@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-07-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/experimental/index.d.ts
CHANGED
|
@@ -7799,6 +7799,7 @@ type ImageOutputOptions = {
|
|
|
7799
7799
|
| "rgba";
|
|
7800
7800
|
quality?: number;
|
|
7801
7801
|
background?: string;
|
|
7802
|
+
anim?: boolean;
|
|
7802
7803
|
};
|
|
7803
7804
|
interface ImagesBinding {
|
|
7804
7805
|
/**
|
|
@@ -7866,6 +7867,110 @@ interface ImagesError extends Error {
|
|
|
7866
7867
|
readonly message: string;
|
|
7867
7868
|
readonly stack?: string;
|
|
7868
7869
|
}
|
|
7870
|
+
/**
|
|
7871
|
+
* Media binding for transforming media streams.
|
|
7872
|
+
* Provides the entry point for media transformation operations.
|
|
7873
|
+
*/
|
|
7874
|
+
interface MediaBinding {
|
|
7875
|
+
/**
|
|
7876
|
+
* Creates a media transformer from an input stream.
|
|
7877
|
+
* @param media - The input media bytes
|
|
7878
|
+
* @returns A MediaTransformer instance for applying transformations
|
|
7879
|
+
*/
|
|
7880
|
+
input(media: ReadableStream<Uint8Array>): MediaTransformer;
|
|
7881
|
+
}
|
|
7882
|
+
/**
|
|
7883
|
+
* Media transformer for applying transformation operations to media content.
|
|
7884
|
+
* Handles sizing, fitting, and other input transformation parameters.
|
|
7885
|
+
*/
|
|
7886
|
+
interface MediaTransformer {
|
|
7887
|
+
/**
|
|
7888
|
+
* Applies transformation options to the media content.
|
|
7889
|
+
* @param transform - Configuration for how the media should be transformed
|
|
7890
|
+
* @returns A generator for producing the transformed media output
|
|
7891
|
+
*/
|
|
7892
|
+
transform(
|
|
7893
|
+
transform: MediaTransformationInputOptions,
|
|
7894
|
+
): MediaTransformationGenerator;
|
|
7895
|
+
}
|
|
7896
|
+
/**
|
|
7897
|
+
* Generator for producing media transformation results.
|
|
7898
|
+
* Configures the output format and parameters for the transformed media.
|
|
7899
|
+
*/
|
|
7900
|
+
interface MediaTransformationGenerator {
|
|
7901
|
+
/**
|
|
7902
|
+
* Generates the final media output with specified options.
|
|
7903
|
+
* @param output - Configuration for the output format and parameters
|
|
7904
|
+
* @returns The final transformation result containing the transformed media
|
|
7905
|
+
*/
|
|
7906
|
+
output(output: MediaTransformationOutputOptions): MediaTransformationResult;
|
|
7907
|
+
}
|
|
7908
|
+
/**
|
|
7909
|
+
* Result of a media transformation operation.
|
|
7910
|
+
* Provides multiple ways to access the transformed media content.
|
|
7911
|
+
*/
|
|
7912
|
+
interface MediaTransformationResult {
|
|
7913
|
+
/**
|
|
7914
|
+
* Returns the transformed media as a readable stream of bytes.
|
|
7915
|
+
* @returns A stream containing the transformed media data
|
|
7916
|
+
*/
|
|
7917
|
+
media(): ReadableStream<Uint8Array>;
|
|
7918
|
+
/**
|
|
7919
|
+
* Returns the transformed media as an HTTP response object.
|
|
7920
|
+
* @returns The transformed media as a Response, ready to store in cache or return to users
|
|
7921
|
+
*/
|
|
7922
|
+
response(): Response;
|
|
7923
|
+
/**
|
|
7924
|
+
* Returns the MIME type of the transformed media.
|
|
7925
|
+
* @returns The content type string (e.g., 'image/jpeg', 'video/mp4')
|
|
7926
|
+
*/
|
|
7927
|
+
contentType(): string;
|
|
7928
|
+
}
|
|
7929
|
+
/**
|
|
7930
|
+
* Configuration options for transforming media input.
|
|
7931
|
+
* Controls how the media should be resized and fitted.
|
|
7932
|
+
*/
|
|
7933
|
+
type MediaTransformationInputOptions = {
|
|
7934
|
+
/** How the media should be resized to fit the specified dimensions */
|
|
7935
|
+
fit?: "contain" | "cover" | "scale-down";
|
|
7936
|
+
/** Target width in pixels */
|
|
7937
|
+
width?: number;
|
|
7938
|
+
/** Target height in pixels */
|
|
7939
|
+
height?: number;
|
|
7940
|
+
};
|
|
7941
|
+
/**
|
|
7942
|
+
* Configuration options for Media Transformations output.
|
|
7943
|
+
* Controls the format, timing, and type of the generated output.
|
|
7944
|
+
*/
|
|
7945
|
+
type MediaTransformationOutputOptions = {
|
|
7946
|
+
/**
|
|
7947
|
+
* Output mode determining the type of media to generate
|
|
7948
|
+
*/
|
|
7949
|
+
mode?: "video" | "spritesheet" | "frame" | "audio";
|
|
7950
|
+
/** Whether to include audio in the output */
|
|
7951
|
+
audio?: boolean;
|
|
7952
|
+
/**
|
|
7953
|
+
* Starting timestamp for frame extraction or start time for clips. (e.g. '2s').
|
|
7954
|
+
*/
|
|
7955
|
+
time?: string;
|
|
7956
|
+
/**
|
|
7957
|
+
* Duration for video clips, audio extraction, and spritesheet generation (e.g. '5s').
|
|
7958
|
+
*/
|
|
7959
|
+
duration?: string;
|
|
7960
|
+
/**
|
|
7961
|
+
* Output format for the generated media.
|
|
7962
|
+
*/
|
|
7963
|
+
format?: "jpg" | "png" | "m4a";
|
|
7964
|
+
};
|
|
7965
|
+
/**
|
|
7966
|
+
* Error object for media transformation operations.
|
|
7967
|
+
* Extends the standard Error interface with additional media-specific information.
|
|
7968
|
+
*/
|
|
7969
|
+
interface MediaError extends Error {
|
|
7970
|
+
readonly code: number;
|
|
7971
|
+
readonly message: string;
|
|
7972
|
+
readonly stack?: string;
|
|
7973
|
+
}
|
|
7869
7974
|
type Params<P extends string = any> = Record<P, string | string[]>;
|
|
7870
7975
|
type EventContext<Env, P extends string, Data> = {
|
|
7871
7976
|
request: Request<unknown, IncomingRequestCfProperties<unknown>>;
|
|
@@ -8391,21 +8496,17 @@ declare namespace TailStream {
|
|
|
8391
8496
|
readonly tag?: string;
|
|
8392
8497
|
readonly message?: string;
|
|
8393
8498
|
}
|
|
8394
|
-
interface Trigger {
|
|
8395
|
-
readonly traceId: string;
|
|
8396
|
-
readonly invocationId: string;
|
|
8397
|
-
readonly spanId: string;
|
|
8398
|
-
}
|
|
8399
8499
|
interface Onset {
|
|
8400
8500
|
readonly type: "onset";
|
|
8401
8501
|
readonly attributes: Attribute[];
|
|
8502
|
+
// id for the span being opened by this Onset event.
|
|
8503
|
+
readonly spanId: string;
|
|
8402
8504
|
readonly dispatchNamespace?: string;
|
|
8403
8505
|
readonly entrypoint?: string;
|
|
8404
8506
|
readonly executionModel: string;
|
|
8405
8507
|
readonly scriptName?: string;
|
|
8406
8508
|
readonly scriptTags?: string[];
|
|
8407
8509
|
readonly scriptVersion?: ScriptVersion;
|
|
8408
|
-
readonly trigger?: Trigger;
|
|
8409
8510
|
readonly info:
|
|
8410
8511
|
| FetchEventInfo
|
|
8411
8512
|
| JsRpcEventInfo
|
|
@@ -8426,6 +8527,8 @@ declare namespace TailStream {
|
|
|
8426
8527
|
interface SpanOpen {
|
|
8427
8528
|
readonly type: "spanOpen";
|
|
8428
8529
|
readonly name: string;
|
|
8530
|
+
// id for the span being opened by this SpanOpen event.
|
|
8531
|
+
readonly spanId: string;
|
|
8429
8532
|
readonly info?: FetchEventInfo | JsRpcEventInfo | Attributes;
|
|
8430
8533
|
}
|
|
8431
8534
|
interface SpanClose {
|
|
@@ -8448,6 +8551,10 @@ declare namespace TailStream {
|
|
|
8448
8551
|
readonly level: "debug" | "error" | "info" | "log" | "warn";
|
|
8449
8552
|
readonly message: object;
|
|
8450
8553
|
}
|
|
8554
|
+
// This marks the worker handler return information.
|
|
8555
|
+
// This is separate from Outcome because the worker invocation can live for a long time after
|
|
8556
|
+
// returning. For example - Websockets that return an http upgrade response but then continue
|
|
8557
|
+
// streaming information or SSE http connections.
|
|
8451
8558
|
interface Return {
|
|
8452
8559
|
readonly type: "return";
|
|
8453
8560
|
readonly info?: FetchResponseInfo;
|
|
@@ -8478,9 +8585,28 @@ declare namespace TailStream {
|
|
|
8478
8585
|
| Log
|
|
8479
8586
|
| Return
|
|
8480
8587
|
| Attributes;
|
|
8588
|
+
// Context in which this trace event lives.
|
|
8589
|
+
interface SpanContext {
|
|
8590
|
+
// Single id for the entire top-level invocation
|
|
8591
|
+
// This should be a new traceId for the first worker stage invoked in the eyeball request and then
|
|
8592
|
+
// same-account service-bindings should reuse the same traceId but cross-account service-bindings
|
|
8593
|
+
// should use a new traceId.
|
|
8594
|
+
readonly traceId: string;
|
|
8595
|
+
// spanId in which this event is handled
|
|
8596
|
+
// for Onset and SpanOpen events this would be the parent span id
|
|
8597
|
+
// for Outcome and SpanClose these this would be the span id of the opening Onset and SpanOpen events
|
|
8598
|
+
// For Hibernate and Mark this would be the span under which they were emitted.
|
|
8599
|
+
// spanId is not set ONLY if:
|
|
8600
|
+
// 1. This is an Onset event
|
|
8601
|
+
// 2. We are not inherting any SpanContext. (e.g. this is a cross-account service binding or a new top-level invocation)
|
|
8602
|
+
readonly spanId?: string;
|
|
8603
|
+
}
|
|
8481
8604
|
interface TailEvent<Event extends EventType> {
|
|
8605
|
+
// invocation id of the currently invoked worker stage.
|
|
8606
|
+
// invocation id will always be unique to every Onset event and will be the same until the Outcome event.
|
|
8482
8607
|
readonly invocationId: string;
|
|
8483
|
-
|
|
8608
|
+
// Inherited spanContext for this event.
|
|
8609
|
+
readonly spanContext: SpanContext;
|
|
8484
8610
|
readonly timestamp: Date;
|
|
8485
8611
|
readonly sequence: number;
|
|
8486
8612
|
readonly event: Event;
|
package/experimental/index.ts
CHANGED
|
@@ -7821,6 +7821,7 @@ export type ImageOutputOptions = {
|
|
|
7821
7821
|
| "rgba";
|
|
7822
7822
|
quality?: number;
|
|
7823
7823
|
background?: string;
|
|
7824
|
+
anim?: boolean;
|
|
7824
7825
|
};
|
|
7825
7826
|
export interface ImagesBinding {
|
|
7826
7827
|
/**
|
|
@@ -7888,6 +7889,110 @@ export interface ImagesError extends Error {
|
|
|
7888
7889
|
readonly message: string;
|
|
7889
7890
|
readonly stack?: string;
|
|
7890
7891
|
}
|
|
7892
|
+
/**
|
|
7893
|
+
* Media binding for transforming media streams.
|
|
7894
|
+
* Provides the entry point for media transformation operations.
|
|
7895
|
+
*/
|
|
7896
|
+
export interface MediaBinding {
|
|
7897
|
+
/**
|
|
7898
|
+
* Creates a media transformer from an input stream.
|
|
7899
|
+
* @param media - The input media bytes
|
|
7900
|
+
* @returns A MediaTransformer instance for applying transformations
|
|
7901
|
+
*/
|
|
7902
|
+
input(media: ReadableStream<Uint8Array>): MediaTransformer;
|
|
7903
|
+
}
|
|
7904
|
+
/**
|
|
7905
|
+
* Media transformer for applying transformation operations to media content.
|
|
7906
|
+
* Handles sizing, fitting, and other input transformation parameters.
|
|
7907
|
+
*/
|
|
7908
|
+
export interface MediaTransformer {
|
|
7909
|
+
/**
|
|
7910
|
+
* Applies transformation options to the media content.
|
|
7911
|
+
* @param transform - Configuration for how the media should be transformed
|
|
7912
|
+
* @returns A generator for producing the transformed media output
|
|
7913
|
+
*/
|
|
7914
|
+
transform(
|
|
7915
|
+
transform: MediaTransformationInputOptions,
|
|
7916
|
+
): MediaTransformationGenerator;
|
|
7917
|
+
}
|
|
7918
|
+
/**
|
|
7919
|
+
* Generator for producing media transformation results.
|
|
7920
|
+
* Configures the output format and parameters for the transformed media.
|
|
7921
|
+
*/
|
|
7922
|
+
export interface MediaTransformationGenerator {
|
|
7923
|
+
/**
|
|
7924
|
+
* Generates the final media output with specified options.
|
|
7925
|
+
* @param output - Configuration for the output format and parameters
|
|
7926
|
+
* @returns The final transformation result containing the transformed media
|
|
7927
|
+
*/
|
|
7928
|
+
output(output: MediaTransformationOutputOptions): MediaTransformationResult;
|
|
7929
|
+
}
|
|
7930
|
+
/**
|
|
7931
|
+
* Result of a media transformation operation.
|
|
7932
|
+
* Provides multiple ways to access the transformed media content.
|
|
7933
|
+
*/
|
|
7934
|
+
export interface MediaTransformationResult {
|
|
7935
|
+
/**
|
|
7936
|
+
* Returns the transformed media as a readable stream of bytes.
|
|
7937
|
+
* @returns A stream containing the transformed media data
|
|
7938
|
+
*/
|
|
7939
|
+
media(): ReadableStream<Uint8Array>;
|
|
7940
|
+
/**
|
|
7941
|
+
* Returns the transformed media as an HTTP response object.
|
|
7942
|
+
* @returns The transformed media as a Response, ready to store in cache or return to users
|
|
7943
|
+
*/
|
|
7944
|
+
response(): Response;
|
|
7945
|
+
/**
|
|
7946
|
+
* Returns the MIME type of the transformed media.
|
|
7947
|
+
* @returns The content type string (e.g., 'image/jpeg', 'video/mp4')
|
|
7948
|
+
*/
|
|
7949
|
+
contentType(): string;
|
|
7950
|
+
}
|
|
7951
|
+
/**
|
|
7952
|
+
* Configuration options for transforming media input.
|
|
7953
|
+
* Controls how the media should be resized and fitted.
|
|
7954
|
+
*/
|
|
7955
|
+
export type MediaTransformationInputOptions = {
|
|
7956
|
+
/** How the media should be resized to fit the specified dimensions */
|
|
7957
|
+
fit?: "contain" | "cover" | "scale-down";
|
|
7958
|
+
/** Target width in pixels */
|
|
7959
|
+
width?: number;
|
|
7960
|
+
/** Target height in pixels */
|
|
7961
|
+
height?: number;
|
|
7962
|
+
};
|
|
7963
|
+
/**
|
|
7964
|
+
* Configuration options for Media Transformations output.
|
|
7965
|
+
* Controls the format, timing, and type of the generated output.
|
|
7966
|
+
*/
|
|
7967
|
+
export type MediaTransformationOutputOptions = {
|
|
7968
|
+
/**
|
|
7969
|
+
* Output mode determining the type of media to generate
|
|
7970
|
+
*/
|
|
7971
|
+
mode?: "video" | "spritesheet" | "frame" | "audio";
|
|
7972
|
+
/** Whether to include audio in the output */
|
|
7973
|
+
audio?: boolean;
|
|
7974
|
+
/**
|
|
7975
|
+
* Starting timestamp for frame extraction or start time for clips. (e.g. '2s').
|
|
7976
|
+
*/
|
|
7977
|
+
time?: string;
|
|
7978
|
+
/**
|
|
7979
|
+
* Duration for video clips, audio extraction, and spritesheet generation (e.g. '5s').
|
|
7980
|
+
*/
|
|
7981
|
+
duration?: string;
|
|
7982
|
+
/**
|
|
7983
|
+
* Output format for the generated media.
|
|
7984
|
+
*/
|
|
7985
|
+
format?: "jpg" | "png" | "m4a";
|
|
7986
|
+
};
|
|
7987
|
+
/**
|
|
7988
|
+
* Error object for media transformation operations.
|
|
7989
|
+
* Extends the standard Error interface with additional media-specific information.
|
|
7990
|
+
*/
|
|
7991
|
+
export interface MediaError extends Error {
|
|
7992
|
+
readonly code: number;
|
|
7993
|
+
readonly message: string;
|
|
7994
|
+
readonly stack?: string;
|
|
7995
|
+
}
|
|
7891
7996
|
export type Params<P extends string = any> = Record<P, string | string[]>;
|
|
7892
7997
|
export type EventContext<Env, P extends string, Data> = {
|
|
7893
7998
|
request: Request<unknown, IncomingRequestCfProperties<unknown>>;
|
|
@@ -8238,21 +8343,17 @@ export declare namespace TailStream {
|
|
|
8238
8343
|
readonly tag?: string;
|
|
8239
8344
|
readonly message?: string;
|
|
8240
8345
|
}
|
|
8241
|
-
interface Trigger {
|
|
8242
|
-
readonly traceId: string;
|
|
8243
|
-
readonly invocationId: string;
|
|
8244
|
-
readonly spanId: string;
|
|
8245
|
-
}
|
|
8246
8346
|
interface Onset {
|
|
8247
8347
|
readonly type: "onset";
|
|
8248
8348
|
readonly attributes: Attribute[];
|
|
8349
|
+
// id for the span being opened by this Onset event.
|
|
8350
|
+
readonly spanId: string;
|
|
8249
8351
|
readonly dispatchNamespace?: string;
|
|
8250
8352
|
readonly entrypoint?: string;
|
|
8251
8353
|
readonly executionModel: string;
|
|
8252
8354
|
readonly scriptName?: string;
|
|
8253
8355
|
readonly scriptTags?: string[];
|
|
8254
8356
|
readonly scriptVersion?: ScriptVersion;
|
|
8255
|
-
readonly trigger?: Trigger;
|
|
8256
8357
|
readonly info:
|
|
8257
8358
|
| FetchEventInfo
|
|
8258
8359
|
| JsRpcEventInfo
|
|
@@ -8273,6 +8374,8 @@ export declare namespace TailStream {
|
|
|
8273
8374
|
interface SpanOpen {
|
|
8274
8375
|
readonly type: "spanOpen";
|
|
8275
8376
|
readonly name: string;
|
|
8377
|
+
// id for the span being opened by this SpanOpen event.
|
|
8378
|
+
readonly spanId: string;
|
|
8276
8379
|
readonly info?: FetchEventInfo | JsRpcEventInfo | Attributes;
|
|
8277
8380
|
}
|
|
8278
8381
|
interface SpanClose {
|
|
@@ -8295,6 +8398,10 @@ export declare namespace TailStream {
|
|
|
8295
8398
|
readonly level: "debug" | "error" | "info" | "log" | "warn";
|
|
8296
8399
|
readonly message: object;
|
|
8297
8400
|
}
|
|
8401
|
+
// This marks the worker handler return information.
|
|
8402
|
+
// This is separate from Outcome because the worker invocation can live for a long time after
|
|
8403
|
+
// returning. For example - Websockets that return an http upgrade response but then continue
|
|
8404
|
+
// streaming information or SSE http connections.
|
|
8298
8405
|
interface Return {
|
|
8299
8406
|
readonly type: "return";
|
|
8300
8407
|
readonly info?: FetchResponseInfo;
|
|
@@ -8325,9 +8432,28 @@ export declare namespace TailStream {
|
|
|
8325
8432
|
| Log
|
|
8326
8433
|
| Return
|
|
8327
8434
|
| Attributes;
|
|
8435
|
+
// Context in which this trace event lives.
|
|
8436
|
+
interface SpanContext {
|
|
8437
|
+
// Single id for the entire top-level invocation
|
|
8438
|
+
// This should be a new traceId for the first worker stage invoked in the eyeball request and then
|
|
8439
|
+
// same-account service-bindings should reuse the same traceId but cross-account service-bindings
|
|
8440
|
+
// should use a new traceId.
|
|
8441
|
+
readonly traceId: string;
|
|
8442
|
+
// spanId in which this event is handled
|
|
8443
|
+
// for Onset and SpanOpen events this would be the parent span id
|
|
8444
|
+
// for Outcome and SpanClose these this would be the span id of the opening Onset and SpanOpen events
|
|
8445
|
+
// For Hibernate and Mark this would be the span under which they were emitted.
|
|
8446
|
+
// spanId is not set ONLY if:
|
|
8447
|
+
// 1. This is an Onset event
|
|
8448
|
+
// 2. We are not inherting any SpanContext. (e.g. this is a cross-account service binding or a new top-level invocation)
|
|
8449
|
+
readonly spanId?: string;
|
|
8450
|
+
}
|
|
8328
8451
|
interface TailEvent<Event extends EventType> {
|
|
8452
|
+
// invocation id of the currently invoked worker stage.
|
|
8453
|
+
// invocation id will always be unique to every Onset event and will be the same until the Outcome event.
|
|
8329
8454
|
readonly invocationId: string;
|
|
8330
|
-
|
|
8455
|
+
// Inherited spanContext for this event.
|
|
8456
|
+
readonly spanContext: SpanContext;
|
|
8331
8457
|
readonly timestamp: Date;
|
|
8332
8458
|
readonly sequence: number;
|
|
8333
8459
|
readonly event: Event;
|