@cloudflare/workers-types 4.20260310.1 → 4.20260313.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.
@@ -492,6 +492,14 @@ interface ExecutionContext<Props = unknown> {
492
492
  passThroughOnException(): void;
493
493
  readonly exports: Cloudflare.Exports;
494
494
  readonly props: Props;
495
+ readonly version?: {
496
+ readonly metadata?: {
497
+ readonly id: string;
498
+ };
499
+ readonly cohort?: string;
500
+ readonly key?: string;
501
+ readonly override?: string;
502
+ };
495
503
  abort(reason?: any): void;
496
504
  }
497
505
  type ExportedHandlerFetchHandler<
@@ -3688,7 +3696,7 @@ declare var WebSocket: {
3688
3696
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket)
3689
3697
  */
3690
3698
  interface WebSocket extends EventTarget<WebSocketEventMap> {
3691
- accept(): void;
3699
+ accept(options?: WebSocketAcceptOptions): void;
3692
3700
  /**
3693
3701
  * 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.
3694
3702
  *
@@ -3734,6 +3742,16 @@ interface WebSocket extends EventTarget<WebSocketEventMap> {
3734
3742
  */
3735
3743
  binaryType: "blob" | "arraybuffer";
3736
3744
  }
3745
+ interface WebSocketAcceptOptions {
3746
+ /**
3747
+ * When set to `true`, receiving a server-initiated WebSocket Close frame will not
3748
+ * automatically send a reciprocal Close frame, leaving the connection in a half-open
3749
+ * state. This is useful for proxying scenarios where you need to coordinate closing
3750
+ * both sides independently. Defaults to `false` when the
3751
+ * `no_web_socket_half_open_by_default` compatibility flag is enabled.
3752
+ */
3753
+ allowHalfOpen?: boolean;
3754
+ }
3737
3755
  declare const WebSocketPair: {
3738
3756
  new (): {
3739
3757
  0: WebSocket;
@@ -12738,6 +12756,767 @@ declare module "cloudflare:sockets" {
12738
12756
  ): Socket;
12739
12757
  export { _connect as connect };
12740
12758
  }
12759
+ /**
12760
+ * Binding entrypoint for Cloudflare Stream.
12761
+ *
12762
+ * Usage:
12763
+ * - Binding-level operations:
12764
+ * `await env.STREAM.videos.upload`
12765
+ * `await env.STREAM.videos.createDirectUpload`
12766
+ * `await env.STREAM.videos.*`
12767
+ * `await env.STREAM.watermarks.*`
12768
+ * - Per-video operations:
12769
+ * `await env.STREAM.video(id).downloads.*`
12770
+ * `await env.STREAM.video(id).captions.*`
12771
+ *
12772
+ * Example usage:
12773
+ * ```ts
12774
+ * await env.STREAM.video(id).downloads.generate();
12775
+ *
12776
+ * const video = env.STREAM.video(id)
12777
+ * const captions = video.captions.list();
12778
+ * const videoDetails = video.details()
12779
+ * ```
12780
+ */
12781
+ interface StreamBinding {
12782
+ /**
12783
+ * Returns a handle scoped to a single video for per-video operations.
12784
+ * @param id The unique identifier for the video.
12785
+ * @returns A handle for per-video operations.
12786
+ */
12787
+ video(id: string): StreamVideoHandle;
12788
+ /**
12789
+ * Uploads a new video from a File.
12790
+ * @param file The video file to upload.
12791
+ * @returns The uploaded video details.
12792
+ * @throws {BadRequestError} if the upload parameter is invalid
12793
+ * @throws {QuotaReachedError} if the account storage capacity is exceeded
12794
+ * @throws {MaxFileSizeError} if the file size is too large
12795
+ * @throws {RateLimitedError} if the server received too many requests
12796
+ * @throws {InternalError} if an unexpected error occurs
12797
+ */
12798
+ upload(file: File): Promise<StreamVideo>;
12799
+ /**
12800
+ * Uploads a new video from a provided URL.
12801
+ * @param url The URL to upload from.
12802
+ * @param params Optional upload parameters.
12803
+ * @returns The uploaded video details.
12804
+ * @throws {BadRequestError} if the upload parameter is invalid or the URL is invalid
12805
+ * @throws {QuotaReachedError} if the account storage capacity is exceeded
12806
+ * @throws {MaxFileSizeError} if the file size is too large
12807
+ * @throws {RateLimitedError} if the server received too many requests
12808
+ * @throws {AlreadyUploadedError} if a video was already uploaded to this URL
12809
+ * @throws {InternalError} if an unexpected error occurs
12810
+ */
12811
+ upload(url: string, params?: StreamUrlUploadParams): Promise<StreamVideo>;
12812
+ /**
12813
+ * Creates a direct upload that allows video uploads without an API key.
12814
+ * @param params Parameters for the direct upload
12815
+ * @returns The direct upload details.
12816
+ * @throws {BadRequestError} if the parameters are invalid
12817
+ * @throws {RateLimitedError} if the server received too many requests
12818
+ * @throws {InternalError} if an unexpected error occurs
12819
+ */
12820
+ createDirectUpload(
12821
+ params: StreamDirectUploadCreateParams,
12822
+ ): Promise<StreamDirectUpload>;
12823
+ videos: StreamVideos;
12824
+ watermarks: StreamWatermarks;
12825
+ }
12826
+ /**
12827
+ * Handle for operations scoped to a single Stream video.
12828
+ */
12829
+ interface StreamVideoHandle {
12830
+ /**
12831
+ * The unique identifier for the video.
12832
+ */
12833
+ id: string;
12834
+ /**
12835
+ * Get a full videos details
12836
+ * @returns The full video details.
12837
+ * @throws {NotFoundError} if the video is not found
12838
+ * @throws {InternalError} if an unexpected error occurs
12839
+ */
12840
+ details(): Promise<StreamVideo>;
12841
+ /**
12842
+ * Update details for a single video.
12843
+ * @param params The fields to update for the video.
12844
+ * @returns The updated video details.
12845
+ * @throws {NotFoundError} if the video is not found
12846
+ * @throws {BadRequestError} if the parameters are invalid
12847
+ * @throws {InternalError} if an unexpected error occurs
12848
+ */
12849
+ update(params: StreamUpdateVideoParams): Promise<StreamVideo>;
12850
+ /**
12851
+ * Deletes a video and its copies from Cloudflare Stream.
12852
+ * @returns A promise that resolves when deletion completes.
12853
+ * @throws {NotFoundError} if the video is not found
12854
+ * @throws {InternalError} if an unexpected error occurs
12855
+ */
12856
+ delete(): Promise<void>;
12857
+ /**
12858
+ * Creates a signed URL token for a video.
12859
+ * @returns The signed token that was created.
12860
+ * @throws {InternalError} if the signing key cannot be retrieved or the token cannot be signed
12861
+ */
12862
+ generateToken(): Promise<string>;
12863
+ downloads: StreamScopedDownloads;
12864
+ captions: StreamScopedCaptions;
12865
+ }
12866
+ interface StreamVideo {
12867
+ /**
12868
+ * The unique identifier for the video.
12869
+ */
12870
+ id: string;
12871
+ /**
12872
+ * A user-defined identifier for the media creator.
12873
+ */
12874
+ creator: string | null;
12875
+ /**
12876
+ * The thumbnail URL for the video.
12877
+ */
12878
+ thumbnail: string;
12879
+ /**
12880
+ * The thumbnail timestamp percentage.
12881
+ */
12882
+ thumbnailTimestampPct: number;
12883
+ /**
12884
+ * Indicates whether the video is ready to stream.
12885
+ */
12886
+ readyToStream: boolean;
12887
+ /**
12888
+ * The date and time the video became ready to stream.
12889
+ */
12890
+ readyToStreamAt: string | null;
12891
+ /**
12892
+ * Processing status information.
12893
+ */
12894
+ status: StreamVideoStatus;
12895
+ /**
12896
+ * A user modifiable key-value store.
12897
+ */
12898
+ meta: Record<string, string>;
12899
+ /**
12900
+ * The date and time the video was created.
12901
+ */
12902
+ created: string;
12903
+ /**
12904
+ * The date and time the video was last modified.
12905
+ */
12906
+ modified: string;
12907
+ /**
12908
+ * The date and time at which the video will be deleted.
12909
+ */
12910
+ scheduledDeletion: string | null;
12911
+ /**
12912
+ * The size of the video in bytes.
12913
+ */
12914
+ size: number;
12915
+ /**
12916
+ * The preview URL for the video.
12917
+ */
12918
+ preview?: string;
12919
+ /**
12920
+ * Origins allowed to display the video.
12921
+ */
12922
+ allowedOrigins: Array<string>;
12923
+ /**
12924
+ * Indicates whether signed URLs are required.
12925
+ */
12926
+ requireSignedURLs: boolean | null;
12927
+ /**
12928
+ * The date and time the video was uploaded.
12929
+ */
12930
+ uploaded: string | null;
12931
+ /**
12932
+ * The date and time when the upload URL expires.
12933
+ */
12934
+ uploadExpiry: string | null;
12935
+ /**
12936
+ * The maximum size in bytes for direct uploads.
12937
+ */
12938
+ maxSizeBytes: number | null;
12939
+ /**
12940
+ * The maximum duration in seconds for direct uploads.
12941
+ */
12942
+ maxDurationSeconds: number | null;
12943
+ /**
12944
+ * The video duration in seconds. -1 indicates unknown.
12945
+ */
12946
+ duration: number;
12947
+ /**
12948
+ * Input metadata for the original upload.
12949
+ */
12950
+ input: StreamVideoInput;
12951
+ /**
12952
+ * Playback URLs for the video.
12953
+ */
12954
+ hlsPlaybackUrl: string;
12955
+ dashPlaybackUrl: string;
12956
+ /**
12957
+ * The watermark applied to the video, if any.
12958
+ */
12959
+ watermark: StreamWatermark | null;
12960
+ /**
12961
+ * The live input id associated with the video, if any.
12962
+ */
12963
+ liveInputId?: string | null;
12964
+ /**
12965
+ * The source video id if this is a clip.
12966
+ */
12967
+ clippedFromId: string | null;
12968
+ /**
12969
+ * Public details associated with the video.
12970
+ */
12971
+ publicDetails: StreamPublicDetails | null;
12972
+ }
12973
+ type StreamVideoStatus = {
12974
+ /**
12975
+ * The current processing state.
12976
+ */
12977
+ state: string;
12978
+ /**
12979
+ * The current processing step.
12980
+ */
12981
+ step?: string;
12982
+ /**
12983
+ * The percent complete as a string.
12984
+ */
12985
+ pctComplete?: string;
12986
+ /**
12987
+ * An error reason code, if applicable.
12988
+ */
12989
+ errorReasonCode: string;
12990
+ /**
12991
+ * An error reason text, if applicable.
12992
+ */
12993
+ errorReasonText: string;
12994
+ };
12995
+ type StreamVideoInput = {
12996
+ /**
12997
+ * The input width in pixels.
12998
+ */
12999
+ width: number;
13000
+ /**
13001
+ * The input height in pixels.
13002
+ */
13003
+ height: number;
13004
+ };
13005
+ type StreamPublicDetails = {
13006
+ /**
13007
+ * The public title for the video.
13008
+ */
13009
+ title: string | null;
13010
+ /**
13011
+ * The public share link.
13012
+ */
13013
+ share_link: string | null;
13014
+ /**
13015
+ * The public channel link.
13016
+ */
13017
+ channel_link: string | null;
13018
+ /**
13019
+ * The public logo URL.
13020
+ */
13021
+ logo: string | null;
13022
+ };
13023
+ type StreamDirectUpload = {
13024
+ /**
13025
+ * The URL an unauthenticated upload can use for a single multipart request.
13026
+ */
13027
+ uploadURL: string;
13028
+ /**
13029
+ * A Cloudflare-generated unique identifier for a media item.
13030
+ */
13031
+ id: string;
13032
+ /**
13033
+ * The watermark profile applied to the upload.
13034
+ */
13035
+ watermark: StreamWatermark | null;
13036
+ /**
13037
+ * The scheduled deletion time, if any.
13038
+ */
13039
+ scheduledDeletion: string | null;
13040
+ };
13041
+ type StreamDirectUploadCreateParams = {
13042
+ /**
13043
+ * The maximum duration in seconds for a video upload.
13044
+ */
13045
+ maxDurationSeconds: number;
13046
+ /**
13047
+ * The date and time after upload when videos will not be accepted.
13048
+ */
13049
+ expiry?: string;
13050
+ /**
13051
+ * A user-defined identifier for the media creator.
13052
+ */
13053
+ creator?: string;
13054
+ /**
13055
+ * A user modifiable key-value store used to reference other systems of record for
13056
+ * managing videos.
13057
+ */
13058
+ meta?: Record<string, string>;
13059
+ /**
13060
+ * Lists the origins allowed to display the video.
13061
+ */
13062
+ allowedOrigins?: Array<string>;
13063
+ /**
13064
+ * Indicates whether the video can be accessed using the id. When set to `true`,
13065
+ * a signed token must be generated with a signing key to view the video.
13066
+ */
13067
+ requireSignedURLs?: boolean;
13068
+ /**
13069
+ * The thumbnail timestamp percentage.
13070
+ */
13071
+ thumbnailTimestampPct?: number;
13072
+ /**
13073
+ * The date and time at which the video will be deleted. Include `null` to remove
13074
+ * a scheduled deletion.
13075
+ */
13076
+ scheduledDeletion?: string | null;
13077
+ /**
13078
+ * The watermark profile to apply.
13079
+ */
13080
+ watermark?: StreamDirectUploadWatermark;
13081
+ };
13082
+ type StreamDirectUploadWatermark = {
13083
+ /**
13084
+ * The unique identifier for the watermark profile.
13085
+ */
13086
+ id: string;
13087
+ };
13088
+ type StreamUrlUploadParams = {
13089
+ /**
13090
+ * Lists the origins allowed to display the video. Enter allowed origin
13091
+ * domains in an array and use `*` for wildcard subdomains. Empty arrays allow the
13092
+ * video to be viewed on any origin.
13093
+ */
13094
+ allowedOrigins?: Array<string>;
13095
+ /**
13096
+ * A user-defined identifier for the media creator.
13097
+ */
13098
+ creator?: string;
13099
+ /**
13100
+ * A user modifiable key-value store used to reference other systems of
13101
+ * record for managing videos.
13102
+ */
13103
+ meta?: Record<string, string>;
13104
+ /**
13105
+ * Indicates whether the video can be a accessed using the id. When
13106
+ * set to `true`, a signed token must be generated with a signing key to view the
13107
+ * video.
13108
+ */
13109
+ requireSignedURLs?: boolean;
13110
+ /**
13111
+ * Indicates the date and time at which the video will be deleted. Omit
13112
+ * the field to indicate no change, or include with a `null` value to remove an
13113
+ * existing scheduled deletion. If specified, must be at least 30 days from upload
13114
+ * time.
13115
+ */
13116
+ scheduledDeletion?: string | null;
13117
+ /**
13118
+ * The timestamp for a thumbnail image calculated as a percentage value
13119
+ * of the video's duration. To convert from a second-wise timestamp to a
13120
+ * percentage, divide the desired timestamp by the total duration of the video. If
13121
+ * this value is not set, the default thumbnail image is taken from 0s of the
13122
+ * video.
13123
+ */
13124
+ thumbnailTimestampPct?: number;
13125
+ /**
13126
+ * The identifier for the watermark profile
13127
+ */
13128
+ watermarkId?: string;
13129
+ };
13130
+ interface StreamScopedCaptions {
13131
+ /**
13132
+ * Uploads the caption or subtitle file to the endpoint for a specific BCP47 language.
13133
+ * One caption or subtitle file per language is allowed.
13134
+ * @param language The BCP 47 language tag for the caption or subtitle.
13135
+ * @param file The caption or subtitle file to upload.
13136
+ * @returns The created caption entry.
13137
+ * @throws {NotFoundError} if the video is not found
13138
+ * @throws {BadRequestError} if the language or file is invalid
13139
+ * @throws {MaxFileSizeError} if the file size is too large
13140
+ * @throws {InternalError} if an unexpected error occurs
13141
+ */
13142
+ upload(language: string, file: File): Promise<StreamCaption>;
13143
+ /**
13144
+ * Generate captions or subtitles for the provided language via AI.
13145
+ * @param language The BCP 47 language tag to generate.
13146
+ * @returns The generated caption entry.
13147
+ * @throws {NotFoundError} if the video is not found
13148
+ * @throws {BadRequestError} if the language is invalid
13149
+ * @throws {StreamError} if a generated caption already exists
13150
+ * @throws {StreamError} if the video duration is too long
13151
+ * @throws {StreamError} if the video is missing audio
13152
+ * @throws {StreamError} if the requested language is not supported
13153
+ * @throws {InternalError} if an unexpected error occurs
13154
+ */
13155
+ generate(language: string): Promise<StreamCaption>;
13156
+ /**
13157
+ * Lists the captions or subtitles.
13158
+ * Use the language parameter to filter by a specific language.
13159
+ * @param language The optional BCP 47 language tag to filter by.
13160
+ * @returns The list of captions or subtitles.
13161
+ * @throws {NotFoundError} if the video or caption is not found
13162
+ * @throws {InternalError} if an unexpected error occurs
13163
+ */
13164
+ list(language?: string): Promise<StreamCaption[]>;
13165
+ /**
13166
+ * Removes the captions or subtitles from a video.
13167
+ * @param language The BCP 47 language tag to remove.
13168
+ * @returns A promise that resolves when deletion completes.
13169
+ * @throws {NotFoundError} if the video or caption is not found
13170
+ * @throws {InternalError} if an unexpected error occurs
13171
+ */
13172
+ delete(language: string): Promise<void>;
13173
+ }
13174
+ interface StreamScopedDownloads {
13175
+ /**
13176
+ * Generates a download for a video when a video is ready to view. Available
13177
+ * types are `default` and `audio`. Defaults to `default` when omitted.
13178
+ * @param downloadType The download type to create.
13179
+ * @returns The current downloads for the video.
13180
+ * @throws {NotFoundError} if the video is not found
13181
+ * @throws {BadRequestError} if the download type is invalid
13182
+ * @throws {StreamError} if the video duration is too long to generate a download
13183
+ * @throws {StreamError} if the video is not ready to stream
13184
+ * @throws {InternalError} if an unexpected error occurs
13185
+ */
13186
+ generate(
13187
+ downloadType?: StreamDownloadType,
13188
+ ): Promise<StreamDownloadGetResponse>;
13189
+ /**
13190
+ * Lists the downloads created for a video.
13191
+ * @returns The current downloads for the video.
13192
+ * @throws {NotFoundError} if the video or downloads are not found
13193
+ * @throws {InternalError} if an unexpected error occurs
13194
+ */
13195
+ get(): Promise<StreamDownloadGetResponse>;
13196
+ /**
13197
+ * Delete the downloads for a video. Available types are `default` and `audio`.
13198
+ * Defaults to `default` when omitted.
13199
+ * @param downloadType The download type to delete.
13200
+ * @returns A promise that resolves when deletion completes.
13201
+ * @throws {NotFoundError} if the video or downloads are not found
13202
+ * @throws {InternalError} if an unexpected error occurs
13203
+ */
13204
+ delete(downloadType?: StreamDownloadType): Promise<void>;
13205
+ }
13206
+ interface StreamVideos {
13207
+ /**
13208
+ * Lists all videos in a users account.
13209
+ * @returns The list of videos.
13210
+ * @throws {BadRequestError} if the parameters are invalid
13211
+ * @throws {InternalError} if an unexpected error occurs
13212
+ */
13213
+ list(params?: StreamVideosListParams): Promise<StreamVideo[]>;
13214
+ }
13215
+ interface StreamWatermarks {
13216
+ /**
13217
+ * Generate a new watermark profile
13218
+ * @param file The image file to upload
13219
+ * @param params The watermark creation parameters.
13220
+ * @returns The created watermark profile.
13221
+ * @throws {BadRequestError} if the parameters are invalid
13222
+ * @throws {InvalidURLError} if the URL is invalid
13223
+ * @throws {MaxFileSizeError} if the file size is too large
13224
+ * @throws {TooManyWatermarksError} if the number of allowed watermarks is reached
13225
+ * @throws {InternalError} if an unexpected error occurs
13226
+ */
13227
+ generate(
13228
+ file: File,
13229
+ params: StreamWatermarkCreateParams,
13230
+ ): Promise<StreamWatermark>;
13231
+ /**
13232
+ * Generate a new watermark profile
13233
+ * @param url The image url to upload
13234
+ * @param params The watermark creation parameters.
13235
+ * @returns The created watermark profile.
13236
+ * @throws {BadRequestError} if the parameters are invalid
13237
+ * @throws {InvalidURLError} if the URL is invalid
13238
+ * @throws {MaxFileSizeError} if the file size is too large
13239
+ * @throws {TooManyWatermarksError} if the number of allowed watermarks is reached
13240
+ * @throws {InternalError} if an unexpected error occurs
13241
+ */
13242
+ generate(
13243
+ url: string,
13244
+ params: StreamWatermarkCreateParams,
13245
+ ): Promise<StreamWatermark>;
13246
+ /**
13247
+ * Lists all watermark profiles for an account.
13248
+ * @returns The list of watermark profiles.
13249
+ * @throws {InternalError} if an unexpected error occurs
13250
+ */
13251
+ list(): Promise<StreamWatermark[]>;
13252
+ /**
13253
+ * Retrieves details for a single watermark profile.
13254
+ * @param watermarkId The watermark profile identifier.
13255
+ * @returns The watermark profile details.
13256
+ * @throws {NotFoundError} if the watermark is not found
13257
+ * @throws {InternalError} if an unexpected error occurs
13258
+ */
13259
+ get(watermarkId: string): Promise<StreamWatermark>;
13260
+ /**
13261
+ * Deletes a watermark profile.
13262
+ * @param watermarkId The watermark profile identifier.
13263
+ * @returns A promise that resolves when deletion completes.
13264
+ * @throws {NotFoundError} if the watermark is not found
13265
+ * @throws {InternalError} if an unexpected error occurs
13266
+ */
13267
+ delete(watermarkId: string): Promise<void>;
13268
+ }
13269
+ type StreamUpdateVideoParams = {
13270
+ /**
13271
+ * Lists the origins allowed to display the video. Enter allowed origin
13272
+ * domains in an array and use `*` for wildcard subdomains. Empty arrays allow the
13273
+ * video to be viewed on any origin.
13274
+ */
13275
+ allowedOrigins?: Array<string>;
13276
+ /**
13277
+ * A user-defined identifier for the media creator.
13278
+ */
13279
+ creator?: string;
13280
+ /**
13281
+ * The maximum duration in seconds for a video upload. Can be set for a
13282
+ * video that is not yet uploaded to limit its duration. Uploads that exceed the
13283
+ * specified duration will fail during processing. A value of `-1` means the value
13284
+ * is unknown.
13285
+ */
13286
+ maxDurationSeconds?: number;
13287
+ /**
13288
+ * A user modifiable key-value store used to reference other systems of
13289
+ * record for managing videos.
13290
+ */
13291
+ meta?: Record<string, string>;
13292
+ /**
13293
+ * Indicates whether the video can be a accessed using the id. When
13294
+ * set to `true`, a signed token must be generated with a signing key to view the
13295
+ * video.
13296
+ */
13297
+ requireSignedURLs?: boolean;
13298
+ /**
13299
+ * Indicates the date and time at which the video will be deleted. Omit
13300
+ * the field to indicate no change, or include with a `null` value to remove an
13301
+ * existing scheduled deletion. If specified, must be at least 30 days from upload
13302
+ * time.
13303
+ */
13304
+ scheduledDeletion?: string | null;
13305
+ /**
13306
+ * The timestamp for a thumbnail image calculated as a percentage value
13307
+ * of the video's duration. To convert from a second-wise timestamp to a
13308
+ * percentage, divide the desired timestamp by the total duration of the video. If
13309
+ * this value is not set, the default thumbnail image is taken from 0s of the
13310
+ * video.
13311
+ */
13312
+ thumbnailTimestampPct?: number;
13313
+ };
13314
+ type StreamCaption = {
13315
+ /**
13316
+ * Whether the caption was generated via AI.
13317
+ */
13318
+ generated?: boolean;
13319
+ /**
13320
+ * The language label displayed in the native language to users.
13321
+ */
13322
+ label: string;
13323
+ /**
13324
+ * The language tag in BCP 47 format.
13325
+ */
13326
+ language: string;
13327
+ /**
13328
+ * The status of a generated caption.
13329
+ */
13330
+ status?: "ready" | "inprogress" | "error";
13331
+ };
13332
+ type StreamDownloadStatus = "ready" | "inprogress" | "error";
13333
+ type StreamDownloadType = "default" | "audio";
13334
+ type StreamDownload = {
13335
+ /**
13336
+ * Indicates the progress as a percentage between 0 and 100.
13337
+ */
13338
+ percentComplete: number;
13339
+ /**
13340
+ * The status of a generated download.
13341
+ */
13342
+ status: StreamDownloadStatus;
13343
+ /**
13344
+ * The URL to access the generated download.
13345
+ */
13346
+ url?: string;
13347
+ };
13348
+ /**
13349
+ * An object with download type keys. Each key is optional and only present if that
13350
+ * download type has been created.
13351
+ */
13352
+ type StreamDownloadGetResponse = {
13353
+ /**
13354
+ * The audio-only download. Only present if this download type has been created.
13355
+ */
13356
+ audio?: StreamDownload;
13357
+ /**
13358
+ * The default video download. Only present if this download type has been created.
13359
+ */
13360
+ default?: StreamDownload;
13361
+ };
13362
+ type StreamWatermarkPosition =
13363
+ | "upperRight"
13364
+ | "upperLeft"
13365
+ | "lowerLeft"
13366
+ | "lowerRight"
13367
+ | "center";
13368
+ type StreamWatermark = {
13369
+ /**
13370
+ * The unique identifier for a watermark profile.
13371
+ */
13372
+ id: string;
13373
+ /**
13374
+ * The size of the image in bytes.
13375
+ */
13376
+ size: number;
13377
+ /**
13378
+ * The height of the image in pixels.
13379
+ */
13380
+ height: number;
13381
+ /**
13382
+ * The width of the image in pixels.
13383
+ */
13384
+ width: number;
13385
+ /**
13386
+ * The date and a time a watermark profile was created.
13387
+ */
13388
+ created: string;
13389
+ /**
13390
+ * The source URL for a downloaded image. If the watermark profile was created via
13391
+ * direct upload, this field is null.
13392
+ */
13393
+ downloadedFrom: string | null;
13394
+ /**
13395
+ * A short description of the watermark profile.
13396
+ */
13397
+ name: string;
13398
+ /**
13399
+ * The translucency of the image. A value of `0.0` makes the image completely
13400
+ * transparent, and `1.0` makes the image completely opaque. Note that if the image
13401
+ * is already semi-transparent, setting this to `1.0` will not make the image
13402
+ * completely opaque.
13403
+ */
13404
+ opacity: number;
13405
+ /**
13406
+ * The whitespace between the adjacent edges (determined by position) of the video
13407
+ * and the image. `0.0` indicates no padding, and `1.0` indicates a fully padded
13408
+ * video width or length, as determined by the algorithm.
13409
+ */
13410
+ padding: number;
13411
+ /**
13412
+ * The size of the image relative to the overall size of the video. This parameter
13413
+ * will adapt to horizontal and vertical videos automatically. `0.0` indicates no
13414
+ * scaling (use the size of the image as-is), and `1.0 `fills the entire video.
13415
+ */
13416
+ scale: number;
13417
+ /**
13418
+ * The location of the image. Valid positions are: `upperRight`, `upperLeft`,
13419
+ * `lowerLeft`, `lowerRight`, and `center`. Note that `center` ignores the
13420
+ * `padding` parameter.
13421
+ */
13422
+ position: StreamWatermarkPosition;
13423
+ };
13424
+ type StreamWatermarkCreateParams = {
13425
+ /**
13426
+ * A short description of the watermark profile.
13427
+ */
13428
+ name?: string;
13429
+ /**
13430
+ * The translucency of the image. A value of `0.0` makes the image completely
13431
+ * transparent, and `1.0` makes the image completely opaque. Note that if the
13432
+ * image is already semi-transparent, setting this to `1.0` will not make the
13433
+ * image completely opaque.
13434
+ */
13435
+ opacity?: number;
13436
+ /**
13437
+ * The whitespace between the adjacent edges (determined by position) of the
13438
+ * video and the image. `0.0` indicates no padding, and `1.0` indicates a fully
13439
+ * padded video width or length, as determined by the algorithm.
13440
+ */
13441
+ padding?: number;
13442
+ /**
13443
+ * The size of the image relative to the overall size of the video. This
13444
+ * parameter will adapt to horizontal and vertical videos automatically. `0.0`
13445
+ * indicates no scaling (use the size of the image as-is), and `1.0 `fills the
13446
+ * entire video.
13447
+ */
13448
+ scale?: number;
13449
+ /**
13450
+ * The location of the image.
13451
+ */
13452
+ position?: StreamWatermarkPosition;
13453
+ };
13454
+ type StreamVideosListParams = {
13455
+ /**
13456
+ * The maximum number of videos to return.
13457
+ */
13458
+ limit?: number;
13459
+ /**
13460
+ * Return videos created before this timestamp.
13461
+ * (RFC3339/RFC3339Nano)
13462
+ */
13463
+ before?: string;
13464
+ /**
13465
+ * Comparison operator for the `before` field.
13466
+ * @default 'lt'
13467
+ */
13468
+ beforeComp?: StreamPaginationComparison;
13469
+ /**
13470
+ * Return videos created after this timestamp.
13471
+ * (RFC3339/RFC3339Nano)
13472
+ */
13473
+ after?: string;
13474
+ /**
13475
+ * Comparison operator for the `after` field.
13476
+ * @default 'gte'
13477
+ */
13478
+ afterComp?: StreamPaginationComparison;
13479
+ };
13480
+ type StreamPaginationComparison = "eq" | "gt" | "gte" | "lt" | "lte";
13481
+ /**
13482
+ * Error object for Stream binding operations.
13483
+ */
13484
+ interface StreamError extends Error {
13485
+ readonly code: number;
13486
+ readonly statusCode: number;
13487
+ readonly message: string;
13488
+ readonly stack?: string;
13489
+ }
13490
+ interface InternalError extends StreamError {
13491
+ name: "InternalError";
13492
+ }
13493
+ interface BadRequestError extends StreamError {
13494
+ name: "BadRequestError";
13495
+ }
13496
+ interface NotFoundError extends StreamError {
13497
+ name: "NotFoundError";
13498
+ }
13499
+ interface ForbiddenError extends StreamError {
13500
+ name: "ForbiddenError";
13501
+ }
13502
+ interface RateLimitedError extends StreamError {
13503
+ name: "RateLimitedError";
13504
+ }
13505
+ interface QuotaReachedError extends StreamError {
13506
+ name: "QuotaReachedError";
13507
+ }
13508
+ interface MaxFileSizeError extends StreamError {
13509
+ name: "MaxFileSizeError";
13510
+ }
13511
+ interface InvalidURLError extends StreamError {
13512
+ name: "InvalidURLError";
13513
+ }
13514
+ interface AlreadyUploadedError extends StreamError {
13515
+ name: "AlreadyUploadedError";
13516
+ }
13517
+ interface TooManyWatermarksError extends StreamError {
13518
+ name: "TooManyWatermarksError";
13519
+ }
12741
13520
  type MarkdownDocument = {
12742
13521
  name: string;
12743
13522
  blob: Blob;