effect-cf 0.41.1 → 0.42.1
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 +24 -0
- package/README.md +28 -0
- package/dist/AiGateway.d.mts +2 -2
- package/dist/AnalyticsEngine.d.mts +2 -2
- package/dist/Artifacts.d.mts +2 -2
- package/dist/BrowserRendering.d.mts +2 -2
- package/dist/ContainerNamespace.d.mts +2 -2
- package/dist/D1.d.mts +9 -12
- package/dist/DurableObject.d.mts +9 -5
- package/dist/DurableObject.mjs +9 -4
- package/dist/DurableObjectDefinition.d.mts +15 -12
- package/dist/DurableObjectDefinition.mjs +5 -3
- package/dist/DurableObjectNamespace.d.mts +10 -8
- package/dist/DurableObjectSqlite.mjs +1 -1
- package/dist/Email.d.mts +2 -2
- package/dist/Hyperdrive.d.mts +2 -2
- package/dist/Images.d.mts +2 -2
- package/dist/Kv.d.mts +2 -2
- package/dist/Queue.d.mts +5 -4
- package/dist/QueueDefinition.d.mts +4 -4
- package/dist/R2.d.mts +2 -2
- package/dist/RpcDefinition.d.mts +26 -12
- package/dist/RpcDefinition.mjs +22 -5
- package/dist/Sandbox.d.mts +1 -1
- package/dist/ServiceBinding.d.mts +17 -18
- package/dist/Vectorize.d.mts +2 -2
- package/dist/Worker.d.mts +5 -3
- package/dist/Worker.mjs +4 -3
- package/dist/WorkerDefinition.d.mts +15 -11
- package/dist/WorkerDefinition.mjs +5 -3
- package/dist/WorkersAi.d.mts +2 -2
- package/dist/Workflow.d.mts +5 -4
- package/dist/WorkflowDefinition.d.mts +4 -4
- package/dist/index.d.mts +2 -2
- package/dist/internal/NativeCallback.mjs +5 -2
- package/package.json +1 -1
- package/src/AiGateway.ts +2 -0
- package/src/AnalyticsEngine.ts +2 -0
- package/src/Artifacts.ts +2 -0
- package/src/BrowserRendering.ts +2 -0
- package/src/ContainerNamespace.ts +2 -0
- package/src/D1.ts +16 -8
- package/src/DurableObject.ts +30 -4
- package/src/DurableObjectDefinition.ts +33 -17
- package/src/DurableObjectNamespace.ts +19 -35
- package/src/Email.ts +2 -0
- package/src/Hyperdrive.ts +2 -0
- package/src/Images.ts +2 -0
- package/src/Kv.ts +2 -0
- package/src/Queue.ts +4 -7
- package/src/QueueDefinition.ts +7 -4
- package/src/R2.ts +2 -0
- package/src/RpcDefinition.ts +64 -25
- package/src/Sandbox.ts +2 -0
- package/src/ServiceBinding.ts +39 -34
- package/src/Vectorize.ts +2 -0
- package/src/Worker.ts +12 -1
- package/src/WorkerDefinition.ts +28 -17
- package/src/WorkersAi.ts +2 -0
- package/src/Workflow.ts +9 -8
- package/src/WorkflowDefinition.ts +12 -4
- package/src/internal/NativeCallback.ts +13 -2
package/dist/R2.d.mts
CHANGED
|
@@ -6,7 +6,7 @@ import * as Schema$1 from "effect/Schema";
|
|
|
6
6
|
import * as Option from "effect/Option";
|
|
7
7
|
import { Layer } from "effect";
|
|
8
8
|
declare namespace R2_d_exports {
|
|
9
|
-
export { LayerOptions, R2Client, R2Definition, R2GetOptions, R2ListOptions, R2MultipartOptions, R2MultipartUploadClient, R2ObjectBodyClient, R2Operation, R2OperationError, R2PutOptions, R2PutValue, R2Service, R2UploadPartOptions, R2UploadPartValue, Tag, TagClass, isR2Bucket, layer, make, makeClient };
|
|
9
|
+
export { BindingNotFoundError, BindingValidationError, LayerOptions, R2Client, R2Definition, R2GetOptions, R2ListOptions, R2MultipartOptions, R2MultipartUploadClient, R2ObjectBodyClient, R2Operation, R2OperationError, R2PutOptions, R2PutValue, R2Service, R2UploadPartOptions, R2UploadPartValue, Tag, TagClass, isR2Bucket, layer, make, makeClient };
|
|
10
10
|
}
|
|
11
11
|
type R2Operation = "head" | "get" | "put" | "delete" | "list" | "createMultipartUpload" | "resumeMultipartUpload" | "uploadPart" | "abortMultipartUpload" | "completeMultipartUpload" | "arrayBuffer" | "bytes" | "text" | "json" | "blob";
|
|
12
12
|
declare const R2OperationError_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 & {
|
|
@@ -86,4 +86,4 @@ declare const layer: <Self>(tag: Context$1.Service<Self, R2Client>, definition:
|
|
|
86
86
|
declare const make: <Id extends string>(id: Id) => TagClass<R2Service<Id>, Id>;
|
|
87
87
|
declare const Tag: <Self>() => <Id extends string>(id: Id) => TagClass<Self, Id>;
|
|
88
88
|
//#endregion
|
|
89
|
-
export { LayerOptions, R2Client, R2Definition, R2GetOptions, R2ListOptions, R2MultipartOptions, R2MultipartUploadClient, R2ObjectBodyClient, R2Operation, R2OperationError, R2PutOptions, R2PutValue, R2Service, R2UploadPartOptions, R2UploadPartValue, R2_d_exports, Tag, TagClass, isR2Bucket, layer, make, makeClient };
|
|
89
|
+
export { type BindingNotFoundError, type BindingValidationError, LayerOptions, R2Client, R2Definition, R2GetOptions, R2ListOptions, R2MultipartOptions, R2MultipartUploadClient, R2ObjectBodyClient, R2Operation, R2OperationError, R2PutOptions, R2PutValue, R2Service, R2UploadPartOptions, R2UploadPartValue, R2_d_exports, Tag, TagClass, isR2Bucket, layer, make, makeClient };
|
package/dist/RpcDefinition.d.mts
CHANGED
|
@@ -2,7 +2,7 @@ import { Provider } from "./Rpc.mjs";
|
|
|
2
2
|
import * as Effect from "effect/Effect";
|
|
3
3
|
import * as S from "effect/Schema";
|
|
4
4
|
declare namespace RpcDefinition_d_exports {
|
|
5
|
-
export { Definition, Method, Methods, NoReservedMethods, ReservedMethodName, RpcArgumentCountError, RpcArgumentDecodeError, RpcArgumentEncodeError, RpcReservedMethodNameError, RpcSuccessDecodeError, RpcSuccessEncodeError, ServiceFreeSchema, WireError, assertNoReservedMethods, decodeArgs, decodeSuccess, decodeWireError, encodeArgs, encodeSuccess, encodeWireError, isWireError, make, method, reservedMethodNames };
|
|
5
|
+
export { Definition, Method, Methods, NativeSchema, NativeSchemaTypeId, NoReservedMethods, ReservedMethodName, RpcArgumentCountError, RpcArgumentDecodeError, RpcArgumentEncodeError, RpcReservedMethodNameError, RpcSchema, RpcSuccessDecodeError, RpcSuccessEncodeError, SchemaType, ServiceFreeSchema, WireEncoded, WireError, assertNoReservedMethods, decodeArgs, decodeSuccess, decodeWireError, encodeArgs, encodeSuccess, encodeWireError, isWireError, make, method, native, reservedMethodNames };
|
|
6
6
|
}
|
|
7
7
|
declare const RpcReservedMethodNameError_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 & {
|
|
8
8
|
readonly _tag: "RpcReservedMethodNameError";
|
|
@@ -72,18 +72,32 @@ declare const reservedMethodNameValues: readonly ["constructor", "fetch", "conne
|
|
|
72
72
|
declare const reservedMethodNames: Set<string>;
|
|
73
73
|
type ReservedMethodName = (typeof reservedMethodNameValues)[number];
|
|
74
74
|
type ServiceFreeSchema = S.Codec<any, any, never, never>;
|
|
75
|
-
|
|
75
|
+
declare const NativeSchemaTypeId: unique symbol;
|
|
76
|
+
/** A schema whose encoded value is passed directly to Workers RPC. */
|
|
77
|
+
interface NativeSchema<Schema extends ServiceFreeSchema = ServiceFreeSchema> {
|
|
78
|
+
readonly [NativeSchemaTypeId]: typeof NativeSchemaTypeId;
|
|
79
|
+
readonly schema: Schema;
|
|
80
|
+
}
|
|
81
|
+
type RpcSchema = ServiceFreeSchema | NativeSchema;
|
|
82
|
+
type SchemaType<Schema extends RpcSchema> = Schema extends NativeSchema<infer Native extends ServiceFreeSchema> ? S.Schema.Type<Native> : Schema extends ServiceFreeSchema ? S.Schema.Type<Schema> : never;
|
|
83
|
+
type WireEncoded<Schema extends RpcSchema> = Schema extends NativeSchema<infer Native extends ServiceFreeSchema> ? S.Codec.Encoded<Native> : S.Json;
|
|
84
|
+
/**
|
|
85
|
+
* Marks a schema to use its declared encoded form directly at the Workers RPC
|
|
86
|
+
* boundary instead of lowering it to canonical JSON.
|
|
87
|
+
*/
|
|
88
|
+
declare const native: <Schema extends ServiceFreeSchema>(schema: Schema) => NativeSchema<Schema>;
|
|
89
|
+
interface Method<Args extends ReadonlyArray<RpcSchema> = ReadonlyArray<RpcSchema>, Success extends RpcSchema = RpcSchema> {
|
|
76
90
|
readonly args: Args;
|
|
77
91
|
readonly success: Success;
|
|
78
92
|
}
|
|
79
93
|
declare namespace Method {
|
|
80
|
-
export type Any = Method<ReadonlyArray<
|
|
81
|
-
type ArgsFromSchemas<Args extends ReadonlyArray<
|
|
82
|
-
type EncodedArgsFromSchemas<Args extends ReadonlyArray<
|
|
94
|
+
export type Any = Method<ReadonlyArray<RpcSchema>, RpcSchema>;
|
|
95
|
+
type ArgsFromSchemas<Args extends ReadonlyArray<RpcSchema>> = Args extends readonly [] ? [] : Args extends readonly [infer Head extends RpcSchema, ...infer Tail extends ReadonlyArray<RpcSchema>] ? [SchemaType<Head>, ...ArgsFromSchemas<Tail>] : Array<SchemaType<Args[number]>>;
|
|
96
|
+
type EncodedArgsFromSchemas<Args extends ReadonlyArray<RpcSchema>> = { [Index in keyof Args]: WireEncoded<Args[Index]>; };
|
|
83
97
|
export type Args<Self extends Any> = ArgsFromSchemas<Self["args"]>;
|
|
84
98
|
export type EncodedArgs<Self extends Any> = EncodedArgsFromSchemas<Self["args"]>;
|
|
85
|
-
export type Success<Self extends Any> =
|
|
86
|
-
export type EncodedSuccess<
|
|
99
|
+
export type Success<Self extends Any> = SchemaType<Self["success"]>;
|
|
100
|
+
export type EncodedSuccess<Self extends Any> = WireEncoded<Self["success"]>;
|
|
87
101
|
export {};
|
|
88
102
|
}
|
|
89
103
|
type Methods = Record<string, Method.Any>;
|
|
@@ -100,17 +114,17 @@ declare namespace Definition {
|
|
|
100
114
|
}
|
|
101
115
|
type ReservedMethodValue = S.Schema.Type<typeof S.Unknown>;
|
|
102
116
|
declare const assertNoReservedMethods: <MethodDefinitions extends Readonly<Record<string, ReservedMethodValue>>>(target: string, methods: MethodDefinitions, reserved: ReadonlySet<string>) => void;
|
|
103
|
-
declare function method<Success extends
|
|
117
|
+
declare function method<Success extends RpcSchema>(definition: {
|
|
104
118
|
readonly success: Success;
|
|
105
119
|
}): Method<readonly [], Success>;
|
|
106
|
-
declare function method<const Args extends ReadonlyArray<
|
|
120
|
+
declare function method<const Args extends ReadonlyArray<RpcSchema>, Success extends RpcSchema>(definition: {
|
|
107
121
|
readonly args: Args;
|
|
108
122
|
readonly success: Success;
|
|
109
123
|
}): Method<Args, Success>;
|
|
110
|
-
declare const decodeArgs: <const Self extends Definition.Any, MethodName extends Definition.MethodNames<Self>>(definition: Self, methodName: MethodName, args: readonly unknown[]) => Effect.Effect<Self["methods"][MethodName]["args"] extends (infer T) ? T extends Self["methods"][MethodName]["args"] ? T extends readonly [] ? [] : T extends readonly [infer Head extends
|
|
111
|
-
declare const encodeArgs: <const Self extends Definition.Any, MethodName extends Definition.MethodNames<Self>>(definition: Self, methodName: MethodName, args: Self["methods"][MethodName]["args"] extends (infer T) ? T extends Self["methods"][MethodName]["args"] ? T extends readonly [] ? [] : T extends readonly [infer Head extends
|
|
124
|
+
declare const decodeArgs: <const Self extends Definition.Any, MethodName extends Definition.MethodNames<Self>>(definition: Self, methodName: MethodName, args: readonly unknown[]) => Effect.Effect<Self["methods"][MethodName]["args"] extends (infer T) ? T extends Self["methods"][MethodName]["args"] ? T extends readonly [] ? [] : T extends readonly [infer Head extends RpcSchema, ...infer Tail extends readonly RpcSchema[]] ? [SchemaType<Head>, ...Tail extends readonly [] ? [] : Tail extends readonly [infer Head extends RpcSchema, ...infer Tail extends readonly RpcSchema[]] ? [SchemaType<Head>, ...Tail extends readonly [] ? [] : Tail extends readonly [infer Head extends RpcSchema, ...infer Tail extends readonly RpcSchema[]] ? [SchemaType<Head>, ...Tail extends readonly [] ? [] : Tail extends readonly [infer Head extends RpcSchema, ...infer Tail extends readonly RpcSchema[]] ? [SchemaType<Head>, ...Tail extends readonly [] ? [] : Tail extends readonly [infer Head extends RpcSchema, ...infer Tail extends readonly RpcSchema[]] ? [SchemaType<Head>, ...Tail extends readonly [] ? [] : Tail extends readonly [infer Head extends RpcSchema, ...infer Tail extends readonly RpcSchema[]] ? [SchemaType<Head>, ...Tail extends readonly [] ? [] : Tail extends readonly [infer Head extends RpcSchema, ...infer Tail extends readonly RpcSchema[]] ? [SchemaType<Head>, ...Tail extends readonly [] ? [] : Tail extends readonly [infer Head extends RpcSchema, ...infer Tail extends readonly RpcSchema[]] ? [SchemaType<Head>, ...Tail extends readonly [] ? [] : Tail extends readonly [infer Head extends RpcSchema, ...infer Tail extends readonly RpcSchema[]] ? [SchemaType<Head>, ...Tail extends readonly [] ? [] : Tail extends readonly [infer Head extends RpcSchema, ...infer Tail extends readonly RpcSchema[]] ? [SchemaType<Head>, ...Tail extends readonly [] ? [] : Tail extends readonly [infer Head extends RpcSchema, ...infer Tail extends readonly RpcSchema[]] ? [SchemaType<Head>, ... /*elided*/ any] : SchemaType<Tail[number]>[]] : SchemaType<Tail[number]>[]] : SchemaType<Tail[number]>[]] : SchemaType<Tail[number]>[]] : SchemaType<Tail[number]>[]] : SchemaType<Tail[number]>[]] : SchemaType<Tail[number]>[]] : SchemaType<Tail[number]>[]] : SchemaType<Tail[number]>[]] : SchemaType<Tail[number]>[]] : SchemaType<T[number]>[] : never : never, RpcArgumentCountError | RpcArgumentDecodeError, never>;
|
|
125
|
+
declare const encodeArgs: <const Self extends Definition.Any, MethodName extends Definition.MethodNames<Self>>(definition: Self, methodName: MethodName, args: Self["methods"][MethodName]["args"] extends (infer T) ? T extends Self["methods"][MethodName]["args"] ? T extends readonly [] ? [] : T extends readonly [infer Head extends RpcSchema, ...infer Tail extends readonly RpcSchema[]] ? [SchemaType<Head>, ...Tail extends readonly [] ? [] : Tail extends readonly [infer Head extends RpcSchema, ...infer Tail extends readonly RpcSchema[]] ? [SchemaType<Head>, ...Tail extends readonly [] ? [] : Tail extends readonly [infer Head extends RpcSchema, ...infer Tail extends readonly RpcSchema[]] ? [SchemaType<Head>, ...Tail extends readonly [] ? [] : Tail extends readonly [infer Head extends RpcSchema, ...infer Tail extends readonly RpcSchema[]] ? [SchemaType<Head>, ...Tail extends readonly [] ? [] : Tail extends readonly [infer Head extends RpcSchema, ...infer Tail extends readonly RpcSchema[]] ? [SchemaType<Head>, ...Tail extends readonly [] ? [] : Tail extends readonly [infer Head extends RpcSchema, ...infer Tail extends readonly RpcSchema[]] ? [SchemaType<Head>, ...Tail extends readonly [] ? [] : Tail extends readonly [infer Head extends RpcSchema, ...infer Tail extends readonly RpcSchema[]] ? [SchemaType<Head>, ...Tail extends readonly [] ? [] : Tail extends readonly [infer Head extends RpcSchema, ...infer Tail extends readonly RpcSchema[]] ? [SchemaType<Head>, ...Tail extends readonly [] ? [] : Tail extends readonly [infer Head extends RpcSchema, ...infer Tail extends readonly RpcSchema[]] ? [SchemaType<Head>, ...Tail extends readonly [] ? [] : Tail extends readonly [infer Head extends RpcSchema, ...infer Tail extends readonly RpcSchema[]] ? [SchemaType<Head>, ...Tail extends readonly [] ? [] : Tail extends readonly [infer Head extends RpcSchema, ...infer Tail extends readonly RpcSchema[]] ? [SchemaType<Head>, ... /*elided*/ any] : SchemaType<Tail[number]>[]] : SchemaType<Tail[number]>[]] : SchemaType<Tail[number]>[]] : SchemaType<Tail[number]>[]] : SchemaType<Tail[number]>[]] : SchemaType<Tail[number]>[]] : SchemaType<Tail[number]>[]] : SchemaType<Tail[number]>[]] : SchemaType<Tail[number]>[]] : SchemaType<Tail[number]>[]] : SchemaType<T[number]>[] : never : never) => Effect.Effect<Self["methods"][MethodName]["args"] extends (infer T_1 extends readonly RpcSchema[]) ? { [Index in keyof T_1]: WireEncoded<T_1[Index]>; } : never, RpcArgumentCountError | RpcArgumentEncodeError, never>;
|
|
112
126
|
declare const encodeSuccess: <const Self extends Definition.Any, MethodName extends Definition.MethodNames<Self>>(definition: Self, methodName: MethodName, value: Method.Success<Self["methods"][MethodName]>) => Effect.Effect<Method.EncodedSuccess<Self["methods"][MethodName]>, RpcSuccessEncodeError>;
|
|
113
127
|
declare const decodeSuccess: <const Self extends Definition.Any, MethodName extends Definition.MethodNames<Self>>(definition: Self, methodName: MethodName, value: WireValue) => Effect.Effect<Method.Success<Self["methods"][MethodName]>, RpcSuccessDecodeError>;
|
|
114
128
|
declare const make: <Id extends string, const MethodDefinitions extends Methods>(id: Id, methods: MethodDefinitions) => Definition<Id, MethodDefinitions>;
|
|
115
129
|
//#endregion
|
|
116
|
-
export { Definition, Method, Methods, NoReservedMethods, ReservedMethodName, RpcArgumentCountError, RpcArgumentDecodeError, RpcArgumentEncodeError, RpcDefinition_d_exports, RpcReservedMethodNameError, RpcSuccessDecodeError, RpcSuccessEncodeError, ServiceFreeSchema, WireError, assertNoReservedMethods, decodeArgs, decodeSuccess, decodeWireError, encodeArgs, encodeSuccess, encodeWireError, isWireError, make, method, reservedMethodNames };
|
|
130
|
+
export { Definition, Method, Methods, NativeSchema, NativeSchemaTypeId, NoReservedMethods, ReservedMethodName, RpcArgumentCountError, RpcArgumentDecodeError, RpcArgumentEncodeError, RpcDefinition_d_exports, RpcReservedMethodNameError, RpcSchema, RpcSuccessDecodeError, RpcSuccessEncodeError, SchemaType, ServiceFreeSchema, WireEncoded, WireError, assertNoReservedMethods, decodeArgs, decodeSuccess, decodeWireError, encodeArgs, encodeSuccess, encodeWireError, isWireError, make, method, native, reservedMethodNames };
|
package/dist/RpcDefinition.mjs
CHANGED
|
@@ -6,6 +6,7 @@ import * as S from "effect/Schema";
|
|
|
6
6
|
import * as Predicate from "effect/Predicate";
|
|
7
7
|
//#region src/RpcDefinition.ts
|
|
8
8
|
var RpcDefinition_exports = /* @__PURE__ */ __exportAll({
|
|
9
|
+
NativeSchemaTypeId: () => NativeSchemaTypeId,
|
|
9
10
|
RpcArgumentCountError: () => RpcArgumentCountError,
|
|
10
11
|
RpcArgumentDecodeError: () => RpcArgumentDecodeError,
|
|
11
12
|
RpcArgumentEncodeError: () => RpcArgumentEncodeError,
|
|
@@ -22,6 +23,7 @@ var RpcDefinition_exports = /* @__PURE__ */ __exportAll({
|
|
|
22
23
|
isWireError: () => isWireError,
|
|
23
24
|
make: () => make,
|
|
24
25
|
method: () => method,
|
|
26
|
+
native: () => native,
|
|
25
27
|
reservedMethodNames: () => reservedMethodNames
|
|
26
28
|
});
|
|
27
29
|
var RpcReservedMethodNameError = class extends Data.TaggedError("RpcReservedMethodNameError") {
|
|
@@ -110,13 +112,26 @@ const reservedMethodNames = /* @__PURE__ */ new Set([
|
|
|
110
112
|
"serialize",
|
|
111
113
|
"deserialize"
|
|
112
114
|
]);
|
|
115
|
+
const NativeSchemaTypeId = Symbol.for("effect-cf/RpcDefinition/NativeSchema");
|
|
116
|
+
/**
|
|
117
|
+
* Marks a schema to use its declared encoded form directly at the Workers RPC
|
|
118
|
+
* boundary instead of lowering it to canonical JSON.
|
|
119
|
+
*/
|
|
120
|
+
const native = (schema) => {
|
|
121
|
+
return Object.freeze({
|
|
122
|
+
[NativeSchemaTypeId]: NativeSchemaTypeId,
|
|
123
|
+
schema
|
|
124
|
+
});
|
|
125
|
+
};
|
|
126
|
+
const isNativeSchema = (schema) => Predicate.hasProperty(schema, NativeSchemaTypeId) && schema[NativeSchemaTypeId] === NativeSchemaTypeId;
|
|
113
127
|
/**
|
|
114
128
|
* Workers RPC structured-clones every value that crosses an isolate boundary
|
|
115
129
|
* and rejects class instances. Declaration schemas such as `Schema.Result`
|
|
116
130
|
* keep their container instance in their `Encoded` form, so the declared
|
|
117
|
-
* schemas are lowered to their canonical JSON codec before touching the wire
|
|
131
|
+
* schemas are lowered to their canonical JSON codec before touching the wire,
|
|
132
|
+
* unless explicitly wrapped with `native`.
|
|
118
133
|
*/
|
|
119
|
-
const wireCodec = (schema) => S.toCodecJson(schema);
|
|
134
|
+
const wireCodec = (schema) => isNativeSchema(schema) ? schema.schema : S.toCodecJson(schema);
|
|
120
135
|
const assertNoReservedMethods = (target, methods, reserved) => {
|
|
121
136
|
for (const method of Object.keys(methods)) if (reserved.has(method)) throw new RpcReservedMethodNameError({
|
|
122
137
|
definition: target,
|
|
@@ -137,7 +152,8 @@ const decodeArgs = Effect.fnUntraced(function* (definition, methodName, args) {
|
|
|
137
152
|
expected: methodDefinition.args.length,
|
|
138
153
|
actual: args.length
|
|
139
154
|
});
|
|
140
|
-
|
|
155
|
+
const codecs = methodDefinition.args.map((schema) => wireCodec(schema));
|
|
156
|
+
return yield* S.decodeUnknownEffect(S.Tuple(codecs))(args).pipe(Effect.mapError((cause) => new RpcArgumentDecodeError({
|
|
141
157
|
definition: definition.id,
|
|
142
158
|
method: methodName,
|
|
143
159
|
cause
|
|
@@ -151,7 +167,8 @@ const encodeArgs = Effect.fnUntraced(function* (definition, methodName, args) {
|
|
|
151
167
|
expected: methodDefinition.args.length,
|
|
152
168
|
actual: args.length
|
|
153
169
|
});
|
|
154
|
-
|
|
170
|
+
const codecs = methodDefinition.args.map((schema) => wireCodec(schema));
|
|
171
|
+
return yield* S.encodeUnknownEffect(S.Tuple(codecs))(args).pipe(Effect.mapError((cause) => new RpcArgumentEncodeError({
|
|
155
172
|
definition: definition.id,
|
|
156
173
|
method: methodName,
|
|
157
174
|
cause
|
|
@@ -181,4 +198,4 @@ const make = (id, methods) => {
|
|
|
181
198
|
};
|
|
182
199
|
};
|
|
183
200
|
//#endregion
|
|
184
|
-
export { RpcArgumentCountError, RpcArgumentDecodeError, RpcArgumentEncodeError, RpcDefinition_exports, RpcReservedMethodNameError, RpcSuccessDecodeError, RpcSuccessEncodeError, assertNoReservedMethods, decodeArgs, decodeSuccess, decodeWireError, encodeArgs, encodeSuccess, encodeWireError, isWireError, make, method, reservedMethodNames };
|
|
201
|
+
export { NativeSchemaTypeId, RpcArgumentCountError, RpcArgumentDecodeError, RpcArgumentEncodeError, RpcDefinition_exports, RpcReservedMethodNameError, RpcSuccessDecodeError, RpcSuccessEncodeError, assertNoReservedMethods, decodeArgs, decodeSuccess, decodeWireError, encodeArgs, encodeSuccess, encodeWireError, isWireError, make, method, native, reservedMethodNames };
|
package/dist/Sandbox.d.mts
CHANGED
|
@@ -194,4 +194,4 @@ declare const proxyToSandbox: (request: Request<unknown, CfProperties<unknown>>,
|
|
|
194
194
|
readonly binding?: string;
|
|
195
195
|
} | undefined) => Effect.Effect<Option.Option<Response>, SandboxOperationError, WorkerEnvironment>;
|
|
196
196
|
//#endregion
|
|
197
|
-
export { type BackupOptions, type CheckChangesOptions, type CheckChangesResult, type CreateTerminalOptions, DeleteFileResult, type DirectoryBackup, type ExecOptions, ExposePortOptions, ExposedPort, ExposedPortStatus, FileExistsResult, type FileWatchSSEEvent, type ISandbox, LayerOptions, type ListFilesOptions, ListFilesResult, MkdirResult, type MountBucketOptions, MoveFileResult, type ProcessExit, type ProcessLogEvent, type ProcessLogsOptions, type ProcessOutput, type ProcessOutputOptions, type ProcessStatus, ReadFileEncoding, ReadFileResult, RenameFileResult, type RestoreBackupResult, Sandbox, SandboxClientResource, type SandboxCommand, SandboxDefinition, SandboxInstanceClient, SandboxNamespaceClient, SandboxNamespaceResource, SandboxNamespaceService, SandboxOperationError, type SandboxOptions, type SandboxProcess, SandboxProcessHandle, SandboxTerminalHandle, SandboxTunnelsClient, SandboxTunnelsResource, Tag, TagClass, type Terminal, type TerminalOutputCursor, type TerminalOutputEvent, type TerminalOutputOptions, type TerminalSnapshot, type TunnelInfo, type TunnelOptions, type WaitForExitOptions, type WaitForLogOptions, type WaitForLogResult, type WaitForPortOptions, type WatchOptions, WriteFileResult, fromSandboxClient, isSandboxNamespaceResource, layer, make, makeClient, proxyToSandbox };
|
|
197
|
+
export { type BackupOptions, type BindingNotFoundError, type BindingValidationError, type CheckChangesOptions, type CheckChangesResult, type CreateTerminalOptions, DeleteFileResult, type DirectoryBackup, type ExecOptions, ExposePortOptions, ExposedPort, ExposedPortStatus, FileExistsResult, type FileWatchSSEEvent, type ISandbox, LayerOptions, type ListFilesOptions, ListFilesResult, MkdirResult, type MountBucketOptions, MoveFileResult, type ProcessExit, type ProcessLogEvent, type ProcessLogsOptions, type ProcessOutput, type ProcessOutputOptions, type ProcessStatus, ReadFileEncoding, ReadFileResult, RenameFileResult, type RestoreBackupResult, Sandbox, SandboxClientResource, type SandboxCommand, SandboxDefinition, SandboxInstanceClient, SandboxNamespaceClient, SandboxNamespaceResource, SandboxNamespaceService, SandboxOperationError, type SandboxOptions, type SandboxProcess, SandboxProcessHandle, SandboxTerminalHandle, SandboxTunnelsClient, SandboxTunnelsResource, Tag, TagClass, type Terminal, type TerminalOutputCursor, type TerminalOutputEvent, type TerminalOutputOptions, type TerminalSnapshot, type TunnelInfo, type TunnelOptions, type WaitForExitOptions, type WaitForLogOptions, type WaitForLogResult, type WaitForPortOptions, type WatchOptions, WriteFileResult, fromSandboxClient, isSandboxNamespaceResource, layer, make, makeClient, proxyToSandbox };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { WorkerEnvironment } from "./Environment.mjs";
|
|
2
2
|
import { BindingNotFoundError, BindingService, BindingValidationError } from "./Binding.mjs";
|
|
3
|
-
import { Provider
|
|
3
|
+
import { Provider } from "./Rpc.mjs";
|
|
4
4
|
import { Definition, Method as Method$1 } from "./RpcDefinition.mjs";
|
|
5
|
-
import { AsyncMethodArgs, AsyncMethodCloudflareReturn, AsyncMethodKey, AsyncMethodSuccess } from "./internal/RpcInvocation.mjs";
|
|
6
5
|
import { Definition as Definition$1, ReservedMethodName as ReservedMethodName$1, ServerApi } from "./WorkerDefinition.mjs";
|
|
6
|
+
import { AsyncMethodArgs, AsyncMethodCloudflareReturn, AsyncMethodKey, AsyncMethodSuccess } from "./internal/RpcInvocation.mjs";
|
|
7
7
|
import * as Effect from "effect/Effect";
|
|
8
8
|
import * as Schema$1 from "effect/Schema";
|
|
9
9
|
import { Context, Scope } from "effect";
|
|
10
10
|
declare namespace ServiceBinding_d_exports {
|
|
11
|
-
export { Service, ServiceBindingClient, ServiceBindingDefinition, ServiceBindingEffectClient, ServiceBindingFetchError, ServiceBindingRpcError, ServiceBindingStaticClient, ServiceFetcher, isServiceBindingClient, layer, makeClient, makeDirectMethods };
|
|
11
|
+
export { BindingNotFoundError, BindingValidationError, Service, ServiceBindingClient, ServiceBindingDefinition, ServiceBindingEffectClient, ServiceBindingFetchError, ServiceBindingRpcError, ServiceBindingStaticClient, ServiceCall, ServiceClass, ServiceFetcher, ServiceRpc, ServiceScopedCall, isServiceBindingClient, layer, makeClient, makeDirectMethods };
|
|
12
12
|
}
|
|
13
13
|
declare const TypeId: "effect-cf/ServiceBinding";
|
|
14
14
|
interface ServiceFetcher {
|
|
@@ -58,6 +58,8 @@ type ServiceMethodArgs<Api, Method extends keyof Api> = AsyncMethodArgs<Api, Met
|
|
|
58
58
|
type ServiceMethodSuccess<Api, Method extends keyof Api> = AsyncMethodSuccess<Api, Method>;
|
|
59
59
|
type ServiceMethodCloudflareReturn<Api, Method extends keyof Api> = AsyncMethodCloudflareReturn<Api, Method>;
|
|
60
60
|
type ServiceCall<R, Api> = <Method extends ServiceMethodKey<Api>>(method: Method, ...args: ServiceMethodArgs<Api, Method>) => Effect.Effect<ServiceMethodSuccess<Api, Method>, ServiceBindingRpcError, R>;
|
|
61
|
+
type ServiceRpc<R, Api> = <Method extends ServiceMethodKey<Api>>(method: Method, ...args: ServiceMethodArgs<Api, Method>) => Effect.Effect<ServiceMethodCloudflareReturn<Api, Method>, ServiceBindingRpcError, R>;
|
|
62
|
+
type ServiceScopedCall<R, Api> = <Method extends ServiceMethodKey<Api>>(method: Method, ...args: ServiceMethodArgs<Api, Method>) => Effect.Effect<Awaited<ServiceMethodSuccess<Api, Method>>, ServiceBindingRpcError, Scope.Scope | R>;
|
|
61
63
|
type DefinitionDirectMethods<R, Definition$2 extends Definition$1.Any> = { readonly [Method in Definition.MethodNames<Definition$2>]: (...args: Method$1.Args<Definition$2["methods"][Method]>) => Effect.Effect<Method$1.Success<Definition$2["methods"][Method]>, ServiceBindingRpcError, R>; };
|
|
62
64
|
type DirectMethods<R, Definition> = Definition extends Definition$1.Any ? DefinitionDirectMethods<R, Definition> : {};
|
|
63
65
|
type ServiceBindingEffectClient<Api extends object, Definition extends Definition$1.Any | undefined = undefined> = DirectMethods<never, Definition> & {
|
|
@@ -71,14 +73,14 @@ type ServiceBindingEffectClient<Api extends object, Definition extends Definitio
|
|
|
71
73
|
*
|
|
72
74
|
* Most application code should use {@link call} instead.
|
|
73
75
|
*/
|
|
74
|
-
readonly rpc: <
|
|
76
|
+
readonly rpc: ServiceRpc<never, Api>;
|
|
75
77
|
/**
|
|
76
78
|
* Invokes a Worker RPC method, resolves Cloudflare's RPC result, and decodes
|
|
77
79
|
* the success value when the binding was created from a definition.
|
|
78
80
|
*
|
|
79
81
|
* This is the normal choice when application code wants the final typed value.
|
|
80
82
|
*/
|
|
81
|
-
readonly call: <
|
|
83
|
+
readonly call: ServiceCall<never, Api>;
|
|
82
84
|
/**
|
|
83
85
|
* Invokes a Worker RPC method in the current `Scope`, resolves Cloudflare's RPC
|
|
84
86
|
* result, decodes definition-backed success values, and disposes the resolved
|
|
@@ -87,26 +89,23 @@ type ServiceBindingEffectClient<Api extends object, Definition extends Definitio
|
|
|
87
89
|
* Use this for RPC methods that return Cloudflare RPC resources or other
|
|
88
90
|
* disposable objects whose lifetime should be tied to an Effect scope.
|
|
89
91
|
*/
|
|
90
|
-
readonly scopedCall: <
|
|
92
|
+
readonly scopedCall: ServiceScopedCall<never, Api>;
|
|
91
93
|
};
|
|
92
94
|
type ServiceBindingStaticClient<R, Api extends object, Definition extends Definition$1.Any | undefined = undefined> = DirectMethods<R, Definition> & {
|
|
93
95
|
readonly fetch: (input: RequestInfo | URL, init?: RequestInit) => Effect.Effect<globalThis.Response, ServiceBindingFetchError, R>;
|
|
94
|
-
readonly rpc: <
|
|
95
|
-
readonly call: <
|
|
96
|
-
readonly scopedCall: <
|
|
96
|
+
readonly rpc: ServiceRpc<R, Api>;
|
|
97
|
+
readonly call: ServiceCall<R, Api>;
|
|
98
|
+
readonly scopedCall: ServiceScopedCall<R, Api>;
|
|
99
|
+
};
|
|
100
|
+
type ServiceClass<Self, Id extends string, Api extends object = never, Definition extends Definition$1.Any | undefined = undefined> = BindingService<Self, Id, ServiceBindingEffectClient<ApiOrDefinition<Api, Definition>, Definition>> & ServiceBindingStaticClient<Self, ApiOrDefinition<Api, Definition>, Definition> & {
|
|
101
|
+
readonly [TypeId]: typeof TypeId;
|
|
102
|
+
readonly definition: ServiceBindingDefinition<Definition>;
|
|
97
103
|
};
|
|
98
104
|
type ServiceBindingValue = Schema$1.Schema.Type<typeof Schema$1.Unknown>;
|
|
99
105
|
declare const isServiceBindingClient: <Api extends object>(value: ServiceBindingValue) => value is ServiceBindingClient<Api>;
|
|
100
106
|
declare const makeClient: <Api extends object, const Definition extends Definition$1.Any | undefined = undefined>(definition: ServiceBindingDefinition<Definition>) => ((service: ServiceBindingClient<Api>) => ServiceBindingEffectClient<Api, Definition>);
|
|
101
107
|
declare const layer: <Self, Api extends object, const Definition extends Definition$1.Any | undefined = undefined>(tag: Context.Service<Self, ServiceBindingEffectClient<Api, Definition>>, definition: ServiceBindingDefinition<Definition>) => import("effect/Layer").Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
102
|
-
declare const Service: <Self, Api extends object = never>() => <Id extends string, const Definition extends Definition$1.Any | undefined = undefined>(id: Id, definition: ServiceBindingDefinition<Definition>) =>
|
|
103
|
-
readonly [TypeId]: typeof TypeId;
|
|
104
|
-
readonly definition: ServiceBindingDefinition<Definition>;
|
|
105
|
-
readonly fetch: (input: URL | RequestInfo<unknown, CfProperties<unknown>>, init?: RequestInit<CfProperties<unknown>> | undefined) => Effect.Effect<Response, ServiceBindingFetchError, Self>;
|
|
106
|
-
readonly rpc: <Method extends ServiceMethodKey<ApiOrDefinition<Api, Definition>>>(method: Method, ...args: AsyncMethodArgs<ApiOrDefinition<Api, Definition>, Method>) => Effect.Effect<Result<AsyncMethodSuccess<ApiOrDefinition<Api, Definition>, Method>>, ServiceBindingRpcError, Self>;
|
|
107
|
-
readonly call: <Method extends ServiceMethodKey<ApiOrDefinition<Api, Definition>>>(method: Method, ...args: AsyncMethodArgs<ApiOrDefinition<Api, Definition>, Method>) => Effect.Effect<AsyncMethodSuccess<ApiOrDefinition<Api, Definition>, Method>, ServiceBindingRpcError, Self>;
|
|
108
|
-
readonly scopedCall: <Method extends ServiceMethodKey<ApiOrDefinition<Api, Definition>>>(method: Method, ...args: AsyncMethodArgs<ApiOrDefinition<Api, Definition>, Method>) => Effect.Effect<Awaited<AsyncMethodSuccess<ApiOrDefinition<Api, Definition>, Method>>, ServiceBindingRpcError, Self | Scope.Scope>;
|
|
109
|
-
};
|
|
108
|
+
declare const Service: <Self, Api extends object = never>() => <Id extends string, const Definition extends Definition$1.Any | undefined = undefined>(id: Id, definition: ServiceBindingDefinition<Definition>) => ServiceClass<Self, Id, Api, Definition>;
|
|
110
109
|
declare const makeDirectMethods: <R, Api, Definition extends Definition$1.Any | undefined>(rpcDefinition: Definition | undefined, call: ServiceCall<R, Api>) => DirectMethods<R, Definition>;
|
|
111
110
|
//#endregion
|
|
112
|
-
export { Service, ServiceBindingClient, ServiceBindingDefinition, ServiceBindingEffectClient, ServiceBindingFetchError, ServiceBindingRpcError, ServiceBindingStaticClient, ServiceBinding_d_exports, ServiceFetcher, isServiceBindingClient, layer, makeClient, makeDirectMethods };
|
|
111
|
+
export { type BindingNotFoundError, type BindingValidationError, Service, ServiceBindingClient, ServiceBindingDefinition, ServiceBindingEffectClient, ServiceBindingFetchError, ServiceBindingRpcError, ServiceBindingStaticClient, ServiceBinding_d_exports, ServiceCall, ServiceClass, ServiceFetcher, ServiceRpc, ServiceScopedCall, isServiceBindingClient, layer, makeClient, makeDirectMethods };
|
package/dist/Vectorize.d.mts
CHANGED
|
@@ -5,7 +5,7 @@ import * as Effect from "effect/Effect";
|
|
|
5
5
|
import * as Schema$1 from "effect/Schema";
|
|
6
6
|
import { Layer } from "effect";
|
|
7
7
|
declare namespace Vectorize_d_exports {
|
|
8
|
-
export { LayerOptions, Tag, TagClass, VectorizeBinding, VectorizeClient, VectorizeDefinition, VectorizeIndexDetails, VectorizeIndexInfo, VectorizeMatch, VectorizeMatches, VectorizeMutation, VectorizeOperation, VectorizeOperationError, VectorizeQueryOptions, VectorizeService, VectorizeValues, VectorizeVector, VectorizeVectorMetadata, VectorizeVectorMetadataFilter, VectorizeVectorMetadataValue, isVectorizeBinding, layer, make, makeClient };
|
|
8
|
+
export { BindingNotFoundError, BindingValidationError, LayerOptions, Tag, TagClass, VectorizeBinding, VectorizeClient, VectorizeDefinition, VectorizeIndexDetails, VectorizeIndexInfo, VectorizeMatch, VectorizeMatches, VectorizeMutation, VectorizeOperation, VectorizeOperationError, VectorizeQueryOptions, VectorizeService, VectorizeValues, VectorizeVector, VectorizeVectorMetadata, VectorizeVectorMetadataFilter, VectorizeVectorMetadataValue, isVectorizeBinding, layer, make, makeClient };
|
|
9
9
|
}
|
|
10
10
|
type VectorizeOperation = "describe" | "query" | "queryById" | "insert" | "upsert" | "deleteByIds" | "getByIds";
|
|
11
11
|
declare const VectorizeOperationError_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 & {
|
|
@@ -65,4 +65,4 @@ declare const layer: <Self>(tag: Context$1.Service<Self, VectorizeClient>, defin
|
|
|
65
65
|
declare const make: <Id extends string>(id: Id) => TagClass<VectorizeService<Id>, Id>;
|
|
66
66
|
declare const Tag: <Self>() => <Id extends string>(id: Id) => TagClass<Self, Id>;
|
|
67
67
|
//#endregion
|
|
68
|
-
export { LayerOptions, Tag, TagClass, VectorizeBinding, VectorizeClient, VectorizeDefinition, VectorizeIndexDetails, VectorizeIndexInfo, VectorizeMatch, VectorizeMatches, VectorizeMutation, VectorizeOperation, VectorizeOperationError, VectorizeQueryOptions, VectorizeService, VectorizeValues, VectorizeVector, VectorizeVectorMetadata, VectorizeVectorMetadataFilter, VectorizeVectorMetadataValue, Vectorize_d_exports, isVectorizeBinding, layer, make, makeClient };
|
|
68
|
+
export { type BindingNotFoundError, type BindingValidationError, LayerOptions, Tag, TagClass, VectorizeBinding, VectorizeClient, VectorizeDefinition, VectorizeIndexDetails, VectorizeIndexInfo, VectorizeMatch, VectorizeMatches, VectorizeMutation, VectorizeOperation, VectorizeOperationError, VectorizeQueryOptions, VectorizeService, VectorizeValues, VectorizeVector, VectorizeVectorMetadata, VectorizeVectorMetadataFilter, VectorizeVectorMetadataValue, Vectorize_d_exports, isVectorizeBinding, layer, make, makeClient };
|
package/dist/Worker.d.mts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { WorkerEnv, WorkerEnvironment } from "./Environment.mjs";
|
|
2
|
+
import { BindingNotFoundError, BindingValidationError } from "./Binding.mjs";
|
|
2
3
|
import { ReservedMethodName as ReservedMethodName$1 } from "./RpcDefinition.mjs";
|
|
3
4
|
import { QueueHandler } from "./Queue.mjs";
|
|
4
5
|
import { ReceiverOptions, RpcInvocationInfo } from "./RpcTracing.mjs";
|
|
5
|
-
import { Api, Definition, HandlerEffect, Handlers, LayerOptions, Method, Methods, NoReservedMethods, Options, ServerApi, ServiceFreeSchema, Tag, TagClass, implement, method } from "./WorkerDefinition.mjs";
|
|
6
|
+
import { Api, Definition, HandlerEffect, Handlers, LayerOptions, Method, Methods, NativeSchema, NoReservedMethods, Options, RpcSchema, ServerApi, ServiceFreeSchema, Tag, TagClass, implement, method, native } from "./WorkerDefinition.mjs";
|
|
7
|
+
import { ServiceBindingFetchError, ServiceBindingRpcError, ServiceCall, ServiceRpc, ServiceScopedCall } from "./ServiceBinding.mjs";
|
|
6
8
|
import * as Context$1 from "effect/Context";
|
|
7
9
|
import * as Effect from "effect/Effect";
|
|
8
10
|
import * as Layer$1 from "effect/Layer";
|
|
@@ -11,7 +13,7 @@ import * as HttpServerRequest from "effect/unstable/http/HttpServerRequest";
|
|
|
11
13
|
import * as HttpServerResponse from "effect/unstable/http/HttpServerResponse";
|
|
12
14
|
import { Cause, Scope } from "effect";
|
|
13
15
|
declare namespace Worker_d_exports {
|
|
14
|
-
export { Api, Definition, ExecutionContext, FetchHandler, FetchWorkerOptions, HandlerEffect, Handlers, LayerOptions, Method, Methods, NativeRequest, NoReservedMethods, Options, ReservedMethodName, RpcHandlers, RunOptions, RunSymbol, ServerApi, ServiceFreeSchema, Tag, TagClass, WorkerClass, WorkerContext, WorkerContextService, WorkerContextWaitUntilOptions, WorkerFetchSuccess, WorkerHandler, WorkerOptions, WorkerRpc, WorkerRpcContract, WorkerRpcHandler, WorkerRpcContract as WorkerRpcShape, implement, isWebSocketUpgrade, make, makeFetchHandler, method };
|
|
16
|
+
export { Api, BindingNotFoundError, BindingValidationError, Definition, ExecutionContext, FetchHandler, FetchWorkerOptions, HandlerEffect, Handlers, LayerOptions, Method, Methods, NativeRequest, NativeSchema, NoReservedMethods, Options, ReservedMethodName, RpcHandlers, RpcSchema, RunOptions, RunSymbol, ServerApi, ServiceBindingFetchError, ServiceBindingRpcError, ServiceCall, ServiceFreeSchema, ServiceRpc, ServiceScopedCall, Tag, TagClass, WorkerClass, WorkerContext, WorkerContextService, WorkerContextWaitUntilOptions, WorkerFetchSuccess, WorkerHandler, WorkerOptions, WorkerRpc, WorkerRpcContract, WorkerRpcHandler, WorkerRpcContract as WorkerRpcShape, implement, isWebSocketUpgrade, make, makeFetchHandler, method, native };
|
|
15
17
|
}
|
|
16
18
|
declare const ExecutionContext_base: Context$1.ServiceClass<ExecutionContext, "effect-cf/ExecutionContext", globalThis.ExecutionContext<unknown>>;
|
|
17
19
|
declare class ExecutionContext extends ExecutionContext_base {}
|
|
@@ -136,4 +138,4 @@ declare function make<ROut, LayerError, REvent extends never = never, EventLayer
|
|
|
136
138
|
declare function makeFetchHandler<ROut, LayerError, REvent, EventLayerError = never, Env extends WorkerEnv = WorkerEnv>(layer: Layer$1.Layer<ROut, LayerError, ExecutionContext | WorkerContext | WorkerEnvironment>, options: FetchWorkerOptionsWithEventLayer<ROut, REvent, EventLayerError>): FetchHandler<Env>;
|
|
137
139
|
declare function makeFetchHandler<ROut, LayerError, REvent extends never = never, EventLayerError = never, Env extends WorkerEnv = WorkerEnv>(layer: Layer$1.Layer<ROut, LayerError, ExecutionContext | WorkerContext | WorkerEnvironment>, options: FetchWorkerOptions<ROut, REvent, EventLayerError>): FetchHandler<Env>;
|
|
138
140
|
//#endregion
|
|
139
|
-
export { type Api, type Definition, ExecutionContext, FetchHandler, FetchWorkerOptions, type HandlerEffect, type Handlers, type LayerOptions, type Method, type Methods, NativeRequest, type NoReservedMethods, type Options, ReservedMethodName, RpcHandlers, RunOptions, RunSymbol, type ServerApi, type ServiceFreeSchema, Tag, type TagClass, WorkerClass, WorkerContext, WorkerContextService, WorkerContextWaitUntilOptions, WorkerFetchSuccess, WorkerHandler, WorkerOptions, WorkerRpc, WorkerRpcContract, type WorkerRpcContract as WorkerRpcShape, WorkerRpcHandler, Worker_d_exports, implement, isWebSocketUpgrade, make, makeFetchHandler, method };
|
|
141
|
+
export { type Api, type BindingNotFoundError, type BindingValidationError, type Definition, ExecutionContext, FetchHandler, FetchWorkerOptions, type HandlerEffect, type Handlers, type LayerOptions, type Method, type Methods, NativeRequest, type NativeSchema, type NoReservedMethods, type Options, ReservedMethodName, RpcHandlers, type RpcSchema, RunOptions, RunSymbol, type ServerApi, type ServiceBindingFetchError, type ServiceBindingRpcError, type ServiceCall, type ServiceFreeSchema, type ServiceRpc, type ServiceScopedCall, Tag, type TagClass, WorkerClass, WorkerContext, WorkerContextService, WorkerContextWaitUntilOptions, WorkerFetchSuccess, WorkerHandler, WorkerOptions, WorkerRpc, WorkerRpcContract, type WorkerRpcContract as WorkerRpcShape, WorkerRpcHandler, Worker_d_exports, implement, isWebSocketUpgrade, make, makeFetchHandler, method, native };
|
package/dist/Worker.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import { reservedMethodNames as reservedMethodNames$1 } from "./RpcDefinition.mj
|
|
|
6
6
|
import { assumeEntrypointClass, defineEntrypointRpcMethods } from "./internal/Entrypoint.mjs";
|
|
7
7
|
import { makeEntrypointRuntime, runEventPromise } from "./internal/Runtime.mjs";
|
|
8
8
|
import { scheduleTelemetryFlush as scheduleTelemetryFlush$1 } from "./internal/Telemetry.mjs";
|
|
9
|
-
import { Tag, implement, method } from "./WorkerDefinition.mjs";
|
|
9
|
+
import { Tag, implement, method, native } from "./WorkerDefinition.mjs";
|
|
10
10
|
import * as Context from "effect/Context";
|
|
11
11
|
import * as Effect from "effect/Effect";
|
|
12
12
|
import * as Layer from "effect/Layer";
|
|
@@ -28,7 +28,8 @@ var Worker_exports = /* @__PURE__ */ __exportAll({
|
|
|
28
28
|
isWebSocketUpgrade: () => isWebSocketUpgrade,
|
|
29
29
|
make: () => make,
|
|
30
30
|
makeFetchHandler: () => makeFetchHandler,
|
|
31
|
-
method: () => method
|
|
31
|
+
method: () => method,
|
|
32
|
+
native: () => native
|
|
32
33
|
});
|
|
33
34
|
var ExecutionContext = class extends Context.Service()("effect-cf/ExecutionContext") {};
|
|
34
35
|
var WorkerContext = class extends Context.Service()("effect-cf/WorkerContext") {};
|
|
@@ -139,4 +140,4 @@ function makeFetchHandler(layer, options) {
|
|
|
139
140
|
} };
|
|
140
141
|
}
|
|
141
142
|
//#endregion
|
|
142
|
-
export { ExecutionContext, NativeRequest, RunSymbol, Tag, WorkerContext, Worker_exports, implement, isWebSocketUpgrade, make, makeFetchHandler, method };
|
|
143
|
+
export { ExecutionContext, NativeRequest, RunSymbol, Tag, WorkerContext, Worker_exports, implement, isWebSocketUpgrade, make, makeFetchHandler, method, native };
|
|
@@ -1,26 +1,29 @@
|
|
|
1
1
|
import { WorkerEnvironment } from "./Environment.mjs";
|
|
2
2
|
import { BindingNotFoundError, BindingValidationError } from "./Binding.mjs";
|
|
3
3
|
import { Provider } from "./Rpc.mjs";
|
|
4
|
-
import {
|
|
4
|
+
import { NativeSchema as NativeSchema$1, RpcSchema as RpcSchema$1, SchemaType, WireEncoded, native as native$1 } from "./RpcDefinition.mjs";
|
|
5
|
+
import { ServiceBindingEffectClient, ServiceBindingFetchError, ServiceBindingRpcError, ServiceBindingStaticClient, ServiceCall, ServiceRpc, ServiceScopedCall } from "./ServiceBinding.mjs";
|
|
5
6
|
import { ExecutionContext, ReservedMethodName as ReservedMethodName$1, WorkerClass, WorkerContext, WorkerOptions, WorkerRpcHandler } from "./Worker.mjs";
|
|
6
7
|
import * as Context$1 from "effect/Context";
|
|
7
8
|
import { Layer, Schema } from "effect";
|
|
8
9
|
declare namespace WorkerDefinition_d_exports {
|
|
9
|
-
export { Api, Definition, HandlerEffect, Handlers, LayerOptions, Method, Methods, NoReservedMethods, Options, ReservedMethodName, ServerApi, ServiceFreeSchema, Tag, TagClass, Worker, implement, make, method };
|
|
10
|
+
export { Api, BindingNotFoundError, BindingValidationError, Definition, HandlerEffect, Handlers, LayerOptions, Method, Methods, NativeSchema, NoReservedMethods, Options, ReservedMethodName, RpcSchema, ServerApi, ServiceBindingFetchError, ServiceBindingRpcError, ServiceCall, ServiceFreeSchema, ServiceRpc, ServiceScopedCall, Tag, TagClass, Worker, implement, make, method, native };
|
|
10
11
|
}
|
|
11
12
|
type ServiceFreeSchema = Schema.Codec<any, any, never, never>;
|
|
12
|
-
|
|
13
|
+
type NativeSchema<Schema extends ServiceFreeSchema = ServiceFreeSchema> = NativeSchema$1<Schema>;
|
|
14
|
+
type RpcSchema = RpcSchema$1;
|
|
15
|
+
interface Method<Args extends ReadonlyArray<RpcSchema> = ReadonlyArray<RpcSchema>, Success extends RpcSchema = RpcSchema> {
|
|
13
16
|
readonly args: Args;
|
|
14
17
|
readonly success: Success;
|
|
15
18
|
}
|
|
16
19
|
declare namespace Method {
|
|
17
|
-
export type Any = Method<ReadonlyArray<
|
|
18
|
-
type ArgsFromSchemas<Args extends ReadonlyArray<
|
|
19
|
-
type EncodedArgsFromSchemas<Args extends ReadonlyArray<
|
|
20
|
+
export type Any = Method<ReadonlyArray<RpcSchema>, RpcSchema>;
|
|
21
|
+
type ArgsFromSchemas<Args extends ReadonlyArray<RpcSchema>> = Args extends readonly [] ? [] : Args extends readonly [infer Head extends RpcSchema, ...infer Tail extends ReadonlyArray<RpcSchema>] ? [SchemaType<Head>, ...ArgsFromSchemas<Tail>] : Array<SchemaType<Args[number]>>;
|
|
22
|
+
type EncodedArgsFromSchemas<Args extends ReadonlyArray<RpcSchema>> = { [Index in keyof Args]: WireEncoded<Args[Index]>; };
|
|
20
23
|
export type Args<Self extends Any> = ArgsFromSchemas<Self["args"]>;
|
|
21
24
|
export type EncodedArgs<Self extends Any> = EncodedArgsFromSchemas<Self["args"]>;
|
|
22
|
-
export type Success<Self extends Any> =
|
|
23
|
-
export type EncodedSuccess<
|
|
25
|
+
export type Success<Self extends Any> = SchemaType<Self["success"]>;
|
|
26
|
+
export type EncodedSuccess<Self extends Any> = WireEncoded<Self["success"]>;
|
|
24
27
|
export {};
|
|
25
28
|
}
|
|
26
29
|
type Methods = Record<string, Method.Any>;
|
|
@@ -77,14 +80,15 @@ type TagClass<Self, Id extends string, MethodDefinitions extends Methods> = Cont
|
|
|
77
80
|
* Defines a single RPC method schema in a worker definition.
|
|
78
81
|
*/
|
|
79
82
|
declare const method: {
|
|
80
|
-
<Success extends
|
|
83
|
+
<Success extends RpcSchema>(definition: {
|
|
81
84
|
readonly success: Success;
|
|
82
85
|
}): Method<readonly [], Success>;
|
|
83
|
-
<const Args extends ReadonlyArray<
|
|
86
|
+
<const Args extends ReadonlyArray<RpcSchema>, Success extends RpcSchema>(definition: {
|
|
84
87
|
readonly args: Args;
|
|
85
88
|
readonly success: Success;
|
|
86
89
|
}): Method<Args, Success>;
|
|
87
90
|
};
|
|
91
|
+
declare const native: typeof native$1;
|
|
88
92
|
declare const make: <Id extends string, const MethodDefinitions extends Methods>(id: Id, methods: MethodDefinitions & NoReservedMethods<MethodDefinitions>) => TagClass<Definition<Id, MethodDefinitions>, Id, MethodDefinitions>;
|
|
89
93
|
declare const Tag: <Self>() => <Id extends string, const MethodDefinitions extends Methods>(id: Id, methods: MethodDefinitions & NoReservedMethods<MethodDefinitions>) => TagClass<Self, Id, MethodDefinitions>;
|
|
90
94
|
declare const Worker: typeof Tag;
|
|
@@ -97,4 +101,4 @@ declare const implement: <ROut, const Self extends Definition.Any>(_definition:
|
|
|
97
101
|
*/
|
|
98
102
|
type HandlerEffect<ROut, Self extends Definition.Any, Key extends keyof Self["methods"]> = WorkerRpcHandler<ROut, Method.Success<Self["methods"][Key]>>;
|
|
99
103
|
//#endregion
|
|
100
|
-
export { Api, Definition, HandlerEffect, Handlers, LayerOptions, Method, Methods, NoReservedMethods, Options, ReservedMethodName, ServerApi, ServiceFreeSchema, Tag, TagClass, Worker, WorkerDefinition_d_exports, implement, make, method };
|
|
104
|
+
export { Api, type BindingNotFoundError, type BindingValidationError, Definition, HandlerEffect, Handlers, LayerOptions, Method, Methods, NativeSchema, NoReservedMethods, Options, ReservedMethodName, RpcSchema, ServerApi, type ServiceBindingFetchError, type ServiceBindingRpcError, type ServiceCall, ServiceFreeSchema, type ServiceRpc, type ServiceScopedCall, Tag, TagClass, Worker, WorkerDefinition_d_exports, implement, make, method, native };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __exportAll } from "./_virtual/_rolldown/runtime.mjs";
|
|
2
|
-
import { assertNoReservedMethods, decodeArgs, encodeSuccess, make as make$1, method as method$1 } from "./RpcDefinition.mjs";
|
|
2
|
+
import { assertNoReservedMethods, decodeArgs, encodeSuccess, make as make$1, method as method$1, native as native$1 } from "./RpcDefinition.mjs";
|
|
3
3
|
import { recordDecodedArgs } from "./internal/RpcInvocation.mjs";
|
|
4
4
|
import { layer, makeDirectMethods } from "./ServiceBinding.mjs";
|
|
5
5
|
import { make as make$2 } from "./Worker.mjs";
|
|
@@ -11,7 +11,8 @@ var WorkerDefinition_exports = /* @__PURE__ */ __exportAll({
|
|
|
11
11
|
Worker: () => Worker,
|
|
12
12
|
implement: () => implement,
|
|
13
13
|
make: () => make,
|
|
14
|
-
method: () => method
|
|
14
|
+
method: () => method,
|
|
15
|
+
native: () => native
|
|
15
16
|
});
|
|
16
17
|
const reservedMethodNames = /* @__PURE__ */ new Set([
|
|
17
18
|
"constructor",
|
|
@@ -36,6 +37,7 @@ const assumeTagClass = (value) => {
|
|
|
36
37
|
* Defines a single RPC method schema in a worker definition.
|
|
37
38
|
*/
|
|
38
39
|
const method = method$1;
|
|
40
|
+
const native = native$1;
|
|
39
41
|
const makeDefinition = (id, methods) => {
|
|
40
42
|
assertNoReservedMethods("Worker", methods, reservedMethodNames);
|
|
41
43
|
const definition = make$1(id, methods);
|
|
@@ -100,4 +102,4 @@ const wrapHandlers = (definition, handlers) => {
|
|
|
100
102
|
*/
|
|
101
103
|
const implement = (_definition, handlers) => handlers;
|
|
102
104
|
//#endregion
|
|
103
|
-
export { Tag, Worker, WorkerDefinition_exports, implement, make, method };
|
|
105
|
+
export { Tag, Worker, WorkerDefinition_exports, implement, make, method, native };
|
package/dist/WorkersAi.d.mts
CHANGED
|
@@ -5,7 +5,7 @@ import * as Effect from "effect/Effect";
|
|
|
5
5
|
import * as S from "effect/Schema";
|
|
6
6
|
import { Layer } from "effect";
|
|
7
7
|
declare namespace WorkersAi_d_exports {
|
|
8
|
-
export { LayerOptions, Tag, TagClass, WorkersAiAsyncBatchResponse, WorkersAiBinding, WorkersAiClient, WorkersAiDefinition, WorkersAiEmbeddingInput, WorkersAiEmbeddingResponse, WorkersAiModelsSearchObject, WorkersAiModelsSearchParams, WorkersAiOperationError, WorkersAiOptions, WorkersAiService, embeddingResponse, isWorkersAiBinding, layer, make, makeClient };
|
|
8
|
+
export { BindingNotFoundError, BindingValidationError, LayerOptions, Tag, TagClass, WorkersAiAsyncBatchResponse, WorkersAiBinding, WorkersAiClient, WorkersAiDefinition, WorkersAiEmbeddingInput, WorkersAiEmbeddingResponse, WorkersAiModelsSearchObject, WorkersAiModelsSearchParams, WorkersAiOperationError, WorkersAiOptions, WorkersAiService, embeddingResponse, isWorkersAiBinding, layer, make, makeClient };
|
|
9
9
|
}
|
|
10
10
|
declare const WorkersAiOperationError_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 & {
|
|
11
11
|
readonly _tag: "WorkersAiOperationError";
|
|
@@ -81,4 +81,4 @@ declare const layer: <Self, ModelList extends AiModelListType = AiModels>(tag: C
|
|
|
81
81
|
declare const make: <Id extends string>(id: Id) => TagClass<WorkersAiService<Id>, Id, AiModels>;
|
|
82
82
|
declare const Tag: <Self>() => <Id extends string, ModelList extends AiModelListType = AiModels>(id: Id) => TagClass<Self, Id, ModelList>;
|
|
83
83
|
//#endregion
|
|
84
|
-
export { LayerOptions, Tag, TagClass, WorkersAiAsyncBatchResponse, WorkersAiBinding, WorkersAiClient, WorkersAiDefinition, WorkersAiEmbeddingInput, WorkersAiEmbeddingResponse, WorkersAiModelsSearchObject, WorkersAiModelsSearchParams, WorkersAiOperationError, WorkersAiOptions, WorkersAiService, WorkersAi_d_exports, embeddingResponse, isWorkersAiBinding, layer, make, makeClient };
|
|
84
|
+
export { type BindingNotFoundError, type BindingValidationError, LayerOptions, Tag, TagClass, WorkersAiAsyncBatchResponse, WorkersAiBinding, WorkersAiClient, WorkersAiDefinition, WorkersAiEmbeddingInput, WorkersAiEmbeddingResponse, WorkersAiModelsSearchObject, WorkersAiModelsSearchParams, WorkersAiOperationError, WorkersAiOptions, WorkersAiService, WorkersAi_d_exports, embeddingResponse, isWorkersAiBinding, layer, make, makeClient };
|
package/dist/Workflow.d.mts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { WorkerEnv, WorkerEnvironment } from "./Environment.mjs";
|
|
2
|
+
import { BindingNotFoundError, BindingValidationError } from "./Binding.mjs";
|
|
2
3
|
import { ExecutionContext, WorkerContext } from "./Worker.mjs";
|
|
3
|
-
import {
|
|
4
|
+
import { WorkflowInstance, WorkflowInstanceCreateBatchOptions, WorkflowInstanceCreateOptions, WorkflowOperationError } from "./WorkflowBinding.mjs";
|
|
5
|
+
import { Definition as Definition$1, Handler as Handler$1, LayerOptions as LayerOptions$1, Options as Options$1, Tag, TagClass, implement } from "./WorkflowDefinition.mjs";
|
|
4
6
|
import * as Context$1 from "effect/Context";
|
|
5
7
|
import * as Effect from "effect/Effect";
|
|
6
8
|
import * as Layer$1 from "effect/Layer";
|
|
@@ -8,7 +10,7 @@ import * as Cause$1 from "effect/Cause";
|
|
|
8
10
|
import { WorkflowEntrypoint, WorkflowEvent, WorkflowSleepDuration, WorkflowStep, WorkflowStepConfig, WorkflowStepContext, WorkflowStepEvent, WorkflowTimeoutDuration } from "cloudflare:workers";
|
|
9
11
|
import { Scope } from "effect";
|
|
10
12
|
declare namespace Workflow_d_exports {
|
|
11
|
-
export { Definition, Handler, LayerOptions, Options, Tag, TagClass, WorkflowClass, WorkflowEvent$1 as WorkflowEvent, WorkflowEventService, WorkflowHandler, WorkflowOptions, WorkflowRunContext, WorkflowStep$1 as WorkflowStep, WorkflowStepContext$1 as WorkflowStepContext, WorkflowStepError, WorkflowStepNonRetryableError, WorkflowStepService, implement, make, sleep, sleepUntil, step, waitForEvent };
|
|
13
|
+
export { BindingNotFoundError, BindingValidationError, Definition, Handler, LayerOptions, Options, Tag, TagClass, WorkflowClass, WorkflowEvent$1 as WorkflowEvent, WorkflowEventService, WorkflowHandler, WorkflowInstance, WorkflowInstanceCreateBatchOptions, WorkflowInstanceCreateOptions, WorkflowOperationError, WorkflowOptions, WorkflowRunContext, WorkflowStep$1 as WorkflowStep, WorkflowStepContext$1 as WorkflowStepContext, WorkflowStepError, WorkflowStepNonRetryableError, WorkflowStepService, implement, make, sleep, sleepUntil, step, waitForEvent };
|
|
12
14
|
}
|
|
13
15
|
interface WorkflowEventService<Payload = unknown> {
|
|
14
16
|
readonly raw: WorkflowEvent<unknown>;
|
|
@@ -79,8 +81,7 @@ declare namespace Definition {
|
|
|
79
81
|
type Any = Definition$1.Any;
|
|
80
82
|
}
|
|
81
83
|
type LayerOptions = LayerOptions$1;
|
|
82
|
-
type TagClass<Self, Id extends string, Payload extends Definition$1.Any["payload"], Result extends Definition$1.Any["result"]> = TagClass$1<Self, Id, Payload, Result>;
|
|
83
84
|
type Handler<ROut, Self extends Definition$1.Any> = Handler$1<ROut, Self>;
|
|
84
85
|
type Options<ROut, Self extends Definition$1.Any> = Options$1<ROut, Self>;
|
|
85
86
|
//#endregion
|
|
86
|
-
export { Definition, Handler, LayerOptions, Options, Tag, TagClass, WorkflowClass, WorkflowEvent$1 as WorkflowEvent, WorkflowEventService, WorkflowHandler, WorkflowOptions, WorkflowRunContext, WorkflowStep$1 as WorkflowStep, WorkflowStepContext$1 as WorkflowStepContext, WorkflowStepError, WorkflowStepNonRetryableError, WorkflowStepService, Workflow_d_exports, implement, make, sleep, sleepUntil, step, waitForEvent };
|
|
87
|
+
export { type BindingNotFoundError, type BindingValidationError, Definition, Handler, LayerOptions, Options, Tag, type TagClass, WorkflowClass, WorkflowEvent$1 as WorkflowEvent, WorkflowEventService, WorkflowHandler, type WorkflowInstance, type WorkflowInstanceCreateBatchOptions, type WorkflowInstanceCreateOptions, type WorkflowOperationError, WorkflowOptions, WorkflowRunContext, WorkflowStep$1 as WorkflowStep, WorkflowStepContext$1 as WorkflowStepContext, WorkflowStepError, WorkflowStepNonRetryableError, WorkflowStepService, Workflow_d_exports, implement, make, sleep, sleepUntil, step, waitForEvent };
|
|
@@ -9,7 +9,7 @@ import * as Effect from "effect/Effect";
|
|
|
9
9
|
import * as S from "effect/Schema";
|
|
10
10
|
import { Layer } from "effect";
|
|
11
11
|
declare namespace WorkflowDefinition_d_exports {
|
|
12
|
-
export { Definition, Handler, LayerOptions, Options, Tag, TagClass, Workflow, implement, make };
|
|
12
|
+
export { BindingNotFoundError, BindingValidationError, Definition, Handler, LayerOptions, Options, Tag, TagClass, Workflow, WorkflowInstance, WorkflowInstanceCreateBatchOptions, WorkflowInstanceCreateOptions, WorkflowOperationError, implement, make };
|
|
13
13
|
}
|
|
14
14
|
interface Definition<Id extends string = string, Payload extends ServiceFreeSchema = ServiceFreeSchema, Result extends ServiceFreeSchema = ServiceFreeSchema> {
|
|
15
15
|
readonly id: Id;
|
|
@@ -26,7 +26,7 @@ interface Options<ROut, Self extends Definition.Any> {
|
|
|
26
26
|
type LayerOptions = {
|
|
27
27
|
readonly binding: string;
|
|
28
28
|
};
|
|
29
|
-
|
|
29
|
+
type TagClass<Self, Id extends string, Payload extends ServiceFreeSchema, Result extends ServiceFreeSchema> = Context$1.ServiceClass<Self, `effect-cf/Workflow/${Id}`, WorkflowBindingClient<Payload, Result>> & {
|
|
30
30
|
readonly id: Id;
|
|
31
31
|
readonly payload: Payload;
|
|
32
32
|
readonly result: Result;
|
|
@@ -36,7 +36,7 @@ interface TagClass<Self, Id extends string, Payload extends ServiceFreeSchema, R
|
|
|
36
36
|
readonly createBatch: (batch: WorkflowInstanceCreateBatchOptions<S.Schema.Type<Payload>, S.Codec.Encoded<Payload>>) => Effect.Effect<ReadonlyArray<WorkflowInstance<S.Schema.Type<Result>>>, WorkflowOperationError | S.SchemaError, Self>;
|
|
37
37
|
readonly get: (instanceId: string) => Effect.Effect<WorkflowInstance<S.Schema.Type<Result>>, WorkflowOperationError, Self>;
|
|
38
38
|
readonly rawUnsafe: Effect.Effect<globalThis.Workflow<S.Codec.Encoded<Payload>>, never, Self>;
|
|
39
|
-
}
|
|
39
|
+
};
|
|
40
40
|
declare const make: <Id extends string, Payload extends ServiceFreeSchema, Result extends ServiceFreeSchema>(id: Id, definition: {
|
|
41
41
|
readonly payload: Payload;
|
|
42
42
|
readonly result: Result;
|
|
@@ -48,4 +48,4 @@ declare const Tag: <Self>() => <Id extends string, Payload extends ServiceFreeSc
|
|
|
48
48
|
declare const Workflow: typeof Tag;
|
|
49
49
|
declare const implement: <ROut, const Self extends Definition.Any>(_definition: Self, handler: Handler<ROut, Self>) => Handler<ROut, Self>;
|
|
50
50
|
//#endregion
|
|
51
|
-
export { Definition, Handler, LayerOptions, Options, Tag, TagClass, Workflow, WorkflowDefinition_d_exports, implement, make };
|
|
51
|
+
export { type BindingNotFoundError, type BindingValidationError, Definition, Handler, LayerOptions, Options, Tag, TagClass, Workflow, WorkflowDefinition_d_exports, type WorkflowInstance, type WorkflowInstanceCreateBatchOptions, type WorkflowInstanceCreateOptions, type WorkflowOperationError, implement, make };
|
package/dist/index.d.mts
CHANGED
|
@@ -9,8 +9,8 @@ import { QueueBinding_d_exports } from "./QueueBinding.mjs";
|
|
|
9
9
|
import { QueueDefinition_d_exports } from "./QueueDefinition.mjs";
|
|
10
10
|
import { Queue_d_exports } from "./Queue.mjs";
|
|
11
11
|
import { RpcTracing_d_exports } from "./RpcTracing.mjs";
|
|
12
|
-
import { ServiceBinding_d_exports } from "./ServiceBinding.mjs";
|
|
13
12
|
import { WorkerDefinition_d_exports } from "./WorkerDefinition.mjs";
|
|
13
|
+
import { ServiceBinding_d_exports } from "./ServiceBinding.mjs";
|
|
14
14
|
import { Worker_d_exports } from "./Worker.mjs";
|
|
15
15
|
import { DurableObjectState_d_exports } from "./DurableObjectState.mjs";
|
|
16
16
|
import { Hyperdrive_d_exports } from "./Hyperdrive.mjs";
|
|
@@ -25,8 +25,8 @@ import { CloudflareOtlp_d_exports } from "./CloudflareOtlp.mjs";
|
|
|
25
25
|
import { CloudflareTracer_d_exports } from "./CloudflareTracer.mjs";
|
|
26
26
|
import { D1_d_exports } from "./D1.mjs";
|
|
27
27
|
import { DurableObjectAlarm_d_exports } from "./DurableObjectAlarm.mjs";
|
|
28
|
-
import { DurableObjectNamespace_d_exports } from "./DurableObjectNamespace.mjs";
|
|
29
28
|
import { DurableObjectDefinition_d_exports } from "./DurableObjectDefinition.mjs";
|
|
29
|
+
import { DurableObjectNamespace_d_exports } from "./DurableObjectNamespace.mjs";
|
|
30
30
|
import { DurableObject_d_exports } from "./DurableObject.mjs";
|
|
31
31
|
import { DurableObjectRpcWebSocket_d_exports } from "./DurableObjectRpcWebSocket.mjs";
|
|
32
32
|
import { DurableObjectSqlite_d_exports } from "./DurableObjectSqlite.mjs";
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import * as Context from "effect/Context";
|
|
1
2
|
import * as Effect from "effect/Effect";
|
|
2
3
|
import "effect/Exit";
|
|
3
4
|
import * as FiberSet from "effect/FiberSet";
|
|
5
|
+
import * as Scheduler from "effect/Scheduler";
|
|
4
6
|
//#region src/internal/NativeCallback.ts
|
|
7
|
+
const callbackScheduler = new Scheduler.MixedScheduler("sync");
|
|
5
8
|
/**
|
|
6
9
|
* Runs an Effect callback owned by a native Promise operation.
|
|
7
10
|
*
|
|
@@ -10,7 +13,7 @@ import * as FiberSet from "effect/FiberSet";
|
|
|
10
13
|
* the native operation's settlement.
|
|
11
14
|
*/
|
|
12
15
|
const runNativeCallback = Effect.fnUntraced(function* (operation) {
|
|
13
|
-
const
|
|
16
|
+
const callbackContext = Context.add(yield* Effect.context(), Scheduler.Scheduler, callbackScheduler);
|
|
14
17
|
return yield* Effect.scoped(Effect.gen(function* () {
|
|
15
18
|
let nativePromise;
|
|
16
19
|
yield* Effect.addFinalizer(() => {
|
|
@@ -20,7 +23,7 @@ const runNativeCallback = Effect.fnUntraced(function* (operation) {
|
|
|
20
23
|
const runPromise = yield* FiberSet.makeRuntimePromise();
|
|
21
24
|
return yield* Effect.callback((resume) => {
|
|
22
25
|
try {
|
|
23
|
-
nativePromise = operation((effect) => runPromise(Effect.provideContext(Effect.exit(effect),
|
|
26
|
+
nativePromise = operation((effect) => runPromise(Effect.provideContext(Effect.exit(effect), callbackContext)));
|
|
24
27
|
} catch (cause) {
|
|
25
28
|
resume(Effect.fail(cause));
|
|
26
29
|
return;
|