apify-cli 0.20.7 → 0.21.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.
Files changed (56) hide show
  1. package/README.md +158 -26
  2. package/dist/.tsbuildinfo +1 -1
  3. package/dist/commands/builds/create.d.ts +13 -0
  4. package/dist/commands/builds/create.d.ts.map +1 -0
  5. package/dist/commands/builds/create.js +130 -0
  6. package/dist/commands/builds/create.js.map +1 -0
  7. package/dist/commands/builds/index.d.ts +6 -0
  8. package/dist/commands/builds/index.d.ts.map +1 -0
  9. package/dist/commands/builds/index.js +13 -0
  10. package/dist/commands/builds/index.js.map +1 -0
  11. package/dist/commands/builds/info.d.ts +10 -0
  12. package/dist/commands/builds/info.d.ts.map +1 -0
  13. package/dist/commands/builds/info.js +92 -0
  14. package/dist/commands/builds/info.js.map +1 -0
  15. package/dist/commands/builds/log.d.ts +9 -0
  16. package/dist/commands/builds/log.d.ts.map +1 -0
  17. package/dist/commands/builds/log.js +41 -0
  18. package/dist/commands/builds/log.js.map +1 -0
  19. package/dist/commands/builds/ls.d.ts +15 -0
  20. package/dist/commands/builds/ls.d.ts.map +1 -0
  21. package/dist/commands/builds/ls.js +144 -0
  22. package/dist/commands/builds/ls.js.map +1 -0
  23. package/dist/commands/create.js +3 -3
  24. package/dist/commands/run.js +3 -3
  25. package/dist/commands/runs/ls.d.ts +14 -0
  26. package/dist/commands/runs/ls.d.ts.map +1 -0
  27. package/dist/commands/runs/ls.js +117 -0
  28. package/dist/commands/runs/ls.js.map +1 -0
  29. package/dist/lib/apify_command.d.ts.map +1 -1
  30. package/dist/lib/apify_command.js +1 -0
  31. package/dist/lib/apify_command.js.map +1 -1
  32. package/dist/lib/commands/pretty-print-bytes.d.ts +2 -0
  33. package/dist/lib/commands/pretty-print-bytes.d.ts.map +1 -0
  34. package/dist/lib/commands/pretty-print-bytes.js +9 -0
  35. package/dist/lib/commands/pretty-print-bytes.js.map +1 -0
  36. package/dist/lib/commands/pretty-print-status.d.ts +3 -0
  37. package/dist/lib/commands/pretty-print-status.d.ts.map +1 -0
  38. package/dist/lib/commands/pretty-print-status.js +29 -0
  39. package/dist/lib/commands/pretty-print-status.js.map +1 -0
  40. package/dist/lib/commands/resolve-actor-context.d.ts +22 -0
  41. package/dist/lib/commands/resolve-actor-context.d.ts.map +1 -0
  42. package/dist/lib/commands/resolve-actor-context.js +70 -0
  43. package/dist/lib/commands/resolve-actor-context.js.map +1 -0
  44. package/dist/lib/commands/responsive-table.d.ts +23 -0
  45. package/dist/lib/commands/responsive-table.d.ts.map +1 -0
  46. package/dist/lib/commands/responsive-table.js +58 -0
  47. package/dist/lib/commands/responsive-table.js.map +1 -0
  48. package/dist/lib/consts.d.ts +1 -1
  49. package/dist/lib/consts.js +1 -1
  50. package/dist/lib/utils.d.ts +9 -0
  51. package/dist/lib/utils.d.ts.map +1 -1
  52. package/dist/lib/utils.js +45 -0
  53. package/dist/lib/utils.js.map +1 -1
  54. package/dist/typechecking.tsbuildinfo +1 -1
  55. package/oclif.manifest.json +269 -1
  56. package/package.json +5 -2
@@ -0,0 +1,13 @@
1
+ import { ApifyCommand } from '../../lib/apify_command.js';
2
+ export declare class BuildsCreateCommand extends ApifyCommand<typeof BuildsCreateCommand> {
3
+ static description: string;
4
+ static flags: {
5
+ actor: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
6
+ tag: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
7
+ version: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
+ log: import("@oclif/core/interfaces").BooleanFlag<boolean>;
9
+ };
10
+ static enableJsonFlag: boolean;
11
+ run(): Promise<import("apify-client").Build | undefined>;
12
+ }
13
+ //# sourceMappingURL=create.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/commands/builds/create.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAK1D,qBAAa,mBAAoB,SAAQ,YAAY,CAAC,OAAO,mBAAmB,CAAC;IAChF,OAAgB,WAAW,SAAuC;IAElE,OAAgB,KAAK;;;;;MAgBnB;IAEF,OAAgB,cAAc,UAAQ;IAEhC,GAAG;CAoHT"}
@@ -0,0 +1,130 @@
1
+ import { Flags } from '@oclif/core';
2
+ import chalk from 'chalk';
3
+ import { ApifyCommand } from '../../lib/apify_command.js';
4
+ import { resolveActorContext } from '../../lib/commands/resolve-actor-context.js';
5
+ import { error, simpleLog } from '../../lib/outputs.js';
6
+ import { getLoggedClientOrThrow, objectGroupBy, outputJobLog, TimestampFormatter } from '../../lib/utils.js';
7
+ export class BuildsCreateCommand extends ApifyCommand {
8
+ async run() {
9
+ const { actor, tag, version, json, log } = this.flags;
10
+ const client = await getLoggedClientOrThrow();
11
+ const ctx = await resolveActorContext({ providedActorNameOrId: actor, client });
12
+ if (!ctx.valid) {
13
+ error({
14
+ message: `${ctx.reason}. Please run this command in an Actor directory, or specify the Actor ID by running this command with "--actor=<id>"`,
15
+ });
16
+ return;
17
+ }
18
+ const actorInfo = (await client.actor(ctx.id).get());
19
+ const versionsByBuildTag = objectGroupBy(actorInfo.versions, (actorVersion) => actorVersion.buildTag ?? 'latest');
20
+ const taggedVersions = versionsByBuildTag[tag ?? 'latest'];
21
+ const specificVersionExists = actorInfo.versions.find((v) => v.versionNumber === version);
22
+ let selectedVersion;
23
+ let actualTag = tag;
24
+ // --version takes precedence over tagged versions (but if --tag is also specified, it will be checked again)
25
+ if (specificVersionExists) {
26
+ // The API doesn't really care if the tag you use for a version is correct or not, just that the version exists. This means you CAN have two separate versions with the same tag
27
+ // but only the latest one that gets built will have the tag.
28
+ // The *console* lets you pick a version to build. Multiple versions can have the same default tag, ergo what was written above.
29
+ // The API *does* also let you tag any existing version with whatever you want. This is where we diverge, and follow semi-console-like behavior. Effectively, this one if check prevents you from doing
30
+ // "--version 0.1 --tag not_actually_the_tag", even if that is technically perfectly valid. Future reader of this code, if this is not wanted, nuke the if check.
31
+ // This ensures that a --tag and --version match the version and tag the platform knows about
32
+ // but only when --tag is provided
33
+ if (tag && (!taggedVersions || !taggedVersions.some((v) => v.versionNumber === version))) {
34
+ error({
35
+ message: `The Actor Version "${version}" does not have the tag "${tag}".`,
36
+ });
37
+ return;
38
+ }
39
+ selectedVersion = version;
40
+ actualTag = specificVersionExists.buildTag ?? 'latest';
41
+ }
42
+ else if (taggedVersions) {
43
+ selectedVersion = taggedVersions[0].versionNumber;
44
+ actualTag = tag ?? 'latest';
45
+ if (taggedVersions.length > 1) {
46
+ if (!version) {
47
+ error({
48
+ message: `Multiple Actor versions with the tag "${tag}" found. Please specify the version number using the "--version" flag.\n Available versions for this tag: ${taggedVersions.map((v) => chalk.yellow(v.versionNumber)).join(', ')}`,
49
+ });
50
+ return;
51
+ }
52
+ // On second run, it will call the upper if check
53
+ }
54
+ }
55
+ if (!selectedVersion) {
56
+ error({
57
+ message: `No Actor versions with the tag "${tag}" found. You can push a new version with this tag by using "apify push --build-tag=${tag}".`,
58
+ });
59
+ return;
60
+ }
61
+ const build = await client.actor(ctx.id).build(selectedVersion, { tag });
62
+ if (json) {
63
+ return build;
64
+ }
65
+ const message = [
66
+ `${chalk.yellow('Actor')}: ${actorInfo?.username ? `${actorInfo.username}/` : ''}${actorInfo?.name ?? 'unknown-actor'} (${chalk.gray(build.actId)})`,
67
+ ` ${chalk.yellow('Version')}: ${selectedVersion} (tagged with ${chalk.yellow(actualTag)})`,
68
+ '',
69
+ `${chalk.greenBright('Build Started')} (ID: ${chalk.gray(build.id)})`,
70
+ ` ${chalk.yellow('Build Number')}: ${build.buildNumber} (will get tagged once finished)`,
71
+ ` ${chalk.yellow('Started')}: ${TimestampFormatter.display(build.startedAt)}`,
72
+ '',
73
+ ];
74
+ const url = `https://console.apify.com/actors/${build.actId}/builds/${build.buildNumber}`;
75
+ const viewMessage = `${chalk.blue('View in Apify Console')}: ${url}`;
76
+ simpleLog({
77
+ message: message.join('\n'),
78
+ });
79
+ if (log) {
80
+ try {
81
+ await outputJobLog(build);
82
+ }
83
+ catch (err) {
84
+ // This should never happen...
85
+ error({ message: `Failed to print log for build with ID "${build.id}": ${err.message}` });
86
+ }
87
+ // Print out an empty line
88
+ simpleLog({
89
+ message: '',
90
+ });
91
+ }
92
+ simpleLog({
93
+ message: viewMessage,
94
+ });
95
+ return undefined;
96
+ }
97
+ }
98
+ Object.defineProperty(BuildsCreateCommand, "description", {
99
+ enumerable: true,
100
+ configurable: true,
101
+ writable: true,
102
+ value: 'Creates a new build of the Actor.'
103
+ });
104
+ Object.defineProperty(BuildsCreateCommand, "flags", {
105
+ enumerable: true,
106
+ configurable: true,
107
+ writable: true,
108
+ value: {
109
+ actor: Flags.string({
110
+ description: 'Optional Actor ID or Name to trigger a build for. By default, it will use the Actor from the current directory.',
111
+ }),
112
+ tag: Flags.string({
113
+ description: 'Build tag to be applied to the successful Actor build. By default, this is "latest".',
114
+ }),
115
+ version: Flags.string({
116
+ description: 'Optional Actor Version to build. By default, this will be inferred from the tag, but this flag is required when multiple versions have the same tag.',
117
+ required: false,
118
+ }),
119
+ log: Flags.boolean({
120
+ description: 'Whether to print out the build log after the build is triggered.',
121
+ }),
122
+ }
123
+ });
124
+ Object.defineProperty(BuildsCreateCommand, "enableJsonFlag", {
125
+ enumerable: true,
126
+ configurable: true,
127
+ writable: true,
128
+ value: true
129
+ });
130
+ //# sourceMappingURL=create.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create.js","sourceRoot":"","sources":["../../../src/commands/builds/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AAClF,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C9B,KAAK,CAAC,EAAE,OAAO,EAAE,0CAA0C,KAAK,CAAC,EAAE,MAAO,GAAa,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;YACtG,CAAC;YAED,0BAA0B;YAC1B,SAAS,CAAC;gBACT,OAAO,EAAE,EAAE;aACX,CAAC,CAAC;QACJ,CAAC;QAED,SAAS,CAAC;YACT,OAAO,EAAE,WAAW;SACpB,CAAC,CAAC;QAEH,OAAO,SAAS,CAAC;IAClB,CAAC;;AAzIe;;;;WAAc,mCAAmC;GAAC;AAElD;;;;WAAQ;QACvB,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC;YACnB,WAAW,EACV,iHAAiH;SAClH,CAAC;QACF,GAAG,EAAE,KAAK,CAAC,MAAM,CAAC;YACjB,WAAW,EAAE,sFAAsF;SACnG,CAAC;QACF,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC;YACrB,WAAW,EACV,sJAAsJ;YACvJ,QAAQ,EAAE,KAAK;SACf,CAAC;QACF,GAAG,EAAE,KAAK,CAAC,OAAO,CAAC;YAClB,WAAW,EAAE,kEAAkE;SAC/E,CAAC;KACF;GAAC;AAEc;;;;WAAiB,IAAI;GAAC"}
@@ -0,0 +1,6 @@
1
+ import { ApifyCommand } from '../../lib/apify_command.js';
2
+ export declare class ActorIndexCommand extends ApifyCommand<typeof ActorIndexCommand> {
3
+ static description: string;
4
+ run(): Promise<void>;
5
+ }
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/builds/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,qBAAa,iBAAkB,SAAQ,YAAY,CAAC,OAAO,iBAAiB,CAAC;IAC5E,OAAgB,WAAW,SAAyD;IAE9E,GAAG;CAGT"}
@@ -0,0 +1,13 @@
1
+ import { ApifyCommand } from '../../lib/apify_command.js';
2
+ export class ActorIndexCommand extends ApifyCommand {
3
+ async run() {
4
+ await this.printHelp();
5
+ }
6
+ }
7
+ Object.defineProperty(ActorIndexCommand, "description", {
8
+ enumerable: true,
9
+ configurable: true,
10
+ writable: true,
11
+ value: 'Commands are designed to be used with Actor Builds.'
12
+ });
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/builds/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,MAAM,OAAO,iBAAkB,SAAQ,YAAsC;IAG5E,KAAK,CAAC,GAAG;QACR,MAAM,IAAI,CAAC,SAAS,EAAE,CAAC;IACxB,CAAC;;AAJe;;;;WAAc,qDAAqD;GAAC"}
@@ -0,0 +1,10 @@
1
+ import { ApifyCommand } from '../../lib/apify_command.js';
2
+ export declare class BuildInfoCommand extends ApifyCommand<typeof BuildInfoCommand> {
3
+ static description: string;
4
+ static args: {
5
+ buildId: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
6
+ };
7
+ static enableJsonFlag: boolean;
8
+ run(): Promise<import("apify-client").Build | undefined>;
9
+ }
10
+ //# sourceMappingURL=info.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"info.d.ts","sourceRoot":"","sources":["../../../src/commands/builds/info.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAM1D,qBAAa,gBAAiB,SAAQ,YAAY,CAAC,OAAO,gBAAgB,CAAC;IAC1E,OAAgB,WAAW,SAAgD;IAE3E,OAAgB,IAAI;;MAKlB;IAEF,OAAgB,cAAc,UAAQ;IAEhC,GAAG;CAkFT"}
@@ -0,0 +1,92 @@
1
+ import { Args } from '@oclif/core';
2
+ import chalk from 'chalk';
3
+ import { ApifyCommand } from '../../lib/apify_command.js';
4
+ import { prettyPrintBytes } from '../../lib/commands/pretty-print-bytes.js';
5
+ import { prettyPrintStatus } from '../../lib/commands/pretty-print-status.js';
6
+ import { error, simpleLog } from '../../lib/outputs.js';
7
+ import { DurationFormatter, getLoggedClientOrThrow, TimestampFormatter } from '../../lib/utils.js';
8
+ export class BuildInfoCommand extends ApifyCommand {
9
+ async run() {
10
+ const { buildId } = this.args;
11
+ const apifyClient = await getLoggedClientOrThrow();
12
+ const build = await apifyClient.build(buildId).get();
13
+ if (!build) {
14
+ error({ message: `Build with ID "${buildId}" was not found on your account.` });
15
+ return;
16
+ }
17
+ // JSON output -> return the object (which is handled by oclif)
18
+ if (this.flags.json) {
19
+ return build;
20
+ }
21
+ const actor = await apifyClient.actor(build.actId).get();
22
+ let buildTag;
23
+ if (actor?.taggedBuilds) {
24
+ for (const [tag, buildData] of Object.entries(actor.taggedBuilds)) {
25
+ if (buildData.buildId === build.id) {
26
+ buildTag = tag;
27
+ break;
28
+ }
29
+ }
30
+ }
31
+ // TODO: untyped field, https://github.com/apify/apify-client-js/issues/526
32
+ const exitCode = Reflect.get(build, 'exitCode');
33
+ const fullActorName = actor?.username ? `${actor.username}/${actor.name}` : actor?.name ?? 'unknown-actor';
34
+ const versionTaggedAs = buildTag ? ` (tagged as ${chalk.yellow(buildTag)})` : '';
35
+ const exitCodeStatus = typeof exitCode !== 'undefined' ? ` (exit code: ${chalk.gray(exitCode)})` : '';
36
+ const message = [
37
+ //
38
+ `${chalk.yellow('Actor')}: ${fullActorName} (${chalk.gray(build.actId)})`,
39
+ '',
40
+ `${chalk.yellow('Build Information')} (ID: ${chalk.gray(build.id)})`,
41
+ ` ${chalk.yellow('Build Number')}: ${build.buildNumber}${versionTaggedAs}`,
42
+ ` ${chalk.yellow('Status')}: ${prettyPrintStatus(build.status)}${exitCodeStatus}`,
43
+ ` ${chalk.yellow('Started')}: ${TimestampFormatter.display(build.startedAt)}`,
44
+ ];
45
+ if (build.finishedAt) {
46
+ message.push(` ${chalk.yellow('Finished')}: ${TimestampFormatter.display(build.finishedAt)} (took ${chalk.gray(DurationFormatter.format(build.stats?.durationMillis ?? 0))})`);
47
+ }
48
+ else {
49
+ const diff = Date.now() - build.startedAt.getTime();
50
+ message.push(` ${chalk.yellow('Finished')}: ${chalk.gray(`Running for ${DurationFormatter.format(diff)}`)}`);
51
+ }
52
+ if (build.stats?.computeUnits) {
53
+ // Platform shows 3 decimal places, so shall we
54
+ message.push(` ${chalk.yellow('Compute Units')}: ${build.stats.computeUnits.toFixed(3)}`);
55
+ }
56
+ // TODO: untyped field, https://github.com/apify/apify-client-js/issues/526
57
+ const dockerImageSize = Reflect.get(build.stats ?? {}, 'imageSizeBytes');
58
+ if (dockerImageSize) {
59
+ message.push(` ${chalk.yellow('Docker Image Size')}: ${prettyPrintBytes(dockerImageSize)}`);
60
+ }
61
+ message.push(` ${chalk.yellow('Origin')}: ${build.meta.origin ?? 'UNKNOWN'}`);
62
+ message.push('');
63
+ const url = `https://console.apify.com/actors/${build.actId}/builds/${build.buildNumber}`;
64
+ message.push(`${chalk.blue('View in Apify Console')}: ${url}`);
65
+ simpleLog({ message: message.join('\n') });
66
+ return undefined;
67
+ }
68
+ }
69
+ Object.defineProperty(BuildInfoCommand, "description", {
70
+ enumerable: true,
71
+ configurable: true,
72
+ writable: true,
73
+ value: 'Prints information about a specific build.'
74
+ });
75
+ Object.defineProperty(BuildInfoCommand, "args", {
76
+ enumerable: true,
77
+ configurable: true,
78
+ writable: true,
79
+ value: {
80
+ buildId: Args.string({
81
+ required: true,
82
+ description: 'The build ID to get information about.',
83
+ }),
84
+ }
85
+ });
86
+ Object.defineProperty(BuildInfoCommand, "enableJsonFlag", {
87
+ enumerable: true,
88
+ configurable: true,
89
+ writable: true,
90
+ value: true
91
+ });
92
+ //# sourceMappingURL=info.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"info.js","sourceRoot":"","sources":["../../../src/commands/builds/info.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACnC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1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AAE,CAAC,CAAC;QAEjB,MAAM,GAAG,GAAG,oCAAoC,KAAK,CAAC,KAAK,WAAW,KAAK,CAAC,WAAW,EAAE,CAAC;QAE1F,OAAO,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,uBAAuB,CAAC,KAAK,GAAG,EAAE,CAAC,CAAC;QAE/D,SAAS,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAE3C,OAAO,SAAS,CAAC;IAClB,CAAC;;AA5Fe;;;;WAAc,4CAA4C;GAAC;AAE3D;;;;WAAO;QACtB,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC;YACpB,QAAQ,EAAE,IAAI;YACd,WAAW,EAAE,wCAAwC;SACrD,CAAC;KACF;GAAC;AAEc;;;;WAAiB,IAAI;GAAC"}
@@ -0,0 +1,9 @@
1
+ import { ApifyCommand } from '../../lib/apify_command.js';
2
+ export declare class BuildLogCommand extends ApifyCommand<typeof BuildLogCommand> {
3
+ static description: string;
4
+ static args: {
5
+ buildId: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
6
+ };
7
+ run(): Promise<void>;
8
+ }
9
+ //# sourceMappingURL=log.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../../src/commands/builds/log.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAI1D,qBAAa,eAAgB,SAAQ,YAAY,CAAC,OAAO,eAAe,CAAC;IACxE,OAAgB,WAAW,SAAyC;IAEpE,OAAgB,IAAI;;MAKlB;IAEI,GAAG;CAqBT"}
@@ -0,0 +1,41 @@
1
+ import { Args } from '@oclif/core';
2
+ import { ApifyCommand } from '../../lib/apify_command.js';
3
+ import { error, info } from '../../lib/outputs.js';
4
+ import { getLoggedClientOrThrow, outputJobLog } from '../../lib/utils.js';
5
+ export class BuildLogCommand extends ApifyCommand {
6
+ async run() {
7
+ const { buildId } = this.args;
8
+ const apifyClient = await getLoggedClientOrThrow();
9
+ const build = await apifyClient.build(buildId).get();
10
+ if (!build) {
11
+ error({ message: `Build with ID "${buildId}" was not found on your account.` });
12
+ return;
13
+ }
14
+ info({ message: `Log for build with ID "${buildId}":\n` });
15
+ try {
16
+ await outputJobLog(build);
17
+ }
18
+ catch (err) {
19
+ // This should never happen...
20
+ error({ message: `Failed to get log for build with ID "${buildId}": ${err.message}` });
21
+ }
22
+ }
23
+ }
24
+ Object.defineProperty(BuildLogCommand, "description", {
25
+ enumerable: true,
26
+ configurable: true,
27
+ writable: true,
28
+ value: 'Prints the log of a specific build.'
29
+ });
30
+ Object.defineProperty(BuildLogCommand, "args", {
31
+ enumerable: true,
32
+ configurable: true,
33
+ writable: true,
34
+ value: {
35
+ buildId: Args.string({
36
+ required: true,
37
+ description: 'The build ID to get the log from.',
38
+ }),
39
+ }
40
+ });
41
+ //# sourceMappingURL=log.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"log.js","sourceRoot":"","sources":["../../../src/commands/builds/log.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAE1E,MAAM,OAAO,eAAgB,SAAQ,YAAoC;IAUxE,KAAK,CAAC,GAAG;QACR,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC;QAE9B,MAAM,WAAW,GAAG,MAAM,sBAAsB,EAAE,CAAC;QAEnD,MAAM,KAAK,GAAG,MAAM,WAAW,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,CAAC;QAErD,IAAI,CAAC,KAAK,EAAE,CAAC;YACZ,KAAK,CAAC,EAAE,OAAO,EAAE,kBAAkB,OAAO,kCAAkC,EAAE,CAAC,CAAC;YAChF,OAAO;QACR,CAAC;QAED,IAAI,CAAC,EAAE,OAAO,EAAE,0BAA0B,OAAO,MAAM,EAAE,CAAC,CAAC;QAE3D,IAAI,CAAC;YACJ,MAAM,YAAY,CAAC,KAAK,CAAC,CAAC;QAC3B,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACd,8BAA8B;YAC9B,KAAK,CAAC,EAAE,OAAO,EAAE,wCAAwC,OAAO,MAAO,GAAa,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QACnG,CAAC;IACF,CAAC;;AA7Be;;;;WAAc,qCAAqC;GAAC;AAEpD;;;;WAAO;QACtB,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC;YACpB,QAAQ,EAAE,IAAI;YACd,WAAW,EAAE,mCAAmC;SAChD,CAAC;KACF;GAAC"}
@@ -0,0 +1,15 @@
1
+ import { ApifyCommand } from '../../lib/apify_command.js';
2
+ export declare class BuildLsCommand extends ApifyCommand<typeof BuildLsCommand> {
3
+ static description: string;
4
+ static flags: {
5
+ actor: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
6
+ offset: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
7
+ limit: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
8
+ desc: import("@oclif/core/interfaces").BooleanFlag<boolean>;
9
+ compact: import("@oclif/core/interfaces").BooleanFlag<boolean>;
10
+ };
11
+ static enableJsonFlag: boolean;
12
+ run(): Promise<import("apify-client").BuildCollectionClientListResult | undefined>;
13
+ private generateTableForActorVersion;
14
+ }
15
+ //# sourceMappingURL=ls.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ls.d.ts","sourceRoot":"","sources":["../../../src/commands/builds/ls.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAa1D,qBAAa,cAAe,SAAQ,YAAY,CAAC,OAAO,cAAc,CAAC;IACtE,OAAgB,WAAW,SAAoC;IAE/D,OAAgB,KAAK;;;;;;MAsBnB;IAEF,OAAgB,cAAc,UAAQ;IAEhC,GAAG;IA2FT,OAAO,CAAC,4BAA4B;CAsCpC"}
@@ -0,0 +1,144 @@
1
+ import { Flags } from '@oclif/core';
2
+ import chalk from 'chalk';
3
+ import { ApifyCommand } from '../../lib/apify_command.js';
4
+ import { prettyPrintStatus } from '../../lib/commands/pretty-print-status.js';
5
+ import { resolveActorContext } from '../../lib/commands/resolve-actor-context.js';
6
+ import { ResponsiveTable } from '../../lib/commands/responsive-table.js';
7
+ import { error, simpleLog } from '../../lib/outputs.js';
8
+ import { getLoggedClientOrThrow, objectGroupBy, ShortDurationFormatter } from '../../lib/utils.js';
9
+ const tableFactory = () => new ResponsiveTable({
10
+ allColumns: ['Number', 'ID', 'Status', 'Took'],
11
+ mandatoryColumns: ['Number', 'ID', 'Status', 'Took'],
12
+ });
13
+ export class BuildLsCommand extends ApifyCommand {
14
+ async run() {
15
+ const { actor, desc, limit, offset, compact, json } = this.flags;
16
+ const client = await getLoggedClientOrThrow();
17
+ // TODO: technically speaking, we don't *need* an actor id to list builds. But it makes more sense to have a table of builds for a specific actor.
18
+ const ctx = await resolveActorContext({ providedActorNameOrId: actor, client });
19
+ if (!ctx.valid) {
20
+ error({
21
+ message: `${ctx.reason}. Please run this command in an Actor directory, or specify the Actor ID by running this command with "--actor=<id>".`,
22
+ });
23
+ return;
24
+ }
25
+ const allBuilds = await client.actor(ctx.id).builds().list({ desc, limit, offset });
26
+ const actorInfo = (await client.actor(ctx.id).get());
27
+ const buildsByActorVersion = objectGroupBy(allBuilds.items, (item) => {
28
+ const versionNumber = Reflect.get(item, 'buildNumber');
29
+ const [major, minor] = versionNumber.split('.');
30
+ return `${major}.${minor}`;
31
+ });
32
+ const buildTagToActorVersion = Object.entries(actorInfo.taggedBuilds ?? {}).reduce((acc, [tag, data]) => {
33
+ acc[data.buildNumber] = tag;
34
+ return acc;
35
+ }, {});
36
+ if (json) {
37
+ // Hydrate the builds with their tags
38
+ for (const build of allBuilds.items) {
39
+ // TODO: untyped field, https://github.com/apify/apify-client-js/issues/526
40
+ const buildNumber = Reflect.get(build, 'buildNumber');
41
+ const hasTag = buildTagToActorVersion[buildNumber];
42
+ if (hasTag) {
43
+ Reflect.set(build, 'buildTag', hasTag);
44
+ }
45
+ }
46
+ return allBuilds;
47
+ }
48
+ simpleLog({
49
+ message: `${chalk.reset('Showing')} ${chalk.yellow(allBuilds.items.length)} out of ${chalk.yellow(allBuilds.total)} builds for Actor ${chalk.yellow(ctx.userFriendlyId)} (${chalk.gray(ctx.id)})\n`,
50
+ });
51
+ const sortedActorVersions = Object.entries(buildsByActorVersion).sort((a, b) => a[0].localeCompare(b[0]));
52
+ for (const [actorVersion, buildsForVersion] of sortedActorVersions) {
53
+ if (!buildsForVersion?.length) {
54
+ simpleLog({
55
+ message: `No builds for version ${actorVersion}`,
56
+ });
57
+ continue;
58
+ }
59
+ const latestBuildTag = actorInfo.versions.find((v) => v.versionNumber === actorVersion)?.buildTag;
60
+ const table = this.generateTableForActorVersion({
61
+ buildsForVersion,
62
+ buildTagToActorVersion,
63
+ });
64
+ const latestBuildTagMessage = latestBuildTag
65
+ ? ` (latest build gets tagged with ${chalk.yellow(latestBuildTag)})`
66
+ : '';
67
+ const message = [
68
+ chalk.reset(`Builds for Actor Version ${chalk.yellow(actorVersion)}${latestBuildTagMessage}`),
69
+ table.render(compact),
70
+ '',
71
+ ];
72
+ simpleLog({
73
+ message: message.join('\n'),
74
+ });
75
+ }
76
+ return undefined;
77
+ }
78
+ generateTableForActorVersion({ buildsForVersion, buildTagToActorVersion, }) {
79
+ const table = tableFactory();
80
+ for (const build of buildsForVersion) {
81
+ // TODO: untyped field, https://github.com/apify/apify-client-js/issues/526
82
+ const buildNumber = Reflect.get(build, 'buildNumber');
83
+ const hasTag = buildTagToActorVersion[buildNumber]
84
+ ? ` (${chalk.yellow(buildTagToActorVersion[buildNumber])})`
85
+ : '';
86
+ let finishedAt;
87
+ if (build.finishedAt) {
88
+ const diff = build.finishedAt.getTime() - build.startedAt.getTime();
89
+ finishedAt = chalk.gray(`${ShortDurationFormatter.format(diff, undefined, { left: '' })}`);
90
+ }
91
+ else {
92
+ const diff = Date.now() - build.startedAt.getTime();
93
+ finishedAt = chalk.gray(`Running for ${ShortDurationFormatter.format(diff, undefined, { left: '' })}`);
94
+ }
95
+ table.pushRow({
96
+ Number: `${buildNumber}${hasTag}`,
97
+ ID: chalk.gray(build.id),
98
+ Status: prettyPrintStatus(build.status),
99
+ Took: finishedAt,
100
+ });
101
+ }
102
+ return table;
103
+ }
104
+ }
105
+ Object.defineProperty(BuildLsCommand, "description", {
106
+ enumerable: true,
107
+ configurable: true,
108
+ writable: true,
109
+ value: 'Lists all builds of the Actor.'
110
+ });
111
+ Object.defineProperty(BuildLsCommand, "flags", {
112
+ enumerable: true,
113
+ configurable: true,
114
+ writable: true,
115
+ value: {
116
+ actor: Flags.string({
117
+ description: 'Optional Actor ID or Name to list builds for. By default, it will use the Actor from the current directory.',
118
+ }),
119
+ offset: Flags.integer({
120
+ description: 'Number of builds that will be skipped.',
121
+ default: 0,
122
+ }),
123
+ limit: Flags.integer({
124
+ description: 'Number of builds that will be listed.',
125
+ default: 10,
126
+ }),
127
+ desc: Flags.boolean({
128
+ description: 'Sort builds in descending order.',
129
+ default: false,
130
+ }),
131
+ compact: Flags.boolean({
132
+ description: 'Display a compact table.',
133
+ default: false,
134
+ char: 'c',
135
+ }),
136
+ }
137
+ });
138
+ Object.defineProperty(BuildLsCommand, "enableJsonFlag", {
139
+ enumerable: true,
140
+ configurable: true,
141
+ writable: true,
142
+ value: true
143
+ });
144
+ //# sourceMappingURL=ls.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ls.js","sourceRoot":"","sources":["../../../src/commands/builds/ls.ts"],"names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AAsB,CAAC,MAAM,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC;YACxG,CAAC;YAED,KAAK,CAAC,OAAO,CAAC;gBACb,MAAM,EAAE,GAAG,WAAW,GAAG,MAAM,EAAE;gBACjC,EAAE,EAAE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;gBACxB,MAAM,EAAE,iBAAiB,CAAC,KAAK,CAAC,MAAM,CAAC;gBACvC,IAAI,EAAE,UAAU;aAChB,CAAC,CAAC;QACJ,CAAC;QAED,OAAO,KAAK,CAAC;IACd,CAAC;;AA5Je;;;;WAAc,gCAAgC;GAAC;AAE/C;;;;WAAQ;QACvB,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC;YACnB,WAAW,EACV,6GAA6G;SAC9G,CAAC;QACF,MAAM,EAAE,KAAK,CAAC,OAAO,CAAC;YACrB,WAAW,EAAE,wCAAwC;YACrD,OAAO,EAAE,CAAC;SACV,CAAC;QACF,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC;YACpB,WAAW,EAAE,uCAAuC;YACpD,OAAO,EAAE,EAAE;SACX,CAAC;QACF,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC;YACnB,WAAW,EAAE,kCAAkC;YAC/C,OAAO,EAAE,KAAK;SACd,CAAC;QACF,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC;YACtB,WAAW,EAAE,0BAA0B;YACvC,OAAO,EAAE,KAAK;YACd,IAAI,EAAE,GAAG;SACT,CAAC;KACF;GAAC;AAEc;;;;WAAiB,IAAI;GAAC"}
@@ -159,16 +159,16 @@ export class CreateCommand extends ApifyCommand {
159
159
  }
160
160
  else {
161
161
  warning({
162
- message: `Python Actors require Python 3.8 or higher, but you have Python ${pythonVersion}!`,
162
+ message: `Python Actors require Python 3.9 or higher, but you have Python ${pythonVersion}!`,
163
163
  });
164
164
  warning({
165
- message: 'Please install Python 3.8 or higher to be able to run Python Actors locally.',
165
+ message: 'Please install Python 3.9 or higher to be able to run Python Actors locally.',
166
166
  });
167
167
  }
168
168
  }
169
169
  else {
170
170
  warning({
171
- message: 'No Python detected! Please install Python 3.8 or higher to be able to run Python Actors locally.',
171
+ message: 'No Python detected! Please install Python 3.9 or higher to be able to run Python Actors locally.',
172
172
  });
173
173
  }
174
174
  }
@@ -221,16 +221,16 @@ export class RunCommand extends ApifyCommand {
221
221
  }
222
222
  else {
223
223
  error({
224
- message: `Python Actors require Python 3.8 or higher, but you have Python ${pythonVersion}!`,
224
+ message: `Python Actors require Python 3.9 or higher, but you have Python ${pythonVersion}!`,
225
225
  });
226
226
  error({
227
- message: 'Please install Python 3.8 or higher to be able to run Python Actors locally.',
227
+ message: 'Please install Python 3.9 or higher to be able to run Python Actors locally.',
228
228
  });
229
229
  }
230
230
  }
231
231
  else {
232
232
  error({
233
- message: 'No Python detected! Please install Python 3.8 or higher to be able to run Python Actors locally.',
233
+ message: 'No Python detected! Please install Python 3.9 or higher to be able to run Python Actors locally.',
234
234
  });
235
235
  }
236
236
  }
@@ -0,0 +1,14 @@
1
+ import { ApifyCommand } from '../../lib/apify_command.js';
2
+ export declare class RunsLsCommand extends ApifyCommand<typeof RunsLsCommand> {
3
+ static description: string;
4
+ static flags: {
5
+ actor: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
6
+ offset: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
7
+ limit: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
8
+ desc: import("@oclif/core/interfaces").BooleanFlag<boolean>;
9
+ compact: import("@oclif/core/interfaces").BooleanFlag<boolean>;
10
+ };
11
+ static enableJsonFlag: boolean;
12
+ run(): Promise<import("apify-client").PaginatedList<import("apify-client").ActorRunListItem> | undefined>;
13
+ }
14
+ //# sourceMappingURL=ls.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ls.d.ts","sourceRoot":"","sources":["../../../src/commands/runs/ls.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAoB1D,qBAAa,aAAc,SAAQ,YAAY,CAAC,OAAO,aAAa,CAAC;IACpE,OAAgB,WAAW,SAAkC;IAE7D,OAAgB,KAAK;;;;;;MAsBnB;IAEF,OAAgB,cAAc,UAAQ;IAEhC,GAAG;CAiFT"}