@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/2021-11-03/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/2021-11-03/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/2022-01-31/index.d.ts
CHANGED
|
@@ -7511,6 +7511,7 @@ type ImageOutputOptions = {
|
|
|
7511
7511
|
| "rgba";
|
|
7512
7512
|
quality?: number;
|
|
7513
7513
|
background?: string;
|
|
7514
|
+
anim?: boolean;
|
|
7514
7515
|
};
|
|
7515
7516
|
interface ImagesBinding {
|
|
7516
7517
|
/**
|
|
@@ -7578,6 +7579,110 @@ interface ImagesError extends Error {
|
|
|
7578
7579
|
readonly message: string;
|
|
7579
7580
|
readonly stack?: string;
|
|
7580
7581
|
}
|
|
7582
|
+
/**
|
|
7583
|
+
* Media binding for transforming media streams.
|
|
7584
|
+
* Provides the entry point for media transformation operations.
|
|
7585
|
+
*/
|
|
7586
|
+
interface MediaBinding {
|
|
7587
|
+
/**
|
|
7588
|
+
* Creates a media transformer from an input stream.
|
|
7589
|
+
* @param media - The input media bytes
|
|
7590
|
+
* @returns A MediaTransformer instance for applying transformations
|
|
7591
|
+
*/
|
|
7592
|
+
input(media: ReadableStream<Uint8Array>): MediaTransformer;
|
|
7593
|
+
}
|
|
7594
|
+
/**
|
|
7595
|
+
* Media transformer for applying transformation operations to media content.
|
|
7596
|
+
* Handles sizing, fitting, and other input transformation parameters.
|
|
7597
|
+
*/
|
|
7598
|
+
interface MediaTransformer {
|
|
7599
|
+
/**
|
|
7600
|
+
* Applies transformation options to the media content.
|
|
7601
|
+
* @param transform - Configuration for how the media should be transformed
|
|
7602
|
+
* @returns A generator for producing the transformed media output
|
|
7603
|
+
*/
|
|
7604
|
+
transform(
|
|
7605
|
+
transform: MediaTransformationInputOptions,
|
|
7606
|
+
): MediaTransformationGenerator;
|
|
7607
|
+
}
|
|
7608
|
+
/**
|
|
7609
|
+
* Generator for producing media transformation results.
|
|
7610
|
+
* Configures the output format and parameters for the transformed media.
|
|
7611
|
+
*/
|
|
7612
|
+
interface MediaTransformationGenerator {
|
|
7613
|
+
/**
|
|
7614
|
+
* Generates the final media output with specified options.
|
|
7615
|
+
* @param output - Configuration for the output format and parameters
|
|
7616
|
+
* @returns The final transformation result containing the transformed media
|
|
7617
|
+
*/
|
|
7618
|
+
output(output: MediaTransformationOutputOptions): MediaTransformationResult;
|
|
7619
|
+
}
|
|
7620
|
+
/**
|
|
7621
|
+
* Result of a media transformation operation.
|
|
7622
|
+
* Provides multiple ways to access the transformed media content.
|
|
7623
|
+
*/
|
|
7624
|
+
interface MediaTransformationResult {
|
|
7625
|
+
/**
|
|
7626
|
+
* Returns the transformed media as a readable stream of bytes.
|
|
7627
|
+
* @returns A stream containing the transformed media data
|
|
7628
|
+
*/
|
|
7629
|
+
media(): ReadableStream<Uint8Array>;
|
|
7630
|
+
/**
|
|
7631
|
+
* Returns the transformed media as an HTTP response object.
|
|
7632
|
+
* @returns The transformed media as a Response, ready to store in cache or return to users
|
|
7633
|
+
*/
|
|
7634
|
+
response(): Response;
|
|
7635
|
+
/**
|
|
7636
|
+
* Returns the MIME type of the transformed media.
|
|
7637
|
+
* @returns The content type string (e.g., 'image/jpeg', 'video/mp4')
|
|
7638
|
+
*/
|
|
7639
|
+
contentType(): string;
|
|
7640
|
+
}
|
|
7641
|
+
/**
|
|
7642
|
+
* Configuration options for transforming media input.
|
|
7643
|
+
* Controls how the media should be resized and fitted.
|
|
7644
|
+
*/
|
|
7645
|
+
type MediaTransformationInputOptions = {
|
|
7646
|
+
/** How the media should be resized to fit the specified dimensions */
|
|
7647
|
+
fit?: "contain" | "cover" | "scale-down";
|
|
7648
|
+
/** Target width in pixels */
|
|
7649
|
+
width?: number;
|
|
7650
|
+
/** Target height in pixels */
|
|
7651
|
+
height?: number;
|
|
7652
|
+
};
|
|
7653
|
+
/**
|
|
7654
|
+
* Configuration options for Media Transformations output.
|
|
7655
|
+
* Controls the format, timing, and type of the generated output.
|
|
7656
|
+
*/
|
|
7657
|
+
type MediaTransformationOutputOptions = {
|
|
7658
|
+
/**
|
|
7659
|
+
* Output mode determining the type of media to generate
|
|
7660
|
+
*/
|
|
7661
|
+
mode?: "video" | "spritesheet" | "frame" | "audio";
|
|
7662
|
+
/** Whether to include audio in the output */
|
|
7663
|
+
audio?: boolean;
|
|
7664
|
+
/**
|
|
7665
|
+
* Starting timestamp for frame extraction or start time for clips. (e.g. '2s').
|
|
7666
|
+
*/
|
|
7667
|
+
time?: string;
|
|
7668
|
+
/**
|
|
7669
|
+
* Duration for video clips, audio extraction, and spritesheet generation (e.g. '5s').
|
|
7670
|
+
*/
|
|
7671
|
+
duration?: string;
|
|
7672
|
+
/**
|
|
7673
|
+
* Output format for the generated media.
|
|
7674
|
+
*/
|
|
7675
|
+
format?: "jpg" | "png" | "m4a";
|
|
7676
|
+
};
|
|
7677
|
+
/**
|
|
7678
|
+
* Error object for media transformation operations.
|
|
7679
|
+
* Extends the standard Error interface with additional media-specific information.
|
|
7680
|
+
*/
|
|
7681
|
+
interface MediaError extends Error {
|
|
7682
|
+
readonly code: number;
|
|
7683
|
+
readonly message: string;
|
|
7684
|
+
readonly stack?: string;
|
|
7685
|
+
}
|
|
7581
7686
|
type Params<P extends string = any> = Record<P, string | string[]>;
|
|
7582
7687
|
type EventContext<Env, P extends string, Data> = {
|
|
7583
7688
|
request: Request<unknown, IncomingRequestCfProperties<unknown>>;
|
|
@@ -8103,21 +8208,17 @@ declare namespace TailStream {
|
|
|
8103
8208
|
readonly tag?: string;
|
|
8104
8209
|
readonly message?: string;
|
|
8105
8210
|
}
|
|
8106
|
-
interface Trigger {
|
|
8107
|
-
readonly traceId: string;
|
|
8108
|
-
readonly invocationId: string;
|
|
8109
|
-
readonly spanId: string;
|
|
8110
|
-
}
|
|
8111
8211
|
interface Onset {
|
|
8112
8212
|
readonly type: "onset";
|
|
8113
8213
|
readonly attributes: Attribute[];
|
|
8214
|
+
// id for the span being opened by this Onset event.
|
|
8215
|
+
readonly spanId: string;
|
|
8114
8216
|
readonly dispatchNamespace?: string;
|
|
8115
8217
|
readonly entrypoint?: string;
|
|
8116
8218
|
readonly executionModel: string;
|
|
8117
8219
|
readonly scriptName?: string;
|
|
8118
8220
|
readonly scriptTags?: string[];
|
|
8119
8221
|
readonly scriptVersion?: ScriptVersion;
|
|
8120
|
-
readonly trigger?: Trigger;
|
|
8121
8222
|
readonly info:
|
|
8122
8223
|
| FetchEventInfo
|
|
8123
8224
|
| JsRpcEventInfo
|
|
@@ -8138,6 +8239,8 @@ declare namespace TailStream {
|
|
|
8138
8239
|
interface SpanOpen {
|
|
8139
8240
|
readonly type: "spanOpen";
|
|
8140
8241
|
readonly name: string;
|
|
8242
|
+
// id for the span being opened by this SpanOpen event.
|
|
8243
|
+
readonly spanId: string;
|
|
8141
8244
|
readonly info?: FetchEventInfo | JsRpcEventInfo | Attributes;
|
|
8142
8245
|
}
|
|
8143
8246
|
interface SpanClose {
|
|
@@ -8160,6 +8263,10 @@ declare namespace TailStream {
|
|
|
8160
8263
|
readonly level: "debug" | "error" | "info" | "log" | "warn";
|
|
8161
8264
|
readonly message: object;
|
|
8162
8265
|
}
|
|
8266
|
+
// This marks the worker handler return information.
|
|
8267
|
+
// This is separate from Outcome because the worker invocation can live for a long time after
|
|
8268
|
+
// returning. For example - Websockets that return an http upgrade response but then continue
|
|
8269
|
+
// streaming information or SSE http connections.
|
|
8163
8270
|
interface Return {
|
|
8164
8271
|
readonly type: "return";
|
|
8165
8272
|
readonly info?: FetchResponseInfo;
|
|
@@ -8190,9 +8297,28 @@ declare namespace TailStream {
|
|
|
8190
8297
|
| Log
|
|
8191
8298
|
| Return
|
|
8192
8299
|
| Attributes;
|
|
8300
|
+
// Context in which this trace event lives.
|
|
8301
|
+
interface SpanContext {
|
|
8302
|
+
// Single id for the entire top-level invocation
|
|
8303
|
+
// This should be a new traceId for the first worker stage invoked in the eyeball request and then
|
|
8304
|
+
// same-account service-bindings should reuse the same traceId but cross-account service-bindings
|
|
8305
|
+
// should use a new traceId.
|
|
8306
|
+
readonly traceId: string;
|
|
8307
|
+
// spanId in which this event is handled
|
|
8308
|
+
// for Onset and SpanOpen events this would be the parent span id
|
|
8309
|
+
// for Outcome and SpanClose these this would be the span id of the opening Onset and SpanOpen events
|
|
8310
|
+
// For Hibernate and Mark this would be the span under which they were emitted.
|
|
8311
|
+
// spanId is not set ONLY if:
|
|
8312
|
+
// 1. This is an Onset event
|
|
8313
|
+
// 2. We are not inherting any SpanContext. (e.g. this is a cross-account service binding or a new top-level invocation)
|
|
8314
|
+
readonly spanId?: string;
|
|
8315
|
+
}
|
|
8193
8316
|
interface TailEvent<Event extends EventType> {
|
|
8317
|
+
// invocation id of the currently invoked worker stage.
|
|
8318
|
+
// invocation id will always be unique to every Onset event and will be the same until the Outcome event.
|
|
8194
8319
|
readonly invocationId: string;
|
|
8195
|
-
|
|
8320
|
+
// Inherited spanContext for this event.
|
|
8321
|
+
readonly spanContext: SpanContext;
|
|
8196
8322
|
readonly timestamp: Date;
|
|
8197
8323
|
readonly sequence: number;
|
|
8198
8324
|
readonly event: Event;
|