1
- // Generated by Wrangler by running `wrangler types --env-interface CloudflareBindings` (hash: 89d7044924684f84281de354a02ef061)
2
- // Runtime types generated with workerd@1.20250310.0 2025-03-13
3
- interface CloudflareBindings {
4
- GITHUB_TOKEN : "" ;
5
- API_VERSION : "x.y.z" ;
6
- ENVIRONMENT : "preview" | "production" ;
7
- }
1
+ // Generated by Wrangler by running `wrangler types --env-interface CloudflareBindings` (hash: e71cf0de9c927e7e3f2e02a5b583aba3)
2
+ // Runtime types generated with workerd@1.20250317.0 2025-03-13
3
+ declare namespace Cloudflare {
4
+ interface Env {
5
+ API_VERSION : "x.y.z" ;
6
+ ENVIRONMENT : "preview" | "production" ;
7
+ GITHUB_TOKEN : string ;
8
+ }
9
+ }
10
+ interface CloudflareBindings extends Cloudflare . Env { }
8
11
9
12
// Begin runtime types
10
13
/*! *****************************************************************************
@@ -1402,6 +1405,7 @@ interface RequestInit<Cf = CfProperties> {
1402
1405
integrity ?: string ;
1403
1406
/* An AbortSignal to set request's signal. */
1404
1407
signal ?: ( AbortSignal | null ) ;
1408
+ encodeResponseBody ?: "automatic" | "manual" ;
1405
1409
}
1406
1410
type Service < T extends Rpc . WorkerEntrypointBranded | undefined = undefined > = Fetcher < T > ;
1407
1411
type Fetcher < T extends Rpc . EntrypointBranded | undefined = undefined , Reserved extends string = never > = ( T extends Rpc . EntrypointBranded ? Rpc . Provider < T , Reserved | "fetch" | "connect" > : unknown ) & {
@@ -3770,6 +3774,7 @@ type AiModelListType = Record<string, any>;
3770
3774
declare abstract class Ai < AiModelList extends AiModelListType = AiModels > {
3771
3775
aiGatewayLogId : string | null ;
3772
3776
gateway ( gatewayId : string ) : AiGateway ;
3777
+ autorag ( autoragId : string ) : AutoRAG ;
3773
3778
run < Name extends keyof AiModelList , Options extends AiOptions > ( model : Name , inputs : AiModelList [ Name ] [ "inputs" ] , options ?: Options ) : Promise < Options extends {
3774
3779
returnRawResponse : true ;
3775
3780
} ? Response : AiModelList [ Name ] [ "postProcessedOutputs" ] > ;
@@ -3779,12 +3784,14 @@ declare abstract class Ai<AiModelList extends AiModelListType = AiModels> {
3779
3784
blob : Blob ;
3780
3785
} [ ] , options ?: {
3781
3786
gateway ?: GatewayOptions ;
3787
+ extraHeaders ?: object ;
3782
3788
} ) : Promise < ConversionResponse [ ] > ;
3783
3789
public toMarkdown ( files : {
3784
3790
name : string ;
3785
3791
blob : Blob ;
3786
3792
} , options ?: {
3787
3793
gateway ?: GatewayOptions ;
3794
+ extraHeaders ?: object ;
3788
3795
} ) : Promise < ConversionResponse > ;
3789
3796
}
3790
3797
type GatewayOptions = {
@@ -3827,21 +3834,21 @@ type AiGatewayLog = {
3827
3834
response_head_complete : boolean ;
3828
3835
created_at : Date ;
3829
3836
} ;
3830
- type AIGatewayProviders = ' workers-ai' | ' anthropic' | ' aws-bedrock' | ' azure-openai' | ' google-vertex-ai' | ' huggingface' | ' openai' | ' perplexity-ai' | ' replicate' | ' groq' | ' cohere' | ' google-ai-studio' | ' mistral' | ' grok' | ' openrouter' ;
3837
+ type AIGatewayProviders = " workers-ai" | " anthropic" | " aws-bedrock" | " azure-openai" | " google-vertex-ai" | " huggingface" | " openai" | " perplexity-ai" | " replicate" | " groq" | " cohere" | " google-ai-studio" | " mistral" | " grok" | " openrouter" | "deepseek" | "cerebras" | "cartesia" | "elevenlabs" | "adobe-firefly" ;
3831
3838
type AIGatewayHeaders = {
3832
- ' cf-aig-metadata' : Record < string , number | string | boolean | null | bigint > | string ;
3833
- ' cf-aig-custom-cost' : {
3839
+ " cf-aig-metadata" : Record < string , number | string | boolean | null | bigint > | string ;
3840
+ " cf-aig-custom-cost" : {
3834
3841
per_token_in ?: number ;
3835
3842
per_token_out ?: number ;
3836
3843
} | {
3837
3844
total_cost ?: number ;
3838
3845
} | string ;
3839
- ' cf-aig-cache-ttl' : number | string ;
3840
- ' cf-aig-skip-cache' : boolean | string ;
3841
- ' cf-aig-cache-key' : string ;
3842
- ' cf-aig-collect-log' : boolean | string ;
3846
+ " cf-aig-cache-ttl" : number | string ;
3847
+ " cf-aig-skip-cache" : boolean | string ;
3848
+ " cf-aig-cache-key" : string ;
3849
+ " cf-aig-collect-log" : boolean | string ;
3843
3850
Authorization : string ;
3844
- ' Content-Type' : string ;
3851
+ " Content-Type" : string ;
3845
3852
[ key : string ] : string | number | boolean | object ;
3846
3853
} ;
3847
3854
type AIGatewayUniversalRequest = {
@@ -3858,6 +3865,45 @@ declare abstract class AiGateway {
3858
3865
patchLog ( logId : string , data : AiGatewayPatchLog ) : Promise < void > ;
3859
3866
getLog ( logId : string ) : Promise < AiGatewayLog > ;
3860
3867
run ( data : AIGatewayUniversalRequest | AIGatewayUniversalRequest [ ] ) : Promise < Response > ;
3868
+ getUrl ( provider ?: AIGatewayProviders | string ) : Promise < string > ; // eslint-disable-line
3869
+ }
3870
+ interface AutoRAGInternalError extends Error {
3871
+ }
3872
+ interface AutoRAGNotFoundError extends Error {
3873
+ }
3874
+ interface AutoRAGUnauthorizedError extends Error {
3875
+ }
3876
+ type AutoRagSearchRequest = {
3877
+ query : string ;
3878
+ max_num_results ?: number ;
3879
+ ranking_options ?: {
3880
+ ranker ?: string ;
3881
+ score_threshold ?: number ;
3882
+ } ;
3883
+ rewrite_query ?: boolean ;
3884
+ } ;
3885
+ type AutoRagSearchResponse = {
3886
+ object : "vector_store.search_results.page" ;
3887
+ search_query : string ;
3888
+ data : {
3889
+ file_id : string ;
3890
+ filename : string ;
3891
+ score : number ;
3892
+ attributes : Record < string , string | number | boolean | null > ;
3893
+ content : {
3894
+ type : "text" ;
3895
+ text : string ;
3896
+ } [ ] ;
3897
+ } [ ] ;
3898
+ has_more : boolean ;
3899
+ next_page : string | null ;
3900
+ } ;
3901
+ type AutoRagAiSearchResponse = AutoRagSearchResponse & {
3902
+ response : string ;
3903
+ } ;
3904
+ declare abstract class AutoRAG {
3905
+ search ( params : AutoRagSearchRequest ) : Promise < AutoRagSearchResponse > ;
3906
+ aiSearch ( params : AutoRagSearchRequest ) : Promise < AutoRagAiSearchResponse > ;
3861
3907
}
3862
3908
interface BasicImageTransformations {
3863
3909
/**
@@ -4579,11 +4625,41 @@ interface D1ExecResult {
4579
4625
count : number ;
4580
4626
duration : number ;
4581
4627
}
4628
+ type D1SessionConstraint =
4629
+ // Indicates that the first query should go to the primary, and the rest queries
4630
+ // using the same D1DatabaseSession will go to any replica that is consistent with
4631
+ // the bookmark maintained by the session (returned by the first query).
4632
+ "first-primary"
4633
+ // Indicates that the first query can go anywhere (primary or replica), and the rest queries
4634
+ // using the same D1DatabaseSession will go to any replica that is consistent with
4635
+ // the bookmark maintained by the session (returned by the first query).
4636
+ | "first-unconstrained" ;
4637
+ type D1SessionBookmark = string ;
4582
4638
declare abstract class D1Database {
4583
4639
prepare ( query : string ) : D1PreparedStatement ;
4584
- dump ( ) : Promise < ArrayBuffer > ;
4585
4640
batch < T = unknown > ( statements : D1PreparedStatement [ ] ) : Promise < D1Result < T > [ ] > ;
4586
4641
exec ( query : string ) : Promise < D1ExecResult > ;
4642
+ /**
4643
+ * Creates a new D1 Session anchored at the given constraint or the bookmark.
4644
+ * All queries executed using the created session will have sequential consistency,
4645
+ * meaning that all writes done through the session will be visible in subsequent reads.
4646
+ *
4647
+ * @param constraintOrBookmark Either the session constraint or the explicit bookmark to anchor the created session.
4648
+ */
4649
+ withSession ( constraintOrBookmark ?: D1SessionBookmark | D1SessionConstraint ) : D1DatabaseSession ;
4650
+ /**
4651
+ * @deprecated dump() will be removed soon, only applies to deprecated alpha v1 databases.
4652
+ */
4653
+ dump ( ) : Promise < ArrayBuffer > ;
4654
+ }
4655
+ declare abstract class D1DatabaseSession {
4656
+ prepare ( query : string ) : D1PreparedStatement ;
4657
+ batch < T = unknown > ( statements : D1PreparedStatement [ ] ) : Promise < D1Result < T > [ ] > ;
4658
+ /**
4659
+ * @returns The latest session bookmark across all executed queries on the session.
4660
+ * If no query has been executed yet, `null` is returned.
4661
+ */
4662
+ getBookmark ( ) : D1SessionBookmark | null ;
4587
4663
}
4588
4664
declare abstract class D1PreparedStatement {
4589
4665
bind ( ...values : unknown [ ] ) : D1PreparedStatement ;
@@ -4877,28 +4953,33 @@ declare module "assets:*" {
4877
4953
// Copyright (c) 2022-2023 Cloudflare, Inc.
4878
4954
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
4879
4955
// https://opensource.org/licenses/Apache-2.0
4880
- type PipelineRecord = Record < string , unknown > ;
4881
- type PipelineBatchMetadata = {
4882
- pipelineId : string ;
4883
- pipelineName : string ;
4884
- } ;
4885
- declare abstract class PipelineTransformationEntrypoint < I extends PipelineRecord , O extends PipelineRecord > {
4886
- /**
4887
- * run recieves an array of PipelineRecord which can be
4888
- * mutated and returned to the pipeline
4889
- * @param records Incoming records from the pipeline to be transformed
4890
- * @param metadata Information about the specific pipeline calling the transformation entrypoint
4891
- * @returns A promise containing the transformed PipelineRecord array
4892
- */
4893
- public run ( records : I [ ] , metadata : PipelineBatchMetadata ) : Promise < O [ ] > ;
4894
- }
4895
- interface Pipeline < T extends PipelineRecord > {
4896
- /**
4897
- * The Pipeline interface represents the type of a binding to a Pipeline
4898
- *
4899
- * @param records The records to send to the pipeline
4900
- */
4901
- send ( records : T [ ] ) : Promise < void > ;
4956
+ declare module "cloudflare:pipelines" {
4957
+ export abstract class PipelineTransformationEntrypoint < Env = unknown , I extends PipelineRecord = { } , O extends PipelineRecord = { } > {
4958
+ /**
4959
+ * run recieves an array of PipelineRecord which can be
4960
+ * mutated and returned to the pipeline
4961
+ * @param records Incoming records from the pipeline to be transformed
4962
+ * @param metadata Information about the specific pipeline calling the transformation entrypoint
4963
+ * @returns A promise containing the transformed PipelineRecord array
4964
+ */
4965
+ protected env : Env ;
4966
+ protected ctx : ExecutionContext ;
4967
+ constructor ( ctx : ExecutionContext , env : Env ) ;
4968
+ public run ( records : I [ ] , metadata : PipelineBatchMetadata ) : Promise < O [ ] > ;
4969
+ }
4970
+ export type PipelineRecord = Record < string , unknown > ;
4971
+ export type PipelineBatchMetadata = {
4972
+ pipelineId : string ;
4973
+ pipelineName : string ;
4974
+ } ;
4975
+ export interface Pipeline < T extends PipelineRecord > {
4976
+ /**
4977
+ * The Pipeline interface represents the type of a binding to a Pipeline
4978
+ *
4979
+ * @param records The records to send to the pipeline
4980
+ */
4981
+ send ( records : T [ ] ) : Promise < void > ;
4982
+ }
4902
4983
}
4903
4984
// PubSubMessage represents an incoming PubSub message.
4904
4985
// The message includes metadata about the broker, the client, and the payload
@@ -4948,9 +5029,6 @@ interface RateLimit {
4948
5029
*/
4949
5030
limit ( options : RateLimitOptions ) : Promise < RateLimitOutcome > ;
4950
5031
}
4951
- // Extend this in your apps to properly type Env
4952
- interface Env {
4953
- }
4954
5032
// Namespace for RPC utility types. Unfortunately, we can't use a `module` here as these types need
4955
5033
// to referenced by `Fetcher`. This is included in the "importable" version of the types which
4956
5034
// strips all `module` blocks.
@@ -5049,6 +5127,10 @@ declare namespace Rpc {
5049
5127
[ K in Exclude < keyof T , Reserved | symbol | keyof StubBase < never > > ] : MethodOrProperty < T [ K ] > ;
5050
5128
} ;
5051
5129
}
5130
+ declare namespace Cloudflare {
5131
+ interface Env {
5132
+ }
5133
+ }
5052
5134
declare module "cloudflare:workers" {
5053
5135
export type RpcStub < T extends Rpc . Stubable > = Rpc . Stub < T > ;
5054
5136
export const RpcStub : {
@@ -5112,7 +5194,7 @@ declare module "cloudflare:workers" {
5112
5194
constructor ( ctx : ExecutionContext , env : Env ) ;
5113
5195
run ( event : Readonly < WorkflowEvent < T > > , step : WorkflowStep ) : Promise < unknown > ;
5114
5196
}
5115
- export const env : Env ;
5197
+ export const env : Cloudflare . Env ;
5116
5198
}
5117
5199
declare module "cloudflare:sockets" {
5118
5200
function _connect ( address : string | SocketAddress , options ?: SocketOptions ) : Socket ;
@@ -5571,6 +5653,13 @@ declare abstract class Workflow<PARAMS = unknown> {
5571
5653
* @returns A promise that resolves with a handle for the Instance
5572
5654
*/
5573
5655
public create ( options ?: WorkflowInstanceCreateOptions < PARAMS > ) : Promise < WorkflowInstance > ;
5656
+ /**
5657
+ * Create a batch of instances and return handle for all of them. If a provided id exists, an error will be thrown.
5658
+ * `createBatch` is limited at 100 instances at a time or when the RPC limit for the batch (1MiB) is reached.
5659
+ * @param batch List of Options when creating an instance including name and params
5660
+ * @returns A promise that resolves with a list of handles for the created instances.
5661
+ */
5662
+ public createBatch ( batch : WorkflowInstanceCreateOptions < PARAMS > [ ] ) : Promise < WorkflowInstance [ ] > ;
5574
5663
}
5575
5664
interface WorkflowInstanceCreateOptions < PARAMS = unknown > {
5576
5665
/**
0 commit comments