@graftland/plugin-remote 0.3.0 → 0.3.2
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/Auth.d.ts +2 -2
- package/dist/Auth.d.ts.map +1 -1
- package/dist/Auth.js.map +1 -1
- package/dist/{Bootstrap-MCwivGN1.js → Bootstrap-H9gDsgsC.js} +2 -2
- package/dist/{Contract-CcpSIJm4.js → Contract-DsJtisvL.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-DYhsGZcZ.js} +14 -1
- package/dist/Errors.d.ts +19 -0
- package/dist/Errors.d.ts.map +1 -1
- package/dist/Errors.js +14 -1
- package/dist/Errors.js.map +1 -1
- package/dist/{FailureGroup-BcH0XOBi.js → FailureGroup-BgT73AaR.js} +14 -4
- package/dist/{Framing-zaYdOJnT.js → Framing-G9eSaeLb.js} +1 -1
- package/dist/{Graft-BsYq3F-J.js → Graft-B71CPA2Y.js} +46 -35
- package/dist/{Packages-B1TPk8pa.js → Packages-AgoCGotL.js} +23 -26
- package/dist/{Peer-IJgFK6mD.js → Peer-DXeVrGBh.js} +5 -5
- package/dist/{ProcessObservation-DEGrEMfP.js → ProcessObservation-gLgGirYv.js} +1 -1
- package/dist/{ServeLifecycle-CJM0gG5B.js → ServeLifecycle-Bd1FPJ6e.js} +1 -1
- 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/Transport.d.ts +2 -2
- package/dist/Transport.d.ts.map +1 -1
- package/dist/Transport.js.map +1 -1
- package/dist/bin.js +48 -47
- package/dist/bin.js.map +1 -1
- package/dist/{childRuntime-DSqtFN9o.js → childRuntime-Bm3iSg_N.js} +30 -26
- package/dist/connectionEnded-BwcxQ7W8.js +54 -0
- package/dist/{entry-SYsx9VNb.js → entry-psOpX3Bj.js} +76 -48
- 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 +4 -4
- 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 +3 -3
- 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 -5
- package/dist/host/worker.js.map +1 -1
- package/dist/{importer-D7zSgqxq.js → importer-Cvf88eAY.js} +5 -8
- package/dist/index.d.ts +2 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -10
- package/dist/index.js.map +1 -1
- package/dist/internal/Certificates.js +4 -4
- package/dist/internal/Certificates.js.map +1 -1
- package/dist/internal/FailureGroup.js +3 -2
- package/dist/internal/FailureGroup.js.map +1 -1
- package/dist/internal/assembly.js +9 -2
- package/dist/internal/assembly.js.map +1 -1
- package/dist/internal/auth/mtls.js +1 -1
- package/dist/internal/auth/mtls.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 +20 -17
- package/dist/internal/child.js.map +1 -1
- package/dist/internal/childRuntime.js +6 -4
- 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/directTransport.d.ts +1 -1
- package/dist/internal/entry.d.ts +1 -2
- package/dist/internal/entry.d.ts.map +1 -1
- package/dist/internal/entry.js +4 -14
- package/dist/internal/entry.js.map +1 -1
- package/dist/internal/execution.js +44 -7
- package/dist/internal/execution.js.map +1 -1
- package/dist/internal/host/runner.js +7 -6
- package/dist/internal/host/runner.js.map +1 -1
- package/dist/internal/host.js +5 -5
- package/dist/internal/host.js.map +1 -1
- package/dist/internal/port.d.ts +2 -10
- package/dist/internal/port.js +5 -5
- package/dist/internal/port.js.map +1 -1
- package/dist/internal/release.js +1 -1
- package/dist/internal/release.js.map +1 -1
- package/dist/internal/runner/Connection.d.ts +1 -1
- package/dist/internal/runner/Connection.js +4 -4
- package/dist/internal/runner/Connection.js.map +1 -1
- package/dist/internal/runner/Execution.js +3 -3
- package/dist/internal/runner/Execution.js.map +1 -1
- package/dist/internal/runner/Framing.d.ts +1 -11
- package/dist/internal/runner/Framing.js +1 -1
- package/dist/internal/runner/Framing.js.map +1 -1
- package/dist/internal/runner/Local.js +1 -1
- package/dist/internal/runner/Local.js.map +1 -1
- package/dist/internal/runner/Lock.js +1 -1
- package/dist/internal/runner/Lock.js.map +1 -1
- package/dist/internal/runner/Packages.d.ts +1 -1
- package/dist/internal/runner/Packages.js +22 -25
- package/dist/internal/runner/Packages.js.map +1 -1
- package/dist/internal/runner/Processes.js +7 -9
- package/dist/internal/runner/Processes.js.map +1 -1
- package/dist/internal/runner/Store.js +3 -3
- package/dist/internal/runner/Store.js.map +1 -1
- package/dist/internal/runner/Supervisor.js +46 -47
- package/dist/internal/runner/Supervisor.js.map +1 -1
- package/dist/internal/runner/accept.js +3 -3
- package/dist/internal/runner/accept.js.map +1 -1
- package/dist/internal/runner/model.js +1 -1
- package/dist/internal/runner/model.js.map +1 -1
- package/dist/internal/serve.js +1 -1
- package/dist/internal/serve.js.map +1 -1
- 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/watchdogMain.js +5 -5
- package/dist/internal/watchdogMain.js.map +1 -1
- package/dist/internal/websocketServer.js +3 -1
- package/dist/internal/websocketServer.js.map +1 -1
- package/dist/internal/workerMain.js +3 -3
- package/dist/{port-Blbh8tms.js → port--3x2zJ4D.js} +8 -8
- package/dist/{release-BY4Mlluy.js → release-DfZPuIcK.js} +1 -1
- package/dist/runner/auth/bearer.js +2 -2
- package/dist/runner/auth/jwt.js +4 -4
- package/dist/runner/auth/jwt.js.map +1 -1
- package/dist/runner/auth/mtls.js +3 -3
- package/dist/runner/auth/none.js +1 -1
- package/dist/runner/index.js +5 -5
- package/dist/runner/stdio.js +3 -3
- package/dist/runner/unix.js +3 -3
- package/dist/runner/websocket.js +4 -4
- package/dist/{socketChannel-KmtzF-9G.js → socketChannel-CJvL2DiB.js} +2 -2
- package/dist/{supervisorPlugin-Inb1S5IV.js → supervisorPlugin-t6Z6PrhD.js} +72 -76
- package/dist/{token-v5ne2I0-.js → token-CYBNNlhS.js} +1 -1
- package/dist/{tokenCredentials-WUJm2AKm.js → tokenCredentials-CbCuk-Rt.js} +3 -3
- package/dist/{websocketServer-MXcCJx0v.js → websocketServer-NQhODlEt.js} +5 -3
- package/dist/{workerChannel-P82YdNjh.js → workerChannel-C8hhBJzA.js} +1 -1
- package/package.json +3 -3
- package/src/Auth.ts +9 -2
- package/src/Contract.ts +67 -51
- package/src/Errors.ts +23 -0
- package/src/Testing.ts +16 -2
- package/src/Transport.ts +6 -2
- package/src/bin.ts +28 -30
- 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 +8 -4
- package/src/internal/Certificates.ts +10 -13
- package/src/internal/FailureGroup.ts +128 -121
- package/src/internal/assembly.ts +19 -10
- package/src/internal/auth/mtls.ts +19 -20
- package/src/internal/auth/tokenCredentials.ts +1 -7
- package/src/internal/child.ts +249 -240
- package/src/internal/childRuntime.ts +84 -81
- package/src/internal/contract.ts +47 -0
- package/src/internal/credentials.ts +12 -9
- package/src/internal/entry.ts +11 -25
- package/src/internal/execution.ts +73 -14
- package/src/internal/host/runner.ts +153 -153
- package/src/internal/host.ts +123 -130
- package/src/internal/port.ts +100 -103
- package/src/internal/release.ts +3 -2
- package/src/internal/runner/Connection.ts +52 -60
- package/src/internal/runner/Execution.ts +163 -164
- package/src/internal/runner/Framing.ts +9 -10
- package/src/internal/runner/Local.ts +26 -27
- package/src/internal/runner/Lock.ts +23 -25
- package/src/internal/runner/Packages.ts +67 -70
- package/src/internal/runner/Processes.ts +89 -92
- package/src/internal/runner/Store.ts +110 -114
- package/src/internal/runner/Supervisor.ts +392 -405
- package/src/internal/runner/accept.ts +76 -84
- package/src/internal/runner/model.ts +20 -21
- package/src/internal/serve.ts +15 -13
- package/src/internal/services.ts +1 -19
- package/src/internal/watchdogMain.ts +16 -11
- package/src/internal/websocketServer.ts +18 -3
- package/src/runner/auth/jwt.ts +10 -6
- package/dist/cleanup-BPWr-5U9.js +0 -13
- 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
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
TxRef,
|
|
14
14
|
} from "effect"
|
|
15
15
|
import * as Release from "./release"
|
|
16
|
+
import { cleanupCause } from "./cleanup"
|
|
16
17
|
|
|
17
18
|
type State<E> = Data.TaggedEnum<{
|
|
18
19
|
Open: {}
|
|
@@ -44,133 +45,139 @@ export interface FailureGroup<E> {
|
|
|
44
45
|
}
|
|
45
46
|
|
|
46
47
|
/** One owner for first failure, transaction wakeups, and interruption of sibling work. */
|
|
47
|
-
export const make = <E>(): Effect.
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
48
|
+
export const make = Effect.fnUntraced(function* <E>(): Effect.fn.Return<
|
|
49
|
+
FailureGroup<E>,
|
|
50
|
+
never,
|
|
51
|
+
Scope.Scope
|
|
52
|
+
> {
|
|
53
|
+
const fibers = yield* FiberSet.make<unknown, E>()
|
|
54
|
+
const state = yield* TxRef.make<State<E>>(State.Open())
|
|
55
|
+
const failures = yield* Ref.make<Cause.Cause<E>>(Cause.empty)
|
|
56
|
+
const cleanup = yield* Ref.make<Cause.Cause<E>>(Cause.empty)
|
|
57
|
+
const check = TxRef.get(state).pipe(
|
|
58
|
+
Effect.flatMap((s) =>
|
|
59
|
+
s._tag === "Failed"
|
|
60
|
+
? Effect.failCause(s.cause)
|
|
61
|
+
: s._tag === "Closed"
|
|
62
|
+
? Effect.interrupt
|
|
63
|
+
: Effect.void,
|
|
64
|
+
),
|
|
65
|
+
)
|
|
66
|
+
const publish = (cause: Cause.Cause<E>) =>
|
|
67
|
+
TxRef.update(state, (s): State<E> =>
|
|
68
|
+
s._tag === "Open" ? State.Failed({ cause }) : s,
|
|
61
69
|
)
|
|
62
|
-
const publish = (cause: Cause.Cause<E>) =>
|
|
63
|
-
TxRef.update(state, (s): State<E> =>
|
|
64
|
-
s._tag === "Open" ? State.Failed({ cause }) : s,
|
|
65
|
-
)
|
|
66
70
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
71
|
+
const observe = <A, R>(effect: Effect.Effect<A, E, R>) =>
|
|
72
|
+
Effect.uninterruptibleMask((restore) =>
|
|
73
|
+
Effect.gen(function* () {
|
|
74
|
+
const scope = yield* Scope.make()
|
|
75
|
+
// The owned child makes cancellation explicit, even when a stream closes an internal scope.
|
|
76
|
+
const ownerId = yield* Effect.withFiber((self) =>
|
|
77
|
+
Effect.succeed(self.id),
|
|
78
|
+
)
|
|
79
|
+
const worker = yield* Effect.forkIn(
|
|
80
|
+
restore(Scope.provide(scope)(effect)),
|
|
81
|
+
scope,
|
|
82
|
+
)
|
|
83
|
+
const waiting = yield* Effect.exit(restore(Fiber.await(worker)))
|
|
84
|
+
if (Exit.isFailure(waiting)) yield* Fiber.interrupt(worker)
|
|
85
|
+
const body = yield* Fiber.await(worker)
|
|
86
|
+
const closed = yield* Effect.exit(Release.close(scope, body))
|
|
87
|
+
// Forwarding this exact cancellation from a finalizer is indistinguishable from acknowledging it.
|
|
88
|
+
const expected =
|
|
89
|
+
Exit.isFailure(waiting) &&
|
|
90
|
+
Exit.isFailure(body) &&
|
|
91
|
+
Array.every(
|
|
92
|
+
body.cause.reasons,
|
|
93
|
+
(reason) =>
|
|
94
|
+
reason._tag === "Interrupt" && reason.fiberId === ownerId,
|
|
78
95
|
)
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
96
|
+
const bodyCause =
|
|
97
|
+
Exit.isFailure(body) && !expected ? body.cause : Cause.empty
|
|
98
|
+
// Release.close marks independent interruptions; an unmarked one is pending cancellation.
|
|
99
|
+
const releaseCause =
|
|
100
|
+
Exit.isFailure(closed) && !Cause.hasInterruptsOnly(closed.cause)
|
|
101
|
+
? closed.cause
|
|
102
|
+
: Cause.empty
|
|
103
|
+
const failure = Cause.combine(bodyCause, releaseCause)
|
|
104
|
+
// Body cleanup may carry either an interruption or a release defect from an inner group.
|
|
105
|
+
const closing = Cause.combine(
|
|
106
|
+
Cause.hasInterrupts(bodyCause) ||
|
|
107
|
+
Array.some(
|
|
108
|
+
bodyCause.reasons,
|
|
89
109
|
(reason) =>
|
|
90
|
-
reason._tag === "
|
|
110
|
+
reason._tag === "Die" &&
|
|
111
|
+
Schema.is(Release.ReleaseInterrupted)(reason.defect),
|
|
91
112
|
)
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
Schema.is(Release.ReleaseInterrupted)(reason.defect),
|
|
108
|
-
)
|
|
109
|
-
? bodyCause
|
|
110
|
-
: Cause.empty,
|
|
111
|
-
releaseCause,
|
|
113
|
+
? bodyCause
|
|
114
|
+
: Cause.empty,
|
|
115
|
+
releaseCause,
|
|
116
|
+
)
|
|
117
|
+
yield* Ref.update(cleanup, (cause) => Cause.combine(cause, closing))
|
|
118
|
+
if (failure.reasons.length > 0) {
|
|
119
|
+
yield* Ref.update(failures, (cause) => Cause.combine(cause, failure))
|
|
120
|
+
yield* publish(failure)
|
|
121
|
+
yield* Deferred.failCause(fibers.deferred, failure)
|
|
122
|
+
}
|
|
123
|
+
if (Exit.isFailure(closed))
|
|
124
|
+
return yield* Effect.failCause(
|
|
125
|
+
Exit.isFailure(body)
|
|
126
|
+
? Cause.combine(body.cause, closed.cause)
|
|
127
|
+
: closed.cause,
|
|
112
128
|
)
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
)
|
|
118
|
-
yield* publish(failure)
|
|
119
|
-
yield* Deferred.failCause(fibers.deferred, failure)
|
|
120
|
-
}
|
|
121
|
-
if (Exit.isFailure(closed))
|
|
122
|
-
return yield* Effect.failCause(
|
|
123
|
-
Exit.isFailure(body)
|
|
124
|
-
? Cause.combine(body.cause, closed.cause)
|
|
125
|
-
: closed.cause,
|
|
126
|
-
)
|
|
127
|
-
if (Exit.isFailure(waiting) && Exit.isSuccess(body))
|
|
128
|
-
return yield* Effect.failCause(waiting.cause)
|
|
129
|
-
return yield* body
|
|
130
|
-
}),
|
|
131
|
-
)
|
|
132
|
-
yield* FiberSet.join(fibers).pipe(
|
|
133
|
-
Effect.catchCause((cause) =>
|
|
134
|
-
publish(cause).pipe(
|
|
135
|
-
Effect.andThen(FiberSet.clear(fibers)),
|
|
136
|
-
Effect.uninterruptible,
|
|
137
|
-
),
|
|
138
|
-
),
|
|
139
|
-
Effect.forkScoped,
|
|
129
|
+
if (Exit.isFailure(waiting) && Exit.isSuccess(body))
|
|
130
|
+
return yield* Effect.failCause(waiting.cause)
|
|
131
|
+
return yield* body
|
|
132
|
+
}),
|
|
140
133
|
)
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
s._tag === "Open" ? State.Closed() : s,
|
|
147
|
-
).pipe(
|
|
148
|
-
Effect.andThen(FiberSet.clear(fibers)),
|
|
149
|
-
Effect.andThen(Ref.get(cleanup)),
|
|
150
|
-
Effect.flatMap((cause) =>
|
|
151
|
-
cause.reasons.length > 0 ? Effect.failCause(cause) : Effect.void,
|
|
134
|
+
yield* FiberSet.join(fibers).pipe(
|
|
135
|
+
Effect.catchCause((cause) =>
|
|
136
|
+
publish(cause).pipe(
|
|
137
|
+
Effect.andThen(FiberSet.clear(fibers)),
|
|
138
|
+
Effect.uninterruptible,
|
|
152
139
|
),
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
140
|
+
),
|
|
141
|
+
Effect.forkScoped,
|
|
142
|
+
)
|
|
143
|
+
const failure = Effect.tx(check.pipe(Effect.andThen(Effect.txRetry)))
|
|
144
|
+
const failCause = (cause: Cause.Cause<E>) =>
|
|
145
|
+
// This is an explicit failure report, not cancellation of an owned worker.
|
|
146
|
+
FiberSet.run(fibers, observe(Effect.failCause(cause))).pipe(Effect.asVoid)
|
|
147
|
+
const close = TxRef.update(state, (s) =>
|
|
148
|
+
s._tag === "Open" ? State.Closed() : s,
|
|
149
|
+
).pipe(
|
|
150
|
+
Effect.andThen(FiberSet.clear(fibers)),
|
|
151
|
+
Effect.andThen(Ref.get(cleanup)),
|
|
152
|
+
Effect.flatMap((cause) =>
|
|
153
|
+
cause.reasons.length > 0 ? Effect.failCause(cause) : Effect.void,
|
|
154
|
+
),
|
|
155
|
+
Effect.uninterruptible,
|
|
156
|
+
)
|
|
157
|
+
// Operational failure is delivered by await; release must also deliver sibling cleanup failures.
|
|
158
|
+
// Every sibling failure and interruption survives as a defect; orDie would keep only the first failure.
|
|
159
|
+
yield* Effect.addFinalizer(() =>
|
|
160
|
+
close.pipe(
|
|
161
|
+
Effect.catchCause((cause) => Effect.failCause(cleanupCause(cause))),
|
|
162
|
+
),
|
|
163
|
+
)
|
|
164
|
+
return {
|
|
165
|
+
await: failure,
|
|
166
|
+
check,
|
|
167
|
+
cause: Ref.get(failures),
|
|
168
|
+
runtime: <R>() =>
|
|
169
|
+
FiberSet.runtime(fibers)<R>().pipe(
|
|
170
|
+
Effect.map(
|
|
171
|
+
(run) => (effect: Effect.Effect<unknown, E, R>) =>
|
|
172
|
+
run(check.pipe(Effect.andThen(observe(effect)))),
|
|
167
173
|
),
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
}
|
|
174
|
+
),
|
|
175
|
+
run: (effect) =>
|
|
176
|
+
FiberSet.run(fibers, check.pipe(Effect.andThen(observe(effect)))),
|
|
177
|
+
fail: (error) => failCause(Cause.fail(error)),
|
|
178
|
+
failCause,
|
|
179
|
+
race: (effect) =>
|
|
180
|
+
check.pipe(Effect.andThen(Effect.raceFirst(effect, failure))),
|
|
181
|
+
close,
|
|
182
|
+
}
|
|
183
|
+
})
|
package/src/internal/assembly.ts
CHANGED
|
@@ -63,6 +63,14 @@ export class CapabilityFailed extends Schema.TaggedError<
|
|
|
63
63
|
cause: Schema.Cause(Schema.Unknown, Schema.Unknown),
|
|
64
64
|
}) {}
|
|
65
65
|
|
|
66
|
+
/** Every failure class assembly raises; host error classification reads this list. */
|
|
67
|
+
export const errors = [
|
|
68
|
+
ListenerConfigError,
|
|
69
|
+
CapabilityContractError,
|
|
70
|
+
CapabilityCombinationError,
|
|
71
|
+
CapabilityFailed,
|
|
72
|
+
] as const
|
|
73
|
+
|
|
66
74
|
const definition = Schema.declare(Plugin.isPlugin)
|
|
67
75
|
/** Entries resolve capability modules before assembling their private providers. */
|
|
68
76
|
export const Invocation = Schema.Struct({
|
|
@@ -235,16 +243,17 @@ export const directAuth = (properties: Properties, explicit: boolean) =>
|
|
|
235
243
|
)
|
|
236
244
|
: Effect.void
|
|
237
245
|
|
|
238
|
-
export const connectWith = (
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
246
|
+
export const connectWith = Effect.fnUntraced(function* (
|
|
247
|
+
explicitAuth: boolean = false,
|
|
248
|
+
) {
|
|
249
|
+
const connector = yield* Connector
|
|
250
|
+
const credentials = yield* Credentials
|
|
251
|
+
yield* directAuth(connector.properties, explicitAuth)
|
|
252
|
+
yield* compatible(connector.properties, credentials.kind)
|
|
253
|
+
yield* warn(connector.properties, credentials.kind, "host")
|
|
254
|
+
const prepared = yield* credentials.read
|
|
255
|
+
return yield* connector.connect(prepared)
|
|
256
|
+
})
|
|
248
257
|
|
|
249
258
|
export const accept =
|
|
250
259
|
(
|
|
@@ -17,24 +17,23 @@ const uriValue = (field: string) => {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
/** Read exactly one graft URI from Node's plain or JSON-quoted SAN representation. */
|
|
20
|
-
export const identityFromSubjectAltName = (
|
|
20
|
+
export const identityFromSubjectAltName = Effect.fnUntraced(function* (
|
|
21
21
|
san: string | undefined,
|
|
22
|
-
): Effect.
|
|
23
|
-
Effect.
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
})
|
|
22
|
+
): Effect.fn.Return<string, AuthenticationFailed> {
|
|
23
|
+
const values = yield* Effect.forEach(
|
|
24
|
+
Array.filter(String.split(san ?? "", ", "), String.startsWith("URI:")),
|
|
25
|
+
uriValue,
|
|
26
|
+
)
|
|
27
|
+
const uris = Array.filter(values, String.startsWith("graft://"))
|
|
28
|
+
const [uri] = uris
|
|
29
|
+
return yield* uris.length === 1 && uri !== undefined
|
|
30
|
+
? Effect.succeed(uri)
|
|
31
|
+
: Effect.fail(
|
|
32
|
+
AuthenticationFailed.make({
|
|
33
|
+
reason: "invalid",
|
|
34
|
+
cause: Cause.fail(
|
|
35
|
+
"The peer certificate must contain exactly one graft SAN URI",
|
|
36
|
+
),
|
|
37
|
+
}),
|
|
38
|
+
)
|
|
39
|
+
})
|
|
@@ -19,13 +19,7 @@ export const Config = Schema.Struct({
|
|
|
19
19
|
Schema.Struct({ file: Schema.String }),
|
|
20
20
|
]),
|
|
21
21
|
})
|
|
22
|
-
export const plugin = (
|
|
23
|
-
name: string,
|
|
24
|
-
): Plugin.Plugin<
|
|
25
|
-
typeof Config.Type,
|
|
26
|
-
typeof Config.Encoded,
|
|
27
|
-
Graft.ServiceConflict
|
|
28
|
-
> =>
|
|
22
|
+
export const plugin = (name: string) =>
|
|
29
23
|
Plugin.make({
|
|
30
24
|
name,
|
|
31
25
|
config: Config,
|