@xyo-network/archivist-cookie 5.1.21 → 5.1.23
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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyo-network/archivist-cookie",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.23",
|
|
4
4
|
"description": "Primary SDK for using XYO Protocol 2.0",
|
|
5
5
|
"homepage": "https://xyo.network",
|
|
6
6
|
"bugs": {
|
|
@@ -30,31 +30,34 @@
|
|
|
30
30
|
"types": "dist/browser/index.d.ts",
|
|
31
31
|
"files": [
|
|
32
32
|
"dist",
|
|
33
|
-
"src"
|
|
33
|
+
"src",
|
|
34
|
+
"!**/*.bench.*",
|
|
35
|
+
"!**/*.spec.*",
|
|
36
|
+
"!**/*.test.*"
|
|
34
37
|
],
|
|
35
38
|
"dependencies": {
|
|
36
|
-
"@xylabs/assert": "~5.0.
|
|
37
|
-
"@xylabs/exists": "~5.0.
|
|
38
|
-
"@xylabs/hex": "~5.0.
|
|
39
|
-
"@xylabs/promise": "~5.0.
|
|
40
|
-
"@xylabs/typeof": "~5.0.
|
|
41
|
-
"@xyo-network/archivist-abstract": "~5.1.
|
|
42
|
-
"@xyo-network/archivist-model": "~5.1.
|
|
43
|
-
"@xyo-network/boundwitness-model": "~5.1.
|
|
44
|
-
"@xyo-network/module-model": "~5.1.
|
|
45
|
-
"@xyo-network/payload-builder": "~5.1.
|
|
46
|
-
"@xyo-network/payload-model": "~5.1.
|
|
39
|
+
"@xylabs/assert": "~5.0.33",
|
|
40
|
+
"@xylabs/exists": "~5.0.33",
|
|
41
|
+
"@xylabs/hex": "~5.0.33",
|
|
42
|
+
"@xylabs/promise": "~5.0.33",
|
|
43
|
+
"@xylabs/typeof": "~5.0.33",
|
|
44
|
+
"@xyo-network/archivist-abstract": "~5.1.23",
|
|
45
|
+
"@xyo-network/archivist-model": "~5.1.23",
|
|
46
|
+
"@xyo-network/boundwitness-model": "~5.1.23",
|
|
47
|
+
"@xyo-network/module-model": "~5.1.23",
|
|
48
|
+
"@xyo-network/payload-builder": "~5.1.23",
|
|
49
|
+
"@xyo-network/payload-model": "~5.1.23",
|
|
47
50
|
"js-cookie": "~3.0.5"
|
|
48
51
|
},
|
|
49
52
|
"devDependencies": {
|
|
50
53
|
"@types/js-cookie": "~3.0.6",
|
|
51
|
-
"@xylabs/delay": "~5.0.
|
|
54
|
+
"@xylabs/delay": "~5.0.33",
|
|
52
55
|
"@xylabs/ts-scripts-yarn3": "~7.2.8",
|
|
53
56
|
"@xylabs/tsconfig": "~7.2.8",
|
|
54
|
-
"@xyo-network/id-payload-plugin": "~5.1.
|
|
55
|
-
"@xyo-network/payload-wrapper": "~5.1.
|
|
57
|
+
"@xyo-network/id-payload-plugin": "~5.1.23",
|
|
58
|
+
"@xyo-network/payload-wrapper": "~5.1.23",
|
|
56
59
|
"typescript": "~5.9.3",
|
|
57
|
-
"vitest": "~4.0.
|
|
60
|
+
"vitest": "~4.0.9"
|
|
58
61
|
},
|
|
59
62
|
"publishConfig": {
|
|
60
63
|
"access": "public"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CookieArchivist.dom.spec.d.ts","sourceRoot":"","sources":["../../../src/spec/CookieArchivist.dom.spec.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @vitest-environment jsdom
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { delay } from '@xylabs/delay'
|
|
6
|
-
import type { Promisable } from '@xylabs/promise'
|
|
7
|
-
import type { ArchivistInstance } from '@xyo-network/archivist-model'
|
|
8
|
-
import { IdSchema } from '@xyo-network/id-payload-plugin'
|
|
9
|
-
import type { Payload } from '@xyo-network/payload-model'
|
|
10
|
-
import { PayloadWrapper } from '@xyo-network/payload-wrapper'
|
|
11
|
-
import { expect, test } from 'vitest'
|
|
12
|
-
|
|
13
|
-
import { CookieArchivist, CookieArchivistConfigSchema } from '../CookieArchivist.ts'
|
|
14
|
-
|
|
15
|
-
const testArchivistRoundTrip = (archivistPromise: Promisable<ArchivistInstance>, name: string) => {
|
|
16
|
-
test(`Archivist RoundTrip [${name}]`, async () => {
|
|
17
|
-
const idPayload: Payload<{ salt: string }> = {
|
|
18
|
-
salt: Date.now().toString(),
|
|
19
|
-
schema: IdSchema,
|
|
20
|
-
}
|
|
21
|
-
const payloadWrapper = PayloadWrapper.wrap(idPayload)
|
|
22
|
-
|
|
23
|
-
const archivist = await archivistPromise
|
|
24
|
-
await archivist.clear?.()
|
|
25
|
-
const insertResult = await archivist.insert([payloadWrapper.payload])
|
|
26
|
-
expect(insertResult).toBeDefined()
|
|
27
|
-
|
|
28
|
-
const getResult = await archivist.get([await payloadWrapper.dataHash()])
|
|
29
|
-
expect(getResult).toBeDefined()
|
|
30
|
-
expect(getResult.length).toBe(1)
|
|
31
|
-
const gottenPayload = getResult[0]
|
|
32
|
-
if (gottenPayload) {
|
|
33
|
-
const gottenPayloadWrapper = PayloadWrapper.wrap(gottenPayload)
|
|
34
|
-
// expect(await gottenPayloadWrapper.hash()).toBe(await payloadWrapper.hash())
|
|
35
|
-
expect(await gottenPayloadWrapper.dataHash()).toBe(await payloadWrapper.dataHash())
|
|
36
|
-
}
|
|
37
|
-
})
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const testArchivistAll = (archivistPromise: Promisable<ArchivistInstance>, name: string) => {
|
|
41
|
-
test(`Archivist All [${name}]`, async () => {
|
|
42
|
-
const archivist = await archivistPromise
|
|
43
|
-
await archivist.clear?.()
|
|
44
|
-
for (let x = 0; x < 10; x++) {
|
|
45
|
-
const idPayload = {
|
|
46
|
-
salt: Date.now().toString(),
|
|
47
|
-
schema: IdSchema,
|
|
48
|
-
}
|
|
49
|
-
await archivist.insert([idPayload])
|
|
50
|
-
await delay(10)
|
|
51
|
-
}
|
|
52
|
-
const getResult = await archivist.all?.()
|
|
53
|
-
expect(getResult).toBeDefined()
|
|
54
|
-
// this is 11 here since we double store all these and every one has the same dataHash
|
|
55
|
-
expect(getResult?.length).toBe(10)
|
|
56
|
-
})
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* @group module
|
|
61
|
-
* @group archivist
|
|
62
|
-
*/
|
|
63
|
-
testArchivistRoundTrip(
|
|
64
|
-
(async () => await CookieArchivist.create({ account: 'random', config: { namespace: 'test', schema: CookieArchivistConfigSchema } }))(),
|
|
65
|
-
'cookie',
|
|
66
|
-
)
|
|
67
|
-
testArchivistAll(
|
|
68
|
-
(async () => await CookieArchivist.create({ account: 'random', config: { namespace: 'test', schema: CookieArchivistConfigSchema } }))(),
|
|
69
|
-
'cookie',
|
|
70
|
-
)
|