hydra-crawler 1.4.5 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/apis/autocomplete.api.d.ts +7 -0
- package/dist/apis/autocomplete.api.js +15 -9
- package/dist/apis/autocomplete.api.js.map +1 -0
- package/dist/apis/bugs.api.d.ts +7 -0
- package/dist/apis/bugs.api.js +21 -15
- package/dist/apis/bugs.api.js.map +1 -0
- package/dist/apis/crawl.api.d.ts +7 -0
- package/dist/apis/crawl.api.js +15 -9
- package/dist/apis/crawl.api.js.map +1 -0
- package/dist/apis/domains.api.d.ts +7 -0
- package/dist/apis/domains.api.js +24 -19
- package/dist/apis/domains.api.js.map +1 -0
- package/dist/apis/images.api.d.ts +7 -0
- package/dist/apis/images.api.js +20 -14
- package/dist/apis/images.api.js.map +1 -0
- package/dist/apis/statistics.api.d.ts +8 -0
- package/dist/apis/statistics.api.js +27 -20
- package/dist/apis/statistics.api.js.map +1 -0
- package/dist/apis/test.api.d.ts +5 -0
- package/dist/apis/test.api.js +15 -9
- package/dist/apis/test.api.js.map +1 -0
- package/dist/apis/urls.api.d.ts +7 -0
- package/dist/apis/urls.api.js +21 -15
- package/dist/apis/urls.api.js.map +1 -0
- package/dist/apps/cleanup.app.d.ts +19 -0
- package/dist/apps/cleanup.app.js +118 -100
- package/dist/apps/cleanup.app.js.map +1 -0
- package/dist/apps/cross-populate-export.app.d.ts +12 -0
- package/dist/apps/cross-populate-export.app.js +60 -47
- package/dist/apps/cross-populate-export.app.js.map +1 -0
- package/dist/apps/cross-populate-import.app.d.ts +12 -0
- package/dist/apps/cross-populate-import.app.js +64 -51
- package/dist/apps/cross-populate-import.app.js.map +1 -0
- package/dist/apps/denylist.app.d.ts +17 -0
- package/dist/apps/denylist.app.js +115 -98
- package/dist/apps/denylist.app.js.map +1 -0
- package/dist/apps/expire.app.d.ts +19 -0
- package/dist/apps/expire.app.js +44 -31
- package/dist/apps/expire.app.js.map +1 -0
- package/dist/apps/extract-text.app.d.ts +8 -0
- package/dist/apps/extract-text.app.js +43 -35
- package/dist/apps/extract-text.app.js.map +1 -0
- package/dist/apps/hydra.app.d.ts +34 -0
- package/dist/apps/hydra.app.js +150 -137
- package/dist/apps/hydra.app.js.map +1 -0
- package/dist/apps/import.app.d.ts +11 -0
- package/dist/apps/import.app.js +44 -32
- package/dist/apps/import.app.js.map +1 -0
- package/dist/apps/internal-hydra-common.app.d.ts +28 -0
- package/dist/apps/internal-hydra-common.app.js +5 -11
- package/dist/apps/internal-hydra-common.app.js.map +1 -0
- package/dist/apps/query.app.d.ts +20 -0
- package/dist/apps/query.app.js +63 -49
- package/dist/apps/query.app.js.map +1 -0
- package/dist/apps/reattempt.app.d.ts +17 -0
- package/dist/apps/reattempt.app.js +66 -53
- package/dist/apps/reattempt.app.js.map +1 -0
- package/dist/apps/requeue-domain.app.d.ts +13 -0
- package/dist/apps/requeue-domain.app.js +50 -37
- package/dist/apps/requeue-domain.app.js.map +1 -0
- package/dist/apps/seed.app.d.ts +15 -0
- package/dist/apps/seed.app.js +53 -40
- package/dist/apps/seed.app.js.map +1 -0
- package/dist/apps/startup.app.d.ts +11 -0
- package/dist/apps/startup.app.js +51 -38
- package/dist/apps/startup.app.js.map +1 -0
- package/dist/apps/unarchive.app.d.ts +15 -0
- package/dist/apps/unarchive.app.js +67 -54
- package/dist/apps/unarchive.app.js.map +1 -0
- package/dist/classes/cleaner.d.ts +12 -0
- package/dist/classes/cleaner.js +227 -207
- package/dist/classes/cleaner.js.map +1 -0
- package/dist/classes/crawler.d.ts +34 -0
- package/dist/classes/crawler.js +248 -241
- package/dist/classes/crawler.js.map +1 -0
- package/dist/classes/dns.d.ts +3 -0
- package/dist/classes/dns.js +10 -13
- package/dist/classes/dns.js.map +1 -0
- package/dist/classes/expirer.d.ts +10 -0
- package/dist/classes/expirer.js +107 -94
- package/dist/classes/expirer.js.map +1 -0
- package/dist/classes/expiry.d.ts +8 -0
- package/dist/classes/expiry.js +16 -19
- package/dist/classes/expiry.js.map +1 -0
- package/dist/classes/lists.d.ts +9 -0
- package/dist/classes/lists.js +13 -18
- package/dist/classes/lists.js.map +1 -0
- package/dist/classes/robot.d.ts +15 -0
- package/dist/classes/robot.js +40 -30
- package/dist/classes/robot.js.map +1 -0
- package/dist/classes/tracker.d.ts +25 -0
- package/dist/classes/tracker.js +82 -64
- package/dist/classes/tracker.js.map +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +72 -65
- package/dist/cli.js.map +1 -0
- package/dist/enums/eavailable-strategy.d.ts +4 -0
- package/dist/enums/eavailable-strategy.js +3 -5
- package/dist/enums/eavailable-strategy.js.map +1 -0
- package/dist/enums/elist.d.ts +7 -0
- package/dist/enums/elist.js +7 -11
- package/dist/enums/elist.js.map +1 -0
- package/dist/enums/eserver.d.ts +8 -0
- package/dist/enums/eserver.js +3 -5
- package/dist/enums/eserver.js.map +1 -0
- package/dist/enums/ex-powered-by.d.ts +6 -0
- package/dist/enums/ex-powered-by.js +3 -5
- package/dist/enums/ex-powered-by.js.map +1 -0
- package/dist/helpers/matcher.d.ts +5 -0
- package/dist/helpers/matcher.js +2 -5
- package/dist/helpers/matcher.js.map +1 -0
- package/dist/helpers/random.d.ts +4 -0
- package/dist/helpers/random.js +2 -5
- package/dist/helpers/random.js.map +1 -0
- package/dist/helpers/utf-decoder.d.ts +4 -0
- package/dist/helpers/utf-decoder.js +3 -6
- package/dist/helpers/utf-decoder.js.map +1 -0
- package/dist/interfaces/iexpiry.d.ts +7 -0
- package/dist/interfaces/iexpiry.js +9 -13
- package/dist/interfaces/iexpiry.js.map +1 -0
- package/dist/interfaces/imatch.d.ts +6 -0
- package/dist/interfaces/imatch.js +6 -9
- package/dist/interfaces/imatch.js.map +1 -0
- package/dist/interfaces/iparser-config.d.ts +4 -0
- package/dist/interfaces/iparser-config.js +4 -7
- package/dist/interfaces/iparser-config.js.map +1 -0
- package/dist/interfaces/iparser.d.ts +8 -0
- package/dist/interfaces/iparser.js +2 -2
- package/dist/interfaces/iparser.js.map +1 -0
- package/dist/interfaces/irequest-outcome.d.ts +11 -0
- package/dist/interfaces/irequest-outcome.js +2 -2
- package/dist/interfaces/irequest-outcome.js.map +1 -0
- package/dist/interfaces/iserver.d.ts +4 -0
- package/dist/interfaces/iserver.js +2 -2
- package/dist/interfaces/iserver.js.map +1 -0
- package/dist/parsers/accessibility-metrics.parser.d.ts +11 -0
- package/dist/parsers/accessibility-metrics.parser.js +34 -26
- package/dist/parsers/accessibility-metrics.parser.js.map +1 -0
- package/dist/parsers/asp-error.parser.d.ts +12 -0
- package/dist/parsers/asp-error.parser.js +36 -28
- package/dist/parsers/asp-error.parser.js.map +1 -0
- package/dist/parsers/bad-words.parser.d.ts +10 -0
- package/dist/parsers/bad-words.parser.js +21 -13
- package/dist/parsers/bad-words.parser.js.map +1 -0
- package/dist/parsers/complex-english.parser.d.ts +15 -0
- package/dist/parsers/complex-english.parser.js +33 -25
- package/dist/parsers/complex-english.parser.js.map +1 -0
- package/dist/parsers/data.parser.d.ts +14 -0
- package/dist/parsers/data.parser.js +12 -16
- package/dist/parsers/data.parser.js.map +1 -0
- package/dist/parsers/dictionary.parser.d.ts +19 -0
- package/dist/parsers/dictionary.parser.js +47 -39
- package/dist/parsers/dictionary.parser.js.map +1 -0
- package/dist/parsers/html.parser.d.ts +13 -0
- package/dist/parsers/html.parser.js +4 -8
- package/dist/parsers/html.parser.js.map +1 -0
- package/dist/parsers/hyperlinks.parser.d.ts +20 -0
- package/dist/parsers/hyperlinks.parser.js +82 -77
- package/dist/parsers/hyperlinks.parser.js.map +1 -0
- package/dist/parsers/image-tags.parser.d.ts +20 -0
- package/dist/parsers/image-tags.parser.js +38 -34
- package/dist/parsers/image-tags.parser.js.map +1 -0
- package/dist/parsers/jpeg.parser.d.ts +11 -0
- package/dist/parsers/jpeg.parser.js +28 -20
- package/dist/parsers/jpeg.parser.js.map +1 -0
- package/dist/parsers/paragraphs.parser.d.ts +13 -0
- package/dist/parsers/paragraphs.parser.js +33 -40
- package/dist/parsers/paragraphs.parser.js.map +1 -0
- package/dist/parsers/parser.d.ts +19 -0
- package/dist/parsers/parser.js +30 -17
- package/dist/parsers/parser.js.map +1 -0
- package/dist/parsers/php-error.parser.d.ts +12 -0
- package/dist/parsers/php-error.parser.js +42 -34
- package/dist/parsers/php-error.parser.js.map +1 -0
- package/dist/parsers/phrase.parser.d.ts +8 -0
- package/dist/parsers/phrase.parser.js +16 -11
- package/dist/parsers/phrase.parser.js.map +1 -0
- package/dist/parsers/regex.parser.d.ts +10 -0
- package/dist/parsers/regex.parser.js +30 -22
- package/dist/parsers/regex.parser.js.map +1 -0
- package/dist/parsers/server.parser.d.ts +12 -0
- package/dist/parsers/server.parser.js +66 -56
- package/dist/parsers/server.parser.js.map +1 -0
- package/dist/parsers/spelling.parser.d.ts +10 -0
- package/dist/parsers/spelling.parser.js +21 -13
- package/dist/parsers/spelling.parser.js.map +1 -0
- package/dist/parsers/string.parser.d.ts +8 -0
- package/dist/parsers/string.parser.js +5 -8
- package/dist/parsers/string.parser.js.map +1 -0
- package/dist/parsers/text.parser.d.ts +8 -0
- package/dist/parsers/text.parser.js +24 -18
- package/dist/parsers/text.parser.js.map +1 -0
- package/dist/parsers/words.parser.d.ts +11 -0
- package/dist/parsers/words.parser.js +32 -28
- package/dist/parsers/words.parser.js.map +1 -0
- package/dist/queries/complex-english.query.d.ts +2 -0
- package/dist/queries/complex-english.query.js +37 -38
- package/dist/queries/complex-english.query.js.map +1 -0
- package/dist/queries/flash-content.query.d.ts +2 -0
- package/dist/queries/flash-content.query.js +45 -32
- package/dist/queries/flash-content.query.js.map +1 -0
- package/dist/queries/linking-to-domains.query.d.ts +2 -0
- package/dist/queries/linking-to-domains.query.js +35 -27
- package/dist/queries/linking-to-domains.query.js.map +1 -0
- package/dist/queries/readability-score.query.d.ts +2 -0
- package/dist/queries/readability-score.query.js +21 -13
- package/dist/queries/readability-score.query.js.map +1 -0
- package/dist/servers/crawl.server.d.ts +35 -0
- package/dist/servers/crawl.server.js +133 -121
- package/dist/servers/crawl.server.js.map +1 -0
- package/dist/servers/express.server.d.ts +8 -0
- package/dist/servers/express.server.js +7 -10
- package/dist/servers/express.server.js.map +1 -0
- package/dist/servers/maintenance.server.d.ts +22 -0
- package/dist/servers/maintenance.server.js +42 -36
- package/dist/servers/maintenance.server.js.map +1 -0
- package/dist/servers/rest.server.d.ts +7 -0
- package/dist/servers/rest.server.js +40 -51
- package/dist/servers/rest.server.js.map +1 -0
- package/dist/servers/socket-io.server.d.ts +12 -0
- package/dist/servers/socket-io.server.js +48 -15
- package/dist/servers/socket-io.server.js.map +1 -0
- package/dist/services/database.service.d.ts +68 -0
- package/dist/services/database.service.js +527 -462
- package/dist/services/database.service.js.map +1 -0
- package/dist/types/tcrawl-config.d.ts +14 -0
- package/dist/types/tcrawl-config.js +14 -17
- package/dist/types/tcrawl-config.js.map +1 -0
- package/dist/types/thydra-config.d.ts +4 -0
- package/dist/types/thydra-config.js +4 -7
- package/dist/types/thydra-config.js.map +1 -0
- package/dist/types/tparser-ctor.d.ts +7 -0
- package/dist/types/tparser-ctor.js +2 -2
- package/dist/types/tparser-ctor.js.map +1 -0
- package/dist/types/tquery.d.ts +7 -0
- package/dist/types/tquery.js +2 -2
- package/dist/types/tquery.js.map +1 -0
- package/dist/types/trobots-config.d.ts +4 -0
- package/dist/types/trobots-config.js +4 -7
- package/dist/types/trobots-config.js.map +1 -0
- package/package.json +41 -29
- package/angular/10-es2015.bacd4ae5dd7913ce55f0.js +0 -1
- package/angular/10-es5.bacd4ae5dd7913ce55f0.js +0 -1
- package/angular/11-es2015.0f031dcf752d1e8eda6b.js +0 -1
- package/angular/11-es5.0f031dcf752d1e8eda6b.js +0 -1
- package/angular/3rdpartylicenses.txt +0 -1127
- package/angular/5-es2015.951498ca9c1bc74e57bf.js +0 -1
- package/angular/5-es5.951498ca9c1bc74e57bf.js +0 -1
- package/angular/6-es2015.65f680261a3506b88381.js +0 -1
- package/angular/6-es5.65f680261a3506b88381.js +0 -1
- package/angular/7-es2015.625197f3af1dbf3e805d.js +0 -1
- package/angular/7-es5.625197f3af1dbf3e805d.js +0 -1
- package/angular/8-es2015.55518901987a5b834309.js +0 -1
- package/angular/8-es5.55518901987a5b834309.js +0 -1
- package/angular/9-es2015.6cc9bde262564e7836f2.js +0 -1
- package/angular/9-es5.6cc9bde262564e7836f2.js +0 -1
- package/angular/Roboto-Black.41ed1105a6ebb8ffe34e.woff2 +0 -0
- package/angular/Roboto-Black.937491dfcbe64ca9a9f1.woff +0 -0
- package/angular/Roboto-BlackItalic.2e1ee657996854c6f427.woff +0 -0
- package/angular/Roboto-BlackItalic.50ca4c51ebc27e7e7d2f.woff2 +0 -0
- package/angular/Roboto-Bold.73288d91c325e82a5b92.woff +0 -0
- package/angular/Roboto-Bold.92fbd4e93cf0a5dbebaa.woff2 +0 -0
- package/angular/Roboto-BoldItalic.5f600d98a73d800ae575.woff2 +0 -0
- package/angular/Roboto-BoldItalic.6d89acbd21d7e3fbecb2.woff +0 -0
- package/angular/Roboto-Light.c27d89ac77468ae18f28.woff2 +0 -0
- package/angular/Roboto-Light.d923dfafc0c5183b59aa.woff +0 -0
- package/angular/Roboto-LightItalic.506274c7228cf81cae4d.woff2 +0 -0
- package/angular/Roboto-LightItalic.d4b8c137518d9d92bb28.woff +0 -0
- package/angular/Roboto-Medium.092c6130df8fd2199888.woff +0 -0
- package/angular/Roboto-Medium.1d3bced88509b0838984.woff2 +0 -0
- package/angular/Roboto-MediumItalic.18ff1628c628080166c1.woff +0 -0
- package/angular/Roboto-MediumItalic.d620b8f53f75966fe42e.woff2 +0 -0
- package/angular/Roboto-Regular.64cfb66c866ea50cad47.woff2 +0 -0
- package/angular/Roboto-Regular.e02e9d6ff5547f7e9962.woff +0 -0
- package/angular/Roboto-RegularItalic.4dd2af1e8df532f41db8.woff2 +0 -0
- package/angular/Roboto-RegularItalic.5ea38fff9eebef99c5df.woff +0 -0
- package/angular/Roboto-Thin.dbd56bd3357dc3617fe5.woff2 +0 -0
- package/angular/Roboto-Thin.e7f7c82374bd0ebef14b.woff +0 -0
- package/angular/Roboto-ThinItalic.5dd9349c940073834e9a.woff +0 -0
- package/angular/Roboto-ThinItalic.a8cef84f735ef887abdc.woff2 +0 -0
- package/angular/assets/config/app-config.json +0 -16
- package/angular/assets/images/splashbg.jpg +0 -0
- package/angular/assets/web-app-commons/fonts/material-icons/MaterialDesignIcons-Community-2.7.94.woff +0 -0
- package/angular/assets/web-app-commons/fonts/material-icons/MaterialDesignIcons-Community-2.7.94.woff2 +0 -0
- package/angular/assets/web-app-commons/fonts/material-icons/material-design-icons-community.css +0 -11293
- package/angular/favicon.ico +0 -0
- package/angular/flUhRq6tzZclQEJ-Vdg-IuiaDsNa.f2a0933406f783065152.woff +0 -0
- package/angular/flUhRq6tzZclQEJ-Vdg-IuiaDsNc.6467d9a24f234e8e8e07.woff2 +0 -0
- package/angular/index.html +0 -16
- package/angular/main-es2015.3a582572476c7f292e52.js +0 -1
- package/angular/main-es5.3a582572476c7f292e52.js +0 -1
- package/angular/polyfills-es2015.7df68534018bc2f6cb09.js +0 -1
- package/angular/polyfills-es5.e79468f406fae2989221.js +0 -1
- package/angular/runtime-es2015.6d2cff76cdb2790d3308.js +0 -1
- package/angular/runtime-es5.6d2cff76cdb2790d3308.js +0 -1
- package/angular/styles.c5c6c2534225b85c4ff0.css +0 -1
- package/config/bad-words.json +0 -1
- package/config/complex-english.json +0 -400
- package/config/hydra-auth.json +0 -8
- package/config/hydra-crawler.json +0 -84
- package/config/list-allow.json +0 -171
- package/config/list-deny.json +0 -248
- package/config/list-expiry.json +0 -7
- package/config/schedule.json +0 -25
- package/config/spelling.json +0 -1
package/dist/apps/query.app.js
CHANGED
|
@@ -1,23 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { commonsTypeIsTKeyObject } from 'tscommons-es-core';
|
|
11
|
+
import { commonsOutputDebug, commonsOutputDoing, commonsOutputSuccess } from 'nodecommons-es-cli';
|
|
12
|
+
import { CommonsApp } from 'nodecommons-es-app';
|
|
13
|
+
import { commonsFileCwdRelativeOrAbsolutePath, commonsFileIsDirectory, commonsFileIsFile, commonsFileRootRelativePath } from 'nodecommons-es-file';
|
|
14
|
+
import { Lists } from '../classes/lists';
|
|
15
|
+
import { Expiry } from '../classes/expiry';
|
|
16
|
+
import { isIParserConfig } from '../interfaces/iparser-config';
|
|
17
|
+
export class QueryApp extends CommonsApp {
|
|
12
18
|
constructor(queryName) {
|
|
13
19
|
super('hydra-crawler');
|
|
14
20
|
this.queryName = queryName;
|
|
15
21
|
if (/[^-a-z0-9]/i.test(queryName))
|
|
16
22
|
throw new Error('Invalid query name');
|
|
17
|
-
this.lists = new
|
|
18
|
-
this.expiry = new
|
|
23
|
+
this.lists = new Lists();
|
|
24
|
+
this.expiry = new Expiry();
|
|
19
25
|
const parsersConfig = this.getConfigArea('parsers');
|
|
20
|
-
if (!
|
|
26
|
+
if (!commonsTypeIsTKeyObject(parsersConfig, isIParserConfig))
|
|
21
27
|
throw new Error('Parsers config is not valid');
|
|
22
28
|
this.parsersConfig = parsersConfig;
|
|
23
29
|
}
|
|
@@ -33,41 +39,49 @@ class QueryApp extends nodecommons_app_1.CommonsApp {
|
|
|
33
39
|
addToExpiry(expiries) {
|
|
34
40
|
this.expiry.add(expiries);
|
|
35
41
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
init() {
|
|
43
|
+
const _super = Object.create(null, {
|
|
44
|
+
init: { get: () => super.init }
|
|
45
|
+
});
|
|
46
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
47
|
+
if (!this.databaseService)
|
|
48
|
+
throw new Error('Database service has not been set yet');
|
|
49
|
+
commonsOutputDoing('Connecting to database');
|
|
50
|
+
yield this.databaseService.init();
|
|
51
|
+
commonsOutputSuccess();
|
|
52
|
+
yield _super.init.call(this);
|
|
53
|
+
});
|
|
43
54
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
55
|
+
run() {
|
|
56
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
57
|
+
if (!this.databaseService)
|
|
58
|
+
throw new Error('Database service has not been set');
|
|
59
|
+
const paths = [];
|
|
60
|
+
const cwdNodeModulesConfig = commonsFileCwdRelativeOrAbsolutePath('dist/queries');
|
|
61
|
+
commonsOutputDebug(`Calculated cwd node_modules path for queries is ${cwdNodeModulesConfig}`);
|
|
62
|
+
if (commonsFileIsDirectory(cwdNodeModulesConfig))
|
|
63
|
+
paths.push(cwdNodeModulesConfig);
|
|
64
|
+
const localNodeModulesConfig = commonsFileRootRelativePath('dist/queries');
|
|
65
|
+
commonsOutputDebug(`Calculated global node_modules path for queries is ${localNodeModulesConfig}`);
|
|
66
|
+
if (commonsFileIsDirectory(localNodeModulesConfig))
|
|
67
|
+
paths.push(localNodeModulesConfig);
|
|
68
|
+
const globalNodeModulesConfig = commonsFileRootRelativePath('node_modules/hydra-crawler/dist/queries');
|
|
69
|
+
commonsOutputDebug(`Calculated global node_modules path for queries is ${globalNodeModulesConfig}`);
|
|
70
|
+
if (commonsFileIsDirectory(globalNodeModulesConfig))
|
|
71
|
+
paths.push(globalNodeModulesConfig);
|
|
72
|
+
const exists = paths
|
|
73
|
+
.filter((p) => commonsFileIsDirectory(p));
|
|
74
|
+
if (exists.length === 0)
|
|
75
|
+
throw new Error('Unable to derive queries path');
|
|
76
|
+
commonsOutputDebug(`Selected path is: ${exists[0]}`);
|
|
77
|
+
const path = `${exists[0]}/${this.queryName}.query.js`;
|
|
78
|
+
commonsOutputDebug(`Query file path is: ${path}`);
|
|
79
|
+
if (!commonsFileIsFile(path))
|
|
80
|
+
throw new Error('No such query exists');
|
|
81
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-var-requires
|
|
82
|
+
const query = require(path).default;
|
|
83
|
+
yield query(this.getArgs(), this.databaseService, this.lists, this.expiry, this.parsersConfig);
|
|
84
|
+
});
|
|
71
85
|
}
|
|
72
86
|
}
|
|
73
|
-
|
|
87
|
+
//# sourceMappingURL=query.app.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query.app.js","sourceRoot":"","sources":["../../src/apps/query.app.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,uBAAuB,EAAc,MAAM,mBAAmB,CAAC;AAExE,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAClG,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;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AAqB,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;YAErD,MAAM,IAAI,GAAW,GAAG,MAAM,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,SAAS,WAAW,CAAC;YAC/D,kBAAkB,CAAC,uBAAuB,IAAI,EAAE,CAAC,CAAC;YAElD,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC;gBAAE,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;YAEtE,mJAAmJ;YACnJ,MAAM,KAAK,GAAW,OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC;YAE5C,MAAM,KAAK,CACT,IAAI,CAAC,OAAO,EAAE,EACd,IAAI,CAAC,eAAe,EACpB,IAAI,CAAC,KAAK,EACV,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,aAAa,CACnB,CAAC;QACH,CAAC;KAAA;CACD"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { EStatus } from 'hydra-crawler-ts-assets';
|
|
2
|
+
import { CommonsApp } from 'nodecommons-es-app';
|
|
3
|
+
import { DatabaseService } from '../services/database.service';
|
|
4
|
+
import { IMatch } from '../interfaces/imatch';
|
|
5
|
+
import { EList } from '../enums/elist';
|
|
6
|
+
import { IInternalHydraCommonListApp } from './internal-hydra-common.app';
|
|
7
|
+
export declare class ReattemptApp extends CommonsApp implements IInternalHydraCommonListApp {
|
|
8
|
+
private include;
|
|
9
|
+
private databaseService;
|
|
10
|
+
private lists;
|
|
11
|
+
constructor(include: EStatus[]);
|
|
12
|
+
getAppName(): string;
|
|
13
|
+
setDatabaseService(databaseService: DatabaseService): void;
|
|
14
|
+
addToList(list: EList, entries: IMatch[]): void;
|
|
15
|
+
init(): Promise<void>;
|
|
16
|
+
run(): Promise<void>;
|
|
17
|
+
}
|
|
@@ -1,16 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { EStatus } from 'hydra-crawler-ts-assets';
|
|
11
|
+
import { commonsOutputDoing, commonsOutputProgress, commonsOutputResult, commonsOutputSuccess } from 'nodecommons-es-cli';
|
|
12
|
+
import { CommonsApp } from 'nodecommons-es-app';
|
|
13
|
+
import { Lists } from '../classes/lists';
|
|
14
|
+
import { EList } from '../enums/elist';
|
|
15
|
+
export class ReattemptApp extends CommonsApp {
|
|
10
16
|
constructor(include) {
|
|
11
17
|
super('hydra-crawler');
|
|
12
18
|
this.include = include;
|
|
13
|
-
this.lists = new
|
|
19
|
+
this.lists = new Lists();
|
|
14
20
|
}
|
|
15
21
|
getAppName() {
|
|
16
22
|
return 'Hydra - Reattempt';
|
|
@@ -21,50 +27,57 @@ class ReattemptApp extends nodecommons_app_1.CommonsApp {
|
|
|
21
27
|
addToList(list, entries) {
|
|
22
28
|
this.lists.add(list, entries);
|
|
23
29
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
init() {
|
|
31
|
+
const _super = Object.create(null, {
|
|
32
|
+
init: { get: () => super.init }
|
|
33
|
+
});
|
|
34
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
if (!this.databaseService)
|
|
36
|
+
throw new Error('Database service has not been set yet');
|
|
37
|
+
commonsOutputDoing('Connecting to database');
|
|
38
|
+
yield this.databaseService.init();
|
|
39
|
+
commonsOutputSuccess();
|
|
40
|
+
yield _super.init.call(this);
|
|
41
|
+
});
|
|
31
42
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
.
|
|
39
|
-
|
|
43
|
+
run() {
|
|
44
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
45
|
+
if (!this.databaseService)
|
|
46
|
+
throw new Error('Database service has not been set');
|
|
47
|
+
let tally = 0;
|
|
48
|
+
commonsOutputDoing(`Searching for allowlisted ${this.include.join(' and ')}`);
|
|
49
|
+
const results = this.databaseService.getUrls()
|
|
50
|
+
.find({
|
|
51
|
+
status: { $in: this.include }
|
|
52
|
+
}, {});
|
|
53
|
+
const urls = [];
|
|
54
|
+
tally = 0;
|
|
55
|
+
while (true) {
|
|
56
|
+
if ((tally % 100) === 0)
|
|
57
|
+
commonsOutputProgress(tally);
|
|
58
|
+
const row = yield results.next();
|
|
59
|
+
if (row === null)
|
|
60
|
+
break;
|
|
61
|
+
if (!this.lists.match(EList.ALLOW, row.url))
|
|
62
|
+
continue;
|
|
63
|
+
urls.push(row.url);
|
|
64
|
+
tally++;
|
|
65
|
+
}
|
|
66
|
+
commonsOutputResult(tally);
|
|
67
|
+
commonsOutputDoing('Requeuing matches');
|
|
68
|
+
tally = 0;
|
|
69
|
+
for (const url of urls) {
|
|
70
|
+
tally++;
|
|
71
|
+
if ((tally % 10) === 0)
|
|
72
|
+
commonsOutputProgress(tally);
|
|
73
|
+
yield this.databaseService.getUrls()
|
|
74
|
+
.updateOne({ url: url }, {
|
|
75
|
+
$set: { status: EStatus.QUEUED },
|
|
76
|
+
$unset: { ttl: 1 }
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
commonsOutputResult(tally);
|
|
40
80
|
});
|
|
41
|
-
const urls = [];
|
|
42
|
-
tally = 0;
|
|
43
|
-
while (true) {
|
|
44
|
-
if ((tally % 100) === 0)
|
|
45
|
-
nodecommons_cli_1.CommonsOutput.progress(tally);
|
|
46
|
-
const row = await results.next();
|
|
47
|
-
if (row === null)
|
|
48
|
-
break;
|
|
49
|
-
if (!this.lists.match(elist_1.EList.ALLOW, row.url))
|
|
50
|
-
continue;
|
|
51
|
-
urls.push(row.url);
|
|
52
|
-
tally++;
|
|
53
|
-
}
|
|
54
|
-
nodecommons_cli_1.CommonsOutput.result(tally);
|
|
55
|
-
nodecommons_cli_1.CommonsOutput.doing(`Requeuing matches`);
|
|
56
|
-
tally = 0;
|
|
57
|
-
for (const url of urls) {
|
|
58
|
-
tally++;
|
|
59
|
-
if ((tally % 10) === 0)
|
|
60
|
-
nodecommons_cli_1.CommonsOutput.progress(tally);
|
|
61
|
-
await this.databaseService.getUrls()
|
|
62
|
-
.updateOne({ url: url }, {
|
|
63
|
-
$set: { status: hydra_crawler_ts_assets_1.EStatus.QUEUED },
|
|
64
|
-
$unset: { ttl: 1 }
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
nodecommons_cli_1.CommonsOutput.result(tally);
|
|
68
81
|
}
|
|
69
82
|
}
|
|
70
|
-
|
|
83
|
+
//# sourceMappingURL=reattempt.app.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reattempt.app.js","sourceRoot":"","sources":["../../src/apps/reattempt.app.ts"],"names":[],"mappings":";;;;;;;;;AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAGlD,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1H,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAMzC,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAI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IAAI,CAAC,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC;oBAAE,qBAAqB,CAAC,KAAK,CAAC,CAAC;gBAEtD,MAAM,GAAG,GAAc,MAAM,OAAO,CAAC,IAAI,EAAE,CAAC;gBAC5C,IAAI,GAAG,KAAK,IAAI;oBAAE,MAAM;gBAExB,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,GAAG,CAAC;oBAAE,SAAS;gBAEtD,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;gBAEnB,KAAK,EAAE,CAAC;aACR;YACD,mBAAmB,CAAC,KAAK,CAAC,CAAC;YAE3B,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;YACxC,KAAK,GAAG,CAAC,CAAC;YACV,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE;gBACvB,KAAK,EAAE,CAAC;gBACR,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC,KAAK,CAAC;oBAAE,qBAAqB,CAAC,KAAK,CAAC,CAAC;gBAErD,MAAM,IAAI,CAAC,eAAe,CAAC,OAAO,EAAE;qBACjC,SAAS,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE;oBACvB,IAAI,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE;oBAChC,MAAM,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE;iBACnB,CAAC,CAAC;aACL;YACD,mBAAmB,CAAC,KAAK,CAAC,CAAC;QAC5B,CAAC;KAAA;CACD"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CommonsApp } from 'nodecommons-es-app';
|
|
2
|
+
import { DatabaseService } from '../services/database.service';
|
|
3
|
+
import { IInternalHydraCommonDbApp } from './internal-hydra-common.app';
|
|
4
|
+
export declare class RequeueDomainApp extends CommonsApp implements IInternalHydraCommonDbApp {
|
|
5
|
+
private domain;
|
|
6
|
+
private done200Only;
|
|
7
|
+
private databaseService;
|
|
8
|
+
constructor(domain: string, done200Only: boolean);
|
|
9
|
+
getAppName(): string;
|
|
10
|
+
setDatabaseService(databaseService: DatabaseService): void;
|
|
11
|
+
init(): Promise<void>;
|
|
12
|
+
run(): Promise<void>;
|
|
13
|
+
}
|
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { EStatus } from 'hydra-crawler-ts-assets';
|
|
11
|
+
import { commonsOutputDoing, commonsOutputSuccess } from 'nodecommons-es-cli';
|
|
12
|
+
import { CommonsApp } from 'nodecommons-es-app';
|
|
13
|
+
export class RequeueDomainApp extends CommonsApp {
|
|
8
14
|
constructor(domain, done200Only) {
|
|
9
15
|
super('hydra-crawler');
|
|
10
16
|
this.domain = domain;
|
|
@@ -16,36 +22,43 @@ class RequeueDomainApp extends nodecommons_app_1.CommonsApp {
|
|
|
16
22
|
setDatabaseService(databaseService) {
|
|
17
23
|
this.databaseService = databaseService;
|
|
18
24
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
init() {
|
|
26
|
+
const _super = Object.create(null, {
|
|
27
|
+
init: { get: () => super.init }
|
|
28
|
+
});
|
|
29
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
if (!this.databaseService)
|
|
31
|
+
throw new Error('Database service has not been set yet');
|
|
32
|
+
commonsOutputDoing('Connecting to database');
|
|
33
|
+
yield this.databaseService.init();
|
|
34
|
+
commonsOutputSuccess();
|
|
35
|
+
yield _super.init.call(this);
|
|
36
|
+
});
|
|
26
37
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
38
|
+
run() {
|
|
39
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
if (!this.databaseService)
|
|
41
|
+
throw new Error('Database service has not been set');
|
|
42
|
+
const conditions = {
|
|
43
|
+
domain: this.domain,
|
|
44
|
+
status: { $in: [] }
|
|
45
|
+
};
|
|
46
|
+
if (this.done200Only) {
|
|
47
|
+
conditions.status.$in = [EStatus.DONE];
|
|
48
|
+
conditions.statusCode = 200;
|
|
49
|
+
commonsOutputDoing(`Marking all 200 DONE as QUEUED for ${this.domain}`);
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
conditions.status.$in = [
|
|
53
|
+
EStatus.DONE,
|
|
54
|
+
EStatus.FAILED
|
|
55
|
+
];
|
|
56
|
+
commonsOutputDoing(`Marking all DONE and FAILED as QUEUED for ${this.domain}`);
|
|
57
|
+
}
|
|
58
|
+
yield this.databaseService.getUrls()
|
|
59
|
+
.updateMany(conditions, { $set: { status: EStatus.QUEUED } });
|
|
60
|
+
commonsOutputSuccess();
|
|
61
|
+
});
|
|
49
62
|
}
|
|
50
63
|
}
|
|
51
|
-
|
|
64
|
+
//# sourceMappingURL=requeue-domain.app.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"requeue-domain.app.js","sourceRoot":"","sources":["../../src/apps/requeue-domain.app.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAElD,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAMhD,MAAM,OAAO,gBAAiB,SAAQ,UAAU;IAG/C,YACU,MAAc,EACd,WAAoB;QAE7B,KAAK,CAAC,eAAe,CAAC,CAAC;QAHd,WAAM,GAAN,MAAM,CAAQ;QACd,gBAAW,GAAX,WAAW,CAAS;IAG9B,CAAC;IAEM,UAAU;QAChB,OAAO,wBAAwB,CAAC;IACjC,CAAC;IAEM,kBAAkB,CACvB,eAAgC;QAEjC,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;IACxC,CAAC;IAEY,IAAI;;;;;YAChB,IAAI,CAAC,IAAI,CAAC,eAAe;gBAAE,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;YAEpF,kBAAkB,CAAC,wBAAwB,CAAC,CAAC;YAC7C,MAAM,IAAI,CAAC,eAAe,CAAC,IAAI,EAAE,CAAC;YAClC,oBAAoB,EAAE,CAAC;YAEvB,MAAM,OAAM,IAAI,WAAE,CAAC;QACpB,CAAC;KAAA;IAEY,GAAG;;YACf,IAAI,CAAC,IAAI,CAAC,eAAe;gBAAE,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;YAEhF,MAAM,UAAU,GAMZ;gBACF,MAAM,EAAE,IAAI,CAAC,MAAM;gBACnB,MAAM,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE;aACpB,CAAC;YAEF,IAAI,IAAI,CAAC,WAAW,EAAE;gBACrB,UAAU,CAAC,MAAM,CAAC,GAAG,GAAG,CAAE,OAAO,CAAC,IAAI,CAAE,CAAC;gBACzC,UAAU,CAAC,UAAU,GAAG,GAAG,CAAC;gBAE5B,kBAAkB,CAAC,sCAAsC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;aACxE;iBAAM;gBACN,UAAU,CAAC,MAAM,CAAC,GAAG,GAAG;oBACtB,OAAO,CAAC,IAAI;oBACZ,OAAO,CAAC,MAAM;iBACf,CAAC;gBAEF,kBAAkB,CAAC,6CAA6C,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;aAC/E;YAED,MAAM,IAAI,CAAC,eAAe,CAAC,OAAO,EAAE;iBACjC,UAAU,CACT,UAAU,EACR,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,EAAE,CACvC,CAAC;YAEJ,oBAAoB,EAAE,CAAC;QACxB,CAAC;KAAA;CACD"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { CommonsApp } from 'nodecommons-es-app';
|
|
2
|
+
import { DatabaseService } from '../services/database.service';
|
|
3
|
+
import { IMatch } from '../interfaces/imatch';
|
|
4
|
+
import { EList } from '../enums/elist';
|
|
5
|
+
import { IInternalHydraCommonListApp } from './internal-hydra-common.app';
|
|
6
|
+
export declare class SeedApp extends CommonsApp implements IInternalHydraCommonListApp {
|
|
7
|
+
private databaseService;
|
|
8
|
+
private lists;
|
|
9
|
+
constructor();
|
|
10
|
+
getAppName(): string;
|
|
11
|
+
setDatabaseService(databaseService: DatabaseService): void;
|
|
12
|
+
addToList(list: EList, entries: IMatch[]): void;
|
|
13
|
+
init(): Promise<void>;
|
|
14
|
+
run(): Promise<void>;
|
|
15
|
+
}
|
package/dist/apps/seed.app.js
CHANGED
|
@@ -1,14 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { commonsOutputDoing, commonsOutputProgress, commonsOutputResult, commonsOutputSuccess } from 'nodecommons-es-cli';
|
|
11
|
+
import { CommonsApp } from 'nodecommons-es-app';
|
|
12
|
+
import { Lists } from '../classes/lists';
|
|
13
|
+
import { EList } from '../enums/elist';
|
|
14
|
+
export class SeedApp extends CommonsApp {
|
|
9
15
|
constructor() {
|
|
10
16
|
super('hydra-crawler');
|
|
11
|
-
this.lists = new
|
|
17
|
+
this.lists = new Lists();
|
|
12
18
|
}
|
|
13
19
|
getAppName() {
|
|
14
20
|
return 'Hydra - Seed';
|
|
@@ -19,38 +25,45 @@ class SeedApp extends nodecommons_app_1.CommonsApp {
|
|
|
19
25
|
addToList(list, entries) {
|
|
20
26
|
this.lists.add(list, entries);
|
|
21
27
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
init() {
|
|
29
|
+
const _super = Object.create(null, {
|
|
30
|
+
init: { get: () => super.init }
|
|
31
|
+
});
|
|
32
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
33
|
+
if (!this.databaseService)
|
|
34
|
+
throw new Error('Database service has not been set yet');
|
|
35
|
+
commonsOutputDoing('Connecting to database');
|
|
36
|
+
yield this.databaseService.init();
|
|
37
|
+
commonsOutputSuccess();
|
|
38
|
+
yield _super.init.call(this);
|
|
39
|
+
});
|
|
29
40
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
unique.
|
|
39
|
-
|
|
40
|
-
unique.
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
nodecommons_cli_1.CommonsOutput.result(unique.length);
|
|
44
|
-
nodecommons_cli_1.CommonsOutput.doing('Seeding into queue');
|
|
45
|
-
let tally = 0;
|
|
46
|
-
for (const url of unique) {
|
|
47
|
-
const outcome = await this.databaseService.queue(url);
|
|
48
|
-
if (outcome) {
|
|
49
|
-
tally++;
|
|
50
|
-
nodecommons_cli_1.CommonsOutput.progress(tally);
|
|
41
|
+
run() {
|
|
42
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
if (!this.databaseService)
|
|
44
|
+
throw new Error('Database service has not been set');
|
|
45
|
+
commonsOutputDoing('Building allowlist hostname seeds');
|
|
46
|
+
const hostnames = this.lists.listHostnames(EList.ALLOW);
|
|
47
|
+
const unique = [];
|
|
48
|
+
for (const hostname of hostnames) {
|
|
49
|
+
if (!unique.includes(hostname))
|
|
50
|
+
unique.push(`http://${hostname}/`);
|
|
51
|
+
if (!unique.includes(`www.${hostname}`))
|
|
52
|
+
unique.push(`http://www.${hostname}/`);
|
|
53
|
+
commonsOutputProgress(unique.length);
|
|
51
54
|
}
|
|
52
|
-
|
|
53
|
-
|
|
55
|
+
commonsOutputResult(unique.length);
|
|
56
|
+
commonsOutputDoing('Seeding into queue');
|
|
57
|
+
let tally = 0;
|
|
58
|
+
for (const url of unique) {
|
|
59
|
+
const outcome = yield this.databaseService.queue(url);
|
|
60
|
+
if (outcome) {
|
|
61
|
+
tally++;
|
|
62
|
+
commonsOutputProgress(tally);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
commonsOutputResult(tally);
|
|
66
|
+
});
|
|
54
67
|
}
|
|
55
68
|
}
|
|
56
|
-
|
|
69
|
+
//# sour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AAa,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YAElE,MAAM,MAAM,GAAa,EAAE,CAAC;YAC5B,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE;gBACjC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC;oBAAE,MAAM,CAAC,IAAI,CAAC,UAAU,QAAQ,GAAG,CAAC,CAAC;gBACnE,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,QAAQ,EAAE,CAAC;oBAAE,MAAM,CAAC,IAAI,CAAC,cAAc,QAAQ,GAAG,CAAC,CAAC;gBAChF,qBAAqB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;aACrC;YAED,mBAAmB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YAEnC,kBAAkB,CAAC,oBAAoB,CAAC,CAAC;YACzC,IAAI,KAAK,GAAW,CAAC,CAAC;YACtB,KAAK,MAAM,GAAG,IAAI,MAAM,EAAE;gBACzB,MAAM,OAAO,GAAY,MAAM,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBAC/D,IAAI,OAAO,EAAE;oBACZ,KAAK,EAAE,CAAC;oBACR,qBAAqB,CAAC,KAAK,CAAC,CAAC;iBAC7B;aACD;YACD,mBAAmB,CAAC,KAAK,CAAC,CAAC;QAC5B,CAAC;KAAA;CACD"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CommonsApp } from 'nodecommons-es-app';
|
|
2
|
+
import { DatabaseService } from '../services/database.service';
|
|
3
|
+
import { IInternalHydraCommonDbApp } from './internal-hydra-common.app';
|
|
4
|
+
export declare class StartupApp extends CommonsApp implements IInternalHydraCommonDbApp {
|
|
5
|
+
private databaseService;
|
|
6
|
+
constructor();
|
|
7
|
+
getAppName(): string;
|
|
8
|
+
setDatabaseService(databaseService: DatabaseService): void;
|
|
9
|
+
init(): Promise<void>;
|
|
10
|
+
run(): Promise<void>;
|
|
11
|
+
}
|