@cloudflare/workers-types 4.20230321.0 → 4.20230404.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.
@@ -353,13 +353,24 @@ declare interface DurableObjectNamespace {
353
353
  id: DurableObjectId,
354
354
  options?: DurableObjectNamespaceGetDurableObjectOptions
355
355
  ): DurableObjectStub;
356
- jurisdiction(jurisdiction: string): DurableObjectNamespace;
356
+ jurisdiction(jurisdiction: DurableObjectJurisdiction): DurableObjectNamespace;
357
357
  }
358
+ declare type DurableObjectJurisdiction = "eu" | "fedramp";
358
359
  declare interface DurableObjectNamespaceNewUniqueIdOptions {
359
- jurisdiction?: string;
360
- }
360
+ jurisdiction?: DurableObjectJurisdiction;
361
+ }
362
+ declare type DurableObjectLocationHint =
363
+ | "wnam"
364
+ | "enam"
365
+ | "sam"
366
+ | "weur"
367
+ | "eeur"
368
+ | "apac"
369
+ | "oc"
370
+ | "afr"
371
+ | "me";
361
372
  declare interface DurableObjectNamespaceGetDurableObjectOptions {
362
- locationHint?: string;
373
+ locationHint?: DurableObjectLocationHint;
363
374
  }
364
375
  declare interface DurableObjectState {
365
376
  waitUntil(promise: Promise<any>): void;
@@ -1309,12 +1320,18 @@ declare interface R2HTTPMetadata {
1309
1320
  cacheControl?: string;
1310
1321
  cacheExpiry?: Date;
1311
1322
  }
1312
- declare interface R2Objects {
1323
+ declare type R2Objects = {
1313
1324
  objects: R2Object[];
1314
- truncated: boolean;
1315
- cursor?: string;
1316
1325
  delimitedPrefixes: string[];
1317
- }
1326
+ } & (
1327
+ | {
1328
+ truncated: true;
1329
+ cursor: string;
1330
+ }
1331
+ | {
1332
+ truncated: false;
1333
+ }
1334
+ );
1318
1335
  declare abstract class ScheduledEvent extends ExtendableEvent {
1319
1336
  readonly scheduledTime: number;
1320
1337
  readonly cron: string;
@@ -1525,13 +1542,19 @@ declare class TransformStream<I = any, O = any> {
1525
1542
  readonly writable: WritableStream<I>;
1526
1543
  }
1527
1544
  declare class FixedLengthStream extends IdentityTransformStream {
1528
- constructor(expectedLength: number | bigint);
1545
+ constructor(
1546
+ expectedLength: number | bigint,
1547
+ queuingStrategy?: IdentityTransformStreamQueuingStrategy
1548
+ );
1529
1549
  }
1530
1550
  declare class IdentityTransformStream extends TransformStream<
1531
1551
  ArrayBuffer | ArrayBufferView,
1532
1552
  Uint8Array
1533
1553
  > {
1534
- constructor();
1554
+ constructor(queuingStrategy?: IdentityTransformStreamQueuingStrategy);
1555
+ }
1556
+ declare interface IdentityTransformStreamQueuingStrategy {
1557
+ highWaterMark?: number | bigint;
1535
1558
  }
1536
1559
  declare interface ReadableStreamValuesOptions {
1537
1560
  preventCancel?: boolean;
@@ -2791,7 +2814,7 @@ declare abstract class D1PreparedStatement {
2791
2814
  raw<T = unknown>(): Promise<T[]>;
2792
2815
  }
2793
2816
  /**
2794
- * A email message that is sent to a consumer Worker.
2817
+ * An email message that can be sent from a Worker.
2795
2818
  */
2796
2819
  declare interface EmailMessage {
2797
2820
  /**
@@ -2802,14 +2825,19 @@ declare interface EmailMessage {
2802
2825
  * Envelope To attribute of the email message.
2803
2826
  */
2804
2827
  readonly to: string;
2805
- /**
2806
- * A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
2807
- */
2808
- readonly headers: Headers;
2828
+ }
2829
+ /**
2830
+ * An email message that is sent to a consumer Worker and can be rejected/forwarded.
2831
+ */
2832
+ declare interface ForwardableEmailMessage extends EmailMessage {
2809
2833
  /**
2810
2834
  * Stream of the email message content.
2811
2835
  */
2812
2836
  readonly raw: ReadableStream;
2837
+ /**
2838
+ * An [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
2839
+ */
2840
+ readonly headers: Headers;
2813
2841
  /**
2814
2842
  * Size of the email message content.
2815
2843
  */
@@ -2828,14 +2856,27 @@ declare interface EmailMessage {
2828
2856
  */
2829
2857
  forward(rcptTo: string, headers?: Headers): Promise<void>;
2830
2858
  }
2859
+ /**
2860
+ * A binding that allows a Worker to send email messages.
2861
+ */
2862
+ declare interface SendEmail {
2863
+ send(message: EmailMessage): Promise<void>;
2864
+ }
2831
2865
  declare abstract class EmailEvent extends ExtendableEvent {
2832
- readonly message: EmailMessage;
2866
+ readonly message: ForwardableEmailMessage;
2833
2867
  }
2834
2868
  declare type EmailExportedHandler<Env = unknown> = (
2835
- message: EmailMessage,
2869
+ message: ForwardableEmailMessage,
2836
2870
  env: Env,
2837
2871
  ctx: ExecutionContext
2838
2872
  ) => void | Promise<void>;
2873
+ declare module "cloudflare:email" {
2874
+ let _EmailMessage: {
2875
+ prototype: EmailMessage;
2876
+ new (from: string, to: string, raw: ReadableStream | string): EmailMessage;
2877
+ };
2878
+ export { _EmailMessage as EmailMessage };
2879
+ }
2839
2880
  declare type Params<P extends string = any> = Record<P, string | string[]>;
2840
2881
  declare type EventContext<Env, P extends string, Data> = {
2841
2882
  request: Request;
@@ -355,13 +355,24 @@ export interface DurableObjectNamespace {
355
355
  id: DurableObjectId,
356
356
  options?: DurableObjectNamespaceGetDurableObjectOptions
357
357
  ): DurableObjectStub;
358
- jurisdiction(jurisdiction: string): DurableObjectNamespace;
358
+ jurisdiction(jurisdiction: DurableObjectJurisdiction): DurableObjectNamespace;
359
359
  }
360
+ export type DurableObjectJurisdiction = "eu" | "fedramp";
360
361
  export interface DurableObjectNamespaceNewUniqueIdOptions {
361
- jurisdiction?: string;
362
- }
362
+ jurisdiction?: DurableObjectJurisdiction;
363
+ }
364
+ export type DurableObjectLocationHint =
365
+ | "wnam"
366
+ | "enam"
367
+ | "sam"
368
+ | "weur"
369
+ | "eeur"
370
+ | "apac"
371
+ | "oc"
372
+ | "afr"
373
+ | "me";
363
374
  export interface DurableObjectNamespaceGetDurableObjectOptions {
364
- locationHint?: string;
375
+ locationHint?: DurableObjectLocationHint;
365
376
  }
366
377
  export interface DurableObjectState {
367
378
  waitUntil(promise: Promise<any>): void;
@@ -1311,12 +1322,18 @@ export interface R2HTTPMetadata {
1311
1322
  cacheControl?: string;
1312
1323
  cacheExpiry?: Date;
1313
1324
  }
1314
- export interface R2Objects {
1325
+ export type R2Objects = {
1315
1326
  objects: R2Object[];
1316
- truncated: boolean;
1317
- cursor?: string;
1318
1327
  delimitedPrefixes: string[];
1319
- }
1328
+ } & (
1329
+ | {
1330
+ truncated: true;
1331
+ cursor: string;
1332
+ }
1333
+ | {
1334
+ truncated: false;
1335
+ }
1336
+ );
1320
1337
  export declare abstract class ScheduledEvent extends ExtendableEvent {
1321
1338
  readonly scheduledTime: number;
1322
1339
  readonly cron: string;
@@ -1527,13 +1544,19 @@ export declare class TransformStream<I = any, O = any> {
1527
1544
  readonly writable: WritableStream<I>;
1528
1545
  }
1529
1546
  export declare class FixedLengthStream extends IdentityTransformStream {
1530
- constructor(expectedLength: number | bigint);
1547
+ constructor(
1548
+ expectedLength: number | bigint,
1549
+ queuingStrategy?: IdentityTransformStreamQueuingStrategy
1550
+ );
1531
1551
  }
1532
1552
  export declare class IdentityTransformStream extends TransformStream<
1533
1553
  ArrayBuffer | ArrayBufferView,
1534
1554
  Uint8Array
1535
1555
  > {
1536
- constructor();
1556
+ constructor(queuingStrategy?: IdentityTransformStreamQueuingStrategy);
1557
+ }
1558
+ export interface IdentityTransformStreamQueuingStrategy {
1559
+ highWaterMark?: number | bigint;
1537
1560
  }
1538
1561
  export interface ReadableStreamValuesOptions {
1539
1562
  preventCancel?: boolean;
@@ -2796,7 +2819,7 @@ export declare abstract class D1PreparedStatement {
2796
2819
  raw<T = unknown>(): Promise<T[]>;
2797
2820
  }
2798
2821
  /**
2799
- * A email message that is sent to a consumer Worker.
2822
+ * An email message that can be sent from a Worker.
2800
2823
  */
2801
2824
  export interface EmailMessage {
2802
2825
  /**
@@ -2807,14 +2830,19 @@ export interface EmailMessage {
2807
2830
  * Envelope To attribute of the email message.
2808
2831
  */
2809
2832
  readonly to: string;
2810
- /**
2811
- * A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
2812
- */
2813
- readonly headers: Headers;
2833
+ }
2834
+ /**
2835
+ * An email message that is sent to a consumer Worker and can be rejected/forwarded.
2836
+ */
2837
+ export interface ForwardableEmailMessage extends EmailMessage {
2814
2838
  /**
2815
2839
  * Stream of the email message content.
2816
2840
  */
2817
2841
  readonly raw: ReadableStream;
2842
+ /**
2843
+ * An [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
2844
+ */
2845
+ readonly headers: Headers;
2818
2846
  /**
2819
2847
  * Size of the email message content.
2820
2848
  */
@@ -2833,11 +2861,17 @@ export interface EmailMessage {
2833
2861
  */
2834
2862
  forward(rcptTo: string, headers?: Headers): Promise<void>;
2835
2863
  }
2864
+ /**
2865
+ * A binding that allows a Worker to send email messages.
2866
+ */
2867
+ export interface SendEmail {
2868
+ send(message: EmailMessage): Promise<void>;
2869
+ }
2836
2870
  export declare abstract class EmailEvent extends ExtendableEvent {
2837
- readonly message: EmailMessage;
2871
+ readonly message: ForwardableEmailMessage;
2838
2872
  }
2839
2873
  export type EmailExportedHandler<Env = unknown> = (
2840
- message: EmailMessage,
2874
+ message: ForwardableEmailMessage,
2841
2875
  env: Env,
2842
2876
  ctx: ExecutionContext
2843
2877
  ) => void | Promise<void>;
@@ -353,13 +353,24 @@ declare interface DurableObjectNamespace {
353
353
  id: DurableObjectId,
354
354
  options?: DurableObjectNamespaceGetDurableObjectOptions
355
355
  ): DurableObjectStub;
356
- jurisdiction(jurisdiction: string): DurableObjectNamespace;
356
+ jurisdiction(jurisdiction: DurableObjectJurisdiction): DurableObjectNamespace;
357
357
  }
358
+ declare type DurableObjectJurisdiction = "eu" | "fedramp";
358
359
  declare interface DurableObjectNamespaceNewUniqueIdOptions {
359
- jurisdiction?: string;
360
- }
360
+ jurisdiction?: DurableObjectJurisdiction;
361
+ }
362
+ declare type DurableObjectLocationHint =
363
+ | "wnam"
364
+ | "enam"
365
+ | "sam"
366
+ | "weur"
367
+ | "eeur"
368
+ | "apac"
369
+ | "oc"
370
+ | "afr"
371
+ | "me";
361
372
  declare interface DurableObjectNamespaceGetDurableObjectOptions {
362
- locationHint?: string;
373
+ locationHint?: DurableObjectLocationHint;
363
374
  }
364
375
  declare interface DurableObjectState {
365
376
  waitUntil(promise: Promise<any>): void;
@@ -1289,12 +1300,18 @@ declare interface R2HTTPMetadata {
1289
1300
  cacheControl?: string;
1290
1301
  cacheExpiry?: Date;
1291
1302
  }
1292
- declare interface R2Objects {
1303
+ declare type R2Objects = {
1293
1304
  objects: R2Object[];
1294
- truncated: boolean;
1295
- cursor?: string;
1296
1305
  delimitedPrefixes: string[];
1297
- }
1306
+ } & (
1307
+ | {
1308
+ truncated: true;
1309
+ cursor: string;
1310
+ }
1311
+ | {
1312
+ truncated: false;
1313
+ }
1314
+ );
1298
1315
  declare abstract class ScheduledEvent extends ExtendableEvent {
1299
1316
  readonly scheduledTime: number;
1300
1317
  readonly cron: string;
@@ -1505,13 +1522,19 @@ declare class TransformStream<I = any, O = any> {
1505
1522
  get writable(): WritableStream<I>;
1506
1523
  }
1507
1524
  declare class FixedLengthStream extends IdentityTransformStream {
1508
- constructor(expectedLength: number | bigint);
1525
+ constructor(
1526
+ expectedLength: number | bigint,
1527
+ queuingStrategy?: IdentityTransformStreamQueuingStrategy
1528
+ );
1509
1529
  }
1510
1530
  declare class IdentityTransformStream extends TransformStream<
1511
1531
  ArrayBuffer | ArrayBufferView,
1512
1532
  Uint8Array
1513
1533
  > {
1514
- constructor();
1534
+ constructor(queuingStrategy?: IdentityTransformStreamQueuingStrategy);
1535
+ }
1536
+ declare interface IdentityTransformStreamQueuingStrategy {
1537
+ highWaterMark?: number | bigint;
1515
1538
  }
1516
1539
  declare interface ReadableStreamValuesOptions {
1517
1540
  preventCancel?: boolean;
@@ -2777,7 +2800,7 @@ declare abstract class D1PreparedStatement {
2777
2800
  raw<T = unknown>(): Promise<T[]>;
2778
2801
  }
2779
2802
  /**
2780
- * A email message that is sent to a consumer Worker.
2803
+ * An email message that can be sent from a Worker.
2781
2804
  */
2782
2805
  declare interface EmailMessage {
2783
2806
  /**
@@ -2788,14 +2811,19 @@ declare interface EmailMessage {
2788
2811
  * Envelope To attribute of the email message.
2789
2812
  */
2790
2813
  readonly to: string;
2791
- /**
2792
- * A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
2793
- */
2794
- readonly headers: Headers;
2814
+ }
2815
+ /**
2816
+ * An email message that is sent to a consumer Worker and can be rejected/forwarded.
2817
+ */
2818
+ declare interface ForwardableEmailMessage extends EmailMessage {
2795
2819
  /**
2796
2820
  * Stream of the email message content.
2797
2821
  */
2798
2822
  readonly raw: ReadableStream;
2823
+ /**
2824
+ * An [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
2825
+ */
2826
+ readonly headers: Headers;
2799
2827
  /**
2800
2828
  * Size of the email message content.
2801
2829
  */
@@ -2814,14 +2842,27 @@ declare interface EmailMessage {
2814
2842
  */
2815
2843
  forward(rcptTo: string, headers?: Headers): Promise<void>;
2816
2844
  }
2845
+ /**
2846
+ * A binding that allows a Worker to send email messages.
2847
+ */
2848
+ declare interface SendEmail {
2849
+ send(message: EmailMessage): Promise<void>;
2850
+ }
2817
2851
  declare abstract class EmailEvent extends ExtendableEvent {
2818
- readonly message: EmailMessage;
2852
+ readonly message: ForwardableEmailMessage;
2819
2853
  }
2820
2854
  declare type EmailExportedHandler<Env = unknown> = (
2821
- message: EmailMessage,
2855
+ message: ForwardableEmailMessage,
2822
2856
  env: Env,
2823
2857
  ctx: ExecutionContext
2824
2858
  ) => void | Promise<void>;
2859
+ declare module "cloudflare:email" {
2860
+ let _EmailMessage: {
2861
+ prototype: EmailMessage;
2862
+ new (from: string, to: string, raw: ReadableStream | string): EmailMessage;
2863
+ };
2864
+ export { _EmailMessage as EmailMessage };
2865
+ }
2825
2866
  declare type Params<P extends string = any> = Record<P, string | string[]>;
2826
2867
  declare type EventContext<Env, P extends string, Data> = {
2827
2868
  request: Request;
@@ -355,13 +355,24 @@ export interface DurableObjectNamespace {
355
355
  id: DurableObjectId,
356
356
  options?: DurableObjectNamespaceGetDurableObjectOptions
357
357
  ): DurableObjectStub;
358
- jurisdiction(jurisdiction: string): DurableObjectNamespace;
358
+ jurisdiction(jurisdiction: DurableObjectJurisdiction): DurableObjectNamespace;
359
359
  }
360
+ export type DurableObjectJurisdiction = "eu" | "fedramp";
360
361
  export interface DurableObjectNamespaceNewUniqueIdOptions {
361
- jurisdiction?: string;
362
- }
362
+ jurisdiction?: DurableObjectJurisdiction;
363
+ }
364
+ export type DurableObjectLocationHint =
365
+ | "wnam"
366
+ | "enam"
367
+ | "sam"
368
+ | "weur"
369
+ | "eeur"
370
+ | "apac"
371
+ | "oc"
372
+ | "afr"
373
+ | "me";
363
374
  export interface DurableObjectNamespaceGetDurableObjectOptions {
364
- locationHint?: string;
375
+ locationHint?: DurableObjectLocationHint;
365
376
  }
366
377
  export interface DurableObjectState {
367
378
  waitUntil(promise: Promise<any>): void;
@@ -1291,12 +1302,18 @@ export interface R2HTTPMetadata {
1291
1302
  cacheControl?: string;
1292
1303
  cacheExpiry?: Date;
1293
1304
  }
1294
- export interface R2Objects {
1305
+ export type R2Objects = {
1295
1306
  objects: R2Object[];
1296
- truncated: boolean;
1297
- cursor?: string;
1298
1307
  delimitedPrefixes: string[];
1299
- }
1308
+ } & (
1309
+ | {
1310
+ truncated: true;
1311
+ cursor: string;
1312
+ }
1313
+ | {
1314
+ truncated: false;
1315
+ }
1316
+ );
1300
1317
  export declare abstract class ScheduledEvent extends ExtendableEvent {
1301
1318
  readonly scheduledTime: number;
1302
1319
  readonly cron: string;
@@ -1507,13 +1524,19 @@ export declare class TransformStream<I = any, O = any> {
1507
1524
  get writable(): WritableStream<I>;
1508
1525
  }
1509
1526
  export declare class FixedLengthStream extends IdentityTransformStream {
1510
- constructor(expectedLength: number | bigint);
1527
+ constructor(
1528
+ expectedLength: number | bigint,
1529
+ queuingStrategy?: IdentityTransformStreamQueuingStrategy
1530
+ );
1511
1531
  }
1512
1532
  export declare class IdentityTransformStream extends TransformStream<
1513
1533
  ArrayBuffer | ArrayBufferView,
1514
1534
  Uint8Array
1515
1535
  > {
1516
- constructor();
1536
+ constructor(queuingStrategy?: IdentityTransformStreamQueuingStrategy);
1537
+ }
1538
+ export interface IdentityTransformStreamQueuingStrategy {
1539
+ highWaterMark?: number | bigint;
1517
1540
  }
1518
1541
  export interface ReadableStreamValuesOptions {
1519
1542
  preventCancel?: boolean;
@@ -2782,7 +2805,7 @@ export declare abstract class D1PreparedStatement {
2782
2805
  raw<T = unknown>(): Promise<T[]>;
2783
2806
  }
2784
2807
  /**
2785
- * A email message that is sent to a consumer Worker.
2808
+ * An email message that can be sent from a Worker.
2786
2809
  */
2787
2810
  export interface EmailMessage {
2788
2811
  /**
@@ -2793,14 +2816,19 @@ export interface EmailMessage {
2793
2816
  * Envelope To attribute of the email message.
2794
2817
  */
2795
2818
  readonly to: string;
2796
- /**
2797
- * A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
2798
- */
2799
- readonly headers: Headers;
2819
+ }
2820
+ /**
2821
+ * An email message that is sent to a consumer Worker and can be rejected/forwarded.
2822
+ */
2823
+ export interface ForwardableEmailMessage extends EmailMessage {
2800
2824
  /**
2801
2825
  * Stream of the email message content.
2802
2826
  */
2803
2827
  readonly raw: ReadableStream;
2828
+ /**
2829
+ * An [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
2830
+ */
2831
+ readonly headers: Headers;
2804
2832
  /**
2805
2833
  * Size of the email message content.
2806
2834
  */
@@ -2819,11 +2847,17 @@ export interface EmailMessage {
2819
2847
  */
2820
2848
  forward(rcptTo: string, headers?: Headers): Promise<void>;
2821
2849
  }
2850
+ /**
2851
+ * A binding that allows a Worker to send email messages.
2852
+ */
2853
+ export interface SendEmail {
2854
+ send(message: EmailMessage): Promise<void>;
2855
+ }
2822
2856
  export declare abstract class EmailEvent extends ExtendableEvent {
2823
- readonly message: EmailMessage;
2857
+ readonly message: ForwardableEmailMessage;
2824
2858
  }
2825
2859
  export type EmailExportedHandler<Env = unknown> = (
2826
- message: EmailMessage,
2860
+ message: ForwardableEmailMessage,
2827
2861
  env: Env,
2828
2862
  ctx: ExecutionContext
2829
2863
  ) => void | Promise<void>;
@@ -359,13 +359,24 @@ declare interface DurableObjectNamespace {
359
359
  id: DurableObjectId,
360
360
  options?: DurableObjectNamespaceGetDurableObjectOptions
361
361
  ): DurableObjectStub;
362
- jurisdiction(jurisdiction: string): DurableObjectNamespace;
362
+ jurisdiction(jurisdiction: DurableObjectJurisdiction): DurableObjectNamespace;
363
363
  }
364
+ declare type DurableObjectJurisdiction = "eu" | "fedramp";
364
365
  declare interface DurableObjectNamespaceNewUniqueIdOptions {
365
- jurisdiction?: string;
366
- }
366
+ jurisdiction?: DurableObjectJurisdiction;
367
+ }
368
+ declare type DurableObjectLocationHint =
369
+ | "wnam"
370
+ | "enam"
371
+ | "sam"
372
+ | "weur"
373
+ | "eeur"
374
+ | "apac"
375
+ | "oc"
376
+ | "afr"
377
+ | "me";
367
378
  declare interface DurableObjectNamespaceGetDurableObjectOptions {
368
- locationHint?: string;
379
+ locationHint?: DurableObjectLocationHint;
369
380
  }
370
381
  declare interface DurableObjectState {
371
382
  waitUntil(promise: Promise<any>): void;
@@ -1295,12 +1306,18 @@ declare interface R2HTTPMetadata {
1295
1306
  cacheControl?: string;
1296
1307
  cacheExpiry?: Date;
1297
1308
  }
1298
- declare interface R2Objects {
1309
+ declare type R2Objects = {
1299
1310
  objects: R2Object[];
1300
- truncated: boolean;
1301
- cursor?: string;
1302
1311
  delimitedPrefixes: string[];
1303
- }
1312
+ } & (
1313
+ | {
1314
+ truncated: true;
1315
+ cursor: string;
1316
+ }
1317
+ | {
1318
+ truncated: false;
1319
+ }
1320
+ );
1304
1321
  declare abstract class ScheduledEvent extends ExtendableEvent {
1305
1322
  readonly scheduledTime: number;
1306
1323
  readonly cron: string;
@@ -1511,13 +1528,19 @@ declare class TransformStream<I = any, O = any> {
1511
1528
  get writable(): WritableStream<I>;
1512
1529
  }
1513
1530
  declare class FixedLengthStream extends IdentityTransformStream {
1514
- constructor(expectedLength: number | bigint);
1531
+ constructor(
1532
+ expectedLength: number | bigint,
1533
+ queuingStrategy?: IdentityTransformStreamQueuingStrategy
1534
+ );
1515
1535
  }
1516
1536
  declare class IdentityTransformStream extends TransformStream<
1517
1537
  ArrayBuffer | ArrayBufferView,
1518
1538
  Uint8Array
1519
1539
  > {
1520
- constructor();
1540
+ constructor(queuingStrategy?: IdentityTransformStreamQueuingStrategy);
1541
+ }
1542
+ declare interface IdentityTransformStreamQueuingStrategy {
1543
+ highWaterMark?: number | bigint;
1521
1544
  }
1522
1545
  declare interface ReadableStreamValuesOptions {
1523
1546
  preventCancel?: boolean;
@@ -2783,7 +2806,7 @@ declare abstract class D1PreparedStatement {
2783
2806
  raw<T = unknown>(): Promise<T[]>;
2784
2807
  }
2785
2808
  /**
2786
- * A email message that is sent to a consumer Worker.
2809
+ * An email message that can be sent from a Worker.
2787
2810
  */
2788
2811
  declare interface EmailMessage {
2789
2812
  /**
@@ -2794,14 +2817,19 @@ declare interface EmailMessage {
2794
2817
  * Envelope To attribute of the email message.
2795
2818
  */
2796
2819
  readonly to: string;
2797
- /**
2798
- * A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
2799
- */
2800
- readonly headers: Headers;
2820
+ }
2821
+ /**
2822
+ * An email message that is sent to a consumer Worker and can be rejected/forwarded.
2823
+ */
2824
+ declare interface ForwardableEmailMessage extends EmailMessage {
2801
2825
  /**
2802
2826
  * Stream of the email message content.
2803
2827
  */
2804
2828
  readonly raw: ReadableStream;
2829
+ /**
2830
+ * An [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
2831
+ */
2832
+ readonly headers: Headers;
2805
2833
  /**
2806
2834
  * Size of the email message content.
2807
2835
  */
@@ -2820,14 +2848,27 @@ declare interface EmailMessage {
2820
2848
  */
2821
2849
  forward(rcptTo: string, headers?: Headers): Promise<void>;
2822
2850
  }
2851
+ /**
2852
+ * A binding that allows a Worker to send email messages.
2853
+ */
2854
+ declare interface SendEmail {
2855
+ send(message: EmailMessage): Promise<void>;
2856
+ }
2823
2857
  declare abstract class EmailEvent extends ExtendableEvent {
2824
- readonly message: EmailMessage;
2858
+ readonly message: ForwardableEmailMessage;
2825
2859
  }
2826
2860
  declare type EmailExportedHandler<Env = unknown> = (
2827
- message: EmailMessage,
2861
+ message: ForwardableEmailMessage,
2828
2862
  env: Env,
2829
2863
  ctx: ExecutionContext
2830
2864
  ) => void | Promise<void>;
2865
+ declare module "cloudflare:email" {
2866
+ let _EmailMessage: {
2867
+ prototype: EmailMessage;
2868
+ new (from: string, to: string, raw: ReadableStream | string): EmailMessage;
2869
+ };
2870
+ export { _EmailMessage as EmailMessage };
2871
+ }
2831
2872
  declare type Params<P extends string = any> = Record<P, string | string[]>;
2832
2873
  declare type EventContext<Env, P extends string, Data> = {
2833
2874
  request: Request;