@cloudflare/workers-types 4.20240909.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 +84 -20
- package/2021-11-03/index.ts +73 -22
- package/2022-01-31/index.d.ts +84 -20
- package/2022-01-31/index.ts +73 -22
- package/2022-03-21/index.d.ts +84 -20
- package/2022-03-21/index.ts +73 -22
- package/2022-08-04/index.d.ts +84 -20
- package/2022-08-04/index.ts +73 -22
- package/2022-10-31/index.d.ts +84 -20
- package/2022-10-31/index.ts +73 -22
- package/2022-11-30/index.d.ts +84 -20
- package/2022-11-30/index.ts +73 -22
- package/2023-03-01/index.d.ts +84 -20
- package/2023-03-01/index.ts +73 -22
- package/2023-07-01/index.d.ts +84 -20
- package/2023-07-01/index.ts +73 -22
- package/experimental/index.d.ts +84 -19
- package/experimental/index.ts +73 -21
- package/index.d.ts +84 -20
- package/index.ts +73 -22
- package/oldest/index.d.ts +84 -20
- package/oldest/index.ts +73 -22
- package/package.json +1 -1
package/2021-11-03/index.d.ts
CHANGED
|
@@ -1518,7 +1518,11 @@ declare abstract class Body {
|
|
|
1518
1518
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response)
|
|
1519
1519
|
*/
|
|
1520
1520
|
declare class Response extends Body {
|
|
1521
|
-
constructor(
|
|
1521
|
+
constructor(
|
|
1522
|
+
body?: BodyInit | null,
|
|
1523
|
+
init?: ResponseInit,
|
|
1524
|
+
webSocket?: WebSocket,
|
|
1525
|
+
);
|
|
1522
1526
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/redirect_static) */
|
|
1523
1527
|
static redirect(url: string, status?: number): Response;
|
|
1524
1528
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/json_static) */
|
|
@@ -1545,7 +1549,7 @@ interface ResponseInit {
|
|
|
1545
1549
|
statusText?: string;
|
|
1546
1550
|
headers?: HeadersInit;
|
|
1547
1551
|
cf?: any;
|
|
1548
|
-
webSocket?: WebSocket
|
|
1552
|
+
webSocket?: WebSocket;
|
|
1549
1553
|
encodeBody?: "automatic" | "manual";
|
|
1550
1554
|
}
|
|
1551
1555
|
type RequestInfo<CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>> =
|
|
@@ -2252,15 +2256,15 @@ declare class TransformStream<I = any, O = any> {
|
|
|
2252
2256
|
}
|
|
2253
2257
|
declare class FixedLengthStream extends IdentityTransformStream {
|
|
2254
2258
|
constructor(
|
|
2255
|
-
|
|
2256
|
-
|
|
2259
|
+
expectedLength: number | bigint,
|
|
2260
|
+
queuingStrategy?: IdentityTransformStreamQueuingStrategy,
|
|
2257
2261
|
);
|
|
2258
2262
|
}
|
|
2259
2263
|
declare class IdentityTransformStream extends TransformStream<
|
|
2260
2264
|
ArrayBuffer | ArrayBufferView,
|
|
2261
2265
|
Uint8Array
|
|
2262
2266
|
> {
|
|
2263
|
-
constructor(
|
|
2267
|
+
constructor(queuingStrategy?: IdentityTransformStreamQueuingStrategy);
|
|
2264
2268
|
}
|
|
2265
2269
|
interface IdentityTransformStreamQueuingStrategy {
|
|
2266
2270
|
highWaterMark?: number | bigint;
|
|
@@ -2719,21 +2723,24 @@ declare const WebSocketPair: {
|
|
|
2719
2723
|
};
|
|
2720
2724
|
};
|
|
2721
2725
|
interface SqlStorage {
|
|
2722
|
-
exec
|
|
2723
|
-
|
|
2726
|
+
exec<T extends Record<string, SqlStorageValue>>(
|
|
2727
|
+
query: string,
|
|
2728
|
+
...bindings: any[]
|
|
2729
|
+
): SqlStorageCursor<T>;
|
|
2724
2730
|
get databaseSize(): number;
|
|
2725
2731
|
Cursor: typeof SqlStorageCursor;
|
|
2726
2732
|
Statement: typeof SqlStorageStatement;
|
|
2727
2733
|
}
|
|
2728
2734
|
declare abstract class SqlStorageStatement {}
|
|
2729
|
-
|
|
2730
|
-
|
|
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>;
|
|
2731
2740
|
get columnNames(): string[];
|
|
2732
2741
|
get rowsRead(): number;
|
|
2733
2742
|
get rowsWritten(): number;
|
|
2734
|
-
[Symbol.iterator](): IterableIterator<
|
|
2735
|
-
Record<string, (ArrayBuffer | string | number) | null>
|
|
2736
|
-
>;
|
|
2743
|
+
[Symbol.iterator](): IterableIterator<T>;
|
|
2737
2744
|
}
|
|
2738
2745
|
interface Socket {
|
|
2739
2746
|
get readable(): ReadableStream;
|
|
@@ -3265,7 +3272,7 @@ interface GPUOrigin3DDict {
|
|
|
3265
3272
|
z?: number;
|
|
3266
3273
|
}
|
|
3267
3274
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource) */
|
|
3268
|
-
declare class EventSource {
|
|
3275
|
+
declare class EventSource extends EventTarget {
|
|
3269
3276
|
constructor(url: string, init?: EventSourceEventSourceInit);
|
|
3270
3277
|
/**
|
|
3271
3278
|
* Aborts any instances of the fetch algorithm started for this EventSource object, and sets the readyState attribute to CLOSED.
|
|
@@ -5530,12 +5537,69 @@ interface DispatchNamespace {
|
|
|
5530
5537
|
): Fetcher;
|
|
5531
5538
|
}
|
|
5532
5539
|
/**
|
|
5533
|
-
* NonRetryableError allows for a
|
|
5534
|
-
*
|
|
5540
|
+
* NonRetryableError allows for a user to throw a fatal error
|
|
5541
|
+
* that makes a Workflow instance fail immediately without triggering a retry
|
|
5535
5542
|
*/
|
|
5536
|
-
declare
|
|
5537
|
-
|
|
5538
|
-
|
|
5539
|
-
|
|
5540
|
-
|
|
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>;
|
|
5541
5605
|
}
|
package/2021-11-03/index.ts
CHANGED
|
@@ -1523,7 +1523,11 @@ export declare abstract class Body {
|
|
|
1523
1523
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response)
|
|
1524
1524
|
*/
|
|
1525
1525
|
export declare class Response extends Body {
|
|
1526
|
-
constructor(
|
|
1526
|
+
constructor(
|
|
1527
|
+
body?: BodyInit | null,
|
|
1528
|
+
init?: ResponseInit,
|
|
1529
|
+
webSocket?: WebSocket,
|
|
1530
|
+
);
|
|
1527
1531
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/redirect_static) */
|
|
1528
1532
|
static redirect(url: string, status?: number): Response;
|
|
1529
1533
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/json_static) */
|
|
@@ -1550,7 +1554,7 @@ export interface ResponseInit {
|
|
|
1550
1554
|
statusText?: string;
|
|
1551
1555
|
headers?: HeadersInit;
|
|
1552
1556
|
cf?: any;
|
|
1553
|
-
webSocket?: WebSocket
|
|
1557
|
+
webSocket?: WebSocket;
|
|
1554
1558
|
encodeBody?: "automatic" | "manual";
|
|
1555
1559
|
}
|
|
1556
1560
|
export type RequestInfo<
|
|
@@ -2258,15 +2262,15 @@ export declare class TransformStream<I = any, O = any> {
|
|
|
2258
2262
|
}
|
|
2259
2263
|
export declare class FixedLengthStream extends IdentityTransformStream {
|
|
2260
2264
|
constructor(
|
|
2261
|
-
|
|
2262
|
-
|
|
2265
|
+
expectedLength: number | bigint,
|
|
2266
|
+
queuingStrategy?: IdentityTransformStreamQueuingStrategy,
|
|
2263
2267
|
);
|
|
2264
2268
|
}
|
|
2265
2269
|
export declare class IdentityTransformStream extends TransformStream<
|
|
2266
2270
|
ArrayBuffer | ArrayBufferView,
|
|
2267
2271
|
Uint8Array
|
|
2268
2272
|
> {
|
|
2269
|
-
constructor(
|
|
2273
|
+
constructor(queuingStrategy?: IdentityTransformStreamQueuingStrategy);
|
|
2270
2274
|
}
|
|
2271
2275
|
export interface IdentityTransformStreamQueuingStrategy {
|
|
2272
2276
|
highWaterMark?: number | bigint;
|
|
@@ -2728,21 +2732,24 @@ export declare const WebSocketPair: {
|
|
|
2728
2732
|
};
|
|
2729
2733
|
};
|
|
2730
2734
|
export interface SqlStorage {
|
|
2731
|
-
exec
|
|
2732
|
-
|
|
2735
|
+
exec<T extends Record<string, SqlStorageValue>>(
|
|
2736
|
+
query: string,
|
|
2737
|
+
...bindings: any[]
|
|
2738
|
+
): SqlStorageCursor<T>;
|
|
2733
2739
|
get databaseSize(): number;
|
|
2734
2740
|
Cursor: typeof SqlStorageCursor;
|
|
2735
2741
|
Statement: typeof SqlStorageStatement;
|
|
2736
2742
|
}
|
|
2737
2743
|
export declare abstract class SqlStorageStatement {}
|
|
2738
|
-
export
|
|
2739
|
-
|
|
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>;
|
|
2740
2749
|
get columnNames(): string[];
|
|
2741
2750
|
get rowsRead(): number;
|
|
2742
2751
|
get rowsWritten(): number;
|
|
2743
|
-
[Symbol.iterator](): IterableIterator<
|
|
2744
|
-
Record<string, (ArrayBuffer | string | number) | null>
|
|
2745
|
-
>;
|
|
2752
|
+
[Symbol.iterator](): IterableIterator<T>;
|
|
2746
2753
|
}
|
|
2747
2754
|
export interface Socket {
|
|
2748
2755
|
get readable(): ReadableStream;
|
|
@@ -3274,7 +3281,7 @@ export interface GPUOrigin3DDict {
|
|
|
3274
3281
|
z?: number;
|
|
3275
3282
|
}
|
|
3276
3283
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource) */
|
|
3277
|
-
export declare class EventSource {
|
|
3284
|
+
export declare class EventSource extends EventTarget {
|
|
3278
3285
|
constructor(url: string, init?: EventSourceEventSourceInit);
|
|
3279
3286
|
/**
|
|
3280
3287
|
* Aborts any instances of the fetch algorithm started for this EventSource object, and sets the readyState attribute to CLOSED.
|
|
@@ -5444,13 +5451,57 @@ export interface DispatchNamespace {
|
|
|
5444
5451
|
options?: DynamicDispatchOptions,
|
|
5445
5452
|
): Fetcher;
|
|
5446
5453
|
}
|
|
5447
|
-
|
|
5448
|
-
|
|
5449
|
-
|
|
5450
|
-
|
|
5451
|
-
|
|
5452
|
-
|
|
5453
|
-
|
|
5454
|
-
|
|
5455
|
-
|
|
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>;
|
|
5456
5507
|
}
|
package/2022-01-31/index.d.ts
CHANGED
|
@@ -1524,7 +1524,11 @@ declare abstract class Body {
|
|
|
1524
1524
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response)
|
|
1525
1525
|
*/
|
|
1526
1526
|
declare class Response extends Body {
|
|
1527
|
-
constructor(
|
|
1527
|
+
constructor(
|
|
1528
|
+
body?: BodyInit | null,
|
|
1529
|
+
init?: ResponseInit,
|
|
1530
|
+
webSocket?: WebSocket,
|
|
1531
|
+
);
|
|
1528
1532
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/redirect_static) */
|
|
1529
1533
|
static redirect(url: string, status?: number): Response;
|
|
1530
1534
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/json_static) */
|
|
@@ -1551,7 +1555,7 @@ interface ResponseInit {
|
|
|
1551
1555
|
statusText?: string;
|
|
1552
1556
|
headers?: HeadersInit;
|
|
1553
1557
|
cf?: any;
|
|
1554
|
-
webSocket?: WebSocket
|
|
1558
|
+
webSocket?: WebSocket;
|
|
1555
1559
|
encodeBody?: "automatic" | "manual";
|
|
1556
1560
|
}
|
|
1557
1561
|
type RequestInfo<CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>> =
|
|
@@ -2258,15 +2262,15 @@ declare class TransformStream<I = any, O = any> {
|
|
|
2258
2262
|
}
|
|
2259
2263
|
declare class FixedLengthStream extends IdentityTransformStream {
|
|
2260
2264
|
constructor(
|
|
2261
|
-
|
|
2262
|
-
|
|
2265
|
+
expectedLength: number | bigint,
|
|
2266
|
+
queuingStrategy?: IdentityTransformStreamQueuingStrategy,
|
|
2263
2267
|
);
|
|
2264
2268
|
}
|
|
2265
2269
|
declare class IdentityTransformStream extends TransformStream<
|
|
2266
2270
|
ArrayBuffer | ArrayBufferView,
|
|
2267
2271
|
Uint8Array
|
|
2268
2272
|
> {
|
|
2269
|
-
constructor(
|
|
2273
|
+
constructor(queuingStrategy?: IdentityTransformStreamQueuingStrategy);
|
|
2270
2274
|
}
|
|
2271
2275
|
interface IdentityTransformStreamQueuingStrategy {
|
|
2272
2276
|
highWaterMark?: number | bigint;
|
|
@@ -2745,21 +2749,24 @@ declare const WebSocketPair: {
|
|
|
2745
2749
|
};
|
|
2746
2750
|
};
|
|
2747
2751
|
interface SqlStorage {
|
|
2748
|
-
exec
|
|
2749
|
-
|
|
2752
|
+
exec<T extends Record<string, SqlStorageValue>>(
|
|
2753
|
+
query: string,
|
|
2754
|
+
...bindings: any[]
|
|
2755
|
+
): SqlStorageCursor<T>;
|
|
2750
2756
|
get databaseSize(): number;
|
|
2751
2757
|
Cursor: typeof SqlStorageCursor;
|
|
2752
2758
|
Statement: typeof SqlStorageStatement;
|
|
2753
2759
|
}
|
|
2754
2760
|
declare abstract class SqlStorageStatement {}
|
|
2755
|
-
|
|
2756
|
-
|
|
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>;
|
|
2757
2766
|
get columnNames(): string[];
|
|
2758
2767
|
get rowsRead(): number;
|
|
2759
2768
|
get rowsWritten(): number;
|
|
2760
|
-
[Symbol.iterator](): IterableIterator<
|
|
2761
|
-
Record<string, (ArrayBuffer | string | number) | null>
|
|
2762
|
-
>;
|
|
2769
|
+
[Symbol.iterator](): IterableIterator<T>;
|
|
2763
2770
|
}
|
|
2764
2771
|
interface Socket {
|
|
2765
2772
|
get readable(): ReadableStream;
|
|
@@ -3291,7 +3298,7 @@ interface GPUOrigin3DDict {
|
|
|
3291
3298
|
z?: number;
|
|
3292
3299
|
}
|
|
3293
3300
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource) */
|
|
3294
|
-
declare class EventSource {
|
|
3301
|
+
declare class EventSource extends EventTarget {
|
|
3295
3302
|
constructor(url: string, init?: EventSourceEventSourceInit);
|
|
3296
3303
|
/**
|
|
3297
3304
|
* Aborts any instances of the fetch algorithm started for this EventSource object, and sets the readyState attribute to CLOSED.
|
|
@@ -5556,12 +5563,69 @@ interface DispatchNamespace {
|
|
|
5556
5563
|
): Fetcher;
|
|
5557
5564
|
}
|
|
5558
5565
|
/**
|
|
5559
|
-
* NonRetryableError allows for a
|
|
5560
|
-
*
|
|
5566
|
+
* NonRetryableError allows for a user to throw a fatal error
|
|
5567
|
+
* that makes a Workflow instance fail immediately without triggering a retry
|
|
5561
5568
|
*/
|
|
5562
|
-
declare
|
|
5563
|
-
|
|
5564
|
-
|
|
5565
|
-
|
|
5566
|
-
|
|
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>;
|
|
5567
5631
|
}
|
package/2022-01-31/index.ts
CHANGED
|
@@ -1529,7 +1529,11 @@ export declare abstract class Body {
|
|
|
1529
1529
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response)
|
|
1530
1530
|
*/
|
|
1531
1531
|
export declare class Response extends Body {
|
|
1532
|
-
constructor(
|
|
1532
|
+
constructor(
|
|
1533
|
+
body?: BodyInit | null,
|
|
1534
|
+
init?: ResponseInit,
|
|
1535
|
+
webSocket?: WebSocket,
|
|
1536
|
+
);
|
|
1533
1537
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/redirect_static) */
|
|
1534
1538
|
static redirect(url: string, status?: number): Response;
|
|
1535
1539
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/json_static) */
|
|
@@ -1556,7 +1560,7 @@ export interface ResponseInit {
|
|
|
1556
1560
|
statusText?: string;
|
|
1557
1561
|
headers?: HeadersInit;
|
|
1558
1562
|
cf?: any;
|
|
1559
|
-
webSocket?: WebSocket
|
|
1563
|
+
webSocket?: WebSocket;
|
|
1560
1564
|
encodeBody?: "automatic" | "manual";
|
|
1561
1565
|
}
|
|
1562
1566
|
export type RequestInfo<
|
|
@@ -2264,15 +2268,15 @@ export declare class TransformStream<I = any, O = any> {
|
|
|
2264
2268
|
}
|
|
2265
2269
|
export declare class FixedLengthStream extends IdentityTransformStream {
|
|
2266
2270
|
constructor(
|
|
2267
|
-
|
|
2268
|
-
|
|
2271
|
+
expectedLength: number | bigint,
|
|
2272
|
+
queuingStrategy?: IdentityTransformStreamQueuingStrategy,
|
|
2269
2273
|
);
|
|
2270
2274
|
}
|
|
2271
2275
|
export declare class IdentityTransformStream extends TransformStream<
|
|
2272
2276
|
ArrayBuffer | ArrayBufferView,
|
|
2273
2277
|
Uint8Array
|
|
2274
2278
|
> {
|
|
2275
|
-
constructor(
|
|
2279
|
+
constructor(queuingStrategy?: IdentityTransformStreamQueuingStrategy);
|
|
2276
2280
|
}
|
|
2277
2281
|
export interface IdentityTransformStreamQueuingStrategy {
|
|
2278
2282
|
highWaterMark?: number | bigint;
|
|
@@ -2754,21 +2758,24 @@ export declare const WebSocketPair: {
|
|
|
2754
2758
|
};
|
|
2755
2759
|
};
|
|
2756
2760
|
export interface SqlStorage {
|
|
2757
|
-
exec
|
|
2758
|
-
|
|
2761
|
+
exec<T extends Record<string, SqlStorageValue>>(
|
|
2762
|
+
query: string,
|
|
2763
|
+
...bindings: any[]
|
|
2764
|
+
): SqlStorageCursor<T>;
|
|
2759
2765
|
get databaseSize(): number;
|
|
2760
2766
|
Cursor: typeof SqlStorageCursor;
|
|
2761
2767
|
Statement: typeof SqlStorageStatement;
|
|
2762
2768
|
}
|
|
2763
2769
|
export declare abstract class SqlStorageStatement {}
|
|
2764
|
-
export
|
|
2765
|
-
|
|
2770
|
+
export type SqlStorageValue = ArrayBuffer | string | number | null;
|
|
2771
|
+
export declare abstract class SqlStorageCursor<
|
|
2772
|
+
T extends Record<string, SqlStorageValue>,
|
|
2773
|
+
> {
|
|
2774
|
+
raw<U extends SqlStorageValue[]>(): IterableIterator<U>;
|
|
2766
2775
|
get columnNames(): string[];
|
|
2767
2776
|
get rowsRead(): number;
|
|
2768
2777
|
get rowsWritten(): number;
|
|
2769
|
-
[Symbol.iterator](): IterableIterator<
|
|
2770
|
-
Record<string, (ArrayBuffer | string | number) | null>
|
|
2771
|
-
>;
|
|
2778
|
+
[Symbol.iterator](): IterableIterator<T>;
|
|
2772
2779
|
}
|
|
2773
2780
|
export interface Socket {
|
|
2774
2781
|
get readable(): ReadableStream;
|
|
@@ -3300,7 +3307,7 @@ export interface GPUOrigin3DDict {
|
|
|
3300
3307
|
z?: number;
|
|
3301
3308
|
}
|
|
3302
3309
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource) */
|
|
3303
|
-
export declare class EventSource {
|
|
3310
|
+
export declare class EventSource extends EventTarget {
|
|
3304
3311
|
constructor(url: string, init?: EventSourceEventSourceInit);
|
|
3305
3312
|
/**
|
|
3306
3313
|
* Aborts any instances of the fetch algorithm started for this EventSource object, and sets the readyState attribute to CLOSED.
|
|
@@ -5470,13 +5477,57 @@ export interface DispatchNamespace {
|
|
|
5470
5477
|
options?: DynamicDispatchOptions,
|
|
5471
5478
|
): Fetcher;
|
|
5472
5479
|
}
|
|
5473
|
-
|
|
5474
|
-
|
|
5475
|
-
|
|
5476
|
-
|
|
5477
|
-
|
|
5478
|
-
|
|
5479
|
-
|
|
5480
|
-
|
|
5481
|
-
|
|
5480
|
+
export declare abstract class Workflow {
|
|
5481
|
+
/**
|
|
5482
|
+
* Get a handle to an existing instance of the Workflow.
|
|
5483
|
+
* @param id Id for the instance of this Workflow
|
|
5484
|
+
* @returns A promise that resolves with a handle for the Instance
|
|
5485
|
+
*/
|
|
5486
|
+
public get(id: string): Promise<Instance>;
|
|
5487
|
+
/**
|
|
5488
|
+
* Create a new instance and return a handle to it. If a provided id exists, an error will be thrown.
|
|
5489
|
+
* @param id Id to create the instance of this Workflow with
|
|
5490
|
+
* @param params The payload to send over to this instance
|
|
5491
|
+
* @returns A promise that resolves with a handle for the Instance
|
|
5492
|
+
*/
|
|
5493
|
+
public create(id: string, params: object): Promise<Instance>;
|
|
5494
|
+
}
|
|
5495
|
+
export type InstanceStatus = {
|
|
5496
|
+
status:
|
|
5497
|
+
| "queued"
|
|
5498
|
+
| "running"
|
|
5499
|
+
| "paused"
|
|
5500
|
+
| "errored"
|
|
5501
|
+
| "terminated"
|
|
5502
|
+
| "complete"
|
|
5503
|
+
| "unknown";
|
|
5504
|
+
error?: string;
|
|
5505
|
+
output?: object;
|
|
5506
|
+
};
|
|
5507
|
+
export interface WorkflowError {
|
|
5508
|
+
code?: number;
|
|
5509
|
+
message: string;
|
|
5510
|
+
}
|
|
5511
|
+
export declare abstract class Instance {
|
|
5512
|
+
public id: string;
|
|
5513
|
+
/**
|
|
5514
|
+
* Pause the instance.
|
|
5515
|
+
*/
|
|
5516
|
+
public pause(): Promise<void>;
|
|
5517
|
+
/**
|
|
5518
|
+
* Resume the instance. If it is already running, an error will be thrown.
|
|
5519
|
+
*/
|
|
5520
|
+
public resume(): Promise<void>;
|
|
5521
|
+
/**
|
|
5522
|
+
* Abort the instance. If it is errored, terminated or complete, an error will be thrown.
|
|
5523
|
+
*/
|
|
5524
|
+
public abort(): Promise<void>;
|
|
5525
|
+
/**
|
|
5526
|
+
* Restart the instance.
|
|
5527
|
+
*/
|
|
5528
|
+
public restart(): Promise<void>;
|
|
5529
|
+
/**
|
|
5530
|
+
* Returns the current status of the instance.
|
|
5531
|
+
*/
|
|
5532
|
+
public status(): Promise<InstanceStatus>;
|
|
5482
5533
|
}
|