@cloudflare/workers-types 5.20261001.1 → 5.20261003.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.
@@ -606,6 +606,7 @@ interface CachePurgeOptions {
606
606
  }
607
607
  interface CacheContext {
608
608
  purge(options: CachePurgeOptions): Promise<CachePurgeResult>;
609
+ invalidate(options: CachePurgeOptions): Promise<CachePurgeResult>;
609
610
  }
610
611
  interface CloudflareAccessContext {
611
612
  readonly aud: string;
@@ -18499,10 +18500,18 @@ declare abstract class Workflow<PARAMS = unknown> {
18499
18500
  options?: WorkflowInstanceCreateOptions<PARAMS>,
18500
18501
  ): Promise<WorkflowInstance>;
18501
18502
  /**
18502
- * Create a batch of instances and return handle for all of them. If a provided id exists, an error will be thrown.
18503
+ * Create a batch of instances and return handles for the created instances and any per-instance errors.
18503
18504
  * `createBatch` is limited at 100 instances at a time or when the RPC limit for the batch (1MiB) is reached.
18504
- * @param batch List of Options when creating an instance including name and params
18505
- * @returns A promise that resolves with a list of handles for the created instances.
18505
+ * @param options Options for creating instances by count or from a list of instance options
18506
+ * @returns A promise that resolves with the created instance handles and any per-instance errors.
18507
+ */
18508
+ public createBatch(
18509
+ options: WorkflowBatchCreateOptions<PARAMS>,
18510
+ ): Promise<WorkflowBatchCreateResult>;
18511
+ /**
18512
+ * Create a batch of instances and return handles for the ones that were created.
18513
+ * Instances that could not be created, for example because their ID already exists, are omitted from the result without an error.
18514
+ * @deprecated Use the object form of `createBatch` instead of the array form.
18506
18515
  */
18507
18516
  public createBatch(
18508
18517
  batch: WorkflowInstanceCreateOptions<PARAMS>[],
@@ -18516,6 +18525,33 @@ declare abstract class Workflow<PARAMS = unknown> {
18516
18525
  */
18517
18526
  public deleteBatch(instanceIds: string[]): Promise<WorkflowBatchDeleteResult>;
18518
18527
  }
18528
+ type WorkflowBatchCreateOptions<PARAMS = unknown> =
18529
+ | {
18530
+ count: number;
18531
+ params?: PARAMS;
18532
+ retention?: {
18533
+ successRetention?: WorkflowRetentionDuration;
18534
+ errorRetention?: WorkflowRetentionDuration;
18535
+ };
18536
+ locationHint?: WorkflowInstanceLocationHint;
18537
+ instances?: never;
18538
+ }
18539
+ | {
18540
+ instances: WorkflowInstanceCreateOptions<PARAMS>[];
18541
+ count?: never;
18542
+ params?: never;
18543
+ retention?: never;
18544
+ locationHint?: never;
18545
+ };
18546
+ type WorkflowBatchCreateResult = {
18547
+ created: WorkflowInstance[];
18548
+ errors: {
18549
+ index: number;
18550
+ id?: string;
18551
+ code: number;
18552
+ message: string;
18553
+ }[];
18554
+ };
18519
18555
  type WorkflowBatchDeleteResult = {
18520
18556
  deleted: {
18521
18557
  id: string;
@@ -608,6 +608,7 @@ export interface CachePurgeOptions {
608
608
  }
609
609
  export interface CacheContext {
610
610
  purge(options: CachePurgeOptions): Promise<CachePurgeResult>;
611
+ invalidate(options: CachePurgeOptions): Promise<CachePurgeResult>;
611
612
  }
612
613
  export interface CloudflareAccessContext {
613
614
  readonly aud: string;
@@ -18399,10 +18400,18 @@ export declare abstract class Workflow<PARAMS = unknown> {
18399
18400
  options?: WorkflowInstanceCreateOptions<PARAMS>,
18400
18401
  ): Promise<WorkflowInstance>;
18401
18402
  /**
18402
- * Create a batch of instances and return handle for all of them. If a provided id exists, an error will be thrown.
18403
+ * Create a batch of instances and return handles for the created instances and any per-instance errors.
18403
18404
  * `createBatch` is limited at 100 instances at a time or when the RPC limit for the batch (1MiB) is reached.
18404
- * @param batch List of Options when creating an instance including name and params
18405
- * @returns A promise that resolves with a list of handles for the created instances.
18405
+ * @param options Options for creating instances by count or from a list of instance options
18406
+ * @returns A promise that resolves with the created instance handles and any per-instance errors.
18407
+ */
18408
+ public createBatch(
18409
+ options: WorkflowBatchCreateOptions<PARAMS>,
18410
+ ): Promise<WorkflowBatchCreateResult>;
18411
+ /**
18412
+ * Create a batch of instances and return handles for the ones that were created.
18413
+ * Instances that could not be created, for example because their ID already exists, are omitted from the result without an error.
18414
+ * @deprecated Use the object form of `createBatch` instead of the array form.
18406
18415
  */
18407
18416
  public createBatch(
18408
18417
  batch: WorkflowInstanceCreateOptions<PARAMS>[],
@@ -18416,6 +18425,33 @@ export declare abstract class Workflow<PARAMS = unknown> {
18416
18425
  */
18417
18426
  public deleteBatch(instanceIds: string[]): Promise<WorkflowBatchDeleteResult>;
18418
18427
  }
18428
+ export type WorkflowBatchCreateOptions<PARAMS = unknown> =
18429
+ | {
18430
+ count: number;
18431
+ params?: PARAMS;
18432
+ retention?: {
18433
+ successRetention?: WorkflowRetentionDuration;
18434
+ errorRetention?: WorkflowRetentionDuration;
18435
+ };
18436
+ locationHint?: WorkflowInstanceLocationHint;
18437
+ instances?: never;
18438
+ }
18439
+ | {
18440
+ instances: WorkflowInstanceCreateOptions<PARAMS>[];
18441
+ count?: never;
18442
+ params?: never;
18443
+ retention?: never;
18444
+ locationHint?: never;
18445
+ };
18446
+ export type WorkflowBatchCreateResult = {
18447
+ created: WorkflowInstance[];
18448
+ errors: {
18449
+ index: number;
18450
+ id?: string;
18451
+ code: number;
18452
+ message: string;
18453
+ }[];
18454
+ };
18419
18455
  export type WorkflowBatchDeleteResult = {
18420
18456
  deleted: {
18421
18457
  id: string;
package/index.d.ts CHANGED
@@ -609,6 +609,7 @@ interface CachePurgeOptions {
609
609
  }
610
610
  interface CacheContext {
611
611
  purge(options: CachePurgeOptions): Promise<CachePurgeResult>;
612
+ invalidate(options: CachePurgeOptions): Promise<CachePurgeResult>;
612
613
  }
613
614
  interface CloudflareAccessContext {
614
615
  readonly aud: string;
@@ -18159,10 +18160,18 @@ declare abstract class Workflow<PARAMS = unknown> {
18159
18160
  options?: WorkflowInstanceCreateOptions<PARAMS>,
18160
18161
  ): Promise<WorkflowInstance>;
18161
18162
  /**
18162
- * Create a batch of instances and return handle for all of them. If a provided id exists, an error will be thrown.
18163
+ * Create a batch of instances and return handles for the created instances and any per-instance errors.
18163
18164
  * `createBatch` is limited at 100 instances at a time or when the RPC limit for the batch (1MiB) is reached.
18164
- * @param batch List of Options when creating an instance including name and params
18165
- * @returns A promise that resolves with a list of handles for the created instances.
18165
+ * @param options Options for creating instances by count or from a list of instance options
18166
+ * @returns A promise that resolves with the created instance handles and any per-instance errors.
18167
+ */
18168
+ public createBatch(
18169
+ options: WorkflowBatchCreateOptions<PARAMS>,
18170
+ ): Promise<WorkflowBatchCreateResult>;
18171
+ /**
18172
+ * Create a batch of instances and return handles for the ones that were created.
18173
+ * Instances that could not be created, for example because their ID already exists, are omitted from the result without an error.
18174
+ * @deprecated Use the object form of `createBatch` instead of the array form.
18166
18175
  */
18167
18176
  public createBatch(
18168
18177
  batch: WorkflowInstanceCreateOptions<PARAMS>[],
@@ -18176,6 +18185,33 @@ declare abstract class Workflow<PARAMS = unknown> {
18176
18185
  */
18177
18186
  public deleteBatch(instanceIds: string[]): Promise<WorkflowBatchDeleteResult>;
18178
18187
  }
18188
+ type WorkflowBatchCreateOptions<PARAMS = unknown> =
18189
+ | {
18190
+ count: number;
18191
+ params?: PARAMS;
18192
+ retention?: {
18193
+ successRetention?: WorkflowRetentionDuration;
18194
+ errorRetention?: WorkflowRetentionDuration;
18195
+ };
18196
+ locationHint?: WorkflowInstanceLocationHint;
18197
+ instances?: never;
18198
+ }
18199
+ | {
18200
+ instances: WorkflowInstanceCreateOptions<PARAMS>[];
18201
+ count?: never;
18202
+ params?: never;
18203
+ retention?: never;
18204
+ locationHint?: never;
18205
+ };
18206
+ type WorkflowBatchCreateResult = {
18207
+ created: WorkflowInstance[];
18208
+ errors: {
18209
+ index: number;
18210
+ id?: string;
18211
+ code: number;
18212
+ message: string;
18213
+ }[];
18214
+ };
18179
18215
  type WorkflowBatchDeleteResult = {
18180
18216
  deleted: {
18181
18217
  id: string;
package/index.ts CHANGED
@@ -611,6 +611,7 @@ export interface CachePurgeOptions {
611
611
  }
612
612
  export interface CacheContext {
613
613
  purge(options: CachePurgeOptions): Promise<CachePurgeResult>;
614
+ invalidate(options: CachePurgeOptions): Promise<CachePurgeResult>;
614
615
  }
615
616
  export interface CloudflareAccessContext {
616
617
  readonly aud: string;
@@ -18059,10 +18060,18 @@ export declare abstract class Workflow<PARAMS = unknown> {
18059
18060
  options?: WorkflowInstanceCreateOptions<PARAMS>,
18060
18061
  ): Promise<WorkflowInstance>;
18061
18062
  /**
18062
- * Create a batch of instances and return handle for all of them. If a provided id exists, an error will be thrown.
18063
+ * Create a batch of instances and return handles for the created instances and any per-instance errors.
18063
18064
  * `createBatch` is limited at 100 instances at a time or when the RPC limit for the batch (1MiB) is reached.
18064
- * @param batch List of Options when creating an instance including name and params
18065
- * @returns A promise that resolves with a list of handles for the created instances.
18065
+ * @param options Options for creating instances by count or from a list of instance options
18066
+ * @returns A promise that resolves with the created instance handles and any per-instance errors.
18067
+ */
18068
+ public createBatch(
18069
+ options: WorkflowBatchCreateOptions<PARAMS>,
18070
+ ): Promise<WorkflowBatchCreateResult>;
18071
+ /**
18072
+ * Create a batch of instances and return handles for the ones that were created.
18073
+ * Instances that could not be created, for example because their ID already exists, are omitted from the result without an error.
18074
+ * @deprecated Use the object form of `createBatch` instead of the array form.
18066
18075
  */
18067
18076
  public createBatch(
18068
18077
  batch: WorkflowInstanceCreateOptions<PARAMS>[],
@@ -18076,6 +18085,33 @@ export declare abstract class Workflow<PARAMS = unknown> {
18076
18085
  */
18077
18086
  public deleteBatch(instanceIds: string[]): Promise<WorkflowBatchDeleteResult>;
18078
18087
  }
18088
+ export type WorkflowBatchCreateOptions<PARAMS = unknown> =
18089
+ | {
18090
+ count: number;
18091
+ params?: PARAMS;
18092
+ retention?: {
18093
+ successRetention?: WorkflowRetentionDuration;
18094
+ errorRetention?: WorkflowRetentionDuration;
18095
+ };
18096
+ locationHint?: WorkflowInstanceLocationHint;
18097
+ instances?: never;
18098
+ }
18099
+ | {
18100
+ instances: WorkflowInstanceCreateOptions<PARAMS>[];
18101
+ count?: never;
18102
+ params?: never;
18103
+ retention?: never;
18104
+ locationHint?: never;
18105
+ };
18106
+ export type WorkflowBatchCreateResult = {
18107
+ created: WorkflowInstance[];
18108
+ errors: {
18109
+ index: number;
18110
+ id?: string;
18111
+ code: number;
18112
+ message: string;
18113
+ }[];
18114
+ };
18079
18115
  export type WorkflowBatchDeleteResult = {
18080
18116
  deleted: {
18081
18117
  id: string;
package/package.json CHANGED
@@ -7,5 +7,5 @@
7
7
  },
8
8
  "author": "Cloudflare Workers DevProd Team <workers-devprod@cloudflare.com> (https://workers.cloudflare.com)",
9
9
  "license": "MIT OR Apache-2.0",
10
- "version": "5.20261001.1"
10
+ "version": "5.20261003.1"
11
11
  }