@workers-community/workers-types 4.20260507.1 → 4.20260509.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.
Files changed (3) hide show
  1. package/index.d.ts +25 -2
  2. package/index.ts +25 -2
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -15178,6 +15178,27 @@ interface WorkflowError {
15178
15178
  code?: number;
15179
15179
  message: string;
15180
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
+ }
15181
15202
  declare abstract class WorkflowInstance {
15182
15203
  public id: string;
15183
15204
  /**
@@ -15193,9 +15214,11 @@ declare abstract class WorkflowInstance {
15193
15214
  */
15194
15215
  public terminate(): Promise<void>;
15195
15216
  /**
15196
- * 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.
15197
15220
  */
15198
- public restart(): Promise<void>;
15221
+ public restart(options?: WorkflowInstanceRestartOptions): Promise<void>;
15199
15222
  /**
15200
15223
  * Returns the current status of the instance.
15201
15224
  */
package/index.ts CHANGED
@@ -15130,6 +15130,27 @@ export interface WorkflowError {
15130
15130
  code?: number;
15131
15131
  message: string;
15132
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
+ }
15133
15154
  export declare abstract class WorkflowInstance {
15134
15155
  public id: string;
15135
15156
  /**
@@ -15145,9 +15166,11 @@ export declare abstract class WorkflowInstance {
15145
15166
  */
15146
15167
  public terminate(): Promise<void>;
15147
15168
  /**
15148
- * 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.
15149
15172
  */
15150
- public restart(): Promise<void>;
15173
+ public restart(options?: WorkflowInstanceRestartOptions): Promise<void>;
15151
15174
  /**
15152
15175
  * Returns the current status of the instance.
15153
15176
  */
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  },
8
8
  "author": "Workers Community",
9
9
  "license": "MIT OR Apache-2.0",
10
- "version": "4.20260507.1",
10
+ "version": "4.20260509.1",
11
11
  "exports": {
12
12
  ".": {
13
13
  "types": "./index.d.ts",