@xyo-network/archivist 2.37.6 → 2.38.0-rc.10
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/Archivist.d.ts +3 -4
- package/dist/cjs/Archivist.d.ts.map +1 -1
- package/dist/cjs/Queries/Find.d.ts +1 -1
- package/dist/cjs/Queries/Find.d.ts.map +1 -1
- package/dist/cjs/Queries/Find.js.map +1 -1
- package/dist/cjs/XyoArchivist.d.ts +8 -8
- package/dist/cjs/XyoArchivist.d.ts.map +1 -1
- package/dist/cjs/XyoArchivist.js +38 -38
- package/dist/cjs/XyoArchivist.js.map +1 -1
- package/dist/cjs/XyoArchivistWrapper.d.ts +3 -4
- package/dist/cjs/XyoArchivistWrapper.d.ts.map +1 -1
- package/dist/cjs/XyoArchivistWrapper.js +3 -2
- package/dist/cjs/XyoArchivistWrapper.js.map +1 -1
- package/dist/cjs/XyoCookieArchivist.d.ts +2 -4
- package/dist/cjs/XyoCookieArchivist.d.ts.map +1 -1
- package/dist/cjs/XyoCookieArchivist.js +7 -3
- package/dist/cjs/XyoCookieArchivist.js.map +1 -1
- package/dist/cjs/XyoMemoryArchivist.d.ts +6 -7
- package/dist/cjs/XyoMemoryArchivist.d.ts.map +1 -1
- package/dist/cjs/XyoMemoryArchivist.js +9 -5
- package/dist/cjs/XyoMemoryArchivist.js.map +1 -1
- package/dist/cjs/XyoStorageArchivist.d.ts +5 -4
- package/dist/cjs/XyoStorageArchivist.d.ts.map +1 -1
- package/dist/cjs/XyoStorageArchivist.js +24 -7
- package/dist/cjs/XyoStorageArchivist.js.map +1 -1
- package/dist/cjs/index.d.ts +0 -1
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +0 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/docs.json +9715 -9324
- package/dist/esm/Archivist.d.ts +3 -4
- package/dist/esm/Archivist.d.ts.map +1 -1
- package/dist/esm/Queries/Find.d.ts +1 -1
- package/dist/esm/Queries/Find.d.ts.map +1 -1
- package/dist/esm/Queries/Find.js.map +1 -1
- package/dist/esm/XyoArchivist.d.ts +8 -8
- package/dist/esm/XyoArchivist.d.ts.map +1 -1
- package/dist/esm/XyoArchivist.js +39 -39
- package/dist/esm/XyoArchivist.js.map +1 -1
- package/dist/esm/XyoArchivistWrapper.d.ts +3 -4
- package/dist/esm/XyoArchivistWrapper.d.ts.map +1 -1
- package/dist/esm/XyoArchivistWrapper.js +3 -2
- package/dist/esm/XyoArchivistWrapper.js.map +1 -1
- package/dist/esm/XyoCookieArchivist.d.ts +2 -4
- package/dist/esm/XyoCookieArchivist.d.ts.map +1 -1
- package/dist/esm/XyoCookieArchivist.js +5 -3
- package/dist/esm/XyoCookieArchivist.js.map +1 -1
- package/dist/esm/XyoMemoryArchivist.d.ts +6 -7
- package/dist/esm/XyoMemoryArchivist.d.ts.map +1 -1
- package/dist/esm/XyoMemoryArchivist.js +7 -5
- package/dist/esm/XyoMemoryArchivist.js.map +1 -1
- package/dist/esm/XyoStorageArchivist.d.ts +5 -4
- package/dist/esm/XyoStorageArchivist.d.ts.map +1 -1
- package/dist/esm/XyoStorageArchivist.js +16 -6
- package/dist/esm/XyoStorageArchivist.js.map +1 -1
- package/dist/esm/index.d.ts +0 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +0 -1
- package/dist/esm/index.js.map +1 -1
- package/package.json +7 -6
- package/src/Archivist.ts +3 -5
- package/src/Queries/Find.ts +1 -2
- package/src/XyoArchivist.ts +45 -55
- package/src/XyoArchivistWrapper.ts +6 -6
- package/src/XyoCookieArchivist.spec.ts +9 -3
- package/src/XyoCookieArchivist.ts +7 -7
- package/src/XyoMemoryArchivist.ts +12 -10
- package/src/XyoStorageArchivist.spec.ts +58 -20
- package/src/XyoStorageArchivist.ts +20 -9
- package/src/index.ts +0 -1
- package/src/test.spec.test/testArchivist.ts +5 -4
- package/dist/cjs/XyoPayloadFindFilter.d.ts +0 -16
- package/dist/cjs/XyoPayloadFindFilter.d.ts.map +0 -1
- package/dist/cjs/XyoPayloadFindFilter.js +0 -3
- package/dist/cjs/XyoPayloadFindFilter.js.map +0 -1
- package/dist/esm/XyoPayloadFindFilter.d.ts +0 -16
- package/dist/esm/XyoPayloadFindFilter.d.ts.map +0 -1
- package/dist/esm/XyoPayloadFindFilter.js +0 -2
- package/dist/esm/XyoPayloadFindFilter.js.map +0 -1
- package/src/XyoPayloadFindFilter.ts +0 -19
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"XyoStorageArchivist.js","sourceRoot":"","sources":["../../src/XyoStorageArchivist.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAGjD,OAAO,EAAE,cAAc,EAAc,MAAM,sBAAsB,CAAA;AAEjE,OAAO,OAAO,MAAM,gBAAgB,CAAA;AACpC,OAAO,KAAoB,MAAM,QAAQ,CAAA;
|
|
1
|
+
{"version":3,"file":"XyoStorageArchivist.js","sourceRoot":"","sources":["../../src/XyoStorageArchivist.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAGjD,OAAO,EAAE,cAAc,EAAc,MAAM,sBAAsB,CAAA;AAEjE,OAAO,OAAO,MAAM,gBAAgB,CAAA;AACpC,OAAO,KAAoB,MAAM,QAAQ,CAAA;AAGzC,OAAO,EACL,0BAA0B,EAC1B,4BAA4B,EAC5B,6BAA6B,EAC7B,6BAA6B,EAC7B,2BAA2B,EAE3B,6BAA6B,GAC9B,MAAM,WAAW,CAAA;AAClB,OAAO,EAAE,YAAY,EAAsB,MAAM,gBAAgB,CAAA;AAGjE,MAAM,CAAC,MAAM,+BAA+B,GAAoC,6CAA6C,CAAA;AAW7H,MAAM,OAAO,mBAAoB,SAAQ,YAAuC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IAAI,CAAA;YAC5D,CAAC,CAAC,CACH,CAAA;SACF;QAAC,OAAO,EAAE,EAAE;YACX,OAAO,CAAC,KAAK,CAAC,UAAU,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAA;YACtD,MAAM,EAAE,CAAA;SACT;IACH,CAAC;CACF"}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -6,6 +6,5 @@ export * from './XyoArchivist';
|
|
|
6
6
|
export * from './XyoArchivistWrapper';
|
|
7
7
|
export * from './XyoCookieArchivist';
|
|
8
8
|
export * from './XyoMemoryArchivist';
|
|
9
|
-
export * from './XyoPayloadFindFilter';
|
|
10
9
|
export * from './XyoStorageArchivist';
|
|
11
10
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,UAAU,CAAA;AACxB,cAAc,iBAAiB,CAAA;AAC/B,cAAc,WAAW,CAAA;AACzB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,uBAAuB,CAAA;AACrC,cAAc,sBAAsB,CAAA;AACpC,cAAc,sBAAsB,CAAA;AACpC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,UAAU,CAAA;AACxB,cAAc,iBAAiB,CAAA;AAC/B,cAAc,WAAW,CAAA;AACzB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,uBAAuB,CAAA;AACrC,cAAc,sBAAsB,CAAA;AACpC,cAAc,sBAAsB,CAAA;AACpC,cAAc,uBAAuB,CAAA"}
|
package/dist/esm/index.js
CHANGED
|
@@ -6,6 +6,5 @@ export * from './XyoArchivist';
|
|
|
6
6
|
export * from './XyoArchivistWrapper';
|
|
7
7
|
export * from './XyoCookieArchivist';
|
|
8
8
|
export * from './XyoMemoryArchivist';
|
|
9
|
-
export * from './XyoPayloadFindFilter';
|
|
10
9
|
export * from './XyoStorageArchivist';
|
|
11
10
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,UAAU,CAAA;AACxB,cAAc,iBAAiB,CAAA;AAC/B,cAAc,WAAW,CAAA;AACzB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,uBAAuB,CAAA;AACrC,cAAc,sBAAsB,CAAA;AACpC,cAAc,sBAAsB,CAAA;AACpC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,UAAU,CAAA;AACxB,cAAc,iBAAiB,CAAA;AAC/B,cAAc,WAAW,CAAA;AACzB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,uBAAuB,CAAA;AACrC,cAAc,sBAAsB,CAAA;AACpC,cAAc,sBAAsB,CAAA;AACpC,cAAc,uBAAuB,CAAA"}
|
package/package.json
CHANGED
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@xylabs/assert": "^2.6.9",
|
|
13
|
-
"@xyo-network/account": "^2.
|
|
14
|
-
"@xyo-network/boundwitness": "^2.
|
|
15
|
-
"@xyo-network/module": "^2.
|
|
16
|
-
"@xyo-network/payload": "^2.
|
|
17
|
-
"@xyo-network/promise": "^2.
|
|
13
|
+
"@xyo-network/account": "^2.38.0-rc.10",
|
|
14
|
+
"@xyo-network/boundwitness": "^2.38.0-rc.10",
|
|
15
|
+
"@xyo-network/module": "^2.38.0-rc.10",
|
|
16
|
+
"@xyo-network/payload": "^2.38.0-rc.10",
|
|
17
|
+
"@xyo-network/promise": "^2.38.0-rc.10",
|
|
18
18
|
"js-cookie": "^3.0.1",
|
|
19
19
|
"lodash": "^4.17.21",
|
|
20
20
|
"lru-cache": "^7.14.0",
|
|
@@ -58,5 +58,6 @@
|
|
|
58
58
|
},
|
|
59
59
|
"sideEffects": false,
|
|
60
60
|
"types": "dist/esm/index.d.ts",
|
|
61
|
-
"version": "2.
|
|
61
|
+
"version": "2.38.0-rc.10",
|
|
62
|
+
"stableVersion": "2.37.6"
|
|
62
63
|
}
|
package/src/Archivist.ts
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { XyoBoundWitness } from '@xyo-network/boundwitness'
|
|
2
2
|
import { Module } from '@xyo-network/module'
|
|
3
|
-
import { XyoPayload } from '@xyo-network/payload'
|
|
3
|
+
import { XyoPayload, XyoPayloadFindFilter } from '@xyo-network/payload'
|
|
4
4
|
import { NullablePromisableArray, Promisable, PromisableArray } from '@xyo-network/promise'
|
|
5
5
|
|
|
6
|
-
import { XyoPayloadFindFilter } from './XyoPayloadFindFilter'
|
|
7
|
-
|
|
8
6
|
export interface ReadArchivist<TReadResponse, TId = string> {
|
|
9
7
|
get(ids: TId[]): NullablePromisableArray<TReadResponse>
|
|
10
|
-
all?():
|
|
8
|
+
all?(): PromisableArray<TReadResponse>
|
|
11
9
|
}
|
|
12
10
|
|
|
13
11
|
export interface WriteArchivist<TReadResponse, TWriteResponse = TReadResponse, TWrite = TReadResponse, TId = string> {
|
|
@@ -17,7 +15,7 @@ export interface WriteArchivist<TReadResponse, TWriteResponse = TReadResponse, T
|
|
|
17
15
|
}
|
|
18
16
|
|
|
19
17
|
export interface FindArchivist<TReadResponse, TFindResponse = TReadResponse, TFindFilter = unknown> {
|
|
20
|
-
find(filter?: TFindFilter):
|
|
18
|
+
find(filter?: TFindFilter): PromisableArray<TFindResponse>
|
|
21
19
|
}
|
|
22
20
|
|
|
23
21
|
export interface StashArchivist<TWriteResponse> {
|
package/src/Queries/Find.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { XyoQuery } from '@xyo-network/module'
|
|
2
|
-
|
|
3
|
-
import { XyoPayloadFindFilter } from '../XyoPayloadFindFilter'
|
|
2
|
+
import { XyoPayloadFindFilter } from '@xyo-network/payload'
|
|
4
3
|
|
|
5
4
|
export type XyoArchivistFindQuerySchema = 'network.xyo.query.archivist.find'
|
|
6
5
|
export const XyoArchivistFindQuerySchema: XyoArchivistFindQuerySchema = 'network.xyo.query.archivist.find'
|
package/src/XyoArchivist.ts
CHANGED
|
@@ -1,15 +1,8 @@
|
|
|
1
1
|
import { assertEx } from '@xylabs/assert'
|
|
2
2
|
import { XyoAccount } from '@xyo-network/account'
|
|
3
3
|
import { XyoBoundWitness } from '@xyo-network/boundwitness'
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
QueryBoundWitnessWrapper,
|
|
7
|
-
XyoModule,
|
|
8
|
-
XyoModuleInitializeQuerySchema,
|
|
9
|
-
XyoModuleShutdownQuerySchema,
|
|
10
|
-
XyoQueryBoundWitness,
|
|
11
|
-
} from '@xyo-network/module'
|
|
12
|
-
import { PayloadWrapper, XyoPayload } from '@xyo-network/payload'
|
|
4
|
+
import { ModuleQueryResult, QueryBoundWitnessWrapper, XyoErrorBuilder, XyoModule, XyoModuleParams, XyoQueryBoundWitness } from '@xyo-network/module'
|
|
5
|
+
import { PayloadWrapper, XyoPayload, XyoPayloadFindFilter } from '@xyo-network/payload'
|
|
13
6
|
import { NullablePromisableArray, Promisable, PromisableArray } from '@xyo-network/promise'
|
|
14
7
|
import compact from 'lodash/compact'
|
|
15
8
|
|
|
@@ -27,7 +20,6 @@ import {
|
|
|
27
20
|
XyoArchivistQuery,
|
|
28
21
|
} from './Queries'
|
|
29
22
|
import { XyoArchivistWrapper } from './XyoArchivistWrapper'
|
|
30
|
-
import { XyoPayloadFindFilter } from './XyoPayloadFindFilter'
|
|
31
23
|
|
|
32
24
|
export interface XyoArchivistParentWrappers {
|
|
33
25
|
read?: Record<string, XyoArchivistWrapper>
|
|
@@ -35,25 +27,18 @@ export interface XyoArchivistParentWrappers {
|
|
|
35
27
|
commit?: Record<string, XyoArchivistWrapper>
|
|
36
28
|
}
|
|
37
29
|
|
|
38
|
-
export
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
{
|
|
30
|
+
export type XyoArchivistParams<TConfig extends XyoArchivistConfig = XyoArchivistConfig> = XyoModuleParams<TConfig>
|
|
31
|
+
|
|
32
|
+
export abstract class XyoArchivist<TConfig extends XyoArchivistConfig = XyoArchivistConfig> extends XyoModule<TConfig> implements PayloadArchivist {
|
|
42
33
|
public override queries() {
|
|
43
|
-
return [
|
|
44
|
-
XyoModuleInitializeQuerySchema,
|
|
45
|
-
XyoModuleShutdownQuerySchema,
|
|
46
|
-
XyoArchivistGetQuerySchema,
|
|
47
|
-
XyoArchivistInsertQuerySchema,
|
|
48
|
-
...super.queries(),
|
|
49
|
-
]
|
|
34
|
+
return [XyoArchivistGetQuerySchema, XyoArchivistInsertQuerySchema, ...super.queries()]
|
|
50
35
|
}
|
|
51
36
|
|
|
52
|
-
|
|
37
|
+
protected get cacheParentReads() {
|
|
53
38
|
return !!this.config?.cacheParentReads
|
|
54
39
|
}
|
|
55
40
|
|
|
56
|
-
|
|
41
|
+
protected get writeThrough() {
|
|
57
42
|
return !!this.config?.writeThrough
|
|
58
43
|
}
|
|
59
44
|
|
|
@@ -97,37 +82,42 @@ export abstract class XyoArchivist<TConfig extends XyoPayload = XyoPayload>
|
|
|
97
82
|
|
|
98
83
|
const resultPayloads: (XyoPayload | null)[] = []
|
|
99
84
|
const queryAccount = new XyoAccount()
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
85
|
+
try {
|
|
86
|
+
switch (typedQuery.schema) {
|
|
87
|
+
case XyoArchivistAllQuerySchema:
|
|
88
|
+
resultPayloads.push(...(await this.all()))
|
|
89
|
+
break
|
|
90
|
+
case XyoArchivistClearQuerySchema:
|
|
91
|
+
await this.clear()
|
|
92
|
+
break
|
|
93
|
+
case XyoArchivistCommitQuerySchema:
|
|
94
|
+
resultPayloads.push(...(await this.commit()))
|
|
95
|
+
break
|
|
96
|
+
case XyoArchivistDeleteQuerySchema:
|
|
97
|
+
await this.delete(typedQuery.hashes)
|
|
98
|
+
break
|
|
99
|
+
case XyoArchivistFindQuerySchema:
|
|
100
|
+
resultPayloads.push(...(await this.find(typedQuery.filter)))
|
|
101
|
+
break
|
|
102
|
+
case XyoArchivistGetQuerySchema:
|
|
103
|
+
resultPayloads.push(...(await this.get(typedQuery.hashes)))
|
|
104
|
+
break
|
|
105
|
+
case XyoArchivistInsertQuerySchema: {
|
|
106
|
+
const wrappers = payloads?.map((payload) => PayloadWrapper.parse(payload)) ?? []
|
|
107
|
+
assertEx(typedQuery.payloads, `Missing payloads: ${JSON.stringify(typedQuery, null, 2)}`)
|
|
108
|
+
const resolvedWrappers = wrappers.filter((wrapper) => typedQuery.payloads.includes(wrapper.hash))
|
|
109
|
+
assertEx(resolvedWrappers.length === typedQuery.payloads.length, 'Could not find some passed hashes')
|
|
110
|
+
resultPayloads.push(...(await this.insert(resolvedWrappers.map((wrapper) => wrapper.payload))))
|
|
111
|
+
break
|
|
112
|
+
}
|
|
113
|
+
default:
|
|
114
|
+
return super.query(query, payloads)
|
|
126
115
|
}
|
|
127
|
-
|
|
128
|
-
|
|
116
|
+
} catch (ex) {
|
|
117
|
+
const error = ex as Error
|
|
118
|
+
resultPayloads.push(new XyoErrorBuilder(wrapper.hash, error.message).build())
|
|
129
119
|
}
|
|
130
|
-
this.log
|
|
120
|
+
this.logger?.log(wrapper.schemaName, 'query')
|
|
131
121
|
return this.bindResult(resultPayloads, queryAccount)
|
|
132
122
|
}
|
|
133
123
|
|
|
@@ -136,7 +126,7 @@ export abstract class XyoArchivist<TConfig extends XyoPayload = XyoPayload>
|
|
|
136
126
|
if (archivists) {
|
|
137
127
|
archivists.map((archivist) => {
|
|
138
128
|
if (resolvedWrappers[archivist] === undefined) {
|
|
139
|
-
const module = this.resolver?.(archivist)
|
|
129
|
+
const module = this.resolver?.fromAddress([archivist]).shift()
|
|
140
130
|
if (module) {
|
|
141
131
|
resolvedWrappers[archivist] = new XyoArchivistWrapper(module)
|
|
142
132
|
}
|
|
@@ -170,7 +160,7 @@ export abstract class XyoArchivist<TConfig extends XyoPayload = XyoPayload>
|
|
|
170
160
|
}
|
|
171
161
|
|
|
172
162
|
protected async writeToParents(payloads: XyoPayload[]): Promise<XyoBoundWitness[]> {
|
|
173
|
-
this.log
|
|
163
|
+
this.logger?.log(this.parents?.write?.length ?? 0, 'writeToParents')
|
|
174
164
|
return compact(
|
|
175
165
|
await Promise.all(
|
|
176
166
|
Object.values(this.parents?.write ?? {}).map(async (parent) => {
|
|
@@ -181,7 +171,7 @@ export abstract class XyoArchivist<TConfig extends XyoPayload = XyoPayload>
|
|
|
181
171
|
}
|
|
182
172
|
|
|
183
173
|
private _parents?: XyoArchivistParentWrappers
|
|
184
|
-
get parents() {
|
|
174
|
+
protected get parents() {
|
|
185
175
|
this._parents = this._parents ?? {
|
|
186
176
|
commit: this.resolveArchivists(this.config?.parents?.commit),
|
|
187
177
|
read: this.resolveArchivists(this.config?.parents?.read),
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { XyoBoundWitness, XyoBoundWitnessSchema } from '@xyo-network/boundwitness'
|
|
2
2
|
import { XyoModuleWrapper } from '@xyo-network/module'
|
|
3
|
-
import { PayloadWrapper, XyoPayload } from '@xyo-network/payload'
|
|
3
|
+
import { PayloadWrapper, XyoPayload, XyoPayloadFindFilter } from '@xyo-network/payload'
|
|
4
|
+
import compact from 'lodash/compact'
|
|
4
5
|
|
|
5
6
|
import { PayloadArchivist } from './Archivist'
|
|
6
7
|
import {
|
|
@@ -19,7 +20,6 @@ import {
|
|
|
19
20
|
XyoArchivistInsertQuery,
|
|
20
21
|
XyoArchivistInsertQuerySchema,
|
|
21
22
|
} from './Queries'
|
|
22
|
-
import { XyoPayloadFindFilter } from './XyoPayloadFindFilter'
|
|
23
23
|
|
|
24
24
|
export class XyoArchivistWrapper extends XyoModuleWrapper implements PayloadArchivist {
|
|
25
25
|
public async delete(hashes: string[]) {
|
|
@@ -53,16 +53,16 @@ export class XyoArchivistWrapper extends XyoModuleWrapper implements PayloadArch
|
|
|
53
53
|
return [result[0], ...innerBoundWitnesses]
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
public async find(filter?: XyoPayloadFindFilter): Promise<
|
|
56
|
+
public async find(filter?: XyoPayloadFindFilter): Promise<XyoPayload[]> {
|
|
57
57
|
const queryPayload = PayloadWrapper.parse<XyoArchivistFindQuery>({ filter, schema: XyoArchivistFindQuerySchema })
|
|
58
58
|
const query = await this.bindQuery(queryPayload)
|
|
59
|
-
return (await this.module.query(query[0], [queryPayload.payload]))[1]
|
|
59
|
+
return compact((await this.module.query(query[0], [queryPayload.payload]))[1])
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
public async all(): Promise<
|
|
62
|
+
public async all(): Promise<XyoPayload[]> {
|
|
63
63
|
const queryPayload = PayloadWrapper.parse<XyoArchivistAllQuery>({ schema: XyoArchivistAllQuerySchema })
|
|
64
64
|
const query = await this.bindQuery(queryPayload)
|
|
65
|
-
return (await this.module.query(query[0], query[1]))[1]
|
|
65
|
+
return compact((await this.module.query(query[0], query[1]))[1])
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
public async commit(): Promise<XyoBoundWitness[]> {
|
|
@@ -3,7 +3,13 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import { testArchivistAll, testArchivistRoundTrip } from './test.spec.test'
|
|
6
|
-
import { XyoCookieArchivist } from './XyoCookieArchivist'
|
|
6
|
+
import { XyoCookieArchivist, XyoCookieArchivistConfig, XyoCookieArchivistConfigSchema } from './XyoCookieArchivist'
|
|
7
7
|
|
|
8
|
-
testArchivistRoundTrip(
|
|
9
|
-
|
|
8
|
+
testArchivistRoundTrip(
|
|
9
|
+
XyoCookieArchivist.create({ config: { namespace: 'test', schema: XyoCookieArchivistConfigSchema } as XyoCookieArchivistConfig }),
|
|
10
|
+
'cookie',
|
|
11
|
+
)
|
|
12
|
+
testArchivistAll(
|
|
13
|
+
XyoCookieArchivist.create({ config: { namespace: 'test', schema: XyoCookieArchivistConfigSchema } as XyoCookieArchivistConfig }),
|
|
14
|
+
'cookie',
|
|
15
|
+
)
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import { assertEx } from '@xylabs/assert'
|
|
2
|
-
import { XyoAccount } from '@xyo-network/account'
|
|
3
2
|
import { XyoBoundWitness } from '@xyo-network/boundwitness'
|
|
4
|
-
import {
|
|
3
|
+
import { XyoModuleParams } from '@xyo-network/module'
|
|
5
4
|
import { PayloadWrapper, XyoPayload } from '@xyo-network/payload'
|
|
6
5
|
import { PromisableArray } from '@xyo-network/promise'
|
|
7
6
|
import Cookies from 'js-cookie'
|
|
8
7
|
import compact from 'lodash/compact'
|
|
9
8
|
|
|
10
9
|
import { XyoArchivistConfig } from './Config'
|
|
11
|
-
import { PartialArchivistConfig } from './PartialConfig'
|
|
12
10
|
import {
|
|
13
11
|
XyoArchivistAllQuerySchema,
|
|
14
12
|
XyoArchivistClearQuerySchema,
|
|
@@ -32,6 +30,12 @@ export type XyoCookieArchivistConfig = XyoArchivistConfig<{
|
|
|
32
30
|
}>
|
|
33
31
|
|
|
34
32
|
export class XyoCookieArchivist extends XyoArchivist<XyoCookieArchivistConfig> {
|
|
33
|
+
static override async create(params?: XyoModuleParams): Promise<XyoCookieArchivist> {
|
|
34
|
+
const module = new XyoCookieArchivist(params as XyoModuleParams<XyoCookieArchivistConfig>)
|
|
35
|
+
await module.start()
|
|
36
|
+
return module
|
|
37
|
+
}
|
|
38
|
+
|
|
35
39
|
public get domain() {
|
|
36
40
|
return this.config?.domain
|
|
37
41
|
}
|
|
@@ -61,10 +65,6 @@ export class XyoCookieArchivist extends XyoArchivist<XyoCookieArchivistConfig> {
|
|
|
61
65
|
]
|
|
62
66
|
}
|
|
63
67
|
|
|
64
|
-
constructor(config?: PartialArchivistConfig<XyoCookieArchivistConfig>, account?: XyoAccount, resolver?: XyoModuleResolverFunc) {
|
|
65
|
-
super({ ...config, schema: XyoCookieArchivistConfigSchema }, account, resolver)
|
|
66
|
-
}
|
|
67
|
-
|
|
68
68
|
private keyFromHash(hash: string) {
|
|
69
69
|
return `${this.namespace}-${hash}`
|
|
70
70
|
}
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import { assertEx } from '@xylabs/assert'
|
|
2
|
-
import { XyoAccount } from '@xyo-network/account'
|
|
3
2
|
import { XyoBoundWitness } from '@xyo-network/boundwitness'
|
|
4
|
-
import {
|
|
3
|
+
import { XyoModuleParams } from '@xyo-network/module'
|
|
5
4
|
import { PayloadWrapper, XyoPayload } from '@xyo-network/payload'
|
|
6
5
|
import { PromisableArray } from '@xyo-network/promise'
|
|
7
6
|
import compact from 'lodash/compact'
|
|
8
7
|
import LruCache from 'lru-cache'
|
|
9
8
|
|
|
10
9
|
import { XyoArchivistConfig } from './Config'
|
|
11
|
-
import { PartialArchivistConfig } from './PartialConfig'
|
|
12
10
|
import {
|
|
13
11
|
XyoArchivistAllQuerySchema,
|
|
14
12
|
XyoArchivistClearQuerySchema,
|
|
@@ -18,7 +16,7 @@ import {
|
|
|
18
16
|
XyoArchivistInsertQuery,
|
|
19
17
|
XyoArchivistInsertQuerySchema,
|
|
20
18
|
} from './Queries'
|
|
21
|
-
import { XyoArchivist } from './XyoArchivist'
|
|
19
|
+
import { XyoArchivist, XyoArchivistParams } from './XyoArchivist'
|
|
22
20
|
|
|
23
21
|
export type XyoMemoryArchivistConfigSchema = 'network.xyo.module.config.archivist.memory'
|
|
24
22
|
export const XyoMemoryArchivistConfigSchema: XyoMemoryArchivistConfigSchema = 'network.xyo.module.config.archivist.memory'
|
|
@@ -28,15 +26,19 @@ export type XyoMemoryArchivistConfig = XyoArchivistConfig<{
|
|
|
28
26
|
max?: number
|
|
29
27
|
}>
|
|
30
28
|
|
|
31
|
-
export
|
|
32
|
-
static create(config?: XyoMemoryArchivistConfig) {
|
|
33
|
-
return new XyoMemoryArchivist(config)
|
|
34
|
-
}
|
|
29
|
+
export type XyoMemoryArchivistParams<TConfig extends XyoMemoryArchivistConfig = XyoMemoryArchivistConfig> = XyoArchivistParams<TConfig>
|
|
35
30
|
|
|
31
|
+
export class XyoMemoryArchivist<TConfig extends XyoMemoryArchivistConfig = XyoMemoryArchivistConfig> extends XyoArchivist<TConfig> {
|
|
36
32
|
public get max() {
|
|
37
33
|
return this.config?.max ?? 10000
|
|
38
34
|
}
|
|
39
35
|
|
|
36
|
+
static override async create(params?: XyoModuleParams): Promise<XyoMemoryArchivist> {
|
|
37
|
+
const module: XyoMemoryArchivist = new XyoMemoryArchivist(params as XyoMemoryArchivistParams)
|
|
38
|
+
await module.start()
|
|
39
|
+
return module
|
|
40
|
+
}
|
|
41
|
+
|
|
40
42
|
private cache: LruCache<string, XyoPayload>
|
|
41
43
|
|
|
42
44
|
public override queries() {
|
|
@@ -50,8 +52,8 @@ export class XyoMemoryArchivist extends XyoArchivist<XyoMemoryArchivistConfig> {
|
|
|
50
52
|
]
|
|
51
53
|
}
|
|
52
54
|
|
|
53
|
-
constructor(
|
|
54
|
-
super(
|
|
55
|
+
protected constructor(params?: XyoMemoryArchivistParams<TConfig>) {
|
|
56
|
+
super(params)
|
|
55
57
|
this.cache = new LruCache<string, XyoPayload>({ max: this.max })
|
|
56
58
|
}
|
|
57
59
|
|
|
@@ -2,39 +2,77 @@
|
|
|
2
2
|
* @jest-environment jsdom
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
+
import { XyoModuleResolver } from '@xyo-network/module'
|
|
5
6
|
import { PayloadWrapper } from '@xyo-network/payload'
|
|
6
7
|
|
|
7
8
|
import { testArchivistAll, testArchivistRoundTrip } from './test.spec.test'
|
|
8
9
|
import { XyoMemoryArchivist } from './XyoMemoryArchivist'
|
|
9
|
-
import { XyoStorageArchivist } from './XyoStorageArchivist'
|
|
10
|
+
import { XyoStorageArchivist, XyoStorageArchivistConfig, XyoStorageArchivistConfigSchema } from './XyoStorageArchivist'
|
|
10
11
|
|
|
11
|
-
testArchivistRoundTrip(
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
testArchivistRoundTrip(
|
|
13
|
+
XyoStorageArchivist.create({ config: { namespace: 'test', schema: XyoStorageArchivistConfigSchema, type: 'local' } as XyoStorageArchivistConfig }),
|
|
14
|
+
'local',
|
|
15
|
+
)
|
|
16
|
+
testArchivistRoundTrip(
|
|
17
|
+
XyoStorageArchivist.create({
|
|
18
|
+
config: { namespace: 'test', schema: XyoStorageArchivistConfigSchema, type: 'session' } as XyoStorageArchivistConfig,
|
|
19
|
+
}),
|
|
20
|
+
'session',
|
|
21
|
+
)
|
|
22
|
+
testArchivistRoundTrip(
|
|
23
|
+
XyoStorageArchivist.create({
|
|
24
|
+
config: { namespace: 'test', schema: XyoStorageArchivistConfigSchema, type: 'page' } as XyoStorageArchivistConfig,
|
|
25
|
+
}),
|
|
26
|
+
'page',
|
|
27
|
+
)
|
|
14
28
|
|
|
15
|
-
testArchivistAll(
|
|
16
|
-
|
|
17
|
-
|
|
29
|
+
testArchivistAll(
|
|
30
|
+
XyoStorageArchivist.create({
|
|
31
|
+
config: { namespace: 'test', schema: XyoStorageArchivistConfigSchema, type: 'local' } as XyoStorageArchivistConfig,
|
|
32
|
+
}),
|
|
33
|
+
'local',
|
|
34
|
+
)
|
|
35
|
+
testArchivistAll(
|
|
36
|
+
XyoStorageArchivist.create({
|
|
37
|
+
config: { namespace: 'test', schema: XyoStorageArchivistConfigSchema, type: 'session' } as XyoStorageArchivistConfig,
|
|
38
|
+
}),
|
|
39
|
+
'session',
|
|
40
|
+
)
|
|
41
|
+
testArchivistAll(
|
|
42
|
+
XyoStorageArchivist.create({
|
|
43
|
+
config: { namespace: 'test', schema: XyoStorageArchivistConfigSchema, type: 'page' } as XyoStorageArchivistConfig,
|
|
44
|
+
}),
|
|
45
|
+
'page',
|
|
46
|
+
)
|
|
18
47
|
|
|
19
|
-
test('XyoArchivist Private Key Save', () => {
|
|
20
|
-
const storage =
|
|
48
|
+
test('XyoArchivist Private Key Save', async () => {
|
|
49
|
+
const storage = await XyoStorageArchivist.create({
|
|
50
|
+
config: { namespace: 'test', persistAccount: true, schema: XyoStorageArchivistConfigSchema, type: 'local' } as XyoStorageArchivistConfig,
|
|
51
|
+
logger: console,
|
|
52
|
+
})
|
|
21
53
|
const address = storage.address
|
|
22
|
-
const storage2 =
|
|
54
|
+
const storage2 = await XyoStorageArchivist.create({
|
|
55
|
+
config: { namespace: 'test', persistAccount: true, schema: XyoStorageArchivistConfigSchema, type: 'local' } as XyoStorageArchivistConfig,
|
|
56
|
+
logger: console,
|
|
57
|
+
})
|
|
23
58
|
expect(storage2.address).toBe(address)
|
|
24
59
|
})
|
|
25
60
|
|
|
26
61
|
test('XyoArchivist Parent Write Through', async () => {
|
|
27
|
-
const memory =
|
|
62
|
+
const memory = await XyoMemoryArchivist.create()
|
|
28
63
|
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
64
|
+
const storage = await XyoStorageArchivist.create({
|
|
65
|
+
config: {
|
|
66
|
+
namespace: 'test',
|
|
67
|
+
parents: { write: [memory.address] },
|
|
68
|
+
persistAccount: true,
|
|
69
|
+
schema: XyoStorageArchivistConfigSchema,
|
|
70
|
+
type: 'local',
|
|
71
|
+
} as XyoStorageArchivistConfig,
|
|
72
|
+
logger: console,
|
|
73
|
+
resolver: new XyoModuleResolver().add(memory),
|
|
74
|
+
})
|
|
75
|
+
await storage.start()
|
|
38
76
|
|
|
39
77
|
const wrapper = new PayloadWrapper({ schema: 'network.xyo.test' })
|
|
40
78
|
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { assertEx } from '@xylabs/assert'
|
|
2
2
|
import { XyoAccount } from '@xyo-network/account'
|
|
3
3
|
import { XyoBoundWitness } from '@xyo-network/boundwitness'
|
|
4
|
-
import {
|
|
4
|
+
import { XyoModuleParams } from '@xyo-network/module'
|
|
5
5
|
import { PayloadWrapper, XyoPayload } from '@xyo-network/payload'
|
|
6
6
|
import { PromisableArray } from '@xyo-network/promise'
|
|
7
7
|
import compact from 'lodash/compact'
|
|
8
8
|
import store, { StoreBase } from 'store2'
|
|
9
9
|
|
|
10
10
|
import { XyoArchivistConfig } from './Config'
|
|
11
|
-
import { PartialArchivistConfig } from './PartialConfig'
|
|
12
11
|
import {
|
|
13
12
|
XyoArchivistAllQuerySchema,
|
|
14
13
|
XyoArchivistClearQuerySchema,
|
|
@@ -18,7 +17,7 @@ import {
|
|
|
18
17
|
XyoArchivistInsertQuery,
|
|
19
18
|
XyoArchivistInsertQuerySchema,
|
|
20
19
|
} from './Queries'
|
|
21
|
-
import { XyoArchivist } from './XyoArchivist'
|
|
20
|
+
import { XyoArchivist, XyoArchivistParams } from './XyoArchivist'
|
|
22
21
|
|
|
23
22
|
export type XyoStorageArchivistConfigSchema = 'network.xyo.module.config.archivist.storage'
|
|
24
23
|
export const XyoStorageArchivistConfigSchema: XyoStorageArchivistConfigSchema = 'network.xyo.module.config.archivist.storage'
|
|
@@ -33,6 +32,12 @@ export type XyoStorageArchivistConfig = XyoArchivistConfig<{
|
|
|
33
32
|
}>
|
|
34
33
|
|
|
35
34
|
export class XyoStorageArchivist extends XyoArchivist<XyoStorageArchivistConfig> {
|
|
35
|
+
static override async create(params?: XyoModuleParams): Promise<XyoStorageArchivist> {
|
|
36
|
+
const module = new XyoStorageArchivist(params as XyoModuleParams<XyoStorageArchivistConfig>)
|
|
37
|
+
await module.start()
|
|
38
|
+
return module
|
|
39
|
+
}
|
|
40
|
+
|
|
36
41
|
public get type() {
|
|
37
42
|
return this.config?.type ?? 'local'
|
|
38
43
|
}
|
|
@@ -78,9 +83,15 @@ export class XyoStorageArchivist extends XyoArchivist<XyoStorageArchivistConfig>
|
|
|
78
83
|
return this._privateStorage
|
|
79
84
|
}
|
|
80
85
|
|
|
81
|
-
constructor(
|
|
82
|
-
super(
|
|
86
|
+
constructor(params?: XyoArchivistParams<XyoStorageArchivistConfig>) {
|
|
87
|
+
super(params)
|
|
88
|
+
this.loadAccount()
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
override async start() {
|
|
92
|
+
await super.start()
|
|
83
93
|
this.saveAccount()
|
|
94
|
+
return this
|
|
84
95
|
}
|
|
85
96
|
|
|
86
97
|
protected override loadAccount() {
|
|
@@ -89,10 +100,10 @@ export class XyoStorageArchivist extends XyoArchivist<XyoStorageArchivistConfig>
|
|
|
89
100
|
if (privateKey) {
|
|
90
101
|
try {
|
|
91
102
|
const account = new XyoAccount({ privateKey })
|
|
92
|
-
this.log
|
|
103
|
+
this.logger?.log(account.addressValue.hex, 'loadAccount')
|
|
93
104
|
return account
|
|
94
|
-
} catch {
|
|
95
|
-
console.error(`Error reading Account from storage [${this.type}] - Recreating Account`)
|
|
105
|
+
} catch (ex) {
|
|
106
|
+
console.error(`Error reading Account from storage [${this.type}, ${ex}] - Recreating Account`)
|
|
96
107
|
this.privateStorage.remove('privateKey')
|
|
97
108
|
}
|
|
98
109
|
}
|
|
@@ -102,7 +113,7 @@ export class XyoStorageArchivist extends XyoArchivist<XyoStorageArchivistConfig>
|
|
|
102
113
|
|
|
103
114
|
protected saveAccount() {
|
|
104
115
|
if (this.persistAccount) {
|
|
105
|
-
this.log
|
|
116
|
+
this.logger?.log(this.account.addressValue.hex, 'saveAccount')
|
|
106
117
|
this.privateStorage.set('privateKey', this.account.private.hex)
|
|
107
118
|
}
|
|
108
119
|
}
|