@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-01-31/index.ts
CHANGED
|
@@ -7531,6 +7531,7 @@ export type ImageOutputOptions = {
|
|
|
7531
7531
|
| "rgba";
|
|
7532
7532
|
quality?: number;
|
|
7533
7533
|
background?: string;
|
|
7534
|
+
anim?: boolean;
|
|
7534
7535
|
};
|
|
7535
7536
|
export interface ImagesBinding {
|
|
7536
7537
|
/**
|
|
@@ -7598,6 +7599,110 @@ export interface ImagesError extends Error {
|
|
|
7598
7599
|
readonly message: string;
|
|
7599
7600
|
readonly stack?: string;
|
|
7600
7601
|
}
|
|
7602
|
+
/**
|
|
7603
|
+
* Media binding for transforming media streams.
|
|
7604
|
+
* Provides the entry point for media transformation operations.
|
|
7605
|
+
*/
|
|
7606
|
+
export interface MediaBinding {
|
|
7607
|
+
/**
|
|
7608
|
+
* Creates a media transformer from an input stream.
|
|
7609
|
+
* @param media - The input media bytes
|
|
7610
|
+
* @returns A MediaTransformer instance for applying transformations
|
|
7611
|
+
*/
|
|
7612
|
+
input(media: ReadableStream<Uint8Array>): MediaTransformer;
|
|
7613
|
+
}
|
|
7614
|
+
/**
|
|
7615
|
+
* Media transformer for applying transformation operations to media content.
|
|
7616
|
+
* Handles sizing, fitting, and other input transformation parameters.
|
|
7617
|
+
*/
|
|
7618
|
+
export interface MediaTransformer {
|
|
7619
|
+
/**
|
|
7620
|
+
* Applies transformation options to the media content.
|
|
7621
|
+
* @param transform - Configuration for how the media should be transformed
|
|
7622
|
+
* @returns A generator for producing the transformed media output
|
|
7623
|
+
*/
|
|
7624
|
+
transform(
|
|
7625
|
+
transform: MediaTransformationInputOptions,
|
|
7626
|
+
): MediaTransformationGenerator;
|
|
7627
|
+
}
|
|
7628
|
+
/**
|
|
7629
|
+
* Generator for producing media transformation results.
|
|
7630
|
+
* Configures the output format and parameters for the transformed media.
|
|
7631
|
+
*/
|
|
7632
|
+
export interface MediaTransformationGenerator {
|
|
7633
|
+
/**
|
|
7634
|
+
* Generates the final media output with specified options.
|
|
7635
|
+
* @param output - Configuration for the output format and parameters
|
|
7636
|
+
* @returns The final transformation result containing the transformed media
|
|
7637
|
+
*/
|
|
7638
|
+
output(output: MediaTransformationOutputOptions): MediaTransformationResult;
|
|
7639
|
+
}
|
|
7640
|
+
/**
|
|
7641
|
+
* Result of a media transformation operation.
|
|
7642
|
+
* Provides multiple ways to access the transformed media content.
|
|
7643
|
+
*/
|
|
7644
|
+
export interface MediaTransformationResult {
|
|
7645
|
+
/**
|
|
7646
|
+
* Returns the transformed media as a readable stream of bytes.
|
|
7647
|
+
* @returns A stream containing the transformed media data
|
|
7648
|
+
*/
|
|
7649
|
+
media(): ReadableStream<Uint8Array>;
|
|
7650
|
+
/**
|
|
7651
|
+
* Returns the transformed media as an HTTP response object.
|
|
7652
|
+
* @returns The transformed media as a Response, ready to store in cache or return to users
|
|
7653
|
+
*/
|
|
7654
|
+
response(): Response;
|
|
7655
|
+
/**
|
|
7656
|
+
* Returns the MIME type of the transformed media.
|
|
7657
|
+
* @returns The content type string (e.g., 'image/jpeg', 'video/mp4')
|
|
7658
|
+
*/
|
|
7659
|
+
contentType(): string;
|
|
7660
|
+
}
|
|
7661
|
+
/**
|
|
7662
|
+
* Configuration options for transforming media input.
|
|
7663
|
+
* Controls how the media should be resized and fitted.
|
|
7664
|
+
*/
|
|
7665
|
+
export type MediaTransformationInputOptions = {
|
|
7666
|
+
/** How the media should be resized to fit the specified dimensions */
|
|
7667
|
+
fit?: "contain" | "cover" | "scale-down";
|
|
7668
|
+
/** Target width in pixels */
|
|
7669
|
+
width?: number;
|
|
7670
|
+
/** Target height in pixels */
|
|
7671
|
+
height?: number;
|
|
7672
|
+
};
|
|
7673
|
+
/**
|
|
7674
|
+
* Configuration options for Media Transformations output.
|
|
7675
|
+
* Controls the format, timing, and type of the generated output.
|
|
7676
|
+
*/
|
|
7677
|
+
export type MediaTransformationOutputOptions = {
|
|
7678
|
+
/**
|
|
7679
|
+
* Output mode determining the type of media to generate
|
|
7680
|
+
*/
|
|
7681
|
+
mode?: "video" | "spritesheet" | "frame" | "audio";
|
|
7682
|
+
/** Whether to include audio in the output */
|
|
7683
|
+
audio?: boolean;
|
|
7684
|
+
/**
|
|
7685
|
+
* Starting timestamp for frame extraction or start time for clips. (e.g. '2s').
|
|
7686
|
+
*/
|
|
7687
|
+
time?: string;
|
|
7688
|
+
/**
|
|
7689
|
+
* Duration for video clips, audio extraction, and spritesheet generation (e.g. '5s').
|
|
7690
|
+
*/
|
|
7691
|
+
duration?: string;
|
|
7692
|
+
/**
|
|
7693
|
+
* Output format for the generated media.
|
|
7694
|
+
*/
|
|
7695
|
+
format?: "jpg" | "png" | "m4a";
|
|
7696
|
+
};
|
|
7697
|
+
/**
|
|
7698
|
+
* Error object for media transformation operations.
|
|
7699
|
+
* Extends the standard Error interface with additional media-specific information.
|
|
7700
|
+
*/
|
|
7701
|
+
export interface MediaError extends Error {
|
|
7702
|
+
readonly code: number;
|
|
7703
|
+
readonly message: string;
|
|
7704
|
+
readonly stack?: string;
|
|
7705
|
+
}
|
|
7601
7706
|
export type Params<P extends string = any> = Record<P, string | string[]>;
|
|
7602
7707
|
export type EventContext<Env, P extends string, Data> = {
|
|
7603
7708
|
request: Request<unknown, IncomingRequestCfProperties<unknown>>;
|
|
@@ -7948,21 +8053,17 @@ export declare namespace TailStream {
|
|
|
7948
8053
|
readonly tag?: string;
|
|
7949
8054
|
readonly message?: string;
|
|
7950
8055
|
}
|
|
7951
|
-
interface Trigger {
|
|
7952
|
-
readonly traceId: string;
|
|
7953
|
-
readonly invocationId: string;
|
|
7954
|
-
readonly spanId: string;
|
|
7955
|
-
}
|
|
7956
8056
|
interface Onset {
|
|
7957
8057
|
readonly type: "onset";
|
|
7958
8058
|
readonly attributes: Attribute[];
|
|
8059
|
+
// id for the span being opened by this Onset event.
|
|
8060
|
+
readonly spanId: string;
|
|
7959
8061
|
readonly dispatchNamespace?: string;
|
|
7960
8062
|
readonly entrypoint?: string;
|
|
7961
8063
|
readonly executionModel: string;
|
|
7962
8064
|
readonly scriptName?: string;
|
|
7963
8065
|
readonly scriptTags?: string[];
|
|
7964
8066
|
readonly scriptVersion?: ScriptVersion;
|
|
7965
|
-
readonly trigger?: Trigger;
|
|
7966
8067
|
readonly info:
|
|
7967
8068
|
| FetchEventInfo
|
|
7968
8069
|
| JsRpcEventInfo
|
|
@@ -7983,6 +8084,8 @@ export declare namespace TailStream {
|
|
|
7983
8084
|
interface SpanOpen {
|
|
7984
8085
|
readonly type: "spanOpen";
|
|
7985
8086
|
readonly name: string;
|
|
8087
|
+
// id for the span being opened by this SpanOpen event.
|
|
8088
|
+
readonly spanId: string;
|
|
7986
8089
|
readonly info?: FetchEventInfo | JsRpcEventInfo | Attributes;
|
|
7987
8090
|
}
|
|
7988
8091
|
interface SpanClose {
|
|
@@ -8005,6 +8108,10 @@ export declare namespace TailStream {
|
|
|
8005
8108
|
readonly level: "debug" | "error" | "info" | "log" | "warn";
|
|
8006
8109
|
readonly message: object;
|
|
8007
8110
|
}
|
|
8111
|
+
// This marks the worker handler return information.
|
|
8112
|
+
// This is separate from Outcome because the worker invocation can live for a long time after
|
|
8113
|
+
// returning. For example - Websockets that return an http upgrade response but then continue
|
|
8114
|
+
// streaming information or SSE http connections.
|
|
8008
8115
|
interface Return {
|
|
8009
8116
|
readonly type: "return";
|
|
8010
8117
|
readonly info?: FetchResponseInfo;
|
|
@@ -8035,9 +8142,28 @@ export declare namespace TailStream {
|
|
|
8035
8142
|
| Log
|
|
8036
8143
|
| Return
|
|
8037
8144
|
| Attributes;
|
|
8145
|
+
// Context in which this trace event lives.
|
|
8146
|
+
interface SpanContext {
|
|
8147
|
+
// Single id for the entire top-level invocation
|
|
8148
|
+
// This should be a new traceId for the first worker stage invoked in the eyeball request and then
|
|
8149
|
+
// same-account service-bindings should reuse the same traceId but cross-account service-bindings
|
|
8150
|
+
// should use a new traceId.
|
|
8151
|
+
readonly traceId: string;
|
|
8152
|
+
// spanId in which this event is handled
|
|
8153
|
+
// for Onset and SpanOpen events this would be the parent span id
|
|
8154
|
+
// for Outcome and SpanClose these this would be the span id of the opening Onset and SpanOpen events
|
|
8155
|
+
// For Hibernate and Mark this would be the span under which they were emitted.
|
|
8156
|
+
// spanId is not set ONLY if:
|
|
8157
|
+
// 1. This is an Onset event
|
|
8158
|
+
// 2. We are not inherting any SpanContext. (e.g. this is a cross-account service binding or a new top-level invocation)
|
|
8159
|
+
readonly spanId?: string;
|
|
8160
|
+
}
|
|
8038
8161
|
interface TailEvent<Event extends EventType> {
|
|
8162
|
+
// invocation id of the currently invoked worker stage.
|
|
8163
|
+
// invocation id will always be unique to every Onset event and will be the same until the Outcome event.
|
|
8039
8164
|
readonly invocationId: string;
|
|
8040
|
-
|
|
8165
|
+
// Inherited spanContext for this event.
|
|
8166
|
+
readonly spanContext: SpanContext;
|
|
8041
8167
|
readonly timestamp: Date;
|
|
8042
8168
|
readonly sequence: number;
|
|
8043
8169
|
readonly event: Event;
|
package/2022-03-21/index.d.ts
CHANGED
|
@@ -7529,6 +7529,7 @@ type ImageOutputOptions = {
|
|
|
7529
7529
|
| "rgba";
|
|
7530
7530
|
quality?: number;
|
|
7531
7531
|
background?: string;
|
|
7532
|
+
anim?: boolean;
|
|
7532
7533
|
};
|
|
7533
7534
|
interface ImagesBinding {
|
|
7534
7535
|
/**
|
|
@@ -7596,6 +7597,110 @@ interface ImagesError extends Error {
|
|
|
7596
7597
|
readonly message: string;
|
|
7597
7598
|
readonly stack?: string;
|
|
7598
7599
|
}
|
|
7600
|
+
/**
|
|
7601
|
+
* Media binding for transforming media streams.
|
|
7602
|
+
* Provides the entry point for media transformation operations.
|
|
7603
|
+
*/
|
|
7604
|
+
interface MediaBinding {
|
|
7605
|
+
/**
|
|
7606
|
+
* Creates a media transformer from an input stream.
|
|
7607
|
+
* @param media - The input media bytes
|
|
7608
|
+
* @returns A MediaTransformer instance for applying transformations
|
|
7609
|
+
*/
|
|
7610
|
+
input(media: ReadableStream<Uint8Array>): MediaTransformer;
|
|
7611
|
+
}
|
|
7612
|
+
/**
|
|
7613
|
+
* Media transformer for applying transformation operations to media content.
|
|
7614
|
+
* Handles sizing, fitting, and other input transformation parameters.
|
|
7615
|
+
*/
|
|
7616
|
+
interface MediaTransformer {
|
|
7617
|
+
/**
|
|
7618
|
+
* Applies transformation options to the media content.
|
|
7619
|
+
* @param transform - Configuration for how the media should be transformed
|
|
7620
|
+
* @returns A generator for producing the transformed media output
|
|
7621
|
+
*/
|
|
7622
|
+
transform(
|
|
7623
|
+
transform: MediaTransformationInputOptions,
|
|
7624
|
+
): MediaTransformationGenerator;
|
|
7625
|
+
}
|
|
7626
|
+
/**
|
|
7627
|
+
* Generator for producing media transformation results.
|
|
7628
|
+
* Configures the output format and parameters for the transformed media.
|
|
7629
|
+
*/
|
|
7630
|
+
interface MediaTransformationGenerator {
|
|
7631
|
+
/**
|
|
7632
|
+
* Generates the final media output with specified options.
|
|
7633
|
+
* @param output - Configuration for the output format and parameters
|
|
7634
|
+
* @returns The final transformation result containing the transformed media
|
|
7635
|
+
*/
|
|
7636
|
+
output(output: MediaTransformationOutputOptions): MediaTransformationResult;
|
|
7637
|
+
}
|
|
7638
|
+
/**
|
|
7639
|
+
* Result of a media transformation operation.
|
|
7640
|
+
* Provides multiple ways to access the transformed media content.
|
|
7641
|
+
*/
|
|
7642
|
+
interface MediaTransformationResult {
|
|
7643
|
+
/**
|
|
7644
|
+
* Returns the transformed media as a readable stream of bytes.
|
|
7645
|
+
* @returns A stream containing the transformed media data
|
|
7646
|
+
*/
|
|
7647
|
+
media(): ReadableStream<Uint8Array>;
|
|
7648
|
+
/**
|
|
7649
|
+
* Returns the transformed media as an HTTP response object.
|
|
7650
|
+
* @returns The transformed media as a Response, ready to store in cache or return to users
|
|
7651
|
+
*/
|
|
7652
|
+
response(): Response;
|
|
7653
|
+
/**
|
|
7654
|
+
* Returns the MIME type of the transformed media.
|
|
7655
|
+
* @returns The content type string (e.g., 'image/jpeg', 'video/mp4')
|
|
7656
|
+
*/
|
|
7657
|
+
contentType(): string;
|
|
7658
|
+
}
|
|
7659
|
+
/**
|
|
7660
|
+
* Configuration options for transforming media input.
|
|
7661
|
+
* Controls how the media should be resized and fitted.
|
|
7662
|
+
*/
|
|
7663
|
+
type MediaTransformationInputOptions = {
|
|
7664
|
+
/** How the media should be resized to fit the specified dimensions */
|
|
7665
|
+
fit?: "contain" | "cover" | "scale-down";
|
|
7666
|
+
/** Target width in pixels */
|
|
7667
|
+
width?: number;
|
|
7668
|
+
/** Target height in pixels */
|
|
7669
|
+
height?: number;
|
|
7670
|
+
};
|
|
7671
|
+
/**
|
|
7672
|
+
* Configuration options for Media Transformations output.
|
|
7673
|
+
* Controls the format, timing, and type of the generated output.
|
|
7674
|
+
*/
|
|
7675
|
+
type MediaTransformationOutputOptions = {
|
|
7676
|
+
/**
|
|
7677
|
+
* Output mode determining the type of media to generate
|
|
7678
|
+
*/
|
|
7679
|
+
mode?: "video" | "spritesheet" | "frame" | "audio";
|
|
7680
|
+
/** Whether to include audio in the output */
|
|
7681
|
+
audio?: boolean;
|
|
7682
|
+
/**
|
|
7683
|
+
* Starting timestamp for frame extraction or start time for clips. (e.g. '2s').
|
|
7684
|
+
*/
|
|
7685
|
+
time?: string;
|
|
7686
|
+
/**
|
|
7687
|
+
* Duration for video clips, audio extraction, and spritesheet generation (e.g. '5s').
|
|
7688
|
+
*/
|
|
7689
|
+
duration?: string;
|
|
7690
|
+
/**
|
|
7691
|
+
* Output format for the generated media.
|
|
7692
|
+
*/
|
|
7693
|
+
format?: "jpg" | "png" | "m4a";
|
|
7694
|
+
};
|
|
7695
|
+
/**
|
|
7696
|
+
* Error object for media transformation operations.
|
|
7697
|
+
* Extends the standard Error interface with additional media-specific information.
|
|
7698
|
+
*/
|
|
7699
|
+
interface MediaError extends Error {
|
|
7700
|
+
readonly code: number;
|
|
7701
|
+
readonly message: string;
|
|
7702
|
+
readonly stack?: string;
|
|
7703
|
+
}
|
|
7599
7704
|
type Params<P extends string = any> = Record<P, string | string[]>;
|
|
7600
7705
|
type EventContext<Env, P extends string, Data> = {
|
|
7601
7706
|
request: Request<unknown, IncomingRequestCfProperties<unknown>>;
|
|
@@ -8121,21 +8226,17 @@ declare namespace TailStream {
|
|
|
8121
8226
|
readonly tag?: string;
|
|
8122
8227
|
readonly message?: string;
|
|
8123
8228
|
}
|
|
8124
|
-
interface Trigger {
|
|
8125
|
-
readonly traceId: string;
|
|
8126
|
-
readonly invocationId: string;
|
|
8127
|
-
readonly spanId: string;
|
|
8128
|
-
}
|
|
8129
8229
|
interface Onset {
|
|
8130
8230
|
readonly type: "onset";
|
|
8131
8231
|
readonly attributes: Attribute[];
|
|
8232
|
+
// id for the span being opened by this Onset event.
|
|
8233
|
+
readonly spanId: string;
|
|
8132
8234
|
readonly dispatchNamespace?: string;
|
|
8133
8235
|
readonly entrypoint?: string;
|
|
8134
8236
|
readonly executionModel: string;
|
|
8135
8237
|
readonly scriptName?: string;
|
|
8136
8238
|
readonly scriptTags?: string[];
|
|
8137
8239
|
readonly scriptVersion?: ScriptVersion;
|
|
8138
|
-
readonly trigger?: Trigger;
|
|
8139
8240
|
readonly info:
|
|
8140
8241
|
| FetchEventInfo
|
|
8141
8242
|
| JsRpcEventInfo
|
|
@@ -8156,6 +8257,8 @@ declare namespace TailStream {
|
|
|
8156
8257
|
interface SpanOpen {
|
|
8157
8258
|
readonly type: "spanOpen";
|
|
8158
8259
|
readonly name: string;
|
|
8260
|
+
// id for the span being opened by this SpanOpen event.
|
|
8261
|
+
readonly spanId: string;
|
|
8159
8262
|
readonly info?: FetchEventInfo | JsRpcEventInfo | Attributes;
|
|
8160
8263
|
}
|
|
8161
8264
|
interface SpanClose {
|
|
@@ -8178,6 +8281,10 @@ declare namespace TailStream {
|
|
|
8178
8281
|
readonly level: "debug" | "error" | "info" | "log" | "warn";
|
|
8179
8282
|
readonly message: object;
|
|
8180
8283
|
}
|
|
8284
|
+
// This marks the worker handler return information.
|
|
8285
|
+
// This is separate from Outcome because the worker invocation can live for a long time after
|
|
8286
|
+
// returning. For example - Websockets that return an http upgrade response but then continue
|
|
8287
|
+
// streaming information or SSE http connections.
|
|
8181
8288
|
interface Return {
|
|
8182
8289
|
readonly type: "return";
|
|
8183
8290
|
readonly info?: FetchResponseInfo;
|
|
@@ -8208,9 +8315,28 @@ declare namespace TailStream {
|
|
|
8208
8315
|
| Log
|
|
8209
8316
|
| Return
|
|
8210
8317
|
| Attributes;
|
|
8318
|
+
// Context in which this trace event lives.
|
|
8319
|
+
interface SpanContext {
|
|
8320
|
+
// Single id for the entire top-level invocation
|
|
8321
|
+
// This should be a new traceId for the first worker stage invoked in the eyeball request and then
|
|
8322
|
+
// same-account service-bindings should reuse the same traceId but cross-account service-bindings
|
|
8323
|
+
// should use a new traceId.
|
|
8324
|
+
readonly traceId: string;
|
|
8325
|
+
// spanId in which this event is handled
|
|
8326
|
+
// for Onset and SpanOpen events this would be the parent span id
|
|
8327
|
+
// for Outcome and SpanClose these this would be the span id of the opening Onset and SpanOpen events
|
|
8328
|
+
// For Hibernate and Mark this would be the span under which they were emitted.
|
|
8329
|
+
// spanId is not set ONLY if:
|
|
8330
|
+
// 1. This is an Onset event
|
|
8331
|
+
// 2. We are not inherting any SpanContext. (e.g. this is a cross-account service binding or a new top-level invocation)
|
|
8332
|
+
readonly spanId?: string;
|
|
8333
|
+
}
|
|
8211
8334
|
interface TailEvent<Event extends EventType> {
|
|
8335
|
+
// invocation id of the currently invoked worker stage.
|
|
8336
|
+
// invocation id will always be unique to every Onset event and will be the same until the Outcome event.
|
|
8212
8337
|
readonly invocationId: string;
|
|
8213
|
-
|
|
8338
|
+
// Inherited spanContext for this event.
|
|
8339
|
+
readonly spanContext: SpanContext;
|
|
8214
8340
|
readonly timestamp: Date;
|
|
8215
8341
|
readonly sequence: number;
|
|
8216
8342
|
readonly event: Event;
|
package/2022-03-21/index.ts
CHANGED
|
@@ -7549,6 +7549,7 @@ export type ImageOutputOptions = {
|
|
|
7549
7549
|
| "rgba";
|
|
7550
7550
|
quality?: number;
|
|
7551
7551
|
background?: string;
|
|
7552
|
+
anim?: boolean;
|
|
7552
7553
|
};
|
|
7553
7554
|
export interface ImagesBinding {
|
|
7554
7555
|
/**
|
|
@@ -7616,6 +7617,110 @@ export interface ImagesError extends Error {
|
|
|
7616
7617
|
readonly message: string;
|
|
7617
7618
|
readonly stack?: string;
|
|
7618
7619
|
}
|
|
7620
|
+
/**
|
|
7621
|
+
* Media binding for transforming media streams.
|
|
7622
|
+
* Provides the entry point for media transformation operations.
|
|
7623
|
+
*/
|
|
7624
|
+
export interface MediaBinding {
|
|
7625
|
+
/**
|
|
7626
|
+
* Creates a media transformer from an input stream.
|
|
7627
|
+
* @param media - The input media bytes
|
|
7628
|
+
* @returns A MediaTransformer instance for applying transformations
|
|
7629
|
+
*/
|
|
7630
|
+
input(media: ReadableStream<Uint8Array>): MediaTransformer;
|
|
7631
|
+
}
|
|
7632
|
+
/**
|
|
7633
|
+
* Media transformer for applying transformation operations to media content.
|
|
7634
|
+
* Handles sizing, fitting, and other input transformation parameters.
|
|
7635
|
+
*/
|
|
7636
|
+
export interface MediaTransformer {
|
|
7637
|
+
/**
|
|
7638
|
+
* Applies transformation options to the media content.
|
|
7639
|
+
* @param transform - Configuration for how the media should be transformed
|
|
7640
|
+
* @returns A generator for producing the transformed media output
|
|
7641
|
+
*/
|
|
7642
|
+
transform(
|
|
7643
|
+
transform: MediaTransformationInputOptions,
|
|
7644
|
+
): MediaTransformationGenerator;
|
|
7645
|
+
}
|
|
7646
|
+
/**
|
|
7647
|
+
* Generator for producing media transformation results.
|
|
7648
|
+
* Configures the output format and parameters for the transformed media.
|
|
7649
|
+
*/
|
|
7650
|
+
export interface MediaTransformationGenerator {
|
|
7651
|
+
/**
|
|
7652
|
+
* Generates the final media output with specified options.
|
|
7653
|
+
* @param output - Configuration for the output format and parameters
|
|
7654
|
+
* @returns The final transformation result containing the transformed media
|
|
7655
|
+
*/
|
|
7656
|
+
output(output: MediaTransformationOutputOptions): MediaTransformationResult;
|
|
7657
|
+
}
|
|
7658
|
+
/**
|
|
7659
|
+
* Result of a media transformation operation.
|
|
7660
|
+
* Provides multiple ways to access the transformed media content.
|
|
7661
|
+
*/
|
|
7662
|
+
export interface MediaTransformationResult {
|
|
7663
|
+
/**
|
|
7664
|
+
* Returns the transformed media as a readable stream of bytes.
|
|
7665
|
+
* @returns A stream containing the transformed media data
|
|
7666
|
+
*/
|
|
7667
|
+
media(): ReadableStream<Uint8Array>;
|
|
7668
|
+
/**
|
|
7669
|
+
* Returns the transformed media as an HTTP response object.
|
|
7670
|
+
* @returns The transformed media as a Response, ready to store in cache or return to users
|
|
7671
|
+
*/
|
|
7672
|
+
response(): Response;
|
|
7673
|
+
/**
|
|
7674
|
+
* Returns the MIME type of the transformed media.
|
|
7675
|
+
* @returns The content type string (e.g., 'image/jpeg', 'video/mp4')
|
|
7676
|
+
*/
|
|
7677
|
+
contentType(): string;
|
|
7678
|
+
}
|
|
7679
|
+
/**
|
|
7680
|
+
* Configuration options for transforming media input.
|
|
7681
|
+
* Controls how the media should be resized and fitted.
|
|
7682
|
+
*/
|
|
7683
|
+
export type MediaTransformationInputOptions = {
|
|
7684
|
+
/** How the media should be resized to fit the specified dimensions */
|
|
7685
|
+
fit?: "contain" | "cover" | "scale-down";
|
|
7686
|
+
/** Target width in pixels */
|
|
7687
|
+
width?: number;
|
|
7688
|
+
/** Target height in pixels */
|
|
7689
|
+
height?: number;
|
|
7690
|
+
};
|
|
7691
|
+
/**
|
|
7692
|
+
* Configuration options for Media Transformations output.
|
|
7693
|
+
* Controls the format, timing, and type of the generated output.
|
|
7694
|
+
*/
|
|
7695
|
+
export type MediaTransformationOutputOptions = {
|
|
7696
|
+
/**
|
|
7697
|
+
* Output mode determining the type of media to generate
|
|
7698
|
+
*/
|
|
7699
|
+
mode?: "video" | "spritesheet" | "frame" | "audio";
|
|
7700
|
+
/** Whether to include audio in the output */
|
|
7701
|
+
audio?: boolean;
|
|
7702
|
+
/**
|
|
7703
|
+
* Starting timestamp for frame extraction or start time for clips. (e.g. '2s').
|
|
7704
|
+
*/
|
|
7705
|
+
time?: string;
|
|
7706
|
+
/**
|
|
7707
|
+
* Duration for video clips, audio extraction, and spritesheet generation (e.g. '5s').
|
|
7708
|
+
*/
|
|
7709
|
+
duration?: string;
|
|
7710
|
+
/**
|
|
7711
|
+
* Output format for the generated media.
|
|
7712
|
+
*/
|
|
7713
|
+
format?: "jpg" | "png" | "m4a";
|
|
7714
|
+
};
|
|
7715
|
+
/**
|
|
7716
|
+
* Error object for media transformation operations.
|
|
7717
|
+
* Extends the standard Error interface with additional media-specific information.
|
|
7718
|
+
*/
|
|
7719
|
+
export interface MediaError extends Error {
|
|
7720
|
+
readonly code: number;
|
|
7721
|
+
readonly message: string;
|
|
7722
|
+
readonly stack?: string;
|
|
7723
|
+
}
|
|
7619
7724
|
export type Params<P extends string = any> = Record<P, string | string[]>;
|
|
7620
7725
|
export type EventContext<Env, P extends string, Data> = {
|
|
7621
7726
|
request: Request<unknown, IncomingRequestCfProperties<unknown>>;
|
|
@@ -7966,21 +8071,17 @@ export declare namespace TailStream {
|
|
|
7966
8071
|
readonly tag?: string;
|
|
7967
8072
|
readonly message?: string;
|
|
7968
8073
|
}
|
|
7969
|
-
interface Trigger {
|
|
7970
|
-
readonly traceId: string;
|
|
7971
|
-
readonly invocationId: string;
|
|
7972
|
-
readonly spanId: string;
|
|
7973
|
-
}
|
|
7974
8074
|
interface Onset {
|
|
7975
8075
|
readonly type: "onset";
|
|
7976
8076
|
readonly attributes: Attribute[];
|
|
8077
|
+
// id for the span being opened by this Onset event.
|
|
8078
|
+
readonly spanId: string;
|
|
7977
8079
|
readonly dispatchNamespace?: string;
|
|
7978
8080
|
readonly entrypoint?: string;
|
|
7979
8081
|
readonly executionModel: string;
|
|
7980
8082
|
readonly scriptName?: string;
|
|
7981
8083
|
readonly scriptTags?: string[];
|
|
7982
8084
|
readonly scriptVersion?: ScriptVersion;
|
|
7983
|
-
readonly trigger?: Trigger;
|
|
7984
8085
|
readonly info:
|
|
7985
8086
|
| FetchEventInfo
|
|
7986
8087
|
| JsRpcEventInfo
|
|
@@ -8001,6 +8102,8 @@ export declare namespace TailStream {
|
|
|
8001
8102
|
interface SpanOpen {
|
|
8002
8103
|
readonly type: "spanOpen";
|
|
8003
8104
|
readonly name: string;
|
|
8105
|
+
// id for the span being opened by this SpanOpen event.
|
|
8106
|
+
readonly spanId: string;
|
|
8004
8107
|
readonly info?: FetchEventInfo | JsRpcEventInfo | Attributes;
|
|
8005
8108
|
}
|
|
8006
8109
|
interface SpanClose {
|
|
@@ -8023,6 +8126,10 @@ export declare namespace TailStream {
|
|
|
8023
8126
|
readonly level: "debug" | "error" | "info" | "log" | "warn";
|
|
8024
8127
|
readonly message: object;
|
|
8025
8128
|
}
|
|
8129
|
+
// This marks the worker handler return information.
|
|
8130
|
+
// This is separate from Outcome because the worker invocation can live for a long time after
|
|
8131
|
+
// returning. For example - Websockets that return an http upgrade response but then continue
|
|
8132
|
+
// streaming information or SSE http connections.
|
|
8026
8133
|
interface Return {
|
|
8027
8134
|
readonly type: "return";
|
|
8028
8135
|
readonly info?: FetchResponseInfo;
|
|
@@ -8053,9 +8160,28 @@ export declare namespace TailStream {
|
|
|
8053
8160
|
| Log
|
|
8054
8161
|
| Return
|
|
8055
8162
|
| Attributes;
|
|
8163
|
+
// Context in which this trace event lives.
|
|
8164
|
+
interface SpanContext {
|
|
8165
|
+
// Single id for the entire top-level invocation
|
|
8166
|
+
// This should be a new traceId for the first worker stage invoked in the eyeball request and then
|
|
8167
|
+
// same-account service-bindings should reuse the same traceId but cross-account service-bindings
|
|
8168
|
+
// should use a new traceId.
|
|
8169
|
+
readonly traceId: string;
|
|
8170
|
+
// spanId in which this event is handled
|
|
8171
|
+
// for Onset and SpanOpen events this would be the parent span id
|
|
8172
|
+
// for Outcome and SpanClose these this would be the span id of the opening Onset and SpanOpen events
|
|
8173
|
+
// For Hibernate and Mark this would be the span under which they were emitted.
|
|
8174
|
+
// spanId is not set ONLY if:
|
|
8175
|
+
// 1. This is an Onset event
|
|
8176
|
+
// 2. We are not inherting any SpanContext. (e.g. this is a cross-account service binding or a new top-level invocation)
|
|
8177
|
+
readonly spanId?: string;
|
|
8178
|
+
}
|
|
8056
8179
|
interface TailEvent<Event extends EventType> {
|
|
8180
|
+
// invocation id of the currently invoked worker stage.
|
|
8181
|
+
// invocation id will always be unique to every Onset event and will be the same until the Outcome event.
|
|
8057
8182
|
readonly invocationId: string;
|
|
8058
|
-
|
|
8183
|
+
// Inherited spanContext for this event.
|
|
8184
|
+
readonly spanContext: SpanContext;
|
|
8059
8185
|
readonly timestamp: Date;
|
|
8060
8186
|
readonly sequence: number;
|
|
8061
8187
|
readonly event: Event;
|