@zlink-systems/framework 0.29.1 → 0.30.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (322) hide show
  1. package/LICENSE +150 -68
  2. package/dist/.tsbuildinfo +1 -1
  3. package/dist/contracts/Actors/ZLinkActorClient.d.ts +2 -1
  4. package/dist/contracts/Channels/Calls.d.ts +2 -1
  5. package/dist/contracts/Common/ZLinkMessageMetadata.js +11 -5
  6. package/dist/contracts/Configuration/Builders.d.ts +1 -2
  7. package/dist/contracts/Configuration/Configs.d.ts +0 -5
  8. package/dist/contracts/Configuration/RegistrationBuilders.js +6 -4
  9. package/dist/contracts/Configuration/RegistrationTypes.d.ts +1 -6
  10. package/dist/contracts/Configuration/RegistrationValidators.js +4 -4
  11. package/dist/contracts/Configuration/index.d.ts +1 -1
  12. package/dist/contracts/Handlers/Attributes.d.ts +5 -13
  13. package/dist/contracts/Handlers/Attributes.js +7 -11
  14. package/dist/contracts/Handlers/JsonContract.d.ts +2 -46
  15. package/dist/contracts/Handlers/JsonContract.js +4 -153
  16. package/dist/contracts/Spots/Contracts.d.ts +2 -1
  17. package/dist/internal.d.ts +1 -0
  18. package/dist/internal.js +3 -1
  19. package/dist/nest-integration.d.ts +1 -1
  20. package/dist/nest-integration.js +2 -1
  21. package/dist/runtime/actors/actor-client.d.ts +1 -1
  22. package/dist/runtime/actors/actor-client.js +14 -12
  23. package/dist/runtime/actors/actor-handoff.d.ts +3 -2
  24. package/dist/runtime/actors/actor-handoff.js +15 -7
  25. package/dist/runtime/actors/actor-join-relocation.d.ts +1 -0
  26. package/dist/runtime/actors/actor-local-native-join.js +9 -12
  27. package/dist/runtime/actors/actor-remote-wire.js +15 -0
  28. package/dist/runtime/actors/actor-routed-join-transport.d.ts +6 -2
  29. package/dist/runtime/actors/actor-routed-json-request.d.ts +2 -0
  30. package/dist/runtime/actors/index.d.ts +2 -1
  31. package/dist/runtime/actors/index.js +18 -6
  32. package/dist/runtime/actors/spot-actor-dispatch.js +2 -2
  33. package/dist/runtime/admission.d.ts +1 -1
  34. package/dist/runtime/admission.js +15 -5
  35. package/dist/runtime/application-jobs/application-ingress-record-owner.d.ts +9 -9
  36. package/dist/runtime/application-jobs/application-ingress-record-owner.js +45 -23
  37. package/dist/runtime/application-jobs/application-job-queue-scope.d.ts +5 -2
  38. package/dist/runtime/application-jobs/application-job-queue-scope.js +41 -21
  39. package/dist/runtime/application-jobs/contracts.d.ts +15 -2
  40. package/dist/runtime/backend/contracts/index.d.ts +27 -27
  41. package/dist/runtime/backend/mesh-completion-table.d.ts +15 -5
  42. package/dist/runtime/backend/mesh-completion-table.js +160 -50
  43. package/dist/runtime/backend/mesh-dispatch-pump.d.ts +3 -0
  44. package/dist/runtime/backend/mesh-dispatch-pump.js +53 -36
  45. package/dist/runtime/backend/node/node-backend-adapter-factory.js +6 -1
  46. package/dist/runtime/backend/node/node-backend-adapter-support.d.ts +3 -3
  47. package/dist/runtime/backend/node/node-backend-adapter-support.js +33 -31
  48. package/dist/runtime/backend/node/node-dealer-channel-client-transport.d.ts +1 -1
  49. package/dist/runtime/backend/node/node-dealer-channel-client-transport.js +5 -2
  50. package/dist/runtime/backend/node/node-mesh-backend-adapter.d.ts +1 -9
  51. package/dist/runtime/backend/node/node-mesh-backend-adapter.js +1 -1
  52. package/dist/runtime/backend/node/node-raw-binding-port.js +50 -25
  53. package/dist/runtime/backend/node/node-raw-mesh-backend.d.ts +22 -16
  54. package/dist/runtime/backend/node/node-raw-mesh-backend.js +133 -149
  55. package/dist/runtime/backend/node/node-socket-backend-adapter.js +15 -10
  56. package/dist/runtime/backend/raw-binding-port.d.ts +10 -3
  57. package/dist/runtime/backend/runtime-message.d.ts +1 -0
  58. package/dist/runtime/backend/runtime-message.js +5 -0
  59. package/dist/runtime/backend/runtime-values.d.ts +1 -0
  60. package/dist/runtime/backend/runtime-values.js +2 -1
  61. package/dist/runtime/channels/channel-clients.d.ts +1 -0
  62. package/dist/runtime/channels/channel-clients.js +58 -21
  63. package/dist/runtime/channels/channel-dispatch-pipeline.d.ts +3 -2
  64. package/dist/runtime/channels/channel-dispatch-pipeline.js +20 -11
  65. package/dist/runtime/channels/channel-dispatch-services.d.ts +1 -0
  66. package/dist/runtime/channels/channel-dispatch-services.js +45 -0
  67. package/dist/runtime/channels/channel-dispatchers.d.ts +1 -1
  68. package/dist/runtime/channels/channel-dispatchers.js +27 -26
  69. package/dist/runtime/channels/channel-envelope-inspection.d.ts +1 -2
  70. package/dist/runtime/channels/channel-envelope-inspection.js +1 -16
  71. package/dist/runtime/channels/channel-envelope.d.ts +1 -0
  72. package/dist/runtime/channels/channel-envelope.js +83 -8
  73. package/dist/runtime/channels/channel-outbound-operations.d.ts +2 -2
  74. package/dist/runtime/channels/channel-outbound-operations.js +8 -8
  75. package/dist/runtime/channels/channel-receive-loops.js +3 -3
  76. package/dist/runtime/channels/channel-runtime-lifecycle.js +2 -1
  77. package/dist/runtime/channels/channel-runtime-manager.d.ts +6 -6
  78. package/dist/runtime/channels/channel-runtime-manager.js +12 -12
  79. package/dist/runtime/channels/channel-socket-registry.d.ts +10 -3
  80. package/dist/runtime/channels/channel-socket-registry.js +59 -82
  81. package/dist/runtime/channels/channel-transports.d.ts +18 -15
  82. package/dist/runtime/channels/channel-transports.js +48 -31
  83. package/dist/runtime/channels/local-spot-route-transport.d.ts +1 -1
  84. package/dist/runtime/channels/local-spot-route-transport.js +2 -1
  85. package/dist/runtime/channels/router-socket-spot-route-transport.d.ts +2 -2
  86. package/dist/runtime/channels/router-socket-spot-route-transport.js +4 -4
  87. package/dist/runtime/channels/source-spot-router.d.ts +2 -2
  88. package/dist/runtime/channels/source-spot-router.js +4 -4
  89. package/dist/runtime/channels/spot-node-route-transport.d.ts +2 -2
  90. package/dist/runtime/channels/spot-node-route-transport.js +4 -4
  91. package/dist/runtime/channels/spot-route-bridge-transport.d.ts +2 -2
  92. package/dist/runtime/channels/spot-route-bridge-transport.js +4 -4
  93. package/dist/runtime/channels/spot-route-dispatch-strategy.d.ts +5 -4
  94. package/dist/runtime/channels/spot-route-dispatch-strategy.js +18 -18
  95. package/dist/runtime/diagnostics/message-flow.d.ts +1 -0
  96. package/dist/runtime/diagnostics/message-flow.js +3 -3
  97. package/dist/runtime/execution/serial-execution-queue.d.ts +1 -0
  98. package/dist/runtime/execution/serial-execution-queue.js +1 -0
  99. package/dist/runtime/foundation/actor-join-recovery-codec.js +2 -2
  100. package/dist/runtime/foundation/durable-service-request.d.ts +14 -0
  101. package/dist/runtime/foundation/durable-service-request.js +98 -0
  102. package/dist/runtime/foundation/operation-identity.d.ts +1 -0
  103. package/dist/runtime/foundation/operation-identity.js +5 -1
  104. package/dist/runtime/foundation/raw-service-mesh-runtime.d.ts +37 -6
  105. package/dist/runtime/foundation/raw-service-mesh-runtime.js +473 -220
  106. package/dist/runtime/foundation/service-liveness-registry.d.ts +20 -8
  107. package/dist/runtime/foundation/service-liveness-registry.js +57 -44
  108. package/dist/runtime/foundation/service-mailbox.d.ts +3 -0
  109. package/dist/runtime/foundation/service-mailbox.js +2 -1
  110. package/dist/runtime/foundation/service-relocation-object-owner.d.ts +1 -0
  111. package/dist/runtime/foundation/service-relocation-object-owner.js +1 -0
  112. package/dist/runtime/foundation/service-relocation-runtime.d.ts +2 -0
  113. package/dist/runtime/foundation/service-relocation-runtime.js +13 -1
  114. package/dist/runtime/foundation/service-runtime-contracts.d.ts +2 -0
  115. package/dist/runtime/foundation/service-stateful-runtime.d.ts +10 -9
  116. package/dist/runtime/foundation/service-stateful-runtime.js +78 -126
  117. package/dist/runtime/foundation/service-stateful-wire-codec.d.ts +5 -7
  118. package/dist/runtime/foundation/service-stateful-wire-codec.js +43 -61
  119. package/dist/runtime/foundation/service-topology-registry.d.ts +16 -4
  120. package/dist/runtime/foundation/service-topology-registry.js +69 -30
  121. package/dist/runtime/foundation/service-wire-m6a-codec.d.ts +3 -3
  122. package/dist/runtime/foundation/service-wire-m6a-codec.js +36 -38
  123. package/dist/runtime/handlers/handler-instance-scope.d.ts +8 -0
  124. package/dist/runtime/handlers/handler-instance-scope.js +54 -11
  125. package/dist/runtime/host/actor-packet-relay.js +7 -7
  126. package/dist/runtime/host/actor-runtime-options-factory.js +2 -2
  127. package/dist/runtime/host/application-job-queue.d.ts +28 -9
  128. package/dist/runtime/host/application-job-queue.js +214 -50
  129. package/dist/runtime/host/entry-actor-runtime.d.ts +1 -0
  130. package/dist/runtime/host/entry-actor-runtime.js +4 -1
  131. package/dist/runtime/host/index.d.ts +7 -1
  132. package/dist/runtime/host/index.js +154 -126
  133. package/dist/runtime/host/instance-activation-authority.d.ts +2 -1
  134. package/dist/runtime/host/instance-activation-authority.js +89 -25
  135. package/dist/runtime/host/remote-bound-session-relay.js +2 -18
  136. package/dist/runtime/host/route-mesh-runtime.js +1 -1
  137. package/dist/runtime/host/service-relocation-control.d.ts +1 -0
  138. package/dist/runtime/host/service-relocation-control.js +10 -4
  139. package/dist/runtime/host/service-relocation-host-runtime.d.ts +6 -8
  140. package/dist/runtime/host/service-relocation-host-runtime.js +215 -243
  141. package/dist/runtime/host/spot-address-transport.d.ts +1 -0
  142. package/dist/runtime/host/spot-address-transport.js +28 -14
  143. package/dist/runtime/host/spot-runtime-options-factory.js +3 -2
  144. package/dist/runtime/host/user-spot-creation-coordinator.d.ts +1 -0
  145. package/dist/runtime/host/user-spot-creation-coordinator.js +1 -0
  146. package/dist/runtime/locations/actor-location-claims.d.ts +2 -2
  147. package/dist/runtime/locations/actor-location-claims.js +34 -19
  148. package/dist/runtime/locations/domain-store-contract.d.ts +2 -2
  149. package/dist/runtime/locations/in-memory-authority-store.d.ts +4 -2
  150. package/dist/runtime/locations/in-memory-authority-store.js +80 -8
  151. package/dist/runtime/locations/in-memory-location-store.d.ts +2 -2
  152. package/dist/runtime/locations/in-memory-location-store.js +19 -3
  153. package/dist/runtime/locations/internal-location-contracts.d.ts +3 -0
  154. package/dist/runtime/locations/lifecycle.d.ts +1 -2
  155. package/dist/runtime/locations/lifecycle.js +2 -5
  156. package/dist/runtime/locations/location-store-repository.d.ts +3 -2
  157. package/dist/runtime/locations/location-store-repository.js +165 -22
  158. package/dist/runtime/locations/resolvers.d.ts +2 -1
  159. package/dist/runtime/locations/resolvers.js +10 -1
  160. package/dist/runtime/locations/runtime.d.ts +1 -1
  161. package/dist/runtime/locations/runtime.js +24 -23
  162. package/dist/runtime/messaging/framework-json-v1.d.ts +4 -6
  163. package/dist/runtime/messaging/framework-json-v1.js +38 -294
  164. package/dist/runtime/messaging/packet-name.d.ts +1 -1
  165. package/dist/runtime/messaging/packet-name.js +8 -24
  166. package/dist/runtime/messaging/request-result.d.ts +2 -0
  167. package/dist/runtime/messaging/request-result.js +54 -0
  168. package/dist/runtime/messaging/submission-result.d.ts +2 -1
  169. package/dist/runtime/messaging/submission-result.js +7 -4
  170. package/dist/runtime/protocol/service_wire_codec.generated.d.ts +15 -0
  171. package/dist/runtime/protocol/service_wire_codec.generated.js +144 -0
  172. package/dist/runtime/protocol/service_wire_pilot_codec.generated.d.ts +9 -0
  173. package/dist/runtime/protocol/service_wire_pilot_codec.generated.js +14 -1
  174. package/dist/runtime/spots/formal-remote-actor-admission-registry.d.ts +9 -2
  175. package/dist/runtime/spots/formal-remote-actor-admission-registry.js +33 -19
  176. package/dist/runtime/spots/index.d.ts +7 -3
  177. package/dist/runtime/spots/index.js +23 -16
  178. package/dist/runtime/spots/spot-activation.d.ts +3 -1
  179. package/dist/runtime/spots/spot-activation.js +21 -12
  180. package/dist/runtime/spots/spot-actor-admission-coordinator.d.ts +2 -1
  181. package/dist/runtime/spots/spot-actor-admission-coordinator.js +11 -10
  182. package/dist/runtime/spots/spot-actor-packet-dispatch.d.ts +4 -1
  183. package/dist/runtime/spots/spot-actor-packet-dispatch.js +7 -5
  184. package/dist/runtime/spots/spot-actor-packet-drain.js +2 -0
  185. package/dist/runtime/spots/spot-actor-packet-relay-dispatch.js +1 -0
  186. package/dist/runtime/spots/spot-entry-activation.js +9 -3
  187. package/dist/runtime/spots/spot-handler-registry.d.ts +3 -1
  188. package/dist/runtime/spots/spot-handler-registry.js +18 -8
  189. package/dist/runtime/spots/spot-node-autoconnect.js +4 -3
  190. package/dist/runtime/spots/spot-node-runtime-manager.d.ts +2 -1
  191. package/dist/runtime/spots/spot-node-runtime-manager.js +4 -11
  192. package/dist/runtime/spots/spot-outbound.d.ts +3 -0
  193. package/dist/runtime/spots/spot-outbound.js +24 -15
  194. package/dist/runtime/spots/spot-routed-spot-packet-dispatch.d.ts +1 -0
  195. package/dist/runtime/spots/spot-routed-spot-packet-dispatch.js +1 -1
  196. package/dist/runtime/spots/spot-routing-internal.d.ts +6 -0
  197. package/dist/runtime/spots/spot-runtime-ports.d.ts +3 -1
  198. package/dist/runtime/spots/spot-subscription-dispatch.js +0 -3
  199. package/dist/runtime/spots/spot-timer.js +1 -0
  200. package/dist/runtime/streams/stream-session-runtime.d.ts +1 -1
  201. package/dist/runtime/streams/stream-session-runtime.js +14 -28
  202. package/package.json +3 -3
  203. package/src/contracts/Actors/ZLinkActorClient.ts +2 -1
  204. package/src/contracts/Channels/Calls.ts +2 -1
  205. package/src/contracts/Common/ZLinkMessageMetadata.ts +13 -8
  206. package/src/contracts/Configuration/Builders.ts +1 -2
  207. package/src/contracts/Configuration/Configs.ts +0 -6
  208. package/src/contracts/Configuration/RegistrationBuilders.ts +8 -12
  209. package/src/contracts/Configuration/RegistrationTypes.ts +1 -6
  210. package/src/contracts/Configuration/RegistrationValidators.ts +9 -10
  211. package/src/contracts/Configuration/index.ts +1 -6
  212. package/src/contracts/Handlers/Attributes.ts +14 -21
  213. package/src/contracts/Handlers/JsonContract.ts +8 -216
  214. package/src/contracts/Spots/Contracts.ts +2 -1
  215. package/src/internal.ts +1 -0
  216. package/src/nest-integration.ts +1 -0
  217. package/src/runtime/actors/actor-client.ts +40 -16
  218. package/src/runtime/actors/actor-handoff.ts +22 -8
  219. package/src/runtime/actors/actor-join-relocation.ts +1 -0
  220. package/src/runtime/actors/actor-local-native-join.ts +17 -26
  221. package/src/runtime/actors/actor-remote-wire.ts +17 -0
  222. package/src/runtime/actors/actor-routed-join-transport.ts +14 -4
  223. package/src/runtime/actors/actor-routed-json-request.ts +10 -2
  224. package/src/runtime/actors/index.ts +19 -5
  225. package/src/runtime/actors/spot-actor-dispatch.ts +4 -2
  226. package/src/runtime/admission.ts +18 -5
  227. package/src/runtime/application-jobs/application-ingress-record-owner.ts +53 -27
  228. package/src/runtime/application-jobs/application-job-queue-scope.ts +56 -22
  229. package/src/runtime/application-jobs/contracts.ts +28 -2
  230. package/src/runtime/backend/contracts/index.ts +63 -32
  231. package/src/runtime/backend/mesh-completion-table.ts +175 -59
  232. package/src/runtime/backend/mesh-dispatch-pump.ts +59 -32
  233. package/src/runtime/backend/node/node-backend-adapter-factory.ts +12 -5
  234. package/src/runtime/backend/node/node-backend-adapter-support.ts +42 -31
  235. package/src/runtime/backend/node/node-dealer-channel-client-transport.ts +12 -2
  236. package/src/runtime/backend/node/node-mesh-backend-adapter.ts +3 -10
  237. package/src/runtime/backend/node/node-raw-binding-port.ts +73 -37
  238. package/src/runtime/backend/node/node-raw-mesh-backend.ts +209 -176
  239. package/src/runtime/backend/node/node-socket-backend-adapter.ts +32 -13
  240. package/src/runtime/backend/raw-binding-port.ts +18 -3
  241. package/src/runtime/backend/runtime-message.ts +6 -0
  242. package/src/runtime/backend/runtime-values.ts +1 -0
  243. package/src/runtime/channels/channel-clients.ts +90 -41
  244. package/src/runtime/channels/channel-dispatch-pipeline.ts +69 -34
  245. package/src/runtime/channels/channel-dispatch-services.ts +69 -1
  246. package/src/runtime/channels/channel-dispatchers.ts +29 -27
  247. package/src/runtime/channels/channel-envelope-inspection.ts +2 -16
  248. package/src/runtime/channels/channel-envelope.ts +133 -8
  249. package/src/runtime/channels/channel-outbound-operations.ts +22 -8
  250. package/src/runtime/channels/channel-receive-loops.ts +3 -3
  251. package/src/runtime/channels/channel-runtime-lifecycle.ts +7 -1
  252. package/src/runtime/channels/channel-runtime-manager.ts +29 -12
  253. package/src/runtime/channels/channel-socket-registry.ts +84 -130
  254. package/src/runtime/channels/channel-transports.ts +128 -60
  255. package/src/runtime/channels/local-spot-route-transport.ts +3 -1
  256. package/src/runtime/channels/router-socket-spot-route-transport.ts +13 -4
  257. package/src/runtime/channels/source-spot-router.ts +8 -4
  258. package/src/runtime/channels/spot-node-route-transport.ts +8 -4
  259. package/src/runtime/channels/spot-route-bridge-transport.ts +6 -4
  260. package/src/runtime/channels/spot-route-dispatch-strategy.ts +47 -18
  261. package/src/runtime/diagnostics/message-flow.ts +1 -1
  262. package/src/runtime/execution/serial-execution-queue.ts +2 -0
  263. package/src/runtime/foundation/actor-join-recovery-codec.ts +2 -2
  264. package/src/runtime/foundation/durable-service-request.ts +137 -0
  265. package/src/runtime/foundation/operation-identity.ts +5 -1
  266. package/src/runtime/foundation/raw-service-mesh-runtime.ts +642 -253
  267. package/src/runtime/foundation/service-liveness-registry.ts +68 -59
  268. package/src/runtime/foundation/service-mailbox.ts +7 -1
  269. package/src/runtime/foundation/service-relocation-object-owner.ts +2 -0
  270. package/src/runtime/foundation/service-relocation-runtime.ts +18 -1
  271. package/src/runtime/foundation/service-runtime-contracts.ts +7 -1
  272. package/src/runtime/foundation/service-stateful-runtime.ts +128 -160
  273. package/src/runtime/foundation/service-stateful-wire-codec.ts +55 -84
  274. package/src/runtime/foundation/service-topology-registry.ts +103 -42
  275. package/src/runtime/foundation/service-wire-m6a-codec.ts +57 -38
  276. package/src/runtime/handlers/handler-instance-scope.ts +67 -16
  277. package/src/runtime/host/actor-packet-relay.ts +7 -0
  278. package/src/runtime/host/actor-runtime-options-factory.ts +14 -2
  279. package/src/runtime/host/application-job-queue.ts +249 -48
  280. package/src/runtime/host/entry-actor-runtime.ts +5 -0
  281. package/src/runtime/host/index.ts +224 -160
  282. package/src/runtime/host/instance-activation-authority.ts +132 -27
  283. package/src/runtime/host/remote-bound-session-relay.ts +2 -23
  284. package/src/runtime/host/route-mesh-runtime.ts +1 -1
  285. package/src/runtime/host/service-relocation-control.ts +11 -5
  286. package/src/runtime/host/service-relocation-host-runtime.ts +317 -291
  287. package/src/runtime/host/spot-address-transport.ts +49 -24
  288. package/src/runtime/host/spot-runtime-options-factory.ts +4 -0
  289. package/src/runtime/host/user-spot-creation-coordinator.ts +8 -0
  290. package/src/runtime/locations/actor-location-claims.ts +52 -30
  291. package/src/runtime/locations/domain-store-contract.ts +6 -2
  292. package/src/runtime/locations/in-memory-authority-store.ts +113 -9
  293. package/src/runtime/locations/in-memory-location-store.ts +25 -3
  294. package/src/runtime/locations/internal-location-contracts.ts +4 -0
  295. package/src/runtime/locations/lifecycle.ts +8 -26
  296. package/src/runtime/locations/location-store-repository.ts +220 -15
  297. package/src/runtime/locations/resolvers.ts +25 -2
  298. package/src/runtime/locations/runtime.ts +28 -24
  299. package/src/runtime/messaging/framework-json-v1.ts +5 -325
  300. package/src/runtime/messaging/packet-name.ts +5 -25
  301. package/src/runtime/messaging/request-result.ts +58 -0
  302. package/src/runtime/messaging/submission-result.ts +7 -3
  303. package/src/runtime/protocol/service_wire_codec.generated.ts +131 -1
  304. package/src/runtime/protocol/service_wire_pilot_codec.generated.ts +4 -4
  305. package/src/runtime/spots/formal-remote-actor-admission-registry.ts +45 -23
  306. package/src/runtime/spots/index.ts +30 -2
  307. package/src/runtime/spots/spot-activation.ts +33 -10
  308. package/src/runtime/spots/spot-actor-admission-coordinator.ts +13 -0
  309. package/src/runtime/spots/spot-actor-packet-dispatch.ts +10 -0
  310. package/src/runtime/spots/spot-actor-packet-drain.ts +2 -0
  311. package/src/runtime/spots/spot-actor-packet-relay-dispatch.ts +1 -0
  312. package/src/runtime/spots/spot-entry-activation.ts +12 -2
  313. package/src/runtime/spots/spot-handler-registry.ts +41 -8
  314. package/src/runtime/spots/spot-node-autoconnect.ts +6 -2
  315. package/src/runtime/spots/spot-node-runtime-manager.ts +7 -12
  316. package/src/runtime/spots/spot-outbound.ts +36 -16
  317. package/src/runtime/spots/spot-routed-spot-packet-dispatch.ts +2 -1
  318. package/src/runtime/spots/spot-routing-internal.ts +14 -0
  319. package/src/runtime/spots/spot-runtime-ports.ts +3 -0
  320. package/src/runtime/spots/spot-subscription-dispatch.ts +0 -3
  321. package/src/runtime/spots/spot-timer.ts +5 -1
  322. package/src/runtime/streams/stream-session-runtime.ts +13 -30
@@ -1,4 +1,5 @@
1
1
  import type { ActorId } from '../Common';
2
+ import type { ZLinkRequest } from '../Handlers/Attributes';
2
3
  export interface ZLinkActorClient {
3
4
  sendToActor(actorId: ActorId, message: unknown): ZLinkActorSendCall;
4
5
  requestToActor(actorId: ActorId, request: unknown): ZLinkActorRequestCall;
@@ -10,6 +11,6 @@ export interface ZLinkActorSendCall {
10
11
  export interface ZLinkActorRequestCall {
11
12
  metadata(key: string, value: string): this;
12
13
  timeout(timeoutMs: number): this;
13
- submit<TReply>(signal?: AbortSignal): Promise<TReply>;
14
+ submit<TReply>(signal?: AbortSignal): ZLinkRequest<TReply>;
14
15
  yield<TReply>(signal?: AbortSignal): Promise<TReply>;
15
16
  }
@@ -1,4 +1,5 @@
1
1
  import type { ZLinkMessageMetadata } from '../Common';
2
+ import type { ZLinkRequest } from '../Handlers/Attributes';
2
3
  export interface ZLinkSendCall {
3
4
  metadata(key: string, value: string): this;
4
5
  metadata(metadata: ZLinkMessageMetadata): this;
@@ -8,7 +9,7 @@ export interface ZLinkRequestCall {
8
9
  metadata(key: string, value: string): this;
9
10
  metadata(metadata: ZLinkMessageMetadata): this;
10
11
  timeout(timeoutMs: number): this;
11
- submit<TReply>(signal?: AbortSignal): Promise<TReply>;
12
+ submit<TReply>(signal?: AbortSignal): ZLinkRequest<TReply>;
12
13
  }
13
14
  export interface ZLinkChannelRequestCall extends ZLinkRequestCall {
14
15
  yield<TReply>(signal?: AbortSignal): Promise<TReply>;
@@ -4,7 +4,7 @@ exports.ZLinkMessageMetadataEmpty = void 0;
4
4
  exports.zlinkMessageMetadata = zlinkMessageMetadata;
5
5
  class ImmutableZLinkMessageMetadata {
6
6
  values;
7
- constructor(values = new Map()) {
7
+ constructor(values = []) {
8
8
  this.values = Object.freeze(new ImmutableMetadataMap(values));
9
9
  }
10
10
  find(key) {
@@ -14,9 +14,7 @@ class ImmutableZLinkMessageMetadata {
14
14
  class ImmutableMetadataMap {
15
15
  #values;
16
16
  constructor(values) {
17
- this.#values = new Map(typeof values[Symbol.iterator] === 'function'
18
- ? values
19
- : Object.entries(values));
17
+ this.#values = new Map(values);
20
18
  }
21
19
  get size() {
22
20
  return this.#values.size;
@@ -45,5 +43,13 @@ class ImmutableMetadataMap {
45
43
  }
46
44
  exports.ZLinkMessageMetadataEmpty = Object.freeze(new ImmutableZLinkMessageMetadata());
47
45
  function zlinkMessageMetadata(values) {
48
- return Object.freeze(new ImmutableZLinkMessageMetadata(values));
46
+ const entries = typeof values[Symbol.iterator] === 'function'
47
+ ? values
48
+ : Object.entries(values);
49
+ const size = Array.isArray(entries)
50
+ ? entries.length
51
+ : entries.size;
52
+ return size === 0
53
+ ? exports.ZLinkMessageMetadataEmpty
54
+ : Object.freeze(new ImmutableZLinkMessageMetadata(entries));
49
55
  }
@@ -7,7 +7,6 @@ import type { ZLinkDispatchOptionsBuilder, ZLinkInboundDispatchOptions } from '.
7
7
  import type { ZLinkLocationOptions, ZLinkLocationStore, ZLinkRelocationStore } from '../Locations';
8
8
  import type { RoutingId, Type } from '../Common';
9
9
  import type { ZLinkWorkerOptions } from './RegistrationTypes';
10
- import type { ZLinkSpotPublisherConfig } from './Configs';
11
10
  import type { ZLinkActorFactoryBuilder, ZLinkInstanceSpotFactoryBuilder, ZLinkUserSpotFactoryBuilder } from './ObjectRoles';
12
11
  import type { ZLinkRequestHandler, ZLinkRouteRequestHandler, ZLinkRouteSendHandler, ZLinkSendHandler } from '../Handlers';
13
12
  export interface ZLinkFrameworkOptions {
@@ -96,7 +95,6 @@ export interface ZLinkMeshNodeBuilder {
96
95
  setActivationConcurrency(limit: number): this;
97
96
  setInstanceSpotIdleTimeout(timeoutMs: number): this;
98
97
  configureRouterSocket(): ZLinkMeshNodeSocketConfig;
99
- configureSpotPublisher(): ZLinkSpotPublisherConfig;
100
98
  peerConnections(): ZLinkMeshPeerConnections;
101
99
  setDefaultRequestTimeout(timeoutMs: number): this;
102
100
  objects(): ZLinkMeshObjectRoleBuilder;
@@ -136,6 +134,7 @@ export interface ZLinkFanoutChannelBuilder {
136
134
  routingId(routingId: string): this;
137
135
  setRoutingIdPrefix(prefix: string): this;
138
136
  setNoDrop(noDrop?: boolean): this;
137
+ setSendTimeout(timeoutMs: number): this;
139
138
  enableSubscriber(): this;
140
139
  subscribe(topic: string): this;
141
140
  connect(endpoint: string): this;
@@ -16,8 +16,3 @@ export interface ZLinkOutboundRouteConfig {
16
16
  targetNodeRid: RoutingId;
17
17
  endpoint: string;
18
18
  }
19
- export interface ZLinkSpotPublisherConfig {
20
- sendHighWaterMark: number;
21
- sendTimeoutMs?: number;
22
- lingerMs?: number;
23
- }
@@ -10,6 +10,7 @@ const ConfigurationException_1 = require("./ConfigurationException");
10
10
  const DiagnosticsValidation_1 = require("./DiagnosticsValidation");
11
11
  const EndpointNotation_1 = require("./EndpointNotation");
12
12
  const FanoutTopic_1 = require("./FanoutTopic");
13
+ const SendTimeoutValidation_1 = require("./SendTimeoutValidation");
13
14
  const InternalDefaults_1 = require("./InternalDefaults");
14
15
  const ObjectRoles_1 = require("./ObjectRoles");
15
16
  const RegistrationBuilderPolicy_1 = require("./RegistrationBuilderPolicy");
@@ -374,6 +375,11 @@ class DefaultFanoutChannelBuilder {
374
375
  this.channel.noDrop = noDrop;
375
376
  return this;
376
377
  }
378
+ setSendTimeout(timeoutMs) {
379
+ (0, SendTimeoutValidation_1.requireValidSendTimeoutMs)(`Fanout channel '${this.name}' send timeout`, timeoutMs);
380
+ this.channel.sendTimeoutMs = timeoutMs;
381
+ return this;
382
+ }
377
383
  enableSubscriber(endpoint) {
378
384
  this.selectSubscriberMode(endpoint === undefined ? 'automatic' : 'manual');
379
385
  this.channel.subscriber ??= { manualConnections: [] };
@@ -758,10 +764,6 @@ class DefaultMeshNodeBuilder {
758
764
  this.node.router ??= {};
759
765
  return this.node.router;
760
766
  }
761
- configureSpotPublisher() {
762
- this.node.publisherConfig ??= {};
763
- return this.node.publisherConfig;
764
- }
765
767
  peerConnections() {
766
768
  this.node.router ??= {};
767
769
  return new DefaultMeshPeerConnections(this.node.router);
@@ -139,6 +139,7 @@ export interface ZLinkChannelOptions {
139
139
  readonly routingId?: string;
140
140
  readonly routingIdPrefix?: string;
141
141
  readonly noDrop?: boolean;
142
+ readonly sendTimeoutMs?: number;
142
143
  readonly requestTimeoutMs?: number;
143
144
  readonly client?: ZLinkClientCapabilityOptions;
144
145
  readonly publisher?: ZLinkPublisherCapabilityOptions;
@@ -167,7 +168,6 @@ export interface ZLinkClientCapabilityOptions {
167
168
  readonly maxMessageSize?: number;
168
169
  }
169
170
  export interface ZLinkPublisherCapabilityOptions {
170
- readonly sendTimeoutMs?: number;
171
171
  readonly bind?: string;
172
172
  readonly bindHost?: string;
173
173
  readonly advertiseHost?: string;
@@ -243,11 +243,6 @@ export interface ZLinkSpotNodeOptions {
243
243
  readonly routeSendHandlers?: readonly ZLinkRouteMeshSendHandlerRegistration[];
244
244
  readonly routeRequestHandlers?: readonly ZLinkRouteMeshRequestHandlerRegistration[];
245
245
  readonly requestTimeoutMs?: number;
246
- readonly publisherConfig?: {
247
- readonly sendHighWaterMark?: number;
248
- readonly sendTimeoutMs?: number;
249
- readonly lingerMs?: number;
250
- };
251
246
  readonly entrySpotTimerHandlers?: readonly ZLinkEntrySpotTimerHandlerRegistration[];
252
247
  readonly entrySpotPacketHandlers?: readonly ZLinkEntrySpotPacketHandlerRegistration[];
253
248
  readonly entrySpotSubscriptionHandlers?: readonly ZLinkEntrySpotSubscriptionHandlerRegistration[];
@@ -155,8 +155,9 @@ function validateChannelCapabilities(channels, peerLocationConfigured) {
155
155
  if (channel.noDrop !== undefined && typeof channel.noDrop !== 'boolean') {
156
156
  throw new ConfigurationException_1.ZLinkConfigurationException(`Channel '${channelName}' NoDrop must be a boolean.`);
157
157
  }
158
- if (channel.noDrop !== undefined && channel.publisher === undefined) {
159
- throw new ConfigurationException_1.ZLinkConfigurationException(`Channel '${channelName}' NoDrop requires a publisher role.`);
158
+ if ((channel.noDrop !== undefined || channel.sendTimeoutMs !== undefined) &&
159
+ channel.publisher === undefined) {
160
+ throw new ConfigurationException_1.ZLinkConfigurationException(`Channel '${channelName}': NoDrop and send timeout require the publisher role.`);
160
161
  }
161
162
  if (channel.server !== undefined) {
162
163
  requireEndpoint(`channel '${channelName}' server`, channel.server.bind);
@@ -167,8 +168,8 @@ function validateChannelCapabilities(channels, peerLocationConfigured) {
167
168
  requirePeerWeight(`channel '${channelName}' server weight`, channel.server.weight);
168
169
  requireSocketOptions(`channel '${channelName}' server`, channel.server);
169
170
  }
171
+ (0, SendTimeoutValidation_1.requireValidSendTimeoutMs)(`channel '${channelName}' publisher sendTimeoutMs`, channel.sendTimeoutMs);
170
172
  if (channel.publisher !== undefined) {
171
- (0, SendTimeoutValidation_1.requireValidSendTimeoutMs)(`channel '${channelName}' publisher sendTimeoutMs`, channel.publisher.sendTimeoutMs);
172
173
  requireEndpoint(`channel '${channelName}' publisher`, channel.publisher.bind);
173
174
  validateListenerNetworkIdentity(`channel '${channelName}' publisher`, channel.publisher.bindHost, channel.publisher.advertiseHost);
174
175
  validateFanoutPublisherIdentity(channelName, channel.routingId, channel.routingIdPrefix, peerLocationConfigured);
@@ -220,7 +221,6 @@ function validateSpotNodes(registration) {
220
221
  }
221
222
  validateSpotNodeCapability(`SpotNode '${spotNodeName}' pubSub`, spotNode.pubSub);
222
223
  requireNonNegativeSafeInteger(`SpotNode '${spotNodeName}' instanceSpotIdleTimeoutMs`, spotNode.instanceSpotIdleTimeoutMs);
223
- (0, SendTimeoutValidation_1.requireValidSendTimeoutMs)(`SpotNode '${spotNodeName}' publisher sendTimeoutMs`, spotNode.publisherConfig?.sendTimeoutMs);
224
224
  validateSpotNodeFactories(spotNodeName, spotNode);
225
225
  validateSpotNodeTimers(spotNode);
226
226
  if (spotNode.objectRole === 'client' &&
@@ -1,5 +1,5 @@
1
1
  export type { ZLinkClientServerChannelClientBuilder, ZLinkClientServerChannelRoleBuilder, ZLinkClientServerChannelServerBuilder, ZLinkFanoutChannelBuilder, ZLinkFrameworkOptions, ZLinkMeshChannelBuilder, ZLinkMeshChannelClientBuilder, ZLinkMeshChannelServerBuilder, ZLinkMeshObjectClientBuilder, ZLinkMeshObjectRoleBuilder, ZLinkMeshObjectServerBuilder, ZLinkMeshNodeBuilder, ZLinkMeshNodeSocketConfig, ZLinkMeshPeerConnection, ZLinkMeshPeerConnections, ZLinkNetworkOptions, ZLinkMetadataPolicyBuilder, ZLinkStreamCompressionBuilder, ZLinkStreamSocketConfig, ZLinkStreamNodeBuilder } from './Builders';
2
- export type { ZLinkOutboundRouteConfig, ZLinkRouteConfig, ZLinkSocketConfig, ZLinkSpotPublisherConfig } from './Configs';
2
+ export type { ZLinkOutboundRouteConfig, ZLinkRouteConfig, ZLinkSocketConfig } from './Configs';
3
3
  export * from './Connections';
4
4
  export * from './ObjectRoles';
5
5
  export type { ZLinkApplicationJobQueueOptions, ZLinkCoreHwmOptions, ZLinkWorkerOptions } from './RegistrationTypes';
@@ -1,16 +1,9 @@
1
- import { type ZLinkPacketJsonContract } from './JsonContract';
2
- export declare const ZLINK_DECORATOR_METADATA: unique symbol;
3
- export interface ZLinkDecoratorMetadata {
4
- readonly kind: string;
5
- readonly packetName?: string;
6
- readonly groupName?: string;
7
- readonly methodName?: string;
8
- readonly meshName?: string;
9
- readonly channelName?: string;
10
- readonly topic?: string;
11
- readonly jsonContract?: ZLinkPacketJsonContract;
12
- }
1
+ export { ZLINK_DECORATOR_METADATA, readZLinkDecoratorMetadata } from '@zlink-systems/stream-wire/internal/json';
2
+ export type { ZLinkDecoratorMetadata } from '@zlink-systems/stream-wire/internal/json';
13
3
  export declare function ZLinkHandlerGroup(groupName: string): ClassDecorator;
4
+ export interface ZLinkRequest<TReply> extends Promise<TReply> {
5
+ readonly admitted: Promise<void>;
6
+ }
14
7
  export declare function ZLinkRequest(packetName?: string): MethodDecorator;
15
8
  export declare function ZLinkSend(packetName?: string): MethodDecorator;
16
9
  export declare function ZLinkPublish(packetName?: string): MethodDecorator;
@@ -21,4 +14,3 @@ export declare function ZLinkSpotActorSend(packetName?: string): MethodDecorator
21
14
  export declare function ZLinkSpotActorRequest(packetName?: string): MethodDecorator;
22
15
  export declare function ZLinkStreamPacket(): MethodDecorator;
23
16
  export declare function ZLinkStreamRaw(): MethodDecorator;
24
- export declare function readZLinkDecoratorMetadata(target: object): readonly ZLinkDecoratorMetadata[];
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ZLINK_DECORATOR_METADATA = void 0;
3
+ exports.readZLinkDecoratorMetadata = exports.ZLINK_DECORATOR_METADATA = void 0;
4
4
  exports.ZLinkHandlerGroup = ZLinkHandlerGroup;
5
5
  exports.ZLinkRequest = ZLinkRequest;
6
6
  exports.ZLinkSend = ZLinkSend;
@@ -13,9 +13,11 @@ exports.ZLinkSpotActorSend = ZLinkSpotActorSend;
13
13
  exports.ZLinkSpotActorRequest = ZLinkSpotActorRequest;
14
14
  exports.ZLinkStreamPacket = ZLinkStreamPacket;
15
15
  exports.ZLinkStreamRaw = ZLinkStreamRaw;
16
- exports.readZLinkDecoratorMetadata = readZLinkDecoratorMetadata;
17
16
  const JsonContract_1 = require("./JsonContract");
18
- exports.ZLINK_DECORATOR_METADATA = Symbol.for('@zlink-systems/framework:decorator');
17
+ const json_1 = require("@zlink-systems/stream-wire/internal/json");
18
+ var json_2 = require("@zlink-systems/stream-wire/internal/json");
19
+ Object.defineProperty(exports, "ZLINK_DECORATOR_METADATA", { enumerable: true, get: function () { return json_2.ZLINK_DECORATOR_METADATA; } });
20
+ Object.defineProperty(exports, "readZLinkDecoratorMetadata", { enumerable: true, get: function () { return json_2.readZLinkDecoratorMetadata; } });
19
21
  function ZLinkHandlerGroup(groupName) {
20
22
  return classDecorator({ kind: 'handlerGroup', groupName });
21
23
  }
@@ -68,17 +70,11 @@ function methodDecorator(metadata) {
68
70
  });
69
71
  }
70
72
  function appendMetadata(target, metadata) {
71
- const current = readZLinkDecoratorMetadata(target);
72
- Object.defineProperty(target, exports.ZLINK_DECORATOR_METADATA, {
73
+ const current = (0, json_1.readZLinkDecoratorMetadata)(target);
74
+ Object.defineProperty(target, json_1.ZLINK_DECORATOR_METADATA, {
73
75
  configurable: true,
74
76
  enumerable: false,
75
77
  value: [...current, metadata],
76
78
  writable: false
77
79
  });
78
80
  }
79
- function readZLinkDecoratorMetadata(target) {
80
- if (!Object.prototype.hasOwnProperty.call(target, exports.ZLINK_DECORATOR_METADATA)) {
81
- return [];
82
- }
83
- return target[exports.ZLINK_DECORATOR_METADATA];
84
- }
@@ -1,46 +1,2 @@
1
- /** Describes the fields accepted by the default framework-json-v1 serializer. */
2
- export type ZLinkJsonSchema = {
3
- readonly type: 'boolean';
4
- } | {
5
- readonly type: 'string';
6
- } | {
7
- readonly type: 'number';
8
- } | {
9
- readonly type: 'int32';
10
- } | {
11
- readonly type: 'uint32';
12
- } | {
13
- readonly type: 'int64';
14
- } | {
15
- readonly type: 'uint64';
16
- } | {
17
- readonly type: 'bytes';
18
- } | {
19
- readonly type: 'enum';
20
- readonly names: readonly string[];
21
- } | {
22
- readonly type: 'nullable';
23
- readonly value: ZLinkJsonSchema;
24
- } | {
25
- readonly type: 'array';
26
- readonly items: ZLinkJsonSchema;
27
- } | {
28
- readonly type: 'record';
29
- readonly values: ZLinkJsonSchema;
30
- } | {
31
- readonly type: 'object';
32
- readonly properties: Readonly<Record<string, ZLinkJsonSchema>>;
33
- readonly required: readonly string[];
34
- /** Unknown properties are ignored during decoding unless this is false. */
35
- readonly additionalProperties?: boolean;
36
- };
37
- /**
38
- * Describes the request and optional reply fields carried under one packet
39
- * name by the default JSON serializer.
40
- */
41
- export interface ZLinkPacketJsonContract {
42
- readonly payload: ZLinkJsonSchema;
43
- readonly reply?: ZLinkJsonSchema;
44
- }
45
- export declare function defineZLinkPacketJsonContract(packetName: string, contract: ZLinkPacketJsonContract): ZLinkPacketJsonContract;
46
- export declare function readZLinkPacketJsonContract(packetName: string): ZLinkPacketJsonContract | undefined;
1
+ export { defineZLinkPacketJsonContract, readZLinkPacketJsonContract } from '@zlink-systems/stream-wire/internal/json';
2
+ export type { ZLinkJsonSchema, ZLinkPacketJsonContract } from '@zlink-systems/stream-wire/internal/json';
@@ -1,155 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.defineZLinkPacketJsonContract = defineZLinkPacketJsonContract;
4
- exports.readZLinkPacketJsonContract = readZLinkPacketJsonContract;
5
- const MAX_CONTRACT_SCHEMA_DEPTH = 64;
6
- const ZLINK_PACKET_JSON_CONTRACTS = Symbol.for('@zlink-systems/framework:packet-json-contracts');
7
- function defineZLinkPacketJsonContract(packetName, contract) {
8
- if (packetName.trim().length === 0) {
9
- throw new TypeError('ZLink packet name must not be empty.');
10
- }
11
- const runtimeContract = contract;
12
- if (typeof runtimeContract !== 'object' || runtimeContract === null) {
13
- throw new TypeError('ZLink packet JSON contract must be an object.');
14
- }
15
- const normalizedContract = runtimeContract;
16
- const normalized = Object.freeze({
17
- payload: normalizeJsonSchema(normalizedContract.payload, new Set(), 0),
18
- ...(normalizedContract.reply === undefined
19
- ? {}
20
- : { reply: normalizeJsonSchema(normalizedContract.reply, new Set(), 0) })
21
- });
22
- const contracts = packetJsonContracts();
23
- const current = contracts.get(packetName);
24
- if (current !== undefined && canonicalContract(current) !== canonicalContract(normalized)) {
25
- throw new TypeError(`ZLink packet '${packetName}' has conflicting JSON contracts in one process.`);
26
- }
27
- if (current !== undefined)
28
- return current;
29
- contracts.set(packetName, normalized);
30
- return normalized;
31
- }
32
- function readZLinkPacketJsonContract(packetName) {
33
- return packetJsonContracts().get(packetName);
34
- }
35
- function normalizeJsonSchema(schema, parents, depth) {
36
- // Keep the runtime boundary defensive for JavaScript callers even though
37
- // the TypeScript signature describes the accepted shape.
38
- const runtimeSchema = schema;
39
- if (typeof runtimeSchema !== 'object' ||
40
- runtimeSchema === null ||
41
- depth > MAX_CONTRACT_SCHEMA_DEPTH) {
42
- throw new TypeError(`ZLink packet JSON schema must be an acyclic object with at most ${MAX_CONTRACT_SCHEMA_DEPTH} levels.`);
43
- }
44
- const normalizedSchema = runtimeSchema;
45
- if (parents.has(normalizedSchema))
46
- throw new TypeError('ZLink packet JSON schema must not contain a cycle.');
47
- const nextParents = new Set(parents).add(normalizedSchema);
48
- switch (normalizedSchema.type) {
49
- case 'boolean':
50
- case 'string':
51
- case 'number':
52
- case 'int32':
53
- case 'uint32':
54
- case 'int64':
55
- case 'uint64':
56
- case 'bytes':
57
- return Object.freeze({ type: normalizedSchema.type });
58
- case 'enum': {
59
- if (!Array.isArray(normalizedSchema.names) ||
60
- normalizedSchema.names.length === 0 ||
61
- normalizedSchema.names.some((name) => typeof name !== 'string' || name.length === 0)) {
62
- throw new TypeError('ZLink packet enum schema requires non-empty string names.');
63
- }
64
- if (new Set(normalizedSchema.names).size !== normalizedSchema.names.length) {
65
- throw new TypeError('ZLink packet enum schema names must be unique.');
66
- }
67
- return Object.freeze({ type: 'enum', names: Object.freeze([...normalizedSchema.names]) });
68
- }
69
- case 'nullable':
70
- return Object.freeze({
71
- type: 'nullable',
72
- value: normalizeJsonSchema(normalizedSchema.value, nextParents, depth + 1)
73
- });
74
- case 'array':
75
- return Object.freeze({
76
- type: 'array',
77
- items: normalizeJsonSchema(normalizedSchema.items, nextParents, depth + 1)
78
- });
79
- case 'record':
80
- return Object.freeze({
81
- type: 'record',
82
- values: normalizeJsonSchema(normalizedSchema.values, nextParents, depth + 1)
83
- });
84
- case 'object': {
85
- const runtimeProperties = normalizedSchema.properties;
86
- if (typeof runtimeProperties !== 'object' ||
87
- runtimeProperties === null ||
88
- Array.isArray(runtimeProperties)) {
89
- throw new TypeError('ZLink packet object schema properties must be an object.');
90
- }
91
- if (!Array.isArray(normalizedSchema.required) ||
92
- normalizedSchema.required.some((name) => typeof name !== 'string' || name.length === 0)) {
93
- throw new TypeError('ZLink packet object schema required must contain property names.');
94
- }
95
- if (normalizedSchema.additionalProperties !== undefined &&
96
- typeof normalizedSchema.additionalProperties !== 'boolean') {
97
- throw new TypeError('ZLink packet object schema additionalProperties must be boolean.');
98
- }
99
- const properties = {};
100
- for (const [name, property] of Object.entries(runtimeProperties)) {
101
- if (isPrototypeKey(name)) {
102
- throw new TypeError(`ZLink packet JSON property '${name}' is not allowed.`);
103
- }
104
- properties[name] = normalizeJsonSchema(property, nextParents, depth + 1);
105
- }
106
- if (new Set(normalizedSchema.required).size !== normalizedSchema.required.length) {
107
- throw new TypeError('ZLink packet JSON required properties must be unique.');
108
- }
109
- for (const name of normalizedSchema.required) {
110
- if (isPrototypeKey(name)) {
111
- throw new TypeError(`ZLink packet JSON property '${name}' is not allowed.`);
112
- }
113
- if (!Object.prototype.hasOwnProperty.call(properties, name)) {
114
- throw new TypeError(`ZLink packet JSON required property '${name}' has no property schema.`);
115
- }
116
- }
117
- return Object.freeze({
118
- type: 'object',
119
- properties: Object.freeze(properties),
120
- required: Object.freeze([...normalizedSchema.required]),
121
- ...(normalizedSchema.additionalProperties === undefined
122
- ? {}
123
- : { additionalProperties: normalizedSchema.additionalProperties })
124
- });
125
- }
126
- }
127
- throw new TypeError(`ZLink packet JSON schema type '${String(normalizedSchema.type)}' is not supported.`);
128
- }
129
- function packetJsonContracts() {
130
- const root = globalThis;
131
- let contracts = root[ZLINK_PACKET_JSON_CONTRACTS];
132
- if (contracts === undefined) {
133
- contracts = new Map();
134
- Object.defineProperty(root, ZLINK_PACKET_JSON_CONTRACTS, {
135
- configurable: false,
136
- enumerable: false,
137
- value: contracts,
138
- writable: false
139
- });
140
- }
141
- return contracts;
142
- }
143
- function canonicalContract(value) {
144
- if (Array.isArray(value))
145
- return `[${value.map(canonicalContract).join(',')}]`;
146
- if (typeof value !== 'object' || value === null)
147
- return JSON.stringify(value);
148
- return `{${Object.entries(value)
149
- .sort(([left], [right]) => (left < right ? -1 : left > right ? 1 : 0))
150
- .map(([key, item]) => `${JSON.stringify(key)}:${canonicalContract(item)}`)
151
- .join(',')}}`;
152
- }
153
- function isPrototypeKey(name) {
154
- return name === '__proto__' || name === 'prototype' || name === 'constructor';
155
- }
3
+ exports.readZLinkPacketJsonContract = exports.defineZLinkPacketJsonContract = void 0;
4
+ var json_1 = require("@zlink-systems/stream-wire/internal/json");
5
+ Object.defineProperty(exports, "defineZLinkPacketJsonContract", { enumerable: true, get: function () { return json_1.defineZLinkPacketJsonContract; } });
6
+ Object.defineProperty(exports, "readZLinkPacketJsonContract", { enumerable: true, get: function () { return json_1.readZLinkPacketJsonContract; } });
@@ -2,6 +2,7 @@ import type { ZLinkActor } from '../Actors';
2
2
  import type { ZLinkChannelRequestCall, ZLinkPublishCall, ZLinkSendCall } from '../Channels';
3
3
  import type { RoutingId, SpotId, Type, ZLinkMessageMetadata } from '../Common';
4
4
  import type { ZLinkSpotTimerHandler } from '../Handlers';
5
+ import type { ZLinkRequest } from '../Handlers/Attributes';
5
6
  import type { ZLinkTimer, ZLinkTimerOptions } from '../Timers';
6
7
  import type { ZLinkEntrySpot, ZLinkInstanceSpot, ZLinkSpot, ZLinkSpotRelocationReadyCall } from './ZLinkSpot';
7
8
  export interface ZLinkActorHandlerRegistry {
@@ -77,7 +78,7 @@ export interface ZLinkSpotRequestCall {
77
78
  instanceSpot(instanceSpotType: string): this;
78
79
  inMesh(meshName: string): this;
79
80
  timeout(timeoutMs: number): this;
80
- submit<TReply>(signal?: AbortSignal): Promise<TReply>;
81
+ submit<TReply>(signal?: AbortSignal): ZLinkRequest<TReply>;
81
82
  yield<TReply>(signal?: AbortSignal): Promise<TReply>;
82
83
  }
83
84
  export declare enum ZLinkSpotCreateState {
@@ -1,5 +1,6 @@
1
1
  /** Test and companion-package integration surface. It is not exported by package.json. */
2
2
  export * from './index';
3
+ export { requireValidSendTimeoutMs } from './contracts/Configuration/SendTimeoutValidation';
3
4
  export * from './runtime/diagnostics';
4
5
  export * from './runtime/host';
5
6
  export * from './runtime/admission';
package/dist/internal.js CHANGED
@@ -14,9 +14,11 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.requirePublicWeight = exports.isValidCapacity = exports.isValidListenerPort = exports.isValidPositiveCapacity = exports.isValidPublicWeight = exports.ZLINK_MAX_CAPACITY = exports.ZLINK_MAX_PUBLIC_WEIGHT = exports.MAX_LISTENER_PORT = exports.ZLINK_MAX_STABLE_TYPE_BYTES = exports.ZLINK_RELOCATION_MAX_BLOB_REFERENCE_BYTES = exports.ZLinkLocationWriteStatus = exports.ZLinkLocationWriteIntent = exports.ZLinkRouteKind = exports.ZLinkLocationKind = exports.ZLinkLocationAutoConnectType = void 0;
17
+ exports.requirePublicWeight = exports.isValidCapacity = exports.isValidListenerPort = exports.isValidPositiveCapacity = exports.isValidPublicWeight = exports.ZLINK_MAX_CAPACITY = exports.ZLINK_MAX_PUBLIC_WEIGHT = exports.MAX_LISTENER_PORT = exports.ZLINK_MAX_STABLE_TYPE_BYTES = exports.ZLINK_RELOCATION_MAX_BLOB_REFERENCE_BYTES = exports.ZLinkLocationWriteStatus = exports.ZLinkLocationWriteIntent = exports.ZLinkRouteKind = exports.ZLinkLocationKind = exports.ZLinkLocationAutoConnectType = exports.requireValidSendTimeoutMs = void 0;
18
18
  /** Test and companion-package integration surface. It is not exported by package.json. */
19
19
  __exportStar(require("./index"), exports);
20
+ var SendTimeoutValidation_1 = require("./contracts/Configuration/SendTimeoutValidation");
21
+ Object.defineProperty(exports, "requireValidSendTimeoutMs", { enumerable: true, get: function () { return SendTimeoutValidation_1.requireValidSendTimeoutMs; } });
20
22
  __exportStar(require("./runtime/diagnostics"), exports);
21
23
  __exportStar(require("./runtime/host"), exports);
22
24
  __exportStar(require("./runtime/admission"), exports);
@@ -11,7 +11,7 @@ import type { ZLinkFrameworkRegistration } from './contracts/Configuration/Regis
11
11
  import type { ZLinkCodecSerializerRegistration, ZLinkFrameworkRegistrationOptions, ZLinkStreamCodecRegistration } from './contracts/Configuration/RegistrationTypes';
12
12
  import { captureZLinkExecutionTurn } from './runtime/execution';
13
13
  export { registerHandlerFilterScope as registerIntegrationHandlerFilterScope, type ZLinkHandlerFilterScopeRunner } from './runtime/channels/handler-filter-scope';
14
- export { disposeOwnedInstance as disposeIntegrationHandler, disposeOwnedInstances as disposeIntegrationHandlers } from './runtime/handlers/handler-instance-scope';
14
+ export { registerHandlerInstanceScopeFactory as registerIntegrationHandlerInstanceScopeFactory, disposeOwnedInstance as disposeIntegrationHandler, disposeOwnedInstances as disposeIntegrationHandlers } from './runtime/handlers/handler-instance-scope';
15
15
  export interface ZLinkNestIntegrationRuntimeHost extends Pick<import('./contracts').ZLinkFrameworkRuntime, 'shutdown'> {
16
16
  readonly channelRuntimeOptions: unknown;
17
17
  readonly routeMeshRuntimeOptions: ZLinkRouteMeshRuntimeOptions;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.disposeIntegrationHandlers = exports.disposeIntegrationHandler = exports.registerIntegrationHandlerFilterScope = exports.validateSessionReplacementCallbackTimeout = exports.validateMessageFollowDuration = exports.validateActorTransferTimeout = exports.registerSpotFactory = exports.registerEntrySpot = exports.validateRoutingIdPrefix = exports.registerRelocationStore = exports.registerActorFactory = exports.ZLinkSpotActorRequest = exports.ZLinkSpotActorSend = exports.hasSpotPublisherClient = exports.hasSpotNode = exports.hasActorManager = exports.normalizeFrameworkRegistration = exports.createFrameworkRegistration = exports.ZLinkConfigurationException = void 0;
3
+ exports.disposeIntegrationHandlers = exports.disposeIntegrationHandler = exports.registerIntegrationHandlerInstanceScopeFactory = exports.registerIntegrationHandlerFilterScope = exports.validateSessionReplacementCallbackTimeout = exports.validateMessageFollowDuration = exports.validateActorTransferTimeout = exports.registerSpotFactory = exports.registerEntrySpot = exports.validateRoutingIdPrefix = exports.registerRelocationStore = exports.registerActorFactory = exports.ZLinkSpotActorRequest = exports.ZLinkSpotActorSend = exports.hasSpotPublisherClient = exports.hasSpotNode = exports.hasActorManager = exports.normalizeFrameworkRegistration = exports.createFrameworkRegistration = exports.ZLinkConfigurationException = void 0;
4
4
  exports.createIntegrationDispatchOptionsBuilder = createIntegrationDispatchOptionsBuilder;
5
5
  exports.createIntegrationInboundDispatchOptionsBuilder = createIntegrationInboundDispatchOptionsBuilder;
6
6
  exports.createIntegrationLocationOptionsBuilder = createIntegrationLocationOptionsBuilder;
@@ -46,6 +46,7 @@ const execution_1 = require("./runtime/execution");
46
46
  var handler_filter_scope_1 = require("./runtime/channels/handler-filter-scope");
47
47
  Object.defineProperty(exports, "registerIntegrationHandlerFilterScope", { enumerable: true, get: function () { return handler_filter_scope_1.registerHandlerFilterScope; } });
48
48
  var handler_instance_scope_1 = require("./runtime/handlers/handler-instance-scope");
49
+ Object.defineProperty(exports, "registerIntegrationHandlerInstanceScopeFactory", { enumerable: true, get: function () { return handler_instance_scope_1.registerHandlerInstanceScopeFactory; } });
49
50
  Object.defineProperty(exports, "disposeIntegrationHandler", { enumerable: true, get: function () { return handler_instance_scope_1.disposeOwnedInstance; } });
50
51
  Object.defineProperty(exports, "disposeIntegrationHandlers", { enumerable: true, get: function () { return handler_instance_scope_1.disposeOwnedInstances; } });
51
52
  function createIntegrationDispatchOptionsBuilder(dispatch) {
@@ -11,7 +11,7 @@ export interface ZLinkActorClientOptions {
11
11
  readonly defaultRequestTimeoutMs?: number;
12
12
  readonly staleActorRefReporter?: (meshName: string, actorId: string) => void;
13
13
  readonly staleActorRefPredicate?: (meshName: string, actor: ActorRef) => boolean;
14
- readonly handoffCapture?: (meshName: string, actorId: string, parts: readonly Message[], returnResponse: boolean, actor: ActorRef, deadlineUnixMs?: number) => Promise<unknown> | undefined;
14
+ readonly handoffCapture?: (meshName: string, actorId: string, parts: readonly Message[], returnResponse: boolean, actor: ActorRef, deadlineUnixMs?: number, onAdmitted?: () => void) => Promise<unknown> | undefined;
15
15
  readonly sendErrorReporter?: (error: unknown) => void;
16
16
  readonly routeTransport?: ZLinkActorRoutedJoinTransport;
17
17
  readonly transportDeliveryGate?: () => {