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