@cloudflare/workers-types 4.20240208.0 → 4.20240312.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/index.d.ts CHANGED
@@ -360,6 +360,10 @@ declare interface Performance {
360
360
  readonly timeOrigin: number;
361
361
  now(): number;
362
362
  }
363
+ declare interface AlarmInvocationInfo {
364
+ readonly isRetry: boolean;
365
+ readonly retryCount: number;
366
+ }
363
367
  declare interface DurableObject {
364
368
  fetch(request: Request): Response | Promise<Response>;
365
369
  alarm?(): void | Promise<void>;
@@ -375,7 +379,7 @@ declare interface DurableObject {
375
379
  ): void | Promise<void>;
376
380
  webSocketError?(ws: WebSocket, error: unknown): void | Promise<void>;
377
381
  }
378
- declare interface DurableObjectStub extends WorkerRpc {
382
+ declare interface DurableObjectStub extends Fetcher {
379
383
  readonly id: DurableObjectId;
380
384
  readonly name?: string;
381
385
  }
@@ -633,9 +637,9 @@ declare interface SchedulerWaitOptions {
633
637
  declare abstract class ExtendableEvent extends Event {
634
638
  waitUntil(promise: Promise<any>): void;
635
639
  }
636
- declare class CustomEvent extends Event {
640
+ declare class CustomEvent<T = any> extends Event {
637
641
  constructor(type: string, init?: CustomEventCustomEventInit);
638
- get detail(): any | undefined;
642
+ get detail(): T;
639
643
  }
640
644
  declare interface CustomEventCustomEventInit {
641
645
  bubbles?: boolean;
@@ -1246,32 +1250,43 @@ declare interface KVNamespaceGetWithMetadataResult<Value, Metadata> {
1246
1250
  declare type QueueContentType = "text" | "bytes" | "json" | "v8";
1247
1251
  declare interface Queue<Body = unknown> {
1248
1252
  send(message: Body, options?: QueueSendOptions): Promise<void>;
1249
- sendBatch(messages: Iterable<MessageSendRequest<Body>>): Promise<void>;
1253
+ sendBatch(
1254
+ messages: Iterable<MessageSendRequest<Body>>,
1255
+ options?: QueueSendBatchOptions
1256
+ ): Promise<void>;
1250
1257
  }
1251
1258
  declare interface QueueSendOptions {
1252
1259
  contentType?: QueueContentType;
1260
+ delaySeconds?: number;
1261
+ }
1262
+ declare interface QueueSendBatchOptions {
1263
+ delaySeconds?: number;
1253
1264
  }
1254
1265
  declare interface MessageSendRequest<Body = unknown> {
1255
1266
  body: Body;
1256
1267
  contentType?: QueueContentType;
1268
+ delaySeconds?: number;
1269
+ }
1270
+ declare interface QueueRetryOptions {
1271
+ delaySeconds?: number;
1257
1272
  }
1258
1273
  declare interface Message<Body = unknown> {
1259
1274
  readonly id: string;
1260
1275
  readonly timestamp: Date;
1261
1276
  readonly body: Body;
1262
- retry(): void;
1277
+ retry(options?: QueueRetryOptions): void;
1263
1278
  ack(): void;
1264
1279
  }
1265
1280
  declare interface QueueEvent<Body = unknown> extends ExtendableEvent {
1266
1281
  readonly messages: readonly Message<Body>[];
1267
1282
  readonly queue: string;
1268
- retryAll(): void;
1283
+ retryAll(options?: QueueRetryOptions): void;
1269
1284
  ackAll(): void;
1270
1285
  }
1271
1286
  declare interface MessageBatch<Body = unknown> {
1272
1287
  readonly messages: readonly Message<Body>[];
1273
1288
  readonly queue: string;
1274
- retryAll(): void;
1289
+ retryAll(options?: QueueRetryOptions): void;
1275
1290
  ackAll(): void;
1276
1291
  }
1277
1292
  declare interface R2Error extends Error {
@@ -1436,7 +1451,6 @@ declare type R2Objects = {
1436
1451
  truncated: false;
1437
1452
  }
1438
1453
  );
1439
- declare abstract class WorkerRpc extends Fetcher {}
1440
1454
  declare abstract class ScheduledEvent extends ExtendableEvent {
1441
1455
  readonly scheduledTime: number;
1442
1456
  readonly cron: string;
@@ -1577,6 +1591,9 @@ declare class ReadableStreamBYOBReader {
1577
1591
  view: T
1578
1592
  ): Promise<ReadableStreamReadResult<T>>;
1579
1593
  }
1594
+ declare interface ReadableStreamBYOBReaderReadableStreamBYOBReaderReadOptions {
1595
+ min?: number;
1596
+ }
1580
1597
  declare interface ReadableStreamGetReaderOptions {
1581
1598
  mode: "byob";
1582
1599
  }
@@ -1867,7 +1884,11 @@ declare class URLSearchParams {
1867
1884
  [Symbol.iterator](): IterableIterator<[key: string, value: string]>;
1868
1885
  }
1869
1886
  declare class URLPattern {
1870
- constructor(input?: string | URLPatternURLPatternInit, baseURL?: string);
1887
+ constructor(
1888
+ input?: string | URLPatternURLPatternInit,
1889
+ baseURL?: string,
1890
+ patternOptions?: URLPatternURLPatternOptions
1891
+ );
1871
1892
  get protocol(): string;
1872
1893
  get username(): string;
1873
1894
  get password(): string;
@@ -1908,6 +1929,9 @@ declare interface URLPatternURLPatternResult {
1908
1929
  search: URLPatternURLPatternComponentResult;
1909
1930
  hash: URLPatternURLPatternComponentResult;
1910
1931
  }
1932
+ declare interface URLPatternURLPatternOptions {
1933
+ ignoreCase?: boolean;
1934
+ }
1911
1935
  declare class CloseEvent extends Event {
1912
1936
  constructor(type: string, initializer: CloseEventInit);
1913
1937
  /** Returns the WebSocket connection close code provided by the server. */
@@ -2066,9 +2090,9 @@ declare interface gpuGPUBuffer {
2066
2090
  unmap(): void;
2067
2091
  destroy(): void;
2068
2092
  mapAsync(
2069
- mode: number,
2070
- offset?: number | bigint,
2071
- size?: number | bigint
2093
+ offset: number,
2094
+ size?: number | bigint,
2095
+ param3?: number | bigint
2072
2096
  ): Promise<void>;
2073
2097
  get size(): number | bigint;
2074
2098
  get usage(): number;
@@ -3509,7 +3533,10 @@ declare abstract class D1PreparedStatement {
3509
3533
  first<T = Record<string, unknown>>(): Promise<T | null>;
3510
3534
  run(): Promise<D1Response>;
3511
3535
  all<T = Record<string, unknown>>(): Promise<D1Result<T>>;
3512
- raw<T = unknown[]>(): Promise<T[]>;
3536
+ raw<T = unknown[]>(options: {
3537
+ columnNames: true;
3538
+ }): Promise<[string[], ...T[]]>;
3539
+ raw<T = unknown[]>(options?: { columnNames?: false }): Promise<T[]>;
3513
3540
  }
3514
3541
  /**
3515
3542
  * An email message that can be sent from a Worker.
@@ -3624,7 +3651,7 @@ declare interface Hyperdrive {
3624
3651
  }
3625
3652
  declare type Params<P extends string = any> = Record<P, string | string[]>;
3626
3653
  declare type EventContext<Env, P extends string, Data> = {
3627
- request: Request;
3654
+ request: Request<unknown, IncomingRequestCfProperties<unknown>>;
3628
3655
  functionPath: string;
3629
3656
  waitUntil: (promise: Promise<any>) => void;
3630
3657
  passThroughOnException: () => void;
@@ -3643,7 +3670,7 @@ declare type PagesFunction<
3643
3670
  Data extends Record<string, unknown> = Record<string, unknown>
3644
3671
  > = (context: EventContext<Env, Params, Data>) => Response | Promise<Response>;
3645
3672
  declare type EventPluginContext<Env, P extends string, Data, PluginArgs> = {
3646
- request: Request;
3673
+ request: Request<unknown, IncomingRequestCfProperties<unknown>>;
3647
3674
  functionPath: string;
3648
3675
  waitUntil: (promise: Promise<any>) => void;
3649
3676
  passThroughOnException: () => void;
package/index.ts CHANGED
@@ -362,6 +362,10 @@ export interface Performance {
362
362
  readonly timeOrigin: number;
363
363
  now(): number;
364
364
  }
365
+ export interface AlarmInvocationInfo {
366
+ readonly isRetry: boolean;
367
+ readonly retryCount: number;
368
+ }
365
369
  export interface DurableObject {
366
370
  fetch(request: Request): Response | Promise<Response>;
367
371
  alarm?(): void | Promise<void>;
@@ -377,7 +381,7 @@ export interface DurableObject {
377
381
  ): void | Promise<void>;
378
382
  webSocketError?(ws: WebSocket, error: unknown): void | Promise<void>;
379
383
  }
380
- export interface DurableObjectStub extends WorkerRpc {
384
+ export interface DurableObjectStub extends Fetcher {
381
385
  readonly id: DurableObjectId;
382
386
  readonly name?: string;
383
387
  }
@@ -635,9 +639,9 @@ export interface SchedulerWaitOptions {
635
639
  export declare abstract class ExtendableEvent extends Event {
636
640
  waitUntil(promise: Promise<any>): void;
637
641
  }
638
- export declare class CustomEvent extends Event {
642
+ export declare class CustomEvent<T = any> extends Event {
639
643
  constructor(type: string, init?: CustomEventCustomEventInit);
640
- get detail(): any | undefined;
644
+ get detail(): T;
641
645
  }
642
646
  export interface CustomEventCustomEventInit {
643
647
  bubbles?: boolean;
@@ -1248,32 +1252,43 @@ export interface KVNamespaceGetWithMetadataResult<Value, Metadata> {
1248
1252
  export type QueueContentType = "text" | "bytes" | "json" | "v8";
1249
1253
  export interface Queue<Body = unknown> {
1250
1254
  send(message: Body, options?: QueueSendOptions): Promise<void>;
1251
- sendBatch(messages: Iterable<MessageSendRequest<Body>>): Promise<void>;
1255
+ sendBatch(
1256
+ messages: Iterable<MessageSendRequest<Body>>,
1257
+ options?: QueueSendBatchOptions
1258
+ ): Promise<void>;
1252
1259
  }
1253
1260
  export interface QueueSendOptions {
1254
1261
  contentType?: QueueContentType;
1262
+ delaySeconds?: number;
1263
+ }
1264
+ export interface QueueSendBatchOptions {
1265
+ delaySeconds?: number;
1255
1266
  }
1256
1267
  export interface MessageSendRequest<Body = unknown> {
1257
1268
  body: Body;
1258
1269
  contentType?: QueueContentType;
1270
+ delaySeconds?: number;
1271
+ }
1272
+ export interface QueueRetryOptions {
1273
+ delaySeconds?: number;
1259
1274
  }
1260
1275
  export interface Message<Body = unknown> {
1261
1276
  readonly id: string;
1262
1277
  readonly timestamp: Date;
1263
1278
  readonly body: Body;
1264
- retry(): void;
1279
+ retry(options?: QueueRetryOptions): void;
1265
1280
  ack(): void;
1266
1281
  }
1267
1282
  export interface QueueEvent<Body = unknown> extends ExtendableEvent {
1268
1283
  readonly messages: readonly Message<Body>[];
1269
1284
  readonly queue: string;
1270
- retryAll(): void;
1285
+ retryAll(options?: QueueRetryOptions): void;
1271
1286
  ackAll(): void;
1272
1287
  }
1273
1288
  export interface MessageBatch<Body = unknown> {
1274
1289
  readonly messages: readonly Message<Body>[];
1275
1290
  readonly queue: string;
1276
- retryAll(): void;
1291
+ retryAll(options?: QueueRetryOptions): void;
1277
1292
  ackAll(): void;
1278
1293
  }
1279
1294
  export interface R2Error extends Error {
@@ -1438,7 +1453,6 @@ export type R2Objects = {
1438
1453
  truncated: false;
1439
1454
  }
1440
1455
  );
1441
- export declare abstract class WorkerRpc extends Fetcher {}
1442
1456
  export declare abstract class ScheduledEvent extends ExtendableEvent {
1443
1457
  readonly scheduledTime: number;
1444
1458
  readonly cron: string;
@@ -1579,6 +1593,9 @@ export declare class ReadableStreamBYOBReader {
1579
1593
  view: T
1580
1594
  ): Promise<ReadableStreamReadResult<T>>;
1581
1595
  }
1596
+ export interface ReadableStreamBYOBReaderReadableStreamBYOBReaderReadOptions {
1597
+ min?: number;
1598
+ }
1582
1599
  export interface ReadableStreamGetReaderOptions {
1583
1600
  mode: "byob";
1584
1601
  }
@@ -1872,7 +1889,11 @@ export declare class URLSearchParams {
1872
1889
  [Symbol.iterator](): IterableIterator<[key: string, value: string]>;
1873
1890
  }
1874
1891
  export declare class URLPattern {
1875
- constructor(input?: string | URLPatternURLPatternInit, baseURL?: string);
1892
+ constructor(
1893
+ input?: string | URLPatternURLPatternInit,
1894
+ baseURL?: string,
1895
+ patternOptions?: URLPatternURLPatternOptions
1896
+ );
1876
1897
  get protocol(): string;
1877
1898
  get username(): string;
1878
1899
  get password(): string;
@@ -1913,6 +1934,9 @@ export interface URLPatternURLPatternResult {
1913
1934
  search: URLPatternURLPatternComponentResult;
1914
1935
  hash: URLPatternURLPatternComponentResult;
1915
1936
  }
1937
+ export interface URLPatternURLPatternOptions {
1938
+ ignoreCase?: boolean;
1939
+ }
1916
1940
  export declare class CloseEvent extends Event {
1917
1941
  constructor(type: string, initializer: CloseEventInit);
1918
1942
  /** Returns the WebSocket connection close code provided by the server. */
@@ -2071,9 +2095,9 @@ export interface gpuGPUBuffer {
2071
2095
  unmap(): void;
2072
2096
  destroy(): void;
2073
2097
  mapAsync(
2074
- mode: number,
2075
- offset?: number | bigint,
2076
- size?: number | bigint
2098
+ offset: number,
2099
+ size?: number | bigint,
2100
+ param3?: number | bigint
2077
2101
  ): Promise<void>;
2078
2102
  get size(): number | bigint;
2079
2103
  get usage(): number;
@@ -3514,7 +3538,10 @@ export declare abstract class D1PreparedStatement {
3514
3538
  first<T = Record<string, unknown>>(): Promise<T | null>;
3515
3539
  run(): Promise<D1Response>;
3516
3540
  all<T = Record<string, unknown>>(): Promise<D1Result<T>>;
3517
- raw<T = unknown[]>(): Promise<T[]>;
3541
+ raw<T = unknown[]>(options: {
3542
+ columnNames: true;
3543
+ }): Promise<[string[], ...T[]]>;
3544
+ raw<T = unknown[]>(options?: { columnNames?: false }): Promise<T[]>;
3518
3545
  }
3519
3546
  /**
3520
3547
  * An email message that can be sent from a Worker.
@@ -3622,7 +3649,7 @@ export interface Hyperdrive {
3622
3649
  }
3623
3650
  export type Params<P extends string = any> = Record<P, string | string[]>;
3624
3651
  export type EventContext<Env, P extends string, Data> = {
3625
- request: Request;
3652
+ request: Request<unknown, IncomingRequestCfProperties<unknown>>;
3626
3653
  functionPath: string;
3627
3654
  waitUntil: (promise: Promise<any>) => void;
3628
3655
  passThroughOnException: () => void;
@@ -3641,7 +3668,7 @@ export type PagesFunction<
3641
3668
  Data extends Record<string, unknown> = Record<string, unknown>
3642
3669
  > = (context: EventContext<Env, Params, Data>) => Response | Promise<Response>;
3643
3670
  export type EventPluginContext<Env, P extends string, Data, PluginArgs> = {
3644
- request: Request;
3671
+ request: Request<unknown, IncomingRequestCfProperties<unknown>>;
3645
3672
  functionPath: string;
3646
3673
  waitUntil: (promise: Promise<any>) => void;
3647
3674
  passThroughOnException: () => void;
package/oldest/index.d.ts CHANGED
@@ -360,6 +360,10 @@ declare interface Performance {
360
360
  readonly timeOrigin: number;
361
361
  now(): number;
362
362
  }
363
+ declare interface AlarmInvocationInfo {
364
+ readonly isRetry: boolean;
365
+ readonly retryCount: number;
366
+ }
363
367
  declare interface DurableObject {
364
368
  fetch(request: Request): Response | Promise<Response>;
365
369
  alarm?(): void | Promise<void>;
@@ -375,7 +379,7 @@ declare interface DurableObject {
375
379
  ): void | Promise<void>;
376
380
  webSocketError?(ws: WebSocket, error: unknown): void | Promise<void>;
377
381
  }
378
- declare interface DurableObjectStub extends WorkerRpc {
382
+ declare interface DurableObjectStub extends Fetcher {
379
383
  readonly id: DurableObjectId;
380
384
  readonly name?: string;
381
385
  }
@@ -633,9 +637,9 @@ declare interface SchedulerWaitOptions {
633
637
  declare abstract class ExtendableEvent extends Event {
634
638
  waitUntil(promise: Promise<any>): void;
635
639
  }
636
- declare class CustomEvent extends Event {
640
+ declare class CustomEvent<T = any> extends Event {
637
641
  constructor(type: string, init?: CustomEventCustomEventInit);
638
- get detail(): any | undefined;
642
+ get detail(): T;
639
643
  }
640
644
  declare interface CustomEventCustomEventInit {
641
645
  bubbles?: boolean;
@@ -1246,32 +1250,43 @@ declare interface KVNamespaceGetWithMetadataResult<Value, Metadata> {
1246
1250
  declare type QueueContentType = "text" | "bytes" | "json" | "v8";
1247
1251
  declare interface Queue<Body = unknown> {
1248
1252
  send(message: Body, options?: QueueSendOptions): Promise<void>;
1249
- sendBatch(messages: Iterable<MessageSendRequest<Body>>): Promise<void>;
1253
+ sendBatch(
1254
+ messages: Iterable<MessageSendRequest<Body>>,
1255
+ options?: QueueSendBatchOptions
1256
+ ): Promise<void>;
1250
1257
  }
1251
1258
  declare interface QueueSendOptions {
1252
1259
  contentType?: QueueContentType;
1260
+ delaySeconds?: number;
1261
+ }
1262
+ declare interface QueueSendBatchOptions {
1263
+ delaySeconds?: number;
1253
1264
  }
1254
1265
  declare interface MessageSendRequest<Body = unknown> {
1255
1266
  body: Body;
1256
1267
  contentType?: QueueContentType;
1268
+ delaySeconds?: number;
1269
+ }
1270
+ declare interface QueueRetryOptions {
1271
+ delaySeconds?: number;
1257
1272
  }
1258
1273
  declare interface Message<Body = unknown> {
1259
1274
  readonly id: string;
1260
1275
  readonly timestamp: Date;
1261
1276
  readonly body: Body;
1262
- retry(): void;
1277
+ retry(options?: QueueRetryOptions): void;
1263
1278
  ack(): void;
1264
1279
  }
1265
1280
  declare interface QueueEvent<Body = unknown> extends ExtendableEvent {
1266
1281
  readonly messages: readonly Message<Body>[];
1267
1282
  readonly queue: string;
1268
- retryAll(): void;
1283
+ retryAll(options?: QueueRetryOptions): void;
1269
1284
  ackAll(): void;
1270
1285
  }
1271
1286
  declare interface MessageBatch<Body = unknown> {
1272
1287
  readonly messages: readonly Message<Body>[];
1273
1288
  readonly queue: string;
1274
- retryAll(): void;
1289
+ retryAll(options?: QueueRetryOptions): void;
1275
1290
  ackAll(): void;
1276
1291
  }
1277
1292
  declare interface R2Error extends Error {
@@ -1436,7 +1451,6 @@ declare type R2Objects = {
1436
1451
  truncated: false;
1437
1452
  }
1438
1453
  );
1439
- declare abstract class WorkerRpc extends Fetcher {}
1440
1454
  declare abstract class ScheduledEvent extends ExtendableEvent {
1441
1455
  readonly scheduledTime: number;
1442
1456
  readonly cron: string;
@@ -1577,6 +1591,9 @@ declare class ReadableStreamBYOBReader {
1577
1591
  view: T
1578
1592
  ): Promise<ReadableStreamReadResult<T>>;
1579
1593
  }
1594
+ declare interface ReadableStreamBYOBReaderReadableStreamBYOBReaderReadOptions {
1595
+ min?: number;
1596
+ }
1580
1597
  declare interface ReadableStreamGetReaderOptions {
1581
1598
  mode: "byob";
1582
1599
  }
@@ -1867,7 +1884,11 @@ declare class URLSearchParams {
1867
1884
  [Symbol.iterator](): IterableIterator<[key: string, value: string]>;
1868
1885
  }
1869
1886
  declare class URLPattern {
1870
- constructor(input?: string | URLPatternURLPatternInit, baseURL?: string);
1887
+ constructor(
1888
+ input?: string | URLPatternURLPatternInit,
1889
+ baseURL?: string,
1890
+ patternOptions?: URLPatternURLPatternOptions
1891
+ );
1871
1892
  get protocol(): string;
1872
1893
  get username(): string;
1873
1894
  get password(): string;
@@ -1908,6 +1929,9 @@ declare interface URLPatternURLPatternResult {
1908
1929
  search: URLPatternURLPatternComponentResult;
1909
1930
  hash: URLPatternURLPatternComponentResult;
1910
1931
  }
1932
+ declare interface URLPatternURLPatternOptions {
1933
+ ignoreCase?: boolean;
1934
+ }
1911
1935
  declare class CloseEvent extends Event {
1912
1936
  constructor(type: string, initializer: CloseEventInit);
1913
1937
  /** Returns the WebSocket connection close code provided by the server. */
@@ -2066,9 +2090,9 @@ declare interface gpuGPUBuffer {
2066
2090
  unmap(): void;
2067
2091
  destroy(): void;
2068
2092
  mapAsync(
2069
- mode: number,
2070
- offset?: number | bigint,
2071
- size?: number | bigint
2093
+ offset: number,
2094
+ size?: number | bigint,
2095
+ param3?: number | bigint
2072
2096
  ): Promise<void>;
2073
2097
  get size(): number | bigint;
2074
2098
  get usage(): number;
@@ -3509,7 +3533,10 @@ declare abstract class D1PreparedStatement {
3509
3533
  first<T = Record<string, unknown>>(): Promise<T | null>;
3510
3534
  run(): Promise<D1Response>;
3511
3535
  all<T = Record<string, unknown>>(): Promise<D1Result<T>>;
3512
- raw<T = unknown[]>(): Promise<T[]>;
3536
+ raw<T = unknown[]>(options: {
3537
+ columnNames: true;
3538
+ }): Promise<[string[], ...T[]]>;
3539
+ raw<T = unknown[]>(options?: { columnNames?: false }): Promise<T[]>;
3513
3540
  }
3514
3541
  /**
3515
3542
  * An email message that can be sent from a Worker.
@@ -3624,7 +3651,7 @@ declare interface Hyperdrive {
3624
3651
  }
3625
3652
  declare type Params<P extends string = any> = Record<P, string | string[]>;
3626
3653
  declare type EventContext<Env, P extends string, Data> = {
3627
- request: Request;
3654
+ request: Request<unknown, IncomingRequestCfProperties<unknown>>;
3628
3655
  functionPath: string;
3629
3656
  waitUntil: (promise: Promise<any>) => void;
3630
3657
  passThroughOnException: () => void;
@@ -3643,7 +3670,7 @@ declare type PagesFunction<
3643
3670
  Data extends Record<string, unknown> = Record<string, unknown>
3644
3671
  > = (context: EventContext<Env, Params, Data>) => Response | Promise<Response>;
3645
3672
  declare type EventPluginContext<Env, P extends string, Data, PluginArgs> = {
3646
- request: Request;
3673
+ request: Request<unknown, IncomingRequestCfProperties<unknown>>;
3647
3674
  functionPath: string;
3648
3675
  waitUntil: (promise: Promise<any>) => void;
3649
3676
  passThroughOnException: () => void;
package/oldest/index.ts CHANGED
@@ -362,6 +362,10 @@ export interface Performance {
362
362
  readonly timeOrigin: number;
363
363
  now(): number;
364
364
  }
365
+ export interface AlarmInvocationInfo {
366
+ readonly isRetry: boolean;
367
+ readonly retryCount: number;
368
+ }
365
369
  export interface DurableObject {
366
370
  fetch(request: Request): Response | Promise<Response>;
367
371
  alarm?(): void | Promise<void>;
@@ -377,7 +381,7 @@ export interface DurableObject {
377
381
  ): void | Promise<void>;
378
382
  webSocketError?(ws: WebSocket, error: unknown): void | Promise<void>;
379
383
  }
380
- export interface DurableObjectStub extends WorkerRpc {
384
+ export interface DurableObjectStub extends Fetcher {
381
385
  readonly id: DurableObjectId;
382
386
  readonly name?: string;
383
387
  }
@@ -635,9 +639,9 @@ export interface SchedulerWaitOptions {
635
639
  export declare abstract class ExtendableEvent extends Event {
636
640
  waitUntil(promise: Promise<any>): void;
637
641
  }
638
- export declare class CustomEvent extends Event {
642
+ export declare class CustomEvent<T = any> extends Event {
639
643
  constructor(type: string, init?: CustomEventCustomEventInit);
640
- get detail(): any | undefined;
644
+ get detail(): T;
641
645
  }
642
646
  export interface CustomEventCustomEventInit {
643
647
  bubbles?: boolean;
@@ -1248,32 +1252,43 @@ export interface KVNamespaceGetWithMetadataResult<Value, Metadata> {
1248
1252
  export type QueueContentType = "text" | "bytes" | "json" | "v8";
1249
1253
  export interface Queue<Body = unknown> {
1250
1254
  send(message: Body, options?: QueueSendOptions): Promise<void>;
1251
- sendBatch(messages: Iterable<MessageSendRequest<Body>>): Promise<void>;
1255
+ sendBatch(
1256
+ messages: Iterable<MessageSendRequest<Body>>,
1257
+ options?: QueueSendBatchOptions
1258
+ ): Promise<void>;
1252
1259
  }
1253
1260
  export interface QueueSendOptions {
1254
1261
  contentType?: QueueContentType;
1262
+ delaySeconds?: number;
1263
+ }
1264
+ export interface QueueSendBatchOptions {
1265
+ delaySeconds?: number;
1255
1266
  }
1256
1267
  export interface MessageSendRequest<Body = unknown> {
1257
1268
  body: Body;
1258
1269
  contentType?: QueueContentType;
1270
+ delaySeconds?: number;
1271
+ }
1272
+ export interface QueueRetryOptions {
1273
+ delaySeconds?: number;
1259
1274
  }
1260
1275
  export interface Message<Body = unknown> {
1261
1276
  readonly id: string;
1262
1277
  readonly timestamp: Date;
1263
1278
  readonly body: Body;
1264
- retry(): void;
1279
+ retry(options?: QueueRetryOptions): void;
1265
1280
  ack(): void;
1266
1281
  }
1267
1282
  export interface QueueEvent<Body = unknown> extends ExtendableEvent {
1268
1283
  readonly messages: readonly Message<Body>[];
1269
1284
  readonly queue: string;
1270
- retryAll(): void;
1285
+ retryAll(options?: QueueRetryOptions): void;
1271
1286
  ackAll(): void;
1272
1287
  }
1273
1288
  export interface MessageBatch<Body = unknown> {
1274
1289
  readonly messages: readonly Message<Body>[];
1275
1290
  readonly queue: string;
1276
- retryAll(): void;
1291
+ retryAll(options?: QueueRetryOptions): void;
1277
1292
  ackAll(): void;
1278
1293
  }
1279
1294
  export interface R2Error extends Error {
@@ -1438,7 +1453,6 @@ export type R2Objects = {
1438
1453
  truncated: false;
1439
1454
  }
1440
1455
  );
1441
- export declare abstract class WorkerRpc extends Fetcher {}
1442
1456
  export declare abstract class ScheduledEvent extends ExtendableEvent {
1443
1457
  readonly scheduledTime: number;
1444
1458
  readonly cron: string;
@@ -1579,6 +1593,9 @@ export declare class ReadableStreamBYOBReader {
1579
1593
  view: T
1580
1594
  ): Promise<ReadableStreamReadResult<T>>;
1581
1595
  }
1596
+ export interface ReadableStreamBYOBReaderReadableStreamBYOBReaderReadOptions {
1597
+ min?: number;
1598
+ }
1582
1599
  export interface ReadableStreamGetReaderOptions {
1583
1600
  mode: "byob";
1584
1601
  }
@@ -1872,7 +1889,11 @@ export declare class URLSearchParams {
1872
1889
  [Symbol.iterator](): IterableIterator<[key: string, value: string]>;
1873
1890
  }
1874
1891
  export declare class URLPattern {
1875
- constructor(input?: string | URLPatternURLPatternInit, baseURL?: string);
1892
+ constructor(
1893
+ input?: string | URLPatternURLPatternInit,
1894
+ baseURL?: string,
1895
+ patternOptions?: URLPatternURLPatternOptions
1896
+ );
1876
1897
  get protocol(): string;
1877
1898
  get username(): string;
1878
1899
  get password(): string;
@@ -1913,6 +1934,9 @@ export interface URLPatternURLPatternResult {
1913
1934
  search: URLPatternURLPatternComponentResult;
1914
1935
  hash: URLPatternURLPatternComponentResult;
1915
1936
  }
1937
+ export interface URLPatternURLPatternOptions {
1938
+ ignoreCase?: boolean;
1939
+ }
1916
1940
  export declare class CloseEvent extends Event {
1917
1941
  constructor(type: string, initializer: CloseEventInit);
1918
1942
  /** Returns the WebSocket connection close code provided by the server. */
@@ -2071,9 +2095,9 @@ export interface gpuGPUBuffer {
2071
2095
  unmap(): void;
2072
2096
  destroy(): void;
2073
2097
  mapAsync(
2074
- mode: number,
2075
- offset?: number | bigint,
2076
- size?: number | bigint
2098
+ offset: number,
2099
+ size?: number | bigint,
2100
+ param3?: number | bigint
2077
2101
  ): Promise<void>;
2078
2102
  get size(): number | bigint;
2079
2103
  get usage(): number;
@@ -3514,7 +3538,10 @@ export declare abstract class D1PreparedStatement {
3514
3538
  first<T = Record<string, unknown>>(): Promise<T | null>;
3515
3539
  run(): Promise<D1Response>;
3516
3540
  all<T = Record<string, unknown>>(): Promise<D1Result<T>>;
3517
- raw<T = unknown[]>(): Promise<T[]>;
3541
+ raw<T = unknown[]>(options: {
3542
+ columnNames: true;
3543
+ }): Promise<[string[], ...T[]]>;
3544
+ raw<T = unknown[]>(options?: { columnNames?: false }): Promise<T[]>;
3518
3545
  }
3519
3546
  /**
3520
3547
  * An email message that can be sent from a Worker.
@@ -3622,7 +3649,7 @@ export interface Hyperdrive {
3622
3649
  }
3623
3650
  export type Params<P extends string = any> = Record<P, string | string[]>;
3624
3651
  export type EventContext<Env, P extends string, Data> = {
3625
- request: Request;
3652
+ request: Request<unknown, IncomingRequestCfProperties<unknown>>;
3626
3653
  functionPath: string;
3627
3654
  waitUntil: (promise: Promise<any>) => void;
3628
3655
  passThroughOnException: () => void;
@@ -3641,7 +3668,7 @@ export type PagesFunction<
3641
3668
  Data extends Record<string, unknown> = Record<string, unknown>
3642
3669
  > = (context: EventContext<Env, Params, Data>) => Response | Promise<Response>;
3643
3670
  export type EventPluginContext<Env, P extends string, Data, PluginArgs> = {
3644
- request: Request;
3671
+ request: Request<unknown, IncomingRequestCfProperties<unknown>>;
3645
3672
  functionPath: string;
3646
3673
  waitUntil: (promise: Promise<any>) => void;
3647
3674
  passThroughOnException: () => void;
package/package.json CHANGED
@@ -7,5 +7,5 @@
7
7
  },
8
8
  "author": "Cloudflare Workers DevProd Team <workers-devprod@cloudflare.com> (https://workers.cloudflare.com)",
9
9
  "license": "MIT OR Apache-2.0",
10
- "version": "4.20240208.0"
10
+ "version": "4.20240312.0"
11
11
  }