@cloudflare/workers-types 4.20240821.1 → 4.20240909.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.
- package/2021-11-03/index.d.ts +70 -11
- package/2021-11-03/index.ts +65 -4
- package/2022-01-31/index.d.ts +70 -11
- package/2022-01-31/index.ts +65 -4
- package/2022-03-21/index.d.ts +70 -11
- package/2022-03-21/index.ts +65 -4
- package/2022-08-04/index.d.ts +70 -11
- package/2022-08-04/index.ts +65 -4
- package/2022-10-31/index.d.ts +77 -18
- package/2022-10-31/index.ts +72 -11
- package/2022-11-30/index.d.ts +77 -18
- package/2022-11-30/index.ts +72 -11
- package/2023-03-01/index.d.ts +77 -18
- package/2023-03-01/index.ts +72 -11
- package/2023-07-01/index.d.ts +79 -20
- package/2023-07-01/index.ts +74 -13
- package/experimental/index.d.ts +65 -20
- package/experimental/index.ts +60 -13
- package/index.d.ts +70 -11
- package/index.ts +65 -4
- package/oldest/index.d.ts +70 -11
- package/oldest/index.ts +65 -4
- package/package.json +1 -1
package/2021-11-03/index.d.ts
CHANGED
|
@@ -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;
|
|
@@ -384,6 +385,7 @@ declare const scheduler: Scheduler;
|
|
|
384
385
|
* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/)
|
|
385
386
|
*/
|
|
386
387
|
declare const performance: Performance;
|
|
388
|
+
declare const Cloudflare: Cloudflare;
|
|
387
389
|
declare const origin: string;
|
|
388
390
|
interface TestController {}
|
|
389
391
|
interface ExecutionContext {
|
|
@@ -459,6 +461,9 @@ interface AlarmInvocationInfo {
|
|
|
459
461
|
readonly isRetry: boolean;
|
|
460
462
|
readonly retryCount: number;
|
|
461
463
|
}
|
|
464
|
+
interface Cloudflare {
|
|
465
|
+
readonly compatibilityFlags: Record<string, boolean>;
|
|
466
|
+
}
|
|
462
467
|
interface DurableObject {
|
|
463
468
|
fetch(request: Request): Response | Promise<Response>;
|
|
464
469
|
alarm?(): void | Promise<void>;
|
|
@@ -534,6 +539,7 @@ interface DurableObjectState {
|
|
|
534
539
|
setHibernatableWebSocketEventTimeout(timeoutMs?: number): void;
|
|
535
540
|
getHibernatableWebSocketEventTimeout(): number | null;
|
|
536
541
|
getTags(ws: WebSocket): string[];
|
|
542
|
+
abort(reason?: string): void;
|
|
537
543
|
}
|
|
538
544
|
interface DurableObjectTransaction {
|
|
539
545
|
get<T = unknown>(
|
|
@@ -600,7 +606,11 @@ interface DurableObjectStorage {
|
|
|
600
606
|
): Promise<void>;
|
|
601
607
|
deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
|
|
602
608
|
sync(): Promise<void>;
|
|
609
|
+
sql: SqlStorage;
|
|
603
610
|
transactionSync<T>(closure: () => T): T;
|
|
611
|
+
getCurrentBookmark(): Promise<string>;
|
|
612
|
+
getBookmarkForTime(timestamp: number | Date): Promise<string>;
|
|
613
|
+
onNextSessionRestoreBookmark(bookmark: string): Promise<string>;
|
|
604
614
|
}
|
|
605
615
|
interface DurableObjectListOptions {
|
|
606
616
|
start?: string;
|
|
@@ -2242,15 +2252,15 @@ declare class TransformStream<I = any, O = any> {
|
|
|
2242
2252
|
}
|
|
2243
2253
|
declare class FixedLengthStream extends IdentityTransformStream {
|
|
2244
2254
|
constructor(
|
|
2245
|
-
|
|
2246
|
-
|
|
2255
|
+
param1: number | bigint,
|
|
2256
|
+
param2?: IdentityTransformStreamQueuingStrategy,
|
|
2247
2257
|
);
|
|
2248
2258
|
}
|
|
2249
2259
|
declare class IdentityTransformStream extends TransformStream<
|
|
2250
2260
|
ArrayBuffer | ArrayBufferView,
|
|
2251
2261
|
Uint8Array
|
|
2252
2262
|
> {
|
|
2253
|
-
constructor(
|
|
2263
|
+
constructor(param1?: IdentityTransformStreamQueuingStrategy);
|
|
2254
2264
|
}
|
|
2255
2265
|
interface IdentityTransformStreamQueuingStrategy {
|
|
2256
2266
|
highWaterMark?: number | bigint;
|
|
@@ -2282,7 +2292,7 @@ declare class TextDecoderStream extends TransformStream<
|
|
|
2282
2292
|
ArrayBuffer | ArrayBufferView,
|
|
2283
2293
|
string
|
|
2284
2294
|
> {
|
|
2285
|
-
constructor(
|
|
2295
|
+
constructor(param1?: string, param2?: TextDecoderStreamTextDecoderStreamInit);
|
|
2286
2296
|
get encoding(): string;
|
|
2287
2297
|
get fatal(): boolean;
|
|
2288
2298
|
get ignoreBOM(): boolean;
|
|
@@ -2708,6 +2718,23 @@ declare const WebSocketPair: {
|
|
|
2708
2718
|
1: WebSocket;
|
|
2709
2719
|
};
|
|
2710
2720
|
};
|
|
2721
|
+
interface SqlStorage {
|
|
2722
|
+
exec(query: string, ...bindings: any[]): SqlStorageCursor;
|
|
2723
|
+
prepare(query: string): SqlStorageStatement;
|
|
2724
|
+
get databaseSize(): number;
|
|
2725
|
+
Cursor: typeof SqlStorageCursor;
|
|
2726
|
+
Statement: typeof SqlStorageStatement;
|
|
2727
|
+
}
|
|
2728
|
+
declare abstract class SqlStorageStatement {}
|
|
2729
|
+
declare abstract class SqlStorageCursor {
|
|
2730
|
+
raw(): IterableIterator<((ArrayBuffer | string | number) | null)[]>;
|
|
2731
|
+
get columnNames(): string[];
|
|
2732
|
+
get rowsRead(): number;
|
|
2733
|
+
get rowsWritten(): number;
|
|
2734
|
+
[Symbol.iterator](): IterableIterator<
|
|
2735
|
+
Record<string, (ArrayBuffer | string | number) | null>
|
|
2736
|
+
>;
|
|
2737
|
+
}
|
|
2711
2738
|
interface Socket {
|
|
2712
2739
|
get readable(): ReadableStream;
|
|
2713
2740
|
get writable(): WritableStream;
|
|
@@ -4885,6 +4912,30 @@ type PagesPluginFunction<
|
|
|
4885
4912
|
declare module "assets:*" {
|
|
4886
4913
|
export const onRequest: PagesFunction;
|
|
4887
4914
|
}
|
|
4915
|
+
// Copyright (c) 2022-2023 Cloudflare, Inc.
|
|
4916
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
4917
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
4918
|
+
declare abstract class PipelineTransform {
|
|
4919
|
+
/**
|
|
4920
|
+
* transformJson recieves an array of javascript objects which can be
|
|
4921
|
+
* mutated and returned to the pipeline
|
|
4922
|
+
* @param data The data to be mutated
|
|
4923
|
+
* @returns A promise containing the mutated data
|
|
4924
|
+
*/
|
|
4925
|
+
public transformJson(data: object[]): Promise<object[]>;
|
|
4926
|
+
}
|
|
4927
|
+
// Copyright (c) 2022-2023 Cloudflare, Inc.
|
|
4928
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
4929
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
4930
|
+
interface Pipeline {
|
|
4931
|
+
/**
|
|
4932
|
+
* send takes an array of javascript objects which are
|
|
4933
|
+
* then received by the pipeline for processing
|
|
4934
|
+
*
|
|
4935
|
+
* @param data The data to be sent
|
|
4936
|
+
*/
|
|
4937
|
+
send(data: object[]): Promise<void>;
|
|
4938
|
+
}
|
|
4888
4939
|
// PubSubMessage represents an incoming PubSub message.
|
|
4889
4940
|
// The message includes metadata about the broker, the client, and the payload
|
|
4890
4941
|
// itself.
|
|
@@ -5151,6 +5202,10 @@ declare module "cloudflare:workers" {
|
|
|
5151
5202
|
};
|
|
5152
5203
|
timeout?: string | number;
|
|
5153
5204
|
};
|
|
5205
|
+
export type WorkflowEvent<T> = {
|
|
5206
|
+
payload: T;
|
|
5207
|
+
timestamp: Date;
|
|
5208
|
+
};
|
|
5154
5209
|
export type WorkflowStep = {
|
|
5155
5210
|
do: <T extends Rpc.Serializable>(
|
|
5156
5211
|
name: string,
|
|
@@ -5170,13 +5225,7 @@ declare module "cloudflare:workers" {
|
|
|
5170
5225
|
[Rpc.__WORKFLOW_BRAND]: never;
|
|
5171
5226
|
protected ctx: ExecutionContext;
|
|
5172
5227
|
protected env: Env;
|
|
5173
|
-
run(
|
|
5174
|
-
events: Array<{
|
|
5175
|
-
payload: T;
|
|
5176
|
-
timestamp: Date;
|
|
5177
|
-
}>,
|
|
5178
|
-
step: WorkflowStep,
|
|
5179
|
-
): Promise<unknown>;
|
|
5228
|
+
run(events: Array<WorkflowEvent<T>>, step: WorkflowStep): Promise<unknown>;
|
|
5180
5229
|
}
|
|
5181
5230
|
}
|
|
5182
5231
|
declare module "cloudflare:sockets" {
|
|
@@ -5480,3 +5529,13 @@ interface DispatchNamespace {
|
|
|
5480
5529
|
options?: DynamicDispatchOptions,
|
|
5481
5530
|
): Fetcher;
|
|
5482
5531
|
}
|
|
5532
|
+
/**
|
|
5533
|
+
* NonRetryableError allows for a Workflow to throw a "fatal" error as in,
|
|
5534
|
+
* an error that makes the instance fail immediately without triggering a retry.
|
|
5535
|
+
*/
|
|
5536
|
+
declare class NonRetryableError extends Error {
|
|
5537
|
+
// __brand has been explicity omitted because it's a internal brand used for
|
|
5538
|
+
// the Workflows' engine and user's shouldn't be able to override it
|
|
5539
|
+
// (at least, in a direct way)
|
|
5540
|
+
public constructor(message: string, name?: string);
|
|
5541
|
+
}
|
package/2021-11-03/index.ts
CHANGED
|
@@ -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;
|
|
@@ -386,6 +387,7 @@ export declare const scheduler: Scheduler;
|
|
|
386
387
|
* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/)
|
|
387
388
|
*/
|
|
388
389
|
export declare const performance: Performance;
|
|
390
|
+
export declare const Cloudflare: Cloudflare;
|
|
389
391
|
export declare const origin: string;
|
|
390
392
|
export interface TestController {}
|
|
391
393
|
export interface ExecutionContext {
|
|
@@ -464,6 +466,9 @@ export interface AlarmInvocationInfo {
|
|
|
464
466
|
readonly isRetry: boolean;
|
|
465
467
|
readonly retryCount: number;
|
|
466
468
|
}
|
|
469
|
+
export interface Cloudflare {
|
|
470
|
+
readonly compatibilityFlags: Record<string, boolean>;
|
|
471
|
+
}
|
|
467
472
|
export interface DurableObject {
|
|
468
473
|
fetch(request: Request): Response | Promise<Response>;
|
|
469
474
|
alarm?(): void | Promise<void>;
|
|
@@ -539,6 +544,7 @@ export interface DurableObjectState {
|
|
|
539
544
|
setHibernatableWebSocketEventTimeout(timeoutMs?: number): void;
|
|
540
545
|
getHibernatableWebSocketEventTimeout(): number | null;
|
|
541
546
|
getTags(ws: WebSocket): string[];
|
|
547
|
+
abort(reason?: string): void;
|
|
542
548
|
}
|
|
543
549
|
export interface DurableObjectTransaction {
|
|
544
550
|
get<T = unknown>(
|
|
@@ -605,7 +611,11 @@ export interface DurableObjectStorage {
|
|
|
605
611
|
): Promise<void>;
|
|
606
612
|
deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
|
|
607
613
|
sync(): Promise<void>;
|
|
614
|
+
sql: SqlStorage;
|
|
608
615
|
transactionSync<T>(closure: () => T): T;
|
|
616
|
+
getCurrentBookmark(): Promise<string>;
|
|
617
|
+
getBookmarkForTime(timestamp: number | Date): Promise<string>;
|
|
618
|
+
onNextSessionRestoreBookmark(bookmark: string): Promise<string>;
|
|
609
619
|
}
|
|
610
620
|
export interface DurableObjectListOptions {
|
|
611
621
|
start?: string;
|
|
@@ -2248,15 +2258,15 @@ export declare class TransformStream<I = any, O = any> {
|
|
|
2248
2258
|
}
|
|
2249
2259
|
export declare class FixedLengthStream extends IdentityTransformStream {
|
|
2250
2260
|
constructor(
|
|
2251
|
-
|
|
2252
|
-
|
|
2261
|
+
param1: number | bigint,
|
|
2262
|
+
param2?: IdentityTransformStreamQueuingStrategy,
|
|
2253
2263
|
);
|
|
2254
2264
|
}
|
|
2255
2265
|
export declare class IdentityTransformStream extends TransformStream<
|
|
2256
2266
|
ArrayBuffer | ArrayBufferView,
|
|
2257
2267
|
Uint8Array
|
|
2258
2268
|
> {
|
|
2259
|
-
constructor(
|
|
2269
|
+
constructor(param1?: IdentityTransformStreamQueuingStrategy);
|
|
2260
2270
|
}
|
|
2261
2271
|
export interface IdentityTransformStreamQueuingStrategy {
|
|
2262
2272
|
highWaterMark?: number | bigint;
|
|
@@ -2291,7 +2301,7 @@ export declare class TextDecoderStream extends TransformStream<
|
|
|
2291
2301
|
ArrayBuffer | ArrayBufferView,
|
|
2292
2302
|
string
|
|
2293
2303
|
> {
|
|
2294
|
-
constructor(
|
|
2304
|
+
constructor(param1?: string, param2?: TextDecoderStreamTextDecoderStreamInit);
|
|
2295
2305
|
get encoding(): string;
|
|
2296
2306
|
get fatal(): boolean;
|
|
2297
2307
|
get ignoreBOM(): boolean;
|
|
@@ -2717,6 +2727,23 @@ export declare const WebSocketPair: {
|
|
|
2717
2727
|
1: WebSocket;
|
|
2718
2728
|
};
|
|
2719
2729
|
};
|
|
2730
|
+
export interface SqlStorage {
|
|
2731
|
+
exec(query: string, ...bindings: any[]): SqlStorageCursor;
|
|
2732
|
+
prepare(query: string): SqlStorageStatement;
|
|
2733
|
+
get databaseSize(): number;
|
|
2734
|
+
Cursor: typeof SqlStorageCursor;
|
|
2735
|
+
Statement: typeof SqlStorageStatement;
|
|
2736
|
+
}
|
|
2737
|
+
export declare abstract class SqlStorageStatement {}
|
|
2738
|
+
export declare abstract class SqlStorageCursor {
|
|
2739
|
+
raw(): IterableIterator<((ArrayBuffer | string | number) | null)[]>;
|
|
2740
|
+
get columnNames(): string[];
|
|
2741
|
+
get rowsRead(): number;
|
|
2742
|
+
get rowsWritten(): number;
|
|
2743
|
+
[Symbol.iterator](): IterableIterator<
|
|
2744
|
+
Record<string, (ArrayBuffer | string | number) | null>
|
|
2745
|
+
>;
|
|
2746
|
+
}
|
|
2720
2747
|
export interface Socket {
|
|
2721
2748
|
get readable(): ReadableStream;
|
|
2722
2749
|
get writable(): WritableStream;
|
|
@@ -4897,6 +4924,30 @@ export type PagesPluginFunction<
|
|
|
4897
4924
|
> = (
|
|
4898
4925
|
context: EventPluginContext<Env, Params, Data, PluginArgs>,
|
|
4899
4926
|
) => Response | Promise<Response>;
|
|
4927
|
+
// Copyright (c) 2022-2023 Cloudflare, Inc.
|
|
4928
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
4929
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
4930
|
+
export declare abstract class PipelineTransform {
|
|
4931
|
+
/**
|
|
4932
|
+
* transformJson recieves an array of javascript objects which can be
|
|
4933
|
+
* mutated and returned to the pipeline
|
|
4934
|
+
* @param data The data to be mutated
|
|
4935
|
+
* @returns A promise containing the mutated data
|
|
4936
|
+
*/
|
|
4937
|
+
public transformJson(data: object[]): Promise<object[]>;
|
|
4938
|
+
}
|
|
4939
|
+
// Copyright (c) 2022-2023 Cloudflare, Inc.
|
|
4940
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
4941
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
4942
|
+
export interface Pipeline {
|
|
4943
|
+
/**
|
|
4944
|
+
* send takes an array of javascript objects which are
|
|
4945
|
+
* then received by the pipeline for processing
|
|
4946
|
+
*
|
|
4947
|
+
* @param data The data to be sent
|
|
4948
|
+
*/
|
|
4949
|
+
send(data: object[]): Promise<void>;
|
|
4950
|
+
}
|
|
4900
4951
|
// PubSubMessage represents an incoming PubSub message.
|
|
4901
4952
|
// The message includes metadata about the broker, the client, and the payload
|
|
4902
4953
|
// itself.
|
|
@@ -5393,3 +5444,13 @@ export interface DispatchNamespace {
|
|
|
5393
5444
|
options?: DynamicDispatchOptions,
|
|
5394
5445
|
): Fetcher;
|
|
5395
5446
|
}
|
|
5447
|
+
/**
|
|
5448
|
+
* NonRetryableError allows for a Workflow to throw a "fatal" error as in,
|
|
5449
|
+
* an error that makes the instance fail immediately without triggering a retry.
|
|
5450
|
+
*/
|
|
5451
|
+
export declare class NonRetryableError extends Error {
|
|
5452
|
+
// __brand has been explicity omitted because it's a internal brand used for
|
|
5453
|
+
// the Workflows' engine and user's shouldn't be able to override it
|
|
5454
|
+
// (at least, in a direct way)
|
|
5455
|
+
public constructor(message: string, name?: string);
|
|
5456
|
+
}
|
package/2022-01-31/index.d.ts
CHANGED
|
@@ -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;
|
|
@@ -384,6 +385,7 @@ declare const scheduler: Scheduler;
|
|
|
384
385
|
* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/)
|
|
385
386
|
*/
|
|
386
387
|
declare const performance: Performance;
|
|
388
|
+
declare const Cloudflare: Cloudflare;
|
|
387
389
|
declare const origin: string;
|
|
388
390
|
interface TestController {}
|
|
389
391
|
interface ExecutionContext {
|
|
@@ -459,6 +461,9 @@ interface AlarmInvocationInfo {
|
|
|
459
461
|
readonly isRetry: boolean;
|
|
460
462
|
readonly retryCount: number;
|
|
461
463
|
}
|
|
464
|
+
interface Cloudflare {
|
|
465
|
+
readonly compatibilityFlags: Record<string, boolean>;
|
|
466
|
+
}
|
|
462
467
|
interface DurableObject {
|
|
463
468
|
fetch(request: Request): Response | Promise<Response>;
|
|
464
469
|
alarm?(): void | Promise<void>;
|
|
@@ -534,6 +539,7 @@ interface DurableObjectState {
|
|
|
534
539
|
setHibernatableWebSocketEventTimeout(timeoutMs?: number): void;
|
|
535
540
|
getHibernatableWebSocketEventTimeout(): number | null;
|
|
536
541
|
getTags(ws: WebSocket): string[];
|
|
542
|
+
abort(reason?: string): void;
|
|
537
543
|
}
|
|
538
544
|
interface DurableObjectTransaction {
|
|
539
545
|
get<T = unknown>(
|
|
@@ -600,7 +606,11 @@ interface DurableObjectStorage {
|
|
|
600
606
|
): Promise<void>;
|
|
601
607
|
deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
|
|
602
608
|
sync(): Promise<void>;
|
|
609
|
+
sql: SqlStorage;
|
|
603
610
|
transactionSync<T>(closure: () => T): T;
|
|
611
|
+
getCurrentBookmark(): Promise<string>;
|
|
612
|
+
getBookmarkForTime(timestamp: number | Date): Promise<string>;
|
|
613
|
+
onNextSessionRestoreBookmark(bookmark: string): Promise<string>;
|
|
604
614
|
}
|
|
605
615
|
interface DurableObjectListOptions {
|
|
606
616
|
start?: string;
|
|
@@ -2248,15 +2258,15 @@ declare class TransformStream<I = any, O = any> {
|
|
|
2248
2258
|
}
|
|
2249
2259
|
declare class FixedLengthStream extends IdentityTransformStream {
|
|
2250
2260
|
constructor(
|
|
2251
|
-
|
|
2252
|
-
|
|
2261
|
+
param1: number | bigint,
|
|
2262
|
+
param2?: IdentityTransformStreamQueuingStrategy,
|
|
2253
2263
|
);
|
|
2254
2264
|
}
|
|
2255
2265
|
declare class IdentityTransformStream extends TransformStream<
|
|
2256
2266
|
ArrayBuffer | ArrayBufferView,
|
|
2257
2267
|
Uint8Array
|
|
2258
2268
|
> {
|
|
2259
|
-
constructor(
|
|
2269
|
+
constructor(param1?: IdentityTransformStreamQueuingStrategy);
|
|
2260
2270
|
}
|
|
2261
2271
|
interface IdentityTransformStreamQueuingStrategy {
|
|
2262
2272
|
highWaterMark?: number | bigint;
|
|
@@ -2288,7 +2298,7 @@ declare class TextDecoderStream extends TransformStream<
|
|
|
2288
2298
|
ArrayBuffer | ArrayBufferView,
|
|
2289
2299
|
string
|
|
2290
2300
|
> {
|
|
2291
|
-
constructor(
|
|
2301
|
+
constructor(param1?: string, param2?: TextDecoderStreamTextDecoderStreamInit);
|
|
2292
2302
|
get encoding(): string;
|
|
2293
2303
|
get fatal(): boolean;
|
|
2294
2304
|
get ignoreBOM(): boolean;
|
|
@@ -2734,6 +2744,23 @@ declare const WebSocketPair: {
|
|
|
2734
2744
|
1: WebSocket;
|
|
2735
2745
|
};
|
|
2736
2746
|
};
|
|
2747
|
+
interface SqlStorage {
|
|
2748
|
+
exec(query: string, ...bindings: any[]): SqlStorageCursor;
|
|
2749
|
+
prepare(query: string): SqlStorageStatement;
|
|
2750
|
+
get databaseSize(): number;
|
|
2751
|
+
Cursor: typeof SqlStorageCursor;
|
|
2752
|
+
Statement: typeof SqlStorageStatement;
|
|
2753
|
+
}
|
|
2754
|
+
declare abstract class SqlStorageStatement {}
|
|
2755
|
+
declare abstract class SqlStorageCursor {
|
|
2756
|
+
raw(): IterableIterator<((ArrayBuffer | string | number) | null)[]>;
|
|
2757
|
+
get columnNames(): string[];
|
|
2758
|
+
get rowsRead(): number;
|
|
2759
|
+
get rowsWritten(): number;
|
|
2760
|
+
[Symbol.iterator](): IterableIterator<
|
|
2761
|
+
Record<string, (ArrayBuffer | string | number) | null>
|
|
2762
|
+
>;
|
|
2763
|
+
}
|
|
2737
2764
|
interface Socket {
|
|
2738
2765
|
get readable(): ReadableStream;
|
|
2739
2766
|
get writable(): WritableStream;
|
|
@@ -4911,6 +4938,30 @@ type PagesPluginFunction<
|
|
|
4911
4938
|
declare module "assets:*" {
|
|
4912
4939
|
export const onRequest: PagesFunction;
|
|
4913
4940
|
}
|
|
4941
|
+
// Copyright (c) 2022-2023 Cloudflare, Inc.
|
|
4942
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
4943
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
4944
|
+
declare abstract class PipelineTransform {
|
|
4945
|
+
/**
|
|
4946
|
+
* transformJson recieves an array of javascript objects which can be
|
|
4947
|
+
* mutated and returned to the pipeline
|
|
4948
|
+
* @param data The data to be mutated
|
|
4949
|
+
* @returns A promise containing the mutated data
|
|
4950
|
+
*/
|
|
4951
|
+
public transformJson(data: object[]): Promise<object[]>;
|
|
4952
|
+
}
|
|
4953
|
+
// Copyright (c) 2022-2023 Cloudflare, Inc.
|
|
4954
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
4955
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
4956
|
+
interface Pipeline {
|
|
4957
|
+
/**
|
|
4958
|
+
* send takes an array of javascript objects which are
|
|
4959
|
+
* then received by the pipeline for processing
|
|
4960
|
+
*
|
|
4961
|
+
* @param data The data to be sent
|
|
4962
|
+
*/
|
|
4963
|
+
send(data: object[]): Promise<void>;
|
|
4964
|
+
}
|
|
4914
4965
|
// PubSubMessage represents an incoming PubSub message.
|
|
4915
4966
|
// The message includes metadata about the broker, the client, and the payload
|
|
4916
4967
|
// itself.
|
|
@@ -5177,6 +5228,10 @@ declare module "cloudflare:workers" {
|
|
|
5177
5228
|
};
|
|
5178
5229
|
timeout?: string | number;
|
|
5179
5230
|
};
|
|
5231
|
+
export type WorkflowEvent<T> = {
|
|
5232
|
+
payload: T;
|
|
5233
|
+
timestamp: Date;
|
|
5234
|
+
};
|
|
5180
5235
|
export type WorkflowStep = {
|
|
5181
5236
|
do: <T extends Rpc.Serializable>(
|
|
5182
5237
|
name: string,
|
|
@@ -5196,13 +5251,7 @@ declare module "cloudflare:workers" {
|
|
|
5196
5251
|
[Rpc.__WORKFLOW_BRAND]: never;
|
|
5197
5252
|
protected ctx: ExecutionContext;
|
|
5198
5253
|
protected env: Env;
|
|
5199
|
-
run(
|
|
5200
|
-
events: Array<{
|
|
5201
|
-
payload: T;
|
|
5202
|
-
timestamp: Date;
|
|
5203
|
-
}>,
|
|
5204
|
-
step: WorkflowStep,
|
|
5205
|
-
): Promise<unknown>;
|
|
5254
|
+
run(events: Array<WorkflowEvent<T>>, step: WorkflowStep): Promise<unknown>;
|
|
5206
5255
|
}
|
|
5207
5256
|
}
|
|
5208
5257
|
declare module "cloudflare:sockets" {
|
|
@@ -5506,3 +5555,13 @@ interface DispatchNamespace {
|
|
|
5506
5555
|
options?: DynamicDispatchOptions,
|
|
5507
5556
|
): Fetcher;
|
|
5508
5557
|
}
|
|
5558
|
+
/**
|
|
5559
|
+
* NonRetryableError allows for a Workflow to throw a "fatal" error as in,
|
|
5560
|
+
* an error that makes the instance fail immediately without triggering a retry.
|
|
5561
|
+
*/
|
|
5562
|
+
declare class NonRetryableError extends Error {
|
|
5563
|
+
// __brand has been explicity omitted because it's a internal brand used for
|
|
5564
|
+
// the Workflows' engine and user's shouldn't be able to override it
|
|
5565
|
+
// (at least, in a direct way)
|
|
5566
|
+
public constructor(message: string, name?: string);
|
|
5567
|
+
}
|
package/2022-01-31/index.ts
CHANGED
|
@@ -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;
|
|
@@ -386,6 +387,7 @@ export declare const scheduler: Scheduler;
|
|
|
386
387
|
* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/)
|
|
387
388
|
*/
|
|
388
389
|
export declare const performance: Performance;
|
|
390
|
+
export declare const Cloudflare: Cloudflare;
|
|
389
391
|
export declare const origin: string;
|
|
390
392
|
export interface TestController {}
|
|
391
393
|
export interface ExecutionContext {
|
|
@@ -464,6 +466,9 @@ export interface AlarmInvocationInfo {
|
|
|
464
466
|
readonly isRetry: boolean;
|
|
465
467
|
readonly retryCount: number;
|
|
466
468
|
}
|
|
469
|
+
export interface Cloudflare {
|
|
470
|
+
readonly compatibilityFlags: Record<string, boolean>;
|
|
471
|
+
}
|
|
467
472
|
export interface DurableObject {
|
|
468
473
|
fetch(request: Request): Response | Promise<Response>;
|
|
469
474
|
alarm?(): void | Promise<void>;
|
|
@@ -539,6 +544,7 @@ export interface DurableObjectState {
|
|
|
539
544
|
setHibernatableWebSocketEventTimeout(timeoutMs?: number): void;
|
|
540
545
|
getHibernatableWebSocketEventTimeout(): number | null;
|
|
541
546
|
getTags(ws: WebSocket): string[];
|
|
547
|
+
abort(reason?: string): void;
|
|
542
548
|
}
|
|
543
549
|
export interface DurableObjectTransaction {
|
|
544
550
|
get<T = unknown>(
|
|
@@ -605,7 +611,11 @@ export interface DurableObjectStorage {
|
|
|
605
611
|
): Promise<void>;
|
|
606
612
|
deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
|
|
607
613
|
sync(): Promise<void>;
|
|
614
|
+
sql: SqlStorage;
|
|
608
615
|
transactionSync<T>(closure: () => T): T;
|
|
616
|
+
getCurrentBookmark(): Promise<string>;
|
|
617
|
+
getBookmarkForTime(timestamp: number | Date): Promise<string>;
|
|
618
|
+
onNextSessionRestoreBookmark(bookmark: string): Promise<string>;
|
|
609
619
|
}
|
|
610
620
|
export interface DurableObjectListOptions {
|
|
611
621
|
start?: string;
|
|
@@ -2254,15 +2264,15 @@ export declare class TransformStream<I = any, O = any> {
|
|
|
2254
2264
|
}
|
|
2255
2265
|
export declare class FixedLengthStream extends IdentityTransformStream {
|
|
2256
2266
|
constructor(
|
|
2257
|
-
|
|
2258
|
-
|
|
2267
|
+
param1: number | bigint,
|
|
2268
|
+
param2?: IdentityTransformStreamQueuingStrategy,
|
|
2259
2269
|
);
|
|
2260
2270
|
}
|
|
2261
2271
|
export declare class IdentityTransformStream extends TransformStream<
|
|
2262
2272
|
ArrayBuffer | ArrayBufferView,
|
|
2263
2273
|
Uint8Array
|
|
2264
2274
|
> {
|
|
2265
|
-
constructor(
|
|
2275
|
+
constructor(param1?: IdentityTransformStreamQueuingStrategy);
|
|
2266
2276
|
}
|
|
2267
2277
|
export interface IdentityTransformStreamQueuingStrategy {
|
|
2268
2278
|
highWaterMark?: number | bigint;
|
|
@@ -2297,7 +2307,7 @@ export declare class TextDecoderStream extends TransformStream<
|
|
|
2297
2307
|
ArrayBuffer | ArrayBufferView,
|
|
2298
2308
|
string
|
|
2299
2309
|
> {
|
|
2300
|
-
constructor(
|
|
2310
|
+
constructor(param1?: string, param2?: TextDecoderStreamTextDecoderStreamInit);
|
|
2301
2311
|
get encoding(): string;
|
|
2302
2312
|
get fatal(): boolean;
|
|
2303
2313
|
get ignoreBOM(): boolean;
|
|
@@ -2743,6 +2753,23 @@ export declare const WebSocketPair: {
|
|
|
2743
2753
|
1: WebSocket;
|
|
2744
2754
|
};
|
|
2745
2755
|
};
|
|
2756
|
+
export interface SqlStorage {
|
|
2757
|
+
exec(query: string, ...bindings: any[]): SqlStorageCursor;
|
|
2758
|
+
prepare(query: string): SqlStorageStatement;
|
|
2759
|
+
get databaseSize(): number;
|
|
2760
|
+
Cursor: typeof SqlStorageCursor;
|
|
2761
|
+
Statement: typeof SqlStorageStatement;
|
|
2762
|
+
}
|
|
2763
|
+
export declare abstract class SqlStorageStatement {}
|
|
2764
|
+
export declare abstract class SqlStorageCursor {
|
|
2765
|
+
raw(): IterableIterator<((ArrayBuffer | string | number) | null)[]>;
|
|
2766
|
+
get columnNames(): string[];
|
|
2767
|
+
get rowsRead(): number;
|
|
2768
|
+
get rowsWritten(): number;
|
|
2769
|
+
[Symbol.iterator](): IterableIterator<
|
|
2770
|
+
Record<string, (ArrayBuffer | string | number) | null>
|
|
2771
|
+
>;
|
|
2772
|
+
}
|
|
2746
2773
|
export interface Socket {
|
|
2747
2774
|
get readable(): ReadableStream;
|
|
2748
2775
|
get writable(): WritableStream;
|
|
@@ -4923,6 +4950,30 @@ export type PagesPluginFunction<
|
|
|
4923
4950
|
> = (
|
|
4924
4951
|
context: EventPluginContext<Env, Params, Data, PluginArgs>,
|
|
4925
4952
|
) => Response | Promise<Response>;
|
|
4953
|
+
// Copyright (c) 2022-2023 Cloudflare, Inc.
|
|
4954
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
4955
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
4956
|
+
export declare abstract class PipelineTransform {
|
|
4957
|
+
/**
|
|
4958
|
+
* transformJson recieves an array of javascript objects which can be
|
|
4959
|
+
* mutated and returned to the pipeline
|
|
4960
|
+
* @param data The data to be mutated
|
|
4961
|
+
* @returns A promise containing the mutated data
|
|
4962
|
+
*/
|
|
4963
|
+
public transformJson(data: object[]): Promise<object[]>;
|
|
4964
|
+
}
|
|
4965
|
+
// Copyright (c) 2022-2023 Cloudflare, Inc.
|
|
4966
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
4967
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
4968
|
+
export interface Pipeline {
|
|
4969
|
+
/**
|
|
4970
|
+
* send takes an array of javascript objects which are
|
|
4971
|
+
* then received by the pipeline for processing
|
|
4972
|
+
*
|
|
4973
|
+
* @param data The data to be sent
|
|
4974
|
+
*/
|
|
4975
|
+
send(data: object[]): Promise<void>;
|
|
4976
|
+
}
|
|
4926
4977
|
// PubSubMessage represents an incoming PubSub message.
|
|
4927
4978
|
// The message includes metadata about the broker, the client, and the payload
|
|
4928
4979
|
// itself.
|
|
@@ -5419,3 +5470,13 @@ export interface DispatchNamespace {
|
|
|
5419
5470
|
options?: DynamicDispatchOptions,
|
|
5420
5471
|
): Fetcher;
|
|
5421
5472
|
}
|
|
5473
|
+
/**
|
|
5474
|
+
* NonRetryableError allows for a Workflow to throw a "fatal" error as in,
|
|
5475
|
+
* an error that makes the instance fail immediately without triggering a retry.
|
|
5476
|
+
*/
|
|
5477
|
+
export declare class NonRetryableError extends Error {
|
|
5478
|
+
// __brand has been explicity omitted because it's a internal brand used for
|
|
5479
|
+
// the Workflows' engine and user's shouldn't be able to override it
|
|
5480
|
+
// (at least, in a direct way)
|
|
5481
|
+
public constructor(message: string, name?: string);
|
|
5482
|
+
}
|