@xyo-network/filesystem-archivist 5.3.20 → 5.3.24

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/filesystem-archivist",
3
- "version": "5.3.20",
3
+ "version": "5.3.24",
4
4
  "description": "Primary SDK for using XYO Protocol 2.0",
5
5
  "homepage": "https://xyo.network",
6
6
  "bugs": {
@@ -31,37 +31,52 @@
31
31
  "types": "dist/node/index.d.ts",
32
32
  "files": [
33
33
  "dist",
34
- "src",
35
34
  "!**/*.bench.*",
36
35
  "!**/*.spec.*",
37
- "!**/*.test.*"
36
+ "!**/*.test.*",
37
+ "README.md"
38
38
  ],
39
39
  "dependencies": {
40
- "@xyo-network/archivist-abstract": "~5.3.20",
41
- "@xyo-network/archivist-memory": "~5.3.20",
42
- "@xyo-network/archivist-model": "~5.3.20",
43
- "@xyo-network/boundwitness-model": "~5.3.20",
44
- "@xyo-network/module-model": "~5.3.20",
45
- "@xyo-network/payload-model": "~5.3.20",
46
- "@xyo-network/wallet": "~5.3.20"
40
+ "@xyo-network/archivist-abstract": "~5.3.24",
41
+ "@xyo-network/archivist-memory": "~5.3.24",
42
+ "@xyo-network/archivist-model": "~5.3.24",
43
+ "@xyo-network/boundwitness-model": "~5.3.24",
44
+ "@xyo-network/payload-model": "~5.3.24",
45
+ "@xyo-network/module-model": "~5.3.24",
46
+ "@xyo-network/wallet": "~5.3.24"
47
47
  },
48
48
  "devDependencies": {
49
- "@xylabs/sdk-js": "^5.0.90",
50
- "@xylabs/ts-scripts-common": "~7.5.6",
51
- "@xylabs/ts-scripts-yarn3": "~7.5.6",
52
- "@xylabs/tsconfig": "~7.5.6",
53
- "@xylabs/vitest-extended": "~5.0.90",
49
+ "@opentelemetry/api": "^1.9.1",
50
+ "@types/node": "^25.5.0",
51
+ "@xylabs/sdk-js": "^5.0.93",
52
+ "@xylabs/ts-scripts-common": "~7.6.16",
53
+ "@xylabs/ts-scripts-pnpm": "~7.6.16",
54
+ "@xylabs/tsconfig": "~7.6.16",
55
+ "@xylabs/vitest-extended": "~5.0.93",
56
+ "acorn": "^8.16.0",
57
+ "axios": "^1.14.0",
58
+ "esbuild": "^0.28.0",
59
+ "ethers": "^6.16.0",
54
60
  "tslib": "^2.8.1",
55
61
  "typescript": "~5.9.3",
62
+ "vite": "^8.0.3",
56
63
  "vitest": "~4.1.2",
57
- "zod": "^4.3.6"
64
+ "zod": "^4.3.6",
65
+ "@xyo-network/archivist-abstract": "~5.3.24",
66
+ "@xyo-network/archivist-memory": "~5.3.24",
67
+ "@xyo-network/archivist-model": "~5.3.24",
68
+ "@xyo-network/boundwitness-model": "~5.3.24",
69
+ "@xyo-network/module-model": "~5.3.24",
70
+ "@xyo-network/payload-model": "~5.3.24",
71
+ "@xyo-network/wallet": "~5.3.24"
58
72
  },
59
73
  "peerDependencies": {
60
74
  "@xylabs/sdk-js": "^5",
75
+ "ethers": "^6",
61
76
  "tslib": "^2.8.1",
62
77
  "zod": "^4"
63
78
  },
64
79
  "publishConfig": {
65
80
  "access": "public"
66
81
  }
67
- }
82
+ }
@@ -1,103 +0,0 @@
1
- import { readFile } from 'node:fs/promises'
2
-
3
- import {
4
- assertEx, Hash, PromisableArray,
5
- } from '@xylabs/sdk-js'
6
- import { AbstractArchivist, StorageClassLabel } from '@xyo-network/archivist-abstract'
7
- import { MemoryArchivist } from '@xyo-network/archivist-memory'
8
- import {
9
- ArchivistAllQuerySchema,
10
- ArchivistCommitQuerySchema,
11
- ArchivistConfig,
12
- ArchivistInstance,
13
- ArchivistParams,
14
- } from '@xyo-network/archivist-model'
15
- import { BoundWitness } from '@xyo-network/boundwitness-model'
16
- import { AnyConfigSchema, creatableModule } from '@xyo-network/module-model'
17
- import {
18
- asSchema,
19
- Payload, Schema, WithStorageMeta,
20
- } from '@xyo-network/payload-model'
21
- import { HDWallet } from '@xyo-network/wallet'
22
-
23
- export interface FileSystemArchivistData {
24
- payloads: Payload[]
25
- }
26
-
27
- export const FilesystemArchivistConfigSchema = asSchema('network.xyo.archivist.filesystem.config', true)
28
- export type FilesystemArchivistConfigSchema = typeof FilesystemArchivistConfigSchema
29
-
30
- export type FilesystemArchivistConfig = ArchivistConfig<{
31
- filePath?: string
32
- schema: FilesystemArchivistConfigSchema
33
- }>
34
-
35
- export type FilesystemArchivistParams = ArchivistParams<AnyConfigSchema<FilesystemArchivistConfig>>
36
-
37
- /** @description Currently only a read-only archivist that loads payloads from filesystem
38
- * but allows for future expansion to read/write
39
- */
40
- @creatableModule()
41
- export class FilesystemArchivist<TParams extends FilesystemArchivistParams = FilesystemArchivistParams>
42
- extends AbstractArchivist<TParams>
43
- implements ArchivistInstance {
44
- static override readonly configSchemas: Schema[] = [...super.configSchemas, FilesystemArchivistConfigSchema]
45
- static override readonly defaultConfigSchema: Schema = FilesystemArchivistConfigSchema
46
- static override readonly labels = { ...super.labels, [StorageClassLabel]: 'disk' }
47
-
48
- private _memoryArchivist?: MemoryArchivist
49
-
50
- get filePath() {
51
- return this.config?.filePath ?? 'archivist.xyo.json'
52
- }
53
-
54
- override get queries() {
55
- return [ArchivistAllQuerySchema, ArchivistCommitQuerySchema, ...super.queries]
56
- }
57
-
58
- private get memoryArchivist() {
59
- return assertEx(this._memoryArchivist)
60
- }
61
-
62
- private static dataFromRawJson(rawJson: string) {
63
- const data: FileSystemArchivistData = JSON.parse(rawJson)
64
- assertEx(typeof data === 'object', () => 'Archivist Data must be object')
65
- assertEx(Array.isArray(data.payloads), () => 'Archivist Data "payloads" field must be array of payloads')
66
- return data
67
- }
68
-
69
- protected override allHandler(): PromisableArray<WithStorageMeta<Payload>> {
70
- return this.memoryArchivist.next({ limit: Number.MAX_SAFE_INTEGER })
71
- }
72
-
73
- protected override clearHandler(): void | Promise<void> {
74
- return this.memoryArchivist.clear()
75
- }
76
-
77
- protected override async commitHandler(): Promise<BoundWitness[]> {
78
- return await this.memoryArchivist.commit()
79
- }
80
-
81
- protected override deleteHandler(hashes: Hash[]): PromisableArray<WithStorageMeta<Payload>> {
82
- return this.memoryArchivist.delete(hashes)
83
- }
84
-
85
- protected override async getHandler(hashes: Hash[]): Promise<WithStorageMeta<Payload>[]> {
86
- return await this.memoryArchivist.get(hashes)
87
- }
88
-
89
- protected override async insertHandler(payloads: Payload[]): Promise<WithStorageMeta<Payload>[]> {
90
- return await this.memoryArchivist.insert(payloads)
91
- }
92
-
93
- protected override async startHandler() {
94
- await super.startHandler()
95
- this._memoryArchivist = await MemoryArchivist.create({ account: await HDWallet.random() })
96
- const data = FilesystemArchivist.dataFromRawJson(await this.rawJsonFromFile())
97
- await this._memoryArchivist.insert(data.payloads)
98
- }
99
-
100
- private async rawJsonFromFile() {
101
- return await readFile(this.filePath, { encoding: 'utf8' })
102
- }
103
- }
package/src/index.ts DELETED
@@ -1 +0,0 @@
1
- export * from './FilesystemArchivist.ts'
@@ -1,16 +0,0 @@
1
- {
2
- "payloads": [
3
- {
4
- "schema": "network.xyo.test.1"
5
- },
6
- {
7
- "schema": "network.xyo.test.2"
8
- },
9
- {
10
- "schema": "network.xyo.test.3"
11
- },
12
- {
13
- "schema": "network.xyo.test.4"
14
- }
15
- ]
16
- }