@xyo-network/diviner-boundwitness-memory 2.110.13 → 2.110.15

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.
Files changed (32) hide show
  1. package/dist/browser/MemoryBoundWitnessDiviner.d.cts +1 -3
  2. package/dist/browser/MemoryBoundWitnessDiviner.d.cts.map +1 -1
  3. package/dist/browser/MemoryBoundWitnessDiviner.d.mts +1 -3
  4. package/dist/browser/MemoryBoundWitnessDiviner.d.mts.map +1 -1
  5. package/dist/browser/MemoryBoundWitnessDiviner.d.ts +1 -3
  6. package/dist/browser/MemoryBoundWitnessDiviner.d.ts.map +1 -1
  7. package/dist/browser/index.cjs +0 -5
  8. package/dist/browser/index.cjs.map +1 -1
  9. package/dist/browser/index.js +1 -6
  10. package/dist/browser/index.js.map +1 -1
  11. package/dist/neutral/MemoryBoundWitnessDiviner.d.cts +1 -3
  12. package/dist/neutral/MemoryBoundWitnessDiviner.d.cts.map +1 -1
  13. package/dist/neutral/MemoryBoundWitnessDiviner.d.mts +1 -3
  14. package/dist/neutral/MemoryBoundWitnessDiviner.d.mts.map +1 -1
  15. package/dist/neutral/MemoryBoundWitnessDiviner.d.ts +1 -3
  16. package/dist/neutral/MemoryBoundWitnessDiviner.d.ts.map +1 -1
  17. package/dist/neutral/index.cjs +0 -5
  18. package/dist/neutral/index.cjs.map +1 -1
  19. package/dist/neutral/index.js +1 -6
  20. package/dist/neutral/index.js.map +1 -1
  21. package/dist/node/MemoryBoundWitnessDiviner.d.cts +1 -3
  22. package/dist/node/MemoryBoundWitnessDiviner.d.cts.map +1 -1
  23. package/dist/node/MemoryBoundWitnessDiviner.d.mts +1 -3
  24. package/dist/node/MemoryBoundWitnessDiviner.d.mts.map +1 -1
  25. package/dist/node/MemoryBoundWitnessDiviner.d.ts +1 -3
  26. package/dist/node/MemoryBoundWitnessDiviner.d.ts.map +1 -1
  27. package/dist/node/index.cjs +0 -10
  28. package/dist/node/index.cjs.map +1 -1
  29. package/dist/node/index.js +1 -11
  30. package/dist/node/index.js.map +1 -1
  31. package/package.json +16 -16
  32. package/src/MemoryBoundWitnessDiviner.ts +1 -5
@@ -1,7 +1,7 @@
1
1
  import { BoundWitness } from '@xyo-network/boundwitness-model';
2
2
  import { BoundWitnessDiviner } from '@xyo-network/diviner-boundwitness-abstract';
3
3
  import { BoundWitnessDivinerParams, BoundWitnessDivinerQueryPayload } from '@xyo-network/diviner-boundwitness-model';
4
- import { Schema, WithMeta } from '@xyo-network/payload-model';
4
+ import { WithMeta } from '@xyo-network/payload-model';
5
5
  export interface EqualityComparisonOperators {
6
6
  '!=': string;
7
7
  '<': string;
@@ -11,8 +11,6 @@ export interface EqualityComparisonOperators {
11
11
  '>=': string;
12
12
  }
13
13
  export declare class MemoryBoundWitnessDiviner<TParams extends BoundWitnessDivinerParams = BoundWitnessDivinerParams, TIn extends BoundWitnessDivinerQueryPayload = BoundWitnessDivinerQueryPayload, TOut extends BoundWitness = BoundWitness> extends BoundWitnessDiviner<TParams, TIn, TOut> {
14
- static readonly configSchemas: Schema[];
15
- static readonly defaultConfigSchema: Schema;
16
14
  protected divineHandler(payloads?: TIn[]): Promise<WithMeta<TOut>[]>;
17
15
  }
18
16
  //# sourceMappingURL=MemoryBoundWitnessDiviner.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MemoryBoundWitnessDiviner.d.ts","sourceRoot":"","sources":["../../src/MemoryBoundWitnessDiviner.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAkB,MAAM,iCAAiC,CAAA;AAC9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,4CAA4C,CAAA;AAChF,OAAO,EAEL,yBAAyB,EACzB,+BAA+B,EAEhC,MAAM,yCAAyC,CAAA;AAChD,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAE7D,MAAM,WAAW,2BAA2B;IAO1C,IAAI,EAAE,MAAM,CAAA;IAQZ,GAAG,EAAE,MAAM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C;cAEtB,aAAa,CAAC,QAAQ,CAAC,EAAE,GAAG,EAAE;CAoCxD"}
@@ -1,7 +1,7 @@
1
1
  import { BoundWitness } from '@xyo-network/boundwitness-model';
2
2
  import { BoundWitnessDiviner } from '@xyo-network/diviner-boundwitness-abstract';
3
3
  import { BoundWitnessDivinerParams, BoundWitnessDivinerQueryPayload } from '@xyo-network/diviner-boundwitness-model';
4
- import { Schema, WithMeta } from '@xyo-network/payload-model';
4
+ import { WithMeta } from '@xyo-network/payload-model';
5
5
  export interface EqualityComparisonOperators {
6
6
  '!=': string;
7
7
  '<': string;
@@ -11,8 +11,6 @@ export interface EqualityComparisonOperators {
11
11
  '>=': string;
12
12
  }
13
13
  export declare class MemoryBoundWitnessDiviner<TParams extends BoundWitnessDivinerParams = BoundWitnessDivinerParams, TIn extends BoundWitnessDivinerQueryPayload = BoundWitnessDivinerQueryPayload, TOut extends BoundWitness = BoundWitness> extends BoundWitnessDiviner<TParams, TIn, TOut> {
14
- static readonly configSchemas: Schema[];
15
- static readonly defaultConfigSchema: Schema;
16
14
  protected divineHandler(payloads?: TIn[]): Promise<WithMeta<TOut>[]>;
17
15
  }
18
16
  //# sourceMappingURL=MemoryBoundWitnessDiviner.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MemoryBoundWitnessDiviner.d.ts","sourceRoot":"","sources":["../../src/MemoryBoundWitnessDiviner.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAkB,MAAM,iCAAiC,CAAA;AAC9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,4CAA4C,CAAA;AAChF,OAAO,EAEL,yBAAyB,EACzB,+BAA+B,EAEhC,MAAM,yCAAyC,CAAA;AAChD,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAE7D,MAAM,WAAW,2BAA2B;IAO1C,IAAI,EAAE,MAAM,CAAA;IAQZ,GAAG,EAAE,MAAM,CAAA;IAQX,IAAI,EAAE,MAAM,CAAA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AAE,GAAG,EAAE;CAoCxD"}
@@ -1,7 +1,7 @@
1
1
  import { BoundWitness } from '@xyo-network/boundwitness-model';
2
2
  import { BoundWitnessDiviner } from '@xyo-network/diviner-boundwitness-abstract';
3
3
  import { BoundWitnessDivinerParams, BoundWitnessDivinerQueryPayload } from '@xyo-network/diviner-boundwitness-model';
4
- import { Schema, WithMeta } from '@xyo-network/payload-model';
4
+ import { WithMeta } from '@xyo-network/payload-model';
5
5
  export interface EqualityComparisonOperators {
6
6
  '!=': string;
7
7
  '<': string;
@@ -11,8 +11,6 @@ export interface EqualityComparisonOperators {
11
11
  '>=': string;
12
12
  }
13
13
  export declare class MemoryBoundWitnessDiviner<TParams extends BoundWitnessDivinerParams = BoundWitnessDivinerParams, TIn extends BoundWitnessDivinerQueryPayload = BoundWitnessDivinerQueryPayload, TOut extends BoundWitness = BoundWitness> extends BoundWitnessDiviner<TParams, TIn, TOut> {
14
- static readonly configSchemas: Schema[];
15
- static readonly defaultConfigSchema: Schema;
16
14
  protected divineHandler(payloads?: TIn[]): Promise<WithMeta<TOut>[]>;
17
15
  }
18
16
  //# sourceMappingURL=MemoryBoundWitnessDiviner.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MemoryBoundWitnessDiviner.d.ts","sourceRoot":"","sources":["../../src/MemoryBoundWitnessDiviner.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAkB,MAAM,iCAAiC,CAAA;AAC9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,4CAA4C,CAAA;AAChF,OAAO,EAEL,yBAAyB,EACzB,+BAA+B,EAEhC,MAAM,yCAAyC,CAAA;AAChD,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAE7D,MAAM,WAAW,2BAA2B;IAO1C,IAAI,EAAE,MAAM,CAAA;IAQZ,GAAG,EAAE,MAAM,CAAA;IAQX,IAAI,EAAE,MAAM,CAAA;IAQZ,GAAG,EAAE,MAAM,CAAA;IAQ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 +38,6 @@ var MemoryBoundWitnessDiviner = class extends import_diviner_boundwitness_abstra
38
38
  static {
39
39
  __name(this, "MemoryBoundWitnessDiviner");
40
40
  }
41
- static configSchemas = [
42
- ...super.configSchemas,
43
- import_diviner_boundwitness_model.BoundWitnessDivinerConfigSchema
44
- ];
45
- static defaultConfigSchema = import_diviner_boundwitness_model.BoundWitnessDivinerConfigSchema;
46
41
  // eslint-disable-next-line complexity
47
42
  async divineHandler(payloads) {
48
43
  const filter = (0, import_assert.assertEx)(payloads?.filter(import_diviner_boundwitness_model.isBoundWitnessDivinerQueryPayload)?.pop(), () => "Missing query payload");
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts","../../src/MemoryBoundWitnessDiviner.ts"],"sourcesContent":["export * from './MemoryBoundWitnessDiviner.js'\n","import { containsAll } from '@xylabs/array'\nimport { assertEx } from '@xylabs/assert'\nimport { exists } from '@xylabs/exists'\nimport { hexFromHexString } from '@xylabs/hex'\nimport { BoundWitness, isBoundWitness } from '@xyo-network/boundwitness-model'\nimport { BoundWitnessDiviner } from '@xyo-network/diviner-boundwitness-abstract'\nimport {\n BoundWitnessDivinerConfigSchema,\n BoundWitnessDivinerParams,\n BoundWitnessDivinerQueryPayload,\n isBoundWitnessDivinerQueryPayload,\n} from '@xyo-network/diviner-boundwitness-model'\nimport { Schema, WithMeta } from '@xyo-network/payload-model'\n\nexport interface EqualityComparisonOperators {\n /**\n * 'Not Equal To' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value does not match the provided string.\n * Example: field != 'value'\n */\n '!=': string\n\n /**\n * 'Less Than' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value is lexicographically less than the provided string.\n * Example: field < 'value'\n */\n '<': string\n\n /**\n * 'Less Than or Equal To' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value is lexicographically less than or equal to the provided string.\n * Example: field <= 'value'\n */\n '<=': string\n\n /**\n * 'Equal To' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value matches the provided string exactly.\n * Example: field = 'value'\n */\n '=': string\n\n /**\n * 'Greater Than' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value is lexicographically greater than the provided string.\n * Example: field > 'value'\n */\n '>': string\n\n /**\n * 'Greater Than or Equal To' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value is lexicographically greater than or equal to the provided string.\n * Example: field >= 'value'\n */\n '>=': string\n}\n\ntype WithTimestamp = BoundWitness & { timestamp: number }\nconst hasTimestamp = (bw: BoundWitness): bw is WithTimestamp => bw.timestamp !== undefined\n\nexport class MemoryBoundWitnessDiviner<\n TParams extends BoundWitnessDivinerParams = BoundWitnessDivinerParams,\n TIn extends BoundWitnessDivinerQueryPayload = BoundWitnessDivinerQueryPayload,\n TOut extends BoundWitness = BoundWitness,\n> extends BoundWitnessDiviner<TParams, TIn, TOut> {\n static override readonly configSchemas: Schema[] = [...super.configSchemas, BoundWitnessDivinerConfigSchema]\n static override readonly defaultConfigSchema: Schema = BoundWitnessDivinerConfigSchema\n\n // eslint-disable-next-line complexity\n protected override async divineHandler(payloads?: TIn[]) {\n const filter = assertEx(payloads?.filter(isBoundWitnessDivinerQueryPayload)?.pop(), () => 'Missing query payload')\n if (!filter) return []\n const archivist = assertEx(await this.archivistInstance(), () => 'Unable to resolve archivist')\n const { addresses, payload_hashes, payload_schemas, limit, offset, order = 'desc', sourceQuery, destination, timestamp } = filter\n let bws = ((await archivist?.all?.()) ?? []).filter(isBoundWitness) as WithMeta<BoundWitness>[]\n if (order === 'desc') bws = bws.reverse()\n const allAddresses = addresses?.map((address) => hexFromHexString(address)).filter(exists)\n if (allAddresses?.length) bws = bws.filter((bw) => containsAll(bw.addresses, allAddresses))\n if (payload_hashes?.length) bws = bws.filter((bw) => containsAll(bw.payload_hashes, payload_hashes))\n if (payload_schemas?.length) bws = bws.filter((bw) => containsAll(bw.payload_schemas, payload_schemas))\n if (sourceQuery) bws = bws.filter((bw) => (bw?.$meta as { sourceQuery?: string })?.sourceQuery === sourceQuery)\n // If there's a destination filter of the right kind\n if (destination && Array.isArray(destination) && destination?.length > 0) {\n const targetFilter = assertEx(destination, () => 'Missing destination')\n // Find all BWs that satisfy the destination constraint\n bws = bws.filter((bw) => {\n const targetDestinationField = (bw?.$meta as { destination?: string[] })?.destination\n // If the destination field is an array and contains at least one element\n return targetDestinationField !== undefined && Array.isArray(targetDestinationField) && targetDestinationField.length > 0 ?\n // Check that the targetDestinationField contains all the elements in the targetFilter\n containsAll(targetFilter, targetDestinationField ?? [])\n // Otherwise, filter it out\n : false\n })\n }\n if (timestamp !== undefined) {\n bws =\n order === 'desc' ?\n bws.filter(hasTimestamp).filter((bw) => bw.timestamp <= timestamp)\n : bws.filter(hasTimestamp).filter((bw) => bw.timestamp >= timestamp)\n }\n const parsedLimit = limit ?? bws.length\n const parsedOffset = offset ?? 0\n return bws.slice(parsedOffset, parsedLimit) as WithMeta<TOut>[]\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;ACAA,mBAA4B;AAC5B,oBAAyB;AACzB,oBAAuB;AACvB,iBAAiC;AACjC,gCAA6C;AAC7C,2CAAoC;AACpC,wCAKO;AAsDP,IAAMA,eAAe,wBAACC,OAA0CA,GAAGC,cAAcC,QAA5D;AAEd,IAAMC,4BAAN,cAIGC,yDAAAA;EAvEV,OAuEUA;;;EACR,OAAyBC,gBAA0B;OAAI,MAAMA;IAAeC;;EAC5E,OAAyBC,sBAA8BD;;EAGvD,MAAyBE,cAAcC,UAAkB;AACvD,UAAMC,aAASC,wBAASF,UAAUC,OAAOE,mEAAAA,GAAoCC,IAAAA,GAAO,MAAM,uBAAA;AAC1F,QAAI,CAACH,OAAQ,QAAO,CAAA;AACpB,UAAMI,gBAAYH,wBAAS,MAAM,KAAKI,kBAAiB,GAAI,MAAM,6BAAA;AACjE,UAAM,EAAEC,WAAWC,gBAAgBC,iBAAiBC,OAAOC,QAAQC,QAAQ,QAAQC,aAAaC,aAAatB,UAAS,IAA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Q,eAAerB,UAAU;AAC/B,WAAOI,IAAIkB,MAAMD,cAAcD,WAAAA;EACjC;AACF;","names":["hasTimestamp","bw","timestamp","undefined","MemoryBoundWitnessDiviner","BoundWitnessDiviner","configSchemas","BoundWitnessDivinerConfigSchema","defaultConfigSchema","divineHandler","payloads","filter","assertEx","isBoundWitnessDivinerQueryPayload","pop","archivist","archivistInstance","addresses","payload_hashes","payload_schemas","limit","offset","order","sourceQuery","destination","bws","all","isBoundWitness","reverse","allAddresses","map","address","hexFromHexString","exists","length","containsAll","$meta","Array","isArray","targetFilter","targetDestinationField","parsedLimit","parsedOffset","slice"]}
1
+ {"version":3,"sources":["../../src/index.ts","../../src/MemoryBoundWitnessDiviner.ts"],"sourcesContent":["export * from './MemoryBoundWitnessDiviner.js'\n","import { containsAll } from '@xylabs/array'\nimport { assertEx } from '@xylabs/assert'\nimport { exists } from '@xylabs/exists'\nimport { hexFromHexString } from '@xylabs/hex'\nimport { BoundWitness, isBoundWitness } from '@xyo-network/boundwitness-model'\nimport { BoundWitnessDiviner } from '@xyo-network/diviner-boundwitness-abstract'\nimport {\n BoundWitnessDivinerParams,\n BoundWitnessDivinerQueryPayload,\n isBoundWitnessDivinerQueryPayload,\n} from '@xyo-network/diviner-boundwitness-model'\nimport { WithMeta } from '@xyo-network/payload-model'\n\nexport interface EqualityComparisonOperators {\n /**\n * 'Not Equal To' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value does not match the provided string.\n * Example: field != 'value'\n */\n '!=': string\n\n /**\n * 'Less Than' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value is lexicographically less than the provided string.\n * Example: field < 'value'\n */\n '<': string\n\n /**\n * 'Less Than or Equal To' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value is lexicographically less than or equal to the provided string.\n * Example: field <= 'value'\n */\n '<=': string\n\n /**\n * 'Equal To' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value matches the provided string exactly.\n * Example: field = 'value'\n */\n '=': string\n\n /**\n * 'Greater Than' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value is lexicographically greater than the provided string.\n * Example: field > 'value'\n */\n '>': string\n\n /**\n * 'Greater Than or Equal To' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value is lexicographically greater than or equal to the provided string.\n * Example: field >= 'value'\n */\n '>=': string\n}\n\ntype WithTimestamp = BoundWitness & { timestamp: number }\nconst hasTimestamp = (bw: BoundWitness): bw is WithTimestamp => bw.timestamp !== undefined\n\nexport class MemoryBoundWitnessDiviner<\n TParams extends BoundWitnessDivinerParams = BoundWitnessDivinerParams,\n TIn extends BoundWitnessDivinerQueryPayload = BoundWitnessDivinerQueryPayload,\n TOut extends BoundWitness = BoundWitness,\n> extends BoundWitnessDiviner<TParams, TIn, TOut> {\n // eslint-disable-next-line complexity\n protected override async divineHandler(payloads?: TIn[]) {\n const filter = assertEx(payloads?.filter(isBoundWitnessDivinerQueryPayload)?.pop(), () => 'Missing query payload')\n if (!filter) return []\n const archivist = assertEx(await this.archivistInstance(), () => 'Unable to resolve archivist')\n const { addresses, payload_hashes, payload_schemas, limit, offset, order = 'desc', sourceQuery, destination, timestamp } = filter\n let bws = ((await archivist?.all?.()) ?? []).filter(isBoundWitness) as WithMeta<BoundWitness>[]\n if (order === 'desc') bws = bws.reverse()\n const allAddresses = addresses?.map((address) => hexFromHexString(address)).filter(exists)\n if (allAddresses?.length) bws = bws.filter((bw) => containsAll(bw.addresses, allAddresses))\n if (payload_hashes?.length) bws = bws.filter((bw) => containsAll(bw.payload_hashes, payload_hashes))\n if (payload_schemas?.length) bws = bws.filter((bw) => containsAll(bw.payload_schemas, payload_schemas))\n if (sourceQuery) bws = bws.filter((bw) => (bw?.$meta as { sourceQuery?: string })?.sourceQuery === sourceQuery)\n // If there's a destination filter of the right kind\n if (destination && Array.isArray(destination) && destination?.length > 0) {\n const targetFilter = assertEx(destination, () => 'Missing destination')\n // Find all BWs that satisfy the destination constraint\n bws = bws.filter((bw) => {\n const targetDestinationField = (bw?.$meta as { destination?: string[] })?.destination\n // If the destination field is an array and contains at least one element\n return targetDestinationField !== undefined && Array.isArray(targetDestinationField) && targetDestinationField.length > 0 ?\n // Check that the targetDestinationField contains all the elements in the targetFilter\n containsAll(targetFilter, targetDestinationField ?? [])\n // Otherwise, filter it out\n : false\n })\n }\n if (timestamp !== undefined) {\n bws =\n order === 'desc' ?\n bws.filter(hasTimestamp).filter((bw) => bw.timestamp <= timestamp)\n : bws.filter(hasTimestamp).filter((bw) => bw.timestamp >= timestamp)\n }\n const parsedLimit = limit ?? bws.length\n const parsedOffset = offset ?? 0\n return bws.slice(parsedOffset, parsedLimit) as WithMeta<TOut>[]\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;ACAA,mBAA4B;AAC5B,oBAAyB;AACzB,oBAAuB;AACvB,iBAAiC;AACjC,gCAA6C;AAC7C,2CAAoC;AACpC,wCAIO;AAsDP,IAAMA,eAAe,wBAACC,OAA0CA,GAAGC,cAAcC,QAA5D;AAEd,IAAMC,4BAAN,cAIGC,yDAAAA;EAtEV,OAsEUA;;;;EAER,MAAyBC,cAAcC,UAAkB;AACvD,UAAMC,aAASC,wBAASF,UAAUC,OAAOE,mEAAAA,GAAoCC,IAAAA,GAAO,MAAM,uBAAA;AAC1F,QAAI,CAACH,OAAQ,QAAO,CAAA;AACpB,UAAMI,gBAAYH,wBAAS,MAAM,KAAKI,kBAAiB,GAAI,MAAM,6BAAA;AACjE,UAAM,EAAEC,WAAWC,gBAAgBC,iBAAiBC,OAAOC,QAAQC,QAAQ,QAAQC,aAAaC,aAAanB,UAAS,IAAKM;AAC3H,QAAIc,OAAQ,MAAMV,WAAWW,MAAAA,KAAY,CAAA,GAAIf,OAAOgB,wCAAAA;AACpD,QAAIL,UAAU,OAAQG,OAAMA,IAAIG,QAAO;AACvC,UAAMC,eAAeZ,WAAWa,IAAI,CAACC,gBAAYC,6BAAiBD,OAAAA,CAAAA,EAAUpB,OAAOsB,oBAAAA;AACnF,QAAIJ,cAAcK,OAAQT,OAAMA,IAAId,OAAO,CAACP,WAAO+B,0BAAY/B,GAAGa,WAAWY,YAAAA,CAAAA;AAC7E,QAAIX,gBAAgBgB,OAAQT,OAAMA,IAAId,OAAO,CAACP,WAAO+B,0BAAY/B,GAAGc,gBAAgBA,cAAAA,CAAAA;AACpF,QAAIC,iBAAiBe,OAAQT,OAAMA,IAAId,OAAO,CAACP,WAAO+B,0BAAY/B,GAAGe,iBAAiBA,eAAAA,CAAAA;AACtF,QAAII,YAAaE,OAAMA,IAAId,OAAO,CAACP,OAAQA,IAAIgC,OAAoCb,gBAAgBA,WAAAA;AAEnG,QAAIC,eAAea,MAAMC,QAAQd,WAAAA,KAAgBA,aAAaU,SAAS,GAAG;AACxE,YAAMK,mBAAe3B,wBAASY,aAAa,MAAM,qBAAA;AAEjDC,YAAMA,IAAId,OAAO,CAACP,OAAAA;AAChB,cAAMoC,yBAA0BpC,IAAIgC,OAAsCZ;AAE1E,eAAOgB,2BAA2BlC,UAAa+B,MAAMC,QAAQE,sBAAAA,KAA2BA,uBAAuBN,SAAS;;cAEpHC,0BAAYI,cAAcC,0BAA0B,CAAA,CAAE;YAEtD;MACN,CAAA;IACF;AACA,QAAInC,cAAcC,QAAW;AAC3BmB,YACEH,UAAU,SACRG,IAAId,OAAOR,YAAAA,EAAcQ,OAAO,CAACP,OAAOA,GAAGC,aAAaA,SAAAA,IACxDoB,IAAId,OAAOR,YAAAA,EAAcQ,OAAO,CAACP,OAAOA,GAAGC,aAAaA,SAAAA;IAC9D;AACA,UAAMoC,cAAcrB,SAASK,IAAIS;AACjC,UAAMQ,eAAerB,UAAU;AAC/B,WAAOI,IAAIkB,MAAMD,cAAcD,WAAAA;EACjC;AACF;","names":["hasTimestamp","bw","timestamp","undefined","MemoryBoundWitnessDiviner","BoundWitnessDiviner","divineHandler","payloads","filter","assertEx","isBoundWitnessDivinerQueryPayload","pop","archivist","archivistInstance","addresses","payload_hashes","payload_schemas","limit","offset","order","sourceQuery","destination","bws","all","isBoundWitness","reverse","allAddresses","map","address","hexFromHexString","exists","length","containsAll","$meta","Array","isArray","targetFilter","targetDestinationField","parsedLimit","parsedOffset","slice"]}
@@ -8,17 +8,12 @@ import { exists } from "@xylabs/exists";
8
8
  import { hexFromHexString } from "@xylabs/hex";
9
9
  import { isBoundWitness } from "@xyo-network/boundwitness-model";
10
10
  import { BoundWitnessDiviner } from "@xyo-network/diviner-boundwitness-abstract";
11
- import { BoundWitnessDivinerConfigSchema, isBoundWitnessDivinerQueryPayload } from "@xyo-network/diviner-boundwitness-model";
11
+ import { isBoundWitnessDivinerQueryPayload } from "@xyo-network/diviner-boundwitness-model";
12
12
  var hasTimestamp = /* @__PURE__ */ __name((bw) => bw.timestamp !== void 0, "hasTimestamp");
13
13
  var MemoryBoundWitnessDiviner = class extends BoundWitnessDiviner {
14
14
  static {
15
15
  __name(this, "MemoryBoundWitnessDiviner");
16
16
  }
17
- static configSchemas = [
18
- ...super.configSchemas,
19
- BoundWitnessDivinerConfigSchema
20
- ];
21
- static defaultConfigSchema = BoundWitnessDivinerConfigSchema;
22
17
  // eslint-disable-next-line complexity
23
18
  async divineHandler(payloads) {
24
19
  const filter = assertEx(payloads?.filter(isBoundWitnessDivinerQueryPayload)?.pop(), () => "Missing query payload");
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/MemoryBoundWitnessDiviner.ts"],"sourcesContent":["import { containsAll } from '@xylabs/array'\nimport { assertEx } from '@xylabs/assert'\nimport { exists } from '@xylabs/exists'\nimport { hexFromHexString } from '@xylabs/hex'\nimport { BoundWitness, isBoundWitness } from '@xyo-network/boundwitness-model'\nimport { BoundWitnessDiviner } from '@xyo-network/diviner-boundwitness-abstract'\nimport {\n BoundWitnessDivinerConfigSchema,\n BoundWitnessDivinerParams,\n BoundWitnessDivinerQueryPayload,\n isBoundWitnessDivinerQueryPayload,\n} from '@xyo-network/diviner-boundwitness-model'\nimport { Schema, WithMeta } from '@xyo-network/payload-model'\n\nexport interface EqualityComparisonOperators {\n /**\n * 'Not Equal To' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value does not match the provided string.\n * Example: field != 'value'\n */\n '!=': string\n\n /**\n * 'Less Than' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value is lexicographically less than the provided string.\n * Example: field < 'value'\n */\n '<': string\n\n /**\n * 'Less Than or Equal To' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value is lexicographically less than or equal to the provided string.\n * Example: field <= 'value'\n */\n '<=': string\n\n /**\n * 'Equal To' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value matches the provided string exactly.\n * Example: field = 'value'\n */\n '=': string\n\n /**\n * 'Greater Than' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value is lexicographically greater than the provided string.\n * Example: field > 'value'\n */\n '>': string\n\n /**\n * 'Greater Than or Equal To' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value is lexicographically greater than or equal to the provided string.\n * Example: field >= 'value'\n */\n '>=': string\n}\n\ntype WithTimestamp = BoundWitness & { timestamp: number }\nconst hasTimestamp = (bw: BoundWitness): bw is WithTimestamp => bw.timestamp !== undefined\n\nexport class MemoryBoundWitnessDiviner<\n TParams extends BoundWitnessDivinerParams = BoundWitnessDivinerParams,\n TIn extends BoundWitnessDivinerQueryPayload = BoundWitnessDivinerQueryPayload,\n TOut extends BoundWitness = BoundWitness,\n> extends BoundWitnessDiviner<TParams, TIn, TOut> {\n static override readonly configSchemas: Schema[] = [...super.configSchemas, BoundWitnessDivinerConfigSchema]\n static override readonly defaultConfigSchema: Schema = BoundWitnessDivinerConfigSchema\n\n // eslint-disable-next-line complexity\n protected override async divineHandler(payloads?: TIn[]) {\n const filter = assertEx(payloads?.filter(isBoundWitnessDivinerQueryPayload)?.pop(), () => 'Missing query payload')\n if (!filter) return []\n const archivist = assertEx(await this.archivistInstance(), () => 'Unable to resolve archivist')\n const { addresses, payload_hashes, payload_schemas, limit, offset, order = 'desc', sourceQuery, destination, timestamp } = filter\n let bws = ((await archivist?.all?.()) ?? []).filter(isBoundWitness) as WithMeta<BoundWitness>[]\n if (order === 'desc') bws = bws.reverse()\n const allAddresses = addresses?.map((address) => hexFromHexString(address)).filter(exists)\n if (allAddresses?.length) bws = bws.filter((bw) => containsAll(bw.addresses, allAddresses))\n if (payload_hashes?.length) bws = bws.filter((bw) => containsAll(bw.payload_hashes, payload_hashes))\n if (payload_schemas?.length) bws = bws.filter((bw) => containsAll(bw.payload_schemas, payload_schemas))\n if (sourceQuery) bws = bws.filter((bw) => (bw?.$meta as { sourceQuery?: string })?.sourceQuery === sourceQuery)\n // If there's a destination filter of the right kind\n if (destination && Array.isArray(destination) && destination?.length > 0) {\n const targetFilter = assertEx(destination, () => 'Missing destination')\n // Find all BWs that satisfy the destination constraint\n bws = bws.filter((bw) => {\n const targetDestinationField = (bw?.$meta as { destination?: string[] })?.destination\n // If the destination field is an array and contains at least one element\n return targetDestinationField !== undefined && Array.isArray(targetDestinationField) && targetDestinationField.length > 0 ?\n // Check that the targetDestinationField contains all the elements in the targetFilter\n containsAll(targetFilter, targetDestinationField ?? [])\n // Otherwise, filter it out\n : false\n })\n }\n if (timestamp !== undefined) {\n bws =\n order === 'desc' ?\n bws.filter(hasTimestamp).filter((bw) => bw.timestamp <= timestamp)\n : bws.filter(hasTimestamp).filter((bw) => bw.timestamp >= timestamp)\n }\n const parsedLimit = limit ?? bws.length\n const parsedOffset = offset ?? 0\n return bws.slice(parsedOffset, parsedLimit) as WithMeta<TOut>[]\n }\n}\n"],"mappings":";;;;AAAA,SAASA,mBAAmB;AAC5B,SAASC,gBAAgB;AACzB,SAASC,cAAc;AACvB,SAASC,wBAAwB;AACjC,SAAuBC,sBAAsB;AAC7C,SAASC,2BAA2B;AACpC,SACEC,iCAGAC,yCACK;AAsDP,IAAMC,eAAe,wBAACC,OAA0CA,GAAGC,cAAcC,QAA5D;AAEd,IAAMC,4BAAN,cAIGC,oBAAAA;EAvEV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OgB,2BAA2BrC,UAAakC,MAAMC,QAAQE,sBAAAA,KAA2BA,uBAAuBN,SAAS;;UAEpHC,YAAYI,cAAcC,0BAA0B,CAAA,CAAE;YAEtD;MACN,CAAA;IACF;AACA,QAAItC,cAAcC,QAAW;AAC3BsB,YACEH,UAAU,SACRG,IAAId,OAAOX,YAAAA,EAAcW,OAAO,CAACV,OAAOA,GAAGC,aAAaA,SAAAA,IACxDuB,IAAId,OAAOX,YAAAA,EAAcW,OAAO,CAACV,OAAOA,GAAGC,aAAaA,SAAAA;IAC9D;AACA,UAAMuC,cAAcrB,SAASK,IAAIS;AACjC,UAAMQ,eAAerB,UAAU;AAC/B,WAAOI,IAAIkB,MAAMD,cAAcD,WAAAA;EACjC;AACF;","names":["containsAll","assertEx","exists","hexFromHexString","isBoundWitness","BoundWitnessDiviner","BoundWitnessDivinerConfigSchema","isBoundWitnessDivinerQueryPayload","hasTimestamp","bw","timestamp","undefined","MemoryBoundWitnessDiviner","BoundWitnessDiviner","configSchemas","BoundWitnessDivinerConfigSchema","defaultConfigSchema","divineHandler","payloads","filter","assertEx","isBoundWitnessDivinerQueryPayload","pop","archivist","archivistInstance","addresses","payload_hashes","payload_schemas","limit","offset","order","sourceQuery","destination","bws","all","isBoundWitness","reverse","allAddresses","map","address","hexFromHexString","exists","length","containsAll","$meta","Array","isArray","targetFilter","targetDestinationField","parsedLimit","parsedOffset","slice"]}
1
+ {"version":3,"sources":["../../src/MemoryBoundWitnessDiviner.ts"],"sourcesContent":["import { containsAll } from '@xylabs/array'\nimport { assertEx } from '@xylabs/assert'\nimport { exists } from '@xylabs/exists'\nimport { hexFromHexString } from '@xylabs/hex'\nimport { BoundWitness, isBoundWitness } from '@xyo-network/boundwitness-model'\nimport { BoundWitnessDiviner } from '@xyo-network/diviner-boundwitness-abstract'\nimport {\n BoundWitnessDivinerParams,\n BoundWitnessDivinerQueryPayload,\n isBoundWitnessDivinerQueryPayload,\n} from '@xyo-network/diviner-boundwitness-model'\nimport { WithMeta } from '@xyo-network/payload-model'\n\nexport interface EqualityComparisonOperators {\n /**\n * 'Not Equal To' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value does not match the provided string.\n * Example: field != 'value'\n */\n '!=': string\n\n /**\n * 'Less Than' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value is lexicographically less than the provided string.\n * Example: field < 'value'\n */\n '<': string\n\n /**\n * 'Less Than or Equal To' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value is lexicographically less than or equal to the provided string.\n * Example: field <= 'value'\n */\n '<=': string\n\n /**\n * 'Equal To' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value matches the provided string exactly.\n * Example: field = 'value'\n */\n '=': string\n\n /**\n * 'Greater Than' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value is lexicographically greater than the provided string.\n * Example: field > 'value'\n */\n '>': string\n\n /**\n * 'Greater Than or Equal To' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value is lexicographically greater than or equal to the provided string.\n * Example: field >= 'value'\n */\n '>=': string\n}\n\ntype WithTimestamp = BoundWitness & { timestamp: number }\nconst hasTimestamp = (bw: BoundWitness): bw is WithTimestamp => bw.timestamp !== undefined\n\nexport class MemoryBoundWitnessDiviner<\n TParams extends BoundWitnessDivinerParams = BoundWitnessDivinerParams,\n TIn extends BoundWitnessDivinerQueryPayload = BoundWitnessDivinerQueryPayload,\n TOut extends BoundWitness = BoundWitness,\n> extends BoundWitnessDiviner<TParams, TIn, TOut> {\n // eslint-disable-next-line complexity\n protected override async divineHandler(payloads?: TIn[]) {\n const filter = assertEx(payloads?.filter(isBoundWitnessDivinerQueryPayload)?.pop(), () => 'Missing query payload')\n if (!filter) return []\n const archivist = assertEx(await this.archivistInstance(), () => 'Unable to resolve archivist')\n const { addresses, payload_hashes, payload_schemas, limit, offset, order = 'desc', sourceQuery, destination, timestamp } = filter\n let bws = ((await archivist?.all?.()) ?? []).filter(isBoundWitness) as WithMeta<BoundWitness>[]\n if (order === 'desc') bws = bws.reverse()\n const allAddresses = addresses?.map((address) => hexFromHexString(address)).filter(exists)\n if (allAddresses?.length) bws = bws.filter((bw) => containsAll(bw.addresses, allAddresses))\n if (payload_hashes?.length) bws = bws.filter((bw) => containsAll(bw.payload_hashes, payload_hashes))\n if (payload_schemas?.length) bws = bws.filter((bw) => containsAll(bw.payload_schemas, payload_schemas))\n if (sourceQuery) bws = bws.filter((bw) => (bw?.$meta as { sourceQuery?: string })?.sourceQuery === sourceQuery)\n // If there's a destination filter of the right kind\n if (destination && Array.isArray(destination) && destination?.length > 0) {\n const targetFilter = assertEx(destination, () => 'Missing destination')\n // Find all BWs that satisfy the destination constraint\n bws = bws.filter((bw) => {\n const targetDestinationField = (bw?.$meta as { destination?: string[] })?.destination\n // If the destination field is an array and contains at least one element\n return targetDestinationField !== undefined && Array.isArray(targetDestinationField) && targetDestinationField.length > 0 ?\n // Check that the targetDestinationField contains all the elements in the targetFilter\n containsAll(targetFilter, targetDestinationField ?? [])\n // Otherwise, filter it out\n : false\n })\n }\n if (timestamp !== undefined) {\n bws =\n order === 'desc' ?\n bws.filter(hasTimestamp).filter((bw) => bw.timestamp <= timestamp)\n : bws.filter(hasTimestamp).filter((bw) => bw.timestamp >= timestamp)\n }\n const parsedLimit = limit ?? bws.length\n const parsedOffset = offset ?? 0\n return bws.slice(parsedOffset, parsedLimit) as WithMeta<TOut>[]\n }\n}\n"],"mappings":";;;;AAAA,SAASA,mBAAmB;AAC5B,SAASC,gBAAgB;AACzB,SAASC,cAAc;AACvB,SAASC,wBAAwB;AACjC,SAAuBC,sBAAsB;AAC7C,SAASC,2BAA2B;AACpC,SAGEC,yCACK;AAsDP,IAAMC,eAAe,wBAACC,OAA0CA,GAAGC,cAAcC,QAA5D;AAEd,IAAMC,4BAAN,cAIGC,oBAAAA;EAtEV,OAsEUA;;;;EAER,MAAyBC,cAAcC,UAAkB;AACvD,UAAMC,SAASC,SAASF,UAAUC,OAAOE,iCAAAA,GAAoCC,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mB,YACEH,UAAU,SACRG,IAAId,OAAOR,YAAAA,EAAcQ,OAAO,CAACP,OAAOA,GAAGC,aAAaA,SAAAA,IACxDoB,IAAId,OAAOR,YAAAA,EAAcQ,OAAO,CAACP,OAAOA,GAAGC,aAAaA,SAAAA;IAC9D;AACA,UAAMoC,cAAcrB,SAASK,IAAIS;AACjC,UAAMQ,eAAerB,UAAU;AAC/B,WAAOI,IAAIkB,MAAMD,cAAcD,WAAAA;EACjC;AACF;","names":["containsAll","assertEx","exists","hexFromHexString","isBoundWitness","BoundWitnessDiviner","isBoundWitnessDivinerQueryPayload","hasTimestamp","bw","timestamp","undefined","MemoryBoundWitnessDiviner","BoundWitnessDiviner","divineHandler","payloads","filter","assertEx","isBoundWitnessDivinerQueryPayload","pop","archivist","archivistInstance","addresses","payload_hashes","payload_schemas","limit","offset","order","sourceQuery","destination","bws","all","isBoundWitness","reverse","allAddresses","map","address","hexFromHexString","exists","length","containsAll","$meta","Array","isArray","targetFilter","targetDestinationField","parsedLimit","parsedOffset","slice"]}
@@ -1,7 +1,7 @@
1
1
  import { BoundWitness } from '@xyo-network/boundwitness-model';
2
2
  import { BoundWitnessDiviner } from '@xyo-network/diviner-boundwitness-abstract';
3
3
  import { BoundWitnessDivinerParams, BoundWitnessDivinerQueryPayload } from '@xyo-network/diviner-boundwitness-model';
4
- import { Schema, WithMeta } from '@xyo-network/payload-model';
4
+ import { WithMeta } from '@xyo-network/payload-model';
5
5
  export interface EqualityComparisonOperators {
6
6
  '!=': string;
7
7
  '<': string;
@@ -11,8 +11,6 @@ export interface EqualityComparisonOperators {
11
11
  '>=': string;
12
12
  }
13
13
  export declare class MemoryBoundWitnessDiviner<TParams extends BoundWitnessDivinerParams = BoundWitnessDivinerParams, TIn extends BoundWitnessDivinerQueryPayload = BoundWitnessDivinerQueryPayload, TOut extends BoundWitness = BoundWitness> extends BoundWitnessDiviner<TParams, TIn, TOut> {
14
- static readonly configSchemas: Schema[];
15
- static readonly defaultConfigSchema: Schema;
16
14
  protected divineHandler(payloads?: TIn[]): Promise<WithMeta<TOut>[]>;
17
15
  }
18
16
  //# sourceMappingURL=MemoryBoundWitnessDiviner.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MemoryBoundWitnessDiviner.d.ts","sourceRoot":"","sources":["../../src/MemoryBoundWitnessDiviner.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAkB,MAAM,iCAAiC,CAAA;AAC9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,4CAA4C,CAAA;AAChF,OAAO,EAEL,yBAAyB,EACzB,+BAA+B,EAEhC,MAAM,yCAAyC,CAAA;AAChD,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAE7D,MAAM,WAAW,2BAA2B;IAO1C,IAAI,EAAE,MAAM,CAAA;IAQZ,GAAG,EAAE,MAAM,CAAA;IAQX,IAAI,EAAE,MAAM,CAAA;IAQZ,GAAG,EAAE,MAAM,CAAA;IAQX,GAAG,EAAE,MAAM,CAAA;IAQX,IAAI,EAAE,MAAM,CAAA;CACb;AAKD,qBAAa,yBAAyB,CACpC,OAAO,SAAS,yBAAyB,GAAG,yBAAyB,EACrE,GAAG,SAAS,+BAA+B,GAAG,+BAA+B,EAC7E,IAAI,SAAS,YAAY,GAAG,YAAY,CACxC,SAAQ,mBAAmB,CAAC,OAAO,EAAE,GAAG,EAAE,IAAI,CAAC;IAC/C,gBAAyB,aAAa,EAAE,MAAM,EAAE,CAA4D;IAC5G,gBAAyB,mBAAmB,EAAE,MAAM,CAAkC;cAG7D,aAAa,CAAC,QAAQ,CAAC,EAAE,GAAG,EAAE;CAoCxD"}
1
+ {"version":3,"file":"MemoryBoundWitnessDiviner.d.ts","sourceRoot":"","sources":["../../src/MemoryBoundWitnessDiviner.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAkB,MAAM,iCAAiC,CAAA;AAC9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,4CAA4C,CAAA;AAChF,OAAO,EACL,yBAAyB,EACzB,+BAA+B,EAEhC,MAAM,yCAAyC,CAAA;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAErD,MAAM,WAAW,2BAA2B;IAO1C,IAAI,EAAE,MAAM,CAAA;IAQZ,GAAG,EAAE,MAAM,CAAA;IAQX,IAAI,EAAE,MAAM,CAAA;IAQZ,GAAG,EAAE,MAAM,CAAA;IAQX,GAAG,EAAE,MAAM,CAAA;IAQX,IAAI,EAAE,MAAM,CAAA;CACb;AAKD,qBAAa,yBAAyB,CACpC,OAAO,SAAS,yBAAyB,GAAG,yBAAyB,EACrE,GAAG,SAAS,+BAA+B,GAAG,+BAA+B,EAC7E,IAAI,SAAS,YAAY,GAAG,YAAY,CACxC,SAAQ,mBAAmB,CAAC,OAAO,EAAE,GAAG,EAAE,IAAI,CAAC;cAEtB,aAAa,CAAC,QAAQ,CAAC,EAAE,GAAG,EAAE;CAoCxD"}
@@ -1,7 +1,7 @@
1
1
  import { BoundWitness } from '@xyo-network/boundwitness-model';
2
2
  import { BoundWitnessDiviner } from '@xyo-network/diviner-boundwitness-abstract';
3
3
  import { BoundWitnessDivinerParams, BoundWitnessDivinerQueryPayload } from '@xyo-network/diviner-boundwitness-model';
4
- import { Schema, WithMeta } from '@xyo-network/payload-model';
4
+ import { WithMeta } from '@xyo-network/payload-model';
5
5
  export interface EqualityComparisonOperators {
6
6
  '!=': string;
7
7
  '<': string;
@@ -11,8 +11,6 @@ export interface EqualityComparisonOperators {
11
11
  '>=': string;
12
12
  }
13
13
  export declare class MemoryBoundWitnessDiviner<TParams extends BoundWitnessDivinerParams = BoundWitnessDivinerParams, TIn extends BoundWitnessDivinerQueryPayload = BoundWitnessDivinerQueryPayload, TOut extends BoundWitness = BoundWitness> extends BoundWitnessDiviner<TParams, TIn, TOut> {
14
- static readonly configSchemas: Schema[];
15
- static readonly defaultConfigSchema: Schema;
16
14
  protected divineHandler(payloads?: TIn[]): Promise<WithMeta<TOut>[]>;
17
15
  }
18
16
  //# sourceMappingURL=MemoryBoundWitnessDiviner.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MemoryBoundWitnessDiviner.d.ts","sourceRoot":"","sources":["../../src/MemoryBoundWitnessDiviner.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAkB,MAAM,iCAAiC,CAAA;AAC9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,4CAA4C,CAAA;AAChF,OAAO,EAEL,yBAAyB,EACzB,+BAA+B,EAEhC,MAAM,yCAAyC,CAAA;AAChD,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAE7D,MAAM,WAAW,2BAA2B;IAO1C,IAAI,EAAE,MAAM,CAAA;IAQZ,GAAG,EAAE,MAAM,CAAA;IAQX,IAAI,EAAE,MAAM,CAAA;IAQZ,GAAG,EAAE,MAAM,CAAA;IAQX,GAAG,EAAE,MAAM,CAAA;IAQX,IAAI,EAAE,MAAM,CAAA;CACb;AAKD,qBAAa,yBAAyB,CACpC,OAAO,SAAS,yBAAyB,GAAG,yBAAyB,EACrE,GAAG,SAAS,+BAA+B,GAAG,+BAA+B,EAC7E,IAAI,SAAS,YAAY,GAAG,YAAY,CACxC,SAAQ,mBAAmB,CAAC,OAAO,EAAE,GAAG,EAAE,IAAI,CAAC;IAC/C,gBAAyB,aAAa,EAAE,MAAM,EAAE,CAA4D;IAC5G,gBAAyB,mBAAmB,EAAE,MAAM,CAAkC;cAG7D,aAAa,CAAC,QAAQ,CAAC,EAAE,GAAG,EAAE;CAoCxD"}
1
+ {"version":3,"file":"MemoryBoundWitnessDiviner.d.ts","sourceRoot":"","sources":["../../src/MemoryBoundWitnessDiviner.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAkB,MAAM,iCAAiC,CAAA;AAC9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,4CAA4C,CAAA;AAChF,OAAO,EACL,yBAAyB,EACzB,+BAA+B,EAEhC,MAAM,yCAAyC,CAAA;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAErD,MAAM,WAAW,2BAA2B;IAO1C,IAAI,EAAE,MAAM,CAAA;IAQZ,GAAG,EAAE,MAAM,CAAA;IAQX,IAAI,EAAE,MAAM,CAAA;IAQZ,GAAG,EAAE,MAAM,CAAA;IAQX,GAAG,EAAE,MAAM,CAAA;IAQX,IAAI,EAAE,MAAM,CAAA;CACb;AAKD,qBAAa,yBAAyB,CACpC,OAAO,SAAS,yBAAyB,GAAG,yBAAyB,EACrE,GAAG,SAAS,+BAA+B,GAAG,+BAA+B,EAC7E,IAAI,SAAS,YAAY,GAAG,YAAY,CACxC,SAAQ,mBAAmB,CAAC,OAAO,EAAE,GAAG,EAAE,IAAI,CAAC;cAEtB,aAAa,CAAC,QAAQ,CAAC,EAAE,GAAG,EAAE;CAoCxD"}
@@ -1,7 +1,7 @@
1
1
  import { BoundWitness } from '@xyo-network/boundwitness-model';
2
2
  import { BoundWitnessDiviner } from '@xyo-network/diviner-boundwitness-abstract';
3
3
  import { BoundWitnessDivinerParams, BoundWitnessDivinerQueryPayload } from '@xyo-network/diviner-boundwitness-model';
4
- import { Schema, WithMeta } from '@xyo-network/payload-model';
4
+ import { WithMeta } from '@xyo-network/payload-model';
5
5
  export interface EqualityComparisonOperators {
6
6
  '!=': string;
7
7
  '<': string;
@@ -11,8 +11,6 @@ export interface EqualityComparisonOperators {
11
11
  '>=': string;
12
12
  }
13
13
  export declare class MemoryBoundWitnessDiviner<TParams extends BoundWitnessDivinerParams = BoundWitnessDivinerParams, TIn extends BoundWitnessDivinerQueryPayload = BoundWitnessDivinerQueryPayload, TOut extends BoundWitness = BoundWitness> extends BoundWitnessDiviner<TParams, TIn, TOut> {
14
- static readonly configSchemas: Schema[];
15
- static readonly defaultConfigSchema: Schema;
16
14
  protected divineHandler(payloads?: TIn[]): Promise<WithMeta<TOut>[]>;
17
15
  }
18
16
  //# sourceMappingURL=MemoryBoundWitnessDiviner.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MemoryBoundWitnessDiviner.d.ts","sourceRoot":"","sources":["../../src/MemoryBoundWitnessDiviner.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAkB,MAAM,iCAAiC,CAAA;AAC9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,4CAA4C,CAAA;AAChF,OAAO,EAEL,yBAAyB,EACzB,+BAA+B,EAEhC,MAAM,yCAAyC,CAAA;AAChD,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAE7D,MAAM,WAAW,2BAA2B;IAO1C,IAAI,EAAE,MAAM,CAAA;IAQZ,GAAG,EAAE,MAAM,CAAA;IAQX,IAAI,EAAE,MAAM,CAAA;IAQZ,GAAG,EAAE,MAAM,CAAA;IAQX,GAAG,EAAE,MAAM,CAAA;IAQX,IAAI,EAAE,MAAM,CAAA;CACb;AAKD,qBAAa,yBAAyB,CACpC,OAAO,SAAS,yBAAyB,GAAG,yBAAyB,EACrE,GAAG,SAAS,+BAA+B,GAAG,+BAA+B,EAC7E,IAAI,SAAS,YAAY,GAAG,YAAY,CACxC,SAAQ,mBAAmB,CAAC,OAAO,EAAE,GAAG,EAAE,IAAI,CAAC;IAC/C,gBAAyB,aAAa,EAAE,MAAM,EAAE,CAA4D;IAC5G,gBAAyB,mBAAmB,EAAE,MAAM,CAAkC;cAG7D,aAAa,CAAC,QAAQ,CAAC,EAAE,GAAG,EAAE;CAoCxD"}
1
+ {"version":3,"file":"MemoryBoundWitnessDiviner.d.ts","sourceRoot":"","sources":["../../src/MemoryBoundWitnessDiviner.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAkB,MAAM,iCAAiC,CAAA;AAC9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,4CAA4C,CAAA;AAChF,OAAO,EACL,yBAAyB,EACzB,+BAA+B,EAEhC,MAAM,yCAAyC,CAAA;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAErD,MAAM,WAAW,2BAA2B;IAO1C,IAAI,EAAE,MAAM,CAAA;IAQZ,GAAG,EAAE,MAAM,CAAA;IAQX,IAAI,EAAE,MAAM,CAAA;IAQZ,GAAG,EAAE,MAAM,CAAA;IAQX,GAAG,EAAE,MAAM,CAAA;IAQX,IAAI,EAAE,MAAM,CAAA;CACb;AAKD,qBAAa,yBAAyB,CACpC,OAAO,SAAS,yBAAyB,GAAG,yBAAyB,EACrE,GAAG,SAAS,+BAA+B,GAAG,+BAA+B,EAC7E,IAAI,SAAS,YAAY,GAAG,YAAY,CACxC,SAAQ,mBAAmB,CAAC,OAAO,EAAE,GAAG,EAAE,IAAI,CAAC;cAEtB,aAAa,CAAC,QAAQ,CAAC,EAAE,GAAG,EAAE;CAoCxD"}
@@ -38,11 +38,6 @@ var MemoryBoundWitnessDiviner = class extends import_diviner_boundwitness_abstra
38
38
  static {
39
39
  __name(this, "MemoryBoundWitnessDiviner");
40
40
  }
41
- static configSchemas = [
42
- ...super.configSchemas,
43
- import_diviner_boundwitness_model.BoundWitnessDivinerConfigSchema
44
- ];
45
- static defaultConfigSchema = import_diviner_boundwitness_model.BoundWitnessDivinerConfigSchema;
46
41
  // eslint-disable-next-line complexity
47
42
  async divineHandler(payloads) {
48
43
  const filter = (0, import_assert.assertEx)(payloads?.filter(import_diviner_boundwitness_model.isBoundWitnessDivinerQueryPayload)?.pop(), () => "Missing query payload");
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts","../../src/MemoryBoundWitnessDiviner.ts"],"sourcesContent":["export * from './MemoryBoundWitnessDiviner.js'\n","import { containsAll } from '@xylabs/array'\nimport { assertEx } from '@xylabs/assert'\nimport { exists } from '@xylabs/exists'\nimport { hexFromHexString } from '@xylabs/hex'\nimport { BoundWitness, isBoundWitness } from '@xyo-network/boundwitness-model'\nimport { BoundWitnessDiviner } from '@xyo-network/diviner-boundwitness-abstract'\nimport {\n BoundWitnessDivinerConfigSchema,\n BoundWitnessDivinerParams,\n BoundWitnessDivinerQueryPayload,\n isBoundWitnessDivinerQueryPayload,\n} from '@xyo-network/diviner-boundwitness-model'\nimport { Schema, WithMeta } from '@xyo-network/payload-model'\n\nexport interface EqualityComparisonOperators {\n /**\n * 'Not Equal To' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value does not match the provided string.\n * Example: field != 'value'\n */\n '!=': string\n\n /**\n * 'Less Than' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value is lexicographically less than the provided string.\n * Example: field < 'value'\n */\n '<': string\n\n /**\n * 'Less Than or Equal To' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value is lexicographically less than or equal to the provided string.\n * Example: field <= 'value'\n */\n '<=': string\n\n /**\n * 'Equal To' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value matches the provided string exactly.\n * Example: field = 'value'\n */\n '=': string\n\n /**\n * 'Greater Than' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value is lexicographically greater than the provided string.\n * Example: field > 'value'\n */\n '>': string\n\n /**\n * 'Greater Than or Equal To' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value is lexicographically greater than or equal to the provided string.\n * Example: field >= 'value'\n */\n '>=': string\n}\n\ntype WithTimestamp = BoundWitness & { timestamp: number }\nconst hasTimestamp = (bw: BoundWitness): bw is WithTimestamp => bw.timestamp !== undefined\n\nexport class MemoryBoundWitnessDiviner<\n TParams extends BoundWitnessDivinerParams = BoundWitnessDivinerParams,\n TIn extends BoundWitnessDivinerQueryPayload = BoundWitnessDivinerQueryPayload,\n TOut extends BoundWitness = BoundWitness,\n> extends BoundWitnessDiviner<TParams, TIn, TOut> {\n static override readonly configSchemas: Schema[] = [...super.configSchemas, BoundWitnessDivinerConfigSchema]\n static override readonly defaultConfigSchema: Schema = BoundWitnessDivinerConfigSchema\n\n // eslint-disable-next-line complexity\n protected override async divineHandler(payloads?: TIn[]) {\n const filter = assertEx(payloads?.filter(isBoundWitnessDivinerQueryPayload)?.pop(), () => 'Missing query payload')\n if (!filter) return []\n const archivist = assertEx(await this.archivistInstance(), () => 'Unable to resolve archivist')\n const { addresses, payload_hashes, payload_schemas, limit, offset, order = 'desc', sourceQuery, destination, timestamp } = filter\n let bws = ((await archivist?.all?.()) ?? []).filter(isBoundWitness) as WithMeta<BoundWitness>[]\n if (order === 'desc') bws = bws.reverse()\n const allAddresses = addresses?.map((address) => hexFromHexString(address)).filter(exists)\n if (allAddresses?.length) bws = bws.filter((bw) => containsAll(bw.addresses, allAddresses))\n if (payload_hashes?.length) bws = bws.filter((bw) => containsAll(bw.payload_hashes, payload_hashes))\n if (payload_schemas?.length) bws = bws.filter((bw) => containsAll(bw.payload_schemas, payload_schemas))\n if (sourceQuery) bws = bws.filter((bw) => (bw?.$meta as { sourceQuery?: string })?.sourceQuery === sourceQuery)\n // If there's a destination filter of the right kind\n if (destination && Array.isArray(destination) && destination?.length > 0) {\n const targetFilter = assertEx(destination, () => 'Missing destination')\n // Find all BWs that satisfy the destination constraint\n bws = bws.filter((bw) => {\n const targetDestinationField = (bw?.$meta as { destination?: string[] })?.destination\n // If the destination field is an array and contains at least one element\n return targetDestinationField !== undefined && Array.isArray(targetDestinationField) && targetDestinationField.length > 0 ?\n // Check that the targetDestinationField contains all the elements in the targetFilter\n containsAll(targetFilter, targetDestinationField ?? [])\n // Otherwise, filter it out\n : false\n })\n }\n if (timestamp !== undefined) {\n bws =\n order === 'desc' ?\n bws.filter(hasTimestamp).filter((bw) => bw.timestamp <= timestamp)\n : bws.filter(hasTimestamp).filter((bw) => bw.timestamp >= timestamp)\n }\n const parsedLimit = limit ?? bws.length\n const parsedOffset = offset ?? 0\n return bws.slice(parsedOffset, parsedLimit) as WithMeta<TOut>[]\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;ACAA,mBAA4B;AAC5B,oBAAyB;AACzB,oBAAuB;AACvB,iBAAiC;AACj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AS,GAAG;AACxE,YAAMK,mBAAe3B,wBAASY,aAAa,MAAM,qBAAA;AAEjDC,YAAMA,IAAId,OAAO,CAACV,OAAAA;AAChB,cAAMuC,yBAA0BvC,IAAImC,OAAsCZ;AAE1E,eAAOgB,2BAA2BrC,UAAakC,MAAMC,QAAQE,sBAAAA,KAA2BA,uBAAuBN,SAAS;;cAEpHC,0BAAYI,cAAcC,0BAA0B,CAAA,CAAE;YAEtD;MACN,CAAA;IACF;AACA,QAAItC,cAAcC,QAAW;AAC3BsB,YACEH,UAAU,SACRG,IAAId,OAAOX,YAAAA,EAAcW,OAAO,CAACV,OAAOA,GAAGC,aAAaA,SAAAA,IACxDuB,IAAId,OAAOX,YAAAA,EAAcW,OAAO,CAACV,OAAOA,GAAGC,aAAaA,SAAAA;IAC9D;AACA,UAAMuC,cAAcrB,SAASK,IAAIS;AACjC,UAAMQ,eAAerB,UAAU;AAC/B,WAAOI,IAAIkB,MAAMD,cAAcD,WAAAA;EACjC;AACF;","names":["hasTimestamp","bw","timestamp","undefined","MemoryBoundWitnessDiviner","BoundWitnessDiviner","configSchemas","BoundWitnessDivinerConfigSchema","defaultConfigSchema","divineHandler","payloads","filter","assertEx","isBoundWitnessDivinerQueryPayload","pop","archivist","archivistInstance","addresses","payload_hashes","payload_schemas","limit","offset","order","sourceQuery","destination","bws","all","isBoundWitness","reverse","allAddresses","map","address","hexFromHexString","exists","length","containsAll","$meta","Array","isArray","targetFilter","targetDestinationField","parsedLimit","parsedOffset","slice"]}
1
+ {"version":3,"sources":["../../src/index.ts","../../src/MemoryBoundWitnessDiviner.ts"],"sourcesContent":["export * from './MemoryBoundWitnessDiviner.js'\n","import { containsAll } from '@xylabs/array'\nimport { assertEx } from '@xylabs/assert'\nimport { exists } from '@xylabs/exists'\nimport { hexFromHexString } from '@xylabs/hex'\nimport { BoundWitness, isBoundWitness } from '@xyo-network/boundwitness-model'\nimport { BoundWitnessDiviner } from '@xyo-network/diviner-boundwitness-abstract'\nimport {\n BoundWitnessDivinerParams,\n BoundWitnessDivinerQueryPayload,\n isBoundWitnessDivinerQueryPayload,\n} from '@xyo-network/diviner-boundwitness-model'\nimport { WithMeta } from '@xyo-network/payload-model'\n\nexport interface EqualityComparisonOperators {\n /**\n * 'Not Equal To' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value does not match the provided string.\n * Example: field != 'value'\n */\n '!=': string\n\n /**\n * 'Less Than' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value is lexicographically less than the provided string.\n * Example: field < 'value'\n */\n '<': string\n\n /**\n * 'Less Than or Equal To' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value is lexicographically less than or equal to the provided string.\n * Example: field <= 'value'\n */\n '<=': string\n\n /**\n * 'Equal To' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value matches the provided string exactly.\n * Example: field = 'value'\n */\n '=': string\n\n /**\n * 'Greater Than' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value is lexicographically greater than the provided string.\n * Example: field > 'value'\n */\n '>': string\n\n /**\n * 'Greater Than or Equal To' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value is lexicographically greater than or equal to the provided string.\n * Example: field >= 'value'\n */\n '>=': string\n}\n\ntype WithTimestamp = BoundWitness & { timestamp: number }\nconst hasTimestamp = (bw: BoundWitness): bw is WithTimestamp => bw.timestamp !== undefined\n\nexport class MemoryBoundWitnessDiviner<\n TParams extends BoundWitnessDivinerParams = BoundWitnessDivinerParams,\n TIn extends BoundWitnessDivinerQueryPayload = BoundWitnessDivinerQueryPayload,\n TOut extends BoundWitness = BoundWitness,\n> extends BoundWitnessDiviner<TParams, TIn, TOut> {\n // eslint-disable-next-line complexity\n protected override async divineHandler(payloads?: TIn[]) {\n const filter = assertEx(payloads?.filter(isBoundWitnessDivinerQueryPayload)?.pop(), () => 'Missing query payload')\n if (!filter) return []\n const archivist = assertEx(await this.archivistInstance(), () => 'Unable to resolve archivist')\n const { addresses, payload_hashes, payload_schemas, limit, offset, order = 'desc', sourceQuery, destination, timestamp } = filter\n let bws = ((await archivist?.all?.()) ?? []).filter(isBoundWitness) as WithMeta<BoundWitness>[]\n if (order === 'desc') bws = bws.reverse()\n const allAddresses = addresses?.map((address) => hexFromHexString(address)).filter(exists)\n if (allAddresses?.length) bws = bws.filter((bw) => containsAll(bw.addresses, allAddresses))\n if (payload_hashes?.length) bws = bws.filter((bw) => containsAll(bw.payload_hashes, payload_hashes))\n if (payload_schemas?.length) bws = bws.filter((bw) => containsAll(bw.payload_schemas, payload_schemas))\n if (sourceQuery) bws = bws.filter((bw) => (bw?.$meta as { sourceQuery?: string })?.sourceQuery === sourceQuery)\n // If there's a destination filter of the right kind\n if (destination && Array.isArray(destination) && destination?.length > 0) {\n const targetFilter = assertEx(destination, () => 'Missing destination')\n // Find all BWs that satisfy the destination constraint\n bws = bws.filter((bw) => {\n const targetDestinationField = (bw?.$meta as { destination?: string[] })?.destination\n // If the destination field is an array and contains at least one element\n return targetDestinationField !== undefined && Array.isArray(targetDestinationField) && targetDestinationField.length > 0 ?\n // Check that the targetDestinationField contains all the elements in the targetFilter\n containsAll(targetFilter, targetDestinationField ?? [])\n // Otherwise, filter it out\n : false\n })\n }\n if (timestamp !== undefined) {\n bws =\n order === 'desc' ?\n bws.filter(hasTimestamp).filter((bw) => bw.timestamp <= timestamp)\n : bws.filter(hasTimestamp).filter((bw) => bw.timestamp >= timestamp)\n }\n const parsedLimit = limit ?? bws.length\n const parsedOffset = offset ?? 0\n return bws.slice(parsedOffset, parsedLimit) as WithMeta<TOut>[]\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;ACAA,mBAA4B;AAC5B,oBAAyB;AACzB,oBAAuB;AACvB,iBAAiC;AACjC,gCAA6C;AAC7C,2CAAoC;AACpC,wCAIO;AAsDP,IAAMA,eAAe,wBAACC,OAA0CA,GAAGC,cAAcC,QAA5D;AAEd,IAAMC,4BAAN,cAIGC,yDAAAA;EAtEV,OAs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,SAAS;;cAEpHC,0BAAYI,cAAcC,0BAA0B,CAAA,CAAE;YAEtD;MACN,CAAA;IACF;AACA,QAAInC,cAAcC,QAAW;AAC3BmB,YACEH,UAAU,SACRG,IAAId,OAAOR,YAAAA,EAAcQ,OAAO,CAACP,OAAOA,GAAGC,aAAaA,SAAAA,IACxDoB,IAAId,OAAOR,YAAAA,EAAcQ,OAAO,CAACP,OAAOA,GAAGC,aAAaA,SAAAA;IAC9D;AACA,UAAMoC,cAAcrB,SAASK,IAAIS;AACjC,UAAMQ,eAAerB,UAAU;AAC/B,WAAOI,IAAIkB,MAAMD,cAAcD,WAAAA;EACjC;AACF;","names":["hasTimestamp","bw","timestamp","undefined","MemoryBoundWitnessDiviner","BoundWitnessDiviner","divineHandler","payloads","filter","assertEx","isBoundWitnessDivinerQueryPayload","pop","archivist","archivistInstance","addresses","payload_hashes","payload_schemas","limit","offset","order","sourceQuery","destination","bws","all","isBoundWitness","reverse","allAddresses","map","address","hexFromHexString","exists","length","containsAll","$meta","Array","isArray","targetFilter","targetDestinationField","parsedLimit","parsedOffset","slice"]}
@@ -8,17 +8,12 @@ import { exists } from "@xylabs/exists";
8
8
  import { hexFromHexString } from "@xylabs/hex";
9
9
  import { isBoundWitness } from "@xyo-network/boundwitness-model";
10
10
  import { BoundWitnessDiviner } from "@xyo-network/diviner-boundwitness-abstract";
11
- import { BoundWitnessDivinerConfigSchema, isBoundWitnessDivinerQueryPayload } from "@xyo-network/diviner-boundwitness-model";
11
+ import { isBoundWitnessDivinerQueryPayload } from "@xyo-network/diviner-boundwitness-model";
12
12
  var hasTimestamp = /* @__PURE__ */ __name((bw) => bw.timestamp !== void 0, "hasTimestamp");
13
13
  var MemoryBoundWitnessDiviner = class extends BoundWitnessDiviner {
14
14
  static {
15
15
  __name(this, "MemoryBoundWitnessDiviner");
16
16
  }
17
- static configSchemas = [
18
- ...super.configSchemas,
19
- BoundWitnessDivinerConfigSchema
20
- ];
21
- static defaultConfigSchema = BoundWitnessDivinerConfigSchema;
22
17
  // eslint-disable-next-line complexity
23
18
  async divineHandler(payloads) {
24
19
  const filter = assertEx(payloads?.filter(isBoundWitnessDivinerQueryPayload)?.pop(), () => "Missing query payload");
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/MemoryBoundWitnessDiviner.ts"],"sourcesContent":["import { containsAll } from '@xylabs/array'\nimport { assertEx } from '@xylabs/assert'\nimport { exists } from '@xylabs/exists'\nimport { hexFromHexString } from '@xylabs/hex'\nimport { BoundWitness, isBoundWitness } from '@xyo-network/boundwitness-model'\nimport { BoundWitnessDiviner } from '@xyo-network/diviner-boundwitness-abstract'\nimport {\n BoundWitnessDivinerConfigSchema,\n BoundWitnessDivinerParams,\n BoundWitnessDivinerQueryPayload,\n isBoundWitnessDivinerQueryPayload,\n} from '@xyo-network/diviner-boundwitness-model'\nimport { Schema, WithMeta } from '@xyo-network/payload-model'\n\nexport interface EqualityComparisonOperators {\n /**\n * 'Not Equal To' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value does not match the provided string.\n * Example: field != 'value'\n */\n '!=': string\n\n /**\n * 'Less Than' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value is lexicographically less than the provided string.\n * Example: field < 'value'\n */\n '<': string\n\n /**\n * 'Less Than or Equal To' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value is lexicographically less than or equal to the provided string.\n * Example: field <= 'value'\n */\n '<=': string\n\n /**\n * 'Equal To' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value matches the provided string exactly.\n * Example: field = 'value'\n */\n '=': string\n\n /**\n * 'Greater Than' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value is lexicographically greater than the provided string.\n * Example: field > 'value'\n */\n '>': string\n\n /**\n * 'Greater Than or Equal To' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value is lexicographically greater than or equal to the provided string.\n * Example: field >= 'value'\n */\n '>=': string\n}\n\ntype WithTimestamp = BoundWitness & { timestamp: number }\nconst hasTimestamp = (bw: BoundWitness): bw is WithTimestamp => bw.timestamp !== undefined\n\nexport class MemoryBoundWitnessDiviner<\n TParams extends BoundWitnessDivinerParams = BoundWitnessDivinerParams,\n TIn extends BoundWitnessDivinerQueryPayload = BoundWitnessDivinerQueryPayload,\n TOut extends BoundWitness = BoundWitness,\n> extends BoundWitnessDiviner<TParams, TIn, TOut> {\n static override readonly configSchemas: Schema[] = [...super.configSchemas, BoundWitnessDivinerConfigSchema]\n static override readonly defaultConfigSchema: Schema = BoundWitnessDivinerConfigSchema\n\n // eslint-disable-next-line complexity\n protected override async divineHandler(payloads?: TIn[]) {\n const filter = assertEx(payloads?.filter(isBoundWitnessDivinerQueryPayload)?.pop(), () => 'Missing query payload')\n if (!filter) return []\n const archivist = assertEx(await this.archivistInstance(), () => 'Unable to resolve archivist')\n const { addresses, payload_hashes, payload_schemas, limit, offset, order = 'desc', sourceQuery, destination, timestamp } = filter\n let bws = ((await archivist?.all?.()) ?? []).filter(isBoundWitness) as WithMeta<BoundWitness>[]\n if (order === 'desc') bws = bws.reverse()\n const allAddresses = addresses?.map((address) => hexFromHexString(address)).filter(exists)\n if (allAddresses?.length) bws = bws.filter((bw) => containsAll(bw.addresses, allAddresses))\n if (payload_hashes?.length) bws = bws.filter((bw) => containsAll(bw.payload_hashes, payload_hashes))\n if (payload_schemas?.length) bws = bws.filter((bw) => containsAll(bw.payload_schemas, payload_schemas))\n if (sourceQuery) bws = bws.filter((bw) => (bw?.$meta as { sourceQuery?: string })?.sourceQuery === sourceQuery)\n // If there's a destination filter of the right kind\n if (destination && Array.isArray(destination) && destination?.length > 0) {\n const targetFilter = assertEx(destination, () => 'Missing destination')\n // Find all BWs that satisfy the destination constraint\n bws = bws.filter((bw) => {\n const targetDestinationField = (bw?.$meta as { destination?: string[] })?.destination\n // If the destination field is an array and contains at least one element\n return targetDestinationField !== undefined && Array.isArray(targetDestinationField) && targetDestinationField.length > 0 ?\n // Check that the targetDestinationField contains all the elements in the targetFilter\n containsAll(targetFilter, targetDestinationField ?? [])\n // Otherwise, filter it out\n : false\n })\n }\n if (timestamp !== undefined) {\n bws =\n order === 'desc' ?\n bws.filter(hasTimestamp).filter((bw) => bw.timestamp <= timestamp)\n : bws.filter(hasTimestamp).filter((bw) => bw.timestamp >= timestamp)\n }\n const parsedLimit = limit ?? bws.length\n const parsedOffset = offset ?? 0\n return bws.slice(parsedOffset, parsedLimit) as WithMeta<TOut>[]\n }\n}\n"],"mappings":";;;;AAAA,SAASA,mBAAmB;AAC5B,SAASC,gBAAgB;AACzB,SAASC,cAAc;AACvB,SAASC,wBAAwB;AACjC,SAAuBC,sBAAsB;AAC7C,SAASC,2BAA2B;AACpC,SACEC,iCAGAC,yCACK;AAsDP,IAAMC,eAAe,wBAACC,OAA0CA,GAAGC,cAAcC,QAA5D;AAEd,IAAMC,4BAAN,cAIGC,oBAAAA;EAvEV,OAuEUA;;;EACR,OAAyBC,gBAA0B;OAAI,MAAMA;IAAeC;;EAC5E,OAAyBC,sBAA8BD;;EAGvD,MAAyBE,cAAcC,UAAkB;AACvD,UAAMC,SAASC,SAASF,UAAUC,OAAOE,iCAAAA,GAAoCC,IAAAA,GAAO,MAAM,uBAAA;AAC1F,QAAI,CAACH,OAAQ,QAAO,CAAA;AACpB,UAAMI,YAAYH,SAAS,MAAM,KAAKI,kBAAiB,GAAI,MAAM,6BAAA;AACjE,UAAM,EAAEC,WAAWC,gBAAgBC,iBAAiBC,OAAOC,QAAQC,QAAQ,QAAQC,aAAaC,aAAatB,UAAS,IAAKS;AAC3H,QAAIc,OAAQ,MAAMV,WAAWW,MAAAA,KAAY,CAAA,GAAIf,OAAOgB,cAAAA;AACpD,QAAIL,UAAU,OAAQG,OAAMA,IAAIG,QAAO;AACvC,UAAMC,eAAeZ,WAAWa,IAAI,CAACC,YAAYC,iBAAiBD,OAAAA,CAAAA,EAAUpB,OAAOsB,MAAAA;AACnF,QAAIJ,cAAcK,OAAQT,OAAMA,IAAId,OAAO,CAACV,OAAOkC,YAAYlC,GAAGgB,WAAWY,YAAAA,CAAAA;AAC7E,QAAIX,gBAAgBgB,OAAQT,OAAMA,IAAId,OAAO,CAACV,OAAOkC,YAAYlC,GAAGiB,gBAAgBA,cAAAA,CAAAA;AACpF,QAAIC,iBAAiBe,OAAQT,OAAMA,IAAId,OAAO,CAACV,OAAOkC,YAAYlC,GAAGkB,iBAAiBA,eAAAA,CAAAA;AACtF,QAAII,YAAaE,OAAMA,IAAId,OAAO,CAACV,OAAQA,IAAImC,OAAoCb,gBAAgBA,WAAAA;AAEnG,QAAIC,eAAea,MAAMC,QAAQd,WAAAA,KAAgBA,aAAaU,SAAS,GAAG;AACxE,YAAMK,eAAe3B,SAASY,aAAa,MAAM,qBAAA;AAEjDC,YAAMA,IAAId,OAAO,CAACV,OAAAA;AAChB,cAAMuC,yBAA0BvC,IAAImC,OAAsCZ;AAE1E,eAAOgB,2BAA2BrC,UAAakC,MAAMC,QAAQE,sBAAAA,KAA2BA,uBAAuBN,SAAS;;UAEpHC,YAAYI,cAAcC,0BAA0B,CAAA,CAAE;YAEtD;MACN,CAAA;IACF;AACA,QAAItC,cAAcC,QAAW;AAC3BsB,YACEH,UAAU,SACRG,IAAId,OAAOX,YAAAA,EAAcW,OAAO,CAACV,OAAOA,GAAGC,aAAaA,SAAAA,IACxDuB,IAAId,OAAOX,YAAAA,EAAcW,OAAO,CAACV,OAAOA,GAAGC,aAAaA,SAAAA;IAC9D;AACA,UAAMuC,cAAcrB,SAASK,IAAIS;AACjC,UAAMQ,eAAerB,UAAU;AAC/B,WAAOI,IAAIkB,MAAMD,cAAcD,WAAAA;EACjC;AACF;","names":["containsAll","assertEx","exists","hexFromHexString","isBoundWitness","BoundWitnessDiviner","BoundWitnessDivinerConfigSchema","isBoundWitnessDivinerQueryPayload","hasTimestamp","bw","timestamp","undefined","MemoryBoundWitnessDiviner","BoundWitnessDiviner","configSchemas","BoundWitnessDivinerConfigSchema","defaultConfigSchema","divineHandler","payloads","filter","assertEx","isBoundWitnessDivinerQueryPayload","pop","archivist","archivistInstance","addresses","payload_hashes","payload_schemas","limit","offset","order","sourceQuery","destination","bws","all","isBoundWitness","reverse","allAddresses","map","address","hexFromHexString","exists","length","containsAll","$meta","Array","isArray","targetFilter","targetDestinationField","parsedLimit","parsedOffset","slice"]}
1
+ {"version":3,"sources":["../../src/MemoryBoundWitnessDiviner.ts"],"sourcesContent":["import { containsAll } from '@xylabs/array'\nimport { assertEx } from '@xylabs/assert'\nimport { exists } from '@xylabs/exists'\nimport { hexFromHexString } from '@xylabs/hex'\nimport { BoundWitness, isBoundWitness } from '@xyo-network/boundwitness-model'\nimport { BoundWitnessDiviner } from '@xyo-network/diviner-boundwitness-abstract'\nimport {\n BoundWitnessDivinerParams,\n BoundWitnessDivinerQueryPayload,\n isBoundWitnessDivinerQueryPayload,\n} from '@xyo-network/diviner-boundwitness-model'\nimport { WithMeta } from '@xyo-network/payload-model'\n\nexport interface EqualityComparisonOperators {\n /**\n * 'Not Equal To' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value does not match the provided string.\n * Example: field != 'value'\n */\n '!=': string\n\n /**\n * 'Less Than' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value is lexicographically less than the provided string.\n * Example: field < 'value'\n */\n '<': string\n\n /**\n * 'Less Than or Equal To' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value is lexicographically less than or equal to the provided string.\n * Example: field <= 'value'\n */\n '<=': string\n\n /**\n * 'Equal To' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value matches the provided string exactly.\n * Example: field = 'value'\n */\n '=': string\n\n /**\n * 'Greater Than' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value is lexicographically greater than the provided string.\n * Example: field > 'value'\n */\n '>': string\n\n /**\n * 'Greater Than or Equal To' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value is lexicographically greater than or equal to the provided string.\n * Example: field >= 'value'\n */\n '>=': string\n}\n\ntype WithTimestamp = BoundWitness & { timestamp: number }\nconst hasTimestamp = (bw: BoundWitness): bw is WithTimestamp => bw.timestamp !== undefined\n\nexport class MemoryBoundWitnessDiviner<\n TParams extends BoundWitnessDivinerParams = BoundWitnessDivinerParams,\n TIn extends BoundWitnessDivinerQueryPayload = BoundWitnessDivinerQueryPayload,\n TOut extends BoundWitness = BoundWitness,\n> extends BoundWitnessDiviner<TParams, TIn, TOut> {\n // eslint-disable-next-line complexity\n protected override async divineHandler(payloads?: TIn[]) {\n const filter = assertEx(payloads?.filter(isBoundWitnessDivinerQueryPayload)?.pop(), () => 'Missing query payload')\n if (!filter) return []\n const archivist = assertEx(await this.archivistInstance(), () => 'Unable to resolve archivist')\n const { addresses, payload_hashes, payload_schemas, limit, offset, order = 'desc', sourceQuery, destination, timestamp } = filter\n let bws = ((await archivist?.all?.()) ?? []).filter(isBoundWitness) as WithMeta<BoundWitness>[]\n if (order === 'desc') bws = bws.reverse()\n const allAddresses = addresses?.map((address) => hexFromHexString(address)).filter(exists)\n if (allAddresses?.length) bws = bws.filter((bw) => containsAll(bw.addresses, allAddresses))\n if (payload_hashes?.length) bws = bws.filter((bw) => containsAll(bw.payload_hashes, payload_hashes))\n if (payload_schemas?.length) bws = bws.filter((bw) => containsAll(bw.payload_schemas, payload_schemas))\n if (sourceQuery) bws = bws.filter((bw) => (bw?.$meta as { sourceQuery?: string })?.sourceQuery === sourceQuery)\n // If there's a destination filter of the right kind\n if (destination && Array.isArray(destination) && destination?.length > 0) {\n const targetFilter = assertEx(destination, () => 'Missing destination')\n // Find all BWs that satisfy the destination constraint\n bws = bws.filter((bw) => {\n const targetDestinationField = (bw?.$meta as { destination?: string[] })?.destination\n // If the destination field is an array and contains at least one element\n return targetDestinationField !== undefined && Array.isArray(targetDestinationField) && targetDestinationField.length > 0 ?\n // Check that the targetDestinationField contains all the elements in the targetFilter\n containsAll(targetFilter, targetDestinationField ?? [])\n // Otherwise, filter it out\n : false\n })\n }\n if (timestamp !== undefined) {\n bws =\n order === 'desc' ?\n bws.filter(hasTimestamp).filter((bw) => bw.timestamp <= timestamp)\n : bws.filter(hasTimestamp).filter((bw) => bw.timestamp >= timestamp)\n }\n const parsedLimit = limit ?? bws.length\n const parsedOffset = offset ?? 0\n return bws.slice(parsedOffset, parsedLimit) as WithMeta<TOut>[]\n }\n}\n"],"mappings":";;;;AAAA,SAASA,mBAAmB;AAC5B,SAASC,gBAAgB;AACzB,SAASC,cAAc;AACvB,SAASC,wBAAwB;AACjC,SAAuBC,sBAAsB;AAC7C,SAASC,2BAA2B;AACpC,SAGEC,yCACK;AAsDP,IAAMC,eAAe,wBAACC,OAA0CA,GAAGC,cAAcC,QAA5D;AAEd,IAAMC,4BAAN,cAIGC,oBAAAA;EAtEV,OAsEUA;;;;EAER,MAAyBC,cAAcC,UAAkB;AACvD,UAAMC,SAASC,SAASF,UAAUC,OAAOE,iCAAAA,GAAoCC,IAAAA,GAAO,MAAM,uBAAA;AAC1F,QAAI,CAACH,OAAQ,QAAO,CAAA;AACpB,UAAMI,YAAYH,SAAS,MAAM,KAAKI,kBAAiB,GAAI,MAAM,6BAAA;AACjE,UAAM,EAAEC,WAAWC,gBAAgBC,iBAAiBC,OAAOC,QAAQC,QAAQ,QAAQC,aAAaC,aAAanB,UAAS,IAAKM;AAC3H,QAAIc,OAAQ,MAAMV,WAAWW,MAAAA,KAAY,CAAA,GAAIf,OAAOgB,cAAAA;AACpD,QAAIL,UAAU,OAAQG,OAAMA,IAAIG,QAAO;AACvC,UAAMC,eAAeZ,WAAWa,IAAI,CAACC,YAAYC,iBAAiBD,OAAAA,CAAAA,EAAUpB,OAAOsB,MAAAA;AACnF,QAAIJ,cAAcK,OAAQT,OAAMA,IAAId,OAAO,CAACP,OAAO+B,YAAY/B,GAAGa,WAAWY,YAAAA,CAAAA;AAC7E,QAAIX,gBAAgBgB,OAAQT,OAAMA,IAAId,OAAO,CAACP,OAAO+B,YAAY/B,GAAGc,gBAAgBA,cAAAA,CAAAA;AACpF,QAAIC,iBAAiBe,OAAQT,OAAMA,IAAId,OAAO,CAACP,OAAO+B,YAAY/B,GAAGe,iBAAiBA,eAAAA,CAAAA;AACtF,QAAII,YAAaE,OAAMA,IAAId,OAAO,CAACP,OAAQA,IAAIgC,OAAoCb,gBAAgBA,WAAAA;AAEnG,QAAIC,eAAea,MAAMC,QAAQd,WAAAA,KAAgBA,aAAaU,SAAS,GAAG;AACxE,YAAMK,eAAe3B,SAASY,aAAa,MAAM,qBAAA;AAEjDC,YAAMA,IAAId,OAAO,CAACP,OAAAA;AAChB,cAAMoC,yBAA0BpC,IAAIgC,OAAsCZ;AAE1E,eAAOgB,2BAA2BlC,UAAa+B,MAAMC,QAAQE,sBAAAA,KAA2BA,uBAAuBN,SAAS;;UAEpHC,YAAYI,cAAcC,0BAA0B,CAAA,CAAE;YAEtD;MACN,CAAA;IACF;AACA,QAAInC,cAAcC,QAAW;AAC3BmB,YACEH,UAAU,SACRG,IAAId,OAAOR,YAAAA,EAAcQ,OAAO,CAACP,OAAOA,GAAGC,aAAaA,SAAAA,IACxDoB,IAAId,OAAOR,YAAAA,EAAcQ,OAAO,CAACP,OAAOA,GAAGC,aAAaA,SAAAA;IAC9D;AACA,UAAMoC,cAAcrB,SAASK,IAAIS;AACjC,UAAMQ,eAAerB,UAAU;AAC/B,WAAOI,IAAIkB,MAAMD,cAAcD,WAAAA;EACjC;AACF;","names":["containsAll","assertEx","exists","hexFromHexString","isBoundWitness","BoundWitnessDiviner","isBoundWitnessDivinerQueryPayload","hasTimestamp","bw","timestamp","undefined","MemoryBoundWitnessDiviner","BoundWitnessDiviner","divineHandler","payloads","filter","assertEx","isBoundWitnessDivinerQueryPayload","pop","archivist","archivistInstance","addresses","payload_hashes","payload_schemas","limit","offset","order","sourceQuery","destination","bws","all","isBoundWitness","reverse","allAddresses","map","address","hexFromHexString","exists","length","containsAll","$meta","Array","isArray","targetFilter","targetDestinationField","parsedLimit","parsedOffset","slice"]}
@@ -1,7 +1,7 @@
1
1
  import { BoundWitness } from '@xyo-network/boundwitness-model';
2
2
  import { BoundWitnessDiviner } from '@xyo-network/diviner-boundwitness-abstract';
3
3
  import { BoundWitnessDivinerParams, BoundWitnessDivinerQueryPayload } from '@xyo-network/diviner-boundwitness-model';
4
- import { Schema, WithMeta } from '@xyo-network/payload-model';
4
+ import { WithMeta } from '@xyo-network/payload-model';
5
5
  export interface EqualityComparisonOperators {
6
6
  '!=': string;
7
7
  '<': string;
@@ -11,8 +11,6 @@ export interface EqualityComparisonOperators {
11
11
  '>=': string;
12
12
  }
13
13
  export declare class MemoryBoundWitnessDiviner<TParams extends BoundWitnessDivinerParams = BoundWitnessDivinerParams, TIn extends BoundWitnessDivinerQueryPayload = BoundWitnessDivinerQueryPayload, TOut extends BoundWitness = BoundWitness> extends BoundWitnessDiviner<TParams, TIn, TOut> {
14
- static readonly configSchemas: Schema[];
15
- static readonly defaultConfigSchema: Schema;
16
14
  protected divineHandler(payloads?: TIn[]): Promise<WithMeta<TOut>[]>;
17
15
  }
18
16
  //# sourceMappingURL=MemoryBoundWitnessDiviner.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MemoryBoundWitnessDiviner.d.ts","sourceRoot":"","sources":["../../src/MemoryBoundWitnessDiviner.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAkB,MAAM,iCAAiC,CAAA;AAC9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,4CAA4C,CAAA;AAChF,OAAO,EAEL,yBAAyB,EACzB,+BAA+B,EAEhC,MAAM,yCAAyC,CAAA;AAChD,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAE7D,MAAM,WAAW,2BAA2B;IAO1C,IAAI,EAAE,MAAM,CAAA;IAQZ,GAAG,EAAE,MAAM,CAAA;IAQX,IAAI,EAAE,MAAM,CAAA;IAQZ,GAAG,EAAE,MAAM,CAAA;IAQX,GAAG,EAAE,MAAM,CAAA;IAQX,IAAI,EAAE,MAAM,CAAA;CACb;AAKD,qBAAa,yBAAyB,CACpC,OAAO,SAAS,yBAAyB,GAAG,yBAAyB,EACrE,GAAG,SAAS,+BAA+B,GAAG,+BAA+B,EAC7E,IAAI,SAAS,YAAY,GAAG,YAAY,CACxC,SAAQ,mBAAmB,CAAC,OAAO,EAAE,GAAG,EAAE,IAAI,CAAC;IAC/C,gBAAyB,aAAa,EAAE,MAAM,EAAE,CAA4D;IAC5G,gBAAyB,mBAAmB,EAAE,MAAM,CAAkC;cAG7D,aAAa,CAAC,QAAQ,CAAC,EAAE,GAAG,EAAE;CAoCxD"}
1
+ {"version":3,"file":"MemoryBoundWitnessDiviner.d.ts","sourceRoot":"","sources":["../../src/MemoryBoundWitnessDiviner.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAkB,MAAM,iCAAiC,CAAA;AAC9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,4CAA4C,CAAA;AAChF,OAAO,EACL,yBAAyB,EACzB,+BAA+B,EAEhC,MAAM,yCAAyC,CAAA;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAErD,MAAM,WAAW,2BAA2B;IAO1C,IAAI,EAAE,MAAM,CAAA;IAQZ,GAAG,EAAE,MAAM,CAAA;IAQX,IAAI,EAAE,MAAM,CAAA;IAQZ,GAAG,EAAE,MAAM,CAAA;IAQX,GAAG,EAAE,MAAM,CAAA;IAQX,IAAI,EAAE,MAAM,CAAA;CACb;AAKD,qBAAa,yBAAyB,CACpC,OAAO,SAAS,yBAAyB,GAAG,yBAAyB,EACrE,GAAG,SAAS,+BAA+B,GAAG,+BAA+B,EAC7E,IAAI,SAAS,YAAY,GAAG,YAAY,CACxC,SAAQ,mBAAmB,CAAC,OAAO,EAAE,GAAG,EAAE,IAAI,CAAC;cAEtB,aAAa,CAAC,QAAQ,CAAC,EAAE,GAAG,EAAE;CAoCxD"}
@@ -1,7 +1,7 @@
1
1
  import { BoundWitness } from '@xyo-network/boundwitness-model';
2
2
  import { BoundWitnessDiviner } from '@xyo-network/diviner-boundwitness-abstract';
3
3
  import { BoundWitnessDivinerParams, BoundWitnessDivinerQueryPayload } from '@xyo-network/diviner-boundwitness-model';
4
- import { Schema, WithMeta } from '@xyo-network/payload-model';
4
+ import { WithMeta } from '@xyo-network/payload-model';
5
5
  export interface EqualityComparisonOperators {
6
6
  '!=': string;
7
7
  '<': string;
@@ -11,8 +11,6 @@ export interface EqualityComparisonOperators {
11
11
  '>=': string;
12
12
  }
13
13
  export declare class MemoryBoundWitnessDiviner<TParams extends BoundWitnessDivinerParams = BoundWitnessDivinerParams, TIn extends BoundWitnessDivinerQueryPayload = BoundWitnessDivinerQueryPayload, TOut extends BoundWitness = BoundWitness> extends BoundWitnessDiviner<TParams, TIn, TOut> {
14
- static readonly configSchemas: Schema[];
15
- static readonly defaultConfigSchema: Schema;
16
14
  protected divineHandler(payloads?: TIn[]): Promise<WithMeta<TOut>[]>;
17
15
  }
18
16
  //# sourceMappingURL=MemoryBoundWitnessDiviner.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MemoryBoundWitnessDiviner.d.ts","sourceRoot":"","sources":["../../src/MemoryBoundWitnessDiviner.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAkB,MAAM,iCAAiC,CAAA;AAC9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,4CAA4C,CAAA;AAChF,OAAO,EAEL,yBAAyB,EACzB,+BAA+B,EAEhC,MAAM,yCAAyC,CAAA;AAChD,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAE7D,MAAM,WAAW,2BAA2B;IAO1C,IAAI,EAAE,MAAM,CAAA;IAQZ,GAAG,EAAE,MAAM,CAAA;IAQX,IAAI,EAAE,MAAM,CAAA;IAQZ,GAAG,EAAE,MAAM,CAAA;IAQX,GAAG,EAAE,MAAM,CAAA;IAQX,IAAI,EAAE,MAAM,CAAA;CACb;AAKD,qBAAa,yBAAyB,CACpC,OAAO,SAAS,yBAAyB,GAAG,yBAAyB,EACrE,GAAG,SAAS,+BAA+B,GAAG,+BAA+B,EAC7E,IAAI,SAAS,YAAY,GAAG,YAAY,CACxC,SAAQ,mBAAmB,CAAC,OAAO,EAAE,GAAG,EAAE,IAAI,CAAC;IAC/C,gBAAyB,aAAa,EAAE,MAAM,EAAE,CAA4D;IAC5G,gBAAyB,mBAAmB,EAAE,MAAM,CAAkC;cAG7D,aAAa,CAAC,QAAQ,CAAC,EAAE,GAAG,EAAE;CAoCxD"}
1
+ {"version":3,"file":"MemoryBoundWitnessDiviner.d.ts","sourceRoot":"","sources":["../../src/MemoryBoundWitnessDiviner.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAkB,MAAM,iCAAiC,CAAA;AAC9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,4CAA4C,CAAA;AAChF,OAAO,EACL,yBAAyB,EACzB,+BAA+B,EAEhC,MAAM,yCAAyC,CAAA;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAErD,MAAM,WAAW,2BAA2B;IAO1C,IAAI,EAAE,MAAM,CAAA;IAQZ,GAAG,EAAE,MAAM,CAAA;IAQX,IAAI,EAAE,MAAM,CAAA;IAQZ,GAAG,EAAE,MAAM,CAAA;IAQX,GAAG,EAAE,MAAM,CAAA;IAQX,IAAI,EAAE,MAAM,CAAA;CACb;AAKD,qBAAa,yBAAyB,CACpC,OAAO,SAAS,yBAAyB,GAAG,yBAAyB,EACrE,GAAG,SAAS,+BAA+B,GAAG,+BAA+B,EAC7E,IAAI,SAAS,YAAY,GAAG,YAAY,CACxC,SAAQ,mBAAmB,CAAC,OAAO,EAAE,GAAG,EAAE,IAAI,CAAC;cAEtB,aAAa,CAAC,QAAQ,CAAC,EAAE,GAAG,EAAE;CAoCxD"}
@@ -1,7 +1,7 @@
1
1
  import { BoundWitness } from '@xyo-network/boundwitness-model';
2
2
  import { BoundWitnessDiviner } from '@xyo-network/diviner-boundwitness-abstract';
3
3
  import { BoundWitnessDivinerParams, BoundWitnessDivinerQueryPayload } from '@xyo-network/diviner-boundwitness-model';
4
- import { Schema, WithMeta } from '@xyo-network/payload-model';
4
+ import { WithMeta } from '@xyo-network/payload-model';
5
5
  export interface EqualityComparisonOperators {
6
6
  '!=': string;
7
7
  '<': string;
@@ -11,8 +11,6 @@ export interface EqualityComparisonOperators {
11
11
  '>=': string;
12
12
  }
13
13
  export declare class MemoryBoundWitnessDiviner<TParams extends BoundWitnessDivinerParams = BoundWitnessDivinerParams, TIn extends BoundWitnessDivinerQueryPayload = BoundWitnessDivinerQueryPayload, TOut extends BoundWitness = BoundWitness> extends BoundWitnessDiviner<TParams, TIn, TOut> {
14
- static readonly configSchemas: Schema[];
15
- static readonly defaultConfigSchema: Schema;
16
14
  protected divineHandler(payloads?: TIn[]): Promise<WithMeta<TOut>[]>;
17
15
  }
18
16
  //# sourceMappingURL=MemoryBoundWitnessDiviner.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MemoryBoundWitnessDiviner.d.ts","sourceRoot":"","sources":["../../src/MemoryBoundWitnessDiviner.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAkB,MAAM,iCAAiC,CAAA;AAC9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,4CAA4C,CAAA;AAChF,OAAO,EAEL,yBAAyB,EACzB,+BAA+B,EAEhC,MAAM,yCAAyC,CAAA;AAChD,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAE7D,MAAM,WAAW,2BAA2B;IAO1C,IAAI,EAAE,MAAM,CAAA;IAQZ,GAAG,EAAE,MAAM,CAAA;IAQX,IAAI,EAAE,MAAM,CAAA;IAQZ,GAAG,EAAE,MAAM,CAAA;IAQX,GAAG,EAAE,MAAM,CAAA;IAQX,IAAI,EAAE,MAAM,CAAA;CACb;AAKD,qBAAa,yBAAyB,CACpC,OAAO,SAAS,yBAAyB,GAAG,yBAAyB,EACrE,GAAG,SAAS,+BAA+B,GAAG,+BAA+B,EAC7E,IAAI,SAAS,YAAY,GAAG,YAAY,CACxC,SAAQ,mBAAmB,CAAC,OAAO,EAAE,GAAG,EAAE,IAAI,CAAC;IAC/C,gBAAyB,aAAa,EAAE,MAAM,EAAE,CAA4D;IAC5G,gBAAyB,mBAAmB,EAAE,MAAM,CAAkC;cAG7D,aAAa,CAAC,QAAQ,CAAC,EAAE,GAAG,EAAE;CAoCxD"}
1
+ {"version":3,"file":"MemoryBoundWitnessDiviner.d.ts","sourceRoot":"","sources":["../../src/MemoryBoundWitnessDiviner.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAkB,MAAM,iCAAiC,CAAA;AAC9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,4CAA4C,CAAA;AAChF,OAAO,EACL,yBAAyB,EACzB,+BAA+B,EAEhC,MAAM,yCAAyC,CAAA;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAErD,MAAM,WAAW,2BAA2B;IAO1C,IAAI,EAAE,MAAM,CAAA;IAQZ,GAAG,EAAE,MAAM,CAAA;IAQX,IAAI,EAAE,MAAM,CAAA;IAQZ,GAAG,EAAE,MAAM,CAAA;IAQX,GAAG,EAAE,MAAM,CAAA;IAQX,IAAI,EAAE,MAAM,CAAA;CACb;AAKD,qBAAa,yBAAyB,CACpC,OAAO,SAAS,yBAAyB,GAAG,yBAAyB,EACrE,GAAG,SAAS,+BAA+B,GAAG,+BAA+B,EAC7E,IAAI,SAAS,YAAY,GAAG,YAAY,CACxC,SAAQ,mBAAmB,CAAC,OAAO,EAAE,GAAG,EAAE,IAAI,CAAC;cAEtB,aAAa,CAAC,QAAQ,CAAC,EAAE,GAAG,EAAE;CAoCxD"}
@@ -2,10 +2,7 @@
2
2
  var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __reflectGet = Reflect.get;
8
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9
6
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
10
7
  var __export = (target, all) => {
11
8
  for (var name in all)
@@ -20,8 +17,6 @@ var __copyProps = (to, from, except, desc) => {
20
17
  return to;
21
18
  };
22
19
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
23
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
24
- var __superGet = (cls, obj, key) => __reflectGet(__getProtoOf(cls), key, obj);
25
20
 
26
21
  // src/index.ts
27
22
  var src_exports = {};
@@ -77,11 +72,6 @@ var _MemoryBoundWitnessDiviner = class _MemoryBoundWitnessDiviner extends import
77
72
  }
78
73
  };
79
74
  __name(_MemoryBoundWitnessDiviner, "MemoryBoundWitnessDiviner");
80
- __publicField(_MemoryBoundWitnessDiviner, "configSchemas", [
81
- ...__superGet(_MemoryBoundWitnessDiviner, _MemoryBoundWitnessDiviner, "configSchemas"),
82
- import_diviner_boundwitness_model.BoundWitnessDivinerConfigSchema
83
- ]);
84
- __publicField(_MemoryBoundWitnessDiviner, "defaultConfigSchema", import_diviner_boundwitness_model.BoundWitnessDivinerConfigSchema);
85
75
  var MemoryBoundWitnessDiviner = _MemoryBoundWitnessDiviner;
86
76
  // Annotate the CommonJS export names for ESM import in node:
87
77
  0 && (module.exports = {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts","../../src/MemoryBoundWitnessDiviner.ts"],"sourcesContent":["export * from './MemoryBoundWitnessDiviner.js'\n","import { containsAll } from '@xylabs/array'\nimport { assertEx } from '@xylabs/assert'\nimport { exists } from '@xylabs/exists'\nimport { hexFromHexString } from '@xylabs/hex'\nimport { BoundWitness, isBoundWitness } from '@xyo-network/boundwitness-model'\nimport { BoundWitnessDiviner } from '@xyo-network/diviner-boundwitness-abstract'\nimport {\n BoundWitnessDivinerConfigSchema,\n BoundWitnessDivinerParams,\n BoundWitnessDivinerQueryPayload,\n isBoundWitnessDivinerQueryPayload,\n} from '@xyo-network/diviner-boundwitness-model'\nimport { Schema, WithMeta } from '@xyo-network/payload-model'\n\nexport interface EqualityComparisonOperators {\n /**\n * 'Not Equal To' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value does not match the provided string.\n * Example: field != 'value'\n */\n '!=': string\n\n /**\n * 'Less Than' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value is lexicographically less than the provided string.\n * Example: field < 'value'\n */\n '<': string\n\n /**\n * 'Less Than or Equal To' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value is lexicographically less than or equal to the provided string.\n * Example: field <= 'value'\n */\n '<=': string\n\n /**\n * 'Equal To' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value matches the provided string exactly.\n * Example: field = 'value'\n */\n '=': string\n\n /**\n * 'Greater Than' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value is lexicographically greater than the provided string.\n * Example: field > 'value'\n */\n '>': string\n\n /**\n * 'Greater Than or Equal To' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value is lexicographically greater than or equal to the provided string.\n * Example: field >= 'value'\n */\n '>=': string\n}\n\ntype WithTimestamp = BoundWitness & { timestamp: number }\nconst hasTimestamp = (bw: BoundWitness): bw is WithTimestamp => bw.timestamp !== undefined\n\nexport class MemoryBoundWitnessDiviner<\n TParams extends BoundWitnessDivinerParams = BoundWitnessDivinerParams,\n TIn extends BoundWitnessDivinerQueryPayload = BoundWitnessDivinerQueryPayload,\n TOut extends BoundWitness = BoundWitness,\n> extends BoundWitnessDiviner<TParams, TIn, TOut> {\n static override readonly configSchemas: Schema[] = [...super.configSchemas, BoundWitnessDivinerConfigSchema]\n static override readonly defaultConfigSchema: Schema = BoundWitnessDivinerConfigSchema\n\n // eslint-disable-next-line complexity\n protected override async divineHandler(payloads?: TIn[]) {\n const filter = assertEx(payloads?.filter(isBoundWitnessDivinerQueryPayload)?.pop(), () => 'Missing query payload')\n if (!filter) return []\n const archivist = assertEx(await this.archivistInstance(), () => 'Unable to resolve archivist')\n const { addresses, payload_hashes, payload_schemas, limit, offset, order = 'desc', sourceQuery, destination, timestamp } = filter\n let bws = ((await archivist?.all?.()) ?? []).filter(isBoundWitness) as WithMeta<BoundWitness>[]\n if (order === 'desc') bws = bws.reverse()\n const allAddresses = addresses?.map((address) => hexFromHexString(address)).filter(exists)\n if (allAddresses?.length) bws = bws.filter((bw) => containsAll(bw.addresses, allAddresses))\n if (payload_hashes?.length) bws = bws.filter((bw) => containsAll(bw.payload_hashes, payload_hashes))\n if (payload_schemas?.length) bws = bws.filter((bw) => containsAll(bw.payload_schemas, payload_schemas))\n if (sourceQuery) bws = bws.filter((bw) => (bw?.$meta as { sourceQuery?: string })?.sourceQuery === sourceQuery)\n // If there's a destination filter of the right kind\n if (destination && Array.isArray(destination) && destination?.length > 0) {\n const targetFilter = assertEx(destination, () => 'Missing destination')\n // Find all BWs that satisfy the destination constraint\n bws = bws.filter((bw) => {\n const targetDestinationField = (bw?.$meta as { destination?: string[] })?.destination\n // If the destination field is an array and contains at least one element\n return targetDestinationField !== undefined && Array.isArray(targetDestinationField) && targetDestinationField.length > 0 ?\n // Check that the targetDestinationField contains all the elements in the targetFilter\n containsAll(targetFilter, targetDestinationField ?? [])\n // Otherwise, filter it out\n : false\n })\n }\n if (timestamp !== undefined) {\n bws =\n order === 'desc' ?\n bws.filter(hasTimestamp).filter((bw) => bw.timestamp <= timestamp)\n : bws.filter(hasTimestamp).filter((bw) => bw.timestamp >= timestamp)\n }\n const parsedLimit = limit ?? bws.length\n const parsedOffset = offset ?? 0\n return bws.slice(parsedOffset, parsedLimit) as WithMeta<TOut>[]\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;ACAA,mBAA4B;AA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AAA,MAAgBA,2CAAaU,UAAS,GAAG;AACxE,YAAMM,mBAAe5B,wBAASY,aAAa,MAAM,qBAAA;AAEjDC,YAAMA,IAAId,OAAO,CAACP,OAAAA;AA5FxB,YAAAgC;AA6FQ,cAAMK,0BAA0BrC,MAAAA,yBAAIiC,UAAJjC,gBAAAA,IAA0CoB;AAE1E,eAAOiB,2BAA2BnC,UAAagC,MAAMC,QAAQE,sBAAAA,KAA2BA,uBAAuBP,SAAS;;cAEpHC,0BAAYK,cAAcC,0BAA0B,CAAA,CAAE;YAEtD;MACN,CAAA;IACF;AACA,QAAIpC,cAAcC,QAAW;AAC3BmB,YACEH,UAAU,SACRG,IAAId,OAAOR,YAAAA,EAAcQ,OAAO,CAACP,OAAOA,GAAGC,aAAaA,SAAAA,IACxDoB,IAAId,OAAOR,YAAAA,EAAcQ,OAAO,CAACP,OAAOA,GAAGC,aAAaA,SAAAA;IAC9D;AACA,UAAMqC,cAActB,SAASK,IAAIS;AACjC,UAAMS,eAAetB,UAAU;AAC/B,WAAOI,IAAImB,MAAMD,cAAcD,WAAAA;EACjC;AACF;AAzCUlC;AACR,cALWD,4BAKcsC,iBAA0B;KAAI,mEAAMA;EAAeC;;AAC5E,cANWvC,4BAMcwC,uBAA8BD;AANlD,IAAMvC,4BAAN;","names":["hasTimestamp","bw","timestamp","undefined","MemoryBoundWitnessDiviner","BoundWitnessDiviner","divineHandler","payloads","filter","assertEx","isBoundWitnessDivinerQueryPayload","pop","archivist","archivistInstance","addresses","payload_hashes","payload_schemas","limit","offset","order","sourceQuery","destination","bws","all","isBoundWitness","reverse","allAddresses","map","address","hexFromHexString","exists","length","containsAll","_a","$meta","Array","isArray","targetFilter","targetDestinationField","parsedLimit","parsedOffset","slice","configSchemas","BoundWitnessDivinerConfigSchema","defaultConfigSchema"]}
1
+ {"version":3,"sources":["../../src/index.ts","../../src/MemoryBoundWitnessDiviner.ts"],"sourcesContent":["export * from './MemoryBoundWitnessDiviner.js'\n","import { containsAll } from '@xylabs/array'\nimport { assertEx } from '@xylabs/assert'\nimport { exists } from '@xylabs/exists'\nimport { hexFromHexString } from '@xylabs/hex'\nimport { BoundWitness, isBoundWitness } from '@xyo-network/boundwitness-model'\nimport { BoundWitnessDiviner } from '@xyo-network/diviner-boundwitness-abstract'\nimport {\n BoundWitnessDivinerParams,\n BoundWitnessDivinerQueryPayload,\n isBoundWitnessDivinerQueryPayload,\n} from '@xyo-network/diviner-boundwitness-model'\nimport { WithMeta } from '@xyo-network/payload-model'\n\nexport interface EqualityComparisonOperators {\n /**\n * 'Not Equal To' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value does not match the provided string.\n * Example: field != 'value'\n */\n '!=': string\n\n /**\n * 'Less Than' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value is lexicographically less than the provided string.\n * Example: field < 'value'\n */\n '<': string\n\n /**\n * 'Less Than or Equal To' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value is lexicographically less than or equal to the provided string.\n * Example: field <= 'value'\n */\n '<=': string\n\n /**\n * 'Equal To' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value matches the provided string exactly.\n * Example: field = 'value'\n */\n '=': string\n\n /**\n * 'Greater Than' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value is lexicographically greater than the provided string.\n * Example: field > 'value'\n */\n '>': string\n\n /**\n * 'Greater Than or Equal To' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value is lexicographically greater than or equal to the provided string.\n * Example: field >= 'value'\n */\n '>=': string\n}\n\ntype WithTimestamp = BoundWitness & { timestamp: number }\nconst hasTimestamp = (bw: BoundWitness): bw is WithTimestamp => bw.timestamp !== undefined\n\nexport class MemoryBoundWitnessDiviner<\n TParams extends BoundWitnessDivinerParams = BoundWitnessDivinerParams,\n TIn extends BoundWitnessDivinerQueryPayload = BoundWitnessDivinerQueryPayload,\n TOut extends BoundWitness = BoundWitness,\n> extends BoundWitnessDiviner<TParams, TIn, TOut> {\n // eslint-disable-next-line complexity\n protected override async divineHandler(payloads?: TIn[]) {\n const filter = assertEx(payloads?.filter(isBoundWitnessDivinerQueryPayload)?.pop(), () => 'Missing query payload')\n if (!filter) return []\n const archivist = assertEx(await this.archivistInstance(), () => 'Unable to resolve archivist')\n const { addresses, payload_hashes, payload_schemas, limit, offset, order = 'desc', sourceQuery, destination, timestamp } = filter\n let bws = ((await archivist?.all?.()) ?? []).filter(isBoundWitness) as WithMeta<BoundWitness>[]\n if (order === 'desc') bws = bws.reverse()\n const allAddresses = addresses?.map((address) => hexFromHexString(address)).filter(exists)\n if (allAddresses?.length) bws = bws.filter((bw) => containsAll(bw.addresses, allAddresses))\n if (payload_hashes?.length) bws = bws.filter((bw) => containsAll(bw.payload_hashes, payload_hashes))\n if (payload_schemas?.length) bws = bws.filter((bw) => containsAll(bw.payload_schemas, payload_schemas))\n if (sourceQuery) bws = bws.filter((bw) => (bw?.$meta as { sourceQuery?: string })?.sourceQuery === sourceQuery)\n // If there's a destination filter of the right kind\n if (destination && Array.isArray(destination) && destination?.length > 0) {\n const targetFilter = assertEx(destination, () => 'Missing destination')\n // Find all BWs that satisfy the destination constraint\n bws = bws.filter((bw) => {\n const targetDestinationField = (bw?.$meta as { destination?: string[] })?.destination\n // If the destination field is an array and contains at least one element\n return targetDestinationField !== undefined && Array.isArray(targetDestinationField) && targetDestinationField.length > 0 ?\n // Check that the targetDestinationField contains all the elements in the targetFilter\n containsAll(targetFilter, targetDestinationField ?? [])\n // Otherwise, filter it out\n : false\n })\n }\n if (timestamp !== undefined) {\n bws =\n order === 'desc' ?\n bws.filter(hasTimestamp).filter((bw) => bw.timestamp <= timestamp)\n : bws.filter(hasTimestamp).filter((bw) => bw.timestamp >= timestamp)\n }\n const parsedLimit = limit ?? bws.length\n const parsedOffset = offset ?? 0\n return bws.slice(parsedOffset, parsedLimit) as WithMeta<TOut>[]\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;ACAA,mBAA4B;AAC5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,MAAgBA,2CAAaU,UAAS,GAAG;AACxE,YAAMM,mBAAe5B,wBAASY,aAAa,MAAM,qBAAA;AAEjDC,YAAMA,IAAId,OAAO,CAACP,OAAAA;AAxFxB,YAAAgC;AAyFQ,cAAMK,0BAA0BrC,MAAAA,yBAAIiC,UAAJjC,gBAAAA,IAA0CoB;AAE1E,eAAOiB,2BAA2BnC,UAAagC,MAAMC,QAAQE,sBAAAA,KAA2BA,uBAAuBP,SAAS;;cAEpHC,0BAAYK,cAAcC,0BAA0B,CAAA,CAAE;YAEtD;MACN,CAAA;IACF;AACA,QAAIpC,cAAcC,QAAW;AAC3BmB,YACEH,UAAU,SACRG,IAAId,OAAOR,YAAAA,EAAcQ,OAAO,CAACP,OAAOA,GAAGC,aAAaA,SAAAA,IACxDoB,IAAId,OAAOR,YAAAA,EAAcQ,OAAO,CAACP,OAAOA,GAAGC,aAAaA,SAAAA;IAC9D;AACA,UAAMqC,cAActB,SAASK,IAAIS;AACjC,UAAMS,eAAetB,UAAU;AAC/B,WAAOI,IAAImB,MAAMD,cAAcD,WAAAA;EACjC;AACF;AAtCUlC;AAJH,IAAMD,4BAAN;","names":["hasTimestamp","bw","timestamp","undefined","MemoryBoundWitnessDiviner","BoundWitnessDiviner","divineHandler","payloads","filter","assertEx","isBoundWitnessDivinerQueryPayload","pop","archivist","archivistInstance","addresses","payload_hashes","payload_schemas","limit","offset","order","sourceQuery","destination","bws","all","isBoundWitness","reverse","allAddresses","map","address","hexFromHexString","exists","length","containsAll","_a","$meta","Array","isArray","targetFilter","targetDestinationField","parsedLimit","parsedOffset","slice"]}
@@ -1,10 +1,5 @@
1
1
  var __defProp = Object.defineProperty;
2
- var __getProtoOf = Object.getPrototypeOf;
3
- var __reflectGet = Reflect.get;
4
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5
2
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
7
- var __superGet = (cls, obj, key) => __reflectGet(__getProtoOf(cls), key, obj);
8
3
 
9
4
  // src/MemoryBoundWitnessDiviner.ts
10
5
  import { containsAll } from "@xylabs/array";
@@ -13,7 +8,7 @@ import { exists } from "@xylabs/exists";
13
8
  import { hexFromHexString } from "@xylabs/hex";
14
9
  import { isBoundWitness } from "@xyo-network/boundwitness-model";
15
10
  import { BoundWitnessDiviner } from "@xyo-network/diviner-boundwitness-abstract";
16
- import { BoundWitnessDivinerConfigSchema, isBoundWitnessDivinerQueryPayload } from "@xyo-network/diviner-boundwitness-model";
11
+ import { isBoundWitnessDivinerQueryPayload } from "@xyo-network/diviner-boundwitness-model";
17
12
  var hasTimestamp = /* @__PURE__ */ __name((bw) => bw.timestamp !== void 0, "hasTimestamp");
18
13
  var _MemoryBoundWitnessDiviner = class _MemoryBoundWitnessDiviner extends BoundWitnessDiviner {
19
14
  // eslint-disable-next-line complexity
@@ -53,11 +48,6 @@ var _MemoryBoundWitnessDiviner = class _MemoryBoundWitnessDiviner extends BoundW
53
48
  }
54
49
  };
55
50
  __name(_MemoryBoundWitnessDiviner, "MemoryBoundWitnessDiviner");
56
- __publicField(_MemoryBoundWitnessDiviner, "configSchemas", [
57
- ...__superGet(_MemoryBoundWitnessDiviner, _MemoryBoundWitnessDiviner, "configSchemas"),
58
- BoundWitnessDivinerConfigSchema
59
- ]);
60
- __publicField(_MemoryBoundWitnessDiviner, "defaultConfigSchema", BoundWitnessDivinerConfigSchema);
61
51
  var MemoryBoundWitnessDiviner = _MemoryBoundWitnessDiviner;
62
52
  export {
63
53
  MemoryBoundWitnessDiviner
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/MemoryBoundWitnessDiviner.ts"],"sourcesContent":["import { containsAll } from '@xylabs/array'\nimport { assertEx } from '@xylabs/assert'\nimport { exists } from '@xylabs/exists'\nimport { hexFromHexString } from '@xylabs/hex'\nimport { BoundWitness, isBoundWitness } from '@xyo-network/boundwitness-model'\nimport { BoundWitnessDiviner } from '@xyo-network/diviner-boundwitness-abstract'\nimport {\n BoundWitnessDivinerConfigSchema,\n BoundWitnessDivinerParams,\n BoundWitnessDivinerQueryPayload,\n isBoundWitnessDivinerQueryPayload,\n} from '@xyo-network/diviner-boundwitness-model'\nimport { Schema, WithMeta } from '@xyo-network/payload-model'\n\nexport interface EqualityComparisonOperators {\n /**\n * 'Not Equal To' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value does not match the provided string.\n * Example: field != 'value'\n */\n '!=': string\n\n /**\n * 'Less Than' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value is lexicographically less than the provided string.\n * Example: field < 'value'\n */\n '<': string\n\n /**\n * 'Less Than or Equal To' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value is lexicographically less than or equal to the provided string.\n * Example: field <= 'value'\n */\n '<=': string\n\n /**\n * 'Equal To' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value matches the provided string exactly.\n * Example: field = 'value'\n */\n '=': string\n\n /**\n * 'Greater Than' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value is lexicographically greater than the provided string.\n * Example: field > 'value'\n */\n '>': string\n\n /**\n * 'Greater Than or Equal To' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value is lexicographically greater than or equal to the provided string.\n * Example: field >= 'value'\n */\n '>=': string\n}\n\ntype WithTimestamp = BoundWitness & { timestamp: number }\nconst hasTimestamp = (bw: BoundWitness): bw is WithTimestamp => bw.timestamp !== undefined\n\nexport class MemoryBoundWitnessDiviner<\n TParams extends BoundWitnessDivinerParams = BoundWitnessDivinerParams,\n TIn extends BoundWitnessDivinerQueryPayload = BoundWitnessDivinerQueryPayload,\n TOut extends BoundWitness = BoundWitness,\n> extends BoundWitnessDiviner<TParams, TIn, TOut> {\n static override readonly configSchemas: Schema[] = [...super.configSchemas, BoundWitnessDivinerConfigSchema]\n static override readonly defaultConfigSchema: Schema = BoundWitnessDivinerConfigSchema\n\n // eslint-disable-next-line complexity\n protected override async divineHandler(payloads?: TIn[]) {\n const filter = assertEx(payloads?.filter(isBoundWitnessDivinerQueryPayload)?.pop(), () => 'Missing query payload')\n if (!filter) return []\n const archivist = assertEx(await this.archivistInstance(), () => 'Unable to resolve archivist')\n const { addresses, payload_hashes, payload_schemas, limit, offset, order = 'desc', sourceQuery, destination, timestamp } = filter\n let bws = ((await archivist?.all?.()) ?? []).filter(isBoundWitness) as WithMeta<BoundWitness>[]\n if (order === 'desc') bws = bws.reverse()\n const allAddresses = addresses?.map((address) => hexFromHexString(address)).filter(exists)\n if (allAddresses?.length) bws = bws.filter((bw) => containsAll(bw.addresses, allAddresses))\n if (payload_hashes?.length) bws = bws.filter((bw) => containsAll(bw.payload_hashes, payload_hashes))\n if (payload_schemas?.length) bws = bws.filter((bw) => containsAll(bw.payload_schemas, payload_schemas))\n if (sourceQuery) bws = bws.filter((bw) => (bw?.$meta as { sourceQuery?: string })?.sourceQuery === sourceQuery)\n // If there's a destination filter of the right kind\n if (destination && Array.isArray(destination) && destination?.length > 0) {\n const targetFilter = assertEx(destination, () => 'Missing destination')\n // Find all BWs that satisfy the destination constraint\n bws = bws.filter((bw) => {\n const targetDestinationField = (bw?.$meta as { destination?: string[] })?.destination\n // If the destination field is an array and contains at least one element\n return targetDestinationField !== undefined && Array.isArray(targetDestinationField) && targetDestinationField.length > 0 ?\n // Check that the targetDestinationField contains all the elements in the targetFilter\n containsAll(targetFilter, targetDestinationField ?? [])\n // Otherwise, filter it out\n : false\n })\n }\n if (timestamp !== undefined) {\n bws =\n order === 'desc' ?\n bws.filter(hasTimestamp).filter((bw) => bw.timestamp <= timestamp)\n : bws.filter(hasTimestamp).filter((bw) => bw.timestamp >= timestamp)\n }\n const parsedLimit = limit ?? bws.length\n const parsedOffset = offset ?? 0\n return bws.slice(parsedOffset, parsedLimit) as WithMeta<TOut>[]\n }\n}\n"],"mappings":";;;;;;;;;AAAA,SAASA,mBAAmB;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AEnG,QAAIC,eAAec,MAAMC,QAAQf,WAAAA,MAAgBA,2CAAaU,UAAS,GAAG;AACxE,YAAMM,eAAe5B,SAASY,aAAa,MAAM,qBAAA;AAEjDC,YAAMA,IAAId,OAAO,CAACP,OAAAA;AA5FxB,YAAAgC;AA6FQ,cAAMK,0BAA0BrC,MAAAA,yBAAIiC,UAAJjC,gBAAAA,IAA0CoB;AAE1E,eAAOiB,2BAA2BnC,UAAagC,MAAMC,QAAQE,sBAAAA,KAA2BA,uBAAuBP,SAAS;;UAEpHC,YAAYK,cAAcC,0BAA0B,CAAA,CAAE;YAEtD;MACN,CAAA;IACF;AACA,QAAIpC,cAAcC,QAAW;AAC3BmB,YACEH,UAAU,SACRG,IAAId,OAAOR,YAAAA,EAAcQ,OAAO,CAACP,OAAOA,GAAGC,aAAaA,SAAAA,IACxDoB,IAAId,OAAOR,YAAAA,EAAcQ,OAAO,CAACP,OAAOA,GAAGC,aAAaA,SAAAA;IAC9D;AACA,UAAMqC,cAActB,SAASK,IAAIS;AACjC,UAAMS,eAAetB,UAAU;AAC/B,WAAOI,IAAImB,MAAMD,cAAcD,WAAAA;EACjC;AACF;AAzCUlC;AACR,cALWD,4BAKcsC,iBAA0B;KAAI,mEAAMA;EAAeC;;AAC5E,cANWvC,4BAMcwC,uBAA8BD;AANlD,IAAMvC,4BAAN;","names":["containsAll","assertEx","exists","hexFromHexString","isBoundWitness","BoundWitnessDiviner","BoundWitnessDivinerConfigSchema","isBoundWitnessDivinerQueryPayload","hasTimestamp","bw","timestamp","undefined","MemoryBoundWitnessDiviner","BoundWitnessDiviner","divineHandler","payloads","filter","assertEx","isBoundWitnessDivinerQueryPayload","pop","archivist","archivistInstance","addresses","payload_hashes","payload_schemas","limit","offset","order","sourceQuery","destination","bws","all","isBoundWitness","reverse","allAddresses","map","address","hexFromHexString","exists","length","containsAll","_a","$meta","Array","isArray","targetFilter","targetDestinationField","parsedLimit","parsedOffset","slice","configSchemas","BoundWitnessDivinerConfigSchema","defaultConfigSchema"]}
1
+ {"version":3,"sources":["../../src/MemoryBoundWitnessDiviner.ts"],"sourcesContent":["import { containsAll } from '@xylabs/array'\nimport { assertEx } from '@xylabs/assert'\nimport { exists } from '@xylabs/exists'\nimport { hexFromHexString } from '@xylabs/hex'\nimport { BoundWitness, isBoundWitness } from '@xyo-network/boundwitness-model'\nimport { BoundWitnessDiviner } from '@xyo-network/diviner-boundwitness-abstract'\nimport {\n BoundWitnessDivinerParams,\n BoundWitnessDivinerQueryPayload,\n isBoundWitnessDivinerQueryPayload,\n} from '@xyo-network/diviner-boundwitness-model'\nimport { WithMeta } from '@xyo-network/payload-model'\n\nexport interface EqualityComparisonOperators {\n /**\n * 'Not Equal To' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value does not match the provided string.\n * Example: field != 'value'\n */\n '!=': string\n\n /**\n * 'Less Than' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value is lexicographically less than the provided string.\n * Example: field < 'value'\n */\n '<': string\n\n /**\n * 'Less Than or Equal To' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value is lexicographically less than or equal to the provided string.\n * Example: field <= 'value'\n */\n '<=': string\n\n /**\n * 'Equal To' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value matches the provided string exactly.\n * Example: field = 'value'\n */\n '=': string\n\n /**\n * 'Greater Than' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value is lexicographically greater than the provided string.\n * Example: field > 'value'\n */\n '>': string\n\n /**\n * 'Greater Than or Equal To' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value is lexicographically greater than or equal to the provided string.\n * Example: field >= 'value'\n */\n '>=': string\n}\n\ntype WithTimestamp = BoundWitness & { timestamp: number }\nconst hasTimestamp = (bw: BoundWitness): bw is WithTimestamp => bw.timestamp !== undefined\n\nexport class MemoryBoundWitnessDiviner<\n TParams extends BoundWitnessDivinerParams = BoundWitnessDivinerParams,\n TIn extends BoundWitnessDivinerQueryPayload = BoundWitnessDivinerQueryPayload,\n TOut extends BoundWitness = BoundWitness,\n> extends BoundWitnessDiviner<TParams, TIn, TOut> {\n // eslint-disable-next-line complexity\n protected override async divineHandler(payloads?: TIn[]) {\n const filter = assertEx(payloads?.filter(isBoundWitnessDivinerQueryPayload)?.pop(), () => 'Missing query payload')\n if (!filter) return []\n const archivist = assertEx(await this.archivistInstance(), () => 'Unable to resolve archivist')\n const { addresses, payload_hashes, payload_schemas, limit, offset, order = 'desc', sourceQuery, destination, timestamp } = filter\n let bws = ((await archivist?.all?.()) ?? []).filter(isBoundWitness) as WithMeta<BoundWitness>[]\n if (order === 'desc') bws = bws.reverse()\n const allAddresses = addresses?.map((address) => hexFromHexString(address)).filter(exists)\n if (allAddresses?.length) bws = bws.filter((bw) => containsAll(bw.addresses, allAddresses))\n if (payload_hashes?.length) bws = bws.filter((bw) => containsAll(bw.payload_hashes, payload_hashes))\n if (payload_schemas?.length) bws = bws.filter((bw) => containsAll(bw.payload_schemas, payload_schemas))\n if (sourceQuery) bws = bws.filter((bw) => (bw?.$meta as { sourceQuery?: string })?.sourceQuery === sourceQuery)\n // If there's a destination filter of the right kind\n if (destination && Array.isArray(destination) && destination?.length > 0) {\n const targetFilter = assertEx(destination, () => 'Missing destination')\n // Find all BWs that satisfy the destination constraint\n bws = bws.filter((bw) => {\n const targetDestinationField = (bw?.$meta as { destination?: string[] })?.destination\n // If the destination field is an array and contains at least one element\n return targetDestinationField !== undefined && Array.isArray(targetDestinationField) && targetDestinationField.length > 0 ?\n // Check that the targetDestinationField contains all the elements in the targetFilter\n containsAll(targetFilter, targetDestinationField ?? [])\n // Otherwise, filter it out\n : false\n })\n }\n if (timestamp !== undefined) {\n bws =\n order === 'desc' ?\n bws.filter(hasTimestamp).filter((bw) => bw.timestamp <= timestamp)\n : bws.filter(hasTimestamp).filter((bw) => bw.timestamp >= timestamp)\n }\n const parsedLimit = limit ?? bws.length\n const parsedOffset = offset ?? 0\n return bws.slice(parsedOffset, parsedLimit) as WithMe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UAAJjC,gBAAAA,IAAwCmB,iBAAgBA;KAAAA;AAEnG,QAAIC,eAAec,MAAMC,QAAQf,WAAAA,MAAgBA,2CAAaU,UAAS,GAAG;AACxE,YAAMM,eAAe5B,SAASY,aAAa,MAAM,qBAAA;AAEjDC,YAAMA,IAAId,OAAO,CAACP,OAAAA;AAxFxB,YAAAgC;AAyFQ,cAAMK,0BAA0BrC,MAAAA,yBAAIiC,UAAJjC,gBAAAA,IAA0CoB;AAE1E,eAAOiB,2BAA2BnC,UAAagC,MAAMC,QAAQE,sBAAAA,KAA2BA,uBAAuBP,SAAS;;UAEpHC,YAAYK,cAAcC,0BAA0B,CAAA,CAAE;YAEtD;MACN,CAAA;IACF;AACA,QAAIpC,cAAcC,QAAW;AAC3BmB,YACEH,UAAU,SACRG,IAAId,OAAOR,YAAAA,EAAcQ,OAAO,CAACP,OAAOA,GAAGC,aAAaA,SAAAA,IACxDoB,IAAId,OAAOR,YAAAA,EAAcQ,OAAO,CAACP,OAAOA,GAAGC,aAAaA,SAAAA;IAC9D;AACA,UAAMqC,cAActB,SAASK,IAAIS;AACjC,UAAMS,eAAetB,UAAU;AAC/B,WAAOI,IAAImB,MAAMD,cAAcD,WAAAA;EACjC;AACF;AAtCUlC;AAJH,IAAMD,4BAAN;","names":["containsAll","assertEx","exists","hexFromHexString","isBoundWitness","BoundWitnessDiviner","isBoundWitnessDivinerQueryPayload","hasTimestamp","bw","timestamp","undefined","MemoryBoundWitnessDiviner","BoundWitnessDiviner","divineHandler","payloads","filter","assertEx","isBoundWitnessDivinerQueryPayload","pop","archivist","archivistInstance","addresses","payload_hashes","payload_schemas","limit","offset","order","sourceQuery","destination","bws","all","isBoundWitness","reverse","allAddresses","map","address","hexFromHexString","exists","length","containsAll","_a","$meta","Array","isArray","targetFilter","targetDestinationField","parsedLimit","parsedOffset","slice"]}
package/package.json CHANGED
@@ -10,23 +10,23 @@
10
10
  "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/issues"
11
11
  },
12
12
  "dependencies": {
13
- "@xylabs/array": "^3.6.5",
14
- "@xylabs/assert": "^3.6.5",
15
- "@xylabs/exists": "^3.6.5",
16
- "@xylabs/hex": "^3.6.5",
17
- "@xyo-network/boundwitness-model": "^2.110.13",
18
- "@xyo-network/diviner-boundwitness-abstract": "^2.110.13",
19
- "@xyo-network/diviner-boundwitness-model": "^2.110.13",
20
- "@xyo-network/payload-model": "^2.110.13"
13
+ "@xylabs/array": "^3.6.6",
14
+ "@xylabs/assert": "^3.6.6",
15
+ "@xylabs/exists": "^3.6.6",
16
+ "@xylabs/hex": "^3.6.6",
17
+ "@xyo-network/boundwitness-model": "^2.110.15",
18
+ "@xyo-network/diviner-boundwitness-abstract": "^2.110.15",
19
+ "@xyo-network/diviner-boundwitness-model": "^2.110.15",
20
+ "@xyo-network/payload-model": "^2.110.15"
21
21
  },
22
22
  "devDependencies": {
23
- "@xylabs/ts-scripts-yarn3": "^3.13.9",
24
- "@xylabs/tsconfig": "^3.13.9",
25
- "@xyo-network/account": "^2.110.13",
26
- "@xyo-network/archivist-memory": "^2.110.13",
27
- "@xyo-network/boundwitness-builder": "^2.110.13",
28
- "@xyo-network/node-memory": "^2.110.13",
29
- "@xyo-network/payload-builder": "^2.110.13",
23
+ "@xylabs/ts-scripts-yarn3": "^3.14.1",
24
+ "@xylabs/tsconfig": "^3.14.1",
25
+ "@xyo-network/account": "^2.110.15",
26
+ "@xyo-network/archivist-memory": "^2.110.15",
27
+ "@xyo-network/boundwitness-builder": "^2.110.15",
28
+ "@xyo-network/node-memory": "^2.110.15",
29
+ "@xyo-network/payload-builder": "^2.110.15",
30
30
  "typescript": "^5.5.4"
31
31
  },
32
32
  "description": "Primary SDK for using XYO Protocol 2.0",
@@ -68,6 +68,6 @@
68
68
  "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js.git"
69
69
  },
70
70
  "sideEffects": false,
71
- "version": "2.110.13",
71
+ "version": "2.110.15",
72
72
  "type": "module"
73
73
  }
@@ -5,12 +5,11 @@ import { hexFromHexString } from '@xylabs/hex'
5
5
  import { BoundWitness, isBoundWitness } from '@xyo-network/boundwitness-model'
6
6
  import { BoundWitnessDiviner } from '@xyo-network/diviner-boundwitness-abstract'
7
7
  import {
8
- BoundWitnessDivinerConfigSchema,
9
8
  BoundWitnessDivinerParams,
10
9
  BoundWitnessDivinerQueryPayload,
11
10
  isBoundWitnessDivinerQueryPayload,
12
11
  } from '@xyo-network/diviner-boundwitness-model'
13
- import { Schema, WithMeta } from '@xyo-network/payload-model'
12
+ import { WithMeta } from '@xyo-network/payload-model'
14
13
 
15
14
  export interface EqualityComparisonOperators {
16
15
  /**
@@ -70,9 +69,6 @@ export class MemoryBoundWitnessDiviner<
70
69
  TIn extends BoundWitnessDivinerQueryPayload = BoundWitnessDivinerQueryPayload,
71
70
  TOut extends BoundWitness = BoundWitness,
72
71
  > extends BoundWitnessDiviner<TParams, TIn, TOut> {
73
- static override readonly configSchemas: Schema[] = [...super.configSchemas, BoundWitnessDivinerConfigSchema]
74
- static override readonly defaultConfigSchema: Schema = BoundWitnessDivinerConfigSchema
75
-
76
72
  // eslint-disable-next-line complexity
77
73
  protected override async divineHandler(payloads?: TIn[]) {
78
74
  const filter = assertEx(payloads?.filter(isBoundWitnessDivinerQueryPayload)?.pop(), () => 'Missing query payload')