two-stroke 6.5.2 → 7.0.0

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.
@@ -1,11 +1,22 @@
1
1
  /* eslint-disable */
2
- // Generated by Wrangler by running `wrangler types` (hash: 869ac3b4ce0f52ba3b2e0bc70c49089e)
3
- // Runtime types generated with workerd@1.20260301.1 2025-09-15 disable_nodejs_fs_module,nodejs_compat
2
+ // Generated by Wrangler by running `wrangler types` (hash: b2afa099eef50e3b1e8d4729ea6dbb6a)
3
+ // Runtime types generated with workerd@1.20260317.1 2025-09-15 disable_nodejs_fs_module,nodejs_compat
4
4
  declare namespace Cloudflare {
5
+ interface GlobalProps {
6
+ mainModule: typeof import("./src/fake");
7
+ }
5
8
  interface Env {
9
+ TOKEN_ISSUER: "fake";
10
+ TOKEN_AUDIENCE: "fake";
6
11
  }
7
12
  }
8
13
  interface Env extends Cloudflare.Env {}
14
+ type StringifyValues<EnvType extends Record<string, unknown>> = {
15
+ [Binding in keyof EnvType]: EnvType[Binding] extends string ? EnvType[Binding] : string;
16
+ };
17
+ declare namespace NodeJS {
18
+ interface ProcessEnv extends StringifyValues<Pick<Cloudflare.Env, "TOKEN_ISSUER" | "TOKEN_AUDIENCE">> {}
19
+ }
9
20
 
10
21
  // Begin runtime types
11
22
  /*! *****************************************************************************
@@ -429,22 +440,22 @@ interface ExecutionContext<Props = unknown> {
429
440
  passThroughOnException(): void;
430
441
  readonly props: Props;
431
442
  }
432
- type ExportedHandlerFetchHandler<Env = unknown, CfHostMetadata = unknown> = (request: Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>, env: Env, ctx: ExecutionContext) => Response | Promise<Response>;
433
- type ExportedHandlerTailHandler<Env = unknown> = (events: TraceItem[], env: Env, ctx: ExecutionContext) => void | Promise<void>;
434
- type ExportedHandlerTraceHandler<Env = unknown> = (traces: TraceItem[], env: Env, ctx: ExecutionContext) => void | Promise<void>;
435
- type ExportedHandlerTailStreamHandler<Env = unknown> = (event: TailStream.TailEvent<TailStream.Onset>, env: Env, ctx: ExecutionContext) => TailStream.TailEventHandlerType | Promise<TailStream.TailEventHandlerType>;
436
- type ExportedHandlerScheduledHandler<Env = unknown> = (controller: ScheduledController, env: Env, ctx: ExecutionContext) => void | Promise<void>;
437
- type ExportedHandlerQueueHandler<Env = unknown, Message = unknown> = (batch: MessageBatch<Message>, env: Env, ctx: ExecutionContext) => void | Promise<void>;
438
- type ExportedHandlerTestHandler<Env = unknown> = (controller: TestController, env: Env, ctx: ExecutionContext) => void | Promise<void>;
439
- interface ExportedHandler<Env = unknown, QueueHandlerMessage = unknown, CfHostMetadata = unknown> {
440
- fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata>;
441
- tail?: ExportedHandlerTailHandler<Env>;
442
- trace?: ExportedHandlerTraceHandler<Env>;
443
- tailStream?: ExportedHandlerTailStreamHandler<Env>;
444
- scheduled?: ExportedHandlerScheduledHandler<Env>;
445
- test?: ExportedHandlerTestHandler<Env>;
446
- email?: EmailExportedHandler<Env>;
447
- queue?: ExportedHandlerQueueHandler<Env, QueueHandlerMessage>;
443
+ type ExportedHandlerFetchHandler<Env = unknown, CfHostMetadata = unknown, Props = unknown> = (request: Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>, env: Env, ctx: ExecutionContext<Props>) => Response | Promise<Response>;
444
+ type ExportedHandlerTailHandler<Env = unknown, Props = unknown> = (events: TraceItem[], env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;
445
+ type ExportedHandlerTraceHandler<Env = unknown, Props = unknown> = (traces: TraceItem[], env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;
446
+ type ExportedHandlerTailStreamHandler<Env = unknown, Props = unknown> = (event: TailStream.TailEvent<TailStream.Onset>, env: Env, ctx: ExecutionContext<Props>) => TailStream.TailEventHandlerType | Promise<TailStream.TailEventHandlerType>;
447
+ type ExportedHandlerScheduledHandler<Env = unknown, Props = unknown> = (controller: ScheduledController, env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;
448
+ type ExportedHandlerQueueHandler<Env = unknown, Message = unknown, Props = unknown> = (batch: MessageBatch<Message>, env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;
449
+ type ExportedHandlerTestHandler<Env = unknown, Props = unknown> = (controller: TestController, env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;
450
+ interface ExportedHandler<Env = unknown, QueueHandlerMessage = unknown, CfHostMetadata = unknown, Props = unknown> {
451
+ fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata, Props>;
452
+ tail?: ExportedHandlerTailHandler<Env, Props>;
453
+ trace?: ExportedHandlerTraceHandler<Env, Props>;
454
+ tailStream?: ExportedHandlerTailStreamHandler<Env, Props>;
455
+ scheduled?: ExportedHandlerScheduledHandler<Env, Props>;
456
+ test?: ExportedHandlerTestHandler<Env, Props>;
457
+ email?: EmailExportedHandler<Env, Props>;
458
+ queue?: ExportedHandlerQueueHandler<Env, QueueHandlerMessage, Props>;
448
459
  }
449
460
  interface StructuredSerializeOptions {
450
461
  transfer?: any[];
@@ -3039,7 +3050,7 @@ declare var WebSocket: {
3039
3050
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket)
3040
3051
  */
3041
3052
  interface WebSocket extends EventTarget<WebSocketEventMap> {
3042
- accept(): void;
3053
+ accept(options?: WebSocketAcceptOptions): void;
3043
3054
  /**
3044
3055
  * The **`WebSocket.send()`** method enqueues the specified data to be transmitted to the server over the WebSocket connection, increasing the value of `bufferedAmount` by the number of bytes needed to contain the data.
3045
3056
  *
@@ -3078,6 +3089,22 @@ interface WebSocket extends EventTarget<WebSocketEventMap> {
3078
3089
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/extensions)
3079
3090
  */
3080
3091
  extensions: string | null;
3092
+ /**
3093
+ * The **`WebSocket.binaryType`** property controls the type of binary data being received over the WebSocket connection.
3094
+ *
3095
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/binaryType)
3096
+ */
3097
+ binaryType: "blob" | "arraybuffer";
3098
+ }
3099
+ interface WebSocketAcceptOptions {
3100
+ /**
3101
+ * When set to `true`, receiving a server-initiated WebSocket Close frame will not
3102
+ * automatically send a reciprocal Close frame, leaving the connection in a half-open
3103
+ * state. This is useful for proxying scenarios where you need to coordinate closing
3104
+ * both sides independently. Defaults to `false` when the
3105
+ * `no_web_socket_half_open_by_default` compatibility flag is enabled.
3106
+ */
3107
+ allowHalfOpen?: boolean;
3081
3108
  }
3082
3109
  declare const WebSocketPair: {
3083
3110
  new (): {
@@ -3196,6 +3223,8 @@ interface Container {
3196
3223
  signal(signo: number): void;
3197
3224
  getTcpPort(port: number): Fetcher;
3198
3225
  setInactivityTimeout(durationMs: number | bigint): Promise<void>;
3226
+ interceptOutboundHttp(addr: string, binding: Fetcher): Promise<void>;
3227
+ interceptAllOutboundHttp(binding: Fetcher): Promise<void>;
3199
3228
  }
3200
3229
  interface ContainerStartupOptions {
3201
3230
  entrypoint?: string[];
@@ -3289,6 +3318,7 @@ interface WorkerStubEntrypointOptions {
3289
3318
  }
3290
3319
  interface WorkerLoader {
3291
3320
  get(name: string | null, getCode: () => WorkerLoaderWorkerCode | Promise<WorkerLoaderWorkerCode>): WorkerStub;
3321
+ load(code: WorkerLoaderWorkerCode): WorkerStub;
3292
3322
  }
3293
3323
  interface WorkerLoaderModule {
3294
3324
  js?: string;
@@ -3335,16 +3365,6 @@ interface AiSearchNotFoundError extends Error {
3335
3365
  }
3336
3366
  interface AiSearchNameNotSetError extends Error {
3337
3367
  }
3338
- // Filter types (shared with AutoRAG for compatibility)
3339
- type ComparisonFilter = {
3340
- key: string;
3341
- type: 'eq' | 'ne' | 'gt' | 'gte' | 'lt' | 'lte';
3342
- value: string | number | boolean;
3343
- };
3344
- type CompoundFilter = {
3345
- type: 'and' | 'or';
3346
- filters: ComparisonFilter[];
3347
- };
3348
3368
  // AI Search V2 Request Types
3349
3369
  type AiSearchSearchRequest = {
3350
3370
  messages: Array<{
@@ -3358,7 +3378,7 @@ type AiSearchSearchRequest = {
3358
3378
  match_threshold?: number;
3359
3379
  /** Maximum number of results (1-50, default 10) */
3360
3380
  max_num_results?: number;
3361
- filters?: CompoundFilter | ComparisonFilter;
3381
+ filters?: VectorizeVectorMetadataFilter;
3362
3382
  /** Context expansion (0-3, default 0) */
3363
3383
  context_expansion?: number;
3364
3384
  [key: string]: unknown;
@@ -3392,7 +3412,7 @@ type AiSearchChatCompletionsRequest = {
3392
3412
  retrieval_type?: 'vector' | 'keyword' | 'hybrid';
3393
3413
  match_threshold?: number;
3394
3414
  max_num_results?: number;
3395
- filters?: CompoundFilter | ComparisonFilter;
3415
+ filters?: VectorizeVectorMetadataFilter;
3396
3416
  context_expansion?: number;
3397
3417
  [key: string]: unknown;
3398
3418
  };
@@ -8826,7 +8846,7 @@ type AIGatewayHeaders = {
8826
8846
  [key: string]: string | number | boolean | object;
8827
8847
  };
8828
8848
  type AIGatewayUniversalRequest = {
8829
- provider: AIGatewayProviders | string; // eslint-disable-line
8849
+ provider: AIGatewayProviders | string;
8830
8850
  endpoint: string;
8831
8851
  headers: Partial<AIGatewayHeaders>;
8832
8852
  query: unknown;
@@ -8842,7 +8862,7 @@ declare abstract class AiGateway {
8842
8862
  gateway?: UniversalGatewayOptions;
8843
8863
  extraHeaders?: object;
8844
8864
  }): Promise<Response>;
8845
- getUrl(provider?: AIGatewayProviders | string): Promise<string>; // eslint-disable-line
8865
+ getUrl(provider?: AIGatewayProviders | string): Promise<string>;
8846
8866
  }
8847
8867
  /**
8848
8868
  * @deprecated AutoRAG has been replaced by AI Search. Use AiSearchInternalError instead.
@@ -8867,6 +8887,15 @@ interface AutoRAGUnauthorizedError extends Error {
8867
8887
  */
8868
8888
  interface AutoRAGNameNotSetError extends Error {
8869
8889
  }
8890
+ type ComparisonFilter = {
8891
+ key: string;
8892
+ type: 'eq' | 'ne' | 'gt' | 'gte' | 'lt' | 'lte';
8893
+ value: string | number | boolean;
8894
+ };
8895
+ type CompoundFilter = {
8896
+ type: 'and' | 'or';
8897
+ filters: ComparisonFilter[];
8898
+ };
8870
8899
  /**
8871
8900
  * @deprecated AutoRAG has been replaced by AI Search.
8872
8901
  * Use AiSearchSearchRequest with the new API instead.
@@ -9923,7 +9952,7 @@ interface SendEmail {
9923
9952
  declare abstract class EmailEvent extends ExtendableEvent {
9924
9953
  readonly message: ForwardableEmailMessage;
9925
9954
  }
9926
- declare type EmailExportedHandler<Env = unknown> = (message: ForwardableEmailMessage, env: Env, ctx: ExecutionContext) => void | Promise<void>;
9955
+ declare type EmailExportedHandler<Env = unknown, Props = unknown> = (message: ForwardableEmailMessage, env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;
9927
9956
  declare module "cloudflare:email" {
9928
9957
  let _EmailMessage: {
9929
9958
  prototype: EmailMessage;
@@ -10642,9 +10671,12 @@ declare namespace CloudflareWorkersModule {
10642
10671
  timestamp: Date;
10643
10672
  type: string;
10644
10673
  };
10674
+ export type WorkflowStepContext = {
10675
+ attempt: number;
10676
+ };
10645
10677
  export abstract class WorkflowStep {
10646
- do<T extends Rpc.Serializable<T>>(name: string, callback: () => Promise<T>): Promise<T>;
10647
- do<T extends Rpc.Serializable<T>>(name: string, config: WorkflowStepConfig, callback: () => Promise<T>): Promise<T>;
10678
+ do<T extends Rpc.Serializable<T>>(name: string, callback: (ctx: WorkflowStepContext) => Promise<T>): Promise<T>;
10679
+ do<T extends Rpc.Serializable<T>>(name: string, config: WorkflowStepConfig, callback: (ctx: WorkflowStepContext) => Promise<T>): Promise<T>;
10648
10680
  sleep: (name: string, duration: WorkflowSleepDuration) => Promise<void>;
10649
10681
  sleepUntil: (name: string, timestamp: Date | number) => Promise<void>;
10650
10682
  waitForEvent<T extends Rpc.Serializable<T>>(name: string, options: {
@@ -10681,6 +10713,752 @@ declare module "cloudflare:sockets" {
10681
10713
  function _connect(address: string | SocketAddress, options?: SocketOptions): Socket;
10682
10714
  export { _connect as connect };
10683
10715
  }
10716
+ /**
10717
+ * Binding entrypoint for Cloudflare Stream.
10718
+ *
10719
+ * Usage:
10720
+ * - Binding-level operations:
10721
+ * `await env.STREAM.videos.upload`
10722
+ * `await env.STREAM.videos.createDirectUpload`
10723
+ * `await env.STREAM.videos.*`
10724
+ * `await env.STREAM.watermarks.*`
10725
+ * - Per-video operations:
10726
+ * `await env.STREAM.video(id).downloads.*`
10727
+ * `await env.STREAM.video(id).captions.*`
10728
+ *
10729
+ * Example usage:
10730
+ * ```ts
10731
+ * await env.STREAM.video(id).downloads.generate();
10732
+ *
10733
+ * const video = env.STREAM.video(id)
10734
+ * const captions = video.captions.list();
10735
+ * const videoDetails = video.details()
10736
+ * ```
10737
+ */
10738
+ interface StreamBinding {
10739
+ /**
10740
+ * Returns a handle scoped to a single video for per-video operations.
10741
+ * @param id The unique identifier for the video.
10742
+ * @returns A handle for per-video operations.
10743
+ */
10744
+ video(id: string): StreamVideoHandle;
10745
+ /**
10746
+ * Uploads a new video from a File.
10747
+ * @param file The video file to upload.
10748
+ * @returns The uploaded video details.
10749
+ * @throws {BadRequestError} if the upload parameter is invalid
10750
+ * @throws {QuotaReachedError} if the account storage capacity is exceeded
10751
+ * @throws {MaxFileSizeError} if the file size is too large
10752
+ * @throws {RateLimitedError} if the server received too many requests
10753
+ * @throws {InternalError} if an unexpected error occurs
10754
+ */
10755
+ upload(file: File): Promise<StreamVideo>;
10756
+ /**
10757
+ * Uploads a new video from a provided URL.
10758
+ * @param url The URL to upload from.
10759
+ * @param params Optional upload parameters.
10760
+ * @returns The uploaded video details.
10761
+ * @throws {BadRequestError} if the upload parameter is invalid or the URL is invalid
10762
+ * @throws {QuotaReachedError} if the account storage capacity is exceeded
10763
+ * @throws {MaxFileSizeError} if the file size is too large
10764
+ * @throws {RateLimitedError} if the server received too many requests
10765
+ * @throws {AlreadyUploadedError} if a video was already uploaded to this URL
10766
+ * @throws {InternalError} if an unexpected error occurs
10767
+ */
10768
+ upload(url: string, params?: StreamUrlUploadParams): Promise<StreamVideo>;
10769
+ /**
10770
+ * Creates a direct upload that allows video uploads without an API key.
10771
+ * @param params Parameters for the direct upload
10772
+ * @returns The direct upload details.
10773
+ * @throws {BadRequestError} if the parameters are invalid
10774
+ * @throws {RateLimitedError} if the server received too many requests
10775
+ * @throws {InternalError} if an unexpected error occurs
10776
+ */
10777
+ createDirectUpload(params: StreamDirectUploadCreateParams): Promise<StreamDirectUpload>;
10778
+ videos: StreamVideos;
10779
+ watermarks: StreamWatermarks;
10780
+ }
10781
+ /**
10782
+ * Handle for operations scoped to a single Stream video.
10783
+ */
10784
+ interface StreamVideoHandle {
10785
+ /**
10786
+ * The unique identifier for the video.
10787
+ */
10788
+ id: string;
10789
+ /**
10790
+ * Get a full videos details
10791
+ * @returns The full video details.
10792
+ * @throws {NotFoundError} if the video is not found
10793
+ * @throws {InternalError} if an unexpected error occurs
10794
+ */
10795
+ details(): Promise<StreamVideo>;
10796
+ /**
10797
+ * Update details for a single video.
10798
+ * @param params The fields to update for the video.
10799
+ * @returns The updated video details.
10800
+ * @throws {NotFoundError} if the video is not found
10801
+ * @throws {BadRequestError} if the parameters are invalid
10802
+ * @throws {InternalError} if an unexpected error occurs
10803
+ */
10804
+ update(params: StreamUpdateVideoParams): Promise<StreamVideo>;
10805
+ /**
10806
+ * Deletes a video and its copies from Cloudflare Stream.
10807
+ * @returns A promise that resolves when deletion completes.
10808
+ * @throws {NotFoundError} if the video is not found
10809
+ * @throws {InternalError} if an unexpected error occurs
10810
+ */
10811
+ delete(): Promise<void>;
10812
+ /**
10813
+ * Creates a signed URL token for a video.
10814
+ * @returns The signed token that was created.
10815
+ * @throws {InternalError} if the signing key cannot be retrieved or the token cannot be signed
10816
+ */
10817
+ generateToken(): Promise<string>;
10818
+ downloads: StreamScopedDownloads;
10819
+ captions: StreamScopedCaptions;
10820
+ }
10821
+ interface StreamVideo {
10822
+ /**
10823
+ * The unique identifier for the video.
10824
+ */
10825
+ id: string;
10826
+ /**
10827
+ * A user-defined identifier for the media creator.
10828
+ */
10829
+ creator: string | null;
10830
+ /**
10831
+ * The thumbnail URL for the video.
10832
+ */
10833
+ thumbnail: string;
10834
+ /**
10835
+ * The thumbnail timestamp percentage.
10836
+ */
10837
+ thumbnailTimestampPct: number;
10838
+ /**
10839
+ * Indicates whether the video is ready to stream.
10840
+ */
10841
+ readyToStream: boolean;
10842
+ /**
10843
+ * The date and time the video became ready to stream.
10844
+ */
10845
+ readyToStreamAt: string | null;
10846
+ /**
10847
+ * Processing status information.
10848
+ */
10849
+ status: StreamVideoStatus;
10850
+ /**
10851
+ * A user modifiable key-value store.
10852
+ */
10853
+ meta: Record<string, string>;
10854
+ /**
10855
+ * The date and time the video was created.
10856
+ */
10857
+ created: string;
10858
+ /**
10859
+ * The date and time the video was last modified.
10860
+ */
10861
+ modified: string;
10862
+ /**
10863
+ * The date and time at which the video will be deleted.
10864
+ */
10865
+ scheduledDeletion: string | null;
10866
+ /**
10867
+ * The size of the video in bytes.
10868
+ */
10869
+ size: number;
10870
+ /**
10871
+ * The preview URL for the video.
10872
+ */
10873
+ preview?: string;
10874
+ /**
10875
+ * Origins allowed to display the video.
10876
+ */
10877
+ allowedOrigins: Array<string>;
10878
+ /**
10879
+ * Indicates whether signed URLs are required.
10880
+ */
10881
+ requireSignedURLs: boolean | null;
10882
+ /**
10883
+ * The date and time the video was uploaded.
10884
+ */
10885
+ uploaded: string | null;
10886
+ /**
10887
+ * The date and time when the upload URL expires.
10888
+ */
10889
+ uploadExpiry: string | null;
10890
+ /**
10891
+ * The maximum size in bytes for direct uploads.
10892
+ */
10893
+ maxSizeBytes: number | null;
10894
+ /**
10895
+ * The maximum duration in seconds for direct uploads.
10896
+ */
10897
+ maxDurationSeconds: number | null;
10898
+ /**
10899
+ * The video duration in seconds. -1 indicates unknown.
10900
+ */
10901
+ duration: number;
10902
+ /**
10903
+ * Input metadata for the original upload.
10904
+ */
10905
+ input: StreamVideoInput;
10906
+ /**
10907
+ * Playback URLs for the video.
10908
+ */
10909
+ hlsPlaybackUrl: string;
10910
+ dashPlaybackUrl: string;
10911
+ /**
10912
+ * The watermark applied to the video, if any.
10913
+ */
10914
+ watermark: StreamWatermark | null;
10915
+ /**
10916
+ * The live input id associated with the video, if any.
10917
+ */
10918
+ liveInputId?: string | null;
10919
+ /**
10920
+ * The source video id if this is a clip.
10921
+ */
10922
+ clippedFromId: string | null;
10923
+ /**
10924
+ * Public details associated with the video.
10925
+ */
10926
+ publicDetails: StreamPublicDetails | null;
10927
+ }
10928
+ type StreamVideoStatus = {
10929
+ /**
10930
+ * The current processing state.
10931
+ */
10932
+ state: string;
10933
+ /**
10934
+ * The current processing step.
10935
+ */
10936
+ step?: string;
10937
+ /**
10938
+ * The percent complete as a string.
10939
+ */
10940
+ pctComplete?: string;
10941
+ /**
10942
+ * An error reason code, if applicable.
10943
+ */
10944
+ errorReasonCode: string;
10945
+ /**
10946
+ * An error reason text, if applicable.
10947
+ */
10948
+ errorReasonText: string;
10949
+ };
10950
+ type StreamVideoInput = {
10951
+ /**
10952
+ * The input width in pixels.
10953
+ */
10954
+ width: number;
10955
+ /**
10956
+ * The input height in pixels.
10957
+ */
10958
+ height: number;
10959
+ };
10960
+ type StreamPublicDetails = {
10961
+ /**
10962
+ * The public title for the video.
10963
+ */
10964
+ title: string | null;
10965
+ /**
10966
+ * The public share link.
10967
+ */
10968
+ share_link: string | null;
10969
+ /**
10970
+ * The public channel link.
10971
+ */
10972
+ channel_link: string | null;
10973
+ /**
10974
+ * The public logo URL.
10975
+ */
10976
+ logo: string | null;
10977
+ };
10978
+ type StreamDirectUpload = {
10979
+ /**
10980
+ * The URL an unauthenticated upload can use for a single multipart request.
10981
+ */
10982
+ uploadURL: string;
10983
+ /**
10984
+ * A Cloudflare-generated unique identifier for a media item.
10985
+ */
10986
+ id: string;
10987
+ /**
10988
+ * The watermark profile applied to the upload.
10989
+ */
10990
+ watermark: StreamWatermark | null;
10991
+ /**
10992
+ * The scheduled deletion time, if any.
10993
+ */
10994
+ scheduledDeletion: string | null;
10995
+ };
10996
+ type StreamDirectUploadCreateParams = {
10997
+ /**
10998
+ * The maximum duration in seconds for a video upload.
10999
+ */
11000
+ maxDurationSeconds: number;
11001
+ /**
11002
+ * The date and time after upload when videos will not be accepted.
11003
+ */
11004
+ expiry?: string;
11005
+ /**
11006
+ * A user-defined identifier for the media creator.
11007
+ */
11008
+ creator?: string;
11009
+ /**
11010
+ * A user modifiable key-value store used to reference other systems of record for
11011
+ * managing videos.
11012
+ */
11013
+ meta?: Record<string, string>;
11014
+ /**
11015
+ * Lists the origins allowed to display the video.
11016
+ */
11017
+ allowedOrigins?: Array<string>;
11018
+ /**
11019
+ * Indicates whether the video can be accessed using the id. When set to `true`,
11020
+ * a signed token must be generated with a signing key to view the video.
11021
+ */
11022
+ requireSignedURLs?: boolean;
11023
+ /**
11024
+ * The thumbnail timestamp percentage.
11025
+ */
11026
+ thumbnailTimestampPct?: number;
11027
+ /**
11028
+ * The date and time at which the video will be deleted. Include `null` to remove
11029
+ * a scheduled deletion.
11030
+ */
11031
+ scheduledDeletion?: string | null;
11032
+ /**
11033
+ * The watermark profile to apply.
11034
+ */
11035
+ watermark?: StreamDirectUploadWatermark;
11036
+ };
11037
+ type StreamDirectUploadWatermark = {
11038
+ /**
11039
+ * The unique identifier for the watermark profile.
11040
+ */
11041
+ id: string;
11042
+ };
11043
+ type StreamUrlUploadParams = {
11044
+ /**
11045
+ * Lists the origins allowed to display the video. Enter allowed origin
11046
+ * domains in an array and use `*` for wildcard subdomains. Empty arrays allow the
11047
+ * video to be viewed on any origin.
11048
+ */
11049
+ allowedOrigins?: Array<string>;
11050
+ /**
11051
+ * A user-defined identifier for the media creator.
11052
+ */
11053
+ creator?: string;
11054
+ /**
11055
+ * A user modifiable key-value store used to reference other systems of
11056
+ * record for managing videos.
11057
+ */
11058
+ meta?: Record<string, string>;
11059
+ /**
11060
+ * Indicates whether the video can be a accessed using the id. When
11061
+ * set to `true`, a signed token must be generated with a signing key to view the
11062
+ * video.
11063
+ */
11064
+ requireSignedURLs?: boolean;
11065
+ /**
11066
+ * Indicates the date and time at which the video will be deleted. Omit
11067
+ * the field to indicate no change, or include with a `null` value to remove an
11068
+ * existing scheduled deletion. If specified, must be at least 30 days from upload
11069
+ * time.
11070
+ */
11071
+ scheduledDeletion?: string | null;
11072
+ /**
11073
+ * The timestamp for a thumbnail image calculated as a percentage value
11074
+ * of the video's duration. To convert from a second-wise timestamp to a
11075
+ * percentage, divide the desired timestamp by the total duration of the video. If
11076
+ * this value is not set, the default thumbnail image is taken from 0s of the
11077
+ * video.
11078
+ */
11079
+ thumbnailTimestampPct?: number;
11080
+ /**
11081
+ * The identifier for the watermark profile
11082
+ */
11083
+ watermarkId?: string;
11084
+ };
11085
+ interface StreamScopedCaptions {
11086
+ /**
11087
+ * Uploads the caption or subtitle file to the endpoint for a specific BCP47 language.
11088
+ * One caption or subtitle file per language is allowed.
11089
+ * @param language The BCP 47 language tag for the caption or subtitle.
11090
+ * @param file The caption or subtitle file to upload.
11091
+ * @returns The created caption entry.
11092
+ * @throws {NotFoundError} if the video is not found
11093
+ * @throws {BadRequestError} if the language or file is invalid
11094
+ * @throws {MaxFileSizeError} if the file size is too large
11095
+ * @throws {InternalError} if an unexpected error occurs
11096
+ */
11097
+ upload(language: string, file: File): Promise<StreamCaption>;
11098
+ /**
11099
+ * Generate captions or subtitles for the provided language via AI.
11100
+ * @param language The BCP 47 language tag to generate.
11101
+ * @returns The generated caption entry.
11102
+ * @throws {NotFoundError} if the video is not found
11103
+ * @throws {BadRequestError} if the language is invalid
11104
+ * @throws {StreamError} if a generated caption already exists
11105
+ * @throws {StreamError} if the video duration is too long
11106
+ * @throws {StreamError} if the video is missing audio
11107
+ * @throws {StreamError} if the requested language is not supported
11108
+ * @throws {InternalError} if an unexpected error occurs
11109
+ */
11110
+ generate(language: string): Promise<StreamCaption>;
11111
+ /**
11112
+ * Lists the captions or subtitles.
11113
+ * Use the language parameter to filter by a specific language.
11114
+ * @param language The optional BCP 47 language tag to filter by.
11115
+ * @returns The list of captions or subtitles.
11116
+ * @throws {NotFoundError} if the video or caption is not found
11117
+ * @throws {InternalError} if an unexpected error occurs
11118
+ */
11119
+ list(language?: string): Promise<StreamCaption[]>;
11120
+ /**
11121
+ * Removes the captions or subtitles from a video.
11122
+ * @param language The BCP 47 language tag to remove.
11123
+ * @returns A promise that resolves when deletion completes.
11124
+ * @throws {NotFoundError} if the video or caption is not found
11125
+ * @throws {InternalError} if an unexpected error occurs
11126
+ */
11127
+ delete(language: string): Promise<void>;
11128
+ }
11129
+ interface StreamScopedDownloads {
11130
+ /**
11131
+ * Generates a download for a video when a video is ready to view. Available
11132
+ * types are `default` and `audio`. Defaults to `default` when omitted.
11133
+ * @param downloadType The download type to create.
11134
+ * @returns The current downloads for the video.
11135
+ * @throws {NotFoundError} if the video is not found
11136
+ * @throws {BadRequestError} if the download type is invalid
11137
+ * @throws {StreamError} if the video duration is too long to generate a download
11138
+ * @throws {StreamError} if the video is not ready to stream
11139
+ * @throws {InternalError} if an unexpected error occurs
11140
+ */
11141
+ generate(downloadType?: StreamDownloadType): Promise<StreamDownloadGetResponse>;
11142
+ /**
11143
+ * Lists the downloads created for a video.
11144
+ * @returns The current downloads for the video.
11145
+ * @throws {NotFoundError} if the video or downloads are not found
11146
+ * @throws {InternalError} if an unexpected error occurs
11147
+ */
11148
+ get(): Promise<StreamDownloadGetResponse>;
11149
+ /**
11150
+ * Delete the downloads for a video. Available types are `default` and `audio`.
11151
+ * Defaults to `default` when omitted.
11152
+ * @param downloadType The download type to delete.
11153
+ * @returns A promise that resolves when deletion completes.
11154
+ * @throws {NotFoundError} if the video or downloads are not found
11155
+ * @throws {InternalError} if an unexpected error occurs
11156
+ */
11157
+ delete(downloadType?: StreamDownloadType): Promise<void>;
11158
+ }
11159
+ interface StreamVideos {
11160
+ /**
11161
+ * Lists all videos in a users account.
11162
+ * @returns The list of videos.
11163
+ * @throws {BadRequestError} if the parameters are invalid
11164
+ * @throws {InternalError} if an unexpected error occurs
11165
+ */
11166
+ list(params?: StreamVideosListParams): Promise<StreamVideo[]>;
11167
+ }
11168
+ interface StreamWatermarks {
11169
+ /**
11170
+ * Generate a new watermark profile
11171
+ * @param file The image file to upload
11172
+ * @param params The watermark creation parameters.
11173
+ * @returns The created watermark profile.
11174
+ * @throws {BadRequestError} if the parameters are invalid
11175
+ * @throws {InvalidURLError} if the URL is invalid
11176
+ * @throws {MaxFileSizeError} if the file size is too large
11177
+ * @throws {TooManyWatermarksError} if the number of allowed watermarks is reached
11178
+ * @throws {InternalError} if an unexpected error occurs
11179
+ */
11180
+ generate(file: File, params: StreamWatermarkCreateParams): Promise<StreamWatermark>;
11181
+ /**
11182
+ * Generate a new watermark profile
11183
+ * @param url The image url to upload
11184
+ * @param params The watermark creation parameters.
11185
+ * @returns The created watermark profile.
11186
+ * @throws {BadRequestError} if the parameters are invalid
11187
+ * @throws {InvalidURLError} if the URL is invalid
11188
+ * @throws {MaxFileSizeError} if the file size is too large
11189
+ * @throws {TooManyWatermarksError} if the number of allowed watermarks is reached
11190
+ * @throws {InternalError} if an unexpected error occurs
11191
+ */
11192
+ generate(url: string, params: StreamWatermarkCreateParams): Promise<StreamWatermark>;
11193
+ /**
11194
+ * Lists all watermark profiles for an account.
11195
+ * @returns The list of watermark profiles.
11196
+ * @throws {InternalError} if an unexpected error occurs
11197
+ */
11198
+ list(): Promise<StreamWatermark[]>;
11199
+ /**
11200
+ * Retrieves details for a single watermark profile.
11201
+ * @param watermarkId The watermark profile identifier.
11202
+ * @returns The watermark profile details.
11203
+ * @throws {NotFoundError} if the watermark is not found
11204
+ * @throws {InternalError} if an unexpected error occurs
11205
+ */
11206
+ get(watermarkId: string): Promise<StreamWatermark>;
11207
+ /**
11208
+ * Deletes a watermark profile.
11209
+ * @param watermarkId The watermark profile identifier.
11210
+ * @returns A promise that resolves when deletion completes.
11211
+ * @throws {NotFoundError} if the watermark is not found
11212
+ * @throws {InternalError} if an unexpected error occurs
11213
+ */
11214
+ delete(watermarkId: string): Promise<void>;
11215
+ }
11216
+ type StreamUpdateVideoParams = {
11217
+ /**
11218
+ * Lists the origins allowed to display the video. Enter allowed origin
11219
+ * domains in an array and use `*` for wildcard subdomains. Empty arrays allow the
11220
+ * video to be viewed on any origin.
11221
+ */
11222
+ allowedOrigins?: Array<string>;
11223
+ /**
11224
+ * A user-defined identifier for the media creator.
11225
+ */
11226
+ creator?: string;
11227
+ /**
11228
+ * The maximum duration in seconds for a video upload. Can be set for a
11229
+ * video that is not yet uploaded to limit its duration. Uploads that exceed the
11230
+ * specified duration will fail during processing. A value of `-1` means the value
11231
+ * is unknown.
11232
+ */
11233
+ maxDurationSeconds?: number;
11234
+ /**
11235
+ * A user modifiable key-value store used to reference other systems of
11236
+ * record for managing videos.
11237
+ */
11238
+ meta?: Record<string, string>;
11239
+ /**
11240
+ * Indicates whether the video can be a accessed using the id. When
11241
+ * set to `true`, a signed token must be generated with a signing key to view the
11242
+ * video.
11243
+ */
11244
+ requireSignedURLs?: boolean;
11245
+ /**
11246
+ * Indicates the date and time at which the video will be deleted. Omit
11247
+ * the field to indicate no change, or include with a `null` value to remove an
11248
+ * existing scheduled deletion. If specified, must be at least 30 days from upload
11249
+ * time.
11250
+ */
11251
+ scheduledDeletion?: string | null;
11252
+ /**
11253
+ * The timestamp for a thumbnail image calculated as a percentage value
11254
+ * of the video's duration. To convert from a second-wise timestamp to a
11255
+ * percentage, divide the desired timestamp by the total duration of the video. If
11256
+ * this value is not set, the default thumbnail image is taken from 0s of the
11257
+ * video.
11258
+ */
11259
+ thumbnailTimestampPct?: number;
11260
+ };
11261
+ type StreamCaption = {
11262
+ /**
11263
+ * Whether the caption was generated via AI.
11264
+ */
11265
+ generated?: boolean;
11266
+ /**
11267
+ * The language label displayed in the native language to users.
11268
+ */
11269
+ label: string;
11270
+ /**
11271
+ * The language tag in BCP 47 format.
11272
+ */
11273
+ language: string;
11274
+ /**
11275
+ * The status of a generated caption.
11276
+ */
11277
+ status?: 'ready' | 'inprogress' | 'error';
11278
+ };
11279
+ type StreamDownloadStatus = 'ready' | 'inprogress' | 'error';
11280
+ type StreamDownloadType = 'default' | 'audio';
11281
+ type StreamDownload = {
11282
+ /**
11283
+ * Indicates the progress as a percentage between 0 and 100.
11284
+ */
11285
+ percentComplete: number;
11286
+ /**
11287
+ * The status of a generated download.
11288
+ */
11289
+ status: StreamDownloadStatus;
11290
+ /**
11291
+ * The URL to access the generated download.
11292
+ */
11293
+ url?: string;
11294
+ };
11295
+ /**
11296
+ * An object with download type keys. Each key is optional and only present if that
11297
+ * download type has been created.
11298
+ */
11299
+ type StreamDownloadGetResponse = {
11300
+ /**
11301
+ * The audio-only download. Only present if this download type has been created.
11302
+ */
11303
+ audio?: StreamDownload;
11304
+ /**
11305
+ * The default video download. Only present if this download type has been created.
11306
+ */
11307
+ default?: StreamDownload;
11308
+ };
11309
+ type StreamWatermarkPosition = 'upperRight' | 'upperLeft' | 'lowerLeft' | 'lowerRight' | 'center';
11310
+ type StreamWatermark = {
11311
+ /**
11312
+ * The unique identifier for a watermark profile.
11313
+ */
11314
+ id: string;
11315
+ /**
11316
+ * The size of the image in bytes.
11317
+ */
11318
+ size: number;
11319
+ /**
11320
+ * The height of the image in pixels.
11321
+ */
11322
+ height: number;
11323
+ /**
11324
+ * The width of the image in pixels.
11325
+ */
11326
+ width: number;
11327
+ /**
11328
+ * The date and a time a watermark profile was created.
11329
+ */
11330
+ created: string;
11331
+ /**
11332
+ * The source URL for a downloaded image. If the watermark profile was created via
11333
+ * direct upload, this field is null.
11334
+ */
11335
+ downloadedFrom: string | null;
11336
+ /**
11337
+ * A short description of the watermark profile.
11338
+ */
11339
+ name: string;
11340
+ /**
11341
+ * The translucency of the image. A value of `0.0` makes the image completely
11342
+ * transparent, and `1.0` makes the image completely opaque. Note that if the image
11343
+ * is already semi-transparent, setting this to `1.0` will not make the image
11344
+ * completely opaque.
11345
+ */
11346
+ opacity: number;
11347
+ /**
11348
+ * The whitespace between the adjacent edges (determined by position) of the video
11349
+ * and the image. `0.0` indicates no padding, and `1.0` indicates a fully padded
11350
+ * video width or length, as determined by the algorithm.
11351
+ */
11352
+ padding: number;
11353
+ /**
11354
+ * The size of the image relative to the overall size of the video. This parameter
11355
+ * will adapt to horizontal and vertical videos automatically. `0.0` indicates no
11356
+ * scaling (use the size of the image as-is), and `1.0 `fills the entire video.
11357
+ */
11358
+ scale: number;
11359
+ /**
11360
+ * The location of the image. Valid positions are: `upperRight`, `upperLeft`,
11361
+ * `lowerLeft`, `lowerRight`, and `center`. Note that `center` ignores the
11362
+ * `padding` parameter.
11363
+ */
11364
+ position: StreamWatermarkPosition;
11365
+ };
11366
+ type StreamWatermarkCreateParams = {
11367
+ /**
11368
+ * A short description of the watermark profile.
11369
+ */
11370
+ name?: string;
11371
+ /**
11372
+ * The translucency of the image. A value of `0.0` makes the image completely
11373
+ * transparent, and `1.0` makes the image completely opaque. Note that if the
11374
+ * image is already semi-transparent, setting this to `1.0` will not make the
11375
+ * image completely opaque.
11376
+ */
11377
+ opacity?: number;
11378
+ /**
11379
+ * The whitespace between the adjacent edges (determined by position) of the
11380
+ * video and the image. `0.0` indicates no padding, and `1.0` indicates a fully
11381
+ * padded video width or length, as determined by the algorithm.
11382
+ */
11383
+ padding?: number;
11384
+ /**
11385
+ * The size of the image relative to the overall size of the video. This
11386
+ * parameter will adapt to horizontal and vertical videos automatically. `0.0`
11387
+ * indicates no scaling (use the size of the image as-is), and `1.0 `fills the
11388
+ * entire video.
11389
+ */
11390
+ scale?: number;
11391
+ /**
11392
+ * The location of the image.
11393
+ */
11394
+ position?: StreamWatermarkPosition;
11395
+ };
11396
+ type StreamVideosListParams = {
11397
+ /**
11398
+ * The maximum number of videos to return.
11399
+ */
11400
+ limit?: number;
11401
+ /**
11402
+ * Return videos created before this timestamp.
11403
+ * (RFC3339/RFC3339Nano)
11404
+ */
11405
+ before?: string;
11406
+ /**
11407
+ * Comparison operator for the `before` field.
11408
+ * @default 'lt'
11409
+ */
11410
+ beforeComp?: StreamPaginationComparison;
11411
+ /**
11412
+ * Return videos created after this timestamp.
11413
+ * (RFC3339/RFC3339Nano)
11414
+ */
11415
+ after?: string;
11416
+ /**
11417
+ * Comparison operator for the `after` field.
11418
+ * @default 'gte'
11419
+ */
11420
+ afterComp?: StreamPaginationComparison;
11421
+ };
11422
+ type StreamPaginationComparison = 'eq' | 'gt' | 'gte' | 'lt' | 'lte';
11423
+ /**
11424
+ * Error object for Stream binding operations.
11425
+ */
11426
+ interface StreamError extends Error {
11427
+ readonly code: number;
11428
+ readonly statusCode: number;
11429
+ readonly message: string;
11430
+ readonly stack?: string;
11431
+ }
11432
+ interface InternalError extends StreamError {
11433
+ name: 'InternalError';
11434
+ }
11435
+ interface BadRequestError extends StreamError {
11436
+ name: 'BadRequestError';
11437
+ }
11438
+ interface NotFoundError extends StreamError {
11439
+ name: 'NotFoundError';
11440
+ }
11441
+ interface ForbiddenError extends StreamError {
11442
+ name: 'ForbiddenError';
11443
+ }
11444
+ interface RateLimitedError extends StreamError {
11445
+ name: 'RateLimitedError';
11446
+ }
11447
+ interface QuotaReachedError extends StreamError {
11448
+ name: 'QuotaReachedError';
11449
+ }
11450
+ interface MaxFileSizeError extends StreamError {
11451
+ name: 'MaxFileSizeError';
11452
+ }
11453
+ interface InvalidURLError extends StreamError {
11454
+ name: 'InvalidURLError';
11455
+ }
11456
+ interface AlreadyUploadedError extends StreamError {
11457
+ name: 'AlreadyUploadedError';
11458
+ }
11459
+ interface TooManyWatermarksError extends StreamError {
11460
+ name: 'TooManyWatermarksError';
11461
+ }
10684
11462
  type MarkdownDocument = {
10685
11463
  name: string;
10686
11464
  blob: Blob;
@@ -10712,6 +11490,7 @@ type ConversionOptions = {
10712
11490
  convertOGImage?: boolean;
10713
11491
  };
10714
11492
  hostname?: string;
11493
+ cssSelector?: string;
10715
11494
  };
10716
11495
  docx?: {
10717
11496
  images?: EmbeddedImageConversionOptions;