@xyo-network/node 2.45.0 → 2.45.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/docs.json +174 -174
- package/package.json +10 -10
- package/src/spec/MemoryNode.spec.ts +22 -25
package/package.json
CHANGED
|
@@ -13,15 +13,15 @@
|
|
|
13
13
|
"@xylabs/assert": "^2.7.1",
|
|
14
14
|
"@xylabs/exists": "^2.7.1",
|
|
15
15
|
"@xylabs/promise": "^2.7.1",
|
|
16
|
-
"@xyo-network/account": "^2.45.
|
|
17
|
-
"@xyo-network/address-payload-plugin": "^2.45.
|
|
18
|
-
"@xyo-network/archivist-wrapper": "^2.45.
|
|
19
|
-
"@xyo-network/module": "^2.45.
|
|
20
|
-
"@xyo-network/module-model": "^2.45.
|
|
21
|
-
"@xyo-network/payload-builder": "^2.45.
|
|
22
|
-
"@xyo-network/payload-model": "^2.45.
|
|
23
|
-
"@xyo-network/payload-wrapper": "^2.45.
|
|
24
|
-
"@xyo-network/promise": "^2.45.
|
|
16
|
+
"@xyo-network/account": "^2.45.1",
|
|
17
|
+
"@xyo-network/address-payload-plugin": "^2.45.1",
|
|
18
|
+
"@xyo-network/archivist-wrapper": "^2.45.1",
|
|
19
|
+
"@xyo-network/module": "^2.45.1",
|
|
20
|
+
"@xyo-network/module-model": "^2.45.1",
|
|
21
|
+
"@xyo-network/payload-builder": "^2.45.1",
|
|
22
|
+
"@xyo-network/payload-model": "^2.45.1",
|
|
23
|
+
"@xyo-network/payload-wrapper": "^2.45.1",
|
|
24
|
+
"@xyo-network/promise": "^2.45.1"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@xylabs/ts-scripts-yarn3": "^2.14.15",
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
},
|
|
62
62
|
"sideEffects": false,
|
|
63
63
|
"types": "dist/types/index.d.ts",
|
|
64
|
-
"version": "2.45.
|
|
64
|
+
"version": "2.45.1"
|
|
65
65
|
}
|
|
@@ -36,10 +36,10 @@ describe('MemoryNode', () => {
|
|
|
36
36
|
config: { archivist: archivist.address, schema: XyoArchivistPayloadDivinerConfigSchema },
|
|
37
37
|
})
|
|
38
38
|
node.register(archivist)
|
|
39
|
-
node.attach(archivist.address)
|
|
39
|
+
await node.attach(archivist.address)
|
|
40
40
|
node.register(diviner)
|
|
41
|
-
node.attach(diviner.address)
|
|
42
|
-
expect(
|
|
41
|
+
await node.attach(diviner.address)
|
|
42
|
+
expect(node.registered().length).toBe(2)
|
|
43
43
|
expect((await node.attached()).length).toBe(2)
|
|
44
44
|
const foundArchivist = (await node.resolve({ address: [archivist.address] })).shift()
|
|
45
45
|
expect(foundArchivist).toBeDefined()
|
|
@@ -145,8 +145,8 @@ describe('MemoryNode', () => {
|
|
|
145
145
|
module = await MemoryArchivist.create()
|
|
146
146
|
node.register(module)
|
|
147
147
|
})
|
|
148
|
-
it('attaches module', () => {
|
|
149
|
-
node.attach(module.address)
|
|
148
|
+
it('attaches module', async () => {
|
|
149
|
+
await node.attach(module.address)
|
|
150
150
|
})
|
|
151
151
|
it('emits event on module attach', (done) => {
|
|
152
152
|
node.on('moduleAttached', (args) => {
|
|
@@ -155,7 +155,7 @@ describe('MemoryNode', () => {
|
|
|
155
155
|
expect(args.module).toBe(module)
|
|
156
156
|
done()
|
|
157
157
|
})
|
|
158
|
-
node.attach(module.address)
|
|
158
|
+
void node.attach(module.address)
|
|
159
159
|
})
|
|
160
160
|
})
|
|
161
161
|
describe('attached', () => {
|
|
@@ -171,11 +171,8 @@ describe('MemoryNode', () => {
|
|
|
171
171
|
})
|
|
172
172
|
})
|
|
173
173
|
describe('with modules attached', () => {
|
|
174
|
-
beforeEach(() => {
|
|
175
|
-
node.attach(module.address)
|
|
176
|
-
})
|
|
177
174
|
it('lists addresses of attached modules', async () => {
|
|
178
|
-
node.attach(module.address)
|
|
175
|
+
await node.attach(module.address)
|
|
179
176
|
const result = await node.attached()
|
|
180
177
|
expect(result).toBeArrayOfSize(1)
|
|
181
178
|
expect(result).toEqual([module.address])
|
|
@@ -187,7 +184,7 @@ describe('MemoryNode', () => {
|
|
|
187
184
|
beforeEach(async () => {
|
|
188
185
|
module = await MemoryArchivist.create()
|
|
189
186
|
node.register(module)
|
|
190
|
-
node.attach(module.address)
|
|
187
|
+
await node.attach(module.address)
|
|
191
188
|
})
|
|
192
189
|
it('deregisters existing module', () => {
|
|
193
190
|
node.detach(module.address)
|
|
@@ -251,9 +248,9 @@ describe('MemoryNode', () => {
|
|
|
251
248
|
await MemoryArchivist.create({ account: testAccount2, config: archivistConfig }),
|
|
252
249
|
await MemoryArchivist.create({ account: testAccount3, config: archivistConfig }),
|
|
253
250
|
])
|
|
254
|
-
modules.map((mod) => {
|
|
251
|
+
modules.map(async (mod) => {
|
|
255
252
|
node.register(mod)
|
|
256
|
-
node.attach(mod.address)
|
|
253
|
+
await node.attach(mod.address)
|
|
257
254
|
})
|
|
258
255
|
})
|
|
259
256
|
it('describes node and child modules', async () => {
|
|
@@ -271,15 +268,15 @@ describe('MemoryNode', () => {
|
|
|
271
268
|
beforeEach(async () => {
|
|
272
269
|
const nestedNode = await MemoryNode.create({ account: testAccount2, config: nodeConfig })
|
|
273
270
|
const nestedModules = await Promise.all([await MemoryArchivist.create({ account: testAccount3, config: archivistConfig })])
|
|
274
|
-
nestedModules.map((mod) => {
|
|
271
|
+
nestedModules.map(async (mod) => {
|
|
275
272
|
nestedNode.register(mod)
|
|
276
|
-
nestedNode.attach(mod.address)
|
|
273
|
+
await nestedNode.attach(mod.address)
|
|
277
274
|
})
|
|
278
275
|
const rootModules: AbstractModule[] = await Promise.all([await MemoryArchivist.create({ account: testAccount4, config: archivistConfig })])
|
|
279
276
|
rootModules.push(nestedNode)
|
|
280
|
-
rootModules.map((mod) => {
|
|
277
|
+
rootModules.map(async (mod) => {
|
|
281
278
|
node.register(mod)
|
|
282
|
-
node.attach(mod.address)
|
|
279
|
+
await node.attach(mod.address)
|
|
283
280
|
})
|
|
284
281
|
})
|
|
285
282
|
it('describes node and all nested nodes and child modules', async () => {
|
|
@@ -322,9 +319,9 @@ describe('MemoryNode', () => {
|
|
|
322
319
|
await MemoryArchivist.create({ account: testAccount2, config: archivistConfig }),
|
|
323
320
|
await MemoryArchivist.create({ account: testAccount3, config: archivistConfig }),
|
|
324
321
|
])
|
|
325
|
-
modules.map((mod) => {
|
|
322
|
+
modules.map(async (mod) => {
|
|
326
323
|
node.register(mod)
|
|
327
|
-
node.attach(mod.address)
|
|
324
|
+
await node.attach(mod.address)
|
|
328
325
|
})
|
|
329
326
|
const description = await node.discover()
|
|
330
327
|
validateDiscoveryResponse(node, description)
|
|
@@ -338,15 +335,15 @@ describe('MemoryNode', () => {
|
|
|
338
335
|
beforeEach(async () => {
|
|
339
336
|
const nestedNode = await MemoryNode.create({ account: testAccount2, config: nodeConfig })
|
|
340
337
|
const nestedModules = await Promise.all([await MemoryArchivist.create({ account: testAccount3, config: archivistConfig })])
|
|
341
|
-
nestedModules.map((mod) => {
|
|
338
|
+
nestedModules.map(async (mod) => {
|
|
342
339
|
nestedNode.register(mod)
|
|
343
|
-
nestedNode.attach(mod.address)
|
|
340
|
+
await nestedNode.attach(mod.address)
|
|
344
341
|
})
|
|
345
342
|
const rootModules: AbstractModule[] = await Promise.all([await MemoryArchivist.create({ account: testAccount4, config: archivistConfig })])
|
|
346
343
|
rootModules.push(nestedNode)
|
|
347
|
-
rootModules.map((mod) => {
|
|
344
|
+
rootModules.map(async (mod) => {
|
|
348
345
|
node.register(mod)
|
|
349
|
-
node.attach(mod.address)
|
|
346
|
+
await node.attach(mod.address)
|
|
350
347
|
})
|
|
351
348
|
})
|
|
352
349
|
it('describes node and all nested nodes and child modules', async () => {
|
|
@@ -361,9 +358,9 @@ describe('MemoryNode', () => {
|
|
|
361
358
|
await MemoryArchivist.create({ account: testAccount2, config: archivistConfig }),
|
|
362
359
|
await MemoryArchivist.create({ account: testAccount3, config: archivistConfig }),
|
|
363
360
|
])
|
|
364
|
-
modules.map((mod) => {
|
|
361
|
+
modules.map(async (mod) => {
|
|
365
362
|
node.register(mod)
|
|
366
|
-
node.attach(mod.address)
|
|
363
|
+
await node.attach(mod.address)
|
|
367
364
|
})
|
|
368
365
|
})
|
|
369
366
|
it('resolves modules wrapped as the specified type', async () => {
|