@xyo-network/manifest 2.73.2 → 2.73.4
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/docs.json +528 -384
- package/dist/{types/ManifestWrapper.d.ts → index.d.mts} +48 -38
- package/dist/index.d.ts +207 -0
- package/dist/index.js +120 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +90 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +40 -29
- package/src/ManifestWrapper.ts +5 -8
- package/tsup.config.ts +16 -0
- package/dist/cjs/ManifestWrapper.js +0 -82
- package/dist/cjs/ManifestWrapper.js.map +0 -1
- package/dist/cjs/index.js +0 -7
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/standardCreatableModules.js +0 -15
- package/dist/cjs/standardCreatableModules.js.map +0 -1
- package/dist/esm/ManifestWrapper.js +0 -63
- package/dist/esm/ManifestWrapper.js.map +0 -1
- package/dist/esm/index.js +0 -4
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/standardCreatableModules.js +0 -12
- package/dist/esm/standardCreatableModules.js.map +0 -1
- package/dist/types/ManifestWrapper.d.ts.map +0 -1
- package/dist/types/index.d.ts +0 -4
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/standardCreatableModules.d.ts +0 -3
- package/dist/types/standardCreatableModules.d.ts.map +0 -1
|
@@ -1,17 +1,24 @@
|
|
|
1
|
+
import * as _xyo_network_node_model from '@xyo-network/node-model';
|
|
2
|
+
import * as _xyo_network_module_model from '@xyo-network/module-model';
|
|
3
|
+
import * as _xyo_network_payload_model from '@xyo-network/payload-model';
|
|
4
|
+
import * as _xyo_network_account_model from '@xyo-network/account-model';
|
|
5
|
+
import * as _xyo_network_core from '@xyo-network/core';
|
|
1
6
|
import { ManifestPayload, ModuleManifest, NodeManifest } from '@xyo-network/manifest-model';
|
|
7
|
+
export * from '@xyo-network/manifest-model';
|
|
2
8
|
import { CreatableModuleDictionary } from '@xyo-network/module';
|
|
3
9
|
import { MemoryNode } from '@xyo-network/node-memory';
|
|
4
10
|
import { PayloadWrapper } from '@xyo-network/payload-wrapper';
|
|
5
11
|
import { WalletInstance } from '@xyo-network/wallet-model';
|
|
6
|
-
|
|
12
|
+
|
|
13
|
+
declare class ManifestWrapper extends PayloadWrapper<ManifestPayload> {
|
|
7
14
|
protected wallet: WalletInstance;
|
|
8
15
|
constructor(payload: ManifestPayload, wallet: WalletInstance);
|
|
9
16
|
loadModule(node: MemoryNode, manifest: ModuleManifest, external?: boolean, additionalCreatableModules?: CreatableModuleDictionary): Promise<void>;
|
|
10
|
-
loadNodeFromIndex(index: number, additionalCreatableModules?: CreatableModuleDictionary): Promise<MemoryNode<
|
|
11
|
-
account?:
|
|
12
|
-
config:
|
|
17
|
+
loadNodeFromIndex(index: number, additionalCreatableModules?: CreatableModuleDictionary): Promise<MemoryNode<_xyo_network_core.BaseParamsFields & {
|
|
18
|
+
account?: _xyo_network_account_model.AccountInstance | "random" | undefined;
|
|
19
|
+
config: _xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & {
|
|
13
20
|
accountDerivationPath?: string | undefined;
|
|
14
|
-
readonly archivist?:
|
|
21
|
+
readonly archivist?: _xyo_network_module_model.ArchivistModuleConfig | undefined;
|
|
15
22
|
readonly name?: string | undefined;
|
|
16
23
|
readonly paging?: Record<string, {
|
|
17
24
|
size?: number | undefined;
|
|
@@ -19,15 +26,15 @@ export declare class ManifestWrapper extends PayloadWrapper<ManifestPayload> {
|
|
|
19
26
|
readonly schema: string;
|
|
20
27
|
readonly security?: {
|
|
21
28
|
readonly allowAnonymous?: boolean | undefined;
|
|
22
|
-
readonly allowed?: Record<string, (string |
|
|
29
|
+
readonly allowed?: Record<string, (string | _xyo_network_module_model.CosigningAddressSet)[]> | undefined;
|
|
23
30
|
readonly disallowed?: Record<string, string[]> | undefined;
|
|
24
31
|
} | undefined;
|
|
25
32
|
readonly sign?: boolean | undefined;
|
|
26
33
|
readonly storeQueries?: boolean | undefined;
|
|
27
34
|
readonly timestamp?: boolean | undefined;
|
|
28
|
-
} & Omit<Omit<
|
|
35
|
+
} & Omit<Omit<_xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & {
|
|
29
36
|
accountDerivationPath?: string | undefined;
|
|
30
|
-
readonly archivist?:
|
|
37
|
+
readonly archivist?: _xyo_network_module_model.ArchivistModuleConfig | undefined;
|
|
31
38
|
readonly name?: string | undefined;
|
|
32
39
|
readonly paging?: Record<string, {
|
|
33
40
|
size?: number | undefined;
|
|
@@ -35,7 +42,7 @@ export declare class ManifestWrapper extends PayloadWrapper<ManifestPayload> {
|
|
|
35
42
|
readonly schema: "network.xyo.node.config";
|
|
36
43
|
readonly security?: {
|
|
37
44
|
readonly allowAnonymous?: boolean | undefined;
|
|
38
|
-
readonly allowed?: Record<string, (string |
|
|
45
|
+
readonly allowed?: Record<string, (string | _xyo_network_module_model.CosigningAddressSet)[]> | undefined;
|
|
39
46
|
readonly disallowed?: Record<string, string[]> | undefined;
|
|
40
47
|
} | undefined;
|
|
41
48
|
readonly sign?: boolean | undefined;
|
|
@@ -53,12 +60,12 @@ export declare class ManifestWrapper extends PayloadWrapper<ManifestPayload> {
|
|
|
53
60
|
};
|
|
54
61
|
ephemeralQueryAccountEnabled?: boolean | undefined;
|
|
55
62
|
wallet?: WalletInstance | undefined;
|
|
56
|
-
},
|
|
57
|
-
loadNodeFromManifest(manifest: NodeManifest, path: string, additionalCreatableModules?: CreatableModuleDictionary): Promise<MemoryNode<
|
|
58
|
-
account?:
|
|
59
|
-
config:
|
|
63
|
+
}, _xyo_network_node_model.NodeModuleEventData>>;
|
|
64
|
+
loadNodeFromManifest(manifest: NodeManifest, path: string, additionalCreatableModules?: CreatableModuleDictionary): Promise<MemoryNode<_xyo_network_core.BaseParamsFields & {
|
|
65
|
+
account?: _xyo_network_account_model.AccountInstance | "random" | undefined;
|
|
66
|
+
config: _xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & {
|
|
60
67
|
accountDerivationPath?: string | undefined;
|
|
61
|
-
readonly archivist?:
|
|
68
|
+
readonly archivist?: _xyo_network_module_model.ArchivistModuleConfig | undefined;
|
|
62
69
|
readonly name?: string | undefined;
|
|
63
70
|
readonly paging?: Record<string, {
|
|
64
71
|
size?: number | undefined;
|
|
@@ -66,15 +73,15 @@ export declare class ManifestWrapper extends PayloadWrapper<ManifestPayload> {
|
|
|
66
73
|
readonly schema: string;
|
|
67
74
|
readonly security?: {
|
|
68
75
|
readonly allowAnonymous?: boolean | undefined;
|
|
69
|
-
readonly allowed?: Record<string, (string |
|
|
76
|
+
readonly allowed?: Record<string, (string | _xyo_network_module_model.CosigningAddressSet)[]> | undefined;
|
|
70
77
|
readonly disallowed?: Record<string, string[]> | undefined;
|
|
71
78
|
} | undefined;
|
|
72
79
|
readonly sign?: boolean | undefined;
|
|
73
80
|
readonly storeQueries?: boolean | undefined;
|
|
74
81
|
readonly timestamp?: boolean | undefined;
|
|
75
|
-
} & Omit<Omit<
|
|
82
|
+
} & Omit<Omit<_xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & {
|
|
76
83
|
accountDerivationPath?: string | undefined;
|
|
77
|
-
readonly archivist?:
|
|
84
|
+
readonly archivist?: _xyo_network_module_model.ArchivistModuleConfig | undefined;
|
|
78
85
|
readonly name?: string | undefined;
|
|
79
86
|
readonly paging?: Record<string, {
|
|
80
87
|
size?: number | undefined;
|
|
@@ -82,7 +89,7 @@ export declare class ManifestWrapper extends PayloadWrapper<ManifestPayload> {
|
|
|
82
89
|
readonly schema: "network.xyo.node.config";
|
|
83
90
|
readonly security?: {
|
|
84
91
|
readonly allowAnonymous?: boolean | undefined;
|
|
85
|
-
readonly allowed?: Record<string, (string |
|
|
92
|
+
readonly allowed?: Record<string, (string | _xyo_network_module_model.CosigningAddressSet)[]> | undefined;
|
|
86
93
|
readonly disallowed?: Record<string, string[]> | undefined;
|
|
87
94
|
} | undefined;
|
|
88
95
|
readonly sign?: boolean | undefined;
|
|
@@ -100,12 +107,12 @@ export declare class ManifestWrapper extends PayloadWrapper<ManifestPayload> {
|
|
|
100
107
|
};
|
|
101
108
|
ephemeralQueryAccountEnabled?: boolean | undefined;
|
|
102
109
|
wallet?: WalletInstance | undefined;
|
|
103
|
-
},
|
|
104
|
-
loadNodes(node?: MemoryNode, additionalCreatableModules?: CreatableModuleDictionary): Promise<MemoryNode<
|
|
105
|
-
account?:
|
|
106
|
-
config:
|
|
110
|
+
}, _xyo_network_node_model.NodeModuleEventData>>;
|
|
111
|
+
loadNodes(node?: MemoryNode, additionalCreatableModules?: CreatableModuleDictionary): Promise<MemoryNode<_xyo_network_core.BaseParamsFields & {
|
|
112
|
+
account?: _xyo_network_account_model.AccountInstance | "random" | undefined;
|
|
113
|
+
config: _xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & {
|
|
107
114
|
accountDerivationPath?: string | undefined;
|
|
108
|
-
readonly archivist?:
|
|
115
|
+
readonly archivist?: _xyo_network_module_model.ArchivistModuleConfig | undefined;
|
|
109
116
|
readonly name?: string | undefined;
|
|
110
117
|
readonly paging?: Record<string, {
|
|
111
118
|
size?: number | undefined;
|
|
@@ -113,15 +120,15 @@ export declare class ManifestWrapper extends PayloadWrapper<ManifestPayload> {
|
|
|
113
120
|
readonly schema: string;
|
|
114
121
|
readonly security?: {
|
|
115
122
|
readonly allowAnonymous?: boolean | undefined;
|
|
116
|
-
readonly allowed?: Record<string, (string |
|
|
123
|
+
readonly allowed?: Record<string, (string | _xyo_network_module_model.CosigningAddressSet)[]> | undefined;
|
|
117
124
|
readonly disallowed?: Record<string, string[]> | undefined;
|
|
118
125
|
} | undefined;
|
|
119
126
|
readonly sign?: boolean | undefined;
|
|
120
127
|
readonly storeQueries?: boolean | undefined;
|
|
121
128
|
readonly timestamp?: boolean | undefined;
|
|
122
|
-
} & Omit<Omit<
|
|
129
|
+
} & Omit<Omit<_xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & {
|
|
123
130
|
accountDerivationPath?: string | undefined;
|
|
124
|
-
readonly archivist?:
|
|
131
|
+
readonly archivist?: _xyo_network_module_model.ArchivistModuleConfig | undefined;
|
|
125
132
|
readonly name?: string | undefined;
|
|
126
133
|
readonly paging?: Record<string, {
|
|
127
134
|
size?: number | undefined;
|
|
@@ -129,7 +136,7 @@ export declare class ManifestWrapper extends PayloadWrapper<ManifestPayload> {
|
|
|
129
136
|
readonly schema: "network.xyo.node.config";
|
|
130
137
|
readonly security?: {
|
|
131
138
|
readonly allowAnonymous?: boolean | undefined;
|
|
132
|
-
readonly allowed?: Record<string, (string |
|
|
139
|
+
readonly allowed?: Record<string, (string | _xyo_network_module_model.CosigningAddressSet)[]> | undefined;
|
|
133
140
|
readonly disallowed?: Record<string, string[]> | undefined;
|
|
134
141
|
} | undefined;
|
|
135
142
|
readonly sign?: boolean | undefined;
|
|
@@ -147,13 +154,13 @@ export declare class ManifestWrapper extends PayloadWrapper<ManifestPayload> {
|
|
|
147
154
|
};
|
|
148
155
|
ephemeralQueryAccountEnabled?: boolean | undefined;
|
|
149
156
|
wallet?: WalletInstance | undefined;
|
|
150
|
-
},
|
|
157
|
+
}, _xyo_network_node_model.NodeModuleEventData>[]>;
|
|
151
158
|
nodeManifest(index: number): NodeManifest;
|
|
152
|
-
registerModule(node: MemoryNode, manifest: ModuleManifest, creatableModules?: CreatableModuleDictionary): Promise<
|
|
153
|
-
account?:
|
|
154
|
-
config:
|
|
159
|
+
registerModule(node: MemoryNode, manifest: ModuleManifest, creatableModules?: CreatableModuleDictionary): Promise<_xyo_network_module_model.ModuleInstance<_xyo_network_core.BaseParamsFields & {
|
|
160
|
+
account?: _xyo_network_account_model.AccountInstance | "random" | undefined;
|
|
161
|
+
config: _xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & {
|
|
155
162
|
accountDerivationPath?: string | undefined;
|
|
156
|
-
readonly archivist?:
|
|
163
|
+
readonly archivist?: _xyo_network_module_model.ArchivistModuleConfig | undefined;
|
|
157
164
|
readonly name?: string | undefined;
|
|
158
165
|
readonly paging?: Record<string, {
|
|
159
166
|
size?: number | undefined;
|
|
@@ -161,15 +168,15 @@ export declare class ManifestWrapper extends PayloadWrapper<ManifestPayload> {
|
|
|
161
168
|
readonly schema: string;
|
|
162
169
|
readonly security?: {
|
|
163
170
|
readonly allowAnonymous?: boolean | undefined;
|
|
164
|
-
readonly allowed?: Record<string, (string |
|
|
171
|
+
readonly allowed?: Record<string, (string | _xyo_network_module_model.CosigningAddressSet)[]> | undefined;
|
|
165
172
|
readonly disallowed?: Record<string, string[]> | undefined;
|
|
166
173
|
} | undefined;
|
|
167
174
|
readonly sign?: boolean | undefined;
|
|
168
175
|
readonly storeQueries?: boolean | undefined;
|
|
169
176
|
readonly timestamp?: boolean | undefined;
|
|
170
|
-
} & Omit<Omit<
|
|
177
|
+
} & Omit<Omit<_xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & {
|
|
171
178
|
accountDerivationPath?: string | undefined;
|
|
172
|
-
readonly archivist?:
|
|
179
|
+
readonly archivist?: _xyo_network_module_model.ArchivistModuleConfig | undefined;
|
|
173
180
|
readonly name?: string | undefined;
|
|
174
181
|
readonly paging?: Record<string, {
|
|
175
182
|
size?: number | undefined;
|
|
@@ -177,7 +184,7 @@ export declare class ManifestWrapper extends PayloadWrapper<ManifestPayload> {
|
|
|
177
184
|
readonly schema: "network.xyo.module.config";
|
|
178
185
|
readonly security?: {
|
|
179
186
|
readonly allowAnonymous?: boolean | undefined;
|
|
180
|
-
readonly allowed?: Record<string, (string |
|
|
187
|
+
readonly allowed?: Record<string, (string | _xyo_network_module_model.CosigningAddressSet)[]> | undefined;
|
|
181
188
|
readonly disallowed?: Record<string, string[]> | undefined;
|
|
182
189
|
} | undefined;
|
|
183
190
|
readonly sign?: boolean | undefined;
|
|
@@ -192,6 +199,9 @@ export declare class ManifestWrapper extends PayloadWrapper<ManifestPayload> {
|
|
|
192
199
|
};
|
|
193
200
|
ephemeralQueryAccountEnabled?: boolean | undefined;
|
|
194
201
|
wallet?: WalletInstance | undefined;
|
|
195
|
-
},
|
|
202
|
+
}, _xyo_network_module_model.ModuleEventData<object>>>;
|
|
196
203
|
}
|
|
197
|
-
|
|
204
|
+
|
|
205
|
+
declare const standardCreatableModules: CreatableModuleDictionary;
|
|
206
|
+
|
|
207
|
+
export { ManifestWrapper, standardCreatableModules };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import * as _xyo_network_node_model from '@xyo-network/node-model';
|
|
2
|
+
import * as _xyo_network_module_model from '@xyo-network/module-model';
|
|
3
|
+
import * as _xyo_network_payload_model from '@xyo-network/payload-model';
|
|
4
|
+
import * as _xyo_network_account_model from '@xyo-network/account-model';
|
|
5
|
+
import * as _xyo_network_core from '@xyo-network/core';
|
|
6
|
+
import { ManifestPayload, ModuleManifest, NodeManifest } from '@xyo-network/manifest-model';
|
|
7
|
+
export * from '@xyo-network/manifest-model';
|
|
8
|
+
import { CreatableModuleDictionary } from '@xyo-network/module';
|
|
9
|
+
import { MemoryNode } from '@xyo-network/node-memory';
|
|
10
|
+
import { PayloadWrapper } from '@xyo-network/payload-wrapper';
|
|
11
|
+
import { WalletInstance } from '@xyo-network/wallet-model';
|
|
12
|
+
|
|
13
|
+
declare class ManifestWrapper extends PayloadWrapper<ManifestPayload> {
|
|
14
|
+
protected wallet: WalletInstance;
|
|
15
|
+
constructor(payload: ManifestPayload, wallet: WalletInstance);
|
|
16
|
+
loadModule(node: MemoryNode, manifest: ModuleManifest, external?: boolean, additionalCreatableModules?: CreatableModuleDictionary): Promise<void>;
|
|
17
|
+
loadNodeFromIndex(index: number, additionalCreatableModules?: CreatableModuleDictionary): Promise<MemoryNode<_xyo_network_core.BaseParamsFields & {
|
|
18
|
+
account?: _xyo_network_account_model.AccountInstance | "random" | undefined;
|
|
19
|
+
config: _xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & {
|
|
20
|
+
accountDerivationPath?: string | undefined;
|
|
21
|
+
readonly archivist?: _xyo_network_module_model.ArchivistModuleConfig | undefined;
|
|
22
|
+
readonly name?: string | undefined;
|
|
23
|
+
readonly paging?: Record<string, {
|
|
24
|
+
size?: number | undefined;
|
|
25
|
+
}> | undefined;
|
|
26
|
+
readonly schema: string;
|
|
27
|
+
readonly security?: {
|
|
28
|
+
readonly allowAnonymous?: boolean | undefined;
|
|
29
|
+
readonly allowed?: Record<string, (string | _xyo_network_module_model.CosigningAddressSet)[]> | undefined;
|
|
30
|
+
readonly disallowed?: Record<string, string[]> | undefined;
|
|
31
|
+
} | undefined;
|
|
32
|
+
readonly sign?: boolean | undefined;
|
|
33
|
+
readonly storeQueries?: boolean | undefined;
|
|
34
|
+
readonly timestamp?: boolean | undefined;
|
|
35
|
+
} & Omit<Omit<_xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & {
|
|
36
|
+
accountDerivationPath?: string | undefined;
|
|
37
|
+
readonly archivist?: _xyo_network_module_model.ArchivistModuleConfig | undefined;
|
|
38
|
+
readonly name?: string | undefined;
|
|
39
|
+
readonly paging?: Record<string, {
|
|
40
|
+
size?: number | undefined;
|
|
41
|
+
}> | undefined;
|
|
42
|
+
readonly schema: "network.xyo.node.config";
|
|
43
|
+
readonly security?: {
|
|
44
|
+
readonly allowAnonymous?: boolean | undefined;
|
|
45
|
+
readonly allowed?: Record<string, (string | _xyo_network_module_model.CosigningAddressSet)[]> | undefined;
|
|
46
|
+
readonly disallowed?: Record<string, string[]> | undefined;
|
|
47
|
+
} | undefined;
|
|
48
|
+
readonly sign?: boolean | undefined;
|
|
49
|
+
readonly storeQueries?: boolean | undefined;
|
|
50
|
+
readonly timestamp?: boolean | undefined;
|
|
51
|
+
} & Omit<{
|
|
52
|
+
archivist?: string | undefined;
|
|
53
|
+
schema: "network.xyo.node.config";
|
|
54
|
+
} & Omit<undefined, "schema">, "schema"> & {
|
|
55
|
+
schema: "network.xyo.node.config";
|
|
56
|
+
}, "schema"> & {
|
|
57
|
+
schema: string;
|
|
58
|
+
}, "schema"> & {
|
|
59
|
+
schema: string;
|
|
60
|
+
};
|
|
61
|
+
ephemeralQueryAccountEnabled?: boolean | undefined;
|
|
62
|
+
wallet?: WalletInstance | undefined;
|
|
63
|
+
}, _xyo_network_node_model.NodeModuleEventData>>;
|
|
64
|
+
loadNodeFromManifest(manifest: NodeManifest, path: string, additionalCreatableModules?: CreatableModuleDictionary): Promise<MemoryNode<_xyo_network_core.BaseParamsFields & {
|
|
65
|
+
account?: _xyo_network_account_model.AccountInstance | "random" | undefined;
|
|
66
|
+
config: _xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & {
|
|
67
|
+
accountDerivationPath?: string | undefined;
|
|
68
|
+
readonly archivist?: _xyo_network_module_model.ArchivistModuleConfig | undefined;
|
|
69
|
+
readonly name?: string | undefined;
|
|
70
|
+
readonly paging?: Record<string, {
|
|
71
|
+
size?: number | undefined;
|
|
72
|
+
}> | undefined;
|
|
73
|
+
readonly schema: string;
|
|
74
|
+
readonly security?: {
|
|
75
|
+
readonly allowAnonymous?: boolean | undefined;
|
|
76
|
+
readonly allowed?: Record<string, (string | _xyo_network_module_model.CosigningAddressSet)[]> | undefined;
|
|
77
|
+
readonly disallowed?: Record<string, string[]> | undefined;
|
|
78
|
+
} | undefined;
|
|
79
|
+
readonly sign?: boolean | undefined;
|
|
80
|
+
readonly storeQueries?: boolean | undefined;
|
|
81
|
+
readonly timestamp?: boolean | undefined;
|
|
82
|
+
} & Omit<Omit<_xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & {
|
|
83
|
+
accountDerivationPath?: string | undefined;
|
|
84
|
+
readonly archivist?: _xyo_network_module_model.ArchivistModuleConfig | undefined;
|
|
85
|
+
readonly name?: string | undefined;
|
|
86
|
+
readonly paging?: Record<string, {
|
|
87
|
+
size?: number | undefined;
|
|
88
|
+
}> | undefined;
|
|
89
|
+
readonly schema: "network.xyo.node.config";
|
|
90
|
+
readonly security?: {
|
|
91
|
+
readonly allowAnonymous?: boolean | undefined;
|
|
92
|
+
readonly allowed?: Record<string, (string | _xyo_network_module_model.CosigningAddressSet)[]> | undefined;
|
|
93
|
+
readonly disallowed?: Record<string, string[]> | undefined;
|
|
94
|
+
} | undefined;
|
|
95
|
+
readonly sign?: boolean | undefined;
|
|
96
|
+
readonly storeQueries?: boolean | undefined;
|
|
97
|
+
readonly timestamp?: boolean | undefined;
|
|
98
|
+
} & Omit<{
|
|
99
|
+
archivist?: string | undefined;
|
|
100
|
+
schema: "network.xyo.node.config";
|
|
101
|
+
} & Omit<undefined, "schema">, "schema"> & {
|
|
102
|
+
schema: "network.xyo.node.config";
|
|
103
|
+
}, "schema"> & {
|
|
104
|
+
schema: string;
|
|
105
|
+
}, "schema"> & {
|
|
106
|
+
schema: string;
|
|
107
|
+
};
|
|
108
|
+
ephemeralQueryAccountEnabled?: boolean | undefined;
|
|
109
|
+
wallet?: WalletInstance | undefined;
|
|
110
|
+
}, _xyo_network_node_model.NodeModuleEventData>>;
|
|
111
|
+
loadNodes(node?: MemoryNode, additionalCreatableModules?: CreatableModuleDictionary): Promise<MemoryNode<_xyo_network_core.BaseParamsFields & {
|
|
112
|
+
account?: _xyo_network_account_model.AccountInstance | "random" | undefined;
|
|
113
|
+
config: _xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & {
|
|
114
|
+
accountDerivationPath?: string | undefined;
|
|
115
|
+
readonly archivist?: _xyo_network_module_model.ArchivistModuleConfig | undefined;
|
|
116
|
+
readonly name?: string | undefined;
|
|
117
|
+
readonly paging?: Record<string, {
|
|
118
|
+
size?: number | undefined;
|
|
119
|
+
}> | undefined;
|
|
120
|
+
readonly schema: string;
|
|
121
|
+
readonly security?: {
|
|
122
|
+
readonly allowAnonymous?: boolean | undefined;
|
|
123
|
+
readonly allowed?: Record<string, (string | _xyo_network_module_model.CosigningAddressSet)[]> | undefined;
|
|
124
|
+
readonly disallowed?: Record<string, string[]> | undefined;
|
|
125
|
+
} | undefined;
|
|
126
|
+
readonly sign?: boolean | undefined;
|
|
127
|
+
readonly storeQueries?: boolean | undefined;
|
|
128
|
+
readonly timestamp?: boolean | undefined;
|
|
129
|
+
} & Omit<Omit<_xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & {
|
|
130
|
+
accountDerivationPath?: string | undefined;
|
|
131
|
+
readonly archivist?: _xyo_network_module_model.ArchivistModuleConfig | undefined;
|
|
132
|
+
readonly name?: string | undefined;
|
|
133
|
+
readonly paging?: Record<string, {
|
|
134
|
+
size?: number | undefined;
|
|
135
|
+
}> | undefined;
|
|
136
|
+
readonly schema: "network.xyo.node.config";
|
|
137
|
+
readonly security?: {
|
|
138
|
+
readonly allowAnonymous?: boolean | undefined;
|
|
139
|
+
readonly allowed?: Record<string, (string | _xyo_network_module_model.CosigningAddressSet)[]> | undefined;
|
|
140
|
+
readonly disallowed?: Record<string, string[]> | undefined;
|
|
141
|
+
} | undefined;
|
|
142
|
+
readonly sign?: boolean | undefined;
|
|
143
|
+
readonly storeQueries?: boolean | undefined;
|
|
144
|
+
readonly timestamp?: boolean | undefined;
|
|
145
|
+
} & Omit<{
|
|
146
|
+
archivist?: string | undefined;
|
|
147
|
+
schema: "network.xyo.node.config";
|
|
148
|
+
} & Omit<undefined, "schema">, "schema"> & {
|
|
149
|
+
schema: "network.xyo.node.config";
|
|
150
|
+
}, "schema"> & {
|
|
151
|
+
schema: string;
|
|
152
|
+
}, "schema"> & {
|
|
153
|
+
schema: string;
|
|
154
|
+
};
|
|
155
|
+
ephemeralQueryAccountEnabled?: boolean | undefined;
|
|
156
|
+
wallet?: WalletInstance | undefined;
|
|
157
|
+
}, _xyo_network_node_model.NodeModuleEventData>[]>;
|
|
158
|
+
nodeManifest(index: number): NodeManifest;
|
|
159
|
+
registerModule(node: MemoryNode, manifest: ModuleManifest, creatableModules?: CreatableModuleDictionary): Promise<_xyo_network_module_model.ModuleInstance<_xyo_network_core.BaseParamsFields & {
|
|
160
|
+
account?: _xyo_network_account_model.AccountInstance | "random" | undefined;
|
|
161
|
+
config: _xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & {
|
|
162
|
+
accountDerivationPath?: string | undefined;
|
|
163
|
+
readonly archivist?: _xyo_network_module_model.ArchivistModuleConfig | undefined;
|
|
164
|
+
readonly name?: string | undefined;
|
|
165
|
+
readonly paging?: Record<string, {
|
|
166
|
+
size?: number | undefined;
|
|
167
|
+
}> | undefined;
|
|
168
|
+
readonly schema: string;
|
|
169
|
+
readonly security?: {
|
|
170
|
+
readonly allowAnonymous?: boolean | undefined;
|
|
171
|
+
readonly allowed?: Record<string, (string | _xyo_network_module_model.CosigningAddressSet)[]> | undefined;
|
|
172
|
+
readonly disallowed?: Record<string, string[]> | undefined;
|
|
173
|
+
} | undefined;
|
|
174
|
+
readonly sign?: boolean | undefined;
|
|
175
|
+
readonly storeQueries?: boolean | undefined;
|
|
176
|
+
readonly timestamp?: boolean | undefined;
|
|
177
|
+
} & Omit<Omit<_xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & {
|
|
178
|
+
accountDerivationPath?: string | undefined;
|
|
179
|
+
readonly archivist?: _xyo_network_module_model.ArchivistModuleConfig | undefined;
|
|
180
|
+
readonly name?: string | undefined;
|
|
181
|
+
readonly paging?: Record<string, {
|
|
182
|
+
size?: number | undefined;
|
|
183
|
+
}> | undefined;
|
|
184
|
+
readonly schema: "network.xyo.module.config";
|
|
185
|
+
readonly security?: {
|
|
186
|
+
readonly allowAnonymous?: boolean | undefined;
|
|
187
|
+
readonly allowed?: Record<string, (string | _xyo_network_module_model.CosigningAddressSet)[]> | undefined;
|
|
188
|
+
readonly disallowed?: Record<string, string[]> | undefined;
|
|
189
|
+
} | undefined;
|
|
190
|
+
readonly sign?: boolean | undefined;
|
|
191
|
+
readonly storeQueries?: boolean | undefined;
|
|
192
|
+
readonly timestamp?: boolean | undefined;
|
|
193
|
+
} & Omit<undefined, "schema"> & {
|
|
194
|
+
schema: "network.xyo.module.config";
|
|
195
|
+
}, "schema"> & {
|
|
196
|
+
schema: string;
|
|
197
|
+
}, "schema"> & {
|
|
198
|
+
schema: string;
|
|
199
|
+
};
|
|
200
|
+
ephemeralQueryAccountEnabled?: boolean | undefined;
|
|
201
|
+
wallet?: WalletInstance | undefined;
|
|
202
|
+
}, _xyo_network_module_model.ModuleEventData<object>>>;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
declare const standardCreatableModules: CreatableModuleDictionary;
|
|
206
|
+
|
|
207
|
+
export { ManifestWrapper, standardCreatableModules };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
|
|
21
|
+
// src/index.ts
|
|
22
|
+
var src_exports = {};
|
|
23
|
+
__export(src_exports, {
|
|
24
|
+
ManifestWrapper: () => ManifestWrapper,
|
|
25
|
+
standardCreatableModules: () => standardCreatableModules
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(src_exports);
|
|
28
|
+
|
|
29
|
+
// src/ManifestWrapper.ts
|
|
30
|
+
var import_assert = require("@xylabs/assert");
|
|
31
|
+
var import_node_memory2 = require("@xyo-network/node-memory");
|
|
32
|
+
var import_payload_wrapper = require("@xyo-network/payload-wrapper");
|
|
33
|
+
|
|
34
|
+
// src/standardCreatableModules.ts
|
|
35
|
+
var import_http_bridge = require("@xyo-network/http-bridge");
|
|
36
|
+
var import_memory_archivist = require("@xyo-network/memory-archivist");
|
|
37
|
+
var import_module = require("@xyo-network/module");
|
|
38
|
+
var import_node_memory = require("@xyo-network/node-memory");
|
|
39
|
+
var import_sentinel = require("@xyo-network/sentinel");
|
|
40
|
+
var standardCreatableModules = {
|
|
41
|
+
"network.xyo.archivist.config": import_memory_archivist.MemoryArchivist,
|
|
42
|
+
"network.xyo.bridge.http.config": import_module.ModuleFactory.withParams(import_http_bridge.HttpBridge, { config: { schema: import_http_bridge.HttpBridge.configSchema } }),
|
|
43
|
+
"network.xyo.node.config": import_node_memory.MemoryNode,
|
|
44
|
+
"network.xyo.sentinel.config": import_sentinel.MemorySentinel
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
// src/ManifestWrapper.ts
|
|
48
|
+
var ManifestWrapper = class extends import_payload_wrapper.PayloadWrapper {
|
|
49
|
+
constructor(payload, wallet) {
|
|
50
|
+
super(payload);
|
|
51
|
+
this.wallet = wallet;
|
|
52
|
+
}
|
|
53
|
+
async loadModule(node, manifest, external = true, additionalCreatableModules) {
|
|
54
|
+
const collision = async (node2, name, external2) => {
|
|
55
|
+
const externalConflict = external2 ? (await node2.resolve({ name: [name] }, { direction: external2 ? "all" : "down" })).length !== 0 : false;
|
|
56
|
+
return externalConflict || (await node2.resolve({ name: [name] }, { direction: "down" })).length !== 0;
|
|
57
|
+
};
|
|
58
|
+
const creatableModules = { ...standardCreatableModules, ...additionalCreatableModules };
|
|
59
|
+
if (!await collision(node, manifest.config.name, external)) {
|
|
60
|
+
if (manifest.config.language && manifest.config.language === "javascript") {
|
|
61
|
+
(0, import_assert.assertEx)(
|
|
62
|
+
(manifest.config.name && await node.attach(manifest.config.name, external)) ?? await node.attach((await this.registerModule(node, manifest, creatableModules)).address, external),
|
|
63
|
+
`No module with config schema [${manifest.config.name}] registered`
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
async loadNodeFromIndex(index, additionalCreatableModules) {
|
|
69
|
+
const manifest = (0, import_assert.assertEx)(this.nodeManifest(index), "Failed to find Node Manifest");
|
|
70
|
+
return await this.loadNodeFromManifest(manifest, manifest.config.accountPath ?? `${index}'`, additionalCreatableModules);
|
|
71
|
+
}
|
|
72
|
+
async loadNodeFromManifest(manifest, path, additionalCreatableModules) {
|
|
73
|
+
const node = await import_node_memory2.MemoryNode.create({ config: manifest.config, wallet: await this.wallet.derivePath(path) });
|
|
74
|
+
const privateModules = manifest.modules?.private?.map(async (moduleManifest) => {
|
|
75
|
+
await this.loadModule(node, moduleManifest, false, additionalCreatableModules);
|
|
76
|
+
}) ?? [];
|
|
77
|
+
const publicModules = manifest.modules?.public?.map(async (moduleManifest) => {
|
|
78
|
+
await this.loadModule(node, moduleManifest, true, additionalCreatableModules);
|
|
79
|
+
}) ?? [];
|
|
80
|
+
await Promise.all([...privateModules, ...publicModules]);
|
|
81
|
+
return node;
|
|
82
|
+
}
|
|
83
|
+
async loadNodes(node, additionalCreatableModules) {
|
|
84
|
+
const start = Date.now();
|
|
85
|
+
const result = await Promise.all(
|
|
86
|
+
this.payload().nodes?.map(async (nodeManifest, index) => {
|
|
87
|
+
const subNode = await this.loadNodeFromManifest(nodeManifest, nodeManifest.config.accountPath ?? `${index}'`, additionalCreatableModules);
|
|
88
|
+
await node?.register(subNode);
|
|
89
|
+
return subNode;
|
|
90
|
+
})
|
|
91
|
+
);
|
|
92
|
+
console.log(`Loaded nodes from manifest in ${Date.now() - start}ms`);
|
|
93
|
+
return result;
|
|
94
|
+
}
|
|
95
|
+
nodeManifest(index) {
|
|
96
|
+
return this.payload().nodes?.[index];
|
|
97
|
+
}
|
|
98
|
+
async registerModule(node, manifest, creatableModules) {
|
|
99
|
+
const creatableModule = (0, import_assert.assertEx)(
|
|
100
|
+
creatableModules?.[manifest.config.schema],
|
|
101
|
+
`No module with [${manifest.config.schema}] config schema available for registration`
|
|
102
|
+
);
|
|
103
|
+
const module2 = await creatableModule.create({
|
|
104
|
+
account: manifest.config.accountPath ? await this.wallet.derivePath(manifest.config.accountPath) : this.wallet,
|
|
105
|
+
config: (0, import_assert.assertEx)(manifest.config, "Missing config")
|
|
106
|
+
});
|
|
107
|
+
await node.register(module2);
|
|
108
|
+
return module2;
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
// src/index.ts
|
|
113
|
+
__reExport(src_exports, require("@xyo-network/manifest-model"), module.exports);
|
|
114
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
115
|
+
0 && (module.exports = {
|
|
116
|
+
ManifestWrapper,
|
|
117
|
+
standardCreatableModules,
|
|
118
|
+
...require("@xyo-network/manifest-model")
|
|
119
|
+
});
|
|
120
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/ManifestWrapper.ts","../src/standardCreatableModules.ts"],"sourcesContent":["export * from './ManifestWrapper'\nexport * from './standardCreatableModules'\nexport * from '@xyo-network/manifest-model'\n","import { assertEx } from '@xylabs/assert'\nimport { ManifestPayload, ModuleManifest, NodeManifest } from '@xyo-network/manifest-model'\nimport { CreatableModuleDictionary } from '@xyo-network/module'\nimport { MemoryNode } from '@xyo-network/node-memory'\nimport { NodeInstance } from '@xyo-network/node-model'\nimport { PayloadWrapper } from '@xyo-network/payload-wrapper'\nimport { WalletInstance } from '@xyo-network/wallet-model'\n\nimport { standardCreatableModules } from './standardCreatableModules'\n\nexport class ManifestWrapper extends PayloadWrapper<ManifestPayload> {\n constructor(\n payload: ManifestPayload,\n protected wallet: WalletInstance,\n ) {\n super(payload)\n }\n\n async loadModule(node: MemoryNode, manifest: ModuleManifest, external = true, additionalCreatableModules?: CreatableModuleDictionary) {\n const collision = async (node: NodeInstance, name: string, external: boolean) => {\n const externalConflict = external ? (await node.resolve({ name: [name] }, { direction: external ? 'all' : 'down' })).length !== 0 : false\n return externalConflict || (await node.resolve({ name: [name] }, { direction: 'down' })).length !== 0\n }\n\n const creatableModules = { ...standardCreatableModules, ...additionalCreatableModules }\n if (!(await collision(node, manifest.config.name, external))) {\n if (manifest.config.language && manifest.config.language === 'javascript') {\n assertEx(\n (manifest.config.name && (await node.attach(manifest.config.name, external))) ??\n (await node.attach((await this.registerModule(node, manifest, creatableModules)).address, external)),\n `No module with config schema [${manifest.config.name}] registered`,\n )\n }\n }\n }\n\n async loadNodeFromIndex(index: number, additionalCreatableModules?: CreatableModuleDictionary) {\n const manifest = assertEx(this.nodeManifest(index), 'Failed to find Node Manifest')\n return await this.loadNodeFromManifest(manifest, manifest.config.accountPath ?? `${index}'`, additionalCreatableModules)\n }\n\n async loadNodeFromManifest(manifest: NodeManifest, path: string, additionalCreatableModules?: CreatableModuleDictionary) {\n const node = await MemoryNode.create({ config: manifest.config, wallet: await this.wallet.derivePath(path) })\n // Load Private Modules\n const privateModules =\n manifest.modules?.private?.map(async (moduleManifest) => {\n await this.loadModule(node, moduleManifest, false, additionalCreatableModules)\n }) ?? []\n // Load Public Modules\n const publicModules =\n manifest.modules?.public?.map(async (moduleManifest) => {\n await this.loadModule(node, moduleManifest, true, additionalCreatableModules)\n }) ?? []\n await Promise.all([...privateModules, ...publicModules])\n return node\n }\n\n async loadNodes(node?: MemoryNode, additionalCreatableModules?: CreatableModuleDictionary) {\n const start = Date.now()\n const result = await Promise.all(\n this.payload().nodes?.map(async (nodeManifest, index) => {\n const subNode = await this.loadNodeFromManifest(nodeManifest, nodeManifest.config.accountPath ?? `${index}'`, additionalCreatableModules)\n await node?.register(subNode)\n return subNode\n }),\n )\n console.log(`Loaded nodes from manifest in ${Date.now() - start}ms`)\n return result\n }\n\n nodeManifest(index: number) {\n return this.payload().nodes?.[index]\n }\n\n async registerModule(node: MemoryNode, manifest: ModuleManifest, creatableModules?: CreatableModuleDictionary) {\n const creatableModule = assertEx(\n creatableModules?.[manifest.config.schema],\n `No module with [${manifest.config.schema}] config schema available for registration`,\n )\n\n const module = await creatableModule.create({\n account: manifest.config.accountPath ? await this.wallet.derivePath(manifest.config.accountPath) : this.wallet,\n config: assertEx(manifest.config, 'Missing config'),\n })\n await node.register(module)\n return module\n }\n}\n","import { HttpBridge } from '@xyo-network/http-bridge'\nimport { MemoryArchivist } from '@xyo-network/memory-archivist'\nimport { CreatableModuleDictionary, ModuleFactory } from '@xyo-network/module'\nimport { MemoryNode } from '@xyo-network/node-memory'\nimport { MemorySentinel } from '@xyo-network/sentinel'\n\nexport const standardCreatableModules: CreatableModuleDictionary = {\n 'network.xyo.archivist.config': MemoryArchivist,\n 'network.xyo.bridge.http.config': ModuleFactory.withParams(HttpBridge, { config: { schema: HttpBridge.configSchema } }),\n 'network.xyo.node.config': MemoryNode,\n 'network.xyo.sentinel.config': MemorySentinel,\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,oBAAyB;AAGzB,IAAAA,sBAA2B;AAE3B,6BAA+B;;;ACL/B,yBAA2B;AAC3B,8BAAgC;AAChC,oBAAyD;AACzD,yBAA2B;AAC3B,sBAA+B;AAExB,IAAM,2BAAsD;AAAA,EACjE,gCAAgC;AAAA,EAChC,kCAAkC,4BAAc,WAAW,+BAAY,EAAE,QAAQ,EAAE,QAAQ,8BAAW,aAAa,EAAE,CAAC;AAAA,EACtH,2BAA2B;AAAA,EAC3B,+BAA+B;AACjC;;;ADDO,IAAM,kBAAN,cAA8B,sCAAgC;AAAA,EACnE,YACE,SACU,QACV;AACA,UAAM,OAAO;AAFH;AAAA,EAGZ;AAAA,EAEA,MAAM,WAAW,MAAkB,UAA0B,WAAW,MAAM,4BAAwD;AACpI,UAAM,YAAY,OAAOC,OAAoB,MAAcC,cAAsB;AAC/E,YAAM,mBAAmBA,aAAY,MAAMD,MAAK,QAAQ,EAAE,MAAM,CAAC,IAAI,EAAE,GAAG,EAAE,WAAWC,YAAW,QAAQ,OAAO,CAAC,GAAG,WAAW,IAAI;AACpI,aAAO,qBAAqB,MAAMD,MAAK,QAAQ,EAAE,MAAM,CAAC,IAAI,EAAE,GAAG,EAAE,WAAW,OAAO,CAAC,GAAG,WAAW;AAAA,IACtG;AAEA,UAAM,mBAAmB,EAAE,GAAG,0BAA0B,GAAG,2BAA2B;AACtF,QAAI,CAAE,MAAM,UAAU,MAAM,SAAS,OAAO,MAAM,QAAQ,GAAI;AAC5D,UAAI,SAAS,OAAO,YAAY,SAAS,OAAO,aAAa,cAAc;AACzE;AAAA,WACG,SAAS,OAAO,QAAS,MAAM,KAAK,OAAO,SAAS,OAAO,MAAM,QAAQ,MACvE,MAAM,KAAK,QAAQ,MAAM,KAAK,eAAe,MAAM,UAAU,gBAAgB,GAAG,SAAS,QAAQ;AAAA,UACpG,iCAAiC,SAAS,OAAO,IAAI;AAAA,QACvD;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EAEA,MAAM,kBAAkB,OAAe,4BAAwD;AAC7F,UAAM,eAAW,wBAAS,KAAK,aAAa,KAAK,GAAG,8BAA8B;AAClF,WAAO,MAAM,KAAK,qBAAqB,UAAU,SAAS,OAAO,eAAe,GAAG,KAAK,KAAK,0BAA0B;AAAA,EACzH;AAAA,EAEA,MAAM,qBAAqB,UAAwB,MAAc,4BAAwD;AACvH,UAAM,OAAO,MAAM,+BAAW,OAAO,EAAE,QAAQ,SAAS,QAAQ,QAAQ,MAAM,KAAK,OAAO,WAAW,IAAI,EAAE,CAAC;AAE5G,UAAM,iBACJ,SAAS,SAAS,SAAS,IAAI,OAAO,mBAAmB;AACvD,YAAM,KAAK,WAAW,MAAM,gBAAgB,OAAO,0BAA0B;AAAA,IAC/E,CAAC,KAAK,CAAC;AAET,UAAM,gBACJ,SAAS,SAAS,QAAQ,IAAI,OAAO,mBAAmB;AACtD,YAAM,KAAK,WAAW,MAAM,gBAAgB,MAAM,0BAA0B;AAAA,IAC9E,CAAC,KAAK,CAAC;AACT,UAAM,QAAQ,IAAI,CAAC,GAAG,gBAAgB,GAAG,aAAa,CAAC;AACvD,WAAO;AAAA,EACT;AAAA,EAEA,MAAM,UAAU,MAAmB,4BAAwD;AACzF,UAAM,QAAQ,KAAK,IAAI;AACvB,UAAM,SAAS,MAAM,QAAQ;AAAA,MAC3B,KAAK,QAAQ,EAAE,OAAO,IAAI,OAAO,cAAc,UAAU;AACvD,cAAM,UAAU,MAAM,KAAK,qBAAqB,cAAc,aAAa,OAAO,eAAe,GAAG,KAAK,KAAK,0BAA0B;AACxI,cAAM,MAAM,SAAS,OAAO;AAC5B,eAAO;AAAA,MACT,CAAC;AAAA,IACH;AACA,YAAQ,IAAI,iCAAiC,KAAK,IAAI,IAAI,KAAK,IAAI;AACnE,WAAO;AAAA,EACT;AAAA,EAEA,aAAa,OAAe;AAC1B,WAAO,KAAK,QAAQ,EAAE,QAAQ,KAAK;AAAA,EACrC;AAAA,EAEA,MAAM,eAAe,MAAkB,UAA0B,kBAA8C;AAC7G,UAAM,sBAAkB;AAAA,MACtB,mBAAmB,SAAS,OAAO,MAAM;AAAA,MACzC,mBAAmB,SAAS,OAAO,MAAM;AAAA,IAC3C;AAEA,UAAME,UAAS,MAAM,gBAAgB,OAAO;AAAA,MAC1C,SAAS,SAAS,OAAO,cAAc,MAAM,KAAK,OAAO,WAAW,SAAS,OAAO,WAAW,IAAI,KAAK;AAAA,MACxG,YAAQ,wBAAS,SAAS,QAAQ,gBAAgB;AAAA,IACpD,CAAC;AACD,UAAM,KAAK,SAASA,OAAM;AAC1B,WAAOA;AAAA,EACT;AACF;;;ADrFA,wBAAc,wCAFd;","names":["import_node_memory","node","external","module"]}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
// src/ManifestWrapper.ts
|
|
2
|
+
import { assertEx } from "@xylabs/assert";
|
|
3
|
+
import { MemoryNode as MemoryNode2 } from "@xyo-network/node-memory";
|
|
4
|
+
import { PayloadWrapper } from "@xyo-network/payload-wrapper";
|
|
5
|
+
|
|
6
|
+
// src/standardCreatableModules.ts
|
|
7
|
+
import { HttpBridge } from "@xyo-network/http-bridge";
|
|
8
|
+
import { MemoryArchivist } from "@xyo-network/memory-archivist";
|
|
9
|
+
import { ModuleFactory } from "@xyo-network/module";
|
|
10
|
+
import { MemoryNode } from "@xyo-network/node-memory";
|
|
11
|
+
import { MemorySentinel } from "@xyo-network/sentinel";
|
|
12
|
+
var standardCreatableModules = {
|
|
13
|
+
"network.xyo.archivist.config": MemoryArchivist,
|
|
14
|
+
"network.xyo.bridge.http.config": ModuleFactory.withParams(HttpBridge, { config: { schema: HttpBridge.configSchema } }),
|
|
15
|
+
"network.xyo.node.config": MemoryNode,
|
|
16
|
+
"network.xyo.sentinel.config": MemorySentinel
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
// src/ManifestWrapper.ts
|
|
20
|
+
var ManifestWrapper = class extends PayloadWrapper {
|
|
21
|
+
constructor(payload, wallet) {
|
|
22
|
+
super(payload);
|
|
23
|
+
this.wallet = wallet;
|
|
24
|
+
}
|
|
25
|
+
async loadModule(node, manifest, external = true, additionalCreatableModules) {
|
|
26
|
+
const collision = async (node2, name, external2) => {
|
|
27
|
+
const externalConflict = external2 ? (await node2.resolve({ name: [name] }, { direction: external2 ? "all" : "down" })).length !== 0 : false;
|
|
28
|
+
return externalConflict || (await node2.resolve({ name: [name] }, { direction: "down" })).length !== 0;
|
|
29
|
+
};
|
|
30
|
+
const creatableModules = { ...standardCreatableModules, ...additionalCreatableModules };
|
|
31
|
+
if (!await collision(node, manifest.config.name, external)) {
|
|
32
|
+
if (manifest.config.language && manifest.config.language === "javascript") {
|
|
33
|
+
assertEx(
|
|
34
|
+
(manifest.config.name && await node.attach(manifest.config.name, external)) ?? await node.attach((await this.registerModule(node, manifest, creatableModules)).address, external),
|
|
35
|
+
`No module with config schema [${manifest.config.name}] registered`
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
async loadNodeFromIndex(index, additionalCreatableModules) {
|
|
41
|
+
const manifest = assertEx(this.nodeManifest(index), "Failed to find Node Manifest");
|
|
42
|
+
return await this.loadNodeFromManifest(manifest, manifest.config.accountPath ?? `${index}'`, additionalCreatableModules);
|
|
43
|
+
}
|
|
44
|
+
async loadNodeFromManifest(manifest, path, additionalCreatableModules) {
|
|
45
|
+
const node = await MemoryNode2.create({ config: manifest.config, wallet: await this.wallet.derivePath(path) });
|
|
46
|
+
const privateModules = manifest.modules?.private?.map(async (moduleManifest) => {
|
|
47
|
+
await this.loadModule(node, moduleManifest, false, additionalCreatableModules);
|
|
48
|
+
}) ?? [];
|
|
49
|
+
const publicModules = manifest.modules?.public?.map(async (moduleManifest) => {
|
|
50
|
+
await this.loadModule(node, moduleManifest, true, additionalCreatableModules);
|
|
51
|
+
}) ?? [];
|
|
52
|
+
await Promise.all([...privateModules, ...publicModules]);
|
|
53
|
+
return node;
|
|
54
|
+
}
|
|
55
|
+
async loadNodes(node, additionalCreatableModules) {
|
|
56
|
+
const start = Date.now();
|
|
57
|
+
const result = await Promise.all(
|
|
58
|
+
this.payload().nodes?.map(async (nodeManifest, index) => {
|
|
59
|
+
const subNode = await this.loadNodeFromManifest(nodeManifest, nodeManifest.config.accountPath ?? `${index}'`, additionalCreatableModules);
|
|
60
|
+
await node?.register(subNode);
|
|
61
|
+
return subNode;
|
|
62
|
+
})
|
|
63
|
+
);
|
|
64
|
+
console.log(`Loaded nodes from manifest in ${Date.now() - start}ms`);
|
|
65
|
+
return result;
|
|
66
|
+
}
|
|
67
|
+
nodeManifest(index) {
|
|
68
|
+
return this.payload().nodes?.[index];
|
|
69
|
+
}
|
|
70
|
+
async registerModule(node, manifest, creatableModules) {
|
|
71
|
+
const creatableModule = assertEx(
|
|
72
|
+
creatableModules?.[manifest.config.schema],
|
|
73
|
+
`No module with [${manifest.config.schema}] config schema available for registration`
|
|
74
|
+
);
|
|
75
|
+
const module = await creatableModule.create({
|
|
76
|
+
account: manifest.config.accountPath ? await this.wallet.derivePath(manifest.config.accountPath) : this.wallet,
|
|
77
|
+
config: assertEx(manifest.config, "Missing config")
|
|
78
|
+
});
|
|
79
|
+
await node.register(module);
|
|
80
|
+
return module;
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
// src/index.ts
|
|
85
|
+
export * from "@xyo-network/manifest-model";
|
|
86
|
+
export {
|
|
87
|
+
ManifestWrapper,
|
|
88
|
+
standardCreatableModules
|
|
89
|
+
};
|
|
90
|
+
//# sourceMappingURL=index.mjs.map
|