@graphrefly/ts 0.0.1 → 0.0.3

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 (333) hide show
  1. package/README.md +197 -117
  2. package/dist/actions-types-CH-XCU9O.d.cts +657 -0
  3. package/dist/actions-types-w2iPQTkv.d.ts +657 -0
  4. package/dist/adapters/index.cjs +5157 -2951
  5. package/dist/adapters/index.cjs.map +1 -1
  6. package/dist/adapters/index.d.cts +207 -70
  7. package/dist/adapters/index.d.ts +207 -70
  8. package/dist/adapters/index.js +3738 -1688
  9. package/dist/adapters/index.js.map +1 -1
  10. package/dist/adapters/nestjs/microservices.cjs +841 -0
  11. package/dist/adapters/nestjs/microservices.cjs.map +1 -0
  12. package/dist/adapters/nestjs/microservices.d.cts +45 -0
  13. package/dist/adapters/nestjs/microservices.d.ts +45 -0
  14. package/dist/adapters/nestjs/microservices.js +206 -0
  15. package/dist/adapters/nestjs/microservices.js.map +1 -0
  16. package/dist/adapters/nestjs/native.cjs +1391 -0
  17. package/dist/adapters/nestjs/native.cjs.map +1 -0
  18. package/dist/adapters/nestjs/native.d.cts +111 -0
  19. package/dist/adapters/nestjs/native.d.ts +111 -0
  20. package/dist/adapters/nestjs/native.js +577 -0
  21. package/dist/adapters/nestjs/native.js.map +1 -0
  22. package/dist/adapters/nestjs/websockets.cjs +924 -0
  23. package/dist/adapters/nestjs/websockets.cjs.map +1 -0
  24. package/dist/adapters/nestjs/websockets.d.cts +47 -0
  25. package/dist/adapters/nestjs/websockets.d.ts +47 -0
  26. package/dist/adapters/nestjs/websockets.js +286 -0
  27. package/dist/adapters/nestjs/websockets.js.map +1 -0
  28. package/dist/adapters/nestjs.cjs +1085 -0
  29. package/dist/adapters/nestjs.cjs.map +1 -0
  30. package/dist/adapters/nestjs.d.cts +385 -0
  31. package/dist/adapters/nestjs.d.ts +385 -0
  32. package/dist/adapters/nestjs.js +112 -0
  33. package/dist/adapters/nestjs.js.map +1 -0
  34. package/dist/adapters/observe-storage.d.cts +3 -3
  35. package/dist/adapters/observe-storage.d.ts +3 -3
  36. package/dist/adapters/observe-storage.js +4 -4
  37. package/dist/adapters/react.cjs.map +1 -1
  38. package/dist/adapters/react.d.cts +2 -2
  39. package/dist/adapters/react.d.ts +2 -2
  40. package/dist/adapters/react.js +1 -1
  41. package/dist/adapters/solid.cjs.map +1 -1
  42. package/dist/adapters/solid.d.cts +2 -2
  43. package/dist/adapters/solid.d.ts +2 -2
  44. package/dist/adapters/solid.js +1 -1
  45. package/dist/adapters/svelte.cjs.map +1 -1
  46. package/dist/adapters/svelte.d.cts +2 -2
  47. package/dist/adapters/svelte.d.ts +2 -2
  48. package/dist/adapters/svelte.js +1 -1
  49. package/dist/adapters/vue.cjs.map +1 -1
  50. package/dist/adapters/vue.d.cts +2 -2
  51. package/dist/adapters/vue.d.ts +2 -2
  52. package/dist/adapters/vue.js +1 -1
  53. package/dist/{agent-runtime-BesGDZcB.d.ts → agent-runtime-types-core-CKwrBDyi.d.ts} +171 -320
  54. package/dist/{agent-runtime-DZTJ3C-p.d.cts → agent-runtime-types-core-bfl4m0vM.d.cts} +171 -320
  55. package/dist/agent-runtime-types-tool-BLPV3azj.d.cts +695 -0
  56. package/dist/agent-runtime-types-tool-hwqvVqNt.d.ts +695 -0
  57. package/dist/agentic-memory-retention-CLwI76JK.d.ts +14 -0
  58. package/dist/agentic-memory-retention-Cz8GR6ie.d.cts +14 -0
  59. package/dist/{agentic-memory-DfuVZ-lY.d.cts → agentic-memory-types-JDr7MPhh.d.cts} +13 -57
  60. package/dist/{agentic-memory-BmRCvh0d.d.ts → agentic-memory-types-khYJgzKL.d.ts} +13 -57
  61. package/dist/{capability-admission-B0BzqAm5.d.cts → capability-admission-B8RNFyaZ.d.cts} +3 -3
  62. package/dist/{capability-admission-g0mn9hpq.d.ts → capability-admission-Dkw1Xz3r.d.ts} +3 -3
  63. package/dist/chunk-2KUAG2GZ.js +9693 -0
  64. package/dist/chunk-2KUAG2GZ.js.map +1 -0
  65. package/dist/{chunk-CZNV3VXM.js → chunk-3J7UPZL5.js} +11 -11
  66. package/dist/{chunk-HKK2JD7Z.js → chunk-3LYI6ADX.js} +12 -125
  67. package/dist/chunk-3LYI6ADX.js.map +1 -0
  68. package/dist/{chunk-YXMZ2N6J.js → chunk-4M37FH2I.js} +1071 -1025
  69. package/dist/chunk-4M37FH2I.js.map +1 -0
  70. package/dist/{chunk-YDSIVHRR.js → chunk-4NWSNI4K.js} +1598 -1584
  71. package/dist/chunk-4NWSNI4K.js.map +1 -0
  72. package/dist/{chunk-Z2ANQ6JW.js → chunk-4Q77MMJY.js} +2 -2
  73. package/dist/{chunk-SS2A464I.js → chunk-54WPEODM.js} +3 -3
  74. package/dist/chunk-54WPEODM.js.map +1 -0
  75. package/dist/chunk-6E76H4OU.js +132 -0
  76. package/dist/chunk-6E76H4OU.js.map +1 -0
  77. package/dist/chunk-7GOTIIQ7.js +819 -0
  78. package/dist/chunk-7GOTIIQ7.js.map +1 -0
  79. package/dist/{chunk-V7CIJE4B.js → chunk-DKFWDTVY.js} +92 -9
  80. package/dist/chunk-DKFWDTVY.js.map +1 -0
  81. package/dist/{chunk-FBUU43PM.js → chunk-E4QCH32M.js} +448 -446
  82. package/dist/chunk-E4QCH32M.js.map +1 -0
  83. package/dist/{chunk-XKXWK2KP.js → chunk-GXU6WFEJ.js} +1157 -1021
  84. package/dist/chunk-GXU6WFEJ.js.map +1 -0
  85. package/dist/{chunk-K3FXTC3I.js → chunk-HJACH5PU.js} +3 -3
  86. package/dist/{chunk-GTPCOEOZ.js → chunk-IDMLXLLG.js} +3 -3
  87. package/dist/{chunk-DKP56CSW.js → chunk-JKAYLDQV.js} +2 -2
  88. package/dist/{chunk-4VLAQHZI.js → chunk-K7FB3JTD.js} +17 -1
  89. package/dist/chunk-K7FB3JTD.js.map +1 -0
  90. package/dist/{chunk-43BKLFZU.js → chunk-KFURM6FM.js} +10 -10
  91. package/dist/{chunk-H75VXTGT.js → chunk-L6LDXRWE.js} +3 -3
  92. package/dist/{chunk-H75VXTGT.js.map → chunk-L6LDXRWE.js.map} +1 -1
  93. package/dist/chunk-MCOFHMUU.js +4131 -0
  94. package/dist/chunk-MCOFHMUU.js.map +1 -0
  95. package/dist/chunk-MQEQMS7B.js +1009 -0
  96. package/dist/chunk-MQEQMS7B.js.map +1 -0
  97. package/dist/chunk-MTELVIYR.js +1421 -0
  98. package/dist/chunk-MTELVIYR.js.map +1 -0
  99. package/dist/{chunk-3JR3EDB2.js → chunk-NNDIFUKX.js} +121 -115
  100. package/dist/chunk-NNDIFUKX.js.map +1 -0
  101. package/dist/{chunk-2747WN4Y.js → chunk-PUSRRALM.js} +3 -3
  102. package/dist/{chunk-QFY4AFY4.js → chunk-PVC7WDKI.js} +58 -52
  103. package/dist/chunk-PVC7WDKI.js.map +1 -0
  104. package/dist/{chunk-VTHLCFN4.js → chunk-RAHNUYA5.js} +2 -2
  105. package/dist/chunk-TQPCAIQI.js +612 -0
  106. package/dist/chunk-TQPCAIQI.js.map +1 -0
  107. package/dist/{chunk-IXZBUWSP.js → chunk-UEMN5URK.js} +2 -2
  108. package/dist/chunk-WOS7RJYZ.js +1320 -0
  109. package/dist/chunk-WOS7RJYZ.js.map +1 -0
  110. package/dist/{chunk-6PHB5CJS.js → chunk-ZLFRB6FI.js} +2 -2
  111. package/dist/composition/index.cjs +1228 -1076
  112. package/dist/composition/index.cjs.map +1 -1
  113. package/dist/composition/index.d.cts +3 -3
  114. package/dist/composition/index.d.ts +3 -3
  115. package/dist/composition/index.js +4 -4
  116. package/dist/core/index.cjs +1198 -1046
  117. package/dist/core/index.cjs.map +1 -1
  118. package/dist/core/index.d.cts +23 -2
  119. package/dist/core/index.d.ts +23 -2
  120. package/dist/core/index.js +2 -2
  121. package/dist/cqrs/index.d.cts +3 -3
  122. package/dist/cqrs/index.d.ts +3 -3
  123. package/dist/cqrs/messaging.d.cts +4 -4
  124. package/dist/cqrs/messaging.d.ts +4 -4
  125. package/dist/cqrs/work-queue.d.cts +5 -5
  126. package/dist/cqrs/work-queue.d.ts +5 -5
  127. package/dist/data-structures/index.cjs +1226 -1074
  128. package/dist/data-structures/index.cjs.map +1 -1
  129. package/dist/data-structures/index.d.cts +8 -7
  130. package/dist/data-structures/index.d.ts +8 -7
  131. package/dist/data-structures/index.js +6 -5
  132. package/dist/{describe-DYMw_l1C.d.cts → describe-BumQ-3_0.d.cts} +1 -1
  133. package/dist/{describe-BpyJuWkw.d.ts → describe-cYr_Z5zm.d.ts} +1 -1
  134. package/dist/executors/tool-provider-adapters.cjs +3091 -0
  135. package/dist/executors/tool-provider-adapters.cjs.map +1 -0
  136. package/dist/executors/tool-provider-adapters.d.cts +174 -0
  137. package/dist/executors/tool-provider-adapters.d.ts +174 -0
  138. package/dist/executors/tool-provider-adapters.js +1336 -0
  139. package/dist/executors/tool-provider-adapters.js.map +1 -0
  140. package/dist/executors/tool-provider-runtime.cjs +5178 -0
  141. package/dist/executors/tool-provider-runtime.cjs.map +1 -0
  142. package/dist/executors/tool-provider-runtime.d.cts +17 -0
  143. package/dist/executors/tool-provider-runtime.d.ts +17 -0
  144. package/dist/executors/tool-provider-runtime.js +15 -0
  145. package/dist/executors/tool-provider-runtime.js.map +1 -0
  146. package/dist/executors/tool-provider.cjs +6392 -0
  147. package/dist/executors/tool-provider.cjs.map +1 -0
  148. package/dist/executors/tool-provider.d.cts +60 -0
  149. package/dist/executors/tool-provider.d.ts +60 -0
  150. package/dist/executors/tool-provider.js +89 -0
  151. package/dist/executors/tool-provider.js.map +1 -0
  152. package/dist/executors/work-queue.d.cts +6 -6
  153. package/dist/executors/work-queue.d.ts +6 -6
  154. package/dist/graph/index.cjs +1499 -1341
  155. package/dist/graph/index.cjs.map +1 -1
  156. package/dist/graph/index.d.cts +9 -8
  157. package/dist/graph/index.d.ts +9 -8
  158. package/dist/graph/index.js +23 -22
  159. package/dist/{graph-DCEWh4T2.d.cts → graph-C1C-wb0L.d.cts} +266 -137
  160. package/dist/{graph-D-1-SQeC.d.ts → graph-CS0b4V9B.d.ts} +266 -137
  161. package/dist/{index-72VZC0-E.d.cts → index-DLrNopda.d.cts} +151 -10
  162. package/dist/{index-Bmxeu0nK.d.ts → index-DzJni3_6.d.ts} +151 -10
  163. package/dist/index.cjs +3397 -3140
  164. package/dist/index.cjs.map +1 -1
  165. package/dist/index.d.cts +12 -9
  166. package/dist/index.d.ts +12 -9
  167. package/dist/index.js +110 -109
  168. package/dist/inspection/boundary.d.cts +4 -4
  169. package/dist/inspection/boundary.d.ts +4 -4
  170. package/dist/measurements-BWAnochv.d.ts +294 -0
  171. package/dist/measurements-B_gJfD8h.d.cts +294 -0
  172. package/dist/messaging/index.cjs +57 -51
  173. package/dist/messaging/index.cjs.map +1 -1
  174. package/dist/messaging/index.d.cts +11 -276
  175. package/dist/messaging/index.d.ts +11 -276
  176. package/dist/messaging/index.js +1 -1
  177. package/dist/operators/index.cjs +1228 -1076
  178. package/dist/operators/index.cjs.map +1 -1
  179. package/dist/operators/index.d.cts +5 -5
  180. package/dist/operators/index.d.ts +5 -5
  181. package/dist/operators/index.js +5 -5
  182. package/dist/orchestration/index.cjs +8844 -6071
  183. package/dist/orchestration/index.cjs.map +1 -1
  184. package/dist/orchestration/index.d.cts +171 -224
  185. package/dist/orchestration/index.d.ts +171 -224
  186. package/dist/orchestration/index.js +42 -991
  187. package/dist/orchestration/index.js.map +1 -1
  188. package/dist/orchestration/messaging.d.cts +5 -8
  189. package/dist/orchestration/messaging.d.ts +5 -8
  190. package/dist/orchestration/work-queue.cjs +1243 -5
  191. package/dist/orchestration/work-queue.cjs.map +1 -1
  192. package/dist/orchestration/work-queue.d.cts +121 -10
  193. package/dist/orchestration/work-queue.d.ts +121 -10
  194. package/dist/orchestration/work-queue.js +1067 -4
  195. package/dist/orchestration/work-queue.js.map +1 -1
  196. package/dist/patterns/event-flow.cjs +6 -20
  197. package/dist/patterns/event-flow.cjs.map +1 -1
  198. package/dist/patterns/event-flow.d.cts +4 -4
  199. package/dist/patterns/event-flow.d.ts +4 -4
  200. package/dist/patterns/event-flow.js +2 -2
  201. package/dist/patterns/index.cjs +453 -465
  202. package/dist/patterns/index.cjs.map +1 -1
  203. package/dist/patterns/index.d.cts +6 -5
  204. package/dist/patterns/index.d.ts +6 -5
  205. package/dist/patterns/index.js +3 -3
  206. package/dist/process-types-BB7oRhX3.d.cts +200 -0
  207. package/dist/process-types-QNhyoYJ8.d.ts +200 -0
  208. package/dist/{reactive-collection-DNV0-gFi.d.cts → reactive-collection-BYlWvtnp.d.cts} +4 -34
  209. package/dist/{reactive-collection-BAmfrGjd.d.ts → reactive-collection-efOEdGFN.d.ts} +4 -34
  210. package/dist/{reactive-collection-storage-BNEldDyi.d.cts → reactive-collection-storage-BjoLsoiC.d.cts} +5 -5
  211. package/dist/{reactive-collection-storage-YZsAQsWK.d.ts → reactive-collection-storage-DwW6UuK_.d.ts} +5 -5
  212. package/dist/{reactive-map-DRD1LJ2H.d.cts → reactive-map-BHacbIqz.d.cts} +7 -2
  213. package/dist/{reactive-map-EsDiCmJk.d.ts → reactive-map-DN4Jyqnf.d.ts} +7 -2
  214. package/dist/render/index.d.cts +2 -2
  215. package/dist/render/index.d.ts +2 -2
  216. package/dist/scheduled-readiness-BmqXxnzX.d.ts +91 -0
  217. package/dist/scheduled-readiness-CYSw7KDE.d.cts +91 -0
  218. package/dist/semantic-memory-graph-B_LwbM-E.d.cts +30 -0
  219. package/dist/semantic-memory-graph-rsFNNhwn.d.ts +30 -0
  220. package/dist/{semantic-memory-graph-DKuNzuWw.d.cts → semantic-memory-graph-types-Y73bbwVI.d.cts} +2 -28
  221. package/dist/{semantic-memory-graph-uwbwJdhe.d.ts → semantic-memory-graph-types-safmPkuX.d.ts} +2 -28
  222. package/dist/solutions/index.cjs +6353 -6169
  223. package/dist/solutions/index.cjs.map +1 -1
  224. package/dist/solutions/index.d.cts +12 -10
  225. package/dist/solutions/index.d.ts +12 -10
  226. package/dist/solutions/index.js +5 -5
  227. package/dist/solutions/reactive-layout/browser/index.cjs +116 -108
  228. package/dist/solutions/reactive-layout/browser/index.cjs.map +1 -1
  229. package/dist/solutions/reactive-layout/browser/index.d.cts +4 -4
  230. package/dist/solutions/reactive-layout/browser/index.d.ts +4 -4
  231. package/dist/solutions/reactive-layout/browser/index.js +3 -3
  232. package/dist/solutions/reactive-layout/index.cjs +3578 -3350
  233. package/dist/solutions/reactive-layout/index.cjs.map +1 -1
  234. package/dist/solutions/reactive-layout/index.d.cts +32 -576
  235. package/dist/solutions/reactive-layout/index.d.ts +32 -576
  236. package/dist/solutions/reactive-layout/index.js +65 -5
  237. package/dist/solutions/reactive-layout/node-canvas/index.cjs +127 -117
  238. package/dist/solutions/reactive-layout/node-canvas/index.cjs.map +1 -1
  239. package/dist/solutions/reactive-layout/node-canvas/index.d.cts +4 -4
  240. package/dist/solutions/reactive-layout/node-canvas/index.d.ts +4 -4
  241. package/dist/solutions/reactive-layout/node-canvas/index.js +3 -3
  242. package/dist/solutions/reactive-layout/react-native/index.cjs +127 -117
  243. package/dist/solutions/reactive-layout/react-native/index.cjs.map +1 -1
  244. package/dist/solutions/reactive-layout/react-native/index.d.cts +4 -4
  245. package/dist/solutions/reactive-layout/react-native/index.d.ts +4 -4
  246. package/dist/solutions/reactive-layout/react-native/index.js +3 -3
  247. package/dist/solutions/reactive-layout/skia/index.cjs +127 -117
  248. package/dist/solutions/reactive-layout/skia/index.cjs.map +1 -1
  249. package/dist/solutions/reactive-layout/skia/index.d.cts +4 -4
  250. package/dist/solutions/reactive-layout/skia/index.d.ts +4 -4
  251. package/dist/solutions/reactive-layout/skia/index.js +3 -3
  252. package/dist/solutions/work-item/actions.cjs +1609 -1428
  253. package/dist/solutions/work-item/actions.cjs.map +1 -1
  254. package/dist/solutions/work-item/actions.d.cts +23 -184
  255. package/dist/solutions/work-item/actions.d.ts +23 -184
  256. package/dist/solutions/work-item/actions.js +1558 -934
  257. package/dist/solutions/work-item/actions.js.map +1 -1
  258. package/dist/solutions/work-item/scheduling.cjs +9181 -1838
  259. package/dist/solutions/work-item/scheduling.cjs.map +1 -1
  260. package/dist/solutions/work-item/scheduling.d.cts +1763 -328
  261. package/dist/solutions/work-item/scheduling.d.ts +1763 -328
  262. package/dist/solutions/work-item/scheduling.js +117 -3
  263. package/dist/solutions/work-item/work-queue.d.cts +7 -7
  264. package/dist/solutions/work-item/work-queue.d.ts +7 -7
  265. package/dist/sources/browser.cjs +1318 -1083
  266. package/dist/sources/browser.cjs.map +1 -1
  267. package/dist/sources/browser.d.cts +22 -6
  268. package/dist/sources/browser.d.ts +22 -6
  269. package/dist/sources/browser.js +4 -4
  270. package/dist/sources/browser.js.map +1 -1
  271. package/dist/sources/index.cjs +1318 -1083
  272. package/dist/sources/index.cjs.map +1 -1
  273. package/dist/sources/index.d.cts +4 -4
  274. package/dist/sources/index.d.ts +4 -4
  275. package/dist/sources/index.js +4 -4
  276. package/dist/sources/node.d.cts +3 -3
  277. package/dist/sources/node.d.ts +3 -3
  278. package/dist/storage/browser.cjs +16 -0
  279. package/dist/storage/browser.cjs.map +1 -1
  280. package/dist/storage/browser.js +3 -3
  281. package/dist/storage/index.cjs +16 -0
  282. package/dist/storage/index.cjs.map +1 -1
  283. package/dist/storage/index.d.cts +5 -4
  284. package/dist/storage/index.d.ts +5 -4
  285. package/dist/storage/index.js +6 -6
  286. package/dist/storage/node.cjs +16 -0
  287. package/dist/storage/node.cjs.map +1 -1
  288. package/dist/storage/node.js +3 -3
  289. package/dist/{store-C-joM4gh.d.ts → store-6_CHF6Ge.d.ts} +1 -1
  290. package/dist/{store-CNJwmT-h.d.cts → store-BljX8RkQ.d.cts} +1 -1
  291. package/dist/types-BAw2QVVE.d.cts +274 -0
  292. package/dist/types-BUbbbh4f.d.cts +34 -0
  293. package/dist/types-CMnzoL54.d.cts +457 -0
  294. package/dist/{types-CcPIn7sy.d.cts → types-CTN3XoMl.d.cts} +57 -108
  295. package/dist/types-CV_ohy5T.d.cts +357 -0
  296. package/dist/{types-BsJvElYZ.d.ts → types-DChxk1vK.d.ts} +57 -108
  297. package/dist/types-DRu7SnLV.d.ts +274 -0
  298. package/dist/types-DeID_FRl.d.ts +34 -0
  299. package/dist/types-IhKH0hGW.d.ts +357 -0
  300. package/dist/types-ePlD2uyT.d.ts +457 -0
  301. package/dist/{work-item-runtime-qaVgsL0T.d.cts → work-item-runtime-types-BTxLskN5.d.cts} +3 -93
  302. package/dist/{work-item-runtime-C3M79vE9.d.ts → work-item-runtime-types-DAsZbb2y.d.ts} +3 -93
  303. package/dist/work-queue/index.cjs +957 -953
  304. package/dist/work-queue/index.cjs.map +1 -1
  305. package/dist/work-queue/index.d.cts +9 -357
  306. package/dist/work-queue/index.d.ts +9 -357
  307. package/dist/work-queue/index.js +957 -953
  308. package/dist/work-queue/index.js.map +1 -1
  309. package/package.json +611 -513
  310. package/dist/chunk-3JR3EDB2.js.map +0 -1
  311. package/dist/chunk-4VLAQHZI.js.map +0 -1
  312. package/dist/chunk-6XAIOL3X.js +0 -2407
  313. package/dist/chunk-6XAIOL3X.js.map +0 -1
  314. package/dist/chunk-FBUU43PM.js.map +0 -1
  315. package/dist/chunk-HKK2JD7Z.js.map +0 -1
  316. package/dist/chunk-PC3BTTBE.js +0 -3217
  317. package/dist/chunk-PC3BTTBE.js.map +0 -1
  318. package/dist/chunk-QFY4AFY4.js.map +0 -1
  319. package/dist/chunk-SS2A464I.js.map +0 -1
  320. package/dist/chunk-V7CIJE4B.js.map +0 -1
  321. package/dist/chunk-XKXWK2KP.js.map +0 -1
  322. package/dist/chunk-YDSIVHRR.js.map +0 -1
  323. package/dist/chunk-YXMZ2N6J.js.map +0 -1
  324. /package/dist/{chunk-CZNV3VXM.js.map → chunk-3J7UPZL5.js.map} +0 -0
  325. /package/dist/{chunk-Z2ANQ6JW.js.map → chunk-4Q77MMJY.js.map} +0 -0
  326. /package/dist/{chunk-K3FXTC3I.js.map → chunk-HJACH5PU.js.map} +0 -0
  327. /package/dist/{chunk-GTPCOEOZ.js.map → chunk-IDMLXLLG.js.map} +0 -0
  328. /package/dist/{chunk-DKP56CSW.js.map → chunk-JKAYLDQV.js.map} +0 -0
  329. /package/dist/{chunk-43BKLFZU.js.map → chunk-KFURM6FM.js.map} +0 -0
  330. /package/dist/{chunk-2747WN4Y.js.map → chunk-PUSRRALM.js.map} +0 -0
  331. /package/dist/{chunk-VTHLCFN4.js.map → chunk-RAHNUYA5.js.map} +0 -0
  332. /package/dist/{chunk-IXZBUWSP.js.map → chunk-UEMN5URK.js.map} +0 -0
  333. /package/dist/{chunk-6PHB5CJS.js.map → chunk-ZLFRB6FI.js.map} +0 -0
@@ -0,0 +1,841 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/adapters/nestjs/microservices.ts
21
+ var microservices_exports = {};
22
+ __export(microservices_exports, {
23
+ GRAPHREFLY_NEST_MESSAGE_BRIDGE: () => GRAPHREFLY_NEST_MESSAGE_BRIDGE,
24
+ GraphMessage: () => GraphMessage,
25
+ GraphMessageReply: () => GraphMessageReply,
26
+ createGraphMessageBridge: () => createGraphMessageBridge,
27
+ fromNestMessage: () => fromNestMessage,
28
+ provideGraphMessageBridge: () => provideGraphMessageBridge,
29
+ provideGraphMessageProviders: () => provideGraphMessageProviders
30
+ });
31
+ module.exports = __toCommonJS(microservices_exports);
32
+
33
+ // src/adapters/nestjs.ts
34
+ var NEST_BOUNDARY_ENVELOPE_VERSION = 1;
35
+ var NEST_BOUNDARY_PAYLOAD_MAX_BYTES = 64 * 1024;
36
+ var NEST_HTTP_DIAGNOSTICS_MAX_RETAINED = 100;
37
+ var NEST_BOUNDARY_BINDINGS = /* @__PURE__ */ new WeakMap();
38
+ function fromNestMessage(graph, opts = {}) {
39
+ return nestIngress(graph, "message", opts);
40
+ }
41
+ function toNestHttp(egress, opts = {}) {
42
+ const bindingId = stableBindingId("http", opts);
43
+ const scopedBindingId = opts.bindingId;
44
+ const maxDiagnostics = diagnosticsRetainedLimit(opts.maxDiagnostics);
45
+ const maxPayloadBytes = payloadByteLimit(opts.maxPayloadBytes);
46
+ const pending = /* @__PURE__ */ new Map();
47
+ const diagnostics = [];
48
+ let active = true;
49
+ let terminal;
50
+ const report = (diagnostic) => {
51
+ pushDiagnostic(diagnostics, diagnostic, maxDiagnostics);
52
+ try {
53
+ const phase = diagnostic.phase ?? opts.diagnosticPhase ?? "http";
54
+ const payload = sanitizeNestDiagnostic({ ...diagnostic, phase }, phase);
55
+ opts.diagnosticBoundary?.emit(payload, { payload });
56
+ } catch {
57
+ }
58
+ };
59
+ const keyOf = (requestId, requestBindingId) => requestBindingId === void 0 ? requestId : `${requestBindingId}\0${requestId}`;
60
+ const rejectEntry = (entry, error, envelope, message) => {
61
+ try {
62
+ entry.handle.reject(error, envelope);
63
+ } catch (rejectError) {
64
+ report({
65
+ kind: "reject-threw",
66
+ requestId: entry.requestId,
67
+ bindingId: entry.bindingId,
68
+ message,
69
+ error: rejectError
70
+ });
71
+ }
72
+ };
73
+ const rejectPending = (kind, error, message) => {
74
+ const entries = [...pending.values()];
75
+ pending.clear();
76
+ if (entries.length === 0) return 0;
77
+ report({ kind, bindingId: scopedBindingId, message, error });
78
+ for (const entry of entries) {
79
+ rejectEntry(entry, error, void 0, `toNestHttp(${bindingId}) pending reject threw`);
80
+ }
81
+ return entries.length;
82
+ };
83
+ const unsubscribe = egress.subscribe((msg) => {
84
+ if (!active) return;
85
+ if (msg[0] === "ERROR" || msg[0] === "COMPLETE" || msg[0] === "TEARDOWN") {
86
+ const error = msg[0] === "ERROR" ? msg[1] : new Error(`toNestHttp(${bindingId}) egress received ${msg[0]}`);
87
+ const message = `toNestHttp(${bindingId}) rejected pending requests after ${msg[0]}`;
88
+ terminal = { error, message };
89
+ const rejectedCount = rejectPending("terminal-egress", error, message);
90
+ if (rejectedCount === 0)
91
+ report({ kind: "terminal-egress", bindingId: scopedBindingId, message, error });
92
+ return;
93
+ }
94
+ if (msg[0] !== "DATA") return;
95
+ const envelope = msg[1];
96
+ const malformed = validateEnvelope(envelope, maxPayloadBytes);
97
+ if (malformed !== void 0) {
98
+ const correlated = malformedCorrelation(msg[1], scopedBindingId);
99
+ if (correlated !== void 0) {
100
+ const pendingKey2 = keyOf(correlated.requestId, scopedBindingId);
101
+ const entry2 = pending.get(pendingKey2);
102
+ if (entry2 !== void 0) {
103
+ pending.delete(pendingKey2);
104
+ rejectEntry(
105
+ entry2,
106
+ new Error(malformed),
107
+ void 0,
108
+ `toNestHttp(${bindingId}) rejected malformed correlated egress`
109
+ );
110
+ }
111
+ }
112
+ report({
113
+ kind: "malformed-egress",
114
+ requestId: correlated?.requestId,
115
+ bindingId: correlated?.bindingId,
116
+ message: malformed
117
+ });
118
+ return;
119
+ }
120
+ if (scopedBindingId !== void 0 && envelope.bindingId !== scopedBindingId) {
121
+ report({
122
+ kind: "binding-mismatch",
123
+ requestId: envelope.requestId,
124
+ bindingId: envelope.bindingId,
125
+ expectedBindingId: scopedBindingId,
126
+ message: `toNestHttp(${bindingId}) ignored egress for binding ${envelope.bindingId}`
127
+ });
128
+ return;
129
+ }
130
+ const pendingKey = keyOf(envelope.requestId, scopedBindingId);
131
+ const entry = pending.get(pendingKey);
132
+ if (entry === void 0) {
133
+ report({
134
+ kind: "stale-egress",
135
+ requestId: envelope.requestId,
136
+ bindingId: envelope.bindingId,
137
+ message: `toNestHttp(${bindingId}) ignored stale requestId ${envelope.requestId}`
138
+ });
139
+ return;
140
+ }
141
+ pending.delete(pendingKey);
142
+ try {
143
+ entry.handle.resolve(
144
+ opts.transform?.(envelope.payload, envelope) ?? envelope.payload,
145
+ envelope
146
+ );
147
+ } catch (error) {
148
+ report({
149
+ kind: "resolve-threw",
150
+ requestId: envelope.requestId,
151
+ bindingId: envelope.bindingId,
152
+ message: `toNestHttp(${bindingId}) response handle threw while resolving`,
153
+ error
154
+ });
155
+ rejectEntry(
156
+ entry,
157
+ error,
158
+ envelope,
159
+ `toNestHttp(${bindingId}) response handle threw while rejecting`
160
+ );
161
+ }
162
+ });
163
+ return {
164
+ kind: "http",
165
+ bindingId,
166
+ attach(registration) {
167
+ if (!active) throw new Error(`toNestHttp(${bindingId}) is disposed`);
168
+ assertNonEmptyString(registration.requestId, "toNestHttp.attach(requestId)");
169
+ const registrationBindingId = registration.bindingId ?? scopedBindingId;
170
+ if (scopedBindingId !== void 0 && registrationBindingId !== scopedBindingId) {
171
+ throw new Error(
172
+ `toNestHttp.attach expected bindingId ${scopedBindingId}, got ${registrationBindingId}`
173
+ );
174
+ }
175
+ if (terminal !== void 0) {
176
+ const entry2 = {
177
+ requestId: registration.requestId,
178
+ bindingId: registrationBindingId,
179
+ handle: registration.handle
180
+ };
181
+ report({
182
+ kind: "terminal-egress",
183
+ requestId: registration.requestId,
184
+ bindingId: registrationBindingId,
185
+ message: terminal.message,
186
+ error: terminal.error
187
+ });
188
+ rejectEntry(
189
+ entry2,
190
+ terminal.error,
191
+ void 0,
192
+ `toNestHttp(${bindingId}) terminal response handle reject threw`
193
+ );
194
+ return () => false;
195
+ }
196
+ const key = keyOf(registration.requestId, scopedBindingId);
197
+ if (pending.has(key)) {
198
+ throw new Error(`toNestHttp.attach duplicate pending requestId ${registration.requestId}`);
199
+ }
200
+ const entry = {
201
+ requestId: registration.requestId,
202
+ bindingId: registrationBindingId,
203
+ handle: registration.handle
204
+ };
205
+ pending.set(key, entry);
206
+ return () => {
207
+ if (pending.get(key) !== entry) return false;
208
+ return pending.delete(key);
209
+ };
210
+ },
211
+ pendingCount: () => pending.size,
212
+ diagnostics: () => diagnostics.slice(),
213
+ dispose() {
214
+ if (!active) return;
215
+ active = false;
216
+ rejectPending(
217
+ "dispose-pending",
218
+ new Error(`toNestHttp(${bindingId}) disposed before response resolution`),
219
+ `toNestHttp(${bindingId}) rejected pending requests during dispose`
220
+ );
221
+ unsubscribe();
222
+ }
223
+ };
224
+ }
225
+ function GraphMessage(boundary, opts = {}) {
226
+ return graphIngressBinding("message", boundary, opts);
227
+ }
228
+ function GraphMessageReply(replyNode, opts) {
229
+ return graphReplyBinding("message-reply", replyNode, opts, "GraphMessageReply");
230
+ }
231
+ function getNestBoundaryBindings(target, methodKey) {
232
+ const ctor = typeof target === "function" ? target : target.constructor;
233
+ const bindings = boundaryBindingsFor(ctor);
234
+ return sortBoundaryBindings(
235
+ methodKey === void 0 ? bindings : bindings.filter((binding) => binding.methodKey === methodKey)
236
+ );
237
+ }
238
+ function bindingRequestId(host, binding, fallback) {
239
+ if (binding.direction === "ingress") {
240
+ const requestId = requestIdFromBinding(host, binding);
241
+ if (requestId !== void 0) return requestId;
242
+ }
243
+ if (typeof fallback === "string") {
244
+ assertNonEmptyString(fallback, "requestId");
245
+ return fallback;
246
+ }
247
+ if (typeof fallback === "function") {
248
+ const requestId = fallback(host);
249
+ if (requestId !== void 0) assertNonEmptyString(requestId, "requestId");
250
+ return requestId;
251
+ }
252
+ return requestIdOf(host, {}, {});
253
+ }
254
+ function bindingEmitOptions(host, binding, requestId) {
255
+ return {
256
+ bindingId: binding.bindingId,
257
+ requestId,
258
+ ...bindingPayloadEmitOption(host, binding),
259
+ requireRequestId: requiresRequestId(binding.kind)
260
+ };
261
+ }
262
+ function sanitizeNestDiagnostic(diagnostic, defaultPhase = "adapter") {
263
+ const payload = {
264
+ kind: diagnostic.kind,
265
+ phase: diagnostic.phase ?? defaultPhase,
266
+ message: diagnostic.message,
267
+ ...optionalStringField("requestId", diagnostic.requestId),
268
+ ...optionalStringField("bindingId", diagnostic.bindingId),
269
+ ...optionalStringField("expectedBindingId", diagnostic.expectedBindingId),
270
+ ...optionalDiagnosticError(diagnostic.error)
271
+ };
272
+ assertGraphVisibleData(payload, "NestDiagnosticPayload", NEST_BOUNDARY_PAYLOAD_MAX_BYTES);
273
+ return payload;
274
+ }
275
+ function nestIngress(graph, kind, opts) {
276
+ const bindingId = stableBindingId(kind, opts);
277
+ const version = parseEnvelopeVersion(opts.version ?? NEST_BOUNDARY_ENVELOPE_VERSION, "version");
278
+ const maxPayloadBytes = payloadByteLimit(opts.maxPayloadBytes);
279
+ const node = graph.node([], null, {
280
+ name: opts.name,
281
+ meta: { adapter: "nestjs", boundary: "ingress", kind, bindingId, version }
282
+ });
283
+ return {
284
+ kind,
285
+ bindingId,
286
+ version,
287
+ node,
288
+ envelope(host, emitOpts = {}) {
289
+ const requestId = requestIdOf(host, opts, {
290
+ ...emitOpts,
291
+ requireRequestId: emitOpts.requireRequestId ?? opts.requireRequestId ?? requiresRequestId(kind)
292
+ });
293
+ const envelopeBindingId = emitOpts.bindingId ?? bindingId;
294
+ assertNonEmptyString(envelopeBindingId, "NestBoundaryEnvelope.bindingId");
295
+ const envelopeVersion = parseEnvelopeVersion(
296
+ emitOpts.version ?? version,
297
+ "NestBoundaryEnvelope.version"
298
+ );
299
+ const payload = "payload" in emitOpts ? emitOpts.payload : opts.payload !== void 0 ? opts.payload(host) : host;
300
+ assertGraphVisibleData(payload, "NestBoundaryEnvelope.payload", maxPayloadBytes);
301
+ const envelope = {
302
+ bindingId: envelopeBindingId,
303
+ version: envelopeVersion,
304
+ payload
305
+ };
306
+ return requestId === void 0 ? envelope : { ...envelope, requestId };
307
+ },
308
+ emit(host, emitOpts = {}) {
309
+ const envelope = this.envelope(host, emitOpts);
310
+ node.down([["DATA", envelope]]);
311
+ return envelope;
312
+ }
313
+ };
314
+ }
315
+ function stableBindingId(kind, opts) {
316
+ const bindingId = opts.bindingId ?? opts.name ?? `nestjs.${kind}`;
317
+ assertNonEmptyString(bindingId, "bindingId");
318
+ return bindingId;
319
+ }
320
+ function requiresRequestId(kind) {
321
+ return kind === "request" || kind === "guard" || kind === "interceptor" || kind === "error";
322
+ }
323
+ function requestIdFromBinding(host, binding) {
324
+ if (typeof binding.requestId === "string") {
325
+ assertNonEmptyString(binding.requestId, "requestId");
326
+ return binding.requestId;
327
+ }
328
+ if (typeof binding.requestId === "function") {
329
+ const requestId = binding.requestId(host);
330
+ if (requestId !== void 0) assertNonEmptyString(requestId, "requestId");
331
+ return requestId;
332
+ }
333
+ return void 0;
334
+ }
335
+ function bindingPayloadEmitOption(host, binding) {
336
+ return binding.payload === void 0 ? {} : { payload: binding.payload(host) };
337
+ }
338
+ function graphIngressBinding(kind, boundary, opts) {
339
+ if (boundary.kind !== kind) {
340
+ throw new Error(`Graph${kind} expected a ${kind} boundary, got ${boundary.kind}`);
341
+ }
342
+ const bindingId = opts.bindingId ?? boundary.bindingId;
343
+ assertNonEmptyString(bindingId, "bindingId");
344
+ return registerMeta(NEST_BOUNDARY_BINDINGS, (methodKey) => ({
345
+ direction: "ingress",
346
+ kind,
347
+ bindingId,
348
+ methodKey,
349
+ boundary,
350
+ payload: opts.payload,
351
+ requestId: opts.requestId,
352
+ order: opts.order,
353
+ mode: opts.mode,
354
+ issueResponse: opts.issueResponse,
355
+ protocolError: opts.protocolError
356
+ }));
357
+ }
358
+ function graphReplyBinding(kind, node, opts, decoratorName) {
359
+ const bindingId = opts?.bindingId;
360
+ if (typeof bindingId !== "string" || bindingId.length === 0) {
361
+ throw new Error(`${decoratorName} requires a non-empty bindingId`);
362
+ }
363
+ const replyNode = node;
364
+ return registerMeta(NEST_BOUNDARY_BINDINGS, (methodKey) => {
365
+ if (kind === "ws-ack") {
366
+ return {
367
+ direction: "egress",
368
+ kind,
369
+ bindingId,
370
+ methodKey,
371
+ ackNode: replyNode,
372
+ order: opts.order
373
+ };
374
+ }
375
+ return {
376
+ direction: "egress",
377
+ kind,
378
+ bindingId,
379
+ methodKey,
380
+ replyNode,
381
+ order: opts.order
382
+ };
383
+ });
384
+ }
385
+ function boundaryBindingsFor(ctor) {
386
+ const bindings = [];
387
+ const seen = /* @__PURE__ */ new Set();
388
+ let current = ctor;
389
+ while (typeof current === "function" && current !== Function.prototype) {
390
+ for (const binding of NEST_BOUNDARY_BINDINGS.get(current) ?? []) {
391
+ if (seen.has(binding)) continue;
392
+ seen.add(binding);
393
+ bindings.push(binding);
394
+ }
395
+ current = Object.getPrototypeOf(current);
396
+ }
397
+ return bindings;
398
+ }
399
+ function sortBoundaryBindings(bindings) {
400
+ return bindings.map((binding, index) => ({ binding, index })).sort((a, b) => (a.binding.order ?? 0) - (b.binding.order ?? 0) || a.index - b.index).map(({ binding }) => binding);
401
+ }
402
+ function requestIdOf(host, opts, emitOpts) {
403
+ const fromEmit = emitOpts.requestId;
404
+ if (fromEmit !== void 0) {
405
+ assertNonEmptyString(fromEmit, "requestId");
406
+ return fromEmit;
407
+ }
408
+ if (typeof opts.requestId === "string") {
409
+ assertNonEmptyString(opts.requestId, "requestId");
410
+ return opts.requestId;
411
+ }
412
+ if (typeof opts.requestId === "function") {
413
+ const requestId = opts.requestId(host);
414
+ if (requestId !== void 0) assertNonEmptyString(requestId, "requestId");
415
+ return requestId;
416
+ }
417
+ const record = host;
418
+ if (typeof record?.requestId === "string" && record.requestId.length > 0) return record.requestId;
419
+ if (typeof record?.id === "string" && record.id.length > 0) return record.id;
420
+ if (emitOpts.requireRequestId ?? opts.requireRequestId ?? false) {
421
+ throw new Error("Nest boundary ingress requires a stable requestId");
422
+ }
423
+ return void 0;
424
+ }
425
+ function validateEnvelope(value, maxPayloadBytes) {
426
+ try {
427
+ assertGraphVisibleData(value, "NestBoundaryEnvelope", maxPayloadBytes);
428
+ } catch (error) {
429
+ return error instanceof Error ? error.message : "egress envelope must be data-only material";
430
+ }
431
+ if (value === null || typeof value !== "object") return "egress DATA is not an envelope object";
432
+ const envelope = value;
433
+ if (typeof envelope.requestId !== "string" || envelope.requestId.length === 0) {
434
+ return "egress envelope requestId must be a non-empty string";
435
+ }
436
+ if (typeof envelope.bindingId !== "string" || envelope.bindingId.length === 0) {
437
+ return "egress envelope bindingId must be a non-empty string";
438
+ }
439
+ try {
440
+ parseEnvelopeVersion(envelope.version, "egress envelope version");
441
+ } catch {
442
+ return `egress envelope version must be ${NEST_BOUNDARY_ENVELOPE_VERSION}`;
443
+ }
444
+ return void 0;
445
+ }
446
+ function malformedCorrelation(value, scopedBindingId) {
447
+ if (value === null || typeof value !== "object") return void 0;
448
+ const requestId = value.requestId;
449
+ const bindingId = value.bindingId;
450
+ if (typeof requestId !== "string" || requestId.length === 0) return void 0;
451
+ if (typeof bindingId !== "string" || bindingId.length === 0) return void 0;
452
+ if (scopedBindingId !== void 0 && bindingId !== scopedBindingId) return void 0;
453
+ return { requestId, bindingId };
454
+ }
455
+ function parseEnvelopeVersion(value, label) {
456
+ if (value !== NEST_BOUNDARY_ENVELOPE_VERSION) {
457
+ throw new Error(`${label} must be ${NEST_BOUNDARY_ENVELOPE_VERSION}`);
458
+ }
459
+ return value;
460
+ }
461
+ function assertNonEmptyString(value, label) {
462
+ if (value.length === 0) throw new Error(`${label} must be a non-empty string`);
463
+ }
464
+ function optionalStringField(key, value) {
465
+ return value === void 0 ? {} : { [key]: value };
466
+ }
467
+ function optionalDiagnosticError(error) {
468
+ const summarized = summarizeDiagnosticError(error);
469
+ return summarized === void 0 ? {} : { error: summarized };
470
+ }
471
+ function summarizeDiagnosticError(error) {
472
+ if (error === void 0) return void 0;
473
+ if (error instanceof Error) {
474
+ return {
475
+ ...optionalDiagnosticName(safeDiagnosticString(() => error.name)),
476
+ message: safeDiagnosticString(() => error.message) ?? "diagnostic error"
477
+ };
478
+ }
479
+ if (typeof error === "string") return { message: error };
480
+ if (typeof error === "number" || typeof error === "boolean" || typeof error === "bigint") {
481
+ return { message: String(error) };
482
+ }
483
+ if (typeof error === "symbol") return { message: error.description ?? "symbol" };
484
+ if (typeof error === "function") return { message: "opaque diagnostic function" };
485
+ if (error !== null && typeof error === "object") {
486
+ const record = error;
487
+ const message = safeDiagnosticString(() => record.message);
488
+ if (message !== void 0) {
489
+ return {
490
+ ...optionalDiagnosticName(safeDiagnosticString(() => record.name)),
491
+ message
492
+ };
493
+ }
494
+ return { message: "opaque diagnostic error" };
495
+ }
496
+ return { message: String(error) };
497
+ }
498
+ function safeDiagnosticString(read) {
499
+ try {
500
+ const value = read();
501
+ return typeof value === "string" ? value : void 0;
502
+ } catch {
503
+ return void 0;
504
+ }
505
+ }
506
+ function optionalDiagnosticName(name) {
507
+ return name === void 0 || name.length === 0 ? {} : { name };
508
+ }
509
+ function payloadByteLimit(value) {
510
+ if (value === void 0) return NEST_BOUNDARY_PAYLOAD_MAX_BYTES;
511
+ if (!Number.isSafeInteger(value) || value < 1) {
512
+ throw new Error("Nest boundary maxPayloadBytes must be a positive safe integer");
513
+ }
514
+ return value;
515
+ }
516
+ function diagnosticsRetainedLimit(value) {
517
+ if (value === void 0) return NEST_HTTP_DIAGNOSTICS_MAX_RETAINED;
518
+ if (!Number.isSafeInteger(value) || value < 0) {
519
+ throw new Error("toNestHttp maxDiagnostics must be a non-negative safe integer");
520
+ }
521
+ return value;
522
+ }
523
+ function pushDiagnostic(diagnostics, diagnostic, maxDiagnostics) {
524
+ if (maxDiagnostics === 0) return;
525
+ diagnostics.push(diagnostic);
526
+ if (diagnostics.length > maxDiagnostics)
527
+ diagnostics.splice(0, diagnostics.length - maxDiagnostics);
528
+ }
529
+ function assertGraphVisibleData(value, path, maxPayloadBytes, seen = /* @__PURE__ */ new WeakSet()) {
530
+ if (value === void 0) {
531
+ throw new TypeError(`${path} cannot be undefined; undefined is SENTINEL/no DATA`);
532
+ }
533
+ if (value === null) return;
534
+ const type = typeof value;
535
+ if (type === "string" || type === "boolean") return;
536
+ if (type === "number") {
537
+ if (!Number.isFinite(value)) throw new TypeError(`${path} number must be finite`);
538
+ return;
539
+ }
540
+ if (type === "function" || type === "symbol" || type === "bigint") {
541
+ throw new TypeError(`${path} must be data-only; found ${type}`);
542
+ }
543
+ if (type !== "object") return;
544
+ if (seen.has(value)) throw new TypeError(`${path} must be acyclic data`);
545
+ seen.add(value);
546
+ if (Array.isArray(value)) {
547
+ try {
548
+ for (let i = 0; i < value.length; i += 1) {
549
+ const descriptor = Object.getOwnPropertyDescriptor(value, i);
550
+ if (descriptor === void 0) {
551
+ throw new TypeError(`${path}[${i}] cannot be a sparse array hole`);
552
+ }
553
+ if (!descriptor.enumerable || !("value" in descriptor)) {
554
+ throw new TypeError(`${path}[${i}] must be enumerable plain data`);
555
+ }
556
+ assertGraphVisibleData(descriptor.value, `${path}[${i}]`, maxPayloadBytes, seen);
557
+ }
558
+ for (const key of Reflect.ownKeys(value)) {
559
+ if (key === "length") continue;
560
+ if (typeof key === "symbol" || !/^(0|[1-9]\d*)$/.test(key)) {
561
+ throw new TypeError(`${path} arrays must not carry hidden or extra properties`);
562
+ }
563
+ }
564
+ assertPayloadSize(value, path, maxPayloadBytes);
565
+ } finally {
566
+ seen.delete(value);
567
+ }
568
+ return;
569
+ }
570
+ const proto = Object.getPrototypeOf(value);
571
+ if (proto !== Object.prototype && proto !== null) {
572
+ throw new TypeError(`${path} must be a plain data object or array`);
573
+ }
574
+ try {
575
+ for (const key of Reflect.ownKeys(value)) {
576
+ if (typeof key === "symbol") throw new TypeError(`${path} must not carry symbol keys`);
577
+ const descriptor = Object.getOwnPropertyDescriptor(value, key);
578
+ if (descriptor === void 0) continue;
579
+ if (!descriptor.enumerable || !("value" in descriptor)) {
580
+ throw new TypeError(`${path}.${key} must be enumerable plain data`);
581
+ }
582
+ assertGraphVisibleData(descriptor.value, `${path}.${key}`, maxPayloadBytes, seen);
583
+ }
584
+ assertPayloadSize(value, path, maxPayloadBytes);
585
+ } finally {
586
+ seen.delete(value);
587
+ }
588
+ }
589
+ function assertPayloadSize(value, path, maxPayloadBytes) {
590
+ const serialized = JSON.stringify(value);
591
+ if (serialized !== void 0 && utf8ByteLength(serialized) > maxPayloadBytes) {
592
+ throw new TypeError(`${path} exceeds ${maxPayloadBytes} bytes`);
593
+ }
594
+ }
595
+ function utf8ByteLength(value) {
596
+ let bytes = 0;
597
+ for (let i = 0; i < value.length; i += 1) {
598
+ const code = value.charCodeAt(i);
599
+ if (code < 128) {
600
+ bytes += 1;
601
+ } else if (code < 2048) {
602
+ bytes += 2;
603
+ } else if (code >= 55296 && code <= 56319 && i + 1 < value.length) {
604
+ const next = value.charCodeAt(i + 1);
605
+ if (next >= 56320 && next <= 57343) {
606
+ bytes += 4;
607
+ i += 1;
608
+ } else {
609
+ bytes += 3;
610
+ }
611
+ } else {
612
+ bytes += 3;
613
+ }
614
+ }
615
+ return bytes;
616
+ }
617
+ function sameMeta(a, b) {
618
+ const left = a;
619
+ const right = b;
620
+ const keys = Reflect.ownKeys(left);
621
+ if (keys.length !== Reflect.ownKeys(right).length) return false;
622
+ for (const key of keys) {
623
+ if (!Object.is(left[key], right[key])) return false;
624
+ }
625
+ return true;
626
+ }
627
+ function pushUniqueMeta(registry, ctor, item) {
628
+ const existing = registry.get(ctor) ?? [];
629
+ if (existing.some((current) => sameMeta(current, item))) return;
630
+ registry.set(ctor, [...existing, item]);
631
+ }
632
+ function registerMeta(registry, meta) {
633
+ return ((targetOrValue, contextOrKey) => {
634
+ if (typeof contextOrKey === "object" && contextOrKey !== null) {
635
+ const methodKey = contextOrKey.name;
636
+ contextOrKey.addInitializer(function() {
637
+ const ctor2 = this.constructor;
638
+ pushUniqueMeta(registry, ctor2, meta(methodKey));
639
+ });
640
+ return;
641
+ }
642
+ const ctor = targetOrValue.constructor;
643
+ pushUniqueMeta(registry, ctor, meta(contextOrKey));
644
+ });
645
+ }
646
+
647
+ // src/adapters/nestjs/microservices.ts
648
+ var GRAPHREFLY_NEST_MESSAGE_BRIDGE = /* @__PURE__ */ Symbol.for("graphrefly:nest:message-bridge");
649
+ function provideGraphMessageBridge(opts = {}) {
650
+ return { provide: GRAPHREFLY_NEST_MESSAGE_BRIDGE, useValue: createGraphMessageBridge(opts) };
651
+ }
652
+ function provideGraphMessageProviders(opts = {}) {
653
+ return opts.bridge === false ? [] : [provideGraphMessageBridge(opts.bridge ?? {})];
654
+ }
655
+ function createGraphMessageBridge(opts = {}) {
656
+ return new GraphMessageBridgeImpl(opts);
657
+ }
658
+ var GraphMessageBridgeImpl = class {
659
+ constructor(opts) {
660
+ this.opts = opts;
661
+ }
662
+ boundaries = /* @__PURE__ */ new WeakMap();
663
+ disposable = /* @__PURE__ */ new Set();
664
+ localDiagnostics = [];
665
+ active = true;
666
+ close() {
667
+ this.dispose();
668
+ }
669
+ onModuleDestroy() {
670
+ this.dispose();
671
+ }
672
+ handleMessage(target, methodKey, host, runOpts = {}) {
673
+ if (!this.active) throw new Error("GraphMessage native bridge is disposed");
674
+ const bindings = getNestBoundaryBindings(target, methodKey);
675
+ const ingress = bindings.filter(isMessageIngress);
676
+ if (ingress.length === 0) return void 0;
677
+ const replies = bindings.filter(isMessageReply);
678
+ const needsRequestId = replies.length > 0;
679
+ for (const binding of ingress) assertExplicitNativePayload(binding, "GraphMessage");
680
+ const ingressEmits = ingress.map((binding) => ({
681
+ binding,
682
+ requestId: bindingRequestId(host, binding, runOpts.requestId ?? this.opts.requestId)
683
+ }));
684
+ if (needsRequestId && ingressEmits.some((entry) => entry.requestId === void 0)) {
685
+ throw new Error("GraphMessage native bridge requires a stable requestId for reply egress");
686
+ }
687
+ const requestIds = uniqueDefinedStrings(ingressEmits.map((entry) => entry.requestId));
688
+ const cleanups = [];
689
+ let timeout;
690
+ let settled = false;
691
+ let resolvePromise;
692
+ let rejectPromise;
693
+ let cleaned = false;
694
+ const cleanupAll = () => {
695
+ if (cleaned) return;
696
+ cleaned = true;
697
+ for (const cleanup of cleanups) cleanup();
698
+ this.clearTimeout(timeout);
699
+ };
700
+ const handle = {
701
+ resolve(payload) {
702
+ if (settled) return;
703
+ settled = true;
704
+ resolvePromise?.(payload);
705
+ },
706
+ reject(error) {
707
+ if (settled) return;
708
+ settled = true;
709
+ rejectPromise?.(error);
710
+ }
711
+ };
712
+ const promise = replies.length === 0 ? void 0 : new Promise((resolve, reject) => {
713
+ resolvePromise = resolve;
714
+ rejectPromise = reject;
715
+ });
716
+ if (promise !== void 0) {
717
+ try {
718
+ for (const requestId of requestIds) {
719
+ for (const reply of replies) {
720
+ cleanups.push(
721
+ this.boundaryFor(reply).attach({
722
+ requestId,
723
+ bindingId: reply.bindingId,
724
+ handle
725
+ })
726
+ );
727
+ }
728
+ }
729
+ } catch (error) {
730
+ cleanupAll();
731
+ handle.reject(error);
732
+ return promise;
733
+ }
734
+ if (settled) {
735
+ cleanupAll();
736
+ return promise;
737
+ }
738
+ if (this.opts.timeoutMs !== void 0) {
739
+ timeout = setTimeout(() => {
740
+ cleanupAll();
741
+ const error = new Error(
742
+ `GraphMessage native bridge timed out waiting for ${requestIds[0]}`
743
+ );
744
+ this.diagnose({
745
+ kind: "timeout",
746
+ requestId: requestIds[0],
747
+ message: error.message,
748
+ error
749
+ });
750
+ handle.reject(error);
751
+ }, this.opts.timeoutMs);
752
+ }
753
+ }
754
+ try {
755
+ for (const { binding, requestId } of ingressEmits) {
756
+ binding.boundary.emit(host, {
757
+ ...bindingEmitOptions(host, binding, requestId),
758
+ requireRequestId: needsRequestId
759
+ });
760
+ }
761
+ } catch (error) {
762
+ cleanupAll();
763
+ throw error;
764
+ }
765
+ return promise?.finally(() => {
766
+ cleanupAll();
767
+ });
768
+ }
769
+ diagnostics() {
770
+ return [
771
+ ...this.localDiagnostics,
772
+ ...[...this.disposable].flatMap((boundary) => boundary.diagnostics())
773
+ ];
774
+ }
775
+ dispose() {
776
+ if (!this.active) return;
777
+ this.active = false;
778
+ for (const boundary of this.disposable) boundary.dispose();
779
+ }
780
+ boundaryFor(binding) {
781
+ let byBinding = this.boundaries.get(binding.replyNode);
782
+ if (byBinding === void 0) {
783
+ byBinding = /* @__PURE__ */ new Map();
784
+ this.boundaries.set(binding.replyNode, byBinding);
785
+ }
786
+ const existing = byBinding.get(binding.bindingId);
787
+ if (existing !== void 0) return existing;
788
+ const boundary = toNestHttp(binding.replyNode, {
789
+ bindingId: binding.bindingId,
790
+ diagnosticBoundary: this.opts.diagnosticBoundary,
791
+ diagnosticPhase: "message",
792
+ name: "nestjs.message-reply",
793
+ maxDiagnostics: this.opts.maxDiagnostics
794
+ });
795
+ byBinding.set(binding.bindingId, boundary);
796
+ this.disposable.add(boundary);
797
+ return boundary;
798
+ }
799
+ diagnose(diagnostic) {
800
+ this.localDiagnostics.push(diagnostic);
801
+ try {
802
+ const phase = diagnostic.phase ?? "message";
803
+ const payload = sanitizeNestDiagnostic({ ...diagnostic, phase }, phase);
804
+ this.opts.diagnosticBoundary?.emit(payload, { payload });
805
+ } catch {
806
+ }
807
+ if (this.opts.maxDiagnostics !== void 0 && this.localDiagnostics.length > this.opts.maxDiagnostics) {
808
+ this.localDiagnostics.splice(0, this.localDiagnostics.length - this.opts.maxDiagnostics);
809
+ }
810
+ }
811
+ clearTimeout(timeout) {
812
+ if (timeout !== void 0) clearTimeout(timeout);
813
+ }
814
+ };
815
+ function isMessageIngress(binding) {
816
+ return binding.direction === "ingress" && binding.kind === "message";
817
+ }
818
+ function isMessageReply(binding) {
819
+ return binding.direction === "egress" && binding.kind === "message-reply";
820
+ }
821
+ function assertExplicitNativePayload(binding, label) {
822
+ if (binding.payload === void 0) {
823
+ throw new Error(`${label} native bridge requires an explicit payload selector`);
824
+ }
825
+ }
826
+ function uniqueDefinedStrings(values) {
827
+ const seen = /* @__PURE__ */ new Set();
828
+ for (const value of values) if (value !== void 0) seen.add(value);
829
+ return [...seen];
830
+ }
831
+ // Annotate the CommonJS export names for ESM import in node:
832
+ 0 && (module.exports = {
833
+ GRAPHREFLY_NEST_MESSAGE_BRIDGE,
834
+ GraphMessage,
835
+ GraphMessageReply,
836
+ createGraphMessageBridge,
837
+ fromNestMessage,
838
+ provideGraphMessageBridge,
839
+ provideGraphMessageProviders
840
+ });
841
+ //# sourceMappingURL=microservices.cjs.map