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