@xyo-network/react-archivist 2.65.4 → 2.65.5
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/package.json
CHANGED
|
@@ -13,13 +13,13 @@
|
|
|
13
13
|
"@xylabs/react-button": "^3.0.21",
|
|
14
14
|
"@xylabs/react-flexbox": "^3.0.21",
|
|
15
15
|
"@xylabs/react-promise": "^3.0.21",
|
|
16
|
-
"@xyo-network/archivist-model": "^2.77.
|
|
17
|
-
"@xyo-network/boundwitness-model": "^2.77.
|
|
18
|
-
"@xyo-network/boundwitness-wrapper": "^2.77.
|
|
19
|
-
"@xyo-network/module-model": "^2.77.
|
|
20
|
-
"@xyo-network/react-module": "~2.65.
|
|
21
|
-
"@xyo-network/react-node": "~2.65.
|
|
22
|
-
"@xyo-network/react-wallet": "~2.65.
|
|
16
|
+
"@xyo-network/archivist-model": "^2.77.19",
|
|
17
|
+
"@xyo-network/boundwitness-model": "^2.77.19",
|
|
18
|
+
"@xyo-network/boundwitness-wrapper": "^2.77.19",
|
|
19
|
+
"@xyo-network/module-model": "^2.77.19",
|
|
20
|
+
"@xyo-network/react-module": "~2.65.5",
|
|
21
|
+
"@xyo-network/react-node": "~2.65.5",
|
|
22
|
+
"@xyo-network/react-wallet": "~2.65.5",
|
|
23
23
|
"react-icons": "^4.11.0"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
@@ -31,16 +31,17 @@
|
|
|
31
31
|
},
|
|
32
32
|
"description": "Common React library for all XYO projects that use React",
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@storybook/react": "^7.5.
|
|
34
|
+
"@storybook/react": "^7.5.2",
|
|
35
35
|
"@xylabs/react-async-effect": "^3.0.21",
|
|
36
36
|
"@xylabs/ts-scripts-yarn3": "^3.1.13",
|
|
37
37
|
"@xylabs/tsconfig-react": "^3.1.13",
|
|
38
|
-
"@xyo-network/account": "^2.77.
|
|
39
|
-
"@xyo-network/archivist": "^2.77.
|
|
40
|
-
"@xyo-network/boundwitness-builder": "^2.77.
|
|
41
|
-
"@xyo-network/module": "^2.77.
|
|
42
|
-
"@xyo-network/
|
|
43
|
-
"@xyo-network/
|
|
38
|
+
"@xyo-network/account": "^2.77.19",
|
|
39
|
+
"@xyo-network/archivist": "^2.77.19",
|
|
40
|
+
"@xyo-network/boundwitness-builder": "^2.77.19",
|
|
41
|
+
"@xyo-network/module": "^2.77.19",
|
|
42
|
+
"@xyo-network/node-memory": "^2.77.19",
|
|
43
|
+
"@xyo-network/payload-model": "^2.77.19",
|
|
44
|
+
"@xyo-network/react-storybook": "~2.65.5",
|
|
44
45
|
"typescript": "^5.2.2"
|
|
45
46
|
},
|
|
46
47
|
"docs": "dist/docs.json",
|
|
@@ -93,6 +94,6 @@
|
|
|
93
94
|
},
|
|
94
95
|
"sideEffects": false,
|
|
95
96
|
"types": "dist/browser/index.d.ts",
|
|
96
|
-
"version": "2.65.
|
|
97
|
+
"version": "2.65.5",
|
|
97
98
|
"type": "module"
|
|
98
99
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Button } from '@mui/material'
|
|
2
2
|
import { Meta, StoryFn } from '@storybook/react'
|
|
3
|
-
import { useAsyncEffect } from '@xylabs/react-async-effect'
|
|
4
3
|
import { FlexCol } from '@xylabs/react-flexbox'
|
|
4
|
+
import { usePromise } from '@xylabs/react-promise'
|
|
5
5
|
import { Account } from '@xyo-network/account'
|
|
6
6
|
import { ArchivistInsertQuerySchema, ArchivistInstance, MemoryArchivist, MemoryArchivistConfigSchema } from '@xyo-network/archivist'
|
|
7
7
|
import { QueryBoundWitnessBuilder } from '@xyo-network/boundwitness-builder'
|
|
8
|
-
import {
|
|
8
|
+
import { MemoryNode } from '@xyo-network/node-memory'
|
|
9
9
|
|
|
10
10
|
import { ArchivistCard } from './Card'
|
|
11
11
|
|
|
@@ -23,8 +23,8 @@ const insertPayload = async (archivist?: ArchivistInstance) => {
|
|
|
23
23
|
if (archivist) {
|
|
24
24
|
const payload = { schema: 'network.xyo.payload', timestamp: Date.now() }
|
|
25
25
|
const insertQuery = { schema: ArchivistInsertQuerySchema }
|
|
26
|
-
const account =
|
|
27
|
-
const builder = new QueryBoundWitnessBuilder(
|
|
26
|
+
const account = Account.randomSync()
|
|
27
|
+
const builder = new QueryBoundWitnessBuilder().payloads([insertQuery, payload]).witness(account).query(insertQuery)
|
|
28
28
|
const [insertQueryBoundWitness, payloads] = await builder.build()
|
|
29
29
|
await archivist.insert([insertQueryBoundWitness, ...payloads])
|
|
30
30
|
}
|
|
@@ -35,28 +35,30 @@ const clearArchivist = async (archivist?: ArchivistInstance) => {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
const Template: StoryFn<typeof ArchivistCard> = () => {
|
|
38
|
-
const [
|
|
38
|
+
const [node] = usePromise(async () => {
|
|
39
|
+
return await MemoryNode.create()
|
|
40
|
+
}, [])
|
|
39
41
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
)
|
|
42
|
+
const [module] = usePromise(async () => {
|
|
43
|
+
if (node) {
|
|
44
|
+
const newParentModule = await MemoryArchivist.create()
|
|
45
|
+
await node?.register(newParentModule)
|
|
46
|
+
await node?.attach(newParentModule.address)
|
|
47
|
+
|
|
48
|
+
const newModule = await MemoryArchivist.create({
|
|
49
|
+
config: {
|
|
50
|
+
name: 'MemoryArchivist',
|
|
51
|
+
parents: { commit: [newParentModule.address], read: [newParentModule.address], write: [newParentModule.address] },
|
|
52
|
+
schema: MemoryArchivistConfigSchema,
|
|
53
|
+
},
|
|
54
|
+
})
|
|
55
|
+
await node?.register(newModule)
|
|
56
|
+
await node?.attach(newModule.address)
|
|
57
|
+
|
|
58
|
+
await insertPayload(newModule)
|
|
59
|
+
return newModule
|
|
60
|
+
}
|
|
61
|
+
}, [node])
|
|
60
62
|
|
|
61
63
|
return (
|
|
62
64
|
<FlexCol gap={2}>
|
|
@@ -3,6 +3,7 @@ import { useAsyncEffect } from '@xylabs/react-async-effect'
|
|
|
3
3
|
import { Account } from '@xyo-network/account'
|
|
4
4
|
import { ArchivistInsertQuerySchema, ArchivistInstance, MemoryArchivist, MemoryArchivistConfigSchema } from '@xyo-network/archivist'
|
|
5
5
|
import { QueryBoundWitnessBuilder } from '@xyo-network/boundwitness-builder'
|
|
6
|
+
import { MemoryNode } from '@xyo-network/node-memory'
|
|
6
7
|
import { useState } from 'react'
|
|
7
8
|
|
|
8
9
|
import { MemoryArchivistsStats } from './MemoryArchivistStats'
|
|
@@ -22,8 +23,9 @@ const Template: StoryFn<typeof MemoryArchivistsStats> = () => {
|
|
|
22
23
|
|
|
23
24
|
useAsyncEffect(
|
|
24
25
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
25
|
-
async (
|
|
26
|
+
async () => {
|
|
26
27
|
if (!module) {
|
|
28
|
+
const node = await MemoryNode.create()
|
|
27
29
|
const newParentModule = await MemoryArchivist.create()
|
|
28
30
|
const newModule = await MemoryArchivist.create({
|
|
29
31
|
config: {
|
|
@@ -34,13 +36,15 @@ const Template: StoryFn<typeof MemoryArchivistsStats> = () => {
|
|
|
34
36
|
})
|
|
35
37
|
const payload = { schema: 'network.xyo.payload' }
|
|
36
38
|
const insertQuery = { schema: ArchivistInsertQuerySchema }
|
|
37
|
-
const account =
|
|
38
|
-
const builder = new QueryBoundWitnessBuilder(
|
|
39
|
+
const account = Account.randomSync()
|
|
40
|
+
const builder = new QueryBoundWitnessBuilder().payloads([insertQuery, payload]).witness(account).query(insertQuery)
|
|
39
41
|
const [insertQueryBoundWitness, payloads] = await builder.build()
|
|
42
|
+
await node.register(newParentModule)
|
|
43
|
+
await node.attach(newParentModule.address)
|
|
44
|
+
await node.register(newModule)
|
|
45
|
+
await node.attach(newModule.address)
|
|
40
46
|
await newModule.insert([insertQueryBoundWitness, ...payloads])
|
|
41
|
-
|
|
42
|
-
setModule(newModule)
|
|
43
|
-
}
|
|
47
|
+
setModule(newModule)
|
|
44
48
|
}
|
|
45
49
|
},
|
|
46
50
|
[module],
|