@xyo-network/diviner-temporal-indexing-memory 2.84.5 → 2.84.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/dist/browser/IndexCandidateToIndexDiviner/Diviner.d.cts.map +1 -1
  2. package/dist/browser/IndexCandidateToIndexDiviner/Diviner.d.mts.map +1 -1
  3. package/dist/browser/IndexCandidateToIndexDiviner/Diviner.d.ts.map +1 -1
  4. package/dist/browser/IndexCandidateToIndexDiviner/_Diviner.d.cts.map +1 -1
  5. package/dist/browser/IndexCandidateToIndexDiviner/_Diviner.d.mts.map +1 -1
  6. package/dist/browser/IndexCandidateToIndexDiviner/_Diviner.d.ts.map +1 -1
  7. package/dist/browser/index.cjs +12 -12
  8. package/dist/browser/index.cjs.map +1 -1
  9. package/dist/browser/index.js +12 -12
  10. package/dist/browser/index.js.map +1 -1
  11. package/dist/browser/jsonpath/reducePayloads.d.cts.map +1 -1
  12. package/dist/browser/jsonpath/reducePayloads.d.mts.map +1 -1
  13. package/dist/browser/jsonpath/reducePayloads.d.ts.map +1 -1
  14. package/dist/node/IndexCandidateToIndexDiviner/Diviner.d.cts.map +1 -1
  15. package/dist/node/IndexCandidateToIndexDiviner/Diviner.d.mts.map +1 -1
  16. package/dist/node/IndexCandidateToIndexDiviner/Diviner.d.ts.map +1 -1
  17. package/dist/node/IndexCandidateToIndexDiviner/_Diviner.d.cts.map +1 -1
  18. package/dist/node/IndexCandidateToIndexDiviner/_Diviner.d.mts.map +1 -1
  19. package/dist/node/IndexCandidateToIndexDiviner/_Diviner.d.ts.map +1 -1
  20. package/dist/node/index.cjs +12 -12
  21. package/dist/node/index.cjs.map +1 -1
  22. package/dist/node/index.js +12 -12
  23. package/dist/node/index.js.map +1 -1
  24. package/dist/node/jsonpath/reducePayloads.d.cts.map +1 -1
  25. package/dist/node/jsonpath/reducePayloads.d.mts.map +1 -1
  26. package/dist/node/jsonpath/reducePayloads.d.ts.map +1 -1
  27. package/package.json +26 -26
  28. package/src/DivinerQueryToIndexQueryDiviner/Diviner.ts +3 -3
  29. package/src/IndexCandidateToIndexDiviner/Diviner.ts +11 -12
  30. package/src/IndexCandidateToIndexDiviner/_Diviner.ts +11 -12
  31. package/src/StateToIndexCandidateDiviner/Diviner.ts +2 -2
  32. package/src/jsonpath/reducePayloads.ts +6 -8
@@ -1 +1 @@
1
- {"version":3,"file":"Diviner.d.ts","sourceRoot":"","sources":["../../../src/IndexCandidateToIndexDiviner/Diviner.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,EAAE,YAAY,EAAkB,MAAM,iCAAiC,CAAA;AAE9E,OAAO,EACL,8CAA8C,EAC9C,qCAAqC,EAErC,yDAAyD,EAG1D,MAAM,8CAA8C,CAAA;AAErD,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAElD,OAAO,EAAE,OAAO,EAAiB,MAAM,4BAA4B,CAAA;AAInE,MAAM,MAAM,iBAAiB,GAAG,CAAC,YAAY,EAAE,GAAG,OAAO,EAAE,CAAC,CAAA;AAI5D;;;;GAIG;AACH,qBAAa,mDAAmD,CAC9D,OAAO,SAAS,yDAAyD,GAAG,yDAAyD,CACrI,SAAQ,eAAe,CAAC,OAAO,CAAC;IAChC,OAAgB,YAAY,oFAAkE;IAC9F,OAAgB,aAAa,uHAAyF;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,O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M,GAAG,IAAI,aAEpD;CACF"}
1
+ {"version":3,"file":"Diviner.d.ts","sourceRoot":"","sources":["../../../src/IndexCandidateToIndexDiviner/Diviner.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,EAAE,YAAY,EAAkB,MAAM,iCAAiC,CAAA;AAE9E,OAAO,EACL,8CAA8C,EAC9C,qCAAqC,EAErC,yDAAyD,EAG1D,MAAM,8CAA8C,CAAA;AAErD,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAElD,OAAO,EAAE,OAAO,EAAiB,MAAM,4BAA4B,CAAA;AAInE,MAAM,MAAM,iBAAiB,GAAG,CAAC,YAAY,EAAE,GAAG,OAAO,EAAE,CAAC,CAAA;AAI5D;;;;GAIG;AACH,qBAAa,mDAAmD,CAC9D,OAAO,SAAS,yDAAyD,GAAG,yDAAyD,CACrI,SAAQ,eAAe,CAAC,OAAO,CAAC;IAChC,OAAgB,YAAY,oFAAkE;IAC9F,OAAgB,aAAa,uHAAyF;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;IAyCpF;;;;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/IndexCandidateToIndexDiviner/Diviner.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,EAAE,YAAY,EAAkB,MAAM,iCAAiC,CAAA;AAE9E,OAAO,EACL,8CAA8C,EAC9C,qCAAqC,EAErC,yDAAyD,EAG1D,MAAM,8CAA8C,CAAA;AAErD,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAElD,OAAO,EAAE,OAAO,EAAiB,MAAM,4BAA4B,CAAA;AAInE,MAAM,MAAM,iBAAiB,GAAG,CAAC,YAAY,EAAE,GAAG,OAAO,EAAE,CAAC,CAAA;AAI5D;;;;GAIG;AACH,qBAAa,mDAAmD,CAC9D,OAAO,SAAS,yDAAyD,GAAG,yDAAyD,CACrI,SAAQ,eAAe,CAAC,OAAO,CAAC;IAChC,OAAgB,YAAY,oFAAkE;IAC9F,OAAgB,aAAa,uHAAyF;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;IA0CpF;;;;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":"AAGA,OAAO,EAAE,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A;AAE9E,OAAO,EACL,8CAA8C,EAC9C,qCAAqC,EAErC,yDAAyD,EAG1D,MAAM,8CAA8C,CAAA;AAErD,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAElD,OAAO,EAAE,OAAO,EAAiB,MAAM,4BAA4B,CAAA;AACnE,OAAO,EAAe,SAAS,EAAmB,MAAM,gCAAgC,CAAA;AAIxF,MAAM,MAAM,iBAAiB,GAAG,CAAC,YAAY,EAAE,SAAS,EAAE,GAAG,OAAO,EAAE,CAAC,CAAA;AAIvE;;;;GAIG;AACH,qBAAa,mDAAmD,CAC9D,OAAO,SAAS,yDAAyD,GAAG,yDAAyD,CACrI,SAAQ,eAAe,CAAC,OAAO,CAAC;IAChC,OAAgB,YAAY,oFAAkE;IAC9F,OAAgB,aAAa,uHAAyF;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;IAgDpF;;;;OAIG;IACH,SAAS,CAAC,kBAAkB,MAAO,OAAO,aAEzC;IAED;;;;OAIG;IACH,SAAS,CAAC,iBAAiB,YAAa,MAAM,GAAG,IAAI,aAEpD;CACF"}
@@ -89,10 +89,10 @@ var jsonPathToTransformersDictionary = (schemaTransforms) => {
89
89
  var import_hash = require("@xyo-network/hash");
90
90
  var import_payload_builder = require("@xyo-network/payload-builder");
91
91
  var reducePayloads = async (payloads, payloadTransformers, destinationSchema) => {
92
- const indexFields = payloads.map((payload) => {
92
+ const indexFields = payloads.flatMap((payload) => {
93
93
  const transformers = payloadTransformers[payload.schema];
94
94
  return transformers ? transformers.map((transform) => transform(payload)) : [];
95
- }).flat();
95
+ });
96
96
  const sources = (await import_hash.PayloadHasher.hashPairs([...payloads])).map(([, hash]) => hash);
97
97
  return await new import_payload_builder.PayloadBuilder({ schema: destinationSchema }).fields(Object.assign({ sources }, ...indexFields)).build();
98
98
  };
@@ -129,7 +129,7 @@ var TemporalIndexingDivinerDivinerQueryToIndexQueryDiviner = class extends impor
129
129
  */
130
130
  get indexableSchemas() {
131
131
  if (!this._indexableSchemas)
132
- this._indexableSchemas = [...Object.keys(this.schemaTransforms)];
132
+ this._indexableSchemas = Object.keys(this.schemaTransforms);
133
133
  return this._indexableSchemas;
134
134
  }
135
135
  /**
@@ -169,7 +169,7 @@ var TemporalIndexingDivinerDivinerQueryToIndexQueryDiviner = class extends impor
169
169
  }
170
170
  async divineHandler(payloads = []) {
171
171
  const queries = payloads.filter((0, import_payload_model.isPayloadOfSchemaType)(this.divinerQuerySchema));
172
- if (queries.length) {
172
+ if (queries.length > 0) {
173
173
  const results = await Promise.all(
174
174
  queries.map(async (query) => {
175
175
  const fields = await reducePayloads(
@@ -184,7 +184,7 @@ var TemporalIndexingDivinerDivinerQueryToIndexQueryDiviner = class extends impor
184
184
  );
185
185
  return results;
186
186
  }
187
- return Promise.resolve([]);
187
+ return [];
188
188
  }
189
189
  };
190
190
 
@@ -212,7 +212,7 @@ var TemporalIndexingDivinerIndexCandidateToIndexDiviner = class extends import_a
212
212
  */
213
213
  get indexableSchemas() {
214
214
  if (!this._indexableSchemas)
215
- this._indexableSchemas = [...Object.keys(this.schemaTransforms)];
215
+ this._indexableSchemas = Object.keys(this.schemaTransforms);
216
216
  return this._indexableSchemas;
217
217
  }
218
218
  /**
@@ -235,7 +235,7 @@ var TemporalIndexingDivinerIndexCandidateToIndexDiviner = class extends import_a
235
235
  async divineHandler(payloads = []) {
236
236
  const bws = payloads.filter(import_boundwitness_model.isBoundWitness);
237
237
  const indexablePayloads = payloads.filter((p) => this.isIndexablePayload(p));
238
- if (bws.length && indexablePayloads.length) {
238
+ if (bws.length > 0 && indexablePayloads.length > 0) {
239
239
  const payloadDictionary = await import_hash2.PayloadHasher.toMap(payloads);
240
240
  const validIndexableTuples = bws.reduce((indexableTuples, bw) => {
241
241
  if (!(0, import_array.containsAll)(bw.payload_schemas, this.indexableSchemas))
@@ -252,17 +252,17 @@ var TemporalIndexingDivinerIndexCandidateToIndexDiviner = class extends import_a
252
252
  }, []);
253
253
  const indexes = await Promise.all(
254
254
  validIndexableTuples.map(async ([bw, ...sourcePayloads]) => {
255
- const indexFields = sourcePayloads.map((payload) => {
255
+ const indexFields = sourcePayloads.flatMap((payload) => {
256
256
  const transformers = this.payloadTransformers[payload.schema];
257
257
  return transformers ? transformers.map((transform) => transform(payload)) : [];
258
- }).flat();
258
+ });
259
259
  const sources = Object.keys(await import_hash2.PayloadHasher.toMap([bw, ...sourcePayloads]));
260
260
  return await new import_payload_builder3.PayloadBuilder({ schema: import_diviner_temporal_indexing_model3.TemporalIndexingDivinerResultIndexSchema }).fields(Object.assign({ sources }, ...indexFields)).build();
261
261
  })
262
262
  );
263
263
  return indexes.flat();
264
264
  }
265
- return Promise.resolve([]);
265
+ return [];
266
266
  }
267
267
  /**
268
268
  * Identifies if a payload is one that is indexed by this diviner
@@ -278,7 +278,7 @@ var TemporalIndexingDivinerIndexCandidateToIndexDiviner = class extends import_a
278
278
  * @returns True if this schema is one indexed by this diviner, false otherwise
279
279
  */
280
280
  isIndexableSchema = (schema) => {
281
- return this.indexableSchemas.some((s) => s === schema);
281
+ return typeof schema === "string" ? this.indexableSchemas.includes(schema) : false;
282
282
  };
283
283
  };
284
284
 
@@ -390,7 +390,7 @@ var TemporalIndexingDivinerStateToIndexCandidateDiviner = class extends import_a
390
390
  const results = await archivist.get(hashes);
391
391
  const indexCandidateIdentityFunctions = this.payload_schemas.map(import_payload_model2.isPayloadOfSchemaType);
392
392
  const filteredResults = indexCandidateIdentityFunctions.map((is) => results.find(is));
393
- if (filteredResults.some((f) => f === void 0))
393
+ if (filteredResults.includes(void 0))
394
394
  return void 0;
395
395
  const indexCandidates = filteredResults.filter(import_exists2.exists);
396
396
  return [bw, ...indexCandidates];
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts","../../src/Diviner.ts","../../src/DivinerQueryToIndexQueryDiviner/Diviner.ts","../../src/jsonpath/toPayloadTransformer.ts","../../src/jsonpath/jsonPathToTransformersDictionary.ts","../../src/jsonpath/reducePayloads.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/abstract-diviner'\nimport { DivinerConfigSchema } from '@xyo-network/diviner-model'\nimport { PayloadDivinerQueryPayload, PayloadDivinerQuerySchema } from '@xyo-network/diviner-payload-model'\nimport {\n SchemaToJsonPathTransformExpressionsDictionary,\n SchemaToPayloadTransformersDictionary,\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\nimport { jsonPathToTransformersDictionary, reducePayloads } from '../jsonpath'\n\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) {\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 Promise.resolve([])\n }\n}\n","import { JsonPathTransformExpression, PayloadTransformer } from '@xyo-network/diviner-temporal-indexing-model'\nimport { Payload } from '@xyo-network/payload-model'\nimport jsonpath from 'jsonpath'\n\n/**\n * Converts a JSON Path transform expression to a payload transformer\n * @param transformExpression The transform expression to convert\n * @returns The payload transformer for the JSON Path transform expression\n */\nexport const toPayloadTransformer = (transformExpression: JsonPathTransformExpression) => {\n const { defaultValue, destinationField, sourcePathExpression } = transformExpression\n const transformer: PayloadTransformer = (x: Payload) => {\n // eslint-disable-next-line import/no-named-as-default-member\n const source = jsonpath.value(x, sourcePathExpression)\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const transformed = {} as { [key: string]: any }\n // Assign the source value to the destination field or the default value if the source is undefined\n const destinationValue = source === undefined ? defaultValue : source\n if (destinationValue !== undefined) transformed[destinationField] = destinationValue\n return transformed\n }\n return transformer\n}\n","import { SchemaToJsonPathTransformExpressionsDictionary, SchemaToPayloadTransformersDictionary } from '@xyo-network/diviner-temporal-indexing-model'\n\nimport { toPayloadTransformer } from './toPayloadTransformer'\n\n/**\n * Materializes the JSON-path expressions into memoized functions by converting a\n * dictionary of schema to JSON Path transform expressions to a dictionary\n * of schema to payload transformers\n * @param schemaTransforms The schema transforms to convert\n * @returns A dictionary of schema to payload transformers\n */\nexport const jsonPathToTransformersDictionary = (\n schemaTransforms: SchemaToJsonPathTransformExpressionsDictionary,\n): SchemaToPayloadTransformersDictionary => {\n return Object.fromEntries(\n Object.entries(schemaTransforms).map(([schema, jsonPathTransformerExpressions]) => {\n const transformers = jsonPathTransformerExpressions.map(toPayloadTransformer)\n return [schema, transformers]\n }),\n )\n}\n","import { SchemaToPayloadTransformersDictionary } from '@xyo-network/diviner-temporal-indexing-model'\nimport { PayloadHasher } from '@xyo-network/hash'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport { Payload, PayloadFields } from '@xyo-network/payload-model'\n\n/**\n * Reduces the payloads to a single payload using the supplied transformers\n * @param payloads The payloads to reduce\n * @param payloadTransformers The transformers to use to convert the payloads to the destination payload\n * @param destinationSchema The schema of the destination payload\n * @returns The reduced payload\n */\nexport const reducePayloads = async <T extends Payload = Payload>(\n payloads: Payload[],\n payloadTransformers: SchemaToPayloadTransformersDictionary,\n destinationSchema: string,\n): Promise<T> => {\n // Use the payload transformers to convert the fields from the source payloads to the destination fields\n const indexFields = payloads\n .map<PayloadFields[]>((payload) => {\n // Find the transformers for this payload\n const transformers = 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 .flat()\n // Include all the sources for reference\n const sources = (await PayloadHasher.hashPairs([...payloads])).map(([, hash]) => hash)\n // Build and return the index\n return await new PayloadBuilder<T>({ schema: destinationSchema }).fields(Object.assign({ sources }, ...indexFields)).build()\n}\n\n/**\n * Reduces the arrays of payload arrays to an array of payloads using the supplied transformers\n * @param payloadsArray The arrays of payloads to reduce\n * @param payloadTransformers The transformers to use to convert the payloads to the destination payloads\n * @param destinationSchema The schema of the destination payloads\n * @returns The reduced payloads\n */\nexport const reducePayloadsArray = async <T extends Payload = Payload>(\n payloadsArray: Payload[][],\n payloadTransformers: SchemaToPayloadTransformersDictionary,\n destinationSchema: string,\n): Promise<T[]> => {\n return await Promise.all(\n payloadsArray.map(async (payloads) => {\n return await reducePayloads<T>(payloads, payloadTransformers, destinationSchema)\n }),\n )\n}\n","import { containsAll } from '@xylabs/array'\nimport { assertEx } from '@xylabs/assert'\nimport { exists } from '@xylabs/exists'\nimport { AbstractDiviner } from '@xyo-network/abstract-diviner'\nimport { BoundWitness, isBoundWitness } from '@xyo-network/boundwitness-model'\nimport { DivinerConfigSchema } from '@xyo-network/diviner-model'\nimport {\n SchemaToJsonPathTransformExpressionsDictionary,\n SchemaToPayloadTransformersDictionary,\n TemporalIndexingDivinerIndexCandidateToIndexDivinerConfigSchema,\n TemporalIndexingDivinerIndexCandidateToIndexDivinerParams,\n TemporalIndexingDivinerResultIndex,\n TemporalIndexingDivinerResultIndexSchema,\n} from '@xyo-network/diviner-temporal-indexing-model'\nimport { PayloadHasher } from '@xyo-network/hash'\nimport { Labels } from '@xyo-network/module-model'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport { Payload, PayloadFields } from '@xyo-network/payload-model'\n\nimport { jsonPathToTransformersDictionary } from '../jsonpath'\n\nexport type IndexablePayloads = [BoundWitness, ...Payload[]]\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 bws: BoundWitness[] = payloads.filter(isBoundWitness)\n const indexablePayloads: Payload[] = payloads.filter((p) => this.isIndexablePayload(p))\n if (bws.length && indexablePayloads.length) {\n const payloadDictionary = await PayloadHasher.toMap(payloads)\n const validIndexableTuples: IndexablePayloads[] = bws.reduce<IndexablePayloads[]>((indexableTuples, bw) => {\n // If this Bound Witness doesn't contain all the required schemas don't index it\n if (!containsAll(bw.payload_schemas, this.indexableSchemas)) return indexableTuples\n // Find the remaining indexable payloads\n const indexablePayloadPositions = this.indexableSchemas.map((schema) => bw.payload_schemas.indexOf(schema))\n const indexablePayloadHashes = indexablePayloadPositions.map((index) => bw.payload_hashes?.[index])\n const indexablePayloads = indexablePayloadHashes.map((hash) => payloadDictionary[hash]).filter(exists)\n // If we found a timestamp and the right amount of indexable payloads (of the\n // correct schema as checked above) in this BW, then index it\n if (indexablePayloads.length === this.indexableSchemas.length) indexableTuples.push([bw, ...indexablePayloads])\n return indexableTuples\n }, [])\n // Create the indexes from the tuples\n const indexes = await Promise.all(\n validIndexableTuples.map<Promise<TemporalIndexingDivinerResultIndex>>(async ([bw, ...sourcePayloads]) => {\n // Use the payload transformers to convert the fields from the source payloads to the destination fields\n const indexFields = sourcePayloads\n .map<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 .flat()\n // Include all the sources for reference\n const sources = Object.keys(await PayloadHasher.toMap([bw, ...sourcePayloads]))\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 return Promise.resolve([])\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 this.indexableSchemas.some((s) => s === schema)\n }\n}\n","import { AbstractDiviner } from '@xyo-network/abstract-diviner'\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 { AbstractDiviner } from '@xyo-network/abstract-diviner'\nimport { ArchivistInstance } from '@xyo-network/archivist-model'\nimport { ArchivistWrapper } from '@xyo-network/archivist-wrapper'\nimport { BoundWitness, isBoundWitness } from '@xyo-network/boundwitness-model'\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 { isPayloadOfSchemaType, Payload } from '@xyo-network/payload-model'\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 ?? 1_000\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 indexes = this.payload_schemas.map((schema) => bw.payload_schemas?.findIndex((s) => s === schema))\n const hashes = indexes.map((index) => bw.payload_hashes?.[index])\n const results = await archivist.get(hashes)\n const indexCandidateIdentityFunctions = this.payload_schemas.map(isPayloadOfSchemaType)\n const filteredResults = indexCandidateIdentityFunctions.map((is) => results.find(is))\n if (filteredResults.some((f) => f === undefined)) return undefined\n const indexCandidates: IndexCandidate[] = filteredResults.filter(exists) as IndexCandidate[]\n return [bw, ...indexCandidates]\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,qCAAgC;AAChC,oCAA4C;AAC5C,2BAA2E;AAC3E,6CAAmF;AAG5E,IAAM,0BAAN,cAKG,+CAAgD;AAAA,EACxD,OAAyB,eAAe;AAAA,EACxC,OAAyB,gBAA0B,CAAC,4EAAqC,2DAA6B,wCAAmB;AAAA,EAEzI,MAAyB,eAAiC;AACxD,UAAM,MAAM,aAAa;AACzB,WAAO;AAAA,EACT;AACF;;;ACnBA,8BAAgC;AAChC,IAAAA,wBAAoC;AACpC,mCAAsE;AACtE,IAAAC,0CAMO;AAEP,IAAAC,0BAA+B;AAC/B,2BAA+C;;;ACV/C,sBAAqB;AAOd,IAAM,uBAAuB,CAAC,wBAAqD;AACxF,QAAM,EAAE,cAAc,kBAAkB,qBAAqB,IAAI;AACjE,QAAM,cAAkC,CAAC,MAAe;AAEtD,UAAM,SAAS,gBAAAC,QAAS,MAAM,GAAG,oBAAoB;AAErD,UAAM,cAAc,CAAC;AAErB,UAAM,mBAAmB,WAAW,SAAY,eAAe;AAC/D,QAAI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QAAI,CAAC;AAAK,aAAO;AAEjB,WAAO,0CAAiB,KAAK,KAAK,KAAK,OAAO;AAAA,EAChD;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,MAAgB,iCAAsE;AApHxF;AAsHI,UAAM,WAAe;AAAA,OACnB,gBAAK,WAAL,mBAAa,iBAAb,mBAA2B;AAAA,MAC3B,MAAM,GAAGA,WAAU;AAAA,IACrB;AAEA,UAAM,MAAM,MAAM,KAAK,QAAQ,IAAI;AACnC,QAAI,CAAC;AAAK,aAAO;AAEjB,WAAO,sCAAe,KAAK,KAAK,KAAK,OAAO;AAAA,EAC9C;AAAA,EAEA,MAAgB,0BAA0B,IAAkB,WAAqE;AAC/H,UAAM,UAAU,KAAK,gBAAgB,IAAI,CAAC,WAAQ;AAlItD;AAkIyD,sBAAG,oBAAH,mBAAoB,UAAU,CAAC,MAAM,MAAM;AAAA,KAAO;AACvG,UAAM,SAAS,QAAQ,IAAI,CAAC,UAAO;AAnIvC;AAmI0C,sBAAG,mBAAH,mBAAoB;AAAA,KAAM;AAChE,UAAM,UAAU,MAAM,UAAU,IAAI,MAAM;AAC1C,UAAM,kCAAkC,KAAK,gBAAgB,IAAI,2CAAqB;AACtF,UAAM,kBAAkB,gCAAgC,IAAI,CAAC,OAAO,QAAQ,KAAK,EAAE,CAAC;AACpF,QAAI,gBAAgB,KAAK,CAAC,MAAM,MAAM,MAAS;AAAG,aAAO;AACzD,UAAM,kBAAoC,gBAAgB,OAAO,qBAAM;AACvE,WAAO,CAAC,IAAI,GAAG,eAAe;AAAA,EAChC;AACF;","names":["import_diviner_model","import_diviner_temporal_indexing_model","import_payload_builder","jsonpath","import_abstract_diviner","import_diviner_model","import_diviner_temporal_indexing_model","import_hash","import_payload_builder","indexablePayloads","import_abstract_diviner","import_diviner_model","import_diviner_payload_model","import_diviner_temporal_indexing_model","import_assert","import_exists","import_abstract_diviner","import_boundwitness_model","import_diviner_model","import_diviner_temporal_indexing_model","import_payload_builder","import_payload_model","moduleName"]}
1
+ {"version":3,"sources":["../../src/index.ts","../../src/Diviner.ts","../../src/DivinerQueryToIndexQueryDiviner/Diviner.ts","../../src/jsonpath/toPayloadTransformer.ts","../../src/jsonpath/jsonPathToTransformersDictionary.ts","../../src/jsonpath/reducePayloads.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/abstract-diviner'\nimport { DivinerConfigSchema } from '@xyo-network/diviner-model'\nimport { PayloadDivinerQueryPayload, PayloadDivinerQuerySchema } from '@xyo-network/diviner-payload-model'\nimport {\n SchemaToJsonPathTransformExpressionsDictionary,\n SchemaToPayloadTransformersDictionary,\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\nimport { jsonPathToTransformersDictionary, reducePayloads } from '../jsonpath'\n\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 { JsonPathTransformExpression, PayloadTransformer } from '@xyo-network/diviner-temporal-indexing-model'\nimport { Payload } from '@xyo-network/payload-model'\nimport jsonpath from 'jsonpath'\n\n/**\n * Converts a JSON Path transform expression to a payload transformer\n * @param transformExpression The transform expression to convert\n * @returns The payload transformer for the JSON Path transform expression\n */\nexport const toPayloadTransformer = (transformExpression: JsonPathTransformExpression) => {\n const { defaultValue, destinationField, sourcePathExpression } = transformExpression\n const transformer: PayloadTransformer = (x: Payload) => {\n // eslint-disable-next-line import/no-named-as-default-member\n const source = jsonpath.value(x, sourcePathExpression)\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const transformed = {} as { [key: string]: any }\n // Assign the source value to the destination field or the default value if the source is undefined\n const destinationValue = source === undefined ? defaultValue : source\n if (destinationValue !== undefined) transformed[destinationField] = destinationValue\n return transformed\n }\n return transformer\n}\n","import { SchemaToJsonPathTransformExpressionsDictionary, SchemaToPayloadTransformersDictionary } from '@xyo-network/diviner-temporal-indexing-model'\n\nimport { toPayloadTransformer } from './toPayloadTransformer'\n\n/**\n * Materializes the JSON-path expressions into memoized functions by converting a\n * dictionary of schema to JSON Path transform expressions to a dictionary\n * of schema to payload transformers\n * @param schemaTransforms The schema transforms to convert\n * @returns A dictionary of schema to payload transformers\n */\nexport const jsonPathToTransformersDictionary = (\n schemaTransforms: SchemaToJsonPathTransformExpressionsDictionary,\n): SchemaToPayloadTransformersDictionary => {\n return Object.fromEntries(\n Object.entries(schemaTransforms).map(([schema, jsonPathTransformerExpressions]) => {\n const transformers = jsonPathTransformerExpressions.map(toPayloadTransformer)\n return [schema, transformers]\n }),\n )\n}\n","import { SchemaToPayloadTransformersDictionary } from '@xyo-network/diviner-temporal-indexing-model'\nimport { PayloadHasher } from '@xyo-network/hash'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport { Payload, PayloadFields } from '@xyo-network/payload-model'\n\n/**\n * Reduces the payloads to a single payload using the supplied transformers\n * @param payloads The payloads to reduce\n * @param payloadTransformers The transformers to use to convert the payloads to the destination payload\n * @param destinationSchema The schema of the destination payload\n * @returns The reduced payload\n */\nexport const reducePayloads = async <T extends Payload = Payload>(\n payloads: Payload[],\n payloadTransformers: SchemaToPayloadTransformersDictionary,\n destinationSchema: string,\n): Promise<T> => {\n // Use the payload transformers to convert the fields from the source payloads to the destination fields\n const indexFields = payloads.flatMap<PayloadFields[]>((payload) => {\n // Find the transformers for this payload\n const transformers = 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 = (await PayloadHasher.hashPairs([...payloads])).map(([, hash]) => hash)\n // Build and return the index\n return await new PayloadBuilder<T>({ schema: destinationSchema }).fields(Object.assign({ sources }, ...indexFields)).build()\n}\n\n/**\n * Reduces the arrays of payload arrays to an array of payloads using the supplied transformers\n * @param payloadsArray The arrays of payloads to reduce\n * @param payloadTransformers The transformers to use to convert the payloads to the destination payloads\n * @param destinationSchema The schema of the destination payloads\n * @returns The reduced payloads\n */\nexport const reducePayloadsArray = async <T extends Payload = Payload>(\n payloadsArray: Payload[][],\n payloadTransformers: SchemaToPayloadTransformersDictionary,\n destinationSchema: string,\n): Promise<T[]> => {\n return await Promise.all(\n payloadsArray.map(async (payloads) => {\n return await reducePayloads<T>(payloads, payloadTransformers, destinationSchema)\n }),\n )\n}\n","import { containsAll } from '@xylabs/array'\nimport { assertEx } from '@xylabs/assert'\nimport { exists } from '@xylabs/exists'\nimport { AbstractDiviner } from '@xyo-network/abstract-diviner'\nimport { BoundWitness, isBoundWitness } from '@xyo-network/boundwitness-model'\nimport { DivinerConfigSchema } from '@xyo-network/diviner-model'\nimport {\n SchemaToJsonPathTransformExpressionsDictionary,\n SchemaToPayloadTransformersDictionary,\n TemporalIndexingDivinerIndexCandidateToIndexDivinerConfigSchema,\n TemporalIndexingDivinerIndexCandidateToIndexDivinerParams,\n TemporalIndexingDivinerResultIndex,\n TemporalIndexingDivinerResultIndexSchema,\n} from '@xyo-network/diviner-temporal-indexing-model'\nimport { PayloadHasher } from '@xyo-network/hash'\nimport { Labels } from '@xyo-network/module-model'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport { Payload, PayloadFields } from '@xyo-network/payload-model'\n\nimport { jsonPathToTransformersDictionary } from '../jsonpath'\n\nexport type IndexablePayloads = [BoundWitness, ...Payload[]]\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 bws: BoundWitness[] = payloads.filter(isBoundWitness)\n const indexablePayloads: Payload[] = payloads.filter((p) => this.isIndexablePayload(p))\n if (bws.length > 0 && indexablePayloads.length > 0) {\n const payloadDictionary = await PayloadHasher.toMap(payloads)\n // eslint-disable-next-line unicorn/no-array-reduce\n const validIndexableTuples: IndexablePayloads[] = bws.reduce<IndexablePayloads[]>((indexableTuples, bw) => {\n // If this Bound Witness doesn't contain all the required schemas don't index it\n if (!containsAll(bw.payload_schemas, this.indexableSchemas)) return indexableTuples\n // Find the remaining indexable payloads\n const indexablePayloadPositions = this.indexableSchemas.map((schema) => bw.payload_schemas.indexOf(schema))\n const indexablePayloadHashes = indexablePayloadPositions.map((index) => bw.payload_hashes?.[index])\n const indexablePayloads = indexablePayloadHashes.map((hash) => payloadDictionary[hash]).filter(exists)\n // If we found a timestamp and the right amount of indexable payloads (of the\n // correct schema as checked above) in this BW, then index it\n if (indexablePayloads.length === this.indexableSchemas.length) indexableTuples.push([bw, ...indexablePayloads])\n return indexableTuples\n }, [])\n // Create the indexes from the tuples\n const indexes = await Promise.all(\n validIndexableTuples.map<Promise<TemporalIndexingDivinerResultIndex>>(async ([bw, ...sourcePayloads]) => {\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 = Object.keys(await PayloadHasher.toMap([bw, ...sourcePayloads]))\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 return []\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/abstract-diviner'\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 { AbstractDiviner } from '@xyo-network/abstract-diviner'\nimport { ArchivistInstance } from '@xyo-network/archivist-model'\nimport { ArchivistWrapper } from '@xyo-network/archivist-wrapper'\nimport { BoundWitness, isBoundWitness } from '@xyo-network/boundwitness-model'\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 { isPayloadOfSchemaType, Payload } from '@xyo-network/payload-model'\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 indexes = this.payload_schemas.map((schema) => bw.payload_schemas?.findIndex((s) => s === schema))\n const hashes = indexes.map((index) => bw.payload_hashes?.[index])\n const results = await archivist.get(hashes)\n const indexCandidateIdentityFunctions = this.payload_schemas.map(isPayloadOfSchemaType)\n const filteredResults = indexCandidateIdentityFunctions.map((is) => results.find(is))\n if (filteredResults.includes(undefined)) return undefined\n const indexCandidates: IndexCandidate[] = filteredResults.filter(exists) as IndexCandidate[]\n return [bw, ...indexCandidates]\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,qCAAgC;AAChC,oCAA4C;AAC5C,2BAA2E;AAC3E,6CAAmF;AAG5E,IAAM,0BAAN,cAKG,+CAAgD;AAAA,EACxD,OAAyB,eAAe;AAAA,EACxC,OAAyB,gBAA0B,CAAC,4EAAqC,2DAA6B,wCAAmB;AAAA,EAEzI,MAAyB,eAAiC;AACxD,UAAM,MAAM,aAAa;AACzB,WAAO;AAAA,EACT;AACF;;;ACnBA,8BAAgC;AAChC,IAAAA,wBAAoC;AACpC,mCAAsE;AACtE,IAAAC,0CAMO;AAEP,IAAAC,0BAA+B;AAC/B,2BAA+C;;;ACV/C,sBAAqB;AAOd,IAAM,uBAAuB,CAAC,wBAAqD;AACxF,QAAM,EAAE,cAAc,kBAAkB,qBAAqB,IAAI;AACjE,QAAM,cAAkC,CAAC,MAAe;AAEtD,UAAM,SAAS,gBAAAC,QAAS,MAAM,GAAG,oBAAoB;AAErD,UAAM,cAAc,CAAC;AAErB,UAAM,mBAAmB,WAAW,SAAY,eAAe;AAC/D,QAAI,qBAAqB;AAAW,kBAAY,gBAAgB,IAAI;AACpE,WAAO;AAAA,EACT;AACA,SAAO;AACT;;;ACXO,IAAM,mCAAmC,CAC9C,qBAC0C;AAC1C,SAAO,OAAO;AAAA,IACZ,OAAO,Q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AU;AAAA,IACrB;AAEA,UAAM,MAAM,MAAM,KAAK,QAAQ,IAAI;AACnC,QAAI,CAAC;AAAK,aAAO;AAEjB,WAAO,sCAAe,KAAK,KAAK,KAAK,OAAO;AAAA,EAC9C;AAAA,EAEA,MAAgB,0BAA0B,IAAkB,WAAqE;AAC/H,UAAM,UAAU,KAAK,gBAAgB,IAAI,CAAC,WAAQ;AAlItD;AAkIyD,sBAAG,oBAAH,mBAAoB,UAAU,CAAC,MAAM,MAAM;AAAA,KAAO;AACvG,UAAM,SAAS,QAAQ,IAAI,CAAC,UAAO;AAnIvC;AAmI0C,sBAAG,mBAAH,mBAAoB;AAAA,KAAM;AAChE,UAAM,UAAU,MAAM,UAAU,IAAI,MAAM;AAC1C,UAAM,kCAAkC,KAAK,gBAAgB,IAAI,2CAAqB;AACtF,UAAM,kBAAkB,gCAAgC,IAAI,CAAC,OAAO,QAAQ,KAAK,EAAE,CAAC;AACpF,QAAI,gBAAgB,SAAS,MAAS;AAAG,aAAO;AAChD,UAAM,kBAAoC,gBAAgB,OAAO,qBAAM;AACvE,WAAO,CAAC,IAAI,GAAG,eAAe;AAAA,EAChC;AACF;","names":["import_diviner_model","import_diviner_temporal_indexing_model","import_payload_builder","jsonpath","import_abstract_diviner","import_diviner_model","import_diviner_temporal_indexing_model","import_hash","import_payload_builder","indexablePayloads","import_abstract_diviner","import_diviner_model","import_diviner_payload_model","import_diviner_temporal_indexing_model","import_assert","import_exists","import_abstract_diviner","import_boundwitness_model","import_diviner_model","import_diviner_temporal_indexing_model","import_payload_builder","import_payload_model","moduleName"]}
@@ -52,10 +52,10 @@ var jsonPathToTransformersDictionary = (schemaTransforms) => {
52
52
  import { PayloadHasher } from "@xyo-network/hash";
53
53
  import { PayloadBuilder } from "@xyo-network/payload-builder";
54
54
  var reducePayloads = async (payloads, payloadTransformers, destinationSchema) => {
55
- const indexFields = payloads.map((payload) => {
55
+ const indexFields = payloads.flatMap((payload) => {
56
56
  const transformers = payloadTransformers[payload.schema];
57
57
  return transformers ? transformers.map((transform) => transform(payload)) : [];
58
- }).flat();
58
+ });
59
59
  const sources = (await PayloadHasher.hashPairs([...payloads])).map(([, hash]) => hash);
60
60
  return await new PayloadBuilder({ schema: destinationSchema }).fields(Object.assign({ sources }, ...indexFields)).build();
61
61
  };
@@ -92,7 +92,7 @@ var TemporalIndexingDivinerDivinerQueryToIndexQueryDiviner = class extends Abstr
92
92
  */
93
93
  get indexableSchemas() {
94
94
  if (!this._indexableSchemas)
95
- this._indexableSchemas = [...Object.keys(this.schemaTransforms)];
95
+ this._indexableSchemas = Object.keys(this.schemaTransforms);
96
96
  return this._indexableSchemas;
97
97
  }
98
98
  /**
@@ -132,7 +132,7 @@ var TemporalIndexingDivinerDivinerQueryToIndexQueryDiviner = class extends Abstr
132
132
  }
133
133
  async divineHandler(payloads = []) {
134
134
  const queries = payloads.filter(isPayloadOfSchemaType(this.divinerQuerySchema));
135
- if (queries.length) {
135
+ if (queries.length > 0) {
136
136
  const results = await Promise.all(
137
137
  queries.map(async (query) => {
138
138
  const fields = await reducePayloads(
@@ -147,7 +147,7 @@ var TemporalIndexingDivinerDivinerQueryToIndexQueryDiviner = class extends Abstr
147
147
  );
148
148
  return results;
149
149
  }
150
- return Promise.resolve([]);
150
+ return [];
151
151
  }
152
152
  };
153
153
 
@@ -178,7 +178,7 @@ var TemporalIndexingDivinerIndexCandidateToIndexDiviner = class extends Abstract
178
178
  */
179
179
  get indexableSchemas() {
180
180
  if (!this._indexableSchemas)
181
- this._indexableSchemas = [...Object.keys(this.schemaTransforms)];
181
+ this._indexableSchemas = Object.keys(this.schemaTransforms);
182
182
  return this._indexableSchemas;
183
183
  }
184
184
  /**
@@ -201,7 +201,7 @@ var TemporalIndexingDivinerIndexCandidateToIndexDiviner = class extends Abstract
201
201
  async divineHandler(payloads = []) {
202
202
  const bws = payloads.filter(isBoundWitness);
203
203
  const indexablePayloads = payloads.filter((p) => this.isIndexablePayload(p));
204
- if (bws.length && indexablePayloads.length) {
204
+ if (bws.length > 0 && indexablePayloads.length > 0) {
205
205
  const payloadDictionary = await PayloadHasher2.toMap(payloads);
206
206
  const validIndexableTuples = bws.reduce((indexableTuples, bw) => {
207
207
  if (!containsAll(bw.payload_schemas, this.indexableSchemas))
@@ -218,17 +218,17 @@ var TemporalIndexingDivinerIndexCandidateToIndexDiviner = class extends Abstract
218
218
  }, []);
219
219
  const indexes = await Promise.all(
220
220
  validIndexableTuples.map(async ([bw, ...sourcePayloads]) => {
221
- const indexFields = sourcePayloads.map((payload) => {
221
+ const indexFields = sourcePayloads.flatMap((payload) => {
222
222
  const transformers = this.payloadTransformers[payload.schema];
223
223
  return transformers ? transformers.map((transform) => transform(payload)) : [];
224
- }).flat();
224
+ });
225
225
  const sources = Object.keys(await PayloadHasher2.toMap([bw, ...sourcePayloads]));
226
226
  return await new PayloadBuilder3({ schema: TemporalIndexingDivinerResultIndexSchema2 }).fields(Object.assign({ sources }, ...indexFields)).build();
227
227
  })
228
228
  );
229
229
  return indexes.flat();
230
230
  }
231
- return Promise.resolve([]);
231
+ return [];
232
232
  }
233
233
  /**
234
234
  * Identifies if a payload is one that is indexed by this diviner
@@ -244,7 +244,7 @@ var TemporalIndexingDivinerIndexCandidateToIndexDiviner = class extends Abstract
244
244
  * @returns True if this schema is one indexed by this diviner, false otherwise
245
245
  */
246
246
  isIndexableSchema = (schema) => {
247
- return this.indexableSchemas.some((s) => s === schema);
247
+ return typeof schema === "string" ? this.indexableSchemas.includes(schema) : false;
248
248
  };
249
249
  };
250
250
 
@@ -358,7 +358,7 @@ var TemporalIndexingDivinerStateToIndexCandidateDiviner = class extends Abstract
358
358
  const results = await archivist.get(hashes);
359
359
  const indexCandidateIdentityFunctions = this.payload_schemas.map(isPayloadOfSchemaType2);
360
360
  const filteredResults = indexCandidateIdentityFunctions.map((is) => results.find(is));
361
- if (filteredResults.some((f) => f === void 0))
361
+ if (filteredResults.includes(void 0))
362
362
  return void 0;
363
363
  const indexCandidates = filteredResults.filter(exists2);
364
364
  return [bw, ...indexCandidates];
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Diviner.ts","../../src/DivinerQueryToIndexQueryDiviner/Diviner.ts","../../src/jsonpath/toPayloadTransformer.ts","../../src/jsonpath/jsonPathToTransformersDictionary.ts","../../src/jsonpath/reducePayloads.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/abstract-diviner'\nimport { DivinerConfigSchema } from '@xyo-network/diviner-model'\nimport { PayloadDivinerQueryPayload, PayloadDivinerQuerySchema } from '@xyo-network/diviner-payload-model'\nimport {\n SchemaToJsonPathTransformExpressionsDictionary,\n SchemaToPayloadTransformersDictionary,\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\nimport { jsonPathToTransformersDictionary, reducePayloads } from '../jsonpath'\n\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) {\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 Promise.resolve([])\n }\n}\n","import { JsonPathTransformExpression, PayloadTransformer } from '@xyo-network/diviner-temporal-indexing-model'\nimport { Payload } from '@xyo-network/payload-model'\nimport jsonpath from 'jsonpath'\n\n/**\n * Converts a JSON Path transform expression to a payload transformer\n * @param transformExpression The transform expression to convert\n * @returns The payload transformer for the JSON Path transform expression\n */\nexport const toPayloadTransformer = (transformExpression: JsonPathTransformExpression) => {\n const { defaultValue, destinationField, sourcePathExpression } = transformExpression\n const transformer: PayloadTransformer = (x: Payload) => {\n // eslint-disable-next-line import/no-named-as-default-member\n const source = jsonpath.value(x, sourcePathExpression)\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const transformed = {} as { [key: string]: any }\n // Assign the source value to the destination field or the default value if the source is undefined\n const destinationValue = source === undefined ? defaultValue : source\n if (destinationValue !== undefined) transformed[destinationField] = destinationValue\n return transformed\n }\n return transformer\n}\n","import { SchemaToJsonPathTransformExpressionsDictionary, SchemaToPayloadTransformersDictionary } from '@xyo-network/diviner-temporal-indexing-model'\n\nimport { toPayloadTransformer } from './toPayloadTransformer'\n\n/**\n * Materializes the JSON-path expressions into memoized functions by converting a\n * dictionary of schema to JSON Path transform expressions to a dictionary\n * of schema to payload transformers\n * @param schemaTransforms The schema transforms to convert\n * @returns A dictionary of schema to payload transformers\n */\nexport const jsonPathToTransformersDictionary = (\n schemaTransforms: SchemaToJsonPathTransformExpressionsDictionary,\n): SchemaToPayloadTransformersDictionary => {\n return Object.fromEntries(\n Object.entries(schemaTransforms).map(([schema, jsonPathTransformerExpressions]) => {\n const transformers = jsonPathTransformerExpressions.map(toPayloadTransformer)\n return [schema, transformers]\n }),\n )\n}\n","import { SchemaToPayloadTransformersDictionary } from '@xyo-network/diviner-temporal-indexing-model'\nimport { PayloadHasher } from '@xyo-network/hash'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport { Payload, PayloadFields } from '@xyo-network/payload-model'\n\n/**\n * Reduces the payloads to a single payload using the supplied transformers\n * @param payloads The payloads to reduce\n * @param payloadTransformers The transformers to use to convert the payloads to the destination payload\n * @param destinationSchema The schema of the destination payload\n * @returns The reduced payload\n */\nexport const reducePayloads = async <T extends Payload = Payload>(\n payloads: Payload[],\n payloadTransformers: SchemaToPayloadTransformersDictionary,\n destinationSchema: string,\n): Promise<T> => {\n // Use the payload transformers to convert the fields from the source payloads to the destination fields\n const indexFields = payloads\n .map<PayloadFields[]>((payload) => {\n // Find the transformers for this payload\n const transformers = 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 .flat()\n // Include all the sources for reference\n const sources = (await PayloadHasher.hashPairs([...payloads])).map(([, hash]) => hash)\n // Build and return the index\n return await new PayloadBuilder<T>({ schema: destinationSchema }).fields(Object.assign({ sources }, ...indexFields)).build()\n}\n\n/**\n * Reduces the arrays of payload arrays to an array of payloads using the supplied transformers\n * @param payloadsArray The arrays of payloads to reduce\n * @param payloadTransformers The transformers to use to convert the payloads to the destination payloads\n * @param destinationSchema The schema of the destination payloads\n * @returns The reduced payloads\n */\nexport const reducePayloadsArray = async <T extends Payload = Payload>(\n payloadsArray: Payload[][],\n payloadTransformers: SchemaToPayloadTransformersDictionary,\n destinationSchema: string,\n): Promise<T[]> => {\n return await Promise.all(\n payloadsArray.map(async (payloads) => {\n return await reducePayloads<T>(payloads, payloadTransformers, destinationSchema)\n }),\n )\n}\n","import { containsAll } from '@xylabs/array'\nimport { assertEx } from '@xylabs/assert'\nimport { exists } from '@xylabs/exists'\nimport { AbstractDiviner } from '@xyo-network/abstract-diviner'\nimport { BoundWitness, isBoundWitness } from '@xyo-network/boundwitness-model'\nimport { DivinerConfigSchema } from '@xyo-network/diviner-model'\nimport {\n SchemaToJsonPathTransformExpressionsDictionary,\n SchemaToPayloadTransformersDictionary,\n TemporalIndexingDivinerIndexCandidateToIndexDivinerConfigSchema,\n TemporalIndexingDivinerIndexCandidateToIndexDivinerParams,\n TemporalIndexingDivinerResultIndex,\n TemporalIndexingDivinerResultIndexSchema,\n} from '@xyo-network/diviner-temporal-indexing-model'\nimport { PayloadHasher } from '@xyo-network/hash'\nimport { Labels } from '@xyo-network/module-model'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport { Payload, PayloadFields } from '@xyo-network/payload-model'\n\nimport { jsonPathToTransformersDictionary } from '../jsonpath'\n\nexport type IndexablePayloads = [BoundWitness, ...Payload[]]\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 bws: BoundWitness[] = payloads.filter(isBoundWitness)\n const indexablePayloads: Payload[] = payloads.filter((p) => this.isIndexablePayload(p))\n if (bws.length && indexablePayloads.length) {\n const payloadDictionary = await PayloadHasher.toMap(payloads)\n const validIndexableTuples: IndexablePayloads[] = bws.reduce<IndexablePayloads[]>((indexableTuples, bw) => {\n // If this Bound Witness doesn't contain all the required schemas don't index it\n if (!containsAll(bw.payload_schemas, this.indexableSchemas)) return indexableTuples\n // Find the remaining indexable payloads\n const indexablePayloadPositions = this.indexableSchemas.map((schema) => bw.payload_schemas.indexOf(schema))\n const indexablePayloadHashes = indexablePayloadPositions.map((index) => bw.payload_hashes?.[index])\n const indexablePayloads = indexablePayloadHashes.map((hash) => payloadDictionary[hash]).filter(exists)\n // If we found a timestamp and the right amount of indexable payloads (of the\n // correct schema as checked above) in this BW, then index it\n if (indexablePayloads.length === this.indexableSchemas.length) indexableTuples.push([bw, ...indexablePayloads])\n return indexableTuples\n }, [])\n // Create the indexes from the tuples\n const indexes = await Promise.all(\n validIndexableTuples.map<Promise<TemporalIndexingDivinerResultIndex>>(async ([bw, ...sourcePayloads]) => {\n // Use the payload transformers to convert the fields from the source payloads to the destination fields\n const indexFields = sourcePayloads\n .map<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 .flat()\n // Include all the sources for reference\n const sources = Object.keys(await PayloadHasher.toMap([bw, ...sourcePayloads]))\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 return Promise.resolve([])\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 this.indexableSchemas.some((s) => s === schema)\n }\n}\n","import { AbstractDiviner } from '@xyo-network/abstract-diviner'\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 { AbstractDiviner } from '@xyo-network/abstract-diviner'\nimport { ArchivistInstance } from '@xyo-network/archivist-model'\nimport { ArchivistWrapper } from '@xyo-network/archivist-wrapper'\nimport { BoundWitness, isBoundWitness } from '@xyo-network/boundwitness-model'\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 { isPayloadOfSchemaType, Payload } from '@xyo-network/payload-model'\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 ?? 1_000\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 indexes = this.payload_schemas.map((schema) => bw.payload_schemas?.findIndex((s) => s === schema))\n const hashes = indexes.map((index) => bw.payload_hashes?.[index])\n const results = await archivist.get(hashes)\n const indexCandidateIdentityFunctions = this.payload_schemas.map(isPayloadOfSchemaType)\n const filteredResults = indexCandidateIdentityFunctions.map((is) => results.find(is))\n if (filteredResults.some((f) => f === undefined)) return undefined\n const indexCandidates: IndexCandidate[] = filteredResults.filter(exists) as IndexCandidate[]\n return [bw, ...indexCandidates]\n }\n}\n"],"mappings":";AAAA,SAAS,uBAAuB;AAChC,SAAS,mCAAmC;AAC5C,SAAS,2BAAkE;AAC3E,SAAS,2CAA0E;AAG5E,IAAM,0BAAN,cAKG,gBAAgD;AAAA,EACxD,OAAyB,eAAe;AAAA,EACxC,OAAyB,gBAA0B,CAAC,qCAAqC,6BAA6B,mBAAmB;AAAA,EAEzI,MAAyB,eAAiC;AACxD,UAAM,MAAM,aAAa;AACzB,WAAO;AAAA,EACT;AACF;;;ACnBA,SAAS,uBAAuB;AAChC,SAAS,uBAAAA,4BAA2B;AACpC,SAAqC,iCAAiC;AACtE;AAAA,EAGE;AAAA,EAEA;AAAA,OACK;AAEP,SAAS,kBAAAC,uBAAsB;AAC/B,SAAS,6BAAsC;;;ACV/C,OAAO,cAAc;AAOd,IAAM,uBAAuB,CAAC,wBAAqD;AACxF,QAAM,EAAE,cAAc,kBAAkB,qBAAqB,IAAI;AACjE,QAAM,cAAkC,CAAC,MAAe;AAEtD,UAAM,SAAS,SAAS,MAAM,GAAG,oBAAoB;AAErD,UAAM,cAAc,CAAC;AAErB,UAAM,mBAAmB,WAAW,SAAY,eAAe;AAC/D,QAAI,qBAAqB;AAAW,kBAAY,gBAAgB,IAAI;AACpE,WAAO;AAAA,EACT;AACA,SAAO;AACT;;;ACXO,IAAM,mCAAmC,CAC9C,qBAC0C;AAC1C,SAAO,OAAO;AAAA,IACZ,OAAO,QAAQ,gBAAgB,EAAE,IAAI,CAAC,CAAC,QAAQ,8BAA8B,MAAM;AACjF,YAAM,eAAe,+BAA+B,IAAI,oBAAoB;AAC5E,aAAO,CAAC,QAAQ,YAAY;AAAA,IAC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AA;AAAA;AAAA,EAMA,MAAgB,iCAAsE;AApHxF;AAsHI,UAAM,OAAeP;AAAA,OACnB,gBAAK,WAAL,mBAAa,iBAAb,mBAA2B;AAAA,MAC3B,MAAM,GAAGO,WAAU;AAAA,IACrB;AAEA,UAAM,MAAM,MAAM,KAAK,QAAQ,IAAI;AACnC,QAAI,CAAC;AAAK,aAAO;AAEjB,WAAO,eAAe,KAAK,KAAK,KAAK,OAAO;AAAA,EAC9C;AAAA,EAEA,MAAgB,0BAA0B,IAAkB,WAAqE;AAC/H,UAAM,UAAU,KAAK,gBAAgB,IAAI,CAAC,WAAQ;AAlItD;AAkIyD,sBAAG,oBAAH,mBAAoB,UAAU,CAAC,MAAM,MAAM;AAAA,KAAO;AACvG,UAAM,SAAS,QAAQ,IAAI,CAAC,UAAO;AAnIvC;AAmI0C,sBAAG,mBAAH,mBAAoB;AAAA,KAAM;AAChE,UAAM,UAAU,MAAM,UAAU,IAAI,MAAM;AAC1C,UAAM,kCAAkC,KAAK,gBAAgB,IAAID,sBAAqB;AACtF,UAAM,kBAAkB,gCAAgC,IAAI,CAAC,OAAO,QAAQ,KAAK,EAAE,CAAC;AACpF,QAAI,gBAAgB,KAAK,CAAC,MAAM,MAAM,MAAS;AAAG,aAAO;AACzD,UAAM,kBAAoC,gBAAgB,OAAOL,OAAM;AACvE,WAAO,CAAC,IAAI,GAAG,eAAe;AAAA,EAChC;AACF;","names":["DivinerConfigSchema","PayloadBuilder","DivinerConfigSchema","PayloadBuilder","AbstractDiviner","DivinerConfigSchema","TemporalIndexingDivinerResultIndexSchema","PayloadHasher","PayloadBuilder","AbstractDiviner","DivinerConfigSchema","PayloadHasher","indexablePayloads","PayloadBuilder","TemporalIndexingDivinerResultIndexSchema","AbstractDiviner","DivinerConfigSchema","assertEx","exists","AbstractDiviner","isBoundWitness","DivinerConfigSchema","PayloadBuilder","isPayloadOfSchemaType","moduleName"]}
1
+ {"version":3,"sources":["../../src/Diviner.ts","../../src/DivinerQueryToIndexQueryDiviner/Diviner.ts","../../src/jsonpath/toPayloadTransformer.ts","../../src/jsonpath/jsonPathToTransformersDictionary.ts","../../src/jsonpath/reducePayloads.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/abstract-diviner'\nimport { DivinerConfigSchema } from '@xyo-network/diviner-model'\nimport { PayloadDivinerQueryPayload, PayloadDivinerQuerySchema } from '@xyo-network/diviner-payload-model'\nimport {\n SchemaToJsonPathTransformExpressionsDictionary,\n SchemaToPayloadTransformersDictionary,\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\nimport { jsonPathToTransformersDictionary, reducePayloads } from '../jsonpath'\n\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 { JsonPathTransformExpression, PayloadTransformer } from '@xyo-network/diviner-temporal-indexing-model'\nimport { Payload } from '@xyo-network/payload-model'\nimport jsonpath from 'jsonpath'\n\n/**\n * Converts a JSON Path transform expression to a payload transformer\n * @param transformExpression The transform expression to convert\n * @returns The payload transformer for the JSON Path transform expression\n */\nexport const toPayloadTransformer = (transformExpression: JsonPathTransformExpression) => {\n const { defaultValue, destinationField, sourcePathExpression } = transformExpression\n const transformer: PayloadTransformer = (x: Payload) => {\n // eslint-disable-next-line import/no-named-as-default-member\n const source = jsonpath.value(x, sourcePathExpression)\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const transformed = {} as { [key: string]: any }\n // Assign the source value to the destination field or the default value if the source is undefined\n const destinationValue = source === undefined ? defaultValue : source\n if (destinationValue !== undefined) transformed[destinationField] = destinationValue\n return transformed\n }\n return transformer\n}\n","import { SchemaToJsonPathTransformExpressionsDictionary, SchemaToPayloadTransformersDictionary } from '@xyo-network/diviner-temporal-indexing-model'\n\nimport { toPayloadTransformer } from './toPayloadTransformer'\n\n/**\n * Materializes the JSON-path expressions into memoized functions by converting a\n * dictionary of schema to JSON Path transform expressions to a dictionary\n * of schema to payload transformers\n * @param schemaTransforms The schema transforms to convert\n * @returns A dictionary of schema to payload transformers\n */\nexport const jsonPathToTransformersDictionary = (\n schemaTransforms: SchemaToJsonPathTransformExpressionsDictionary,\n): SchemaToPayloadTransformersDictionary => {\n return Object.fromEntries(\n Object.entries(schemaTransforms).map(([schema, jsonPathTransformerExpressions]) => {\n const transformers = jsonPathTransformerExpressions.map(toPayloadTransformer)\n return [schema, transformers]\n }),\n )\n}\n","import { SchemaToPayloadTransformersDictionary } from '@xyo-network/diviner-temporal-indexing-model'\nimport { PayloadHasher } from '@xyo-network/hash'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport { Payload, PayloadFields } from '@xyo-network/payload-model'\n\n/**\n * Reduces the payloads to a single payload using the supplied transformers\n * @param payloads The payloads to reduce\n * @param payloadTransformers The transformers to use to convert the payloads to the destination payload\n * @param destinationSchema The schema of the destination payload\n * @returns The reduced payload\n */\nexport const reducePayloads = async <T extends Payload = Payload>(\n payloads: Payload[],\n payloadTransformers: SchemaToPayloadTransformersDictionary,\n destinationSchema: string,\n): Promise<T> => {\n // Use the payload transformers to convert the fields from the source payloads to the destination fields\n const indexFields = payloads.flatMap<PayloadFields[]>((payload) => {\n // Find the transformers for this payload\n const transformers = 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 = (await PayloadHasher.hashPairs([...payloads])).map(([, hash]) => hash)\n // Build and return the index\n return await new PayloadBuilder<T>({ schema: destinationSchema }).fields(Object.assign({ sources }, ...indexFields)).build()\n}\n\n/**\n * Reduces the arrays of payload arrays to an array of payloads using the supplied transformers\n * @param payloadsArray The arrays of payloads to reduce\n * @param payloadTransformers The transformers to use to convert the payloads to the destination payloads\n * @param destinationSchema The schema of the destination payloads\n * @returns The reduced payloads\n */\nexport const reducePayloadsArray = async <T extends Payload = Payload>(\n payloadsArray: Payload[][],\n payloadTransformers: SchemaToPayloadTransformersDictionary,\n destinationSchema: string,\n): Promise<T[]> => {\n return await Promise.all(\n payloadsArray.map(async (payloads) => {\n return await reducePayloads<T>(payloads, payloadTransformers, destinationSchema)\n }),\n )\n}\n","import { containsAll } from '@xylabs/array'\nimport { assertEx } from '@xylabs/assert'\nimport { exists } from '@xylabs/exists'\nimport { AbstractDiviner } from '@xyo-network/abstract-diviner'\nimport { BoundWitness, isBoundWitness } from '@xyo-network/boundwitness-model'\nimport { DivinerConfigSchema } from '@xyo-network/diviner-model'\nimport {\n SchemaToJsonPathTransformExpressionsDictionary,\n SchemaToPayloadTransformersDictionary,\n TemporalIndexingDivinerIndexCandidateToIndexDivinerConfigSchema,\n TemporalIndexingDivinerIndexCandidateToIndexDivinerParams,\n TemporalIndexingDivinerResultIndex,\n TemporalIndexingDivinerResultIndexSchema,\n} from '@xyo-network/diviner-temporal-indexing-model'\nimport { PayloadHasher } from '@xyo-network/hash'\nimport { Labels } from '@xyo-network/module-model'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport { Payload, PayloadFields } from '@xyo-network/payload-model'\n\nimport { jsonPathToTransformersDictionary } from '../jsonpath'\n\nexport type IndexablePayloads = [BoundWitness, ...Payload[]]\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 bws: BoundWitness[] = payloads.filter(isBoundWitness)\n const indexablePayloads: Payload[] = payloads.filter((p) => this.isIndexablePayload(p))\n if (bws.length > 0 && indexablePayloads.length > 0) {\n const payloadDictionary = await PayloadHasher.toMap(payloads)\n // eslint-disable-next-line unicorn/no-array-reduce\n const validIndexableTuples: IndexablePayloads[] = bws.reduce<IndexablePayloads[]>((indexableTuples, bw) => {\n // If this Bound Witness doesn't contain all the required schemas don't index it\n if (!containsAll(bw.payload_schemas, this.indexableSchemas)) return indexableTuples\n // Find the remaining indexable payloads\n const indexablePayloadPositions = this.indexableSchemas.map((schema) => bw.payload_schemas.indexOf(schema))\n const indexablePayloadHashes = indexablePayloadPositions.map((index) => bw.payload_hashes?.[index])\n const indexablePayloads = indexablePayloadHashes.map((hash) => payloadDictionary[hash]).filter(exists)\n // If we found a timestamp and the right amount of indexable payloads (of the\n // correct schema as checked above) in this BW, then index it\n if (indexablePayloads.length === this.indexableSchemas.length) indexableTuples.push([bw, ...indexablePayloads])\n return indexableTuples\n }, [])\n // Create the indexes from the tuples\n const indexes = await Promise.all(\n validIndexableTuples.map<Promise<TemporalIndexingDivinerResultIndex>>(async ([bw, ...sourcePayloads]) => {\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 = Object.keys(await PayloadHasher.toMap([bw, ...sourcePayloads]))\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 return []\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/abstract-diviner'\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 { AbstractDiviner } from '@xyo-network/abstract-diviner'\nimport { ArchivistInstance } from '@xyo-network/archivist-model'\nimport { ArchivistWrapper } from '@xyo-network/archivist-wrapper'\nimport { BoundWitness, isBoundWitness } from '@xyo-network/boundwitness-model'\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 { isPayloadOfSchemaType, Payload } from '@xyo-network/payload-model'\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 indexes = this.payload_schemas.map((schema) => bw.payload_schemas?.findIndex((s) => s === schema))\n const hashes = indexes.map((index) => bw.payload_hashes?.[index])\n const results = await archivist.get(hashes)\n const indexCandidateIdentityFunctions = this.payload_schemas.map(isPayloadOfSchemaType)\n const filteredResults = indexCandidateIdentityFunctions.map((is) => results.find(is))\n if (filteredResults.includes(undefined)) return undefined\n const indexCandidates: IndexCandidate[] = filteredResults.filter(exists) as IndexCandidate[]\n return [bw, ...indexCandidates]\n }\n}\n"],"mappings":";AAAA,SAAS,uBAAuB;AAChC,SAAS,mCAAmC;AAC5C,SAAS,2BAAkE;AAC3E,SAAS,2CAA0E;AAG5E,IAAM,0BAAN,cAKG,gBAAgD;AAAA,EACxD,OAAyB,eAAe;AAAA,EACxC,OAAyB,gBAA0B,CAAC,qCAAqC,6BAA6B,mBAAmB;AAAA,EAEzI,MAAyB,eAAiC;AACxD,UAAM,MAAM,aAAa;AACzB,WAAO;AAAA,EACT;AACF;;;ACnBA,SAAS,uBAAuB;AAChC,SAAS,uBAAAA,4BAA2B;AACpC,SAAqC,iCAAiC;AACtE;AAAA,EAGE;AAAA,EAEA;AAAA,OACK;AAEP,SAAS,kBAAAC,uBAAsB;AAC/B,SAAS,6BAAsC;;;ACV/C,OAAO,cAAc;AAOd,IAAM,uBAAuB,CAAC,wBAAqD;AACxF,QAAM,EAAE,cAAc,kBAAkB,qBAAqB,IAAI;AACjE,QAAM,cAAkC,CAAC,MAAe;AAEtD,UAAM,SAAS,SAAS,MAAM,GAAG,oBAAoB;AAErD,UAAM,cAAc,CAAC;AAErB,UAAM,mBAAmB,WAAW,SAAY,eAAe;AAC/D,QAAI,qBAAqB;AAAW,kBAAY,gBAAgB,IAAI;AACpE,WAAO;AAAA,EACT;AACA,SAAO;AACT;;;ACXO,IAAM,mCAAmC,CAC9C,qBAC0C;AAC1C,SAAO,OAAO;AAAA,IACZ,OAAO,QAAQ,gBAAgB,EAAE,IAAI,CAAC,CAAC,QAAQ,8BAA8B,MAAM;AACjF,YAAM,eAAe,+BAA+B,IAAI,oBAAoB;AAC5E,aAAO,CAAC,QAAQ,YAAY;AAAA,IAC9B,CAAC;AAAA,EACH;AACF;;;ACnBA,SAAS,qBAAqB;AAC9B,SAAS,sBAAsB;AAUxB,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,UAAM,MAAM,MAAM,KAAK,QAAQ,IAAI;AACnC,QAAI,CAAC;AAAK,aAAO;AAEjB,WAAO,eAAe,KAAK,KAAK,KAAK,OAAO;AAAA,EAC9C;AAAA,EAEA,MAAgB,0BAA0B,IAAkB,WAAqE;AAC/H,UAAM,UAAU,KAAK,gBAAgB,IAAI,CAAC,WAAQ;AAlItD;AAkIyD,sBAAG,oBAAH,mBAAoB,UAAU,CAAC,MAAM,MAAM;AAAA,KAAO;AACvG,UAAM,SAAS,QAAQ,IAAI,CAAC,UAAO;AAnIvC;AAmI0C,sBAAG,mBAAH,mBAAoB;AAAA,KAAM;AAChE,UAAM,UAAU,MAAM,UAAU,IAAI,MAAM;AAC1C,UAAM,kCAAkC,KAAK,gBAAgB,IAAID,sBAAqB;AACtF,UAAM,kBAAkB,gCAAgC,IAAI,CAAC,OAAO,QAAQ,KAAK,EAAE,CAAC;AACpF,QAAI,gBAAgB,SAAS,MAAS;AAAG,aAAO;AAChD,UAAM,kBAAoC,gBAAgB,OAAOL,OAAM;AACvE,WAAO,CAAC,IAAI,GAAG,eAAe;AAAA,EAChC;AACF;","names":["DivinerConfigSchema","PayloadBuilder","DivinerConfigSchema","PayloadBuilder","AbstractDiviner","DivinerConfigSchema","TemporalIndexingDivinerResultIndexSchema","PayloadHasher","PayloadBuilder","AbstractDiviner","DivinerConfigSchema","PayloadHasher","indexablePayloads","PayloadBuilder","TemporalIndexingDivinerResultIndexSchema","AbstractDiviner","DivinerConfigSchema","assertEx","exists","AbstractDiviner","isBoundWitness","DivinerConfigSchema","PayloadBuilder","isPayloadOfSchemaType","moduleName"]}
@@ -1 +1 @@
1
- {"version":3,"file":"reducePayloads.d.ts","sourceRoot":"","sources":["../../../src/jsonpath/reducePayloads.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qCAAqC,EAAE,MAAM,8CAA8C,CAAA;AAGpG,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAEnE;;;;;;GAMG;AACH,eAAO,MAAM,cAAc;;;;6BACf,OAAO,EAAE,uBACE,qCAAqC,qBACvC,MAAM,eAe1B,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB;;;;kCACf,OAAO,EAAE,EAAE,uBACL,qCAAqC,qBACvC,MAAM,iBAO1B,CAAA"}
1
+ {"version":3,"file":"reducePayloads.d.ts","sourceRoot":"","sources":["../../../src/jsonpath/reducePayloads.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qCAAqC,EAAE,MAAM,8CAA8C,CAAA;AAGpG,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAEnE;;;;;;GAMG;AACH,eAAO,MAAM,cAAc;;;;6BACf,OAAO,EAAE,uBACE,qCAAqC,qBACvC,MAAM,eAa1B,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB;;;;kCACf,OAAO,EAAE,EAAE,uBACL,qCAAqC,qBACvC,MAAM,iBAO1B,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"reducePayloads.d.ts","sourceRoot":"","sources":["../../../src/jsonpath/reducePayloads.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qCAAqC,EAAE,MAAM,8CAA8C,CAAA;AAGpG,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAEnE;;;;;;GAMG;AACH,eAAO,MAAM,cAAc;;;;6BACf,OAAO,EAAE,uBACE,qCAAqC,qBACvC,MAAM,eAe1B,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB;;;;kCACf,OAAO,EAAE,EAAE,uBACL,qCAAqC,qBACvC,MAAM,iBAO1B,CAAA"}
1
+ {"version":3,"file":"reducePayloads.d.ts","sourceRoot":"","sources":["../../../src/jsonpath/reducePayloads.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qCAAqC,EAAE,MAAM,8CAA8C,CAAA;AAGpG,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAEnE;;;;;;GAMG;AACH,eAAO,MAAM,cAAc;;;;6BACf,OAAO,EAAE,uBACE,qCAAqC,qBACvC,MAAM,eAa1B,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB;;;;kCACf,OAAO,EAAE,EAAE,uBACL,qCAAqC,qBACvC,MAAM,iBAO1B,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"reducePayloads.d.ts","sourceRoot":"","sources":["../../../src/jsonpath/reducePayloads.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qCAAqC,EAAE,MAAM,8CAA8C,CAAA;AAGpG,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAEnE;;;;;;GAMG;AACH,eAAO,MAAM,cAAc;;;;6BACf,OAAO,EAAE,uBACE,qCAAqC,qBACvC,MAAM,eAe1B,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB;;;;kCACf,OAAO,EAAE,EAAE,uBACL,qCAAqC,qBACvC,MAAM,iBAO1B,CAAA"}
1
+ {"version":3,"file":"reducePayloads.d.ts","sourceRoot":"","sources":["../../../src/jsonpath/reducePayloads.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qCAAqC,EAAE,MAAM,8CAA8C,CAAA;AAGpG,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAEnE;;;;;;GAMG;AACH,eAAO,MAAM,cAAc;;;;6BACf,OAAO,EAAE,uBACE,qCAAqC,qBACvC,MAAM,eAa1B,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB;;;;kCACf,OAAO,EAAE,EAAE,uBACL,qCAAqC,qBACvC,MAAM,iBAO1B,CAAA"}