effect-cf 0.26.0 → 0.27.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/CHANGELOG.md +6 -0
- package/README.md +8 -6
- package/dist/Artifacts-BhWrdyqX.mjs +241 -0
- package/dist/ComputerArtifacts.d.mts +55 -0
- package/dist/ComputerArtifacts.mjs +95 -0
- package/dist/ComputerWorkspace.d.mts +279 -0
- package/dist/ComputerWorkspace.mjs +545 -0
- package/dist/{DurableObjectState-CEh0DVw7.mjs → DurableObjectState-Dux8KfjG.mjs} +3 -48
- package/dist/{WorkflowBinding-D5iWzCUa.d.mts → DurableObjectState-biHrHwrh.d.mts} +7 -81
- package/dist/ErrorMessage-_lg53p3W.mjs +49 -0
- package/dist/Vitest.d.mts +2 -1
- package/dist/Vitest.mjs +2 -1
- package/dist/WorkflowBinding-zlRPCXVf.d.mts +79 -0
- package/dist/index.d.mts +15 -343
- package/dist/index.mjs +66 -946
- package/package.json +12 -1
- package/src/index.ts +0 -2
|
@@ -379,7 +379,7 @@ declare const encodeSuccess: <const Self extends Definition$3.Any, MethodName ex
|
|
|
379
379
|
declare const decodeSuccess: <const Self extends Definition$3.Any, MethodName extends Definition$3.MethodNames<Self>>(definition: Self, methodName: MethodName, value: unknown) => Effect.Effect<Method$2.Success<Self["methods"][MethodName]>, RpcSuccessDecodeError>;
|
|
380
380
|
declare const make$3: <Id extends string, const MethodsShape extends Methods$1>(id: Id, methods: MethodsShape) => Definition$3<Id, MethodsShape>;
|
|
381
381
|
declare namespace QueueBinding_d_exports {
|
|
382
|
-
export { MessageSendRequest, QueueBindingClient, QueueBindingDefinition, QueueMetrics, QueueOperationError, QueueProducer, QueueSendBatchOptions, QueueSendBatchResponse, QueueSendOptions, QueueSendResponse, isQueue, layer$
|
|
382
|
+
export { MessageSendRequest, QueueBindingClient, QueueBindingDefinition, QueueMetrics, QueueOperationError, QueueProducer, QueueSendBatchOptions, QueueSendBatchResponse, QueueSendOptions, QueueSendResponse, isQueue, layer$1 as layer, makeClient$1 as makeClient };
|
|
383
383
|
}
|
|
384
384
|
type QueueSendOptions = CloudflareQueueSendOptions;
|
|
385
385
|
type QueueSendResponse = CloudflareQueueSendResponse;
|
|
@@ -410,8 +410,8 @@ declare class QueueOperationError extends QueueOperationError_base<{
|
|
|
410
410
|
readonly message: string;
|
|
411
411
|
}> {}
|
|
412
412
|
declare const isQueue: <Body>(value: unknown) => value is QueueProducer<Body>;
|
|
413
|
-
declare const makeClient$
|
|
414
|
-
declare const layer$
|
|
413
|
+
declare const makeClient$1: <Message extends ServiceFreeSchema$1>(definition: QueueBindingDefinition<Message>) => ((queue: QueueProducer<Schema.Codec.Encoded<Message>>) => QueueBindingClient<Message>);
|
|
414
|
+
declare const layer$1: <Self, Message extends ServiceFreeSchema$1>(tag: Context.Service<Self, QueueBindingClient<Message>>, definition: QueueBindingDefinition<Message>) => import("effect/Layer").Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
415
415
|
declare namespace QueueDefinition_d_exports {
|
|
416
416
|
export { Definition$2 as Definition, Handler$1 as Handler, LayerOptions$2 as LayerOptions, Options$2 as Options, Queue$1 as Queue, Tag$2 as Tag, TagClass$2 as TagClass, implement$2 as implement, make$2 as make };
|
|
417
417
|
}
|
|
@@ -516,7 +516,7 @@ type AsyncMethodArgs<Api, Method extends keyof Api> = Api[Method] extends ((...a
|
|
|
516
516
|
type AsyncMethodSuccess<Api, Method extends keyof Api> = Api[Method] extends ((...args: AnyArgs) => Promise<infer A>) ? A : never;
|
|
517
517
|
type AsyncMethodCloudflareReturn<Api, Method extends keyof Api> = Result$1<AsyncMethodSuccess<Api, Method>>;
|
|
518
518
|
declare namespace ServiceBinding_d_exports {
|
|
519
|
-
export { Service, ServiceBindingClient, ServiceBindingDefinition, ServiceBindingEffectClient, ServiceBindingFetchError, ServiceBindingRpcError, ServiceBindingStaticClient, ServiceFetcher, isServiceBindingClient, layer
|
|
519
|
+
export { Service, ServiceBindingClient, ServiceBindingDefinition, ServiceBindingEffectClient, ServiceBindingFetchError, ServiceBindingRpcError, ServiceBindingStaticClient, ServiceFetcher, isServiceBindingClient, layer, makeClient, makeDirectMethods };
|
|
520
520
|
}
|
|
521
521
|
declare const TypeId: "effect-cf/ServiceBinding";
|
|
522
522
|
/**
|
|
@@ -666,8 +666,8 @@ type ServiceBindingStaticClient<R, Api extends object, Definition$7 extends Defi
|
|
|
666
666
|
readonly scopedCall: <Method extends ServiceMethodKey<Api>>(method: Method, ...args: ServiceMethodArgs<Api, Method>) => Effect.Effect<Awaited<ServiceMethodSuccess<Api, Method>>, unknown, Scope.Scope | R>;
|
|
667
667
|
};
|
|
668
668
|
declare const isServiceBindingClient: <Api extends object>(value: unknown) => value is ServiceBindingClient<Api>;
|
|
669
|
-
declare const makeClient
|
|
670
|
-
declare const layer
|
|
669
|
+
declare const makeClient: <Api extends object, const Definition$8 extends Definition.Any | undefined = undefined>(definition: ServiceBindingDefinition<Definition$8>) => ((service: ServiceBindingClient<Api>) => ServiceBindingEffectClient<Api, Definition$8>);
|
|
670
|
+
declare const layer: <Self, Api extends object, const Definition$12 extends Definition.Any | undefined = undefined>(tag: Context.Service<Self, ServiceBindingEffectClient<Api, Definition$12>>, definition: ServiceBindingDefinition<Definition$12>) => import("effect/Layer").Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
671
671
|
/**
|
|
672
672
|
* Creates a typed Effect service for a Worker service binding.
|
|
673
673
|
*
|
|
@@ -1008,79 +1008,5 @@ declare class DurableObjectState extends DurableObjectState_base {}
|
|
|
1008
1008
|
* Wraps a native Cloudflare `DurableObjectState` as a {@link DurableObjectStateService}.
|
|
1009
1009
|
*/
|
|
1010
1010
|
declare const fromDurableObjectState: (state: globalThis.DurableObjectState) => DurableObjectStateService;
|
|
1011
|
-
declare namespace WorkflowBinding_d_exports {
|
|
1012
|
-
export { WorkflowBindingClient, WorkflowBindingDefinition, WorkflowInstance, WorkflowInstanceCreateBatchOptions, WorkflowInstanceCreateOptions, WorkflowInstanceEvent, WorkflowInstanceRestartOptions, WorkflowInstanceStatus, WorkflowInstanceStatusName, WorkflowOperationError, WorkflowResultDecodeError, isWorkflow, layer, makeClient };
|
|
1013
|
-
}
|
|
1014
|
-
type WorkflowInstanceCreateOptions<Payload> = Omit<CloudflareWorkflowInstanceCreateOptions<Payload>, "params">;
|
|
1015
|
-
type WorkflowInstanceCreateBatchOptions<Payload, EncodedPayload = unknown> = ReadonlyArray<{
|
|
1016
|
-
readonly payload: Payload;
|
|
1017
|
-
} & WorkflowInstanceCreateOptions<EncodedPayload>>;
|
|
1018
|
-
interface WorkflowInstanceRestartOptions {
|
|
1019
|
-
readonly from?: {
|
|
1020
|
-
readonly name?: string;
|
|
1021
|
-
readonly count?: number;
|
|
1022
|
-
readonly type?: string;
|
|
1023
|
-
};
|
|
1024
|
-
}
|
|
1025
|
-
type WorkflowInstanceStatusName = CloudflareInstanceStatus["status"];
|
|
1026
|
-
interface WorkflowInstanceStatus<Result> {
|
|
1027
|
-
readonly status: WorkflowInstanceStatusName;
|
|
1028
|
-
readonly output: Option.Option<Result>;
|
|
1029
|
-
readonly error: Option.Option<{
|
|
1030
|
-
readonly name: string;
|
|
1031
|
-
readonly message: string;
|
|
1032
|
-
}>;
|
|
1033
|
-
}
|
|
1034
|
-
interface WorkflowInstance<Result> {
|
|
1035
|
-
readonly raw: CloudflareWorkflowInstance;
|
|
1036
|
-
readonly id: string;
|
|
1037
|
-
readonly pause: Effect.Effect<void, WorkflowOperationError>;
|
|
1038
|
-
readonly resume: Effect.Effect<void, WorkflowOperationError>;
|
|
1039
|
-
readonly terminate: Effect.Effect<void, WorkflowOperationError>;
|
|
1040
|
-
readonly restart: (options?: WorkflowInstanceRestartOptions) => Effect.Effect<void, WorkflowOperationError>;
|
|
1041
|
-
readonly status: Effect.Effect<WorkflowInstanceStatus<Result>, WorkflowOperationError | WorkflowResultDecodeError>;
|
|
1042
|
-
readonly sendEvent: (event: WorkflowInstanceEvent) => Effect.Effect<void, WorkflowOperationError>;
|
|
1043
|
-
}
|
|
1044
|
-
interface WorkflowInstanceEvent {
|
|
1045
|
-
readonly type: string;
|
|
1046
|
-
readonly payload: unknown;
|
|
1047
|
-
}
|
|
1048
|
-
interface WorkflowBindingDefinition<Payload extends ServiceFreeSchema$1, Result extends ServiceFreeSchema$1> {
|
|
1049
|
-
/** Binding name as configured in `wrangler.jsonc`. */
|
|
1050
|
-
readonly binding: string;
|
|
1051
|
-
/** Codec used to encode payloads passed to `Workflow.create`. */
|
|
1052
|
-
readonly payload: Payload;
|
|
1053
|
-
/** Codec used to decode completed workflow status output. */
|
|
1054
|
-
readonly result: Result;
|
|
1055
|
-
}
|
|
1056
|
-
interface WorkflowBindingClient<Payload extends ServiceFreeSchema$1, Result extends ServiceFreeSchema$1> {
|
|
1057
|
-
readonly create: (payload: Schema.Schema.Type<Payload>, options?: WorkflowInstanceCreateOptions<Schema.Codec.Encoded<Payload>>) => Effect.Effect<WorkflowInstance<Schema.Schema.Type<Result>>, WorkflowOperationError | Schema.SchemaError>;
|
|
1058
|
-
readonly createBatch: (batch: WorkflowInstanceCreateBatchOptions<Schema.Schema.Type<Payload>, Schema.Codec.Encoded<Payload>>) => Effect.Effect<ReadonlyArray<WorkflowInstance<Schema.Schema.Type<Result>>>, WorkflowOperationError | Schema.SchemaError>;
|
|
1059
|
-
readonly get: (instanceId: string) => Effect.Effect<WorkflowInstance<Schema.Schema.Type<Result>>, WorkflowOperationError>;
|
|
1060
|
-
readonly rawUnsafe: Effect.Effect<CloudflareWorkflow<Schema.Codec.Encoded<Payload>>>;
|
|
1061
|
-
}
|
|
1062
|
-
declare const WorkflowOperationError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
1063
|
-
readonly _tag: "WorkflowOperationError";
|
|
1064
|
-
} & Readonly<A>;
|
|
1065
|
-
declare class WorkflowOperationError extends WorkflowOperationError_base<{
|
|
1066
|
-
readonly binding: string;
|
|
1067
|
-
readonly operation: string;
|
|
1068
|
-
readonly cause: unknown;
|
|
1069
|
-
}> {
|
|
1070
|
-
get message(): string;
|
|
1071
|
-
}
|
|
1072
|
-
declare const WorkflowResultDecodeError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
1073
|
-
readonly _tag: "WorkflowResultDecodeError";
|
|
1074
|
-
} & Readonly<A>;
|
|
1075
|
-
declare class WorkflowResultDecodeError extends WorkflowResultDecodeError_base<{
|
|
1076
|
-
readonly binding: string;
|
|
1077
|
-
readonly instanceId: string;
|
|
1078
|
-
readonly cause: unknown;
|
|
1079
|
-
}> {
|
|
1080
|
-
get message(): string;
|
|
1081
|
-
}
|
|
1082
|
-
declare const isWorkflow: <Payload>(value: unknown) => value is CloudflareWorkflow<Payload>;
|
|
1083
|
-
declare const makeClient: <Payload extends ServiceFreeSchema$1, Result extends ServiceFreeSchema$1>(definition: WorkflowBindingDefinition<Payload, Result>) => ((workflow: CloudflareWorkflow<Schema.Codec.Encoded<Payload>>) => WorkflowBindingClient<Payload, Result>);
|
|
1084
|
-
declare const layer: <Self, Payload extends ServiceFreeSchema$1, Result extends ServiceFreeSchema$1>(tag: Context.Service<Self, WorkflowBindingClient<Payload, Result>>, definition: WorkflowBindingDefinition<Payload, Result>) => import("effect/Layer").Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
1085
1011
|
//#endregion
|
|
1086
|
-
export { Rpc_d_exports as
|
|
1012
|
+
export { Rpc_d_exports as C, StorageOperationError as D, DurableObjectStorage_d_exports as E, Provider as S, DurableWebSocket as T, Definition$3 as _, NativeRequest as a, RpcDefinition_d_exports as b, WorkerDefinition_d_exports as c, AsyncMethodCloudflareReturn as d, AsyncMethodKey as f, QueueBinding_d_exports as g, QueueDefinition_d_exports as h, ExecutionContext as i, ServiceBinding_d_exports as l, Queue_d_exports as m, DurableObjectStateService as n, WorkerContext as o, AsyncMethodSuccess as p, DurableObjectState_d_exports as r, Worker_d_exports as s, DurableObjectState as t, AsyncMethodArgs as u, Method$2 as v, DurableObjectWebSocket_d_exports as w, ServiceFreeSchema$1 as x, ReservedMethodName$3 as y };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
|
|
2
|
+
import { Config, ConfigProvider, Context, Effect, Predicate } from "effect";
|
|
3
|
+
//#region src/Environment.ts
|
|
4
|
+
var Environment_exports = /* @__PURE__ */ __exportAll({
|
|
5
|
+
WorkerConfig: () => WorkerConfig,
|
|
6
|
+
WorkerEnvironment: () => WorkerEnvironment
|
|
7
|
+
});
|
|
8
|
+
/**
|
|
9
|
+
* Context service for reading worker bindings from the current `env` object.
|
|
10
|
+
*/
|
|
11
|
+
var WorkerEnvironment = class extends Context.Service()("effect-cf/WorkerEnvironment") {};
|
|
12
|
+
let WorkerConfig;
|
|
13
|
+
(function(_WorkerConfig) {
|
|
14
|
+
_WorkerConfig.string = (name) => Config.string(name);
|
|
15
|
+
_WorkerConfig.redacted = (name) => Config.redacted(name);
|
|
16
|
+
_WorkerConfig.number = (name) => Config.number(name);
|
|
17
|
+
_WorkerConfig.integer = (name) => Config.int(name);
|
|
18
|
+
_WorkerConfig.boolean = (name) => Config.boolean(name);
|
|
19
|
+
const providerFromEnv = _WorkerConfig.providerFromEnv = (env, options) => {
|
|
20
|
+
const record = {};
|
|
21
|
+
for (const [key, value] of Object.entries(env)) if (Predicate.isString(value) || Predicate.isNumber(value) || Predicate.isBoolean(value)) record[key] = String(value);
|
|
22
|
+
return ConfigProvider.fromEnvRecord(record, options);
|
|
23
|
+
};
|
|
24
|
+
const providerWith = _WorkerConfig.providerWith = (makeProvider) => Effect.map(WorkerEnvironment, makeProvider);
|
|
25
|
+
const provider = _WorkerConfig.provider = providerWith(providerFromEnv);
|
|
26
|
+
_WorkerConfig.providerLayer = ConfigProvider.layer(provider);
|
|
27
|
+
_WorkerConfig.layerWith = (makeProvider) => ConfigProvider.layer(providerWith(makeProvider));
|
|
28
|
+
})(WorkerConfig || (WorkerConfig = {}));
|
|
29
|
+
//#endregion
|
|
30
|
+
//#region src/internal/ErrorMessage.ts
|
|
31
|
+
/**
|
|
32
|
+
* Renders the most useful human-readable description of an unknown `cause`
|
|
33
|
+
* for use in tagged error `message` getters.
|
|
34
|
+
*/
|
|
35
|
+
const causeMessage = (cause) => {
|
|
36
|
+
if (typeof cause === "object" && cause !== null) {
|
|
37
|
+
const message = Reflect.get(cause, "message");
|
|
38
|
+
if (typeof message === "string" && message.length > 0) return message;
|
|
39
|
+
}
|
|
40
|
+
try {
|
|
41
|
+
return String(cause);
|
|
42
|
+
} catch {
|
|
43
|
+
return "unknown cause";
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
/** Renders a violation list as a single `path: message; ...` line. */
|
|
47
|
+
const violationsMessage = (violations) => violations.map((violation) => `${violation.path}: ${violation.message}`).join("; ");
|
|
48
|
+
//#endregion
|
|
49
|
+
export { WorkerEnvironment as a, WorkerConfig as i, violationsMessage as n, Environment_exports as r, causeMessage as t };
|
package/dist/Vitest.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { c as WorkerEnvironment, s as WorkerEnv } from "./Binding-COCtoJXa.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { n as DurableObjectStateService, t as DurableObjectState } from "./DurableObjectState-biHrHwrh.mjs";
|
|
3
|
+
import { o as WorkflowInstanceStatusName } from "./WorkflowBinding-zlRPCXVf.mjs";
|
|
3
4
|
import { Effect, Layer } from "effect";
|
|
4
5
|
import { DurableObject } from "cloudflare:workers";
|
|
5
6
|
import { adminSecretsStore as adminSecretsStore$1, getQueueResult, introspectWorkflow as introspectWorkflow$1, introspectWorkflowInstance as introspectWorkflowInstance$1 } from "cloudflare:test";
|
package/dist/Vitest.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as WorkerEnvironment, i as WorkerConfig } from "./ErrorMessage-_lg53p3W.mjs";
|
|
2
|
+
import { r as fromDurableObjectState, t as DurableObjectState } from "./DurableObjectState-Dux8KfjG.mjs";
|
|
2
3
|
import { ConfigProvider, Effect, Exit, Layer } from "effect";
|
|
3
4
|
import { env } from "cloudflare:workers";
|
|
4
5
|
import { abortAllDurableObjects as abortAllDurableObjects$1, adminSecretsStore as adminSecretsStore$1, applyD1Migrations as applyD1Migrations$1, createExecutionContext, createMessageBatch, createPagesEventContext, createScheduledController, evictAllDurableObjects as evictAllDurableObjects$1, evictDurableObject as evictDurableObject$1, getQueueResult, introspectWorkflow as introspectWorkflow$1, introspectWorkflowInstance as introspectWorkflowInstance$1, listDurableObjectIds as listDurableObjectIds$1, reset as reset$1, runDurableObjectAlarm as runDurableObjectAlarm$1, runInDurableObject as runInDurableObject$1, waitOnExecutionContext } from "cloudflare:test";
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { c as WorkerEnvironment, r as BindingValidationError, t as BindingNotFoundError } from "./Binding-COCtoJXa.mjs";
|
|
2
|
+
import { x as ServiceFreeSchema } from "./DurableObjectState-biHrHwrh.mjs";
|
|
3
|
+
import { Context, Effect, Option, Schema } from "effect";
|
|
4
|
+
declare namespace WorkflowBinding_d_exports {
|
|
5
|
+
export { WorkflowBindingClient, WorkflowBindingDefinition, WorkflowInstance, WorkflowInstanceCreateBatchOptions, WorkflowInstanceCreateOptions, WorkflowInstanceEvent, WorkflowInstanceRestartOptions, WorkflowInstanceStatus, WorkflowInstanceStatusName, WorkflowOperationError, WorkflowResultDecodeError, isWorkflow, layer, makeClient };
|
|
6
|
+
}
|
|
7
|
+
type WorkflowInstanceCreateOptions<Payload> = Omit<CloudflareWorkflowInstanceCreateOptions<Payload>, "params">;
|
|
8
|
+
type WorkflowInstanceCreateBatchOptions<Payload, EncodedPayload = unknown> = ReadonlyArray<{
|
|
9
|
+
readonly payload: Payload;
|
|
10
|
+
} & WorkflowInstanceCreateOptions<EncodedPayload>>;
|
|
11
|
+
interface WorkflowInstanceRestartOptions {
|
|
12
|
+
readonly from?: {
|
|
13
|
+
readonly name?: string;
|
|
14
|
+
readonly count?: number;
|
|
15
|
+
readonly type?: string;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
type WorkflowInstanceStatusName = CloudflareInstanceStatus["status"];
|
|
19
|
+
interface WorkflowInstanceStatus<Result> {
|
|
20
|
+
readonly status: WorkflowInstanceStatusName;
|
|
21
|
+
readonly output: Option.Option<Result>;
|
|
22
|
+
readonly error: Option.Option<{
|
|
23
|
+
readonly name: string;
|
|
24
|
+
readonly message: string;
|
|
25
|
+
}>;
|
|
26
|
+
}
|
|
27
|
+
interface WorkflowInstance<Result> {
|
|
28
|
+
readonly raw: CloudflareWorkflowInstance;
|
|
29
|
+
readonly id: string;
|
|
30
|
+
readonly pause: Effect.Effect<void, WorkflowOperationError>;
|
|
31
|
+
readonly resume: Effect.Effect<void, WorkflowOperationError>;
|
|
32
|
+
readonly terminate: Effect.Effect<void, WorkflowOperationError>;
|
|
33
|
+
readonly restart: (options?: WorkflowInstanceRestartOptions) => Effect.Effect<void, WorkflowOperationError>;
|
|
34
|
+
readonly status: Effect.Effect<WorkflowInstanceStatus<Result>, WorkflowOperationError | WorkflowResultDecodeError>;
|
|
35
|
+
readonly sendEvent: (event: WorkflowInstanceEvent) => Effect.Effect<void, WorkflowOperationError>;
|
|
36
|
+
}
|
|
37
|
+
interface WorkflowInstanceEvent {
|
|
38
|
+
readonly type: string;
|
|
39
|
+
readonly payload: unknown;
|
|
40
|
+
}
|
|
41
|
+
interface WorkflowBindingDefinition<Payload extends ServiceFreeSchema, Result extends ServiceFreeSchema> {
|
|
42
|
+
/** Binding name as configured in `wrangler.jsonc`. */
|
|
43
|
+
readonly binding: string;
|
|
44
|
+
/** Codec used to encode payloads passed to `Workflow.create`. */
|
|
45
|
+
readonly payload: Payload;
|
|
46
|
+
/** Codec used to decode completed workflow status output. */
|
|
47
|
+
readonly result: Result;
|
|
48
|
+
}
|
|
49
|
+
interface WorkflowBindingClient<Payload extends ServiceFreeSchema, Result extends ServiceFreeSchema> {
|
|
50
|
+
readonly create: (payload: Schema.Schema.Type<Payload>, options?: WorkflowInstanceCreateOptions<Schema.Codec.Encoded<Payload>>) => Effect.Effect<WorkflowInstance<Schema.Schema.Type<Result>>, WorkflowOperationError | Schema.SchemaError>;
|
|
51
|
+
readonly createBatch: (batch: WorkflowInstanceCreateBatchOptions<Schema.Schema.Type<Payload>, Schema.Codec.Encoded<Payload>>) => Effect.Effect<ReadonlyArray<WorkflowInstance<Schema.Schema.Type<Result>>>, WorkflowOperationError | Schema.SchemaError>;
|
|
52
|
+
readonly get: (instanceId: string) => Effect.Effect<WorkflowInstance<Schema.Schema.Type<Result>>, WorkflowOperationError>;
|
|
53
|
+
readonly rawUnsafe: Effect.Effect<CloudflareWorkflow<Schema.Codec.Encoded<Payload>>>;
|
|
54
|
+
}
|
|
55
|
+
declare const WorkflowOperationError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
56
|
+
readonly _tag: "WorkflowOperationError";
|
|
57
|
+
} & Readonly<A>;
|
|
58
|
+
declare class WorkflowOperationError extends WorkflowOperationError_base<{
|
|
59
|
+
readonly binding: string;
|
|
60
|
+
readonly operation: string;
|
|
61
|
+
readonly cause: unknown;
|
|
62
|
+
}> {
|
|
63
|
+
get message(): string;
|
|
64
|
+
}
|
|
65
|
+
declare const WorkflowResultDecodeError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
66
|
+
readonly _tag: "WorkflowResultDecodeError";
|
|
67
|
+
} & Readonly<A>;
|
|
68
|
+
declare class WorkflowResultDecodeError extends WorkflowResultDecodeError_base<{
|
|
69
|
+
readonly binding: string;
|
|
70
|
+
readonly instanceId: string;
|
|
71
|
+
readonly cause: unknown;
|
|
72
|
+
}> {
|
|
73
|
+
get message(): string;
|
|
74
|
+
}
|
|
75
|
+
declare const isWorkflow: <Payload>(value: unknown) => value is CloudflareWorkflow<Payload>;
|
|
76
|
+
declare const makeClient: <Payload extends ServiceFreeSchema, Result extends ServiceFreeSchema>(definition: WorkflowBindingDefinition<Payload, Result>) => ((workflow: CloudflareWorkflow<Schema.Codec.Encoded<Payload>>) => WorkflowBindingClient<Payload, Result>);
|
|
77
|
+
declare const layer: <Self, Payload extends ServiceFreeSchema, Result extends ServiceFreeSchema>(tag: Context.Service<Self, WorkflowBindingClient<Payload, Result>>, definition: WorkflowBindingDefinition<Payload, Result>) => import("effect/Layer").Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
78
|
+
//#endregion
|
|
79
|
+
export { WorkflowInstanceCreateOptions as a, WorkflowInstanceCreateBatchOptions as i, WorkflowBinding_d_exports as n, WorkflowInstanceStatusName as o, WorkflowInstance as r, WorkflowOperationError as s, WorkflowBindingClient as t };
|