apify-cli 1.10.1-beta.56 → 1.10.1-beta.57

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.
@@ -1,4 +1,4 @@
1
- import e from"node:process";import t from"chalk";import n from"indent-string";import r from"widest-line";import i from"wrap-ansi";import a,{basename as s,dirname as c,isAbsolute as l,join as u,relative as f,resolve as p,sep as m}from"node:path";import{inspect as h,parseArgs as g,promisify as _}from"node:util";import{gt as v,gte as y,minVersion as b,satisfies as x}from"semver";import{appendFileSync as S,chmodSync as C,closeSync as w,constants as T,copyFileSync as E,createWriteStream as D,existsSync as O,fstat as k,mkdirSync as A,openSync as j,readFileSync as M,readdirSync as ee,realpathSync as te,renameSync as N,rmSync as P,statSync as ne,unlinkSync as re,writeFileSync as F,writeSync as ie}from"node:fs";import ae from"string-width";import oe from"strip-ansi";import{once as se}from"node:events";import{homedir as ce,platform as le}from"node:os";import ue,{isCI as de}from"ci-info";import{ACTOR_ENV_VARS as I,ACTOR_JOB_STATUSES as L,ACTOR_JOB_TERMINAL_STATUSES as fe,ACTOR_JOB_TYPES as R,ACTOR_NAME as pe,ACTOR_SOURCE_TYPES as me,APIFY_ENV_VARS as z,KEY_VALUE_STORE_KEYS as he,LOCAL_ACTOR_ENV_VARS as ge,LOCAL_STORAGE_SUBDIRS as _e,MAX_MULTIFILE_BYTES as ve,META_ORIGINS as ye,SOURCE_FILE_FORMATS as be}from"@apify/consts";import{jaroWinkler as xe}from"@skyra/jaro-winkler";import Se from"js-levenshtein";import{ApifyApiError as Ce,ApifyClient as we,DownloadItemsFormat as Te}from"apify-client";import Ee,{AxiosHeaders as De}from"axios";import{createHmacSignature as Oe,cryptoRandomObjectId as ke}from"@apify/utilities";import{access as Ae,appendFile as je,mkdir as B,readFile as Me,readdir as Ne,rename as Pe,rm as Fe,stat as V,symlink as Ie,unlink as Le,writeFile as H}from"node:fs/promises";import{setTimeout as Re}from"node:timers/promises";import{Result as ze,err as Be,none as U,ok as Ve,some as He}from"@sapphire/result";import{execa as Ue}from"execa";import We from"configparser";import Ge from"@inquirer/input";import Ke from"which";import{execFileSync as qe,execSync as Je,spawn as Ye}from"node:child_process";import{DurationFormatter as Xe,Time as Ze,TimeTypes as Qe}from"@sapphire/duration";import{Timestamp as $e}from"@sapphire/timestamp";import et from"adm-zip";import tt from"ajv/dist/2019.js";import{ZipArchive as nt}from"archiver";import rt from"escape-string-regexp";import it from"ignore";import{getEncoding as at}from"istextorbinary";import ot,{Mime as st}from"mime";import ct from"mime/types/other.js";import lt from"mime/types/standard.js";import{glob as ut}from"tinyglobby";import{calculateRunDynamicMemory as dt}from"@apify/actor-memory-expression";import{Separator as ft,createPrompt as pt,isEnterKey as mt,makeTheme as ht,useKeypress as gt,usePrefix as _t,useState as vt}from"@inquirer/core";import{compile as yt}from"json-schema-to-typescript";import{validateInputSchema as bt,validateInputUsingValidator as xt}from"@apify/input_schema";import{getDatasetSchemaValidator as St,getKeyValueStoreSchemaValidator as Ct,getOutputSchemaValidator as wt}from"@apify/json_schemas";import{pipeline as Tt}from"node:stream/promises";import{MemoryStorage as Et}from"@crawlee/memory-storage";import Dt from"cli-table3";import{downloadTemplate as Ot}from"giget";import kt from"jju";import At from"open";import{fetchManifest as jt,manifestUrl as Mt,wrapperManifestUrl as Nt}from"@apify/actor-templates";import Pt from"computer-name";import Ft from"@inquirer/password";import{createServer as It}from"node:http";import{createHash as Lt,randomBytes as Rt}from"node:crypto";import zt from"@inquirer/select";import Bt from"node:assert";import{ReadStream as Vt}from"node:tty";import Ht from"detect-indent";import{fileURLToPath as Ut}from"node:url";import Wt from"@root/walk";import Gt from"handlebars";function internalLog(e){e.stdoutOutput&&console.log(...e.stdoutOutput),e.stderrOutput&&console.error(...e.stderrOutput)}function simpleLog(e){internalLog({[e.stdout?`stdoutOutput`:`stderrOutput`]:[e.message]})}function error(e){internalLog({[e.stdout?`stdoutOutput`:`stderrOutput`]:[t.red(`Error:`),e.message]})}function warning(e){internalLog({[e.stdout?`stdoutOutput`:`stderrOutput`]:[t.yellow.bold(`Warning:`),e.message]})}function success(e){internalLog({[e.stdout?`stdoutOutput`:`stderrOutput`]:[t.green(`Success:`),e.message]})}function run(e){internalLog({[e.stdout?`stdoutOutput`:`stderrOutput`]:[t.gray(`Run:`),e.message]})}function info(e){internalLog({[e.stdout?`stdoutOutput`:`stderrOutput`]:[t.white(`Info:`),e.message]})}function detectInstallMethod(){if(process.env.APIFY_CLI_BUNDLE)return`bundle`;let e=process.argv[1];if(!e)return warning({message:`Failed to detect install method of CLI, assuming npm`}),`npm`;let t=te(e);return process.env.VOLTA_HOME&&t.includes(process.env.VOLTA_HOME)?`volta`:t.includes(`homebrew/Cellar`)||t.includes(`linuxbrew/Cellar`)?`homebrew`:process.env.PNPM_HOME&&t.includes(process.env.PNPM_HOME)?`pnpm`:process.env.BUN_INSTALL&&t.includes(process.env.BUN_INSTALL)?`bun`:`npm`}function getRuntimeInfo(){return process.versions.bun?{runtime:`bun`,version:process.versions.bun,nodeVersion:process.versions.node}:process.versions.deno?{runtime:`deno`,version:process.versions.deno,nodeVersion:process.versions.node}:{runtime:`node`,version:process.versions.node}}let Kt=null;function useCLIMetadata(){if(Kt)return Kt;let e=detectInstallMethod(),t=getRuntimeInfo();return Kt={version:`1.10.1-beta.56`,hash:`bd0f69d5bfeaa274a0e4b1689ab3574c80835d18`,arch:process.env.APIFY_BUNDLE_ARCH??process.arch,platform:process.platform===`win32`?`windows`:process.platform,runtime:t,extraRuntimeData:t.nodeVersion?`(emulating node ${t.nodeVersion})`:``,installMethod:e,get fullVersionString(){return`apify-cli/${this.version} (${this.hash.slice(0,7)}) running on ${this.platform}-${this.arch} with ${this.runtime.runtime}-${t.version}${this.extraRuntimeData?` ${this.extraRuntimeData}`:``}, installed via ${this.installMethod}`},get isBeta(){return this.version.includes(`beta`)||this.version===`0.0.0`}},e===`bundle`&&(Kt.installPath=c(process.execPath)),Kt}function cliDebugPrint(e,...n){process.env.APIFY_CLI_DEBUG&&console.error(t.gray(`[${e}]`),...n)}const qt=[`apify`,`actor`];function unixWrapperScript(e){return[`#!/bin/sh`,`DIR="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)"`,`APIFY_CLI_ENTRYPOINT=${e} exec "$DIR/apify-cli" "$@"`,``].join(`
1
+ import e from"node:process";import t from"chalk";import n from"indent-string";import r from"widest-line";import i from"wrap-ansi";import a,{basename as s,dirname as c,isAbsolute as l,join as u,relative as f,resolve as p,sep as m}from"node:path";import{inspect as h,parseArgs as g,promisify as _}from"node:util";import{gt as v,gte as y,minVersion as b,satisfies as x}from"semver";import{appendFileSync as S,chmodSync as C,closeSync as w,constants as T,copyFileSync as E,createWriteStream as D,existsSync as O,fstat as k,mkdirSync as A,openSync as j,readFileSync as M,readdirSync as ee,realpathSync as te,renameSync as N,rmSync as P,statSync as ne,unlinkSync as re,writeFileSync as F,writeSync as ie}from"node:fs";import ae from"string-width";import oe from"strip-ansi";import{once as se}from"node:events";import{homedir as ce,platform as le}from"node:os";import ue,{isCI as de}from"ci-info";import{ACTOR_ENV_VARS as I,ACTOR_JOB_STATUSES as L,ACTOR_JOB_TERMINAL_STATUSES as fe,ACTOR_JOB_TYPES as R,ACTOR_NAME as pe,ACTOR_SOURCE_TYPES as me,APIFY_ENV_VARS as z,KEY_VALUE_STORE_KEYS as he,LOCAL_ACTOR_ENV_VARS as ge,LOCAL_STORAGE_SUBDIRS as _e,MAX_MULTIFILE_BYTES as ve,META_ORIGINS as ye,SOURCE_FILE_FORMATS as be}from"@apify/consts";import{jaroWinkler as xe}from"@skyra/jaro-winkler";import Se from"js-levenshtein";import{ApifyApiError as Ce,ApifyClient as we,DownloadItemsFormat as Te}from"apify-client";import Ee,{AxiosHeaders as De}from"axios";import{createHmacSignature as Oe,cryptoRandomObjectId as ke}from"@apify/utilities";import{access as Ae,appendFile as je,mkdir as B,readFile as Me,readdir as Ne,rename as Pe,rm as Fe,stat as V,symlink as Ie,unlink as Le,writeFile as H}from"node:fs/promises";import{setTimeout as Re}from"node:timers/promises";import{Result as ze,err as Be,none as U,ok as Ve,some as He}from"@sapphire/result";import{execa as Ue}from"execa";import We from"configparser";import Ge from"@inquirer/input";import Ke from"which";import{execFileSync as qe,execSync as Je,spawn as Ye}from"node:child_process";import{DurationFormatter as Xe,Time as Ze,TimeTypes as Qe}from"@sapphire/duration";import{Timestamp as $e}from"@sapphire/timestamp";import et from"adm-zip";import tt from"ajv/dist/2019.js";import{ZipArchive as nt}from"archiver";import rt from"escape-string-regexp";import it from"ignore";import{getEncoding as at}from"istextorbinary";import ot,{Mime as st}from"mime";import ct from"mime/types/other.js";import lt from"mime/types/standard.js";import{glob as ut}from"tinyglobby";import{calculateRunDynamicMemory as dt}from"@apify/actor-memory-expression";import{Separator as ft,createPrompt as pt,isEnterKey as mt,makeTheme as ht,useKeypress as gt,usePrefix as _t,useState as vt}from"@inquirer/core";import{compile as yt}from"json-schema-to-typescript";import{validateInputSchema as bt,validateInputUsingValidator as xt}from"@apify/input_schema";import{getDatasetSchemaValidator as St,getKeyValueStoreSchemaValidator as Ct,getOutputSchemaValidator as wt}from"@apify/json_schemas";import{pipeline as Tt}from"node:stream/promises";import{MemoryStorage as Et}from"@crawlee/memory-storage";import Dt from"cli-table3";import{downloadTemplate as Ot}from"giget";import kt from"jju";import At from"open";import{fetchManifest as jt,manifestUrl as Mt,wrapperManifestUrl as Nt}from"@apify/actor-templates";import Pt from"computer-name";import Ft from"@inquirer/password";import{createServer as It}from"node:http";import{createHash as Lt,randomBytes as Rt}from"node:crypto";import zt from"@inquirer/select";import Bt from"node:assert";import{ReadStream as Vt}from"node:tty";import Ht from"detect-indent";import{fileURLToPath as Ut}from"node:url";import Wt from"@root/walk";import Gt from"handlebars";function internalLog(e){e.stdoutOutput&&console.log(...e.stdoutOutput),e.stderrOutput&&console.error(...e.stderrOutput)}function simpleLog(e){internalLog({[e.stdout?`stdoutOutput`:`stderrOutput`]:[e.message]})}function error(e){internalLog({[e.stdout?`stdoutOutput`:`stderrOutput`]:[t.red(`Error:`),e.message]})}function warning(e){internalLog({[e.stdout?`stdoutOutput`:`stderrOutput`]:[t.yellow.bold(`Warning:`),e.message]})}function success(e){internalLog({[e.stdout?`stdoutOutput`:`stderrOutput`]:[t.green(`Success:`),e.message]})}function run(e){internalLog({[e.stdout?`stdoutOutput`:`stderrOutput`]:[t.gray(`Run:`),e.message]})}function info(e){internalLog({[e.stdout?`stdoutOutput`:`stderrOutput`]:[t.white(`Info:`),e.message]})}function detectInstallMethod(){if(process.env.APIFY_CLI_BUNDLE)return`bundle`;let e=process.argv[1];if(!e)return warning({message:`Failed to detect install method of CLI, assuming npm`}),`npm`;let t=te(e);return process.env.VOLTA_HOME&&t.includes(process.env.VOLTA_HOME)?`volta`:t.includes(`homebrew/Cellar`)||t.includes(`linuxbrew/Cellar`)?`homebrew`:process.env.PNPM_HOME&&t.includes(process.env.PNPM_HOME)?`pnpm`:process.env.BUN_INSTALL&&t.includes(process.env.BUN_INSTALL)?`bun`:`npm`}function getRuntimeInfo(){return process.versions.bun?{runtime:`bun`,version:process.versions.bun,nodeVersion:process.versions.node}:process.versions.deno?{runtime:`deno`,version:process.versions.deno,nodeVersion:process.versions.node}:{runtime:`node`,version:process.versions.node}}let Kt=null;function useCLIMetadata(){if(Kt)return Kt;let e=detectInstallMethod(),t=getRuntimeInfo();return Kt={version:`1.10.1-beta.57`,hash:`6f46619dcc76ba2049f6fe51243c97d1db005281`,arch:process.env.APIFY_BUNDLE_ARCH??process.arch,platform:process.platform===`win32`?`windows`:process.platform,runtime:t,extraRuntimeData:t.nodeVersion?`(emulating node ${t.nodeVersion})`:``,installMethod:e,get fullVersionString(){return`apify-cli/${this.version} (${this.hash.slice(0,7)}) running on ${this.platform}-${this.arch} with ${this.runtime.runtime}-${t.version}${this.extraRuntimeData?` ${this.extraRuntimeData}`:``}, installed via ${this.installMethod}`},get isBeta(){return this.version.includes(`beta`)||this.version===`0.0.0`}},e===`bundle`&&(Kt.installPath=c(process.execPath)),Kt}function cliDebugPrint(e,...n){process.env.APIFY_CLI_DEBUG&&console.error(t.gray(`[${e}]`),...n)}const qt=[`apify`,`actor`];function unixWrapperScript(e){return[`#!/bin/sh`,`DIR="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)"`,`APIFY_CLI_ENTRYPOINT=${e} exec "$DIR/apify-cli" "$@"`,``].join(`
2
2
  `)}function windowsCmdWrapperScript(e){return[`@echo off`,`setlocal`,`set "APIFY_CLI_ENTRYPOINT=${e}"`,`"%~dp0apify-cli.exe" %*`,``].join(`\r
3
3
  `)}function windowsPowershellWrapperScript(e){return[`#!/usr/bin/env pwsh`,`$prev = $env:APIFY_CLI_ENTRYPOINT`,`$env:APIFY_CLI_ENTRYPOINT = "${e}"`,`try {`,` & "$PSScriptRoot\\apify-cli.exe" @args`,`} finally {`,` $env:APIFY_CLI_ENTRYPOINT = $prev`,`}`,`exit $LASTEXITCODE`,``].join(`\r
4
4
  `)}function atomicWriteSync(t,n,r){let i=`${t}.${e.pid}.tmp`;try{F(i,n),r!==void 0&&C(i,r),N(i,t)}catch(e){try{P(i,{force:!0})}catch{}throw e}}function atomicCopySync(t,n,r){let i=`${n}.${e.pid}.tmp`;try{E(t,i),r!==void 0&&C(i,r),N(i,n)}catch(e){try{P(i,{force:!0})}catch{}throw e}}function writeEntrypointShims(e,t){for(let n of qt)atomicWriteSync(u(e,n),unixWrapperScript(n),493),t&&(atomicWriteSync(u(e,`${n}.cmd`),windowsCmdWrapperScript(n)),atomicWriteSync(u(e,`${n}.ps1`),windowsPowershellWrapperScript(n)))}function migrateLegacyBundleInstallIfNeeded(){let t=useCLIMetadata();if(t.installMethod!==`bundle`)return;let n=t.platform===`windows`,r=c(e.execPath),i=s(e.execPath).replace(/\.exe$/i,``).toLowerCase();if(n)for(let e of qt){let t=u(r,`${e}.exe.old`);if(O(t))try{P(t,{force:!0}),cliDebugPrint(`[migration] removed stale legacy binary`,t)}catch(e){cliDebugPrint(`[migration] failed to remove stale legacy binary`,{stalePath:t,err:e})}}if(i===`apify-cli`||!qt.includes(i))return;cliDebugPrint(`[migration] legacy multi-bundle install detected, migrating to single bundle`,{binDir:r,selfName:i});let a=u(r,`apify-cli${n?`.exe`:``}`);try{atomicCopySync(e.execPath,a,n?void 0:493),cliDebugPrint(`[migration] copied current bundle to`,a)}catch(e){cliDebugPrint(`[migration] failed to copy current bundle, will retry on next run`,{err:e});return}try{writeEntrypointShims(r,n),cliDebugPrint(`[migration] wrote entrypoint shims`)}catch(e){cliDebugPrint(`[migration] failed to write entrypoint shims, will retry on next run`,{err:e})}if(n){for(let t of qt){let n=u(r,`${t}.exe`);if(O(n))try{p(n)===p(e.execPath)?(N(n,`${n}.old`),cliDebugPrint(`[migration] renamed running legacy binary`,n)):P(n,{force:!0})}catch(e){try{N(n,`${n}.old`)}catch{}cliDebugPrint(`[migration] failed to remove legacy binary`,{legacyBinaryPath:n,err:e})}}let t=u(r,`upgrade.ps1`);try{P(t,{force:!0}),cliDebugPrint(`[migration] removed upgrade script, it will be re-downloaded on the next upgrade`)}catch(e){cliDebugPrint(`[migration] failed to remove upgrade script`,{upgradeScriptPath:t,err:e})}}cliDebugPrint(`[migration] migration to single bundle complete`)}let Jt;function getMaxLineWidth(){if(Jt)return Jt;let e=Number(process.env.APIFY_CLI_MAX_LINE_WIDTH);if(!Number.isNaN(e))Jt=e;else if(!process.stdout.isTTY)Jt=80;else{let e=process.stdout.getWindowSize?.()[0]??-1;Jt=e<1?80:e<40?40:e}return Jt}var BaseCommandRenderer=class{command;entrypoint;constructor(e,t){this.entrypoint=e,this.command=t}pushShortDescription(e){let n=this.command.interactive?`${t.yellow(`[INTERACTIVE]`)} `:``;this.command.shortDescription?e.push(`${n}${this.command.shortDescription}`,``):this.command.description&&e.push(`${n}${this.command.description.split(`
@@ -247,4 +247,4 @@ When no path is provided, validates all schemas found in '${G}':
247
247
  - Dataset schema (from "storages.dataset")
248
248
  - Output schema (from "output")
249
249
  - Key-Value Store schema (from "storages.keyValueStore")`;static group=`Local Actor Development`;static examples=[{description:`Validate the input schema discovered from the default locations.`,command:`apify validate-schema`},{description:`Validate a specific INPUT_SCHEMA.json file.`,command:`apify validate-schema ./my-schema.json`}];static docsUrl=`https://docs.apify.com/cli/docs/reference#apify-validate-schema`;static args={path:Z.string({required:!1,description:`Optional path to your INPUT_SCHEMA.json file. If not provided, validates all schemas in '${G}'.`})};static hiddenAliases=[`vis`];async run(){this.args.path?await this.validateInputSchemaAtPath(this.args.path):await this.validateAllSchemas()}async validateInputSchemaAtPath(t){await readAndValidateInputSchema({forcePath:t,cwd:e.cwd(),getMessage:e=>`Validating input schema at ${e??t}`}),success({message:`Input schema is valid.`})}async validateAllSchemas(){let t=e.cwd(),n=!1,r=!1;try{let{inputSchema:e,inputSchemaPath:r}=await readInputSchema({cwd:t,throwOnMissing:!0});if(e){n=!0,info({message:`Validating input schema ${r?`at ${r}`:`embedded in '${G}'`}`});let t=new Qn({strict:!1});bt(t,e),success({message:`Input schema is valid.`})}}catch(e){n=!0,r=!0,error({message:e.message})}let i=[{label:`Dataset`,read:()=>readStorageSchema({cwd:t,key:`dataset`,label:`Dataset`,throwOnMissing:!0}),validate:validateDatasetSchema},{label:`Output`,read:()=>readStorageSchema({cwd:t,key:`output`,label:`Output`,getRef:e=>e?.output,throwOnMissing:!0}),validate:validateOutputSchema},{label:`Key-Value Store`,read:()=>readStorageSchema({cwd:t,key:`keyValueStore`,label:`Key-Value Store`,throwOnMissing:!0}),validate:validateKvsSchema}];for(let{label:e,read:t,validate:a}of i)try{let r=t();r&&(n=!0,info({message:`Validating ${e} schema ${r.schemaPath?`at ${r.schemaPath}`:`embedded in '${G}'`}`}),a(r.schema),success({message:`${e} schema is valid.`}))}catch(e){n=!0,r=!0,error({message:e.message})}if(!n)throw Error(`No schemas found. Make sure '${G}' exists and defines at least one schema.`);r&&(e.exitCode=5)}};const Ri=[ActorIndexCommand,ActorsIndexCommand,AuthIndexCommand,BuildsIndexCommand,DatasetsIndexCommand,KeyValueStoresIndexCommand,MCPIndexCommand,RequestQueuesIndexCommand,RunsIndexCommand,SecretsIndexCommand,TasksIndexCommand,TelemetryIndexCommand,TemplatesIndexCommand,ApiCommand,TopLevelCallCommand,UpgradeCommand,InstallCommand,CreateCommand,EditInputSchemaCommand,InfoCommand,WrapScrapyCommand,InitCommand,LoginCommand,LogoutCommand,TopLevelPullCommand,ToplevelPushCommand,RunCommand,ValidateSchemaCommand,HelpCommand],zi=[ActorSetValueCommand,ActorPushDataCommand,ActorGetValueCommand,ActorGetPublicUrlCommand,ActorGetInputCommand,ActorChargeCommand,ActorCalculateMemoryCommand,ActorGenerateSchemaTypesCommand,HelpCommand,UpgradeCommand,InstallCommand,TelemetryIndexCommand];export{runCLI as i,Ri as n,processVersionCheck as r,zi as t};
250
- //# sourceMappingURL=_register-CSpT0sFh.js.map
250
+ //# sourceMappingURL=_register-DvxlIEYE.js.map