From 38ee296c1cbc1245e5e270a21f66ff5d14c840d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hanu=C5=A1?= Date: Thu, 2 Oct 2025 15:13:17 +0200 Subject: [PATCH 1/7] feat: move restartOnError from Actor to Run options --- src/resource_clients/actor.ts | 4 ++-- src/resource_clients/actor_collection.ts | 1 - src/resource_clients/schedule.ts | 1 + 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/resource_clients/actor.ts b/src/resource_clients/actor.ts index 195c42b0c..9ea896f2f 100644 --- a/src/resource_clients/actor.ts +++ b/src/resource_clients/actor.ts @@ -268,7 +268,6 @@ export interface Actor { name: string; username: string; description?: string; - restartOnError?: boolean; isPublic: boolean; isAnonymouslyRunnable?: boolean; createdAt: Date; @@ -305,6 +304,7 @@ export interface ActorDefaultRunOptions { build: string; timeoutSecs: number; memoryMbytes: number; + restartOnError?: boolean; } export interface ActorExampleRunInput { @@ -330,7 +330,6 @@ export type ActorUpdateOptions = Partial< | 'seoTitle' | 'seoDescription' | 'title' - | 'restartOnError' | 'versions' | 'categories' | 'defaultRunOptions' @@ -486,6 +485,7 @@ export interface ActorRunOptions { memoryMbytes: number; diskMbytes: number; maxTotalChargeUsd?: number; + restartOnError?: boolean; } export interface ActorBuildOptions { diff --git a/src/resource_clients/actor_collection.ts b/src/resource_clients/actor_collection.ts index f5f75d205..02aaf4bed 100644 --- a/src/resource_clients/actor_collection.ts +++ b/src/resource_clients/actor_collection.ts @@ -76,7 +76,6 @@ export interface ActorCollectionCreateOptions { isDeprecated?: boolean; isPublic?: boolean; name?: string; - restartOnError?: boolean; seoTitle?: string; seoDescription?: string; title?: string; diff --git a/src/resource_clients/schedule.ts b/src/resource_clients/schedule.ts index e3a6fc941..52015333c 100644 --- a/src/resource_clients/schedule.ts +++ b/src/resource_clients/schedule.ts @@ -117,6 +117,7 @@ export interface ScheduledActorRunOptions { build: string; timeoutSecs: number; memoryMbytes: number; + restartOnError?: boolean; } export interface ScheduleActionRunActorTask extends BaseScheduleAction { From 3777136a702483fa27f465e49bf3c60921c95b46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hanu=C5=A1?= Date: Fri, 3 Oct 2025 15:27:05 +0200 Subject: [PATCH 2/7] feat: deprecate restartOnError instead of removing it --- src/resource_clients/actor.ts | 7 ++++++- src/resource_clients/actor_collection.ts | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/resource_clients/actor.ts b/src/resource_clients/actor.ts index 9ea896f2f..478bfbb97 100644 --- a/src/resource_clients/actor.ts +++ b/src/resource_clients/actor.ts @@ -268,6 +268,8 @@ export interface Actor { name: string; username: string; description?: string; + /** @deprecated Moved to defaultRunOptions.restartOnError */ + restartOnError?: boolean; isPublic: boolean; isAnonymouslyRunnable?: boolean; createdAt: Date; @@ -334,7 +336,10 @@ export type ActorUpdateOptions = Partial< | 'categories' | 'defaultRunOptions' | 'actorStandby' - > + > & { + /** @deprecated Moved to defaultRunOptions.restartOnError */ + restartOnError?: boolean; + } >; export interface ActorStandby { diff --git a/src/resource_clients/actor_collection.ts b/src/resource_clients/actor_collection.ts index 02aaf4bed..960f838ad 100644 --- a/src/resource_clients/actor_collection.ts +++ b/src/resource_clients/actor_collection.ts @@ -76,6 +76,8 @@ export interface ActorCollectionCreateOptions { isDeprecated?: boolean; isPublic?: boolean; name?: string; + /** @deprecated Moved to defaultRunOptions.restartOnError */ + restartOnError?: boolean; seoTitle?: string; seoDescription?: string; title?: string; From e38d0d8daf48a96d49d056623e59f47d1e08fa46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hanu=C5=A1?= Date: Fri, 3 Oct 2025 16:29:41 +0200 Subject: [PATCH 3/7] chore: better wording of deprecation message --- src/resource_clients/actor.ts | 4 ++-- src/resource_clients/actor_collection.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/resource_clients/actor.ts b/src/resource_clients/actor.ts index 478bfbb97..b24b1e4df 100644 --- a/src/resource_clients/actor.ts +++ b/src/resource_clients/actor.ts @@ -268,7 +268,7 @@ export interface Actor { name: string; username: string; description?: string; - /** @deprecated Moved to defaultRunOptions.restartOnError */ + /** @deprecated Use defaultRunOptions.restartOnError instead */ restartOnError?: boolean; isPublic: boolean; isAnonymouslyRunnable?: boolean; @@ -337,7 +337,7 @@ export type ActorUpdateOptions = Partial< | 'defaultRunOptions' | 'actorStandby' > & { - /** @deprecated Moved to defaultRunOptions.restartOnError */ + /** @deprecated Use defaultRunOptions.restartOnError instead */ restartOnError?: boolean; } >; diff --git a/src/resource_clients/actor_collection.ts b/src/resource_clients/actor_collection.ts index 960f838ad..43ad2656c 100644 --- a/src/resource_clients/actor_collection.ts +++ b/src/resource_clients/actor_collection.ts @@ -76,7 +76,7 @@ export interface ActorCollectionCreateOptions { isDeprecated?: boolean; isPublic?: boolean; name?: string; - /** @deprecated Moved to defaultRunOptions.restartOnError */ + /** @deprecated Use defaultRunOptions.restartOnError instead */ restartOnError?: boolean; seoTitle?: string; seoDescription?: string; From c6a5c355bab4faec1233011c13823939a6bde865 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hanu=C5=A1?= Date: Tue, 7 Oct 2025 13:06:30 +0200 Subject: [PATCH 4/7] feat: add restartOnError option to resurrect run --- src/resource_clients/run.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/resource_clients/run.ts b/src/resource_clients/run.ts index f165c8dfb..0e517a83b 100644 --- a/src/resource_clients/run.ts +++ b/src/resource_clients/run.ts @@ -141,6 +141,7 @@ export class RunClient extends ResourceClient { timeout: ow.optional.number, maxItems: ow.optional.number, maxTotalChargeUsd: ow.optional.number, + restartOnError: ow.optional.boolean, }), ); @@ -291,6 +292,7 @@ export interface RunResurrectOptions { timeout?: number; maxItems?: number; maxTotalChargeUsd?: number; + restartOnError?: boolean; } export interface RunChargeOptions { From ee2acb1165991661668b97af693bad04121ee717 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hanu=C5=A1?= Date: Wed, 8 Oct 2025 16:30:49 +0200 Subject: [PATCH 5/7] feat: add restartOnError to call and start methods for actor and task --- src/resource_clients/actor.ts | 10 +++++++++- src/resource_clients/task.ts | 6 +++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/resource_clients/actor.ts b/src/resource_clients/actor.ts index b24b1e4df..cc48d586c 100644 --- a/src/resource_clients/actor.ts +++ b/src/resource_clients/actor.ts @@ -70,11 +70,12 @@ export class ActorClient extends ResourceClient { webhooks: ow.optional.array.ofType(ow.object), maxItems: ow.optional.number.not.negative, maxTotalChargeUsd: ow.optional.number.not.negative, + restartOnError: ow.optional.boolean, forcePermissionLevel: ow.optional.string.oneOf(Object.values(ACTOR_PERMISSION_LEVEL)), }), ); - const { waitForFinish, timeout, memory, build, maxItems, maxTotalChargeUsd, forcePermissionLevel } = options; + const { waitForFinish, timeout, memory, build, maxItems, maxTotalChargeUsd, restartOnError, forcePermissionLevel } = options; const params = { waitForFinish, @@ -84,6 +85,7 @@ export class ActorClient extends ResourceClient { webhooks: stringifyWebhooksToBase64(options.webhooks), maxItems, maxTotalChargeUsd, + restartOnError, forcePermissionLevel, }; @@ -128,6 +130,7 @@ export class ActorClient extends ResourceClient { webhooks: ow.optional.array.ofType(ow.object), maxItems: ow.optional.number.not.negative, maxTotalChargeUsd: ow.optional.number.not.negative, + restartOnError: ow.optional.boolean, forcePermissionLevel: ow.optional.string.oneOf(Object.values(ACTOR_PERMISSION_LEVEL)), }), ); @@ -400,6 +403,11 @@ export interface ActorStartOptions { */ maxItems?: number; + /** + * Determines whether the run will be restarted if it fails. + */ + restartOnError?: boolean; + // TODO(PPE): add maxTotalChargeUsd after finished /** diff --git a/src/resource_clients/task.ts b/src/resource_clients/task.ts index 438da2fdc..6ef869b59 100644 --- a/src/resource_clients/task.ts +++ b/src/resource_clients/task.ts @@ -63,10 +63,11 @@ export class TaskClient extends ResourceClient { webhooks: ow.optional.array.ofType(ow.object), maxItems: ow.optional.number.not.negative, maxTotalChargeUsd: ow.optional.number.not.negative, + restartOnError: ow.optional.boolean, }), ); - const { waitForFinish, timeout, memory, build, maxItems, maxTotalChargeUsd } = options; + const { waitForFinish, timeout, memory, build, maxItems, maxTotalChargeUsd, restartOnError } = options; const params = { waitForFinish, @@ -76,6 +77,7 @@ export class TaskClient extends ResourceClient { webhooks: stringifyWebhooksToBase64(options.webhooks), maxItems, maxTotalChargeUsd, + restartOnError, }; const request: ApifyRequestConfig = { @@ -112,6 +114,7 @@ export class TaskClient extends ResourceClient { webhooks: ow.optional.array.ofType(ow.object), maxItems: ow.optional.number.not.negative, maxTotalChargeUsd: ow.optional.number.not.negative, + restartOnError: ow.optional.boolean, }), ); @@ -222,6 +225,7 @@ export interface TaskOptions { build?: string; timeoutSecs?: number; memoryMbytes?: number; + restartOnError?: boolean; } export type TaskUpdateData = Partial< From 3f8815f58b9fe066b7a11604c154c0fc954d0ac7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hanu=C5=A1?= Date: Thu, 9 Oct 2025 14:19:32 +0200 Subject: [PATCH 6/7] fix: have restartOnError directly in the ActorUpdateOptions --- src/resource_clients/actor.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/resource_clients/actor.ts b/src/resource_clients/actor.ts index cc48d586c..67881e311 100644 --- a/src/resource_clients/actor.ts +++ b/src/resource_clients/actor.ts @@ -335,14 +335,12 @@ export type ActorUpdateOptions = Partial< | 'seoTitle' | 'seoDescription' | 'title' + | 'restartOnError' | 'versions' | 'categories' | 'defaultRunOptions' | 'actorStandby' - > & { - /** @deprecated Use defaultRunOptions.restartOnError instead */ - restartOnError?: boolean; - } + > >; export interface ActorStandby { From 7963a0abc39edb5aa9ce8fa81e24645b57a58c70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hanu=C5=A1?= Date: Mon, 20 Oct 2025 13:59:28 +0200 Subject: [PATCH 7/7] fix: prettier issues --- src/resource_clients/actor.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/resource_clients/actor.ts b/src/resource_clients/actor.ts index 67881e311..919ce30f6 100644 --- a/src/resource_clients/actor.ts +++ b/src/resource_clients/actor.ts @@ -75,7 +75,16 @@ export class ActorClient extends ResourceClient { }), ); - const { waitForFinish, timeout, memory, build, maxItems, maxTotalChargeUsd, restartOnError, forcePermissionLevel } = options; + const { + waitForFinish, + timeout, + memory, + build, + maxItems, + maxTotalChargeUsd, + restartOnError, + forcePermissionLevel, + } = options; const params = { waitForFinish,