@cloudflare/workers-types

4.20240821.14.20240903.0
2022-08-04/index.d.ts
~2022-08-04/index.d.tsModified
+26−11
Index: package/2022-08-04/index.d.ts
===================================================================
--- package/2022-08-04/index.d.ts
+++ package/2022-08-04/index.d.ts
@@ -234,8 +234,9 @@
   crypto: Crypto;
   caches: CacheStorage;
   scheduler: Scheduler;
   performance: Performance;
+  Cloudflare: Cloudflare;
   readonly origin: string;
   Event: typeof Event;
   ExtendableEvent: typeof ExtendableEvent;
   CustomEvent: typeof CustomEvent;
@@ -385,8 +386,9 @@
  *
  * [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/)
  */
 declare const performance: Performance;
+declare const Cloudflare: Cloudflare;
 declare const origin: string;
 declare const navigator: Navigator;
 interface TestController {}
 interface ExecutionContext {
@@ -475,8 +477,11 @@
 interface AlarmInvocationInfo {
   readonly isRetry: boolean;
   readonly retryCount: number;
 }
+interface Cloudflare {
+  readonly compatibilityFlags: Record<string, boolean>;
+}
 interface DurableObject {
   fetch(request: Request): Response | Promise<Response>;
   alarm?(): void | Promise<void>;
   webSocketMessage?(
@@ -2265,17 +2270,17 @@
   get writable(): WritableStream<I>;
 }
 declare class FixedLengthStream extends IdentityTransformStream {
   constructor(
-    expectedLength: number | bigint,
-    queuingStrategy?: IdentityTransformStreamQueuingStrategy,
+    param1: number | bigint,
+    param2?: IdentityTransformStreamQueuingStrategy,
   );
 }
 declare class IdentityTransformStream extends TransformStream<
   ArrayBuffer | ArrayBufferView,
   Uint8Array
 > {
-  constructor(queuingStrategy?: IdentityTransformStreamQueuingStrategy);
+  constructor(param1?: IdentityTransformStreamQueuingStrategy);
 }
 interface IdentityTransformStreamQueuingStrategy {
   highWaterMark?: number | bigint;
 }
@@ -2305,9 +2310,9 @@
 declare class TextDecoderStream extends TransformStream<
   ArrayBuffer | ArrayBufferView,
   string
 > {
-  constructor(label?: string, options?: TextDecoderStreamTextDecoderStreamInit);
+  constructor(param1?: string, param2?: TextDecoderStreamTextDecoderStreamInit);
   get encoding(): string;
   get fatal(): boolean;
   get ignoreBOM(): boolean;
 }
@@ -4935,8 +4940,20 @@
 ) => Response | Promise<Response>;
 declare module "assets:*" {
   export const onRequest: PagesFunction;
 }
+// Copyright (c) 2022-2023 Cloudflare, Inc.
+// Licensed under the Apache 2.0 license found in the LICENSE file or at:
+//     https://opensource.org/licenses/Apache-2.0
+declare abstract class PipelineTransform {
+  /**
+   * transformJson recieves an array of javascript objects which can be
+   * mutated and returned to the pipeline
+   * @param data The data to be mutated
+   * @returns A promise containing the mutated data
+   */
+  public transformJson(data: object[]): Promise<object[]>;
+}
 // PubSubMessage represents an incoming PubSub message.
 // The message includes metadata about the broker, the client, and the payload
 // itself.
 // https://developers.cloudflare.com/pub-sub/
@@ -5201,8 +5218,12 @@
       backoff?: WorkflowBackoff;
     };
     timeout?: string | number;
   };
+  export type WorkflowEvent<T> = {
+    payload: T;
+    timestamp: Date;
+  };
   export type WorkflowStep = {
     do: <T extends Rpc.Serializable>(
       name: string,
       callback: () => Promise<T>,
@@ -5220,15 +5241,9 @@
   {
     [Rpc.__WORKFLOW_BRAND]: never;
     protected ctx: ExecutionContext;
     protected env: Env;
-    run(
-      events: Array<{
-        payload: T;
-        timestamp: Date;
-      }>,
-      step: WorkflowStep,
-    ): Promise<unknown>;
+    run(events: Array<WorkflowEvent<T>>, step: WorkflowStep): Promise<unknown>;
   }
 }
 declare module "cloudflare:sockets" {
   function _connect(