@cloudflare/workers-types 4.20240903.0 → 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.
@@ -561,6 +561,7 @@ export interface DurableObjectState {
561
561
  setHibernatableWebSocketEventTimeout(timeoutMs?: number): void;
562
562
  getHibernatableWebSocketEventTimeout(): number | null;
563
563
  getTags(ws: WebSocket): string[];
564
+ abort(reason?: string): void;
564
565
  }
565
566
  export interface DurableObjectTransaction {
566
567
  get<T = unknown>(
@@ -627,7 +628,11 @@ export interface DurableObjectStorage {
627
628
  ): Promise<void>;
628
629
  deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
629
630
  sync(): Promise<void>;
631
+ sql: SqlStorage;
630
632
  transactionSync<T>(closure: () => T): T;
633
+ getCurrentBookmark(): Promise<string>;
634
+ getBookmarkForTime(timestamp: number | Date): Promise<string>;
635
+ onNextSessionRestoreBookmark(bookmark: string): Promise<string>;
631
636
  }
632
637
  export interface DurableObjectListOptions {
633
638
  start?: string;
@@ -2765,6 +2770,23 @@ export declare const WebSocketPair: {
2765
2770
  1: WebSocket;
2766
2771
  };
2767
2772
  };
2773
+ export interface SqlStorage {
2774
+ exec(query: string, ...bindings: any[]): SqlStorageCursor;
2775
+ prepare(query: string): SqlStorageStatement;
2776
+ get databaseSize(): number;
2777
+ Cursor: typeof SqlStorageCursor;
2778
+ Statement: typeof SqlStorageStatement;
2779
+ }
2780
+ export declare abstract class SqlStorageStatement {}
2781
+ export declare abstract class SqlStorageCursor {
2782
+ raw(): IterableIterator<((ArrayBuffer | string | number) | null)[]>;
2783
+ get columnNames(): string[];
2784
+ get rowsRead(): number;
2785
+ get rowsWritten(): number;
2786
+ [Symbol.iterator](): IterableIterator<
2787
+ Record<string, (ArrayBuffer | string | number) | null>
2788
+ >;
2789
+ }
2768
2790
  export interface Socket {
2769
2791
  get readable(): ReadableStream;
2770
2792
  get writable(): WritableStream;
@@ -4964,6 +4986,18 @@ export declare abstract class PipelineTransform {
4964
4986
  */
4965
4987
  public transformJson(data: object[]): Promise<object[]>;
4966
4988
  }
4989
+ // Copyright (c) 2022-2023 Cloudflare, Inc.
4990
+ // Licensed under the Apache 2.0 license found in the LICENSE file or at:
4991
+ // https://opensource.org/licenses/Apache-2.0
4992
+ export interface Pipeline {
4993
+ /**
4994
+ * send takes an array of javascript objects which are
4995
+ * then received by the pipeline for processing
4996
+ *
4997
+ * @param data The data to be sent
4998
+ */
4999
+ send(data: object[]): Promise<void>;
5000
+ }
4967
5001
  // PubSubMessage represents an incoming PubSub message.
4968
5002
  // The message includes metadata about the broker, the client, and the payload
4969
5003
  // itself.
@@ -5460,3 +5494,13 @@ export interface DispatchNamespace {
5460
5494
  options?: DynamicDispatchOptions,
5461
5495
  ): Fetcher;
5462
5496
  }
5497
+ /**
5498
+ * NonRetryableError allows for a Workflow to throw a "fatal" error as in,
5499
+ * an error that makes the instance fail immediately without triggering a retry.
5500
+ */
5501
+ export declare class NonRetryableError extends Error {
5502
+ // __brand has been explicity omitted because it's a internal brand used for
5503
+ // the Workflows' engine and user's shouldn't be able to override it
5504
+ // (at least, in a direct way)
5505
+ public constructor(message: string, name?: string);
5506
+ }
@@ -561,6 +561,7 @@ interface DurableObjectState {
561
561
  setHibernatableWebSocketEventTimeout(timeoutMs?: number): void;
562
562
  getHibernatableWebSocketEventTimeout(): number | null;
563
563
  getTags(ws: WebSocket): string[];
564
+ abort(reason?: string): void;
564
565
  }
565
566
  interface DurableObjectTransaction {
566
567
  get<T = unknown>(
@@ -627,7 +628,11 @@ interface DurableObjectStorage {
627
628
  ): Promise<void>;
628
629
  deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
629
630
  sync(): Promise<void>;
631
+ sql: SqlStorage;
630
632
  transactionSync<T>(closure: () => T): T;
633
+ getCurrentBookmark(): Promise<string>;
634
+ getBookmarkForTime(timestamp: number | Date): Promise<string>;
635
+ onNextSessionRestoreBookmark(bookmark: string): Promise<string>;
631
636
  }
632
637
  interface DurableObjectListOptions {
633
638
  start?: string;
@@ -2761,6 +2766,23 @@ declare const WebSocketPair: {
2761
2766
  1: WebSocket;
2762
2767
  };
2763
2768
  };
2769
+ interface SqlStorage {
2770
+ exec(query: string, ...bindings: any[]): SqlStorageCursor;
2771
+ prepare(query: string): SqlStorageStatement;
2772
+ get databaseSize(): number;
2773
+ Cursor: typeof SqlStorageCursor;
2774
+ Statement: typeof SqlStorageStatement;
2775
+ }
2776
+ declare abstract class SqlStorageStatement {}
2777
+ declare abstract class SqlStorageCursor {
2778
+ raw(): IterableIterator<((ArrayBuffer | string | number) | null)[]>;
2779
+ get columnNames(): string[];
2780
+ get rowsRead(): number;
2781
+ get rowsWritten(): number;
2782
+ [Symbol.iterator](): IterableIterator<
2783
+ Record<string, (ArrayBuffer | string | number) | null>
2784
+ >;
2785
+ }
2764
2786
  interface Socket {
2765
2787
  get readable(): ReadableStream;
2766
2788
  get writable(): WritableStream;
@@ -4957,6 +4979,18 @@ declare abstract class PipelineTransform {
4957
4979
  */
4958
4980
  public transformJson(data: object[]): Promise<object[]>;
4959
4981
  }
4982
+ // Copyright (c) 2022-2023 Cloudflare, Inc.
4983
+ // Licensed under the Apache 2.0 license found in the LICENSE file or at:
4984
+ // https://opensource.org/licenses/Apache-2.0
4985
+ interface Pipeline {
4986
+ /**
4987
+ * send takes an array of javascript objects which are
4988
+ * then received by the pipeline for processing
4989
+ *
4990
+ * @param data The data to be sent
4991
+ */
4992
+ send(data: object[]): Promise<void>;
4993
+ }
4960
4994
  // PubSubMessage represents an incoming PubSub message.
4961
4995
  // The message includes metadata about the broker, the client, and the payload
4962
4996
  // itself.
@@ -5550,3 +5584,13 @@ interface DispatchNamespace {
5550
5584
  options?: DynamicDispatchOptions,
5551
5585
  ): Fetcher;
5552
5586
  }
5587
+ /**
5588
+ * NonRetryableError allows for a Workflow to throw a "fatal" error as in,
5589
+ * an error that makes the instance fail immediately without triggering a retry.
5590
+ */
5591
+ declare class NonRetryableError extends Error {
5592
+ // __brand has been explicity omitted because it's a internal brand used for
5593
+ // the Workflows' engine and user's shouldn't be able to override it
5594
+ // (at least, in a direct way)
5595
+ public constructor(message: string, name?: string);
5596
+ }
@@ -566,6 +566,7 @@ export interface DurableObjectState {
566
566
  setHibernatableWebSocketEventTimeout(timeoutMs?: number): void;
567
567
  getHibernatableWebSocketEventTimeout(): number | null;
568
568
  getTags(ws: WebSocket): string[];
569
+ abort(reason?: string): void;
569
570
  }
570
571
  export interface DurableObjectTransaction {
571
572
  get<T = unknown>(
@@ -632,7 +633,11 @@ export interface DurableObjectStorage {
632
633
  ): Promise<void>;
633
634
  deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
634
635
  sync(): Promise<void>;
636
+ sql: SqlStorage;
635
637
  transactionSync<T>(closure: () => T): T;
638
+ getCurrentBookmark(): Promise<string>;
639
+ getBookmarkForTime(timestamp: number | Date): Promise<string>;
640
+ onNextSessionRestoreBookmark(bookmark: string): Promise<string>;
636
641
  }
637
642
  export interface DurableObjectListOptions {
638
643
  start?: string;
@@ -2770,6 +2775,23 @@ export declare const WebSocketPair: {
2770
2775
  1: WebSocket;
2771
2776
  };
2772
2777
  };
2778
+ export interface SqlStorage {
2779
+ exec(query: string, ...bindings: any[]): SqlStorageCursor;
2780
+ prepare(query: string): SqlStorageStatement;
2781
+ get databaseSize(): number;
2782
+ Cursor: typeof SqlStorageCursor;
2783
+ Statement: typeof SqlStorageStatement;
2784
+ }
2785
+ export declare abstract class SqlStorageStatement {}
2786
+ export declare abstract class SqlStorageCursor {
2787
+ raw(): IterableIterator<((ArrayBuffer | string | number) | null)[]>;
2788
+ get columnNames(): string[];
2789
+ get rowsRead(): number;
2790
+ get rowsWritten(): number;
2791
+ [Symbol.iterator](): IterableIterator<
2792
+ Record<string, (ArrayBuffer | string | number) | null>
2793
+ >;
2794
+ }
2773
2795
  export interface Socket {
2774
2796
  get readable(): ReadableStream;
2775
2797
  get writable(): WritableStream;
@@ -4969,6 +4991,18 @@ export declare abstract class PipelineTransform {
4969
4991
  */
4970
4992
  public transformJson(data: object[]): Promise<object[]>;
4971
4993
  }
4994
+ // Copyright (c) 2022-2023 Cloudflare, Inc.
4995
+ // Licensed under the Apache 2.0 license found in the LICENSE file or at:
4996
+ // https://opensource.org/licenses/Apache-2.0
4997
+ export interface Pipeline {
4998
+ /**
4999
+ * send takes an array of javascript objects which are
5000
+ * then received by the pipeline for processing
5001
+ *
5002
+ * @param data The data to be sent
5003
+ */
5004
+ send(data: object[]): Promise<void>;
5005
+ }
4972
5006
  // PubSubMessage represents an incoming PubSub message.
4973
5007
  // The message includes metadata about the broker, the client, and the payload
4974
5008
  // itself.
@@ -5465,3 +5499,13 @@ export interface DispatchNamespace {
5465
5499
  options?: DynamicDispatchOptions,
5466
5500
  ): Fetcher;
5467
5501
  }
5502
+ /**
5503
+ * NonRetryableError allows for a Workflow to throw a "fatal" error as in,
5504
+ * an error that makes the instance fail immediately without triggering a retry.
5505
+ */
5506
+ export declare class NonRetryableError extends Error {
5507
+ // __brand has been explicity omitted because it's a internal brand used for
5508
+ // the Workflows' engine and user's shouldn't be able to override it
5509
+ // (at least, in a direct way)
5510
+ public constructor(message: string, name?: string);
5511
+ }
@@ -561,6 +561,7 @@ interface DurableObjectState {
561
561
  setHibernatableWebSocketEventTimeout(timeoutMs?: number): void;
562
562
  getHibernatableWebSocketEventTimeout(): number | null;
563
563
  getTags(ws: WebSocket): string[];
564
+ abort(reason?: string): void;
564
565
  }
565
566
  interface DurableObjectTransaction {
566
567
  get<T = unknown>(
@@ -627,7 +628,11 @@ interface DurableObjectStorage {
627
628
  ): Promise<void>;
628
629
  deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
629
630
  sync(): Promise<void>;
631
+ sql: SqlStorage;
630
632
  transactionSync<T>(closure: () => T): T;
633
+ getCurrentBookmark(): Promise<string>;
634
+ getBookmarkForTime(timestamp: number | Date): Promise<string>;
635
+ onNextSessionRestoreBookmark(bookmark: string): Promise<string>;
631
636
  }
632
637
  interface DurableObjectListOptions {
633
638
  start?: string;
@@ -2763,6 +2768,23 @@ declare const WebSocketPair: {
2763
2768
  1: WebSocket;
2764
2769
  };
2765
2770
  };
2771
+ interface SqlStorage {
2772
+ exec(query: string, ...bindings: any[]): SqlStorageCursor;
2773
+ prepare(query: string): SqlStorageStatement;
2774
+ get databaseSize(): number;
2775
+ Cursor: typeof SqlStorageCursor;
2776
+ Statement: typeof SqlStorageStatement;
2777
+ }
2778
+ declare abstract class SqlStorageStatement {}
2779
+ declare abstract class SqlStorageCursor {
2780
+ raw(): IterableIterator<((ArrayBuffer | string | number) | null)[]>;
2781
+ get columnNames(): string[];
2782
+ get rowsRead(): number;
2783
+ get rowsWritten(): number;
2784
+ [Symbol.iterator](): IterableIterator<
2785
+ Record<string, (ArrayBuffer | string | number) | null>
2786
+ >;
2787
+ }
2766
2788
  interface Socket {
2767
2789
  get readable(): ReadableStream;
2768
2790
  get writable(): WritableStream;
@@ -4959,6 +4981,18 @@ declare abstract class PipelineTransform {
4959
4981
  */
4960
4982
  public transformJson(data: object[]): Promise<object[]>;
4961
4983
  }
4984
+ // Copyright (c) 2022-2023 Cloudflare, Inc.
4985
+ // Licensed under the Apache 2.0 license found in the LICENSE file or at:
4986
+ // https://opensource.org/licenses/Apache-2.0
4987
+ interface Pipeline {
4988
+ /**
4989
+ * send takes an array of javascript objects which are
4990
+ * then received by the pipeline for processing
4991
+ *
4992
+ * @param data The data to be sent
4993
+ */
4994
+ send(data: object[]): Promise<void>;
4995
+ }
4962
4996
  // PubSubMessage represents an incoming PubSub message.
4963
4997
  // The message includes metadata about the broker, the client, and the payload
4964
4998
  // itself.
@@ -5552,3 +5586,13 @@ interface DispatchNamespace {
5552
5586
  options?: DynamicDispatchOptions,
5553
5587
  ): Fetcher;
5554
5588
  }
5589
+ /**
5590
+ * NonRetryableError allows for a Workflow to throw a "fatal" error as in,
5591
+ * an error that makes the instance fail immediately without triggering a retry.
5592
+ */
5593
+ declare class NonRetryableError extends Error {
5594
+ // __brand has been explicity omitted because it's a internal brand used for
5595
+ // the Workflows' engine and user's shouldn't be able to override it
5596
+ // (at least, in a direct way)
5597
+ public constructor(message: string, name?: string);
5598
+ }
@@ -566,6 +566,7 @@ export interface DurableObjectState {
566
566
  setHibernatableWebSocketEventTimeout(timeoutMs?: number): void;
567
567
  getHibernatableWebSocketEventTimeout(): number | null;
568
568
  getTags(ws: WebSocket): string[];
569
+ abort(reason?: string): void;
569
570
  }
570
571
  export interface DurableObjectTransaction {
571
572
  get<T = unknown>(
@@ -632,7 +633,11 @@ export interface DurableObjectStorage {
632
633
  ): Promise<void>;
633
634
  deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
634
635
  sync(): Promise<void>;
636
+ sql: SqlStorage;
635
637
  transactionSync<T>(closure: () => T): T;
638
+ getCurrentBookmark(): Promise<string>;
639
+ getBookmarkForTime(timestamp: number | Date): Promise<string>;
640
+ onNextSessionRestoreBookmark(bookmark: string): Promise<string>;
636
641
  }
637
642
  export interface DurableObjectListOptions {
638
643
  start?: string;
@@ -2772,6 +2777,23 @@ export declare const WebSocketPair: {
2772
2777
  1: WebSocket;
2773
2778
  };
2774
2779
  };
2780
+ export interface SqlStorage {
2781
+ exec(query: string, ...bindings: any[]): SqlStorageCursor;
2782
+ prepare(query: string): SqlStorageStatement;
2783
+ get databaseSize(): number;
2784
+ Cursor: typeof SqlStorageCursor;
2785
+ Statement: typeof SqlStorageStatement;
2786
+ }
2787
+ export declare abstract class SqlStorageStatement {}
2788
+ export declare abstract class SqlStorageCursor {
2789
+ raw(): IterableIterator<((ArrayBuffer | string | number) | null)[]>;
2790
+ get columnNames(): string[];
2791
+ get rowsRead(): number;
2792
+ get rowsWritten(): number;
2793
+ [Symbol.iterator](): IterableIterator<
2794
+ Record<string, (ArrayBuffer | string | number) | null>
2795
+ >;
2796
+ }
2775
2797
  export interface Socket {
2776
2798
  get readable(): ReadableStream;
2777
2799
  get writable(): WritableStream;
@@ -4971,6 +4993,18 @@ export declare abstract class PipelineTransform {
4971
4993
  */
4972
4994
  public transformJson(data: object[]): Promise<object[]>;
4973
4995
  }
4996
+ // Copyright (c) 2022-2023 Cloudflare, Inc.
4997
+ // Licensed under the Apache 2.0 license found in the LICENSE file or at:
4998
+ // https://opensource.org/licenses/Apache-2.0
4999
+ export interface Pipeline {
5000
+ /**
5001
+ * send takes an array of javascript objects which are
5002
+ * then received by the pipeline for processing
5003
+ *
5004
+ * @param data The data to be sent
5005
+ */
5006
+ send(data: object[]): Promise<void>;
5007
+ }
4974
5008
  // PubSubMessage represents an incoming PubSub message.
4975
5009
  // The message includes metadata about the broker, the client, and the payload
4976
5010
  // itself.
@@ -5467,3 +5501,13 @@ export interface DispatchNamespace {
5467
5501
  options?: DynamicDispatchOptions,
5468
5502
  ): Fetcher;
5469
5503
  }
5504
+ /**
5505
+ * NonRetryableError allows for a Workflow to throw a "fatal" error as in,
5506
+ * an error that makes the instance fail immediately without triggering a retry.
5507
+ */
5508
+ export declare class NonRetryableError extends Error {
5509
+ // __brand has been explicity omitted because it's a internal brand used for
5510
+ // the Workflows' engine and user's shouldn't be able to override it
5511
+ // (at least, in a direct way)
5512
+ public constructor(message: string, name?: string);
5513
+ }
@@ -561,6 +561,7 @@ interface DurableObjectState {
561
561
  setHibernatableWebSocketEventTimeout(timeoutMs?: number): void;
562
562
  getHibernatableWebSocketEventTimeout(): number | null;
563
563
  getTags(ws: WebSocket): string[];
564
+ abort(reason?: string): void;
564
565
  }
565
566
  interface DurableObjectTransaction {
566
567
  get<T = unknown>(
@@ -627,7 +628,11 @@ interface DurableObjectStorage {
627
628
  ): Promise<void>;
628
629
  deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
629
630
  sync(): Promise<void>;
631
+ sql: SqlStorage;
630
632
  transactionSync<T>(closure: () => T): T;
633
+ getCurrentBookmark(): Promise<string>;
634
+ getBookmarkForTime(timestamp: number | Date): Promise<string>;
635
+ onNextSessionRestoreBookmark(bookmark: string): Promise<string>;
631
636
  }
632
637
  interface DurableObjectListOptions {
633
638
  start?: string;
@@ -2763,6 +2768,23 @@ declare const WebSocketPair: {
2763
2768
  1: WebSocket;
2764
2769
  };
2765
2770
  };
2771
+ interface SqlStorage {
2772
+ exec(query: string, ...bindings: any[]): SqlStorageCursor;
2773
+ prepare(query: string): SqlStorageStatement;
2774
+ get databaseSize(): number;
2775
+ Cursor: typeof SqlStorageCursor;
2776
+ Statement: typeof SqlStorageStatement;
2777
+ }
2778
+ declare abstract class SqlStorageStatement {}
2779
+ declare abstract class SqlStorageCursor {
2780
+ raw(): IterableIterator<((ArrayBuffer | string | number) | null)[]>;
2781
+ get columnNames(): string[];
2782
+ get rowsRead(): number;
2783
+ get rowsWritten(): number;
2784
+ [Symbol.iterator](): IterableIterator<
2785
+ Record<string, (ArrayBuffer | string | number) | null>
2786
+ >;
2787
+ }
2766
2788
  interface Socket {
2767
2789
  get readable(): ReadableStream;
2768
2790
  get writable(): WritableStream;
@@ -4959,6 +4981,18 @@ declare abstract class PipelineTransform {
4959
4981
  */
4960
4982
  public transformJson(data: object[]): Promise<object[]>;
4961
4983
  }
4984
+ // Copyright (c) 2022-2023 Cloudflare, Inc.
4985
+ // Licensed under the Apache 2.0 license found in the LICENSE file or at:
4986
+ // https://opensource.org/licenses/Apache-2.0
4987
+ interface Pipeline {
4988
+ /**
4989
+ * send takes an array of javascript objects which are
4990
+ * then received by the pipeline for processing
4991
+ *
4992
+ * @param data The data to be sent
4993
+ */
4994
+ send(data: object[]): Promise<void>;
4995
+ }
4962
4996
  // PubSubMessage represents an incoming PubSub message.
4963
4997
  // The message includes metadata about the broker, the client, and the payload
4964
4998
  // itself.
@@ -5552,3 +5586,13 @@ interface DispatchNamespace {
5552
5586
  options?: DynamicDispatchOptions,
5553
5587
  ): Fetcher;
5554
5588
  }
5589
+ /**
5590
+ * NonRetryableError allows for a Workflow to throw a "fatal" error as in,
5591
+ * an error that makes the instance fail immediately without triggering a retry.
5592
+ */
5593
+ declare class NonRetryableError extends Error {
5594
+ // __brand has been explicity omitted because it's a internal brand used for
5595
+ // the Workflows' engine and user's shouldn't be able to override it
5596
+ // (at least, in a direct way)
5597
+ public constructor(message: string, name?: string);
5598
+ }
@@ -566,6 +566,7 @@ export interface DurableObjectState {
566
566
  setHibernatableWebSocketEventTimeout(timeoutMs?: number): void;
567
567
  getHibernatableWebSocketEventTimeout(): number | null;
568
568
  getTags(ws: WebSocket): string[];
569
+ abort(reason?: string): void;
569
570
  }
570
571
  export interface DurableObjectTransaction {
571
572
  get<T = unknown>(
@@ -632,7 +633,11 @@ export interface DurableObjectStorage {
632
633
  ): Promise<void>;
633
634
  deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
634
635
  sync(): Promise<void>;
636
+ sql: SqlStorage;
635
637
  transactionSync<T>(closure: () => T): T;
638
+ getCurrentBookmark(): Promise<string>;
639
+ getBookmarkForTime(timestamp: number | Date): Promise<string>;
640
+ onNextSessionRestoreBookmark(bookmark: string): Promise<string>;
636
641
  }
637
642
  export interface DurableObjectListOptions {
638
643
  start?: string;
@@ -2772,6 +2777,23 @@ export declare const WebSocketPair: {
2772
2777
  1: WebSocket;
2773
2778
  };
2774
2779
  };
2780
+ export interface SqlStorage {
2781
+ exec(query: string, ...bindings: any[]): SqlStorageCursor;
2782
+ prepare(query: string): SqlStorageStatement;
2783
+ get databaseSize(): number;
2784
+ Cursor: typeof SqlStorageCursor;
2785
+ Statement: typeof SqlStorageStatement;
2786
+ }
2787
+ export declare abstract class SqlStorageStatement {}
2788
+ export declare abstract class SqlStorageCursor {
2789
+ raw(): IterableIterator<((ArrayBuffer | string | number) | null)[]>;
2790
+ get columnNames(): string[];
2791
+ get rowsRead(): number;
2792
+ get rowsWritten(): number;
2793
+ [Symbol.iterator](): IterableIterator<
2794
+ Record<string, (ArrayBuffer | string | number) | null>
2795
+ >;
2796
+ }
2775
2797
  export interface Socket {
2776
2798
  get readable(): ReadableStream;
2777
2799
  get writable(): WritableStream;
@@ -4971,6 +4993,18 @@ export declare abstract class PipelineTransform {
4971
4993
  */
4972
4994
  public transformJson(data: object[]): Promise<object[]>;
4973
4995
  }
4996
+ // Copyright (c) 2022-2023 Cloudflare, Inc.
4997
+ // Licensed under the Apache 2.0 license found in the LICENSE file or at:
4998
+ // https://opensource.org/licenses/Apache-2.0
4999
+ export interface Pipeline {
5000
+ /**
5001
+ * send takes an array of javascript objects which are
5002
+ * then received by the pipeline for processing
5003
+ *
5004
+ * @param data The data to be sent
5005
+ */
5006
+ send(data: object[]): Promise<void>;
5007
+ }
4974
5008
  // PubSubMessage represents an incoming PubSub message.
4975
5009
  // The message includes metadata about the broker, the client, and the payload
4976
5010
  // itself.
@@ -5467,3 +5501,13 @@ export interface DispatchNamespace {
5467
5501
  options?: DynamicDispatchOptions,
5468
5502
  ): Fetcher;
5469
5503
  }
5504
+ /**
5505
+ * NonRetryableError allows for a Workflow to throw a "fatal" error as in,
5506
+ * an error that makes the instance fail immediately without triggering a retry.
5507
+ */
5508
+ export declare class NonRetryableError extends Error {
5509
+ // __brand has been explicity omitted because it's a internal brand used for
5510
+ // the Workflows' engine and user's shouldn't be able to override it
5511
+ // (at least, in a direct way)
5512
+ public constructor(message: string, name?: string);
5513
+ }
@@ -5042,6 +5042,18 @@ declare abstract class PipelineTransform {
5042
5042
  */
5043
5043
  public transformJson(data: object[]): Promise<object[]>;
5044
5044
  }
5045
+ // Copyright (c) 2022-2023 Cloudflare, Inc.
5046
+ // Licensed under the Apache 2.0 license found in the LICENSE file or at:
5047
+ // https://opensource.org/licenses/Apache-2.0
5048
+ interface Pipeline {
5049
+ /**
5050
+ * send takes an array of javascript objects which are
5051
+ * then received by the pipeline for processing
5052
+ *
5053
+ * @param data The data to be sent
5054
+ */
5055
+ send(data: object[]): Promise<void>;
5056
+ }
5045
5057
  // PubSubMessage represents an incoming PubSub message.
5046
5058
  // The message includes metadata about the broker, the client, and the payload
5047
5059
  // itself.
@@ -5635,3 +5647,13 @@ interface DispatchNamespace {
5635
5647
  options?: DynamicDispatchOptions,
5636
5648
  ): Fetcher;
5637
5649
  }
5650
+ /**
5651
+ * NonRetryableError allows for a Workflow to throw a "fatal" error as in,
5652
+ * an error that makes the instance fail immediately without triggering a retry.
5653
+ */
5654
+ declare class NonRetryableError extends Error {
5655
+ // __brand has been explicity omitted because it's a internal brand used for
5656
+ // the Workflows' engine and user's shouldn't be able to override it
5657
+ // (at least, in a direct way)
5658
+ public constructor(message: string, name?: string);
5659
+ }
@@ -5054,6 +5054,18 @@ export declare abstract class PipelineTransform {
5054
5054
  */
5055
5055
  public transformJson(data: object[]): Promise<object[]>;
5056
5056
  }
5057
+ // Copyright (c) 2022-2023 Cloudflare, Inc.
5058
+ // Licensed under the Apache 2.0 license found in the LICENSE file or at:
5059
+ // https://opensource.org/licenses/Apache-2.0
5060
+ export interface Pipeline {
5061
+ /**
5062
+ * send takes an array of javascript objects which are
5063
+ * then received by the pipeline for processing
5064
+ *
5065
+ * @param data The data to be sent
5066
+ */
5067
+ send(data: object[]): Promise<void>;
5068
+ }
5057
5069
  // PubSubMessage represents an incoming PubSub message.
5058
5070
  // The message includes metadata about the broker, the client, and the payload
5059
5071
  // itself.
@@ -5550,3 +5562,13 @@ export interface DispatchNamespace {
5550
5562
  options?: DynamicDispatchOptions,
5551
5563
  ): Fetcher;
5552
5564
  }
5565
+ /**
5566
+ * NonRetryableError allows for a Workflow to throw a "fatal" error as in,
5567
+ * an error that makes the instance fail immediately without triggering a retry.
5568
+ */
5569
+ export declare class NonRetryableError extends Error {
5570
+ // __brand has been explicity omitted because it's a internal brand used for
5571
+ // the Workflows' engine and user's shouldn't be able to override it
5572
+ // (at least, in a direct way)
5573
+ public constructor(message: string, name?: string);
5574
+ }
package/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;
@@ -2713,6 +2718,23 @@ declare const WebSocketPair: {
2713
2718
  1: WebSocket;
2714
2719
  };
2715
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
+ }
2716
2738
  interface Socket {
2717
2739
  get readable(): ReadableStream;
2718
2740
  get writable(): WritableStream;
@@ -4902,6 +4924,18 @@ declare abstract class PipelineTransform {
4902
4924
  */
4903
4925
  public transformJson(data: object[]): Promise<object[]>;
4904
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
+ }
4905
4939
  // PubSubMessage represents an incoming PubSub message.
4906
4940
  // The message includes metadata about the broker, the client, and the payload
4907
4941
  // itself.
@@ -5495,3 +5529,13 @@ interface DispatchNamespace {
5495
5529
  options?: DynamicDispatchOptions,
5496
5530
  ): Fetcher;
5497
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
+ }