@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/index.d.ts
CHANGED
|
@@ -7485,6 +7485,7 @@ type ImageOutputOptions = {
|
|
|
7485
7485
|
| "rgba";
|
|
7486
7486
|
quality?: number;
|
|
7487
7487
|
background?: string;
|
|
7488
|
+
anim?: boolean;
|
|
7488
7489
|
};
|
|
7489
7490
|
interface ImagesBinding {
|
|
7490
7491
|
/**
|
|
@@ -7552,6 +7553,110 @@ interface ImagesError extends Error {
|
|
|
7552
7553
|
readonly message: string;
|
|
7553
7554
|
readonly stack?: string;
|
|
7554
7555
|
}
|
|
7556
|
+
/**
|
|
7557
|
+
* Media binding for transforming media streams.
|
|
7558
|
+
* Provides the entry point for media transformation operations.
|
|
7559
|
+
*/
|
|
7560
|
+
interface MediaBinding {
|
|
7561
|
+
/**
|
|
7562
|
+
* Creates a media transformer from an input stream.
|
|
7563
|
+
* @param media - The input media bytes
|
|
7564
|
+
* @returns A MediaTransformer instance for applying transformations
|
|
7565
|
+
*/
|
|
7566
|
+
input(media: ReadableStream<Uint8Array>): MediaTransformer;
|
|
7567
|
+
}
|
|
7568
|
+
/**
|
|
7569
|
+
* Media transformer for applying transformation operations to media content.
|
|
7570
|
+
* Handles sizing, fitting, and other input transformation parameters.
|
|
7571
|
+
*/
|
|
7572
|
+
interface MediaTransformer {
|
|
7573
|
+
/**
|
|
7574
|
+
* Applies transformation options to the media content.
|
|
7575
|
+
* @param transform - Configuration for how the media should be transformed
|
|
7576
|
+
* @returns A generator for producing the transformed media output
|
|
7577
|
+
*/
|
|
7578
|
+
transform(
|
|
7579
|
+
transform: MediaTransformationInputOptions,
|
|
7580
|
+
): MediaTransformationGenerator;
|
|
7581
|
+
}
|
|
7582
|
+
/**
|
|
7583
|
+
* Generator for producing media transformation results.
|
|
7584
|
+
* Configures the output format and parameters for the transformed media.
|
|
7585
|
+
*/
|
|
7586
|
+
interface MediaTransformationGenerator {
|
|
7587
|
+
/**
|
|
7588
|
+
* Generates the final media output with specified options.
|
|
7589
|
+
* @param output - Configuration for the output format and parameters
|
|
7590
|
+
* @returns The final transformation result containing the transformed media
|
|
7591
|
+
*/
|
|
7592
|
+
output(output: MediaTransformationOutputOptions): MediaTransformationResult;
|
|
7593
|
+
}
|
|
7594
|
+
/**
|
|
7595
|
+
* Result of a media transformation operation.
|
|
7596
|
+
* Provides multiple ways to access the transformed media content.
|
|
7597
|
+
*/
|
|
7598
|
+
interface MediaTransformationResult {
|
|
7599
|
+
/**
|
|
7600
|
+
* Returns the transformed media as a readable stream of bytes.
|
|
7601
|
+
* @returns A stream containing the transformed media data
|
|
7602
|
+
*/
|
|
7603
|
+
media(): ReadableStream<Uint8Array>;
|
|
7604
|
+
/**
|
|
7605
|
+
* Returns the transformed media as an HTTP response object.
|
|
7606
|
+
* @returns The transformed media as a Response, ready to store in cache or return to users
|
|
7607
|
+
*/
|
|
7608
|
+
response(): Response;
|
|
7609
|
+
/**
|
|
7610
|
+
* Returns the MIME type of the transformed media.
|
|
7611
|
+
* @returns The content type string (e.g., 'image/jpeg', 'video/mp4')
|
|
7612
|
+
*/
|
|
7613
|
+
contentType(): string;
|
|
7614
|
+
}
|
|
7615
|
+
/**
|
|
7616
|
+
* Configuration options for transforming media input.
|
|
7617
|
+
* Controls how the media should be resized and fitted.
|
|
7618
|
+
*/
|
|
7619
|
+
type MediaTransformationInputOptions = {
|
|
7620
|
+
/** How the media should be resized to fit the specified dimensions */
|
|
7621
|
+
fit?: "contain" | "cover" | "scale-down";
|
|
7622
|
+
/** Target width in pixels */
|
|
7623
|
+
width?: number;
|
|
7624
|
+
/** Target height in pixels */
|
|
7625
|
+
height?: number;
|
|
7626
|
+
};
|
|
7627
|
+
/**
|
|
7628
|
+
* Configuration options for Media Transformations output.
|
|
7629
|
+
* Controls the format, timing, and type of the generated output.
|
|
7630
|
+
*/
|
|
7631
|
+
type MediaTransformationOutputOptions = {
|
|
7632
|
+
/**
|
|
7633
|
+
* Output mode determining the type of media to generate
|
|
7634
|
+
*/
|
|
7635
|
+
mode?: "video" | "spritesheet" | "frame" | "audio";
|
|
7636
|
+
/** Whether to include audio in the output */
|
|
7637
|
+
audio?: boolean;
|
|
7638
|
+
/**
|
|
7639
|
+
* Starting timestamp for frame extraction or start time for clips. (e.g. '2s').
|
|
7640
|
+
*/
|
|
7641
|
+
time?: string;
|
|
7642
|
+
/**
|
|
7643
|
+
* Duration for video clips, audio extraction, and spritesheet generation (e.g. '5s').
|
|
7644
|
+
*/
|
|
7645
|
+
duration?: string;
|
|
7646
|
+
/**
|
|
7647
|
+
* Output format for the generated media.
|
|
7648
|
+
*/
|
|
7649
|
+
format?: "jpg" | "png" | "m4a";
|
|
7650
|
+
};
|
|
7651
|
+
/**
|
|
7652
|
+
* Error object for media transformation operations.
|
|
7653
|
+
* Extends the standard Error interface with additional media-specific information.
|
|
7654
|
+
*/
|
|
7655
|
+
interface MediaError extends Error {
|
|
7656
|
+
readonly code: number;
|
|
7657
|
+
readonly message: string;
|
|
7658
|
+
readonly stack?: string;
|
|
7659
|
+
}
|
|
7555
7660
|
type Params<P extends string = any> = Record<P, string | string[]>;
|
|
7556
7661
|
type EventContext<Env, P extends string, Data> = {
|
|
7557
7662
|
request: Request<unknown, IncomingRequestCfProperties<unknown>>;
|
|
@@ -8077,21 +8182,17 @@ declare namespace TailStream {
|
|
|
8077
8182
|
readonly tag?: string;
|
|
8078
8183
|
readonly message?: string;
|
|
8079
8184
|
}
|
|
8080
|
-
interface Trigger {
|
|
8081
|
-
readonly traceId: string;
|
|
8082
|
-
readonly invocationId: string;
|
|
8083
|
-
readonly spanId: string;
|
|
8084
|
-
}
|
|
8085
8185
|
interface Onset {
|
|
8086
8186
|
readonly type: "onset";
|
|
8087
8187
|
readonly attributes: Attribute[];
|
|
8188
|
+
// id for the span being opened by this Onset event.
|
|
8189
|
+
readonly spanId: string;
|
|
8088
8190
|
readonly dispatchNamespace?: string;
|
|
8089
8191
|
readonly entrypoint?: string;
|
|
8090
8192
|
readonly executionModel: string;
|
|
8091
8193
|
readonly scriptName?: string;
|
|
8092
8194
|
readonly scriptTags?: string[];
|
|
8093
8195
|
readonly scriptVersion?: ScriptVersion;
|
|
8094
|
-
readonly trigger?: Trigger;
|
|
8095
8196
|
readonly info:
|
|
8096
8197
|
| FetchEventInfo
|
|
8097
8198
|
| JsRpcEventInfo
|
|
@@ -8112,6 +8213,8 @@ declare namespace TailStream {
|
|
|
8112
8213
|
interface SpanOpen {
|
|
8113
8214
|
readonly type: "spanOpen";
|
|
8114
8215
|
readonly name: string;
|
|
8216
|
+
// id for the span being opened by this SpanOpen event.
|
|
8217
|
+
readonly spanId: string;
|
|
8115
8218
|
readonly info?: FetchEventInfo | JsRpcEventInfo | Attributes;
|
|
8116
8219
|
}
|
|
8117
8220
|
interface SpanClose {
|
|
@@ -8134,6 +8237,10 @@ declare namespace TailStream {
|
|
|
8134
8237
|
readonly level: "debug" | "error" | "info" | "log" | "warn";
|
|
8135
8238
|
readonly message: object;
|
|
8136
8239
|
}
|
|
8240
|
+
// This marks the worker handler return information.
|
|
8241
|
+
// This is separate from Outcome because the worker invocation can live for a long time after
|
|
8242
|
+
// returning. For example - Websockets that return an http upgrade response but then continue
|
|
8243
|
+
// streaming information or SSE http connections.
|
|
8137
8244
|
interface Return {
|
|
8138
8245
|
readonly type: "return";
|
|
8139
8246
|
readonly info?: FetchResponseInfo;
|
|
@@ -8164,9 +8271,28 @@ declare namespace TailStream {
|
|
|
8164
8271
|
| Log
|
|
8165
8272
|
| Return
|
|
8166
8273
|
| Attributes;
|
|
8274
|
+
// Context in which this trace event lives.
|
|
8275
|
+
interface SpanContext {
|
|
8276
|
+
// Single id for the entire top-level invocation
|
|
8277
|
+
// This should be a new traceId for the first worker stage invoked in the eyeball request and then
|
|
8278
|
+
// same-account service-bindings should reuse the same traceId but cross-account service-bindings
|
|
8279
|
+
// should use a new traceId.
|
|
8280
|
+
readonly traceId: string;
|
|
8281
|
+
// spanId in which this event is handled
|
|
8282
|
+
// for Onset and SpanOpen events this would be the parent span id
|
|
8283
|
+
// for Outcome and SpanClose these this would be the span id of the opening Onset and SpanOpen events
|
|
8284
|
+
// For Hibernate and Mark this would be the span under which they were emitted.
|
|
8285
|
+
// spanId is not set ONLY if:
|
|
8286
|
+
// 1. This is an Onset event
|
|
8287
|
+
// 2. We are not inherting any SpanContext. (e.g. this is a cross-account service binding or a new top-level invocation)
|
|
8288
|
+
readonly spanId?: string;
|
|
8289
|
+
}
|
|
8167
8290
|
interface TailEvent<Event extends EventType> {
|
|
8291
|
+
// invocation id of the currently invoked worker stage.
|
|
8292
|
+
// invocation id will always be unique to every Onset event and will be the same until the Outcome event.
|
|
8168
8293
|
readonly invocationId: string;
|
|
8169
|
-
|
|
8294
|
+
// Inherited spanContext for this event.
|
|
8295
|
+
readonly spanContext: SpanContext;
|
|
8170
8296
|
readonly timestamp: Date;
|
|
8171
8297
|
readonly sequence: number;
|
|
8172
8298
|
readonly event: Event;
|
package/index.ts
CHANGED
|
@@ -7505,6 +7505,7 @@ export type ImageOutputOptions = {
|
|
|
7505
7505
|
| "rgba";
|
|
7506
7506
|
quality?: number;
|
|
7507
7507
|
background?: string;
|
|
7508
|
+
anim?: boolean;
|
|
7508
7509
|
};
|
|
7509
7510
|
export interface ImagesBinding {
|
|
7510
7511
|
/**
|
|
@@ -7572,6 +7573,110 @@ export interface ImagesError extends Error {
|
|
|
7572
7573
|
readonly message: string;
|
|
7573
7574
|
readonly stack?: string;
|
|
7574
7575
|
}
|
|
7576
|
+
/**
|
|
7577
|
+
* Media binding for transforming media streams.
|
|
7578
|
+
* Provides the entry point for media transformation operations.
|
|
7579
|
+
*/
|
|
7580
|
+
export interface MediaBinding {
|
|
7581
|
+
/**
|
|
7582
|
+
* Creates a media transformer from an input stream.
|
|
7583
|
+
* @param media - The input media bytes
|
|
7584
|
+
* @returns A MediaTransformer instance for applying transformations
|
|
7585
|
+
*/
|
|
7586
|
+
input(media: ReadableStream<Uint8Array>): MediaTransformer;
|
|
7587
|
+
}
|
|
7588
|
+
/**
|
|
7589
|
+
* Media transformer for applying transformation operations to media content.
|
|
7590
|
+
* Handles sizing, fitting, and other input transformation parameters.
|
|
7591
|
+
*/
|
|
7592
|
+
export interface MediaTransformer {
|
|
7593
|
+
/**
|
|
7594
|
+
* Applies transformation options to the media content.
|
|
7595
|
+
* @param transform - Configuration for how the media should be transformed
|
|
7596
|
+
* @returns A generator for producing the transformed media output
|
|
7597
|
+
*/
|
|
7598
|
+
transform(
|
|
7599
|
+
transform: MediaTransformationInputOptions,
|
|
7600
|
+
): MediaTransformationGenerator;
|
|
7601
|
+
}
|
|
7602
|
+
/**
|
|
7603
|
+
* Generator for producing media transformation results.
|
|
7604
|
+
* Configures the output format and parameters for the transformed media.
|
|
7605
|
+
*/
|
|
7606
|
+
export interface MediaTransformationGenerator {
|
|
7607
|
+
/**
|
|
7608
|
+
* Generates the final media output with specified options.
|
|
7609
|
+
* @param output - Configuration for the output format and parameters
|
|
7610
|
+
* @returns The final transformation result containing the transformed media
|
|
7611
|
+
*/
|
|
7612
|
+
output(output: MediaTransformationOutputOptions): MediaTransformationResult;
|
|
7613
|
+
}
|
|
7614
|
+
/**
|
|
7615
|
+
* Result of a media transformation operation.
|
|
7616
|
+
* Provides multiple ways to access the transformed media content.
|
|
7617
|
+
*/
|
|
7618
|
+
export interface MediaTransformationResult {
|
|
7619
|
+
/**
|
|
7620
|
+
* Returns the transformed media as a readable stream of bytes.
|
|
7621
|
+
* @returns A stream containing the transformed media data
|
|
7622
|
+
*/
|
|
7623
|
+
media(): ReadableStream<Uint8Array>;
|
|
7624
|
+
/**
|
|
7625
|
+
* Returns the transformed media as an HTTP response object.
|
|
7626
|
+
* @returns The transformed media as a Response, ready to store in cache or return to users
|
|
7627
|
+
*/
|
|
7628
|
+
response(): Response;
|
|
7629
|
+
/**
|
|
7630
|
+
* Returns the MIME type of the transformed media.
|
|
7631
|
+
* @returns The content type string (e.g., 'image/jpeg', 'video/mp4')
|
|
7632
|
+
*/
|
|
7633
|
+
contentType(): string;
|
|
7634
|
+
}
|
|
7635
|
+
/**
|
|
7636
|
+
* Configuration options for transforming media input.
|
|
7637
|
+
* Controls how the media should be resized and fitted.
|
|
7638
|
+
*/
|
|
7639
|
+
export type MediaTransformationInputOptions = {
|
|
7640
|
+
/** How the media should be resized to fit the specified dimensions */
|
|
7641
|
+
fit?: "contain" | "cover" | "scale-down";
|
|
7642
|
+
/** Target width in pixels */
|
|
7643
|
+
width?: number;
|
|
7644
|
+
/** Target height in pixels */
|
|
7645
|
+
height?: number;
|
|
7646
|
+
};
|
|
7647
|
+
/**
|
|
7648
|
+
* Configuration options for Media Transformations output.
|
|
7649
|
+
* Controls the format, timing, and type of the generated output.
|
|
7650
|
+
*/
|
|
7651
|
+
export type MediaTransformationOutputOptions = {
|
|
7652
|
+
/**
|
|
7653
|
+
* Output mode determining the type of media to generate
|
|
7654
|
+
*/
|
|
7655
|
+
mode?: "video" | "spritesheet" | "frame" | "audio";
|
|
7656
|
+
/** Whether to include audio in the output */
|
|
7657
|
+
audio?: boolean;
|
|
7658
|
+
/**
|
|
7659
|
+
* Starting timestamp for frame extraction or start time for clips. (e.g. '2s').
|
|
7660
|
+
*/
|
|
7661
|
+
time?: string;
|
|
7662
|
+
/**
|
|
7663
|
+
* Duration for video clips, audio extraction, and spritesheet generation (e.g. '5s').
|
|
7664
|
+
*/
|
|
7665
|
+
duration?: string;
|
|
7666
|
+
/**
|
|
7667
|
+
* Output format for the generated media.
|
|
7668
|
+
*/
|
|
7669
|
+
format?: "jpg" | "png" | "m4a";
|
|
7670
|
+
};
|
|
7671
|
+
/**
|
|
7672
|
+
* Error object for media transformation operations.
|
|
7673
|
+
* Extends the standard Error interface with additional media-specific information.
|
|
7674
|
+
*/
|
|
7675
|
+
export interface MediaError extends Error {
|
|
7676
|
+
readonly code: number;
|
|
7677
|
+
readonly message: string;
|
|
7678
|
+
readonly stack?: string;
|
|
7679
|
+
}
|
|
7575
7680
|
export type Params<P extends string = any> = Record<P, string | string[]>;
|
|
7576
7681
|
export type EventContext<Env, P extends string, Data> = {
|
|
7577
7682
|
request: Request<unknown, IncomingRequestCfProperties<unknown>>;
|
|
@@ -7922,21 +8027,17 @@ export declare namespace TailStream {
|
|
|
7922
8027
|
readonly tag?: string;
|
|
7923
8028
|
readonly message?: string;
|
|
7924
8029
|
}
|
|
7925
|
-
interface Trigger {
|
|
7926
|
-
readonly traceId: string;
|
|
7927
|
-
readonly invocationId: string;
|
|
7928
|
-
readonly spanId: string;
|
|
7929
|
-
}
|
|
7930
8030
|
interface Onset {
|
|
7931
8031
|
readonly type: "onset";
|
|
7932
8032
|
readonly attributes: Attribute[];
|
|
8033
|
+
// id for the span being opened by this Onset event.
|
|
8034
|
+
readonly spanId: string;
|
|
7933
8035
|
readonly dispatchNamespace?: string;
|
|
7934
8036
|
readonly entrypoint?: string;
|
|
7935
8037
|
readonly executionModel: string;
|
|
7936
8038
|
readonly scriptName?: string;
|
|
7937
8039
|
readonly scriptTags?: string[];
|
|
7938
8040
|
readonly scriptVersion?: ScriptVersion;
|
|
7939
|
-
readonly trigger?: Trigger;
|
|
7940
8041
|
readonly info:
|
|
7941
8042
|
| FetchEventInfo
|
|
7942
8043
|
| JsRpcEventInfo
|
|
@@ -7957,6 +8058,8 @@ export declare namespace TailStream {
|
|
|
7957
8058
|
interface SpanOpen {
|
|
7958
8059
|
readonly type: "spanOpen";
|
|
7959
8060
|
readonly name: string;
|
|
8061
|
+
// id for the span being opened by this SpanOpen event.
|
|
8062
|
+
readonly spanId: string;
|
|
7960
8063
|
readonly info?: FetchEventInfo | JsRpcEventInfo | Attributes;
|
|
7961
8064
|
}
|
|
7962
8065
|
interface SpanClose {
|
|
@@ -7979,6 +8082,10 @@ export declare namespace TailStream {
|
|
|
7979
8082
|
readonly level: "debug" | "error" | "info" | "log" | "warn";
|
|
7980
8083
|
readonly message: object;
|
|
7981
8084
|
}
|
|
8085
|
+
// This marks the worker handler return information.
|
|
8086
|
+
// This is separate from Outcome because the worker invocation can live for a long time after
|
|
8087
|
+
// returning. For example - Websockets that return an http upgrade response but then continue
|
|
8088
|
+
// streaming information or SSE http connections.
|
|
7982
8089
|
interface Return {
|
|
7983
8090
|
readonly type: "return";
|
|
7984
8091
|
readonly info?: FetchResponseInfo;
|
|
@@ -8009,9 +8116,28 @@ export declare namespace TailStream {
|
|
|
8009
8116
|
| Log
|
|
8010
8117
|
| Return
|
|
8011
8118
|
| Attributes;
|
|
8119
|
+
// Context in which this trace event lives.
|
|
8120
|
+
interface SpanContext {
|
|
8121
|
+
// Single id for the entire top-level invocation
|
|
8122
|
+
// This should be a new traceId for the first worker stage invoked in the eyeball request and then
|
|
8123
|
+
// same-account service-bindings should reuse the same traceId but cross-account service-bindings
|
|
8124
|
+
// should use a new traceId.
|
|
8125
|
+
readonly traceId: string;
|
|
8126
|
+
// spanId in which this event is handled
|
|
8127
|
+
// for Onset and SpanOpen events this would be the parent span id
|
|
8128
|
+
// for Outcome and SpanClose these this would be the span id of the opening Onset and SpanOpen events
|
|
8129
|
+
// For Hibernate and Mark this would be the span under which they were emitted.
|
|
8130
|
+
// spanId is not set ONLY if:
|
|
8131
|
+
// 1. This is an Onset event
|
|
8132
|
+
// 2. We are not inherting any SpanContext. (e.g. this is a cross-account service binding or a new top-level invocation)
|
|
8133
|
+
readonly spanId?: string;
|
|
8134
|
+
}
|
|
8012
8135
|
interface TailEvent<Event extends EventType> {
|
|
8136
|
+
// invocation id of the currently invoked worker stage.
|
|
8137
|
+
// invocation id will always be unique to every Onset event and will be the same until the Outcome event.
|
|
8013
8138
|
readonly invocationId: string;
|
|
8014
|
-
|
|
8139
|
+
// Inherited spanContext for this event.
|
|
8140
|
+
readonly spanContext: SpanContext;
|
|
8015
8141
|
readonly timestamp: Date;
|
|
8016
8142
|
readonly sequence: number;
|
|
8017
8143
|
readonly event: Event;
|
package/latest/index.d.ts
CHANGED
|
@@ -7570,6 +7570,7 @@ type ImageOutputOptions = {
|
|
|
7570
7570
|
| "rgba";
|
|
7571
7571
|
quality?: number;
|
|
7572
7572
|
background?: string;
|
|
7573
|
+
anim?: boolean;
|
|
7573
7574
|
};
|
|
7574
7575
|
interface ImagesBinding {
|
|
7575
7576
|
/**
|
|
@@ -7637,6 +7638,110 @@ interface ImagesError extends Error {
|
|
|
7637
7638
|
readonly message: string;
|
|
7638
7639
|
readonly stack?: string;
|
|
7639
7640
|
}
|
|
7641
|
+
/**
|
|
7642
|
+
* Media binding for transforming media streams.
|
|
7643
|
+
* Provides the entry point for media transformation operations.
|
|
7644
|
+
*/
|
|
7645
|
+
interface MediaBinding {
|
|
7646
|
+
/**
|
|
7647
|
+
* Creates a media transformer from an input stream.
|
|
7648
|
+
* @param media - The input media bytes
|
|
7649
|
+
* @returns A MediaTransformer instance for applying transformations
|
|
7650
|
+
*/
|
|
7651
|
+
input(media: ReadableStream<Uint8Array>): MediaTransformer;
|
|
7652
|
+
}
|
|
7653
|
+
/**
|
|
7654
|
+
* Media transformer for applying transformation operations to media content.
|
|
7655
|
+
* Handles sizing, fitting, and other input transformation parameters.
|
|
7656
|
+
*/
|
|
7657
|
+
interface MediaTransformer {
|
|
7658
|
+
/**
|
|
7659
|
+
* Applies transformation options to the media content.
|
|
7660
|
+
* @param transform - Configuration for how the media should be transformed
|
|
7661
|
+
* @returns A generator for producing the transformed media output
|
|
7662
|
+
*/
|
|
7663
|
+
transform(
|
|
7664
|
+
transform: MediaTransformationInputOptions,
|
|
7665
|
+
): MediaTransformationGenerator;
|
|
7666
|
+
}
|
|
7667
|
+
/**
|
|
7668
|
+
* Generator for producing media transformation results.
|
|
7669
|
+
* Configures the output format and parameters for the transformed media.
|
|
7670
|
+
*/
|
|
7671
|
+
interface MediaTransformationGenerator {
|
|
7672
|
+
/**
|
|
7673
|
+
* Generates the final media output with specified options.
|
|
7674
|
+
* @param output - Configuration for the output format and parameters
|
|
7675
|
+
* @returns The final transformation result containing the transformed media
|
|
7676
|
+
*/
|
|
7677
|
+
output(output: MediaTransformationOutputOptions): MediaTransformationResult;
|
|
7678
|
+
}
|
|
7679
|
+
/**
|
|
7680
|
+
* Result of a media transformation operation.
|
|
7681
|
+
* Provides multiple ways to access the transformed media content.
|
|
7682
|
+
*/
|
|
7683
|
+
interface MediaTransformationResult {
|
|
7684
|
+
/**
|
|
7685
|
+
* Returns the transformed media as a readable stream of bytes.
|
|
7686
|
+
* @returns A stream containing the transformed media data
|
|
7687
|
+
*/
|
|
7688
|
+
media(): ReadableStream<Uint8Array>;
|
|
7689
|
+
/**
|
|
7690
|
+
* Returns the transformed media as an HTTP response object.
|
|
7691
|
+
* @returns The transformed media as a Response, ready to store in cache or return to users
|
|
7692
|
+
*/
|
|
7693
|
+
response(): Response;
|
|
7694
|
+
/**
|
|
7695
|
+
* Returns the MIME type of the transformed media.
|
|
7696
|
+
* @returns The content type string (e.g., 'image/jpeg', 'video/mp4')
|
|
7697
|
+
*/
|
|
7698
|
+
contentType(): string;
|
|
7699
|
+
}
|
|
7700
|
+
/**
|
|
7701
|
+
* Configuration options for transforming media input.
|
|
7702
|
+
* Controls how the media should be resized and fitted.
|
|
7703
|
+
*/
|
|
7704
|
+
type MediaTransformationInputOptions = {
|
|
7705
|
+
/** How the media should be resized to fit the specified dimensions */
|
|
7706
|
+
fit?: "contain" | "cover" | "scale-down";
|
|
7707
|
+
/** Target width in pixels */
|
|
7708
|
+
width?: number;
|
|
7709
|
+
/** Target height in pixels */
|
|
7710
|
+
height?: number;
|
|
7711
|
+
};
|
|
7712
|
+
/**
|
|
7713
|
+
* Configuration options for Media Transformations output.
|
|
7714
|
+
* Controls the format, timing, and type of the generated output.
|
|
7715
|
+
*/
|
|
7716
|
+
type MediaTransformationOutputOptions = {
|
|
7717
|
+
/**
|
|
7718
|
+
* Output mode determining the type of media to generate
|
|
7719
|
+
*/
|
|
7720
|
+
mode?: "video" | "spritesheet" | "frame" | "audio";
|
|
7721
|
+
/** Whether to include audio in the output */
|
|
7722
|
+
audio?: boolean;
|
|
7723
|
+
/**
|
|
7724
|
+
* Starting timestamp for frame extraction or start time for clips. (e.g. '2s').
|
|
7725
|
+
*/
|
|
7726
|
+
time?: string;
|
|
7727
|
+
/**
|
|
7728
|
+
* Duration for video clips, audio extraction, and spritesheet generation (e.g. '5s').
|
|
7729
|
+
*/
|
|
7730
|
+
duration?: string;
|
|
7731
|
+
/**
|
|
7732
|
+
* Output format for the generated media.
|
|
7733
|
+
*/
|
|
7734
|
+
format?: "jpg" | "png" | "m4a";
|
|
7735
|
+
};
|
|
7736
|
+
/**
|
|
7737
|
+
* Error object for media transformation operations.
|
|
7738
|
+
* Extends the standard Error interface with additional media-specific information.
|
|
7739
|
+
*/
|
|
7740
|
+
interface MediaError extends Error {
|
|
7741
|
+
readonly code: number;
|
|
7742
|
+
readonly message: string;
|
|
7743
|
+
readonly stack?: string;
|
|
7744
|
+
}
|
|
7640
7745
|
type Params<P extends string = any> = Record<P, string | string[]>;
|
|
7641
7746
|
type EventContext<Env, P extends string, Data> = {
|
|
7642
7747
|
request: Request<unknown, IncomingRequestCfProperties<unknown>>;
|
|
@@ -8162,21 +8267,17 @@ declare namespace TailStream {
|
|
|
8162
8267
|
readonly tag?: string;
|
|
8163
8268
|
readonly message?: string;
|
|
8164
8269
|
}
|
|
8165
|
-
interface Trigger {
|
|
8166
|
-
readonly traceId: string;
|
|
8167
|
-
readonly invocationId: string;
|
|
8168
|
-
readonly spanId: string;
|
|
8169
|
-
}
|
|
8170
8270
|
interface Onset {
|
|
8171
8271
|
readonly type: "onset";
|
|
8172
8272
|
readonly attributes: Attribute[];
|
|
8273
|
+
// id for the span being opened by this Onset event.
|
|
8274
|
+
readonly spanId: string;
|
|
8173
8275
|
readonly dispatchNamespace?: string;
|
|
8174
8276
|
readonly entrypoint?: string;
|
|
8175
8277
|
readonly executionModel: string;
|
|
8176
8278
|
readonly scriptName?: string;
|
|
8177
8279
|
readonly scriptTags?: string[];
|
|
8178
8280
|
readonly scriptVersion?: ScriptVersion;
|
|
8179
|
-
readonly trigger?: Trigger;
|
|
8180
8281
|
readonly info:
|
|
8181
8282
|
| FetchEventInfo
|
|
8182
8283
|
| JsRpcEventInfo
|
|
@@ -8197,6 +8298,8 @@ declare namespace TailStream {
|
|
|
8197
8298
|
interface SpanOpen {
|
|
8198
8299
|
readonly type: "spanOpen";
|
|
8199
8300
|
readonly name: string;
|
|
8301
|
+
// id for the span being opened by this SpanOpen event.
|
|
8302
|
+
readonly spanId: string;
|
|
8200
8303
|
readonly info?: FetchEventInfo | JsRpcEventInfo | Attributes;
|
|
8201
8304
|
}
|
|
8202
8305
|
interface SpanClose {
|
|
@@ -8219,6 +8322,10 @@ declare namespace TailStream {
|
|
|
8219
8322
|
readonly level: "debug" | "error" | "info" | "log" | "warn";
|
|
8220
8323
|
readonly message: object;
|
|
8221
8324
|
}
|
|
8325
|
+
// This marks the worker handler return information.
|
|
8326
|
+
// This is separate from Outcome because the worker invocation can live for a long time after
|
|
8327
|
+
// returning. For example - Websockets that return an http upgrade response but then continue
|
|
8328
|
+
// streaming information or SSE http connections.
|
|
8222
8329
|
interface Return {
|
|
8223
8330
|
readonly type: "return";
|
|
8224
8331
|
readonly info?: FetchResponseInfo;
|
|
@@ -8249,9 +8356,28 @@ declare namespace TailStream {
|
|
|
8249
8356
|
| Log
|
|
8250
8357
|
| Return
|
|
8251
8358
|
| Attributes;
|
|
8359
|
+
// Context in which this trace event lives.
|
|
8360
|
+
interface SpanContext {
|
|
8361
|
+
// Single id for the entire top-level invocation
|
|
8362
|
+
// This should be a new traceId for the first worker stage invoked in the eyeball request and then
|
|
8363
|
+
// same-account service-bindings should reuse the same traceId but cross-account service-bindings
|
|
8364
|
+
// should use a new traceId.
|
|
8365
|
+
readonly traceId: string;
|
|
8366
|
+
// spanId in which this event is handled
|
|
8367
|
+
// for Onset and SpanOpen events this would be the parent span id
|
|
8368
|
+
// for Outcome and SpanClose these this would be the span id of the opening Onset and SpanOpen events
|
|
8369
|
+
// For Hibernate and Mark this would be the span under which they were emitted.
|
|
8370
|
+
// spanId is not set ONLY if:
|
|
8371
|
+
// 1. This is an Onset event
|
|
8372
|
+
// 2. We are not inherting any SpanContext. (e.g. this is a cross-account service binding or a new top-level invocation)
|
|
8373
|
+
readonly spanId?: string;
|
|
8374
|
+
}
|
|
8252
8375
|
interface TailEvent<Event extends EventType> {
|
|
8376
|
+
// invocation id of the currently invoked worker stage.
|
|
8377
|
+
// invocation id will always be unique to every Onset event and will be the same until the Outcome event.
|
|
8253
8378
|
readonly invocationId: string;
|
|
8254
|
-
|
|
8379
|
+
// Inherited spanContext for this event.
|
|
8380
|
+
readonly spanContext: SpanContext;
|
|
8255
8381
|
readonly timestamp: Date;
|
|
8256
8382
|
readonly sequence: number;
|
|
8257
8383
|
readonly event: Event;
|