effect-cf 0.39.1 → 0.40.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 +18 -0
- package/README.md +9 -1
- package/dist/AiGateway.d.mts +86 -0
- package/dist/AiGateway.mjs +178 -0
- package/dist/AnalyticsEngine.d.mts +170 -0
- package/dist/AnalyticsEngine.mjs +275 -0
- package/dist/{Artifacts-B3r3RuTB.d.mts → Artifacts.d.mts} +8 -5
- package/dist/{Artifacts-CBxWGeZB.mjs → Artifacts.mjs} +9 -5
- package/dist/Binding.d.mts +45 -0
- package/dist/{Binding-C82jRhdr.mjs → Binding.mjs} +8 -4
- package/dist/BrowserRendering.d.mts +85 -0
- package/dist/BrowserRendering.mjs +81 -0
- package/dist/Cache.d.mts +40 -0
- package/dist/Cache.mjs +51 -0
- package/dist/CloudflareOtlp.d.mts +95 -0
- package/dist/CloudflareOtlp.mjs +125 -0
- package/dist/CloudflareTracer.d.mts +20 -0
- package/dist/CloudflareTracer.mjs +69 -0
- package/dist/ComputerArtifacts.d.mts +2 -2
- package/dist/ComputerArtifacts.mjs +3 -2
- package/dist/ComputerWorkspace.d.mts +36 -31
- package/dist/ComputerWorkspace.mjs +8 -3
- package/dist/ComputerWorkspaceHost.d.mts +1 -1
- package/dist/ComputerWorkspaceHost.mjs +1 -1
- package/dist/{ContainerNamespace-DbLaeFhN.d.mts → ContainerNamespace.d.mts} +16 -12
- package/dist/ContainerNamespace.mjs +165 -0
- package/dist/D1.d.mts +33 -0
- package/dist/D1.mjs +32 -0
- package/dist/DurableObject.d.mts +103 -0
- package/dist/DurableObject.mjs +77 -0
- package/dist/DurableObjectAlarm.d.mts +187 -0
- package/dist/DurableObjectAlarm.mjs +344 -0
- package/dist/DurableObjectDefinition.d.mts +87 -0
- package/dist/DurableObjectDefinition.mjs +125 -0
- package/dist/DurableObjectNamespace.d.mts +154 -0
- package/dist/DurableObjectNamespace.mjs +144 -0
- package/dist/DurableObjectRpcWebSocket.d.mts +112 -0
- package/dist/DurableObjectRpcWebSocket.mjs +547 -0
- package/dist/DurableObjectSqlite.d.mts +11 -0
- package/dist/DurableObjectSqlite.mjs +16 -0
- package/dist/DurableObjectState.d.mts +65 -0
- package/dist/DurableObjectState.mjs +47 -0
- package/dist/DurableObjectStorage.d.mts +112 -0
- package/dist/{DurableObjectState-DLL0YgBd.mjs → DurableObjectStorage.mjs} +19 -157
- package/dist/DurableObjectWebSocket.d.mts +83 -0
- package/dist/DurableObjectWebSocket.mjs +120 -0
- package/dist/Email.d.mts +106 -0
- package/dist/Email.mjs +247 -0
- package/dist/Environment.d.mts +59 -0
- package/dist/{ErrorMessage-Byx2OgNd.mjs → Environment.mjs} +7 -18
- package/dist/{Hyperdrive-HrwFlZ6x.d.mts → Hyperdrive.d.mts} +8 -5
- package/dist/Hyperdrive.mjs +32 -0
- package/dist/HyperdrivePg.d.mts +4 -3
- package/dist/HyperdrivePg.mjs +3 -1
- package/dist/Images.d.mts +191 -0
- package/dist/Images.mjs +112 -0
- package/dist/Kv.d.mts +84 -0
- package/dist/Kv.mjs +132 -0
- package/dist/Mcp.d.mts +5 -3
- package/dist/Mcp.mjs +13 -4
- package/dist/Queue.d.mts +68 -0
- package/dist/Queue.mjs +54 -0
- package/dist/QueueBinding.d.mts +42 -0
- package/dist/QueueBinding.mjs +69 -0
- package/dist/QueueDefinition.d.mts +48 -0
- package/dist/QueueDefinition.mjs +63 -0
- package/dist/R2.d.mts +89 -0
- package/dist/R2.mjs +117 -0
- package/dist/Rpc.d.mts +29 -0
- package/dist/Rpc.mjs +28 -0
- package/dist/RpcDefinition.d.mts +116 -0
- package/dist/RpcDefinition.mjs +184 -0
- package/dist/RpcTracing.d.mts +52 -0
- package/dist/RpcTracing.mjs +77 -0
- package/dist/Sandbox.d.mts +10 -5
- package/dist/Sandbox.mjs +9 -3
- package/dist/ServiceBinding.d.mts +112 -0
- package/dist/ServiceBinding.mjs +145 -0
- package/dist/Vectorize.d.mts +68 -0
- package/dist/Vectorize.mjs +76 -0
- package/dist/Vitest.d.mts +6 -4
- package/dist/Vitest.mjs +8 -4
- package/dist/WebTransport.d.mts +66 -0
- package/dist/WebTransport.mjs +63 -0
- package/dist/Worker.d.mts +139 -0
- package/dist/Worker.mjs +141 -0
- package/dist/WorkerDefinition.d.mts +100 -0
- package/dist/WorkerDefinition.mjs +103 -0
- package/dist/WorkersAi.d.mts +84 -0
- package/dist/WorkersAi.mjs +84 -0
- package/dist/Workflow.d.mts +91 -0
- package/dist/Workflow.mjs +139 -0
- package/dist/{WorkflowBinding-DtVykUCz.d.mts → WorkflowBinding.d.mts} +14 -10
- package/dist/WorkflowBinding.mjs +100 -0
- package/dist/WorkflowDefinition.d.mts +51 -0
- package/dist/WorkflowDefinition.mjs +69 -0
- package/dist/{rolldown-runtime-D7D4PA-g.mjs → _virtual/_rolldown/runtime.mjs} +1 -1
- package/dist/index.d.mts +40 -1800
- package/dist/index.mjs +40 -3123
- package/dist/{ComputerWorkspaceHostRegistry-CY5Fv4Ng.mjs → internal/ComputerWorkspaceHostRegistry.mjs} +1 -1
- package/dist/internal/Entrypoint.mjs +37 -0
- package/dist/internal/ErrorMessage.mjs +17 -0
- package/dist/internal/NativeCallback.mjs +33 -0
- package/dist/internal/RpcInvocation.d.mts +13 -0
- package/dist/internal/RpcInvocation.mjs +34 -0
- package/dist/internal/Runtime.mjs +31 -0
- package/dist/internal/Telemetry.mjs +20 -0
- package/dist/{WorkerContext-Yobnfw-K.mjs → internal/WorkerContext.mjs} +4 -31
- package/package.json +1 -1
- package/src/AiGateway.ts +5 -1
- package/src/AnalyticsEngine.ts +14 -19
- package/src/Artifacts.ts +6 -1
- package/src/Binding.ts +5 -1
- package/src/BrowserRendering.ts +5 -1
- package/src/Cache.ts +5 -1
- package/src/CloudflareOtlp.ts +12 -10
- package/src/CloudflareTracer.ts +7 -1
- package/src/ComputerArtifacts.ts +2 -1
- package/src/ComputerWorkspace.ts +7 -1
- package/src/ContainerNamespace.ts +6 -1
- package/src/D1.ts +4 -1
- package/src/DurableObject.ts +122 -29
- package/src/DurableObjectAlarm.ts +185 -52
- package/src/DurableObjectDefinition.ts +22 -22
- package/src/DurableObjectNamespace.ts +4 -1
- package/src/DurableObjectRpcWebSocket.ts +7 -1
- package/src/DurableObjectSqlite.ts +2 -1
- package/src/DurableObjectState.ts +4 -1
- package/src/DurableObjectStorage.ts +11 -13
- package/src/DurableObjectWebSocket.ts +5 -1
- package/src/Email.ts +5 -1
- package/src/Environment.ts +6 -1
- package/src/Hyperdrive.ts +4 -1
- package/src/HyperdrivePg.ts +3 -1
- package/src/Images.ts +7 -1
- package/src/Kv.ts +7 -1
- package/src/Mcp.ts +13 -13
- package/src/Queue.ts +3 -1
- package/src/QueueBinding.ts +5 -1
- package/src/QueueDefinition.ts +4 -1
- package/src/R2.ts +7 -1
- package/src/Rpc.ts +4 -1
- package/src/RpcDefinition.ts +4 -1
- package/src/RpcTracing.ts +9 -1
- package/src/Sandbox.ts +7 -1
- package/src/ServiceBinding.ts +6 -1
- package/src/Vectorize.ts +7 -1
- package/src/Vitest.ts +5 -1
- package/src/WebTransport.ts +6 -1
- package/src/Worker.ts +10 -16
- package/src/WorkerDefinition.ts +3 -1
- package/src/WorkersAi.ts +7 -1
- package/src/Workflow.ts +8 -11
- package/src/WorkflowBinding.ts +6 -1
- package/src/WorkflowDefinition.ts +4 -1
- package/src/internal/Entrypoint.ts +3 -1
- package/src/internal/ErrorMessage.ts +1 -1
- package/src/internal/NativeCallback.ts +3 -1
- package/src/internal/RpcInvocation.ts +5 -1
- package/src/internal/Runtime.ts +5 -1
- package/src/internal/Telemetry.ts +4 -3
- package/src/internal/WorkerContext.ts +3 -1
- package/dist/Binding-DKcLrQCM.d.mts +0 -94
- package/dist/DurableObjectState-DJ0K-zyd.d.mts +0 -244
- package/dist/Worker-XsGJsCJX.mjs +0 -885
- package/dist/Worker-gV4mDqIs.d.mts +0 -641
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { assertNoReservedMethods, encodeWireError } from "../RpcDefinition.mjs";
|
|
2
|
+
import { RpcTraceContext } from "../RpcTracing.mjs";
|
|
3
|
+
import { CurrentInvocation } from "./RpcInvocation.mjs";
|
|
4
|
+
import * as Effect from "effect/Effect";
|
|
5
|
+
import * as Schema from "effect/Schema";
|
|
6
|
+
import * as Layer from "effect/Layer";
|
|
7
|
+
//#region src/internal/Entrypoint.ts
|
|
8
|
+
const isRpcTraceContext = Schema.is(RpcTraceContext);
|
|
9
|
+
const invokeEntrypointRpcMethod = (self, method, args, run, onExit, service, key, rpcTracing) => {
|
|
10
|
+
const last = args.at(-1);
|
|
11
|
+
const parent = rpcTracing !== void 0 && isRpcTraceContext(last) ? last : void 0;
|
|
12
|
+
const handlerArgs = parent === void 0 ? args : args.slice(0, -1);
|
|
13
|
+
const invocation = {
|
|
14
|
+
service: rpcTracing?.service ?? service,
|
|
15
|
+
method: key,
|
|
16
|
+
args: handlerArgs,
|
|
17
|
+
parent
|
|
18
|
+
};
|
|
19
|
+
const handler = Effect.suspend(() => method(...handlerArgs)).pipe(Effect.provideService(CurrentInvocation, invocation), Effect.mapError(encodeWireError));
|
|
20
|
+
return run(self, onExit === void 0 ? handler : handler.pipe(Effect.onExit(() => onExit(self))), invocation);
|
|
21
|
+
};
|
|
22
|
+
const provideEntrypointServices = (layer, services) => layer.pipe(Layer.provideMerge(services));
|
|
23
|
+
const defineEntrypointRpcMethods = (target, prototype, rpc, reservedMethodNames, run, onExit, rpcTracing) => {
|
|
24
|
+
const methods = rpc ?? {};
|
|
25
|
+
assertNoReservedMethods(target, methods, reservedMethodNames);
|
|
26
|
+
for (const [key, method] of Object.entries(methods)) Object.defineProperty(prototype, key, {
|
|
27
|
+
enumerable: true,
|
|
28
|
+
value(...args) {
|
|
29
|
+
return invokeEntrypointRpcMethod(this, method, args, run, onExit, target, key, rpcTracing);
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
const assumeEntrypointClass = (entrypoint) => {
|
|
34
|
+
return entrypoint;
|
|
35
|
+
};
|
|
36
|
+
//#endregion
|
|
37
|
+
export { assumeEntrypointClass, defineEntrypointRpcMethods, provideEntrypointServices };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as Predicate from "effect/Predicate";
|
|
2
|
+
//#region src/internal/ErrorMessage.ts
|
|
3
|
+
/**
|
|
4
|
+
* Renders the most useful human-readable description of an unknown `cause`
|
|
5
|
+
* for use in tagged error `message` getters.
|
|
6
|
+
*/
|
|
7
|
+
const causeMessage = (cause) => {
|
|
8
|
+
if (Predicate.hasProperty(cause, "message") && Predicate.isString(cause.message) && cause.message.length > 0) return cause.message;
|
|
9
|
+
try {
|
|
10
|
+
return String(cause);
|
|
11
|
+
} catch {
|
|
12
|
+
return "unknown cause";
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
const violationsMessage = (violations) => violations.map((violation) => `${violation.path}: ${violation.message}`).join("; ");
|
|
16
|
+
//#endregion
|
|
17
|
+
export { causeMessage, violationsMessage };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect";
|
|
2
|
+
import "effect/Exit";
|
|
3
|
+
import * as FiberSet from "effect/FiberSet";
|
|
4
|
+
//#region src/internal/NativeCallback.ts
|
|
5
|
+
/**
|
|
6
|
+
* Runs an Effect callback owned by a native Promise operation.
|
|
7
|
+
*
|
|
8
|
+
* The callback keeps the caller's context, while a private scope owns its
|
|
9
|
+
* fiber. Closing that scope interrupts and joins the callback before awaiting
|
|
10
|
+
* the native operation's settlement.
|
|
11
|
+
*/
|
|
12
|
+
const runNativeCallback = Effect.fnUntraced(function* (operation) {
|
|
13
|
+
const callerContext = yield* Effect.context();
|
|
14
|
+
return yield* Effect.scoped(Effect.gen(function* () {
|
|
15
|
+
let nativePromise;
|
|
16
|
+
yield* Effect.addFinalizer(() => {
|
|
17
|
+
const promise = nativePromise;
|
|
18
|
+
return promise === void 0 ? Effect.void : Effect.promise(() => promise.then(() => void 0, () => void 0));
|
|
19
|
+
});
|
|
20
|
+
const runPromise = yield* FiberSet.makeRuntimePromise();
|
|
21
|
+
return yield* Effect.callback((resume) => {
|
|
22
|
+
try {
|
|
23
|
+
nativePromise = operation((effect) => runPromise(Effect.provideContext(Effect.exit(effect), callerContext)));
|
|
24
|
+
} catch (cause) {
|
|
25
|
+
resume(Effect.fail(cause));
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
nativePromise.then((value) => resume(Effect.succeed(value)), (cause) => resume(Effect.fail(cause)));
|
|
29
|
+
});
|
|
30
|
+
}));
|
|
31
|
+
});
|
|
32
|
+
//#endregion
|
|
33
|
+
export { runNativeCallback };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Result } from "../Rpc.mjs";
|
|
2
|
+
import "../RpcTracing.mjs";
|
|
3
|
+
import "effect/Context";
|
|
4
|
+
import "effect/Effect";
|
|
5
|
+
import "effect/Schema";
|
|
6
|
+
//#region src/internal/RpcInvocation.d.ts
|
|
7
|
+
type AnyArgs = Array<any>;
|
|
8
|
+
type AsyncMethodKey<Api> = { [Key in keyof Api]-?: Key extends string ? Api[Key] extends ((...args: AnyArgs) => Promise<any>) ? Key : never : never; }[keyof Api];
|
|
9
|
+
type AsyncMethodArgs<Api, Method extends keyof Api> = Api[Method] extends ((...args: infer Args) => Promise<any>) ? Args : never;
|
|
10
|
+
type AsyncMethodSuccess<Api, Method extends keyof Api> = Api[Method] extends ((...args: AnyArgs) => Promise<infer A>) ? A : never;
|
|
11
|
+
type AsyncMethodCloudflareReturn<Api, Method extends keyof Api> = Result<AsyncMethodSuccess<Api, Method>>;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { AsyncMethodArgs, AsyncMethodCloudflareReturn, AsyncMethodKey, AsyncMethodSuccess };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import * as Context from "effect/Context";
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
import "effect/Schema";
|
|
4
|
+
import * as Predicate from "effect/Predicate";
|
|
5
|
+
import * as Option from "effect/Option";
|
|
6
|
+
//#region src/internal/RpcInvocation.ts
|
|
7
|
+
/** Scoped to the incoming event effect, never the instance runtime or storage. */
|
|
8
|
+
var CurrentInvocation = class extends Context.Service()("effect-cf/internal/RpcInvocation") {};
|
|
9
|
+
const recordDecodedArgs = (args) => Effect.map(Effect.serviceOption(CurrentInvocation), (invocation) => {
|
|
10
|
+
if (Option.isSome(invocation)) invocation.value.decodedArgs = args;
|
|
11
|
+
});
|
|
12
|
+
const invokeWithReceiver = (value, receiver, args) => {
|
|
13
|
+
return Function.prototype.apply.call(value, receiver, args);
|
|
14
|
+
};
|
|
15
|
+
const lookupRpcMethod = (target, method, makeError) => Effect.try({
|
|
16
|
+
try: () => {
|
|
17
|
+
if (!Predicate.isObjectKeyword(target)) throw new TypeError(`RPC target is not object-like`);
|
|
18
|
+
const receiver = target;
|
|
19
|
+
const value = receiver[method];
|
|
20
|
+
if (!Predicate.isFunction(value)) throw new TypeError(`RPC method "${String(method)}" is not callable`);
|
|
21
|
+
const callable = value;
|
|
22
|
+
return (...args) => invokeWithReceiver(callable, receiver, args);
|
|
23
|
+
},
|
|
24
|
+
catch: makeError
|
|
25
|
+
});
|
|
26
|
+
const invokeRpcMethod = Effect.fnUntraced(function* (target, method, args, makeError) {
|
|
27
|
+
const fn = yield* lookupRpcMethod(target, method, makeError);
|
|
28
|
+
return yield* Effect.try({
|
|
29
|
+
try: () => fn(...args),
|
|
30
|
+
catch: makeError
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
//#endregion
|
|
34
|
+
export { CurrentInvocation, invokeRpcMethod, lookupRpcMethod, recordDecodedArgs };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { WorkerConfig, WorkerEnvironment } from "../Environment.mjs";
|
|
2
|
+
import { provideEntrypointServices } from "./Entrypoint.mjs";
|
|
3
|
+
import * as Effect from "effect/Effect";
|
|
4
|
+
import * as Layer from "effect/Layer";
|
|
5
|
+
import * as ConfigProvider from "effect/ConfigProvider";
|
|
6
|
+
import * as ManagedRuntime from "effect/ManagedRuntime";
|
|
7
|
+
//#region src/internal/Runtime.ts
|
|
8
|
+
/**
|
|
9
|
+
* Assembles the shared `ManagedRuntime` used by the Cloudflare entrypoint
|
|
10
|
+
* classes (Worker, Durable Object, Workflow).
|
|
11
|
+
*
|
|
12
|
+
* The entrypoint-specific services are merged with the env-backed
|
|
13
|
+
* `ConfigProvider` and `WorkerEnvironment`, then provided to the user-supplied
|
|
14
|
+
* layer so the resulting runtime satisfies both the user services and the
|
|
15
|
+
* platform services.
|
|
16
|
+
*/
|
|
17
|
+
const makeEntrypointRuntime = (layer, env, services) => {
|
|
18
|
+
const entrypointServices = Layer.mergeAll(services, ConfigProvider.layer(WorkerConfig.providerFromEnv(env)), Layer.succeed(WorkerEnvironment, env));
|
|
19
|
+
return ManagedRuntime.make(provideEntrypointServices(layer, entrypointServices));
|
|
20
|
+
};
|
|
21
|
+
function runEventPromise(...args) {
|
|
22
|
+
const [runtime, effect, eventLayer, parent] = args;
|
|
23
|
+
if (eventLayer === void 0) {
|
|
24
|
+
const event = Effect.scoped(effect);
|
|
25
|
+
return runtime.runPromise(parent === void 0 ? event : Effect.withParentSpan(event, parent));
|
|
26
|
+
}
|
|
27
|
+
const event = Effect.scoped(effect.pipe(Effect.provide(eventLayer, { local: true })));
|
|
28
|
+
return runtime.runPromise(parent === void 0 ? event : Effect.withParentSpan(event, parent));
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
export { makeEntrypointRuntime, runEventPromise };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect";
|
|
2
|
+
import * as Option from "effect/Option";
|
|
3
|
+
import { Flusher } from "effect/unstable/observability/OtlpExporter";
|
|
4
|
+
//#region src/internal/Telemetry.ts
|
|
5
|
+
/** Maximum event lifetime spent on an internally scheduled telemetry flush. */
|
|
6
|
+
const scheduledFlushTimeout = "2 seconds";
|
|
7
|
+
/**
|
|
8
|
+
* Schedules a configured OTLP flusher through the current Cloudflare event.
|
|
9
|
+
*
|
|
10
|
+
* The handed-off effect is best-effort: it settles within two seconds and
|
|
11
|
+
* silently absorbs every failure cause so telemetry cannot extend or fail the
|
|
12
|
+
* user event, or recursively log through an unhealthy exporter.
|
|
13
|
+
*/
|
|
14
|
+
const scheduleTelemetryFlush = (waitUntil) => Effect.gen(function* () {
|
|
15
|
+
const flusher = yield* Effect.serviceOption(Flusher);
|
|
16
|
+
if (Option.isNone(flusher)) return;
|
|
17
|
+
yield* waitUntil(flusher.value.flush.pipe(Effect.timeoutOption(scheduledFlushTimeout), Effect.ignoreCause, Effect.asVoid));
|
|
18
|
+
}).pipe(Effect.ignoreCause);
|
|
19
|
+
//#endregion
|
|
20
|
+
export { scheduleTelemetryFlush };
|
|
@@ -1,33 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* Runs an Effect callback owned by a native Promise operation.
|
|
5
|
-
*
|
|
6
|
-
* The callback keeps the caller's context, while a private scope owns its
|
|
7
|
-
* fiber. Closing that scope interrupts and joins the callback before awaiting
|
|
8
|
-
* the native operation's settlement.
|
|
9
|
-
*/
|
|
10
|
-
const runNativeCallback = Effect.fnUntraced(function* (operation) {
|
|
11
|
-
const callerContext = yield* Effect.context();
|
|
12
|
-
return yield* Effect.scoped(Effect.gen(function* () {
|
|
13
|
-
let nativePromise;
|
|
14
|
-
yield* Effect.addFinalizer(() => {
|
|
15
|
-
const promise = nativePromise;
|
|
16
|
-
return promise === void 0 ? Effect.void : Effect.promise(() => promise.then(() => void 0, () => void 0));
|
|
17
|
-
});
|
|
18
|
-
const runPromise = yield* FiberSet.makeRuntimePromise();
|
|
19
|
-
return yield* Effect.callback((resume) => {
|
|
20
|
-
try {
|
|
21
|
-
nativePromise = operation((effect) => runPromise(Effect.provideContext(Effect.exit(effect), callerContext)));
|
|
22
|
-
} catch (cause) {
|
|
23
|
-
resume(Effect.fail(cause));
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
nativePromise.then((value) => resume(Effect.succeed(value)), (cause) => resume(Effect.fail(cause)));
|
|
27
|
-
});
|
|
28
|
-
}));
|
|
29
|
-
});
|
|
30
|
-
//#endregion
|
|
1
|
+
import * as Effect from "effect/Effect";
|
|
2
|
+
import * as Cause from "effect/Cause";
|
|
3
|
+
import * as Exit from "effect/Exit";
|
|
31
4
|
//#region src/internal/WorkerContext.ts
|
|
32
5
|
const causeError = (cause) => {
|
|
33
6
|
const squashed = Cause.squash(cause);
|
|
@@ -57,4 +30,4 @@ const fromExecutionContext = (ctx, runPromiseExit = (effect) => Effect.runPromis
|
|
|
57
30
|
};
|
|
58
31
|
};
|
|
59
32
|
//#endregion
|
|
60
|
-
export {
|
|
33
|
+
export { fromExecutionContext, makeWaitUntilScheduler };
|
package/package.json
CHANGED
package/src/AiGateway.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as Context from "effect/Context";
|
|
2
|
+
import * as Data from "effect/Data";
|
|
3
|
+
import * as Effect from "effect/Effect";
|
|
4
|
+
import * as S from "effect/Schema";
|
|
5
|
+
import type { Layer } from "effect";
|
|
2
6
|
import type { AiGateway as CloudflareAiGateway } from "@cloudflare/workers-types";
|
|
3
7
|
|
|
4
8
|
import * as Binding from "./Binding";
|
package/src/AnalyticsEngine.ts
CHANGED
|
@@ -2,25 +2,20 @@ import type {
|
|
|
2
2
|
AnalyticsEngineDataPoint as CloudflareAnalyticsEngineDataPoint,
|
|
3
3
|
AnalyticsEngineDataset as CloudflareAnalyticsEngineDataset,
|
|
4
4
|
} from "@cloudflare/workers-types";
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
import
|
|
18
|
-
|
|
19
|
-
type Headers,
|
|
20
|
-
HttpClient,
|
|
21
|
-
type HttpClientResponse,
|
|
22
|
-
HttpClientRequest,
|
|
23
|
-
} from "effect/unstable/http";
|
|
5
|
+
import * as Config from "effect/Config";
|
|
6
|
+
import * as Context from "effect/Context";
|
|
7
|
+
import * as Data from "effect/Data";
|
|
8
|
+
import * as Effect from "effect/Effect";
|
|
9
|
+
import * as Layer from "effect/Layer";
|
|
10
|
+
import * as Option from "effect/Option";
|
|
11
|
+
import * as Predicate from "effect/Predicate";
|
|
12
|
+
import * as Result from "effect/Result";
|
|
13
|
+
import * as S from "effect/Schema";
|
|
14
|
+
import type { Redacted } from "effect";
|
|
15
|
+
import * as FetchHttpClient from "effect/unstable/http/FetchHttpClient";
|
|
16
|
+
import * as HttpClient from "effect/unstable/http/HttpClient";
|
|
17
|
+
import * as HttpClientRequest from "effect/unstable/http/HttpClientRequest";
|
|
18
|
+
import type { Headers, HttpClientResponse } from "effect/unstable/http";
|
|
24
19
|
|
|
25
20
|
import * as Binding from "./Binding";
|
|
26
21
|
import type { WorkerEnvironment } from "./Environment";
|
package/src/Artifacts.ts
CHANGED
|
@@ -6,7 +6,12 @@ import type {
|
|
|
6
6
|
ArtifactsTokenInfo as CloudflareArtifactsTokenInfo,
|
|
7
7
|
ArtifactsTokenListResult as CloudflareArtifactsTokenListResult,
|
|
8
8
|
} from "@cloudflare/workers-types";
|
|
9
|
-
import
|
|
9
|
+
import * as Context from "effect/Context";
|
|
10
|
+
import * as Data from "effect/Data";
|
|
11
|
+
import * as Effect from "effect/Effect";
|
|
12
|
+
import * as Predicate from "effect/Predicate";
|
|
13
|
+
import * as Schema from "effect/Schema";
|
|
14
|
+
import type { Layer } from "effect";
|
|
10
15
|
|
|
11
16
|
import * as Binding from "./Binding";
|
|
12
17
|
import type { WorkerEnvironment } from "./Environment";
|
package/src/Binding.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as Context from "effect/Context";
|
|
2
|
+
import * as Data from "effect/Data";
|
|
3
|
+
import * as Effect from "effect/Effect";
|
|
4
|
+
import * as Layer from "effect/Layer";
|
|
5
|
+
import * as Predicate from "effect/Predicate";
|
|
2
6
|
|
|
3
7
|
import { WorkerEnvironment, type WorkerEnv } from "./Environment";
|
|
4
8
|
|
package/src/BrowserRendering.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as Context from "effect/Context";
|
|
2
|
+
import * as Data from "effect/Data";
|
|
3
|
+
import * as Effect from "effect/Effect";
|
|
4
|
+
import * as Predicate from "effect/Predicate";
|
|
5
|
+
import type { Layer } from "effect";
|
|
2
6
|
|
|
3
7
|
import * as Binding from "./Binding";
|
|
4
8
|
import type { WorkerEnvironment } from "./Environment";
|
package/src/Cache.ts
CHANGED
|
@@ -4,7 +4,11 @@ import type {
|
|
|
4
4
|
CacheStorage as CloudflareCacheStorage,
|
|
5
5
|
RequestInfo as CloudflareRequestInfo,
|
|
6
6
|
} from "@cloudflare/workers-types";
|
|
7
|
-
import
|
|
7
|
+
import * as Context from "effect/Context";
|
|
8
|
+
import * as Data from "effect/Data";
|
|
9
|
+
import * as Effect from "effect/Effect";
|
|
10
|
+
import * as Layer from "effect/Layer";
|
|
11
|
+
import * as Option from "effect/Option";
|
|
8
12
|
|
|
9
13
|
import * as ErrorMessage from "./internal/ErrorMessage";
|
|
10
14
|
|
package/src/CloudflareOtlp.ts
CHANGED
|
@@ -4,17 +4,19 @@
|
|
|
4
4
|
* flush explicitly. Scheduled flush failures cannot fail user events. Exporter
|
|
5
5
|
* layer finalizers run separately and follow their configured shutdown timeout.
|
|
6
6
|
*/
|
|
7
|
-
import
|
|
7
|
+
import * as ConfigProvider from "effect/ConfigProvider";
|
|
8
|
+
import * as Effect from "effect/Effect";
|
|
9
|
+
import * as Layer from "effect/Layer";
|
|
10
|
+
import * as Option from "effect/Option";
|
|
8
11
|
import type * as Tracer from "effect/Tracer";
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
} from "effect/unstable/observability";
|
|
12
|
+
import * as FetchHttpClient from "effect/unstable/http/FetchHttpClient";
|
|
13
|
+
import type { Headers } from "effect/unstable/http";
|
|
14
|
+
import * as OtlpExporter from "effect/unstable/observability/OtlpExporter";
|
|
15
|
+
import * as OtlpLogger from "effect/unstable/observability/OtlpLogger";
|
|
16
|
+
import * as OtlpMetrics from "effect/unstable/observability/OtlpMetrics";
|
|
17
|
+
import * as OtlpResource from "effect/unstable/observability/OtlpResource";
|
|
18
|
+
import * as OtlpSerialization from "effect/unstable/observability/OtlpSerialization";
|
|
19
|
+
import * as OtlpTracer from "effect/unstable/observability/OtlpTracer";
|
|
18
20
|
|
|
19
21
|
import { DurableObjectState } from "./DurableObjectState";
|
|
20
22
|
import { WorkerConfig, WorkerEnvironment } from "./Environment";
|
package/src/CloudflareTracer.ts
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
2
2
|
import { tracing } from "cloudflare:workers";
|
|
3
|
-
import
|
|
3
|
+
import * as Cause from "effect/Cause";
|
|
4
|
+
import * as Effect from "effect/Effect";
|
|
5
|
+
import * as Exit from "effect/Exit";
|
|
6
|
+
import * as Layer from "effect/Layer";
|
|
7
|
+
import * as Option from "effect/Option";
|
|
8
|
+
import * as Predicate from "effect/Predicate";
|
|
9
|
+
import * as Tracer from "effect/Tracer";
|
|
4
10
|
|
|
5
11
|
type SpanOptions = Parameters<Tracer.Tracer["span"]>[0];
|
|
6
12
|
type RunInContext = ReturnType<typeof AsyncLocalStorage.snapshot>;
|
package/src/ComputerArtifacts.ts
CHANGED
|
@@ -8,7 +8,8 @@ import type {
|
|
|
8
8
|
ArtifactsCLIResult as CloudflareComputerArtifactsCliResult,
|
|
9
9
|
RemoteAddFn as CloudflareComputerRemoteAdd,
|
|
10
10
|
} from "@cloudflare/computer/artifacts";
|
|
11
|
-
import
|
|
11
|
+
import * as Effect from "effect/Effect";
|
|
12
|
+
import * as Predicate from "effect/Predicate";
|
|
12
13
|
|
|
13
14
|
import * as Artifacts from "./Artifacts";
|
|
14
15
|
|
package/src/ComputerWorkspace.ts
CHANGED
|
@@ -27,7 +27,13 @@ import type {
|
|
|
27
27
|
GitLogOptions as CloudflareGitLogOptions,
|
|
28
28
|
GitUpdateRefOptions as CloudflareGitUpdateRefOptions,
|
|
29
29
|
} from "@cloudflare/computer/git";
|
|
30
|
-
import
|
|
30
|
+
import * as Context from "effect/Context";
|
|
31
|
+
import * as Effect from "effect/Effect";
|
|
32
|
+
import * as Layer from "effect/Layer";
|
|
33
|
+
import * as Predicate from "effect/Predicate";
|
|
34
|
+
import * as Schema from "effect/Schema";
|
|
35
|
+
import * as Stream from "effect/Stream";
|
|
36
|
+
import type { Scope } from "effect";
|
|
31
37
|
|
|
32
38
|
import * as ComputerArtifacts from "./ComputerArtifacts";
|
|
33
39
|
import { DurableObjectState } from "./DurableObjectState";
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as Context from "effect/Context";
|
|
2
|
+
import * as Data from "effect/Data";
|
|
3
|
+
import * as Effect from "effect/Effect";
|
|
4
|
+
import * as Predicate from "effect/Predicate";
|
|
5
|
+
import * as S from "effect/Schema";
|
|
6
|
+
import type { Layer } from "effect";
|
|
2
7
|
|
|
3
8
|
import * as Binding from "./Binding";
|
|
4
9
|
import type { WorkerEnvironment } from "./Environment";
|
package/src/D1.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { D1Client } from "@effect/sql-d1";
|
|
2
|
-
import
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
import * as Layer from "effect/Layer";
|
|
4
|
+
import * as Predicate from "effect/Predicate";
|
|
5
|
+
import type { Config } from "effect";
|
|
3
6
|
import type { SqlClient } from "effect/unstable/sql";
|
|
4
7
|
|
|
5
8
|
import * as Binding from "./Binding";
|