@moltzap/client 2026.519.0 → 2026.519.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/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/notification/__tests__/filter-equivalence.test.d.ts +2 -0
- package/dist/notification/__tests__/filter-equivalence.test.d.ts.map +1 -0
- package/dist/notification/__tests__/filter-equivalence.test.js +123 -0
- package/dist/notification/__tests__/filter-equivalence.test.js.map +1 -0
- package/dist/notification/__tests__/snapshot-semantics.test.d.ts +2 -0
- package/dist/notification/__tests__/snapshot-semantics.test.d.ts.map +1 -0
- package/dist/notification/__tests__/snapshot-semantics.test.js +261 -0
- package/dist/notification/__tests__/snapshot-semantics.test.js.map +1 -0
- package/dist/notification/__tests__/snapshot-semantics.types-check.d.ts +3 -0
- package/dist/notification/__tests__/snapshot-semantics.types-check.d.ts.map +1 -0
- package/dist/notification/__tests__/snapshot-semantics.types-check.js +62 -0
- package/dist/notification/__tests__/snapshot-semantics.types-check.js.map +1 -0
- package/dist/notification/errors.d.ts +27 -0
- package/dist/notification/errors.d.ts.map +1 -0
- package/dist/notification/errors.js +24 -0
- package/dist/notification/errors.js.map +1 -0
- package/dist/notification/stream.d.ts +84 -0
- package/dist/notification/stream.d.ts.map +1 -0
- package/dist/notification/stream.js +106 -0
- package/dist/notification/stream.js.map +1 -0
- package/dist/runtime/errors.d.ts +0 -13
- package/dist/runtime/errors.d.ts.map +1 -1
- package/dist/runtime/errors.js +0 -10
- package/dist/runtime/errors.js.map +1 -1
- package/dist/runtime/index.d.ts +3 -4
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +3 -3
- package/dist/runtime/service-teardown.d.ts +5 -0
- package/dist/runtime/service-teardown.d.ts.map +1 -0
- package/dist/runtime/service-teardown.js +36 -0
- package/dist/runtime/service-teardown.js.map +1 -0
- package/dist/runtime/service-teardown.test.d.ts +2 -0
- package/dist/runtime/service-teardown.test.d.ts.map +1 -0
- package/dist/runtime/service-teardown.test.js +80 -0
- package/dist/runtime/service-teardown.test.js.map +1 -0
- package/dist/runtime/subscribers.d.ts +74 -136
- package/dist/runtime/subscribers.d.ts.map +1 -1
- package/dist/runtime/subscribers.js +187 -93
- package/dist/runtime/subscribers.js.map +1 -1
- package/dist/service.d.ts +10 -0
- package/dist/service.d.ts.map +1 -1
- package/dist/service.js +45 -12
- package/dist/service.js.map +1 -1
- package/dist/test-utils/conformance-adapter.d.ts +6 -16
- package/dist/test-utils/conformance-adapter.d.ts.map +1 -1
- package/dist/test-utils/conformance-adapter.js +100 -59
- package/dist/test-utils/conformance-adapter.js.map +1 -1
- package/dist/ws-client-test-support.d.ts +13 -10
- package/dist/ws-client-test-support.d.ts.map +1 -1
- package/dist/ws-client-test-support.js +44 -11
- package/dist/ws-client-test-support.js.map +1 -1
- package/dist/ws-client.d.ts +91 -104
- package/dist/ws-client.d.ts.map +1 -1
- package/dist/ws-client.js +78 -244
- package/dist/ws-client.js.map +1 -1
- package/dist/ws-client.test.js +33 -36
- package/dist/ws-client.test.js.map +1 -1
- package/package.json +3 -3
- package/dist/runtime/subscribers.test.d.ts +0 -2
- package/dist/runtime/subscribers.test.d.ts.map +0 -1
- package/dist/runtime/subscribers.test.js +0 -193
- package/dist/runtime/subscribers.test.js.map +0 -1
|
@@ -1,166 +1,104 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Per-subscription notification registry for `MoltZapWsClient`.
|
|
3
3
|
*
|
|
4
|
-
* Responsibility: own the list of live
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* `SubscriptionId`) re-export from the package barrel.
|
|
4
|
+
* Responsibility: own the list of live subscriptions and fan each inbound
|
|
5
|
+
* JSON-RPC notification out to every subscription whose definition (and
|
|
6
|
+
* optional typed refinement predicate) matches. Implements spec #596
|
|
7
|
+
* (notification consumption consolidation) via the AD1 path-(a) Stream.async
|
|
8
|
+
* design (architect plan §3, §5.5).
|
|
10
9
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
10
|
+
* Storage shape (post-Spec B):
|
|
11
|
+
* - Subscriptions are records of typed `{onFrame, onClose}` callbacks
|
|
12
|
+
* (NOT queues / Take items / Stream.fromQueue). `notification/stream.ts`
|
|
13
|
+
* owns Stream construction via `Stream.async`; this module owns the
|
|
14
|
+
* register/dispatch/closeAll lifecycle.
|
|
15
|
+
* - The dispatch path snapshots `subsRef` at iteration start (AD1
|
|
16
|
+
* snapshot-semantic contract from spec #222 §5.3 OQ-3 / spec #596
|
|
17
|
+
* "Stream lifecycle contract" row).
|
|
18
|
+
* - `closeAll` invokes each live sub's `onClose(new NotConnectedError(...))`
|
|
19
|
+
* before clearing `subsRef` — deterministic typed-failure delivery
|
|
20
|
+
* replaces the deleted `failAllNotificationWaiters` semantic.
|
|
19
21
|
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* `closeAll` are `Effect<T, never>`.
|
|
22
|
+
* Filter grammar (post-Spec B):
|
|
23
|
+
* - Subscription matches a frame iff `sub.definition === frame.definition`.
|
|
24
|
+
* - Optional `refinement` is a typed predicate over the frame's params
|
|
25
|
+
* (erased to the union type `ErasedNotificationRefinement` at the
|
|
26
|
+
* storage boundary; consumers receive the typed-narrowed shape via
|
|
27
|
+
* `Stream.async`'s typed `emit.single` callback inside
|
|
28
|
+
* `notification/stream.ts`).
|
|
29
|
+
* - The three-field `SubscriptionFilter` grammar is deleted (spec #596
|
|
30
|
+
* Goal #3 + §"Acceptance criteria" delete sweep). Multi-definition
|
|
31
|
+
* fan-out becomes `Stream.mergeAll([subscribe(d1), subscribe(d2)])`.
|
|
31
32
|
*/
|
|
32
33
|
import { Brand, Effect } from "effect";
|
|
33
|
-
import type
|
|
34
|
-
interface FilterableNotificationFrame {
|
|
35
|
-
readonly method: string;
|
|
36
|
-
readonly params?: unknown;
|
|
37
|
-
}
|
|
34
|
+
import { NotConnectedError, type AnyNotificationDefinition, type DecodedNotification, type NotificationParamsOf } from "@moltzap/protocol";
|
|
38
35
|
/** Branded identifier for a subscription handle. Minted by `register`. */
|
|
39
|
-
|
|
36
|
+
type SubscriptionId = string & Brand.Brand<"SubscriptionId">;
|
|
40
37
|
/**
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
* OQ-2 resolution (A): exactly these three fields, no free-form
|
|
46
|
-
* predicate, no schema-derived matcher. Matches the existing
|
|
47
|
-
* `RealClientEventFilter` contract at
|
|
48
|
-
* `packages/protocol/src/testing/conformance/client/runner.ts:104-116`
|
|
49
|
-
* one-for-one.
|
|
50
|
-
*
|
|
51
|
-
* - `emissionTag` — exact match against the canonical payload key
|
|
52
|
-
* `frame.params.__emissionTag`. (The adapter reads the same key at
|
|
53
|
-
* `packages/client/src/test-utils/conformance-adapter.ts:77-79`;
|
|
54
|
-
* `emitTaggedEventDefault` writes it at `runner.ts:343-357`. The
|
|
55
|
-
* `__emissionId` string in the `runner.ts:108` doc comment is a
|
|
56
|
-
* known doc-bug — architect files a follow-up issue against
|
|
57
|
-
* protocol to correct the comment; it is not the canonical name.)
|
|
58
|
-
* - `conversationId` — exact match against `frame.params.conversationId`
|
|
59
|
-
* when set on the notification payload.
|
|
60
|
-
* - `notificationNamePrefix` — `frame.method.startsWith(prefix)`.
|
|
38
|
+
* Per-subscription callback delivered each matching frame. Implemented in
|
|
39
|
+
* `notification/stream.ts` as `(frame) => Effect.sync(() => emit.single(frame))`.
|
|
40
|
+
* Returning `Effect<void, never>` keeps the dispatch path total — the
|
|
41
|
+
* Stream-side `emit.single` cannot fail synchronously.
|
|
61
42
|
*/
|
|
62
|
-
|
|
63
|
-
readonly emissionTag?: string;
|
|
64
|
-
readonly conversationId?: string;
|
|
65
|
-
readonly notificationNamePrefix?: string;
|
|
66
|
-
}
|
|
43
|
+
type SubscriberFrameCallback = (frame: DecodedNotification<AnyNotificationDefinition>) => Effect.Effect<void, never>;
|
|
67
44
|
/**
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
* `
|
|
71
|
-
*
|
|
72
|
-
* `unsubscribe` is `Effect<void, never>`: it is idempotent and total.
|
|
73
|
-
* Calling `unsubscribe` a second time, or after `closeAll`, is a no-op.
|
|
45
|
+
* Per-subscription callback invoked exactly once when the client transitions
|
|
46
|
+
* to its terminal closed state. Implemented in `notification/stream.ts` as
|
|
47
|
+
* `(cause) => Effect.sync(() => emit.fail(cause))`.
|
|
74
48
|
*/
|
|
75
|
-
|
|
76
|
-
readonly id: SubscriptionId;
|
|
77
|
-
readonly unsubscribe: Effect.Effect<void, never>;
|
|
78
|
-
}
|
|
49
|
+
type SubscriberCloseCallback = (cause: NotConnectedError) => Effect.Effect<void, never>;
|
|
79
50
|
/**
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
* The frame is a known-descriptor `DecodedNotification` (post-S9
|
|
85
|
-
* fail-close: malformed / unknown-method frames are rejected before
|
|
86
|
-
* dispatch). Handlers receive validated `params` typed as
|
|
87
|
-
* `NotificationParamsOf<D>` for the matching definition.
|
|
88
|
-
*
|
|
89
|
-
* Returning an `Effect` (not a plain `void`) lets handlers compose with
|
|
90
|
-
* Effect-native downstream code without an extra runSync shim. The
|
|
91
|
-
* registry awaits each handler's effect before moving to the next
|
|
92
|
-
* subscription for this frame — fairness over throughput, so a slow
|
|
93
|
-
* handler on subscription A does not reorder frames seen by
|
|
94
|
-
* subscription B across frames.
|
|
51
|
+
* Handle returned by `register`. `unregister` is `Effect<void, never>`: it
|
|
52
|
+
* is idempotent and total. Calling `unregister` a second time, or after
|
|
53
|
+
* `closeAll`, is a no-op.
|
|
95
54
|
*/
|
|
96
|
-
|
|
55
|
+
interface SubscriptionHandle {
|
|
56
|
+
readonly id: SubscriptionId;
|
|
57
|
+
readonly unregister: Effect.Effect<void, never>;
|
|
58
|
+
}
|
|
97
59
|
/**
|
|
98
60
|
* Subscriber registry. One instance per `MoltZapWsClient`, created at
|
|
99
|
-
* construction time and owned by the client.
|
|
100
|
-
*
|
|
101
|
-
* `
|
|
61
|
+
* construction time and owned by the client.
|
|
62
|
+
*
|
|
63
|
+
* `register<D>` accepts typed `onFrame` / `onClose` callbacks for the
|
|
64
|
+
* specific definition `D`; internally the registry erases them to the
|
|
65
|
+
* `Subscriber{Frame,Close}Callback` union shape so a single iteration
|
|
66
|
+
* can dispatch over heterogeneous subscriptions without per-`D`
|
|
67
|
+
* dispatch tables.
|
|
102
68
|
*/
|
|
103
69
|
export interface SubscriberRegistry {
|
|
70
|
+
readonly register: <D extends AnyNotificationDefinition>(definition: D, refinement: ((params: NotificationParamsOf<D>) => boolean) | undefined, callbacks: {
|
|
71
|
+
readonly onFrame: (frame: DecodedNotification<D>) => Effect.Effect<void, never>;
|
|
72
|
+
readonly onClose: SubscriberCloseCallback;
|
|
73
|
+
}) => Effect.Effect<SubscriptionHandle, never>;
|
|
104
74
|
/**
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
75
|
+
* `subscribeAll` surface (spec #596 Goal #2). Registers a broad-union
|
|
76
|
+
* subscription that fires for every inbound frame regardless of
|
|
77
|
+
* definition. The optional `refinement` predicate runs against the
|
|
78
|
+
* full `DecodedNotification<AnyNotificationDefinition>` shape.
|
|
79
|
+
*
|
|
80
|
+
* Stored in a sibling `subsAllRef` list — kept off `subsRef` so the
|
|
81
|
+
* per-definition dispatch loop in `dispatch` stays a simple
|
|
82
|
+
* `definition ===` check without a per-sub broad-union escape branch.
|
|
110
83
|
*/
|
|
111
|
-
readonly
|
|
84
|
+
readonly registerAll: (refinement: ((notification: DecodedNotification<AnyNotificationDefinition>) => boolean) | undefined, callbacks: {
|
|
85
|
+
readonly onFrame: SubscriberFrameCallback;
|
|
86
|
+
readonly onClose: SubscriberCloseCallback;
|
|
87
|
+
}) => Effect.Effect<SubscriptionHandle, never>;
|
|
112
88
|
/**
|
|
113
|
-
* Fan an inbound notification out to every matching subscription. Called
|
|
114
|
-
* `MoltZapWsClient.
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
* unsubscribe-during-dispatch observes next-frame semantics (OQ-3 A).
|
|
118
|
-
*
|
|
119
|
-
* Frames are pre-validation (`DecodedNotification<AnyNotificationDefinition>` union) — the
|
|
120
|
-
* type-system contract that subscribers see RAW frames, not the lifted
|
|
121
|
-
* `DecodedNotification<D>` shape that typed handlers see.
|
|
122
|
-
*
|
|
123
|
-
* Dispatch order: registration order, iterated sequentially; slow
|
|
124
|
-
* handlers block later subscriptions for this frame but never
|
|
125
|
-
* reorder frame N relative to frame N+1.
|
|
89
|
+
* Fan an inbound notification out to every matching subscription. Called
|
|
90
|
+
* from `MoltZapWsClient.handleDecodedNotification`. Snapshot semantic:
|
|
91
|
+
* unsubscribes that commit mid-dispatch observe NEXT-frame semantics
|
|
92
|
+
* (AD1 path-(a) contract).
|
|
126
93
|
*/
|
|
127
94
|
readonly dispatch: (frame: DecodedNotification<AnyNotificationDefinition>) => Effect.Effect<void, never>;
|
|
128
95
|
/**
|
|
129
|
-
*
|
|
130
|
-
*
|
|
96
|
+
* Terminal close. Invokes every live sub's `onClose` callback (which
|
|
97
|
+
* `emit.fail(cause)`s the corresponding consumer Stream), then clears
|
|
98
|
+
* both `subsRef` and `subsAllRef`. Idempotent.
|
|
131
99
|
*/
|
|
132
100
|
readonly closeAll: Effect.Effect<void, never>;
|
|
133
101
|
}
|
|
134
|
-
/**
|
|
135
|
-
* Construct an empty registry. Called once from the `MoltZapWsClient`
|
|
136
|
-
* constructor.
|
|
137
|
-
*
|
|
138
|
-
* Implementation notes:
|
|
139
|
-
* - Live subscriptions are stored in a `Ref<ReadonlyArray<…>>` keyed
|
|
140
|
-
* by registration order. Append-on-register, filter-on-unsubscribe
|
|
141
|
-
* keeps the dispatch path O(N) with N = live subscription count.
|
|
142
|
-
* Bigger structures aren't justified at the expected sub count
|
|
143
|
-
* (≤ ~10 per fixture).
|
|
144
|
-
* - `dispatch` snapshots the array at start (OQ-3 A). An
|
|
145
|
-
* `unsubscribe` mid-dispatch mutates the Ref but the in-flight
|
|
146
|
-
* iteration walks the snapshot.
|
|
147
|
-
* - Handler exceptions are caught with `Effect.catchAllDefect` after
|
|
148
|
-
* the handler Effect. Sync `throw` from a `(frame) => …` body
|
|
149
|
-
* surfaces as a defect; we log + swallow to match the pre-deletion
|
|
150
|
-
* `onNotification` contract.
|
|
151
|
-
*/
|
|
152
102
|
export declare function makeSubscriberRegistry(): Effect.Effect<SubscriberRegistry, never>;
|
|
153
|
-
/**
|
|
154
|
-
* Pure filter-match predicate. Exposed for unit testing so executable
|
|
155
|
-
* client-side divergence proofs can force known-bad subscription
|
|
156
|
-
* behavior without bypassing the production dispatch path.
|
|
157
|
-
*
|
|
158
|
-
* Returns `true` iff `frame` matches every set field on `filter`:
|
|
159
|
-
* - `filter.emissionTag === frame.params.__emissionTag` (strict ===)
|
|
160
|
-
* - `filter.conversationId === frame.params.conversationId` (strict ===)
|
|
161
|
-
* - `frame.method.startsWith(filter.notificationNamePrefix)`
|
|
162
|
-
* Unset filter fields are wildcards.
|
|
163
|
-
*/
|
|
164
|
-
export declare function matchesFilter(filter: SubscriptionFilter, frame: FilterableNotificationFrame): boolean;
|
|
165
103
|
export {};
|
|
166
104
|
//# sourceMappingURL=subscribers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscribers.d.ts","sourceRoot":"","sources":["../../src/runtime/subscribers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"subscribers.d.ts","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AAE,uBAAuB,CAAC;KAC3C,KACE,MAAM,CAAC,MAAM,CAAC,kBAAkB,EAAE,KAAK,CAAC,CAAC;IAE9C;;;;;;;;;OASG;IACH,QAAQ,CAAC,WAAW,EAAE,CACpB,UAAU,EACN,CAAC,CACC,YAAY,EAAE,mBAAmB,CAAC,yBAAyB,CAAC,KACzD,OAAO,CAAC,GACb,SAAS,EACb,SAAS,EAAE;QACT,QAAQ,CAAC,OAAO,EAAE,uBAAuB,CAAC;QAC1C,QAAQ,CAAC,OAAO,EAAE,uBAAuB,CAAC;KAC3C,KACE,MAAM,CAAC,MAAM,CAAC,kBAAkB,EAAE,KAAK,CAAC,CAAC;IAE9C;;;;;OAKG;IACH,QAAQ,CAAC,QAAQ,EAAE,CACjB,KAAK,EAAE,mBAAmB,CAAC,yBAAyB,CAAC,KAClD,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAEhC;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;CAC/C;AA8RD,wBAAgB,sBAAsB,IAAI,MAAM,CAAC,MAAM,CACrD,kBAAkB,EAClB,KAAK,CACN,CAcA"}
|
|
@@ -1,35 +1,38 @@
|
|
|
1
|
+
/* eslint-disable jsdoc/text-escaping -- JSDoc references to generic types like `NotificationParamsOf<D>` use the natural angle-bracket form (TS source style) inside backtick-fenced code spans; the lint rule's pre-render check fires false positives on these multi-line spans. Matches the precedent in filter-equivalence.test.ts. */
|
|
1
2
|
/**
|
|
2
3
|
* Per-subscription notification registry for `MoltZapWsClient`.
|
|
3
4
|
*
|
|
4
|
-
* Responsibility: own the list of live
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* `SubscriptionId`) re-export from the package barrel.
|
|
5
|
+
* Responsibility: own the list of live subscriptions and fan each inbound
|
|
6
|
+
* JSON-RPC notification out to every subscription whose definition (and
|
|
7
|
+
* optional typed refinement predicate) matches. Implements spec #596
|
|
8
|
+
* (notification consumption consolidation) via the AD1 path-(a) Stream.async
|
|
9
|
+
* design (architect plan §3, §5.5).
|
|
10
10
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
11
|
+
* Storage shape (post-Spec B):
|
|
12
|
+
* - Subscriptions are records of typed `{onFrame, onClose}` callbacks
|
|
13
|
+
* (NOT queues / Take items / Stream.fromQueue). `notification/stream.ts`
|
|
14
|
+
* owns Stream construction via `Stream.async`; this module owns the
|
|
15
|
+
* register/dispatch/closeAll lifecycle.
|
|
16
|
+
* - The dispatch path snapshots `subsRef` at iteration start (AD1
|
|
17
|
+
* snapshot-semantic contract from spec #222 §5.3 OQ-3 / spec #596
|
|
18
|
+
* "Stream lifecycle contract" row).
|
|
19
|
+
* - `closeAll` invokes each live sub's `onClose(new NotConnectedError(...))`
|
|
20
|
+
* before clearing `subsRef` — deterministic typed-failure delivery
|
|
21
|
+
* replaces the deleted `failAllNotificationWaiters` semantic.
|
|
19
22
|
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* `closeAll` are `Effect<T, never>`.
|
|
23
|
+
* Filter grammar (post-Spec B):
|
|
24
|
+
* - Subscription matches a frame iff `sub.definition === frame.definition`.
|
|
25
|
+
* - Optional `refinement` is a typed predicate over the frame's params
|
|
26
|
+
* (erased to the union type `ErasedNotificationRefinement` at the
|
|
27
|
+
* storage boundary; consumers receive the typed-narrowed shape via
|
|
28
|
+
* `Stream.async`'s typed `emit.single` callback inside
|
|
29
|
+
* `notification/stream.ts`).
|
|
30
|
+
* - The three-field `SubscriptionFilter` grammar is deleted (spec #596
|
|
31
|
+
* Goal #3 + §"Acceptance criteria" delete sweep). Multi-definition
|
|
32
|
+
* fan-out becomes `Stream.mergeAll([subscribe(d1), subscribe(d2)])`.
|
|
31
33
|
*/
|
|
32
34
|
import { Brand, Effect, Ref } from "effect";
|
|
35
|
+
import { NotConnectedError, } from "@moltzap/protocol";
|
|
33
36
|
const SubscriptionIdBrand = Brand.nominal();
|
|
34
37
|
function nextSubscriptionId(counterRef) {
|
|
35
38
|
return Ref.updateAndGet(counterRef, (count) => count + 1).pipe(Effect.map((count) => SubscriptionIdBrand(`sub-${count}`)));
|
|
@@ -41,88 +44,179 @@ function removeSubscription(subsRef, id) {
|
|
|
41
44
|
return Ref.update(subsRef, (subscriptions) => subscriptions.filter((subscription) => subscription.id !== id));
|
|
42
45
|
}
|
|
43
46
|
function dispatchToSubscriber(sub, frame) {
|
|
44
|
-
return Effect.suspend(() => sub.
|
|
47
|
+
return Effect.suspend(() => sub.onFrame(frame)).pipe(Effect.catchAllDefect((err) => Effect.logWarning("subscriber onFrame callback threw", err)));
|
|
45
48
|
}
|
|
46
|
-
function
|
|
47
|
-
return
|
|
49
|
+
function closeSubscriber(sub, cause) {
|
|
50
|
+
return Effect.suspend(() => sub.onClose(cause)).pipe(Effect.catchAllDefect((err) => Effect.logWarning("subscriber onClose callback threw", err)));
|
|
48
51
|
}
|
|
49
52
|
/**
|
|
50
53
|
* Construct an empty registry. Called once from the `MoltZapWsClient`
|
|
51
54
|
* constructor.
|
|
52
55
|
*
|
|
53
56
|
* Implementation notes:
|
|
54
|
-
* -
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
* surfaces as a defect; we log + swallow to match the pre-deletion
|
|
65
|
-
* `onNotification` contract.
|
|
57
|
+
* - `subsRef: Ref<ReadonlyArray<LiveSubscription>>` keyed by registration
|
|
58
|
+
* order. Append-on-register, filter-on-unregister keeps the dispatch
|
|
59
|
+
* path O(N) with N = live subscription count.
|
|
60
|
+
* - `dispatch` snapshots `subsRef` at iteration start. An unregister
|
|
61
|
+
* mid-dispatch mutates the Ref but the in-flight iteration walks the
|
|
62
|
+
* snapshot (AD1 path-(a) snapshot semantic).
|
|
63
|
+
* - `closeAll` invokes each live sub's `onClose` in iteration order
|
|
64
|
+
* before clearing the ref. `Stream.async`'s `emit.fail` is the
|
|
65
|
+
* deterministic in-Effect mechanism that propagates the typed
|
|
66
|
+
* failure to each consumer.
|
|
66
67
|
*/
|
|
67
|
-
|
|
68
|
-
return
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
68
|
+
function appendBroadSubscription(subsAllRef, live) {
|
|
69
|
+
return Ref.update(subsAllRef, (subscriptions) => [...subscriptions, live]);
|
|
70
|
+
}
|
|
71
|
+
function removeBroadSubscription(subsAllRef, id) {
|
|
72
|
+
return Ref.update(subsAllRef, (subscriptions) => subscriptions.filter((subscription) => subscription.id !== id));
|
|
73
|
+
}
|
|
74
|
+
function dispatchToBroadSubscriber(sub, frame) {
|
|
75
|
+
return Effect.suspend(() => sub.onFrame(frame)).pipe(Effect.catchAllDefect((err) => Effect.logWarning("subscribeAll onFrame callback threw", err)));
|
|
76
|
+
}
|
|
77
|
+
function closeBroadSubscriber(sub, cause) {
|
|
78
|
+
return Effect.suspend(() => sub.onClose(cause)).pipe(Effect.catchAllDefect((err) => Effect.logWarning("subscribeAll onClose callback threw", err)));
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Single named typed→erased adapter for the refinement predicate. The
|
|
82
|
+
* `Stream.async` callback inside `notification/stream.ts` keeps the typed
|
|
83
|
+
* shape for the consumer's typed payload; storage in `LiveSubscription`
|
|
84
|
+
* uses the broad-union erased form. This is the only place the typed →
|
|
85
|
+
* erased boundary crosses, so the cast is acknowledged with an explicit
|
|
86
|
+
* lint suppression.
|
|
87
|
+
*/
|
|
88
|
+
function eraseRefinement(refinement) {
|
|
89
|
+
if (refinement === undefined)
|
|
90
|
+
return undefined;
|
|
91
|
+
// The typed→erased boundary is by construction safe: the registry's
|
|
92
|
+
// `dispatch` loop only invokes the refinement with frames whose
|
|
93
|
+
// `definition === sub.definition`, so `frame.params` always satisfies
|
|
94
|
+
// `NotificationParamsOf<D>`.
|
|
95
|
+
// eslint-disable-next-line agent-code-guard/as-unknown-as -- documented typed→erased boundary, see comment above
|
|
96
|
+
return refinement; // #ignore-sloppy-code[as-unknown-as]: typed→erased boundary for heterogeneous registry storage; dispatch loop enforces definition identity before invocation
|
|
97
|
+
}
|
|
98
|
+
function buildRegister(subsRef, counterRef) {
|
|
99
|
+
return (definition, refinement, callbacks) => Effect.gen(function* () {
|
|
100
|
+
const id = yield* nextSubscriptionId(counterRef);
|
|
101
|
+
const erasedRefinement = eraseRefinement(refinement);
|
|
102
|
+
const live = {
|
|
103
|
+
id,
|
|
104
|
+
definition,
|
|
105
|
+
...(erasedRefinement !== undefined
|
|
106
|
+
? { refinement: erasedRefinement }
|
|
107
|
+
: {}),
|
|
108
|
+
onFrame: callbacks.onFrame,
|
|
109
|
+
onClose: callbacks.onClose,
|
|
110
|
+
};
|
|
111
|
+
yield* appendSubscription(subsRef, live);
|
|
112
|
+
const unregister = removeSubscription(subsRef, id);
|
|
113
|
+
return { id, unregister };
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
function buildRegisterAll(subsAllRef, counterRef) {
|
|
117
|
+
return (refinement, callbacks) => Effect.gen(function* () {
|
|
118
|
+
const id = yield* nextSubscriptionId(counterRef);
|
|
119
|
+
const live = {
|
|
120
|
+
id,
|
|
121
|
+
...(refinement !== undefined ? { refinement } : {}),
|
|
122
|
+
onFrame: callbacks.onFrame,
|
|
123
|
+
onClose: callbacks.onClose,
|
|
124
|
+
};
|
|
125
|
+
yield* appendBroadSubscription(subsAllRef, live);
|
|
126
|
+
const unregister = removeBroadSubscription(subsAllRef, id);
|
|
127
|
+
return { id, unregister };
|
|
128
|
+
});
|
|
99
129
|
}
|
|
100
130
|
/**
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
131
|
+
* Run a user-supplied refinement predicate with throw isolation. A throw
|
|
132
|
+
* inside the predicate must NOT defect the dispatch Effect (which would
|
|
133
|
+
* starve sibling subscribers of the in-flight frame, AD1 path-(a) snapshot
|
|
134
|
+
* contract). Treat any throw as "predicate said false" — the frame is
|
|
135
|
+
* filtered out for this subscriber, the throw is logged, dispatch
|
|
136
|
+
* continues with the next subscription in the snapshot.
|
|
104
137
|
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
138
|
+
* The warning is emitted via `Effect.runFork(Effect.logWarning(…))`
|
|
139
|
+
* (detached from the dispatch fiber's span/annotations) so the
|
|
140
|
+
* synchronous filter returned by `subAcceptsFrame` / `broadAcceptsFrame`
|
|
141
|
+
* stays synchronous — pulling logging into the surrounding `Effect.gen`
|
|
142
|
+
* would either (a) require the predicate to become an Effect (forcing
|
|
143
|
+
* every caller to `yield*`) or (b) accumulate warnings in a Ref and
|
|
144
|
+
* re-emit post-dispatch (extra state for a non-load-bearing log). The
|
|
145
|
+
* detached log is acceptable for predicate misuse — a noisy warning
|
|
146
|
+
* that names the call site (`subscribe` vs `subscribeAll`) is sufficient
|
|
147
|
+
* signal for the application author to find the throw in their
|
|
148
|
+
* refinement. Codex r2 P3-1 documented this trade-off rather than
|
|
149
|
+
* restructuring.
|
|
150
|
+
*/
|
|
151
|
+
function safePredicate(predicate, params, context) {
|
|
152
|
+
try {
|
|
153
|
+
return predicate(params);
|
|
154
|
+
}
|
|
155
|
+
catch (err) {
|
|
156
|
+
Effect.runFork(Effect.logWarning(`${context} refinement predicate threw`, err));
|
|
157
|
+
return false;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Cognitive-complexity helper: decides whether a per-definition sub
|
|
162
|
+
* accepts a given frame. Predicate throws are caught (P2-1, codex r1):
|
|
163
|
+
* a throwing refinement returns `false` rather than defecting the
|
|
164
|
+
* dispatch Effect.
|
|
110
165
|
*/
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
166
|
+
function subAcceptsFrame(sub, frame) {
|
|
167
|
+
if (sub.definition !== frame.definition)
|
|
168
|
+
return false;
|
|
169
|
+
if (sub.refinement !== undefined &&
|
|
170
|
+
!safePredicate(sub.refinement, frame.params, "subscribe"))
|
|
115
171
|
return false;
|
|
116
|
-
|
|
117
|
-
? frame.params
|
|
118
|
-
: null;
|
|
119
|
-
return (matchesPayloadValue(params, "__emissionTag", filter.emissionTag) &&
|
|
120
|
-
matchesPayloadValue(params, "conversationId", filter.conversationId));
|
|
172
|
+
return true;
|
|
121
173
|
}
|
|
122
|
-
|
|
123
|
-
|
|
174
|
+
/** Same as `subAcceptsFrame`, but for broad-union subscriptions. */
|
|
175
|
+
function broadAcceptsFrame(sub, frame) {
|
|
176
|
+
return (sub.refinement === undefined ||
|
|
177
|
+
safePredicate(sub.refinement, frame, "subscribeAll"));
|
|
124
178
|
}
|
|
125
|
-
function
|
|
126
|
-
return
|
|
179
|
+
function buildDispatch(subsRef, subsAllRef) {
|
|
180
|
+
return (frame) => Effect.gen(function* () {
|
|
181
|
+
// Snapshot both lists at iteration start (AD1 path-(a) semantic).
|
|
182
|
+
const snapshot = yield* Ref.get(subsRef);
|
|
183
|
+
const broadSnapshot = yield* Ref.get(subsAllRef);
|
|
184
|
+
const matching = snapshot.filter((sub) => subAcceptsFrame(sub, frame));
|
|
185
|
+
for (const sub of matching) {
|
|
186
|
+
yield* dispatchToSubscriber(sub, frame);
|
|
187
|
+
}
|
|
188
|
+
const matchingBroad = broadSnapshot.filter((sub) => broadAcceptsFrame(sub, frame));
|
|
189
|
+
for (const sub of matchingBroad) {
|
|
190
|
+
yield* dispatchToBroadSubscriber(sub, frame);
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
function buildCloseAll(subsRef, subsAllRef) {
|
|
195
|
+
return Effect.gen(function* () {
|
|
196
|
+
const snapshot = yield* Ref.getAndSet(subsRef, []);
|
|
197
|
+
const broadSnapshot = yield* Ref.getAndSet(subsAllRef, []);
|
|
198
|
+
const cause = new NotConnectedError({
|
|
199
|
+
message: "WebSocket not connected",
|
|
200
|
+
});
|
|
201
|
+
for (const sub of snapshot) {
|
|
202
|
+
yield* closeSubscriber(sub, cause);
|
|
203
|
+
}
|
|
204
|
+
for (const sub of broadSnapshot) {
|
|
205
|
+
yield* closeBroadSubscriber(sub, cause);
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
export function makeSubscriberRegistry() {
|
|
210
|
+
return Effect.gen(function* () {
|
|
211
|
+
const subsRef = yield* Ref.make([]);
|
|
212
|
+
const subsAllRef = yield* Ref.make([]);
|
|
213
|
+
const counterRef = yield* Ref.make(0);
|
|
214
|
+
return {
|
|
215
|
+
register: buildRegister(subsRef, counterRef),
|
|
216
|
+
registerAll: buildRegisterAll(subsAllRef, counterRef),
|
|
217
|
+
dispatch: buildDispatch(subsRef, subsAllRef),
|
|
218
|
+
closeAll: buildCloseAll(subsRef, subsAllRef),
|
|
219
|
+
};
|
|
220
|
+
}).pipe(Effect.withSpan("makeSubscriberRegistry"));
|
|
127
221
|
}
|
|
128
222
|
//# sourceMappingURL=subscribers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscribers.js","sourceRoot":"","sources":["../../src/runtime/subscribers.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"subscribers.js","sourceRoot":"","sources":["../../src/runtime/subscribers.ts"],"names":[],"mappings":"AAAA,2UAA2U;AAE3U;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,EACL,iBAAiB,GAIlB,MAAM,mBAAmB,CAAC;AAI3B,MAAM,mBAAmB,GAAG,KAAK,CAAC,OAAO,EAAkB,CAAC;AA8H5D,SAAS,kBAAkB,CACzB,UAA2B;IAE3B,OAAO,GAAG,CAAC,YAAY,CAAC,UAAU,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,IAAI,CAC5D,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,mBAAmB,CAAC,OAAO,KAAK,EAAE,CAAC,CAAC,CAC3D,CAAC;AACJ,CAAC;AAED,SAAS,kBAAkB,CACzB,OAAiD,EACjD,IAAsB;IAEtB,OAAO,GAAG,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC,GAAG,aAAa,EAAE,IAAI,CAAC,CAAC,CAAC;AAC1E,CAAC;AAED,SAAS,kBAAkB,CACzB,OAAiD,EACjD,EAAkB;IAElB,OAAO,GAAG,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,aAAa,EAAE,EAAE,CAC3C,aAAa,CAAC,MAAM,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,YAAY,CAAC,EAAE,KAAK,EAAE,CAAC,CAC/D,CAAC;AACJ,CAAC;AAED,SAAS,oBAAoB,CAC3B,GAAqB,EACrB,KAAqD;IAErD,OAAO,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,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