@cloudflare/workers-types 4.20240129.0 → 4.20240222.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.
@@ -398,7 +398,7 @@ export interface DurableObject {
398
398
  ): void | Promise<void>;
399
399
  webSocketError?(ws: WebSocket, error: unknown): void | Promise<void>;
400
400
  }
401
- export interface DurableObjectStub extends WorkerRpc {
401
+ export interface DurableObjectStub extends Fetcher {
402
402
  readonly id: DurableObjectId;
403
403
  readonly name?: string;
404
404
  }
@@ -1146,6 +1146,7 @@ export declare abstract class Fetcher {
1146
1146
  messages: ServiceBindingQueueMessage[]
1147
1147
  ): Promise<FetcherQueueResult>;
1148
1148
  scheduled(options?: FetcherScheduledOptions): Promise<FetcherScheduledResult>;
1149
+ getRpcMethodForTestOnly(name: string): (() => any | Promise<any>) | null;
1149
1150
  }
1150
1151
  export interface FetcherPutOptions {
1151
1152
  expiration?: number;
@@ -1481,7 +1482,6 @@ export type R2Objects = {
1481
1482
  truncated: false;
1482
1483
  }
1483
1484
  );
1484
- export declare abstract class WorkerRpc extends Fetcher {}
1485
1485
  export declare abstract class ScheduledEvent extends ExtendableEvent {
1486
1486
  readonly scheduledTime: number;
1487
1487
  readonly cron: string;
@@ -1622,6 +1622,9 @@ export declare class ReadableStreamBYOBReader {
1622
1622
  view: T
1623
1623
  ): Promise<ReadableStreamReadResult<T>>;
1624
1624
  }
1625
+ export interface ReadableStreamBYOBReaderReadableStreamBYOBReaderReadOptions {
1626
+ min?: number;
1627
+ }
1625
1628
  export interface ReadableStreamGetReaderOptions {
1626
1629
  mode: "byob";
1627
1630
  }
@@ -3561,12 +3564,14 @@ export interface D1Meta {
3561
3564
  changed_db: boolean;
3562
3565
  changes: number;
3563
3566
  }
3564
- export interface D1Result<T = unknown> {
3565
- results: T[];
3567
+ export interface D1Response {
3566
3568
  success: true;
3567
3569
  meta: D1Meta & Record<string, unknown>;
3568
3570
  error?: never;
3569
3571
  }
3572
+ export type D1Result<T = unknown> = D1Response & {
3573
+ results: T[];
3574
+ };
3570
3575
  export interface D1ExecResult {
3571
3576
  count: number;
3572
3577
  duration: number;
@@ -3581,9 +3586,12 @@ export declare abstract class D1PreparedStatement {
3581
3586
  bind(...values: unknown[]): D1PreparedStatement;
3582
3587
  first<T = unknown>(colName: string): Promise<T | null>;
3583
3588
  first<T = Record<string, unknown>>(): Promise<T | null>;
3584
- run<T = Record<string, unknown>>(): Promise<D1Result<T>>;
3589
+ run(): Promise<D1Response>;
3585
3590
  all<T = Record<string, unknown>>(): Promise<D1Result<T>>;
3586
- raw<T = unknown[]>(): Promise<T[]>;
3591
+ raw<T = unknown[]>(options: {
3592
+ columnNames: true;
3593
+ }): Promise<[string[], ...T[]]>;
3594
+ raw<T = unknown[]>(options?: { columnNames?: false }): Promise<T[]>;
3587
3595
  }
3588
3596
  /**
3589
3597
  * An email message that can be sent from a Worker.
@@ -3691,7 +3699,7 @@ export interface Hyperdrive {
3691
3699
  }
3692
3700
  export type Params<P extends string = any> = Record<P, string | string[]>;
3693
3701
  export type EventContext<Env, P extends string, Data> = {
3694
- request: Request;
3702
+ request: Request<unknown, IncomingRequestCfProperties<unknown>>;
3695
3703
  functionPath: string;
3696
3704
  waitUntil: (promise: Promise<any>) => void;
3697
3705
  passThroughOnException: () => void;
@@ -3710,7 +3718,7 @@ export type PagesFunction<
3710
3718
  Data extends Record<string, unknown> = Record<string, unknown>
3711
3719
  > = (context: EventContext<Env, Params, Data>) => Response | Promise<Response>;
3712
3720
  export type EventPluginContext<Env, P extends string, Data, PluginArgs> = {
3713
- request: Request;
3721
+ request: Request<unknown, IncomingRequestCfProperties<unknown>>;
3714
3722
  functionPath: string;
3715
3723
  waitUntil: (promise: Promise<any>) => void;
3716
3724
  passThroughOnException: () => void;
package/index.d.ts CHANGED
@@ -375,7 +375,7 @@ declare interface DurableObject {
375
375
  ): void | Promise<void>;
376
376
  webSocketError?(ws: WebSocket, error: unknown): void | Promise<void>;
377
377
  }
378
- declare interface DurableObjectStub extends WorkerRpc {
378
+ declare interface DurableObjectStub extends Fetcher {
379
379
  readonly id: DurableObjectId;
380
380
  readonly name?: string;
381
381
  }
@@ -1436,7 +1436,6 @@ declare type R2Objects = {
1436
1436
  truncated: false;
1437
1437
  }
1438
1438
  );
1439
- declare abstract class WorkerRpc extends Fetcher {}
1440
1439
  declare abstract class ScheduledEvent extends ExtendableEvent {
1441
1440
  readonly scheduledTime: number;
1442
1441
  readonly cron: string;
@@ -1577,6 +1576,9 @@ declare class ReadableStreamBYOBReader {
1577
1576
  view: T
1578
1577
  ): Promise<ReadableStreamReadResult<T>>;
1579
1578
  }
1579
+ declare interface ReadableStreamBYOBReaderReadableStreamBYOBReaderReadOptions {
1580
+ min?: number;
1581
+ }
1580
1582
  declare interface ReadableStreamGetReaderOptions {
1581
1583
  mode: "byob";
1582
1584
  }
@@ -3485,12 +3487,14 @@ declare interface D1Meta {
3485
3487
  changed_db: boolean;
3486
3488
  changes: number;
3487
3489
  }
3488
- declare interface D1Result<T = unknown> {
3489
- results: T[];
3490
+ declare interface D1Response {
3490
3491
  success: true;
3491
3492
  meta: D1Meta & Record<string, unknown>;
3492
3493
  error?: never;
3493
3494
  }
3495
+ declare type D1Result<T = unknown> = D1Response & {
3496
+ results: T[];
3497
+ };
3494
3498
  declare interface D1ExecResult {
3495
3499
  count: number;
3496
3500
  duration: number;
@@ -3505,9 +3509,12 @@ declare abstract class D1PreparedStatement {
3505
3509
  bind(...values: unknown[]): D1PreparedStatement;
3506
3510
  first<T = unknown>(colName: string): Promise<T | null>;
3507
3511
  first<T = Record<string, unknown>>(): Promise<T | null>;
3508
- run<T = Record<string, unknown>>(): Promise<D1Result<T>>;
3512
+ run(): Promise<D1Response>;
3509
3513
  all<T = Record<string, unknown>>(): Promise<D1Result<T>>;
3510
- raw<T = unknown[]>(): Promise<T[]>;
3514
+ raw<T = unknown[]>(options: {
3515
+ columnNames: true;
3516
+ }): Promise<[string[], ...T[]]>;
3517
+ raw<T = unknown[]>(options?: { columnNames?: false }): Promise<T[]>;
3511
3518
  }
3512
3519
  /**
3513
3520
  * An email message that can be sent from a Worker.
@@ -3622,7 +3629,7 @@ declare interface Hyperdrive {
3622
3629
  }
3623
3630
  declare type Params<P extends string = any> = Record<P, string | string[]>;
3624
3631
  declare type EventContext<Env, P extends string, Data> = {
3625
- request: Request;
3632
+ request: Request<unknown, IncomingRequestCfProperties<unknown>>;
3626
3633
  functionPath: string;
3627
3634
  waitUntil: (promise: Promise<any>) => void;
3628
3635
  passThroughOnException: () => void;
@@ -3641,7 +3648,7 @@ declare type PagesFunction<
3641
3648
  Data extends Record<string, unknown> = Record<string, unknown>
3642
3649
  > = (context: EventContext<Env, Params, Data>) => Response | Promise<Response>;
3643
3650
  declare type EventPluginContext<Env, P extends string, Data, PluginArgs> = {
3644
- request: Request;
3651
+ request: Request<unknown, IncomingRequestCfProperties<unknown>>;
3645
3652
  functionPath: string;
3646
3653
  waitUntil: (promise: Promise<any>) => void;
3647
3654
  passThroughOnException: () => void;
package/index.ts CHANGED
@@ -377,7 +377,7 @@ export interface DurableObject {
377
377
  ): void | Promise<void>;
378
378
  webSocketError?(ws: WebSocket, error: unknown): void | Promise<void>;
379
379
  }
380
- export interface DurableObjectStub extends WorkerRpc {
380
+ export interface DurableObjectStub extends Fetcher {
381
381
  readonly id: DurableObjectId;
382
382
  readonly name?: string;
383
383
  }
@@ -1438,7 +1438,6 @@ export type R2Objects = {
1438
1438
  truncated: false;
1439
1439
  }
1440
1440
  );
1441
- export declare abstract class WorkerRpc extends Fetcher {}
1442
1441
  export declare abstract class ScheduledEvent extends ExtendableEvent {
1443
1442
  readonly scheduledTime: number;
1444
1443
  readonly cron: string;
@@ -1579,6 +1578,9 @@ export declare class ReadableStreamBYOBReader {
1579
1578
  view: T
1580
1579
  ): Promise<ReadableStreamReadResult<T>>;
1581
1580
  }
1581
+ export interface ReadableStreamBYOBReaderReadableStreamBYOBReaderReadOptions {
1582
+ min?: number;
1583
+ }
1582
1584
  export interface ReadableStreamGetReaderOptions {
1583
1585
  mode: "byob";
1584
1586
  }
@@ -3490,12 +3492,14 @@ export interface D1Meta {
3490
3492
  changed_db: boolean;
3491
3493
  changes: number;
3492
3494
  }
3493
- export interface D1Result<T = unknown> {
3494
- results: T[];
3495
+ export interface D1Response {
3495
3496
  success: true;
3496
3497
  meta: D1Meta & Record<string, unknown>;
3497
3498
  error?: never;
3498
3499
  }
3500
+ export type D1Result<T = unknown> = D1Response & {
3501
+ results: T[];
3502
+ };
3499
3503
  export interface D1ExecResult {
3500
3504
  count: number;
3501
3505
  duration: number;
@@ -3510,9 +3514,12 @@ export declare abstract class D1PreparedStatement {
3510
3514
  bind(...values: unknown[]): D1PreparedStatement;
3511
3515
  first<T = unknown>(colName: string): Promise<T | null>;
3512
3516
  first<T = Record<string, unknown>>(): Promise<T | null>;
3513
- run<T = Record<string, unknown>>(): Promise<D1Result<T>>;
3517
+ run(): Promise<D1Response>;
3514
3518
  all<T = Record<string, unknown>>(): Promise<D1Result<T>>;
3515
- raw<T = unknown[]>(): Promise<T[]>;
3519
+ raw<T = unknown[]>(options: {
3520
+ columnNames: true;
3521
+ }): Promise<[string[], ...T[]]>;
3522
+ raw<T = unknown[]>(options?: { columnNames?: false }): Promise<T[]>;
3516
3523
  }
3517
3524
  /**
3518
3525
  * An email message that can be sent from a Worker.
@@ -3620,7 +3627,7 @@ export interface Hyperdrive {
3620
3627
  }
3621
3628
  export type Params<P extends string = any> = Record<P, string | string[]>;
3622
3629
  export type EventContext<Env, P extends string, Data> = {
3623
- request: Request;
3630
+ request: Request<unknown, IncomingRequestCfProperties<unknown>>;
3624
3631
  functionPath: string;
3625
3632
  waitUntil: (promise: Promise<any>) => void;
3626
3633
  passThroughOnException: () => void;
@@ -3639,7 +3646,7 @@ export type PagesFunction<
3639
3646
  Data extends Record<string, unknown> = Record<string, unknown>
3640
3647
  > = (context: EventContext<Env, Params, Data>) => Response | Promise<Response>;
3641
3648
  export type EventPluginContext<Env, P extends string, Data, PluginArgs> = {
3642
- request: Request;
3649
+ request: Request<unknown, IncomingRequestCfProperties<unknown>>;
3643
3650
  functionPath: string;
3644
3651
  waitUntil: (promise: Promise<any>) => void;
3645
3652
  passThroughOnException: () => void;
package/oldest/index.d.ts CHANGED
@@ -375,7 +375,7 @@ declare interface DurableObject {
375
375
  ): void | Promise<void>;
376
376
  webSocketError?(ws: WebSocket, error: unknown): void | Promise<void>;
377
377
  }
378
- declare interface DurableObjectStub extends WorkerRpc {
378
+ declare interface DurableObjectStub extends Fetcher {
379
379
  readonly id: DurableObjectId;
380
380
  readonly name?: string;
381
381
  }
@@ -1436,7 +1436,6 @@ declare type R2Objects = {
1436
1436
  truncated: false;
1437
1437
  }
1438
1438
  );
1439
- declare abstract class WorkerRpc extends Fetcher {}
1440
1439
  declare abstract class ScheduledEvent extends ExtendableEvent {
1441
1440
  readonly scheduledTime: number;
1442
1441
  readonly cron: string;
@@ -1577,6 +1576,9 @@ declare class ReadableStreamBYOBReader {
1577
1576
  view: T
1578
1577
  ): Promise<ReadableStreamReadResult<T>>;
1579
1578
  }
1579
+ declare interface ReadableStreamBYOBReaderReadableStreamBYOBReaderReadOptions {
1580
+ min?: number;
1581
+ }
1580
1582
  declare interface ReadableStreamGetReaderOptions {
1581
1583
  mode: "byob";
1582
1584
  }
@@ -3485,12 +3487,14 @@ declare interface D1Meta {
3485
3487
  changed_db: boolean;
3486
3488
  changes: number;
3487
3489
  }
3488
- declare interface D1Result<T = unknown> {
3489
- results: T[];
3490
+ declare interface D1Response {
3490
3491
  success: true;
3491
3492
  meta: D1Meta & Record<string, unknown>;
3492
3493
  error?: never;
3493
3494
  }
3495
+ declare type D1Result<T = unknown> = D1Response & {
3496
+ results: T[];
3497
+ };
3494
3498
  declare interface D1ExecResult {
3495
3499
  count: number;
3496
3500
  duration: number;
@@ -3505,9 +3509,12 @@ declare abstract class D1PreparedStatement {
3505
3509
  bind(...values: unknown[]): D1PreparedStatement;
3506
3510
  first<T = unknown>(colName: string): Promise<T | null>;
3507
3511
  first<T = Record<string, unknown>>(): Promise<T | null>;
3508
- run<T = Record<string, unknown>>(): Promise<D1Result<T>>;
3512
+ run(): Promise<D1Response>;
3509
3513
  all<T = Record<string, unknown>>(): Promise<D1Result<T>>;
3510
- raw<T = unknown[]>(): Promise<T[]>;
3514
+ raw<T = unknown[]>(options: {
3515
+ columnNames: true;
3516
+ }): Promise<[string[], ...T[]]>;
3517
+ raw<T = unknown[]>(options?: { columnNames?: false }): Promise<T[]>;
3511
3518
  }
3512
3519
  /**
3513
3520
  * An email message that can be sent from a Worker.
@@ -3622,7 +3629,7 @@ declare interface Hyperdrive {
3622
3629
  }
3623
3630
  declare type Params<P extends string = any> = Record<P, string | string[]>;
3624
3631
  declare type EventContext<Env, P extends string, Data> = {
3625
- request: Request;
3632
+ request: Request<unknown, IncomingRequestCfProperties<unknown>>;
3626
3633
  functionPath: string;
3627
3634
  waitUntil: (promise: Promise<any>) => void;
3628
3635
  passThroughOnException: () => void;
@@ -3641,7 +3648,7 @@ declare type PagesFunction<
3641
3648
  Data extends Record<string, unknown> = Record<string, unknown>
3642
3649
  > = (context: EventContext<Env, Params, Data>) => Response | Promise<Response>;
3643
3650
  declare type EventPluginContext<Env, P extends string, Data, PluginArgs> = {
3644
- request: Request;
3651
+ request: Request<unknown, IncomingRequestCfProperties<unknown>>;
3645
3652
  functionPath: string;
3646
3653
  waitUntil: (promise: Promise<any>) => void;
3647
3654
  passThroughOnException: () => void;
package/oldest/index.ts CHANGED
@@ -377,7 +377,7 @@ export interface DurableObject {
377
377
  ): void | Promise<void>;
378
378
  webSocketError?(ws: WebSocket, error: unknown): void | Promise<void>;
379
379
  }
380
- export interface DurableObjectStub extends WorkerRpc {
380
+ export interface DurableObjectStub extends Fetcher {
381
381
  readonly id: DurableObjectId;
382
382
  readonly name?: string;
383
383
  }
@@ -1438,7 +1438,6 @@ export type R2Objects = {
1438
1438
  truncated: false;
1439
1439
  }
1440
1440
  );
1441
- export declare abstract class WorkerRpc extends Fetcher {}
1442
1441
  export declare abstract class ScheduledEvent extends ExtendableEvent {
1443
1442
  readonly scheduledTime: number;
1444
1443
  readonly cron: string;
@@ -1579,6 +1578,9 @@ export declare class ReadableStreamBYOBReader {
1579
1578
  view: T
1580
1579
  ): Promise<ReadableStreamReadResult<T>>;
1581
1580
  }
1581
+ export interface ReadableStreamBYOBReaderReadableStreamBYOBReaderReadOptions {
1582
+ min?: number;
1583
+ }
1582
1584
  export interface ReadableStreamGetReaderOptions {
1583
1585
  mode: "byob";
1584
1586
  }
@@ -3490,12 +3492,14 @@ export interface D1Meta {
3490
3492
  changed_db: boolean;
3491
3493
  changes: number;
3492
3494
  }
3493
- export interface D1Result<T = unknown> {
3494
- results: T[];
3495
+ export interface D1Response {
3495
3496
  success: true;
3496
3497
  meta: D1Meta & Record<string, unknown>;
3497
3498
  error?: never;
3498
3499
  }
3500
+ export type D1Result<T = unknown> = D1Response & {
3501
+ results: T[];
3502
+ };
3499
3503
  export interface D1ExecResult {
3500
3504
  count: number;
3501
3505
  duration: number;
@@ -3510,9 +3514,12 @@ export declare abstract class D1PreparedStatement {
3510
3514
  bind(...values: unknown[]): D1PreparedStatement;
3511
3515
  first<T = unknown>(colName: string): Promise<T | null>;
3512
3516
  first<T = Record<string, unknown>>(): Promise<T | null>;
3513
- run<T = Record<string, unknown>>(): Promise<D1Result<T>>;
3517
+ run(): Promise<D1Response>;
3514
3518
  all<T = Record<string, unknown>>(): Promise<D1Result<T>>;
3515
- raw<T = unknown[]>(): Promise<T[]>;
3519
+ raw<T = unknown[]>(options: {
3520
+ columnNames: true;
3521
+ }): Promise<[string[], ...T[]]>;
3522
+ raw<T = unknown[]>(options?: { columnNames?: false }): Promise<T[]>;
3516
3523
  }
3517
3524
  /**
3518
3525
  * An email message that can be sent from a Worker.
@@ -3620,7 +3627,7 @@ export interface Hyperdrive {
3620
3627
  }
3621
3628
  export type Params<P extends string = any> = Record<P, string | string[]>;
3622
3629
  export type EventContext<Env, P extends string, Data> = {
3623
- request: Request;
3630
+ request: Request<unknown, IncomingRequestCfProperties<unknown>>;
3624
3631
  functionPath: string;
3625
3632
  waitUntil: (promise: Promise<any>) => void;
3626
3633
  passThroughOnException: () => void;
@@ -3639,7 +3646,7 @@ export type PagesFunction<
3639
3646
  Data extends Record<string, unknown> = Record<string, unknown>
3640
3647
  > = (context: EventContext<Env, Params, Data>) => Response | Promise<Response>;
3641
3648
  export type EventPluginContext<Env, P extends string, Data, PluginArgs> = {
3642
- request: Request;
3649
+ request: Request<unknown, IncomingRequestCfProperties<unknown>>;
3643
3650
  functionPath: string;
3644
3651
  waitUntil: (promise: Promise<any>) => void;
3645
3652
  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.20240129.0"
10
+ "version": "4.20240222.0"
11
11
  }