@cloudflare/workers-types 4.20240729.0 → 4.20240815.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 +160 -1
- package/2021-11-03/index.ts +128 -1
- package/2022-01-31/index.d.ts +160 -1
- package/2022-01-31/index.ts +128 -1
- package/2022-03-21/index.d.ts +160 -1
- package/2022-03-21/index.ts +128 -1
- package/2022-08-04/index.d.ts +160 -1
- package/2022-08-04/index.ts +128 -1
- package/2022-10-31/index.d.ts +160 -1
- package/2022-10-31/index.ts +128 -1
- package/2022-11-30/index.d.ts +160 -1
- package/2022-11-30/index.ts +128 -1
- package/2023-03-01/index.d.ts +160 -1
- package/2023-03-01/index.ts +128 -1
- package/2023-07-01/index.d.ts +160 -1
- package/2023-07-01/index.ts +128 -1
- package/experimental/index.d.ts +160 -1
- package/experimental/index.ts +128 -1
- package/index.d.ts +160 -1
- package/index.ts +128 -1
- package/oldest/index.d.ts +160 -1
- package/oldest/index.ts +128 -1
- package/package.json +1 -1
package/2022-03-21/index.d.ts
CHANGED
|
@@ -4767,6 +4767,128 @@ interface Hyperdrive {
|
|
|
4767
4767
|
*/
|
|
4768
4768
|
readonly database: string;
|
|
4769
4769
|
}
|
|
4770
|
+
// Copyright (c) 2024 Cloudflare, Inc.
|
|
4771
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
4772
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
4773
|
+
type InfoResponse =
|
|
4774
|
+
| {
|
|
4775
|
+
format: "image/svg+xml";
|
|
4776
|
+
}
|
|
4777
|
+
| {
|
|
4778
|
+
format: string;
|
|
4779
|
+
fileSize: number;
|
|
4780
|
+
width: number;
|
|
4781
|
+
height: number;
|
|
4782
|
+
};
|
|
4783
|
+
type Transform = {
|
|
4784
|
+
fit?: "scale-down" | "contain" | "pad" | "squeeze" | "cover" | "crop";
|
|
4785
|
+
gravity?:
|
|
4786
|
+
| "left"
|
|
4787
|
+
| "right"
|
|
4788
|
+
| "top"
|
|
4789
|
+
| "bottom"
|
|
4790
|
+
| "center"
|
|
4791
|
+
| "auto"
|
|
4792
|
+
| "entropy"
|
|
4793
|
+
| "face"
|
|
4794
|
+
| {
|
|
4795
|
+
x?: number;
|
|
4796
|
+
y?: number;
|
|
4797
|
+
mode: "remainder" | "box-center";
|
|
4798
|
+
};
|
|
4799
|
+
trim?: {
|
|
4800
|
+
top?: number;
|
|
4801
|
+
bottom?: number;
|
|
4802
|
+
left?: number;
|
|
4803
|
+
right?: number;
|
|
4804
|
+
width?: number;
|
|
4805
|
+
height?: number;
|
|
4806
|
+
border?:
|
|
4807
|
+
| boolean
|
|
4808
|
+
| {
|
|
4809
|
+
color?: string;
|
|
4810
|
+
tolerance?: number;
|
|
4811
|
+
keep?: number;
|
|
4812
|
+
};
|
|
4813
|
+
};
|
|
4814
|
+
width?: number;
|
|
4815
|
+
height?: number;
|
|
4816
|
+
background?: string;
|
|
4817
|
+
rotate?: number;
|
|
4818
|
+
sharpen?: number;
|
|
4819
|
+
blur?: number;
|
|
4820
|
+
contrast?: number;
|
|
4821
|
+
brightness?: number;
|
|
4822
|
+
gamma?: number;
|
|
4823
|
+
border?: {
|
|
4824
|
+
color?: string;
|
|
4825
|
+
width?: number;
|
|
4826
|
+
top?: number;
|
|
4827
|
+
bottom?: number;
|
|
4828
|
+
left?: number;
|
|
4829
|
+
right?: number;
|
|
4830
|
+
};
|
|
4831
|
+
zoom?: number;
|
|
4832
|
+
};
|
|
4833
|
+
type OutputOptions = {
|
|
4834
|
+
format:
|
|
4835
|
+
| "image/jpeg"
|
|
4836
|
+
| "image/png"
|
|
4837
|
+
| "image/gif"
|
|
4838
|
+
| "image/webp"
|
|
4839
|
+
| "image/avif"
|
|
4840
|
+
| "rgb"
|
|
4841
|
+
| "rgba";
|
|
4842
|
+
quality?: number;
|
|
4843
|
+
background?: string;
|
|
4844
|
+
};
|
|
4845
|
+
interface ImagesBinding {
|
|
4846
|
+
/**
|
|
4847
|
+
* Get image metadata (type, width and height)
|
|
4848
|
+
* @throws {@link ImagesError} with code 9412 if input is not an image
|
|
4849
|
+
* @param stream The image bytes
|
|
4850
|
+
*/
|
|
4851
|
+
info(stream: ReadableStream<Uint8Array>): Promise<InfoResponse>;
|
|
4852
|
+
/**
|
|
4853
|
+
* Begin applying a series of transformations to an image
|
|
4854
|
+
* @param stream The image bytes
|
|
4855
|
+
* @returns A transform handle
|
|
4856
|
+
*/
|
|
4857
|
+
input(stream: ReadableStream<Uint8Array>): ImageTransformer;
|
|
4858
|
+
}
|
|
4859
|
+
interface ImageTransformer {
|
|
4860
|
+
/**
|
|
4861
|
+
* Apply transform next, returning a transform handle.
|
|
4862
|
+
* You can then apply more transformations or retrieve the output.
|
|
4863
|
+
* @param transform
|
|
4864
|
+
*/
|
|
4865
|
+
transform(transform: Transform): ImageTransformer;
|
|
4866
|
+
/**
|
|
4867
|
+
* Retrieve the image that results from applying the transforms to the
|
|
4868
|
+
* provided input
|
|
4869
|
+
* @param options Options that apply to the output e.g. output format
|
|
4870
|
+
*/
|
|
4871
|
+
output(options: OutputOptions): Promise<TransformationResult>;
|
|
4872
|
+
}
|
|
4873
|
+
interface TransformationResult {
|
|
4874
|
+
/**
|
|
4875
|
+
* The image as a response, ready to store in cache or return to users
|
|
4876
|
+
*/
|
|
4877
|
+
response(): Response;
|
|
4878
|
+
/**
|
|
4879
|
+
* The content type of the returned image
|
|
4880
|
+
*/
|
|
4881
|
+
contentType(): string;
|
|
4882
|
+
/**
|
|
4883
|
+
* The bytes of the response
|
|
4884
|
+
*/
|
|
4885
|
+
image(): ReadableStream<Uint8Array>;
|
|
4886
|
+
}
|
|
4887
|
+
interface ImagesError extends Error {
|
|
4888
|
+
readonly code: number;
|
|
4889
|
+
readonly message: string;
|
|
4890
|
+
readonly stack?: string;
|
|
4891
|
+
}
|
|
4770
4892
|
type Params<P extends string = any> = Record<P, string | string[]>;
|
|
4771
4893
|
type EventContext<Env, P extends string, Data> = {
|
|
4772
4894
|
request: Request<unknown, IncomingRequestCfProperties<unknown>>;
|
|
@@ -4873,6 +4995,7 @@ declare namespace Rpc {
|
|
|
4873
4995
|
export const __RPC_TARGET_BRAND: "__RPC_TARGET_BRAND";
|
|
4874
4996
|
export const __WORKER_ENTRYPOINT_BRAND: "__WORKER_ENTRYPOINT_BRAND";
|
|
4875
4997
|
export const __DURABLE_OBJECT_BRAND: "__DURABLE_OBJECT_BRAND";
|
|
4998
|
+
export const __WORKFLOW_BRAND: "__WORKFLOW_BRAND";
|
|
4876
4999
|
export interface RpcTargetBranded {
|
|
4877
5000
|
[__RPC_TARGET_BRAND]: never;
|
|
4878
5001
|
}
|
|
@@ -4882,9 +5005,13 @@ declare namespace Rpc {
|
|
|
4882
5005
|
export interface DurableObjectBranded {
|
|
4883
5006
|
[__DURABLE_OBJECT_BRAND]: never;
|
|
4884
5007
|
}
|
|
5008
|
+
export interface WorkflowBranded {
|
|
5009
|
+
[__WORKFLOW_BRAND]: never;
|
|
5010
|
+
}
|
|
4885
5011
|
export type EntrypointBranded =
|
|
4886
5012
|
| WorkerEntrypointBranded
|
|
4887
|
-
| DurableObjectBranded
|
|
5013
|
+
| DurableObjectBranded
|
|
5014
|
+
| WorkflowBranded;
|
|
4888
5015
|
// Types that can be used through `Stub`s
|
|
4889
5016
|
export type Stubable = RpcTargetBranded | ((...args: any[]) => any);
|
|
4890
5017
|
// Types that can be passed over RPC
|
|
@@ -5054,6 +5181,38 @@ declare module "cloudflare:workers" {
|
|
|
5054
5181
|
): void | Promise<void>;
|
|
5055
5182
|
webSocketError?(ws: WebSocket, error: unknown): void | Promise<void>;
|
|
5056
5183
|
}
|
|
5184
|
+
export type DurationLabel =
|
|
5185
|
+
| "second"
|
|
5186
|
+
| "minute"
|
|
5187
|
+
| "hour"
|
|
5188
|
+
| "day"
|
|
5189
|
+
| "week"
|
|
5190
|
+
| "month"
|
|
5191
|
+
| "year";
|
|
5192
|
+
export type SleepDuration = `${number} ${DurationLabel}${"s" | ""}` | number;
|
|
5193
|
+
type WorkflowStep = {
|
|
5194
|
+
do: <T extends Rpc.Serializable>(
|
|
5195
|
+
name: string,
|
|
5196
|
+
callback: () => T,
|
|
5197
|
+
) => T | Promise<T>;
|
|
5198
|
+
sleep: (name: string, duration: SleepDuration) => void | Promise<void>;
|
|
5199
|
+
};
|
|
5200
|
+
export abstract class Workflow<
|
|
5201
|
+
Env = unknown,
|
|
5202
|
+
T extends Rpc.Serializable | unknown = unknown,
|
|
5203
|
+
> implements Rpc.WorkflowBranded
|
|
5204
|
+
{
|
|
5205
|
+
[Rpc.__WORKFLOW_BRAND]: never;
|
|
5206
|
+
protected ctx: ExecutionContext;
|
|
5207
|
+
protected env: Env;
|
|
5208
|
+
run(
|
|
5209
|
+
events: Array<{
|
|
5210
|
+
payload: T;
|
|
5211
|
+
timestamp: Date;
|
|
5212
|
+
}>,
|
|
5213
|
+
step: WorkflowStep,
|
|
5214
|
+
): unknown | Promise<unknown>;
|
|
5215
|
+
}
|
|
5057
5216
|
}
|
|
5058
5217
|
declare module "cloudflare:sockets" {
|
|
5059
5218
|
function _connect(
|
package/2022-03-21/index.ts
CHANGED
|
@@ -4782,6 +4782,128 @@ export interface Hyperdrive {
|
|
|
4782
4782
|
*/
|
|
4783
4783
|
readonly database: string;
|
|
4784
4784
|
}
|
|
4785
|
+
// Copyright (c) 2024 Cloudflare, Inc.
|
|
4786
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
4787
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
4788
|
+
export type InfoResponse =
|
|
4789
|
+
| {
|
|
4790
|
+
format: "image/svg+xml";
|
|
4791
|
+
}
|
|
4792
|
+
| {
|
|
4793
|
+
format: string;
|
|
4794
|
+
fileSize: number;
|
|
4795
|
+
width: number;
|
|
4796
|
+
height: number;
|
|
4797
|
+
};
|
|
4798
|
+
export type Transform = {
|
|
4799
|
+
fit?: "scale-down" | "contain" | "pad" | "squeeze" | "cover" | "crop";
|
|
4800
|
+
gravity?:
|
|
4801
|
+
| "left"
|
|
4802
|
+
| "right"
|
|
4803
|
+
| "top"
|
|
4804
|
+
| "bottom"
|
|
4805
|
+
| "center"
|
|
4806
|
+
| "auto"
|
|
4807
|
+
| "entropy"
|
|
4808
|
+
| "face"
|
|
4809
|
+
| {
|
|
4810
|
+
x?: number;
|
|
4811
|
+
y?: number;
|
|
4812
|
+
mode: "remainder" | "box-center";
|
|
4813
|
+
};
|
|
4814
|
+
trim?: {
|
|
4815
|
+
top?: number;
|
|
4816
|
+
bottom?: number;
|
|
4817
|
+
left?: number;
|
|
4818
|
+
right?: number;
|
|
4819
|
+
width?: number;
|
|
4820
|
+
height?: number;
|
|
4821
|
+
border?:
|
|
4822
|
+
| boolean
|
|
4823
|
+
| {
|
|
4824
|
+
color?: string;
|
|
4825
|
+
tolerance?: number;
|
|
4826
|
+
keep?: number;
|
|
4827
|
+
};
|
|
4828
|
+
};
|
|
4829
|
+
width?: number;
|
|
4830
|
+
height?: number;
|
|
4831
|
+
background?: string;
|
|
4832
|
+
rotate?: number;
|
|
4833
|
+
sharpen?: number;
|
|
4834
|
+
blur?: number;
|
|
4835
|
+
contrast?: number;
|
|
4836
|
+
brightness?: number;
|
|
4837
|
+
gamma?: number;
|
|
4838
|
+
border?: {
|
|
4839
|
+
color?: string;
|
|
4840
|
+
width?: number;
|
|
4841
|
+
top?: number;
|
|
4842
|
+
bottom?: number;
|
|
4843
|
+
left?: number;
|
|
4844
|
+
right?: number;
|
|
4845
|
+
};
|
|
4846
|
+
zoom?: number;
|
|
4847
|
+
};
|
|
4848
|
+
export type OutputOptions = {
|
|
4849
|
+
format:
|
|
4850
|
+
| "image/jpeg"
|
|
4851
|
+
| "image/png"
|
|
4852
|
+
| "image/gif"
|
|
4853
|
+
| "image/webp"
|
|
4854
|
+
| "image/avif"
|
|
4855
|
+
| "rgb"
|
|
4856
|
+
| "rgba";
|
|
4857
|
+
quality?: number;
|
|
4858
|
+
background?: string;
|
|
4859
|
+
};
|
|
4860
|
+
export interface ImagesBinding {
|
|
4861
|
+
/**
|
|
4862
|
+
* Get image metadata (type, width and height)
|
|
4863
|
+
* @throws {@link ImagesError} with code 9412 if input is not an image
|
|
4864
|
+
* @param stream The image bytes
|
|
4865
|
+
*/
|
|
4866
|
+
info(stream: ReadableStream<Uint8Array>): Promise<InfoResponse>;
|
|
4867
|
+
/**
|
|
4868
|
+
* Begin applying a series of transformations to an image
|
|
4869
|
+
* @param stream The image bytes
|
|
4870
|
+
* @returns A transform handle
|
|
4871
|
+
*/
|
|
4872
|
+
input(stream: ReadableStream<Uint8Array>): ImageTransformer;
|
|
4873
|
+
}
|
|
4874
|
+
export interface ImageTransformer {
|
|
4875
|
+
/**
|
|
4876
|
+
* Apply transform next, returning a transform handle.
|
|
4877
|
+
* You can then apply more transformations or retrieve the output.
|
|
4878
|
+
* @param transform
|
|
4879
|
+
*/
|
|
4880
|
+
transform(transform: Transform): ImageTransformer;
|
|
4881
|
+
/**
|
|
4882
|
+
* Retrieve the image that results from applying the transforms to the
|
|
4883
|
+
* provided input
|
|
4884
|
+
* @param options Options that apply to the output e.g. output format
|
|
4885
|
+
*/
|
|
4886
|
+
output(options: OutputOptions): Promise<TransformationResult>;
|
|
4887
|
+
}
|
|
4888
|
+
export interface TransformationResult {
|
|
4889
|
+
/**
|
|
4890
|
+
* The image as a response, ready to store in cache or return to users
|
|
4891
|
+
*/
|
|
4892
|
+
response(): Response;
|
|
4893
|
+
/**
|
|
4894
|
+
* The content type of the returned image
|
|
4895
|
+
*/
|
|
4896
|
+
contentType(): string;
|
|
4897
|
+
/**
|
|
4898
|
+
* The bytes of the response
|
|
4899
|
+
*/
|
|
4900
|
+
image(): ReadableStream<Uint8Array>;
|
|
4901
|
+
}
|
|
4902
|
+
export interface ImagesError extends Error {
|
|
4903
|
+
readonly code: number;
|
|
4904
|
+
readonly message: string;
|
|
4905
|
+
readonly stack?: string;
|
|
4906
|
+
}
|
|
4785
4907
|
export type Params<P extends string = any> = Record<P, string | string[]>;
|
|
4786
4908
|
export type EventContext<Env, P extends string, Data> = {
|
|
4787
4909
|
request: Request<unknown, IncomingRequestCfProperties<unknown>>;
|
|
@@ -4885,6 +5007,7 @@ export declare namespace Rpc {
|
|
|
4885
5007
|
export const __RPC_TARGET_BRAND: "__RPC_TARGET_BRAND";
|
|
4886
5008
|
export const __WORKER_ENTRYPOINT_BRAND: "__WORKER_ENTRYPOINT_BRAND";
|
|
4887
5009
|
export const __DURABLE_OBJECT_BRAND: "__DURABLE_OBJECT_BRAND";
|
|
5010
|
+
export const __WORKFLOW_BRAND: "__WORKFLOW_BRAND";
|
|
4888
5011
|
export interface RpcTargetBranded {
|
|
4889
5012
|
[__RPC_TARGET_BRAND]: never;
|
|
4890
5013
|
}
|
|
@@ -4894,9 +5017,13 @@ export declare namespace Rpc {
|
|
|
4894
5017
|
export interface DurableObjectBranded {
|
|
4895
5018
|
[__DURABLE_OBJECT_BRAND]: never;
|
|
4896
5019
|
}
|
|
5020
|
+
export interface WorkflowBranded {
|
|
5021
|
+
[__WORKFLOW_BRAND]: never;
|
|
5022
|
+
}
|
|
4897
5023
|
export type EntrypointBranded =
|
|
4898
5024
|
| WorkerEntrypointBranded
|
|
4899
|
-
| DurableObjectBranded
|
|
5025
|
+
| DurableObjectBranded
|
|
5026
|
+
| WorkflowBranded;
|
|
4900
5027
|
// Types that can be used through `Stub`s
|
|
4901
5028
|
export type Stubable = RpcTargetBranded | ((...args: any[]) => any);
|
|
4902
5029
|
// Types that can be passed over RPC
|
package/2022-08-04/index.d.ts
CHANGED
|
@@ -4768,6 +4768,128 @@ interface Hyperdrive {
|
|
|
4768
4768
|
*/
|
|
4769
4769
|
readonly database: string;
|
|
4770
4770
|
}
|
|
4771
|
+
// Copyright (c) 2024 Cloudflare, Inc.
|
|
4772
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
4773
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
4774
|
+
type InfoResponse =
|
|
4775
|
+
| {
|
|
4776
|
+
format: "image/svg+xml";
|
|
4777
|
+
}
|
|
4778
|
+
| {
|
|
4779
|
+
format: string;
|
|
4780
|
+
fileSize: number;
|
|
4781
|
+
width: number;
|
|
4782
|
+
height: number;
|
|
4783
|
+
};
|
|
4784
|
+
type Transform = {
|
|
4785
|
+
fit?: "scale-down" | "contain" | "pad" | "squeeze" | "cover" | "crop";
|
|
4786
|
+
gravity?:
|
|
4787
|
+
| "left"
|
|
4788
|
+
| "right"
|
|
4789
|
+
| "top"
|
|
4790
|
+
| "bottom"
|
|
4791
|
+
| "center"
|
|
4792
|
+
| "auto"
|
|
4793
|
+
| "entropy"
|
|
4794
|
+
| "face"
|
|
4795
|
+
| {
|
|
4796
|
+
x?: number;
|
|
4797
|
+
y?: number;
|
|
4798
|
+
mode: "remainder" | "box-center";
|
|
4799
|
+
};
|
|
4800
|
+
trim?: {
|
|
4801
|
+
top?: number;
|
|
4802
|
+
bottom?: number;
|
|
4803
|
+
left?: number;
|
|
4804
|
+
right?: number;
|
|
4805
|
+
width?: number;
|
|
4806
|
+
height?: number;
|
|
4807
|
+
border?:
|
|
4808
|
+
| boolean
|
|
4809
|
+
| {
|
|
4810
|
+
color?: string;
|
|
4811
|
+
tolerance?: number;
|
|
4812
|
+
keep?: number;
|
|
4813
|
+
};
|
|
4814
|
+
};
|
|
4815
|
+
width?: number;
|
|
4816
|
+
height?: number;
|
|
4817
|
+
background?: string;
|
|
4818
|
+
rotate?: number;
|
|
4819
|
+
sharpen?: number;
|
|
4820
|
+
blur?: number;
|
|
4821
|
+
contrast?: number;
|
|
4822
|
+
brightness?: number;
|
|
4823
|
+
gamma?: number;
|
|
4824
|
+
border?: {
|
|
4825
|
+
color?: string;
|
|
4826
|
+
width?: number;
|
|
4827
|
+
top?: number;
|
|
4828
|
+
bottom?: number;
|
|
4829
|
+
left?: number;
|
|
4830
|
+
right?: number;
|
|
4831
|
+
};
|
|
4832
|
+
zoom?: number;
|
|
4833
|
+
};
|
|
4834
|
+
type OutputOptions = {
|
|
4835
|
+
format:
|
|
4836
|
+
| "image/jpeg"
|
|
4837
|
+
| "image/png"
|
|
4838
|
+
| "image/gif"
|
|
4839
|
+
| "image/webp"
|
|
4840
|
+
| "image/avif"
|
|
4841
|
+
| "rgb"
|
|
4842
|
+
| "rgba";
|
|
4843
|
+
quality?: number;
|
|
4844
|
+
background?: string;
|
|
4845
|
+
};
|
|
4846
|
+
interface ImagesBinding {
|
|
4847
|
+
/**
|
|
4848
|
+
* Get image metadata (type, width and height)
|
|
4849
|
+
* @throws {@link ImagesError} with code 9412 if input is not an image
|
|
4850
|
+
* @param stream The image bytes
|
|
4851
|
+
*/
|
|
4852
|
+
info(stream: ReadableStream<Uint8Array>): Promise<InfoResponse>;
|
|
4853
|
+
/**
|
|
4854
|
+
* Begin applying a series of transformations to an image
|
|
4855
|
+
* @param stream The image bytes
|
|
4856
|
+
* @returns A transform handle
|
|
4857
|
+
*/
|
|
4858
|
+
input(stream: ReadableStream<Uint8Array>): ImageTransformer;
|
|
4859
|
+
}
|
|
4860
|
+
interface ImageTransformer {
|
|
4861
|
+
/**
|
|
4862
|
+
* Apply transform next, returning a transform handle.
|
|
4863
|
+
* You can then apply more transformations or retrieve the output.
|
|
4864
|
+
* @param transform
|
|
4865
|
+
*/
|
|
4866
|
+
transform(transform: Transform): ImageTransformer;
|
|
4867
|
+
/**
|
|
4868
|
+
* Retrieve the image that results from applying the transforms to the
|
|
4869
|
+
* provided input
|
|
4870
|
+
* @param options Options that apply to the output e.g. output format
|
|
4871
|
+
*/
|
|
4872
|
+
output(options: OutputOptions): Promise<TransformationResult>;
|
|
4873
|
+
}
|
|
4874
|
+
interface TransformationResult {
|
|
4875
|
+
/**
|
|
4876
|
+
* The image as a response, ready to store in cache or return to users
|
|
4877
|
+
*/
|
|
4878
|
+
response(): Response;
|
|
4879
|
+
/**
|
|
4880
|
+
* The content type of the returned image
|
|
4881
|
+
*/
|
|
4882
|
+
contentType(): string;
|
|
4883
|
+
/**
|
|
4884
|
+
* The bytes of the response
|
|
4885
|
+
*/
|
|
4886
|
+
image(): ReadableStream<Uint8Array>;
|
|
4887
|
+
}
|
|
4888
|
+
interface ImagesError extends Error {
|
|
4889
|
+
readonly code: number;
|
|
4890
|
+
readonly message: string;
|
|
4891
|
+
readonly stack?: string;
|
|
4892
|
+
}
|
|
4771
4893
|
type Params<P extends string = any> = Record<P, string | string[]>;
|
|
4772
4894
|
type EventContext<Env, P extends string, Data> = {
|
|
4773
4895
|
request: Request<unknown, IncomingRequestCfProperties<unknown>>;
|
|
@@ -4874,6 +4996,7 @@ declare namespace Rpc {
|
|
|
4874
4996
|
export const __RPC_TARGET_BRAND: "__RPC_TARGET_BRAND";
|
|
4875
4997
|
export const __WORKER_ENTRYPOINT_BRAND: "__WORKER_ENTRYPOINT_BRAND";
|
|
4876
4998
|
export const __DURABLE_OBJECT_BRAND: "__DURABLE_OBJECT_BRAND";
|
|
4999
|
+
export const __WORKFLOW_BRAND: "__WORKFLOW_BRAND";
|
|
4877
5000
|
export interface RpcTargetBranded {
|
|
4878
5001
|
[__RPC_TARGET_BRAND]: never;
|
|
4879
5002
|
}
|
|
@@ -4883,9 +5006,13 @@ declare namespace Rpc {
|
|
|
4883
5006
|
export interface DurableObjectBranded {
|
|
4884
5007
|
[__DURABLE_OBJECT_BRAND]: never;
|
|
4885
5008
|
}
|
|
5009
|
+
export interface WorkflowBranded {
|
|
5010
|
+
[__WORKFLOW_BRAND]: never;
|
|
5011
|
+
}
|
|
4886
5012
|
export type EntrypointBranded =
|
|
4887
5013
|
| WorkerEntrypointBranded
|
|
4888
|
-
| DurableObjectBranded
|
|
5014
|
+
| DurableObjectBranded
|
|
5015
|
+
| WorkflowBranded;
|
|
4889
5016
|
// Types that can be used through `Stub`s
|
|
4890
5017
|
export type Stubable = RpcTargetBranded | ((...args: any[]) => any);
|
|
4891
5018
|
// Types that can be passed over RPC
|
|
@@ -5055,6 +5182,38 @@ declare module "cloudflare:workers" {
|
|
|
5055
5182
|
): void | Promise<void>;
|
|
5056
5183
|
webSocketError?(ws: WebSocket, error: unknown): void | Promise<void>;
|
|
5057
5184
|
}
|
|
5185
|
+
export type DurationLabel =
|
|
5186
|
+
| "second"
|
|
5187
|
+
| "minute"
|
|
5188
|
+
| "hour"
|
|
5189
|
+
| "day"
|
|
5190
|
+
| "week"
|
|
5191
|
+
| "month"
|
|
5192
|
+
| "year";
|
|
5193
|
+
export type SleepDuration = `${number} ${DurationLabel}${"s" | ""}` | number;
|
|
5194
|
+
type WorkflowStep = {
|
|
5195
|
+
do: <T extends Rpc.Serializable>(
|
|
5196
|
+
name: string,
|
|
5197
|
+
callback: () => T,
|
|
5198
|
+
) => T | Promise<T>;
|
|
5199
|
+
sleep: (name: string, duration: SleepDuration) => void | Promise<void>;
|
|
5200
|
+
};
|
|
5201
|
+
export abstract class Workflow<
|
|
5202
|
+
Env = unknown,
|
|
5203
|
+
T extends Rpc.Serializable | unknown = unknown,
|
|
5204
|
+
> implements Rpc.WorkflowBranded
|
|
5205
|
+
{
|
|
5206
|
+
[Rpc.__WORKFLOW_BRAND]: never;
|
|
5207
|
+
protected ctx: ExecutionContext;
|
|
5208
|
+
protected env: Env;
|
|
5209
|
+
run(
|
|
5210
|
+
events: Array<{
|
|
5211
|
+
payload: T;
|
|
5212
|
+
timestamp: Date;
|
|
5213
|
+
}>,
|
|
5214
|
+
step: WorkflowStep,
|
|
5215
|
+
): unknown | Promise<unknown>;
|
|
5216
|
+
}
|
|
5058
5217
|
}
|
|
5059
5218
|
declare module "cloudflare:sockets" {
|
|
5060
5219
|
function _connect(
|
package/2022-08-04/index.ts
CHANGED
|
@@ -4783,6 +4783,128 @@ export interface Hyperdrive {
|
|
|
4783
4783
|
*/
|
|
4784
4784
|
readonly database: string;
|
|
4785
4785
|
}
|
|
4786
|
+
// Copyright (c) 2024 Cloudflare, Inc.
|
|
4787
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
4788
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
4789
|
+
export type InfoResponse =
|
|
4790
|
+
| {
|
|
4791
|
+
format: "image/svg+xml";
|
|
4792
|
+
}
|
|
4793
|
+
| {
|
|
4794
|
+
format: string;
|
|
4795
|
+
fileSize: number;
|
|
4796
|
+
width: number;
|
|
4797
|
+
height: number;
|
|
4798
|
+
};
|
|
4799
|
+
export type Transform = {
|
|
4800
|
+
fit?: "scale-down" | "contain" | "pad" | "squeeze" | "cover" | "crop";
|
|
4801
|
+
gravity?:
|
|
4802
|
+
| "left"
|
|
4803
|
+
| "right"
|
|
4804
|
+
| "top"
|
|
4805
|
+
| "bottom"
|
|
4806
|
+
| "center"
|
|
4807
|
+
| "auto"
|
|
4808
|
+
| "entropy"
|
|
4809
|
+
| "face"
|
|
4810
|
+
| {
|
|
4811
|
+
x?: number;
|
|
4812
|
+
y?: number;
|
|
4813
|
+
mode: "remainder" | "box-center";
|
|
4814
|
+
};
|
|
4815
|
+
trim?: {
|
|
4816
|
+
top?: number;
|
|
4817
|
+
bottom?: number;
|
|
4818
|
+
left?: number;
|
|
4819
|
+
right?: number;
|
|
4820
|
+
width?: number;
|
|
4821
|
+
height?: number;
|
|
4822
|
+
border?:
|
|
4823
|
+
| boolean
|
|
4824
|
+
| {
|
|
4825
|
+
color?: string;
|
|
4826
|
+
tolerance?: number;
|
|
4827
|
+
keep?: number;
|
|
4828
|
+
};
|
|
4829
|
+
};
|
|
4830
|
+
width?: number;
|
|
4831
|
+
height?: number;
|
|
4832
|
+
background?: string;
|
|
4833
|
+
rotate?: number;
|
|
4834
|
+
sharpen?: number;
|
|
4835
|
+
blur?: number;
|
|
4836
|
+
contrast?: number;
|
|
4837
|
+
brightness?: number;
|
|
4838
|
+
gamma?: number;
|
|
4839
|
+
border?: {
|
|
4840
|
+
color?: string;
|
|
4841
|
+
width?: number;
|
|
4842
|
+
top?: number;
|
|
4843
|
+
bottom?: number;
|
|
4844
|
+
left?: number;
|
|
4845
|
+
right?: number;
|
|
4846
|
+
};
|
|
4847
|
+
zoom?: number;
|
|
4848
|
+
};
|
|
4849
|
+
export type OutputOptions = {
|
|
4850
|
+
format:
|
|
4851
|
+
| "image/jpeg"
|
|
4852
|
+
| "image/png"
|
|
4853
|
+
| "image/gif"
|
|
4854
|
+
| "image/webp"
|
|
4855
|
+
| "image/avif"
|
|
4856
|
+
| "rgb"
|
|
4857
|
+
| "rgba";
|
|
4858
|
+
quality?: number;
|
|
4859
|
+
background?: string;
|
|
4860
|
+
};
|
|
4861
|
+
export interface ImagesBinding {
|
|
4862
|
+
/**
|
|
4863
|
+
* Get image metadata (type, width and height)
|
|
4864
|
+
* @throws {@link ImagesError} with code 9412 if input is not an image
|
|
4865
|
+
* @param stream The image bytes
|
|
4866
|
+
*/
|
|
4867
|
+
info(stream: ReadableStream<Uint8Array>): Promise<InfoResponse>;
|
|
4868
|
+
/**
|
|
4869
|
+
* Begin applying a series of transformations to an image
|
|
4870
|
+
* @param stream The image bytes
|
|
4871
|
+
* @returns A transform handle
|
|
4872
|
+
*/
|
|
4873
|
+
input(stream: ReadableStream<Uint8Array>): ImageTransformer;
|
|
4874
|
+
}
|
|
4875
|
+
export interface ImageTransformer {
|
|
4876
|
+
/**
|
|
4877
|
+
* Apply transform next, returning a transform handle.
|
|
4878
|
+
* You can then apply more transformations or retrieve the output.
|
|
4879
|
+
* @param transform
|
|
4880
|
+
*/
|
|
4881
|
+
transform(transform: Transform): ImageTransformer;
|
|
4882
|
+
/**
|
|
4883
|
+
* Retrieve the image that results from applying the transforms to the
|
|
4884
|
+
* provided input
|
|
4885
|
+
* @param options Options that apply to the output e.g. output format
|
|
4886
|
+
*/
|
|
4887
|
+
output(options: OutputOptions): Promise<TransformationResult>;
|
|
4888
|
+
}
|
|
4889
|
+
export interface TransformationResult {
|
|
4890
|
+
/**
|
|
4891
|
+
* The image as a response, ready to store in cache or return to users
|
|
4892
|
+
*/
|
|
4893
|
+
response(): Response;
|
|
4894
|
+
/**
|
|
4895
|
+
* The content type of the returned image
|
|
4896
|
+
*/
|
|
4897
|
+
contentType(): string;
|
|
4898
|
+
/**
|
|
4899
|
+
* The bytes of the response
|
|
4900
|
+
*/
|
|
4901
|
+
image(): ReadableStream<Uint8Array>;
|
|
4902
|
+
}
|
|
4903
|
+
export interface ImagesError extends Error {
|
|
4904
|
+
readonly code: number;
|
|
4905
|
+
readonly message: string;
|
|
4906
|
+
readonly stack?: string;
|
|
4907
|
+
}
|
|
4786
4908
|
export type Params<P extends string = any> = Record<P, string | string[]>;
|
|
4787
4909
|
export type EventContext<Env, P extends string, Data> = {
|
|
4788
4910
|
request: Request<unknown, IncomingRequestCfProperties<unknown>>;
|
|
@@ -4886,6 +5008,7 @@ export declare namespace Rpc {
|
|
|
4886
5008
|
export const __RPC_TARGET_BRAND: "__RPC_TARGET_BRAND";
|
|
4887
5009
|
export const __WORKER_ENTRYPOINT_BRAND: "__WORKER_ENTRYPOINT_BRAND";
|
|
4888
5010
|
export const __DURABLE_OBJECT_BRAND: "__DURABLE_OBJECT_BRAND";
|
|
5011
|
+
export const __WORKFLOW_BRAND: "__WORKFLOW_BRAND";
|
|
4889
5012
|
export interface RpcTargetBranded {
|
|
4890
5013
|
[__RPC_TARGET_BRAND]: never;
|
|
4891
5014
|
}
|
|
@@ -4895,9 +5018,13 @@ export declare namespace Rpc {
|
|
|
4895
5018
|
export interface DurableObjectBranded {
|
|
4896
5019
|
[__DURABLE_OBJECT_BRAND]: never;
|
|
4897
5020
|
}
|
|
5021
|
+
export interface WorkflowBranded {
|
|
5022
|
+
[__WORKFLOW_BRAND]: never;
|
|
5023
|
+
}
|
|
4898
5024
|
export type EntrypointBranded =
|
|
4899
5025
|
| WorkerEntrypointBranded
|
|
4900
|
-
| DurableObjectBranded
|
|
5026
|
+
| DurableObjectBranded
|
|
5027
|
+
| WorkflowBranded;
|
|
4901
5028
|
// Types that can be used through `Stub`s
|
|
4902
5029
|
export type Stubable = RpcTargetBranded | ((...args: any[]) => any);
|
|
4903
5030
|
// Types that can be passed over RPC
|