@xyo-network/os-runtime 7.2.0 → 7.3.0

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 (303) hide show
  1. package/dist/neutral/Caller.d.ts +18 -20
  2. package/dist/neutral/Caller.d.ts.map +1 -1
  3. package/dist/neutral/DappCallerBase.d.ts +2 -2
  4. package/dist/neutral/DappCallerBase.d.ts.map +1 -1
  5. package/dist/neutral/OsCallerBase.d.ts +2 -2
  6. package/dist/neutral/PubSubBridgeCaller.d.ts +1 -1
  7. package/dist/neutral/PubSubBridgeCaller.d.ts.map +1 -1
  8. package/dist/neutral/RunningDappCache.d.ts.map +1 -1
  9. package/dist/neutral/XyOs.d.ts +5 -6
  10. package/dist/neutral/XyOs.d.ts.map +1 -1
  11. package/dist/neutral/XyOsBase.d.ts +124 -7
  12. package/dist/neutral/XyOsBase.d.ts.map +1 -1
  13. package/dist/neutral/XyOsDapp.d.ts +3 -3
  14. package/dist/neutral/XyOsDapp.d.ts.map +1 -1
  15. package/dist/neutral/access/Caller.d.ts +2 -2
  16. package/dist/neutral/access/Caller.d.ts.map +1 -1
  17. package/dist/neutral/access/RunningAccessDappCache.d.ts.map +1 -1
  18. package/dist/neutral/access/interfaces/registered-names/helpers/resource/AbstractXnsCaller.d.ts +1 -1
  19. package/dist/neutral/adapter/Base.d.ts +2 -2
  20. package/dist/neutral/adapter/Base.d.ts.map +1 -1
  21. package/dist/neutral/classes/lib/DappCreatorParams.d.ts +3 -3
  22. package/dist/neutral/classes/lib/DappCreatorParams.d.ts.map +1 -1
  23. package/dist/neutral/classes/lib/Insertable.d.ts +1 -3
  24. package/dist/neutral/classes/lib/Insertable.d.ts.map +1 -1
  25. package/dist/neutral/classes/menu/Caller.d.ts +1 -2
  26. package/dist/neutral/classes/menu/Caller.d.ts.map +1 -1
  27. package/dist/neutral/classes/settings/Caller.d.ts +2 -2
  28. package/dist/neutral/classes/settings/CallerBase.d.ts +1 -1
  29. package/dist/neutral/classes/settings/SettingsQueries.d.ts.map +1 -1
  30. package/dist/neutral/classes/settings/badge/Caller.d.ts +2 -2
  31. package/dist/neutral/classes/settings/badge/Resource.d.ts +1 -1
  32. package/dist/neutral/classes/settings/badge/Resource.d.ts.map +1 -1
  33. package/dist/neutral/dapp/context/creator/Creator.d.ts +1 -1
  34. package/dist/neutral/dapp/context/creator/Creator.d.ts.map +1 -1
  35. package/dist/neutral/dapp/context/creator/createDappContext.d.ts.map +1 -1
  36. package/dist/neutral/event/bus/Connection.d.ts +3 -4
  37. package/dist/neutral/event/bus/Connection.d.ts.map +1 -1
  38. package/dist/neutral/event/bus/EventBus.d.ts +1 -1
  39. package/dist/neutral/event/bus/EventBus.d.ts.map +1 -1
  40. package/dist/neutral/event/bus/PubSubConnection.d.ts +1 -1
  41. package/dist/neutral/helpers/monitor/XyOsMonitor.d.ts +2 -2
  42. package/dist/neutral/helpers/monitor/XyOsMonitor.d.ts.map +1 -1
  43. package/dist/neutral/helpers/monitor/types.d.ts +3 -3
  44. package/dist/neutral/helpers/monitor/types.d.ts.map +1 -1
  45. package/dist/neutral/index.mjs +1042 -694
  46. package/dist/neutral/index.mjs.map +1 -1
  47. package/dist/neutral/intent/Caller.d.ts +5 -5
  48. package/dist/neutral/lib/Listener.d.ts +1 -1
  49. package/dist/neutral/lib/Listener.d.ts.map +1 -1
  50. package/dist/neutral/lib/PayloadStore.d.ts +1 -2
  51. package/dist/neutral/lib/PayloadStore.d.ts.map +1 -1
  52. package/dist/neutral/lib/isPayload.d.ts +1 -1
  53. package/dist/neutral/loadOsNode.d.ts.map +1 -1
  54. package/dist/neutral/profileModuleEvents.d.ts +2 -4
  55. package/dist/neutral/profileModuleEvents.d.ts.map +1 -1
  56. package/dist/neutral/registration/DappRegistrationService.d.ts +3 -3
  57. package/dist/neutral/registration/DappRegistrationService.d.ts.map +1 -1
  58. package/dist/neutral/registration/DappRegistry.d.ts +4 -6
  59. package/dist/neutral/registration/DappRegistry.d.ts.map +1 -1
  60. package/dist/neutral/registration/ValidateDappAccessDiviner/Config.d.ts +7 -3
  61. package/dist/neutral/registration/ValidateDappAccessDiviner/Config.d.ts.map +1 -1
  62. package/dist/neutral/registration/ValidateDappAccessDiviner/Diviner.d.ts +3 -1
  63. package/dist/neutral/registration/ValidateDappAccessDiviner/Diviner.d.ts.map +1 -1
  64. package/dist/neutral/scripts/xyos/lib/headless.d.ts.map +1 -1
  65. package/dist/neutral/signer/Signers.d.ts.map +1 -1
  66. package/dist/neutral/stack/Base.d.ts +2 -2
  67. package/dist/neutral/stack/Base.d.ts.map +1 -1
  68. package/dist/neutral/stack/Manager.d.ts +2 -6
  69. package/dist/neutral/stack/Manager.d.ts.map +1 -1
  70. package/dist/neutral/system/ManageSystemDapps.d.ts +3 -3
  71. package/dist/neutral/system/ManageSystemDapps.d.ts.map +1 -1
  72. package/dist/neutral/utils/buildWalletSeedPhrasePayload.d.ts +1 -1
  73. package/dist/neutral/utils/buildWalletSeedPhrasePayload.d.ts.map +1 -1
  74. package/dist/neutral/wallet/SeedPhraseRepository.d.ts +3 -4
  75. package/dist/neutral/wallet/SeedPhraseRepository.d.ts.map +1 -1
  76. package/dist/node/Caller.d.ts +18 -20
  77. package/dist/node/Caller.d.ts.map +1 -1
  78. package/dist/node/DappCallerBase.d.ts +2 -2
  79. package/dist/node/DappCallerBase.d.ts.map +1 -1
  80. package/dist/node/OsCallerBase.d.ts +2 -2
  81. package/dist/node/PubSubBridgeCaller.d.ts +1 -1
  82. package/dist/node/PubSubBridgeCaller.d.ts.map +1 -1
  83. package/dist/node/RunningDappCache.d.ts.map +1 -1
  84. package/dist/node/XyOs.d.ts +5 -6
  85. package/dist/node/XyOs.d.ts.map +1 -1
  86. package/dist/node/XyOsBase.d.ts +124 -7
  87. package/dist/node/XyOsBase.d.ts.map +1 -1
  88. package/dist/node/XyOsDapp.d.ts +3 -3
  89. package/dist/node/XyOsDapp.d.ts.map +1 -1
  90. package/dist/node/access/Caller.d.ts +2 -2
  91. package/dist/node/access/Caller.d.ts.map +1 -1
  92. package/dist/node/access/RunningAccessDappCache.d.ts.map +1 -1
  93. package/dist/node/access/interfaces/registered-names/helpers/resource/AbstractXnsCaller.d.ts +1 -1
  94. package/dist/node/adapter/Base.d.ts +2 -2
  95. package/dist/node/adapter/Base.d.ts.map +1 -1
  96. package/dist/node/classes/lib/DappCreatorParams.d.ts +3 -3
  97. package/dist/node/classes/lib/DappCreatorParams.d.ts.map +1 -1
  98. package/dist/node/classes/lib/Insertable.d.ts +1 -3
  99. package/dist/node/classes/lib/Insertable.d.ts.map +1 -1
  100. package/dist/node/classes/menu/Caller.d.ts +1 -2
  101. package/dist/node/classes/menu/Caller.d.ts.map +1 -1
  102. package/dist/node/classes/settings/Caller.d.ts +2 -2
  103. package/dist/node/classes/settings/CallerBase.d.ts +1 -1
  104. package/dist/node/classes/settings/SettingsQueries.d.ts.map +1 -1
  105. package/dist/node/classes/settings/badge/Caller.d.ts +2 -2
  106. package/dist/node/classes/settings/badge/Resource.d.ts +1 -1
  107. package/dist/node/classes/settings/badge/Resource.d.ts.map +1 -1
  108. package/dist/node/dapp/context/creator/Creator.d.ts +1 -1
  109. package/dist/node/dapp/context/creator/Creator.d.ts.map +1 -1
  110. package/dist/node/dapp/context/creator/createDappContext.d.ts.map +1 -1
  111. package/dist/node/event/bus/Connection.d.ts +3 -4
  112. package/dist/node/event/bus/Connection.d.ts.map +1 -1
  113. package/dist/node/event/bus/EventBus.d.ts +1 -1
  114. package/dist/node/event/bus/EventBus.d.ts.map +1 -1
  115. package/dist/node/event/bus/PubSubConnection.d.ts +1 -1
  116. package/dist/node/helpers/monitor/XyOsMonitor.d.ts +2 -2
  117. package/dist/node/helpers/monitor/XyOsMonitor.d.ts.map +1 -1
  118. package/dist/node/helpers/monitor/types.d.ts +3 -3
  119. package/dist/node/helpers/monitor/types.d.ts.map +1 -1
  120. package/dist/node/index.mjs +1042 -694
  121. package/dist/node/index.mjs.map +1 -1
  122. package/dist/node/intent/Caller.d.ts +5 -5
  123. package/dist/node/lib/Listener.d.ts +1 -1
  124. package/dist/node/lib/Listener.d.ts.map +1 -1
  125. package/dist/node/lib/PayloadStore.d.ts +1 -2
  126. package/dist/node/lib/PayloadStore.d.ts.map +1 -1
  127. package/dist/node/lib/isPayload.d.ts +1 -1
  128. package/dist/node/loadOsNode.d.ts.map +1 -1
  129. package/dist/node/profileModuleEvents.d.ts +2 -4
  130. package/dist/node/profileModuleEvents.d.ts.map +1 -1
  131. package/dist/node/registration/DappRegistrationService.d.ts +3 -3
  132. package/dist/node/registration/DappRegistrationService.d.ts.map +1 -1
  133. package/dist/node/registration/DappRegistry.d.ts +4 -6
  134. package/dist/node/registration/DappRegistry.d.ts.map +1 -1
  135. package/dist/node/registration/ValidateDappAccessDiviner/Config.d.ts +7 -3
  136. package/dist/node/registration/ValidateDappAccessDiviner/Config.d.ts.map +1 -1
  137. package/dist/node/registration/ValidateDappAccessDiviner/Diviner.d.ts +3 -1
  138. package/dist/node/registration/ValidateDappAccessDiviner/Diviner.d.ts.map +1 -1
  139. package/dist/node/scripts/xyos/index.mjs +520 -384
  140. package/dist/node/scripts/xyos/index.mjs.map +1 -1
  141. package/dist/node/scripts/xyos/lib/headless.d.ts.map +1 -1
  142. package/dist/node/signer/Signers.d.ts.map +1 -1
  143. package/dist/node/stack/Base.d.ts +2 -2
  144. package/dist/node/stack/Base.d.ts.map +1 -1
  145. package/dist/node/stack/Manager.d.ts +2 -6
  146. package/dist/node/stack/Manager.d.ts.map +1 -1
  147. package/dist/node/system/ManageSystemDapps.d.ts +3 -3
  148. package/dist/node/system/ManageSystemDapps.d.ts.map +1 -1
  149. package/dist/node/utils/buildWalletSeedPhrasePayload.d.ts +1 -1
  150. package/dist/node/utils/buildWalletSeedPhrasePayload.d.ts.map +1 -1
  151. package/dist/node/wallet/SeedPhraseRepository.d.ts +3 -4
  152. package/dist/node/wallet/SeedPhraseRepository.d.ts.map +1 -1
  153. package/package.json +165 -55
  154. package/dist/neutral/signer/Signer.spec.d.ts +0 -2
  155. package/dist/neutral/signer/Signer.spec.d.ts.map +0 -1
  156. package/dist/neutral/spec/boot.spec.d.ts +0 -2
  157. package/dist/neutral/spec/boot.spec.d.ts.map +0 -1
  158. package/dist/node/signer/Signer.spec.d.ts +0 -2
  159. package/dist/node/signer/Signer.spec.d.ts.map +0 -1
  160. package/dist/node/spec/boot.spec.d.ts +0 -2
  161. package/dist/node/spec/boot.spec.d.ts.map +0 -1
  162. package/src/Caller.ts +0 -202
  163. package/src/DappCallerBase.ts +0 -56
  164. package/src/DefaultsQueries.ts +0 -27
  165. package/src/OsCallerBase.ts +0 -59
  166. package/src/PubSubBridgeCaller.ts +0 -33
  167. package/src/RunningDappCache.ts +0 -58
  168. package/src/XyOs.ts +0 -166
  169. package/src/XyOsBase.ts +0 -136
  170. package/src/XyOsDapp.ts +0 -103
  171. package/src/access/Caller.ts +0 -85
  172. package/src/access/Queries.ts +0 -38
  173. package/src/access/Resource.ts +0 -65
  174. package/src/access/RunningAccessDappCache.ts +0 -21
  175. package/src/access/index.ts +0 -4
  176. package/src/access/interfaces/index.ts +0 -1
  177. package/src/access/interfaces/registered-names/helpers/AccessNodeQueries.ts +0 -68
  178. package/src/access/interfaces/registered-names/helpers/index.ts +0 -2
  179. package/src/access/interfaces/registered-names/helpers/resource/AbstractXnsCaller.ts +0 -42
  180. package/src/access/interfaces/registered-names/helpers/resource/RegistrationsResource.ts +0 -52
  181. package/src/access/interfaces/registered-names/helpers/resource/RegistrationsResourceQueries.ts +0 -23
  182. package/src/access/interfaces/registered-names/helpers/resource/index.ts +0 -3
  183. package/src/access/interfaces/registered-names/index.ts +0 -1
  184. package/src/adapter/Base.ts +0 -104
  185. package/src/adapter/Network.ts +0 -31
  186. package/src/adapter/Settings.ts +0 -30
  187. package/src/adapter/index.ts +0 -2
  188. package/src/adapters/OsPubSubBridgeNetwork.ts +0 -10
  189. package/src/adapters/OsSettings.ts +0 -7
  190. package/src/adapters/OsXyoPublicNetwork.ts +0 -9
  191. package/src/adapters/index.ts +0 -3
  192. package/src/classes/dapp/DefaultsResource.ts +0 -67
  193. package/src/classes/dapp/index.ts +0 -1
  194. package/src/classes/index.ts +0 -4
  195. package/src/classes/lib/DappCreatorParams.ts +0 -18
  196. package/src/classes/lib/Insertable.ts +0 -10
  197. package/src/classes/lib/index.ts +0 -2
  198. package/src/classes/menu/Caller.ts +0 -77
  199. package/src/classes/menu/Queries.ts +0 -60
  200. package/src/classes/menu/Resource.ts +0 -105
  201. package/src/classes/menu/index.ts +0 -2
  202. package/src/classes/settings/Caller.ts +0 -78
  203. package/src/classes/settings/CallerBase.ts +0 -27
  204. package/src/classes/settings/Resource.ts +0 -81
  205. package/src/classes/settings/SettingsQueries.ts +0 -56
  206. package/src/classes/settings/badge/Caller.ts +0 -30
  207. package/src/classes/settings/badge/Queries.ts +0 -19
  208. package/src/classes/settings/badge/Resource.ts +0 -50
  209. package/src/classes/settings/badge/index.ts +0 -2
  210. package/src/classes/settings/index.ts +0 -5
  211. package/src/dapp/context/creator/Creator.ts +0 -122
  212. package/src/dapp/context/creator/DefaultPayloads/DappAccessPayloads.ts +0 -20
  213. package/src/dapp/context/creator/DefaultPayloads/DefaultPayloads.ts +0 -40
  214. package/src/dapp/context/creator/DefaultPayloads/NodeInfoPayload.ts +0 -33
  215. package/src/dapp/context/creator/DefaultPayloads/index.ts +0 -1
  216. package/src/dapp/context/creator/ExternalModulePermissions/ExternalModulePermissions.ts +0 -59
  217. package/src/dapp/context/creator/ExternalModulePermissions/index.ts +0 -1
  218. package/src/dapp/context/creator/createDappContext.ts +0 -61
  219. package/src/dapp/context/creator/index.ts +0 -3
  220. package/src/dapp/context/index.ts +0 -1
  221. package/src/dapp/index.ts +0 -1
  222. package/src/event/bus/Connection.ts +0 -33
  223. package/src/event/bus/EventBus.ts +0 -159
  224. package/src/event/bus/PubSubConnection.ts +0 -28
  225. package/src/event/bus/index.ts +0 -3
  226. package/src/event/connections/DappAccessRequest.ts +0 -11
  227. package/src/event/connections/DappsReady.ts +0 -9
  228. package/src/event/connections/ExposeDappRequest.ts +0 -11
  229. package/src/event/connections/OsPubSubNetworkReady.ts +0 -12
  230. package/src/event/connections/OsSettingsReady.ts +0 -12
  231. package/src/event/connections/OsXyoPublicReady.ts +0 -12
  232. package/src/event/connections/index.ts +0 -6
  233. package/src/event/index.ts +0 -2
  234. package/src/helpers/index.ts +0 -1
  235. package/src/helpers/monitor/XyOsMonitor.ts +0 -52
  236. package/src/helpers/monitor/index.ts +0 -2
  237. package/src/helpers/monitor/types.ts +0 -8
  238. package/src/index.ts +0 -29
  239. package/src/initializer/DappInitializer.ts +0 -57
  240. package/src/initializer/index.ts +0 -1
  241. package/src/intent/Caller.ts +0 -74
  242. package/src/intent/Resource.ts +0 -66
  243. package/src/intent/index.ts +0 -2
  244. package/src/lib/ExternalStore.ts +0 -7
  245. package/src/lib/Listener.ts +0 -1
  246. package/src/lib/ModuleAccountPaths.ts +0 -23
  247. package/src/lib/ModuleNames.ts +0 -3
  248. package/src/lib/NameTransforms.ts +0 -34
  249. package/src/lib/PayloadStore.ts +0 -106
  250. package/src/lib/ResourceStores.ts +0 -7
  251. package/src/lib/index.ts +0 -11
  252. package/src/lib/initializeXns.ts +0 -16
  253. package/src/lib/isEqual.ts +0 -42
  254. package/src/lib/isPayload.ts +0 -24
  255. package/src/lib/tokenPlacesSplit.ts +0 -17
  256. package/src/loadOsNode.ts +0 -44
  257. package/src/manifest/index.ts +0 -2
  258. package/src/manifest/manifestReplacementTokens.ts +0 -6
  259. package/src/manifest/os-node.manifest.json +0 -132
  260. package/src/manifests/dapp-window.manifest.json +0 -36
  261. package/src/manifests/index.ts +0 -1
  262. package/src/models/access/ValidDappAccessInterfaces.ts +0 -6
  263. package/src/models/access/index.ts +0 -1
  264. package/src/models/index.ts +0 -1
  265. package/src/profileModuleEvents.ts +0 -43
  266. package/src/registration/DappRegistrationService.ts +0 -179
  267. package/src/registration/DappRegistry.ts +0 -131
  268. package/src/registration/ValidateDappAccessDiviner/Config.ts +0 -24
  269. package/src/registration/ValidateDappAccessDiviner/Diviner.ts +0 -133
  270. package/src/registration/ValidateDappAccessDiviner/index.ts +0 -2
  271. package/src/registration/index.ts +0 -2
  272. package/src/scripts/xyos/command/config.ts +0 -19
  273. package/src/scripts/xyos/command/create.ts +0 -22
  274. package/src/scripts/xyos/command/index.ts +0 -7
  275. package/src/scripts/xyos/command/manifest.ts +0 -19
  276. package/src/scripts/xyos/command/start.ts +0 -35
  277. package/src/scripts/xyos/index.ts +0 -32
  278. package/src/scripts/xyos/lib/createFromTemplate.ts +0 -11
  279. package/src/scripts/xyos/lib/headless.ts +0 -68
  280. package/src/scripts/xyos/lib/index.ts +0 -2
  281. package/src/signer/Signer.spec.ts +0 -65
  282. package/src/signer/Signers.ts +0 -74
  283. package/src/signer/index.ts +0 -1
  284. package/src/spec/boot.spec.ts +0 -89
  285. package/src/stack/Base.ts +0 -166
  286. package/src/stack/Manager.ts +0 -51
  287. package/src/stack/Map.ts +0 -22
  288. package/src/stack/OsPubSubNetworkStack.ts +0 -70
  289. package/src/stack/OsSettingsStack.ts +0 -24
  290. package/src/stack/XyoPublicNetworkStack.ts +0 -32
  291. package/src/stack/index.ts +0 -6
  292. package/src/system/ManageSystemDapps.ts +0 -148
  293. package/src/system/Queries.ts +0 -69
  294. package/src/system/index.ts +0 -1
  295. package/src/types/global.d.ts +0 -9
  296. package/src/types/images.d.ts +0 -5
  297. package/src/utils/buildWalletSeedPhrasePayload.ts +0 -51
  298. package/src/utils/getApiDomain.ts +0 -14
  299. package/src/utils/index.ts +0 -3
  300. package/src/utils/renameObjKey.ts +0 -22
  301. package/src/wallet/DappSeedPhraseRepository.ts +0 -99
  302. package/src/wallet/SeedPhraseRepository.ts +0 -32
  303. package/src/wallet/index.ts +0 -2
@@ -1,12 +1,15 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+
1
4
  // src/access/Caller.ts
2
- import { assertEx as assertEx16 } from "@xylabs/assert";
3
- import { ModuleFactoryLocator as ModuleFactoryLocator9 } from "@xyo-network/module-factory-locator";
5
+ import { assertEx as assertEx16 } from "@xylabs/sdk-js";
4
6
  import { asNodeInstance as asNodeInstance2 } from "@xyo-network/node-model";
5
7
  import { isRegisteredDappAccessDappSet as isRegisteredDappAccessDappSet2 } from "@xyo-network/os-model";
6
8
  import { PayloadBuilder as PayloadBuilder5 } from "@xyo-network/payload-builder";
9
+ import { ModuleFactoryLocator as ModuleFactoryLocator9 } from "@xyo-network/sdk-js";
7
10
 
8
11
  // src/OsCallerBase.ts
9
- import { assertEx } from "@xylabs/assert";
12
+ import { assertEx } from "@xylabs/sdk-js";
10
13
  import { asArchivistInstance } from "@xyo-network/archivist-model";
11
14
  import { asDivinerInstance } from "@xyo-network/diviner-model";
12
15
  var DappsArchivistModuleName = "DappsArchivist";
@@ -15,6 +18,9 @@ var DappsArchivistPayloadDivinerModuleName = "DappsArchivistPayloadDiviner";
15
18
  var DappsArchivistPayloadDevelopmentDivinerModuleName = `${DappsArchivistPayloadDivinerModuleName}Development`;
16
19
  var RegisteredDappInterfacesArchivistModuleName = "RegisteredDappInterfacesArchivist";
17
20
  var OsCallerBase = class {
21
+ static {
22
+ __name(this, "OsCallerBase");
23
+ }
18
24
  context;
19
25
  constructor(context) {
20
26
  this.context = context;
@@ -22,57 +28,57 @@ var OsCallerBase = class {
22
28
  // Get the dapps archivist
23
29
  async getDappsArchivist() {
24
30
  const mod = assertEx(await this.context.root.resolve(DappsArchivistModuleName), () => `${DappsArchivistModuleName} not found`);
25
- return asArchivistInstance(mod, () => `${DappsArchivistModuleName} is not an archivist`, { required: true });
31
+ return asArchivistInstance(mod, () => `${DappsArchivistModuleName} is not an archivist`, {
32
+ required: true
33
+ });
26
34
  }
27
35
  // Get the dapps archivist development
28
36
  async getDappsArchivistDevelopment() {
29
- const mod = assertEx(
30
- await this.context.root.resolve(DappsArchivistDevelopmentModuleName),
31
- () => `${DappsArchivistDevelopmentModuleName} not found`
32
- );
33
- return asArchivistInstance(mod, () => `${DappsArchivistDevelopmentModuleName} is not an archivist`, { required: true });
37
+ const mod = assertEx(await this.context.root.resolve(DappsArchivistDevelopmentModuleName), () => `${DappsArchivistDevelopmentModuleName} not found`);
38
+ return asArchivistInstance(mod, () => `${DappsArchivistDevelopmentModuleName} is not an archivist`, {
39
+ required: true
40
+ });
34
41
  }
35
42
  // Get the dapps archivist payload diviner
36
43
  async getDappsArchivistPayloadDiviner() {
37
- const mod = assertEx(
38
- await this.context.root.resolve(DappsArchivistPayloadDivinerModuleName),
39
- () => `${DappsArchivistPayloadDivinerModuleName} not found`
40
- );
41
- return asDivinerInstance(mod, () => `${DappsArchivistPayloadDivinerModuleName} is not a diviner`, { required: true });
44
+ const mod = assertEx(await this.context.root.resolve(DappsArchivistPayloadDivinerModuleName), () => `${DappsArchivistPayloadDivinerModuleName} not found`);
45
+ return asDivinerInstance(mod, () => `${DappsArchivistPayloadDivinerModuleName} is not a diviner`, {
46
+ required: true
47
+ });
42
48
  }
43
49
  // Get the dapps archivist payload diviner development
44
50
  async getDappsArchivistPayloadDivinerDevelopment() {
45
- const mod = assertEx(
46
- await this.context.root.resolve(DappsArchivistPayloadDevelopmentDivinerModuleName),
47
- () => `${DappsArchivistPayloadDevelopmentDivinerModuleName} not found`
48
- );
49
- return asDivinerInstance(mod, () => `${DappsArchivistPayloadDevelopmentDivinerModuleName} is not a diviner`, { required: true });
51
+ const mod = assertEx(await this.context.root.resolve(DappsArchivistPayloadDevelopmentDivinerModuleName), () => `${DappsArchivistPayloadDevelopmentDivinerModuleName} not found`);
52
+ return asDivinerInstance(mod, () => `${DappsArchivistPayloadDevelopmentDivinerModuleName} is not a diviner`, {
53
+ required: true
54
+ });
50
55
  }
51
56
  // Get the registered dapp interfaces archivist
52
57
  async getRegisteredDappInterfacesArchivist() {
53
- const mod = assertEx(
54
- await this.context.root.resolve(RegisteredDappInterfacesArchivistModuleName),
55
- () => `${RegisteredDappInterfacesArchivistModuleName} not found`
56
- );
57
- return asArchivistInstance(mod, () => `${RegisteredDappInterfacesArchivistModuleName} is not an archivist`, { required: true });
58
+ const mod = assertEx(await this.context.root.resolve(RegisteredDappInterfacesArchivistModuleName), () => `${RegisteredDappInterfacesArchivistModuleName} not found`);
59
+ return asArchivistInstance(mod, () => `${RegisteredDappInterfacesArchivistModuleName} is not an archivist`, {
60
+ required: true
61
+ });
58
62
  }
59
63
  };
60
64
 
61
65
  // src/RunningDappCache.ts
62
- import { assertEx as assertEx15 } from "@xylabs/assert";
66
+ import { assertEx as assertEx15 } from "@xylabs/sdk-js";
63
67
  import { Mutex as Mutex3 } from "async-mutex";
64
68
 
65
69
  // src/dapp/context/creator/createDappContext.ts
66
70
  import { GenericPayloadDiviner } from "@xyo-network/diviner-payload-generic";
67
- import { ModuleFactoryLocator as ModuleFactoryLocator2 } from "@xyo-network/module-factory-locator";
68
- import { HDWallet as HDWallet2 } from "@xyo-network/wallet";
71
+ import { HDWallet as HDWallet2, ModuleFactoryLocator as ModuleFactoryLocator2 } from "@xyo-network/sdk-js";
69
72
 
70
73
  // src/wallet/DappSeedPhraseRepository.ts
71
74
  import { PayloadDivinerQuerySchema } from "@xyo-network/diviner-payload-model";
72
75
  import { DappWalletSeedPhraseSchema } from "@xyo-network/os-model";
73
- import { HDWallet } from "@xyo-network/wallet";
76
+ import { HDWallet } from "@xyo-network/sdk-js";
74
77
  import { v4 as uuid } from "uuid";
75
78
  var DappSeedPhraseRepository = class extends OsCallerBase {
79
+ static {
80
+ __name(this, "DappSeedPhraseRepository");
81
+ }
76
82
  allowedNames;
77
83
  // record of all dapps that have requested a seed phrase with the OS
78
84
  dappIdRepository = /* @__PURE__ */ new Map();
@@ -92,7 +98,9 @@ var DappSeedPhraseRepository = class extends OsCallerBase {
92
98
  seedPhrase,
93
99
  walletId
94
100
  };
95
- await archivist.insert([payload]);
101
+ await archivist.insert([
102
+ payload
103
+ ]);
96
104
  this.dappIdRepository.set(dappId, payload);
97
105
  this.walletIdRepository.set(walletId, payload);
98
106
  return walletId;
@@ -108,7 +116,9 @@ var DappSeedPhraseRepository = class extends OsCallerBase {
108
116
  throw new Error(`failed to add seed phrase: ${dappName}`);
109
117
  } catch (e) {
110
118
  console.error(e);
111
- throw new Error(`failed to add seed phrase: ${dappName}`);
119
+ throw new Error(`failed to add seed phrase: ${dappName}`, {
120
+ cause: e
121
+ });
112
122
  }
113
123
  } else {
114
124
  throw new Error(`${dappName} is not allowed to register a seed phase. NOTE: this is a safeguard till 3rd party dApps can be validated`);
@@ -124,9 +134,13 @@ var DappSeedPhraseRepository = class extends OsCallerBase {
124
134
  limit: 1,
125
135
  order: "desc",
126
136
  schema: PayloadDivinerQuerySchema,
127
- schemas: [DappWalletSeedPhraseSchema]
137
+ schemas: [
138
+ DappWalletSeedPhraseSchema
139
+ ]
128
140
  };
129
- const results = await diviner.divine([query]);
141
+ const results = await diviner.divine([
142
+ query
143
+ ]);
130
144
  return results.length > 0 ? results[0] : void 0;
131
145
  }
132
146
  async checkWalletId(walletId) {
@@ -135,10 +149,14 @@ var DappSeedPhraseRepository = class extends OsCallerBase {
135
149
  limit: 1,
136
150
  order: "desc",
137
151
  schema: PayloadDivinerQuerySchema,
138
- schemas: [DappWalletSeedPhraseSchema],
152
+ schemas: [
153
+ DappWalletSeedPhraseSchema
154
+ ],
139
155
  walletId
140
156
  };
141
- const results = await diviner.divine([query]);
157
+ const results = await diviner.divine([
158
+ query
159
+ ]);
142
160
  return results.length > 0 ? results[0] : void 0;
143
161
  }
144
162
  newPhrase() {
@@ -147,15 +165,14 @@ var DappSeedPhraseRepository = class extends OsCallerBase {
147
165
  };
148
166
 
149
167
  // src/dapp/context/creator/Creator.ts
150
- import { assertEx as assertEx3 } from "@xylabs/assert";
168
+ import { assertEx as assertEx3 } from "@xylabs/sdk-js";
151
169
  import { asArchivistInstance as asArchivistInstance3 } from "@xyo-network/archivist-model";
152
170
  import { replaceManifestTokens } from "@xyo-network/kernel";
153
- import { DappPackageManifestPayloadSchema } from "@xyo-network/manifest";
154
- import { ModuleFactoryLocator } from "@xyo-network/module-factory-locator";
171
+ import { DappPackageManifestPayloadSchema } from "@xyo-network/os-model";
172
+ import { ModuleFactoryLocator } from "@xyo-network/sdk-js";
155
173
 
156
174
  // src/DappCallerBase.ts
157
- import { assertEx as assertEx2 } from "@xylabs/assert";
158
- import { toSafeJsonString } from "@xylabs/object";
175
+ import { assertEx as assertEx2, toSafeJsonString } from "@xylabs/sdk-js";
159
176
  import { asArchivistInstance as asArchivistInstance2 } from "@xyo-network/archivist-model";
160
177
  import { asDivinerInstance as asDivinerInstance2 } from "@xyo-network/diviner-model";
161
178
  var DappArchivistModuleName = "DappArchivist";
@@ -163,50 +180,54 @@ var IntentArchivistModuleName = "IntentArchivist";
163
180
  var IntentArchivistPayloadDivinerModuleName = "IntentArchivistPayloadDiviner";
164
181
  var DappArchivistPayloadDivinerModuleName = "DappArchivistPayloadDiviner";
165
182
  var DappCallerBase = class {
183
+ static {
184
+ __name(this, "DappCallerBase");
185
+ }
166
186
  context;
167
187
  constructor(context) {
168
188
  this.context = context;
169
189
  }
170
190
  /**
171
- * Get the DappArchivist
172
- */
191
+ * Get the DappArchivist
192
+ */
173
193
  async getDappArchivist() {
174
- const mod = assertEx2(
175
- await this.context.root.resolve(DappArchivistModuleName),
176
- () => `${DappArchivistModuleName} not found [${toSafeJsonString(this.context.root.publicChildren())}]`
177
- );
178
- return asArchivistInstance2(mod, () => `${DappArchivistModuleName} is not an archivist`, { required: true });
194
+ const mod = assertEx2(await this.context.root.resolve(DappArchivistModuleName), () => `${DappArchivistModuleName} not found [${toSafeJsonString(this.context.root.publicChildren())}]`);
195
+ return asArchivistInstance2(mod, () => `${DappArchivistModuleName} is not an archivist`, {
196
+ required: true
197
+ });
179
198
  }
180
199
  /**
181
- * Get the DappArchivistPayloadDiviner
182
- */
200
+ * Get the DappArchivistPayloadDiviner
201
+ */
183
202
  async getDappArchivistPayloadDiviner() {
184
- const mod = assertEx2(
185
- await this.context.root.resolve(DappArchivistPayloadDivinerModuleName),
186
- () => `${DappArchivistPayloadDivinerModuleName} not found`
187
- );
188
- return asDivinerInstance2(mod, () => `${DappArchivistPayloadDivinerModuleName} is not a diviner`, { required: true });
203
+ const mod = assertEx2(await this.context.root.resolve(DappArchivistPayloadDivinerModuleName), () => `${DappArchivistPayloadDivinerModuleName} not found`);
204
+ return asDivinerInstance2(mod, () => `${DappArchivistPayloadDivinerModuleName} is not a diviner`, {
205
+ required: true
206
+ });
189
207
  }
190
208
  /**
191
- * Get the IntentArchivist
192
- */
209
+ * Get the IntentArchivist
210
+ */
193
211
  async getDappIntentArchivist() {
194
212
  const mod = assertEx2(await this.context.root.resolve(IntentArchivistModuleName), () => `${IntentArchivistModuleName} not found`);
195
- return asArchivistInstance2(mod, () => `${IntentArchivistModuleName} is not an archivist`, { required: true });
213
+ return asArchivistInstance2(mod, () => `${IntentArchivistModuleName} is not an archivist`, {
214
+ required: true
215
+ });
196
216
  }
197
217
  // Get the IntentArchivistPayloadDiviner
198
218
  async getDappIntentArchivistPayloadDiviner() {
199
- const mod = assertEx2(
200
- await this.context.root.resolve(IntentArchivistPayloadDivinerModuleName),
201
- () => `${IntentArchivistPayloadDivinerModuleName} not found`
202
- );
203
- return asDivinerInstance2(mod, () => `${IntentArchivistPayloadDivinerModuleName} is not a diviner`, { required: true });
219
+ const mod = assertEx2(await this.context.root.resolve(IntentArchivistPayloadDivinerModuleName), () => `${IntentArchivistPayloadDivinerModuleName} not found`);
220
+ return asDivinerInstance2(mod, () => `${IntentArchivistPayloadDivinerModuleName} is not a diviner`, {
221
+ required: true
222
+ });
204
223
  }
205
224
  };
206
225
 
207
226
  // src/manifest/manifestReplacementTokens.ts
208
227
  import { getXnsDomain } from "@xyo-network/kernel";
209
- var manifestReplacementTokens = (xnsNodeUrl, xnsNetwork) => ({ "[REPLACE_WITH_NS_NODE_URL]": getXnsDomain(xnsNodeUrl, xnsNetwork) });
228
+ var manifestReplacementTokens = /* @__PURE__ */ __name((xnsNodeUrl, xnsNetwork) => ({
229
+ "[REPLACE_WITH_NS_NODE_URL]": getXnsDomain(xnsNodeUrl, xnsNetwork)
230
+ }), "manifestReplacementTokens");
210
231
 
211
232
  // src/manifest/os-node.manifest.json
212
233
  var os_node_manifest_default = {
@@ -346,10 +367,13 @@ var os_node_manifest_default = {
346
367
  import { PayloadBuilder } from "@xyo-network/payload-builder";
347
368
 
348
369
  // src/classes/lib/Insertable.ts
349
- var createInsertable = (insertable, ...params) => new insertable(...params);
370
+ var createInsertable = /* @__PURE__ */ __name((insertable, ...params) => new insertable(...params), "createInsertable");
350
371
 
351
372
  // src/dapp/context/creator/DefaultPayloads/DappAccessPayloads.ts
352
373
  var DappAccessPayloads = class {
374
+ static {
375
+ __name(this, "DappAccessPayloads");
376
+ }
353
377
  context;
354
378
  constructor(context, _dappName) {
355
379
  this.context = context;
@@ -364,6 +388,9 @@ var DappAccessPayloads = class {
364
388
  // src/dapp/context/creator/DefaultPayloads/NodeInfoPayload.ts
365
389
  import { NodeOsInfoSchema } from "@xyo-network/os-model";
366
390
  var NodeInfoPayload = class {
391
+ static {
392
+ __name(this, "NodeInfoPayload");
393
+ }
367
394
  _context;
368
395
  constructor(context, _dappName) {
369
396
  this._context = context;
@@ -380,12 +407,17 @@ var NodeInfoPayload = class {
380
407
  publicAddress: exposedNode?.address ?? "",
381
408
  schema: NodeOsInfoSchema
382
409
  };
383
- return [nodeOsInfo];
410
+ return [
411
+ nodeOsInfo
412
+ ];
384
413
  }
385
414
  };
386
415
 
387
416
  // src/dapp/context/creator/DefaultPayloads/DefaultPayloads.ts
388
417
  var DefaultPayloads = class {
418
+ static {
419
+ __name(this, "DefaultPayloads");
420
+ }
389
421
  dappArchivist;
390
422
  dappName;
391
423
  xyOs;
@@ -395,7 +427,10 @@ var DefaultPayloads = class {
395
427
  this.dappName = dappName;
396
428
  }
397
429
  async insert() {
398
- const insertables = [NodeInfoPayload, DappAccessPayloads];
430
+ const insertables = [
431
+ NodeInfoPayload,
432
+ DappAccessPayloads
433
+ ];
399
434
  const insertPayloads = [];
400
435
  for (const insertable of insertables) {
401
436
  const classInstance = createInsertable(insertable, this.xyOs, this.dappName);
@@ -403,16 +438,28 @@ var DefaultPayloads = class {
403
438
  insertPayloads.push(...payloads);
404
439
  }
405
440
  for (const payload of insertPayloads) {
406
- const [existing] = await this.dappArchivist.get([await PayloadBuilder.dataHash(payload)]);
441
+ const [existing] = await this.dappArchivist.get([
442
+ await PayloadBuilder.dataHash(payload)
443
+ ]);
407
444
  if (existing) continue;
408
- await this.dappArchivist.insert([payload]);
445
+ await this.dappArchivist.insert([
446
+ payload
447
+ ]);
409
448
  }
410
449
  }
411
450
  };
412
451
 
413
452
  // src/dapp/context/creator/ExternalModulePermissions/ExternalModulePermissions.ts
414
- var ALLOWED_MODULES_FROM_PARENT = ["IntentArchivist", "OsSettingsNode", "OsPubSubNetworkStackNode", "OsXyoPublicNetworkStackNode"];
453
+ var ALLOWED_MODULES_FROM_PARENT = [
454
+ "IntentArchivist",
455
+ "OsSettingsNode",
456
+ "OsPubSubNetworkStackNode",
457
+ "OsXyoPublicNetworkStackNode"
458
+ ];
415
459
  var ExternalModulePermissions = class {
460
+ static {
461
+ __name(this, "ExternalModulePermissions");
462
+ }
416
463
  context;
417
464
  dappName;
418
465
  dappWindowNode;
@@ -453,6 +500,9 @@ var ExternalModulePermissions = class {
453
500
 
454
501
  // src/dapp/context/creator/Creator.ts
455
502
  var DappContextCreator = class _DappContextCreator {
503
+ static {
504
+ __name(this, "DappContextCreator");
505
+ }
456
506
  // Designated offset path for the wallet used by windowed dapps. In the future, other offsets could be used for other dapp modes
457
507
  static DAPP_WINDOW_WALLET_PATH = "1";
458
508
  context;
@@ -470,18 +520,8 @@ var DappContextCreator = class _DappContextCreator {
470
520
  this.sharedLocator = sharedLocator;
471
521
  }
472
522
  static async create(params, xnsNodeUrl, xnsNetwork) {
473
- const {
474
- config,
475
- locator,
476
- context,
477
- wallet
478
- } = params;
479
- const {
480
- payload,
481
- dappName,
482
- publicChildren,
483
- privateChildren
484
- } = config;
523
+ const { config, locator, context, wallet } = params;
524
+ const { payload, dappName, publicChildren, privateChildren } = config;
485
525
  const { external, manifestPayload } = this.parseDappPackageManifestPayload(payload, xnsNodeUrl, xnsNetwork);
486
526
  console.debug("[DEBUG] dApp manifest", manifestPayload);
487
527
  const dappWallet = await wallet.derivePath(_DappContextCreator.DAPP_WINDOW_WALLET_PATH);
@@ -516,7 +556,10 @@ var DappContextCreator = class _DappContextCreator {
516
556
  };
517
557
  console.log("DappContextCreator:parseDappPackageManifestPayload", xnsNodeUrl, xnsNetwork);
518
558
  const manifestPayload = replaceManifestTokens(manifestPayloadRaw, manifestReplacementTokens(xnsNodeUrl, xnsNetwork));
519
- return { external, manifestPayload };
559
+ return {
560
+ external,
561
+ manifestPayload
562
+ };
520
563
  }
521
564
  async loadDappContext(context) {
522
565
  console.log("DappNodesCreator:loadDappContext", this.dappId);
@@ -537,13 +580,15 @@ var DappContextCreator = class _DappContextCreator {
537
580
  };
538
581
 
539
582
  // src/dapp/context/creator/createDappContext.ts
540
- var GenericPayloadDivinerTags = { "network.xyo.generic.payload.diviner": "GenericPayloadDiviner" };
541
- var resolveLocator = (existingLocator) => {
583
+ var GenericPayloadDivinerTags = {
584
+ "network.xyo.generic.payload.diviner": "GenericPayloadDiviner"
585
+ };
586
+ var resolveLocator = /* @__PURE__ */ __name((existingLocator) => {
542
587
  const locator = existingLocator ?? new ModuleFactoryLocator2();
543
588
  locator.register(GenericPayloadDiviner.factory(), GenericPayloadDivinerTags);
544
589
  return locator;
545
- };
546
- var createDappContext = async (dapp, context, allowedNames, xnsNodeUrl, xnsNetwork) => {
590
+ }, "resolveLocator");
591
+ var createDappContext = /* @__PURE__ */ __name(async (dapp, context, allowedNames, xnsNodeUrl, xnsNetwork) => {
547
592
  console.log("createNodes");
548
593
  try {
549
594
  const dappSeedPhraseRepository = new DappSeedPhraseRepository(context, allowedNames);
@@ -556,7 +601,10 @@ var createDappContext = async (dapp, context, allowedNames, xnsNodeUrl, xnsNetwo
556
601
  const { config: dappConfig, params: dappParams } = dapp;
557
602
  const locator = resolveLocator((dappParams.locator ?? new ModuleFactoryLocator2()).merge(context.platformLocator));
558
603
  const params = {
559
- config: { dappName, payload: dappConfig.manifest },
604
+ config: {
605
+ dappName,
606
+ payload: dappConfig.manifest
607
+ },
560
608
  context,
561
609
  locator,
562
610
  wallet
@@ -571,20 +619,24 @@ var createDappContext = async (dapp, context, allowedNames, xnsNodeUrl, xnsNetwo
571
619
  const error = e;
572
620
  console.error(`Error creating dappWindow node: ${error.message}`);
573
621
  console.error(`Error creating dappWindow node: ${error.stack}`);
574
- throw new Error(`Error creating dappWindow node: ${error.message}`);
622
+ throw new Error(`Error creating dappWindow node: ${error.message}`, {
623
+ cause: e
624
+ });
575
625
  }
576
- };
626
+ }, "createDappContext");
577
627
 
578
628
  // src/XyOs.ts
579
- import { assertEx as assertEx14 } from "@xylabs/assert";
629
+ import { assertEx as assertEx14 } from "@xylabs/sdk-js";
580
630
  import { boot } from "@xyo-network/bios";
581
631
  import { Kernel } from "@xyo-network/kernel";
582
- import { ModuleFactoryLocator as ModuleFactoryLocator8 } from "@xyo-network/module-factory-locator";
632
+ import { ModuleFactoryLocator as ModuleFactoryLocator8 } from "@xyo-network/sdk-js";
583
633
 
584
634
  // src/event/bus/Connection.ts
585
- import { assertEx as assertEx4 } from "@xylabs/assert";
586
- import { BaseEmitter } from "@xylabs/events";
635
+ import { assertEx as assertEx4, BaseEmitter } from "@xylabs/sdk-js";
587
636
  var EventBusConnection = class extends BaseEmitter {
637
+ static {
638
+ __name(this, "EventBusConnection");
639
+ }
588
640
  _id;
589
641
  description;
590
642
  type;
@@ -602,19 +654,18 @@ var EventBusConnection = class extends BaseEmitter {
602
654
  };
603
655
 
604
656
  // src/event/bus/EventBus.ts
605
- import { findAs } from "@xylabs/array";
606
- import { assertEx as assertEx5 } from "@xylabs/assert";
607
- import { forget } from "@xylabs/forget";
657
+ import { assertEx as assertEx5, findAs, forget } from "@xylabs/sdk-js";
608
658
  import { asArchivistInstance as asArchivistInstance4 } from "@xyo-network/archivist";
609
- import { MemoryArchivist, MemoryArchivistConfigSchema } from "@xyo-network/archivist-memory";
610
- import {
611
- asOptionalEventBusEvent,
612
- isPubSubConnections
613
- } from "@xyo-network/os-model";
659
+ import { asOptionalEventBusEvent, isPubSubConnections } from "@xyo-network/os-model";
614
660
  import { PayloadBuilder as PayloadBuilder2 } from "@xyo-network/payload-builder";
661
+ import { asSchema } from "@xyo-network/payload-model";
662
+ import { MemoryArchivist, MemoryArchivistConfigSchema } from "@xyo-network/sdk-js";
615
663
  import { Mutex } from "async-mutex";
616
664
  import { v4 as uuid2 } from "uuid";
617
665
  var EventBus = class {
666
+ static {
667
+ __name(this, "EventBus");
668
+ }
618
669
  // Internal Archivist to store event data
619
670
  _archivist;
620
671
  // Store all connections
@@ -623,11 +674,9 @@ var EventBus = class {
623
674
  publisherCallbacks = {};
624
675
  startMutex = new Mutex();
625
676
  get archivist() {
626
- return asArchivistInstance4(
627
- assertEx5(this._archivist, () => "Archivist not found. Did you forget to call start()?"),
628
- "not a valid archivist instance",
629
- { required: true }
630
- );
677
+ return asArchivistInstance4(assertEx5(this._archivist, () => "Archivist not found. Did you forget to call start()?"), "not a valid archivist instance", {
678
+ required: true
679
+ });
631
680
  }
632
681
  addConnection(connection) {
633
682
  const id = uuid2();
@@ -656,7 +705,12 @@ var EventBus = class {
656
705
  console.warn("EventBus already started");
657
706
  return this;
658
707
  }
659
- this._archivist = await MemoryArchivist.create({ config: { name: storeName, schema: MemoryArchivistConfigSchema } });
708
+ this._archivist = await MemoryArchivist.create({
709
+ config: {
710
+ name: storeName,
711
+ schema: MemoryArchivistConfigSchema
712
+ }
713
+ });
660
714
  this.archivist.on("inserted", ({ payloads }) => {
661
715
  const eventBusEvent = findAs(payloads, asOptionalEventBusEvent);
662
716
  if (!eventBusEvent) return;
@@ -666,7 +720,9 @@ var EventBus = class {
666
720
  for (const [eventName, callback] of connection.subscribableEvents.entries()) {
667
721
  if (eventName !== eventBusEvent.name) continue;
668
722
  if (callback) {
669
- const forgettable = async () => await callback({ payloads });
723
+ const forgettable = /* @__PURE__ */ __name(async () => await callback({
724
+ payloads
725
+ }), "forgettable");
670
726
  forget(forgettable());
671
727
  }
672
728
  }
@@ -678,16 +734,22 @@ var EventBus = class {
678
734
  }
679
735
  handlePublisherAdd(connection) {
680
736
  for (const eventName of connection.publishableEvents ?? []) {
681
- const connectionPublisherCallback = async ({ payloads }) => {
682
- const event = { name: eventName, schema: "network.xyo.event.bus.event" };
737
+ const connectionPublisherCallback = /* @__PURE__ */ __name(async ({ payloads }) => {
738
+ const event = {
739
+ name: eventName,
740
+ schema: asSchema("network.xyo.event.bus.event", true)
741
+ };
683
742
  const eventPayloads = payloads ?? [];
684
743
  event.sources = await PayloadBuilder2.dataHashes(eventPayloads);
685
744
  try {
686
- await this.archivist.insert([event, ...payloads ?? []]);
745
+ await this.archivist.insert([
746
+ event,
747
+ ...payloads ?? []
748
+ ]);
687
749
  } catch (e) {
688
750
  console.error("Error inserting event into archivist", e);
689
751
  }
690
- };
752
+ }, "connectionPublisherCallback");
691
753
  connection.on(eventName, connectionPublisherCallback);
692
754
  const callbackId = connection.id + eventName;
693
755
  this.publisherCallbacks[callbackId] = connectionPublisherCallback;
@@ -704,6 +766,9 @@ var EventBus = class {
704
766
 
705
767
  // src/event/bus/PubSubConnection.ts
706
768
  var EventBusPubSubConnection = class extends EventBusConnection {
769
+ static {
770
+ __name(this, "EventBusPubSubConnection");
771
+ }
707
772
  publishableEvents;
708
773
  subscribableEvents;
709
774
  constructor(request) {
@@ -719,79 +784,95 @@ var EventBusPubSubConnection = class extends EventBusConnection {
719
784
  // src/event/connections/DappAccessRequest.ts
720
785
  var DappAccessRequestEvent = "dappAccessRequest";
721
786
  var dappAccessRequestConnectionRequest = {
722
- publishableEvents: [DappAccessRequestEvent],
787
+ publishableEvents: [
788
+ DappAccessRequestEvent
789
+ ],
723
790
  type: "PubSub"
724
791
  };
725
- var dappAccessRequestConnection = () => new EventBusPubSubConnection(dappAccessRequestConnectionRequest);
792
+ var dappAccessRequestConnection = /* @__PURE__ */ __name(() => new EventBusPubSubConnection(dappAccessRequestConnectionRequest), "dappAccessRequestConnection");
726
793
 
727
794
  // src/event/connections/DappsReady.ts
728
795
  var dappsReadyConnectionRequest = {
729
- publishableEvents: ["dappsReady"],
796
+ publishableEvents: [
797
+ "dappsReady"
798
+ ],
730
799
  type: "PubSub"
731
800
  };
732
- var dappsReadyConnection = () => new EventBusPubSubConnection(dappsReadyConnectionRequest);
801
+ var dappsReadyConnection = /* @__PURE__ */ __name(() => new EventBusPubSubConnection(dappsReadyConnectionRequest), "dappsReadyConnection");
733
802
 
734
803
  // src/event/connections/ExposeDappRequest.ts
735
804
  var ExposeDappRequestEvent = "exposeDappRequest";
736
805
  var exposeDappConnectionRequest = {
737
- publishableEvents: [ExposeDappRequestEvent],
806
+ publishableEvents: [
807
+ ExposeDappRequestEvent
808
+ ],
738
809
  type: "PubSub"
739
810
  };
740
- var exposeDappRequestConnection = () => new EventBusPubSubConnection(exposeDappConnectionRequest);
811
+ var exposeDappRequestConnection = /* @__PURE__ */ __name(() => new EventBusPubSubConnection(exposeDappConnectionRequest), "exposeDappRequestConnection");
741
812
 
742
813
  // src/event/connections/OsPubSubNetworkReady.ts
743
814
  var OsPubSubNetworkReadyEvent = "osPubSubNetworkReady";
744
815
  var osPubSubNetworkConnectionRequest = {
745
- publishableEvents: [OsPubSubNetworkReadyEvent],
816
+ publishableEvents: [
817
+ OsPubSubNetworkReadyEvent
818
+ ],
746
819
  type: "PubSub"
747
820
  };
748
- var osPubSubNetworkReadyConnection = () => new EventBusPubSubConnection(osPubSubNetworkConnectionRequest);
821
+ var osPubSubNetworkReadyConnection = /* @__PURE__ */ __name(() => new EventBusPubSubConnection(osPubSubNetworkConnectionRequest), "osPubSubNetworkReadyConnection");
749
822
 
750
823
  // src/event/connections/OsSettingsReady.ts
751
824
  var OsSettingsReadyEvent = "osSettingsReady";
752
825
  var osSettingsConnectionRequest = {
753
- publishableEvents: [OsSettingsReadyEvent],
826
+ publishableEvents: [
827
+ OsSettingsReadyEvent
828
+ ],
754
829
  type: "PubSub"
755
830
  };
756
- var osSettingsReadyConnection = () => new EventBusPubSubConnection(osSettingsConnectionRequest);
831
+ var osSettingsReadyConnection = /* @__PURE__ */ __name(() => new EventBusPubSubConnection(osSettingsConnectionRequest), "osSettingsReadyConnection");
757
832
 
758
833
  // src/event/connections/OsXyoPublicReady.ts
759
834
  var OsXyoPublicNetworkReadyEvent = "osXyoPublicNetworkReady";
760
835
  var osXyoPublicNetworkConnectionRequest = {
761
- publishableEvents: [OsXyoPublicNetworkReadyEvent],
836
+ publishableEvents: [
837
+ OsXyoPublicNetworkReadyEvent
838
+ ],
762
839
  type: "PubSub"
763
840
  };
764
- var osXyoPublicNetworkReadyConnection = () => new EventBusPubSubConnection(osXyoPublicNetworkConnectionRequest);
841
+ var osXyoPublicNetworkReadyConnection = /* @__PURE__ */ __name(() => new EventBusPubSubConnection(osXyoPublicNetworkConnectionRequest), "osXyoPublicNetworkReadyConnection");
765
842
 
766
843
  // src/lib/initializeXns.ts
767
844
  import { asDivinerInstance as asDivinerInstance3 } from "@xyo-network/diviner-model";
768
- import { ResolveHelper } from "@xyo-network/module-model";
845
+ import { ResolveHelper } from "@xyo-network/module";
769
846
  import { NameRegistrarTransformer } from "@xyo-network/module-resolver";
770
- var initializeXns = async (xnsNode) => {
847
+ var initializeXns = /* @__PURE__ */ __name(async (xnsNode) => {
771
848
  if (ResolveHelper.transformers.length === 0) {
772
849
  const registrarDiviner = asDivinerInstance3(await xnsNode?.resolve("AddressRecords:AddressRecordIndexDiviner"));
773
850
  if (registrarDiviner) {
774
851
  const transformer = new NameRegistrarTransformer(registrarDiviner, "xyo");
775
- ResolveHelper.transformers = [transformer];
852
+ ResolveHelper.transformers = [
853
+ transformer
854
+ ];
776
855
  return true;
777
856
  }
778
857
  }
779
858
  return false;
780
- };
859
+ }, "initializeXns");
781
860
 
782
861
  // src/lib/isEqual.ts
783
- import { isObject } from "@xylabs/object";
862
+ import { isObject } from "@xylabs/sdk-js";
784
863
  function isEqual(a, b) {
785
864
  if (a === b) return true;
786
865
  if (typeof a !== typeof b) return false;
787
866
  if (isObject(a) && isObject(b)) {
788
- const aKeys = Object.keys(a);
789
- const bKeys = Object.keys(b);
867
+ const aRecord = a;
868
+ const bRecord = b;
869
+ const aKeys = Object.keys(aRecord);
870
+ const bKeys = Object.keys(bRecord);
790
871
  if (aKeys.length !== bKeys.length) {
791
872
  return false;
792
873
  }
793
874
  for (const key of aKeys) {
794
- if (!b.hasOwnProperty(key) || !isEqual(a[key], b[key])) {
875
+ if (!Object.hasOwn(bRecord, key) || !isEqual(aRecord[key], bRecord[key])) {
795
876
  return false;
796
877
  }
797
878
  }
@@ -810,25 +891,26 @@ function isEqual(a, b) {
810
891
  }
811
892
  return false;
812
893
  }
894
+ __name(isEqual, "isEqual");
813
895
 
814
896
  // src/lib/isPayload.ts
815
- import { AsObjectFactory } from "@xylabs/object";
816
- var isObject2 = (x) => {
897
+ import { AsObjectFactory } from "@xylabs/sdk-js";
898
+ var isObject2 = /* @__PURE__ */ __name((x) => {
817
899
  return typeof x === "object" && !Array.isArray(x);
818
- };
819
- var isAnyPayload = (obj) => {
900
+ }, "isObject");
901
+ var isAnyPayload = /* @__PURE__ */ __name((obj) => {
820
902
  if (isObject2(obj)) {
821
903
  return typeof obj.schema === "string";
822
904
  }
823
905
  return false;
824
- };
825
- var isPayload = (schema) => (obj) => {
906
+ }, "isAnyPayload");
907
+ var isPayload = /* @__PURE__ */ __name((schema) => (obj) => {
826
908
  if (isAnyPayload(obj)) {
827
909
  return schema.includes(obj.schema);
828
910
  }
829
911
  return false;
830
- };
831
- var asPayload = (schema) => AsObjectFactory.create(isPayload(schema));
912
+ }, "isPayload");
913
+ var asPayload = /* @__PURE__ */ __name((schema) => AsObjectFactory.create(isPayload(schema)), "asPayload");
832
914
 
833
915
  // src/lib/ModuleNames.ts
834
916
  var DevelopArchivist = "DevelopArchivist";
@@ -836,9 +918,15 @@ var NodeSentinel = "NodeSentinel";
836
918
 
837
919
  // src/lib/ModuleAccountPaths.ts
838
920
  var RemoteNodeArchivistOffsetPaths = {
839
- Kerplunk: { [DevelopArchivist]: "118" },
840
- Local: { [DevelopArchivist]: "115" },
841
- Main: { [DevelopArchivist]: "121" }
921
+ Kerplunk: {
922
+ [DevelopArchivist]: "118"
923
+ },
924
+ Local: {
925
+ [DevelopArchivist]: "115"
926
+ },
927
+ Main: {
928
+ [DevelopArchivist]: "121"
929
+ }
842
930
  };
843
931
  var ModuleOffsetPaths = {
844
932
  IdWitness: "1",
@@ -858,6 +946,9 @@ var ModuleOffsetPaths = {
858
946
 
859
947
  // src/lib/NameTransforms.ts
860
948
  var NameTransforms = class _NameTransforms {
949
+ static {
950
+ __name(this, "NameTransforms");
951
+ }
861
952
  value;
862
953
  constructor(value) {
863
954
  this.value = value;
@@ -884,6 +975,9 @@ var NameTransforms = class _NameTransforms {
884
975
 
885
976
  // src/lib/PayloadStore.ts
886
977
  var PayloadStore = class {
978
+ static {
979
+ __name(this, "PayloadStore");
980
+ }
887
981
  latest = [];
888
982
  archivist;
889
983
  deleteListeners = [];
@@ -893,26 +987,22 @@ var PayloadStore = class {
893
987
  this.archivist = archivist;
894
988
  }
895
989
  /**
896
- * Initialize listeners on the archivist that update class member variables when new payloads are inserted
897
- */
898
- static async create({
899
- archivist,
900
- getLatest,
901
- idFunction
902
- }) {
990
+ * Initialize listeners on the archivist that update class member variables when new payloads are inserted
991
+ */
992
+ static async create({ archivist, getLatest, idFunction }) {
903
993
  const instance = new this(archivist);
904
- const insertListener = async ({ payloads }) => {
994
+ const insertListener = /* @__PURE__ */ __name(async ({ payloads }) => {
905
995
  if (payloads.some(idFunction)) {
906
996
  const latest = await getLatest();
907
997
  if (isEqual(latest, instance.latest)) return;
908
998
  instance.latest = latest;
909
999
  instance.emitChange();
910
1000
  }
911
- };
912
- const deleteListener = async () => {
1001
+ }, "insertListener");
1002
+ const deleteListener = /* @__PURE__ */ __name(async () => {
913
1003
  instance.latest = await getLatest();
914
1004
  instance.emitChange();
915
- };
1005
+ }, "deleteListener");
916
1006
  const weakRefInsertListener = new WeakRef(insertListener);
917
1007
  const weakRefDeleteListener = new WeakRef(deleteListener);
918
1008
  const insertListenerRef = weakRefInsertListener.deref();
@@ -925,8 +1015,8 @@ var PayloadStore = class {
925
1015
  return instance;
926
1016
  }
927
1017
  /**
928
- * Remove all listeners and reset their class members
929
- */
1018
+ * Remove all listeners and reset their class members
1019
+ */
930
1020
  cleanupListeners() {
931
1021
  this.removeListeners(this.insertListeners, "inserted");
932
1022
  this.removeListeners(this.deleteListeners, "deleted");
@@ -934,16 +1024,15 @@ var PayloadStore = class {
934
1024
  this.deleteListeners = [];
935
1025
  }
936
1026
  /**
937
- * Get the current value of the store
938
- */
1027
+ * Get the current value of the store
1028
+ */
939
1029
  getSnapshot() {
940
1030
  return this.latest;
941
1031
  }
942
1032
  /**
943
- * Add a call back function that is invoked when new Payloads are inserted
944
- *
945
- * @param {PayloadListener} onStoreChange
946
- */
1033
+ * Add a call back function that is invoked when new Payloads are inserted
1034
+ * @param onStoreChange
1035
+ */
947
1036
  subscribe(onStoreChange) {
948
1037
  this.listeners.push(onStoreChange);
949
1038
  return () => {
@@ -965,85 +1054,92 @@ var PayloadStore = class {
965
1054
  };
966
1055
 
967
1056
  // src/lib/tokenPlacesSplit.ts
968
- import { assertEx as assertEx6 } from "@xylabs/assert";
969
- var tokenPlacesSplit = (value, places) => {
1057
+ import { assertEx as assertEx6 } from "@xylabs/sdk-js";
1058
+ var tokenPlacesSplit = /* @__PURE__ */ __name((value, places) => {
970
1059
  assertEx6(places >= 0, () => "Places has to be >= 0");
971
1060
  const factor = BigInt(10 ** Math.abs(places));
972
1061
  const remainder = value % factor;
973
1062
  const wholeValue = value / factor;
974
- return [wholeValue, remainder];
975
- };
976
- var tokenPlacesSplitString = (value, places) => {
1063
+ return [
1064
+ wholeValue,
1065
+ remainder
1066
+ ];
1067
+ }, "tokenPlacesSplit");
1068
+ var tokenPlacesSplitString = /* @__PURE__ */ __name((value, places) => {
977
1069
  if (value === void 0) {
978
1070
  return "-";
979
1071
  }
980
1072
  const [wholeValue, remainder] = tokenPlacesSplit(value, places);
981
1073
  return `${wholeValue}.${remainder.toString().padStart(Math.abs(places), "0")}`;
982
- };
1074
+ }, "tokenPlacesSplitString");
983
1075
 
984
1076
  // src/loadOsNode.ts
985
1077
  import { IndexedDbArchivist } from "@xyo-network/archivist-indexeddb";
986
1078
  import { IndexedDbPayloadDiviner } from "@xyo-network/diviner-payload-indexeddb";
987
- import { ManifestWrapper } from "@xyo-network/manifest-wrapper";
988
- import { ModuleFactoryLocator as ModuleFactoryLocator3 } from "@xyo-network/module-factory-locator";
1079
+ import { ManifestWrapper, ModuleFactoryLocator as ModuleFactoryLocator3 } from "@xyo-network/sdk-js";
989
1080
  var OS_NODE_PATH = "1'";
990
- var getDefaultOsNodeLocator = () => {
1081
+ var getDefaultOsNodeLocator = /* @__PURE__ */ __name(() => {
991
1082
  const locator = new ModuleFactoryLocator3();
992
- locator.register(IndexedDbArchivist.factory(), { "network.xyo.archivist.persistence.scope": "device" });
993
- locator.register(IndexedDbPayloadDiviner.factory(), { "network.xyo.archivist.persistence.scope": "device" });
1083
+ locator.register(IndexedDbArchivist.factory(), {
1084
+ "network.xyo.archivist.persistence.scope": "device"
1085
+ });
1086
+ locator.register(IndexedDbPayloadDiviner.factory(), {
1087
+ "network.xyo.archivist.persistence.scope": "device"
1088
+ });
994
1089
  return locator;
995
- };
996
- var loadOsNode = async (osWallet, locator) => {
1090
+ }, "getDefaultOsNodeLocator");
1091
+ var loadOsNode = /* @__PURE__ */ __name(async (osWallet, locator) => {
997
1092
  try {
998
1093
  const osNodeWallet = await osWallet.derivePath(OS_NODE_PATH);
999
1094
  const osNodeLocator = locator ?? getDefaultOsNodeLocator();
1000
1095
  const manifestWrapper = new ManifestWrapper(os_node_manifest_default, osNodeWallet, osNodeLocator);
1001
1096
  const osNode = (await manifestWrapper.loadNodes())[0];
1002
- return [osNode];
1097
+ return [
1098
+ osNode
1099
+ ];
1003
1100
  } catch (e) {
1004
1101
  const error = e;
1005
1102
  console.error(`Error creating os node: ${error.message}`);
1006
1103
  console.error(`Error creating os node: ${error.stack}`);
1007
- throw new Error(`Error creating os node: ${error.message}`);
1104
+ throw new Error(`Error creating os node: ${error.message}`, {
1105
+ cause: e
1106
+ });
1008
1107
  }
1009
- };
1108
+ }, "loadOsNode");
1010
1109
 
1011
1110
  // src/registration/DappRegistrationService.ts
1012
- import { forget as forget2 } from "@xylabs/forget";
1013
- import { fulfilled, rejected } from "@xylabs/promise";
1014
- import { ModuleFactoryLocator as ModuleFactoryLocator7 } from "@xyo-network/module-factory-locator";
1015
- import {
1016
- DappIntentTypes,
1017
- DappMode as DappMode2,
1018
- isRegisteredDappAccessDappSet,
1019
- isRegisteredDappExposedDappSet
1020
- } from "@xyo-network/os-model";
1111
+ import { forget as forget2, fulfilled, rejected } from "@xylabs/sdk-js";
1112
+ import { DappIntentTypes, DappMode as DappMode2, isRegisteredDappAccessDappSet, isRegisteredDappExposedDappSet } from "@xyo-network/os-model";
1113
+ import { ModuleFactoryLocator as ModuleFactoryLocator7 } from "@xyo-network/sdk-js";
1021
1114
 
1022
1115
  // src/intent/Caller.ts
1023
1116
  import { PayloadDivinerQuerySchema as PayloadDivinerQuerySchema2 } from "@xyo-network/diviner-payload-model";
1024
1117
  import { DappIntentSchema, DappMode } from "@xyo-network/os-model";
1025
1118
  var DappIntentCaller = class _DappIntentCaller extends DappCallerBase {
1119
+ static {
1120
+ __name(this, "DappIntentCaller");
1121
+ }
1026
1122
  static OsDappName = "XyOs";
1027
1123
  constructor(context) {
1028
1124
  super(context);
1029
1125
  }
1030
1126
  /**
1031
- * Build a new intent
1032
- * @param {DappId} sourceDappId
1033
- * @param {DappIntentTypes} intent
1034
- * @param {DappId} targetDappId
1035
- * @param {DappMode} targetMode
1036
- * @param {DappIntent['params']} params?
1037
- * @returns DappIntent
1038
- */
1127
+ * Build a new intent
1128
+ * @param sourceDappId
1129
+ * @param intent
1130
+ * @param targetDappId
1131
+ * @param targetMode
1132
+ * @param params?
1133
+ * @returns DappIntent
1134
+ */
1039
1135
  static buildIntent(sourceDappId, intent, targetDappId, targetMode = DappMode.Window, params) {
1040
1136
  return {
1041
1137
  intent,
1042
- params: params || "",
1138
+ params: params ?? "",
1043
1139
  schema: DappIntentSchema,
1044
1140
  sourceDappId,
1045
1141
  targetDappId,
1046
- targetMode: targetMode || DappMode.Window,
1142
+ targetMode: targetMode ?? DappMode.Window,
1047
1143
  timestamp: Date.now()
1048
1144
  };
1049
1145
  }
@@ -1051,7 +1147,9 @@ var DappIntentCaller = class _DappIntentCaller extends DappCallerBase {
1051
1147
  async addIntent(id, intent, mode) {
1052
1148
  const intentArchivist = await this.getDappIntentArchivist();
1053
1149
  const newIntent = _DappIntentCaller.buildIntent(id, intent, mode);
1054
- await intentArchivist.insert([newIntent]);
1150
+ await intentArchivist.insert([
1151
+ newIntent
1152
+ ]);
1055
1153
  }
1056
1154
  // Get all intents
1057
1155
  async allIntents() {
@@ -1072,15 +1170,20 @@ var DappIntentCaller = class _DappIntentCaller extends DappCallerBase {
1072
1170
  schema: PayloadDivinerQuerySchema2,
1073
1171
  sourceDappId: dappName
1074
1172
  };
1075
- return await diviner.divine([query]);
1173
+ return await diviner.divine([
1174
+ query
1175
+ ]);
1076
1176
  }
1077
1177
  };
1078
1178
 
1079
1179
  // src/intent/Resource.ts
1080
- import { assertEx as assertEx7 } from "@xylabs/assert";
1180
+ import { assertEx as assertEx7 } from "@xylabs/sdk-js";
1081
1181
  import { isDappIntent } from "@xyo-network/os-model";
1082
1182
  var NO_RESULTS = [];
1083
1183
  var DappIntentResource = class extends DappCallerBase {
1184
+ static {
1185
+ __name(this, "DappIntentResource");
1186
+ }
1084
1187
  _allDappIntents;
1085
1188
  _latestDappIntent;
1086
1189
  constructor(context) {
@@ -1094,14 +1197,14 @@ var DappIntentResource = class extends DappCallerBase {
1094
1197
  }
1095
1198
  get subscriptions() {
1096
1199
  return {
1097
- allDappIntents: (cb) => this.allDappIntents.subscribe(cb),
1098
- latestDappIntent: (cb) => this.latestDappIntent.subscribe(cb)
1200
+ allDappIntents: /* @__PURE__ */ __name((cb) => this.allDappIntents.subscribe(cb), "allDappIntents"),
1201
+ latestDappIntent: /* @__PURE__ */ __name((cb) => this.latestDappIntent.subscribe(cb), "latestDappIntent")
1099
1202
  };
1100
1203
  }
1101
1204
  get views() {
1102
1205
  return {
1103
- allDappIntents: () => this.allDappIntents.getSnapshot(),
1104
- latestDappIntent: () => this.latestDappIntent.getSnapshot()
1206
+ allDappIntents: /* @__PURE__ */ __name(() => this.allDappIntents.getSnapshot(), "allDappIntents"),
1207
+ latestDappIntent: /* @__PURE__ */ __name(() => this.latestDappIntent.getSnapshot(), "latestDappIntent")
1105
1208
  };
1106
1209
  }
1107
1210
  cleanupListeners() {
@@ -1112,16 +1215,18 @@ var DappIntentResource = class extends DappCallerBase {
1112
1215
  const archivist = await this.getDappIntentArchivist();
1113
1216
  this._allDappIntents = await PayloadStore.create({
1114
1217
  archivist,
1115
- getLatest: async () => await archivist.all(),
1218
+ getLatest: /* @__PURE__ */ __name(async () => await archivist.all(), "getLatest"),
1116
1219
  idFunction: isDappIntent
1117
1220
  });
1118
1221
  this._latestDappIntent = await PayloadStore.create({
1119
1222
  archivist,
1120
- getLatest: async () => {
1223
+ getLatest: /* @__PURE__ */ __name(async () => {
1121
1224
  const all = await archivist.all();
1122
- const result = all.length > 0 ? [all.at(-1)] : NO_RESULTS;
1225
+ const result = all.length > 0 ? [
1226
+ all.at(-1)
1227
+ ] : NO_RESULTS;
1123
1228
  return result;
1124
- },
1229
+ }, "getLatest"),
1125
1230
  idFunction: isDappIntent
1126
1231
  });
1127
1232
  }
@@ -1133,12 +1238,7 @@ import semver from "semver";
1133
1238
 
1134
1239
  // src/system/Queries.ts
1135
1240
  import { PayloadDivinerQuerySchema as PayloadDivinerQuerySchema3 } from "@xyo-network/diviner-payload-model";
1136
- import {
1137
- DappConfigSchema,
1138
- DappIconSchema,
1139
- DappWidgetConfigSchema,
1140
- UnregisteredDappAccessSchema
1141
- } from "@xyo-network/os-model";
1241
+ import { DappConfigSchema, DappIconSchema, DappWidgetConfigSchema, UnregisteredDappAccessSchema } from "@xyo-network/os-model";
1142
1242
  import { PayloadBuilder as PayloadBuilder3 } from "@xyo-network/payload-builder";
1143
1243
  var SystemDappQueries = {
1144
1244
  async getDappAccess(diviner, name, version) {
@@ -1146,10 +1246,14 @@ var SystemDappQueries = {
1146
1246
  order: "desc",
1147
1247
  registeringDappId: name,
1148
1248
  schema: PayloadDivinerQuerySchema3,
1149
- schemas: [UnregisteredDappAccessSchema],
1249
+ schemas: [
1250
+ UnregisteredDappAccessSchema
1251
+ ],
1150
1252
  version
1151
1253
  };
1152
- return await diviner.divine([accessQuery]);
1254
+ return await diviner.divine([
1255
+ accessQuery
1256
+ ]);
1153
1257
  },
1154
1258
  async getLatestConfig(diviner, name) {
1155
1259
  const configQuery = {
@@ -1157,9 +1261,13 @@ var SystemDappQueries = {
1157
1261
  name,
1158
1262
  order: "desc",
1159
1263
  schema: PayloadDivinerQuerySchema3,
1160
- schemas: [DappConfigSchema]
1264
+ schemas: [
1265
+ DappConfigSchema
1266
+ ]
1161
1267
  };
1162
- const [dappConfig] = await diviner.divine([configQuery]);
1268
+ const [dappConfig] = await diviner.divine([
1269
+ configQuery
1270
+ ]);
1163
1271
  return dappConfig;
1164
1272
  },
1165
1273
  async getLatestIcon(diviner, name, version) {
@@ -1167,10 +1275,14 @@ var SystemDappQueries = {
1167
1275
  name,
1168
1276
  order: "desc",
1169
1277
  schema: PayloadDivinerQuerySchema3,
1170
- schemas: [DappIconSchema],
1278
+ schemas: [
1279
+ DappIconSchema
1280
+ ],
1171
1281
  version
1172
1282
  };
1173
- const [dappIcon] = await diviner.divine([iconQuery]);
1283
+ const [dappIcon] = await diviner.divine([
1284
+ iconQuery
1285
+ ]);
1174
1286
  return dappIcon;
1175
1287
  },
1176
1288
  async getWidgetConfigs(diviner, name, version) {
@@ -1178,10 +1290,14 @@ var SystemDappQueries = {
1178
1290
  dappId: name,
1179
1291
  order: "desc",
1180
1292
  schema: PayloadDivinerQuerySchema3,
1181
- schemas: [DappWidgetConfigSchema],
1293
+ schemas: [
1294
+ DappWidgetConfigSchema
1295
+ ],
1182
1296
  version
1183
1297
  };
1184
- const widgetConfigs = await diviner.divine([widgetConfigQuery]);
1298
+ const widgetConfigs = await diviner.divine([
1299
+ widgetConfigQuery
1300
+ ]);
1185
1301
  const uniqueConfigs = {};
1186
1302
  for (const widgetConfig of widgetConfigs) {
1187
1303
  const hash = await PayloadBuilder3.dataHash(widgetConfig);
@@ -1193,6 +1309,9 @@ var SystemDappQueries = {
1193
1309
 
1194
1310
  // src/system/ManageSystemDapps.ts
1195
1311
  var ManageSystemDapps = class extends OsCallerBase {
1312
+ static {
1313
+ __name(this, "ManageSystemDapps");
1314
+ }
1196
1315
  defaultSystemDappParams;
1197
1316
  defaultSystemDapps;
1198
1317
  defaultSystemNames;
@@ -1208,15 +1327,15 @@ var ManageSystemDapps = class extends OsCallerBase {
1208
1327
  this.developmentMode = developmentMode;
1209
1328
  }
1210
1329
  /**
1211
- * Add a callback to listen for errors throwing during system dapp registration
1212
- * @param {ErrorListener} errorListener
1213
- */
1330
+ * Add a callback to listen for errors throwing during system dapp registration
1331
+ * @param errorListener
1332
+ */
1214
1333
  addErrorListener(errorListener) {
1215
1334
  this.onErrorCallbacks.push(errorListener);
1216
1335
  }
1217
1336
  /**
1218
- * Installs the dapps into the OS and builds the appropriate DappSet
1219
- */
1337
+ * Installs the dapps into the OS and builds the appropriate DappSet
1338
+ */
1220
1339
  async install() {
1221
1340
  await this.insertPayloads();
1222
1341
  return await this.latestSets();
@@ -1240,9 +1359,13 @@ var ManageSystemDapps = class extends OsCallerBase {
1240
1359
  console.error(`${systemDappPayload.version} does not appear to be a valid semver value`, e);
1241
1360
  continue;
1242
1361
  }
1243
- const [existing] = await archivist.get([await PayloadBuilder4.dataHash(systemDappPayload)]);
1362
+ const [existing] = await archivist.get([
1363
+ await PayloadBuilder4.dataHash(systemDappPayload)
1364
+ ]);
1244
1365
  if (existing) continue;
1245
- await archivist.insert([systemDappPayload]);
1366
+ await archivist.insert([
1367
+ systemDappPayload
1368
+ ]);
1246
1369
  }
1247
1370
  return true;
1248
1371
  } catch (e) {
@@ -1296,10 +1419,9 @@ var ManageSystemDapps = class extends OsCallerBase {
1296
1419
  };
1297
1420
 
1298
1421
  // src/XyOsDapp.ts
1299
- import { assertEx as assertEx9 } from "@xylabs/assert";
1300
- import { ManifestWrapper as ManifestWrapper2 } from "@xyo-network/manifest-wrapper";
1301
- import { ModuleFactoryLocator as ModuleFactoryLocator5 } from "@xyo-network/module-factory-locator";
1422
+ import { assertEx as assertEx9 } from "@xylabs/sdk-js";
1302
1423
  import { DappPackageManifestPayloadSchema as DappPackageManifestPayloadSchema2 } from "@xyo-network/os-model";
1424
+ import { ManifestWrapper as ManifestWrapper2, ModuleFactoryLocator as ModuleFactoryLocator5 } from "@xyo-network/sdk-js";
1303
1425
 
1304
1426
  // src/manifests/dapp-window.manifest.json
1305
1427
  var dapp_window_manifest_default = {
@@ -1340,11 +1462,13 @@ var dapp_window_manifest_default = {
1340
1462
  };
1341
1463
 
1342
1464
  // src/XyOsBase.ts
1343
- import { assertEx as assertEx8 } from "@xylabs/assert";
1344
- import { BaseEmitter as BaseEmitter2 } from "@xylabs/events";
1345
- import { ModuleFactoryLocator as ModuleFactoryLocator4 } from "@xyo-network/module-factory-locator";
1465
+ import { assertEx as assertEx8, BaseEmitter as BaseEmitter2 } from "@xylabs/sdk-js";
1466
+ import { ModuleFactoryLocator as ModuleFactoryLocator4 } from "@xyo-network/sdk-js";
1346
1467
  import { Mutex as Mutex2 } from "async-mutex";
1347
1468
  var XyOsContextBase = class extends BaseEmitter2 {
1469
+ static {
1470
+ __name(this, "XyOsContextBase");
1471
+ }
1348
1472
  _bootMutex = new Mutex2();
1349
1473
  _platformLocator;
1350
1474
  _root;
@@ -1428,10 +1552,15 @@ var XyOsContextBase = class extends BaseEmitter2 {
1428
1552
 
1429
1553
  // src/XyOsDapp.ts
1430
1554
  var XyOsDapp = class extends XyOsContextBase {
1555
+ static {
1556
+ __name(this, "XyOsDapp");
1557
+ }
1431
1558
  dapp;
1432
1559
  constructor(params) {
1433
1560
  super(params);
1434
- this.dapp = { ...params.dapp };
1561
+ this.dapp = {
1562
+ ...params.dapp
1563
+ };
1435
1564
  }
1436
1565
  get eventBus() {
1437
1566
  return this.parent.eventBus;
@@ -1443,12 +1572,12 @@ var XyOsDapp = class extends XyOsContextBase {
1443
1572
  return this.parent.exposedNodeOuter;
1444
1573
  }
1445
1574
  /**
1446
- * @deprecated Dapps should not have access to the bios. This is done for the
1447
- * settings dapp, but should be refactored out. Bios could possibly be an
1448
- * optional property of the parent context passed in for dapps that require
1449
- * elevated permissions.
1450
- * ^^^ I believe we may want this here in that is a dApp requests access to the bios it will optionally be there
1451
- */
1575
+ * @deprecated Dapps should not have access to the bios. This is done for the
1576
+ * settings dapp, but should be refactored out. Bios could possibly be an
1577
+ * optional property of the parent context passed in for dapps that require
1578
+ * elevated permissions.
1579
+ * ^^^ I believe we may want this here in that is a dApp requests access to the bios it will optionally be there
1580
+ */
1452
1581
  get kernel() {
1453
1582
  return assertEx9(this.parent.kernel, () => "Missing kernel");
1454
1583
  }
@@ -1467,15 +1596,18 @@ var XyOsDapp = class extends XyOsContextBase {
1467
1596
  assertEx9(this._root === void 0, () => "Dapp already booted");
1468
1597
  const finalLocator = locator ? (this.params.locator ?? new ModuleFactoryLocator5()).merge(locator) : this.params.locator ?? new ModuleFactoryLocator5();
1469
1598
  console.log("XyOsDapp:boot:finalLocator", finalLocator);
1470
- const dappNodesWrapper = new ManifestWrapper2({ ...this.manifest, schema: DappPackageManifestPayloadSchema2 }, wallet, finalLocator);
1599
+ const dappNodesWrapper = new ManifestWrapper2({
1600
+ ...this.manifest,
1601
+ schema: DappPackageManifestPayloadSchema2
1602
+ }, wallet, finalLocator);
1471
1603
  const dappNodes = await dappNodesWrapper.loadNodes();
1604
+ const manifest = dapp_window_manifest_default;
1472
1605
  const dappManifestWallet = await wallet.derivePath("99999");
1473
- dapp_window_manifest_default.nodes[0].config.name = this.dapp.name + "Root";
1474
- const wrapper = new ManifestWrapper2(
1475
- { ...dapp_window_manifest_default, schema: DappPackageManifestPayloadSchema2 },
1476
- dappManifestWallet,
1477
- finalLocator
1478
- );
1606
+ manifest.nodes[0].config.name = this.dapp.name + "Root";
1607
+ const wrapper = new ManifestWrapper2({
1608
+ ...manifest,
1609
+ schema: DappPackageManifestPayloadSchema2
1610
+ }, dappManifestWallet, finalLocator);
1479
1611
  const node = await wrapper.loadNodeFromIndex(0);
1480
1612
  for (const dappNode of dappNodes) {
1481
1613
  await node.register(dappNode);
@@ -1492,45 +1624,42 @@ var XyOsDapp = class extends XyOsContextBase {
1492
1624
  };
1493
1625
 
1494
1626
  // src/registration/DappRegistry.ts
1495
- import {
1496
- DappRegisteredSchema,
1497
- DappRegisteredState,
1498
- isRegisteredDappAccess
1499
- } from "@xyo-network/os-model";
1500
- import { HDWallet as HDWallet4 } from "@xyo-network/wallet";
1627
+ import { DappRegisteredSchema, DappRegisteredState, isRegisteredDappAccess } from "@xyo-network/os-model";
1628
+ import { HDWallet as HDWallet4 } from "@xyo-network/sdk-js";
1501
1629
 
1502
1630
  // src/registration/ValidateDappAccessDiviner/Config.ts
1503
- import { isPayloadOfSchemaType } from "@xyo-network/payload-model";
1504
- var FailedAccessorSchema = "network.xyo.os.failed.accessor.registration";
1631
+ import { asSchema as asSchema2, isPayloadOfSchemaType } from "@xyo-network/payload-model";
1632
+ var FailedAccessorSchema = asSchema2("network.xyo.os.failed.accessor.registration", true);
1505
1633
  var isFailedAccessor = isPayloadOfSchemaType(FailedAccessorSchema);
1506
- var ValidateDappAccessDivinerConfigSchema = "network.xyo.os.dapp.access.registration.validate";
1634
+ var ValidateDappAccessDivinerConfigSchema = asSchema2("network.xyo.os.dapp.access.registration.validate", true);
1507
1635
 
1508
1636
  // src/registration/ValidateDappAccessDiviner/Diviner.ts
1509
1637
  import { AbstractDiviner } from "@xyo-network/diviner-abstract";
1510
- import { ManifestWrapper as ManifestWrapper3, PackageManifestPayloadSchema } from "@xyo-network/manifest";
1511
- import { ModuleFactoryLocator as ModuleFactoryLocator6 } from "@xyo-network/module-factory-locator";
1512
- import {
1513
- isDappPackageManifestPayload,
1514
- isUnregisteredDappAccess,
1515
- RegisteredDappAccessSchema
1516
- } from "@xyo-network/os-model";
1517
- import { HDWallet as HDWallet3 } from "@xyo-network/wallet";
1638
+ import { isDappPackageManifestPayload, isUnregisteredDappAccess, RegisteredDappAccessSchema } from "@xyo-network/os-model";
1639
+ import { HDWallet as HDWallet3, ManifestWrapper as ManifestWrapper3, ModuleFactoryLocator as ModuleFactoryLocator6, PackageManifestPayloadSchema } from "@xyo-network/sdk-js";
1518
1640
 
1519
1641
  // src/models/access/ValidDappAccessInterfaces.ts
1520
1642
  import { RegisteredNames, RegisteredNamesInterface } from "@xyo-network/os-model";
1521
- var ValidDappAccessInterfaces = { [RegisteredNames]: RegisteredNamesInterface };
1643
+ var ValidDappAccessInterfaces = {
1644
+ [RegisteredNames]: RegisteredNamesInterface
1645
+ };
1522
1646
 
1523
1647
  // src/registration/ValidateDappAccessDiviner/Diviner.ts
1524
1648
  var ValidateDappAccessDiviner = class extends AbstractDiviner {
1525
- static configSchemas = [ValidateDappAccessDivinerConfigSchema];
1649
+ static {
1650
+ __name(this, "ValidateDappAccessDiviner");
1651
+ }
1652
+ static configSchemas = [
1653
+ ValidateDappAccessDivinerConfigSchema
1654
+ ];
1526
1655
  async divineHandler(payloads) {
1527
- const dappManifest = payloads?.filter(isDappPackageManifestPayload);
1528
- const accessors = payloads?.filter(isUnregisteredDappAccess);
1656
+ const dappManifest = payloads?.filter(isDappPackageManifestPayload) ?? [];
1657
+ const accessors = payloads?.filter(isUnregisteredDappAccess) ?? [];
1529
1658
  const dappParams = this.params.dappParams;
1530
1659
  if (dappManifest.length > 1) {
1531
1660
  throw new Error("Only one dapp manifest payload is allowed");
1532
1661
  }
1533
- if (!dappManifest || dappManifest.length === 0 || accessors?.length === 0) {
1662
+ if (dappManifest.length === 0 || accessors.length === 0) {
1534
1663
  return [];
1535
1664
  }
1536
1665
  const registeredAccessors = [];
@@ -1564,32 +1693,33 @@ var ValidateDappAccessDiviner = class extends AbstractDiviner {
1564
1693
  }
1565
1694
  }
1566
1695
  } catch (e) {
1567
- failedAccessors.push(
1568
- {
1569
- accessor: access,
1570
- errorMessage: e.message,
1571
- schema: FailedAccessorSchema
1572
- }
1573
- );
1696
+ failedAccessors.push({
1697
+ accessor: access,
1698
+ errorMessage: e.message,
1699
+ schema: FailedAccessorSchema
1700
+ });
1574
1701
  }
1575
1702
  }
1576
- return [...registeredAccessors, ...failedAccessors];
1703
+ return [
1704
+ ...registeredAccessors,
1705
+ ...failedAccessors
1706
+ ];
1577
1707
  }
1578
1708
  };
1579
- var compareChildren = (interfaceChildren, dappChildren) => {
1709
+ var compareChildren = /* @__PURE__ */ __name((interfaceChildren, dappChildren) => {
1580
1710
  return interfaceChildren.every((interfaceChild) => Object.values(interfaceChild).every((interfaceChildName) => dappChildren.some((dappChild) => Object.values(dappChild).includes(interfaceChildName))));
1581
- };
1582
- var dappPackageManifestToPackageManifest = (dappPackageManifest) => {
1711
+ }, "compareChildren");
1712
+ var dappPackageManifestToPackageManifest = /* @__PURE__ */ __name((dappPackageManifest) => {
1583
1713
  return {
1584
1714
  ...dappPackageManifest,
1585
1715
  schema: PackageManifestPayloadSchema
1586
1716
  };
1587
- };
1588
- var getChildrenFromNode = async (node) => {
1717
+ }, "dappPackageManifestToPackageManifest");
1718
+ var getChildrenFromNode = /* @__PURE__ */ __name(async (node) => {
1589
1719
  const nodeManifest = (await node.state())?.[0];
1590
1720
  return nodeManifest.status?.children;
1591
- };
1592
- var getNodeChildren = async (manifestToTest, dappParams) => {
1721
+ }, "getChildrenFromNode");
1722
+ var getNodeChildren = /* @__PURE__ */ __name(async (manifestToTest, dappParams) => {
1593
1723
  const testNodes = await getNodeToTest(manifestToTest, dappParams);
1594
1724
  const children = [];
1595
1725
  for (const node of testNodes) {
@@ -1599,36 +1729,30 @@ var getNodeChildren = async (manifestToTest, dappParams) => {
1599
1729
  }
1600
1730
  }
1601
1731
  return children;
1602
- };
1603
- var getNodeToTest = async (manifestToTest, dappParams) => {
1732
+ }, "getNodeChildren");
1733
+ var getNodeToTest = /* @__PURE__ */ __name(async (manifestToTest, dappParams) => {
1604
1734
  const dappManifestWrapper = new ManifestWrapper3(manifestToTest, await HDWallet3.random(), dappParams.locator ?? new ModuleFactoryLocator6());
1605
1735
  return await dappManifestWrapper.loadNodes();
1606
- };
1736
+ }, "getNodeToTest");
1607
1737
 
1608
1738
  // src/registration/DappRegistry.ts
1609
1739
  var DappRegistry = class {
1740
+ static {
1741
+ __name(this, "DappRegistry");
1742
+ }
1610
1743
  dappRegistry = /* @__PURE__ */ new Map();
1611
1744
  dappSeedPhraseRepository;
1612
1745
  constructor(dappSeedPhraseRepository) {
1613
1746
  this.dappSeedPhraseRepository = dappSeedPhraseRepository;
1614
1747
  }
1615
1748
  /**
1616
- * Register a Dapp with window manager and if successful, return its id
1617
- *
1618
- * @param {UnregisteredDapp} dapp Manifest and UI of the Dapp to register
1619
- * @returns {RegisteredDapp} dapp with registration fields
1620
- **/
1749
+ * Register a Dapp with window manager and if successful, return its id
1750
+ * @param dapp Manifest and UI of the Dapp to register
1751
+ * @returns dapp with registration fields
1752
+ */
1621
1753
  async registerDapp(dapp) {
1622
1754
  if (dapp) {
1623
- const {
1624
- exposedModuleIds,
1625
- manifest,
1626
- modes,
1627
- name,
1628
- version,
1629
- params,
1630
- widgetConfigs
1631
- } = this.extractDappProperties(dapp);
1755
+ const { exposedModuleIds, manifest, modes, name, version, params, widgetConfigs } = this.extractDappProperties(dapp);
1632
1756
  try {
1633
1757
  const walletId = await this.dappSeedPhraseRepository.findOrCreate(name);
1634
1758
  const registeredAccessors = await this.validateDappAccessPayloads(manifest, dapp.accessors, params);
@@ -1663,27 +1787,15 @@ var DappRegistry = class {
1663
1787
  }
1664
1788
  }
1665
1789
  /**
1666
- * Unregister a dapp so it can no longer be launched
1667
- *
1668
- * @param dappId
1669
- */
1790
+ * Unregister a dapp so it can no longer be launched
1791
+ * @param dappId
1792
+ */
1670
1793
  unregisterDapp(dappId) {
1671
1794
  this.dappRegistry.delete(dappId);
1672
1795
  }
1673
1796
  extractDappProperties(dapp) {
1674
- const {
1675
- params,
1676
- config,
1677
- widgetConfigs
1678
- } = dapp;
1679
- const {
1680
- exposedModuleIds,
1681
- manifest,
1682
- modes,
1683
- name,
1684
- sources,
1685
- version
1686
- } = config;
1797
+ const { params, config, widgetConfigs } = dapp;
1798
+ const { exposedModuleIds, manifest, modes, name, sources, version } = config;
1687
1799
  return {
1688
1800
  exposedModuleIds,
1689
1801
  manifest,
@@ -1698,10 +1810,15 @@ var DappRegistry = class {
1698
1810
  async validateDappAccessPayloads(manifest, accessors = [], params) {
1699
1811
  const validateDappAccess = await ValidateDappAccessDiviner.create({
1700
1812
  account: await HDWallet4.random(),
1701
- config: { schema: ValidateDappAccessDivinerConfigSchema },
1813
+ config: {
1814
+ schema: ValidateDappAccessDivinerConfigSchema
1815
+ },
1702
1816
  dappParams: params
1703
1817
  });
1704
- const payloads = await validateDappAccess.divine([manifest, ...accessors]);
1818
+ const payloads = await validateDappAccess.divine([
1819
+ manifest,
1820
+ ...accessors
1821
+ ]);
1705
1822
  const failedAccessors = payloads.filter(isFailedAccessor);
1706
1823
  const registeredAccessors = payloads.filter(isRegisteredDappAccess);
1707
1824
  if (failedAccessors.length > 0) {
@@ -1713,6 +1830,9 @@ var DappRegistry = class {
1713
1830
 
1714
1831
  // src/registration/DappRegistrationService.ts
1715
1832
  var DappRegistrationService = class {
1833
+ static {
1834
+ __name(this, "DappRegistrationService");
1835
+ }
1716
1836
  // Dapps that have been built with their own context
1717
1837
  builtDapps = {};
1718
1838
  dappRegistry;
@@ -1739,21 +1859,17 @@ var DappRegistrationService = class {
1739
1859
  };
1740
1860
  this.locator = locator;
1741
1861
  this.developmentMode = developmentMode;
1742
- this.manageSystemDapps = new ManageSystemDapps(
1743
- context,
1744
- this.params?.dappNames ?? [],
1745
- this.params?.dappPayloads ?? [],
1746
- this.params?.dappParams ?? {},
1747
- this.locator,
1748
- this.developmentMode
1749
- );
1862
+ this.manageSystemDapps = new ManageSystemDapps(context, this.params?.dappNames ?? [], this.params?.dappPayloads ?? [], this.params?.dappParams ?? {}, this.locator, this.developmentMode);
1750
1863
  this.dappSeedPhraseRepository = new DappSeedPhraseRepository(context, this.params?.dappNames ?? []);
1751
1864
  this.dappRegistry = new DappRegistry(this.dappSeedPhraseRepository);
1752
1865
  this.addConnectionRequests();
1753
1866
  }
1754
1867
  async buildDapp(manifest, dappId = NameTransforms.slug(manifest.nodes[0]?.config.name), name = NameTransforms.moduleName(manifest.nodes[0]?.config.name)) {
1755
1868
  const dapp = new XyOsDapp({
1756
- dapp: { id: dappId, name },
1869
+ dapp: {
1870
+ id: dappId,
1871
+ name
1872
+ },
1757
1873
  locator: this.locator,
1758
1874
  manifest,
1759
1875
  parent: this.context,
@@ -1766,37 +1882,46 @@ var DappRegistrationService = class {
1766
1882
  return this.params?.dappParams[dappId];
1767
1883
  }
1768
1884
  async start() {
1769
- const systemDapps = await this.context.monitor(async () => await this.manageSystemDapps.install(), { name: "Install System dApps" });
1885
+ const systemDapps = await this.context.monitor(async () => await this.manageSystemDapps.install(), {
1886
+ name: "Install System dApps"
1887
+ });
1770
1888
  const activeDapps = systemDapps.filter(({ dapp }) => dapp.icon.active === true);
1771
- const results = await Promise.allSettled(
1772
- activeDapps.map(async (dappSet) => {
1773
- const { dapp } = dappSet;
1774
- const registeredDapp = await this.dappRegistry.registerDapp(dapp);
1775
- const result = { dapp: registeredDapp, dappIcon: dapp.icon };
1776
- const forgetHandlers = async () => {
1777
- try {
1778
- await this.postRegistrationHandlers(result);
1779
- } catch (e) {
1780
- console.error("Error in post registration handlers", e);
1781
- }
1782
- };
1783
- forget2(forgetHandlers());
1784
- return result;
1785
- })
1786
- );
1787
- const failed = results.filter(rejected).map((result) => result.reason);
1889
+ const results = await Promise.allSettled(activeDapps.map(async (dappSet) => {
1890
+ const { dapp } = dappSet;
1891
+ const registeredDapp = await this.dappRegistry.registerDapp(dapp);
1892
+ const result = {
1893
+ dapp: registeredDapp,
1894
+ dappIcon: dapp.icon
1895
+ };
1896
+ const forgetHandlers = /* @__PURE__ */ __name(async () => {
1897
+ try {
1898
+ await this.postRegistrationHandlers(result);
1899
+ } catch (e) {
1900
+ console.error("Error in post registration handlers", e);
1901
+ }
1902
+ }, "forgetHandlers");
1903
+ forget2(forgetHandlers());
1904
+ return result;
1905
+ }));
1906
+ const failed = results.filter(rejected).map((result) => {
1907
+ const reason = result.reason;
1908
+ return reason instanceof Error ? reason.message : String(reason);
1909
+ });
1788
1910
  const succeeded = results.filter(fulfilled).map((result) => result.value);
1789
1911
  for (const registeredDapp of succeeded) this.registeredDappSets.add(registeredDapp);
1790
- return { failed, succeeded };
1912
+ return {
1913
+ failed,
1914
+ succeeded
1915
+ };
1791
1916
  }
1792
1917
  addConnectionRequests() {
1793
1918
  this.context.eventBus.addConnection(this.dappAccessRequestConnection);
1794
1919
  this.context.eventBus.addConnection(this.exposeDappRequestConnection);
1795
1920
  }
1796
1921
  /**
1797
- * A method to get the user property from context and eventually modify it before handing it to a dapp
1798
- * i.e. curating user-approved signers
1799
- */
1922
+ * A method to get the user property from context and eventually modify it before handing it to a dapp
1923
+ * i.e. curating user-approved signers
1924
+ */
1800
1925
  getUser() {
1801
1926
  return this.context.user;
1802
1927
  }
@@ -1804,26 +1929,31 @@ var DappRegistrationService = class {
1804
1929
  if (registeredDapp.dapp) {
1805
1930
  if (isRegisteredDappExposedDappSet(registeredDapp)) {
1806
1931
  this.registeredExposedDappSets.add(registeredDapp);
1807
- const exposeIntent = DappIntentCaller.buildIntent(
1808
- DappIntentCaller.OsDappName,
1809
- DappIntentTypes.Launch,
1810
- registeredDapp.dapp.config.name,
1811
- DappMode2.Exposed
1812
- );
1813
- await this.exposeDappRequestConnection.emit(ExposeDappRequestEvent, { payloads: [registeredDapp.dapp.config, exposeIntent] });
1932
+ const exposeIntent = DappIntentCaller.buildIntent(DappIntentCaller.OsDappName, DappIntentTypes.Launch, registeredDapp.dapp.config.name, DappMode2.Exposed);
1933
+ await this.exposeDappRequestConnection.emit(ExposeDappRequestEvent, {
1934
+ payloads: [
1935
+ registeredDapp.dapp.config,
1936
+ exposeIntent
1937
+ ]
1938
+ });
1814
1939
  }
1815
1940
  if (isRegisteredDappAccessDappSet(registeredDapp)) {
1816
1941
  this.registeredAccessDappSets.add(registeredDapp);
1817
- await this.dappAccessRequestConnection.emit(DappAccessRequestEvent, { payloads: registeredDapp.dapp.accessors });
1942
+ await this.dappAccessRequestConnection.emit(DappAccessRequestEvent, {
1943
+ payloads: registeredDapp.dapp.accessors
1944
+ });
1818
1945
  }
1819
1946
  }
1820
1947
  }
1821
1948
  };
1822
1949
 
1823
1950
  // src/signer/Signers.ts
1824
- import { assertEx as assertEx10 } from "@xylabs/assert";
1825
- import { HDWallet as HDWallet5 } from "@xyo-network/wallet";
1951
+ import { assertEx as assertEx10 } from "@xylabs/sdk-js";
1952
+ import { HDWallet as HDWallet5 } from "@xyo-network/sdk-js";
1826
1953
  var Signers = class {
1954
+ static {
1955
+ __name(this, "Signers");
1956
+ }
1827
1957
  _paths;
1828
1958
  _signerAccounts;
1829
1959
  _walletStore;
@@ -1869,12 +1999,13 @@ var Signers = class {
1869
1999
  };
1870
2000
 
1871
2001
  // src/stack/Base.ts
1872
- import { assertEx as assertEx11 } from "@xylabs/assert";
1873
- import { BaseEmitter as BaseEmitter3 } from "@xylabs/events";
1874
- import { forget as forget3 } from "@xylabs/forget";
2002
+ import { assertEx as assertEx11, BaseEmitter as BaseEmitter3, forget as forget3 } from "@xylabs/sdk-js";
1875
2003
  import { isModuleInstance } from "@xyo-network/module-model";
1876
2004
  import { asAttachableNodeInstance } from "@xyo-network/node-model";
1877
2005
  var StackBase = class extends BaseEmitter3 {
2006
+ static {
2007
+ __name(this, "StackBase");
2008
+ }
1878
2009
  // flag to check that all adapters are initialized
1879
2010
  initialized = false;
1880
2011
  // adapters to initialize into the stack
@@ -1891,7 +2022,7 @@ var StackBase = class extends BaseEmitter3 {
1891
2022
  constructor(context, adapterSet, stackNodeModuleId) {
1892
2023
  super({});
1893
2024
  this._context = context;
1894
- this._adapterSet = adapterSet(assertEx11(this.context.kernel, "Kernel access required"));
2025
+ this._adapterSet = adapterSet(assertEx11(this.context.kernel, () => "Kernel access required"));
1895
2026
  this._stackNodeModuleId = stackNodeModuleId;
1896
2027
  }
1897
2028
  get adapterSet() {
@@ -1909,84 +2040,95 @@ var StackBase = class extends BaseEmitter3 {
1909
2040
  initialize() {
1910
2041
  this.assignStack();
1911
2042
  for (const adapter of this.adapterSet) {
1912
- const driverReadyListener = async ({ node }) => await this.handleDriverReady(node);
2043
+ const driverReadyListener = /* @__PURE__ */ __name(async ({ node }) => await this.handleDriverReady(node), "driverReadyListener");
1913
2044
  adapter.on("driverReady", driverReadyListener);
1914
2045
  this.listeners.push({
1915
2046
  adapter,
1916
2047
  eventName: "driverReady",
1917
2048
  listener: driverReadyListener
1918
2049
  });
1919
- const driverErrorListener = async ({ error }) => {
2050
+ const driverErrorListener = /* @__PURE__ */ __name(async ({ error }) => {
1920
2051
  console.error(`Error updating ${this.stackNodeModuleId} stack node`, error);
1921
- await this.emit("driverError", { error });
1922
- };
2052
+ await this.emit("driverError", {
2053
+ error
2054
+ });
2055
+ }, "driverErrorListener");
1923
2056
  adapter.on("driverError", driverErrorListener);
1924
2057
  this.listeners.push({
1925
2058
  adapter,
1926
2059
  eventName: "driverError",
1927
2060
  listener: driverErrorListener
1928
2061
  });
1929
- const startAdapter = async () => await adapter.start();
2062
+ const startAdapter = /* @__PURE__ */ __name(async () => await adapter.start(), "startAdapter");
1930
2063
  forget3(startAdapter());
1931
2064
  }
1932
2065
  }
1933
2066
  /**
1934
- * Stops the stack
1935
- */
2067
+ * Stops the stack
2068
+ */
1936
2069
  stop() {
1937
- for (const {
1938
- eventName,
1939
- listener,
1940
- adapter
1941
- } of this.listeners) {
2070
+ for (const { eventName, listener, adapter } of this.listeners) {
1942
2071
  adapter.off(eventName, listener);
1943
2072
  }
1944
2073
  }
1945
2074
  /**
1946
- * Adds a node to the stack. Idempotent to avoid adding the
1947
- * same node multiple times
1948
- * @param node The node to add to the stack
1949
- * @returns
1950
- */
2075
+ * Adds a node to the stack. Idempotent to avoid adding the
2076
+ * same node multiple times
2077
+ * @param node The node to add to the stack
2078
+ * @returns
2079
+ */
1951
2080
  async addNodeToStackNode(node) {
1952
2081
  const stackNode = await this.getStackNode();
1953
- const existingModule = await stackNode.resolve(node.address, { direction: "down" });
2082
+ const existingModule = await stackNode.resolve(node.address, {
2083
+ direction: "down"
2084
+ });
1954
2085
  if (isModuleInstance(existingModule)) return;
1955
2086
  await stackNode.register?.(node);
1956
2087
  await stackNode.attach?.(node.address, true);
1957
2088
  }
1958
2089
  assignStack() {
1959
- const assign = async () => {
2090
+ const assign = /* @__PURE__ */ __name(async () => {
1960
2091
  const stackNode = await this.getStackNode();
1961
2092
  this._stack = stackNode;
1962
- };
2093
+ }, "assign");
1963
2094
  forget3(assign());
1964
2095
  }
1965
2096
  async getStackNode() {
1966
2097
  const mod = assertEx11(await this.context.root.resolve(this.stackNodeModuleId), () => `${this.stackNodeModuleId} not found`);
1967
- return asAttachableNodeInstance(mod, () => `${this.stackNodeModuleId} not a NodeInstance`, { required: true });
2098
+ return asAttachableNodeInstance(mod, () => `${this.stackNodeModuleId} not a NodeInstance`, {
2099
+ required: true
2100
+ });
1968
2101
  }
1969
2102
  async handleDriverReady(node) {
1970
2103
  try {
1971
- await this.emit("driverReady", { node });
2104
+ await this.emit("driverReady", {
2105
+ node
2106
+ });
1972
2107
  await this.addNodeToStackNode(node);
1973
2108
  await this.updateInitializationState(node);
1974
2109
  } catch (error) {
1975
2110
  console.error(`Error updating ${this.stackNodeModuleId} stack node`, node.id, error);
1976
- await this.emit("stackError", { error });
2111
+ await this.emit("stackError", {
2112
+ error
2113
+ });
1977
2114
  }
1978
2115
  }
1979
2116
  async updateInitializationState(node) {
1980
2117
  this.initializedNodes.push(node);
1981
2118
  this.initialized = this.adapterSet.every((n) => n.initialized);
1982
2119
  if (this.initialized) {
1983
- await this.emit("initialized", { stack: await this.getStackNode() });
2120
+ await this.emit("initialized", {
2121
+ stack: await this.getStackNode()
2122
+ });
1984
2123
  }
1985
2124
  }
1986
2125
  };
1987
2126
 
1988
2127
  // src/stack/Manager.ts
1989
2128
  var StackManager = class {
2129
+ static {
2130
+ __name(this, "StackManager");
2131
+ }
1990
2132
  initializedStacksMap = /* @__PURE__ */ new Map();
1991
2133
  stackMap;
1992
2134
  constructor(stackMap) {
@@ -2021,13 +2163,15 @@ var StackManager = class {
2021
2163
  import { ExposedNodeOuterNodeName, PubSubBridgeNodeNodeName } from "@xyo-network/os-model";
2022
2164
 
2023
2165
  // src/adapter/Base.ts
2024
- import { assertEx as assertEx12 } from "@xylabs/assert";
2025
- import { BaseEmitter as BaseEmitter4 } from "@xylabs/events";
2026
- import { forget as forget4 } from "@xylabs/forget";
2166
+ import { assertEx as assertEx12, BaseEmitter as BaseEmitter4, forget as forget4 } from "@xylabs/sdk-js";
2027
2167
  import { asArchivistInstance as asArchivistInstance5 } from "@xyo-network/archivist";
2028
2168
  import { asAttachableNodeInstance as asAttachableNodeInstance2 } from "@xyo-network/node-model";
2169
+ import { asSchema as asSchema3 } from "@xyo-network/payload-model";
2029
2170
  import { v4 as uuid3 } from "uuid";
2030
2171
  var NodeAdapterBase = class extends BaseEmitter4 {
2172
+ static {
2173
+ __name(this, "NodeAdapterBase");
2174
+ }
2031
2175
  initialized = false;
2032
2176
  _id = "";
2033
2177
  driverName;
@@ -2043,14 +2187,14 @@ var NodeAdapterBase = class extends BaseEmitter4 {
2043
2187
  }
2044
2188
  async start() {
2045
2189
  try {
2046
- const moduleAttachedInsertListener = ({ payloads }) => {
2190
+ const moduleAttachedInsertListener = /* @__PURE__ */ __name(({ payloads }) => {
2047
2191
  const moduleAttachedEvent = this.findModuleEventPayloads(payloads);
2048
2192
  for (const payload of moduleAttachedEvent) {
2049
2193
  if (payload.name === this.driverName) {
2050
2194
  this.validateAndReturnDriver();
2051
2195
  }
2052
2196
  }
2053
- };
2197
+ }, "moduleAttachedInsertListener");
2054
2198
  const eventsArchivist = await this.getEventsArchivist();
2055
2199
  const weakRefInsertListener = new WeakRef(moduleAttachedInsertListener);
2056
2200
  const insertListenerRef = weakRefInsertListener.deref();
@@ -2059,25 +2203,33 @@ var NodeAdapterBase = class extends BaseEmitter4 {
2059
2203
  if (node) return node;
2060
2204
  this.initialized = false;
2061
2205
  } catch (error) {
2062
- await this.emit("driverError", { error });
2206
+ await this.emit("driverError", {
2207
+ error
2208
+ });
2063
2209
  }
2064
2210
  }
2065
2211
  findModuleEventPayloads(payloads) {
2066
2212
  return payloads.filter((payload) => {
2067
2213
  const payloadToTest = payload;
2068
- return payloadToTest.event === "driverReady" && payloadToTest.schema === "network.xyo.kernel.module.event";
2214
+ return payloadToTest.event === "driverReady" && payloadToTest.schema === asSchema3("network.xyo.kernel.module.event", true);
2069
2215
  });
2070
2216
  }
2071
2217
  async getEventsArchivist() {
2072
2218
  const mod = assertEx12(await (await this.kernel.getNode()).resolve("KernelNode:ModuleEvents"), () => "KernelNode:ModuleEvents not found");
2073
- return asArchivistInstance5(mod, () => `${mod.id} is not an archivist`, { required: true });
2219
+ return asArchivistInstance5(mod, () => `${mod.id} is not an archivist`, {
2220
+ required: true
2221
+ });
2074
2222
  }
2075
2223
  validateAndReturnDriver() {
2076
2224
  const mod = this.kernel.initialized[this.driverName];
2077
2225
  if (mod) {
2078
- const node = asAttachableNodeInstance2(mod, () => `${mod.id} is not a node`, { required: true });
2226
+ const node = asAttachableNodeInstance2(mod, () => `${mod.id} is not a node`, {
2227
+ required: true
2228
+ });
2079
2229
  this.initialized = true;
2080
- const emit = async () => await this.emit("driverReady", { node });
2230
+ const emit = /* @__PURE__ */ __name(async () => await this.emit("driverReady", {
2231
+ node
2232
+ }), "emit");
2081
2233
  forget4(emit());
2082
2234
  return node;
2083
2235
  }
@@ -2086,6 +2238,9 @@ var NodeAdapterBase = class extends BaseEmitter4 {
2086
2238
 
2087
2239
  // src/adapter/Network.ts
2088
2240
  var NetworkAdapter = class extends NodeAdapterBase {
2241
+ static {
2242
+ __name(this, "NetworkAdapter");
2243
+ }
2089
2244
  _connection;
2090
2245
  constructor(kernel, driverName) {
2091
2246
  super(kernel, driverName);
@@ -2106,6 +2261,9 @@ var NetworkAdapter = class extends NodeAdapterBase {
2106
2261
 
2107
2262
  // src/adapter/Settings.ts
2108
2263
  var SettingsAdapter = class extends NodeAdapterBase {
2264
+ static {
2265
+ __name(this, "SettingsAdapter");
2266
+ }
2109
2267
  _settings = void 0;
2110
2268
  constructor(kernel, driverName) {
2111
2269
  super(kernel, driverName);
@@ -2125,26 +2283,31 @@ var SettingsAdapter = class extends NodeAdapterBase {
2125
2283
  };
2126
2284
 
2127
2285
  // src/adapters/OsPubSubBridgeNetwork.ts
2128
- var OsPubSubBridgeNetworkAdapters = (kernel) => [
2286
+ var OsPubSubBridgeNetworkAdapters = /* @__PURE__ */ __name((kernel) => [
2129
2287
  new NetworkAdapter(kernel, PubSubBridgeNodeNodeName),
2130
2288
  new NetworkAdapter(kernel, ExposedNodeOuterNodeName)
2131
- ];
2289
+ ], "OsPubSubBridgeNetworkAdapters");
2132
2290
 
2133
2291
  // src/adapters/OsSettings.ts
2134
2292
  import { OsSettingsNodeName } from "@xyo-network/os-model";
2135
- var OsSettingsAdapters = (kernel) => [new SettingsAdapter(kernel, OsSettingsNodeName)];
2293
+ var OsSettingsAdapters = /* @__PURE__ */ __name((kernel) => [
2294
+ new SettingsAdapter(kernel, OsSettingsNodeName)
2295
+ ], "OsSettingsAdapters");
2136
2296
 
2137
2297
  // src/adapters/OsXyoPublicNetwork.ts
2138
2298
  import { XyoPublicNodeName } from "@xyo-network/os-model";
2139
- var OsXyoPublicNetworkAdapters = (kernel) => [
2299
+ var OsXyoPublicNetworkAdapters = /* @__PURE__ */ __name((kernel) => [
2140
2300
  new NetworkAdapter(kernel, XyoPublicNodeName)
2141
- ];
2301
+ ], "OsXyoPublicNetworkAdapters");
2142
2302
 
2143
2303
  // src/stack/OsPubSubNetworkStack.ts
2144
- import { assertEx as assertEx13 } from "@xylabs/assert";
2304
+ import { assertEx as assertEx13 } from "@xylabs/sdk-js";
2145
2305
  import { asAttachableNodeInstance as asAttachableNodeInstance3, asNodeInstance } from "@xyo-network/node-model";
2146
2306
  import { ExposedNodeOuterNodeName as ExposedNodeOuterNodeName2, PubSubBridgeNodeNodeName as PubSubBridgeNodeNodeName2 } from "@xyo-network/os-model";
2147
2307
  var OsPubSubNetworkStack = class extends StackBase {
2308
+ static {
2309
+ __name(this, "OsPubSubNetworkStack");
2310
+ }
2148
2311
  _exposedNode;
2149
2312
  _exposedNodeOuter;
2150
2313
  busConnection = osPubSubNetworkReadyConnection();
@@ -2187,13 +2350,15 @@ var OsPubSubNetworkStack = class extends StackBase {
2187
2350
  super.stop();
2188
2351
  this._exposedNode = void 0;
2189
2352
  this._exposedNodeOuter = void 0;
2190
- if (this.busConnection._id)
2191
- this.context.eventBus.removeConnection(this.busConnection.id);
2353
+ if (this.busConnection._id) this.context.eventBus.removeConnection(this.busConnection.id);
2192
2354
  }
2193
2355
  };
2194
2356
 
2195
2357
  // src/stack/OsSettingsStack.ts
2196
2358
  var OsSettingsStack = class extends StackBase {
2359
+ static {
2360
+ __name(this, "OsSettingsStack");
2361
+ }
2197
2362
  busConnection = osSettingsReadyConnection();
2198
2363
  constructor(context, adapters) {
2199
2364
  super(context, adapters, "OsSettingsStackNode");
@@ -2211,6 +2376,9 @@ var OsSettingsStack = class extends StackBase {
2211
2376
  // src/stack/XyoPublicNetworkStack.ts
2212
2377
  import { XyoPublicNodeName as XyoPublicNodeName2 } from "@xyo-network/os-model";
2213
2378
  var XyoPublicNetworkStack = class extends StackBase {
2379
+ static {
2380
+ __name(this, "XyoPublicNetworkStack");
2381
+ }
2214
2382
  busConnection = osXyoPublicNetworkReadyConnection();
2215
2383
  constructor(context, adapters) {
2216
2384
  super(context, adapters, "OsXyoPublicNetworkStackNode");
@@ -2249,6 +2417,9 @@ var OsStackMap = {
2249
2417
 
2250
2418
  // src/XyOs.ts
2251
2419
  var XyOs = class _XyOs extends XyOsContextBase {
2420
+ static {
2421
+ __name(this, "XyOs");
2422
+ }
2252
2423
  _exposedNode;
2253
2424
  _exposedNodeOuter;
2254
2425
  _kernel;
@@ -2256,16 +2427,9 @@ var XyOs = class _XyOs extends XyOsContextBase {
2256
2427
  dappRegistrationService;
2257
2428
  signers;
2258
2429
  stackManager;
2259
- constructor({
2260
- logger = console,
2261
- eventBus = new EventBus(),
2262
- kernel = new Kernel({ logger }),
2263
- locator = new ModuleFactoryLocator8(),
2264
- dappsConfiguration,
2265
- developmentMode,
2266
- stackMap = OsStackMap,
2267
- ...params
2268
- } = {}) {
2430
+ constructor({ logger = console, eventBus = new EventBus(), kernel = new Kernel({
2431
+ logger
2432
+ }), locator = new ModuleFactoryLocator8(), dappsConfiguration, developmentMode, stackMap = OsStackMap, ...params } = {}) {
2269
2433
  super({
2270
2434
  eventBus,
2271
2435
  kernel,
@@ -2303,14 +2467,19 @@ var XyOs = class _XyOs extends XyOsContextBase {
2303
2467
  return this.stackManager.stacks;
2304
2468
  }
2305
2469
  get user() {
2306
- return { signers: this.signers?.getWalletKindSigner("user") };
2470
+ return {
2471
+ signers: this.signers?.getWalletKindSigner("user")
2472
+ };
2307
2473
  }
2308
2474
  static async monitor(fn, eventConfig) {
2309
2475
  const { name, additionalProperties } = eventConfig;
2310
2476
  const monitor = this.monitoring;
2311
2477
  monitor?.startTimer(name);
2312
2478
  const result = await fn();
2313
- monitor?.stopTimer({ additionalProperties, name });
2479
+ monitor?.stopTimer({
2480
+ additionalProperties,
2481
+ name
2482
+ });
2314
2483
  return result;
2315
2484
  }
2316
2485
  async boot(wallet, locator = new ModuleFactoryLocator8()) {
@@ -2319,13 +2488,18 @@ var XyOs = class _XyOs extends XyOsContextBase {
2319
2488
  return await this._bootMutex.runExclusive(async () => {
2320
2489
  await this.eventBus.start();
2321
2490
  if (this.kernel?.status === "created") {
2322
- await this.kernel.boot(await boot(), { locator: fullLocator, kernelDrivers: [] });
2491
+ await this.kernel.boot(await boot(), {
2492
+ locator: fullLocator,
2493
+ kernelDrivers: []
2494
+ });
2323
2495
  }
2324
2496
  if (this.kernel?.status !== "booted") {
2325
2497
  throw new Error("Kernel not booted");
2326
2498
  }
2327
2499
  assertEx14(this._root === void 0, () => "XyOs already booted");
2328
- const [root] = await _XyOs.monitor(async () => await loadOsNode(wallet, fullLocator), { name: "Load XyOs" });
2500
+ const [root] = await _XyOs.monitor(async () => await loadOsNode(wallet, fullLocator), {
2501
+ name: "Load XyOs"
2502
+ });
2329
2503
  this._root = root;
2330
2504
  this.stackManager.initialize(this);
2331
2505
  if (this.signers) await this.signers.initialize();
@@ -2357,25 +2531,30 @@ var XyOs = class _XyOs extends XyOsContextBase {
2357
2531
  // src/RunningDappCache.ts
2358
2532
  var findOrCreateMutex = new Mutex3();
2359
2533
  var RunningDappCache = class _RunningDappCache {
2534
+ static {
2535
+ __name(this, "RunningDappCache");
2536
+ }
2360
2537
  static _cache = {};
2361
2538
  static async findOrCreate(dapp, xyOs, allowedNames, xnsNodeUrl, xnsNetwork) {
2362
2539
  const dappId = dapp.config.name;
2363
- return await XyOs.monitor(
2364
- async () => await findOrCreateMutex.runExclusive(async () => {
2365
- const existingWindowDappSet = _RunningDappCache.get(dappId);
2366
- if (existingWindowDappSet) {
2367
- console.debug("[DEBUG]", `RunningDappCache, using existing node for ${dappId}`);
2368
- const existingDappContext = assertEx15(existingWindowDappSet.context, () => "No context found in existing dapp node");
2369
- await DappContextCreator.primeDappArchivist(existingDappContext, xyOs, dappId);
2370
- return existingWindowDappSet;
2371
- }
2372
- console.debug("[DEBUG]", "RunningDappCache:creating", dappId);
2373
- const windowDappSet = await createDappContext(dapp, xyOs, allowedNames, xnsNodeUrl, xnsNetwork);
2374
- _RunningDappCache.set(dappId, windowDappSet);
2375
- return windowDappSet;
2376
- }),
2377
- { additionalProperties: { dappId }, name: "Loading dApp" }
2378
- );
2540
+ return await XyOs.monitor(async () => await findOrCreateMutex.runExclusive(async () => {
2541
+ const existingWindowDappSet = _RunningDappCache.get(dappId);
2542
+ if (existingWindowDappSet) {
2543
+ console.debug("[DEBUG]", `RunningDappCache, using existing node for ${dappId}`);
2544
+ const existingDappContext = assertEx15(existingWindowDappSet.context, () => "No context found in existing dapp node");
2545
+ await DappContextCreator.primeDappArchivist(existingDappContext, xyOs, dappId);
2546
+ return existingWindowDappSet;
2547
+ }
2548
+ console.debug("[DEBUG]", "RunningDappCache:creating", dappId);
2549
+ const windowDappSet = await createDappContext(dapp, xyOs, allowedNames, xnsNodeUrl, xnsNetwork);
2550
+ _RunningDappCache.set(dappId, windowDappSet);
2551
+ return windowDappSet;
2552
+ }), {
2553
+ additionalProperties: {
2554
+ dappId
2555
+ },
2556
+ name: "Loading dApp"
2557
+ });
2379
2558
  }
2380
2559
  static get(key) {
2381
2560
  return this._cache[key];
@@ -2390,6 +2569,9 @@ var RunningDappCache = class _RunningDappCache {
2390
2569
 
2391
2570
  // src/access/RunningAccessDappCache.ts
2392
2571
  var RunningDappAccessCache = class {
2572
+ static {
2573
+ __name(this, "RunningDappAccessCache");
2574
+ }
2393
2575
  static _cache = {};
2394
2576
  static get(key) {
2395
2577
  return this._cache[key];
@@ -2404,6 +2586,9 @@ var RunningDappAccessCache = class {
2404
2586
 
2405
2587
  // src/access/Caller.ts
2406
2588
  var DappAccessCaller = class extends OsCallerBase {
2589
+ static {
2590
+ __name(this, "DappAccessCaller");
2591
+ }
2407
2592
  allowedNames;
2408
2593
  platformLocator;
2409
2594
  registeredDapps;
@@ -2435,23 +2620,32 @@ var DappAccessCaller = class extends OsCallerBase {
2435
2620
  async cacheAccessNode(dappAccessor, context) {
2436
2621
  const accessNodeId = dappAccessor.rootModuleId;
2437
2622
  const accessNodeModule = assertEx16(await context.root.resolve(accessNodeId), () => "Access Node Module not found");
2438
- const accessNode = asNodeInstance2(accessNodeModule, () => "Access Node Module is not a NodeInstance", { required: true });
2623
+ const accessNode = asNodeInstance2(accessNodeModule, () => "Access Node Module is not a NodeInstance", {
2624
+ required: true
2625
+ });
2439
2626
  RunningDappAccessCache.set(dappAccessor.registeringDappId, accessNode);
2440
2627
  }
2441
2628
  async saveRegisteredDappInterfaces(registeredDappAccess) {
2442
2629
  const archivist = await this.getRegisteredDappInterfacesArchivist();
2443
2630
  const hash = await PayloadBuilder5.dataHash(registeredDappAccess);
2444
- const [existing] = await archivist.get([hash]);
2631
+ const [existing] = await archivist.get([
2632
+ hash
2633
+ ]);
2445
2634
  if (existing) return;
2446
- await archivist.insert([registeredDappAccess]);
2635
+ await archivist.insert([
2636
+ registeredDappAccess
2637
+ ]);
2447
2638
  console.debug("[DEBUG] -", `Registered ${registeredDappAccess.registeringDappId} with ${registeredDappAccess.name} interface`);
2448
2639
  }
2449
2640
  };
2450
2641
 
2451
2642
  // src/access/interfaces/registered-names/helpers/AccessNodeQueries.ts
2452
- import { assertEx as assertEx17 } from "@xylabs/assert";
2643
+ import { assertEx as assertEx17 } from "@xylabs/sdk-js";
2453
2644
  import { asArchivistInstance as asArchivistInstance6 } from "@xyo-network/archivist-model";
2454
2645
  var AccessNodeQueries = class {
2646
+ static {
2647
+ __name(this, "AccessNodeQueries");
2648
+ }
2455
2649
  xyOsContext;
2456
2650
  accessRequest;
2457
2651
  registeredDappAccess;
@@ -2477,9 +2671,11 @@ var AccessNodeQueries = class {
2477
2671
  return payloads;
2478
2672
  }
2479
2673
  async getArchivistFromDappNode() {
2480
- const archivistPath = this.accessRequest?.destinationArchivist || "DappArchivist";
2674
+ const archivistPath = this.accessRequest?.destinationArchivist ?? "DappArchivist";
2481
2675
  const mod = assertEx17(await this.xyOsContext.root.resolve(archivistPath), () => `Unable to find archivist at ${archivistPath}`);
2482
- return asArchivistInstance6(mod, () => `Module at ${archivistPath} is not an archivist`, { required: true });
2676
+ return asArchivistInstance6(mod, () => `Module at ${archivistPath} is not an archivist`, {
2677
+ required: true
2678
+ });
2483
2679
  }
2484
2680
  async getPayloadsFromAccessNode() {
2485
2681
  const archivistFromAccessNode = await this.resolveArchivistFromAccessNode();
@@ -2491,76 +2687,91 @@ var AccessNodeQueries = class {
2491
2687
  await archivist.insert(payloads);
2492
2688
  }
2493
2689
  async resolveArchivistFromAccessNode() {
2494
- const archivist = assertEx17(
2495
- await this.nameServiceNamesAccessNode.resolve("PublicXnsArchivist"),
2496
- () => "Unable to find archivist at PublicXnsArchivist"
2497
- );
2498
- return asArchivistInstance6(archivist, () => "PublicXnsArchivist is not an archivist", { required: true });
2690
+ const archivist = assertEx17(await this.nameServiceNamesAccessNode.resolve("PublicXnsArchivist"), () => "Unable to find archivist at PublicXnsArchivist");
2691
+ return asArchivistInstance6(archivist, () => "PublicXnsArchivist is not an archivist", {
2692
+ required: true
2693
+ });
2499
2694
  }
2500
2695
  };
2501
2696
 
2502
2697
  // src/access/interfaces/registered-names/helpers/resource/AbstractXnsCaller.ts
2503
- import { assertEx as assertEx18 } from "@xylabs/assert";
2698
+ import { assertEx as assertEx18 } from "@xylabs/sdk-js";
2504
2699
  import { asArchivistInstance as asArchivistInstance7 } from "@xyo-network/archivist-model";
2505
2700
  import { asDivinerInstance as asDivinerInstance4 } from "@xyo-network/diviner-model";
2506
2701
  var XnsArchivistPayloadDivinerModuleName = "XnsArchivistPayloadDiviner";
2507
2702
  var XnsArchivistModuleName = "XnsArchivist";
2508
2703
  var XnsRegistrationsArchivistModuleName = "XnsRegistrationsArchivist";
2509
2704
  var AbstractXnsCaller = class {
2705
+ static {
2706
+ __name(this, "AbstractXnsCaller");
2707
+ }
2510
2708
  context;
2511
2709
  constructor(context) {
2512
2710
  this.context = context;
2513
2711
  }
2514
2712
  /**
2515
- * Get the XnsArchivist
2516
- */
2713
+ * Get the XnsArchivist
2714
+ */
2517
2715
  async getXnsArchivist(pathPrefix) {
2518
2716
  const fullyQualifiedPath = pathPrefix ? `${pathPrefix}:${XnsArchivistModuleName}` : XnsArchivistModuleName;
2519
2717
  const mod = assertEx18(await this.context.root.resolve(fullyQualifiedPath), () => `${fullyQualifiedPath} not found`);
2520
- return asArchivistInstance7(mod, () => `${fullyQualifiedPath} is not an archivist`, { required: true });
2718
+ return asArchivistInstance7(mod, () => `${fullyQualifiedPath} is not an archivist`, {
2719
+ required: true
2720
+ });
2521
2721
  }
2522
2722
  /**
2523
- * Get the XnsArchivistPayloadDiviner
2524
- */
2723
+ * Get the XnsArchivistPayloadDiviner
2724
+ */
2525
2725
  async getXnsArchivistPayloadDiviner(pathPrefix) {
2526
2726
  const fullyQualifiedPath = pathPrefix ? `${pathPrefix}:${XnsArchivistPayloadDivinerModuleName}` : XnsArchivistPayloadDivinerModuleName;
2527
2727
  const mod = assertEx18(await this.context.root.resolve(fullyQualifiedPath), () => `${fullyQualifiedPath} not found`);
2528
- return asDivinerInstance4(mod, () => `${fullyQualifiedPath} is not an diviner`, { required: true });
2728
+ return asDivinerInstance4(mod, () => `${fullyQualifiedPath} is not an diviner`, {
2729
+ required: true
2730
+ });
2529
2731
  }
2530
2732
  /**
2531
- * Get the XnsRegistrationsArchivist
2532
- */
2733
+ * Get the XnsRegistrationsArchivist
2734
+ */
2533
2735
  async getXnsRegistrationsArchivist(pathPrefix) {
2534
2736
  const fullyQualifiedPath = pathPrefix ? `${pathPrefix}:${XnsRegistrationsArchivistModuleName}` : XnsRegistrationsArchivistModuleName;
2535
2737
  const mod = assertEx18(await this.context.root.resolve(fullyQualifiedPath), () => `${fullyQualifiedPath} not found`);
2536
- return asArchivistInstance7(mod, () => `${fullyQualifiedPath} is not an archivist`, { required: true });
2738
+ return asArchivistInstance7(mod, () => `${fullyQualifiedPath} is not an archivist`, {
2739
+ required: true
2740
+ });
2537
2741
  }
2538
2742
  };
2539
2743
 
2540
2744
  // src/access/interfaces/registered-names/helpers/resource/RegistrationsResource.ts
2541
- import { assertEx as assertEx19 } from "@xylabs/assert";
2745
+ import { assertEx as assertEx19 } from "@xylabs/sdk-js";
2542
2746
  import { isTemporalIndexingDivinerResultIndex } from "@xyo-network/diviner-temporal-indexing-model";
2543
2747
 
2544
2748
  // src/access/interfaces/registered-names/helpers/resource/RegistrationsResourceQueries.ts
2545
2749
  import { PayloadDivinerQuerySchema as PayloadDivinerQuerySchema4 } from "@xyo-network/diviner-payload-model";
2546
2750
  import { TemporalIndexingDivinerResultIndexSchema } from "@xyo-network/diviner-temporal-indexing-model";
2547
2751
  var XnsRegistrationsResourceQueries = {
2548
- getAllRegistrations: async (diviner) => {
2752
+ getAllRegistrations: /* @__PURE__ */ __name(async (diviner) => {
2549
2753
  const query = {
2550
2754
  limit: 100,
2551
2755
  order: "desc",
2552
2756
  schema: PayloadDivinerQuerySchema4,
2553
- schemas: [TemporalIndexingDivinerResultIndexSchema]
2757
+ schemas: [
2758
+ TemporalIndexingDivinerResultIndexSchema
2759
+ ]
2554
2760
  };
2555
- return await diviner.divine([query]);
2556
- },
2557
- getRecentRegistrations: async (archivist) => {
2761
+ return await diviner.divine([
2762
+ query
2763
+ ]);
2764
+ }, "getAllRegistrations"),
2765
+ getRecentRegistrations: /* @__PURE__ */ __name(async (archivist) => {
2558
2766
  return (await archivist.all()).toReversed();
2559
- }
2767
+ }, "getRecentRegistrations")
2560
2768
  };
2561
2769
 
2562
2770
  // src/access/interfaces/registered-names/helpers/resource/RegistrationsResource.ts
2563
2771
  var XnsRegistrationsResource = class extends AbstractXnsCaller {
2772
+ static {
2773
+ __name(this, "XnsRegistrationsResource");
2774
+ }
2564
2775
  _allRegistrations;
2565
2776
  pathPrefix;
2566
2777
  constructor(context, pathPrefix) {
@@ -2571,10 +2782,14 @@ var XnsRegistrationsResource = class extends AbstractXnsCaller {
2571
2782
  return assertEx19(this._allRegistrations);
2572
2783
  }
2573
2784
  get subscriptions() {
2574
- return { allRegistrations: (cb) => this.allRegistrations.subscribe(cb) };
2785
+ return {
2786
+ allRegistrations: /* @__PURE__ */ __name((cb) => this.allRegistrations.subscribe(cb), "allRegistrations")
2787
+ };
2575
2788
  }
2576
2789
  get views() {
2577
- return { allRegistrations: () => this.allRegistrations.getSnapshot() };
2790
+ return {
2791
+ allRegistrations: /* @__PURE__ */ __name(() => this.allRegistrations.getSnapshot(), "allRegistrations")
2792
+ };
2578
2793
  }
2579
2794
  cleanupListeners() {
2580
2795
  this.allRegistrations.cleanupListeners();
@@ -2584,7 +2799,7 @@ var XnsRegistrationsResource = class extends AbstractXnsCaller {
2584
2799
  const xnsArchivist = await this.getXnsArchivist(this.pathPrefix);
2585
2800
  this._allRegistrations = await PayloadStore.create({
2586
2801
  archivist: xnsArchivist,
2587
- getLatest: async () => await XnsRegistrationsResourceQueries.getAllRegistrations(xnsArchivistPayloadDiviner),
2802
+ getLatest: /* @__PURE__ */ __name(async () => await XnsRegistrationsResourceQueries.getAllRegistrations(xnsArchivistPayloadDiviner), "getLatest"),
2588
2803
  idFunction: isTemporalIndexingDivinerResultIndex
2589
2804
  });
2590
2805
  }
@@ -2599,9 +2814,13 @@ var DappAccessRequestQueries = {
2599
2814
  const query = {
2600
2815
  limit: 1,
2601
2816
  schema: PayloadDivinerQuerySchema5,
2602
- schemas: [DappAccessRequestSchema]
2817
+ schemas: [
2818
+ DappAccessRequestSchema
2819
+ ]
2603
2820
  };
2604
- const results = await diviner.divine([query]);
2821
+ const results = await diviner.divine([
2822
+ query
2823
+ ]);
2605
2824
  if (results.length === 0) {
2606
2825
  return noResults;
2607
2826
  }
@@ -2611,9 +2830,13 @@ var DappAccessRequestQueries = {
2611
2830
  const query = {
2612
2831
  limit: 1,
2613
2832
  schema: PayloadDivinerQuerySchema5,
2614
- schemas: [RegisteredDappAccessSchema2]
2833
+ schemas: [
2834
+ RegisteredDappAccessSchema2
2835
+ ]
2615
2836
  };
2616
- const results = await diviner.divine([query]);
2837
+ const results = await diviner.divine([
2838
+ query
2839
+ ]);
2617
2840
  if (results.length === 0) {
2618
2841
  return noResults;
2619
2842
  }
@@ -2622,9 +2845,12 @@ var DappAccessRequestQueries = {
2622
2845
  };
2623
2846
 
2624
2847
  // src/access/Resource.ts
2625
- import { assertEx as assertEx20 } from "@xylabs/assert";
2848
+ import { assertEx as assertEx20 } from "@xylabs/sdk-js";
2626
2849
  import { isDappAccessRequestWithMeta, isRegisteredDappAccess as isRegisteredDappAccess2 } from "@xyo-network/os-model";
2627
2850
  var DappAccessRequestResource = class extends DappCallerBase {
2851
+ static {
2852
+ __name(this, "DappAccessRequestResource");
2853
+ }
2628
2854
  _accessRequestListener;
2629
2855
  _registeredInterfacesListener;
2630
2856
  constructor(context) {
@@ -2638,14 +2864,14 @@ var DappAccessRequestResource = class extends DappCallerBase {
2638
2864
  }
2639
2865
  get subscriptions() {
2640
2866
  return {
2641
- accessRequests: (cb) => this.accessRequestListener.subscribe(cb),
2642
- registeredInterfaces: (cb) => this.registeredInterfacesListener.subscribe(cb)
2867
+ accessRequests: /* @__PURE__ */ __name((cb) => this.accessRequestListener.subscribe(cb), "accessRequests"),
2868
+ registeredInterfaces: /* @__PURE__ */ __name((cb) => this.registeredInterfacesListener.subscribe(cb), "registeredInterfaces")
2643
2869
  };
2644
2870
  }
2645
2871
  get views() {
2646
2872
  return {
2647
- accessRequests: () => this.accessRequestListener.getSnapshot(),
2648
- registeredInterfaces: () => this.registeredInterfacesListener.getSnapshot()
2873
+ accessRequests: /* @__PURE__ */ __name(() => this.accessRequestListener.getSnapshot(), "accessRequests"),
2874
+ registeredInterfaces: /* @__PURE__ */ __name(() => this.registeredInterfacesListener.getSnapshot(), "registeredInterfaces")
2649
2875
  };
2650
2876
  }
2651
2877
  cleanupListeners() {
@@ -2657,27 +2883,21 @@ var DappAccessRequestResource = class extends DappCallerBase {
2657
2883
  const diviner = await this.getDappArchivistPayloadDiviner();
2658
2884
  this._accessRequestListener = await PayloadStore.create({
2659
2885
  archivist,
2660
- getLatest: async () => await DappAccessRequestQueries.getAccessRequests(diviner),
2886
+ getLatest: /* @__PURE__ */ __name(async () => await DappAccessRequestQueries.getAccessRequests(diviner), "getLatest"),
2661
2887
  idFunction: isDappAccessRequestWithMeta
2662
2888
  });
2663
2889
  this._registeredInterfacesListener = await PayloadStore.create({
2664
2890
  archivist,
2665
- getLatest: async () => await DappAccessRequestQueries.getRegisteredInterfaces(diviner),
2891
+ getLatest: /* @__PURE__ */ __name(async () => await DappAccessRequestQueries.getRegisteredInterfaces(diviner), "getLatest"),
2666
2892
  idFunction: isRegisteredDappAccess2
2667
2893
  });
2668
2894
  }
2669
2895
  };
2670
2896
 
2671
2897
  // src/Caller.ts
2672
- import { assertEx as assertEx21 } from "@xylabs/assert";
2898
+ import { assertEx as assertEx21 } from "@xylabs/sdk-js";
2673
2899
  import { PayloadDivinerQuerySchema as PayloadDivinerQuerySchema7 } from "@xyo-network/diviner-payload-model";
2674
- import {
2675
- DappAccessRequestSchema as DappAccessRequestSchema2,
2676
- DappInjectableParamsSchema as DappInjectableParamsSchema2,
2677
- DappIntentTypes as DappIntentTypes2,
2678
- DappMode as DappMode3,
2679
- RegisteredDappAccessSchema as RegisteredDappAccessSchema3
2680
- } from "@xyo-network/os-model";
2900
+ import { DappAccessRequestSchema as DappAccessRequestSchema2, DappInjectableParamsSchema as DappInjectableParamsSchema2, DappIntentTypes as DappIntentTypes2, DappMode as DappMode3, RegisteredDappAccessSchema as RegisteredDappAccessSchema3 } from "@xyo-network/os-model";
2681
2901
  import { PayloadBuilder as PayloadBuilder6 } from "@xyo-network/payload-builder";
2682
2902
 
2683
2903
  // src/DefaultsQueries.ts
@@ -2689,32 +2909,43 @@ var DappDefaultsResourceQueries = {
2689
2909
  limit: 1,
2690
2910
  order: "desc",
2691
2911
  schema: PayloadDivinerQuerySchema6,
2692
- schemas: [DappInjectableParamsSchema],
2912
+ schemas: [
2913
+ DappInjectableParamsSchema
2914
+ ],
2693
2915
  source: "route"
2694
2916
  };
2695
- return await diviner.divine([query]);
2917
+ return await diviner.divine([
2918
+ query
2919
+ ]);
2696
2920
  },
2697
2921
  async getNodeOsInfo(diviner) {
2698
2922
  const query = {
2699
2923
  limit: 1,
2700
2924
  order: "desc",
2701
2925
  schema: PayloadDivinerQuerySchema6,
2702
- schemas: [NodeOsInfoSchema2]
2926
+ schemas: [
2927
+ NodeOsInfoSchema2
2928
+ ]
2703
2929
  };
2704
- return await diviner.divine([query]);
2930
+ return await diviner.divine([
2931
+ query
2932
+ ]);
2705
2933
  }
2706
2934
  };
2707
2935
 
2708
2936
  // src/Caller.ts
2709
2937
  var DappCaller = class extends DappCallerBase {
2938
+ static {
2939
+ __name(this, "DappCaller");
2940
+ }
2710
2941
  constructor(context) {
2711
2942
  super(context);
2712
2943
  }
2713
2944
  /**
2714
- * Add payloads to the dapp archivist
2715
- * @param {Payload[]} payloads
2716
- * @param {Boolean} force
2717
- */
2945
+ * Add payloads to the dapp archivist
2946
+ * @param payloads
2947
+ * @param force
2948
+ */
2718
2949
  async addPayloadsToDappArchivist(payloads = [], force = false) {
2719
2950
  const dappArchivist = await this.getDappArchivist();
2720
2951
  if (force) {
@@ -2722,19 +2953,23 @@ var DappCaller = class extends DappCallerBase {
2722
2953
  } else {
2723
2954
  for (const payload of payloads) {
2724
2955
  const hash = await PayloadBuilder6.dataHash(payload);
2725
- const [existing] = await dappArchivist.get([hash]);
2956
+ const [existing] = await dappArchivist.get([
2957
+ hash
2958
+ ]);
2726
2959
  if (existing) continue;
2727
- await dappArchivist.insert([payload]);
2960
+ await dappArchivist.insert([
2961
+ payload
2962
+ ]);
2728
2963
  }
2729
2964
  }
2730
2965
  }
2731
2966
  /**
2732
- * Build Access Request
2733
- * @param {DappAccessRequest['mode']} mode
2734
- * @param {Hash} registeredDappAccessHash
2735
- * @param {string} requestingDappId
2736
- * @param {string | undefined} destinationArchivist
2737
- */
2967
+ * Build Access Request
2968
+ * @param mode
2969
+ * @param registeredDappAccessHash
2970
+ * @param requestingDappId
2971
+ * @param destinationArchivist
2972
+ */
2738
2973
  buildAccessRequest(mode, registeredDappAccessHash, requestingDappId, destinationArchivist) {
2739
2974
  const accessRequest = {
2740
2975
  destinationArchivist,
@@ -2747,43 +2982,51 @@ var DappCaller = class extends DappCallerBase {
2747
2982
  return accessRequest;
2748
2983
  }
2749
2984
  /**
2750
- * Get all available dapp access requests
2751
- */
2985
+ * Get all available dapp access requests
2986
+ */
2752
2987
  async getDappAccessPayloads() {
2753
2988
  const diviner = await this.getDappArchivistPayloadDiviner();
2754
2989
  const query = {
2755
2990
  order: "desc",
2756
2991
  schema: PayloadDivinerQuerySchema7,
2757
- schemas: [RegisteredDappAccessSchema3]
2992
+ schemas: [
2993
+ RegisteredDappAccessSchema3
2994
+ ]
2758
2995
  };
2759
- return diviner.divine([query]);
2996
+ return diviner.divine([
2997
+ query
2998
+ ]);
2760
2999
  }
2761
3000
  /**
2762
- * Get the most recent dapp injectable params
2763
- * @returns Promise
2764
- */
3001
+ * Get the most recent dapp injectable params
3002
+ * @returns Promise
3003
+ */
2765
3004
  async getDappInjectableParams() {
2766
3005
  const diviner = await this.getDappArchivistPayloadDiviner();
2767
3006
  return await DappDefaultsResourceQueries.getDappInjectableParamsFromRoute(diviner);
2768
3007
  }
2769
3008
  /**
2770
- * Get the most recent dapp intent
2771
- * @param {string} name
2772
- */
3009
+ * Get the most recent dapp intent
3010
+ * @param name
3011
+ */
2773
3012
  async getRegisteredDappAccessByName(name) {
2774
3013
  const diviner = await this.getDappArchivistPayloadDiviner();
2775
3014
  const query = {
2776
3015
  limit: 1,
2777
3016
  name,
2778
3017
  schema: PayloadDivinerQuerySchema7,
2779
- schemas: [RegisteredDappAccessSchema3]
3018
+ schemas: [
3019
+ RegisteredDappAccessSchema3
3020
+ ]
2780
3021
  };
2781
- const [payload] = assertEx21(await diviner.divine([query]), () => "Unable to find registered dapp access");
3022
+ const [payload] = assertEx21(await diviner.divine([
3023
+ query
3024
+ ]), () => "Unable to find registered dapp access");
2782
3025
  return payload;
2783
3026
  }
2784
3027
  /**
2785
- * Get the user wallet
2786
- */
3028
+ * Get the user wallet
3029
+ */
2787
3030
  getUserAccount(dappName) {
2788
3031
  const account = this.context.user.signers?.get(dappName);
2789
3032
  if (account) {
@@ -2793,48 +3036,55 @@ var DappCaller = class extends DappCallerBase {
2793
3036
  }
2794
3037
  }
2795
3038
  /**
2796
- * Get all wallets for the user
2797
- */
3039
+ * Get all wallets for the user
3040
+ */
2798
3041
  getUserAccountsAll() {
2799
- return [...this.context.user.signers?.values() ?? []];
3042
+ return [
3043
+ ...this.context.user.signers?.values() ?? []
3044
+ ];
2800
3045
  }
2801
3046
  /**
2802
- * Make Dapp Access Request
2803
- * @param {string} requestingDappId
2804
- * @param {string} registeredDappAccessHash
2805
- * @param {string} mode
2806
- * @param {string} destinationArchivist
2807
- */
3047
+ * Make Dapp Access Request
3048
+ * @param requestingDappId
3049
+ * @param registeredDappAccessHash
3050
+ * @param mode
3051
+ * @param destinationArchivist
3052
+ */
2808
3053
  async makeDappAccessRequest(requestingDappId, registeredDappAccessHash, mode, destinationArchivist) {
2809
3054
  const archivist = await this.getDappArchivist();
2810
- const registeredDappAccessPayload = await archivist.get([registeredDappAccessHash]);
3055
+ const registeredDappAccessPayload = await archivist.get([
3056
+ registeredDappAccessHash
3057
+ ]);
2811
3058
  if (!registeredDappAccessPayload) {
2812
3059
  throw new Error("No registered dapp access found");
2813
3060
  }
2814
3061
  const accessRequest = this.buildAccessRequest(mode, registeredDappAccessHash, requestingDappId, destinationArchivist);
2815
- await archivist.insert([accessRequest]);
3062
+ await archivist.insert([
3063
+ accessRequest
3064
+ ]);
2816
3065
  }
2817
3066
  /**
2818
- * Make Dapp Intent Request
2819
- * @param {DappId} sourceDappId
2820
- * @param {DappId} targetDappId
2821
- * @param {DappIntentTypes=DappIntentTypes.Launch} intent
2822
- * @param {DappIntent['params']} mode
2823
- */
3067
+ * Make Dapp Intent Request
3068
+ * @param sourceDappId
3069
+ * @param targetDappId
3070
+ * @param intent
3071
+ * @param mode
3072
+ */
2824
3073
  async makeDappIntentRequest(sourceDappId, targetDappId, intent = DappIntentTypes2.Launch, mode = DappMode3.Window, params) {
2825
3074
  if (!sourceDappId) {
2826
3075
  throw new Error("No source dapp id provided, dApps must declare a sourceDappId");
2827
3076
  }
2828
3077
  const archivist = await this.getDappArchivist();
2829
3078
  const dappIntent = DappIntentCaller.buildIntent(sourceDappId, intent, targetDappId, mode, params);
2830
- return await archivist.insert([dappIntent]);
3079
+ return await archivist.insert([
3080
+ dappIntent
3081
+ ]);
2831
3082
  }
2832
3083
  /**
2833
- * Set the dapp injectable params
2834
- *
2835
- * @param {URLSearchParams} searchParams
2836
- * @param {string} pathname
2837
- */
3084
+ * Set the dapp injectable params
3085
+ * @param searchParams
3086
+ * @param pathname
3087
+ */
2838
3088
  async setDappInjectableRouteParams(searchParams = new URLSearchParams(), pathname) {
2839
3089
  const dappArchivist = await this.getDappArchivist();
2840
3090
  const params = {};
@@ -2848,14 +3098,19 @@ var DappCaller = class extends DappCallerBase {
2848
3098
  source: "route",
2849
3099
  timestamp: Date.now()
2850
3100
  };
2851
- await dappArchivist.insert([payload]);
3101
+ await dappArchivist.insert([
3102
+ payload
3103
+ ]);
2852
3104
  }
2853
3105
  };
2854
3106
 
2855
3107
  // src/classes/dapp/DefaultsResource.ts
2856
- import { assertEx as assertEx22 } from "@xylabs/assert";
3108
+ import { assertEx as assertEx22 } from "@xylabs/sdk-js";
2857
3109
  import { isDappInjectableParams, isNodeOsInfo } from "@xyo-network/os-model";
2858
3110
  var DappDefaultsResource = class extends DappCallerBase {
3111
+ static {
3112
+ __name(this, "DappDefaultsResource");
3113
+ }
2859
3114
  _dappInjectableParamsFromRouteListener;
2860
3115
  _nodeOsInfoListener;
2861
3116
  constructor(context) {
@@ -2869,14 +3124,14 @@ var DappDefaultsResource = class extends DappCallerBase {
2869
3124
  }
2870
3125
  get subscriptions() {
2871
3126
  return {
2872
- dappInjectableParamsFromRoute: (cb) => this.dappInjectableParamsFromRouteListener.subscribe(cb),
2873
- nodeOsInfo: (cb) => this.nodeOsInfoListener.subscribe(cb)
3127
+ dappInjectableParamsFromRoute: /* @__PURE__ */ __name((cb) => this.dappInjectableParamsFromRouteListener.subscribe(cb), "dappInjectableParamsFromRoute"),
3128
+ nodeOsInfo: /* @__PURE__ */ __name((cb) => this.nodeOsInfoListener.subscribe(cb), "nodeOsInfo")
2874
3129
  };
2875
3130
  }
2876
3131
  get views() {
2877
3132
  return {
2878
- dappInjectableParamsFromRoute: () => this.dappInjectableParamsFromRouteListener.getSnapshot(),
2879
- nodeOsInfo: () => this.nodeOsInfoListener.getSnapshot()
3133
+ dappInjectableParamsFromRoute: /* @__PURE__ */ __name(() => this.dappInjectableParamsFromRouteListener.getSnapshot(), "dappInjectableParamsFromRoute"),
3134
+ nodeOsInfo: /* @__PURE__ */ __name(() => this.nodeOsInfoListener.getSnapshot(), "nodeOsInfo")
2880
3135
  };
2881
3136
  }
2882
3137
  cleanupListeners() {
@@ -2887,12 +3142,12 @@ var DappDefaultsResource = class extends DappCallerBase {
2887
3142
  const diviner = await this.getDappArchivistPayloadDiviner();
2888
3143
  this._nodeOsInfoListener = await PayloadStore.create({
2889
3144
  archivist,
2890
- getLatest: async () => await DappDefaultsResourceQueries.getNodeOsInfo(diviner),
3145
+ getLatest: /* @__PURE__ */ __name(async () => await DappDefaultsResourceQueries.getNodeOsInfo(diviner), "getLatest"),
2891
3146
  idFunction: isNodeOsInfo
2892
3147
  });
2893
3148
  this._dappInjectableParamsFromRouteListener = await PayloadStore.create({
2894
3149
  archivist,
2895
- getLatest: async () => await DappDefaultsResourceQueries.getDappInjectableParamsFromRoute(diviner),
3150
+ getLatest: /* @__PURE__ */ __name(async () => await DappDefaultsResourceQueries.getDappInjectableParamsFromRoute(diviner), "getLatest"),
2896
3151
  idFunction: isDappInjectableParams
2897
3152
  });
2898
3153
  }
@@ -2900,25 +3155,26 @@ var DappDefaultsResource = class extends DappCallerBase {
2900
3155
 
2901
3156
  // src/classes/menu/Caller.ts
2902
3157
  import { PayloadDivinerQuerySchema as PayloadDivinerQuerySchema8 } from "@xyo-network/diviner-payload-model";
2903
- import {
2904
- DappInjectableParamsSchema as DappInjectableParamsSchema3,
2905
- DappNavItemSelectionSchema
2906
- } from "@xyo-network/os-model";
3158
+ import { DappInjectableParamsSchema as DappInjectableParamsSchema3, DappNavItemSelectionSchema } from "@xyo-network/os-model";
2907
3159
  import { PayloadBuilder as PayloadBuilder7 } from "@xyo-network/payload-builder";
2908
3160
  var DappMenuCaller = class extends DappCaller {
3161
+ static {
3162
+ __name(this, "DappMenuCaller");
3163
+ }
2909
3164
  constructor(context) {
2910
3165
  super(context);
2911
3166
  }
2912
3167
  /**
2913
- * Add new Payloads to the dappArchivist if they haven't already
2914
- *
2915
- * @param {Payload[]} payloads
2916
- */
3168
+ * Add new Payloads to the dappArchivist if they haven't already
3169
+ * @param payloads
3170
+ */
2917
3171
  async add(payloads, force = false) {
2918
3172
  const dappArchivist = await this.getDappArchivist();
2919
3173
  for (const payload of payloads) {
2920
3174
  const hash = await PayloadBuilder7.dataHash(payload);
2921
- const [existing] = await dappArchivist.get([hash]);
3175
+ const [existing] = await dappArchivist.get([
3176
+ hash
3177
+ ]);
2922
3178
  if (!existing || force) {
2923
3179
  await dappArchivist.insert(payloads);
2924
3180
  }
@@ -2930,17 +3186,21 @@ var DappMenuCaller = class extends DappCaller {
2930
3186
  limit: 1,
2931
3187
  order: "desc",
2932
3188
  schema: PayloadDivinerQuerySchema8,
2933
- schemas: [DappNavItemSelectionSchema]
3189
+ schemas: [
3190
+ DappNavItemSelectionSchema
3191
+ ]
2934
3192
  };
2935
- return await diviner.divine([query]);
3193
+ return await diviner.divine([
3194
+ query
3195
+ ]);
2936
3196
  }
2937
3197
  /*
2938
- * Indicate to the system that a nav item was selected
2939
- *
2940
- * @param {string} path
2941
- * @params {string} injectableParamsPath
2942
- * @returns Promise
2943
- */
3198
+ * Indicate to the system that a nav item was selected
3199
+ *
3200
+ * @param {string} path
3201
+ * @params {string} injectableParamsPath
3202
+ * @returns Promise
3203
+ */
2944
3204
  async makeNavItemSelection(path, injectableParamsPath) {
2945
3205
  const dappArchivist = await this.getDappArchivist();
2946
3206
  const payload = {
@@ -2948,7 +3208,9 @@ var DappMenuCaller = class extends DappCaller {
2948
3208
  schema: DappNavItemSelectionSchema,
2949
3209
  timestamp: Date.now()
2950
3210
  };
2951
- await dappArchivist.insert([payload]);
3211
+ await dappArchivist.insert([
3212
+ payload
3213
+ ]);
2952
3214
  if (injectableParamsPath) {
2953
3215
  const injectableParams = {
2954
3216
  params: {},
@@ -2957,22 +3219,20 @@ var DappMenuCaller = class extends DappCaller {
2957
3219
  source: "route",
2958
3220
  timestamp: Date.now()
2959
3221
  };
2960
- await dappArchivist.insert([injectableParams]);
3222
+ await dappArchivist.insert([
3223
+ injectableParams
3224
+ ]);
2961
3225
  }
2962
3226
  }
2963
3227
  };
2964
3228
 
2965
3229
  // src/classes/menu/Resource.ts
2966
- import { assertEx as assertEx23 } from "@xylabs/assert";
3230
+ import { assertEx as assertEx23 } from "@xylabs/sdk-js";
2967
3231
  import { isDappNavItemSelection, isDappNavMenuConfig } from "@xyo-network/os-model";
2968
3232
 
2969
3233
  // src/classes/menu/Queries.ts
2970
3234
  import { PayloadDivinerQuerySchema as PayloadDivinerQuerySchema9 } from "@xyo-network/diviner-payload-model";
2971
- import {
2972
- DappNavItemSchema,
2973
- DappNavItemSelectionSchema as DappNavItemSelectionSchema2,
2974
- DappNavMenuConfigSchema
2975
- } from "@xyo-network/os-model";
3235
+ import { DappNavItemSchema, DappNavItemSelectionSchema as DappNavItemSelectionSchema2, DappNavMenuConfigSchema } from "@xyo-network/os-model";
2976
3236
  var NO_ITEMS = [];
2977
3237
  var DappMenuQueries = {
2978
3238
  async getMenuConfigs(diviner) {
@@ -2980,17 +3240,25 @@ var DappMenuQueries = {
2980
3240
  limit: 1,
2981
3241
  order: "desc",
2982
3242
  schema: PayloadDivinerQuerySchema9,
2983
- schemas: [DappNavMenuConfigSchema]
3243
+ schemas: [
3244
+ DappNavMenuConfigSchema
3245
+ ]
2984
3246
  };
2985
- return await diviner.divine([query]);
3247
+ return await diviner.divine([
3248
+ query
3249
+ ]);
2986
3250
  },
2987
3251
  async getMenuItems(diviner) {
2988
3252
  const query = {
2989
3253
  order: "desc",
2990
3254
  schema: PayloadDivinerQuerySchema9,
2991
- schemas: [DappNavItemSchema]
3255
+ schemas: [
3256
+ DappNavItemSchema
3257
+ ]
2992
3258
  };
2993
- const results = await diviner.divine([query]);
3259
+ const results = await diviner.divine([
3260
+ query
3261
+ ]);
2994
3262
  return results.length > 0 ? results : NO_ITEMS;
2995
3263
  },
2996
3264
  async getNavItemSelections(diviner) {
@@ -2998,24 +3266,35 @@ var DappMenuQueries = {
2998
3266
  limit: 1,
2999
3267
  order: "desc",
3000
3268
  schema: PayloadDivinerQuerySchema9,
3001
- schemas: [DappNavItemSelectionSchema2]
3269
+ schemas: [
3270
+ DappNavItemSelectionSchema2
3271
+ ]
3002
3272
  };
3003
- const results = await diviner.divine([query]);
3273
+ const results = await diviner.divine([
3274
+ query
3275
+ ]);
3004
3276
  return results.length > 0 ? results : NO_ITEMS;
3005
3277
  },
3006
3278
  async getVisibleMenuItems(diviner) {
3007
3279
  const query = {
3008
3280
  order: "desc",
3009
3281
  schema: PayloadDivinerQuerySchema9,
3010
- schemas: [DappNavItemSchema]
3282
+ schemas: [
3283
+ DappNavItemSchema
3284
+ ]
3011
3285
  };
3012
- const results = await diviner.divine([query]);
3286
+ const results = await diviner.divine([
3287
+ query
3288
+ ]);
3013
3289
  return results.filter((menuItem) => menuItem.hidden !== true).toSorted((a, b) => (a.weight ?? 0) > (b.weight ?? 0) ? 1 : -1);
3014
3290
  }
3015
3291
  };
3016
3292
 
3017
3293
  // src/classes/menu/Resource.ts
3018
3294
  var DappMenuResource = class extends DappCaller {
3295
+ static {
3296
+ __name(this, "DappMenuResource");
3297
+ }
3019
3298
  _menuConfigListener;
3020
3299
  _menuItemListener;
3021
3300
  _menuItemSelectionListener;
@@ -3038,55 +3317,55 @@ var DappMenuResource = class extends DappCaller {
3038
3317
  /** subscribe to latest set of payloads */
3039
3318
  get subscriptions() {
3040
3319
  return {
3041
- menuConfigs: (cb) => this.menuConfigListener.subscribe(cb),
3042
- menuItemSelections: (cb) => this.menuItemSelectionListener.subscribe(cb),
3043
- menuItems: (cb) => this.menuItemListener.subscribe(cb),
3044
- menuItemsVisible: (cb) => this.menuItemVisibleListener.subscribe(cb)
3320
+ menuConfigs: /* @__PURE__ */ __name((cb) => this.menuConfigListener.subscribe(cb), "menuConfigs"),
3321
+ menuItemSelections: /* @__PURE__ */ __name((cb) => this.menuItemSelectionListener.subscribe(cb), "menuItemSelections"),
3322
+ menuItems: /* @__PURE__ */ __name((cb) => this.menuItemListener.subscribe(cb), "menuItems"),
3323
+ menuItemsVisible: /* @__PURE__ */ __name((cb) => this.menuItemVisibleListener.subscribe(cb), "menuItemsVisible")
3045
3324
  };
3046
3325
  }
3047
3326
  /**
3048
- * Return the latest menu payloads from the repository
3049
- */
3327
+ * Return the latest menu payloads from the repository
3328
+ */
3050
3329
  get views() {
3051
3330
  return {
3052
- menuConfigs: () => this.menuConfigListener.getSnapshot(),
3053
- menuItemSelections: () => this.menuItemSelectionListener.getSnapshot(),
3054
- menuItems: () => this.menuItemListener.getSnapshot(),
3055
- menuItemsVisible: () => this.menuItemVisibleListener.getSnapshot()
3331
+ menuConfigs: /* @__PURE__ */ __name(() => this.menuConfigListener.getSnapshot(), "menuConfigs"),
3332
+ menuItemSelections: /* @__PURE__ */ __name(() => this.menuItemSelectionListener.getSnapshot(), "menuItemSelections"),
3333
+ menuItems: /* @__PURE__ */ __name(() => this.menuItemListener.getSnapshot(), "menuItems"),
3334
+ menuItemsVisible: /* @__PURE__ */ __name(() => this.menuItemVisibleListener.getSnapshot(), "menuItemsVisible")
3056
3335
  };
3057
3336
  }
3058
3337
  /**
3059
- * Remove all listeners and reset their class members
3060
- */
3338
+ * Remove all listeners and reset their class members
3339
+ */
3061
3340
  cleanupListeners() {
3062
3341
  this.menuConfigListener.cleanupListeners();
3063
3342
  this.menuItemListener.cleanupListeners();
3064
3343
  this.menuItemSelectionListener.cleanupListeners();
3065
3344
  }
3066
3345
  /**
3067
- * Start the resource
3068
- */
3346
+ * Start the resource
3347
+ */
3069
3348
  async start() {
3070
3349
  const dappArchivist = await this.getDappArchivist();
3071
3350
  const dappArchivistPayloadDiviner = await this.getDappArchivistPayloadDiviner();
3072
3351
  this._menuConfigListener = await PayloadStore.create({
3073
3352
  archivist: dappArchivist,
3074
- getLatest: async () => await DappMenuQueries.getMenuConfigs(dappArchivistPayloadDiviner),
3353
+ getLatest: /* @__PURE__ */ __name(async () => await DappMenuQueries.getMenuConfigs(dappArchivistPayloadDiviner), "getLatest"),
3075
3354
  idFunction: isDappNavMenuConfig
3076
3355
  });
3077
3356
  this._menuItemListener = await PayloadStore.create({
3078
3357
  archivist: dappArchivist,
3079
- getLatest: async () => await DappMenuQueries.getMenuItems(dappArchivistPayloadDiviner),
3358
+ getLatest: /* @__PURE__ */ __name(async () => await DappMenuQueries.getMenuItems(dappArchivistPayloadDiviner), "getLatest"),
3080
3359
  idFunction: isDappNavMenuConfig
3081
3360
  });
3082
3361
  this._menuItemVisibleListener = await PayloadStore.create({
3083
3362
  archivist: dappArchivist,
3084
- getLatest: async () => await DappMenuQueries.getVisibleMenuItems(dappArchivistPayloadDiviner),
3363
+ getLatest: /* @__PURE__ */ __name(async () => await DappMenuQueries.getVisibleMenuItems(dappArchivistPayloadDiviner), "getLatest"),
3085
3364
  idFunction: isDappNavMenuConfig
3086
3365
  });
3087
3366
  this._menuItemSelectionListener = await PayloadStore.create({
3088
3367
  archivist: dappArchivist,
3089
- getLatest: async () => await DappMenuQueries.getNavItemSelections(dappArchivistPayloadDiviner),
3368
+ getLatest: /* @__PURE__ */ __name(async () => await DappMenuQueries.getNavItemSelections(dappArchivistPayloadDiviner), "getLatest"),
3090
3369
  idFunction: isDappNavItemSelection
3091
3370
  });
3092
3371
  }
@@ -3096,26 +3375,30 @@ var DappMenuResource = class extends DappCaller {
3096
3375
  import { OsBadgeSchema as OsBadgeSchema2 } from "@xyo-network/os-model";
3097
3376
 
3098
3377
  // src/classes/settings/CallerBase.ts
3099
- import { assertEx as assertEx24 } from "@xylabs/assert";
3378
+ import { assertEx as assertEx24 } from "@xylabs/sdk-js";
3100
3379
  import { asArchivistInstance as asArchivistInstance8 } from "@xyo-network/archivist-model";
3101
3380
  import { asDivinerInstance as asDivinerInstance5 } from "@xyo-network/diviner-model";
3102
3381
  var OsSettingsArchivistModuleName = "OsSettingsNode:OsSettingsArchivist";
3103
3382
  var OsSettingsArchivistPayloadDivinerModuleName = "OsSettingsNode:OsSettingsArchivistPayloadDiviner";
3104
3383
  var OsSettingsCallerBase = class {
3384
+ static {
3385
+ __name(this, "OsSettingsCallerBase");
3386
+ }
3105
3387
  context;
3106
3388
  constructor(context) {
3107
3389
  this.context = context;
3108
3390
  }
3109
3391
  async getOsSettingsArchivist() {
3110
3392
  const mod = assertEx24(await this.context.root.resolve(OsSettingsArchivistModuleName), () => `${OsSettingsArchivistModuleName} not found`);
3111
- return asArchivistInstance8(mod, () => `${OsSettingsArchivistModuleName} is not an archivist`, { required: true });
3393
+ return asArchivistInstance8(mod, () => `${OsSettingsArchivistModuleName} is not an archivist`, {
3394
+ required: true
3395
+ });
3112
3396
  }
3113
3397
  async getOsSettingsPayloadDiviner() {
3114
- const mod = assertEx24(
3115
- await this.context.root.resolve(OsSettingsArchivistPayloadDivinerModuleName),
3116
- () => `${OsSettingsArchivistPayloadDivinerModuleName} not found`
3117
- );
3118
- return asDivinerInstance5(mod, () => `${OsSettingsArchivistPayloadDivinerModuleName} is not a diviner`, { required: true });
3398
+ const mod = assertEx24(await this.context.root.resolve(OsSettingsArchivistPayloadDivinerModuleName), () => `${OsSettingsArchivistPayloadDivinerModuleName} not found`);
3399
+ return asDivinerInstance5(mod, () => `${OsSettingsArchivistPayloadDivinerModuleName} is not a diviner`, {
3400
+ required: true
3401
+ });
3119
3402
  }
3120
3403
  };
3121
3404
 
@@ -3123,31 +3406,38 @@ var OsSettingsCallerBase = class {
3123
3406
  import { PayloadDivinerQuerySchema as PayloadDivinerQuerySchema10 } from "@xyo-network/diviner-payload-model";
3124
3407
  import { OsBadgeSchema } from "@xyo-network/os-model";
3125
3408
  var OsBadgeQueries = {
3126
- getBadge: async (achievement, diviner) => {
3409
+ getBadge: /* @__PURE__ */ __name(async (achievement, diviner) => {
3127
3410
  const query = {
3128
3411
  achievement,
3129
3412
  limit: 1,
3130
3413
  order: "desc",
3131
3414
  schema: PayloadDivinerQuerySchema10,
3132
- schemas: [OsBadgeSchema]
3415
+ schemas: [
3416
+ OsBadgeSchema
3417
+ ]
3133
3418
  };
3134
- return await diviner.divine([query]);
3135
- }
3419
+ return await diviner.divine([
3420
+ query
3421
+ ]);
3422
+ }, "getBadge")
3136
3423
  };
3137
3424
 
3138
3425
  // src/classes/settings/badge/Caller.ts
3139
3426
  var OsBadgeCaller = class extends OsSettingsCallerBase {
3427
+ static {
3428
+ __name(this, "OsBadgeCaller");
3429
+ }
3140
3430
  /**
3141
- * @param {ValidOsAchievements} achievement
3142
- */
3431
+ * @param achievement
3432
+ */
3143
3433
  async getBadge(achievement) {
3144
3434
  const diviner = await this.getOsSettingsPayloadDiviner();
3145
3435
  const results = await OsBadgeQueries.getBadge(achievement, diviner);
3146
3436
  return results[0] ?? null;
3147
3437
  }
3148
3438
  /**
3149
- * @param {ValidOsAchievements} achievement
3150
- */
3439
+ * @param achievement
3440
+ */
3151
3441
  async saveBadge(achievement) {
3152
3442
  const badge = {
3153
3443
  achievement,
@@ -3155,15 +3445,22 @@ var OsBadgeCaller = class extends OsSettingsCallerBase {
3155
3445
  timestamp: Date.now()
3156
3446
  };
3157
3447
  const archivist = await this.getOsSettingsArchivist();
3158
- return await archivist.insert([badge]);
3448
+ return await archivist.insert([
3449
+ badge
3450
+ ]);
3159
3451
  }
3160
3452
  };
3161
3453
 
3162
3454
  // src/classes/settings/badge/Resource.ts
3163
- import { assertEx as assertEx25 } from "@xylabs/assert";
3455
+ import { assertEx as assertEx25 } from "@xylabs/sdk-js";
3164
3456
  import { isBadgeWithMeta } from "@xyo-network/os-model";
3165
3457
  var OsBadgeResource = class extends OsSettingsCallerBase {
3166
- static views = ["savedSeedPhrase"];
3458
+ static {
3459
+ __name(this, "OsBadgeResource");
3460
+ }
3461
+ static views = [
3462
+ "savedSeedPhrase"
3463
+ ];
3167
3464
  _savedSeedPhrase;
3168
3465
  constructor(xyOsContext) {
3169
3466
  super(xyOsContext);
@@ -3172,30 +3469,34 @@ var OsBadgeResource = class extends OsSettingsCallerBase {
3172
3469
  return assertEx25(this._savedSeedPhrase, () => "Saved seed phrase listener not set");
3173
3470
  }
3174
3471
  get subscriptions() {
3175
- return { savedSeedPhrase: (cb) => this.savedSeedPhrase.subscribe(cb) };
3472
+ return {
3473
+ savedSeedPhrase: /* @__PURE__ */ __name((cb) => this.savedSeedPhrase.subscribe(cb), "savedSeedPhrase")
3474
+ };
3176
3475
  }
3177
3476
  get views() {
3178
- return { savedSeedPhrase: () => this.savedSeedPhrase.latest };
3477
+ return {
3478
+ savedSeedPhrase: /* @__PURE__ */ __name(() => this.savedSeedPhrase.latest, "savedSeedPhrase")
3479
+ };
3179
3480
  }
3180
3481
  cleanupListeners() {
3181
3482
  this.savedSeedPhrase.cleanupListeners();
3182
3483
  }
3183
3484
  /**
3184
- * start listeners
3185
- **/
3485
+ * start listeners
3486
+ */
3186
3487
  async start() {
3187
3488
  const diviner = await this.getOsSettingsPayloadDiviner();
3188
3489
  const archivist = await this.getOsSettingsArchivist();
3189
3490
  this._savedSeedPhrase = await PayloadStore.create({
3190
3491
  archivist,
3191
- getLatest: async () => await OsBadgeQueries.getBadge("savedSeedPhrase", diviner),
3492
+ getLatest: /* @__PURE__ */ __name(async () => await OsBadgeQueries.getBadge("savedSeedPhrase", diviner), "getLatest"),
3192
3493
  idFunction: isBadgeWithMeta
3193
3494
  });
3194
3495
  }
3195
3496
  };
3196
3497
 
3197
3498
  // src/classes/settings/Caller.ts
3198
- import { assertEx as assertEx26 } from "@xylabs/assert";
3499
+ import { assertEx as assertEx26 } from "@xylabs/sdk-js";
3199
3500
 
3200
3501
  // src/utils/buildWalletSeedPhrasePayload.ts
3201
3502
  import { WalletSeedPhraseSchema } from "@xyo-network/os-model";
@@ -3203,7 +3504,7 @@ import { PayloadBuilder as PayloadBuilder8 } from "@xyo-network/payload-builder"
3203
3504
  var language = "english";
3204
3505
  var standard = "bip-39";
3205
3506
  var userWalletLabel = "userWallet";
3206
- var buildWalletSeedPhrasePayload = async (mnemonic, $label) => {
3507
+ var buildWalletSeedPhrasePayload = /* @__PURE__ */ __name(async (mnemonic, $label) => {
3207
3508
  const fields = {
3208
3509
  mnemonic: {
3209
3510
  language,
@@ -3213,16 +3514,21 @@ var buildWalletSeedPhrasePayload = async (mnemonic, $label) => {
3213
3514
  $label,
3214
3515
  $timestamp: Date.now()
3215
3516
  };
3216
- const payload = new PayloadBuilder8({ schema: WalletSeedPhraseSchema }).fields(fields).build();
3517
+ const payload = new PayloadBuilder8({
3518
+ schema: WalletSeedPhraseSchema
3519
+ }).fields(fields).build();
3217
3520
  const rootHash = await PayloadBuilder8.hash(payload);
3218
- return { payload, rootHash };
3219
- };
3220
- var buildUserWalletSeedPhrasePayload = (mnemonic) => {
3521
+ return {
3522
+ payload,
3523
+ rootHash
3524
+ };
3525
+ }, "buildWalletSeedPhrasePayload");
3526
+ var buildUserWalletSeedPhrasePayload = /* @__PURE__ */ __name((mnemonic) => {
3221
3527
  return buildWalletSeedPhrasePayload(mnemonic, userWalletLabel);
3222
- };
3528
+ }, "buildUserWalletSeedPhrasePayload");
3223
3529
 
3224
3530
  // src/utils/getApiDomain.ts
3225
- var getApiDomain = (scope, apiDomain) => {
3531
+ var getApiDomain = /* @__PURE__ */ __name((scope, apiDomain) => {
3226
3532
  if (apiDomain !== void 0) {
3227
3533
  return apiDomain;
3228
3534
  }
@@ -3233,24 +3539,21 @@ var getApiDomain = (scope, apiDomain) => {
3233
3539
  return "https://beta.archivist.xyo.network";
3234
3540
  }
3235
3541
  return "https://archivist.xyo.network";
3236
- };
3542
+ }, "getApiDomain");
3237
3543
 
3238
3544
  // src/utils/renameObjKey.ts
3239
- var renameObjKey = (oldObj, oldKey, newKey) => {
3545
+ var renameObjKey = /* @__PURE__ */ __name((oldObj, oldKey, newKey) => {
3240
3546
  const oldObjKeys = Object.keys(oldObj);
3241
- const newObj = oldObjKeys.reduce(
3242
- (acc, val) => {
3243
- if (val === oldKey) {
3244
- acc[newKey] = oldObj[oldKey];
3245
- } else {
3246
- acc[val] = oldObj[val];
3247
- }
3248
- return acc;
3249
- },
3250
- {}
3251
- );
3547
+ const newObj = oldObjKeys.reduce((acc, val) => {
3548
+ if (val === oldKey) {
3549
+ acc[newKey] = oldObj[oldKey];
3550
+ } else {
3551
+ acc[val] = oldObj[val];
3552
+ }
3553
+ return acc;
3554
+ }, {});
3252
3555
  return newObj;
3253
- };
3556
+ }, "renameObjKey");
3254
3557
 
3255
3558
  // src/classes/settings/SettingsQueries.ts
3256
3559
  import { PayloadDivinerQuerySchema as PayloadDivinerQuerySchema11 } from "@xyo-network/diviner-payload-model";
@@ -3263,22 +3566,34 @@ var OsSettingsQueries = {
3263
3566
  limit: 1,
3264
3567
  order: "desc",
3265
3568
  schema: PayloadDivinerQuerySchema11,
3266
- schemas: [WalletSeedPhraseSchema2]
3569
+ schemas: [
3570
+ WalletSeedPhraseSchema2
3571
+ ]
3267
3572
  };
3268
- const results = await diviner.divine([query]);
3573
+ const results = await diviner.divine([
3574
+ query
3575
+ ]);
3269
3576
  const wallet = results.find((payload) => payload.$label === "userWallet");
3270
- if (wallet) return [wallet];
3271
- const legacyWallet = results.find((payload) => payload.$meta.label === "userWallet");
3577
+ if (wallet) return [
3578
+ wallet
3579
+ ];
3580
+ const legacyWallet = results.find((payload) => payload.$meta?.label === "userWallet");
3272
3581
  if (legacyWallet && archivist) {
3273
3582
  const legacyMeta = legacyWallet.$meta;
3274
3583
  const newWalletPayloadFields = {
3275
3584
  mnemonic: legacyWallet.mnemonic,
3276
- $label: legacyMeta.label,
3277
- $timestamp: legacyMeta.$timestamp
3585
+ $label: legacyMeta?.label,
3586
+ $timestamp: legacyMeta?.$timestamp
3278
3587
  };
3279
- const payload = new PayloadBuilder9({ schema: WalletSeedPhraseSchema2 }).fields(newWalletPayloadFields).build();
3280
- await archivist.insert([payload]);
3281
- return [payload];
3588
+ const payload = new PayloadBuilder9({
3589
+ schema: WalletSeedPhraseSchema2
3590
+ }).fields(newWalletPayloadFields).build();
3591
+ await archivist.insert([
3592
+ payload
3593
+ ]);
3594
+ return [
3595
+ payload
3596
+ ];
3282
3597
  }
3283
3598
  return NO_RESULTS2;
3284
3599
  },
@@ -3287,46 +3602,61 @@ var OsSettingsQueries = {
3287
3602
  limit: 1,
3288
3603
  order: "desc",
3289
3604
  schema: PayloadDivinerQuerySchema11,
3290
- schemas: [NodeBackgroundSchema]
3605
+ schemas: [
3606
+ NodeBackgroundSchema
3607
+ ]
3291
3608
  };
3292
- return await diviner.divine([query]);
3609
+ return await diviner.divine([
3610
+ query
3611
+ ]);
3293
3612
  },
3294
3613
  async getWallets(diviner) {
3295
3614
  const query = {
3296
3615
  order: "desc",
3297
3616
  schema: PayloadDivinerQuerySchema11,
3298
- schemas: [WalletSeedPhraseSchema2]
3617
+ schemas: [
3618
+ WalletSeedPhraseSchema2
3619
+ ]
3299
3620
  };
3300
- return await diviner.divine([query]);
3621
+ return await diviner.divine([
3622
+ query
3623
+ ]);
3301
3624
  }
3302
3625
  };
3303
3626
 
3304
3627
  // src/classes/settings/Caller.ts
3305
3628
  var OsSettingsCaller = class extends OsSettingsCallerBase {
3629
+ static {
3630
+ __name(this, "OsSettingsCaller");
3631
+ }
3306
3632
  constructor(context) {
3307
3633
  super(context);
3308
3634
  }
3309
3635
  /**
3310
- * Add a node background to the settings
3311
- * @param {NodeBackground} payload
3312
- */
3636
+ * Add a node background to the settings
3637
+ * @param payload
3638
+ */
3313
3639
  async addNodeBackground(payload) {
3314
3640
  const archivist = await this.getOsSettingsArchivist();
3315
- await archivist.insert([payload]);
3641
+ await archivist.insert([
3642
+ payload
3643
+ ]);
3316
3644
  }
3317
3645
  /**
3318
- * Add a wallet seed phrase to the settings
3319
- * @param {WalletSeedPhrase} payload
3320
- */
3646
+ * Add a wallet seed phrase to the settings
3647
+ * @param payload
3648
+ */
3321
3649
  async addWalletSeedPhrase(payload) {
3322
3650
  const archivist = await this.getOsSettingsArchivist();
3323
- await archivist.insert([payload]);
3651
+ await archivist.insert([
3652
+ payload
3653
+ ]);
3324
3654
  const phrase = payload.mnemonic.mnemonic.join(" ");
3325
3655
  await this.context.kernel?.bios?.seedPhraseStore.set("user", phrase);
3326
3656
  }
3327
3657
  /**
3328
- * Get the latest node background
3329
- */
3658
+ * Get the latest node background
3659
+ */
3330
3660
  async getLatestNodeBackground() {
3331
3661
  const diviner = await this.getOsSettingsPayloadDiviner();
3332
3662
  const [result] = await OsSettingsQueries.getNodeBackground(diviner);
@@ -3351,9 +3681,12 @@ var OsSettingsCaller = class extends OsSettingsCallerBase {
3351
3681
  };
3352
3682
 
3353
3683
  // src/classes/settings/Resource.ts
3354
- import { assertEx as assertEx27 } from "@xylabs/assert";
3684
+ import { assertEx as assertEx27 } from "@xylabs/sdk-js";
3355
3685
  import { isNodeBackground, isWalletSeedPhrase } from "@xyo-network/os-model";
3356
3686
  var OsSettingsResource = class extends OsSettingsCallerBase {
3687
+ static {
3688
+ __name(this, "OsSettingsResource");
3689
+ }
3357
3690
  _latestUserWalletListener;
3358
3691
  _nodeBackgroundListener;
3359
3692
  _walletsListener;
@@ -3368,16 +3701,16 @@ var OsSettingsResource = class extends OsSettingsCallerBase {
3368
3701
  }
3369
3702
  get subscriptions() {
3370
3703
  return {
3371
- latestUserWallet: (cb) => this.walletsListener.subscribe(cb),
3372
- nodeBackground: (cb) => this.nodeBackgroundListener.subscribe(cb),
3373
- wallets: (cb) => this.walletsListener.subscribe(cb)
3704
+ latestUserWallet: /* @__PURE__ */ __name((cb) => this.walletsListener.subscribe(cb), "latestUserWallet"),
3705
+ nodeBackground: /* @__PURE__ */ __name((cb) => this.nodeBackgroundListener.subscribe(cb), "nodeBackground"),
3706
+ wallets: /* @__PURE__ */ __name((cb) => this.walletsListener.subscribe(cb), "wallets")
3374
3707
  };
3375
3708
  }
3376
3709
  get views() {
3377
3710
  return {
3378
- latestUserWallet: () => this.latestUserWalletListener.latest,
3379
- nodeBackground: () => this.nodeBackgroundListener.latest,
3380
- wallets: () => this.walletsListener.latest
3711
+ latestUserWallet: /* @__PURE__ */ __name(() => this.latestUserWalletListener.latest, "latestUserWallet"),
3712
+ nodeBackground: /* @__PURE__ */ __name(() => this.nodeBackgroundListener.latest, "nodeBackground"),
3713
+ wallets: /* @__PURE__ */ __name(() => this.walletsListener.latest, "wallets")
3381
3714
  };
3382
3715
  }
3383
3716
  get walletsListener() {
@@ -3388,24 +3721,24 @@ var OsSettingsResource = class extends OsSettingsCallerBase {
3388
3721
  this.latestUserWalletListener.cleanupListeners();
3389
3722
  }
3390
3723
  /**
3391
- * start listeners
3392
- */
3724
+ * start listeners
3725
+ */
3393
3726
  async start() {
3394
3727
  const archivist = await this.getOsSettingsArchivist();
3395
3728
  const diviner = await this.getOsSettingsPayloadDiviner();
3396
3729
  this._walletsListener = await PayloadStore.create({
3397
3730
  archivist,
3398
- getLatest: async () => await OsSettingsQueries.getWallets(diviner),
3731
+ getLatest: /* @__PURE__ */ __name(async () => await OsSettingsQueries.getWallets(diviner), "getLatest"),
3399
3732
  idFunction: isWalletSeedPhrase
3400
3733
  });
3401
3734
  this._latestUserWalletListener = await PayloadStore.create({
3402
3735
  archivist,
3403
- getLatest: async () => await OsSettingsQueries.getLatestUserWallet(diviner),
3736
+ getLatest: /* @__PURE__ */ __name(async () => await OsSettingsQueries.getLatestUserWallet(diviner), "getLatest"),
3404
3737
  idFunction: isWalletSeedPhrase
3405
3738
  });
3406
3739
  this._nodeBackgroundListener = await PayloadStore.create({
3407
3740
  archivist,
3408
- getLatest: async () => await OsSettingsQueries.getNodeBackground(diviner),
3741
+ getLatest: /* @__PURE__ */ __name(async () => await OsSettingsQueries.getNodeBackground(diviner), "getLatest"),
3409
3742
  idFunction: isNodeBackground
3410
3743
  });
3411
3744
  }
@@ -3414,10 +3747,17 @@ var OsSettingsResource = class extends OsSettingsCallerBase {
3414
3747
  // src/helpers/monitor/XyOsMonitor.ts
3415
3748
  var DEFAULT_MONITORING_EVENT_NAME = "System Task Duration";
3416
3749
  globalThis.getXyOsGlobal = globalThis.getXyOsGlobal ?? (() => {
3417
- return { tracking: { trackEvent: (_event, _properties) => void {} } };
3750
+ return {
3751
+ tracking: {
3752
+ trackEvent: /* @__PURE__ */ __name((_event, _properties) => void {}, "trackEvent")
3753
+ }
3754
+ };
3418
3755
  });
3419
3756
  var xyOsGlobal = globalThis.getXyOsGlobal();
3420
3757
  var XyOsMonitor = class _XyOsMonitor {
3758
+ static {
3759
+ __name(this, "XyOsMonitor");
3760
+ }
3421
3761
  static trackEvent = xyOsGlobal.tracking.trackEvent;
3422
3762
  performanceTimers = /* @__PURE__ */ new Map();
3423
3763
  startTimer(name) {
@@ -3444,8 +3784,11 @@ var XyOsMonitor = class _XyOsMonitor {
3444
3784
  };
3445
3785
 
3446
3786
  // src/initializer/DappInitializer.ts
3447
- import { assertEx as assertEx28 } from "@xylabs/assert";
3787
+ import { assertEx as assertEx28 } from "@xylabs/sdk-js";
3448
3788
  var DappInitializer = class {
3789
+ static {
3790
+ __name(this, "DappInitializer");
3791
+ }
3449
3792
  _config;
3450
3793
  constructor(config) {
3451
3794
  this._config = config;
@@ -3458,17 +3801,14 @@ var DappInitializer = class {
3458
3801
  return await this.initializeDappContext(dappWithWalletId);
3459
3802
  }
3460
3803
  async initializeDappContext(dappWithWalletId) {
3461
- const {
3462
- allowedNames,
3463
- xnsNetwork,
3464
- xnsNodeUrl,
3465
- xyOs
3466
- } = this.config;
3804
+ const { allowedNames, xnsNetwork, xnsNodeUrl, xyOs } = this.config;
3467
3805
  return await RunningDappCache.findOrCreate(dappWithWalletId, xyOs, allowedNames ?? [], xnsNodeUrl, xnsNetwork);
3468
3806
  }
3469
3807
  async installDappWallet() {
3470
3808
  const { xyOs, dapp } = this.config;
3471
- const dappSeedPhraseRepository = new DappSeedPhraseRepository(xyOs, [dapp.config.name]);
3809
+ const dappSeedPhraseRepository = new DappSeedPhraseRepository(xyOs, [
3810
+ dapp.config.name
3811
+ ]);
3472
3812
  const walletId = await dappSeedPhraseRepository.findOrCreate(dapp.config.name);
3473
3813
  return {
3474
3814
  ...dapp,
@@ -3484,12 +3824,15 @@ var DappInitializer = class {
3484
3824
  import { PayloadBuilder as PayloadBuilder10 } from "@xyo-network/payload-builder";
3485
3825
  var DISPLAY_EVENT_COUNT_FREQUENCY = 100;
3486
3826
  var profileData = {};
3487
- var profileModuleEvents = (mod) => {
3827
+ var profileModuleEvents = /* @__PURE__ */ __name((mod) => {
3488
3828
  const modRef = new WeakRef(mod);
3489
3829
  mod.onAny(async (eventName, args) => {
3490
3830
  const mod2 = modRef.deref();
3491
3831
  if (mod2) {
3492
- const data = profileData[mod2.address] ?? { allEventCount: 0, eventCounts: {} };
3832
+ const data = profileData[mod2.address] ?? {
3833
+ allEventCount: 0,
3834
+ eventCounts: {}
3835
+ };
3493
3836
  profileData[mod2.address] = data;
3494
3837
  data.allEventCount += 1;
3495
3838
  data.eventCounts[eventName] = (data.eventCounts[eventName] ?? 0) + 1;
@@ -3512,13 +3855,16 @@ var profileModuleEvents = (mod) => {
3512
3855
  }
3513
3856
  }
3514
3857
  });
3515
- };
3858
+ }, "profileModuleEvents");
3516
3859
 
3517
3860
  // src/PubSubBridgeCaller.ts
3518
- import { assertEx as assertEx29 } from "@xylabs/assert";
3861
+ import { assertEx as assertEx29 } from "@xylabs/sdk-js";
3519
3862
  import { asBridgeInstance } from "@xyo-network/bridge-model";
3520
3863
  import { BridgedPubSubModuleName } from "@xyo-network/os-model";
3521
3864
  var PubSubBridgeCaller = class {
3865
+ static {
3866
+ __name(this, "PubSubBridgeCaller");
3867
+ }
3522
3868
  node;
3523
3869
  constructor(node) {
3524
3870
  this.node = node;
@@ -3538,7 +3884,9 @@ var PubSubBridgeCaller = class {
3538
3884
  }
3539
3885
  async getPubSubBridge() {
3540
3886
  const mod = assertEx29(await this.node.resolve(BridgedPubSubModuleName), () => `${BridgedPubSubModuleName} not found`);
3541
- return asBridgeInstance(mod, () => `${BridgedPubSubModuleName} is not a bridge`, { required: true });
3887
+ return asBridgeInstance(mod, () => `${BridgedPubSubModuleName} is not a bridge`, {
3888
+ required: true
3889
+ });
3542
3890
  }
3543
3891
  };
3544
3892
  export {