Compare commits

..

4 Commits
0.4.0 ... 0.4.1

Author SHA1 Message Date
FoxxMD
e790f7c260 Fix issue when activities retrieved for attribution rule 2021-06-25 15:20:31 -04:00
FoxxMD
20358294ce Fix domain ident aliases when not aggregating parent domain 2021-06-25 10:29:19 -04:00
FoxxMD
e0f18dc0a2 Add typescript dep 2021-06-25 10:28:39 -04:00
FoxxMD
9a788a8323 Add file logging for uncaught rejection/exceptions 2021-06-23 16:05:58 -04:00
5 changed files with 41 additions and 31 deletions

58
package-lock.json generated
View File

@@ -5,6 +5,7 @@
"requires": true,
"packages": {
"": {
"name": "redditcontextbot",
"version": "1.0.0",
"license": "ISC",
"dependencies": {
@@ -24,6 +25,7 @@
"safe-stable-stringify": "^1.1.1",
"snoostorm": "^1.5.2",
"snoowrap": "^1.23.0",
"typescript": "^4.3.4",
"winston": "FoxxMD/winston#fbab8de969ecee578981c77846156c7f43b5f01e",
"winston-daily-rotate-file": "^4.5.5",
"zlib": "^1.0.5"
@@ -118,6 +120,19 @@
"typescript": "~4.1.3"
}
},
"node_modules/@ts-morph/common/node_modules/typescript": {
"version": "4.1.6",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.1.6.tgz",
"integrity": "sha512-pxnwLxeb/Z5SP80JDRzVjh58KsM6jZHRAOtTpS7sXLS4ogXNKC9ANxHHZqLLeVHZN35jCtI4JdmLLbLiC1kBow==",
"dev": true,
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
},
"engines": {
"node": ">=4.2.0"
}
},
"node_modules/@tsconfig/node14": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.1.tgz",
@@ -1827,19 +1842,6 @@
"node": ">=10.0.0"
}
},
"node_modules/ts-json-schema-generator/node_modules/typescript": {
"version": "4.3.2",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.3.2.tgz",
"integrity": "sha512-zZ4hShnmnoVnAHpVHWpTcxdv7dWP60S2FsydQLV8V5PbS3FifjWFFRiHSWpDJahly88PRyV5teTSLoq4eG7mKw==",
"dev": true,
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
},
"engines": {
"node": ">=4.2.0"
}
},
"node_modules/ts-morph": {
"version": "9.1.0",
"resolved": "https://registry.npmjs.org/ts-morph/-/ts-morph-9.1.0.tgz",
@@ -1906,10 +1908,9 @@
"integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q="
},
"node_modules/typescript": {
"version": "4.1.5",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.1.5.tgz",
"integrity": "sha512-6OSu9PTIzmn9TCDiovULTnET6BgXtDYL4Gg4szY+cGsc3JP1dQL8qvE8kShTRx1NIw4Q9IBHlwODjkjWEtMUyA==",
"dev": true,
"version": "4.3.4",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.3.4.tgz",
"integrity": "sha512-uauPG7XZn9F/mo+7MrsRjyvbxFpzemRjKEZXS4AK83oP2KKOJPvb+9cO/gmnv8arWZvhnjVOXz7B49m1l0e9Ew==",
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
@@ -2297,6 +2298,14 @@
"mkdirp": "^1.0.4",
"multimatch": "^5.0.0",
"typescript": "~4.1.3"
},
"dependencies": {
"typescript": {
"version": "4.1.6",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.1.6.tgz",
"integrity": "sha512-pxnwLxeb/Z5SP80JDRzVjh58KsM6jZHRAOtTpS7sXLS4ogXNKC9ANxHHZqLLeVHZN35jCtI4JdmLLbLiC1kBow==",
"dev": true
}
}
},
"@tsconfig/node14": {
@@ -3651,14 +3660,6 @@
"glob": "^7.1.7",
"json-stable-stringify": "^1.0.1",
"typescript": "~4.3.2"
},
"dependencies": {
"typescript": {
"version": "4.3.2",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.3.2.tgz",
"integrity": "sha512-zZ4hShnmnoVnAHpVHWpTcxdv7dWP60S2FsydQLV8V5PbS3FifjWFFRiHSWpDJahly88PRyV5teTSLoq4eG7mKw==",
"dev": true
}
}
},
"ts-morph": {
@@ -3712,10 +3713,9 @@
"integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q="
},
"typescript": {
"version": "4.1.5",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.1.5.tgz",
"integrity": "sha512-6OSu9PTIzmn9TCDiovULTnET6BgXtDYL4Gg4szY+cGsc3JP1dQL8qvE8kShTRx1NIw4Q9IBHlwODjkjWEtMUyA==",
"dev": true
"version": "4.3.4",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.3.4.tgz",
"integrity": "sha512-uauPG7XZn9F/mo+7MrsRjyvbxFpzemRjKEZXS4AK83oP2KKOJPvb+9cO/gmnv8arWZvhnjVOXz7B49m1l0e9Ew=="
},
"typescript-json-schema": {
"version": "0.50.1",

View File

@@ -40,6 +40,7 @@
"safe-stable-stringify": "^1.1.1",
"snoostorm": "^1.5.2",
"snoowrap": "^1.23.0",
"typescript": "^4.3.4",
"winston": "FoxxMD/winston#fbab8de969ecee578981c77846156c7f43b5f01e",
"winston-daily-rotate-file": "^4.5.5",
"zlib": "^1.0.5"

View File

@@ -64,6 +64,7 @@ export class App {
const myTransports = [
consoleTransport,
];
let errorTransports = [];
if (logDir !== false) {
let logPath = logDir;
@@ -80,6 +81,7 @@ export class App {
});
// @ts-ignore
myTransports.push(rotateTransport);
errorTransports.push(rotateTransport);
}
const loggerOptions = {
@@ -95,7 +97,9 @@ export class App {
debug: 5,
trace: 5,
silly: 6
}
},
exceptionHandlers: errorTransports,
rejectionHandlers: errorTransports,
};
winston.loggers.add('default', loggerOptions);

View File

@@ -194,6 +194,11 @@ export class AttributionRule extends Rule {
let activityTotal = 0;
let firstActivity, lastActivity;
if(activities.length === 0) {
this.logger.debug(`No activities retrieved for criteria`);
continue;
}
activityTotal = activities.length;
firstActivity = activities[0];
lastActivity = activities[activities.length - 1];

View File

@@ -486,7 +486,7 @@ export const getSubmissionFromComment = async (item: Comment): Promise<Submissio
export const getAttributionIdentifier = (sub: Submission, useParentMediaDomain = false): DomainInfo => {
let domain: string = '';
let displayDomain: string = '';
let domainIdents: string[] = [sub.domain];
let domainIdents: string[] = useParentMediaDomain ? [sub.domain] : [];
let provider: string | undefined;
if (!useParentMediaDomain && sub.secure_media?.oembed !== undefined) {
const {