@cloudflare/workers-types 5.20260804.1 → 5.20260808.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts CHANGED
@@ -350,6 +350,14 @@ interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
350
350
  ReadableByteStreamController: typeof ReadableByteStreamController;
351
351
  WritableStreamDefaultController: typeof WritableStreamDefaultController;
352
352
  TransformStreamDefaultController: typeof TransformStreamDefaultController;
353
+ Buffer: any;
354
+ process: any;
355
+ global: ServiceWorkerGlobalScope;
356
+ setImmediate(
357
+ $function: (...param0: any[]) => void,
358
+ ...args: any[]
359
+ ): Immediate;
360
+ clearImmediate(immediate: Immediate | null): void;
353
361
  CompressionStream: typeof CompressionStream;
354
362
  DecompressionStream: typeof DecompressionStream;
355
363
  TextEncoderStream: typeof TextEncoderStream;
@@ -381,6 +389,13 @@ interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
381
389
  FixedLengthStream: typeof FixedLengthStream;
382
390
  IdentityTransformStream: typeof IdentityTransformStream;
383
391
  HTMLRewriter: typeof HTMLRewriter;
392
+ Performance: typeof Performance;
393
+ PerformanceEntry: typeof PerformanceEntry;
394
+ PerformanceMark: typeof PerformanceMark;
395
+ PerformanceMeasure: typeof PerformanceMeasure;
396
+ PerformanceResourceTiming: typeof PerformanceResourceTiming;
397
+ PerformanceObserver: typeof PerformanceObserver;
398
+ PerformanceObserverEntryList: typeof PerformanceObserverEntryList;
384
399
  }
385
400
  declare function addEventListener<Type extends keyof WorkerGlobalScopeEventMap>(
386
401
  type: Type,
@@ -472,6 +487,14 @@ declare const scheduler: Scheduler;
472
487
  declare const performance: Performance;
473
488
  declare const Cloudflare: Cloudflare;
474
489
  declare const origin: string;
490
+ declare const Buffer: any;
491
+ declare const process: any;
492
+ declare const global: ServiceWorkerGlobalScope;
493
+ declare function setImmediate(
494
+ $function: (...param0: any[]) => void,
495
+ ...args: any[]
496
+ ): Immediate;
497
+ declare function clearImmediate(immediate: Immediate | null): void;
475
498
  declare const navigator: Navigator;
476
499
  interface TestController {}
477
500
  interface ExecutionContext<Props = unknown> {
@@ -482,6 +505,7 @@ interface ExecutionContext<Props = unknown> {
482
505
  cache?: CacheContext;
483
506
  readonly access?: CloudflareAccessContext;
484
507
  tracing: Tracing;
508
+ abort(reason?: any): void;
485
509
  }
486
510
  type ExportedHandlerFetchHandler<
487
511
  Env = unknown,
@@ -563,6 +587,11 @@ interface AlarmInvocationInfo {
563
587
  readonly retryCount: number;
564
588
  readonly scheduledTime: number;
565
589
  }
590
+ interface Immediate {
591
+ ref(): void;
592
+ unref(): void;
593
+ hasRef(): boolean;
594
+ }
566
595
  interface Cloudflare {
567
596
  readonly compatibilityFlags: Record<string, boolean>;
568
597
  }
@@ -3309,6 +3338,12 @@ interface TraceLog {
3309
3338
  readonly timestamp: number;
3310
3339
  readonly level: string;
3311
3340
  readonly message: any;
3341
+ readonly errorInfo?: (TraceLogErrorInfo | null)[];
3342
+ }
3343
+ interface TraceLogErrorInfo {
3344
+ name: string;
3345
+ message: string;
3346
+ stack?: string;
3312
3347
  }
3313
3348
  interface TraceException {
3314
3349
  readonly timestamp: number;
@@ -3866,18 +3901,26 @@ interface ContainerExecOptions {
3866
3901
  cwd?: string;
3867
3902
  env?: Record<string, string>;
3868
3903
  user?: string;
3904
+ signal?: AbortSignal;
3905
+ pty?: boolean | ContainerExecPtyOptions;
3869
3906
  stdin?: ReadableStream | "pipe";
3870
3907
  stdout?: "pipe" | "ignore";
3871
3908
  stderr?: "pipe" | "ignore" | "combined";
3872
3909
  }
3910
+ interface ContainerExecPtyOptions {
3911
+ cols?: number;
3912
+ rows?: number;
3913
+ }
3873
3914
  interface ExecProcess {
3874
3915
  readonly stdin: WritableStream | null;
3875
3916
  readonly stdout: ReadableStream | null;
3876
3917
  readonly stderr: ReadableStream | null;
3877
3918
  readonly pid: number;
3919
+ readonly isPty: boolean;
3878
3920
  readonly exitCode: Promise<number>;
3879
3921
  output(): Promise<ExecOutput>;
3880
3922
  kill(signal?: number): void;
3923
+ resize(cols: number, rows: number): void;
3881
3924
  }
3882
3925
  interface Container {
3883
3926
  get running(): boolean;
@@ -3928,6 +3971,11 @@ interface ContainerStartupOptions {
3928
3971
  directorySnapshots?: ContainerDirectorySnapshotRestoreParams[];
3929
3972
  containerSnapshot?: ContainerSnapshot;
3930
3973
  }
3974
+ interface ContainerStartResources {
3975
+ vcpu: number;
3976
+ memoryMib: number;
3977
+ diskMb: number;
3978
+ }
3931
3979
  /**
3932
3980
  * 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.
3933
3981
  *
@@ -4073,17 +4121,363 @@ interface workerdResourceLimits {
4073
4121
  *
4074
4122
  * [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/)
4075
4123
  */
4076
- declare abstract class Performance {
4124
+ declare abstract class Performance extends EventTarget {
4077
4125
  /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/#performancetimeorigin) */
4078
4126
  get timeOrigin(): number;
4079
4127
  /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/#performancenow) */
4080
4128
  now(): number;
4129
+ get eventCounts(): EventCounts;
4130
+ /**
4131
+ * The **`clearMarks()`** method removes all or specific PerformanceMark objects from the browser's performance timeline.
4132
+ *
4133
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/clearMarks)
4134
+ */
4135
+ clearMarks(name?: string): void;
4136
+ /**
4137
+ * The **`clearMeasures()`** method removes all or specific PerformanceMeasure objects from the browser's performance timeline.
4138
+ *
4139
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/clearMeasures)
4140
+ */
4141
+ clearMeasures(name?: string): void;
4142
+ /**
4143
+ * The **`clearResourceTimings()`** method removes all performance entries with an PerformanceEntry.entryType of `'resource'` from the browser's performance timeline and sets the size of the performance resource data buffer to zero.
4144
+ *
4145
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/clearResourceTimings)
4146
+ */
4147
+ clearResourceTimings(): void;
4148
+ /**
4149
+ * The **`getEntries()`** method returns an array of all PerformanceEntry objects currently present in the performance timeline.
4150
+ *
4151
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/getEntries)
4152
+ */
4153
+ getEntries(): PerformanceEntry[];
4154
+ /**
4155
+ * The **`getEntriesByName()`** method returns an array of PerformanceEntry objects currently present in the performance timeline with the given _name_ and _type_.
4156
+ *
4157
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/getEntriesByName)
4158
+ */
4159
+ getEntriesByName(name: string, type?: string): PerformanceEntry[];
4160
+ /**
4161
+ * The **`getEntriesByType()`** method returns an array of PerformanceEntry objects currently present in the performance timeline for a given _type_.
4162
+ *
4163
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/getEntriesByType)
4164
+ */
4165
+ getEntriesByType(type: string): PerformanceEntry[];
4166
+ /**
4167
+ * The **`mark()`** method creates a named PerformanceMark object representing a high resolution timestamp marker in the browser's performance timeline.
4168
+ *
4169
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/mark)
4170
+ */
4171
+ mark(name: string, options?: PerformanceMarkOptions): PerformanceMark;
4172
+ /**
4173
+ * The **`measure()`** method creates a named PerformanceMeasure object representing a time measurement between two marks in the browser's performance timeline.
4174
+ *
4175
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/measure)
4176
+ */
4177
+ measure(
4178
+ measureName: string,
4179
+ measureOptionsOrStartMark?: PerformanceMeasureOptions | string,
4180
+ maybeEndMark?: string,
4181
+ ): PerformanceMeasure;
4182
+ /**
4183
+ * The **`setResourceTimingBufferSize()`** method sets the desired size of the browser's resource timing buffer which stores the `'resource'` performance entries.
4184
+ *
4185
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/setResourceTimingBufferSize)
4186
+ */
4187
+ setResourceTimingBufferSize(size: number): void;
4081
4188
  /**
4082
4189
  * The **`toJSON()`** method of the Performance interface is a Serialization; it returns a JSON representation of the Performance object.
4083
4190
  *
4084
4191
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/toJSON)
4085
4192
  */
4086
4193
  toJSON(): object;
4194
+ get nodeTiming(): PerformanceNodeTiming;
4195
+ eventLoopUtilization(): PerformanceEventLoopUtilization;
4196
+ markResourceTiming(): void;
4197
+ timerify(fn: () => void): () => void;
4198
+ }
4199
+ interface PerformanceEventLoopUtilization {
4200
+ idle: number;
4201
+ active: number;
4202
+ utilization: number;
4203
+ }
4204
+ interface PerformanceNodeTiming extends PerformanceEntry {
4205
+ readonly nodeStart: number;
4206
+ readonly v8Start: number;
4207
+ readonly bootstrapComplete: number;
4208
+ readonly environment: number;
4209
+ readonly loopStart: number;
4210
+ readonly loopExit: number;
4211
+ readonly idleTime: number;
4212
+ readonly uvMetricsInfo: UvMetricsInfo;
4213
+ toJSON(): object;
4214
+ }
4215
+ interface UvMetricsInfo {
4216
+ loopCount: number;
4217
+ events: number;
4218
+ eventsWaiting: number;
4219
+ }
4220
+ /**
4221
+ * **`PerformanceMark`** is an interface for PerformanceEntry objects with an PerformanceEntry.entryType of `'mark'`.
4222
+ *
4223
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceMark)
4224
+ */
4225
+ declare class PerformanceMark extends PerformanceEntry {
4226
+ constructor(name: string, maybeOptions?: PerformanceMarkOptions);
4227
+ /**
4228
+ * The read-only **`detail`** property returns arbitrary metadata that was included in the mark upon construction (either when using Performance.mark or the PerformanceMark.PerformanceMark constructor).
4229
+ *
4230
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceMark/detail)
4231
+ */
4232
+ get detail(): any;
4233
+ toJSON(): object;
4234
+ }
4235
+ /**
4236
+ * **`PerformanceMeasure`** is an _abstract_ interface for PerformanceEntry objects with an PerformanceEntry.entryType of `'measure'`.
4237
+ *
4238
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceMeasure)
4239
+ */
4240
+ declare abstract class PerformanceMeasure extends PerformanceEntry {
4241
+ /**
4242
+ * The read-only **`detail`** property returns arbitrary metadata that was included in the mark upon construction (when using Performance.measure.
4243
+ *
4244
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceMeasure/detail)
4245
+ */
4246
+ get detail(): any;
4247
+ toJSON(): object;
4248
+ }
4249
+ interface PerformanceMarkOptions {
4250
+ detail?: any;
4251
+ startTime?: number;
4252
+ }
4253
+ interface PerformanceMeasureOptions {
4254
+ detail?: any;
4255
+ start?: number;
4256
+ duration?: number;
4257
+ end?: number;
4258
+ }
4259
+ /**
4260
+ * The **`PerformanceObserverEntryList`** interface is a list of PerformanceEntry that were explicitly observed via the PerformanceObserver.observe method.
4261
+ *
4262
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceObserverEntryList)
4263
+ */
4264
+ declare abstract class PerformanceObserverEntryList {
4265
+ /**
4266
+ * The **`getEntries()`** method of the PerformanceObserverEntryList interface returns a list of explicitly observed PerformanceEntry objects.
4267
+ *
4268
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceObserverEntryList/getEntries)
4269
+ */
4270
+ getEntries(): PerformanceEntry[];
4271
+ /**
4272
+ * The **`getEntriesByType()`** method of the PerformanceObserverEntryList returns a list of explicitly _observed_ PerformanceEntry objects for a given PerformanceEntry.entryType.
4273
+ *
4274
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceObserverEntryList/getEntriesByType)
4275
+ */
4276
+ getEntriesByType(type: string): PerformanceEntry[];
4277
+ /**
4278
+ * The **`getEntriesByName()`** method of the PerformanceObserverEntryList interface returns a list of explicitly observed PerformanceEntry objects for a given PerformanceEntry.name and PerformanceEntry.entryType.
4279
+ *
4280
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceObserverEntryList/getEntriesByName)
4281
+ */
4282
+ getEntriesByName(name: string, type?: string): PerformanceEntry[];
4283
+ }
4284
+ /**
4285
+ * The **`PerformanceEntry`** object encapsulates a single performance metric that is part of the browser's performance timeline.
4286
+ *
4287
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceEntry)
4288
+ */
4289
+ declare abstract class PerformanceEntry {
4290
+ /**
4291
+ * The read-only **`name`** property of the PerformanceEntry interface is a string representing the name for a performance entry.
4292
+ *
4293
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceEntry/name)
4294
+ */
4295
+ get name(): string;
4296
+ /**
4297
+ * The read-only **`entryType`** property returns a string representing the type of performance metric that this entry represents.
4298
+ *
4299
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceEntry/entryType)
4300
+ */
4301
+ get entryType(): string;
4302
+ /**
4303
+ * The read-only **`startTime`** property returns the first DOMHighResTimeStamp recorded for this PerformanceEntry.
4304
+ *
4305
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceEntry/startTime)
4306
+ */
4307
+ get startTime(): number;
4308
+ /**
4309
+ * The read-only **`duration`** property returns a DOMHighResTimeStamp that is the duration of the PerformanceEntry.
4310
+ *
4311
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceEntry/duration)
4312
+ */
4313
+ get duration(): number;
4314
+ /**
4315
+ * The **`toJSON()`** method is a Serialization; it returns a JSON representation of the PerformanceEntry object.
4316
+ *
4317
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceEntry/toJSON)
4318
+ */
4319
+ toJSON(): object;
4320
+ }
4321
+ /**
4322
+ * The **`PerformanceResourceTiming`** interface enables retrieval and analysis of detailed network timing data regarding the loading of an application's resources.
4323
+ *
4324
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceResourceTiming)
4325
+ */
4326
+ declare abstract class PerformanceResourceTiming extends PerformanceEntry {
4327
+ /**
4328
+ * The **`connectEnd`** read-only property returns the DOMHighResTimeStamp immediately after the browser finishes establishing the connection to the server to retrieve the resource.
4329
+ *
4330
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceResourceTiming/connectEnd)
4331
+ */
4332
+ get connectEnd(): number;
4333
+ /**
4334
+ * The **`connectStart`** read-only property returns the DOMHighResTimeStamp immediately before the user agent starts establishing the connection to the server to retrieve the resource.
4335
+ *
4336
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceResourceTiming/connectStart)
4337
+ */
4338
+ get connectStart(): number;
4339
+ /**
4340
+ * The **`decodedBodySize`** read-only property returns the size (in octets) received from the fetch (HTTP or cache) of the message body after removing any applied content encoding (like gzip or Brotli).
4341
+ *
4342
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceResourceTiming/decodedBodySize)
4343
+ */
4344
+ get decodedBodySize(): number;
4345
+ /**
4346
+ * The **`domainLookupEnd`** read-only property returns the DOMHighResTimeStamp immediately after the browser finishes the domain-name lookup for the resource.
4347
+ *
4348
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceResourceTiming/domainLookupEnd)
4349
+ */
4350
+ get domainLookupEnd(): number;
4351
+ /**
4352
+ * The **`domainLookupStart`** read-only property returns the DOMHighResTimeStamp immediately before the browser starts the domain name lookup for the resource.
4353
+ *
4354
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceResourceTiming/domainLookupStart)
4355
+ */
4356
+ get domainLookupStart(): number;
4357
+ /**
4358
+ * The **`encodedBodySize`** read-only property represents the size (in octets) received from the fetch (HTTP or cache) of the payload body before removing any applied content encodings (like gzip or Brotli).
4359
+ *
4360
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceResourceTiming/encodedBodySize)
4361
+ */
4362
+ get encodedBodySize(): number;
4363
+ /**
4364
+ * The **`fetchStart`** read-only property represents a DOMHighResTimeStamp immediately before the browser starts to fetch the resource.
4365
+ *
4366
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceResourceTiming/fetchStart)
4367
+ */
4368
+ get fetchStart(): number;
4369
+ /**
4370
+ * The **`initiatorType`** read-only property is a string representing web platform feature that initiated the resource load.
4371
+ *
4372
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceResourceTiming/initiatorType)
4373
+ */
4374
+ get initiatorType(): string;
4375
+ /**
4376
+ * The **`nextHopProtocol`** read-only property is a string representing the network protocol used to fetch the resource, as identified by the ALPN Protocol ID (RFC7301).
4377
+ *
4378
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceResourceTiming/nextHopProtocol)
4379
+ */
4380
+ get nextHopProtocol(): string;
4381
+ /**
4382
+ * The **`redirectEnd`** read-only property returns a DOMHighResTimeStamp immediately after receiving the last byte of the response of the last redirect.
4383
+ *
4384
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceResourceTiming/redirectEnd)
4385
+ */
4386
+ get redirectEnd(): number;
4387
+ /**
4388
+ * The **`redirectStart`** read-only property returns a DOMHighResTimeStamp representing the start time of the fetch which that initiates the redirect.
4389
+ *
4390
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceResourceTiming/redirectStart)
4391
+ */
4392
+ get redirectStart(): number;
4393
+ /**
4394
+ * The **`requestStart`** read-only property returns a DOMHighResTimeStamp of the time immediately before the browser starts requesting the resource from the server, cache, or local resource.
4395
+ *
4396
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceResourceTiming/requestStart)
4397
+ */
4398
+ get requestStart(): number;
4399
+ /**
4400
+ * The **`responseEnd`** read-only property returns a DOMHighResTimeStamp immediately after the browser receives the last byte of the resource or immediately before the transport connection is closed, whichever comes first.
4401
+ *
4402
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceResourceTiming/responseEnd)
4403
+ */
4404
+ get responseEnd(): number;
4405
+ /**
4406
+ * The **`responseStart`** read-only property returns a DOMHighResTimeStamp immediately after the browser receives the first byte of the response from the server, cache, or local resource.
4407
+ *
4408
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceResourceTiming/responseStart)
4409
+ */
4410
+ get responseStart(): number;
4411
+ /**
4412
+ * The **`responseStatus`** read-only property represents the HTTP response status code returned when fetching the resource.
4413
+ *
4414
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceResourceTiming/responseStatus)
4415
+ */
4416
+ get responseStatus(): number;
4417
+ /**
4418
+ * The **`secureConnectionStart`** read-only property returns a DOMHighResTimeStamp immediately before the browser starts the handshake process to secure the current connection.
4419
+ *
4420
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceResourceTiming/secureConnectionStart)
4421
+ */
4422
+ get secureConnectionStart(): number | undefined;
4423
+ /**
4424
+ * The **`transferSize`** read-only property represents the size (in octets) of the fetched resource.
4425
+ *
4426
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceResourceTiming/transferSize)
4427
+ */
4428
+ get transferSize(): number;
4429
+ /**
4430
+ * The **`workerStart`** read-only property of the PerformanceResourceTiming interface returns a The `workerStart` property can have the following values: - A DOMHighResTimeStamp.
4431
+ *
4432
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceResourceTiming/workerStart)
4433
+ */
4434
+ get workerStart(): number;
4435
+ }
4436
+ /**
4437
+ * The **`PerformanceObserver`** interface is used to observe performance measurement events and be notified of new PerformanceEntry as they are recorded in the browser's _performance timeline_.
4438
+ *
4439
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceObserver)
4440
+ */
4441
+ declare class PerformanceObserver {
4442
+ constructor(callback: any);
4443
+ /**
4444
+ * The **`disconnect()`** method of the PerformanceObserver interface is used to stop the performance observer from receiving any PerformanceEntry events.
4445
+ *
4446
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceObserver/disconnect)
4447
+ */
4448
+ disconnect(): void;
4449
+ /**
4450
+ * The **`observe()`** method of the **PerformanceObserver** interface is used to specify the set of performance entry types to observe.
4451
+ *
4452
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceObserver/observe)
4453
+ */
4454
+ observe(options?: PerformanceObserverObserveOptions): void;
4455
+ /**
4456
+ * The **`takeRecords()`** method of the PerformanceObserver interface returns the current list of PerformanceEntry objects stored in the performance observer, emptying it out.
4457
+ *
4458
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceObserver/takeRecords)
4459
+ */
4460
+ takeRecords(): PerformanceEntry[];
4461
+ readonly supportedEntryTypes: string[];
4462
+ }
4463
+ interface PerformanceObserverObserveOptions {
4464
+ buffered?: boolean;
4465
+ durationThreshold?: number;
4466
+ entryTypes?: string[];
4467
+ type?: string;
4468
+ }
4469
+ interface EventCounts {
4470
+ get size(): number;
4471
+ get(eventType: string): number | undefined;
4472
+ has(eventType: string): boolean;
4473
+ entries(): IterableIterator<string[]>;
4474
+ keys(): IterableIterator<string>;
4475
+ values(): IterableIterator<number>;
4476
+ forEach(
4477
+ param1: (param0: number, param1: string, param2: EventCounts) => void,
4478
+ param2?: any,
4479
+ ): void;
4480
+ [Symbol.iterator](): IterableIterator<string[]>;
4087
4481
  }
4088
4482
  interface Tracing {
4089
4483
  enterSpan<T, A extends unknown[]>(
@@ -4096,11 +4490,15 @@ interface Tracing {
4096
4490
  callback: (span: Span, ...args: A) => T,
4097
4491
  ...args: A
4098
4492
  ): T;
4493
+ startSpan(name: string): Span;
4099
4494
  Span: typeof Span;
4100
4495
  }
4101
4496
  declare abstract class Span {
4102
4497
  get isTraced(): boolean;
4103
- setAttribute(key: string, value?: boolean | number | string): void;
4498
+ setAttribute(key: string, value: boolean | number | string): this;
4499
+ setAttributes(
4500
+ attributes: Record<string, boolean | number | string | undefined>,
4501
+ ): this;
4104
4502
  end(): void;
4105
4503
  }
4106
4504
  /**
@@ -4776,6 +5174,13 @@ type AiSearchListItemsParams = {
4776
5174
  source?: string;
4777
5175
  /** JSON-encoded Vectorize filter for metadata filtering. */
4778
5176
  metadata_filter?: string;
5177
+ /** Filter items by their unique ID. Returns at most one item. */
5178
+ item_id?: string;
5179
+ /**
5180
+ * Filter items by their exact key (object key / filename). Keys are unique
5181
+ * per source, so combine with `source` to disambiguate across data sources.
5182
+ */
5183
+ key?: string;
4779
5184
  };
4780
5185
  type AiSearchListItemsResponse = {
4781
5186
  result: AiSearchItemInfo[];
@@ -13924,6 +14329,15 @@ interface Hyperdrive {
13924
14329
  * for your database.
13925
14330
  */
13926
14331
  readonly host: string;
14332
+ /*
14333
+ * A synthetic IPv4 address (in the reserved 240.0.0.0/4 range) that, like the
14334
+ * host field, is only valid within the context of the currently running
14335
+ * Worker and, when passed into the `connect()` function from the
14336
+ * "cloudflare:sockets" module, will connect to the Hyperdrive instance for
14337
+ * your database. This is provided for database drivers that require the host
14338
+ * to be an IP literal rather than a hostname.
14339
+ */
14340
+ readonly ip: string;
13927
14341
  /*
13928
14342
  * The port that must be paired the the host field when connecting.
13929
14343
  */
@@ -14762,6 +15176,32 @@ declare namespace CloudflareWorkersModule {
14762
15176
  timeout?: WorkflowTimeoutDuration | number;
14763
15177
  sensitive?: WorkflowStepSensitivity;
14764
15178
  };
15179
+ // Internal discriminators used only for `WorkflowStep.do` overload
15180
+ // resolution. They mirror `WorkflowStepConfig` but pin `retries.delay` to a
15181
+ // single kind so the callback context can be narrowed based on the shape of
15182
+ // the config argument (rather than on an inferred type parameter, which is
15183
+ // lost when the caller supplies an explicit return-type argument). Not
15184
+ // exported: they must not widen the public type surface.
15185
+ type WorkflowStepConfigWithStaticDelay = Omit<
15186
+ WorkflowStepConfig,
15187
+ "retries"
15188
+ > & {
15189
+ retries?: {
15190
+ limit: number;
15191
+ delay: WorkflowDelayDuration | number;
15192
+ backoff?: WorkflowBackoff;
15193
+ };
15194
+ };
15195
+ type WorkflowStepConfigWithDelayFunction = Omit<
15196
+ WorkflowStepConfig,
15197
+ "retries"
15198
+ > & {
15199
+ retries: {
15200
+ limit: number;
15201
+ delay: WorkflowDelayFunction;
15202
+ backoff?: WorkflowBackoff;
15203
+ };
15204
+ };
14765
15205
  export type WorkflowStepRollbackConfig = Pick<
14766
15206
  WorkflowStepConfig,
14767
15207
  "retries" | "timeout"
@@ -14804,18 +15244,30 @@ declare namespace CloudflareWorkersModule {
14804
15244
  sensitive?: WorkflowStepSensitivity;
14805
15245
  };
14806
15246
  };
14807
- export type WorkflowRollbackContext<T = unknown> = {
14808
- ctx: WorkflowStepContext;
15247
+ // The rollback handler receives the step context, so it mirrors the same
15248
+ // delay discriminant as the step callback: when the step was configured with
15249
+ // a dynamic delay function the resolved `config.retries.delay` is omitted,
15250
+ // otherwise it is present. `Delay` is threaded from the `WorkflowStep.do`
15251
+ // overload that matched the step config.
15252
+ export type WorkflowRollbackContext<
15253
+ T = unknown,
15254
+ Delay = WorkflowDelayDuration | number,
15255
+ > = {
15256
+ ctx: WorkflowStepContext<Delay>;
14809
15257
  error: Error;
14810
15258
  output: T | undefined;
14811
15259
  /** @deprecated Use `ctx.step.name` and `ctx.step.count` instead. */
14812
15260
  stepName: string;
14813
15261
  };
14814
- export type WorkflowRollbackHandler<T = unknown> = (
14815
- ctx: WorkflowRollbackContext<T>,
14816
- ) => Promise<void>;
14817
- export type WorkflowStepRollbackOptions<T = unknown> = {
14818
- rollback: WorkflowRollbackHandler<T>;
15262
+ export type WorkflowRollbackHandler<
15263
+ T = unknown,
15264
+ Delay = WorkflowDelayDuration | number,
15265
+ > = (ctx: WorkflowRollbackContext<T, Delay>) => Promise<void>;
15266
+ export type WorkflowStepRollbackOptions<
15267
+ T = unknown,
15268
+ Delay = WorkflowDelayDuration | number,
15269
+ > = {
15270
+ rollback: WorkflowRollbackHandler<T, Delay>;
14819
15271
  rollbackConfig?: WorkflowStepRollbackConfig;
14820
15272
  };
14821
15273
  export abstract class WorkflowStep {
@@ -14824,18 +15276,34 @@ declare namespace CloudflareWorkersModule {
14824
15276
  callback: (ctx: WorkflowStepContext) => Promise<T>,
14825
15277
  rollbackOptions?: WorkflowStepRollbackOptions<T>,
14826
15278
  ): Promise<T>;
14827
- do<T extends Rpc.Serializable<T>, const C extends WorkflowStepConfig>(
15279
+ // The config overloads discriminate on the shape of `config.retries.delay`
15280
+ // so the callback context reflects whether the resolved delay is present
15281
+ // (static delay) or omitted (dynamic delay function). Each has a single
15282
+ // type parameter, so an explicit return-type argument (`do<T>(...)`) still
15283
+ // resolves here. ORDERING IS LOAD-BEARING: the broad `WorkflowStepConfig`
15284
+ // fallback MUST remain last, otherwise it shadows the discriminating
15285
+ // overloads and narrowing is silently lost.
15286
+ do<T extends Rpc.Serializable<T>>(
15287
+ name: string,
15288
+ config: WorkflowStepConfigWithDelayFunction,
15289
+ callback: (ctx: WorkflowStepContext<WorkflowDelayFunction>) => Promise<T>,
15290
+ rollbackOptions?: WorkflowStepRollbackOptions<T, WorkflowDelayFunction>,
15291
+ ): Promise<T>;
15292
+ do<T extends Rpc.Serializable<T>>(
14828
15293
  name: string,
14829
- config: C,
15294
+ config: WorkflowStepConfigWithStaticDelay,
14830
15295
  callback: (
14831
- ctx: WorkflowStepContext<
14832
- C["retries"] extends {
14833
- delay: infer D;
14834
- }
14835
- ? D
14836
- : WorkflowDelayDuration | number
14837
- >,
15296
+ ctx: WorkflowStepContext<WorkflowDelayDuration | number>,
14838
15297
  ) => Promise<T>,
15298
+ rollbackOptions?: WorkflowStepRollbackOptions<
15299
+ T,
15300
+ WorkflowDelayDuration | number
15301
+ >,
15302
+ ): Promise<T>;
15303
+ do<T extends Rpc.Serializable<T>>(
15304
+ name: string,
15305
+ config: WorkflowStepConfig,
15306
+ callback: (ctx: WorkflowStepContext) => Promise<T>,
14839
15307
  rollbackOptions?: WorkflowStepRollbackOptions<T>,
14840
15308
  ): Promise<T>;
14841
15309
  sleep: (name: string, duration: WorkflowSleepDuration) => Promise<void>;
@@ -15654,12 +16122,13 @@ type MarkdownDocument = {
15654
16122
  name: string;
15655
16123
  blob: Blob;
15656
16124
  };
16125
+ type OutputFormat = "markdown" | "text";
15657
16126
  type ConversionResponse =
15658
16127
  | {
15659
16128
  id: string;
15660
16129
  name: string;
15661
16130
  mimeType: string;
15662
- format: "markdown";
16131
+ format: OutputFormat;
15663
16132
  tokens: number;
15664
16133
  data: string;
15665
16134
  }
@@ -15677,7 +16146,11 @@ type EmbeddedImageConversionOptions = ImageConversionOptions & {
15677
16146
  convert?: boolean;
15678
16147
  maxConvertedImages?: number;
15679
16148
  };
16149
+ type ConversionOutputOptions = {
16150
+ format?: OutputFormat;
16151
+ };
15680
16152
  type ConversionOptions = {
16153
+ output?: ConversionOutputOptions;
15681
16154
  html?: {
15682
16155
  images?: EmbeddedImageConversionOptions & {
15683
16156
  convertOGImage?: boolean;
@@ -15858,11 +16331,25 @@ declare namespace TailStream {
15858
16331
  readonly message: string;
15859
16332
  readonly stack?: string;
15860
16333
  }
15861
- interface Log {
16334
+ interface TailStreamErrorInfo {
16335
+ readonly name: string;
16336
+ readonly message: string;
16337
+ readonly stack?: string;
16338
+ }
16339
+ type Log = {
15862
16340
  readonly type: "log";
15863
16341
  readonly level: "debug" | "error" | "info" | "log" | "warn";
15864
- readonly message: object;
15865
- }
16342
+ readonly errorInfo?: readonly (TailStreamErrorInfo | null)[];
16343
+ } & (
16344
+ | {
16345
+ readonly message: object;
16346
+ readonly truncated?: false;
16347
+ }
16348
+ | {
16349
+ readonly message: string;
16350
+ readonly truncated: true;
16351
+ }
16352
+ );
15866
16353
  interface DroppedEventsDiagnostic {
15867
16354
  readonly diagnosticsType: "droppedEvents";
15868
16355
  readonly count: number;
@@ -16398,7 +16885,25 @@ declare abstract class Workflow<PARAMS = unknown> {
16398
16885
  public createBatch(
16399
16886
  batch: WorkflowInstanceCreateOptions<PARAMS>[],
16400
16887
  ): Promise<WorkflowInstance[]>;
16888
+ /**
16889
+ * Delete a batch of Workflow instances and their stored state.
16890
+ * `deleteBatch` is limited to 100 instances at a time. Duplicate IDs are deleted once.
16891
+ * The result contains one entry for each input position; IDs that do not exist are returned as per-instance errors.
16892
+ * @param instanceIds IDs of the Workflow instances to delete
16893
+ * @returns A promise that resolves with the successfully deleted instances and any per-instance errors.
16894
+ */
16895
+ public deleteBatch(instanceIds: string[]): Promise<WorkflowBatchDeleteResult>;
16401
16896
  }
16897
+ type WorkflowBatchDeleteResult = {
16898
+ deleted: {
16899
+ id: string;
16900
+ }[];
16901
+ errors: {
16902
+ id: string;
16903
+ code: number;
16904
+ message: string;
16905
+ }[];
16906
+ };
16402
16907
  type WorkflowDurationLabel =
16403
16908
  | "second"
16404
16909
  | "minute"
@@ -16499,6 +17004,10 @@ declare abstract class WorkflowInstance {
16499
17004
  * @param options Options for the restart, including an optional step to restart from.
16500
17005
  */
16501
17006
  public restart(options?: WorkflowInstanceRestartOptions): Promise<void>;
17007
+ /**
17008
+ * Delete the instance and its stored state.
17009
+ */
17010
+ public delete(): Promise<void>;
16502
17011
  /**
16503
17012
  * Returns the current status of the instance.
16504
17013
  */