@xyo-network/sdk 7.4.1 → 7.4.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 (298) hide show
  1. package/dist/neutral/api-location-diviner.mjs.map +2 -2
  2. package/dist/neutral/archivist-abstract.mjs +4 -3
  3. package/dist/neutral/archivist-abstract.mjs.map +2 -2
  4. package/dist/neutral/archivist-generic.mjs +1 -1
  5. package/dist/neutral/archivist-generic.mjs.map +2 -2
  6. package/dist/neutral/archivist-memory.mjs +1 -1
  7. package/dist/neutral/archivist-memory.mjs.map +2 -2
  8. package/dist/neutral/archivist-model.mjs +4 -2
  9. package/dist/neutral/archivist-model.mjs.map +2 -2
  10. package/dist/neutral/archivist-wrapper.mjs +22 -4
  11. package/dist/neutral/archivist-wrapper.mjs.map +2 -2
  12. package/dist/neutral/boundwitness-loader.mjs +2 -1
  13. package/dist/neutral/boundwitness-loader.mjs.map +2 -2
  14. package/dist/neutral/bridge-abstract.mjs +4 -3
  15. package/dist/neutral/bridge-abstract.mjs.map +2 -2
  16. package/dist/neutral/bridge-http.mjs +4 -5
  17. package/dist/neutral/bridge-http.mjs.map +2 -2
  18. package/dist/neutral/bridge-model.mjs +4 -2
  19. package/dist/neutral/bridge-model.mjs.map +2 -2
  20. package/dist/neutral/bridge-wrapper.mjs +18 -3
  21. package/dist/neutral/bridge-wrapper.mjs.map +2 -2
  22. package/dist/neutral/bridge.mjs.map +2 -2
  23. package/dist/neutral/diviner-abstract.mjs +2 -1
  24. package/dist/neutral/diviner-abstract.mjs.map +2 -2
  25. package/dist/neutral/diviner-model.mjs +4 -2
  26. package/dist/neutral/diviner-model.mjs.map +2 -2
  27. package/dist/neutral/diviner-payload-generic.mjs +1 -2
  28. package/dist/neutral/diviner-payload-generic.mjs.map +2 -2
  29. package/dist/neutral/diviner-wrapper.mjs +22 -4
  30. package/dist/neutral/diviner-wrapper.mjs.map +2 -2
  31. package/dist/neutral/module-abstract.mjs +57 -60
  32. package/dist/neutral/module-abstract.mjs.map +2 -2
  33. package/dist/neutral/module-factory-locator.mjs +4 -2
  34. package/dist/neutral/module-factory-locator.mjs.map +2 -2
  35. package/dist/neutral/module-resolver.mjs +30 -31
  36. package/dist/neutral/module-resolver.mjs.map +2 -2
  37. package/dist/neutral/module-wrapper.mjs +7 -4
  38. package/dist/neutral/module-wrapper.mjs.map +2 -2
  39. package/dist/neutral/modules/api-location-diviner/LocationDiviner/LocationDivinerApi.d.ts +5 -3
  40. package/dist/neutral/modules/api-location-diviner/LocationDiviner/LocationDivinerApi.d.ts.map +1 -1
  41. package/dist/neutral/modules/api-location-diviner/LocationDiviner/Queries/LocationQueryCreationRequest.d.ts +7 -3
  42. package/dist/neutral/modules/api-location-diviner/LocationDiviner/Queries/LocationQueryCreationRequest.d.ts.map +1 -1
  43. package/dist/neutral/modules/api-location-diviner/RemoteDivinerConfig.d.ts +1 -2
  44. package/dist/neutral/modules/api-location-diviner/RemoteDivinerConfig.d.ts.map +1 -1
  45. package/dist/neutral/modules/archivist-abstract/payloadAdmission.d.ts.map +1 -1
  46. package/dist/neutral/modules/archivist-model/typeChecks.d.ts.map +1 -1
  47. package/dist/neutral/modules/archivist-wrapper/ArchivistWrapper.d.ts.map +1 -1
  48. package/dist/neutral/modules/boundwitness-loader/Loader.d.ts.map +1 -1
  49. package/dist/neutral/modules/bridge/index.d.ts +3 -0
  50. package/dist/neutral/modules/bridge/index.d.ts.map +1 -1
  51. package/dist/neutral/modules/bridge/model.d.ts +1 -0
  52. package/dist/neutral/modules/bridge/model.d.ts.map +1 -1
  53. package/dist/neutral/modules/bridge/wrapper.d.ts +1 -0
  54. package/dist/neutral/modules/bridge/wrapper.d.ts.map +1 -1
  55. package/dist/neutral/modules/bridge-abstract/AbstractBridge.d.ts +1 -0
  56. package/dist/neutral/modules/bridge-abstract/AbstractBridge.d.ts.map +1 -1
  57. package/dist/neutral/modules/bridge-abstract/AbstractBridgeModuleResolver.d.ts +2 -0
  58. package/dist/neutral/modules/bridge-abstract/AbstractBridgeModuleResolver.d.ts.map +1 -1
  59. package/dist/neutral/modules/bridge-abstract/AbstractModuleProxy/AbstractModuleProxy.d.ts +2 -0
  60. package/dist/neutral/modules/bridge-abstract/AbstractModuleProxy/AbstractModuleProxy.d.ts.map +1 -1
  61. package/dist/neutral/modules/bridge-abstract/AbstractModuleProxy/ModuleProxyResolver.d.ts +2 -0
  62. package/dist/neutral/modules/bridge-abstract/AbstractModuleProxy/ModuleProxyResolver.d.ts.map +1 -1
  63. package/dist/neutral/modules/bridge-abstract/index.d.ts +4 -0
  64. package/dist/neutral/modules/bridge-abstract/index.d.ts.map +1 -1
  65. package/dist/neutral/modules/bridge-abstract/wrapModuleWithType.d.ts +1 -0
  66. package/dist/neutral/modules/bridge-abstract/wrapModuleWithType.d.ts.map +1 -1
  67. package/dist/neutral/modules/bridge-http/HttpBridge.d.ts +2 -0
  68. package/dist/neutral/modules/bridge-http/HttpBridge.d.ts.map +1 -1
  69. package/dist/neutral/modules/bridge-http/HttpBridgeConfig.d.ts +8 -0
  70. package/dist/neutral/modules/bridge-http/HttpBridgeConfig.d.ts.map +1 -1
  71. package/dist/neutral/modules/bridge-http/HttpBridgeModuleResolver.d.ts +4 -2
  72. package/dist/neutral/modules/bridge-http/HttpBridgeModuleResolver.d.ts.map +1 -1
  73. package/dist/neutral/modules/bridge-http/ModuleProxy/ModuleProxy.d.ts +3 -0
  74. package/dist/neutral/modules/bridge-http/ModuleProxy/ModuleProxy.d.ts.map +1 -1
  75. package/dist/neutral/modules/bridge-http/ModuleProxy/index.d.ts +1 -0
  76. package/dist/neutral/modules/bridge-http/ModuleProxy/index.d.ts.map +1 -1
  77. package/dist/neutral/modules/bridge-http/index.d.ts +2 -0
  78. package/dist/neutral/modules/bridge-http/index.d.ts.map +1 -1
  79. package/dist/neutral/modules/bridge-model/Config.d.ts +10 -0
  80. package/dist/neutral/modules/bridge-model/Config.d.ts.map +1 -1
  81. package/dist/neutral/modules/bridge-model/EventData.d.ts +1 -0
  82. package/dist/neutral/modules/bridge-model/EventData.d.ts.map +1 -1
  83. package/dist/neutral/modules/bridge-model/Events/Exposed.d.ts +2 -0
  84. package/dist/neutral/modules/bridge-model/Events/Exposed.d.ts.map +1 -1
  85. package/dist/neutral/modules/bridge-model/Events/QueryFulfillFinished.d.ts +2 -0
  86. package/dist/neutral/modules/bridge-model/Events/QueryFulfillFinished.d.ts.map +1 -1
  87. package/dist/neutral/modules/bridge-model/Events/QueryFulfillStarted.d.ts +2 -0
  88. package/dist/neutral/modules/bridge-model/Events/QueryFulfillStarted.d.ts.map +1 -1
  89. package/dist/neutral/modules/bridge-model/Events/QuerySendFinished.d.ts +2 -0
  90. package/dist/neutral/modules/bridge-model/Events/QuerySendFinished.d.ts.map +1 -1
  91. package/dist/neutral/modules/bridge-model/Events/QuerySendStarted.d.ts +2 -0
  92. package/dist/neutral/modules/bridge-model/Events/QuerySendStarted.d.ts.map +1 -1
  93. package/dist/neutral/modules/bridge-model/Events/Unexposed.d.ts +2 -0
  94. package/dist/neutral/modules/bridge-model/Events/Unexposed.d.ts.map +1 -1
  95. package/dist/neutral/modules/bridge-model/Instance.d.ts +1 -0
  96. package/dist/neutral/modules/bridge-model/Instance.d.ts.map +1 -1
  97. package/dist/neutral/modules/bridge-model/Module.d.ts +1 -0
  98. package/dist/neutral/modules/bridge-model/Module.d.ts.map +1 -1
  99. package/dist/neutral/modules/bridge-model/Params.d.ts +1 -0
  100. package/dist/neutral/modules/bridge-model/Params.d.ts.map +1 -1
  101. package/dist/neutral/modules/bridge-model/Queries/Connect.d.ts +7 -0
  102. package/dist/neutral/modules/bridge-model/Queries/Connect.d.ts.map +1 -1
  103. package/dist/neutral/modules/bridge-model/Queries/Disconnect.d.ts +7 -0
  104. package/dist/neutral/modules/bridge-model/Queries/Disconnect.d.ts.map +1 -1
  105. package/dist/neutral/modules/bridge-model/Queries/Expose.d.ts +15 -0
  106. package/dist/neutral/modules/bridge-model/Queries/Expose.d.ts.map +1 -1
  107. package/dist/neutral/modules/bridge-model/Queries/Unexpose.d.ts +8 -0
  108. package/dist/neutral/modules/bridge-model/Queries/Unexpose.d.ts.map +1 -1
  109. package/dist/neutral/modules/bridge-model/Queries/index.d.ts +2 -0
  110. package/dist/neutral/modules/bridge-model/Queries/index.d.ts.map +1 -1
  111. package/dist/neutral/modules/bridge-model/QueryFunctions.d.ts +1 -0
  112. package/dist/neutral/modules/bridge-model/QueryFunctions.d.ts.map +1 -1
  113. package/dist/neutral/modules/bridge-model/RawQueryFunctions.d.ts +1 -0
  114. package/dist/neutral/modules/bridge-model/RawQueryFunctions.d.ts.map +1 -1
  115. package/dist/neutral/modules/bridge-model/attachable/AttachableInstance.d.ts +3 -0
  116. package/dist/neutral/modules/bridge-model/attachable/AttachableInstance.d.ts.map +1 -1
  117. package/dist/neutral/modules/bridge-model/attachable/asAttachableInstance.d.ts +1 -0
  118. package/dist/neutral/modules/bridge-model/attachable/asAttachableInstance.d.ts.map +1 -1
  119. package/dist/neutral/modules/bridge-model/attachable/isAttachableInstance.d.ts +2 -0
  120. package/dist/neutral/modules/bridge-model/attachable/isAttachableInstance.d.ts.map +1 -1
  121. package/dist/neutral/modules/bridge-model/index.d.ts +1 -0
  122. package/dist/neutral/modules/bridge-model/index.d.ts.map +1 -1
  123. package/dist/neutral/modules/bridge-model/typeChecks.d.ts +12 -2
  124. package/dist/neutral/modules/bridge-model/typeChecks.d.ts.map +1 -1
  125. package/dist/neutral/modules/bridge-wrapper/BridgeWrapper.d.ts +1 -0
  126. package/dist/neutral/modules/bridge-wrapper/BridgeWrapper.d.ts.map +1 -1
  127. package/dist/neutral/modules/bridge-wrapper/index.d.ts +1 -0
  128. package/dist/neutral/modules/bridge-wrapper/index.d.ts.map +1 -1
  129. package/dist/neutral/modules/diviner-abstract/AbstractDiviner.d.ts.map +1 -1
  130. package/dist/neutral/modules/diviner-model/typeChecks.d.ts.map +1 -1
  131. package/dist/neutral/modules/diviner-payload-generic/Diviner.d.ts.map +1 -1
  132. package/dist/neutral/modules/diviner-wrapper/DivinerWrapper.d.ts.map +1 -1
  133. package/dist/neutral/modules/module-abstract/AbstractModule.d.ts +1 -3
  134. package/dist/neutral/modules/module-abstract/AbstractModule.d.ts.map +1 -1
  135. package/dist/neutral/modules/module-abstract/AbstractModuleInstance.d.ts.map +1 -1
  136. package/dist/neutral/modules/module-abstract/Error.d.ts +1 -4
  137. package/dist/neutral/modules/module-abstract/Error.d.ts.map +1 -1
  138. package/dist/neutral/modules/module-factory-locator/ModuleFactoryLocator.d.ts.map +1 -1
  139. package/dist/neutral/modules/module-factory-locator/standardCreatableFactories.d.ts.map +1 -1
  140. package/dist/neutral/modules/module-resolver/ResolveHelper/ResolveHelper.d.ts.map +1 -1
  141. package/dist/neutral/modules/module-resolver/SimpleModuleResolver.d.ts.map +1 -1
  142. package/dist/neutral/modules/module-wrapper/ModuleWrapper.d.ts +7 -1
  143. package/dist/neutral/modules/module-wrapper/ModuleWrapper.d.ts.map +1 -1
  144. package/dist/neutral/modules/modules/index.d.ts +1 -0
  145. package/dist/neutral/modules/modules/index.d.ts.map +1 -1
  146. package/dist/neutral/modules/node-abstract/AbstractNode.d.ts.map +1 -1
  147. package/dist/neutral/modules/node-memory/NodeHelper/attachToExistingNode.d.ts.map +1 -1
  148. package/dist/neutral/modules/node-model/typeChecks.d.ts.map +1 -1
  149. package/dist/neutral/modules/node-view/ViewNode.d.ts.map +1 -1
  150. package/dist/neutral/modules/node-wrapper/NodeWrapper.d.ts.map +1 -1
  151. package/dist/neutral/modules/sentinel-memory/MemorySentinel.d.ts.map +1 -1
  152. package/dist/neutral/modules/sentinel-memory/SentinelRunner.d.ts.map +1 -1
  153. package/dist/neutral/modules/sentinel-model/typeChecks.d.ts.map +1 -1
  154. package/dist/neutral/modules/sentinel-wrapper/Wrapper.d.ts.map +1 -1
  155. package/dist/neutral/modules/witness-model/typeChecks.d.ts.map +1 -1
  156. package/dist/neutral/modules/witness-wrapper/WitnessWrapper.d.ts.map +1 -1
  157. package/dist/neutral/modules.mjs.map +2 -2
  158. package/dist/neutral/node-abstract.mjs +14 -6
  159. package/dist/neutral/node-abstract.mjs.map +2 -2
  160. package/dist/neutral/node-memory.mjs +8 -9
  161. package/dist/neutral/node-memory.mjs.map +2 -2
  162. package/dist/neutral/node-model.mjs +2 -1
  163. package/dist/neutral/node-model.mjs.map +2 -2
  164. package/dist/neutral/node-view.mjs +11 -10
  165. package/dist/neutral/node-view.mjs.map +2 -2
  166. package/dist/neutral/node-wrapper.mjs +19 -4
  167. package/dist/neutral/node-wrapper.mjs.map +2 -2
  168. package/dist/neutral/sentinel-abstract.mjs +4 -4
  169. package/dist/neutral/sentinel-abstract.mjs.map +2 -2
  170. package/dist/neutral/sentinel-memory.mjs +17 -16
  171. package/dist/neutral/sentinel-memory.mjs.map +2 -2
  172. package/dist/neutral/sentinel-model.mjs +4 -2
  173. package/dist/neutral/sentinel-model.mjs.map +2 -2
  174. package/dist/neutral/sentinel-wrapper.mjs +22 -4
  175. package/dist/neutral/sentinel-wrapper.mjs.map +2 -2
  176. package/dist/neutral/witness-model.mjs +4 -2
  177. package/dist/neutral/witness-model.mjs.map +2 -2
  178. package/dist/neutral/witness-wrapper.mjs +22 -4
  179. package/dist/neutral/witness-wrapper.mjs.map +2 -2
  180. package/dist/node/modules/api-location-diviner/LocationDiviner/LocationDivinerApi.d.ts +5 -3
  181. package/dist/node/modules/api-location-diviner/LocationDiviner/LocationDivinerApi.d.ts.map +1 -1
  182. package/dist/node/modules/api-location-diviner/LocationDiviner/Queries/LocationQueryCreationRequest.d.ts +7 -3
  183. package/dist/node/modules/api-location-diviner/LocationDiviner/Queries/LocationQueryCreationRequest.d.ts.map +1 -1
  184. package/dist/node/modules/api-location-diviner/RemoteDivinerConfig.d.ts +1 -2
  185. package/dist/node/modules/api-location-diviner/RemoteDivinerConfig.d.ts.map +1 -1
  186. package/dist/node/modules/archivist-abstract/payloadAdmission.d.ts.map +1 -1
  187. package/dist/node/modules/archivist-model/typeChecks.d.ts.map +1 -1
  188. package/dist/node/modules/archivist-wrapper/ArchivistWrapper.d.ts.map +1 -1
  189. package/dist/node/modules/boundwitness-loader/Loader.d.ts.map +1 -1
  190. package/dist/node/modules/bridge/index.d.ts +3 -0
  191. package/dist/node/modules/bridge/index.d.ts.map +1 -1
  192. package/dist/node/modules/bridge/model.d.ts +1 -0
  193. package/dist/node/modules/bridge/model.d.ts.map +1 -1
  194. package/dist/node/modules/bridge/wrapper.d.ts +1 -0
  195. package/dist/node/modules/bridge/wrapper.d.ts.map +1 -1
  196. package/dist/node/modules/bridge-abstract/AbstractBridge.d.ts +1 -0
  197. package/dist/node/modules/bridge-abstract/AbstractBridge.d.ts.map +1 -1
  198. package/dist/node/modules/bridge-abstract/AbstractBridgeModuleResolver.d.ts +2 -0
  199. package/dist/node/modules/bridge-abstract/AbstractBridgeModuleResolver.d.ts.map +1 -1
  200. package/dist/node/modules/bridge-abstract/AbstractModuleProxy/AbstractModuleProxy.d.ts +2 -0
  201. package/dist/node/modules/bridge-abstract/AbstractModuleProxy/AbstractModuleProxy.d.ts.map +1 -1
  202. package/dist/node/modules/bridge-abstract/AbstractModuleProxy/ModuleProxyResolver.d.ts +2 -0
  203. package/dist/node/modules/bridge-abstract/AbstractModuleProxy/ModuleProxyResolver.d.ts.map +1 -1
  204. package/dist/node/modules/bridge-abstract/index.d.ts +4 -0
  205. package/dist/node/modules/bridge-abstract/index.d.ts.map +1 -1
  206. package/dist/node/modules/bridge-abstract/wrapModuleWithType.d.ts +1 -0
  207. package/dist/node/modules/bridge-abstract/wrapModuleWithType.d.ts.map +1 -1
  208. package/dist/node/modules/bridge-http/HttpBridge.d.ts +2 -0
  209. package/dist/node/modules/bridge-http/HttpBridge.d.ts.map +1 -1
  210. package/dist/node/modules/bridge-http/HttpBridgeConfig.d.ts +8 -0
  211. package/dist/node/modules/bridge-http/HttpBridgeConfig.d.ts.map +1 -1
  212. package/dist/node/modules/bridge-http/HttpBridgeModuleResolver.d.ts +4 -2
  213. package/dist/node/modules/bridge-http/HttpBridgeModuleResolver.d.ts.map +1 -1
  214. package/dist/node/modules/bridge-http/ModuleProxy/ModuleProxy.d.ts +3 -0
  215. package/dist/node/modules/bridge-http/ModuleProxy/ModuleProxy.d.ts.map +1 -1
  216. package/dist/node/modules/bridge-http/ModuleProxy/index.d.ts +1 -0
  217. package/dist/node/modules/bridge-http/ModuleProxy/index.d.ts.map +1 -1
  218. package/dist/node/modules/bridge-http/index.d.ts +2 -0
  219. package/dist/node/modules/bridge-http/index.d.ts.map +1 -1
  220. package/dist/node/modules/bridge-model/Config.d.ts +10 -0
  221. package/dist/node/modules/bridge-model/Config.d.ts.map +1 -1
  222. package/dist/node/modules/bridge-model/EventData.d.ts +1 -0
  223. package/dist/node/modules/bridge-model/EventData.d.ts.map +1 -1
  224. package/dist/node/modules/bridge-model/Events/Exposed.d.ts +2 -0
  225. package/dist/node/modules/bridge-model/Events/Exposed.d.ts.map +1 -1
  226. package/dist/node/modules/bridge-model/Events/QueryFulfillFinished.d.ts +2 -0
  227. package/dist/node/modules/bridge-model/Events/QueryFulfillFinished.d.ts.map +1 -1
  228. package/dist/node/modules/bridge-model/Events/QueryFulfillStarted.d.ts +2 -0
  229. package/dist/node/modules/bridge-model/Events/QueryFulfillStarted.d.ts.map +1 -1
  230. package/dist/node/modules/bridge-model/Events/QuerySendFinished.d.ts +2 -0
  231. package/dist/node/modules/bridge-model/Events/QuerySendFinished.d.ts.map +1 -1
  232. package/dist/node/modules/bridge-model/Events/QuerySendStarted.d.ts +2 -0
  233. package/dist/node/modules/bridge-model/Events/QuerySendStarted.d.ts.map +1 -1
  234. package/dist/node/modules/bridge-model/Events/Unexposed.d.ts +2 -0
  235. package/dist/node/modules/bridge-model/Events/Unexposed.d.ts.map +1 -1
  236. package/dist/node/modules/bridge-model/Instance.d.ts +1 -0
  237. package/dist/node/modules/bridge-model/Instance.d.ts.map +1 -1
  238. package/dist/node/modules/bridge-model/Module.d.ts +1 -0
  239. package/dist/node/modules/bridge-model/Module.d.ts.map +1 -1
  240. package/dist/node/modules/bridge-model/Params.d.ts +1 -0
  241. package/dist/node/modules/bridge-model/Params.d.ts.map +1 -1
  242. package/dist/node/modules/bridge-model/Queries/Connect.d.ts +7 -0
  243. package/dist/node/modules/bridge-model/Queries/Connect.d.ts.map +1 -1
  244. package/dist/node/modules/bridge-model/Queries/Disconnect.d.ts +7 -0
  245. package/dist/node/modules/bridge-model/Queries/Disconnect.d.ts.map +1 -1
  246. package/dist/node/modules/bridge-model/Queries/Expose.d.ts +15 -0
  247. package/dist/node/modules/bridge-model/Queries/Expose.d.ts.map +1 -1
  248. package/dist/node/modules/bridge-model/Queries/Unexpose.d.ts +8 -0
  249. package/dist/node/modules/bridge-model/Queries/Unexpose.d.ts.map +1 -1
  250. package/dist/node/modules/bridge-model/Queries/index.d.ts +2 -0
  251. package/dist/node/modules/bridge-model/Queries/index.d.ts.map +1 -1
  252. package/dist/node/modules/bridge-model/QueryFunctions.d.ts +1 -0
  253. package/dist/node/modules/bridge-model/QueryFunctions.d.ts.map +1 -1
  254. package/dist/node/modules/bridge-model/RawQueryFunctions.d.ts +1 -0
  255. package/dist/node/modules/bridge-model/RawQueryFunctions.d.ts.map +1 -1
  256. package/dist/node/modules/bridge-model/attachable/AttachableInstance.d.ts +3 -0
  257. package/dist/node/modules/bridge-model/attachable/AttachableInstance.d.ts.map +1 -1
  258. package/dist/node/modules/bridge-model/attachable/asAttachableInstance.d.ts +1 -0
  259. package/dist/node/modules/bridge-model/attachable/asAttachableInstance.d.ts.map +1 -1
  260. package/dist/node/modules/bridge-model/attachable/isAttachableInstance.d.ts +2 -0
  261. package/dist/node/modules/bridge-model/attachable/isAttachableInstance.d.ts.map +1 -1
  262. package/dist/node/modules/bridge-model/index.d.ts +1 -0
  263. package/dist/node/modules/bridge-model/index.d.ts.map +1 -1
  264. package/dist/node/modules/bridge-model/typeChecks.d.ts +12 -2
  265. package/dist/node/modules/bridge-model/typeChecks.d.ts.map +1 -1
  266. package/dist/node/modules/bridge-wrapper/BridgeWrapper.d.ts +1 -0
  267. package/dist/node/modules/bridge-wrapper/BridgeWrapper.d.ts.map +1 -1
  268. package/dist/node/modules/bridge-wrapper/index.d.ts +1 -0
  269. package/dist/node/modules/bridge-wrapper/index.d.ts.map +1 -1
  270. package/dist/node/modules/diviner-abstract/AbstractDiviner.d.ts.map +1 -1
  271. package/dist/node/modules/diviner-model/typeChecks.d.ts.map +1 -1
  272. package/dist/node/modules/diviner-payload-generic/Diviner.d.ts.map +1 -1
  273. package/dist/node/modules/diviner-wrapper/DivinerWrapper.d.ts.map +1 -1
  274. package/dist/node/modules/module-abstract/AbstractModule.d.ts +1 -3
  275. package/dist/node/modules/module-abstract/AbstractModule.d.ts.map +1 -1
  276. package/dist/node/modules/module-abstract/AbstractModuleInstance.d.ts.map +1 -1
  277. package/dist/node/modules/module-abstract/Error.d.ts +1 -4
  278. package/dist/node/modules/module-abstract/Error.d.ts.map +1 -1
  279. package/dist/node/modules/module-factory-locator/ModuleFactoryLocator.d.ts.map +1 -1
  280. package/dist/node/modules/module-factory-locator/standardCreatableFactories.d.ts.map +1 -1
  281. package/dist/node/modules/module-resolver/ResolveHelper/ResolveHelper.d.ts.map +1 -1
  282. package/dist/node/modules/module-resolver/SimpleModuleResolver.d.ts.map +1 -1
  283. package/dist/node/modules/module-wrapper/ModuleWrapper.d.ts +7 -1
  284. package/dist/node/modules/module-wrapper/ModuleWrapper.d.ts.map +1 -1
  285. package/dist/node/modules/modules/index.d.ts +1 -0
  286. package/dist/node/modules/modules/index.d.ts.map +1 -1
  287. package/dist/node/modules/node-abstract/AbstractNode.d.ts.map +1 -1
  288. package/dist/node/modules/node-memory/NodeHelper/attachToExistingNode.d.ts.map +1 -1
  289. package/dist/node/modules/node-model/typeChecks.d.ts.map +1 -1
  290. package/dist/node/modules/node-view/ViewNode.d.ts.map +1 -1
  291. package/dist/node/modules/node-wrapper/NodeWrapper.d.ts.map +1 -1
  292. package/dist/node/modules/sentinel-memory/MemorySentinel.d.ts.map +1 -1
  293. package/dist/node/modules/sentinel-memory/SentinelRunner.d.ts.map +1 -1
  294. package/dist/node/modules/sentinel-model/typeChecks.d.ts.map +1 -1
  295. package/dist/node/modules/sentinel-wrapper/Wrapper.d.ts.map +1 -1
  296. package/dist/node/modules/witness-model/typeChecks.d.ts.map +1 -1
  297. package/dist/node/modules/witness-wrapper/WitnessWrapper.d.ts.map +1 -1
  298. package/package.json +6 -6
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/modules/bridge-http/HttpBridge.ts", "../../src/modules/bridge-http/HttpBridgeConfig.ts", "../../src/modules/bridge-http/HttpBridgeModuleResolver.ts", "../../src/modules/bridge-http/ModuleProxy/ModuleProxy.ts"],
4
- "sourcesContent": ["import type { Promisable } from '@ariestools/sdk'\nimport {\n assertEx,\n exists,\n FetchClientError,\n FetchJsonClient,\n forget,\n toSafeJsonString,\n} from '@ariestools/sdk'\nimport type {\n ApiEnvelope, ModuleManifestPayload, NodeManifestPayload, Payload, QueryBoundWitness, Schema, XyoAddress,\n} from '@xyo-network/sdk-protocol'\nimport { isPayloadOfSchemaType, NodeManifestPayloadSchema } from '@xyo-network/sdk-protocol'\nimport { Mutex, Semaphore } from 'async-mutex'\nimport { LRUCache } from 'lru-cache'\n\nimport { AbstractBridge } from '#bridge-abstract'\nimport type {\n BridgeExposeOptions,\n BridgeModule,\n BridgeParams,\n BridgeUnexposeOptions,\n QuerySendFinishedEventArgs,\n QuerySendStartedEventArgs,\n} from '#bridge-model'\nimport type {\n AnyConfigSchema,\n ModuleInstance,\n ModuleQueryResult,\n ModuleResolverInstance,\n ModuleStateQuery,\n} from '#module-model'\nimport {\n creatableModule,\n ModuleStateQuerySchema,\n} from '#module-model'\nimport { asAttachableNodeInstance } from '#node-model'\n\nimport type { HttpBridgeConfig } from './HttpBridgeConfig.ts'\nimport { HttpBridgeConfigSchema } from './HttpBridgeConfig.ts'\nimport { HttpBridgeModuleResolver } from './HttpBridgeModuleResolver.ts'\nimport type { BridgeQuerySender } from './ModuleProxy/index.ts'\n\nexport interface HttpBridgeParams extends BridgeParams<AnyConfigSchema<HttpBridgeConfig>> {\n fetchClient?: FetchJsonClient\n}\n\n@creatableModule()\nexport class HttpBridge<TParams extends HttpBridgeParams> extends AbstractBridge<TParams> implements BridgeModule<TParams>, BridgeQuerySender {\n static override readonly configSchemas: Schema[] = [...super.configSchemas, HttpBridgeConfigSchema]\n static override readonly defaultConfigSchema: Schema = HttpBridgeConfigSchema\n static readonly defaultFailureRetryTime: number = 1000 * 60\n static readonly defaultMaxConnections = 4\n static readonly defaultMaxPayloadSizeWarning: number = 256 * 256\n static readonly fetchClient: FetchJsonClient = new FetchJsonClient()\n static readonly maxFailureCacheSize = 1000\n\n private _discoverRootsMutex = new Mutex()\n private _failureTimeCache = new LRUCache<XyoAddress, number>({ max: HttpBridge.maxFailureCacheSize })\n private _fetchClient?: FetchJsonClient\n private _querySemaphore?: Semaphore\n private _resolver?: HttpBridgeModuleResolver\n\n get clientUrl(): string {\n return assertEx(this.config.client?.url, () => 'No Url Set')\n }\n\n get failureRetryTime(): number {\n return this.config.failureRetryTime ?? HttpBridge.defaultFailureRetryTime\n }\n\n get fetchClient(): FetchJsonClient {\n this._fetchClient = this._fetchClient ?? this.params.fetchClient ?? HttpBridge.fetchClient\n return this._fetchClient\n }\n\n get maxConnections(): number {\n return this.config.maxConnections ?? HttpBridge.defaultMaxConnections\n }\n\n get maxPayloadSizeWarning(): number {\n return this.config.maxPayloadSizeWarning ?? HttpBridge.defaultMaxPayloadSizeWarning\n }\n\n get querySemaphore(): Semaphore {\n this._querySemaphore = this._querySemaphore ?? new Semaphore(this.maxConnections)\n return this._querySemaphore\n }\n\n override get resolver(): HttpBridgeModuleResolver {\n this._resolver\n = this._resolver\n ?? new HttpBridgeModuleResolver({\n additionalSigners: this.additionalSigners,\n archiving: { ...this.archiving, resolveArchivists: this.resolveArchivingArchivists.bind(this) },\n bridge: this,\n onQuerySendFinished: (args: Omit<QuerySendFinishedEventArgs, 'mod'>) => {\n forget(this.emit('querySendFinished', { mod: this, ...args }))\n },\n onQuerySendStarted: (args: Omit<QuerySendStartedEventArgs, 'mod'>) => {\n forget(this.emit('querySendStarted', { mod: this, ...args }))\n },\n querySender: this,\n root: this,\n rootUrl: this.clientUrl,\n wrapperAccount: this.account,\n })\n return this._resolver\n }\n\n override exposeHandler(_id: string, _options?: BridgeExposeOptions): Promisable<ModuleInstance[]> {\n throw new Error('Unsupported')\n }\n\n override exposedHandler(): Promisable<XyoAddress[]> {\n throw new Error('Unsupported')\n }\n\n async getRoots(force?: boolean): Promise<ModuleInstance[]> {\n return await this._discoverRootsMutex.runExclusive(async () => {\n if (this._roots === undefined || force) {\n const state = await this.getRootState()\n this.logger?.debug(`HttpBridge:discoverRoots.state [${state?.length}]`)\n const nodeManifest = state?.find(isPayloadOfSchemaType<NodeManifestPayload>(NodeManifestPayloadSchema))\n if (nodeManifest) {\n const mods = (await this.resolveRootNode(nodeManifest)).filter(exists)\n this.logger?.debug(`HttpBridge:discoverRoots [${mods.length}]`)\n this._roots = mods\n } else {\n this._roots = []\n }\n }\n return this._roots\n })\n }\n\n moduleUrl(address: XyoAddress): URL {\n return new URL(address, this.clientUrl)\n }\n\n async sendBridgeQuery<TOut extends Payload = Payload, TQuery extends QueryBoundWitness = QueryBoundWitness, TIn extends Payload = Payload>(\n targetAddress: XyoAddress,\n query: TQuery,\n payloads?: TIn[],\n ): Promise<ModuleQueryResult<TOut>> {\n const lastFailureTime = this._failureTimeCache.get(targetAddress)\n if (lastFailureTime !== undefined) {\n const now = Date.now()\n const timeSincePreviousFailure = now - lastFailureTime\n if (timeSincePreviousFailure > this.failureRetryTime) {\n throw new Error(`target module failed recently [${targetAddress}] [${timeSincePreviousFailure}ms ago]`)\n }\n this._failureTimeCache.delete(targetAddress)\n }\n try {\n await this.querySemaphore.acquire()\n const payloadSize = JSON.stringify([query, payloads]).length\n if (payloadSize > this.maxPayloadSizeWarning) {\n this.logger?.warn(\n `Large targetQuery being sent: ${payloadSize} bytes [${this.address}][${targetAddress}] [${query.schema}] [${payloads?.length ?? 0}]`,\n )\n }\n const moduleUrl = this.moduleUrl(targetAddress).href\n const result = await this.fetchClient.post<ApiEnvelope<ModuleQueryResult<TOut>>>(moduleUrl, [query, payloads])\n if (result.status === 404) {\n throw new Error(`target module not found [${moduleUrl}] [${result.status}]`)\n }\n if (result.status >= 400) {\n this.logger?.error(`targetQuery failed [${moduleUrl}]`)\n throw new Error(`targetQuery failed [${moduleUrl}] [${result.status}]`)\n }\n return assertEx(result.data?.data, () => `targetQuery returned no data [${moduleUrl}]`)\n } catch (ex) {\n const error = ex instanceof FetchClientError ? ex : (ex as Error)\n this.logger?.error(`Error: ${toSafeJsonString(error)}`)\n throw error\n } finally {\n this.querySemaphore.release()\n }\n }\n\n override unexposeHandler(_id: string, _options?: BridgeUnexposeOptions): Promisable<ModuleInstance[]> {\n throw new Error('Unsupported')\n }\n\n private async getRootState() {\n const queryPayload: ModuleStateQuery = { schema: ModuleStateQuerySchema }\n const boundQuery = await this.bindQuery(queryPayload)\n try {\n const response = await this.fetchClient.post<ApiEnvelope<ModuleQueryResult>>(this.clientUrl.toString(), boundQuery)\n if (response.status === 404) {\n return []\n }\n const [, payloads, errors] = response.data?.data ?? [undefined, [], []]\n if (errors.length > 0) {\n throw new Error(`getRootState failed: ${JSON.stringify(errors, null, 2)}`)\n }\n return payloads\n } catch (ex) {\n const error = ex as Error\n this.logger?.warn(`Unable to connect to remote node: ${error.message} [${this.clientUrl}]`)\n }\n }\n\n private async resolveRootNode(nodeManifest: ModuleManifestPayload): Promise<ModuleInstance[]> {\n const rootModule = assertEx(\n (\n await this.resolver.resolveHandler(\n assertEx(nodeManifest.status?.address, () => 'Root has no address'),\n undefined,\n { manifest: nodeManifest },\n )\n ).at(0),\n () => `Root not found [${nodeManifest.status?.address}]`,\n )\n assertEx(rootModule.constructor.name !== 'HttpModuleProxy', () => 'rootModule is not a Wrapper')\n const rootNode = asAttachableNodeInstance(rootModule, 'Root modules is not a node')\n if (rootNode) {\n this.logger?.debug(`rootNode: ${rootNode.id}`)\n this.downResolver.addResolver(rootNode as unknown as ModuleResolverInstance)\n return [rootNode]\n }\n return []\n }\n}\n", "import type { EmptyObject } from '@ariestools/sdk'\nimport {\n zodAsFactory, zodIsFactory, zodToFactory,\n} from '@ariestools/sdk'\nimport type { Schema } from '@xyo-network/sdk-protocol'\nimport { asSchema } from '@xyo-network/sdk-protocol'\nimport * as z from 'zod/mini'\n\nimport type { BridgeClientConfig, BridgeConfig } from '#bridge-model'\nimport { BridgeConfigZod } from '#bridge-model'\n\nexport const HttpBridgeConfigSchema: 'network.xyo.bridge.http.config' & {\n readonly __schema: true\n} = asSchema('network.xyo.bridge.http.config', true)\nexport type HttpBridgeConfigSchema = typeof HttpBridgeConfigSchema\n\nexport const HttpBridgeConfigZod: z.ZodMiniObject<\n Omit<(typeof BridgeConfigZod)['shape'], 'schema' | 'client' | 'host'> & {\n client: z.ZodMiniOptional<z.ZodMiniCustom<BridgeClientConfig & { url: string }, BridgeClientConfig & { url: string }>>\n failureRetryTime: z.ZodMiniOptional<z.ZodMiniNumber<number>>\n failureTimeCacheMax: z.ZodMiniOptional<z.ZodMiniNumber<number>>\n host: z.ZodMiniOptional<z.ZodMiniCustom<{ port: number }, { port: number }>>\n maxConnections: z.ZodMiniOptional<z.ZodMiniNumber<number>>\n maxPayloadSizeWarning: z.ZodMiniOptional<z.ZodMiniNumber<number>>\n schema: z.ZodMiniLiteral<HttpBridgeConfigSchema>\n },\n z.core.$strip\n> = z.extend(BridgeConfigZod, {\n client: z.optional(z.custom<BridgeClientConfig & { url: string }>()),\n failureRetryTime: z.optional(z.number()),\n failureTimeCacheMax: z.optional(z.number()),\n host: z.optional(z.custom<{ port: number }>()),\n maxConnections: z.optional(z.number()),\n maxPayloadSizeWarning: z.optional(z.number()),\n schema: z.literal(HttpBridgeConfigSchema),\n})\n\nexport type HttpBridgeConfigBase = z.infer<typeof HttpBridgeConfigZod>\n\nexport const isHttpBridgeConfig: ReturnType<typeof zodIsFactory<HttpBridgeConfigBase>> = zodIsFactory(HttpBridgeConfigZod)\nexport const asHttpBridgeConfig: ReturnType<typeof zodAsFactory<HttpBridgeConfigBase>> = zodAsFactory(HttpBridgeConfigZod, 'asHttpBridgeConfig')\nexport const toHttpBridgeConfig: ReturnType<typeof zodToFactory<HttpBridgeConfigBase>> = zodToFactory(HttpBridgeConfigZod, 'toHttpBridgeConfig')\n\nexport type HttpBridgeConfig<TConfig extends EmptyObject = EmptyObject, TSchema extends string | void = void> = BridgeConfig<\n {\n client?: BridgeConfig['client'] & {\n url: string\n }\n failureRetryTime?: number\n failureTimeCacheMax?: number\n host?: {\n port: number\n }\n maxConnections?: number\n maxPayloadSizeWarning?: number\n schema: HttpBridgeConfigSchema\n } & TConfig,\n TSchema extends Schema ? TSchema : HttpBridgeConfigSchema\n>\n", "import type { CreatableName } from '@ariestools/sdk'\nimport {\n assertEx, isAddress, isDefined,\n} from '@ariestools/sdk'\nimport type {\n ConfigPayload, Payload, XyoAddress,\n XyoQuantAddress,\n} from '@xyo-network/sdk-protocol'\nimport { Account, ConfigSchema } from '@xyo-network/sdk-protocol'\nimport { Mutex } from 'async-mutex'\nimport { LRUCache } from 'lru-cache'\n\nimport type { BridgeModuleResolverParams } from '#bridge-abstract'\nimport { AbstractBridgeModuleResolver, wrapModuleWithType } from '#bridge-abstract'\nimport type {\n AnyConfigSchema,\n ModuleConfig,\n ModuleEventData,\n ModuleFilterOptions,\n ModuleIdentifier,\n ModuleInstance,\n QueryableModuleParams,\n} from '#module-model'\nimport {\n asModuleInstance,\n isModuleInstance,\n ModuleConfigSchema,\n} from '#module-model'\nimport { ResolveHelper } from '#module-resolver'\n\nimport type { BridgeQuerySender, HttpModuleProxyParams } from './ModuleProxy/index.ts'\nimport { HttpModuleProxy } from './ModuleProxy/index.ts'\n\nconst NotFoundModule = { notFound: true }\n\nexport interface HttpBridgeModuleResolverParams extends BridgeModuleResolverParams {\n querySender: BridgeQuerySender\n rootUrl: string\n}\n\nexport class HttpBridgeModuleResolver<\n T extends HttpBridgeModuleResolverParams = HttpBridgeModuleResolverParams,\n> extends AbstractBridgeModuleResolver<T> {\n protected _resolvedCache: LRUCache<(Lowercase<string> & {\n readonly __hex: true\n } & {\n readonly __address: true\n }) | XyoQuantAddress, {\n notFound: boolean\n } | ModuleInstance<QueryableModuleParams<AnyConfigSchema<ModuleConfig>>, ModuleEventData<object>>, unknown> = new LRUCache<XyoAddress, ModuleInstance | typeof NotFoundModule>({ max: 1000 })\n\n protected _resolvedCacheMutex: Mutex = new Mutex()\n\n get querySender(): BridgeQuerySender {\n return this.params.querySender\n }\n\n moduleUrl(address: XyoAddress): URL {\n return new URL(address, this.params.rootUrl)\n }\n\n override async resolveHandler<T extends ModuleInstance = ModuleInstance>(\n id: ModuleIdentifier,\n options?: ModuleFilterOptions<T>,\n params?: Partial<HttpModuleProxyParams>,\n ): Promise<T[]> {\n const parentResult = await super.resolveHandler(id, options)\n if (parentResult.length > 0) {\n return parentResult\n }\n const idParts = id.split(':')\n const untransformedFirstPart = assertEx(idParts.shift(), () => 'Missing module identifier')\n const firstPart = await ResolveHelper.transformModuleIdentifier(untransformedFirstPart)\n assertEx(isAddress(firstPart), () => `Invalid module address: ${firstPart}`)\n const remainderParts = idParts.join(':')\n const instance: T | undefined = await this._resolvedCacheMutex.runExclusive(async () => {\n const cachedMod = this._resolvedCache.get(firstPart as XyoAddress)\n if (cachedMod) {\n if (isModuleInstance(cachedMod)) {\n const result = idParts.length <= 0 ? cachedMod : cachedMod.resolve(remainderParts, { ...options, maxDepth: (options?.maxDepth ?? 5) - 1 })\n return result as T\n } else {\n // return cached 404\n return\n }\n }\n const account = await Account.random()\n const finalParams: HttpModuleProxyParams = {\n name: 'HttpBridgeModuleResolver' as CreatableName,\n account,\n archiving: this.params.archiving,\n config: { schema: ModuleConfigSchema },\n host: this,\n moduleAddress: firstPart as XyoAddress,\n onQuerySendFinished: this.params.onQuerySendFinished,\n onQuerySendStarted: this.params.onQuerySendStarted,\n querySender: this.params.querySender,\n ...params,\n }\n\n this.logger?.debug(`creating HttpProxy [${firstPart}] ${id}`)\n\n let proxy: HttpModuleProxy | undefined\n\n let state: Payload[] | undefined\n\n try {\n proxy = await HttpModuleProxy.create(finalParams)\n state = await proxy.state()\n } catch (ex) {\n const error = ex as Error\n this.logger?.error(error.message)\n }\n\n if (isDefined(proxy)) {\n if (!state) {\n // cache the fact that it was not found\n this._resolvedCache.set(firstPart as XyoAddress, NotFoundModule)\n return\n }\n\n const configSchema = (state.find(payload => payload.schema === ConfigSchema) as ConfigPayload | undefined)?.config\n const config = assertEx(\n state.find(payload => payload.schema === configSchema),\n () => 'Unable to locate config',\n ) as ModuleConfig\n proxy.setConfig(config)\n\n this.logger?.log(`created HttpProxy [${firstPart}] ${proxy.id}`)\n\n await proxy.start?.()\n const wrapped = wrapModuleWithType(proxy, account) as unknown as T\n assertEx(asModuleInstance<T>(wrapped, {}), () => `Failed to asModuleInstance [${id}]`)\n this._resolvedCache.set(wrapped.address, wrapped)\n return wrapped\n }\n })\n const result = remainderParts.length > 0 ? await instance?.resolve(remainderParts, options) : instance\n return result ? [result] : []\n }\n}\n", "import {\n exists, forget,\n isAddress, isString,\n} from '@ariestools/sdk'\nimport type {\n Payload, QueryBoundWitness, XyoAddress,\n} from '@xyo-network/sdk-protocol'\n\nimport type { ModuleProxyParams } from '#bridge-abstract'\nimport { AbstractModuleProxy } from '#bridge-abstract'\nimport type {\n AttachableModuleInstance,\n ModuleFilterOptions,\n ModuleIdentifier,\n ModuleInstance,\n ModuleQueryResult,\n} from '#module-model'\nimport { creatableModule } from '#module-model'\nimport type { ResolveHelperConfig } from '#module-resolver'\nimport { ResolveHelper } from '#module-resolver'\n\nexport interface BridgeQuerySender {\n sendBridgeQuery: <TOut extends Payload = Payload, TQuery extends QueryBoundWitness = QueryBoundWitness, TIn extends Payload = Payload>(\n targetAddress: XyoAddress,\n query: TQuery,\n payloads?: TIn[],\n ) => Promise<ModuleQueryResult<TOut>>\n}\n\nexport type HttpModuleProxyParams = ModuleProxyParams & {\n querySender: BridgeQuerySender\n}\n\n@creatableModule()\nexport class HttpModuleProxy<\n TWrappedModule extends ModuleInstance = ModuleInstance,\n TParams extends Omit<HttpModuleProxyParams, 'config'> & { config: TWrappedModule['config'] } = Omit<HttpModuleProxyParams, 'config'> & {\n config: TWrappedModule['config']\n },\n>\n extends AbstractModuleProxy<TWrappedModule, TParams>\n implements AttachableModuleInstance<TParams, TWrappedModule['eventData']> {\n async proxyQueryHandler<T extends QueryBoundWitness = QueryBoundWitness>(query: T, payloads: Payload[] = []): Promise<ModuleQueryResult> {\n if (this.archiving && this.isAllowedArchivingQuery(query.schema)) {\n forget(this.storeToArchivists([query, ...(payloads ?? [])]))\n }\n const result = await this.params.querySender.sendBridgeQuery(this.params.moduleAddress, query, payloads)\n if (this.archiving && this.isAllowedArchivingQuery(query.schema)) {\n forget(this.storeToArchivists(result.flat()))\n }\n return result\n }\n\n override async publicChildren(): Promise<ModuleInstance[]> {\n return (\n await Promise.all(\n Object.values(await this.childAddressMap())\n .filter(exists)\n .map(address => this.resolve(address)),\n )\n ).filter(exists)\n }\n\n /** @deprecated do not pass undefined. If trying to get all, pass '*' */\n override async resolve(): Promise<ModuleInstance[]>\n override async resolve<T extends ModuleInstance = ModuleInstance>(all: '*', options?: ModuleFilterOptions<T>): Promise<T[]>\n override async resolve<T extends ModuleInstance = ModuleInstance>(id: ModuleIdentifier, options?: ModuleFilterOptions<T>): Promise<T | undefined>\n override async resolve<T extends ModuleInstance = ModuleInstance>(\n id: ModuleIdentifier = '*',\n options: ModuleFilterOptions<T> = {},\n ): Promise<T | T[] | undefined> {\n const config: ResolveHelperConfig = {\n address: this.address,\n dead: this.dead,\n downResolver: this.downResolver,\n logger: this.logger,\n mod: this,\n transformers: this.moduleIdentifierTransformers,\n upResolver: this.upResolver,\n }\n if (id === '*') {\n return [...(await this.publicChildren()), await this.params.host.resolve(this.address)] as T[]\n }\n switch (typeof id) {\n case 'string': {\n const parts = id.split(':')\n const first = parts.shift()\n if (isString(first)) {\n const remainingPath = parts.length > 0 ? parts.join(':') : undefined\n const address\n = isAddress(first)\n ? first\n : this.id === first\n ? this.address\n : this.childAddressByName(first)\n if (!isAddress(address)) return undefined\n const firstInstance = (await this.params.host.resolve(address))\n return (isString(remainingPath) ? await firstInstance?.resolve(remainingPath) : firstInstance) as T | undefined\n }\n return undefined\n }\n default: {\n return (await ResolveHelper.resolve(config, id, options)).filter(mod => mod.address !== this.address)\n }\n }\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;AACA;AAAA,EACE,YAAAA;AAAA,EACA,UAAAC;AAAA,EACA;AAAA,EACA;AAAA,EACA,UAAAC;AAAA,EACA;AAAA,OACK;AAIP,SAAS,uBAAuB,iCAAiC;AACjE,SAAS,SAAAC,QAAO,iBAAiB;AACjC,SAAS,YAAAC,iBAAgB;AAEzB,SAAS,sBAAsB;AAgB/B;AAAA,EACE,mBAAAC;AAAA,EACA;AAAA,OACK;AACP,SAAS,gCAAgC;;;ACnCzC;AAAA,EACE;AAAA,EAAc;AAAA,EAAc;AAAA,OACvB;AAEP,SAAS,gBAAgB;AACzB,YAAY,OAAO;AAGnB,SAAS,uBAAuB;AAEzB,IAAM,yBAET,SAAS,kCAAkC,IAAI;AAG5C,IAAM,sBAWP,SAAO,iBAAiB;AAAA,EAC5B,QAAU,WAAW,SAA6C,CAAC;AAAA,EACnE,kBAAoB,WAAW,SAAO,CAAC;AAAA,EACvC,qBAAuB,WAAW,SAAO,CAAC;AAAA,EAC1C,MAAQ,WAAW,SAAyB,CAAC;AAAA,EAC7C,gBAAkB,WAAW,SAAO,CAAC;AAAA,EACrC,uBAAyB,WAAW,SAAO,CAAC;AAAA,EAC5C,QAAU,UAAQ,sBAAsB;AAC1C,CAAC;AAIM,IAAM,qBAA4E,aAAa,mBAAmB;AAClH,IAAM,qBAA4E,aAAa,qBAA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,CAAC;AAAA,MACN,MAAM,mBAAmB,aAAa,QAAQ,OAAO;AAAA,IACvD;AACA,IAAAA,UAAS,WAAW,YAAY,SAAS,mBAAmB,MAAM,6BAA6B;AAC/F,UAAM,WAAW,yBAAyB,YAAY,4BAA4B;AAClF,QAAI,UAAU;AACZ,WAAK,QAAQ,MAAM,aAAa,SAAS,EAAE,EAAE;AAC7C,WAAK,aAAa,YAAY,QAA6C;AAC3E,aAAO,CAAC,QAAQ;AAAA,IAClB;AACA,WAAO,CAAC;AAAA,EACV;AACF;AA/KE,cADW,YACc,iBAA0B,CAAC,GAAG,mCAAM,kBAAe,sBAAsB;AAClG,cAFW,YAEc,uBAA8B;AACvD,cAHW,YAGK,2BAAkC,MAAO;AACzD,cAJW,YAIK,yBAAwB;AACxC,cALW,YAKK,gCAAuC,MAAM;AAC7D,cANW,YAMK,eAA+B,IAAI,gBAAgB;AACnE,cAPW,YAOK,uBAAsB;AAP3B,aAAN;AAAA,EADNG,iBAAgB;AAAA,GACJ;",
4
+ "sourcesContent": ["import type { Promisable } from '@ariestools/sdk'\nimport {\n assertEx,\n exists,\n FetchClientError,\n FetchJsonClient,\n forget,\n toSafeJsonString,\n} from '@ariestools/sdk'\nimport type {\n ModuleManifestPayload, NodeManifestPayload, Payload, QueryBoundWitness, Schema, XyoAddress,\n} from '@xyo-network/sdk-protocol'\nimport { isPayloadOfSchemaType, NodeManifestPayloadSchema } from '@xyo-network/sdk-protocol'\nimport { Mutex, Semaphore } from 'async-mutex'\nimport { LRUCache } from 'lru-cache'\n\nimport { AbstractBridge } from '#bridge-abstract'\nimport type {\n BridgeExposeOptions,\n BridgeModule,\n BridgeParams,\n BridgeUnexposeOptions,\n QuerySendFinishedEventArgs,\n QuerySendStartedEventArgs,\n} from '#bridge-model'\nimport type {\n AnyConfigSchema,\n ModuleInstance,\n ModuleQueryResult,\n ModuleResolverInstance,\n ModuleStateQuery,\n} from '#module-model'\nimport {\n creatableModule,\n ModuleStateQuerySchema,\n} from '#module-model'\nimport { asAttachableNodeInstance } from '#node-model'\n\nimport type { HttpBridgeConfig } from './HttpBridgeConfig.ts'\nimport { HttpBridgeConfigSchema } from './HttpBridgeConfig.ts'\nimport { HttpBridgeModuleResolver } from './HttpBridgeModuleResolver.ts'\nimport type { BridgeQuerySender } from './ModuleProxy/index.ts'\n\n/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\nexport interface HttpBridgeParams extends BridgeParams<AnyConfigSchema<HttpBridgeConfig>> {\n fetchClient?: FetchJsonClient\n}\n\ninterface HttpQueryEnvelope<T> {\n data?: T\n errors?: unknown[]\n}\n\n/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\n@creatableModule()\nexport class HttpBridge<TParams extends HttpBridgeParams> extends AbstractBridge<TParams> implements BridgeModule<TParams>, BridgeQuerySender {\n static override readonly configSchemas: Schema[] = [...super.configSchemas, HttpBridgeConfigSchema]\n static override readonly defaultConfigSchema: Schema = HttpBridgeConfigSchema\n static readonly defaultFailureRetryTime: number = 1000 * 60\n static readonly defaultMaxConnections = 4\n static readonly defaultMaxPayloadSizeWarning: number = 256 * 256\n static readonly fetchClient: FetchJsonClient = new FetchJsonClient()\n static readonly maxFailureCacheSize = 1000\n\n private _discoverRootsMutex = new Mutex()\n private _failureTimeCache = new LRUCache<XyoAddress, number>({ max: HttpBridge.maxFailureCacheSize })\n private _fetchClient?: FetchJsonClient\n private _querySemaphore?: Semaphore\n private _resolver?: HttpBridgeModuleResolver\n\n get clientUrl(): string {\n return assertEx(this.config.client?.url, () => 'No Url Set')\n }\n\n get failureRetryTime(): number {\n return this.config.failureRetryTime ?? HttpBridge.defaultFailureRetryTime\n }\n\n get fetchClient(): FetchJsonClient {\n this._fetchClient = this._fetchClient ?? this.params.fetchClient ?? HttpBridge.fetchClient\n return this._fetchClient\n }\n\n get maxConnections(): number {\n return this.config.maxConnections ?? HttpBridge.defaultMaxConnections\n }\n\n get maxPayloadSizeWarning(): number {\n return this.config.maxPayloadSizeWarning ?? HttpBridge.defaultMaxPayloadSizeWarning\n }\n\n get querySemaphore(): Semaphore {\n this._querySemaphore = this._querySemaphore ?? new Semaphore(this.maxConnections)\n return this._querySemaphore\n }\n\n override get resolver(): HttpBridgeModuleResolver {\n this._resolver\n = this._resolver\n ?? new HttpBridgeModuleResolver({\n additionalSigners: this.additionalSigners,\n archiving: { ...this.archiving, resolveArchivists: this.resolveArchivingArchivists.bind(this) },\n bridge: this,\n onQuerySendFinished: (args: Omit<QuerySendFinishedEventArgs, 'mod'>) => {\n forget(this.emit('querySendFinished', { mod: this, ...args }))\n },\n onQuerySendStarted: (args: Omit<QuerySendStartedEventArgs, 'mod'>) => {\n forget(this.emit('querySendStarted', { mod: this, ...args }))\n },\n querySender: this,\n root: this,\n rootUrl: this.clientUrl,\n wrapperAccount: this.account,\n })\n return this._resolver\n }\n\n override exposeHandler(_id: string, _options?: BridgeExposeOptions): Promisable<ModuleInstance[]> {\n throw new Error('Unsupported')\n }\n\n override exposedHandler(): Promisable<XyoAddress[]> {\n throw new Error('Unsupported')\n }\n\n async getRoots(force?: boolean): Promise<ModuleInstance[]> {\n return await this._discoverRootsMutex.runExclusive(async () => {\n if (this._roots === undefined || force) {\n const state = await this.getRootState()\n this.logger?.debug(`HttpBridge:discoverRoots.state [${state?.length}]`)\n const nodeManifest = state?.find(isPayloadOfSchemaType<NodeManifestPayload>(NodeManifestPayloadSchema))\n if (nodeManifest) {\n const mods = (await this.resolveRootNode(nodeManifest)).filter(exists)\n this.logger?.debug(`HttpBridge:discoverRoots [${mods.length}]`)\n this._roots = mods\n } else {\n this._roots = []\n }\n }\n return this._roots\n })\n }\n\n moduleUrl(address: XyoAddress): URL {\n return new URL(address, this.clientUrl)\n }\n\n async sendBridgeQuery<TOut extends Payload = Payload, TQuery extends QueryBoundWitness = QueryBoundWitness, TIn extends Payload = Payload>(\n targetAddress: XyoAddress,\n query: TQuery,\n payloads?: TIn[],\n ): Promise<ModuleQueryResult<TOut>> {\n const lastFailureTime = this._failureTimeCache.get(targetAddress)\n if (lastFailureTime !== undefined) {\n const now = Date.now()\n const timeSincePreviousFailure = now - lastFailureTime\n if (timeSincePreviousFailure > this.failureRetryTime) {\n throw new Error(`target module failed recently [${targetAddress}] [${timeSincePreviousFailure}ms ago]`)\n }\n this._failureTimeCache.delete(targetAddress)\n }\n try {\n await this.querySemaphore.acquire()\n const payloadSize = JSON.stringify([query, payloads]).length\n if (payloadSize > this.maxPayloadSizeWarning) {\n this.logger?.warn(\n `Large targetQuery being sent: ${payloadSize} bytes [${this.address}][${targetAddress}] [${query.schema}] [${payloads?.length ?? 0}]`,\n )\n }\n const moduleUrl = this.moduleUrl(targetAddress).href\n const result = await this.fetchClient.post<HttpQueryEnvelope<ModuleQueryResult<TOut>>>(moduleUrl, [query, payloads])\n if (result.status === 404) {\n throw new Error(`target module not found [${moduleUrl}] [${result.status}]`)\n }\n if (result.status >= 400) {\n this.logger?.error(`targetQuery failed [${moduleUrl}]`)\n throw new Error(`targetQuery failed [${moduleUrl}] [${result.status}]`)\n }\n return assertEx(result.data?.data, () => `targetQuery returned no data [${moduleUrl}]`)\n } catch (ex) {\n const error = ex instanceof FetchClientError ? ex : (ex as Error)\n this.logger?.error(`Error: ${toSafeJsonString(error)}`)\n throw error\n } finally {\n this.querySemaphore.release()\n }\n }\n\n override unexposeHandler(_id: string, _options?: BridgeUnexposeOptions): Promisable<ModuleInstance[]> {\n throw new Error('Unsupported')\n }\n\n private async getRootState() {\n const queryPayload: ModuleStateQuery = { schema: ModuleStateQuerySchema }\n const boundQuery = await this.bindQuery(queryPayload)\n try {\n const response = await this.fetchClient.post<HttpQueryEnvelope<ModuleQueryResult>>(this.clientUrl.toString(), boundQuery)\n if (response.status === 404) {\n return []\n }\n const [, payloads, errors] = response.data?.data ?? [undefined, [], []]\n if (errors.length > 0) {\n throw new Error(`getRootState failed: ${JSON.stringify(errors, null, 2)}`)\n }\n return payloads\n } catch (ex) {\n const error = ex as Error\n this.logger?.warn(`Unable to connect to remote node: ${error.message} [${this.clientUrl}]`)\n }\n }\n\n private async resolveRootNode(nodeManifest: ModuleManifestPayload): Promise<ModuleInstance[]> {\n const rootModule = assertEx(\n (\n await this.resolver.resolveHandler(\n assertEx(nodeManifest.status?.address, () => 'Root has no address'),\n undefined,\n { manifest: nodeManifest },\n )\n ).at(0),\n () => `Root not found [${nodeManifest.status?.address}]`,\n )\n assertEx(rootModule.constructor.name !== 'HttpModuleProxy', () => 'rootModule is not a Wrapper')\n const rootNode = asAttachableNodeInstance(rootModule, 'Root modules is not a node')\n if (rootNode) {\n this.logger?.debug(`rootNode: ${rootNode.id}`)\n this.downResolver.addResolver(rootNode as unknown as ModuleResolverInstance)\n return [rootNode]\n }\n return []\n }\n}\n", "import type { EmptyObject } from '@ariestools/sdk'\nimport {\n zodAsFactory, zodIsFactory, zodToFactory,\n} from '@ariestools/sdk'\nimport type { Schema } from '@xyo-network/sdk-protocol'\nimport { asSchema } from '@xyo-network/sdk-protocol'\nimport * as z from 'zod/mini'\n\nimport type { BridgeClientConfig, BridgeConfig } from '#bridge-model'\nimport { BridgeConfigZod } from '#bridge-model'\n\n/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\nexport const HttpBridgeConfigSchema: 'network.xyo.bridge.http.config' & {\n readonly __schema: true\n} = asSchema('network.xyo.bridge.http.config', true)\n/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\nexport type HttpBridgeConfigSchema = typeof HttpBridgeConfigSchema\n\n/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\nexport const HttpBridgeConfigZod: z.ZodMiniObject<\n Omit<(typeof BridgeConfigZod)['shape'], 'schema' | 'client' | 'host'> & {\n client: z.ZodMiniOptional<z.ZodMiniCustom<BridgeClientConfig & { url: string }, BridgeClientConfig & { url: string }>>\n failureRetryTime: z.ZodMiniOptional<z.ZodMiniNumber<number>>\n failureTimeCacheMax: z.ZodMiniOptional<z.ZodMiniNumber<number>>\n host: z.ZodMiniOptional<z.ZodMiniCustom<{ port: number }, { port: number }>>\n maxConnections: z.ZodMiniOptional<z.ZodMiniNumber<number>>\n maxPayloadSizeWarning: z.ZodMiniOptional<z.ZodMiniNumber<number>>\n schema: z.ZodMiniLiteral<HttpBridgeConfigSchema>\n },\n z.core.$strip\n> = z.extend(BridgeConfigZod, {\n client: z.optional(z.custom<BridgeClientConfig & { url: string }>()),\n failureRetryTime: z.optional(z.number()),\n failureTimeCacheMax: z.optional(z.number()),\n host: z.optional(z.custom<{ port: number }>()),\n maxConnections: z.optional(z.number()),\n maxPayloadSizeWarning: z.optional(z.number()),\n schema: z.literal(HttpBridgeConfigSchema),\n})\n\n/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\nexport type HttpBridgeConfigBase = z.infer<typeof HttpBridgeConfigZod>\n\n/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\nexport const isHttpBridgeConfig: ReturnType<typeof zodIsFactory<HttpBridgeConfigBase>> = zodIsFactory(HttpBridgeConfigZod)\n/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\nexport const asHttpBridgeConfig: ReturnType<typeof zodAsFactory<HttpBridgeConfigBase>> = zodAsFactory(HttpBridgeConfigZod, 'asHttpBridgeConfig')\n/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\nexport const toHttpBridgeConfig: ReturnType<typeof zodToFactory<HttpBridgeConfigBase>> = zodToFactory(HttpBridgeConfigZod, 'toHttpBridgeConfig')\n\n/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\nexport type HttpBridgeConfig<TConfig extends EmptyObject = EmptyObject, TSchema extends string | void = void> = BridgeConfig<\n {\n client?: BridgeConfig['client'] & {\n url: string\n }\n failureRetryTime?: number\n failureTimeCacheMax?: number\n host?: {\n port: number\n }\n maxConnections?: number\n maxPayloadSizeWarning?: number\n schema: HttpBridgeConfigSchema\n } & TConfig,\n TSchema extends Schema ? TSchema : HttpBridgeConfigSchema\n>\n", "import type { CreatableName } from '@ariestools/sdk'\nimport {\n assertEx, isAddress, isDefined,\n} from '@ariestools/sdk'\nimport type {\n ConfigPayload, Payload, XyoAddress,\n XyoQuantAddress,\n} from '@xyo-network/sdk-protocol'\nimport { Account, ConfigSchema } from '@xyo-network/sdk-protocol'\nimport { Mutex } from 'async-mutex'\nimport { LRUCache } from 'lru-cache'\n\nimport type { BridgeModuleResolverParams } from '#bridge-abstract'\nimport { AbstractBridgeModuleResolver, wrapModuleWithType } from '#bridge-abstract'\nimport type {\n AnyConfigSchema,\n ModuleConfig,\n ModuleEventData,\n ModuleFilterOptions,\n ModuleIdentifier,\n ModuleInstance,\n QueryableModuleParams,\n} from '#module-model'\nimport {\n asModuleInstance,\n isModuleInstance,\n ModuleConfigSchema,\n} from '#module-model'\nimport { ResolveHelper } from '#module-resolver'\n\nimport type { BridgeQuerySender, HttpModuleProxyParams } from './ModuleProxy/index.ts'\nimport { HttpModuleProxy } from './ModuleProxy/index.ts'\n\nconst NotFoundModule = { notFound: true }\n\n/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\nexport interface HttpBridgeModuleResolverParams extends BridgeModuleResolverParams {\n querySender: BridgeQuerySender\n rootUrl: string\n}\n\n/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\nexport class HttpBridgeModuleResolver<\n T extends HttpBridgeModuleResolverParams = HttpBridgeModuleResolverParams,\n> extends AbstractBridgeModuleResolver<T> {\n protected _resolvedCache: LRUCache<(Lowercase<string> & {\n readonly __hex: true\n } & {\n readonly __address: true\n }) | XyoQuantAddress, ModuleInstance<QueryableModuleParams<AnyConfigSchema<ModuleConfig>>, ModuleEventData<object>> | {\n notFound: boolean\n }, unknown> = new LRUCache<XyoAddress, ModuleInstance | typeof NotFoundModule>({ max: 1000 })\n\n protected _resolvedCacheMutex: Mutex = new Mutex()\n\n get querySender(): BridgeQuerySender {\n return this.params.querySender\n }\n\n moduleUrl(address: XyoAddress): URL {\n return new URL(address, this.params.rootUrl)\n }\n\n override async resolveHandler<T extends ModuleInstance = ModuleInstance>(\n id: ModuleIdentifier,\n options?: ModuleFilterOptions<T>,\n params?: Partial<HttpModuleProxyParams>,\n ): Promise<T[]> {\n const parentResult = await super.resolveHandler(id, options)\n if (parentResult.length > 0) {\n return parentResult\n }\n const idParts = id.split(':')\n const untransformedFirstPart = assertEx(idParts.shift(), () => 'Missing module identifier')\n const firstPart = await ResolveHelper.transformModuleIdentifier(untransformedFirstPart)\n assertEx(isAddress(firstPart), () => `Invalid module address: ${firstPart}`)\n const remainderParts = idParts.join(':')\n const instance: T | undefined = await this._resolvedCacheMutex.runExclusive(async () => {\n const cachedMod = this._resolvedCache.get(firstPart as XyoAddress)\n if (cachedMod) {\n if (isModuleInstance(cachedMod)) {\n const result = idParts.length <= 0 ? cachedMod : cachedMod.resolve(remainderParts, { ...options, maxDepth: (options?.maxDepth ?? 5) - 1 })\n return result as T\n }\n // return cached 404\n return\n }\n const account = await Account.random()\n const finalParams: HttpModuleProxyParams = {\n name: 'HttpBridgeModuleResolver' as CreatableName,\n account,\n archiving: this.params.archiving,\n config: { schema: ModuleConfigSchema },\n host: this,\n moduleAddress: firstPart as XyoAddress,\n onQuerySendFinished: this.params.onQuerySendFinished,\n onQuerySendStarted: this.params.onQuerySendStarted,\n querySender: this.params.querySender,\n ...params,\n }\n\n this.logger?.debug(`creating HttpProxy [${firstPart}] ${id}`)\n\n let proxy: HttpModuleProxy | undefined\n\n let state: Payload[] | undefined\n\n try {\n proxy = await HttpModuleProxy.create(finalParams)\n state = await proxy.state()\n } catch (ex) {\n const error = ex as Error\n this.logger?.error(error.message)\n }\n\n if (isDefined(proxy)) {\n if (!state) {\n // cache the fact that it was not found\n this._resolvedCache.set(firstPart as XyoAddress, NotFoundModule)\n return\n }\n\n const configSchema = (state.find(payload => payload.schema === ConfigSchema) as ConfigPayload | undefined)?.config\n const config = assertEx(\n state.find(payload => payload.schema === configSchema),\n () => 'Unable to locate config',\n ) as ModuleConfig\n proxy.setConfig(config)\n\n this.logger?.log(`created HttpProxy [${firstPart}] ${proxy.id}`)\n\n await proxy.start?.()\n const wrapped = wrapModuleWithType(proxy, account) as unknown as T\n assertEx(asModuleInstance<T>(wrapped, {}), () => `Failed to asModuleInstance [${id}]`)\n this._resolvedCache.set(wrapped.address, wrapped)\n return wrapped\n }\n })\n const result = remainderParts.length > 0 ? await instance?.resolve(remainderParts, options) : instance\n return result ? [result] : []\n }\n}\n", "import {\n exists, forget,\n isAddress, isString,\n} from '@ariestools/sdk'\nimport type {\n Payload, QueryBoundWitness, XyoAddress,\n} from '@xyo-network/sdk-protocol'\n\nimport type { ModuleProxyParams } from '#bridge-abstract'\nimport { AbstractModuleProxy } from '#bridge-abstract'\nimport type {\n AttachableModuleInstance,\n ModuleFilterOptions,\n ModuleIdentifier,\n ModuleInstance,\n ModuleQueryResult,\n} from '#module-model'\nimport { creatableModule } from '#module-model'\nimport type { ResolveHelperConfig } from '#module-resolver'\nimport { ResolveHelper } from '#module-resolver'\n\n/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\nexport interface BridgeQuerySender {\n sendBridgeQuery: <TOut extends Payload = Payload, TQuery extends QueryBoundWitness = QueryBoundWitness, TIn extends Payload = Payload>(\n targetAddress: XyoAddress,\n query: TQuery,\n payloads?: TIn[],\n ) => Promise<ModuleQueryResult<TOut>>\n}\n\n/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\nexport type HttpModuleProxyParams = ModuleProxyParams & {\n querySender: BridgeQuerySender\n}\n\n/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\n@creatableModule()\nexport class HttpModuleProxy<\n TWrappedModule extends ModuleInstance = ModuleInstance,\n TParams extends Omit<HttpModuleProxyParams, 'config'> & { config: TWrappedModule['config'] } = Omit<HttpModuleProxyParams, 'config'> & {\n config: TWrappedModule['config']\n },\n>\n extends AbstractModuleProxy<TWrappedModule, TParams>\n implements AttachableModuleInstance<TParams, TWrappedModule['eventData']> {\n async proxyQueryHandler<T extends QueryBoundWitness = QueryBoundWitness>(query: T, payloads: Payload[] = []): Promise<ModuleQueryResult> {\n if (this.archiving && this.isAllowedArchivingQuery(query.schema)) {\n forget(this.storeToArchivists([query, ...(payloads ?? [])]))\n }\n const result = await this.params.querySender.sendBridgeQuery(this.params.moduleAddress, query, payloads)\n if (this.archiving && this.isAllowedArchivingQuery(query.schema)) {\n forget(this.storeToArchivists(result.flat()))\n }\n return result\n }\n\n override async publicChildren(): Promise<ModuleInstance[]> {\n return (\n await Promise.all(\n Object.values(await this.childAddressMap())\n .filter(exists)\n .map(address => this.resolve(address)),\n )\n ).filter(exists)\n }\n\n /** @deprecated do not pass undefined. If trying to get all, pass '*' */\n override async resolve(): Promise<ModuleInstance[]>\n override async resolve<T extends ModuleInstance = ModuleInstance>(all: '*', options?: ModuleFilterOptions<T>): Promise<T[]>\n override async resolve<T extends ModuleInstance = ModuleInstance>(id: ModuleIdentifier, options?: ModuleFilterOptions<T>): Promise<T | undefined>\n override async resolve<T extends ModuleInstance = ModuleInstance>(\n id: ModuleIdentifier = '*',\n options: ModuleFilterOptions<T> = {},\n ): Promise<T | T[] | undefined> {\n if (id === '*') {\n return [...(await this.publicChildren()), await this.params.host.resolve(this.address)] as T[]\n }\n const config: ResolveHelperConfig = {\n address: this.address,\n dead: this.dead,\n downResolver: this.downResolver,\n logger: this.logger,\n mod: this,\n transformers: this.moduleIdentifierTransformers,\n upResolver: this.upResolver,\n }\n switch (typeof id) {\n case 'string': {\n const parts = id.split(':')\n const first = parts.shift()\n if (isString(first)) {\n const remainingPath = parts.length > 0 ? parts.join(':') : undefined\n const address\n = isAddress(first)\n ? first\n : this.id === first\n ? this.address\n : this.childAddressByName(first)\n if (!isAddress(address)) return undefined\n const firstInstance = (await this.params.host.resolve(address))\n return (isString(remainingPath) ? await firstInstance?.resolve(remainingPath) : firstInstance) as T | undefined\n }\n return undefined\n }\n default: {\n return (await ResolveHelper.resolve(config, id, options)).filter(mod => mod.address !== this.address)\n }\n }\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AACA;AAA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AGK,2BAAkC,MAAO;AACzD,cAJW,YAIK,yBAAwB;AACxC,cALW,YAKK,gCAAuC,MAAM;AAC7D,cANW,YAMK,eAA+B,IAAI,gBAAgB;AACnE,cAPW,YAOK,uBAAsB;AAP3B,aAAN;AAAA,EADNG,iBAAgB;AAAA,GACJ;",
6
6
  "names": ["assertEx", "exists", "forget", "Mutex", "LRUCache", "creatableModule", "isAddress", "ResolveHelper", "ResolveHelper", "isAddress", "result", "Mutex", "LRUCache", "assertEx", "forget", "exists", "creatableModule"]
7
7
  }
@@ -104,11 +104,13 @@ var asBridgeUnexposeQuery = zodAsFactory4(BridgeUnexposeQueryZod, "asBridgeUnexp
104
104
  var toBridgeUnexposeQuery = zodToFactory4(BridgeUnexposeQueryZod, "toBridgeUnexposeQuery");
105
105
 
106
106
  // src/modules/bridge-model/typeChecks.ts
107
- var isBridgeInstance = new IsInstanceFactory().create(
107
+ var isInstanceFactory = new IsInstanceFactory();
108
+ var isBridgeInstance = isInstanceFactory.create(
108
109
  { expose: "function" },
109
110
  [isModuleInstance]
110
111
  );
111
- var isBridgeModule = new IsQueryableModuleFactory().create([BridgeConnectQuerySchema, BridgeDisconnectQuerySchema]);
112
+ var isQueryableModuleFactory = new IsQueryableModuleFactory();
113
+ var isBridgeModule = isQueryableModuleFactory.create([BridgeConnectQuerySchema, BridgeDisconnectQuerySchema]);
112
114
  var asBridgeModule = AsObjectFactory.create(isBridgeModule);
113
115
  var asBridgeInstance = AsObjectFactory.create(isBridgeInstance);
114
116
  var withBridgeModule = WithFactory.create(isBridgeModule);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/modules/bridge-model/attachable/asAttachableInstance.ts", "../../src/modules/bridge-model/attachable/isAttachableInstance.ts", "../../src/modules/bridge-model/typeChecks.ts", "../../src/modules/bridge-model/Queries/Connect.ts", "../../src/modules/bridge-model/Queries/Disconnect.ts", "../../src/modules/bridge-model/Queries/Expose.ts", "../../src/modules/bridge-model/Queries/Unexpose.ts", "../../src/modules/bridge-model/attachable/AttachableInstance.ts", "../../src/modules/bridge-model/Config.ts"],
4
- "sourcesContent": ["import { AsObjectFactory } from '@ariestools/sdk'\n\nimport { isAttachableBridgeInstance } from './isAttachableInstance.ts'\n\nexport const asAttachableBridgeInstance = AsObjectFactory.create(isAttachableBridgeInstance)\n", "import type { ObjectTypeShape, TypeCheck } from '@ariestools/sdk'\nimport { IsObjectFactory } from '@ariestools/sdk'\n\nimport { isAttachableModuleInstance } from '#module-model'\n\nimport { isBridgeInstance } from '../typeChecks.ts'\nimport type { AttachableBridgeInstance } from './AttachableInstance.ts'\n\nexport const requiredAttachableBridgeInstanceFunctions: ObjectTypeShape = {}\n\n// we do not use IsInstanceFactory here to prevent a cycle\nconst factory = new IsObjectFactory<AttachableBridgeInstance>()\n\nexport const isAttachableBridgeInstance: TypeCheck<AttachableBridgeInstance> = factory.create(requiredAttachableBridgeInstanceFunctions, [\n isBridgeInstance,\n isAttachableModuleInstance,\n])\n", "import { AsObjectFactory } from '@ariestools/sdk'\n\nimport {\n IsInstanceFactory, isModuleInstance, IsQueryableModuleFactory, WithFactory,\n} from '#module-model'\n\nimport type { BridgeInstance } from './Instance.ts'\nimport type { BridgeModule } from './Module.ts'\nimport { BridgeConnectQuerySchema, BridgeDisconnectQuerySchema } from './Queries/index.ts'\n\nexport const isBridgeInstance = new IsInstanceFactory<BridgeInstance>().create(\n { expose: 'function' },\n [isModuleInstance],\n)\nexport const isBridgeModule = new IsQueryableModuleFactory<BridgeModule>().create([BridgeConnectQuerySchema, BridgeDisconnectQuerySchema])\n\nexport const asBridgeModule = AsObjectFactory.create(isBridgeModule)\nexport const asBridgeInstance = AsObjectFactory.create(isBridgeInstance)\n\n/** @deprecated use narrowing instead [ if(is) ] */\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nexport const withBridgeModule = WithFactory.create(isBridgeModule)\n/** @deprecated use narrowing instead [ if(is) ] */\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nexport const withBridgeInstance = WithFactory.create(isBridgeInstance)\n", "import {\n zodAsFactory, zodIsFactory, zodToFactory,\n} from '@ariestools/sdk'\nimport {\n asSchema, PayloadZodOfSchema, QueryFieldsZod,\n} from '@xyo-network/sdk-protocol'\nimport * as z from 'zod/mini'\n\nimport type { ModuleIdentifier } from '#module-model'\n\nexport const BridgeConnectQuerySchema: 'network.xyo.query.bridge.connect' & {\n readonly __schema: true\n} = asSchema('network.xyo.query.bridge.connect', true)\nexport type BridgeConnectQuerySchema = typeof BridgeConnectQuerySchema\n\nexport const BridgeConnectQueryZod: z.ZodMiniObject<\n & { schema: z.ZodMiniLiteral<BridgeConnectQuerySchema> }\n & (typeof QueryFieldsZod)['shape']\n & {\n id: z.ZodMiniOptional<z.ZodMiniCustom<ModuleIdentifier, ModuleIdentifier>>\n maxDepth: z.ZodMiniOptional<z.ZodMiniNumber<number>>\n },\n z.core.$strip\n> = z.extend(PayloadZodOfSchema(BridgeConnectQuerySchema), {\n ...QueryFieldsZod.shape,\n id: z.optional(z.custom<ModuleIdentifier>()),\n maxDepth: z.optional(z.number()),\n})\n\nexport type BridgeConnectQuery = z.infer<typeof BridgeConnectQueryZod>\n\nexport const isBridgeConnectQuery: ReturnType<typeof zodIsFactory<BridgeConnectQuery>> = zodIsFactory(BridgeConnectQueryZod)\nexport const asBridgeConnectQuery: ReturnType<typeof zodAsFactory<BridgeConnectQuery>> = zodAsFactory(BridgeConnectQueryZod, 'asBridgeConnectQuery')\nexport const toBridgeConnectQuery: ReturnType<typeof zodToFactory<BridgeConnectQuery>> = zodToFactory(BridgeConnectQueryZod, 'toBridgeConnectQuery')\n", "import {\n zodAsFactory, zodIsFactory, zodToFactory,\n} from '@ariestools/sdk'\nimport {\n asSchema, PayloadZodOfSchema, QueryFieldsZod,\n} from '@xyo-network/sdk-protocol'\nimport * as z from 'zod/mini'\n\nimport type { ModuleIdentifier } from '#module-model'\n\nexport const BridgeDisconnectQuerySchema: 'network.xyo.query.bridge.disconnect' & {\n readonly __schema: true\n} = asSchema('network.xyo.query.bridge.disconnect', true)\nexport type BridgeDisconnectQuerySchema = typeof BridgeDisconnectQuerySchema\n\nexport const BridgeDisconnectQueryZod: z.ZodMiniObject<\n & { schema: z.ZodMiniLiteral<BridgeDisconnectQuerySchema> }\n & (typeof QueryFieldsZod)['shape']\n & {\n id: z.ZodMiniOptional<z.ZodMiniCustom<ModuleIdentifier, ModuleIdentifier>>\n maxDepth: z.ZodMiniOptional<z.ZodMiniNumber<number>>\n },\n z.core.$strip\n> = z.extend(PayloadZodOfSchema(BridgeDisconnectQuerySchema), {\n ...QueryFieldsZod.shape,\n id: z.optional(z.custom<ModuleIdentifier>()),\n maxDepth: z.optional(z.number()),\n})\n\nexport type BridgeDisconnectQuery = z.infer<typeof BridgeDisconnectQueryZod>\n\nexport const isBridgeDisconnectQuery: ReturnType<typeof zodIsFactory<BridgeDisconnectQuery>> = zodIsFactory(BridgeDisconnectQueryZod)\nexport const asBridgeDisconnectQuery: ReturnType<typeof zodAsFactory<BridgeDisconnectQuery>> = zodAsFactory(BridgeDisconnectQueryZod, 'asBridgeDisconnectQuery')\nexport const toBridgeDisconnectQuery: ReturnType<typeof zodToFactory<BridgeDisconnectQuery>> = zodToFactory(BridgeDisconnectQueryZod, 'toBridgeDisconnectQuery')\n", "import {\n zodAsFactory, zodIsFactory, zodToFactory,\n} from '@ariestools/sdk'\nimport {\n asSchema, PayloadZodOfSchema, QueryFieldsZod,\n} from '@xyo-network/sdk-protocol'\nimport * as z from 'zod/mini'\n\nimport type { ModuleIdentifier } from '#module-model'\n\nexport const BridgeExposeQuerySchema: 'network.xyo.query.bridge.expose' & {\n readonly __schema: true\n} = asSchema('network.xyo.query.bridge.expose', true)\nexport type BridgeExposeQuerySchema = typeof BridgeExposeQuerySchema\n\nexport interface BridgeExposeOptions {\n maxDepth?: number\n required?: boolean\n}\n\nexport const ModuleFilterPayloadSchema: 'network.xyo.module.filter' & {\n readonly __schema: true\n} = asSchema('network.xyo.module.filter', true)\nexport type ModuleFilterPayloadSchema = typeof ModuleFilterPayloadSchema\n\nexport const ModuleFilterPayloadZod: z.ZodMiniObject<{\n id: z.ZodMiniCustom<ModuleIdentifier, ModuleIdentifier>\n maxDepth: z.ZodMiniOptional<z.ZodMiniNumber<number>>\n required: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>\n schema: z.ZodMiniLiteral<ModuleFilterPayloadSchema>\n}, z.core.$strip> = z.extend(PayloadZodOfSchema(ModuleFilterPayloadSchema), {\n id: z.custom<ModuleIdentifier>(),\n maxDepth: z.optional(z.number()),\n required: z.optional(z.boolean()),\n})\n\nexport type ModuleFilterPayload = z.infer<typeof ModuleFilterPayloadZod>\n\nexport const isModuleFilterPayload: ReturnType<typeof zodIsFactory<ModuleFilterPayload>> = zodIsFactory(ModuleFilterPayloadZod)\nexport const asModuleFilterPayload: ReturnType<typeof zodAsFactory<ModuleFilterPayload>> = zodAsFactory(ModuleFilterPayloadZod, 'asModuleFilterPayload')\nexport const toModuleFilterPayload: ReturnType<typeof zodToFactory<ModuleFilterPayload>> = zodToFactory(ModuleFilterPayloadZod, 'toModuleFilterPayload')\n\nexport const BridgeExposeQueryZod: z.ZodMiniObject<\n & { schema: z.ZodMiniLiteral<BridgeExposeQuerySchema> }\n & (typeof QueryFieldsZod)['shape'],\n z.core.$strip\n> = z.extend(PayloadZodOfSchema(BridgeExposeQuerySchema), { ...QueryFieldsZod.shape })\n\nexport type BridgeExposeQuery = z.infer<typeof BridgeExposeQueryZod>\n\nexport const isBridgeExposeQuery: ReturnType<typeof zodIsFactory<BridgeExposeQuery>> = zodIsFactory(BridgeExposeQueryZod)\nexport const asBridgeExposeQuery: ReturnType<typeof zodAsFactory<BridgeExposeQuery>> = zodAsFactory(BridgeExposeQueryZod, 'asBridgeExposeQuery')\nexport const toBridgeExposeQuery: ReturnType<typeof zodToFactory<BridgeExposeQuery>> = zodToFactory(BridgeExposeQueryZod, 'toBridgeExposeQuery')\n", "import {\n zodAsFactory, zodIsFactory, zodToFactory,\n} from '@ariestools/sdk'\nimport {\n asSchema, PayloadZodOfSchema, QueryFieldsZod,\n} from '@xyo-network/sdk-protocol'\nimport * as z from 'zod/mini'\n\nimport type { BridgeExposeOptions } from './Expose.ts'\n\nexport const BridgeUnexposeQuerySchema: 'network.xyo.query.bridge.unexpose' & {\n readonly __schema: true\n} = asSchema('network.xyo.query.bridge.unexpose', true)\nexport type BridgeUnexposeQuerySchema = typeof BridgeUnexposeQuerySchema\n\nexport interface BridgeUnexposeOptions extends BridgeExposeOptions {}\n\nexport const BridgeUnexposeQueryZod: z.ZodMiniObject<\n & { schema: z.ZodMiniLiteral<BridgeUnexposeQuerySchema> }\n & (typeof QueryFieldsZod)['shape'],\n z.core.$strip\n> = z.extend(PayloadZodOfSchema(BridgeUnexposeQuerySchema), { ...QueryFieldsZod.shape })\n\nexport type BridgeUnexposeQuery = z.infer<typeof BridgeUnexposeQueryZod>\n\nexport const isBridgeUnexposeQuery: ReturnType<typeof zodIsFactory<BridgeUnexposeQuery>> = zodIsFactory(BridgeUnexposeQueryZod)\nexport const asBridgeUnexposeQuery: ReturnType<typeof zodAsFactory<BridgeUnexposeQuery>> = zodAsFactory(BridgeUnexposeQueryZod, 'asBridgeUnexposeQuery')\nexport const toBridgeUnexposeQuery: ReturnType<typeof zodToFactory<BridgeUnexposeQuery>> = zodToFactory(BridgeUnexposeQueryZod, 'toBridgeUnexposeQuery')\n", "import type { TypeCheck } from '@ariestools/sdk'\nimport { IsObjectFactory } from '@ariestools/sdk'\n\nimport type { AttachableModuleInstance } from '#module-model'\n\nimport type { BridgeModuleEventData } from '../EventData.ts'\nimport type { BridgeInstance } from '../Instance.ts'\nimport type { BridgeModule } from '../Module.ts'\nimport type { BridgeParams } from '../Params.ts'\n\nexport interface AttachableBridgeInstance<\n TParams extends BridgeParams = BridgeParams,\n TEventData extends BridgeModuleEventData = BridgeModuleEventData,\n> extends BridgeModule<TParams, TEventData>,\n AttachableModuleInstance<TParams, TEventData>,\n BridgeInstance<TParams, TEventData> {}\n\nexport type AttachableBridgeInstanceTypeCheck<T extends AttachableBridgeInstance = AttachableBridgeInstance> = TypeCheck<T>\n\nexport class IsAttachableBridgeInstanceFactory<T extends AttachableBridgeInstance = AttachableBridgeInstance> extends IsObjectFactory<T> {}\n", "import type { EmptyObject, WithAdditional } from '@ariestools/sdk'\nimport {\n zodAsFactory, zodIsFactory, zodToFactory,\n} from '@ariestools/sdk'\nimport type {\n Payload,\n Schema,\n} from '@xyo-network/sdk-protocol'\nimport { asSchema } from '@xyo-network/sdk-protocol'\nimport * as z from 'zod/mini'\n\nimport type { CacheConfig, ModuleConfig } from '#module-model'\nimport { ModuleConfigZod } from '#module-model'\n\nexport const BridgeConfigSchema: 'network.xyo.bridge.config' & {\n readonly __schema: true\n} = asSchema('network.xyo.bridge.config', true)\nexport type BridgeConfigSchema = typeof BridgeConfigSchema\n\nexport interface BridgeClientConfig {\n cache?: CacheConfig | true\n discoverRoots?: 'start' | 'lazy'\n maxDepth?: number\n}\n\nexport interface BridgeHostConfig {\n cache?: CacheConfig | true\n maxDepth?: number\n}\n\nexport const BridgeConfigZod: z.ZodMiniObject<\n Omit<(typeof ModuleConfigZod)['shape'], 'schema'> & {\n client: z.ZodMiniOptional<z.ZodMiniCustom<BridgeClientConfig, BridgeClientConfig>>\n host: z.ZodMiniOptional<z.ZodMiniCustom<BridgeHostConfig, BridgeHostConfig>>\n schema: z.ZodMiniLiteral<BridgeConfigSchema>\n },\n z.core.$strip\n> = z.extend(ModuleConfigZod, {\n schema: z.literal(BridgeConfigSchema),\n client: z.optional(z.custom<BridgeClientConfig>()),\n host: z.optional(z.custom<BridgeHostConfig>()),\n})\n\nexport type BridgeConfigBase = z.infer<typeof BridgeConfigZod>\n\nexport const isBridgeConfig: ReturnType<typeof zodIsFactory<BridgeConfigBase>> = zodIsFactory(BridgeConfigZod)\nexport const asBridgeConfig: ReturnType<typeof zodAsFactory<BridgeConfigBase>> = zodAsFactory(BridgeConfigZod, 'asBridgeConfig')\nexport const toBridgeConfig: ReturnType<typeof zodToFactory<BridgeConfigBase>> = zodToFactory(BridgeConfigZod, 'toBridgeConfig')\n\nexport type BridgeConfig<\n TConfig extends Payload | EmptyObject | void = void,\n TSchema extends Schema | void = void,\n TClient extends EmptyObject | void = void,\n THost extends EmptyObject | void = void,\n> = ModuleConfig<\n WithAdditional<\n {\n client?: WithAdditional<BridgeClientConfig, TClient>\n host?: WithAdditional<BridgeHostConfig, THost>\n schema: TConfig extends Payload ? TConfig['schema'] : BridgeConfigSchema\n },\n TConfig\n >,\n TSchema\n>\n"],
5
- "mappings": ";AAAA,SAAS,mBAAAA,wBAAuB;;;ACChC,SAAS,uBAAuB;AAEhC,SAAS,kCAAkC;;;ACH3C,SAAS,uBAAuB;AAEhC;AAAA,EACE;AAAA,EAAmB;AAAA,EAAkB;AAAA,EAA0B;AAAA,OAC1D;;;ACJP;AAAA,EACE;AAAA,EAAc;AAAA,EAAc;AAAA,OACvB;AACP;AAAA,EACE;AAAA,EAAU;AAAA,EAAoB;AAAA,OACzB;AACP,YAAY,OAAO;AAIZ,IAAM,2BAET,SAAS,oCAAoC,IAAI;AAG9C,IAAM,wBAQP,SAAO,mBAAmB,wBAAwB,GAAG;AAAA,EACzD,GAAG,eAAe;AAAA,EAClB,IAAM,WAAW,SAAyB,CAAC;AAAA,EAC3C,UAAY,WAAW,SAAO,CAAC;AACjC,CAAC;AAIM,IAAM,uBAA4E,aAAa,qBAAqB;AACpH,IAAM,uBAA4E,aAAa,uBAAuB,sBAAsB;AAC5I,IAAM,uBAA4E,aAAa,uBAAuB,sBAAsB;;;ACjCnJ;AAAA,EACE,gBAAAC;AAAA,EAAc,gBAAAC;AAAA,EAAc,gBAAAC;AAAA,OACvB;AACP;AAAA,EACE,YAAAC;AAAA,EAAU,sBAAAC;AAAA,EAAoB,kBAAAC;AAAA,OACzB;AACP,YAAYC,QAAO;AAIZ,IAAM,8BAETH,UAAS,uCAAuC,IAAI;AAGjD,IAAM,2B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AAa,eAAe;AACtG,IAAM,iBAAoED,cAAa,iBAAiB,gBAAgB;AACxH,IAAM,iBAAoEE,cAAa,iBAAiB,gBAAgB;",
4
+ "sourcesContent": ["import { AsObjectFactory } from '@ariestools/sdk'\n\nimport { isAttachableBridgeInstance } from './isAttachableInstance.ts'\n\n/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\nexport const asAttachableBridgeInstance = AsObjectFactory.create(isAttachableBridgeInstance)\n", "import type { ObjectTypeShape, TypeCheck } from '@ariestools/sdk'\nimport { IsObjectFactory } from '@ariestools/sdk'\n\nimport { isAttachableModuleInstance } from '#module-model'\n\nimport { isBridgeInstance } from '../typeChecks.ts'\nimport type { AttachableBridgeInstance } from './AttachableInstance.ts'\n\n/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\nexport const requiredAttachableBridgeInstanceFunctions: ObjectTypeShape = {}\n\n// we do not use IsInstanceFactory here to prevent a cycle\nconst factory = new IsObjectFactory<AttachableBridgeInstance>()\n\n/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\nexport const isAttachableBridgeInstance: TypeCheck<AttachableBridgeInstance> = factory.create(requiredAttachableBridgeInstanceFunctions, [\n isBridgeInstance,\n isAttachableModuleInstance,\n])\n", "import { AsObjectFactory } from '@ariestools/sdk'\n\nimport {\n IsInstanceFactory, isModuleInstance, IsQueryableModuleFactory, WithFactory,\n} from '#module-model'\n\nimport type { BridgeInstance } from './Instance.ts'\nimport type { BridgeModule } from './Module.ts'\nimport { BridgeConnectQuerySchema, BridgeDisconnectQuerySchema } from './Queries/index.ts'\n\nconst isInstanceFactory = new IsInstanceFactory<BridgeInstance>()\n/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\nexport const isBridgeInstance = isInstanceFactory.create(\n { expose: 'function' },\n [isModuleInstance],\n)\nconst isQueryableModuleFactory = new IsQueryableModuleFactory<BridgeModule>()\n/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\nexport const isBridgeModule = isQueryableModuleFactory.create([BridgeConnectQuerySchema, BridgeDisconnectQuerySchema])\n\n/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\nexport const asBridgeModule = AsObjectFactory.create(isBridgeModule)\n/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\nexport const asBridgeInstance = AsObjectFactory.create(isBridgeInstance)\n\n/**\n * @deprecated The Bridge module concept is deprecated and will be removed in the next major version.\n * @deprecated use narrowing instead [ if(is) ]\n */\nexport const withBridgeModule = WithFactory.create(isBridgeModule)\n/**\n * @deprecated The Bridge module concept is deprecated and will be removed in the next major version.\n * @deprecated use narrowing instead [ if(is) ]\n */\nexport const withBridgeInstance = WithFactory.create(isBridgeInstance)\n", "import {\n zodAsFactory, zodIsFactory, zodToFactory,\n} from '@ariestools/sdk'\nimport {\n asSchema, PayloadZodOfSchema, QueryFieldsZod,\n} from '@xyo-network/sdk-protocol'\nimport * as z from 'zod/mini'\n\nimport type { ModuleIdentifier } from '#module-model'\n\n/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\nexport const BridgeConnectQuerySchema: 'network.xyo.query.bridge.connect' & {\n readonly __schema: true\n} = asSchema('network.xyo.query.bridge.connect', true)\n/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\nexport type BridgeConnectQuerySchema = typeof BridgeConnectQuerySchema\n\n/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\nexport const BridgeConnectQueryZod: z.ZodMiniObject<\n & { schema: z.ZodMiniLiteral<BridgeConnectQuerySchema> }\n & (typeof QueryFieldsZod)['shape']\n & {\n id: z.ZodMiniOptional<z.ZodMiniCustom<ModuleIdentifier, ModuleIdentifier>>\n maxDepth: z.ZodMiniOptional<z.ZodMiniNumber<number>>\n },\n z.core.$strip\n> = z.extend(PayloadZodOfSchema(BridgeConnectQuerySchema), {\n ...QueryFieldsZod.shape,\n id: z.optional(z.custom<ModuleIdentifier>()),\n maxDepth: z.optional(z.number()),\n})\n\n/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\nexport type BridgeConnectQuery = z.infer<typeof BridgeConnectQueryZod>\n\n/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\nexport const isBridgeConnectQuery: ReturnType<typeof zodIsFactory<BridgeConnectQuery>> = zodIsFactory(BridgeConnectQueryZod)\n/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\nexport const asBridgeConnectQuery: ReturnType<typeof zodAsFactory<BridgeConnectQuery>> = zodAsFactory(BridgeConnectQueryZod, 'asBridgeConnectQuery')\n/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\nexport const toBridgeConnectQuery: ReturnType<typeof zodToFactory<BridgeConnectQuery>> = zodToFactory(BridgeConnectQueryZod, 'toBridgeConnectQuery')\n", "import {\n zodAsFactory, zodIsFactory, zodToFactory,\n} from '@ariestools/sdk'\nimport {\n asSchema, PayloadZodOfSchema, QueryFieldsZod,\n} from '@xyo-network/sdk-protocol'\nimport * as z from 'zod/mini'\n\nimport type { ModuleIdentifier } from '#module-model'\n\n/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\nexport const BridgeDisconnectQuerySchema: 'network.xyo.query.bridge.disconnect' & {\n readonly __schema: true\n} = asSchema('network.xyo.query.bridge.disconnect', true)\n/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\nexport type BridgeDisconnectQuerySchema = typeof BridgeDisconnectQuerySchema\n\n/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\nexport const BridgeDisconnectQueryZod: z.ZodMiniObject<\n & { schema: z.ZodMiniLiteral<BridgeDisconnectQuerySchema> }\n & (typeof QueryFieldsZod)['shape']\n & {\n id: z.ZodMiniOptional<z.ZodMiniCustom<ModuleIdentifier, ModuleIdentifier>>\n maxDepth: z.ZodMiniOptional<z.ZodMiniNumber<number>>\n },\n z.core.$strip\n> = z.extend(PayloadZodOfSchema(BridgeDisconnectQuerySchema), {\n ...QueryFieldsZod.shape,\n id: z.optional(z.custom<ModuleIdentifier>()),\n maxDepth: z.optional(z.number()),\n})\n\n/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\nexport type BridgeDisconnectQuery = z.infer<typeof BridgeDisconnectQueryZod>\n\n/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\nexport const isBridgeDisconnectQuery: ReturnType<typeof zodIsFactory<BridgeDisconnectQuery>> = zodIsFactory(BridgeDisconnectQueryZod)\n/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\nexport const asBridgeDisconnectQuery: ReturnType<typeof zodAsFactory<BridgeDisconnectQuery>> = zodAsFactory(BridgeDisconnectQueryZod, 'asBridgeDisconnectQuery')\n/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\nexport const toBridgeDisconnectQuery: ReturnType<typeof zodToFactory<BridgeDisconnectQuery>> = zodToFactory(BridgeDisconnectQueryZod, 'toBridgeDisconnectQuery')\n", "import {\n zodAsFactory, zodIsFactory, zodToFactory,\n} from '@ariestools/sdk'\nimport {\n asSchema, PayloadZodOfSchema, QueryFieldsZod,\n} from '@xyo-network/sdk-protocol'\nimport * as z from 'zod/mini'\n\nimport type { ModuleIdentifier } from '#module-model'\n\n/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\nexport const BridgeExposeQuerySchema: 'network.xyo.query.bridge.expose' & {\n readonly __schema: true\n} = asSchema('network.xyo.query.bridge.expose', true)\n/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\nexport type BridgeExposeQuerySchema = typeof BridgeExposeQuerySchema\n\n/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\nexport interface BridgeExposeOptions {\n maxDepth?: number\n required?: boolean\n}\n\n/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\nexport const ModuleFilterPayloadSchema: 'network.xyo.module.filter' & {\n readonly __schema: true\n} = asSchema('network.xyo.module.filter', true)\n/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\nexport type ModuleFilterPayloadSchema = typeof ModuleFilterPayloadSchema\n\n/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\nexport const ModuleFilterPayloadZod: z.ZodMiniObject<{\n id: z.ZodMiniCustom<ModuleIdentifier, ModuleIdentifier>\n maxDepth: z.ZodMiniOptional<z.ZodMiniNumber<number>>\n required: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>\n schema: z.ZodMiniLiteral<ModuleFilterPayloadSchema>\n}, z.core.$strip> = z.extend(PayloadZodOfSchema(ModuleFilterPayloadSchema), {\n id: z.custom<ModuleIdentifier>(),\n maxDepth: z.optional(z.number()),\n required: z.optional(z.boolean()),\n})\n\n/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\nexport type ModuleFilterPayload = z.infer<typeof ModuleFilterPayloadZod>\n\n/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\nexport const isModuleFilterPayload: ReturnType<typeof zodIsFactory<ModuleFilterPayload>> = zodIsFactory(ModuleFilterPayloadZod)\n/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\nexport const asModuleFilterPayload: ReturnType<typeof zodAsFactory<ModuleFilterPayload>> = zodAsFactory(ModuleFilterPayloadZod, 'asModuleFilterPayload')\n/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\nexport const toModuleFilterPayload: ReturnType<typeof zodToFactory<ModuleFilterPayload>> = zodToFactory(ModuleFilterPayloadZod, 'toModuleFilterPayload')\n\n/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\nexport const BridgeExposeQueryZod: z.ZodMiniObject<\n & { schema: z.ZodMiniLiteral<BridgeExposeQuerySchema> }\n & (typeof QueryFieldsZod)['shape'],\n z.core.$strip\n> = z.extend(PayloadZodOfSchema(BridgeExposeQuerySchema), { ...QueryFieldsZod.shape })\n\n/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\nexport type BridgeExposeQuery = z.infer<typeof BridgeExposeQueryZod>\n\n/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\nexport const isBridgeExposeQuery: ReturnType<typeof zodIsFactory<BridgeExposeQuery>> = zodIsFactory(BridgeExposeQueryZod)\n/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\nexport const asBridgeExposeQuery: ReturnType<typeof zodAsFactory<BridgeExposeQuery>> = zodAsFactory(BridgeExposeQueryZod, 'asBridgeExposeQuery')\n/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\nexport const toBridgeExposeQuery: ReturnType<typeof zodToFactory<BridgeExposeQuery>> = zodToFactory(BridgeExposeQueryZod, 'toBridgeExposeQuery')\n", "import {\n zodAsFactory, zodIsFactory, zodToFactory,\n} from '@ariestools/sdk'\nimport {\n asSchema, PayloadZodOfSchema, QueryFieldsZod,\n} from '@xyo-network/sdk-protocol'\nimport * as z from 'zod/mini'\n\nimport type { BridgeExposeOptions } from './Expose.ts'\n\n/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\nexport const BridgeUnexposeQuerySchema: 'network.xyo.query.bridge.unexpose' & {\n readonly __schema: true\n} = asSchema('network.xyo.query.bridge.unexpose', true)\n/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\nexport type BridgeUnexposeQuerySchema = typeof BridgeUnexposeQuerySchema\n\n/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\nexport interface BridgeUnexposeOptions extends BridgeExposeOptions {}\n\n/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\nexport const BridgeUnexposeQueryZod: z.ZodMiniObject<\n & { schema: z.ZodMiniLiteral<BridgeUnexposeQuerySchema> }\n & (typeof QueryFieldsZod)['shape'],\n z.core.$strip\n> = z.extend(PayloadZodOfSchema(BridgeUnexposeQuerySchema), { ...QueryFieldsZod.shape })\n\n/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\nexport type BridgeUnexposeQuery = z.infer<typeof BridgeUnexposeQueryZod>\n\n/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\nexport const isBridgeUnexposeQuery: ReturnType<typeof zodIsFactory<BridgeUnexposeQuery>> = zodIsFactory(BridgeUnexposeQueryZod)\n/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\nexport const asBridgeUnexposeQuery: ReturnType<typeof zodAsFactory<BridgeUnexposeQuery>> = zodAsFactory(BridgeUnexposeQueryZod, 'asBridgeUnexposeQuery')\n/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\nexport const toBridgeUnexposeQuery: ReturnType<typeof zodToFactory<BridgeUnexposeQuery>> = zodToFactory(BridgeUnexposeQueryZod, 'toBridgeUnexposeQuery')\n", "import type { TypeCheck } from '@ariestools/sdk'\nimport { IsObjectFactory } from '@ariestools/sdk'\n\nimport type { AttachableModuleInstance } from '#module-model'\n\nimport type { BridgeModuleEventData } from '../EventData.ts'\nimport type { BridgeInstance } from '../Instance.ts'\nimport type { BridgeModule } from '../Module.ts'\nimport type { BridgeParams } from '../Params.ts'\n\n/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\nexport interface AttachableBridgeInstance<\n TParams extends BridgeParams = BridgeParams,\n TEventData extends BridgeModuleEventData = BridgeModuleEventData,\n> extends BridgeModule<TParams, TEventData>,\n AttachableModuleInstance<TParams, TEventData>,\n BridgeInstance<TParams, TEventData> {}\n\n/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\nexport type AttachableBridgeInstanceTypeCheck<T extends AttachableBridgeInstance = AttachableBridgeInstance> = TypeCheck<T>\n\n/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\nexport class IsAttachableBridgeInstanceFactory<T extends AttachableBridgeInstance = AttachableBridgeInstance> extends IsObjectFactory<T> {}\n", "import type { EmptyObject, WithAdditional } from '@ariestools/sdk'\nimport {\n zodAsFactory, zodIsFactory, zodToFactory,\n} from '@ariestools/sdk'\nimport type {\n Payload,\n Schema,\n} from '@xyo-network/sdk-protocol'\nimport { asSchema } from '@xyo-network/sdk-protocol'\nimport * as z from 'zod/mini'\n\nimport type { CacheConfig, ModuleConfig } from '#module-model'\nimport { ModuleConfigZod } from '#module-model'\n\n/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\nexport const BridgeConfigSchema: 'network.xyo.bridge.config' & {\n readonly __schema: true\n} = asSchema('network.xyo.bridge.config', true)\n/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\nexport type BridgeConfigSchema = typeof BridgeConfigSchema\n\n/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\nexport interface BridgeClientConfig {\n cache?: CacheConfig | true\n discoverRoots?: 'start' | 'lazy'\n maxDepth?: number\n}\n\n/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\nexport interface BridgeHostConfig {\n cache?: CacheConfig | true\n maxDepth?: number\n}\n\n/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\nexport const BridgeConfigZod: z.ZodMiniObject<\n Omit<(typeof ModuleConfigZod)['shape'], 'schema'> & {\n client: z.ZodMiniOptional<z.ZodMiniCustom<BridgeClientConfig, BridgeClientConfig>>\n host: z.ZodMiniOptional<z.ZodMiniCustom<BridgeHostConfig, BridgeHostConfig>>\n schema: z.ZodMiniLiteral<BridgeConfigSchema>\n },\n z.core.$strip\n> = z.extend(ModuleConfigZod, {\n schema: z.literal(BridgeConfigSchema),\n client: z.optional(z.custom<BridgeClientConfig>()),\n host: z.optional(z.custom<BridgeHostConfig>()),\n})\n\n/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\nexport type BridgeConfigBase = z.infer<typeof BridgeConfigZod>\n\n/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\nexport const isBridgeConfig: ReturnType<typeof zodIsFactory<BridgeConfigBase>> = zodIsFactory(BridgeConfigZod)\n/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\nexport const asBridgeConfig: ReturnType<typeof zodAsFactory<BridgeConfigBase>> = zodAsFactory(BridgeConfigZod, 'asBridgeConfig')\n/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\nexport const toBridgeConfig: ReturnType<typeof zodToFactory<BridgeConfigBase>> = zodToFactory(BridgeConfigZod, 'toBridgeConfig')\n\n/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\nexport type BridgeConfig<\n TConfig extends Payload | EmptyObject | void = void,\n TSchema extends Schema | void = void,\n TClient extends EmptyObject | void = void,\n THost extends EmptyObject | void = void,\n> = ModuleConfig<\n WithAdditional<\n {\n client?: WithAdditional<BridgeClientConfig, TClient>\n host?: WithAdditional<BridgeHostConfig, THost>\n schema: TConfig extends Payload ? TConfig['schema'] : BridgeConfigSchema\n },\n TConfig\n >,\n TSchema\n>\n"],
5
+ "mappings": ";AAAA,SAAS,mBAAAA,wBAAuB;;;ACChC,SAAS,uBAAuB;AAEhC,SAAS,kCAAkC;;;ACH3C,SAAS,uBAAuB;AAEhC;AAAA,EACE;AAAA,EAAmB;AAAA,EAAkB;AAAA,EAA0B;AAAA,OAC1D;;;ACJP;AAAA,EACE;AAAA,EAAc;AAAA,EAAc;AAAA,OACvB;AACP;AAAA,EACE;AAAA,EAAU;AAAA,EAAoB;AAAA,OACzB;AACP,YAAY,OAAO;AAKZ,IAAM,2BAET,SAAS,oCAAoC,IAAI;AAK9C,IAAM,wBAQP,SAAO,mBAAmB,wBAAwB,GAAG;AAAA,EACzD,GAAG,eAAe;AAAA,EAClB,IAAM,WAAW,SAAyB,CAAC;AAAA,EAC3C,UAAY,WAAW,SAAO,CAAC;AACjC,CAAC;AAMM,IAAM,uBAA4E,aAAa,qBAAqB;AAEpH,IAAM,uBAA4E,aAAa,uBAAuB,sBAAsB;AAE5I,IAAM,uBAA4E,aAAa,uBAAuB,sBAAsB;;;ACxCnJ;AAAA,EACE,gBAAAC;AAAA,EAAc,gBAAAC;AAAA,EAAc,gBAAAC;AAAA,OACvB;AACP;AAAA,EACE,YAAAC;AAAA,EAAU,sBAAAC;AAAA,EAAoB,kBAAAC;AAAA,OACzB;AACP,YAAYC,QAAO;AAKZ,IAAM,8BAETH,UAAS,uCAAuC,IAAI;AAKjD,IAAM,2BAQP,UAAOC,oBAAmB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C;AAC/C,CAAC;AAMM,IAAM,iBAAoEF,cAAa,eAAe;AAEtG,IAAM,iBAAoED,cAAa,iBAAiB,gBAAgB;AAExH,IAAM,iBAAoEE,cAAa,iBAAiB,gBAAgB;",
6
6
  "names": ["AsObjectFactory", "zodAsFactory", "zodIsFactory", "zodToFactory", "asSchema", "PayloadZodOfSchema", "QueryFieldsZod", "z", "zodAsFactory", "zodIsFactory", "zodToFactory", "asSchema", "PayloadZodOfSchema", "QueryFieldsZod", "z", "zodAsFactory", "zodIsFactory", "zodToFactory", "asSchema", "PayloadZodOfSchema", "QueryFieldsZod", "z", "AsObjectFactory", "IsObjectFactory", "zodAsFactory", "zodIsFactory", "zodToFactory", "asSchema", "z"]
7
7
  }
@@ -1,3 +1,16 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4
+ var __decorateClass = (decorators, target, key, kind) => {
5
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
6
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
7
+ if (decorator = decorators[i])
8
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
9
+ if (kind && result) __defProp(target, key, result);
10
+ return result;
11
+ };
12
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
13
+
1
14
  // src/modules/bridge-wrapper/BridgeWrapper.ts
2
15
  import {
3
16
  BridgeExposeQuerySchema,
@@ -7,10 +20,7 @@ import {
7
20
  ModuleFilterPayloadSchema
8
21
  } from "#bridge-model";
9
22
  import { constructableModuleWrapper, ModuleWrapper } from "#module-wrapper";
10
- constructableModuleWrapper();
11
23
  var BridgeWrapper = class extends ModuleWrapper {
12
- static instanceIdentityCheck = isBridgeInstance;
13
- static moduleIdentityCheck = isBridgeModule;
14
24
  async expose(id, options) {
15
25
  const filterPayload = {
16
26
  id,
@@ -29,6 +39,11 @@ var BridgeWrapper = class extends ModuleWrapper {
29
39
  return (await this.sendQuery({ schema: BridgeUnexposeQuerySchema }, [filterPayload])).map(({ address }) => address);
30
40
  }
31
41
  };
42
+ __publicField(BridgeWrapper, "instanceIdentityCheck", isBridgeInstance);
43
+ __publicField(BridgeWrapper, "moduleIdentityCheck", isBridgeModule);
44
+ BridgeWrapper = __decorateClass([
45
+ constructableModuleWrapper()
46
+ ], BridgeWrapper);
32
47
  export {
33
48
  BridgeWrapper
34
49
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/modules/bridge-wrapper/BridgeWrapper.ts"],
4
- "sourcesContent": ["import type { TypeCheck } from '@ariestools/sdk'\nimport type { XyoAddress } from '@xyo-network/sdk-protocol'\n\nimport type {\n BridgeConfig,\n BridgeExposeOptions,\n BridgeExposeQuery,\n BridgeInstance,\n BridgeModule,\n BridgeModuleEventData,\n BridgeParams,\n BridgeUnexposeOptions,\n BridgeUnexposeQuery,\n ModuleFilterPayload,\n} from '#bridge-model'\nimport {\n BridgeExposeQuerySchema,\n BridgeUnexposeQuerySchema,\n isBridgeInstance,\n isBridgeModule,\n ModuleFilterPayloadSchema,\n} from '#bridge-model'\nimport type {\n AddressPayload, AnyConfigSchema, ModuleIdentifier, ModuleInstance,\n QueryableModuleTypeCheck,\n} from '#module-model'\nimport { constructableModuleWrapper, ModuleWrapper } from '#module-wrapper'\n\nconstructableModuleWrapper()\nexport class BridgeWrapper<TWrappedModule extends BridgeModule = BridgeModule>\n extends ModuleWrapper<TWrappedModule>\n implements BridgeInstance<TWrappedModule['params']> {\n static override readonly instanceIdentityCheck: TypeCheck<BridgeInstance<BridgeParams<AnyConfigSchema<BridgeConfig<void, void, void, void>>>, BridgeModuleEventData>> = isBridgeInstance\n static override readonly moduleIdentityCheck: QueryableModuleTypeCheck<BridgeModule<BridgeParams<AnyConfigSchema<BridgeConfig<void, void, void, void>>>, BridgeModuleEventData>> = isBridgeModule\n\n async expose(id: ModuleIdentifier, options?: BridgeExposeOptions): Promise<ModuleInstance[]> {\n const filterPayload: ModuleFilterPayload = {\n id, schema: ModuleFilterPayloadSchema, ...options,\n }\n const addresses = (\n await this.sendQuery<BridgeExposeQuery, ModuleFilterPayload, AddressPayload>({ schema: BridgeExposeQuerySchema }, [filterPayload])\n ).map(({ address }) => address)\n return await Promise.all((addresses).map(address => this.resolve(address)))\n }\n\n async unexpose(id: ModuleIdentifier, options?: BridgeUnexposeOptions): Promise<XyoAddress[]> {\n const filterPayload: ModuleFilterPayload = {\n id, schema: ModuleFilterPayloadSchema, ...options,\n }\n return (\n await this.sendQuery<BridgeUnexposeQuery, ModuleFilterPayload, AddressPayload>({ schema: BridgeUnexposeQuerySchema }, [filterPayload])\n ).map(({ address }) => address)\n }\n}\n"],
5
- "mappings": ";AAeA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAKP,SAAS,4BAA4B,qBAAqB;AAE1D,2BAA2B;AACpB,IAAM,gBAAN,cACG,cAC4C;AAAA,EACpD,OAAyB,wBAA+I;AAAA,EACxK,OAAyB,sBAA0J;AAAA,EAEnL,MAAM,OAAO,IAAsB,SAA0D;AAC3F,UAAM,gBAAqC;AAAA,MACzC;AAAA,MAAI,QAAQ;AAAA,MAA2B,GAAG;AAAA,IAC5C;AACA,UAAM,aACJ,MAAM,KAAK,UAAkE,EAAE,QAAQ,wBAAwB,GAAG,CAAC,aAAa,CAAC,GACjI,IAAI,CAAC,EAAE,QAAQ,MAAM,OAAO;AAC9B,WAAO,MAAM,QAAQ,IAAK,UAAW,IAAI,aAAW,KAAK,QAAQ,OAAO,CAAC,CAAC;AAAA,EAC5E;AAAA,EAEA,MAAM,SAAS,IAAsB,SAAwD;AAC3F,UAAM,gBAAqC;AAAA,MACzC;AAAA,MAAI,QAAQ;AAAA,MAA2B,GAAG;AAAA,IAC5C;AACA,YACE,MAAM,KAAK,UAAoE,EAAE,QAAQ,0BAA0B,GAAG,CAAC,aAAa,CAAC,GACrI,IAAI,CAAC,EAAE,QAAQ,MAAM,OAAO;AAAA,EAChC;AACF;",
4
+ "sourcesContent": ["import type { TypeCheck } from '@ariestools/sdk'\nimport type { XyoAddress } from '@xyo-network/sdk-protocol'\n\nimport type {\n BridgeConfig,\n BridgeExposeOptions,\n BridgeExposeQuery,\n BridgeInstance,\n BridgeModule,\n BridgeModuleEventData,\n BridgeParams,\n BridgeUnexposeOptions,\n BridgeUnexposeQuery,\n ModuleFilterPayload,\n} from '#bridge-model'\nimport {\n BridgeExposeQuerySchema,\n BridgeUnexposeQuerySchema,\n isBridgeInstance,\n isBridgeModule,\n ModuleFilterPayloadSchema,\n} from '#bridge-model'\nimport type {\n AddressPayload, AnyConfigSchema, ModuleIdentifier, ModuleInstance,\n QueryableModuleTypeCheck,\n} from '#module-model'\nimport { constructableModuleWrapper, ModuleWrapper } from '#module-wrapper'\n\n/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\n@constructableModuleWrapper()\nexport class BridgeWrapper<TWrappedModule extends BridgeModule = BridgeModule>\n extends ModuleWrapper<TWrappedModule>\n implements BridgeInstance<TWrappedModule['params']> {\n static override readonly instanceIdentityCheck: TypeCheck<BridgeInstance<BridgeParams<AnyConfigSchema<BridgeConfig<void, void, void, void>>>, BridgeModuleEventData>> = isBridgeInstance\n static override readonly moduleIdentityCheck: QueryableModuleTypeCheck<BridgeModule<BridgeParams<AnyConfigSchema<BridgeConfig<void, void, void, void>>>, BridgeModuleEventData>> = isBridgeModule\n\n async expose(id: ModuleIdentifier, options?: BridgeExposeOptions): Promise<ModuleInstance[]> {\n const filterPayload: ModuleFilterPayload = {\n id, schema: ModuleFilterPayloadSchema, ...options,\n }\n const addresses = (\n await this.sendQuery<BridgeExposeQuery, ModuleFilterPayload, AddressPayload>({ schema: BridgeExposeQuerySchema }, [filterPayload])\n ).map(({ address }) => address)\n return await Promise.all((addresses).map(address => this.resolve(address)))\n }\n\n async unexpose(id: ModuleIdentifier, options?: BridgeUnexposeOptions): Promise<XyoAddress[]> {\n const filterPayload: ModuleFilterPayload = {\n id, schema: ModuleFilterPayloadSchema, ...options,\n }\n return (\n await this.sendQuery<BridgeUnexposeQuery, ModuleFilterPayload, AddressPayload>({ schema: BridgeUnexposeQuerySchema }, [filterPayload])\n ).map(({ address }) => address)\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;AAeA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAKP,SAAS,4BAA4B,qBAAqB;AAInD,IAAM,gBAAN,cACG,cAC4C;AAAA,EAIpD,MAAM,OAAO,IAAsB,SAA0D;AAC3F,UAAM,gBAAqC;AAAA,MACzC;AAAA,MAAI,QAAQ;AAAA,MAA2B,GAAG;AAAA,IAC5C;AACA,UAAM,aACJ,MAAM,KAAK,UAAkE,EAAE,QAAQ,wBAAwB,GAAG,CAAC,aAAa,CAAC,GACjI,IAAI,CAAC,EAAE,QAAQ,MAAM,OAAO;AAC9B,WAAO,MAAM,QAAQ,IAAK,UAAW,IAAI,aAAW,KAAK,QAAQ,OAAO,CAAC,CAAC;AAAA,EAC5E;AAAA,EAEA,MAAM,SAAS,IAAsB,SAAwD;AAC3F,UAAM,gBAAqC;AAAA,MACzC;AAAA,MAAI,QAAQ;AAAA,MAA2B,GAAG;AAAA,IAC5C;AACA,YACE,MAAM,KAAK,UAAoE,EAAE,QAAQ,0BAA0B,GAAG,CAAC,aAAa,CAAC,GACrI,IAAI,CAAC,EAAE,QAAQ,MAAM,OAAO;AAAA,EAChC;AACF;AArBE,cAHW,eAGc,yBAA+I;AACxK,cAJW,eAIc,uBAA0J;AAJxK,gBAAN;AAAA,EADN,2BAA2B;AAAA,GACf;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/modules/bridge/index.ts"],
4
- "sourcesContent": ["export * from '#bridge-abstract'\nexport * from '#bridge-model'\nexport * from '#bridge-wrapper'\n"],
5
- "mappings": ";AAAA,cAAc;AACd,cAAc;AACd,cAAc;",
4
+ "sourcesContent": ["/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\nexport * from '#bridge-abstract'\n/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\nexport * from '#bridge-model'\n/** @deprecated The Bridge module concept is deprecated and will be removed in the next major version. */\nexport * from '#bridge-wrapper'\n"],
5
+ "mappings": ";AACA,cAAc;AAEd,cAAc;AAEd,cAAc;",
6
6
  "names": []
7
7
  }
@@ -28,7 +28,8 @@ var delayedResolve = async (parent, id, closure, as = asModuleInstance, timeout
28
28
  if (isDefined(result)) {
29
29
  closure(result);
30
30
  break;
31
- } else if (Date.now() - start > timeout) {
31
+ }
32
+ if (Date.now() - start > timeout) {
32
33
  logger?.error(`Timed out waiting for ${id} to resolve`);
33
34
  closure(null);
34
35
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/modules/diviner-abstract/AbstractDiviner.ts"],
4
- "sourcesContent": ["import type {\n AsTypeFunction, EventUnsubscribeFunction, Logger,\n Promisable, RetryConfig, RetryConfigWithComplete,\n} from '@ariestools/sdk'\nimport {\n assertEx,\n delay,\n forget,\n isDefined, isNull, isUndefined, retry,\n} from '@ariestools/sdk'\nimport type {\n AccountInstance, Payload, QueryBoundWitness,\n Schema, WithoutPrivateStorageMeta,\n} from '@xyo-network/sdk-protocol'\nimport { PayloadBuilder, QueryBoundWitnessWrapper } from '@xyo-network/sdk-protocol'\n\nimport { isArchivistInstance } from '#archivist-model'\nimport type {\n AttachableDivinerInstance,\n DivinerDivineQuery,\n DivinerDivineResult,\n DivinerInstance,\n DivinerModuleEventData,\n DivinerParams,\n DivinerQueries,\n} from '#diviner-model'\nimport {\n DivinerConfigSchema, DivinerDivineQuerySchema, isDivinerInstance,\n} from '#diviner-model'\nimport { AbstractModuleInstance } from '#module-abstract'\nimport {\n asModuleInstance,\n type ModuleConfig, type ModuleIdentifier, type ModuleInstance, type ModuleQueryHandlerResult, type ModuleQueryResult,\n} from '#module-model'\nimport { isWitnessInstance } from '#witness-model'\n\nconst delayedResolve = async <T extends ModuleInstance>(\n parent: ModuleInstance,\n id: ModuleIdentifier,\n closure: (mod: T | null) => void,\n as: AsTypeFunction<T> = asModuleInstance,\n timeout = 30_000,\n logger?: Logger,\n) => {\n const start = Date.now()\n let result: T | undefined\n while (isUndefined(result)) {\n result = as(await parent.resolve(id))\n if (isDefined(result)) {\n closure(result)\n break\n } else if (Date.now() - start > timeout) {\n logger?.error(`Timed out waiting for ${id} to resolve`)\n closure(null)\n }\n await delay(500)\n }\n}\n\nexport abstract class AbstractDiviner<\n TParams extends DivinerParams = DivinerParams,\n TIn extends Payload = Payload,\n TOut extends Payload = Payload,\n TEventData extends DivinerModuleEventData<DivinerInstance<TParams, TIn, TOut>, TIn, TOut> = DivinerModuleEventData<\n DivinerInstance<TParams, TIn, TOut>,\n TIn,\n TOut\n >,\n>\n extends AbstractModuleInstance<TParams, TEventData>\n implements AttachableDivinerInstance<TParams, TIn, TOut, TEventData> {\n static override readonly configSchemas: Schema[] = [...super.configSchemas, DivinerConfigSchema]\n static override readonly defaultConfigSchema: Schema = DivinerConfigSchema\n static readonly targetSchema: Schema\n\n private _eventUnsubscribeFunctions: EventUnsubscribeFunction[] = []\n\n override get queries(): Schema[] {\n return [DivinerDivineQuerySchema, ...super.queries]\n }\n\n /** @function divine The main entry point for a diviner. Do not override this function. Implement/override divineHandler for custom functionality */\n async divine(payloads: TIn[] = [], retryConfigIn?: RetryConfigWithComplete): Promise<DivinerDivineResult<TOut>[]> {\n this._noOverride('divine')\n this.isSupportedQuery(DivinerDivineQuerySchema, 'divine')\n return await this.spanAsync('divine', async () => {\n if (this.reentrancy?.scope === 'global' && this.reentrancy.action === 'skip' && this.globalReentrancyMutex?.isLocked()) {\n return []\n }\n try {\n await this.globalReentrancyMutex?.acquire()\n return await this.busy(async () => {\n const retryConfig = retryConfigIn ?? this.config.retry\n await this.startedAsync('throw')\n await this.emit('divineStart', { inPayloads: payloads, mod: this })\n let outPayloads: TOut[] = []\n const errors: Error[] = []\n try {\n outPayloads = (retryConfig ? await retry(() => this.divineHandler(payloads), retryConfig) : await this.divineHandler(payloads)) ?? []\n } catch (ex) {\n errors.push(ex as Error)\n this.logger?.error(`Error in divineHandler: ${String(ex)}`)\n }\n await this.emit('divineEnd', {\n errors, inPayloads: payloads, mod: this, outPayloads,\n })\n if (errors.length > 0) {\n throw new Error(`Divine failed with ${errors.length} errors: ${errors.map(e => e.message).join(', ')}`)\n }\n return PayloadBuilder.omitPrivateStorageMeta<TOut>(outPayloads)\n })\n } finally {\n this.globalReentrancyMutex?.release()\n }\n }, { timeBudgetLimit: 200 })\n }\n\n async divineQuery(payloads?: TIn[], account?: AccountInstance, _retry?: RetryConfig): Promise<ModuleQueryResult<TOut>> {\n this._noOverride('divineQuery')\n const queryPayload: DivinerDivineQuery = { schema: DivinerDivineQuerySchema }\n return await this.sendQueryRaw(queryPayload, payloads, account)\n }\n\n /** @function queryHandler Calls divine for a divine query. Override to support additional queries. */\n protected override async queryHandler<T extends QueryBoundWitness = QueryBoundWitness, TConfig extends ModuleConfig = ModuleConfig>(\n query: T,\n payloads?: Payload[],\n queryConfig?: TConfig,\n ): Promise<ModuleQueryHandlerResult> {\n const wrapper = QueryBoundWitnessWrapper.parseQuery<DivinerQueries>(query, payloads)\n // remove the query payload\n const cleanPayloads = await PayloadBuilder.filterExclude(payloads, query.query)\n const queryPayload = await wrapper.getQuery()\n assertEx(await this.queryable(query, payloads, queryConfig))\n const resultPayloads: WithoutPrivateStorageMeta<Payload>[] = []\n switch (queryPayload.schema) {\n case DivinerDivineQuerySchema: {\n resultPayloads.push(...(await this.divine(cleanPayloads as TIn[])))\n break\n }\n default: {\n return super.queryHandler(query, payloads)\n }\n }\n return PayloadBuilder.omitPrivateStorageMeta(resultPayloads)\n }\n\n protected override async startHandler(): Promise<void> {\n const { eventSubscriptions = [] } = this.config\n\n for (const subscription of eventSubscriptions) {\n const {\n sourceEvent, sourceModule, targetModuleFunction,\n } = subscription\n if (targetModuleFunction === 'divine') {\n forget(delayedResolve(this, sourceModule, (sourceModuleInstance: ModuleInstance | null) => {\n if (isNull(sourceModuleInstance)) {\n this.logger?.error(`Failed to resolve ${sourceModule} for ${this.modName}`)\n } else {\n if (isArchivistInstance(sourceModuleInstance)) {\n if (sourceEvent === 'inserted') {\n this._eventUnsubscribeFunctions.push(\n sourceModuleInstance.on(sourceEvent, async ({ outPayloads, payloads }) => {\n await this.divine((outPayloads ?? payloads) as Payload[] as TIn[])\n }),\n )\n } else {\n this.logger?.warn(`Unsupported sourceEvent ${sourceEvent} for ${sourceModuleInstance.modName}`)\n }\n } else if (isDivinerInstance(sourceModuleInstance)) {\n if (sourceEvent === 'divineEnd') {\n this._eventUnsubscribeFunctions.push(\n sourceModuleInstance.on(sourceEvent, async ({ outPayloads }) => {\n await this.divine(outPayloads as TIn[])\n }),\n )\n } else {\n this.logger?.warn(`Unsupported sourceEvent ${sourceEvent} for ${sourceModuleInstance.modName}`)\n }\n } else if (isWitnessInstance(sourceModuleInstance)) {\n if (sourceEvent === 'observeEnd') {\n this._eventUnsubscribeFunctions.push(\n sourceModuleInstance.on(sourceEvent, async ({ outPayloads }) => {\n await this.divine(outPayloads! as TIn[])\n }),\n )\n } else {\n this.logger?.warn(`Unsupported sourceEvent ${sourceEvent} for ${sourceModuleInstance.modName}`)\n }\n }\n }\n }, asModuleInstance, undefined, this.logger))\n }\n }\n\n return await super.startHandler()\n }\n\n protected override async stopHandler(): Promise<void> {\n for (const unsubscribe of this._eventUnsubscribeFunctions) {\n unsubscribe()\n }\n this._eventUnsubscribeFunctions = []\n this._eventUnsubscribeFunctions = []\n return await super.stopHandler()\n }\n\n /** @function divineHandler Implement or override to add custom functionality to a diviner */\n protected abstract divineHandler(payloads?: TIn[]): Promisable<TOut[]>\n}\n"],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C9D,0BAAM,KAAK,OAAO,WAAoB;AAAA,kBACxC,CAAC;AAAA,gBACH;AAAA,cACF,OAAO;AACL,qBAAK,QAAQ,KAAK,2BAA2B,WAAW,QAAQ,qBAAqB,OAAO,EAAE;AAAA,cAChG;AAAA,YACF,WAAW,kBAAkB,oBAAoB,GAAG;AAClD,kBAAI,gBAAgB,cAAc;AAChC,qBAAK,2BAA2B;AAAA,kBAC9B,qBAAqB,GAAG,aAAa,OAAO,EAAE,YAAY,MAAM;AAC9D,0BAAM,KAAK,OAAO,WAAqB;AAAA,kBACzC,CAAC;AAAA,gBACH;AAAA,cACF,OAAO;AACL,qBAAK,QAAQ,KAAK,2BAA2B,WAAW,QAAQ,qBAAqB,OAAO,EAAE;AAAA,cAChG;AAAA,YACF;AAAA,UACF;AAAA,QACF,GAAG,kBAAkB,QAAW,KAAK,MAAM,CAAC;AAAA,MAC9C;AAAA,IACF;AAEA,WAAO,MAAM,MAAM,aAAa;AAAA,EAClC;AAAA,EAEA,MAAyB,cAA6B;AACpD,eAAW,eAAe,KAAK,4BAA4B;AACzD,kBAAY;AAAA,IACd;AACA,SAAK,6BAA6B,CAAC;AACnC,SAAK,6BAA6B,CAAC;AACnC,WAAO,MAAM,MAAM,YAAY;AAAA,EACjC;AAIF;",
4
+ "sourcesContent": ["import type {\n AsTypeFunction, EventUnsubscribeFunction, Logger,\n Promisable, RetryConfig, RetryConfigWithComplete,\n} from '@ariestools/sdk'\nimport {\n assertEx,\n delay,\n forget,\n isDefined, isNull, isUndefined, retry,\n} from '@ariestools/sdk'\nimport type {\n AccountInstance, Payload, QueryBoundWitness,\n Schema, WithoutPrivateStorageMeta,\n} from '@xyo-network/sdk-protocol'\nimport { PayloadBuilder, QueryBoundWitnessWrapper } from '@xyo-network/sdk-protocol'\n\nimport { isArchivistInstance } from '#archivist-model'\nimport type {\n AttachableDivinerInstance,\n DivinerDivineQuery,\n DivinerDivineResult,\n DivinerInstance,\n DivinerModuleEventData,\n DivinerParams,\n DivinerQueries,\n} from '#diviner-model'\nimport {\n DivinerConfigSchema, DivinerDivineQuerySchema, isDivinerInstance,\n} from '#diviner-model'\nimport { AbstractModuleInstance } from '#module-abstract'\nimport {\n asModuleInstance,\n type ModuleConfig, type ModuleIdentifier, type ModuleInstance, type ModuleQueryHandlerResult, type ModuleQueryResult,\n} from '#module-model'\nimport { isWitnessInstance } from '#witness-model'\n\nconst delayedResolve = async <T extends ModuleInstance>(\n parent: ModuleInstance,\n id: ModuleIdentifier,\n closure: (mod: T | null) => void,\n as: AsTypeFunction<T> = asModuleInstance,\n timeout = 30_000,\n logger?: Logger,\n) => {\n const start = Date.now()\n let result: T | undefined\n while (isUndefined(result)) {\n result = as(await parent.resolve(id))\n if (isDefined(result)) {\n closure(result)\n break\n }\n if (Date.now() - start > timeout) {\n logger?.error(`Timed out waiting for ${id} to resolve`)\n closure(null)\n }\n await delay(500)\n }\n}\n\nexport abstract class AbstractDiviner<\n TParams extends DivinerParams = DivinerParams,\n TIn extends Payload = Payload,\n TOut extends Payload = Payload,\n TEventData extends DivinerModuleEventData<DivinerInstance<TParams, TIn, TOut>, TIn, TOut> = DivinerModuleEventData<\n DivinerInstance<TParams, TIn, TOut>,\n TIn,\n TOut\n >,\n>\n extends AbstractModuleInstance<TParams, TEventData>\n implements AttachableDivinerInstance<TParams, TIn, TOut, TEventData> {\n static override readonly configSchemas: Schema[] = [...super.configSchemas, DivinerConfigSchema]\n static override readonly defaultConfigSchema: Schema = DivinerConfigSchema\n static readonly targetSchema: Schema\n\n private _eventUnsubscribeFunctions: EventUnsubscribeFunction[] = []\n\n override get queries(): Schema[] {\n return [DivinerDivineQuerySchema, ...super.queries]\n }\n\n /** @function divine The main entry point for a diviner. Do not override this function. Implement/override divineHandler for custom functionality */\n async divine(payloads: TIn[] = [], retryConfigIn?: RetryConfigWithComplete): Promise<DivinerDivineResult<TOut>[]> {\n this._noOverride('divine')\n this.isSupportedQuery(DivinerDivineQuerySchema, 'divine')\n return await this.spanAsync('divine', async () => {\n if (this.reentrancy?.scope === 'global' && this.reentrancy.action === 'skip' && this.globalReentrancyMutex?.isLocked()) {\n return []\n }\n try {\n await this.globalReentrancyMutex?.acquire()\n return await this.busy(async () => {\n const retryConfig = retryConfigIn ?? this.config.retry\n await this.startedAsync('throw')\n await this.emit('divineStart', { inPayloads: payloads, mod: this })\n let outPayloads: TOut[] = []\n const errors: Error[] = []\n try {\n outPayloads = (retryConfig ? await retry(() => this.divineHandler(payloads), retryConfig) : await this.divineHandler(payloads)) ?? []\n } catch (ex) {\n errors.push(ex as Error)\n this.logger?.error(`Error in divineHandler: ${String(ex)}`)\n }\n await this.emit('divineEnd', {\n errors, inPayloads: payloads, mod: this, outPayloads,\n })\n if (errors.length > 0) {\n throw new Error(`Divine failed with ${errors.length} errors: ${errors.map(e => e.message).join(', ')}`)\n }\n return PayloadBuilder.omitPrivateStorageMeta<TOut>(outPayloads)\n })\n } finally {\n this.globalReentrancyMutex?.release()\n }\n }, { timeBudgetLimit: 200 })\n }\n\n async divineQuery(payloads?: TIn[], account?: AccountInstance, _retry?: RetryConfig): Promise<ModuleQueryResult<TOut>> {\n this._noOverride('divineQuery')\n const queryPayload: DivinerDivineQuery = { schema: DivinerDivineQuerySchema }\n return await this.sendQueryRaw(queryPayload, payloads, account)\n }\n\n /** @function queryHandler Calls divine for a divine query. Override to support additional queries. */\n protected override async queryHandler<T extends QueryBoundWitness = QueryBoundWitness, TConfig extends ModuleConfig = ModuleConfig>(\n query: T,\n payloads?: Payload[],\n queryConfig?: TConfig,\n ): Promise<ModuleQueryHandlerResult> {\n const wrapper = QueryBoundWitnessWrapper.parseQuery<DivinerQueries>(query, payloads)\n // remove the query payload\n const cleanPayloads = await PayloadBuilder.filterExclude(payloads, query.query)\n const queryPayload = await wrapper.getQuery()\n assertEx(await this.queryable(query, payloads, queryConfig))\n const resultPayloads: WithoutPrivateStorageMeta<Payload>[] = []\n switch (queryPayload.schema) {\n case DivinerDivineQuerySchema: {\n resultPayloads.push(...(await this.divine(cleanPayloads as TIn[])))\n break\n }\n default: {\n return super.queryHandler(query, payloads)\n }\n }\n return PayloadBuilder.omitPrivateStorageMeta(resultPayloads)\n }\n\n protected override async startHandler(): Promise<void> {\n const { eventSubscriptions = [] } = this.config\n\n for (const subscription of eventSubscriptions) {\n const {\n sourceEvent, sourceModule, targetModuleFunction,\n } = subscription\n if (targetModuleFunction === 'divine') {\n forget(delayedResolve(this, sourceModule, (sourceModuleInstance: ModuleInstance | null) => {\n if (isNull(sourceModuleInstance)) {\n this.logger?.error(`Failed to resolve ${sourceModule} for ${this.modName}`)\n } else {\n if (isArchivistInstance(sourceModuleInstance)) {\n if (sourceEvent === 'inserted') {\n this._eventUnsubscribeFunctions.push(\n sourceModuleInstance.on(sourceEvent, async ({ outPayloads, payloads }) => {\n await this.divine((outPayloads ?? payloads) as Payload[] as TIn[])\n }),\n )\n } else {\n this.logger?.warn(`Unsupported sourceEvent ${sourceEvent} for ${sourceModuleInstance.modName}`)\n }\n } else if (isDivinerInstance(sourceModuleInstance)) {\n if (sourceEvent === 'divineEnd') {\n this._eventUnsubscribeFunctions.push(\n sourceModuleInstance.on(sourceEvent, async ({ outPayloads }) => {\n await this.divine(outPayloads as TIn[])\n }),\n )\n } else {\n this.logger?.warn(`Unsupported sourceEvent ${sourceEvent} for ${sourceModuleInstance.modName}`)\n }\n } else if (isWitnessInstance(sourceModuleInstance)) {\n if (sourceEvent === 'observeEnd') {\n this._eventUnsubscribeFunctions.push(\n sourceModuleInstance.on(sourceEvent, async ({ outPayloads }) => {\n await this.divine(outPayloads! as TIn[])\n }),\n )\n } else {\n this.logger?.warn(`Unsupported sourceEvent ${sourceEvent} for ${sourceModuleInstance.modName}`)\n }\n }\n }\n }, asModuleInstance, undefined, this.logger))\n }\n }\n\n return await super.startHandler()\n }\n\n protected override async stopHandler(): Promise<void> {\n for (const unsubscribe of this._eventUnsubscribeFunctions) {\n unsubscribe()\n }\n this._eventUnsubscribeFunctions = []\n this._eventUnsubscribeFunctions = []\n return await super.stopHandler()\n }\n\n /** @function divineHandler Implement or override to add custom functionality to a diviner */\n protected abstract divineHandler(payloads?: TIn[]): Promisable<TOut[]>\n}\n"],
5
+ "mappings": ";AAIA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAAW;AAAA,EAAQ;AAAA,EAAa;AAAA,OAC3B;AAKP,SAAS,gBAAgB,gCAAgC;AAEzD,SAAS,2BAA2B;AAUpC;AAAA,EACE;AAAA,EAAqB;AAAA,EAA0B;AAAA,OAC1C;AACP,SAAS,8BAA8B;AACvC;AAAA,EACE;AAAA,OAEK;AACP,SAAS,yBAAyB;AAElC,IAAM,iBAAiB,OACrB,QACA,IACA,SACA,KAAwB,kBACxB,UAAU,KACV,WACG;AACH,QAAM,QAAQ,KAAK,IAAI;AACvB,MAAI;AACJ,SAAO,YAAY,MAAM,GAAG;AAC1B,aAAS,GAAG,MAAM,OAAO,QAAQ,EAAE,CAAC;AACpC,QAAI,UAAU,MAAM,GAAG;AACrB,cAAQ,MAAM;AACd;AAAA,IACF;AACA,QAAI,KAAK,IAAI,IAAI,QAAQ,SAAS;AAChC,cAAQ,MAAM,yBAAyB,EAAE,aAAa;AACtD,cAAQ,IAAI;AAAA,IACd;AACA,UAAM,MAAM,GAAG;AAAA,EACjB;AACF;AAEO,IAAe,kBAAf,cAUG,uBAC6D;AAAA,EACrE,OAAyB,gBAA0B,CAAC,GAAG,MAAM,eAAe,mBAAmB;AAAA,EAC/F,OAAyB,sBAA8B;AAAA,EACvD,OAAgB;AAAA,EAER,6BAAyD,CAAC;AAAA,EAElE,IAAa,UAAoB;AAC/B,WAAO,CAAC,0BAA0B,GAAG,MAAM,OAAO;AAAA,EACpD;AAAA;AAAA,EAGA,MAAM,OAAO,WAAkB,CAAC,GAAG,eAA+E;AAChH,SAAK,YAAY,QAAQ;AACzB,SAAK,iBAAiB,0BAA0B,QAAQ;AACxD,WAAO,MAAM,KAAK,UAAU,UAAU,YAAY;AAChD,UAAI,KAA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AAClD,kBAAI,gBAAgB,aAAa;AAC/B,qBAAK,2BAA2B;AAAA,kBAC9B,qBAAqB,GAAG,aAAa,OAAO,EAAE,YAAY,MAAM;AAC9D,0BAAM,KAAK,OAAO,WAAoB;AAAA,kBACxC,CAAC;AAAA,gBACH;AAAA,cACF,OAAO;AACL,qBAAK,QAAQ,KAAK,2BAA2B,WAAW,QAAQ,qBAAqB,OAAO,EAAE;AAAA,cAChG;AAAA,YACF,WAAW,kBAAkB,oBAAoB,GAAG;AAClD,kBAAI,gBAAgB,cAAc;AAChC,qBAAK,2BAA2B;AAAA,kBAC9B,qBAAqB,GAAG,aAAa,OAAO,EAAE,YAAY,MAAM;AAC9D,0BAAM,KAAK,OAAO,WAAqB;AAAA,kBACzC,CAAC;AAAA,gBACH;AAAA,cACF,OAAO;AACL,qBAAK,QAAQ,KAAK,2BAA2B,WAAW,QAAQ,qBAAqB,OAAO,EAAE;AAAA,cAChG;AAAA,YACF;AAAA,UACF;AAAA,QACF,GAAG,kBAAkB,QAAW,KAAK,MAAM,CAAC;AAAA,MAC9C;AAAA,IACF;AAEA,WAAO,MAAM,MAAM,aAAa;AAAA,EAClC;AAAA,EAEA,MAAyB,cAA6B;AACpD,eAAW,eAAe,KAAK,4BAA4B;AACzD,kBAAY;AAAA,IACd;AACA,SAAK,6BAA6B,CAAC;AACnC,SAAK,6BAA6B,CAAC;AACnC,WAAO,MAAM,MAAM,YAAY;AAAA,EACjC;AAIF;",
6
6
  "names": []
7
7
  }
@@ -33,8 +33,10 @@ var asDivinerDivineQuery = zodAsFactory(DivinerDivineQueryZod, "asDivinerDivineQ
33
33
  var toDivinerDivineQuery = zodToFactory(DivinerDivineQueryZod, "toDivinerDivineQuery");
34
34
 
35
35
  // src/modules/diviner-model/typeChecks.ts
36
- var isDivinerInstance = new IsInstanceFactory().create({ divine: "function" }, [isModuleInstance]);
37
- var isDivinerModule = new IsQueryableModuleFactory().create([DivinerDivineQuerySchema]);
36
+ var isInstanceFactory = new IsInstanceFactory();
37
+ var isDivinerInstance = isInstanceFactory.create({ divine: "function" }, [isModuleInstance]);
38
+ var isQueryableModuleFactory = new IsQueryableModuleFactory();
39
+ var isDivinerModule = isQueryableModuleFactory.create([DivinerDivineQuerySchema]);
38
40
  var asDivinerModule = AsObjectFactory.create(isDivinerModule);
39
41
  var asDivinerInstance = AsObjectFactory.create(isDivinerInstance);
40
42
  var withDivinerModule = WithFactory.create(isDivinerModule);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/modules/diviner-model/attachable/asAttachableInstance.ts", "../../src/modules/diviner-model/attachable/isAttachableInstance.ts", "../../src/modules/diviner-model/typeChecks.ts", "../../src/modules/diviner-model/Queries/Divine.ts", "../../src/modules/diviner-model/attachable/AttachableInstance.ts", "../../src/modules/diviner-model/Config.ts"],
4
- "sourcesContent": ["import { AsObjectFactory } from '@ariestools/sdk'\n\nimport { isAttachableDivinerInstance } from './isAttachableInstance.ts'\n\nexport const asAttachableDivinerInstance = AsObjectFactory.create(isAttachableDivinerInstance)\n", "import type { ObjectTypeShape, TypeCheck } from '@ariestools/sdk'\nimport { IsObjectFactory } from '@ariestools/sdk'\n\nimport { isAttachableModuleInstance } from '#module-model'\n\nimport { isDivinerInstance } from '../typeChecks.ts'\nimport type { AttachableDivinerInstance } from './AttachableInstance.ts'\n\nexport const requiredAttachableDivinerInstanceFunctions: ObjectTypeShape = {}\n\n// we do not use IsInstanceFactory here to prevent a cycle\nconst factory = new IsObjectFactory<AttachableDivinerInstance>()\n\nexport const isAttachableDivinerInstance: TypeCheck<AttachableDivinerInstance> = factory.create(requiredAttachableDivinerInstanceFunctions, [\n isDivinerInstance,\n isAttachableModuleInstance,\n])\n", "import type { TypeCheck } from '@ariestools/sdk'\nimport { AsObjectFactory } from '@ariestools/sdk'\n\nimport {\n IsInstanceFactory, isModuleInstance, IsQueryableModuleFactory, WithFactory,\n} from '#module-model'\n\nimport type { DivinerInstance } from './Instance.ts'\nimport type { DivinerModule } from './Module.ts'\nimport { DivinerDivineQuerySchema } from './Queries/index.ts'\n\nexport const isDivinerInstance: TypeCheck<DivinerInstance> = new IsInstanceFactory<DivinerInstance>().create({ divine: 'function' }, [isModuleInstance])\nexport const isDivinerModule: TypeCheck<DivinerModule> = new IsQueryableModuleFactory<DivinerModule>().create([DivinerDivineQuerySchema])\n\nexport const asDivinerModule = AsObjectFactory.create(isDivinerModule)\nexport const asDivinerInstance = AsObjectFactory.create(isDivinerInstance)\n\n/** @deprecated use narrowing instead [ if(is) ] */\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nexport const withDivinerModule = WithFactory.create(isDivinerModule)\n/** @deprecated use narrowing instead [ if(is) ] */\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nexport const withDivinerInstance = WithFactory.create(isDivinerInstance)\n", "import {\n zodAsFactory, zodIsFactory, zodToFactory,\n} from '@ariestools/sdk'\nimport {\n asSchema, PayloadZodOfSchema, QueryFieldsZod,\n} from '@xyo-network/sdk-protocol'\nimport * as z from 'zod/mini'\n\nexport const DivinerDivineQuerySchema: 'network.xyo.query.diviner.divine' & {\n readonly __schema: true\n} = asSchema('network.xyo.query.diviner.divine', true)\nexport type DivinerDivineQuerySchema = typeof DivinerDivineQuerySchema\n\nexport const DivinerDivineQueryZod: z.ZodMiniObject<\n & { schema: z.ZodMiniLiteral<DivinerDivineQuerySchema> }\n & (typeof QueryFieldsZod)['shape'],\n z.core.$strip\n> = z.extend(PayloadZodOfSchema(DivinerDivineQuerySchema), { ...QueryFieldsZod.shape })\n\nexport type DivinerDivineQuery = z.infer<typeof DivinerDivineQueryZod>\n\nexport const isDivinerDivineQuery: ReturnType<typeof zodIsFactory<DivinerDivineQuery>> = zodIsFactory(DivinerDivineQueryZod)\nexport const asDivinerDivineQuery: ReturnType<typeof zodAsFactory<DivinerDivineQuery>> = zodAsFactory(DivinerDivineQueryZod, 'asDivinerDivineQuery')\nexport const toDivinerDivineQuery: ReturnType<typeof zodToFactory<DivinerDivineQuery>> = zodToFactory(DivinerDivineQueryZod, 'toDivinerDivineQuery')\n", "import type { TypeCheck } from '@ariestools/sdk'\nimport { IsObjectFactory } from '@ariestools/sdk'\nimport type { Payload } from '@xyo-network/sdk-protocol'\n\nimport type { AttachableModuleInstance } from '#module-model'\n\nimport type { DivinerModuleEventData } from '../EventData.ts'\nimport type { DivinerInstance } from '../Instance.ts'\nimport type { DivinerParams } from '../Params.ts'\n\nexport interface AttachableDivinerInstance<\n TParams extends DivinerParams = DivinerParams,\n TIn extends Payload = Payload,\n TOut extends Payload = Payload,\n TEventData extends DivinerModuleEventData = DivinerModuleEventData,\n> extends DivinerInstance<TParams, TIn, TOut, TEventData>,\n AttachableModuleInstance<TParams, TEventData> {}\n\nexport type AttachableDivinerInstanceTypeCheck<T extends AttachableDivinerInstance = AttachableDivinerInstance> = TypeCheck<T>\n\nexport class IsAttachableDivinerInstanceFactory<T extends AttachableDivinerInstance = AttachableDivinerInstance> extends IsObjectFactory<T> {}\n", "import type { EmptyObject, WithAdditional } from '@ariestools/sdk'\nimport {\n zodAsFactory, zodIsFactory, zodToFactory,\n} from '@ariestools/sdk'\nimport {\n asSchema, type Payload, type Schema,\n} from '@xyo-network/sdk-protocol'\nimport * as z from 'zod/mini'\n\nimport type { ModuleConfig, ModuleIdentifier } from '#module-model'\nimport { ModuleConfigZod } from '#module-model'\n\nexport const DivinerConfigSchema: 'network.xyo.diviner.config' & {\n readonly __schema: true\n} = asSchema('network.xyo.diviner.config', true)\nexport type DivinerConfigSchema = typeof DivinerConfigSchema\n\nexport interface ModuleEventSubscription {\n sourceEvent: string\n sourceModule: ModuleIdentifier\n targetModuleFunction?: string\n}\n\nexport const DivinerConfigZod: z.ZodMiniObject<\n Omit<(typeof ModuleConfigZod)['shape'], 'schema'> & {\n eventSubscriptions: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniCustom<ModuleEventSubscription, ModuleEventSubscription>>>\n schema: z.ZodMiniLiteral<DivinerConfigSchema>\n },\n z.core.$strip\n> = z.extend(ModuleConfigZod, {\n eventSubscriptions: z.optional(z.array(z.custom<ModuleEventSubscription>())),\n schema: z.literal(DivinerConfigSchema),\n})\n\nexport type DivinerConfigBase = z.infer<typeof DivinerConfigZod>\n\nexport const isDivinerConfig: ReturnType<typeof zodIsFactory<DivinerConfigBase>> = zodIsFactory(DivinerConfigZod)\nexport const asDivinerConfig: ReturnType<typeof zodAsFactory<DivinerConfigBase>> = zodAsFactory(DivinerConfigZod, 'asDivinerConfig')\nexport const toDivinerConfig: ReturnType<typeof zodToFactory<DivinerConfigBase>> = zodToFactory(DivinerConfigZod, 'toDivinerConfig')\n\nexport type DivinerConfig<TConfig extends Payload | EmptyObject | void = void, TSchema extends Schema | void = void> = ModuleConfig<\n WithAdditional<\n {\n eventSubscriptions?: ModuleEventSubscription[]\n },\n Omit<TConfig, 'schema'>\n >,\n TSchema extends Schema ? TSchema : TConfig extends Payload ? TConfig['schema'] : DivinerConfigSchema\n>\n"],
5
- "mappings": ";AAAA,SAAS,mBAAAA,wBAAuB;;;ACChC,SAAS,uBAAuB;AAEhC,SAAS,kCAAkC;;;ACF3C,SAAS,uBAAuB;AAEhC;AAAA,EACE;AAAA,EAAmB;AAAA,EAAkB;AAAA,EAA0B;AAAA,OAC1D;;;ACLP;AAAA,EACE;AAAA,EAAc;AAAA,EAAc;AAAA,OACvB;AACP;AAAA,EACE;AAAA,EAAU;AAAA,EAAoB;AAAA,OACzB;AACP,YAAY,OAAO;AAEZ,IAAM,2BAET,SAAS,oCAAoC,IAAI;AAG9C,IAAM,wBAIP,SAAO,mBAAmB,wBAAwB,GAAG,EAAE,GAAG,eAAe,MAAM,CAAC;AAI/E,IAAM,uBAA4E,aAAa,qBAAqB;AACpH,IAAM,uBAA4E,aAAa,uBAAuB,sBAAsB;AAC5I,IAAM,uBAA4E,aAAa,uBAAuB,sBAAsB;;;ADZ5I,IAAM,oBAAgD,IAAI,kBAAmC,EAAE,OAAO,EAAE,QAAQ,WAAW,GAAG,CAAC,gBAAgB,CAAC;AAChJ,IAAM,kBAA4C,IAAI,yBAAwC,EAAE,OAAO,CAAC,wBAAwB,CAAC;AAEjI,IAAM,kBAAkB,gBAAgB,OAAO,eAAe;AAC9D,IAAM,oBAAoB,gBAAgB,OAAO,iBAAiB;AAIlE,IAAM,oBAAoB,YAAY,OAAO,eAAe;AAG5D,IAAM,sBAAsB,YAAY,OAAO,iBAAiB;;;ADdhE,IAAM,6CAA8D,CAAC;AAG5E,IAAM,UAAU,IAAI,gBAA2C;AAExD,IAAM,8BAAoE,QAAQ,OAAO,4CAA4C;AAAA,EAC1I;AAAA,EACA;AACF,CAAC;;;ADZM,IAAM,8BAA8BC,iBAAgB,OAAO,2BAA2B;;;AIH7F,SAAS,mBAAAC,wBAAuB;AAmBzB,IAAM,qCAAN,cAAkHA,iBAAmB;AAAC;;;ACnB7I;AAAA,EACE,gBAAAC;AAAA,EAAc,gBAAAC;AAAA,EAAc,gBAAAC;AAAA,OACvB;AACP;AAAA,EACE,YAAAC;AAAA,OACK;AACP,YAAYC,QAAO;AAGnB,SAAS,uBAAuB;AAEzB,IAAM,sBAETD,UAAS,8BAA8B,IAAI;AASxC,IAAM,mBAMP,UAAO,iBAAiB;AAAA,EAC5B,oBAAsB,YAAW,SAAQ,UAAgC,CAAC,CAAC;AAAA,EAC3E,QAAU,WAAQ,mBAAmB;AACvC,CAAC;AAIM,IAAM,kBAAsEF,cAAa,gBAAgB;AACzG,IAAM,kBAAsED,cAAa,kBAAkB,iBAAiB;AAC5H,IAAM,kBAAsEE,cAAa,kBAAkB,iBAAiB;",
4
+ "sourcesContent": ["import { AsObjectFactory } from '@ariestools/sdk'\n\nimport { isAttachableDivinerInstance } from './isAttachableInstance.ts'\n\nexport const asAttachableDivinerInstance = AsObjectFactory.create(isAttachableDivinerInstance)\n", "import type { ObjectTypeShape, TypeCheck } from '@ariestools/sdk'\nimport { IsObjectFactory } from '@ariestools/sdk'\n\nimport { isAttachableModuleInstance } from '#module-model'\n\nimport { isDivinerInstance } from '../typeChecks.ts'\nimport type { AttachableDivinerInstance } from './AttachableInstance.ts'\n\nexport const requiredAttachableDivinerInstanceFunctions: ObjectTypeShape = {}\n\n// we do not use IsInstanceFactory here to prevent a cycle\nconst factory = new IsObjectFactory<AttachableDivinerInstance>()\n\nexport const isAttachableDivinerInstance: TypeCheck<AttachableDivinerInstance> = factory.create(requiredAttachableDivinerInstanceFunctions, [\n isDivinerInstance,\n isAttachableModuleInstance,\n])\n", "import type { TypeCheck } from '@ariestools/sdk'\nimport { AsObjectFactory } from '@ariestools/sdk'\n\nimport {\n IsInstanceFactory, isModuleInstance, IsQueryableModuleFactory, WithFactory,\n} from '#module-model'\n\nimport type { DivinerInstance } from './Instance.ts'\nimport type { DivinerModule } from './Module.ts'\nimport { DivinerDivineQuerySchema } from './Queries/index.ts'\n\nconst isInstanceFactory = new IsInstanceFactory<DivinerInstance>()\nexport const isDivinerInstance: TypeCheck<DivinerInstance> = isInstanceFactory.create({ divine: 'function' }, [isModuleInstance])\nconst isQueryableModuleFactory = new IsQueryableModuleFactory<DivinerModule>()\nexport const isDivinerModule: TypeCheck<DivinerModule> = isQueryableModuleFactory.create([DivinerDivineQuerySchema])\n\nexport const asDivinerModule = AsObjectFactory.create(isDivinerModule)\nexport const asDivinerInstance = AsObjectFactory.create(isDivinerInstance)\n\n/** @deprecated use narrowing instead [ if(is) ] */\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nexport const withDivinerModule = WithFactory.create(isDivinerModule)\n/** @deprecated use narrowing instead [ if(is) ] */\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nexport const withDivinerInstance = WithFactory.create(isDivinerInstance)\n", "import {\n zodAsFactory, zodIsFactory, zodToFactory,\n} from '@ariestools/sdk'\nimport {\n asSchema, PayloadZodOfSchema, QueryFieldsZod,\n} from '@xyo-network/sdk-protocol'\nimport * as z from 'zod/mini'\n\nexport const DivinerDivineQuerySchema: 'network.xyo.query.diviner.divine' & {\n readonly __schema: true\n} = asSchema('network.xyo.query.diviner.divine', true)\nexport type DivinerDivineQuerySchema = typeof DivinerDivineQuerySchema\n\nexport const DivinerDivineQueryZod: z.ZodMiniObject<\n & { schema: z.ZodMiniLiteral<DivinerDivineQuerySchema> }\n & (typeof QueryFieldsZod)['shape'],\n z.core.$strip\n> = z.extend(PayloadZodOfSchema(DivinerDivineQuerySchema), { ...QueryFieldsZod.shape })\n\nexport type DivinerDivineQuery = z.infer<typeof DivinerDivineQueryZod>\n\nexport const isDivinerDivineQuery: ReturnType<typeof zodIsFactory<DivinerDivineQuery>> = zodIsFactory(DivinerDivineQueryZod)\nexport const asDivinerDivineQuery: ReturnType<typeof zodAsFactory<DivinerDivineQuery>> = zodAsFactory(DivinerDivineQueryZod, 'asDivinerDivineQuery')\nexport const toDivinerDivineQuery: ReturnType<typeof zodToFactory<DivinerDivineQuery>> = zodToFactory(DivinerDivineQueryZod, 'toDivinerDivineQuery')\n", "import type { TypeCheck } from '@ariestools/sdk'\nimport { IsObjectFactory } from '@ariestools/sdk'\nimport type { Payload } from '@xyo-network/sdk-protocol'\n\nimport type { AttachableModuleInstance } from '#module-model'\n\nimport type { DivinerModuleEventData } from '../EventData.ts'\nimport type { DivinerInstance } from '../Instance.ts'\nimport type { DivinerParams } from '../Params.ts'\n\nexport interface AttachableDivinerInstance<\n TParams extends DivinerParams = DivinerParams,\n TIn extends Payload = Payload,\n TOut extends Payload = Payload,\n TEventData extends DivinerModuleEventData = DivinerModuleEventData,\n> extends DivinerInstance<TParams, TIn, TOut, TEventData>,\n AttachableModuleInstance<TParams, TEventData> {}\n\nexport type AttachableDivinerInstanceTypeCheck<T extends AttachableDivinerInstance = AttachableDivinerInstance> = TypeCheck<T>\n\nexport class IsAttachableDivinerInstanceFactory<T extends AttachableDivinerInstance = AttachableDivinerInstance> extends IsObjectFactory<T> {}\n", "import type { EmptyObject, WithAdditional } from '@ariestools/sdk'\nimport {\n zodAsFactory, zodIsFactory, zodToFactory,\n} from '@ariestools/sdk'\nimport {\n asSchema, type Payload, type Schema,\n} from '@xyo-network/sdk-protocol'\nimport * as z from 'zod/mini'\n\nimport type { ModuleConfig, ModuleIdentifier } from '#module-model'\nimport { ModuleConfigZod } from '#module-model'\n\nexport const DivinerConfigSchema: 'network.xyo.diviner.config' & {\n readonly __schema: true\n} = asSchema('network.xyo.diviner.config', true)\nexport type DivinerConfigSchema = typeof DivinerConfigSchema\n\nexport interface ModuleEventSubscription {\n sourceEvent: string\n sourceModule: ModuleIdentifier\n targetModuleFunction?: string\n}\n\nexport const DivinerConfigZod: z.ZodMiniObject<\n Omit<(typeof ModuleConfigZod)['shape'], 'schema'> & {\n eventSubscriptions: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniCustom<ModuleEventSubscription, ModuleEventSubscription>>>\n schema: z.ZodMiniLiteral<DivinerConfigSchema>\n },\n z.core.$strip\n> = z.extend(ModuleConfigZod, {\n eventSubscriptions: z.optional(z.array(z.custom<ModuleEventSubscription>())),\n schema: z.literal(DivinerConfigSchema),\n})\n\nexport type DivinerConfigBase = z.infer<typeof DivinerConfigZod>\n\nexport const isDivinerConfig: ReturnType<typeof zodIsFactory<DivinerConfigBase>> = zodIsFactory(DivinerConfigZod)\nexport const asDivinerConfig: ReturnType<typeof zodAsFactory<DivinerConfigBase>> = zodAsFactory(DivinerConfigZod, 'asDivinerConfig')\nexport const toDivinerConfig: ReturnType<typeof zodToFactory<DivinerConfigBase>> = zodToFactory(DivinerConfigZod, 'toDivinerConfig')\n\nexport type DivinerConfig<TConfig extends Payload | EmptyObject | void = void, TSchema extends Schema | void = void> = ModuleConfig<\n WithAdditional<\n {\n eventSubscriptions?: ModuleEventSubscription[]\n },\n Omit<TConfig, 'schema'>\n >,\n TSchema extends Schema ? TSchema : TConfig extends Payload ? TConfig['schema'] : DivinerConfigSchema\n>\n"],
5
+ "mappings": ";AAAA,SAAS,mBAAAA,wBAAuB;;;ACChC,SAAS,uBAAuB;AAEhC,SAAS,kCAAkC;;;ACF3C,SAAS,uBAAuB;A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uBAAuB;AAEzB,IAAM,sBAETD,UAAS,8BAA8B,IAAI;AASxC,IAAM,mBAMP,UAAO,iBAAiB;AAAA,EAC5B,oBAAsB,YAAW,SAAQ,UAAgC,CAAC,CAAC;AAAA,EAC3E,QAAU,WAAQ,mBAAmB;AACvC,CAAC;AAIM,IAAM,kBAAsEF,cAAa,gBAAgB;AACzG,IAAM,kBAAsED,cAAa,kBAAkB,iBAAiB;AAC5H,IAAM,kBAAsEE,cAAa,kBAAkB,iBAAiB;",
6
6
  "names": ["AsObjectFactory", "AsObjectFactory", "IsObjectFactory", "zodAsFactory", "zodIsFactory", "zodToFactory", "asSchema", "z"]
7
7
  }
@@ -110,9 +110,8 @@ var GenericPayloadDiviner = class extends PayloadDiviner {
110
110
  }
111
111
  }
112
112
  return limit ? all.slice(0, limit) : all;
113
- } else {
114
- throw new Error('Archivist does not support "all"');
115
113
  }
114
+ throw new Error('Archivist does not support "all"');
116
115
  }
117
116
  onArchivistCleared = () => {
118
117
  forget(
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/modules/diviner-payload-generic/Diviner.ts"],
4
- "sourcesContent": ["import type { EventListener, Hex } from '@ariestools/sdk'\nimport {\n assertEx, filterAs, forget,\n zodAsFactory, zodIsFactory, zodToFactory,\n} from '@ariestools/sdk'\nimport { PayloadBuilder } from '@xyo-network/sdk-protocol'\nimport {\n asSchema,\n type Payload, type Schema,\n type Sequence,\n type WithStorageMeta,\n} from '@xyo-network/sdk-protocol'\nimport { Mutex } from 'async-mutex'\nimport * as z from 'zod/mini'\n\nimport type { ArchivistInstance, ArchivistModuleEventData } from '#archivist-model'\nimport type { DivinerInstance, DivinerModuleEventData } from '#diviner-model'\nimport { PayloadDiviner } from '#diviner-payload-abstract'\nimport type {\n Order,\n PayloadDivinerConfig,\n PayloadDivinerParams,\n PayloadDivinerQueryPayload,\n} from '#diviner-payload-model'\nimport { asPayloadDivinerQueryPayload, PayloadDivinerConfigZod } from '#diviner-payload-model'\nimport { creatableModule } from '#module-model'\n\nconst DEFAULT_INDEX_BATCH_SIZE = 100 as const\nconst DEFAULT_MAX_INDEX_SIZE = 8000 as const\n\nexport const GenericPayloadDivinerConfigSchema: 'network.xyo.diviner.payload.generic.config' & {\n readonly __schema: true\n} = asSchema('network.xyo.diviner.payload.generic.config', true)\nexport type GenericPayloadDivinerConfigSchema = typeof GenericPayloadDivinerConfigSchema\n\nexport const GenericPayloadDivinerConfigZod: z.ZodMiniObject<\n Omit<(typeof PayloadDivinerConfigZod)['shape'], 'schema'> & {\n indexes: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>\n schema: z.ZodMiniLiteral<GenericPayloadDivinerConfigSchema>\n },\n z.core.$strip\n> = z.extend(PayloadDivinerConfigZod, {\n indexes: z.optional(z.array(z.string())),\n schema: z.literal(GenericPayloadDivinerConfigSchema),\n})\n\nexport type GenericPayloadDivinerConfigBase = z.infer<typeof GenericPayloadDivinerConfigZod>\n\nexport const isGenericPayloadDivinerConfig: ReturnType<typeof zodIsFactory<GenericPayloadDivinerConfigBase>> = zodIsFactory(GenericPayloadDivinerConfigZod)\nexport const asGenericPayloadDivinerConfig: ReturnType<typeof zodAsFactory<GenericPayloadDivinerConfigBase>> = zodAsFactory(GenericPayloadDivinerConfigZod, 'asGenericPayloadDivinerConfig')\nexport const toGenericPayloadDivinerConfig: ReturnType<typeof zodToFactory<GenericPayloadDivinerConfigBase>> = zodToFactory(GenericPayloadDivinerConfigZod, 'toGenericPayloadDivinerConfig')\n\nexport type GenericPayloadDivinerConfig = PayloadDivinerConfig<\n {\n indexes?: string[]\n },\n GenericPayloadDivinerConfigSchema\n>\n\n@creatableModule()\nexport class GenericPayloadDiviner<\n TParams extends PayloadDivinerParams<GenericPayloadDivinerConfig> = PayloadDivinerParams<GenericPayloadDivinerConfig>,\n TIn extends PayloadDivinerQueryPayload = PayloadDivinerQueryPayload,\n TOut extends WithStorageMeta<Payload> = WithStorageMeta<Payload>,\n TEventData extends DivinerModuleEventData<DivinerInstance<TParams, TIn, TOut>, TIn, TOut> = DivinerModuleEventData<\n DivinerInstance<TParams, TIn, TOut>,\n TIn,\n TOut\n >,\n> extends PayloadDiviner<TParams, TIn, TOut, TEventData> {\n static override readonly configSchemas: Schema[] = [...super.configSchemas, GenericPayloadDivinerConfigSchema]\n static override readonly defaultConfigSchema: Schema = GenericPayloadDivinerConfigSchema\n\n protected indexMaps: Record<string, WithStorageMeta<TOut>[]> = {}\n protected payloadsWithMeta: WithStorageMeta<TOut>[] = []\n\n private _archivistInstance?: ArchivistInstance\n private _cursor?: Sequence\n private _updatePayloadPairsMutex = new Mutex()\n\n protected get indexBatchSize(): number {\n return this.config.indexBatchSize ?? DEFAULT_INDEX_BATCH_SIZE\n }\n\n protected get indexes(): string[] {\n return ['schema', ...(this.config.indexes ?? [])]\n }\n\n protected get maxIndexSize(): number {\n return this.config.maxIndexSize ?? DEFAULT_MAX_INDEX_SIZE\n }\n\n protected all(order: Order = 'desc', cursor?: Hex): WithStorageMeta<TOut>[] {\n const payloads = this.payloadsWithMeta.toSorted(PayloadBuilder.compareStorageMeta)\n if (order === 'desc') payloads.reverse()\n const startIndex = (cursor ? (payloads.findIndex(payload => payload._sequence === cursor) ?? -1) : -1) + 1\n return payloads.slice(startIndex)\n }\n\n protected override async archivistInstance(): Promise<ArchivistInstance | undefined>\n protected override async archivistInstance(required: true): Promise<ArchivistInstance>\n protected override async archivistInstance(required = false): Promise<ArchivistInstance | undefined> {\n if (!this._archivistInstance) {\n const archivist = await super.archivistInstance()\n if (required && !archivist) {\n throw new Error('Failed to find archivist')\n }\n archivist?.on('inserted', this.onArchivistInserted)\n archivist?.on('cleared', this.onArchivistCleared)\n archivist?.on('deleted', this.onArchivistDeleted)\n this._archivistInstance = archivist\n }\n return this._archivistInstance\n }\n\n protected async clearIndex(): Promise<void> {\n await this._updatePayloadPairsMutex.runExclusive(() => {\n this._cursor = undefined\n this.payloadsWithMeta = []\n this.indexMaps = {}\n })\n }\n\n protected override async divineHandler(payloads?: TIn[]): Promise<TOut[]> {\n const filters = filterAs(payloads ?? [], asPayloadDivinerQueryPayload)\n assertEx(filters.length < 2, () => 'Multiple PayloadDivinerQuery payloads may not be specified')\n const filter = assertEx(filters.shift(), () => 'No PayloadDivinerQuery specified')\n await this.updateIndex()\n\n const {\n\n schema, schemas, order, limit, cursor, ...props\n } = filter\n let all: TOut[] = this.all(order, cursor)\n if (all) {\n if (schemas?.length) all = all.filter(payload => schemas.includes(payload.schema))\n if (Object.keys(props).length > 0) {\n const additionalFilterCriteria = Object.entries(props)\n for (const [prop, filter] of additionalFilterCriteria) {\n const property = prop as keyof TOut\n all\n = Array.isArray(filter)\n ? all.filter(payload =>\n filter.every((value) => {\n const prop = payload?.[property]\n // TODO: This seems to be written just to check arrays, and now that $meta is there, need to check type?\n return Array.isArray(prop) && prop.includes?.(value)\n }))\n : all.filter(payload => payload?.[property] === filter)\n }\n }\n return limit ? all.slice(0, limit) : all\n } else {\n throw new Error('Archivist does not support \"all\"')\n }\n }\n\n protected onArchivistCleared: EventListener<ArchivistModuleEventData['cleared']> = () => {\n forget(\n (async () => {\n await this.clearIndex()\n await this.updateIndex()\n })(),\n )\n }\n\n // we are just rebuilding the entire index at this point on delete since large archivists do not support delete\n protected onArchivistDeleted: EventListener<ArchivistModuleEventData['deleted']> = () => {\n forget(\n (async () => {\n await this.clearIndex()\n await this.updateIndex()\n })(),\n )\n }\n\n protected onArchivistInserted: EventListener<ArchivistModuleEventData['inserted']> = () => {\n forget(this.updateIndex())\n }\n\n protected override async stopHandler(_timeout?: number): Promise<void> {\n await super.stopHandler()\n const archivist = await this.archivistInstance(true)\n archivist.off('inserted', this.onArchivistInserted)\n archivist.off('deleted', this.onArchivistDeleted)\n archivist.off('cleared', this.onArchivistCleared)\n }\n\n // index any new payloads\n protected async updateIndex(): Promise<void> {\n await this._updatePayloadPairsMutex.runExclusive(async () => {\n const archivist = await this.archivistInstance(true)\n let newPayloads = await archivist.next({ limit: 100, cursor: this._cursor }) as TOut[]\n while (newPayloads.length > 0) {\n this._cursor = newPayloads.at(-1)?._sequence\n assertEx(this.payloadsWithMeta.length + newPayloads.length <= this.maxIndexSize, () => 'maxIndexSize exceeded')\n this.indexPayloads(newPayloads)\n newPayloads = await archivist.next({ limit: 100, cursor: this._cursor }) as TOut[]\n }\n })\n }\n\n private indexPayloads(payloads: WithStorageMeta<TOut>[]): Hex {\n this.payloadsWithMeta.push(...payloads)\n\n // update the custom indexes\n for (const index of this.indexes ?? []) {\n this.indexMaps[index] = this.indexMaps[index] ?? []\n for (const payload of payloads) {\n this.indexMaps[index].push(payload)\n }\n }\n return assertEx(payloads.at(-1), () => 'No payloads to index')._sequence\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;AACA;AAAA,EACE;AAAA,EAAU;AAAA,EAAU;AAAA,EACpB;AAAA,EAAc;AAAA,EAAc;AAAA,OACvB;AACP,SAAS,sBAAsB;AAC/B;AAAA,EACE;AAAA,OAIK;AACP,SAAS,aAAa;AACtB,YAAY,OAAO;AAInB,SAAS,sBAAsB;AAO/B,SAAS,8BAA8B,+BAA+B;AACtE,SAAS,uBAAuB;AAEhC,IAAM,2BAA2B;AACjC,IAAM,yBAAyB;AAExB,IAAM,oCAET,SAAS,8CAA8C,IAAI;AAGxD,IAAM,iCAMP,SAAO,yBAAyB;AAAA,EACpC,SAAW,WAAW,QAAQ,SAAO,CAAC,CAAC;AAAA,EACvC,QAAU,UAAQ,iCAAiC;AACrD,CAAC;AAIM,IAAM,gCAAkG,aAAa,8BAA8B;AACnJ,IAAM,gCAAkG,aAAa,gCAAgC,+BAA+B;AACpL,IAAM,gCAAkG,aAAa,gCAAgC,+BAA+B;AAUpL,IAAM,wBAAN,cASG,eAA+C;AAAA,EAI7C,YAAqD,CAAC;AAAA,EACtD,mBAA4C,CAAC;AAAA,EAE/C;AAAA,EACA;AAAA,EACA,2BAA2B,IAAI,MAAM;AAAA,EAE7C,IAAc,iBAAyB;AACrC,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AAI,YAAY,KAAK,mBAAmB;AAClD,cAAU,IAAI,WAAW,KAAK,kBAAkB;AAChD,cAAU,IAAI,WAAW,KAAK,kBAAkB;AAAA,EAClD;AAAA;AAAA,EAGA,MAAgB,cAA6B;AAC3C,UAAM,KAAK,yBAAyB,aAAa,YAAY;AAC3D,YAAM,YAAY,MAAM,KAAK,kBAAkB,IAAI;AACnD,UAAI,cAAc,MAAM,UAAU,KAAK,EAAE,OAAO,KAAK,QAAQ,KAAK,QAAQ,CAAC;AAC3E,aAAO,YAAY,SAAS,GAAG;AAC7B,aAAK,UAAU,YAAY,GAAG,EAAE,GAAG;AACnC,iBAAS,KAAK,iBAAiB,SAAS,YAAY,UAAU,KAAK,cAAc,MAAM,uBAAuB;AAC9G,aAAK,cAAc,WAAW;AAC9B,sBAAc,MAAM,UAAU,KAAK,EAAE,OAAO,KAAK,QAAQ,KAAK,QAAQ,CAAC;AAAA,MACzE;AAAA,IACF,CAAC;AAAA,EACH;AAAA,EAEQ,cAAc,UAAwC;AAC5D,SAAK,iBAAiB,KAAK,GAAG,QAAQ;AAGtC,eAAW,SAAS,KAAK,WAAW,CAAC,GAAG;AACtC,WAAK,UAAU,KAAK,IAAI,KAAK,UAAU,KAAK,KAAK,CAAC;AAClD,iBAAW,WAAW,UAAU;AAC9B,aAAK,UAAU,KAAK,EAAE,KAAK,OAAO;AAAA,MACpC;AAAA,IACF;AACA,WAAO,SAAS,SAAS,GAAG,EAAE,GAAG,MAAM,sBAAsB,EAAE;AAAA,EACjE;AACF;AAhJE,cAVW,uBAUc,iBAA0B,CAAC,GAAG,yDAAM,kBAAe,iCAAiC;AAC7G,cAXW,uBAWc,uBAA8B;AAX5C,wBAAN;AAAA,EADN,gBAAgB;AAAA,GACJ;",
4
+ "sourcesContent": ["import type { EventListener, Hex } from '@ariestools/sdk'\nimport {\n assertEx, filterAs, forget,\n zodAsFactory, zodIsFactory, zodToFactory,\n} from '@ariestools/sdk'\nimport { PayloadBuilder } from '@xyo-network/sdk-protocol'\nimport {\n asSchema,\n type Payload, type Schema,\n type Sequence,\n type WithStorageMeta,\n} from '@xyo-network/sdk-protocol'\nimport { Mutex } from 'async-mutex'\nimport * as z from 'zod/mini'\n\nimport type { ArchivistInstance, ArchivistModuleEventData } from '#archivist-model'\nimport type { DivinerInstance, DivinerModuleEventData } from '#diviner-model'\nimport { PayloadDiviner } from '#diviner-payload-abstract'\nimport type {\n Order,\n PayloadDivinerConfig,\n PayloadDivinerParams,\n PayloadDivinerQueryPayload,\n} from '#diviner-payload-model'\nimport { asPayloadDivinerQueryPayload, PayloadDivinerConfigZod } from '#diviner-payload-model'\nimport { creatableModule } from '#module-model'\n\nconst DEFAULT_INDEX_BATCH_SIZE = 100 as const\nconst DEFAULT_MAX_INDEX_SIZE = 8000 as const\n\nexport const GenericPayloadDivinerConfigSchema: 'network.xyo.diviner.payload.generic.config' & {\n readonly __schema: true\n} = asSchema('network.xyo.diviner.payload.generic.config', true)\nexport type GenericPayloadDivinerConfigSchema = typeof GenericPayloadDivinerConfigSchema\n\nexport const GenericPayloadDivinerConfigZod: z.ZodMiniObject<\n Omit<(typeof PayloadDivinerConfigZod)['shape'], 'schema'> & {\n indexes: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>\n schema: z.ZodMiniLiteral<GenericPayloadDivinerConfigSchema>\n },\n z.core.$strip\n> = z.extend(PayloadDivinerConfigZod, {\n indexes: z.optional(z.array(z.string())),\n schema: z.literal(GenericPayloadDivinerConfigSchema),\n})\n\nexport type GenericPayloadDivinerConfigBase = z.infer<typeof GenericPayloadDivinerConfigZod>\n\nexport const isGenericPayloadDivinerConfig: ReturnType<typeof zodIsFactory<GenericPayloadDivinerConfigBase>> = zodIsFactory(GenericPayloadDivinerConfigZod)\nexport const asGenericPayloadDivinerConfig: ReturnType<typeof zodAsFactory<GenericPayloadDivinerConfigBase>> = zodAsFactory(GenericPayloadDivinerConfigZod, 'asGenericPayloadDivinerConfig')\nexport const toGenericPayloadDivinerConfig: ReturnType<typeof zodToFactory<GenericPayloadDivinerConfigBase>> = zodToFactory(GenericPayloadDivinerConfigZod, 'toGenericPayloadDivinerConfig')\n\nexport type GenericPayloadDivinerConfig = PayloadDivinerConfig<\n {\n indexes?: string[]\n },\n GenericPayloadDivinerConfigSchema\n>\n\n@creatableModule()\nexport class GenericPayloadDiviner<\n TParams extends PayloadDivinerParams<GenericPayloadDivinerConfig> = PayloadDivinerParams<GenericPayloadDivinerConfig>,\n TIn extends PayloadDivinerQueryPayload = PayloadDivinerQueryPayload,\n TOut extends WithStorageMeta<Payload> = WithStorageMeta<Payload>,\n TEventData extends DivinerModuleEventData<DivinerInstance<TParams, TIn, TOut>, TIn, TOut> = DivinerModuleEventData<\n DivinerInstance<TParams, TIn, TOut>,\n TIn,\n TOut\n >,\n> extends PayloadDiviner<TParams, TIn, TOut, TEventData> {\n static override readonly configSchemas: Schema[] = [...super.configSchemas, GenericPayloadDivinerConfigSchema]\n static override readonly defaultConfigSchema: Schema = GenericPayloadDivinerConfigSchema\n\n protected indexMaps: Record<string, WithStorageMeta<TOut>[]> = {}\n protected payloadsWithMeta: WithStorageMeta<TOut>[] = []\n\n private _archivistInstance?: ArchivistInstance\n private _cursor?: Sequence\n private _updatePayloadPairsMutex = new Mutex()\n\n protected get indexBatchSize(): number {\n return this.config.indexBatchSize ?? DEFAULT_INDEX_BATCH_SIZE\n }\n\n protected get indexes(): string[] {\n return ['schema', ...(this.config.indexes ?? [])]\n }\n\n protected get maxIndexSize(): number {\n return this.config.maxIndexSize ?? DEFAULT_MAX_INDEX_SIZE\n }\n\n protected all(order: Order = 'desc', cursor?: Hex): WithStorageMeta<TOut>[] {\n const payloads = this.payloadsWithMeta.toSorted(PayloadBuilder.compareStorageMeta)\n if (order === 'desc') payloads.reverse()\n const startIndex = (cursor ? (payloads.findIndex(payload => payload._sequence === cursor) ?? -1) : -1) + 1\n return payloads.slice(startIndex)\n }\n\n protected override async archivistInstance(): Promise<ArchivistInstance | undefined>\n protected override async archivistInstance(required: true): Promise<ArchivistInstance>\n protected override async archivistInstance(required = false): Promise<ArchivistInstance | undefined> {\n if (!this._archivistInstance) {\n const archivist = await super.archivistInstance()\n if (required && !archivist) {\n throw new Error('Failed to find archivist')\n }\n archivist?.on('inserted', this.onArchivistInserted)\n archivist?.on('cleared', this.onArchivistCleared)\n archivist?.on('deleted', this.onArchivistDeleted)\n this._archivistInstance = archivist\n }\n return this._archivistInstance\n }\n\n protected async clearIndex(): Promise<void> {\n await this._updatePayloadPairsMutex.runExclusive(() => {\n this._cursor = undefined\n this.payloadsWithMeta = []\n this.indexMaps = {}\n })\n }\n\n protected override async divineHandler(payloads?: TIn[]): Promise<TOut[]> {\n const filters = filterAs(payloads ?? [], asPayloadDivinerQueryPayload)\n assertEx(filters.length < 2, () => 'Multiple PayloadDivinerQuery payloads may not be specified')\n const filter = assertEx(filters.shift(), () => 'No PayloadDivinerQuery specified')\n await this.updateIndex()\n\n const {\n\n schema, schemas, order, limit, cursor, ...props\n } = filter\n let all: TOut[] = this.all(order, cursor)\n if (all) {\n if (schemas?.length) all = all.filter(payload => schemas.includes(payload.schema))\n if (Object.keys(props).length > 0) {\n const additionalFilterCriteria = Object.entries(props)\n for (const [prop, filter] of additionalFilterCriteria) {\n const property = prop as keyof TOut\n all\n = Array.isArray(filter)\n ? all.filter(payload =>\n filter.every((value) => {\n const prop = payload?.[property]\n // TODO: This seems to be written just to check arrays, and now that $meta is there, need to check type?\n return Array.isArray(prop) && prop.includes?.(value)\n }))\n : all.filter(payload => payload?.[property] === filter)\n }\n }\n return limit ? all.slice(0, limit) : all\n }\n throw new Error('Archivist does not support \"all\"')\n }\n\n protected onArchivistCleared: EventListener<ArchivistModuleEventData['cleared']> = () => {\n forget(\n (async () => {\n await this.clearIndex()\n await this.updateIndex()\n })(),\n )\n }\n\n // we are just rebuilding the entire index at this point on delete since large archivists do not support delete\n protected onArchivistDeleted: EventListener<ArchivistModuleEventData['deleted']> = () => {\n forget(\n (async () => {\n await this.clearIndex()\n await this.updateIndex()\n })(),\n )\n }\n\n protected onArchivistInserted: EventListener<ArchivistModuleEventData['inserted']> = () => {\n forget(this.updateIndex())\n }\n\n protected override async stopHandler(_timeout?: number): Promise<void> {\n await super.stopHandler()\n const archivist = await this.archivistInstance(true)\n archivist.off('inserted', this.onArchivistInserted)\n archivist.off('deleted', this.onArchivistDeleted)\n archivist.off('cleared', this.onArchivistCleared)\n }\n\n // index any new payloads\n protected async updateIndex(): Promise<void> {\n await this._updatePayloadPairsMutex.runExclusive(async () => {\n const archivist = await this.archivistInstance(true)\n let newPayloads = await archivist.next({ limit: 100, cursor: this._cursor }) as TOut[]\n while (newPayloads.length > 0) {\n this._cursor = newPayloads.at(-1)?._sequence\n assertEx(this.payloadsWithMeta.length + newPayloads.length <= this.maxIndexSize, () => 'maxIndexSize exceeded')\n this.indexPayloads(newPayloads)\n newPayloads = await archivist.next({ limit: 100, cursor: this._cursor }) as TOut[]\n }\n })\n }\n\n private indexPayloads(payloads: WithStorageMeta<TOut>[]): Hex {\n this.payloadsWithMeta.push(...payloads)\n\n // update the custom indexes\n for (const index of this.indexes ?? []) {\n this.indexMaps[index] = this.indexMaps[index] ?? []\n for (const payload of payloads) {\n this.indexMaps[index].push(payload)\n }\n }\n return assertEx(payloads.at(-1), () => 'No payloads to index')._sequence\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AACA;AAAA,EACE;AAAA,EAAU;AAAA,EAAU;AAAA,EACpB;AAAA,EAAc;AAAA,EAAc;AAAA,OACvB;AACP,SAAS,sBAAsB;AAC/B;AAAA,EACE;AAAA,OAIK;AACP,SAAS,aAAa;AACtB,YAAY,OAAO;AAInB,SAAS,sBAAsB;AAO/B,SAAS,8BAA8B,+BAA+B;AACtE,SAAS,uBAAuB;AAEhC,IAAM,2BAA2B;AACjC,IAAM,yBAAyB;AAExB,IAAM,oCAET,SAAS,8CAA8C,IAAI;AAGxD,IAAM,iCAMP,SAAO,yBAAyB;AAAA,EACpC,SAAW,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