@xyo-network/diviner-temporal-indexing-memory 2.84.6 → 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.
- package/dist/browser/IndexCandidateToIndexDiviner/Diviner.d.cts.map +1 -1
- package/dist/browser/IndexCandidateToIndexDiviner/Diviner.d.mts.map +1 -1
- package/dist/browser/IndexCandidateToIndexDiviner/Diviner.d.ts.map +1 -1
- package/dist/browser/IndexCandidateToIndexDiviner/_Diviner.d.cts.map +1 -1
- package/dist/browser/IndexCandidateToIndexDiviner/_Diviner.d.mts.map +1 -1
- package/dist/browser/IndexCandidateToIndexDiviner/_Diviner.d.ts.map +1 -1
- package/dist/browser/index.cjs +12 -12
- package/dist/browser/index.cjs.map +1 -1
- package/dist/browser/index.js +12 -12
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/jsonpath/reducePayloads.d.cts.map +1 -1
- package/dist/browser/jsonpath/reducePayloads.d.mts.map +1 -1
- package/dist/browser/jsonpath/reducePayloads.d.ts.map +1 -1
- package/dist/node/IndexCandidateToIndexDiviner/Diviner.d.cts.map +1 -1
- package/dist/node/IndexCandidateToIndexDiviner/Diviner.d.mts.map +1 -1
- package/dist/node/IndexCandidateToIndexDiviner/Diviner.d.ts.map +1 -1
- package/dist/node/IndexCandidateToIndexDiviner/_Diviner.d.cts.map +1 -1
- package/dist/node/IndexCandidateToIndexDiviner/_Diviner.d.mts.map +1 -1
- package/dist/node/IndexCandidateToIndexDiviner/_Diviner.d.ts.map +1 -1
- package/dist/node/index.cjs +12 -12
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.js +12 -12
- package/dist/node/index.js.map +1 -1
- package/dist/node/jsonpath/reducePayloads.d.cts.map +1 -1
- package/dist/node/jsonpath/reducePayloads.d.mts.map +1 -1
- package/dist/node/jsonpath/reducePayloads.d.ts.map +1 -1
- package/package.json +26 -26
- package/src/DivinerQueryToIndexQueryDiviner/Diviner.ts +3 -3
- package/src/IndexCandidateToIndexDiviner/Diviner.ts +11 -12
- package/src/IndexCandidateToIndexDiviner/_Diviner.ts +11 -12
- package/src/StateToIndexCandidateDiviner/Diviner.ts +2 -2
- 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,OAAO,CAAC,OAAO,EAAE,CAAC;
|
|
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":[],"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8C,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"}
|
package/dist/browser/index.cjs
CHANGED
|
@@ -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.
|
|
92
|
+
const indexFields = payloads.flatMap((payload) => {
|
|
93
93
|
const transformers = payloadTransformers[payload.schema];
|
|
94
94
|
return transformers ? transformers.map((transform) => transform(payload)) : [];
|
|
95
|
-
})
|
|
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 =
|
|
132
|
+
this._indexableSchemas = Object.keys(this.schemaTransforms);
|
|
133
133
|
return this._indexableSchemas;
|
|
134
134
|
}
|
|
135
135
|
/**
|
|
@@ -168,7 +168,7 @@ var TemporalIndexingDivinerDivinerQueryToIndexQueryDiviner = class extends impor
|
|
|
168
168
|
}
|
|
169
169
|
async divineHandler(payloads = []) {
|
|
170
170
|
const queries = payloads.filter((0, import_payload_model.isPayloadOfSchemaType)(this.divinerQuerySchema));
|
|
171
|
-
if (queries.length) {
|
|
171
|
+
if (queries.length > 0) {
|
|
172
172
|
const results = await Promise.all(
|
|
173
173
|
queries.map(async (query) => {
|
|
174
174
|
const fields = await reducePayloads(
|
|
@@ -183,7 +183,7 @@ var TemporalIndexingDivinerDivinerQueryToIndexQueryDiviner = class extends impor
|
|
|
183
183
|
);
|
|
184
184
|
return results;
|
|
185
185
|
}
|
|
186
|
-
return
|
|
186
|
+
return [];
|
|
187
187
|
}
|
|
188
188
|
};
|
|
189
189
|
|
|
@@ -211,7 +211,7 @@ var TemporalIndexingDivinerIndexCandidateToIndexDiviner = class extends import_a
|
|
|
211
211
|
*/
|
|
212
212
|
get indexableSchemas() {
|
|
213
213
|
if (!this._indexableSchemas)
|
|
214
|
-
this._indexableSchemas =
|
|
214
|
+
this._indexableSchemas = Object.keys(this.schemaTransforms);
|
|
215
215
|
return this._indexableSchemas;
|
|
216
216
|
}
|
|
217
217
|
/**
|
|
@@ -233,7 +233,7 @@ var TemporalIndexingDivinerIndexCandidateToIndexDiviner = class extends import_a
|
|
|
233
233
|
async divineHandler(payloads = []) {
|
|
234
234
|
const bws = payloads.filter(import_boundwitness_model.isBoundWitness);
|
|
235
235
|
const indexablePayloads = payloads.filter((p) => this.isIndexablePayload(p));
|
|
236
|
-
if (bws.length && indexablePayloads.length) {
|
|
236
|
+
if (bws.length > 0 && indexablePayloads.length > 0) {
|
|
237
237
|
const payloadDictionary = await import_hash2.PayloadHasher.toMap(payloads);
|
|
238
238
|
const validIndexableTuples = bws.reduce((indexableTuples, bw) => {
|
|
239
239
|
if (!(0, import_array.containsAll)(bw.payload_schemas, this.indexableSchemas))
|
|
@@ -247,17 +247,17 @@ var TemporalIndexingDivinerIndexCandidateToIndexDiviner = class extends import_a
|
|
|
247
247
|
}, []);
|
|
248
248
|
const indexes = await Promise.all(
|
|
249
249
|
validIndexableTuples.map(async ([bw, ...sourcePayloads]) => {
|
|
250
|
-
const indexFields = sourcePayloads.
|
|
250
|
+
const indexFields = sourcePayloads.flatMap((payload) => {
|
|
251
251
|
const transformers = this.payloadTransformers[payload.schema];
|
|
252
252
|
return transformers ? transformers.map((transform) => transform(payload)) : [];
|
|
253
|
-
})
|
|
253
|
+
});
|
|
254
254
|
const sources = Object.keys(await import_hash2.PayloadHasher.toMap([bw, ...sourcePayloads]));
|
|
255
255
|
return await new import_payload_builder3.PayloadBuilder({ schema: import_diviner_temporal_indexing_model3.TemporalIndexingDivinerResultIndexSchema }).fields(Object.assign({ sources }, ...indexFields)).build();
|
|
256
256
|
})
|
|
257
257
|
);
|
|
258
258
|
return indexes.flat();
|
|
259
259
|
}
|
|
260
|
-
return
|
|
260
|
+
return [];
|
|
261
261
|
}
|
|
262
262
|
/**
|
|
263
263
|
* Identifies if a payload is one that is indexed by this diviner
|
|
@@ -273,7 +273,7 @@ var TemporalIndexingDivinerIndexCandidateToIndexDiviner = class extends import_a
|
|
|
273
273
|
* @returns True if this schema is one indexed by this diviner, false otherwise
|
|
274
274
|
*/
|
|
275
275
|
isIndexableSchema = (schema) => {
|
|
276
|
-
return this.indexableSchemas.
|
|
276
|
+
return typeof schema === "string" ? this.indexableSchemas.includes(schema) : false;
|
|
277
277
|
};
|
|
278
278
|
};
|
|
279
279
|
|
|
@@ -376,7 +376,7 @@ var TemporalIndexingDivinerStateToIndexCandidateDiviner = class extends import_a
|
|
|
376
376
|
const results = await archivist.get(hashes);
|
|
377
377
|
const indexCandidateIdentityFunctions = this.payload_schemas.map(import_payload_model2.isPayloadOfSchemaType);
|
|
378
378
|
const filteredResults = indexCandidateIdentityFunctions.map((is) => results.find(is));
|
|
379
|
-
if (filteredResults.
|
|
379
|
+
if (filteredResults.includes(void 0))
|
|
380
380
|
return void 0;
|
|
381
381
|
const indexCandidates = filteredResults.filter(import_exists2.exists);
|
|
382
382
|
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,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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KAAK,OAAO;AAAA,EAC9C;AAAA,EAEA,MAAgB,0BAA0B,IAAkB,WAAqE;AAC/H,UAAM,UAAU,KAAK,gBAAgB,IAAI,CAAC,WAAW,GAAG,iBAAiB,UAAU,CAAC,MAAM,MAAM,MAAM,CAAC;AACvG,UAAM,SAAS,QAAQ,IAAI,CAAC,UAAU,GAAG,iBAAiB,KAAK,CAAC;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;AAA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;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"]}
|
package/dist/browser/index.js
CHANGED
|
@@ -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.
|
|
55
|
+
const indexFields = payloads.flatMap((payload) => {
|
|
56
56
|
const transformers = payloadTransformers[payload.schema];
|
|
57
57
|
return transformers ? transformers.map((transform) => transform(payload)) : [];
|
|
58
|
-
})
|
|
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 =
|
|
95
|
+
this._indexableSchemas = Object.keys(this.schemaTransforms);
|
|
96
96
|
return this._indexableSchemas;
|
|
97
97
|
}
|
|
98
98
|
/**
|
|
@@ -131,7 +131,7 @@ var TemporalIndexingDivinerDivinerQueryToIndexQueryDiviner = class extends Abstr
|
|
|
131
131
|
}
|
|
132
132
|
async divineHandler(payloads = []) {
|
|
133
133
|
const queries = payloads.filter(isPayloadOfSchemaType(this.divinerQuerySchema));
|
|
134
|
-
if (queries.length) {
|
|
134
|
+
if (queries.length > 0) {
|
|
135
135
|
const results = await Promise.all(
|
|
136
136
|
queries.map(async (query) => {
|
|
137
137
|
const fields = await reducePayloads(
|
|
@@ -146,7 +146,7 @@ var TemporalIndexingDivinerDivinerQueryToIndexQueryDiviner = class extends Abstr
|
|
|
146
146
|
);
|
|
147
147
|
return results;
|
|
148
148
|
}
|
|
149
|
-
return
|
|
149
|
+
return [];
|
|
150
150
|
}
|
|
151
151
|
};
|
|
152
152
|
|
|
@@ -177,7 +177,7 @@ var TemporalIndexingDivinerIndexCandidateToIndexDiviner = class extends Abstract
|
|
|
177
177
|
*/
|
|
178
178
|
get indexableSchemas() {
|
|
179
179
|
if (!this._indexableSchemas)
|
|
180
|
-
this._indexableSchemas =
|
|
180
|
+
this._indexableSchemas = Object.keys(this.schemaTransforms);
|
|
181
181
|
return this._indexableSchemas;
|
|
182
182
|
}
|
|
183
183
|
/**
|
|
@@ -199,7 +199,7 @@ var TemporalIndexingDivinerIndexCandidateToIndexDiviner = class extends Abstract
|
|
|
199
199
|
async divineHandler(payloads = []) {
|
|
200
200
|
const bws = payloads.filter(isBoundWitness);
|
|
201
201
|
const indexablePayloads = payloads.filter((p) => this.isIndexablePayload(p));
|
|
202
|
-
if (bws.length && indexablePayloads.length) {
|
|
202
|
+
if (bws.length > 0 && indexablePayloads.length > 0) {
|
|
203
203
|
const payloadDictionary = await PayloadHasher2.toMap(payloads);
|
|
204
204
|
const validIndexableTuples = bws.reduce((indexableTuples, bw) => {
|
|
205
205
|
if (!containsAll(bw.payload_schemas, this.indexableSchemas))
|
|
@@ -213,17 +213,17 @@ var TemporalIndexingDivinerIndexCandidateToIndexDiviner = class extends Abstract
|
|
|
213
213
|
}, []);
|
|
214
214
|
const indexes = await Promise.all(
|
|
215
215
|
validIndexableTuples.map(async ([bw, ...sourcePayloads]) => {
|
|
216
|
-
const indexFields = sourcePayloads.
|
|
216
|
+
const indexFields = sourcePayloads.flatMap((payload) => {
|
|
217
217
|
const transformers = this.payloadTransformers[payload.schema];
|
|
218
218
|
return transformers ? transformers.map((transform) => transform(payload)) : [];
|
|
219
|
-
})
|
|
219
|
+
});
|
|
220
220
|
const sources = Object.keys(await PayloadHasher2.toMap([bw, ...sourcePayloads]));
|
|
221
221
|
return await new PayloadBuilder3({ schema: TemporalIndexingDivinerResultIndexSchema2 }).fields(Object.assign({ sources }, ...indexFields)).build();
|
|
222
222
|
})
|
|
223
223
|
);
|
|
224
224
|
return indexes.flat();
|
|
225
225
|
}
|
|
226
|
-
return
|
|
226
|
+
return [];
|
|
227
227
|
}
|
|
228
228
|
/**
|
|
229
229
|
* Identifies if a payload is one that is indexed by this diviner
|
|
@@ -239,7 +239,7 @@ var TemporalIndexingDivinerIndexCandidateToIndexDiviner = class extends Abstract
|
|
|
239
239
|
* @returns True if this schema is one indexed by this diviner, false otherwise
|
|
240
240
|
*/
|
|
241
241
|
isIndexableSchema = (schema) => {
|
|
242
|
-
return this.indexableSchemas.
|
|
242
|
+
return typeof schema === "string" ? this.indexableSchemas.includes(schema) : false;
|
|
243
243
|
};
|
|
244
244
|
};
|
|
245
245
|
|
|
@@ -344,7 +344,7 @@ var TemporalIndexingDivinerStateToIndexCandidateDiviner = class extends Abstract
|
|
|
344
344
|
const results = await archivist.get(hashes);
|
|
345
345
|
const indexCandidateIdentityFunctions = this.payload_schemas.map(isPayloadOfSchemaType2);
|
|
346
346
|
const filteredResults = indexCandidateIdentityFunctions.map((is) => results.find(is));
|
|
347
|
-
if (filteredResults.
|
|
347
|
+
if (filteredResults.includes(void 0))
|
|
348
348
|
return void 0;
|
|
349
349
|
const indexCandidates = filteredResults.filter(exists2);
|
|
350
350
|
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,IAC9B,CAAC;AAAA,EACH;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U;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,WAAW,GAAG,iBAAiB,UAAU,CAAC,MAAM,MAAM,MAAM,CAAC;AACvG,UAAM,SAAS,QAAQ,IAAI,CAAC,UAAU,GAAG,iBAAiB,KAAK,CAAC;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,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AU,GAAG,iBAAiB,KAAK,CAAC;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,
|
|
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,
|
|
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,
|
|
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"}
|