@xyo-network/diviner-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.
@@ -1,5 +1,18 @@
1
1
  var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getProtoOf = Object.getPrototypeOf;
4
+ var __reflectGet = Reflect.get;
5
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
+ var __decorateClass = (decorators, target, key, kind) => {
7
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
8
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
9
+ if (decorator = decorators[i])
10
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
11
+ if (kind && result) __defProp(target, key, result);
12
+ return result;
13
+ };
14
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
15
+ var __superGet = (cls, obj, key) => __reflectGet(__getProtoOf(cls), key, obj);
3
16
 
4
17
  // src/Diviner.ts
5
18
  import { assertEx } from "@xylabs/assert";
@@ -9,30 +22,24 @@ import { BoundWitnessBuilder } from "@xyo-network/boundwitness-builder";
9
22
  import { isBoundWitness } from "@xyo-network/boundwitness-model";
10
23
  import { AbstractDiviner } from "@xyo-network/diviner-abstract";
11
24
  import { BoundWitnessDivinerQuerySchema } from "@xyo-network/diviner-boundwitness-model";
12
- import { IndexingDivinerConfigSchema } from "@xyo-network/diviner-indexing-model";
13
- import { asDivinerInstance } from "@xyo-network/diviner-model";
25
+ import {
26
+ IndexingDivinerConfigSchema
27
+ } from "@xyo-network/diviner-indexing-model";
28
+ import {
29
+ asDivinerInstance
30
+ } from "@xyo-network/diviner-model";
14
31
  import { DivinerWrapper } from "@xyo-network/diviner-wrapper";
15
- import { creatableModule, isModuleState, ModuleStateSchema } from "@xyo-network/module-model";
32
+ import {
33
+ creatableModule,
34
+ isModuleState,
35
+ ModuleStateSchema
36
+ } from "@xyo-network/module-model";
16
37
  import { PayloadBuilder } from "@xyo-network/payload-builder";
17
- import { SequenceConstants } from "@xyo-network/payload-model";
18
- function _ts_decorate(decorators, target, key, desc) {
19
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
20
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
21
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
22
- return c > 3 && r && Object.defineProperty(target, key, r), r;
23
- }
24
- __name(_ts_decorate, "_ts_decorate");
38
+ import {
39
+ SequenceConstants
40
+ } from "@xyo-network/payload-model";
25
41
  var moduleName = "IndexingDiviner";
26
42
  var IndexingDiviner = class extends AbstractDiviner {
27
- static {
28
- __name(this, "IndexingDiviner");
29
- }
30
- static allowRandomAccount = false;
31
- static configSchemas = [
32
- ...super.configSchemas,
33
- IndexingDivinerConfigSchema
34
- ];
35
- static defaultConfigSchema = IndexingDivinerConfigSchema;
36
43
  _lastState;
37
44
  _pollId;
38
45
  get payloadDivinerLimit() {
@@ -42,15 +49,13 @@ var IndexingDiviner = class extends AbstractDiviner {
42
49
  return this.config.pollFrequency ?? 1e4;
43
50
  }
44
51
  /**
45
- * Works via batched iteration of the source archivist to populate the index.
46
- * @returns A promise that resolves when the background process is complete
47
- */
48
- backgroundDivine = /* @__PURE__ */ __name(async () => {
52
+ * Works via batched iteration of the source archivist to populate the index.
53
+ * @returns A promise that resolves when the background process is complete
54
+ */
55
+ backgroundDivine = async () => {
49
56
  const lastState = await this.retrieveState();
50
57
  const indexCandidateDiviner = await this.getIndexingDivinerStage("stateToIndexCandidateDiviner");
51
- const results = lastState ? await indexCandidateDiviner.divine([
52
- lastState
53
- ]) : await indexCandidateDiviner.divine();
58
+ const results = lastState ? await indexCandidateDiviner.divine([lastState]) : await indexCandidateDiviner.divine();
54
59
  const nextState = results.find(isModuleState);
55
60
  const indexCandidates = results.filter((x) => !isModuleState(x));
56
61
  const toIndexTransformDiviner = await this.getIndexingDivinerStage("indexCandidateToIndexDiviner");
@@ -60,118 +65,109 @@ var IndexingDiviner = class extends AbstractDiviner {
60
65
  if (nextState) {
61
66
  await this.commitState(nextState);
62
67
  }
63
- }, "backgroundDivine");
68
+ };
64
69
  /**
65
- * Commit the internal state of the Diviner process. This is similar
66
- * to a transaction completion in a database and should only be called
67
- * when results have been successfully persisted to the appropriate
68
- * external stores.
69
- * @param nextState The state to commit
70
- */
70
+ * Commit the internal state of the Diviner process. This is similar
71
+ * to a transaction completion in a database and should only be called
72
+ * when results have been successfully persisted to the appropriate
73
+ * external stores.
74
+ * @param nextState The state to commit
75
+ */
71
76
  async commitState(nextState) {
72
77
  if (nextState.state.cursor === this._lastState?.state.cursor) return;
73
78
  this._lastState = nextState;
74
79
  const archivist = await this.getArchivistForStore("stateStore");
75
80
  const [bw] = await new BoundWitnessBuilder().payload(nextState).signer(this.account).build();
76
- await archivist.insert([
77
- bw,
78
- nextState
79
- ]);
81
+ await archivist.insert([bw, nextState]);
80
82
  }
81
83
  async divineHandler(payloads = []) {
82
84
  const indexPayloadDiviner = await this.getPayloadDivinerForStore("indexStore");
83
85
  const divinerQueryToIndexQueryDiviner = await this.getIndexingDivinerStage("divinerQueryToIndexQueryDiviner");
84
86
  const indexQueryResponseToDivinerQueryResponseDiviner = await this.getIndexingDivinerStage("indexQueryResponseToDivinerQueryResponseDiviner");
85
- const results = (await Promise.all(payloads.map(async (payload) => {
86
- const indexQuery = await divinerQueryToIndexQueryDiviner.divine([
87
- payload
88
- ]);
89
- const indexedResults = await indexPayloadDiviner.divine(indexQuery);
90
- const response = await Promise.all(indexedResults.flat().map((indexedResult) => indexQueryResponseToDivinerQueryResponseDiviner.divine([
91
- payload,
92
- indexedResult
93
- ])));
94
- return response.flat();
95
- }))).flat();
87
+ const results = (await Promise.all(
88
+ payloads.map(async (payload) => {
89
+ const indexQuery = await divinerQueryToIndexQueryDiviner.divine([payload]);
90
+ const indexedResults = await indexPayloadDiviner.divine(indexQuery);
91
+ const response = await Promise.all(
92
+ indexedResults.flat().map((indexedResult) => indexQueryResponseToDivinerQueryResponseDiviner.divine([payload, indexedResult]))
93
+ );
94
+ return response.flat();
95
+ })
96
+ )).flat();
96
97
  return results;
97
98
  }
98
99
  /**
99
- * Retrieves the archivist for the specified store
100
- * @param store The store to retrieve the archivist for
101
- * @returns The archivist for the specified store
102
- */
100
+ * Retrieves the archivist for the specified store
101
+ * @param store The store to retrieve the archivist for
102
+ * @returns The archivist for the specified store
103
+ */
103
104
  async getArchivistForStore(store) {
104
105
  const name = assertEx(this.config?.[store]?.archivist, () => `${moduleName}: Config for ${store}.archivist not specified`);
105
106
  const mod = assertEx(await this.resolve(name), () => `${moduleName}: Failed to resolve ${store}.archivist [${name}]`);
106
107
  return ArchivistWrapper.wrap(mod, this.account);
107
108
  }
108
109
  /**
109
- * Retrieves the BoundWitness Diviner for the specified store
110
- * @param store The store to retrieve the BoundWitness Diviner for
111
- * @returns The BoundWitness Diviner for the specified store
112
- */
110
+ * Retrieves the BoundWitness Diviner for the specified store
111
+ * @param store The store to retrieve the BoundWitness Diviner for
112
+ * @returns The BoundWitness Diviner for the specified store
113
+ */
113
114
  async getBoundWitnessDivinerForStore(store) {
114
115
  const name = assertEx(this.config?.[store]?.boundWitnessDiviner, () => `${moduleName}: Config for ${store}.boundWitnessDiviner not specified`);
115
116
  const mod = assertEx(await this.resolve(name), () => `${moduleName}: Failed to resolve ${store}.boundWitnessDiviner [${name}]`);
116
117
  return DivinerWrapper.wrap(mod, this.account);
117
118
  }
118
119
  /**
119
- * Gets the Diviner for the supplied Indexing Diviner stage
120
- * @param transform The Indexing Diviner stage
121
- * @returns The diviner corresponding to the Indexing Diviner stage
122
- */
120
+ * Gets the Diviner for the supplied Indexing Diviner stage
121
+ * @param transform The Indexing Diviner stage
122
+ * @returns The diviner corresponding to the Indexing Diviner stage
123
+ */
123
124
  async getIndexingDivinerStage(transform) {
124
- const nameOrAddress = assertEx(this.config?.indexingDivinerStages?.[transform], () => `${moduleName}: Config for indexingDivinerStages.${transform} not specified`);
125
+ const nameOrAddress = assertEx(
126
+ this.config?.indexingDivinerStages?.[transform],
127
+ () => `${moduleName}: Config for indexingDivinerStages.${transform} not specified`
128
+ );
125
129
  const mod = await this.resolve(nameOrAddress);
126
130
  return assertEx(asDivinerInstance(mod), () => `${moduleName}: Failed to resolve indexing diviner stage for ${transform}`);
127
131
  }
128
132
  /**
129
- * Retrieves the Payload Diviner for the specified store
130
- * @param store The store to retrieve the Payload Diviner for
131
- * @returns The Payload Diviner for the specified store
132
- */
133
+ * Retrieves the Payload Diviner for the specified store
134
+ * @param store The store to retrieve the Payload Diviner for
135
+ * @returns The Payload Diviner for the specified store
136
+ */
133
137
  async getPayloadDivinerForStore(store) {
134
138
  const name = assertEx(this.config?.[store]?.payloadDiviner, () => `${moduleName}: Config for ${store}.payloadDiviner not specified`);
135
139
  const mod = assertEx(await this.resolve(name), () => `${moduleName}: Failed to resolve ${store}.payloadDiviner [${name}]`);
136
140
  return DivinerWrapper.wrap(mod, this.account);
137
141
  }
138
142
  /**
139
- * Retrieves the last state of the Diviner process. Used to recover state after
140
- * preemptions, reboots, etc.
141
- */
143
+ * Retrieves the last state of the Diviner process. Used to recover state after
144
+ * preemptions, reboots, etc.
145
+ */
142
146
  async retrieveState() {
143
147
  const accountAddress = this.account.address;
144
148
  if (this._lastState) return this._lastState;
145
149
  let hash = "";
146
150
  const diviner = await this.getBoundWitnessDivinerForStore("stateStore");
147
- const query = await new PayloadBuilder({
148
- schema: BoundWitnessDivinerQuerySchema
149
- }).fields({
151
+ const query = await new PayloadBuilder({ schema: BoundWitnessDivinerQuerySchema }).fields({
150
152
  address: accountAddress,
151
153
  limit: 1,
152
154
  cursor: SequenceConstants.minLocalSequence,
153
155
  order: "desc",
154
- payload_schemas: [
155
- ModuleStateSchema
156
- ]
156
+ payload_schemas: [ModuleStateSchema]
157
157
  }).build();
158
- const boundWitnesses = await diviner.divine([
159
- query
160
- ]);
158
+ const boundWitnesses = await diviner.divine([query]);
161
159
  if (boundWitnesses.length > 0) {
162
160
  const boundWitness = boundWitnesses[0];
163
161
  if (isBoundWitness(boundWitness)) {
164
- hash = boundWitness.addresses.map((address, index) => ({
165
- address,
166
- index
167
- })).filter(({ address }) => address === accountAddress).reduce((prev, curr) => boundWitness.payload_schemas?.[curr?.index] === ModuleStateSchema ? boundWitness.payload_hashes[curr?.index] : prev, "");
162
+ hash = boundWitness.addresses.map((address, index) => ({ address, index })).filter(({ address }) => address === accountAddress).reduce(
163
+ (prev, curr) => boundWitness.payload_schemas?.[curr?.index] === ModuleStateSchema ? boundWitness.payload_hashes[curr?.index] : prev,
164
+ ""
165
+ );
168
166
  }
169
167
  }
170
168
  if (hash !== "") {
171
169
  const archivist = await this.getArchivistForStore("stateStore");
172
- const payload = (await archivist.get([
173
- hash
174
- ])).find(isModuleState);
170
+ const payload = (await archivist.get([hash])).find(isModuleState);
175
171
  if (payload) {
176
172
  return payload;
177
173
  }
@@ -191,9 +187,9 @@ var IndexingDiviner = class extends AbstractDiviner {
191
187
  return await super.stopHandler();
192
188
  }
193
189
  /**
194
- * Runs the background divine process on a loop with a delay
195
- * specified by the `config.pollFrequency`
196
- */
190
+ * Runs the background divine process on a loop with a delay
191
+ * specified by the `config.pollFrequency`
192
+ */
197
193
  poll() {
198
194
  this._pollId = setTimeoutEx(async () => {
199
195
  try {
@@ -209,7 +205,10 @@ var IndexingDiviner = class extends AbstractDiviner {
209
205
  }, this.pollFrequency);
210
206
  }
211
207
  };
212
- IndexingDiviner = _ts_decorate([
208
+ __publicField(IndexingDiviner, "allowRandomAccount", false);
209
+ __publicField(IndexingDiviner, "configSchemas", [...__superGet(IndexingDiviner, IndexingDiviner, "configSchemas"), IndexingDivinerConfigSchema]);
210
+ __publicField(IndexingDiviner, "defaultConfigSchema", IndexingDivinerConfigSchema);
211
+ IndexingDiviner = __decorateClass([
213
212
  creatableModule()
214
213
  ], IndexingDiviner);
215
214
  export {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Diviner.ts"],"sourcesContent":["import { assertEx } from '@xylabs/assert'\nimport { Hash } from '@xylabs/hex'\nimport { clearTimeoutEx, setTimeoutEx } from '@xylabs/timer'\nimport { ArchivistWrapper } from '@xyo-network/archivist-wrapper'\nimport { BoundWitnessBuilder } from '@xyo-network/boundwitness-builder'\nimport { isBoundWitness } from '@xyo-network/boundwitness-model'\nimport { AbstractDiviner } from '@xyo-network/diviner-abstract'\nimport { BoundWitnessDivinerQueryPayload, BoundWitnessDivinerQuerySchema } from '@xyo-network/diviner-boundwitness-model'\nimport {\n IndexingDivinerConfig,\n IndexingDivinerConfigSchema,\n IndexingDivinerParams,\n IndexingDivinerStage,\n IndexingDivinerState,\n} from '@xyo-network/diviner-indexing-model'\nimport {\n asDivinerInstance, DivinerInstance, DivinerModuleEventData,\n} from '@xyo-network/diviner-model'\nimport { DivinerWrapper } from '@xyo-network/diviner-wrapper'\nimport {\n creatableModule, isModuleState, ModuleState, ModuleStateSchema,\n} from '@xyo-network/module-model'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport {\n Payload, Schema, SequenceConstants, WithStorageMeta,\n} from '@xyo-network/payload-model'\n\nexport type ConfigStoreKey = 'indexStore' | 'stateStore'\n\nexport type ConfigStore = Extract<keyof IndexingDivinerConfig, ConfigStoreKey>\n\nconst moduleName = 'IndexingDiviner'\n\n@creatableModule<IndexingDiviner>()\nexport class IndexingDiviner<\n TParams extends IndexingDivinerParams = IndexingDivinerParams,\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 AbstractDiviner<TParams, TIn, TOut, TEventData> {\n static override readonly allowRandomAccount = false\n static override readonly configSchemas: Schema[] = [...super.configSchemas, IndexingDivinerConfigSchema]\n static override readonly defaultConfigSchema: Schema = IndexingDivinerConfigSchema\n\n private _lastState?: ModuleState<IndexingDivinerState>\n private _pollId?: string\n\n get payloadDivinerLimit() {\n return this.config.payloadDivinerLimit ?? 1000\n }\n\n get pollFrequency() {\n return this.config.pollFrequency ?? 10_000\n }\n\n /**\n * Works via batched iteration of the source archivist to populate the index.\n * @returns A promise that resolves when the background process is complete\n */\n protected backgroundDivine = async (): Promise<void> => {\n // Load last state\n const lastState = await this.retrieveState()\n // Get next batch of results\n const indexCandidateDiviner = await this.getIndexingDivinerStage('stateToIndexCandidateDiviner')\n const results = lastState ? await indexCandidateDiviner.divine([lastState]) : await indexCandidateDiviner.divine()\n // Filter next state out from results\n const nextState = results.find(isModuleState<IndexingDivinerState>)\n const indexCandidates = results.filter(x => !isModuleState(x))\n // Transform candidates to indexes\n const toIndexTransformDiviner = await this.getIndexingDivinerStage('indexCandidateToIndexDiviner')\n const indexes = await toIndexTransformDiviner.divine(indexCandidates)\n // Insert index results\n const indexArchivist = await this.getArchivistForStore('indexStore')\n await indexArchivist.insert(indexes)\n // Update state\n if (nextState) {\n await this.commitState(nextState)\n }\n }\n\n /**\n * Commit the internal state of the Diviner process. This is similar\n * to a transaction completion in a database and should only be called\n * when results have been successfully persisted to the appropriate\n * external stores.\n * @param nextState The state to commit\n */\n protected async commitState(nextState: ModuleState<IndexingDivinerState>) {\n // Don't commit state if no state has changed\n if (nextState.state.cursor === this._lastState?.state.cursor) return\n this._lastState = nextState\n const archivist = await this.getArchivistForStore('stateStore')\n const [bw] = await new BoundWitnessBuilder().payload(nextState).signer(this.account).build()\n await archivist.insert([bw, nextState])\n }\n\n protected override async divineHandler(payloads: TIn[] = []): Promise<TOut[]> {\n const indexPayloadDiviner = await this.getPayloadDivinerForStore('indexStore')\n const divinerQueryToIndexQueryDiviner = await this.getIndexingDivinerStage('divinerQueryToIndexQueryDiviner')\n const indexQueryResponseToDivinerQueryResponseDiviner = await this.getIndexingDivinerStage('indexQueryResponseToDivinerQueryResponseDiviner')\n const results = (\n await Promise.all(\n payloads.map(async (payload) => {\n const indexQuery = await divinerQueryToIndexQueryDiviner.divine([payload])\n // Divine the results\n const indexedResults = await indexPayloadDiviner.divine(indexQuery)\n // Transform the results to the response shape\n const response = await Promise.all(\n indexedResults.flat().map(indexedResult => indexQueryResponseToDivinerQueryResponseDiviner.divine([payload, indexedResult])),\n )\n return response.flat()\n }),\n )\n ).flat()\n // TODO: Infer this type over casting to this type\n return results as TOut[]\n }\n\n /**\n * Retrieves the archivist for the specified store\n * @param store The store to retrieve the archivist for\n * @returns The archivist for the specified store\n */\n protected async getArchivistForStore(store: ConfigStore) {\n const name = assertEx(this.config?.[store]?.archivist, () => `${moduleName}: Config for ${store}.archivist not specified`)\n const mod = assertEx(await this.resolve(name), () => `${moduleName}: Failed to resolve ${store}.archivist [${name}]`)\n return ArchivistWrapper.wrap(mod, this.account)\n }\n\n /**\n * Retrieves the BoundWitness Diviner for the specified store\n * @param store The store to retrieve the BoundWitness Diviner for\n * @returns The BoundWitness Diviner for the specified store\n */\n protected async getBoundWitnessDivinerForStore(store: ConfigStore) {\n const name = assertEx(this.config?.[store]?.boundWitnessDiviner, () => `${moduleName}: Config for ${store}.boundWitnessDiviner not specified`)\n const mod = assertEx(await this.resolve(name), () => `${moduleName}: Failed to resolve ${store}.boundWitnessDiviner [${name}]`)\n return DivinerWrapper.wrap(mod, this.account)\n }\n\n /**\n * Gets the Diviner for the supplied Indexing Diviner stage\n * @param transform The Indexing Diviner stage\n * @returns The diviner corresponding to the Indexing Diviner stage\n */\n protected async getIndexingDivinerStage(transform: IndexingDivinerStage) {\n const nameOrAddress = assertEx(\n this.config?.indexingDivinerStages?.[transform],\n () => `${moduleName}: Config for indexingDivinerStages.${transform} not specified`,\n )\n const mod = await this.resolve(nameOrAddress)\n return assertEx(asDivinerInstance(mod), () => `${moduleName}: Failed to resolve indexing diviner stage for ${transform}`) as DivinerInstance\n }\n\n /**\n * Retrieves the Payload Diviner for the specified store\n * @param store The store to retrieve the Payload Diviner for\n * @returns The Payload Diviner for the specified store\n */\n protected async getPayloadDivinerForStore(store: ConfigStore) {\n const name = assertEx(this.config?.[store]?.payloadDiviner, () => `${moduleName}: Config for ${store}.payloadDiviner not specified`)\n const mod = assertEx(await this.resolve(name), () => `${moduleName}: Failed to resolve ${store}.payloadDiviner [${name}]`)\n return DivinerWrapper.wrap(mod, this.account)\n }\n\n /**\n * Retrieves the last state of the Diviner process. Used to recover state after\n * preemptions, reboots, etc.\n */\n protected async retrieveState(): Promise<ModuleState<IndexingDivinerState> | undefined> {\n const accountAddress = this.account.address\n if (this._lastState) return this._lastState\n let hash: Hash = ''\n const diviner = await this.getBoundWitnessDivinerForStore('stateStore')\n const query = await new PayloadBuilder<BoundWitnessDivinerQueryPayload>({ schema: BoundWitnessDivinerQuerySchema })\n .fields({\n address: accountAddress,\n limit: 1,\n cursor: SequenceConstants.minLocalSequence,\n order: 'desc',\n payload_schemas: [ModuleStateSchema],\n })\n .build()\n const boundWitnesses = await diviner.divine([query])\n if (boundWitnesses.length > 0) {\n const boundWitness = boundWitnesses[0]\n if (isBoundWitness(boundWitness)) {\n // Find the index for this address in the BoundWitness that is a ModuleState\n hash = boundWitness.addresses\n .map((address, index) => ({ address, index }))\n .filter(({ address }) => address === accountAddress)\n // eslint-disable-next-line unicorn/no-array-reduce\n .reduce(\n (prev, curr) => (boundWitness.payload_schemas?.[curr?.index] === ModuleStateSchema ? boundWitness.payload_hashes[curr?.index] : prev),\n '' as Hash,\n )\n }\n }\n\n // If we able to located the last state\n if (hash !== '') {\n // Get last state\n const archivist = await this.getArchivistForStore('stateStore')\n const payload = (await archivist.get([hash])).find(isModuleState<IndexingDivinerState>)\n if (payload) {\n return payload as WithStorageMeta<ModuleState<IndexingDivinerState>>\n }\n }\n return undefined\n }\n\n protected override async startHandler(): Promise<boolean> {\n await super.startHandler()\n this.poll()\n return true\n }\n\n protected override async stopHandler(_timeout?: number | undefined): Promise<boolean> {\n if (this._pollId) {\n clearTimeout(this._pollId)\n this._pollId = undefined\n }\n return await super.stopHandler()\n }\n\n /**\n * Runs the background divine process on a loop with a delay\n * specified by the `config.pollFrequency`\n */\n private poll() {\n this._pollId = setTimeoutEx(async () => {\n try {\n await Promise.resolve()\n await this.backgroundDivine()\n } catch (e) {\n console.log(e)\n } finally {\n if (this._pollId) clearTimeoutEx(this._pollId)\n this._pollId = undefined\n this.poll()\n }\n }, this.pollFrequency)\n }\n}\n"],"mappings":";;;;AAAA,SAASA,gBAAgB;AAEzB,SAASC,gBAAgBC,oBAAoB;AAC7C,SAASC,wBAAwB;AACjC,SAASC,2BAA2B;AACpC,SAASC,sBAAsB;AAC/B,SAASC,uBAAuB;AAChC,SAA0CC,sCAAsC;AAChF,SAEEC,mCAIK;AACP,SACEC,yBACK;AACP,SAASC,sBAAsB;AAC/B,SACEC,iBAAiBC,eAA4BC,yBACxC;AACP,SAASC,sBAAsB;AAC/B,SACmBC,yBACZ;;;;;;;;AAMP,IAAMC,aAAa;AAGZ,IAAMC,kBAAN,cASGC,gBAAAA;SAAAA;;;EACR,OAAyBC,qBAAqB;EAC9C,OAAyBC,gBAA0B;OAAI,MAAMA;IAAeC;;EAC5E,OAAyBC,sBAA8BD;EAE/CE;EACAC;EAER,IAAIC,sBAAsB;AACxB,WAAO,KAAKC,OAAOD,uBAAuB;EAC5C;EAEA,IAAIE,gBAAgB;AAClB,WAAO,KAAKD,OAAOC,iBAAiB;EACtC;;;;;EAMUC,mBAAmB,mCAAA;AAE3B,UAAMC,YAAY,MAAM,KAAKC,cAAa;AAE1C,UAAMC,wBAAwB,MAAM,KAAKC,wBAAwB,8BAAA;AACjE,UAAMC,UAAUJ,YAAY,MAAME,sBAAsBG,OAAO;MAACL;KAAU,IAAI,MAAME,sBAAsBG,OAAM;AAE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,SAAKC,KAAI;AACT,WAAO;EACT;EAEA,MAAyBC,YAAYC,UAAiD;AACpF,QAAI,KAAK3F,SAAS;AAChB4F,mBAAa,KAAK5F,OAAO;AACzB,WAAKA,UAAUuF;IACjB;AACA,WAAO,MAAM,MAAMG,YAAAA;EACrB;;;;;EAMQD,OAAO;AACb,SAAKzF,UAAU6F,aAAa,YAAA;AAC1B,UAAI;AACF,cAAMvD,QAAQY,QAAO;AACrB,cAAM,KAAK9C,iBAAgB;MAC7B,SAAS0F,GAAG;AACVC,gBAAQC,IAAIF,CAAAA;MACd,UAAA;AACE,YAAI,KAAK9F,QAASiG,gBAAe,KAAKjG,OAAO;AAC7C,aAAKA,UAAUuF;AACf,aAAKE,KAAI;MACX;IACF,GAAG,KAAKtF,aAAa;EACvB;AACF;;;;","names":["assertEx","clearTimeoutEx","setTimeoutEx","ArchivistWrapper","BoundWitnessBuilder","isBoundWitness","AbstractDiviner","BoundWitnessDivinerQuerySchema","IndexingDivinerConfigSchema","asDivinerInstance","DivinerWrapper","creatableModule","isModuleState","ModuleStateSchema","PayloadBuilder","SequenceConstants","moduleName","IndexingDiviner","AbstractDiviner","allowRandomAccount","configSchemas","IndexingDivinerConfigSchema","defaultConfigSchema","_lastState","_pollId","payloadDivinerLimit","config","pollFrequency","backgroundDivine","lastState","retrieveState","indexCandidateDiviner","getIndexingDivinerStage","results","divine","nextState","find","isModuleState","indexCandidates","filter","x","toIndexTransformDiviner","indexes","indexArchivist","getArchivistForStore","insert","commitState","state","cursor","archivist","bw","BoundWitnessBuilder","payload","signer","account","build","divineHandler","payloads","indexPayloadDiviner","getPayloadDivinerForStore","divinerQueryToIndexQueryDiviner","indexQueryResponseToDivinerQueryResponseDiviner","Promise","all","map","indexQuery","indexedResults","response","flat","indexedResult","store","name","assertEx","mod","resolve","ArchivistWrapper","wrap","getBoundWitnessDivinerForStore","boundWitnessDiviner","DivinerWrapper","transform","nameOrAddress","indexingDivinerStages","asDivinerInstance","payloadDiviner","accountAddress","address","hash","diviner","query","PayloadBuilder","schema","BoundWitnessDivinerQuerySchema","fields","limit","SequenceConstants","minLocalSequence","order","payload_schemas","ModuleStateSchema","boundWitnesses","length","boundWitness","isBoundWitness","addresses","index","reduce","prev","curr","payload_hashes","get","undefined","startHandler","poll","stopHandler","_timeout","clearTimeout","setTimeoutEx","e","console","log","clearTimeoutEx"]}
1
+ {"version":3,"sources":["../../src/Diviner.ts"],"sourcesContent":["import { assertEx } from '@xylabs/assert'\nimport { Hash } from '@xylabs/hex'\nimport { clearTimeoutEx, setTimeoutEx } from '@xylabs/timer'\nimport { ArchivistWrapper } from '@xyo-network/archivist-wrapper'\nimport { BoundWitnessBuilder } from '@xyo-network/boundwitness-builder'\nimport { isBoundWitness } from '@xyo-network/boundwitness-model'\nimport { AbstractDiviner } from '@xyo-network/diviner-abstract'\nimport { BoundWitnessDivinerQueryPayload, BoundWitnessDivinerQuerySchema } from '@xyo-network/diviner-boundwitness-model'\nimport {\n IndexingDivinerConfig,\n IndexingDivinerConfigSchema,\n IndexingDivinerParams,\n IndexingDivinerStage,\n IndexingDivinerState,\n} from '@xyo-network/diviner-indexing-model'\nimport {\n asDivinerInstance, DivinerInstance, DivinerModuleEventData,\n} from '@xyo-network/diviner-model'\nimport { DivinerWrapper } from '@xyo-network/diviner-wrapper'\nimport {\n creatableModule, isModuleState, ModuleState, ModuleStateSchema,\n} from '@xyo-network/module-model'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport {\n Payload, Schema, SequenceConstants, WithStorageMeta,\n} from '@xyo-network/payload-model'\n\nexport type ConfigStoreKey = 'indexStore' | 'stateStore'\n\nexport type ConfigStore = Extract<keyof IndexingDivinerConfig, ConfigStoreKey>\n\nconst moduleName = 'IndexingDiviner'\n\n@creatableModule<IndexingDiviner>()\nexport class IndexingDiviner<\n TParams extends IndexingDivinerParams = IndexingDivinerParams,\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 AbstractDiviner<TParams, TIn, TOut, TEventData> {\n static override readonly allowRandomAccount = false\n static override readonly configSchemas: Schema[] = [...super.configSchemas, IndexingDivinerConfigSchema]\n static override readonly defaultConfigSchema: Schema = IndexingDivinerConfigSchema\n\n private _lastState?: ModuleState<IndexingDivinerState>\n private _pollId?: string\n\n get payloadDivinerLimit() {\n return this.config.payloadDivinerLimit ?? 1000\n }\n\n get pollFrequency() {\n return this.config.pollFrequency ?? 10_000\n }\n\n /**\n * Works via batched iteration of the source archivist to populate the index.\n * @returns A promise that resolves when the background process is complete\n */\n protected backgroundDivine = async (): Promise<void> => {\n // Load last state\n const lastState = await this.retrieveState()\n // Get next batch of results\n const indexCandidateDiviner = await this.getIndexingDivinerStage('stateToIndexCandidateDiviner')\n const results = lastState ? await indexCandidateDiviner.divine([lastState]) : await indexCandidateDiviner.divine()\n // Filter next state out from results\n const nextState = results.find(isModuleState<IndexingDivinerState>)\n const indexCandidates = results.filter(x => !isModuleState(x))\n // Transform candidates to indexes\n const toIndexTransformDiviner = await this.getIndexingDivinerStage('indexCandidateToIndexDiviner')\n const indexes = await toIndexTransformDiviner.divine(indexCandidates)\n // Insert index results\n const indexArchivist = await this.getArchivistForStore('indexStore')\n await indexArchivist.insert(indexes)\n // Update state\n if (nextState) {\n await this.commitState(nextState)\n }\n }\n\n /**\n * Commit the internal state of the Diviner process. This is similar\n * to a transaction completion in a database and should only be called\n * when results have been successfully persisted to the appropriate\n * external stores.\n * @param nextState The state to commit\n */\n protected async commitState(nextState: ModuleState<IndexingDivinerState>) {\n // Don't commit state if no state has changed\n if (nextState.state.cursor === this._lastState?.state.cursor) return\n this._lastState = nextState\n const archivist = await this.getArchivistForStore('stateStore')\n const [bw] = await new BoundWitnessBuilder().payload(nextState).signer(this.account).build()\n await archivist.insert([bw, nextState])\n }\n\n protected override async divineHandler(payloads: TIn[] = []): Promise<TOut[]> {\n const indexPayloadDiviner = await this.getPayloadDivinerForStore('indexStore')\n const divinerQueryToIndexQueryDiviner = await this.getIndexingDivinerStage('divinerQueryToIndexQueryDiviner')\n const indexQueryResponseToDivinerQueryResponseDiviner = await this.getIndexingDivinerStage('indexQueryResponseToDivinerQueryResponseDiviner')\n const results = (\n await Promise.all(\n payloads.map(async (payload) => {\n const indexQuery = await divinerQueryToIndexQueryDiviner.divine([payload])\n // Divine the results\n const indexedResults = await indexPayloadDiviner.divine(indexQuery)\n // Transform the results to the response shape\n const response = await Promise.all(\n indexedResults.flat().map(indexedResult => indexQueryResponseToDivinerQueryResponseDiviner.divine([payload, indexedResult])),\n )\n return response.flat()\n }),\n )\n ).flat()\n // TODO: Infer this type over casting to this type\n return results as TOut[]\n }\n\n /**\n * Retrieves the archivist for the specified store\n * @param store The store to retrieve the archivist for\n * @returns The archivist for the specified store\n */\n protected async getArchivistForStore(store: ConfigStore) {\n const name = assertEx(this.config?.[store]?.archivist, () => `${moduleName}: Config for ${store}.archivist not specified`)\n const mod = assertEx(await this.resolve(name), () => `${moduleName}: Failed to resolve ${store}.archivist [${name}]`)\n return ArchivistWrapper.wrap(mod, this.account)\n }\n\n /**\n * Retrieves the BoundWitness Diviner for the specified store\n * @param store The store to retrieve the BoundWitness Diviner for\n * @returns The BoundWitness Diviner for the specified store\n */\n protected async getBoundWitnessDivinerForStore(store: ConfigStore) {\n const name = assertEx(this.config?.[store]?.boundWitnessDiviner, () => `${moduleName}: Config for ${store}.boundWitnessDiviner not specified`)\n const mod = assertEx(await this.resolve(name), () => `${moduleName}: Failed to resolve ${store}.boundWitnessDiviner [${name}]`)\n return DivinerWrapper.wrap(mod, this.account)\n }\n\n /**\n * Gets the Diviner for the supplied Indexing Diviner stage\n * @param transform The Indexing Diviner stage\n * @returns The diviner corresponding to the Indexing Diviner stage\n */\n protected async getIndexingDivinerStage(transform: IndexingDivinerStage) {\n const nameOrAddress = assertEx(\n this.config?.indexingDivinerStages?.[transform],\n () => `${moduleName}: Config for indexingDivinerStages.${transform} not specified`,\n )\n const mod = await this.resolve(nameOrAddress)\n return assertEx(asDivinerInstance(mod), () => `${moduleName}: Failed to resolve indexing diviner stage for ${transform}`) as DivinerInstance\n }\n\n /**\n * Retrieves the Payload Diviner for the specified store\n * @param store The store to retrieve the Payload Diviner for\n * @returns The Payload Diviner for the specified store\n */\n protected async getPayloadDivinerForStore(store: ConfigStore) {\n const name = assertEx(this.config?.[store]?.payloadDiviner, () => `${moduleName}: Config for ${store}.payloadDiviner not specified`)\n const mod = assertEx(await this.resolve(name), () => `${moduleName}: Failed to resolve ${store}.payloadDiviner [${name}]`)\n return DivinerWrapper.wrap(mod, this.account)\n }\n\n /**\n * Retrieves the last state of the Diviner process. Used to recover state after\n * preemptions, reboots, etc.\n */\n protected async retrieveState(): Promise<ModuleState<IndexingDivinerState> | undefined> {\n const accountAddress = this.account.address\n if (this._lastState) return this._lastState\n let hash: Hash = ''\n const diviner = await this.getBoundWitnessDivinerForStore('stateStore')\n const query = await new PayloadBuilder<BoundWitnessDivinerQueryPayload>({ schema: BoundWitnessDivinerQuerySchema })\n .fields({\n address: accountAddress,\n limit: 1,\n cursor: SequenceConstants.minLocalSequence,\n order: 'desc',\n payload_schemas: [ModuleStateSchema],\n })\n .build()\n const boundWitnesses = await diviner.divine([query])\n if (boundWitnesses.length > 0) {\n const boundWitness = boundWitnesses[0]\n if (isBoundWitness(boundWitness)) {\n // Find the index for this address in the BoundWitness that is a ModuleState\n hash = boundWitness.addresses\n .map((address, index) => ({ address, index }))\n .filter(({ address }) => address === accountAddress)\n // eslint-disable-next-line unicorn/no-array-reduce\n .reduce(\n (prev, curr) => (boundWitness.payload_schemas?.[curr?.index] === ModuleStateSchema ? boundWitness.payload_hashes[curr?.index] : prev),\n '' as Hash,\n )\n }\n }\n\n // If we able to located the last state\n if (hash !== '') {\n // Get last state\n const archivist = await this.getArchivistForStore('stateStore')\n const payload = (await archivist.get([hash])).find(isModuleState<IndexingDivinerState>)\n if (payload) {\n return payload as WithStorageMeta<ModuleState<IndexingDivinerState>>\n }\n }\n return undefined\n }\n\n protected override async startHandler(): Promise<boolean> {\n await super.startHandler()\n this.poll()\n return true\n }\n\n protected override async stopHandler(_timeout?: number | undefined): Promise<boolean> {\n if (this._pollId) {\n clearTimeout(this._pollId)\n this._pollId = undefined\n }\n return await super.stopHandler()\n }\n\n /**\n * Runs the background divine process on a loop with a delay\n * specified by the `config.pollFrequency`\n */\n private poll() {\n this._pollId = setTimeoutEx(async () => {\n try {\n await Promise.resolve()\n await this.backgroundDivine()\n } catch (e) {\n console.log(e)\n } finally {\n if (this._pollId) clearTimeoutEx(this._pollId)\n this._pollId = undefined\n this.poll()\n }\n }, this.pollFrequency)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA,SAAS,gBAAgB;AAEzB,SAAS,gBAAgB,oBAAoB;AAC7C,SAAS,wBAAwB;AACjC,SAAS,2BAA2B;AACpC,SAAS,sBAAsB;AAC/B,SAAS,uBAAuB;AAChC,SAA0C,sCAAsC;AAChF;AAAA,EAEE;AAAA,OAIK;AACP;AAAA,EACE;AAAA,OACK;AACP,SAAS,sBAAsB;AAC/B;AAAA,EACE;AAAA,EAAiB;AAAA,EAA4B;AAAA,OACxC;AACP,SAAS,sBAAsB;AAC/B;AAAA,EACmB;AAAA,OACZ;AAMP,IAAM,aAAa;AAGZ,IAAM,kBAAN,cASG,gBAAgD;AAAA,EAKhD;AAAA,EACA;AAAA,EAER,IAAI,sBAAsB;AACxB,WAAO,KAAK,OAAO,uBAAuB;AAAA,EAC5C;AAAA,EAEA,IAAI,gBAAgB;AAClB,WAAO,KAAK,OAAO,iBAAiB;AAAA,EACtC;AAAA;AAAA;AAAA;AAAA;AAAA,EAMU,mBAAmB,YAA2B;AAEtD,UAAM,YAAY,MAAM,KAAK,cAAc;AAE3C,UAAM,wBAAwB,MAAM,KAAK,wBAAwB,8BAA8B;AAC/F,UAAM,UAAU,YAAY,MAAM,sBA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A,EAEA,MAAyB,eAAiC;AACxD,UAAM,MAAM,aAAa;AACzB,SAAK,KAAK;AACV,WAAO;AAAA,EACT;AAAA,EAEA,MAAyB,YAAY,UAAiD;AACpF,QAAI,KAAK,SAAS;AAChB,mBAAa,KAAK,OAAO;AACzB,WAAK,UAAU;AAAA,IACjB;AACA,WAAO,MAAM,MAAM,YAAY;AAAA,EACjC;AAAA;AAAA;AAAA;AAAA;AAAA,EAMQ,OAAO;AACb,SAAK,UAAU,aAAa,YAAY;AACtC,UAAI;AACF,cAAM,QAAQ,QAAQ;AACtB,cAAM,KAAK,iBAAiB;AAAA,MAC9B,SAAS,GAAG;AACV,gBAAQ,IAAI,CAAC;AAAA,MACf,UAAE;AACA,YAAI,KAAK,QAAS,gBAAe,KAAK,OAAO;AAC7C,aAAK,UAAU;AACf,aAAK,KAAK;AAAA,MACZ;AAAA,IACF,GAAG,KAAK,aAAa;AAAA,EACvB;AACF;AA3ME,cAVW,iBAUc,sBAAqB;AAC9C,cAXW,iBAWc,iBAA0B,CAAC,GAAG,6CAAM,kBAAe,2BAA2B;AACvG,cAZW,iBAYc,uBAA8B;AAZ5C,kBAAN;AAAA,EADN,gBAAiC;AAAA,GACrB;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xyo-network/diviner-indexing-memory",
3
- "version": "3.6.9",
3
+ "version": "3.6.11",
4
4
  "description": "Primary SDK for using XYO Protocol 2.0",
5
5
  "homepage": "https://xyo.network",
6
6
  "bugs": {
@@ -29,25 +29,25 @@
29
29
  "module": "dist/neutral/index.mjs",
30
30
  "types": "dist/neutral/index.d.ts",
31
31
  "dependencies": {
32
- "@xylabs/assert": "^4.4.34",
33
- "@xylabs/hex": "^4.4.34",
34
- "@xylabs/timer": "^4.4.34",
35
- "@xyo-network/archivist-wrapper": "^3.6.9",
36
- "@xyo-network/boundwitness-builder": "^3.6.9",
37
- "@xyo-network/boundwitness-model": "^3.6.9",
38
- "@xyo-network/diviner-abstract": "^3.6.9",
39
- "@xyo-network/diviner-boundwitness-model": "^3.6.9",
40
- "@xyo-network/diviner-indexing-model": "^3.6.9",
41
- "@xyo-network/diviner-model": "^3.6.9",
42
- "@xyo-network/diviner-wrapper": "^3.6.9",
43
- "@xyo-network/module-model": "^3.6.9",
44
- "@xyo-network/payload-builder": "^3.6.9",
45
- "@xyo-network/payload-model": "^3.6.9"
32
+ "@xylabs/assert": "^4.5.1",
33
+ "@xylabs/hex": "^4.5.1",
34
+ "@xylabs/timer": "^4.5.1",
35
+ "@xyo-network/archivist-wrapper": "^3.6.11",
36
+ "@xyo-network/boundwitness-builder": "^3.6.11",
37
+ "@xyo-network/boundwitness-model": "^3.6.11",
38
+ "@xyo-network/diviner-abstract": "^3.6.11",
39
+ "@xyo-network/diviner-boundwitness-model": "^3.6.11",
40
+ "@xyo-network/diviner-indexing-model": "^3.6.11",
41
+ "@xyo-network/diviner-model": "^3.6.11",
42
+ "@xyo-network/diviner-wrapper": "^3.6.11",
43
+ "@xyo-network/module-model": "^3.6.11",
44
+ "@xyo-network/payload-builder": "^3.6.11",
45
+ "@xyo-network/payload-model": "^3.6.11"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@xylabs/ts-scripts-yarn3": "^4.2.6",
49
49
  "@xylabs/tsconfig": "^4.2.6",
50
- "typescript": "^5.7.2"
50
+ "typescript": "^5.7.3"
51
51
  },
52
52
  "publishConfig": {
53
53
  "access": "public"