11/* eslint-disable */
22// Generated by Wrangler by running `wrangler types ./types/worker-configuration.d.ts` (hash: 2ba4d49d5cf176d71f4422a91ce53bd4)
3- // Runtime types generated with workerd@1.20250902 .0 2025-04-04
3+ // Runtime types generated with workerd@1.20250906 .0 2025-04-04
44declare namespace Cloudflare {
55 interface Env {
66 OAUTH_KV : KVNamespace ;
@@ -411,7 +411,7 @@ interface DurableObjectId {
411411 equals ( other : DurableObjectId ) : boolean ;
412412 readonly name ?: string ;
413413}
414- interface DurableObjectNamespace < T extends Rpc . DurableObjectBranded | undefined = undefined > {
414+ declare abstract class DurableObjectNamespace < T extends Rpc . DurableObjectBranded | undefined = undefined > {
415415 newUniqueId ( options ?: DurableObjectNamespaceNewUniqueIdOptions ) : DurableObjectId ;
416416 idFromName ( name : string ) : DurableObjectId ;
417417 idFromString ( id : string ) : DurableObjectId ;
@@ -429,6 +429,7 @@ interface DurableObjectNamespaceGetDurableObjectOptions {
429429}
430430interface DurableObjectState {
431431 waitUntil ( promise : Promise < any > ) : void ;
432+ props : any ;
432433 readonly id : DurableObjectId ;
433434 readonly storage : DurableObjectStorage ;
434435 container ?: Container ;
@@ -471,6 +472,7 @@ interface DurableObjectStorage {
471472 deleteAlarm ( options ?: DurableObjectSetAlarmOptions ) : Promise < void > ;
472473 sync ( ) : Promise < void > ;
473474 sql : SqlStorage ;
475+ kv : SyncKvStorage ;
474476 transactionSync < T > ( closure : ( ) => T ) : T ;
475477 getCurrentBookmark ( ) : Promise < string > ;
476478 getBookmarkForTime ( timestamp : number | Date ) : Promise < string > ;
@@ -2042,6 +2044,7 @@ interface TraceItem {
20422044 readonly scriptVersion ?: ScriptVersion ;
20432045 readonly dispatchNamespace ?: string ;
20442046 readonly scriptTags ?: string [ ] ;
2047+ readonly durableObjectId ?: string ;
20452048 readonly outcome : string ;
20462049 readonly executionModel : string ;
20472050 readonly truncated : boolean ;
@@ -2542,6 +2545,23 @@ interface MessagePort extends EventTarget {
25422545interface MessagePortPostMessageOptions {
25432546 transfer ?: any [ ] ;
25442547}
2548+ interface SyncKvStorage {
2549+ get < T = unknown > ( key : string ) : T | undefined ;
2550+ list < T = unknown > ( options ?: SyncKvListOptions ) : Iterable < [
2551+ string ,
2552+ T
2553+ ] > ;
2554+ put < T > ( key : string , value : T ) : void ;
2555+ delete ( key : string ) : boolean ;
2556+ }
2557+ interface SyncKvListOptions {
2558+ start ?: string ;
2559+ startAfter ?: string ;
2560+ end ?: string ;
2561+ prefix ?: string ;
2562+ reverse ?: boolean ;
2563+ limit ?: number ;
2564+ }
25452565type AiImageClassificationInput = {
25462566 image : number [ ] ;
25472567} ;
@@ -6531,6 +6551,7 @@ type ImageOutputOptions = {
65316551 format : 'image/jpeg' | 'image/png' | 'image/gif' | 'image/webp' | 'image/avif' | 'rgb' | 'rgba' ;
65326552 quality ?: number ;
65336553 background ?: string ;
6554+ anim ?: boolean ;
65346555} ;
65356556interface ImagesBinding {
65366557 /**
@@ -6589,6 +6610,108 @@ interface ImagesError extends Error {
65896610 readonly message : string ;
65906611 readonly stack ?: string ;
65916612}
6613+ /**
6614+ * Media binding for transforming media streams.
6615+ * Provides the entry point for media transformation operations.
6616+ */
6617+ interface MediaBinding {
6618+ /**
6619+ * Creates a media transformer from an input stream.
6620+ * @param media - The input media bytes
6621+ * @returns A MediaTransformer instance for applying transformations
6622+ */
6623+ input ( media : ReadableStream < Uint8Array > ) : MediaTransformer ;
6624+ }
6625+ /**
6626+ * Media transformer for applying transformation operations to media content.
6627+ * Handles sizing, fitting, and other input transformation parameters.
6628+ */
6629+ interface MediaTransformer {
6630+ /**
6631+ * Applies transformation options to the media content.
6632+ * @param transform - Configuration for how the media should be transformed
6633+ * @returns A generator for producing the transformed media output
6634+ */
6635+ transform ( transform : MediaTransformationInputOptions ) : MediaTransformationGenerator ;
6636+ }
6637+ /**
6638+ * Generator for producing media transformation results.
6639+ * Configures the output format and parameters for the transformed media.
6640+ */
6641+ interface MediaTransformationGenerator {
6642+ /**
6643+ * Generates the final media output with specified options.
6644+ * @param output - Configuration for the output format and parameters
6645+ * @returns The final transformation result containing the transformed media
6646+ */
6647+ output ( output : MediaTransformationOutputOptions ) : MediaTransformationResult ;
6648+ }
6649+ /**
6650+ * Result of a media transformation operation.
6651+ * Provides multiple ways to access the transformed media content.
6652+ */
6653+ interface MediaTransformationResult {
6654+ /**
6655+ * Returns the transformed media as a readable stream of bytes.
6656+ * @returns A stream containing the transformed media data
6657+ */
6658+ media ( ) : ReadableStream < Uint8Array > ;
6659+ /**
6660+ * Returns the transformed media as an HTTP response object.
6661+ * @returns The transformed media as a Response, ready to store in cache or return to users
6662+ */
6663+ response ( ) : Response ;
6664+ /**
6665+ * Returns the MIME type of the transformed media.
6666+ * @returns The content type string (e.g., 'image/jpeg', 'video/mp4')
6667+ */
6668+ contentType ( ) : string ;
6669+ }
6670+ /**
6671+ * Configuration options for transforming media input.
6672+ * Controls how the media should be resized and fitted.
6673+ */
6674+ type MediaTransformationInputOptions = {
6675+ /** How the media should be resized to fit the specified dimensions */
6676+ fit ?: 'contain' | 'cover' | 'scale-down' ;
6677+ /** Target width in pixels */
6678+ width ?: number ;
6679+ /** Target height in pixels */
6680+ height ?: number ;
6681+ } ;
6682+ /**
6683+ * Configuration options for Media Transformations output.
6684+ * Controls the format, timing, and type of the generated output.
6685+ */
6686+ type MediaTransformationOutputOptions = {
6687+ /**
6688+ * Output mode determining the type of media to generate
6689+ */
6690+ mode ?: 'video' | 'spritesheet' | 'frame' | 'audio' ;
6691+ /** Whether to include audio in the output */
6692+ audio ?: boolean ;
6693+ /**
6694+ * Starting timestamp for frame extraction or start time for clips. (e.g. '2s').
6695+ */
6696+ time ?: string ;
6697+ /**
6698+ * Duration for video clips, audio extraction, and spritesheet generation (e.g. '5s').
6699+ */
6700+ duration ?: string ;
6701+ /**
6702+ * Output format for the generated media.
6703+ */
6704+ format ?: 'jpg' | 'png' | 'm4a' ;
6705+ } ;
6706+ /**
6707+ * Error object for media transformation operations.
6708+ * Extends the standard Error interface with additional media-specific information.
6709+ */
6710+ interface MediaError extends Error {
6711+ readonly code : number ;
6712+ readonly message : string ;
6713+ readonly stack ?: string ;
6714+ }
65926715type Params < P extends string = any > = Record < P , string | string [ ] > ;
65936716type EventContext < Env , P extends string , Data > = {
65946717 request : Request < unknown , IncomingRequestCfProperties < unknown > > ;
@@ -6975,21 +7098,17 @@ declare namespace TailStream {
69757098 readonly tag ?: string ;
69767099 readonly message ?: string ;
69777100 }
6978- interface Trigger {
6979- readonly traceId : string ;
6980- readonly invocationId : string ;
6981- readonly spanId : string ;
6982- }
69837101 interface Onset {
69847102 readonly type : "onset" ;
69857103 readonly attributes : Attribute [ ] ;
7104+ // id for the span being opened by this Onset event.
7105+ readonly spanId : string ;
69867106 readonly dispatchNamespace ?: string ;
69877107 readonly entrypoint ?: string ;
69887108 readonly executionModel : string ;
69897109 readonly scriptName ?: string ;
69907110 readonly scriptTags ?: string [ ] ;
69917111 readonly scriptVersion ?: ScriptVersion ;
6992- readonly trigger ?: Trigger ;
69937112 readonly info : FetchEventInfo | JsRpcEventInfo | ScheduledEventInfo | AlarmEventInfo | QueueEventInfo | EmailEventInfo | TraceEventInfo | HibernatableWebSocketEventInfo | CustomEventInfo ;
69947113 }
69957114 interface Outcome {
@@ -7001,6 +7120,8 @@ declare namespace TailStream {
70017120 interface SpanOpen {
70027121 readonly type : "spanOpen" ;
70037122 readonly name : string ;
7123+ // id for the span being opened by this SpanOpen event.
7124+ readonly spanId : string ;
70047125 readonly info ?: FetchEventInfo | JsRpcEventInfo | Attributes ;
70057126 }
70067127 interface SpanClose {
@@ -7023,6 +7144,10 @@ declare namespace TailStream {
70237144 readonly level : "debug" | "error" | "info" | "log" | "warn" ;
70247145 readonly message : object ;
70257146 }
7147+ // This marks the worker handler return information.
7148+ // This is separate from Outcome because the worker invocation can live for a long time after
7149+ // returning. For example - Websockets that return an http upgrade response but then continue
7150+ // streaming information or SSE http connections.
70267151 interface Return {
70277152 readonly type : "return" ;
70287153 readonly info ?: FetchResponseInfo ;
@@ -7036,9 +7161,28 @@ declare namespace TailStream {
70367161 readonly info : Attribute [ ] ;
70377162 }
70387163 type EventType = Onset | Outcome | SpanOpen | SpanClose | DiagnosticChannelEvent | Exception | Log | Return | Attributes ;
7164+ // Context in which this trace event lives.
7165+ interface SpanContext {
7166+ // Single id for the entire top-level invocation
7167+ // This should be a new traceId for the first worker stage invoked in the eyeball request and then
7168+ // same-account service-bindings should reuse the same traceId but cross-account service-bindings
7169+ // should use a new traceId.
7170+ readonly traceId : string ;
7171+ // spanId in which this event is handled
7172+ // for Onset and SpanOpen events this would be the parent span id
7173+ // for Outcome and SpanClose these this would be the span id of the opening Onset and SpanOpen events
7174+ // For Hibernate and Mark this would be the span under which they were emitted.
7175+ // spanId is not set ONLY if:
7176+ // 1. This is an Onset event
7177+ // 2. We are not inherting any SpanContext. (e.g. this is a cross-account service binding or a new top-level invocation)
7178+ readonly spanId ?: string ;
7179+ }
70397180 interface TailEvent < Event extends EventType > {
7181+ // invocation id of the currently invoked worker stage.
7182+ // invocation id will always be unique to every Onset event and will be the same until the Outcome event.
70407183 readonly invocationId : string ;
7041- readonly spanId : string ;
7184+ // Inherited spanContext for this event.
7185+ readonly spanContext : SpanContext ;
70427186 readonly timestamp : Date ;
70437187 readonly sequence : number ;
70447188 readonly event : Event ;
0 commit comments