@xyo-network/os-runtime 7.2.1 → 7.3.1

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 (249) hide show
  1. package/dist/neutral/Caller.d.ts.map +1 -1
  2. package/dist/neutral/DappCallerBase.d.ts +2 -2
  3. package/dist/neutral/OsCallerBase.d.ts +2 -2
  4. package/dist/neutral/RunningDappCache.d.ts.map +1 -1
  5. package/dist/neutral/XyOs.d.ts +4 -5
  6. package/dist/neutral/XyOs.d.ts.map +1 -1
  7. package/dist/neutral/XyOsBase.d.ts +122 -3
  8. package/dist/neutral/XyOsBase.d.ts.map +1 -1
  9. package/dist/neutral/XyOsDapp.d.ts +3 -3
  10. package/dist/neutral/XyOsDapp.d.ts.map +1 -1
  11. package/dist/neutral/access/Caller.d.ts +1 -1
  12. package/dist/neutral/access/Caller.d.ts.map +1 -1
  13. package/dist/neutral/access/RunningAccessDappCache.d.ts.map +1 -1
  14. package/dist/neutral/access/interfaces/registered-names/helpers/resource/AbstractXnsCaller.d.ts +1 -1
  15. package/dist/neutral/adapter/Base.d.ts.map +1 -1
  16. package/dist/neutral/classes/lib/DappCreatorParams.d.ts +3 -3
  17. package/dist/neutral/classes/lib/DappCreatorParams.d.ts.map +1 -1
  18. package/dist/neutral/classes/lib/Insertable.d.ts +1 -3
  19. package/dist/neutral/classes/lib/Insertable.d.ts.map +1 -1
  20. package/dist/neutral/classes/settings/CallerBase.d.ts +1 -1
  21. package/dist/neutral/classes/settings/SettingsQueries.d.ts.map +1 -1
  22. package/dist/neutral/dapp/context/creator/Creator.d.ts +1 -1
  23. package/dist/neutral/dapp/context/creator/Creator.d.ts.map +1 -1
  24. package/dist/neutral/dapp/context/creator/createDappContext.d.ts.map +1 -1
  25. package/dist/neutral/event/bus/EventBus.d.ts +1 -1
  26. package/dist/neutral/event/bus/EventBus.d.ts.map +1 -1
  27. package/dist/neutral/helpers/monitor/XyOsMonitor.d.ts +2 -2
  28. package/dist/neutral/helpers/monitor/XyOsMonitor.d.ts.map +1 -1
  29. package/dist/neutral/helpers/monitor/types.d.ts +2 -2
  30. package/dist/neutral/helpers/monitor/types.d.ts.map +1 -1
  31. package/dist/neutral/index.mjs +42 -36
  32. package/dist/neutral/index.mjs.map +1 -1
  33. package/dist/neutral/lib/Listener.d.ts +1 -1
  34. package/dist/neutral/lib/Listener.d.ts.map +1 -1
  35. package/dist/neutral/loadOsNode.d.ts.map +1 -1
  36. package/dist/neutral/profileModuleEvents.d.ts +1 -3
  37. package/dist/neutral/profileModuleEvents.d.ts.map +1 -1
  38. package/dist/neutral/registration/DappRegistrationService.d.ts +3 -3
  39. package/dist/neutral/registration/DappRegistrationService.d.ts.map +1 -1
  40. package/dist/neutral/registration/DappRegistry.d.ts.map +1 -1
  41. package/dist/neutral/registration/ValidateDappAccessDiviner/Config.d.ts +1 -1
  42. package/dist/neutral/registration/ValidateDappAccessDiviner/Config.d.ts.map +1 -1
  43. package/dist/neutral/scripts/xyos/lib/headless.d.ts.map +1 -1
  44. package/dist/neutral/signer/Signers.d.ts.map +1 -1
  45. package/dist/neutral/stack/Manager.d.ts +2 -6
  46. package/dist/neutral/stack/Manager.d.ts.map +1 -1
  47. package/dist/neutral/system/ManageSystemDapps.d.ts +2 -2
  48. package/dist/neutral/system/ManageSystemDapps.d.ts.map +1 -1
  49. package/dist/node/Caller.d.ts.map +1 -1
  50. package/dist/node/DappCallerBase.d.ts +2 -2
  51. package/dist/node/OsCallerBase.d.ts +2 -2
  52. package/dist/node/RunningDappCache.d.ts.map +1 -1
  53. package/dist/node/XyOs.d.ts +4 -5
  54. package/dist/node/XyOs.d.ts.map +1 -1
  55. package/dist/node/XyOsBase.d.ts +122 -3
  56. package/dist/node/XyOsBase.d.ts.map +1 -1
  57. package/dist/node/XyOsDapp.d.ts +3 -3
  58. package/dist/node/XyOsDapp.d.ts.map +1 -1
  59. package/dist/node/access/Caller.d.ts +1 -1
  60. package/dist/node/access/Caller.d.ts.map +1 -1
  61. package/dist/node/access/RunningAccessDappCache.d.ts.map +1 -1
  62. package/dist/node/access/interfaces/registered-names/helpers/resource/AbstractXnsCaller.d.ts +1 -1
  63. package/dist/node/adapter/Base.d.ts.map +1 -1
  64. package/dist/node/classes/lib/DappCreatorParams.d.ts +3 -3
  65. package/dist/node/classes/lib/DappCreatorParams.d.ts.map +1 -1
  66. package/dist/node/classes/lib/Insertable.d.ts +1 -3
  67. package/dist/node/classes/lib/Insertable.d.ts.map +1 -1
  68. package/dist/node/classes/settings/CallerBase.d.ts +1 -1
  69. package/dist/node/classes/settings/SettingsQueries.d.ts.map +1 -1
  70. package/dist/node/dapp/context/creator/Creator.d.ts +1 -1
  71. package/dist/node/dapp/context/creator/Creator.d.ts.map +1 -1
  72. package/dist/node/dapp/context/creator/createDappContext.d.ts.map +1 -1
  73. package/dist/node/event/bus/EventBus.d.ts +1 -1
  74. package/dist/node/event/bus/EventBus.d.ts.map +1 -1
  75. package/dist/node/helpers/monitor/XyOsMonitor.d.ts +2 -2
  76. package/dist/node/helpers/monitor/XyOsMonitor.d.ts.map +1 -1
  77. package/dist/node/helpers/monitor/types.d.ts +2 -2
  78. package/dist/node/helpers/monitor/types.d.ts.map +1 -1
  79. package/dist/node/index.mjs +42 -36
  80. package/dist/node/index.mjs.map +1 -1
  81. package/dist/node/lib/Listener.d.ts +1 -1
  82. package/dist/node/lib/Listener.d.ts.map +1 -1
  83. package/dist/node/loadOsNode.d.ts.map +1 -1
  84. package/dist/node/profileModuleEvents.d.ts +1 -3
  85. package/dist/node/profileModuleEvents.d.ts.map +1 -1
  86. package/dist/node/registration/DappRegistrationService.d.ts +3 -3
  87. package/dist/node/registration/DappRegistrationService.d.ts.map +1 -1
  88. package/dist/node/registration/DappRegistry.d.ts.map +1 -1
  89. package/dist/node/registration/ValidateDappAccessDiviner/Config.d.ts +1 -1
  90. package/dist/node/registration/ValidateDappAccessDiviner/Config.d.ts.map +1 -1
  91. package/dist/node/scripts/xyos/index.mjs +27 -24
  92. package/dist/node/scripts/xyos/index.mjs.map +1 -1
  93. package/dist/node/scripts/xyos/lib/headless.d.ts.map +1 -1
  94. package/dist/node/signer/Signers.d.ts.map +1 -1
  95. package/dist/node/stack/Manager.d.ts +2 -6
  96. package/dist/node/stack/Manager.d.ts.map +1 -1
  97. package/dist/node/system/ManageSystemDapps.d.ts +2 -2
  98. package/dist/node/system/ManageSystemDapps.d.ts.map +1 -1
  99. package/package.json +134 -49
  100. package/dist/neutral/signer/Signer.spec.d.ts +0 -2
  101. package/dist/neutral/signer/Signer.spec.d.ts.map +0 -1
  102. package/dist/neutral/spec/boot.spec.d.ts +0 -2
  103. package/dist/neutral/spec/boot.spec.d.ts.map +0 -1
  104. package/dist/node/signer/Signer.spec.d.ts +0 -2
  105. package/dist/node/signer/Signer.spec.d.ts.map +0 -1
  106. package/dist/node/spec/boot.spec.d.ts +0 -2
  107. package/dist/node/spec/boot.spec.d.ts.map +0 -1
  108. package/src/Caller.ts +0 -200
  109. package/src/DappCallerBase.ts +0 -55
  110. package/src/DefaultsQueries.ts +0 -27
  111. package/src/OsCallerBase.ts +0 -59
  112. package/src/PubSubBridgeCaller.ts +0 -33
  113. package/src/RunningDappCache.ts +0 -58
  114. package/src/XyOs.ts +0 -166
  115. package/src/XyOsBase.ts +0 -135
  116. package/src/XyOsDapp.ts +0 -106
  117. package/src/access/Caller.ts +0 -85
  118. package/src/access/Queries.ts +0 -38
  119. package/src/access/Resource.ts +0 -65
  120. package/src/access/RunningAccessDappCache.ts +0 -21
  121. package/src/access/index.ts +0 -4
  122. package/src/access/interfaces/index.ts +0 -1
  123. package/src/access/interfaces/registered-names/helpers/AccessNodeQueries.ts +0 -68
  124. package/src/access/interfaces/registered-names/helpers/index.ts +0 -2
  125. package/src/access/interfaces/registered-names/helpers/resource/AbstractXnsCaller.ts +0 -42
  126. package/src/access/interfaces/registered-names/helpers/resource/RegistrationsResource.ts +0 -52
  127. package/src/access/interfaces/registered-names/helpers/resource/RegistrationsResourceQueries.ts +0 -23
  128. package/src/access/interfaces/registered-names/helpers/resource/index.ts +0 -3
  129. package/src/access/interfaces/registered-names/index.ts +0 -1
  130. package/src/adapter/Base.ts +0 -106
  131. package/src/adapter/Network.ts +0 -31
  132. package/src/adapter/Settings.ts +0 -30
  133. package/src/adapter/index.ts +0 -2
  134. package/src/adapters/OsPubSubBridgeNetwork.ts +0 -10
  135. package/src/adapters/OsSettings.ts +0 -7
  136. package/src/adapters/OsXyoPublicNetwork.ts +0 -9
  137. package/src/adapters/index.ts +0 -3
  138. package/src/classes/dapp/DefaultsResource.ts +0 -67
  139. package/src/classes/dapp/index.ts +0 -1
  140. package/src/classes/index.ts +0 -4
  141. package/src/classes/lib/DappCreatorParams.ts +0 -18
  142. package/src/classes/lib/Insertable.ts +0 -10
  143. package/src/classes/lib/index.ts +0 -2
  144. package/src/classes/menu/Caller.ts +0 -76
  145. package/src/classes/menu/Queries.ts +0 -60
  146. package/src/classes/menu/Resource.ts +0 -105
  147. package/src/classes/menu/index.ts +0 -2
  148. package/src/classes/settings/Caller.ts +0 -78
  149. package/src/classes/settings/CallerBase.ts +0 -27
  150. package/src/classes/settings/Resource.ts +0 -81
  151. package/src/classes/settings/SettingsQueries.ts +0 -56
  152. package/src/classes/settings/badge/Caller.ts +0 -30
  153. package/src/classes/settings/badge/Queries.ts +0 -19
  154. package/src/classes/settings/badge/Resource.ts +0 -50
  155. package/src/classes/settings/badge/index.ts +0 -2
  156. package/src/classes/settings/index.ts +0 -5
  157. package/src/dapp/context/creator/Creator.ts +0 -122
  158. package/src/dapp/context/creator/DefaultPayloads/DappAccessPayloads.ts +0 -20
  159. package/src/dapp/context/creator/DefaultPayloads/DefaultPayloads.ts +0 -40
  160. package/src/dapp/context/creator/DefaultPayloads/NodeInfoPayload.ts +0 -33
  161. package/src/dapp/context/creator/DefaultPayloads/index.ts +0 -1
  162. package/src/dapp/context/creator/ExternalModulePermissions/ExternalModulePermissions.ts +0 -59
  163. package/src/dapp/context/creator/ExternalModulePermissions/index.ts +0 -1
  164. package/src/dapp/context/creator/createDappContext.ts +0 -61
  165. package/src/dapp/context/creator/index.ts +0 -3
  166. package/src/dapp/context/index.ts +0 -1
  167. package/src/dapp/index.ts +0 -1
  168. package/src/event/bus/Connection.ts +0 -31
  169. package/src/event/bus/EventBus.ts +0 -160
  170. package/src/event/bus/PubSubConnection.ts +0 -28
  171. package/src/event/bus/index.ts +0 -3
  172. package/src/event/connections/DappAccessRequest.ts +0 -11
  173. package/src/event/connections/DappsReady.ts +0 -9
  174. package/src/event/connections/ExposeDappRequest.ts +0 -11
  175. package/src/event/connections/OsPubSubNetworkReady.ts +0 -12
  176. package/src/event/connections/OsSettingsReady.ts +0 -12
  177. package/src/event/connections/OsXyoPublicReady.ts +0 -12
  178. package/src/event/connections/index.ts +0 -6
  179. package/src/event/index.ts +0 -2
  180. package/src/helpers/index.ts +0 -1
  181. package/src/helpers/monitor/XyOsMonitor.ts +0 -52
  182. package/src/helpers/monitor/index.ts +0 -2
  183. package/src/helpers/monitor/types.ts +0 -8
  184. package/src/index.ts +0 -29
  185. package/src/initializer/DappInitializer.ts +0 -57
  186. package/src/initializer/index.ts +0 -1
  187. package/src/intent/Caller.ts +0 -74
  188. package/src/intent/Resource.ts +0 -66
  189. package/src/intent/index.ts +0 -2
  190. package/src/lib/ExternalStore.ts +0 -7
  191. package/src/lib/Listener.ts +0 -1
  192. package/src/lib/ModuleAccountPaths.ts +0 -23
  193. package/src/lib/ModuleNames.ts +0 -3
  194. package/src/lib/NameTransforms.ts +0 -34
  195. package/src/lib/PayloadStore.ts +0 -105
  196. package/src/lib/ResourceStores.ts +0 -7
  197. package/src/lib/index.ts +0 -11
  198. package/src/lib/initializeXns.ts +0 -16
  199. package/src/lib/isEqual.ts +0 -42
  200. package/src/lib/isPayload.ts +0 -24
  201. package/src/lib/tokenPlacesSplit.ts +0 -17
  202. package/src/loadOsNode.ts +0 -44
  203. package/src/manifest/index.ts +0 -2
  204. package/src/manifest/manifestReplacementTokens.ts +0 -6
  205. package/src/manifest/os-node.manifest.json +0 -132
  206. package/src/manifests/dapp-window.manifest.json +0 -36
  207. package/src/manifests/index.ts +0 -1
  208. package/src/models/access/ValidDappAccessInterfaces.ts +0 -6
  209. package/src/models/access/index.ts +0 -1
  210. package/src/models/index.ts +0 -1
  211. package/src/profileModuleEvents.ts +0 -43
  212. package/src/registration/DappRegistrationService.ts +0 -180
  213. package/src/registration/DappRegistry.ts +0 -129
  214. package/src/registration/ValidateDappAccessDiviner/Config.ts +0 -24
  215. package/src/registration/ValidateDappAccessDiviner/Diviner.ts +0 -133
  216. package/src/registration/ValidateDappAccessDiviner/index.ts +0 -2
  217. package/src/registration/index.ts +0 -2
  218. package/src/scripts/xyos/command/config.ts +0 -19
  219. package/src/scripts/xyos/command/create.ts +0 -22
  220. package/src/scripts/xyos/command/index.ts +0 -7
  221. package/src/scripts/xyos/command/manifest.ts +0 -19
  222. package/src/scripts/xyos/command/start.ts +0 -35
  223. package/src/scripts/xyos/index.ts +0 -31
  224. package/src/scripts/xyos/lib/createFromTemplate.ts +0 -11
  225. package/src/scripts/xyos/lib/headless.ts +0 -68
  226. package/src/scripts/xyos/lib/index.ts +0 -2
  227. package/src/signer/Signer.spec.ts +0 -65
  228. package/src/signer/Signers.ts +0 -74
  229. package/src/signer/index.ts +0 -1
  230. package/src/spec/boot.spec.ts +0 -89
  231. package/src/stack/Base.ts +0 -165
  232. package/src/stack/Manager.ts +0 -51
  233. package/src/stack/Map.ts +0 -22
  234. package/src/stack/OsPubSubNetworkStack.ts +0 -70
  235. package/src/stack/OsSettingsStack.ts +0 -24
  236. package/src/stack/XyoPublicNetworkStack.ts +0 -32
  237. package/src/stack/index.ts +0 -6
  238. package/src/system/ManageSystemDapps.ts +0 -148
  239. package/src/system/Queries.ts +0 -69
  240. package/src/system/index.ts +0 -1
  241. package/src/types/global.d.ts +0 -9
  242. package/src/types/images.d.ts +0 -5
  243. package/src/utils/buildWalletSeedPhrasePayload.ts +0 -51
  244. package/src/utils/getApiDomain.ts +0 -14
  245. package/src/utils/index.ts +0 -3
  246. package/src/utils/renameObjKey.ts +0 -22
  247. package/src/wallet/DappSeedPhraseRepository.ts +0 -99
  248. package/src/wallet/SeedPhraseRepository.ts +0 -31
  249. package/src/wallet/index.ts +0 -2
@@ -1,132 +0,0 @@
1
- {
2
- "$schema": "https://raw.githubusercontent.com/XYOracleNetwork/sdk-xyo-client-js/main/packages/manifest/src/compilations/dapp-package-manifest-schema.json",
3
- "nodes": [
4
- {
5
- "config": {
6
- "accountPath": "0'",
7
- "name": "OsNode",
8
- "schema": "network.xyo.node.config"
9
- },
10
- "modules": {
11
- "private": [],
12
- "public": [
13
- {
14
- "config": {
15
- "accountPath": "1'",
16
- "name": "OSArchivist",
17
- "dbName": "OSArchivist-2025-01-13",
18
- "labels": {
19
- "network.xyo.archivist.persistence.scope": "device"
20
- },
21
- "storeName": "payloads",
22
- "parents": {
23
- "read": [
24
- "Archivist"
25
- ]
26
- },
27
- "schema": "network.xyo.archivist.config"
28
- }
29
- },
30
- {
31
- "config": {
32
- "accountPath": "3'",
33
- "name": "DappsArchivist",
34
- "dbName": "DappsArchivist-2025-01-13",
35
- "labels": {
36
- "network.xyo.archivist.persistence.scope": "device"
37
- },
38
- "storeName": "payloads",
39
- "schema": "network.xyo.archivist.config"
40
- }
41
- },
42
- {
43
- "config": {
44
- "archivist": "DappsArchivist",
45
- "dbVersion": 1,
46
- "name": "DappsArchivistPayloadDiviner",
47
- "labels": {
48
- "network.xyo.archivist.persistence.scope": "device"
49
- },
50
- "schema": "network.xyo.diviner.payload.generic.config"
51
- }
52
- },
53
- {
54
- "config": {
55
- "accountPath": "4'",
56
- "dbName": "IntentArchivist-2025-01-13",
57
- "name": "IntentArchivist",
58
- "storeName": "payloads",
59
- "labels": {
60
- "network.xyo.archivist.persistence.scope": "device"
61
- },
62
- "schema": "network.xyo.archivist.config"
63
- }
64
- },
65
- {
66
- "config": {
67
- "accountPath": "7",
68
- "archivist": "IntentArchivist",
69
- "dbVersion": 1,
70
- "name": "IntentArchivistPayloadDiviner",
71
- "labels": {
72
- "network.xyo.archivist.persistence.scope": "device"
73
- },
74
- "schema": "network.xyo.diviner.payload.generic.config",
75
- "storeName": "payloads"
76
- }
77
- },
78
- {
79
- "config": {
80
- "accountPath": "8",
81
- "name": "RegisteredDappInterfacesArchivist",
82
- "schema": "network.xyo.archivist.memory.config"
83
- }
84
- },
85
- {
86
- "config": {
87
- "accountPath": "9'",
88
- "name": "DappsArchivistDevelopment",
89
- "parents": {
90
- "write": [
91
- "DappsArchivist"
92
- ]
93
- },
94
- "schema": "network.xyo.archivist.memory.config"
95
- }
96
- },
97
- {
98
- "config": {
99
- "accountPath": "10",
100
- "archivist": "DappsArchivistDevelopment",
101
- "dbVersion": 1,
102
- "name": "DappsArchivistPayloadDivinerDevelopment",
103
- "labels": {
104
- "network.xyo.generic.payload.diviner": "GenericPayloadDiviner"
105
- },
106
- "schema": "network.xyo.diviner.payload.generic.config"
107
- }
108
- },
109
- {
110
- "config": {
111
- "name": "OsPubSubNetworkStackNode",
112
- "schema": "network.xyo.node.config"
113
- }
114
- },
115
- {
116
- "config": {
117
- "name": "OsSettingsStackNode",
118
- "schema": "network.xyo.node.config"
119
- }
120
- },
121
- {
122
- "config": {
123
- "name": "OsXyoPublicNetworkStackNode",
124
- "schema": "network.xyo.node.config"
125
- }
126
- }
127
- ]
128
- }
129
- }
130
- ],
131
- "schema": "network.xyo.manifest.package.dapp"
132
- }
@@ -1,36 +0,0 @@
1
- {
2
- "$schema": "https://raw.githubusercontent.com/XYOracleNetwork/sdk-xyo-client-js/main/packages/manifest/src/compilations/dapp-package-manifest-schema.json",
3
- "nodes": [
4
- {
5
- "config": {
6
- "accountPath": "0'",
7
- "name": "Dapp",
8
- "schema": "network.xyo.node.config"
9
- },
10
- "modules": {
11
- "private": [],
12
- "public": [
13
- {
14
- "config": {
15
- "accountPath": "0'/0'",
16
- "name": "DappArchivist",
17
- "schema": "network.xyo.archivist.memory.config"
18
- }
19
- },
20
- {
21
- "config": {
22
- "accountPath": "0'/1'",
23
- "archivist": "DappArchivist",
24
- "labels": {
25
- "network.xyo.generic.payload.diviner": "GenericPayloadDiviner"
26
- },
27
- "name": "DappArchivistPayloadDiviner",
28
- "schema": "network.xyo.diviner.payload.generic.config"
29
- }
30
- }
31
- ]
32
- }
33
- }
34
- ],
35
- "schema": "network.xyo.manifest.package.dapp"
36
- }
@@ -1 +0,0 @@
1
- export { default as DappWindowManifest } from './dapp-window.manifest.json' with { type: 'json' }
@@ -1,6 +0,0 @@
1
- import type { DappAccessInterface } from '@xyo-network/os-model'
2
- import { RegisteredNames, RegisteredNamesInterface } from '@xyo-network/os-model'
3
-
4
- export type ValidDappAccessInterfaces = typeof RegisteredNames
5
-
6
- export const ValidDappAccessInterfaces: Record<string, DappAccessInterface> = { [RegisteredNames]: RegisteredNamesInterface }
@@ -1 +0,0 @@
1
- export * from './ValidDappAccessInterfaces.ts'
@@ -1 +0,0 @@
1
- export * from './access/index.ts'
@@ -1,43 +0,0 @@
1
- import type { Address } from '@xylabs/sdk-js'
2
- import type { QuerySendStartedEventArgs } from '@xyo-network/bridge-model'
3
- import type { ModuleInstance } from '@xyo-network/module-model'
4
- import { PayloadBuilder } from '@xyo-network/payload-builder'
5
-
6
- const DISPLAY_EVENT_COUNT_FREQUENCY = 100 as const
7
-
8
- export interface ProfileEventsData {
9
- allEventCount: number
10
- eventCounts: { [key: string | number | symbol]: number }
11
- }
12
-
13
- export const profileData: Record<Address, ProfileEventsData> = {}
14
-
15
- export const profileModuleEvents = (mod: ModuleInstance) => {
16
- const modRef = new WeakRef(mod) // prevent memory leak
17
- mod.onAny(async (eventName, args) => {
18
- const mod = modRef.deref()
19
- if (mod) {
20
- const data = profileData[mod.address] ?? { allEventCount: 0, eventCounts: {} }
21
- profileData[mod.address] = data
22
- data.allEventCount += 1
23
- data.eventCounts[eventName] = (data.eventCounts[eventName] ?? 0) + 1
24
- if (eventName === 'querySendStarted') {
25
- const { query, payloads = [] } = args as QuerySendStartedEventArgs
26
- const pairs = await PayloadBuilder.dataHashPairs(payloads)
27
- const foundPair = pairs.find(([, hash]) => hash === query.query)
28
- if (foundPair) {
29
- const [payload] = foundPair
30
- console.log(`querySendStarted: ${payload.schema}`)
31
- }
32
- }
33
- if (eventName === 'querySendFinished') {
34
- const { query } = args as QuerySendStartedEventArgs
35
- console.log(`querySendFinished: ${query.query}`)
36
- }
37
- if (data.allEventCount % DISPLAY_EVENT_COUNT_FREQUENCY === 0) {
38
- console.log(`[PROFILE] - ${mod.id} Event Counts:`)
39
- console.log(data.eventCounts)
40
- }
41
- }
42
- })
43
- }
@@ -1,180 +0,0 @@
1
- import type { Promisable } from '@xylabs/sdk-js'
2
- import {
3
- forget, fulfilled, rejected,
4
- } from '@xylabs/sdk-js'
5
- import { ModuleFactoryLocator } from '@xyo-network/module-factory-locator'
6
- import type { ModuleFactoryLocatorInstance } from '@xyo-network/module-model'
7
- import type {
8
- DappPackageManifestPayload,
9
- DappParams,
10
- DappRegistrationResults,
11
- PayloadWithVersion,
12
- RegisteredDappSetResult,
13
- XyOsContext,
14
- XyOsDappContext,
15
- } from '@xyo-network/os-model'
16
- import {
17
- DappIntentTypes,
18
- DappMode,
19
- isRegisteredDappAccessDappSet,
20
- isRegisteredDappExposedDappSet,
21
- } from '@xyo-network/os-model'
22
-
23
- import {
24
- dappAccessRequestConnection, DappAccessRequestEvent, exposeDappRequestConnection, ExposeDappRequestEvent,
25
- } from '../event/index.ts'
26
- import { DappIntentCaller } from '../intent/index.ts'
27
- import { NameTransforms } from '../lib/index.ts'
28
- import { ManageSystemDapps } from '../system/index.ts'
29
- import { DappSeedPhraseRepository } from '../wallet/index.ts'
30
- import { XyOsDapp } from '../XyOsDapp.ts'
31
- import { DappRegistry } from './DappRegistry.ts'
32
-
33
- export interface DappRegistrationServiceParams {
34
- dappNames: string[]
35
- dappParams: Record<string, DappParams>
36
- dappPayloads: PayloadWithVersion[]
37
- }
38
-
39
- export class DappRegistrationService {
40
- // Dapps that have been built with their own context
41
- builtDapps: Record<string, XyOsDappContext> = {}
42
-
43
- dappRegistry: DappRegistry
44
- dappSeedPhraseRepository: DappSeedPhraseRepository
45
- manageSystemDapps: ManageSystemDapps
46
-
47
- // Dapps that have been registered with dappAccessRequests
48
- registeredAccessDappSets: Set<RegisteredDappSetResult> = new Set()
49
-
50
- // Dapps that have been registered with the dapp registry
51
- registeredDappSets: Set<RegisteredDappSetResult> = new Set()
52
-
53
- // Dapps that have been registered with exposeDappRequests
54
- registeredExposedDappSets: Set<RegisteredDappSetResult> = new Set()
55
-
56
- private context: XyOsContext
57
-
58
- private dappAccessRequestConnection = dappAccessRequestConnection()
59
- private developmentMode?: boolean
60
-
61
- private exposeDappRequestConnection = exposeDappRequestConnection()
62
-
63
- private locator: ModuleFactoryLocatorInstance
64
-
65
- private params: DappRegistrationServiceParams
66
-
67
- constructor(
68
- context: XyOsContext,
69
- params?: DappRegistrationServiceParams,
70
- locator: ModuleFactoryLocatorInstance = new ModuleFactoryLocator(),
71
- developmentMode?: boolean,
72
- ) {
73
- this.context = context
74
- this.params = params ?? {
75
- dappNames: [], dappParams: {}, dappPayloads: [],
76
- }
77
- this.locator = locator
78
- this.developmentMode = developmentMode
79
-
80
- this.manageSystemDapps = new ManageSystemDapps(
81
- context,
82
- this.params?.dappNames ?? [],
83
- this.params?.dappPayloads ?? [],
84
- this.params?.dappParams ?? {},
85
- this.locator,
86
- this.developmentMode,
87
- )
88
- this.dappSeedPhraseRepository = new DappSeedPhraseRepository(context, this.params?.dappNames ?? [])
89
- this.dappRegistry = new DappRegistry(this.dappSeedPhraseRepository)
90
-
91
- this.addConnectionRequests()
92
- }
93
-
94
- async buildDapp(
95
- manifest: DappPackageManifestPayload,
96
- dappId = NameTransforms.slug(manifest.nodes[0]?.config.name),
97
- name = NameTransforms.moduleName(manifest.nodes[0]?.config.name),
98
- ): Promise<XyOsDappContext> {
99
- const dapp = new XyOsDapp({
100
- dapp: { id: dappId, name },
101
- locator: this.locator,
102
- manifest,
103
- parent: this.context,
104
- user: await this.getUser(),
105
- }) as XyOsDappContext
106
- this.builtDapps[dappId] = dapp
107
- return dapp
108
- }
109
-
110
- getParamsForRegisteredDapp(dappId: string) {
111
- return this.params?.dappParams[dappId]
112
- }
113
-
114
- async start(): Promise<DappRegistrationResults> {
115
- const systemDapps = await this.context.monitor(async () => await this.manageSystemDapps.install(), { name: 'Install System dApps' })
116
- const activeDapps = systemDapps.filter(({ dapp }) => dapp.icon.active === true)
117
- const results = await Promise.allSettled(
118
- activeDapps.map(async (dappSet) => {
119
- const { dapp } = dappSet
120
- const registeredDapp = await this.dappRegistry.registerDapp(dapp)
121
- const result: RegisteredDappSetResult = { dapp: registeredDapp, dappIcon: dapp.icon }
122
-
123
- // Start post registration process in the background
124
- const forgetHandlers = async () => {
125
- try {
126
- await this.postRegistrationHandlers(result)
127
- } catch (e) {
128
- console.error('Error in post registration handlers', e)
129
- }
130
- }
131
- forget(forgetHandlers())
132
-
133
- return result
134
- }),
135
- )
136
- const failed = results.filter(rejected).map(result => result.reason)
137
- const succeeded = results.filter(fulfilled).map(result => result.value)
138
-
139
- for (const registeredDapp of succeeded) this.registeredDappSets.add(registeredDapp)
140
-
141
- return { failed, succeeded }
142
- }
143
-
144
- private addConnectionRequests() {
145
- this.context.eventBus.addConnection(this.dappAccessRequestConnection)
146
- this.context.eventBus.addConnection(this.exposeDappRequestConnection)
147
- }
148
-
149
- /**
150
- * A method to get the user property from context and eventually modify it before handing it to a dapp
151
- * i.e. curating user-approved signers
152
- */
153
- private getUser(): Promisable<XyOsContext['user']> {
154
- return this.context.user
155
- }
156
-
157
- private async postRegistrationHandlers(registeredDapp: RegisteredDappSetResult) {
158
- if (registeredDapp.dapp) {
159
- if (isRegisteredDappExposedDappSet(registeredDapp)) {
160
- // add to exposed dapp set
161
- this.registeredExposedDappSets.add(registeredDapp)
162
- // craft intent
163
- const exposeIntent = DappIntentCaller.buildIntent(
164
- DappIntentCaller.OsDappName,
165
- DappIntentTypes.Launch,
166
- registeredDapp.dapp.config.name,
167
- DappMode.Exposed,
168
- )
169
- // emit to bus
170
- await this.exposeDappRequestConnection.emit(ExposeDappRequestEvent, { payloads: [registeredDapp.dapp.config, exposeIntent] })
171
- }
172
- if (isRegisteredDappAccessDappSet(registeredDapp)) {
173
- // add to access dapp set
174
- this.registeredAccessDappSets.add(registeredDapp)
175
- // emit to bus
176
- await this.dappAccessRequestConnection.emit(DappAccessRequestEvent, { payloads: registeredDapp.dapp.accessors })
177
- }
178
- }
179
- }
180
- }
@@ -1,129 +0,0 @@
1
- import type { Hash } from '@xylabs/sdk-js'
2
- import type {
3
- DappPackageManifestPayload,
4
- DappParams,
5
- RegisteredDapp,
6
- RegisteredDappAccess,
7
- UnregisteredDapp,
8
- UnregisteredDappAccess,
9
- } from '@xyo-network/os-model'
10
- import {
11
- DappRegisteredSchema,
12
- DappRegisteredState,
13
- isRegisteredDappAccess,
14
- } from '@xyo-network/os-model'
15
- import { HDWallet } from '@xyo-network/wallet'
16
-
17
- import type { DappSeedPhraseRepository } from '../wallet/index.ts'
18
- import type { FailedAccessor } from './ValidateDappAccessDiviner/index.ts'
19
- import {
20
- isFailedAccessor,
21
- ValidateDappAccessDiviner,
22
- ValidateDappAccessDivinerConfigSchema,
23
- } from './ValidateDappAccessDiviner/index.ts'
24
-
25
- export type DappRegisteredId = string
26
-
27
- /**
28
- * Manage Dapp Registration
29
- */
30
- export class DappRegistry {
31
- private dappRegistry: Map<DappRegisteredId, RegisteredDapp> = new Map()
32
- private dappSeedPhraseRepository: DappSeedPhraseRepository
33
-
34
- constructor(dappSeedPhraseRepository: DappSeedPhraseRepository) {
35
- this.dappSeedPhraseRepository = dappSeedPhraseRepository
36
- }
37
-
38
- /**
39
- * Register a Dapp with window manager and if successful, return its id
40
- * @param dapp Manifest and UI of the Dapp to register
41
- * @returns dapp with registration fields
42
- */
43
- async registerDapp(dapp?: UnregisteredDapp): Promise<RegisteredDapp | null> {
44
- if (dapp) {
45
- const {
46
- exposedModuleIds, manifest, modes, name, version, params, widgetConfigs,
47
- } = this.extractDappProperties(dapp)
48
-
49
- try {
50
- /**
51
- * TODO: More validation from sources is needed for third-party dapps. A name needs some form of verification
52
- * before trusting it with a seed phrase at that given name.
53
- */
54
-
55
- // get a seed phrase for the given dapp id
56
- const walletId = await this.dappSeedPhraseRepository.findOrCreate(name)
57
-
58
- const registeredAccessors = await this.validateDappAccessPayloads(manifest, dapp.accessors, params)
59
-
60
- const registeredDapp: RegisteredDapp = {
61
- accessors: registeredAccessors,
62
- config: {
63
- exposedModuleIds,
64
- manifest,
65
- modes,
66
- name,
67
- schema: DappRegisteredSchema,
68
- state: DappRegisteredState.Registered,
69
- version,
70
- // attach the walletId to a registered dapp so it can request it back in the future
71
- walletId,
72
- },
73
- params,
74
- widgetConfigs,
75
- }
76
-
77
- if (this.dappRegistry.get(name)) {
78
- console.warn('tried to register two dapps with the same name', name)
79
- return null
80
- }
81
- this.dappRegistry.set(name, registeredDapp)
82
- return registeredDapp
83
- } catch (e) {
84
- console.error('Error registeringDapp', e)
85
- return null
86
- }
87
- } else {
88
- return null
89
- }
90
- }
91
-
92
- /**
93
- * Unregister a dapp so it can no longer be launched
94
- * @param dappId
95
- */
96
- unregisterDapp(dappId: Hash) {
97
- this.dappRegistry.delete(dappId)
98
- }
99
-
100
- private extractDappProperties(dapp: UnregisteredDapp) {
101
- const {
102
- params, config, widgetConfigs,
103
- } = dapp
104
- const {
105
- exposedModuleIds, manifest, modes, name, sources, version,
106
- } = config
107
-
108
- return {
109
- exposedModuleIds, manifest, modes, name, params, sources, version, widgetConfigs,
110
- }
111
- }
112
-
113
- private async validateDappAccessPayloads(manifest: DappPackageManifestPayload, accessors: UnregisteredDappAccess[] = [], params: DappParams) {
114
- const validateDappAccess = await ValidateDappAccessDiviner.create({
115
- account: await HDWallet.random(),
116
- config: { schema: ValidateDappAccessDivinerConfigSchema },
117
- dappParams: params,
118
- })
119
- const payloads = await validateDappAccess.divine([manifest, ...accessors])
120
- const failedAccessors = payloads.filter(isFailedAccessor) as FailedAccessor[]
121
- const registeredAccessors = payloads.filter(isRegisteredDappAccess) as RegisteredDappAccess[]
122
-
123
- if (failedAccessors.length > 0) {
124
- console.error('Failed to register all dapp accessors', failedAccessors)
125
- }
126
-
127
- return registeredAccessors
128
- }
129
- }
@@ -1,24 +0,0 @@
1
- import type { DivinerParams } from '@xyo-network/diviner-model'
2
- import type { PackageManifestPayload } from '@xyo-network/manifest'
3
- import type {
4
- DappPackageManifestPayload, DappParams, RegisteredDappAccess, UnregisteredDappAccess,
5
- } from '@xyo-network/os-model'
6
- import type { Payload } from '@xyo-network/payload-model'
7
- import { asSchema, isPayloadOfSchemaType } from '@xyo-network/payload-model'
8
-
9
- export const FailedAccessorSchema = asSchema('network.xyo.os.failed.accessor.registration', true)
10
- export type FailedAccessorSchema = typeof FailedAccessorSchema
11
-
12
- export type FailedAccessor = Payload<{
13
- accessor: UnregisteredDappAccess
14
- errorMessage: string
15
- }, FailedAccessorSchema>
16
-
17
- export const isFailedAccessor = isPayloadOfSchemaType<FailedAccessor>(FailedAccessorSchema)
18
-
19
- export type ValidateDappAccessDivinerParams = DivinerParams & { dappParams: DappParams }
20
- export type ValidateDappAccessDivinerIn = DappPackageManifestPayload | PackageManifestPayload | UnregisteredDappAccess
21
- export type ValidateDappAccessDivinerOut = RegisteredDappAccess | FailedAccessor
22
-
23
- export const ValidateDappAccessDivinerConfigSchema = asSchema('network.xyo.os.dapp.access.registration.validate', true)
24
- export type ValidateDappAccessDivinerConfigSchema = typeof ValidateDappAccessDivinerConfigSchema