apify-cli 1.2.2-beta.28 → 1.2.2-beta.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/actor.js CHANGED
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- import{a as o,b as r,d as m}from"./chunk-WPWD5ZUF.js";o("Actor");for(let a of m)a.registerCommand("actor");await r("actor");
2
+ import{a as o,b as r,d as m}from"./chunk-JAT3TWMD.js";o("Actor");for(let a of m)a.registerCommand("actor");await r("actor");
3
3
  //# sourceMappingURL=actor.js.map
package/dist/apify.js CHANGED
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- import{a as o,b as r,c as i}from"./chunk-WPWD5ZUF.js";o("Apify");for(let m of i)m.registerCommand("apify");await r("apify");
2
+ import{a as o,b as r,c as i}from"./chunk-JAT3TWMD.js";o("Apify");for(let m of i)m.registerCommand("apify");await r("apify");
3
3
  //# sourceMappingURL=apify.js.map
@@ -1,4 +1,4 @@
1
- var rc=Object.defineProperty;var u=(r,e)=>rc(r,"name",{value:e,configurable:!0});import Ie from"process";import{parseArgs as kn}from"util";import Hr from"chalk";import{satisfies as Ql}from"semver";import Js from"chalk";import Nl from"indent-string";import kl from"widest-line";import Ll from"wrap-ansi";import oc from"chalk";function C(r,...e){process.env.APIFY_CLI_DEBUG&&console.error(oc.gray(`[${r}]`),...e)}u(C,"cliDebugPrint");import{realpathSync as sc}from"fs";import{dirname as ic}from"path";import dt from"chalk";function Ze(r){r.stdoutOutput&&console.log(...r.stdoutOutput),r.stderrOutput&&console.error(...r.stderrOutput)}u(Ze,"internalLog");function _(r){Ze({[r.stdout?"stdoutOutput":"stderrOutput"]:[r.message]})}u(_,"simpleLog");function d(r){Ze({[r.stdout?"stdoutOutput":"stderrOutput"]:[dt.red("Error:"),r.message]})}u(d,"error");function R(r){Ze({[r.stdout?"stdoutOutput":"stderrOutput"]:[dt.yellow.bold("Warning:"),r.message]})}u(R,"warning");function E(r){Ze({[r.stdout?"stdoutOutput":"stderrOutput"]:[dt.green("Success:"),r.message]})}u(E,"success");function be(r){Ze({[r.stdout?"stdoutOutput":"stderrOutput"]:[dt.gray("Run:"),r.message]})}u(be,"run");function S(r){Ze({[r.stdout?"stdoutOutput":"stderrOutput"]:[dt.white("Info:"),r.message]})}u(S,"info");function Is(r){Ze({[r.stdout?"stdoutOutput":"stderrOutput"]:[dt.blue(r.message),r.url]})}u(Is,"link");var $s="0.0.0";var nc="1.2.2-beta.28",ac="597e7322ca931056e85f9372815b7d0126822d5a";function cc(){if(process.env.APIFY_CLI_MARKED_INSTALL_METHOD)return process.env.APIFY_CLI_MARKED_INSTALL_METHOD;if(process.env.APIFY_CLI_BUNDLE)return"bundle";let r=process.argv[1];if(!r)return R({message:"Failed to detect install method of CLI, assuming npm"}),"npm";let e=sc(r);return process.env.VOLTA_HOME&&e.includes(process.env.VOLTA_HOME)?"volta":e.includes("homebrew/Cellar")||e.includes("linuxbrew/Cellar")?"homebrew":process.env.PNPM_HOME&&e.includes(process.env.PNPM_HOME)?"pnpm":process.env.BUN_INSTALL&&e.includes(process.env.BUN_INSTALL)?"bun":"npm"}u(cc,"detectInstallMethod");function lc(){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}}u(lc,"getRuntimeInfo");var Nt=null;function K(){if(Nt)return Nt;let r=cc(),e=lc();return Nt={version:nc,hash:ac,arch:process.env.APIFY_BUNDLE_ARCH??process.arch,platform:process.platform==="win32"?"windows":process.platform,runtime:e,extraRuntimeData:e.nodeVersion?`(emulating node ${e.nodeVersion})`:"",installMethod:r,get fullVersionString(){return`apify-cli/${this.version} (${this.hash.slice(0,7)}) running on ${this.platform}-${this.arch} with ${this.runtime.runtime}-${e.version}${this.extraRuntimeData?` ${this.extraRuntimeData}`:""}, installed via ${this.installMethod}`},get isBeta(){return this.version.includes("beta")||this.version===$s}},r==="bundle"&&(Nt.installPath=ic(process.execPath)),Nt}u(K,"useCLIMetadata");import{existsSync as Yc,mkdirSync as Hc,readFileSync as Jc,writeFileSync as Kc}from"fs";import{dirname as qc}from"path";import{cryptoRandomObjectId as Wc}from"@apify/utilities";import{homedir as mc}from"os";import{join as Qe}from"path";import{KEY_VALUE_STORE_KEYS as dc,META_ORIGINS as pc}from"@apify/consts";var vi={name:"apify-cli",version:"1.2.2-beta.28",description:"Apify command-line interface (CLI) helps you manage the Apify cloud platform and develop, build, and deploy Apify Actors.",exports:"./dist/index.js",type:"module",scripts:{"dev:apify":"tsx ./src/entrypoints/apify.ts","dev:actor":"tsx ./src/entrypoints/actor.ts","test:all":"yarn test:local && yarn test:api","test:local":"vitest run --testNamePattern '^((?!\\[api]).)*$' --exclude ./test/api","test:api":"vitest run --testNamePattern '\\[api\\]'","test:python":"vitest run --testNamePattern '\\[python\\]'","test:cucumber":'cross-env NODE_OPTIONS="--import tsx" cucumber-js',lint:"eslint src test scripts features --ext .ts,.cjs,.mjs","lint:fix":"eslint src test scripts features --fix --ext .ts,.cjs,.mjs",format:'biome format . && prettier --check "**/*.{md,yml,yaml}"',"format:fix":'biome format --write . && prettier --write "**/*.{md,yml,yaml}"',clean:"rimraf dist",build:"yarn clean && tsc && tsup","build-bundles":"bun run scripts/build-cli-bundles.ts",prepack:"yarn insert-cli-metadata && yarn build && yarn update-docs","insert-cli-metadata":"tsx scripts/insert-cli-metadata.ts","update-docs":"tsx scripts/generate-cli-docs.ts",postinstall:`node -e "console.log('We have an active developer community on Discord. You can find it on https://discord.gg/crawlee-apify-801163717915574323.');"`},files:["dist"],bin:{actor:"./dist/actor.js",apify:"./dist/apify.js","apify-cli":"./dist/apify.js"},contributors:["Jakub Drobn\xEDk <jakub.drobnik@apify.com>","Jan Curn <jan@apify.com>","Vlad Frangu <vlad.frangu@apify.com>"],repository:{type:"git",url:"git+https://github.com/apify/apify-cli.git"},keywords:["apify","client","node","command","line","bash"],author:{name:"Apify",email:"support@apify.com",url:"https://www.apify.com"},license:"Apache-2.0",bugs:{url:"https://github.com/apify/apify-cli/issues"},homepage:"https://github.com/apify/apify-cli#readme",engines:{node:">=20"},dependencies:{"@apify/actor-memory-expression":"^0.1.3","@apify/actor-templates":"^0.1.5","@apify/consts":"^2.36.0","@apify/input_schema":"^3.17.0","@apify/utilities":"^2.18.0","@crawlee/memory-storage":"^3.12.0","@inquirer/core":"^11.0.0","@inquirer/input":"^5.0.0","@inquirer/password":"^5.0.0","@inquirer/select":"^5.0.0","@root/walk":"~1.1.0","@sapphire/duration":"^1.1.2","@sapphire/result":"^2.7.2","@sapphire/timestamp":"^1.0.3","@skyra/jaro-winkler":"^1.1.1","adm-zip":"~0.5.15",ajv:"~8.18.0","apify-client":"^2.22.0",archiver:"~7.0.1",axios:"^1.11.0",chalk:"~5.6.0","cli-table3":"^0.6.5","computer-name":"~0.1.0",configparser:"~0.3.10",cors:"~2.8.5","detect-indent":"~7.0.1","escape-string-regexp":"~5.0.0",execa:"^9.5.2",express:"~5.2.0",globby:"~15.0.0",handlebars:"~4.7.8","indent-string":"^5.0.0","is-ci":"~4.1.0",istextorbinary:"~9.5.0",jju:"~1.4.0","js-levenshtein":"^1.1.6","lodash.clonedeep":"^4.5.0",mime:"~4.1.0",open:"~11.0.0",rimraf:"~6.1.0",semver:"~7.7.0","string-width":"^8.0.0","strip-ansi":"^7.1.0",tiged:"~2.12.7",which:"^6.0.0","widest-line":"^6.0.0","wrap-ansi":"^10.0.0"},devDependencies:{"@apify/eslint-config":"^1.0.0","@apify/tsconfig":"^0.1.1","@biomejs/biome":"^2.0.0","@crawlee/types":"^3.11.1","@cucumber/cucumber":"^12.0.0","@types/adm-zip":"^0.5.5","@types/archiver":"^7.0.0","@types/bun":"^1.2.5","@types/cors":"^2.8.17","@types/execa":"^2.0.2","@types/express":"^5.0.0","@types/is-ci":"^3.0.4","@types/jju":"^1.4.5","@types/js-levenshtein":"^1","@types/lodash.clonedeep":"^4","@types/mime":"^4.0.0","@types/node":"^24.0.0","@types/semver":"^7.5.8","@types/which":"^3.0.4","@yarnpkg/core":"^4.1.2",apify:"^3.2.4","cross-env":"^10.0.0",eslint:"^9.25.1","eslint-config-prettier":"^10.1.2","lint-staged":"^16.0.0","mock-stdin":"^1.0.0",prettier:"^3.5.3",tsup:"^8.5.0",tsx:"^4.16.5",typescript:"^5.8.3","typescript-eslint":"^8.31.0",vitest:"^4.0.0"},volta:{node:"24.13.1",yarn:"4.12.0"},packageManager:"yarn@4.12.0",devEngines:{runtime:[{name:"node",version:">= 20",onFail:"error"},{name:"bun",version:">= 1.2.5",onFail:"ignore"}],packageManager:{name:"yarn",version:">= 4",onFail:"warn"}},"lint-staged":{"*":"biome format --write --no-errors-on-unmatched","*.{mjs,js,ts}":"eslint --fix --ext mjs,js,ts","*.md":"prettier --write"},resolutions:{tar:"7.5.9"}};var et="storage",Es="apify_storage",_s=1,mr={actorSpecification:_s,name:null,version:"0.0",buildTag:"latest",environmentVariables:{}},Si=1440*60*1e3,pt=u(()=>{let r=Qe(mc(),".apify");return process.env.__APIFY_INTERNAL_TEST_AUTH_PATH__?Qe(r,process.env.__APIFY_INTERNAL_TEST_AUTH_PATH__):r},"GLOBAL_CONFIGS_FOLDER"),ce=u(()=>Qe(pt(),"auth.json"),"AUTH_FILE_PATH"),dr=u(()=>Qe(pt(),"secrets.json"),"SECRETS_FILE_PATH"),pr=u(()=>Qe(pt(),"state.json"),"STATE_FILE_PATH"),fr=u(()=>Qe(pt(),"telemetry.json"),"TELEMETRY_FILE_PATH"),gr="apify.json",Rs=".actor",fc="actor.json",V=Qe(Rs,fc),xs=new RegExp(`(^${dc.INPUT}(?:\\.[^.]+)?$)`),ve=vi.engines.node,Ti={"X-Apify-Request-Origin":pc.CLI},tt="3.9.0",Ci=".venv";import{createWriteStream as Sc,existsSync as ue,mkdirSync as Tc,readdirSync as Oi,readFileSync as Mt,writeFileSync as yr}from"fs";import{mkdir as Cc,readFile as Ic}from"fs/promises";import{get as $c}from"https";import{homedir as Ri}from"os";import{dirname as Pi,join as le}from"path";import se from"process";import{finished as Ec}from"stream/promises";import{DurationFormatter as Ni,TimeTypes as rt}from"@sapphire/duration";import{Timestamp as Os}from"@sapphire/timestamp";import _c from"adm-zip";import Rc from"ajv/dist/2019.js";import{ApifyClient as ki}from"apify-client";import xc from"archiver";import{AxiosHeaders as Oc}from"axios";import Pc from"escape-string-regexp";import{globby as Li}from"globby";import{getEncoding as Nc}from"istextorbinary";import{Mime as kc}from"mime";import Lc from"mime/types/other.js";import Dc from"mime/types/standard.js";import{gte as Fc,minVersion as Mc,satisfies as Uc}from"semver";import{ACTOR_ENV_VARS as Ps,ACTOR_JOB_TERMINAL_STATUSES as jc,ACTOR_NAME as Ft,APIFY_ENV_VARS as Bc,KEY_VALUE_STORE_KEYS as xi,LOCAL_ACTOR_ENV_VARS as Ns,LOCAL_STORAGE_SUBDIRS as ks,SOURCE_FILE_FORMATS as Dt}from"@apify/consts";import{existsSync as gc,mkdirSync as hc}from"fs";import{readFile as yc,stat as Ii,unlink as wc,writeFile as Ac}from"fs/promises";import{join as $i,sep as bc}from"path";import{rimraf as vc}from"rimraf";var Ei=u(async(r,e={},t=null)=>{let o=await yc(r,"utf-8"),s=JSON.parse(o),i;t?(i=s,i[t]={...s[t],...e}):i={...s,...e},await Ac(r,JSON.stringify(i,null," "))},"updateLocalJson"),hr=u((r,e)=>{e||(e=r,r="."),e.split(bc).reduce((o,s)=>(o=$i(o,s),gc(o)||hc(o),o),r)},"ensureFolderExistsSync"),kt=u(async r=>{await vc(r)},"rimrafPromised"),Lt=u(async r=>{(await Ii(r)).isFile()&&await wc(r)},"deleteFile"),_i=u(async(r,e)=>(await Promise.all(r.map(async s=>Ii($i(e,s))))).map(s=>s.size).reduce((s,i)=>s+i,0),"sumFilesSizeInBytes");var ft=Rc,wr=u(async r=>new Promise((e,t)=>{$c(r,o=>{o.statusCode===301||o.statusCode===302?(e(wr(o.headers.location)),o.destroy()):e(o)}).on("error",t)}),"httpsGet"),de=u(()=>{let r=Bc.LOCAL_STORAGE_DIR;return se.env[r]||se.env.CRAWLEE_STORAGE_DIR||et},"getLocalStorageDir"),me=u(r=>{let e=Ps.DEFAULT_KEY_VALUE_STORE_ID,t=r||se.env[e]||Ns[e];return le(de(),ks.keyValueStores,t)},"getLocalKeyValueStorePath"),Di=u(r=>{let e=Ps.DEFAULT_DATASET_ID,t=r||se.env[e]||Ns[e];return le(de(),ks.datasets,t)},"getLocalDatasetPath"),Fi=u(r=>{let e=Ps.DEFAULT_REQUEST_QUEUE_ID,t=r||se.env[e]||Ns[e];return le(de(),ks.requestQueues,t)},"getLocalRequestQueuePath"),F=u(async()=>{let r={};try{let e=await Ic(ce(),"utf-8");r=JSON.parse(e)}catch{return{}}if(!r.username&&!r.id)throw new Error('Corrupted local user info was found. Please run "apify login" to fix it.');return r},"getLocalUserInfo");async function I(){let r=await Ut();if(!r)throw se.exitCode=1,new Error('You are not logged in with your Apify account. Call "apify login" to fix that.');return r}u(I,"getLoggedClientOrThrow");var Mi=u(r=>{if(!r&&ue(pt())&&ue(ce())){let e=Mt(ce(),"utf-8");return JSON.parse(e).token}return r},"getTokenWithAuthFileFallback"),Ls=u((r,e)=>(r=Mi(r),{token:r,baseUrl:e||se.env.APIFY_CLIENT_BASE_URL,requestInterceptors:[t=>{t.headers??=new Oc;for(let[o,s]of Object.entries(Ti))t.headers[o]=s;return t}]}),"getApifyClientOptions");async function Ut(r,e){r=Mi(r);let t=new ki(Ls(r,e)),o;try{o=await t.user("me").get()}catch{return null}return Fs(ce()),yr(ce(),JSON.stringify({token:t.token,...o},null," ")),t}u(Ut,"getLoggedClient");var Ds=u(r=>le(r,V),"getLocalConfigPath"),pe=u(r=>{if(ue(r))return JSON.parse(Mt(r,{encoding:"utf-8"}))},"getJsonFileContent"),Ue=u(r=>pe(Ds(r)),"getLocalConfig"),Ar=u(async(r,e)=>{let t=le(e||se.cwd(),V);await Cc(Pi(t),{recursive:!0}),yr(t,JSON.stringify(r,null," "))},"setLocalConfig"),Vc=[de(),"node_modules",".venv"],br=u(async r=>{let e=me();hr(r,Di()),hr(r,Fi()),hr(r,e);let t=le(r,".gitignore"),o="";ue(t)&&(o=Mt(t,{encoding:"utf-8"}));let s=[];for(let i of Vc)RegExp(`^${Pc(i)}$`,"mg").test(o)||s.push(i);s.length>0&&(o.length>0?(s.unshift("# Added by Apify CLI"),yr(t,`
1
+ var rc=Object.defineProperty;var u=(r,e)=>rc(r,"name",{value:e,configurable:!0});import Ie from"process";import{parseArgs as kn}from"util";import Hr from"chalk";import{satisfies as Ql}from"semver";import Js from"chalk";import Nl from"indent-string";import kl from"widest-line";import Ll from"wrap-ansi";import oc from"chalk";function C(r,...e){process.env.APIFY_CLI_DEBUG&&console.error(oc.gray(`[${r}]`),...e)}u(C,"cliDebugPrint");import{realpathSync as sc}from"fs";import{dirname as ic}from"path";import dt from"chalk";function Ze(r){r.stdoutOutput&&console.log(...r.stdoutOutput),r.stderrOutput&&console.error(...r.stderrOutput)}u(Ze,"internalLog");function _(r){Ze({[r.stdout?"stdoutOutput":"stderrOutput"]:[r.message]})}u(_,"simpleLog");function d(r){Ze({[r.stdout?"stdoutOutput":"stderrOutput"]:[dt.red("Error:"),r.message]})}u(d,"error");function R(r){Ze({[r.stdout?"stdoutOutput":"stderrOutput"]:[dt.yellow.bold("Warning:"),r.message]})}u(R,"warning");function E(r){Ze({[r.stdout?"stdoutOutput":"stderrOutput"]:[dt.green("Success:"),r.message]})}u(E,"success");function be(r){Ze({[r.stdout?"stdoutOutput":"stderrOutput"]:[dt.gray("Run:"),r.message]})}u(be,"run");function S(r){Ze({[r.stdout?"stdoutOutput":"stderrOutput"]:[dt.white("Info:"),r.message]})}u(S,"info");function Is(r){Ze({[r.stdout?"stdoutOutput":"stderrOutput"]:[dt.blue(r.message),r.url]})}u(Is,"link");var $s="0.0.0";var nc="1.2.2-beta.29",ac="c4b5d9160f3cfb397aeeab0ad1a1fdf0bce42031";function cc(){if(process.env.APIFY_CLI_MARKED_INSTALL_METHOD)return process.env.APIFY_CLI_MARKED_INSTALL_METHOD;if(process.env.APIFY_CLI_BUNDLE)return"bundle";let r=process.argv[1];if(!r)return R({message:"Failed to detect install method of CLI, assuming npm"}),"npm";let e=sc(r);return process.env.VOLTA_HOME&&e.includes(process.env.VOLTA_HOME)?"volta":e.includes("homebrew/Cellar")||e.includes("linuxbrew/Cellar")?"homebrew":process.env.PNPM_HOME&&e.includes(process.env.PNPM_HOME)?"pnpm":process.env.BUN_INSTALL&&e.includes(process.env.BUN_INSTALL)?"bun":"npm"}u(cc,"detectInstallMethod");function lc(){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}}u(lc,"getRuntimeInfo");var Nt=null;function K(){if(Nt)return Nt;let r=cc(),e=lc();return Nt={version:nc,hash:ac,arch:process.env.APIFY_BUNDLE_ARCH??process.arch,platform:process.platform==="win32"?"windows":process.platform,runtime:e,extraRuntimeData:e.nodeVersion?`(emulating node ${e.nodeVersion})`:"",installMethod:r,get fullVersionString(){return`apify-cli/${this.version} (${this.hash.slice(0,7)}) running on ${this.platform}-${this.arch} with ${this.runtime.runtime}-${e.version}${this.extraRuntimeData?` ${this.extraRuntimeData}`:""}, installed via ${this.installMethod}`},get isBeta(){return this.version.includes("beta")||this.version===$s}},r==="bundle"&&(Nt.installPath=ic(process.execPath)),Nt}u(K,"useCLIMetadata");import{existsSync as Yc,mkdirSync as Hc,readFileSync as Jc,writeFileSync as Kc}from"fs";import{dirname as qc}from"path";import{cryptoRandomObjectId as Wc}from"@apify/utilities";import{homedir as mc}from"os";import{join as Qe}from"path";import{KEY_VALUE_STORE_KEYS as dc,META_ORIGINS as pc}from"@apify/consts";var vi={name:"apify-cli",version:"1.2.2-beta.29",description:"Apify command-line interface (CLI) helps you manage the Apify cloud platform and develop, build, and deploy Apify Actors.",exports:"./dist/index.js",type:"module",scripts:{"dev:apify":"tsx ./src/entrypoints/apify.ts","dev:actor":"tsx ./src/entrypoints/actor.ts","test:all":"yarn test:local && yarn test:api","test:local":"vitest run --testNamePattern '^((?!\\[api]).)*$' --exclude ./test/api","test:api":"vitest run --testNamePattern '\\[api\\]'","test:python":"vitest run --testNamePattern '\\[python\\]'","test:cucumber":'cross-env NODE_OPTIONS="--import tsx" cucumber-js',lint:"eslint src test scripts features --ext .ts,.cjs,.mjs","lint:fix":"eslint src test scripts features --fix --ext .ts,.cjs,.mjs",format:'biome format . && prettier --check "**/*.{md,yml,yaml}"',"format:fix":'biome format --write . && prettier --write "**/*.{md,yml,yaml}"',clean:"rimraf dist",build:"yarn clean && tsc && tsup","build-bundles":"bun run scripts/build-cli-bundles.ts",prepack:"yarn insert-cli-metadata && yarn build && yarn update-docs","insert-cli-metadata":"tsx scripts/insert-cli-metadata.ts","update-docs":"tsx scripts/generate-cli-docs.ts",postinstall:`node -e "console.log('We have an active developer community on Discord. You can find it on https://discord.gg/crawlee-apify-801163717915574323.');"`},files:["dist"],bin:{actor:"./dist/actor.js",apify:"./dist/apify.js","apify-cli":"./dist/apify.js"},contributors:["Jakub Drobn\xEDk <jakub.drobnik@apify.com>","Jan Curn <jan@apify.com>","Vlad Frangu <vlad.frangu@apify.com>"],repository:{type:"git",url:"git+https://github.com/apify/apify-cli.git"},keywords:["apify","client","node","command","line","bash"],author:{name:"Apify",email:"support@apify.com",url:"https://www.apify.com"},license:"Apache-2.0",bugs:{url:"https://github.com/apify/apify-cli/issues"},homepage:"https://github.com/apify/apify-cli#readme",engines:{node:">=20"},dependencies:{"@apify/actor-memory-expression":"^0.1.3","@apify/actor-templates":"^0.1.5","@apify/consts":"^2.36.0","@apify/input_schema":"^3.17.0","@apify/utilities":"^2.18.0","@crawlee/memory-storage":"^3.12.0","@inquirer/core":"^11.0.0","@inquirer/input":"^5.0.0","@inquirer/password":"^5.0.0","@inquirer/select":"^5.0.0","@root/walk":"~1.1.0","@sapphire/duration":"^1.1.2","@sapphire/result":"^2.7.2","@sapphire/timestamp":"^1.0.3","@skyra/jaro-winkler":"^1.1.1","adm-zip":"~0.5.15",ajv:"~8.18.0","apify-client":"^2.22.0",archiver:"~7.0.1",axios:"^1.11.0",chalk:"~5.6.0","cli-table3":"^0.6.5","computer-name":"~0.1.0",configparser:"~0.3.10",cors:"~2.8.5","detect-indent":"~7.0.1","escape-string-regexp":"~5.0.0",execa:"^9.5.2",express:"~5.2.0",globby:"~15.0.0",handlebars:"~4.7.8","indent-string":"^5.0.0","is-ci":"~4.1.0",istextorbinary:"~9.5.0",jju:"~1.4.0","js-levenshtein":"^1.1.6","lodash.clonedeep":"^4.5.0",mime:"~4.1.0",open:"~11.0.0",rimraf:"~6.1.0",semver:"~7.7.0","string-width":"^8.0.0","strip-ansi":"^7.1.0",tiged:"~2.12.7",which:"^6.0.0","widest-line":"^6.0.0","wrap-ansi":"^10.0.0"},devDependencies:{"@apify/eslint-config":"^1.0.0","@apify/tsconfig":"^0.1.1","@biomejs/biome":"^2.0.0","@crawlee/types":"^3.11.1","@cucumber/cucumber":"^12.0.0","@types/adm-zip":"^0.5.5","@types/archiver":"^7.0.0","@types/bun":"^1.2.5","@types/cors":"^2.8.17","@types/execa":"^2.0.2","@types/express":"^5.0.0","@types/is-ci":"^3.0.4","@types/jju":"^1.4.5","@types/js-levenshtein":"^1","@types/lodash.clonedeep":"^4","@types/mime":"^4.0.0","@types/node":"^24.0.0","@types/semver":"^7.5.8","@types/which":"^3.0.4","@yarnpkg/core":"^4.1.2",apify:"^3.2.4","cross-env":"^10.0.0",eslint:"^9.25.1","eslint-config-prettier":"^10.1.2","lint-staged":"^16.0.0","mock-stdin":"^1.0.0",prettier:"^3.5.3",tsup:"^8.5.0",tsx:"^4.16.5",typescript:"^5.8.3","typescript-eslint":"^8.31.0",vitest:"^4.0.0"},volta:{node:"24.13.1",yarn:"4.12.0"},packageManager:"yarn@4.12.0",devEngines:{runtime:[{name:"node",version:">= 20",onFail:"error"},{name:"bun",version:">= 1.2.5",onFail:"ignore"}],packageManager:{name:"yarn",version:">= 4",onFail:"warn"}},"lint-staged":{"*":"biome format --write --no-errors-on-unmatched","*.{mjs,js,ts}":"eslint --fix --ext mjs,js,ts","*.md":"prettier --write"},resolutions:{tar:"7.5.9"}};var et="storage",Es="apify_storage",_s=1,mr={actorSpecification:_s,name:null,version:"0.0",buildTag:"latest",environmentVariables:{}},Si=1440*60*1e3,pt=u(()=>{let r=Qe(mc(),".apify");return process.env.__APIFY_INTERNAL_TEST_AUTH_PATH__?Qe(r,process.env.__APIFY_INTERNAL_TEST_AUTH_PATH__):r},"GLOBAL_CONFIGS_FOLDER"),ce=u(()=>Qe(pt(),"auth.json"),"AUTH_FILE_PATH"),dr=u(()=>Qe(pt(),"secrets.json"),"SECRETS_FILE_PATH"),pr=u(()=>Qe(pt(),"state.json"),"STATE_FILE_PATH"),fr=u(()=>Qe(pt(),"telemetry.json"),"TELEMETRY_FILE_PATH"),gr="apify.json",Rs=".actor",fc="actor.json",V=Qe(Rs,fc),xs=new RegExp(`(^${dc.INPUT}(?:\\.[^.]+)?$)`),ve=vi.engines.node,Ti={"X-Apify-Request-Origin":pc.CLI},tt="3.9.0",Ci=".venv";import{createWriteStream as Sc,existsSync as ue,mkdirSync as Tc,readdirSync as Oi,readFileSync as Mt,writeFileSync as yr}from"fs";import{mkdir as Cc,readFile as Ic}from"fs/promises";import{get as $c}from"https";import{homedir as Ri}from"os";import{dirname as Pi,join as le}from"path";import se from"process";import{finished as Ec}from"stream/promises";import{DurationFormatter as Ni,TimeTypes as rt}from"@sapphire/duration";import{Timestamp as Os}from"@sapphire/timestamp";import _c from"adm-zip";import Rc from"ajv/dist/2019.js";import{ApifyClient as ki}from"apify-client";import xc from"archiver";import{AxiosHeaders as Oc}from"axios";import Pc from"escape-string-regexp";import{globby as Li}from"globby";import{getEncoding as Nc}from"istextorbinary";import{Mime as kc}from"mime";import Lc from"mime/types/other.js";import Dc from"mime/types/standard.js";import{gte as Fc,minVersion as Mc,satisfies as Uc}from"semver";import{ACTOR_ENV_VARS as Ps,ACTOR_JOB_TERMINAL_STATUSES as jc,ACTOR_NAME as Ft,APIFY_ENV_VARS as Bc,KEY_VALUE_STORE_KEYS as xi,LOCAL_ACTOR_ENV_VARS as Ns,LOCAL_STORAGE_SUBDIRS as ks,SOURCE_FILE_FORMATS as Dt}from"@apify/consts";import{existsSync as gc,mkdirSync as hc}from"fs";import{readFile as yc,stat as Ii,unlink as wc,writeFile as Ac}from"fs/promises";import{join as $i,sep as bc}from"path";import{rimraf as vc}from"rimraf";var Ei=u(async(r,e={},t=null)=>{let o=await yc(r,"utf-8"),s=JSON.parse(o),i;t?(i=s,i[t]={...s[t],...e}):i={...s,...e},await Ac(r,JSON.stringify(i,null," "))},"updateLocalJson"),hr=u((r,e)=>{e||(e=r,r="."),e.split(bc).reduce((o,s)=>(o=$i(o,s),gc(o)||hc(o),o),r)},"ensureFolderExistsSync"),kt=u(async r=>{await vc(r)},"rimrafPromised"),Lt=u(async r=>{(await Ii(r)).isFile()&&await wc(r)},"deleteFile"),_i=u(async(r,e)=>(await Promise.all(r.map(async s=>Ii($i(e,s))))).map(s=>s.size).reduce((s,i)=>s+i,0),"sumFilesSizeInBytes");var ft=Rc,wr=u(async r=>new Promise((e,t)=>{$c(r,o=>{o.statusCode===301||o.statusCode===302?(e(wr(o.headers.location)),o.destroy()):e(o)}).on("error",t)}),"httpsGet"),de=u(()=>{let r=Bc.LOCAL_STORAGE_DIR;return se.env[r]||se.env.CRAWLEE_STORAGE_DIR||et},"getLocalStorageDir"),me=u(r=>{let e=Ps.DEFAULT_KEY_VALUE_STORE_ID,t=r||se.env[e]||Ns[e];return le(de(),ks.keyValueStores,t)},"getLocalKeyValueStorePath"),Di=u(r=>{let e=Ps.DEFAULT_DATASET_ID,t=r||se.env[e]||Ns[e];return le(de(),ks.datasets,t)},"getLocalDatasetPath"),Fi=u(r=>{let e=Ps.DEFAULT_REQUEST_QUEUE_ID,t=r||se.env[e]||Ns[e];return le(de(),ks.requestQueues,t)},"getLocalRequestQueuePath"),F=u(async()=>{let r={};try{let e=await Ic(ce(),"utf-8");r=JSON.parse(e)}catch{return{}}if(!r.username&&!r.id)throw new Error('Corrupted local user info was found. Please run "apify login" to fix it.');return r},"getLocalUserInfo");async function I(){let r=await Ut();if(!r)throw se.exitCode=1,new Error('You are not logged in with your Apify account. Call "apify login" to fix that.');return r}u(I,"getLoggedClientOrThrow");var Mi=u(r=>{if(!r&&ue(pt())&&ue(ce())){let e=Mt(ce(),"utf-8");return JSON.parse(e).token}return r},"getTokenWithAuthFileFallback"),Ls=u((r,e)=>(r=Mi(r),{token:r,baseUrl:e||se.env.APIFY_CLIENT_BASE_URL,requestInterceptors:[t=>{t.headers??=new Oc;for(let[o,s]of Object.entries(Ti))t.headers[o]=s;return t}]}),"getApifyClientOptions");async function Ut(r,e){r=Mi(r);let t=new ki(Ls(r,e)),o;try{o=await t.user("me").get()}catch{return null}return Fs(ce()),yr(ce(),JSON.stringify({token:t.token,...o},null," ")),t}u(Ut,"getLoggedClient");var Ds=u(r=>le(r,V),"getLocalConfigPath"),pe=u(r=>{if(ue(r))return JSON.parse(Mt(r,{encoding:"utf-8"}))},"getJsonFileContent"),Ue=u(r=>pe(Ds(r)),"getLocalConfig"),Ar=u(async(r,e)=>{let t=le(e||se.cwd(),V);await Cc(Pi(t),{recursive:!0}),yr(t,JSON.stringify(r,null," "))},"setLocalConfig"),Vc=[de(),"node_modules",".venv"],br=u(async r=>{let e=me();hr(r,Di()),hr(r,Fi()),hr(r,e);let t=le(r,".gitignore"),o="";ue(t)&&(o=Mt(t,{encoding:"utf-8"}));let s=[];for(let i of Vc)RegExp(`^${Pc(i)}$`,"mg").test(o)||s.push(i);s.length>0&&(o.length>0?(s.unshift("# Added by Apify CLI"),yr(t,`
2
2
  ${s.join(`
3
3
  `)}
4
4
  `,{flag:"a"})):yr(t,`${s.join(`
@@ -105,9 +105,9 @@ Reads input from local key-value store by default.`;static flags={...Et("Actor")
105
105
  `,z.gray("On",Ki.display(f.lastRun.finishedAt)))}return $.join(" ")}return""})();m.pushRow({Name:`${f.title}
106
106
  ${z.gray(`${f.username}/${f.name}`)}`,Runs:Y.isSmallTerminal()&&l>=56?Zr:z.cyan(`${f.stats?.totalRuns??0}`),"Last run started at":p,"Last run":p,"Last run status":f.lastRun?$e(f.lastRun.status):"","Modified at":Vt.display(f.modifiedAt),Builds:f.actor?z.cyan(f.actor.stats.totalBuilds):z.gray("Unknown"),"Last run duration":Y.isSmallTerminal()?Zr:z.cyan(g),"Default build":y,_Small_LastRunText:b})}_({message:m.render(1),stdout:!0})}sortByModifiedAt(e){return e.sort((t,o)=>{let s=new Date(t.modifiedAt);return new Date(o.modifiedAt).getTime()-s.getTime()})}sortByLastRun(e){return e.sort((t,o)=>{let s=new Date(t.stats?.lastRunStartedAt??"1970-01-01T00:00Z");return new Date(o.stats?.lastRunStartedAt??"1970-01-01T00:00Z").getTime()-s.getTime()})}};import{mkdirSync as Wn,readdirSync as zu,writeFileSync as zn}from"fs";import{dirname as Xu,join as Zu}from"path";import Xn from"process";import Qu from"adm-zip";import em from"axios";import Zn from"jju";import{gt as tm}from"semver";import rm from"tiged";var Qn=u(async(r,e)=>{let{data:t}=await em.get(r,{responseType:"arraybuffer"}),o=new Qu(Buffer.from(t,"binary"));o.extractEntryTo(o.getEntries()[0].entryName,e,!1)},"extractGitHubZip"),_t=class extends h{static name="pull";static description="Download Actor code to current directory. Clones Git repositories or fetches Actor files based on the source type.";static flags={version:w.string({char:"v",description:"Actor version number which will be pulled, e.g. 1.2. Default: the highest version",required:!1}),dir:w.string({description:"Directory where the Actor should be pulled to",required:!1})};static args={actorId:A.string({required:!1,description:'Name or ID of the Actor to run (e.g. "apify/hello-world" or "E2jjCZBezvAZnX8Rb"). If not provided, the command will update the Actor in the current directory based on its name in ".actor/actor.json" file.'})};async run(){let e=Xn.cwd(),t=await xe({cwd:e});if(t.isErr()){d({message:t.unwrapErr().message}),Xn.exitCode=5;return}let{config:o}=t.unwrap(),s=await F(),i=await I(),n=!this.args.actorId,a=s.username||s.id,c=this.args?.actorId||o?.id||(o?.name?`${a}/${o.name}`:void 0);if(!c)throw new Error("Cannot find Actor in this directory.");let m;try{m=await i.actor(c).get()}catch{throw new Error(`Cannot find Actor with ID/name '${c}' in your account.`)}if(!m)throw new Error(`Cannot find Actor with ID/name '${c}' in your account.`);let{name:l,versions:f}=m,p=u(()=>{throw new Error("You cannot pull source code of this Actor because you do not have permission to do so.")},"throwMissingSourceCodeAccessError");if(!m.versions.length)throw new Error(`Actor ${c} has no versions.`);let g=null;if(this.flags.version&&(g=f.find(b=>b.versionNumber===this.flags.version),!g))throw new Error(`Cannot find version ${this.flags.version} of Actor ${c}.`);g||(g=f.reduce((b,v)=>tm(`${v.versionNumber}.0`,`${b.versionNumber}.0`)?v:b));let y=n?e:Zu(e,this.flags.dir??l);if(Wn(y,{recursive:!0}),!n&&zu(y).length!==0){d({message:`Directory ${y} is not empty. Please empty it or choose another directory.`});return}switch(g.sourceType){case"TARBALL":{g.tarballUrl||p(),await Qn(g.tarballUrl,y);break}case"SOURCE_FILES":{g.sourceFiles||p();let{sourceFiles:b}=g;for(let v of b){let $=Xu(v.name);if(Wn(`${y}/${$}`,{recursive:!0}),!v.folder){let T=v.format==="BASE64"?Buffer.from(v.content,"base64").toString():v.content;if(v.name===V){let P=Zn.parse(T);P.name=m.name,zn(`${y}/${v.name}`,Zn.update(T,P))}else zn(`${y}/${v.name}`,T)}}break}case"GIT_REPO":{g.gitRepoUrl||p();let{gitRepoUrl:b}=g,[v,$]=b.split("#"),T,P;$&&([T,P]=$.split(":"));let k=v;P&&(k+=`/${P}`),T&&(k+=`#${T}`);let N=rm(k);try{await N.clone(y)}catch(D){throw new Error(`Failed to pull Actor from ${b}. ${D.message}`)}break}case"GITHUB_GIST":{g.gitHubGistUrl||p(),await Qn(`${g.gitHubGistUrl}/archive/master.zip`,y);break}default:throw new Error(`Unknown source type: ${g.sourceType}`)}E({message:n?`Actor ${l} updated at ${y}/`:`Pulled to ${y}/`})}};import{readFileSync as im,statSync as nm,unlinkSync as am}from"fs";import{join as cm,resolve as lm}from"path";import at from"process";import um from"open";import{fetchManifest as mm}from"@apify/actor-templates";import{ACTOR_JOB_STATUSES as ct,ACTOR_SOURCE_TYPES as ri,MAX_MULTIFILE_BYTES as ca}from"@apify/consts";import{createHmacSignature as dm}from"@apify/utilities";import{readFileSync as om,writeFileSync as sm}from"fs";var ti="@",ea=100,ta=5e4,Rt=u(()=>{try{return JSON.parse(om(dr(),"utf-8"))||{}}catch{return{}}},"getSecretsFile"),ra=u(r=>(Fs(dr()),sm(dr(),JSON.stringify(r,null," ")),r),"writeSecretsFile"),oa=u((r,e)=>{let t=Rt();if(t[r])throw new Error(`Secret with name ${r} already exists. Call "apify secrets rm ${r}" to remove it.`);if(typeof r!="string"||r.length>ea)throw new Error(`Secret name has to be string with maximum length ${ea}.`);if(typeof e!="string"||e.length>ta)throw new Error(`Secret value has to be string with maximum length ${ta}.`);return t[r]=e,ra(t)},"addSecret"),sa=u(r=>{let e=Rt();if(!e[r])throw new Error(`Secret with name ${r} doesn't exist.`);delete e[r],ra(e)},"removeSecret"),ia=u(r=>new RegExp(`^${ti}.{1}`).test(r),"isSecretKey"),na=u((r,e)=>{e=e||Rt();let t={};return Object.keys(r).forEach(o=>{if(ia(r[o])){let s=r[o].replace(new RegExp(`^${ti}`),"");e[s]?t[o]=e[s]:R({message:`Value for ${s} not found in local secrets. Set it by calling "apify secrets add ${s} [SECRET_VALUE]"`})}else t[o]=r[o]}),t},"replaceSecretsValue"),aa=u((r,e)=>{e=e||Rt();let t=[];return Object.keys(r).forEach(o=>{if(ia(r[o])){let s=r[o].replace(new RegExp(`^${ti}`),"");e[s]?t.push({name:o,value:e[s],isSecret:!0}):R({message:`Value for ${s} not found in local secrets. Set it by calling "apify secrets add ${s} [SECRET_VALUE]"`})}else t.push({name:o,value:r[o]})}),t},"transformEnvToEnvVars");var oi="temp_file.zip",pm={build:"latest",memoryMbytes:4096,timeoutSecs:3600},la="0.0",fm="latest",xt=class extends h{static name="push";static description=`Deploys Actor to Apify platform using settings from '${V}'.
107
107
  Files under '${ca/1024**2}' MB upload as "Multiple source files"; larger projects upload as ZIP file.
108
- Use --force to override newer remote versions.`;static flags={version:w.string({char:"v",description:`Actor version number to which the files should be pushed. By default, it is taken from the '${V}' file.`,required:!1}),"build-tag":w.string({char:"b",description:`Build tag to be applied to the successful Actor build. By default, it is taken from the '${V}' file`,required:!1}),"wait-for-finish":w.string({char:"w",description:"Seconds for waiting to build to finish, if no value passed, it waits forever.",required:!1}),open:w.boolean({description:"Whether to open the browser automatically to the Actor details page.",default:!1,required:!1}),force:w.boolean({char:"f",description:"Push an Actor even when the local files are older than the Actor on the platform.",default:!1,required:!1}),dir:w.string({description:"Directory where the Actor is located",required:!1})};static args={actorId:A.string({required:!1,description:`Name or ID of the Actor to push (e.g. "apify/hello-world" or "E2jjCZBezvAZnX8Rb"). If not provided, the command will create or modify the Actor with the name specified in '${V}' file.`})};async run(){let e=lm(at.cwd(),this.flags.dir??"."),t=await Bi(e);if(!t.length){d({message:"You need to call this command from a folder that has an Actor in it!"}),at.exitCode=4;return}if(![gr,"actor.json",".actor/actor.json",".actor"].some(M=>t.some(Q=>Q===M||Q.startsWith(M)))){d({message:["A valid Actor could not be found in the current directory. Please make sure you are in the correct directory.","You can also turn this directory into an Actor by running `apify init`."].join(`
108
+ Use --force to override newer remote versions.`;static enableJsonFlag=!0;static flags={version:w.string({char:"v",description:`Actor version number to which the files should be pushed. By default, it is taken from the '${V}' file.`,required:!1}),"build-tag":w.string({char:"b",description:`Build tag to be applied to the successful Actor build. By default, it is taken from the '${V}' file`,required:!1}),"wait-for-finish":w.string({char:"w",description:"Seconds for waiting to build to finish, if no value passed, it waits forever.",required:!1}),open:w.boolean({description:"Whether to open the browser automatically to the Actor details page.",default:!1,required:!1}),force:w.boolean({char:"f",description:"Push an Actor even when the local files are older than the Actor on the platform.",default:!1,required:!1}),dir:w.string({description:"Directory where the Actor is located",required:!1})};static args={actorId:A.string({required:!1,description:`Name or ID of the Actor to push (e.g. "apify/hello-world" or "E2jjCZBezvAZnX8Rb"). If not provided, the command will create or modify the Actor with the name specified in '${V}' file.`})};async run(){let e=lm(at.cwd(),this.flags.dir??"."),t=await Bi(e);if(!t.length){d({message:"You need to call this command from a folder that has an Actor in it!"}),at.exitCode=4;return}if(![gr,"actor.json",".actor/actor.json",".actor"].some(M=>t.some(Q=>Q===M||Q.startsWith(M)))){d({message:["A valid Actor could not be found in the current directory. Please make sure you are in the correct directory.","You can also turn this directory into an Actor by running `apify init`."].join(`
109
109
  `)}),at.exitCode=4;return}let o=await I(),s=await xe({cwd:e});if(s.isErr()){d({message:s.unwrapErr().message}),at.exitCode=5;return}let{config:i}=s.unwrap(),n=await F(),c=!!n.organizationOwnerUserId?`/organization/${n.id}`:"",m,l,f=!1,p=this.flags.version||i?.version||la,g=this.flags.buildTag||i?.buildTag;!g&&p===la&&(g=fm);let y=Number.isNaN(this.flags.waitForFinish)?void 0:Number.parseInt(this.flags.waitForFinish,10)*1e3,b=this.args.actorId;if(b){if(l=await o.actor(b).get(),!l)throw new Error(`Cannot find Actor with ID '${b}' in your account.`);m=l.id}else{let M=n.username||n.id;if(l=await o.actor(`${M}/${i.name}`).get(),l)m=l.id;else{let{templates:Q}=await mm(),Ae=Q.find(ur=>ur.name===i.template)?.defaultRunOptions||pm,mt={name:i.name,title:i.title,description:i.description,defaultRunOptions:Ae,versions:[{versionNumber:p,buildTag:g,sourceType:ri.SOURCE_FILES,sourceFiles:[]}]};i.usesStandbyMode&&(mt.actorStandby={isEnabled:!0}),l=await o.actors().create(mt),m=l.id,f=!0,S({message:`Created Actor with name ${i.name} on Apify.`})}}let v=o.actor(m);S({message:`Deploying Actor '${i.name}' to Apify.`});let $=await _i(t,e),T,P,k;if($<ca){let M=await v.get();if(!f){let Q=t.reduce((Ae,mt)=>{let{mtimeMs:ur,ctimeMs:Ai}=nm(cm(e,mt)),bi=ur>Ai?ur:Ai;return Ae>bi?Ae:bi},0),we=M?.modifiedAt.valueOf();if(!this.flags.force&&we&&Q<we&&(i?.name||b))throw new Error(`Actor with identifier "${i?.name||b}" is already on the platform and was modified there since modified locally.
110
- Skipping push. Use --force to override.`)}P=await ji(t,e),T=ri.SOURCE_FILES}else{be({message:"Zipping Actor files"}),await Vi(oi,t,e);let M=await o.keyValueStores().getOrCreate(`actor-${m}-source`),Q=`version-${p}.zip`,we=im(oi);await o.keyValueStore(M.id).setRecord({key:Q,value:we,contentType:"application/zip"}),am(oi);let Ae=new URL(`${o.baseUrl}/key-value-stores/${M.id}/records/${Q}?disableRedirect=true`);if(M?.urlSigningSecretKey){let mt=dm(M.urlSigningSecretKey,Q);Ae.searchParams.set("signature",mt)}k=Ae.toString(),T=ri.TARBALL}let N=await v.version(p).get(),D=i.environmentVariables?aa(i.environmentVariables):void 0;if(N){let M={tarballUrl:k,sourceFiles:P,buildTag:g,sourceType:T,envVars:D};await v.version(p).update(M),be({message:`Updated version ${p} for Actor ${l.name}.`})}else{let M={versionNumber:p,tarballUrl:k,sourceFiles:P,buildTag:g,sourceType:T,envVars:D};await v.versions().create({...M}),be({message:`Created version ${p} for Actor ${l.name}.`})}be({message:`Building Actor ${l.name}`});let J=await v.build(p,{useCache:!0,waitForFinish:2});try{await Ee({job:J,timeoutMillis:y,apifyClient:o})}catch(M){R({message:"Can not get log:"}),console.error(M)}J=await o.build(J.id).get(),Is({message:"Actor build detail",url:`https://console.apify.com${c}/actors/${J.actId}#/builds/${J.buildNumber}`}),Is({message:"Actor detail",url:`https://console.apify.com${c}/actors/${J.actId}`}),this.flags.open&&await um(`https://console.apify.com${c}/actors/${J.actId}`),J.status===ct.SUCCEEDED?E({message:"Actor was deployed to Apify cloud and built there."}):J.status===ct.READY?R({message:"Build is waiting for allocation."}):J.status===ct.RUNNING?R({message:"Build is still running."}):J.status===ct.ABORTED||J.status===ct.ABORTING?(R({message:"Build was aborted!"}),at.exitCode=3):J.status===ct.TIMED_OUT||J.status===ct.TIMING_OUT?(R({message:"Build timed out!"}),at.exitCode=2):(d({message:"Build failed!"}),at.exitCode=1)}};var oo=class extends h{static name="rm";static description="Permanently removes an Actor from your account.";static args={actorId:A.string({description:"The Actor ID to delete.",required:!0})};async run(){let{actorId:e}=this.args,t=await I();if(!await t.actor(e).get()){d({message:`Actor with ID "${e}" was not found on your account.`});return}if(!await q({message:"Are you sure you want to delete this Actor?"})){S({message:`Deletion of Actor "${e}" was canceled.`});return}try{await t.actor(e).delete(),E({message:`Actor with ID "${e}" was deleted.`})}catch(i){let n=i;d({message:`Failed to delete Actor "${e}".
110
+ Skipping push. Use --force to override.`)}P=await ji(t,e),T=ri.SOURCE_FILES}else{be({message:"Zipping Actor files"}),await Vi(oi,t,e);let M=await o.keyValueStores().getOrCreate(`actor-${m}-source`),Q=`version-${p}.zip`,we=im(oi);await o.keyValueStore(M.id).setRecord({key:Q,value:we,contentType:"application/zip"}),am(oi);let Ae=new URL(`${o.baseUrl}/key-value-stores/${M.id}/records/${Q}?disableRedirect=true`);if(M?.urlSigningSecretKey){let mt=dm(M.urlSigningSecretKey,Q);Ae.searchParams.set("signature",mt)}k=Ae.toString(),T=ri.TARBALL}let N=await v.version(p).get(),D=i.environmentVariables?aa(i.environmentVariables):void 0;if(N){let M={tarballUrl:k,sourceFiles:P,buildTag:g,sourceType:T,envVars:D};await v.version(p).update(M),be({message:`Updated version ${p} for Actor ${l.name}.`})}else{let M={versionNumber:p,tarballUrl:k,sourceFiles:P,buildTag:g,sourceType:T,envVars:D};await v.versions().create({...M}),be({message:`Created version ${p} for Actor ${l.name}.`})}be({message:`Building Actor ${l.name}`});let J=await v.build(p,{useCache:!0,waitForFinish:2});try{await Ee({job:J,timeoutMillis:y,apifyClient:o})}catch(M){R({message:"Can not get log:"}),console.error(M)}if(J=await o.build(J.id).get(),this.flags.json){L(J);return}Is({message:"Actor build detail",url:`https://console.apify.com${c}/actors/${J.actId}#/builds/${J.buildNumber}`}),Is({message:"Actor detail",url:`https://console.apify.com${c}/actors/${J.actId}`}),this.flags.open&&await um(`https://console.apify.com${c}/actors/${J.actId}`),J.status===ct.SUCCEEDED?E({message:"Actor was deployed to Apify cloud and built there."}):J.status===ct.READY?R({message:"Build is waiting for allocation."}):J.status===ct.RUNNING?R({message:"Build is still running."}):J.status===ct.ABORTED||J.status===ct.ABORTING?(R({message:"Build was aborted!"}),at.exitCode=3):J.status===ct.TIMED_OUT||J.status===ct.TIMING_OUT?(R({message:"Build timed out!"}),at.exitCode=2):(d({message:"Build failed!"}),at.exitCode=1)}};var oo=class extends h{static name="rm";static description="Permanently removes an Actor from your account.";static args={actorId:A.string({description:"The Actor ID to delete.",required:!0})};async run(){let{actorId:e}=this.args,t=await I();if(!await t.actor(e).get()){d({message:`Actor with ID "${e}" was not found on your account.`});return}if(!await q({message:"Are you sure you want to delete this Actor?"})){S({message:`Deletion of Actor "${e}" was canceled.`});return}try{await t.actor(e).delete(),E({message:`Actor with ID "${e}" was deleted.`})}catch(i){let n=i;d({message:`Failed to delete Actor "${e}".
111
111
  ${n.message||n}`})}}};import ee from"chalk";var so=class extends h{static name="start";static description=`Starts Actor remotely and returns run details immediately.
112
112
  Uses authenticated account and local key-value store for input.`;static flags={...Et("Actor"),input:w.string({char:"i",description:"Optional JSON input to be given to the Actor.",required:!1,stdin:2,exclusive:["input-file"]}),"input-file":w.string({aliases:["if"],description:"Optional path to a file with JSON input to be given to the Actor. The file must be a valid JSON file. You can also specify `-` to read from standard input.",required:!1,stdin:2,exclusive:["input"]})};static enableJsonFlag=!0;static args={actorId:A.string({required:!1,description:`Name or ID of the Actor to run (e.g. "my-actor", "apify/hello-world" or "E2jjCZBezvAZnX8Rb"). If not provided, the command runs the remote Actor specified in the '${V}' file.`})};async run(){let e=process.cwd(),t=Ue(e)||{},o=await I(),s=await F(),i=s.username||s.id,{id:n,userFriendlyId:a,actorData:c}=await Je.resolveActorId({client:o,localActorName:t.name,usernameOrId:i,providedActorNameOrId:this.args.actorId}),m={};this.flags.build&&(m.build=this.flags.build),this.flags.timeout&&(m.timeout=this.flags.timeout),this.flags.memory&&(m.memory=this.flags.memory);let l=await It(e,this.flags.input,this.flags.inputFile);if(l===!1)return;let f=$t(o,{actorOrTaskData:{id:n,userFriendlyId:a},runOptions:m,type:"Actor",inputOverride:l?.input,silent:!0,waitForRunToFinish:!1,printRunLogs:!1}),p;for await(let k of f)p=k;if(this.flags.json){L(p);return}let g=`https://console.apify.com/actors/${n}/runs/${p.id}`,y=`https://console.apify.com/storage/datasets/${p.defaultDatasetId}`,b=[`${ee.gray("Run:")} Calling Actor ${a} (${ee.gray(n)})`,"",`${ee.yellow("Started")}: ${G.display(p.startedAt)}`];p.containerUrl&&b.push(`${ee.yellow("Container URL")}: ${ee.blue(p.containerUrl)}`);let v=p.buildNumber.split(".").slice(0,2).join("."),$=c.versions.find(k=>k.versionNumber===v),T=Object.entries(c.taggedBuilds??{}).find(([,k])=>k.buildNumber===p.buildNumber)?.[0],P=[`${ee.yellow("Build")}:`,ee.cyan(p.buildNumber)];T?P.push(`(${ee.yellow(T)})`):P.push(`(${ee.gray("N/A")})`),$&&P.push(`| ${ee.gray("Actor version:")} ${ee.cyan($.versionNumber)} (${ee.yellow($.buildTag)})`),b.push(P.join(" ")),b.push(`${ee.yellow("Timeout")}: ${p.options.timeoutSecs.toLocaleString("en-US")} seconds`),b.push(`${ee.yellow("Memory")}: ${p.options.memoryMbytes} MB`),b.push("",`${ee.blue("Export results")}: ${y}`,`${ee.blue("View on Apify Console")}: ${g}`),_({message:b.join(`
113
113
  `),stdout:!0})}};var io=class extends h{static name="actors";static description="Manages Actor creation, deployment, and execution on the Apify platform.";static subcommands=[so,oo,xt,_t,ro,to,Je,zr];async run(){this.printHelp()}};import ym from"chalk";import wm from"computer-name";import Am from"cors";import si from"express";import bm from"open";import{cryptoRandomObjectId as vm}from"@apify/utilities";import gm from"@inquirer/password";var ua=_e(async({message:r,mask:e})=>await gm({message:r,mask:e??"*"}));import hm from"@inquirer/select";var Ke=_e(async({message:r,choices:e,pageSize:t,loop:o,default:s})=>await hm({message:r,choices:e,pageSize:t,loop:o,default:s}));var ni="https://console.apify.com/settings/integrations",Sm=new URL(ni).origin,Tm=ni.includes("localhost")?"http://localhost:3333":void 0,ma="v1",ii=u(async r=>{let e=await Ut(r,Tm),t=await F();return e?(await Er(t.id),E({message:`You are logged in to Apify as ${t.username||t.id}. ${ym.gray(`Your token is stored at ${ce()}.`)}`})):d({message:"Login to Apify failed, the provided API token is not valid."}),e},"tryToLogin"),Ot=class extends h{static name="login";static description=`Authenticates your Apify account and saves credentials to '${je(ce())}'.
@@ -277,4 +277,4 @@ Read more: https://docs.apify.com/cli/docs/telemetry`;static subcommands=[Ts,Ss]
277
277
  4. INPUT_SCHEMA.json
278
278
 
279
279
  Optionally specify custom schema path to validate.`;static args={path:A.string({required:!1,description:"Optional path to your INPUT_SCHEMA.json file. If not provided ./INPUT_SCHEMA.json is used."})};static hiddenAliases=["vis"];async run(){let{inputSchema:e,inputSchemaPath:t}=await lt({forcePath:this.args.path,cwd:Wd.cwd()});if(!e)throw new Error(`Input schema has not been found at ${t}.`);t?S({message:`Validating input schema stored at ${t}`}):S({message:`Validating input schema embedded in '${V}'`});let o=new ft({strict:!1});zd(o,e),E({message:"Input schema is valid."})}};var ZO=[Wr,io,ao,ho,Po,Wo,es,gs,As,vs,lr,yo,sr,or,So,No,Lo,Uo,Mo,zo,Xo,Zo,Qo,is,Cs,ir],QO=[Tt,St,vt,bt,At,wt,yt,ir,sr,or,lr];export{dy as a,py as b,ZO as c,QO as d};
280
- //# sourceMappingURL=chunk-WPWD5ZUF.js.map
280
+ //# sourceMappingURL=chunk-JAT3TWMD.js.map