@cloudflare/workers-types 4.20250904.0 → 4.20250906.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.
- package/2021-11-03/index.d.ts +133 -7
- package/2021-11-03/index.ts +133 -7
- package/2022-01-31/index.d.ts +133 -7
- package/2022-01-31/index.ts +133 -7
- package/2022-03-21/index.d.ts +133 -7
- package/2022-03-21/index.ts +133 -7
- package/2022-08-04/index.d.ts +133 -7
- package/2022-08-04/index.ts +133 -7
- package/2022-10-31/index.d.ts +133 -7
- package/2022-10-31/index.ts +133 -7
- package/2022-11-30/index.d.ts +133 -7
- package/2022-11-30/index.ts +133 -7
- package/2023-03-01/index.d.ts +133 -7
- package/2023-03-01/index.ts +133 -7
- package/2023-07-01/index.d.ts +133 -7
- package/2023-07-01/index.ts +133 -7
- package/experimental/index.d.ts +133 -7
- package/experimental/index.ts +133 -7
- package/index.d.ts +133 -7
- package/index.ts +133 -7
- package/latest/index.d.ts +133 -7
- package/latest/index.ts +133 -7
- package/oldest/index.d.ts +133 -7
- package/oldest/index.ts +133 -7
- package/package.json +1 -1
package/2022-10-31/index.ts
CHANGED
|
@@ -7554,6 +7554,7 @@ export type ImageOutputOptions = {
|
|
|
7554
7554
|
| "rgba";
|
|
7555
7555
|
quality?: number;
|
|
7556
7556
|
background?: string;
|
|
7557
|
+
anim?: boolean;
|
|
7557
7558
|
};
|
|
7558
7559
|
export interface ImagesBinding {
|
|
7559
7560
|
/**
|
|
@@ -7621,6 +7622,110 @@ export interface ImagesError extends Error {
|
|
|
7621
7622
|
readonly message: string;
|
|
7622
7623
|
readonly stack?: string;
|
|
7623
7624
|
}
|
|
7625
|
+
/**
|
|
7626
|
+
* Media binding for transforming media streams.
|
|
7627
|
+
* Provides the entry point for media transformation operations.
|
|
7628
|
+
*/
|
|
7629
|
+
export interface MediaBinding {
|
|
7630
|
+
/**
|
|
7631
|
+
* Creates a media transformer from an input stream.
|
|
7632
|
+
* @param media - The input media bytes
|
|
7633
|
+
* @returns A MediaTransformer instance for applying transformations
|
|
7634
|
+
*/
|
|
7635
|
+
input(media: ReadableStream<Uint8Array>): MediaTransformer;
|
|
7636
|
+
}
|
|
7637
|
+
/**
|
|
7638
|
+
* Media transformer for applying transformation operations to media content.
|
|
7639
|
+
* Handles sizing, fitting, and other input transformation parameters.
|
|
7640
|
+
*/
|
|
7641
|
+
export interface MediaTransformer {
|
|
7642
|
+
/**
|
|
7643
|
+
* Applies transformation options to the media content.
|
|
7644
|
+
* @param transform - Configuration for how the media should be transformed
|
|
7645
|
+
* @returns A generator for producing the transformed media output
|
|
7646
|
+
*/
|
|
7647
|
+
transform(
|
|
7648
|
+
transform: MediaTransformationInputOptions,
|
|
7649
|
+
): MediaTransformationGenerator;
|
|
7650
|
+
}
|
|
7651
|
+
/**
|
|
7652
|
+
* Generator for producing media transformation results.
|
|
7653
|
+
* Configures the output format and parameters for the transformed media.
|
|
7654
|
+
*/
|
|
7655
|
+
export interface MediaTransformationGenerator {
|
|
7656
|
+
/**
|
|
7657
|
+
* Generates the final media output with specified options.
|
|
7658
|
+
* @param output - Configuration for the output format and parameters
|
|
7659
|
+
* @returns The final transformation result containing the transformed media
|
|
7660
|
+
*/
|
|
7661
|
+
output(output: MediaTransformationOutputOptions): MediaTransformationResult;
|
|
7662
|
+
}
|
|
7663
|
+
/**
|
|
7664
|
+
* Result of a media transformation operation.
|
|
7665
|
+
* Provides multiple ways to access the transformed media content.
|
|
7666
|
+
*/
|
|
7667
|
+
export interface MediaTransformationResult {
|
|
7668
|
+
/**
|
|
7669
|
+
* Returns the transformed media as a readable stream of bytes.
|
|
7670
|
+
* @returns A stream containing the transformed media data
|
|
7671
|
+
*/
|
|
7672
|
+
media(): ReadableStream<Uint8Array>;
|
|
7673
|
+
/**
|
|
7674
|
+
* Returns the transformed media as an HTTP response object.
|
|
7675
|
+
* @returns The transformed media as a Response, ready to store in cache or return to users
|
|
7676
|
+
*/
|
|
7677
|
+
response(): Response;
|
|
7678
|
+
/**
|
|
7679
|
+
* Returns the MIME type of the transformed media.
|
|
7680
|
+
* @returns The content type string (e.g., 'image/jpeg', 'video/mp4')
|
|
7681
|
+
*/
|
|
7682
|
+
contentType(): string;
|
|
7683
|
+
}
|
|
7684
|
+
/**
|
|
7685
|
+
* Configuration options for transforming media input.
|
|
7686
|
+
* Controls how the media should be resized and fitted.
|
|
7687
|
+
*/
|
|
7688
|
+
export type MediaTransformationInputOptions = {
|
|
7689
|
+
/** How the media should be resized to fit the specified dimensions */
|
|
7690
|
+
fit?: "contain" | "cover" | "scale-down";
|
|
7691
|
+
/** Target width in pixels */
|
|
7692
|
+
width?: number;
|
|
7693
|
+
/** Target height in pixels */
|
|
7694
|
+
height?: number;
|
|
7695
|
+
};
|
|
7696
|
+
/**
|
|
7697
|
+
* Configuration options for Media Transformations output.
|
|
7698
|
+
* Controls the format, timing, and type of the generated output.
|
|
7699
|
+
*/
|
|
7700
|
+
export type MediaTransformationOutputOptions = {
|
|
7701
|
+
/**
|
|
7702
|
+
* Output mode determining the type of media to generate
|
|
7703
|
+
*/
|
|
7704
|
+
mode?: "video" | "spritesheet" | "frame" | "audio";
|
|
7705
|
+
/** Whether to include audio in the output */
|
|
7706
|
+
audio?: boolean;
|
|
7707
|
+
/**
|
|
7708
|
+
* Starting timestamp for frame extraction or start time for clips. (e.g. '2s').
|
|
7709
|
+
*/
|
|
7710
|
+
time?: string;
|
|
7711
|
+
/**
|
|
7712
|
+
* Duration for video clips, audio extraction, and spritesheet generation (e.g. '5s').
|
|
7713
|
+
*/
|
|
7714
|
+
duration?: string;
|
|
7715
|
+
/**
|
|
7716
|
+
* Output format for the generated media.
|
|
7717
|
+
*/
|
|
7718
|
+
format?: "jpg" | "png" | "m4a";
|
|
7719
|
+
};
|
|
7720
|
+
/**
|
|
7721
|
+
* Error object for media transformation operations.
|
|
7722
|
+
* Extends the standard Error interface with additional media-specific information.
|
|
7723
|
+
*/
|
|
7724
|
+
export interface MediaError extends Error {
|
|
7725
|
+
readonly code: number;
|
|
7726
|
+
readonly message: string;
|
|
7727
|
+
readonly stack?: string;
|
|
7728
|
+
}
|
|
7624
7729
|
export type Params<P extends string = any> = Record<P, string | string[]>;
|
|
7625
7730
|
export type EventContext<Env, P extends string, Data> = {
|
|
7626
7731
|
request: Request<unknown, IncomingRequestCfProperties<unknown>>;
|
|
@@ -7971,21 +8076,17 @@ export declare namespace TailStream {
|
|
|
7971
8076
|
readonly tag?: string;
|
|
7972
8077
|
readonly message?: string;
|
|
7973
8078
|
}
|
|
7974
|
-
interface Trigger {
|
|
7975
|
-
readonly traceId: string;
|
|
7976
|
-
readonly invocationId: string;
|
|
7977
|
-
readonly spanId: string;
|
|
7978
|
-
}
|
|
7979
8079
|
interface Onset {
|
|
7980
8080
|
readonly type: "onset";
|
|
7981
8081
|
readonly attributes: Attribute[];
|
|
8082
|
+
// id for the span being opened by this Onset event.
|
|
8083
|
+
readonly spanId: string;
|
|
7982
8084
|
readonly dispatchNamespace?: string;
|
|
7983
8085
|
readonly entrypoint?: string;
|
|
7984
8086
|
readonly executionModel: string;
|
|
7985
8087
|
readonly scriptName?: string;
|
|
7986
8088
|
readonly scriptTags?: string[];
|
|
7987
8089
|
readonly scriptVersion?: ScriptVersion;
|
|
7988
|
-
readonly trigger?: Trigger;
|
|
7989
8090
|
readonly info:
|
|
7990
8091
|
| FetchEventInfo
|
|
7991
8092
|
| JsRpcEventInfo
|
|
@@ -8006,6 +8107,8 @@ export declare namespace TailStream {
|
|
|
8006
8107
|
interface SpanOpen {
|
|
8007
8108
|
readonly type: "spanOpen";
|
|
8008
8109
|
readonly name: string;
|
|
8110
|
+
// id for the span being opened by this SpanOpen event.
|
|
8111
|
+
readonly spanId: string;
|
|
8009
8112
|
readonly info?: FetchEventInfo | JsRpcEventInfo | Attributes;
|
|
8010
8113
|
}
|
|
8011
8114
|
interface SpanClose {
|
|
@@ -8028,6 +8131,10 @@ export declare namespace TailStream {
|
|
|
8028
8131
|
readonly level: "debug" | "error" | "info" | "log" | "warn";
|
|
8029
8132
|
readonly message: object;
|
|
8030
8133
|
}
|
|
8134
|
+
// This marks the worker handler return information.
|
|
8135
|
+
// This is separate from Outcome because the worker invocation can live for a long time after
|
|
8136
|
+
// returning. For example - Websockets that return an http upgrade response but then continue
|
|
8137
|
+
// streaming information or SSE http connections.
|
|
8031
8138
|
interface Return {
|
|
8032
8139
|
readonly type: "return";
|
|
8033
8140
|
readonly info?: FetchResponseInfo;
|
|
@@ -8058,9 +8165,28 @@ export declare namespace TailStream {
|
|
|
8058
8165
|
| Log
|
|
8059
8166
|
| Return
|
|
8060
8167
|
| Attributes;
|
|
8168
|
+
// Context in which this trace event lives.
|
|
8169
|
+
interface SpanContext {
|
|
8170
|
+
// Single id for the entire top-level invocation
|
|
8171
|
+
// This should be a new traceId for the first worker stage invoked in the eyeball request and then
|
|
8172
|
+
// same-account service-bindings should reuse the same traceId but cross-account service-bindings
|
|
8173
|
+
// should use a new traceId.
|
|
8174
|
+
readonly traceId: string;
|
|
8175
|
+
// spanId in which this event is handled
|
|
8176
|
+
// for Onset and SpanOpen events this would be the parent span id
|
|
8177
|
+
// for Outcome and SpanClose these this would be the span id of the opening Onset and SpanOpen events
|
|
8178
|
+
// For Hibernate and Mark this would be the span under which they were emitted.
|
|
8179
|
+
// spanId is not set ONLY if:
|
|
8180
|
+
// 1. This is an Onset event
|
|
8181
|
+
// 2. We are not inherting any SpanContext. (e.g. this is a cross-account service binding or a new top-level invocation)
|
|
8182
|
+
readonly spanId?: string;
|
|
8183
|
+
}
|
|
8061
8184
|
interface TailEvent<Event extends EventType> {
|
|
8185
|
+
// invocation id of the currently invoked worker stage.
|
|
8186
|
+
// invocation id will always be unique to every Onset event and will be the same until the Outcome event.
|
|
8062
8187
|
readonly invocationId: string;
|
|
8063
|
-
|
|
8188
|
+
// Inherited spanContext for this event.
|
|
8189
|
+
readonly spanContext: SpanContext;
|
|
8064
8190
|
readonly timestamp: Date;
|
|
8065
8191
|
readonly sequence: number;
|
|
8066
8192
|
readonly event: Event;
|
package/2022-11-30/index.d.ts
CHANGED
|
@@ -7539,6 +7539,7 @@ type ImageOutputOptions = {
|
|
|
7539
7539
|
| "rgba";
|
|
7540
7540
|
quality?: number;
|
|
7541
7541
|
background?: string;
|
|
7542
|
+
anim?: boolean;
|
|
7542
7543
|
};
|
|
7543
7544
|
interface ImagesBinding {
|
|
7544
7545
|
/**
|
|
@@ -7606,6 +7607,110 @@ interface ImagesError extends Error {
|
|
|
7606
7607
|
readonly message: string;
|
|
7607
7608
|
readonly stack?: string;
|
|
7608
7609
|
}
|
|
7610
|
+
/**
|
|
7611
|
+
* Media binding for transforming media streams.
|
|
7612
|
+
* Provides the entry point for media transformation operations.
|
|
7613
|
+
*/
|
|
7614
|
+
interface MediaBinding {
|
|
7615
|
+
/**
|
|
7616
|
+
* Creates a media transformer from an input stream.
|
|
7617
|
+
* @param media - The input media bytes
|
|
7618
|
+
* @returns A MediaTransformer instance for applying transformations
|
|
7619
|
+
*/
|
|
7620
|
+
input(media: ReadableStream<Uint8Array>): MediaTransformer;
|
|
7621
|
+
}
|
|
7622
|
+
/**
|
|
7623
|
+
* Media transformer for applying transformation operations to media content.
|
|
7624
|
+
* Handles sizing, fitting, and other input transformation parameters.
|
|
7625
|
+
*/
|
|
7626
|
+
interface MediaTransformer {
|
|
7627
|
+
/**
|
|
7628
|
+
* Applies transformation options to the media content.
|
|
7629
|
+
* @param transform - Configuration for how the media should be transformed
|
|
7630
|
+
* @returns A generator for producing the transformed media output
|
|
7631
|
+
*/
|
|
7632
|
+
transform(
|
|
7633
|
+
transform: MediaTransformationInputOptions,
|
|
7634
|
+
): MediaTransformationGenerator;
|
|
7635
|
+
}
|
|
7636
|
+
/**
|
|
7637
|
+
* Generator for producing media transformation results.
|
|
7638
|
+
* Configures the output format and parameters for the transformed media.
|
|
7639
|
+
*/
|
|
7640
|
+
interface MediaTransformationGenerator {
|
|
7641
|
+
/**
|
|
7642
|
+
* Generates the final media output with specified options.
|
|
7643
|
+
* @param output - Configuration for the output format and parameters
|
|
7644
|
+
* @returns The final transformation result containing the transformed media
|
|
7645
|
+
*/
|
|
7646
|
+
output(output: MediaTransformationOutputOptions): MediaTransformationResult;
|
|
7647
|
+
}
|
|
7648
|
+
/**
|
|
7649
|
+
* Result of a media transformation operation.
|
|
7650
|
+
* Provides multiple ways to access the transformed media content.
|
|
7651
|
+
*/
|
|
7652
|
+
interface MediaTransformationResult {
|
|
7653
|
+
/**
|
|
7654
|
+
* Returns the transformed media as a readable stream of bytes.
|
|
7655
|
+
* @returns A stream containing the transformed media data
|
|
7656
|
+
*/
|
|
7657
|
+
media(): ReadableStream<Uint8Array>;
|
|
7658
|
+
/**
|
|
7659
|
+
* Returns the transformed media as an HTTP response object.
|
|
7660
|
+
* @returns The transformed media as a Response, ready to store in cache or return to users
|
|
7661
|
+
*/
|
|
7662
|
+
response(): Response;
|
|
7663
|
+
/**
|
|
7664
|
+
* Returns the MIME type of the transformed media.
|
|
7665
|
+
* @returns The content type string (e.g., 'image/jpeg', 'video/mp4')
|
|
7666
|
+
*/
|
|
7667
|
+
contentType(): string;
|
|
7668
|
+
}
|
|
7669
|
+
/**
|
|
7670
|
+
* Configuration options for transforming media input.
|
|
7671
|
+
* Controls how the media should be resized and fitted.
|
|
7672
|
+
*/
|
|
7673
|
+
type MediaTransformationInputOptions = {
|
|
7674
|
+
/** How the media should be resized to fit the specified dimensions */
|
|
7675
|
+
fit?: "contain" | "cover" | "scale-down";
|
|
7676
|
+
/** Target width in pixels */
|
|
7677
|
+
width?: number;
|
|
7678
|
+
/** Target height in pixels */
|
|
7679
|
+
height?: number;
|
|
7680
|
+
};
|
|
7681
|
+
/**
|
|
7682
|
+
* Configuration options for Media Transformations output.
|
|
7683
|
+
* Controls the format, timing, and type of the generated output.
|
|
7684
|
+
*/
|
|
7685
|
+
type MediaTransformationOutputOptions = {
|
|
7686
|
+
/**
|
|
7687
|
+
* Output mode determining the type of media to generate
|
|
7688
|
+
*/
|
|
7689
|
+
mode?: "video" | "spritesheet" | "frame" | "audio";
|
|
7690
|
+
/** Whether to include audio in the output */
|
|
7691
|
+
audio?: boolean;
|
|
7692
|
+
/**
|
|
7693
|
+
* Starting timestamp for frame extraction or start time for clips. (e.g. '2s').
|
|
7694
|
+
*/
|
|
7695
|
+
time?: string;
|
|
7696
|
+
/**
|
|
7697
|
+
* Duration for video clips, audio extraction, and spritesheet generation (e.g. '5s').
|
|
7698
|
+
*/
|
|
7699
|
+
duration?: string;
|
|
7700
|
+
/**
|
|
7701
|
+
* Output format for the generated media.
|
|
7702
|
+
*/
|
|
7703
|
+
format?: "jpg" | "png" | "m4a";
|
|
7704
|
+
};
|
|
7705
|
+
/**
|
|
7706
|
+
* Error object for media transformation operations.
|
|
7707
|
+
* Extends the standard Error interface with additional media-specific information.
|
|
7708
|
+
*/
|
|
7709
|
+
interface MediaError extends Error {
|
|
7710
|
+
readonly code: number;
|
|
7711
|
+
readonly message: string;
|
|
7712
|
+
readonly stack?: string;
|
|
7713
|
+
}
|
|
7609
7714
|
type Params<P extends string = any> = Record<P, string | string[]>;
|
|
7610
7715
|
type EventContext<Env, P extends string, Data> = {
|
|
7611
7716
|
request: Request<unknown, IncomingRequestCfProperties<unknown>>;
|
|
@@ -8131,21 +8236,17 @@ declare namespace TailStream {
|
|
|
8131
8236
|
readonly tag?: string;
|
|
8132
8237
|
readonly message?: string;
|
|
8133
8238
|
}
|
|
8134
|
-
interface Trigger {
|
|
8135
|
-
readonly traceId: string;
|
|
8136
|
-
readonly invocationId: string;
|
|
8137
|
-
readonly spanId: string;
|
|
8138
|
-
}
|
|
8139
8239
|
interface Onset {
|
|
8140
8240
|
readonly type: "onset";
|
|
8141
8241
|
readonly attributes: Attribute[];
|
|
8242
|
+
// id for the span being opened by this Onset event.
|
|
8243
|
+
readonly spanId: string;
|
|
8142
8244
|
readonly dispatchNamespace?: string;
|
|
8143
8245
|
readonly entrypoint?: string;
|
|
8144
8246
|
readonly executionModel: string;
|
|
8145
8247
|
readonly scriptName?: string;
|
|
8146
8248
|
readonly scriptTags?: string[];
|
|
8147
8249
|
readonly scriptVersion?: ScriptVersion;
|
|
8148
|
-
readonly trigger?: Trigger;
|
|
8149
8250
|
readonly info:
|
|
8150
8251
|
| FetchEventInfo
|
|
8151
8252
|
| JsRpcEventInfo
|
|
@@ -8166,6 +8267,8 @@ declare namespace TailStream {
|
|
|
8166
8267
|
interface SpanOpen {
|
|
8167
8268
|
readonly type: "spanOpen";
|
|
8168
8269
|
readonly name: string;
|
|
8270
|
+
// id for the span being opened by this SpanOpen event.
|
|
8271
|
+
readonly spanId: string;
|
|
8169
8272
|
readonly info?: FetchEventInfo | JsRpcEventInfo | Attributes;
|
|
8170
8273
|
}
|
|
8171
8274
|
interface SpanClose {
|
|
@@ -8188,6 +8291,10 @@ declare namespace TailStream {
|
|
|
8188
8291
|
readonly level: "debug" | "error" | "info" | "log" | "warn";
|
|
8189
8292
|
readonly message: object;
|
|
8190
8293
|
}
|
|
8294
|
+
// This marks the worker handler return information.
|
|
8295
|
+
// This is separate from Outcome because the worker invocation can live for a long time after
|
|
8296
|
+
// returning. For example - Websockets that return an http upgrade response but then continue
|
|
8297
|
+
// streaming information or SSE http connections.
|
|
8191
8298
|
interface Return {
|
|
8192
8299
|
readonly type: "return";
|
|
8193
8300
|
readonly info?: FetchResponseInfo;
|
|
@@ -8218,9 +8325,28 @@ declare namespace TailStream {
|
|
|
8218
8325
|
| Log
|
|
8219
8326
|
| Return
|
|
8220
8327
|
| Attributes;
|
|
8328
|
+
// Context in which this trace event lives.
|
|
8329
|
+
interface SpanContext {
|
|
8330
|
+
// Single id for the entire top-level invocation
|
|
8331
|
+
// This should be a new traceId for the first worker stage invoked in the eyeball request and then
|
|
8332
|
+
// same-account service-bindings should reuse the same traceId but cross-account service-bindings
|
|
8333
|
+
// should use a new traceId.
|
|
8334
|
+
readonly traceId: string;
|
|
8335
|
+
// spanId in which this event is handled
|
|
8336
|
+
// for Onset and SpanOpen events this would be the parent span id
|
|
8337
|
+
// for Outcome and SpanClose these this would be the span id of the opening Onset and SpanOpen events
|
|
8338
|
+
// For Hibernate and Mark this would be the span under which they were emitted.
|
|
8339
|
+
// spanId is not set ONLY if:
|
|
8340
|
+
// 1. This is an Onset event
|
|
8341
|
+
// 2. We are not inherting any SpanContext. (e.g. this is a cross-account service binding or a new top-level invocation)
|
|
8342
|
+
readonly spanId?: string;
|
|
8343
|
+
}
|
|
8221
8344
|
interface TailEvent<Event extends EventType> {
|
|
8345
|
+
// invocation id of the currently invoked worker stage.
|
|
8346
|
+
// invocation id will always be unique to every Onset event and will be the same until the Outcome event.
|
|
8222
8347
|
readonly invocationId: string;
|
|
8223
|
-
|
|
8348
|
+
// Inherited spanContext for this event.
|
|
8349
|
+
readonly spanContext: SpanContext;
|
|
8224
8350
|
readonly timestamp: Date;
|
|
8225
8351
|
readonly sequence: number;
|
|
8226
8352
|
readonly event: Event;
|
package/2022-11-30/index.ts
CHANGED
|
@@ -7559,6 +7559,7 @@ export type ImageOutputOptions = {
|
|
|
7559
7559
|
| "rgba";
|
|
7560
7560
|
quality?: number;
|
|
7561
7561
|
background?: string;
|
|
7562
|
+
anim?: boolean;
|
|
7562
7563
|
};
|
|
7563
7564
|
export interface ImagesBinding {
|
|
7564
7565
|
/**
|
|
@@ -7626,6 +7627,110 @@ export interface ImagesError extends Error {
|
|
|
7626
7627
|
readonly message: string;
|
|
7627
7628
|
readonly stack?: string;
|
|
7628
7629
|
}
|
|
7630
|
+
/**
|
|
7631
|
+
* Media binding for transforming media streams.
|
|
7632
|
+
* Provides the entry point for media transformation operations.
|
|
7633
|
+
*/
|
|
7634
|
+
export interface MediaBinding {
|
|
7635
|
+
/**
|
|
7636
|
+
* Creates a media transformer from an input stream.
|
|
7637
|
+
* @param media - The input media bytes
|
|
7638
|
+
* @returns A MediaTransformer instance for applying transformations
|
|
7639
|
+
*/
|
|
7640
|
+
input(media: ReadableStream<Uint8Array>): MediaTransformer;
|
|
7641
|
+
}
|
|
7642
|
+
/**
|
|
7643
|
+
* Media transformer for applying transformation operations to media content.
|
|
7644
|
+
* Handles sizing, fitting, and other input transformation parameters.
|
|
7645
|
+
*/
|
|
7646
|
+
export interface MediaTransformer {
|
|
7647
|
+
/**
|
|
7648
|
+
* Applies transformation options to the media content.
|
|
7649
|
+
* @param transform - Configuration for how the media should be transformed
|
|
7650
|
+
* @returns A generator for producing the transformed media output
|
|
7651
|
+
*/
|
|
7652
|
+
transform(
|
|
7653
|
+
transform: MediaTransformationInputOptions,
|
|
7654
|
+
): MediaTransformationGenerator;
|
|
7655
|
+
}
|
|
7656
|
+
/**
|
|
7657
|
+
* Generator for producing media transformation results.
|
|
7658
|
+
* Configures the output format and parameters for the transformed media.
|
|
7659
|
+
*/
|
|
7660
|
+
export interface MediaTransformationGenerator {
|
|
7661
|
+
/**
|
|
7662
|
+
* Generates the final media output with specified options.
|
|
7663
|
+
* @param output - Configuration for the output format and parameters
|
|
7664
|
+
* @returns The final transformation result containing the transformed media
|
|
7665
|
+
*/
|
|
7666
|
+
output(output: MediaTransformationOutputOptions): MediaTransformationResult;
|
|
7667
|
+
}
|
|
7668
|
+
/**
|
|
7669
|
+
* Result of a media transformation operation.
|
|
7670
|
+
* Provides multiple ways to access the transformed media content.
|
|
7671
|
+
*/
|
|
7672
|
+
export interface MediaTransformationResult {
|
|
7673
|
+
/**
|
|
7674
|
+
* Returns the transformed media as a readable stream of bytes.
|
|
7675
|
+
* @returns A stream containing the transformed media data
|
|
7676
|
+
*/
|
|
7677
|
+
media(): ReadableStream<Uint8Array>;
|
|
7678
|
+
/**
|
|
7679
|
+
* Returns the transformed media as an HTTP response object.
|
|
7680
|
+
* @returns The transformed media as a Response, ready to store in cache or return to users
|
|
7681
|
+
*/
|
|
7682
|
+
response(): Response;
|
|
7683
|
+
/**
|
|
7684
|
+
* Returns the MIME type of the transformed media.
|
|
7685
|
+
* @returns The content type string (e.g., 'image/jpeg', 'video/mp4')
|
|
7686
|
+
*/
|
|
7687
|
+
contentType(): string;
|
|
7688
|
+
}
|
|
7689
|
+
/**
|
|
7690
|
+
* Configuration options for transforming media input.
|
|
7691
|
+
* Controls how the media should be resized and fitted.
|
|
7692
|
+
*/
|
|
7693
|
+
export type MediaTransformationInputOptions = {
|
|
7694
|
+
/** How the media should be resized to fit the specified dimensions */
|
|
7695
|
+
fit?: "contain" | "cover" | "scale-down";
|
|
7696
|
+
/** Target width in pixels */
|
|
7697
|
+
width?: number;
|
|
7698
|
+
/** Target height in pixels */
|
|
7699
|
+
height?: number;
|
|
7700
|
+
};
|
|
7701
|
+
/**
|
|
7702
|
+
* Configuration options for Media Transformations output.
|
|
7703
|
+
* Controls the format, timing, and type of the generated output.
|
|
7704
|
+
*/
|
|
7705
|
+
export type MediaTransformationOutputOptions = {
|
|
7706
|
+
/**
|
|
7707
|
+
* Output mode determining the type of media to generate
|
|
7708
|
+
*/
|
|
7709
|
+
mode?: "video" | "spritesheet" | "frame" | "audio";
|
|
7710
|
+
/** Whether to include audio in the output */
|
|
7711
|
+
audio?: boolean;
|
|
7712
|
+
/**
|
|
7713
|
+
* Starting timestamp for frame extraction or start time for clips. (e.g. '2s').
|
|
7714
|
+
*/
|
|
7715
|
+
time?: string;
|
|
7716
|
+
/**
|
|
7717
|
+
* Duration for video clips, audio extraction, and spritesheet generation (e.g. '5s').
|
|
7718
|
+
*/
|
|
7719
|
+
duration?: string;
|
|
7720
|
+
/**
|
|
7721
|
+
* Output format for the generated media.
|
|
7722
|
+
*/
|
|
7723
|
+
format?: "jpg" | "png" | "m4a";
|
|
7724
|
+
};
|
|
7725
|
+
/**
|
|
7726
|
+
* Error object for media transformation operations.
|
|
7727
|
+
* Extends the standard Error interface with additional media-specific information.
|
|
7728
|
+
*/
|
|
7729
|
+
export interface MediaError extends Error {
|
|
7730
|
+
readonly code: number;
|
|
7731
|
+
readonly message: string;
|
|
7732
|
+
readonly stack?: string;
|
|
7733
|
+
}
|
|
7629
7734
|
export type Params<P extends string = any> = Record<P, string | string[]>;
|
|
7630
7735
|
export type EventContext<Env, P extends string, Data> = {
|
|
7631
7736
|
request: Request<unknown, IncomingRequestCfProperties<unknown>>;
|
|
@@ -7976,21 +8081,17 @@ export declare namespace TailStream {
|
|
|
7976
8081
|
readonly tag?: string;
|
|
7977
8082
|
readonly message?: string;
|
|
7978
8083
|
}
|
|
7979
|
-
interface Trigger {
|
|
7980
|
-
readonly traceId: string;
|
|
7981
|
-
readonly invocationId: string;
|
|
7982
|
-
readonly spanId: string;
|
|
7983
|
-
}
|
|
7984
8084
|
interface Onset {
|
|
7985
8085
|
readonly type: "onset";
|
|
7986
8086
|
readonly attributes: Attribute[];
|
|
8087
|
+
// id for the span being opened by this Onset event.
|
|
8088
|
+
readonly spanId: string;
|
|
7987
8089
|
readonly dispatchNamespace?: string;
|
|
7988
8090
|
readonly entrypoint?: string;
|
|
7989
8091
|
readonly executionModel: string;
|
|
7990
8092
|
readonly scriptName?: string;
|
|
7991
8093
|
readonly scriptTags?: string[];
|
|
7992
8094
|
readonly scriptVersion?: ScriptVersion;
|
|
7993
|
-
readonly trigger?: Trigger;
|
|
7994
8095
|
readonly info:
|
|
7995
8096
|
| FetchEventInfo
|
|
7996
8097
|
| JsRpcEventInfo
|
|
@@ -8011,6 +8112,8 @@ export declare namespace TailStream {
|
|
|
8011
8112
|
interface SpanOpen {
|
|
8012
8113
|
readonly type: "spanOpen";
|
|
8013
8114
|
readonly name: string;
|
|
8115
|
+
// id for the span being opened by this SpanOpen event.
|
|
8116
|
+
readonly spanId: string;
|
|
8014
8117
|
readonly info?: FetchEventInfo | JsRpcEventInfo | Attributes;
|
|
8015
8118
|
}
|
|
8016
8119
|
interface SpanClose {
|
|
@@ -8033,6 +8136,10 @@ export declare namespace TailStream {
|
|
|
8033
8136
|
readonly level: "debug" | "error" | "info" | "log" | "warn";
|
|
8034
8137
|
readonly message: object;
|
|
8035
8138
|
}
|
|
8139
|
+
// This marks the worker handler return information.
|
|
8140
|
+
// This is separate from Outcome because the worker invocation can live for a long time after
|
|
8141
|
+
// returning. For example - Websockets that return an http upgrade response but then continue
|
|
8142
|
+
// streaming information or SSE http connections.
|
|
8036
8143
|
interface Return {
|
|
8037
8144
|
readonly type: "return";
|
|
8038
8145
|
readonly info?: FetchResponseInfo;
|
|
@@ -8063,9 +8170,28 @@ export declare namespace TailStream {
|
|
|
8063
8170
|
| Log
|
|
8064
8171
|
| Return
|
|
8065
8172
|
| Attributes;
|
|
8173
|
+
// Context in which this trace event lives.
|
|
8174
|
+
interface SpanContext {
|
|
8175
|
+
// Single id for the entire top-level invocation
|
|
8176
|
+
// This should be a new traceId for the first worker stage invoked in the eyeball request and then
|
|
8177
|
+
// same-account service-bindings should reuse the same traceId but cross-account service-bindings
|
|
8178
|
+
// should use a new traceId.
|
|
8179
|
+
readonly traceId: string;
|
|
8180
|
+
// spanId in which this event is handled
|
|
8181
|
+
// for Onset and SpanOpen events this would be the parent span id
|
|
8182
|
+
// for Outcome and SpanClose these this would be the span id of the opening Onset and SpanOpen events
|
|
8183
|
+
// For Hibernate and Mark this would be the span under which they were emitted.
|
|
8184
|
+
// spanId is not set ONLY if:
|
|
8185
|
+
// 1. This is an Onset event
|
|
8186
|
+
// 2. We are not inherting any SpanContext. (e.g. this is a cross-account service binding or a new top-level invocation)
|
|
8187
|
+
readonly spanId?: string;
|
|
8188
|
+
}
|
|
8066
8189
|
interface TailEvent<Event extends EventType> {
|
|
8190
|
+
// invocation id of the currently invoked worker stage.
|
|
8191
|
+
// invocation id will always be unique to every Onset event and will be the same until the Outcome event.
|
|
8067
8192
|
readonly invocationId: string;
|
|
8068
|
-
|
|
8193
|
+
// Inherited spanContext for this event.
|
|
8194
|
+
readonly spanContext: SpanContext;
|
|
8069
8195
|
readonly timestamp: Date;
|
|
8070
8196
|
readonly sequence: number;
|
|
8071
8197
|
readonly event: Event;
|