@xyo-network/manifest 2.63.14 → 2.64.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/ManifestWrapper.js +25 -30
- package/dist/cjs/ManifestWrapper.js.map +1 -1
- package/dist/cjs/ModuleFactory.js +4 -4
- package/dist/cjs/ModuleFactory.js.map +1 -1
- package/dist/docs.json +912 -1515
- package/dist/esm/ManifestWrapper.js +24 -28
- package/dist/esm/ManifestWrapper.js.map +1 -1
- package/dist/esm/ModuleFactory.js +4 -4
- package/dist/esm/ModuleFactory.js.map +1 -1
- package/dist/types/ManifestWrapper.d.ts +5 -6
- package/dist/types/ManifestWrapper.d.ts.map +1 -1
- package/dist/types/Payload.d.ts +12 -9
- package/dist/types/Payload.d.ts.map +1 -1
- package/package.json +13 -11
- package/src/ManifestWrapper.ts +31 -45
- package/src/ModuleFactory.ts +4 -4
- package/src/Payload.ts +11 -9
- package/src/schema.json +98 -79
- package/src/spec/simple-node-inline-manifest.json +18 -17
- package/src/spec/simple-node-indirect-manifest.json +0 -50
|
@@ -11,72 +11,67 @@ class ManifestWrapper extends payload_wrapper_1.PayloadWrapper {
|
|
|
11
11
|
super(payload);
|
|
12
12
|
this.wallet = wallet;
|
|
13
13
|
}
|
|
14
|
-
|
|
14
|
+
loadModule(node, manifest, external = true, additionalCreatableModules) {
|
|
15
15
|
var _a;
|
|
16
|
-
return (
|
|
16
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
17
|
+
const collision = (node, name, external) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
18
|
+
const externalConflict = external ? (yield (external ? node.upResolver : node.downResolver).resolve({ name: [name] })).length !== 0 : false;
|
|
19
|
+
return externalConflict || (yield node.downResolver.resolve({ name: [name] })).length !== 0;
|
|
20
|
+
});
|
|
21
|
+
const creatableModules = Object.assign(Object.assign({}, ModuleFactory_1.standardCreatableModules), additionalCreatableModules);
|
|
22
|
+
if (!(yield collision(node, manifest.config.name, external))) {
|
|
23
|
+
if (manifest.config.language && manifest.config.language === 'javascript') {
|
|
24
|
+
(0, assert_1.assertEx)((_a = (manifest.config.name && (yield node.attach(manifest.config.name, external)))) !== null && _a !== void 0 ? _a : (yield node.attach((yield this.registerModule(node, manifest, creatableModules)).address, external)), `No module with config schema [${manifest.config.name}] registered`);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
});
|
|
17
28
|
}
|
|
18
|
-
|
|
29
|
+
loadNodeFromIndex(node, index, additionalCreatableModules) {
|
|
19
30
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
20
|
-
return yield this.
|
|
31
|
+
return yield this.loadNodeFromManifest(node, (0, assert_1.assertEx)(this.nodeManifest(index), 'Failed to find Node Manifest'), additionalCreatableModules);
|
|
21
32
|
});
|
|
22
33
|
}
|
|
23
|
-
|
|
34
|
+
loadNodeFromManifest(node, manifest, additionalCreatableModules) {
|
|
24
35
|
var _a, _b, _c, _d, _e, _f;
|
|
25
36
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
26
37
|
const nodeWrapper = node_1.NodeWrapper.wrap(node);
|
|
27
38
|
// Load Private Modules
|
|
28
39
|
yield Promise.all((_c = (_b = (_a = manifest.modules) === null || _a === void 0 ? void 0 : _a.private) === null || _b === void 0 ? void 0 : _b.map((moduleManifest) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
29
|
-
yield this.loadModule(nodeWrapper,
|
|
40
|
+
yield this.loadModule(nodeWrapper, moduleManifest, false, additionalCreatableModules);
|
|
30
41
|
}))) !== null && _c !== void 0 ? _c : [() => null]);
|
|
31
42
|
// Load Public Modules
|
|
32
43
|
yield Promise.all((_f = (_e = (_d = manifest.modules) === null || _d === void 0 ? void 0 : _d.public) === null || _e === void 0 ? void 0 : _e.map((moduleManifest) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
33
|
-
yield this.loadModule(nodeWrapper,
|
|
44
|
+
yield this.loadModule(nodeWrapper, moduleManifest, true, additionalCreatableModules);
|
|
34
45
|
}))) !== null && _f !== void 0 ? _f : [() => null]);
|
|
35
46
|
return node;
|
|
36
47
|
});
|
|
37
48
|
}
|
|
38
|
-
|
|
49
|
+
loadNodes(node, additionalCreatableModules) {
|
|
39
50
|
var _a;
|
|
40
51
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
41
|
-
return yield Promise.all((_a = this.payload().
|
|
52
|
+
return yield Promise.all((_a = this.payload().nodes) === null || _a === void 0 ? void 0 : _a.map((nodeManifest, index) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
42
53
|
const subNode = yield node_1.MemoryNode.create({ config: { schema: 'network.xyo.node.config' }, wallet: yield this.wallet.derivePath(`${index}'`) });
|
|
43
54
|
yield (node === null || node === void 0 ? void 0 : node.register(subNode));
|
|
44
|
-
yield this.
|
|
55
|
+
yield this.loadNodeFromManifest(subNode, nodeManifest, additionalCreatableModules);
|
|
45
56
|
return subNode;
|
|
46
57
|
})));
|
|
47
58
|
});
|
|
48
59
|
}
|
|
49
|
-
|
|
60
|
+
nodeManifest(index) {
|
|
50
61
|
var _a;
|
|
51
|
-
return
|
|
52
|
-
const creatableModules = Object.assign(Object.assign({}, ModuleFactory_1.standardCreatableModules), additionalCreatableModules);
|
|
53
|
-
const nodeWrapper = node_1.NodeWrapper.wrap(node);
|
|
54
|
-
if (!manifest.name || (yield (external ? nodeWrapper.downResolver : nodeWrapper.upResolver).resolve({ name: [manifest.name] })).length === 0) {
|
|
55
|
-
if (manifest.language && manifest.language === 'javascript') {
|
|
56
|
-
const id = manifest.id;
|
|
57
|
-
(0, assert_1.assertEx)((_a = (manifest.name && (yield node.attach(manifest.name, external)))) !== null && _a !== void 0 ? _a : (id ? yield node.attach((yield this.registerModule(node, manifest, creatableModules)).address, external) : undefined), `No module named [${manifest.name}] registered`);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
});
|
|
62
|
+
return (_a = this.payload().nodes) === null || _a === void 0 ? void 0 : _a[index];
|
|
61
63
|
}
|
|
62
64
|
registerModule(node, manifest, creatableModules) {
|
|
63
65
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
64
|
-
const creatableModule = (0, assert_1.assertEx)(creatableModules === null || creatableModules === void 0 ? void 0 : creatableModules[
|
|
66
|
+
const creatableModule = (0, assert_1.assertEx)(creatableModules === null || creatableModules === void 0 ? void 0 : creatableModules[manifest.config.schema], `No module with [${manifest.config.schema}] config schema available for registration`);
|
|
65
67
|
const module = yield creatableModule.create({
|
|
66
|
-
account: manifest.accountPath ? yield this.wallet.derivePath(manifest.accountPath) : this.wallet,
|
|
68
|
+
account: manifest.config.accountPath ? yield this.wallet.derivePath(manifest.config.accountPath) : this.wallet,
|
|
67
69
|
config: (0, assert_1.assertEx)(manifest.config, 'Missing config'),
|
|
68
70
|
});
|
|
69
71
|
yield node.module.register(module);
|
|
70
72
|
return module;
|
|
71
73
|
});
|
|
72
74
|
}
|
|
73
|
-
resolveModuleManifest(manifest) {
|
|
74
|
-
var _a;
|
|
75
|
-
if ((manifest === null || manifest === void 0 ? void 0 : manifest.name) && !manifest.id) {
|
|
76
|
-
return (_a = this.payload().modules) === null || _a === void 0 ? void 0 : _a[manifest.name];
|
|
77
|
-
}
|
|
78
|
-
return manifest;
|
|
79
|
-
}
|
|
80
75
|
}
|
|
81
76
|
exports.ManifestWrapper = ManifestWrapper;
|
|
82
77
|
//# sourceMappingURL=ManifestWrapper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ManifestWrapper.js","sourceRoot":"","sources":["../../src/ManifestWrapper.ts"],"names":[],"mappings":";;;;AAAA,2CAAyC;AAEzC,
|
|
1
|
+
{"version":3,"file":"ManifestWrapper.js","sourceRoot":"","sources":["../../src/ManifestWrapper.ts"],"names":[],"mappings":";;;;AAAA,2CAAyC;AAEzC,4CAAuE;AACvE,kEAA6D;AAG7D,mDAA0D;AAG1D,MAAa,eAAgB,SAAQ,gCAA+B;IAClE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AC,MAAM;gBAC9G,MAAM,EAAE,IAAA,iBAAQ,EAAC,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC;aACpD,CAAC,CAAA;YACF,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;YAClC,OAAO,MAAM,CAAA;QACf,CAAC;KAAA;CACF;AA1ED,0CA0EC"}
|
|
@@ -7,9 +7,9 @@ const module_1 = require("@xyo-network/module");
|
|
|
7
7
|
const node_1 = require("@xyo-network/node");
|
|
8
8
|
const sentinel_1 = require("@xyo-network/sentinel");
|
|
9
9
|
exports.standardCreatableModules = {
|
|
10
|
-
'network.xyo.archivist': memory_archivist_1.MemoryArchivist,
|
|
11
|
-
'network.xyo.bridge.http': module_1.ModuleFactory.withParams(http_bridge_1.HttpBridge, { config: { schema: http_bridge_1.HttpBridge.configSchema } }),
|
|
12
|
-
'network.xyo.node': node_1.MemoryNode,
|
|
13
|
-
'network.xyo.sentinel': sentinel_1.MemorySentinel,
|
|
10
|
+
'network.xyo.archivist.config': memory_archivist_1.MemoryArchivist,
|
|
11
|
+
'network.xyo.bridge.http.config': module_1.ModuleFactory.withParams(http_bridge_1.HttpBridge, { config: { schema: http_bridge_1.HttpBridge.configSchema } }),
|
|
12
|
+
'network.xyo.node.config': node_1.MemoryNode,
|
|
13
|
+
'network.xyo.sentinel.config': sentinel_1.MemorySentinel,
|
|
14
14
|
};
|
|
15
15
|
//# sourceMappingURL=ModuleFactory.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModuleFactory.js","sourceRoot":"","sources":["../../src/ModuleFactory.ts"],"names":[],"mappings":";;;AAAA,0DAAqD;AACrD,oEAA+D;AAC/D,gDAA8E;AAC9E,4CAA8C;AAC9C,oDAAsD;AAEzC,QAAA,wBAAwB,GAA8B;IACjE,
|
|
1
|
+
{"version":3,"file":"ModuleFactory.js","sourceRoot":"","sources":["../../src/ModuleFactory.ts"],"names":[],"mappings":";;;AAAA,0DAAqD;AACrD,oEAA+D;AAC/D,gDAA8E;AAC9E,4CAA8C;AAC9C,oDAAsD;AAEzC,QAAA,wBAAwB,GAA8B;IACjE,8BAA8B,EAAE,kCAAe;IAC/C,gCAAgC,EAAE,sBAAa,CAAC,UAAU,CAAC,wBAAU,EAAE,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,wBAAU,CAAC,YAAY,EAAE,EAAE,CAAC;IACvH,yBAAyB,EAAE,iBAAU;IACrC,6BAA6B,EAAE,yBAAc;CAC9C,CAAA"}
|