@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/latest/index.ts
CHANGED
|
@@ -7590,6 +7590,7 @@ export type ImageOutputOptions = {
|
|
|
7590
7590
|
| "rgba";
|
|
7591
7591
|
quality?: number;
|
|
7592
7592
|
background?: string;
|
|
7593
|
+
anim?: boolean;
|
|
7593
7594
|
};
|
|
7594
7595
|
export interface ImagesBinding {
|
|
7595
7596
|
/**
|
|
@@ -7657,6 +7658,110 @@ export interface ImagesError extends Error {
|
|
|
7657
7658
|
readonly message: string;
|
|
7658
7659
|
readonly stack?: string;
|
|
7659
7660
|
}
|
|
7661
|
+
/**
|
|
7662
|
+
* Media binding for transforming media streams.
|
|
7663
|
+
* Provides the entry point for media transformation operations.
|
|
7664
|
+
*/
|
|
7665
|
+
export interface MediaBinding {
|
|
7666
|
+
/**
|
|
7667
|
+
* Creates a media transformer from an input stream.
|
|
7668
|
+
* @param media - The input media bytes
|
|
7669
|
+
* @returns A MediaTransformer instance for applying transformations
|
|
7670
|
+
*/
|
|
7671
|
+
input(media: ReadableStream<Uint8Array>): MediaTransformer;
|
|
7672
|
+
}
|
|
7673
|
+
/**
|
|
7674
|
+
* Media transformer for applying transformation operations to media content.
|
|
7675
|
+
* Handles sizing, fitting, and other input transformation parameters.
|
|
7676
|
+
*/
|
|
7677
|
+
export interface MediaTransformer {
|
|
7678
|
+
/**
|
|
7679
|
+
* Applies transformation options to the media content.
|
|
7680
|
+
* @param transform - Configuration for how the media should be transformed
|
|
7681
|
+
* @returns A generator for producing the transformed media output
|
|
7682
|
+
*/
|
|
7683
|
+
transform(
|
|
7684
|
+
transform: MediaTransformationInputOptions,
|
|
7685
|
+
): MediaTransformationGenerator;
|
|
7686
|
+
}
|
|
7687
|
+
/**
|
|
7688
|
+
* Generator for producing media transformation results.
|
|
7689
|
+
* Configures the output format and parameters for the transformed media.
|
|
7690
|
+
*/
|
|
7691
|
+
export interface MediaTransformationGenerator {
|
|
7692
|
+
/**
|
|
7693
|
+
* Generates the final media output with specified options.
|
|
7694
|
+
* @param output - Configuration for the output format and parameters
|
|
7695
|
+
* @returns The final transformation result containing the transformed media
|
|
7696
|
+
*/
|
|
7697
|
+
output(output: MediaTransformationOutputOptions): MediaTransformationResult;
|
|
7698
|
+
}
|
|
7699
|
+
/**
|
|
7700
|
+
* Result of a media transformation operation.
|
|
7701
|
+
* Provides multiple ways to access the transformed media content.
|
|
7702
|
+
*/
|
|
7703
|
+
export interface MediaTransformationResult {
|
|
7704
|
+
/**
|
|
7705
|
+
* Returns the transformed media as a readable stream of bytes.
|
|
7706
|
+
* @returns A stream containing the transformed media data
|
|
7707
|
+
*/
|
|
7708
|
+
media(): ReadableStream<Uint8Array>;
|
|
7709
|
+
/**
|
|
7710
|
+
* Returns the transformed media as an HTTP response object.
|
|
7711
|
+
* @returns The transformed media as a Response, ready to store in cache or return to users
|
|
7712
|
+
*/
|
|
7713
|
+
response(): Response;
|
|
7714
|
+
/**
|
|
7715
|
+
* Returns the MIME type of the transformed media.
|
|
7716
|
+
* @returns The content type string (e.g., 'image/jpeg', 'video/mp4')
|
|
7717
|
+
*/
|
|
7718
|
+
contentType(): string;
|
|
7719
|
+
}
|
|
7720
|
+
/**
|
|
7721
|
+
* Configuration options for transforming media input.
|
|
7722
|
+
* Controls how the media should be resized and fitted.
|
|
7723
|
+
*/
|
|
7724
|
+
export type MediaTransformationInputOptions = {
|
|
7725
|
+
/** How the media should be resized to fit the specified dimensions */
|
|
7726
|
+
fit?: "contain" | "cover" | "scale-down";
|
|
7727
|
+
/** Target width in pixels */
|
|
7728
|
+
width?: number;
|
|
7729
|
+
/** Target height in pixels */
|
|
7730
|
+
height?: number;
|
|
7731
|
+
};
|
|
7732
|
+
/**
|
|
7733
|
+
* Configuration options for Media Transformations output.
|
|
7734
|
+
* Controls the format, timing, and type of the generated output.
|
|
7735
|
+
*/
|
|
7736
|
+
export type MediaTransformationOutputOptions = {
|
|
7737
|
+
/**
|
|
7738
|
+
* Output mode determining the type of media to generate
|
|
7739
|
+
*/
|
|
7740
|
+
mode?: "video" | "spritesheet" | "frame" | "audio";
|
|
7741
|
+
/** Whether to include audio in the output */
|
|
7742
|
+
audio?: boolean;
|
|
7743
|
+
/**
|
|
7744
|
+
* Starting timestamp for frame extraction or start time for clips. (e.g. '2s').
|
|
7745
|
+
*/
|
|
7746
|
+
time?: string;
|
|
7747
|
+
/**
|
|
7748
|
+
* Duration for video clips, audio extraction, and spritesheet generation (e.g. '5s').
|
|
7749
|
+
*/
|
|
7750
|
+
duration?: string;
|
|
7751
|
+
/**
|
|
7752
|
+
* Output format for the generated media.
|
|
7753
|
+
*/
|
|
7754
|
+
format?: "jpg" | "png" | "m4a";
|
|
7755
|
+
};
|
|
7756
|
+
/**
|
|
7757
|
+
* Error object for media transformation operations.
|
|
7758
|
+
* Extends the standard Error interface with additional media-specific information.
|
|
7759
|
+
*/
|
|
7760
|
+
export interface MediaError extends Error {
|
|
7761
|
+
readonly code: number;
|
|
7762
|
+
readonly message: string;
|
|
7763
|
+
readonly stack?: string;
|
|
7764
|
+
}
|
|
7660
7765
|
export type Params<P extends string = any> = Record<P, string | string[]>;
|
|
7661
7766
|
export type EventContext<Env, P extends string, Data> = {
|
|
7662
7767
|
request: Request<unknown, IncomingRequestCfProperties<unknown>>;
|
|
@@ -8007,21 +8112,17 @@ export declare namespace TailStream {
|
|
|
8007
8112
|
readonly tag?: string;
|
|
8008
8113
|
readonly message?: string;
|
|
8009
8114
|
}
|
|
8010
|
-
interface Trigger {
|
|
8011
|
-
readonly traceId: string;
|
|
8012
|
-
readonly invocationId: string;
|
|
8013
|
-
readonly spanId: string;
|
|
8014
|
-
}
|
|
8015
8115
|
interface Onset {
|
|
8016
8116
|
readonly type: "onset";
|
|
8017
8117
|
readonly attributes: Attribute[];
|
|
8118
|
+
// id for the span being opened by this Onset event.
|
|
8119
|
+
readonly spanId: string;
|
|
8018
8120
|
readonly dispatchNamespace?: string;
|
|
8019
8121
|
readonly entrypoint?: string;
|
|
8020
8122
|
readonly executionModel: string;
|
|
8021
8123
|
readonly scriptName?: string;
|
|
8022
8124
|
readonly scriptTags?: string[];
|
|
8023
8125
|
readonly scriptVersion?: ScriptVersion;
|
|
8024
|
-
readonly trigger?: Trigger;
|
|
8025
8126
|
readonly info:
|
|
8026
8127
|
| FetchEventInfo
|
|
8027
8128
|
| JsRpcEventInfo
|
|
@@ -8042,6 +8143,8 @@ export declare namespace TailStream {
|
|
|
8042
8143
|
interface SpanOpen {
|
|
8043
8144
|
readonly type: "spanOpen";
|
|
8044
8145
|
readonly name: string;
|
|
8146
|
+
// id for the span being opened by this SpanOpen event.
|
|
8147
|
+
readonly spanId: string;
|
|
8045
8148
|
readonly info?: FetchEventInfo | JsRpcEventInfo | Attributes;
|
|
8046
8149
|
}
|
|
8047
8150
|
interface SpanClose {
|
|
@@ -8064,6 +8167,10 @@ export declare namespace TailStream {
|
|
|
8064
8167
|
readonly level: "debug" | "error" | "info" | "log" | "warn";
|
|
8065
8168
|
readonly message: object;
|
|
8066
8169
|
}
|
|
8170
|
+
// This marks the worker handler return information.
|
|
8171
|
+
// This is separate from Outcome because the worker invocation can live for a long time after
|
|
8172
|
+
// returning. For example - Websockets that return an http upgrade response but then continue
|
|
8173
|
+
// streaming information or SSE http connections.
|
|
8067
8174
|
interface Return {
|
|
8068
8175
|
readonly type: "return";
|
|
8069
8176
|
readonly info?: FetchResponseInfo;
|
|
@@ -8094,9 +8201,28 @@ export declare namespace TailStream {
|
|
|
8094
8201
|
| Log
|
|
8095
8202
|
| Return
|
|
8096
8203
|
| Attributes;
|
|
8204
|
+
// Context in which this trace event lives.
|
|
8205
|
+
interface SpanContext {
|
|
8206
|
+
// Single id for the entire top-level invocation
|
|
8207
|
+
// This should be a new traceId for the first worker stage invoked in the eyeball request and then
|
|
8208
|
+
// same-account service-bindings should reuse the same traceId but cross-account service-bindings
|
|
8209
|
+
// should use a new traceId.
|
|
8210
|
+
readonly traceId: string;
|
|
8211
|
+
// spanId in which this event is handled
|
|
8212
|
+
// for Onset and SpanOpen events this would be the parent span id
|
|
8213
|
+
// for Outcome and SpanClose these this would be the span id of the opening Onset and SpanOpen events
|
|
8214
|
+
// For Hibernate and Mark this would be the span under which they were emitted.
|
|
8215
|
+
// spanId is not set ONLY if:
|
|
8216
|
+
// 1. This is an Onset event
|
|
8217
|
+
// 2. We are not inherting any SpanContext. (e.g. this is a cross-account service binding or a new top-level invocation)
|
|
8218
|
+
readonly spanId?: string;
|
|
8219
|
+
}
|
|
8097
8220
|
interface TailEvent<Event extends EventType> {
|
|
8221
|
+
// invocation id of the currently invoked worker stage.
|
|
8222
|
+
// invocation id will always be unique to every Onset event and will be the same until the Outcome event.
|
|
8098
8223
|
readonly invocationId: string;
|
|
8099
|
-
|
|
8224
|
+
// Inherited spanContext for this event.
|
|
8225
|
+
readonly spanContext: SpanContext;
|
|
8100
8226
|
readonly timestamp: Date;
|
|
8101
8227
|
readonly sequence: number;
|
|
8102
8228
|
readonly event: Event;
|
package/oldest/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/oldest/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/package.json
CHANGED