Skip to content

Commit d1ea61b

Browse files
committed
Fix incomplete type hint of last run/task
Add the argument to one test
1 parent 06bf32b commit d1ea61b

3 files changed

Lines changed: 7 additions & 6 deletions

File tree

src/resource_clients/actor.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -844,6 +844,7 @@ export interface ActorBuildOptions {
844844
*/
845845
export interface ActorLastRunOptions {
846846
status?: keyof typeof ACT_JOB_STATUSES;
847+
origin?: keyof typeof META_ORIGINS;
847848
}
848849

849850
/**

src/resource_clients/task.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { ResourceClient } from '../base/resource_client';
88
import type { ApifyRequestConfig } from '../http_client';
99
import type { Dictionary } from '../utils';
1010
import { cast, catchNotFoundOrThrow, parseDateFields, pluckData, stringifyWebhooksToBase64 } from '../utils';
11-
import type { ActorRun, ActorStandby, ActorStartOptions } from './actor';
11+
import type { ActorLastRunOptions, ActorRun, ActorStandby, ActorStartOptions } from './actor';
1212
import { RunClient } from './run';
1313
import { RunCollectionClient } from './run_collection';
1414
import { WebhookCollectionClient } from './webhook_collection';
@@ -322,9 +322,7 @@ export type TaskUpdateData = Partial<
322322
/**
323323
* Options for filtering the last run of a Task.
324324
*/
325-
export interface TaskLastRunOptions {
326-
status?: keyof typeof ACT_JOB_STATUSES;
327-
}
325+
export interface TaskLastRunOptions extends ActorLastRunOptions {}
328326

329327
/**
330328
* Options for starting a Task.

test/actors.test.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import express from 'express';
99
import type { Page } from 'puppeteer';
1010
import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, test, vi } from 'vitest';
1111

12-
import { WEBHOOK_EVENT_TYPES } from '@apify/consts';
12+
import { META_ORIGINS, WEBHOOK_EVENT_TYPES } from '@apify/consts';
1313
import { LEVELS, Log } from '@apify/log';
1414

1515
import { stringifyWebhooksToBase64 } from '../src/utils';
@@ -387,7 +387,9 @@ describe('Actor methods', () => {
387387
const actorId = 'some-actor-id';
388388
const requestedStatus = 'SUCCEEDED';
389389

390-
const lastRunClient = client.actor(actorId).lastRun({ status: requestedStatus });
390+
const lastRunClient = client
391+
.actor(actorId)
392+
.lastRun({ status: requestedStatus, origin: META_ORIGINS.API });
391393
const res = method === 'get' ? await lastRunClient.get() : await lastRunClient[method]().get();
392394

393395
const endpointIdMap = {

0 commit comments

Comments
 (0)