@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/2021-11-03/index.d.ts
CHANGED
|
@@ -4717,6 +4717,128 @@ interface Hyperdrive {
|
|
|
4717
4717
|
*/
|
|
4718
4718
|
readonly database: string;
|
|
4719
4719
|
}
|
|
4720
|
+
// Copyright (c) 2024 Cloudflare, Inc.
|
|
4721
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
4722
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
4723
|
+
type InfoResponse =
|
|
4724
|
+
| {
|
|
4725
|
+
format: "image/svg+xml";
|
|
4726
|
+
}
|
|
4727
|
+
| {
|
|
4728
|
+
format: string;
|
|
4729
|
+
fileSize: number;
|
|
4730
|
+
width: number;
|
|
4731
|
+
height: number;
|
|
4732
|
+
};
|
|
4733
|
+
type Transform = {
|
|
4734
|
+
fit?: "scale-down" | "contain" | "pad" | "squeeze" | "cover" | "crop";
|
|
4735
|
+
gravity?:
|
|
4736
|
+
| "left"
|
|
4737
|
+
| "right"
|
|
4738
|
+
| "top"
|
|
4739
|
+
| "bottom"
|
|
4740
|
+
| "center"
|
|
4741
|
+
| "auto"
|
|
4742
|
+
| "entropy"
|
|
4743
|
+
| "face"
|
|
4744
|
+
| {
|
|
4745
|
+
x?: number;
|
|
4746
|
+
y?: number;
|
|
4747
|
+
mode: "remainder" | "box-center";
|
|
4748
|
+
};
|
|
4749
|
+
trim?: {
|
|
4750
|
+
top?: number;
|
|
4751
|
+
bottom?: number;
|
|
4752
|
+
left?: number;
|
|
4753
|
+
right?: number;
|
|
4754
|
+
width?: number;
|
|
4755
|
+
height?: number;
|
|
4756
|
+
border?:
|
|
4757
|
+
| boolean
|
|
4758
|
+
| {
|
|
4759
|
+
color?: string;
|
|
4760
|
+
tolerance?: number;
|
|
4761
|
+
keep?: number;
|
|
4762
|
+
};
|
|
4763
|
+
};
|
|
4764
|
+
width?: number;
|
|
4765
|
+
height?: number;
|
|
4766
|
+
background?: string;
|
|
4767
|
+
rotate?: number;
|
|
4768
|
+
sharpen?: number;
|
|
4769
|
+
blur?: number;
|
|
4770
|
+
contrast?: number;
|
|
4771
|
+
brightness?: number;
|
|
4772
|
+
gamma?: number;
|
|
4773
|
+
border?: {
|
|
4774
|
+
color?: string;
|
|
4775
|
+
width?: number;
|
|
4776
|
+
top?: number;
|
|
4777
|
+
bottom?: number;
|
|
4778
|
+
left?: number;
|
|
4779
|
+
right?: number;
|
|
4780
|
+
};
|
|
4781
|
+
zoom?: number;
|
|
4782
|
+
};
|
|
4783
|
+
type OutputOptions = {
|
|
4784
|
+
format:
|
|
4785
|
+
| "image/jpeg"
|
|
4786
|
+
| "image/png"
|
|
4787
|
+
| "image/gif"
|
|
4788
|
+
| "image/webp"
|
|
4789
|
+
| "image/avif"
|
|
4790
|
+
| "rgb"
|
|
4791
|
+
| "rgba";
|
|
4792
|
+
quality?: number;
|
|
4793
|
+
background?: string;
|
|
4794
|
+
};
|
|
4795
|
+
interface ImagesBinding {
|
|
4796
|
+
/**
|
|
4797
|
+
* Get image metadata (type, width and height)
|
|
4798
|
+
* @throws {@link ImagesError} with code 9412 if input is not an image
|
|
4799
|
+
* @param stream The image bytes
|
|
4800
|
+
*/
|
|
4801
|
+
info(stream: ReadableStream<Uint8Array>): Promise<InfoResponse>;
|
|
4802
|
+
/**
|
|
4803
|
+
* Begin applying a series of transformations to an image
|
|
4804
|
+
* @param stream The image bytes
|
|
4805
|
+
* @returns A transform handle
|
|
4806
|
+
*/
|
|
4807
|
+
input(stream: ReadableStream<Uint8Array>): ImageTransformer;
|
|
4808
|
+
}
|
|
4809
|
+
interface ImageTransformer {
|
|
4810
|
+
/**
|
|
4811
|
+
* Apply transform next, returning a transform handle.
|
|
4812
|
+
* You can then apply more transformations or retrieve the output.
|
|
4813
|
+
* @param transform
|
|
4814
|
+
*/
|
|
4815
|
+
transform(transform: Transform): ImageTransformer;
|
|
4816
|
+
/**
|
|
4817
|
+
* Retrieve the image that results from applying the transforms to the
|
|
4818
|
+
* provided input
|
|
4819
|
+
* @param options Options that apply to the output e.g. output format
|
|
4820
|
+
*/
|
|
4821
|
+
output(options: OutputOptions): Promise<TransformationResult>;
|
|
4822
|
+
}
|
|
4823
|
+
interface TransformationResult {
|
|
4824
|
+
/**
|
|
4825
|
+
* The image as a response, ready to store in cache or return to users
|
|
4826
|
+
*/
|
|
4827
|
+
response(): Response;
|
|
4828
|
+
/**
|
|
4829
|
+
* The content type of the returned image
|
|
4830
|
+
*/
|
|
4831
|
+
contentType(): string;
|
|
4832
|
+
/**
|
|
4833
|
+
* The bytes of the response
|
|
4834
|
+
*/
|
|
4835
|
+
image(): ReadableStream<Uint8Array>;
|
|
4836
|
+
}
|
|
4837
|
+
interface ImagesError extends Error {
|
|
4838
|
+
readonly code: number;
|
|
4839
|
+
readonly message: string;
|
|
4840
|
+
readonly stack?: string;
|
|
4841
|
+
}
|
|
4720
4842
|
type Params<P extends string = any> = Record<P, string | string[]>;
|
|
4721
4843
|
type EventContext<Env, P extends string, Data> = {
|
|
4722
4844
|
request: Request<unknown, IncomingRequestCfProperties<unknown>>;
|
|
@@ -4823,6 +4945,7 @@ declare namespace Rpc {
|
|
|
4823
4945
|
export const __RPC_TARGET_BRAND: "__RPC_TARGET_BRAND";
|
|
4824
4946
|
export const __WORKER_ENTRYPOINT_BRAND: "__WORKER_ENTRYPOINT_BRAND";
|
|
4825
4947
|
export const __DURABLE_OBJECT_BRAND: "__DURABLE_OBJECT_BRAND";
|
|
4948
|
+
export const __WORKFLOW_BRAND: "__WORKFLOW_BRAND";
|
|
4826
4949
|
export interface RpcTargetBranded {
|
|
4827
4950
|
[__RPC_TARGET_BRAND]: never;
|
|
4828
4951
|
}
|
|
@@ -4832,9 +4955,13 @@ declare namespace Rpc {
|
|
|
4832
4955
|
export interface DurableObjectBranded {
|
|
4833
4956
|
[__DURABLE_OBJECT_BRAND]: never;
|
|
4834
4957
|
}
|
|
4958
|
+
export interface WorkflowBranded {
|
|
4959
|
+
[__WORKFLOW_BRAND]: never;
|
|
4960
|
+
}
|
|
4835
4961
|
export type EntrypointBranded =
|
|
4836
4962
|
| WorkerEntrypointBranded
|
|
4837
|
-
| DurableObjectBranded
|
|
4963
|
+
| DurableObjectBranded
|
|
4964
|
+
| WorkflowBranded;
|
|
4838
4965
|
// Types that can be used through `Stub`s
|
|
4839
4966
|
export type Stubable = RpcTargetBranded | ((...args: any[]) => any);
|
|
4840
4967
|
// Types that can be passed over RPC
|
|
@@ -5004,6 +5131,38 @@ declare module "cloudflare:workers" {
|
|
|
5004
5131
|
): void | Promise<void>;
|
|
5005
5132
|
webSocketError?(ws: WebSocket, error: unknown): void | Promise<void>;
|
|
5006
5133
|
}
|
|
5134
|
+
export type DurationLabel =
|
|
5135
|
+
| "second"
|
|
5136
|
+
| "minute"
|
|
5137
|
+
| "hour"
|
|
5138
|
+
| "day"
|
|
5139
|
+
| "week"
|
|
5140
|
+
| "month"
|
|
5141
|
+
| "year";
|
|
5142
|
+
export type SleepDuration = `${number} ${DurationLabel}${"s" | ""}` | number;
|
|
5143
|
+
type WorkflowStep = {
|
|
5144
|
+
do: <T extends Rpc.Serializable>(
|
|
5145
|
+
name: string,
|
|
5146
|
+
callback: () => T,
|
|
5147
|
+
) => T | Promise<T>;
|
|
5148
|
+
sleep: (name: string, duration: SleepDuration) => void | Promise<void>;
|
|
5149
|
+
};
|
|
5150
|
+
export abstract class Workflow<
|
|
5151
|
+
Env = unknown,
|
|
5152
|
+
T extends Rpc.Serializable | unknown = unknown,
|
|
5153
|
+
> implements Rpc.WorkflowBranded
|
|
5154
|
+
{
|
|
5155
|
+
[Rpc.__WORKFLOW_BRAND]: never;
|
|
5156
|
+
protected ctx: ExecutionContext;
|
|
5157
|
+
protected env: Env;
|
|
5158
|
+
run(
|
|
5159
|
+
events: Array<{
|
|
5160
|
+
payload: T;
|
|
5161
|
+
timestamp: Date;
|
|
5162
|
+
}>,
|
|
5163
|
+
step: WorkflowStep,
|
|
5164
|
+
): unknown | Promise<unknown>;
|
|
5165
|
+
}
|
|
5007
5166
|
}
|
|
5008
5167
|
declare module "cloudflare:sockets" {
|
|
5009
5168
|
function _connect(
|
package/2021-11-03/index.ts
CHANGED
|
@@ -4732,6 +4732,128 @@ export interface Hyperdrive {
|
|
|
4732
4732
|
*/
|
|
4733
4733
|
readonly database: string;
|
|
4734
4734
|
}
|
|
4735
|
+
// Copyright (c) 2024 Cloudflare, Inc.
|
|
4736
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
4737
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
4738
|
+
export type InfoResponse =
|
|
4739
|
+
| {
|
|
4740
|
+
format: "image/svg+xml";
|
|
4741
|
+
}
|
|
4742
|
+
| {
|
|
4743
|
+
format: string;
|
|
4744
|
+
fileSize: number;
|
|
4745
|
+
width: number;
|
|
4746
|
+
height: number;
|
|
4747
|
+
};
|
|
4748
|
+
export type Transform = {
|
|
4749
|
+
fit?: "scale-down" | "contain" | "pad" | "squeeze" | "cover" | "crop";
|
|
4750
|
+
gravity?:
|
|
4751
|
+
| "left"
|
|
4752
|
+
| "right"
|
|
4753
|
+
| "top"
|
|
4754
|
+
| "bottom"
|
|
4755
|
+
| "center"
|
|
4756
|
+
| "auto"
|
|
4757
|
+
| "entropy"
|
|
4758
|
+
| "face"
|
|
4759
|
+
| {
|
|
4760
|
+
x?: number;
|
|
4761
|
+
y?: number;
|
|
4762
|
+
mode: "remainder" | "box-center";
|
|
4763
|
+
};
|
|
4764
|
+
trim?: {
|
|
4765
|
+
top?: number;
|
|
4766
|
+
bottom?: number;
|
|
4767
|
+
left?: number;
|
|
4768
|
+
right?: number;
|
|
4769
|
+
width?: number;
|
|
4770
|
+
height?: number;
|
|
4771
|
+
border?:
|
|
4772
|
+
| boolean
|
|
4773
|
+
| {
|
|
4774
|
+
color?: string;
|
|
4775
|
+
tolerance?: number;
|
|
4776
|
+
keep?: number;
|
|
4777
|
+
};
|
|
4778
|
+
};
|
|
4779
|
+
width?: number;
|
|
4780
|
+
height?: number;
|
|
4781
|
+
background?: string;
|
|
4782
|
+
rotate?: number;
|
|
4783
|
+
sharpen?: number;
|
|
4784
|
+
blur?: number;
|
|
4785
|
+
contrast?: number;
|
|
4786
|
+
brightness?: number;
|
|
4787
|
+
gamma?: number;
|
|
4788
|
+
border?: {
|
|
4789
|
+
color?: string;
|
|
4790
|
+
width?: number;
|
|
4791
|
+
top?: number;
|
|
4792
|
+
bottom?: number;
|
|
4793
|
+
left?: number;
|
|
4794
|
+
right?: number;
|
|
4795
|
+
};
|
|
4796
|
+
zoom?: number;
|
|
4797
|
+
};
|
|
4798
|
+
export type OutputOptions = {
|
|
4799
|
+
format:
|
|
4800
|
+
| "image/jpeg"
|
|
4801
|
+
| "image/png"
|
|
4802
|
+
| "image/gif"
|
|
4803
|
+
| "image/webp"
|
|
4804
|
+
| "image/avif"
|
|
4805
|
+
| "rgb"
|
|
4806
|
+
| "rgba";
|
|
4807
|
+
quality?: number;
|
|
4808
|
+
background?: string;
|
|
4809
|
+
};
|
|
4810
|
+
export interface ImagesBinding {
|
|
4811
|
+
/**
|
|
4812
|
+
* Get image metadata (type, width and height)
|
|
4813
|
+
* @throws {@link ImagesError} with code 9412 if input is not an image
|
|
4814
|
+
* @param stream The image bytes
|
|
4815
|
+
*/
|
|
4816
|
+
info(stream: ReadableStream<Uint8Array>): Promise<InfoResponse>;
|
|
4817
|
+
/**
|
|
4818
|
+
* Begin applying a series of transformations to an image
|
|
4819
|
+
* @param stream The image bytes
|
|
4820
|
+
* @returns A transform handle
|
|
4821
|
+
*/
|
|
4822
|
+
input(stream: ReadableStream<Uint8Array>): ImageTransformer;
|
|
4823
|
+
}
|
|
4824
|
+
export interface ImageTransformer {
|
|
4825
|
+
/**
|
|
4826
|
+
* Apply transform next, returning a transform handle.
|
|
4827
|
+
* You can then apply more transformations or retrieve the output.
|
|
4828
|
+
* @param transform
|
|
4829
|
+
*/
|
|
4830
|
+
transform(transform: Transform): ImageTransformer;
|
|
4831
|
+
/**
|
|
4832
|
+
* Retrieve the image that results from applying the transforms to the
|
|
4833
|
+
* provided input
|
|
4834
|
+
* @param options Options that apply to the output e.g. output format
|
|
4835
|
+
*/
|
|
4836
|
+
output(options: OutputOptions): Promise<TransformationResult>;
|
|
4837
|
+
}
|
|
4838
|
+
export interface TransformationResult {
|
|
4839
|
+
/**
|
|
4840
|
+
* The image as a response, ready to store in cache or return to users
|
|
4841
|
+
*/
|
|
4842
|
+
response(): Response;
|
|
4843
|
+
/**
|
|
4844
|
+
* The content type of the returned image
|
|
4845
|
+
*/
|
|
4846
|
+
contentType(): string;
|
|
4847
|
+
/**
|
|
4848
|
+
* The bytes of the response
|
|
4849
|
+
*/
|
|
4850
|
+
image(): ReadableStream<Uint8Array>;
|
|
4851
|
+
}
|
|
4852
|
+
export interface ImagesError extends Error {
|
|
4853
|
+
readonly code: number;
|
|
4854
|
+
readonly message: string;
|
|
4855
|
+
readonly stack?: string;
|
|
4856
|
+
}
|
|
4735
4857
|
export type Params<P extends string = any> = Record<P, string | string[]>;
|
|
4736
4858
|
export type EventContext<Env, P extends string, Data> = {
|
|
4737
4859
|
request: Request<unknown, IncomingRequestCfProperties<unknown>>;
|
|
@@ -4835,6 +4957,7 @@ export declare namespace Rpc {
|
|
|
4835
4957
|
export const __RPC_TARGET_BRAND: "__RPC_TARGET_BRAND";
|
|
4836
4958
|
export const __WORKER_ENTRYPOINT_BRAND: "__WORKER_ENTRYPOINT_BRAND";
|
|
4837
4959
|
export const __DURABLE_OBJECT_BRAND: "__DURABLE_OBJECT_BRAND";
|
|
4960
|
+
export const __WORKFLOW_BRAND: "__WORKFLOW_BRAND";
|
|
4838
4961
|
export interface RpcTargetBranded {
|
|
4839
4962
|
[__RPC_TARGET_BRAND]: never;
|
|
4840
4963
|
}
|
|
@@ -4844,9 +4967,13 @@ export declare namespace Rpc {
|
|
|
4844
4967
|
export interface DurableObjectBranded {
|
|
4845
4968
|
[__DURABLE_OBJECT_BRAND]: never;
|
|
4846
4969
|
}
|
|
4970
|
+
export interface WorkflowBranded {
|
|
4971
|
+
[__WORKFLOW_BRAND]: never;
|
|
4972
|
+
}
|
|
4847
4973
|
export type EntrypointBranded =
|
|
4848
4974
|
| WorkerEntrypointBranded
|
|
4849
|
-
| DurableObjectBranded
|
|
4975
|
+
| DurableObjectBranded
|
|
4976
|
+
| WorkflowBranded;
|
|
4850
4977
|
// Types that can be used through `Stub`s
|
|
4851
4978
|
export type Stubable = RpcTargetBranded | ((...args: any[]) => any);
|
|
4852
4979
|
// Types that can be passed over RPC
|
package/2022-01-31/index.d.ts
CHANGED
|
@@ -4743,6 +4743,128 @@ interface Hyperdrive {
|
|
|
4743
4743
|
*/
|
|
4744
4744
|
readonly database: string;
|
|
4745
4745
|
}
|
|
4746
|
+
// Copyright (c) 2024 Cloudflare, Inc.
|
|
4747
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
4748
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
4749
|
+
type InfoResponse =
|
|
4750
|
+
| {
|
|
4751
|
+
format: "image/svg+xml";
|
|
4752
|
+
}
|
|
4753
|
+
| {
|
|
4754
|
+
format: string;
|
|
4755
|
+
fileSize: number;
|
|
4756
|
+
width: number;
|
|
4757
|
+
height: number;
|
|
4758
|
+
};
|
|
4759
|
+
type Transform = {
|
|
4760
|
+
fit?: "scale-down" | "contain" | "pad" | "squeeze" | "cover" | "crop";
|
|
4761
|
+
gravity?:
|
|
4762
|
+
| "left"
|
|
4763
|
+
| "right"
|
|
4764
|
+
| "top"
|
|
4765
|
+
| "bottom"
|
|
4766
|
+
| "center"
|
|
4767
|
+
| "auto"
|
|
4768
|
+
| "entropy"
|
|
4769
|
+
| "face"
|
|
4770
|
+
| {
|
|
4771
|
+
x?: number;
|
|
4772
|
+
y?: number;
|
|
4773
|
+
mode: "remainder" | "box-center";
|
|
4774
|
+
};
|
|
4775
|
+
trim?: {
|
|
4776
|
+
top?: number;
|
|
4777
|
+
bottom?: number;
|
|
4778
|
+
left?: number;
|
|
4779
|
+
right?: number;
|
|
4780
|
+
width?: number;
|
|
4781
|
+
height?: number;
|
|
4782
|
+
border?:
|
|
4783
|
+
| boolean
|
|
4784
|
+
| {
|
|
4785
|
+
color?: string;
|
|
4786
|
+
tolerance?: number;
|
|
4787
|
+
keep?: number;
|
|
4788
|
+
};
|
|
4789
|
+
};
|
|
4790
|
+
width?: number;
|
|
4791
|
+
height?: number;
|
|
4792
|
+
background?: string;
|
|
4793
|
+
rotate?: number;
|
|
4794
|
+
sharpen?: number;
|
|
4795
|
+
blur?: number;
|
|
4796
|
+
contrast?: number;
|
|
4797
|
+
brightness?: number;
|
|
4798
|
+
gamma?: number;
|
|
4799
|
+
border?: {
|
|
4800
|
+
color?: string;
|
|
4801
|
+
width?: number;
|
|
4802
|
+
top?: number;
|
|
4803
|
+
bottom?: number;
|
|
4804
|
+
left?: number;
|
|
4805
|
+
right?: number;
|
|
4806
|
+
};
|
|
4807
|
+
zoom?: number;
|
|
4808
|
+
};
|
|
4809
|
+
type OutputOptions = {
|
|
4810
|
+
format:
|
|
4811
|
+
| "image/jpeg"
|
|
4812
|
+
| "image/png"
|
|
4813
|
+
| "image/gif"
|
|
4814
|
+
| "image/webp"
|
|
4815
|
+
| "image/avif"
|
|
4816
|
+
| "rgb"
|
|
4817
|
+
| "rgba";
|
|
4818
|
+
quality?: number;
|
|
4819
|
+
background?: string;
|
|
4820
|
+
};
|
|
4821
|
+
interface ImagesBinding {
|
|
4822
|
+
/**
|
|
4823
|
+
* Get image metadata (type, width and height)
|
|
4824
|
+
* @throws {@link ImagesError} with code 9412 if input is not an image
|
|
4825
|
+
* @param stream The image bytes
|
|
4826
|
+
*/
|
|
4827
|
+
info(stream: ReadableStream<Uint8Array>): Promise<InfoResponse>;
|
|
4828
|
+
/**
|
|
4829
|
+
* Begin applying a series of transformations to an image
|
|
4830
|
+
* @param stream The image bytes
|
|
4831
|
+
* @returns A transform handle
|
|
4832
|
+
*/
|
|
4833
|
+
input(stream: ReadableStream<Uint8Array>): ImageTransformer;
|
|
4834
|
+
}
|
|
4835
|
+
interface ImageTransformer {
|
|
4836
|
+
/**
|
|
4837
|
+
* Apply transform next, returning a transform handle.
|
|
4838
|
+
* You can then apply more transformations or retrieve the output.
|
|
4839
|
+
* @param transform
|
|
4840
|
+
*/
|
|
4841
|
+
transform(transform: Transform): ImageTransformer;
|
|
4842
|
+
/**
|
|
4843
|
+
* Retrieve the image that results from applying the transforms to the
|
|
4844
|
+
* provided input
|
|
4845
|
+
* @param options Options that apply to the output e.g. output format
|
|
4846
|
+
*/
|
|
4847
|
+
output(options: OutputOptions): Promise<TransformationResult>;
|
|
4848
|
+
}
|
|
4849
|
+
interface TransformationResult {
|
|
4850
|
+
/**
|
|
4851
|
+
* The image as a response, ready to store in cache or return to users
|
|
4852
|
+
*/
|
|
4853
|
+
response(): Response;
|
|
4854
|
+
/**
|
|
4855
|
+
* The content type of the returned image
|
|
4856
|
+
*/
|
|
4857
|
+
contentType(): string;
|
|
4858
|
+
/**
|
|
4859
|
+
* The bytes of the response
|
|
4860
|
+
*/
|
|
4861
|
+
image(): ReadableStream<Uint8Array>;
|
|
4862
|
+
}
|
|
4863
|
+
interface ImagesError extends Error {
|
|
4864
|
+
readonly code: number;
|
|
4865
|
+
readonly message: string;
|
|
4866
|
+
readonly stack?: string;
|
|
4867
|
+
}
|
|
4746
4868
|
type Params<P extends string = any> = Record<P, string | string[]>;
|
|
4747
4869
|
type EventContext<Env, P extends string, Data> = {
|
|
4748
4870
|
request: Request<unknown, IncomingRequestCfProperties<unknown>>;
|
|
@@ -4849,6 +4971,7 @@ declare namespace Rpc {
|
|
|
4849
4971
|
export const __RPC_TARGET_BRAND: "__RPC_TARGET_BRAND";
|
|
4850
4972
|
export const __WORKER_ENTRYPOINT_BRAND: "__WORKER_ENTRYPOINT_BRAND";
|
|
4851
4973
|
export const __DURABLE_OBJECT_BRAND: "__DURABLE_OBJECT_BRAND";
|
|
4974
|
+
export const __WORKFLOW_BRAND: "__WORKFLOW_BRAND";
|
|
4852
4975
|
export interface RpcTargetBranded {
|
|
4853
4976
|
[__RPC_TARGET_BRAND]: never;
|
|
4854
4977
|
}
|
|
@@ -4858,9 +4981,13 @@ declare namespace Rpc {
|
|
|
4858
4981
|
export interface DurableObjectBranded {
|
|
4859
4982
|
[__DURABLE_OBJECT_BRAND]: never;
|
|
4860
4983
|
}
|
|
4984
|
+
export interface WorkflowBranded {
|
|
4985
|
+
[__WORKFLOW_BRAND]: never;
|
|
4986
|
+
}
|
|
4861
4987
|
export type EntrypointBranded =
|
|
4862
4988
|
| WorkerEntrypointBranded
|
|
4863
|
-
| DurableObjectBranded
|
|
4989
|
+
| DurableObjectBranded
|
|
4990
|
+
| WorkflowBranded;
|
|
4864
4991
|
// Types that can be used through `Stub`s
|
|
4865
4992
|
export type Stubable = RpcTargetBranded | ((...args: any[]) => any);
|
|
4866
4993
|
// Types that can be passed over RPC
|
|
@@ -5030,6 +5157,38 @@ declare module "cloudflare:workers" {
|
|
|
5030
5157
|
): void | Promise<void>;
|
|
5031
5158
|
webSocketError?(ws: WebSocket, error: unknown): void | Promise<void>;
|
|
5032
5159
|
}
|
|
5160
|
+
export type DurationLabel =
|
|
5161
|
+
| "second"
|
|
5162
|
+
| "minute"
|
|
5163
|
+
| "hour"
|
|
5164
|
+
| "day"
|
|
5165
|
+
| "week"
|
|
5166
|
+
| "month"
|
|
5167
|
+
| "year";
|
|
5168
|
+
export type SleepDuration = `${number} ${DurationLabel}${"s" | ""}` | number;
|
|
5169
|
+
type WorkflowStep = {
|
|
5170
|
+
do: <T extends Rpc.Serializable>(
|
|
5171
|
+
name: string,
|
|
5172
|
+
callback: () => T,
|
|
5173
|
+
) => T | Promise<T>;
|
|
5174
|
+
sleep: (name: string, duration: SleepDuration) => void | Promise<void>;
|
|
5175
|
+
};
|
|
5176
|
+
export abstract class Workflow<
|
|
5177
|
+
Env = unknown,
|
|
5178
|
+
T extends Rpc.Serializable | unknown = unknown,
|
|
5179
|
+
> implements Rpc.WorkflowBranded
|
|
5180
|
+
{
|
|
5181
|
+
[Rpc.__WORKFLOW_BRAND]: never;
|
|
5182
|
+
protected ctx: ExecutionContext;
|
|
5183
|
+
protected env: Env;
|
|
5184
|
+
run(
|
|
5185
|
+
events: Array<{
|
|
5186
|
+
payload: T;
|
|
5187
|
+
timestamp: Date;
|
|
5188
|
+
}>,
|
|
5189
|
+
step: WorkflowStep,
|
|
5190
|
+
): unknown | Promise<unknown>;
|
|
5191
|
+
}
|
|
5033
5192
|
}
|
|
5034
5193
|
declare module "cloudflare:sockets" {
|
|
5035
5194
|
function _connect(
|
package/2022-01-31/index.ts
CHANGED
|
@@ -4758,6 +4758,128 @@ export interface Hyperdrive {
|
|
|
4758
4758
|
*/
|
|
4759
4759
|
readonly database: string;
|
|
4760
4760
|
}
|
|
4761
|
+
// Copyright (c) 2024 Cloudflare, Inc.
|
|
4762
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
4763
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
4764
|
+
export type InfoResponse =
|
|
4765
|
+
| {
|
|
4766
|
+
format: "image/svg+xml";
|
|
4767
|
+
}
|
|
4768
|
+
| {
|
|
4769
|
+
format: string;
|
|
4770
|
+
fileSize: number;
|
|
4771
|
+
width: number;
|
|
4772
|
+
height: number;
|
|
4773
|
+
};
|
|
4774
|
+
export type Transform = {
|
|
4775
|
+
fit?: "scale-down" | "contain" | "pad" | "squeeze" | "cover" | "crop";
|
|
4776
|
+
gravity?:
|
|
4777
|
+
| "left"
|
|
4778
|
+
| "right"
|
|
4779
|
+
| "top"
|
|
4780
|
+
| "bottom"
|
|
4781
|
+
| "center"
|
|
4782
|
+
| "auto"
|
|
4783
|
+
| "entropy"
|
|
4784
|
+
| "face"
|
|
4785
|
+
| {
|
|
4786
|
+
x?: number;
|
|
4787
|
+
y?: number;
|
|
4788
|
+
mode: "remainder" | "box-center";
|
|
4789
|
+
};
|
|
4790
|
+
trim?: {
|
|
4791
|
+
top?: number;
|
|
4792
|
+
bottom?: number;
|
|
4793
|
+
left?: number;
|
|
4794
|
+
right?: number;
|
|
4795
|
+
width?: number;
|
|
4796
|
+
height?: number;
|
|
4797
|
+
border?:
|
|
4798
|
+
| boolean
|
|
4799
|
+
| {
|
|
4800
|
+
color?: string;
|
|
4801
|
+
tolerance?: number;
|
|
4802
|
+
keep?: number;
|
|
4803
|
+
};
|
|
4804
|
+
};
|
|
4805
|
+
width?: number;
|
|
4806
|
+
height?: number;
|
|
4807
|
+
background?: string;
|
|
4808
|
+
rotate?: number;
|
|
4809
|
+
sharpen?: number;
|
|
4810
|
+
blur?: number;
|
|
4811
|
+
contrast?: number;
|
|
4812
|
+
brightness?: number;
|
|
4813
|
+
gamma?: number;
|
|
4814
|
+
border?: {
|
|
4815
|
+
color?: string;
|
|
4816
|
+
width?: number;
|
|
4817
|
+
top?: number;
|
|
4818
|
+
bottom?: number;
|
|
4819
|
+
left?: number;
|
|
4820
|
+
right?: number;
|
|
4821
|
+
};
|
|
4822
|
+
zoom?: number;
|
|
4823
|
+
};
|
|
4824
|
+
export type OutputOptions = {
|
|
4825
|
+
format:
|
|
4826
|
+
| "image/jpeg"
|
|
4827
|
+
| "image/png"
|
|
4828
|
+
| "image/gif"
|
|
4829
|
+
| "image/webp"
|
|
4830
|
+
| "image/avif"
|
|
4831
|
+
| "rgb"
|
|
4832
|
+
| "rgba";
|
|
4833
|
+
quality?: number;
|
|
4834
|
+
background?: string;
|
|
4835
|
+
};
|
|
4836
|
+
export interface ImagesBinding {
|
|
4837
|
+
/**
|
|
4838
|
+
* Get image metadata (type, width and height)
|
|
4839
|
+
* @throws {@link ImagesError} with code 9412 if input is not an image
|
|
4840
|
+
* @param stream The image bytes
|
|
4841
|
+
*/
|
|
4842
|
+
info(stream: ReadableStream<Uint8Array>): Promise<InfoResponse>;
|
|
4843
|
+
/**
|
|
4844
|
+
* Begin applying a series of transformations to an image
|
|
4845
|
+
* @param stream The image bytes
|
|
4846
|
+
* @returns A transform handle
|
|
4847
|
+
*/
|
|
4848
|
+
input(stream: ReadableStream<Uint8Array>): ImageTransformer;
|
|
4849
|
+
}
|
|
4850
|
+
export interface ImageTransformer {
|
|
4851
|
+
/**
|
|
4852
|
+
* Apply transform next, returning a transform handle.
|
|
4853
|
+
* You can then apply more transformations or retrieve the output.
|
|
4854
|
+
* @param transform
|
|
4855
|
+
*/
|
|
4856
|
+
transform(transform: Transform): ImageTransformer;
|
|
4857
|
+
/**
|
|
4858
|
+
* Retrieve the image that results from applying the transforms to the
|
|
4859
|
+
* provided input
|
|
4860
|
+
* @param options Options that apply to the output e.g. output format
|
|
4861
|
+
*/
|
|
4862
|
+
output(options: OutputOptions): Promise<TransformationResult>;
|
|
4863
|
+
}
|
|
4864
|
+
export interface TransformationResult {
|
|
4865
|
+
/**
|
|
4866
|
+
* The image as a response, ready to store in cache or return to users
|
|
4867
|
+
*/
|
|
4868
|
+
response(): Response;
|
|
4869
|
+
/**
|
|
4870
|
+
* The content type of the returned image
|
|
4871
|
+
*/
|
|
4872
|
+
contentType(): string;
|
|
4873
|
+
/**
|
|
4874
|
+
* The bytes of the response
|
|
4875
|
+
*/
|
|
4876
|
+
image(): ReadableStream<Uint8Array>;
|
|
4877
|
+
}
|
|
4878
|
+
export interface ImagesError extends Error {
|
|
4879
|
+
readonly code: number;
|
|
4880
|
+
readonly message: string;
|
|
4881
|
+
readonly stack?: string;
|
|
4882
|
+
}
|
|
4761
4883
|
export type Params<P extends string = any> = Record<P, string | string[]>;
|
|
4762
4884
|
export type EventContext<Env, P extends string, Data> = {
|
|
4763
4885
|
request: Request<unknown, IncomingRequestCfProperties<unknown>>;
|
|
@@ -4861,6 +4983,7 @@ export declare namespace Rpc {
|
|
|
4861
4983
|
export const __RPC_TARGET_BRAND: "__RPC_TARGET_BRAND";
|
|
4862
4984
|
export const __WORKER_ENTRYPOINT_BRAND: "__WORKER_ENTRYPOINT_BRAND";
|
|
4863
4985
|
export const __DURABLE_OBJECT_BRAND: "__DURABLE_OBJECT_BRAND";
|
|
4986
|
+
export const __WORKFLOW_BRAND: "__WORKFLOW_BRAND";
|
|
4864
4987
|
export interface RpcTargetBranded {
|
|
4865
4988
|
[__RPC_TARGET_BRAND]: never;
|
|
4866
4989
|
}
|
|
@@ -4870,9 +4993,13 @@ export declare namespace Rpc {
|
|
|
4870
4993
|
export interface DurableObjectBranded {
|
|
4871
4994
|
[__DURABLE_OBJECT_BRAND]: never;
|
|
4872
4995
|
}
|
|
4996
|
+
export interface WorkflowBranded {
|
|
4997
|
+
[__WORKFLOW_BRAND]: never;
|
|
4998
|
+
}
|
|
4873
4999
|
export type EntrypointBranded =
|
|
4874
5000
|
| WorkerEntrypointBranded
|
|
4875
|
-
| DurableObjectBranded
|
|
5001
|
+
| DurableObjectBranded
|
|
5002
|
+
| WorkflowBranded;
|
|
4876
5003
|
// Types that can be used through `Stub`s
|
|
4877
5004
|
export type Stubable = RpcTargetBranded | ((...args: any[]) => any);
|
|
4878
5005
|
// Types that can be passed over RPC
|