apify-cli 1.1.2-beta.40 → 1.1.2-beta.41

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-3BRR66C7.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-YPA7T4DZ.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-3BRR66C7.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-YPA7T4DZ.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 Va=Object.defineProperty;var c=(r,e)=>Va(r,"name",{value:e,configurable:!0});import Ie from"process";import{parseArgs as bn}from"util";import Mr from"chalk";import{satisfies as Lc}from"semver";import Ls from"chalk";import fc from"indent-string";import gc from"widest-line";import hc from"wrap-ansi";import Ba from"chalk";function C(r,...e){process.env.APIFY_CLI_DEBUG&&console.error(Ba.gray(`[${r}]`),...e)}c(C,"cliDebugPrint");import{realpathSync as Ga}from"fs";import{dirname as Ya}from"path";import mt from"chalk";function Ze(r){r.stdoutOutput&&console.log(...r.stdoutOutput),r.stderrOutput&&console.error(...r.stderrOutput)}c(Ze,"internalLog");function R(r){Ze({[r.stdout?"stdoutOutput":"stderrOutput"]:[r.message]})}c(R,"simpleLog");function p(r){Ze({[r.stdout?"stdoutOutput":"stderrOutput"]:[mt.red("Error:"),r.message]})}c(p,"error");function x(r){Ze({[r.stdout?"stdoutOutput":"stderrOutput"]:[mt.yellow.bold("Warning:"),r.message]})}c(x,"warning");function $(r){Ze({[r.stdout?"stdoutOutput":"stderrOutput"]:[mt.green("Success:"),r.message]})}c($,"success");function Ae(r){Ze({[r.stdout?"stdoutOutput":"stderrOutput"]:[mt.gray("Run:"),r.message]})}c(Ae,"run");function v(r){Ze({[r.stdout?"stdoutOutput":"stderrOutput"]:[mt.white("Info:"),r.message]})}c(v,"info");function ps(r){Ze({[r.stdout?"stdoutOutput":"stderrOutput"]:[mt.blue(r.message),r.url]})}c(ps,"link");var fs="0.0.0";var Ha="1.1.2-beta.40",Ja="38f98d1048f1432dd71b639bce23f7ba5f3466d2";function Ka(){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=Ga(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"}c(Ka,"detectInstallMethod");function qa(){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}}c(qa,"getRuntimeInfo");var _t=null;function K(){if(_t)return _t;let r=Ka(),e=qa();return _t={version:Ha,hash:Ja,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===fs}},r==="bundle"&&(_t.installPath=Ya(process.execPath)),_t}c(K,"useCLIMetadata");import{existsSync as _l,mkdirSync as xl,readFileSync as Ol,writeFileSync as Pl}from"fs";import{dirname as Nl}from"path";import{cryptoRandomObjectId as Ll}from"@apify/utilities";import{homedir as za}from"os";import{join as Qe}from"path";import{KEY_VALUE_STORE_KEYS as Xa,META_ORIGINS as Za}from"@apify/consts";var ci={name:"apify-cli",version:"1.1.2-beta.40",description:"Apify command-line interface (CLI) helps you manage the Apify cloud platform and develop, build, and deploy Apify Actors.",exports:"./dist/index.js",type:"module",scripts:{"dev:apify":"tsx ./src/entrypoints/apify.ts","dev:actor":"tsx ./src/entrypoints/actor.ts","test:all":"yarn test:local && yarn test:api","test:local":"vitest run --testNamePattern '^((?!\\[api]).)*$' --exclude ./test/api","test:api":"vitest run --testNamePattern '\\[api\\]'","test:python":"vitest run --testNamePattern '\\[python\\]'","test:cucumber":'cross-env NODE_OPTIONS="--import tsx" cucumber-js',lint:"eslint src test scripts features --ext .ts,.cjs,.mjs","lint:fix":"eslint src test scripts features --fix --ext .ts,.cjs,.mjs",format:'biome format . && prettier --check "**/*.{md,yml,yaml}"',"format:fix":'biome format --write . && prettier --write "**/*.{md,yml,yaml}"',clean:"rimraf dist",build:"yarn clean && tsc && tsup","build-bundles":"bun run scripts/build-cli-bundles.ts",prepack:"yarn insert-cli-metadata && yarn build && yarn update-docs","insert-cli-metadata":"tsx scripts/insert-cli-metadata.ts","update-docs":"tsx scripts/generate-cli-docs.ts",postinstall:`node -e "console.log('We have an active developer community on Discord. You can find it on https://discord.gg/crawlee-apify-801163717915574323.');"`},files:["dist"],bin:{actor:"./dist/actor.js",apify:"./dist/apify.js","apify-cli":"./dist/apify.js"},contributors:["Jakub Drobn\xEDk <jakub.drobnik@apify.com>","Jan Curn <jan@apify.com>","Vlad Frangu <vlad.frangu@apify.com>"],repository:{type:"git",url:"git+https://github.com/apify/apify-cli.git"},keywords:["apify","client","node","command","line","bash"],author:{name:"Apify",email:"support@apify.com",url:"https://www.apify.com"},license:"Apache-2.0",bugs:{url:"https://github.com/apify/apify-cli/issues"},homepage:"https://github.com/apify/apify-cli#readme",engines:{node:">=20"},dependencies:{"@apify/actor-memory-expression":"^0.1.3","@apify/actor-templates":"^0.1.5","@apify/consts":"^2.36.0","@apify/input_schema":"^3.17.0","@apify/utilities":"^2.18.0","@crawlee/memory-storage":"^3.12.0","@inquirer/core":"^11.0.0","@inquirer/input":"^5.0.0","@inquirer/password":"^5.0.0","@inquirer/select":"^5.0.0","@root/walk":"~1.1.0","@sapphire/duration":"^1.1.2","@sapphire/result":"^2.7.2","@sapphire/timestamp":"^1.0.3","@skyra/jaro-winkler":"^1.1.1","adm-zip":"~0.5.15",ajv:"~8.17.1","apify-client":"^2.14.0",archiver:"~7.0.1",axios:"^1.11.0",chalk:"~5.6.0","cli-table3":"^0.6.5","computer-name":"~0.1.0",configparser:"~0.3.10",cors:"~2.8.5","detect-indent":"~7.0.1","escape-string-regexp":"~5.0.0",execa:"^9.5.2",express:"~5.2.0",globby:"~15.0.0",handlebars:"~4.7.8","indent-string":"^5.0.0","is-ci":"~4.1.0",istextorbinary:"~9.5.0",jju:"~1.4.0","js-levenshtein":"^1.1.6","lodash.clonedeep":"^4.5.0",mime:"~4.1.0",open:"~11.0.0",rimraf:"~6.1.0",semver:"~7.7.0","string-width":"^8.0.0","strip-ansi":"^7.1.0",tiged:"~2.12.7",which:"^6.0.0","widest-line":"^5.0.0","wrap-ansi":"^9.0.0"},devDependencies:{"@apify/eslint-config":"^1.0.0","@apify/tsconfig":"^0.1.1","@biomejs/biome":"^2.0.0","@crawlee/types":"^3.11.1","@cucumber/cucumber":"^12.0.0","@types/adm-zip":"^0.5.5","@types/archiver":"^7.0.0","@types/bun":"^1.2.5","@types/cors":"^2.8.17","@types/execa":"^2.0.2","@types/express":"^5.0.0","@types/fs-extra":"^11","@types/is-ci":"^3.0.4","@types/jju":"^1.4.5","@types/js-levenshtein":"^1","@types/lodash.clonedeep":"^4","@types/mime":"^4.0.0","@types/node":"^24.0.0","@types/semver":"^7.5.8","@types/which":"^3.0.4","@yarnpkg/core":"^4.1.2",apify:"^3.2.4","cross-env":"^10.0.0",eslint:"^9.25.1","eslint-config-prettier":"^10.1.2","lint-staged":"^16.0.0","mdast-util-from-markdown":"^2.0.2","mock-stdin":"^1.0.0",prettier:"^3.5.3",tsup:"^8.5.0",tsx:"^4.16.5",typescript:"^5.8.3","typescript-eslint":"^8.31.0",vitest:"^4.0.0"},volta:{node:"24.12.0",yarn:"4.12.0"},packageManager:"yarn@4.12.0",devEngines:{runtime:[{name:"node",version:">= 20",onFail:"error"},{name:"bun",version:">= 1.2.5",onFail:"ignore"}],packageManager:{name:"yarn",version:">= 4",onFail:"warn"}},"lint-staged":{"*":"biome format --write --no-errors-on-unmatched","*.{mjs,js,ts}":"eslint --fix --ext mjs,js,ts","*.md":"prettier --write"}};var et="storage",gs="apify_storage",hs=1,ir={actorSpecification:hs,name:null,version:"0.0",buildTag:"latest",environmentVariables:{}},ui=1440*60*1e3,dt=c(()=>{let r=Qe(za(),".apify");return process.env.__APIFY_INTERNAL_TEST_AUTH_PATH__?Qe(r,process.env.__APIFY_INTERNAL_TEST_AUTH_PATH__):r},"GLOBAL_CONFIGS_FOLDER"),ae=c(()=>Qe(dt(),"auth.json"),"AUTH_FILE_PATH"),nr=c(()=>Qe(dt(),"secrets.json"),"SECRETS_FILE_PATH"),ar=c(()=>Qe(dt(),"state.json"),"STATE_FILE_PATH"),lr=c(()=>Qe(dt(),"telemetry.json"),"TELEMETRY_FILE_PATH"),cr="apify.json",ys=".actor",Qa="actor.json",V=Qe(ys,Qa),ws=new RegExp(`(^${Xa.INPUT}(?:\\.[^.]+)?$)`),be=ci.engines.node,mi={"X-Apify-Request-Origin":Za.CLI},tt="3.9.0",di=".venv";import{createWriteStream as al,existsSync as ce,mkdirSync as ll,readdirSync as Ai,readFileSync as Lt,writeFileSync as mr}from"fs";import{mkdir as cl,readFile as ul}from"fs/promises";import{get as ml}from"https";import{homedir as yi}from"os";import{dirname as bi,join as Se}from"path";import le from"process";import{finished as dl}from"stream/promises";import{DurationFormatter as Si,TimeTypes as rt}from"@sapphire/duration";import{Timestamp as As}from"@sapphire/timestamp";import pl from"adm-zip";import fl from"ajv/dist/2019.js";import{ApifyClient as vi}from"apify-client";import gl from"archiver";import{AxiosHeaders as hl}from"axios";import yl from"escape-string-regexp";import{globby as Ti}from"globby";import{getEncoding as wl}from"istextorbinary";import{Mime as Al}from"mime";import bl from"mime/types/other.js";import Sl from"mime/types/standard.js";import{gte as vl,minVersion as Tl,satisfies as Cl}from"semver";import{ACTOR_ENV_VARS as bs,ACTOR_JOB_TERMINAL_STATUSES as Il,ACTOR_NAME as Nt,APIFY_ENV_VARS as El,KEY_VALUE_STORE_KEYS as wi,LOCAL_ACTOR_ENV_VARS as Ss,LOCAL_STORAGE_SUBDIRS as vs,SOURCE_FILE_FORMATS as Pt}from"@apify/consts";import{existsSync as el,mkdirSync as tl}from"fs";import{readFile as rl,stat as pi,unlink as ol,writeFile as sl}from"fs/promises";import{join as fi,sep as il}from"path";import{rimraf as nl}from"rimraf";var gi=c(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"),ur=c((r,e)=>{e||(e=r,r="."),e.split(il).reduce((o,s)=>(o=fi(o,s),el(o)||tl(o),o),r)},"ensureFolderExistsSync"),xt=c(async r=>{await nl(r)},"rimrafPromised"),Ot=c(async r=>{(await pi(r)).isFile()&&await ol(r)},"deleteFile"),hi=c(async(r,e)=>(await Promise.all(r.map(async s=>pi(fi(e,s))))).map(s=>s.size).reduce((s,i)=>s+i,0),"sumFilesSizeInBytes");var pt=fl,dr=c(async r=>new Promise((e,t)=>{ml(r,o=>{o.statusCode===301||o.statusCode===302?(e(dr(o.headers.location)),o.destroy()):e(o)}).on("error",t)}),"httpsGet"),me=c(()=>{let r=El.LOCAL_STORAGE_DIR;return le.env[r]||le.env.CRAWLEE_STORAGE_DIR||et},"getLocalStorageDir"),ue=c(r=>{let e=bs.DEFAULT_KEY_VALUE_STORE_ID,t=r||le.env[e]||Ss[e];return Se(me(),vs.keyValueStores,t)},"getLocalKeyValueStorePath"),Ci=c(r=>{let e=bs.DEFAULT_DATASET_ID,t=r||le.env[e]||Ss[e];return Se(me(),vs.datasets,t)},"getLocalDatasetPath"),Ii=c(r=>{let e=bs.DEFAULT_REQUEST_QUEUE_ID,t=r||le.env[e]||Ss[e];return Se(me(),vs.requestQueues,t)},"getLocalRequestQueuePath"),M=c(async()=>{let r={};try{let e=await ul(ae(),"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 Dt();if(!r)throw new Error('You are not logged in with your Apify account. Call "apify login" to fix that.');return r}c(I,"getLoggedClientOrThrow");var Ei=c(r=>{if(!r&&ce(dt())&&ce(ae())){let e=Lt(ae(),"utf-8");return JSON.parse(e).token}return r},"getTokenWithAuthFileFallback"),Ts=c((r,e)=>(r=Ei(r),{token:r,baseUrl:e||le.env.APIFY_CLIENT_BASE_URL,requestInterceptors:[t=>{t.headers??=new hl;for(let[o,s]of Object.entries(mi))t.headers[o]=s;return t}]}),"getApifyClientOptions");async function Dt(r,e){r=Ei(r);let t=new vi(Ts(r,e)),o;try{o=await t.user("me").get()}catch{return null}return Is(ae()),mr(ae(),JSON.stringify({token:t.token,...o},null," ")),t}c(Dt,"getLoggedClient");var Cs=c(r=>Se(r,V),"getLocalConfigPath"),de=c(r=>{if(ce(r))return JSON.parse(Lt(r,{encoding:"utf-8"}))},"getJsonFileContent"),Me=c(r=>de(Cs(r)),"getLocalConfig"),pr=c(async(r,e)=>{let t=Se(e||le.cwd(),V);await cl(bi(t),{recursive:!0}),mr(t,JSON.stringify(r,null," "))},"setLocalConfig"),$l=[me(),"node_modules",".venv"],fr=c(async r=>{let e=ue();ur(r,Ci()),ur(r,Ii()),ur(r,e);let t=Se(r,".gitignore"),o="";ce(t)&&(o=Lt(t,{encoding:"utf-8"}));let s=[];for(let i of $l)RegExp(`^${yl(i)}$`,"mg").test(o)||s.push(i);s.length>0&&(o.length>0?(s.unshift("# Added by Apify CLI"),mr(t,`
1
+ var Va=Object.defineProperty;var c=(r,e)=>Va(r,"name",{value:e,configurable:!0});import Ie from"process";import{parseArgs as bn}from"util";import Mr from"chalk";import{satisfies as Lc}from"semver";import Ls from"chalk";import fc from"indent-string";import gc from"widest-line";import hc from"wrap-ansi";import Ba from"chalk";function C(r,...e){process.env.APIFY_CLI_DEBUG&&console.error(Ba.gray(`[${r}]`),...e)}c(C,"cliDebugPrint");import{realpathSync as Ga}from"fs";import{dirname as Ya}from"path";import mt from"chalk";function Ze(r){r.stdoutOutput&&console.log(...r.stdoutOutput),r.stderrOutput&&console.error(...r.stderrOutput)}c(Ze,"internalLog");function R(r){Ze({[r.stdout?"stdoutOutput":"stderrOutput"]:[r.message]})}c(R,"simpleLog");function p(r){Ze({[r.stdout?"stdoutOutput":"stderrOutput"]:[mt.red("Error:"),r.message]})}c(p,"error");function x(r){Ze({[r.stdout?"stdoutOutput":"stderrOutput"]:[mt.yellow.bold("Warning:"),r.message]})}c(x,"warning");function $(r){Ze({[r.stdout?"stdoutOutput":"stderrOutput"]:[mt.green("Success:"),r.message]})}c($,"success");function Ae(r){Ze({[r.stdout?"stdoutOutput":"stderrOutput"]:[mt.gray("Run:"),r.message]})}c(Ae,"run");function v(r){Ze({[r.stdout?"stdoutOutput":"stderrOutput"]:[mt.white("Info:"),r.message]})}c(v,"info");function ps(r){Ze({[r.stdout?"stdoutOutput":"stderrOutput"]:[mt.blue(r.message),r.url]})}c(ps,"link");var fs="0.0.0";var Ha="1.1.2-beta.41",Ja="aeec97a9cd764cb1a9706dbe8d668aefca2badc4";function Ka(){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=Ga(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"}c(Ka,"detectInstallMethod");function qa(){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}}c(qa,"getRuntimeInfo");var _t=null;function K(){if(_t)return _t;let r=Ka(),e=qa();return _t={version:Ha,hash:Ja,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===fs}},r==="bundle"&&(_t.installPath=Ya(process.execPath)),_t}c(K,"useCLIMetadata");import{existsSync as _l,mkdirSync as xl,readFileSync as Ol,writeFileSync as Pl}from"fs";import{dirname as Nl}from"path";import{cryptoRandomObjectId as Ll}from"@apify/utilities";import{homedir as za}from"os";import{join as Qe}from"path";import{KEY_VALUE_STORE_KEYS as Xa,META_ORIGINS as Za}from"@apify/consts";var ci={name:"apify-cli",version:"1.1.2-beta.41",description:"Apify command-line interface (CLI) helps you manage the Apify cloud platform and develop, build, and deploy Apify Actors.",exports:"./dist/index.js",type:"module",scripts:{"dev:apify":"tsx ./src/entrypoints/apify.ts","dev:actor":"tsx ./src/entrypoints/actor.ts","test:all":"yarn test:local && yarn test:api","test:local":"vitest run --testNamePattern '^((?!\\[api]).)*$' --exclude ./test/api","test:api":"vitest run --testNamePattern '\\[api\\]'","test:python":"vitest run --testNamePattern '\\[python\\]'","test:cucumber":'cross-env NODE_OPTIONS="--import tsx" cucumber-js',lint:"eslint src test scripts features --ext .ts,.cjs,.mjs","lint:fix":"eslint src test scripts features --fix --ext .ts,.cjs,.mjs",format:'biome format . && prettier --check "**/*.{md,yml,yaml}"',"format:fix":'biome format --write . && prettier --write "**/*.{md,yml,yaml}"',clean:"rimraf dist",build:"yarn clean && tsc && tsup","build-bundles":"bun run scripts/build-cli-bundles.ts",prepack:"yarn insert-cli-metadata && yarn build && yarn update-docs","insert-cli-metadata":"tsx scripts/insert-cli-metadata.ts","update-docs":"tsx scripts/generate-cli-docs.ts",postinstall:`node -e "console.log('We have an active developer community on Discord. You can find it on https://discord.gg/crawlee-apify-801163717915574323.');"`},files:["dist"],bin:{actor:"./dist/actor.js",apify:"./dist/apify.js","apify-cli":"./dist/apify.js"},contributors:["Jakub Drobn\xEDk <jakub.drobnik@apify.com>","Jan Curn <jan@apify.com>","Vlad Frangu <vlad.frangu@apify.com>"],repository:{type:"git",url:"git+https://github.com/apify/apify-cli.git"},keywords:["apify","client","node","command","line","bash"],author:{name:"Apify",email:"support@apify.com",url:"https://www.apify.com"},license:"Apache-2.0",bugs:{url:"https://github.com/apify/apify-cli/issues"},homepage:"https://github.com/apify/apify-cli#readme",engines:{node:">=20"},dependencies:{"@apify/actor-memory-expression":"^0.1.3","@apify/actor-templates":"^0.1.5","@apify/consts":"^2.36.0","@apify/input_schema":"^3.17.0","@apify/utilities":"^2.18.0","@crawlee/memory-storage":"^3.12.0","@inquirer/core":"^11.0.0","@inquirer/input":"^5.0.0","@inquirer/password":"^5.0.0","@inquirer/select":"^5.0.0","@root/walk":"~1.1.0","@sapphire/duration":"^1.1.2","@sapphire/result":"^2.7.2","@sapphire/timestamp":"^1.0.3","@skyra/jaro-winkler":"^1.1.1","adm-zip":"~0.5.15",ajv:"~8.17.1","apify-client":"^2.14.0",archiver:"~7.0.1",axios:"^1.11.0",chalk:"~5.6.0","cli-table3":"^0.6.5","computer-name":"~0.1.0",configparser:"~0.3.10",cors:"~2.8.5","detect-indent":"~7.0.1","escape-string-regexp":"~5.0.0",execa:"^9.5.2",express:"~5.2.0",globby:"~15.0.0",handlebars:"~4.7.8","indent-string":"^5.0.0","is-ci":"~4.1.0",istextorbinary:"~9.5.0",jju:"~1.4.0","js-levenshtein":"^1.1.6","lodash.clonedeep":"^4.5.0",mime:"~4.1.0",open:"~11.0.0",rimraf:"~6.1.0",semver:"~7.7.0","string-width":"^8.0.0","strip-ansi":"^7.1.0",tiged:"~2.12.7",which:"^6.0.0","widest-line":"^5.0.0","wrap-ansi":"^9.0.0"},devDependencies:{"@apify/eslint-config":"^1.0.0","@apify/tsconfig":"^0.1.1","@biomejs/biome":"^2.0.0","@crawlee/types":"^3.11.1","@cucumber/cucumber":"^12.0.0","@types/adm-zip":"^0.5.5","@types/archiver":"^7.0.0","@types/bun":"^1.2.5","@types/cors":"^2.8.17","@types/execa":"^2.0.2","@types/express":"^5.0.0","@types/fs-extra":"^11","@types/is-ci":"^3.0.4","@types/jju":"^1.4.5","@types/js-levenshtein":"^1","@types/lodash.clonedeep":"^4","@types/mime":"^4.0.0","@types/node":"^24.0.0","@types/semver":"^7.5.8","@types/which":"^3.0.4","@yarnpkg/core":"^4.1.2",apify:"^3.2.4","cross-env":"^10.0.0",eslint:"^9.25.1","eslint-config-prettier":"^10.1.2","lint-staged":"^16.0.0","mdast-util-from-markdown":"^2.0.2","mock-stdin":"^1.0.0",prettier:"^3.5.3",tsup:"^8.5.0",tsx:"^4.16.5",typescript:"^5.8.3","typescript-eslint":"^8.31.0",vitest:"^4.0.0"},volta:{node:"24.12.0",yarn:"4.12.0"},packageManager:"yarn@4.12.0",devEngines:{runtime:[{name:"node",version:">= 20",onFail:"error"},{name:"bun",version:">= 1.2.5",onFail:"ignore"}],packageManager:{name:"yarn",version:">= 4",onFail:"warn"}},"lint-staged":{"*":"biome format --write --no-errors-on-unmatched","*.{mjs,js,ts}":"eslint --fix --ext mjs,js,ts","*.md":"prettier --write"}};var et="storage",gs="apify_storage",hs=1,ir={actorSpecification:hs,name:null,version:"0.0",buildTag:"latest",environmentVariables:{}},ui=1440*60*1e3,dt=c(()=>{let r=Qe(za(),".apify");return process.env.__APIFY_INTERNAL_TEST_AUTH_PATH__?Qe(r,process.env.__APIFY_INTERNAL_TEST_AUTH_PATH__):r},"GLOBAL_CONFIGS_FOLDER"),ae=c(()=>Qe(dt(),"auth.json"),"AUTH_FILE_PATH"),nr=c(()=>Qe(dt(),"secrets.json"),"SECRETS_FILE_PATH"),ar=c(()=>Qe(dt(),"state.json"),"STATE_FILE_PATH"),lr=c(()=>Qe(dt(),"telemetry.json"),"TELEMETRY_FILE_PATH"),cr="apify.json",ys=".actor",Qa="actor.json",V=Qe(ys,Qa),ws=new RegExp(`(^${Xa.INPUT}(?:\\.[^.]+)?$)`),be=ci.engines.node,mi={"X-Apify-Request-Origin":Za.CLI},tt="3.9.0",di=".venv";import{createWriteStream as al,existsSync as ce,mkdirSync as ll,readdirSync as Ai,readFileSync as Lt,writeFileSync as mr}from"fs";import{mkdir as cl,readFile as ul}from"fs/promises";import{get as ml}from"https";import{homedir as yi}from"os";import{dirname as bi,join as Se}from"path";import le from"process";import{finished as dl}from"stream/promises";import{DurationFormatter as Si,TimeTypes as rt}from"@sapphire/duration";import{Timestamp as As}from"@sapphire/timestamp";import pl from"adm-zip";import fl from"ajv/dist/2019.js";import{ApifyClient as vi}from"apify-client";import gl from"archiver";import{AxiosHeaders as hl}from"axios";import yl from"escape-string-regexp";import{globby as Ti}from"globby";import{getEncoding as wl}from"istextorbinary";import{Mime as Al}from"mime";import bl from"mime/types/other.js";import Sl from"mime/types/standard.js";import{gte as vl,minVersion as Tl,satisfies as Cl}from"semver";import{ACTOR_ENV_VARS as bs,ACTOR_JOB_TERMINAL_STATUSES as Il,ACTOR_NAME as Nt,APIFY_ENV_VARS as El,KEY_VALUE_STORE_KEYS as wi,LOCAL_ACTOR_ENV_VARS as Ss,LOCAL_STORAGE_SUBDIRS as vs,SOURCE_FILE_FORMATS as Pt}from"@apify/consts";import{existsSync as el,mkdirSync as tl}from"fs";import{readFile as rl,stat as pi,unlink as ol,writeFile as sl}from"fs/promises";import{join as fi,sep as il}from"path";import{rimraf as nl}from"rimraf";var gi=c(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"),ur=c((r,e)=>{e||(e=r,r="."),e.split(il).reduce((o,s)=>(o=fi(o,s),el(o)||tl(o),o),r)},"ensureFolderExistsSync"),xt=c(async r=>{await nl(r)},"rimrafPromised"),Ot=c(async r=>{(await pi(r)).isFile()&&await ol(r)},"deleteFile"),hi=c(async(r,e)=>(await Promise.all(r.map(async s=>pi(fi(e,s))))).map(s=>s.size).reduce((s,i)=>s+i,0),"sumFilesSizeInBytes");var pt=fl,dr=c(async r=>new Promise((e,t)=>{ml(r,o=>{o.statusCode===301||o.statusCode===302?(e(dr(o.headers.location)),o.destroy()):e(o)}).on("error",t)}),"httpsGet"),me=c(()=>{let r=El.LOCAL_STORAGE_DIR;return le.env[r]||le.env.CRAWLEE_STORAGE_DIR||et},"getLocalStorageDir"),ue=c(r=>{let e=bs.DEFAULT_KEY_VALUE_STORE_ID,t=r||le.env[e]||Ss[e];return Se(me(),vs.keyValueStores,t)},"getLocalKeyValueStorePath"),Ci=c(r=>{let e=bs.DEFAULT_DATASET_ID,t=r||le.env[e]||Ss[e];return Se(me(),vs.datasets,t)},"getLocalDatasetPath"),Ii=c(r=>{let e=bs.DEFAULT_REQUEST_QUEUE_ID,t=r||le.env[e]||Ss[e];return Se(me(),vs.requestQueues,t)},"getLocalRequestQueuePath"),M=c(async()=>{let r={};try{let e=await ul(ae(),"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 Dt();if(!r)throw new Error('You are not logged in with your Apify account. Call "apify login" to fix that.');return r}c(I,"getLoggedClientOrThrow");var Ei=c(r=>{if(!r&&ce(dt())&&ce(ae())){let e=Lt(ae(),"utf-8");return JSON.parse(e).token}return r},"getTokenWithAuthFileFallback"),Ts=c((r,e)=>(r=Ei(r),{token:r,baseUrl:e||le.env.APIFY_CLIENT_BASE_URL,requestInterceptors:[t=>{t.headers??=new hl;for(let[o,s]of Object.entries(mi))t.headers[o]=s;return t}]}),"getApifyClientOptions");async function Dt(r,e){r=Ei(r);let t=new vi(Ts(r,e)),o;try{o=await t.user("me").get()}catch{return null}return Is(ae()),mr(ae(),JSON.stringify({token:t.token,...o},null," ")),t}c(Dt,"getLoggedClient");var Cs=c(r=>Se(r,V),"getLocalConfigPath"),de=c(r=>{if(ce(r))return JSON.parse(Lt(r,{encoding:"utf-8"}))},"getJsonFileContent"),Me=c(r=>de(Cs(r)),"getLocalConfig"),pr=c(async(r,e)=>{let t=Se(e||le.cwd(),V);await cl(bi(t),{recursive:!0}),mr(t,JSON.stringify(r,null," "))},"setLocalConfig"),$l=[me(),"node_modules",".venv"],fr=c(async r=>{let e=ue();ur(r,Ci()),ur(r,Ii()),ur(r,e);let t=Se(r,".gitignore"),o="";ce(t)&&(o=Lt(t,{encoding:"utf-8"}));let s=[];for(let i of $l)RegExp(`^${yl(i)}$`,"mg").test(o)||s.push(i);s.length>0&&(o.length>0?(s.unshift("# Added by Apify CLI"),mr(t,`
2
2
  ${s.join(`
3
3
  `)}
4
4
  `,{flag:"a"})):mr(t,`${s.join(`
@@ -43,7 +43,7 @@ ${e.ambiguousMessage.split(`
43
43
  ${t.message||t}`}):p({message:`Failed to rename the deprecated "apify.json" file to "apify.json.deprecated".
44
44
  ${zc(t,{showHidden:!1})}`})}}c(Zc,"handleBothConfigVersionsFound");var Qc=["name","version","buildTag"];async function eu(r,e,t){let o={...r};if(typeof o.version=="object"&&(o=tu(o)),o={actorSpecification:hs,environmentVariables:r?.env||void 0,...Qc.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 Kt({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 Jc(qc(t),{recursive:!0}),await Kc(t,JSON.stringify(o,null," "))}catch(i){let n=i;return Kt({message:`Failed to write the new "actor.json" file to path: '${t}'.
45
45
  ${n.message||n}`,exists:!0,config:o})}try{await En(e,`${e}.deprecated`)}catch(i){let n=i;x({message:`Failed to rename the deprecated "apify.json" file to "apify.json.deprecated".
46
- ${n.message||n}`})}return v({message:'The "apify.json" file has been migrated to ".actor/actor.json" and the original file 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. Do not forget to commit the new file to your Git repository.'}),Vr(o)}c(eu,"handleMigrationFlow");function tu(r){let e={name:r.name,template:r.template,version:r.version.versionNumber,buildTag:r.version.buildTag,env:null};if(r.version.envVars?.length){let t={};r.version.envVars.forEach(o=>{o.name&&o.value&&(t[o.name]=o.value)}),e.env=t}return e}c(tu,"updateLocalConfigStructure");var iu=ru(ue("default"),"INPUT.json"),gt=class extends h{static name="calculate-memory";static description="Calculates the Actor\u2019s dynamic memory usage based on a memory expression from actor.json, input data, and run options.";static flags={input:w.string({description:"Path to the input JSON file used for the calculation.",required:!1,default:iu}),defaultMemoryMbytes:w.string({description:"Memory-calculation expression (in MB). If omitted, the value is loaded from the actor.json file.",required:!1}),build:w.string({description:"Actor build version or build tag to evaluate the expression with.",required:!1}),timeoutSecs:w.integer({description:"Maximum run timeout, in seconds.",required:!1}),maxItems:w.integer({description:"Maximum number of items Actor can output.",required:!1}),maxTotalChargeUsd:w.integer({description:"Maximum total charge in USD.",required:!1})};async run(){let{input:e,memoryExpression:t,minMemory:o,maxMemory:s,runOptions:i}=await this.prepareMemoryArguments();if(!t)throw new Error("No memory-calculation expression found. Provide it via the --defaultMemoryMbytes flag or define defaultMemoryMbytes in actor.json.");let n=ou(Ms.cwd(),e),a=de(n)??{};v({message:`Evaluating memory expression: ${t}`});try{let l=await su(t,{input:a,runOptions:i}),m=Math.min(Math.max(l,o),s);$({message:`Calculated memory: ${m} MB`,stdout:!0})}catch(l){p({message:`Memory calculation failed: ${l.message}`})}}async prepareMemoryArguments(){let{input:e,defaultMemoryMbytes:t,...o}=this.flags,s=t,i=0,n=1/0;return s||({defaultMemoryMbytes:s,minMemoryMbytes:i=i,maxMemoryMbytes:n=n}=await this.getExpressionFromConfig()),{memoryExpression:s,minMemory:i,maxMemory:n,input:e,runOptions:o}}async getExpressionFromConfig(){let e=Ms.cwd(),t=await xe({cwd:e});if(t.isErr()){let{message:s,cause:i}=t.unwrapErr();return p({message:`${s}${i?`
46
+ ${n.message||n}`})}return v({message:'The "apify.json" file has been migrated to ".actor/actor.json" and the original file 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. Do not forget to commit the new file to your Git repository.'}),Vr(o)}c(eu,"handleMigrationFlow");function tu(r){let e={name:r.name,template:r.template,version:r.version.versionNumber,buildTag:r.version.buildTag,env:null};if(r.version.envVars?.length){let t={};r.version.envVars.forEach(o=>{o.name&&o.value&&(t[o.name]=o.value)}),e.env=t}return e}c(tu,"updateLocalConfigStructure");var iu=ru(ue("default"),"INPUT.json"),gt=class extends h{static name="calculate-memory";static description="Calculates the Actor\u2019s dynamic memory usage based on a memory expression from actor.json, input data, and run options.";static flags={input:w.string({description:"Path to the input JSON file used for the calculation.",required:!1,default:iu}),defaultMemoryMbytes:w.string({description:"Memory-calculation expression (in MB). If omitted, the value is loaded from the actor.json file.",required:!1}),build:w.string({description:"Actor build version or build tag to evaluate the expression with.",required:!1}),timeoutSecs:w.integer({description:"Maximum run timeout, in seconds.",required:!1}),maxItems:w.integer({description:"Maximum number of items Actor can output.",required:!1}),maxTotalChargeUsd:w.integer({description:"Maximum total charge in USD.",required:!1})};async run(){let{input:e,memoryExpression:t,minMemory:o,maxMemory:s,runOptions:i}=await this.prepareMemoryArguments();if(!t)throw new Error("No memory-calculation expression found. Provide it via the --default-memory-mbytes flag or define defaultMemoryMbytes in actor.json.");let n=ou(Ms.cwd(),e),a=de(n)??{};v({message:`Evaluating memory expression: ${t}`});try{let l=await su(t,{input:a,runOptions:i}),m=Math.min(Math.max(l,o),s);$({message:`Calculated memory: ${m} MB`,stdout:!0})}catch(l){p({message:`Memory calculation failed: ${l.message}`})}}async prepareMemoryArguments(){let{input:e,defaultMemoryMbytes:t,...o}=this.flags,s=t,i=0,n=1/0;return s||({defaultMemoryMbytes:s,minMemoryMbytes:i=i,maxMemoryMbytes:n=n}=await this.getExpressionFromConfig()),{memoryExpression:s,minMemory:i,maxMemory:n,input:e,runOptions:o}}async getExpressionFromConfig(){let e=Ms.cwd(),t=await xe({cwd:e});if(t.isErr()){let{message:s,cause:i}=t.unwrapErr();return p({message:`${s}${i?`
47
47
  ${i.message}`:""}`}),Ms.exitCode=5,{}}let{config:o}=t.unwrap();return{defaultMemoryMbytes:o?.defaultMemoryMbytes?.toString(),minMemoryMbytes:o?.minMemoryMbytes,maxMemoryMbytes:o?.maxMemoryMbytes}}};import{APIFY_ENV_VARS as du}from"@apify/consts";import qt from"process";import{pipeline as nu}from"stream/promises";import{MemoryStorage as au}from"@crawlee/memory-storage";import{ApifyClient as lu}from"apify-client";import{ACTOR_ENV_VARS as $n,APIFY_ENV_VARS as Rn,KEY_VALUE_STORE_KEYS as cu,LOCAL_ACTOR_ENV_VARS as uu}from"@apify/consts";var Wt={KEY_VALUE_STORE:"KEY_VALUE_STORE",DATASET:"DATASET",REQUEST_QUEUE:"REQUEST_QUEUE"},Us=c(async()=>{let r=qt.env[Rn.TOKEN];if(r)return r;let e=await M();if(!e||!e.token)throw new Error("Apify token is not set. Please set it using the environment variable APIFY_TOKEN or apify login command.");return e.token},"getApifyTokenFromEnvOrAuthFile"),nt=c(async(r={},e=Reflect.has(qt.env,Rn.IS_AT_HOME))=>{let t=me();if(t&&!e)return new au({localDataDirectory:t,...r});let o=await Us();return new lu({...Ts(o),...r})},"getApifyStorageClient"),zt=c(r=>{let e=$n[`DEFAULT_${r}_ID`];return qt.env[e]||uu[e]},"getDefaultStorageId"),js=c(async r=>{let e=await nt(),t=zt(Wt.KEY_VALUE_STORE),o=await e.keyValueStore(t).getRecord(r,{stream:!0});o&&await nu(o.value,qt.stdout,{end:!1})},"outputRecordFromDefaultStore"),_n=c(async()=>js(qt.env[$n.INPUT_KEY]||cu.INPUT),"outputInputFromDefaultStore");function mu(r){return{argTag:"string",required:r.required??!1,stdin:r.stdin??1,description:r.description,aliases:r.aliases,catchAll:r.catchAll??!1}}c(mu,"stringArg");var A={string:mu};var ht=class extends h{static name="charge";static description="Charge for a specific event in the pay-per-event Actor run.";static args={eventName:A.string({description:"Name of the event to charge for",required:!0})};static flags={count:w.integer({description:"Number of events to charge",required:!1,default:1}),"idempotency-key":w.string({description:"Idempotency key for the charge request",required:!1}),"test-pay-per-event":w.boolean({description:"Test pay-per-event charging without actually charging",required:!1,default:!1})};async run(){let{eventName:e}=this.args,{count:t,testPayPerEvent:o,idempotencyKey:s}=this.flags;if(!!!process.env.APIFY_IS_AT_HOME){v({message:`No platform detected: would charge ${t} events of type "${e}" with idempotency key "${s??"not-provided"}".`,stdout:!0});return}if(o){v({message:`PPE test mode: would charge ${t} events of type "${e}" with idempotency key "${s??"not-provided"}".`,stdout:!0});return}let n=await Us(),a=await Dt(n);if(!a)throw new Error("Apify token is not set. Please set it using the environment variable APIFY_TOKEN.");let l=process.env[du.ACTOR_RUN_ID];if(!l)throw new Error("Charge command must be executed in a running Actor. Run ID not found.");if((await a.run(l).get())?.pricingInfo?.pricingModel!=="PAY_PER_EVENT")throw new Error("Charge command can only be used with pay-per-event pricing model.");v({message:`Charging ${t} events of type "${e}" with idempotency key "${s??"not-provided"}" (runId: ${l}).`,stdout:!0}),await a.run(l).charge({eventName:e,count:t,idempotencyKey:s})}};var yt=class extends h{static name="get-input";static description="Gets the Actor input value from the default key-value store associated with the Actor run.";async run(){await _n()}};import{ACTOR_ENV_VARS as Vs,APIFY_ENV_VARS as pu}from"@apify/consts";var wt=class extends h{static name="get-public-url";static description="Get an HTTP URL that allows public access to a key-value store item.";static args={key:A.string({required:!0,description:"Key of the record in key-value store"})};async run(){let{key:e}=this.args;if([void 0,"false",""].includes(process.env[pu.IS_AT_HOME])){p({message:"get-public-url is not yet implemented for local development"}),process.exitCode=255;return}let t=process.env[Vs.DEFAULT_KEY_VALUE_STORE_ID];if(!t){p({message:`Missing environment variable: ${Vs.DEFAULT_KEY_VALUE_STORE_ID}. Please set it before running the command.`}),process.exitCode=5;return}let o=await nt();if(!await o.keyValueStore(t).get()){p({message:`Key-Value store with ID '${t}' was not found. Ensure the store exists and that the correct ID is set in ${Vs.DEFAULT_KEY_VALUE_STORE_ID}.`}),process.exitCode=250;return}let i=await o.keyValueStore(t).getRecordPublicUrl(e);console.log(i)}};var At=class extends h{static name="get-value";static description="Gets a value from the default key-value store associated with the Actor run.";static args={key:A.string({required:!0,description:"Key of the record in key-value store"})};async run(){let{key:e}=this.args;await js(e)}};var bt=class extends h{static name="push-data";static description=`Saves data to Actor's run default dataset.
48
48
 
49
49
  Accept input as:
@@ -252,4 +252,4 @@ Read more: https://docs.apify.com/cli/docs/telemetry`;static subcommands=[ms,us]
252
252
  4. INPUT_SCHEMA.json
253
253
 
254
254
  Optionally specify custom schema path to validate.`;static args={path:A.string({required:!1,description:"Optional path to your INPUT_SCHEMA.json file. If not provided ./INPUT_SCHEMA.json is used."})};static hiddenAliases=["vis"];async run(){let{inputSchema:e,inputSchemaPath:t}=await ct({forcePath:this.args.path,cwd:_d.cwd()});if(!e)throw new Error(`Input schema has not been found at ${t}.`);t?v({message:`Validating input schema stored at ${t}`}):v({message:`Validating input schema embedded in '${V}'`});let o=new pt({strict:!1});xd(o,e),$({message:"Input schema is valid."})}};var Wx=[Br,Qr,so,So,Mo,Go,ss,as,cs,or,io,Zt,Xt,uo,vo,Co,Ro,$o,Uo,jo,Vo,Bo,qo,ds,Qt],zx=[St,bt,At,wt,yt,ht,gt,Qt,Zt,Xt,or];export{Jh as a,Kh as b,Wx as c,zx as d};
255
- //# sourceMappingURL=chunk-3BRR66C7.js.map
255
+ //# sourceMappingURL=chunk-YPA7T4DZ.js.map