@graftland/plugin-remote 0.3.0 → 0.3.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/dist/{Bootstrap-MCwivGN1.js → Bootstrap-Dr6sX7el.js} +2 -2
- package/dist/{Contract-CcpSIJm4.js → Contract-DL2mHvaT.js} +8 -46
- package/dist/Contract.d.ts +50 -53
- package/dist/Contract.d.ts.map +1 -1
- package/dist/Contract.js +1 -1
- package/dist/Contract.js.map +1 -1
- package/dist/{Errors-oPsTLY7l.js → Errors-BMKmu5Y7.js} +12 -1
- package/dist/Errors.d.ts +12 -0
- package/dist/Errors.d.ts.map +1 -1
- package/dist/Errors.js +12 -1
- package/dist/Errors.js.map +1 -1
- package/dist/{Graft-BsYq3F-J.js → Graft-CVyueNOf.js} +26 -19
- package/dist/{Packages-B1TPk8pa.js → Packages-JNL34JpS.js} +1 -1
- package/dist/{Peer-IJgFK6mD.js → Peer-BT7eAGmh.js} +2 -2
- package/dist/Testing.d.ts +4 -4
- package/dist/Testing.d.ts.map +1 -1
- package/dist/Testing.js +10 -4
- package/dist/Testing.js.map +1 -1
- package/dist/bin.js +7 -7
- package/dist/{childRuntime-DSqtFN9o.js → childRuntime-An0HsIzl.js} +7 -6
- package/dist/{cleanup-BPWr-5U9.js → cleanup-CXLa1Wd9.js} +1 -1
- package/dist/connectionEnded-DCpFCjMX.js +54 -0
- package/dist/{entry-SYsx9VNb.js → entry-B89sepMU.js} +13 -22
- package/dist/host/auth/bearer.d.ts +1 -2
- package/dist/host/auth/bearer.d.ts.map +1 -1
- package/dist/host/auth/bearer.js +1 -1
- package/dist/host/auth/bearer.js.map +1 -1
- package/dist/host/auth/jwt.d.ts +1 -2
- package/dist/host/auth/jwt.d.ts.map +1 -1
- package/dist/host/auth/jwt.js +1 -1
- package/dist/host/auth/jwt.js.map +1 -1
- package/dist/host/auth/mtls.js +2 -2
- package/dist/host/auth/none.js +1 -1
- package/dist/host/command.d.ts +1 -1
- package/dist/host/command.d.ts.map +1 -1
- package/dist/host/command.js +3 -3
- package/dist/host/command.js.map +1 -1
- package/dist/host/local.d.ts +1 -2
- package/dist/host/local.d.ts.map +1 -1
- package/dist/host/local.js +2 -2
- package/dist/host/local.js.map +1 -1
- package/dist/host/unix.d.ts +1 -1
- package/dist/host/unix.d.ts.map +1 -1
- package/dist/host/unix.js +3 -3
- package/dist/host/unix.js.map +1 -1
- package/dist/host/websocket.d.ts +1 -1
- package/dist/host/websocket.d.ts.map +1 -1
- package/dist/host/websocket.js +3 -3
- package/dist/host/websocket.js.map +1 -1
- package/dist/host/worker.d.ts +1 -2
- package/dist/host/worker.d.ts.map +1 -1
- package/dist/host/worker.js +4 -4
- package/dist/host/worker.js.map +1 -1
- package/dist/{importer-D7zSgqxq.js → importer-Bk6U_sn4.js} +1 -1
- package/dist/index.d.ts +2 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -8
- package/dist/index.js.map +1 -1
- package/dist/internal/auth/tokenCredentials.d.ts +0 -1
- package/dist/internal/auth/tokenCredentials.d.ts.map +1 -1
- package/dist/internal/auth/tokenCredentials.js.map +1 -1
- package/dist/internal/child.js.map +1 -1
- package/dist/internal/childRuntime.js +3 -1
- package/dist/internal/childRuntime.js.map +1 -1
- package/dist/internal/contract.js +26 -0
- package/dist/internal/contract.js.map +1 -0
- package/dist/internal/credentials.d.ts +6 -6
- package/dist/internal/credentials.d.ts.map +1 -1
- package/dist/internal/credentials.js.map +1 -1
- package/dist/internal/entry.d.ts +1 -2
- package/dist/internal/entry.d.ts.map +1 -1
- package/dist/internal/entry.js +3 -13
- package/dist/internal/entry.js.map +1 -1
- package/dist/internal/execution.js +4 -2
- package/dist/internal/execution.js.map +1 -1
- package/dist/internal/host.js.map +1 -1
- package/dist/internal/port.d.ts +2 -10
- package/dist/internal/runner/Framing.d.ts +1 -11
- package/dist/internal/services.d.ts +2 -12
- package/dist/internal/services.d.ts.map +1 -1
- package/dist/internal/services.js.map +1 -1
- package/dist/internal/supervisorPlugin.js +1 -1
- package/dist/internal/workerMain.js +3 -3
- package/dist/{port-Blbh8tms.js → port-DSVUY8Bq.js} +1 -1
- package/dist/runner/auth/bearer.js +2 -2
- package/dist/runner/auth/jwt.js +3 -3
- package/dist/runner/auth/mtls.js +2 -2
- package/dist/runner/auth/none.js +1 -1
- package/dist/runner/index.js +5 -5
- package/dist/runner/stdio.js +2 -2
- package/dist/runner/unix.js +3 -3
- package/dist/runner/websocket.js +4 -4
- package/dist/{socketChannel-KmtzF-9G.js → socketChannel-C_ppdSzz.js} +1 -1
- package/dist/{supervisorPlugin-Inb1S5IV.js → supervisorPlugin-CivhM7x5.js} +7 -7
- package/dist/{token-v5ne2I0-.js → token-Cc_1CTbE.js} +1 -1
- package/dist/{tokenCredentials-WUJm2AKm.js → tokenCredentials-CI6mMRRd.js} +3 -3
- package/dist/{websocketServer-MXcCJx0v.js → websocketServer-D2Hk7wsA.js} +2 -2
- package/dist/{workerChannel-P82YdNjh.js → workerChannel-cmLc13vm.js} +1 -1
- package/package.json +3 -3
- package/src/Contract.ts +67 -51
- package/src/Errors.ts +15 -0
- package/src/Testing.ts +16 -2
- package/src/host/auth/bearer.ts +1 -6
- package/src/host/auth/jwt.ts +1 -6
- package/src/host/command.ts +2 -0
- package/src/host/local.ts +5 -9
- package/src/host/unix.ts +2 -0
- package/src/host/websocket.ts +2 -0
- package/src/host/worker.ts +4 -6
- package/src/index.ts +3 -1
- package/src/internal/auth/tokenCredentials.ts +1 -7
- package/src/internal/child.ts +1 -1
- package/src/internal/childRuntime.ts +4 -2
- package/src/internal/contract.ts +47 -0
- package/src/internal/credentials.ts +12 -9
- package/src/internal/entry.ts +1 -14
- package/src/internal/execution.ts +4 -2
- package/src/internal/host.ts +8 -11
- package/src/internal/services.ts +1 -19
- package/dist/connectionEnded-DUgcobEd.js +0 -9
- package/dist/internal/childErrors.d.ts +0 -33
- package/dist/internal/childErrors.d.ts.map +0 -1
- package/dist/internal/port.d.ts.map +0 -1
- package/dist/internal/runner/Framing.d.ts.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D as Identity } from "./Peer-
|
|
2
|
-
import { r as Limits } from "./port-
|
|
1
|
+
import { D as Identity } from "./Peer-BT7eAGmh.js";
|
|
2
|
+
import { r as Limits } from "./port-DSVUY8Bq.js";
|
|
3
3
|
import { Schema } from "effect";
|
|
4
4
|
// packages/remote/src/internal/runner/Bootstrap.ts
|
|
5
5
|
const Bootstrap = Schema.Struct({
|
|
@@ -1,33 +1,8 @@
|
|
|
1
1
|
import { n as __exportAll } from "./rolldown-runtime-DYf_mQCB.js";
|
|
2
|
-
import { t as Priority } from "./port-
|
|
3
|
-
import { a as provide } from "./Graft-
|
|
4
|
-
import { Array,
|
|
2
|
+
import { t as Priority } from "./port-DSVUY8Bq.js";
|
|
3
|
+
import { a as provide } from "./Graft-CVyueNOf.js";
|
|
4
|
+
import { Array, Context, Effect, Predicate, Record, Schema } from "effect";
|
|
5
5
|
import { Rpc, RpcClient, RpcGroup, RpcServer } from "effect/rpc";
|
|
6
|
-
// packages/remote/src/internal/childErrors.ts
|
|
7
|
-
var AlreadyLoaded = class extends Schema.TaggedError()("AlreadyLoaded", {}) {};
|
|
8
|
-
var ContractNotFound = class extends Schema.TaggedError()("ContractNotFound", { module: Schema.String }) {
|
|
9
|
-
get message() {
|
|
10
|
-
return `No remote contract exported by ${this.module}`;
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
|
-
var ModuleImportFailed = class extends Schema.TaggedError()("ModuleImportFailed", {
|
|
14
|
-
module: Schema.String,
|
|
15
|
-
cause: Schema.Defect({ includeStack: true })
|
|
16
|
-
}) {};
|
|
17
|
-
var ActivationFailed = class extends Schema.TaggedError()("ActivationFailed", {
|
|
18
|
-
detail: Schema.String,
|
|
19
|
-
cause: Schema.optionalKey(Schema.Cause(Schema.Defect({ includeStack: true }), Schema.Defect({ includeStack: true })))
|
|
20
|
-
}) {
|
|
21
|
-
get message() {
|
|
22
|
-
return this.detail;
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
const ChildFailure = Schema.Union([
|
|
26
|
-
AlreadyLoaded,
|
|
27
|
-
ContractNotFound,
|
|
28
|
-
ModuleImportFailed,
|
|
29
|
-
ActivationFailed
|
|
30
|
-
]);
|
|
31
6
|
// packages/remote/src/internal/control.ts
|
|
32
7
|
const Log = Schema.Struct({
|
|
33
8
|
level: Schema.Literals([
|
|
@@ -82,7 +57,6 @@ const service = (key, group, mapping) => ({
|
|
|
82
57
|
const endpoints = (services) => Record.fromEntries(Array.map(services, (service) => [service.key.key, service.group]));
|
|
83
58
|
// packages/remote/src/Contract.ts
|
|
84
59
|
var Contract_exports = /* @__PURE__ */ __exportAll({
|
|
85
|
-
ChildFailure: () => ChildFailure,
|
|
86
60
|
UndeclaredFailure: () => UndeclaredFailure,
|
|
87
61
|
fromModule: () => fromModule,
|
|
88
62
|
isContract: () => isContract,
|
|
@@ -92,30 +66,18 @@ var Contract_exports = /* @__PURE__ */ __exportAll({
|
|
|
92
66
|
const TypeId = "~@graftland/plugin-remote/Contract";
|
|
93
67
|
/** An undeclared failure still crosses the boundary, with its diagnostic value. */
|
|
94
68
|
var UndeclaredFailure = class extends Schema.TaggedError()("UndeclaredFailure", { original: Schema.Defect({ includeStack: true }) }) {};
|
|
95
|
-
|
|
96
|
-
const make = (options) => {
|
|
69
|
+
function make(options) {
|
|
97
70
|
const keys = Array.map([...options.inject ?? [], ...options.provides ?? []], (service) => service.key.key);
|
|
98
71
|
if (Array.dedupe(keys).length !== keys.length || keys.includes("@graftland/plugin-remote/control")) throw new Error("Service keys must be unique within a remote contract and must not use the control endpoint");
|
|
99
|
-
const failure = Schema.Union([
|
|
100
|
-
options.error,
|
|
101
|
-
UndeclaredFailure,
|
|
102
|
-
ChildFailure
|
|
103
|
-
]);
|
|
104
|
-
const codec = Schema.toCodecJson(Schema.Cause(failure, Schema.Defect({ includeStack: true })));
|
|
105
|
-
const declared = Schema.is(failure);
|
|
106
|
-
const normalizeCause = (cause) => Cause.map(cause, (error) => declared(error) ? error : UndeclaredFailure.make({ original: error }));
|
|
107
72
|
return {
|
|
108
73
|
...options,
|
|
109
|
-
|
|
110
|
-
normalizeCause,
|
|
74
|
+
error: options.error ?? Schema.Never,
|
|
111
75
|
inject: options.inject ?? [],
|
|
112
76
|
provides: options.provides ?? [],
|
|
113
|
-
[TypeId]: TypeId
|
|
114
|
-
encodeCause: (cause) => normalizeCause(cause).pipe(Schema.encodeEffect(codec)),
|
|
115
|
-
decodeCause: Schema.decodeUnknownEffect(codec)
|
|
77
|
+
[TypeId]: TypeId
|
|
116
78
|
};
|
|
117
|
-
}
|
|
79
|
+
}
|
|
118
80
|
const isContract = (value) => Predicate.hasProperty(value, TypeId) && value[TypeId] === TypeId;
|
|
119
81
|
/** A contract module exports either default or a named contract. */
|
|
120
82
|
const fromModule = (module) => Array.findFirst([Predicate.hasProperty(module, "default") ? module.default : void 0, Predicate.hasProperty(module, "contract") ? module.contract : void 0], isContract);
|
|
121
|
-
export { make as a, endpoint as c,
|
|
83
|
+
export { make as a, endpoint as c, isContract as i, make$1 as l, UndeclaredFailure as n, endpoints as o, fromModule as r, service as s, Contract_exports as t };
|
package/dist/Contract.d.ts
CHANGED
|
@@ -1,71 +1,68 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { service } from "./internal/services.js";
|
|
2
|
+
import { Graft } from "@graftland/graft";
|
|
3
|
+
import { Context, Effect, Schema, Scope } from "effect";
|
|
4
|
+
import { Rpc, RpcClient, RpcGroup, RpcServer } from "effect/rpc";
|
|
4
5
|
declare namespace Contract_d_exports {
|
|
5
|
-
export {
|
|
6
|
+
export { ConfigSchema, Contract, ErrorSchema, Options, RunnerContract, Service, UndeclaredFailure, fromModule, isContract, make, service };
|
|
6
7
|
}
|
|
7
|
-
declare const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
readonly
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
8
|
+
declare const TypeId = "~@graftland/plugin-remote/Contract";
|
|
9
|
+
/** RPC types stay inside the descriptor; Graft supplies its dynamic activation context. */
|
|
10
|
+
export interface Service<R = never, ClientR = never> {
|
|
11
|
+
readonly key: Context.Key<unknown, unknown>;
|
|
12
|
+
readonly group: Pick<RpcGroup.RpcGroup<Rpc.Any>, "requests">;
|
|
13
|
+
readonly serve: (port: {
|
|
14
|
+
readonly serverProtocol: (endpoint: string) => RpcServer.Protocol["Service"];
|
|
15
|
+
}) => Effect.Effect<never, never, R>;
|
|
16
|
+
readonly publish: (port: {
|
|
17
|
+
readonly clientProtocol: (endpoint: string) => RpcClient.Protocol["Service"];
|
|
18
|
+
}) => Effect.Effect<void, Graft.ServiceConflict, Graft.Graft | Scope.Scope | ClientR>;
|
|
19
|
+
}
|
|
20
|
+
/** A self-contained configuration schema that encodes as JSON. */
|
|
21
|
+
export type ConfigSchema = Schema.Top & {
|
|
16
22
|
readonly Encoded: Schema.Json;
|
|
17
23
|
readonly DecodingServices: never;
|
|
18
24
|
readonly EncodingServices: never;
|
|
19
|
-
}
|
|
25
|
+
};
|
|
26
|
+
/** A self-contained schema for declared failures. */
|
|
27
|
+
export type ErrorSchema = Schema.Top & {
|
|
20
28
|
readonly DecodingServices: never;
|
|
21
29
|
readonly EncodingServices: never;
|
|
22
|
-
}
|
|
30
|
+
};
|
|
31
|
+
/** The shared configuration and service declarations for one remote plugin. */
|
|
32
|
+
export interface Contract<S extends ConfigSchema, E extends ErrorSchema = typeof Schema.Never> {
|
|
23
33
|
readonly name: string;
|
|
24
34
|
readonly config: S;
|
|
25
35
|
readonly error: E;
|
|
26
36
|
readonly module: string;
|
|
37
|
+
readonly inject: ReadonlyArray<Service>;
|
|
38
|
+
readonly provides: ReadonlyArray<Service>;
|
|
39
|
+
readonly [TypeId]: typeof TypeId;
|
|
40
|
+
}
|
|
41
|
+
/** Configuration accepted by make; omitted errors default to Never. */
|
|
42
|
+
export interface Options<S extends ConfigSchema, E extends ErrorSchema> {
|
|
43
|
+
readonly name: string;
|
|
44
|
+
readonly config: S;
|
|
45
|
+
readonly error?: E;
|
|
46
|
+
readonly module: string;
|
|
27
47
|
readonly inject?: ReadonlyArray<Service>;
|
|
28
48
|
readonly provides?: ReadonlyArray<Service>;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
readonly annotations: Schema.$Record<Schema.String, Schema.Defect>;
|
|
44
|
-
}>;
|
|
45
|
-
readonly dropped: Schema.Int;
|
|
46
|
-
}>, Schema.TaggedStruct<"LogsEnded", {
|
|
47
|
-
readonly dropped: Schema.Int;
|
|
48
|
-
}>]>, Schema.Never>, Schema.Never, never, never>>;
|
|
49
|
-
normalizeCause: (cause: Cause.Cause<unknown>) => Cause.Cause<ActivationFailed | AlreadyLoaded | ContractNotFound | ModuleImportFailed | UndeclaredFailure | E["Type"]>;
|
|
50
|
-
inject: readonly Service<never, never>[];
|
|
51
|
-
provides: readonly Service<never, never>[];
|
|
52
|
-
"~@graftland/plugin-remote/Contract": string;
|
|
53
|
-
encodeCause: (cause: Cause.Cause<unknown>) => import("effect/Effect").Effect<Schema.Json, Schema.SchemaError, E["EncodingServices"]>;
|
|
54
|
-
decodeCause: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => import("effect/Effect").Effect<Cause.Cause<ActivationFailed | AlreadyLoaded | ContractNotFound | ModuleImportFailed | UndeclaredFailure | E["Type"]>, Schema.SchemaError, E["DecodingServices"]>;
|
|
55
|
-
};
|
|
56
|
-
/** The shared config, error codecs, and service declarations for one remote plugin. */
|
|
57
|
-
export type Contract<S extends Schema.Top & {
|
|
58
|
-
readonly Encoded: Schema.Json;
|
|
59
|
-
readonly DecodingServices: never;
|
|
60
|
-
readonly EncodingServices: never;
|
|
61
|
-
}, E extends Schema.Top & {
|
|
62
|
-
readonly DecodingServices: never;
|
|
63
|
-
readonly EncodingServices: never;
|
|
64
|
-
}> = ReturnType<typeof make<S, E>>;
|
|
65
|
-
/** Dynamic imports retain the control server and cause normalization; hosts retain the declared error type. */
|
|
49
|
+
}
|
|
50
|
+
declare const UndeclaredFailure_base: Schema.Class<UndeclaredFailure, Schema.TaggedStruct<"UndeclaredFailure", {
|
|
51
|
+
readonly original: Schema.Defect;
|
|
52
|
+
}>, import("effect/Cause").YieldableError & {
|
|
53
|
+
readonly brand: unique symbol;
|
|
54
|
+
}>;
|
|
55
|
+
/** An undeclared failure still crosses the boundary, with its diagnostic value. */
|
|
56
|
+
export declare class UndeclaredFailure extends UndeclaredFailure_base {}
|
|
57
|
+
/** Pure metadata shared by the host and the executable runner bootstrap. */
|
|
58
|
+
export declare function make<S extends ConfigSchema, E extends ErrorSchema>(options: Options<S, E> & {
|
|
59
|
+
readonly error: E;
|
|
60
|
+
}): Contract<S, E>;
|
|
61
|
+
export declare function make<S extends ConfigSchema>(options: Options<S, typeof Schema.Never>): Contract<S>;
|
|
62
|
+
/** A contract whose schemas are discovered through a dynamic import. */
|
|
66
63
|
export type RunnerContract = Contract<Schema.Codec<unknown, Schema.Json>, Schema.Codec<unknown>>;
|
|
67
64
|
export declare const isContract: (value: unknown) => value is RunnerContract;
|
|
68
65
|
/** A contract module exports either default or a named contract. */
|
|
69
66
|
export declare const fromModule: (module: unknown) => import("effect/Option").Option<RunnerContract>;
|
|
70
|
-
export {
|
|
67
|
+
export { Contract_d_exports, service };
|
|
71
68
|
//# sourceMappingURL=Contract.d.ts.map
|
package/dist/Contract.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Contract.d.ts","names":[
|
|
1
|
+
{"version":3,"file":"Contract.d.ts","names":[],"sources":["../src/Contract.ts"],"mappings":";;;;;;;cAOM;;iBAGW,QAAQ,WAAW;WAC1B,KAAK,QAAQ;WACb,OAAO,KAAK,SAAS,SAAS,IAAI;WAClC,QAAQ;aACP,iBAAiB,qBAAqB,UAAU;QACpD,OAAO,qBAAqB;WACzB,UAAU;aACT,iBAAiB,qBAAqB,UAAU;QACpD,OAAO,aAEZ,MAAM,iBACN,MAAM,QAAQ,MAAM,QAAQ;;;YAKlB,eAAe,OAAO;WACxB,SAAS,OAAO;WAChB;WACA;;;YAGE,cAAc,OAAO;WACvB;WACA;;;iBAIO,SAChB,UAAU,cACV,UAAU,qBAAqB,OAAO;WAE7B;WACA,QAAQ;WACR,OAAO;WACP;WACA,QAAQ,cAAc;WACtB,UAAU,cAAc;YACvB,gBAAgB;;;iBAGV,QAAQ,UAAU,cAAc,UAAU;WACjD;WACA,QAAQ;WACR,QAAQ;WACR;WACA,SAAS,cAAc;WACvB,WAAW,cAAc;;;;;WAMhB;;;qBAFN,0BAA0B;;wBAMvB,KAAK,UAAU,cAAc,UAAU,aACtD,SAAS,QAAQ,GAAG;WAAgB,OAAO;IACzC,SAAS,GAAG;wBACC,KAAK,UAAU,cAC9B,SAAS,QAAQ,UAAU,OAAO,SAChC,SAAS;;YA2BA,iBAAiB,SAC5B,OAAO,eAAe,OAAO,OAC7B,OAAO;qBAGK,aAAU,mBAAqB,SAAS;;qBAIxC,aAAU,4CAAmB,OAAA"}
|
package/dist/Contract.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { n as UndeclaredFailure, r as fromModule, i as isContract, a as make, s as service } from "./Contract-DL2mHvaT.js";
|
package/dist/Contract.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Contract.js","names":[
|
|
1
|
+
{"version":3,"file":"Contract.js","names":[],"sources":["../src/Contract.ts"],"sourcesContent":["import { Array, Predicate, Schema } from \"effect\"\nimport type { Context, Effect, Scope } from \"effect\"\nimport type { Graft } from \"@graftland/graft\"\nimport type { Rpc, RpcClient, RpcGroup, RpcServer } from \"effect/rpc\"\nimport * as Control from \"./internal/control\"\nexport { service } from \"./internal/services\"\n\nconst TypeId = \"~@graftland/plugin-remote/Contract\"\n\n/** RPC types stay inside the descriptor; Graft supplies its dynamic activation context. */\nexport interface Service<R = never, ClientR = never> {\n\treadonly key: Context.Key<unknown, unknown>\n\treadonly group: Pick<RpcGroup.RpcGroup<Rpc.Any>, \"requests\">\n\treadonly serve: (port: {\n\t\treadonly serverProtocol: (endpoint: string) => RpcServer.Protocol[\"Service\"]\n\t}) => Effect.Effect<never, never, R>\n\treadonly publish: (port: {\n\t\treadonly clientProtocol: (endpoint: string) => RpcClient.Protocol[\"Service\"]\n\t}) => Effect.Effect<\n\t\tvoid,\n\t\tGraft.ServiceConflict,\n\t\tGraft.Graft | Scope.Scope | ClientR\n\t>\n}\n\n/** A self-contained configuration schema that encodes as JSON. */\nexport type ConfigSchema = Schema.Top & {\n\treadonly Encoded: Schema.Json\n\treadonly DecodingServices: never\n\treadonly EncodingServices: never\n}\n/** A self-contained schema for declared failures. */\nexport type ErrorSchema = Schema.Top & {\n\treadonly DecodingServices: never\n\treadonly EncodingServices: never\n}\n\n/** The shared configuration and service declarations for one remote plugin. */\nexport interface Contract<\n\tS extends ConfigSchema,\n\tE extends ErrorSchema = typeof Schema.Never,\n> {\n\treadonly name: string\n\treadonly config: S\n\treadonly error: E\n\treadonly module: string\n\treadonly inject: ReadonlyArray<Service>\n\treadonly provides: ReadonlyArray<Service>\n\treadonly [TypeId]: typeof TypeId\n}\n/** Configuration accepted by make; omitted errors default to Never. */\nexport interface Options<S extends ConfigSchema, E extends ErrorSchema> {\n\treadonly name: string\n\treadonly config: S\n\treadonly error?: E\n\treadonly module: string\n\treadonly inject?: ReadonlyArray<Service>\n\treadonly provides?: ReadonlyArray<Service>\n}\n\n/** An undeclared failure still crosses the boundary, with its diagnostic value. */\nexport class UndeclaredFailure extends Schema.TaggedError<\n\tUndeclaredFailure,\n\t{ readonly brand: unique symbol }\n>()(\"UndeclaredFailure\", { original: Schema.Defect({ includeStack: true }) }) {}\n\n/** Pure metadata shared by the host and the executable runner bootstrap. */\nexport function make<S extends ConfigSchema, E extends ErrorSchema>(\n\toptions: Options<S, E> & { readonly error: E },\n): Contract<S, E>\nexport function make<S extends ConfigSchema>(\n\toptions: Options<S, typeof Schema.Never>,\n): Contract<S>\nexport function make<S extends ConfigSchema, E extends ErrorSchema>(\n\toptions: Options<S, E>,\n): Contract<S, E | typeof Schema.Never> {\n\t// Keys are runtime strings; tuple types cannot distinguish independently created keys.\n\tconst keys = Array.map(\n\t\t[...(options.inject ?? []), ...(options.provides ?? [])],\n\t\t(service) => service.key.key,\n\t)\n\tif (\n\t\tArray.dedupe(keys).length !== keys.length ||\n\t\tkeys.includes(Control.endpoint)\n\t)\n\t\tthrow new Error(\n\t\t\t\"Service keys must be unique within a remote contract and must not use the control endpoint\",\n\t\t)\n\n\treturn {\n\t\t...options,\n\t\terror: options.error ?? Schema.Never,\n\t\tinject: options.inject ?? [],\n\t\tprovides: options.provides ?? [],\n\t\t[TypeId]: TypeId,\n\t}\n}\n\n/** A contract whose schemas are discovered through a dynamic import. */\nexport type RunnerContract = Contract<\n\tSchema.Codec<unknown, Schema.Json>,\n\tSchema.Codec<unknown>\n>\n\nexport const isContract = (value: unknown): value is RunnerContract =>\n\tPredicate.hasProperty(value, TypeId) && value[TypeId] === TypeId\n\n/** A contract module exports either default or a named contract. */\nexport const fromModule = (module: unknown) =>\n\tArray.findFirst(\n\t\t[\n\t\t\tPredicate.hasProperty(module, \"default\") ? module.default : undefined,\n\t\t\tPredicate.hasProperty(module, \"contract\") ? module.contract : undefined,\n\t\t],\n\t\tisContract,\n\t)\n"],"mappings":";;;;;;;;;;;;AAOA,MAAM,SAAS;;AAsDf,IAAa,oBAAb,cAAuC,OAAO,YAG5C,CAAC,CAAC,qBAAqB,EAAE,UAAU,OAAO,OAAO,EAAE,cAAc,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAS/E,SAAgB,KACf,SACuC;CAEvC,MAAM,OAAO,MAAM,IAClB,CAAC,GAAI,QAAQ,UAAU,CAAC,GAAI,GAAI,QAAQ,YAAY,CAAC,CAAE,IACtD,YAAY,QAAQ,IAAI,GAC1B;CACA,IACC,MAAM,OAAO,IAAI,CAAC,CAAC,WAAW,KAAK,UACnC,KAAK,SAAS,kCAAgB,GAE9B,MAAM,IAAI,MACT,4FACD;CAED,OAAO;EACN,GAAG;EACH,OAAO,QAAQ,SAAS,OAAO;EAC/B,QAAQ,QAAQ,UAAU,CAAC;EAC3B,UAAU,QAAQ,YAAY,CAAC;GAC9B,SAAS;CACX;AACD;AAQA,MAAa,cAAc,UAC1B,UAAU,YAAY,OAAO,MAAM,KAAK,MAAM,YAAY;;AAG3D,MAAa,cAAc,WAC1B,MAAM,UACL,CACC,UAAU,YAAY,QAAQ,SAAS,IAAI,OAAO,UAAU,KAAA,GAC5D,UAAU,YAAY,QAAQ,UAAU,IAAI,OAAO,WAAW,KAAA,CAC/D,GACA,UACD"}
|
|
@@ -42,4 +42,15 @@ var AuthenticationFailed = class extends Schema.TaggedError()("AuthenticationFai
|
|
|
42
42
|
challenge: Schema.optionalKey(Schema.String),
|
|
43
43
|
cause: Schema.optionalKey(Schema.Cause(Schema.Unknown, Schema.Unknown))
|
|
44
44
|
}) {};
|
|
45
|
-
|
|
45
|
+
/** A remote entry could not be resolved or configured at the indicated field. */
|
|
46
|
+
var RemoteEntryError = class extends Schema.TaggedError()("RemoteEntryError", {
|
|
47
|
+
entry: Schema.Option(Schema.String),
|
|
48
|
+
directory: Schema.Option(Schema.String),
|
|
49
|
+
field: Schema.String,
|
|
50
|
+
cause: Schema.Cause(Schema.Unknown, Schema.Unknown)
|
|
51
|
+
}) {
|
|
52
|
+
get message() {
|
|
53
|
+
return `Remote entry ${Option.getOrElse(this.entry, () => "<programmatic>")} failed at ${this.field}`;
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
export { ProcessExited as a, RemoteWithdrawn as c, MissingInstance as i, TransportError as l, CredentialsError as n, RemoteEntryError as o, LocalTerminationTimeout as r, RemoteError as s, AuthenticationFailed as t };
|
package/dist/Errors.d.ts
CHANGED
|
@@ -63,5 +63,17 @@ declare const AuthenticationFailed_base: Schema.Class<AuthenticationFailed, Sche
|
|
|
63
63
|
readonly brand: unique symbol;
|
|
64
64
|
}>;
|
|
65
65
|
export declare class AuthenticationFailed extends AuthenticationFailed_base {}
|
|
66
|
+
declare const RemoteEntryError_base: Schema.Class<RemoteEntryError, Schema.TaggedStruct<"RemoteEntryError", {
|
|
67
|
+
readonly entry: Schema.Option<Schema.String>;
|
|
68
|
+
readonly directory: Schema.Option<Schema.String>;
|
|
69
|
+
readonly field: Schema.String;
|
|
70
|
+
readonly cause: Schema.Cause<Schema.Unknown, Schema.Unknown>;
|
|
71
|
+
}>, import("effect/Cause").YieldableError & {
|
|
72
|
+
readonly brand: unique symbol;
|
|
73
|
+
}>;
|
|
74
|
+
/** A remote entry could not be resolved or configured at the indicated field. */
|
|
75
|
+
export declare class RemoteEntryError extends RemoteEntryError_base {
|
|
76
|
+
get message(): string;
|
|
77
|
+
}
|
|
66
78
|
export {};
|
|
67
79
|
//# sourceMappingURL=Errors.d.ts.map
|
package/dist/Errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Errors.d.ts","names":[],"sources":["../src/Errors.ts"],"mappings":";;;;;;;;WAImB;;qBAFN,sBAAsB;MAUrB;;;;;WAQK;;qBAFN,uBAAuB;;WAUjB;;;qBAFN,wBAAwB;MAIvB;;;;;WAQK;;;qBAFN,oBAAoB;;WAQd;;;qBAFN,wBAAwB;MAIvB;;;;;;WAQK;;;qBAFN,gCAAgC;MAO/B;;;;;WAUK;;;qBAFN,yBAAyB;;;;;;WASnB;;qBAFN,6BAA6B"}
|
|
1
|
+
{"version":3,"file":"Errors.d.ts","names":[],"sources":["../src/Errors.ts"],"mappings":";;;;;;;;WAImB;;qBAFN,sBAAsB;MAUrB;;;;;WAQK;;qBAFN,uBAAuB;;WAUjB;;;qBAFN,wBAAwB;MAIvB;;;;;WAQK;;;qBAFN,oBAAoB;;WAQd;;;qBAFN,wBAAwB;MAIvB;;;;;;WAQK;;;qBAFN,gCAAgC;MAO/B;;;;;WAUK;;;qBAFN,yBAAyB;;;;;;WASnB;;qBAFN,6BAA6B;;;;;;;WAYvB;;;qBAFN,yBAAyB;MASxB"}
|
package/dist/Errors.js
CHANGED
|
@@ -42,6 +42,17 @@ var AuthenticationFailed = class extends Schema.TaggedError()("AuthenticationFai
|
|
|
42
42
|
challenge: Schema.optionalKey(Schema.String),
|
|
43
43
|
cause: Schema.optionalKey(Schema.Cause(Schema.Unknown, Schema.Unknown))
|
|
44
44
|
}) {};
|
|
45
|
-
|
|
45
|
+
/** A remote entry could not be resolved or configured at the indicated field. */
|
|
46
|
+
var RemoteEntryError = class extends Schema.TaggedError()("RemoteEntryError", {
|
|
47
|
+
entry: Schema.Option(Schema.String),
|
|
48
|
+
directory: Schema.Option(Schema.String),
|
|
49
|
+
field: Schema.String,
|
|
50
|
+
cause: Schema.Cause(Schema.Unknown, Schema.Unknown)
|
|
51
|
+
}) {
|
|
52
|
+
get message() {
|
|
53
|
+
return `Remote entry ${Option.getOrElse(this.entry, () => "<programmatic>")} failed at ${this.field}`;
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
export { AuthenticationFailed, CredentialsError, LocalTerminationTimeout, MissingInstance, ProcessExited, RemoteEntryError, RemoteError, RemoteWithdrawn, TransportError };
|
|
46
57
|
|
|
47
58
|
//# sourceMappingURL=Errors.js.map
|
package/dist/Errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Errors.js","names":[],"sources":["../src/Errors.ts"],"sourcesContent":["import { Option, Schema } from \"effect\"\n\nexport class ProcessExited extends Schema.TaggedError<\n\tProcessExited,\n\t{ readonly brand: unique symbol }\n>()(\"ProcessExited\", {\n\tpid: Schema.Option(Schema.Int),\n\tthreadId: Schema.optionalKey(Schema.Int),\n\texitCode: Schema.NullOr(Schema.Int),\n\tstderr: Schema.String,\n\tstatusCause: Schema.Cause(Schema.Unknown, Schema.Unknown),\n}) {\n\toverride get message() {\n\t\treturn this.threadId !== undefined\n\t\t\t? `Remote worker ${this.threadId} exited unexpectedly (${this.exitCode})`\n\t\t\t: `Remote process${Option.isSome(this.pid) ? ` ${this.pid.value}` : \"\"} exited unexpectedly (${this.exitCode ?? \"signal\"})`\n\t}\n}\nexport class TransportError extends Schema.TaggedError<\n\tTransportError,\n\t{ readonly brand: unique symbol }\n>()(\"TransportError\", {\n\tcause: Schema.Cause(Schema.Unknown, Schema.Unknown),\n}) {}\n\n/** The remote export lease was withdrawn; host consumers must drain before Dispose. */\nexport class RemoteWithdrawn extends Schema.TaggedError<\n\tRemoteWithdrawn,\n\t{ readonly brand: unique symbol }\n>()(\"RemoteWithdrawn\", {}) {\n\toverride get message() {\n\t\treturn \"Remote services were withdrawn\"\n\t}\n}\n\n/** Infrastructure failure at the plugin boundary; the complete underlying cause remains inspectable. */\nexport class RemoteError extends Schema.TaggedError<\n\tRemoteError,\n\t{ readonly brand: unique symbol }\n>()(\"RemoteError\", { cause: Schema.Cause(Schema.Unknown, Schema.Unknown) }) {}\n\n/** A network execution needs a stable logical identity across host restarts. */\nexport class MissingInstance extends Schema.TaggedError<\n\tMissingInstance,\n\t{ readonly brand: unique symbol }\n>()(\"MissingInstance\", {}) {\n\toverride get message() {\n\t\treturn \"A runner connection requires an instance or a loader entry id; set connect.instance when loading without Loader.\"\n\t}\n}\n\n/** Dispose completed, but Node still owns live handles; process-scope cleanup must terminate it. */\nexport class LocalTerminationTimeout extends Schema.TaggedError<\n\tLocalTerminationTimeout,\n\t{ readonly brand: unique symbol }\n>()(\"LocalTerminationTimeout\", {\n\tpid: Schema.optionalKey(Schema.Int),\n\tthreadId: Schema.optionalKey(Schema.Int),\n}) {\n\toverride get message() {\n\t\treturn this.threadId !== undefined\n\t\t\t? `Remote worker ${this.threadId} did not exit within one second after Dispose; terminating it`\n\t\t\t: `Remote process ${this.pid} did not exit within one second after Dispose; terminating it`\n\t}\n}\n\n/** A credential source failed; the original failure remains available. */\nexport class CredentialsError extends Schema.TaggedError<\n\tCredentialsError,\n\t{ readonly brand: unique symbol }\n>()(\"CredentialsError\", {\n\tcause: Schema.Cause(Schema.Unknown, Schema.Unknown),\n}) {}\n\nexport class AuthenticationFailed extends Schema.TaggedError<\n\tAuthenticationFailed,\n\t{ readonly brand: unique symbol }\n>()(\"AuthenticationFailed\", {\n\treason: Schema.Literals([\"missing\", \"invalid\"]),\n\tchallenge: Schema.optionalKey(Schema.String),\n\tcause: Schema.optionalKey(Schema.Cause(Schema.Unknown, Schema.Unknown)),\n}) {}\n"],"mappings":";;AAEA,IAAa,gBAAb,cAAmC,OAAO,YAGxC,CAAC,CAAC,iBAAiB;CACpB,KAAK,OAAO,OAAO,OAAO,GAAG;CAC7B,UAAU,OAAO,YAAY,OAAO,GAAG;CACvC,UAAU,OAAO,OAAO,OAAO,GAAG;CAClC,QAAQ,OAAO;CACf,aAAa,OAAO,MAAM,OAAO,SAAS,OAAO,OAAO;AACzD,CAAC,CAAC,CAAC;CACF,IAAa,UAAU;EACtB,OAAO,KAAK,aAAa,KAAA,IACtB,iBAAiB,KAAK,SAAS,wBAAwB,KAAK,SAAS,KACrE,iBAAiB,OAAO,OAAO,KAAK,GAAG,IAAI,IAAI,KAAK,IAAI,UAAU,GAAG,wBAAwB,KAAK,YAAY,SAAS;CAC3H;AACD;AACA,IAAa,iBAAb,cAAoC,OAAO,YAGzC,CAAC,CAAC,kBAAkB,EACrB,OAAO,OAAO,MAAM,OAAO,SAAS,OAAO,OAAO,EACnD,CAAC,CAAC,CAAC,CAAC;;AAGJ,IAAa,kBAAb,cAAqC,OAAO,YAG1C,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC;CAC1B,IAAa,UAAU;EACtB,OAAO;CACR;AACD;;AAGA,IAAa,cAAb,cAAiC,OAAO,YAGtC,CAAC,CAAC,eAAe,EAAE,OAAO,OAAO,MAAM,OAAO,SAAS,OAAO,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC;;AAG7E,IAAa,kBAAb,cAAqC,OAAO,YAG1C,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC;CAC1B,IAAa,UAAU;EACtB,OAAO;CACR;AACD;;AAGA,IAAa,0BAAb,cAA6C,OAAO,YAGlD,CAAC,CAAC,2BAA2B;CAC9B,KAAK,OAAO,YAAY,OAAO,GAAG;CAClC,UAAU,OAAO,YAAY,OAAO,GAAG;AACxC,CAAC,CAAC,CAAC;CACF,IAAa,UAAU;EACtB,OAAO,KAAK,aAAa,KAAA,IACtB,iBAAiB,KAAK,SAAS,iEAC/B,kBAAkB,KAAK,IAAI;CAC/B;AACD;;AAGA,IAAa,mBAAb,cAAsC,OAAO,YAG3C,CAAC,CAAC,oBAAoB,EACvB,OAAO,OAAO,MAAM,OAAO,SAAS,OAAO,OAAO,EACnD,CAAC,CAAC,CAAC,CAAC;AAEJ,IAAa,uBAAb,cAA0C,OAAO,YAG/C,CAAC,CAAC,wBAAwB;CAC3B,QAAQ,OAAO,SAAS,CAAC,WAAW,SAAS,CAAC;CAC9C,WAAW,OAAO,YAAY,OAAO,MAAM;CAC3C,OAAO,OAAO,YAAY,OAAO,MAAM,OAAO,SAAS,OAAO,OAAO,CAAC;AACvE,CAAC,CAAC,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"Errors.js","names":[],"sources":["../src/Errors.ts"],"sourcesContent":["import { Option, Schema } from \"effect\"\n\nexport class ProcessExited extends Schema.TaggedError<\n\tProcessExited,\n\t{ readonly brand: unique symbol }\n>()(\"ProcessExited\", {\n\tpid: Schema.Option(Schema.Int),\n\tthreadId: Schema.optionalKey(Schema.Int),\n\texitCode: Schema.NullOr(Schema.Int),\n\tstderr: Schema.String,\n\tstatusCause: Schema.Cause(Schema.Unknown, Schema.Unknown),\n}) {\n\toverride get message() {\n\t\treturn this.threadId !== undefined\n\t\t\t? `Remote worker ${this.threadId} exited unexpectedly (${this.exitCode})`\n\t\t\t: `Remote process${Option.isSome(this.pid) ? ` ${this.pid.value}` : \"\"} exited unexpectedly (${this.exitCode ?? \"signal\"})`\n\t}\n}\nexport class TransportError extends Schema.TaggedError<\n\tTransportError,\n\t{ readonly brand: unique symbol }\n>()(\"TransportError\", {\n\tcause: Schema.Cause(Schema.Unknown, Schema.Unknown),\n}) {}\n\n/** The remote export lease was withdrawn; host consumers must drain before Dispose. */\nexport class RemoteWithdrawn extends Schema.TaggedError<\n\tRemoteWithdrawn,\n\t{ readonly brand: unique symbol }\n>()(\"RemoteWithdrawn\", {}) {\n\toverride get message() {\n\t\treturn \"Remote services were withdrawn\"\n\t}\n}\n\n/** Infrastructure failure at the plugin boundary; the complete underlying cause remains inspectable. */\nexport class RemoteError extends Schema.TaggedError<\n\tRemoteError,\n\t{ readonly brand: unique symbol }\n>()(\"RemoteError\", { cause: Schema.Cause(Schema.Unknown, Schema.Unknown) }) {}\n\n/** A network execution needs a stable logical identity across host restarts. */\nexport class MissingInstance extends Schema.TaggedError<\n\tMissingInstance,\n\t{ readonly brand: unique symbol }\n>()(\"MissingInstance\", {}) {\n\toverride get message() {\n\t\treturn \"A runner connection requires an instance or a loader entry id; set connect.instance when loading without Loader.\"\n\t}\n}\n\n/** Dispose completed, but Node still owns live handles; process-scope cleanup must terminate it. */\nexport class LocalTerminationTimeout extends Schema.TaggedError<\n\tLocalTerminationTimeout,\n\t{ readonly brand: unique symbol }\n>()(\"LocalTerminationTimeout\", {\n\tpid: Schema.optionalKey(Schema.Int),\n\tthreadId: Schema.optionalKey(Schema.Int),\n}) {\n\toverride get message() {\n\t\treturn this.threadId !== undefined\n\t\t\t? `Remote worker ${this.threadId} did not exit within one second after Dispose; terminating it`\n\t\t\t: `Remote process ${this.pid} did not exit within one second after Dispose; terminating it`\n\t}\n}\n\n/** A credential source failed; the original failure remains available. */\nexport class CredentialsError extends Schema.TaggedError<\n\tCredentialsError,\n\t{ readonly brand: unique symbol }\n>()(\"CredentialsError\", {\n\tcause: Schema.Cause(Schema.Unknown, Schema.Unknown),\n}) {}\n\nexport class AuthenticationFailed extends Schema.TaggedError<\n\tAuthenticationFailed,\n\t{ readonly brand: unique symbol }\n>()(\"AuthenticationFailed\", {\n\treason: Schema.Literals([\"missing\", \"invalid\"]),\n\tchallenge: Schema.optionalKey(Schema.String),\n\tcause: Schema.optionalKey(Schema.Cause(Schema.Unknown, Schema.Unknown)),\n}) {}\n\n/** A remote entry could not be resolved or configured at the indicated field. */\nexport class RemoteEntryError extends Schema.TaggedError<\n\tRemoteEntryError,\n\t{ readonly brand: unique symbol }\n>()(\"RemoteEntryError\", {\n\tentry: Schema.Option(Schema.String),\n\tdirectory: Schema.Option(Schema.String),\n\tfield: Schema.String,\n\tcause: Schema.Cause(Schema.Unknown, Schema.Unknown),\n}) {\n\toverride get message() {\n\t\treturn `Remote entry ${Option.getOrElse(this.entry, () => \"<programmatic>\")} failed at ${this.field}`\n\t}\n}\n"],"mappings":";;AAEA,IAAa,gBAAb,cAAmC,OAAO,YAGxC,CAAC,CAAC,iBAAiB;CACpB,KAAK,OAAO,OAAO,OAAO,GAAG;CAC7B,UAAU,OAAO,YAAY,OAAO,GAAG;CACvC,UAAU,OAAO,OAAO,OAAO,GAAG;CAClC,QAAQ,OAAO;CACf,aAAa,OAAO,MAAM,OAAO,SAAS,OAAO,OAAO;AACzD,CAAC,CAAC,CAAC;CACF,IAAa,UAAU;EACtB,OAAO,KAAK,aAAa,KAAA,IACtB,iBAAiB,KAAK,SAAS,wBAAwB,KAAK,SAAS,KACrE,iBAAiB,OAAO,OAAO,KAAK,GAAG,IAAI,IAAI,KAAK,IAAI,UAAU,GAAG,wBAAwB,KAAK,YAAY,SAAS;CAC3H;AACD;AACA,IAAa,iBAAb,cAAoC,OAAO,YAGzC,CAAC,CAAC,kBAAkB,EACrB,OAAO,OAAO,MAAM,OAAO,SAAS,OAAO,OAAO,EACnD,CAAC,CAAC,CAAC,CAAC;;AAGJ,IAAa,kBAAb,cAAqC,OAAO,YAG1C,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC;CAC1B,IAAa,UAAU;EACtB,OAAO;CACR;AACD;;AAGA,IAAa,cAAb,cAAiC,OAAO,YAGtC,CAAC,CAAC,eAAe,EAAE,OAAO,OAAO,MAAM,OAAO,SAAS,OAAO,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC;;AAG7E,IAAa,kBAAb,cAAqC,OAAO,YAG1C,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC;CAC1B,IAAa,UAAU;EACtB,OAAO;CACR;AACD;;AAGA,IAAa,0BAAb,cAA6C,OAAO,YAGlD,CAAC,CAAC,2BAA2B;CAC9B,KAAK,OAAO,YAAY,OAAO,GAAG;CAClC,UAAU,OAAO,YAAY,OAAO,GAAG;AACxC,CAAC,CAAC,CAAC;CACF,IAAa,UAAU;EACtB,OAAO,KAAK,aAAa,KAAA,IACtB,iBAAiB,KAAK,SAAS,iEAC/B,kBAAkB,KAAK,IAAI;CAC/B;AACD;;AAGA,IAAa,mBAAb,cAAsC,OAAO,YAG3C,CAAC,CAAC,oBAAoB,EACvB,OAAO,OAAO,MAAM,OAAO,SAAS,OAAO,OAAO,EACnD,CAAC,CAAC,CAAC,CAAC;AAEJ,IAAa,uBAAb,cAA0C,OAAO,YAG/C,CAAC,CAAC,wBAAwB;CAC3B,QAAQ,OAAO,SAAS,CAAC,WAAW,SAAS,CAAC;CAC9C,WAAW,OAAO,YAAY,OAAO,MAAM;CAC3C,OAAO,OAAO,YAAY,OAAO,MAAM,OAAO,SAAS,OAAO,OAAO,CAAC;AACvE,CAAC,CAAC,CAAC,CAAC;;AAGJ,IAAa,mBAAb,cAAsC,OAAO,YAG3C,CAAC,CAAC,oBAAoB;CACvB,OAAO,OAAO,OAAO,OAAO,MAAM;CAClC,WAAW,OAAO,OAAO,OAAO,MAAM;CACtC,OAAO,OAAO;CACd,OAAO,OAAO,MAAM,OAAO,SAAS,OAAO,OAAO;AACnD,CAAC,CAAC,CAAC;CACF,IAAa,UAAU;EACtB,OAAO,gBAAgB,OAAO,UAAU,KAAK,aAAa,gBAAgB,EAAE,aAAa,KAAK;CAC/F;AACD"}
|
|
@@ -276,6 +276,18 @@ const stable = (status) => Effect.tx(Effect.gen(function* () {
|
|
|
276
276
|
// packages/core/src/internal/context.ts
|
|
277
277
|
/** Strip provision-sourced values before child intercepts read or transform the fallback. */
|
|
278
278
|
const inheritContext = (parent, inherited) => Context.makeUnsafe(new Map([...Array.filter(parent.fallback.mapUnsafe, ([key]) => HashSet.has(parent.provisionKeys, key)), ...Array.filter(inherited.mapUnsafe, ([key]) => !HashSet.has(parent.provisionKeys, key))]));
|
|
279
|
+
// packages/core/src/internal/runtime.ts
|
|
280
|
+
/** Maps a service key to the realm it resolves in. Absent keys use the root realm. */
|
|
281
|
+
const Realms = Context.Reference("@graftland/graft/Realms", { defaultValue: () => HashMap.empty() });
|
|
282
|
+
/** The realm a key resolves in; the root realm is the empty string. */
|
|
283
|
+
const realmOf = (realms, key) => Option.getOrElse(HashMap.get(realms, key), () => "");
|
|
284
|
+
/** The single constructor used by publication, resolution, and failed-publication retries. */
|
|
285
|
+
const realmKey = (realm, service) => `${realm.length}:${realm}${service}`;
|
|
286
|
+
/** Both public and private context views address this same runtime value. */
|
|
287
|
+
const GraftKey = "@graftland/graft/Graft";
|
|
288
|
+
// packages/core/src/internal/runtimeContext.ts
|
|
289
|
+
/** Internal view of the same context key; the public service does not expose the graph. */
|
|
290
|
+
var RuntimeContext = class extends Context.Service()(GraftKey) {};
|
|
279
291
|
// packages/core/src/internal/tasks.ts
|
|
280
292
|
/** One activation owns both the workers and every failure they finish with. */
|
|
281
293
|
const make$1 = Effect.gen(function* () {
|
|
@@ -300,6 +312,11 @@ const run = (group, effect) => FiberSet.run(group.fibers, Effect.uninterruptible
|
|
|
300
312
|
return yield* body;
|
|
301
313
|
})), { startImmediately: false });
|
|
302
314
|
// packages/core/src/Plugin.ts
|
|
315
|
+
/**
|
|
316
|
+
* Plugins are the unit of composition. A plugin declares the services it
|
|
317
|
+
* needs, decodes its configuration with a schema, and runs `apply` inside a
|
|
318
|
+
* scope that lives exactly as long as the plugin is active.
|
|
319
|
+
*/
|
|
303
320
|
const TypeId = "~@graftland/graft/Plugin";
|
|
304
321
|
const Contract = "~@graftland/graft/Plugin/Contract";
|
|
305
322
|
/**
|
|
@@ -309,7 +326,7 @@ const Contract = "~@graftland/graft/Plugin/Contract";
|
|
|
309
326
|
var Optional = class extends Data.TaggedClass("Optional") {};
|
|
310
327
|
/** Starts an activation-owned worker. Its unhandled errors belong to the plugin, not the launch operation. */
|
|
311
328
|
const fork = (effect) => Effect.gen(function* () {
|
|
312
|
-
const { activation } = yield*
|
|
329
|
+
const { activation } = yield* RuntimeContext;
|
|
313
330
|
if (Option.isNone(activation.tasks)) return yield* Effect.die(/* @__PURE__ */ new Error("Plugin.fork requires a plugin activation"));
|
|
314
331
|
return yield* run(activation.tasks.value, effect);
|
|
315
332
|
});
|
|
@@ -342,13 +359,6 @@ const service = (key, build, options) => make({
|
|
|
342
359
|
...options,
|
|
343
360
|
apply: () => Effect.flatMap(build, (value) => provide(key, value))
|
|
344
361
|
});
|
|
345
|
-
// packages/core/src/internal/runtime.ts
|
|
346
|
-
/** Maps a service key to the realm it resolves in. Absent keys use the root realm. */
|
|
347
|
-
const Realms = Context.Reference("@graftland/graft/Realms", { defaultValue: () => HashMap.empty() });
|
|
348
|
-
/** The realm a key resolves in; the root realm is the empty string. */
|
|
349
|
-
const realmOf = (realms, key) => Option.getOrElse(HashMap.get(realms, key), () => "");
|
|
350
|
-
/** The single constructor used by publication, resolution, and failed-publication retries. */
|
|
351
|
-
const realmKey = (realm, service) => `${realm.length}:${realm}${service}`;
|
|
352
362
|
// packages/core/src/internal/activation.ts
|
|
353
363
|
/**
|
|
354
364
|
* The supervision loop of a single fork.
|
|
@@ -715,11 +725,8 @@ const supervise = Effect.fnUntraced(function* (runtime, id, specRef, processing,
|
|
|
715
725
|
* The graft runtime: loading plugins, publishing services, replacing
|
|
716
726
|
* plugins at runtime, and observing the fork tree and its logs.
|
|
717
727
|
*/
|
|
718
|
-
/**
|
|
719
|
-
|
|
720
|
-
* that owns anything it publishes.
|
|
721
|
-
*/
|
|
722
|
-
var Graft = class extends Context.Service()("@graftland/graft/Graft") {};
|
|
728
|
+
/** Identifies the current runtime. Use the module's operations to access it; its state is private. */
|
|
729
|
+
var Graft = class extends Context.Service()(GraftKey) {};
|
|
723
730
|
var ServiceConflict = class extends Schema.TaggedError()("ServiceConflict", {
|
|
724
731
|
service: Schema.String,
|
|
725
732
|
/** Absent for an existing provision; otherwise explains why this activation cannot publish. */
|
|
@@ -741,7 +748,7 @@ var ServiceConflict = class extends Schema.TaggedError()("ServiceConflict", {
|
|
|
741
748
|
* consumer to let go of it.
|
|
742
749
|
*/
|
|
743
750
|
const provide = Effect.fnUntraced(function* (key, value) {
|
|
744
|
-
const { runtime, activation } = yield*
|
|
751
|
+
const { runtime, activation } = yield* RuntimeContext;
|
|
745
752
|
const realms = yield* Realms;
|
|
746
753
|
const qualified = realmKey(realmOf(realms, key.key), key.key);
|
|
747
754
|
yield* Effect.tx(Effect.gen(function* () {
|
|
@@ -818,7 +825,7 @@ const runtimeLayer = Layer.effect(Graft, Effect.gen(function* () {
|
|
|
818
825
|
};
|
|
819
826
|
}));
|
|
820
827
|
/** Copies every log entry into the runtime, so `logs` can replay recent history. */
|
|
821
|
-
const loggerLayer = Logger.layer([Effect.map(
|
|
828
|
+
const loggerLayer = Logger.layer([Effect.map(RuntimeContext, ({ runtime }) => Logger.make((options) => {
|
|
822
829
|
PubSub.publishUnsafe(runtime.logs, {
|
|
823
830
|
date: options.date,
|
|
824
831
|
level: options.logLevel,
|
|
@@ -868,7 +875,7 @@ const makeFork = (status, id, spec, dispose) => {
|
|
|
868
875
|
/** Loads a plugin under the current scope. Closing that scope unloads it. */
|
|
869
876
|
const plugin = Effect.fnUntraced(function* (plugin, input, options) {
|
|
870
877
|
return yield* Effect.uninterruptible(Effect.gen(function* () {
|
|
871
|
-
const { runtime, activation } = yield*
|
|
878
|
+
const { runtime, activation } = yield* RuntimeContext;
|
|
872
879
|
const scope = yield* Effect.scope;
|
|
873
880
|
const termination = yield* Ref.make(Exit.void);
|
|
874
881
|
const owned = yield* ownedScope(scope, Effect.flatMap(Ref.get(termination), (exit) => Exit.isFailure(exit) ? Effect.fail(CleanupError.make({ cause: exit.cause })) : Effect.void));
|
|
@@ -950,7 +957,7 @@ const plugin = Effect.fnUntraced(function* (plugin, input, options) {
|
|
|
950
957
|
/** The requested identities cannot be represented by the runtime's flat aliases. */
|
|
951
958
|
var ReplacementConflict = class extends Schema.TaggedError()("ReplacementConflict", { indices: Schema.Array(Schema.Int) }) {};
|
|
952
959
|
Effect.fnUntraced(function* (pairs) {
|
|
953
|
-
const { runtime } = yield*
|
|
960
|
+
const { runtime } = yield* RuntimeContext;
|
|
954
961
|
yield* Effect.tx(Effect.gen(function* () {
|
|
955
962
|
const conflicts = yield* replace$1(runtime.aliases, pairs);
|
|
956
963
|
if (conflicts.length > 0) return yield* ReplacementConflict.make({ indices: conflicts });
|
|
@@ -980,6 +987,6 @@ const buildTree = (forks) => {
|
|
|
980
987
|
return children(void 0);
|
|
981
988
|
};
|
|
982
989
|
/** The fork tree, emitted again on every change. */
|
|
983
|
-
const forks = Stream.unwrap(Effect.map(
|
|
984
|
-
Stream.unwrap(Effect.map(
|
|
990
|
+
const forks = Stream.unwrap(Effect.map(RuntimeContext, ({ runtime }) => TxSubscriptionRef.changesStream(runtime.forks).pipe(Stream.map(buildTree))));
|
|
991
|
+
Stream.unwrap(Effect.map(RuntimeContext, ({ runtime }) => Stream.fromPubSub(runtime.logs)));
|
|
985
992
|
export { provide as a, isPlugin as c, service as d, CleanupError as f, plugin as i, make as l, intercept as n, fork as o, layer as r, fromModule as s, forks as t, optional as u };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as PackageError } from "./Peer-
|
|
1
|
+
import { c as PackageError } from "./Peer-BT7eAGmh.js";
|
|
2
2
|
import { Array, Cause, Context, Duration, Effect, FileSystem, Order, Path, Schema, Stream, String } from "effect";
|
|
3
3
|
import process from "node:process";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { l as TransportError } from "./Errors-BMKmu5Y7.js";
|
|
2
2
|
import { i as encode, r as decoder, t as EndOfStream } from "./Framing-zaYdOJnT.js";
|
|
3
3
|
import { t as make$1 } from "./FailureGroup-BcH0XOBi.js";
|
|
4
|
-
import { a as PositiveInt, i as PositiveFinite, r as Limits, t as Priority } from "./port-
|
|
4
|
+
import { a as PositiveInt, i as PositiveFinite, r as Limits, t as Priority } from "./port-DSVUY8Bq.js";
|
|
5
5
|
import { Array, Cause, Context, Data, Duration, Effect, Fiber, Option, Queue, Schema, Sink, Stream, TxQueue } from "effect";
|
|
6
6
|
import { Rpc, RpcGroup } from "effect/rpc";
|
|
7
7
|
// packages/remote/src/Instance.ts
|
package/dist/Testing.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { TransportError } from "./Errors.js";
|
|
2
2
|
import { Channel } from "./Transport.js";
|
|
3
|
-
import { FrameError } from "./internal/runner/Framing.js";
|
|
4
3
|
import { Plugin } from "@graftland/graft";
|
|
5
|
-
import { Effect, Schema } from "effect";
|
|
4
|
+
import { Cause, Effect, Schema } from "effect";
|
|
6
5
|
declare const ConformanceError_base: Schema.Class<ConformanceError, Schema.TaggedStruct<"ConformanceError", {
|
|
7
6
|
readonly message: Schema.String;
|
|
8
|
-
|
|
7
|
+
readonly cause: Schema.optionalKey<Schema.Cause<Schema.Unknown, Schema.Unknown>>;
|
|
8
|
+
}>, Cause.YieldableError & {
|
|
9
9
|
readonly brand: unique symbol;
|
|
10
10
|
}>;
|
|
11
11
|
export declare class ConformanceError extends ConformanceError_base {}
|
|
@@ -17,7 +17,7 @@ export interface Capabilities {
|
|
|
17
17
|
}
|
|
18
18
|
/** The fixture supplies addresses/credentials and an echo session; no full runner is required. */
|
|
19
19
|
export declare const transport: <E, R>(plugins: Capabilities, fixture: (plugins: Capabilities) => Effect.Effect<Channel, E, R>) => {
|
|
20
|
-
chunks: Effect.Effect<void, E | ConformanceError |
|
|
20
|
+
chunks: Effect.Effect<void, E | ConformanceError | TransportError, R | import("effect/Scope").Scope>;
|
|
21
21
|
eof: Effect.Effect<void, E | ConformanceError | TransportError, R>;
|
|
22
22
|
};
|
|
23
23
|
/** HTTP implementations reject before accepting a session, preserving the challenge. */
|
package/dist/Testing.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Testing.d.ts","names":[
|
|
1
|
+
{"version":3,"file":"Testing.d.ts","names":[],"sources":["../src/Testing.ts"],"mappings":";;;;;;;;WAkBmB;;qBAFN,yBAAyB;iBASrB;WACP,WAAW,OAAO;WAClB,UAAU,OAAO;WACjB,aAAa,OAAO;WACpB,eAAe,OAAO;;;qBAGnB,YAAa,GAAG,GAAC,SACpB,cAAY,UACX,SAAS,iBAAiB,OAAO,OAAO,SAAS,GAAG;EAI7D,QAAM,OAAA,aAAA,IAAA,mBAAA,gBAAA,2BAAA;EAmEN,KAAG,OAAA,aAAA,IAAA,mBAAA,gBAAA;;;qBAaQ,YAAa,GAAG,GAAC,UACnB,OAAO,eAAe,GAAG,IAAE,uBACnB,OAAA,eAAA,IAAA,kBAAA"}
|
package/dist/Testing.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import { decoder, encode } from "./internal/runner/Framing.js";
|
|
2
|
-
import { Array, Deferred, Effect, Equivalence, Fiber, Schema, Stream, String } from "effect";
|
|
1
|
+
import { FrameError, decoder, encode } from "./internal/runner/Framing.js";
|
|
2
|
+
import { Array, Cause, Deferred, Effect, Equivalence, Fiber, Schema, Stream, String } from "effect";
|
|
3
3
|
// src/Testing.ts
|
|
4
|
-
var ConformanceError = class extends Schema.TaggedError()("ConformanceError", {
|
|
4
|
+
var ConformanceError = class extends Schema.TaggedError()("ConformanceError", {
|
|
5
|
+
message: Schema.String,
|
|
6
|
+
cause: Schema.optionalKey(Schema.Cause(Schema.Unknown, Schema.Unknown))
|
|
7
|
+
}) {};
|
|
5
8
|
const check = (condition, message) => condition ? Effect.void : Effect.fail(ConformanceError.make({ message }));
|
|
6
9
|
/** The fixture supplies addresses/credentials and an echo session; no full runner is required. */
|
|
7
10
|
const transport = (plugins, fixture) => {
|
|
@@ -48,7 +51,10 @@ const transport = (plugins, fixture) => {
|
|
|
48
51
|
channel: 1,
|
|
49
52
|
payload: [4, 5]
|
|
50
53
|
}]), "The channel changed byte order across split or coalesced chunks");
|
|
51
|
-
})
|
|
54
|
+
}).pipe(Effect.mapError((error) => Schema.is(FrameError)(error) ? ConformanceError.make({
|
|
55
|
+
message: error.message,
|
|
56
|
+
cause: Cause.fail(error)
|
|
57
|
+
}) : error)),
|
|
52
58
|
eof: Effect.gen(function* () {
|
|
53
59
|
const channel = yield* connect;
|
|
54
60
|
yield* Stream.empty.pipe(Stream.run(channel.output));
|
package/dist/Testing.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Testing.js","names":["Framing.encode","Framing.decoder"],"sources":["../src/Testing.ts"],"sourcesContent":["import type { Plugin } from \"@graftland/graft\"\nimport {\n\tArray,\n\tEquivalence,\n\tDeferred,\n\tEffect,\n\tFiber,\n\tStream,\n\tString,\n\tSchema,\n} from \"effect\"\nimport type { Channel } from \"./Transport\"\nimport * as Framing from \"./internal/runner/Framing\"\n\nexport class ConformanceError extends Schema.TaggedError<\n\tConformanceError,\n\t{ readonly brand: unique symbol }\n>()(\"ConformanceError\", {
|
|
1
|
+
{"version":3,"file":"Testing.js","names":["Framing.encode","Framing.decoder","Framing.FrameError"],"sources":["../src/Testing.ts"],"sourcesContent":["import type { Plugin } from \"@graftland/graft\"\nimport {\n\tArray,\n\tCause,\n\tEquivalence,\n\tDeferred,\n\tEffect,\n\tFiber,\n\tStream,\n\tString,\n\tSchema,\n} from \"effect\"\nimport type { TransportError } from \"./Errors\"\nimport type { Channel } from \"./Transport\"\nimport * as Framing from \"./internal/runner/Framing\"\n\nexport class ConformanceError extends Schema.TaggedError<\n\tConformanceError,\n\t{ readonly brand: unique symbol }\n>()(\"ConformanceError\", {\n\tmessage: Schema.String,\n\tcause: Schema.optionalKey(Schema.Cause(Schema.Unknown, Schema.Unknown)),\n}) {}\nconst check = (condition: boolean, message: string) =>\n\tcondition ? Effect.void : Effect.fail(ConformanceError.make({ message }))\nexport interface Capabilities {\n\treadonly connector: Plugin.Plugin\n\treadonly listener: Plugin.Plugin\n\treadonly credentials: Plugin.Plugin\n\treadonly authenticator: Plugin.Plugin\n}\n/** The fixture supplies addresses/credentials and an echo session; no full runner is required. */\nexport const transport = <E, R>(\n\tplugins: Capabilities,\n\tfixture: (plugins: Capabilities) => Effect.Effect<Channel, E, R>,\n) => {\n\tconst connect = fixture(plugins)\n\treturn {\n\t\tchunks: Effect.gen(function* () {\n\t\t\tconst channel = yield* connect\n\t\t\tconst first = yield* Framing.encode({\n\t\t\t\tchannel: 0,\n\t\t\t\tpayload: new Uint8Array([1, 2, 3]),\n\t\t\t})\n\t\t\tconst second = yield* Framing.encode({\n\t\t\t\tchannel: 1,\n\t\t\t\tpayload: new Uint8Array([4, 5]),\n\t\t\t})\n\t\t\tconst combined = new Uint8Array(first.length + second.length)\n\t\t\tcombined.set(first)\n\t\t\tcombined.set(second, first.length)\n\t\t\t// Split the header, then put the remainder and the next frame in one chunk.\n\t\t\tconst done = yield* Deferred.make<void>()\n\t\t\tconst sending = yield* Stream.make(\n\t\t\t\tcombined.subarray(0, 2),\n\t\t\t\tcombined.subarray(2),\n\t\t\t).pipe(\n\t\t\t\tStream.concat(\n\t\t\t\t\tStream.fromEffect(Deferred.await(done)).pipe(Stream.drain),\n\t\t\t\t),\n\t\t\t\tStream.run(channel.output),\n\t\t\t\tEffect.forkScoped,\n\t\t\t)\n\t\t\tconst frames = Framing.decoder()\n\t\t\tconst reply = yield* channel.input.pipe(\n\t\t\t\tStream.mapEffect((chunk) => Effect.fromResult(frames.decode(chunk))),\n\t\t\t\tStream.flattenIterable,\n\t\t\t\tStream.zipWithIndex,\n\t\t\t\tStream.tap(([, index]) =>\n\t\t\t\t\tindex === 1 ? Deferred.succeed(done, undefined) : Effect.void,\n\t\t\t\t),\n\t\t\t\tStream.map(([frame]) => frame),\n\t\t\t\tStream.runCollect,\n\t\t\t)\n\t\t\tyield* frames.finish\n\t\t\tyield* Deferred.succeed(done, undefined)\n\t\t\tyield* Fiber.join(sending)\n\t\t\tyield* check(\n\t\t\t\tArray.makeEquivalence(\n\t\t\t\t\tEquivalence.Struct({\n\t\t\t\t\t\tchannel: Equivalence.Number,\n\t\t\t\t\t\tpayload: Array.makeEquivalence(Equivalence.Number),\n\t\t\t\t\t}),\n\t\t\t\t)(\n\t\t\t\t\tArray.map(reply, (frame) => ({\n\t\t\t\t\t\tchannel: frame.channel,\n\t\t\t\t\t\tpayload: Array.fromIterable(frame.payload),\n\t\t\t\t\t})),\n\t\t\t\t\t[\n\t\t\t\t\t\t{ channel: 0, payload: [1, 2, 3] },\n\t\t\t\t\t\t{ channel: 1, payload: [4, 5] },\n\t\t\t\t\t],\n\t\t\t\t),\n\t\t\t\t\"The channel changed byte order across split or coalesced chunks\",\n\t\t\t)\n\t\t}).pipe(\n\t\t\tEffect.mapError((error): E | ConformanceError | TransportError =>\n\t\t\t\tSchema.is(Framing.FrameError)(error)\n\t\t\t\t\t? ConformanceError.make({\n\t\t\t\t\t\t\tmessage: error.message,\n\t\t\t\t\t\t\tcause: Cause.fail(error),\n\t\t\t\t\t\t})\n\t\t\t\t\t: error,\n\t\t\t),\n\t\t),\n\t\teof: Effect.gen(function* () {\n\t\t\tconst channel = yield* connect\n\t\t\tyield* Stream.empty.pipe(Stream.run(channel.output))\n\t\t\tconst remaining = yield* Stream.runCollect(channel.input)\n\t\t\tyield* check(\n\t\t\t\tremaining.length === 0,\n\t\t\t\t\"The channel produced bytes after EOF\",\n\t\t\t)\n\t\t}),\n\t}\n}\n\n/** HTTP implementations reject before accepting a session, preserving the challenge. */\nexport const rejection = <E, R>(\n\tresponse: Effect.Effect<string, E, R>,\n\tchallenge?: string,\n) =>\n\tresponse.pipe(\n\t\tEffect.tap((response) =>\n\t\t\tEffect.all(\n\t\t\t\t[\n\t\t\t\t\tcheck(String.includes(\"HTTP/1.1 401\")(response), \"Expected HTTP 401\"),\n\t\t\t\t\tcheck(\n\t\t\t\t\t\t!String.includes(\"101 Switching Protocols\")(response),\n\t\t\t\t\t\t\"Rejected credentials opened a WebSocket\",\n\t\t\t\t\t),\n\t\t\t\t\tcheck(\n\t\t\t\t\t\t!String.includes(\"sec-websocket-accept:\")(\n\t\t\t\t\t\t\tString.toLowerCase(response),\n\t\t\t\t\t\t),\n\t\t\t\t\t\t\"Rejected credentials received a WebSocket accept header\",\n\t\t\t\t\t),\n\t\t\t\t\tcheck(\n\t\t\t\t\t\tchallenge === undefined ||\n\t\t\t\t\t\t\tString.includes(\n\t\t\t\t\t\t\t\t\"www-authenticate: \" + String.toLowerCase(challenge),\n\t\t\t\t\t\t\t)(String.toLowerCase(response)),\n\t\t\t\t\t\t\"The authentication challenge was lost\",\n\t\t\t\t\t),\n\t\t\t\t],\n\t\t\t\t{ discard: true },\n\t\t\t),\n\t\t),\n\t)\n"],"mappings":";;;AAgBA,IAAa,mBAAb,cAAsC,OAAO,YAG3C,CAAC,CAAC,oBAAoB;CACvB,SAAS,OAAO;CAChB,OAAO,OAAO,YAAY,OAAO,MAAM,OAAO,SAAS,OAAO,OAAO,CAAC;AACvE,CAAC,CAAC,CAAC,CAAC;AACJ,MAAM,SAAS,WAAoB,YAClC,YAAY,OAAO,OAAO,OAAO,KAAK,iBAAiB,KAAK,EAAE,QAAQ,CAAC,CAAC;;AAQzE,MAAa,aACZ,SACA,YACI;CACJ,MAAM,UAAU,QAAQ,OAAO;CAC/B,OAAO;EACN,QAAQ,OAAO,IAAI,aAAa;GAC/B,MAAM,UAAU,OAAO;GACvB,MAAM,QAAQ,OAAOA,OAAe;IACnC,SAAS;IACT,SAAS,IAAI,WAAW;KAAC;KAAG;KAAG;IAAC,CAAC;GAClC,CAAC;GACD,MAAM,SAAS,OAAOA,OAAe;IACpC,SAAS;IACT,SAAS,IAAI,WAAW,CAAC,GAAG,CAAC,CAAC;GAC/B,CAAC;GACD,MAAM,WAAW,IAAI,WAAW,MAAM,SAAS,OAAO,MAAM;GAC5D,SAAS,IAAI,KAAK;GAClB,SAAS,IAAI,QAAQ,MAAM,MAAM;GAEjC,MAAM,OAAO,OAAO,SAAS,KAAW;GACxC,MAAM,UAAU,OAAO,OAAO,KAC7B,SAAS,SAAS,GAAG,CAAC,GACtB,SAAS,SAAS,CAAC,CACpB,CAAC,CAAC,KACD,OAAO,OACN,OAAO,WAAW,SAAS,MAAM,IAAI,CAAC,CAAC,CAAC,KAAK,OAAO,KAAK,CAC1D,GACA,OAAO,IAAI,QAAQ,MAAM,GACzB,OAAO,UACR;GACA,MAAM,SAASC,QAAgB;GAC/B,MAAM,QAAQ,OAAO,QAAQ,MAAM,KAClC,OAAO,WAAW,UAAU,OAAO,WAAW,OAAO,OAAO,KAAK,CAAC,CAAC,GACnE,OAAO,iBACP,OAAO,cACP,OAAO,KAAK,GAAG,WACd,UAAU,IAAI,SAAS,QAAQ,MAAM,KAAA,CAAS,IAAI,OAAO,IAC1D,GACA,OAAO,KAAK,CAAC,WAAW,KAAK,GAC7B,OAAO,UACR;GACA,OAAO,OAAO;GACd,OAAO,SAAS,QAAQ,MAAM,KAAA,CAAS;GACvC,OAAO,MAAM,KAAK,OAAO;GACzB,OAAO,MACN,MAAM,gBACL,YAAY,OAAO;IAClB,SAAS,YAAY;IACrB,SAAS,MAAM,gBAAgB,YAAY,MAAM;GAClD,CAAC,CACF,CAAC,CACA,MAAM,IAAI,QAAQ,WAAW;IAC5B,SAAS,MAAM;IACf,SAAS,MAAM,aAAa,MAAM,OAAO;GAC1C,EAAE,GACF,CACC;IAAE,SAAS;IAAG,SAAS;KAAC;KAAG;KAAG;IAAC;GAAE,GACjC;IAAE,SAAS;IAAG,SAAS,CAAC,GAAG,CAAC;GAAE,CAC/B,CACD,GACA,iEACD;EACD,CAAC,CAAC,CAAC,KACF,OAAO,UAAU,UAChB,OAAO,GAAGC,UAAkB,CAAC,CAAC,KAAK,IAChC,iBAAiB,KAAK;GACtB,SAAS,MAAM;GACf,OAAO,MAAM,KAAK,KAAK;EACxB,CAAC,IACA,KACJ,CACD;EACA,KAAK,OAAO,IAAI,aAAa;GAC5B,MAAM,UAAU,OAAO;GACvB,OAAO,OAAO,MAAM,KAAK,OAAO,IAAI,QAAQ,MAAM,CAAC;GACnD,MAAM,YAAY,OAAO,OAAO,WAAW,QAAQ,KAAK;GACxD,OAAO,MACN,UAAU,WAAW,GACrB,sCACD;EACD,CAAC;CACF;AACD;;AAGA,MAAa,aACZ,UACA,cAEA,SAAS,KACR,OAAO,KAAK,aACX,OAAO,IACN;CACC,MAAM,OAAO,SAAS,cAAc,CAAC,CAAC,QAAQ,GAAG,mBAAmB;CACpE,MACC,CAAC,OAAO,SAAS,yBAAyB,CAAC,CAAC,QAAQ,GACpD,yCACD;CACA,MACC,CAAC,OAAO,SAAS,uBAAuB,CAAC,CACxC,OAAO,YAAY,QAAQ,CAC5B,GACA,yDACD;CACA,MACC,cAAc,KAAA,KACb,OAAO,SACN,uBAAuB,OAAO,YAAY,SAAS,CACpD,CAAC,CAAC,OAAO,YAAY,QAAQ,CAAC,GAC/B,uCACD;AACD,GACA,EAAE,SAAS,KAAK,CACjB,CACD,CACD"}
|
package/dist/bin.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { r as __require, t as __commonJSMin } from "./rolldown-runtime-DYf_mQCB.js";
|
|
3
|
-
import { a as provide, f as CleanupError, i as plugin$1, l as make, n as intercept, r as layer, t as forks } from "./Graft-
|
|
4
|
-
import { n as run$1, r as platform, t as load$1 } from "./childRuntime-
|
|
5
|
-
import {
|
|
6
|
-
import { t as Bootstrap } from "./Bootstrap-
|
|
3
|
+
import { a as provide, f as CleanupError, i as plugin$1, l as make, n as intercept, r as layer, t as forks } from "./Graft-CVyueNOf.js";
|
|
4
|
+
import { n as run$1, r as platform, t as load$1 } from "./childRuntime-An0HsIzl.js";
|
|
5
|
+
import { l as TransportError } from "./Errors-BMKmu5Y7.js";
|
|
6
|
+
import { t as Bootstrap } from "./Bootstrap-Dr6sX7el.js";
|
|
7
7
|
import { t as make$1 } from "./FailureGroup-BcH0XOBi.js";
|
|
8
|
-
import { a as ExecutionError } from "./Peer-
|
|
8
|
+
import { a as ExecutionError } from "./Peer-BT7eAGmh.js";
|
|
9
9
|
import { n as Notice } from "./WatchdogProtocol-BZmVxrBP.js";
|
|
10
|
-
import { a as isOnlyFailure, c as Env, d as isSnapshot, f as snapshot, i as make$3, l as resolveEnv, m as isSubtreeActive, o as CurrentId, p as findSubtree, r as ModuleResolver, s as Entry, t as make$2, u as isContainer } from "./importer-
|
|
10
|
+
import { a as isOnlyFailure, c as Env, d as isSnapshot, f as snapshot, i as make$3, l as resolveEnv, m as isSubtreeActive, o as CurrentId, p as findSubtree, r as ModuleResolver, s as Entry, t as make$2, u as isContainer } from "./importer-Bk6U_sn4.js";
|
|
11
11
|
import { t as ConfigDirectory } from "./ConfigDirectory-BCC6q2R4.js";
|
|
12
12
|
import { n as StartupError, r as make$4, t as ServeLifecycle } from "./ServeLifecycle-CJM0gG5B.js";
|
|
13
|
-
import { n as cleanupCause } from "./cleanup-
|
|
13
|
+
import { n as cleanupCause } from "./cleanup-CXLa1Wd9.js";
|
|
14
14
|
import { Array as Array$1, Cause, Chunk, Console, Context, Data, DateTime, Deferred, Effect, Equal, Exit, Fiber, FiberMap, FileSystem, Hash, HashMap, HashSet, Layer, Logger, MutableList, Option, Order, Path, Predicate, Queue, Random, Record, Redacted, Ref, Result, Schema, Scope, ScopedRef, Semaphore, Stdio, Stream, String as String$1, SubscriptionRef } from "effect";
|
|
15
15
|
import { NodeRuntime, NodeSink } from "@effect/platform-node";
|
|
16
16
|
import { Argument, CliError, Command, Flag } from "effect/cli";
|