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