@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/oldest/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/oldest/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/package.json
CHANGED