liminal 0.17.11 → 0.17.12
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/{util/Accumulator.ts → Accumulator.ts} +2 -2
- package/{actor/Actor.ts → Actor.ts} +3 -3
- package/{actor/Audition.ts → Audition.ts} +2 -2
- package/CHANGELOG.md +9 -0
- package/{actor/Client.ts → Client.ts} +3 -3
- package/{actor/ClientDirectory.ts → ClientDirectory.ts} +4 -4
- package/{actor/Method.ts → Method.ts} +6 -6
- package/_diagnostic.ts +3 -0
- package/browser/BrowserActorNamespace.ts +213 -0
- package/browser/index.ts +1 -0
- package/dist/{util/Accumulator.js → Accumulator.js} +2 -2
- package/dist/Accumulator.js.map +1 -0
- package/dist/{actor/Actor.d.ts → Actor.d.ts} +1 -1
- package/dist/{actor/Actor.js → Actor.js} +2 -2
- package/dist/Actor.js.map +1 -0
- package/dist/ActorTransport.js.map +1 -0
- package/dist/{actor/Audition.js → Audition.js} +2 -2
- package/dist/Audition.js.map +1 -0
- package/dist/{actor/Client.js → Client.js} +3 -3
- package/dist/Client.js.map +1 -0
- package/dist/{actor/ClientDirectory.d.ts → ClientDirectory.d.ts} +1 -1
- package/dist/{actor/ClientDirectory.js → ClientDirectory.js} +3 -3
- package/dist/ClientDirectory.js.map +1 -0
- package/dist/ClientHandle.js.map +1 -0
- package/dist/F.js.map +1 -0
- package/dist/{actor/Method.d.ts → Method.d.ts} +4 -4
- package/dist/Method.js.map +1 -0
- package/dist/Protocol.js.map +1 -0
- package/dist/_diagnostic.d.ts +4 -0
- package/dist/_diagnostic.js +3 -0
- package/dist/_diagnostic.js.map +1 -0
- package/dist/_util/Mutex.js.map +1 -0
- package/dist/_util/phantom.js.map +1 -0
- package/dist/_util/schema.js.map +1 -0
- package/dist/{socket_util.js → _util/socket.js} +1 -1
- package/dist/_util/socket.js.map +1 -0
- package/dist/browser/BrowserActorNamespace.d.ts +16 -0
- package/dist/browser/BrowserActorNamespace.js +112 -0
- package/dist/browser/BrowserActorNamespace.js.map +1 -0
- package/dist/browser/index.d.ts +1 -0
- package/dist/browser/index.js +2 -0
- package/dist/browser/index.js.map +1 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +11 -12
- package/dist/index.js +11 -12
- package/dist/index.js.map +1 -1
- package/dist/package.json +12 -16
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/workerd/WorkerdActorNamespace.d.ts +23 -0
- package/dist/{actor/ActorRegistry.js → workerd/WorkerdActorNamespace.js} +18 -19
- package/dist/workerd/WorkerdActorNamespace.js.map +1 -0
- package/dist/workerd/index.d.ts +1 -0
- package/dist/workerd/index.js +2 -0
- package/dist/workerd/index.js.map +1 -0
- package/index.ts +11 -12
- package/package.json +12 -16
- package/tsconfig.json +2 -1
- package/{actor/ActorRegistry.ts → workerd/WorkerdActorNamespace.ts} +44 -44
- package/workerd/index.ts +1 -0
- package/Ai.ts +0 -7
- package/Assets.ts +0 -21
- package/Binding.ts +0 -40
- package/D1.ts +0 -8
- package/DoState.ts +0 -3
- package/Hyperdrive.ts +0 -11
- package/Images.ts +0 -101
- package/Kv.ts +0 -65
- package/NativeRequest.ts +0 -3
- package/R2.ts +0 -7
- package/Worker.ts +0 -54
- package/WorkerLoader.ts +0 -29
- package/actor/index.ts +0 -11
- package/asset_forwarding.ts +0 -13
- package/commands/sync-env.ts +0 -30
- package/dist/Ai.d.ts +0 -6
- package/dist/Ai.js +0 -6
- package/dist/Ai.js.map +0 -1
- package/dist/Assets.d.ts +0 -11
- package/dist/Assets.js +0 -14
- package/dist/Assets.js.map +0 -1
- package/dist/Binding.d.ts +0 -2
- package/dist/Binding.js +0 -19
- package/dist/Binding.js.map +0 -1
- package/dist/D1.d.ts +0 -7
- package/dist/D1.js +0 -7
- package/dist/D1.js.map +0 -1
- package/dist/DoState.d.ts +0 -5
- package/dist/DoState.js +0 -4
- package/dist/DoState.js.map +0 -1
- package/dist/Hyperdrive.d.ts +0 -7
- package/dist/Hyperdrive.js +0 -7
- package/dist/Hyperdrive.js.map +0 -1
- package/dist/Images.d.ts +0 -39
- package/dist/Images.js +0 -60
- package/dist/Images.js.map +0 -1
- package/dist/Kv.d.ts +0 -17
- package/dist/Kv.js +0 -32
- package/dist/Kv.js.map +0 -1
- package/dist/NativeRequest.d.ts +0 -5
- package/dist/NativeRequest.js +0 -4
- package/dist/NativeRequest.js.map +0 -1
- package/dist/R2.d.ts +0 -6
- package/dist/R2.js +0 -6
- package/dist/R2.js.map +0 -1
- package/dist/Worker.d.ts +0 -14
- package/dist/Worker.js +0 -25
- package/dist/Worker.js.map +0 -1
- package/dist/WorkerLoader.d.ts +0 -9
- package/dist/WorkerLoader.js +0 -22
- package/dist/WorkerLoader.js.map +0 -1
- package/dist/actor/Actor.js.map +0 -1
- package/dist/actor/ActorRegistry.d.ts +0 -23
- package/dist/actor/ActorRegistry.js.map +0 -1
- package/dist/actor/ActorTransport.js.map +0 -1
- package/dist/actor/Audition.js.map +0 -1
- package/dist/actor/Client.js.map +0 -1
- package/dist/actor/ClientDirectory.js.map +0 -1
- package/dist/actor/ClientHandle.js.map +0 -1
- package/dist/actor/F.js.map +0 -1
- package/dist/actor/Method.js.map +0 -1
- package/dist/actor/Protocol.js.map +0 -1
- package/dist/actor/errors.js.map +0 -1
- package/dist/actor/index.d.ts +0 -11
- package/dist/actor/index.js +0 -12
- package/dist/actor/index.js.map +0 -1
- package/dist/asset_forwarding.d.ts +0 -4
- package/dist/asset_forwarding.js +0 -9
- package/dist/asset_forwarding.js.map +0 -1
- package/dist/commands/sync-env.d.ts +0 -8
- package/dist/commands/sync-env.js +0 -32
- package/dist/commands/sync-env.js.map +0 -1
- package/dist/main.d.ts +0 -2
- package/dist/main.js +0 -10
- package/dist/main.js.map +0 -1
- package/dist/platform/KeyValueStore.d.ts +0 -6
- package/dist/platform/KeyValueStore.js +0 -96
- package/dist/platform/KeyValueStore.js.map +0 -1
- package/dist/platform/index.d.ts +0 -1
- package/dist/platform/index.js +0 -2
- package/dist/platform/index.js.map +0 -1
- package/dist/socket_util.js.map +0 -1
- package/dist/util/Accumulator.js.map +0 -1
- package/dist/util/Diagnostic.d.ts +0 -5
- package/dist/util/Diagnostic.js +0 -10
- package/dist/util/Diagnostic.js.map +0 -1
- package/dist/util/Mutex.js.map +0 -1
- package/dist/util/boundLayer.d.ts +0 -2
- package/dist/util/boundLayer.js +0 -4
- package/dist/util/boundLayer.js.map +0 -1
- package/dist/util/logCause.d.ts +0 -2
- package/dist/util/logCause.js +0 -7
- package/dist/util/logCause.js.map +0 -1
- package/dist/util/phantom.js.map +0 -1
- package/dist/util/schema.js.map +0 -1
- package/main.ts +0 -19
- package/platform/KeyValueStore.ts +0 -112
- package/platform/index.ts +0 -1
- package/util/Diagnostic.ts +0 -16
- package/util/boundLayer.ts +0 -11
- package/util/logCause.ts +0 -8
- /package/{actor/ActorTransport.ts → ActorTransport.ts} +0 -0
- /package/{actor/ClientHandle.ts → ClientHandle.ts} +0 -0
- /package/{actor/F.ts → F.ts} +0 -0
- /package/{actor/Protocol.ts → Protocol.ts} +0 -0
- /package/{util → _util}/Mutex.ts +0 -0
- /package/{util → _util}/phantom.ts +0 -0
- /package/{util → _util}/schema.ts +0 -0
- /package/{socket_util.ts → _util/socket.ts} +0 -0
- /package/dist/{util/Accumulator.d.ts → Accumulator.d.ts} +0 -0
- /package/dist/{actor/ActorTransport.d.ts → ActorTransport.d.ts} +0 -0
- /package/dist/{actor/ActorTransport.js → ActorTransport.js} +0 -0
- /package/dist/{actor/Audition.d.ts → Audition.d.ts} +0 -0
- /package/dist/{actor/Client.d.ts → Client.d.ts} +0 -0
- /package/dist/{actor/ClientHandle.d.ts → ClientHandle.d.ts} +0 -0
- /package/dist/{actor/ClientHandle.js → ClientHandle.js} +0 -0
- /package/dist/{actor/F.d.ts → F.d.ts} +0 -0
- /package/dist/{actor/F.js → F.js} +0 -0
- /package/dist/{actor/Method.js → Method.js} +0 -0
- /package/dist/{actor/Protocol.d.ts → Protocol.d.ts} +0 -0
- /package/dist/{actor/Protocol.js → Protocol.js} +0 -0
- /package/dist/{util → _util}/Mutex.d.ts +0 -0
- /package/dist/{util → _util}/Mutex.js +0 -0
- /package/dist/{util → _util}/phantom.d.ts +0 -0
- /package/dist/{util → _util}/phantom.js +0 -0
- /package/dist/{util → _util}/schema.d.ts +0 -0
- /package/dist/{util → _util}/schema.js +0 -0
- /package/dist/{socket_util.d.ts → _util/socket.d.ts} +0 -0
- /package/dist/{actor/errors.d.ts → errors.d.ts} +0 -0
- /package/dist/{actor/errors.js → errors.js} +0 -0
- /package/{actor/errors.ts → errors.ts} +0 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Layer, Effect, Scope, Schema as S, Context, Duration } from "effect";
|
|
2
|
+
import { NativeRequest } from "effect-workerd";
|
|
3
|
+
import { HttpServerResponse, HttpClient } from "effect/unstable/http";
|
|
4
|
+
import type { Actor } from "../Actor.ts";
|
|
5
|
+
import type { ProtocolDefinition } from "../Protocol.ts";
|
|
6
|
+
import { type TopFromString } from "../_util/schema.ts";
|
|
7
|
+
import * as Method from "../Method.ts";
|
|
8
|
+
export interface ActorNamespaceDefinition<ActorSelf, ActorId extends string, Name extends TopFromString, AttachmentFields extends S.Struct.Fields, ClientSelf, ClientId extends string, D extends ProtocolDefinition, PreludeROut, PreludeE, RunROut, RunE> {
|
|
9
|
+
readonly ""?: this["actor"]["definition"]["client"]["protocol"];
|
|
10
|
+
readonly actor: Actor<ActorSelf, ActorId, Name, AttachmentFields, ClientSelf, ClientId, D>;
|
|
11
|
+
readonly prelude: Layer.Layer<PreludeROut | NonNullable<this[""]>["F"]["Payload"]["DecodingServices"] | NonNullable<this[""]>["F"]["Success"]["EncodingServices"] | NonNullable<this[""]>["F"]["Failure"]["EncodingServices"] | NonNullable<this[""]>["Event"]["EncodingServices"] | S.Struct<AttachmentFields>["DecodingServices"] | S.Struct<AttachmentFields>["EncodingServices"] | Name["EncodingServices"] | Name["DecodingServices"], PreludeE>;
|
|
12
|
+
readonly layer: Layer.Layer<RunROut, RunE, ActorSelf | HttpClient.HttpClient | PreludeROut>;
|
|
13
|
+
readonly handlers: Method.Handlers<D["methods"], ActorSelf | HttpClient.HttpClient | PreludeROut | RunROut | Scope.Scope>;
|
|
14
|
+
readonly onConnect: Effect.Effect<void, never, ActorSelf | HttpClient.HttpClient | PreludeROut | RunROut | Scope.Scope>;
|
|
15
|
+
readonly hibernation?: Duration.Input | undefined;
|
|
16
|
+
}
|
|
17
|
+
export interface ActorNamespace<NamespaceSelf, NamespaceId extends string, ActorSelf, ActorId extends string, Name extends TopFromString, AttachmentFields extends S.Struct.Fields, ClientSelf, ClientId extends string, D extends ProtocolDefinition, PreludeROut, PreludeE, RunROut, RunE> extends Context.Service<NamespaceSelf, DurableObjectNamespace> {
|
|
18
|
+
new (state: globalThis.DurableObjectState<{}>): Context.ServiceClass.Shape<NamespaceId, DurableObjectNamespace>;
|
|
19
|
+
readonly definition: ActorNamespaceDefinition<ActorSelf, ActorId, Name, AttachmentFields, ClientSelf, ClientId, D, PreludeROut, PreludeE, RunROut, RunE>;
|
|
20
|
+
readonly upgrade: (name: Name["Type"], attachments: S.Struct<AttachmentFields>["Type"]) => Effect.Effect<HttpServerResponse.HttpServerResponse, S.SchemaError, NamespaceSelf | NativeRequest.NativeRequest>;
|
|
21
|
+
readonly layer: (binding: string) => Layer.Layer<NamespaceSelf, S.SchemaError, never>;
|
|
22
|
+
}
|
|
23
|
+
export declare const Service: <NamespaceSelf>() => <NamespaceId extends string, ActorSelf, ActorId extends string, Name extends TopFromString, AttachmentFields extends S.Struct.Fields, ClientSelf, ClientId extends string, D extends ProtocolDefinition, PreludeROut, PreludeE, RunROut, RunE>(id: NamespaceId, definition: ActorNamespaceDefinition<ActorSelf, ActorId, Name, AttachmentFields, ClientSelf, ClientId, D, PreludeROut, PreludeE, RunROut, RunE>) => ActorNamespace<NamespaceSelf, NamespaceId, ActorSelf, ActorId, Name, AttachmentFields, ClientSelf, ClientId, D, PreludeROut, PreludeE, RunROut, RunE>;
|
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
import { Layer, Effect, Scope, Schema as S, Context, ManagedRuntime, ConfigProvider, Duration, flow, String, Array, Encoding, Option, } from "effect";
|
|
2
|
+
import { Binding, DoState, NativeRequest } from "effect-workerd";
|
|
3
|
+
import { SecWebSocketProtocol, close } from "effect-workerd/socket_util";
|
|
2
4
|
import { HttpServerResponse, HttpClient, FetchHttpClient } from "effect/unstable/http";
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import * as
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
import { encodeJsonString, decodeJsonString } from "../util/schema.js";
|
|
12
|
-
import * as Actor from "./Actor.js";
|
|
13
|
-
import * as ClientDirectory from "./ClientDirectory.js";
|
|
14
|
-
const { debug, span } = Diagnostic.module("cloudflare.ActorRegistry");
|
|
5
|
+
import { boundLayer } from "liminal-util/boundLayer";
|
|
6
|
+
import { logCause } from "liminal-util/logCause";
|
|
7
|
+
import { diagnostic } from "../_diagnostic.js";
|
|
8
|
+
import * as Mutex from "../_util/Mutex.js";
|
|
9
|
+
import { encodeJsonString, decodeJsonString } from "../_util/schema.js";
|
|
10
|
+
import * as ClientDirectory from "../ClientDirectory.js";
|
|
11
|
+
import * as Method from "../Method.js";
|
|
12
|
+
const { debug, span } = diagnostic("workerd.WorkerdActorNamespace");
|
|
15
13
|
export const Service = () => (id, definition) => {
|
|
16
|
-
const { hibernation, actor, prelude,
|
|
14
|
+
const { hibernation, actor, prelude, handlers, layer: runLayer, onConnect } = definition;
|
|
17
15
|
const { definition: { name: Name, client: { key: clientId, protocol: P }, attachments: AttachmentFields, }, } = actor;
|
|
18
16
|
const encodeName = S.encodeEffect(Name);
|
|
19
17
|
const decodeName = S.decodeUnknownEffect(Name);
|
|
@@ -73,19 +71,20 @@ export const Service = () => (id, definition) => {
|
|
|
73
71
|
clients: this.directory.handles,
|
|
74
72
|
currentClient,
|
|
75
73
|
});
|
|
76
|
-
yield* onConnect.pipe(Effect.scoped, span("onConnect"), Effect.
|
|
74
|
+
yield* onConnect.pipe(Effect.scoped, span("onConnect"), Effect.scoped, Effect.provide(Layer.provideMerge(runLayer, ActorLive)));
|
|
75
|
+
yield* debug("ClientRegistered");
|
|
77
76
|
return new Response(null, {
|
|
78
77
|
status: 101,
|
|
79
78
|
webSocket,
|
|
80
79
|
headers: { [SecWebSocketProtocol]: "liminal" },
|
|
81
80
|
});
|
|
82
|
-
}).pipe(Effect.
|
|
81
|
+
}).pipe(Effect.tapCause(logCause), span("fetch"), this.runtime.runPromise);
|
|
83
82
|
}
|
|
84
83
|
webSocketMessage(socket, raw) {
|
|
85
84
|
Effect.gen({ self: this }, function* () {
|
|
86
85
|
const currentClient = yield* this.directory.get(socket);
|
|
87
86
|
const name = yield* Effect.fromNullishOr(this.#name);
|
|
88
|
-
const
|
|
87
|
+
const ActorLive = Layer.succeed(actor, {
|
|
89
88
|
name,
|
|
90
89
|
clients: this.directory.handles,
|
|
91
90
|
currentClient,
|
|
@@ -100,7 +99,7 @@ export const Service = () => (id, definition) => {
|
|
|
100
99
|
}
|
|
101
100
|
const { id, payload } = message;
|
|
102
101
|
const { _tag, value } = payload;
|
|
103
|
-
yield* handlers[_tag](value).pipe(Effect.
|
|
102
|
+
yield* handlers[_tag](value).pipe(Effect.matchEffect({
|
|
104
103
|
onSuccess: (value) => encodeFSuccess({
|
|
105
104
|
_tag: "F.Success",
|
|
106
105
|
id,
|
|
@@ -111,7 +110,7 @@ export const Service = () => (id, definition) => {
|
|
|
111
110
|
id,
|
|
112
111
|
failure: { _tag, value },
|
|
113
112
|
}),
|
|
114
|
-
}), span("handler", { attributes: { _tag } }), Effect.andThen((v) => Effect.sync(() => socket.send(v))), Effect.scoped);
|
|
113
|
+
}), span("handler", { attributes: { _tag } }), Effect.andThen((v) => Effect.sync(() => socket.send(v))), Effect.scoped, Effect.provide(Layer.provideMerge(runLayer, ActorLive)));
|
|
115
114
|
}).pipe(Effect.scoped, Mutex.task, Effect.tapCause(logCause), span("webSocketMessage"), this.runtime.runFork);
|
|
116
115
|
}
|
|
117
116
|
webSocketClose(socket, _code, _reason, _wasClean) {
|
|
@@ -150,4 +149,4 @@ export const Service = () => (id, definition) => {
|
|
|
150
149
|
const layer = Binding.layer(tag, ["getByName"]);
|
|
151
150
|
return Object.assign(tag, { definition, upgrade, layer });
|
|
152
151
|
};
|
|
153
|
-
//# sourceMappingURL=
|
|
152
|
+
//# sourceMappingURL=WorkerdActorNamespace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WorkerdActorNamespace.js","sourceRoot":"","sources":["../../workerd/WorkerdActorNamespace.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,MAAM,EACN,KAAK,EACL,MAAM,IAAI,CAAC,EACX,OAAO,EACP,cAAc,EACd,cAAc,EACd,QAAQ,EACR,IAAI,EACJ,MAAM,EACN,KAAK,EACL,QAAQ,EACR,MAAM,GACP,MAAM,QAAQ,CAAA;AACf,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAChE,OAAO,EAAE,oBAAoB,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAA;AACxE,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtF,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAMhD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAC9C,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAA;AAC1C,OAAO,EAAsB,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAC3F,OAAO,KAAK,eAAe,MAAM,uBAAuB,CAAA;AACxD,OAAO,KAAK,MAAM,MAAM,cAA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WorkerdActorNamespace.ts";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../workerd/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,qBAAqB,MAAM,4BAA4B,CAAA"}
|
package/index.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
export * as
|
|
2
|
-
export * as
|
|
3
|
-
export * as
|
|
4
|
-
export * as
|
|
5
|
-
export * as
|
|
6
|
-
export * as
|
|
7
|
-
export * as
|
|
8
|
-
export * as
|
|
9
|
-
export *
|
|
10
|
-
export *
|
|
11
|
-
export *
|
|
12
|
-
export * as WorkerLoader from "./WorkerLoader.ts"
|
|
1
|
+
export * as Accumulator from "./Accumulator.ts"
|
|
2
|
+
export * as Actor from "./Actor.ts"
|
|
3
|
+
export * as Audition from "./Audition.ts"
|
|
4
|
+
export * as Client from "./Client.ts"
|
|
5
|
+
export * as ClientDirectory from "./ClientDirectory.ts"
|
|
6
|
+
export * as ClientHandle from "./ClientHandle.ts"
|
|
7
|
+
export * as Method from "./Method.ts"
|
|
8
|
+
export * as Protocol from "./Protocol.ts"
|
|
9
|
+
export * from "./ActorTransport.ts"
|
|
10
|
+
export * from "./F.ts"
|
|
11
|
+
export * from "./errors.ts"
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "liminal",
|
|
3
|
-
"version": "0.17.
|
|
4
|
-
"description": "Effect x
|
|
3
|
+
"version": "0.17.12",
|
|
4
|
+
"description": "Effect x Actors",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/crosshatch/liminal/issues"
|
|
7
7
|
},
|
|
@@ -11,9 +11,6 @@
|
|
|
11
11
|
"url": "https://github.com/crosshatch/liminal.git",
|
|
12
12
|
"directory": "liminal"
|
|
13
13
|
},
|
|
14
|
-
"bin": {
|
|
15
|
-
"liminal": "./dist/main.js"
|
|
16
|
-
},
|
|
17
14
|
"type": "module",
|
|
18
15
|
"sideEffects": false,
|
|
19
16
|
"exports": {
|
|
@@ -25,27 +22,26 @@
|
|
|
25
22
|
"types": "./*.ts",
|
|
26
23
|
"default": "./dist/*.js"
|
|
27
24
|
},
|
|
28
|
-
"./
|
|
29
|
-
"types": "./
|
|
30
|
-
"default": "./dist/
|
|
25
|
+
"./browser": {
|
|
26
|
+
"types": "./browser/index.ts",
|
|
27
|
+
"default": "./dist/browser/index.js"
|
|
31
28
|
},
|
|
32
29
|
"./experimental": {
|
|
33
30
|
"types": "./experimental/index.ts",
|
|
34
31
|
"default": "./dist/experimental/index.js"
|
|
35
32
|
},
|
|
36
|
-
"./
|
|
37
|
-
"types": "./
|
|
38
|
-
"default": "./dist/
|
|
39
|
-
},
|
|
40
|
-
"./util/*": {
|
|
41
|
-
"types": "./util/*.ts",
|
|
42
|
-
"default": "./dist/util/*.js"
|
|
33
|
+
"./workerd": {
|
|
34
|
+
"types": "./workerd/index.ts",
|
|
35
|
+
"default": "./dist/workerd/index.js"
|
|
43
36
|
},
|
|
44
37
|
"./package.json": "./package.json"
|
|
45
38
|
},
|
|
46
39
|
"peerDependencies": {
|
|
47
40
|
"@cloudflare/workers-types": "^4.20260414.1",
|
|
41
|
+
"@effect/platform-browser": "4.0.0-beta.50",
|
|
48
42
|
"@effect/sql-d1": "4.0.0-beta.50",
|
|
49
|
-
"effect": "4.0.0-beta.50"
|
|
43
|
+
"effect": "4.0.0-beta.50",
|
|
44
|
+
"effect-workerd": "0.0.2",
|
|
45
|
+
"liminal-util": "0.0.2"
|
|
50
46
|
}
|
|
51
47
|
}
|
package/tsconfig.json
CHANGED
|
@@ -13,27 +13,25 @@ import {
|
|
|
13
13
|
Encoding,
|
|
14
14
|
Option,
|
|
15
15
|
} from "effect"
|
|
16
|
+
import { Binding, DoState, NativeRequest } from "effect-workerd"
|
|
17
|
+
import { SecWebSocketProtocol, close } from "effect-workerd/socket_util"
|
|
16
18
|
import { HttpServerResponse, HttpClient, FetchHttpClient } from "effect/unstable/http"
|
|
19
|
+
import { boundLayer } from "liminal-util/boundLayer"
|
|
20
|
+
import { logCause } from "liminal-util/logCause"
|
|
17
21
|
|
|
18
|
-
import type {
|
|
19
|
-
import type
|
|
20
|
-
import type { ProtocolDefinition } from "
|
|
21
|
-
|
|
22
|
-
import
|
|
23
|
-
import * as
|
|
24
|
-
import
|
|
25
|
-
import
|
|
26
|
-
import
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
import * as Actor from "./Actor.ts"
|
|
32
|
-
import * as ClientDirectory from "./ClientDirectory.ts"
|
|
33
|
-
|
|
34
|
-
const { debug, span } = Diagnostic.module("cloudflare.ActorRegistry")
|
|
35
|
-
|
|
36
|
-
export interface ActorRegistryDefinition<
|
|
22
|
+
import type { Actor } from "../Actor.ts"
|
|
23
|
+
import type { ActorTransport } from "../ActorTransport.ts"
|
|
24
|
+
import type { ProtocolDefinition } from "../Protocol.ts"
|
|
25
|
+
|
|
26
|
+
import { diagnostic } from "../_diagnostic.ts"
|
|
27
|
+
import * as Mutex from "../_util/Mutex.ts"
|
|
28
|
+
import { type TopFromString, encodeJsonString, decodeJsonString } from "../_util/schema.ts"
|
|
29
|
+
import * as ClientDirectory from "../ClientDirectory.ts"
|
|
30
|
+
import * as Method from "../Method.ts"
|
|
31
|
+
|
|
32
|
+
const { debug, span } = diagnostic("workerd.WorkerdActorNamespace")
|
|
33
|
+
|
|
34
|
+
export interface ActorNamespaceDefinition<
|
|
37
35
|
ActorSelf,
|
|
38
36
|
ActorId extends string,
|
|
39
37
|
Name extends TopFromString,
|
|
@@ -48,7 +46,7 @@ export interface ActorRegistryDefinition<
|
|
|
48
46
|
> {
|
|
49
47
|
readonly ""?: this["actor"]["definition"]["client"]["protocol"]
|
|
50
48
|
|
|
51
|
-
readonly actor: Actor
|
|
49
|
+
readonly actor: Actor<ActorSelf, ActorId, Name, AttachmentFields, ClientSelf, ClientId, D>
|
|
52
50
|
|
|
53
51
|
readonly prelude: Layer.Layer<
|
|
54
52
|
| PreludeROut
|
|
@@ -63,25 +61,25 @@ export interface ActorRegistryDefinition<
|
|
|
63
61
|
PreludeE
|
|
64
62
|
>
|
|
65
63
|
|
|
66
|
-
readonly
|
|
64
|
+
readonly layer: Layer.Layer<RunROut, RunE, ActorSelf | HttpClient.HttpClient | PreludeROut>
|
|
67
65
|
|
|
68
66
|
readonly handlers: Method.Handlers<
|
|
69
67
|
D["methods"],
|
|
70
|
-
ActorSelf |
|
|
68
|
+
ActorSelf | HttpClient.HttpClient | PreludeROut | RunROut | Scope.Scope
|
|
71
69
|
>
|
|
72
70
|
|
|
73
71
|
readonly onConnect: Effect.Effect<
|
|
74
72
|
void,
|
|
75
73
|
never,
|
|
76
|
-
ActorSelf |
|
|
74
|
+
ActorSelf | HttpClient.HttpClient | PreludeROut | RunROut | Scope.Scope
|
|
77
75
|
>
|
|
78
76
|
|
|
79
77
|
readonly hibernation?: Duration.Input | undefined
|
|
80
78
|
}
|
|
81
79
|
|
|
82
|
-
export interface
|
|
83
|
-
|
|
84
|
-
|
|
80
|
+
export interface ActorNamespace<
|
|
81
|
+
NamespaceSelf,
|
|
82
|
+
NamespaceId extends string,
|
|
85
83
|
ActorSelf,
|
|
86
84
|
ActorId extends string,
|
|
87
85
|
Name extends TopFromString,
|
|
@@ -93,10 +91,10 @@ export interface ActorRegistry<
|
|
|
93
91
|
PreludeE,
|
|
94
92
|
RunROut,
|
|
95
93
|
RunE,
|
|
96
|
-
> extends Context.Service<
|
|
97
|
-
new (state: globalThis.DurableObjectState<{}>): Context.ServiceClass.Shape<
|
|
94
|
+
> extends Context.Service<NamespaceSelf, DurableObjectNamespace> {
|
|
95
|
+
new (state: globalThis.DurableObjectState<{}>): Context.ServiceClass.Shape<NamespaceId, DurableObjectNamespace>
|
|
98
96
|
|
|
99
|
-
readonly definition:
|
|
97
|
+
readonly definition: ActorNamespaceDefinition<
|
|
100
98
|
ActorSelf,
|
|
101
99
|
ActorId,
|
|
102
100
|
Name,
|
|
@@ -113,15 +111,15 @@ export interface ActorRegistry<
|
|
|
113
111
|
readonly upgrade: (
|
|
114
112
|
name: Name["Type"],
|
|
115
113
|
attachments: S.Struct<AttachmentFields>["Type"],
|
|
116
|
-
) => Effect.Effect<HttpServerResponse.HttpServerResponse, S.SchemaError,
|
|
114
|
+
) => Effect.Effect<HttpServerResponse.HttpServerResponse, S.SchemaError, NamespaceSelf | NativeRequest.NativeRequest>
|
|
117
115
|
|
|
118
|
-
readonly layer: (binding: string) => Layer.Layer<
|
|
116
|
+
readonly layer: (binding: string) => Layer.Layer<NamespaceSelf, S.SchemaError, never>
|
|
119
117
|
}
|
|
120
118
|
|
|
121
119
|
export const Service =
|
|
122
|
-
<
|
|
120
|
+
<NamespaceSelf>() =>
|
|
123
121
|
<
|
|
124
|
-
|
|
122
|
+
NamespaceId extends string,
|
|
125
123
|
ActorSelf,
|
|
126
124
|
ActorId extends string,
|
|
127
125
|
Name extends TopFromString,
|
|
@@ -134,8 +132,8 @@ export const Service =
|
|
|
134
132
|
RunROut,
|
|
135
133
|
RunE,
|
|
136
134
|
>(
|
|
137
|
-
id:
|
|
138
|
-
definition:
|
|
135
|
+
id: NamespaceId,
|
|
136
|
+
definition: ActorNamespaceDefinition<
|
|
139
137
|
ActorSelf,
|
|
140
138
|
ActorId,
|
|
141
139
|
Name,
|
|
@@ -148,9 +146,9 @@ export const Service =
|
|
|
148
146
|
RunROut,
|
|
149
147
|
RunE
|
|
150
148
|
>,
|
|
151
|
-
):
|
|
152
|
-
|
|
153
|
-
|
|
149
|
+
): ActorNamespace<
|
|
150
|
+
NamespaceSelf,
|
|
151
|
+
NamespaceId,
|
|
154
152
|
ActorSelf,
|
|
155
153
|
ActorId,
|
|
156
154
|
Name,
|
|
@@ -163,7 +161,7 @@ export const Service =
|
|
|
163
161
|
RunROut,
|
|
164
162
|
RunE
|
|
165
163
|
> => {
|
|
166
|
-
const { hibernation, actor, prelude,
|
|
164
|
+
const { hibernation, actor, prelude, handlers, layer: runLayer, onConnect } = definition
|
|
167
165
|
const {
|
|
168
166
|
definition: {
|
|
169
167
|
name: Name,
|
|
@@ -196,7 +194,7 @@ export const Service =
|
|
|
196
194
|
encodeAttachments(attachments).pipe(Effect.andThen((v) => Effect.sync(() => socket.serializeAttachment(v)))),
|
|
197
195
|
}
|
|
198
196
|
|
|
199
|
-
const tag = class tag extends Context.Service<
|
|
197
|
+
const tag = class tag extends Context.Service<NamespaceSelf, DurableObjectNamespace>()(id) {
|
|
200
198
|
readonly runtime
|
|
201
199
|
readonly directory = ClientDirectory.make(actor, transport)
|
|
202
200
|
|
|
@@ -261,21 +259,23 @@ export const Service =
|
|
|
261
259
|
yield* onConnect.pipe(
|
|
262
260
|
Effect.scoped,
|
|
263
261
|
span("onConnect"),
|
|
264
|
-
Effect.
|
|
262
|
+
Effect.scoped,
|
|
263
|
+
Effect.provide(Layer.provideMerge(runLayer, ActorLive)),
|
|
265
264
|
)
|
|
265
|
+
yield* debug("ClientRegistered")
|
|
266
266
|
return new Response(null, {
|
|
267
267
|
status: 101,
|
|
268
268
|
webSocket,
|
|
269
269
|
headers: { [SecWebSocketProtocol]: "liminal" },
|
|
270
270
|
})
|
|
271
|
-
}).pipe(Effect.
|
|
271
|
+
}).pipe(Effect.tapCause(logCause), span("fetch"), this.runtime.runPromise)
|
|
272
272
|
}
|
|
273
273
|
|
|
274
274
|
webSocketMessage(socket: WebSocket, raw: string | ArrayBuffer) {
|
|
275
275
|
Effect.gen({ self: this }, function* () {
|
|
276
276
|
const currentClient = yield* this.directory.get(socket)
|
|
277
277
|
const name = yield* Effect.fromNullishOr(this.#name)
|
|
278
|
-
const
|
|
278
|
+
const ActorLive = Layer.succeed(actor, {
|
|
279
279
|
name,
|
|
280
280
|
clients: this.directory.handles,
|
|
281
281
|
currentClient,
|
|
@@ -291,7 +291,6 @@ export const Service =
|
|
|
291
291
|
const { id, payload } = message
|
|
292
292
|
const { _tag, value } = payload as never
|
|
293
293
|
yield* handlers[_tag]!(value).pipe(
|
|
294
|
-
Effect.provide(runLayer.pipe(Layer.provideMerge(layer))),
|
|
295
294
|
Effect.matchEffect({
|
|
296
295
|
onSuccess: (value) =>
|
|
297
296
|
encodeFSuccess({
|
|
@@ -309,6 +308,7 @@ export const Service =
|
|
|
309
308
|
span("handler", { attributes: { _tag } }),
|
|
310
309
|
Effect.andThen((v) => Effect.sync(() => socket.send(v))),
|
|
311
310
|
Effect.scoped,
|
|
311
|
+
Effect.provide(Layer.provideMerge(runLayer, ActorLive)),
|
|
312
312
|
)
|
|
313
313
|
}).pipe(Effect.scoped, Mutex.task, Effect.tapCause(logCause), span("webSocketMessage"), this.runtime.runFork)
|
|
314
314
|
}
|
package/workerd/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * as WorkerdActorNamespace from "./WorkerdActorNamespace.ts"
|
package/Ai.ts
DELETED
package/Assets.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { Effect, Context } from "effect"
|
|
2
|
-
import { HttpServerResponse } from "effect/unstable/http"
|
|
3
|
-
|
|
4
|
-
import * as Binding from "./Binding.ts"
|
|
5
|
-
import { NativeRequest } from "./NativeRequest.ts"
|
|
6
|
-
|
|
7
|
-
export class Assets extends Context.Service<
|
|
8
|
-
Assets,
|
|
9
|
-
{
|
|
10
|
-
readonly fetch: typeof fetch
|
|
11
|
-
}
|
|
12
|
-
>()("liminal/Assets") {}
|
|
13
|
-
|
|
14
|
-
export const layer = Binding.layer(Assets, ["fetch"])
|
|
15
|
-
|
|
16
|
-
export const forward = Effect.gen({ self: this }, function* () {
|
|
17
|
-
const assets = yield* Assets
|
|
18
|
-
const request = yield* NativeRequest
|
|
19
|
-
const response = yield* Effect.promise(() => assets.fetch(request))
|
|
20
|
-
return HttpServerResponse.fromWeb(response)
|
|
21
|
-
})
|
package/Binding.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { env } from "cloudflare:workers"
|
|
2
|
-
import { Context, Layer, Effect, Schema as S, SchemaIssue } from "effect"
|
|
3
|
-
|
|
4
|
-
export const layer =
|
|
5
|
-
<Self, Identifier extends string, Shape, ROut = never, E = never, RIn = never>(
|
|
6
|
-
tag: Context.ServiceClass<Self, Identifier, Shape>,
|
|
7
|
-
keys: ReadonlyArray<string>,
|
|
8
|
-
derive?: (resource: Shape) => Layer.Layer<ROut, E, RIn> | undefined,
|
|
9
|
-
) =>
|
|
10
|
-
(binding: string) =>
|
|
11
|
-
Effect.gen(function* () {
|
|
12
|
-
const resolved = (env as never)[binding]
|
|
13
|
-
if (!resolved) {
|
|
14
|
-
return yield* Effect.fail(
|
|
15
|
-
new S.SchemaError(
|
|
16
|
-
new SchemaIssue.Pointer(
|
|
17
|
-
[binding],
|
|
18
|
-
new SchemaIssue.MissingKey({
|
|
19
|
-
messageMissingKey: `Missing binding "${binding}" on env`,
|
|
20
|
-
}),
|
|
21
|
-
),
|
|
22
|
-
),
|
|
23
|
-
)
|
|
24
|
-
}
|
|
25
|
-
for (const key of keys) {
|
|
26
|
-
if (!(key in resolved)) {
|
|
27
|
-
return yield* Effect.fail(
|
|
28
|
-
new S.SchemaError(
|
|
29
|
-
new SchemaIssue.Pointer(
|
|
30
|
-
[key],
|
|
31
|
-
new SchemaIssue.MissingKey({
|
|
32
|
-
messageMissingKey: `Expected key \`${key}\` on binding \`${binding}\``,
|
|
33
|
-
}),
|
|
34
|
-
),
|
|
35
|
-
),
|
|
36
|
-
)
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
return Layer.mergeAll(Layer.succeed(tag, resolved), derive?.(resolved) ?? Layer.empty)
|
|
40
|
-
}).pipe(Layer.unwrap)
|
package/D1.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { D1Client } from "@effect/sql-d1"
|
|
2
|
-
import { Context } from "effect"
|
|
3
|
-
|
|
4
|
-
import * as Binding from "./Binding.ts"
|
|
5
|
-
|
|
6
|
-
export class D1 extends Context.Service<D1, D1Database>()("liminal/D1") {}
|
|
7
|
-
|
|
8
|
-
export const layer = Binding.layer(D1, ["exec"], (db) => D1Client.layer({ db }))
|
package/DoState.ts
DELETED
package/Hyperdrive.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Effect, Redacted, Context } from "effect"
|
|
2
|
-
|
|
3
|
-
import * as Binding from "./Binding.ts"
|
|
4
|
-
|
|
5
|
-
export class Hyperdrive extends Context.Service<Hyperdrive, globalThis.Hyperdrive>()("liminal/Hyperdrive") {}
|
|
6
|
-
|
|
7
|
-
export const layer = Binding.layer(Hyperdrive, ["connectionString"])
|
|
8
|
-
|
|
9
|
-
export const connectionString = Hyperdrive.asEffect().pipe(
|
|
10
|
-
Effect.map(({ connectionString }) => Redacted.make(connectionString)),
|
|
11
|
-
)
|
package/Images.ts
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import { Data, Context, Pipeable, Function, Effect } from "effect"
|
|
2
|
-
|
|
3
|
-
import * as Binding from "./Binding.ts"
|
|
4
|
-
|
|
5
|
-
export class Images extends Context.Service<Images, globalThis.ImagesBinding>()("liminal/ImageTransformer") {}
|
|
6
|
-
|
|
7
|
-
export const layer = Binding.layer(Images, ["transform", "draw", "output"])
|
|
8
|
-
|
|
9
|
-
const TypeId = "~liminal/Images/Transformation" as const
|
|
10
|
-
|
|
11
|
-
export interface Steps extends Pipeable.Pipeable {
|
|
12
|
-
readonly [TypeId]: typeof TypeId
|
|
13
|
-
readonly steps: ReadonlyArray<Step>
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export interface DrawOptions {
|
|
17
|
-
image: ReadableStream<Uint8Array> | ImageTransformer
|
|
18
|
-
options?: ImageDrawOptions | undefined
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export type Step = Data.TaggedEnum<{
|
|
22
|
-
Transform: {
|
|
23
|
-
transform: ImageTransform
|
|
24
|
-
}
|
|
25
|
-
Draw: DrawOptions
|
|
26
|
-
}>
|
|
27
|
-
|
|
28
|
-
export const empty: Steps = {
|
|
29
|
-
[TypeId]: TypeId,
|
|
30
|
-
steps: [],
|
|
31
|
-
pipe() {
|
|
32
|
-
return Pipeable.pipeArguments(this, arguments)
|
|
33
|
-
},
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export const transform: {
|
|
37
|
-
(transform: ImageTransform): (steps: Steps) => Steps
|
|
38
|
-
(steps: Steps, transform: ImageTransform): Steps
|
|
39
|
-
} = Function.dual(2, (steps: Steps, transform: ImageTransform) => ({
|
|
40
|
-
[TypeId]: TypeId,
|
|
41
|
-
steps: [
|
|
42
|
-
...steps.steps,
|
|
43
|
-
{
|
|
44
|
-
_tag: "Transform",
|
|
45
|
-
transform,
|
|
46
|
-
},
|
|
47
|
-
],
|
|
48
|
-
pipe() {
|
|
49
|
-
return Pipeable.pipeArguments(this, arguments)
|
|
50
|
-
},
|
|
51
|
-
}))
|
|
52
|
-
|
|
53
|
-
export const draw: {
|
|
54
|
-
(draw: DrawOptions): (steps: Steps) => Steps
|
|
55
|
-
(steps: Steps, draw: DrawOptions): Steps
|
|
56
|
-
} = Function.dual(2, (steps: Steps, draw: DrawOptions) => ({
|
|
57
|
-
[TypeId]: TypeId,
|
|
58
|
-
steps: [
|
|
59
|
-
...steps.steps,
|
|
60
|
-
{
|
|
61
|
-
_tag: "Draw",
|
|
62
|
-
...draw,
|
|
63
|
-
},
|
|
64
|
-
],
|
|
65
|
-
pipe() {
|
|
66
|
-
return Pipeable.pipeArguments(this, arguments)
|
|
67
|
-
},
|
|
68
|
-
}))
|
|
69
|
-
|
|
70
|
-
export interface ProcessConfig {
|
|
71
|
-
readonly stream: ReadableStream<Uint8Array>
|
|
72
|
-
readonly inputOptions?: ImageInputOptions | undefined
|
|
73
|
-
readonly outputOptions: ImageOutputOptions
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export const process: {
|
|
77
|
-
(config: ProcessConfig): (steps: Steps) => Effect.Effect<ImageTransformationResult, never, Images>
|
|
78
|
-
(steps: Steps, config: ProcessConfig): Effect.Effect<ImageTransformationResult, never, Images>
|
|
79
|
-
} = Function.dual(
|
|
80
|
-
2,
|
|
81
|
-
Effect.fnUntraced(function* ({ steps }: Steps, { stream, inputOptions, outputOptions }: ProcessConfig) {
|
|
82
|
-
const images = yield* Images
|
|
83
|
-
let transformer = images.input(stream, inputOptions)
|
|
84
|
-
for (let i = 0; i < steps.length; i++) {
|
|
85
|
-
const step = steps[i]!
|
|
86
|
-
switch (step._tag) {
|
|
87
|
-
case "Draw": {
|
|
88
|
-
const { image, options } = step
|
|
89
|
-
transformer = transformer.draw(image, options)
|
|
90
|
-
break
|
|
91
|
-
}
|
|
92
|
-
case "Transform": {
|
|
93
|
-
const { transform } = step
|
|
94
|
-
transformer = transformer.transform(transform)
|
|
95
|
-
break
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
return yield* Effect.promise(() => transformer.output(outputOptions))
|
|
100
|
-
}),
|
|
101
|
-
)
|