@xyo-network/diviner-temporal-indexing-memory 2.90.2 → 2.90.3

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 (29) hide show
  1. package/dist/browser/IndexCandidateToIndexDiviner/Diviner.d.cts +1 -1
  2. package/dist/browser/IndexCandidateToIndexDiviner/Diviner.d.cts.map +1 -1
  3. package/dist/browser/IndexCandidateToIndexDiviner/Diviner.d.mts +1 -1
  4. package/dist/browser/IndexCandidateToIndexDiviner/Diviner.d.mts.map +1 -1
  5. package/dist/browser/IndexCandidateToIndexDiviner/Diviner.d.ts +1 -1
  6. package/dist/browser/IndexCandidateToIndexDiviner/Diviner.d.ts.map +1 -1
  7. package/dist/browser/StateToIndexCandidateDiviner/Diviner.d.cts.map +1 -1
  8. package/dist/browser/StateToIndexCandidateDiviner/Diviner.d.mts.map +1 -1
  9. package/dist/browser/StateToIndexCandidateDiviner/Diviner.d.ts.map +1 -1
  10. package/dist/browser/index.cjs +6 -4
  11. package/dist/browser/index.cjs.map +1 -1
  12. package/dist/browser/index.js +8 -6
  13. package/dist/browser/index.js.map +1 -1
  14. package/dist/node/IndexCandidateToIndexDiviner/Diviner.d.cts +1 -1
  15. package/dist/node/IndexCandidateToIndexDiviner/Diviner.d.cts.map +1 -1
  16. package/dist/node/IndexCandidateToIndexDiviner/Diviner.d.mts +1 -1
  17. package/dist/node/IndexCandidateToIndexDiviner/Diviner.d.mts.map +1 -1
  18. package/dist/node/IndexCandidateToIndexDiviner/Diviner.d.ts +1 -1
  19. package/dist/node/IndexCandidateToIndexDiviner/Diviner.d.ts.map +1 -1
  20. package/dist/node/StateToIndexCandidateDiviner/Diviner.d.cts.map +1 -1
  21. package/dist/node/StateToIndexCandidateDiviner/Diviner.d.mts.map +1 -1
  22. package/dist/node/StateToIndexCandidateDiviner/Diviner.d.ts.map +1 -1
  23. package/dist/node/index.cjs +6 -4
  24. package/dist/node/index.cjs.map +1 -1
  25. package/dist/node/index.js +8 -6
  26. package/dist/node/index.js.map +1 -1
  27. package/package.json +30 -30
  28. package/src/IndexCandidateToIndexDiviner/Diviner.ts +8 -7
  29. package/src/StateToIndexCandidateDiviner/Diviner.ts +2 -2
@@ -34,7 +34,7 @@ export declare class TemporalIndexingDivinerIndexCandidateToIndexDiviner<TParams
34
34
  * @param x The candidate payload
35
35
  * @returns True if the payload is one indexed by this diviner, false otherwise
36
36
  */
37
- protected isIndexablePayload: (x: Payload) => boolean;
37
+ protected isIndexablePayload: (x: unknown) => boolean;
38
38
  /**
39
39
  * Identifies if a schema is one that is indexed by this diviner
40
40
  * @param schema The candidate schema
@@ -1 +1 @@
1
- {"version":3,"file":"Diviner.d.ts","sourceRoot":"","sources":["../../../src/IndexCandidateToIndexDiviner/Diviner.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAE/D,OAAO,EAAE,8CAA8C,EAAE,qCAAqC,EAAE,MAAM,qCAAqC,CAAA;AAE3I,OAAO,EAEL,yDAAyD,EAG1D,MAAM,8CAA8C,CAAA;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAElD,OAAO,EAAE,OAAO,EAAiB,MAAM,4BAA4B,CAAA;AAOnE;;;;GAIG;AACH,qBAAa,mDAAmD,CAC9D,OAAO,SAAS,yDAAyD,GAAG,yDAAyD,CACrI,SAAQ,eAAe,CAAC,OAAO,CAAC;IAChC,OAAgB,YAAY,oFAAkE;IAC9F,OAAgB,aAAa,WAAyF;IACtH,MAAM,CAAC,MAAM,EAAE,MAAM,CAEpB;IAED,OAAO,CAAC,iBAAiB,CAAsB;IAC/C,OAAO,CAAC,oBAAoB,CAAmD;IAE/E;;OAEG;IACH,SAAS,KAAK,gBAAgB,IAAI,MAAM,EAAE,CAGzC;IAED;;;OAGG;IACH,SAAS,KAAK,mBAAmB,IAAI,qCAAqC,CAGzE;IAED;;;OAGG;IACH,SAAS,KAAK,gBAAgB,IAAI,8C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IACH,SAAS,CAAC,iBAAiB,YAAa,MAAM,GAAG,IAAI,aAEpD;CACF"}
@@ -34,7 +34,7 @@ export declare class TemporalIndexingDivinerIndexCandidateToIndexDiviner<TParams
34
34
  * @param x The candidate payload
35
35
  * @returns True if the payload is one indexed by this diviner, false otherwise
36
36
  */
37
- protected isIndexablePayload: (x: Payload) => boolean;
37
+ protected isIndexablePayload: (x: unknown) => boolean;
38
38
  /**
39
39
  * Identifies if a schema is one that is indexed by this diviner
40
40
  * @param schema The candidate schema
@@ -1 +1 @@
1
- {"version":3,"file":"Diviner.d.ts","sourceRoot":"","sources":["../../../src/IndexCandidateToIndexDiviner/Diviner.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAE/D,OAAO,EAAE,8CAA8C,EAAE,qCAAqC,EAAE,MAAM,qCAAqC,CAAA;AAE3I,OAAO,EAEL,yDAAyD,EAG1D,MAAM,8CAA8C,CAAA;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAElD,OAAO,EAAE,OAAO,EAAiB,MAAM,4BAA4B,CAAA;AAOnE;;;;GAIG;AACH,qBAAa,mDAAmD,CAC9D,OAAO,SAAS,yDAAyD,GAAG,yDAAyD,CACrI,SAAQ,eAAe,CAAC,OAAO,CAAC;IAChC,OAAgB,YAAY,oFAAkE;IAC9F,OAAgB,aAAa,WAAyF;IACtH,MAAM,CAAC,MAAM,EAAE,MAAM,CAEpB;IAED,OAAO,CAAC,iBAAiB,CAAsB;IAC/C,OAAO,CAAC,oBAAoB,CAAmD;IAE/E;;OAEG;IACH,SAAS,KAAK,gBAAgB,IAAI,MAAM,EAAE,CAGzC;IAED;;;OAGG;IACH,SAAS,KAAK,mBAAmB,IAAI,qCAAqC,CAGzE;IAED;;;OAGG;IACH,SAAS,KAAK,gBAAgB,IAAI,8CAA8C,CAE/E;cAEwB,aAAa,CAAC,QAAQ,GAAE,OAAO,EAAO,GAAG,OAAO,CAA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+34,7 @@ export declare class TemporalIndexingDivinerIndexCandidateToIndexDiviner<TParams
34
34
  * @param x The candidate payload
35
35
  * @returns True if the payload is one indexed by this diviner, false otherwise
36
36
  */
37
- protected isIndexablePayload: (x: Payload) => boolean;
37
+ protected isIndexablePayload: (x: unknown) => boolean;
38
38
  /**
39
39
  * Identifies if a schema is one that is indexed by this diviner
40
40
  * @param schema The candidate schema
@@ -1 +1 @@
1
- {"version":3,"file":"Diviner.d.ts","sourceRoot":"","sources":["../../../src/IndexCandidateToIndexDiviner/Diviner.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAE/D,OAAO,EAAE,8CAA8C,EAAE,qCAAqC,EAAE,MAAM,qCAAqC,CAAA;AAE3I,OAAO,EAEL,yDAAyD,EAG1D,MAAM,8CAA8C,CAAA;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAElD,OAAO,EAAE,OAAO,EAAiB,MAAM,4BAA4B,CAAA;AAOnE;;;;GAIG;AACH,qBAAa,mDAAmD,CAC9D,OAAO,SAAS,yDAAyD,GAAG,yDAAyD,CACrI,SAAQ,eAAe,CAAC,OAAO,CAAC;IAChC,OAAgB,YAAY,oFAAkE;IAC9F,OAAgB,aAAa,WAAyF;IACtH,MAAM,CAAC,MAAM,EAAE,MAAM,CAEpB;IAED,OAAO,CAAC,iBAAiB,CAAsB;IAC/C,OAAO,CAAC,oBAAoB,CAAmD;IAE/E;;OAEG;IACH,SAAS,KAAK,gBAAgB,IAAI,MAAM,EAAE,CAGzC;IAED;;;OAGG;IACH,SAAS,KAAK,mBAAmB,IAAI,qCAAqC,CAGzE;IAED;;;OAGG;IACH,SAAS,KAAK,gBAAgB,IAAI,8CAA8C,CAE/E;cAEwB,aAAa,CAAC,QAAQ,GAAE,OAAO,EAAO,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAyDpF;;;;OAIG;IACH,SAAS,CAAC,kBAAkB,MAAO,OAAO,aAEzC;IAED;;;;OAIG;IACH,SAAS,CAAC,iBAAiB,YAAa,MAAM,GAAG,IAAI,aAEpD;CACF"}
1
+ {"version":3,"file":"Diviner.d.ts","sourceRoot":"","sources":["../../../src/IndexCandidateToIndexDiviner/Diviner.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAE/D,OAAO,EAAE,8CAA8C,EAAE,qCAAqC,EAAE,MAAM,qCAAqC,CAAA;AAE3I,OAAO,EAEL,yDAAyD,EAG1D,MAAM,8CAA8C,CAAA;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAElD,OAAO,EAAgB,OAAO,EAAiB,MAAM,4BAA4B,CAAA;AAOjF;;;;GAIG;AACH,qBAAa,mDAAmD,CAC9D,OAAO,SAAS,yDAAyD,GAAG,yDAAyD,CACrI,SAAQ,eAAe,CAAC,OAAO,CAAC;IAChC,OAAgB,YAAY,oFAAkE;IAC9F,OAAgB,aAAa,WAAyF;IACtH,MAAM,CAAC,MAAM,EAAE,MAAM,CAEpB;IAED,OAAO,CAAC,iBAAiB,CAAsB;IAC/C,OAAO,CAAC,oBAAoB,CAAmD;IAE/E;;OAEG;IACH,SAAS,KAAK,gBAAgB,IAAI,MAAM,EAAE,CAGzC;IAED;;;OAGG;IACH,SAAS,KAAK,mBAAmB,IAAI,qCAAqC,CAGzE;IAED;;;OAGG;IACH,SAAS,KAAK,gBAAgB,IAAI,8CAA8C,CAE/E;cAEwB,aAAa,CAAC,QAAQ,GAAE,OAAO,EAAO,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IA0DpF;;;;OAIG;IACH,SAAS,CAAC,kBAAkB,MAAO,OAAO,aAEzC;IAED;;;;OAIG;IACH,SAAS,CAAC,iBAAiB,YAAa,MAAM,GAAG,IAAI,aAEpD;CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"Diviner.d.ts","sourceRoot":"","sources":["../../../src/StateToIndexCandidateDiviner/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OAAO,CAAC;IAChC,gBAAyB,YAAY,oFAAkE;IACvG,OAAgB,aAAa,WAAyF;IACtH,MAAM,CAAC,MAAM,EAAE,MAAM,CAEpB;IAED,IAAI,mBAAmB,WAEtB;IAED;;OAEG;IACH,SAAS,KAAK,eAAe,IAAI,MAAM,EAAE,CAGxC;cAEwB,aAAa,CAAC,QAAQ,GAAE,OAAO,EAAO,GAAG,OAAO,CAAC,CAAC,WAAW,EAAE,GAAG,cAAc,EAAE,CAAC,CAAC;IA0B7G;;;OAGG;cACa,oBAAoB,IAAI,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC;IAU7E;;;OAGG;cACa,8BAA8B,IAAI,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC;cAarE,yBAAyB,CAAC,EAAE,EAAE,YAAY,EAAE,SAAS,EAAE,iBAAiB,GAAG,OAAO,CAAC,cAAc,EAAE,GAAG,SAAS,CAAC;CAOjI"}
@@ -163,6 +163,7 @@ var import_diviner_jsonpath_aggregate_memory2 = require("@xyo-network/diviner-js
163
163
  var import_diviner_model3 = require("@xyo-network/diviner-model");
164
164
  var import_diviner_temporal_indexing_model3 = require("@xyo-network/diviner-temporal-indexing-model");
165
165
  var import_payload_builder2 = require("@xyo-network/payload-builder");
166
+ var import_payload_model2 = require("@xyo-network/payload-model");
166
167
  var import_payload_utils = require("@xyo-network/payload-utils");
167
168
  var moduleName = "TemporalIndexingDivinerIndexCandidateToIndexDiviner";
168
169
  var TemporalIndexingDivinerIndexCandidateToIndexDiviner = class extends import_diviner_abstract2.AbstractDiviner {
@@ -204,8 +205,9 @@ var TemporalIndexingDivinerIndexCandidateToIndexDiviner = class extends import_d
204
205
  return (0, import_assert.assertEx)(this.config?.schemaTransforms, () => `${moduleName}: Missing config.schemaTransforms section`);
205
206
  }
206
207
  async divineHandler(payloads = []) {
207
- const indexableBoundWitnesses = payloads.filter(import_boundwitness_model.isBoundWitness).filter((bw) => (0, import_array.containsAll)(bw.payload_schemas, this.indexableSchemas));
208
- const indexablePayloads = payloads.filter((p) => this.isIndexablePayload(p));
208
+ const builtPayloads = await Promise.all(payloads.map((payload) => import_payload_builder2.PayloadBuilder.build(payload)));
209
+ const indexableBoundWitnesses = builtPayloads.filter(import_boundwitness_model.isBoundWitnessWithMeta).filter((bw) => (0, import_array.containsAll)(bw.payload_schemas, this.indexableSchemas));
210
+ const indexablePayloads = builtPayloads.filter((p) => this.isIndexablePayload(p));
209
211
  if (indexableBoundWitnesses.length === 0 || indexablePayloads.length === 0)
210
212
  return [];
211
213
  const [bwDictionary, payloadDictionary] = await Promise.all([
@@ -249,7 +251,7 @@ var TemporalIndexingDivinerIndexCandidateToIndexDiviner = class extends import_d
249
251
  * @returns True if the payload is one indexed by this diviner, false otherwise
250
252
  */
251
253
  isIndexablePayload = (x) => {
252
- return this.indexableSchemas.includes(x?.schema);
254
+ return (0, import_payload_model2.isAnyPayload)(x) && this.indexableSchemas.includes(x?.schema);
253
255
  };
254
256
  /**
255
257
  * Identifies if a schema is one that is indexed by this diviner
@@ -362,7 +364,7 @@ var TemporalIndexingDivinerStateToIndexCandidateDiviner = class extends import_d
362
364
  return [
363
365
  lastState
364
366
  ];
365
- const indexCandidates = (await Promise.all(batch.filter(import_boundwitness_model2.isBoundWitness).map((bw) => this.getPayloadsInBoundWitness(bw, sourceArchivist)))).filter(import_exists2.exists).flat();
367
+ const indexCandidates = (await Promise.all(batch.filter(import_boundwitness_model2.isBoundWitnessWithMeta).map((bw) => this.getPayloadsInBoundWitness(bw, sourceArchivist)))).filter(import_exists2.exists).flat();
366
368
  const nextState = {
367
369
  schema: import_module_model.ModuleStateSchema,
368
370
  state: {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts","../../src/Diviner.ts","../../src/DivinerQueryToIndexQueryDiviner/Diviner.ts","../../src/IndexCandidateToIndexDiviner/Diviner.ts","../../src/IndexQueryResponseToDivinerQueryResponseDiviner/Diviner.ts","../../src/StateToIndexCandidateDiviner/Diviner.ts"],"sourcesContent":["export * from './Diviner'\nexport * from './DivinerQueryToIndexQueryDiviner'\nexport * from './IndexCandidateToIndexDiviner'\nexport * from './IndexQueryResponseToDivinerQueryResponseDiviner'\nexport * from './StateToIndexCandidateDiviner'\n","import { IndexingDiviner } from '@xyo-network/diviner-indexing-memory'\nimport { IndexingDivinerConfigSchema } from '@xyo-network/diviner-indexing-model'\nimport { DivinerConfigSchema, DivinerModule, DivinerModuleEventData } from '@xyo-network/diviner-model'\nimport { TemporalIndexingDivinerConfigSchema, TemporalIndexingDivinerParams } from '@xyo-network/diviner-temporal-indexing-model'\nimport { Payload } from '@xyo-network/payload-model'\n\nexport class TemporalIndexingDiviner<\n TParams extends TemporalIndexingDivinerParams = TemporalIndexingDivinerParams,\n TIn extends Payload = Payload,\n TOut extends Payload = Payload,\n TEventData extends DivinerModuleEventData<DivinerModule<TParams>, TIn, TOut> = DivinerModuleEventData<DivinerModule<TParams>, TIn, TOut>,\n> extends IndexingDiviner<TParams, TIn, TOut, TEventData> {\n static override readonly configSchema = TemporalIndexingDivinerConfigSchema\n static override readonly configSchemas: string[] = [TemporalIndexingDivinerConfigSchema, IndexingDivinerConfigSchema, DivinerConfigSchema]\n\n protected override async startHandler(): Promise<boolean> {\n await super.startHandler()\n return true\n }\n}\n","import { AbstractDiviner } from '@xyo-network/diviner-abstract'\nimport { jsonPathToTransformersDictionary, reducePayloads } from '@xyo-network/diviner-jsonpath-aggregate-memory'\nimport { SchemaToJsonPathTransformExpressionsDictionary, SchemaToPayloadTransformersDictionary } from '@xyo-network/diviner-jsonpath-model'\nimport { DivinerConfigSchema } from '@xyo-network/diviner-model'\nimport { PayloadDivinerQueryPayload, PayloadDivinerQuerySchema } from '@xyo-network/diviner-payload-model'\nimport {\n TemporalIndexingDivinerDivinerQueryToIndexQueryDivinerConfigSchema,\n TemporalIndexingDivinerDivinerQueryToIndexQueryDivinerParams,\n TemporalIndexingDivinerResultIndexSchema,\n} from '@xyo-network/diviner-temporal-indexing-model'\nimport { Labels } from '@xyo-network/module-model'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport { isPayloadOfSchemaType, Payload } from '@xyo-network/payload-model'\n// TODO: Inherit from JsonPathAggregateDiviner\n/**\n * A diviner that converts diviner query to index query\n */\nexport class TemporalIndexingDivinerDivinerQueryToIndexQueryDiviner<\n TParams extends TemporalIndexingDivinerDivinerQueryToIndexQueryDivinerParams = TemporalIndexingDivinerDivinerQueryToIndexQueryDivinerParams,\n> extends AbstractDiviner<TParams> {\n static override readonly configSchema = TemporalIndexingDivinerDivinerQueryToIndexQueryDivinerConfigSchema\n static override configSchemas = [DivinerConfigSchema, TemporalIndexingDivinerDivinerQueryToIndexQueryDivinerConfigSchema]\n static labels: Labels = {\n 'network.xyo.diviner.stage': 'divinerQueryToIndexQueryDiviner',\n }\n\n private _indexableSchemas: string[] | undefined\n private _payloadTransformers: SchemaToPayloadTransformersDictionary | undefined\n\n /**\n * The schema of the diviner query payloads\n */\n protected get divinerQuerySchema(): string {\n return this.config.divinerQuerySchema ?? PayloadDivinerQuerySchema\n }\n\n /**\n * The schema of the index query payloads\n */\n protected get indexQuerySchema(): string {\n return this.config.indexQuerySchema ?? PayloadDivinerQuerySchema\n }\n\n /**\n * The schema of the index payloads\n */\n protected get indexSchema(): string {\n return this.config.indexSchema ?? TemporalIndexingDivinerResultIndexSchema\n }\n\n /**\n * List of indexable schemas for this diviner\n */\n protected get indexableSchemas(): string[] {\n if (!this._indexableSchemas) this._indexableSchemas = Object.keys(this.schemaTransforms)\n return this._indexableSchemas\n }\n\n /**\n * Dictionary of schemas to payload transformers for creating indexes\n * from the payloads within a Bound Witness\n */\n protected get payloadTransformers(): SchemaToPayloadTransformersDictionary {\n if (!this._payloadTransformers) this._payloadTransformers = jsonPathToTransformersDictionary(this.schemaTransforms)\n return this._payloadTransformers\n }\n\n /**\n * The dictionary of schemas to JSON Path transform expressions for creating indexes\n * from the payloads within a Bound Witness\n */\n protected get schemaTransforms(): SchemaToJsonPathTransformExpressionsDictionary {\n return (\n this.config?.schemaTransforms ?? {\n [this.divinerQuerySchema]: [\n {\n defaultValue: 1,\n destinationField: 'limit',\n sourcePathExpression: '$.limit',\n },\n {\n defaultValue: 0,\n destinationField: 'offset',\n sourcePathExpression: '$.offset',\n },\n {\n defaultValue: 'desc',\n destinationField: 'order',\n sourcePathExpression: '$.order',\n },\n ],\n }\n )\n }\n\n protected override async divineHandler(payloads: Payload[] = []): Promise<Payload[]> {\n const queries = payloads.filter(isPayloadOfSchemaType<PayloadDivinerQueryPayload>(this.divinerQuerySchema))\n if (queries.length > 0) {\n const results = await Promise.all(\n queries.map(async (query) => {\n const fields = await reducePayloads<PayloadDivinerQueryPayload & { sources?: string[] }>(\n [query],\n this.payloadTransformers,\n this.indexQuerySchema,\n )\n // TODO: Make index schema configurable\n fields.schemas = [this.indexSchema]\n // TODO: Make sources not need to be deleted\n delete fields.sources\n // TODO: Add support for additional filters\n return await new PayloadBuilder<Payload>({ schema: this.indexQuerySchema }).fields(fields).build()\n }),\n )\n return results\n }\n return []\n }\n}\n","import { containsAll } from '@xylabs/array'\nimport { assertEx } from '@xylabs/assert'\nimport { exists } from '@xylabs/exists'\nimport { BoundWitness, isBoundWitness } from '@xyo-network/boundwitness-model'\nimport { AbstractDiviner } from '@xyo-network/diviner-abstract'\nimport { jsonPathToTransformersDictionary } from '@xyo-network/diviner-jsonpath-aggregate-memory'\nimport { SchemaToJsonPathTransformExpressionsDictionary, SchemaToPayloadTransformersDictionary } from '@xyo-network/diviner-jsonpath-model'\nimport { DivinerConfigSchema } from '@xyo-network/diviner-model'\nimport {\n TemporalIndexingDivinerIndexCandidateToIndexDivinerConfigSchema,\n TemporalIndexingDivinerIndexCandidateToIndexDivinerParams,\n TemporalIndexingDivinerResultIndex,\n TemporalIndexingDivinerResultIndexSchema,\n} from '@xyo-network/diviner-temporal-indexing-model'\nimport { Labels } from '@xyo-network/module-model'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport { Payload, PayloadFields } from '@xyo-network/payload-model'\nimport { intraBoundwitnessSchemaCombinations } from '@xyo-network/payload-utils'\n\ntype IndexableHashes = [string, ...string[]]\n\nconst moduleName = 'TemporalIndexingDivinerIndexCandidateToIndexDiviner'\n\n/**\n * Diviner which transforms index candidates to indexes using JSON Path to map\n * source properties in the supplied payloads to destination fields in the\n * resultant index\n */\nexport class TemporalIndexingDivinerIndexCandidateToIndexDiviner<\n TParams extends TemporalIndexingDivinerIndexCandidateToIndexDivinerParams = TemporalIndexingDivinerIndexCandidateToIndexDivinerParams,\n> extends AbstractDiviner<TParams> {\n static override configSchema = TemporalIndexingDivinerIndexCandidateToIndexDivinerConfigSchema\n static override configSchemas = [DivinerConfigSchema, TemporalIndexingDivinerIndexCandidateToIndexDivinerConfigSchema]\n static labels: Labels = {\n 'network.xyo.diviner.stage': 'indexCandidateToIndexDiviner',\n }\n\n private _indexableSchemas: string[] | undefined\n private _payloadTransformers: SchemaToPayloadTransformersDictionary | undefined\n\n /**\n * List of indexable schemas for this diviner\n */\n protected get indexableSchemas(): string[] {\n if (!this._indexableSchemas) this._indexableSchemas = Object.keys(this.schemaTransforms)\n return this._indexableSchemas\n }\n\n /**\n * Dictionary of schemas to payload transformers for creating indexes\n * from the payloads within a Bound Witness\n */\n protected get payloadTransformers(): SchemaToPayloadTransformersDictionary {\n if (!this._payloadTransformers) this._payloadTransformers = jsonPathToTransformersDictionary(this.schemaTransforms)\n return this._payloadTransformers\n }\n\n /**\n * The dictionary of schemas to JSON Path transform expressions for creating indexes\n * from the payloads within a Bound Witness\n */\n protected get schemaTransforms(): SchemaToJsonPathTransformExpressionsDictionary {\n return assertEx(this.config?.schemaTransforms, () => `${moduleName}: Missing config.schemaTransforms section`)\n }\n\n protected override async divineHandler(payloads: Payload[] = []): Promise<Payload[]> {\n // If the Bound Witness does not contain all the required schemas do not index it\n const indexableBoundWitnesses: BoundWitness[] = payloads\n .filter(isBoundWitness)\n .filter((bw) => containsAll(bw.payload_schemas, this.indexableSchemas))\n // If the Payload is not one of the indexable schemas do not index it\n const indexablePayloads: Payload[] = payloads.filter((p) => this.isIndexablePayload(p))\n // If there is nothing to index, return an empty array\n if (indexableBoundWitnesses.length === 0 || indexablePayloads.length === 0) return []\n // Hash all the indexable data once\n const [bwDictionary, payloadDictionary] = await Promise.all([\n PayloadBuilder.toDataHashMap(indexableBoundWitnesses),\n PayloadBuilder.toDataHashMap(indexablePayloads),\n ])\n\n // Initialize the array for validIndexableTuples outside of the loop\n const validIndexableTuples: IndexableHashes[] = []\n\n // Iterate over each entry in bwDictionary\n for (const [bwHash, bw] of Object.entries(bwDictionary)) {\n // Find the combinations of payloads that satisfy the required schemas\n const combinations = intraBoundwitnessSchemaCombinations(bw, this.indexableSchemas)\n\n // Iterate over each combination\n for (const combination of combinations) {\n const indexablePayloads = combination.map((hash) => payloadDictionary[hash]).filter(exists)\n\n // If we found the right amount of indexable payloads (of the correct schema as checked\n // above) in this BW, then index it\n if (indexablePayloads.length === this.indexableSchemas.length) {\n validIndexableTuples.push([bwHash, ...combination])\n }\n }\n }\n\n // Create the indexes from the tuples\n const indexes = await Promise.all(\n validIndexableTuples.map<Promise<TemporalIndexingDivinerResultIndex>>(async ([bwHash, ...sourcePayloadHashes]) => {\n const sourcePayloads = sourcePayloadHashes.map((hash) => payloadDictionary[hash])\n // Use the payload transformers to convert the fields from the source payloads to the destination fields\n const indexFields = sourcePayloads.flatMap<PayloadFields[]>((payload) => {\n // Find the transformers for this payload\n const transformers = this.payloadTransformers[payload.schema]\n // If transformers exist, apply them to the payload otherwise return an empty array\n return transformers ? transformers.map((transform) => transform(payload)) : []\n })\n // Include all the sources for reference\n const sources: string[] = [bwHash, ...sourcePayloadHashes]\n // Build and return the index\n return await new PayloadBuilder<TemporalIndexingDivinerResultIndex>({ schema: TemporalIndexingDivinerResultIndexSchema })\n .fields(Object.assign({ sources }, ...indexFields))\n .build()\n }),\n )\n return indexes.flat()\n }\n\n /**\n * Identifies if a payload is one that is indexed by this diviner\n * @param x The candidate payload\n * @returns True if the payload is one indexed by this diviner, false otherwise\n */\n protected isIndexablePayload = (x: Payload) => {\n return this.indexableSchemas.includes(x?.schema)\n }\n\n /**\n * Identifies if a schema is one that is indexed by this diviner\n * @param schema The candidate schema\n * @returns True if this schema is one indexed by this diviner, false otherwise\n */\n protected isIndexableSchema = (schema?: string | null) => {\n return typeof schema === 'string' ? this.indexableSchemas.includes(schema) : false\n }\n}\n","import { AbstractDiviner } from '@xyo-network/diviner-abstract'\nimport { DivinerConfigSchema } from '@xyo-network/diviner-model'\nimport { isPayloadDivinerQueryPayload } from '@xyo-network/diviner-payload-model'\nimport { TemporalIndexingDivinerIndexQueryResponseToDivinerQueryResponseDivinerConfigSchema } from '@xyo-network/diviner-temporal-indexing-model'\nimport { Labels } from '@xyo-network/module-model'\nimport { Payload } from '@xyo-network/payload-model'\n\n/**\n * Transforms an ImageThumbnailIndex response into an ImageThumbnailResponse response\n */\nexport class TemporalIndexingDivinerIndexQueryResponseToDivinerQueryResponseDiviner extends AbstractDiviner {\n static override readonly configSchema = TemporalIndexingDivinerIndexQueryResponseToDivinerQueryResponseDivinerConfigSchema\n static override configSchemas = [DivinerConfigSchema, TemporalIndexingDivinerIndexQueryResponseToDivinerQueryResponseDivinerConfigSchema]\n static labels: Labels = {\n 'network.xyo.diviner.stage': 'indexQueryResponseToDivinerQueryResponseDiviner',\n }\n\n protected override async divineHandler(payloads: Payload[] = []): Promise<Payload[]> {\n // NOTE: We're not doing anything with the query payloads but some diviners\n // might want to use this to transform from the query to the response (for example\n // if we use a plaintext value in the query to generate a hash key in the index)\n // const queries = payloads.filter(isPayloadDivinerQueryPayload)\n const responses = payloads.filter((p) => !isPayloadDivinerQueryPayload(p))\n return await Promise.resolve(responses)\n }\n}\n","import { assertEx } from '@xylabs/assert'\nimport { exists } from '@xylabs/exists'\nimport { ArchivistInstance } from '@xyo-network/archivist-model'\nimport { ArchivistWrapper } from '@xyo-network/archivist-wrapper'\nimport { BoundWitness, isBoundWitness } from '@xyo-network/boundwitness-model'\nimport { AbstractDiviner } from '@xyo-network/diviner-abstract'\nimport { BoundWitnessDivinerQueryPayload, BoundWitnessDivinerQuerySchema } from '@xyo-network/diviner-boundwitness-model'\nimport { IndexingDivinerState } from '@xyo-network/diviner-indexing-model'\nimport { DivinerConfigSchema } from '@xyo-network/diviner-model'\nimport {\n TemporalIndexingDivinerStateToIndexCandidateDivinerConfigSchema,\n TemporalIndexingDivinerStateToIndexCandidateDivinerParams,\n} from '@xyo-network/diviner-temporal-indexing-model'\nimport { DivinerWrapper } from '@xyo-network/diviner-wrapper'\nimport { isModuleState, Labels, ModuleState, ModuleStateSchema } from '@xyo-network/module-model'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport { Payload } from '@xyo-network/payload-model'\nimport { intraBoundwitnessSchemaCombinations } from '@xyo-network/payload-utils'\nimport { TimeStamp, TimestampSchema } from '@xyo-network/witness-timestamp'\n\n/**\n * All Payload types involved in index candidates for indexing\n */\nexport type IndexCandidate = BoundWitness | Payload | TimeStamp\n\n/**\n * The response from the TemporalStateToIndexCandidateDiviner\n */\nexport type TemporalStateToIndexCandidateDivinerResponse = [\n /**\n * The next state of the diviner\n */\n nextState: ModuleState<IndexingDivinerState>,\n /**\n * The index candidates\n */\n ...IndexCandidate[],\n]\n\n/**\n * The default order to search Bound Witnesses to identify index candidates\n */\nconst order = 'asc'\n\n/**\n * The name of the module (for logging purposes)\n */\nconst moduleName = 'TemporalIndexingDivinerStateToIndexCandidateDiviner'\n\n/**\n * Transforms candidates for image thumbnail indexing into their indexed representation\n */\nexport class TemporalIndexingDivinerStateToIndexCandidateDiviner<\n TParams extends TemporalIndexingDivinerStateToIndexCandidateDivinerParams = TemporalIndexingDivinerStateToIndexCandidateDivinerParams,\n> extends AbstractDiviner<TParams> {\n static override readonly configSchema = TemporalIndexingDivinerStateToIndexCandidateDivinerConfigSchema\n static override configSchemas = [DivinerConfigSchema, TemporalIndexingDivinerStateToIndexCandidateDivinerConfigSchema]\n static labels: Labels = {\n 'network.xyo.diviner.stage': 'stateToIndexCandidateDiviner',\n }\n\n get payloadDivinerLimit() {\n return this.config.payloadDivinerLimit ?? 1000\n }\n\n /**\n * The required payload_schemas within BoundWitnesses to identify index candidates\n */\n protected get payload_schemas(): string[] {\n const schemas = this.config.filter?.payload_schemas\n return [TimestampSchema, ...(schemas ?? [])]\n }\n\n protected override async divineHandler(payloads: Payload[] = []): Promise<[ModuleState, ...IndexCandidate[]]> {\n // Retrieve the last state from what was passed in\n const lastState = payloads.find(isModuleState<IndexingDivinerState>)\n // If there is no last state, start from the beginning\n if (!lastState) return [{ schema: ModuleStateSchema, state: { offset: 0 } }]\n // Otherwise, get the last offset\n const { offset } = lastState.state\n // Get next batch of results starting from the offset\n const boundWitnessDiviner = await this.getBoundWitnessDivinerForStore()\n if (!boundWitnessDiviner) return [lastState]\n const query = await new PayloadBuilder<BoundWitnessDivinerQueryPayload>({ schema: BoundWitnessDivinerQuerySchema })\n .fields({ limit: this.payloadDivinerLimit, offset, order, payload_schemas: this.payload_schemas })\n .build()\n const batch = await boundWitnessDiviner.divine([query])\n if (batch.length === 0) return [lastState]\n // Get source data\n const sourceArchivist = await this.getArchivistForStore()\n if (!sourceArchivist) return [lastState]\n const indexCandidates: IndexCandidate[] = (\n await Promise.all(batch.filter(isBoundWitness).map((bw) => this.getPayloadsInBoundWitness(bw, sourceArchivist)))\n )\n .filter(exists)\n .flat()\n const nextState = { schema: ModuleStateSchema, state: { ...lastState.state, offset: offset + batch.length } }\n return [nextState, ...indexCandidates]\n }\n /**\n * Retrieves the archivist for the payloadStore\n * @returns The archivist for the payloadStore or undefined if not resolvable\n */\n protected async getArchivistForStore(): Promise<ArchivistWrapper | undefined> {\n // It should be defined, so we'll error if it's not\n const name: string = assertEx(this.config?.payloadStore?.archivist, () => `${moduleName}: Config for payloadStore.archivist not specified`)\n // It might not be resolvable (yet), so we'll return undefined if it's not\n const mod = await this.resolve(name)\n if (!mod) return undefined\n // Return the wrapped archivist\n return ArchivistWrapper.wrap(mod, this.account)\n }\n\n /**\n * Retrieves the BoundWitness Diviner for the payloadStore\n * @returns The BoundWitness Diviner for the payloadStore or undefined if not resolvable\n */\n protected async getBoundWitnessDivinerForStore(): Promise<DivinerWrapper | undefined> {\n // It should be defined, so we'll error if it's not\n const name: string = assertEx(\n this.config?.payloadStore?.boundWitnessDiviner,\n () => `${moduleName}: Config for payloadStore.boundWitnessDiviner not specified`,\n )\n // It might not be resolvable (yet), so we'll return undefined if it's not\n const mod = await this.resolve(name)\n if (!mod) return undefined\n // Return the wrapped diviner\n return DivinerWrapper.wrap(mod, this.account)\n }\n\n protected async getPayloadsInBoundWitness(bw: BoundWitness, archivist: ArchivistInstance): Promise<IndexCandidate[] | undefined> {\n const combinations = intraBoundwitnessSchemaCombinations(bw, this.payload_schemas).flat()\n if (combinations.length === 0) return undefined\n const hashes = new Set(combinations)\n const indexCandidates = await archivist.get([...hashes])\n return [bw, ...indexCandidates]\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;ACAA,qCAAgC;AAChC,oCAA4C;AAC5C,2BAA2E;AAC3E,6CAAmF;AAG5E,IAAMA,0BAAN,cAKGC,+CAAAA;EAXV,OAWUA;;;EACR,OAAyBC,eAAeC;EACxC,OAAyBC,gBAA0B;IAACD;IAAqCE;IAA6BC;;EAEtH,MAAyBC,eAAiC;AACxD,UAAM,MAAMA,aAAAA;AACZ,WAAO;EACT;AACF;;;ACnBA,8BAAgC;AAChC,+CAAiE;AAEjE,IAAAC,wBAAoC;AACpC,mCAAsE;AACtE,IAAAC,0CAIO;AAEP,6BAA+B;AAC/B,2BAA+C;AAKxC,IAAMC,yDAAN,cAEGC,wCAAAA;EAnBV,OAmBUA;;;EACR,OAAyBC,eAAeC;EACxC,OAAgBC,gBAAgB;IAACC;IAAqBF;;EACtD,OAAOG,SAAiB;IACtB,6BAA6B;EAC/B;EAEQC;EACAC;;;;EAKR,IAAcC,qBAA6B;AACzC,WAAO,KAAKC,OAA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0BAA0BD,IAAkBQ,WAAqE;AAC/H,UAAMQ,mBAAeC,2DAAoCjB,IAAI,KAAK/B,eAAe,EAAEkC,KAAI;AACvF,QAAIa,aAAaxB,WAAW;AAAG,aAAOmB;AACtC,UAAMO,SAAS,IAAIC,IAAIH,YAAAA;AACvB,UAAMrB,kBAAkB,MAAMa,UAAUY,IAAI;SAAIF;KAAO;AACvD,WAAO;MAAClB;SAAOL;;EACjB;AACF;","names":["TemporalIndexingDiviner","IndexingDiviner","configSchema","TemporalIndexingDivinerConfigSchema","configSchemas","IndexingDivinerConfigSchema","DivinerConfigSchema","startHandler","import_diviner_model","import_diviner_temporal_indexing_model","TemporalIndexingDivinerDivinerQueryToIndexQueryDiviner","AbstractDiviner","configSchema","TemporalIndexingDivinerDivinerQueryToIndexQueryDivinerConfigSchema","configSchemas","DivinerConfigSchema","labels","_indexableSchemas","_payloadTransformers","divinerQuerySchema","config","PayloadDivinerQuerySchema","indexQuerySchema","indexSchema","TemporalIndexingDivinerResultIndexSchema","indexableSchemas","Object","keys","schemaTransforms","payloadTransformers","jsonPathToTransformersDictionary","defaultValue","destinationField","sourcePathExpression","divineHandler","payloads","queries","filter","isPayloadOfSchemaType","length","results","Promise","all","map","query","fields","reducePayloads","schemas","sources","PayloadBuilder","schema","build","import_diviner_abstract","import_diviner_jsonpath_aggregate_memory","import_diviner_model","import_diviner_temporal_indexing_model","import_payload_builder","moduleName","TemporalIndexingDivinerIndexCandidateToIndexDiviner","AbstractDiviner","configSchema","TemporalIndexingDivinerIndexCandidateToIndexDivinerConfigSchema","configSchemas","DivinerConfigSchema","labels","_indexableSchemas","_payloadTransformers","indexableSchemas","Object","keys","schemaTransforms","payloadTransformers","jsonPathToTransformersDictionary","assertEx","config","divineHandler","payloads","indexableBoundWitnesses","filter","isBoundWitness","bw","containsAll","payload_schemas","indexablePayloads","p","isIndexablePayload","length","bwDictionary","payloadDictionary","Promise","all","PayloadBuilder","toDataHashMap","validIndexableTuples","bwHash","entries","combinations","intraBoundwitnessSchemaCombinations","combination","map","hash","exists","push","indexes","sourcePayloadHashes","sourcePayloads","indexFields","flatMap","payload","transformers","schema","transform","sources","TemporalIndexingDivinerResultIndexSchema","fields","assign","build","flat","x","includes","isIndexableSchema","import_diviner_abstract","import_diviner_model","import_diviner_payload_model","import_diviner_temporal_indexing_model","TemporalIndexingDivinerIndexQueryResponseToDivinerQueryResponseDiviner","AbstractDiviner","configSchema","TemporalIndexingDivinerIndexQueryResponseToDivinerQueryResponseDivinerConfigSchema","configSchemas","DivinerConfigSchema","labels","divineHandler","payloads","responses","filter","p","isPayloadDivinerQueryPayload","Promise","resolve","import_assert","import_exists","import_boundwitness_model","import_diviner_abstract","import_diviner_model","import_diviner_temporal_indexing_model","import_payload_builder","import_payload_utils","order","moduleName","TemporalIndexingDivinerStateToIndexCandidateDiviner","AbstractDiviner","configSchema","TemporalIndexingDivinerStateToIndexCandidateDivinerConfigSchema","configSchemas","DivinerConfigSchema","labels","payloadDivinerLimit","config","payload_schemas","schemas","filter","TimestampSchema","divineHandler","payloads","lastState","find","isModuleState","schema","ModuleStateSchema","state","offset","boundWitnessDiviner","getBoundWitnessDivinerForStore","query","PayloadBuilder","BoundWitnessDivinerQuerySchema","fields","limit","build","batch","divine","length","sourceArchivist","getArchivistForStore","indexCandidates","Promise","all","isBoundWitness","map","bw","getPayloadsInBoundWitness","exists","flat","nextState","name","assertEx","payloadStore","archivist","mod","resolve","undefined","ArchivistWrapper","wrap","account","DivinerWrapper","combinations","intraBoundwitnessSchemaCombinations","hashes","Set","get"]}
1
+ {"version":3,"sources":["../../src/index.ts","../../src/Diviner.ts","../../src/DivinerQueryToIndexQueryDiviner/Diviner.ts","../../src/IndexCandidateToIndexDiviner/Diviner.ts","../../src/IndexQueryResponseToDivinerQueryResponseDiviner/Diviner.ts","../../src/StateToIndexCandidateDiviner/Diviner.ts"],"sourcesContent":["export * from './Diviner'\nexport * from './DivinerQueryToIndexQueryDiviner'\nexport * from './IndexCandidateToIndexDiviner'\nexport * from './IndexQueryResponseToDivinerQueryResponseDiviner'\nexport * from './StateToIndexCandidateDiviner'\n","import { IndexingDiviner } from '@xyo-network/diviner-indexing-memory'\nimport { IndexingDivinerConfigSchema } from '@xyo-network/diviner-indexing-model'\nimport { DivinerConfigSchema, DivinerModule, DivinerModuleEventData } from '@xyo-network/diviner-model'\nimport { TemporalIndexingDivinerConfigSchema, TemporalIndexingDivinerParams } from '@xyo-network/diviner-temporal-indexing-model'\nimport { Payload } from '@xyo-network/payload-model'\n\nexport class TemporalIndexingDiviner<\n TParams extends TemporalIndexingDivinerParams = TemporalIndexingDivinerParams,\n TIn extends Payload = Payload,\n TOut extends Payload = Payload,\n TEventData extends DivinerModuleEventData<DivinerModule<TParams>, TIn, TOut> = DivinerModuleEventData<DivinerModule<TParams>, TIn, TOut>,\n> extends IndexingDiviner<TParams, TIn, TOut, TEventData> {\n static override readonly configSchema = TemporalIndexingDivinerConfigSchema\n static override readonly configSchemas: string[] = [TemporalIndexingDivinerConfigSchema, IndexingDivinerConfigSchema, DivinerConfigSchema]\n\n protected override async startHandler(): Promise<boolean> {\n await super.startHandler()\n return true\n }\n}\n","import { AbstractDiviner } from '@xyo-network/diviner-abstract'\nimport { jsonPathToTransformersDictionary, reducePayloads } from '@xyo-network/diviner-jsonpath-aggregate-memory'\nimport { SchemaToJsonPathTransformExpressionsDictionary, SchemaToPayloadTransformersDictionary } from '@xyo-network/diviner-jsonpath-model'\nimport { DivinerConfigSchema } from '@xyo-network/diviner-model'\nimport { PayloadDivinerQueryPayload, PayloadDivinerQuerySchema } from '@xyo-network/diviner-payload-model'\nimport {\n TemporalIndexingDivinerDivinerQueryToIndexQueryDivinerConfigSchema,\n TemporalIndexingDivinerDivinerQueryToIndexQueryDivinerParams,\n TemporalIndexingDivinerResultIndexSchema,\n} from '@xyo-network/diviner-temporal-indexing-model'\nimport { Labels } from '@xyo-network/module-model'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport { isPayloadOfSchemaType, Payload } from '@xyo-network/payload-model'\n// TODO: Inherit from JsonPathAggregateDiviner\n/**\n * A diviner that converts diviner query to index query\n */\nexport class TemporalIndexingDivinerDivinerQueryToIndexQueryDiviner<\n TParams extends TemporalIndexingDivinerDivinerQueryToIndexQueryDivinerParams = TemporalIndexingDivinerDivinerQueryToIndexQueryDivinerParams,\n> extends AbstractDiviner<TParams> {\n static override readonly configSchema = TemporalIndexingDivinerDivinerQueryToIndexQueryDivinerConfigSchema\n static override configSchemas = [DivinerConfigSchema, TemporalIndexingDivinerDivinerQueryToIndexQueryDivinerConfigSchema]\n static labels: Labels = {\n 'network.xyo.diviner.stage': 'divinerQueryToIndexQueryDiviner',\n }\n\n private _indexableSchemas: string[] | undefined\n private _payloadTransformers: SchemaToPayloadTransformersDictionary | undefined\n\n /**\n * The schema of the diviner query payloads\n */\n protected get divinerQuerySchema(): string {\n return this.config.divinerQuerySchema ?? PayloadDivinerQuerySchema\n }\n\n /**\n * The schema of the index query payloads\n */\n protected get indexQuerySchema(): string {\n return this.config.indexQuerySchema ?? PayloadDivinerQuerySchema\n }\n\n /**\n * The schema of the index payloads\n */\n protected get indexSchema(): string {\n return this.config.indexSchema ?? TemporalIndexingDivinerResultIndexSchema\n }\n\n /**\n * List of indexable schemas for this diviner\n */\n protected get indexableSchemas(): string[] {\n if (!this._indexableSchemas) this._indexableSchemas = Object.keys(this.schemaTransforms)\n return this._indexableSchemas\n }\n\n /**\n * Dictionary of schemas to payload transformers for creating indexes\n * from the payloads within a Bound Witness\n */\n protected get payloadTransformers(): SchemaToPayloadTransformersDictionary {\n if (!this._payloadTransformers) this._payloadTransformers = jsonPathToTransformersDictionary(this.schemaTransforms)\n return this._payloadTransformers\n }\n\n /**\n * The dictionary of schemas to JSON Path transform expressions for creating indexes\n * from the payloads within a Bound Witness\n */\n protected get schemaTransforms(): SchemaToJsonPathTransformExpressionsDictionary {\n return (\n this.config?.schemaTransforms ?? {\n [this.divinerQuerySchema]: [\n {\n defaultValue: 1,\n destinationField: 'limit',\n sourcePathExpression: '$.limit',\n },\n {\n defaultValue: 0,\n destinationField: 'offset',\n sourcePathExpression: '$.offset',\n },\n {\n defaultValue: 'desc',\n destinationField: 'order',\n sourcePathExpression: '$.order',\n },\n ],\n }\n )\n }\n\n protected override async divineHandler(payloads: Payload[] = []): Promise<Payload[]> {\n const queries = payloads.filter(isPayloadOfSchemaType<PayloadDivinerQueryPayload>(this.divinerQuerySchema))\n if (queries.length > 0) {\n const results = await Promise.all(\n queries.map(async (query) => {\n const fields = await reducePayloads<PayloadDivinerQueryPayload & { sources?: string[] }>(\n [query],\n this.payloadTransformers,\n this.indexQuerySchema,\n )\n // TODO: Make index schema configurable\n fields.schemas = [this.indexSchema]\n // TODO: Make sources not need to be deleted\n delete fields.sources\n // TODO: Add support for additional filters\n return await new PayloadBuilder<Payload>({ schema: this.indexQuerySchema }).fields(fields).build()\n }),\n )\n return results\n }\n return []\n }\n}\n","import { containsAll } from '@xylabs/array'\nimport { assertEx } from '@xylabs/assert'\nimport { exists } from '@xylabs/exists'\nimport { isBoundWitnessWithMeta } from '@xyo-network/boundwitness-model'\nimport { AbstractDiviner } from '@xyo-network/diviner-abstract'\nimport { jsonPathToTransformersDictionary } from '@xyo-network/diviner-jsonpath-aggregate-memory'\nimport { SchemaToJsonPathTransformExpressionsDictionary, SchemaToPayloadTransformersDictionary } from '@xyo-network/diviner-jsonpath-model'\nimport { DivinerConfigSchema } from '@xyo-network/diviner-model'\nimport {\n TemporalIndexingDivinerIndexCandidateToIndexDivinerConfigSchema,\n TemporalIndexingDivinerIndexCandidateToIndexDivinerParams,\n TemporalIndexingDivinerResultIndex,\n TemporalIndexingDivinerResultIndexSchema,\n} from '@xyo-network/diviner-temporal-indexing-model'\nimport { Labels } from '@xyo-network/module-model'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport { isAnyPayload, Payload, PayloadFields } from '@xyo-network/payload-model'\nimport { intraBoundwitnessSchemaCombinations } from '@xyo-network/payload-utils'\n\ntype IndexableHashes = [string, ...string[]]\n\nconst moduleName = 'TemporalIndexingDivinerIndexCandidateToIndexDiviner'\n\n/**\n * Diviner which transforms index candidates to indexes using JSON Path to map\n * source properties in the supplied payloads to destination fields in the\n * resultant index\n */\nexport class TemporalIndexingDivinerIndexCandidateToIndexDiviner<\n TParams extends TemporalIndexingDivinerIndexCandidateToIndexDivinerParams = TemporalIndexingDivinerIndexCandidateToIndexDivinerParams,\n> extends AbstractDiviner<TParams> {\n static override configSchema = TemporalIndexingDivinerIndexCandidateToIndexDivinerConfigSchema\n static override configSchemas = [DivinerConfigSchema, TemporalIndexingDivinerIndexCandidateToIndexDivinerConfigSchema]\n static labels: Labels = {\n 'network.xyo.diviner.stage': 'indexCandidateToIndexDiviner',\n }\n\n private _indexableSchemas: string[] | undefined\n private _payloadTransformers: SchemaToPayloadTransformersDictionary | undefined\n\n /**\n * List of indexable schemas for this diviner\n */\n protected get indexableSchemas(): string[] {\n if (!this._indexableSchemas) this._indexableSchemas = Object.keys(this.schemaTransforms)\n return this._indexableSchemas\n }\n\n /**\n * Dictionary of schemas to payload transformers for creating indexes\n * from the payloads within a Bound Witness\n */\n protected get payloadTransformers(): SchemaToPayloadTransformersDictionary {\n if (!this._payloadTransformers) this._payloadTransformers = jsonPathToTransformersDictionary(this.schemaTransforms)\n return this._payloadTransformers\n }\n\n /**\n * The dictionary of schemas to JSON Path transform expressions for creating indexes\n * from the payloads within a Bound Witness\n */\n protected get schemaTransforms(): SchemaToJsonPathTransformExpressionsDictionary {\n return assertEx(this.config?.schemaTransforms, () => `${moduleName}: Missing config.schemaTransforms section`)\n }\n\n protected override async divineHandler(payloads: Payload[] = []): Promise<Payload[]> {\n const builtPayloads = await Promise.all(payloads.map((payload) => PayloadBuilder.build(payload)))\n // If the Bound Witness does not contain all the required schemas do not index it\n const indexableBoundWitnesses = builtPayloads\n .filter(isBoundWitnessWithMeta)\n .filter((bw) => containsAll(bw.payload_schemas, this.indexableSchemas))\n // If the Payload is not one of the indexable schemas do not index it\n const indexablePayloads = builtPayloads.filter((p) => this.isIndexablePayload(p))\n // If there is nothing to index, return an empty array\n if (indexableBoundWitnesses.length === 0 || indexablePayloads.length === 0) return []\n // Hash all the indexable data once\n const [bwDictionary, payloadDictionary] = await Promise.all([\n PayloadBuilder.toDataHashMap(indexableBoundWitnesses),\n PayloadBuilder.toDataHashMap(indexablePayloads),\n ])\n\n // Initialize the array for validIndexableTuples outside of the loop\n const validIndexableTuples: IndexableHashes[] = []\n\n // Iterate over each entry in bwDictionary\n for (const [bwHash, bw] of Object.entries(bwDictionary)) {\n // Find the combinations of payloads that satisfy the required schemas\n const combinations = intraBoundwitnessSchemaCombinations(bw, this.indexableSchemas)\n\n // Iterate over each combination\n for (const combination of combinations) {\n const indexablePayloads = combination.map((hash) => payloadDictionary[hash]).filter(exists)\n\n // If we found the right amount of indexable payloads (of the correct schema as checked\n // above) in this BW, then index it\n if (indexablePayloads.length === this.indexableSchemas.length) {\n validIndexableTuples.push([bwHash, ...combination])\n }\n }\n }\n\n // Create the indexes from the tuples\n const indexes = await Promise.all(\n validIndexableTuples.map<Promise<TemporalIndexingDivinerResultIndex>>(async ([bwHash, ...sourcePayloadHashes]) => {\n const sourcePayloads = sourcePayloadHashes.map((hash) => payloadDictionary[hash])\n // Use the payload transformers to convert the fields from the source payloads to the destination fields\n const indexFields = sourcePayloads.flatMap<PayloadFields[]>((payload) => {\n // Find the transformers for this payload\n const transformers = this.payloadTransformers[payload.schema]\n // If transformers exist, apply them to the payload otherwise return an empty array\n return transformers ? transformers.map((transform) => transform(payload)) : []\n })\n // Include all the sources for reference\n const sources: string[] = [bwHash, ...sourcePayloadHashes]\n // Build and return the index\n return await new PayloadBuilder<TemporalIndexingDivinerResultIndex>({ schema: TemporalIndexingDivinerResultIndexSchema })\n .fields(Object.assign({ sources }, ...indexFields))\n .build()\n }),\n )\n return indexes.flat()\n }\n\n /**\n * Identifies if a payload is one that is indexed by this diviner\n * @param x The candidate payload\n * @returns True if the payload is one indexed by this diviner, false otherwise\n */\n protected isIndexablePayload = (x: unknown) => {\n return isAnyPayload(x) && this.indexableSchemas.includes(x?.schema)\n }\n\n /**\n * Identifies if a schema is one that is indexed by this diviner\n * @param schema The candidate schema\n * @returns True if this schema is one indexed by this diviner, false otherwise\n */\n protected isIndexableSchema = (schema?: string | null) => {\n return typeof schema === 'string' ? this.indexableSchemas.includes(schema) : false\n }\n}\n","import { AbstractDiviner } from '@xyo-network/diviner-abstract'\nimport { DivinerConfigSchema } from '@xyo-network/diviner-model'\nimport { isPayloadDivinerQueryPayload } from '@xyo-network/diviner-payload-model'\nimport { TemporalIndexingDivinerIndexQueryResponseToDivinerQueryResponseDivinerConfigSchema } from '@xyo-network/diviner-temporal-indexing-model'\nimport { Labels } from '@xyo-network/module-model'\nimport { Payload } from '@xyo-network/payload-model'\n\n/**\n * Transforms an ImageThumbnailIndex response into an ImageThumbnailResponse response\n */\nexport class TemporalIndexingDivinerIndexQueryResponseToDivinerQueryResponseDiviner extends AbstractDiviner {\n static override readonly configSchema = TemporalIndexingDivinerIndexQueryResponseToDivinerQueryResponseDivinerConfigSchema\n static override configSchemas = [DivinerConfigSchema, TemporalIndexingDivinerIndexQueryResponseToDivinerQueryResponseDivinerConfigSchema]\n static labels: Labels = {\n 'network.xyo.diviner.stage': 'indexQueryResponseToDivinerQueryResponseDiviner',\n }\n\n protected override async divineHandler(payloads: Payload[] = []): Promise<Payload[]> {\n // NOTE: We're not doing anything with the query payloads but some diviners\n // might want to use this to transform from the query to the response (for example\n // if we use a plaintext value in the query to generate a hash key in the index)\n // const queries = payloads.filter(isPayloadDivinerQueryPayload)\n const responses = payloads.filter((p) => !isPayloadDivinerQueryPayload(p))\n return await Promise.resolve(responses)\n }\n}\n","import { assertEx } from '@xylabs/assert'\nimport { exists } from '@xylabs/exists'\nimport { ArchivistInstance } from '@xyo-network/archivist-model'\nimport { ArchivistWrapper } from '@xyo-network/archivist-wrapper'\nimport { BoundWitness, isBoundWitnessWithMeta } from '@xyo-network/boundwitness-model'\nimport { AbstractDiviner } from '@xyo-network/diviner-abstract'\nimport { BoundWitnessDivinerQueryPayload, BoundWitnessDivinerQuerySchema } from '@xyo-network/diviner-boundwitness-model'\nimport { IndexingDivinerState } from '@xyo-network/diviner-indexing-model'\nimport { DivinerConfigSchema } from '@xyo-network/diviner-model'\nimport {\n TemporalIndexingDivinerStateToIndexCandidateDivinerConfigSchema,\n TemporalIndexingDivinerStateToIndexCandidateDivinerParams,\n} from '@xyo-network/diviner-temporal-indexing-model'\nimport { DivinerWrapper } from '@xyo-network/diviner-wrapper'\nimport { isModuleState, Labels, ModuleState, ModuleStateSchema } from '@xyo-network/module-model'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport { Payload } from '@xyo-network/payload-model'\nimport { intraBoundwitnessSchemaCombinations } from '@xyo-network/payload-utils'\nimport { TimeStamp, TimestampSchema } from '@xyo-network/witness-timestamp'\n\n/**\n * All Payload types involved in index candidates for indexing\n */\nexport type IndexCandidate = BoundWitness | Payload | TimeStamp\n\n/**\n * The response from the TemporalStateToIndexCandidateDiviner\n */\nexport type TemporalStateToIndexCandidateDivinerResponse = [\n /**\n * The next state of the diviner\n */\n nextState: ModuleState<IndexingDivinerState>,\n /**\n * The index candidates\n */\n ...IndexCandidate[],\n]\n\n/**\n * The default order to search Bound Witnesses to identify index candidates\n */\nconst order = 'asc'\n\n/**\n * The name of the module (for logging purposes)\n */\nconst moduleName = 'TemporalIndexingDivinerStateToIndexCandidateDiviner'\n\n/**\n * Transforms candidates for image thumbnail indexing into their indexed representation\n */\nexport class TemporalIndexingDivinerStateToIndexCandidateDiviner<\n TParams extends TemporalIndexingDivinerStateToIndexCandidateDivinerParams = TemporalIndexingDivinerStateToIndexCandidateDivinerParams,\n> extends AbstractDiviner<TParams> {\n static override readonly configSchema = TemporalIndexingDivinerStateToIndexCandidateDivinerConfigSchema\n static override configSchemas = [DivinerConfigSchema, TemporalIndexingDivinerStateToIndexCandidateDivinerConfigSchema]\n static labels: Labels = {\n 'network.xyo.diviner.stage': 'stateToIndexCandidateDiviner',\n }\n\n get payloadDivinerLimit() {\n return this.config.payloadDivinerLimit ?? 1000\n }\n\n /**\n * The required payload_schemas within BoundWitnesses to identify index candidates\n */\n protected get payload_schemas(): string[] {\n const schemas = this.config.filter?.payload_schemas\n return [TimestampSchema, ...(schemas ?? [])]\n }\n\n protected override async divineHandler(payloads: Payload[] = []): Promise<[ModuleState, ...IndexCandidate[]]> {\n // Retrieve the last state from what was passed in\n const lastState = payloads.find(isModuleState<IndexingDivinerState>)\n // If there is no last state, start from the beginning\n if (!lastState) return [{ schema: ModuleStateSchema, state: { offset: 0 } }]\n // Otherwise, get the last offset\n const { offset } = lastState.state\n // Get next batch of results starting from the offset\n const boundWitnessDiviner = await this.getBoundWitnessDivinerForStore()\n if (!boundWitnessDiviner) return [lastState]\n const query = await new PayloadBuilder<BoundWitnessDivinerQueryPayload>({ schema: BoundWitnessDivinerQuerySchema })\n .fields({ limit: this.payloadDivinerLimit, offset, order, payload_schemas: this.payload_schemas })\n .build()\n const batch = await boundWitnessDiviner.divine([query])\n if (batch.length === 0) return [lastState]\n // Get source data\n const sourceArchivist = await this.getArchivistForStore()\n if (!sourceArchivist) return [lastState]\n const indexCandidates: IndexCandidate[] = (\n await Promise.all(batch.filter(isBoundWitnessWithMeta).map((bw) => this.getPayloadsInBoundWitness(bw, sourceArchivist)))\n )\n .filter(exists)\n .flat()\n const nextState = { schema: ModuleStateSchema, state: { ...lastState.state, offset: offset + batch.length } }\n return [nextState, ...indexCandidates]\n }\n /**\n * Retrieves the archivist for the payloadStore\n * @returns The archivist for the payloadStore or undefined if not resolvable\n */\n protected async getArchivistForStore(): Promise<ArchivistWrapper | undefined> {\n // It should be defined, so we'll error if it's not\n const name: string = assertEx(this.config?.payloadStore?.archivist, () => `${moduleName}: Config for payloadStore.archivist not specified`)\n // It might not be resolvable (yet), so we'll return undefined if it's not\n const mod = await this.resolve(name)\n if (!mod) return undefined\n // Return the wrapped archivist\n return ArchivistWrapper.wrap(mod, this.account)\n }\n\n /**\n * Retrieves the BoundWitness Diviner for the payloadStore\n * @returns The BoundWitness Diviner for the payloadStore or undefined if not resolvable\n */\n protected async getBoundWitnessDivinerForStore(): Promise<DivinerWrapper | undefined> {\n // It should be defined, so we'll error if it's not\n const name: string = assertEx(\n this.config?.payloadStore?.boundWitnessDiviner,\n () => `${moduleName}: Config for payloadStore.boundWitnessDiviner not specified`,\n )\n // It might not be resolvable (yet), so we'll return undefined if it's not\n const mod = await this.resolve(name)\n if (!mod) return undefined\n // Return the wrapped diviner\n return DivinerWrapper.wrap(mod, this.account)\n }\n\n protected async getPayloadsInBoundWitness(bw: BoundWitness, archivist: ArchivistInstance): Promise<IndexCandidate[] | undefined> {\n const combinations = intraBoundwitnessSchemaCombinations(bw, this.payload_schemas).flat()\n if (combinations.length === 0) return undefined\n const hashes = new Set(combinations)\n const indexCandidates = await archivist.get([...hashes])\n return [bw, ...indexCandidates]\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;ACAA,qCAAgC;AAChC,oCAA4C;AAC5C,2BAA2E;AAC3E,6CAAmF;AAG5E,IAAMA,0BAAN,cAKGC,+CAAAA;EAXV,OAWUA;;;EACR,OAAyBC,eAAeC;EACxC,OAAyBC,gBAA0B;IAACD;IAAqCE;IAA6BC;;EAEtH,MAAyBC,eAAiC;AACxD,UAAM,MAAMA,aAAAA;AACZ,WAAO;EACT;AACF;;;ACnBA,8BAAgC;AAChC,+CAAiE;AAEjE,IAAAC,wBAAoC;AACpC,mCAAsE;AACtE,IAAAC,0CAIO;AAEP,6BAA+B;AAC/B,2BAA+C;AAKxC,IAAMC,yDAAN,cAEGC,wCAAAA;EAnBV,OAmBUA;;;EACR,OAAyBC,eAAeC;EACxC,OAAgBC,gBAAgB;IAACC;IAAqBF;;EACtD,OAAOG,SAAiB;IACtB,6BAA6B;EAC/B;EAEQC;EACAC;;;;EAKR,IAAcC,qBAA6B;AACzC,WA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,MAAM,GAAGvB,WAAAA,6DAAuE;AAGlF,UAAMkD,MAAM,MAAM,KAAKC,QAAQL,IAAAA;AAC/B,QAAI,CAACI;AAAK,aAAOE;AAEjB,WAAOI,sCAAeF,KAAKJ,KAAK,KAAKK,OAAO;EAC9C;EAEA,MAAgBb,0BAA0BD,IAAkBQ,WAAqE;AAC/H,UAAMQ,mBAAeC,2DAAoCjB,IAAI,KAAK/B,eAAe,EAAEkC,KAAI;AACvF,QAAIa,aAAaxB,WAAW;AAAG,aAAOmB;AACtC,UAAMO,SAAS,IAAIC,IAAIH,YAAAA;AACvB,UAAMrB,kBAAkB,MAAMa,UAAUY,IAAI;SAAIF;KAAO;AACvD,WAAO;MAAClB;SAAOL;;EACjB;AACF;","names":["TemporalIndexingDiviner","IndexingDiviner","configSchema","TemporalIndexingDivinerConfigSchema","configSchemas","IndexingDivinerConfigSchema","DivinerConfigSchema","startHandler","import_diviner_model","import_diviner_temporal_indexing_model","TemporalIndexingDivinerDivinerQueryToIndexQueryDiviner","AbstractDiviner","configSchema","TemporalIndexingDivinerDivinerQueryToIndexQueryDivinerConfigSchema","configSchemas","DivinerConfigSchema","labels","_indexableSchemas","_payloadTransformers","divinerQuerySchema","config","PayloadDivinerQuerySchema","indexQuerySchema","indexSchema","TemporalIndexingDivinerResultIndexSchema","indexableSchemas","Object","keys","schemaTransforms","payloadTransformers","jsonPathToTransformersDictionary","defaultValue","destinationField","sourcePathExpression","divineHandler","payloads","queries","filter","isPayloadOfSchemaType","length","results","Promise","all","map","query","fields","reducePayloads","schemas","sources","PayloadBuilder","schema","build","import_diviner_abstract","import_diviner_jsonpath_aggregate_memory","import_diviner_model","import_diviner_temporal_indexing_model","import_payload_builder","import_payload_model","moduleName","TemporalIndexingDivinerIndexCandidateToIndexDiviner","AbstractDiviner","configSchema","TemporalIndexingDivinerIndexCandidateToIndexDivinerConfigSchema","configSchemas","DivinerConfigSchema","labels","_indexableSchemas","_payloadTransformers","indexableSchemas","Object","keys","schemaTransforms","payloadTransformers","jsonPathToTransformersDictionary","assertEx","config","divineHandler","payloads","builtPayloads","Promise","all","map","payload","PayloadBuilder","build","indexableBoundWitnesses","filter","isBoundWitnessWithMeta","bw","containsAll","payload_schemas","indexablePayloads","p","isIndexablePayload","length","bwDictionary","payloadDictionary","toDataHashMap","validIndexableTuples","bwHash","entries","combinations","intraBoundwitnessSchemaCombinations","combination","hash","exists","push","indexes","sourcePayloadHashes","sourcePayloads","indexFields","flatMap","transformers","schema","transform","sources","TemporalIndexingDivinerResultIndexSchema","fields","assign","flat","x","isAnyPayload","includes","isIndexableSchema","import_diviner_abstract","import_diviner_model","import_diviner_payload_model","import_diviner_temporal_indexing_model","TemporalIndexingDivinerIndexQueryResponseToDivinerQueryResponseDiviner","AbstractDiviner","configSchema","TemporalIndexingDivinerIndexQueryResponseToDivinerQueryResponseDivinerConfigSchema","configSchemas","DivinerConfigSchema","labels","divineHandler","payloads","responses","filter","p","isPayloadDivinerQueryPayload","Promise","resolve","import_assert","import_exists","import_boundwitness_model","import_diviner_abstract","import_diviner_model","import_diviner_temporal_indexing_model","import_payload_builder","import_payload_utils","order","moduleName","TemporalIndexingDivinerStateToIndexCandidateDiviner","AbstractDiviner","configSchema","TemporalIndexingDivinerStateToIndexCandidateDivinerConfigSchema","configSchemas","DivinerConfigSchema","labels","payloadDivinerLimit","config","payload_schemas","schemas","filter","TimestampSchema","divineHandler","payloads","lastState","find","isModuleState","schema","ModuleStateSchema","state","offset","boundWitnessDiviner","getBoundWitnessDivinerForStore","query","PayloadBuilder","BoundWitnessDivinerQuerySchema","fields","limit","build","batch","divine","length","sourceArchivist","getArchivistForStore","indexCandidates","Promise","all","isBoundWitnessWithMeta","map","bw","getPayloadsInBoundWitness","exists","flat","nextState","name","assertEx","payloadStore","archivist","mod","resolve","undefined","ArchivistWrapper","wrap","account","DivinerWrapper","combinations","intraBoundwitnessSchemaCombinations","hashes","Set","get"]}
@@ -129,12 +129,13 @@ var TemporalIndexingDivinerDivinerQueryToIndexQueryDiviner = class extends Abstr
129
129
  import { containsAll } from "@xylabs/array";
130
130
  import { assertEx } from "@xylabs/assert";
131
131
  import { exists } from "@xylabs/exists";
132
- import { isBoundWitness } from "@xyo-network/boundwitness-model";
132
+ import { isBoundWitnessWithMeta } from "@xyo-network/boundwitness-model";
133
133
  import { AbstractDiviner as AbstractDiviner2 } from "@xyo-network/diviner-abstract";
134
134
  import { jsonPathToTransformersDictionary as jsonPathToTransformersDictionary2 } from "@xyo-network/diviner-jsonpath-aggregate-memory";
135
135
  import { DivinerConfigSchema as DivinerConfigSchema3 } from "@xyo-network/diviner-model";
136
136
  import { TemporalIndexingDivinerIndexCandidateToIndexDivinerConfigSchema, TemporalIndexingDivinerResultIndexSchema as TemporalIndexingDivinerResultIndexSchema2 } from "@xyo-network/diviner-temporal-indexing-model";
137
137
  import { PayloadBuilder as PayloadBuilder2 } from "@xyo-network/payload-builder";
138
+ import { isAnyPayload } from "@xyo-network/payload-model";
138
139
  import { intraBoundwitnessSchemaCombinations } from "@xyo-network/payload-utils";
139
140
  var moduleName = "TemporalIndexingDivinerIndexCandidateToIndexDiviner";
140
141
  var TemporalIndexingDivinerIndexCandidateToIndexDiviner = class extends AbstractDiviner2 {
@@ -176,8 +177,9 @@ var TemporalIndexingDivinerIndexCandidateToIndexDiviner = class extends Abstract
176
177
  return assertEx(this.config?.schemaTransforms, () => `${moduleName}: Missing config.schemaTransforms section`);
177
178
  }
178
179
  async divineHandler(payloads = []) {
179
- const indexableBoundWitnesses = payloads.filter(isBoundWitness).filter((bw) => containsAll(bw.payload_schemas, this.indexableSchemas));
180
- const indexablePayloads = payloads.filter((p) => this.isIndexablePayload(p));
180
+ const builtPayloads = await Promise.all(payloads.map((payload) => PayloadBuilder2.build(payload)));
181
+ const indexableBoundWitnesses = builtPayloads.filter(isBoundWitnessWithMeta).filter((bw) => containsAll(bw.payload_schemas, this.indexableSchemas));
182
+ const indexablePayloads = builtPayloads.filter((p) => this.isIndexablePayload(p));
181
183
  if (indexableBoundWitnesses.length === 0 || indexablePayloads.length === 0)
182
184
  return [];
183
185
  const [bwDictionary, payloadDictionary] = await Promise.all([
@@ -221,7 +223,7 @@ var TemporalIndexingDivinerIndexCandidateToIndexDiviner = class extends Abstract
221
223
  * @returns True if the payload is one indexed by this diviner, false otherwise
222
224
  */
223
225
  isIndexablePayload = (x) => {
224
- return this.indexableSchemas.includes(x?.schema);
226
+ return isAnyPayload(x) && this.indexableSchemas.includes(x?.schema);
225
227
  };
226
228
  /**
227
229
  * Identifies if a schema is one that is indexed by this diviner
@@ -260,7 +262,7 @@ var TemporalIndexingDivinerIndexQueryResponseToDivinerQueryResponseDiviner = cla
260
262
  import { assertEx as assertEx2 } from "@xylabs/assert";
261
263
  import { exists as exists2 } from "@xylabs/exists";
262
264
  import { ArchivistWrapper } from "@xyo-network/archivist-wrapper";
263
- import { isBoundWitness as isBoundWitness2 } from "@xyo-network/boundwitness-model";
265
+ import { isBoundWitnessWithMeta as isBoundWitnessWithMeta2 } from "@xyo-network/boundwitness-model";
264
266
  import { AbstractDiviner as AbstractDiviner4 } from "@xyo-network/diviner-abstract";
265
267
  import { BoundWitnessDivinerQuerySchema } from "@xyo-network/diviner-boundwitness-model";
266
268
  import { DivinerConfigSchema as DivinerConfigSchema5 } from "@xyo-network/diviner-model";
@@ -334,7 +336,7 @@ var TemporalIndexingDivinerStateToIndexCandidateDiviner = class extends Abstract
334
336
  return [
335
337
  lastState
336
338
  ];
337
- const indexCandidates = (await Promise.all(batch.filter(isBoundWitness2).map((bw) => this.getPayloadsInBoundWitness(bw, sourceArchivist)))).filter(exists2).flat();
339
+ const indexCandidates = (await Promise.all(batch.filter(isBoundWitnessWithMeta2).map((bw) => this.getPayloadsInBoundWitness(bw, sourceArchivist)))).filter(exists2).flat();
338
340
  const nextState = {
339
341
  schema: ModuleStateSchema,
340
342
  state: {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Diviner.ts","../../src/DivinerQueryToIndexQueryDiviner/Diviner.ts","../../src/IndexCandidateToIndexDiviner/Diviner.ts","../../src/IndexQueryResponseToDivinerQueryResponseDiviner/Diviner.ts","../../src/StateToIndexCandidateDiviner/Diviner.ts"],"sourcesContent":["import { IndexingDiviner } from '@xyo-network/diviner-indexing-memory'\nimport { IndexingDivinerConfigSchema } from '@xyo-network/diviner-indexing-model'\nimport { DivinerConfigSchema, DivinerModule, DivinerModuleEventData } from '@xyo-network/diviner-model'\nimport { TemporalIndexingDivinerConfigSchema, TemporalIndexingDivinerParams } from '@xyo-network/diviner-temporal-indexing-model'\nimport { Payload } from '@xyo-network/payload-model'\n\nexport class TemporalIndexingDiviner<\n TParams extends TemporalIndexingDivinerParams = TemporalIndexingDivinerParams,\n TIn extends Payload = Payload,\n TOut extends Payload = Payload,\n TEventData extends DivinerModuleEventData<DivinerModule<TParams>, TIn, TOut> = DivinerModuleEventData<DivinerModule<TParams>, TIn, TOut>,\n> extends IndexingDiviner<TParams, TIn, TOut, TEventData> {\n static override readonly configSchema = TemporalIndexingDivinerConfigSchema\n static override readonly configSchemas: string[] = [TemporalIndexingDivinerConfigSchema, IndexingDivinerConfigSchema, DivinerConfigSchema]\n\n protected override async startHandler(): Promise<boolean> {\n await super.startHandler()\n return true\n }\n}\n","import { AbstractDiviner } from '@xyo-network/diviner-abstract'\nimport { jsonPathToTransformersDictionary, reducePayloads } from '@xyo-network/diviner-jsonpath-aggregate-memory'\nimport { SchemaToJsonPathTransformExpressionsDictionary, SchemaToPayloadTransformersDictionary } from '@xyo-network/diviner-jsonpath-model'\nimport { DivinerConfigSchema } from '@xyo-network/diviner-model'\nimport { PayloadDivinerQueryPayload, PayloadDivinerQuerySchema } from '@xyo-network/diviner-payload-model'\nimport {\n TemporalIndexingDivinerDivinerQueryToIndexQueryDivinerConfigSchema,\n TemporalIndexingDivinerDivinerQueryToIndexQueryDivinerParams,\n TemporalIndexingDivinerResultIndexSchema,\n} from '@xyo-network/diviner-temporal-indexing-model'\nimport { Labels } from '@xyo-network/module-model'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport { isPayloadOfSchemaType, Payload } from '@xyo-network/payload-model'\n// TODO: Inherit from JsonPathAggregateDiviner\n/**\n * A diviner that converts diviner query to index query\n */\nexport class TemporalIndexingDivinerDivinerQueryToIndexQueryDiviner<\n TParams extends TemporalIndexingDivinerDivinerQueryToIndexQueryDivinerParams = TemporalIndexingDivinerDivinerQueryToIndexQueryDivinerParams,\n> extends AbstractDiviner<TParams> {\n static override readonly configSchema = TemporalIndexingDivinerDivinerQueryToIndexQueryDivinerConfigSchema\n static override configSchemas = [DivinerConfigSchema, TemporalIndexingDivinerDivinerQueryToIndexQueryDivinerConfigSchema]\n static labels: Labels = {\n 'network.xyo.diviner.stage': 'divinerQueryToIndexQueryDiviner',\n }\n\n private _indexableSchemas: string[] | undefined\n private _payloadTransformers: SchemaToPayloadTransformersDictionary | undefined\n\n /**\n * The schema of the diviner query payloads\n */\n protected get divinerQuerySchema(): string {\n return this.config.divinerQuerySchema ?? PayloadDivinerQuerySchema\n }\n\n /**\n * The schema of the index query payloads\n */\n protected get indexQuerySchema(): string {\n return this.config.indexQuerySchema ?? PayloadDivinerQuerySchema\n }\n\n /**\n * The schema of the index payloads\n */\n protected get indexSchema(): string {\n return this.config.indexSchema ?? TemporalIndexingDivinerResultIndexSchema\n }\n\n /**\n * List of indexable schemas for this diviner\n */\n protected get indexableSchemas(): string[] {\n if (!this._indexableSchemas) this._indexableSchemas = Object.keys(this.schemaTransforms)\n return this._indexableSchemas\n }\n\n /**\n * Dictionary of schemas to payload transformers for creating indexes\n * from the payloads within a Bound Witness\n */\n protected get payloadTransformers(): SchemaToPayloadTransformersDictionary {\n if (!this._payloadTransformers) this._payloadTransformers = jsonPathToTransformersDictionary(this.schemaTransforms)\n return this._payloadTransformers\n }\n\n /**\n * The dictionary of schemas to JSON Path transform expressions for creating indexes\n * from the payloads within a Bound Witness\n */\n protected get schemaTransforms(): SchemaToJsonPathTransformExpressionsDictionary {\n return (\n this.config?.schemaTransforms ?? {\n [this.divinerQuerySchema]: [\n {\n defaultValue: 1,\n destinationField: 'limit',\n sourcePathExpression: '$.limit',\n },\n {\n defaultValue: 0,\n destinationField: 'offset',\n sourcePathExpression: '$.offset',\n },\n {\n defaultValue: 'desc',\n destinationField: 'order',\n sourcePathExpression: '$.order',\n },\n ],\n }\n )\n }\n\n protected override async divineHandler(payloads: Payload[] = []): Promise<Payload[]> {\n const queries = payloads.filter(isPayloadOfSchemaType<PayloadDivinerQueryPayload>(this.divinerQuerySchema))\n if (queries.length > 0) {\n const results = await Promise.all(\n queries.map(async (query) => {\n const fields = await reducePayloads<PayloadDivinerQueryPayload & { sources?: string[] }>(\n [query],\n this.payloadTransformers,\n this.indexQuerySchema,\n )\n // TODO: Make index schema configurable\n fields.schemas = [this.indexSchema]\n // TODO: Make sources not need to be deleted\n delete fields.sources\n // TODO: Add support for additional filters\n return await new PayloadBuilder<Payload>({ schema: this.indexQuerySchema }).fields(fields).build()\n }),\n )\n return results\n }\n return []\n }\n}\n","import { containsAll } from '@xylabs/array'\nimport { assertEx } from '@xylabs/assert'\nimport { exists } from '@xylabs/exists'\nimport { BoundWitness, isBoundWitness } from '@xyo-network/boundwitness-model'\nimport { AbstractDiviner } from '@xyo-network/diviner-abstract'\nimport { jsonPathToTransformersDictionary } from '@xyo-network/diviner-jsonpath-aggregate-memory'\nimport { SchemaToJsonPathTransformExpressionsDictionary, SchemaToPayloadTransformersDictionary } from '@xyo-network/diviner-jsonpath-model'\nimport { DivinerConfigSchema } from '@xyo-network/diviner-model'\nimport {\n TemporalIndexingDivinerIndexCandidateToIndexDivinerConfigSchema,\n TemporalIndexingDivinerIndexCandidateToIndexDivinerParams,\n TemporalIndexingDivinerResultIndex,\n TemporalIndexingDivinerResultIndexSchema,\n} from '@xyo-network/diviner-temporal-indexing-model'\nimport { Labels } from '@xyo-network/module-model'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport { Payload, PayloadFields } from '@xyo-network/payload-model'\nimport { intraBoundwitnessSchemaCombinations } from '@xyo-network/payload-utils'\n\ntype IndexableHashes = [string, ...string[]]\n\nconst moduleName = 'TemporalIndexingDivinerIndexCandidateToIndexDiviner'\n\n/**\n * Diviner which transforms index candidates to indexes using JSON Path to map\n * source properties in the supplied payloads to destination fields in the\n * resultant index\n */\nexport class TemporalIndexingDivinerIndexCandidateToIndexDiviner<\n TParams extends TemporalIndexingDivinerIndexCandidateToIndexDivinerParams = TemporalIndexingDivinerIndexCandidateToIndexDivinerParams,\n> extends AbstractDiviner<TParams> {\n static override configSchema = TemporalIndexingDivinerIndexCandidateToIndexDivinerConfigSchema\n static override configSchemas = [DivinerConfigSchema, TemporalIndexingDivinerIndexCandidateToIndexDivinerConfigSchema]\n static labels: Labels = {\n 'network.xyo.diviner.stage': 'indexCandidateToIndexDiviner',\n }\n\n private _indexableSchemas: string[] | undefined\n private _payloadTransformers: SchemaToPayloadTransformersDictionary | undefined\n\n /**\n * List of indexable schemas for this diviner\n */\n protected get indexableSchemas(): string[] {\n if (!this._indexableSchemas) this._indexableSchemas = Object.keys(this.schemaTransforms)\n return this._indexableSchemas\n }\n\n /**\n * Dictionary of schemas to payload transformers for creating indexes\n * from the payloads within a Bound Witness\n */\n protected get payloadTransformers(): SchemaToPayloadTransformersDictionary {\n if (!this._payloadTransformers) this._payloadTransformers = jsonPathToTransformersDictionary(this.schemaTransforms)\n return this._payloadTransformers\n }\n\n /**\n * The dictionary of schemas to JSON Path transform expressions for creating indexes\n * from the payloads within a Bound Witness\n */\n protected get schemaTransforms(): SchemaToJsonPathTransformExpressionsDictionary {\n return assertEx(this.config?.schemaTransforms, () => `${moduleName}: Missing config.schemaTransforms section`)\n }\n\n protected override async divineHandler(payloads: Payload[] = []): Promise<Payload[]> {\n // If the Bound Witness does not contain all the required schemas do not index it\n const indexableBoundWitnesses: BoundWitness[] = payloads\n .filter(isBoundWitness)\n .filter((bw) => containsAll(bw.payload_schemas, this.indexableSchemas))\n // If the Payload is not one of the indexable schemas do not index it\n const indexablePayloads: Payload[] = payloads.filter((p) => this.isIndexablePayload(p))\n // If there is nothing to index, return an empty array\n if (indexableBoundWitnesses.length === 0 || indexablePayloads.length === 0) return []\n // Hash all the indexable data once\n const [bwDictionary, payloadDictionary] = await Promise.all([\n PayloadBuilder.toDataHashMap(indexableBoundWitnesses),\n PayloadBuilder.toDataHashMap(indexablePayloads),\n ])\n\n // Initialize the array for validIndexableTuples outside of the loop\n const validIndexableTuples: IndexableHashes[] = []\n\n // Iterate over each entry in bwDictionary\n for (const [bwHash, bw] of Object.entries(bwDictionary)) {\n // Find the combinations of payloads that satisfy the required schemas\n const combinations = intraBoundwitnessSchemaCombinations(bw, this.indexableSchemas)\n\n // Iterate over each combination\n for (const combination of combinations) {\n const indexablePayloads = combination.map((hash) => payloadDictionary[hash]).filter(exists)\n\n // If we found the right amount of indexable payloads (of the correct schema as checked\n // above) in this BW, then index it\n if (indexablePayloads.length === this.indexableSchemas.length) {\n validIndexableTuples.push([bwHash, ...combination])\n }\n }\n }\n\n // Create the indexes from the tuples\n const indexes = await Promise.all(\n validIndexableTuples.map<Promise<TemporalIndexingDivinerResultIndex>>(async ([bwHash, ...sourcePayloadHashes]) => {\n const sourcePayloads = sourcePayloadHashes.map((hash) => payloadDictionary[hash])\n // Use the payload transformers to convert the fields from the source payloads to the destination fields\n const indexFields = sourcePayloads.flatMap<PayloadFields[]>((payload) => {\n // Find the transformers for this payload\n const transformers = this.payloadTransformers[payload.schema]\n // If transformers exist, apply them to the payload otherwise return an empty array\n return transformers ? transformers.map((transform) => transform(payload)) : []\n })\n // Include all the sources for reference\n const sources: string[] = [bwHash, ...sourcePayloadHashes]\n // Build and return the index\n return await new PayloadBuilder<TemporalIndexingDivinerResultIndex>({ schema: TemporalIndexingDivinerResultIndexSchema })\n .fields(Object.assign({ sources }, ...indexFields))\n .build()\n }),\n )\n return indexes.flat()\n }\n\n /**\n * Identifies if a payload is one that is indexed by this diviner\n * @param x The candidate payload\n * @returns True if the payload is one indexed by this diviner, false otherwise\n */\n protected isIndexablePayload = (x: Payload) => {\n return this.indexableSchemas.includes(x?.schema)\n }\n\n /**\n * Identifies if a schema is one that is indexed by this diviner\n * @param schema The candidate schema\n * @returns True if this schema is one indexed by this diviner, false otherwise\n */\n protected isIndexableSchema = (schema?: string | null) => {\n return typeof schema === 'string' ? this.indexableSchemas.includes(schema) : false\n }\n}\n","import { AbstractDiviner } from '@xyo-network/diviner-abstract'\nimport { DivinerConfigSchema } from '@xyo-network/diviner-model'\nimport { isPayloadDivinerQueryPayload } from '@xyo-network/diviner-payload-model'\nimport { TemporalIndexingDivinerIndexQueryResponseToDivinerQueryResponseDivinerConfigSchema } from '@xyo-network/diviner-temporal-indexing-model'\nimport { Labels } from '@xyo-network/module-model'\nimport { Payload } from '@xyo-network/payload-model'\n\n/**\n * Transforms an ImageThumbnailIndex response into an ImageThumbnailResponse response\n */\nexport class TemporalIndexingDivinerIndexQueryResponseToDivinerQueryResponseDiviner extends AbstractDiviner {\n static override readonly configSchema = TemporalIndexingDivinerIndexQueryResponseToDivinerQueryResponseDivinerConfigSchema\n static override configSchemas = [DivinerConfigSchema, TemporalIndexingDivinerIndexQueryResponseToDivinerQueryResponseDivinerConfigSchema]\n static labels: Labels = {\n 'network.xyo.diviner.stage': 'indexQueryResponseToDivinerQueryResponseDiviner',\n }\n\n protected override async divineHandler(payloads: Payload[] = []): Promise<Payload[]> {\n // NOTE: We're not doing anything with the query payloads but some diviners\n // might want to use this to transform from the query to the response (for example\n // if we use a plaintext value in the query to generate a hash key in the index)\n // const queries = payloads.filter(isPayloadDivinerQueryPayload)\n const responses = payloads.filter((p) => !isPayloadDivinerQueryPayload(p))\n return await Promise.resolve(responses)\n }\n}\n","import { assertEx } from '@xylabs/assert'\nimport { exists } from '@xylabs/exists'\nimport { ArchivistInstance } from '@xyo-network/archivist-model'\nimport { ArchivistWrapper } from '@xyo-network/archivist-wrapper'\nimport { BoundWitness, isBoundWitness } from '@xyo-network/boundwitness-model'\nimport { AbstractDiviner } from '@xyo-network/diviner-abstract'\nimport { BoundWitnessDivinerQueryPayload, BoundWitnessDivinerQuerySchema } from '@xyo-network/diviner-boundwitness-model'\nimport { IndexingDivinerState } from '@xyo-network/diviner-indexing-model'\nimport { DivinerConfigSchema } from '@xyo-network/diviner-model'\nimport {\n TemporalIndexingDivinerStateToIndexCandidateDivinerConfigSchema,\n TemporalIndexingDivinerStateToIndexCandidateDivinerParams,\n} from '@xyo-network/diviner-temporal-indexing-model'\nimport { DivinerWrapper } from '@xyo-network/diviner-wrapper'\nimport { isModuleState, Labels, ModuleState, ModuleStateSchema } from '@xyo-network/module-model'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport { Payload } from '@xyo-network/payload-model'\nimport { intraBoundwitnessSchemaCombinations } from '@xyo-network/payload-utils'\nimport { TimeStamp, TimestampSchema } from '@xyo-network/witness-timestamp'\n\n/**\n * All Payload types involved in index candidates for indexing\n */\nexport type IndexCandidate = BoundWitness | Payload | TimeStamp\n\n/**\n * The response from the TemporalStateToIndexCandidateDiviner\n */\nexport type TemporalStateToIndexCandidateDivinerResponse = [\n /**\n * The next state of the diviner\n */\n nextState: ModuleState<IndexingDivinerState>,\n /**\n * The index candidates\n */\n ...IndexCandidate[],\n]\n\n/**\n * The default order to search Bound Witnesses to identify index candidates\n */\nconst order = 'asc'\n\n/**\n * The name of the module (for logging purposes)\n */\nconst moduleName = 'TemporalIndexingDivinerStateToIndexCandidateDiviner'\n\n/**\n * Transforms candidates for image thumbnail indexing into their indexed representation\n */\nexport class TemporalIndexingDivinerStateToIndexCandidateDiviner<\n TParams extends TemporalIndexingDivinerStateToIndexCandidateDivinerParams = TemporalIndexingDivinerStateToIndexCandidateDivinerParams,\n> extends AbstractDiviner<TParams> {\n static override readonly configSchema = TemporalIndexingDivinerStateToIndexCandidateDivinerConfigSchema\n static override configSchemas = [DivinerConfigSchema, TemporalIndexingDivinerStateToIndexCandidateDivinerConfigSchema]\n static labels: Labels = {\n 'network.xyo.diviner.stage': 'stateToIndexCandidateDiviner',\n }\n\n get payloadDivinerLimit() {\n return this.config.payloadDivinerLimit ?? 1000\n }\n\n /**\n * The required payload_schemas within BoundWitnesses to identify index candidates\n */\n protected get payload_schemas(): string[] {\n const schemas = this.config.filter?.payload_schemas\n return [TimestampSchema, ...(schemas ?? [])]\n }\n\n protected override async divineHandler(payloads: Payload[] = []): Promise<[ModuleState, ...IndexCandidate[]]> {\n // Retrieve the last state from what was passed in\n const lastState = payloads.find(isModuleState<IndexingDivinerState>)\n // If there is no last state, start from the beginning\n if (!lastState) return [{ schema: ModuleStateSchema, state: { offset: 0 } }]\n // Otherwise, get the last offset\n const { offset } = lastState.state\n // Get next batch of results starting from the offset\n const boundWitnessDiviner = await this.getBoundWitnessDivinerForStore()\n if (!boundWitnessDiviner) return [lastState]\n const query = await new PayloadBuilder<BoundWitnessDivinerQueryPayload>({ schema: BoundWitnessDivinerQuerySchema })\n .fields({ limit: this.payloadDivinerLimit, offset, order, payload_schemas: this.payload_schemas })\n .build()\n const batch = await boundWitnessDiviner.divine([query])\n if (batch.length === 0) return [lastState]\n // Get source data\n const sourceArchivist = await this.getArchivistForStore()\n if (!sourceArchivist) return [lastState]\n const indexCandidates: IndexCandidate[] = (\n await Promise.all(batch.filter(isBoundWitness).map((bw) => this.getPayloadsInBoundWitness(bw, sourceArchivist)))\n )\n .filter(exists)\n .flat()\n const nextState = { schema: ModuleStateSchema, state: { ...lastState.state, offset: offset + batch.length } }\n return [nextState, ...indexCandidates]\n }\n /**\n * Retrieves the archivist for the payloadStore\n * @returns The archivist for the payloadStore or undefined if not resolvable\n */\n protected async getArchivistForStore(): Promise<ArchivistWrapper | undefined> {\n // It should be defined, so we'll error if it's not\n const name: string = assertEx(this.config?.payloadStore?.archivist, () => `${moduleName}: Config for payloadStore.archivist not specified`)\n // It might not be resolvable (yet), so we'll return undefined if it's not\n const mod = await this.resolve(name)\n if (!mod) return undefined\n // Return the wrapped archivist\n return ArchivistWrapper.wrap(mod, this.account)\n }\n\n /**\n * Retrieves the BoundWitness Diviner for the payloadStore\n * @returns The BoundWitness Diviner for the payloadStore or undefined if not resolvable\n */\n protected async getBoundWitnessDivinerForStore(): Promise<DivinerWrapper | undefined> {\n // It should be defined, so we'll error if it's not\n const name: string = assertEx(\n this.config?.payloadStore?.boundWitnessDiviner,\n () => `${moduleName}: Config for payloadStore.boundWitnessDiviner not specified`,\n )\n // It might not be resolvable (yet), so we'll return undefined if it's not\n const mod = await this.resolve(name)\n if (!mod) return undefined\n // Return the wrapped diviner\n return DivinerWrapper.wrap(mod, this.account)\n }\n\n protected async getPayloadsInBoundWitness(bw: BoundWitness, archivist: ArchivistInstance): Promise<IndexCandidate[] | undefined> {\n const combinations = intraBoundwitnessSchemaCombinations(bw, this.payload_schemas).flat()\n if (combinations.length === 0) return undefined\n const hashes = new Set(combinations)\n const indexCandidates = await archivist.get([...hashes])\n return [bw, ...indexCandidates]\n }\n}\n"],"mappings":";;;;AAAA,SAASA,uBAAuB;AAChC,SAASC,mCAAmC;AAC5C,SAASC,2BAAkE;AAC3E,SAASC,2CAA0E;AAG5E,IAAMC,0BAAN,cAKGC,gBAAAA;EAXV,OAWUA;;;EACR,OAAyBC,eAAeC;EACxC,OAAyBC,gBAA0B;IAACD;IAAqCE;IAA6BC;;EAEtH,MAAyBC,eAAiC;AACxD,UAAM,MAAMA,aAAAA;AACZ,WAAO;EACT;AACF;;;ACnBA,SAASC,uBAAuB;AAChC,SAASC,kCAAkCC,sBAAsB;AAEjE,SAASC,uBAAAA,4BAA2B;AACpC,SAAqCC,iCAAiC;AACtE,SACEC,oEAEAC,gDACK;AAEP,SAASC,sBAAsB;AAC/B,SAASC,6BAAsC;AAKxC,IAAMC,yDAAN,cAEGC,gBAAAA;EAnBV,OAmBUA;;;EACR,OAAyBC,eAAeC;EACxC,OAAgBC,gBAAgB;IAACC;IAAqBF;;EACtD,OAAOG,SAAiB;IACtB,6BAA6B;EAC/B;EAEQC;EACAC;;;;EAKR,IAAcC,qBAA6B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,MAAM,GAAGvB,WAAAA,6DAAuE;AAGlF,UAAMkD,MAAM,MAAM,KAAKC,QAAQL,IAAAA;AAC/B,QAAI,CAACI;AAAK,aAAOE;AAEjB,WAAOI,eAAeF,KAAKJ,KAAK,KAAKK,OAAO;EAC9C;EAEA,MAAgBb,0BAA0BD,IAAkBQ,WAAqE;AAC/H,UAAMQ,eAAeC,qCAAoCjB,IAAI,KAAK/B,eAAe,EAAEkC,KAAI;AACvF,QAAIa,aAAaxB,WAAW;AAAG,aAAOmB;AACtC,UAAMO,SAAS,IAAIC,IAAIH,YAAAA;AACvB,UAAMrB,kBAAkB,MAAMa,UAAUY,IAAI;SAAIF;KAAO;AACvD,WAAO;MAAClB;SAAOL;;EACjB;AACF;","names":["IndexingDiviner","IndexingDivinerConfigSchema","DivinerConfigSchema","TemporalIndexingDivinerConfigSchema","TemporalIndexingDiviner","IndexingDiviner","configSchema","TemporalIndexingDivinerConfigSchema","configSchemas","IndexingDivinerConfigSchema","DivinerConfigSchema","startHandler","AbstractDiviner","jsonPathToTransformersDictionary","reducePayloads","DivinerConfigSchema","PayloadDivinerQuerySchema","TemporalIndexingDivinerDivinerQueryToIndexQueryDivinerConfigSchema","TemporalIndexingDivinerResultIndexSchema","PayloadBuilder","isPayloadOfSchemaType","TemporalIndexingDivinerDivinerQueryToIndexQueryDiviner","AbstractDiviner","configSchema","TemporalIndexingDivinerDivinerQueryToIndexQueryDivinerConfigSchema","configSchemas","DivinerConfigSchema","labels","_indexableSchemas","_payloadTransformers","divinerQuerySchema","config","PayloadDivinerQuerySchema","indexQuerySchema","indexSchema","TemporalIndexingDivinerResultIndexSchema","indexableSchemas","Object","keys","schemaTransforms","payloadTransformers","jsonPathToTransformersDictionary","defaultValue","destinationField","sourcePathExpression","divineHandler","payloads","queries","filter","isPayloadOfSchemaType","length","results","Promise","all","map","query","fields","reducePayloads","schemas","sources","PayloadBuilder","schema","build","containsAll","assertEx","exists","isBoundWitness","AbstractDiviner","jsonPathToTransformersDictionary","DivinerConfigSchema","TemporalIndexingDivinerIndexCandidateToIndexDivinerConfigSchema","TemporalIndexingDivinerResultIndexSchema","PayloadBuilder","intraBoundwitnessSchemaCombinations","moduleName","TemporalIndexingDivinerIndexCandidateToIndexDiviner","AbstractDiviner","configSchema","TemporalIndexingDivinerIndexCandidateToIndexDivinerConfigSchema","configSchemas","DivinerConfigSchema","labels","_indexableSchemas","_payloadTransformers","indexableSchemas","Object","keys","schemaTransforms","payloadTransformers","jsonPathToTransformersDictionary","assertEx","config","divineHandler","payloads","indexableBoundWitnesses","filter","isBoundWitness","bw","containsAll","payload_schemas","indexablePayloads","p","isIndexablePayload","length","bwDictionary","payloadDictionary","Promise","all","PayloadBuilder","toDataHashMap","validIndexableTuples","bwHash","entries","combinations","intraBoundwitnessSchemaCombinations","combination","map","hash","exists","push","indexes","sourcePayloadHashes","sourcePayloads","indexFields","flatMap","payload","transformers","schema","transform","sources","TemporalIndexingDivinerResultIndexSchema","fields","assign","build","flat","x","includes","isIndexableSchema","AbstractDiviner","DivinerConfigSchema","isPayloadDivinerQueryPayload","TemporalIndexingDivinerIndexQueryResponseToDivinerQueryResponseDivinerConfigSchema","TemporalIndexingDivinerIndexQueryResponseToDivinerQueryResponseDiviner","AbstractDiviner","configSchema","TemporalIndexingDivinerIndexQueryResponseToDivinerQueryResponseDivinerConfigSchema","configSchemas","DivinerConfigSchema","labels","divineHandler","payloads","responses","filter","p","isPayloadDivinerQueryPayload","Promise","resolve","assertEx","exists","ArchivistWrapper","isBoundWitness","AbstractDiviner","BoundWitnessDivinerQuerySchema","DivinerConfigSchema","TemporalIndexingDivinerStateToIndexCandidateDivinerConfigSchema","DivinerWrapper","isModuleState","ModuleStateSchema","PayloadBuilder","intraBoundwitnessSchemaCombinations","TimestampSchema","order","moduleName","TemporalIndexingDivinerStateToIndexCandidateDiviner","AbstractDiviner","configSchema","TemporalIndexingDivinerStateToIndexCandidateDivinerConfigSchema","configSchemas","DivinerConfigSchema","labels","payloadDivinerLimit","config","payload_schemas","schemas","filter","TimestampSchema","divineHandler","payloads","lastState","find","isModuleState","schema","ModuleStateSchema","state","offset","boundWitnessDiviner","getBoundWitnessDivinerForStore","query","PayloadBuilder","BoundWitnessDivinerQuerySchema","fields","limit","build","batch","divine","length","sourceArchivist","getArchivistForStore","indexCandidates","Promise","all","isBoundWitness","map","bw","getPayloadsInBoundWitness","exists","flat","nextState","name","assertEx","payloadStore","archivist","mod","resolve","undefined","ArchivistWrapper","wrap","account","DivinerWrapper","combinations","intraBoundwitnessSchemaCombinations","hashes","Set","get"]}
1
+ {"version":3,"sources":["../../src/Diviner.ts","../../src/DivinerQueryToIndexQueryDiviner/Diviner.ts","../../src/IndexCandidateToIndexDiviner/Diviner.ts","../../src/IndexQueryResponseToDivinerQueryResponseDiviner/Diviner.ts","../../src/StateToIndexCandidateDiviner/Diviner.ts"],"sourcesContent":["import { IndexingDiviner } from '@xyo-network/diviner-indexing-memory'\nimport { IndexingDivinerConfigSchema } from '@xyo-network/diviner-indexing-model'\nimport { DivinerConfigSchema, DivinerModule, DivinerModuleEventData } from '@xyo-network/diviner-model'\nimport { TemporalIndexingDivinerConfigSchema, TemporalIndexingDivinerParams } from '@xyo-network/diviner-temporal-indexing-model'\nimport { Payload } from '@xyo-network/payload-model'\n\nexport class TemporalIndexingDiviner<\n TParams extends TemporalIndexingDivinerParams = TemporalIndexingDivinerParams,\n TIn extends Payload = Payload,\n TOut extends Payload = Payload,\n TEventData extends DivinerModuleEventData<DivinerModule<TParams>, TIn, TOut> = DivinerModuleEventData<DivinerModule<TParams>, TIn, TOut>,\n> extends IndexingDiviner<TParams, TIn, TOut, TEventData> {\n static override readonly configSchema = TemporalIndexingDivinerConfigSchema\n static override readonly configSchemas: string[] = [TemporalIndexingDivinerConfigSchema, IndexingDivinerConfigSchema, DivinerConfigSchema]\n\n protected override async startHandler(): Promise<boolean> {\n await super.startHandler()\n return true\n }\n}\n","import { AbstractDiviner } from '@xyo-network/diviner-abstract'\nimport { jsonPathToTransformersDictionary, reducePayloads } from '@xyo-network/diviner-jsonpath-aggregate-memory'\nimport { SchemaToJsonPathTransformExpressionsDictionary, SchemaToPayloadTransformersDictionary } from '@xyo-network/diviner-jsonpath-model'\nimport { DivinerConfigSchema } from '@xyo-network/diviner-model'\nimport { PayloadDivinerQueryPayload, PayloadDivinerQuerySchema } from '@xyo-network/diviner-payload-model'\nimport {\n TemporalIndexingDivinerDivinerQueryToIndexQueryDivinerConfigSchema,\n TemporalIndexingDivinerDivinerQueryToIndexQueryDivinerParams,\n TemporalIndexingDivinerResultIndexSchema,\n} from '@xyo-network/diviner-temporal-indexing-model'\nimport { Labels } from '@xyo-network/module-model'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport { isPayloadOfSchemaType, Payload } from '@xyo-network/payload-model'\n// TODO: Inherit from JsonPathAggregateDiviner\n/**\n * A diviner that converts diviner query to index query\n */\nexport class TemporalIndexingDivinerDivinerQueryToIndexQueryDiviner<\n TParams extends TemporalIndexingDivinerDivinerQueryToIndexQueryDivinerParams = TemporalIndexingDivinerDivinerQueryToIndexQueryDivinerParams,\n> extends AbstractDiviner<TParams> {\n static override readonly configSchema = TemporalIndexingDivinerDivinerQueryToIndexQueryDivinerConfigSchema\n static override configSchemas = [DivinerConfigSchema, TemporalIndexingDivinerDivinerQueryToIndexQueryDivinerConfigSchema]\n static labels: Labels = {\n 'network.xyo.diviner.stage': 'divinerQueryToIndexQueryDiviner',\n }\n\n private _indexableSchemas: string[] | undefined\n private _payloadTransformers: SchemaToPayloadTransformersDictionary | undefined\n\n /**\n * The schema of the diviner query payloads\n */\n protected get divinerQuerySchema(): string {\n return this.config.divinerQuerySchema ?? PayloadDivinerQuerySchema\n }\n\n /**\n * The schema of the index query payloads\n */\n protected get indexQuerySchema(): string {\n return this.config.indexQuerySchema ?? PayloadDivinerQuerySchema\n }\n\n /**\n * The schema of the index payloads\n */\n protected get indexSchema(): string {\n return this.config.indexSchema ?? TemporalIndexingDivinerResultIndexSchema\n }\n\n /**\n * List of indexable schemas for this diviner\n */\n protected get indexableSchemas(): string[] {\n if (!this._indexableSchemas) this._indexableSchemas = Object.keys(this.schemaTransforms)\n return this._indexableSchemas\n }\n\n /**\n * Dictionary of schemas to payload transformers for creating indexes\n * from the payloads within a Bound Witness\n */\n protected get payloadTransformers(): SchemaToPayloadTransformersDictionary {\n if (!this._payloadTransformers) this._payloadTransformers = jsonPathToTransformersDictionary(this.schemaTransforms)\n return this._payloadTransformers\n }\n\n /**\n * The dictionary of schemas to JSON Path transform expressions for creating indexes\n * from the payloads within a Bound Witness\n */\n protected get schemaTransforms(): SchemaToJsonPathTransformExpressionsDictionary {\n return (\n this.config?.schemaTransforms ?? {\n [this.divinerQuerySchema]: [\n {\n defaultValue: 1,\n destinationField: 'limit',\n sourcePathExpression: '$.limit',\n },\n {\n defaultValue: 0,\n destinationField: 'offset',\n sourcePathExpression: '$.offset',\n },\n {\n defaultValue: 'desc',\n destinationField: 'order',\n sourcePathExpression: '$.order',\n },\n ],\n }\n )\n }\n\n protected override async divineHandler(payloads: Payload[] = []): Promise<Payload[]> {\n const queries = payloads.filter(isPayloadOfSchemaType<PayloadDivinerQueryPayload>(this.divinerQuerySchema))\n if (queries.length > 0) {\n const results = await Promise.all(\n queries.map(async (query) => {\n const fields = await reducePayloads<PayloadDivinerQueryPayload & { sources?: string[] }>(\n [query],\n this.payloadTransformers,\n this.indexQuerySchema,\n )\n // TODO: Make index schema configurable\n fields.schemas = [this.indexSchema]\n // TODO: Make sources not need to be deleted\n delete fields.sources\n // TODO: Add support for additional filters\n return await new PayloadBuilder<Payload>({ schema: this.indexQuerySchema }).fields(fields).build()\n }),\n )\n return results\n }\n return []\n }\n}\n","import { containsAll } from '@xylabs/array'\nimport { assertEx } from '@xylabs/assert'\nimport { exists } from '@xylabs/exists'\nimport { isBoundWitnessWithMeta } from '@xyo-network/boundwitness-model'\nimport { AbstractDiviner } from '@xyo-network/diviner-abstract'\nimport { jsonPathToTransformersDictionary } from '@xyo-network/diviner-jsonpath-aggregate-memory'\nimport { SchemaToJsonPathTransformExpressionsDictionary, SchemaToPayloadTransformersDictionary } from '@xyo-network/diviner-jsonpath-model'\nimport { DivinerConfigSchema } from '@xyo-network/diviner-model'\nimport {\n TemporalIndexingDivinerIndexCandidateToIndexDivinerConfigSchema,\n TemporalIndexingDivinerIndexCandidateToIndexDivinerParams,\n TemporalIndexingDivinerResultIndex,\n TemporalIndexingDivinerResultIndexSchema,\n} from '@xyo-network/diviner-temporal-indexing-model'\nimport { Labels } from '@xyo-network/module-model'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport { isAnyPayload, Payload, PayloadFields } from '@xyo-network/payload-model'\nimport { intraBoundwitnessSchemaCombinations } from '@xyo-network/payload-utils'\n\ntype IndexableHashes = [string, ...string[]]\n\nconst moduleName = 'TemporalIndexingDivinerIndexCandidateToIndexDiviner'\n\n/**\n * Diviner which transforms index candidates to indexes using JSON Path to map\n * source properties in the supplied payloads to destination fields in the\n * resultant index\n */\nexport class TemporalIndexingDivinerIndexCandidateToIndexDiviner<\n TParams extends TemporalIndexingDivinerIndexCandidateToIndexDivinerParams = TemporalIndexingDivinerIndexCandidateToIndexDivinerParams,\n> extends AbstractDiviner<TParams> {\n static override configSchema = TemporalIndexingDivinerIndexCandidateToIndexDivinerConfigSchema\n static override configSchemas = [DivinerConfigSchema, TemporalIndexingDivinerIndexCandidateToIndexDivinerConfigSchema]\n static labels: Labels = {\n 'network.xyo.diviner.stage': 'indexCandidateToIndexDiviner',\n }\n\n private _indexableSchemas: string[] | undefined\n private _payloadTransformers: SchemaToPayloadTransformersDictionary | undefined\n\n /**\n * List of indexable schemas for this diviner\n */\n protected get indexableSchemas(): string[] {\n if (!this._indexableSchemas) this._indexableSchemas = Object.keys(this.schemaTransforms)\n return this._indexableSchemas\n }\n\n /**\n * Dictionary of schemas to payload transformers for creating indexes\n * from the payloads within a Bound Witness\n */\n protected get payloadTransformers(): SchemaToPayloadTransformersDictionary {\n if (!this._payloadTransformers) this._payloadTransformers = jsonPathToTransformersDictionary(this.schemaTransforms)\n return this._payloadTransformers\n }\n\n /**\n * The dictionary of schemas to JSON Path transform expressions for creating indexes\n * from the payloads within a Bound Witness\n */\n protected get schemaTransforms(): SchemaToJsonPathTransformExpressionsDictionary {\n return assertEx(this.config?.schemaTransforms, () => `${moduleName}: Missing config.schemaTransforms section`)\n }\n\n protected override async divineHandler(payloads: Payload[] = []): Promise<Payload[]> {\n const builtPayloads = await Promise.all(payloads.map((payload) => PayloadBuilder.build(payload)))\n // If the Bound Witness does not contain all the required schemas do not index it\n const indexableBoundWitnesses = builtPayloads\n .filter(isBoundWitnessWithMeta)\n .filter((bw) => containsAll(bw.payload_schemas, this.indexableSchemas))\n // If the Payload is not one of the indexable schemas do not index it\n const indexablePayloads = builtPayloads.filter((p) => this.isIndexablePayload(p))\n // If there is nothing to index, return an empty array\n if (indexableBoundWitnesses.length === 0 || indexablePayloads.length === 0) return []\n // Hash all the indexable data once\n const [bwDictionary, payloadDictionary] = await Promise.all([\n PayloadBuilder.toDataHashMap(indexableBoundWitnesses),\n PayloadBuilder.toDataHashMap(indexablePayloads),\n ])\n\n // Initialize the array for validIndexableTuples outside of the loop\n const validIndexableTuples: IndexableHashes[] = []\n\n // Iterate over each entry in bwDictionary\n for (const [bwHash, bw] of Object.entries(bwDictionary)) {\n // Find the combinations of payloads that satisfy the required schemas\n const combinations = intraBoundwitnessSchemaCombinations(bw, this.indexableSchemas)\n\n // Iterate over each combination\n for (const combination of combinations) {\n const indexablePayloads = combination.map((hash) => payloadDictionary[hash]).filter(exists)\n\n // If we found the right amount of indexable payloads (of the correct schema as checked\n // above) in this BW, then index it\n if (indexablePayloads.length === this.indexableSchemas.length) {\n validIndexableTuples.push([bwHash, ...combination])\n }\n }\n }\n\n // Create the indexes from the tuples\n const indexes = await Promise.all(\n validIndexableTuples.map<Promise<TemporalIndexingDivinerResultIndex>>(async ([bwHash, ...sourcePayloadHashes]) => {\n const sourcePayloads = sourcePayloadHashes.map((hash) => payloadDictionary[hash])\n // Use the payload transformers to convert the fields from the source payloads to the destination fields\n const indexFields = sourcePayloads.flatMap<PayloadFields[]>((payload) => {\n // Find the transformers for this payload\n const transformers = this.payloadTransformers[payload.schema]\n // If transformers exist, apply them to the payload otherwise return an empty array\n return transformers ? transformers.map((transform) => transform(payload)) : []\n })\n // Include all the sources for reference\n const sources: string[] = [bwHash, ...sourcePayloadHashes]\n // Build and return the index\n return await new PayloadBuilder<TemporalIndexingDivinerResultIndex>({ schema: TemporalIndexingDivinerResultIndexSchema })\n .fields(Object.assign({ sources }, ...indexFields))\n .build()\n }),\n )\n return indexes.flat()\n }\n\n /**\n * Identifies if a payload is one that is indexed by this diviner\n * @param x The candidate payload\n * @returns True if the payload is one indexed by this diviner, false otherwise\n */\n protected isIndexablePayload = (x: unknown) => {\n return isAnyPayload(x) && this.indexableSchemas.includes(x?.schema)\n }\n\n /**\n * Identifies if a schema is one that is indexed by this diviner\n * @param schema The candidate schema\n * @returns True if this schema is one indexed by this diviner, false otherwise\n */\n protected isIndexableSchema = (schema?: string | null) => {\n return typeof schema === 'string' ? this.indexableSchemas.includes(schema) : false\n }\n}\n","import { AbstractDiviner } from '@xyo-network/diviner-abstract'\nimport { DivinerConfigSchema } from '@xyo-network/diviner-model'\nimport { isPayloadDivinerQueryPayload } from '@xyo-network/diviner-payload-model'\nimport { TemporalIndexingDivinerIndexQueryResponseToDivinerQueryResponseDivinerConfigSchema } from '@xyo-network/diviner-temporal-indexing-model'\nimport { Labels } from '@xyo-network/module-model'\nimport { Payload } from '@xyo-network/payload-model'\n\n/**\n * Transforms an ImageThumbnailIndex response into an ImageThumbnailResponse response\n */\nexport class TemporalIndexingDivinerIndexQueryResponseToDivinerQueryResponseDiviner extends AbstractDiviner {\n static override readonly configSchema = TemporalIndexingDivinerIndexQueryResponseToDivinerQueryResponseDivinerConfigSchema\n static override configSchemas = [DivinerConfigSchema, TemporalIndexingDivinerIndexQueryResponseToDivinerQueryResponseDivinerConfigSchema]\n static labels: Labels = {\n 'network.xyo.diviner.stage': 'indexQueryResponseToDivinerQueryResponseDiviner',\n }\n\n protected override async divineHandler(payloads: Payload[] = []): Promise<Payload[]> {\n // NOTE: We're not doing anything with the query payloads but some diviners\n // might want to use this to transform from the query to the response (for example\n // if we use a plaintext value in the query to generate a hash key in the index)\n // const queries = payloads.filter(isPayloadDivinerQueryPayload)\n const responses = payloads.filter((p) => !isPayloadDivinerQueryPayload(p))\n return await Promise.resolve(responses)\n }\n}\n","import { assertEx } from '@xylabs/assert'\nimport { exists } from '@xylabs/exists'\nimport { ArchivistInstance } from '@xyo-network/archivist-model'\nimport { ArchivistWrapper } from '@xyo-network/archivist-wrapper'\nimport { BoundWitness, isBoundWitnessWithMeta } from '@xyo-network/boundwitness-model'\nimport { AbstractDiviner } from '@xyo-network/diviner-abstract'\nimport { BoundWitnessDivinerQueryPayload, BoundWitnessDivinerQuerySchema } from '@xyo-network/diviner-boundwitness-model'\nimport { IndexingDivinerState } from '@xyo-network/diviner-indexing-model'\nimport { DivinerConfigSchema } from '@xyo-network/diviner-model'\nimport {\n TemporalIndexingDivinerStateToIndexCandidateDivinerConfigSchema,\n TemporalIndexingDivinerStateToIndexCandidateDivinerParams,\n} from '@xyo-network/diviner-temporal-indexing-model'\nimport { DivinerWrapper } from '@xyo-network/diviner-wrapper'\nimport { isModuleState, Labels, ModuleState, ModuleStateSchema } from '@xyo-network/module-model'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport { Payload } from '@xyo-network/payload-model'\nimport { intraBoundwitnessSchemaCombinations } from '@xyo-network/payload-utils'\nimport { TimeStamp, TimestampSchema } from '@xyo-network/witness-timestamp'\n\n/**\n * All Payload types involved in index candidates for indexing\n */\nexport type IndexCandidate = BoundWitness | Payload | TimeStamp\n\n/**\n * The response from the TemporalStateToIndexCandidateDiviner\n */\nexport type TemporalStateToIndexCandidateDivinerResponse = [\n /**\n * The next state of the diviner\n */\n nextState: ModuleState<IndexingDivinerState>,\n /**\n * The index candidates\n */\n ...IndexCandidate[],\n]\n\n/**\n * The default order to search Bound Witnesses to identify index candidates\n */\nconst order = 'asc'\n\n/**\n * The name of the module (for logging purposes)\n */\nconst moduleName = 'TemporalIndexingDivinerStateToIndexCandidateDiviner'\n\n/**\n * Transforms candidates for image thumbnail indexing into their indexed representation\n */\nexport class TemporalIndexingDivinerStateToIndexCandidateDiviner<\n TParams extends TemporalIndexingDivinerStateToIndexCandidateDivinerParams = TemporalIndexingDivinerStateToIndexCandidateDivinerParams,\n> extends AbstractDiviner<TParams> {\n static override readonly configSchema = TemporalIndexingDivinerStateToIndexCandidateDivinerConfigSchema\n static override configSchemas = [DivinerConfigSchema, TemporalIndexingDivinerStateToIndexCandidateDivinerConfigSchema]\n static labels: Labels = {\n 'network.xyo.diviner.stage': 'stateToIndexCandidateDiviner',\n }\n\n get payloadDivinerLimit() {\n return this.config.payloadDivinerLimit ?? 1000\n }\n\n /**\n * The required payload_schemas within BoundWitnesses to identify index candidates\n */\n protected get payload_schemas(): string[] {\n const schemas = this.config.filter?.payload_schemas\n return [TimestampSchema, ...(schemas ?? [])]\n }\n\n protected override async divineHandler(payloads: Payload[] = []): Promise<[ModuleState, ...IndexCandidate[]]> {\n // Retrieve the last state from what was passed in\n const lastState = payloads.find(isModuleState<IndexingDivinerState>)\n // If there is no last state, start from the beginning\n if (!lastState) return [{ schema: ModuleStateSchema, state: { offset: 0 } }]\n // Otherwise, get the last offset\n const { offset } = lastState.state\n // Get next batch of results starting from the offset\n const boundWitnessDiviner = await this.getBoundWitnessDivinerForStore()\n if (!boundWitnessDiviner) return [lastState]\n const query = await new PayloadBuilder<BoundWitnessDivinerQueryPayload>({ schema: BoundWitnessDivinerQuerySchema })\n .fields({ limit: this.payloadDivinerLimit, offset, order, payload_schemas: this.payload_schemas })\n .build()\n const batch = await boundWitnessDiviner.divine([query])\n if (batch.length === 0) return [lastState]\n // Get source data\n const sourceArchivist = await this.getArchivistForStore()\n if (!sourceArchivist) return [lastState]\n const indexCandidates: IndexCandidate[] = (\n await Promise.all(batch.filter(isBoundWitnessWithMeta).map((bw) => this.getPayloadsInBoundWitness(bw, sourceArchivist)))\n )\n .filter(exists)\n .flat()\n const nextState = { schema: ModuleStateSchema, state: { ...lastState.state, offset: offset + batch.length } }\n return [nextState, ...indexCandidates]\n }\n /**\n * Retrieves the archivist for the payloadStore\n * @returns The archivist for the payloadStore or undefined if not resolvable\n */\n protected async getArchivistForStore(): Promise<ArchivistWrapper | undefined> {\n // It should be defined, so we'll error if it's not\n const name: string = assertEx(this.config?.payloadStore?.archivist, () => `${moduleName}: Config for payloadStore.archivist not specified`)\n // It might not be resolvable (yet), so we'll return undefined if it's not\n const mod = await this.resolve(name)\n if (!mod) return undefined\n // Return the wrapped archivist\n return ArchivistWrapper.wrap(mod, this.account)\n }\n\n /**\n * Retrieves the BoundWitness Diviner for the payloadStore\n * @returns The BoundWitness Diviner for the payloadStore or undefined if not resolvable\n */\n protected async getBoundWitnessDivinerForStore(): Promise<DivinerWrapper | undefined> {\n // It should be defined, so we'll error if it's not\n const name: string = assertEx(\n this.config?.payloadStore?.boundWitnessDiviner,\n () => `${moduleName}: Config for payloadStore.boundWitnessDiviner not specified`,\n )\n // It might not be resolvable (yet), so we'll return undefined if it's not\n const mod = await this.resolve(name)\n if (!mod) return undefined\n // Return the wrapped diviner\n return DivinerWrapper.wrap(mod, this.account)\n }\n\n protected async getPayloadsInBoundWitness(bw: BoundWitness, archivist: ArchivistInstance): Promise<IndexCandidate[] | undefined> {\n const combinations = intraBoundwitnessSchemaCombinations(bw, this.payload_schemas).flat()\n if (combinations.length === 0) return undefined\n const hashes = new Set(combinations)\n const indexCandidates = await archivist.get([...hashes])\n return [bw, ...indexCandidates]\n }\n}\n"],"mappings":";;;;AAAA,SAASA,uBAAuB;AAChC,SAASC,mCAAmC;AAC5C,SAASC,2BAAkE;AAC3E,SAASC,2CAA0E;AAG5E,IAAMC,0BAAN,cAKGC,gBAAAA;EAXV,OAWUA;;;EACR,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QAAClB;;AAC9B,UAAMoB,mBACJ,MAAMC,QAAQC,IAAIP,MAAMnB,OAAO2B,uBAAAA,EAAwBC,IAAI,CAACC,OAAO,KAAKC,0BAA0BD,IAAIP,eAAAA,CAAAA,CAAAA,GAErGtB,OAAO+B,OAAAA,EACPC,KAAI;AACP,UAAMC,YAAY;MAAE1B,QAAQC;MAAmBC,OAAO;QAAE,GAAGL,UAAUK;QAAOC,QAAQA,SAASS,MAAME;MAAO;IAAE;AAC5G,WAAO;MAACY;SAAcT;;EACxB;;;;;EAKA,MAAgBD,uBAA8D;AAE5E,UAAMW,OAAeC,UAAS,KAAKtC,QAAQuC,cAAcC,WAAW,MAAM,GAAGjD,WAAAA,mDAA6D;AAE1I,UAAMkD,MAAM,MAAM,KAAKC,QAAQL,IAAAA;AAC/B,QAAI,CAACI;AAAK,aAAOE;AAEjB,WAAOC,iBAAiBC,KAAKJ,KAAK,KAAKK,OAAO;EAChD;;;;;EAMA,MAAgB/B,iCAAsE;AAEpF,UAAMsB,OAAeC,UACnB,KAAKtC,QAAQuC,cAAczB,qBAC3B,MAAM,GAAGvB,WAAAA,6DAAuE;AAGlF,UAAMkD,MAAM,MAAM,KAAKC,QAAQL,IAAAA;AAC/B,QAAI,CAACI;AAAK,aAAOE;AAEjB,WAAOI,eAAeF,KAAKJ,KAAK,KAAKK,OAAO;EAC9C;EAEA,MAAgBb,0BAA0BD,IAAkBQ,WAAqE;AAC/H,UAAMQ,eAAeC,qCAAoCjB,IAAI,KAAK/B,eAAe,EAAEkC,KAAI;AACvF,QAAIa,aAAaxB,WAAW;AAAG,aAAOmB;AACtC,UAAMO,SAAS,IAAIC,IAAIH,YAAAA;AACvB,UAAMrB,kBAAkB,MAAMa,UAAUY,IAAI;SAAIF;KAAO;AACvD,WAAO;MAAClB;SAAOL;;EACjB;AACF;","names":["IndexingDiviner","IndexingDivinerConfigSchema","DivinerConfigSchema","TemporalIndexingDivinerConfigSchema","TemporalIndexingDiviner","IndexingDiviner","configSchema","TemporalIndexingDivinerConfigSchema","configSchemas","IndexingDivinerConfigSchema","DivinerConfigSchema","startHandler","AbstractDiviner","jsonPathToTransformersDictionary","reducePayloads","DivinerConfigSchema","PayloadDivinerQuerySchema","TemporalIndexingDivinerDivinerQueryToIndexQueryDivinerConfigSchema","TemporalIndexingDivinerResultIndexSchema","PayloadBuilder","isPayloadOfSchemaType","TemporalIndexingDivinerDivinerQueryToIndexQueryDiviner","AbstractDiviner","configSchema","TemporalIndexingDivinerDivinerQueryToIndexQueryDivinerConfigSchema","configSchemas","DivinerConfigSchema","labels","_indexableSchemas","_payloadTransformers","divinerQuerySchema","config","PayloadDivinerQuerySchema","indexQuerySchema","indexSchema","TemporalIndexingDivinerResultIndexSchema","indexableSchemas","Object","keys","schemaTransforms","payloadTransformers","jsonPathToTransformersDictionary","defaultValue","destinationField","sourcePathExpression","divineHandler","payloads","queries","filter","isPayloadOfSchemaType","length","results","Promise","all","map","query","fields","reducePayloads","schemas","sources","PayloadBuilder","schema","build","containsAll","assertEx","exists","isBoundWitnessWithMeta","AbstractDiviner","jsonPathToTransformersDictionary","DivinerConfigSchema","TemporalIndexingDivinerIndexCandidateToIndexDivinerConfigSchema","TemporalIndexingDivinerResultIndexSchema","PayloadBuilder","isAnyPayload","intraBoundwitnessSchemaCombinations","moduleName","TemporalIndexingDivinerIndexCandidateToIndexDiviner","AbstractDiviner","configSchema","TemporalIndexingDivinerIndexCandidateToIndexDivinerConfigSchema","configSchemas","DivinerConfigSchema","labels","_indexableSchemas","_payloadTransformers","indexableSchemas","Object","keys","schemaTransforms","payloadTransformers","jsonPathToTransformersDictionary","assertEx","config","divineHandler","payloads","builtPayloads","Promise","all","map","payload","PayloadBuilder","build","indexableBoundWitnesses","filter","isBoundWitnessWithMeta","bw","containsAll","payload_schemas","indexablePayloads","p","isIndexablePayload","length","bwDictionary","payloadDictionary","toDataHashMap","validIndexableTuples","bwHash","entries","combinations","intraBoundwitnessSchemaCombinations","combination","hash","exists","push","indexes","sourcePayloadHashes","sourcePayloads","indexFields","flatMap","transformers","schema","transform","sources","TemporalIndexingDivinerResultIndexSchema","fields","assign","flat","x","isAnyPayload","includes","isIndexableSchema","AbstractDiviner","DivinerConfigSchema","isPayloadDivinerQueryPayload","TemporalIndexingDivinerIndexQueryResponseToDivinerQueryResponseDivinerConfigSchema","TemporalIndexingDivinerIndexQueryResponseToDivinerQueryResponseDiviner","AbstractDiviner","configSchema","TemporalIndexingDivinerIndexQueryResponseToDivinerQueryResponseDivinerConfigSchema","configSchemas","DivinerConfigSchema","labels","divineHandler","payloads","responses","filter","p","isPayloadDivinerQueryPayload","Promise","resolve","assertEx","exists","ArchivistWrapper","isBoundWitnessWithMeta","AbstractDiviner","BoundWitnessDivinerQuerySchema","DivinerConfigSchema","TemporalIndexingDivinerStateToIndexCandidateDivinerConfigSchema","DivinerWrapper","isModuleState","ModuleStateSchema","PayloadBuilder","intraBoundwitnessSchemaCombinations","TimestampSchema","order","moduleName","TemporalIndexingDivinerStateToIndexCandidateDiviner","AbstractDiviner","configSchema","TemporalIndexingDivinerStateToIndexCandidateDivinerConfigSchema","configSchemas","DivinerConfigSchema","labels","payloadDivinerLimit","config","payload_schemas","schemas","filter","TimestampSchema","divineHandler","payloads","lastState","find","isModuleState","schema","ModuleStateSchema","state","offset","boundWitnessDiviner","getBoundWitnessDivinerForStore","query","PayloadBuilder","BoundWitnessDivinerQuerySchema","fields","limit","build","batch","divine","length","sourceArchivist","getArchivistForStore","indexCandidates","Promise","all","isBoundWitnessWithMeta","map","bw","getPayloadsInBoundWitness","exists","flat","nextState","name","assertEx","payloadStore","archivist","mod","resolve","undefined","ArchivistWrapper","wrap","account","DivinerWrapper","combinations","intraBoundwitnessSchemaCombinations","hashes","Set","get"]}
@@ -34,7 +34,7 @@ export declare class TemporalIndexingDivinerIndexCandidateToIndexDiviner<TParams
34
34
  * @param x The candidate payload
35
35
  * @returns True if the payload is one indexed by this diviner, false otherwise
36
36
  */
37
- protected isIndexablePayload: (x: Payload) => boolean;
37
+ protected isIndexablePayload: (x: unknown) => boolean;
38
38
  /**
39
39
  * Identifies if a schema is one that is indexed by this diviner
40
40
  * @param schema The candidate schema
@@ -1 +1 @@
1
- {"version":3,"file":"Diviner.d.ts","sourceRoot":"","sources":["../../../src/IndexCandidateToIndexDiviner/Diviner.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAE/D,OAAO,EAAE,8CAA8C,EAAE,qCAAqC,EAAE,MAAM,qCAAqC,CAAA;AAE3I,OAAO,EAEL,yDAAyD,EAG1D,MAAM,8CAA8C,CAAA;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAElD,OAAO,EAAE,OAAO,EAAiB,MAAM,4BAA4B,CAAA;AAOnE;;;;GAIG;AACH,qBAAa,mDAAmD,CAC9D,OAAO,SAAS,yDAAyD,GAAG,yDAAyD,CACrI,SAAQ,eAAe,CAAC,OAAO,CAAC;IAChC,OAAgB,YAAY,oFAAkE;IAC9F,OAAgB,aAAa,WAAyF;IACtH,MAAM,CAAC,MAAM,EAAE,MAAM,CAEpB;IAED,OAAO,CAAC,iBAAiB,CAAsB;IAC/C,OAAO,CAAC,oBAAoB,CAAmD;IAE/E;;OAEG;IACH,SAAS,KAAK,gBAAgB,IAAI,MAAM,EAAE,CAGzC;IAED;;;OAGG;IACH,SAAS,KAAK,mBAAmB,IAAI,qCAAqC,CAGzE;IAED;;;OAGG;IACH,SAAS,KAAK,gBAAgB,IAAI,8CAA8C,CAE/E;cAEwB,aAAa,CAAC,QAAQ,GAAE,OAAO,EAAO,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAyDpF;;;;OAIG;IACH,SAAS,CAAC,kBAAkB,MAAO,OAAO,aAEzC;IAED;;;;OAIG;IACH,SAAS,CAAC,iBAAiB,YAAa,MAAM,GAAG,IAAI,aAEpD;CACF"}
1
+ {"version":3,"file":"Diviner.d.ts","sourceRoot":"","sources":["../../../src/IndexCandidateToIndexDiviner/Diviner.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAE/D,OAAO,EAAE,8CAA8C,EAAE,qCAAqC,EAAE,MAAM,qCAAqC,CAAA;AAE3I,OAAO,EAEL,yDAAyD,EAG1D,MAAM,8CAA8C,CAAA;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAElD,OAAO,EAAgB,OAAO,EAAiB,MAAM,4BAA4B,CAAA;AAOjF;;;;GAIG;AACH,qBAAa,mDAAmD,CAC9D,OAAO,SAAS,yDAAyD,GAAG,yDAAyD,CACrI,SAAQ,eAAe,CAAC,OAAO,CAAC;IAChC,OAAgB,YAAY,oFAAkE;IAC9F,OAAgB,aAAa,WAAyF;IACtH,MAAM,CAAC,MAAM,EAAE,MAAM,CAEpB;IAED,OAAO,CAAC,iBAAiB,CAAsB;IAC/C,OAAO,CAAC,oBAAoB,CAAmD;IAE/E;;OAEG;IACH,SAAS,KAAK,gBAAgB,IAAI,MAAM,EAAE,CAGzC;IAED;;;OAGG;IACH,SAAS,KAAK,mBAAmB,IAAI,qCAAqC,CAGzE;IAED;;;OAGG;IACH,SAAS,KAAK,gBAAgB,IAAI,8CAA8C,CAE/E;cAEwB,aAAa,CAAC,QAAQ,GAAE,OAAO,EAAO,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IA0DpF;;;;OAIG;IACH,SAAS,CAAC,kBAAkB,MAAO,OAAO,aAEzC;IAED;;;;OAIG;IACH,SAAS,CAAC,iBAAiB,YAAa,MAAM,GAAG,IAAI,aAEpD;CACF"}
@@ -34,7 +34,7 @@ export declare class TemporalIndexingDivinerIndexCandidateToIndexDiviner<TParams
34
34
  * @param x The candidate payload
35
35
  * @returns True if the payload is one indexed by this diviner, false otherwise
36
36
  */
37
- protected isIndexablePayload: (x: Payload) => boolean;
37
+ protected isIndexablePayload: (x: unknown) => boolean;
38
38
  /**
39
39
  * Identifies if a schema is one that is indexed by this diviner
40
40
  * @param schema The candidate schema
@@ -1 +1 @@
1
- {"version":3,"file":"Diviner.d.ts","sourceRoot":"","sources":["../../../src/IndexCandidateToIndexDiviner/Diviner.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAE/D,OAAO,EAAE,8CAA8C,EAAE,qCAAqC,EAAE,MAAM,qCAAqC,CAAA;AAE3I,OAAO,EAEL,yDAAyD,EAG1D,MAAM,8CAA8C,CAAA;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAElD,OAAO,EAAE,OAAO,EAAiB,MAAM,4BAA4B,CAAA;AAOnE;;;;GAIG;AACH,qBAAa,mDAAmD,CAC9D,OAAO,SAAS,yDAAyD,GAAG,yDAAyD,CACrI,SAAQ,eAAe,CAAC,OAAO,CAAC;IAChC,OAAgB,YAAY,oFAAkE;IAC9F,OAAgB,aAAa,WAAyF;IACtH,MAAM,CAAC,MAAM,EAAE,MAAM,CAEpB;IAED,OAAO,CAAC,iBAAiB,CAAsB;IAC/C,OAAO,CAAC,oBAAoB,CAAmD;IAE/E;;OAEG;IACH,SAAS,KAAK,gBAAgB,IAAI,MAAM,EAAE,CAGzC;IAED;;;OAGG;IACH,SAAS,KAAK,mBAAmB,IAAI,qCAAqC,CAGzE;IAED;;;OAGG;IACH,SAAS,KAAK,gBAAgB,IAAI,8CAA8C,CAE/E;cAEwB,aAAa,CAAC,QAAQ,GAAE,OAAO,EAAO,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAyDpF;;;;OAIG;IACH,SAAS,CAAC,kBAAkB,MAAO,OAAO,aAEzC;IAED;;;;OAIG;IACH,SAAS,CAAC,iBAAiB,YAAa,MAAM,GAAG,IAAI,aAEpD;CACF"}
1
+ {"version":3,"file":"Diviner.d.ts","sourceRoot":"","sources":["../../../src/IndexCandidateToIndexDiviner/Diviner.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAE/D,OAAO,EAAE,8CAA8C,EAAE,qCAAqC,EAAE,MAAM,qCAAqC,CAAA;AAE3I,OAAO,EAEL,yDAAyD,EAG1D,MAAM,8CAA8C,CAAA;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAElD,OAAO,EAAgB,OAAO,EAAiB,MAAM,4BAA4B,CAAA;AAOjF;;;;GAIG;AACH,qBAAa,mDAAmD,CAC9D,OAAO,SAAS,yDAAyD,GAAG,yDAAyD,CACrI,SAAQ,eAAe,CAAC,OAAO,CAAC;IAChC,OAAgB,YAAY,oFAAkE;IAC9F,OAAgB,aAAa,WAAyF;IACtH,MAAM,CAAC,MAAM,EAAE,MAAM,CAEpB;IAED,OAAO,CAAC,iBAAiB,CAAsB;IAC/C,OAAO,CAAC,oBAAoB,CAAmD;IAE/E;;OAEG;IACH,SAAS,KAAK,gBAAgB,IAAI,MAAM,EAAE,CAGzC;IAED;;;OAGG;IACH,SAAS,KAAK,mBAAmB,IAAI,qCAAqC,CAGzE;IAED;;;OAGG;IACH,SAAS,KAAK,gBAAgB,IAAI,8CAA8C,CAE/E;cAEwB,aAAa,CAAC,QAAQ,GAAE,OAAO,EAAO,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IA0DpF;;;;OAIG;IACH,SAAS,CAAC,kBAAkB,MAAO,OAAO,aAEzC;IAED;;;;OAIG;IACH,SAAS,CAAC,iBAAiB,YAAa,MAAM,GAAG,IAAI,aAEpD;CACF"}
@@ -34,7 +34,7 @@ export declare class TemporalIndexingDivinerIndexCandidateToIndexDiviner<TParams
34
34
  * @param x The candidate payload
35
35
  * @returns True if the payload is one indexed by this diviner, false otherwise
36
36
  */
37
- protected isIndexablePayload: (x: Payload) => boolean;
37
+ protected isIndexablePayload: (x: unknown) => boolean;
38
38
  /**
39
39
  * Identifies if a schema is one that is indexed by this diviner
40
40
  * @param schema The candidate schema
@@ -1 +1 @@
1
- {"version":3,"file":"Diviner.d.ts","sourceRoot":"","sources":["../../../src/IndexCandidateToIndexDiviner/Diviner.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAE/D,OAAO,EAAE,8CAA8C,EAAE,qCAAqC,EAAE,MAAM,qCAAqC,CAAA;AAE3I,OAAO,EAEL,yDAAyD,EAG1D,MAAM,8CAA8C,CAAA;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAElD,OAAO,EAAE,OAAO,EAAiB,MAAM,4BAA4B,CAAA;AAOnE;;;;GAIG;AACH,qBAAa,mDAAmD,CAC9D,OAAO,SAAS,yDAAyD,GAAG,yDAAyD,CACrI,SAAQ,eAAe,CAAC,OAAO,CAAC;IAChC,OAAgB,YAAY,oFAAkE;IAC9F,OAAgB,aAAa,WAAyF;IACtH,MAAM,CAAC,MAAM,EAAE,MAAM,CAEpB;IAED,OAAO,CAAC,iBAAiB,CAAsB;IAC/C,OAAO,CAAC,oBAAoB,CAAmD;IAE/E;;OAEG;IACH,SAAS,KAAK,gBAAgB,IAAI,MAAM,EAAE,CAGzC;IAED;;;OAGG;IACH,SAAS,KAAK,mBAAmB,IAAI,qCAAqC,CAGzE;IAED;;;OAGG;IACH,SAAS,KAAK,gBAAgB,IAAI,8CAA8C,CAE/E;cAEwB,aAAa,CAAC,QAAQ,GAAE,OAAO,EAAO,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAyDpF;;;;OAIG;IACH,SAAS,CAAC,kBAAkB,MAAO,OAAO,aAEzC;IAED;;;;OAIG;IACH,SAAS,CAAC,iBAAiB,YAAa,MAAM,GAAG,IAAI,aAEpD;CACF"}
1
+ {"version":3,"file":"Diviner.d.ts","sourceRoot":"","sources":["../../../src/IndexCandidateToIndexDiviner/Diviner.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAE/D,OAAO,EAAE,8CAA8C,EAAE,qCAAqC,EAAE,MAAM,qCAAqC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