chore(deps): regenerate worker types
This commit is contained in:
1 parent
4b3caaaf55
commit
2efe0d9336
1 file changed
+231
-40
Vendored
+231
-40
@@ -1,30 +1,31 @@
|
|||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
// Generated by Wrangler by running `wrangler types` (hash: 66ec2d07ecff4cba477f98430a977e7f)
|
// Generated by Wrangler by running `wrangler types` (hash: 0c6962cb0ba4ddc8c608c52059e64907)
|
||||||
// Runtime types generated with workerd@1.20260507.1 2026-03-19 nodejs_compat
|
// Runtime types generated with workerd@1.20260526.1 2026-03-19 nodejs_compat
|
||||||
|
interface __BaseEnv_Env {
|
||||||
|
PASTES_BUCKET: R2Bucket;
|
||||||
|
DB: D1Database;
|
||||||
|
GC_QUEUE: Queue;
|
||||||
|
ASSETS: Fetcher;
|
||||||
|
XBIN_APP_NAME: "Xbin";
|
||||||
|
XBIN_APP_VERSION: "1.0.0";
|
||||||
|
XBIN_PROJECT_PAGE_URL: "https://github.com/xixu-me/xbin";
|
||||||
|
XBIN_BASE_PATH: "/";
|
||||||
|
XBIN_MAX_PASTE_BYTES: "10000000";
|
||||||
|
XBIN_DEFAULT_EXPIRATION: "1hour";
|
||||||
|
XBIN_SUPPORTED_EXPIRATIONS: "5min,10min,30min,1hour,3hour,6hour,12hour,1day,3day,1week";
|
||||||
|
XBIN_ENABLE_LEGACY_API: "true";
|
||||||
|
XBIN_REQUIRE_TURNSTILE: "false";
|
||||||
|
XBIN_BURN_CLAIM_TTL_SECONDS: "120";
|
||||||
|
PASTE_COORDINATOR: DurableObjectNamespace<import("./src/index").PasteCoordinator>;
|
||||||
|
}
|
||||||
declare namespace Cloudflare {
|
declare namespace Cloudflare {
|
||||||
interface GlobalProps {
|
interface GlobalProps {
|
||||||
mainModule: typeof import("./src/index");
|
mainModule: typeof import("./src/index");
|
||||||
durableNamespaces: "PasteCoordinator";
|
durableNamespaces: "PasteCoordinator";
|
||||||
}
|
}
|
||||||
interface Env {
|
interface Env extends __BaseEnv_Env {}
|
||||||
PASTES_BUCKET: R2Bucket;
|
|
||||||
DB: D1Database;
|
|
||||||
GC_QUEUE: Queue;
|
|
||||||
ASSETS: Fetcher;
|
|
||||||
XBIN_APP_NAME: "Xbin";
|
|
||||||
XBIN_APP_VERSION: "1.0.0";
|
|
||||||
XBIN_PROJECT_PAGE_URL: "https://github.com/xixu-me/xbin";
|
|
||||||
XBIN_BASE_PATH: "/";
|
|
||||||
XBIN_MAX_PASTE_BYTES: "10000000";
|
|
||||||
XBIN_DEFAULT_EXPIRATION: "1hour";
|
|
||||||
XBIN_SUPPORTED_EXPIRATIONS: "5min,10min,30min,1hour,3hour,6hour,12hour,1day,3day,1week";
|
|
||||||
XBIN_ENABLE_LEGACY_API: "true";
|
|
||||||
XBIN_REQUIRE_TURNSTILE: "false";
|
|
||||||
XBIN_BURN_CLAIM_TTL_SECONDS: "120";
|
|
||||||
PASTE_COORDINATOR: DurableObjectNamespace<import("./src/index").PasteCoordinator>;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
interface Env extends Cloudflare.Env {}
|
interface Env extends __BaseEnv_Env {}
|
||||||
type StringifyValues<EnvType extends Record<string, unknown>> = {
|
type StringifyValues<EnvType extends Record<string, unknown>> = {
|
||||||
[Binding in keyof EnvType]: EnvType[Binding] extends string ? EnvType[Binding] : string;
|
[Binding in keyof EnvType]: EnvType[Binding] extends string ? EnvType[Binding] : string;
|
||||||
};
|
};
|
||||||
@@ -4849,9 +4850,6 @@ type ChatCompletionChoice = {
|
|||||||
finish_reason: "stop" | "length" | "tool_calls" | "content_filter" | "function_call";
|
finish_reason: "stop" | "length" | "tool_calls" | "content_filter" | "function_call";
|
||||||
logprobs: ChatCompletionLogprobs | null;
|
logprobs: ChatCompletionLogprobs | null;
|
||||||
};
|
};
|
||||||
type ChatCompletionsPromptInput = {
|
|
||||||
prompt: string;
|
|
||||||
} & ChatCompletionsCommonOptions;
|
|
||||||
type ChatCompletionsMessagesInput = {
|
type ChatCompletionsMessagesInput = {
|
||||||
messages: Array<ChatCompletionMessageParam>;
|
messages: Array<ChatCompletionMessageParam>;
|
||||||
} & ChatCompletionsCommonOptions;
|
} & ChatCompletionsCommonOptions;
|
||||||
@@ -8781,11 +8779,11 @@ declare abstract class Base_Ai_Cf_Pipecat_Ai_Smart_Turn_V2 {
|
|||||||
postProcessedOutputs: Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Output;
|
postProcessedOutputs: Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Output;
|
||||||
}
|
}
|
||||||
declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_120B {
|
declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_120B {
|
||||||
inputs: XOR<ResponsesInput, ChatCompletionsInput>;
|
inputs: XOR<ResponsesInput, ChatCompletionsMessagesInput>;
|
||||||
postProcessedOutputs: XOR<ResponsesOutput, ChatCompletionsOutput>;
|
postProcessedOutputs: XOR<ResponsesOutput, ChatCompletionsOutput>;
|
||||||
}
|
}
|
||||||
declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_20B {
|
declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_20B {
|
||||||
inputs: XOR<ResponsesInput, ChatCompletionsInput>;
|
inputs: XOR<ResponsesInput, ChatCompletionsMessagesInput>;
|
||||||
postProcessedOutputs: XOR<ResponsesOutput, ChatCompletionsOutput>;
|
postProcessedOutputs: XOR<ResponsesOutput, ChatCompletionsOutput>;
|
||||||
}
|
}
|
||||||
interface Ai_Cf_Leonardo_Phoenix_1_0_Input {
|
interface Ai_Cf_Leonardo_Phoenix_1_0_Input {
|
||||||
@@ -9761,6 +9759,10 @@ declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_5 {
|
|||||||
inputs: ChatCompletionsInput;
|
inputs: ChatCompletionsInput;
|
||||||
postProcessedOutputs: ChatCompletionsOutput;
|
postProcessedOutputs: ChatCompletionsOutput;
|
||||||
}
|
}
|
||||||
|
declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_6 {
|
||||||
|
inputs: ChatCompletionsInput;
|
||||||
|
postProcessedOutputs: ChatCompletionsOutput;
|
||||||
|
}
|
||||||
declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B {
|
declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B {
|
||||||
inputs: ChatCompletionsInput;
|
inputs: ChatCompletionsInput;
|
||||||
postProcessedOutputs: ChatCompletionsOutput;
|
postProcessedOutputs: ChatCompletionsOutput;
|
||||||
@@ -9858,7 +9860,9 @@ interface AiModels {
|
|||||||
"@cf/black-forest-labs/flux-2-klein-9b": Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B;
|
"@cf/black-forest-labs/flux-2-klein-9b": Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B;
|
||||||
"@cf/zai-org/glm-4.7-flash": Base_Ai_Cf_Zai_Org_Glm_4_7_Flash;
|
"@cf/zai-org/glm-4.7-flash": Base_Ai_Cf_Zai_Org_Glm_4_7_Flash;
|
||||||
"@cf/moonshotai/kimi-k2.5": Base_Ai_Cf_Moonshotai_Kimi_K2_5;
|
"@cf/moonshotai/kimi-k2.5": Base_Ai_Cf_Moonshotai_Kimi_K2_5;
|
||||||
|
"@cf/moonshotai/kimi-k2.6": Base_Ai_Cf_Moonshotai_Kimi_K2_6;
|
||||||
"@cf/nvidia/nemotron-3-120b-a12b": Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B;
|
"@cf/nvidia/nemotron-3-120b-a12b": Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B;
|
||||||
|
"@cf/google/gemma-4-26b-a4b-it": Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT;
|
||||||
}
|
}
|
||||||
type AiOptions = {
|
type AiOptions = {
|
||||||
/**
|
/**
|
||||||
@@ -9911,10 +9915,8 @@ type AiModelsSearchObject = {
|
|||||||
value: string;
|
value: string;
|
||||||
}[];
|
}[];
|
||||||
};
|
};
|
||||||
type ChatCompletionsBase = XOR<ChatCompletionsPromptInput, ChatCompletionsMessagesInput>;
|
type ChatCompletionsBase = ChatCompletionsMessagesInput;
|
||||||
type ChatCompletionsInput = XOR<ChatCompletionsBase, {
|
type ChatCompletionsInput = ChatCompletionsMessagesInput;
|
||||||
requests: ChatCompletionsBase[];
|
|
||||||
}>;
|
|
||||||
interface InferenceUpstreamError extends Error {
|
interface InferenceUpstreamError extends Error {
|
||||||
}
|
}
|
||||||
interface AiInternalError extends Error {
|
interface AiInternalError extends Error {
|
||||||
@@ -9959,8 +9961,15 @@ declare abstract class Ai<AiModelList extends AiModelListType = AiModels> {
|
|||||||
}, options?: AiOptions): Promise<ReadableStream>;
|
}, options?: AiOptions): Promise<ReadableStream>;
|
||||||
// Normal (default) - known model
|
// Normal (default) - known model
|
||||||
run<Name extends keyof AiModelList>(model: Name, inputs: AiModelList[Name]['inputs'], options?: AiOptions): Promise<AiModelList[Name]['postProcessedOutputs']>;
|
run<Name extends keyof AiModelList>(model: Name, inputs: AiModelList[Name]['inputs'], options?: AiOptions): Promise<AiModelList[Name]['postProcessedOutputs']>;
|
||||||
// Unknown model (gateway fallback)
|
// Unknown model (fallback).
|
||||||
run(model: string & {}, inputs: Record<string, unknown>, options?: AiOptions): Promise<Record<string, unknown>>;
|
//
|
||||||
|
// The `Exclude<..., keyof AiModelList>` constraint forces TypeScript to
|
||||||
|
// route any model name that is a literal key of `AiModelList` to one of
|
||||||
|
// the known-model overloads above (so input/output mismatches surface as
|
||||||
|
// type errors rather than silently falling back to `Record<string, unknown>`).
|
||||||
|
// Names that aren't in `AiModelList` — e.g. third-party gateway models
|
||||||
|
// like `"google/nano-banana"` — still hit this overload.
|
||||||
|
run<Model extends string>(model: Model extends keyof AiModelList ? never : Model, inputs: Record<string, unknown>, options?: AiOptions): Promise<Record<string, unknown>>;
|
||||||
models(params?: AiModelsSearchParams): Promise<AiModelsSearchObject[]>;
|
models(params?: AiModelsSearchParams): Promise<AiModelsSearchObject[]>;
|
||||||
toMarkdown(): ToMarkdownService;
|
toMarkdown(): ToMarkdownService;
|
||||||
toMarkdown(files: MarkdownDocument[], options?: ConversionRequestOptions): Promise<ConversionResponse[]>;
|
toMarkdown(files: MarkdownDocument[], options?: ConversionRequestOptions): Promise<ConversionResponse[]>;
|
||||||
@@ -10151,12 +10160,17 @@ interface ArtifactsTokenListResult {
|
|||||||
/** Total number of tokens for the repository. */
|
/** Total number of tokens for the repository. */
|
||||||
total: number;
|
total: number;
|
||||||
}
|
}
|
||||||
/** Handle for a single repository. Returned by Artifacts.get(). */
|
/**
|
||||||
|
* Handle for a single repository. Returned by Artifacts.get().
|
||||||
|
*
|
||||||
|
* Methods may throw `ArtifactsError` with code `INTERNAL_ERROR` if an unexpected service error occurs.
|
||||||
|
*/
|
||||||
interface ArtifactsRepo extends ArtifactsRepoInfo {
|
interface ArtifactsRepo extends ArtifactsRepoInfo {
|
||||||
/**
|
/**
|
||||||
* Create an access token for this repo.
|
* Create an access token for this repo.
|
||||||
* @param scope Token scope: "write" (default) or "read".
|
* @param scope Token scope: "write" (default) or "read".
|
||||||
* @param ttl Time-to-live in seconds (default 86400, min 60, max 31536000).
|
* @param ttl Time-to-live in seconds (default 86400, min 60, max 31536000).
|
||||||
|
* @throws {ArtifactsError} with code `INVALID_TTL` if ttl is out of range.
|
||||||
*/
|
*/
|
||||||
createToken(scope?: 'write' | 'read', ttl?: number): Promise<ArtifactsCreateTokenResult>;
|
createToken(scope?: 'write' | 'read', ttl?: number): Promise<ArtifactsCreateTokenResult>;
|
||||||
/** List tokens for this repo (metadata only, no plaintext). */
|
/** List tokens for this repo (metadata only, no plaintext). */
|
||||||
@@ -10165,6 +10179,7 @@ interface ArtifactsRepo extends ArtifactsRepoInfo {
|
|||||||
* Revoke a token by plaintext or ID.
|
* Revoke a token by plaintext or ID.
|
||||||
* @param tokenOrId Plaintext token or token ID.
|
* @param tokenOrId Plaintext token or token ID.
|
||||||
* @returns true if revoked, false if not found.
|
* @returns true if revoked, false if not found.
|
||||||
|
* @throws {ArtifactsError} with code `INVALID_INPUT` if tokenOrId is empty.
|
||||||
*/
|
*/
|
||||||
revokeToken(tokenOrId: string): Promise<boolean>;
|
revokeToken(tokenOrId: string): Promise<boolean>;
|
||||||
// ── Fork ──
|
// ── Fork ──
|
||||||
@@ -10172,6 +10187,9 @@ interface ArtifactsRepo extends ArtifactsRepoInfo {
|
|||||||
* Fork this repo to a new repo.
|
* Fork this repo to a new repo.
|
||||||
* @param name Target repository name.
|
* @param name Target repository name.
|
||||||
* @param opts Optional: description, readOnly flag, defaultBranchOnly (default true).
|
* @param opts Optional: description, readOnly flag, defaultBranchOnly (default true).
|
||||||
|
* @throws {ArtifactsError} with code `INVALID_REPO_NAME` if name is invalid.
|
||||||
|
* @throws {ArtifactsError} with code `ALREADY_EXISTS` if the target repo already exists.
|
||||||
|
* @throws {ArtifactsError} with code `FORK_IN_PROGRESS` if a fork is already running.
|
||||||
*/
|
*/
|
||||||
fork(name: string, opts?: {
|
fork(name: string, opts?: {
|
||||||
description?: string;
|
description?: string;
|
||||||
@@ -10179,13 +10197,41 @@ interface ArtifactsRepo extends ArtifactsRepoInfo {
|
|||||||
defaultBranchOnly?: boolean;
|
defaultBranchOnly?: boolean;
|
||||||
}): Promise<ArtifactsCreateRepoResult>;
|
}): Promise<ArtifactsCreateRepoResult>;
|
||||||
}
|
}
|
||||||
/** Artifacts binding — namespace-level operations. */
|
// ── Error types ──────────────────────────────────────────────────────────────
|
||||||
|
/**
|
||||||
|
* Error codes returned by Artifacts binding operations.
|
||||||
|
*
|
||||||
|
* Each code maps to a numeric code available on `ArtifactsError.numericCode`.
|
||||||
|
*/
|
||||||
|
type ArtifactsErrorCode = 'ALREADY_EXISTS' | 'NOT_FOUND' | 'IMPORT_IN_PROGRESS' | 'FORK_IN_PROGRESS' | 'INVALID_INPUT' | 'INVALID_REPO_NAME' | 'INVALID_TTL' | 'INVALID_URL' | 'REMOTE_AUTH_REQUIRED' | 'UPSTREAM_UNAVAILABLE' | 'MEMORY_LIMIT' | 'INTERNAL_ERROR';
|
||||||
|
/**
|
||||||
|
* Error thrown by Artifacts binding operations.
|
||||||
|
*
|
||||||
|
* Uses a string `.code` discriminator following the Cloudflare platform
|
||||||
|
* convention (StreamError, ImagesError, etc.). The `.numericCode` matches
|
||||||
|
* the REST API `errors[].code` values.
|
||||||
|
*/
|
||||||
|
interface ArtifactsError extends Error {
|
||||||
|
readonly name: 'ArtifactsError';
|
||||||
|
/** String error code for programmatic matching. */
|
||||||
|
readonly code: ArtifactsErrorCode;
|
||||||
|
/** Numeric error code matching the REST API. */
|
||||||
|
readonly numericCode: number;
|
||||||
|
}
|
||||||
|
// ── Binding ──────────────────────────────────────────────────────────────────
|
||||||
|
/**
|
||||||
|
* Artifacts binding — namespace-level operations.
|
||||||
|
*
|
||||||
|
* Methods may throw `ArtifactsError` with code `INTERNAL_ERROR` if an unexpected service error occurs.
|
||||||
|
*/
|
||||||
interface Artifacts {
|
interface Artifacts {
|
||||||
/**
|
/**
|
||||||
* Create a new repository with an initial access token.
|
* Create a new repository with an initial access token.
|
||||||
* @param name Repository name (alphanumeric, dots, hyphens, underscores).
|
* @param name Repository name (alphanumeric, dots, hyphens, underscores).
|
||||||
* @param opts Optional: readOnly flag, description, default branch name.
|
* @param opts Optional: readOnly flag, description, default branch name.
|
||||||
* @returns Repo metadata with initial token.
|
* @returns Repo metadata with initial token.
|
||||||
|
* @throws {ArtifactsError} with code `INVALID_REPO_NAME` if name is invalid.
|
||||||
|
* @throws {ArtifactsError} with code `ALREADY_EXISTS` if the repo already exists.
|
||||||
*/
|
*/
|
||||||
create(name: string, opts?: {
|
create(name: string, opts?: {
|
||||||
readOnly?: boolean;
|
readOnly?: boolean;
|
||||||
@@ -10196,12 +10242,23 @@ interface Artifacts {
|
|||||||
* Get a handle to an existing repository.
|
* Get a handle to an existing repository.
|
||||||
* @param name Repository name.
|
* @param name Repository name.
|
||||||
* @returns Repo handle.
|
* @returns Repo handle.
|
||||||
|
* @throws {ArtifactsError} with code `NOT_FOUND` if the repo does not exist.
|
||||||
|
* @throws {ArtifactsError} with code `IMPORT_IN_PROGRESS` if the repo is still importing.
|
||||||
|
* @throws {ArtifactsError} with code `FORK_IN_PROGRESS` if the repo is still forking.
|
||||||
*/
|
*/
|
||||||
get(name: string): Promise<ArtifactsRepo>;
|
get(name: string): Promise<ArtifactsRepo>;
|
||||||
/**
|
/**
|
||||||
* Import a repository from an external git remote.
|
* Import a repository from an external git remote.
|
||||||
* @param params Source URL and optional branch/depth, plus target name and options.
|
* @param params Source URL and optional branch/depth, plus target name and options.
|
||||||
* @returns Repo metadata with initial token.
|
* @returns Repo metadata with initial token.
|
||||||
|
* @throws {ArtifactsError} with code `INVALID_REPO_NAME` if the target name is invalid.
|
||||||
|
* @throws {ArtifactsError} with code `INVALID_INPUT` if the source URL is not valid HTTPS.
|
||||||
|
* @throws {ArtifactsError} with code `INVALID_URL` if the source URL does not point to a git repository.
|
||||||
|
* @throws {ArtifactsError} with code `REMOTE_AUTH_REQUIRED` if the remote requires authentication.
|
||||||
|
* @throws {ArtifactsError} with code `NOT_FOUND` if the remote repository does not exist.
|
||||||
|
* @throws {ArtifactsError} with code `UPSTREAM_UNAVAILABLE` if the remote cannot be reached.
|
||||||
|
* @throws {ArtifactsError} with code `MEMORY_LIMIT` if the import exceeds service memory limits.
|
||||||
|
* @throws {ArtifactsError} with code `ALREADY_EXISTS` if the target repo already exists.
|
||||||
*/
|
*/
|
||||||
import(params: {
|
import(params: {
|
||||||
source: {
|
source: {
|
||||||
@@ -10229,6 +10286,7 @@ interface Artifacts {
|
|||||||
* Delete a repository and all associated tokens.
|
* Delete a repository and all associated tokens.
|
||||||
* @param name Repository name.
|
* @param name Repository name.
|
||||||
* @returns true if deleted, false if not found.
|
* @returns true if deleted, false if not found.
|
||||||
|
* @throws {ArtifactsError} with code `INVALID_REPO_NAME` if name is invalid.
|
||||||
*/
|
*/
|
||||||
delete(name: string): Promise<boolean>;
|
delete(name: string): Promise<boolean>;
|
||||||
}
|
}
|
||||||
@@ -11328,11 +11386,11 @@ interface SendEmail {
|
|||||||
send(message: EmailMessage): Promise<EmailSendResult>;
|
send(message: EmailMessage): Promise<EmailSendResult>;
|
||||||
send(builder: {
|
send(builder: {
|
||||||
from: string | EmailAddress;
|
from: string | EmailAddress;
|
||||||
to: string | string[];
|
to: string | EmailAddress | (string | EmailAddress)[];
|
||||||
subject: string;
|
subject: string;
|
||||||
replyTo?: string | EmailAddress;
|
replyTo?: string | EmailAddress;
|
||||||
cc?: string | string[];
|
cc?: string | EmailAddress | (string | EmailAddress)[];
|
||||||
bcc?: string | string[];
|
bcc?: string | EmailAddress | (string | EmailAddress)[];
|
||||||
headers?: Record<string, string>;
|
headers?: Record<string, string>;
|
||||||
text?: string;
|
text?: string;
|
||||||
html?: string;
|
html?: string;
|
||||||
@@ -12174,9 +12232,19 @@ declare namespace CloudflareWorkersModule {
|
|||||||
attempt: number;
|
attempt: number;
|
||||||
config: WorkflowStepConfig;
|
config: WorkflowStepConfig;
|
||||||
};
|
};
|
||||||
|
export type WorkflowRollbackContext<T = unknown> = {
|
||||||
|
error: Error;
|
||||||
|
output: T | undefined;
|
||||||
|
stepName: string;
|
||||||
|
};
|
||||||
|
export type WorkflowRollbackHandler<T = unknown> = (ctx: WorkflowRollbackContext<T>) => Promise<void>;
|
||||||
|
export type WorkflowStepRollbackOptions<T = unknown> = {
|
||||||
|
rollback?: WorkflowRollbackHandler<T>;
|
||||||
|
rollbackConfig?: WorkflowStepConfig;
|
||||||
|
};
|
||||||
export abstract class WorkflowStep {
|
export abstract class WorkflowStep {
|
||||||
do<T extends Rpc.Serializable<T>>(name: string, callback: (ctx: WorkflowStepContext) => Promise<T>): Promise<T>;
|
do<T extends Rpc.Serializable<T>>(name: string, callback: (ctx: WorkflowStepContext) => Promise<T>, rollbackOptions?: WorkflowStepRollbackOptions<T>): Promise<T>;
|
||||||
do<T extends Rpc.Serializable<T>>(name: string, config: WorkflowStepConfig, callback: (ctx: WorkflowStepContext) => Promise<T>): Promise<T>;
|
do<T extends Rpc.Serializable<T>>(name: string, config: WorkflowStepConfig, callback: (ctx: WorkflowStepContext) => Promise<T>, rollbackOptions?: WorkflowStepRollbackOptions<T>): Promise<T>;
|
||||||
sleep: (name: string, duration: WorkflowSleepDuration) => Promise<void>;
|
sleep: (name: string, duration: WorkflowSleepDuration) => Promise<void>;
|
||||||
sleepUntil: (name: string, timestamp: Date | number) => Promise<void>;
|
sleepUntil: (name: string, timestamp: Date | number) => Promise<void>;
|
||||||
waitForEvent<T extends Rpc.Serializable<T>>(name: string, options: {
|
waitForEvent<T extends Rpc.Serializable<T>>(name: string, options: {
|
||||||
@@ -13166,6 +13234,9 @@ declare namespace TailStream {
|
|||||||
// 1. This is an Onset event
|
// 1. This is an Onset event
|
||||||
// 2. We are not inheriting any SpanContext. (e.g. this is a cross-account service binding or a new top-level invocation)
|
// 2. We are not inheriting any SpanContext. (e.g. this is a cross-account service binding or a new top-level invocation)
|
||||||
readonly spanId?: string;
|
readonly spanId?: string;
|
||||||
|
// W3C trace flags from an upstream traceparent. Absent when no upstream
|
||||||
|
// sampling decision was made.
|
||||||
|
readonly traceFlags?: number;
|
||||||
}
|
}
|
||||||
interface TailEvent<Event extends EventType> {
|
interface TailEvent<Event extends EventType> {
|
||||||
// invocation id of the currently invoked worker stage.
|
// invocation id of the currently invoked worker stage.
|
||||||
@@ -13439,6 +13510,103 @@ type WorkerVersionMetadata = {
|
|||||||
/** The timestamp of when the Worker Version was uploaded */
|
/** The timestamp of when the Worker Version was uploaded */
|
||||||
timestamp: string;
|
timestamp: string;
|
||||||
};
|
};
|
||||||
|
// ============ Web Search Request Types ============
|
||||||
|
/**
|
||||||
|
* Options for a Web Search query.
|
||||||
|
*/
|
||||||
|
type WebSearchSearchOptions = {
|
||||||
|
/** The search query. */
|
||||||
|
query: string;
|
||||||
|
/**
|
||||||
|
* Maximum number of results to return. Defaults to 10, capped at 20.
|
||||||
|
* The actual count may be lower if fewer matches exist.
|
||||||
|
*/
|
||||||
|
limit?: number;
|
||||||
|
};
|
||||||
|
// ============ Web Search Response Types ============
|
||||||
|
/**
|
||||||
|
* A single Web Search result.
|
||||||
|
*
|
||||||
|
* Web Search is discovery-only -- results carry catalog metadata about a page
|
||||||
|
* but never the page body. To read a result's content the caller invokes the
|
||||||
|
* global `fetch()` API against the result's `url`, at which point the
|
||||||
|
* destination's own access controls apply (including Cloudflare Pay-per-Crawl).
|
||||||
|
*/
|
||||||
|
type WebSearchResult = {
|
||||||
|
/** Canonical URL. */
|
||||||
|
url: string;
|
||||||
|
/** Page title. */
|
||||||
|
title: string;
|
||||||
|
/** Page-level description. May be absent. */
|
||||||
|
description?: string;
|
||||||
|
/**
|
||||||
|
* Last-modified date for the page, when known. Naive (no timezone)
|
||||||
|
* ISO-8601 datetime, e.g. `"2025-11-30T04:39:48"`.
|
||||||
|
*/
|
||||||
|
lastModifiedDate?: string;
|
||||||
|
/**
|
||||||
|
* Page meta image URL (typically the `og:image`). May be absent.
|
||||||
|
*/
|
||||||
|
imageUrl?: string;
|
||||||
|
/** Optional favicon URL for UI hints. */
|
||||||
|
faviconUrl?: string;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Per-response metadata for a Web Search query. Carries operational
|
||||||
|
* fields useful for support and debugging.
|
||||||
|
*/
|
||||||
|
type WebSearchResponseMetadata = {
|
||||||
|
/** The query that was executed. */
|
||||||
|
query: string;
|
||||||
|
/** Opaque request identifier used for support and debugging. */
|
||||||
|
requestId: string;
|
||||||
|
/** End-to-end latency for this search request, in milliseconds. */
|
||||||
|
latencyMs: number;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Response from a Web Search query.
|
||||||
|
*/
|
||||||
|
type WebSearchSearchResponse = {
|
||||||
|
items: WebSearchResult[];
|
||||||
|
metadata: WebSearchResponseMetadata;
|
||||||
|
};
|
||||||
|
// ============ Web Search Binding Class ============
|
||||||
|
/**
|
||||||
|
* Cloudflare Web Search binding.
|
||||||
|
*
|
||||||
|
* Discovery-only primitive for agents and Workers. Returns URLs and catalog
|
||||||
|
* metadata for a query; never returns page content or excerpts. To read a
|
||||||
|
* result's body, fetch the URL with the global `fetch()` API.
|
||||||
|
*
|
||||||
|
* Declared in wrangler with a single object (there is exactly one corpus, the
|
||||||
|
* public web, so there is no name, namespace, or instance to specify):
|
||||||
|
*
|
||||||
|
* ```jsonc
|
||||||
|
* { "web_search": { "binding": "WEBSEARCH" } }
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* ```ts
|
||||||
|
* const { items, metadata } = await env.WEBSEARCH.search({
|
||||||
|
* query: "Cloudflare Workers",
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* const top = items[0];
|
||||||
|
* console.log(top.url, top.title, metadata.latencyMs);
|
||||||
|
*
|
||||||
|
* // Read content yourself; pay-per-crawl and other publisher
|
||||||
|
* // controls apply at the fetch site, not at search time.
|
||||||
|
* const page = await fetch(top.url);
|
||||||
|
* ```
|
||||||
|
*/
|
||||||
|
declare abstract class WebSearch {
|
||||||
|
/**
|
||||||
|
* Run a Web Search query.
|
||||||
|
* @param options Search options. Only `query` is required.
|
||||||
|
* @returns The matching results plus per-response metadata.
|
||||||
|
*/
|
||||||
|
search(options: WebSearchSearchOptions): Promise<WebSearchSearchResponse>;
|
||||||
|
}
|
||||||
interface DynamicDispatchLimits {
|
interface DynamicDispatchLimits {
|
||||||
/**
|
/**
|
||||||
* Limit CPU time in milliseconds.
|
* Limit CPU time in milliseconds.
|
||||||
@@ -13540,6 +13708,27 @@ interface WorkflowError {
|
|||||||
code?: number;
|
code?: number;
|
||||||
message: string;
|
message: string;
|
||||||
}
|
}
|
||||||
|
interface WorkflowInstanceRestartOptions {
|
||||||
|
/**
|
||||||
|
* Restart from a specific step. If omitted, the instance restarts from the beginning.
|
||||||
|
* The step must exist in the instance's execution history.
|
||||||
|
*/
|
||||||
|
from?: {
|
||||||
|
/**
|
||||||
|
* The step name as defined in your workflow code.
|
||||||
|
*/
|
||||||
|
name: string;
|
||||||
|
/**
|
||||||
|
* 1-indexed occurrence of this step name. Use when the same step name appears multiple times (e.g. in a loop).
|
||||||
|
* @default 1
|
||||||
|
*/
|
||||||
|
count?: number;
|
||||||
|
/**
|
||||||
|
* Step type filter. Use when different step types share the same name.
|
||||||
|
*/
|
||||||
|
type?: 'do' | 'sleep' | 'waitForEvent';
|
||||||
|
};
|
||||||
|
}
|
||||||
declare abstract class WorkflowInstance {
|
declare abstract class WorkflowInstance {
|
||||||
public id: string;
|
public id: string;
|
||||||
/**
|
/**
|
||||||
@@ -13555,9 +13744,11 @@ declare abstract class WorkflowInstance {
|
|||||||
*/
|
*/
|
||||||
public terminate(): Promise<void>;
|
public terminate(): Promise<void>;
|
||||||
/**
|
/**
|
||||||
* Restart the instance.
|
* Restart the instance. Optionally restart from a specific step, preserving
|
||||||
|
* cached results for all steps before it.
|
||||||
|
* @param options Options for the restart, including an optional step to restart from.
|
||||||
*/
|
*/
|
||||||
public restart(): Promise<void>;
|
public restart(options?: WorkflowInstanceRestartOptions): Promise<void>;
|
||||||
/**
|
/**
|
||||||
* Returns the current status of the instance.
|
* Returns the current status of the instance.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in new issue
Block a user