@xyo-network/diviner-temporal-indexing-memory 3.6.9 → 3.6.11
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/index.mjs +87 -144
- package/dist/browser/index.mjs.map +1 -1
- package/dist/neutral/index.mjs +87 -144
- package/dist/neutral/index.mjs.map +1 -1
- package/dist/node/index.mjs +87 -144
- package/dist/node/index.mjs.map +1 -1
- package/package.json +35 -35
package/dist/neutral/index.mjs
CHANGED
|
@@ -1,17 +1,8 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
|
|
4
1
|
// src/Diviner.ts
|
|
5
2
|
import { IndexingDiviner } from "@xyo-network/diviner-indexing-memory";
|
|
6
3
|
import { TemporalIndexingDivinerConfigSchema } from "@xyo-network/diviner-temporal-indexing-model";
|
|
7
4
|
var TemporalIndexingDiviner = class extends IndexingDiviner {
|
|
8
|
-
static
|
|
9
|
-
__name(this, "TemporalIndexingDiviner");
|
|
10
|
-
}
|
|
11
|
-
static configSchemas = [
|
|
12
|
-
...super.configSchemas,
|
|
13
|
-
TemporalIndexingDivinerConfigSchema
|
|
14
|
-
];
|
|
5
|
+
static configSchemas = [...super.configSchemas, TemporalIndexingDivinerConfigSchema];
|
|
15
6
|
static defaultConfigSchema = TemporalIndexingDivinerConfigSchema;
|
|
16
7
|
async startHandler() {
|
|
17
8
|
await super.startHandler();
|
|
@@ -23,17 +14,14 @@ var TemporalIndexingDiviner = class extends IndexingDiviner {
|
|
|
23
14
|
import { AbstractDiviner } from "@xyo-network/diviner-abstract";
|
|
24
15
|
import { jsonPathToTransformersDictionary, reducePayloads } from "@xyo-network/diviner-jsonpath-aggregate-memory";
|
|
25
16
|
import { PayloadDivinerQuerySchema } from "@xyo-network/diviner-payload-model";
|
|
26
|
-
import {
|
|
17
|
+
import {
|
|
18
|
+
TemporalIndexingDivinerDivinerQueryToIndexQueryDivinerConfigSchema,
|
|
19
|
+
TemporalIndexingDivinerResultIndexSchema
|
|
20
|
+
} from "@xyo-network/diviner-temporal-indexing-model";
|
|
27
21
|
import { PayloadBuilder } from "@xyo-network/payload-builder";
|
|
28
22
|
import { isPayloadOfSchemaType } from "@xyo-network/payload-model";
|
|
29
23
|
var TemporalIndexingDivinerDivinerQueryToIndexQueryDiviner = class extends AbstractDiviner {
|
|
30
|
-
static
|
|
31
|
-
__name(this, "TemporalIndexingDivinerDivinerQueryToIndexQueryDiviner");
|
|
32
|
-
}
|
|
33
|
-
static configSchemas = [
|
|
34
|
-
...super.configSchemas,
|
|
35
|
-
TemporalIndexingDivinerDivinerQueryToIndexQueryDivinerConfigSchema
|
|
36
|
-
];
|
|
24
|
+
static configSchemas = [...super.configSchemas, TemporalIndexingDivinerDivinerQueryToIndexQueryDivinerConfigSchema];
|
|
37
25
|
static defaultConfigSchema = TemporalIndexingDivinerDivinerQueryToIndexQueryDivinerConfigSchema;
|
|
38
26
|
static labels = {
|
|
39
27
|
...super.labels,
|
|
@@ -42,42 +30,42 @@ var TemporalIndexingDivinerDivinerQueryToIndexQueryDiviner = class extends Abstr
|
|
|
42
30
|
_indexableSchemas;
|
|
43
31
|
_payloadTransformers;
|
|
44
32
|
/**
|
|
45
|
-
|
|
46
|
-
|
|
33
|
+
* The schema of the diviner query payloads
|
|
34
|
+
*/
|
|
47
35
|
get divinerQuerySchema() {
|
|
48
36
|
return this.config.divinerQuerySchema ?? PayloadDivinerQuerySchema;
|
|
49
37
|
}
|
|
50
38
|
/**
|
|
51
|
-
|
|
52
|
-
|
|
39
|
+
* The schema of the index query payloads
|
|
40
|
+
*/
|
|
53
41
|
get indexQuerySchema() {
|
|
54
42
|
return this.config.indexQuerySchema ?? PayloadDivinerQuerySchema;
|
|
55
43
|
}
|
|
56
44
|
/**
|
|
57
|
-
|
|
58
|
-
|
|
45
|
+
* The schema of the index payloads
|
|
46
|
+
*/
|
|
59
47
|
get indexSchema() {
|
|
60
48
|
return this.config.indexSchema ?? TemporalIndexingDivinerResultIndexSchema;
|
|
61
49
|
}
|
|
62
50
|
/**
|
|
63
|
-
|
|
64
|
-
|
|
51
|
+
* List of indexable schemas for this diviner
|
|
52
|
+
*/
|
|
65
53
|
get indexableSchemas() {
|
|
66
54
|
if (!this._indexableSchemas) this._indexableSchemas = Object.keys(this.schemaTransforms);
|
|
67
55
|
return this._indexableSchemas;
|
|
68
56
|
}
|
|
69
57
|
/**
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
58
|
+
* Dictionary of schemas to payload transformers for creating indexes
|
|
59
|
+
* from the payloads within a Bound Witness
|
|
60
|
+
*/
|
|
73
61
|
get payloadTransformers() {
|
|
74
62
|
if (!this._payloadTransformers) this._payloadTransformers = jsonPathToTransformersDictionary(this.schemaTransforms);
|
|
75
63
|
return this._payloadTransformers;
|
|
76
64
|
}
|
|
77
65
|
/**
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
66
|
+
* The dictionary of schemas to JSON Path transform expressions for creating indexes
|
|
67
|
+
* from the payloads within a Bound Witness
|
|
68
|
+
*/
|
|
81
69
|
get schemaTransforms() {
|
|
82
70
|
return this.config?.schemaTransforms ?? {
|
|
83
71
|
[this.divinerQuerySchema]: [
|
|
@@ -102,19 +90,19 @@ var TemporalIndexingDivinerDivinerQueryToIndexQueryDiviner = class extends Abstr
|
|
|
102
90
|
async divineHandler(payloads = []) {
|
|
103
91
|
const queries = payloads.filter(isPayloadOfSchemaType(this.divinerQuerySchema));
|
|
104
92
|
if (queries.length > 0) {
|
|
105
|
-
return await Promise.all(
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
schema: this.indexQuerySchema
|
|
116
|
-
})
|
|
117
|
-
|
|
93
|
+
return await Promise.all(
|
|
94
|
+
queries.map(async (query) => {
|
|
95
|
+
const fields = await reducePayloads(
|
|
96
|
+
[query],
|
|
97
|
+
this.payloadTransformers,
|
|
98
|
+
this.indexQuerySchema
|
|
99
|
+
);
|
|
100
|
+
fields.schemas = [this.indexSchema];
|
|
101
|
+
delete fields.sources;
|
|
102
|
+
delete fields?.$sources;
|
|
103
|
+
return new PayloadBuilder({ schema: this.indexQuerySchema }).fields(fields).build();
|
|
104
|
+
})
|
|
105
|
+
);
|
|
118
106
|
}
|
|
119
107
|
return [];
|
|
120
108
|
}
|
|
@@ -127,19 +115,16 @@ import { exists } from "@xylabs/exists";
|
|
|
127
115
|
import { isBoundWitness } from "@xyo-network/boundwitness-model";
|
|
128
116
|
import { AbstractDiviner as AbstractDiviner2 } from "@xyo-network/diviner-abstract";
|
|
129
117
|
import { jsonPathToTransformersDictionary as jsonPathToTransformersDictionary2 } from "@xyo-network/diviner-jsonpath-aggregate-memory";
|
|
130
|
-
import {
|
|
118
|
+
import {
|
|
119
|
+
TemporalIndexingDivinerIndexCandidateToIndexDivinerConfigSchema,
|
|
120
|
+
TemporalIndexingDivinerResultIndexSchema as TemporalIndexingDivinerResultIndexSchema2
|
|
121
|
+
} from "@xyo-network/diviner-temporal-indexing-model";
|
|
131
122
|
import { PayloadBuilder as PayloadBuilder2 } from "@xyo-network/payload-builder";
|
|
132
123
|
import { isAnyPayload } from "@xyo-network/payload-model";
|
|
133
124
|
import { intraBoundwitnessSchemaCombinations } from "@xyo-network/payload-utils";
|
|
134
125
|
var moduleName = "TemporalIndexingDivinerIndexCandidateToIndexDiviner";
|
|
135
126
|
var TemporalIndexingDivinerIndexCandidateToIndexDiviner = class extends AbstractDiviner2 {
|
|
136
|
-
static
|
|
137
|
-
__name(this, "TemporalIndexingDivinerIndexCandidateToIndexDiviner");
|
|
138
|
-
}
|
|
139
|
-
static configSchemas = [
|
|
140
|
-
...super.configSchemas,
|
|
141
|
-
TemporalIndexingDivinerIndexCandidateToIndexDivinerConfigSchema
|
|
142
|
-
];
|
|
127
|
+
static configSchemas = [...super.configSchemas, TemporalIndexingDivinerIndexCandidateToIndexDivinerConfigSchema];
|
|
143
128
|
static defaultConfigSchema = TemporalIndexingDivinerIndexCandidateToIndexDivinerConfigSchema;
|
|
144
129
|
static labels = {
|
|
145
130
|
...super.labels,
|
|
@@ -148,24 +133,24 @@ var TemporalIndexingDivinerIndexCandidateToIndexDiviner = class extends Abstract
|
|
|
148
133
|
_indexableSchemas;
|
|
149
134
|
_payloadTransformers;
|
|
150
135
|
/**
|
|
151
|
-
|
|
152
|
-
|
|
136
|
+
* List of indexable schemas for this diviner
|
|
137
|
+
*/
|
|
153
138
|
get indexableSchemas() {
|
|
154
139
|
if (!this._indexableSchemas) this._indexableSchemas = Object.keys(this.schemaTransforms);
|
|
155
140
|
return this._indexableSchemas;
|
|
156
141
|
}
|
|
157
142
|
/**
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
143
|
+
* Dictionary of schemas to payload transformers for creating indexes
|
|
144
|
+
* from the payloads within a Bound Witness
|
|
145
|
+
*/
|
|
161
146
|
get payloadTransformers() {
|
|
162
147
|
if (!this._payloadTransformers) this._payloadTransformers = jsonPathToTransformersDictionary2(this.schemaTransforms);
|
|
163
148
|
return this._payloadTransformers;
|
|
164
149
|
}
|
|
165
150
|
/**
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
151
|
+
* The dictionary of schemas to JSON Path transform expressions for creating indexes
|
|
152
|
+
* from the payloads within a Bound Witness
|
|
153
|
+
*/
|
|
169
154
|
get schemaTransforms() {
|
|
170
155
|
return assertEx(this.config?.schemaTransforms, () => `${moduleName}: Missing config.schemaTransforms section`);
|
|
171
156
|
}
|
|
@@ -183,10 +168,7 @@ var TemporalIndexingDivinerIndexCandidateToIndexDiviner = class extends Abstract
|
|
|
183
168
|
for (const combination of combinations) {
|
|
184
169
|
const indexablePayloads2 = combination.map((hash) => payloadDictionary[hash]).filter(exists);
|
|
185
170
|
if (indexablePayloads2.length === this.indexableSchemas.length) {
|
|
186
|
-
validIndexableTuples.push([
|
|
187
|
-
bwHash,
|
|
188
|
-
...combination
|
|
189
|
-
]);
|
|
171
|
+
validIndexableTuples.push([bwHash, ...combination]);
|
|
190
172
|
}
|
|
191
173
|
}
|
|
192
174
|
}
|
|
@@ -196,34 +178,27 @@ var TemporalIndexingDivinerIndexCandidateToIndexDiviner = class extends Abstract
|
|
|
196
178
|
const transformers = this.payloadTransformers[payload.schema];
|
|
197
179
|
return transformers ? transformers.map((transform) => transform(payload)) : [];
|
|
198
180
|
});
|
|
199
|
-
const $sources = [
|
|
200
|
-
|
|
201
|
-
...sourcePayloadHashes
|
|
202
|
-
];
|
|
203
|
-
return new PayloadBuilder2({
|
|
204
|
-
schema: TemporalIndexingDivinerResultIndexSchema2
|
|
205
|
-
}).fields(Object.assign({}, ...indexFields)).meta({
|
|
206
|
-
$sources
|
|
207
|
-
}).build();
|
|
181
|
+
const $sources = [bwHash, ...sourcePayloadHashes];
|
|
182
|
+
return new PayloadBuilder2({ schema: TemporalIndexingDivinerResultIndexSchema2 }).fields(Object.assign({}, ...indexFields)).meta({ $sources }).build();
|
|
208
183
|
});
|
|
209
184
|
return indexes.flat();
|
|
210
185
|
}
|
|
211
186
|
/**
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
isIndexablePayload =
|
|
187
|
+
* Identifies if a payload is one that is indexed by this diviner
|
|
188
|
+
* @param x The candidate payload
|
|
189
|
+
* @returns True if the payload is one indexed by this diviner, false otherwise
|
|
190
|
+
*/
|
|
191
|
+
isIndexablePayload = (x) => {
|
|
217
192
|
return isAnyPayload(x) && this.indexableSchemas.includes(x?.schema);
|
|
218
|
-
}
|
|
193
|
+
};
|
|
219
194
|
/**
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
isIndexableSchema =
|
|
195
|
+
* Identifies if a schema is one that is indexed by this diviner
|
|
196
|
+
* @param schema The candidate schema
|
|
197
|
+
* @returns True if this schema is one indexed by this diviner, false otherwise
|
|
198
|
+
*/
|
|
199
|
+
isIndexableSchema = (schema) => {
|
|
225
200
|
return typeof schema === "string" ? this.indexableSchemas.includes(schema) : false;
|
|
226
|
-
}
|
|
201
|
+
};
|
|
227
202
|
};
|
|
228
203
|
|
|
229
204
|
// src/IndexQueryResponseToDivinerQueryResponseDiviner/Diviner.ts
|
|
@@ -231,9 +206,6 @@ import { AbstractDiviner as AbstractDiviner3 } from "@xyo-network/diviner-abstra
|
|
|
231
206
|
import { isPayloadDivinerQueryPayload } from "@xyo-network/diviner-payload-model";
|
|
232
207
|
import { TemporalIndexingDivinerIndexQueryResponseToDivinerQueryResponseDivinerConfigSchema } from "@xyo-network/diviner-temporal-indexing-model";
|
|
233
208
|
var TemporalIndexingDivinerIndexQueryResponseToDivinerQueryResponseDiviner = class extends AbstractDiviner3 {
|
|
234
|
-
static {
|
|
235
|
-
__name(this, "TemporalIndexingDivinerIndexQueryResponseToDivinerQueryResponseDiviner");
|
|
236
|
-
}
|
|
237
209
|
static configSchemas = [
|
|
238
210
|
...super.configSchemas,
|
|
239
211
|
TemporalIndexingDivinerIndexQueryResponseToDivinerQueryResponseDivinerConfigSchema
|
|
@@ -266,13 +238,7 @@ import { TimestampSchema } from "@xyo-network/witness-timestamp";
|
|
|
266
238
|
var order = "asc";
|
|
267
239
|
var moduleName2 = "TemporalIndexingDivinerStateToIndexCandidateDiviner";
|
|
268
240
|
var TemporalIndexingDivinerStateToIndexCandidateDiviner = class extends AbstractDiviner4 {
|
|
269
|
-
static
|
|
270
|
-
__name(this, "TemporalIndexingDivinerStateToIndexCandidateDiviner");
|
|
271
|
-
}
|
|
272
|
-
static configSchemas = [
|
|
273
|
-
...super.configSchemas,
|
|
274
|
-
TemporalIndexingDivinerStateToIndexCandidateDivinerConfigSchema
|
|
275
|
-
];
|
|
241
|
+
static configSchemas = [...super.configSchemas, TemporalIndexingDivinerStateToIndexCandidateDivinerConfigSchema];
|
|
276
242
|
static defaultConfigSchema = TemporalIndexingDivinerStateToIndexCandidateDivinerConfigSchema;
|
|
277
243
|
static labels = {
|
|
278
244
|
...super.labels,
|
|
@@ -282,67 +248,49 @@ var TemporalIndexingDivinerStateToIndexCandidateDiviner = class extends Abstract
|
|
|
282
248
|
return this.config.payloadDivinerLimit ?? 1e3;
|
|
283
249
|
}
|
|
284
250
|
/**
|
|
285
|
-
|
|
286
|
-
|
|
251
|
+
* The required payload_schemas within BoundWitnesses to identify index candidates
|
|
252
|
+
*/
|
|
287
253
|
get payload_schemas() {
|
|
288
254
|
const schemas = this.config.filter?.payload_schemas;
|
|
289
|
-
return [
|
|
290
|
-
TimestampSchema,
|
|
291
|
-
...schemas ?? []
|
|
292
|
-
];
|
|
255
|
+
return [TimestampSchema, ...schemas ?? []];
|
|
293
256
|
}
|
|
294
257
|
async divineHandler(payloads = []) {
|
|
295
|
-
const lastState = payloads.find(isModuleState) ?? {
|
|
296
|
-
schema: ModuleStateSchema,
|
|
297
|
-
state: {
|
|
298
|
-
cursor: SequenceConstants.minLocalSequence
|
|
299
|
-
}
|
|
300
|
-
};
|
|
258
|
+
const lastState = payloads.find(isModuleState) ?? { schema: ModuleStateSchema, state: { cursor: SequenceConstants.minLocalSequence } };
|
|
301
259
|
const cursor = lastState?.state?.cursor;
|
|
302
260
|
const sourceArchivist = await this.getArchivistForStore();
|
|
303
|
-
if (!sourceArchivist) return [
|
|
304
|
-
|
|
305
|
-
];
|
|
306
|
-
const nextOffset = {
|
|
307
|
-
limit: this.payloadDivinerLimit,
|
|
308
|
-
order
|
|
309
|
-
};
|
|
261
|
+
if (!sourceArchivist) return [lastState];
|
|
262
|
+
const nextOffset = { limit: this.payloadDivinerLimit, order };
|
|
310
263
|
if (cursor !== SequenceConstants.minLocalSequence) nextOffset.cursor = cursor;
|
|
311
264
|
const next = await sourceArchivist.next(nextOffset);
|
|
312
|
-
if (next.length === 0) return [
|
|
313
|
-
lastState
|
|
314
|
-
];
|
|
265
|
+
if (next.length === 0) return [lastState];
|
|
315
266
|
const batch = filterAs(next, asBoundWitness).filter(exists2).filter((bw) => payloadSchemasContainsAll(bw, this.payload_schemas));
|
|
316
267
|
const indexCandidates = (await Promise.all(batch.map((bw) => this.getPayloadsInBoundWitness(bw, sourceArchivist)))).filter(exists2).flat();
|
|
317
268
|
const nextCursor = assertEx2(next.at(-1)?._sequence, () => `${moduleName2}: Expected next to have a sequence`);
|
|
318
|
-
const nextState = {
|
|
319
|
-
|
|
320
|
-
state: {
|
|
321
|
-
...lastState.state,
|
|
322
|
-
cursor: nextCursor
|
|
323
|
-
}
|
|
324
|
-
};
|
|
325
|
-
return [
|
|
326
|
-
nextState,
|
|
327
|
-
...indexCandidates
|
|
328
|
-
];
|
|
269
|
+
const nextState = { schema: ModuleStateSchema, state: { ...lastState.state, cursor: nextCursor } };
|
|
270
|
+
return [nextState, ...indexCandidates];
|
|
329
271
|
}
|
|
330
272
|
/**
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
273
|
+
* Retrieves the archivist for the payloadStore
|
|
274
|
+
* @returns The archivist for the payloadStore or undefined if not resolvable
|
|
275
|
+
*/
|
|
334
276
|
async getArchivistForStore() {
|
|
335
|
-
const name = assertEx2(
|
|
277
|
+
const name = assertEx2(
|
|
278
|
+
this.config?.payloadStore?.archivist,
|
|
279
|
+
() => `${moduleName2}: Config for payloadStore.archivist not specified`
|
|
280
|
+
);
|
|
336
281
|
const mod = await this.resolve(name);
|
|
337
282
|
if (!mod) return void 0;
|
|
338
283
|
return ArchivistWrapper.wrap(mod, this.account);
|
|
339
284
|
}
|
|
340
285
|
/**
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
286
|
+
* Retrieves the BoundWitness Diviner for the payloadStore
|
|
287
|
+
* @returns The BoundWitness Diviner for the payloadStore or undefined if not resolvable
|
|
288
|
+
*/
|
|
344
289
|
async getBoundWitnessDivinerForStore() {
|
|
345
|
-
const name = assertEx2(
|
|
290
|
+
const name = assertEx2(
|
|
291
|
+
this.config?.payloadStore?.boundWitnessDiviner,
|
|
292
|
+
() => `${moduleName2}: Config for payloadStore.boundWitnessDiviner not specified`
|
|
293
|
+
);
|
|
346
294
|
const mod = await this.resolve(name);
|
|
347
295
|
if (!mod) return;
|
|
348
296
|
return DivinerWrapper.wrap(mod, this.account);
|
|
@@ -351,13 +299,8 @@ var TemporalIndexingDivinerStateToIndexCandidateDiviner = class extends Abstract
|
|
|
351
299
|
const combinations = intraBoundwitnessSchemaCombinations2(bw, this.payload_schemas).flat();
|
|
352
300
|
if (combinations.length === 0) return void 0;
|
|
353
301
|
const hashes = new Set(combinations);
|
|
354
|
-
const indexCandidates = await archivist.get([
|
|
355
|
-
|
|
356
|
-
]);
|
|
357
|
-
return [
|
|
358
|
-
bw,
|
|
359
|
-
...indexCandidates
|
|
360
|
-
];
|
|
302
|
+
const indexCandidates = await archivist.get([...hashes]);
|
|
303
|
+
return [bw, ...indexCandidates];
|
|
361
304
|
}
|
|
362
305
|
};
|
|
363
306
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Diviner.ts","../../src/DivinerQueryToIndexQueryDiviner/Diviner.ts","../../src/IndexCandidateToIndexDiviner/Diviner.ts","../../src/IndexQueryResponseToDivinerQueryResponseDiviner/Diviner.ts","../../src/StateToIndexCandidateDiviner/Diviner.ts"],"sourcesContent":["import { IndexingDiviner } from '@xyo-network/diviner-indexing-memory'\nimport type { DivinerInstance, DivinerModuleEventData } from '@xyo-network/diviner-model'\nimport type { TemporalIndexingDivinerParams } from '@xyo-network/diviner-temporal-indexing-model'\nimport { TemporalIndexingDivinerConfigSchema } from '@xyo-network/diviner-temporal-indexing-model'\nimport type { Payload, Schema } 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<DivinerInstance<TParams, TIn, TOut>, TIn, TOut> = DivinerModuleEventData<\n DivinerInstance<TParams, TIn, TOut>,\n TIn,\n TOut\n >,\n> extends IndexingDiviner<TParams, TIn, TOut, TEventData> {\n static override readonly configSchemas: Schema[] = [...super.configSchemas, TemporalIndexingDivinerConfigSchema]\n static override readonly defaultConfigSchema: Schema = TemporalIndexingDivinerConfigSchema\n\n protected override async startHandler(): Promise<boolean> {\n await super.startHandler()\n return true\n }\n}\n","import type { Hash } from '@xylabs/hex'\nimport { AbstractDiviner } from '@xyo-network/diviner-abstract'\nimport { jsonPathToTransformersDictionary, reducePayloads } from '@xyo-network/diviner-jsonpath-aggregate-memory'\nimport type { SchemaToJsonPathTransformExpressionsDictionary, SchemaToPayloadTransformersDictionary } from '@xyo-network/diviner-jsonpath-model'\nimport type { PayloadDivinerQueryPayload } from '@xyo-network/diviner-payload-model'\nimport { PayloadDivinerQuerySchema } from '@xyo-network/diviner-payload-model'\nimport type { TemporalIndexingDivinerDivinerQueryToIndexQueryDivinerParams } from '@xyo-network/diviner-temporal-indexing-model'\nimport {\n TemporalIndexingDivinerDivinerQueryToIndexQueryDivinerConfigSchema,\n TemporalIndexingDivinerResultIndexSchema,\n} from '@xyo-network/diviner-temporal-indexing-model'\nimport type { Labels } from '@xyo-network/module-model'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport type { Payload, Schema } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType } from '@xyo-network/payload-model'\n// TODO: Inherit from JsonPathAggregateDiviner\n/**\n * A diviner that converts diviner query to index query\n */\nexport class TemporalIndexingDivinerDivinerQueryToIndexQueryDiviner<\n TParams extends TemporalIndexingDivinerDivinerQueryToIndexQueryDivinerParams = TemporalIndexingDivinerDivinerQueryToIndexQueryDivinerParams,\n> extends AbstractDiviner<TParams> {\n static override readonly configSchemas = [...super.configSchemas, TemporalIndexingDivinerDivinerQueryToIndexQueryDivinerConfigSchema]\n static override readonly defaultConfigSchema = TemporalIndexingDivinerDivinerQueryToIndexQueryDivinerConfigSchema\n static override labels: Labels = {\n ...super.labels,\n 'network.xyo.diviner.stage': 'divinerQueryToIndexQueryDiviner',\n }\n\n private _indexableSchemas: Schema[] | undefined\n private _payloadTransformers: SchemaToPayloadTransformersDictionary | undefined\n\n /**\n * The schema of the diviner query payloads\n */\n protected get divinerQuerySchema(): Schema {\n return this.config.divinerQuerySchema ?? PayloadDivinerQuerySchema\n }\n\n /**\n * The schema of the index query payloads\n */\n protected get indexQuerySchema(): Schema {\n return this.config.indexQuerySchema ?? PayloadDivinerQuerySchema\n }\n\n /**\n * The schema of the index payloads\n */\n protected get indexSchema(): Schema {\n return this.config.indexSchema ?? TemporalIndexingDivinerResultIndexSchema\n }\n\n /**\n * List of indexable schemas for this diviner\n */\n protected get indexableSchemas(): Schema[] {\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: 'cursor',\n sourcePathExpression: '$.cursor',\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 // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const queries = payloads.filter(isPayloadOfSchemaType<PayloadDivinerQueryPayload>(this.divinerQuerySchema as any))\n if (queries.length > 0) {\n return await Promise.all(\n queries.map(async (query) => {\n const fields = await reducePayloads<PayloadDivinerQueryPayload & { $sources?: Hash[];sources?: Hash[] }>(\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 delete fields?.$sources\n // TODO: Add support for additional filters\n return new PayloadBuilder<Payload>({ schema: this.indexQuerySchema }).fields(fields).build()\n }),\n )\n }\n return []\n }\n}\n","import { containsAll } from '@xylabs/array'\nimport { assertEx } from '@xylabs/assert'\nimport { exists } from '@xylabs/exists'\nimport type { Hash } from '@xylabs/hex'\nimport type { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { isBoundWitness } from '@xyo-network/boundwitness-model'\nimport { AbstractDiviner } from '@xyo-network/diviner-abstract'\nimport { jsonPathToTransformersDictionary } from '@xyo-network/diviner-jsonpath-aggregate-memory'\nimport type { SchemaToJsonPathTransformExpressionsDictionary, SchemaToPayloadTransformersDictionary } from '@xyo-network/diviner-jsonpath-model'\nimport type {\n TemporalIndexingDivinerIndexCandidateToIndexDivinerParams,\n TemporalIndexingDivinerResultIndex,\n} from '@xyo-network/diviner-temporal-indexing-model'\nimport {\n TemporalIndexingDivinerIndexCandidateToIndexDivinerConfigSchema,\n TemporalIndexingDivinerResultIndexSchema,\n} from '@xyo-network/diviner-temporal-indexing-model'\nimport type { Labels } from '@xyo-network/module-model'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport type { Payload, Schema } from '@xyo-network/payload-model'\nimport { isAnyPayload } from '@xyo-network/payload-model'\nimport { intraBoundwitnessSchemaCombinations } from '@xyo-network/payload-utils'\n\ntype IndexableHashes = [Hash, ...Hash[]]\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 readonly configSchemas: Schema[] = [...super.configSchemas, TemporalIndexingDivinerIndexCandidateToIndexDivinerConfigSchema]\n static override readonly defaultConfigSchema: Schema = TemporalIndexingDivinerIndexCandidateToIndexDivinerConfigSchema\n static override labels: Labels = {\n ...super.labels,\n 'network.xyo.diviner.stage': 'indexCandidateToIndexDiviner',\n }\n\n private _indexableSchemas: string[] | undefined\n private _payloadTransformers: SchemaToPayloadTransformersDictionary | undefined\n\n /**\n * List of indexable schemas for this diviner\n */\n protected get indexableSchemas(): string[] {\n if (!this._indexableSchemas) this._indexableSchemas = Object.keys(this.schemaTransforms)\n return this._indexableSchemas\n }\n\n /**\n * Dictionary of schemas to payload transformers for creating indexes\n * from the payloads within a Bound Witness\n */\n protected get payloadTransformers(): SchemaToPayloadTransformersDictionary {\n if (!this._payloadTransformers) this._payloadTransformers = jsonPathToTransformersDictionary(this.schemaTransforms)\n return this._payloadTransformers\n }\n\n /**\n * The dictionary of schemas to JSON Path transform expressions for creating indexes\n * from the payloads within a Bound Witness\n */\n protected get schemaTransforms(): SchemaToJsonPathTransformExpressionsDictionary {\n return assertEx(this.config?.schemaTransforms, () => `${moduleName}: Missing config.schemaTransforms section`)\n }\n\n protected override async divineHandler(payloads: Payload[] = []): Promise<Payload[]> {\n // If the Bound Witness does not contain all the required schemas do not index it\n const indexableBoundWitnesses = payloads\n .filter(isBoundWitness)\n .filter(bw => containsAll(bw.payload_schemas, this.indexableSchemas))\n // If the Payload is not one of the indexable schemas do not index it\n const indexablePayloads = payloads.filter(p => this.isIndexablePayload(p))\n // If there is nothing to index, return an empty array\n if (indexableBoundWitnesses.length === 0 || indexablePayloads.length === 0) return []\n // Hash all the indexable data once\n const [bwDictionary, payloadDictionary] = await Promise.all([\n PayloadBuilder.toDataHashMap(indexableBoundWitnesses),\n PayloadBuilder.toDataHashMap(indexablePayloads),\n ])\n\n // Initialize the array for validIndexableTuples outside of the loop\n const validIndexableTuples: IndexableHashes[] = []\n\n // Iterate over each entry in bwDictionary\n for (const [bwHash, bw] of Object.entries(bwDictionary) as [Hash, BoundWitness][]) {\n // Find the combinations of payloads that satisfy the required schemas\n const combinations = intraBoundwitnessSchemaCombinations(bw, this.indexableSchemas)\n\n // Iterate over each combination\n for (const combination of combinations) {\n const indexablePayloads = combination.map(hash => payloadDictionary[hash]).filter(exists)\n\n // If we found the right amount of indexable payloads (of the correct schema as checked\n // above) in this BW, then index it\n if (indexablePayloads.length === this.indexableSchemas.length) {\n validIndexableTuples.push([bwHash, ...combination])\n }\n }\n }\n\n // Create the indexes from the tuples\n const indexes = validIndexableTuples.map<TemporalIndexingDivinerResultIndex>(([bwHash, ...sourcePayloadHashes]) => {\n const sourcePayloads = sourcePayloadHashes.map(hash => payloadDictionary[hash])\n // Use the payload transformers to convert the fields from the source payloads to the destination fields\n const indexFields = sourcePayloads.flatMap((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: Hash[] = [bwHash, ...sourcePayloadHashes]\n // Build and return the index\n return new PayloadBuilder<TemporalIndexingDivinerResultIndex>({ schema: TemporalIndexingDivinerResultIndexSchema })\n .fields(Object.assign({}, ...indexFields))\n .meta({ $sources })\n .build()\n })\n return indexes.flat()\n }\n\n /**\n * Identifies if a payload is one that is indexed by this diviner\n * @param x The candidate payload\n * @returns True if the payload is one indexed by this diviner, false otherwise\n */\n protected isIndexablePayload = (x: unknown) => {\n return isAnyPayload(x) && this.indexableSchemas.includes(x?.schema)\n }\n\n /**\n * Identifies if a schema is one that is indexed by this diviner\n * @param schema The candidate schema\n * @returns True if this schema is one indexed by this diviner, false otherwise\n */\n protected isIndexableSchema = (schema?: string | null) => {\n return typeof schema === 'string' ? this.indexableSchemas.includes(schema) : false\n }\n}\n","import { AbstractDiviner } from '@xyo-network/diviner-abstract'\nimport { isPayloadDivinerQueryPayload } from '@xyo-network/diviner-payload-model'\nimport { TemporalIndexingDivinerIndexQueryResponseToDivinerQueryResponseDivinerConfigSchema } from '@xyo-network/diviner-temporal-indexing-model'\nimport type { Labels } from '@xyo-network/module-model'\nimport type { Payload, Schema } 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 configSchemas: Schema[] = [\n ...super.configSchemas,\n TemporalIndexingDivinerIndexQueryResponseToDivinerQueryResponseDivinerConfigSchema,\n ]\n\n static override readonly defaultConfigSchema: Schema = TemporalIndexingDivinerIndexQueryResponseToDivinerQueryResponseDivinerConfigSchema\n static override labels: Labels = {\n ...super.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 { filterAs } from '@xylabs/array'\nimport { assertEx } from '@xylabs/assert'\nimport { exists } from '@xylabs/exists'\nimport type { ArchivistInstance, ArchivistNextOptions } from '@xyo-network/archivist-model'\nimport { ArchivistWrapper } from '@xyo-network/archivist-wrapper'\nimport type { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { asBoundWitness } from '@xyo-network/boundwitness-model'\nimport { payloadSchemasContainsAll } from '@xyo-network/boundwitness-validator'\nimport { AbstractDiviner } from '@xyo-network/diviner-abstract'\nimport type { BoundWitnessDiviner } from '@xyo-network/diviner-boundwitness-abstract'\nimport type { BoundWitnessDivinerParams, BoundWitnessDivinerQueryPayload } from '@xyo-network/diviner-boundwitness-model'\nimport type { IndexingDivinerState } from '@xyo-network/diviner-indexing-model'\nimport type { TemporalIndexingDivinerStateToIndexCandidateDivinerParams } from '@xyo-network/diviner-temporal-indexing-model'\nimport { TemporalIndexingDivinerStateToIndexCandidateDivinerConfigSchema } from '@xyo-network/diviner-temporal-indexing-model'\nimport { DivinerWrapper } from '@xyo-network/diviner-wrapper'\nimport type {\n Labels, ModuleIdentifier, ModuleState,\n} from '@xyo-network/module-model'\nimport { isModuleState, ModuleStateSchema } from '@xyo-network/module-model'\nimport type {\n Payload, Schema,\n WithStorageMeta,\n} from '@xyo-network/payload-model'\nimport { SequenceConstants } from '@xyo-network/payload-model'\nimport { intraBoundwitnessSchemaCombinations } from '@xyo-network/payload-utils'\nimport type { TimeStamp } from '@xyo-network/witness-timestamp'\nimport { 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, Payload, ModuleState | IndexCandidate> {\n static override readonly configSchemas: Schema[] = [...super.configSchemas, TemporalIndexingDivinerStateToIndexCandidateDivinerConfigSchema]\n static override readonly defaultConfigSchema: Schema = TemporalIndexingDivinerStateToIndexCandidateDivinerConfigSchema\n static override labels: Labels = {\n ...super.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<TemporalStateToIndexCandidateDivinerResponse> {\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 ?? { schema: ModuleStateSchema, state: { cursor: SequenceConstants.minLocalSequence } }\n\n // Get the last cursor\n const cursor = lastState?.state?.cursor\n // Get the archivist for the store\n const sourceArchivist = await this.getArchivistForStore()\n if (!sourceArchivist) return [lastState]\n\n // Get the next batch of results\n const nextOffset: ArchivistNextOptions = { limit: this.payloadDivinerLimit, order }\n // Only use the cursor if it's a valid offset\n if (cursor !== SequenceConstants.minLocalSequence) nextOffset.cursor = cursor\n // Get next batch of results starting from the offset\n const next = await sourceArchivist.next(nextOffset)\n if (next.length === 0) return [lastState]\n\n const batch = filterAs(next, asBoundWitness)\n .filter(exists)\n .filter(bw => payloadSchemasContainsAll(bw, this.payload_schemas))\n // Get source data\n const indexCandidates: IndexCandidate[] = (await Promise.all(batch.map(bw => this.getPayloadsInBoundWitness(bw, sourceArchivist))))\n .filter(exists)\n .flat()\n const nextCursor = assertEx(next.at(-1)?._sequence, () => `${moduleName}: Expected next to have a sequence`)\n const nextState: ModuleState<IndexingDivinerState> = { schema: ModuleStateSchema, state: { ...lastState.state, cursor: nextCursor } }\n return [nextState, ...indexCandidates]\n }\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: ModuleIdentifier = assertEx(\n this.config?.payloadStore?.archivist,\n () => `${moduleName}: Config for payloadStore.archivist 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 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() {\n // It should be defined, so we'll error if it's not\n const name: ModuleIdentifier = 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\n // Return the wrapped diviner\n return DivinerWrapper.wrap<\n DivinerWrapper<\n BoundWitnessDiviner<BoundWitnessDivinerParams, BoundWitnessDivinerQueryPayload, BoundWitness>,\n BoundWitnessDivinerQueryPayload,\n WithStorageMeta<BoundWitness>\n >\n >(mod, this.account)\n }\n\n protected async getPayloadsInBoundWitness(bw: BoundWitness, archivist: ArchivistInstance): Promise<IndexCandidate[] | undefined> {\n const combinations = intraBoundwitnessSchemaCombinations(bw, this.payload_schemas).flat()\n if (combinations.length === 0) return undefined\n const hashes = new Set(combinations)\n const indexCandidates = await archivist.get([...hashes])\n return [bw, ...indexCandidates]\n }\n}\n"],"mappings":";;;;AAAA,SAASA,uBAAuB;AAGhC,SAASC,2CAA2C;AAG7C,IAAMC,0BAAN,cASGC,gBAAAA;EAfV,OAeUA;;;EACR,OAAyBC,gBAA0B;OAAI,MAAMA;IAAeC;;EAC5E,OAAyBC,sBAA8BD;EAEvD,MAAyBE,eAAiC;AACxD,UAAM,MAAMA,aAAAA;AACZ,WAAO;EACT;AACF;;;ACtBA,SAASC,uBAAuB;AAChC,SAASC,kCAAkCC,sBAAsB;AAGjE,SAASC,iCAAiC;AAE1C,SACEC,oEACAC,gDACK;AAEP,SAASC,sBAAsB;AA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uBAA8D;AAE5E,UAAMsB,OAAyBJ,UAC7B,KAAKnC,QAAQwC,cAAcC,WAC3B,MAAM,GAAGjD,WAAAA,mDAA6D;AAGxE,UAAMkD,MAAM,MAAM,KAAKC,QAAQJ,IAAAA;AAC/B,QAAI,CAACG,IAAK,QAAOE;AAEjB,WAAOC,iBAAiBC,KAAKJ,KAAK,KAAKK,OAAO;EAChD;;;;;EAMA,MAAgBC,iCAAiC;AAE/C,UAAMT,OAAyBJ,UAC7B,KAAKnC,QAAQwC,cAAcS,qBAC3B,MAAM,GAAGzD,WAAAA,6DAAuE;AAGlF,UAAMkD,MAAM,MAAM,KAAKC,QAAQJ,IAAAA;AAC/B,QAAI,CAACG,IAAK;AAEV,WAAOQ,eAAeJ,KAMpBJ,KAAK,KAAKK,OAAO;EACrB;EAEA,MAAgBf,0BAA0BN,IAAkBe,WAAqE;AAC/H,UAAMU,eAAeC,qCAAoC1B,IAAI,KAAKzB,eAAe,EAAEgC,KAAI;AACvF,QAAIkB,aAAa9B,WAAW,EAAG,QAAOuB;AACtC,UAAMS,SAAS,IAAIC,IAAIH,YAAAA;AACvB,UAAMvB,kBAAkB,MAAMa,UAAUc,IAAI;SAAIF;KAAO;AACvD,WAAO;MAAC3B;SAAOE;;EACjB;AACF;","names":["IndexingDiviner","TemporalIndexingDivinerConfigSchema","TemporalIndexingDiviner","IndexingDiviner","configSchemas","TemporalIndexingDivinerConfigSchema","defaultConfigSchema","startHandler","AbstractDiviner","jsonPathToTransformersDictionary","reducePayloads","PayloadDivinerQuerySchema","TemporalIndexingDivinerDivinerQueryToIndexQueryDivinerConfigSchema","TemporalIndexingDivinerResultIndexSchema","PayloadBuilder","isPayloadOfSchemaType","TemporalIndexingDivinerDivinerQueryToIndexQueryDiviner","AbstractDiviner","configSchemas","TemporalIndexingDivinerDivinerQueryToIndexQueryDivinerConfigSchema","defaultConfigSchema","labels","_indexableSchemas","_payloadTransformers","divinerQuerySchema","config","PayloadDivinerQuerySchema","indexQuerySchema","indexSchema","TemporalIndexingDivinerResultIndexSchema","indexableSchemas","Object","keys","schemaTransforms","payloadTransformers","jsonPathToTransformersDictionary","defaultValue","destinationField","sourcePathExpression","divineHandler","payloads","queries","filter","isPayloadOfSchemaType","length","Promise","all","map","query","fields","reducePayloads","schemas","sources","$sources","PayloadBuilder","schema","build","containsAll","assertEx","exists","isBoundWitness","AbstractDiviner","jsonPathToTransformersDictionary","TemporalIndexingDivinerIndexCandidateToIndexDivinerConfigSchema","TemporalIndexingDivinerResultIndexSchema","PayloadBuilder","isAnyPayload","intraBoundwitnessSchemaCombinations","moduleName","TemporalIndexingDivinerIndexCandidateToIndexDiviner","AbstractDiviner","configSchemas","TemporalIndexingDivinerIndexCandidateToIndexDivinerConfigSchema","defaultConfigSchema","labels","_indexableSchemas","_payloadTransformers","indexableSchemas","Object","keys","schemaTransforms","payloadTransformers","jsonPathToTransformersDictionary","assertEx","config","divineHandler","payloads","indexableBoundWitnesses","filter","isBoundWitness","bw","containsAll","payload_schemas","indexablePayloads","p","isIndexablePayload","length","bwDictionary","payloadDictionary","Promise","all","PayloadBuilder","toDataHashMap","validIndexableTuples","bwHash","entries","combinations","intraBoundwitnessSchemaCombinations","combination","map","hash","exists","push","indexes","sourcePayloadHashes","sourcePayloads","indexFields","flatMap","payload","transformers","schema","transform","$sources","TemporalIndexingDivinerResultIndexSchema","fields","assign","meta","build","flat","x","isAnyPayload","includes","isIndexableSchema","AbstractDiviner","isPayloadDivinerQueryPayload","TemporalIndexingDivinerIndexQueryResponseToDivinerQueryResponseDivinerConfigSchema","TemporalIndexingDivinerIndexQueryResponseToDivinerQueryResponseDiviner","AbstractDiviner","configSchemas","TemporalIndexingDivinerIndexQueryResponseToDivinerQueryResponseDivinerConfigSchema","defaultConfigSchema","labels","divineHandler","payloads","responses","filter","p","isPayloadDivinerQueryPayload","Promise","resolve","filterAs","assertEx","exists","ArchivistWrapper","asBoundWitness","payloadSchemasContainsAll","AbstractDiviner","TemporalIndexingDivinerStateToIndexCandidateDivinerConfigSchema","DivinerWrapper","isModuleState","ModuleStateSchema","SequenceConstants","intraBoundwitnessSchemaCombinations","TimestampSchema","order","moduleName","TemporalIndexingDivinerStateToIndexCandidateDiviner","AbstractDiviner","configSchemas","TemporalIndexingDivinerStateToIndexCandidateDivinerConfigSchema","defaultConfigSchema","labels","payloadDivinerLimit","config","payload_schemas","schemas","filter","TimestampSchema","divineHandler","payloads","lastState","find","isModuleState","schema","ModuleStateSchema","state","cursor","SequenceConstants","minLocalSequence","sourceArchivist","getArchivistForStore","nextOffset","limit","next","length","batch","filterAs","asBoundWitness","exists","bw","payloadSchemasContainsAll","indexCandidates","Promise","all","map","getPayloadsInBoundWitness","flat","nextCursor","assertEx","at","_sequence","nextState","name","payloadStore","archivist","mod","resolve","undefined","ArchivistWrapper","wrap","account","getBoundWitnessDivinerForStore","boundWitnessDiviner","DivinerWrapper","combinations","intraBoundwitnessSchemaCombinations","hashes","Set","get"]}
|
|
1
|
+
{"version":3,"sources":["../../src/Diviner.ts","../../src/DivinerQueryToIndexQueryDiviner/Diviner.ts","../../src/IndexCandidateToIndexDiviner/Diviner.ts","../../src/IndexQueryResponseToDivinerQueryResponseDiviner/Diviner.ts","../../src/StateToIndexCandidateDiviner/Diviner.ts"],"sourcesContent":["import { IndexingDiviner } from '@xyo-network/diviner-indexing-memory'\nimport type { DivinerInstance, DivinerModuleEventData } from '@xyo-network/diviner-model'\nimport type { TemporalIndexingDivinerParams } from '@xyo-network/diviner-temporal-indexing-model'\nimport { TemporalIndexingDivinerConfigSchema } from '@xyo-network/diviner-temporal-indexing-model'\nimport type { Payload, Schema } 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<DivinerInstance<TParams, TIn, TOut>, TIn, TOut> = DivinerModuleEventData<\n DivinerInstance<TParams, TIn, TOut>,\n TIn,\n TOut\n >,\n> extends IndexingDiviner<TParams, TIn, TOut, TEventData> {\n static override readonly configSchemas: Schema[] = [...super.configSchemas, TemporalIndexingDivinerConfigSchema]\n static override readonly defaultConfigSchema: Schema = TemporalIndexingDivinerConfigSchema\n\n protected override async startHandler(): Promise<boolean> {\n await super.startHandler()\n return true\n }\n}\n","import type { Hash } from '@xylabs/hex'\nimport { AbstractDiviner } from '@xyo-network/diviner-abstract'\nimport { jsonPathToTransformersDictionary, reducePayloads } from '@xyo-network/diviner-jsonpath-aggregate-memory'\nimport type { SchemaToJsonPathTransformExpressionsDictionary, SchemaToPayloadTransformersDictionary } from '@xyo-network/diviner-jsonpath-model'\nimport type { PayloadDivinerQueryPayload } from '@xyo-network/diviner-payload-model'\nimport { PayloadDivinerQuerySchema } from '@xyo-network/diviner-payload-model'\nimport type { TemporalIndexingDivinerDivinerQueryToIndexQueryDivinerParams } from '@xyo-network/diviner-temporal-indexing-model'\nimport {\n TemporalIndexingDivinerDivinerQueryToIndexQueryDivinerConfigSchema,\n TemporalIndexingDivinerResultIndexSchema,\n} from '@xyo-network/diviner-temporal-indexing-model'\nimport type { Labels } from '@xyo-network/module-model'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport type { Payload, Schema } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType } from '@xyo-network/payload-model'\n// TODO: Inherit from JsonPathAggregateDiviner\n/**\n * A diviner that converts diviner query to index query\n */\nexport class TemporalIndexingDivinerDivinerQueryToIndexQueryDiviner<\n TParams extends TemporalIndexingDivinerDivinerQueryToIndexQueryDivinerParams = TemporalIndexingDivinerDivinerQueryToIndexQueryDivinerParams,\n> extends AbstractDiviner<TParams> {\n static override readonly configSchemas = [...super.configSchemas, TemporalIndexingDivinerDivinerQueryToIndexQueryDivinerConfigSchema]\n static override readonly defaultConfigSchema = TemporalIndexingDivinerDivinerQueryToIndexQueryDivinerConfigSchema\n static override labels: Labels = {\n ...super.labels,\n 'network.xyo.diviner.stage': 'divinerQueryToIndexQueryDiviner',\n }\n\n private _indexableSchemas: Schema[] | undefined\n private _payloadTransformers: SchemaToPayloadTransformersDictionary | undefined\n\n /**\n * The schema of the diviner query payloads\n */\n protected get divinerQuerySchema(): Schema {\n return this.config.divinerQuerySchema ?? PayloadDivinerQuerySchema\n }\n\n /**\n * The schema of the index query payloads\n */\n protected get indexQuerySchema(): Schema {\n return this.config.indexQuerySchema ?? PayloadDivinerQuerySchema\n }\n\n /**\n * The schema of the index payloads\n */\n protected get indexSchema(): Schema {\n return this.config.indexSchema ?? TemporalIndexingDivinerResultIndexSchema\n }\n\n /**\n * List of indexable schemas for this diviner\n */\n protected get indexableSchemas(): Schema[] {\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: 'cursor',\n sourcePathExpression: '$.cursor',\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 // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const queries = payloads.filter(isPayloadOfSchemaType<PayloadDivinerQueryPayload>(this.divinerQuerySchema as any))\n if (queries.length > 0) {\n return await Promise.all(\n queries.map(async (query) => {\n const fields = await reducePayloads<PayloadDivinerQueryPayload & { $sources?: Hash[];sources?: Hash[] }>(\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 delete fields?.$sources\n // TODO: Add support for additional filters\n return new PayloadBuilder<Payload>({ schema: this.indexQuerySchema }).fields(fields).build()\n }),\n )\n }\n return []\n }\n}\n","import { containsAll } from '@xylabs/array'\nimport { assertEx } from '@xylabs/assert'\nimport { exists } from '@xylabs/exists'\nimport type { Hash } from '@xylabs/hex'\nimport type { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { isBoundWitness } from '@xyo-network/boundwitness-model'\nimport { AbstractDiviner } from '@xyo-network/diviner-abstract'\nimport { jsonPathToTransformersDictionary } from '@xyo-network/diviner-jsonpath-aggregate-memory'\nimport type { SchemaToJsonPathTransformExpressionsDictionary, SchemaToPayloadTransformersDictionary } from '@xyo-network/diviner-jsonpath-model'\nimport type {\n TemporalIndexingDivinerIndexCandidateToIndexDivinerParams,\n TemporalIndexingDivinerResultIndex,\n} from '@xyo-network/diviner-temporal-indexing-model'\nimport {\n TemporalIndexingDivinerIndexCandidateToIndexDivinerConfigSchema,\n TemporalIndexingDivinerResultIndexSchema,\n} from '@xyo-network/diviner-temporal-indexing-model'\nimport type { Labels } from '@xyo-network/module-model'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport type { Payload, Schema } from '@xyo-network/payload-model'\nimport { isAnyPayload } from '@xyo-network/payload-model'\nimport { intraBoundwitnessSchemaCombinations } from '@xyo-network/payload-utils'\n\ntype IndexableHashes = [Hash, ...Hash[]]\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 readonly configSchemas: Schema[] = [...super.configSchemas, TemporalIndexingDivinerIndexCandidateToIndexDivinerConfigSchema]\n static override readonly defaultConfigSchema: Schema = TemporalIndexingDivinerIndexCandidateToIndexDivinerConfigSchema\n static override labels: Labels = {\n ...super.labels,\n 'network.xyo.diviner.stage': 'indexCandidateToIndexDiviner',\n }\n\n private _indexableSchemas: string[] | undefined\n private _payloadTransformers: SchemaToPayloadTransformersDictionary | undefined\n\n /**\n * List of indexable schemas for this diviner\n */\n protected get indexableSchemas(): string[] {\n if (!this._indexableSchemas) this._indexableSchemas = Object.keys(this.schemaTransforms)\n return this._indexableSchemas\n }\n\n /**\n * Dictionary of schemas to payload transformers for creating indexes\n * from the payloads within a Bound Witness\n */\n protected get payloadTransformers(): SchemaToPayloadTransformersDictionary {\n if (!this._payloadTransformers) this._payloadTransformers = jsonPathToTransformersDictionary(this.schemaTransforms)\n return this._payloadTransformers\n }\n\n /**\n * The dictionary of schemas to JSON Path transform expressions for creating indexes\n * from the payloads within a Bound Witness\n */\n protected get schemaTransforms(): SchemaToJsonPathTransformExpressionsDictionary {\n return assertEx(this.config?.schemaTransforms, () => `${moduleName}: Missing config.schemaTransforms section`)\n }\n\n protected override async divineHandler(payloads: Payload[] = []): Promise<Payload[]> {\n // If the Bound Witness does not contain all the required schemas do not index it\n const indexableBoundWitnesses = payloads\n .filter(isBoundWitness)\n .filter(bw => containsAll(bw.payload_schemas, this.indexableSchemas))\n // If the Payload is not one of the indexable schemas do not index it\n const indexablePayloads = payloads.filter(p => this.isIndexablePayload(p))\n // If there is nothing to index, return an empty array\n if (indexableBoundWitnesses.length === 0 || indexablePayloads.length === 0) return []\n // Hash all the indexable data once\n const [bwDictionary, payloadDictionary] = await Promise.all([\n PayloadBuilder.toDataHashMap(indexableBoundWitnesses),\n PayloadBuilder.toDataHashMap(indexablePayloads),\n ])\n\n // Initialize the array for validIndexableTuples outside of the loop\n const validIndexableTuples: IndexableHashes[] = []\n\n // Iterate over each entry in bwDictionary\n for (const [bwHash, bw] of Object.entries(bwDictionary) as [Hash, BoundWitness][]) {\n // Find the combinations of payloads that satisfy the required schemas\n const combinations = intraBoundwitnessSchemaCombinations(bw, this.indexableSchemas)\n\n // Iterate over each combination\n for (const combination of combinations) {\n const indexablePayloads = combination.map(hash => payloadDictionary[hash]).filter(exists)\n\n // If we found the right amount of indexable payloads (of the correct schema as checked\n // above) in this BW, then index it\n if (indexablePayloads.length === this.indexableSchemas.length) {\n validIndexableTuples.push([bwHash, ...combination])\n }\n }\n }\n\n // Create the indexes from the tuples\n const indexes = validIndexableTuples.map<TemporalIndexingDivinerResultIndex>(([bwHash, ...sourcePayloadHashes]) => {\n const sourcePayloads = sourcePayloadHashes.map(hash => payloadDictionary[hash])\n // Use the payload transformers to convert the fields from the source payloads to the destination fields\n const indexFields = sourcePayloads.flatMap((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: Hash[] = [bwHash, ...sourcePayloadHashes]\n // Build and return the index\n return new PayloadBuilder<TemporalIndexingDivinerResultIndex>({ schema: TemporalIndexingDivinerResultIndexSchema })\n .fields(Object.assign({}, ...indexFields))\n .meta({ $sources })\n .build()\n })\n return indexes.flat()\n }\n\n /**\n * Identifies if a payload is one that is indexed by this diviner\n * @param x The candidate payload\n * @returns True if the payload is one indexed by this diviner, false otherwise\n */\n protected isIndexablePayload = (x: unknown) => {\n return isAnyPayload(x) && this.indexableSchemas.includes(x?.schema)\n }\n\n /**\n * Identifies if a schema is one that is indexed by this diviner\n * @param schema The candidate schema\n * @returns True if this schema is one indexed by this diviner, false otherwise\n */\n protected isIndexableSchema = (schema?: string | null) => {\n return typeof schema === 'string' ? this.indexableSchemas.includes(schema) : false\n }\n}\n","import { AbstractDiviner } from '@xyo-network/diviner-abstract'\nimport { isPayloadDivinerQueryPayload } from '@xyo-network/diviner-payload-model'\nimport { TemporalIndexingDivinerIndexQueryResponseToDivinerQueryResponseDivinerConfigSchema } from '@xyo-network/diviner-temporal-indexing-model'\nimport type { Labels } from '@xyo-network/module-model'\nimport type { Payload, Schema } 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 configSchemas: Schema[] = [\n ...super.configSchemas,\n TemporalIndexingDivinerIndexQueryResponseToDivinerQueryResponseDivinerConfigSchema,\n ]\n\n static override readonly defaultConfigSchema: Schema = TemporalIndexingDivinerIndexQueryResponseToDivinerQueryResponseDivinerConfigSchema\n static override labels: Labels = {\n ...super.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 { filterAs } from '@xylabs/array'\nimport { assertEx } from '@xylabs/assert'\nimport { exists } from '@xylabs/exists'\nimport type { ArchivistInstance, ArchivistNextOptions } from '@xyo-network/archivist-model'\nimport { ArchivistWrapper } from '@xyo-network/archivist-wrapper'\nimport type { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { asBoundWitness } from '@xyo-network/boundwitness-model'\nimport { payloadSchemasContainsAll } from '@xyo-network/boundwitness-validator'\nimport { AbstractDiviner } from '@xyo-network/diviner-abstract'\nimport type { BoundWitnessDiviner } from '@xyo-network/diviner-boundwitness-abstract'\nimport type { BoundWitnessDivinerParams, BoundWitnessDivinerQueryPayload } from '@xyo-network/diviner-boundwitness-model'\nimport type { IndexingDivinerState } from '@xyo-network/diviner-indexing-model'\nimport type { TemporalIndexingDivinerStateToIndexCandidateDivinerParams } from '@xyo-network/diviner-temporal-indexing-model'\nimport { TemporalIndexingDivinerStateToIndexCandidateDivinerConfigSchema } from '@xyo-network/diviner-temporal-indexing-model'\nimport { DivinerWrapper } from '@xyo-network/diviner-wrapper'\nimport type {\n Labels, ModuleIdentifier, ModuleState,\n} from '@xyo-network/module-model'\nimport { isModuleState, ModuleStateSchema } from '@xyo-network/module-model'\nimport type {\n Payload, Schema,\n WithStorageMeta,\n} from '@xyo-network/payload-model'\nimport { SequenceConstants } from '@xyo-network/payload-model'\nimport { intraBoundwitnessSchemaCombinations } from '@xyo-network/payload-utils'\nimport type { TimeStamp } from '@xyo-network/witness-timestamp'\nimport { 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, Payload, ModuleState | IndexCandidate> {\n static override readonly configSchemas: Schema[] = [...super.configSchemas, TemporalIndexingDivinerStateToIndexCandidateDivinerConfigSchema]\n static override readonly defaultConfigSchema: Schema = TemporalIndexingDivinerStateToIndexCandidateDivinerConfigSchema\n static override labels: Labels = {\n ...super.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<TemporalStateToIndexCandidateDivinerResponse> {\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 ?? { schema: ModuleStateSchema, state: { cursor: SequenceConstants.minLocalSequence } }\n\n // Get the last cursor\n const cursor = lastState?.state?.cursor\n // Get the archivist for the store\n const sourceArchivist = await this.getArchivistForStore()\n if (!sourceArchivist) return [lastState]\n\n // Get the next batch of results\n const nextOffset: ArchivistNextOptions = { limit: this.payloadDivinerLimit, order }\n // Only use the cursor if it's a valid offset\n if (cursor !== SequenceConstants.minLocalSequence) nextOffset.cursor = cursor\n // Get next batch of results starting from the offset\n const next = await sourceArchivist.next(nextOffset)\n if (next.length === 0) return [lastState]\n\n const batch = filterAs(next, asBoundWitness)\n .filter(exists)\n .filter(bw => payloadSchemasContainsAll(bw, this.payload_schemas))\n // Get source data\n const indexCandidates: IndexCandidate[] = (await Promise.all(batch.map(bw => this.getPayloadsInBoundWitness(bw, sourceArchivist))))\n .filter(exists)\n .flat()\n const nextCursor = assertEx(next.at(-1)?._sequence, () => `${moduleName}: Expected next to have a sequence`)\n const nextState: ModuleState<IndexingDivinerState> = { schema: ModuleStateSchema, state: { ...lastState.state, cursor: nextCursor } }\n return [nextState, ...indexCandidates]\n }\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: ModuleIdentifier = assertEx(\n this.config?.payloadStore?.archivist,\n () => `${moduleName}: Config for payloadStore.archivist 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 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() {\n // It should be defined, so we'll error if it's not\n const name: ModuleIdentifier = 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\n // Return the wrapped diviner\n return DivinerWrapper.wrap<\n DivinerWrapper<\n BoundWitnessDiviner<BoundWitnessDivinerParams, BoundWitnessDivinerQueryPayload, BoundWitness>,\n BoundWitnessDivinerQueryPayload,\n WithStorageMeta<BoundWitness>\n >\n >(mod, this.account)\n }\n\n protected async getPayloadsInBoundWitness(bw: BoundWitness, archivist: ArchivistInstance): Promise<IndexCandidate[] | undefined> {\n const combinations = intraBoundwitnessSchemaCombinations(bw, this.payload_schemas).flat()\n if (combinations.length === 0) return undefined\n const hashes = new Set(combinations)\n const indexCandidates = await archivist.get([...hashes])\n return [bw, ...indexCandidates]\n }\n}\n"],"mappings":";AAAA,SAAS,uBAAuB;AAGhC,SAAS,2CAA2C;AAG7C,IAAM,0BAAN,cASG,gBAAgD;AAAA,EACxD,OAAyB,gBAA0B,CAAC,GAAG,MAAM,eAAe,mCAAmC;AAAA,EAC/G,OAAyB,sBAA8B;AAAA,EAEvD,MAAyB,eAAiC;AACxD,UAAM,MAAM,aAAa;AACzB,WAAO;AAAA,EACT;AACF;;;ACtBA,SAAS,uBAAuB;AAChC,SAAS,kCAAkC,sBAAsB;AAGjE,SAAS,iCAAiC;AAE1C;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAEP,SAAS,sBAAsB;AAE/B,SAA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","PayloadBuilder","indexablePayloads","AbstractDiviner","assertEx","exists","AbstractDiviner","intraBoundwitnessSchemaCombinations","moduleName"]}
|