@@ -17,13 +17,7 @@ import { getInputOverride } from '../../lib/commands/resolve-input.js';
1717import { runActorOrTaskOnCloud , SharedRunOnCloudFlags } from '../../lib/commands/run-on-cloud.js' ;
1818import { CommandExitCodes , LOCAL_CONFIG_PATH } from '../../lib/consts.js' ;
1919import { error , simpleLog } from '../../lib/outputs.js' ;
20- import {
21- getLocalConfig ,
22- getLocalUserInfo ,
23- getLoggedClientOrThrow ,
24- printJsonToStdout ,
25- TimestampFormatter ,
26- } from '../../lib/utils.js' ;
20+ import { getLocalConfig , printJsonToStdout , TimestampFormatter } from '../../lib/utils.js' ;
2721
2822export class ActorsCallCommand extends ApifyCommand < typeof ActorsCallCommand > {
2923 static override name = 'call' as const ;
@@ -62,6 +56,7 @@ export class ActorsCallCommand extends ApifyCommand<typeof ActorsCallCommand> {
6256 } ;
6357
6458 static override enableJsonFlag = true ;
59+ static override requiresAuthentication = 'always' as const ;
6560
6661 static override args = {
6762 actorId : Args . string ( {
@@ -75,8 +70,7 @@ export class ActorsCallCommand extends ApifyCommand<typeof ActorsCallCommand> {
7570 async run ( ) {
7671 const cwd = process . cwd ( ) ;
7772 const localConfig = getLocalConfig ( cwd ) || { } ;
78- const apifyClient = await getLoggedClientOrThrow ( ) ;
79- const userInfo = await getLocalUserInfo ( ) ;
73+ const userInfo = await this . apifyClient . user ( ) . get ( ) ;
8074 const usernameOrId = userInfo . username || ( userInfo . id as string ) ;
8175
8276 if ( this . flags . json && this . flags . outputDataset ) {
@@ -91,7 +85,7 @@ export class ActorsCallCommand extends ApifyCommand<typeof ActorsCallCommand> {
9185 userFriendlyId,
9286 actorData,
9387 } = await ActorsCallCommand . resolveActorId ( {
94- client : apifyClient ,
88+ client : this . apifyClient ,
9589 localActorName : localConfig . name as string | undefined ,
9690 usernameOrId,
9791 providedActorNameOrId : this . args . actorId ,
@@ -126,7 +120,7 @@ export class ActorsCallCommand extends ApifyCommand<typeof ActorsCallCommand> {
126120 let url : string ;
127121 let datasetUrl : string ;
128122
129- const iterator = runActorOrTaskOnCloud ( apifyClient , {
123+ const iterator = runActorOrTaskOnCloud ( this . apifyClient , {
130124 actorOrTaskData : {
131125 id : actorId ,
132126 userFriendlyId,
@@ -226,7 +220,7 @@ export class ActorsCallCommand extends ApifyCommand<typeof ActorsCallCommand> {
226220 // Why is this needed? Sometimes, when fetching the dataset info right after the run ends, the object doesn't have the stats up-to-date.
227221 // But sometimes it does!
228222 do {
229- info = ( await apifyClient . dataset ( datasetId ) . get ( ) ) ! ;
223+ info = ( await this . apifyClient . dataset ( datasetId ) . get ( ) ) ! ;
230224
231225 if ( info ?. itemCount ) {
232226 break ;
@@ -237,7 +231,7 @@ export class ActorsCallCommand extends ApifyCommand<typeof ActorsCallCommand> {
237231 } ) ;
238232 } while ( retries -- ) ;
239233
240- const dataset = await apifyClient . dataset ( datasetId ) . downloadItems ( DownloadItemsFormat . JSON , {
234+ const dataset = await this . apifyClient . dataset ( datasetId ) . downloadItems ( DownloadItemsFormat . JSON , {
241235 clean : true ,
242236 } ) ;
243237
0 commit comments