apify-cli 1.4.2-beta.7 → 1.4.2-beta.8

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-K6JWY7BZ.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-ZOZTH3AG.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-K6JWY7BZ.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-ZOZTH3AG.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 jc=Object.defineProperty;var m=(r,e)=>jc(r,"name",{value:e,configurable:!0});import xe from"process";import{parseArgs as aa}from"util";import co from"chalk";import{satisfies as Yd}from"semver";import fi from"chalk";import Cd from"indent-string";import Id from"widest-line";import Ed from"wrap-ansi";import qi from"ci-info";var Bc=[["CLAUDECODE","claude_code"],["CLAUDE_CODE_ENTRYPOINT","claude_code"],["CURSOR_AGENT","cursor"],["CLINE_ACTIVE","cline"],["CODEX_SANDBOX","codex_cli"],["CODEX_THREAD_ID","codex_cli"],["GEMINI_CLI","gemini_cli"],["OPENCODE","open_code"],["OPENCLAW_SHELL","openclaw"]];function Ki(){for(let[r,e]of Bc)if(process.env[r])return e}m(Ki,"detectAiAgent");function Wi(){return qi.isCI?{isCi:!0,ciProvider:qi.id?.toLowerCase()??"unknown"}:{isCi:!1,ciProvider:void 0}}m(Wi,"detectCi");function zi(){return!!process.stdin.isTTY&&!!process.stdout.isTTY}m(zi,"detectIsInteractive");import Vc from"chalk";function T(r,...e){process.env.APIFY_CLI_DEBUG&&console.error(Vc.gray(`[${r}]`),...e)}m(T,"cliDebugPrint");import{realpathSync as Gc}from"fs";import{dirname as Yc}from"path";import gt from"chalk";function tt(r){r.stdoutOutput&&console.log(...r.stdoutOutput),r.stderrOutput&&console.error(...r.stderrOutput)}m(tt,"internalLog");function $(r){tt({[r.stdout?"stdoutOutput":"stderrOutput"]:[r.message]})}m($,"simpleLog");function g(r){tt({[r.stdout?"stdoutOutput":"stderrOutput"]:[gt.red("Error:"),r.message]})}m(g,"error");function x(r){tt({[r.stdout?"stdoutOutput":"stderrOutput"]:[gt.yellow.bold("Warning:"),r.message]})}m(x,"warning");function R(r){tt({[r.stdout?"stdoutOutput":"stderrOutput"]:[gt.green("Success:"),r.message]})}m(R,"success");function Ce(r){tt({[r.stdout?"stdoutOutput":"stderrOutput"]:[gt.gray("Run:"),r.message]})}m(Ce,"run");function b(r){tt({[r.stdout?"stdoutOutput":"stderrOutput"]:[gt.white("Info:"),r.message]})}m(b,"info");function Hs(r){tt({[r.stdout?"stdoutOutput":"stderrOutput"]:[gt.blue(r.message),r.url]})}m(Hs,"link");var Js="0.0.0";var Hc="1.4.2-beta.7",Jc="ed31fcb995895b1d949e0922a945b103ba17d39c";function qc(){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 x({message:"Failed to detect install method of CLI, assuming npm"}),"npm";let e=Gc(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"}m(qc,"detectInstallMethod");function Kc(){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}}m(Kc,"getRuntimeInfo");var Vt=null;function z(){if(Vt)return Vt;let r=qc(),e=Kc();return Vt={version:Hc,hash:Jc,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===Js}},r==="bundle"&&(Vt.installPath=Yc(process.execPath)),Vt}m(z,"useCLIMetadata");import{existsSync as Ol,mkdirSync as Nl,readFileSync as Ll,writeFileSync as Dl}from"fs";import{dirname as Fl}from"path";import{cryptoRandomObjectId as Ul}from"@apify/utilities";import{homedir as zc}from"os";import{join as rt}from"path";import{KEY_VALUE_STORE_KEYS as Xc,META_ORIGINS as Zc}from"@apify/consts";var Xi={name:"apify-cli",version:"1.4.2-beta.7",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 --exclude ./test/e2e","test:e2e":"vitest run --testNamePattern '\\[e2e\\]' --exclude ./test/api","test:e2e:local":"vitest run --testNamePattern '^(?=.*\\[e2e\\])(?!.*\\[api\\]).*$' --exclude ./test/api","test:api":"vitest run --testNamePattern '^(?=.*\\[api\\])(?!.*\\[e2e\\]).*$' --exclude ./test/e2e","test:python":"vitest run --testNamePattern '\\[python\\]'",lint:"eslint src test scripts --ext .ts,.cjs,.mjs","lint:fix":"eslint src test scripts --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.');"`,prepare:"husky"},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.12","@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.15.0",chalk:"~5.6.0","ci-info":"~4.4.0","cli-table3":"^0.6.5","computer-name":"~0.1.0",configparser:"~0.3.10",cors:"~2.8.5","detect-indent":"~7.0.1","es-toolkit":"^1.45.1","escape-string-regexp":"~5.0.0",execa:"^9.5.2",express:"~5.2.0",handlebars:"~4.7.8",ignore:"^7.0.0","indent-string":"^5.0.0","is-ci":"~4.1.0",istextorbinary:"~9.5.0",jju:"~1.4.0","js-levenshtein":"^1.1.6","json-schema-to-typescript":"^15.0.4",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",tinyglobby:"^0.2.15",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","@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/jju":"^1.4.5","@types/js-levenshtein":"^1","@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",husky:"^9","lint-staged":"^16.0.0","mock-stdin":"^1.0.0",prettier:"^3.5.3",tsup:"^8.5.0",tsx:"^4.16.5",typescript:"^6.0.0","typescript-eslint":"^8.31.0",vitest:"^4.0.0"},volta:{node:"24.14.1",yarn:"4.13.0"},packageManager:"yarn@4.13.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.13"}};var ot="storage",qs="apify_storage",Ks=1,Cr={actorSpecification:Ks,name:null,version:"0.0",buildTag:"latest",environmentVariables:{}},Zi=1440*60*1e3,ht=m(()=>{let r=rt(zc(),".apify");return process.env.__APIFY_INTERNAL_TEST_AUTH_PATH__?rt(r,process.env.__APIFY_INTERNAL_TEST_AUTH_PATH__):r},"GLOBAL_CONFIGS_FOLDER"),ge=m(()=>rt(ht(),"auth.json"),"AUTH_FILE_PATH"),Ir=m(()=>rt(ht(),"secrets.json"),"SECRETS_FILE_PATH"),Er=m(()=>rt(ht(),"state.json"),"STATE_FILE_PATH"),$r=m(()=>rt(ht(),"telemetry.json"),"TELEMETRY_FILE_PATH"),Rr="apify.json",xr=".actor",Qc="actor.json",D=rt(xr,Qc),Ws=new RegExp(`(^${Xc.INPUT}(?:\\.[^.]+)?$)`),Ie=Xi.engines.node,_r={"X-Apify-Request-Origin":Zc.CLI},st="3.9.0",Qi=".venv";import{execSync as al}from"child_process";import{createWriteStream as cl,existsSync as oe,mkdirSync as ll,readdirSync as nn,readFileSync as Kt,writeFileSync as kr}from"fs";import{mkdir as dl,readFile as Or}from"fs/promises";import{get as ml}from"https";import{homedir as zs}from"os";import{dirname as yt,join as q,relative as ul}from"path";import X from"process";import{finished as pl}from"stream/promises";import{DurationFormatter as an,TimeTypes as it}from"@sapphire/duration";import{Timestamp as Xs}from"@sapphire/timestamp";import fl from"adm-zip";import gl from"ajv/dist/2019.js";import{ApifyClient as cn}from"apify-client";import hl from"archiver";import{AxiosHeaders as yl}from"axios";import wl from"escape-string-regexp";import Al from"ignore";import{getEncoding as vl}from"istextorbinary";import{Mime as bl}from"mime";import Sl from"mime/types/other.js";import Tl from"mime/types/standard.js";import{gte as Cl,minVersion as Il,satisfies as El}from"semver";import{glob as Zs}from"tinyglobby";import{ACTOR_ENV_VARS as Qs,ACTOR_JOB_TERMINAL_STATUSES as $l,ACTOR_NAME as Jt,APIFY_ENV_VARS as Rl,KEY_VALUE_STORE_KEYS as sn,LOCAL_ACTOR_ENV_VARS as ei,LOCAL_STORAGE_SUBDIRS as ti,SOURCE_FILE_FORMATS as Ht}from"@apify/consts";import{existsSync as el,mkdirSync as tl}from"fs";import{readFile as rl,stat as en,unlink as ol,writeFile as sl}from"fs/promises";import{join as tn,sep as il}from"path";import{rimraf as nl}from"rimraf";var rn=m(async(r,e={},t=null)=>{let o=await rl(r,"utf-8"),s=JSON.parse(o),i;t?(i=s,i[t]={...s[t],...e}):i={...s,...e},await sl(r,JSON.stringify(i,null," "))},"updateLocalJson"),Pr=m((r,e)=>{e||(e=r,r="."),e.split(il).reduce((o,s)=>(o=tn(o,s),el(o)||tl(o),o),r)},"ensureFolderExistsSync"),Gt=m(async r=>{await nl(r)},"rimrafPromised"),Yt=m(async r=>{(await en(r)).isFile()&&await ol(r)},"deleteFile"),on=m(async(r,e)=>(await Promise.all(r.map(async s=>en(tn(e,s))))).map(s=>s.size).reduce((s,i)=>s+i,0),"sumFilesSizeInBytes");var qt=Al,Wt=gl,Nr=m(async r=>new Promise((e,t)=>{ml(r,o=>{o.statusCode===301||o.statusCode===302?(e(Nr(o.headers.location)),o.destroy()):e(o)}).on("error",t)}),"httpsGet"),we=m(()=>{let r=Rl.LOCAL_STORAGE_DIR;return X.env[r]||X.env.CRAWLEE_STORAGE_DIR||ot},"getLocalStorageDir"),he=m(r=>{let e=Qs.DEFAULT_KEY_VALUE_STORE_ID,t=r||X.env[e]||ei[e];return q(we(),ti.keyValueStores,t)},"getLocalKeyValueStorePath"),ln=m(r=>{let e=Qs.DEFAULT_DATASET_ID,t=r||X.env[e]||ei[e];return q(we(),ti.datasets,t)},"getLocalDatasetPath"),dn=m(r=>{let e=Qs.DEFAULT_REQUEST_QUEUE_ID,t=r||X.env[e]||ei[e];return q(we(),ti.requestQueues,t)},"getLocalRequestQueuePath"),M=m(async()=>{let r={};try{let e=await Or(ge(),"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 Xt();if(!r)throw X.exitCode=1,new Error('You are not logged in with your Apify account. Call "apify login" to fix that.');return r}m(I,"getLoggedClientOrThrow");var mn=m(r=>{if(!r&&oe(ht())&&oe(ge())){let e=Kt(ge(),"utf-8");return JSON.parse(e).token}return r},"getTokenWithAuthFileFallback"),zt=m((r,e)=>(r=mn(r),{token:r,baseUrl:e||X.env.APIFY_CLIENT_BASE_URL,requestInterceptors:[t=>{t.headers??=new yl;for(let[o,s]of Object.entries(_r))t.headers[o]=s;return t}]}),"getApifyClientOptions");async function Xt(r,e){r=mn(r);let t=new cn(zt(r,e)),o;try{o=await t.user("me").get()}catch(s){return T("[getLoggedClient] error getting user info",{error:s,apiBaseUrl:e}),null}return oi(ge()),kr(ge(),JSON.stringify({token:t.token,...o},null," ")),t}m(Xt,"getLoggedClient");var ri=m(r=>q(r,D),"getLocalConfigPath"),de=m(r=>{if(oe(r))return JSON.parse(Kt(r,{encoding:"utf-8"}))},"getJsonFileContent"),Me=m(r=>de(ri(r)),"getLocalConfig"),Lr=m(async(r,e)=>{let t=q(e||X.cwd(),D);await dl(yt(t),{recursive:!0}),kr(t,JSON.stringify(r,null," "))},"setLocalConfig"),xl=[we(),"node_modules",".venv"],Dr=m(async r=>{let e=he();Pr(r,ln()),Pr(r,dn()),Pr(r,e);let t=q(r,".gitignore"),o="";oe(t)&&(o=Kt(t,{encoding:"utf-8"}));let s=[];for(let i of xl)RegExp(`^${wl(i)}$`,"mg").test(o)||s.push(i);s.length>0&&(o.length>0?(s.unshift("# Added by Apify CLI"),kr(t,`
1
+ var jc=Object.defineProperty;var m=(r,e)=>jc(r,"name",{value:e,configurable:!0});import xe from"process";import{parseArgs as aa}from"util";import co from"chalk";import{satisfies as Yd}from"semver";import fi from"chalk";import Cd from"indent-string";import Id from"widest-line";import Ed from"wrap-ansi";import qi from"ci-info";var Bc=[["CLAUDECODE","claude_code"],["CLAUDE_CODE_ENTRYPOINT","claude_code"],["CURSOR_AGENT","cursor"],["CLINE_ACTIVE","cline"],["CODEX_SANDBOX","codex_cli"],["CODEX_THREAD_ID","codex_cli"],["GEMINI_CLI","gemini_cli"],["OPENCODE","open_code"],["OPENCLAW_SHELL","openclaw"]];function Ki(){for(let[r,e]of Bc)if(process.env[r])return e}m(Ki,"detectAiAgent");function Wi(){return qi.isCI?{isCi:!0,ciProvider:qi.id?.toLowerCase()??"unknown"}:{isCi:!1,ciProvider:void 0}}m(Wi,"detectCi");function zi(){return!!process.stdin.isTTY&&!!process.stdout.isTTY}m(zi,"detectIsInteractive");import Vc from"chalk";function T(r,...e){process.env.APIFY_CLI_DEBUG&&console.error(Vc.gray(`[${r}]`),...e)}m(T,"cliDebugPrint");import{realpathSync as Gc}from"fs";import{dirname as Yc}from"path";import gt from"chalk";function tt(r){r.stdoutOutput&&console.log(...r.stdoutOutput),r.stderrOutput&&console.error(...r.stderrOutput)}m(tt,"internalLog");function $(r){tt({[r.stdout?"stdoutOutput":"stderrOutput"]:[r.message]})}m($,"simpleLog");function g(r){tt({[r.stdout?"stdoutOutput":"stderrOutput"]:[gt.red("Error:"),r.message]})}m(g,"error");function x(r){tt({[r.stdout?"stdoutOutput":"stderrOutput"]:[gt.yellow.bold("Warning:"),r.message]})}m(x,"warning");function R(r){tt({[r.stdout?"stdoutOutput":"stderrOutput"]:[gt.green("Success:"),r.message]})}m(R,"success");function Ce(r){tt({[r.stdout?"stdoutOutput":"stderrOutput"]:[gt.gray("Run:"),r.message]})}m(Ce,"run");function b(r){tt({[r.stdout?"stdoutOutput":"stderrOutput"]:[gt.white("Info:"),r.message]})}m(b,"info");function Hs(r){tt({[r.stdout?"stdoutOutput":"stderrOutput"]:[gt.blue(r.message),r.url]})}m(Hs,"link");var Js="0.0.0";var Hc="1.4.2-beta.8",Jc="3111d162800aa39f24b0d1f5b4bc30543738b50c";function qc(){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 x({message:"Failed to detect install method of CLI, assuming npm"}),"npm";let e=Gc(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"}m(qc,"detectInstallMethod");function Kc(){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}}m(Kc,"getRuntimeInfo");var Vt=null;function z(){if(Vt)return Vt;let r=qc(),e=Kc();return Vt={version:Hc,hash:Jc,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===Js}},r==="bundle"&&(Vt.installPath=Yc(process.execPath)),Vt}m(z,"useCLIMetadata");import{existsSync as Ol,mkdirSync as Nl,readFileSync as Ll,writeFileSync as Dl}from"fs";import{dirname as Fl}from"path";import{cryptoRandomObjectId as Ul}from"@apify/utilities";import{homedir as zc}from"os";import{join as rt}from"path";import{KEY_VALUE_STORE_KEYS as Xc,META_ORIGINS as Zc}from"@apify/consts";var Xi={name:"apify-cli",version:"1.4.2-beta.8",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 --exclude ./test/e2e","test:e2e":"vitest run --testNamePattern '\\[e2e\\]' --exclude ./test/api","test:e2e:local":"vitest run --testNamePattern '^(?=.*\\[e2e\\])(?!.*\\[api\\]).*$' --exclude ./test/api","test:api":"vitest run --testNamePattern '^(?=.*\\[api\\])(?!.*\\[e2e\\]).*$' --exclude ./test/e2e","test:python":"vitest run --testNamePattern '\\[python\\]'",lint:"eslint src test scripts --ext .ts,.cjs,.mjs","lint:fix":"eslint src test scripts --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.');"`,prepare:"husky"},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.12","@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.15.0",chalk:"~5.6.0","ci-info":"~4.4.0","cli-table3":"^0.6.5","computer-name":"~0.1.0",configparser:"~0.3.10",cors:"~2.8.5","detect-indent":"~7.0.1","es-toolkit":"^1.45.1","escape-string-regexp":"~5.0.0",execa:"^9.5.2",express:"~5.2.0",handlebars:"~4.7.8",ignore:"^7.0.0","indent-string":"^5.0.0","is-ci":"~4.1.0",istextorbinary:"~9.5.0",jju:"~1.4.0","js-levenshtein":"^1.1.6","json-schema-to-typescript":"^15.0.4",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",tinyglobby:"^0.2.15",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","@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/jju":"^1.4.5","@types/js-levenshtein":"^1","@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",husky:"^9","lint-staged":"^16.0.0","mock-stdin":"^1.0.0",prettier:"^3.5.3",tsup:"^8.5.0",tsx:"^4.16.5",typescript:"^6.0.0","typescript-eslint":"^8.31.0",vitest:"^4.0.0"},volta:{node:"24.14.1",yarn:"4.13.0"},packageManager:"yarn@4.13.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.13"}};var ot="storage",qs="apify_storage",Ks=1,Cr={actorSpecification:Ks,name:null,version:"0.0",buildTag:"latest",environmentVariables:{}},Zi=1440*60*1e3,ht=m(()=>{let r=rt(zc(),".apify");return process.env.__APIFY_INTERNAL_TEST_AUTH_PATH__?rt(r,process.env.__APIFY_INTERNAL_TEST_AUTH_PATH__):r},"GLOBAL_CONFIGS_FOLDER"),ge=m(()=>rt(ht(),"auth.json"),"AUTH_FILE_PATH"),Ir=m(()=>rt(ht(),"secrets.json"),"SECRETS_FILE_PATH"),Er=m(()=>rt(ht(),"state.json"),"STATE_FILE_PATH"),$r=m(()=>rt(ht(),"telemetry.json"),"TELEMETRY_FILE_PATH"),Rr="apify.json",xr=".actor",Qc="actor.json",D=rt(xr,Qc),Ws=new RegExp(`(^${Xc.INPUT}(?:\\.[^.]+)?$)`),Ie=Xi.engines.node,_r={"X-Apify-Request-Origin":Zc.CLI},st="3.9.0",Qi=".venv";import{execSync as al}from"child_process";import{createWriteStream as cl,existsSync as oe,mkdirSync as ll,readdirSync as nn,readFileSync as Kt,writeFileSync as kr}from"fs";import{mkdir as dl,readFile as Or}from"fs/promises";import{get as ml}from"https";import{homedir as zs}from"os";import{dirname as yt,join as q,relative as ul}from"path";import X from"process";import{finished as pl}from"stream/promises";import{DurationFormatter as an,TimeTypes as it}from"@sapphire/duration";import{Timestamp as Xs}from"@sapphire/timestamp";import fl from"adm-zip";import gl from"ajv/dist/2019.js";import{ApifyClient as cn}from"apify-client";import hl from"archiver";import{AxiosHeaders as yl}from"axios";import wl from"escape-string-regexp";import Al from"ignore";import{getEncoding as vl}from"istextorbinary";import{Mime as bl}from"mime";import Sl from"mime/types/other.js";import Tl from"mime/types/standard.js";import{gte as Cl,minVersion as Il,satisfies as El}from"semver";import{glob as Zs}from"tinyglobby";import{ACTOR_ENV_VARS as Qs,ACTOR_JOB_TERMINAL_STATUSES as $l,ACTOR_NAME as Jt,APIFY_ENV_VARS as Rl,KEY_VALUE_STORE_KEYS as sn,LOCAL_ACTOR_ENV_VARS as ei,LOCAL_STORAGE_SUBDIRS as ti,SOURCE_FILE_FORMATS as Ht}from"@apify/consts";import{existsSync as el,mkdirSync as tl}from"fs";import{readFile as rl,stat as en,unlink as ol,writeFile as sl}from"fs/promises";import{join as tn,sep as il}from"path";import{rimraf as nl}from"rimraf";var rn=m(async(r,e={},t=null)=>{let o=await rl(r,"utf-8"),s=JSON.parse(o),i;t?(i=s,i[t]={...s[t],...e}):i={...s,...e},await sl(r,JSON.stringify(i,null," "))},"updateLocalJson"),Pr=m((r,e)=>{e||(e=r,r="."),e.split(il).reduce((o,s)=>(o=tn(o,s),el(o)||tl(o),o),r)},"ensureFolderExistsSync"),Gt=m(async r=>{await nl(r)},"rimrafPromised"),Yt=m(async r=>{(await en(r)).isFile()&&await ol(r)},"deleteFile"),on=m(async(r,e)=>(await Promise.all(r.map(async s=>en(tn(e,s))))).map(s=>s.size).reduce((s,i)=>s+i,0),"sumFilesSizeInBytes");var qt=Al,Wt=gl,Nr=m(async r=>new Promise((e,t)=>{ml(r,o=>{o.statusCode===301||o.statusCode===302?(e(Nr(o.headers.location)),o.destroy()):e(o)}).on("error",t)}),"httpsGet"),we=m(()=>{let r=Rl.LOCAL_STORAGE_DIR;return X.env[r]||X.env.CRAWLEE_STORAGE_DIR||ot},"getLocalStorageDir"),he=m(r=>{let e=Qs.DEFAULT_KEY_VALUE_STORE_ID,t=r||X.env[e]||ei[e];return q(we(),ti.keyValueStores,t)},"getLocalKeyValueStorePath"),ln=m(r=>{let e=Qs.DEFAULT_DATASET_ID,t=r||X.env[e]||ei[e];return q(we(),ti.datasets,t)},"getLocalDatasetPath"),dn=m(r=>{let e=Qs.DEFAULT_REQUEST_QUEUE_ID,t=r||X.env[e]||ei[e];return q(we(),ti.requestQueues,t)},"getLocalRequestQueuePath"),M=m(async()=>{let r={};try{let e=await Or(ge(),"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 Xt();if(!r)throw X.exitCode=1,new Error('You are not logged in with your Apify account. Call "apify login" to fix that.');return r}m(I,"getLoggedClientOrThrow");var mn=m(r=>{if(!r&&oe(ht())&&oe(ge())){let e=Kt(ge(),"utf-8");return JSON.parse(e).token}return r},"getTokenWithAuthFileFallback"),zt=m((r,e)=>(r=mn(r),{token:r,baseUrl:e||X.env.APIFY_CLIENT_BASE_URL,requestInterceptors:[t=>{t.headers??=new yl;for(let[o,s]of Object.entries(_r))t.headers[o]=s;return t}]}),"getApifyClientOptions");async function Xt(r,e){r=mn(r);let t=new cn(zt(r,e)),o;try{o=await t.user("me").get()}catch(s){return T("[getLoggedClient] error getting user info",{error:s,apiBaseUrl:e}),null}return oi(ge()),kr(ge(),JSON.stringify({token:t.token,...o},null," ")),t}m(Xt,"getLoggedClient");var ri=m(r=>q(r,D),"getLocalConfigPath"),de=m(r=>{if(oe(r))return JSON.parse(Kt(r,{encoding:"utf-8"}))},"getJsonFileContent"),Me=m(r=>de(ri(r)),"getLocalConfig"),Lr=m(async(r,e)=>{let t=q(e||X.cwd(),D);await dl(yt(t),{recursive:!0}),kr(t,JSON.stringify(r,null," "))},"setLocalConfig"),xl=[we(),"node_modules",".venv"],Dr=m(async r=>{let e=he();Pr(r,ln()),Pr(r,dn()),Pr(r,e);let t=q(r,".gitignore"),o="";oe(t)&&(o=Kt(t,{encoding:"utf-8"}));let s=[];for(let i of xl)RegExp(`^${wl(i)}$`,"mg").test(o)||s.push(i);s.length>0&&(o.length>0?(s.unshift("# Added by Apify CLI"),kr(t,`
2
2
  ${s.join(`
3
3
  `)}
4
4
  `,{flag:"a"})):kr(t,`${s.join(`
@@ -66,7 +66,7 @@ ${e.ambiguousMessage.split(`
66
66
  `)}`):t.push(`To solve this, provide the flag like this: --${e.name}=<value>`)):e.expectsValue?t.push("expects a value"):t.push("does not take an argument"),t.map(o=>K.gray(o)).join(" ")}static into(e,t){if(e instanceof r)return e;if(e instanceof Error&&"code"in e){let o=e;switch(o.code){case"ERR_PARSE_ARGS_INVALID_OPTION_VALUE":return new r({code:0,message:o.message,command:t});case"ERR_PARSE_ARGS_UNEXPECTED_POSITIONAL":return new r({code:1,message:o.message,command:t});case"ERR_PARSE_ARGS_UNKNOWN_OPTION":return new r({code:2,message:o.message,command:t});default:return new r({code:9,message:`Unknown error: ${e instanceof Error?e.message:String(e)}`,command:t})}}return new r({code:9,message:`Unknown error: ${e instanceof Error?e.message:String(e)}`,command:t})}};function ta(r){return r.replace(/[-_\s](.)/g,(e,t)=>t.toUpperCase())}m(ta,"camelCaseString");function Ee(r){return r.replace(/[\s_]+/g,"-")}m(Ee,"kebabCaseString");function $e(r){return r.replace(/([A-Z])/g,"-$1").toLowerCase()}m($e,"camelCaseToKebabCase");var $d={type:"boolean",multiple:!1,short:"h"},Rd={type:"boolean",multiple:!1},W=new Map,xd=["init","run","push","actors push","pull","actors pull","call","actors call","actors start"],h=class{static args;static flags;static subcommands;static enableJsonFlag=!1;static name;static shortDescription;static description;static examples;static docsUrl;static interactive;static interactiveNote;static group;static aliases;static hidden;static hiddenAliases;telemetryData={};flags;args;entrypoint;commandString;aliasUsed;subcommandAliasUsed;skipTelemetry=!1;constructor(e,t,o,s){this.entrypoint=e,this.commandString=t,this.aliasUsed=o,this.subcommandAliasUsed=s;let i=z();this.telemetryData.installMethod=i.installMethod,this.telemetryData.osArch=i.arch,this.telemetryData.runtime=i.runtime.runtime,this.telemetryData.runtimeVersion=i.runtime.version,this.telemetryData.runtimeNodeVersion=i.runtime.nodeVersion??i.runtime.version,this.telemetryData.commandString=t,this.telemetryData.entrypoint=e;let n=Wi();this.telemetryData.aiAgent=Ki(),this.telemetryData.isCi=n.isCi,this.telemetryData.ciProvider=n.ciProvider,this.telemetryData.isInteractive=zi()}get ctor(){return this.constructor}pluralString(e,t,o){return e===1?t:o}static printHelp(){console.log(ro(this)),process.exit(0)}printHelp(){return this.ctor.printHelp()}async _run(e){let t=Date.now(),{values:o,positionals:s,tokens:i}=e;o.help&&this.ctor.printHelp(),this.args={},this.flags={},this.ctor.enableJsonFlag&&(typeof o.json=="boolean"?this.flags.json=o.json:this.flags.json=!1);let n=new Map;if(this.ctor.args){let a=0;for(let[c,l]of Object.entries(this.ctor.args)){if(typeof l=="string")throw new RangeError("Do not provide the string for the json arg! It is a type level assertion!");let d=ta(c),u=s[a++];if(u)switch(l.argTag){default:this.args[d]=String(u),u==="-"&&l.stdin&&(this.args[d]=this._handleStdin(l.stdin)),l.catchAll&&(this.args[d]=s.slice(a-1).join(" "));break}else l.required&&n.set(c,l)}}if(n.size){process.exitCode=1,this._printMissingRequiredArgs(n);return}this._parseFlags(o,i);try{await this.run()}catch(a){g({message:a.message}),process.exitCode||=1}finally{!this.telemetryData.actorLanguage&&xd.includes(this.commandString)&&(await Ne()).inspect(c=>{c.type===0?(this.telemetryData.actorLanguage="javascript",this.telemetryData.actorRuntime=c.runtime.runtimeShorthand||"node",this.telemetryData.actorRuntimeVersion=c.runtime.version):(c.type===1||c.type===2)&&(this.telemetryData.actorLanguage="python",this.telemetryData.actorRuntime="python",this.telemetryData.actorRuntimeVersion=c.runtime.version)}),this.skipTelemetry||(this.telemetryData.flagsUsed=Object.keys(this.flags),this.telemetryData.exitCode=typeof process.exitCode=="number"?process.exitCode:0,this.telemetryData.durationMs=Date.now()-t,this.telemetryData.wasRetried=await Cn(this.commandString),await $n(`cli_command_${this.commandString.replaceAll(" ","_").toLowerCase()}`,this.telemetryData))}}_userFlagNameToRegisteredName(e,t){let o=Ee($e(e)).toLowerCase(),s=o;o.startsWith("no-")&&(s=o.slice(3));let i=new Set;for(let n of t.aliases??[])i.add(Ee($e(n)).toLowerCase());return{baseFlagName:s,rawBaseFlagName:o,allMatchers:[s,...i]}}_commandFlagKeyToKebabCaseRegisteredName(e){let t=Ee($e(e)).toLowerCase();return t.startsWith("no-")&&(t=t.slice(3)),t}_parseFlags(e,t){if(!this.ctor.flags)return;let o=new Map,s;for(let[n,a]of Object.entries(this.ctor.flags)){if(typeof a=="string")throw new RangeError("Do not provide the string for the json arg! It is a type level assertion!");let{allMatchers:c,baseFlagName:l,rawBaseFlagName:d}=this._userFlagNameToRegisteredName(n,a),u=ta(d),p=t.some(v=>v.kind==="option"&&v.name===l);if(a.exclusive?.length){let v=o.get(l)??new Set;for(let S of a.exclusive)v.add(this._commandFlagKeyToKebabCaseRegisteredName(S));o.set(l,v);for(let S of a.exclusive){let E=this._commandFlagKeyToKebabCaseRegisteredName(S),C=o.get(E)??new Set;C.add(l),o.set(E,C)}}let f=c.filter(v=>e[v]);if(f.length>1)throw new pe({code:3,command:this.ctor,metadata:{flag:l}});let y=e[f[0]];if(!y&&a.required)throw new pe({code:6,command:this.ctor,metadata:{flag:l,matcher:f[0]}});if(Array.isArray(y)){if(y.length>1)throw new pe({code:3,command:this.ctor,metadata:{flag:l}});y=y[0]}if(p&&typeof y=="string"&&y.startsWith("=")&&(y=y.slice(1)),typeof y<"u")switch(a.flagTag){case"boolean":{this.flags[u]=d.startsWith("no-")?!y:y;break}case"integer":{let v=Number(y);if(Number.isNaN(v)||!Number.isInteger(v))throw new pe({code:4,command:this.ctor,metadata:{flag:l,value:String(y)}});this.flags[u]=v;break}default:{if(this.flags[u]=y,y==="-"&&a.stdin){if(s)throw new pe({code:8,command:this.ctor,metadata:{firstUse:s,secondUse:l}});s=l,this.flags[u]=this._handleStdin(a.stdin)}break}}else typeof a.hasDefault<"u"&&(this.flags[u]=a.hasDefault);if(this.flags[u]&&a.choices&&!a.choices.includes(this.flags[u]))throw new pe({code:5,command:this.ctor,metadata:{flag:l,choices:a.choices.map(v=>fi.white.bold(v)).join(", ")}});if(this.flags[u]==null&&(a.required||y!=null))throw new pe({code:6,command:this.ctor,metadata:{flag:l,matcher:f[0],providedButReceivedNoValue:!!y}})}let i=[];for(let[n,a]of o)if(e[n]!=null)for(let c of a){if(e[c]==null)continue;let l=e[n][0],d=e[c][0],u=m((p,f)=>typeof f=="boolean"?f?`--${p}`:`--no-${p}`:`--${p}=${f}`,"flagRepresentation");i.push([u(n,l),u(c,d)]);break}if(i.length)throw new pe({code:7,command:this.ctor,metadata:{flagPairs:i}})}_printMissingRequiredArgs(e){let t;try{t=oo(this.ctor,{showUsageString:!0})}catch{}let o=Id([...e.keys()].join(`
67
67
  `)),s=[];for(let[n,a]of e){let c=`${n.padEnd(o)} ${a.description}`,l=Ed(c,se()-o-2),d=Cd(l,o+2+2).trim();s.push(` ${fi.red(">")} ${d}`)}let i=[`Missing ${e.size} required ${this.pluralString(e.size,"argument","arguments")}:`,...s,fi.gray(" See more help with --help")];t&&i.push("",t),g({message:i.join(`
68
68
  `)})}_handleStdin(e){return e===2?(Re?.toString("utf8")??"").trim():Re}_buildParseArgsOption(){let e={allowNegative:!0,allowPositionals:!0,strict:!0,tokens:!0,options:{help:$d}};if(this.ctor.flags)for(let[t,o]of Object.entries(this.ctor.flags)){if(typeof o=="string")throw new RangeError("Do not provide the string for the json flag! It is a type level assertion!");if(t.toLowerCase()==="json")continue;let s=Ee($e(t)).toLowerCase();s.startsWith("no-")&&(s=s.slice(3));let i=o.builder(s);for(let{flagName:n,option:a}of i)e.options[n]=a}return this.ctor.enableJsonFlag&&(e.options.json=Rd),e}static registerCommand(e){if(pi(e,this),W.set(this.name,this),this.aliases?.length)for(let t of this.aliases)W.set(t,this);if(this.hiddenAliases?.length)for(let t of this.hiddenAliases)W.set(t,this);if(this.subcommands?.length)for(let t of this.subcommands){if(W.set(`${this.name} ${t.name}`,t),this.aliases?.length)for(let o of this.aliases)W.set(`${o} ${t.name}`,t);if(this.hiddenAliases?.length)for(let o of this.hiddenAliases)W.set(`${o} ${t.name}`,t);if(t.aliases?.length)for(let o of t.aliases){if(W.set(`${this.name} ${o}`,t),this.aliases?.length)for(let s of this.aliases)W.set(`${s} ${o}`,t);if(this.hiddenAliases?.length)for(let s of this.hiddenAliases)W.set(`${s} ${o}`,t)}if(t.hiddenAliases?.length)for(let o of t.hiddenAliases){if(W.set(`${this.name} ${o}`,t),this.aliases?.length)for(let s of this.aliases)W.set(`${s} ${o}`,t);if(this.hiddenAliases?.length)for(let s of this.hiddenAliases)W.set(`${s} ${o}`,t)}}}};async function ra(r,e,t){let o={positionals:[],values:{},tokens:[]},s=0;for(let[n,a]of Object.entries(t)){let[c,l]=n.split("_");if(c==="args")o.positionals[s++]=a;else{let d=Ee($e(l)).toLowerCase();d.startsWith("no-")?o.values[d.slice(3)]=!a:o.values[d]=a}}let i=new e(r,e.name,e.name);i.skipTelemetry=!0,await i._run(o)}m(ra,"internalRunCommand");import{once as _d}from"events";async function oa(){let r=await Yr(),{hasData:e,waitDelay:t,stream:o}=r;if(!e)return;let s=[],i=new AbortController,n=null;t&&(n=setTimeout(()=>{i.abort()},t).unref()),o.on("data",c=>{s.push(c),n&&(clearTimeout(n),n=null)});try{await _d(o,"end",{signal:i.signal})}catch(c){if(c.name==="AbortError")return}n&&clearTimeout(n),r.hasData=!1;let a=Buffer.concat(s);if(a.length)return a}m(oa,"readStdin");import{gt as Ud}from"semver";import{existsSync as Pd,mkdirSync as kd,readFileSync as Od,writeFileSync as Nd}from"fs";import{dirname as Ld}from"path";function Dd(r){if(r.version&&r.version>=1)return!1;let e=r;if(e.latestNpmVersionCheckedAt){let t=new Date(e.latestNpmVersionCheckedAt).getTime(),o=e.latestNpmVersion;T("LocalStateV0ToV1","Migrating state from v0 to v1",{oldState:r,newState:{versionCheck:{lastChecked:t,lastVersion:o}}}),hi({version:1},s=>{s.versionCheck={lastChecked:t,lastVersion:o}})}return!0}m(Dd,"migrateStateV0ToV1");var Fd={version:1};function gi(){let r=Er();if(!Pd(r))return Fd;let t=JSON.parse(Od(r,"utf-8"));return Dd(t)?gi():t}m(gi,"useLocalState");function hi(r,e){let t={...r};e(t);let o=Er(),s=Ld(o);kd(s,{recursive:!0}),Nd(Er(),JSON.stringify(t,null," "))}m(hi,"updateLocalState");var no=z(),sa=`Apify CLI/${no.version} (https://github.com/apify/apify-cli)`,Md=["https://1.1.1.1","https://8.8.8.8"];async function jd(r=500){let e=new AbortController,t=setTimeout(()=>{e.abort()},r),o=await Promise.any(Md.map(async s=>fetch(s,{signal:e.signal,headers:{"User-Agent":sa},keepalive:!1}))).catch(()=>null);return clearTimeout(t),o?o.ok?(T("isOnline",{state:"online",site:o.url}),!0):(T("isOnline",{state:"offline"}),!1):(T("isOnline",{state:"timeout"}),!1)}m(jd,"isOnline");async function Bd(r){let e=await fetch("https://api.github.com/repos/apify/apify-cli/releases/latest",{headers:{"User-Agent":sa}});if(!e.ok)return T("useCLIVersionCheck","Failed to fetch latest version",{statusCode:e.status,body:await e.text()}),x({message:"Failed to fetch latest version of Apify CLI, using the cached version instead."}),null;let o=(await e.json()).tag_name.replace(/^v/,"");return T("useCLIVersionCheck","Fetched latest version",{version:o}),hi(r,s=>{s.versionCheck={lastChecked:Date.now(),lastVersion:o}}),o}m(Bd,"getLatestVersion");function ia(){return!!(process.env.APIFY_CLI_SKIP_UPDATE_CHECK&&!["0","false"].includes(process.env.APIFY_CLI_SKIP_UPDATE_CHECK))}m(ia,"shouldSkipVersionCheck");async function na(r=!1){let e=gi(),t=!e.versionCheck||Date.now()-e.versionCheck.lastChecked>Zi,o=r||t&&await jd(),s=o?await Bd(e):e.versionCheck?.lastVersion;if(!s)return{currentVersion:no.version,latestVersion:"unknown",shouldUpdate:!1,cacheHit:!1};let i=Ud(s,no.version);return{currentVersion:no.version,latestVersion:s,shouldUpdate:i,cacheHit:!o}}m(na,"useCLIVersionCheck");import{jaroWinkler as Vd}from"@skyra/jaro-winkler";import Gd from"js-levenshtein";function ao(r){let e=[...W.entries()].sort(([s],[i])=>s.localeCompare(i)),t=r.toLowerCase();return e.map(([s,i])=>{let n=s.toLowerCase(),a=s.split(" "),c=a[a.length-1].toLowerCase(),l=i.aliases?.includes(c)||i.hiddenAliases?.includes(c)||!1,d=Gd(t,n),u=Vd(t,n),p=d<=2||u>=.975;return p?(T("useCommandSuggestions",{inputString:t,lowercased:n,matches:p,levenshtein:d,jaroWinkler:u}),l?{string:`${n} (alias for ${i.name})`,distance:u}:{string:`${n}`,distance:u}):null}).filter(s=>s!==null).sort((s,i)=>i.distance-s.distance).map(s=>s.string)}m(ao,"useCommandSuggestions");var Re=await oa(),cr=z(),nt=`Apify CLI/${cr.version} (https://github.com/apify/apify-cli)`;function vw(r){cr.installMethod!=="bundle"&&(Yd(xe.version,Ie)||(g({message:`${r} CLI requires Node.js version ${Ie}. Your current version is ${xe.version}.`}),xe.exit(1)))}m(vw,"processVersionCheck");function Hd(r){r.values.version===!0&&r.positionals.length===0&&(console.log(cr.fullVersionString),xe.exit(0))}m(Hd,"printCLIVersionAndExitIfFlagUsed");function Jd(r,e){(r.values.help===!0&&r.positionals.length===0||r.positionals.length===0)&&(console.log(so(e)),xe.exit(0))}m(Jd,"printHelpAndExitIfFlagUsedOrNoCommandPassed");function ca(r){let e=ao(String(r)),t=co.gray(`Command ${co.whiteBright(r)} not found`);e.length&&(t+=`
69
- `,t+=co.gray(`Did you mean: ${e.map(o=>co.whiteBright(o)).join(", ")}?`)),g({message:t}),xe.exit(1)}m(ca,"handleCommandNotFound");async function qd(r,e){let t=W.get("upgrade");if([t.name,...t.aliases??[]].some(s=>e===s)){T("[VersionCheckMiddleware]","upgrade command detected, skipping version check");return}if(ia()){T("[VersionCheckMiddleware]","skipping version check because APIFY_CLI_SKIP_UPDATE_CHECK is set");return}await ra(r,t,{flags_internalAutomaticCall:!0})}m(qd,"runVersionCheck");async function bw(r){T("CLIMetadata",{...cr,fullVersionString:cr.fullVersionString,argv:xe.argv,cwd:xe.cwd(),execPath:xe.execPath});let e=xe.argv.slice(2);T("ProcessArgv",e);let t=aa({allowPositionals:!0,strict:!1,options:{help:{type:"boolean",short:"h"},version:{type:"boolean",short:"v"}},args:e});Hd(t),Jd(t,r),await qd(r,t.positionals[0]),T("TopLevelOptions",t);let o=t.positionals[0],s=-1;if(W.get(o)?.subcommands?.length){if(t.positionals[1]?.toLowerCase()==="help")s=1;else if(t.positionals[2]?.toLowerCase()==="help"){let y=W.get(`${o} ${t.positionals[1]}`);y&&!y.args&&(s=2)}}if(s!==-1){let y=t.positionals[s],v=e.indexOf(y);v!==-1&&e.splice(v,1),!e.includes("--help")&&!e.includes("-h")&&e.push("--help"),t.positionals.splice(s,1),t.values.help=!0}let n=t.positionals[1],a=!1,c=W.get(o);if(!c)return ca(o);let l=c;if(c.subcommands?.length){if(!n)return c.printHelp();a=!0,l=W.get(`${o} ${n}`)}if(!l)return ca(`${o} ${n}`);let d=[...e],u=d.indexOf(o);if(T("CommandNameIndex",u),d.splice(u,1),a){let y=d.indexOf(n);T("SubcommandNameIndex",y),d.splice(y,1)}T("RebuiltArgs",d),T("CommandToRun",l);let p=new l(r,a?`${c.name} ${n}`:c.name,o,a?n:void 0),f=p._buildParseArgsOption();T("ParserOptionsForCommand",f);try{let y=aa({...f,args:d});await p._run(y),T("CommandArgsResult",y)}catch(y){let v=pe.into(y,l);g({message:v.getPrettyMessage()}),xe.exit(1)}}m(bw,"runCLI");import{join as um,resolve as pm}from"path";import wi from"process";import{calculateRunDynamicMemory as fm}from"@apify/actor-memory-expression";var w={string:Kd,boolean:Wd,integer:zd},ie={yes:w.boolean({char:"y",description:'Automatic yes to prompts; assume "yes" as answer to all prompts.',default:!1})};function Kd(r){return{flagTag:"string",builder:m(e=>{let t=new Set([...r.aliases??[]]);t.delete(e);let o=[{flagName:e,option:{type:"string",multiple:!0}}];r.char&&(o[0].option.short=r.char);for(let s of t)o.push({flagName:Ee($e(s)).toLowerCase(),option:{type:"string",multiple:!0}});return o},"builder"),choices:r.choices,required:r.required??!1,hasDefault:r.default,stdin:r.stdin??2,description:r.description,aliases:r.aliases,char:r.char,hidden:r.hidden,exclusive:r.exclusive}}m(Kd,"stringFlag");function Wd(r){return{flagTag:"boolean",builder:m(e=>{let t=new Set([...r.aliases??[]]);t.delete(e);let o=[{flagName:e,option:{type:"boolean",multiple:!0}}];r.char&&(o[0].option.short=r.char);for(let s of t)o.push({flagName:Ee($e(s)).toLowerCase(),option:{type:"boolean",multiple:!0}});return o},"builder"),choices:null,required:r.required??!1,hasDefault:r.default,stdin:r.stdin??1,description:r.description,aliases:r.aliases,char:r.char,hidden:r.hidden,exclusive:r.exclusive}}m(Wd,"booleanFlag");function zd(r){return{flagTag:"integer",builder:m(e=>{let t=new Set([...r.aliases??[]]);t.delete(e);let o=[{flagName:e,option:{type:"string",multiple:!0}}];r.char&&(o[0].option.short=r.char);for(let s of t)o.push({flagName:Ee($e(s)).toLowerCase(),option:{type:"string",multiple:!0}});return o},"builder"),choices:null,required:r.required??!1,hasDefault:r.default,stdin:r.stdin??1,description:r.description,aliases:r.aliases,char:r.char,hidden:r.hidden,exclusive:r.exclusive}}m(zd,"integerFlag");import{mkdir as rm,rename as pa,writeFile as om}from"fs/promises";import{dirname as sm,join as im}from"path";import ua from"process";import{inspect as nm}from"util";import{err as dr,ok as mo}from"@sapphire/result";import{createPrompt as Xd,isEnterKey as Zd,makeTheme as Qd,useKeypress as em,usePrefix as tm,useState as la}from"@inquirer/core";function yi(r,e){let t=e!==!1;return/^(y|yes)/i.test(r)?t=!0:/^(n|no)/i.test(r)&&(t=!1),t}m(yi,"getBooleanValue");function da(r){return r?"Yes":"No"}m(da,"boolToString");var ma=Xd((r,e)=>{let t=da,[o,s]=la("idle"),[i,n]=la(""),a=Qd(),c=tm({status:o,theme:a});em((p,f)=>{if(Zd(p)){let y=yi(i,r.default);n(t(y)),s("done"),e(y);return}if(p.name==="tab"){let y=da(!yi(i,r.default));f.clearLine(0),f.write(y),n(y);return}if(p.name==="y"||p.name==="n"){let y=yi(p.name,r.default);n(t(y)),s("done"),e(y);return}f.clearLine(0),f.write(i),n(f.line)});let l=i,d="";o==="done"?l=a.style.answer(i):d=` ${a.style.defaultAnswer(r.default===!1?"y/N":"Y/n")}`;let u=a.style.message(r.message,o);return`${c} ${u}${d} ${l}`});var Z=Oe(async({message:r,default:e})=>await ma({message:r,default:e}));var am=m(r=>im(r,Rr),"getDeprecatedLocalConfigPath"),lo=new Map;async function Le({cwd:r=ua.cwd(),migrateConfig:e=!0,warnAboutOldConfig:t=!0}={cwd:ua.cwd(),migrateConfig:!0,warnAboutOldConfig:!0}){let o=lo.get(r);if(o)return T("useActorConfig",{cacheHit:!0,config:o}),mo(o);let s=ri(r),i=am(r),n,a;try{n=de(s)}catch(l){return dr({message:`Failed to read local config at path: '${s}':`,cause:l,exists:!1,config:{}})}try{a=de(i)}catch(l){return dr({message:`Failed to read local config at path: '${i}':`,cause:l,exists:!1,config:{}})}if(n&&a&&t&&await cm(i),!n&&!a)return lo.set(r,{exists:!1,migrated:!1,config:{}}),mo({exists:!1,migrated:!1,config:{}});let c=!1;if(!n&&a&&e){let l=await dm(a,i,s);if(l.isErr())return dr(l.unwrapErr());n=l.unwrap(),c=!0}return lo.set(r,{exists:!0,migrated:c,config:n||a||{}}),T("useActorConfig",{cacheHit:!1,config:lo.get(r)}),mo({exists:!0,migrated:c,config:n||a||{}})}m(Le,"useActorConfig");async function cm(r){if(!await Z({message:'The new version of Apify CLI uses the ".actor/actor.json" instead of the "apify.json" file. Since we have found both files in your Actor directory, "apify.json" will be renamed to "apify.json.deprecated". Going forward, all commands will use ".actor/actor.json". You can read about the differences between the old and the new config at https://github.com/apify/apify-cli/blob/master/MIGRATIONS.md. Do you want to continue?'})){x({message:'The "apify.json" file present in your Actor directory will be ignored, and the new ".actor/actor.json" file will be used instead. Please, either rename or remove the old file.'});return}try{await pa(r,`${r}.deprecated`),b({message:'The "apify.json" file has been renamed to "apify.json.deprecated". The deprecated file is no longer used by the CLI or Apify Console. If you do not need it for some specific purpose, it can be safely deleted.'})}catch(t){t instanceof Error?g({message:`Failed to rename the deprecated "apify.json" file to "apify.json.deprecated".
69
+ `,t+=co.gray(`Did you mean: ${e.map(o=>co.whiteBright(o)).join(", ")}?`)),g({message:t}),xe.exit(1)}m(ca,"handleCommandNotFound");async function qd(r,e){let t=W.get("upgrade");if([t.name,...t.aliases??[]].some(s=>e===s)){T("[VersionCheckMiddleware]","upgrade command detected, skipping version check");return}if(ia()){T("[VersionCheckMiddleware]","skipping version check because APIFY_CLI_SKIP_UPDATE_CHECK is set");return}await ra(r,t,{flags_internalAutomaticCall:!0})}m(qd,"runVersionCheck");async function bw(r){T("CLIMetadata",{...cr,fullVersionString:cr.fullVersionString,argv:xe.argv,cwd:xe.cwd(),execPath:xe.execPath});let e=xe.argv.slice(2);T("ProcessArgv",e);let t=aa({allowPositionals:!0,strict:!1,options:{help:{type:"boolean",short:"h"},version:{type:"boolean",short:"v"}},args:e});Hd(t),Jd(t,r),await qd(r,t.positionals[0]),T("TopLevelOptions",t);let o=t.positionals[0],s=-1;if(W.get(o)?.subcommands?.length){if(t.positionals[1]?.toLowerCase()==="help")s=1;else if(t.positionals[2]?.toLowerCase()==="help"){let y=W.get(`${o} ${t.positionals[1]}`);y&&!y.args&&(s=2)}}if(s!==-1){let y=t.positionals[s],v=e.indexOf(y);v!==-1&&e.splice(v,1),!e.includes("--help")&&!e.includes("-h")&&e.push("--help"),t.positionals.splice(s,1),t.values.help=!0}let n=t.positionals[1],a=!1,c=W.get(o);if(!c)return ca(o);let l=c;if(c.subcommands?.length){if(!n)return c.printHelp();a=!0,l=W.get(`${o} ${n}`)}if(!l)return ca(`${o} ${n}`);let d=[...e],u=d.indexOf(o);if(T("CommandNameIndex",u),d.splice(u,1),a){let y=d.indexOf(n);T("SubcommandNameIndex",y),d.splice(y,1)}T("RebuiltArgs",d),T("CommandToRun",l);let p=new l(r,a?`${c.name} ${n}`:c.name,o,a?n:void 0),f=p._buildParseArgsOption();T("ParserOptionsForCommand",f);try{let y=aa({...f,args:d});await p._run(y),T("CommandArgsResult",y)}catch(y){let v=pe.into(y,l);g({message:v.getPrettyMessage()}),xe.exit(1)}}m(bw,"runCLI");import{join as um,resolve as pm}from"path";import wi from"process";import{calculateRunDynamicMemory as fm}from"@apify/actor-memory-expression";var w={string:Kd,boolean:Wd,integer:zd};function ie(r='Automatic yes to prompts; assume "yes" as answer to all prompts.'){return{yes:w.boolean({char:"y",description:r,default:!1})}}m(ie,"YesFlag");function Kd(r){return{flagTag:"string",builder:m(e=>{let t=new Set([...r.aliases??[]]);t.delete(e);let o=[{flagName:e,option:{type:"string",multiple:!0}}];r.char&&(o[0].option.short=r.char);for(let s of t)o.push({flagName:Ee($e(s)).toLowerCase(),option:{type:"string",multiple:!0}});return o},"builder"),choices:r.choices,required:r.required??!1,hasDefault:r.default,stdin:r.stdin??2,description:r.description,aliases:r.aliases,char:r.char,hidden:r.hidden,exclusive:r.exclusive}}m(Kd,"stringFlag");function Wd(r){return{flagTag:"boolean",builder:m(e=>{let t=new Set([...r.aliases??[]]);t.delete(e);let o=[{flagName:e,option:{type:"boolean",multiple:!0}}];r.char&&(o[0].option.short=r.char);for(let s of t)o.push({flagName:Ee($e(s)).toLowerCase(),option:{type:"boolean",multiple:!0}});return o},"builder"),choices:null,required:r.required??!1,hasDefault:r.default,stdin:r.stdin??1,description:r.description,aliases:r.aliases,char:r.char,hidden:r.hidden,exclusive:r.exclusive}}m(Wd,"booleanFlag");function zd(r){return{flagTag:"integer",builder:m(e=>{let t=new Set([...r.aliases??[]]);t.delete(e);let o=[{flagName:e,option:{type:"string",multiple:!0}}];r.char&&(o[0].option.short=r.char);for(let s of t)o.push({flagName:Ee($e(s)).toLowerCase(),option:{type:"string",multiple:!0}});return o},"builder"),choices:null,required:r.required??!1,hasDefault:r.default,stdin:r.stdin??1,description:r.description,aliases:r.aliases,char:r.char,hidden:r.hidden,exclusive:r.exclusive}}m(zd,"integerFlag");import{mkdir as rm,rename as pa,writeFile as om}from"fs/promises";import{dirname as sm,join as im}from"path";import ua from"process";import{inspect as nm}from"util";import{err as dr,ok as mo}from"@sapphire/result";import{createPrompt as Xd,isEnterKey as Zd,makeTheme as Qd,useKeypress as em,usePrefix as tm,useState as la}from"@inquirer/core";function yi(r,e){let t=e!==!1;return/^(y|yes)/i.test(r)?t=!0:/^(n|no)/i.test(r)&&(t=!1),t}m(yi,"getBooleanValue");function da(r){return r?"Yes":"No"}m(da,"boolToString");var ma=Xd((r,e)=>{let t=da,[o,s]=la("idle"),[i,n]=la(""),a=Qd(),c=tm({status:o,theme:a});em((p,f)=>{if(Zd(p)){let y=yi(i,r.default);n(t(y)),s("done"),e(y);return}if(p.name==="tab"){let y=da(!yi(i,r.default));f.clearLine(0),f.write(y),n(y);return}if(p.name==="y"||p.name==="n"){let y=yi(p.name,r.default);n(t(y)),s("done"),e(y);return}f.clearLine(0),f.write(i),n(f.line)});let l=i,d="";o==="done"?l=a.style.answer(i):d=` ${a.style.defaultAnswer(r.default===!1?"y/N":"Y/n")}`;let u=a.style.message(r.message,o);return`${c} ${u}${d} ${l}`});var Z=Oe(async({message:r,default:e})=>await ma({message:r,default:e}));var am=m(r=>im(r,Rr),"getDeprecatedLocalConfigPath"),lo=new Map;async function Le({cwd:r=ua.cwd(),migrateConfig:e=!0,warnAboutOldConfig:t=!0}={cwd:ua.cwd(),migrateConfig:!0,warnAboutOldConfig:!0}){let o=lo.get(r);if(o)return T("useActorConfig",{cacheHit:!0,config:o}),mo(o);let s=ri(r),i=am(r),n,a;try{n=de(s)}catch(l){return dr({message:`Failed to read local config at path: '${s}':`,cause:l,exists:!1,config:{}})}try{a=de(i)}catch(l){return dr({message:`Failed to read local config at path: '${i}':`,cause:l,exists:!1,config:{}})}if(n&&a&&t&&await cm(i),!n&&!a)return lo.set(r,{exists:!1,migrated:!1,config:{}}),mo({exists:!1,migrated:!1,config:{}});let c=!1;if(!n&&a&&e){let l=await dm(a,i,s);if(l.isErr())return dr(l.unwrapErr());n=l.unwrap(),c=!0}return lo.set(r,{exists:!0,migrated:c,config:n||a||{}}),T("useActorConfig",{cacheHit:!1,config:lo.get(r)}),mo({exists:!0,migrated:c,config:n||a||{}})}m(Le,"useActorConfig");async function cm(r){if(!await Z({message:'The new version of Apify CLI uses the ".actor/actor.json" instead of the "apify.json" file. Since we have found both files in your Actor directory, "apify.json" will be renamed to "apify.json.deprecated". Going forward, all commands will use ".actor/actor.json". You can read about the differences between the old and the new config at https://github.com/apify/apify-cli/blob/master/MIGRATIONS.md. Do you want to continue?'})){x({message:'The "apify.json" file present in your Actor directory will be ignored, and the new ".actor/actor.json" file will be used instead. Please, either rename or remove the old file.'});return}try{await pa(r,`${r}.deprecated`),b({message:'The "apify.json" file has been renamed to "apify.json.deprecated". The deprecated file is no longer used by the CLI or Apify Console. If you do not need it for some specific purpose, it can be safely deleted.'})}catch(t){t instanceof Error?g({message:`Failed to rename the deprecated "apify.json" file to "apify.json.deprecated".
70
70
  ${t.message||t}`}):g({message:`Failed to rename the deprecated "apify.json" file to "apify.json.deprecated".
71
71
  ${nm(t,{showHidden:!1})}`})}}m(cm,"handleBothConfigVersionsFound");var lm=["name","version","buildTag"];async function dm(r,e,t){let o={...r};if(typeof o.version=="object"&&(o=mm(o)),o={actorSpecification:Ks,environmentVariables:r?.env||void 0,...lm.reduce((i,n)=>(i[n]=r[n],i),{})},!await Z({message:'The new version of Apify CLI uses the ".actor/actor.json" instead of the "apify.json" file. Your "apify.json" file will be automatically updated to the new format under ".actor/actor.json". The original file will be renamed by adding the ".deprecated" suffix. Do you want to continue?'}))return dr({message:'Command can not run with old "apify.json" structure. Either let the CLI auto-update it or follow the guide on https://github.com/apify/apify-cli/blob/master/MIGRATIONS.md and update it manually.',exists:!0,config:o});try{await rm(sm(t),{recursive:!0}),await om(t,JSON.stringify(o,null," "))}catch(i){let n=i;return dr({message:`Failed to write the new "actor.json" file to path: '${t}'.
72
72
  ${n.message||n}`,exists:!0,config:o})}try{await pa(e,`${e}.deprecated`)}catch(i){let n=i;x({message:`Failed to rename the deprecated "apify.json" file to "apify.json.deprecated".
@@ -133,7 +133,7 @@ Files under '${Ha/1024**2}' MB upload as "Multiple source files"; larger project
133
133
  Files matched by .gitignore and .actorignore are excluded. Use negation patterns (e.g. !dist/) in .actorignore to force-include git-ignored files.
134
134
  Use --force to override newer remote versions.`;static group="Local Actor Development";static examples=[{description:"Deploy the current Actor to the Apify platform.",command:"apify push"},{description:"Deploy to a specific Actor by ID, overriding newer remote versions.",command:"apify push E2jjCZBezvAZnX8Rb --force"},{description:"Deploy without waiting for the build to finish.",command:"apify push --no-wait-for-finish"}];static docsUrl="https://docs.apify.com/cli/docs/reference#apify-push";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 '${D}' 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 '${D}' 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}),"allow-missing-secrets":w.boolean({description:"Allow the command to continue even when secret values are not found in the local secrets storage.",required:!1,default:!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 '${D}' file.`})};async run(){let e=nu(mt.cwd(),this.flags.dir??"."),t=await fn(e);if(!t.length){g({message:"You need to call this command from a folder that has an Actor in it!"}),mt.exitCode=4;return}if(![Rr,"actor.json",".actor/actor.json",".actor"].some(F=>t.some(re=>re===F||re.startsWith(F)))){g({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(`
135
135
  `)}),mt.exitCode=4;return}let o=await I(),s=await Le({cwd:e});if(s.isErr()){g({message:s.unwrapErr().message}),mt.exitCode=5;return}let{config:i}=s.unwrap(),n=await M(),c=!!n.organizationOwnerUserId?`/organization/${n.id}`:"",l,d,u=!1,p=this.flags.version||i?.version||Ja,f=this.flags.buildTag||i?.buildTag;!f&&p===Ja&&(f=mu);let y=Number.isNaN(this.flags.waitForFinish)?void 0:Number.parseInt(this.flags.waitForFinish,10)*1e3,v=this.args.actorId;if(v){if(d=await o.actor(v).get(),!d)throw new Error(`Cannot find Actor with ID '${v}' in your account.`);l=d.id}else{let F=n.username||n.id;if(d=await o.actor(`${F}/${i.name}`).get(),d)l=d.id;else{let{templates:re}=await cu(),Te=re.find(Tr=>Tr.name===i.template)?.defaultRunOptions||du,ft={name:i.name,title:i.title,description:i.description,defaultRunOptions:Te,versions:[{versionNumber:p,buildTag:f,sourceType:Ii.SOURCE_FILES,sourceFiles:[]}]};i.usesStandbyMode&&(ft.actorStandby={isEnabled:!0}),d=await o.actors().create(ft),l=d.id,u=!0,b({message:`Created Actor with name ${i.name} on Apify.`})}}let S=o.actor(l);b({message:`Deploying Actor '${i.name}' to Apify.`});let E=await on(t,e),C,P,N;if(E<Ha){let F=await S.get();if(!u){let re=t.reduce((Te,ft)=>{let{mtimeMs:Tr,ctimeMs:Hi}=ou(iu(e,ft)),Ji=Tr>Hi?Tr:Hi;return Te>Ji?Te:Ji},0),Se=F?.modifiedAt.valueOf();if(!this.flags.force&&Se&&re<Se&&(i?.name||v))throw new Error(`Actor with identifier "${i?.name||v}" is already on the platform and was modified there since modified locally.
136
- Skipping push. Use --force to override.`)}P=await pn(t,e),C=Ii.SOURCE_FILES}else{Ce({message:"Zipping Actor files"}),await gn(Ei,t,e);let F=await o.keyValueStores().getOrCreate(`actor-${l}-source`),re=`version-${p}.zip`,Se=ru(Ei);await o.keyValueStore(F.id).setRecord({key:re,value:Se,contentType:"application/zip"}),su(Ei);let Te=new URL(`${o.baseUrl}/key-value-stores/${F.id}/records/${re}?disableRedirect=true`);if(F?.urlSigningSecretKey){let ft=lu(F.urlSigningSecretKey,re);Te.searchParams.set("signature",ft)}N=Te.toString(),C=Ii.TARBALL}let O=await S.version(p).get(),U=i.environmentVariables?Ya(i.environmentVariables,void 0,{allowMissing:this.flags.allowMissingSecrets}):void 0;if(O){let F={tarballUrl:N,sourceFiles:P,buildTag:f,sourceType:C,envVars:U};await S.version(p).update(F),Ce({message:`Updated version ${p} for Actor ${d.name}.`})}else{let F={versionNumber:p,tarballUrl:N,sourceFiles:P,buildTag:f,sourceType:C,envVars:U};await S.versions().create({...F}),Ce({message:`Created version ${p} for Actor ${d.name}.`})}if(!u&&!!i.usesStandbyMode!=!!d.actorStandby?.isEnabled){let F=!!i.usesStandbyMode;await S.update({actorStandby:{isEnabled:F}}),b({message:`${F?"Enabled":"Disabled"} standby mode for Actor ${d.name}.`})}Ce({message:`Building Actor ${d.name}`});let J=await S.build(p,{useCache:!0,waitForFinish:2});try{await ke({job:J,timeoutMillis:y,apifyClient:o})}catch(F){x({message:"Can not get log:"}),console.error(F)}if(J=await o.build(J.id).get(),this.flags.json){L(J);return}Hs({message:"Actor build detail",url:`https://console.apify.com${c}/actors/${J.actId}#/builds/${J.buildNumber}`}),Hs({message:"Actor detail",url:`https://console.apify.com${c}/actors/${J.actId}`}),this.flags.open&&await au(`https://console.apify.com${c}/actors/${J.actId}`),J.status===ut.SUCCEEDED?R({message:"Actor was deployed to Apify cloud and built there."}):J.status===ut.READY?x({message:"Build is waiting for allocation."}):J.status===ut.RUNNING?x({message:"Build is still running."}):J.status===ut.ABORTED||J.status===ut.ABORTING?(x({message:"Build was aborted!"}),mt.exitCode=3):J.status===ut.TIMED_OUT||J.status===ut.TIMING_OUT?(x({message:"Build timed out!"}),mt.exitCode=2):(g({message:"Build failed!"}),mt.exitCode=1)}};var Io=class extends h{static name="rm";static description="Permanently removes an Actor from your account.";static interactive=!0;static interactiveNote="Prompts for confirmation before deleting. Cannot be bypassed; deletion is irreversible.";static examples=[{description:"Delete an Actor by its full name (prompts for confirmation).",command:"apify actors rm my-username/my-actor"}];static docsUrl="https://docs.apify.com/cli/docs/reference#apify-actors-rm";static args={actorId:A.string({description:"The Actor ID to delete.",required:!0})};static flags={...ie};async run(){let{actorId:e}=this.args,{yes:t}=this.flags,o=await I();if(!await o.actor(e).get()){g({message:`Actor with ID "${e}" was not found on your account.`});return}if(!await Z({message:"Are you sure you want to delete this Actor?",providedConfirmFromStdin:t||void 0})){b({message:`Deletion of Actor "${e}" was canceled.`});return}try{await o.actor(e).delete(),R({message:`Actor with ID "${e}" was deleted.`})}catch(n){let a=n;g({message:`Failed to delete Actor "${e}".
136
+ Skipping push. Use --force to override.`)}P=await pn(t,e),C=Ii.SOURCE_FILES}else{Ce({message:"Zipping Actor files"}),await gn(Ei,t,e);let F=await o.keyValueStores().getOrCreate(`actor-${l}-source`),re=`version-${p}.zip`,Se=ru(Ei);await o.keyValueStore(F.id).setRecord({key:re,value:Se,contentType:"application/zip"}),su(Ei);let Te=new URL(`${o.baseUrl}/key-value-stores/${F.id}/records/${re}?disableRedirect=true`);if(F?.urlSigningSecretKey){let ft=lu(F.urlSigningSecretKey,re);Te.searchParams.set("signature",ft)}N=Te.toString(),C=Ii.TARBALL}let O=await S.version(p).get(),U=i.environmentVariables?Ya(i.environmentVariables,void 0,{allowMissing:this.flags.allowMissingSecrets}):void 0;if(O){let F={tarballUrl:N,sourceFiles:P,buildTag:f,sourceType:C,envVars:U};await S.version(p).update(F),Ce({message:`Updated version ${p} for Actor ${d.name}.`})}else{let F={versionNumber:p,tarballUrl:N,sourceFiles:P,buildTag:f,sourceType:C,envVars:U};await S.versions().create({...F}),Ce({message:`Created version ${p} for Actor ${d.name}.`})}if(!u&&!!i.usesStandbyMode!=!!d.actorStandby?.isEnabled){let F=!!i.usesStandbyMode;await S.update({actorStandby:{isEnabled:F}}),b({message:`${F?"Enabled":"Disabled"} standby mode for Actor ${d.name}.`})}Ce({message:`Building Actor ${d.name}`});let J=await S.build(p,{useCache:!0,waitForFinish:2});try{await ke({job:J,timeoutMillis:y,apifyClient:o})}catch(F){x({message:"Can not get log:"}),console.error(F)}if(J=await o.build(J.id).get(),this.flags.json){L(J);return}Hs({message:"Actor build detail",url:`https://console.apify.com${c}/actors/${J.actId}#/builds/${J.buildNumber}`}),Hs({message:"Actor detail",url:`https://console.apify.com${c}/actors/${J.actId}`}),this.flags.open&&await au(`https://console.apify.com${c}/actors/${J.actId}`),J.status===ut.SUCCEEDED?R({message:"Actor was deployed to Apify cloud and built there."}):J.status===ut.READY?x({message:"Build is waiting for allocation."}):J.status===ut.RUNNING?x({message:"Build is still running."}):J.status===ut.ABORTED||J.status===ut.ABORTING?(x({message:"Build was aborted!"}),mt.exitCode=3):J.status===ut.TIMED_OUT||J.status===ut.TIMING_OUT?(x({message:"Build timed out!"}),mt.exitCode=2):(g({message:"Build failed!"}),mt.exitCode=1)}};var Io=class extends h{static name="rm";static description="Permanently removes an Actor from your account.";static interactive=!0;static interactiveNote="Prompts for confirmation before deleting. Cannot be bypassed; deletion is irreversible.";static examples=[{description:"Delete an Actor by its full name (prompts for confirmation).",command:"apify actors rm my-username/my-actor"}];static docsUrl="https://docs.apify.com/cli/docs/reference#apify-actors-rm";static args={actorId:A.string({description:"The Actor ID to delete.",required:!0})};static flags={...ie()};async run(){let{actorId:e}=this.args,{yes:t}=this.flags,o=await I();if(!await o.actor(e).get()){g({message:`Actor with ID "${e}" was not found on your account.`});return}if(!await Z({message:"Are you sure you want to delete this Actor?",providedConfirmFromStdin:t||void 0})){b({message:`Deletion of Actor "${e}" was canceled.`});return}try{await o.actor(e).delete(),R({message:`Actor with ID "${e}" was deleted.`})}catch(n){let a=n;g({message:`Failed to delete Actor "${e}".
137
137
  ${a.message||a}`})}}};import{ApifyClient as uu}from"apify-client";import $i from"chalk";var pu={FREE:"Free",FLAT_PRICE_PER_MONTH:"Subscription",PRICE_PER_DATASET_ITEM:"Pay per result",PAY_PER_EVENT:"Pay per event"};function fu(r){return r?pu[r]??r:$i.gray("Unknown")}m(fu,"formatPricingModel");function gu(r,e=60){return r?r.length<=e?r:`${r.slice(0,e-1)}\u2026`:""}m(gu,"truncateDescription");var Eo=class extends h{static name="search";static description=`Searches Actors in the Apify Store.
138
138
 
139
139
  Searches the Apify Store for Actors matching the given query. Results can be filtered by category, author, pricing model, and more. This command does not require authentication.`;static examples=[{description:'Search the Apify Store for "web scraper" Actors.',command:'apify actors search "web scraper"'},{description:"Search for TikTok Actors sorted by popularity, limit to 5 results.",command:'apify actors search "tiktok" --limit 5 --sort-by popularity'},{description:"Find free AI Actors.",command:'apify actors search "ai" --category AI --pricing-model FREE'},{description:"Output results as JSON for scripting.",command:'apify actors search "web scraper" --json'}];static docsUrl="https://docs.apify.com/cli/docs/reference#apify-actors-search";static args={query:A.string({description:"Search query to find Actors by title, name, description, username, or readme.",required:!1})};static flags={"sort-by":w.string({description:"Sort order for the results.",options:["relevance","popularity","newest","lastUpdate"],default:"relevance"}),category:w.string({description:"Filter by category (e.g. AI)."}),username:w.string({description:"Filter by Actor author username."}),"pricing-model":w.string({description:"Filter by pricing model.",options:["FREE","FLAT_PRICE_PER_MONTH","PRICE_PER_DATASET_ITEM","PAY_PER_EVENT"]}),limit:w.integer({description:"Maximum number of results to return.",default:20}),offset:w.integer({description:"Number of results to skip for pagination.",default:0})};static enableJsonFlag=!0;async run(){let{query:e}=this.args,{json:t,sortBy:o,category:s,username:i,pricingModel:n,limit:a,offset:c}=this.flags,l=zt();delete l.token;let d=new uu(l),u;try{u=await d.store().list({search:e,sortBy:o,category:s,username:i,pricingModel:n,limit:a,offset:c})}catch(f){process.exitCode=1,g({message:`Failed to search Apify Store: ${f instanceof Error?f.message:String(f)}`,stdout:!0});return}if(u.count===0){if(t){L(u);return}b({message:"No Actors found matching your search.",stdout:!0});return}if(t){L(u);return}let p=new B({allColumns:["Name","Description","Users (30d)","Pricing"],mandatoryColumns:["Name","Pricing"],columnAlignments:{"Users (30d)":"right",Name:"left"}});for(let f of u.items)p.pushRow({Name:`${f.title}
@@ -153,8 +153,8 @@ Run 'apify login' to authenticate again.`;static group="Authentication";static e
153
153
  `),stdout:!0})}};var Lo=class extends h{static name="log";static description="Prints the log of a specific build.";static examples=[{description:"Print the build log.",command:"apify builds log <buildId>"}];static docsUrl="https://docs.apify.com/cli/docs/reference#apify-builds-log";static args={buildId:A.string({required:!0,description:"The build ID to get the log from."})};async run(){let{buildId:e}=this.args,t=await I(),o=await t.build(e).get();if(!o){g({message:`Build with ID "${e}" was not found on your account.`,stdout:!0});return}b({message:`Log for build with ID "${e}":
154
154
  `});try{await ke({job:o,apifyClient:t})}catch(s){g({message:`Failed to get log for build with ID "${e}": ${s.message}`,stdout:!0})}}};import ve from"chalk";var Pu=m(()=>new B({allColumns:["Number","ID","Status","Took"],mandatoryColumns:["Number","ID","Status","Took"],columnAlignments:{Took:"right"}}),"tableFactory"),Do=class extends h{static name="ls";static description="Lists all builds of the Actor.";static examples=[{description:"List builds of the Actor in the current directory.",command:"apify builds ls"},{description:"List builds of a specific Actor.",command:"apify builds ls apify/hello-world"}];static docsUrl="https://docs.apify.com/cli/docs/reference#apify-builds-ls";static flags={offset:w.integer({description:"Number of builds that will be skipped.",default:0}),limit:w.integer({description:"Number of builds that will be listed.",default:10}),desc:w.boolean({description:"Sort builds in descending order.",default:!1}),compact:w.boolean({description:"Display a compact table.",default:!1,char:"c"})};static args={actorId:A.string({description:"Optional Actor ID or Name to list runs for. By default, it will use the Actor from the current directory."})};static enableJsonFlag=!0;async run(){let{desc:e,limit:t,offset:o,compact:s,json:i}=this.flags,{actorId:n}=this.args,a=await I(),c=await Je({providedActorNameOrId:n,client:a});if(!c.valid){g({message:`${c.reason}. Please run this command in an Actor directory, or specify the Actor ID.`,stdout:!0});return}let l=await a.actor(c.id).builds().list({desc:e,limit:t,offset:o}),d=await a.actor(c.id).get(),u=Br(l.items,y=>{let v=Reflect.get(y,"buildNumber"),[S,E]=v.split(".");return`${S}.${E}`}),p=Object.entries(d.taggedBuilds??{}).reduce((y,[v,S])=>(y[S.buildNumber]=v,y),{});if(i){for(let y of l.items){let v=Reflect.get(y,"buildNumber"),S=p[v];S&&Reflect.set(y,"buildTag",S)}L(l);return}$({message:`${ve.reset("Showing")} ${ve.yellow(l.items.length)} out of ${ve.yellow(l.total)} builds for Actor ${ve.yellow(c.userFriendlyId)} (${ve.gray(c.id)})
155
155
  `,stdout:!0});let f=Object.entries(u).sort((y,v)=>y[0].localeCompare(v[0]));for(let[y,v]of f){if(!v?.length){$({message:`No builds for version ${y}`,stdout:!0});continue}let S=d.versions.find(N=>N.versionNumber===y)?.buildTag,E=this.generateTableForActorVersion({buildsForVersion:v,buildTagToActorVersion:p}),C=S?` (latest build gets tagged with ${ve.yellow(S)})`:"",P=[ve.reset(`Builds for Actor Version ${ve.yellow(y)}${C}`),E.render(s?0:-1),""];$({message:P.join(`
156
- `),stdout:!0})}}generateTableForActorVersion({buildsForVersion:e,buildTagToActorVersion:t}){let o=Pu();for(let s of e){let i=Reflect.get(s,"buildNumber"),n=t[i]?` (${ve.yellow(t[i])})`:"",a;if(s.finishedAt){let c=s.finishedAt.getTime()-s.startedAt.getTime();a=ve.gray(`${me.format(c,void 0,{left:""})}`)}else{let c=Date.now()-s.startedAt.getTime();a=ve.gray(`Running for ${me.format(c,void 0,{left:""})}`)}o.pushRow({Number:`${i}${n}`,ID:ve.gray(s.id),Status:Pe(s.status),Took:a})}return o}};import gr from"chalk";var Fo=class extends h{static name="remove-tag";static description="Removes a tag from a specific Actor build.";static examples=[{description:"Remove a tag from a build (prompts for confirmation).",command:"apify builds remove-tag --build <buildId> --tag beta"},{description:"Remove a tag non-interactively.",command:"apify builds remove-tag --build <buildId> --tag beta --yes"}];static docsUrl="https://docs.apify.com/cli/docs/reference#apify-builds-remove-tag";static flags={build:w.string({char:"b",description:"The build ID to remove the tag from.",required:!0}),tag:w.string({char:"t",description:"The tag to remove from the build.",required:!0}),...ie};async run(){let{build:e,tag:t,yes:o}=this.flags,s=await I(),i=await s.build(e).get();if(!i){g({message:`Build with ID "${e}" was not found on your account.`,stdout:!0});return}let n=await s.actor(i.actId).get();if(!n){g({message:`Actor with ID "${i.actId}" was not found.`,stdout:!0});return}let c=(n.taggedBuilds??{})[t];if(!c){g({message:`Tag "${t}" does not exist on Actor "${n.name}".`,stdout:!0});return}if(c.buildId!==e){g({message:`Tag "${t}" is not associated with build "${e}". It points to build "${c.buildNumber}" (${c.buildId}).`,stdout:!0});return}if(!await Z({message:`Are you sure you want to remove tag "${gr.yellow(t)}" from build ${gr.gray(i.buildNumber)}?`,providedConfirmFromStdin:o||void 0})){b({message:"Tag removal was canceled.",stdout:!0});return}try{await s.actor(i.actId).update({taggedBuilds:{[t]:null}}),R({message:`Tag "${gr.yellow(t)}" removed from build ${gr.gray(i.buildNumber)} (${gr.gray(e)})`,stdout:!0})}catch(d){let u=d;g({message:`Failed to remove tag "${t}" from build "${e}".
157
- ${u.message||u}`,stdout:!0})}}};import ku from"@inquirer/input";var Wa=Oe(async({message:r,expectedValue:e,failureMessage:t})=>await ku({message:r,validate(s){return s===e?!0:t??"That is not the correct input!"}}));var Uo=class extends h{static name="rm";static description="Permanently removes an Actor build from the Apify platform.";static interactive=!0;static interactiveNote="Prompts for confirmation before deleting. Tagged builds additionally require typing the tag name.";static examples=[{description:"Delete a build (prompts for confirmation).",command:"apify builds rm <buildId>"}];static docsUrl="https://docs.apify.com/cli/docs/reference#apify-builds-rm";static args={buildId:A.string({description:"The build ID to delete.",required:!0})};static flags={...ie};async run(){let{buildId:e}=this.args,{yes:t}=this.flags,o=await I(),s=await o.build(e).get();if(!s){g({message:`Build with ID "${e}" was not found on your account.`,stdout:!0});return}let i=await o.actor(s.actId).get(),n;if(i?.taggedBuilds){for(let[c,l]of Object.entries(i.taggedBuilds))if(e===l.buildId){n=c;break}}let a;if(n?a=await Wa({message:`Are you sure you want to delete this Actor Build? If so, please type in "${n}":`,expectedValue:n,failureMessage:"Your provided value does not match the build tag.",providedConfirmFromStdin:t?n:void 0}):a=await Z({message:"Are you sure you want to delete this Actor Build?",providedConfirmFromStdin:t||void 0}),!a){b({message:`Deletion of build "${e}" was canceled.`,stdout:!0});return}try{await o.build(e).delete(),R({message:`Build with ID "${e}" was deleted.`,stdout:!0})}catch(c){let l=c;g({message:`Failed to delete build "${e}".
156
+ `),stdout:!0})}}generateTableForActorVersion({buildsForVersion:e,buildTagToActorVersion:t}){let o=Pu();for(let s of e){let i=Reflect.get(s,"buildNumber"),n=t[i]?` (${ve.yellow(t[i])})`:"",a;if(s.finishedAt){let c=s.finishedAt.getTime()-s.startedAt.getTime();a=ve.gray(`${me.format(c,void 0,{left:""})}`)}else{let c=Date.now()-s.startedAt.getTime();a=ve.gray(`Running for ${me.format(c,void 0,{left:""})}`)}o.pushRow({Number:`${i}${n}`,ID:ve.gray(s.id),Status:Pe(s.status),Took:a})}return o}};import gr from"chalk";var Fo=class extends h{static name="remove-tag";static description="Removes a tag from a specific Actor build.";static examples=[{description:"Remove a tag from a build (prompts for confirmation).",command:"apify builds remove-tag --build <buildId> --tag beta"},{description:"Remove a tag non-interactively.",command:"apify builds remove-tag --build <buildId> --tag beta --yes"}];static docsUrl="https://docs.apify.com/cli/docs/reference#apify-builds-remove-tag";static flags={build:w.string({char:"b",description:"The build ID to remove the tag from.",required:!0}),tag:w.string({char:"t",description:"The tag to remove from the build.",required:!0}),...ie()};async run(){let{build:e,tag:t,yes:o}=this.flags,s=await I(),i=await s.build(e).get();if(!i){g({message:`Build with ID "${e}" was not found on your account.`,stdout:!0});return}let n=await s.actor(i.actId).get();if(!n){g({message:`Actor with ID "${i.actId}" was not found.`,stdout:!0});return}let c=(n.taggedBuilds??{})[t];if(!c){g({message:`Tag "${t}" does not exist on Actor "${n.name}".`,stdout:!0});return}if(c.buildId!==e){g({message:`Tag "${t}" is not associated with build "${e}". It points to build "${c.buildNumber}" (${c.buildId}).`,stdout:!0});return}if(!await Z({message:`Are you sure you want to remove tag "${gr.yellow(t)}" from build ${gr.gray(i.buildNumber)}?`,providedConfirmFromStdin:o||void 0})){b({message:"Tag removal was canceled.",stdout:!0});return}try{await s.actor(i.actId).update({taggedBuilds:{[t]:null}}),R({message:`Tag "${gr.yellow(t)}" removed from build ${gr.gray(i.buildNumber)} (${gr.gray(e)})`,stdout:!0})}catch(d){let u=d;g({message:`Failed to remove tag "${t}" from build "${e}".
157
+ ${u.message||u}`,stdout:!0})}}};import ku from"@inquirer/input";var Wa=Oe(async({message:r,expectedValue:e,failureMessage:t})=>await ku({message:r,validate(s){return s===e?!0:t??"That is not the correct input!"}}));var Uo=class extends h{static name="rm";static description="Permanently removes an Actor build from the Apify platform.";static interactive=!0;static interactiveNote="Prompts for confirmation before deleting. Tagged builds additionally require typing the tag name.";static examples=[{description:"Delete a build (prompts for confirmation).",command:"apify builds rm <buildId>"}];static docsUrl="https://docs.apify.com/cli/docs/reference#apify-builds-rm";static args={buildId:A.string({description:"The build ID to delete.",required:!0})};static flags={...ie()};async run(){let{buildId:e}=this.args,{yes:t}=this.flags,o=await I(),s=await o.build(e).get();if(!s){g({message:`Build with ID "${e}" was not found on your account.`,stdout:!0});return}let i=await o.actor(s.actId).get(),n;if(i?.taggedBuilds){for(let[c,l]of Object.entries(i.taggedBuilds))if(e===l.buildId){n=c;break}}let a;if(n?a=await Wa({message:`Are you sure you want to delete this Actor Build? If so, please type in "${n}":`,expectedValue:n,failureMessage:"Your provided value does not match the build tag.",providedConfirmFromStdin:t?n:void 0}):a=await Z({message:"Are you sure you want to delete this Actor Build?",providedConfirmFromStdin:t||void 0}),!a){b({message:`Deletion of build "${e}" was canceled.`,stdout:!0});return}try{await o.build(e).delete(),R({message:`Build with ID "${e}" was deleted.`,stdout:!0})}catch(c){let l=c;g({message:`Failed to delete build "${e}".
158
158
  ${l.message||l}`,stdout:!0})}}};var Mo=class extends h{static name="builds";static description="Create, inspect, tag, and delete Actor builds on the Apify platform.";static group="Apify Console";static docsUrl="https://docs.apify.com/cli/docs/reference#apify-builds";static subcommands=[Oo,Fo,Uo,Do,Lo,No,Ot];async run(){this.printHelp()}};var jo=class extends Ke{static name="call"};import Ou from"assert";import{existsSync as za,openSync as Nu}from"fs";import{mkdir as Xa,readFile as Lu,symlink as Du,unlink as Fu,writeFile as Za}from"fs/promises";import{homedir as Uu}from"os";import{dirname as Mu,join as Xe}from"path";import{ReadStream as ju}from"tty";import H from"chalk";import Qa from"which";var Bu=m(r=>Xe(r,".install-marker"),"pathToInstallMarker"),ec=m(()=>process.env.HOME??Uu(),"HOMEDIR"),hr=class extends h{static name="install";static description="Finalizes the first-time setup of Apify and Actor CLI.";static hidden=!0;async run(){let{installMethod:e,installPath:t,version:o}=z();if(e!=="bundle"){b({message:"Apify and Actor CLI are already fully configured! \u{1F44D}"});return}Ou(t,"When CLI is installed via bundles, the install path must be set");let s=Bu(t);if(za(s)){b({message:"Apify and Actor CLI are already fully configured! \u{1F44D}"});return}if(process.platform!=="win32"){await this.symlinkToLocalBin(t);try{await this.promptAddToShell()}catch(i){g({message:i.message||"Failed to automatically handle shell integration"})}$({message:""})}await Za(s,o),T("[install] install marker written to",s),$({message:["",H.green("Apify and Actor CLI were installed successfully!"),"",H.gray(` Version: ${H.green(o)}`),H.gray(` Location: ${H.bold.white(le(Xe(t,"apify")))} and ${H.bold.white(le(Xe(t,"actor")))}`)].join(`
159
159
  `)}),$({message:""}),R({message:"To get started, run:"}),$({message:H.white.bold(` apify --help
160
160
  actor --help`)})}async symlinkToLocalBin(e){let t=ec();if(T("[install -> symlinkToLocalBin] user home directory",t),!t){T("[install -> symlinkToLocalBin] user home directory not found"),x({message:H.gray("User home directory not found, cannot symlink to ~/.local/bin")});return}let o=Xe(t,".local","bin");await Xa(o,{recursive:!0});let s=["apify","actor","apify-cli"];for(let i of s){let n=Xe(e,i);if(!za(n)){T("[install] file not found for symlinking",i,n),x({message:H.gray(`Bundle not found for symlinking: ${i}`)});continue}let a=Xe(o,i);await Fu(a).catch(()=>{}),await Du(n,a),T("[install] symlink created for item",i,a)}b({message:H.gray(`Symlinked apify, actor, and apify-cli to ${le(o)}`)})}async confirmFromTty(e){let t,o,s=`${H.green("?")} ${H.bold(e)} ${H.dim("(Y/n)")} `,i=m(n=>{process.stdout.write(`\r\x1B[2K${H.green("?")} ${H.bold(e)} ${H.cyan(n)}
@@ -206,7 +206,7 @@ Storage size: ${ee({bytes:l,shortBytes:!0,precision:1})}`;let S=[`Dataset ID: ${
206
206
  `),"",v].join(`
207
207
  `);$({message:J,stdout:!0})}};import Ac from"chalk";var vc=new B({allColumns:["Dataset ID","Name","Items","Size","Created","Modified"],mandatoryColumns:["Dataset ID","Name","Items","Size"],columnAlignments:{Items:"right"}}),qo=class extends h{static name="ls";static description="Prints all datasets on your account.";static examples=[{description:"List your datasets (most recently modified first).",command:"apify datasets ls --desc"},{description:"List only unnamed (auto-generated) datasets.",command:"apify datasets ls --unnamed"}];static docsUrl="https://docs.apify.com/cli/docs/reference#apify-datasets-ls";static flags={offset:w.integer({description:"Number of datasets that will be skipped.",default:0}),limit:w.integer({description:"Number of datasets that will be listed.",default:20}),desc:w.boolean({description:"Sorts datasets in descending order.",default:!1}),unnamed:w.boolean({description:"Lists datasets that don't have a name set.",default:!1})};static enableJsonFlag=!0;async run(){let{desc:e,offset:t,limit:o,json:s,unnamed:i}=this.flags,n=await I(),a=await M(),c=await n.datasets().list({desc:e,offset:t,limit:o,unnamed:i});if(s){L(c);return}if(c.count===0){b({message:"You don't have any Datasets on your account",stdout:!0});return}for(let l of c.items){let d=Reflect.get(l.stats,"s3StorageBytes");vc.pushRow({"Dataset ID":l.id,Created:Y.display(l.createdAt),Items:`${l.itemCount}`,Modified:Y.display(l.modifiedAt),Name:l.name?`${a.username}/${l.name}`:"",Size:typeof d=="number"?ee({bytes:d,shortBytes:!0,colorFunc:Ac.gray,precision:0}):Ac.gray("N/A")})}$({message:vc.render(1),stdout:!0})}};import Ko from"chalk";var Wo=class extends h{static name="push-items";static description="Adds data items to specified dataset. Accepts single object or array of objects.";static examples=[{description:"Push a single item as an inline JSON argument.",command:`apify datasets push-items my-dataset '{"url":"https://example.com"}'`},{description:"Push an array of items from stdin.",command:"cat ./items.json | apify datasets push-items my-dataset"}];static docsUrl="https://docs.apify.com/cli/docs/reference#apify-datasets-push-items";static args={nameOrId:A.string({required:!0,description:"The dataset ID or name to push the objects to.",ignoreStdin:!0}),item:A.string({description:"The object or array of objects to be pushed."})};async run(){let{nameOrId:e,item:t}=this.args,o=await I(),s=await Ue(o,e);if(!s){g({message:`Dataset with ID or name "${e}" not found.`});return}let{datasetClient:i,dataset:n}=s,a,c=t||Re;if(!c){g({message:"No items were provided."});return}try{a=JSON.parse(c.toString("utf8"))}catch(d){g({message:`Failed to parse data as JSON string: ${d.message}`});return}if(Array.isArray(a)&&a.length===0){g({message:"No items were provided."});return}let l=n.name?`Dataset named ${Ko.yellow(n.name)} (${Ko.gray("ID:")} ${Ko.yellow(n.id)})`:`Dataset with ID ${Ko.yellow(n.id)}`;try{await i.pushItems(a),R({message:`${this.pluralString(Array.isArray(a)?a.length:1,"Object","Objects")} pushed to ${l} successfully.`})}catch(d){let u=d;g({message:`Failed to push items into ${l}
208
208
  ${u.message||u}`})}}};import Qe from"chalk";var zo=class extends h{static name="rename";static description="Change the dataset name or remove the name with --unname flag.";static examples=[{description:"Rename a dataset.",command:"apify datasets rename old-name new-name"},{description:"Remove the name from a dataset (makes it unnamed).",command:"apify datasets rename my-dataset --unname"}];static docsUrl="https://docs.apify.com/cli/docs/reference#apify-datasets-rename";static flags={unname:w.boolean({description:"Removes the unique name of the dataset."})};static args={nameOrId:A.string({description:"The dataset ID or name to delete.",required:!0}),newName:A.string({description:"The new name for the dataset."})};async run(){let{unname:e}=this.flags,{newName:t,nameOrId:o}=this.args;if(!t&&!e){g({message:"You must provide either a new name or the --unname flag."});return}if(t&&e){g({message:"You cannot provide a new name and the --unname flag."});return}let s=await I(),i=await Ue(s,o);if(!i){g({message:`Dataset with ID or name "${o}" not found.`});return}let{id:n,name:a}=i.dataset,c=a?e?`The name of the dataset with ID ${Qe.yellow(n)} has been removed (was ${Qe.yellow(a)} previously).`:`The name of the dataset with ID ${Qe.yellow(n)} was changed from ${Qe.yellow(a)} to ${Qe.yellow(t)}.`:`The name of the dataset with ID ${Qe.yellow(n)} has been set to: ${Qe.yellow(t)}`;try{await i.datasetClient.update({name:e?null:t}),R({message:c,stdout:!0})}catch(l){let d=l;g({message:`Failed to rename dataset with ID ${Qe.yellow(n)}
209
- ${d.message||d}`})}}};import Di from"chalk";var Xo=class extends h{static name="rm";static description="Permanently removes a dataset.";static interactive=!0;static interactiveNote="Prompts for confirmation before deleting. Cannot be bypassed; deletion is irreversible.";static examples=[{description:"Delete a dataset by name or ID (prompts for confirmation).",command:"apify datasets rm my-dataset"}];static docsUrl="https://docs.apify.com/cli/docs/reference#apify-datasets-rm";static args={datasetNameOrId:A.string({description:"The dataset ID or name to delete.",required:!0})};static flags={...ie};async run(){let{datasetNameOrId:e}=this.args,{yes:t}=this.flags,o=await I(),s=await Ue(o,e);if(!s){g({message:`Dataset with ID or name "${e}" not found.`});return}if(!await Z({message:"Are you sure you want to delete this Dataset?",providedConfirmFromStdin:t||void 0})){b({message:"Dataset deletion has been aborted."});return}let{id:n,name:a}=s.dataset;try{await s.datasetClient.delete(),R({message:`Dataset with ID ${Di.yellow(n)}${a?` (called ${Di.yellow(a)})`:""} has been deleted.`,stdout:!0})}catch(c){let l=c;g({message:`Failed to delete dataset with ID ${Di.yellow(n)}
209
+ ${d.message||d}`})}}};import Di from"chalk";var Xo=class extends h{static name="rm";static description="Permanently removes a dataset.";static interactive=!0;static interactiveNote="Prompts for confirmation before deleting. Cannot be bypassed; deletion is irreversible.";static examples=[{description:"Delete a dataset by name or ID (prompts for confirmation).",command:"apify datasets rm my-dataset"}];static docsUrl="https://docs.apify.com/cli/docs/reference#apify-datasets-rm";static args={datasetNameOrId:A.string({description:"The dataset ID or name to delete.",required:!0})};static flags={...ie()};async run(){let{datasetNameOrId:e}=this.args,{yes:t}=this.flags,o=await I(),s=await Ue(o,e);if(!s){g({message:`Dataset with ID or name "${e}" not found.`});return}if(!await Z({message:"Are you sure you want to delete this Dataset?",providedConfirmFromStdin:t||void 0})){b({message:"Dataset deletion has been aborted."});return}let{id:n,name:a}=s.dataset;try{await s.datasetClient.delete(),R({message:`Dataset with ID ${Di.yellow(n)}${a?` (called ${Di.yellow(a)})`:""} has been deleted.`,stdout:!0})}catch(c){let l=c;g({message:`Failed to delete dataset with ID ${Di.yellow(n)}
210
210
  ${l.message||l}`})}}};var Zo=class extends h{static name="datasets";static description="Manage Apify datasets \u2014 create, list, rename, delete, push items, and download items in various formats.";static group="Apify Console";static docsUrl="https://docs.apify.com/cli/docs/reference#apify-datasets";static subcommands=[Go,Yo,qo,Jo,Xo,zo,Wo];async run(){this.printHelp()}};import{existsSync as Fi,mkdirSync as up,readFileSync as pp,writeFileSync as fp}from"fs";import{dirname as gp}from"path";import hp from"cors";import yp from"detect-indent";import Ui from"express";import wp from"open";import{cryptoRandomObjectId as Ap}from"@apify/utilities";var Sc="https://apify.github.io/input-schema-editor-react/",vp=new URL(Sc).origin,bc="v1",Qo=class extends h{static name="edit-input-schema";static description="Lets you edit your input schema that would be used on the platform in a visual input schema editor.";static group="Local Actor Development";static interactive=!0;static interactiveNote="Opens a browser-based schema editor. Requires a local display; cannot be run headlessly.";static examples=[{description:"Edit the input schema of the Actor in the current directory.",command:"apify edit-input-schema"},{description:"Edit a specific INPUT_SCHEMA.json file.",command:"apify edit-input-schema ./.actor/INPUT_SCHEMA.json"}];static docsUrl="https://docs.apify.com/cli/docs/reference#apify-edit-input-schema";static args={path:A.string({required:!1,description:"Optional path to your INPUT_SCHEMA.json file. If not provided default platform location for input schema is used."})};static hidden=!0;static aliases=["eis"];async run(){let{inputSchema:e,inputSchemaPath:t}=await Tt({forcePath:this.args.path,cwd:process.cwd()});if(e&&!t)throw new Error(`Editing an input schema directly embedded in '${D}' is not yet supported.`);x({message:`This command is still experimental and might break at any time. Use at your own risk.
211
211
  `}),b({message:`Editing input schema at "${t}"...`});let o,s=Ui();s.use(hp({origin:vp,allowedHeaders:["Content-Type","Authorization"]})),s.use((u,p,f)=>{p.set("Connection","close"),f()}),s.use(Ui.json());let i=Ap();s.use((u,p,f)=>{let{token:y}=u.query;if(!y){let v=u.get("Authorization");if(v){let[S,E,...C]=v.trim().split(/\s+/);S.toLowerCase()==="bearer"&&E&&C.length===0&&(y=E)}}y!==i?(p.status(401),p.send("Authorization failed")):f()});let n=Ui.Router();s.use(`/api/${bc}`,n);let a=" ",c=!0;n.get("/input-schema",(u,p)=>{let f;try{f=Fi(t)?pp(t,{encoding:"utf-8"}):`{}
212
212
  `,f.length>3&&(a=yp(f).indent||a),f&&(c=f[f.length-1]===`
@@ -217,14 +217,14 @@ Storage size: ${ee({bytes:l,shortBytes:!0,precision:1})}`;let S=[`Dataset ID: ${
217
217
  If the directory contains a Scrapy project in Python, the command automatically creates wrappers so that you can run your scrapers without changes.
218
218
  Creates the '${D}' file and the '${ot}' directory in the current directory, but does not touch any other existing files or directories.
219
219
 
220
- WARNING: Overwrites existing '${ot}' directory.`;static group="Local Actor Development";static interactive=!0;static interactiveNote="Prompts for an Actor name if not provided. To run non-interactively, pass the Actor name as a positional argument, or pass --yes to accept the default (current directory name).";static examples=[{description:"Initialize an Actor in the current directory, prompting for a name.",command:"apify init"},{description:"Initialize non-interactively with an explicit Actor name.",command:"apify init my-actor"},{description:"Initialize non-interactively, accepting the default Actor name.",command:"apify init --yes"}];static docsUrl="https://docs.apify.com/cli/docs/reference#apify-init";static args={actorName:A.string({required:!1,description:"Name of the Actor. If not provided, you will be prompted for it."})};static flags={...ie,dockerfile:w.string({description:'Path to a Dockerfile to use for the Actor (e.g., "./Dockerfile" or "./docker/Dockerfile").',required:!1})};async run(){let{actorName:e}=this.args,t=Vi.cwd(),o=await Ne();o.isErr()&&(g({message:o.unwrapErr().message}),Vi.exit(1));let s=o.unwrap();if(s.warnings?.length)for(let a of s.warnings)x({message:a});let i=Lp(t);if(s.type===1&&s.entrypoint?.path){let a=s.entrypoint.path,c=a.includes(".")?a.split(".").pop():a;i=Fr(c)}if(s.type===2)return b({message:"The current directory looks like a Scrapy project. Using automatic project wrapping."}),this.telemetryData.actorWrapper="scrapy",os({projectPath:t});if(!this.flags.yes&&s.type===3&&(x({message:"The current directory does not look like a Node.js or Python project."}),!await Z({message:"Do you want to continue?",providedConfirmFromStdin:this.flags.yes})))return;let n=await Le({cwd:t});if(n.isOkAnd(a=>a.exists&&!a.migrated))x({message:`Skipping creation of '${D}', the file already exists in the current directory.`});else{if(n.isErr()){g({message:n.unwrapErr().message}),Vi.exitCode=5;return}if(!e){let l=n.isOkAnd(d=>d.exists)?n.unwrap().config.name:null;for(;!l;)try{let d=await at({message:"Actor name:",default:i});Qt(d),l=d}catch(d){g({message:d.message})}e=l}let c={...{...Cr,...n.unwrap().config},name:e};this.flags.dockerfile&&(c.dockerfile=this.flags.dockerfile),await Lr(c,t)}await Dr(t),await fo(t),R({message:"The Actor has been initialized in the current directory."})}};var is=class extends h{static name="init-wrap-scrapy";static description=`Wraps your existing Scrapy project to work like an Apify Actor.
220
+ WARNING: Overwrites existing '${ot}' directory.`;static group="Local Actor Development";static interactive=!0;static interactiveNote="Prompts for an Actor name if not provided. To run non-interactively, pass the Actor name as a positional argument, or pass --yes to accept the default (current directory name).";static examples=[{description:"Initialize an Actor in the current directory, prompting for a name.",command:"apify init"},{description:"Initialize non-interactively with an explicit Actor name.",command:"apify init my-actor"},{description:"Initialize non-interactively, accepting the default Actor name.",command:"apify init --yes"}];static docsUrl="https://docs.apify.com/cli/docs/reference#apify-init";static args={actorName:A.string({required:!1,description:"Name of the Actor. If not provided, you will be prompted for it."})};static flags={...ie(),dockerfile:w.string({description:'Path to a Dockerfile to use for the Actor (e.g., "./Dockerfile" or "./docker/Dockerfile").',required:!1})};async run(){let{actorName:e}=this.args,t=Vi.cwd(),o=await Ne();o.isErr()&&(g({message:o.unwrapErr().message}),Vi.exit(1));let s=o.unwrap();if(s.warnings?.length)for(let a of s.warnings)x({message:a});let i=Lp(t);if(s.type===1&&s.entrypoint?.path){let a=s.entrypoint.path,c=a.includes(".")?a.split(".").pop():a;i=Fr(c)}if(s.type===2)return b({message:"The current directory looks like a Scrapy project. Using automatic project wrapping."}),this.telemetryData.actorWrapper="scrapy",os({projectPath:t});if(!this.flags.yes&&s.type===3&&(x({message:"The current directory does not look like a Node.js or Python project."}),!await Z({message:"Do you want to continue?",providedConfirmFromStdin:this.flags.yes})))return;let n=await Le({cwd:t});if(n.isOkAnd(a=>a.exists&&!a.migrated))x({message:`Skipping creation of '${D}', the file already exists in the current directory.`});else{if(n.isErr()){g({message:n.unwrapErr().message}),Vi.exitCode=5;return}if(!e){let l=n.isOkAnd(d=>d.exists)?n.unwrap().config.name:null;for(;!l;)try{let d=await at({message:"Actor name:",default:i});Qt(d),l=d}catch(d){g({message:d.message})}e=l}let c={...{...Cr,...n.unwrap().config},name:e};this.flags.dockerfile&&(c.dockerfile=this.flags.dockerfile),await Lr(c,t)}await Dr(t),await fo(t),R({message:"The Actor has been initialized in the current directory."})}};var is=class extends h{static name="init-wrap-scrapy";static description=`Wraps your existing Scrapy project to work like an Apify Actor.
221
221
 
222
222
  It adds the following features:
223
223
  - Automatic retry of failed requests
224
224
  - Automatic proxy rotation
225
225
  - Automatic user agent rotation
226
226
  ...
227
- `;static args={path:A.string({required:!1,description:"Optional path to your scrapy project. If not provided, the current directory is used."})};static hidden=!0;async run(){await os({projectPath:this.args.path}),b({message:"Scrapy project wrapped successfully."})}};import $c from"chalk";var ns=class extends h{static name="create";static description="Creates a new key-value store on your account.";static examples=[{description:"Create an unnamed key-value store.",command:"apify key-value-stores create"},{description:"Create a named key-value store.",command:"apify key-value-stores create my-store"}];static docsUrl="https://docs.apify.com/cli/docs/reference#apify-key-value-stores-create";static args={"key-value store name":A.string({description:"Optional name for the key-value store.",required:!1})};static enableJsonFlag=!0;async run(){let{keyValueStoreName:e}=this.args,t=await I();if(e&&await ae(t,e)){g({message:"Cannot create a key-value store with the same name!"});return}let o=await t.keyValueStores().getOrCreate(e);if(this.flags.json){L(o);return}R({message:`Key-value store with ID ${$c.yellow(o.id)}${e?` (called ${$c.yellow(e)})`:""} was created.`,stdout:!0})}};import Dp from"chalk";var as=class extends h{static name="delete-value";static description="Delete a value from a key-value store.";static interactive=!0;static interactiveNote="Prompts for confirmation before deleting the record. Cannot be bypassed; deletion is irreversible.";static examples=[{description:"Delete a single record by key.",command:"apify key-value-stores delete-value <storeId> OUTPUT"}];static docsUrl="https://docs.apify.com/cli/docs/reference#apify-key-value-stores-delete-value";static args={"store id":A.string({description:"The key-value store ID to delete the value from.",required:!0}),itemKey:A.string({description:"The key of the item in the key-value store.",required:!0})};static flags={...ie};async run(){let{storeId:e,itemKey:t}=this.args,{yes:o}=this.flags,s=await I(),i=await ae(s,e);if(!i){g({message:`Key-value store with ID or name "${e}" not found.`});return}let{keyValueStoreClient:n}=i;if(!await n.getRecord(t)){g({message:`Item with key "${t}" not found in the key-value store.`});return}if(!await Z({message:"Are you sure you want to delete this record?",providedConfirmFromStdin:o||void 0})){b({message:"Key-value store record deletion aborted.",stdout:!0});return}try{await n.deleteRecord(t),b({message:`Record with key "${Dp.yellow(t)}" deleted from the key-value store.`,stdout:!0})}catch(l){let d=l;g({message:`Failed to delete record with key "${t}" from the key-value store.
227
+ `;static args={path:A.string({required:!1,description:"Optional path to your scrapy project. If not provided, the current directory is used."})};static hidden=!0;async run(){await os({projectPath:this.args.path}),b({message:"Scrapy project wrapped successfully."})}};import $c from"chalk";var ns=class extends h{static name="create";static description="Creates a new key-value store on your account.";static examples=[{description:"Create an unnamed key-value store.",command:"apify key-value-stores create"},{description:"Create a named key-value store.",command:"apify key-value-stores create my-store"}];static docsUrl="https://docs.apify.com/cli/docs/reference#apify-key-value-stores-create";static args={"key-value store name":A.string({description:"Optional name for the key-value store.",required:!1})};static enableJsonFlag=!0;async run(){let{keyValueStoreName:e}=this.args,t=await I();if(e&&await ae(t,e)){g({message:"Cannot create a key-value store with the same name!"});return}let o=await t.keyValueStores().getOrCreate(e);if(this.flags.json){L(o);return}R({message:`Key-value store with ID ${$c.yellow(o.id)}${e?` (called ${$c.yellow(e)})`:""} was created.`,stdout:!0})}};import Dp from"chalk";var as=class extends h{static name="delete-value";static description="Delete a value from a key-value store.";static interactive=!0;static interactiveNote="Prompts for confirmation before deleting the record. Cannot be bypassed; deletion is irreversible.";static examples=[{description:"Delete a single record by key.",command:"apify key-value-stores delete-value <storeId> OUTPUT"}];static docsUrl="https://docs.apify.com/cli/docs/reference#apify-key-value-stores-delete-value";static args={"store id":A.string({description:"The key-value store ID to delete the value from.",required:!0}),itemKey:A.string({description:"The key of the item in the key-value store.",required:!0})};static flags={...ie()};async run(){let{storeId:e,itemKey:t}=this.args,{yes:o}=this.flags,s=await I(),i=await ae(s,e);if(!i){g({message:`Key-value store with ID or name "${e}" not found.`});return}let{keyValueStoreClient:n}=i;if(!await n.getRecord(t)){g({message:`Item with key "${t}" not found in the key-value store.`});return}if(!await Z({message:"Are you sure you want to delete this record?",providedConfirmFromStdin:o||void 0})){b({message:"Key-value store record deletion aborted.",stdout:!0});return}try{await n.deleteRecord(t),b({message:`Record with key "${Dp.yellow(t)}" deleted from the key-value store.`,stdout:!0})}catch(l){let d=l;g({message:`Failed to delete record with key "${t}" from the key-value store.
228
228
  ${d.message||d}`})}}};var cs=class extends h{static name="get-value";static description="Retrieves stored value for specified key. Use --only-content-type to check MIME type.";static examples=[{description:"Read a record value and print it to stdout.",command:"apify key-value-stores get-value <storeId> INPUT"},{description:"Print only the record content-type.",command:"apify key-value-stores get-value <storeId> INPUT --only-content-type"}];static docsUrl="https://docs.apify.com/cli/docs/reference#apify-key-value-stores-get-value";static flags={"only-content-type":w.boolean({description:"Only return the content type of the specified key.",default:!1})};static args={keyValueStoreId:A.string({description:"The key-value store ID to get the value from.",required:!0}),itemKey:A.string({description:"The key of the item in the key-value store.",required:!0})};async run(){let{onlyContentType:e}=this.flags,{keyValueStoreId:t,itemKey:o}=this.args,s=await I(),i=await ae(s,t);if(!i){g({message:`Key-value store with ID "${t}" not found.`});return}let{keyValueStoreClient:n}=i,a=await n.getRecord(o,{stream:!0});if(!a){g({message:`Item with key "${o}" not found in the key-value store.`});return}if($({message:a.contentType??"application/octet-stream"}),e){a.value.destroy();return}if(a.contentType?.includes("application/json")){let{value:c}=a,l=[];for await(let u of c)l.push(u);let d=Buffer.concat(l).toString();try{let u=JSON.parse(d);$({message:JSON.stringify(u,null,2),stdout:!0})}catch{$({message:d,stdout:!0})}return}a.value.pipe(process.stdout)}};import V from"chalk";var Rc=new B({allColumns:["Row1","Row2"],mandatoryColumns:["Row1","Row2"]}),ls=class extends h{static name="info";static description="Shows information about a key-value store.";static examples=[{description:"Show metadata about a key-value store.",command:"apify key-value-stores info <storeId>"}];static docsUrl="https://docs.apify.com/cli/docs/reference#apify-key-value-stores-info";static args={storeId:A.string({description:"The key-value store ID to print information about.",required:!0})};static enableJsonFlag=!0;async run(){let{storeId:e}=this.args,t=await I(),o=await ae(t,e);if(!o){g({message:`Key-value store with ID or name "${e}" not found.`});return}let{keyValueStore:s}=o,[i,n,a]=await Promise.all([t.user(s.userId).get().then(F=>F),s.actId?t.actor(s.actId).get():Promise.resolve(void 0),s.actRunId?t.run(s.actRunId).get():Promise.resolve(void 0)]),c;if(a?.actorTaskId&&(c=await t.task(a.actorTaskId).get().catch(()=>{})),this.flags.json){L({...s,user:i,actor:n||null,run:a||null,task:c||null});return}let l=s.stats?.storageBytes||0,d=s.stats?.readCount||0,u=s.stats?.writeCount||0,p=s.stats?.deleteCount||0,f=s.stats?.listCount||0,v=`Operations: ${[`${V.bold(d.toLocaleString("en-US"))} ${V.gray(this.pluralString(d,"read","reads"))}`,`${V.bold(u.toLocaleString("en-US"))} ${V.gray(this.pluralString(u,"write","writes"))}`,`${V.bold(p.toLocaleString("en-US"))} ${V.gray(this.pluralString(p,"delete","deletes"))}`,`${V.bold(f.toLocaleString("en-US"))} ${V.gray(this.pluralString(f,"list","lists"))}`].join(" / ")}`;if(i.plan){let F=Ho(i.plan);if(F){let re=F.KEY_VALUE_STORE_TIMED_STORAGE_GBYTE_HOURS*(l/1e9),Se=re*24*30,Te=Se>1?`$${Se.toFixed(2)}`:`$${re.toFixed(3)}`;v+=`
229
229
  Storage size: ${ee({bytes:l,shortBytes:!0,precision:1})} / ${V.gray(`${Te} per month`)}`}}else v+=`
230
230
  Storage size: ${ee({bytes:l,shortBytes:!0,precision:1})} / ${V.gray("$unknown per month")}`;let S=[`Store ID: ${V.bgGray(s.id)}`,`Name: ${s.name?V.bgGray(s.name):V.bold(V.italic("Unnamed"))}`,`Created: ${V.bold(Y.display(s.createdAt))}`,`Modified: ${V.bold(Y.display(s.modifiedAt))}`].join(`
@@ -233,7 +233,7 @@ Storage size: ${ee({bytes:l,shortBytes:!0,precision:1})} / ${V.gray("$unknown pe
233
233
  `).map(F=>F.trim());U.shift();let J=[`${V.bold(s.name||V.italic("Unnamed"))}`,`${V.gray(s.name?`${i.username}/${s.name}`:s.id)} ${V.gray("Owned by")} ${V.blue(i.username)}`,"",U.join(`
234
234
  `),"",v].join(`
235
235
  `);$({message:J,stdout:!0})}};var xc=new B({allColumns:["Key","Size"],mandatoryColumns:["Key","Size"]}),ds=class extends h{static name="keys";static description="Lists all keys in a key-value store.";static examples=[{description:"List the first 20 keys in a key-value store.",command:"apify key-value-stores keys <storeId>"},{description:"Paginate keys past an exclusive start key.",command:"apify key-value-stores keys <storeId> --exclusive-start-key last-seen-key --limit 100"}];static docsUrl="https://docs.apify.com/cli/docs/reference#apify-key-value-stores-keys";static flags={limit:w.integer({description:"The maximum number of keys to return.",default:20}),"exclusive-start-key":w.string({description:"The key to start the list from."})};static args={storeId:A.string({description:"The key-value store ID to list keys for.",required:!0})};static enableJsonFlag=!0;async run(){let{storeId:e}=this.args,{limit:t,exclusiveStartKey:o}=this.flags,s=await I(),i=await ae(s,e);if(!i){g({message:`Key-value store with ID or name "${e}" not found.`});return}let{keyValueStoreClient:n}=i,a=await n.listKeys({limit:t,exclusiveStartKey:o});if(this.flags.json){L(a);return}for(let c of a.items)xc.pushRow({Key:c.key,Size:ee({bytes:c.size,shortBytes:!0,precision:0})});$({message:xc.render(1),stdout:!0})}};import _c from"chalk";var Pc=new B({allColumns:["Store ID","Name","Size","Created","Modified"],mandatoryColumns:["Store ID","Name","Size"]}),ms=class extends h{static name="ls";static description="Lists all key-value stores on your account.";static examples=[{description:"List your key-value stores.",command:"apify key-value-stores ls"},{description:"List the next page of stores, sorted descending.",command:"apify key-value-stores ls --limit 50 --offset 50 --desc"}];static docsUrl="https://docs.apify.com/cli/docs/reference#apify-key-value-stores-ls";static flags={offset:w.integer({description:"Number of key-value stores that will be skipped.",default:0}),limit:w.integer({description:"Number of key-value stores that will be listed.",default:20}),desc:w.boolean({description:"Sorts key-value stores in descending order.",default:!1}),unnamed:w.boolean({description:"Lists key-value stores that don't have a name set.",default:!1})};static enableJsonFlag=!0;async run(){let{desc:e,offset:t,limit:o,json:s,unnamed:i}=this.flags,n=await I(),a=await M(),c=await n.keyValueStores().list({desc:e,offset:t,limit:o,unnamed:i});if(s){L(c);return}if(c.count===0){b({message:"You don't have any key-value stores on your account",stdout:!0});return}for(let l of c.items){let u=Reflect.get(l,"stats").s3StorageBytes;Pc.pushRow({"Store ID":l.id,Created:Y.display(l.createdAt),Modified:Y.display(l.modifiedAt),Name:l.name?`${a.username}/${l.name}`:"",Size:typeof u=="number"?ee({bytes:u,shortBytes:!0,colorFunc:_c.gray,precision:0}):_c.gray("N/A")})}$({message:Pc.render(1),stdout:!0})}};import et from"chalk";var us=class extends h{static name="rename";static description="Renames a key-value store, or removes its unique name.";static examples=[{description:"Rename a key-value store.",command:"apify key-value-stores rename old-name new-name"},{description:"Remove the name from a key-value store.",command:"apify key-value-stores rename my-store --unname"}];static docsUrl="https://docs.apify.com/cli/docs/reference#apify-key-value-stores-rename";static flags={unname:w.boolean({description:"Removes the unique name of the key-value store."})};static args={keyValueStoreNameOrId:A.string({description:"The key-value store ID or name to delete.",required:!0}),newName:A.string({description:"The new name for the key-value store."})};async run(){let{unname:e}=this.flags,{newName:t,keyValueStoreNameOrId:o}=this.args;if(!t&&!e){g({message:"You must provide either a new name or the --unname flag."});return}if(t&&e){g({message:"You cannot provide a new name and the --unname flag."});return}let s=await I(),i=await ae(s,o);if(!i){g({message:`Key-value store with ID or name "${o}" not found.`});return}let{id:n,name:a}=i.keyValueStore,c=a?e?`The name of the key-value store with ID ${et.yellow(n)} has been removed (was ${et.yellow(a)} previously).`:`The name of the key-value store with ID ${et.yellow(n)} was changed from ${et.yellow(a)} to ${et.yellow(t)}.`:`The name of the key-value store with ID ${et.yellow(n)} has been set to: ${et.yellow(t)}`;try{await i.keyValueStoreClient.update({name:e?null:t}),R({message:c,stdout:!0})}catch(l){let d=l;g({message:`Failed to rename key-value store with ID ${et.yellow(n)}
236
- ${d.message||d}`})}}};import Gi from"chalk";var ps=class extends h{static name="rm";static description="Permanently removes a key-value store.";static interactive=!0;static interactiveNote="Prompts for confirmation before deleting. Cannot be bypassed; deletion is irreversible.";static examples=[{description:"Delete a key-value store (prompts for confirmation).",command:"apify key-value-stores rm my-store"}];static docsUrl="https://docs.apify.com/cli/docs/reference#apify-key-value-stores-rm";static args={keyValueStoreNameOrId:A.string({description:"The key-value store ID or name to delete.",required:!0})};static flags={...ie};async run(){let{keyValueStoreNameOrId:e}=this.args,{yes:t}=this.flags,o=await I(),s=await ae(o,e);if(!s){g({message:`Key-value store with ID or name "${e}" not found.`});return}if(!await Z({message:"Are you sure you want to delete this Key-value store?",providedConfirmFromStdin:t||void 0})){b({message:"Key-value store deletion has been aborted."});return}let{id:n,name:a}=s.keyValueStore;try{await s.keyValueStoreClient.delete(),R({message:`Key-value store with ID ${Gi.yellow(n)}${a?` (called ${Gi.yellow(a)})`:""} has been deleted.`,stdout:!0})}catch(c){let l=c;g({message:`Failed to delete key-value store with ID ${Gi.yellow(n)}
236
+ ${d.message||d}`})}}};import Gi from"chalk";var ps=class extends h{static name="rm";static description="Permanently removes a key-value store.";static interactive=!0;static interactiveNote="Prompts for confirmation before deleting. Cannot be bypassed; deletion is irreversible.";static examples=[{description:"Delete a key-value store (prompts for confirmation).",command:"apify key-value-stores rm my-store"}];static docsUrl="https://docs.apify.com/cli/docs/reference#apify-key-value-stores-rm";static args={keyValueStoreNameOrId:A.string({description:"The key-value store ID or name to delete.",required:!0})};static flags={...ie()};async run(){let{keyValueStoreNameOrId:e}=this.args,{yes:t}=this.flags,o=await I(),s=await ae(o,e);if(!s){g({message:`Key-value store with ID or name "${e}" not found.`});return}if(!await Z({message:"Are you sure you want to delete this Key-value store?",providedConfirmFromStdin:t||void 0})){b({message:"Key-value store deletion has been aborted."});return}let{id:n,name:a}=s.keyValueStore;try{await s.keyValueStoreClient.delete(),R({message:`Key-value store with ID ${Gi.yellow(n)}${a?` (called ${Gi.yellow(a)})`:""} has been deleted.`,stdout:!0})}catch(c){let l=c;g({message:`Failed to delete key-value store with ID ${Gi.yellow(n)}
237
237
  ${l.message||l}`})}}};var fs=class extends h{static name="set-value";static description="Stores value with specified key. Set content-type with --content-type flag.";static examples=[{description:"Store a JSON value under a key.",command:`apify key-value-stores set-value <storeId> OUTPUT '{"status":"done"}'`},{description:"Store a plain-text file read from stdin.",command:"cat ./report.txt | apify key-value-stores set-value <storeId> REPORT --content-type text/plain"}];static docsUrl="https://docs.apify.com/cli/docs/reference#apify-key-value-stores-set-value";static flags={"content-type":w.string({description:'The MIME content type of the value. By default, "application/json" is assumed.',default:"application/json"})};static args={storeId:A.string({description:"The key-value store ID to set the value in.",required:!0}),itemKey:A.string({description:"The key of the item in the key-value store.",required:!0}),value:A.string({description:"The value to set."})};async run(){let{storeId:e,itemKey:t,value:o}=this.args,{contentType:s}=this.flags,i=await I(),n=await ae(i,e);if(!n){g({message:`Key-value store with ID or name "${e}" not found.`});return}let{keyValueStoreClient:a}=n;try{await a.setRecord({key:t,value:o||process.stdin,contentType:s}),R({message:`Value with key "${t}" set in the key-value store.`,stdout:!0})}catch(c){let l=c;g({message:`Failed to set value with key "${t}" in the key-value store.
238
238
  ${l.message||l}`})}}};var gs=class extends h{static name="key-value-stores";static description=`Manage Apify key-value stores \u2014 create, list, rename, delete stores, and get/set/delete individual records.
239
239
 
@@ -292,7 +292,7 @@ NOTE: For Node.js Actors, customize behavior by modifying the 'start' script in
292
292
  `),stdout:!0})}addDetailedUsage(e){let{usage:t,usageUsd:o}=e;if(!t||!o){for(let s of Object.keys(Dc))br.pushRow({"":s,Unit:"N/A","USD Amount":"N/A"});return}for(let[s,i]of Object.entries(Dc)){let n=t[i]??0,a=o[i]??0;switch(i){case"ACTOR_COMPUTE_UNITS":{br.pushRow({"":s,Unit:n.toFixed(4),"USD Amount":this.formatUsd(a)});break}case"DATA_TRANSFER_INTERNAL_GBYTES":case"DATA_TRANSFER_EXTERNAL_GBYTES":case"PROXY_RESIDENTIAL_TRANSFER_GBYTES":{br.pushRow({"":s,Unit:ee({bytes:n*1024*1024*1024,shortBytes:!0}),"USD Amount":this.formatUsd(a)});break}default:br.pushRow({"":s,Unit:n.toLocaleString("en-US"),"USD Amount":this.formatUsd(a)})}}}formatUsd(e){return`$${e.toFixed(3)}`}};var xs=class extends h{static name="log";static description="Prints the log of a specific run.";static examples=[{description:"Print the log of a specific run to stdout.",command:"apify runs log <runId>"}];static docsUrl="https://docs.apify.com/cli/docs/reference#apify-runs-log";static args={runId:A.string({required:!0,description:"The run ID to get the log from."})};async run(){let{runId:e}=this.args,t=await I(),o=await t.run(e).get();if(!o){g({message:`Run with ID "${e}" was not found on your account.`,stdout:!0});return}b({message:`Log for run with ID "${e}":
293
293
  `,stdout:!0});try{await ke({job:o,apifyClient:t})}catch(s){g({message:`Failed to get log for run with ID "${e}": ${s.message}`})}}};import be from"chalk";var Fc=new B({allColumns:["ID","Status","Results","Usage","Started At","Took","Build No.","Origin"],mandatoryColumns:["ID","Status","Results","Usage","Started At","Took"],columnAlignments:{Results:"right",Usage:"right",Took:"right","Build No.":"right"}}),_s=class extends h{static name="ls";static description="Lists all runs of the Actor.";static examples=[{description:"List runs of the Actor in the current directory.",command:"apify runs ls"},{description:"List runs of a specific Actor.",command:"apify runs ls apify/hello-world"},{description:"List the 50 most recent runs in descending order.",command:"apify runs ls --limit 50 --desc"}];static docsUrl="https://docs.apify.com/cli/docs/reference#apify-runs-ls";static flags={offset:w.integer({description:"Number of runs that will be skipped.",default:0}),limit:w.integer({description:"Number of runs that will be listed.",default:10}),desc:w.boolean({description:"Sort runs in descending order.",default:!1}),compact:w.boolean({description:"Display a compact table.",default:!1,char:"c"})};static args={actorId:A.string({description:"Optional Actor ID or Name to list runs for. By default, it will use the Actor from the current directory."})};static enableJsonFlag=!0;async run(){let{desc:e,limit:t,offset:o,compact:s,json:i}=this.flags,{actorId:n}=this.args,a=await I(),c=await Je({providedActorNameOrId:n,client:a});if(!c.valid){g({message:`${c.reason}. Please run this command in an Actor directory, or specify the Actor ID.`});return}let l=await a.actor(c.id).runs().list({desc:e,limit:t,offset:o});if(i){L(l);return}if(!l.items.length){$({message:"There are no recent runs found for this Actor."});return}let d=[`${be.reset("Showing")} ${be.yellow(l.items.length)} out of ${be.yellow(l.total)} runs for Actor ${be.yellow(c.userFriendlyId)} (${be.gray(c.id)})`],u=new Map(await Promise.all(l.items.map(async p=>a.dataset(p.defaultDatasetId).get().then(f=>[p.id,be.yellow(f?.itemCount??0)],()=>[p.id,be.gray("N/A")]))));for(let p of l.items){let f;if(p.finishedAt){let y=p.finishedAt.getTime()-p.startedAt.getTime();f=be.gray(`${me.format(y,void 0,{left:""})}`)}else{let y=Date.now()-p.startedAt.getTime();f=be.gray(`Running for ${me.format(y,void 0,{left:""})}`)}Fc.pushRow({ID:be.gray(p.id),Status:Pe(p.status),Results:u.get(p.id)||be.gray("N/A"),Usage:be.cyan(`$${(p.usageTotalUsd??0).toFixed(3)}`),"Started At":er.display(p.startedAt),Took:f,"Build No.":p.buildNumber,Origin:p.meta.origin??"UNKNOWN"})}d.push(Fc.render(s?0:1)),$({message:d.join(`
294
294
  `),stdout:!0})}};import{ACTOR_JOB_STATUSES as Ps}from"@apify/consts";var Kp=[Ps.SUCCEEDED,Ps.FAILED,Ps.ABORTED,Ps.TIMED_OUT],ks=class extends h{static name="resurrect";static description="Resurrects an aborted or finished Actor Run.";static examples=[{description:"Resurrect a finished or aborted run.",command:"apify runs resurrect <runId>"}];static docsUrl="https://docs.apify.com/cli/docs/reference#apify-runs-resurrect";static args={runId:A.string({required:!0,description:"The run ID to resurrect."})};static enableJsonFlag=!0;async run(){let{runId:e}=this.args,t=await I(),o=await t.run(e).get();if(!o){g({message:`Run with ID "${e}" was not found on your account.`,stdout:!0});return}if(!Kp.includes(o.status)){g({message:`Run with ID "${e}" cannot be resurrected, as it is still running or in the process of aborting.`,stdout:!0});return}try{let s=await t.run(e).resurrect();if(this.flags.json){L(s);return}R({message:`Run with ID "${e}" was resurrected successfully.`,stdout:!0})}catch(s){let i=s;g({message:`Failed to resurrect run "${e}".
295
- ${i.message||i}`,stdout:!0})}}};import{ACTOR_JOB_STATUSES as Os}from"@apify/consts";var Wp=[Os.SUCCEEDED,Os.FAILED,Os.ABORTED,Os.TIMED_OUT],Ns=class extends h{static name="rm";static description="Deletes an Actor Run.";static interactive=!0;static interactiveNote="Prompts for confirmation before deleting. Cannot be bypassed; deletion is irreversible.";static examples=[{description:"Delete a finished or aborted run (prompts for confirmation).",command:"apify runs rm <runId>"}];static docsUrl="https://docs.apify.com/cli/docs/reference#apify-runs-rm";static args={runId:A.string({description:"The run ID to delete.",required:!0})};static flags={...ie};async run(){let{runId:e}=this.args,{yes:t}=this.flags,o=await I(),s=await o.run(e).get();if(!s){g({message:`Run with ID "${e}" was not found on your account.`});return}if(!Wp.includes(s.status)){g({message:`Run with ID "${e}" cannot be deleted, as it is still running or in the process of aborting.`});return}if(!await Z({message:"Are you sure you want to delete this Actor Run?",providedConfirmFromStdin:t||void 0})){b({message:`Deletion of run "${e}" was canceled.`});return}try{await o.run(e).delete(),R({message:`Run with ID "${e}" was deleted.`})}catch(n){let a=n;g({message:`Failed to delete run "${e}".
295
+ ${i.message||i}`,stdout:!0})}}};import{ACTOR_JOB_STATUSES as Os}from"@apify/consts";var Wp=[Os.SUCCEEDED,Os.FAILED,Os.ABORTED,Os.TIMED_OUT],Ns=class extends h{static name="rm";static description="Deletes an Actor Run.";static interactive=!0;static interactiveNote="Prompts for confirmation before deleting. Cannot be bypassed; deletion is irreversible.";static examples=[{description:"Delete a finished or aborted run (prompts for confirmation).",command:"apify runs rm <runId>"}];static docsUrl="https://docs.apify.com/cli/docs/reference#apify-runs-rm";static args={runId:A.string({description:"The run ID to delete.",required:!0})};static flags={...ie()};async run(){let{runId:e}=this.args,{yes:t}=this.flags,o=await I(),s=await o.run(e).get();if(!s){g({message:`Run with ID "${e}" was not found on your account.`});return}if(!Wp.includes(s.status)){g({message:`Run with ID "${e}" cannot be deleted, as it is still running or in the process of aborting.`});return}if(!await Z({message:"Are you sure you want to delete this Actor Run?",providedConfirmFromStdin:t||void 0})){b({message:`Deletion of run "${e}" was canceled.`});return}try{await o.run(e).delete(),R({message:`Run with ID "${e}" was deleted.`})}catch(n){let a=n;g({message:`Failed to delete run "${e}".
296
296
  ${a.message||a}`})}}};var Ls=class extends h{static name="runs";static description=`Inspect, abort, resurrect, or delete existing Actor runs.
297
297
  Does not start new runs \u2014 use 'apify call' (synchronous) or 'apify actors start' (asynchronous) for that.`;static group="Apify Console";static docsUrl="https://docs.apify.com/cli/docs/reference#apify-runs";static subcommands=[$s,Rs,xs,_s,ks,Ns];async run(){this.printHelp()}};var Ds=class extends h{static name="add";static description="Adds a new secret to '~/.apify' for use in Actor environment variables.";static examples=[{description:'Add a secret named "mySecret". Reference it in .actor/actor.json as "@mySecret".',command:"apify secrets add mySecret TopSecretValue123"}];static docsUrl="https://docs.apify.com/cli/docs/reference#apify-secrets-add";static args={name:A.string({required:!0,description:"Name of the secret."}),value:A.string({required:!0,description:"Value of the secret."})};async run(){let{name:e,value:t}=this.args;ja(e,t)}};import zp from"chalk";var Uc=new B({allColumns:["Secret Name"],mandatoryColumns:["Secret Name"],columnAlignments:{"Secret Name":"left"}}),Fs=class extends h{static name="ls";static description="Lists all secret keys stored in your local configuration.";static examples=[{description:"List the names of all locally stored secrets.",command:"apify secrets ls"}];static docsUrl="https://docs.apify.com/cli/docs/reference#apify-secrets-ls";static enableJsonFlag=!0;async run(){let{json:e}=this.flags,t=Ut(),o=Object.keys(t);if(e){L({keys:o});return}if(o.length===0){b({message:"You don't have any secrets stored locally. Use 'apify secrets add' to add a secret.",stdout:!0});return}for(let s of o)Uc.pushRow({"Secret Name":zp.cyan(s)});$({message:Uc.render(1),stdout:!0})}};var Us=class extends h{static name="rm";static description="Permanently deletes a secret from your stored credentials.";static examples=[{description:"Delete a locally stored secret by name.",command:"apify secrets rm mySecret"}];static docsUrl="https://docs.apify.com/cli/docs/reference#apify-secrets-rm";static args={name:A.string({required:!0,description:"Name of the secret."})};async run(){let{name:e}=this.args;Ba(e)}};var Ms=class extends h{static name="secrets";static description=`Manage locally stored secrets that can be referenced from '${D}' environment variables using the "@" prefix (e.g. "@mySecret"). Secrets are uploaded alongside the Actor and stored encrypted on the Apify platform.`;static group="Authentication";static examples=[{description:'Store a secret called "mySecret".',command:"apify secrets add mySecret TopSecretValue123"},{description:'Reference the secret from .actor/actor.json using the "@" prefix, e.g. "environmentVariables": { "SECRET_ENV_VAR": "@mySecret" }, then push as usual.',command:"apify push"}];static docsUrl="https://docs.apify.com/cli/docs/reference#apify-secrets";static subcommands=[Ds,Fs,Us];async run(){this.printHelp()}};import Mc from"chalk";var js=class extends h{static name="run";static description=`Executes predefined Actor task remotely using local key-value store for input.
298
298
  Customize with --memory and --timeout flags.
@@ -304,4 +304,4 @@ Customize with --memory and --timeout flags.
304
304
  4. INPUT_SCHEMA.json
305
305
 
306
306
  Optionally specify custom schema path to validate.`;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: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(){await uo({forcePath:this.args.path,cwd:Xp.cwd(),getMessage:m(e=>e?`Validating input schema at ${e}`:`Validating input schema embedded in '${D}'`,"getMessage")}),R({message:"Input schema is valid."})}};var eN=[yo,Ro,Po,Mo,Zo,gs,vs,Ls,Ms,Bs,Sr,xo,jo,yr,hr,Vo,Qo,ts,is,ss,hs,ys,ws,As,Is,Ys,wr],tN=[kt,Pt,_t,xt,Rt,St,bt,$t,wr,yr,hr,Sr];export{vw as a,bw as b,eN as c,tN as d};
307
- //# sourceMappingURL=chunk-K6JWY7BZ.js.map
307
+ //# sourceMappingURL=chunk-ZOZTH3AG.js.map