@workers-community/workers-types 4.20260506.1 → 4.20260508.1
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.
- package/index.d.ts +28 -17
- package/index.ts +28 -17
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -13658,28 +13658,16 @@ declare namespace CloudflareWorkersModule {
|
|
|
13658
13658
|
attempt: number;
|
|
13659
13659
|
config: WorkflowStepConfig;
|
|
13660
13660
|
};
|
|
13661
|
-
export interface RollbackContext<T> {
|
|
13662
|
-
error: Error;
|
|
13663
|
-
output: NonNullable<T> | undefined;
|
|
13664
|
-
stepName: string;
|
|
13665
|
-
}
|
|
13666
|
-
export interface StepPromise<T> extends Promise<T> {
|
|
13667
|
-
rollback(fn: (ctx: RollbackContext<T>) => Promise<void>): StepPromise<T>;
|
|
13668
|
-
rollback(
|
|
13669
|
-
config: WorkflowStepConfig,
|
|
13670
|
-
fn: (ctx: RollbackContext<T>) => Promise<void>,
|
|
13671
|
-
): StepPromise<T>;
|
|
13672
|
-
}
|
|
13673
13661
|
export abstract class WorkflowStep {
|
|
13674
13662
|
do<T extends Rpc.Serializable<T>>(
|
|
13675
13663
|
name: string,
|
|
13676
13664
|
callback: (ctx: WorkflowStepContext) => Promise<T>,
|
|
13677
|
-
):
|
|
13665
|
+
): Promise<T>;
|
|
13678
13666
|
do<T extends Rpc.Serializable<T>>(
|
|
13679
13667
|
name: string,
|
|
13680
13668
|
config: WorkflowStepConfig,
|
|
13681
13669
|
callback: (ctx: WorkflowStepContext) => Promise<T>,
|
|
13682
|
-
):
|
|
13670
|
+
): Promise<T>;
|
|
13683
13671
|
sleep: (name: string, duration: WorkflowSleepDuration) => Promise<void>;
|
|
13684
13672
|
sleepUntil: (name: string, timestamp: Date | number) => Promise<void>;
|
|
13685
13673
|
waitForEvent<T extends Rpc.Serializable<T>>(
|
|
@@ -13688,7 +13676,7 @@ declare namespace CloudflareWorkersModule {
|
|
|
13688
13676
|
type: string;
|
|
13689
13677
|
timeout?: WorkflowTimeoutDuration | number;
|
|
13690
13678
|
},
|
|
13691
|
-
):
|
|
13679
|
+
): Promise<WorkflowStepEvent<T>>;
|
|
13692
13680
|
}
|
|
13693
13681
|
export type WorkflowInstanceStatus =
|
|
13694
13682
|
| "queued"
|
|
@@ -15190,6 +15178,27 @@ interface WorkflowError {
|
|
|
15190
15178
|
code?: number;
|
|
15191
15179
|
message: string;
|
|
15192
15180
|
}
|
|
15181
|
+
interface WorkflowInstanceRestartOptions {
|
|
15182
|
+
/**
|
|
15183
|
+
* Restart from a specific step. If omitted, the instance restarts from the beginning.
|
|
15184
|
+
* The step must exist in the instance's execution history.
|
|
15185
|
+
*/
|
|
15186
|
+
from?: {
|
|
15187
|
+
/**
|
|
15188
|
+
* The step name as defined in your workflow code.
|
|
15189
|
+
*/
|
|
15190
|
+
name: string;
|
|
15191
|
+
/**
|
|
15192
|
+
* 1-indexed occurrence of this step name. Use when the same step name appears multiple times (e.g. in a loop).
|
|
15193
|
+
* @default 1
|
|
15194
|
+
*/
|
|
15195
|
+
count?: number;
|
|
15196
|
+
/**
|
|
15197
|
+
* Step type filter. Use when different step types share the same name.
|
|
15198
|
+
*/
|
|
15199
|
+
type?: "do" | "sleep" | "waitForEvent";
|
|
15200
|
+
};
|
|
15201
|
+
}
|
|
15193
15202
|
declare abstract class WorkflowInstance {
|
|
15194
15203
|
public id: string;
|
|
15195
15204
|
/**
|
|
@@ -15205,9 +15214,11 @@ declare abstract class WorkflowInstance {
|
|
|
15205
15214
|
*/
|
|
15206
15215
|
public terminate(): Promise<void>;
|
|
15207
15216
|
/**
|
|
15208
|
-
* Restart the instance.
|
|
15217
|
+
* Restart the instance. Optionally restart from a specific step, preserving
|
|
15218
|
+
* cached results for all steps before it.
|
|
15219
|
+
* @param options Options for the restart, including an optional step to restart from.
|
|
15209
15220
|
*/
|
|
15210
|
-
public restart(): Promise<void>;
|
|
15221
|
+
public restart(options?: WorkflowInstanceRestartOptions): Promise<void>;
|
|
15211
15222
|
/**
|
|
15212
15223
|
* Returns the current status of the instance.
|
|
15213
15224
|
*/
|
package/index.ts
CHANGED
|
@@ -13629,28 +13629,16 @@ export declare namespace CloudflareWorkersModule {
|
|
|
13629
13629
|
attempt: number;
|
|
13630
13630
|
config: WorkflowStepConfig;
|
|
13631
13631
|
};
|
|
13632
|
-
export interface RollbackContext<T> {
|
|
13633
|
-
error: Error;
|
|
13634
|
-
output: NonNullable<T> | undefined;
|
|
13635
|
-
stepName: string;
|
|
13636
|
-
}
|
|
13637
|
-
export interface StepPromise<T> extends Promise<T> {
|
|
13638
|
-
rollback(fn: (ctx: RollbackContext<T>) => Promise<void>): StepPromise<T>;
|
|
13639
|
-
rollback(
|
|
13640
|
-
config: WorkflowStepConfig,
|
|
13641
|
-
fn: (ctx: RollbackContext<T>) => Promise<void>,
|
|
13642
|
-
): StepPromise<T>;
|
|
13643
|
-
}
|
|
13644
13632
|
export abstract class WorkflowStep {
|
|
13645
13633
|
do<T extends Rpc.Serializable<T>>(
|
|
13646
13634
|
name: string,
|
|
13647
13635
|
callback: (ctx: WorkflowStepContext) => Promise<T>,
|
|
13648
|
-
):
|
|
13636
|
+
): Promise<T>;
|
|
13649
13637
|
do<T extends Rpc.Serializable<T>>(
|
|
13650
13638
|
name: string,
|
|
13651
13639
|
config: WorkflowStepConfig,
|
|
13652
13640
|
callback: (ctx: WorkflowStepContext) => Promise<T>,
|
|
13653
|
-
):
|
|
13641
|
+
): Promise<T>;
|
|
13654
13642
|
sleep: (name: string, duration: WorkflowSleepDuration) => Promise<void>;
|
|
13655
13643
|
sleepUntil: (name: string, timestamp: Date | number) => Promise<void>;
|
|
13656
13644
|
waitForEvent<T extends Rpc.Serializable<T>>(
|
|
@@ -13659,7 +13647,7 @@ export declare namespace CloudflareWorkersModule {
|
|
|
13659
13647
|
type: string;
|
|
13660
13648
|
timeout?: WorkflowTimeoutDuration | number;
|
|
13661
13649
|
},
|
|
13662
|
-
):
|
|
13650
|
+
): Promise<WorkflowStepEvent<T>>;
|
|
13663
13651
|
}
|
|
13664
13652
|
export type WorkflowInstanceStatus =
|
|
13665
13653
|
| "queued"
|
|
@@ -15142,6 +15130,27 @@ export interface WorkflowError {
|
|
|
15142
15130
|
code?: number;
|
|
15143
15131
|
message: string;
|
|
15144
15132
|
}
|
|
15133
|
+
export interface WorkflowInstanceRestartOptions {
|
|
15134
|
+
/**
|
|
15135
|
+
* Restart from a specific step. If omitted, the instance restarts from the beginning.
|
|
15136
|
+
* The step must exist in the instance's execution history.
|
|
15137
|
+
*/
|
|
15138
|
+
from?: {
|
|
15139
|
+
/**
|
|
15140
|
+
* The step name as defined in your workflow code.
|
|
15141
|
+
*/
|
|
15142
|
+
name: string;
|
|
15143
|
+
/**
|
|
15144
|
+
* 1-indexed occurrence of this step name. Use when the same step name appears multiple times (e.g. in a loop).
|
|
15145
|
+
* @default 1
|
|
15146
|
+
*/
|
|
15147
|
+
count?: number;
|
|
15148
|
+
/**
|
|
15149
|
+
* Step type filter. Use when different step types share the same name.
|
|
15150
|
+
*/
|
|
15151
|
+
type?: "do" | "sleep" | "waitForEvent";
|
|
15152
|
+
};
|
|
15153
|
+
}
|
|
15145
15154
|
export declare abstract class WorkflowInstance {
|
|
15146
15155
|
public id: string;
|
|
15147
15156
|
/**
|
|
@@ -15157,9 +15166,11 @@ export declare abstract class WorkflowInstance {
|
|
|
15157
15166
|
*/
|
|
15158
15167
|
public terminate(): Promise<void>;
|
|
15159
15168
|
/**
|
|
15160
|
-
* Restart the instance.
|
|
15169
|
+
* Restart the instance. Optionally restart from a specific step, preserving
|
|
15170
|
+
* cached results for all steps before it.
|
|
15171
|
+
* @param options Options for the restart, including an optional step to restart from.
|
|
15161
15172
|
*/
|
|
15162
|
-
public restart(): Promise<void>;
|
|
15173
|
+
public restart(options?: WorkflowInstanceRestartOptions): Promise<void>;
|
|
15163
15174
|
/**
|
|
15164
15175
|
* Returns the current status of the instance.
|
|
15165
15176
|
*/
|