@xyo-network/diviner-payload-stats 6.0.1 → 6.0.2

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.
@@ -1,11 +1,10 @@
1
- import type { Address } from '@xylabs/sdk-js';
2
- import { type Payload, type Schema } from '@xyo-network/sdk-protocol-js';
1
+ import { type Payload, type Schema, type XyoAddress } from '@xyo-network/sdk-protocol-js';
3
2
  import type { PayloadStatsDivinerParams } from './Params.ts';
4
3
  import { PayloadStatsDiviner } from './PayloadStatsDiviner.ts';
5
4
  export declare class MemoryPayloadStatsDiviner<TParams extends PayloadStatsDivinerParams = PayloadStatsDivinerParams> extends PayloadStatsDiviner<TParams> {
6
5
  static readonly configSchemas: Schema[];
7
6
  static readonly defaultConfigSchema: Schema;
8
- protected divineAddress(address: Address): Promise<number>;
7
+ protected divineAddress(address: XyoAddress): Promise<number>;
9
8
  protected divineAllAddresses(): Promise<number>;
10
9
  protected divineHandler(payloads?: Payload[]): Promise<Payload[]>;
11
10
  }
@@ -1 +1 @@
1
- {"version":3,"file":"MemoryPayloadStatsDiviner.d.ts","sourceRoot":"","sources":["../../src/MemoryPayloadStatsDiviner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAG7C,OAAO,EACU,KAAK,OAAO,EAAE,KAAK,MAAM,EACzC,MAAM,8BAA8B,CAAA;AAGrC,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAA;AAE5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAK9D,qBAAa,yBAAyB,CAAC,OAAO,SAAS,yBAAyB,GAAG,yBAAyB,CAAE,SAAQ,mBAAmB,CAAC,OAAO,CAAC;IAChJ,gBAAyB,aAAa,EAAE,MAAM,EAAE,CAA4D;IAC5G,gBAAyB,mBAAmB,EAAE,MAAM,CAAkC;cAEtE,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC;cAShD,kBAAkB,IAAI,OAAO,CAAC,MAAM,CAAC;cAM5B,aAAa,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;CAYjF"}
1
+ {"version":3,"file":"MemoryPayloadStatsDiviner.d.ts","sourceRoot":"","sources":["../../src/MemoryPayloadStatsDiviner.ts"],"names":[],"mappings":"AAEA,OAAO,EACU,KAAK,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,UAAU,EAC1D,MAAM,8BAA8B,CAAA;AAGrC,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAA;AAE5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAK9D,qBAAa,yBAAyB,CAAC,OAAO,SAAS,yBAAyB,GAAG,yBAAyB,CAAE,SAAQ,mBAAmB,CAAC,OAAO,CAAC;IAChJ,gBAAyB,aAAa,EAAE,MAAM,EAAE,CAA4D;IAC5G,gBAAyB,mBAAmB,EAAE,MAAM,CAAkC;cAEtE,aAAa,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC;cASnD,kBAAkB,IAAI,OAAO,CAAC,MAAM,CAAC;cAM5B,aAAa,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;CAYjF"}
@@ -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 type { Address } from '@xylabs/sdk-js'\nimport { assertEx } from '@xylabs/sdk-js'\nimport { isBoundWitness, PayloadBuilder } from '@xyo-network/sdk-protocol-js'\nimport {\n isStorageMeta, type Payload, type Schema,\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: Address): 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
- "mapp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ACF,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;;;AIzCO,IAAM,wBAAwB,CAAC,MAAiD,GAAG,WAAW;",
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,4BAA4B,SAAS,qCAAqC,IAAI;;;ADGpF,IAAM,kCAAkCC,UAAS,GAAG,yBAAyB,WAAW,IAAI;;;AELnG;AAAA,EACE,YAAAC;AAAA,OACK;AAIA,IAAM,0BAA0BC,UAAS,GAAG,yBAAyB,UAAU,IAAI;AAInF,IAAM,6BAA6B,CAAC,MAAsD,GAAG,WAAW;;;AHIxG,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 type { Address } from '@xylabs/sdk-js'\nimport { assertEx } from '@xylabs/sdk-js'\nimport { isBoundWitness, PayloadBuilder } from '@xyo-network/sdk-protocol-js'\nimport {\n isStorageMeta, type Payload, type Schema,\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: Address): 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": ";AACA,SAAS,gBAAgB;AACzB,SAAS,gBAAgB,sBAAsB;AAC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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;",
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,4BAA4B,SAAS,qCAAqC,IAAI;;;ADGpF,IAAM,kCAAkCC,UAAS,GAAG,yBAAyB,WAAW,IAAI;;;AELnG,SAAS,uBAAuB;AAMzB,IAAe,sBAAf,cASG,gBAAgD;AAAC;;;ACf3D;AAAA,EACE,YAAAC;AAAA,OACK;AAIA,IAAM,0BAA0BC,UAAS,GAAG,yBAAyB,UAAU,IAAI;AAInF,IAAM,6BAA6B,CAAC,MAAsD,GAAG,WAAW;;;AJIxG,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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xyo-network/diviner-payload-stats",
3
- "version": "6.0.1",
3
+ "version": "6.0.2",
4
4
  "description": "Primary SDK for using XYO Protocol 2.0",
5
5
  "homepage": "https://xyo.network",
6
6
  "bugs": {
@@ -46,41 +46,38 @@
46
46
  "README.md"
47
47
  ],
48
48
  "dependencies": {
49
- "@xyo-network/diviner-abstract": "~6.0.1",
50
- "@xyo-network/diviner-model": "~6.0.1",
51
- "@xyo-network/module-model": "~6.0.1"
49
+ "@xyo-network/diviner-abstract": "~6.0.2",
50
+ "@xyo-network/diviner-model": "~6.0.2",
51
+ "@xyo-network/module-model": "~6.0.2"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@bitauth/libauth": "~3.0.0",
55
- "@metamask/providers": "^22.1",
55
+ "@metamask/providers": "^22.1.1",
56
56
  "@noble/post-quantum": "~0.6.1",
57
57
  "@opentelemetry/api": "^1.9.1",
58
58
  "@opentelemetry/sdk-trace-base": "^2.7.1",
59
59
  "@scure/base": "~2.2.0",
60
- "@scure/bip39": "~2.2",
61
- "@xylabs/geo": "^6.0",
62
- "@xylabs/sdk-js": "^6.0.4",
63
- "@xylabs/threads": "~6.0.4",
64
- "@xylabs/toolchain": "~8.1.6",
65
- "@xylabs/tsconfig": "~8.1.6",
66
- "@xyo-network/sdk-protocol-js": "~6.0.5",
67
- "ajv": "^8.20",
60
+ "@scure/bip39": "~2.2.0",
61
+ "@xylabs/geo": "^6.0.6",
62
+ "@xylabs/sdk-js": "^6.0.6",
63
+ "@xylabs/threads": "^6.0.6",
64
+ "@xylabs/toolchain": "~8.1.8",
65
+ "@xylabs/tsconfig": "~8.1.8",
66
+ "@xyo-network/sdk-protocol-js": "~6.0.7",
67
+ "ajv": "^8.20.0",
68
68
  "async-mutex": "^0.5.0",
69
69
  "bn.js": "^5.2.3",
70
70
  "buffer": "^6.0.3",
71
71
  "debug": "~4.4.3",
72
- "eslint": "^10.4.0",
72
+ "eslint": "^10.4.1",
73
73
  "ethers": "^6.16.0",
74
74
  "hash-wasm": "~4.12.0",
75
- "idb": "^8.0",
75
+ "idb": "^8.0.3",
76
76
  "lru-cache": "^11.5.1",
77
- "mapbox-gl": "^3.23",
78
77
  "observable-fns": "~0.6.1",
79
78
  "pako": "~2.1.0",
80
- "store2": "~2.14",
81
79
  "typescript": "~6.0.3",
82
- "wasm-feature-detect": "~1.8.0",
83
- "webextension-polyfill": "^0.12",
80
+ "webextension-polyfill": "^0.12.0",
84
81
  "zod": "^4.4.3"
85
82
  },
86
83
  "peerDependencies": {
@@ -93,7 +90,7 @@
93
90
  "@scure/bip39": "~2.2",
94
91
  "@xylabs/geo": "^6.0",
95
92
  "@xylabs/sdk-js": "^6.0",
96
- "@xylabs/threads": "~6.0",
93
+ "@xylabs/threads": "^6.0",
97
94
  "@xyo-network/sdk-protocol-js": "~6.0",
98
95
  "ajv": "^8.20",
99
96
  "async-mutex": "^0.5",
@@ -104,11 +101,8 @@
104
101
  "hash-wasm": "~4.12",
105
102
  "idb": "^8.0",
106
103
  "lru-cache": "^11.3",
107
- "mapbox-gl": "^3.23",
108
104
  "observable-fns": "~0.6",
109
105
  "pako": "~2.1",
110
- "store2": "~2.14",
111
- "wasm-feature-detect": "~1.8",
112
106
  "webextension-polyfill": "^0.12",
113
107
  "zod": "^4.4"
114
108
  },