@cloudflare/workers-types 4.20240815.0 → 4.20240903.0

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.
@@ -235,6 +235,7 @@ interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
235
235
  caches: CacheStorage;
236
236
  scheduler: Scheduler;
237
237
  performance: Performance;
238
+ Cloudflare: Cloudflare;
238
239
  readonly origin: string;
239
240
  Event: typeof Event;
240
241
  ExtendableEvent: typeof ExtendableEvent;
@@ -386,6 +387,7 @@ declare const scheduler: Scheduler;
386
387
  * [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/)
387
388
  */
388
389
  declare const performance: Performance;
390
+ declare const Cloudflare: Cloudflare;
389
391
  declare const origin: string;
390
392
  declare const navigator: Navigator;
391
393
  interface TestController {}
@@ -476,6 +478,9 @@ interface AlarmInvocationInfo {
476
478
  readonly isRetry: boolean;
477
479
  readonly retryCount: number;
478
480
  }
481
+ interface Cloudflare {
482
+ readonly compatibilityFlags: Record<string, boolean>;
483
+ }
479
484
  interface DurableObject {
480
485
  fetch(request: Request): Response | Promise<Response>;
481
486
  alarm?(): void | Promise<void>;
@@ -2266,15 +2271,15 @@ declare class TransformStream<I = any, O = any> {
2266
2271
  }
2267
2272
  declare class FixedLengthStream extends IdentityTransformStream {
2268
2273
  constructor(
2269
- expectedLength: number | bigint,
2270
- queuingStrategy?: IdentityTransformStreamQueuingStrategy,
2274
+ param1: number | bigint,
2275
+ param2?: IdentityTransformStreamQueuingStrategy,
2271
2276
  );
2272
2277
  }
2273
2278
  declare class IdentityTransformStream extends TransformStream<
2274
2279
  ArrayBuffer | ArrayBufferView,
2275
2280
  Uint8Array
2276
2281
  > {
2277
- constructor(queuingStrategy?: IdentityTransformStreamQueuingStrategy);
2282
+ constructor(param1?: IdentityTransformStreamQueuingStrategy);
2278
2283
  }
2279
2284
  interface IdentityTransformStreamQueuingStrategy {
2280
2285
  highWaterMark?: number | bigint;
@@ -2306,7 +2311,7 @@ declare class TextDecoderStream extends TransformStream<
2306
2311
  ArrayBuffer | ArrayBufferView,
2307
2312
  string
2308
2313
  > {
2309
- constructor(label?: string, options?: TextDecoderStreamTextDecoderStreamInit);
2314
+ constructor(param1?: string, param2?: TextDecoderStreamTextDecoderStreamInit);
2310
2315
  get encoding(): string;
2311
2316
  get fatal(): boolean;
2312
2317
  get ignoreBOM(): boolean;
@@ -2520,13 +2525,13 @@ declare class URL {
2520
2525
  /*function toString() { [native code] }*/
2521
2526
  toString(): string;
2522
2527
  /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/canParse_static) */
2523
- static canParse(url: string, base?: string): boolean;
2524
- static parse(url: string, base?: string): URL | null;
2528
+ static canParse(param0: string, param1?: string): boolean;
2529
+ static parse(param1: string, param2?: string): URL | null;
2525
2530
  }
2526
2531
  /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams) */
2527
2532
  declare class URLSearchParams {
2528
2533
  constructor(
2529
- init?: Iterable<Iterable<string>> | Record<string, string> | string,
2534
+ param0?: Iterable<Iterable<string>> | Record<string, string> | string,
2530
2535
  );
2531
2536
  /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/size) */
2532
2537
  get size(): number;
@@ -2535,7 +2540,7 @@ declare class URLSearchParams {
2535
2540
  *
2536
2541
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/append)
2537
2542
  */
2538
- append(name: string, value: string): void;
2543
+ append(param0: string, param1: string): void;
2539
2544
  /**
2540
2545
  * Deletes the given search parameter, and its associated value, from the list of all search parameters.
2541
2546
  *
@@ -2547,13 +2552,13 @@ declare class URLSearchParams {
2547
2552
  *
2548
2553
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/get)
2549
2554
  */
2550
- get(name: string): string | null;
2555
+ get(param0: string): string | null;
2551
2556
  /**
2552
2557
  * Returns all the values association with a given search parameter.
2553
2558
  *
2554
2559
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/getAll)
2555
2560
  */
2556
- getAll(name: string): string[];
2561
+ getAll(param0: string): string[];
2557
2562
  /**
2558
2563
  * Returns a Boolean indicating if such a search parameter exists.
2559
2564
  *
@@ -2565,7 +2570,7 @@ declare class URLSearchParams {
2565
2570
  *
2566
2571
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/set)
2567
2572
  */
2568
- set(name: string, value: string): void;
2573
+ set(param0: string, param1: string): void;
2569
2574
  /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/sort) */
2570
2575
  sort(): void;
2571
2576
  /* Returns an array of key, value pairs for every entry in the search params. */
@@ -4935,6 +4940,18 @@ type PagesPluginFunction<
4935
4940
  declare module "assets:*" {
4936
4941
  export const onRequest: PagesFunction;
4937
4942
  }
4943
+ // Copyright (c) 2022-2023 Cloudflare, Inc.
4944
+ // Licensed under the Apache 2.0 license found in the LICENSE file or at:
4945
+ // https://opensource.org/licenses/Apache-2.0
4946
+ declare abstract class PipelineTransform {
4947
+ /**
4948
+ * transformJson recieves an array of javascript objects which can be
4949
+ * mutated and returned to the pipeline
4950
+ * @param data The data to be mutated
4951
+ * @returns A promise containing the mutated data
4952
+ */
4953
+ public transformJson(data: object[]): Promise<object[]>;
4954
+ }
4938
4955
  // PubSubMessage represents an incoming PubSub message.
4939
4956
  // The message includes metadata about the broker, the client, and the payload
4940
4957
  // itself.
@@ -5181,7 +5198,7 @@ declare module "cloudflare:workers" {
5181
5198
  ): void | Promise<void>;
5182
5199
  webSocketError?(ws: WebSocket, error: unknown): void | Promise<void>;
5183
5200
  }
5184
- export type DurationLabel =
5201
+ export type WorkflowDurationLabel =
5185
5202
  | "second"
5186
5203
  | "minute"
5187
5204
  | "hour"
@@ -5189,13 +5206,32 @@ declare module "cloudflare:workers" {
5189
5206
  | "week"
5190
5207
  | "month"
5191
5208
  | "year";
5192
- export type SleepDuration = `${number} ${DurationLabel}${"s" | ""}` | number;
5193
- type WorkflowStep = {
5209
+ export type WorkflowSleepDuration =
5210
+ | `${number} ${WorkflowDurationLabel}${"s" | ""}`
5211
+ | number;
5212
+ export type WorkflowBackoff = "constant" | "linear" | "exponential";
5213
+ export type WorkflowStepConfig = {
5214
+ retries?: {
5215
+ limit: number;
5216
+ delay: string | number;
5217
+ backoff?: WorkflowBackoff;
5218
+ };
5219
+ timeout?: string | number;
5220
+ };
5221
+ export type WorkflowEvent<T> = {
5222
+ payload: T;
5223
+ timestamp: Date;
5224
+ };
5225
+ export type WorkflowStep = {
5194
5226
  do: <T extends Rpc.Serializable>(
5195
5227
  name: string,
5196
- callback: () => T,
5197
- ) => T | Promise<T>;
5198
- sleep: (name: string, duration: SleepDuration) => void | Promise<void>;
5228
+ callback: () => Promise<T>,
5229
+ config?: WorkflowStepConfig,
5230
+ ) => Promise<T>;
5231
+ sleep: (
5232
+ name: string,
5233
+ duration: WorkflowSleepDuration,
5234
+ ) => void | Promise<void>;
5199
5235
  };
5200
5236
  export abstract class Workflow<
5201
5237
  Env = unknown,
@@ -5205,13 +5241,7 @@ declare module "cloudflare:workers" {
5205
5241
  [Rpc.__WORKFLOW_BRAND]: never;
5206
5242
  protected ctx: ExecutionContext;
5207
5243
  protected env: Env;
5208
- run(
5209
- events: Array<{
5210
- payload: T;
5211
- timestamp: Date;
5212
- }>,
5213
- step: WorkflowStep,
5214
- ): unknown | Promise<unknown>;
5244
+ run(events: Array<WorkflowEvent<T>>, step: WorkflowStep): Promise<unknown>;
5215
5245
  }
5216
5246
  }
5217
5247
  declare module "cloudflare:sockets" {
@@ -5274,13 +5304,11 @@ type VectorizeDistanceMetric = "euclidean" | "cosine" | "dot-product";
5274
5304
  * @property none No indexed metadata will be returned.
5275
5305
  */
5276
5306
  type VectorizeMetadataRetrievalLevel = "all" | "indexed" | "none";
5277
- interface VectorizeQueryOptions<
5278
- MetadataReturn extends boolean | VectorizeMetadataRetrievalLevel = boolean,
5279
- > {
5307
+ interface VectorizeQueryOptions {
5280
5308
  topK?: number;
5281
5309
  namespace?: string;
5282
5310
  returnValues?: boolean;
5283
- returnMetadata?: MetadataReturn;
5311
+ returnMetadata?: boolean | VectorizeMetadataRetrievalLevel;
5284
5312
  filter?: VectorizeVectorMetadataFilter;
5285
5313
  }
5286
5314
  /**
@@ -5394,7 +5422,7 @@ declare abstract class VectorizeIndex {
5394
5422
  */
5395
5423
  public query(
5396
5424
  vector: VectorFloatArray | number[],
5397
- options: VectorizeQueryOptions,
5425
+ options?: VectorizeQueryOptions,
5398
5426
  ): Promise<VectorizeMatches>;
5399
5427
  /**
5400
5428
  * Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.
@@ -5440,7 +5468,7 @@ declare abstract class Vectorize {
5440
5468
  */
5441
5469
  public query(
5442
5470
  vector: VectorFloatArray | number[],
5443
- options: VectorizeQueryOptions<VectorizeMetadataRetrievalLevel>,
5471
+ options?: VectorizeQueryOptions,
5444
5472
  ): Promise<VectorizeMatches>;
5445
5473
  /**
5446
5474
  * Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.
@@ -235,6 +235,7 @@ export interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
235
235
  caches: CacheStorage;
236
236
  scheduler: Scheduler;
237
237
  performance: Performance;
238
+ Cloudflare: Cloudflare;
238
239
  readonly origin: string;
239
240
  Event: typeof Event;
240
241
  ExtendableEvent: typeof ExtendableEvent;
@@ -388,6 +389,7 @@ export declare const scheduler: Scheduler;
388
389
  * [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/)
389
390
  */
390
391
  export declare const performance: Performance;
392
+ export declare const Cloudflare: Cloudflare;
391
393
  export declare const origin: string;
392
394
  export declare const navigator: Navigator;
393
395
  export interface TestController {}
@@ -481,6 +483,9 @@ export interface AlarmInvocationInfo {
481
483
  readonly isRetry: boolean;
482
484
  readonly retryCount: number;
483
485
  }
486
+ export interface Cloudflare {
487
+ readonly compatibilityFlags: Record<string, boolean>;
488
+ }
484
489
  export interface DurableObject {
485
490
  fetch(request: Request): Response | Promise<Response>;
486
491
  alarm?(): void | Promise<void>;
@@ -2272,15 +2277,15 @@ export declare class TransformStream<I = any, O = any> {
2272
2277
  }
2273
2278
  export declare class FixedLengthStream extends IdentityTransformStream {
2274
2279
  constructor(
2275
- expectedLength: number | bigint,
2276
- queuingStrategy?: IdentityTransformStreamQueuingStrategy,
2280
+ param1: number | bigint,
2281
+ param2?: IdentityTransformStreamQueuingStrategy,
2277
2282
  );
2278
2283
  }
2279
2284
  export declare class IdentityTransformStream extends TransformStream<
2280
2285
  ArrayBuffer | ArrayBufferView,
2281
2286
  Uint8Array
2282
2287
  > {
2283
- constructor(queuingStrategy?: IdentityTransformStreamQueuingStrategy);
2288
+ constructor(param1?: IdentityTransformStreamQueuingStrategy);
2284
2289
  }
2285
2290
  export interface IdentityTransformStreamQueuingStrategy {
2286
2291
  highWaterMark?: number | bigint;
@@ -2315,7 +2320,7 @@ export declare class TextDecoderStream extends TransformStream<
2315
2320
  ArrayBuffer | ArrayBufferView,
2316
2321
  string
2317
2322
  > {
2318
- constructor(label?: string, options?: TextDecoderStreamTextDecoderStreamInit);
2323
+ constructor(param1?: string, param2?: TextDecoderStreamTextDecoderStreamInit);
2319
2324
  get encoding(): string;
2320
2325
  get fatal(): boolean;
2321
2326
  get ignoreBOM(): boolean;
@@ -2529,13 +2534,13 @@ export declare class URL {
2529
2534
  /*function toString() { [native code] }*/
2530
2535
  toString(): string;
2531
2536
  /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/canParse_static) */
2532
- static canParse(url: string, base?: string): boolean;
2533
- static parse(url: string, base?: string): URL | null;
2537
+ static canParse(param0: string, param1?: string): boolean;
2538
+ static parse(param1: string, param2?: string): URL | null;
2534
2539
  }
2535
2540
  /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams) */
2536
2541
  export declare class URLSearchParams {
2537
2542
  constructor(
2538
- init?: Iterable<Iterable<string>> | Record<string, string> | string,
2543
+ param0?: Iterable<Iterable<string>> | Record<string, string> | string,
2539
2544
  );
2540
2545
  /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/size) */
2541
2546
  get size(): number;
@@ -2544,7 +2549,7 @@ export declare class URLSearchParams {
2544
2549
  *
2545
2550
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/append)
2546
2551
  */
2547
- append(name: string, value: string): void;
2552
+ append(param0: string, param1: string): void;
2548
2553
  /**
2549
2554
  * Deletes the given search parameter, and its associated value, from the list of all search parameters.
2550
2555
  *
@@ -2556,13 +2561,13 @@ export declare class URLSearchParams {
2556
2561
  *
2557
2562
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/get)
2558
2563
  */
2559
- get(name: string): string | null;
2564
+ get(param0: string): string | null;
2560
2565
  /**
2561
2566
  * Returns all the values association with a given search parameter.
2562
2567
  *
2563
2568
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/getAll)
2564
2569
  */
2565
- getAll(name: string): string[];
2570
+ getAll(param0: string): string[];
2566
2571
  /**
2567
2572
  * Returns a Boolean indicating if such a search parameter exists.
2568
2573
  *
@@ -2574,7 +2579,7 @@ export declare class URLSearchParams {
2574
2579
  *
2575
2580
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/set)
2576
2581
  */
2577
- set(name: string, value: string): void;
2582
+ set(param0: string, param1: string): void;
2578
2583
  /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/sort) */
2579
2584
  sort(): void;
2580
2585
  /* Returns an array of key, value pairs for every entry in the search params. */
@@ -4947,6 +4952,18 @@ export type PagesPluginFunction<
4947
4952
  > = (
4948
4953
  context: EventPluginContext<Env, Params, Data, PluginArgs>,
4949
4954
  ) => Response | Promise<Response>;
4955
+ // Copyright (c) 2022-2023 Cloudflare, Inc.
4956
+ // Licensed under the Apache 2.0 license found in the LICENSE file or at:
4957
+ // https://opensource.org/licenses/Apache-2.0
4958
+ export declare abstract class PipelineTransform {
4959
+ /**
4960
+ * transformJson recieves an array of javascript objects which can be
4961
+ * mutated and returned to the pipeline
4962
+ * @param data The data to be mutated
4963
+ * @returns A promise containing the mutated data
4964
+ */
4965
+ public transformJson(data: object[]): Promise<object[]>;
4966
+ }
4950
4967
  // PubSubMessage represents an incoming PubSub message.
4951
4968
  // The message includes metadata about the broker, the client, and the payload
4952
4969
  // itself.
@@ -5202,13 +5219,11 @@ export type VectorizeDistanceMetric = "euclidean" | "cosine" | "dot-product";
5202
5219
  * @property none No indexed metadata will be returned.
5203
5220
  */
5204
5221
  export type VectorizeMetadataRetrievalLevel = "all" | "indexed" | "none";
5205
- export interface VectorizeQueryOptions<
5206
- MetadataReturn extends boolean | VectorizeMetadataRetrievalLevel = boolean,
5207
- > {
5222
+ export interface VectorizeQueryOptions {
5208
5223
  topK?: number;
5209
5224
  namespace?: string;
5210
5225
  returnValues?: boolean;
5211
- returnMetadata?: MetadataReturn;
5226
+ returnMetadata?: boolean | VectorizeMetadataRetrievalLevel;
5212
5227
  filter?: VectorizeVectorMetadataFilter;
5213
5228
  }
5214
5229
  /**
@@ -5322,7 +5337,7 @@ export declare abstract class VectorizeIndex {
5322
5337
  */
5323
5338
  public query(
5324
5339
  vector: VectorFloatArray | number[],
5325
- options: VectorizeQueryOptions,
5340
+ options?: VectorizeQueryOptions,
5326
5341
  ): Promise<VectorizeMatches>;
5327
5342
  /**
5328
5343
  * Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.
@@ -5368,7 +5383,7 @@ export declare abstract class Vectorize {
5368
5383
  */
5369
5384
  public query(
5370
5385
  vector: VectorFloatArray | number[],
5371
- options: VectorizeQueryOptions<VectorizeMetadataRetrievalLevel>,
5386
+ options?: VectorizeQueryOptions,
5372
5387
  ): Promise<VectorizeMatches>;
5373
5388
  /**
5374
5389
  * Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.
@@ -235,6 +235,7 @@ interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
235
235
  caches: CacheStorage;
236
236
  scheduler: Scheduler;
237
237
  performance: Performance;
238
+ Cloudflare: Cloudflare;
238
239
  readonly origin: string;
239
240
  Event: typeof Event;
240
241
  ExtendableEvent: typeof ExtendableEvent;
@@ -391,6 +392,7 @@ declare const scheduler: Scheduler;
391
392
  * [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/)
392
393
  */
393
394
  declare const performance: Performance;
395
+ declare const Cloudflare: Cloudflare;
394
396
  declare const origin: string;
395
397
  declare const navigator: Navigator;
396
398
  interface TestController {}
@@ -481,6 +483,9 @@ interface AlarmInvocationInfo {
481
483
  readonly isRetry: boolean;
482
484
  readonly retryCount: number;
483
485
  }
486
+ interface Cloudflare {
487
+ readonly compatibilityFlags: Record<string, boolean>;
488
+ }
484
489
  interface DurableObject {
485
490
  fetch(request: Request): Response | Promise<Response>;
486
491
  alarm?(): void | Promise<void>;
@@ -2271,15 +2276,15 @@ declare class TransformStream<I = any, O = any> {
2271
2276
  }
2272
2277
  declare class FixedLengthStream extends IdentityTransformStream {
2273
2278
  constructor(
2274
- expectedLength: number | bigint,
2275
- queuingStrategy?: IdentityTransformStreamQueuingStrategy,
2279
+ param1: number | bigint,
2280
+ param2?: IdentityTransformStreamQueuingStrategy,
2276
2281
  );
2277
2282
  }
2278
2283
  declare class IdentityTransformStream extends TransformStream<
2279
2284
  ArrayBuffer | ArrayBufferView,
2280
2285
  Uint8Array
2281
2286
  > {
2282
- constructor(queuingStrategy?: IdentityTransformStreamQueuingStrategy);
2287
+ constructor(param1?: IdentityTransformStreamQueuingStrategy);
2283
2288
  }
2284
2289
  interface IdentityTransformStreamQueuingStrategy {
2285
2290
  highWaterMark?: number | bigint;
@@ -2311,7 +2316,7 @@ declare class TextDecoderStream extends TransformStream<
2311
2316
  ArrayBuffer | ArrayBufferView,
2312
2317
  string
2313
2318
  > {
2314
- constructor(label?: string, options?: TextDecoderStreamTextDecoderStreamInit);
2319
+ constructor(param1?: string, param2?: TextDecoderStreamTextDecoderStreamInit);
2315
2320
  get encoding(): string;
2316
2321
  get fatal(): boolean;
2317
2322
  get ignoreBOM(): boolean;
@@ -2525,13 +2530,13 @@ declare class URL {
2525
2530
  /*function toString() { [native code] }*/
2526
2531
  toString(): string;
2527
2532
  /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/canParse_static) */
2528
- static canParse(url: string, base?: string): boolean;
2529
- static parse(url: string, base?: string): URL | null;
2533
+ static canParse(param0: string, param1?: string): boolean;
2534
+ static parse(param1: string, param2?: string): URL | null;
2530
2535
  }
2531
2536
  /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams) */
2532
2537
  declare class URLSearchParams {
2533
2538
  constructor(
2534
- init?: Iterable<Iterable<string>> | Record<string, string> | string,
2539
+ param0?: Iterable<Iterable<string>> | Record<string, string> | string,
2535
2540
  );
2536
2541
  /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/size) */
2537
2542
  get size(): number;
@@ -2540,7 +2545,7 @@ declare class URLSearchParams {
2540
2545
  *
2541
2546
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/append)
2542
2547
  */
2543
- append(name: string, value: string): void;
2548
+ append(param0: string, param1: string): void;
2544
2549
  /**
2545
2550
  * Deletes the given search parameter, and its associated value, from the list of all search parameters.
2546
2551
  *
@@ -2552,13 +2557,13 @@ declare class URLSearchParams {
2552
2557
  *
2553
2558
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/get)
2554
2559
  */
2555
- get(name: string): string | null;
2560
+ get(param0: string): string | null;
2556
2561
  /**
2557
2562
  * Returns all the values association with a given search parameter.
2558
2563
  *
2559
2564
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/getAll)
2560
2565
  */
2561
- getAll(name: string): string[];
2566
+ getAll(param0: string): string[];
2562
2567
  /**
2563
2568
  * Returns a Boolean indicating if such a search parameter exists.
2564
2569
  *
@@ -2570,7 +2575,7 @@ declare class URLSearchParams {
2570
2575
  *
2571
2576
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/set)
2572
2577
  */
2573
- set(name: string, value: string): void;
2578
+ set(param0: string, param1: string): void;
2574
2579
  /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/sort) */
2575
2580
  sort(): void;
2576
2581
  /* Returns an array of key, value pairs for every entry in the search params. */
@@ -4940,6 +4945,18 @@ type PagesPluginFunction<
4940
4945
  declare module "assets:*" {
4941
4946
  export const onRequest: PagesFunction;
4942
4947
  }
4948
+ // Copyright (c) 2022-2023 Cloudflare, Inc.
4949
+ // Licensed under the Apache 2.0 license found in the LICENSE file or at:
4950
+ // https://opensource.org/licenses/Apache-2.0
4951
+ declare abstract class PipelineTransform {
4952
+ /**
4953
+ * transformJson recieves an array of javascript objects which can be
4954
+ * mutated and returned to the pipeline
4955
+ * @param data The data to be mutated
4956
+ * @returns A promise containing the mutated data
4957
+ */
4958
+ public transformJson(data: object[]): Promise<object[]>;
4959
+ }
4943
4960
  // PubSubMessage represents an incoming PubSub message.
4944
4961
  // The message includes metadata about the broker, the client, and the payload
4945
4962
  // itself.
@@ -5186,7 +5203,7 @@ declare module "cloudflare:workers" {
5186
5203
  ): void | Promise<void>;
5187
5204
  webSocketError?(ws: WebSocket, error: unknown): void | Promise<void>;
5188
5205
  }
5189
- export type DurationLabel =
5206
+ export type WorkflowDurationLabel =
5190
5207
  | "second"
5191
5208
  | "minute"
5192
5209
  | "hour"
@@ -5194,13 +5211,32 @@ declare module "cloudflare:workers" {
5194
5211
  | "week"
5195
5212
  | "month"
5196
5213
  | "year";
5197
- export type SleepDuration = `${number} ${DurationLabel}${"s" | ""}` | number;
5198
- type WorkflowStep = {
5214
+ export type WorkflowSleepDuration =
5215
+ | `${number} ${WorkflowDurationLabel}${"s" | ""}`
5216
+ | number;
5217
+ export type WorkflowBackoff = "constant" | "linear" | "exponential";
5218
+ export type WorkflowStepConfig = {
5219
+ retries?: {
5220
+ limit: number;
5221
+ delay: string | number;
5222
+ backoff?: WorkflowBackoff;
5223
+ };
5224
+ timeout?: string | number;
5225
+ };
5226
+ export type WorkflowEvent<T> = {
5227
+ payload: T;
5228
+ timestamp: Date;
5229
+ };
5230
+ export type WorkflowStep = {
5199
5231
  do: <T extends Rpc.Serializable>(
5200
5232
  name: string,
5201
- callback: () => T,
5202
- ) => T | Promise<T>;
5203
- sleep: (name: string, duration: SleepDuration) => void | Promise<void>;
5233
+ callback: () => Promise<T>,
5234
+ config?: WorkflowStepConfig,
5235
+ ) => Promise<T>;
5236
+ sleep: (
5237
+ name: string,
5238
+ duration: WorkflowSleepDuration,
5239
+ ) => void | Promise<void>;
5204
5240
  };
5205
5241
  export abstract class Workflow<
5206
5242
  Env = unknown,
@@ -5210,13 +5246,7 @@ declare module "cloudflare:workers" {
5210
5246
  [Rpc.__WORKFLOW_BRAND]: never;
5211
5247
  protected ctx: ExecutionContext;
5212
5248
  protected env: Env;
5213
- run(
5214
- events: Array<{
5215
- payload: T;
5216
- timestamp: Date;
5217
- }>,
5218
- step: WorkflowStep,
5219
- ): unknown | Promise<unknown>;
5249
+ run(events: Array<WorkflowEvent<T>>, step: WorkflowStep): Promise<unknown>;
5220
5250
  }
5221
5251
  }
5222
5252
  declare module "cloudflare:sockets" {
@@ -5279,13 +5309,11 @@ type VectorizeDistanceMetric = "euclidean" | "cosine" | "dot-product";
5279
5309
  * @property none No indexed metadata will be returned.
5280
5310
  */
5281
5311
  type VectorizeMetadataRetrievalLevel = "all" | "indexed" | "none";
5282
- interface VectorizeQueryOptions<
5283
- MetadataReturn extends boolean | VectorizeMetadataRetrievalLevel = boolean,
5284
- > {
5312
+ interface VectorizeQueryOptions {
5285
5313
  topK?: number;
5286
5314
  namespace?: string;
5287
5315
  returnValues?: boolean;
5288
- returnMetadata?: MetadataReturn;
5316
+ returnMetadata?: boolean | VectorizeMetadataRetrievalLevel;
5289
5317
  filter?: VectorizeVectorMetadataFilter;
5290
5318
  }
5291
5319
  /**
@@ -5399,7 +5427,7 @@ declare abstract class VectorizeIndex {
5399
5427
  */
5400
5428
  public query(
5401
5429
  vector: VectorFloatArray | number[],
5402
- options: VectorizeQueryOptions,
5430
+ options?: VectorizeQueryOptions,
5403
5431
  ): Promise<VectorizeMatches>;
5404
5432
  /**
5405
5433
  * Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.
@@ -5445,7 +5473,7 @@ declare abstract class Vectorize {
5445
5473
  */
5446
5474
  public query(
5447
5475
  vector: VectorFloatArray | number[],
5448
- options: VectorizeQueryOptions<VectorizeMetadataRetrievalLevel>,
5476
+ options?: VectorizeQueryOptions,
5449
5477
  ): Promise<VectorizeMatches>;
5450
5478
  /**
5451
5479
  * Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.