@xyo-network/os-runtime 3.0.0 → 3.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/neutral/index.d.ts +2 -2
- package/dist/neutral/index.mjs +264 -102
- package/dist/neutral/index.mjs.map +1 -1
- package/package.json +28 -28
- package/src/Caller.ts +5 -2
- package/src/DefaultsQueries.ts +6 -2
- package/src/XyOs.ts +20 -9
- package/src/XyOsBase.ts +10 -3
- package/src/XyOsDapp.ts +9 -3
- package/src/access-interfaces/ValidDappAccessInterfaces.ts +4 -4
- package/src/access-interfaces/registered-names/helpers/AccessNodeQueries.ts +6 -2
- package/src/access-interfaces/registered-names/helpers/resource/RegistrationsResource.ts +8 -8
- package/src/adapter/Base.ts +11 -3
- package/src/adapters/OsPubSubBridgeNetwork.ts +3 -1
- package/src/classes/cache/RunningDappCache.ts +16 -4
- package/src/classes/dapp/DefaultsResource.ts +9 -3
- package/src/classes/dapp/access/Caller.ts +5 -4
- package/src/classes/dapp/access/Queries.ts +6 -2
- package/src/classes/dapp/access/Resource.ts +9 -3
- package/src/classes/lib/DappCreatorParams.ts +3 -1
- package/src/classes/lib/Insertable.ts +5 -7
- package/src/classes/menu/Caller.ts +5 -2
- package/src/classes/menu/Queries.ts +5 -2
- package/src/classes/menu/Resource.ts +12 -4
- package/src/classes/node/Creator.ts +19 -7
- package/src/classes/node/DefaultPayloads/DappAccessPayloads.ts +3 -1
- package/src/classes/node/DefaultPayloads/DefaultPayloads.ts +3 -1
- package/src/classes/node/DefaultPayloads/NodeInfoPayload.ts +3 -1
- package/src/classes/node/DefaultPayloads/SigningKeyPayloads.ts +9 -10
- package/src/classes/node/ExternalModulePermissions/ExternalModulePermissions.ts +6 -2
- package/src/classes/node/createDappContext.ts +16 -4
- package/src/classes/registration/DappRegistrationService.ts +25 -7
- package/src/classes/registration/DappRegistry.ts +16 -8
- package/src/classes/registration/ValidateDappAccessDiviner/Config.ts +10 -3
- package/src/classes/registration/ValidateDappAccessDiviner/Diviner.ts +14 -8
- package/src/classes/settings/Caller.ts +3 -1
- package/src/classes/settings/Resource.ts +9 -3
- package/src/classes/settings/SettingsQueries.ts +6 -2
- package/src/classes/settings/badge/Resource.ts +5 -7
- package/src/classes/system/ManageSystemDapps.ts +7 -2
- package/src/classes/system/Queries.ts +2 -1
- package/src/event/bus/Connection.ts +3 -1
- package/src/event/bus/EventBus.ts +13 -4
- package/src/helpers/monitor/XyOsMonitor.ts +9 -7
- package/src/helpers/monitor/types.ts +4 -1
- package/src/intent/Caller.ts +6 -2
- package/src/intent/Resource.ts +6 -2
- package/src/lib/ModuleAccountPaths.ts +6 -10
- package/src/lib/PayloadStore.ts +9 -3
- package/src/lib/isPayload.ts +3 -1
- package/src/manifest/ManifestReplaceableTokens.ts +4 -3
- package/src/profileModuleEvents.ts +6 -2
- package/src/stack/Base.ts +18 -6
- package/src/stack/Manager.ts +8 -8
- package/src/stack/Map.ts +3 -1
- package/src/stack/OsPubSubNetworkStack.ts +12 -4
- package/src/stack/OsSettingsStack.ts +6 -2
- package/src/stack/XyoPublicNetworkStack.ts +6 -2
- package/src/utils/buildWalletSeedPhrasePayload.ts +22 -6
- package/src/wallet/DappSeedPhraseRepository.ts +6 -2
package/dist/neutral/index.mjs
CHANGED
|
@@ -26,7 +26,10 @@ import { ModuleFactoryLocator as ModuleFactoryLocator5 } from "@xyo-network/modu
|
|
|
26
26
|
|
|
27
27
|
// src/classes/registration/DappRegistrationService.ts
|
|
28
28
|
import { forget as forget2 } from "@xylabs/forget";
|
|
29
|
-
import {
|
|
29
|
+
import {
|
|
30
|
+
fulfilled,
|
|
31
|
+
rejected
|
|
32
|
+
} from "@xylabs/promise";
|
|
30
33
|
import { ModuleFactoryLocator as ModuleFactoryLocator3 } from "@xyo-network/module-factory-locator";
|
|
31
34
|
import {
|
|
32
35
|
DappIntentTypes,
|
|
@@ -58,7 +61,11 @@ var EventBusConnection = class extends BaseEmitter {
|
|
|
58
61
|
// src/event/bus/EventBus.ts
|
|
59
62
|
import { assertEx as assertEx2 } from "@xylabs/assert";
|
|
60
63
|
import { forget } from "@xylabs/forget";
|
|
61
|
-
import {
|
|
64
|
+
import {
|
|
65
|
+
asArchivistInstance,
|
|
66
|
+
MemoryArchivist,
|
|
67
|
+
MemoryArchivistConfigSchema
|
|
68
|
+
} from "@xyo-network/archivist";
|
|
62
69
|
import {
|
|
63
70
|
isEventBusEvent,
|
|
64
71
|
isPubSubConnections
|
|
@@ -100,7 +107,12 @@ var EventBus = class {
|
|
|
100
107
|
delete this.connections[connectionId];
|
|
101
108
|
}
|
|
102
109
|
async start(storeName = "EventBusArchivist") {
|
|
103
|
-
this._archivist = await MemoryArchivist.create({
|
|
110
|
+
this._archivist = await MemoryArchivist.create({
|
|
111
|
+
config: {
|
|
112
|
+
name: storeName,
|
|
113
|
+
schema: MemoryArchivistConfigSchema
|
|
114
|
+
}
|
|
115
|
+
});
|
|
104
116
|
this.archivist.on("inserted", ({ payloads }) => {
|
|
105
117
|
const eventBusEvent = payloads.find(isEventBusEvent);
|
|
106
118
|
if (!eventBusEvent) return;
|
|
@@ -121,7 +133,10 @@ var EventBus = class {
|
|
|
121
133
|
handlePublisherAdd(connection) {
|
|
122
134
|
for (const eventName of connection.publishableEvents ?? []) {
|
|
123
135
|
const connectionPublisherCallback = async ({ payloads }) => {
|
|
124
|
-
const event = {
|
|
136
|
+
const event = {
|
|
137
|
+
name: eventName,
|
|
138
|
+
schema: "network.xyo.event.bus.event"
|
|
139
|
+
};
|
|
125
140
|
const eventPayloads = payloads ?? [];
|
|
126
141
|
event.sources = await PayloadBuilder.dataHashes(eventPayloads);
|
|
127
142
|
try {
|
|
@@ -207,7 +222,10 @@ var osXyoPublicNetworkReadyConnection = () => new EventBusPubSubConnection(osXyo
|
|
|
207
222
|
|
|
208
223
|
// src/intent/Caller.ts
|
|
209
224
|
import { PayloadDivinerQuerySchema } from "@xyo-network/diviner-payload-model";
|
|
210
|
-
import {
|
|
225
|
+
import {
|
|
226
|
+
DappIntentSchema,
|
|
227
|
+
DappMode
|
|
228
|
+
} from "@xyo-network/os-model";
|
|
211
229
|
|
|
212
230
|
// src/DappCallerBase.ts
|
|
213
231
|
import { assertEx as assertEx3 } from "@xylabs/assert";
|
|
@@ -359,15 +377,9 @@ var NodeSentinel = "NodeSentinel";
|
|
|
359
377
|
|
|
360
378
|
// src/lib/ModuleAccountPaths.ts
|
|
361
379
|
var RemoteNodeArchivistOffsetPaths = {
|
|
362
|
-
Kerplunk: {
|
|
363
|
-
|
|
364
|
-
}
|
|
365
|
-
Local: {
|
|
366
|
-
[DevelopArchivist]: "115"
|
|
367
|
-
},
|
|
368
|
-
Main: {
|
|
369
|
-
[DevelopArchivist]: "121"
|
|
370
|
-
}
|
|
380
|
+
Kerplunk: { [DevelopArchivist]: "118" },
|
|
381
|
+
Local: { [DevelopArchivist]: "115" },
|
|
382
|
+
Main: { [DevelopArchivist]: "121" }
|
|
371
383
|
};
|
|
372
384
|
var ModuleOffsetPaths = {
|
|
373
385
|
IdWitness: "1",
|
|
@@ -422,7 +434,11 @@ var PayloadStore = class {
|
|
|
422
434
|
/**
|
|
423
435
|
* Initialize listeners on the archivist that update class member variables when new payloads are inserted
|
|
424
436
|
*/
|
|
425
|
-
static async create({
|
|
437
|
+
static async create({
|
|
438
|
+
archivist,
|
|
439
|
+
getLatest,
|
|
440
|
+
idFunction
|
|
441
|
+
}) {
|
|
426
442
|
const instance = new this(archivist);
|
|
427
443
|
const insertListener = async ({ payloads }) => {
|
|
428
444
|
if (payloads.some(idFunction)) {
|
|
@@ -843,12 +859,18 @@ var XyOsDapp = class extends XyOsContextBase {
|
|
|
843
859
|
assertEx8(this._root === void 0, () => "Dapp already booted");
|
|
844
860
|
const finalLocator = locator ? (this.params.locator ?? new ModuleFactoryLocator2()).merge(locator) : this.params.locator ?? new ModuleFactoryLocator2();
|
|
845
861
|
console.log("XyOsDapp:boot:finalLocator", finalLocator);
|
|
846
|
-
const dappNodesWrapper = new ManifestWrapper({
|
|
862
|
+
const dappNodesWrapper = new ManifestWrapper({
|
|
863
|
+
...this.manifest,
|
|
864
|
+
schema: DappPackageManifestPayloadSchema
|
|
865
|
+
}, wallet, finalLocator);
|
|
847
866
|
const dappNodes = await dappNodesWrapper.loadNodes();
|
|
848
867
|
const dappManifestWallet = await wallet.derivePath("99999");
|
|
849
868
|
dapp_window_manifest_default.nodes[0].config.name = this.dapp.name + "Root";
|
|
850
869
|
const wrapper = new ManifestWrapper(
|
|
851
|
-
{
|
|
870
|
+
{
|
|
871
|
+
...dapp_window_manifest_default,
|
|
872
|
+
schema: DappPackageManifestPayloadSchema
|
|
873
|
+
},
|
|
852
874
|
dappManifestWallet,
|
|
853
875
|
finalLocator
|
|
854
876
|
);
|
|
@@ -1046,7 +1068,10 @@ var ValidateDappAccessDivinerConfigSchema = "network.xyo.os.dapp.access.registra
|
|
|
1046
1068
|
// src/classes/registration/ValidateDappAccessDiviner/Diviner.ts
|
|
1047
1069
|
import { HDWallet as HDWallet2 } from "@xyo-network/account";
|
|
1048
1070
|
import { AbstractDiviner } from "@xyo-network/diviner-abstract";
|
|
1049
|
-
import {
|
|
1071
|
+
import {
|
|
1072
|
+
ManifestWrapper as ManifestWrapper2,
|
|
1073
|
+
PackageManifestPayloadSchema
|
|
1074
|
+
} from "@xyo-network/manifest";
|
|
1050
1075
|
import {
|
|
1051
1076
|
isDappPackageManifestPayload,
|
|
1052
1077
|
isUnregisteredDappAccess,
|
|
@@ -1097,7 +1122,11 @@ var ValidateDappAccessDiviner = class extends AbstractDiviner {
|
|
|
1097
1122
|
}
|
|
1098
1123
|
} catch (e) {
|
|
1099
1124
|
failedAccessors.push(
|
|
1100
|
-
await PayloadBuilder4.build({
|
|
1125
|
+
await PayloadBuilder4.build({
|
|
1126
|
+
accessor: access,
|
|
1127
|
+
errorMessage: e.message,
|
|
1128
|
+
schema: FailedAccessorSchema
|
|
1129
|
+
})
|
|
1101
1130
|
);
|
|
1102
1131
|
}
|
|
1103
1132
|
}
|
|
@@ -1105,11 +1134,7 @@ var ValidateDappAccessDiviner = class extends AbstractDiviner {
|
|
|
1105
1134
|
}
|
|
1106
1135
|
};
|
|
1107
1136
|
var compareChildren = (interfaceChildren, dappChildren) => {
|
|
1108
|
-
return interfaceChildren.every(
|
|
1109
|
-
(interfaceChild) => Object.values(interfaceChild).every(
|
|
1110
|
-
(interfaceChildName) => dappChildren.some((dappChild) => Object.values(dappChild).includes(interfaceChildName))
|
|
1111
|
-
)
|
|
1112
|
-
);
|
|
1137
|
+
return interfaceChildren.every((interfaceChild) => Object.values(interfaceChild).every((interfaceChildName) => dappChildren.some((dappChild) => Object.values(dappChild).includes(interfaceChildName))));
|
|
1113
1138
|
};
|
|
1114
1139
|
var dappPackageManifestToPackageManifest = (dappPackageManifest) => {
|
|
1115
1140
|
return {
|
|
@@ -1151,7 +1176,15 @@ var DappRegistry = class {
|
|
|
1151
1176
|
**/
|
|
1152
1177
|
async registerDapp(dapp) {
|
|
1153
1178
|
if (dapp) {
|
|
1154
|
-
const {
|
|
1179
|
+
const {
|
|
1180
|
+
exposedModuleIds,
|
|
1181
|
+
manifest,
|
|
1182
|
+
modes,
|
|
1183
|
+
name,
|
|
1184
|
+
version,
|
|
1185
|
+
params,
|
|
1186
|
+
widgetConfigs
|
|
1187
|
+
} = this.extractDappProperties(dapp);
|
|
1155
1188
|
try {
|
|
1156
1189
|
const walletId = await this.dappSeedPhraseRepository.findOrCreate(name);
|
|
1157
1190
|
const registeredAccessors = await this.validateDappAccessPayloads(manifest, dapp.accessors, params);
|
|
@@ -1194,9 +1227,29 @@ var DappRegistry = class {
|
|
|
1194
1227
|
this.dappRegistry.delete(dappId);
|
|
1195
1228
|
}
|
|
1196
1229
|
extractDappProperties(dapp) {
|
|
1197
|
-
const {
|
|
1198
|
-
|
|
1199
|
-
|
|
1230
|
+
const {
|
|
1231
|
+
params,
|
|
1232
|
+
config,
|
|
1233
|
+
widgetConfigs
|
|
1234
|
+
} = dapp;
|
|
1235
|
+
const {
|
|
1236
|
+
exposedModuleIds,
|
|
1237
|
+
manifest,
|
|
1238
|
+
modes,
|
|
1239
|
+
name,
|
|
1240
|
+
sources,
|
|
1241
|
+
version
|
|
1242
|
+
} = config;
|
|
1243
|
+
return {
|
|
1244
|
+
exposedModuleIds,
|
|
1245
|
+
manifest,
|
|
1246
|
+
modes,
|
|
1247
|
+
name,
|
|
1248
|
+
params,
|
|
1249
|
+
sources,
|
|
1250
|
+
version,
|
|
1251
|
+
widgetConfigs
|
|
1252
|
+
};
|
|
1200
1253
|
}
|
|
1201
1254
|
async validateDappAccessPayloads(manifest, accessors = [], params) {
|
|
1202
1255
|
const validateDappAccess = await ValidateDappAccessDiviner.create({
|
|
@@ -1216,7 +1269,11 @@ var DappRegistry = class {
|
|
|
1216
1269
|
|
|
1217
1270
|
// src/classes/registration/DappRegistrationService.ts
|
|
1218
1271
|
var DappRegistrationService = class {
|
|
1219
|
-
constructor(context, params = {
|
|
1272
|
+
constructor(context, params = {
|
|
1273
|
+
dappNames: [],
|
|
1274
|
+
dappParams: {},
|
|
1275
|
+
dappPayloads: []
|
|
1276
|
+
}, locator = new ModuleFactoryLocator3(), developmentMode) {
|
|
1220
1277
|
this.context = context;
|
|
1221
1278
|
this.params = params;
|
|
1222
1279
|
this.locator = locator;
|
|
@@ -1247,7 +1304,15 @@ var DappRegistrationService = class {
|
|
|
1247
1304
|
dappAccessRequestConnection = dappAccessRequestConnection();
|
|
1248
1305
|
exposeDappRequestConnection = exposeDappRequestConnection();
|
|
1249
1306
|
buildDapp(manifest, dappId = NameTransforms.slug(manifest.nodes[0]?.config.name), name = NameTransforms.moduleName(manifest.nodes[0]?.config.name)) {
|
|
1250
|
-
const dapp = new XyOsDapp({
|
|
1307
|
+
const dapp = new XyOsDapp({
|
|
1308
|
+
dapp: {
|
|
1309
|
+
id: dappId,
|
|
1310
|
+
name
|
|
1311
|
+
},
|
|
1312
|
+
locator: this.locator,
|
|
1313
|
+
manifest,
|
|
1314
|
+
parent: this.context
|
|
1315
|
+
});
|
|
1251
1316
|
this.builtDapps[dappId] = dapp;
|
|
1252
1317
|
return dapp;
|
|
1253
1318
|
}
|
|
@@ -1261,7 +1326,10 @@ var DappRegistrationService = class {
|
|
|
1261
1326
|
activeDapps.map(async (dappSet) => {
|
|
1262
1327
|
const { dapp } = dappSet;
|
|
1263
1328
|
const registeredDapp = await this.dappRegistry.registerDapp(dapp);
|
|
1264
|
-
const result = {
|
|
1329
|
+
const result = {
|
|
1330
|
+
dapp: registeredDapp,
|
|
1331
|
+
dappIcon: dapp.icon
|
|
1332
|
+
};
|
|
1265
1333
|
const forgetHandlers = async () => {
|
|
1266
1334
|
try {
|
|
1267
1335
|
await this.postRegistrationHandlers(result);
|
|
@@ -1276,7 +1344,10 @@ var DappRegistrationService = class {
|
|
|
1276
1344
|
const failed = results.filter(rejected).map((result) => result.reason);
|
|
1277
1345
|
const succeeded = results.filter(fulfilled).map((result) => result.value);
|
|
1278
1346
|
for (const registeredDapp of succeeded) this.registeredDappSets.add(registeredDapp);
|
|
1279
|
-
return {
|
|
1347
|
+
return {
|
|
1348
|
+
failed,
|
|
1349
|
+
succeeded
|
|
1350
|
+
};
|
|
1280
1351
|
}
|
|
1281
1352
|
addConnectionRequests() {
|
|
1282
1353
|
this.context.eventBus.addConnection(this.dappAccessRequestConnection);
|
|
@@ -1310,9 +1381,7 @@ import { ModuleFactoryLocator as ModuleFactoryLocator4 } from "@xyo-network/modu
|
|
|
1310
1381
|
|
|
1311
1382
|
// src/manifest/ManifestReplaceableTokens.ts
|
|
1312
1383
|
import { getXnsDomain } from "@xyo-network/kernel";
|
|
1313
|
-
var ManifestReplaceableTokens = (xnsNodeUrl, xnsNetwork) => ({
|
|
1314
|
-
"[REPLACE_WITH_NS_NODE_URL]": getXnsDomain(xnsNodeUrl, xnsNetwork)
|
|
1315
|
-
});
|
|
1384
|
+
var ManifestReplaceableTokens = (xnsNodeUrl, xnsNetwork) => ({ "[REPLACE_WITH_NS_NODE_URL]": getXnsDomain(xnsNodeUrl, xnsNetwork) });
|
|
1316
1385
|
var ReplaceManifestTokens = (manifest, xnsNodeUrl, xnsNetwork) => {
|
|
1317
1386
|
let stringifiedManifestReplaced = JSON.stringify(manifest);
|
|
1318
1387
|
for (const [token, value] of Object.entries(ManifestReplaceableTokens(xnsNodeUrl, xnsNetwork))) {
|
|
@@ -1497,7 +1566,6 @@ var StackBase = class extends BaseEmitter3 {
|
|
|
1497
1566
|
// list of initialized nodes
|
|
1498
1567
|
initializedNodes = [];
|
|
1499
1568
|
// list of listeners - lister type not important since its only recalled to stop listening
|
|
1500
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1501
1569
|
listeners = [];
|
|
1502
1570
|
constructor(context, adapterSet, stackNodeModuleId) {
|
|
1503
1571
|
super({});
|
|
@@ -1522,13 +1590,21 @@ var StackBase = class extends BaseEmitter3 {
|
|
|
1522
1590
|
for (const adapter of this.adapterSet) {
|
|
1523
1591
|
const driverReadyListener = async ({ node }) => await this.handleDriverReady(node);
|
|
1524
1592
|
adapter.on("driverReady", driverReadyListener);
|
|
1525
|
-
this.listeners.push({
|
|
1593
|
+
this.listeners.push({
|
|
1594
|
+
adapter,
|
|
1595
|
+
eventName: "driverReady",
|
|
1596
|
+
listener: driverReadyListener
|
|
1597
|
+
});
|
|
1526
1598
|
const driverErrorListener = async ({ error }) => {
|
|
1527
1599
|
console.error(`Error updating ${this.stackNodeModuleId} stack node`, error);
|
|
1528
1600
|
await this.emit("driverError", { error });
|
|
1529
1601
|
};
|
|
1530
1602
|
adapter.on("driverError", driverErrorListener);
|
|
1531
|
-
this.listeners.push({
|
|
1603
|
+
this.listeners.push({
|
|
1604
|
+
adapter,
|
|
1605
|
+
eventName: "driverError",
|
|
1606
|
+
listener: driverErrorListener
|
|
1607
|
+
});
|
|
1532
1608
|
const startAdapter = async () => await adapter.start();
|
|
1533
1609
|
forget3(startAdapter());
|
|
1534
1610
|
}
|
|
@@ -1537,7 +1613,11 @@ var StackBase = class extends BaseEmitter3 {
|
|
|
1537
1613
|
* Stops the stack
|
|
1538
1614
|
*/
|
|
1539
1615
|
stop() {
|
|
1540
|
-
for (const {
|
|
1616
|
+
for (const {
|
|
1617
|
+
eventName,
|
|
1618
|
+
listener,
|
|
1619
|
+
adapter
|
|
1620
|
+
} of this.listeners) {
|
|
1541
1621
|
adapter.off(eventName, listener);
|
|
1542
1622
|
}
|
|
1543
1623
|
}
|
|
@@ -1599,7 +1679,10 @@ var StackManager = class {
|
|
|
1599
1679
|
}
|
|
1600
1680
|
initialize(context) {
|
|
1601
1681
|
for (const [key, stackSet] of Object.entries(this.stackMap)) {
|
|
1602
|
-
const {
|
|
1682
|
+
const {
|
|
1683
|
+
stack: Stack,
|
|
1684
|
+
adapters: stackNodeModuleId
|
|
1685
|
+
} = stackSet;
|
|
1603
1686
|
const initializedStack = new Stack(context, stackNodeModuleId);
|
|
1604
1687
|
initializedStack.initialize();
|
|
1605
1688
|
this.stacks.set(key, initializedStack);
|
|
@@ -1613,7 +1696,10 @@ var StackManager = class {
|
|
|
1613
1696
|
};
|
|
1614
1697
|
|
|
1615
1698
|
// src/adapters/OsPubSubBridgeNetwork.ts
|
|
1616
|
-
import {
|
|
1699
|
+
import {
|
|
1700
|
+
ExposedNodeOuterNodeName,
|
|
1701
|
+
PubSubBridgeNodeNodeName
|
|
1702
|
+
} from "@xyo-network/os-model";
|
|
1617
1703
|
|
|
1618
1704
|
// src/adapter/Base.ts
|
|
1619
1705
|
import { assertEx as assertEx10 } from "@xylabs/assert";
|
|
@@ -1735,8 +1821,14 @@ var OsXyoPublicNetworkAdapters = (kernel) => [
|
|
|
1735
1821
|
|
|
1736
1822
|
// src/stack/OsPubSubNetworkStack.ts
|
|
1737
1823
|
import { assertEx as assertEx11 } from "@xylabs/assert";
|
|
1738
|
-
import {
|
|
1739
|
-
|
|
1824
|
+
import {
|
|
1825
|
+
asAttachableNodeInstance as asAttachableNodeInstance3,
|
|
1826
|
+
asNodeInstance
|
|
1827
|
+
} from "@xyo-network/node-model";
|
|
1828
|
+
import {
|
|
1829
|
+
ExposedNodeOuterNodeName as ExposedNodeOuterNodeName2,
|
|
1830
|
+
PubSubBridgeNodeNodeName as PubSubBridgeNodeNodeName2
|
|
1831
|
+
} from "@xyo-network/os-model";
|
|
1740
1832
|
var OsPubSubNetworkStack = class extends StackBase {
|
|
1741
1833
|
_exposedNode;
|
|
1742
1834
|
_exposedNodeOuter;
|
|
@@ -1847,8 +1939,14 @@ var XyOs = class _XyOs extends XyOsContextBase {
|
|
|
1847
1939
|
_locator;
|
|
1848
1940
|
dappRegistrationService;
|
|
1849
1941
|
stackManager;
|
|
1850
|
-
constructor(
|
|
1851
|
-
|
|
1942
|
+
constructor({
|
|
1943
|
+
eventBus = new EventBus(),
|
|
1944
|
+
...params
|
|
1945
|
+
}, dappsConfiguration, developmentMode) {
|
|
1946
|
+
super({
|
|
1947
|
+
eventBus,
|
|
1948
|
+
...params
|
|
1949
|
+
});
|
|
1852
1950
|
this._locator = params.locator ?? new ModuleFactoryLocator5();
|
|
1853
1951
|
this.stackManager = new StackManager(OsStackMap);
|
|
1854
1952
|
this.dappRegistrationService = new DappRegistrationService(this, dappsConfiguration, this.locator, developmentMode);
|
|
@@ -1875,11 +1973,17 @@ var XyOs = class _XyOs extends XyOsContextBase {
|
|
|
1875
1973
|
return this._locator;
|
|
1876
1974
|
}
|
|
1877
1975
|
static async monitor(fn, eventConfig) {
|
|
1878
|
-
const {
|
|
1976
|
+
const {
|
|
1977
|
+
name,
|
|
1978
|
+
additionalProperties
|
|
1979
|
+
} = eventConfig;
|
|
1879
1980
|
const monitor = this.monitoring;
|
|
1880
1981
|
monitor?.startTimer(name);
|
|
1881
1982
|
const result = await fn();
|
|
1882
|
-
monitor?.stopTimer({
|
|
1983
|
+
monitor?.stopTimer({
|
|
1984
|
+
additionalProperties,
|
|
1985
|
+
name
|
|
1986
|
+
});
|
|
1883
1987
|
return result;
|
|
1884
1988
|
}
|
|
1885
1989
|
async boot(wallet, locator = new ModuleFactoryLocator5()) {
|
|
@@ -1968,7 +2072,10 @@ var NodeInfoPayload = class {
|
|
|
1968
2072
|
import { assertEx as assertEx17 } from "@xylabs/assert";
|
|
1969
2073
|
import { hexFrom } from "@xylabs/hex";
|
|
1970
2074
|
import { HDWallet as HDWallet4 } from "@xyo-network/account";
|
|
1971
|
-
import {
|
|
2075
|
+
import {
|
|
2076
|
+
mnemonicArrayToString,
|
|
2077
|
+
SigningKeySchema
|
|
2078
|
+
} from "@xyo-network/os-model";
|
|
1972
2079
|
import { isAnyPayload as isAnyPayload2 } from "@xyo-network/payload-model";
|
|
1973
2080
|
|
|
1974
2081
|
// src/classes/settings/badge/Caller.ts
|
|
@@ -2050,14 +2157,10 @@ var OsBadgeResource = class extends OsSettingsCallerBase {
|
|
|
2050
2157
|
return assertEx14(this._savedSeedPhrase, () => "Saved seed phrase listener not set");
|
|
2051
2158
|
}
|
|
2052
2159
|
get subscriptions() {
|
|
2053
|
-
return {
|
|
2054
|
-
savedSeedPhrase: (cb) => this.savedSeedPhrase.subscribe(cb)
|
|
2055
|
-
};
|
|
2160
|
+
return { savedSeedPhrase: (cb) => this.savedSeedPhrase.subscribe(cb) };
|
|
2056
2161
|
}
|
|
2057
2162
|
get views() {
|
|
2058
|
-
return {
|
|
2059
|
-
savedSeedPhrase: () => this.savedSeedPhrase.latest
|
|
2060
|
-
};
|
|
2163
|
+
return { savedSeedPhrase: () => this.savedSeedPhrase.latest };
|
|
2061
2164
|
}
|
|
2062
2165
|
cleanupListeners() {
|
|
2063
2166
|
this.savedSeedPhrase.cleanupListeners();
|
|
@@ -2087,12 +2190,28 @@ var language = "english";
|
|
|
2087
2190
|
var standard = "bip-39";
|
|
2088
2191
|
var userWalletLabel = "userWallet";
|
|
2089
2192
|
var buildWalletSeedPhrasePayload = async (mnemonic, label) => {
|
|
2090
|
-
const fields = {
|
|
2091
|
-
|
|
2092
|
-
|
|
2193
|
+
const fields = {
|
|
2194
|
+
mnemonic: {
|
|
2195
|
+
language,
|
|
2196
|
+
mnemonic: mnemonic.split(" "),
|
|
2197
|
+
standard
|
|
2198
|
+
}
|
|
2199
|
+
};
|
|
2200
|
+
const meta = {
|
|
2201
|
+
label,
|
|
2202
|
+
timestamp: Date.now()
|
|
2203
|
+
};
|
|
2204
|
+
const builder = new PayloadBuilder5({
|
|
2205
|
+
fields,
|
|
2206
|
+
meta,
|
|
2207
|
+
schema: WalletSeedPhraseSchema
|
|
2208
|
+
});
|
|
2093
2209
|
const payload = await builder.build();
|
|
2094
2210
|
const rootHash = await PayloadBuilder5.hash(payload);
|
|
2095
|
-
return {
|
|
2211
|
+
return {
|
|
2212
|
+
payload,
|
|
2213
|
+
rootHash
|
|
2214
|
+
};
|
|
2096
2215
|
};
|
|
2097
2216
|
var buildUserWalletSeedPhrasePayload = (mnemonic) => {
|
|
2098
2217
|
return buildWalletSeedPhrasePayload(mnemonic, userWalletLabel);
|
|
@@ -2131,7 +2250,10 @@ var renameObjKey = (oldObj, oldKey, newKey) => {
|
|
|
2131
2250
|
|
|
2132
2251
|
// src/classes/settings/SettingsQueries.ts
|
|
2133
2252
|
import { PayloadDivinerQuerySchema as PayloadDivinerQuerySchema5 } from "@xyo-network/diviner-payload-model";
|
|
2134
|
-
import {
|
|
2253
|
+
import {
|
|
2254
|
+
NodeBackgroundSchema,
|
|
2255
|
+
WalletSeedPhraseSchema as WalletSeedPhraseSchema2
|
|
2256
|
+
} from "@xyo-network/os-model";
|
|
2135
2257
|
var NO_RESULTS2 = [];
|
|
2136
2258
|
var OsSettingsQueries = {
|
|
2137
2259
|
async getLatestUserWallet(diviner) {
|
|
@@ -2214,7 +2336,10 @@ var OsSettingsCaller = class extends OsSettingsCallerBase {
|
|
|
2214
2336
|
|
|
2215
2337
|
// src/classes/settings/Resource.ts
|
|
2216
2338
|
import { assertEx as assertEx16 } from "@xylabs/assert";
|
|
2217
|
-
import {
|
|
2339
|
+
import {
|
|
2340
|
+
isNodeBackground,
|
|
2341
|
+
isWalletSeedPhrase
|
|
2342
|
+
} from "@xyo-network/os-model";
|
|
2218
2343
|
var OsSettingsResource = class extends OsSettingsCallerBase {
|
|
2219
2344
|
_latestUserWalletListener;
|
|
2220
2345
|
_nodeBackgroundListener;
|
|
@@ -2276,14 +2401,8 @@ var OsSettingsResource = class extends OsSettingsCallerBase {
|
|
|
2276
2401
|
// src/classes/node/DefaultPayloads/SigningKeyPayloads.ts
|
|
2277
2402
|
var DappsWithAdditionalPayloads = /* @__PURE__ */ new Set(["Profile"]);
|
|
2278
2403
|
var DefaultName = "Name Service";
|
|
2279
|
-
var DEFAULT_DAPP_ACCOUNT_PATHS = {
|
|
2280
|
-
|
|
2281
|
-
};
|
|
2282
|
-
var ADDITIONAL_DAPP_ACCOUNT_PATHS = {
|
|
2283
|
-
["Profile"]: {
|
|
2284
|
-
[DefaultName]: DEFAULT_DAPP_ACCOUNT_PATHS[DefaultName]
|
|
2285
|
-
}
|
|
2286
|
-
};
|
|
2404
|
+
var DEFAULT_DAPP_ACCOUNT_PATHS = { [DefaultName]: "1'/1" };
|
|
2405
|
+
var ADDITIONAL_DAPP_ACCOUNT_PATHS = { ["Profile"]: { [DefaultName]: DEFAULT_DAPP_ACCOUNT_PATHS[DefaultName] } };
|
|
2287
2406
|
var SigningKeyPayloads = class {
|
|
2288
2407
|
constructor(context, dappName) {
|
|
2289
2408
|
this.context = context;
|
|
@@ -2395,9 +2514,22 @@ var DappContextCreator = class _DappContextCreator {
|
|
|
2395
2514
|
// Designated offset path for the wallet used by windowed dapps. In the future, other offsets could be used for other dapp modes
|
|
2396
2515
|
static DAPP_WINDOW_WALLET_PATH = "1";
|
|
2397
2516
|
static async create(params, xnsNodeUrl, xnsNetwork) {
|
|
2398
|
-
const {
|
|
2399
|
-
|
|
2400
|
-
|
|
2517
|
+
const {
|
|
2518
|
+
config,
|
|
2519
|
+
locator,
|
|
2520
|
+
context,
|
|
2521
|
+
wallet
|
|
2522
|
+
} = params;
|
|
2523
|
+
const {
|
|
2524
|
+
payload,
|
|
2525
|
+
dappName,
|
|
2526
|
+
publicChildren,
|
|
2527
|
+
privateChildren
|
|
2528
|
+
} = config;
|
|
2529
|
+
const {
|
|
2530
|
+
external,
|
|
2531
|
+
manifestPayload
|
|
2532
|
+
} = this.parseDappPackageManifestPayload(payload, xnsNodeUrl, xnsNetwork);
|
|
2401
2533
|
console.debug("[DEBUG] dApp manifest", manifestPayload);
|
|
2402
2534
|
const dappWallet = await wallet.derivePath(_DappContextCreator.DAPP_WINDOW_WALLET_PATH);
|
|
2403
2535
|
const targetDappManifestParams = [manifestPayload, dappWallet, locator, publicChildren, privateChildren];
|
|
@@ -2418,13 +2550,19 @@ var DappContextCreator = class _DappContextCreator {
|
|
|
2418
2550
|
await dappArchivist.clear();
|
|
2419
2551
|
}
|
|
2420
2552
|
static parseDappPackageManifestPayload(payload, xnsNodeUrl, xnsNetwork) {
|
|
2421
|
-
const {
|
|
2553
|
+
const {
|
|
2554
|
+
external,
|
|
2555
|
+
...manifestWithoutExternals
|
|
2556
|
+
} = payload;
|
|
2422
2557
|
const manifestPayloadRaw = {
|
|
2423
2558
|
...manifestWithoutExternals,
|
|
2424
2559
|
schema: PackageManifestPayloadSchema2
|
|
2425
2560
|
};
|
|
2426
2561
|
const manifestPayload = ReplaceManifestTokens(manifestPayloadRaw, xnsNodeUrl, xnsNetwork);
|
|
2427
|
-
return {
|
|
2562
|
+
return {
|
|
2563
|
+
external,
|
|
2564
|
+
manifestPayload
|
|
2565
|
+
};
|
|
2428
2566
|
}
|
|
2429
2567
|
async loadDappContext(context) {
|
|
2430
2568
|
console.log("DappNodesCreator:loadDappContext", this.dappId);
|
|
@@ -2461,10 +2599,16 @@ var createDappContext = async (dapp, context, allowedNames, xnsNodeUrl, xnsNetwo
|
|
|
2461
2599
|
}
|
|
2462
2600
|
const wallet = await HDWallet5.fromPhrase(seedPhrase);
|
|
2463
2601
|
const dappName = dapp.config.name;
|
|
2464
|
-
const {
|
|
2602
|
+
const {
|
|
2603
|
+
config: dappConfig,
|
|
2604
|
+
params: dappParams
|
|
2605
|
+
} = dapp;
|
|
2465
2606
|
const locator = resolveLocator((dappParams.locator ?? new ModuleFactoryLocator6()).merge(context.platformLocator));
|
|
2466
2607
|
const params = {
|
|
2467
|
-
config: {
|
|
2608
|
+
config: {
|
|
2609
|
+
dappName,
|
|
2610
|
+
payload: dappConfig.manifest
|
|
2611
|
+
},
|
|
2468
2612
|
context,
|
|
2469
2613
|
locator,
|
|
2470
2614
|
wallet
|
|
@@ -2503,7 +2647,10 @@ var RunningDappCache = class _RunningDappCache {
|
|
|
2503
2647
|
_RunningDappCache.set(dappId, windowDappSet);
|
|
2504
2648
|
return windowDappSet;
|
|
2505
2649
|
}),
|
|
2506
|
-
{
|
|
2650
|
+
{
|
|
2651
|
+
additionalProperties: { dappId },
|
|
2652
|
+
name: "Loading dApp"
|
|
2653
|
+
}
|
|
2507
2654
|
);
|
|
2508
2655
|
}
|
|
2509
2656
|
static get(key) {
|
|
@@ -2632,14 +2779,10 @@ var XnsRegistrationsResource = class extends AbstractXnsCaller {
|
|
|
2632
2779
|
return assertEx22(this._allRegistrations);
|
|
2633
2780
|
}
|
|
2634
2781
|
get subscriptions() {
|
|
2635
|
-
return {
|
|
2636
|
-
allRegistrations: (cb) => this.allRegistrations.subscribe(cb)
|
|
2637
|
-
};
|
|
2782
|
+
return { allRegistrations: (cb) => this.allRegistrations.subscribe(cb) };
|
|
2638
2783
|
}
|
|
2639
2784
|
get views() {
|
|
2640
|
-
return {
|
|
2641
|
-
allRegistrations: () => this.allRegistrations.getSnapshot()
|
|
2642
|
-
};
|
|
2785
|
+
return { allRegistrations: () => this.allRegistrations.getSnapshot() };
|
|
2643
2786
|
}
|
|
2644
2787
|
cleanupListeners() {
|
|
2645
2788
|
this.allRegistrations.cleanupListeners();
|
|
@@ -2656,10 +2799,11 @@ var XnsRegistrationsResource = class extends AbstractXnsCaller {
|
|
|
2656
2799
|
};
|
|
2657
2800
|
|
|
2658
2801
|
// src/access-interfaces/ValidDappAccessInterfaces.ts
|
|
2659
|
-
import {
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
};
|
|
2802
|
+
import {
|
|
2803
|
+
RegisteredNames,
|
|
2804
|
+
RegisteredNamesInterface
|
|
2805
|
+
} from "@xyo-network/os-model";
|
|
2806
|
+
var ValidDappAccessInterfaces = { [RegisteredNames]: RegisteredNamesInterface };
|
|
2663
2807
|
|
|
2664
2808
|
// src/Caller.ts
|
|
2665
2809
|
import { assertEx as assertEx23 } from "@xylabs/assert";
|
|
@@ -2677,7 +2821,10 @@ import { PayloadBuilder as PayloadBuilder7 } from "@xyo-network/payload-builder"
|
|
|
2677
2821
|
|
|
2678
2822
|
// src/DefaultsQueries.ts
|
|
2679
2823
|
import { PayloadDivinerQuerySchema as PayloadDivinerQuerySchema7 } from "@xyo-network/diviner-payload-model";
|
|
2680
|
-
import {
|
|
2824
|
+
import {
|
|
2825
|
+
DappInjectableParamsSchema,
|
|
2826
|
+
NodeOsInfoSchema as NodeOsInfoSchema2
|
|
2827
|
+
} from "@xyo-network/os-model";
|
|
2681
2828
|
var DappDefaultsResourceQueries = {
|
|
2682
2829
|
async getDappInjectableParamsFromRoute(diviner) {
|
|
2683
2830
|
const query = {
|
|
@@ -2870,9 +3017,7 @@ var DappCaller = class extends DappCallerBase {
|
|
|
2870
3017
|
import { assertEx as assertEx24 } from "@xylabs/assert";
|
|
2871
3018
|
import { ModuleFactoryLocator as ModuleFactoryLocator7 } from "@xyo-network/module-factory-locator";
|
|
2872
3019
|
import { asNodeInstance as asNodeInstance2 } from "@xyo-network/node-model";
|
|
2873
|
-
import {
|
|
2874
|
-
isRegisteredDappAccessDappSet as isRegisteredDappAccessDappSet2
|
|
2875
|
-
} from "@xyo-network/os-model";
|
|
3020
|
+
import { isRegisteredDappAccessDappSet as isRegisteredDappAccessDappSet2 } from "@xyo-network/os-model";
|
|
2876
3021
|
import { PayloadBuilder as PayloadBuilder8 } from "@xyo-network/payload-builder";
|
|
2877
3022
|
var DappAccessCaller = class extends OsCallerBase {
|
|
2878
3023
|
constructor(context, registeredDapps, allowedNames, xnsNodeUrl, xnsNetwork, platformLocator = new ModuleFactoryLocator7()) {
|
|
@@ -2916,7 +3061,10 @@ var DappAccessCaller = class extends OsCallerBase {
|
|
|
2916
3061
|
|
|
2917
3062
|
// src/classes/dapp/access/Queries.ts
|
|
2918
3063
|
import { PayloadDivinerQuerySchema as PayloadDivinerQuerySchema9 } from "@xyo-network/diviner-payload-model";
|
|
2919
|
-
import {
|
|
3064
|
+
import {
|
|
3065
|
+
DappAccessRequestSchema as DappAccessRequestSchema2,
|
|
3066
|
+
RegisteredDappAccessSchema as RegisteredDappAccessSchema3
|
|
3067
|
+
} from "@xyo-network/os-model";
|
|
2920
3068
|
var noResults = [];
|
|
2921
3069
|
var DappAccessRequestQueries = {
|
|
2922
3070
|
async getAccessRequests(diviner) {
|
|
@@ -2947,7 +3095,10 @@ var DappAccessRequestQueries = {
|
|
|
2947
3095
|
|
|
2948
3096
|
// src/classes/dapp/access/Resource.ts
|
|
2949
3097
|
import { assertEx as assertEx25 } from "@xylabs/assert";
|
|
2950
|
-
import {
|
|
3098
|
+
import {
|
|
3099
|
+
isDappAccessRequestWithMeta,
|
|
3100
|
+
isRegisteredDappAccess as isRegisteredDappAccess2
|
|
3101
|
+
} from "@xyo-network/os-model";
|
|
2951
3102
|
var DappAccessRequestResource = class extends DappCallerBase {
|
|
2952
3103
|
_accessRequestListener;
|
|
2953
3104
|
_registeredInterfacesListener;
|
|
@@ -2994,7 +3145,10 @@ var DappAccessRequestResource = class extends DappCallerBase {
|
|
|
2994
3145
|
|
|
2995
3146
|
// src/classes/dapp/DefaultsResource.ts
|
|
2996
3147
|
import { assertEx as assertEx26 } from "@xylabs/assert";
|
|
2997
|
-
import {
|
|
3148
|
+
import {
|
|
3149
|
+
isDappInjectableParams,
|
|
3150
|
+
isNodeOsInfo
|
|
3151
|
+
} from "@xyo-network/os-model";
|
|
2998
3152
|
var DappDefaultsResource = class extends DappCallerBase {
|
|
2999
3153
|
_dappInjectableParamsFromRouteListener;
|
|
3000
3154
|
_nodeOsInfoListener;
|
|
@@ -3104,7 +3258,10 @@ var DappMenuCaller = class extends DappCaller {
|
|
|
3104
3258
|
|
|
3105
3259
|
// src/classes/menu/Resource.ts
|
|
3106
3260
|
import { assertEx as assertEx27 } from "@xylabs/assert";
|
|
3107
|
-
import {
|
|
3261
|
+
import {
|
|
3262
|
+
isDappNavItemSelection,
|
|
3263
|
+
isDappNavMenuConfig
|
|
3264
|
+
} from "@xyo-network/os-model";
|
|
3108
3265
|
|
|
3109
3266
|
// src/classes/menu/Queries.ts
|
|
3110
3267
|
import { PayloadDivinerQuerySchema as PayloadDivinerQuerySchema11 } from "@xyo-network/diviner-payload-model";
|
|
@@ -3235,11 +3392,7 @@ var DappMenuResource = class extends DappCaller {
|
|
|
3235
3392
|
// src/helpers/monitor/XyOsMonitor.ts
|
|
3236
3393
|
var DEFAULT_MONITORING_EVENT_NAME = "System Task Duration";
|
|
3237
3394
|
globalThis.getXyOsGlobal = globalThis.getXyOsGlobal ?? (() => {
|
|
3238
|
-
return {
|
|
3239
|
-
tracking: {
|
|
3240
|
-
trackEvent: (_event, _properties) => void 0
|
|
3241
|
-
}
|
|
3242
|
-
};
|
|
3395
|
+
return { tracking: { trackEvent: (_event, _properties) => void 0 } };
|
|
3243
3396
|
});
|
|
3244
3397
|
var xyOsGlobal = globalThis.getXyOsGlobal();
|
|
3245
3398
|
var XyOsMonitor = class _XyOsMonitor {
|
|
@@ -3249,7 +3402,10 @@ var XyOsMonitor = class _XyOsMonitor {
|
|
|
3249
3402
|
this.performanceTimers.set(name, performance.now());
|
|
3250
3403
|
}
|
|
3251
3404
|
stopTimer(eventConfig) {
|
|
3252
|
-
const {
|
|
3405
|
+
const {
|
|
3406
|
+
additionalProperties,
|
|
3407
|
+
name
|
|
3408
|
+
} = eventConfig;
|
|
3253
3409
|
const start = this.performanceTimers.get(name);
|
|
3254
3410
|
if (start) {
|
|
3255
3411
|
const end = performance.now();
|
|
@@ -3277,12 +3433,18 @@ var profileModuleEvents = (mod) => {
|
|
|
3277
3433
|
mod.onAny(async (eventName, args) => {
|
|
3278
3434
|
const mod2 = modRef.deref();
|
|
3279
3435
|
if (mod2) {
|
|
3280
|
-
const data = profileData[mod2.address] ?? {
|
|
3436
|
+
const data = profileData[mod2.address] ?? {
|
|
3437
|
+
allEventCount: 0,
|
|
3438
|
+
eventCounts: {}
|
|
3439
|
+
};
|
|
3281
3440
|
profileData[mod2.address] = data;
|
|
3282
3441
|
data.allEventCount += 1;
|
|
3283
3442
|
data.eventCounts[eventName] = (data.eventCounts[eventName] ?? 0) + 1;
|
|
3284
3443
|
if (eventName === "querySendStarted") {
|
|
3285
|
-
const {
|
|
3444
|
+
const {
|
|
3445
|
+
query,
|
|
3446
|
+
payloads = []
|
|
3447
|
+
} = args;
|
|
3286
3448
|
const pairs = await PayloadBuilder10.dataHashPairs(payloads);
|
|
3287
3449
|
const foundPair = pairs.find(([, hash]) => hash === query.query);
|
|
3288
3450
|
if (foundPair) {
|