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