@cloudflare/workers-types 4.20240903.0 → 4.20240919.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 +114 -6
- package/2021-11-03/index.ts +101 -6
- package/2022-01-31/index.d.ts +114 -6
- package/2022-01-31/index.ts +101 -6
- package/2022-03-21/index.d.ts +114 -6
- package/2022-03-21/index.ts +101 -6
- package/2022-08-04/index.d.ts +114 -6
- package/2022-08-04/index.ts +101 -6
- package/2022-10-31/index.d.ts +114 -6
- package/2022-10-31/index.ts +101 -6
- package/2022-11-30/index.d.ts +114 -6
- package/2022-11-30/index.ts +101 -6
- package/2023-03-01/index.d.ts +114 -6
- package/2023-03-01/index.ts +101 -6
- package/2023-07-01/index.d.ts +114 -6
- package/2023-07-01/index.ts +101 -6
- package/experimental/index.d.ts +99 -12
- package/experimental/index.ts +86 -12
- package/index.d.ts +114 -6
- package/index.ts +101 -6
- package/oldest/index.d.ts +114 -6
- package/oldest/index.ts +101 -6
- package/package.json +1 -1
package/2021-11-03/index.d.ts
CHANGED
|
@@ -539,6 +539,7 @@ interface DurableObjectState {
|
|
|
539
539
|
setHibernatableWebSocketEventTimeout(timeoutMs?: number): void;
|
|
540
540
|
getHibernatableWebSocketEventTimeout(): number | null;
|
|
541
541
|
getTags(ws: WebSocket): string[];
|
|
542
|
+
abort(reason?: string): void;
|
|
542
543
|
}
|
|
543
544
|
interface DurableObjectTransaction {
|
|
544
545
|
get<T = unknown>(
|
|
@@ -605,7 +606,11 @@ interface DurableObjectStorage {
|
|
|
605
606
|
): Promise<void>;
|
|
606
607
|
deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
|
|
607
608
|
sync(): Promise<void>;
|
|
609
|
+
sql: SqlStorage;
|
|
608
610
|
transactionSync<T>(closure: () => T): T;
|
|
611
|
+
getCurrentBookmark(): Promise<string>;
|
|
612
|
+
getBookmarkForTime(timestamp: number | Date): Promise<string>;
|
|
613
|
+
onNextSessionRestoreBookmark(bookmark: string): Promise<string>;
|
|
609
614
|
}
|
|
610
615
|
interface DurableObjectListOptions {
|
|
611
616
|
start?: string;
|
|
@@ -1513,7 +1518,11 @@ declare abstract class Body {
|
|
|
1513
1518
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response)
|
|
1514
1519
|
*/
|
|
1515
1520
|
declare class Response extends Body {
|
|
1516
|
-
constructor(
|
|
1521
|
+
constructor(
|
|
1522
|
+
body?: BodyInit | null,
|
|
1523
|
+
init?: ResponseInit,
|
|
1524
|
+
webSocket?: WebSocket,
|
|
1525
|
+
);
|
|
1517
1526
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/redirect_static) */
|
|
1518
1527
|
static redirect(url: string, status?: number): Response;
|
|
1519
1528
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/json_static) */
|
|
@@ -1540,7 +1549,7 @@ interface ResponseInit {
|
|
|
1540
1549
|
statusText?: string;
|
|
1541
1550
|
headers?: HeadersInit;
|
|
1542
1551
|
cf?: any;
|
|
1543
|
-
webSocket?: WebSocket
|
|
1552
|
+
webSocket?: WebSocket;
|
|
1544
1553
|
encodeBody?: "automatic" | "manual";
|
|
1545
1554
|
}
|
|
1546
1555
|
type RequestInfo<CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>> =
|
|
@@ -2247,15 +2256,15 @@ declare class TransformStream<I = any, O = any> {
|
|
|
2247
2256
|
}
|
|
2248
2257
|
declare class FixedLengthStream extends IdentityTransformStream {
|
|
2249
2258
|
constructor(
|
|
2250
|
-
|
|
2251
|
-
|
|
2259
|
+
expectedLength: number | bigint,
|
|
2260
|
+
queuingStrategy?: IdentityTransformStreamQueuingStrategy,
|
|
2252
2261
|
);
|
|
2253
2262
|
}
|
|
2254
2263
|
declare class IdentityTransformStream extends TransformStream<
|
|
2255
2264
|
ArrayBuffer | ArrayBufferView,
|
|
2256
2265
|
Uint8Array
|
|
2257
2266
|
> {
|
|
2258
|
-
constructor(
|
|
2267
|
+
constructor(queuingStrategy?: IdentityTransformStreamQueuingStrategy);
|
|
2259
2268
|
}
|
|
2260
2269
|
interface IdentityTransformStreamQueuingStrategy {
|
|
2261
2270
|
highWaterMark?: number | bigint;
|
|
@@ -2713,6 +2722,26 @@ declare const WebSocketPair: {
|
|
|
2713
2722
|
1: WebSocket;
|
|
2714
2723
|
};
|
|
2715
2724
|
};
|
|
2725
|
+
interface SqlStorage {
|
|
2726
|
+
exec<T extends Record<string, SqlStorageValue>>(
|
|
2727
|
+
query: string,
|
|
2728
|
+
...bindings: any[]
|
|
2729
|
+
): SqlStorageCursor<T>;
|
|
2730
|
+
get databaseSize(): number;
|
|
2731
|
+
Cursor: typeof SqlStorageCursor;
|
|
2732
|
+
Statement: typeof SqlStorageStatement;
|
|
2733
|
+
}
|
|
2734
|
+
declare abstract class SqlStorageStatement {}
|
|
2735
|
+
type SqlStorageValue = ArrayBuffer | string | number | null;
|
|
2736
|
+
declare abstract class SqlStorageCursor<
|
|
2737
|
+
T extends Record<string, SqlStorageValue>,
|
|
2738
|
+
> {
|
|
2739
|
+
raw<U extends SqlStorageValue[]>(): IterableIterator<U>;
|
|
2740
|
+
get columnNames(): string[];
|
|
2741
|
+
get rowsRead(): number;
|
|
2742
|
+
get rowsWritten(): number;
|
|
2743
|
+
[Symbol.iterator](): IterableIterator<T>;
|
|
2744
|
+
}
|
|
2716
2745
|
interface Socket {
|
|
2717
2746
|
get readable(): ReadableStream;
|
|
2718
2747
|
get writable(): WritableStream;
|
|
@@ -3243,7 +3272,7 @@ interface GPUOrigin3DDict {
|
|
|
3243
3272
|
z?: number;
|
|
3244
3273
|
}
|
|
3245
3274
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource) */
|
|
3246
|
-
declare class EventSource {
|
|
3275
|
+
declare class EventSource extends EventTarget {
|
|
3247
3276
|
constructor(url: string, init?: EventSourceEventSourceInit);
|
|
3248
3277
|
/**
|
|
3249
3278
|
* Aborts any instances of the fetch algorithm started for this EventSource object, and sets the readyState attribute to CLOSED.
|
|
@@ -4902,6 +4931,18 @@ declare abstract class PipelineTransform {
|
|
|
4902
4931
|
*/
|
|
4903
4932
|
public transformJson(data: object[]): Promise<object[]>;
|
|
4904
4933
|
}
|
|
4934
|
+
// Copyright (c) 2022-2023 Cloudflare, Inc.
|
|
4935
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
4936
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
4937
|
+
interface Pipeline {
|
|
4938
|
+
/**
|
|
4939
|
+
* send takes an array of javascript objects which are
|
|
4940
|
+
* then received by the pipeline for processing
|
|
4941
|
+
*
|
|
4942
|
+
* @param data The data to be sent
|
|
4943
|
+
*/
|
|
4944
|
+
send(data: object[]): Promise<void>;
|
|
4945
|
+
}
|
|
4905
4946
|
// PubSubMessage represents an incoming PubSub message.
|
|
4906
4947
|
// The message includes metadata about the broker, the client, and the payload
|
|
4907
4948
|
// itself.
|
|
@@ -5495,3 +5536,70 @@ interface DispatchNamespace {
|
|
|
5495
5536
|
options?: DynamicDispatchOptions,
|
|
5496
5537
|
): Fetcher;
|
|
5497
5538
|
}
|
|
5539
|
+
/**
|
|
5540
|
+
* NonRetryableError allows for a user to throw a fatal error
|
|
5541
|
+
* that makes a Workflow instance fail immediately without triggering a retry
|
|
5542
|
+
*/
|
|
5543
|
+
declare module "cloudflare:workflows" {
|
|
5544
|
+
export abstract class NonRetryableError extends Error {
|
|
5545
|
+
/**
|
|
5546
|
+
* `__brand` is used to differentiate between `NonRetryableError` and `Error`
|
|
5547
|
+
* and is omitted from the constructor because users should not set it
|
|
5548
|
+
*/
|
|
5549
|
+
public constructor(message: string, name?: string);
|
|
5550
|
+
}
|
|
5551
|
+
}
|
|
5552
|
+
declare abstract class Workflow {
|
|
5553
|
+
/**
|
|
5554
|
+
* Get a handle to an existing instance of the Workflow.
|
|
5555
|
+
* @param id Id for the instance of this Workflow
|
|
5556
|
+
* @returns A promise that resolves with a handle for the Instance
|
|
5557
|
+
*/
|
|
5558
|
+
public get(id: string): Promise<Instance>;
|
|
5559
|
+
/**
|
|
5560
|
+
* Create a new instance and return a handle to it. If a provided id exists, an error will be thrown.
|
|
5561
|
+
* @param id Id to create the instance of this Workflow with
|
|
5562
|
+
* @param params The payload to send over to this instance
|
|
5563
|
+
* @returns A promise that resolves with a handle for the Instance
|
|
5564
|
+
*/
|
|
5565
|
+
public create(id: string, params: object): Promise<Instance>;
|
|
5566
|
+
}
|
|
5567
|
+
type InstanceStatus = {
|
|
5568
|
+
status:
|
|
5569
|
+
| "queued"
|
|
5570
|
+
| "running"
|
|
5571
|
+
| "paused"
|
|
5572
|
+
| "errored"
|
|
5573
|
+
| "terminated"
|
|
5574
|
+
| "complete"
|
|
5575
|
+
| "unknown";
|
|
5576
|
+
error?: string;
|
|
5577
|
+
output?: object;
|
|
5578
|
+
};
|
|
5579
|
+
interface WorkflowError {
|
|
5580
|
+
code?: number;
|
|
5581
|
+
message: string;
|
|
5582
|
+
}
|
|
5583
|
+
declare abstract class Instance {
|
|
5584
|
+
public id: string;
|
|
5585
|
+
/**
|
|
5586
|
+
* Pause the instance.
|
|
5587
|
+
*/
|
|
5588
|
+
public pause(): Promise<void>;
|
|
5589
|
+
/**
|
|
5590
|
+
* Resume the instance. If it is already running, an error will be thrown.
|
|
5591
|
+
*/
|
|
5592
|
+
public resume(): Promise<void>;
|
|
5593
|
+
/**
|
|
5594
|
+
* Abort the instance. If it is errored, terminated or complete, an error will be thrown.
|
|
5595
|
+
*/
|
|
5596
|
+
public abort(): Promise<void>;
|
|
5597
|
+
/**
|
|
5598
|
+
* Restart the instance.
|
|
5599
|
+
*/
|
|
5600
|
+
public restart(): Promise<void>;
|
|
5601
|
+
/**
|
|
5602
|
+
* Returns the current status of the instance.
|
|
5603
|
+
*/
|
|
5604
|
+
public status(): Promise<InstanceStatus>;
|
|
5605
|
+
}
|
package/2021-11-03/index.ts
CHANGED
|
@@ -544,6 +544,7 @@ export interface DurableObjectState {
|
|
|
544
544
|
setHibernatableWebSocketEventTimeout(timeoutMs?: number): void;
|
|
545
545
|
getHibernatableWebSocketEventTimeout(): number | null;
|
|
546
546
|
getTags(ws: WebSocket): string[];
|
|
547
|
+
abort(reason?: string): void;
|
|
547
548
|
}
|
|
548
549
|
export interface DurableObjectTransaction {
|
|
549
550
|
get<T = unknown>(
|
|
@@ -610,7 +611,11 @@ export interface DurableObjectStorage {
|
|
|
610
611
|
): Promise<void>;
|
|
611
612
|
deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
|
|
612
613
|
sync(): Promise<void>;
|
|
614
|
+
sql: SqlStorage;
|
|
613
615
|
transactionSync<T>(closure: () => T): T;
|
|
616
|
+
getCurrentBookmark(): Promise<string>;
|
|
617
|
+
getBookmarkForTime(timestamp: number | Date): Promise<string>;
|
|
618
|
+
onNextSessionRestoreBookmark(bookmark: string): Promise<string>;
|
|
614
619
|
}
|
|
615
620
|
export interface DurableObjectListOptions {
|
|
616
621
|
start?: string;
|
|
@@ -1518,7 +1523,11 @@ export declare abstract class Body {
|
|
|
1518
1523
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response)
|
|
1519
1524
|
*/
|
|
1520
1525
|
export declare class Response extends Body {
|
|
1521
|
-
constructor(
|
|
1526
|
+
constructor(
|
|
1527
|
+
body?: BodyInit | null,
|
|
1528
|
+
init?: ResponseInit,
|
|
1529
|
+
webSocket?: WebSocket,
|
|
1530
|
+
);
|
|
1522
1531
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/redirect_static) */
|
|
1523
1532
|
static redirect(url: string, status?: number): Response;
|
|
1524
1533
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/json_static) */
|
|
@@ -1545,7 +1554,7 @@ export interface ResponseInit {
|
|
|
1545
1554
|
statusText?: string;
|
|
1546
1555
|
headers?: HeadersInit;
|
|
1547
1556
|
cf?: any;
|
|
1548
|
-
webSocket?: WebSocket
|
|
1557
|
+
webSocket?: WebSocket;
|
|
1549
1558
|
encodeBody?: "automatic" | "manual";
|
|
1550
1559
|
}
|
|
1551
1560
|
export type RequestInfo<
|
|
@@ -2253,15 +2262,15 @@ export declare class TransformStream<I = any, O = any> {
|
|
|
2253
2262
|
}
|
|
2254
2263
|
export declare class FixedLengthStream extends IdentityTransformStream {
|
|
2255
2264
|
constructor(
|
|
2256
|
-
|
|
2257
|
-
|
|
2265
|
+
expectedLength: number | bigint,
|
|
2266
|
+
queuingStrategy?: IdentityTransformStreamQueuingStrategy,
|
|
2258
2267
|
);
|
|
2259
2268
|
}
|
|
2260
2269
|
export declare class IdentityTransformStream extends TransformStream<
|
|
2261
2270
|
ArrayBuffer | ArrayBufferView,
|
|
2262
2271
|
Uint8Array
|
|
2263
2272
|
> {
|
|
2264
|
-
constructor(
|
|
2273
|
+
constructor(queuingStrategy?: IdentityTransformStreamQueuingStrategy);
|
|
2265
2274
|
}
|
|
2266
2275
|
export interface IdentityTransformStreamQueuingStrategy {
|
|
2267
2276
|
highWaterMark?: number | bigint;
|
|
@@ -2722,6 +2731,26 @@ export declare const WebSocketPair: {
|
|
|
2722
2731
|
1: WebSocket;
|
|
2723
2732
|
};
|
|
2724
2733
|
};
|
|
2734
|
+
export interface SqlStorage {
|
|
2735
|
+
exec<T extends Record<string, SqlStorageValue>>(
|
|
2736
|
+
query: string,
|
|
2737
|
+
...bindings: any[]
|
|
2738
|
+
): SqlStorageCursor<T>;
|
|
2739
|
+
get databaseSize(): number;
|
|
2740
|
+
Cursor: typeof SqlStorageCursor;
|
|
2741
|
+
Statement: typeof SqlStorageStatement;
|
|
2742
|
+
}
|
|
2743
|
+
export declare abstract class SqlStorageStatement {}
|
|
2744
|
+
export type SqlStorageValue = ArrayBuffer | string | number | null;
|
|
2745
|
+
export declare abstract class SqlStorageCursor<
|
|
2746
|
+
T extends Record<string, SqlStorageValue>,
|
|
2747
|
+
> {
|
|
2748
|
+
raw<U extends SqlStorageValue[]>(): IterableIterator<U>;
|
|
2749
|
+
get columnNames(): string[];
|
|
2750
|
+
get rowsRead(): number;
|
|
2751
|
+
get rowsWritten(): number;
|
|
2752
|
+
[Symbol.iterator](): IterableIterator<T>;
|
|
2753
|
+
}
|
|
2725
2754
|
export interface Socket {
|
|
2726
2755
|
get readable(): ReadableStream;
|
|
2727
2756
|
get writable(): WritableStream;
|
|
@@ -3252,7 +3281,7 @@ export interface GPUOrigin3DDict {
|
|
|
3252
3281
|
z?: number;
|
|
3253
3282
|
}
|
|
3254
3283
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource) */
|
|
3255
|
-
export declare class EventSource {
|
|
3284
|
+
export declare class EventSource extends EventTarget {
|
|
3256
3285
|
constructor(url: string, init?: EventSourceEventSourceInit);
|
|
3257
3286
|
/**
|
|
3258
3287
|
* Aborts any instances of the fetch algorithm started for this EventSource object, and sets the readyState attribute to CLOSED.
|
|
@@ -4914,6 +4943,18 @@ export declare abstract class PipelineTransform {
|
|
|
4914
4943
|
*/
|
|
4915
4944
|
public transformJson(data: object[]): Promise<object[]>;
|
|
4916
4945
|
}
|
|
4946
|
+
// Copyright (c) 2022-2023 Cloudflare, Inc.
|
|
4947
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
4948
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
4949
|
+
export interface Pipeline {
|
|
4950
|
+
/**
|
|
4951
|
+
* send takes an array of javascript objects which are
|
|
4952
|
+
* then received by the pipeline for processing
|
|
4953
|
+
*
|
|
4954
|
+
* @param data The data to be sent
|
|
4955
|
+
*/
|
|
4956
|
+
send(data: object[]): Promise<void>;
|
|
4957
|
+
}
|
|
4917
4958
|
// PubSubMessage represents an incoming PubSub message.
|
|
4918
4959
|
// The message includes metadata about the broker, the client, and the payload
|
|
4919
4960
|
// itself.
|
|
@@ -5410,3 +5451,57 @@ export interface DispatchNamespace {
|
|
|
5410
5451
|
options?: DynamicDispatchOptions,
|
|
5411
5452
|
): Fetcher;
|
|
5412
5453
|
}
|
|
5454
|
+
export declare abstract class Workflow {
|
|
5455
|
+
/**
|
|
5456
|
+
* Get a handle to an existing instance of the Workflow.
|
|
5457
|
+
* @param id Id for the instance of this Workflow
|
|
5458
|
+
* @returns A promise that resolves with a handle for the Instance
|
|
5459
|
+
*/
|
|
5460
|
+
public get(id: string): Promise<Instance>;
|
|
5461
|
+
/**
|
|
5462
|
+
* Create a new instance and return a handle to it. If a provided id exists, an error will be thrown.
|
|
5463
|
+
* @param id Id to create the instance of this Workflow with
|
|
5464
|
+
* @param params The payload to send over to this instance
|
|
5465
|
+
* @returns A promise that resolves with a handle for the Instance
|
|
5466
|
+
*/
|
|
5467
|
+
public create(id: string, params: object): Promise<Instance>;
|
|
5468
|
+
}
|
|
5469
|
+
export type InstanceStatus = {
|
|
5470
|
+
status:
|
|
5471
|
+
| "queued"
|
|
5472
|
+
| "running"
|
|
5473
|
+
| "paused"
|
|
5474
|
+
| "errored"
|
|
5475
|
+
| "terminated"
|
|
5476
|
+
| "complete"
|
|
5477
|
+
| "unknown";
|
|
5478
|
+
error?: string;
|
|
5479
|
+
output?: object;
|
|
5480
|
+
};
|
|
5481
|
+
export interface WorkflowError {
|
|
5482
|
+
code?: number;
|
|
5483
|
+
message: string;
|
|
5484
|
+
}
|
|
5485
|
+
export declare abstract class Instance {
|
|
5486
|
+
public id: string;
|
|
5487
|
+
/**
|
|
5488
|
+
* Pause the instance.
|
|
5489
|
+
*/
|
|
5490
|
+
public pause(): Promise<void>;
|
|
5491
|
+
/**
|
|
5492
|
+
* Resume the instance. If it is already running, an error will be thrown.
|
|
5493
|
+
*/
|
|
5494
|
+
public resume(): Promise<void>;
|
|
5495
|
+
/**
|
|
5496
|
+
* Abort the instance. If it is errored, terminated or complete, an error will be thrown.
|
|
5497
|
+
*/
|
|
5498
|
+
public abort(): Promise<void>;
|
|
5499
|
+
/**
|
|
5500
|
+
* Restart the instance.
|
|
5501
|
+
*/
|
|
5502
|
+
public restart(): Promise<void>;
|
|
5503
|
+
/**
|
|
5504
|
+
* Returns the current status of the instance.
|
|
5505
|
+
*/
|
|
5506
|
+
public status(): Promise<InstanceStatus>;
|
|
5507
|
+
}
|
package/2022-01-31/index.d.ts
CHANGED
|
@@ -539,6 +539,7 @@ interface DurableObjectState {
|
|
|
539
539
|
setHibernatableWebSocketEventTimeout(timeoutMs?: number): void;
|
|
540
540
|
getHibernatableWebSocketEventTimeout(): number | null;
|
|
541
541
|
getTags(ws: WebSocket): string[];
|
|
542
|
+
abort(reason?: string): void;
|
|
542
543
|
}
|
|
543
544
|
interface DurableObjectTransaction {
|
|
544
545
|
get<T = unknown>(
|
|
@@ -605,7 +606,11 @@ interface DurableObjectStorage {
|
|
|
605
606
|
): Promise<void>;
|
|
606
607
|
deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
|
|
607
608
|
sync(): Promise<void>;
|
|
609
|
+
sql: SqlStorage;
|
|
608
610
|
transactionSync<T>(closure: () => T): T;
|
|
611
|
+
getCurrentBookmark(): Promise<string>;
|
|
612
|
+
getBookmarkForTime(timestamp: number | Date): Promise<string>;
|
|
613
|
+
onNextSessionRestoreBookmark(bookmark: string): Promise<string>;
|
|
609
614
|
}
|
|
610
615
|
interface DurableObjectListOptions {
|
|
611
616
|
start?: string;
|
|
@@ -1519,7 +1524,11 @@ declare abstract class Body {
|
|
|
1519
1524
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response)
|
|
1520
1525
|
*/
|
|
1521
1526
|
declare class Response extends Body {
|
|
1522
|
-
constructor(
|
|
1527
|
+
constructor(
|
|
1528
|
+
body?: BodyInit | null,
|
|
1529
|
+
init?: ResponseInit,
|
|
1530
|
+
webSocket?: WebSocket,
|
|
1531
|
+
);
|
|
1523
1532
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/redirect_static) */
|
|
1524
1533
|
static redirect(url: string, status?: number): Response;
|
|
1525
1534
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/json_static) */
|
|
@@ -1546,7 +1555,7 @@ interface ResponseInit {
|
|
|
1546
1555
|
statusText?: string;
|
|
1547
1556
|
headers?: HeadersInit;
|
|
1548
1557
|
cf?: any;
|
|
1549
|
-
webSocket?: WebSocket
|
|
1558
|
+
webSocket?: WebSocket;
|
|
1550
1559
|
encodeBody?: "automatic" | "manual";
|
|
1551
1560
|
}
|
|
1552
1561
|
type RequestInfo<CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>> =
|
|
@@ -2253,15 +2262,15 @@ declare class TransformStream<I = any, O = any> {
|
|
|
2253
2262
|
}
|
|
2254
2263
|
declare class FixedLengthStream extends IdentityTransformStream {
|
|
2255
2264
|
constructor(
|
|
2256
|
-
|
|
2257
|
-
|
|
2265
|
+
expectedLength: number | bigint,
|
|
2266
|
+
queuingStrategy?: IdentityTransformStreamQueuingStrategy,
|
|
2258
2267
|
);
|
|
2259
2268
|
}
|
|
2260
2269
|
declare class IdentityTransformStream extends TransformStream<
|
|
2261
2270
|
ArrayBuffer | ArrayBufferView,
|
|
2262
2271
|
Uint8Array
|
|
2263
2272
|
> {
|
|
2264
|
-
constructor(
|
|
2273
|
+
constructor(queuingStrategy?: IdentityTransformStreamQueuingStrategy);
|
|
2265
2274
|
}
|
|
2266
2275
|
interface IdentityTransformStreamQueuingStrategy {
|
|
2267
2276
|
highWaterMark?: number | bigint;
|
|
@@ -2739,6 +2748,26 @@ declare const WebSocketPair: {
|
|
|
2739
2748
|
1: WebSocket;
|
|
2740
2749
|
};
|
|
2741
2750
|
};
|
|
2751
|
+
interface SqlStorage {
|
|
2752
|
+
exec<T extends Record<string, SqlStorageValue>>(
|
|
2753
|
+
query: string,
|
|
2754
|
+
...bindings: any[]
|
|
2755
|
+
): SqlStorageCursor<T>;
|
|
2756
|
+
get databaseSize(): number;
|
|
2757
|
+
Cursor: typeof SqlStorageCursor;
|
|
2758
|
+
Statement: typeof SqlStorageStatement;
|
|
2759
|
+
}
|
|
2760
|
+
declare abstract class SqlStorageStatement {}
|
|
2761
|
+
type SqlStorageValue = ArrayBuffer | string | number | null;
|
|
2762
|
+
declare abstract class SqlStorageCursor<
|
|
2763
|
+
T extends Record<string, SqlStorageValue>,
|
|
2764
|
+
> {
|
|
2765
|
+
raw<U extends SqlStorageValue[]>(): IterableIterator<U>;
|
|
2766
|
+
get columnNames(): string[];
|
|
2767
|
+
get rowsRead(): number;
|
|
2768
|
+
get rowsWritten(): number;
|
|
2769
|
+
[Symbol.iterator](): IterableIterator<T>;
|
|
2770
|
+
}
|
|
2742
2771
|
interface Socket {
|
|
2743
2772
|
get readable(): ReadableStream;
|
|
2744
2773
|
get writable(): WritableStream;
|
|
@@ -3269,7 +3298,7 @@ interface GPUOrigin3DDict {
|
|
|
3269
3298
|
z?: number;
|
|
3270
3299
|
}
|
|
3271
3300
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource) */
|
|
3272
|
-
declare class EventSource {
|
|
3301
|
+
declare class EventSource extends EventTarget {
|
|
3273
3302
|
constructor(url: string, init?: EventSourceEventSourceInit);
|
|
3274
3303
|
/**
|
|
3275
3304
|
* Aborts any instances of the fetch algorithm started for this EventSource object, and sets the readyState attribute to CLOSED.
|
|
@@ -4928,6 +4957,18 @@ declare abstract class PipelineTransform {
|
|
|
4928
4957
|
*/
|
|
4929
4958
|
public transformJson(data: object[]): Promise<object[]>;
|
|
4930
4959
|
}
|
|
4960
|
+
// Copyright (c) 2022-2023 Cloudflare, Inc.
|
|
4961
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
4962
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
4963
|
+
interface Pipeline {
|
|
4964
|
+
/**
|
|
4965
|
+
* send takes an array of javascript objects which are
|
|
4966
|
+
* then received by the pipeline for processing
|
|
4967
|
+
*
|
|
4968
|
+
* @param data The data to be sent
|
|
4969
|
+
*/
|
|
4970
|
+
send(data: object[]): Promise<void>;
|
|
4971
|
+
}
|
|
4931
4972
|
// PubSubMessage represents an incoming PubSub message.
|
|
4932
4973
|
// The message includes metadata about the broker, the client, and the payload
|
|
4933
4974
|
// itself.
|
|
@@ -5521,3 +5562,70 @@ interface DispatchNamespace {
|
|
|
5521
5562
|
options?: DynamicDispatchOptions,
|
|
5522
5563
|
): Fetcher;
|
|
5523
5564
|
}
|
|
5565
|
+
/**
|
|
5566
|
+
* NonRetryableError allows for a user to throw a fatal error
|
|
5567
|
+
* that makes a Workflow instance fail immediately without triggering a retry
|
|
5568
|
+
*/
|
|
5569
|
+
declare module "cloudflare:workflows" {
|
|
5570
|
+
export abstract class NonRetryableError extends Error {
|
|
5571
|
+
/**
|
|
5572
|
+
* `__brand` is used to differentiate between `NonRetryableError` and `Error`
|
|
5573
|
+
* and is omitted from the constructor because users should not set it
|
|
5574
|
+
*/
|
|
5575
|
+
public constructor(message: string, name?: string);
|
|
5576
|
+
}
|
|
5577
|
+
}
|
|
5578
|
+
declare abstract class Workflow {
|
|
5579
|
+
/**
|
|
5580
|
+
* Get a handle to an existing instance of the Workflow.
|
|
5581
|
+
* @param id Id for the instance of this Workflow
|
|
5582
|
+
* @returns A promise that resolves with a handle for the Instance
|
|
5583
|
+
*/
|
|
5584
|
+
public get(id: string): Promise<Instance>;
|
|
5585
|
+
/**
|
|
5586
|
+
* Create a new instance and return a handle to it. If a provided id exists, an error will be thrown.
|
|
5587
|
+
* @param id Id to create the instance of this Workflow with
|
|
5588
|
+
* @param params The payload to send over to this instance
|
|
5589
|
+
* @returns A promise that resolves with a handle for the Instance
|
|
5590
|
+
*/
|
|
5591
|
+
public create(id: string, params: object): Promise<Instance>;
|
|
5592
|
+
}
|
|
5593
|
+
type InstanceStatus = {
|
|
5594
|
+
status:
|
|
5595
|
+
| "queued"
|
|
5596
|
+
| "running"
|
|
5597
|
+
| "paused"
|
|
5598
|
+
| "errored"
|
|
5599
|
+
| "terminated"
|
|
5600
|
+
| "complete"
|
|
5601
|
+
| "unknown";
|
|
5602
|
+
error?: string;
|
|
5603
|
+
output?: object;
|
|
5604
|
+
};
|
|
5605
|
+
interface WorkflowError {
|
|
5606
|
+
code?: number;
|
|
5607
|
+
message: string;
|
|
5608
|
+
}
|
|
5609
|
+
declare abstract class Instance {
|
|
5610
|
+
public id: string;
|
|
5611
|
+
/**
|
|
5612
|
+
* Pause the instance.
|
|
5613
|
+
*/
|
|
5614
|
+
public pause(): Promise<void>;
|
|
5615
|
+
/**
|
|
5616
|
+
* Resume the instance. If it is already running, an error will be thrown.
|
|
5617
|
+
*/
|
|
5618
|
+
public resume(): Promise<void>;
|
|
5619
|
+
/**
|
|
5620
|
+
* Abort the instance. If it is errored, terminated or complete, an error will be thrown.
|
|
5621
|
+
*/
|
|
5622
|
+
public abort(): Promise<void>;
|
|
5623
|
+
/**
|
|
5624
|
+
* Restart the instance.
|
|
5625
|
+
*/
|
|
5626
|
+
public restart(): Promise<void>;
|
|
5627
|
+
/**
|
|
5628
|
+
* Returns the current status of the instance.
|
|
5629
|
+
*/
|
|
5630
|
+
public status(): Promise<InstanceStatus>;
|
|
5631
|
+
}
|