Skip to content

Commit b2e8daa

Browse files
Regenerate worker types
1 parent 6b41fa1 commit b2e8daa

1 file changed

Lines changed: 121 additions & 13 deletions

File tree

worker-configuration.d.ts

Lines changed: 121 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* eslint-disable */
2-
// Runtime types generated with workerd@1.20260730.1 2024-09-09 nodejs_compat
2+
// Runtime types generated with workerd@1.20260811.1 2024-09-09 nodejs_compat
33
// Begin runtime types
44
/*! *****************************************************************************
55
Copyright (c) Cloudflare. All rights reserved.
@@ -422,6 +422,7 @@ interface ExecutionContext<Props = unknown> {
422422
cache?: CacheContext;
423423
readonly access?: CloudflareAccessContext;
424424
tracing: Tracing;
425+
abort(reason?: any): void;
425426
}
426427
type ExportedHandlerFetchHandler<Env = unknown, CfHostMetadata = unknown, Props = unknown> = (request: Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>, env: Env, ctx: ExecutionContext<Props>) => Response | Promise<Response>;
427428
type ExportedHandlerConnectHandler<Env = unknown, Props = unknown> = (socket: Socket, env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;
@@ -2744,6 +2745,12 @@ interface TraceLog {
27442745
readonly timestamp: number;
27452746
readonly level: string;
27462747
readonly message: any;
2748+
readonly errorInfo?: (TraceLogErrorInfo | null)[];
2749+
}
2750+
interface TraceLogErrorInfo {
2751+
name: string;
2752+
message: string;
2753+
stack?: string;
27472754
}
27482755
interface TraceException {
27492756
readonly timestamp: number;
@@ -3283,18 +3290,26 @@ interface ContainerExecOptions {
32833290
cwd?: string;
32843291
env?: Record<string, string>;
32853292
user?: string;
3293+
signal?: AbortSignal;
3294+
pty?: boolean | ContainerExecPtyOptions;
32863295
stdin?: ReadableStream | "pipe";
32873296
stdout?: "pipe" | "ignore";
32883297
stderr?: "pipe" | "ignore" | "combined";
32893298
}
3299+
interface ContainerExecPtyOptions {
3300+
cols?: number;
3301+
rows?: number;
3302+
}
32903303
interface ExecProcess {
32913304
readonly stdin: WritableStream | null;
32923305
readonly stdout: ReadableStream | null;
32933306
readonly stderr: ReadableStream | null;
32943307
readonly pid: number;
3308+
readonly isPty: boolean;
32953309
readonly exitCode: Promise<number>;
32963310
output(): Promise<ExecOutput>;
32973311
kill(signal?: number): void;
3312+
resize(cols: number, rows: number): void;
32983313
}
32993314
interface Container {
33003315
get running(): boolean;
@@ -3341,6 +3356,11 @@ interface ContainerStartupOptions {
33413356
directorySnapshots?: ContainerDirectorySnapshotRestoreParams[];
33423357
containerSnapshot?: ContainerSnapshot;
33433358
}
3359+
interface ContainerStartResources {
3360+
vcpu: number;
3361+
memoryMib: number;
3362+
diskMb: number;
3363+
}
33443364
/**
33453365
* The **`MessagePort`** interface of the Channel Messaging API represents one of the two ports of a MessageChannel, allowing messages to be sent from one port and listening out for them arriving at the other.
33463366
*
@@ -3461,11 +3481,13 @@ declare abstract class Performance {
34613481
interface Tracing {
34623482
enterSpan<T, A extends unknown[]>(name: string, callback: (span: Span, ...args: A) => T, ...args: A): T;
34633483
startActiveSpan<T, A extends unknown[]>(name: string, callback: (span: Span, ...args: A) => T, ...args: A): T;
3484+
startSpan(name: string): Span;
34643485
Span: typeof Span;
34653486
}
34663487
declare abstract class Span {
34673488
get isTraced(): boolean;
3468-
setAttribute(key: string, value?: (boolean | number | string)): void;
3489+
setAttribute(key: string, value: boolean | number | string): this;
3490+
setAttributes(attributes: Record<string, boolean | number | string | undefined>): this;
34693491
end(): void;
34703492
}
34713493
/**
@@ -4105,6 +4127,13 @@ type AiSearchListItemsParams = {
41054127
source?: string;
41064128
/** JSON-encoded Vectorize filter for metadata filtering. */
41074129
metadata_filter?: string;
4130+
/** Filter items by their unique ID. Returns at most one item. */
4131+
item_id?: string;
4132+
/**
4133+
* Filter items by their exact key (object key / filename). Keys are unique
4134+
* per source, so combine with `source` to disambiguate across data sources.
4135+
*/
4136+
key?: string;
41084137
};
41094138
type AiSearchListItemsResponse = {
41104139
result: AiSearchItemInfo[];
@@ -12393,6 +12422,15 @@ interface Hyperdrive {
1239312422
* for your database.
1239412423
*/
1239512424
readonly host: string;
12425+
/*
12426+
* A synthetic IPv4 address (in the reserved 240.0.0.0/4 range) that, like the
12427+
* host field, is only valid within the context of the currently running
12428+
* Worker and, when passed into the `connect()` function from the
12429+
* "cloudflare:sockets" module, will connect to the Hyperdrive instance for
12430+
* your database. This is provided for database drivers that require the host
12431+
* to be an IP literal rather than a hostname.
12432+
*/
12433+
readonly ip: string;
1239612434
/*
1239712435
* The port that must be paired the the host field when connecting.
1239812436
*/
@@ -13079,6 +13117,26 @@ declare namespace CloudflareWorkersModule {
1307913117
timeout?: WorkflowTimeoutDuration | number;
1308013118
sensitive?: WorkflowStepSensitivity;
1308113119
};
13120+
// Internal discriminators used only for `WorkflowStep.do` overload
13121+
// resolution. They mirror `WorkflowStepConfig` but pin `retries.delay` to a
13122+
// single kind so the callback context can be narrowed based on the shape of
13123+
// the config argument (rather than on an inferred type parameter, which is
13124+
// lost when the caller supplies an explicit return-type argument). Not
13125+
// exported: they must not widen the public type surface.
13126+
type WorkflowStepConfigWithStaticDelay = Omit<WorkflowStepConfig, 'retries'> & {
13127+
retries?: {
13128+
limit: number;
13129+
delay: WorkflowDelayDuration | number;
13130+
backoff?: WorkflowBackoff;
13131+
};
13132+
};
13133+
type WorkflowStepConfigWithDelayFunction = Omit<WorkflowStepConfig, 'retries'> & {
13134+
retries: {
13135+
limit: number;
13136+
delay: WorkflowDelayFunction;
13137+
backoff?: WorkflowBackoff;
13138+
};
13139+
};
1308213140
export type WorkflowStepRollbackConfig = Pick<WorkflowStepConfig, 'retries' | 'timeout'>;
1308313141
export type WorkflowCronSchedule = {
1308413142
/** Cron expression that triggered this event. */
@@ -13116,23 +13174,35 @@ declare namespace CloudflareWorkersModule {
1311613174
sensitive?: WorkflowStepSensitivity;
1311713175
};
1311813176
};
13119-
export type WorkflowRollbackContext<T = unknown> = {
13120-
ctx: WorkflowStepContext;
13177+
// The rollback handler receives the step context, so it mirrors the same
13178+
// delay discriminant as the step callback: when the step was configured with
13179+
// a dynamic delay function the resolved `config.retries.delay` is omitted,
13180+
// otherwise it is present. `Delay` is threaded from the `WorkflowStep.do`
13181+
// overload that matched the step config.
13182+
export type WorkflowRollbackContext<T = unknown, Delay = WorkflowDelayDuration | number> = {
13183+
ctx: WorkflowStepContext<Delay>;
1312113184
error: Error;
1312213185
output: T | undefined;
1312313186
/** @deprecated Use `ctx.step.name` and `ctx.step.count` instead. */
1312413187
stepName: string;
1312513188
};
13126-
export type WorkflowRollbackHandler<T = unknown> = (ctx: WorkflowRollbackContext<T>) => Promise<void>;
13127-
export type WorkflowStepRollbackOptions<T = unknown> = {
13128-
rollback: WorkflowRollbackHandler<T>;
13189+
export type WorkflowRollbackHandler<T = unknown, Delay = WorkflowDelayDuration | number> = (ctx: WorkflowRollbackContext<T, Delay>) => Promise<void>;
13190+
export type WorkflowStepRollbackOptions<T = unknown, Delay = WorkflowDelayDuration | number> = {
13191+
rollback: WorkflowRollbackHandler<T, Delay>;
1312913192
rollbackConfig?: WorkflowStepRollbackConfig;
1313013193
};
1313113194
export abstract class WorkflowStep {
1313213195
do<T extends Rpc.Serializable<T>>(name: string, callback: (ctx: WorkflowStepContext) => Promise<T>, rollbackOptions?: WorkflowStepRollbackOptions<T>): Promise<T>;
13133-
do<T extends Rpc.Serializable<T>, const C extends WorkflowStepConfig>(name: string, config: C, callback: (ctx: WorkflowStepContext<C['retries'] extends {
13134-
delay: infer D;
13135-
} ? D : WorkflowDelayDuration | number>) => Promise<T>, rollbackOptions?: WorkflowStepRollbackOptions<T>): Promise<T>;
13196+
// The config overloads discriminate on the shape of `config.retries.delay`
13197+
// so the callback context reflects whether the resolved delay is present
13198+
// (static delay) or omitted (dynamic delay function). Each has a single
13199+
// type parameter, so an explicit return-type argument (`do<T>(...)`) still
13200+
// resolves here. ORDERING IS LOAD-BEARING: the broad `WorkflowStepConfig`
13201+
// fallback MUST remain last, otherwise it shadows the discriminating
13202+
// overloads and narrowing is silently lost.
13203+
do<T extends Rpc.Serializable<T>>(name: string, config: WorkflowStepConfigWithDelayFunction, callback: (ctx: WorkflowStepContext<WorkflowDelayFunction>) => Promise<T>, rollbackOptions?: WorkflowStepRollbackOptions<T, WorkflowDelayFunction>): Promise<T>;
13204+
do<T extends Rpc.Serializable<T>>(name: string, config: WorkflowStepConfigWithStaticDelay, callback: (ctx: WorkflowStepContext<WorkflowDelayDuration | number>) => Promise<T>, rollbackOptions?: WorkflowStepRollbackOptions<T, WorkflowDelayDuration | number>): Promise<T>;
13205+
do<T extends Rpc.Serializable<T>>(name: string, config: WorkflowStepConfig, callback: (ctx: WorkflowStepContext) => Promise<T>, rollbackOptions?: WorkflowStepRollbackOptions<T>): Promise<T>;
1313613206
sleep: (name: string, duration: WorkflowSleepDuration) => Promise<void>;
1313713207
sleepUntil: (name: string, timestamp: Date | number) => Promise<void>;
1313813208
waitForEvent<T extends Rpc.Serializable<T>>(name: string, options: {
@@ -13907,11 +13977,12 @@ type MarkdownDocument = {
1390713977
name: string;
1390813978
blob: Blob;
1390913979
};
13980+
type OutputFormat = 'markdown' | 'text';
1391013981
type ConversionResponse = {
1391113982
id: string;
1391213983
name: string;
1391313984
mimeType: string;
13914-
format: 'markdown';
13985+
format: OutputFormat;
1391513986
tokens: number;
1391613987
data: string;
1391713988
} | {
@@ -13928,7 +13999,11 @@ type EmbeddedImageConversionOptions = ImageConversionOptions & {
1392813999
convert?: boolean;
1392914000
maxConvertedImages?: number;
1393014001
};
14002+
type ConversionOutputOptions = {
14003+
format?: OutputFormat;
14004+
};
1393114005
type ConversionOptions = {
14006+
output?: ConversionOutputOptions;
1393214007
html?: {
1393314008
images?: EmbeddedImageConversionOptions & {
1393414009
convertOGImage?: boolean;
@@ -14077,11 +14152,22 @@ declare namespace TailStream {
1407714152
readonly message: string;
1407814153
readonly stack?: string;
1407914154
}
14080-
interface Log {
14155+
interface TailStreamErrorInfo {
14156+
readonly name: string;
14157+
readonly message: string;
14158+
readonly stack?: string;
14159+
}
14160+
type Log = {
1408114161
readonly type: "log";
1408214162
readonly level: "debug" | "error" | "info" | "log" | "warn";
14163+
readonly errorInfo?: readonly (TailStreamErrorInfo | null)[];
14164+
} & ({
1408314165
readonly message: object;
14084-
}
14166+
readonly truncated?: false;
14167+
} | {
14168+
readonly message: string;
14169+
readonly truncated: true;
14170+
});
1408514171
interface DroppedEventsDiagnostic {
1408614172
readonly diagnosticsType: "droppedEvents";
1408714173
readonly count: number;
@@ -14559,7 +14645,25 @@ declare abstract class Workflow<PARAMS = unknown> {
1455914645
* @returns A promise that resolves with a list of handles for the created instances.
1456014646
*/
1456114647
public createBatch(batch: WorkflowInstanceCreateOptions<PARAMS>[]): Promise<WorkflowInstance[]>;
14648+
/**
14649+
* Delete a batch of Workflow instances and their stored state.
14650+
* `deleteBatch` is limited to 100 instances at a time. Duplicate IDs are deleted once.
14651+
* The result contains one entry for each input position; IDs that do not exist are returned as per-instance errors.
14652+
* @param instanceIds IDs of the Workflow instances to delete
14653+
* @returns A promise that resolves with the successfully deleted instances and any per-instance errors.
14654+
*/
14655+
public deleteBatch(instanceIds: string[]): Promise<WorkflowBatchDeleteResult>;
1456214656
}
14657+
type WorkflowBatchDeleteResult = {
14658+
deleted: {
14659+
id: string;
14660+
}[];
14661+
errors: {
14662+
id: string;
14663+
code: number;
14664+
message: string;
14665+
}[];
14666+
};
1456314667
type WorkflowDurationLabel = 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year';
1456414668
type WorkflowSleepDuration = `${number} ${WorkflowDurationLabel}${'s' | ''}` | number;
1456514669
type WorkflowRetentionDuration = WorkflowSleepDuration;
@@ -14646,6 +14750,10 @@ declare abstract class WorkflowInstance {
1464614750
* @param options Options for the restart, including an optional step to restart from.
1464714751
*/
1464814752
public restart(options?: WorkflowInstanceRestartOptions): Promise<void>;
14753+
/**
14754+
* Delete the instance and its stored state.
14755+
*/
14756+
public delete(): Promise<void>;
1464914757
/**
1465014758
* Returns the current status of the instance.
1465114759
*/

0 commit comments

Comments
 (0)