@cloudflare/workers-types
4.20240821.14.20240903.0
2022-10-31/index.d.ts~
2022-10-31/index.d.tsModified+33−18
Index: package/2022-10-31/index.d.ts
===================================================================
--- package/2022-10-31/index.d.ts
+++ package/2022-10-31/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;
}
@@ -2519,24 +2524,24 @@
toJSON(): string;
/*function toString() { [native code] }*/
toString(): string;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/canParse_static) */
- static canParse(url: string, base?: string): boolean;
- static parse(url: string, base?: string): URL | null;
+ static canParse(param0: string, param1?: string): boolean;
+ static parse(param1: string, param2?: string): URL | null;
}
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams) */
declare class URLSearchParams {
constructor(
- init?: Iterable<Iterable<string>> | Record<string, string> | string,
+ param0?: Iterable<Iterable<string>> | Record<string, string> | string,
);
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/size) */
get size(): number;
/**
* Appends a specified key/value pair as a new search parameter.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/append)
*/
- append(name: string, value: string): void;
+ append(param0: string, param1: string): void;
/**
* Deletes the given search parameter, and its associated value, from the list of all search parameters.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/delete)
@@ -2546,15 +2551,15 @@
* Returns the first value associated to the given search parameter.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/get)
*/
- get(name: string): string | null;
+ get(param0: string): string | null;
/**
* Returns all the values association with a given search parameter.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/getAll)
*/
- getAll(name: string): string[];
+ getAll(param0: string): string[];
/**
* Returns a Boolean indicating if such a search parameter exists.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/has)
@@ -2564,9 +2569,9 @@
* Sets the value associated to a given search parameter to the given value. If there were several values, delete the others.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/set)
*/
- set(name: string, value: string): void;
+ set(param0: string, param1: string): void;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/sort) */
sort(): void;
/* Returns an array of key, value pairs for every entry in the search params. */
entries(): IterableIterator<[key: string, value: string]>;
@@ -4934,8 +4939,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/
@@ -5200,8 +5217,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>,
@@ -5219,15 +5240,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(