@olane/o-node 0.7.12-alpha.3 → 0.7.12-alpha.30

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 (254) hide show
  1. package/dist/o-core/src/connection/o-response.d.ts +12 -0
  2. package/dist/o-core/src/connection/o-response.d.ts.map +1 -0
  3. package/dist/o-core/src/connection/o-response.js +18 -0
  4. package/dist/o-core/src/error/enums/codes.error.d.ts +20 -0
  5. package/dist/o-core/src/error/enums/codes.error.d.ts.map +1 -0
  6. package/dist/o-core/src/error/enums/codes.error.js +20 -0
  7. package/dist/o-core/src/error/interfaces/o-error.interface.d.ts +6 -0
  8. package/dist/o-core/src/error/interfaces/o-error.interface.d.ts.map +1 -0
  9. package/dist/o-core/src/error/interfaces/o-error.interface.js +1 -0
  10. package/dist/o-core/src/error/o-error.d.ts +15 -0
  11. package/dist/o-core/src/error/o-error.d.ts.map +1 -0
  12. package/dist/o-core/src/error/o-error.js +27 -0
  13. package/dist/o-core/src/streaming/index.d.ts +11 -0
  14. package/dist/o-core/src/streaming/index.d.ts.map +1 -0
  15. package/dist/o-core/src/streaming/index.js +14 -0
  16. package/dist/o-core/src/streaming/protocol-builder.d.ts +62 -0
  17. package/dist/o-core/src/streaming/protocol-builder.d.ts.map +1 -0
  18. package/dist/o-core/src/streaming/protocol-builder.js +93 -0
  19. package/dist/o-core/src/streaming/stream-config.d.ts +36 -0
  20. package/dist/o-core/src/streaming/stream-config.d.ts.map +1 -0
  21. package/dist/o-core/src/streaming/stream-config.js +19 -0
  22. package/dist/o-core/src/streaming/stream-handler.base.d.ts +85 -0
  23. package/dist/o-core/src/streaming/stream-handler.base.d.ts.map +1 -0
  24. package/dist/o-core/src/streaming/stream-handler.base.js +112 -0
  25. package/dist/o-core/src/streaming/stream-transport.interface.d.ts +61 -0
  26. package/dist/o-core/src/streaming/stream-transport.interface.d.ts.map +1 -0
  27. package/dist/o-core/src/streaming/stream-transport.interface.js +10 -0
  28. package/dist/o-core/src/utils/streaming.utils.d.ts +22 -0
  29. package/dist/o-core/src/utils/streaming.utils.d.ts.map +1 -0
  30. package/dist/o-core/src/utils/streaming.utils.js +45 -0
  31. package/dist/o-node/src/connection/index.d.ts +5 -0
  32. package/dist/o-node/src/connection/index.d.ts.map +1 -0
  33. package/dist/o-node/src/connection/index.js +4 -0
  34. package/dist/o-node/src/connection/interfaces/o-node-connection-manager.config.d.ts +6 -0
  35. package/dist/o-node/src/connection/interfaces/o-node-connection-manager.config.d.ts.map +1 -0
  36. package/dist/o-node/src/connection/interfaces/o-node-connection-manager.config.js +1 -0
  37. package/dist/o-node/src/connection/interfaces/o-node-connection.config.d.ts +6 -0
  38. package/dist/o-node/src/connection/interfaces/o-node-connection.config.d.ts.map +1 -0
  39. package/dist/o-node/src/connection/interfaces/o-node-connection.config.js +1 -0
  40. package/dist/o-node/src/connection/o-node-connection.d.ts +13 -0
  41. package/dist/o-node/src/connection/o-node-connection.d.ts.map +1 -0
  42. package/dist/o-node/src/connection/o-node-connection.js +80 -0
  43. package/dist/o-node/src/connection/o-node-connection.manager.d.ts +19 -0
  44. package/dist/o-node/src/connection/o-node-connection.manager.d.ts.map +1 -0
  45. package/dist/o-node/src/connection/o-node-connection.manager.js +93 -0
  46. package/dist/o-node/src/connection/o-stream.request.d.ts +11 -0
  47. package/dist/o-node/src/connection/o-stream.request.d.ts.map +1 -0
  48. package/dist/o-node/src/connection/o-stream.request.js +7 -0
  49. package/dist/o-node/src/index.d.ts +11 -0
  50. package/dist/o-node/src/index.d.ts.map +1 -0
  51. package/dist/o-node/src/index.js +10 -0
  52. package/dist/o-node/src/interfaces/i-heartbeatable-node.d.ts +49 -0
  53. package/dist/o-node/src/interfaces/i-heartbeatable-node.d.ts.map +1 -0
  54. package/dist/o-node/src/interfaces/i-heartbeatable-node.js +1 -0
  55. package/dist/o-node/src/interfaces/i-reconnectable-node.d.ts +46 -0
  56. package/dist/o-node/src/interfaces/i-reconnectable-node.d.ts.map +1 -0
  57. package/dist/o-node/src/interfaces/i-reconnectable-node.js +1 -0
  58. package/dist/o-node/src/interfaces/o-node.config.d.ts +66 -0
  59. package/dist/o-node/src/interfaces/o-node.config.d.ts.map +1 -0
  60. package/dist/o-node/src/interfaces/o-node.config.js +1 -0
  61. package/dist/o-node/src/interfaces/o-node.tool-config.d.ts +4 -0
  62. package/dist/o-node/src/interfaces/o-node.tool-config.d.ts.map +1 -0
  63. package/dist/o-node/src/interfaces/o-node.tool-config.js +1 -0
  64. package/dist/o-node/src/lib/network-activity.lib.d.ts +1 -0
  65. package/dist/o-node/src/lib/network-activity.lib.d.ts.map +1 -0
  66. package/dist/o-node/src/lib/network-activity.lib.js +34 -0
  67. package/dist/o-node/src/managers/o-connection-heartbeat.manager.d.ts +62 -0
  68. package/dist/o-node/src/managers/o-connection-heartbeat.manager.d.ts.map +1 -0
  69. package/dist/o-node/src/managers/o-connection-heartbeat.manager.js +213 -0
  70. package/dist/o-node/src/managers/o-reconnection.manager.d.ts +51 -0
  71. package/dist/o-node/src/managers/o-reconnection.manager.d.ts.map +1 -0
  72. package/dist/o-node/src/managers/o-reconnection.manager.js +266 -0
  73. package/dist/o-node/src/nodes/client.node.d.ts +7 -0
  74. package/dist/o-node/src/nodes/client.node.d.ts.map +1 -0
  75. package/dist/o-node/src/nodes/client.node.js +16 -0
  76. package/dist/o-node/src/nodes/index.d.ts +4 -0
  77. package/dist/o-node/src/nodes/index.d.ts.map +1 -0
  78. package/dist/o-node/src/nodes/index.js +3 -0
  79. package/dist/o-node/src/nodes/server.node.d.ts +7 -0
  80. package/dist/o-node/src/nodes/server.node.d.ts.map +1 -0
  81. package/dist/o-node/src/nodes/server.node.js +20 -0
  82. package/dist/o-node/src/nodes/websocket.node.d.ts +7 -0
  83. package/dist/o-node/src/nodes/websocket.node.d.ts.map +1 -0
  84. package/dist/o-node/src/nodes/websocket.node.js +18 -0
  85. package/dist/o-node/src/o-node.d.ts +73 -0
  86. package/dist/o-node/src/o-node.d.ts.map +1 -0
  87. package/dist/o-node/src/o-node.hierarchy-manager.d.ts +15 -0
  88. package/dist/o-node/src/o-node.hierarchy-manager.d.ts.map +1 -0
  89. package/dist/o-node/src/o-node.hierarchy-manager.js +15 -0
  90. package/dist/o-node/src/o-node.js +414 -0
  91. package/dist/o-node/src/o-node.notification-manager.d.ts +52 -0
  92. package/dist/o-node/src/o-node.notification-manager.d.ts.map +1 -0
  93. package/dist/o-node/src/o-node.notification-manager.js +185 -0
  94. package/dist/o-node/src/o-node.tool.d.ts +18 -0
  95. package/dist/o-node/src/o-node.tool.d.ts.map +1 -0
  96. package/dist/o-node/src/o-node.tool.js +90 -0
  97. package/dist/o-node/src/router/index.d.ts +6 -0
  98. package/dist/o-node/src/router/index.d.ts.map +1 -0
  99. package/dist/o-node/src/router/index.js +5 -0
  100. package/dist/o-node/src/router/interfaces/o-node-router.config.d.ts +3 -0
  101. package/dist/o-node/src/router/interfaces/o-node-router.config.d.ts.map +1 -0
  102. package/dist/o-node/src/router/interfaces/o-node-router.config.js +1 -0
  103. package/dist/o-node/src/router/interfaces/o-node-router.response.d.ts +8 -0
  104. package/dist/o-node/src/router/interfaces/o-node-router.response.d.ts.map +1 -0
  105. package/dist/o-node/src/router/interfaces/o-node-router.response.js +1 -0
  106. package/dist/o-node/src/router/o-node.address.d.ts +18 -0
  107. package/dist/o-node/src/router/o-node.address.d.ts.map +1 -0
  108. package/dist/o-node/src/router/o-node.address.js +29 -0
  109. package/dist/o-node/src/router/o-node.router.d.ts +45 -0
  110. package/dist/o-node/src/router/o-node.router.d.ts.map +1 -0
  111. package/dist/o-node/src/router/o-node.router.js +135 -0
  112. package/dist/o-node/src/router/o-node.routing-policy.d.ts +30 -0
  113. package/dist/o-node/src/router/o-node.routing-policy.d.ts.map +1 -0
  114. package/dist/o-node/src/router/o-node.routing-policy.js +57 -0
  115. package/dist/o-node/src/router/o-node.transport.d.ts +11 -0
  116. package/dist/o-node/src/router/o-node.transport.d.ts.map +1 -0
  117. package/dist/o-node/src/router/o-node.transport.js +18 -0
  118. package/dist/o-node/src/router/resolvers/index.d.ts +4 -0
  119. package/dist/o-node/src/router/resolvers/index.d.ts.map +1 -0
  120. package/dist/o-node/src/router/resolvers/index.js +3 -0
  121. package/dist/o-node/src/router/resolvers/o-node.leader-resolver-fallback.d.ts +8 -0
  122. package/dist/o-node/src/router/resolvers/o-node.leader-resolver-fallback.d.ts.map +1 -0
  123. package/dist/o-node/src/router/resolvers/o-node.leader-resolver-fallback.js +35 -0
  124. package/dist/{src/router/resolvers/o-node.child-resolver.d.ts → o-node/src/router/resolvers/o-node.resolver.d.ts} +2 -2
  125. package/dist/o-node/src/router/resolvers/o-node.resolver.d.ts.map +1 -0
  126. package/dist/o-node/src/router/resolvers/o-node.resolver.js +41 -0
  127. package/dist/o-node/src/router/resolvers/o-node.search-resolver.d.ts +170 -0
  128. package/dist/o-node/src/router/resolvers/o-node.search-resolver.d.ts.map +1 -0
  129. package/dist/o-node/src/router/resolvers/o-node.search-resolver.js +285 -0
  130. package/dist/o-node/src/router/route.request.d.ts +14 -0
  131. package/dist/o-node/src/router/route.request.d.ts.map +1 -0
  132. package/dist/o-node/src/router/route.request.js +1 -0
  133. package/dist/o-node/src/streaming/index.d.ts +10 -0
  134. package/dist/o-node/src/streaming/index.d.ts.map +1 -0
  135. package/dist/o-node/src/streaming/index.js +12 -0
  136. package/dist/o-node/src/streaming/libp2p-stream-transport.d.ts +50 -0
  137. package/dist/o-node/src/streaming/libp2p-stream-transport.d.ts.map +1 -0
  138. package/dist/o-node/src/streaming/libp2p-stream-transport.js +137 -0
  139. package/dist/o-node/src/streaming/node-stream-handler.d.ts +65 -0
  140. package/dist/o-node/src/streaming/node-stream-handler.d.ts.map +1 -0
  141. package/dist/o-node/src/streaming/node-stream-handler.js +101 -0
  142. package/dist/o-node/src/utils/circuit-breaker.d.ts +107 -0
  143. package/dist/o-node/src/utils/circuit-breaker.d.ts.map +1 -0
  144. package/dist/o-node/src/utils/circuit-breaker.js +175 -0
  145. package/dist/o-node/src/utils/index.d.ts +5 -0
  146. package/dist/o-node/src/utils/index.d.ts.map +1 -0
  147. package/dist/o-node/src/utils/index.js +4 -0
  148. package/dist/o-node/src/utils/leader-request-wrapper.d.ts +66 -0
  149. package/dist/o-node/src/utils/leader-request-wrapper.d.ts.map +1 -0
  150. package/dist/o-node/src/utils/leader-request-wrapper.js +160 -0
  151. package/dist/o-node/src/utils/network.utils.d.ts +20 -0
  152. package/dist/o-node/src/utils/network.utils.d.ts.map +1 -0
  153. package/dist/o-node/src/utils/network.utils.js +74 -0
  154. package/dist/o-node/src/utils/stream.utils.d.ts +6 -0
  155. package/dist/o-node/src/utils/stream.utils.d.ts.map +1 -0
  156. package/dist/o-node/src/utils/stream.utils.js +27 -0
  157. package/dist/o-node/test/circuit-breaker.test.d.ts +2 -0
  158. package/dist/o-node/test/circuit-breaker.test.d.ts.map +1 -0
  159. package/dist/o-node/test/circuit-breaker.test.js +262 -0
  160. package/dist/o-node/test/leader-request-wrapper.test.d.ts +1 -0
  161. package/dist/o-node/test/leader-request-wrapper.test.d.ts.map +1 -0
  162. package/dist/o-node/test/leader-request-wrapper.test.js +246 -0
  163. package/dist/o-node/test/o-node.spec.d.ts +2 -0
  164. package/dist/o-node/test/o-node.spec.d.ts.map +1 -0
  165. package/dist/o-node/test/o-node.spec.js +20 -0
  166. package/dist/o-node/test/search-resolver.spec.d.ts +2 -0
  167. package/dist/o-node/test/search-resolver.spec.d.ts.map +1 -0
  168. package/dist/o-node/test/search-resolver.spec.js +693 -0
  169. package/dist/src/connection/o-node-connection.d.ts +1 -2
  170. package/dist/src/connection/o-node-connection.d.ts.map +1 -1
  171. package/dist/src/connection/o-node-connection.js +25 -18
  172. package/dist/src/connection/o-node-connection.manager.d.ts +3 -1
  173. package/dist/src/connection/o-node-connection.manager.d.ts.map +1 -1
  174. package/dist/src/connection/o-node-connection.manager.js +45 -20
  175. package/dist/src/connection/o-stream.request.d.ts +11 -0
  176. package/dist/src/connection/o-stream.request.d.ts.map +1 -0
  177. package/dist/src/connection/o-stream.request.js +7 -0
  178. package/dist/src/index.d.ts +2 -1
  179. package/dist/src/index.d.ts.map +1 -1
  180. package/dist/src/index.js +2 -1
  181. package/dist/src/interfaces/i-heartbeatable-node.d.ts +49 -0
  182. package/dist/src/interfaces/i-heartbeatable-node.d.ts.map +1 -0
  183. package/dist/src/interfaces/i-heartbeatable-node.js +1 -0
  184. package/dist/src/interfaces/i-reconnectable-node.d.ts +46 -0
  185. package/dist/src/interfaces/i-reconnectable-node.d.ts.map +1 -0
  186. package/dist/src/interfaces/i-reconnectable-node.js +1 -0
  187. package/dist/src/interfaces/o-node.config.d.ts +42 -0
  188. package/dist/src/interfaces/o-node.config.d.ts.map +1 -1
  189. package/dist/src/managers/o-connection-heartbeat.manager.d.ts +62 -0
  190. package/dist/src/managers/o-connection-heartbeat.manager.d.ts.map +1 -0
  191. package/dist/src/managers/o-connection-heartbeat.manager.js +213 -0
  192. package/dist/src/managers/o-reconnection.manager.d.ts +51 -0
  193. package/dist/src/managers/o-reconnection.manager.d.ts.map +1 -0
  194. package/dist/src/managers/o-reconnection.manager.js +266 -0
  195. package/dist/src/o-node.d.ts +20 -2
  196. package/dist/src/o-node.d.ts.map +1 -1
  197. package/dist/src/o-node.js +161 -32
  198. package/dist/src/o-node.notification-manager.d.ts +52 -0
  199. package/dist/src/o-node.notification-manager.d.ts.map +1 -0
  200. package/dist/src/o-node.notification-manager.js +185 -0
  201. package/dist/src/o-node.tool.d.ts.map +1 -1
  202. package/dist/src/o-node.tool.js +29 -22
  203. package/dist/src/router/o-node.router.d.ts +1 -0
  204. package/dist/src/router/o-node.router.d.ts.map +1 -1
  205. package/dist/src/router/o-node.router.js +61 -5
  206. package/dist/src/router/o-node.routing-policy.d.ts.map +1 -1
  207. package/dist/src/router/o-node.routing-policy.js +7 -2
  208. package/dist/src/router/resolvers/o-node.resolver.d.ts.map +1 -1
  209. package/dist/src/router/resolvers/o-node.resolver.js +5 -1
  210. package/dist/src/router/resolvers/o-node.search-resolver.d.ts.map +1 -1
  211. package/dist/src/router/resolvers/o-node.search-resolver.js +40 -10
  212. package/dist/src/streaming/index.d.ts +10 -0
  213. package/dist/src/streaming/index.d.ts.map +1 -0
  214. package/dist/src/streaming/index.js +12 -0
  215. package/dist/src/streaming/libp2p-stream-transport.d.ts +50 -0
  216. package/dist/src/streaming/libp2p-stream-transport.d.ts.map +1 -0
  217. package/dist/src/streaming/libp2p-stream-transport.js +137 -0
  218. package/dist/src/streaming/node-stream-handler.d.ts +65 -0
  219. package/dist/src/streaming/node-stream-handler.d.ts.map +1 -0
  220. package/dist/src/streaming/node-stream-handler.js +101 -0
  221. package/dist/src/streaming/o-node-streaming-client.d.ts +33 -0
  222. package/dist/src/streaming/o-node-streaming-client.d.ts.map +1 -0
  223. package/dist/src/streaming/o-node-streaming-client.js +130 -0
  224. package/dist/src/utils/circuit-breaker.d.ts +107 -0
  225. package/dist/src/utils/circuit-breaker.d.ts.map +1 -0
  226. package/dist/src/utils/circuit-breaker.js +175 -0
  227. package/dist/src/utils/circuit-breaker.test.d.ts +2 -0
  228. package/dist/src/utils/circuit-breaker.test.d.ts.map +1 -0
  229. package/dist/src/utils/circuit-breaker.test.js +262 -0
  230. package/dist/src/utils/index.d.ts +3 -0
  231. package/dist/src/utils/index.d.ts.map +1 -0
  232. package/dist/src/utils/index.js +2 -0
  233. package/dist/src/utils/leader-request-wrapper.d.ts +66 -0
  234. package/dist/src/utils/leader-request-wrapper.d.ts.map +1 -0
  235. package/dist/src/utils/leader-request-wrapper.js +160 -0
  236. package/dist/src/utils/leader-request-wrapper.test.d.ts +1 -0
  237. package/dist/src/utils/leader-request-wrapper.test.d.ts.map +1 -0
  238. package/dist/src/utils/leader-request-wrapper.test.js +246 -0
  239. package/dist/src/utils/stream.utils.d.ts +6 -0
  240. package/dist/src/utils/stream.utils.d.ts.map +1 -0
  241. package/dist/src/utils/stream.utils.js +31 -0
  242. package/dist/test/circuit-breaker.test.d.ts +2 -0
  243. package/dist/test/circuit-breaker.test.d.ts.map +1 -0
  244. package/dist/test/circuit-breaker.test.js +262 -0
  245. package/dist/test/helpers/test-node.tool.d.ts +15 -0
  246. package/dist/test/helpers/test-node.tool.d.ts.map +1 -0
  247. package/dist/test/helpers/test-node.tool.js +27 -0
  248. package/dist/test/leader-request-wrapper.test.d.ts +1 -0
  249. package/dist/test/leader-request-wrapper.test.d.ts.map +1 -0
  250. package/dist/test/leader-request-wrapper.test.js +246 -0
  251. package/dist/test/search-resolver.spec.js +79 -0
  252. package/package.json +6 -6
  253. package/dist/src/router/resolvers/o-node.child-resolver.d.ts.map +0 -1
  254. package/dist/src/router/resolvers/o-node.child-resolver.js +0 -58
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stream-transport.interface.d.ts","sourceRoot":"","sources":["../../../../../o-core/src/streaming/stream-transport.interface.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,YAAY;IACtB,IAAI,SAAS;IACb,OAAO,YAAY;IACnB,MAAM,WAAW;IACjB,KAAK,UAAU;CAChB;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,IAAI,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEtC;;;OAGG;IACH,SAAS,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,IAAI,GAAG,IAAI,CAAC;IAErD;;OAEG;IACH,oBAAoB,IAAI,IAAI,CAAC;IAE7B;;;OAGG;IACH,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEvB;;;OAGG;IACH,SAAS,IAAI,YAAY,CAAC;IAE1B;;;OAGG;IACH,MAAM,IAAI,OAAO,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Stream status states
3
+ */
4
+ export var StreamStatus;
5
+ (function (StreamStatus) {
6
+ StreamStatus["OPEN"] = "open";
7
+ StreamStatus["CLOSING"] = "closing";
8
+ StreamStatus["CLOSED"] = "closed";
9
+ StreamStatus["RESET"] = "reset";
10
+ })(StreamStatus || (StreamStatus = {}));
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Type guard to check if a value is an AsyncGenerator
3
+ * @param value - The value to check
4
+ * @returns true if the value is an AsyncGenerator
5
+ */
6
+ export declare function isAsyncGenerator(value: any): value is AsyncGenerator;
7
+ /**
8
+ * Safely iterate through an AsyncGenerator with error handling
9
+ * @param generator - The AsyncGenerator to iterate
10
+ * @param onChunk - Callback for each chunk
11
+ * @param onError - Optional error handler
12
+ * @returns Promise that resolves when iteration is complete
13
+ */
14
+ export declare function iterateAsyncGenerator<T>(generator: AsyncGenerator<T>, onChunk: (chunk: T) => Promise<void> | void, onError?: (error: unknown) => void): Promise<void>;
15
+ /**
16
+ * Collect all chunks from an AsyncGenerator into an array
17
+ * Useful for testing or converting streaming responses to non-streaming
18
+ * @param generator - The AsyncGenerator to collect from
19
+ * @returns Promise resolving to array of all chunks
20
+ */
21
+ export declare function collectStreamChunks<T>(generator: AsyncGenerator<T>): Promise<T[]>;
22
+ //# sourceMappingURL=streaming.utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"streaming.utils.d.ts","sourceRoot":"","sources":["../../../../../o-core/src/utils/streaming.utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,cAAc,CAMpE;AAED;;;;;;GAMG;AACH,wBAAsB,qBAAqB,CAAC,CAAC,EAC3C,SAAS,EAAE,cAAc,CAAC,CAAC,CAAC,EAC5B,OAAO,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,EAC3C,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,GACjC,OAAO,CAAC,IAAI,CAAC,CAYf;AAED;;;;;GAKG;AACH,wBAAsB,mBAAmB,CAAC,CAAC,EACzC,SAAS,EAAE,cAAc,CAAC,CAAC,CAAC,GAC3B,OAAO,CAAC,CAAC,EAAE,CAAC,CAMd"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Type guard to check if a value is an AsyncGenerator
3
+ * @param value - The value to check
4
+ * @returns true if the value is an AsyncGenerator
5
+ */
6
+ export function isAsyncGenerator(value) {
7
+ return (value != null &&
8
+ typeof value === 'object' &&
9
+ typeof value[Symbol.asyncIterator] === 'function');
10
+ }
11
+ /**
12
+ * Safely iterate through an AsyncGenerator with error handling
13
+ * @param generator - The AsyncGenerator to iterate
14
+ * @param onChunk - Callback for each chunk
15
+ * @param onError - Optional error handler
16
+ * @returns Promise that resolves when iteration is complete
17
+ */
18
+ export async function iterateAsyncGenerator(generator, onChunk, onError) {
19
+ try {
20
+ for await (const chunk of generator) {
21
+ await onChunk(chunk);
22
+ }
23
+ }
24
+ catch (error) {
25
+ if (onError) {
26
+ onError(error);
27
+ }
28
+ else {
29
+ throw error;
30
+ }
31
+ }
32
+ }
33
+ /**
34
+ * Collect all chunks from an AsyncGenerator into an array
35
+ * Useful for testing or converting streaming responses to non-streaming
36
+ * @param generator - The AsyncGenerator to collect from
37
+ * @returns Promise resolving to array of all chunks
38
+ */
39
+ export async function collectStreamChunks(generator) {
40
+ const chunks = [];
41
+ for await (const chunk of generator) {
42
+ chunks.push(chunk);
43
+ }
44
+ return chunks;
45
+ }
@@ -0,0 +1,5 @@
1
+ export * from './o-node-connection.js';
2
+ export * from './o-node-connection.manager.js';
3
+ export * from './interfaces/o-node-connection.config.js';
4
+ export * from './interfaces/o-node-connection-manager.config.js';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/connection/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,0CAA0C,CAAC;AACzD,cAAc,kDAAkD,CAAC"}
@@ -0,0 +1,4 @@
1
+ export * from './o-node-connection.js';
2
+ export * from './o-node-connection.manager.js';
3
+ export * from './interfaces/o-node-connection.config.js';
4
+ export * from './interfaces/o-node-connection-manager.config.js';
@@ -0,0 +1,6 @@
1
+ import { oConnectionManagerConfig } from '@olane/o-core';
2
+ import { Libp2p } from '@olane/o-config';
3
+ export interface oNodeConnectionManagerConfig extends oConnectionManagerConfig {
4
+ p2pNode: Libp2p;
5
+ }
6
+ //# sourceMappingURL=o-node-connection-manager.config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"o-node-connection-manager.config.d.ts","sourceRoot":"","sources":["../../../../../src/connection/interfaces/o-node-connection-manager.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEzC,MAAM,WAAW,4BAA6B,SAAQ,wBAAwB;IAC5E,OAAO,EAAE,MAAM,CAAC;CACjB"}
@@ -0,0 +1,6 @@
1
+ import { Connection } from '@olane/o-config';
2
+ import { oConnectionConfig } from '@olane/o-core';
3
+ export interface oNodeConnectionConfig extends oConnectionConfig {
4
+ p2pConnection: Connection;
5
+ }
6
+ //# sourceMappingURL=o-node-connection.config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"o-node-connection.config.d.ts","sourceRoot":"","sources":["../../../../../src/connection/interfaces/o-node-connection.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAElD,MAAM,WAAW,qBAAsB,SAAQ,iBAAiB;IAC9D,aAAa,EAAE,UAAU,CAAC;CAC3B"}
@@ -0,0 +1,13 @@
1
+ import { Connection, Stream } from '@olane/o-config';
2
+ import { oConnection, oRequest, oResponse } from '@olane/o-core';
3
+ import { oNodeConnectionConfig } from './interfaces/o-node-connection.config.js';
4
+ export declare class oNodeConnection extends oConnection {
5
+ protected readonly config: oNodeConnectionConfig;
6
+ p2pConnection: Connection;
7
+ constructor(config: oNodeConnectionConfig);
8
+ read(source: Stream): Promise<any>;
9
+ validate(): void;
10
+ transmit(request: oRequest): Promise<oResponse>;
11
+ close(): Promise<void>;
12
+ }
13
+ //# sourceMappingURL=o-node-connection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"o-node-connection.d.ts","sourceRoot":"","sources":["../../../../src/connection/o-node-connection.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAIV,MAAM,EAEP,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAEL,WAAW,EAGX,QAAQ,EACR,SAAS,EACV,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AAEjF,qBAAa,eAAgB,SAAQ,WAAW;IAGlC,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,qBAAqB;IAFrD,aAAa,EAAE,UAAU,CAAC;gBAEF,MAAM,EAAE,qBAAqB;IAKtD,IAAI,CAAC,MAAM,EAAE,MAAM;IAWzB,QAAQ;IAOF,QAAQ,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,SAAS,CAAC;IA0E/C,KAAK;CAKZ"}
@@ -0,0 +1,80 @@
1
+ import { Uint8ArrayList, byteStream, } from '@olane/o-config';
2
+ import { CoreUtils, oConnection, oError, oErrorCodes, oResponse, } from '@olane/o-core';
3
+ export class oNodeConnection extends oConnection {
4
+ constructor(config) {
5
+ super(config);
6
+ this.config = config;
7
+ this.p2pConnection = config.p2pConnection;
8
+ }
9
+ async read(source) {
10
+ const bytes = byteStream(source);
11
+ const output = await bytes.read({
12
+ signal: AbortSignal.timeout(this.config.readTimeoutMs ?? 120000), // Default: 2 min timeout
13
+ });
14
+ const outputObj = output instanceof Uint8ArrayList ? output.subarray() : output;
15
+ const jsonStr = new TextDecoder().decode(outputObj);
16
+ return JSON.parse(jsonStr);
17
+ }
18
+ validate() {
19
+ if (this.config.p2pConnection.status !== 'open') {
20
+ throw new Error('Connection is not valid');
21
+ }
22
+ // do nothing
23
+ }
24
+ async transmit(request) {
25
+ try {
26
+ const stream = await this.p2pConnection.newStream(this.nextHopAddress.protocol, {
27
+ maxOutboundStreams: Infinity,
28
+ runOnLimitedConnection: true, // TODO: should this be configurable?
29
+ });
30
+ const isStreamRequest = request.params._isStream;
31
+ if (!stream || (stream.status !== 'open' && stream.status !== 'reset')) {
32
+ throw new oError(oErrorCodes.FAILED_TO_DIAL_TARGET, 'Failed to dial target');
33
+ }
34
+ if (stream.status === 'reset') {
35
+ throw new oError(oErrorCodes.CONNECTION_LIMIT_REACHED, 'Connection limit reached');
36
+ }
37
+ // Send the data with backpressure handling (libp2p v3 best practice)
38
+ const data = new TextEncoder().encode(request.toString());
39
+ const sent = stream.send(data);
40
+ if (isStreamRequest) {
41
+ stream.addEventListener('message', async (event) => {
42
+ const response = await CoreUtils.processStreamResponse(event);
43
+ this.emitter.emit('chunk', response);
44
+ // marked as the last chunk let's close
45
+ if (response.result._last) {
46
+ await stream.close();
47
+ }
48
+ });
49
+ }
50
+ // If send() returns false, wait for the stream to drain before continuing
51
+ if (!sent) {
52
+ this.logger.debug('Stream buffer full, waiting for drain...');
53
+ await stream.onDrain({
54
+ signal: AbortSignal.timeout(this.config.drainTimeoutMs ?? 30000),
55
+ }); // Default: 30 second timeout
56
+ }
57
+ if (isStreamRequest) {
58
+ return Promise.resolve(CoreUtils.buildResponse(request, 'request is streaming, this response is not used', null));
59
+ }
60
+ const res = await this.read(stream);
61
+ await stream.close();
62
+ // process the response
63
+ const response = new oResponse({
64
+ ...res.result,
65
+ });
66
+ return response;
67
+ }
68
+ catch (error) {
69
+ if (error?.name === 'UnsupportedProtocolError') {
70
+ throw new oError(oErrorCodes.NOT_FOUND, 'Address not found');
71
+ }
72
+ throw error;
73
+ }
74
+ }
75
+ async close() {
76
+ this.logger.debug('Closing connection');
77
+ await this.p2pConnection.close();
78
+ this.logger.debug('Connection closed');
79
+ }
80
+ }
@@ -0,0 +1,19 @@
1
+ import { oAddress, oConnectionConfig, oConnectionManager } from '@olane/o-core';
2
+ import { oConnection } from '@olane/o-core';
3
+ import { oNodeConnectionManagerConfig } from './interfaces/o-node-connection-manager.config.js';
4
+ import { oNodeConnection } from './o-node-connection.js';
5
+ export declare class oNodeConnectionManager extends oConnectionManager {
6
+ private p2pNode;
7
+ private defaultReadTimeoutMs?;
8
+ private defaultDrainTimeoutMs?;
9
+ constructor(config: oNodeConnectionManagerConfig);
10
+ /**
11
+ * Connect to a given address with exponential backoff retry
12
+ * @param address - The address to connect to
13
+ * @returns The connection object
14
+ */
15
+ connect(config: oConnectionConfig): Promise<oNodeConnection>;
16
+ isCached(address: oAddress): boolean;
17
+ getCachedConnection(address: oAddress): oConnection | null;
18
+ }
19
+ //# sourceMappingURL=o-node-connection.manager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"o-node-connection.manager.d.ts","sourceRoot":"","sources":["../../../../src/connection/o-node-connection.manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAChF,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,EAAE,4BAA4B,EAAE,MAAM,kDAAkD,CAAC;AAEhG,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,qBAAa,sBAAuB,SAAQ,kBAAkB;IAC5D,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,oBAAoB,CAAC,CAAS;IACtC,OAAO,CAAC,qBAAqB,CAAC,CAAS;gBAE3B,MAAM,EAAE,4BAA4B;IAOhD;;;;OAIG;IACG,OAAO,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,eAAe,CAAC;IA8FlE,QAAQ,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO;IAIpC,mBAAmB,CAAC,OAAO,EAAE,QAAQ,GAAG,WAAW,GAAG,IAAI;CAe3D"}
@@ -0,0 +1,93 @@
1
+ import { oConnectionManager } from '@olane/o-core';
2
+ import { oNodeConnection } from './o-node-connection.js';
3
+ export class oNodeConnectionManager extends oConnectionManager {
4
+ constructor(config) {
5
+ super(config);
6
+ this.p2pNode = config.p2pNode;
7
+ this.defaultReadTimeoutMs = config.defaultReadTimeoutMs;
8
+ this.defaultDrainTimeoutMs = config.defaultDrainTimeoutMs;
9
+ }
10
+ /**
11
+ * Connect to a given address with exponential backoff retry
12
+ * @param address - The address to connect to
13
+ * @returns The connection object
14
+ */
15
+ async connect(config) {
16
+ const { address, nextHopAddress, callerAddress, readTimeoutMs, drainTimeoutMs, } = config;
17
+ // check if we already have a connection to this address
18
+ // TODO: how can we enable caching of connections & connection lifecycles
19
+ if (this.isCached(nextHopAddress)) {
20
+ const cachedConnection = this.getCachedConnection(nextHopAddress);
21
+ if (cachedConnection &&
22
+ cachedConnection.p2pConnection.status === 'open') {
23
+ this.logger.debug('Using cached connection for address: ' + address.toString());
24
+ return cachedConnection;
25
+ }
26
+ else {
27
+ // cached item is not valid, remove it
28
+ this.cache.delete(nextHopAddress.toString());
29
+ }
30
+ }
31
+ // Retry configuration for handling transient connection failures
32
+ const MAX_RETRIES = 3;
33
+ const BASE_DELAY_MS = 1000; // Start with 1 second
34
+ const MAX_DELAY_MS = 10000; // Cap at 10 seconds
35
+ // first time setup connection with retry logic
36
+ let lastError;
37
+ for (let attempt = 0; attempt <= MAX_RETRIES; attempt++) {
38
+ try {
39
+ if (attempt > 0) {
40
+ // Calculate exponential backoff delay: 1s, 2s, 4s, 8s (capped at MAX_DELAY_MS)
41
+ const delay = Math.min(BASE_DELAY_MS * Math.pow(2, attempt - 1), MAX_DELAY_MS);
42
+ this.logger.debug(`Retry attempt ${attempt}/${MAX_RETRIES} for ${nextHopAddress.toString()} after ${delay}ms delay`);
43
+ await new Promise((resolve) => setTimeout(resolve, delay));
44
+ }
45
+ const p2pConnection = await this.p2pNode.dial(nextHopAddress.libp2pTransports.map((ma) => ma.toMultiaddr()));
46
+ const connection = new oNodeConnection({
47
+ nextHopAddress: nextHopAddress,
48
+ address: address,
49
+ p2pConnection: p2pConnection,
50
+ callerAddress: callerAddress,
51
+ readTimeoutMs: readTimeoutMs ?? this.defaultReadTimeoutMs,
52
+ drainTimeoutMs: drainTimeoutMs ?? this.defaultDrainTimeoutMs,
53
+ isStream: config.isStream || false,
54
+ });
55
+ if (attempt > 0) {
56
+ this.logger.info(`Successfully connected to ${nextHopAddress.toString()} on retry attempt ${attempt}`);
57
+ }
58
+ // this.cache.set(nextHopAddress.toString(), connection);
59
+ return connection;
60
+ }
61
+ catch (error) {
62
+ lastError = error;
63
+ this.logger.warn(`[${callerAddress?.toString() || 'unknown'}] Connection attempt ${attempt + 1}/${MAX_RETRIES + 1} failed for ${nextHopAddress.toString()}: ${error instanceof Error ? error.message : String(error)}`);
64
+ // Don't retry on the last attempt
65
+ if (attempt === MAX_RETRIES) {
66
+ break;
67
+ }
68
+ }
69
+ }
70
+ // All retries exhausted
71
+ this.logger.error(`[${callerAddress?.toString() || 'unknown'}] Failed to connect after ${MAX_RETRIES + 1} attempts to address! Next hop: ${nextHopAddress} With Address: ${address.toString()}`, lastError);
72
+ throw lastError;
73
+ }
74
+ isCached(address) {
75
+ return this.cache.has(address.toString());
76
+ }
77
+ getCachedConnection(address) {
78
+ const key = address.toString();
79
+ try {
80
+ const connection = this.cache.get(key);
81
+ if (!connection) {
82
+ throw new Error('Connection not found in cache');
83
+ }
84
+ connection.validate();
85
+ return connection;
86
+ }
87
+ catch (error) {
88
+ this.cache.delete(key);
89
+ this.logger.error('Error getting cached connection:', error);
90
+ }
91
+ return null;
92
+ }
93
+ }
@@ -0,0 +1,11 @@
1
+ import { Request, RequestId } from '@olane/o-protocol';
2
+ import { oRequest } from '@olane/o-core';
3
+ import { Stream } from '@olane/o-config';
4
+ export declare class oStreamRequest extends oRequest {
5
+ stream: Stream;
6
+ constructor(config: Request & {
7
+ id: RequestId;
8
+ stream: Stream;
9
+ });
10
+ }
11
+ //# sourceMappingURL=o-stream.request.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"o-stream.request.d.ts","sourceRoot":"","sources":["../../../../src/connection/o-stream.request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEzC,qBAAa,cAAe,SAAQ,QAAQ;IAC1C,MAAM,EAAE,MAAM,CAAC;gBACH,MAAM,EAAE,OAAO,GAAG;QAAE,EAAE,EAAE,SAAS,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE;CAIhE"}
@@ -0,0 +1,7 @@
1
+ import { oRequest } from '@olane/o-core';
2
+ export class oStreamRequest extends oRequest {
3
+ constructor(config) {
4
+ super(config);
5
+ this.stream = config.stream;
6
+ }
7
+ }
@@ -0,0 +1,11 @@
1
+ export * from './o-node.js';
2
+ export * from './utils/index.js';
3
+ export * from './o-node.hierarchy-manager.js';
4
+ export * from './interfaces/o-node.config.js';
5
+ export * from './connection/index.js';
6
+ export * from './o-node.tool.js';
7
+ export * from './nodes/index.js';
8
+ export * from './interfaces/o-node.tool-config.js';
9
+ export * from './router/index.js';
10
+ export * from './connection/o-stream.request.js';
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oCAAoC,CAAC;AACnD,cAAc,mBAAmB,CAAC;AAClC,cAAc,kCAAkC,CAAC"}
@@ -0,0 +1,10 @@
1
+ export * from './o-node.js';
2
+ export * from './utils/index.js';
3
+ export * from './o-node.hierarchy-manager.js';
4
+ export * from './interfaces/o-node.config.js';
5
+ export * from './connection/index.js';
6
+ export * from './o-node.tool.js';
7
+ export * from './nodes/index.js';
8
+ export * from './interfaces/o-node.tool-config.js';
9
+ export * from './router/index.js';
10
+ export * from './connection/o-stream.request.js';
@@ -0,0 +1,49 @@
1
+ import { oNotificationManager } from '@olane/o-core';
2
+ import { Libp2p } from '@olane/o-config';
3
+ import { oNodeAddress } from '../router/o-node.address.js';
4
+ /**
5
+ * Interface for nodes that support connection heartbeat monitoring.
6
+ * This interface defines the contract that oConnectionHeartbeatManager needs
7
+ * to access live hierarchy state without holding stale references.
8
+ */
9
+ export interface IHeartbeatableNode {
10
+ /**
11
+ * The node's current address
12
+ */
13
+ address: oNodeAddress;
14
+ /**
15
+ * The notification manager for emitting heartbeat events
16
+ */
17
+ notificationManager: oNotificationManager;
18
+ /**
19
+ * The underlying libp2p node for ping operations
20
+ */
21
+ p2pNode: Libp2p;
22
+ /**
23
+ * The current parent address (with live transport updates)
24
+ * @returns Parent address or null if no parent
25
+ */
26
+ parent: oNodeAddress | null;
27
+ /**
28
+ * Get the current list of leader addresses
29
+ * @returns Array of leader addresses (empty if this node is the leader)
30
+ */
31
+ getLeaders(): oNodeAddress[];
32
+ /**
33
+ * Get the current list of parent addresses
34
+ * @returns Array of parent addresses
35
+ */
36
+ getParents(): oNodeAddress[];
37
+ /**
38
+ * Get the current list of child addresses
39
+ * @returns Array of child addresses
40
+ */
41
+ getChildren(): oNodeAddress[];
42
+ /**
43
+ * Remove a child from the hierarchy
44
+ * @param childAddress The address of the child to remove
45
+ */
46
+ removeChild(childAddress: oNodeAddress): void;
47
+ use(param1: any, param2: any): Promise<any>;
48
+ }
49
+ //# sourceMappingURL=i-heartbeatable-node.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"i-heartbeatable-node.d.ts","sourceRoot":"","sources":["../../../../src/interfaces/i-heartbeatable-node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,OAAO,EAAE,YAAY,CAAC;IAEtB;;OAEG;IACH,mBAAmB,EAAE,oBAAoB,CAAC;IAE1C;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,MAAM,EAAE,YAAY,GAAG,IAAI,CAAC;IAE5B;;;OAGG;IACH,UAAU,IAAI,YAAY,EAAE,CAAC;IAE7B;;;OAGG;IACH,UAAU,IAAI,YAAY,EAAE,CAAC;IAE7B;;;OAGG;IACH,WAAW,IAAI,YAAY,EAAE,CAAC;IAE9B;;;OAGG;IACH,WAAW,CAAC,YAAY,EAAE,YAAY,GAAG,IAAI,CAAC;IAE9C,GAAG,CAAC,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;CAC7C"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,46 @@
1
+ import { oAddress, NodeState, oNotificationManager } from '@olane/o-core';
2
+ import { oNodeAddress } from '../router/o-node.address.js';
3
+ import { oNodeConfig } from './o-node.config.js';
4
+ /**
5
+ * Interface for nodes that support reconnection management.
6
+ * This interface defines the contract that oReconnectionManager needs
7
+ * to perform reconnection operations without creating a circular dependency.
8
+ */
9
+ export interface IReconnectableNode {
10
+ /**
11
+ * The node's configuration
12
+ */
13
+ config: oNodeConfig;
14
+ /**
15
+ * The node's current address
16
+ */
17
+ address: oNodeAddress;
18
+ /**
19
+ * The node's current state
20
+ */
21
+ state: NodeState;
22
+ /**
23
+ * The notification manager for subscribing to events
24
+ */
25
+ notificationManager: oNotificationManager;
26
+ /**
27
+ * Register with the parent node
28
+ */
29
+ registerParent(): Promise<void>;
30
+ /**
31
+ * Register with the leader's global registry
32
+ */
33
+ register(): Promise<void>;
34
+ useSelf(request?: any): Promise<any>;
35
+ /**
36
+ * Execute a method on another node
37
+ */
38
+ use(address: oAddress, data?: {
39
+ method?: string;
40
+ params?: {
41
+ [key: string]: any;
42
+ };
43
+ id?: string;
44
+ }): Promise<any>;
45
+ }
46
+ //# sourceMappingURL=i-reconnectable-node.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"i-reconnectable-node.d.ts","sourceRoot":"","sources":["../../../../src/interfaces/i-reconnectable-node.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,SAAS,EACT,oBAAoB,EAErB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,MAAM,EAAE,WAAW,CAAC;IAEpB;;OAEG;IACH,OAAO,EAAE,YAAY,CAAC;IAEtB;;OAEG;IACH,KAAK,EAAE,SAAS,CAAC;IAEjB;;OAEG;IACH,mBAAmB,EAAE,oBAAoB,CAAC;IAE1C;;OAEG;IACH,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEhC;;OAEG;IACH,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAE1B,OAAO,CAAC,OAAO,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;IAErC;;OAEG;IACH,GAAG,CACD,OAAO,EAAE,QAAQ,EACjB,IAAI,CAAC,EAAE;QACL,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,MAAM,CAAC,EAAE;YAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;SAAE,CAAC;QAChC,EAAE,CAAC,EAAE,MAAM,CAAC;KACb,GACA,OAAO,CAAC,GAAG,CAAC,CAAC;CACjB"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,66 @@
1
+ import { oCoreConfig } from '@olane/o-core';
2
+ import { oNodeAddress } from '../router/o-node.address.js';
3
+ export interface oNodeConfig extends oCoreConfig {
4
+ leader: oNodeAddress | null;
5
+ parent: oNodeAddress | null;
6
+ /**
7
+ * Connection heartbeat configuration (libp2p-native pings)
8
+ * Detects dead connections via periodic pings using libp2p's ping service
9
+ */
10
+ connectionHeartbeat?: {
11
+ enabled?: boolean;
12
+ intervalMs?: number;
13
+ timeoutMs?: number;
14
+ failureThreshold?: number;
15
+ checkChildren?: boolean;
16
+ checkParent?: boolean;
17
+ checkLeader?: boolean;
18
+ };
19
+ /**
20
+ * Automatic reconnection configuration
21
+ * Handles parent connection failures and attempts to reconnect
22
+ */
23
+ reconnection?: {
24
+ enabled?: boolean;
25
+ maxAttempts?: number;
26
+ baseDelayMs?: number;
27
+ maxDelayMs?: number;
28
+ useLeaderFallback?: boolean;
29
+ parentDiscoveryIntervalMs?: number;
30
+ parentDiscoveryMaxDelayMs?: number;
31
+ };
32
+ /**
33
+ * Leader request retry configuration
34
+ * Handles temporary leader unavailability (healing, maintenance)
35
+ */
36
+ leaderRetry?: {
37
+ enabled?: boolean;
38
+ maxAttempts?: number;
39
+ baseDelayMs?: number;
40
+ maxDelayMs?: number;
41
+ timeoutMs?: number;
42
+ circuitBreaker?: {
43
+ enabled?: boolean;
44
+ failureThreshold?: number;
45
+ openTimeoutMs?: number;
46
+ halfOpenMaxAttempts?: number;
47
+ };
48
+ };
49
+ /**
50
+ * Connection timeout configuration
51
+ * Controls timeouts for stream read and drain operations in connections
52
+ */
53
+ connectionTimeouts?: {
54
+ /**
55
+ * Timeout in milliseconds for reading response data from a stream
56
+ * Default: 120000 (2 minutes)
57
+ */
58
+ readTimeoutMs?: number;
59
+ /**
60
+ * Timeout in milliseconds for waiting for stream buffer to drain when backpressure occurs
61
+ * Default: 30000 (30 seconds)
62
+ */
63
+ drainTimeoutMs?: number;
64
+ };
65
+ }
66
+ //# sourceMappingURL=o-node.config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"o-node.config.d.ts","sourceRoot":"","sources":["../../../../src/interfaces/o-node.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D,MAAM,WAAW,WAAY,SAAQ,WAAW;IAC9C,MAAM,EAAE,YAAY,GAAG,IAAI,CAAC;IAC5B,MAAM,EAAE,YAAY,GAAG,IAAI,CAAC;IAE5B;;;OAGG;IACH,mBAAmB,CAAC,EAAE;QACpB,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,aAAa,CAAC,EAAE,OAAO,CAAC;QACxB,WAAW,CAAC,EAAE,OAAO,CAAC;QACtB,WAAW,CAAC,EAAE,OAAO,CAAC;KACvB,CAAC;IAEF;;;OAGG;IACH,YAAY,CAAC,EAAE;QACb,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,iBAAiB,CAAC,EAAE,OAAO,CAAC;QAC5B,yBAAyB,CAAC,EAAE,MAAM,CAAC;QACnC,yBAAyB,CAAC,EAAE,MAAM,CAAC;KACpC,CAAC;IAEF;;;OAGG;IACH,WAAW,CAAC,EAAE;QACZ,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,cAAc,CAAC,EAAE;YACf,OAAO,CAAC,EAAE,OAAO,CAAC;YAClB,gBAAgB,CAAC,EAAE,MAAM,CAAC;YAC1B,aAAa,CAAC,EAAE,MAAM,CAAC;YACvB,mBAAmB,CAAC,EAAE,MAAM,CAAC;SAC9B,CAAC;KACH,CAAC;IAEF;;;OAGG;IACH,kBAAkB,CAAC,EAAE;QACnB;;;WAGG;QACH,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB;;;WAGG;QACH,cAAc,CAAC,EAAE,MAAM,CAAC;KACzB,CAAC;CACH"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ import { oNodeConfig } from './o-node.config';
2
+ export interface oNodeToolConfig extends Omit<oNodeConfig, 'address'> {
3
+ }
4
+ //# sourceMappingURL=o-node.tool-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"o-node.tool-config.d.ts","sourceRoot":"","sources":["../../../../src/interfaces/o-node.tool-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,MAAM,WAAW,eAAgB,SAAQ,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC;CAAG"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=network-activity.lib.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"network-activity.lib.d.ts","sourceRoot":"","sources":["../../../../src/lib/network-activity.lib.ts"],"names":[],"mappings":""}