effect-cf 0.39.0 → 0.39.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 +6 -0
- package/dist/ComputerWorkspace.d.mts +1 -1
- package/dist/ComputerWorkspace.mjs +2 -1
- package/dist/{DurableObjectState-CpgAmFqo.d.mts → DurableObjectState-DJ0K-zyd.d.mts} +1 -1
- package/dist/Mcp.d.mts +1 -1
- package/dist/Vitest.d.mts +2 -2
- package/dist/{Worker-Dl6_Pijl.d.mts → Worker-gV4mDqIs.d.mts} +15 -15
- package/dist/{WorkflowBinding-CvJT9hB5.d.mts → WorkflowBinding-DtVykUCz.d.mts} +1 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +7 -5
- package/package.json +1 -1
- package/src/DurableObject.ts +11 -9
- package/src/DurableObjectNamespace.ts +6 -4
- package/src/DurableObjectStorage.ts +4 -5
- package/src/Images.ts +4 -8
- package/src/ServiceBinding.ts +6 -4
- package/src/Worker.ts +12 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# effect-cf
|
|
2
2
|
|
|
3
|
+
## 0.39.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#142](https://github.com/danieljvdm/effect-cf/pull/142) [`4ecf192`](https://github.com/danieljvdm/effect-cf/commit/4ecf192733193f4c3b5869abd992c1658f5ad7a6) Thanks [@danieljvdm](https://github.com/danieljvdm)! - Rebuild with Vite+ 0.3.0 and apply its formatter's source layout updates. Public APIs and runtime behavior are unchanged.
|
|
8
|
+
|
|
3
9
|
## 0.39.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ComputerArtifactsClient } from "./ComputerArtifacts.mjs";
|
|
2
|
-
import { t as DurableObjectState } from "./DurableObjectState-
|
|
2
|
+
import { t as DurableObjectState } from "./DurableObjectState-DJ0K-zyd.mjs";
|
|
3
3
|
import { Context, Effect, Layer, Schema, Scope, Stream } from "effect";
|
|
4
4
|
import { CommitView, GitClient, GitCloneOptions, GitCommitOptions, GitDiffOptions, GitFetchOptions, GitLogOptions, GitUpdateRefOptions } from "@cloudflare/computer/git";
|
|
5
5
|
import { ExecSyncResult, RuntimeExecOptions, RuntimeGetOptions, RuntimeKillOptions, ShellValue, SkippedEntry, ThinkWorkspaceCompatibility, WorkspaceClient, WorkspaceRuntimeResult, WorkspaceRuntimeValue as WorkspaceRuntimeValue$1 } from "@cloudflare/computer";
|
|
@@ -581,7 +581,8 @@ var ComputerWorkspace = class ComputerWorkspace extends Context.Service()("effec
|
|
|
581
581
|
* releases its RPC client when the layer scope closes.
|
|
582
582
|
*/
|
|
583
583
|
static layer = Layer.effect(ComputerWorkspace, Effect.gen(function* () {
|
|
584
|
-
const
|
|
584
|
+
const state = yield* DurableObjectState;
|
|
585
|
+
const host = lookup(state.raw);
|
|
585
586
|
if (host === void 0) return yield* Effect.die("ComputerWorkspace.layer requires a Durable Object class built with withComputerWorkspace");
|
|
586
587
|
const computer = yield* Effect.tryPromise({
|
|
587
588
|
try: () => import("@cloudflare/computer"),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as WorkerContextWaitUntilOptions } from "./Worker-
|
|
1
|
+
import { i as WorkerContextWaitUntilOptions } from "./Worker-gV4mDqIs.mjs";
|
|
2
2
|
import { Cause, Context, Duration, Effect, Option, Schema } from "effect";
|
|
3
3
|
declare namespace DurableObjectStorage_d_exports {
|
|
4
4
|
export { DurableObjectStorage, DurableObjectTransaction, SchemaBackedSyncKvStorage, SqlCursor, SqlStorage, SqlStorageValue, StorageOperationError, SyncKvDefinition, SyncKvStorage, fromDurableObjectStorage };
|
package/dist/Mcp.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as NativeRequest } from "./Worker-
|
|
1
|
+
import { n as NativeRequest } from "./Worker-gV4mDqIs.mjs";
|
|
2
2
|
import { Effect, Option } from "effect";
|
|
3
3
|
import { CreateMcpHandlerOptions, ServerOptions } from "@modelcontextprotocol/server";
|
|
4
4
|
import { Tool, Toolkit } from "effect/unstable/ai";
|
package/dist/Vitest.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { c as WorkerEnvironment, s as WorkerEnv } from "./Binding-DKcLrQCM.mjs";
|
|
2
|
-
import { n as DurableObjectStateService, t as DurableObjectState } from "./DurableObjectState-
|
|
3
|
-
import { o as WorkflowInstanceStatusName } from "./WorkflowBinding-
|
|
2
|
+
import { n as DurableObjectStateService, t as DurableObjectState } from "./DurableObjectState-DJ0K-zyd.mjs";
|
|
3
|
+
import { o as WorkflowInstanceStatusName } from "./WorkflowBinding-DtVykUCz.mjs";
|
|
4
4
|
import { Effect, Layer, Schema } from "effect";
|
|
5
5
|
import { DurableObject } from "cloudflare:workers";
|
|
6
6
|
import { adminSecretsStore as adminSecretsStore$1, getQueueResult, introspectWorkflow as introspectWorkflow$1, introspectWorkflowInstance as introspectWorkflowInstance$1 } from "cloudflare:test";
|
|
@@ -330,14 +330,14 @@ interface ServiceFetcher {
|
|
|
330
330
|
type RpcClient<Api> = { readonly [Key in keyof Api as Key extends string ? Api[Key] extends ((...args: Array<any>) => any) ? Key : never : never]: Api[Key]; };
|
|
331
331
|
type ReservedMethodName$2 = ReservedMethodName$1 | "fetch";
|
|
332
332
|
type ServiceBindingClient<Api extends object> = ServiceFetcher & RpcClient<Provider<Api, ReservedMethodName$2>>;
|
|
333
|
-
type ApiFromDefinition<Definition$
|
|
333
|
+
type ApiFromDefinition<Definition$4> = Definition$4 extends Definition.Any ? ServerApi$1<Definition$4> : never;
|
|
334
334
|
type ApiOrDefinition<Api extends object, Definition> = [Api] extends [never] ? ApiFromDefinition<Definition> : Api;
|
|
335
335
|
/**
|
|
336
336
|
* Binding metadata used to create an Effect service from a Worker binding.
|
|
337
337
|
*/
|
|
338
|
-
interface ServiceBindingDefinition<Definition$
|
|
338
|
+
interface ServiceBindingDefinition<Definition$5 extends Definition.Any | undefined = undefined> {
|
|
339
339
|
readonly binding: string;
|
|
340
|
-
readonly definition?: Definition$
|
|
340
|
+
readonly definition?: Definition$5;
|
|
341
341
|
/** Append live trace context only when the receiver also enables rpcTracing. */
|
|
342
342
|
readonly rpcTracing?: boolean;
|
|
343
343
|
}
|
|
@@ -371,9 +371,9 @@ type ServiceMethodArgs<Api, Method extends keyof Api> = AsyncMethodArgs<Api, Met
|
|
|
371
371
|
type ServiceMethodSuccess<Api, Method extends keyof Api> = AsyncMethodSuccess<Api, Method>;
|
|
372
372
|
type ServiceMethodCloudflareReturn<Api, Method extends keyof Api> = AsyncMethodCloudflareReturn<Api, Method>;
|
|
373
373
|
type ServiceCall<R, Api> = <Method extends ServiceMethodKey<Api>>(method: Method, ...args: ServiceMethodArgs<Api, Method>) => Effect.Effect<ServiceMethodSuccess<Api, Method>, ServiceBindingRpcError, R>;
|
|
374
|
-
type DefinitionDirectMethods<R, Definition$
|
|
375
|
-
type DirectMethods<R, Definition$
|
|
376
|
-
type ServiceBindingEffectClient<Api extends object, Definition$
|
|
374
|
+
type DefinitionDirectMethods<R, Definition$9 extends Definition.Any> = { readonly [Method in Definition$3.MethodNames<Definition$9>]: (...args: Method$2.Args<Definition$9["methods"][Method]>) => Effect.Effect<Method$2.Success<Definition$9["methods"][Method]>, ServiceBindingRpcError, R>; };
|
|
375
|
+
type DirectMethods<R, Definition$12> = Definition$12 extends Definition.Any ? DefinitionDirectMethods<R, Definition$12> : {};
|
|
376
|
+
type ServiceBindingEffectClient<Api extends object, Definition$10 extends Definition.Any | undefined = undefined> = DirectMethods<never, Definition$10> & {
|
|
377
377
|
readonly fetch: (input: RequestInfo | URL, init?: RequestInit) => Effect.Effect<globalThis.Response, ServiceBindingFetchError>;
|
|
378
378
|
/**
|
|
379
379
|
* Invokes a Worker RPC method and returns Cloudflare's raw RPC result.
|
|
@@ -402,7 +402,7 @@ type ServiceBindingEffectClient<Api extends object, Definition$8 extends Definit
|
|
|
402
402
|
*/
|
|
403
403
|
readonly scopedCall: <Method extends ServiceMethodKey<Api>>(method: Method, ...args: ServiceMethodArgs<Api, Method>) => Effect.Effect<Awaited<ServiceMethodSuccess<Api, Method>>, ServiceBindingRpcError, Scope.Scope>;
|
|
404
404
|
};
|
|
405
|
-
type ServiceBindingStaticClient<R, Api extends object, Definition$
|
|
405
|
+
type ServiceBindingStaticClient<R, Api extends object, Definition$11 extends Definition.Any | undefined = undefined> = DirectMethods<R, Definition$11> & {
|
|
406
406
|
readonly fetch: (input: RequestInfo | URL, init?: RequestInit) => Effect.Effect<globalThis.Response, ServiceBindingFetchError, R>;
|
|
407
407
|
readonly rpc: <Method extends ServiceMethodKey<Api>>(method: Method, ...args: ServiceMethodArgs<Api, Method>) => Effect.Effect<ServiceMethodCloudflareReturn<Api, Method>, ServiceBindingRpcError, R>;
|
|
408
408
|
readonly call: <Method extends ServiceMethodKey<Api>>(method: Method, ...args: ServiceMethodArgs<Api, Method>) => Effect.Effect<ServiceMethodSuccess<Api, Method>, ServiceBindingRpcError, R>;
|
|
@@ -410,17 +410,17 @@ type ServiceBindingStaticClient<R, Api extends object, Definition$5 extends Defi
|
|
|
410
410
|
};
|
|
411
411
|
type ServiceBindingValue = Schema.Schema.Type<typeof Schema.Unknown>;
|
|
412
412
|
declare const isServiceBindingClient: <Api extends object>(value: ServiceBindingValue) => value is ServiceBindingClient<Api>;
|
|
413
|
-
declare const makeClient: <Api extends object, const Definition$
|
|
414
|
-
declare const layer: <Self, Api extends object, const Definition$
|
|
415
|
-
declare const Service: <Self, Api extends object = never>() => <Id extends string, const Definition$
|
|
413
|
+
declare const makeClient: <Api extends object, const Definition$6 extends Definition.Any | undefined = undefined>(definition: ServiceBindingDefinition<Definition$6>) => ((service: ServiceBindingClient<Api>) => ServiceBindingEffectClient<Api, Definition$6>);
|
|
414
|
+
declare const layer: <Self, Api extends object, const Definition$13 extends Definition.Any | undefined = undefined>(tag: Context.Service<Self, ServiceBindingEffectClient<Api, Definition$13>>, definition: ServiceBindingDefinition<Definition$13>) => import("effect/Layer").Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
415
|
+
declare const Service: <Self, Api extends object = never>() => <Id extends string, const Definition$8 extends Definition.Any | undefined = undefined>(id: Id, definition: ServiceBindingDefinition<Definition$8>) => BindingService<Self, Id, ServiceBindingEffectClient<ApiOrDefinition<Api, Definition$8>, Definition$8>> & DirectMethods<Self, Definition$8> & {
|
|
416
416
|
readonly [TypeId]: typeof TypeId;
|
|
417
|
-
readonly definition: ServiceBindingDefinition<Definition$
|
|
417
|
+
readonly definition: ServiceBindingDefinition<Definition$8>;
|
|
418
418
|
readonly fetch: (input: URL | RequestInfo<unknown, CfProperties<unknown>>, init?: RequestInit<CfProperties<unknown>> | undefined) => Effect.Effect<Response, ServiceBindingFetchError, Self>;
|
|
419
|
-
readonly rpc: <Method extends ServiceMethodKey<ApiOrDefinition<Api, Definition$
|
|
420
|
-
readonly call: <Method extends ServiceMethodKey<ApiOrDefinition<Api, Definition$
|
|
421
|
-
readonly scopedCall: <Method extends ServiceMethodKey<ApiOrDefinition<Api, Definition$
|
|
419
|
+
readonly rpc: <Method extends ServiceMethodKey<ApiOrDefinition<Api, Definition$8>>>(method: Method, ...args: AsyncMethodArgs<ApiOrDefinition<Api, Definition$8>, Method>) => Effect.Effect<Result$1<AsyncMethodSuccess<ApiOrDefinition<Api, Definition$8>, Method>>, ServiceBindingRpcError, Self>;
|
|
420
|
+
readonly call: <Method extends ServiceMethodKey<ApiOrDefinition<Api, Definition$8>>>(method: Method, ...args: AsyncMethodArgs<ApiOrDefinition<Api, Definition$8>, Method>) => Effect.Effect<AsyncMethodSuccess<ApiOrDefinition<Api, Definition$8>, Method>, ServiceBindingRpcError, Self>;
|
|
421
|
+
readonly scopedCall: <Method extends ServiceMethodKey<ApiOrDefinition<Api, Definition$8>>>(method: Method, ...args: AsyncMethodArgs<ApiOrDefinition<Api, Definition$8>, Method>) => Effect.Effect<Awaited<AsyncMethodSuccess<ApiOrDefinition<Api, Definition$8>, Method>>, ServiceBindingRpcError, Self | Scope.Scope>;
|
|
422
422
|
};
|
|
423
|
-
declare const makeDirectMethods: <R, Api, Definition$
|
|
423
|
+
declare const makeDirectMethods: <R, Api, Definition$7 extends Definition.Any | undefined>(rpcDefinition: Definition$7 | undefined, call: ServiceCall<R, Api>) => DirectMethods<R, Definition$7>;
|
|
424
424
|
declare namespace WorkerDefinition_d_exports {
|
|
425
425
|
export { Api, Definition, HandlerEffect, Handlers, LayerOptions, Method$1 as Method, Methods, NoReservedMethods, Options, ReservedMethodName$1 as ReservedMethodName, ServerApi$1 as ServerApi, ServiceFreeSchema, Tag, TagClass, Worker, implement, make$1 as make, method };
|
|
426
426
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { c as WorkerEnvironment, r as BindingValidationError, t as BindingNotFoundError } from "./Binding-DKcLrQCM.mjs";
|
|
2
|
-
import { S as ServiceFreeSchema } from "./Worker-
|
|
2
|
+
import { S as ServiceFreeSchema } from "./Worker-gV4mDqIs.mjs";
|
|
3
3
|
import { Context, Effect, Option, Schema } from "effect";
|
|
4
4
|
declare namespace WorkflowBinding_d_exports {
|
|
5
5
|
export { WorkflowBindingClient, WorkflowBindingDefinition, WorkflowInstance, WorkflowInstanceCreateBatchOptions, WorkflowInstanceCreateOptions, WorkflowInstanceEvent, WorkflowInstanceLocationHint, WorkflowInstanceRestartOptions, WorkflowInstanceStatus, WorkflowInstanceStatusName, WorkflowInstanceTerminateOptions, WorkflowOperationError, WorkflowResultDecodeError, isWorkflow, layer, makeClient };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { a as Environment_d_exports, c as WorkerEnvironment, i as Binding_d_exports, n as BindingService, o as WorkerConfig, r as BindingValidationError, s as WorkerEnv, t as BindingNotFoundError } from "./Binding-DKcLrQCM.mjs";
|
|
2
2
|
import { l as Artifacts_d_exports } from "./Artifacts-B3r3RuTB.mjs";
|
|
3
|
-
import { a as AcceptedUpgrade, c as DurableWebSocketAttachmentError, i as AcceptUpgradeOptions, l as DurableObjectStorage_d_exports, o as DurableObjectWebSocket_d_exports, r as DurableObjectState_d_exports, s as DurableWebSocket, t as DurableObjectState, u as StorageOperationError } from "./DurableObjectState-
|
|
4
|
-
import { C as Provider, S as ServiceFreeSchema$1, _ as QueueBinding_d_exports, a as Worker_d_exports, b as ReservedMethodName$2, c as AsyncMethodArgs, d as AsyncMethodSuccess, f as ReceiverOptions, g as QueueDefinition_d_exports, h as Queue_d_exports, l as AsyncMethodCloudflareReturn, m as RpcTracing_d_exports, n as NativeRequest, o as WorkerDefinition_d_exports, p as RpcInvocationInfo, r as WorkerContext, s as ServiceBinding_d_exports, t as ExecutionContext, u as AsyncMethodKey, v as Definition$4, w as Rpc_d_exports, x as RpcDefinition_d_exports, y as Method$2 } from "./Worker-
|
|
3
|
+
import { a as AcceptedUpgrade, c as DurableWebSocketAttachmentError, i as AcceptUpgradeOptions, l as DurableObjectStorage_d_exports, o as DurableObjectWebSocket_d_exports, r as DurableObjectState_d_exports, s as DurableWebSocket, t as DurableObjectState, u as StorageOperationError } from "./DurableObjectState-DJ0K-zyd.mjs";
|
|
4
|
+
import { C as Provider, S as ServiceFreeSchema$1, _ as QueueBinding_d_exports, a as Worker_d_exports, b as ReservedMethodName$2, c as AsyncMethodArgs, d as AsyncMethodSuccess, f as ReceiverOptions, g as QueueDefinition_d_exports, h as Queue_d_exports, l as AsyncMethodCloudflareReturn, m as RpcTracing_d_exports, n as NativeRequest, o as WorkerDefinition_d_exports, p as RpcInvocationInfo, r as WorkerContext, s as ServiceBinding_d_exports, t as ExecutionContext, u as AsyncMethodKey, v as Definition$4, w as Rpc_d_exports, x as RpcDefinition_d_exports, y as Method$2 } from "./Worker-gV4mDqIs.mjs";
|
|
5
5
|
import { t as Hyperdrive_d_exports } from "./Hyperdrive-HrwFlZ6x.mjs";
|
|
6
6
|
import { t as ContainerNamespace_d_exports } from "./ContainerNamespace-DbLaeFhN.mjs";
|
|
7
|
-
import { a as WorkflowInstanceCreateOptions, i as WorkflowInstanceCreateBatchOptions, n as WorkflowBinding_d_exports, r as WorkflowInstance, s as WorkflowOperationError, t as WorkflowBindingClient } from "./WorkflowBinding-
|
|
7
|
+
import { a as WorkflowInstanceCreateOptions, i as WorkflowInstanceCreateBatchOptions, n as WorkflowBinding_d_exports, r as WorkflowInstance, s as WorkflowOperationError, t as WorkflowBindingClient } from "./WorkflowBinding-DtVykUCz.mjs";
|
|
8
8
|
import { Cause, Config, Context, Data, DateTime, Duration, Effect, Layer, Option, Predicate, Redacted, Schema, Scope } from "effect";
|
|
9
9
|
import { Headers as Headers$1, HttpClient, HttpClientResponse } from "effect/unstable/http";
|
|
10
10
|
import { OtlpExporter, OtlpResource } from "effect/unstable/observability";
|
package/dist/index.mjs
CHANGED
|
@@ -288,7 +288,7 @@ const writeLimits = {
|
|
|
288
288
|
maxBlobs: 20,
|
|
289
289
|
maxDoubles: 20,
|
|
290
290
|
maxIndexes: 1,
|
|
291
|
-
maxBlobBytes:
|
|
291
|
+
maxBlobBytes: 16384,
|
|
292
292
|
maxIndexBytes: 96,
|
|
293
293
|
maxDataPointsPerInvocation: 250
|
|
294
294
|
};
|
|
@@ -1039,7 +1039,8 @@ const makeClient$7 = (definition) => {
|
|
|
1039
1039
|
method: methodName,
|
|
1040
1040
|
cause
|
|
1041
1041
|
})));
|
|
1042
|
-
|
|
1042
|
+
const nativeArgs = definition.rpcTracing ? yield* withRpcTraceContext(encodedArgs) : encodedArgs;
|
|
1043
|
+
return yield* invokeRpcMethod(stub, method, nativeArgs, (cause) => new DurableObjectRpcError({
|
|
1043
1044
|
binding: definition.binding,
|
|
1044
1045
|
method: methodName,
|
|
1045
1046
|
cause
|
|
@@ -1064,7 +1065,8 @@ const makeClient$7 = (definition) => {
|
|
|
1064
1065
|
}, (effect, ...args) => withRpcClientSpan(effect, definition.binding, String(args[1])));
|
|
1065
1066
|
const scopedCall = Effect.fnUntraced(function* (stub, method, ...args) {
|
|
1066
1067
|
const methodName = String(method);
|
|
1067
|
-
const
|
|
1068
|
+
const result = yield* rpc(stub, method, ...args);
|
|
1069
|
+
const value = yield* scoped(result).pipe(Effect.mapError((cause) => new DurableObjectRpcError({
|
|
1068
1070
|
binding: definition.binding,
|
|
1069
1071
|
method: methodName,
|
|
1070
1072
|
cause
|
|
@@ -2145,10 +2147,10 @@ const textEncoder = new TextEncoder();
|
|
|
2145
2147
|
const sendLimits = {
|
|
2146
2148
|
maxRecipients: 50,
|
|
2147
2149
|
maxAttachments: 32,
|
|
2148
|
-
maxMessageBytes:
|
|
2150
|
+
maxMessageBytes: 5242880,
|
|
2149
2151
|
maxHeaderNameBytes: 100,
|
|
2150
2152
|
maxHeaderValueBytes: 2048,
|
|
2151
|
-
maxHeadersBytes:
|
|
2153
|
+
maxHeadersBytes: 16384,
|
|
2152
2154
|
maxAllowlistHeaders: 20
|
|
2153
2155
|
};
|
|
2154
2156
|
/**
|
package/package.json
CHANGED
package/src/DurableObject.ts
CHANGED
|
@@ -65,15 +65,17 @@ export type DurableObjectRpcApi<Rpc extends DurableObjectRpc<ROut>, ROut> = {
|
|
|
65
65
|
};
|
|
66
66
|
|
|
67
67
|
export type RpcHandlers<ROut, Api> = {
|
|
68
|
-
readonly [
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
? never
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
68
|
+
readonly [
|
|
69
|
+
Key in keyof Api as Key extends keyof CloudflareDurableObject<WorkerEnv>
|
|
70
|
+
? never
|
|
71
|
+
: Key extends string
|
|
72
|
+
? [Api[Key]] extends [never]
|
|
73
|
+
? never
|
|
74
|
+
: Api[Key] extends (...args: Array<any>) => Promise<any>
|
|
75
|
+
? Key
|
|
76
|
+
: never
|
|
77
|
+
: never
|
|
78
|
+
]: Api[Key] extends (...args: infer Args) => Promise<infer A>
|
|
77
79
|
? (...args: Args) => DurableObjectHandler<ROut, A>
|
|
78
80
|
: never;
|
|
79
81
|
};
|
|
@@ -17,11 +17,13 @@ interface DurableObjectFetcher {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
type RpcClient<Api> = {
|
|
20
|
-
readonly [
|
|
21
|
-
|
|
22
|
-
? Key
|
|
20
|
+
readonly [
|
|
21
|
+
Key in keyof Api as Key extends string
|
|
22
|
+
? Api[Key] extends (...args: Array<any>) => any
|
|
23
|
+
? Key
|
|
24
|
+
: never
|
|
23
25
|
: never
|
|
24
|
-
|
|
26
|
+
]: Api[Key];
|
|
25
27
|
};
|
|
26
28
|
|
|
27
29
|
type ReservedMethodName = DurableObjectDefinition.ReservedMethodName | "fetch";
|
|
@@ -399,11 +399,10 @@ export const fromDurableObjectStorage = (
|
|
|
399
399
|
throw exit;
|
|
400
400
|
}),
|
|
401
401
|
).pipe(
|
|
402
|
-
Effect.catch(
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
: Effect.fail(storageError("transaction", cause)),
|
|
402
|
+
Effect.catch((cause): Effect.Effect<never, E | StorageOperationError> =>
|
|
403
|
+
aborted !== undefined && cause === aborted && Exit.isFailure(aborted)
|
|
404
|
+
? Effect.failCause(aborted.cause)
|
|
405
|
+
: Effect.fail(storageError("transaction", cause)),
|
|
407
406
|
),
|
|
408
407
|
);
|
|
409
408
|
}),
|
package/src/Images.ts
CHANGED
|
@@ -207,19 +207,15 @@ export const empty: Steps = makeSteps([]);
|
|
|
207
207
|
export const transform: {
|
|
208
208
|
(transform: ImageTransform): (steps: Steps) => Steps;
|
|
209
209
|
(steps: Steps, transform: ImageTransform): Steps;
|
|
210
|
-
} = Function.dual(
|
|
211
|
-
|
|
212
|
-
(steps: Steps, transformValue: ImageTransform): Steps =>
|
|
213
|
-
makeSteps([...steps.steps, Step.Transform({ transform: transformValue })]),
|
|
210
|
+
} = Function.dual(2, (steps: Steps, transformValue: ImageTransform): Steps =>
|
|
211
|
+
makeSteps([...steps.steps, Step.Transform({ transform: transformValue })]),
|
|
214
212
|
);
|
|
215
213
|
|
|
216
214
|
export const draw: {
|
|
217
215
|
(draw: DrawStepOptions): (steps: Steps) => Steps;
|
|
218
216
|
(steps: Steps, draw: DrawStepOptions): Steps;
|
|
219
|
-
} = Function.dual(
|
|
220
|
-
|
|
221
|
-
(steps: Steps, drawValue: DrawStepOptions): Steps =>
|
|
222
|
-
makeSteps([...steps.steps, Step.Draw(drawValue)]),
|
|
217
|
+
} = Function.dual(2, (steps: Steps, drawValue: DrawStepOptions): Steps =>
|
|
218
|
+
makeSteps([...steps.steps, Step.Draw(drawValue)]),
|
|
223
219
|
);
|
|
224
220
|
|
|
225
221
|
const imagesError = (binding: string, operation: string, cause: unknown) =>
|
package/src/ServiceBinding.ts
CHANGED
|
@@ -16,11 +16,13 @@ export interface ServiceFetcher {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
type RpcClient<Api> = {
|
|
19
|
-
readonly [
|
|
20
|
-
|
|
21
|
-
? Key
|
|
19
|
+
readonly [
|
|
20
|
+
Key in keyof Api as Key extends string
|
|
21
|
+
? Api[Key] extends (...args: Array<any>) => any
|
|
22
|
+
? Key
|
|
23
|
+
: never
|
|
22
24
|
: never
|
|
23
|
-
|
|
25
|
+
]: Api[Key];
|
|
24
26
|
};
|
|
25
27
|
|
|
26
28
|
type ReservedMethodName = WorkerDefinition.ReservedMethodName | "fetch";
|
package/src/Worker.ts
CHANGED
|
@@ -139,17 +139,19 @@ export type WorkerRpcContract<Rpc extends WorkerRpc<ROut>, ROut> = {
|
|
|
139
139
|
};
|
|
140
140
|
|
|
141
141
|
export type RpcHandlers<ROut, Api> = {
|
|
142
|
-
readonly [
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
?
|
|
147
|
-
: [Api[Key]] extends [never]
|
|
142
|
+
readonly [
|
|
143
|
+
Key in keyof Api as Key extends keyof CloudflareWorkerEntrypoint
|
|
144
|
+
? never
|
|
145
|
+
: Key extends string
|
|
146
|
+
? Key extends ReservedMethodName
|
|
148
147
|
? never
|
|
149
|
-
: Api[Key] extends
|
|
150
|
-
?
|
|
151
|
-
:
|
|
152
|
-
|
|
148
|
+
: [Api[Key]] extends [never]
|
|
149
|
+
? never
|
|
150
|
+
: Api[Key] extends (...args: Array<any>) => Promise<any>
|
|
151
|
+
? Key
|
|
152
|
+
: never
|
|
153
|
+
: never
|
|
154
|
+
]: Api[Key] extends (...args: infer Args) => Promise<infer A>
|
|
153
155
|
? (...args: Args) => WorkerRpcHandler<ROut, A>
|
|
154
156
|
: never;
|
|
155
157
|
};
|