@xyo-network/diviner-payload-stats 6.0.3 → 6.1.0
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/README.md +3 -1
- package/dist/neutral/Config.d.ts.map +1 -1
- package/dist/neutral/Query.d.ts.map +1 -1
- package/dist/neutral/Schema.d.ts +1 -1
- package/dist/neutral/Schema.d.ts.map +1 -1
- package/dist/neutral/index.mjs.map +2 -2
- package/dist/neutral/memory.mjs.map +2 -2
- package/dist/neutral/model.mjs.map +2 -2
- package/package.json +14 -17
package/README.md
CHANGED
|
@@ -38,10 +38,12 @@ bun add {{name}}
|
|
|
38
38
|
|
|
39
39
|
See the [LICENSE](LICENSE) file for license rights and limitations (LGPL-3.0-only).
|
|
40
40
|
|
|
41
|
+
## Credits
|
|
41
42
|
|
|
43
|
+
[Made with 🔥 and ❄️ by XYO Foundation](https://xyo.network)
|
|
42
44
|
|
|
43
|
-
[logo]: https://cdn.xy.company/img/brand/XYO_full_colored.png
|
|
44
45
|
[npm-badge]: https://img.shields.io/npm/v/@xyo-network/diviner-payload-stats.svg
|
|
45
46
|
[npm-link]: https://www.npmjs.com/package/@xyo-network/diviner-payload-stats
|
|
46
47
|
[license-badge]: https://img.shields.io/npm/l/@xyo-network/diviner-payload-stats.svg
|
|
47
48
|
[license-link]: https://github.com/xylabs/sdk-js/blob/main/LICENSE
|
|
49
|
+
[logo]: https://cdn.xy.company/img/brand/XYO_full_colored.png
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Config.d.ts","sourceRoot":"","sources":["../../src/Config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC/D,OAAO,EAAY,KAAK,OAAO,EAAE,MAAM,8BAA8B,CAAA;AAIrE,eAAO,MAAM,+BAA+B
|
|
1
|
+
{"version":3,"file":"Config.d.ts","sourceRoot":"","sources":["../../src/Config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC/D,OAAO,EAAY,KAAK,OAAO,EAAE,MAAM,8BAA8B,CAAA;AAIrE,eAAO,MAAM,+BAA+B,EAAE,MAAM,GAAG;IACrD,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAA;CACgC,CAAA;AACzD,MAAM,MAAM,+BAA+B,GAAG,OAAO,+BAA+B,CAAA;AAEpF,MAAM,MAAM,yBAAyB,CAAC,CAAC,SAAS,OAAO,GAAG,OAAO,IAAI,aAAa,CAChF,CAAC,GAAG;IACF,MAAM,EAAE,+BAA+B,CAAA;CACxC,CACF,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Query.d.ts","sourceRoot":"","sources":["../../src/Query.ts"],"names":[],"mappings":"AAAA,OAAO,EACK,KAAK,OAAO,EAAE,KAAK,KAAK,EACnC,MAAM,8BAA8B,CAAA;AAIrC,eAAO,MAAM,uBAAuB
|
|
1
|
+
{"version":3,"file":"Query.d.ts","sourceRoot":"","sources":["../../src/Query.ts"],"names":[],"mappings":"AAAA,OAAO,EACK,KAAK,OAAO,EAAE,KAAK,KAAK,EACnC,MAAM,8BAA8B,CAAA;AAIrC,eAAO,MAAM,uBAAuB,EAAE,MAAM,GAAG;IAC7C,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAA;CAC+B,CAAA;AACxD,MAAM,MAAM,uBAAuB,GAAG,OAAO,uBAAuB,CAAA;AAEpE,MAAM,MAAM,wBAAwB,GAAG,KAAK,CAAC;IAAE,MAAM,EAAE,uBAAuB,CAAA;CAAE,CAAC,CAAA;AACjF,eAAO,MAAM,0BAA0B,GAAI,IAAI,OAAO,GAAG,IAAI,KAAG,CAAC,IAAI,wBAAiE,CAAA"}
|
package/dist/neutral/Schema.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const PayloadStatsDivinerSchema:
|
|
1
|
+
export declare const PayloadStatsDivinerSchema: 'network.xyo.diviner.payload.stats' & {
|
|
2
2
|
readonly __schema: true;
|
|
3
3
|
};
|
|
4
4
|
export type PayloadStatsDivinerSchema = typeof PayloadStatsDivinerSchema;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Schema.d.ts","sourceRoot":"","sources":["../../src/Schema.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,yBAAyB
|
|
1
|
+
{"version":3,"file":"Schema.d.ts","sourceRoot":"","sources":["../../src/Schema.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,yBAAyB,EAAE,mCAAmC,GAAG;IAC5E,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAA;CAC8B,CAAA;AACvD,MAAM,MAAM,yBAAyB,GAAG,OAAO,yBAAyB,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/PayloadStatsDiviner.ts", "../../src/MemoryPayloadStatsDiviner.ts", "../../src/Config.ts", "../../src/Schema.ts", "../../src/Query.ts", "../../src/Payload.ts"],
|
|
4
|
-
"sourcesContent": ["import { AbstractDiviner } from '@xyo-network/diviner-abstract'\nimport type { DivinerInstance, DivinerModuleEventData } from '@xyo-network/diviner-model'\nimport type { Payload } from '@xyo-network/sdk-protocol-js'\n\nimport type { PayloadStatsDivinerParams } from './Params.ts'\n\nexport abstract class PayloadStatsDiviner<\n TParams extends PayloadStatsDivinerParams = PayloadStatsDivinerParams,\n TIn extends Payload = Payload,\n TOut extends Payload = Payload,\n TEventData extends DivinerModuleEventData<DivinerInstance<TParams, TIn, TOut>, TIn, TOut> = DivinerModuleEventData<\n DivinerInstance<TParams, TIn, TOut>,\n TIn,\n TOut\n >,\n> extends AbstractDiviner<TParams, TIn, TOut, TEventData> {}\n", "import { assertEx } from '@xylabs/sdk-js'\nimport { isBoundWitness, PayloadBuilder } from '@xyo-network/sdk-protocol-js'\nimport {\n isStorageMeta, type Payload, type Schema, type XyoAddress,\n} from '@xyo-network/sdk-protocol-js'\n\nimport { PayloadStatsDivinerConfigSchema } from './Config.ts'\nimport type { PayloadStatsDivinerParams } from './Params.ts'\nimport type { PayloadStatsPayload } from './Payload.ts'\nimport { PayloadStatsDiviner } from './PayloadStatsDiviner.ts'\nimport type { PayloadStatsQueryPayload } from './Query.ts'\nimport { isPayloadStatsQueryPayload } from './Query.ts'\nimport { PayloadStatsDivinerSchema } from './Schema.ts'\n\nexport class MemoryPayloadStatsDiviner<TParams extends PayloadStatsDivinerParams = PayloadStatsDivinerParams> extends PayloadStatsDiviner<TParams> {\n static override readonly configSchemas: Schema[] = [...super.configSchemas, PayloadStatsDivinerConfigSchema]\n static override readonly defaultConfigSchema: Schema = PayloadStatsDivinerConfigSchema\n\n protected async divineAddress(address: XyoAddress): Promise<number> {\n const archivist = assertEx(await this.archivistInstance(), () => 'Unable to resolve archivist')\n return (await archivist.next({ limit: 20_000 }))\n .filter(x => isBoundWitness(x) && isStorageMeta(x))\n .filter(bw => bw.addresses.includes(address))\n .map(bw => bw.payload_hashes.length)\n .reduce((total, count) => total + count, 0)\n }\n\n protected async divineAllAddresses(): Promise<number> {\n const archivist = assertEx(await this.archivistInstance(), () => 'Unable to resolve archivist')\n const all = await archivist.next({ limit: 20_000 })\n return all.length\n }\n\n protected override async divineHandler(payloads?: Payload[]): Promise<Payload[]> {\n const query = payloads?.find<PayloadStatsQueryPayload>(isPayloadStatsQueryPayload)\n if (!query) return []\n const addresses\n = query?.address\n ? Array.isArray(query?.address)\n ? query.address\n : [query.address]\n : undefined\n const counts = addresses ? await Promise.all(addresses.map(address => this.divineAddress(address))) : [await this.divineAllAddresses()]\n return counts.map(count => new PayloadBuilder<PayloadStatsPayload>({ schema: PayloadStatsDivinerSchema }).fields({ count }).build())\n }\n}\n", "import type { DivinerConfig } from '@xyo-network/diviner-model'\nimport { asSchema, type Payload } from '@xyo-network/sdk-protocol-js'\n\nimport { PayloadStatsDivinerSchema } from './Schema.ts'\n\nexport const PayloadStatsDivinerConfigSchema = asSchema(`${PayloadStatsDivinerSchema}.config`, true)\nexport type PayloadStatsDivinerConfigSchema = typeof PayloadStatsDivinerConfigSchema\n\nexport type PayloadStatsDivinerConfig<T extends Payload = Payload> = DivinerConfig<\n T & {\n schema: PayloadStatsDivinerConfigSchema\n }\n>\n", "import { asSchema } from '@xyo-network/sdk-protocol-js'\n\nexport const PayloadStatsDivinerSchema = asSchema('network.xyo.diviner.payload.stats', true)\nexport type PayloadStatsDivinerSchema = typeof PayloadStatsDivinerSchema\n", "import {\n asSchema, type Payload, type Query,\n} from '@xyo-network/sdk-protocol-js'\n\nimport { PayloadStatsDivinerSchema } from './Schema.ts'\n\nexport const PayloadStatsQuerySchema = asSchema(`${PayloadStatsDivinerSchema}.query`, true)\nexport type PayloadStatsQuerySchema = typeof PayloadStatsQuerySchema\n\nexport type PayloadStatsQueryPayload = Query<{ schema: PayloadStatsQuerySchema }>\nexport const isPayloadStatsQueryPayload = (x?: Payload | null): x is PayloadStatsQueryPayload => x?.schema === PayloadStatsQuerySchema\n", "import type { Payload } from '@xyo-network/sdk-protocol-js'\n\nimport { PayloadStatsDivinerSchema } from './Schema.ts'\n\nexport type PayloadStatsPayload = Payload<{ count: number; schema: PayloadStatsDivinerSchema }>\nexport const isPayloadStatsPayload = (x?: Payload | null): x is PayloadStatsPayload => x?.schema === PayloadStatsDivinerSchema\n"],
|
|
5
|
-
"mappings": ";AAAA,SAAS,uBAAuB;AAMzB,IAAe,sBAAf,cASG,gBAAgD;AAAC;;;ACf3D,SAAS,gBAAgB;AACzB,SAAS,gBAAgB,sBAAsB;AAC/C;AAAA,EACE;AAAA,OACK;;;ACHP,SAAS,YAAAA,iBAA8B;;;ACDvC,SAAS,gBAAgB;AAElB,IAAM,
|
|
4
|
+
"sourcesContent": ["import { AbstractDiviner } from '@xyo-network/diviner-abstract'\nimport type { DivinerInstance, DivinerModuleEventData } from '@xyo-network/diviner-model'\nimport type { Payload } from '@xyo-network/sdk-protocol-js'\n\nimport type { PayloadStatsDivinerParams } from './Params.ts'\n\nexport abstract class PayloadStatsDiviner<\n TParams extends PayloadStatsDivinerParams = PayloadStatsDivinerParams,\n TIn extends Payload = Payload,\n TOut extends Payload = Payload,\n TEventData extends DivinerModuleEventData<DivinerInstance<TParams, TIn, TOut>, TIn, TOut> = DivinerModuleEventData<\n DivinerInstance<TParams, TIn, TOut>,\n TIn,\n TOut\n >,\n> extends AbstractDiviner<TParams, TIn, TOut, TEventData> {}\n", "import { assertEx } from '@xylabs/sdk-js'\nimport { isBoundWitness, PayloadBuilder } from '@xyo-network/sdk-protocol-js'\nimport {\n isStorageMeta, type Payload, type Schema, type XyoAddress,\n} from '@xyo-network/sdk-protocol-js'\n\nimport { PayloadStatsDivinerConfigSchema } from './Config.ts'\nimport type { PayloadStatsDivinerParams } from './Params.ts'\nimport type { PayloadStatsPayload } from './Payload.ts'\nimport { PayloadStatsDiviner } from './PayloadStatsDiviner.ts'\nimport type { PayloadStatsQueryPayload } from './Query.ts'\nimport { isPayloadStatsQueryPayload } from './Query.ts'\nimport { PayloadStatsDivinerSchema } from './Schema.ts'\n\nexport class MemoryPayloadStatsDiviner<TParams extends PayloadStatsDivinerParams = PayloadStatsDivinerParams> extends PayloadStatsDiviner<TParams> {\n static override readonly configSchemas: Schema[] = [...super.configSchemas, PayloadStatsDivinerConfigSchema]\n static override readonly defaultConfigSchema: Schema = PayloadStatsDivinerConfigSchema\n\n protected async divineAddress(address: XyoAddress): Promise<number> {\n const archivist = assertEx(await this.archivistInstance(), () => 'Unable to resolve archivist')\n return (await archivist.next({ limit: 20_000 }))\n .filter(x => isBoundWitness(x) && isStorageMeta(x))\n .filter(bw => bw.addresses.includes(address))\n .map(bw => bw.payload_hashes.length)\n .reduce((total, count) => total + count, 0)\n }\n\n protected async divineAllAddresses(): Promise<number> {\n const archivist = assertEx(await this.archivistInstance(), () => 'Unable to resolve archivist')\n const all = await archivist.next({ limit: 20_000 })\n return all.length\n }\n\n protected override async divineHandler(payloads?: Payload[]): Promise<Payload[]> {\n const query = payloads?.find<PayloadStatsQueryPayload>(isPayloadStatsQueryPayload)\n if (!query) return []\n const addresses\n = query?.address\n ? Array.isArray(query?.address)\n ? query.address\n : [query.address]\n : undefined\n const counts = addresses ? await Promise.all(addresses.map(address => this.divineAddress(address))) : [await this.divineAllAddresses()]\n return counts.map(count => new PayloadBuilder<PayloadStatsPayload>({ schema: PayloadStatsDivinerSchema }).fields({ count }).build())\n }\n}\n", "import type { DivinerConfig } from '@xyo-network/diviner-model'\nimport { asSchema, type Payload } from '@xyo-network/sdk-protocol-js'\n\nimport { PayloadStatsDivinerSchema } from './Schema.ts'\n\nexport const PayloadStatsDivinerConfigSchema: string & {\n readonly __schema: true\n} = asSchema(`${PayloadStatsDivinerSchema}.config`, true)\nexport type PayloadStatsDivinerConfigSchema = typeof PayloadStatsDivinerConfigSchema\n\nexport type PayloadStatsDivinerConfig<T extends Payload = Payload> = DivinerConfig<\n T & {\n schema: PayloadStatsDivinerConfigSchema\n }\n>\n", "import { asSchema } from '@xyo-network/sdk-protocol-js'\n\nexport const PayloadStatsDivinerSchema: 'network.xyo.diviner.payload.stats' & {\n readonly __schema: true\n} = asSchema('network.xyo.diviner.payload.stats', true)\nexport type PayloadStatsDivinerSchema = typeof PayloadStatsDivinerSchema\n", "import {\n asSchema, type Payload, type Query,\n} from '@xyo-network/sdk-protocol-js'\n\nimport { PayloadStatsDivinerSchema } from './Schema.ts'\n\nexport const PayloadStatsQuerySchema: string & {\n readonly __schema: true\n} = asSchema(`${PayloadStatsDivinerSchema}.query`, true)\nexport type PayloadStatsQuerySchema = typeof PayloadStatsQuerySchema\n\nexport type PayloadStatsQueryPayload = Query<{ schema: PayloadStatsQuerySchema }>\nexport const isPayloadStatsQueryPayload = (x?: Payload | null): x is PayloadStatsQueryPayload => x?.schema === PayloadStatsQuerySchema\n", "import type { Payload } from '@xyo-network/sdk-protocol-js'\n\nimport { PayloadStatsDivinerSchema } from './Schema.ts'\n\nexport type PayloadStatsPayload = Payload<{ count: number; schema: PayloadStatsDivinerSchema }>\nexport const isPayloadStatsPayload = (x?: Payload | null): x is PayloadStatsPayload => x?.schema === PayloadStatsDivinerSchema\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAS,uBAAuB;AAMzB,IAAe,sBAAf,cASG,gBAAgD;AAAC;;;ACf3D,SAAS,gBAAgB;AACzB,SAAS,gBAAgB,sBAAsB;AAC/C;AAAA,EACE;AAAA,OACK;;;ACHP,SAAS,YAAAA,iBAA8B;;;ACDvC,SAAS,gBAAgB;AAElB,IAAM,4BAET,SAAS,qCAAqC,IAAI;;;ADC/C,IAAM,kCAETC,UAAS,GAAG,yBAAyB,WAAW,IAAI;;;AEPxD;AAAA,EACE,YAAAC;AAAA,OACK;AAIA,IAAM,0BAETC,UAAS,GAAG,yBAAyB,UAAU,IAAI;AAIhD,IAAM,6BAA6B,CAAC,MAAsD,GAAG,WAAW;;;AHExG,IAAM,4BAAN,cAA+G,oBAA6B;AAAA,EACjJ,OAAyB,gBAA0B,CAAC,GAAG,MAAM,eAAe,+BAA+B;AAAA,EAC3G,OAAyB,sBAA8B;AAAA,EAEvD,MAAgB,cAAc,SAAsC;AAClE,UAAM,YAAY,SAAS,MAAM,KAAK,kBAAkB,GAAG,MAAM,6BAA6B;AAC9F,YAAQ,MAAM,UAAU,KAAK,EAAE,OAAO,IAAO,CAAC,GAC3C,OAAO,OAAK,eAAe,CAAC,KAAK,cAAc,CAAC,CAAC,EACjD,OAAO,QAAM,GAAG,UAAU,SAAS,OAAO,CAAC,EAC3C,IAAI,QAAM,GAAG,eAAe,MAAM,EAClC,OAAO,CAAC,OAAO,UAAU,QAAQ,OAAO,CAAC;AAAA,EAC9C;AAAA,EAEA,MAAgB,qBAAsC;AACpD,UAAM,YAAY,SAAS,MAAM,KAAK,kBAAkB,GAAG,MAAM,6BAA6B;AAC9F,UAAM,MAAM,MAAM,UAAU,KAAK,EAAE,OAAO,IAAO,CAAC;AAClD,WAAO,IAAI;AAAA,EACb;AAAA,EAEA,MAAyB,cAAc,UAA0C;AAC/E,UAAM,QAAQ,UAAU,KAA+B,0BAA0B;AACjF,QAAI,CAAC,MAAO,QAAO,CAAC;AACpB,UAAM,YACF,OAAO,UACL,MAAM,QAAQ,OAAO,OAAO,IAC1B,MAAM,UACN,CAAC,MAAM,OAAO,IAChB;AACN,UAAM,SAAS,YAAY,MAAM,QAAQ,IAAI,UAAU,IAAI,aAAW,KAAK,cAAc,OAAO,CAAC,CAAC,IAAI,CAAC,MAAM,KAAK,mBAAmB,CAAC;AACtI,WAAO,OAAO,IAAI,WAAS,IAAI,eAAoC,EAAE,QAAQ,0BAA0B,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC;AAAA,EACrI;AACF;;;AIxCO,IAAM,wBAAwB,CAAC,MAAiD,GAAG,WAAW;",
|
|
6
6
|
"names": ["asSchema", "asSchema", "asSchema", "asSchema"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/MemoryPayloadStatsDiviner.ts", "../../src/Config.ts", "../../src/Schema.ts", "../../src/PayloadStatsDiviner.ts", "../../src/Query.ts"],
|
|
4
|
-
"sourcesContent": ["import { assertEx } from '@xylabs/sdk-js'\nimport { isBoundWitness, PayloadBuilder } from '@xyo-network/sdk-protocol-js'\nimport {\n isStorageMeta, type Payload, type Schema, type XyoAddress,\n} from '@xyo-network/sdk-protocol-js'\n\nimport { PayloadStatsDivinerConfigSchema } from './Config.ts'\nimport type { PayloadStatsDivinerParams } from './Params.ts'\nimport type { PayloadStatsPayload } from './Payload.ts'\nimport { PayloadStatsDiviner } from './PayloadStatsDiviner.ts'\nimport type { PayloadStatsQueryPayload } from './Query.ts'\nimport { isPayloadStatsQueryPayload } from './Query.ts'\nimport { PayloadStatsDivinerSchema } from './Schema.ts'\n\nexport class MemoryPayloadStatsDiviner<TParams extends PayloadStatsDivinerParams = PayloadStatsDivinerParams> extends PayloadStatsDiviner<TParams> {\n static override readonly configSchemas: Schema[] = [...super.configSchemas, PayloadStatsDivinerConfigSchema]\n static override readonly defaultConfigSchema: Schema = PayloadStatsDivinerConfigSchema\n\n protected async divineAddress(address: XyoAddress): Promise<number> {\n const archivist = assertEx(await this.archivistInstance(), () => 'Unable to resolve archivist')\n return (await archivist.next({ limit: 20_000 }))\n .filter(x => isBoundWitness(x) && isStorageMeta(x))\n .filter(bw => bw.addresses.includes(address))\n .map(bw => bw.payload_hashes.length)\n .reduce((total, count) => total + count, 0)\n }\n\n protected async divineAllAddresses(): Promise<number> {\n const archivist = assertEx(await this.archivistInstance(), () => 'Unable to resolve archivist')\n const all = await archivist.next({ limit: 20_000 })\n return all.length\n }\n\n protected override async divineHandler(payloads?: Payload[]): Promise<Payload[]> {\n const query = payloads?.find<PayloadStatsQueryPayload>(isPayloadStatsQueryPayload)\n if (!query) return []\n const addresses\n = query?.address\n ? Array.isArray(query?.address)\n ? query.address\n : [query.address]\n : undefined\n const counts = addresses ? await Promise.all(addresses.map(address => this.divineAddress(address))) : [await this.divineAllAddresses()]\n return counts.map(count => new PayloadBuilder<PayloadStatsPayload>({ schema: PayloadStatsDivinerSchema }).fields({ count }).build())\n }\n}\n", "import type { DivinerConfig } from '@xyo-network/diviner-model'\nimport { asSchema, type Payload } from '@xyo-network/sdk-protocol-js'\n\nimport { PayloadStatsDivinerSchema } from './Schema.ts'\n\nexport const PayloadStatsDivinerConfigSchema = asSchema(`${PayloadStatsDivinerSchema}.config`, true)\nexport type PayloadStatsDivinerConfigSchema = typeof PayloadStatsDivinerConfigSchema\n\nexport type PayloadStatsDivinerConfig<T extends Payload = Payload> = DivinerConfig<\n T & {\n schema: PayloadStatsDivinerConfigSchema\n }\n>\n", "import { asSchema } from '@xyo-network/sdk-protocol-js'\n\nexport const PayloadStatsDivinerSchema = asSchema('network.xyo.diviner.payload.stats', true)\nexport type PayloadStatsDivinerSchema = typeof PayloadStatsDivinerSchema\n", "import { AbstractDiviner } from '@xyo-network/diviner-abstract'\nimport type { DivinerInstance, DivinerModuleEventData } from '@xyo-network/diviner-model'\nimport type { Payload } from '@xyo-network/sdk-protocol-js'\n\nimport type { PayloadStatsDivinerParams } from './Params.ts'\n\nexport abstract class PayloadStatsDiviner<\n TParams extends PayloadStatsDivinerParams = PayloadStatsDivinerParams,\n TIn extends Payload = Payload,\n TOut extends Payload = Payload,\n TEventData extends DivinerModuleEventData<DivinerInstance<TParams, TIn, TOut>, TIn, TOut> = DivinerModuleEventData<\n DivinerInstance<TParams, TIn, TOut>,\n TIn,\n TOut\n >,\n> extends AbstractDiviner<TParams, TIn, TOut, TEventData> {}\n", "import {\n asSchema, type Payload, type Query,\n} from '@xyo-network/sdk-protocol-js'\n\nimport { PayloadStatsDivinerSchema } from './Schema.ts'\n\nexport const PayloadStatsQuerySchema = asSchema(`${PayloadStatsDivinerSchema}.query`, true)\nexport type PayloadStatsQuerySchema = typeof PayloadStatsQuerySchema\n\nexport type PayloadStatsQueryPayload = Query<{ schema: PayloadStatsQuerySchema }>\nexport const isPayloadStatsQueryPayload = (x?: Payload | null): x is PayloadStatsQueryPayload => x?.schema === PayloadStatsQuerySchema\n"],
|
|
5
|
-
"mappings": ";AAAA,SAAS,gBAAgB;AACzB,SAAS,gBAAgB,sBAAsB;AAC/C;AAAA,EACE;AAAA,OACK;;;ACHP,SAAS,YAAAA,iBAA8B;;;ACDvC,SAAS,gBAAgB;AAElB,IAAM,
|
|
4
|
+
"sourcesContent": ["import { assertEx } from '@xylabs/sdk-js'\nimport { isBoundWitness, PayloadBuilder } from '@xyo-network/sdk-protocol-js'\nimport {\n isStorageMeta, type Payload, type Schema, type XyoAddress,\n} from '@xyo-network/sdk-protocol-js'\n\nimport { PayloadStatsDivinerConfigSchema } from './Config.ts'\nimport type { PayloadStatsDivinerParams } from './Params.ts'\nimport type { PayloadStatsPayload } from './Payload.ts'\nimport { PayloadStatsDiviner } from './PayloadStatsDiviner.ts'\nimport type { PayloadStatsQueryPayload } from './Query.ts'\nimport { isPayloadStatsQueryPayload } from './Query.ts'\nimport { PayloadStatsDivinerSchema } from './Schema.ts'\n\nexport class MemoryPayloadStatsDiviner<TParams extends PayloadStatsDivinerParams = PayloadStatsDivinerParams> extends PayloadStatsDiviner<TParams> {\n static override readonly configSchemas: Schema[] = [...super.configSchemas, PayloadStatsDivinerConfigSchema]\n static override readonly defaultConfigSchema: Schema = PayloadStatsDivinerConfigSchema\n\n protected async divineAddress(address: XyoAddress): Promise<number> {\n const archivist = assertEx(await this.archivistInstance(), () => 'Unable to resolve archivist')\n return (await archivist.next({ limit: 20_000 }))\n .filter(x => isBoundWitness(x) && isStorageMeta(x))\n .filter(bw => bw.addresses.includes(address))\n .map(bw => bw.payload_hashes.length)\n .reduce((total, count) => total + count, 0)\n }\n\n protected async divineAllAddresses(): Promise<number> {\n const archivist = assertEx(await this.archivistInstance(), () => 'Unable to resolve archivist')\n const all = await archivist.next({ limit: 20_000 })\n return all.length\n }\n\n protected override async divineHandler(payloads?: Payload[]): Promise<Payload[]> {\n const query = payloads?.find<PayloadStatsQueryPayload>(isPayloadStatsQueryPayload)\n if (!query) return []\n const addresses\n = query?.address\n ? Array.isArray(query?.address)\n ? query.address\n : [query.address]\n : undefined\n const counts = addresses ? await Promise.all(addresses.map(address => this.divineAddress(address))) : [await this.divineAllAddresses()]\n return counts.map(count => new PayloadBuilder<PayloadStatsPayload>({ schema: PayloadStatsDivinerSchema }).fields({ count }).build())\n }\n}\n", "import type { DivinerConfig } from '@xyo-network/diviner-model'\nimport { asSchema, type Payload } from '@xyo-network/sdk-protocol-js'\n\nimport { PayloadStatsDivinerSchema } from './Schema.ts'\n\nexport const PayloadStatsDivinerConfigSchema: string & {\n readonly __schema: true\n} = asSchema(`${PayloadStatsDivinerSchema}.config`, true)\nexport type PayloadStatsDivinerConfigSchema = typeof PayloadStatsDivinerConfigSchema\n\nexport type PayloadStatsDivinerConfig<T extends Payload = Payload> = DivinerConfig<\n T & {\n schema: PayloadStatsDivinerConfigSchema\n }\n>\n", "import { asSchema } from '@xyo-network/sdk-protocol-js'\n\nexport const PayloadStatsDivinerSchema: 'network.xyo.diviner.payload.stats' & {\n readonly __schema: true\n} = asSchema('network.xyo.diviner.payload.stats', true)\nexport type PayloadStatsDivinerSchema = typeof PayloadStatsDivinerSchema\n", "import { AbstractDiviner } from '@xyo-network/diviner-abstract'\nimport type { DivinerInstance, DivinerModuleEventData } from '@xyo-network/diviner-model'\nimport type { Payload } from '@xyo-network/sdk-protocol-js'\n\nimport type { PayloadStatsDivinerParams } from './Params.ts'\n\nexport abstract class PayloadStatsDiviner<\n TParams extends PayloadStatsDivinerParams = PayloadStatsDivinerParams,\n TIn extends Payload = Payload,\n TOut extends Payload = Payload,\n TEventData extends DivinerModuleEventData<DivinerInstance<TParams, TIn, TOut>, TIn, TOut> = DivinerModuleEventData<\n DivinerInstance<TParams, TIn, TOut>,\n TIn,\n TOut\n >,\n> extends AbstractDiviner<TParams, TIn, TOut, TEventData> {}\n", "import {\n asSchema, type Payload, type Query,\n} from '@xyo-network/sdk-protocol-js'\n\nimport { PayloadStatsDivinerSchema } from './Schema.ts'\n\nexport const PayloadStatsQuerySchema: string & {\n readonly __schema: true\n} = asSchema(`${PayloadStatsDivinerSchema}.query`, true)\nexport type PayloadStatsQuerySchema = typeof PayloadStatsQuerySchema\n\nexport type PayloadStatsQueryPayload = Query<{ schema: PayloadStatsQuerySchema }>\nexport const isPayloadStatsQueryPayload = (x?: Payload | null): x is PayloadStatsQueryPayload => x?.schema === PayloadStatsQuerySchema\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAS,gBAAgB;AACzB,SAAS,gBAAgB,sBAAsB;AAC/C;AAAA,EACE;AAAA,OACK;;;ACHP,SAAS,YAAAA,iBAA8B;;;ACDvC,SAAS,gBAAgB;AAElB,IAAM,4BAET,SAAS,qCAAqC,IAAI;;;ADC/C,IAAM,kCAETC,UAAS,GAAG,yBAAyB,WAAW,IAAI;;;AEPxD,SAAS,uBAAuB;AAMzB,IAAe,sBAAf,cASG,gBAAgD;AAAC;;;ACf3D;AAAA,EACE,YAAAC;AAAA,OACK;AAIA,IAAM,0BAETC,UAAS,GAAG,yBAAyB,UAAU,IAAI;AAIhD,IAAM,6BAA6B,CAAC,MAAsD,GAAG,WAAW;;;AJExG,IAAM,4BAAN,cAA+G,oBAA6B;AAAA,EACjJ,OAAyB,gBAA0B,CAAC,GAAG,MAAM,eAAe,+BAA+B;AAAA,EAC3G,OAAyB,sBAA8B;AAAA,EAEvD,MAAgB,cAAc,SAAsC;AAClE,UAAM,YAAY,SAAS,MAAM,KAAK,kBAAkB,GAAG,MAAM,6BAA6B;AAC9F,YAAQ,MAAM,UAAU,KAAK,EAAE,OAAO,IAAO,CAAC,GAC3C,OAAO,OAAK,eAAe,CAAC,KAAK,cAAc,CAAC,CAAC,EACjD,OAAO,QAAM,GAAG,UAAU,SAAS,OAAO,CAAC,EAC3C,IAAI,QAAM,GAAG,eAAe,MAAM,EAClC,OAAO,CAAC,OAAO,UAAU,QAAQ,OAAO,CAAC;AAAA,EAC9C;AAAA,EAEA,MAAgB,qBAAsC;AACpD,UAAM,YAAY,SAAS,MAAM,KAAK,kBAAkB,GAAG,MAAM,6BAA6B;AAC9F,UAAM,MAAM,MAAM,UAAU,KAAK,EAAE,OAAO,IAAO,CAAC;AAClD,WAAO,IAAI;AAAA,EACb;AAAA,EAEA,MAAyB,cAAc,UAA0C;AAC/E,UAAM,QAAQ,UAAU,KAA+B,0BAA0B;AACjF,QAAI,CAAC,MAAO,QAAO,CAAC;AACpB,UAAM,YACF,OAAO,UACL,MAAM,QAAQ,OAAO,OAAO,IAC1B,MAAM,UACN,CAAC,MAAM,OAAO,IAChB;AACN,UAAM,SAAS,YAAY,MAAM,QAAQ,IAAI,UAAU,IAAI,aAAW,KAAK,cAAc,OAAO,CAAC,CAAC,IAAI,CAAC,MAAM,KAAK,mBAAmB,CAAC;AACtI,WAAO,OAAO,IAAI,WAAS,IAAI,eAAoC,EAAE,QAAQ,0BAA0B,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC;AAAA,EACrI;AACF;",
|
|
6
6
|
"names": ["asSchema", "asSchema", "asSchema", "asSchema"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Config.ts", "../../src/Schema.ts", "../../src/Payload.ts", "../../src/Query.ts"],
|
|
4
|
-
"sourcesContent": ["import type { DivinerConfig } from '@xyo-network/diviner-model'\nimport { asSchema, type Payload } from '@xyo-network/sdk-protocol-js'\n\nimport { PayloadStatsDivinerSchema } from './Schema.ts'\n\nexport const PayloadStatsDivinerConfigSchema = asSchema(`${PayloadStatsDivinerSchema}.config`, true)\nexport type PayloadStatsDivinerConfigSchema = typeof PayloadStatsDivinerConfigSchema\n\nexport type PayloadStatsDivinerConfig<T extends Payload = Payload> = DivinerConfig<\n T & {\n schema: PayloadStatsDivinerConfigSchema\n }\n>\n", "import { asSchema } from '@xyo-network/sdk-protocol-js'\n\nexport const PayloadStatsDivinerSchema = asSchema('network.xyo.diviner.payload.stats', true)\nexport type PayloadStatsDivinerSchema = typeof PayloadStatsDivinerSchema\n", "import type { Payload } from '@xyo-network/sdk-protocol-js'\n\nimport { PayloadStatsDivinerSchema } from './Schema.ts'\n\nexport type PayloadStatsPayload = Payload<{ count: number; schema: PayloadStatsDivinerSchema }>\nexport const isPayloadStatsPayload = (x?: Payload | null): x is PayloadStatsPayload => x?.schema === PayloadStatsDivinerSchema\n", "import {\n asSchema, type Payload, type Query,\n} from '@xyo-network/sdk-protocol-js'\n\nimport { PayloadStatsDivinerSchema } from './Schema.ts'\n\nexport const PayloadStatsQuerySchema = asSchema(`${PayloadStatsDivinerSchema}.query`, true)\nexport type PayloadStatsQuerySchema = typeof PayloadStatsQuerySchema\n\nexport type PayloadStatsQueryPayload = Query<{ schema: PayloadStatsQuerySchema }>\nexport const isPayloadStatsQueryPayload = (x?: Payload | null): x is PayloadStatsQueryPayload => x?.schema === PayloadStatsQuerySchema\n"],
|
|
5
|
-
"mappings": ";AACA,SAAS,YAAAA,iBAA8B;;;ACDvC,SAAS,gBAAgB;AAElB,IAAM,
|
|
4
|
+
"sourcesContent": ["import type { DivinerConfig } from '@xyo-network/diviner-model'\nimport { asSchema, type Payload } from '@xyo-network/sdk-protocol-js'\n\nimport { PayloadStatsDivinerSchema } from './Schema.ts'\n\nexport const PayloadStatsDivinerConfigSchema: string & {\n readonly __schema: true\n} = asSchema(`${PayloadStatsDivinerSchema}.config`, true)\nexport type PayloadStatsDivinerConfigSchema = typeof PayloadStatsDivinerConfigSchema\n\nexport type PayloadStatsDivinerConfig<T extends Payload = Payload> = DivinerConfig<\n T & {\n schema: PayloadStatsDivinerConfigSchema\n }\n>\n", "import { asSchema } from '@xyo-network/sdk-protocol-js'\n\nexport const PayloadStatsDivinerSchema: 'network.xyo.diviner.payload.stats' & {\n readonly __schema: true\n} = asSchema('network.xyo.diviner.payload.stats', true)\nexport type PayloadStatsDivinerSchema = typeof PayloadStatsDivinerSchema\n", "import type { Payload } from '@xyo-network/sdk-protocol-js'\n\nimport { PayloadStatsDivinerSchema } from './Schema.ts'\n\nexport type PayloadStatsPayload = Payload<{ count: number; schema: PayloadStatsDivinerSchema }>\nexport const isPayloadStatsPayload = (x?: Payload | null): x is PayloadStatsPayload => x?.schema === PayloadStatsDivinerSchema\n", "import {\n asSchema, type Payload, type Query,\n} from '@xyo-network/sdk-protocol-js'\n\nimport { PayloadStatsDivinerSchema } from './Schema.ts'\n\nexport const PayloadStatsQuerySchema: string & {\n readonly __schema: true\n} = asSchema(`${PayloadStatsDivinerSchema}.query`, true)\nexport type PayloadStatsQuerySchema = typeof PayloadStatsQuerySchema\n\nexport type PayloadStatsQueryPayload = Query<{ schema: PayloadStatsQuerySchema }>\nexport const isPayloadStatsQueryPayload = (x?: Payload | null): x is PayloadStatsQueryPayload => x?.schema === PayloadStatsQuerySchema\n"],
|
|
5
|
+
"mappings": ";AACA,SAAS,YAAAA,iBAA8B;;;ACDvC,SAAS,gBAAgB;AAElB,IAAM,4BAET,SAAS,qCAAqC,IAAI;;;ADC/C,IAAM,kCAETC,UAAS,GAAG,yBAAyB,WAAW,IAAI;;;AEFjD,IAAM,wBAAwB,CAAC,MAAiD,GAAG,WAAW;;;ACLrG;AAAA,EACE,YAAAC;AAAA,OACK;AAIA,IAAM,0BAETC,UAAS,GAAG,yBAAyB,UAAU,IAAI;AAIhD,IAAM,6BAA6B,CAAC,MAAsD,GAAG,WAAW;",
|
|
6
6
|
"names": ["asSchema", "asSchema", "asSchema", "asSchema"]
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyo-network/diviner-payload-stats",
|
|
3
|
-
"version": "6.0
|
|
3
|
+
"version": "6.1.0",
|
|
4
4
|
"description": "Primary SDK for using XYO Protocol 2.0",
|
|
5
5
|
"homepage": "https://xyo.network",
|
|
6
6
|
"bugs": {
|
|
@@ -46,9 +46,9 @@
|
|
|
46
46
|
"README.md"
|
|
47
47
|
],
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@xyo-network/diviner-abstract": "~6.0
|
|
50
|
-
"@xyo-network/
|
|
51
|
-
"@xyo-network/
|
|
49
|
+
"@xyo-network/diviner-abstract": "~6.1.0",
|
|
50
|
+
"@xyo-network/diviner-model": "~6.1.0",
|
|
51
|
+
"@xyo-network/module-model": "~6.1.0"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@bitauth/libauth": "~3.0.0",
|
|
@@ -58,16 +58,14 @@
|
|
|
58
58
|
"@opentelemetry/sdk-trace-base": "^2.7.1",
|
|
59
59
|
"@scure/base": "~2.2.0",
|
|
60
60
|
"@scure/bip39": "~2.2.0",
|
|
61
|
-
"@xylabs/geo": "^6.0
|
|
62
|
-
"@xylabs/sdk-js": "^6.0
|
|
63
|
-
"@xylabs/threads": "^6.0
|
|
64
|
-
"@xylabs/toolchain": "
|
|
65
|
-
"@xylabs/tsconfig": "
|
|
66
|
-
"@xyo-network/sdk-protocol-js": "
|
|
61
|
+
"@xylabs/geo": "^6.1.0",
|
|
62
|
+
"@xylabs/sdk-js": "^6.1.0",
|
|
63
|
+
"@xylabs/threads": "^6.1.0",
|
|
64
|
+
"@xylabs/toolchain": "^8.1.20",
|
|
65
|
+
"@xylabs/tsconfig": "^8.1.20",
|
|
66
|
+
"@xyo-network/sdk-protocol-js": "^6.1.0",
|
|
67
67
|
"ajv": "^8.20.0",
|
|
68
68
|
"async-mutex": "^0.5.0",
|
|
69
|
-
"bn.js": "^5.2.3",
|
|
70
|
-
"buffer": "^6.0.3",
|
|
71
69
|
"debug": "~4.4.3",
|
|
72
70
|
"eslint": "^10.4.1",
|
|
73
71
|
"ethers": "^6.16.0",
|
|
@@ -75,7 +73,6 @@
|
|
|
75
73
|
"idb": "^8.0.3",
|
|
76
74
|
"lru-cache": "^11.5.1",
|
|
77
75
|
"observable-fns": "~0.6.1",
|
|
78
|
-
"pako": "~2.1.0",
|
|
79
76
|
"typescript": "~6.0.3",
|
|
80
77
|
"webextension-polyfill": "^0.12.0",
|
|
81
78
|
"zod": "^4.4.3"
|
|
@@ -91,21 +88,21 @@
|
|
|
91
88
|
"@xylabs/geo": "^6.0",
|
|
92
89
|
"@xylabs/sdk-js": "^6.0",
|
|
93
90
|
"@xylabs/threads": "^6.0",
|
|
94
|
-
"@xyo-network/sdk-protocol-js": "
|
|
91
|
+
"@xyo-network/sdk-protocol-js": "^6.1",
|
|
95
92
|
"ajv": "^8.20",
|
|
96
93
|
"async-mutex": "^0.5",
|
|
97
|
-
"bn.js": "^5.2",
|
|
98
|
-
"buffer": "^6.0",
|
|
99
94
|
"debug": "~4.4",
|
|
100
95
|
"ethers": "^6.16",
|
|
101
96
|
"hash-wasm": "~4.12",
|
|
102
97
|
"idb": "^8.0",
|
|
103
98
|
"lru-cache": "^11.3",
|
|
104
99
|
"observable-fns": "~0.6",
|
|
105
|
-
"pako": "~2.1",
|
|
106
100
|
"webextension-polyfill": "^0.12",
|
|
107
101
|
"zod": "^4.4"
|
|
108
102
|
},
|
|
103
|
+
"engines": {
|
|
104
|
+
"node": "^24"
|
|
105
|
+
},
|
|
109
106
|
"publishConfig": {
|
|
110
107
|
"access": "public"
|
|
111
108
|
}
|