@graphrefly/ts 0.0.1 → 0.0.2

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