@cloudflare/workers-types 5.20261119.1 → 5.20261121.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.ts CHANGED
@@ -251,7 +251,6 @@ export interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
251
251
  ): number;
252
252
  clearInterval(timeoutId: number | null): void;
253
253
  queueMicrotask(task: Function): void;
254
- structuredClone<T>(value: T, options?: StructuredSerializeOptions): T;
255
254
  reportError(error: any): void;
256
255
  fetch(
257
256
  input: RequestInfo | URL,
@@ -283,9 +282,6 @@ export interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
283
282
  ByteLengthQueuingStrategy: typeof ByteLengthQueuingStrategy;
284
283
  CountQueuingStrategy: typeof CountQueuingStrategy;
285
284
  ErrorEvent: typeof ErrorEvent;
286
- MessageChannel: typeof MessageChannel;
287
- MessagePort: typeof MessagePort;
288
- EventSource: typeof EventSource;
289
285
  ReadableStreamBYOBRequest: typeof ReadableStreamBYOBRequest;
290
286
  ReadableStreamDefaultController: typeof ReadableStreamDefaultController;
291
287
  ReadableByteStreamController: typeof ReadableByteStreamController;
@@ -337,6 +333,9 @@ export interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
337
333
  PerformanceResourceTiming: typeof PerformanceResourceTiming;
338
334
  PerformanceObserver: typeof PerformanceObserver;
339
335
  PerformanceObserverEntryList: typeof PerformanceObserverEntryList;
336
+ MessageChannel: typeof MessageChannel;
337
+ MessagePort: typeof MessagePort;
338
+ EventSource: typeof EventSource;
340
339
  }
341
340
  export declare function addEventListener<
342
341
  Type extends keyof WorkerGlobalScopeEventMap,
@@ -392,11 +391,6 @@ export declare function setInterval<Args extends any[]>(
392
391
  export declare function clearInterval(timeoutId: number | null): void;
393
392
  /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/queueMicrotask) */
394
393
  export declare function queueMicrotask(task: Function): void;
395
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/structuredClone) */
396
- export declare function structuredClone<T>(
397
- value: T,
398
- options?: StructuredSerializeOptions,
399
- ): T;
400
394
  /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/reportError) */
401
395
  export declare function reportError(error: any): void;
402
396
  /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/fetch) */
@@ -519,9 +513,6 @@ export interface ExportedHandler<
519
513
  email?: EmailExportedHandler<Env, Props>;
520
514
  queue?: ExportedHandlerQueueHandler<Env, QueueHandlerMessage, Props>;
521
515
  }
522
- export interface StructuredSerializeOptions {
523
- transfer?: any[];
524
- }
525
516
  export declare abstract class Navigator {
526
517
  sendBeacon(url: string, body?: BodyInit): boolean;
527
518
  readonly userAgent: string;
@@ -3516,58 +3507,6 @@ export interface SocketInfo {
3516
3507
  remoteAddress?: string;
3517
3508
  localAddress?: string;
3518
3509
  }
3519
- /**
3520
- * The **`EventSource`** interface is web content's interface to server-sent events.
3521
- *
3522
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource)
3523
- */
3524
- export declare class EventSource extends EventTarget {
3525
- constructor(url: string, init?: EventSourceEventSourceInit);
3526
- /**
3527
- * The **`close()`** method of the EventSource interface closes the connection, if one is made, and sets the EventSource.readyState attribute to 2 (closed).
3528
- *
3529
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/close)
3530
- */
3531
- close(): void;
3532
- /**
3533
- * The **`url`** read-only property of the EventSource interface returns a string representing the URL of the source.
3534
- *
3535
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/url)
3536
- */
3537
- get url(): string;
3538
- /**
3539
- * The **`withCredentials`** read-only property of the EventSource interface returns a boolean value indicating whether the EventSource object was instantiated with CORS credentials set.
3540
- *
3541
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/withCredentials)
3542
- */
3543
- get withCredentials(): boolean;
3544
- /**
3545
- * The **`readyState`** read-only property of the EventSource interface returns a number representing the state of the connection.
3546
- *
3547
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/readyState)
3548
- */
3549
- get readyState(): number;
3550
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/open_event) */
3551
- get onopen(): any | null;
3552
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/open_event) */
3553
- set onopen(value: any | null);
3554
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/message_event) */
3555
- get onmessage(): any | null;
3556
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/message_event) */
3557
- set onmessage(value: any | null);
3558
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/error_event) */
3559
- get onerror(): any | null;
3560
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/error_event) */
3561
- set onerror(value: any | null);
3562
- static readonly CONNECTING: number;
3563
- static readonly OPEN: number;
3564
- static readonly CLOSED: number;
3565
- static from(stream: ReadableStream): EventSource;
3566
- }
3567
- export interface EventSourceEventSourceInit {
3568
- withCredentials?: boolean;
3569
- fetcher?: Fetcher;
3570
- }
3571
3510
  export interface ExecOutput {
3572
3511
  readonly stdout: ArrayBuffer;
3573
3512
  readonly stderr: ArrayBuffer;
@@ -3675,59 +3614,6 @@ export interface ContainerStartResources {
3675
3614
  memoryMib: number;
3676
3615
  diskMb: number;
3677
3616
  }
3678
- /**
3679
- * 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.
3680
- *
3681
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort)
3682
- */
3683
- export declare abstract class MessagePort extends EventTarget {
3684
- /**
3685
- * The **`postMessage()`** method of the MessagePort interface sends a message from the port, and optionally, transfers ownership of objects to other browsing contexts.
3686
- *
3687
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/postMessage)
3688
- */
3689
- postMessage(
3690
- data?: any,
3691
- options?: any[] | MessagePortPostMessageOptions,
3692
- ): void;
3693
- /**
3694
- * The **`close()`** method of the MessagePort interface disconnects the port, so it is no longer active. This stops the flow of messages to that port.
3695
- *
3696
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/close)
3697
- */
3698
- close(): void;
3699
- /**
3700
- * The **`start()`** method of the MessagePort interface starts the sending of messages queued on the port. This method is only needed when using EventTarget.addEventListener; it is implied when using onmessage.
3701
- *
3702
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/start)
3703
- */
3704
- start(): void;
3705
- get onmessage(): any | null;
3706
- set onmessage(value: any | null);
3707
- }
3708
- /**
3709
- * The **`MessageChannel`** interface of the Channel Messaging API allows us to create a new message channel and send data through it via its two MessagePort properties.
3710
- *
3711
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel)
3712
- */
3713
- export declare class MessageChannel {
3714
- constructor();
3715
- /**
3716
- * The **`port1`** read-only property of the MessageChannel interface returns the first port of the message channel — the port attached to the context that originated the channel.
3717
- *
3718
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel/port1)
3719
- */
3720
- readonly port1: MessagePort;
3721
- /**
3722
- * The **`port2`** read-only property of the MessageChannel interface returns the second port of the message channel — the port attached to the context at the other end of the channel, which the message is initially sent to.
3723
- *
3724
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel/port2)
3725
- */
3726
- readonly port2: MessagePort;
3727
- }
3728
- export interface MessagePortPostMessageOptions {
3729
- transfer?: any[];
3730
- }
3731
3617
  export type LoopbackForExport<
3732
3618
  T extends
3733
3619
  | (new (...args: any[]) => Rpc.EntrypointBranded)
@@ -13205,21 +13091,31 @@ export type BrowserRunScriptOptions = {
13205
13091
  lab?: boolean;
13206
13092
  /** Record the browser session. @default false */
13207
13093
  recording?: boolean;
13094
+ /** Run the script on an alternate browser backend. Only the raw CDP client is
13095
+ * supported, and no session is kept open afterwards. Setting `library`,
13096
+ * `keepAlive`, `lab` or `recording` with it returns an HTTP 400 error
13097
+ * response.
13098
+ */
13099
+ browser?: "kitesurf";
13208
13100
  };
13209
- /** Options for `scriptInSession()`. */
13101
+ /** Options for `script()` in an existing browser session. */
13210
13102
  export type BrowserRunScriptSessionOptions = {
13103
+ /** Session to run in, such as the `cf-browser-session-id` header returned by
13104
+ * `script()`. The session keeps the launch options it was acquired with.
13105
+ */
13106
+ sessionId: string;
13107
+ /** Page target the script attaches to, such as the `cf-browser-target-id`
13108
+ * header returned by `script()`. Defaults to the session's first page.
13109
+ */
13110
+ targetId?: string;
13211
13111
  /** Library whose objects are passed to the script. Omit it for raw CDP. */
13212
13112
  library?: BrowserRunScriptLibrary;
13213
13113
  /** Maximum run time of the script in milliseconds. Between 1 and 120000.
13214
13114
  * @default 60000
13215
13115
  */
13216
13116
  timeout?: number;
13217
- /** Page target the script attaches to, such as the `cf-browser-target-id`
13218
- * header returned by `script()`. Defaults to the session's first page.
13219
- */
13220
- targetId?: string;
13221
13117
  };
13222
- /** JSON success body of `script()` and `scriptInSession()`. */
13118
+ /** JSON success body of `script()`. */
13223
13119
  export type BrowserRunScriptSuccessResponse = {
13224
13120
  success: true;
13225
13121
  /** The script's return value, or `null` when it returned nothing. */
@@ -13444,7 +13340,7 @@ export declare abstract class BrowserRun {
13444
13340
  * @param code - Source of an async function. It receives the selected
13445
13341
  * library's objects (Playwright `{ page, context, browser }`, Puppeteer
13446
13342
  * `{ page, browser }`) or, without `library`, a CDP client.
13447
- * @param options - Library, timeout and session launch options.
13343
+ * @param options - Library, timeout, session launch and backend options.
13448
13344
  * @returns A `Response` containing one of:
13449
13345
  *
13450
13346
  * **Success (HTTP 200):**
@@ -13454,26 +13350,28 @@ export declare abstract class BrowserRun {
13454
13350
  * non-JSON output
13455
13351
  *
13456
13352
  * **Error:**
13457
- * - JSON error body with an HTTP status code (400, 404, 408, 422, 429, 500, 503)
13353
+ * - JSON error body with an HTTP status code (400, 404, 408, 422, 429, 500, 502, 503)
13458
13354
  * - HTTP 408 when the script exceeds `timeout`
13459
13355
  * - HTTP 422 when the script fails to compile or throws
13356
+ * - HTTP 502 when the script fails on the `browser: 'kitesurf'` backend
13460
13357
  * - HTTP errors are returned as a `Response`, not thrown. Invalid `options`
13461
13358
  * throw before any request is made.
13462
13359
  *
13463
- * **Headers:**
13464
- * - `cf-browser-session-id`: Session kept open for `scriptInSession()`
13360
+ * **Headers** (not returned with `browser: 'kitesurf'`):
13361
+ * - `cf-browser-session-id`: Session kept open for a later `script()` call
13362
+ * with `sessionId`
13465
13363
  * - `cf-browser-target-id`: Page target the script ran on
13466
13364
  * - `X-Browser-Ms-Used`: Browser time consumed in milliseconds
13467
13365
  */
13468
13366
  script(code: string, options?: BrowserRunScriptOptions): Promise<Response>;
13469
13367
  /**
13470
13368
  * Run a script against an existing browser session, such as one kept open by
13471
- * `script()`.
13472
- * @param sessionId - Session to run in, such as the `cf-browser-session-id`
13473
- * header returned by `script()`.
13474
- * @param code - Source of an async function, as for `script()`.
13475
- * @param options - Library, timeout and page target options.
13476
- * @returns A `Response` with the same success bodies as `script()`.
13369
+ * an earlier `script()` call.
13370
+ * @param code - Source of an async function, as for a new session.
13371
+ * @param options - The session to run in, plus page target, library and
13372
+ * timeout options. Launch options such as `keepAlive` cannot be set, because
13373
+ * the session keeps the ones it was acquired with.
13374
+ * @returns A `Response` with the same success bodies as a new-session run.
13477
13375
  *
13478
13376
  * **Error:**
13479
13377
  * - JSON error body with an HTTP status code (400, 401, 404, 408, 410, 422, 500)
@@ -13485,10 +13383,9 @@ export declare abstract class BrowserRun {
13485
13383
  * **Headers:**
13486
13384
  * - `X-Browser-Ms-Used`: Browser time consumed in milliseconds
13487
13385
  */
13488
- scriptInSession(
13489
- sessionId: string,
13386
+ script(
13490
13387
  code: string,
13491
- options?: BrowserRunScriptSessionOptions,
13388
+ options: BrowserRunScriptSessionOptions,
13492
13389
  ): Promise<Response>;
13493
13390
  /** DevTools JSON methods exposed through one nested binding target. */
13494
13391
  get devtools(): BrowserRunDevtools;
@@ -15010,6 +14907,59 @@ export declare type EmailExportedHandler<Env = unknown, Props = unknown> = (
15010
14907
  env: Env,
15011
14908
  ctx: ExecutionContext<Props>,
15012
14909
  ) => void | Promise<void>;
14910
+ // EventSource, a global at every compatibility date.
14911
+ /**
14912
+ * The **`EventSource`** interface is web content's interface to server-sent events.
14913
+ *
14914
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource)
14915
+ */
14916
+ export declare class EventSource extends EventTarget {
14917
+ constructor(url: string, init?: EventSourceEventSourceInit);
14918
+ /**
14919
+ * The **`close()`** method of the EventSource interface closes the connection, if one is made, and sets the EventSource.readyState attribute to 2 (closed).
14920
+ *
14921
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/close)
14922
+ */
14923
+ close(): void;
14924
+ /**
14925
+ * The **`url`** read-only property of the EventSource interface returns a string representing the URL of the source.
14926
+ *
14927
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/url)
14928
+ */
14929
+ get url(): string;
14930
+ /**
14931
+ * The **`withCredentials`** read-only property of the EventSource interface returns a boolean value indicating whether the EventSource object was instantiated with CORS credentials set.
14932
+ *
14933
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/withCredentials)
14934
+ */
14935
+ get withCredentials(): boolean;
14936
+ /**
14937
+ * The **`readyState`** read-only property of the EventSource interface returns a number representing the state of the connection.
14938
+ *
14939
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/readyState)
14940
+ */
14941
+ get readyState(): number;
14942
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/open_event) */
14943
+ get onopen(): any | null;
14944
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/open_event) */
14945
+ set onopen(value: any | null);
14946
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/message_event) */
14947
+ get onmessage(): any | null;
14948
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/message_event) */
14949
+ set onmessage(value: any | null);
14950
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/error_event) */
14951
+ get onerror(): any | null;
14952
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/error_event) */
14953
+ set onerror(value: any | null);
14954
+ static readonly CONNECTING: number;
14955
+ static readonly OPEN: number;
14956
+ static readonly CLOSED: number;
14957
+ static from(stream: ReadableStream): EventSource;
14958
+ }
14959
+ export interface EventSourceEventSourceInit {
14960
+ withCredentials?: boolean;
14961
+ fetcher?: Fetcher;
14962
+ }
15013
14963
  /**
15014
14964
  * Evaluation context for targeting rules.
15015
14965
  * Keys are attribute names (e.g. "userId", "country"), values are the attribute values.
@@ -15792,6 +15742,62 @@ export interface MediaError extends Error {
15792
15742
  readonly message: string;
15793
15743
  readonly stack?: string;
15794
15744
  }
15745
+ // MessageChannel and MessagePort, declared at every compatibility date. They
15746
+ // are globals under the expose_global_message_channel compatibility flag (the
15747
+ // default from 2025-08-15); node:worker_threads exports them at any date.
15748
+ /**
15749
+ * 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.
15750
+ *
15751
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort)
15752
+ */
15753
+ export declare abstract class MessagePort extends EventTarget {
15754
+ /**
15755
+ * The **`postMessage()`** method of the MessagePort interface sends a message from the port, and optionally, transfers ownership of objects to other browsing contexts.
15756
+ *
15757
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/postMessage)
15758
+ */
15759
+ postMessage(
15760
+ data?: any,
15761
+ options?: any[] | MessagePortPostMessageOptions,
15762
+ ): void;
15763
+ /**
15764
+ * The **`close()`** method of the MessagePort interface disconnects the port, so it is no longer active. This stops the flow of messages to that port.
15765
+ *
15766
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/close)
15767
+ */
15768
+ close(): void;
15769
+ /**
15770
+ * The **`start()`** method of the MessagePort interface starts the sending of messages queued on the port. This method is only needed when using EventTarget.addEventListener; it is implied when using onmessage.
15771
+ *
15772
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/start)
15773
+ */
15774
+ start(): void;
15775
+ get onmessage(): any | null;
15776
+ set onmessage(value: any | null);
15777
+ }
15778
+ /**
15779
+ * The **`MessageChannel`** interface of the Channel Messaging API allows us to create a new message channel and send data through it via its two MessagePort properties.
15780
+ *
15781
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel)
15782
+ */
15783
+ export declare class MessageChannel {
15784
+ constructor();
15785
+ /**
15786
+ * The **`port1`** read-only property of the MessageChannel interface returns the first port of the message channel — the port attached to the context that originated the channel.
15787
+ *
15788
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel/port1)
15789
+ */
15790
+ readonly port1: MessagePort;
15791
+ /**
15792
+ * The **`port2`** read-only property of the MessageChannel interface returns the second port of the message channel — the port attached to the context at the other end of the channel, which the message is initially sent to.
15793
+ *
15794
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel/port2)
15795
+ */
15796
+ readonly port2: MessagePort;
15797
+ }
15798
+ export interface MessagePortPostMessageOptions {
15799
+ transfer?: any[];
15800
+ }
15795
15801
  export type Params<P extends string = any> = Record<P, string | string[]>;
15796
15802
  export type EventContext<Env, P extends string, Data> = {
15797
15803
  request: Request<unknown, IncomingRequestCfProperties<unknown>>;
@@ -16387,6 +16393,7 @@ export interface SecretsStoreSecret {
16387
16393
  * - Binding-level operations:
16388
16394
  * `await env.STREAM.videos.upload`
16389
16395
  * `await env.STREAM.videos.createDirectUpload`
16396
+ * `await env.STREAM.clip`
16390
16397
  * `await env.STREAM.videos.*`
16391
16398
  * `await env.STREAM.watermarks.*`
16392
16399
  * - Per-video operations:
@@ -16433,6 +16440,19 @@ export interface StreamBinding {
16433
16440
  createDirectUpload(
16434
16441
  params: StreamDirectUploadCreateParams,
16435
16442
  ): Promise<StreamDirectUpload>;
16443
+ /**
16444
+ * Creates a new video by clipping a time range from an existing video.
16445
+ * @param videoId The unique identifier of the source video to clip from.
16446
+ * @param params The time range to clip from the source video.
16447
+ * @returns The details of the newly created clip.
16448
+ * @throws {NotFoundError} if the source video is not found
16449
+ * @throws {BadRequestError} if the time range is invalid or extends past the end of the source video
16450
+ * @throws {BadRequestError} if the source video is a live stream recording
16451
+ * @throws {QuotaReachedError} if the account storage capacity is exceeded
16452
+ * @throws {RateLimitedError} if the account has too many videos processing at once
16453
+ * @throws {InternalError} if an unexpected error occurs
16454
+ */
16455
+ clip(videoId: string, params: StreamClipParams): Promise<StreamVideo>;
16436
16456
  videos: StreamVideos;
16437
16457
  watermarks: StreamWatermarks;
16438
16458
  }
@@ -16469,10 +16489,13 @@ export interface StreamVideoHandle {
16469
16489
  delete(): Promise<void>;
16470
16490
  /**
16471
16491
  * Creates a signed URL token for a video.
16492
+ * @param options Optional settings for the token.
16472
16493
  * @returns The signed token that was created.
16494
+ * @throws {NotFoundError} if the video is not found
16495
+ * @throws {BadRequestError} if the options are invalid, e.g. `expiresAt` is in the past or more than 24 hours away, `notBefore` is not before `expiresAt`, or the signing key is not found or does not belong to the account
16473
16496
  * @throws {InternalError} if the signing key cannot be retrieved or the token cannot be signed
16474
16497
  */
16475
- generateToken(): Promise<string>;
16498
+ generateToken(options?: StreamSignedTokenOptions): Promise<string>;
16476
16499
  downloads: StreamScopedDownloads;
16477
16500
  captions: StreamScopedCaptions;
16478
16501
  }
@@ -16582,6 +16605,13 @@ export interface StreamVideo {
16582
16605
  * Public details associated with the video.
16583
16606
  */
16584
16607
  publicDetails: StreamPublicDetails | null;
16608
+ /**
16609
+ * The unique customer code associated with the video.
16610
+ *
16611
+ * Use this to construct URLs that require a customer code, such as player URLs using signed tokens.
16612
+ * `https://customer-{customerCode}.cloudflarestream.com/{token}/iframe`
16613
+ */
16614
+ customerCode: string;
16585
16615
  }
16586
16616
  export type StreamVideoStatus = {
16587
16617
  /**
@@ -16740,6 +16770,98 @@ export type StreamUrlUploadParams = {
16740
16770
  */
16741
16771
  watermarkId?: string;
16742
16772
  };
16773
+ export type StreamClipParams = {
16774
+ /**
16775
+ * The point in the source video, in whole seconds, where the clip starts.
16776
+ */
16777
+ startTimeSeconds: number;
16778
+ /**
16779
+ * The point in the source video, in whole seconds, where the clip ends.
16780
+ * Must be greater than `startTimeSeconds` and no later than the end of the
16781
+ * source video.
16782
+ */
16783
+ endTimeSeconds: number;
16784
+ };
16785
+ export type StreamSignedTokenOptions = {
16786
+ /**
16787
+ * The signing key to sign the token with. When omitted, the token is signed
16788
+ * with a key Stream manages for the account.
16789
+ */
16790
+ signingKey?: StreamSigningKey;
16791
+ /**
16792
+ * When the token stops being accepted, as a `Date` or a Unix timestamp in
16793
+ * seconds. Must be in the future and no more than 24 hours from now.
16794
+ * Defaults to one hour from now.
16795
+ */
16796
+ expiresAt?: Date | number;
16797
+ /**
16798
+ * When the token starts being accepted, as a `Date` or a Unix timestamp in
16799
+ * seconds. Must be earlier than `expiresAt`. Defaults to one hour ago.
16800
+ */
16801
+ notBefore?: Date | number;
16802
+ /**
16803
+ * Whether the token can also be used to access the video's MP4 downloads.
16804
+ * @default false
16805
+ */
16806
+ downloadable?: boolean;
16807
+ /**
16808
+ * Rules that allow or block viewers by IP address or country. Rules are
16809
+ * evaluated in order, and the first rule that matches is applied.
16810
+ */
16811
+ accessRules?: StreamAccessRule[];
16812
+ /**
16813
+ * Additional flags for the token.
16814
+ */
16815
+ flags?: StreamSignedTokenFlags;
16816
+ };
16817
+ export type StreamSigningKey = {
16818
+ /**
16819
+ * The ID of a Stream signing key.
16820
+ */
16821
+ id: string;
16822
+ /**
16823
+ * The base64-encoded private key, in PEM format, for the signing key.
16824
+ */
16825
+ pem: string;
16826
+ };
16827
+ export type StreamSignedTokenFlags = {
16828
+ /**
16829
+ * Whether the token serves the original video without transformations.
16830
+ * @default false
16831
+ */
16832
+ original?: boolean;
16833
+ };
16834
+ export type StreamAccessRuleAction = "allow" | "block";
16835
+ export type StreamAccessRule =
16836
+ | {
16837
+ /**
16838
+ * Matches every request. Use as the last rule to set a default action.
16839
+ */
16840
+ type: "any";
16841
+ action: StreamAccessRuleAction;
16842
+ }
16843
+ | {
16844
+ /**
16845
+ * Matches requests from the listed IP addresses or CIDR ranges.
16846
+ */
16847
+ type: "ip.src";
16848
+ action: StreamAccessRuleAction;
16849
+ /**
16850
+ * IPv4 or IPv6 addresses or CIDR ranges.
16851
+ */
16852
+ ip: string[];
16853
+ }
16854
+ | {
16855
+ /**
16856
+ * Matches requests from the listed countries.
16857
+ */
16858
+ type: "ip.geoip.country";
16859
+ action: StreamAccessRuleAction;
16860
+ /**
16861
+ * Two-letter ISO 3166-1 alpha-2 country codes.
16862
+ */
16863
+ country: string[];
16864
+ };
16743
16865
  export interface StreamScopedCaptions {
16744
16866
  /**
16745
16867
  * Uploads the caption or subtitle file to the endpoint for a specific BCP47 language.
@@ -16774,6 +16896,15 @@ export interface StreamScopedCaptions {
16774
16896
  * @throws {InternalError} if an unexpected error occurs
16775
16897
  */
16776
16898
  list(language?: string): Promise<StreamCaption[]>;
16899
+ /**
16900
+ * Gets the WebVTT file for a caption or subtitle track.
16901
+ * @param language The BCP 47 language tag of the track.
16902
+ * @returns The track's WebVTT file as a stream.
16903
+ * @throws {NotFoundError} if the video is not found, it has no caption for this language, or a generated caption has not finished
16904
+ * @throws {BadRequestError} if the language is not a valid BCP 47 tag
16905
+ * @throws {InternalError} if an unexpected error occurs
16906
+ */
16907
+ get(language: string): Promise<ReadableStream>;
16777
16908
  /**
16778
16909
  * Removes the captions or subtitles from a video.
16779
16910
  * @param language The BCP 47 language tag to remove.
@@ -17123,6 +17254,17 @@ export interface AlreadyUploadedError extends StreamError {
17123
17254
  export interface TooManyWatermarksError extends StreamError {
17124
17255
  name: "TooManyWatermarksError";
17125
17256
  }
17257
+ export interface StructuredSerializeOptions {
17258
+ transfer?: any[];
17259
+ }
17260
+ export interface ServiceWorkerGlobalScope {
17261
+ structuredClone<T>(value: T, options?: StructuredSerializeOptions): T;
17262
+ }
17263
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/structuredClone) */
17264
+ export declare function structuredClone<T>(
17265
+ value: T,
17266
+ options?: StructuredSerializeOptions,
17267
+ ): T;
17126
17268
  export type MarkdownDocument = {
17127
17269
  name: string;
17128
17270
  blob: Blob;
package/package.json CHANGED
@@ -7,5 +7,5 @@
7
7
  },
8
8
  "author": "Cloudflare Workers DevProd Team <workers-devprod@cloudflare.com> (https://workers.cloudflare.com)",
9
9
  "license": "MIT OR Apache-2.0",
10
- "version": "5.20261119.1"
10
+ "version": "5.20261121.1"
11
11
  }