@xyo-network/diviner-stateful 2.91.0 → 2.91.2
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/DivinerMixin.d.cts +88 -5
- package/dist/browser/DivinerMixin.d.cts.map +1 -1
- package/dist/browser/DivinerMixin.d.mts +88 -5
- package/dist/browser/DivinerMixin.d.mts.map +1 -1
- package/dist/browser/DivinerMixin.d.ts +88 -5
- package/dist/browser/DivinerMixin.d.ts.map +1 -1
- package/dist/browser/index.cjs.map +1 -1
- package/dist/browser/index.js.map +1 -1
- package/dist/node/DivinerMixin.d.cts +88 -5
- package/dist/node/DivinerMixin.d.cts.map +1 -1
- package/dist/node/DivinerMixin.d.mts +88 -5
- package/dist/node/DivinerMixin.d.mts.map +1 -1
- package/dist/node/DivinerMixin.d.ts +88 -5
- package/dist/node/DivinerMixin.d.ts.map +1 -1
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.js.map +1 -1
- package/package.json +20 -20
- package/src/DivinerMixin.ts +3 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Schema.ts","../../src/Config.ts","../../src/Diviner.ts","../../src/DivinerMixin.ts"],"sourcesContent":["export const StatefulDivinerSchema = 'network.xyo.diviner.stateful' as const\nexport type StatefulDivinerSchema = typeof StatefulDivinerSchema\n","import { DivinerConfig } from '@xyo-network/diviner-model'\nimport { ModuleIdentifier } from '@xyo-network/module-model'\n\nimport { StatefulDivinerSchema } from './Schema'\n\n/**\n * The schema for a Stateful Diviner config\n */\nexport const StatefulDivinerConfigSchema = `${StatefulDivinerSchema}.config` as const\n/**\n * The schema for a Stateful Diviner config\n */\nexport type StatefulDivinerConfigSchema = typeof StatefulDivinerConfigSchema\n\n/**\n * The config for a Stateful Diviner\n */\nexport type StatefulDivinerConfig = DivinerConfig<{\n schema: StatefulDivinerConfigSchema\n stateStore: {\n archivist: ModuleIdentifier\n boundWitnessDiviner: ModuleIdentifier\n payloadDiviner: ModuleIdentifier\n }\n}>\n","import { assertEx } from '@xylabs/assert'\nimport { Hash } from '@xylabs/hex'\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 { DivinerConfigSchema, DivinerModule, DivinerModuleEventData } from '@xyo-network/diviner-model'\nimport { DivinerWrapper } from '@xyo-network/diviner-wrapper'\nimport { isModuleState, ModuleState, ModuleStateSchema, StateDictionary } from '@xyo-network/module-model'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport { Payload, WithMeta } from '@xyo-network/payload-model'\n\nimport { StatefulDivinerConfigSchema } from './Config'\nimport { StatefulDivinerParams } from './Params'\n\nconst moduleName = 'StatefulDiviner'\n\n/**\n * A Diviner that maintains state\n */\nexport abstract class StatefulDiviner<\n TParams extends StatefulDivinerParams = StatefulDivinerParams,\n TIn extends Payload = Payload,\n TOut extends Payload = Payload,\n TEventData extends DivinerModuleEventData<DivinerModule<TParams>, TIn, TOut> = DivinerModuleEventData<DivinerModule<TParams>, TIn, TOut>,\n TState extends StateDictionary = StateDictionary,\n> extends AbstractDiviner<TParams, TIn, TOut, TEventData> {\n static override readonly configSchemas: string[] = [DivinerConfigSchema, StatefulDivinerConfigSchema]\n\n /**\n * The last state\n */\n protected _lastState?: WithMeta<ModuleState<TState>>\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: WithMeta<ModuleState<TState>>) {\n // Don't commit state if no state has changed\n if (nextState.state.offset === this._lastState?.state.offset) return\n this._lastState = nextState\n const archivist = await this.getArchivistForStateStore()\n const [bw] = await (await new BoundWitnessBuilder().payload(nextState)).witness(this.account).build()\n await archivist.insert([bw, nextState])\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 getArchivistForStateStore() {\n const name = assertEx(this.config?.stateStore.archivist, () => `${moduleName}: Config for stateStore.archivist not specified`)\n const mod = assertEx(await this.resolve(name), () => `${moduleName}: Failed to resolve stateStore.archivist`)\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 getBoundWitnessDivinerForStateStore() {\n const name = assertEx(this.config?.stateStore.boundWitnessDiviner, () => `${moduleName}: Config for stateStore.boundWitnessDiviner not specified`)\n const mod = assertEx(await this.resolve(name), () => `${moduleName}: Failed to resolve stateStore.boundWitnessDiviner`)\n return DivinerWrapper.wrap(mod, this.account)\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 getPayloadDivinerForStateStore() {\n const name = assertEx(this.config?.stateStore?.payloadDiviner, () => `${moduleName}: Config for stateStore.payloadDiviner not specified`)\n const mod = assertEx(await this.resolve(name), () => `${moduleName}: Failed to resolve stateStore.payloadDiviner`)\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<WithMeta<ModuleState<TState>> | undefined> {\n if (this._lastState) return this._lastState\n let hash: Hash = ''\n const diviner = await this.getBoundWitnessDivinerForStateStore()\n const query = await new PayloadBuilder<BoundWitnessDivinerQueryPayload>({ schema: BoundWitnessDivinerQuerySchema })\n .fields({\n address: this.account.address,\n limit: 1,\n offset: 0,\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 === this.account.address)\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.getArchivistForStateStore()\n const payload = (await archivist.get([hash])).find(isModuleState<TState>)\n if (payload) {\n return payload as WithMeta<ModuleState<TState>>\n }\n }\n return undefined\n }\n}\n","import { assertEx } from '@xylabs/assert'\nimport { asArchivistInstance } from '@xyo-network/archivist-model'\nimport { BoundWitnessBuilder } from '@xyo-network/boundwitness-builder'\nimport { isBoundWitness } from '@xyo-network/boundwitness-model'\nimport { BoundWitnessDivinerQueryPayload, BoundWitnessDivinerQuerySchema } from '@xyo-network/diviner-boundwitness-model'\nimport { asDivinerInstance } from '@xyo-network/diviner-model'\nimport {\n AnyConfigSchema,\n isModuleState,\n ModuleInstance,\n ModuleParams,\n ModuleState,\n ModuleStateSchema,\n StateDictionary,\n} from '@xyo-network/module-model'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport { WithMeta } from '@xyo-network/payload-model'\n\nimport { StatefulDivinerConfig } from './Config'\n\nexport type StatefulModuleParams = ModuleParams<AnyConfigSchema<StatefulDivinerConfig>>\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type AnyModule<TParams extends StatefulModuleParams = StatefulModuleParams> = new (...args: any[]) => ModuleInstance<TParams>\n\nconst moduleName = 'StatefulModuleMixin'\n\n/**\n * @ignore Inherit from StatefulDiviner instead\n * @param ModuleBase\n * @returns\n */\nexport const StatefulModuleMixin = <\n TParams extends StatefulModuleParams = StatefulModuleParams,\n TModule extends AnyModule<TParams> = AnyModule<TParams>,\n TState extends StateDictionary = StateDictionary,\n>(\n ModuleBase: TModule,\n) => {\n abstract class StatefulModuleBase extends ModuleBase {\n _lastState?: WithMeta<ModuleState<TState>>\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 async commitState(nextState: WithMeta<ModuleState<TState>>) {\n // Don't commit state if no state has changed\n if (nextState.state.offset === this._lastState?.state.offset) return\n this._lastState = nextState\n const archivist = await this.getArchivistForStore()\n // const [bw] = await new BoundWitnessBuilder().payload(nextState).witness(this.account).build()\n const [bw] = await (await new BoundWitnessBuilder().payload(nextState)).build()\n await archivist.insert([bw, nextState])\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 async getArchivistForStore() {\n const name = assertEx(this.config?.stateStore?.archivist, () => `${moduleName}: Config for stateStore.archivist not specified`)\n const mod = assertEx(await this.resolve(name), () => `${moduleName}: Failed to resolve stateStore.archivist`)\n // return ArchivistWrapper.wrap(mod, this.account)\n const instance = asArchivistInstance(mod)\n return assertEx(instance, () => `${moduleName}: Failed to wrap archivist instance`)\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 async getBoundWitnessDivinerForStore() {\n const name = assertEx(\n this.config?.stateStore?.boundWitnessDiviner,\n () => `${moduleName}: Config for stateStore.boundWitnessDiviner not specified`,\n )\n const mod = assertEx(await this.resolve(name), () => `${moduleName}: Failed to resolve stateStore.boundWitnessDiviner`)\n // return DivinerWrapper.wrap(mod, this.account)\n const instance = asDivinerInstance(mod)\n return assertEx(instance, () => `${moduleName}: Failed to wrap diviner instance`)\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 async getPayloadDivinerForStateStore() {\n const name = assertEx(this.config?.stateStore?.payloadDiviner, () => `${moduleName}: Config for stateStore.payloadDiviner not specified`)\n const mod = assertEx(await this.resolve(name), () => `${moduleName}: Failed to resolve stateStore.payloadDiviner`)\n // return DivinerWrapper.wrap(mod, this.account)\n const instance = asDivinerInstance(mod)\n return assertEx(instance, () => `${moduleName}: Failed to wrap diviner instance`)\n }\n /**\n * Retrieves the last state of the Diviner process. Used to recover state after\n * preemptions, reboots, etc.\n */\n async retrieveState(): Promise<WithMeta<ModuleState<TState>> | undefined> {\n if (this._lastState) return this._lastState\n let hash: string = ''\n const diviner = await this.getBoundWitnessDivinerForStore()\n const query = await new PayloadBuilder<BoundWitnessDivinerQueryPayload>({ schema: BoundWitnessDivinerQuerySchema })\n .fields({\n // address: this.account.address,\n limit: 1,\n offset: 0,\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 === this.account.address)\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 '',\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()\n const payload = (await archivist.get([hash])).find(isModuleState<TState>)\n if (payload) {\n return payload as WithMeta<ModuleState<TState>>\n }\n }\n return undefined\n }\n }\n return StatefulModuleBase\n}\n"],"mappings":";;;;AAAO,IAAMA,wBAAwB;;;ACQ9B,IAAMC,8BAA8B,GAAGC,qBAAAA;;;ACR9C,SAASC,gBAAgB;AAEzB,SAASC,wBAAwB;AACjC,SAASC,2BAA2B;AACpC,SAASC,sBAAsB;AAC/B,SAASC,uBAAuB;AAChC,SAA0CC,s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QAAQC,YAAYS,gBAAgB,MAAM,GAAG5B,WAAAA,sDAAgE;AACxI,YAAMoB,MAAMH,UAAS,MAAM,KAAKI,QAAQL,IAAAA,GAAO,MAAM,GAAGhB,WAAAA,+CAAyD;AAEjH,YAAMsB,WAAWI,kBAAkBN,GAAAA;AACnC,aAAOH,UAASK,UAAU,MAAM,GAAGtB,WAAAA,mCAA6C;IAClF;;;;;IAKA,MAAM6B,gBAAoE;AACxE,UAAI,KAAKzB;AAAY,eAAO,KAAKA;AACjC,UAAI0B,OAAe;AACnB,YAAMC,UAAU,MAAM,KAAKP,+BAA8B;AACzD,YAAMQ,QAAQ,MAAM,IAAIC,gBAAgD;QAAEC,QAAQC;MAA+B,CAAA,EAC9GC,OAAO;;QAENC,OAAO;QACP7B,QAAQ;QACR8B,OAAO;QACPC,iBAAiB;UAACC;;MACpB,CAAA,EACC1B,MAAK;AACR,YAAM2B,iBAAiB,MAAMV,QAAQW,OAAO;QAACV;OAAM;AACnD,UAAIS,eAAeE,SAAS,GAAG;AAC7B,cAAMC,eAAeH,eAAe,CAAA;AACpC,YAAII,gBAAeD,YAAAA,GAAe;AAEhCd,iBAAOc,aAAaE,UACjBC,IAAI,CAACC,SAASC,WAAW;YAAED;YAASC;UAAM,EAAA,EAG1CC,OACC,CAACC,MAAMC,SAAUR,aAAaL,kBAAkBa,MAAMH,KAAAA,MAAWT,qBAAoBI,aAAaS,eAAeD,MAAMH,KAAAA,IAASE,MAChI,EAAA;QAEN;MACF;AAGA,UAAIrB,MAAM;AAER,cAAMrB,YAAY,MAAM,KAAKC,qBAAoB;AACjD,cAAMG,WAAW,MAAMJ,UAAU6C,IAAI;UAACxB;SAAK,GAAGyB,KAAKC,cAAAA;AACnD,YAAI3C,SAAS;AACX,iBAAOA;QACT;MACF;AACA,aAAO4C;IACT;EACF;AACA,SAAOtD;AACT,GAjHmC;","names":["StatefulDivinerSchema","StatefulDivinerConfigSchema","StatefulDivinerSchema","assertEx","ArchivistWrapper","BoundWitnessBuilder","isBoundWitness","AbstractDiviner","BoundWitnessDivinerQuerySchema","DivinerConfigSchema","DivinerWrapper","isModuleState","ModuleStateSchema","PayloadBuilder","moduleName","StatefulDiviner","AbstractDiviner","configSchemas","DivinerConfigSchema","StatefulDivinerConfigSchema","_lastState","commitState","nextState","state","offset","archivist","getArchivistForStateStore","bw","BoundWitnessBuilder","payload","witness","account","build","insert","name","assertEx","config","stateStore","mod","resolve","ArchivistWrapper","wrap","getBoundWitnessDivinerForStateStore","boundWitnessDiviner","DivinerWrapper","getPayloadDivinerForStateStore","payloadDiviner","retrieveState","hash","diviner","query","PayloadBuilder","schema","BoundWitnessDivinerQuerySchema","fields","address","limit","order","payload_schemas","ModuleStateSchema","boundWitnesses","divine","length","boundWitness","isBoundWitness","addresses","map","index","filter","reduce","prev","curr","payload_hashes","get","find","isModuleState","undefined","assertEx","asArchivistInstance","BoundWitnessBuilder","isBoundWitness","BoundWitnessDivinerQuerySchema","asDivinerInstance","isModuleState","ModuleStateSchema","PayloadBuilder","moduleName","StatefulModuleMixin","ModuleBase","StatefulModuleBase","_lastState","commitState","nextState","state","offset","archivist","getArchivistForStore","bw","BoundWitnessBuilder","payload","build","insert","name","assertEx","config","stateStore","mod","resolve","instance","asArchivistInstance","getBoundWitnessDivinerForStore","boundWitnessDiviner","asDivinerInstance","getPayloadDivinerForStateStore","payloadDiviner","retrieveState","hash","diviner","query","PayloadBuilder","schema","BoundWitnessDivinerQuerySchema","fields","limit","order","payload_schemas","ModuleStateSchema","boundWitnesses","divine","length","boundWitness","isBoundWitness","addresses","map","address","index","reduce","prev","curr","payload_hashes","get","find","isModuleState","undefined"]}
|
|
1
|
+
{"version":3,"sources":["../../src/Schema.ts","../../src/Config.ts","../../src/Diviner.ts","../../src/DivinerMixin.ts"],"sourcesContent":["export const StatefulDivinerSchema = 'network.xyo.diviner.stateful' as const\nexport type StatefulDivinerSchema = typeof StatefulDivinerSchema\n","import { DivinerConfig } from '@xyo-network/diviner-model'\nimport { ModuleIdentifier } from '@xyo-network/module-model'\n\nimport { StatefulDivinerSchema } from './Schema'\n\n/**\n * The schema for a Stateful Diviner config\n */\nexport const StatefulDivinerConfigSchema = `${StatefulDivinerSchema}.config` as const\n/**\n * The schema for a Stateful Diviner config\n */\nexport type StatefulDivinerConfigSchema = typeof StatefulDivinerConfigSchema\n\n/**\n * The config for a Stateful Diviner\n */\nexport type StatefulDivinerConfig = DivinerConfig<{\n schema: StatefulDivinerConfigSchema\n stateStore: {\n archivist: ModuleIdentifier\n boundWitnessDiviner: ModuleIdentifier\n payloadDiviner: ModuleIdentifier\n }\n}>\n","import { assertEx } from '@xylabs/assert'\nimport { Hash } from '@xylabs/hex'\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 { DivinerConfigSchema, DivinerModule, DivinerModuleEventData } from '@xyo-network/diviner-model'\nimport { DivinerWrapper } from '@xyo-network/diviner-wrapper'\nimport { isModuleState, ModuleState, ModuleStateSchema, StateDictionary } from '@xyo-network/module-model'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport { Payload, WithMeta } from '@xyo-network/payload-model'\n\nimport { StatefulDivinerConfigSchema } from './Config'\nimport { StatefulDivinerParams } from './Params'\n\nconst moduleName = 'StatefulDiviner'\n\n/**\n * A Diviner that maintains state\n */\nexport abstract class StatefulDiviner<\n TParams extends StatefulDivinerParams = StatefulDivinerParams,\n TIn extends Payload = Payload,\n TOut extends Payload = Payload,\n TEventData extends DivinerModuleEventData<DivinerModule<TParams>, TIn, TOut> = DivinerModuleEventData<DivinerModule<TParams>, TIn, TOut>,\n TState extends StateDictionary = StateDictionary,\n> extends AbstractDiviner<TParams, TIn, TOut, TEventData> {\n static override readonly configSchemas: string[] = [DivinerConfigSchema, StatefulDivinerConfigSchema]\n\n /**\n * The last state\n */\n protected _lastState?: WithMeta<ModuleState<TState>>\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: WithMeta<ModuleState<TState>>) {\n // Don't commit state if no state has changed\n if (nextState.state.offset === this._lastState?.state.offset) return\n this._lastState = nextState\n const archivist = await this.getArchivistForStateStore()\n const [bw] = await (await new BoundWitnessBuilder().payload(nextState)).witness(this.account).build()\n await archivist.insert([bw, nextState])\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 getArchivistForStateStore() {\n const name = assertEx(this.config?.stateStore.archivist, () => `${moduleName}: Config for stateStore.archivist not specified`)\n const mod = assertEx(await this.resolve(name), () => `${moduleName}: Failed to resolve stateStore.archivist`)\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 getBoundWitnessDivinerForStateStore() {\n const name = assertEx(this.config?.stateStore.boundWitnessDiviner, () => `${moduleName}: Config for stateStore.boundWitnessDiviner not specified`)\n const mod = assertEx(await this.resolve(name), () => `${moduleName}: Failed to resolve stateStore.boundWitnessDiviner`)\n return DivinerWrapper.wrap(mod, this.account)\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 getPayloadDivinerForStateStore() {\n const name = assertEx(this.config?.stateStore?.payloadDiviner, () => `${moduleName}: Config for stateStore.payloadDiviner not specified`)\n const mod = assertEx(await this.resolve(name), () => `${moduleName}: Failed to resolve stateStore.payloadDiviner`)\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<WithMeta<ModuleState<TState>> | undefined> {\n if (this._lastState) return this._lastState\n let hash: Hash = ''\n const diviner = await this.getBoundWitnessDivinerForStateStore()\n const query = await new PayloadBuilder<BoundWitnessDivinerQueryPayload>({ schema: BoundWitnessDivinerQuerySchema })\n .fields({\n address: this.account.address,\n limit: 1,\n offset: 0,\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 === this.account.address)\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.getArchivistForStateStore()\n const payload = (await archivist.get([hash])).find(isModuleState<TState>)\n if (payload) {\n return payload as WithMeta<ModuleState<TState>>\n }\n }\n return undefined\n }\n}\n","import { assertEx } from '@xylabs/assert'\nimport { Hash } from '@xylabs/hex'\nimport { asArchivistInstance } from '@xyo-network/archivist-model'\nimport { BoundWitnessBuilder } from '@xyo-network/boundwitness-builder'\nimport { isBoundWitness } from '@xyo-network/boundwitness-model'\nimport { BoundWitnessDivinerQueryPayload, BoundWitnessDivinerQuerySchema } from '@xyo-network/diviner-boundwitness-model'\nimport { asDivinerInstance } from '@xyo-network/diviner-model'\nimport {\n AnyConfigSchema,\n isModuleState,\n ModuleInstance,\n ModuleParams,\n ModuleState,\n ModuleStateSchema,\n StateDictionary,\n} from '@xyo-network/module-model'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport { WithMeta } from '@xyo-network/payload-model'\n\nimport { StatefulDivinerConfig } from './Config'\n\nexport type StatefulModuleParams = ModuleParams<AnyConfigSchema<StatefulDivinerConfig>>\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type AnyModule<TParams extends StatefulModuleParams = StatefulModuleParams> = new (...args: any[]) => ModuleInstance<TParams>\n\nconst moduleName = 'StatefulModuleMixin'\n\n/**\n * @ignore Inherit from StatefulDiviner instead\n * @param ModuleBase\n * @returns\n */\nexport const StatefulModuleMixin = <\n TParams extends StatefulModuleParams = StatefulModuleParams,\n TModule extends AnyModule<TParams> = AnyModule<TParams>,\n TState extends StateDictionary = StateDictionary,\n>(\n ModuleBase: TModule,\n) => {\n abstract class StatefulModuleBase extends ModuleBase {\n _lastState?: WithMeta<ModuleState<TState>>\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 async commitState(nextState: WithMeta<ModuleState<TState>>) {\n // Don't commit state if no state has changed\n if (nextState.state.offset === this._lastState?.state.offset) return\n this._lastState = nextState\n const archivist = await this.getArchivistForStore()\n // const [bw] = await new BoundWitnessBuilder().payload(nextState).witness(this.account).build()\n const [bw] = await (await new BoundWitnessBuilder().payload(nextState)).build()\n await archivist.insert([bw, nextState])\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 async getArchivistForStore() {\n const name = assertEx(this.config?.stateStore?.archivist, () => `${moduleName}: Config for stateStore.archivist not specified`)\n const mod = assertEx(await this.resolve(name), () => `${moduleName}: Failed to resolve stateStore.archivist`)\n // return ArchivistWrapper.wrap(mod, this.account)\n const instance = asArchivistInstance(mod)\n return assertEx(instance, () => `${moduleName}: Failed to wrap archivist instance`)\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 async getBoundWitnessDivinerForStore() {\n const name = assertEx(\n this.config?.stateStore?.boundWitnessDiviner,\n () => `${moduleName}: Config for stateStore.boundWitnessDiviner not specified`,\n )\n const mod = assertEx(await this.resolve(name), () => `${moduleName}: Failed to resolve stateStore.boundWitnessDiviner`)\n // return DivinerWrapper.wrap(mod, this.account)\n const instance = asDivinerInstance(mod)\n return assertEx(instance, () => `${moduleName}: Failed to wrap diviner instance`)\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 async getPayloadDivinerForStateStore() {\n const name = assertEx(this.config?.stateStore?.payloadDiviner, () => `${moduleName}: Config for stateStore.payloadDiviner not specified`)\n const mod = assertEx(await this.resolve(name), () => `${moduleName}: Failed to resolve stateStore.payloadDiviner`)\n // return DivinerWrapper.wrap(mod, this.account)\n const instance = asDivinerInstance(mod)\n return assertEx(instance, () => `${moduleName}: Failed to wrap diviner instance`)\n }\n /**\n * Retrieves the last state of the Diviner process. Used to recover state after\n * preemptions, reboots, etc.\n */\n async retrieveState(): Promise<WithMeta<ModuleState<TState>> | undefined> {\n if (this._lastState) return this._lastState\n let hash: Hash = ''\n const diviner = await this.getBoundWitnessDivinerForStore()\n const query = await new PayloadBuilder<BoundWitnessDivinerQueryPayload>({ schema: BoundWitnessDivinerQuerySchema })\n .fields({\n // address: this.account.address,\n limit: 1,\n offset: 0,\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 === this.account.address)\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()\n const payload = (await archivist.get([hash])).find(isModuleState<TState>)\n if (payload) {\n return payload as WithMeta<ModuleState<TState>>\n }\n }\n return undefined\n }\n }\n return StatefulModuleBase\n}\n"],"mappings":";;;;AAAO,IAAMA,wBAAwB;;;ACQ9B,IAAMC,8BAA8B,GAAGC,qBAAAA;;;ACR9C,SAASC,gBAAgB;AAEzB,SAASC,wBAAwB;AACjC,SAASC,2BAA2B;AACpC,SAASC,sBAAsB;AAC/B,SAASC,uBAAuB;AAChC,SAA0CC,sCAAsC;AAChF,SAASC,2BAAkE;AAC3E,SAASC,sBAAsB;AAC/B,SAASC,eAA4BC,yBAA0C;AAC/E,SAASC,sBAAsB;AAM/B,IAAMC,aAAa;AAKZ,IAAeC,kBAAf,cAMGC,gBAAAA;EA3BV,OA2BUA;;;EACR,OAAyBC,gBAA0B;IAACC;IAAqBC;;;;;EAK/DC;;;;;;;;EASV,MAAgBC,YAAYC,WAA0C;AAEpE,QAAIA,UAAUC,MAAMC,WAAW,KAAKJ,YAAYG,MAAMC;AAAQ;AAC9D,SAAKJ,aAAaE;AAClB,UAAMG,YAAY,MAAM,KAAKC,0BAAyB;AACtD,UAAM,CAACC,EAAAA,IAAM,OAAO,MAAM,IAAIC,oBAAAA,EAAsBC,QAAQP,SAAAA,GAAYQ,QAAQ,KAAKC,OAAO,EAAEC,MAAK;AACnG,UAAMP,UAAUQ,OAAO;MAACN;MAAIL;KAAU;EACxC;;;;;;EAOA,MAAgBI,4BAA4B;AAC1C,UAAMQ,OAAOC,SAAS,KAAKC,QAAQC,WAAWZ,WAAW,MAAM,GAAGX,UAAAA,iDAA2D;AAC7H,UAAMwB,MAAMH,SAAS,MAAM,KAAKI,QAAQL,IAAAA,GAAO,MAAM,GAAGpB,UAAAA,0CAAoD;AAC5G,WAAO0B,iBAAiBC,KAAKH,KAAK,KAAKP,OAAO;EAChD;;;;;;EAOA,MAAgBW,sCA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AoBI,aAAaS,eAAeD,MAAMH,KAAAA,IAASE,MAChI,EAAA;QAEN;MACF;AAGA,UAAIrB,MAAM;AAER,cAAMrB,YAAY,MAAM,KAAKC,qBAAoB;AACjD,cAAMG,WAAW,MAAMJ,UAAU6C,IAAI;UAACxB;SAAK,GAAGyB,KAAKC,cAAAA;AACnD,YAAI3C,SAAS;AACX,iBAAOA;QACT;MACF;AACA,aAAO4C;IACT;EACF;AACA,SAAOtD;AACT,GAjHmC;","names":["StatefulDivinerSchema","StatefulDivinerConfigSchema","StatefulDivinerSchema","assertEx","ArchivistWrapper","BoundWitnessBuilder","isBoundWitness","AbstractDiviner","BoundWitnessDivinerQuerySchema","DivinerConfigSchema","DivinerWrapper","isModuleState","ModuleStateSchema","PayloadBuilder","moduleName","StatefulDiviner","AbstractDiviner","configSchemas","DivinerConfigSchema","StatefulDivinerConfigSchema","_lastState","commitState","nextState","state","offset","archivist","getArchivistForStateStore","bw","BoundWitnessBuilder","payload","witness","account","build","insert","name","assertEx","config","stateStore","mod","resolve","ArchivistWrapper","wrap","getBoundWitnessDivinerForStateStore","boundWitnessDiviner","DivinerWrapper","getPayloadDivinerForStateStore","payloadDiviner","retrieveState","hash","diviner","query","PayloadBuilder","schema","BoundWitnessDivinerQuerySchema","fields","address","limit","order","payload_schemas","ModuleStateSchema","boundWitnesses","divine","length","boundWitness","isBoundWitness","addresses","map","index","filter","reduce","prev","curr","payload_hashes","get","find","isModuleState","undefined","assertEx","asArchivistInstance","BoundWitnessBuilder","isBoundWitness","BoundWitnessDivinerQuerySchema","asDivinerInstance","isModuleState","ModuleStateSchema","PayloadBuilder","moduleName","StatefulModuleMixin","ModuleBase","StatefulModuleBase","_lastState","commitState","nextState","state","offset","archivist","getArchivistForStore","bw","BoundWitnessBuilder","payload","build","insert","name","assertEx","config","stateStore","mod","resolve","instance","asArchivistInstance","getBoundWitnessDivinerForStore","boundWitnessDiviner","asDivinerInstance","getPayloadDivinerForStateStore","payloadDiviner","retrieveState","hash","diviner","query","PayloadBuilder","schema","BoundWitnessDivinerQuerySchema","fields","limit","order","payload_schemas","ModuleStateSchema","boundWitnesses","divine","length","boundWitness","isBoundWitness","addresses","map","address","index","reduce","prev","curr","payload_hashes","get","find","isModuleState","undefined"]}
|
|
@@ -278,9 +278,89 @@ export declare const StatefulModuleMixin: <TParams extends import("@xylabs/objec
|
|
|
278
278
|
* preemptions, reboots, etc.
|
|
279
279
|
*/
|
|
280
280
|
retrieveState(): Promise<WithMeta<ModuleState<TState>> | undefined>;
|
|
281
|
-
readonly downResolver: Omit<import("@xyo-network/module-model").
|
|
281
|
+
readonly downResolver: Omit<import("@xyo-network/module-model").ObjectResolverInstance<ModuleInstance<import("@xylabs/object").BaseParamsFields & {
|
|
282
|
+
account?: import("@xyo-network/account-model").AccountInstance | "random" | undefined;
|
|
283
|
+
config: import("@xyo-network/payload-model").SchemaFields & object & Omit<{
|
|
284
|
+
readonly archivist?: string | undefined;
|
|
285
|
+
readonly labels?: import("@xyo-network/module-model").Labels | undefined;
|
|
286
|
+
readonly name?: string | undefined;
|
|
287
|
+
readonly paging?: Record<string, {
|
|
288
|
+
size?: number | undefined;
|
|
289
|
+
}> | undefined;
|
|
290
|
+
readonly retry?: import("@xylabs/retry").RetryConfig | undefined;
|
|
291
|
+
schema: "network.xyo.module.config";
|
|
292
|
+
readonly security?: {
|
|
293
|
+
readonly allowAnonymous?: boolean | undefined;
|
|
294
|
+
readonly allowed?: Record<string, (Lowercase<string> | import("@xyo-network/module-model").CosigningAddressSet)[]> | undefined;
|
|
295
|
+
readonly disallowed?: Record<string, Lowercase<string>[]> | undefined;
|
|
296
|
+
} | undefined;
|
|
297
|
+
readonly sign?: boolean | undefined;
|
|
298
|
+
readonly storeQueries?: boolean | undefined;
|
|
299
|
+
readonly timestamp?: boolean | undefined;
|
|
300
|
+
} & import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/payload-model").SchemaFields & object & {
|
|
301
|
+
readonly archivist?: string | undefined;
|
|
302
|
+
readonly labels?: import("@xyo-network/module-model").Labels | undefined;
|
|
303
|
+
readonly name?: string | undefined;
|
|
304
|
+
readonly paging?: Record<string, {
|
|
305
|
+
size?: number | undefined;
|
|
306
|
+
}> | undefined;
|
|
307
|
+
readonly retry?: import("@xylabs/retry").RetryConfig | undefined;
|
|
308
|
+
schema: "network.xyo.module.config";
|
|
309
|
+
readonly security?: {
|
|
310
|
+
readonly allowAnonymous?: boolean | undefined;
|
|
311
|
+
readonly allowed?: Record<string, (Lowercase<string> | import("@xyo-network/module-model").CosigningAddressSet)[]> | undefined;
|
|
312
|
+
readonly disallowed?: Record<string, Lowercase<string>[]> | undefined;
|
|
313
|
+
} | undefined;
|
|
314
|
+
readonly sign?: boolean | undefined;
|
|
315
|
+
readonly storeQueries?: boolean | undefined;
|
|
316
|
+
readonly timestamp?: boolean | undefined;
|
|
317
|
+
}, "schema"> & {
|
|
318
|
+
schema: string;
|
|
319
|
+
};
|
|
320
|
+
ephemeralQueryAccountEnabled?: boolean | undefined;
|
|
321
|
+
}, import("@xyo-network/module-model").ModuleEventData<object>>>, "resolve">;
|
|
282
322
|
readonly pipeline?: "one-to-one" | "one-to-many" | "many-to-one" | "many-to-many" | undefined;
|
|
283
|
-
readonly upResolver: Omit<import("@xyo-network/module-model").
|
|
323
|
+
readonly upResolver: Omit<import("@xyo-network/module-model").ObjectResolverInstance<ModuleInstance<import("@xylabs/object").BaseParamsFields & {
|
|
324
|
+
account?: import("@xyo-network/account-model").AccountInstance | "random" | undefined;
|
|
325
|
+
config: import("@xyo-network/payload-model").SchemaFields & object & Omit<{
|
|
326
|
+
readonly archivist?: string | undefined;
|
|
327
|
+
readonly labels?: import("@xyo-network/module-model").Labels | undefined;
|
|
328
|
+
readonly name?: string | undefined;
|
|
329
|
+
readonly paging?: Record<string, {
|
|
330
|
+
size?: number | undefined;
|
|
331
|
+
}> | undefined;
|
|
332
|
+
readonly retry?: import("@xylabs/retry").RetryConfig | undefined;
|
|
333
|
+
schema: "network.xyo.module.config";
|
|
334
|
+
readonly security?: {
|
|
335
|
+
readonly allowAnonymous?: boolean | undefined;
|
|
336
|
+
readonly allowed?: Record<string, (Lowercase<string> | import("@xyo-network/module-model").CosigningAddressSet)[]> | undefined;
|
|
337
|
+
readonly disallowed?: Record<string, Lowercase<string>[]> | undefined;
|
|
338
|
+
} | undefined;
|
|
339
|
+
readonly sign?: boolean | undefined;
|
|
340
|
+
readonly storeQueries?: boolean | undefined;
|
|
341
|
+
readonly timestamp?: boolean | undefined;
|
|
342
|
+
} & import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/payload-model").SchemaFields & object & {
|
|
343
|
+
readonly archivist?: string | undefined;
|
|
344
|
+
readonly labels?: import("@xyo-network/module-model").Labels | undefined;
|
|
345
|
+
readonly name?: string | undefined;
|
|
346
|
+
readonly paging?: Record<string, {
|
|
347
|
+
size?: number | undefined;
|
|
348
|
+
}> | undefined;
|
|
349
|
+
readonly retry?: import("@xylabs/retry").RetryConfig | undefined;
|
|
350
|
+
schema: "network.xyo.module.config";
|
|
351
|
+
readonly security?: {
|
|
352
|
+
readonly allowAnonymous?: boolean | undefined;
|
|
353
|
+
readonly allowed?: Record<string, (Lowercase<string> | import("@xyo-network/module-model").CosigningAddressSet)[]> | undefined;
|
|
354
|
+
readonly disallowed?: Record<string, Lowercase<string>[]> | undefined;
|
|
355
|
+
} | undefined;
|
|
356
|
+
readonly sign?: boolean | undefined;
|
|
357
|
+
readonly storeQueries?: boolean | undefined;
|
|
358
|
+
readonly timestamp?: boolean | undefined;
|
|
359
|
+
}, "schema"> & {
|
|
360
|
+
schema: string;
|
|
361
|
+
};
|
|
362
|
+
ephemeralQueryAccountEnabled?: boolean | undefined;
|
|
363
|
+
}, import("@xyo-network/module-model").ModuleEventData<object>>>, "resolve">;
|
|
284
364
|
address: Lowercase<string>;
|
|
285
365
|
config: TParams["config"];
|
|
286
366
|
id: string;
|
|
@@ -477,7 +557,7 @@ export declare const StatefulModuleMixin: <TParams extends import("@xylabs/objec
|
|
|
477
557
|
schema: string;
|
|
478
558
|
};
|
|
479
559
|
ephemeralQueryAccountEnabled?: boolean | undefined;
|
|
480
|
-
}, import("@xyo-network/module-model").ModuleEventData<object>>>(filter?: import("@xyo-network/module-model").
|
|
560
|
+
}, import("@xyo-network/module-model").ModuleEventData<object>>>(filter?: import("@xyo-network/module-model").ObjectFilter<T_2> | undefined, options?: import("@xyo-network/module-model").ObjectFilterOptions<T_2> | undefined): import("@xylabs/promise").Promisable<T_2[]>;
|
|
481
561
|
resolve<T_3 extends ModuleInstance<import("@xylabs/object").BaseParamsFields & {
|
|
482
562
|
account?: import("@xyo-network/account-model").AccountInstance | "random" | undefined;
|
|
483
563
|
config: import("@xyo-network/payload-model").SchemaFields & object & Omit<{
|
|
@@ -558,7 +638,7 @@ export declare const StatefulModuleMixin: <TParams extends import("@xylabs/objec
|
|
|
558
638
|
schema: string;
|
|
559
639
|
};
|
|
560
640
|
ephemeralQueryAccountEnabled?: boolean | undefined;
|
|
561
|
-
}, import("@xyo-network/module-model").ModuleEventData<object>>>(nameOrAddress: string, options?: import("@xyo-network/module-model").
|
|
641
|
+
}, import("@xyo-network/module-model").ModuleEventData<object>>>(nameOrAddress: string, options?: import("@xyo-network/module-model").ObjectFilterOptions<T_3> | undefined): import("@xylabs/promise").Promisable<T_3 | undefined>;
|
|
562
642
|
resolve<T_4 extends ModuleInstance<import("@xylabs/object").BaseParamsFields & {
|
|
563
643
|
account?: import("@xyo-network/account-model").AccountInstance | "random" | undefined;
|
|
564
644
|
config: import("@xyo-network/payload-model").SchemaFields & object & Omit<{
|
|
@@ -639,7 +719,7 @@ export declare const StatefulModuleMixin: <TParams extends import("@xylabs/objec
|
|
|
639
719
|
schema: string;
|
|
640
720
|
};
|
|
641
721
|
ephemeralQueryAccountEnabled?: boolean | undefined;
|
|
642
|
-
}, import("@xyo-network/module-model").ModuleEventData<object>>>(nameOrAddressOrFilter?: string | import("@xyo-network/module-model").
|
|
722
|
+
}, import("@xyo-network/module-model").ModuleEventData<object>>>(nameOrAddressOrFilter?: string | import("@xyo-network/module-model").ObjectFilter<T_4> | undefined, options?: import("@xyo-network/module-model").ObjectFilterOptions<T_4> | undefined): import("@xylabs/promise").Promisable<T_4 | T_4[] | undefined>;
|
|
643
723
|
describe: () => Promise<import("@xyo-network/module-model").ModuleDescription>;
|
|
644
724
|
discover: () => import("@xylabs/promise").Promisable<({
|
|
645
725
|
schema: string;
|
|
@@ -654,5 +734,8 @@ export declare const StatefulModuleMixin: <TParams extends import("@xylabs/objec
|
|
|
654
734
|
previousHash?: string | undefined;
|
|
655
735
|
schema: string;
|
|
656
736
|
})[]>;
|
|
737
|
+
state: () => import("@xylabs/promise").Promisable<({
|
|
738
|
+
schema: string;
|
|
739
|
+
} & object)[]>;
|
|
657
740
|
}) & TModule;
|
|
658
741
|
//# sourceMappingURL=DivinerMixin.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DivinerMixin.d.ts","sourceRoot":"","sources":["../../src/DivinerMixin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DivinerMixin.d.ts","sourceRoot":"","sources":["../../src/DivinerMixin.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,eAAe,EAEf,cAAc,EACd,YAAY,EACZ,WAAW,EAEX,eAAe,EAChB,MAAM,2BAA2B,CAAA;AAElC,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAErD,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAA;AAEhD,MAAM,MAAM,oBAAoB,GAAG,YAAY,CAAC,eAAe,CAAC,qBAAqB,CAAC,CAAC,CAAA;AAGvF,MAAM,MAAM,SAAS,CAAC,OAAO,SAAS,oBAAoB,GAAG,oBAAoB,IAAI,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,cAAc,CAAC,OAAO,CAAC,CAAA;AAIpI;;;;GAIG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8JATmE,GAAG,EAAE;;IAmBpG;;;;;;OAMG;;IAWH;;;;OAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IASH;;;;OAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAWH;;;;OAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAQH;;;OAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YA2CN,CAAA"}
|
|
@@ -278,9 +278,89 @@ export declare const StatefulModuleMixin: <TParams extends import("@xylabs/objec
|
|
|
278
278
|
* preemptions, reboots, etc.
|
|
279
279
|
*/
|
|
280
280
|
retrieveState(): Promise<WithMeta<ModuleState<TState>> | undefined>;
|
|
281
|
-
readonly downResolver: Omit<import("@xyo-network/module-model").
|
|
281
|
+
readonly downResolver: Omit<import("@xyo-network/module-model").ObjectResolverInstance<ModuleInstance<import("@xylabs/object").BaseParamsFields & {
|
|
282
|
+
account?: import("@xyo-network/account-model").AccountInstance | "random" | undefined;
|
|
283
|
+
config: import("@xyo-network/payload-model").SchemaFields & object & Omit<{
|
|
284
|
+
readonly archivist?: string | undefined;
|
|
285
|
+
readonly labels?: import("@xyo-network/module-model").Labels | undefined;
|
|
286
|
+
readonly name?: string | undefined;
|
|
287
|
+
readonly paging?: Record<string, {
|
|
288
|
+
size?: number | undefined;
|
|
289
|
+
}> | undefined;
|
|
290
|
+
readonly retry?: import("@xylabs/retry").RetryConfig | undefined;
|
|
291
|
+
schema: "network.xyo.module.config";
|
|
292
|
+
readonly security?: {
|
|
293
|
+
readonly allowAnonymous?: boolean | undefined;
|
|
294
|
+
readonly allowed?: Record<string, (Lowercase<string> | import("@xyo-network/module-model").CosigningAddressSet)[]> | undefined;
|
|
295
|
+
readonly disallowed?: Record<string, Lowercase<string>[]> | undefined;
|
|
296
|
+
} | undefined;
|
|
297
|
+
readonly sign?: boolean | undefined;
|
|
298
|
+
readonly storeQueries?: boolean | undefined;
|
|
299
|
+
readonly timestamp?: boolean | undefined;
|
|
300
|
+
} & import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/payload-model").SchemaFields & object & {
|
|
301
|
+
readonly archivist?: string | undefined;
|
|
302
|
+
readonly labels?: import("@xyo-network/module-model").Labels | undefined;
|
|
303
|
+
readonly name?: string | undefined;
|
|
304
|
+
readonly paging?: Record<string, {
|
|
305
|
+
size?: number | undefined;
|
|
306
|
+
}> | undefined;
|
|
307
|
+
readonly retry?: import("@xylabs/retry").RetryConfig | undefined;
|
|
308
|
+
schema: "network.xyo.module.config";
|
|
309
|
+
readonly security?: {
|
|
310
|
+
readonly allowAnonymous?: boolean | undefined;
|
|
311
|
+
readonly allowed?: Record<string, (Lowercase<string> | import("@xyo-network/module-model").CosigningAddressSet)[]> | undefined;
|
|
312
|
+
readonly disallowed?: Record<string, Lowercase<string>[]> | undefined;
|
|
313
|
+
} | undefined;
|
|
314
|
+
readonly sign?: boolean | undefined;
|
|
315
|
+
readonly storeQueries?: boolean | undefined;
|
|
316
|
+
readonly timestamp?: boolean | undefined;
|
|
317
|
+
}, "schema"> & {
|
|
318
|
+
schema: string;
|
|
319
|
+
};
|
|
320
|
+
ephemeralQueryAccountEnabled?: boolean | undefined;
|
|
321
|
+
}, import("@xyo-network/module-model").ModuleEventData<object>>>, "resolve">;
|
|
282
322
|
readonly pipeline?: "one-to-one" | "one-to-many" | "many-to-one" | "many-to-many" | undefined;
|
|
283
|
-
readonly upResolver: Omit<import("@xyo-network/module-model").
|
|
323
|
+
readonly upResolver: Omit<import("@xyo-network/module-model").ObjectResolverInstance<ModuleInstance<import("@xylabs/object").BaseParamsFields & {
|
|
324
|
+
account?: import("@xyo-network/account-model").AccountInstance | "random" | undefined;
|
|
325
|
+
config: import("@xyo-network/payload-model").SchemaFields & object & Omit<{
|
|
326
|
+
readonly archivist?: string | undefined;
|
|
327
|
+
readonly labels?: import("@xyo-network/module-model").Labels | undefined;
|
|
328
|
+
readonly name?: string | undefined;
|
|
329
|
+
readonly paging?: Record<string, {
|
|
330
|
+
size?: number | undefined;
|
|
331
|
+
}> | undefined;
|
|
332
|
+
readonly retry?: import("@xylabs/retry").RetryConfig | undefined;
|
|
333
|
+
schema: "network.xyo.module.config";
|
|
334
|
+
readonly security?: {
|
|
335
|
+
readonly allowAnonymous?: boolean | undefined;
|
|
336
|
+
readonly allowed?: Record<string, (Lowercase<string> | import("@xyo-network/module-model").CosigningAddressSet)[]> | undefined;
|
|
337
|
+
readonly disallowed?: Record<string, Lowercase<string>[]> | undefined;
|
|
338
|
+
} | undefined;
|
|
339
|
+
readonly sign?: boolean | undefined;
|
|
340
|
+
readonly storeQueries?: boolean | undefined;
|
|
341
|
+
readonly timestamp?: boolean | undefined;
|
|
342
|
+
} & import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/payload-model").SchemaFields & object & {
|
|
343
|
+
readonly archivist?: string | undefined;
|
|
344
|
+
readonly labels?: import("@xyo-network/module-model").Labels | undefined;
|
|
345
|
+
readonly name?: string | undefined;
|
|
346
|
+
readonly paging?: Record<string, {
|
|
347
|
+
size?: number | undefined;
|
|
348
|
+
}> | undefined;
|
|
349
|
+
readonly retry?: import("@xylabs/retry").RetryConfig | undefined;
|
|
350
|
+
schema: "network.xyo.module.config";
|
|
351
|
+
readonly security?: {
|
|
352
|
+
readonly allowAnonymous?: boolean | undefined;
|
|
353
|
+
readonly allowed?: Record<string, (Lowercase<string> | import("@xyo-network/module-model").CosigningAddressSet)[]> | undefined;
|
|
354
|
+
readonly disallowed?: Record<string, Lowercase<string>[]> | undefined;
|
|
355
|
+
} | undefined;
|
|
356
|
+
readonly sign?: boolean | undefined;
|
|
357
|
+
readonly storeQueries?: boolean | undefined;
|
|
358
|
+
readonly timestamp?: boolean | undefined;
|
|
359
|
+
}, "schema"> & {
|
|
360
|
+
schema: string;
|
|
361
|
+
};
|
|
362
|
+
ephemeralQueryAccountEnabled?: boolean | undefined;
|
|
363
|
+
}, import("@xyo-network/module-model").ModuleEventData<object>>>, "resolve">;
|
|
284
364
|
address: Lowercase<string>;
|
|
285
365
|
config: TParams["config"];
|
|
286
366
|
id: string;
|
|
@@ -477,7 +557,7 @@ export declare const StatefulModuleMixin: <TParams extends import("@xylabs/objec
|
|
|
477
557
|
schema: string;
|
|
478
558
|
};
|
|
479
559
|
ephemeralQueryAccountEnabled?: boolean | undefined;
|
|
480
|
-
}, import("@xyo-network/module-model").ModuleEventData<object>>>(filter?: import("@xyo-network/module-model").
|
|
560
|
+
}, import("@xyo-network/module-model").ModuleEventData<object>>>(filter?: import("@xyo-network/module-model").ObjectFilter<T_2> | undefined, options?: import("@xyo-network/module-model").ObjectFilterOptions<T_2> | undefined): import("@xylabs/promise").Promisable<T_2[]>;
|
|
481
561
|
resolve<T_3 extends ModuleInstance<import("@xylabs/object").BaseParamsFields & {
|
|
482
562
|
account?: import("@xyo-network/account-model").AccountInstance | "random" | undefined;
|
|
483
563
|
config: import("@xyo-network/payload-model").SchemaFields & object & Omit<{
|
|
@@ -558,7 +638,7 @@ export declare const StatefulModuleMixin: <TParams extends import("@xylabs/objec
|
|
|
558
638
|
schema: string;
|
|
559
639
|
};
|
|
560
640
|
ephemeralQueryAccountEnabled?: boolean | undefined;
|
|
561
|
-
}, import("@xyo-network/module-model").ModuleEventData<object>>>(nameOrAddress: string, options?: import("@xyo-network/module-model").
|
|
641
|
+
}, import("@xyo-network/module-model").ModuleEventData<object>>>(nameOrAddress: string, options?: import("@xyo-network/module-model").ObjectFilterOptions<T_3> | undefined): import("@xylabs/promise").Promisable<T_3 | undefined>;
|
|
562
642
|
resolve<T_4 extends ModuleInstance<import("@xylabs/object").BaseParamsFields & {
|
|
563
643
|
account?: import("@xyo-network/account-model").AccountInstance | "random" | undefined;
|
|
564
644
|
config: import("@xyo-network/payload-model").SchemaFields & object & Omit<{
|
|
@@ -639,7 +719,7 @@ export declare const StatefulModuleMixin: <TParams extends import("@xylabs/objec
|
|
|
639
719
|
schema: string;
|
|
640
720
|
};
|
|
641
721
|
ephemeralQueryAccountEnabled?: boolean | undefined;
|
|
642
|
-
}, import("@xyo-network/module-model").ModuleEventData<object>>>(nameOrAddressOrFilter?: string | import("@xyo-network/module-model").
|
|
722
|
+
}, import("@xyo-network/module-model").ModuleEventData<object>>>(nameOrAddressOrFilter?: string | import("@xyo-network/module-model").ObjectFilter<T_4> | undefined, options?: import("@xyo-network/module-model").ObjectFilterOptions<T_4> | undefined): import("@xylabs/promise").Promisable<T_4 | T_4[] | undefined>;
|
|
643
723
|
describe: () => Promise<import("@xyo-network/module-model").ModuleDescription>;
|
|
644
724
|
discover: () => import("@xylabs/promise").Promisable<({
|
|
645
725
|
schema: string;
|
|
@@ -654,5 +734,8 @@ export declare const StatefulModuleMixin: <TParams extends import("@xylabs/objec
|
|
|
654
734
|
previousHash?: string | undefined;
|
|
655
735
|
schema: string;
|
|
656
736
|
})[]>;
|
|
737
|
+
state: () => import("@xylabs/promise").Promisable<({
|
|
738
|
+
schema: string;
|
|
739
|
+
} & object)[]>;
|
|
657
740
|
}) & TModule;
|
|
658
741
|
//# sourceMappingURL=DivinerMixin.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DivinerMixin.d.ts","sourceRoot":"","sources":["../../src/DivinerMixin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DivinerMixin.d.ts","sourceRoot":"","sources":["../../src/DivinerMixin.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,eAAe,EAEf,cAAc,EACd,YAAY,EACZ,WAAW,EAEX,eAAe,EAChB,MAAM,2BAA2B,CAAA;AAElC,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAErD,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAA;AAEhD,MAAM,MAAM,oBAAoB,GAAG,YAAY,CAAC,eAAe,CAAC,qBAAqB,CAAC,CAAC,CAAA;AAGvF,MAAM,MAAM,SAAS,CAAC,OAAO,SAAS,oBAAoB,GAAG,oBAAoB,IAAI,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,cAAc,CAAC,OAAO,CAAC,CAAA;AAIpI;;;;GAIG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8JATmE,GAAG,EAAE;;IAmBpG;;;;;;OAMG;;IAWH;;;;OAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IASH;;;;OAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAWH;;;;OAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAQH;;;OAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YA2CN,CAAA"}
|
|
@@ -278,9 +278,89 @@ export declare const StatefulModuleMixin: <TParams extends import("@xylabs/objec
|
|
|
278
278
|
* preemptions, reboots, etc.
|
|
279
279
|
*/
|
|
280
280
|
retrieveState(): Promise<WithMeta<ModuleState<TState>> | undefined>;
|
|
281
|
-
readonly downResolver: Omit<import("@xyo-network/module-model").
|
|
281
|
+
readonly downResolver: Omit<import("@xyo-network/module-model").ObjectResolverInstance<ModuleInstance<import("@xylabs/object").BaseParamsFields & {
|
|
282
|
+
account?: import("@xyo-network/account-model").AccountInstance | "random" | undefined;
|
|
283
|
+
config: import("@xyo-network/payload-model").SchemaFields & object & Omit<{
|
|
284
|
+
readonly archivist?: string | undefined;
|
|
285
|
+
readonly labels?: import("@xyo-network/module-model").Labels | undefined;
|
|
286
|
+
readonly name?: string | undefined;
|
|
287
|
+
readonly paging?: Record<string, {
|
|
288
|
+
size?: number | undefined;
|
|
289
|
+
}> | undefined;
|
|
290
|
+
readonly retry?: import("@xylabs/retry").RetryConfig | undefined;
|
|
291
|
+
schema: "network.xyo.module.config";
|
|
292
|
+
readonly security?: {
|
|
293
|
+
readonly allowAnonymous?: boolean | undefined;
|
|
294
|
+
readonly allowed?: Record<string, (Lowercase<string> | import("@xyo-network/module-model").CosigningAddressSet)[]> | undefined;
|
|
295
|
+
readonly disallowed?: Record<string, Lowercase<string>[]> | undefined;
|
|
296
|
+
} | undefined;
|
|
297
|
+
readonly sign?: boolean | undefined;
|
|
298
|
+
readonly storeQueries?: boolean | undefined;
|
|
299
|
+
readonly timestamp?: boolean | undefined;
|
|
300
|
+
} & import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/payload-model").SchemaFields & object & {
|
|
301
|
+
readonly archivist?: string | undefined;
|
|
302
|
+
readonly labels?: import("@xyo-network/module-model").Labels | undefined;
|
|
303
|
+
readonly name?: string | undefined;
|
|
304
|
+
readonly paging?: Record<string, {
|
|
305
|
+
size?: number | undefined;
|
|
306
|
+
}> | undefined;
|
|
307
|
+
readonly retry?: import("@xylabs/retry").RetryConfig | undefined;
|
|
308
|
+
schema: "network.xyo.module.config";
|
|
309
|
+
readonly security?: {
|
|
310
|
+
readonly allowAnonymous?: boolean | undefined;
|
|
311
|
+
readonly allowed?: Record<string, (Lowercase<string> | import("@xyo-network/module-model").CosigningAddressSet)[]> | undefined;
|
|
312
|
+
readonly disallowed?: Record<string, Lowercase<string>[]> | undefined;
|
|
313
|
+
} | undefined;
|
|
314
|
+
readonly sign?: boolean | undefined;
|
|
315
|
+
readonly storeQueries?: boolean | undefined;
|
|
316
|
+
readonly timestamp?: boolean | undefined;
|
|
317
|
+
}, "schema"> & {
|
|
318
|
+
schema: string;
|
|
319
|
+
};
|
|
320
|
+
ephemeralQueryAccountEnabled?: boolean | undefined;
|
|
321
|
+
}, import("@xyo-network/module-model").ModuleEventData<object>>>, "resolve">;
|
|
282
322
|
readonly pipeline?: "one-to-one" | "one-to-many" | "many-to-one" | "many-to-many" | undefined;
|
|
283
|
-
readonly upResolver: Omit<import("@xyo-network/module-model").
|
|
323
|
+
readonly upResolver: Omit<import("@xyo-network/module-model").ObjectResolverInstance<ModuleInstance<import("@xylabs/object").BaseParamsFields & {
|
|
324
|
+
account?: import("@xyo-network/account-model").AccountInstance | "random" | undefined;
|
|
325
|
+
config: import("@xyo-network/payload-model").SchemaFields & object & Omit<{
|
|
326
|
+
readonly archivist?: string | undefined;
|
|
327
|
+
readonly labels?: import("@xyo-network/module-model").Labels | undefined;
|
|
328
|
+
readonly name?: string | undefined;
|
|
329
|
+
readonly paging?: Record<string, {
|
|
330
|
+
size?: number | undefined;
|
|
331
|
+
}> | undefined;
|
|
332
|
+
readonly retry?: import("@xylabs/retry").RetryConfig | undefined;
|
|
333
|
+
schema: "network.xyo.module.config";
|
|
334
|
+
readonly security?: {
|
|
335
|
+
readonly allowAnonymous?: boolean | undefined;
|
|
336
|
+
readonly allowed?: Record<string, (Lowercase<string> | import("@xyo-network/module-model").CosigningAddressSet)[]> | undefined;
|
|
337
|
+
readonly disallowed?: Record<string, Lowercase<string>[]> | undefined;
|
|
338
|
+
} | undefined;
|
|
339
|
+
readonly sign?: boolean | undefined;
|
|
340
|
+
readonly storeQueries?: boolean | undefined;
|
|
341
|
+
readonly timestamp?: boolean | undefined;
|
|
342
|
+
} & import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/payload-model").SchemaFields & object & {
|
|
343
|
+
readonly archivist?: string | undefined;
|
|
344
|
+
readonly labels?: import("@xyo-network/module-model").Labels | undefined;
|
|
345
|
+
readonly name?: string | undefined;
|
|
346
|
+
readonly paging?: Record<string, {
|
|
347
|
+
size?: number | undefined;
|
|
348
|
+
}> | undefined;
|
|
349
|
+
readonly retry?: import("@xylabs/retry").RetryConfig | undefined;
|
|
350
|
+
schema: "network.xyo.module.config";
|
|
351
|
+
readonly security?: {
|
|
352
|
+
readonly allowAnonymous?: boolean | undefined;
|
|
353
|
+
readonly allowed?: Record<string, (Lowercase<string> | import("@xyo-network/module-model").CosigningAddressSet)[]> | undefined;
|
|
354
|
+
readonly disallowed?: Record<string, Lowercase<string>[]> | undefined;
|
|
355
|
+
} | undefined;
|
|
356
|
+
readonly sign?: boolean | undefined;
|
|
357
|
+
readonly storeQueries?: boolean | undefined;
|
|
358
|
+
readonly timestamp?: boolean | undefined;
|
|
359
|
+
}, "schema"> & {
|
|
360
|
+
schema: string;
|
|
361
|
+
};
|
|
362
|
+
ephemeralQueryAccountEnabled?: boolean | undefined;
|
|
363
|
+
}, import("@xyo-network/module-model").ModuleEventData<object>>>, "resolve">;
|
|
284
364
|
address: Lowercase<string>;
|
|
285
365
|
config: TParams["config"];
|
|
286
366
|
id: string;
|
|
@@ -477,7 +557,7 @@ export declare const StatefulModuleMixin: <TParams extends import("@xylabs/objec
|
|
|
477
557
|
schema: string;
|
|
478
558
|
};
|
|
479
559
|
ephemeralQueryAccountEnabled?: boolean | undefined;
|
|
480
|
-
}, import("@xyo-network/module-model").ModuleEventData<object>>>(filter?: import("@xyo-network/module-model").
|
|
560
|
+
}, import("@xyo-network/module-model").ModuleEventData<object>>>(filter?: import("@xyo-network/module-model").ObjectFilter<T_2> | undefined, options?: import("@xyo-network/module-model").ObjectFilterOptions<T_2> | undefined): import("@xylabs/promise").Promisable<T_2[]>;
|
|
481
561
|
resolve<T_3 extends ModuleInstance<import("@xylabs/object").BaseParamsFields & {
|
|
482
562
|
account?: import("@xyo-network/account-model").AccountInstance | "random" | undefined;
|
|
483
563
|
config: import("@xyo-network/payload-model").SchemaFields & object & Omit<{
|
|
@@ -558,7 +638,7 @@ export declare const StatefulModuleMixin: <TParams extends import("@xylabs/objec
|
|
|
558
638
|
schema: string;
|
|
559
639
|
};
|
|
560
640
|
ephemeralQueryAccountEnabled?: boolean | undefined;
|
|
561
|
-
}, import("@xyo-network/module-model").ModuleEventData<object>>>(nameOrAddress: string, options?: import("@xyo-network/module-model").
|
|
641
|
+
}, import("@xyo-network/module-model").ModuleEventData<object>>>(nameOrAddress: string, options?: import("@xyo-network/module-model").ObjectFilterOptions<T_3> | undefined): import("@xylabs/promise").Promisable<T_3 | undefined>;
|
|
562
642
|
resolve<T_4 extends ModuleInstance<import("@xylabs/object").BaseParamsFields & {
|
|
563
643
|
account?: import("@xyo-network/account-model").AccountInstance | "random" | undefined;
|
|
564
644
|
config: import("@xyo-network/payload-model").SchemaFields & object & Omit<{
|
|
@@ -639,7 +719,7 @@ export declare const StatefulModuleMixin: <TParams extends import("@xylabs/objec
|
|
|
639
719
|
schema: string;
|
|
640
720
|
};
|
|
641
721
|
ephemeralQueryAccountEnabled?: boolean | undefined;
|
|
642
|
-
}, import("@xyo-network/module-model").ModuleEventData<object>>>(nameOrAddressOrFilter?: string | import("@xyo-network/module-model").
|
|
722
|
+
}, import("@xyo-network/module-model").ModuleEventData<object>>>(nameOrAddressOrFilter?: string | import("@xyo-network/module-model").ObjectFilter<T_4> | undefined, options?: import("@xyo-network/module-model").ObjectFilterOptions<T_4> | undefined): import("@xylabs/promise").Promisable<T_4 | T_4[] | undefined>;
|
|
643
723
|
describe: () => Promise<import("@xyo-network/module-model").ModuleDescription>;
|
|
644
724
|
discover: () => import("@xylabs/promise").Promisable<({
|
|
645
725
|
schema: string;
|
|
@@ -654,5 +734,8 @@ export declare const StatefulModuleMixin: <TParams extends import("@xylabs/objec
|
|
|
654
734
|
previousHash?: string | undefined;
|
|
655
735
|
schema: string;
|
|
656
736
|
})[]>;
|
|
737
|
+
state: () => import("@xylabs/promise").Promisable<({
|
|
738
|
+
schema: string;
|
|
739
|
+
} & object)[]>;
|
|
657
740
|
}) & TModule;
|
|
658
741
|
//# sourceMappingURL=DivinerMixin.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DivinerMixin.d.ts","sourceRoot":"","sources":["../../src/DivinerMixin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DivinerMixin.d.ts","sourceRoot":"","sources":["../../src/DivinerMixin.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,eAAe,EAEf,cAAc,EACd,YAAY,EACZ,WAAW,EAEX,eAAe,EAChB,MAAM,2BAA2B,CAAA;AAElC,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAErD,OA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