@spine-event-engine/server 2.0.0-snapshot.23 → 2.0.0-snapshot.24

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.
Files changed (104) hide show
  1. package/REFERENCE.md +89 -23
  2. package/dist/bus/event-bus.d.ts +65 -100
  3. package/dist/bus/event-bus.d.ts.map +1 -1
  4. package/dist/bus/event-bus.js +46 -116
  5. package/dist/bus/event-bus.js.map +1 -1
  6. package/dist/bus/saved-dispatcher-binding.d.ts +1 -44
  7. package/dist/bus/saved-dispatcher-binding.d.ts.map +1 -1
  8. package/dist/bus/saved-dispatcher-binding.js +0 -8
  9. package/dist/bus/saved-dispatcher-binding.js.map +1 -1
  10. package/dist/context/bounded-context.d.ts +9 -10
  11. package/dist/context/bounded-context.d.ts.map +1 -1
  12. package/dist/context/bounded-context.js +64 -43
  13. package/dist/context/bounded-context.js.map +1 -1
  14. package/dist/context/entity-inbox.d.ts.map +1 -1
  15. package/dist/context/entity-inbox.js +21 -7
  16. package/dist/context/entity-inbox.js.map +1 -1
  17. package/dist/context/local-inbox-handoff.d.ts +1 -0
  18. package/dist/context/local-inbox-handoff.d.ts.map +1 -1
  19. package/dist/context/local-inbox-handoff.js +31 -1
  20. package/dist/context/local-inbox-handoff.js.map +1 -1
  21. package/dist/context/projection-handoff.d.ts.map +1 -1
  22. package/dist/context/projection-handoff.js +2 -0
  23. package/dist/context/projection-handoff.js.map +1 -1
  24. package/dist/delivery/delivery-monitor.d.ts +12 -9
  25. package/dist/delivery/delivery-monitor.d.ts.map +1 -1
  26. package/dist/delivery/delivery-monitor.js +15 -9
  27. package/dist/delivery/delivery-monitor.js.map +1 -1
  28. package/dist/delivery/delivery-ports.d.ts +6 -13
  29. package/dist/delivery/delivery-ports.d.ts.map +1 -1
  30. package/dist/delivery/delivery-run-control.d.ts +15 -0
  31. package/dist/delivery/delivery-run-control.d.ts.map +1 -1
  32. package/dist/delivery/delivery-run-control.js.map +1 -1
  33. package/dist/delivery/delivery-supervisor.d.ts +33 -5
  34. package/dist/delivery/delivery-supervisor.d.ts.map +1 -1
  35. package/dist/delivery/delivery-supervisor.js +150 -22
  36. package/dist/delivery/delivery-supervisor.js.map +1 -1
  37. package/dist/delivery/delivery.d.ts.map +1 -1
  38. package/dist/delivery/delivery.js +128 -54
  39. package/dist/delivery/delivery.js.map +1 -1
  40. package/dist/delivery/inbox-storage.d.ts +8 -11
  41. package/dist/delivery/inbox-storage.d.ts.map +1 -1
  42. package/dist/delivery/inbox-storage.js +33 -76
  43. package/dist/delivery/inbox-storage.js.map +1 -1
  44. package/dist/delivery/inbox.d.ts +9 -12
  45. package/dist/delivery/inbox.d.ts.map +1 -1
  46. package/dist/delivery/inbox.js +10 -13
  47. package/dist/delivery/inbox.js.map +1 -1
  48. package/dist/delivery/reception-observation.d.ts +56 -0
  49. package/dist/delivery/reception-observation.d.ts.map +1 -0
  50. package/dist/delivery/reception-observation.js +67 -0
  51. package/dist/delivery/reception-observation.js.map +1 -0
  52. package/dist/repository/repository.d.ts +3 -4
  53. package/dist/repository/repository.d.ts.map +1 -1
  54. package/dist/repository/repository.js +155 -166
  55. package/dist/repository/repository.js.map +1 -1
  56. package/dist/runtime/runtime.d.ts +11 -0
  57. package/dist/runtime/runtime.d.ts.map +1 -1
  58. package/dist/runtime/runtime.js +13 -0
  59. package/dist/runtime/runtime.js.map +1 -1
  60. package/dist/runtime/signal-metadata.d.ts.map +1 -1
  61. package/dist/runtime/signal-metadata.js +3 -10
  62. package/dist/runtime/signal-metadata.js.map +1 -1
  63. package/dist/runtime/signal-publisher.d.ts +11 -33
  64. package/dist/runtime/signal-publisher.d.ts.map +1 -1
  65. package/dist/runtime/signal-publisher.js +70 -55
  66. package/dist/runtime/signal-publisher.js.map +1 -1
  67. package/dist/runtime/standalone-handler-runtime.d.ts.map +1 -1
  68. package/dist/runtime/standalone-handler-runtime.js +1 -31
  69. package/dist/runtime/standalone-handler-runtime.js.map +1 -1
  70. package/dist/server/environment-delivery-worker.d.ts.map +1 -1
  71. package/dist/server/environment-delivery-worker.js +305 -5
  72. package/dist/server/environment-delivery-worker.js.map +1 -1
  73. package/dist/server/managed-server-application.d.ts +2 -2
  74. package/dist/server/managed-server-application.d.ts.map +1 -1
  75. package/dist/server/managed-server-application.js +467 -177
  76. package/dist/server/managed-server-application.js.map +1 -1
  77. package/dist/server/node-coordinator.d.ts +14 -0
  78. package/dist/server/node-coordinator.d.ts.map +1 -1
  79. package/dist/server/node-coordinator.js +266 -45
  80. package/dist/server/node-coordinator.js.map +1 -1
  81. package/dist/server/server-log.d.ts.map +1 -1
  82. package/dist/server/server-log.js +4 -0
  83. package/dist/server/server-log.js.map +1 -1
  84. package/dist/server/server.js +20 -7
  85. package/dist/server/server.js.map +1 -1
  86. package/dist/services/spine-services.d.ts.map +1 -1
  87. package/dist/services/spine-services.js +200 -72
  88. package/dist/services/spine-services.js.map +1 -1
  89. package/dist/stand/event-origin-filter.d.ts +16 -0
  90. package/dist/stand/event-origin-filter.d.ts.map +1 -0
  91. package/dist/stand/event-origin-filter.js +124 -0
  92. package/dist/stand/event-origin-filter.js.map +1 -0
  93. package/dist/stand/subscription-observer.d.ts.map +1 -1
  94. package/dist/stand/subscription-observer.js +7 -0
  95. package/dist/stand/subscription-observer.js.map +1 -1
  96. package/dist/stand/subscription-runtime.d.ts +18 -1
  97. package/dist/stand/subscription-runtime.d.ts.map +1 -1
  98. package/dist/stand/subscription-runtime.js +32 -4
  99. package/dist/stand/subscription-runtime.js.map +1 -1
  100. package/dist/testing/index.d.ts.map +1 -1
  101. package/dist/testing/index.js +2 -2
  102. package/dist/testing/index.js.map +1 -1
  103. package/dist/tsconfig.tsbuildinfo +1 -1
  104. package/package.json +15 -15
package/REFERENCE.md CHANGED
@@ -737,8 +737,9 @@ The signal's matching handlers share one Entity draft. Each handler can await
737
737
  `this.ai.invoke()` through the protected Spine facade. Calls in one handler must
738
738
  be sequential and finish before it returns. Requests, results and
739
739
  validation failures are saved as the operation progresses. The final accepted
740
- state, Version, history and original outgoing envelopes are committed under the
741
- same execution claim. A no-op still completes its execution record. Waiting for
740
+ state, Version, history and outgoing Command obligations are committed under the
741
+ same execution claim. Emitted domain Events enter immutable Agent history but are
742
+ not stored as delivery obligations. A no-op still completes its execution record. Waiting for
742
743
  a provider does not hold a database transaction open.
743
744
 
744
745
  Recovery compares the registered handler, schema and policy with accepted work.
@@ -747,14 +748,14 @@ request is a mismatch, not a new attempt. Domain code should derive its decision
747
748
  from accepted signals and recorded reads. Arbitrary external effects performed
748
749
  by handler code are outside the model/tool journal.
749
750
 
750
- After completion, delivery uses the saved outgoing envelopes and recipient
751
- bindings. The producing handler and model are not rerun to deliver them.
752
- Downstream delivery is at least once: a recipient or standalone callback may be
753
- called again with the same envelope. Application effects must account for that.
754
- Generated repository and standalone receivers have the required binding metadata.
755
- Matching raw custom dispatchers without that metadata are rejected for Agent
756
- output; unrelated dispatchers and ordinary non-Agent posting keep their usual
757
- behavior.
751
+ After completion, emitted domain Events are handed once to the Bounded Context's
752
+ normal EventBus. The Agent does not track Event recipients, retry a failed handoff,
753
+ or replay Event delivery after restart. Immutable Agent history remains readable
754
+ independently of EventBus delivery. Saved outgoing Commands retain their original
755
+ IDs and recipient bindings for recovery without rerunning the producing handler
756
+ or model. Generated repository and standalone Command receivers provide the
757
+ required binding metadata; matching raw custom Command dispatchers without it
758
+ are rejected.
758
759
 
759
760
  ### Retained history
760
761
 
@@ -796,7 +797,7 @@ the registered Agent `Repository`, which exposes
796
797
  The scope is explicit: pass `{}` in a single-tenant Bounded Context or
797
798
  `{ tenantId }` in a multitenant Bounded Context. The repository also exposes
798
799
  `agentExecution(id, sourceCommandOrEventId, scope)` for the exact recorded phase:
799
- `accepted`, `active`, `completed-pending-delivery`, `completed`, or `terminated`.
800
+ `accepted`, `active`, `completed-pending-commands`, `completed`, or `terminated`.
800
801
  An absent record returns `undefined`; it does not establish completion. These
801
802
  reads use indexed storage without restoring an Agent. The application bridge
802
803
  must authorize access before calling either method; actor metadata does not
@@ -856,6 +857,21 @@ a starting time, and has no durable operation identity, progress, Inbox
856
857
  catch-up delivery, restart, resumption, or historical/live coordination. It is
857
858
  not JVM-equivalent Projection catch-up.
858
859
 
860
+ Event Topics accept `include_all` or equality filters on the complete
861
+ `context.past_message` Origin. The filter value must be a valid packed
862
+ `spine.core.Origin`; other Event field paths, operators, ID filters, empty
863
+ filter trees, and malformed values are rejected. Existing composite-filter
864
+ limits apply. This is the immediate previous signal, not any ancestor in a
865
+ causal chain. Tenant isolation remains independent of the filter.
866
+
867
+ Origin filters use Protobuf value equality for the entire supported message,
868
+ including actor context and grand-origin. Packed `Any` payloads retain their
869
+ exact type URL and bytes. Expected Origins with unknown fields in their nested
870
+ message structure are unsupported and rejected; actual Origins with such
871
+ unknown fields cannot match. This avoids silently ignoring fields while keeping
872
+ the same equality semantics as Spine JVM for supported filters. The same rule
873
+ applies to direct and stored subscription definitions.
874
+
859
875
  Active subscription streams and queues are process-local. `Stand` serves
860
876
  authoritative queries from current state and Entity subscriptions observe
861
877
  committed `EntityStateChanged` messages on the paired System Context EventBus,
@@ -881,7 +897,8 @@ group of complete server replicas when the framework handles process shutdown.
881
897
  and installs no process signal handlers; that host closes the returned handle.
882
898
  Both require a positive safe-integer
883
899
  `processCount` and an ESM `moduleUrl`; it never derives a process count from
884
- the machine. Its optional `host` and required nonzero `port` bind the public
900
+ the machine. Its optional `host` and required `port` (zero selects an OS-assigned
901
+ port) bind the public
885
902
  Coordinator listener. Every child executes that same module and calls the
886
903
  module's `createServer({ host: "127.0.0.1", port: 0 })`. The child reports its
887
904
  actual loopback endpoint only after its local readiness gates settle. The parent
@@ -900,11 +917,24 @@ inspect CPU availability and does not constrain the application's independently
900
917
  chosen `DeliveryStrategy` or shard count. Direct `Server.run()` and browser
901
918
  hosting remain independent of managed Node deployment.
902
919
 
920
+ Managed close drains Delivery before cancelling subscription relays. Child listeners
921
+ remain available through relay cancellation, and final child close follows relay
922
+ cleanup. A failed cleanup phase can be retried. Private child acknowledgement
923
+ and process reaping retain their finite process-control graces. A permanently
924
+ blocked application effect can keep explicit close pending.
925
+
903
926
  If no child is READY, Command and Query return gRPC `UNAVAILABLE`. The
904
927
  Coordinator does not enter application intake and does not retry the selected
905
928
  call on a sibling child. Subscription fan-out follows current READY members;
906
929
  later and replacement members attach the retained subscription before managed
907
930
  admission.
931
+ Each native child sends a response-only successful activation ACK after its
932
+ listener attaches. The Coordinator waits for every required child ACK before
933
+ emitting one ACK with the logical public subscription ID and Topic; a child
934
+ failure before readiness cancels admitted siblings. Business updates do not
935
+ serve as readiness signals, and later joining children do not emit another
936
+ logical ACK. An ACK confirms attachment, not durable replay or delivery of
937
+ future updates.
908
938
 
909
939
  `ServerOptions` is native-only: it configures contexts, resources, services,
910
940
  and the native listener. It has no `browser` option and the root package does
@@ -1019,12 +1049,15 @@ absent or elapsed (`keepUntil <= now`). Delivery skips per-record mutation check
1019
1049
  and deletion attempts for rows whose deadline is still in the future. Cleanup
1020
1050
  and retained-row duplicate recognition use the same applicable clock. Eligible
1021
1051
  rows still receive final time and shard checks before deletion.
1022
- Direct local storage atomically verifies ownership and
1023
- the exact delivered snapshot during removal. A remote adapter may instead read
1024
- and compare the snapshot before sending a separate best-effort removal request;
1025
- that sequence is not an atomic compare-and-delete guarantee. Pending, retryable,
1026
- non-delivered, and still-protected rows remain. There is no additional retention
1027
- configuration, timer, or scheduler.
1052
+ Direct local storage checks the supplied delivered status and deadline again,
1053
+ then deletes by ID while the operation is active. It does not re-read the stored
1054
+ row or compare its snapshot, and the shard session is not checked again after
1055
+ deletion. A row changed between the checks and deletion can therefore be
1056
+ removed. Cancellation stops subsequent cleanup attempts; deletions already
1057
+ completed remain. The remote adapter sends a separate bounded removal request,
1058
+ without an atomic compare-and-delete guarantee from this client. Pending,
1059
+ retryable, non-delivered, and still-protected rows are skipped by cleanup. There
1060
+ is no additional retention configuration, timer, or scheduler.
1028
1061
 
1029
1062
  `BoundedContextBuilder.withDeliveryStrategy(strategy)` snapshots a validated
1030
1063
  immutable strategy for its Entity Inbox; the default is one shard. For example,
@@ -1053,6 +1086,11 @@ before source client/storage. `DeliverySource` is not configured on
1053
1086
  durable supervisor state, topology failover, exactly-once effects, or automatic
1054
1087
  retry of unknown remote mutations.
1055
1088
 
1089
+ Direct `DeliverySupervisor.close({ graceMs })` stops new admission and source
1090
+ activity. Its `graceMs` defaults to 30,000 ms and bounds active-work grace and
1091
+ release cleanup separately. After those waits, close may still await entered
1092
+ work that has not settled; it is not a hard total close deadline.
1093
+
1056
1094
  Each Inbox read is bounded to one page. That bound does not limit the total
1057
1095
  pending work: an active drain continues from the last row read until that scan
1058
1096
  ends. It restarts from the beginning only if the completed scan delivered
@@ -1073,11 +1111,39 @@ the remote server.
1073
1111
  `DeliveryMonitor` is an instantiable, customizable policy seam exposing
1074
1112
  asynchronous continuation, start/completion, failed-reception, pickup-failure,
1075
1113
  and already-picked hooks.
1076
- `FailedReception` supplies only `markDelivered()` and one immediate
1077
- `repeatDispatching()` action; the framework adds no attempt history, timer,
1078
- backoff, quarantine, dead-letter, receipt, marker, or scheduler policy. A failed
1079
- durable acknowledgement keeps that row pending, blocks later rows for its
1080
- target during the run, and does not prevent independent targets from running.
1114
+ `FailedReception` supplies `markDelivered()` and immediate
1115
+ `repeatDispatching()` actions for failed processing. The default marks a failed
1116
+ reception delivered; independent targets continue. A custom monitor may repeat
1117
+ the dispatch and is consulted again if that attempt fails. Monitor and selected
1118
+ action errors propagate. A successful handler followed by a failed acknowledgement
1119
+ retries acknowledgement up to three times without deliberately rerunning the
1120
+ handler. Exhausted acknowledgement leaves the row pending and does not call the
1121
+ reception monitor. A custom reception action that completes normally completes
1122
+ delivery and the enclosing stage acknowledges the row. An action that rejects
1123
+ propagates its error and leaves the row `TO_DELIVER`. `markDelivered()` does not
1124
+ mean domain processing succeeded.
1125
+ Managed repository replay sends actual handler failures to the monitor while
1126
+ storage and replay infrastructure errors propagate. A direct `onMessage` callback
1127
+ is treated as the endpoint. Handler effects and acknowledgement are separate,
1128
+ so a crash between them may redeliver.
1129
+ The framework adds no persisted attempts, quarantine, dead-letter, receipt, or
1130
+ marker policy. The supervisor rescans pending shards every 10 seconds by default;
1131
+ the stale-session threshold is separately 60 seconds.
1132
+ After a failed finite run, release-generated remote observations of that shard
1133
+ are held locally until the next periodic rescan, preventing an immediate
1134
+ self-triggered retry loop. Explicit notifications remain admissible. A newly
1135
+ enqueued remote row on that shard may wait for the next rescan; other shards
1136
+ continue, and other processes may each attempt the failed row before applying
1137
+ local suppression. This timing is not a delivery deadline.
1138
+
1139
+ `BoundedContext.close()` stops external admission, drains accepted framework
1140
+ work, and then closes buses, subscriptions, Stands, and repository bindings.
1141
+ Cleanup failures are aggregated and may be retried. A committed Entity Event,
1142
+ reactor or Process Manager Event, and System Event receives one first-publication
1143
+ attempt; a contained failure is logged and does not schedule publication again.
1144
+ Persisted System Events use a separate fixed storage group. Command acceptance
1145
+ alone does not promise recipient completion. Processing retries for Inbox rows
1146
+ and acknowledgement recovery remain separate Delivery behavior.
1081
1147
 
1082
1148
  `Environment` resolves the Node `local` or `production` profile once from
1083
1149
  `NODE_ENV`. `ServerEnvironment` resolves configured facilities once for that
@@ -1,164 +1,129 @@
1
1
  import { type MessageSchema } from "@spine-event-engine/core";
2
2
  import { type Event } from "@spine-event-engine/proto";
3
3
  import type { EventStore } from "@spine-event-engine/storage";
4
- import { type AgentSavedDispatchPlan } from "@spine-event-engine/proto/generated/spine/server/agent/execution_record_pb.js";
5
4
  import type { ILogLayer } from "loglayer";
6
5
  import type { EventDispatcher } from "./event-dispatcher.js";
7
6
  /**
8
- * Checks for framework System events, including Agent interaction events.
7
+ * Checks whether a schema defines a framework System Event, including Agent interactions.
9
8
  *
10
- * @param schema Event message descriptor to classify.
11
- * @returns Whether the schema is reserved for System events.
9
+ * @param schema Event payload schema.
10
+ * @returns Whether the Event belongs to the System bus.
12
11
  */
13
12
  export declare const isSystemEventSchema: (schema: MessageSchema) => boolean;
14
13
  interface EventBusAccess {
15
14
  /**
16
- * Creates a bus without event storage.
15
+ * Creates a package-internal bus without an event store.
17
16
  *
18
- * @param dispatchers Initial dispatchers to register.
19
- * @returns The event bus without an event store.
17
+ * @param dispatchers the initial dispatchers to register.
18
+ * @returns the assembled forgetting bus.
20
19
  */
21
20
  createForgettingBus(dispatchers?: Iterable<EventDispatcher>): EventBus;
22
21
  /**
23
- * Creates a System-event bus with optional storage.
24
- *
25
- * @param eventStore Optional event store for the System bus.
26
- * @param dispatchers Initial dispatchers to register.
27
- * @returns The System-event bus.
22
+ * Creates a System Event bus with optional persistent storage.
23
+ * @param eventStore Optional System Event store.
24
+ * @param dispatchers Initial recipients.
25
+ * @returns Configured System Event bus.
28
26
  */
29
27
  createSystemBus(eventStore: EventStore | undefined, dispatchers?: Iterable<EventDispatcher>): EventBus;
30
28
  /**
31
- * Stores and dispatches an accepted event.
32
- *
33
- * @param eventBus Event bus receiving this internal operation.
34
- * @param event Event envelope to prepare or dispatch.
35
- * @returns A promise for event storage and dispatch.
29
+ * Dispatches one already-stored Event without another append.
30
+ * @param eventBus Target bus.
31
+ * @param event Captured Event envelope.
32
+ * @returns Completion after recipient dispatch.
36
33
  */
37
34
  postStored(eventBus: EventBus, event: Event): Promise<void>;
38
35
  /**
39
- * Stores and dispatches an event during follow-up work.
40
- *
41
- * @param eventBus Event bus receiving this internal operation.
42
- * @param event Event envelope to prepare or dispatch.
43
- * @returns A promise for follow-up event storage and dispatch.
36
+ * Queues an already-stored Event as a trusted follow-up.
37
+ * @param eventBus Target bus.
38
+ * @param event Captured Event envelope.
39
+ * @returns Completion after recipient dispatch.
44
40
  */
45
41
  postStoredFollowUp(eventBus: EventBus, event: Event): Promise<void>;
46
42
  /**
47
- * Posts an internal event during follow-up work.
48
- *
49
- * @param eventBus Event bus receiving this internal operation.
50
- * @param event Event envelope to prepare or dispatch.
51
- * @returns A promise for follow-up event dispatch.
43
+ * Queues a produced Event after active bus work.
44
+ * @param eventBus Target bus.
45
+ * @param event Produced Event envelope.
46
+ * @returns Completion after recipient dispatch.
52
47
  */
53
48
  postFollowUp(eventBus: EventBus, event: Event): Promise<void>;
54
49
  /**
55
- * Prepares a dispatch plan before persisting accepted output.
56
- *
57
- * @param eventBus Event bus receiving this internal operation.
58
- * @param event Event envelope to prepare or dispatch.
59
- * @returns The exact saved recipient plan.
60
- */
61
- prepareSaved(eventBus: EventBus, event: Event): Promise<AgentSavedDispatchPlan>;
62
- /**
63
- * Posts a prepared dispatch after its Agent result is saved.
64
- *
65
- * @param eventBus Event bus receiving this internal operation.
66
- * @param event Event envelope to prepare or dispatch.
67
- * @param plan Persisted recipient plan for this dispatch.
68
- * @returns A promise for completion of the saved dispatch.
69
- */
70
- postSavedFollowUp(eventBus: EventBus, event: Event, plan: AgentSavedDispatchPlan): Promise<void>;
71
- /**
72
- * Executes work in the bus-wide exclusive sequence.
73
- *
74
- * @typeParam Result Result type returned by the serialized work.
75
- * @param eventBus Event bus receiving this internal operation.
76
- * @param work Work to serialize with other bus operations.
77
- * @returns The result returned by the serialized work.
50
+ * Executes a callback in the Event queue.
51
+ * @typeParam Result Callback result.
52
+ * @param eventBus Target bus.
53
+ * @param work Serialized callback.
54
+ * @returns The callback result.
78
55
  */
79
56
  runExclusive<Result>(eventBus: EventBus, work: () => Result | Promise<Result>): Promise<Result>;
80
57
  /**
81
- * Subscribes a callback to one event type.
82
- *
83
- * @param eventBus Event bus receiving this internal operation.
84
- * @param typeUrl Fully qualified event message type URL.
85
- * @param subscriber Callback to invoke for matching events.
86
- * @returns A handle for removing the subscription.
58
+ * Registers an in-process Event subscriber.
59
+ * @param eventBus Target bus.
60
+ * @param typeUrl Event payload type URL.
61
+ * @param subscriber Recipient to notify.
62
+ * @returns Subscription cancellation handle.
87
63
  */
88
64
  subscribe(eventBus: EventBus, typeUrl: string, subscriber: EventSubscriber): EventSubscription;
89
65
  /**
90
- * Lists schemas registered for dispatch.
91
- *
92
- * @param eventBus Event bus receiving this internal operation.
93
- * @returns The registered event message schemas.
66
+ * Lists registered Event payload schemas.
67
+ * @param eventBus Target bus.
68
+ * @returns Current schema list.
94
69
  */
95
70
  eventSchemas(eventBus: EventBus): readonly MessageSchema[];
96
71
  /**
97
- * Registers event schemas for dispatch.
98
- *
99
- * @param eventBus Event bus receiving this internal operation.
100
- * @param schemas Event message schemas to register.
72
+ * Registers Event schemas for produced signals.
73
+ * @param eventBus Target bus.
74
+ * @param schemas Schemas to register.
101
75
  */
102
76
  registerSchemas(eventBus: EventBus, schemas: Iterable<MessageSchema>): void;
103
77
  /**
104
- * Removes a dispatcher from the bus.
105
- *
106
- * @param eventBus Event bus receiving this internal operation.
107
- * @param dispatcher Dispatcher to register or inspect.
78
+ * Removes a dispatcher from this bus.
79
+ * @param eventBus Target bus.
80
+ * @param dispatcher Dispatcher to remove.
108
81
  */
109
82
  unregister(eventBus: EventBus, dispatcher: EventDispatcher): void;
110
83
  /**
111
- * Finds a registered event schema by type URL.
112
- *
113
- * @param eventBus Event bus receiving this internal operation.
114
- * @param typeUrl Fully qualified event message type URL.
115
- * @returns The matching schema, if registered.
84
+ * Finds a registered Event schema.
85
+ * @param eventBus Target bus.
86
+ * @param typeUrl Event payload type URL.
87
+ * @returns Matching schema when registered.
116
88
  */
117
89
  schema(eventBus: EventBus, typeUrl: string): MessageSchema | undefined;
118
90
  /**
119
- * Stops accepting new external work.
120
- *
121
- * @param eventBus Event bus receiving this internal operation.
91
+ * Stops external Event intake before graceful drain.
92
+ * @param eventBus Target bus.
122
93
  */
123
94
  beginClose(eventBus: EventBus): void;
124
95
  /**
125
- * Waits for accepted dispatches to settle.
126
- *
127
- * @param eventBus Event bus receiving this internal operation.
128
- * @returns A promise that settles when accepted work drains.
96
+ * Waits for accepted Event work.
97
+ * @param eventBus Target bus.
98
+ * @returns Completion after the queue drains.
129
99
  */
130
100
  drain(eventBus: EventBus): Promise<void>;
131
101
  /**
132
- * Completes the bus shutdown.
133
- *
134
- * @param eventBus Event bus receiving this internal operation.
135
- * @returns A promise that settles when shutdown completes.
102
+ * Completes graceful Event-bus closure.
103
+ * @param eventBus Target bus.
104
+ * @returns Completion after closure.
136
105
  */
137
106
  finishClose(eventBus: EventBus): Promise<void>;
138
107
  /**
139
- * Restores intake after an aborted shutdown.
140
- *
141
- * @param eventBus Event bus receiving this internal operation.
108
+ * Closes a partially assembled bus.
109
+ * @param eventBus Target bus.
142
110
  */
143
111
  abortClose(eventBus: EventBus): void;
144
112
  /**
145
- * Returns the number of accepted dispatches still in progress.
146
- *
147
- * @param eventBus Event bus receiving this internal operation.
148
- * @returns The number of accepted dispatches still in progress.
113
+ * Returns admitted Event work count for drain stability.
114
+ * @param eventBus Target bus.
115
+ * @returns Number of accepted work items.
149
116
  */
150
117
  acceptedWorkCount(eventBus: EventBus): number;
151
118
  /**
152
- * Attaches the server logger to this bus.
153
- *
154
- * @param eventBus Event bus receiving this internal operation.
155
- * @param logger Logger used for bus diagnostics.
119
+ * Sets the internal diagnostic sink.
120
+ * @param eventBus Target bus.
121
+ * @param logger Safe structured logger.
156
122
  */
157
123
  installLogger(eventBus: EventBus, logger: ILogLayer): void;
158
124
  /**
159
- * Removes the server logger from this bus.
160
- *
161
- * @param eventBus Event bus receiving this internal operation.
125
+ * Clears the internal diagnostic sink.
126
+ * @param eventBus Target bus.
162
127
  */
163
128
  clearLogger(eventBus: EventBus): void;
164
129
  }
@@ -167,7 +132,7 @@ interface EventBusAccess {
167
132
  *
168
133
  * Public construction creates a domain-only bus that stores domain events and
169
134
  * rejects System schemas, dispatchers, and events. Internally assembled
170
- * forgetting and System buses own no `EventStore` unless explicitly given one.
135
+ * forgetting and System buses have no `EventStore` unless explicitly given one.
171
136
  * Events with no matching dispatcher resolve without dispatch. Events with no
172
137
  * registered schema reject deterministically before storage or dispatch.
173
138
  */
@@ -185,7 +150,7 @@ export declare class EventBus {
185
150
  /**
186
151
  * Registers an event dispatcher.
187
152
  *
188
- * @typeParam Dispatcher Concrete Event dispatcher type returned to the caller.
153
+ * @typeParam Dispatcher Concrete recipient being registered.
189
154
  * @param dispatcher the dispatcher to register.
190
155
  * @returns the registered dispatcher.
191
156
  */
@@ -1 +1 @@
1
- {"version":3,"file":"event-bus.d.ts","sourceRoot":"","sources":["../../src/bus/event-bus.ts"],"names":[],"mappings":"AAeA,OAAO,EAAyB,KAAK,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACrF,OAAO,EAAe,KAAK,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAEpE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAE9D,OAAO,EAEL,KAAK,sBAAsB,EAC5B,MAAM,+EAA+E,CAAC;AACvF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAQ1C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAuD7D;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,GAAI,QAAQ,aAAa,KAAG,OAC0B,CAAC;AAOvF,UAAU,cAAc;IACtB;;;;;OAKG;IACH,mBAAmB,CAAC,WAAW,CAAC,EAAE,QAAQ,CAAC,eAAe,CAAC,GAAG,QAAQ,CAAC;IAEvE;;;;;;OAMG;IACH,eAAe,CACb,UAAU,EAAE,UAAU,GAAG,SAAS,EAClC,WAAW,CAAC,EAAE,QAAQ,CAAC,eAAe,CAAC,GACtC,QAAQ,CAAC;IAEZ;;;;;;OAMG;IACH,UAAU,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE5D;;;;;;OAMG;IACH,kBAAkB,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEpE;;;;;;OAMG;IACH,YAAY,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE9D;;;;;;OAMG;IACH,YAAY,CAAC,QAAQ,EAAE,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