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