Skip to content

Commit 955e4d9

Browse files
committedMar 19, 2025
chore: codegen
1 parent f1e8ee4 commit 955e4d9

File tree

2 files changed

+132
-45
lines changed

2 files changed

+132
-45
lines changed
 

‎src/index.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ app.route("/", RANDOM_EMOJI_ROUTER);
1919
app.get(
2020
"/scalar",
2121
apiReference({
22-
spec: {
23-
url: "/openapi.json",
24-
},
22+
url: "/openapi.json",
2523
layout: "classic",
2624
customCss: /* css */`
2725
.endpoint-label-path {

‎worker-configuration.d.ts

+131-42
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
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 {}
811

912
// Begin runtime types
1013
/*! *****************************************************************************
@@ -1402,6 +1405,7 @@ interface RequestInit<Cf = CfProperties> {
14021405
integrity?: string;
14031406
/* An AbortSignal to set request's signal. */
14041407
signal?: (AbortSignal | null);
1408+
encodeResponseBody?: "automatic" | "manual";
14051409
}
14061410
type Service<T extends Rpc.WorkerEntrypointBranded | undefined = undefined> = Fetcher<T>;
14071411
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>;
37703774
declare abstract class Ai<AiModelList extends AiModelListType = AiModels> {
37713775
aiGatewayLogId: string | null;
37723776
gateway(gatewayId: string): AiGateway;
3777+
autorag(autoragId: string): AutoRAG;
37733778
run<Name extends keyof AiModelList, Options extends AiOptions>(model: Name, inputs: AiModelList[Name]["inputs"], options?: Options): Promise<Options extends {
37743779
returnRawResponse: true;
37753780
} ? Response : AiModelList[Name]["postProcessedOutputs"]>;
@@ -3779,12 +3784,14 @@ declare abstract class Ai<AiModelList extends AiModelListType = AiModels> {
37793784
blob: Blob;
37803785
}[], options?: {
37813786
gateway?: GatewayOptions;
3787+
extraHeaders?: object;
37823788
}): Promise<ConversionResponse[]>;
37833789
public toMarkdown(files: {
37843790
name: string;
37853791
blob: Blob;
37863792
}, options?: {
37873793
gateway?: GatewayOptions;
3794+
extraHeaders?: object;
37883795
}): Promise<ConversionResponse>;
37893796
}
37903797
type GatewayOptions = {
@@ -3827,21 +3834,21 @@ type AiGatewayLog = {
38273834
response_head_complete: boolean;
38283835
created_at: Date;
38293836
};
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";
38313838
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": {
38343841
per_token_in?: number;
38353842
per_token_out?: number;
38363843
} | {
38373844
total_cost?: number;
38383845
} | 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;
38433850
Authorization: string;
3844-
'Content-Type': string;
3851+
"Content-Type": string;
38453852
[key: string]: string | number | boolean | object;
38463853
};
38473854
type AIGatewayUniversalRequest = {
@@ -3858,6 +3865,45 @@ declare abstract class AiGateway {
38583865
patchLog(logId: string, data: AiGatewayPatchLog): Promise<void>;
38593866
getLog(logId: string): Promise<AiGatewayLog>;
38603867
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>;
38613907
}
38623908
interface BasicImageTransformations {
38633909
/**
@@ -4579,11 +4625,41 @@ interface D1ExecResult {
45794625
count: number;
45804626
duration: number;
45814627
}
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;
45824638
declare abstract class D1Database {
45834639
prepare(query: string): D1PreparedStatement;
4584-
dump(): Promise<ArrayBuffer>;
45854640
batch<T = unknown>(statements: D1PreparedStatement[]): Promise<D1Result<T>[]>;
45864641
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;
45874663
}
45884664
declare abstract class D1PreparedStatement {
45894665
bind(...values: unknown[]): D1PreparedStatement;
@@ -4877,28 +4953,33 @@ declare module "assets:*" {
48774953
// Copyright (c) 2022-2023 Cloudflare, Inc.
48784954
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
48794955
// 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+
}
49024983
}
49034984
// PubSubMessage represents an incoming PubSub message.
49044985
// The message includes metadata about the broker, the client, and the payload
@@ -4948,9 +5029,6 @@ interface RateLimit {
49485029
*/
49495030
limit(options: RateLimitOptions): Promise<RateLimitOutcome>;
49505031
}
4951-
// Extend this in your apps to properly type Env
4952-
interface Env {
4953-
}
49545032
// Namespace for RPC utility types. Unfortunately, we can't use a `module` here as these types need
49555033
// to referenced by `Fetcher`. This is included in the "importable" version of the types which
49565034
// strips all `module` blocks.
@@ -5049,6 +5127,10 @@ declare namespace Rpc {
50495127
[K in Exclude<keyof T, Reserved | symbol | keyof StubBase<never>>]: MethodOrProperty<T[K]>;
50505128
};
50515129
}
5130+
declare namespace Cloudflare {
5131+
interface Env {
5132+
}
5133+
}
50525134
declare module "cloudflare:workers" {
50535135
export type RpcStub<T extends Rpc.Stubable> = Rpc.Stub<T>;
50545136
export const RpcStub: {
@@ -5112,7 +5194,7 @@ declare module "cloudflare:workers" {
51125194
constructor(ctx: ExecutionContext, env: Env);
51135195
run(event: Readonly<WorkflowEvent<T>>, step: WorkflowStep): Promise<unknown>;
51145196
}
5115-
export const env: Env;
5197+
export const env: Cloudflare.Env;
51165198
}
51175199
declare module "cloudflare:sockets" {
51185200
function _connect(address: string | SocketAddress, options?: SocketOptions): Socket;
@@ -5571,6 +5653,13 @@ declare abstract class Workflow<PARAMS = unknown> {
55715653
* @returns A promise that resolves with a handle for the Instance
55725654
*/
55735655
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[]>;
55745663
}
55755664
interface WorkflowInstanceCreateOptions<PARAMS = unknown> {
55765665
/**

0 commit comments

Comments
 (0)