@spine-event-engine/server 2.0.0-snapshot.25 → 2.0.0-snapshot.28
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/README.md +104 -16
- package/REFERENCE.md +486 -57
- package/dist/agent/agent-history.d.ts +19 -3
- package/dist/agent/agent-history.d.ts.map +1 -1
- package/dist/agent/agent-history.js +41 -10
- package/dist/agent/agent-history.js.map +1 -1
- package/dist/agent/agent-live-ai-runtime.d.ts +1 -1
- package/dist/agent/agent-live-ai-runtime.js +1 -1
- package/dist/agent/agent-live-budget.d.ts +1 -1
- package/dist/agent/agent-live-budget.js +1 -1
- package/dist/agent/agent-live-read-runtime.d.ts +13 -2
- package/dist/agent/agent-live-read-runtime.d.ts.map +1 -1
- package/dist/agent/agent-live-read-runtime.js +6 -5
- package/dist/agent/agent-live-read-runtime.js.map +1 -1
- package/dist/browser/browser-admission.d.ts +47 -0
- package/dist/browser/browser-admission.d.ts.map +1 -0
- package/dist/browser/browser-admission.js +200 -0
- package/dist/browser/browser-admission.js.map +1 -0
- package/dist/browser/browser-server.d.ts +171 -1
- package/dist/browser/browser-server.d.ts.map +1 -1
- package/dist/browser/browser-server.js +1027 -303
- package/dist/browser/browser-server.js.map +1 -1
- package/dist/browser/durable-subscription-bindings.d.ts +5 -0
- package/dist/browser/durable-subscription-bindings.d.ts.map +1 -1
- package/dist/browser/durable-subscription-bindings.js +226 -38
- package/dist/browser/durable-subscription-bindings.js.map +1 -1
- package/dist/browser/index.d.ts +1 -1
- package/dist/browser/index.d.ts.map +1 -1
- package/dist/browser/options.d.ts +53 -2
- package/dist/browser/options.d.ts.map +1 -1
- package/dist/bus/command-bus.d.ts +9 -1
- package/dist/bus/command-bus.d.ts.map +1 -1
- package/dist/bus/command-bus.js +75 -10
- package/dist/bus/command-bus.js.map +1 -1
- package/dist/bus/command-errors.d.ts +20 -4
- package/dist/bus/command-errors.d.ts.map +1 -1
- package/dist/bus/command-errors.js +47 -7
- package/dist/bus/command-errors.js.map +1 -1
- package/dist/bus/event-bus.d.ts +9 -1
- package/dist/bus/event-bus.d.ts.map +1 -1
- package/dist/bus/event-bus.js +136 -9
- package/dist/bus/event-bus.js.map +1 -1
- package/dist/context/bounded-context.d.ts +59 -39
- package/dist/context/bounded-context.d.ts.map +1 -1
- package/dist/context/bounded-context.js +277 -262
- package/dist/context/bounded-context.js.map +1 -1
- package/dist/context/entity-inbox.d.ts +12 -17
- package/dist/context/entity-inbox.d.ts.map +1 -1
- package/dist/context/entity-inbox.js +106 -119
- package/dist/context/entity-inbox.js.map +1 -1
- package/dist/context/local-inbox-handoff.d.ts +13 -13
- package/dist/context/local-inbox-handoff.d.ts.map +1 -1
- package/dist/context/local-inbox-handoff.js +60 -32
- package/dist/context/local-inbox-handoff.js.map +1 -1
- package/dist/context/persistent-tenant-index.d.ts +81 -0
- package/dist/context/persistent-tenant-index.d.ts.map +1 -0
- package/dist/context/persistent-tenant-index.js +270 -0
- package/dist/context/persistent-tenant-index.js.map +1 -0
- package/dist/context/projection-handoff.d.ts +9 -9
- package/dist/context/projection-handoff.d.ts.map +1 -1
- package/dist/context/projection-handoff.js +31 -23
- package/dist/context/projection-handoff.js.map +1 -1
- package/dist/context/tenant-index.d.ts +7 -6
- package/dist/context/tenant-index.d.ts.map +1 -1
- package/dist/context/tenant-index.js +2 -188
- package/dist/context/tenant-index.js.map +1 -1
- package/dist/context/tenant-unknown-error.d.ts +2 -2
- package/dist/context/tenant-unknown-error.d.ts.map +1 -1
- package/dist/context/tenant-unknown-error.js +4 -1
- package/dist/context/tenant-unknown-error.js.map +1 -1
- package/dist/delivery/delivery-supervisor.d.ts.map +1 -1
- package/dist/delivery/delivery-supervisor.js +12 -3
- package/dist/delivery/delivery-supervisor.js.map +1 -1
- package/dist/delivery/delivery.d.ts +4 -3
- package/dist/delivery/delivery.d.ts.map +1 -1
- package/dist/delivery/delivery.js +82 -34
- package/dist/delivery/delivery.js.map +1 -1
- package/dist/delivery/reception-observation.d.ts +3 -3
- package/dist/delivery/reception-observation.js +2 -2
- package/dist/entity/entity.d.ts +59 -0
- package/dist/entity/entity.d.ts.map +1 -1
- package/dist/entity/entity.js +60 -0
- package/dist/entity/entity.js.map +1 -1
- package/dist/handler/app-query-handler.d.ts +60 -0
- package/dist/handler/app-query-handler.d.ts.map +1 -0
- package/dist/handler/app-query-handler.js +23 -0
- package/dist/handler/app-query-handler.js.map +1 -0
- package/dist/handler/generated-registry-discovery.d.ts +6 -0
- package/dist/handler/generated-registry-discovery.d.ts.map +1 -1
- package/dist/handler/generated-registry-discovery.js +71 -2
- package/dist/handler/generated-registry-discovery.js.map +1 -1
- package/dist/handler/handler-decorators.d.ts +8 -29
- package/dist/handler/handler-decorators.d.ts.map +1 -1
- package/dist/handler/handler-decorators.js +33 -210
- package/dist/handler/handler-decorators.js.map +1 -1
- package/dist/handler/spine-metadata-inventory.d.ts +99 -0
- package/dist/handler/spine-metadata-inventory.d.ts.map +1 -0
- package/dist/handler/spine-metadata-inventory.js +162 -0
- package/dist/handler/spine-metadata-inventory.js.map +1 -0
- package/dist/index.d.ts +9 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/dist/repository/command-routing.d.ts +1 -1
- package/dist/repository/command-routing.js +1 -1
- package/dist/repository/event-routing.d.ts +1 -1
- package/dist/repository/event-routing.js +1 -1
- package/dist/repository/repository.d.ts +61 -26
- package/dist/repository/repository.d.ts.map +1 -1
- package/dist/repository/repository.js +612 -306
- package/dist/repository/repository.js.map +1 -1
- package/dist/repository/state-update-routing.d.ts +1 -1
- package/dist/repository/state-update-routing.js +1 -1
- package/dist/runtime/signal-publisher.d.ts +23 -8
- package/dist/runtime/signal-publisher.d.ts.map +1 -1
- package/dist/runtime/signal-publisher.js +11 -8
- package/dist/runtime/signal-publisher.js.map +1 -1
- package/dist/server/managed-server-application.d.ts +12 -11
- package/dist/server/managed-server-application.d.ts.map +1 -1
- package/dist/server/managed-server-application.js +41 -25
- package/dist/server/managed-server-application.js.map +1 -1
- package/dist/server/node-coordinator.d.ts +18 -5
- package/dist/server/node-coordinator.d.ts.map +1 -1
- package/dist/server/node-coordinator.js +744 -108
- package/dist/server/node-coordinator.js.map +1 -1
- package/dist/server/reserved-spine-rpc-paths.json +1 -0
- package/dist/server/server-environment.d.ts +23 -5
- package/dist/server/server-environment.d.ts.map +1 -1
- package/dist/server/server-environment.js +89 -24
- package/dist/server/server-environment.js.map +1 -1
- package/dist/server/server.d.ts +45 -0
- package/dist/server/server.d.ts.map +1 -1
- package/dist/server/server.js +112 -3
- package/dist/server/server.js.map +1 -1
- package/dist/services/app-query-execution.d.ts +53 -0
- package/dist/services/app-query-execution.d.ts.map +1 -0
- package/dist/services/app-query-execution.js +408 -0
- package/dist/services/app-query-execution.js.map +1 -0
- package/dist/services/native-operation.d.ts +34 -0
- package/dist/services/native-operation.d.ts.map +1 -0
- package/dist/services/native-operation.js +77 -0
- package/dist/services/native-operation.js.map +1 -0
- package/dist/services/query-reader.d.ts +32 -7
- package/dist/services/query-reader.d.ts.map +1 -1
- package/dist/services/query-reader.js +22 -2
- package/dist/services/query-reader.js.map +1 -1
- package/dist/services/read-request-status.d.ts +65 -0
- package/dist/services/read-request-status.d.ts.map +1 -0
- package/dist/services/read-request-status.js +151 -0
- package/dist/services/read-request-status.js.map +1 -0
- package/dist/services/spine-services.d.ts +42 -7
- package/dist/services/spine-services.d.ts.map +1 -1
- package/dist/services/spine-services.js +1005 -175
- package/dist/services/spine-services.js.map +1 -1
- package/dist/services/trusted-reader-ingress.d.ts +110 -0
- package/dist/services/trusted-reader-ingress.d.ts.map +1 -0
- package/dist/services/trusted-reader-ingress.js +102 -0
- package/dist/services/trusted-reader-ingress.js.map +1 -0
- package/dist/spi/handler-registry.d.ts +2 -0
- package/dist/spi/handler-registry.d.ts.map +1 -1
- package/dist/spi/handler-registry.js +1 -1
- package/dist/spi/handler-registry.js.map +1 -1
- package/dist/stand/read-side-filter-engine.d.ts +46 -0
- package/dist/stand/read-side-filter-engine.d.ts.map +1 -0
- package/dist/stand/read-side-filter-engine.js +356 -0
- package/dist/stand/read-side-filter-engine.js.map +1 -0
- package/dist/stand/read-side-filter.d.ts +247 -0
- package/dist/stand/read-side-filter.d.ts.map +1 -0
- package/dist/stand/read-side-filter.js +39 -0
- package/dist/stand/read-side-filter.js.map +1 -0
- package/dist/stand/read-side-message.d.ts +66 -0
- package/dist/stand/read-side-message.d.ts.map +1 -0
- package/dist/stand/read-side-message.js +167 -0
- package/dist/stand/read-side-message.js.map +1 -0
- package/dist/stand/stand-direct-delivery.d.ts +161 -0
- package/dist/stand/stand-direct-delivery.d.ts.map +1 -0
- package/dist/stand/stand-direct-delivery.js +210 -0
- package/dist/stand/stand-direct-delivery.js.map +1 -0
- package/dist/stand/stand.d.ts +81 -43
- package/dist/stand/stand.d.ts.map +1 -1
- package/dist/stand/stand.js +411 -55
- package/dist/stand/stand.js.map +1 -1
- package/dist/stand/subscription-observer.d.ts.map +1 -1
- package/dist/stand/subscription-observer.js +103 -0
- package/dist/stand/subscription-observer.js.map +1 -1
- package/dist/stand/subscription-read-filters.d.ts +40 -0
- package/dist/stand/subscription-read-filters.d.ts.map +1 -0
- package/dist/stand/subscription-read-filters.js +91 -0
- package/dist/stand/subscription-read-filters.js.map +1 -0
- package/dist/stand/subscription-reader-binding.d.ts +20 -0
- package/dist/stand/subscription-reader-binding.d.ts.map +1 -0
- package/dist/stand/subscription-reader-binding.js +56 -0
- package/dist/stand/subscription-reader-binding.js.map +1 -0
- package/dist/stand/subscription-records.d.ts +30 -3
- package/dist/stand/subscription-records.d.ts.map +1 -1
- package/dist/stand/subscription-records.js +61 -16
- package/dist/stand/subscription-records.js.map +1 -1
- package/dist/stand/subscription-registry.d.ts +49 -14
- package/dist/stand/subscription-registry.d.ts.map +1 -1
- package/dist/stand/subscription-registry.js +150 -31
- package/dist/stand/subscription-registry.js.map +1 -1
- package/dist/stand/subscription-runtime.d.ts +7 -2
- package/dist/stand/subscription-runtime.d.ts.map +1 -1
- package/dist/stand/subscription-runtime.js +131 -25
- package/dist/stand/subscription-runtime.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +16 -14
|
@@ -7,7 +7,7 @@ import { type InterfaceRouteSchemas, type InterfaceRouteMessage, type RoutingDec
|
|
|
7
7
|
* Calculates target Entity IDs for one accepted Entity state update.
|
|
8
8
|
*
|
|
9
9
|
* The route must be deterministic and side-effect-free. It runs once during
|
|
10
|
-
* admission; durable
|
|
10
|
+
* admission; durable Inbox delivery uses the stored target instead.
|
|
11
11
|
*
|
|
12
12
|
* @typeParam Id Entity ID type used by the receiving Projection repository.
|
|
13
13
|
* @typeParam Schema Generated Entity state message schema.
|
|
@@ -54,7 +54,7 @@ export class StateUpdateRouting {
|
|
|
54
54
|
*
|
|
55
55
|
* Copied or malformed tokens fail during declaration. Every token member must
|
|
56
56
|
* be registered by the repository, or construction fails. The selected route
|
|
57
|
-
* runs once for an accepted admission; durable
|
|
57
|
+
* runs once for an accepted admission; durable Inbox delivery uses stored targets and
|
|
58
58
|
* does not run routing again.
|
|
59
59
|
*
|
|
60
60
|
* @param schemaOrToken Generated Entity-state schema or nominal message-interface token.
|
|
@@ -2,13 +2,28 @@ import { type Command, type Event } from "@spine-event-engine/proto";
|
|
|
2
2
|
import type { ILogLayer } from "loglayer";
|
|
3
3
|
import { CommandBus } from "../bus/command-bus.js";
|
|
4
4
|
import { EventBus } from "../bus/event-bus.js";
|
|
5
|
+
/**
|
|
6
|
+
* Categories of produced-signal publication attempts.
|
|
7
|
+
*/
|
|
5
8
|
type PublicationKind = "command" | "event" | "rejection-event" | "system-event" | "stored-event";
|
|
9
|
+
/**
|
|
10
|
+
* Observes produced signals in test fixtures without changing publication.
|
|
11
|
+
*/
|
|
6
12
|
interface ProducedSignalObserver {
|
|
13
|
+
/**
|
|
14
|
+
* Receives a produced Command.
|
|
15
|
+
*/
|
|
7
16
|
readonly onCommand?: (command: Readonly<Command>) => void;
|
|
17
|
+
/**
|
|
18
|
+
* Receives a produced Event.
|
|
19
|
+
*/
|
|
8
20
|
readonly onEvent?: (event: Readonly<Event>) => void;
|
|
9
21
|
}
|
|
10
22
|
/**
|
|
11
23
|
* Publishes produced signals and contains their detached dispatch failures for one context.
|
|
24
|
+
* Completion follows each registered dispatcher's Promise. Repository-backed
|
|
25
|
+
* Entity recipients finish after Inbox receipt; custom dispatchers retain
|
|
26
|
+
* their own completion contract.
|
|
12
27
|
*
|
|
13
28
|
* @internal
|
|
14
29
|
*/
|
|
@@ -24,17 +39,17 @@ export declare class SignalPublisher {
|
|
|
24
39
|
*/
|
|
25
40
|
constructor(commandBus: CommandBus, eventBus: EventBus, systemEventBus: EventBus, contextName: string);
|
|
26
41
|
/**
|
|
27
|
-
* Publishes a produced Command
|
|
42
|
+
* Publishes a produced Command through one tracked bus handoff attempt.
|
|
28
43
|
*
|
|
29
44
|
* @param command The produced Command envelope.
|
|
30
|
-
* @returns
|
|
45
|
+
* @returns Completion after registered dispatchers settle or a handoff failure is contained.
|
|
31
46
|
*/
|
|
32
47
|
publishCommand(command: Command): Promise<void>;
|
|
33
48
|
/**
|
|
34
|
-
* Publishes a produced Event
|
|
49
|
+
* Publishes a produced Event through one tracked bus handoff attempt.
|
|
35
50
|
*
|
|
36
51
|
* @param event The produced Event envelope.
|
|
37
|
-
* @returns
|
|
52
|
+
* @returns Completion after registered dispatchers settle or a handoff failure is contained.
|
|
38
53
|
*/
|
|
39
54
|
publishEvent(event: Event): Promise<void>;
|
|
40
55
|
/**
|
|
@@ -42,25 +57,25 @@ export declare class SignalPublisher {
|
|
|
42
57
|
*
|
|
43
58
|
* @internal
|
|
44
59
|
* @param event The rejection Event envelope.
|
|
45
|
-
* @returns
|
|
60
|
+
* @returns Completion after registered dispatchers settle or a handoff failure is contained.
|
|
46
61
|
*/
|
|
47
62
|
publishRejectionEvent(event: Event): Promise<void>;
|
|
48
63
|
/**
|
|
49
64
|
* Dispatches a committed Entity Event once after persistence.
|
|
50
65
|
* @param event The committed Event envelope.
|
|
51
|
-
* @returns Completion after
|
|
66
|
+
* @returns Completion after registered dispatchers settle or a handoff failure is contained.
|
|
52
67
|
*/
|
|
53
68
|
publishCommittedEvent(event: Event): Promise<void>;
|
|
54
69
|
/**
|
|
55
70
|
* Dispatches a committed reactor or Process Manager Event once as follow-up work.
|
|
56
71
|
* @param event The committed Event envelope.
|
|
57
|
-
* @returns Completion after
|
|
72
|
+
* @returns Completion after registered dispatchers settle or a handoff failure is contained.
|
|
58
73
|
*/
|
|
59
74
|
publishReactorEvent(event: Event): Promise<void>;
|
|
60
75
|
/**
|
|
61
76
|
* Dispatches a produced System Event once, persisting it when configured.
|
|
62
77
|
* @param event The produced System Event envelope.
|
|
63
|
-
* @returns Completion after
|
|
78
|
+
* @returns Completion after registered dispatchers settle or a handoff failure is contained.
|
|
64
79
|
*/
|
|
65
80
|
publishSystemEvent(event: Event): Promise<void>;
|
|
66
81
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signal-publisher.d.ts","sourceRoot":"","sources":["../../src/runtime/signal-publisher.ts"],"names":[],"mappings":"AAeA,OAAO,EAA8B,KAAK,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,2BAA2B,CAAC;AACjG,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C,OAAO,EAAoB,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAkB,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAG/D,KAAK,eAAe,GAAG,SAAS,GAAG,OAAO,GAAG,iBAAiB,GAAG,cAAc,GAAG,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"signal-publisher.d.ts","sourceRoot":"","sources":["../../src/runtime/signal-publisher.ts"],"names":[],"mappings":"AAeA,OAAO,EAA8B,KAAK,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,2BAA2B,CAAC;AACjG,OAAO,KAAK,EAAE,SAAS,EAA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GAAG,KAAK,GAAG,SAAS,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI;IA6B/F;;;;OAIG;IACH,aAAa,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI;IAItC;;OAEG;IACH,WAAW,IAAI,IAAI;IAInB;;;OAGG;IACH,UAAU,IAAI,IAAI;IAIlB;;;;OAIG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAM5B;;OAEG;IACH,WAAW,IAAI,IAAI;IAInB;;OAEG;IACH,aAAa,IAAI,IAAI;IAKrB;;;;;;OAMG;IACH,OAAO,CAAC,QAAQ,EAAE,sBAAsB,GAAG;QAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,IAAI,CAAA;KAAE;IA4CzE;;;;;OAKG;IACH,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,OAAO,GAAG,KAAK,GAAG,SAAS,GAAG,MAAM;CAK7D"}
|
|
@@ -18,6 +18,9 @@ import { eventBusAccess, EventBus } from "../bus/event-bus.js";
|
|
|
18
18
|
import { emitServerError } from "../server/server-log.js";
|
|
19
19
|
/**
|
|
20
20
|
* Publishes produced signals and contains their detached dispatch failures for one context.
|
|
21
|
+
* Completion follows each registered dispatcher's Promise. Repository-backed
|
|
22
|
+
* Entity recipients finish after Inbox receipt; custom dispatchers retain
|
|
23
|
+
* their own completion contract.
|
|
21
24
|
*
|
|
22
25
|
* @internal
|
|
23
26
|
*/
|
|
@@ -69,19 +72,19 @@ export class SignalPublisher {
|
|
|
69
72
|
this.#contextName = contextName;
|
|
70
73
|
}
|
|
71
74
|
/**
|
|
72
|
-
* Publishes a produced Command
|
|
75
|
+
* Publishes a produced Command through one tracked bus handoff attempt.
|
|
73
76
|
*
|
|
74
77
|
* @param command The produced Command envelope.
|
|
75
|
-
* @returns
|
|
78
|
+
* @returns Completion after registered dispatchers settle or a handoff failure is contained.
|
|
76
79
|
*/
|
|
77
80
|
publishCommand(command) {
|
|
78
81
|
return this.#publish("command", command, () => commandBusAccess.postInternalFollowUp(this.#commandBus, command));
|
|
79
82
|
}
|
|
80
83
|
/**
|
|
81
|
-
* Publishes a produced Event
|
|
84
|
+
* Publishes a produced Event through one tracked bus handoff attempt.
|
|
82
85
|
*
|
|
83
86
|
* @param event The produced Event envelope.
|
|
84
|
-
* @returns
|
|
87
|
+
* @returns Completion after registered dispatchers settle or a handoff failure is contained.
|
|
85
88
|
*/
|
|
86
89
|
publishEvent(event) {
|
|
87
90
|
return this.#publish("event", event, () => eventBusAccess.postFollowUp(this.#eventBus, event));
|
|
@@ -91,7 +94,7 @@ export class SignalPublisher {
|
|
|
91
94
|
*
|
|
92
95
|
* @internal
|
|
93
96
|
* @param event The rejection Event envelope.
|
|
94
|
-
* @returns
|
|
97
|
+
* @returns Completion after registered dispatchers settle or a handoff failure is contained.
|
|
95
98
|
*/
|
|
96
99
|
publishRejectionEvent(event) {
|
|
97
100
|
return this.#publish("rejection-event", event, () => eventBusAccess.postFollowUp(this.#eventBus, event));
|
|
@@ -99,7 +102,7 @@ export class SignalPublisher {
|
|
|
99
102
|
/**
|
|
100
103
|
* Dispatches a committed Entity Event once after persistence.
|
|
101
104
|
* @param event The committed Event envelope.
|
|
102
|
-
* @returns Completion after
|
|
105
|
+
* @returns Completion after registered dispatchers settle or a handoff failure is contained.
|
|
103
106
|
*/
|
|
104
107
|
publishCommittedEvent(event) {
|
|
105
108
|
const snapshot = clone(EventSchema, event);
|
|
@@ -108,7 +111,7 @@ export class SignalPublisher {
|
|
|
108
111
|
/**
|
|
109
112
|
* Dispatches a committed reactor or Process Manager Event once as follow-up work.
|
|
110
113
|
* @param event The committed Event envelope.
|
|
111
|
-
* @returns Completion after
|
|
114
|
+
* @returns Completion after registered dispatchers settle or a handoff failure is contained.
|
|
112
115
|
*/
|
|
113
116
|
publishReactorEvent(event) {
|
|
114
117
|
const snapshot = clone(EventSchema, event);
|
|
@@ -117,7 +120,7 @@ export class SignalPublisher {
|
|
|
117
120
|
/**
|
|
118
121
|
* Dispatches a produced System Event once, persisting it when configured.
|
|
119
122
|
* @param event The produced System Event envelope.
|
|
120
|
-
* @returns Completion after
|
|
123
|
+
* @returns Completion after registered dispatchers settle or a handoff failure is contained.
|
|
121
124
|
*/
|
|
122
125
|
publishSystemEvent(event) {
|
|
123
126
|
const snapshot = clone(EventSchema, event);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signal-publisher.js","sourceRoot":"","sources":["../../src/runtime/signal-publisher.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,WAAW,EAA4B,MAAM,2BAA2B,CAAC;AAGjG,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"signal-publisher.js","sourceRoot":"","sources":["../../src/runtime/signal-publisher.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,WAAW,EAA4B,MAAM,2BAA2B,CAAC;AAGjG,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AA2B1D;;;;;;;GAOG;AACH,MAAM,OAAO,eAAe;IAC1B;;OAEG;IACM,WAAW,CAAa;IAEjC;;OAEG;IACM,SAAS,CAAW;IAE7B;;OAEG;IACM,eAAe,CAAW;IAEnC;;OAEG;IACM,YAAY,CAAS;IAE9B;;OAEG;IACM,SAAS,GAAG,IA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AAU,EAAE,CAAC;YACvC,IAAI,CAAC;gBACH,IAAI,IAAI,KAAK,SAAS;oBAAE,QAAQ,CAAC,SAAS,EAAE,CAAC,KAAK,CAAC,aAAa,EAAE,MAAiB,CAAC,CAAC,CAAC;gBACtF,IAAI,IAAI,KAAK,OAAO;oBAAE,QAAQ,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE,MAAe,CAAC,CAAC,CAAC;YAChF,CAAC;YAAC,MAAM,CAAC;gBACP,iEAAiE;YACnE,CAAC;QACH,CAAC;IACH,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,QAAQ,CAAC,MAAmC;QACjD,MAAM,EAAE,GAAG,MAAM,EAAE,EAAE,CAAC;QACtB,IAAI,EAAE,KAAK,SAAS;YAAE,OAAO,SAAS,CAAC;QACvC,OAAO,MAAM,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC;IAC3C,CAAC;CACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ChildProcess } from "node:child_process";
|
|
2
2
|
import { type RunningServer } from "./server.js";
|
|
3
|
-
import { NodeCoordinator, type ReadyCoordinatorMember } from "./node-coordinator.js";
|
|
3
|
+
import { NodeCoordinator, type NodeCoordinatorOptions, type ReadyCoordinatorMember } from "./node-coordinator.js";
|
|
4
4
|
import { InMemorySubscriptionRegistry } from "../stand/subscription-registry.js";
|
|
5
5
|
import type { Subscription } from "@spine-event-engine/proto/client";
|
|
6
6
|
/**
|
|
@@ -94,6 +94,14 @@ export interface ManagedServerApplicationOptions {
|
|
|
94
94
|
* @returns Completion after child-local prerequisites are established.
|
|
95
95
|
*/
|
|
96
96
|
readonly synchronize?: () => Promise<void>;
|
|
97
|
+
/**
|
|
98
|
+
* Authenticates direct and forwarded requests at the managed Coordinator.
|
|
99
|
+
*/
|
|
100
|
+
readonly readerAdmission?: NodeCoordinatorOptions["readerAdmission"];
|
|
101
|
+
/**
|
|
102
|
+
* Issues fresh operation-bound proofs from the Coordinator to children.
|
|
103
|
+
*/
|
|
104
|
+
readonly forwardingProof?: NodeCoordinatorOptions["forwardingProof"];
|
|
97
105
|
/**
|
|
98
106
|
*
|
|
99
107
|
* Configures bounded private process replacement.
|
|
@@ -124,10 +132,8 @@ export interface ManagedServerApplicationHandle {
|
|
|
124
132
|
*/
|
|
125
133
|
export declare const ManagedServerApplication: Readonly<{
|
|
126
134
|
/**
|
|
127
|
-
*
|
|
128
135
|
* Starts a managed parent and complete-replica children without taking
|
|
129
136
|
* process-signal handling.
|
|
130
|
-
*
|
|
131
137
|
* The caller closes the returned handle. This is for an embedding host that
|
|
132
138
|
* already handles `SIGINT` and `SIGTERM`.
|
|
133
139
|
*
|
|
@@ -136,7 +142,6 @@ export declare const ManagedServerApplication: Readonly<{
|
|
|
136
142
|
*/
|
|
137
143
|
start(options: ManagedServerApplicationOptions): Promise<ManagedServerApplicationHandle>;
|
|
138
144
|
/**
|
|
139
|
-
*
|
|
140
145
|
* Starts a managed parent and complete-replica children with process-signal
|
|
141
146
|
* ownership.
|
|
142
147
|
*
|
|
@@ -158,14 +163,12 @@ export interface ManagedServerCoordinatorDependencies {
|
|
|
158
163
|
*/
|
|
159
164
|
readonly clock: {
|
|
160
165
|
/**
|
|
161
|
-
*
|
|
162
166
|
* Reads the current clock value.
|
|
163
167
|
*
|
|
164
168
|
* @returns The current time in milliseconds.
|
|
165
169
|
*/
|
|
166
170
|
now(): number;
|
|
167
171
|
/**
|
|
168
|
-
*
|
|
169
172
|
* Schedules a timeout callback.
|
|
170
173
|
*
|
|
171
174
|
* @param onTimeout Runs when the requested delay elapses.
|
|
@@ -174,7 +177,6 @@ export interface ManagedServerCoordinatorDependencies {
|
|
|
174
177
|
*/
|
|
175
178
|
setTimeout(onTimeout: () => void, delay: number): unknown;
|
|
176
179
|
/**
|
|
177
|
-
*
|
|
178
180
|
* Cancels a scheduled timeout.
|
|
179
181
|
*
|
|
180
182
|
* @param timer Identifies the timer to cancel.
|
|
@@ -204,6 +206,9 @@ export interface ManagedServerCoordinatorDependencies {
|
|
|
204
206
|
readonly port?: number;
|
|
205
207
|
}) => Promise<NodeCoordinator>;
|
|
206
208
|
}
|
|
209
|
+
/**
|
|
210
|
+
* Coordinator settings with a port assigned during managed startup.
|
|
211
|
+
*/
|
|
207
212
|
type ManagedServerCoordinatorOptions = Omit<ManagedServerApplicationOptions, "port"> & {
|
|
208
213
|
readonly port?: number;
|
|
209
214
|
readonly manageProcessSignals?: boolean;
|
|
@@ -217,7 +222,6 @@ type ManagedServerCoordinatorOptions = Omit<ManagedServerApplicationOptions, "po
|
|
|
217
222
|
export declare class ManagedServerCoordinator {
|
|
218
223
|
#private;
|
|
219
224
|
/**
|
|
220
|
-
*
|
|
221
225
|
* Creates a coordinator for one configured replica cohort.
|
|
222
226
|
*
|
|
223
227
|
* @param options Configures complete child application replicas.
|
|
@@ -225,21 +229,18 @@ export declare class ManagedServerCoordinator {
|
|
|
225
229
|
*/
|
|
226
230
|
constructor(options: ManagedServerCoordinatorOptions, dependencies?: ManagedServerCoordinatorDependencies);
|
|
227
231
|
/**
|
|
228
|
-
*
|
|
229
232
|
* Starts every initial replica and waits until all report READY.
|
|
230
233
|
*
|
|
231
234
|
* @returns The handle for the started managed cohort.
|
|
232
235
|
*/
|
|
233
236
|
start(): Promise<ManagedServerApplicationHandle>;
|
|
234
237
|
/**
|
|
235
|
-
*
|
|
236
238
|
* Stops managed children and prevents later replacement starts.
|
|
237
239
|
*
|
|
238
240
|
* @returns Completion after child and retired-child cleanup succeeds.
|
|
239
241
|
*/
|
|
240
242
|
close(): Promise<void>;
|
|
241
243
|
/**
|
|
242
|
-
*
|
|
243
244
|
* Returns ready child facts to the next Coordinator slice.
|
|
244
245
|
*
|
|
245
246
|
* @returns The ready child topology facts.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"managed-server-application.d.ts","sourceRoot":"","sources":["../../src/server/managed-server-application.ts"],"names":[],"mappings":"AAeA,OAAO,EAAQ,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAI7D,OAAO,EAAuB,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAEtE,OAAO,
|
|
1
|
+
{"version":3,"file":"managed-server-application.d.ts","sourceRoot":"","sources":["../../src/server/managed-server-application.ts"],"names":[],"mappings":"AAeA,OAAO,EAAQ,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAI7D,OAAO,EAAuB,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAEtE,OAAO,EACL,eAAe,EACf,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC5B,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC;AACjF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAyBrE;;;GAGG;AACH,MAAM,WAAW,2BAA2B;IAG1C;;;OAGG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IAEjC;;;OAGG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IAEjC;;;OAGG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IAEjC;;;OAGG;IACH,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;CACpC;AAED;;;GAGG;AACH,MAAM,WAAW,+BAA+B;IAG9C;;;OAGG;IACH,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAE9B;;;OAGG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAEvB;;;;;;OAMG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB;;;OAGG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAE3B;;;;;;;;;;;;OAYG;IACH,QAAQ,CAAC,YAAY,EAAE,CAAC,OAAO,EAAE;QAG/B;;;WAGG;QACH,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AAE,MAAM,IAAI,GAAG,MAAM,IAAI;IAKtD;;;;;OAKG;IACH,oBAAoB,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI;IAItD;;;;;OAKG;IACH,mBAAmB,IAAI,MAAM,GAAG,SAAS;CA0C1C;AAED;;;;;GAKG;AACH,KAAK,WAAW,GAAG,sBAAsB,CAAC;AAE1C;;;;;GAKG;AACH,eAAO,MAAM,8BAA8B,EAAE,QAAQ,CAAC;IACpD;;;;;OAKG;IACH,YAAY,CAAC,WAAW,EAAE,wBAAwB,GAAG,SAAS,WAAW,EAAE,CAAC;IAE5E;;;;;OAKG;IACH,mBAAmB,CAAC,WAAW,EAAE,wBAAwB,GAAG,MAAM,GAAG,SAAS,CAAC;CAChF,CAoBC,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,8BAA8B,EAAE,QAAQ,CAAC;IACpD;;;;;OAKG;IACH,YAAY,CAAC,MAAM,EAAE,8BAA8B,GAAG,SAAS,WAAW,EAAE,CAAC;IAE7E;;;;;OAKG;IACH,mBAAmB,CAAC,MAAM,EAAE,8BAA8B,GAAG,MAAM,GAAG,SAAS,CAAC;IAEhF;;;;;OAKG;IACH,wBAAwB,CACtB,MAAM,EAAE,aAAa,EACrB,UAAU,EAAE,SAAS,4BAA4B,EAAE,GAClD,IAAI,CAAC;CACT,CAiCC,CAAC"}
|
|
@@ -18,7 +18,7 @@ import { fileURLToPath } from "node:url";
|
|
|
18
18
|
import { LogLayer, StructuredTransport } from "loglayer";
|
|
19
19
|
import { runningServerAccess } from "./server.js";
|
|
20
20
|
import { emitServerWarning } from "./server-log.js";
|
|
21
|
-
import { NodeCoordinator } from "./node-coordinator.js";
|
|
21
|
+
import { NodeCoordinator, } from "./node-coordinator.js";
|
|
22
22
|
import { managedDeliveryGate } from "./managed-delivery-gate.js";
|
|
23
23
|
import { managedChildSubscriptionAccess } from "./managed-child-subscription.js";
|
|
24
24
|
import { InMemorySubscriptionRegistry } from "../stand/subscription-registry.js";
|
|
@@ -188,7 +188,6 @@ class ManagedChildLifecycle {
|
|
|
188
188
|
this.#server = server;
|
|
189
189
|
}
|
|
190
190
|
/**
|
|
191
|
-
*
|
|
192
191
|
* Starts the child and waits for Coordinator activation.
|
|
193
192
|
*
|
|
194
193
|
* @returns A child handle after the private READY notification.
|
|
@@ -220,7 +219,6 @@ class ManagedChildLifecycle {
|
|
|
220
219
|
return { ready: true, close: () => this.close() };
|
|
221
220
|
}
|
|
222
221
|
/**
|
|
223
|
-
*
|
|
224
222
|
* Closes Delivery before closing the child listener and its server.
|
|
225
223
|
*
|
|
226
224
|
* @returns The shared close attempt; a failed attempt may be retried.
|
|
@@ -233,7 +231,6 @@ class ManagedChildLifecycle {
|
|
|
233
231
|
return this.#closing;
|
|
234
232
|
}
|
|
235
233
|
/**
|
|
236
|
-
*
|
|
237
234
|
* Performs child shutdown and observes a failed completion notification.
|
|
238
235
|
*
|
|
239
236
|
* @returns Completion after the child server closes.
|
|
@@ -253,7 +250,6 @@ class ManagedChildLifecycle {
|
|
|
253
250
|
}
|
|
254
251
|
}
|
|
255
252
|
/**
|
|
256
|
-
*
|
|
257
253
|
* Stops new child Delivery work and awaits admitted effects.
|
|
258
254
|
*
|
|
259
255
|
* @returns Completion when admitted work drains.
|
|
@@ -267,7 +263,6 @@ class ManagedChildLifecycle {
|
|
|
267
263
|
await runningServerAccess.drainDelivery(this.#server);
|
|
268
264
|
}
|
|
269
265
|
/**
|
|
270
|
-
*
|
|
271
266
|
* Waits for parent relay cancellation before closing the child listener.
|
|
272
267
|
*
|
|
273
268
|
* @returns Completion after final server close.
|
|
@@ -280,7 +275,6 @@ class ManagedChildLifecycle {
|
|
|
280
275
|
await this.#server.close();
|
|
281
276
|
}
|
|
282
277
|
/**
|
|
283
|
-
*
|
|
284
278
|
* Sends one child lifecycle notification on the private IPC channel.
|
|
285
279
|
*
|
|
286
280
|
* @param type The lifecycle phase to report.
|
|
@@ -364,7 +358,6 @@ export class ManagedServerCoordinator {
|
|
|
364
358
|
#onSignal;
|
|
365
359
|
#nodeCoordinator;
|
|
366
360
|
/**
|
|
367
|
-
*
|
|
368
361
|
* Creates a coordinator for one configured replica cohort.
|
|
369
362
|
*
|
|
370
363
|
* @param options Configures complete child application replicas.
|
|
@@ -384,7 +377,6 @@ export class ManagedServerCoordinator {
|
|
|
384
377
|
}));
|
|
385
378
|
}
|
|
386
379
|
/**
|
|
387
|
-
*
|
|
388
380
|
* Starts every initial replica and waits until all report READY.
|
|
389
381
|
*
|
|
390
382
|
* @returns The handle for the started managed cohort.
|
|
@@ -398,11 +390,41 @@ export class ManagedServerCoordinator {
|
|
|
398
390
|
for (const slot of this.#slots)
|
|
399
391
|
this.#start(slot);
|
|
400
392
|
await this.#ready;
|
|
393
|
+
await this.#openCoordinator();
|
|
394
|
+
/**
|
|
395
|
+
* Reports whether any managed replica has announced readiness.
|
|
396
|
+
*/
|
|
397
|
+
const isReady = () => this.#slots.some((slot) => slot.replica?.readyAt !== undefined);
|
|
398
|
+
const handle = {
|
|
399
|
+
/**
|
|
400
|
+
* Checks whether a managed application has reached the ready state.
|
|
401
|
+
*
|
|
402
|
+
* @returns Whether the application is ready.
|
|
403
|
+
*/ get ready() {
|
|
404
|
+
return isReady();
|
|
405
|
+
},
|
|
406
|
+
close: () => this.close(),
|
|
407
|
+
};
|
|
408
|
+
handleMembers.set(handle, this);
|
|
409
|
+
return handle;
|
|
410
|
+
}
|
|
411
|
+
/**
|
|
412
|
+
* Opens the reader-aware Coordinator after the first replica is ready.
|
|
413
|
+
*
|
|
414
|
+
* @returns Completion after the operation settles.
|
|
415
|
+
*/
|
|
416
|
+
async #openCoordinator() {
|
|
401
417
|
try {
|
|
402
418
|
const openCoordinator = this.#dependencies.openCoordinator;
|
|
403
419
|
if (openCoordinator !== undefined)
|
|
404
420
|
this.#nodeCoordinator = await openCoordinator({
|
|
405
421
|
members: this,
|
|
422
|
+
...(this.#options.readerAdmission === undefined
|
|
423
|
+
? {}
|
|
424
|
+
: { readerAdmission: this.#options.readerAdmission }),
|
|
425
|
+
...(this.#options.forwardingProof === undefined
|
|
426
|
+
? {}
|
|
427
|
+
: { forwardingProof: this.#options.forwardingProof }),
|
|
406
428
|
...(this.#options.host === undefined ? {} : { host: this.#options.host }),
|
|
407
429
|
...(this.#options.port === undefined ? {} : { port: this.#options.port }),
|
|
408
430
|
});
|
|
@@ -416,15 +438,6 @@ export class ManagedServerCoordinator {
|
|
|
416
438
|
}
|
|
417
439
|
throw error;
|
|
418
440
|
}
|
|
419
|
-
const isReady = () => this.#slots.some((slot) => slot.replica?.readyAt !== undefined);
|
|
420
|
-
const handle = {
|
|
421
|
-
get ready() {
|
|
422
|
-
return isReady();
|
|
423
|
-
},
|
|
424
|
-
close: () => this.close(),
|
|
425
|
-
};
|
|
426
|
-
handleMembers.set(handle, this);
|
|
427
|
-
return handle;
|
|
428
441
|
}
|
|
429
442
|
/**
|
|
430
443
|
* Starts a child for an available slot while respecting the concurrent-start limit.
|
|
@@ -689,7 +702,6 @@ export class ManagedServerCoordinator {
|
|
|
689
702
|
}
|
|
690
703
|
/**
|
|
691
704
|
* Fills available concurrent-start capacity with unscheduled empty slots.
|
|
692
|
-
*
|
|
693
705
|
*/
|
|
694
706
|
#drainStarts() {
|
|
695
707
|
for (const slot of this.#slots) {
|
|
@@ -700,7 +712,6 @@ export class ManagedServerCoordinator {
|
|
|
700
712
|
}
|
|
701
713
|
}
|
|
702
714
|
/**
|
|
703
|
-
*
|
|
704
715
|
* Stops managed children and prevents later replacement starts.
|
|
705
716
|
*
|
|
706
717
|
* @returns Completion after child and retired-child cleanup succeeds.
|
|
@@ -719,6 +730,8 @@ export class ManagedServerCoordinator {
|
|
|
719
730
|
}
|
|
720
731
|
/**
|
|
721
732
|
* Stops replacement starts and awaits all cleanup phases.
|
|
733
|
+
*
|
|
734
|
+
* @returns Completion after the operation settles.
|
|
722
735
|
*/
|
|
723
736
|
async #closeGracefully() {
|
|
724
737
|
this.#closing = true;
|
|
@@ -752,9 +765,11 @@ export class ManagedServerCoordinator {
|
|
|
752
765
|
}
|
|
753
766
|
/**
|
|
754
767
|
* Cancels relays, releases children, and closes the Coordinator after a drain attempt.
|
|
768
|
+
*
|
|
755
769
|
* @param replicas The active children being closed.
|
|
756
770
|
* @param children The already-running bounded child close attempts.
|
|
757
771
|
* @param failures Errors collected from the drain phase.
|
|
772
|
+
* @returns Completion after the operation settles.
|
|
758
773
|
*/
|
|
759
774
|
async #finishClose(replicas, children, failures) {
|
|
760
775
|
try {
|
|
@@ -880,7 +895,6 @@ export class ManagedServerCoordinator {
|
|
|
880
895
|
return termination;
|
|
881
896
|
}
|
|
882
897
|
/**
|
|
883
|
-
*
|
|
884
898
|
* Returns ready child facts to the next Coordinator slice.
|
|
885
899
|
*
|
|
886
900
|
* @returns The ready child topology facts.
|
|
@@ -1025,7 +1039,6 @@ export class ManagedServerCoordinator {
|
|
|
1025
1039
|
}
|
|
1026
1040
|
/**
|
|
1027
1041
|
* Calls listeners after the available child membership changes.
|
|
1028
|
-
*
|
|
1029
1042
|
*/
|
|
1030
1043
|
#notifyReadyMembers() {
|
|
1031
1044
|
for (const listener of this.#memberListeners)
|
|
@@ -1033,7 +1046,6 @@ export class ManagedServerCoordinator {
|
|
|
1033
1046
|
}
|
|
1034
1047
|
/**
|
|
1035
1048
|
* Registers managed shutdown handlers for SIGINT and SIGTERM once.
|
|
1036
|
-
*
|
|
1037
1049
|
*/
|
|
1038
1050
|
#installSignalHandlers() {
|
|
1039
1051
|
if (this.#onSignal !== undefined)
|
|
@@ -1057,7 +1069,6 @@ export class ManagedServerCoordinator {
|
|
|
1057
1069
|
}
|
|
1058
1070
|
/**
|
|
1059
1071
|
* Unregisters managed shutdown handlers when the coordinator closes.
|
|
1060
|
-
*
|
|
1061
1072
|
*/
|
|
1062
1073
|
#removeSignalHandlers() {
|
|
1063
1074
|
if (this.#onSignal === undefined)
|
|
@@ -1458,7 +1469,12 @@ const ManagedServerCoordinatorValues = Object.freeze({
|
|
|
1458
1469
|
});
|
|
1459
1470
|
},
|
|
1460
1471
|
});
|
|
1461
|
-
|
|
1472
|
+
/**
|
|
1473
|
+
* Accepts only a canonical local endpoint for a managed child.
|
|
1474
|
+
*
|
|
1475
|
+
* @param value Candidate managed-child endpoint URL.
|
|
1476
|
+
* @returns The canonical endpoint, or undefined if invalid.
|
|
1477
|
+
*/ function canonicalLoopbackEndpoint(value) {
|
|
1462
1478
|
if (Buffer.byteLength(value, "utf8") > endpointMaximumBytes)
|
|
1463
1479
|
return undefined;
|
|
1464
1480
|
try {
|