@zlink-systems/framework 0.21.0 → 0.22.0
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/.tsbuildinfo +1 -1
- package/dist/contracts/Common/ZLinkMessage.js +5 -5
- package/dist/contracts/Configuration/CodecContentType.js +5 -7
- package/dist/contracts/Configuration/DiagnosticsValidation.js +1 -6
- package/dist/contracts/Configuration/EndpointNotation.js +4 -8
- package/dist/contracts/Configuration/Registration.js +14 -11
- package/dist/contracts/Configuration/RegistrationBuilders.js +32 -25
- package/dist/contracts/Configuration/RegistrationNormalizers.js +25 -26
- package/dist/contracts/Configuration/RegistrationValidators.js +36 -38
- package/dist/contracts/Configuration/SendTimeoutValidation.js +4 -4
- package/dist/contracts/Configuration/TimerRegistrationValidator.js +7 -7
- package/dist/contracts/Handlers/JsonContract.js +23 -11
- package/dist/contracts/Spots/SpotKind.js +16 -8
- package/dist/location-store-integration.js +16 -16
- package/dist/nest-integration.js +17 -11
- package/dist/runtime/abort.js +9 -5
- package/dist/runtime/actors/actor-authority-payload-codec.js +12 -16
- package/dist/runtime/actors/actor-authority-publication.js +18 -17
- package/dist/runtime/actors/actor-client.js +83 -63
- package/dist/runtime/actors/actor-context.js +24 -18
- package/dist/runtime/actors/actor-creation.js +4 -3
- package/dist/runtime/actors/actor-handoff.js +89 -92
- package/dist/runtime/actors/actor-local-native-join.js +18 -19
- package/dist/runtime/actors/actor-mailbox.js +1 -1
- package/dist/runtime/actors/actor-message-follow-context.js +24 -21
- package/dist/runtime/actors/actor-packet-relay-wire.js +1 -3
- package/dist/runtime/actors/actor-remote-joiner.js +20 -17
- package/dist/runtime/actors/actor-remote-wire.js +6 -7
- package/dist/runtime/actors/actor-runtime-state.js +87 -81
- package/dist/runtime/actors/actor-transfer-registry.js +3 -5
- package/dist/runtime/actors/bound-session-wire.js +14 -9
- package/dist/runtime/actors/deferred-join-accepted-journal.js +158 -124
- package/dist/runtime/actors/index.js +2 -5
- package/dist/runtime/actors/post-commit-actor-binder.js +3 -6
- package/dist/runtime/actors/post-commit-actor-location.js +1 -1
- package/dist/runtime/actors/spot-actor-dispatch.js +5 -5
- package/dist/runtime/actors/transferred-actor-rollback.js +4 -4
- package/dist/runtime/admission.js +2 -6
- package/dist/runtime/application-jobs/application-ingress-record-owner.js +2 -6
- package/dist/runtime/application-jobs/receive-flow-controller.js +11 -12
- package/dist/runtime/backend/mesh-completion-table.js +1 -3
- package/dist/runtime/backend/mesh-dispatch-pump.js +12 -16
- package/dist/runtime/backend/node/node-backend-adapter-factory.js +1 -3
- package/dist/runtime/backend/node/node-backend-adapter-support.js +26 -17
- package/dist/runtime/backend/node/node-mesh-backend-adapter.js +4 -3
- package/dist/runtime/backend/node/node-raw-binding-port.js +7 -6
- package/dist/runtime/backend/node/node-raw-mesh-backend.js +116 -113
- package/dist/runtime/backend/node/node-socket-backend-adapter.js +12 -13
- package/dist/runtime/backend/runtime-message.js +3 -3
- package/dist/runtime/backend/runtime-values.d.ts +2 -2
- package/dist/runtime/backend/runtime-values.js +4 -5
- package/dist/runtime/channels/channel-clients.js +27 -24
- package/dist/runtime/channels/channel-dispatch-pipeline.js +10 -18
- package/dist/runtime/channels/channel-dispatch-services.js +7 -4
- package/dist/runtime/channels/channel-dispatchers.js +9 -9
- package/dist/runtime/channels/channel-envelope-inspection.js +16 -13
- package/dist/runtime/channels/channel-envelope.js +83 -47
- package/dist/runtime/channels/channel-outbound-operations.js +8 -8
- package/dist/runtime/channels/channel-receive-loops.js +20 -22
- package/dist/runtime/channels/channel-receive-task-tracker.js +1 -1
- package/dist/runtime/channels/channel-runtime-lifecycle.js +61 -56
- package/dist/runtime/channels/channel-runtime-manager.js +18 -9
- package/dist/runtime/channels/channel-socket-registry.js +126 -123
- package/dist/runtime/channels/channel-transports.js +43 -33
- package/dist/runtime/channels/client-server-location-runtime.js +32 -40
- package/dist/runtime/channels/client-server-service-wire.js +29 -22
- package/dist/runtime/channels/dispatch-error-reporter.js +9 -7
- package/dist/runtime/channels/fanout-location-runtime.js +34 -47
- package/dist/runtime/channels/fanout-service-wire.js +3 -5
- package/dist/runtime/channels/local-spot-route-transport.js +7 -1
- package/dist/runtime/channels/route-member-snapshot.js +3 -3
- package/dist/runtime/channels/source-spot-router.js +6 -2
- package/dist/runtime/channels/spot-route-bridge-transport.js +5 -2
- package/dist/runtime/channels/spot-route-dispatch-strategy.js +2 -2
- package/dist/runtime/channels/spot-route-target-resolver.js +6 -6
- package/dist/runtime/diagnostics/index.js +38 -10
- package/dist/runtime/diagnostics/message-flow.js +47 -39
- package/dist/runtime/diagnostics/runtime-metrics.js +18 -9
- package/dist/runtime/diagnostics/runtime-observation-queue.js +8 -10
- package/dist/runtime/diagnostics/topology-runtime-projections.js +17 -10
- package/dist/runtime/execution/index.js +7 -6
- package/dist/runtime/execution/serial-execution-queue.js +12 -18
- package/dist/runtime/execution/state-lane.js +2 -2
- package/dist/runtime/foundation/actor-join-recovery-codec.js +31 -23
- package/dist/runtime/foundation/event-loop-resources.js +4 -4
- package/dist/runtime/foundation/message-follow-suppression-registry.js +4 -4
- package/dist/runtime/foundation/raw-service-mesh-runtime.js +136 -136
- package/dist/runtime/foundation/route-mesh-connection-policy.js +4 -4
- package/dist/runtime/foundation/runtime-state-projections.js +22 -11
- package/dist/runtime/foundation/service-authority-payload-codec.js +13 -15
- package/dist/runtime/foundation/service-discovery-registry.js +35 -33
- package/dist/runtime/foundation/service-instance-activation-recovery-codec.js +20 -22
- package/dist/runtime/foundation/service-liveness-registry.js +16 -12
- package/dist/runtime/foundation/service-maintenance-runtime.js +2 -4
- package/dist/runtime/foundation/service-relocation-aggregate-committer.js +24 -24
- package/dist/runtime/foundation/service-relocation-object-owner.js +6 -6
- package/dist/runtime/foundation/service-relocation-runtime.js +137 -94
- package/dist/runtime/foundation/service-runtime-contracts.js +5 -5
- package/dist/runtime/foundation/service-stateful-registry.js +24 -23
- package/dist/runtime/foundation/service-stateful-runtime.js +416 -438
- package/dist/runtime/foundation/service-stateful-wire-codec.js +95 -98
- package/dist/runtime/foundation/service-topology-registry.js +96 -95
- package/dist/runtime/foundation/service-weighted-selection.js +6 -11
- package/dist/runtime/foundation/service-wire-binary-primitives.js +5 -6
- package/dist/runtime/foundation/service-wire-m6a-codec.js +46 -35
- package/dist/runtime/framework-errors-internal.js +7 -10
- package/dist/runtime/handlers/handler-instance-scope.js +4 -5
- package/dist/runtime/handlers/index.js +3 -1
- package/dist/runtime/host/actor-packet-relay.js +74 -70
- package/dist/runtime/host/actor-placement-coordinator.js +29 -31
- package/dist/runtime/host/actor-runtime-options-factory.js +12 -14
- package/dist/runtime/host/actor-transfer-authority-runtime.js +7 -9
- package/dist/runtime/host/actor-transfer-runtime.js +176 -153
- package/dist/runtime/host/application-job-queue.js +18 -22
- package/dist/runtime/host/bound-session-relay.js +3 -1
- package/dist/runtime/host/channel-runtime-options-factory.js +31 -14
- package/dist/runtime/host/host-capacity-status.js +8 -4
- package/dist/runtime/host/index.js +244 -227
- package/dist/runtime/host/instance-activation-authority.js +93 -96
- package/dist/runtime/host/location-runtime-owner.js +16 -14
- package/dist/runtime/host/mesh-router-resolver.js +11 -13
- package/dist/runtime/host/relocation-direct-transfer.js +10 -9
- package/dist/runtime/host/remote-actor-join-receiver.js +20 -15
- package/dist/runtime/host/remote-actor-packet-target-store.js +18 -22
- package/dist/runtime/host/remote-bound-session-relay.js +97 -73
- package/dist/runtime/host/route-mesh-runtime.js +64 -69
- package/dist/runtime/host/runtime-shutdown.js +1 -2
- package/dist/runtime/host/service-relocation-host-runtime.js +586 -511
- package/dist/runtime/host/spot-address-transport.js +69 -71
- package/dist/runtime/host/spot-runtime-options-factory.js +30 -29
- package/dist/runtime/host/stateful-authority-route-runtime.js +65 -68
- package/dist/runtime/host/user-spot-creation-coordinator.js +61 -67
- package/dist/runtime/locations/actor-location-claims.js +26 -20
- package/dist/runtime/locations/aggregate-inventory-store.js +72 -75
- package/dist/runtime/locations/authority-key-codec.js +7 -7
- package/dist/runtime/locations/auto-connect-loop.js +3 -3
- package/dist/runtime/locations/auto-connect-planner.js +25 -19
- package/dist/runtime/locations/auto-connect-reconciler.js +51 -31
- package/dist/runtime/locations/in-memory-authority-store.js +128 -118
- package/dist/runtime/locations/in-memory-location-store.js +195 -168
- package/dist/runtime/locations/in-memory-provider-location-store.js +8 -10
- package/dist/runtime/locations/key-codec.js +1 -1
- package/dist/runtime/locations/lease-tracker.js +23 -21
- package/dist/runtime/locations/lifecycle.js +4 -5
- package/dist/runtime/locations/location-store-repository.js +368 -324
- package/dist/runtime/locations/opaque-record-key.js +2 -2
- package/dist/runtime/locations/resolvers.js +73 -82
- package/dist/runtime/locations/runtime.js +68 -63
- package/dist/runtime/locations/spot-location-claims.js +39 -35
- package/dist/runtime/messaging/framework-json-v1.js +7 -7
- package/dist/runtime/messaging/packet-name.js +7 -6
- package/dist/runtime/messaging/payload-codec.js +21 -18
- package/dist/runtime/protocol/service_wire_codec.generated.d.ts +30 -2
- package/dist/runtime/protocol/service_wire_codec.generated.js +1671 -234
- package/dist/runtime/routing-id.js +3 -5
- package/dist/runtime/spots/formal-remote-actor-admission-registry.js +35 -31
- package/dist/runtime/spots/formal-remote-actor-transfer-registry.js +1 -2
- package/dist/runtime/spots/index.js +208 -219
- package/dist/runtime/spots/spot-activation-registry.js +15 -14
- package/dist/runtime/spots/spot-activation-state.js +17 -15
- package/dist/runtime/spots/spot-activation.js +33 -16
- package/dist/runtime/spots/spot-actor-admission-coordinator.js +18 -15
- package/dist/runtime/spots/spot-actor-membership.js +1 -3
- package/dist/runtime/spots/spot-actor-packet-dispatch.js +23 -20
- package/dist/runtime/spots/spot-actor-packet-drain.js +12 -10
- package/dist/runtime/spots/spot-actor-packet-relay-dispatch.js +10 -6
- package/dist/runtime/spots/spot-closing.js +3 -7
- package/dist/runtime/spots/spot-context.js +2 -2
- package/dist/runtime/spots/spot-entry-activation.js +13 -14
- package/dist/runtime/spots/spot-handle.js +6 -3
- package/dist/runtime/spots/spot-handler-registry.js +12 -12
- package/dist/runtime/spots/spot-manager-public.js +5 -6
- package/dist/runtime/spots/spot-native-actor-join-admission.js +4 -3
- package/dist/runtime/spots/spot-node-autoconnect.js +15 -18
- package/dist/runtime/spots/spot-node-runtime-manager.js +74 -85
- package/dist/runtime/spots/spot-outbound.js +10 -14
- package/dist/runtime/spots/spot-remote-codec.js +22 -26
- package/dist/runtime/spots/spot-remote-route-codec.js +5 -7
- package/dist/runtime/spots/spot-route-packet-dispatch.js +16 -14
- package/dist/runtime/spots/spot-route-replies.js +4 -6
- package/dist/runtime/spots/spot-routed-actor-admission.js +9 -7
- package/dist/runtime/spots/spot-routed-bound-session-dispatch.js +1 -2
- package/dist/runtime/spots/spot-routed-frame-dispatch.js +5 -5
- package/dist/runtime/spots/spot-routed-spot-packet-dispatch.js +14 -10
- package/dist/runtime/spots/spot-serial-executor.js +5 -8
- package/dist/runtime/spots/spot-serial-turn-executor.js +4 -6
- package/dist/runtime/spots/spot-subscription-dispatch.js +5 -5
- package/dist/runtime/spots/spot-timer.js +25 -29
- package/dist/runtime/streams/actor-session-binding-registry.js +98 -107
- package/dist/runtime/streams/actor-session-lifecycle-coordinator.js +3 -1
- package/dist/runtime/streams/bound-actor-relay-sender.js +18 -16
- package/dist/runtime/streams/bound-session-service.js +8 -9
- package/dist/runtime/streams/index.js +20 -19
- package/dist/runtime/streams/managed-stream.js +32 -30
- package/dist/runtime/streams/native-fallback-bound-session.js +21 -17
- package/dist/runtime/streams/protocol.js +29 -18
- package/dist/runtime/streams/session-actor-coordinator.js +34 -37
- package/dist/runtime/streams/session-context.js +30 -28
- package/dist/runtime/streams/session-provider.js +2 -2
- package/dist/runtime/streams/session-serial-executor.js +1 -2
- package/dist/runtime/streams/stream-frame-factory.js +11 -5
- package/dist/runtime/streams/stream-session-runtime.js +70 -66
- package/dist/runtime/workers/index.js +15 -4
- package/package.json +2 -2
- package/src/contracts/Channels/RouteCalls.ts +6 -1
- package/src/contracts/Common/ZLinkMessage.ts +5 -5
- package/src/contracts/Common/ZLinkMessageMetadata.ts +4 -3
- package/src/contracts/Configuration/Builders.ts +14 -14
- package/src/contracts/Configuration/CodecContentType.ts +8 -10
- package/src/contracts/Configuration/DiagnosticsValidation.ts +1 -6
- package/src/contracts/Configuration/EndpointNotation.ts +11 -11
- package/src/contracts/Configuration/ObjectRoles.ts +1 -3
- package/src/contracts/Configuration/Registration.ts +46 -17
- package/src/contracts/Configuration/RegistrationBuilderPolicy.ts +10 -8
- package/src/contracts/Configuration/RegistrationBuilders.ts +107 -96
- package/src/contracts/Configuration/RegistrationCodecRegistry.ts +9 -3
- package/src/contracts/Configuration/RegistrationNormalizers.ts +116 -84
- package/src/contracts/Configuration/RegistrationTypes.ts +21 -25
- package/src/contracts/Configuration/RegistrationValidators.ts +122 -73
- package/src/contracts/Configuration/RouteChannelInternalState.ts +1 -4
- package/src/contracts/Configuration/RuntimeEndpointConnections.ts +4 -1
- package/src/contracts/Configuration/SendTimeoutValidation.ts +6 -4
- package/src/contracts/Configuration/TimerRegistrationValidator.ts +8 -13
- package/src/contracts/Dispatch/ZLinkDispatchOptions.ts +1 -6
- package/src/contracts/Errors/index.ts +1 -4
- package/src/contracts/Handlers/Attributes.ts +15 -9
- package/src/contracts/Handlers/IZLinkChannelHandlers.ts +24 -4
- package/src/contracts/Handlers/JsonContract.ts +53 -19
- package/src/contracts/Locations/ActorTransfer.ts +1 -5
- package/src/contracts/Locations/Authority.ts +4 -11
- package/src/contracts/Locations/Keys.ts +6 -1
- package/src/contracts/Locations/Options.ts +3 -2
- package/src/contracts/Locations/RelocationStore.ts +1 -4
- package/src/contracts/Locations/Resolvers.ts +5 -5
- package/src/contracts/Locations/RuntimeQuery.ts +6 -2
- package/src/contracts/Locations/Stores.ts +1 -2
- package/src/contracts/Locations/index.ts +2 -8
- package/src/contracts/RouteMesh/Contracts.ts +1 -7
- package/src/contracts/RouteMesh/RuntimeTopology.ts +1 -4
- package/src/contracts/Spots/Contracts.ts +2 -8
- package/src/contracts/Spots/SpotKind.ts +16 -8
- package/src/contracts/Spots/ZLinkSpot.ts +8 -11
- package/src/contracts/Streams/IZLinkSession.ts +0 -1
- package/src/contracts/Streams/IZLinkSessionActor.ts +5 -1
- package/src/contracts/Streams/IZLinkSessionPacketHandler.ts +5 -1
- package/src/internal.ts +5 -4
- package/src/location-store-integration.ts +24 -16
- package/src/nest-integration.ts +40 -25
- package/src/runtime/abort.ts +10 -4
- package/src/runtime/actors/actor-authority-payload-codec.ts +20 -29
- package/src/runtime/actors/actor-authority-publication.ts +92 -77
- package/src/runtime/actors/actor-client.ts +162 -133
- package/src/runtime/actors/actor-context.ts +138 -130
- package/src/runtime/actors/actor-creation.ts +47 -44
- package/src/runtime/actors/actor-execution-context.ts +6 -4
- package/src/runtime/actors/actor-handoff.ts +269 -293
- package/src/runtime/actors/actor-join-deferred-scope.ts +5 -4
- package/src/runtime/actors/actor-lifecycle-snapshot.ts +5 -8
- package/src/runtime/actors/actor-local-native-join.ts +131 -159
- package/src/runtime/actors/actor-mailbox.ts +16 -19
- package/src/runtime/actors/actor-message-follow-context.ts +46 -36
- package/src/runtime/actors/actor-packet-relay-wire.ts +32 -21
- package/src/runtime/actors/actor-remote-joiner.ts +50 -54
- package/src/runtime/actors/actor-remote-wire.ts +9 -13
- package/src/runtime/actors/actor-routed-join-transport.ts +10 -2
- package/src/runtime/actors/actor-runtime-contracts.ts +2 -5
- package/src/runtime/actors/actor-runtime-state.ts +127 -124
- package/src/runtime/actors/actor-transfer-registry.ts +9 -14
- package/src/runtime/actors/actor-transport-delivery-gate.ts +4 -6
- package/src/runtime/actors/bound-session-wire.ts +37 -17
- package/src/runtime/actors/deferred-join-accepted-journal.ts +351 -320
- package/src/runtime/actors/index.ts +43 -86
- package/src/runtime/actors/post-commit-actor-binder.ts +10 -10
- package/src/runtime/actors/post-commit-actor-location.ts +30 -23
- package/src/runtime/actors/spot-actor-dispatch.ts +78 -53
- package/src/runtime/actors/transferred-actor-rollback.ts +18 -13
- package/src/runtime/admission.ts +9 -9
- package/src/runtime/application-jobs/application-ingress-record-owner.ts +5 -15
- package/src/runtime/application-jobs/application-job-queue-handler-start-gate.ts +3 -2
- package/src/runtime/application-jobs/receive-flow-controller.ts +17 -14
- package/src/runtime/backend/contracts/index.ts +73 -52
- package/src/runtime/backend/mesh-actor-session-node-adapter.ts +4 -14
- package/src/runtime/backend/mesh-completion-table.ts +6 -9
- package/src/runtime/backend/mesh-dispatch-pump.ts +38 -30
- package/src/runtime/backend/node/node-backend-adapter-factory.ts +23 -21
- package/src/runtime/backend/node/node-backend-adapter-support.ts +36 -22
- package/src/runtime/backend/node/node-dealer-channel-client-transport.ts +59 -58
- package/src/runtime/backend/node/node-event-loop-poller.ts +2 -10
- package/src/runtime/backend/node/node-mesh-backend-adapter.ts +12 -5
- package/src/runtime/backend/node/node-monitor-backend-adapter.ts +4 -3
- package/src/runtime/backend/node/node-raw-binding-port.ts +29 -29
- package/src/runtime/backend/node/node-raw-mesh-backend.ts +335 -383
- package/src/runtime/backend/node/node-socket-backend-adapter.ts +101 -54
- package/src/runtime/backend/runtime-message.ts +5 -3
- package/src/runtime/backend/runtime-values.ts +10 -7
- package/src/runtime/channels/channel-autoconnect.ts +1 -4
- package/src/runtime/channels/channel-clients.ts +93 -73
- package/src/runtime/channels/channel-dispatch-pipeline.ts +40 -42
- package/src/runtime/channels/channel-dispatch-services.ts +51 -49
- package/src/runtime/channels/channel-dispatchers.ts +152 -96
- package/src/runtime/channels/channel-envelope-inspection.ts +20 -16
- package/src/runtime/channels/channel-envelope.ts +256 -150
- package/src/runtime/channels/channel-multipart.ts +13 -5
- package/src/runtime/channels/channel-outbound-operations.ts +37 -41
- package/src/runtime/channels/channel-receive-loops.ts +102 -98
- package/src/runtime/channels/channel-receive-task-tracker.ts +1 -1
- package/src/runtime/channels/channel-runtime-lifecycle.ts +248 -190
- package/src/runtime/channels/channel-runtime-manager.ts +63 -37
- package/src/runtime/channels/channel-socket-options.ts +3 -10
- package/src/runtime/channels/channel-socket-registry.ts +331 -273
- package/src/runtime/channels/channel-transports.ts +215 -197
- package/src/runtime/channels/client-server-location-runtime.ts +116 -100
- package/src/runtime/channels/client-server-service-wire.ts +37 -36
- package/src/runtime/channels/dispatch-error-reporter.ts +11 -8
- package/src/runtime/channels/fanout-location-runtime.ts +91 -94
- package/src/runtime/channels/fanout-service-wire.ts +5 -12
- package/src/runtime/channels/handler-filter-scope.ts +1 -4
- package/src/runtime/channels/index.ts +1 -4
- package/src/runtime/channels/local-spot-route-transport.ts +20 -5
- package/src/runtime/channels/route-member-snapshot.ts +11 -5
- package/src/runtime/channels/router-socket-spot-route-transport.ts +1 -7
- package/src/runtime/channels/source-spot-router.ts +26 -22
- package/src/runtime/channels/spot-direct-envelope.ts +10 -8
- package/src/runtime/channels/spot-node-route-transport.ts +13 -16
- package/src/runtime/channels/spot-route-bridge-transport.ts +26 -9
- package/src/runtime/channels/spot-route-dispatch-strategy.ts +40 -13
- package/src/runtime/channels/spot-route-target-resolver.ts +18 -9
- package/src/runtime/codecs/index.ts +3 -2
- package/src/runtime/diagnostics/flow-context.ts +12 -3
- package/src/runtime/diagnostics/index.ts +96 -61
- package/src/runtime/diagnostics/internal-event-contracts.ts +87 -33
- package/src/runtime/diagnostics/message-flow.ts +95 -76
- package/src/runtime/diagnostics/runtime-metrics.ts +46 -24
- package/src/runtime/diagnostics/runtime-observation-queue.ts +17 -28
- package/src/runtime/diagnostics/topology-runtime-projections.ts +62 -43
- package/src/runtime/execution/index.ts +18 -26
- package/src/runtime/execution/serial-execution-queue.ts +31 -40
- package/src/runtime/execution/state-lane.ts +2 -2
- package/src/runtime/foundation/actor-join-recovery-codec.ts +69 -51
- package/src/runtime/foundation/event-loop-resources.ts +8 -4
- package/src/runtime/foundation/message-follow-suppression-registry.ts +7 -14
- package/src/runtime/foundation/operation-identity.ts +1 -2
- package/src/runtime/foundation/operation-registry.ts +8 -2
- package/src/runtime/foundation/raw-service-mesh-runtime.ts +312 -385
- package/src/runtime/foundation/route-mesh-connection-policy.ts +7 -8
- package/src/runtime/foundation/runtime-state-projections.ts +24 -23
- package/src/runtime/foundation/service-authority-payload-codec.ts +54 -57
- package/src/runtime/foundation/service-discovery-registry.ts +67 -59
- package/src/runtime/foundation/service-instance-activation-recovery-codec.ts +28 -29
- package/src/runtime/foundation/service-liveness-registry.ts +18 -13
- package/src/runtime/foundation/service-mailbox.ts +14 -14
- package/src/runtime/foundation/service-maintenance-runtime.ts +22 -21
- package/src/runtime/foundation/service-metadata-codec.ts +2 -9
- package/src/runtime/foundation/service-relocation-aggregate-committer.ts +39 -36
- package/src/runtime/foundation/service-relocation-coordinator.ts +1 -4
- package/src/runtime/foundation/service-relocation-object-owner.ts +40 -58
- package/src/runtime/foundation/service-relocation-runtime.ts +292 -216
- package/src/runtime/foundation/service-runtime-contracts.ts +8 -8
- package/src/runtime/foundation/service-session-binding-ingress-port.ts +1 -4
- package/src/runtime/foundation/service-stateful-registry.ts +69 -59
- package/src/runtime/foundation/service-stateful-runtime.ts +1174 -1112
- package/src/runtime/foundation/service-stateful-wire-codec.ts +318 -270
- package/src/runtime/foundation/service-topology-registry.ts +157 -159
- package/src/runtime/foundation/service-weighted-selection.ts +9 -15
- package/src/runtime/foundation/service-wire-binary-primitives.ts +6 -12
- package/src/runtime/foundation/service-wire-m6a-codec.ts +69 -47
- package/src/runtime/framework-errors-internal.ts +31 -30
- package/src/runtime/handlers/handler-instance-scope.ts +18 -29
- package/src/runtime/handlers/index.ts +18 -8
- package/src/runtime/host/actor-packet-relay.ts +290 -261
- package/src/runtime/host/actor-placement-coordinator.ts +165 -150
- package/src/runtime/host/actor-runtime-options-factory.ts +89 -87
- package/src/runtime/host/actor-transfer-authority-runtime.ts +46 -38
- package/src/runtime/host/actor-transfer-runtime.ts +391 -395
- package/src/runtime/host/application-job-queue.ts +32 -48
- package/src/runtime/host/bound-session-relay.ts +7 -9
- package/src/runtime/host/channel-runtime-options-factory.ts +75 -35
- package/src/runtime/host/host-capacity-status.ts +10 -9
- package/src/runtime/host/index.ts +861 -789
- package/src/runtime/host/instance-activation-authority.ts +125 -143
- package/src/runtime/host/location-runtime-owner.ts +38 -26
- package/src/runtime/host/mesh-router-resolver.ts +30 -23
- package/src/runtime/host/relocation-direct-transfer.ts +15 -15
- package/src/runtime/host/relocation-integrity-fault-gate.ts +3 -2
- package/src/runtime/host/remote-actor-join-receiver.ts +43 -34
- package/src/runtime/host/remote-actor-packet-target-store.ts +54 -52
- package/src/runtime/host/remote-bound-session-relay.ts +274 -247
- package/src/runtime/host/route-mesh-runtime-options.ts +1 -3
- package/src/runtime/host/route-mesh-runtime.ts +227 -181
- package/src/runtime/host/runtime-shutdown.ts +4 -3
- package/src/runtime/host/service-relocation-control.ts +14 -5
- package/src/runtime/host/service-relocation-host-runtime.ts +1388 -1165
- package/src/runtime/host/spot-address-transport.ts +284 -237
- package/src/runtime/host/spot-node-runtime-options-factory.ts +14 -8
- package/src/runtime/host/spot-runtime-options-factory.ts +71 -62
- package/src/runtime/host/stateful-authority-route-runtime.ts +117 -116
- package/src/runtime/host/user-spot-creation-coordinator.ts +225 -220
- package/src/runtime/locations/actor-location-claims.ts +61 -49
- package/src/runtime/locations/actor-session-route-claims.ts +1 -4
- package/src/runtime/locations/aggregate-inventory-store.ts +105 -134
- package/src/runtime/locations/authority-key-codec.ts +13 -10
- package/src/runtime/locations/auto-connect-loop.ts +14 -11
- package/src/runtime/locations/auto-connect-planner.ts +42 -31
- package/src/runtime/locations/auto-connect-reconciler.ts +106 -63
- package/src/runtime/locations/canonical-codec.ts +3 -1
- package/src/runtime/locations/creation-operation-id.ts +4 -3
- package/src/runtime/locations/domain-store-contract.ts +13 -7
- package/src/runtime/locations/in-memory-authority-store.ts +232 -199
- package/src/runtime/locations/in-memory-location-store.ts +432 -250
- package/src/runtime/locations/in-memory-provider-location-store.ts +16 -17
- package/src/runtime/locations/internal-store-contracts.ts +95 -38
- package/src/runtime/locations/key-codec.ts +3 -4
- package/src/runtime/locations/lease-tracker.ts +36 -27
- package/src/runtime/locations/lifecycle-runtime.ts +15 -3
- package/src/runtime/locations/lifecycle.ts +33 -28
- package/src/runtime/locations/location-store-repository.ts +1329 -1185
- package/src/runtime/locations/opaque-record-key.ts +4 -9
- package/src/runtime/locations/resolvers.ts +201 -178
- package/src/runtime/locations/runtime.ts +251 -159
- package/src/runtime/locations/spot-location-claims.ts +110 -112
- package/src/runtime/messaging/creation-payload-codec.ts +4 -1
- package/src/runtime/messaging/framework-json-v1.ts +34 -15
- package/src/runtime/messaging/packet-name.ts +8 -6
- package/src/runtime/messaging/payload-codec.ts +70 -50
- package/src/runtime/messaging/submission-result.ts +6 -9
- package/src/runtime/protocol/service_wire_codec.generated.ts +1376 -159
- package/src/runtime/protocol/service_wire_pilot_codec.generated.ts +1 -1
- package/src/runtime/routing-id.ts +10 -7
- package/src/runtime/spots/formal-remote-actor-admission-registry.ts +56 -62
- package/src/runtime/spots/formal-remote-actor-transfer-registry.ts +23 -20
- package/src/runtime/spots/index.ts +593 -563
- package/src/runtime/spots/spot-activation-registry.ts +38 -34
- package/src/runtime/spots/spot-activation-state.ts +43 -51
- package/src/runtime/spots/spot-activation.ts +179 -116
- package/src/runtime/spots/spot-actor-admission-coordinator.ts +110 -78
- package/src/runtime/spots/spot-actor-join-dispatch.ts +57 -41
- package/src/runtime/spots/spot-actor-lifecycle-drain.ts +5 -7
- package/src/runtime/spots/spot-actor-membership.ts +25 -27
- package/src/runtime/spots/spot-actor-packet-dispatch.ts +184 -153
- package/src/runtime/spots/spot-actor-packet-drain.ts +54 -42
- package/src/runtime/spots/spot-actor-packet-relay-dispatch.ts +37 -39
- package/src/runtime/spots/spot-closing.ts +11 -12
- package/src/runtime/spots/spot-context.ts +46 -26
- package/src/runtime/spots/spot-entry-activation.ts +84 -65
- package/src/runtime/spots/spot-handle.ts +17 -15
- package/src/runtime/spots/spot-handler-registry.ts +44 -31
- package/src/runtime/spots/spot-location-claim.ts +5 -4
- package/src/runtime/spots/spot-manager-public.ts +62 -82
- package/src/runtime/spots/spot-native-actor-join-admission.ts +20 -16
- package/src/runtime/spots/spot-node-autoconnect.ts +54 -61
- package/src/runtime/spots/spot-node-runtime-manager.ts +230 -221
- package/src/runtime/spots/spot-outbound.ts +47 -59
- package/src/runtime/spots/spot-publisher-transport.ts +5 -4
- package/src/runtime/spots/spot-remote-codec.ts +66 -65
- package/src/runtime/spots/spot-remote-route-codec.ts +61 -41
- package/src/runtime/spots/spot-route-packet-dispatch.ts +128 -95
- package/src/runtime/spots/spot-route-replies.ts +23 -24
- package/src/runtime/spots/spot-route-reply-wire.ts +3 -2
- package/src/runtime/spots/spot-routed-actor-admission.ts +37 -27
- package/src/runtime/spots/spot-routed-bound-session-dispatch.ts +11 -17
- package/src/runtime/spots/spot-routed-frame-dispatch.ts +18 -15
- package/src/runtime/spots/spot-routed-spot-packet-dispatch.ts +35 -26
- package/src/runtime/spots/spot-routing-internal.ts +1 -4
- package/src/runtime/spots/spot-runtime-ports.ts +5 -5
- package/src/runtime/spots/spot-serial-executor.ts +5 -9
- package/src/runtime/spots/spot-serial-turn-executor.ts +19 -26
- package/src/runtime/spots/spot-subscription-dispatch.ts +56 -46
- package/src/runtime/spots/spot-timer.ts +98 -91
- package/src/runtime/streams/actor-session-binding-registry.ts +277 -235
- package/src/runtime/streams/actor-session-binding-runtime-owner.ts +7 -4
- package/src/runtime/streams/actor-session-lifecycle-coordinator.ts +3 -1
- package/src/runtime/streams/bound-actor-relay-sender.ts +53 -51
- package/src/runtime/streams/bound-session-response-target.ts +29 -8
- package/src/runtime/streams/bound-session-service.ts +39 -39
- package/src/runtime/streams/index.ts +176 -100
- package/src/runtime/streams/managed-stream.ts +98 -87
- package/src/runtime/streams/native-fallback-bound-session.ts +57 -52
- package/src/runtime/streams/protocol.ts +73 -43
- package/src/runtime/streams/session-actor-coordinator.ts +97 -89
- package/src/runtime/streams/session-calls.ts +2 -8
- package/src/runtime/streams/session-context.ts +66 -48
- package/src/runtime/streams/session-provider.ts +5 -7
- package/src/runtime/streams/session-serial-executor.ts +7 -6
- package/src/runtime/streams/stream-binding-runtime-ports.ts +79 -29
- package/src/runtime/streams/stream-frame-factory.ts +55 -38
- package/src/runtime/streams/stream-session-runtime.ts +268 -210
- package/src/runtime/workers/index.ts +68 -29
|
@@ -32,7 +32,11 @@ import type {
|
|
|
32
32
|
export * from './RegistrationTypes';
|
|
33
33
|
import { validateFrameworkRegistration } from './RegistrationValidators';
|
|
34
34
|
export { validateFrameworkRegistration };
|
|
35
|
-
export {
|
|
35
|
+
export {
|
|
36
|
+
normalizeEndpoint,
|
|
37
|
+
buildAdvertisedEndpoint,
|
|
38
|
+
parseEndpointHostPort
|
|
39
|
+
} from './EndpointNotation';
|
|
36
40
|
|
|
37
41
|
const DEFAULT_MESSAGE_FOLLOW_DURATION_MS = 30_000;
|
|
38
42
|
const DEFAULT_SESSION_REPLACEMENT_CALLBACK_TIMEOUT_MS = 30_000;
|
|
@@ -50,7 +54,10 @@ export function createFrameworkRegistration(
|
|
|
50
54
|
maintenanceWave: normalizeMaintenanceWave(options.maintenanceWave),
|
|
51
55
|
messageSerializers: codecRegistry.registeredSerializers,
|
|
52
56
|
codecs: codecRegistry.registration,
|
|
53
|
-
requestTimeoutMs: normalizeOptionalPositiveInteger(
|
|
57
|
+
requestTimeoutMs: normalizeOptionalPositiveInteger(
|
|
58
|
+
options.requestTimeoutMs,
|
|
59
|
+
'requestTimeoutMs'
|
|
60
|
+
),
|
|
54
61
|
actorFactories: actorFactoriesFromSpotNodes(spotNodes),
|
|
55
62
|
actorTransferTimeoutMs: normalizeOptionalPositiveInteger(
|
|
56
63
|
options.actorTransferTimeoutMs,
|
|
@@ -69,7 +76,10 @@ export function createFrameworkRegistration(
|
|
|
69
76
|
spotFactories: toSpotFactorySet(options.spotFactories, spotNodes),
|
|
70
77
|
channels: toChannelMap(options.channels, network),
|
|
71
78
|
channelClients: channelNamesWith(options.channels, (channel) => channel.client !== undefined),
|
|
72
|
-
fanoutPublishers: channelNamesWith(
|
|
79
|
+
fanoutPublishers: channelNamesWith(
|
|
80
|
+
options.channels,
|
|
81
|
+
(channel) => channel.publisher !== undefined
|
|
82
|
+
),
|
|
73
83
|
routeChannels: new Set(routeChannelOptions.keys()),
|
|
74
84
|
routeChannelOptions,
|
|
75
85
|
streamNodes: toStreamNodeMap(options.streamNodes, network),
|
|
@@ -96,26 +106,32 @@ function normalizeApplicationJobQueue(
|
|
|
96
106
|
throw new TypeError('applicationJobQueue.profile must be a supported profile.');
|
|
97
107
|
}
|
|
98
108
|
const maxQueuedApplicationJobs = value?.maxQueuedApplicationJobs;
|
|
99
|
-
if (
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
109
|
+
if (
|
|
110
|
+
maxQueuedApplicationJobs !== undefined &&
|
|
111
|
+
(typeof maxQueuedApplicationJobs !== 'bigint' ||
|
|
112
|
+
maxQueuedApplicationJobs < 1n ||
|
|
113
|
+
maxQueuedApplicationJobs > 2_147_483_647n)
|
|
114
|
+
) {
|
|
103
115
|
throw new TypeError(
|
|
104
116
|
'applicationJobQueue.maxQueuedApplicationJobs must be a bigint in the range 1..2147483647.'
|
|
105
117
|
);
|
|
106
118
|
}
|
|
107
119
|
const pauseThresholdPercent = value?.pauseThresholdPercent ?? 80;
|
|
108
120
|
const resumeThresholdPercent = value?.resumeThresholdPercent ?? 60;
|
|
109
|
-
if (
|
|
110
|
-
|
|
111
|
-
|
|
121
|
+
if (
|
|
122
|
+
!Number.isInteger(pauseThresholdPercent) ||
|
|
123
|
+
pauseThresholdPercent < 1 ||
|
|
124
|
+
pauseThresholdPercent > 100
|
|
125
|
+
) {
|
|
112
126
|
throw new TypeError(
|
|
113
127
|
'applicationJobQueue.pauseThresholdPercent must be an integer in the range 1..100.'
|
|
114
128
|
);
|
|
115
129
|
}
|
|
116
|
-
if (
|
|
117
|
-
|
|
118
|
-
|
|
130
|
+
if (
|
|
131
|
+
!Number.isInteger(resumeThresholdPercent) ||
|
|
132
|
+
resumeThresholdPercent < 0 ||
|
|
133
|
+
resumeThresholdPercent > 99
|
|
134
|
+
) {
|
|
119
135
|
throw new TypeError(
|
|
120
136
|
'applicationJobQueue.resumeThresholdPercent must be an integer in the range 0..99.'
|
|
121
137
|
);
|
|
@@ -141,7 +157,10 @@ function normalizeCoreHwm(
|
|
|
141
157
|
if (profile !== undefined && (!Number.isInteger(profile) || profile < 0 || profile > 3)) {
|
|
142
158
|
throw new TypeError('coreHwm.profile must be a Core Auto HWM profile value.');
|
|
143
159
|
}
|
|
144
|
-
for (const [name, bytes] of [
|
|
160
|
+
for (const [name, bytes] of [
|
|
161
|
+
['memoryLimitBytes', memoryLimitBytes],
|
|
162
|
+
['budgetBytes', budgetBytes]
|
|
163
|
+
] as const) {
|
|
145
164
|
if (bytes !== undefined && (typeof bytes !== 'bigint' || bytes <= 0n)) {
|
|
146
165
|
throw new TypeError(`coreHwm.${name} must be a positive bigint.`);
|
|
147
166
|
}
|
|
@@ -154,7 +173,9 @@ const MAX_APPLICATION_VERSION = 9_223_372_036_854_775_807n;
|
|
|
154
173
|
function normalizeApplicationVersion(value: bigint | undefined): bigint {
|
|
155
174
|
const version = value ?? 0n;
|
|
156
175
|
if (typeof version !== 'bigint' || version < 0n || version > MAX_APPLICATION_VERSION) {
|
|
157
|
-
throw new TypeError(
|
|
176
|
+
throw new TypeError(
|
|
177
|
+
'applicationVersion must be a bigint in the signed 64-bit non-negative range.'
|
|
178
|
+
);
|
|
158
179
|
}
|
|
159
180
|
return version;
|
|
160
181
|
}
|
|
@@ -168,7 +189,11 @@ function normalizeMaintenanceWave(value: string | undefined): string | undefined
|
|
|
168
189
|
return value;
|
|
169
190
|
}
|
|
170
191
|
|
|
171
|
-
function normalizeNonNegativeInteger(
|
|
192
|
+
function normalizeNonNegativeInteger(
|
|
193
|
+
value: number | undefined,
|
|
194
|
+
name: string,
|
|
195
|
+
fallback: number
|
|
196
|
+
): number {
|
|
172
197
|
if (value === undefined) return fallback;
|
|
173
198
|
if (!Number.isSafeInteger(value) || value < 0) {
|
|
174
199
|
throw new TypeError(`${name} must be a non-negative safe integer.`);
|
|
@@ -176,7 +201,11 @@ function normalizeNonNegativeInteger(value: number | undefined, name: string, fa
|
|
|
176
201
|
return value;
|
|
177
202
|
}
|
|
178
203
|
|
|
179
|
-
function normalizePositiveInteger(
|
|
204
|
+
function normalizePositiveInteger(
|
|
205
|
+
value: number | undefined,
|
|
206
|
+
name: string,
|
|
207
|
+
fallback: number
|
|
208
|
+
): number {
|
|
180
209
|
if (value === undefined) return fallback;
|
|
181
210
|
if (!Number.isSafeInteger(value) || value <= 0) {
|
|
182
211
|
throw new TypeError(`${name} must be a positive safe integer.`);
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
Type,
|
|
3
|
-
ZLinkEntrySpot,
|
|
4
|
-
ZLinkSpot
|
|
5
|
-
} from '../../contracts';
|
|
1
|
+
import type { Type, ZLinkEntrySpot, ZLinkSpot } from '../../contracts';
|
|
6
2
|
import { ZLinkConfigurationException } from './ConfigurationException';
|
|
7
3
|
|
|
8
4
|
export function validateMessageFollowDuration(timeoutMs: number): number {
|
|
9
5
|
if (!Number.isSafeInteger(timeoutMs) || timeoutMs < 0) {
|
|
10
|
-
throw new ZLinkConfigurationException(
|
|
6
|
+
throw new ZLinkConfigurationException(
|
|
7
|
+
'Message Follow duration must be a non-negative safe integer.'
|
|
8
|
+
);
|
|
11
9
|
}
|
|
12
10
|
return timeoutMs;
|
|
13
11
|
}
|
|
14
12
|
|
|
15
13
|
export function validateActorTransferTimeout(timeoutMs: number): number {
|
|
16
14
|
if (!Number.isSafeInteger(timeoutMs) || timeoutMs <= 0) {
|
|
17
|
-
throw new ZLinkConfigurationException(
|
|
15
|
+
throw new ZLinkConfigurationException(
|
|
16
|
+
'actor transfer timeout must be a positive safe integer.'
|
|
17
|
+
);
|
|
18
18
|
}
|
|
19
19
|
return timeoutMs;
|
|
20
20
|
}
|
|
@@ -70,7 +70,9 @@ export function validateRoutingIdPrefix(prefix: string): string {
|
|
|
70
70
|
throw new ZLinkConfigurationException('Routing-id prefix must not be empty or padded.');
|
|
71
71
|
}
|
|
72
72
|
if (Buffer.byteLength(`${prefix}-00000000-0000-0000-0000-000000000000`, 'utf8') > 255) {
|
|
73
|
-
throw new ZLinkConfigurationException(
|
|
73
|
+
throw new ZLinkConfigurationException(
|
|
74
|
+
'Routing-id prefix is too long for a generated routing id.'
|
|
75
|
+
);
|
|
74
76
|
}
|
|
75
77
|
return prefix;
|
|
76
78
|
}
|
|
@@ -39,10 +39,7 @@ import type {
|
|
|
39
39
|
ZLinkSpotRelocationAdapter,
|
|
40
40
|
ZLinkUserSpotFactoryBuilder
|
|
41
41
|
} from './ObjectRoles';
|
|
42
|
-
import {
|
|
43
|
-
ZLinkSpotRelocationCoordinationMode,
|
|
44
|
-
ZLinkUserSpotExecutionMode
|
|
45
|
-
} from './ObjectRoles';
|
|
42
|
+
import { ZLinkSpotRelocationCoordinationMode, ZLinkUserSpotExecutionMode } from './ObjectRoles';
|
|
46
43
|
import type { ZLinkSpotNodeBuilder } from '../Spots/Builders';
|
|
47
44
|
import { readZLinkDecoratorMetadata } from '../Handlers/Attributes';
|
|
48
45
|
import type { ZLinkCodecRegistryBuilder } from '../Codecs';
|
|
@@ -60,11 +57,7 @@ import {
|
|
|
60
57
|
import { AutoHwmProfile } from '@zlink-systems/zlink';
|
|
61
58
|
import { endpointConnections } from './RuntimeEndpointConnections';
|
|
62
59
|
import type { ZLinkEndpointConnections } from './Connections';
|
|
63
|
-
import type {
|
|
64
|
-
ZLinkLocationOptions,
|
|
65
|
-
ZLinkLocationStore,
|
|
66
|
-
ZLinkRelocationStore
|
|
67
|
-
} from '../Locations';
|
|
60
|
+
import type { ZLinkLocationOptions, ZLinkLocationStore, ZLinkRelocationStore } from '../Locations';
|
|
68
61
|
import { ZLinkConfigurationException } from './ConfigurationException';
|
|
69
62
|
import {
|
|
70
63
|
RegistrationCodecRegistryBuilder,
|
|
@@ -176,7 +169,8 @@ class ZLinkFrameworkOptionsBuilder implements ZLinkFrameworkOptions {
|
|
|
176
169
|
}
|
|
177
170
|
|
|
178
171
|
setSessionReplacementCallbackTimeout(timeoutMs: number): this {
|
|
179
|
-
this.options.sessionReplacementCallbackTimeoutMs =
|
|
172
|
+
this.options.sessionReplacementCallbackTimeoutMs =
|
|
173
|
+
validateSessionReplacementCallbackTimeout(timeoutMs);
|
|
180
174
|
return this;
|
|
181
175
|
}
|
|
182
176
|
|
|
@@ -199,10 +193,7 @@ class ZLinkFrameworkOptionsBuilder implements ZLinkFrameworkOptions {
|
|
|
199
193
|
this.spotMeshes.add(meshName);
|
|
200
194
|
const node = this.spotNodeOptions(meshName);
|
|
201
195
|
node.router ??= { port: 0 };
|
|
202
|
-
return new DefaultMeshNodeBuilder(
|
|
203
|
-
meshName,
|
|
204
|
-
node
|
|
205
|
-
);
|
|
196
|
+
return new DefaultMeshNodeBuilder(meshName, node);
|
|
206
197
|
}
|
|
207
198
|
|
|
208
199
|
addFanoutChannel(name: string): ZLinkFanoutChannelBuilder {
|
|
@@ -301,7 +292,6 @@ export class DefaultDispatchOptionsBuilder implements ZLinkDispatchOptionsBuilde
|
|
|
301
292
|
this.dispatch.diagnostics.includeMessageSizes = include;
|
|
302
293
|
return this;
|
|
303
294
|
}
|
|
304
|
-
|
|
305
295
|
}
|
|
306
296
|
|
|
307
297
|
interface MutableInboundDispatchRegistrationOptions {
|
|
@@ -363,13 +353,20 @@ export class DefaultInboundDispatchOptionsBuilder implements ZLinkInboundDispatc
|
|
|
363
353
|
}
|
|
364
354
|
}
|
|
365
355
|
|
|
366
|
-
function coreHwmProfileValue(
|
|
356
|
+
function coreHwmProfileValue(
|
|
357
|
+
value: ZLinkCoreHwmProfile
|
|
358
|
+
): (typeof AutoHwmProfile)[keyof typeof AutoHwmProfile] {
|
|
367
359
|
switch (value) {
|
|
368
|
-
case ZLinkCoreHwmProfile.Compact:
|
|
369
|
-
|
|
370
|
-
case ZLinkCoreHwmProfile.
|
|
371
|
-
|
|
372
|
-
|
|
360
|
+
case ZLinkCoreHwmProfile.Compact:
|
|
361
|
+
return AutoHwmProfile.Compact;
|
|
362
|
+
case ZLinkCoreHwmProfile.LowLatency:
|
|
363
|
+
return AutoHwmProfile.LowLatency;
|
|
364
|
+
case ZLinkCoreHwmProfile.Balanced:
|
|
365
|
+
return AutoHwmProfile.Balanced;
|
|
366
|
+
case ZLinkCoreHwmProfile.Throughput:
|
|
367
|
+
return AutoHwmProfile.Throughput;
|
|
368
|
+
default:
|
|
369
|
+
throw new TypeError('coreHwmProfile must be a supported profile.');
|
|
373
370
|
}
|
|
374
371
|
}
|
|
375
372
|
|
|
@@ -644,10 +641,7 @@ class DefaultClientServerChannelServerBuilder implements ZLinkClientServerChanne
|
|
|
644
641
|
}
|
|
645
642
|
|
|
646
643
|
setWeight(weight: number): this {
|
|
647
|
-
this.server.weight = requirePublicWeight(
|
|
648
|
-
weight,
|
|
649
|
-
`ClientServer channel '${this.name}' weight`
|
|
650
|
-
);
|
|
644
|
+
this.server.weight = requirePublicWeight(weight, `ClientServer channel '${this.name}' weight`);
|
|
651
645
|
return this;
|
|
652
646
|
}
|
|
653
647
|
|
|
@@ -658,7 +652,9 @@ class DefaultClientServerChannelServerBuilder implements ZLinkClientServerChanne
|
|
|
658
652
|
return this;
|
|
659
653
|
}
|
|
660
654
|
|
|
661
|
-
addSendHandler<TMessage>(
|
|
655
|
+
addSendHandler<TMessage>(
|
|
656
|
+
handlerType: Type<import('../Handlers').ZLinkSendHandler<TMessage>>
|
|
657
|
+
): this {
|
|
662
658
|
this.channel.sendHandlers ??= [];
|
|
663
659
|
this.channel.sendHandlers.push({ packetName: handlerPacketName(handlerType), handlerType });
|
|
664
660
|
return this;
|
|
@@ -723,7 +719,11 @@ class DefaultStreamNodeBuilder implements ZLinkStreamNodeBuilder {
|
|
|
723
719
|
return this;
|
|
724
720
|
}
|
|
725
721
|
|
|
726
|
-
setTlsServer(
|
|
722
|
+
setTlsServer(
|
|
723
|
+
certificatePath: string,
|
|
724
|
+
keyPath: string,
|
|
725
|
+
requireClientCertificate: boolean = false
|
|
726
|
+
): this {
|
|
727
727
|
this.streamNode.tlsServer = {
|
|
728
728
|
certificatePath,
|
|
729
729
|
keyPath,
|
|
@@ -732,9 +732,13 @@ class DefaultStreamNodeBuilder implements ZLinkStreamNodeBuilder {
|
|
|
732
732
|
return this;
|
|
733
733
|
}
|
|
734
734
|
|
|
735
|
-
registerSession<TSession extends ZLinkSession>(
|
|
735
|
+
registerSession<TSession extends ZLinkSession>(
|
|
736
|
+
sessionType: Type<TSession> | Type<ZLinkSessionFactory<TSession>>
|
|
737
|
+
): this {
|
|
736
738
|
if (this.streamNode.session !== undefined) {
|
|
737
|
-
throw new ZLinkConfigurationException(
|
|
739
|
+
throw new ZLinkConfigurationException(
|
|
740
|
+
'STREAM node cannot register more than one header stream session.'
|
|
741
|
+
);
|
|
738
742
|
}
|
|
739
743
|
this.streamNode.session = sessionType;
|
|
740
744
|
return this;
|
|
@@ -764,7 +768,9 @@ export class DefaultStreamCompressionBuilder implements ZLinkStreamCompressionBu
|
|
|
764
768
|
|
|
765
769
|
use(codec: ZLinkStreamCompressionCodec): this {
|
|
766
770
|
if (!isStreamCompressionCodec(codec)) {
|
|
767
|
-
throw new ZLinkConfigurationException(
|
|
771
|
+
throw new ZLinkConfigurationException(
|
|
772
|
+
'STREAM compression codec must provide compress and decompress functions.'
|
|
773
|
+
);
|
|
768
774
|
}
|
|
769
775
|
this.options.disabled = false;
|
|
770
776
|
this.options.codec = codec;
|
|
@@ -802,12 +808,17 @@ class DefaultSpotNodeBuilder implements ZLinkSpotNodeBuilder {
|
|
|
802
808
|
return this;
|
|
803
809
|
}
|
|
804
810
|
|
|
805
|
-
enableRouter(
|
|
811
|
+
enableRouter(
|
|
812
|
+
endpoint: string,
|
|
813
|
+
routingId?: RoutingId,
|
|
814
|
+
connect?: string | readonly string[]
|
|
815
|
+
): this {
|
|
806
816
|
this.spotNode.router = {
|
|
807
817
|
...(this.spotNode.router ?? {}),
|
|
808
818
|
bind: endpoint,
|
|
809
819
|
routingId: routingId ?? this.spotNode.routingId,
|
|
810
|
-
manualConnections:
|
|
820
|
+
manualConnections:
|
|
821
|
+
connect === undefined ? this.spotNode.router?.manualConnections : endpointList(connect)
|
|
811
822
|
};
|
|
812
823
|
return this;
|
|
813
824
|
}
|
|
@@ -829,12 +840,17 @@ class DefaultSpotNodeBuilder implements ZLinkSpotNodeBuilder {
|
|
|
829
840
|
return this;
|
|
830
841
|
}
|
|
831
842
|
|
|
832
|
-
enablePubSub(
|
|
843
|
+
enablePubSub(
|
|
844
|
+
endpoint: string,
|
|
845
|
+
routingId?: RoutingId,
|
|
846
|
+
connect?: string | readonly string[]
|
|
847
|
+
): this {
|
|
833
848
|
this.spotNode.pubSub = {
|
|
834
849
|
...(this.spotNode.pubSub ?? {}),
|
|
835
850
|
bind: endpoint,
|
|
836
851
|
routingId: routingId ?? this.spotNode.routingId,
|
|
837
|
-
manualConnections:
|
|
852
|
+
manualConnections:
|
|
853
|
+
connect === undefined ? this.spotNode.pubSub?.manualConnections : endpointList(connect)
|
|
838
854
|
};
|
|
839
855
|
return this;
|
|
840
856
|
}
|
|
@@ -845,7 +861,6 @@ class DefaultSpotNodeBuilder implements ZLinkSpotNodeBuilder {
|
|
|
845
861
|
this.spotNode.pubSub.manualConnections.push(endpoint);
|
|
846
862
|
return this;
|
|
847
863
|
}
|
|
848
|
-
|
|
849
864
|
}
|
|
850
865
|
|
|
851
866
|
class DefaultMeshNodeBuilder implements ZLinkMeshNodeBuilder {
|
|
@@ -972,7 +987,9 @@ class DefaultMeshNodeBuilder implements ZLinkMeshNodeBuilder {
|
|
|
972
987
|
return new DefaultMeshObjectRoleBuilder(this.name, this.node);
|
|
973
988
|
}
|
|
974
989
|
|
|
975
|
-
addRouteSendHandler<TMessage>(
|
|
990
|
+
addRouteSendHandler<TMessage>(
|
|
991
|
+
handlerType: Type<import('../Handlers').ZLinkRouteSendHandler<TMessage>>
|
|
992
|
+
): this {
|
|
976
993
|
this.node.routeSendHandlers ??= [];
|
|
977
994
|
this.node.routeSendHandlers.push({ packetName: handlerPacketName(handlerType), handlerType });
|
|
978
995
|
return this;
|
|
@@ -982,7 +999,10 @@ class DefaultMeshNodeBuilder implements ZLinkMeshNodeBuilder {
|
|
|
982
999
|
handlerType: Type<import('../Handlers').ZLinkRouteRequestHandler<TRequest, TReply>>
|
|
983
1000
|
): this {
|
|
984
1001
|
this.node.routeRequestHandlers ??= [];
|
|
985
|
-
this.node.routeRequestHandlers.push({
|
|
1002
|
+
this.node.routeRequestHandlers.push({
|
|
1003
|
+
packetName: handlerPacketName(handlerType),
|
|
1004
|
+
handlerType
|
|
1005
|
+
});
|
|
986
1006
|
return this;
|
|
987
1007
|
}
|
|
988
1008
|
|
|
@@ -990,9 +1010,7 @@ class DefaultMeshNodeBuilder implements ZLinkMeshNodeBuilder {
|
|
|
990
1010
|
const router = this.node.router;
|
|
991
1011
|
if (router?.port === undefined) return;
|
|
992
1012
|
const bindHost = router.bindHost ?? '127.0.0.1';
|
|
993
|
-
const host = bindHost.includes(':') && !bindHost.startsWith('[')
|
|
994
|
-
? `[${bindHost}]`
|
|
995
|
-
: bindHost;
|
|
1013
|
+
const host = bindHost.includes(':') && !bindHost.startsWith('[') ? `[${bindHost}]` : bindHost;
|
|
996
1014
|
router.bind = `tcp://${host}:${router.port}`;
|
|
997
1015
|
}
|
|
998
1016
|
}
|
|
@@ -1069,7 +1087,8 @@ abstract class DefaultFactoryBuilder<TInstance> {
|
|
|
1069
1087
|
|
|
1070
1088
|
class DefaultActorFactoryBuilder<TActor extends ZLinkActor>
|
|
1071
1089
|
extends DefaultFactoryBuilder<TActor>
|
|
1072
|
-
implements ZLinkActorFactoryBuilder<TActor>
|
|
1090
|
+
implements ZLinkActorFactoryBuilder<TActor>
|
|
1091
|
+
{
|
|
1073
1092
|
disableRelocation(): void {
|
|
1074
1093
|
this.disable();
|
|
1075
1094
|
}
|
|
@@ -1078,9 +1097,7 @@ class DefaultActorFactoryBuilder<TActor extends ZLinkActor>
|
|
|
1078
1097
|
this.recreate();
|
|
1079
1098
|
}
|
|
1080
1099
|
|
|
1081
|
-
preserveStateWith(
|
|
1082
|
-
adapterType: Type<ZLinkActorRelocationAdapter<TActor>>
|
|
1083
|
-
): void {
|
|
1100
|
+
preserveStateWith(adapterType: Type<ZLinkActorRelocationAdapter<TActor>>): void {
|
|
1084
1101
|
this.preserve(adapterType);
|
|
1085
1102
|
}
|
|
1086
1103
|
|
|
@@ -1097,7 +1114,8 @@ class DefaultActorFactoryBuilder<TActor extends ZLinkActor>
|
|
|
1097
1114
|
|
|
1098
1115
|
class DefaultUserSpotFactoryBuilder<TSpot extends ZLinkSpot>
|
|
1099
1116
|
extends DefaultFactoryBuilder<TSpot>
|
|
1100
|
-
implements ZLinkUserSpotFactoryBuilder<TSpot>
|
|
1117
|
+
implements ZLinkUserSpotFactoryBuilder<TSpot>
|
|
1118
|
+
{
|
|
1101
1119
|
private stableTypeLimitValue: number | undefined;
|
|
1102
1120
|
private executionModeValue = ZLinkUserSpotExecutionMode.SpotWide;
|
|
1103
1121
|
private relocationCoordinationModeValue = ZLinkSpotRelocationCoordinationMode.FrameworkManaged;
|
|
@@ -1129,9 +1147,7 @@ class DefaultUserSpotFactoryBuilder<TSpot extends ZLinkSpot>
|
|
|
1129
1147
|
this.recreate();
|
|
1130
1148
|
}
|
|
1131
1149
|
|
|
1132
|
-
preserveStateWith(
|
|
1133
|
-
adapterType: Type<ZLinkSpotRelocationAdapter<TSpot>>
|
|
1134
|
-
): void {
|
|
1150
|
+
preserveStateWith(adapterType: Type<ZLinkSpotRelocationAdapter<TSpot>>): void {
|
|
1135
1151
|
this.preserve(adapterType);
|
|
1136
1152
|
}
|
|
1137
1153
|
|
|
@@ -1147,12 +1163,10 @@ class DefaultUserSpotFactoryBuilder<TSpot extends ZLinkSpot>
|
|
|
1147
1163
|
};
|
|
1148
1164
|
validateUserSpotFactoryOptions(options);
|
|
1149
1165
|
if (
|
|
1150
|
-
options.executionMode === ZLinkUserSpotExecutionMode.PerActor
|
|
1151
|
-
|
|
1166
|
+
options.executionMode === ZLinkUserSpotExecutionMode.PerActor &&
|
|
1167
|
+
relocation.kind !== 'recreate'
|
|
1152
1168
|
) {
|
|
1153
|
-
throw new ZLinkConfigurationException(
|
|
1154
|
-
'PerActor User Spots require RecreateOnRelocation.'
|
|
1155
|
-
);
|
|
1169
|
+
throw new ZLinkConfigurationException('PerActor User Spots require RecreateOnRelocation.');
|
|
1156
1170
|
}
|
|
1157
1171
|
return { options, relocation };
|
|
1158
1172
|
}
|
|
@@ -1160,7 +1174,8 @@ class DefaultUserSpotFactoryBuilder<TSpot extends ZLinkSpot>
|
|
|
1160
1174
|
|
|
1161
1175
|
class DefaultInstanceSpotFactoryBuilder<TSpot extends ZLinkInstanceSpot>
|
|
1162
1176
|
extends DefaultFactoryBuilder<TSpot>
|
|
1163
|
-
implements ZLinkInstanceSpotFactoryBuilder<TSpot>
|
|
1177
|
+
implements ZLinkInstanceSpotFactoryBuilder<TSpot>
|
|
1178
|
+
{
|
|
1164
1179
|
private stableTypeLimitValue: number | undefined;
|
|
1165
1180
|
|
|
1166
1181
|
stableTypeLimit(limit: number): this {
|
|
@@ -1178,9 +1193,7 @@ class DefaultInstanceSpotFactoryBuilder<TSpot extends ZLinkInstanceSpot>
|
|
|
1178
1193
|
this.recreate();
|
|
1179
1194
|
}
|
|
1180
1195
|
|
|
1181
|
-
preserveStateWith(
|
|
1182
|
-
adapterType: Type<ZLinkSpotRelocationAdapter<TSpot>>
|
|
1183
|
-
): void {
|
|
1196
|
+
preserveStateWith(adapterType: Type<ZLinkSpotRelocationAdapter<TSpot>>): void {
|
|
1184
1197
|
this.preserve(adapterType);
|
|
1185
1198
|
}
|
|
1186
1199
|
|
|
@@ -1339,7 +1352,9 @@ class DefaultMeshChannelServerBuilder implements ZLinkMeshChannelServerBuilder {
|
|
|
1339
1352
|
return this;
|
|
1340
1353
|
}
|
|
1341
1354
|
|
|
1342
|
-
addSendHandler<TMessage>(
|
|
1355
|
+
addSendHandler<TMessage>(
|
|
1356
|
+
handlerType: Type<import('../Handlers').ZLinkSendHandler<TMessage>>
|
|
1357
|
+
): this {
|
|
1343
1358
|
this.channel.sendHandlers ??= [];
|
|
1344
1359
|
this.channel.sendHandlers.push({ packetName: handlerPacketName(handlerType), handlerType });
|
|
1345
1360
|
return this;
|
|
@@ -1372,10 +1387,16 @@ class DefaultMeshPeerConnections implements ZLinkMeshPeerConnections {
|
|
|
1372
1387
|
requireRegistrationName(endpoint, 'Mesh peer endpoint');
|
|
1373
1388
|
const normalizedEndpoint = normalizeEndpoint(endpoint);
|
|
1374
1389
|
this.router.manualPeerConnections ??= [];
|
|
1375
|
-
if (
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1390
|
+
if (
|
|
1391
|
+
!this.router.manualPeerConnections.some(
|
|
1392
|
+
(peer) =>
|
|
1393
|
+
peer.endpoint === normalizedEndpoint && peer.peerRid === expectedRoutingIdOrEndpoint
|
|
1394
|
+
)
|
|
1395
|
+
) {
|
|
1396
|
+
this.router.manualPeerConnections.push({
|
|
1397
|
+
peerRid: expectedRoutingIdOrEndpoint,
|
|
1398
|
+
endpoint: normalizedEndpoint
|
|
1399
|
+
});
|
|
1379
1400
|
}
|
|
1380
1401
|
}
|
|
1381
1402
|
|
|
@@ -1385,7 +1406,9 @@ class DefaultMeshPeerConnections implements ZLinkMeshPeerConnections {
|
|
|
1385
1406
|
// (see connect() above); without normalizing here, disconnect() with a
|
|
1386
1407
|
// differently-cased or -formatted endpoint would silently no-op.
|
|
1387
1408
|
const normalizedEndpoint = normalizeEndpoint(endpoint);
|
|
1388
|
-
this.router.manualConnections = this.router.manualConnections?.filter(
|
|
1409
|
+
this.router.manualConnections = this.router.manualConnections?.filter(
|
|
1410
|
+
(value) => value !== normalizedEndpoint
|
|
1411
|
+
);
|
|
1389
1412
|
this.router.manualPeerConnections = this.router.manualPeerConnections?.filter(
|
|
1390
1413
|
(value) => value.endpoint !== normalizedEndpoint
|
|
1391
1414
|
);
|
|
@@ -1409,9 +1432,7 @@ function endpointList(endpoint: string | readonly string[]): string[] {
|
|
|
1409
1432
|
function requireStableObjectType(value: string, label: string): string {
|
|
1410
1433
|
const byteLength = Buffer.byteLength(value, 'utf8');
|
|
1411
1434
|
if (byteLength < 1 || byteLength > 255 || value.includes('\0')) {
|
|
1412
|
-
throw new ZLinkConfigurationException(
|
|
1413
|
-
`${label} must contain 1..255 UTF-8 bytes and no NUL.`
|
|
1414
|
-
);
|
|
1435
|
+
throw new ZLinkConfigurationException(`${label} must contain 1..255 UTF-8 bytes and no NUL.`);
|
|
1415
1436
|
}
|
|
1416
1437
|
return value;
|
|
1417
1438
|
}
|
|
@@ -1432,9 +1453,7 @@ function requireCapacity(value: number, label: string): number {
|
|
|
1432
1453
|
|
|
1433
1454
|
function requireNonNegativeSafeInteger(value: number, label: string): number {
|
|
1434
1455
|
if (!Number.isSafeInteger(value) || value < 0) {
|
|
1435
|
-
throw new ZLinkConfigurationException(
|
|
1436
|
-
`${label} must be a non-negative safe integer.`
|
|
1437
|
-
);
|
|
1456
|
+
throw new ZLinkConfigurationException(`${label} must be a non-negative safe integer.`);
|
|
1438
1457
|
}
|
|
1439
1458
|
return value;
|
|
1440
1459
|
}
|
|
@@ -1450,9 +1469,7 @@ function requireFactoryConfigure(
|
|
|
1450
1469
|
configure: unknown
|
|
1451
1470
|
): asserts configure is (builder: unknown) => void {
|
|
1452
1471
|
if (typeof configure !== 'function') {
|
|
1453
|
-
throw new ZLinkConfigurationException(
|
|
1454
|
-
'Object factory requires a configure callback.'
|
|
1455
|
-
);
|
|
1472
|
+
throw new ZLinkConfigurationException('Object factory requires a configure callback.');
|
|
1456
1473
|
}
|
|
1457
1474
|
}
|
|
1458
1475
|
|
|
@@ -1462,21 +1479,21 @@ function validateUserSpotFactoryOptions(
|
|
|
1462
1479
|
validateStableTypeLimit(options?.stableTypeLimit);
|
|
1463
1480
|
const executionMode: unknown = options?.executionMode;
|
|
1464
1481
|
if (
|
|
1465
|
-
executionMode !== undefined
|
|
1466
|
-
|
|
1467
|
-
|
|
1482
|
+
executionMode !== undefined &&
|
|
1483
|
+
executionMode !== ZLinkUserSpotExecutionMode.SpotWide &&
|
|
1484
|
+
executionMode !== ZLinkUserSpotExecutionMode.PerActor
|
|
1468
1485
|
) {
|
|
1469
1486
|
throw new ZLinkConfigurationException('User Spot executionMode is invalid.');
|
|
1470
1487
|
}
|
|
1471
1488
|
if (
|
|
1472
|
-
options?.relocationCoordinationMode !== ZLinkSpotRelocationCoordinationMode.FrameworkManaged
|
|
1473
|
-
|
|
1489
|
+
options?.relocationCoordinationMode !== ZLinkSpotRelocationCoordinationMode.FrameworkManaged &&
|
|
1490
|
+
options?.relocationCoordinationMode !== ZLinkSpotRelocationCoordinationMode.ApplicationSignaled
|
|
1474
1491
|
) {
|
|
1475
1492
|
throw new ZLinkConfigurationException('User Spot relocationCoordinationMode is invalid.');
|
|
1476
1493
|
}
|
|
1477
1494
|
if (
|
|
1478
|
-
options.executionMode === ZLinkUserSpotExecutionMode.PerActor
|
|
1479
|
-
|
|
1495
|
+
options.executionMode === ZLinkUserSpotExecutionMode.PerActor &&
|
|
1496
|
+
options.relocationCoordinationMode === ZLinkSpotRelocationCoordinationMode.ApplicationSignaled
|
|
1480
1497
|
) {
|
|
1481
1498
|
throw new ZLinkConfigurationException(
|
|
1482
1499
|
'ApplicationSignaled relocation coordination mode is valid only for SpotWide User Spots.'
|
|
@@ -1485,10 +1502,7 @@ function validateUserSpotFactoryOptions(
|
|
|
1485
1502
|
}
|
|
1486
1503
|
|
|
1487
1504
|
function validateStableTypeLimit(value: number | undefined): void {
|
|
1488
|
-
if (
|
|
1489
|
-
value !== undefined
|
|
1490
|
-
&& (!Number.isInteger(value) || value < 0 || value > 2_147_483_647)
|
|
1491
|
-
) {
|
|
1505
|
+
if (value !== undefined && (!Number.isInteger(value) || value < 0 || value > 2_147_483_647)) {
|
|
1492
1506
|
throw new ZLinkConfigurationException(
|
|
1493
1507
|
'stableTypeLimit must be an integer from 0 through 2147483647.'
|
|
1494
1508
|
);
|
|
@@ -1612,11 +1626,10 @@ interface MutableSpotNodeOptions {
|
|
|
1612
1626
|
pubSub?: MutableSpotPubSubCapabilityOptions;
|
|
1613
1627
|
entrySpotType?: Type<ZLinkEntrySpot>;
|
|
1614
1628
|
spotFactories?: Type<ZLinkSpot>[];
|
|
1615
|
-
spotFactoryRegistrations?: Record<
|
|
1616
|
-
|
|
1617
|
-
ZLinkSpot,
|
|
1618
|
-
|
|
1619
|
-
>>;
|
|
1629
|
+
spotFactoryRegistrations?: Record<
|
|
1630
|
+
string,
|
|
1631
|
+
MutableObjectFactoryRegistration<ZLinkSpot, ZLinkSpot, ZLinkUserSpotFactoryConfiguration>
|
|
1632
|
+
>;
|
|
1620
1633
|
instanceSpotFactories?: Record<string, Type<ZLinkInstanceSpot>>;
|
|
1621
1634
|
instanceSpotFactoryRegistrations?: Record<
|
|
1622
1635
|
string,
|
|
@@ -1629,11 +1642,7 @@ interface MutableSpotNodeOptions {
|
|
|
1629
1642
|
actorFactories?: Record<string, Type>;
|
|
1630
1643
|
actorFactoryRegistrations?: Record<
|
|
1631
1644
|
string,
|
|
1632
|
-
MutableObjectFactoryRegistration<
|
|
1633
|
-
ZLinkActor,
|
|
1634
|
-
ZLinkActorFactory,
|
|
1635
|
-
ZLinkActorFactoryConfiguration
|
|
1636
|
-
>
|
|
1645
|
+
MutableObjectFactoryRegistration<ZLinkActor, ZLinkActorFactory, ZLinkActorFactoryConfiguration>
|
|
1637
1646
|
>;
|
|
1638
1647
|
meshChannels?: Record<string, MutableMeshChannelOptions>;
|
|
1639
1648
|
routeSendHandlers?: Array<{ packetName: string; handlerType: Type }>;
|
|
@@ -1682,9 +1691,11 @@ interface MutableSpotPubSubCapabilityOptions {
|
|
|
1682
1691
|
}
|
|
1683
1692
|
|
|
1684
1693
|
function handlerPacketName(handlerType: Type): string {
|
|
1685
|
-
return
|
|
1686
|
-
.find(
|
|
1687
|
-
|
|
1694
|
+
return (
|
|
1695
|
+
readZLinkDecoratorMetadata(handlerType).find(
|
|
1696
|
+
(metadata) => metadata.kind === 'packet' && metadata.packetName !== undefined
|
|
1697
|
+
)?.packetName ?? handlerType.name
|
|
1698
|
+
);
|
|
1688
1699
|
}
|
|
1689
1700
|
|
|
1690
1701
|
function requireRegistrationName(value: string, label: string): void {
|
|
@@ -31,7 +31,9 @@ export function createCodecRegistry(
|
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
export class RegistrationCodecRegistryBuilder
|
|
34
|
+
export class RegistrationCodecRegistryBuilder
|
|
35
|
+
implements ZLinkCodecRegistryBuilder, ZLinkCodecRegistrar
|
|
36
|
+
{
|
|
35
37
|
private readonly options: MutableCodecRegistryOptions;
|
|
36
38
|
|
|
37
39
|
constructor(options: MutableCodecRegistryOptions = { serializers: [], streamCodecs: [] }) {
|
|
@@ -100,7 +102,9 @@ export class RegistrationCodecRegistryBuilder implements ZLinkCodecRegistryBuild
|
|
|
100
102
|
canSerialize?: ZLinkMessageTypeSelector
|
|
101
103
|
): this {
|
|
102
104
|
const normalized = normalizeCodecContentType(contentType);
|
|
103
|
-
const existing = this.options.serializers.findIndex(
|
|
105
|
+
const existing = this.options.serializers.findIndex(
|
|
106
|
+
(entry) => entry.contentType === normalized
|
|
107
|
+
);
|
|
104
108
|
const registration = { contentType: normalized, serializer, canSerialize };
|
|
105
109
|
if (existing >= 0) this.options.serializers.splice(existing, 1);
|
|
106
110
|
this.options.serializers.push(registration);
|
|
@@ -109,7 +113,9 @@ export class RegistrationCodecRegistryBuilder implements ZLinkCodecRegistryBuild
|
|
|
109
113
|
|
|
110
114
|
addStreamCodec(contentType: string, codec: unknown): this {
|
|
111
115
|
const normalized = normalizeCodecContentType(contentType);
|
|
112
|
-
const existing = this.options.streamCodecs.findIndex(
|
|
116
|
+
const existing = this.options.streamCodecs.findIndex(
|
|
117
|
+
(entry) => entry.contentType === normalized
|
|
118
|
+
);
|
|
113
119
|
const registration = { contentType: normalized, codec };
|
|
114
120
|
if (existing >= 0) this.options.streamCodecs.splice(existing, 1);
|
|
115
121
|
this.options.streamCodecs.push(registration);
|