@cloudflare/workers-types 4.20250311.0 → 4.20250313.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.
@@ -1683,6 +1683,7 @@ interface RequestInit<Cf = CfProperties> {
1683
1683
  integrity?: string;
1684
1684
  /* An AbortSignal to set request's signal. */
1685
1685
  signal?: AbortSignal | null;
1686
+ encodeResponseBody?: "automatic" | "manual";
1686
1687
  }
1687
1688
  type Service<T extends Rpc.WorkerEntrypointBranded | undefined = undefined> =
1688
1689
  Fetcher<T>;
@@ -4363,7 +4364,12 @@ type AIGatewayProviders =
4363
4364
  | "google-ai-studio"
4364
4365
  | "mistral"
4365
4366
  | "grok"
4366
- | "openrouter";
4367
+ | "openrouter"
4368
+ | "deepseek"
4369
+ | "cerebras"
4370
+ | "cartesia"
4371
+ | "elevenlabs"
4372
+ | "adobe-firefly";
4367
4373
  type AIGatewayHeaders = {
4368
4374
  "cf-aig-metadata":
4369
4375
  | Record<string, number | string | boolean | null | bigint>
@@ -4399,6 +4405,7 @@ declare abstract class AiGateway {
4399
4405
  run(
4400
4406
  data: AIGatewayUniversalRequest | AIGatewayUniversalRequest[],
4401
4407
  ): Promise<Response>;
4408
+ getUrl(provider: AIGatewayProviders | string): Promise<string>; // eslint-disable-line
4402
4409
  }
4403
4410
  interface BasicImageTransformations {
4404
4411
  /**
@@ -5394,11 +5401,43 @@ interface D1ExecResult {
5394
5401
  count: number;
5395
5402
  duration: number;
5396
5403
  }
5404
+ type D1SessionConstraint =
5405
+ // Indicates that the first query should go to the primary, and the rest queries
5406
+ // using the same D1DatabaseSession will go to any replica that is consistent with
5407
+ // the bookmark maintained by the session (returned by the first query).
5408
+ | "first-primary"
5409
+ // Indicates that the first query can go anywhere (primary or replica), and the rest queries
5410
+ // using the same D1DatabaseSession will go to any replica that is consistent with
5411
+ // the bookmark maintained by the session (returned by the first query).
5412
+ | "first-unconstrained";
5413
+ type D1SessionBookmark = string;
5397
5414
  declare abstract class D1Database {
5398
5415
  prepare(query: string): D1PreparedStatement;
5399
- dump(): Promise<ArrayBuffer>;
5400
5416
  batch<T = unknown>(statements: D1PreparedStatement[]): Promise<D1Result<T>[]>;
5401
5417
  exec(query: string): Promise<D1ExecResult>;
5418
+ /**
5419
+ * Creates a new D1 Session anchored at the given constraint or the bookmark.
5420
+ * All queries executed using the created session will have sequential consistency,
5421
+ * meaning that all writes done through the session will be visible in subsequent reads.
5422
+ *
5423
+ * @param constraintOrBookmark Either the session constraint or the explicit bookmark to anchor the created session.
5424
+ */
5425
+ withSession(
5426
+ constraintOrBookmark?: D1SessionBookmark | D1SessionConstraint,
5427
+ ): D1DatabaseSession;
5428
+ /**
5429
+ * @deprecated dump() will be removed soon, only applies to deprecated alpha v1 databases.
5430
+ */
5431
+ dump(): Promise<ArrayBuffer>;
5432
+ }
5433
+ declare abstract class D1DatabaseSession {
5434
+ prepare(query: string): D1PreparedStatement;
5435
+ batch<T = unknown>(statements: D1PreparedStatement[]): Promise<D1Result<T>[]>;
5436
+ /**
5437
+ * @returns The latest session bookmark across all executed queries on the session.
5438
+ * If no query has been executed yet, `null` is returned.
5439
+ */
5440
+ getBookmark(): D1SessionBookmark | null;
5402
5441
  }
5403
5442
  declare abstract class D1PreparedStatement {
5404
5443
  bind(...values: unknown[]): D1PreparedStatement;
@@ -5724,31 +5763,37 @@ declare module "assets:*" {
5724
5763
  // Copyright (c) 2022-2023 Cloudflare, Inc.
5725
5764
  // Licensed under the Apache 2.0 license found in the LICENSE file or at:
5726
5765
  // https://opensource.org/licenses/Apache-2.0
5727
- type PipelineRecord = Record<string, unknown>;
5728
- type PipelineBatchMetadata = {
5729
- pipelineId: string;
5730
- pipelineName: string;
5731
- };
5732
- declare abstract class PipelineTransformationEntrypoint<
5733
- I extends PipelineRecord,
5734
- O extends PipelineRecord,
5735
- > {
5736
- /**
5737
- * run recieves an array of PipelineRecord which can be
5738
- * mutated and returned to the pipeline
5739
- * @param records Incoming records from the pipeline to be transformed
5740
- * @param metadata Information about the specific pipeline calling the transformation entrypoint
5741
- * @returns A promise containing the transformed PipelineRecord array
5742
- */
5743
- public run(records: I[], metadata: PipelineBatchMetadata): Promise<O[]>;
5744
- }
5745
- interface Pipeline<T extends PipelineRecord> {
5746
- /**
5747
- * The Pipeline interface represents the type of a binding to a Pipeline
5748
- *
5749
- * @param records The records to send to the pipeline
5750
- */
5751
- send(records: T[]): Promise<void>;
5766
+ declare module "cloudflare:pipelines" {
5767
+ export abstract class PipelineTransformationEntrypoint<
5768
+ Env = unknown,
5769
+ I extends PipelineRecord = {},
5770
+ O extends PipelineRecord = {},
5771
+ > {
5772
+ /**
5773
+ * run recieves an array of PipelineRecord which can be
5774
+ * mutated and returned to the pipeline
5775
+ * @param records Incoming records from the pipeline to be transformed
5776
+ * @param metadata Information about the specific pipeline calling the transformation entrypoint
5777
+ * @returns A promise containing the transformed PipelineRecord array
5778
+ */
5779
+ protected env: Env;
5780
+ protected ctx: ExecutionContext;
5781
+ constructor(ctx: ExecutionContext, env: Env);
5782
+ public run(records: I[], metadata: PipelineBatchMetadata): Promise<O[]>;
5783
+ }
5784
+ export type PipelineRecord = Record<string, unknown>;
5785
+ export type PipelineBatchMetadata = {
5786
+ pipelineId: string;
5787
+ pipelineName: string;
5788
+ };
5789
+ export interface Pipeline<T extends PipelineRecord> {
5790
+ /**
5791
+ * The Pipeline interface represents the type of a binding to a Pipeline
5792
+ *
5793
+ * @param records The records to send to the pipeline
5794
+ */
5795
+ send(records: T[]): Promise<void>;
5796
+ }
5752
5797
  }
5753
5798
  // PubSubMessage represents an incoming PubSub message.
5754
5799
  // The message includes metadata about the broker, the client, and the payload
@@ -5958,6 +6003,9 @@ declare namespace Rpc {
5958
6003
  >]: MethodOrProperty<T[K]>;
5959
6004
  };
5960
6005
  }
6006
+ declare namespace Cloudflare {
6007
+ interface Env {}
6008
+ }
5961
6009
  declare module "cloudflare:workers" {
5962
6010
  export type RpcStub<T extends Rpc.Stubable> = Rpc.Stub<T>;
5963
6011
  export const RpcStub: {
@@ -6056,6 +6104,7 @@ declare module "cloudflare:workers" {
6056
6104
  step: WorkflowStep,
6057
6105
  ): Promise<unknown>;
6058
6106
  }
6107
+ export const env: Cloudflare.Env;
6059
6108
  }
6060
6109
  declare module "cloudflare:sockets" {
6061
6110
  function _connect(
@@ -6584,6 +6633,15 @@ declare abstract class Workflow<PARAMS = unknown> {
6584
6633
  public create(
6585
6634
  options?: WorkflowInstanceCreateOptions<PARAMS>,
6586
6635
  ): Promise<WorkflowInstance>;
6636
+ /**
6637
+ * Create a batch of instances and return handle for all of them. If a provided id exists, an error will be thrown.
6638
+ * `createBatch` is limited at 100 instances at a time or when the RPC limit for the batch (1MiB) is reached.
6639
+ * @param batch List of Options when creating an instance including name and params
6640
+ * @returns A promise that resolves with a list of handles for the created instances.
6641
+ */
6642
+ public createBatch(
6643
+ batch: WorkflowInstanceCreateOptions<PARAMS>[],
6644
+ ): Promise<WorkflowInstance[]>;
6587
6645
  }
6588
6646
  interface WorkflowInstanceCreateOptions<PARAMS = unknown> {
6589
6647
  /**
@@ -1691,6 +1691,7 @@ export interface RequestInit<Cf = CfProperties> {
1691
1691
  integrity?: string;
1692
1692
  /* An AbortSignal to set request's signal. */
1693
1693
  signal?: AbortSignal | null;
1694
+ encodeResponseBody?: "automatic" | "manual";
1694
1695
  }
1695
1696
  export type Service<
1696
1697
  T extends Rpc.WorkerEntrypointBranded | undefined = undefined,
@@ -4377,7 +4378,12 @@ export type AIGatewayProviders =
4377
4378
  | "google-ai-studio"
4378
4379
  | "mistral"
4379
4380
  | "grok"
4380
- | "openrouter";
4381
+ | "openrouter"
4382
+ | "deepseek"
4383
+ | "cerebras"
4384
+ | "cartesia"
4385
+ | "elevenlabs"
4386
+ | "adobe-firefly";
4381
4387
  export type AIGatewayHeaders = {
4382
4388
  "cf-aig-metadata":
4383
4389
  | Record<string, number | string | boolean | null | bigint>
@@ -4413,6 +4419,7 @@ export declare abstract class AiGateway {
4413
4419
  run(
4414
4420
  data: AIGatewayUniversalRequest | AIGatewayUniversalRequest[],
4415
4421
  ): Promise<Response>;
4422
+ getUrl(provider: AIGatewayProviders | string): Promise<string>; // eslint-disable-line
4416
4423
  }
4417
4424
  export interface BasicImageTransformations {
4418
4425
  /**
@@ -5420,11 +5427,43 @@ export interface D1ExecResult {
5420
5427
  count: number;
5421
5428
  duration: number;
5422
5429
  }
5430
+ export type D1SessionConstraint =
5431
+ // Indicates that the first query should go to the primary, and the rest queries
5432
+ // using the same D1DatabaseSession will go to any replica that is consistent with
5433
+ // the bookmark maintained by the session (returned by the first query).
5434
+ | "first-primary"
5435
+ // Indicates that the first query can go anywhere (primary or replica), and the rest queries
5436
+ // using the same D1DatabaseSession will go to any replica that is consistent with
5437
+ // the bookmark maintained by the session (returned by the first query).
5438
+ | "first-unconstrained";
5439
+ export type D1SessionBookmark = string;
5423
5440
  export declare abstract class D1Database {
5424
5441
  prepare(query: string): D1PreparedStatement;
5425
- dump(): Promise<ArrayBuffer>;
5426
5442
  batch<T = unknown>(statements: D1PreparedStatement[]): Promise<D1Result<T>[]>;
5427
5443
  exec(query: string): Promise<D1ExecResult>;
5444
+ /**
5445
+ * Creates a new D1 Session anchored at the given constraint or the bookmark.
5446
+ * All queries executed using the created session will have sequential consistency,
5447
+ * meaning that all writes done through the session will be visible in subsequent reads.
5448
+ *
5449
+ * @param constraintOrBookmark Either the session constraint or the explicit bookmark to anchor the created session.
5450
+ */
5451
+ withSession(
5452
+ constraintOrBookmark?: D1SessionBookmark | D1SessionConstraint,
5453
+ ): D1DatabaseSession;
5454
+ /**
5455
+ * @deprecated dump() will be removed soon, only applies to deprecated alpha v1 databases.
5456
+ */
5457
+ dump(): Promise<ArrayBuffer>;
5458
+ }
5459
+ export declare abstract class D1DatabaseSession {
5460
+ prepare(query: string): D1PreparedStatement;
5461
+ batch<T = unknown>(statements: D1PreparedStatement[]): Promise<D1Result<T>[]>;
5462
+ /**
5463
+ * @returns The latest session bookmark across all executed queries on the session.
5464
+ * If no query has been executed yet, `null` is returned.
5465
+ */
5466
+ getBookmark(): D1SessionBookmark | null;
5428
5467
  }
5429
5468
  export declare abstract class D1PreparedStatement {
5430
5469
  bind(...values: unknown[]): D1PreparedStatement;
@@ -5737,35 +5776,6 @@ export type PagesPluginFunction<
5737
5776
  > = (
5738
5777
  context: EventPluginContext<Env, Params, Data, PluginArgs>,
5739
5778
  ) => Response | Promise<Response>;
5740
- // Copyright (c) 2022-2023 Cloudflare, Inc.
5741
- // Licensed under the Apache 2.0 license found in the LICENSE file or at:
5742
- // https://opensource.org/licenses/Apache-2.0
5743
- export type PipelineRecord = Record<string, unknown>;
5744
- export type PipelineBatchMetadata = {
5745
- pipelineId: string;
5746
- pipelineName: string;
5747
- };
5748
- export declare abstract class PipelineTransformationEntrypoint<
5749
- I extends PipelineRecord,
5750
- O extends PipelineRecord,
5751
- > {
5752
- /**
5753
- * run recieves an array of PipelineRecord which can be
5754
- * mutated and returned to the pipeline
5755
- * @param records Incoming records from the pipeline to be transformed
5756
- * @param metadata Information about the specific pipeline calling the transformation entrypoint
5757
- * @returns A promise containing the transformed PipelineRecord array
5758
- */
5759
- public run(records: I[], metadata: PipelineBatchMetadata): Promise<O[]>;
5760
- }
5761
- export interface Pipeline<T extends PipelineRecord> {
5762
- /**
5763
- * The Pipeline interface represents the type of a binding to a Pipeline
5764
- *
5765
- * @param records The records to send to the pipeline
5766
- */
5767
- send(records: T[]): Promise<void>;
5768
- }
5769
5779
  // PubSubMessage represents an incoming PubSub message.
5770
5780
  // The message includes metadata about the broker, the client, and the payload
5771
5781
  // itself.
@@ -5974,6 +5984,9 @@ export declare namespace Rpc {
5974
5984
  >]: MethodOrProperty<T[K]>;
5975
5985
  };
5976
5986
  }
5987
+ export declare namespace Cloudflare {
5988
+ interface Env {}
5989
+ }
5977
5990
  export declare namespace TailStream {
5978
5991
  interface Header {
5979
5992
  readonly name: string;
@@ -6485,6 +6498,15 @@ export declare abstract class Workflow<PARAMS = unknown> {
6485
6498
  public create(
6486
6499
  options?: WorkflowInstanceCreateOptions<PARAMS>,
6487
6500
  ): Promise<WorkflowInstance>;
6501
+ /**
6502
+ * Create a batch of instances and return handle for all of them. If a provided id exists, an error will be thrown.
6503
+ * `createBatch` is limited at 100 instances at a time or when the RPC limit for the batch (1MiB) is reached.
6504
+ * @param batch List of Options when creating an instance including name and params
6505
+ * @returns A promise that resolves with a list of handles for the created instances.
6506
+ */
6507
+ public createBatch(
6508
+ batch: WorkflowInstanceCreateOptions<PARAMS>[],
6509
+ ): Promise<WorkflowInstance[]>;
6488
6510
  }
6489
6511
  export interface WorkflowInstanceCreateOptions<PARAMS = unknown> {
6490
6512
  /**
@@ -1689,6 +1689,7 @@ interface RequestInit<Cf = CfProperties> {
1689
1689
  integrity?: string;
1690
1690
  /* An AbortSignal to set request's signal. */
1691
1691
  signal?: AbortSignal | null;
1692
+ encodeResponseBody?: "automatic" | "manual";
1692
1693
  }
1693
1694
  type Service<T extends Rpc.WorkerEntrypointBranded | undefined = undefined> =
1694
1695
  Fetcher<T>;
@@ -4389,7 +4390,12 @@ type AIGatewayProviders =
4389
4390
  | "google-ai-studio"
4390
4391
  | "mistral"
4391
4392
  | "grok"
4392
- | "openrouter";
4393
+ | "openrouter"
4394
+ | "deepseek"
4395
+ | "cerebras"
4396
+ | "cartesia"
4397
+ | "elevenlabs"
4398
+ | "adobe-firefly";
4393
4399
  type AIGatewayHeaders = {
4394
4400
  "cf-aig-metadata":
4395
4401
  | Record<string, number | string | boolean | null | bigint>
@@ -4425,6 +4431,7 @@ declare abstract class AiGateway {
4425
4431
  run(
4426
4432
  data: AIGatewayUniversalRequest | AIGatewayUniversalRequest[],
4427
4433
  ): Promise<Response>;
4434
+ getUrl(provider: AIGatewayProviders | string): Promise<string>; // eslint-disable-line
4428
4435
  }
4429
4436
  interface BasicImageTransformations {
4430
4437
  /**
@@ -5420,11 +5427,43 @@ interface D1ExecResult {
5420
5427
  count: number;
5421
5428
  duration: number;
5422
5429
  }
5430
+ type D1SessionConstraint =
5431
+ // Indicates that the first query should go to the primary, and the rest queries
5432
+ // using the same D1DatabaseSession will go to any replica that is consistent with
5433
+ // the bookmark maintained by the session (returned by the first query).
5434
+ | "first-primary"
5435
+ // Indicates that the first query can go anywhere (primary or replica), and the rest queries
5436
+ // using the same D1DatabaseSession will go to any replica that is consistent with
5437
+ // the bookmark maintained by the session (returned by the first query).
5438
+ | "first-unconstrained";
5439
+ type D1SessionBookmark = string;
5423
5440
  declare abstract class D1Database {
5424
5441
  prepare(query: string): D1PreparedStatement;
5425
- dump(): Promise<ArrayBuffer>;
5426
5442
  batch<T = unknown>(statements: D1PreparedStatement[]): Promise<D1Result<T>[]>;
5427
5443
  exec(query: string): Promise<D1ExecResult>;
5444
+ /**
5445
+ * Creates a new D1 Session anchored at the given constraint or the bookmark.
5446
+ * All queries executed using the created session will have sequential consistency,
5447
+ * meaning that all writes done through the session will be visible in subsequent reads.
5448
+ *
5449
+ * @param constraintOrBookmark Either the session constraint or the explicit bookmark to anchor the created session.
5450
+ */
5451
+ withSession(
5452
+ constraintOrBookmark?: D1SessionBookmark | D1SessionConstraint,
5453
+ ): D1DatabaseSession;
5454
+ /**
5455
+ * @deprecated dump() will be removed soon, only applies to deprecated alpha v1 databases.
5456
+ */
5457
+ dump(): Promise<ArrayBuffer>;
5458
+ }
5459
+ declare abstract class D1DatabaseSession {
5460
+ prepare(query: string): D1PreparedStatement;
5461
+ batch<T = unknown>(statements: D1PreparedStatement[]): Promise<D1Result<T>[]>;
5462
+ /**
5463
+ * @returns The latest session bookmark across all executed queries on the session.
5464
+ * If no query has been executed yet, `null` is returned.
5465
+ */
5466
+ getBookmark(): D1SessionBookmark | null;
5428
5467
  }
5429
5468
  declare abstract class D1PreparedStatement {
5430
5469
  bind(...values: unknown[]): D1PreparedStatement;
@@ -5750,31 +5789,37 @@ declare module "assets:*" {
5750
5789
  // Copyright (c) 2022-2023 Cloudflare, Inc.
5751
5790
  // Licensed under the Apache 2.0 license found in the LICENSE file or at:
5752
5791
  // https://opensource.org/licenses/Apache-2.0
5753
- type PipelineRecord = Record<string, unknown>;
5754
- type PipelineBatchMetadata = {
5755
- pipelineId: string;
5756
- pipelineName: string;
5757
- };
5758
- declare abstract class PipelineTransformationEntrypoint<
5759
- I extends PipelineRecord,
5760
- O extends PipelineRecord,
5761
- > {
5762
- /**
5763
- * run recieves an array of PipelineRecord which can be
5764
- * mutated and returned to the pipeline
5765
- * @param records Incoming records from the pipeline to be transformed
5766
- * @param metadata Information about the specific pipeline calling the transformation entrypoint
5767
- * @returns A promise containing the transformed PipelineRecord array
5768
- */
5769
- public run(records: I[], metadata: PipelineBatchMetadata): Promise<O[]>;
5770
- }
5771
- interface Pipeline<T extends PipelineRecord> {
5772
- /**
5773
- * The Pipeline interface represents the type of a binding to a Pipeline
5774
- *
5775
- * @param records The records to send to the pipeline
5776
- */
5777
- send(records: T[]): Promise<void>;
5792
+ declare module "cloudflare:pipelines" {
5793
+ export abstract class PipelineTransformationEntrypoint<
5794
+ Env = unknown,
5795
+ I extends PipelineRecord = {},
5796
+ O extends PipelineRecord = {},
5797
+ > {
5798
+ /**
5799
+ * run recieves an array of PipelineRecord which can be
5800
+ * mutated and returned to the pipeline
5801
+ * @param records Incoming records from the pipeline to be transformed
5802
+ * @param metadata Information about the specific pipeline calling the transformation entrypoint
5803
+ * @returns A promise containing the transformed PipelineRecord array
5804
+ */
5805
+ protected env: Env;
5806
+ protected ctx: ExecutionContext;
5807
+ constructor(ctx: ExecutionContext, env: Env);
5808
+ public run(records: I[], metadata: PipelineBatchMetadata): Promise<O[]>;
5809
+ }
5810
+ export type PipelineRecord = Record<string, unknown>;
5811
+ export type PipelineBatchMetadata = {
5812
+ pipelineId: string;
5813
+ pipelineName: string;
5814
+ };
5815
+ export interface Pipeline<T extends PipelineRecord> {
5816
+ /**
5817
+ * The Pipeline interface represents the type of a binding to a Pipeline
5818
+ *
5819
+ * @param records The records to send to the pipeline
5820
+ */
5821
+ send(records: T[]): Promise<void>;
5822
+ }
5778
5823
  }
5779
5824
  // PubSubMessage represents an incoming PubSub message.
5780
5825
  // The message includes metadata about the broker, the client, and the payload
@@ -5984,6 +6029,9 @@ declare namespace Rpc {
5984
6029
  >]: MethodOrProperty<T[K]>;
5985
6030
  };
5986
6031
  }
6032
+ declare namespace Cloudflare {
6033
+ interface Env {}
6034
+ }
5987
6035
  declare module "cloudflare:workers" {
5988
6036
  export type RpcStub<T extends Rpc.Stubable> = Rpc.Stub<T>;
5989
6037
  export const RpcStub: {
@@ -6082,6 +6130,7 @@ declare module "cloudflare:workers" {
6082
6130
  step: WorkflowStep,
6083
6131
  ): Promise<unknown>;
6084
6132
  }
6133
+ export const env: Cloudflare.Env;
6085
6134
  }
6086
6135
  declare module "cloudflare:sockets" {
6087
6136
  function _connect(
@@ -6610,6 +6659,15 @@ declare abstract class Workflow<PARAMS = unknown> {
6610
6659
  public create(
6611
6660
  options?: WorkflowInstanceCreateOptions<PARAMS>,
6612
6661
  ): Promise<WorkflowInstance>;
6662
+ /**
6663
+ * Create a batch of instances and return handle for all of them. If a provided id exists, an error will be thrown.
6664
+ * `createBatch` is limited at 100 instances at a time or when the RPC limit for the batch (1MiB) is reached.
6665
+ * @param batch List of Options when creating an instance including name and params
6666
+ * @returns A promise that resolves with a list of handles for the created instances.
6667
+ */
6668
+ public createBatch(
6669
+ batch: WorkflowInstanceCreateOptions<PARAMS>[],
6670
+ ): Promise<WorkflowInstance[]>;
6613
6671
  }
6614
6672
  interface WorkflowInstanceCreateOptions<PARAMS = unknown> {
6615
6673
  /**
@@ -1697,6 +1697,7 @@ export interface RequestInit<Cf = CfProperties> {
1697
1697
  integrity?: string;
1698
1698
  /* An AbortSignal to set request's signal. */
1699
1699
  signal?: AbortSignal | null;
1700
+ encodeResponseBody?: "automatic" | "manual";
1700
1701
  }
1701
1702
  export type Service<
1702
1703
  T extends Rpc.WorkerEntrypointBranded | undefined = undefined,
@@ -4403,7 +4404,12 @@ export type AIGatewayProviders =
4403
4404
  | "google-ai-studio"
4404
4405
  | "mistral"
4405
4406
  | "grok"
4406
- | "openrouter";
4407
+ | "openrouter"
4408
+ | "deepseek"
4409
+ | "cerebras"
4410
+ | "cartesia"
4411
+ | "elevenlabs"
4412
+ | "adobe-firefly";
4407
4413
  export type AIGatewayHeaders = {
4408
4414
  "cf-aig-metadata":
4409
4415
  | Record<string, number | string | boolean | null | bigint>
@@ -4439,6 +4445,7 @@ export declare abstract class AiGateway {
4439
4445
  run(
4440
4446
  data: AIGatewayUniversalRequest | AIGatewayUniversalRequest[],
4441
4447
  ): Promise<Response>;
4448
+ getUrl(provider: AIGatewayProviders | string): Promise<string>; // eslint-disable-line
4442
4449
  }
4443
4450
  export interface BasicImageTransformations {
4444
4451
  /**
@@ -5446,11 +5453,43 @@ export interface D1ExecResult {
5446
5453
  count: number;
5447
5454
  duration: number;
5448
5455
  }
5456
+ export type D1SessionConstraint =
5457
+ // Indicates that the first query should go to the primary, and the rest queries
5458
+ // using the same D1DatabaseSession will go to any replica that is consistent with
5459
+ // the bookmark maintained by the session (returned by the first query).
5460
+ | "first-primary"
5461
+ // Indicates that the first query can go anywhere (primary or replica), and the rest queries
5462
+ // using the same D1DatabaseSession will go to any replica that is consistent with
5463
+ // the bookmark maintained by the session (returned by the first query).
5464
+ | "first-unconstrained";
5465
+ export type D1SessionBookmark = string;
5449
5466
  export declare abstract class D1Database {
5450
5467
  prepare(query: string): D1PreparedStatement;
5451
- dump(): Promise<ArrayBuffer>;
5452
5468
  batch<T = unknown>(statements: D1PreparedStatement[]): Promise<D1Result<T>[]>;
5453
5469
  exec(query: string): Promise<D1ExecResult>;
5470
+ /**
5471
+ * Creates a new D1 Session anchored at the given constraint or the bookmark.
5472
+ * All queries executed using the created session will have sequential consistency,
5473
+ * meaning that all writes done through the session will be visible in subsequent reads.
5474
+ *
5475
+ * @param constraintOrBookmark Either the session constraint or the explicit bookmark to anchor the created session.
5476
+ */
5477
+ withSession(
5478
+ constraintOrBookmark?: D1SessionBookmark | D1SessionConstraint,
5479
+ ): D1DatabaseSession;
5480
+ /**
5481
+ * @deprecated dump() will be removed soon, only applies to deprecated alpha v1 databases.
5482
+ */
5483
+ dump(): Promise<ArrayBuffer>;
5484
+ }
5485
+ export declare abstract class D1DatabaseSession {
5486
+ prepare(query: string): D1PreparedStatement;
5487
+ batch<T = unknown>(statements: D1PreparedStatement[]): Promise<D1Result<T>[]>;
5488
+ /**
5489
+ * @returns The latest session bookmark across all executed queries on the session.
5490
+ * If no query has been executed yet, `null` is returned.
5491
+ */
5492
+ getBookmark(): D1SessionBookmark | null;
5454
5493
  }
5455
5494
  export declare abstract class D1PreparedStatement {
5456
5495
  bind(...values: unknown[]): D1PreparedStatement;
@@ -5763,35 +5802,6 @@ export type PagesPluginFunction<
5763
5802
  > = (
5764
5803
  context: EventPluginContext<Env, Params, Data, PluginArgs>,
5765
5804
  ) => Response | Promise<Response>;
5766
- // Copyright (c) 2022-2023 Cloudflare, Inc.
5767
- // Licensed under the Apache 2.0 license found in the LICENSE file or at:
5768
- // https://opensource.org/licenses/Apache-2.0
5769
- export type PipelineRecord = Record<string, unknown>;
5770
- export type PipelineBatchMetadata = {
5771
- pipelineId: string;
5772
- pipelineName: string;
5773
- };
5774
- export declare abstract class PipelineTransformationEntrypoint<
5775
- I extends PipelineRecord,
5776
- O extends PipelineRecord,
5777
- > {
5778
- /**
5779
- * run recieves an array of PipelineRecord which can be
5780
- * mutated and returned to the pipeline
5781
- * @param records Incoming records from the pipeline to be transformed
5782
- * @param metadata Information about the specific pipeline calling the transformation entrypoint
5783
- * @returns A promise containing the transformed PipelineRecord array
5784
- */
5785
- public run(records: I[], metadata: PipelineBatchMetadata): Promise<O[]>;
5786
- }
5787
- export interface Pipeline<T extends PipelineRecord> {
5788
- /**
5789
- * The Pipeline interface represents the type of a binding to a Pipeline
5790
- *
5791
- * @param records The records to send to the pipeline
5792
- */
5793
- send(records: T[]): Promise<void>;
5794
- }
5795
5805
  // PubSubMessage represents an incoming PubSub message.
5796
5806
  // The message includes metadata about the broker, the client, and the payload
5797
5807
  // itself.
@@ -6000,6 +6010,9 @@ export declare namespace Rpc {
6000
6010
  >]: MethodOrProperty<T[K]>;
6001
6011
  };
6002
6012
  }
6013
+ export declare namespace Cloudflare {
6014
+ interface Env {}
6015
+ }
6003
6016
  export declare namespace TailStream {
6004
6017
  interface Header {
6005
6018
  readonly name: string;
@@ -6511,6 +6524,15 @@ export declare abstract class Workflow<PARAMS = unknown> {
6511
6524
  public create(
6512
6525
  options?: WorkflowInstanceCreateOptions<PARAMS>,
6513
6526
  ): Promise<WorkflowInstance>;
6527
+ /**
6528
+ * Create a batch of instances and return handle for all of them. If a provided id exists, an error will be thrown.
6529
+ * `createBatch` is limited at 100 instances at a time or when the RPC limit for the batch (1MiB) is reached.
6530
+ * @param batch List of Options when creating an instance including name and params
6531
+ * @returns A promise that resolves with a list of handles for the created instances.
6532
+ */
6533
+ public createBatch(
6534
+ batch: WorkflowInstanceCreateOptions<PARAMS>[],
6535
+ ): Promise<WorkflowInstance[]>;
6514
6536
  }
6515
6537
  export interface WorkflowInstanceCreateOptions<PARAMS = unknown> {
6516
6538
  /**