@xyo-network/diviner-schema-stats-memory 5.3.22 → 5.3.25

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/diviner-schema-stats-memory",
3
- "version": "5.3.22",
3
+ "version": "5.3.25",
4
4
  "description": "Primary SDK for using XYO Protocol 2.0",
5
5
  "homepage": "https://xyo.network",
6
6
  "bugs": {
@@ -30,41 +30,37 @@
30
30
  "types": "dist/neutral/index.d.ts",
31
31
  "files": [
32
32
  "dist",
33
- "src",
34
33
  "!**/*.bench.*",
35
34
  "!**/*.spec.*",
36
35
  "!**/*.test.*",
37
36
  "README.md"
38
37
  ],
39
38
  "dependencies": {
40
- "@xyo-network/boundwitness-model": "~5.3.22",
41
- "@xyo-network/diviner-schema-stats-abstract": "~5.3.22",
42
- "@xyo-network/diviner-schema-stats-model": "~5.3.22",
43
- "@xyo-network/payload-builder": "~5.3.22",
44
- "@xyo-network/payload-model": "~5.3.22"
39
+ "@xyo-network/boundwitness-model": "~5.3.25",
40
+ "@xyo-network/diviner-schema-stats-abstract": "~5.3.25",
41
+ "@xyo-network/diviner-schema-stats-model": "~5.3.25",
42
+ "@xyo-network/payload-builder": "~5.3.25",
43
+ "@xyo-network/payload-model": "~5.3.25"
45
44
  },
46
45
  "devDependencies": {
47
46
  "@opentelemetry/api": "^1.9.1",
48
47
  "@types/node": "^25.5.0",
49
- "@xylabs/sdk-js": "^5.0.91",
50
- "@xylabs/ts-scripts-common": "~7.6.8",
51
- "@xylabs/ts-scripts-yarn3": "~7.6.8",
52
- "@xylabs/tsconfig": "~7.6.8",
53
- "@xyo-network/boundwitness-model": "~5.3.22",
54
- "@xyo-network/diviner-schema-stats-abstract": "~5.3.22",
55
- "@xyo-network/diviner-schema-stats-model": "~5.3.22",
56
- "@xyo-network/payload-builder": "~5.3.22",
57
- "@xyo-network/payload-model": "~5.3.22",
48
+ "@xylabs/sdk-js": "^5.0.93",
49
+ "@xylabs/ts-scripts-common": "~7.6.16",
50
+ "@xylabs/ts-scripts-pnpm": "~7.6.16",
51
+ "@xylabs/tsconfig": "~7.6.16",
58
52
  "acorn": "^8.16.0",
59
53
  "axios": "^1.14.0",
60
- "cosmiconfig": "^9.0.1",
61
- "esbuild": "^0.27.4",
62
- "eslint": "^10.1.0",
54
+ "esbuild": "^0.28.0",
63
55
  "ethers": "^6.16.0",
64
- "rollup": "^4.60.1",
65
56
  "tslib": "^2.8.1",
66
57
  "typescript": "~5.9.3",
67
- "zod": "^4.3.6"
58
+ "zod": "^4.3.6",
59
+ "@xyo-network/diviner-schema-stats-abstract": "~5.3.25",
60
+ "@xyo-network/diviner-schema-stats-model": "~5.3.25",
61
+ "@xyo-network/payload-builder": "~5.3.25",
62
+ "@xyo-network/payload-model": "~5.3.25",
63
+ "@xyo-network/boundwitness-model": "~5.3.25"
68
64
  },
69
65
  "peerDependencies": {
70
66
  "@xylabs/sdk-js": "^5",
@@ -75,4 +71,4 @@
75
71
  "publishConfig": {
76
72
  "access": "public"
77
73
  }
78
- }
74
+ }
@@ -1,69 +0,0 @@
1
- import type { Address } from '@xylabs/sdk-js'
2
- import { assertEx } from '@xylabs/sdk-js'
3
- import { isBoundWitness } from '@xyo-network/boundwitness-model'
4
- import { SchemaStatsDiviner } from '@xyo-network/diviner-schema-stats-abstract'
5
- import type {
6
- SchemaStatsDivinerParams,
7
- SchemaStatsPayload,
8
- SchemaStatsQueryPayload,
9
- } from '@xyo-network/diviner-schema-stats-model'
10
- import {
11
- isSchemaStatsQueryPayload,
12
- SchemaStatsDivinerConfigSchema,
13
- SchemaStatsDivinerSchema,
14
- } from '@xyo-network/diviner-schema-stats-model'
15
- import { PayloadBuilder } from '@xyo-network/payload-builder'
16
- import {
17
- isStorageMeta, type Payload, type Schema,
18
- } from '@xyo-network/payload-model'
19
-
20
- export class MemorySchemaStatsDiviner<TParams extends SchemaStatsDivinerParams = SchemaStatsDivinerParams> extends SchemaStatsDiviner<TParams> {
21
- static override readonly configSchemas: Schema[] = [...super.configSchemas, SchemaStatsDivinerConfigSchema]
22
- static override readonly defaultConfigSchema: Schema = SchemaStatsDivinerConfigSchema
23
-
24
- protected async divineAddress(address: Address): Promise<Record<string, number>> {
25
- const archivist = assertEx(await this.archivistInstance(), () => 'Unable to resolve archivist')
26
- const all = await archivist.next({ limit: 20_000 })
27
- const filtered = all
28
- .filter(x => isBoundWitness(x) && isStorageMeta(x))
29
- .filter(bw => bw.addresses.includes(address))
30
- // eslint-disable-next-line unicorn/no-array-reduce
31
- const counts: Record<string, number> = filtered.reduce(
32
- (acc, payload) => {
33
- acc[payload.schema] = acc[payload.schema] ? acc[payload.schema] + 1 : 1
34
- return acc
35
- },
36
- {} as Record<string, number>,
37
- )
38
- return counts
39
- }
40
-
41
- protected async divineAllAddresses(): Promise<Record<string, number>> {
42
- const archivist = assertEx(await this.archivistInstance(), () => 'Unable to resolve archivist')
43
- const all = await archivist.next({ limit: 20_000 })
44
- // eslint-disable-next-line unicorn/no-array-reduce
45
- const counts: Record<string, number> = all.reduce(
46
- (acc, payload) => {
47
- acc[payload.schema] = acc[payload.schema] ? acc[payload.schema] + 1 : 1
48
- return acc
49
- },
50
- {} as Record<string, number>,
51
- )
52
- return counts
53
- }
54
-
55
- protected override async divineHandler(payloads?: Payload[]): Promise<Payload[]> {
56
- const query = payloads?.find<SchemaStatsQueryPayload>(isSchemaStatsQueryPayload)
57
- if (!query) return []
58
- const addresses
59
- = query?.address
60
- ? Array.isArray(query?.address)
61
- ? query.address
62
- : [query.address]
63
- : undefined
64
- const counts = addresses ? await Promise.all(addresses.map(address => this.divineAddress(address))) : [await this.divineAllAddresses()]
65
- return await Promise.all(
66
- counts.map(count => new PayloadBuilder<SchemaStatsPayload>({ schema: SchemaStatsDivinerSchema }).fields({ count }).build()),
67
- )
68
- }
69
- }
package/src/index.ts DELETED
@@ -1 +0,0 @@
1
- export * from './MemorySchemaStatsDiviner.ts'