@cloudflare/workers-types 5.20260801.1 → 5.20260807.2

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