Lines 73-113javascript
74 * This file was automatically generated by json-schema-to-typescript.
75 * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
76 * and run apify actor generate-schema-types to regenerate this file.
78`,maxItems:-1,unknownAny:!0,format:!0,additionalProperties:!this.flags.strict,$refOptions:{resolve:{external:!1,file:!1,http:!1}}},l=await vt(stripTitles(s),a,c),u=D.resolve(r,this.flags.output);await F(u,{recursive:!0});let f=D.join(u,`${a}.ts`);if(await z(f,l,`utf-8`),success({message:`Generated types written to ${f}`}),!n){let t=await Promise.allSettled([this.generateDatasetTypes({cwd:r,outputDir:u,compileOptions:c}),this.generateOutputTypes({cwd:r,outputDir:u,compileOptions:c}),this.generateKvsTypes({cwd:r,outputDir:u,compileOptions:c})]),n=[`Dataset`,`Output`,`Key-Value Store`],i=!1;for(l ...
79`),`utf-8`),success({message:`Generated types written to ${l}`})}},ActorGetInputCommand=class extends ApifyCommand{static name=`get-input`;static description=`Gets the Actor input value from the default key-value store associated with the Actor run.`;static group=`Actor Runtime`;static examples=[{description:`Print the current Actor input to stdout.`,command:`actor get-input`}];static docsUrl=
80- If empty, the record in the key-value store is deleted.
81- If no \`contentType\` flag is specified, value is expected to be any JSON string value.
82- If options.contentType is set, value is taken as is.`})};static flags={contentType:Y.string({char:`c`,description:`Specifies a custom MIME content type of the record. By default "application/json" is used.`,required:!1})};async run(){let{key:e,value:t}=this.args,{contentType:n=`application/json; charset=utf-8`}=this.flags,r=t||process.stdin,i=(await getApifyStorageClient()).keyValueStore(getDefaultStorageId
84For platform-level management (deploy, list, call Actors), see 'apify actors' (plural).`;static group=`Apify Console`;static docsUrl=`https://docs.apify.com/cli/docs/reference#apify-actor`;static subcommands=[ActorSetValueCommand,ActorPushDataCommand,ActorGetValueCommand,ActorGetPublicUrlCommand,ActorGetInputCommand,ActorChargeCommand,ActorCalculateMemoryCommand,ActorGenerateSchemaTypesCommand];async run(){this.printHelp()}};function OverrideClassName(
85`).filter(e=>e.length>0).slice(-n):[]}catch{return[]}}function consoleRunUrl(e,t){return`https://console.apify.com/actors/${e}/runs/${t}`}function consoleBuildUrl(e,t){return`https://console.apify.com/actors/${e}#/builds/${t}`}function statusColor(e){return e===`SUCCEEDED`?t.green(e):e===`RUNNING`||e===`READY`?t.blue(e):t.red(e)}function formatResultSummary(e){let n=[];n.push(`${t.bold(e.resultLabel)}: ${statusColor(e.overallStatus)}`),n.push(``);for(let t of e.lines)n.push(`${t.label}: ${t.value}`);if(e.links?.length){n.push(``);for(let r of e.links)n.push(`${r.label}: ${t.blue(r.url)}`)}if(e ...
86`)}async function resolveActorContext({providedActorNameOrId:t,client:n}){let r=await getLocalUserInfo(),i=r.username||r.id,a=getLocalConfig(e.cwd())||{};if(t?.includes(`/`)){let e=await n.actor(t).get();return e?{valid:!0,userFriendlyId:`${e.username}/${e.name}`,id:e.id}:{valid:!1,reason:`Actor with ID "${t}" was not found`}}if(t){let e=await n.actor(t).get();if(e)return{valid:!0,userFriendlyId:`${e.username}/${e.name}`,id:e.id};let r=await n.actor(`${i}/${t.toLowerCase()}`).get();return r?{valid:!0,userFriendlyId:`${r.username}/${r.name}`,id:r.id}:{valid:!1,reason:`Actor with name or ID "${t ...
87`),stdout:!0})}},ActorsBuildCommand=class extends OverrideClassName(BuildsCreateCommand){static name=`build`};function withSchemaHint(e,t){return t?`${e}\n${t}`:e}function resolveInput(e,t){let n,r;if(t)n=t,r=`application/json`;else{let t=getLocalInput(e);t&&(Je.getExtension(t.contentType)===`json`?(n=JSON.parse(t.body.toString(`utf8`)),r=`application/json`):(n=t.body,r=t.contentType))}return!n||!r?null:{inputToUse:n,contentType:r}}async function getInputOverride(t,n,r,i={}){let a,s,{schemaHint:c}=i;if(!n&&!r){let t=pn;if(t)try{let n=JSON.parse(t.toString(`utf8`));if(Array.isArray(n))return er ...
88`))}throw e}if(i.u(useAbortJobOnSignal({apifyClient:n,kind:`run`,jobId:y.id,runType:l,silent:p})),yield y,!p&&h)try{await outputJobLog({job:y,timeoutMillis:u,apifyClient:n})===`timeouts`?console.error(`\n${t.gray(`Timeout for printing logs was hit, there may be future logs.`)}\n`):console.error()}catch(e){
89`).map(e=>e.trimEnd()).filter(e=>e.length>0).slice(-10):[]}function buildRunResultJson({run:e,operation:t,logTail:n}){let r=isSucceeded(e),i={ok:r,operation:t,actor:{id:e.actId,url:actorUrl(e.actId)},run:{id:e.id,status:e.status,url:runUrl(e.actId,e.id)},storage:{defaultDatasetId:e.defaultDatasetId,defaultKeyValueStoreId:e.defaultKeyValueStoreId,datasetUrl:datasetUrl(e.defaultDatasetId)},exitCode:getRunExitCode(e)};return r||(i.error={phase:`run`,message:e.statusMessage||genericReason(e),logTail:n}),i}function printRunResultSummary({run:e,operation:n,logTail:r}){let i=isSucceeded(e),a=i?t.gree ...
90`),stdout:!0})}async function finalizeRun({apifyClient:t,run:n,operation:r,json:i,silent:a}){if(e.exitCode=getRunExitCode(n),a)return;let s=await fetchRunLogTail(t,n);if(i){printJsonToStdout(
91Reads input from local key-value store by default.
92To inspect the input schema before creating a JSON input, use "apify actors info <actor> --input".`;static group=`Apify Console`;static examples=[{description:`Call the Actor defined in the current directory (from .actor/actor.json).`,command:`apify call`},{description:`Call a specific Actor by its full name.`,command:`apify call apify/hello-world`},{description:`Inspect the Actor input schema before preparing JSON input.`,command:`apify actors info apify/hello-world --input`},{description:`Call an Actor with inline JSON input.`,command:`apify call apify/hello-world --input '{"url":"https://ex ...
93`),stdout:!this.flags.json})}if(await finalizeRun({apifyClient:i,run:h,operation:`call`,json:this.flags.json,silent:this.flags.silent}),!this.flags.json&&this.flags.outputDataset&&h.status===N.SUCCEEDED){let e=h.defaultDatasetId,t,n=4;do{if(t=await i.dataset(e).get(),t?.itemCount)break;await new Promise
94`);r.splice(1,1),u.push(r.join(`
95`));break}case`FREE`:u.push(`${t.yellow(`Pricing information:`)} ${t.bgGray(`Pay for usage`)}`);break;default:{let n=e.pricingModel;u.push(`${t.yellow(`Pricing information:`)} ${t.bgGray(`Unknown pricing model (${t.yellow(n)})`)}`
96`),stdout:!0})}};function prettyPrintStatus(e){switch(e){case`READY`:return t.green(`Ready`);case`RUNNING`:return t.blue(`Running`);case`SUCCEEDED`:return t.green(`Succeeded`);case`FAILED`:return t.red(`Failed`);case`ABORTING`:return t.yellow(`Aborting`);case`ABORTED`:return t.red(`Aborted`);case`TIMING-OUT`:return t.yellow(`Timing Out`);case`TIMED-OUT`:return t.red(`Timed Out`);default:return t.gray(e.split(`-`).map(e=>e[0].toUpperCase()+e.slice(1).toLowerCase()).join(` `))}}const sr={"TIMED-OUT":t.gray(`after`),"TIMING-OUT":t.gray(`after
97`,t.gray(`${K.format(r)} ago`)):n.push(`
98`,t.gray(`On`,On.display(e.lastRun.finishedAt)))}return n.join(` `)}return``})();u.pushRow({Name:`${e.title}\n${t.gray(`${e.username}/${e.name}`)}`,Runs:Q.isSmallTerminal()&&f>=56?ir:
99`);if(n)for(let e of i)warning({message:`Value for ${e} not found in local secrets. Set it by calling "apify secrets add ${e} [SECRET_VALUE]"`});else throw Error(`The following secrets are missing:\n${e}\n\nSet them by calling "apify secrets add <SECRET_NAME> <SECRET_VALUE>" for each missing secret.
100If you want to skip missing secrets, run the command with the --allow-missing-secrets flag.`)}return r},transformEnvToEnvVars=(e,t,{allowMissing:n=!1}={})=>{t||=getSecretsFile();let r=[],i=[];if(Object.keys(e).forEach(n=>{if(isSecretKey(e[n])){let a=e[n].replace(RegExp(`^@`),``);t[a]?r.push({name:n,value:t[a],isSecret:!0}):i.push(a)}else r.push({name:n,value:e[n]})}),i.length>0){let e=i.map(e=>` - ${e}`).join(`
101`);if(n)for(let e of i)warning({message:`Value for ${e} not found in local secrets. Set it by calling "apify secrets add ${e} [SECRET_VALUE]"`});else throw Error(`The following secrets are missing:\n${e}\n\nSet them by calling "apify secrets add <SECRET_NAME> <SECRET_VALUE>" for each missing secret.
102If you want to skip missing secrets, run the command with the --allow-missing-secrets flag.`)}return r},dr=`temp_file.zip`,fr={build:`latest`,memoryMbytes:4096,timeoutSecs:3600};function resolvePushOutcome(e){switch(e){case N.SUCCEEDED:return{resultLabel:`SUCCEEDED`,exitCode:0,ok:!0};case N.READY:return{resultLabel:`PENDING`,ok:!0};case N.RUNNING:return{resultLabel:`RUNNING`,ok:!0};case N.ABORTING:return{resultLabel:`ABORTING`,exitCode:3,ok:!1,errorMessage:`Build is aborting`};case N.ABORTED:return{resultLabel:`ABORTED`,exitCode:3,ok:!1,errorMessage:`Build aborted`};case N.TIMING_OUT:return{re ...
103Files matched by .gitignore and .actorignore are excluded. Use negation patterns (e.g. !dist/) in .actorignore to force-include git-ignored files.
104Use --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:Y.string({char:`v`,description:`Actor version number to ...
105`)}),e.exitCode=4;return}let i=await getLoggedClientOrThrow(),a=await useActorConfig({cwd:n});if(a.isErr()){error({message:a.unwrapErr().message}),e.exitCode=5;return}let{config:s}=a.unwrap(),c=await getLocalUserInfo(),l=c.organizationOwnerUserId?`/organization/${c.id}`:``,
106Skipping push. Use --force to override.`)}x=await createSourceFiles(r,n),b=me.SOURCE_FILES}else{run({message:`Zipping Actor files`}),await createActZip(dr,r,n);let e=await i.keyValueStores().getOrCreate(`actor-${u}-source`),t=`version-${m}.zip`,a=S(dr);await i.keyValueStore(e.id).setRecord({key:t,value:a,contentType:`application/zip`}),ne(dr);let s=new URL(`${i.baseUrl}/key-value-stores/${e.id}/records/${t}?disableRedirect=true`);if(e?.urlSigningSecretKey){let n=Ce(e.urlSigningSecretKey,t);s.searchParams.set(`signature`,n)}C=s.toString(),b=me.TARBALL}let ee=await v.version(m).get(),te=s.enviro ...
107`).map(e=>e.trimEnd()).filter(e=>e.length>0).slice(-10))}catch{}O.exitCode&&(e.exitCode=O.exitCode);let oe={ok:O.ok,operation:`push`,actor:{id:E.actId,url:ie},build:{id:E.id,number:E.buildNumber,status:re,url:ae}};if(O.exitCode!==void 0
108`)}),this.flags.open&&await Ot(ie)}catch(e){t.e=e}finally{t.d()}}},ActorsRmCommand=class extends ApifyCommand{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
110Searches the Apify Store for Actors matching the given query. Results can be filtered by category, author, pricing model, and more. This command does not
111Uses authenticated account and local key-value store for input.`;static examples=[{description:`Start the Actor defined in the current directory and return immediately.`,command:`apify actors start`},{description:`
112`),stdout:!0})}},ActorsIndexCommand=class extends ApifyCommand{static name=`actors`;static description=`Search, list, deploy, and call Actors on the Apify platform.
113For runtime operations inside a running Actor (push-data, get-input, set-value...), see 'apify actor' (singular).`;static group=`Apify Console`;static docsUrl=`https://docs.apify.com/cli/docs/reference#apify-actors`;static subcommands=[ActorsStartCommand,ActorsRmCommand,ActorsSearchCommand,ActorsPushCommand,ActorsPullCommand,ActorsLsCommand,ActorsInfoCommand,tr,ActorsBuildCommand];async run(){this.printHelp()}};const mr=[`GET`,`POST`,`PUT`,`PATCH`,`DELETE`],hr=new Set([`GET`,`HEAD`]),gr=`https://docs.apify.com/api/openapi.json`;function parseParams(e){if(!e)return``;let t;try{t=JSON.parse(e)}c ...
Long lines were clipped for display.