apify-cli 0.19.3-beta.4 → 1.0.0-beta.0
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/README.md +87 -63
- package/bin/dev.cmd +3 -0
- package/bin/dev.js +16 -0
- package/bin/run.js +16 -0
- package/dist/.tsbuildinfo +1 -0
- package/dist/commands/actor/get-input.d.ts +6 -0
- package/dist/commands/actor/get-input.d.ts.map +1 -0
- package/dist/commands/actor/get-input.js +14 -0
- package/dist/commands/actor/get-input.js.map +1 -0
- package/dist/commands/actor/get-value.d.ts +9 -0
- package/dist/commands/actor/get-value.d.ts.map +1 -0
- package/dist/commands/actor/get-value.js +27 -0
- package/dist/commands/actor/get-value.js.map +1 -0
- package/dist/commands/actor/index.d.ts +6 -0
- package/dist/commands/actor/index.d.ts.map +1 -0
- package/dist/commands/actor/index.js +13 -0
- package/dist/commands/actor/index.js.map +1 -0
- package/dist/commands/actor/push-data.d.ts +11 -0
- package/dist/commands/actor/push-data.d.ts.map +1 -0
- package/dist/commands/actor/push-data.js +56 -0
- package/dist/commands/actor/push-data.js.map +1 -0
- package/dist/commands/actor/set-value.d.ts +15 -0
- package/dist/commands/actor/set-value.d.ts.map +1 -0
- package/dist/commands/actor/set-value.js +76 -0
- package/dist/commands/actor/set-value.js.map +1 -0
- package/dist/commands/call.d.ts +15 -0
- package/dist/commands/call.d.ts.map +1 -0
- package/dist/commands/call.js +142 -0
- package/dist/commands/call.js.map +1 -0
- package/dist/commands/check-version.d.ts +11 -0
- package/dist/commands/check-version.d.ts.map +1 -0
- package/dist/commands/check-version.js +39 -0
- package/dist/commands/check-version.js.map +1 -0
- package/dist/commands/create.d.ts +14 -0
- package/dist/commands/create.d.ts.map +1 -0
- package/dist/commands/create.js +181 -0
- package/dist/commands/create.js.map +1 -0
- package/dist/commands/edit-input-schema.d.ts +11 -0
- package/dist/commands/edit-input-schema.d.ts.map +1 -0
- package/{src → dist}/commands/edit-input-schema.js +81 -85
- package/dist/commands/edit-input-schema.js.map +1 -0
- package/dist/commands/info.d.ts +6 -0
- package/dist/commands/info.d.ts.map +1 -0
- package/dist/commands/info.js +26 -0
- package/dist/commands/info.js.map +1 -0
- package/dist/commands/init-wrap-scrapy.d.ts +10 -0
- package/dist/commands/init-wrap-scrapy.d.ts.map +1 -0
- package/dist/commands/init-wrap-scrapy.js +41 -0
- package/dist/commands/init-wrap-scrapy.js.map +1 -0
- package/dist/commands/init.d.ts +12 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +88 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/login-new.d.ts +10 -0
- package/dist/commands/login-new.d.ts.map +1 -0
- package/{src → dist}/commands/login-new.js +79 -82
- package/dist/commands/login-new.js.map +1 -0
- package/dist/commands/login.d.ts +9 -0
- package/dist/commands/login.d.ts.map +1 -0
- package/dist/commands/login.js +43 -0
- package/dist/commands/login.js.map +1 -0
- package/dist/commands/logout.d.ts +6 -0
- package/dist/commands/logout.d.ts.map +1 -0
- package/dist/commands/logout.js +20 -0
- package/dist/commands/logout.js.map +1 -0
- package/dist/commands/pull.d.ts +12 -0
- package/dist/commands/pull.d.ts.map +1 -0
- package/dist/commands/pull.js +148 -0
- package/dist/commands/pull.js.map +1 -0
- package/dist/commands/push.d.ts +16 -0
- package/dist/commands/push.d.ts.map +1 -0
- package/dist/commands/push.js +242 -0
- package/dist/commands/push.js.map +1 -0
- package/dist/commands/run.d.ts +12 -0
- package/dist/commands/run.d.ts.map +1 -0
- package/{src → dist}/commands/run.js +96 -109
- package/dist/commands/run.js.map +1 -0
- package/dist/commands/secrets/add.d.ts +10 -0
- package/dist/commands/secrets/add.d.ts.map +1 -0
- package/dist/commands/secrets/add.js +31 -0
- package/dist/commands/secrets/add.js.map +1 -0
- package/dist/commands/secrets/index.d.ts +6 -0
- package/dist/commands/secrets/index.d.ts.map +1 -0
- package/dist/commands/secrets/index.js +24 -0
- package/dist/commands/secrets/index.js.map +1 -0
- package/dist/commands/secrets/rm.d.ts +9 -0
- package/dist/commands/secrets/rm.d.ts.map +1 -0
- package/dist/commands/secrets/rm.js +27 -0
- package/dist/commands/secrets/rm.js.map +1 -0
- package/dist/commands/vis.d.ts +9 -0
- package/dist/commands/vis.d.ts.map +1 -0
- package/dist/commands/vis.js +52 -0
- package/dist/commands/vis.js.map +1 -0
- package/dist/hooks/init.d.ts +7 -0
- package/dist/hooks/init.d.ts.map +1 -0
- package/dist/hooks/init.js +17 -0
- package/dist/hooks/init.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/actor.d.ts +27 -0
- package/dist/lib/actor.d.ts.map +1 -0
- package/{src → dist}/lib/actor.js +21 -44
- package/dist/lib/actor.js.map +1 -0
- package/dist/lib/apify-oclif-help.d.ts +15 -0
- package/dist/lib/apify-oclif-help.d.ts.map +1 -0
- package/dist/lib/apify-oclif-help.js +19 -0
- package/dist/lib/apify-oclif-help.js.map +1 -0
- package/dist/lib/apify_command.d.ts +22 -0
- package/dist/lib/apify_command.d.ts.map +1 -0
- package/dist/lib/apify_command.js +103 -0
- package/dist/lib/apify_command.js.map +1 -0
- package/dist/lib/community.d.ts +2 -0
- package/dist/lib/community.d.ts.map +1 -0
- package/dist/lib/community.js +4 -0
- package/dist/lib/community.js.map +1 -0
- package/dist/lib/consts.d.ts +45 -0
- package/dist/lib/consts.d.ts.map +1 -0
- package/dist/lib/consts.js +54 -0
- package/dist/lib/consts.js.map +1 -0
- package/dist/lib/create-utils.d.ts +8 -0
- package/dist/lib/create-utils.d.ts.map +1 -0
- package/{src → dist}/lib/create-utils.js +74 -113
- package/dist/lib/create-utils.js.map +1 -0
- package/dist/lib/exec.d.ts +4 -0
- package/dist/lib/exec.d.ts.map +1 -0
- package/{src → dist}/lib/exec.js +15 -16
- package/dist/lib/exec.js.map +1 -0
- package/dist/lib/files.d.ts +14 -0
- package/dist/lib/files.d.ts.map +1 -0
- package/dist/lib/files.js +58 -0
- package/dist/lib/files.js.map +1 -0
- package/dist/lib/input_schema.d.ts +26 -0
- package/dist/lib/input_schema.d.ts.map +1 -0
- package/{src → dist}/lib/input_schema.js +34 -55
- package/dist/lib/input_schema.js.map +1 -0
- package/dist/lib/local_state.d.ts +11 -0
- package/dist/lib/local_state.d.ts.map +1 -0
- package/dist/lib/local_state.js +27 -0
- package/dist/lib/local_state.js.map +1 -0
- package/dist/lib/outputs.d.ts +7 -0
- package/dist/lib/outputs.d.ts.map +1 -0
- package/{src → dist}/lib/outputs.js +8 -15
- package/dist/lib/outputs.js.map +1 -0
- package/dist/lib/project_analyzer.d.ts +4 -0
- package/dist/lib/project_analyzer.d.ts.map +1 -0
- package/{src → dist}/lib/project_analyzer.js +6 -11
- package/dist/lib/project_analyzer.js.map +1 -0
- package/dist/lib/projects/CrawleeAnalyzer.d.ts +4 -0
- package/dist/lib/projects/CrawleeAnalyzer.d.ts.map +1 -0
- package/{src → dist}/lib/projects/CrawleeAnalyzer.js +7 -24
- package/dist/lib/projects/CrawleeAnalyzer.js.map +1 -0
- package/dist/lib/projects/OldApifySDKAnalyzer.d.ts +4 -0
- package/dist/lib/projects/OldApifySDKAnalyzer.d.ts.map +1 -0
- package/{src → dist}/lib/projects/OldApifySDKAnalyzer.js +9 -32
- package/dist/lib/projects/OldApifySDKAnalyzer.js.map +1 -0
- package/dist/lib/projects/scrapy/ScrapyProjectAnalyzer.d.ts +17 -0
- package/dist/lib/projects/scrapy/ScrapyProjectAnalyzer.d.ts.map +1 -0
- package/{src/lib/scrapy-wrapper → dist/lib/projects/scrapy}/ScrapyProjectAnalyzer.js +33 -36
- package/dist/lib/projects/scrapy/ScrapyProjectAnalyzer.js.map +1 -0
- package/dist/lib/projects/scrapy/Spider.d.ts +14 -0
- package/dist/lib/projects/scrapy/Spider.d.ts.map +1 -0
- package/dist/lib/projects/scrapy/Spider.js +33 -0
- package/dist/lib/projects/scrapy/Spider.js.map +1 -0
- package/dist/lib/projects/scrapy/SpiderFileAnalyzer.d.ts +7 -0
- package/dist/lib/projects/scrapy/SpiderFileAnalyzer.d.ts.map +1 -0
- package/dist/lib/projects/scrapy/SpiderFileAnalyzer.js +25 -0
- package/dist/lib/projects/scrapy/SpiderFileAnalyzer.js.map +1 -0
- package/dist/lib/projects/scrapy/wrapScrapyProject.d.ts +4 -0
- package/dist/lib/projects/scrapy/wrapScrapyProject.d.ts.map +1 -0
- package/{src/lib/scrapy-wrapper/index.js → dist/lib/projects/scrapy/wrapScrapyProject.js} +43 -73
- package/dist/lib/projects/scrapy/wrapScrapyProject.js.map +1 -0
- package/dist/lib/projects/shared.d.ts +2 -0
- package/dist/lib/projects/shared.d.ts.map +1 -0
- package/dist/lib/projects/shared.js +13 -0
- package/dist/lib/projects/shared.js.map +1 -0
- package/dist/lib/secrets.d.ts +22 -0
- package/dist/lib/secrets.d.ts.map +1 -0
- package/{src → dist}/lib/secrets.js +32 -40
- package/dist/lib/secrets.js.map +1 -0
- package/dist/lib/telemetry.d.ts +21 -0
- package/dist/lib/telemetry.d.ts.map +1 -0
- package/dist/lib/telemetry.js +87 -0
- package/dist/lib/telemetry.js.map +1 -0
- package/dist/lib/types.d.ts +11 -0
- package/dist/lib/types.d.ts.map +1 -0
- package/dist/lib/types.js +2 -0
- package/dist/lib/types.js.map +1 -0
- package/dist/lib/utils.d.ts +106 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/{src → dist}/lib/utils.js +235 -347
- package/dist/lib/utils.js.map +1 -0
- package/dist/lib/version_check.d.ts +14 -0
- package/dist/lib/version_check.d.ts.map +1 -0
- package/{src → dist}/lib/version_check.js +25 -54
- package/dist/lib/version_check.js.map +1 -0
- package/oclif.manifest.json +722 -1
- package/package.json +137 -113
- package/index.js +0 -1
- package/src/bin/run +0 -16
- package/src/commands/actor/get-input.js +0 -12
- package/src/commands/actor/get-value.js +0 -23
- package/src/commands/actor/index.js +0 -13
- package/src/commands/actor/push-data.js +0 -44
- package/src/commands/actor/set-value.js +0 -63
- package/src/commands/call.js +0 -131
- package/src/commands/check-version.js +0 -28
- package/src/commands/create.js +0 -203
- package/src/commands/info.js +0 -24
- package/src/commands/init-wrap-scrapy.js +0 -34
- package/src/commands/init.js +0 -83
- package/src/commands/login.js +0 -40
- package/src/commands/logout.js +0 -18
- package/src/commands/pull.js +0 -154
- package/src/commands/push.js +0 -234
- package/src/commands/secrets/add.js +0 -28
- package/src/commands/secrets/index.js +0 -24
- package/src/commands/secrets/rm.js +0 -23
- package/src/commands/vis.js +0 -50
- package/src/hooks/init.js +0 -16
- package/src/lib/apify-oclif-help.js +0 -23
- package/src/lib/apify_command.js +0 -82
- package/src/lib/community.js +0 -3
- package/src/lib/consts.js +0 -69
- package/src/lib/files.js +0 -76
- package/src/lib/local_state.js +0 -39
- package/src/lib/scrapy-wrapper/Spider.js +0 -10
- package/src/lib/scrapy-wrapper/SpiderFileAnalyzer.js +0 -26
- package/src/lib/telemetry.js +0 -104
- /package/{src/bin → bin}/run.cmd +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/secrets/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAG1D,qBAAa,mBAAoB,SAAQ,YAAY,CAAC,OAAO,mBAAmB,CAAC;IAC7E,OAAgB,WAAW,SAU8G;IAEnI,GAAG;CAGZ"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ApifyCommand } from '../../lib/apify_command.js';
|
|
2
|
+
import { LOCAL_CONFIG_PATH } from '../../lib/consts.js';
|
|
3
|
+
export class SecretsIndexCommand extends ApifyCommand {
|
|
4
|
+
async run() {
|
|
5
|
+
await this.printHelp();
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(SecretsIndexCommand, "description", {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
configurable: true,
|
|
11
|
+
writable: true,
|
|
12
|
+
value: 'Manages secret values for Actor environment variables.\n\n'
|
|
13
|
+
+ 'Example:\n'
|
|
14
|
+
+ '$ apify secrets:add mySecret TopSecretValue123\n\n'
|
|
15
|
+
+ `Now the "mySecret" value can be used in an environment variable defined in "${LOCAL_CONFIG_PATH}" file by adding the "@" prefix:\n\n`
|
|
16
|
+
+ '{\n'
|
|
17
|
+
+ ' "actorSpecification": 1,\n'
|
|
18
|
+
+ ' "name": "my_actor",\n'
|
|
19
|
+
+ ' "environmentVariables": { "SECRET_ENV_VAR": "@mySecret" },\n'
|
|
20
|
+
+ ' "version": "0.1\n'
|
|
21
|
+
+ '}\n\n'
|
|
22
|
+
+ 'When the Actor is pushed to Apify cloud, the "SECRET_ENV_VAR" and its value is stored as a secret environment variable of the Actor.'
|
|
23
|
+
});
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/secrets/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,MAAM,OAAO,mBAAoB,SAAQ,YAAwC;IAa7E,KAAK,CAAC,GAAG;QACL,MAAM,IAAI,CAAC,SAAS,EAAE,CAAC;IAC3B,CAAC;;AAde;;;;WAAc,4DAA4D;UACxF,YAAY;UACZ,oDAAoD;UACpD,+EAA+E,iBAAiB,sCAAsC;UACtI,KAAK;UACL,8BAA8B;UAC9B,yBAAyB;UACzB,gEAAgE;UAChE,qBAAqB;UACrB,OAAO;UACP,sIAAsI;GAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ApifyCommand } from '../../lib/apify_command.js';
|
|
2
|
+
export declare class SecretRmCommand extends ApifyCommand<typeof SecretRmCommand> {
|
|
3
|
+
static description: string;
|
|
4
|
+
static args: {
|
|
5
|
+
name: import("@oclif/core/lib/interfaces/parser.js").Arg<string, Record<string, unknown>>;
|
|
6
|
+
};
|
|
7
|
+
run(): Promise<void>;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=rm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rm.d.ts","sourceRoot":"","sources":["../../../src/commands/secrets/rm.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAG1D,qBAAa,eAAgB,SAAQ,YAAY,CAAC,OAAO,eAAe,CAAC;IACrE,OAAgB,WAAW,SAAyB;IAEpD,OAAgB,IAAI;;MAKlB;IAEI,GAAG;CAKZ"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Args } from '@oclif/core';
|
|
2
|
+
import { ApifyCommand } from '../../lib/apify_command.js';
|
|
3
|
+
import { removeSecret } from '../../lib/secrets.js';
|
|
4
|
+
export class SecretRmCommand extends ApifyCommand {
|
|
5
|
+
async run() {
|
|
6
|
+
const { name } = this.args;
|
|
7
|
+
removeSecret(name);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
Object.defineProperty(SecretRmCommand, "description", {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
configurable: true,
|
|
13
|
+
writable: true,
|
|
14
|
+
value: 'Removes the secret.'
|
|
15
|
+
});
|
|
16
|
+
Object.defineProperty(SecretRmCommand, "args", {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
configurable: true,
|
|
19
|
+
writable: true,
|
|
20
|
+
value: {
|
|
21
|
+
name: Args.string({
|
|
22
|
+
required: true,
|
|
23
|
+
description: 'Name of the secret',
|
|
24
|
+
}),
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
//# sourceMappingURL=rm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rm.js","sourceRoot":"","sources":["../../../src/commands/secrets/rm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD,MAAM,OAAO,eAAgB,SAAQ,YAAoC;IAUrE,KAAK,CAAC,GAAG;QACL,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC;QAE3B,YAAY,CAAC,IAAI,CAAC,CAAC;IACvB,CAAC;;AAbe;;;;WAAc,qBAAqB;GAAC;AAEpC;;;;WAAO;QACnB,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC;YACd,QAAQ,EAAE,IAAI;YACd,WAAW,EAAE,oBAAoB;SACpC,CAAC;KACL;GAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ApifyCommand } from '../lib/apify_command.js';
|
|
2
|
+
export declare class ValidateInputSchemaCommand extends ApifyCommand<typeof ValidateInputSchemaCommand> {
|
|
3
|
+
static description: string;
|
|
4
|
+
static args: {
|
|
5
|
+
path: import("@oclif/core/lib/interfaces/parser.js").Arg<string | undefined, Record<string, unknown>>;
|
|
6
|
+
};
|
|
7
|
+
run(): Promise<void>;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=vis.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vis.d.ts","sourceRoot":"","sources":["../../src/commands/vis.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAMvD,qBAAa,0BAA2B,SAAQ,YAAY,CAAC,OAAO,0BAA0B,CAAC;IAC3F,OAAgB,WAAW,SAS7B;IAEE,OAAgB,IAAI;;MAKlB;IAEI,GAAG;CAiBZ"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import process from 'node:process';
|
|
2
|
+
import { validateInputSchema } from '@apify/input_schema';
|
|
3
|
+
import { Args } from '@oclif/core';
|
|
4
|
+
import { ApifyCommand } from '../lib/apify_command.js';
|
|
5
|
+
import { LOCAL_CONFIG_PATH } from '../lib/consts.js';
|
|
6
|
+
import { readInputSchema } from '../lib/input_schema.js';
|
|
7
|
+
import { info, success } from '../lib/outputs.js';
|
|
8
|
+
import { Ajv } from '../lib/utils.js';
|
|
9
|
+
export class ValidateInputSchemaCommand extends ApifyCommand {
|
|
10
|
+
async run() {
|
|
11
|
+
const { inputSchema, inputSchemaPath } = await readInputSchema({ forcePath: this.args.path, cwd: process.cwd() });
|
|
12
|
+
if (!inputSchema) {
|
|
13
|
+
throw new Error(`Input schema has not been found at ${inputSchemaPath}.`);
|
|
14
|
+
}
|
|
15
|
+
if (inputSchemaPath) {
|
|
16
|
+
info(`Validating input schema stored at ${inputSchemaPath}`);
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
info(`Validating input schema embedded in "${LOCAL_CONFIG_PATH}"`);
|
|
20
|
+
}
|
|
21
|
+
const validator = new Ajv({ strict: false });
|
|
22
|
+
validateInputSchema(validator, inputSchema); // This one throws an error in a case of invalid schema.
|
|
23
|
+
success('Input schema is valid.');
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
Object.defineProperty(ValidateInputSchemaCommand, "description", {
|
|
27
|
+
enumerable: true,
|
|
28
|
+
configurable: true,
|
|
29
|
+
writable: true,
|
|
30
|
+
value: `Validates input schema and prints errors found.
|
|
31
|
+
The input schema for the Actor is used from these locations in order of preference.
|
|
32
|
+
The first one found is validated as it would be the one used on the Apify platform.
|
|
33
|
+
1. Directly embedded object in "${LOCAL_CONFIG_PATH}" under 'input' key
|
|
34
|
+
2. Path to JSON file referenced in "${LOCAL_CONFIG_PATH}" under 'input' key
|
|
35
|
+
3. JSON file at .actor/INPUT_SCHEMA.json
|
|
36
|
+
4. JSON file at INPUT_SCHEMA.json
|
|
37
|
+
|
|
38
|
+
You can also pass any custom path to your input schema to have it validated instead.
|
|
39
|
+
`
|
|
40
|
+
});
|
|
41
|
+
Object.defineProperty(ValidateInputSchemaCommand, "args", {
|
|
42
|
+
enumerable: true,
|
|
43
|
+
configurable: true,
|
|
44
|
+
writable: true,
|
|
45
|
+
value: {
|
|
46
|
+
path: Args.string({
|
|
47
|
+
required: false,
|
|
48
|
+
description: 'Optional path to your INPUT_SCHEMA.json file. If not provided ./INPUT_SCHEMA.json is used.',
|
|
49
|
+
}),
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
//# sourceMappingURL=vis.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vis.js","sourceRoot":"","sources":["../../src/commands/vis.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,cAAc,CAAC;AAEnC,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAEtC,MAAM,OAAO,0BAA2B,SAAQ,YAA+C;IAmB3F,KAAK,CAAC,GAAG;QACL,MAAM,EAAE,WAAW,EAAE,eAAe,EAAE,GAAG,MAAM,eAAe,CAAC,EAAE,SAAS,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;QAElH,IAAI,CAAC,WAAW,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CAAC,sCAAsC,eAAe,GAAG,CAAC,CAAC;QAC9E,CAAC;QAED,IAAI,eAAe,EAAE,CAAC;YAClB,IAAI,CAAC,qCAAqC,eAAe,EAAE,CAAC,CAAC;QACjE,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,wCAAwC,iBAAiB,GAAG,CAAC,CAAC;QACvE,CAAC;QAED,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;QAC7C,mBAAmB,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC,CAAC,wDAAwD;QACrG,OAAO,CAAC,wBAAwB,CAAC,CAAC;IACtC,CAAC;;AAlCe;;;;WAAc;;;kCAGA,iBAAiB;sCACb,iBAAiB;;;;;CAKtD;GAAC;AAEkB;;;;WAAO;QACnB,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC;YACd,QAAQ,EAAE,KAAK;YACf,WAAW,EAAE,4FAA4F;SAC5G,CAAC;KACL;GAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/hooks/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAInC;;GAEG;AACH,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,MAAM,CAWtB,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { SKIP_UPDATE_CHECK, checkLatestVersion } from '../lib/version_check.js';
|
|
2
|
+
/**
|
|
3
|
+
* This code'll be call before each commmand run
|
|
4
|
+
*/
|
|
5
|
+
const hook = async (params) => {
|
|
6
|
+
// This is not necessary when you call the `--check-version` as the same command is called there.
|
|
7
|
+
if (['cv', 'check-version'].includes(params.id)) {
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
// If the user has configured the `APIFY_CLI_SKIP_UPDATE_CHECK` env variable then skip the check.
|
|
11
|
+
if (SKIP_UPDATE_CHECK)
|
|
12
|
+
return;
|
|
13
|
+
// Check package latest version
|
|
14
|
+
await checkLatestVersion();
|
|
15
|
+
};
|
|
16
|
+
export default hook;
|
|
17
|
+
//# sourceMappingURL=init.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/hooks/init.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAEhF;;GAEG;AACH,MAAM,IAAI,GAAiB,KAAK,EAAE,MAAM,EAAE,EAAE;IACxC,iGAAiG;IACjG,IAAI,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAG,CAAC,EAAE,CAAC;QAC/C,OAAO;IACX,CAAC;IAED,iGAAiG;IACjG,IAAI,iBAAiB;QAAE,OAAO;IAE9B,+BAA+B;IAC/B,MAAM,kBAAkB,EAAE,CAAC;AAC/B,CAAC,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { MemoryStorageOptions } from '@crawlee/memory-storage';
|
|
2
|
+
import { StorageClient } from '@crawlee/types';
|
|
3
|
+
import { ApifyClientOptions } from 'apify-client';
|
|
4
|
+
export declare const APIFY_STORAGE_TYPES: {
|
|
5
|
+
readonly KEY_VALUE_STORE: "KEY_VALUE_STORE";
|
|
6
|
+
readonly DATASET: "DATASET";
|
|
7
|
+
readonly REQUEST_QUEUE: "REQUEST_QUEUE";
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Returns instance of ApifyClient or ApifyStorageLocal based on environment variables.
|
|
11
|
+
* @param options - ApifyClient options
|
|
12
|
+
* @param forceCloud - If true then ApifyClient will be returned.
|
|
13
|
+
*/
|
|
14
|
+
export declare const getApifyStorageClient: (options?: MemoryStorageOptions | ApifyClientOptions, forceCloud?: boolean) => Promise<StorageClient>;
|
|
15
|
+
/**
|
|
16
|
+
* Returns default storage id based on environment variables.
|
|
17
|
+
* Throws error if not set and actor running on platform.
|
|
18
|
+
* @param storeType
|
|
19
|
+
*/
|
|
20
|
+
export declare const getDefaultStorageId: (storeType: (typeof APIFY_STORAGE_TYPES)[keyof typeof APIFY_STORAGE_TYPES]) => string;
|
|
21
|
+
/**
|
|
22
|
+
* Outputs value of record into standard output of the command.
|
|
23
|
+
* @param key - Record key
|
|
24
|
+
*/
|
|
25
|
+
export declare const outputRecordFromDefaultStore: (key: string) => Promise<void>;
|
|
26
|
+
export declare const outputInputFromDefaultStore: () => Promise<void>;
|
|
27
|
+
//# sourceMappingURL=actor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actor.d.ts","sourceRoot":"","sources":["../../src/lib/actor.ts"],"names":[],"mappings":"AAIA,OAAO,EAAiB,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAe,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAM/D,eAAO,MAAM,mBAAmB;;;;CAItB,CAAC;AAEX;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,aACrB,oBAAoB,GAAG,kBAAkB,2BAEnD,QAAQ,aAAa,CAyBvB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,cAAe,CAAA,0BAA0B,EAAC,MAAM,0BAA0B,CAAC,WAI1G,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,4BAA4B,QAAe,MAAM,kBAU7D,CAAC;AAEF,eAAO,MAAM,2BAA2B,qBAEvC,CAAC"}
|
|
@@ -1,90 +1,67 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
const pipelinePromise = promisify(pipeline);
|
|
12
|
-
|
|
13
|
-
const APIFY_STORAGE_TYPES = {
|
|
1
|
+
import process from 'node:process';
|
|
2
|
+
import { pipeline } from 'node:stream/promises';
|
|
3
|
+
import { ACTOR_ENV_VARS, APIFY_ENV_VARS, KEY_VALUE_STORE_KEYS, LOCAL_ACTOR_ENV_VARS } from '@apify/consts';
|
|
4
|
+
import { MemoryStorage } from '@crawlee/memory-storage';
|
|
5
|
+
import { ApifyClient } from 'apify-client';
|
|
6
|
+
// Will this work, who knows
|
|
7
|
+
import ow from 'ow';
|
|
8
|
+
import { getApifyClientOptions, getLocalStorageDir, getLocalUserInfo } from './utils.js';
|
|
9
|
+
export const APIFY_STORAGE_TYPES = {
|
|
14
10
|
KEY_VALUE_STORE: 'KEY_VALUE_STORE',
|
|
15
11
|
DATASET: 'DATASET',
|
|
16
12
|
REQUEST_QUEUE: 'REQUEST_QUEUE',
|
|
17
13
|
};
|
|
18
|
-
|
|
19
14
|
/**
|
|
20
15
|
* Returns instance of ApifyClient or ApifyStorageLocal based on environment variables.
|
|
21
16
|
* @param options - ApifyClient options
|
|
22
17
|
* @param forceCloud - If true then ApifyClient will be returned.
|
|
23
|
-
* @return {MemoryStorage|ApifyClient}
|
|
24
18
|
*/
|
|
25
|
-
const getApifyStorageClient = (options = {}, forceCloud = false) => {
|
|
19
|
+
export const getApifyStorageClient = async (options = {}, forceCloud = false) => {
|
|
26
20
|
const storageDir = getLocalStorageDir();
|
|
27
|
-
|
|
28
21
|
if (storageDir && !forceCloud) {
|
|
29
22
|
return new MemoryStorage({
|
|
30
|
-
storageDir,
|
|
23
|
+
localDataDirectory: storageDir,
|
|
31
24
|
...options,
|
|
32
25
|
});
|
|
33
26
|
}
|
|
34
|
-
|
|
35
27
|
// NOTE: Token in env var overrides token in local auth file.
|
|
36
28
|
let apifyToken = process.env[APIFY_ENV_VARS.TOKEN];
|
|
37
29
|
if (!apifyToken) {
|
|
38
|
-
const localUserInfo = getLocalUserInfo();
|
|
30
|
+
const localUserInfo = await getLocalUserInfo();
|
|
39
31
|
if (!localUserInfo || !localUserInfo.token) {
|
|
40
32
|
throw new Error('Apify token is not set. Please set it using the environment variable APIFY_TOKEN or apify login command.');
|
|
41
33
|
}
|
|
42
34
|
apifyToken = localUserInfo.token;
|
|
43
35
|
}
|
|
44
|
-
|
|
45
36
|
return new ApifyClient({
|
|
46
37
|
...getApifyClientOptions(apifyToken),
|
|
47
38
|
...options,
|
|
48
39
|
});
|
|
49
40
|
};
|
|
50
|
-
|
|
51
41
|
/**
|
|
52
42
|
* Returns default storage id based on environment variables.
|
|
53
43
|
* Throws error if not set and actor running on platform.
|
|
54
44
|
* @param storeType
|
|
55
|
-
* @return {string}
|
|
56
45
|
*/
|
|
57
|
-
const getDefaultStorageId = (storeType) => {
|
|
46
|
+
export const getDefaultStorageId = (storeType) => {
|
|
58
47
|
const envVarName = ACTOR_ENV_VARS[`DEFAULT_${storeType}_ID`];
|
|
59
|
-
|
|
60
48
|
return process.env[envVarName] || LOCAL_ACTOR_ENV_VARS[envVarName];
|
|
61
49
|
};
|
|
62
|
-
|
|
63
50
|
/**
|
|
64
51
|
* Outputs value of record into standard output of the command.
|
|
65
|
-
* @param
|
|
66
|
-
* @return {Promise<void>}
|
|
52
|
+
* @param key - Record key
|
|
67
53
|
*/
|
|
68
|
-
const outputRecordFromDefaultStore = async (key) => {
|
|
54
|
+
export const outputRecordFromDefaultStore = async (key) => {
|
|
69
55
|
ow(key, ow.string);
|
|
70
|
-
|
|
71
|
-
const apifyClient = getApifyStorageClient();
|
|
56
|
+
const apifyClient = await getApifyStorageClient();
|
|
72
57
|
const defaultStoreId = getDefaultStorageId(APIFY_STORAGE_TYPES.KEY_VALUE_STORE);
|
|
73
58
|
const record = await apifyClient.keyValueStore(defaultStoreId).getRecord(key, { stream: true });
|
|
74
59
|
// If record does not exist return empty string.
|
|
75
|
-
if (!record)
|
|
76
|
-
|
|
77
|
-
await
|
|
60
|
+
if (!record)
|
|
61
|
+
return;
|
|
62
|
+
await pipeline(record.value, process.stdout, { end: false });
|
|
78
63
|
};
|
|
79
|
-
|
|
80
|
-
const outputInputFromDefaultStore = async () => {
|
|
64
|
+
export const outputInputFromDefaultStore = async () => {
|
|
81
65
|
return outputRecordFromDefaultStore(process.env[ACTOR_ENV_VARS.INPUT_KEY] || KEY_VALUE_STORE_KEYS.INPUT);
|
|
82
66
|
};
|
|
83
|
-
|
|
84
|
-
module.exports = {
|
|
85
|
-
outputRecordFromDefaultStore,
|
|
86
|
-
outputInputFromDefaultStore,
|
|
87
|
-
getApifyStorageClient,
|
|
88
|
-
getDefaultStorageId,
|
|
89
|
-
APIFY_STORAGE_TYPES,
|
|
90
|
-
};
|
|
67
|
+
//# sourceMappingURL=actor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actor.js","sourceRoot":"","sources":["../../src/lib/actor.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEhD,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAC3G,OAAO,EAAE,aAAa,EAAwB,MAAM,yBAAyB,CAAC;AAE9E,OAAO,EAAE,WAAW,EAAsB,MAAM,cAAc,CAAC;AAC/D,4BAA4B;AAC5B,OAAO,EAAE,MAAM,IAAI,CAAC;AAEpB,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEzF,MAAM,CAAC,MAAM,mBAAmB,GAAG;IAC/B,eAAe,EAAE,iBAAiB;IAClC,OAAO,EAAE,SAAS;IAClB,aAAa,EAAE,eAAe;CACxB,CAAC;A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AC;IAClD,MAAM,cAAc,GAAG,mBAAmB,CAAC,mBAAmB,CAAC,eAAe,CAAC,CAAC;IAChF,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC,SAAS,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;IAChG,gDAAgD;IAChD,IAAI,CAAC,MAAM;QAAE,OAAO;IAEpB,MAAM,QAAQ,CAAC,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,MAAM,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,CAAC;AACjE,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,2BAA2B,GAAG,KAAK,IAAI,EAAE;IAClD,OAAO,4BAA4B,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,SAAS,CAAC,IAAI,oBAAoB,CAAC,KAAK,CAAC,CAAC;AAC7G,CAAC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Help } from '@oclif/core';
|
|
2
|
+
/**
|
|
3
|
+
* Custom help class that overrides how oclif renders help screens.
|
|
4
|
+
*
|
|
5
|
+
* It is registered through package.json.
|
|
6
|
+
*
|
|
7
|
+
* Refer to the oclif documentation for more information:
|
|
8
|
+
* https://oclif.io/docs/help_classes/#custom-help
|
|
9
|
+
*
|
|
10
|
+
* Note: The CLI was crashing when printing help with the latest oclif packages. Be careful when upgrading.
|
|
11
|
+
*/
|
|
12
|
+
export default class ApifyOclifHelp extends Help {
|
|
13
|
+
showRootHelp(): Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=apify-oclif-help.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apify-oclif-help.d.ts","sourceRoot":"","sources":["../../src/lib/apify-oclif-help.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC;;;;;;;;;GASG;AACH,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,IAAI;IAC7B,YAAY;CAY9B"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Help } from '@oclif/core';
|
|
2
|
+
/**
|
|
3
|
+
* Custom help class that overrides how oclif renders help screens.
|
|
4
|
+
*
|
|
5
|
+
* It is registered through package.json.
|
|
6
|
+
*
|
|
7
|
+
* Refer to the oclif documentation for more information:
|
|
8
|
+
* https://oclif.io/docs/help_classes/#custom-help
|
|
9
|
+
*
|
|
10
|
+
* Note: The CLI was crashing when printing help with the latest oclif packages. Be careful when upgrading.
|
|
11
|
+
*/
|
|
12
|
+
export default class ApifyOclifHelp extends Help {
|
|
13
|
+
async showRootHelp() {
|
|
14
|
+
await super.showRootHelp();
|
|
15
|
+
this.log(this.section('TROUBLESHOOTING', this.wrap('For general support, reach out to us at https://apify.com/contact\n\n'
|
|
16
|
+
+ 'If you believe you are encountering a bug, file it at https://github.com/apify/apify-cli/issues/new')));
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=apify-oclif-help.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apify-oclif-help.js","sourceRoot":"","sources":["../../src/lib/apify-oclif-help.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC;;;;;;;;;GASG;AACH,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,IAAI;IACnC,KAAK,CAAC,YAAY;QACvB,MAAM,KAAK,CAAC,YAAY,EAAE,CAAC;QAE3B,IAAI,CAAC,GAAG,CACJ,IAAI,CAAC,OAAO,CACR,iBAAiB,EACjB,IAAI,CAAC,IAAI,CACL,uEAAuE;cACjE,qGAAqG,CAAC,CACnH,CACJ,CAAC;IACN,CAAC;CACJ"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
+
import process from 'node:process';
|
|
3
|
+
import { Command, Interfaces } from '@oclif/core';
|
|
4
|
+
import { KeysToCamelCase } from './utils.js';
|
|
5
|
+
export type ApifyFlags<T extends typeof Command> = KeysToCamelCase<Interfaces.InferredFlags<T['flags']>>;
|
|
6
|
+
export type ApifyArgs<T extends typeof Command> = Interfaces.InferredArgs<T['args']>;
|
|
7
|
+
/**
|
|
8
|
+
* Adding parsing flags to oclif Command class
|
|
9
|
+
*/
|
|
10
|
+
export declare abstract class ApifyCommand<T extends typeof Command> extends Command {
|
|
11
|
+
protected telemetryData: Record<string, unknown>;
|
|
12
|
+
protected flags: ApifyFlags<T>;
|
|
13
|
+
protected args: ApifyArgs<T>;
|
|
14
|
+
init(): Promise<void>;
|
|
15
|
+
finally(err?: Error): Promise<any>;
|
|
16
|
+
/**
|
|
17
|
+
* Reads data on standard input as a string.
|
|
18
|
+
*/
|
|
19
|
+
readStdin(stdinStream: typeof process.stdin): Promise<string | undefined>;
|
|
20
|
+
printHelp(customCommand?: string): Promise<void>;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=apify_command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apify_command.d.ts","sourceRoot":"","sources":["../../src/lib/apify_command.ts"],"names":[],"mappings":";AAAA,OAAO,OAAO,MAAM,cAAc,CAAC;AAGnC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAiB,MAAM,aAAa,CAAC;AAIjE,OAAO,EAAE,eAAe,EAA6C,MAAM,YAAY,CAAC;AAGxF,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,OAAO,OAAO,IAAI,eAAe,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AACzG,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,OAAO,OAAO,IAAI,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AAErF;;GAEG;AACH,8BAAsB,YAAY,CAAC,CAAC,SAAS,OAAO,OAAO,CAAE,SAAQ,OAAO;IACxE,SAAS,CAAC,aAAa,EAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAElD,SAAS,CAAC,KAAK,EAAG,UAAU,CAAC,CAAC,CAAC,CAAC;IAChC,SAAS,CAAC,IAAI,EAAG,SAAS,CAAC,CAAC,CAAC,CAAC;IAEf,IAAI;IAkBJ,OAAO,CAAC,GAAG,CAAC,EAAE,KAAK;IAmClC;;OAEG;IACG,SAAS,CAAC,WAAW,EAAE,OAAO,OAAO,CAAC,KAAK;IAe3C,SAAS,CAAC,aAAa,CAAC,EAAE,MAAM;CAKzC"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import process from 'node:process';
|
|
2
|
+
import { finished } from 'node:stream/promises';
|
|
3
|
+
import { Command, loadHelpClass } from '@oclif/core';
|
|
4
|
+
import { COMMANDS_WITHIN_ACTOR, LANGUAGE } from './consts.js';
|
|
5
|
+
import { maybeTrackTelemetry } from './telemetry.js';
|
|
6
|
+
import { argsToCamelCase, detectLocalActorLanguage } from './utils.js';
|
|
7
|
+
import { detectInstallationType } from './version_check.js';
|
|
8
|
+
/**
|
|
9
|
+
* Adding parsing flags to oclif Command class
|
|
10
|
+
*/
|
|
11
|
+
export class ApifyCommand extends Command {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
Object.defineProperty(this, "telemetryData", {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
configurable: true,
|
|
17
|
+
writable: true,
|
|
18
|
+
value: void 0
|
|
19
|
+
});
|
|
20
|
+
Object.defineProperty(this, "flags", {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
configurable: true,
|
|
23
|
+
writable: true,
|
|
24
|
+
value: void 0
|
|
25
|
+
});
|
|
26
|
+
Object.defineProperty(this, "args", {
|
|
27
|
+
enumerable: true,
|
|
28
|
+
configurable: true,
|
|
29
|
+
writable: true,
|
|
30
|
+
value: void 0
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
async init() {
|
|
34
|
+
await super.init();
|
|
35
|
+
const { args, flags } = await this.parse({
|
|
36
|
+
flags: this.ctor.flags,
|
|
37
|
+
args: this.ctor.args,
|
|
38
|
+
strict: this.ctor.strict,
|
|
39
|
+
});
|
|
40
|
+
this.flags = argsToCamelCase(flags);
|
|
41
|
+
this.args = args;
|
|
42
|
+
// Initialize telemetry data, all attributes are tracked in the finally method
|
|
43
|
+
this.telemetryData = {
|
|
44
|
+
flagsUsed: Object.keys(this.flags),
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
async finally(err) {
|
|
48
|
+
const command = this.id;
|
|
49
|
+
const eventData = {
|
|
50
|
+
command,
|
|
51
|
+
$os: this.config.platform,
|
|
52
|
+
shell: this.config.shell,
|
|
53
|
+
arch: this.config.arch,
|
|
54
|
+
apifyCliVersion: this.config.version,
|
|
55
|
+
nodeJsVersion: process.version,
|
|
56
|
+
...this.telemetryData,
|
|
57
|
+
error: err ? err.message : null,
|
|
58
|
+
};
|
|
59
|
+
try {
|
|
60
|
+
eventData.installationType = detectInstallationType();
|
|
61
|
+
if (!this.telemetryData.actorLanguage && command && COMMANDS_WITHIN_ACTOR.includes(command)) {
|
|
62
|
+
const { language, languageVersion } = detectLocalActorLanguage(process.cwd());
|
|
63
|
+
eventData.actorLanguage = language;
|
|
64
|
+
if (language === LANGUAGE.NODEJS) {
|
|
65
|
+
eventData.actorNodejsVersion = languageVersion;
|
|
66
|
+
}
|
|
67
|
+
else if (language === LANGUAGE.PYTHON) {
|
|
68
|
+
eventData.actorPythonVersion = languageVersion;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
await maybeTrackTelemetry({
|
|
72
|
+
eventName: `cli_command_${command}`,
|
|
73
|
+
eventData,
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
// Ignore errors
|
|
78
|
+
}
|
|
79
|
+
return super.finally(err);
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Reads data on standard input as a string.
|
|
83
|
+
*/
|
|
84
|
+
async readStdin(stdinStream) {
|
|
85
|
+
// The isTTY params says if TTY is connected to the process, if so the stdout is
|
|
86
|
+
// synchronous and the stdout steam is empty.
|
|
87
|
+
// See https://nodejs.org/docs/latest-v12.x/api/process.html#process_a_note_on_process_i_o
|
|
88
|
+
if (stdinStream.isTTY)
|
|
89
|
+
return;
|
|
90
|
+
const bufferChunks = [];
|
|
91
|
+
stdinStream.on('data', (chunk) => {
|
|
92
|
+
bufferChunks.push(chunk);
|
|
93
|
+
});
|
|
94
|
+
await finished(stdinStream);
|
|
95
|
+
return Buffer.concat(bufferChunks).toString('utf-8');
|
|
96
|
+
}
|
|
97
|
+
async printHelp(customCommand) {
|
|
98
|
+
const HelpCommand = await loadHelpClass(this.config);
|
|
99
|
+
const help = new HelpCommand(this.config);
|
|
100
|
+
await help.showHelp([customCommand ?? this.id]);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=apify_command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apify_command.js","sourceRoot":"","sources":["../../src/lib/apify_command.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEhD,OAAO,EAAE,OAAO,EAAc,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjE,OAAO,EAAE,qBAAqB,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAmB,eAAe,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AACxF,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAK5D;;GAEG;AACH,MAAM,OAAgB,YAAuC,SAAQ,OAAO;IAA5E;;QACc;;;;;WAAwC;QAExC;;;;;WAAsB;QACt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AI,CAAC,MAAM,CAAC,CAAC;QAC1C,MAAM,IAAI,CAAC,QAAQ,CAAC,CAAC,aAAa,IAAI,IAAI,CAAC,EAAG,CAAC,CAAC,CAAC;IACrD,CAAC;CACJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"community.d.ts","sourceRoot":"","sources":["../../src/lib/community.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"community.js","sourceRoot":"","sources":["../../src/lib/community.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,GAAG,CAAC,oDAAoD;MAClD,yEAAyE,CACtF,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export declare const DEFAULT_LOCAL_STORAGE_DIR = "storage";
|
|
2
|
+
export declare const LEGACY_LOCAL_STORAGE_DIR = "apify_storage";
|
|
3
|
+
export declare const ACTOR_SPECIFICATION_VERSION = 1;
|
|
4
|
+
export declare const EMPTY_LOCAL_CONFIG: {
|
|
5
|
+
actorSpecification: number;
|
|
6
|
+
name: null;
|
|
7
|
+
version: string;
|
|
8
|
+
buildTag: string;
|
|
9
|
+
environmentVariables: {};
|
|
10
|
+
};
|
|
11
|
+
export declare const LANGUAGE: {
|
|
12
|
+
NODEJS: string;
|
|
13
|
+
PYTHON: string;
|
|
14
|
+
UNKNOWN: string;
|
|
15
|
+
};
|
|
16
|
+
export type Language = typeof LANGUAGE[keyof typeof LANGUAGE];
|
|
17
|
+
export declare const PROJECT_TYPES: {
|
|
18
|
+
SCRAPY: string;
|
|
19
|
+
CRAWLEE: string;
|
|
20
|
+
PRE_CRAWLEE_APIFY_SDK: string;
|
|
21
|
+
UNKNOWN: string;
|
|
22
|
+
};
|
|
23
|
+
export declare const COMMANDS_WITHIN_ACTOR: string[];
|
|
24
|
+
export declare const CHECK_VERSION_EVERY_MILLIS: number;
|
|
25
|
+
export declare const GLOBAL_CONFIGS_FOLDER: () => string;
|
|
26
|
+
export declare const AUTH_FILE_PATH: () => string;
|
|
27
|
+
export declare const SECRETS_FILE_PATH: () => string;
|
|
28
|
+
export declare const STATE_FILE_PATH: () => string;
|
|
29
|
+
export declare const TELEMETRY_FILE_PATH: () => string;
|
|
30
|
+
export declare const DEPRECATED_LOCAL_CONFIG_NAME = "apify.json";
|
|
31
|
+
export declare const ACTOR_SPECIFICATION_FOLDER = ".actor";
|
|
32
|
+
export declare const LOCAL_CONFIG_NAME = "actor.json";
|
|
33
|
+
export declare const LOCAL_CONFIG_PATH: string;
|
|
34
|
+
export declare const INPUT_FILE_REG_EXP: RegExp;
|
|
35
|
+
export declare const MAIN_FILE = "main.js";
|
|
36
|
+
export declare const UPLOADS_STORE_NAME = "apify-cli-deployments";
|
|
37
|
+
export declare const SUPPORTED_NODEJS_VERSION: any;
|
|
38
|
+
export declare const CURRENT_APIFY_CLI_VERSION: any;
|
|
39
|
+
export declare const APIFY_CLIENT_DEFAULT_HEADERS: {
|
|
40
|
+
'X-Apify-Request-Origin': "CLI";
|
|
41
|
+
};
|
|
42
|
+
export declare const MINIMUM_SUPPORTED_PYTHON_VERSION = "3.8.0";
|
|
43
|
+
export declare const PYTHON_VENV_PATH = ".venv";
|
|
44
|
+
export declare const MIXPANEL_TOKEN = "ea75e434d4b4d2405d79ed9d14bfc93b";
|
|
45
|
+
//# sourceMappingURL=consts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consts.d.ts","sourceRoot":"","sources":["../../src/lib/consts.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,yBAAyB,YAAY,CAAC;AAEnD,eAAO,MAAM,wBAAwB,kBAAkB,CAAC;AAExD,eAAO,MAAM,2BAA2B,IAAI,CAAC;AAE7C,eAAO,MAAM,kBAAkB;;;;;;CAM9B,CAAC;AAEF,eAAO,MAAM,QAAQ;;;;CAIpB,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG,OAAO,QAAQ,CAAC,MAAM,OAAO,QAAQ,CAAC,CAAC;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