@xyo-network/os-runtime 5.0.12 → 6.0.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 (55) hide show
  1. package/dist/neutral/index.mjs +96 -63
  2. package/dist/neutral/index.mjs.map +1 -1
  3. package/dist/node/index.mjs +96 -63
  4. package/dist/node/index.mjs.map +1 -1
  5. package/dist/node/scripts/xyos/index.mjs +65 -46
  6. package/dist/node/scripts/xyos/index.mjs.map +1 -1
  7. package/dist/types/DappCallerBase.d.ts +4 -52
  8. package/dist/types/DappCallerBase.d.ts.map +1 -1
  9. package/dist/types/OsCallerBase.d.ts +5 -61
  10. package/dist/types/OsCallerBase.d.ts.map +1 -1
  11. package/dist/types/XyOs.d.ts +2 -18
  12. package/dist/types/XyOs.d.ts.map +1 -1
  13. package/dist/types/XyOsBase.d.ts +2 -2
  14. package/dist/types/XyOsBase.d.ts.map +1 -1
  15. package/dist/types/XyOsDapp.d.ts +2 -18
  16. package/dist/types/XyOsDapp.d.ts.map +1 -1
  17. package/dist/types/access/RunningAccessDappCache.d.ts +1 -9
  18. package/dist/types/access/RunningAccessDappCache.d.ts.map +1 -1
  19. package/dist/types/access/interfaces/registered-names/helpers/AccessNodeQueries.d.ts +1 -9
  20. package/dist/types/access/interfaces/registered-names/helpers/AccessNodeQueries.d.ts.map +1 -1
  21. package/dist/types/access/interfaces/registered-names/helpers/resource/AbstractXnsCaller.d.ts +3 -35
  22. package/dist/types/access/interfaces/registered-names/helpers/resource/AbstractXnsCaller.d.ts.map +1 -1
  23. package/dist/types/adapter/Base.d.ts +3 -11
  24. package/dist/types/adapter/Base.d.ts.map +1 -1
  25. package/dist/types/adapter/Network.d.ts +1 -9
  26. package/dist/types/adapter/Network.d.ts.map +1 -1
  27. package/dist/types/adapter/Settings.d.ts +1 -9
  28. package/dist/types/adapter/Settings.d.ts.map +1 -1
  29. package/dist/types/classes/settings/CallerBase.d.ts +2 -26
  30. package/dist/types/classes/settings/CallerBase.d.ts.map +1 -1
  31. package/dist/types/event/bus/Connection.d.ts +2 -2
  32. package/dist/types/event/bus/Connection.d.ts.map +1 -1
  33. package/dist/types/event/bus/EventBus.d.ts +1 -9
  34. package/dist/types/event/bus/EventBus.d.ts.map +1 -1
  35. package/dist/types/lib/isPayload.d.ts +1 -4
  36. package/dist/types/lib/isPayload.d.ts.map +1 -1
  37. package/dist/types/stack/Base.d.ts +2 -2
  38. package/dist/types/stack/Base.d.ts.map +1 -1
  39. package/dist/types/stack/OsPubSubNetworkStack.d.ts +2 -18
  40. package/dist/types/stack/OsPubSubNetworkStack.d.ts.map +1 -1
  41. package/package.json +50 -52
  42. package/src/DappCallerBase.ts +4 -4
  43. package/src/OsCallerBase.ts +5 -5
  44. package/src/PubSubBridgeCaller.ts +1 -1
  45. package/src/XyOsBase.ts +2 -2
  46. package/src/access/Caller.ts +1 -1
  47. package/src/access/interfaces/registered-names/helpers/AccessNodeQueries.ts +2 -2
  48. package/src/access/interfaces/registered-names/helpers/resource/AbstractXnsCaller.ts +3 -3
  49. package/src/adapter/Base.ts +4 -4
  50. package/src/classes/settings/CallerBase.ts +2 -2
  51. package/src/dapp/context/creator/createDappContext.ts +1 -1
  52. package/src/event/bus/Connection.ts +2 -2
  53. package/src/event/bus/EventBus.ts +1 -0
  54. package/src/loadOsNode.ts +2 -2
  55. package/src/stack/Base.ts +3 -3
@@ -33,7 +33,7 @@ var createFromTemplate = /* @__PURE__ */ __name(async ({ target, template }) =>
33
33
  }, "createFromTemplate");
34
34
 
35
35
  // src/scripts/xyos/lib/headless.ts
36
- import fs from "node:fs";
36
+ import fs from "fs";
37
37
  import { boot as boot2 } from "@xyo-network/bios";
38
38
  import { Kernel as Kernel2 } from "@xyo-network/kernel";
39
39
  import { HDWallet as HDWallet5 } from "@xyo-network/wallet";
@@ -50,8 +50,8 @@ import { ModuleFactoryLocator as ModuleFactoryLocator6 } from "@xyo-network/modu
50
50
 
51
51
  // src/event/bus/Connection.ts
52
52
  import { assertEx } from "@xylabs/assert";
53
- import { ModuleBaseEmitter } from "@xyo-network/module-event-emitter";
54
- var EventBusConnection = class extends ModuleBaseEmitter {
53
+ import { BaseEmitter } from "@xylabs/events";
54
+ var EventBusConnection = class extends BaseEmitter {
55
55
  static {
56
56
  __name(this, "EventBusConnection");
57
57
  }
@@ -93,7 +93,9 @@ var EventBus = class {
93
93
  publisherCallbacks = {};
94
94
  startMutex = new Mutex();
95
95
  get archivist() {
96
- return asArchivistInstance(assertEx2(this._archivist, () => "Archivist not found. Did you forget to call start()?"), "not a valid archivist instance");
96
+ return asArchivistInstance(assertEx2(this._archivist, () => "Archivist not found. Did you forget to call start()?"), "not a valid archivist instance", {
97
+ required: true
98
+ });
97
99
  }
98
100
  addConnection(connection) {
99
101
  const id = uuid();
@@ -439,10 +441,10 @@ var os_node_manifest_default = {
439
441
  var OS_NODE_PATH = "1'";
440
442
  var getDefaultOsNodeLocator = /* @__PURE__ */ __name(() => {
441
443
  const locator = new ModuleFactoryLocator();
442
- locator.register(IndexedDbArchivist, {
444
+ locator.register(IndexedDbArchivist.factory(), {
443
445
  "network.xyo.archivist.persistence.scope": "device"
444
446
  });
445
- locator.register(IndexedDbPayloadDiviner, {
447
+ locator.register(IndexedDbPayloadDiviner.factory(), {
446
448
  "network.xyo.archivist.persistence.scope": "device"
447
449
  });
448
450
  return locator;
@@ -496,26 +498,34 @@ var DappCallerBase = class {
496
498
  */
497
499
  async getDappArchivist() {
498
500
  const mod = assertEx3(await this.context.root.resolve(DappArchivistModuleName), () => `${DappArchivistModuleName} not found [${toJsonString(this.context.root.publicChildren())}]`);
499
- return asArchivistInstance2(mod, () => `${DappArchivistModuleName} is not an archivist`);
501
+ return asArchivistInstance2(mod, () => `${DappArchivistModuleName} is not an archivist`, {
502
+ required: true
503
+ });
500
504
  }
501
505
  /**
502
506
  * Get the DappArchivistPayloadDiviner
503
507
  */
504
508
  async getDappArchivistPayloadDiviner() {
505
509
  const mod = assertEx3(await this.context.root.resolve(DappArchivistPayloadDivinerModuleName), () => `${DappArchivistPayloadDivinerModuleName} not found`);
506
- return asDivinerInstance2(mod, () => `${DappArchivistPayloadDivinerModuleName} is not a diviner`);
510
+ return asDivinerInstance2(mod, () => `${DappArchivistPayloadDivinerModuleName} is not a diviner`, {
511
+ required: true
512
+ });
507
513
  }
508
514
  /**
509
515
  * Get the IntentArchivist
510
516
  */
511
517
  async getDappIntentArchivist() {
512
518
  const mod = assertEx3(await this.context.root.resolve(IntentArchivistModuleName), () => `${IntentArchivistModuleName} not found`);
513
- return asArchivistInstance2(mod, () => `${IntentArchivistModuleName} is not an archivist`);
519
+ return asArchivistInstance2(mod, () => `${IntentArchivistModuleName} is not an archivist`, {
520
+ required: true
521
+ });
514
522
  }
515
523
  // Get the IntentArchivistPayloadDiviner
516
524
  async getDappIntentArchivistPayloadDiviner() {
517
525
  const mod = assertEx3(await this.context.root.resolve(IntentArchivistPayloadDivinerModuleName), () => `${IntentArchivistPayloadDivinerModuleName} not found`);
518
- return asDivinerInstance2(mod, () => `${IntentArchivistPayloadDivinerModuleName} is not a diviner`);
526
+ return asDivinerInstance2(mod, () => `${IntentArchivistPayloadDivinerModuleName} is not a diviner`, {
527
+ required: true
528
+ });
519
529
  }
520
530
  };
521
531
 
@@ -605,27 +615,37 @@ var OsCallerBase = class {
605
615
  // Get the dapps archivist
606
616
  async getDappsArchivist() {
607
617
  const mod = assertEx4(await this.context.root.resolve(DappsArchivistModuleName), () => `${DappsArchivistModuleName} not found`);
608
- return asArchivistInstance3(mod, () => `${DappsArchivistModuleName} is not an archivist`);
618
+ return asArchivistInstance3(mod, () => `${DappsArchivistModuleName} is not an archivist`, {
619
+ required: true
620
+ });
609
621
  }
610
622
  // Get the dapps archivist development
611
623
  async getDappsArchivistDevelopment() {
612
624
  const mod = assertEx4(await this.context.root.resolve(DappsArchivistDevelopmentModuleName), () => `${DappsArchivistDevelopmentModuleName} not found`);
613
- return asArchivistInstance3(mod, () => `${DappsArchivistDevelopmentModuleName} is not an archivist`);
625
+ return asArchivistInstance3(mod, () => `${DappsArchivistDevelopmentModuleName} is not an archivist`, {
626
+ required: true
627
+ });
614
628
  }
615
629
  // Get the dapps archivist payload diviner
616
630
  async getDappsArchivistPayloadDiviner() {
617
631
  const mod = assertEx4(await this.context.root.resolve(DappsArchivistPayloadDivinerModuleName), () => `${DappsArchivistPayloadDivinerModuleName} not found`);
618
- return asDivinerInstance3(mod, () => `${DappsArchivistPayloadDivinerModuleName} is not a diviner`);
632
+ return asDivinerInstance3(mod, () => `${DappsArchivistPayloadDivinerModuleName} is not a diviner`, {
633
+ required: true
634
+ });
619
635
  }
620
636
  // Get the dapps archivist payload diviner development
621
637
  async getDappsArchivistPayloadDivinerDevelopment() {
622
638
  const mod = assertEx4(await this.context.root.resolve(DappsArchivistPayloadDevelopmentDivinerModuleName), () => `${DappsArchivistPayloadDevelopmentDivinerModuleName} not found`);
623
- return asDivinerInstance3(mod, () => `${DappsArchivistPayloadDevelopmentDivinerModuleName} is not a diviner`);
639
+ return asDivinerInstance3(mod, () => `${DappsArchivistPayloadDevelopmentDivinerModuleName} is not a diviner`, {
640
+ required: true
641
+ });
624
642
  }
625
643
  // Get the registered dapp interfaces archivist
626
644
  async getRegisteredDappInterfacesArchivist() {
627
645
  const mod = assertEx4(await this.context.root.resolve(RegisteredDappInterfacesArchivistModuleName), () => `${RegisteredDappInterfacesArchivistModuleName} not found`);
628
- return asArchivistInstance3(mod, () => `${RegisteredDappInterfacesArchivistModuleName} is not an archivist`);
646
+ return asArchivistInstance3(mod, () => `${RegisteredDappInterfacesArchivistModuleName} is not an archivist`, {
647
+ required: true
648
+ });
629
649
  }
630
650
  };
631
651
 
@@ -710,9 +730,9 @@ var ManageSystemDapps = class extends OsCallerBase {
710
730
  defaultSystemDappParams;
711
731
  locator;
712
732
  developmentMode;
713
- onErrorCallbacks;
733
+ onErrorCallbacks = [];
714
734
  constructor(context, defaultSystemNames, defaultSystemDapps, defaultSystemDappParams, locator, developmentMode) {
715
- super(context), this.defaultSystemNames = defaultSystemNames, this.defaultSystemDapps = defaultSystemDapps, this.defaultSystemDappParams = defaultSystemDappParams, this.locator = locator, this.developmentMode = developmentMode, this.onErrorCallbacks = [];
735
+ super(context), this.defaultSystemNames = defaultSystemNames, this.defaultSystemDapps = defaultSystemDapps, this.defaultSystemDappParams = defaultSystemDappParams, this.locator = locator, this.developmentMode = developmentMode;
716
736
  }
717
737
  /**
718
738
  * Add a callback to listen for errors throwing during system dapp registration
@@ -817,11 +837,11 @@ var DappSeedPhraseRepository = class extends OsCallerBase {
817
837
  }
818
838
  allowedNames;
819
839
  // record of all dapps that have requested a seed phrase with the OS
820
- dappIdRepository;
840
+ dappIdRepository = /* @__PURE__ */ new Map();
821
841
  // record of all walletIds that have been issued to registered dapps
822
- walletIdRepository;
842
+ walletIdRepository = /* @__PURE__ */ new Map();
823
843
  constructor(xyOs, allowedNames) {
824
- super(xyOs), this.allowedNames = allowedNames, this.dappIdRepository = /* @__PURE__ */ new Map(), this.walletIdRepository = /* @__PURE__ */ new Map();
844
+ super(xyOs), this.allowedNames = allowedNames;
825
845
  }
826
846
  async add(dappId) {
827
847
  const archivist = await this.getDappsArchivist();
@@ -943,10 +963,10 @@ var dapp_window_manifest_default = {
943
963
 
944
964
  // src/XyOsBase.ts
945
965
  import { assertEx as assertEx5 } from "@xylabs/assert";
946
- import { ModuleBaseEmitter as ModuleBaseEmitter2 } from "@xyo-network/module-event-emitter";
966
+ import { BaseEmitter as BaseEmitter2 } from "@xylabs/events";
947
967
  import { ModuleFactoryLocator as ModuleFactoryLocator2 } from "@xyo-network/module-factory-locator";
948
968
  import { Mutex as Mutex2 } from "async-mutex";
949
- var XyOsContextBase = class extends ModuleBaseEmitter2 {
969
+ var XyOsContextBase = class extends BaseEmitter2 {
950
970
  static {
951
971
  __name(this, "XyOsContextBase");
952
972
  }
@@ -1223,10 +1243,9 @@ var DappRegistry = class {
1223
1243
  __name(this, "DappRegistry");
1224
1244
  }
1225
1245
  dappSeedPhraseRepository;
1226
- dappRegistry;
1246
+ dappRegistry = /* @__PURE__ */ new Map();
1227
1247
  constructor(dappSeedPhraseRepository) {
1228
1248
  this.dappSeedPhraseRepository = dappSeedPhraseRepository;
1229
- this.dappRegistry = /* @__PURE__ */ new Map();
1230
1249
  }
1231
1250
  /**
1232
1251
  * Register a Dapp with window manager and if successful, return its id
@@ -1323,18 +1342,18 @@ var DappRegistrationService = class {
1323
1342
  locator;
1324
1343
  developmentMode;
1325
1344
  // Dapps that have been built with their own context
1326
- builtDapps;
1345
+ builtDapps = {};
1327
1346
  dappRegistry;
1328
1347
  dappSeedPhraseRepository;
1329
1348
  manageSystemDapps;
1330
1349
  // Dapps that have been registered with dappAccessRequests
1331
- registeredAccessDappSets;
1350
+ registeredAccessDappSets = /* @__PURE__ */ new Set();
1332
1351
  // Dapps that have been registered with the dapp registry
1333
- registeredDappSets;
1352
+ registeredDappSets = /* @__PURE__ */ new Set();
1334
1353
  // Dapps that have been registered with exposeDappRequests
1335
- registeredExposedDappSets;
1336
- dappAccessRequestConnection;
1337
- exposeDappRequestConnection;
1354
+ registeredExposedDappSets = /* @__PURE__ */ new Set();
1355
+ dappAccessRequestConnection = dappAccessRequestConnection();
1356
+ exposeDappRequestConnection = exposeDappRequestConnection();
1338
1357
  constructor(context, params = {
1339
1358
  dappNames: [],
1340
1359
  dappParams: {},
@@ -1344,12 +1363,6 @@ var DappRegistrationService = class {
1344
1363
  this.params = params;
1345
1364
  this.locator = locator;
1346
1365
  this.developmentMode = developmentMode;
1347
- this.builtDapps = {};
1348
- this.registeredAccessDappSets = /* @__PURE__ */ new Set();
1349
- this.registeredDappSets = /* @__PURE__ */ new Set();
1350
- this.registeredExposedDappSets = /* @__PURE__ */ new Set();
1351
- this.dappAccessRequestConnection = dappAccessRequestConnection();
1352
- this.exposeDappRequestConnection = exposeDappRequestConnection();
1353
1366
  this.manageSystemDapps = new ManageSystemDapps(context, this.params?.dappNames ?? [], this.params?.dappPayloads ?? [], this.params?.dappParams ?? {}, this.locator, this.developmentMode);
1354
1367
  this.dappSeedPhraseRepository = new DappSeedPhraseRepository(context, this.params?.dappNames ?? []);
1355
1368
  this.dappRegistry = new DappRegistry(this.dappSeedPhraseRepository);
@@ -1488,11 +1501,11 @@ var Signers = class {
1488
1501
 
1489
1502
  // src/stack/Base.ts
1490
1503
  import { assertEx as assertEx8 } from "@xylabs/assert";
1504
+ import { BaseEmitter as BaseEmitter3 } from "@xylabs/events";
1491
1505
  import { forget as forget3 } from "@xylabs/forget";
1492
- import { ModuleBaseEmitter as ModuleBaseEmitter3 } from "@xyo-network/module-event-emitter";
1493
1506
  import { isModuleInstance } from "@xyo-network/module-model";
1494
1507
  import { asAttachableNodeInstance } from "@xyo-network/node-model";
1495
- var StackBase = class extends ModuleBaseEmitter3 {
1508
+ var StackBase = class extends BaseEmitter3 {
1496
1509
  static {
1497
1510
  __name(this, "StackBase");
1498
1511
  }
@@ -1585,7 +1598,9 @@ var StackBase = class extends ModuleBaseEmitter3 {
1585
1598
  }
1586
1599
  async getStackNode() {
1587
1600
  const mod = assertEx8(await this.context.root.resolve(this.stackNodeModuleId), () => `${this.stackNodeModuleId} not found`);
1588
- return asAttachableNodeInstance(mod, () => `${this.stackNodeModuleId} not a NodeInstance`);
1601
+ return asAttachableNodeInstance(mod, () => `${this.stackNodeModuleId} not a NodeInstance`, {
1602
+ required: true
1603
+ });
1589
1604
  }
1590
1605
  async handleDriverReady(node) {
1591
1606
  try {
@@ -1652,21 +1667,21 @@ import { ExposedNodeOuterNodeName, PubSubBridgeNodeNodeName } from "@xyo-network
1652
1667
 
1653
1668
  // src/adapter/Base.ts
1654
1669
  import { assertEx as assertEx9 } from "@xylabs/assert";
1670
+ import { BaseEmitter as BaseEmitter4 } from "@xylabs/events";
1655
1671
  import { forget as forget4 } from "@xylabs/forget";
1656
1672
  import { asArchivistInstance as asArchivistInstance4 } from "@xyo-network/archivist";
1657
- import { ModuleBaseEmitter as ModuleBaseEmitter4 } from "@xyo-network/module-event-emitter";
1658
1673
  import { asAttachableNodeInstance as asAttachableNodeInstance2 } from "@xyo-network/node-model";
1659
1674
  import { v4 as uuid3 } from "uuid";
1660
- var NodeAdapterBase = class extends ModuleBaseEmitter4 {
1675
+ var NodeAdapterBase = class extends BaseEmitter4 {
1661
1676
  static {
1662
1677
  __name(this, "NodeAdapterBase");
1663
1678
  }
1664
1679
  kernel;
1665
1680
  driverName;
1666
- initialized;
1667
- _id;
1681
+ initialized = false;
1682
+ _id = "";
1668
1683
  constructor(kernel, driverName) {
1669
- super({}), this.kernel = kernel, this.driverName = driverName, this.initialized = false, this._id = "";
1684
+ super({}), this.kernel = kernel, this.driverName = driverName;
1670
1685
  this._id = uuid3();
1671
1686
  }
1672
1687
  get id() {
@@ -1703,12 +1718,16 @@ var NodeAdapterBase = class extends ModuleBaseEmitter4 {
1703
1718
  }
1704
1719
  async getEventsArchivist() {
1705
1720
  const mod = assertEx9(await (await this.kernel.getNode()).resolve("KernelNode:ModuleEvents"), () => "KernelNode:ModuleEvents not found");
1706
- return asArchivistInstance4(mod, () => `${mod.id} is not an archivist`);
1721
+ return asArchivistInstance4(mod, () => `${mod.id} is not an archivist`, {
1722
+ required: true
1723
+ });
1707
1724
  }
1708
1725
  validateAndReturnDriver() {
1709
1726
  const mod = this.kernel.initialized[this.driverName];
1710
1727
  if (mod) {
1711
- const node = asAttachableNodeInstance2(mod, () => `${mod.id} is not a node`);
1728
+ const node = asAttachableNodeInstance2(mod, () => `${mod.id} is not a node`, {
1729
+ required: true
1730
+ });
1712
1731
  this.initialized = true;
1713
1732
  const emit = /* @__PURE__ */ __name(async () => await this.emit("driverReady", {
1714
1733
  node