@xyo-network/diviner-stateful 3.9.17 → 3.9.19
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/neutral/Config.d.ts +22 -0
- package/dist/neutral/Config.d.ts.map +1 -0
- package/dist/neutral/Diviner.d.ts +80 -0
- package/dist/neutral/Diviner.d.ts.map +1 -0
- package/dist/neutral/DivinerMixin.d.ts +278 -0
- package/dist/neutral/DivinerMixin.d.ts.map +1 -0
- package/dist/neutral/Params.d.ts +8 -0
- package/dist/neutral/Params.d.ts.map +1 -0
- package/dist/neutral/Schema.d.ts +3 -0
- package/dist/neutral/Schema.d.ts.map +1 -0
- package/dist/neutral/index.d.ts +6 -351
- package/dist/neutral/index.d.ts.map +1 -0
- package/dist/neutral/index.mjs +1 -3
- package/dist/neutral/index.mjs.map +1 -1
- package/package.json +23 -23
- package/src/Diviner.ts +4 -3
- package/src/DivinerMixin.ts +2 -1
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { DivinerConfig } from '@xyo-network/diviner-model';
|
|
2
|
+
import type { ModuleIdentifier } from '@xyo-network/module-model';
|
|
3
|
+
/**
|
|
4
|
+
* The schema for a Stateful Diviner config
|
|
5
|
+
*/
|
|
6
|
+
export declare const StatefulDivinerConfigSchema: "network.xyo.diviner.stateful.config";
|
|
7
|
+
/**
|
|
8
|
+
* The schema for a Stateful Diviner config
|
|
9
|
+
*/
|
|
10
|
+
export type StatefulDivinerConfigSchema = typeof StatefulDivinerConfigSchema;
|
|
11
|
+
/**
|
|
12
|
+
* The config for a Stateful Diviner
|
|
13
|
+
*/
|
|
14
|
+
export type StatefulDivinerConfig = DivinerConfig<{
|
|
15
|
+
schema: StatefulDivinerConfigSchema;
|
|
16
|
+
stateStore: {
|
|
17
|
+
archivist: ModuleIdentifier;
|
|
18
|
+
boundWitnessDiviner: ModuleIdentifier;
|
|
19
|
+
payloadDiviner: ModuleIdentifier;
|
|
20
|
+
};
|
|
21
|
+
}>;
|
|
22
|
+
//# sourceMappingURL=Config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Config.d.ts","sourceRoot":"","sources":["../../src/Config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC/D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;AAIjE;;GAEG;AACH,eAAO,MAAM,2BAA2B,uCAA6C,CAAA;AACrF;;GAEG;AACH,MAAM,MAAM,2BAA2B,GAAG,OAAO,2BAA2B,CAAA;AAE5E;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG,aAAa,CAAC;IAChD,MAAM,EAAE,2BAA2B,CAAA;IACnC,UAAU,EAAE;QACV,SAAS,EAAE,gBAAgB,CAAA;QAC3B,mBAAmB,EAAE,gBAAgB,CAAA;QACrC,cAAc,EAAE,gBAAgB,CAAA;KACjC,CAAA;CACF,CAAC,CAAA"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { ArchivistWrapper } from '@xyo-network/archivist-wrapper';
|
|
2
|
+
import { AbstractDiviner } from '@xyo-network/diviner-abstract';
|
|
3
|
+
import type { DivinerInstance, DivinerModuleEventData } from '@xyo-network/diviner-model';
|
|
4
|
+
import { DivinerWrapper } from '@xyo-network/diviner-wrapper';
|
|
5
|
+
import type { ModuleState, StateDictionary } from '@xyo-network/module-model';
|
|
6
|
+
import type { Payload, Schema } from '@xyo-network/payload-model';
|
|
7
|
+
import type { StatefulDivinerParams } from './Params.ts';
|
|
8
|
+
/**
|
|
9
|
+
* A Diviner that maintains state
|
|
10
|
+
*/
|
|
11
|
+
export declare abstract class StatefulDiviner<TParams extends StatefulDivinerParams = StatefulDivinerParams, TIn extends Payload = Payload, TOut extends Payload = Payload, TEventData extends DivinerModuleEventData<DivinerInstance<TParams, TIn, TOut>, TIn, TOut> = DivinerModuleEventData<DivinerInstance<TParams, TIn, TOut>, TIn, TOut>, TState extends StateDictionary = StateDictionary> extends AbstractDiviner<TParams, TIn, TOut, TEventData> {
|
|
12
|
+
static readonly configSchemas: Schema[];
|
|
13
|
+
static readonly defaultConfigSchema: Schema;
|
|
14
|
+
/**
|
|
15
|
+
* The last state
|
|
16
|
+
*/
|
|
17
|
+
protected _lastState?: ModuleState<TState>;
|
|
18
|
+
/**
|
|
19
|
+
* Commit the internal state of the Diviner process. This is similar
|
|
20
|
+
* to a transaction completion in a database and should only be called
|
|
21
|
+
* when results have been successfully persisted to the appropriate
|
|
22
|
+
* external stores.
|
|
23
|
+
* @param nextState The state to commit
|
|
24
|
+
*/
|
|
25
|
+
protected commitState(nextState: ModuleState<TState>): Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* Retrieves the archivist for the specified store
|
|
28
|
+
* @param store The store to retrieve the archivist for
|
|
29
|
+
* @returns The archivist for the specified store
|
|
30
|
+
*/
|
|
31
|
+
protected getArchivistForStateStore(): Promise<ArchivistWrapper<import("@xyo-network/archivist-model").ArchivistModuleInstance<import("@xylabs/object").BaseParamsFields & {
|
|
32
|
+
account?: import("@xyo-network/account-model").AccountInstance | "random";
|
|
33
|
+
addToResolvers?: boolean;
|
|
34
|
+
additionalSigners?: import("@xyo-network/account-model").AccountInstance[];
|
|
35
|
+
allowNameResolution?: boolean;
|
|
36
|
+
config: import("@xyo-network/module-model").AnyConfigSchema<import("@xyo-network/archivist-model").ArchivistConfig>;
|
|
37
|
+
ephemeralQueryAccountEnabled?: boolean;
|
|
38
|
+
moduleIdentifierTransformers?: import("@xyo-network/module-model").ModuleIdentifierTransformer[];
|
|
39
|
+
privateChildren?: import("@xyo-network/module-model").ModuleInstance[];
|
|
40
|
+
publicChildren?: import("@xyo-network/module-model").ModuleInstance[];
|
|
41
|
+
}, import("@xyo-network/archivist-model").ArchivistModuleEventData>>>;
|
|
42
|
+
/**
|
|
43
|
+
* Retrieves the BoundWitness Diviner for the specified store
|
|
44
|
+
* @param store The store to retrieve the BoundWitness Diviner for
|
|
45
|
+
* @returns The BoundWitness Diviner for the specified store
|
|
46
|
+
*/
|
|
47
|
+
protected getBoundWitnessDivinerForStateStore(): Promise<DivinerWrapper<import("@xyo-network/diviner-model").DivinerModule<import("@xylabs/object").BaseParamsFields & {
|
|
48
|
+
account?: import("@xyo-network/account-model").AccountInstance | "random";
|
|
49
|
+
addToResolvers?: boolean;
|
|
50
|
+
additionalSigners?: import("@xyo-network/account-model").AccountInstance[];
|
|
51
|
+
allowNameResolution?: boolean;
|
|
52
|
+
config: import("@xyo-network/module-model").AnyConfigSchema<import("@xyo-network/diviner-model").DivinerConfig>;
|
|
53
|
+
ephemeralQueryAccountEnabled?: boolean;
|
|
54
|
+
moduleIdentifierTransformers?: import("@xyo-network/module-model").ModuleIdentifierTransformer[];
|
|
55
|
+
privateChildren?: import("@xyo-network/module-model").ModuleInstance[];
|
|
56
|
+
publicChildren?: import("@xyo-network/module-model").ModuleInstance[];
|
|
57
|
+
}, DivinerModuleEventData>, Payload, Payload>>;
|
|
58
|
+
/**
|
|
59
|
+
* Retrieves the Payload Diviner for the specified store
|
|
60
|
+
* @param store The store to retrieve the Payload Diviner for
|
|
61
|
+
* @returns The Payload Diviner for the specified store
|
|
62
|
+
*/
|
|
63
|
+
protected getPayloadDivinerForStateStore(): Promise<DivinerWrapper<import("@xyo-network/diviner-model").DivinerModule<import("@xylabs/object").BaseParamsFields & {
|
|
64
|
+
account?: import("@xyo-network/account-model").AccountInstance | "random";
|
|
65
|
+
addToResolvers?: boolean;
|
|
66
|
+
additionalSigners?: import("@xyo-network/account-model").AccountInstance[];
|
|
67
|
+
allowNameResolution?: boolean;
|
|
68
|
+
config: import("@xyo-network/module-model").AnyConfigSchema<import("@xyo-network/diviner-model").DivinerConfig>;
|
|
69
|
+
ephemeralQueryAccountEnabled?: boolean;
|
|
70
|
+
moduleIdentifierTransformers?: import("@xyo-network/module-model").ModuleIdentifierTransformer[];
|
|
71
|
+
privateChildren?: import("@xyo-network/module-model").ModuleInstance[];
|
|
72
|
+
publicChildren?: import("@xyo-network/module-model").ModuleInstance[];
|
|
73
|
+
}, DivinerModuleEventData>, Payload, Payload>>;
|
|
74
|
+
/**
|
|
75
|
+
* Retrieves the last state of the Diviner process. Used to recover state after
|
|
76
|
+
* preemptions, reboots, etc.
|
|
77
|
+
*/
|
|
78
|
+
protected retrieveState(): Promise<ModuleState<TState> | undefined>;
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=Diviner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Diviner.d.ts","sourceRoot":"","sources":["../../src/Diviner.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AAGjE,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAG/D,OAAO,KAAK,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAA;AACzF,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAC7D,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAG7E,OAAO,KAAK,EACV,OAAO,EAAE,MAAM,EAEhB,MAAM,4BAA4B,CAAA;AAInC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AAIxD;;GAEG;AACH,8BAAsB,eAAe,CACnC,OAAO,SAAS,qBAAqB,GAAG,qBAAqB,EAC7D,GAAG,SAAS,OAAO,GAAG,OAAO,EAC7B,IAAI,SAAS,OAAO,GAAG,OAAO,EAC9B,UAAU,SAAS,sBAAsB,CAAC,eAAe,CAAC,OAAO,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,sBAAsB,CAChH,eAAe,CAAC,OAAO,EAAE,GAAG,EAAE,IAAI,CAAC,EACnC,GAAG,EACH,IAAI,CACL,EACD,MAAM,SAAS,eAAe,GAAG,eAAe,CAChD,SAAQ,eAAe,CAAC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,CAAC;IACvD,gBAAyB,aAAa,EAAE,MAAM,EAAE,CAAwD;IACxG,gBAAyB,mBAAmB,EAAE,MAAM,CAA8B;IAElF;;OAEG;IACH,SAAS,CAAC,UAAU,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;IAE1C;;;;;;OAMG;cACa,WAAW,CAAC,SAAS,EAAE,WAAW,CAAC,MAAM,CAAC;IAS1D;;;;OAIG;cACa,yBAAyB;;;;;;;;;;;IAMzC;;;;OAIG;cACa,mCAAmC;;;;;;;;;;;IAMnD;;;;OAIG;cACa,8BAA8B;;;;;;;;;;;IAM9C;;;OAGG;cACa,aAAa,IAAI,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC;CAwC1E"}
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
import type { AnyConfigSchema, ModuleInstance, ModuleParams, ModuleState, StateDictionary } from '@xyo-network/module-model';
|
|
2
|
+
import type { StatefulDivinerConfig } from './Config.ts';
|
|
3
|
+
export type StatefulModuleParams = ModuleParams<AnyConfigSchema<StatefulDivinerConfig>>;
|
|
4
|
+
export type AnyModule<TParams extends StatefulModuleParams = StatefulModuleParams> = new (...args: any[]) => ModuleInstance<TParams>;
|
|
5
|
+
/**
|
|
6
|
+
* @ignore Inherit from StatefulDiviner instead
|
|
7
|
+
* @param ModuleBase
|
|
8
|
+
* @returns
|
|
9
|
+
*/
|
|
10
|
+
export declare const StatefulModuleMixin: <TParams extends StatefulModuleParams = StatefulModuleParams, TModule extends AnyModule<TParams> = AnyModule<TParams>, TState extends StateDictionary = StateDictionary>(ModuleBase: TModule) => (abstract new (...args: any[]) => {
|
|
11
|
+
_lastState?: ModuleState<TState>;
|
|
12
|
+
/**
|
|
13
|
+
* Commit the internal state of the Diviner process. This is similar
|
|
14
|
+
* to a transaction completion in a database and should only be called
|
|
15
|
+
* when results have been successfully persisted to the appropriate
|
|
16
|
+
* external stores.
|
|
17
|
+
* @param nextState The state to commit
|
|
18
|
+
*/
|
|
19
|
+
commitState(nextState: ModuleState<TState>): Promise<void>;
|
|
20
|
+
/**
|
|
21
|
+
* Retrieves the archivist for the specified store
|
|
22
|
+
* @param store The store to retrieve the archivist for
|
|
23
|
+
* @returns The archivist for the specified store
|
|
24
|
+
*/
|
|
25
|
+
getArchivistForStore(): Promise<import("@xyo-network/archivist-model").ArchivistInstance<import("@xylabs/object").BaseParamsFields & {
|
|
26
|
+
account?: import("@xyo-network/account-model").AccountInstance | "random";
|
|
27
|
+
addToResolvers?: boolean;
|
|
28
|
+
additionalSigners?: import("@xyo-network/account-model").AccountInstance[];
|
|
29
|
+
allowNameResolution?: boolean;
|
|
30
|
+
config: import("@xyo-network/module-model").AnyConfigSchema<import("@xyo-network/archivist-model").ArchivistConfig>;
|
|
31
|
+
ephemeralQueryAccountEnabled?: boolean;
|
|
32
|
+
moduleIdentifierTransformers?: import("@xyo-network/module-model").ModuleIdentifierTransformer[];
|
|
33
|
+
privateChildren?: import("@xyo-network/module-model").ModuleInstance[];
|
|
34
|
+
publicChildren?: import("@xyo-network/module-model").ModuleInstance[];
|
|
35
|
+
} & import("@xyo-network/archivist-model").ArchivistParamFields & object, import("@xyo-network/archivist-model").ArchivistModuleEventData, import("@xyo-network/payload-model").Payload<void, void>>>;
|
|
36
|
+
/**
|
|
37
|
+
* Retrieves the BoundWitness Diviner for the specified store
|
|
38
|
+
* @param store The store to retrieve the BoundWitness Diviner for
|
|
39
|
+
* @returns The BoundWitness Diviner for the specified store
|
|
40
|
+
*/
|
|
41
|
+
getBoundWitnessDivinerForStore(): Promise<import("@xyo-network/diviner-model").DivinerInstance<import("@xylabs/object").BaseParamsFields & {
|
|
42
|
+
account?: import("@xyo-network/account-model").AccountInstance | "random";
|
|
43
|
+
addToResolvers?: boolean;
|
|
44
|
+
additionalSigners?: import("@xyo-network/account-model").AccountInstance[];
|
|
45
|
+
allowNameResolution?: boolean;
|
|
46
|
+
config: import("@xyo-network/module-model").AnyConfigSchema<import("@xyo-network/diviner-model").DivinerConfig>;
|
|
47
|
+
ephemeralQueryAccountEnabled?: boolean;
|
|
48
|
+
moduleIdentifierTransformers?: import("@xyo-network/module-model").ModuleIdentifierTransformer[];
|
|
49
|
+
privateChildren?: import("@xyo-network/module-model").ModuleInstance[];
|
|
50
|
+
publicChildren?: import("@xyo-network/module-model").ModuleInstance[];
|
|
51
|
+
}, import("@xyo-network/payload-model").Payload<void, void>, import("@xyo-network/payload-model").Payload<void, void>, import("@xyo-network/diviner-model").DivinerModuleEventData<ModuleInstance<import("@xylabs/object").BaseParamsFields & {
|
|
52
|
+
account?: import("@xyo-network/account-model").AccountInstance | "random";
|
|
53
|
+
addToResolvers?: boolean;
|
|
54
|
+
additionalSigners?: import("@xyo-network/account-model").AccountInstance[];
|
|
55
|
+
allowNameResolution?: boolean;
|
|
56
|
+
config: AnyConfigSchema<import("@xyo-network/module-model").ModuleConfig>;
|
|
57
|
+
ephemeralQueryAccountEnabled?: boolean;
|
|
58
|
+
moduleIdentifierTransformers?: import("@xyo-network/module-model").ModuleIdentifierTransformer[];
|
|
59
|
+
privateChildren?: ModuleInstance[];
|
|
60
|
+
publicChildren?: ModuleInstance[];
|
|
61
|
+
}, import("@xyo-network/module-model").ModuleEventData<object>>, import("@xyo-network/payload-model").Payload, import("@xyo-network/payload-model").Payload>>>;
|
|
62
|
+
/**
|
|
63
|
+
* Retrieves the Payload Diviner for the specified store
|
|
64
|
+
* @param store The store to retrieve the Payload Diviner for
|
|
65
|
+
* @returns The Payload Diviner for the specified store
|
|
66
|
+
*/
|
|
67
|
+
getPayloadDivinerForStateStore(): Promise<import("@xyo-network/diviner-model").DivinerInstance<import("@xylabs/object").BaseParamsFields & {
|
|
68
|
+
account?: import("@xyo-network/account-model").AccountInstance | "random";
|
|
69
|
+
addToResolvers?: boolean;
|
|
70
|
+
additionalSigners?: import("@xyo-network/account-model").AccountInstance[];
|
|
71
|
+
allowNameResolution?: boolean;
|
|
72
|
+
config: import("@xyo-network/module-model").AnyConfigSchema<import("@xyo-network/diviner-model").DivinerConfig>;
|
|
73
|
+
ephemeralQueryAccountEnabled?: boolean;
|
|
74
|
+
moduleIdentifierTransformers?: import("@xyo-network/module-model").ModuleIdentifierTransformer[];
|
|
75
|
+
privateChildren?: import("@xyo-network/module-model").ModuleInstance[];
|
|
76
|
+
publicChildren?: import("@xyo-network/module-model").ModuleInstance[];
|
|
77
|
+
}, import("@xyo-network/payload-model").Payload<void, void>, import("@xyo-network/payload-model").Payload<void, void>, import("@xyo-network/diviner-model").DivinerModuleEventData<ModuleInstance<import("@xylabs/object").BaseParamsFields & {
|
|
78
|
+
account?: import("@xyo-network/account-model").AccountInstance | "random";
|
|
79
|
+
addToResolvers?: boolean;
|
|
80
|
+
additionalSigners?: import("@xyo-network/account-model").AccountInstance[];
|
|
81
|
+
allowNameResolution?: boolean;
|
|
82
|
+
config: AnyConfigSchema<import("@xyo-network/module-model").ModuleConfig>;
|
|
83
|
+
ephemeralQueryAccountEnabled?: boolean;
|
|
84
|
+
moduleIdentifierTransformers?: import("@xyo-network/module-model").ModuleIdentifierTransformer[];
|
|
85
|
+
privateChildren?: ModuleInstance[];
|
|
86
|
+
publicChildren?: ModuleInstance[];
|
|
87
|
+
}, import("@xyo-network/module-model").ModuleEventData<object>>, import("@xyo-network/payload-model").Payload, import("@xyo-network/payload-model").Payload>>>;
|
|
88
|
+
/**
|
|
89
|
+
* Retrieves the last state of the Diviner process. Used to recover state after
|
|
90
|
+
* preemptions, reboots, etc.
|
|
91
|
+
*/
|
|
92
|
+
retrieveState(): Promise<ModuleState<TState> | undefined>;
|
|
93
|
+
readonly pipeline?: import("@xyo-network/module-model").ModulePipeLine;
|
|
94
|
+
readonly status: import("@xyo-network/module-model").ModuleStatus;
|
|
95
|
+
address: import("@xylabs/hex").Address;
|
|
96
|
+
config: TParams["config"];
|
|
97
|
+
id: string;
|
|
98
|
+
modName?: import("@xyo-network/module-model").ModuleName;
|
|
99
|
+
params: TParams;
|
|
100
|
+
previousHash: () => import("@xylabs/promise").Promisable<string | undefined>;
|
|
101
|
+
queries: string[];
|
|
102
|
+
query: <T extends import("@xyo-network/boundwitness-model").QueryBoundWitness = import("@xyo-network/boundwitness-model").QueryBoundWitness, TConf extends import("@xyo-network/module-model").ModuleConfig = import("@xyo-network/module-model").ModuleConfig>(query: T, payloads?: import("@xyo-network/payload-model").Payload[], queryConfig?: TConf) => import("@xylabs/promise").Promisable<import("@xyo-network/module-model").ModuleQueryResult>;
|
|
103
|
+
queryable: <T extends import("@xyo-network/boundwitness-model").QueryBoundWitness = import("@xyo-network/boundwitness-model").QueryBoundWitness, TConf_1 extends import("@xyo-network/module-model").ModuleConfig = import("@xyo-network/module-model").ModuleConfig>(query: T, payloads?: import("@xyo-network/payload-model").Payload[], queryConfig?: TConf_1) => import("@xylabs/promise").Promisable<boolean>;
|
|
104
|
+
start?: () => import("@xylabs/promise").Promisable<boolean>;
|
|
105
|
+
stop?: () => import("@xylabs/promise").Promisable<boolean>;
|
|
106
|
+
eventData: import("@xyo-network/module-model").ModuleEventData<object>;
|
|
107
|
+
clearListeners(eventNames: keyof import("@xyo-network/module-model").ModuleEventData<object> | (keyof import("@xyo-network/module-model").ModuleEventData<object>)[]): void;
|
|
108
|
+
emit<TEventName extends keyof import("@xyo-network/module-model").ModuleEventData<object>>(eventName: TEventName, eventArgs: import("@xyo-network/module-model").ModuleEventData<object>[TEventName]): Promise<void>;
|
|
109
|
+
emitSerial<TEventName extends keyof import("@xyo-network/module-model").ModuleEventData<object>>(eventName: TEventName, eventArgs: import("@xyo-network/module-model").ModuleEventData<object>[TEventName]): Promise<void>;
|
|
110
|
+
listenerCount(eventNames: keyof import("@xyo-network/module-model").ModuleEventData<object> | (keyof import("@xyo-network/module-model").ModuleEventData<object>)[]): number;
|
|
111
|
+
off<TEventName extends keyof import("@xyo-network/module-model").ModuleEventData<object>>(eventNames: TEventName | TEventName[], listener: import("@xyo-network/module-events").EventListener<import("@xyo-network/module-model").ModuleEventData<object>[TEventName]>): void;
|
|
112
|
+
offAny(listener: import("@xyo-network/module-events").EventAnyListener | Promise<void>): void;
|
|
113
|
+
on<TEventName extends keyof import("@xyo-network/module-model").ModuleEventData<object>>(eventNames: TEventName | TEventName[], listener: import("@xyo-network/module-events").EventListener<import("@xyo-network/module-model").ModuleEventData<object>[TEventName]>): import("@xyo-network/module-events").EventUnsubscribeFunction;
|
|
114
|
+
onAny(listener: import("@xyo-network/module-events").EventAnyListener): import("@xyo-network/module-events").EventUnsubscribeFunction;
|
|
115
|
+
once<TEventName extends keyof import("@xyo-network/module-model").ModuleEventData<object>>(eventName: TEventName, listener: import("@xyo-network/module-events").EventListener<import("@xyo-network/module-model").ModuleEventData<object>[TEventName]>): import("@xyo-network/module-events").EventUnsubscribeFunction;
|
|
116
|
+
priority: import("@xyo-network/module-model").ObjectResolverPriority;
|
|
117
|
+
resolve<T extends ModuleInstance<import("@xylabs/object").BaseParamsFields & {
|
|
118
|
+
account?: import("@xyo-network/account-model").AccountInstance | "random";
|
|
119
|
+
addToResolvers?: boolean;
|
|
120
|
+
additionalSigners?: import("@xyo-network/account-model").AccountInstance[];
|
|
121
|
+
allowNameResolution?: boolean;
|
|
122
|
+
config: AnyConfigSchema<import("@xyo-network/module-model").ModuleConfig>;
|
|
123
|
+
ephemeralQueryAccountEnabled?: boolean;
|
|
124
|
+
moduleIdentifierTransformers?: import("@xyo-network/module-model").ModuleIdentifierTransformer[];
|
|
125
|
+
privateChildren?: ModuleInstance[];
|
|
126
|
+
publicChildren?: ModuleInstance[];
|
|
127
|
+
}, import("@xyo-network/module-model").ModuleEventData<object>> = ModuleInstance<import("@xylabs/object").BaseParamsFields & {
|
|
128
|
+
account?: import("@xyo-network/account-model").AccountInstance | "random";
|
|
129
|
+
addToResolvers?: boolean;
|
|
130
|
+
additionalSigners?: import("@xyo-network/account-model").AccountInstance[];
|
|
131
|
+
allowNameResolution?: boolean;
|
|
132
|
+
config: AnyConfigSchema<import("@xyo-network/module-model").ModuleConfig>;
|
|
133
|
+
ephemeralQueryAccountEnabled?: boolean;
|
|
134
|
+
moduleIdentifierTransformers?: import("@xyo-network/module-model").ModuleIdentifierTransformer[];
|
|
135
|
+
privateChildren?: ModuleInstance[];
|
|
136
|
+
publicChildren?: ModuleInstance[];
|
|
137
|
+
}, import("@xyo-network/module-model").ModuleEventData<object>>>(): import("@xylabs/promise").Promisable<T | undefined>;
|
|
138
|
+
resolve<T extends ModuleInstance<import("@xylabs/object").BaseParamsFields & {
|
|
139
|
+
account?: import("@xyo-network/account-model").AccountInstance | "random";
|
|
140
|
+
addToResolvers?: boolean;
|
|
141
|
+
additionalSigners?: import("@xyo-network/account-model").AccountInstance[];
|
|
142
|
+
allowNameResolution?: boolean;
|
|
143
|
+
config: AnyConfigSchema<import("@xyo-network/module-model").ModuleConfig>;
|
|
144
|
+
ephemeralQueryAccountEnabled?: boolean;
|
|
145
|
+
moduleIdentifierTransformers?: import("@xyo-network/module-model").ModuleIdentifierTransformer[];
|
|
146
|
+
privateChildren?: ModuleInstance[];
|
|
147
|
+
publicChildren?: ModuleInstance[];
|
|
148
|
+
}, import("@xyo-network/module-model").ModuleEventData<object>> = ModuleInstance<import("@xylabs/object").BaseParamsFields & {
|
|
149
|
+
account?: import("@xyo-network/account-model").AccountInstance | "random";
|
|
150
|
+
addToResolvers?: boolean;
|
|
151
|
+
additionalSigners?: import("@xyo-network/account-model").AccountInstance[];
|
|
152
|
+
allowNameResolution?: boolean;
|
|
153
|
+
config: AnyConfigSchema<import("@xyo-network/module-model").ModuleConfig>;
|
|
154
|
+
ephemeralQueryAccountEnabled?: boolean;
|
|
155
|
+
moduleIdentifierTransformers?: import("@xyo-network/module-model").ModuleIdentifierTransformer[];
|
|
156
|
+
privateChildren?: ModuleInstance[];
|
|
157
|
+
publicChildren?: ModuleInstance[];
|
|
158
|
+
}, import("@xyo-network/module-model").ModuleEventData<object>>>(all: "*", options?: import("@xyo-network/module-model").ObjectFilterOptions<T> | undefined): import("@xylabs/promise").Promisable<T[]>;
|
|
159
|
+
resolve<T extends ModuleInstance<import("@xylabs/object").BaseParamsFields & {
|
|
160
|
+
account?: import("@xyo-network/account-model").AccountInstance | "random";
|
|
161
|
+
addToResolvers?: boolean;
|
|
162
|
+
additionalSigners?: import("@xyo-network/account-model").AccountInstance[];
|
|
163
|
+
allowNameResolution?: boolean;
|
|
164
|
+
config: AnyConfigSchema<import("@xyo-network/module-model").ModuleConfig>;
|
|
165
|
+
ephemeralQueryAccountEnabled?: boolean;
|
|
166
|
+
moduleIdentifierTransformers?: import("@xyo-network/module-model").ModuleIdentifierTransformer[];
|
|
167
|
+
privateChildren?: ModuleInstance[];
|
|
168
|
+
publicChildren?: ModuleInstance[];
|
|
169
|
+
}, import("@xyo-network/module-model").ModuleEventData<object>> = ModuleInstance<import("@xylabs/object").BaseParamsFields & {
|
|
170
|
+
account?: import("@xyo-network/account-model").AccountInstance | "random";
|
|
171
|
+
addToResolvers?: boolean;
|
|
172
|
+
additionalSigners?: import("@xyo-network/account-model").AccountInstance[];
|
|
173
|
+
allowNameResolution?: boolean;
|
|
174
|
+
config: AnyConfigSchema<import("@xyo-network/module-model").ModuleConfig>;
|
|
175
|
+
ephemeralQueryAccountEnabled?: boolean;
|
|
176
|
+
moduleIdentifierTransformers?: import("@xyo-network/module-model").ModuleIdentifierTransformer[];
|
|
177
|
+
privateChildren?: ModuleInstance[];
|
|
178
|
+
publicChildren?: ModuleInstance[];
|
|
179
|
+
}, import("@xyo-network/module-model").ModuleEventData<object>>>(id: import("@xyo-network/module-model").ModuleIdentifier, options?: import("@xyo-network/module-model").ObjectFilterOptions<T> | undefined): import("@xylabs/promise").Promisable<T | undefined>;
|
|
180
|
+
resolve<T extends ModuleInstance<import("@xylabs/object").BaseParamsFields & {
|
|
181
|
+
account?: import("@xyo-network/account-model").AccountInstance | "random";
|
|
182
|
+
addToResolvers?: boolean;
|
|
183
|
+
additionalSigners?: import("@xyo-network/account-model").AccountInstance[];
|
|
184
|
+
allowNameResolution?: boolean;
|
|
185
|
+
config: AnyConfigSchema<import("@xyo-network/module-model").ModuleConfig>;
|
|
186
|
+
ephemeralQueryAccountEnabled?: boolean;
|
|
187
|
+
moduleIdentifierTransformers?: import("@xyo-network/module-model").ModuleIdentifierTransformer[];
|
|
188
|
+
privateChildren?: ModuleInstance[];
|
|
189
|
+
publicChildren?: ModuleInstance[];
|
|
190
|
+
}, import("@xyo-network/module-model").ModuleEventData<object>> = ModuleInstance<import("@xylabs/object").BaseParamsFields & {
|
|
191
|
+
account?: import("@xyo-network/account-model").AccountInstance | "random";
|
|
192
|
+
addToResolvers?: boolean;
|
|
193
|
+
additionalSigners?: import("@xyo-network/account-model").AccountInstance[];
|
|
194
|
+
allowNameResolution?: boolean;
|
|
195
|
+
config: AnyConfigSchema<import("@xyo-network/module-model").ModuleConfig>;
|
|
196
|
+
ephemeralQueryAccountEnabled?: boolean;
|
|
197
|
+
moduleIdentifierTransformers?: import("@xyo-network/module-model").ModuleIdentifierTransformer[];
|
|
198
|
+
privateChildren?: ModuleInstance[];
|
|
199
|
+
publicChildren?: ModuleInstance[];
|
|
200
|
+
}, import("@xyo-network/module-model").ModuleEventData<object>>>(id?: import("@xyo-network/module-model").ModuleIdentifier, options?: import("@xyo-network/module-model").ObjectFilterOptions<T> | undefined): import("@xylabs/promise").Promisable<T | T[] | undefined>;
|
|
201
|
+
resolvePrivate<T extends ModuleInstance<import("@xylabs/object").BaseParamsFields & {
|
|
202
|
+
account?: import("@xyo-network/account-model").AccountInstance | "random";
|
|
203
|
+
addToResolvers?: boolean;
|
|
204
|
+
additionalSigners?: import("@xyo-network/account-model").AccountInstance[];
|
|
205
|
+
allowNameResolution?: boolean;
|
|
206
|
+
config: AnyConfigSchema<import("@xyo-network/module-model").ModuleConfig>;
|
|
207
|
+
ephemeralQueryAccountEnabled?: boolean;
|
|
208
|
+
moduleIdentifierTransformers?: import("@xyo-network/module-model").ModuleIdentifierTransformer[];
|
|
209
|
+
privateChildren?: ModuleInstance[];
|
|
210
|
+
publicChildren?: ModuleInstance[];
|
|
211
|
+
}, import("@xyo-network/module-model").ModuleEventData<object>> = ModuleInstance<import("@xylabs/object").BaseParamsFields & {
|
|
212
|
+
account?: import("@xyo-network/account-model").AccountInstance | "random";
|
|
213
|
+
addToResolvers?: boolean;
|
|
214
|
+
additionalSigners?: import("@xyo-network/account-model").AccountInstance[];
|
|
215
|
+
allowNameResolution?: boolean;
|
|
216
|
+
config: AnyConfigSchema<import("@xyo-network/module-model").ModuleConfig>;
|
|
217
|
+
ephemeralQueryAccountEnabled?: boolean;
|
|
218
|
+
moduleIdentifierTransformers?: import("@xyo-network/module-model").ModuleIdentifierTransformer[];
|
|
219
|
+
privateChildren?: ModuleInstance[];
|
|
220
|
+
publicChildren?: ModuleInstance[];
|
|
221
|
+
}, import("@xyo-network/module-model").ModuleEventData<object>>>(all: "*", options?: import("@xyo-network/module-model").ObjectFilterOptions<T> | undefined): Promise<T[]>;
|
|
222
|
+
resolvePrivate<T extends ModuleInstance<import("@xylabs/object").BaseParamsFields & {
|
|
223
|
+
account?: import("@xyo-network/account-model").AccountInstance | "random";
|
|
224
|
+
addToResolvers?: boolean;
|
|
225
|
+
additionalSigners?: import("@xyo-network/account-model").AccountInstance[];
|
|
226
|
+
allowNameResolution?: boolean;
|
|
227
|
+
config: AnyConfigSchema<import("@xyo-network/module-model").ModuleConfig>;
|
|
228
|
+
ephemeralQueryAccountEnabled?: boolean;
|
|
229
|
+
moduleIdentifierTransformers?: import("@xyo-network/module-model").ModuleIdentifierTransformer[];
|
|
230
|
+
privateChildren?: ModuleInstance[];
|
|
231
|
+
publicChildren?: ModuleInstance[];
|
|
232
|
+
}, import("@xyo-network/module-model").ModuleEventData<object>> = ModuleInstance<import("@xylabs/object").BaseParamsFields & {
|
|
233
|
+
account?: import("@xyo-network/account-model").AccountInstance | "random";
|
|
234
|
+
addToResolvers?: boolean;
|
|
235
|
+
additionalSigners?: import("@xyo-network/account-model").AccountInstance[];
|
|
236
|
+
allowNameResolution?: boolean;
|
|
237
|
+
config: AnyConfigSchema<import("@xyo-network/module-model").ModuleConfig>;
|
|
238
|
+
ephemeralQueryAccountEnabled?: boolean;
|
|
239
|
+
moduleIdentifierTransformers?: import("@xyo-network/module-model").ModuleIdentifierTransformer[];
|
|
240
|
+
privateChildren?: ModuleInstance[];
|
|
241
|
+
publicChildren?: ModuleInstance[];
|
|
242
|
+
}, import("@xyo-network/module-model").ModuleEventData<object>>>(id: import("@xyo-network/module-model").ModuleIdentifier, options?: import("@xyo-network/module-model").ObjectFilterOptions<T> | undefined): Promise<T | undefined>;
|
|
243
|
+
resolvePrivate<T extends ModuleInstance<import("@xylabs/object").BaseParamsFields & {
|
|
244
|
+
account?: import("@xyo-network/account-model").AccountInstance | "random";
|
|
245
|
+
addToResolvers?: boolean;
|
|
246
|
+
additionalSigners?: import("@xyo-network/account-model").AccountInstance[];
|
|
247
|
+
allowNameResolution?: boolean;
|
|
248
|
+
config: AnyConfigSchema<import("@xyo-network/module-model").ModuleConfig>;
|
|
249
|
+
ephemeralQueryAccountEnabled?: boolean;
|
|
250
|
+
moduleIdentifierTransformers?: import("@xyo-network/module-model").ModuleIdentifierTransformer[];
|
|
251
|
+
privateChildren?: ModuleInstance[];
|
|
252
|
+
publicChildren?: ModuleInstance[];
|
|
253
|
+
}, import("@xyo-network/module-model").ModuleEventData<object>> = ModuleInstance<import("@xylabs/object").BaseParamsFields & {
|
|
254
|
+
account?: import("@xyo-network/account-model").AccountInstance | "random";
|
|
255
|
+
addToResolvers?: boolean;
|
|
256
|
+
additionalSigners?: import("@xyo-network/account-model").AccountInstance[];
|
|
257
|
+
allowNameResolution?: boolean;
|
|
258
|
+
config: AnyConfigSchema<import("@xyo-network/module-model").ModuleConfig>;
|
|
259
|
+
ephemeralQueryAccountEnabled?: boolean;
|
|
260
|
+
moduleIdentifierTransformers?: import("@xyo-network/module-model").ModuleIdentifierTransformer[];
|
|
261
|
+
privateChildren?: ModuleInstance[];
|
|
262
|
+
publicChildren?: ModuleInstance[];
|
|
263
|
+
}, import("@xyo-network/module-model").ModuleEventData<object>>>(id: import("@xyo-network/module-model").ModuleIdentifier, options?: import("@xyo-network/module-model").ObjectFilterOptions<T> | undefined): Promise<T | T[] | undefined>;
|
|
264
|
+
manifest: (maxDepth?: number, ignoreAddresses?: import("@xylabs/hex").Address[]) => import("@xylabs/promise").Promisable<import("@xyo-network/manifest-model").ModuleManifestPayload>;
|
|
265
|
+
manifestQuery: (account: import("@xyo-network/account-model").AccountInstance, maxDepth?: number, ignoreAddresses?: import("@xylabs/hex").Address[]) => import("@xylabs/promise").Promisable<import("@xyo-network/module-model").ModuleQueryResult<import("@xyo-network/manifest-model").ModuleManifestPayload>>;
|
|
266
|
+
moduleAddress: () => import("@xylabs/promise").Promisable<(import("@xyo-network/module-model").AddressPreviousHashPayload | import("@xyo-network/module-model").AddressPayload)[]>;
|
|
267
|
+
state: () => import("@xylabs/promise").Promisable<import("@xyo-network/payload-model").Payload[]>;
|
|
268
|
+
stateQuery: (account: import("@xyo-network/account-model").AccountInstance) => import("@xylabs/promise").Promisable<import("@xyo-network/module-model").ModuleQueryResult>;
|
|
269
|
+
account?: import("@xyo-network/account-model").AccountInstance;
|
|
270
|
+
addParent: (mod: ModuleInstance) => void;
|
|
271
|
+
addressCache?: (direction: import("@xyo-network/module-model").Direction, includePrivate: boolean) => import("@xyo-network/module-model").AddressToWeakInstanceCache | undefined;
|
|
272
|
+
parents: () => import("@xylabs/promise").Promisable<ModuleInstance[]>;
|
|
273
|
+
privateChildren: () => import("@xylabs/promise").Promisable<ModuleInstance[]>;
|
|
274
|
+
publicChildren: () => import("@xylabs/promise").Promisable<ModuleInstance[]>;
|
|
275
|
+
removeParent: (address: import("@xylabs/hex").Address) => void;
|
|
276
|
+
siblings: () => import("@xylabs/promise").Promisable<ModuleInstance[]>;
|
|
277
|
+
}) & TModule;
|
|
278
|
+
//# sourceMappingURL=DivinerMixin.d.ts.map
|
|
@@ -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N;;;OAGG;qBACoB,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC;;;;;;;;;;sRAzFnE,CAAA,6DAAwB,CAAC;4RAI+C,CAAC,6DAEjE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBApBR,CAAC,yBAAyB,CAAC;2FAKzB,CAAC,yBACU,CAAC;;;;;;;;;;;;YA2Id,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { DivinerParams } from '@xyo-network/diviner-model';
|
|
2
|
+
import type { AnyConfigSchema } from '@xyo-network/module-model';
|
|
3
|
+
import type { StatefulDivinerConfig } from './Config.ts';
|
|
4
|
+
/**
|
|
5
|
+
* The parameters for a Stateful Diviner
|
|
6
|
+
*/
|
|
7
|
+
export type StatefulDivinerParams = DivinerParams<AnyConfigSchema<StatefulDivinerConfig>>;
|
|
8
|
+
//# sourceMappingURL=Params.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Params.d.ts","sourceRoot":"","sources":["../../src/Params.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC/D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAEhE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AAExD;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG,aAAa,CAAC,eAAe,CAAC,qBAAqB,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Schema.d.ts","sourceRoot":"","sources":["../../src/Schema.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB,EAAG,8BAAuC,CAAA;AAC5E,MAAM,MAAM,qBAAqB,GAAG,OAAO,qBAAqB,CAAA"}
|
package/dist/neutral/index.d.ts
CHANGED
|
@@ -1,351 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import * as _xylabs_object from '@xylabs/object';
|
|
8
|
-
import { ArchivistWrapper } from '@xyo-network/archivist-wrapper';
|
|
9
|
-
import { AbstractDiviner } from '@xyo-network/diviner-abstract';
|
|
10
|
-
import { DivinerWrapper } from '@xyo-network/diviner-wrapper';
|
|
11
|
-
import * as _xyo_network_payload_model from '@xyo-network/payload-model';
|
|
12
|
-
import { Payload, Schema } from '@xyo-network/payload-model';
|
|
13
|
-
import * as _xyo_network_manifest_model from '@xyo-network/manifest-model';
|
|
14
|
-
import * as _xyo_network_module_events from '@xyo-network/module-events';
|
|
15
|
-
import * as _xyo_network_boundwitness_model from '@xyo-network/boundwitness-model';
|
|
16
|
-
import * as _xylabs_promise from '@xylabs/promise';
|
|
17
|
-
import * as _xylabs_hex from '@xylabs/hex';
|
|
18
|
-
|
|
19
|
-
declare const StatefulDivinerConfigSchema: "network.xyo.diviner.stateful.config";
|
|
20
|
-
type StatefulDivinerConfigSchema = typeof StatefulDivinerConfigSchema;
|
|
21
|
-
type StatefulDivinerConfig = DivinerConfig<{
|
|
22
|
-
schema: StatefulDivinerConfigSchema;
|
|
23
|
-
stateStore: {
|
|
24
|
-
archivist: ModuleIdentifier;
|
|
25
|
-
boundWitnessDiviner: ModuleIdentifier;
|
|
26
|
-
payloadDiviner: ModuleIdentifier;
|
|
27
|
-
};
|
|
28
|
-
}>;
|
|
29
|
-
|
|
30
|
-
type StatefulDivinerParams = DivinerParams<AnyConfigSchema<StatefulDivinerConfig>>;
|
|
31
|
-
|
|
32
|
-
declare abstract class StatefulDiviner<TParams extends StatefulDivinerParams = StatefulDivinerParams, TIn extends Payload = Payload, TOut extends Payload = Payload, TEventData extends DivinerModuleEventData<DivinerInstance<TParams, TIn, TOut>, TIn, TOut> = DivinerModuleEventData<DivinerInstance<TParams, TIn, TOut>, TIn, TOut>, TState extends StateDictionary = StateDictionary> extends AbstractDiviner<TParams, TIn, TOut, TEventData> {
|
|
33
|
-
static readonly configSchemas: Schema[];
|
|
34
|
-
static readonly defaultConfigSchema: Schema;
|
|
35
|
-
protected _lastState?: ModuleState<TState>;
|
|
36
|
-
protected commitState(nextState: ModuleState<TState>): Promise<void>;
|
|
37
|
-
protected getArchivistForStateStore(): Promise<ArchivistWrapper<_xyo_network_archivist_model.ArchivistModuleInstance<_xylabs_object.BaseParamsFields & {
|
|
38
|
-
account?: _xyo_network_account_model.AccountInstance | "random";
|
|
39
|
-
addToResolvers?: boolean;
|
|
40
|
-
additionalSigners?: _xyo_network_account_model.AccountInstance[];
|
|
41
|
-
allowNameResolution?: boolean;
|
|
42
|
-
config: _xyo_network_module_model.AnyConfigSchema<_xyo_network_archivist_model.ArchivistConfig<void, void>>;
|
|
43
|
-
ephemeralQueryAccountEnabled?: boolean;
|
|
44
|
-
moduleIdentifierTransformers?: _xyo_network_module_model.ModuleIdentifierTransformer[];
|
|
45
|
-
privateChildren?: _xyo_network_module_model.ModuleInstance[];
|
|
46
|
-
publicChildren?: _xyo_network_module_model.ModuleInstance[];
|
|
47
|
-
}, _xyo_network_archivist_model.ArchivistModuleEventData>>>;
|
|
48
|
-
protected getBoundWitnessDivinerForStateStore(): Promise<DivinerWrapper<_xyo_network_diviner_model.DivinerModule<_xylabs_object.BaseParamsFields & {
|
|
49
|
-
account?: _xyo_network_account_model.AccountInstance | "random";
|
|
50
|
-
addToResolvers?: boolean;
|
|
51
|
-
additionalSigners?: _xyo_network_account_model.AccountInstance[];
|
|
52
|
-
allowNameResolution?: boolean;
|
|
53
|
-
config: _xyo_network_module_model.AnyConfigSchema<_xyo_network_diviner_model.DivinerConfig<void, void>>;
|
|
54
|
-
ephemeralQueryAccountEnabled?: boolean;
|
|
55
|
-
moduleIdentifierTransformers?: _xyo_network_module_model.ModuleIdentifierTransformer[];
|
|
56
|
-
privateChildren?: _xyo_network_module_model.ModuleInstance[];
|
|
57
|
-
publicChildren?: _xyo_network_module_model.ModuleInstance[];
|
|
58
|
-
}, DivinerModuleEventData<_xyo_network_module_model.ModuleInstance<_xylabs_object.BaseParamsFields & {
|
|
59
|
-
account?: _xyo_network_account_model.AccountInstance | "random";
|
|
60
|
-
addToResolvers?: boolean;
|
|
61
|
-
additionalSigners?: _xyo_network_account_model.AccountInstance[];
|
|
62
|
-
allowNameResolution?: boolean;
|
|
63
|
-
config: _xyo_network_module_model.AnyConfigSchema<_xyo_network_module_model.ModuleConfig<void, void>>;
|
|
64
|
-
ephemeralQueryAccountEnabled?: boolean;
|
|
65
|
-
moduleIdentifierTransformers?: _xyo_network_module_model.ModuleIdentifierTransformer[];
|
|
66
|
-
privateChildren?: _xyo_network_module_model.ModuleInstance[];
|
|
67
|
-
publicChildren?: _xyo_network_module_model.ModuleInstance[];
|
|
68
|
-
}, _xyo_network_module_model.ModuleEventData<object>>, Payload, Payload>>, Payload, Payload>>;
|
|
69
|
-
protected getPayloadDivinerForStateStore(): Promise<DivinerWrapper<_xyo_network_diviner_model.DivinerModule<_xylabs_object.BaseParamsFields & {
|
|
70
|
-
account?: _xyo_network_account_model.AccountInstance | "random";
|
|
71
|
-
addToResolvers?: boolean;
|
|
72
|
-
additionalSigners?: _xyo_network_account_model.AccountInstance[];
|
|
73
|
-
allowNameResolution?: boolean;
|
|
74
|
-
config: _xyo_network_module_model.AnyConfigSchema<_xyo_network_diviner_model.DivinerConfig<void, void>>;
|
|
75
|
-
ephemeralQueryAccountEnabled?: boolean;
|
|
76
|
-
moduleIdentifierTransformers?: _xyo_network_module_model.ModuleIdentifierTransformer[];
|
|
77
|
-
privateChildren?: _xyo_network_module_model.ModuleInstance[];
|
|
78
|
-
publicChildren?: _xyo_network_module_model.ModuleInstance[];
|
|
79
|
-
}, DivinerModuleEventData<_xyo_network_module_model.ModuleInstance<_xylabs_object.BaseParamsFields & {
|
|
80
|
-
account?: _xyo_network_account_model.AccountInstance | "random";
|
|
81
|
-
addToResolvers?: boolean;
|
|
82
|
-
additionalSigners?: _xyo_network_account_model.AccountInstance[];
|
|
83
|
-
allowNameResolution?: boolean;
|
|
84
|
-
config: _xyo_network_module_model.AnyConfigSchema<_xyo_network_module_model.ModuleConfig<void, void>>;
|
|
85
|
-
ephemeralQueryAccountEnabled?: boolean;
|
|
86
|
-
moduleIdentifierTransformers?: _xyo_network_module_model.ModuleIdentifierTransformer[];
|
|
87
|
-
privateChildren?: _xyo_network_module_model.ModuleInstance[];
|
|
88
|
-
publicChildren?: _xyo_network_module_model.ModuleInstance[];
|
|
89
|
-
}, _xyo_network_module_model.ModuleEventData<object>>, Payload, Payload>>, Payload, Payload>>;
|
|
90
|
-
protected retrieveState(): Promise<ModuleState<TState> | undefined>;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
type StatefulModuleParams = ModuleParams<AnyConfigSchema<StatefulDivinerConfig>>;
|
|
94
|
-
type AnyModule<TParams extends StatefulModuleParams = StatefulModuleParams> = new (...args: any[]) => ModuleInstance<TParams>;
|
|
95
|
-
declare const StatefulModuleMixin: <TParams extends StatefulModuleParams = _xylabs_object.BaseParamsFields & {
|
|
96
|
-
account?: _xyo_network_account_model.AccountInstance | "random";
|
|
97
|
-
addToResolvers?: boolean;
|
|
98
|
-
additionalSigners?: _xyo_network_account_model.AccountInstance[];
|
|
99
|
-
allowNameResolution?: boolean;
|
|
100
|
-
config: AnyConfigSchema<StatefulDivinerConfig>;
|
|
101
|
-
ephemeralQueryAccountEnabled?: boolean;
|
|
102
|
-
moduleIdentifierTransformers?: _xyo_network_module_model.ModuleIdentifierTransformer[];
|
|
103
|
-
privateChildren?: ModuleInstance[];
|
|
104
|
-
publicChildren?: ModuleInstance[];
|
|
105
|
-
}, TModule extends AnyModule<TParams> = AnyModule<TParams>, TState extends StateDictionary = StateDictionary>(ModuleBase: TModule) => (abstract new (...args: any[]) => {
|
|
106
|
-
_lastState?: ModuleState<TState>;
|
|
107
|
-
commitState(nextState: ModuleState<TState>): Promise<void>;
|
|
108
|
-
getArchivistForStore(): Promise<_xyo_network_archivist_model.ArchivistInstance<_xylabs_object.BaseParamsFields & {
|
|
109
|
-
account?: _xyo_network_account_model.AccountInstance | "random";
|
|
110
|
-
addToResolvers?: boolean;
|
|
111
|
-
additionalSigners?: _xyo_network_account_model.AccountInstance[];
|
|
112
|
-
allowNameResolution?: boolean;
|
|
113
|
-
config: AnyConfigSchema<_xyo_network_archivist_model.ArchivistConfig>;
|
|
114
|
-
ephemeralQueryAccountEnabled?: boolean;
|
|
115
|
-
moduleIdentifierTransformers?: _xyo_network_module_model.ModuleIdentifierTransformer[];
|
|
116
|
-
privateChildren?: ModuleInstance[];
|
|
117
|
-
publicChildren?: ModuleInstance[];
|
|
118
|
-
} & _xyo_network_archivist_model.ArchivistParamFields & object, _xyo_network_archivist_model.ArchivistModuleEventData, _xyo_network_payload_model.Payload>>;
|
|
119
|
-
getBoundWitnessDivinerForStore(): Promise<_xyo_network_diviner_model.DivinerInstance<_xylabs_object.BaseParamsFields & {
|
|
120
|
-
account?: _xyo_network_account_model.AccountInstance | "random";
|
|
121
|
-
addToResolvers?: boolean;
|
|
122
|
-
additionalSigners?: _xyo_network_account_model.AccountInstance[];
|
|
123
|
-
allowNameResolution?: boolean;
|
|
124
|
-
config: AnyConfigSchema<_xyo_network_diviner_model.DivinerConfig>;
|
|
125
|
-
ephemeralQueryAccountEnabled?: boolean;
|
|
126
|
-
moduleIdentifierTransformers?: _xyo_network_module_model.ModuleIdentifierTransformer[];
|
|
127
|
-
privateChildren?: ModuleInstance[];
|
|
128
|
-
publicChildren?: ModuleInstance[];
|
|
129
|
-
}, _xyo_network_payload_model.Payload, _xyo_network_payload_model.Payload, _xyo_network_diviner_model.DivinerModuleEventData<ModuleInstance<_xylabs_object.BaseParamsFields & {
|
|
130
|
-
account?: _xyo_network_account_model.AccountInstance | "random";
|
|
131
|
-
addToResolvers?: boolean;
|
|
132
|
-
additionalSigners?: _xyo_network_account_model.AccountInstance[];
|
|
133
|
-
allowNameResolution?: boolean;
|
|
134
|
-
config: AnyConfigSchema<_xyo_network_module_model.ModuleConfig<void, void>>;
|
|
135
|
-
ephemeralQueryAccountEnabled?: boolean;
|
|
136
|
-
moduleIdentifierTransformers?: _xyo_network_module_model.ModuleIdentifierTransformer[];
|
|
137
|
-
privateChildren?: ModuleInstance[];
|
|
138
|
-
publicChildren?: ModuleInstance[];
|
|
139
|
-
}, _xyo_network_module_model.ModuleEventData<object>>, _xyo_network_payload_model.Payload, _xyo_network_payload_model.Payload>>>;
|
|
140
|
-
getPayloadDivinerForStateStore(): Promise<_xyo_network_diviner_model.DivinerInstance<_xylabs_object.BaseParamsFields & {
|
|
141
|
-
account?: _xyo_network_account_model.AccountInstance | "random";
|
|
142
|
-
addToResolvers?: boolean;
|
|
143
|
-
additionalSigners?: _xyo_network_account_model.AccountInstance[];
|
|
144
|
-
allowNameResolution?: boolean;
|
|
145
|
-
config: AnyConfigSchema<_xyo_network_diviner_model.DivinerConfig>;
|
|
146
|
-
ephemeralQueryAccountEnabled?: boolean;
|
|
147
|
-
moduleIdentifierTransformers?: _xyo_network_module_model.ModuleIdentifierTransformer[];
|
|
148
|
-
privateChildren?: ModuleInstance[];
|
|
149
|
-
publicChildren?: ModuleInstance[];
|
|
150
|
-
}, _xyo_network_payload_model.Payload, _xyo_network_payload_model.Payload, _xyo_network_diviner_model.DivinerModuleEventData<ModuleInstance<_xylabs_object.BaseParamsFields & {
|
|
151
|
-
account?: _xyo_network_account_model.AccountInstance | "random";
|
|
152
|
-
addToResolvers?: boolean;
|
|
153
|
-
additionalSigners?: _xyo_network_account_model.AccountInstance[];
|
|
154
|
-
allowNameResolution?: boolean;
|
|
155
|
-
config: AnyConfigSchema<_xyo_network_module_model.ModuleConfig<void, void>>;
|
|
156
|
-
ephemeralQueryAccountEnabled?: boolean;
|
|
157
|
-
moduleIdentifierTransformers?: _xyo_network_module_model.ModuleIdentifierTransformer[];
|
|
158
|
-
privateChildren?: ModuleInstance[];
|
|
159
|
-
publicChildren?: ModuleInstance[];
|
|
160
|
-
}, _xyo_network_module_model.ModuleEventData<object>>, _xyo_network_payload_model.Payload, _xyo_network_payload_model.Payload>>>;
|
|
161
|
-
retrieveState(): Promise<ModuleState<TState> | undefined>;
|
|
162
|
-
readonly pipeline?: _xyo_network_module_model.ModulePipeLine;
|
|
163
|
-
readonly status: _xyo_network_module_model.ModuleStatus;
|
|
164
|
-
address: _xylabs_hex.Address;
|
|
165
|
-
config: TParams["config"];
|
|
166
|
-
id: string;
|
|
167
|
-
modName?: _xyo_network_module_model.ModuleName;
|
|
168
|
-
params: TParams;
|
|
169
|
-
previousHash: () => _xylabs_promise.Promisable<string | undefined>;
|
|
170
|
-
queries: string[];
|
|
171
|
-
query: <T extends _xyo_network_boundwitness_model.QueryBoundWitness = _xyo_network_boundwitness_model.QueryBoundWitness, TConf extends _xyo_network_module_model.ModuleConfig = _xyo_network_module_model.ModuleConfig>(query: T, payloads?: _xyo_network_payload_model.Payload[], queryConfig?: TConf) => _xylabs_promise.Promisable<_xyo_network_module_model.ModuleQueryResult>;
|
|
172
|
-
queryable: <T extends _xyo_network_boundwitness_model.QueryBoundWitness = _xyo_network_boundwitness_model.QueryBoundWitness, TConf_1 extends _xyo_network_module_model.ModuleConfig = _xyo_network_module_model.ModuleConfig>(query: T, payloads?: _xyo_network_payload_model.Payload[], queryConfig?: TConf_1) => _xylabs_promise.Promisable<boolean>;
|
|
173
|
-
start?: () => _xylabs_promise.Promisable<boolean>;
|
|
174
|
-
stop?: () => _xylabs_promise.Promisable<boolean>;
|
|
175
|
-
eventData: _xyo_network_module_model.ModuleEventData<object>;
|
|
176
|
-
clearListeners(eventNames: keyof _xyo_network_module_model.ModuleEventData<object> | (keyof _xyo_network_module_model.ModuleEventData<object>)[]): void;
|
|
177
|
-
emit<TEventName extends keyof _xyo_network_module_model.ModuleEventData<object>>(eventName: TEventName, eventArgs: _xyo_network_module_model.ModuleEventData<object>[TEventName]): Promise<void>;
|
|
178
|
-
emitSerial<TEventName extends keyof _xyo_network_module_model.ModuleEventData<object>>(eventName: TEventName, eventArgs: _xyo_network_module_model.ModuleEventData<object>[TEventName]): Promise<void>;
|
|
179
|
-
listenerCount(eventNames: keyof _xyo_network_module_model.ModuleEventData<object> | (keyof _xyo_network_module_model.ModuleEventData<object>)[]): number;
|
|
180
|
-
off<TEventName extends keyof _xyo_network_module_model.ModuleEventData<object>>(eventNames: TEventName | TEventName[], listener: _xyo_network_module_events.EventListener<_xyo_network_module_model.ModuleEventData<object>[TEventName]>): void;
|
|
181
|
-
offAny(listener: _xyo_network_module_events.EventAnyListener | Promise<void>): void;
|
|
182
|
-
on<TEventName extends keyof _xyo_network_module_model.ModuleEventData<object>>(eventNames: TEventName | TEventName[], listener: _xyo_network_module_events.EventListener<_xyo_network_module_model.ModuleEventData<object>[TEventName]>): _xyo_network_module_events.EventUnsubscribeFunction;
|
|
183
|
-
onAny(listener: _xyo_network_module_events.EventAnyListener): _xyo_network_module_events.EventUnsubscribeFunction;
|
|
184
|
-
once<TEventName extends keyof _xyo_network_module_model.ModuleEventData<object>>(eventName: TEventName, listener: _xyo_network_module_events.EventListener<_xyo_network_module_model.ModuleEventData<object>[TEventName]>): _xyo_network_module_events.EventUnsubscribeFunction;
|
|
185
|
-
priority: _xyo_network_module_model.ObjectResolverPriority;
|
|
186
|
-
resolve<T extends ModuleInstance<_xylabs_object.BaseParamsFields & {
|
|
187
|
-
account?: _xyo_network_account_model.AccountInstance | "random";
|
|
188
|
-
addToResolvers?: boolean;
|
|
189
|
-
additionalSigners?: _xyo_network_account_model.AccountInstance[];
|
|
190
|
-
allowNameResolution?: boolean;
|
|
191
|
-
config: AnyConfigSchema<_xyo_network_module_model.ModuleConfig<void, void>>;
|
|
192
|
-
ephemeralQueryAccountEnabled?: boolean;
|
|
193
|
-
moduleIdentifierTransformers?: _xyo_network_module_model.ModuleIdentifierTransformer[];
|
|
194
|
-
privateChildren?: ModuleInstance[];
|
|
195
|
-
publicChildren?: ModuleInstance[];
|
|
196
|
-
}, _xyo_network_module_model.ModuleEventData<object>> = ModuleInstance<_xylabs_object.BaseParamsFields & {
|
|
197
|
-
account?: _xyo_network_account_model.AccountInstance | "random";
|
|
198
|
-
addToResolvers?: boolean;
|
|
199
|
-
additionalSigners?: _xyo_network_account_model.AccountInstance[];
|
|
200
|
-
allowNameResolution?: boolean;
|
|
201
|
-
config: AnyConfigSchema<_xyo_network_module_model.ModuleConfig<void, void>>;
|
|
202
|
-
ephemeralQueryAccountEnabled?: boolean;
|
|
203
|
-
moduleIdentifierTransformers?: _xyo_network_module_model.ModuleIdentifierTransformer[];
|
|
204
|
-
privateChildren?: ModuleInstance[];
|
|
205
|
-
publicChildren?: ModuleInstance[];
|
|
206
|
-
}, _xyo_network_module_model.ModuleEventData<object>>>(): _xylabs_promise.Promisable<T | undefined>;
|
|
207
|
-
resolve<T extends ModuleInstance<_xylabs_object.BaseParamsFields & {
|
|
208
|
-
account?: _xyo_network_account_model.AccountInstance | "random";
|
|
209
|
-
addToResolvers?: boolean;
|
|
210
|
-
additionalSigners?: _xyo_network_account_model.AccountInstance[];
|
|
211
|
-
allowNameResolution?: boolean;
|
|
212
|
-
config: AnyConfigSchema<_xyo_network_module_model.ModuleConfig<void, void>>;
|
|
213
|
-
ephemeralQueryAccountEnabled?: boolean;
|
|
214
|
-
moduleIdentifierTransformers?: _xyo_network_module_model.ModuleIdentifierTransformer[];
|
|
215
|
-
privateChildren?: ModuleInstance[];
|
|
216
|
-
publicChildren?: ModuleInstance[];
|
|
217
|
-
}, _xyo_network_module_model.ModuleEventData<object>> = ModuleInstance<_xylabs_object.BaseParamsFields & {
|
|
218
|
-
account?: _xyo_network_account_model.AccountInstance | "random";
|
|
219
|
-
addToResolvers?: boolean;
|
|
220
|
-
additionalSigners?: _xyo_network_account_model.AccountInstance[];
|
|
221
|
-
allowNameResolution?: boolean;
|
|
222
|
-
config: AnyConfigSchema<_xyo_network_module_model.ModuleConfig<void, void>>;
|
|
223
|
-
ephemeralQueryAccountEnabled?: boolean;
|
|
224
|
-
moduleIdentifierTransformers?: _xyo_network_module_model.ModuleIdentifierTransformer[];
|
|
225
|
-
privateChildren?: ModuleInstance[];
|
|
226
|
-
publicChildren?: ModuleInstance[];
|
|
227
|
-
}, _xyo_network_module_model.ModuleEventData<object>>>(all: "*", options?: _xyo_network_module_model.ObjectFilterOptions<T> | undefined): _xylabs_promise.Promisable<T[]>;
|
|
228
|
-
resolve<T extends ModuleInstance<_xylabs_object.BaseParamsFields & {
|
|
229
|
-
account?: _xyo_network_account_model.AccountInstance | "random";
|
|
230
|
-
addToResolvers?: boolean;
|
|
231
|
-
additionalSigners?: _xyo_network_account_model.AccountInstance[];
|
|
232
|
-
allowNameResolution?: boolean;
|
|
233
|
-
config: AnyConfigSchema<_xyo_network_module_model.ModuleConfig<void, void>>;
|
|
234
|
-
ephemeralQueryAccountEnabled?: boolean;
|
|
235
|
-
moduleIdentifierTransformers?: _xyo_network_module_model.ModuleIdentifierTransformer[];
|
|
236
|
-
privateChildren?: ModuleInstance[];
|
|
237
|
-
publicChildren?: ModuleInstance[];
|
|
238
|
-
}, _xyo_network_module_model.ModuleEventData<object>> = ModuleInstance<_xylabs_object.BaseParamsFields & {
|
|
239
|
-
account?: _xyo_network_account_model.AccountInstance | "random";
|
|
240
|
-
addToResolvers?: boolean;
|
|
241
|
-
additionalSigners?: _xyo_network_account_model.AccountInstance[];
|
|
242
|
-
allowNameResolution?: boolean;
|
|
243
|
-
config: AnyConfigSchema<_xyo_network_module_model.ModuleConfig<void, void>>;
|
|
244
|
-
ephemeralQueryAccountEnabled?: boolean;
|
|
245
|
-
moduleIdentifierTransformers?: _xyo_network_module_model.ModuleIdentifierTransformer[];
|
|
246
|
-
privateChildren?: ModuleInstance[];
|
|
247
|
-
publicChildren?: ModuleInstance[];
|
|
248
|
-
}, _xyo_network_module_model.ModuleEventData<object>>>(id: _xyo_network_module_model.ModuleIdentifier, options?: _xyo_network_module_model.ObjectFilterOptions<T> | undefined): _xylabs_promise.Promisable<T | undefined>;
|
|
249
|
-
resolve<T extends ModuleInstance<_xylabs_object.BaseParamsFields & {
|
|
250
|
-
account?: _xyo_network_account_model.AccountInstance | "random";
|
|
251
|
-
addToResolvers?: boolean;
|
|
252
|
-
additionalSigners?: _xyo_network_account_model.AccountInstance[];
|
|
253
|
-
allowNameResolution?: boolean;
|
|
254
|
-
config: AnyConfigSchema<_xyo_network_module_model.ModuleConfig<void, void>>;
|
|
255
|
-
ephemeralQueryAccountEnabled?: boolean;
|
|
256
|
-
moduleIdentifierTransformers?: _xyo_network_module_model.ModuleIdentifierTransformer[];
|
|
257
|
-
privateChildren?: ModuleInstance[];
|
|
258
|
-
publicChildren?: ModuleInstance[];
|
|
259
|
-
}, _xyo_network_module_model.ModuleEventData<object>> = ModuleInstance<_xylabs_object.BaseParamsFields & {
|
|
260
|
-
account?: _xyo_network_account_model.AccountInstance | "random";
|
|
261
|
-
addToResolvers?: boolean;
|
|
262
|
-
additionalSigners?: _xyo_network_account_model.AccountInstance[];
|
|
263
|
-
allowNameResolution?: boolean;
|
|
264
|
-
config: AnyConfigSchema<_xyo_network_module_model.ModuleConfig<void, void>>;
|
|
265
|
-
ephemeralQueryAccountEnabled?: boolean;
|
|
266
|
-
moduleIdentifierTransformers?: _xyo_network_module_model.ModuleIdentifierTransformer[];
|
|
267
|
-
privateChildren?: ModuleInstance[];
|
|
268
|
-
publicChildren?: ModuleInstance[];
|
|
269
|
-
}, _xyo_network_module_model.ModuleEventData<object>>>(id?: _xyo_network_module_model.ModuleIdentifier, options?: _xyo_network_module_model.ObjectFilterOptions<T> | undefined): _xylabs_promise.Promisable<T | T[] | undefined>;
|
|
270
|
-
resolvePrivate<T extends ModuleInstance<_xylabs_object.BaseParamsFields & {
|
|
271
|
-
account?: _xyo_network_account_model.AccountInstance | "random";
|
|
272
|
-
addToResolvers?: boolean;
|
|
273
|
-
additionalSigners?: _xyo_network_account_model.AccountInstance[];
|
|
274
|
-
allowNameResolution?: boolean;
|
|
275
|
-
config: AnyConfigSchema<_xyo_network_module_model.ModuleConfig<void, void>>;
|
|
276
|
-
ephemeralQueryAccountEnabled?: boolean;
|
|
277
|
-
moduleIdentifierTransformers?: _xyo_network_module_model.ModuleIdentifierTransformer[];
|
|
278
|
-
privateChildren?: ModuleInstance[];
|
|
279
|
-
publicChildren?: ModuleInstance[];
|
|
280
|
-
}, _xyo_network_module_model.ModuleEventData<object>> = ModuleInstance<_xylabs_object.BaseParamsFields & {
|
|
281
|
-
account?: _xyo_network_account_model.AccountInstance | "random";
|
|
282
|
-
addToResolvers?: boolean;
|
|
283
|
-
additionalSigners?: _xyo_network_account_model.AccountInstance[];
|
|
284
|
-
allowNameResolution?: boolean;
|
|
285
|
-
config: AnyConfigSchema<_xyo_network_module_model.ModuleConfig<void, void>>;
|
|
286
|
-
ephemeralQueryAccountEnabled?: boolean;
|
|
287
|
-
moduleIdentifierTransformers?: _xyo_network_module_model.ModuleIdentifierTransformer[];
|
|
288
|
-
privateChildren?: ModuleInstance[];
|
|
289
|
-
publicChildren?: ModuleInstance[];
|
|
290
|
-
}, _xyo_network_module_model.ModuleEventData<object>>>(all: "*", options?: _xyo_network_module_model.ObjectFilterOptions<T> | undefined): Promise<T[]>;
|
|
291
|
-
resolvePrivate<T extends ModuleInstance<_xylabs_object.BaseParamsFields & {
|
|
292
|
-
account?: _xyo_network_account_model.AccountInstance | "random";
|
|
293
|
-
addToResolvers?: boolean;
|
|
294
|
-
additionalSigners?: _xyo_network_account_model.AccountInstance[];
|
|
295
|
-
allowNameResolution?: boolean;
|
|
296
|
-
config: AnyConfigSchema<_xyo_network_module_model.ModuleConfig<void, void>>;
|
|
297
|
-
ephemeralQueryAccountEnabled?: boolean;
|
|
298
|
-
moduleIdentifierTransformers?: _xyo_network_module_model.ModuleIdentifierTransformer[];
|
|
299
|
-
privateChildren?: ModuleInstance[];
|
|
300
|
-
publicChildren?: ModuleInstance[];
|
|
301
|
-
}, _xyo_network_module_model.ModuleEventData<object>> = ModuleInstance<_xylabs_object.BaseParamsFields & {
|
|
302
|
-
account?: _xyo_network_account_model.AccountInstance | "random";
|
|
303
|
-
addToResolvers?: boolean;
|
|
304
|
-
additionalSigners?: _xyo_network_account_model.AccountInstance[];
|
|
305
|
-
allowNameResolution?: boolean;
|
|
306
|
-
config: AnyConfigSchema<_xyo_network_module_model.ModuleConfig<void, void>>;
|
|
307
|
-
ephemeralQueryAccountEnabled?: boolean;
|
|
308
|
-
moduleIdentifierTransformers?: _xyo_network_module_model.ModuleIdentifierTransformer[];
|
|
309
|
-
privateChildren?: ModuleInstance[];
|
|
310
|
-
publicChildren?: ModuleInstance[];
|
|
311
|
-
}, _xyo_network_module_model.ModuleEventData<object>>>(id: _xyo_network_module_model.ModuleIdentifier, options?: _xyo_network_module_model.ObjectFilterOptions<T> | undefined): Promise<T | undefined>;
|
|
312
|
-
resolvePrivate<T extends ModuleInstance<_xylabs_object.BaseParamsFields & {
|
|
313
|
-
account?: _xyo_network_account_model.AccountInstance | "random";
|
|
314
|
-
addToResolvers?: boolean;
|
|
315
|
-
additionalSigners?: _xyo_network_account_model.AccountInstance[];
|
|
316
|
-
allowNameResolution?: boolean;
|
|
317
|
-
config: AnyConfigSchema<_xyo_network_module_model.ModuleConfig<void, void>>;
|
|
318
|
-
ephemeralQueryAccountEnabled?: boolean;
|
|
319
|
-
moduleIdentifierTransformers?: _xyo_network_module_model.ModuleIdentifierTransformer[];
|
|
320
|
-
privateChildren?: ModuleInstance[];
|
|
321
|
-
publicChildren?: ModuleInstance[];
|
|
322
|
-
}, _xyo_network_module_model.ModuleEventData<object>> = ModuleInstance<_xylabs_object.BaseParamsFields & {
|
|
323
|
-
account?: _xyo_network_account_model.AccountInstance | "random";
|
|
324
|
-
addToResolvers?: boolean;
|
|
325
|
-
additionalSigners?: _xyo_network_account_model.AccountInstance[];
|
|
326
|
-
allowNameResolution?: boolean;
|
|
327
|
-
config: AnyConfigSchema<_xyo_network_module_model.ModuleConfig<void, void>>;
|
|
328
|
-
ephemeralQueryAccountEnabled?: boolean;
|
|
329
|
-
moduleIdentifierTransformers?: _xyo_network_module_model.ModuleIdentifierTransformer[];
|
|
330
|
-
privateChildren?: ModuleInstance[];
|
|
331
|
-
publicChildren?: ModuleInstance[];
|
|
332
|
-
}, _xyo_network_module_model.ModuleEventData<object>>>(id: _xyo_network_module_model.ModuleIdentifier, options?: _xyo_network_module_model.ObjectFilterOptions<T> | undefined): Promise<T | T[] | undefined>;
|
|
333
|
-
manifest: (maxDepth?: number, ignoreAddresses?: _xylabs_hex.Address[]) => _xylabs_promise.Promisable<_xyo_network_manifest_model.ModuleManifestPayload>;
|
|
334
|
-
manifestQuery: (account: _xyo_network_account_model.AccountInstance, maxDepth?: number, ignoreAddresses?: _xylabs_hex.Address[]) => _xylabs_promise.Promisable<_xyo_network_module_model.ModuleQueryResult<_xyo_network_manifest_model.ModuleManifestPayload>>;
|
|
335
|
-
moduleAddress: () => _xylabs_promise.Promisable<(_xyo_network_module_model.AddressPreviousHashPayload | _xyo_network_module_model.AddressPayload)[]>;
|
|
336
|
-
state: () => _xylabs_promise.Promisable<_xyo_network_payload_model.Payload[]>;
|
|
337
|
-
stateQuery: (account: _xyo_network_account_model.AccountInstance) => _xylabs_promise.Promisable<_xyo_network_module_model.ModuleQueryResult>;
|
|
338
|
-
account?: _xyo_network_account_model.AccountInstance;
|
|
339
|
-
addParent: (mod: ModuleInstance) => void;
|
|
340
|
-
addressCache?: (direction: _xyo_network_module_model.Direction, includePrivate: boolean) => _xyo_network_module_model.AddressToWeakInstanceCache | undefined;
|
|
341
|
-
parents: () => _xylabs_promise.Promisable<ModuleInstance[]>;
|
|
342
|
-
privateChildren: () => _xylabs_promise.Promisable<ModuleInstance[]>;
|
|
343
|
-
publicChildren: () => _xylabs_promise.Promisable<ModuleInstance[]>;
|
|
344
|
-
removeParent: (address: _xylabs_hex.Address) => void;
|
|
345
|
-
siblings: () => _xylabs_promise.Promisable<ModuleInstance[]>;
|
|
346
|
-
}) & TModule;
|
|
347
|
-
|
|
348
|
-
declare const StatefulDivinerSchema: "network.xyo.diviner.stateful";
|
|
349
|
-
type StatefulDivinerSchema = typeof StatefulDivinerSchema;
|
|
350
|
-
|
|
351
|
-
export { type AnyModule, StatefulDiviner, type StatefulDivinerConfig, StatefulDivinerConfigSchema, type StatefulDivinerParams, StatefulDivinerSchema, StatefulModuleMixin, type StatefulModuleParams };
|
|
1
|
+
export * from './Config.ts';
|
|
2
|
+
export * from './Diviner.ts';
|
|
3
|
+
export * from './DivinerMixin.ts';
|
|
4
|
+
export * from './Params.ts';
|
|
5
|
+
export * from './Schema.ts';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,cAAc,mBAAmB,CAAA;AACjC,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA"}
|
package/dist/neutral/index.mjs
CHANGED
|
@@ -15,9 +15,7 @@ import { BoundWitnessDivinerQuerySchema } from "@xyo-network/diviner-boundwitnes
|
|
|
15
15
|
import { DivinerWrapper } from "@xyo-network/diviner-wrapper";
|
|
16
16
|
import { isModuleState, ModuleStateSchema } from "@xyo-network/module-model";
|
|
17
17
|
import { PayloadBuilder } from "@xyo-network/payload-builder";
|
|
18
|
-
import {
|
|
19
|
-
SequenceConstants
|
|
20
|
-
} from "@xyo-network/payload-model";
|
|
18
|
+
import { SequenceConstants } from "@xyo-network/payload-model";
|
|
21
19
|
var moduleName = "StatefulDiviner";
|
|
22
20
|
var StatefulDiviner = class extends AbstractDiviner {
|
|
23
21
|
static configSchemas = [...super.configSchemas, StatefulDivinerConfigSchema];
|
|
@@ -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 type { DivinerConfig } from '@xyo-network/diviner-model'\nimport type { ModuleIdentifier } from '@xyo-network/module-model'\n\nimport { StatefulDivinerSchema } from './Schema.ts'\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 type { Hash } from '@xylabs/hex'\nimport { toJson } from '@xylabs/object'\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 type { BoundWitnessDivinerQueryPayload } from '@xyo-network/diviner-boundwitness-model'\nimport { BoundWitnessDivinerQuerySchema } from '@xyo-network/diviner-boundwitness-model'\nimport type { DivinerInstance, DivinerModuleEventData } from '@xyo-network/diviner-model'\nimport { DivinerWrapper } from '@xyo-network/diviner-wrapper'\nimport type { ModuleState, StateDictionary } from '@xyo-network/module-model'\nimport { isModuleState, ModuleStateSchema } from '@xyo-network/module-model'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport {\n type Payload, type Schema, SequenceConstants,\n type WithStorageMeta,\n} from '@xyo-network/payload-model'\n\nimport { StatefulDivinerConfigSchema } from './Config.ts'\nimport type { StatefulDivinerParams } from './Params.ts'\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<DivinerInstance<TParams, TIn, TOut>, TIn, TOut> = DivinerModuleEventData<\n DivinerInstance<TParams, TIn, TOut>,\n TIn,\n TOut\n >,\n TState extends StateDictionary = StateDictionary,\n> extends AbstractDiviner<TParams, TIn, TOut, TEventData> {\n static override readonly configSchemas: Schema[] = [...super.configSchemas, StatefulDivinerConfigSchema]\n static override readonly defaultConfigSchema: Schema = StatefulDivinerConfigSchema\n\n /**\n * The last state\n */\n protected _lastState?: 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: ModuleState<TState>) {\n // Don't commit state if no state has changed\n if (toJson(nextState.state) === toJson(this._lastState?.state)) return\n this._lastState = nextState\n const archivist = await this.getArchivistForStateStore()\n const [bw] = await new BoundWitnessBuilder().payload(nextState).signer(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<ModuleState<TState> | undefined> {\n if (this._lastState) return this._lastState\n let hash: Hash = ''\n const diviner = await this.getBoundWitnessDivinerForStateStore()\n const query = new PayloadBuilder<BoundWitnessDivinerQueryPayload>({ schema: BoundWitnessDivinerQuerySchema })\n .fields({\n address: this.account.address,\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 === 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 WithStorageMeta<ModuleState<TState>>\n }\n }\n return undefined\n }\n}\n","import { assertEx } from '@xylabs/assert'\nimport type { Hash } from '@xylabs/hex'\nimport { toJson } from '@xylabs/object'\nimport { asArchivistInstance } from '@xyo-network/archivist-model'\nimport { BoundWitnessBuilder } from '@xyo-network/boundwitness-builder'\nimport { isBoundWitness } from '@xyo-network/boundwitness-model'\nimport type { BoundWitnessDivinerQueryPayload } from '@xyo-network/diviner-boundwitness-model'\nimport { BoundWitnessDivinerQuerySchema } from '@xyo-network/diviner-boundwitness-model'\nimport { asDivinerInstance } from '@xyo-network/diviner-model'\nimport type {\n AnyConfigSchema,\n ModuleInstance,\n ModuleParams,\n ModuleState,\n StateDictionary,\n} from '@xyo-network/module-model'\nimport {\n isModuleState,\n ModuleStateSchema,\n} from '@xyo-network/module-model'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport { SequenceConstants, type WithStorageMeta } from '@xyo-network/payload-model'\n\nimport type { StatefulDivinerConfig } from './Config.ts'\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?: 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: ModuleState<TState>) {\n // Don't commit state if no state has changed\n if (toJson(nextState.state) === toJson(this._lastState?.state)) return\n this._lastState = nextState\n const archivist = await this.getArchivistForStore()\n // const [bw] = await new BoundWitnessBuilder().payload(nextState).signer(this.account).build()\n const [bw] = 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 /**\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 /**\n * Retrieves the last state of the Diviner process. Used to recover state after\n * preemptions, reboots, etc.\n */\n async retrieveState(): Promise<ModuleState<TState> | undefined> {\n if (this._lastState) return this._lastState\n let hash: Hash = ''\n const diviner = await this.getBoundWitnessDivinerForStore()\n const query = new PayloadBuilder<BoundWitnessDivinerQueryPayload>({ schema: BoundWitnessDivinerQuerySchema })\n .fields({\n // address: this.account.address,\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 === 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 WithStorageMeta<ModuleState<TState>>\n }\n }\n return undefined\n }\n }\n return StatefulModuleBase\n}\n"],"mappings":";AAAO,IAAM,wBAAwB;;;ACQ9B,IAAM,8BAA8B,GAAG,qBAAqB;;;ACRnE,SAAS,gBAAgB;AAEzB,SAAS,cAAc;AACvB,SAAS,wBAAwB;AACjC,SAAS,2BAA2B;AACpC,SAAS,sBAAsB;AAC/B,SAAS,uBAAuB;AAEhC,SAAS,sCAAsC;AAE/C,SAAS,sBAAsB;AAE/B,SAAS,eAAe,yBAAyB;AACjD,SAAS,sBAAsB;AAC/B;AAAA,EAC6B;AAAA,OAEtB;AAKP,IAAM,aAAa;AAKZ,IAAe,kBAAf,cAUG,gBAAgD;AAAA,EACxD,OAAyB,gBAA0B,CAAC,GAAG,MAAM,eAAe,2BAA2B;AAAA,EACvG,OAAyB,sBAA8B;AAAA;AAAA;AAAA;AAAA,EAK7C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASV,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MT,UAAS,MAAM,KAAK,QAAQ,IAAI,GAAG,MAAM,GAAGS,WAAU,+CAA+C;AAEjH,YAAM,WAAW,kBAAkB,GAAG;AACtC,aAAOT,UAAS,UAAU,MAAM,GAAGS,WAAU,mCAAmC;AAAA,IAClF;AAAA;AAAA;AAAA;AAAA;AAAA,IAMA,MAAM,gBAA0D;AAC9D,UAAI,KAAK,WAAY,QAAO,KAAK;AACjC,UAAI,OAAa;AACjB,YAAM,UAAU,MAAM,KAAK,+BAA+B;AAC1D,YAAM,QAAQ,IAAIF,gBAAgD,EAAE,QAAQH,gCAA+B,CAAC,EACzG,OAAO;AAAA;AAAA,QAEN,OAAO;AAAA,QACP,QAAQI,mBAAkB;AAAA,QAC1B,OAAO;AAAA,QACP,iBAAiB,CAACF,kBAAiB;AAAA,MACrC,CAAC,EACA,MAAM;AACT,YAAM,iBAAiB,MAAM,QAAQ,OAAO,CAAC,KAAK,CAAC;AACnD,UAAI,eAAe,SAAS,GAAG;AAC7B,cAAM,eAAe,eAAe,CAAC;AACrC,YAAIH,gBAAe,YAAY,GAAG;AAEhC,iBAAO,aAAa,UACjB,IAAI,CAAC,SAAS,WAAW,EAAE,SAAS,MAAM,EAAE,EAG5C;AAAA,YACC,CAAC,MAAM,SAAU,aAAa,kBAAkB,MAAM,KAAK,MAAMG,qBAAoB,aAAa,eAAe,MAAM,KAAK,IAAI;AAAA,YAChI;AAAA,UACF;AAAA,QACJ;AAAA,MACF;AAGA,UAAI,MAAM;AAER,cAAM,YAAY,MAAM,KAAK,qBAAqB;AAClD,cAAM,WAAW,MAAM,UAAU,IAAI,CAAC,IAAI,CAAC,GAAG,KAAKD,cAAqB;AACxE,YAAI,SAAS;AACX,iBAAO;AAAA,QACT;AAAA,MACF;AACA,aAAO;AAAA,IACT;AAAA,EACF;AACA,SAAO;AACT;","names":["assertEx","toJson","BoundWitnessBuilder","isBoundWitness","BoundWitnessDivinerQuerySchema","isModuleState","ModuleStateSchema","PayloadBuilder","SequenceConstants","moduleName"]}
|
|
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 type { DivinerConfig } from '@xyo-network/diviner-model'\nimport type { ModuleIdentifier } from '@xyo-network/module-model'\n\nimport { StatefulDivinerSchema } from './Schema.ts'\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 type { Hash } from '@xylabs/hex'\nimport { toJson } from '@xylabs/object'\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 type { BoundWitnessDivinerQueryPayload } from '@xyo-network/diviner-boundwitness-model'\nimport { BoundWitnessDivinerQuerySchema } from '@xyo-network/diviner-boundwitness-model'\nimport type { DivinerInstance, DivinerModuleEventData } from '@xyo-network/diviner-model'\nimport { DivinerWrapper } from '@xyo-network/diviner-wrapper'\nimport type { ModuleState, StateDictionary } from '@xyo-network/module-model'\nimport { isModuleState, ModuleStateSchema } from '@xyo-network/module-model'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport type {\n Payload, Schema,\n WithStorageMeta,\n} from '@xyo-network/payload-model'\nimport { SequenceConstants } from '@xyo-network/payload-model'\n\nimport { StatefulDivinerConfigSchema } from './Config.ts'\nimport type { StatefulDivinerParams } from './Params.ts'\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<DivinerInstance<TParams, TIn, TOut>, TIn, TOut> = DivinerModuleEventData<\n DivinerInstance<TParams, TIn, TOut>,\n TIn,\n TOut\n >,\n TState extends StateDictionary = StateDictionary,\n> extends AbstractDiviner<TParams, TIn, TOut, TEventData> {\n static override readonly configSchemas: Schema[] = [...super.configSchemas, StatefulDivinerConfigSchema]\n static override readonly defaultConfigSchema: Schema = StatefulDivinerConfigSchema\n\n /**\n * The last state\n */\n protected _lastState?: 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: ModuleState<TState>) {\n // Don't commit state if no state has changed\n if (toJson(nextState.state) === toJson(this._lastState?.state)) return\n this._lastState = nextState\n const archivist = await this.getArchivistForStateStore()\n const [bw] = await new BoundWitnessBuilder().payload(nextState).signer(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<ModuleState<TState> | undefined> {\n if (this._lastState) return this._lastState\n let hash: Hash = ''\n const diviner = await this.getBoundWitnessDivinerForStateStore()\n const query = new PayloadBuilder<BoundWitnessDivinerQueryPayload>({ schema: BoundWitnessDivinerQuerySchema })\n .fields({\n address: this.account.address,\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 === 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 WithStorageMeta<ModuleState<TState>>\n }\n }\n return undefined\n }\n}\n","import { assertEx } from '@xylabs/assert'\nimport type { Hash } from '@xylabs/hex'\nimport { toJson } from '@xylabs/object'\nimport { asArchivistInstance } from '@xyo-network/archivist-model'\nimport { BoundWitnessBuilder } from '@xyo-network/boundwitness-builder'\nimport { isBoundWitness } from '@xyo-network/boundwitness-model'\nimport type { BoundWitnessDivinerQueryPayload } from '@xyo-network/diviner-boundwitness-model'\nimport { BoundWitnessDivinerQuerySchema } from '@xyo-network/diviner-boundwitness-model'\nimport { asDivinerInstance } from '@xyo-network/diviner-model'\nimport type {\n AnyConfigSchema,\n ModuleInstance,\n ModuleParams,\n ModuleState,\n StateDictionary,\n} from '@xyo-network/module-model'\nimport {\n isModuleState,\n ModuleStateSchema,\n} from '@xyo-network/module-model'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport type { WithStorageMeta } from '@xyo-network/payload-model'\nimport { SequenceConstants } from '@xyo-network/payload-model'\n\nimport type { StatefulDivinerConfig } from './Config.ts'\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?: 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: ModuleState<TState>) {\n // Don't commit state if no state has changed\n if (toJson(nextState.state) === toJson(this._lastState?.state)) return\n this._lastState = nextState\n const archivist = await this.getArchivistForStore()\n // const [bw] = await new BoundWitnessBuilder().payload(nextState).signer(this.account).build()\n const [bw] = 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 /**\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 /**\n * Retrieves the last state of the Diviner process. Used to recover state after\n * preemptions, reboots, etc.\n */\n async retrieveState(): Promise<ModuleState<TState> | undefined> {\n if (this._lastState) return this._lastState\n let hash: Hash = ''\n const diviner = await this.getBoundWitnessDivinerForStore()\n const query = new PayloadBuilder<BoundWitnessDivinerQueryPayload>({ schema: BoundWitnessDivinerQuerySchema })\n .fields({\n // address: this.account.address,\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 === 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 WithStorageMeta<ModuleState<TState>>\n }\n }\n return undefined\n }\n }\n return StatefulModuleBase\n}\n"],"mappings":";AAAO,IAAM,wBAAwB;;;ACQ9B,IAAM,8BAA8B,GAAG,qBAAqB;;;ACRnE,SAAS,gBAAgB;AAEzB,SAAS,cAAc;AACvB,SAAS,wBAAwB;AACjC,SAAS,2BAA2B;AACpC,SAAS,sBAAsB;AAC/B,SAAS,uBAAuB;AAEhC,SAAS,sCAAsC;AAE/C,SAAS,sBAAsB;AAE/B,SAAS,eAAe,yBAAyB;AACjD,SAAS,sBAAsB;AAK/B,SAAS,yBAAyB;AAKlC,IAAM,aAAa;AAKZ,IAAe,kBAAf,cAUG,gBAAgD;AAAA,EACxD,OAAyB,gBAA0B,CAAC,GAAG,MAAM,eAAe,2BAA2B;AAAA,EACvG,OAAyB,sBAA8B;AAAA;AAAA;AAAA;AAAA,EAK7C;AAAA;AAAA;AAAA;AAAA;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ateSchema","PayloadBuilder","SequenceConstants","moduleName"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyo-network/diviner-stateful",
|
|
3
|
-
"version": "3.9.
|
|
3
|
+
"version": "3.9.19",
|
|
4
4
|
"description": "Primary SDK for using XYO Protocol 2.0",
|
|
5
5
|
"homepage": "https://xyo.network",
|
|
6
6
|
"bugs": {
|
|
@@ -32,31 +32,31 @@
|
|
|
32
32
|
"@xylabs/assert": "^4.5.1",
|
|
33
33
|
"@xylabs/hex": "^4.5.1",
|
|
34
34
|
"@xylabs/object": "^4.5.1",
|
|
35
|
-
"@xyo-network/archivist-model": "^3.9.
|
|
36
|
-
"@xyo-network/archivist-wrapper": "^3.9.
|
|
37
|
-
"@xyo-network/boundwitness-builder": "^3.9.
|
|
38
|
-
"@xyo-network/boundwitness-model": "^3.9.
|
|
39
|
-
"@xyo-network/diviner-abstract": "^3.9.
|
|
40
|
-
"@xyo-network/diviner-boundwitness-model": "^3.9.
|
|
41
|
-
"@xyo-network/diviner-model": "^3.9.
|
|
42
|
-
"@xyo-network/diviner-wrapper": "^3.9.
|
|
43
|
-
"@xyo-network/module-model": "^3.9.
|
|
44
|
-
"@xyo-network/payload-builder": "^3.9.
|
|
45
|
-
"@xyo-network/payload-model": "^3.9.
|
|
35
|
+
"@xyo-network/archivist-model": "^3.9.19",
|
|
36
|
+
"@xyo-network/archivist-wrapper": "^3.9.19",
|
|
37
|
+
"@xyo-network/boundwitness-builder": "^3.9.19",
|
|
38
|
+
"@xyo-network/boundwitness-model": "^3.9.19",
|
|
39
|
+
"@xyo-network/diviner-abstract": "^3.9.19",
|
|
40
|
+
"@xyo-network/diviner-boundwitness-model": "^3.9.19",
|
|
41
|
+
"@xyo-network/diviner-model": "^3.9.19",
|
|
42
|
+
"@xyo-network/diviner-wrapper": "^3.9.19",
|
|
43
|
+
"@xyo-network/module-model": "^3.9.19",
|
|
44
|
+
"@xyo-network/payload-builder": "^3.9.19",
|
|
45
|
+
"@xyo-network/payload-model": "^3.9.19"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@xylabs/ts-scripts-yarn3": "^5.0.
|
|
49
|
-
"@xylabs/tsconfig": "^5.0.
|
|
48
|
+
"@xylabs/ts-scripts-yarn3": "^5.0.39",
|
|
49
|
+
"@xylabs/tsconfig": "^5.0.39",
|
|
50
50
|
"@xylabs/vitest-extended": "^4.5.1",
|
|
51
|
-
"@xyo-network/account": "^3.9.
|
|
52
|
-
"@xyo-network/archivist-memory": "^3.9.
|
|
53
|
-
"@xyo-network/diviner-boundwitness-memory": "^3.9.
|
|
54
|
-
"@xyo-network/diviner-payload-memory": "^3.9.
|
|
55
|
-
"@xyo-network/manifest": "^3.9.
|
|
56
|
-
"@xyo-network/module-factory-locator": "^3.9.
|
|
57
|
-
"@xyo-network/node-memory": "^3.9.
|
|
58
|
-
"typescript": "^5.
|
|
59
|
-
"vitest": "^3.0.
|
|
51
|
+
"@xyo-network/account": "^3.9.19",
|
|
52
|
+
"@xyo-network/archivist-memory": "^3.9.19",
|
|
53
|
+
"@xyo-network/diviner-boundwitness-memory": "^3.9.19",
|
|
54
|
+
"@xyo-network/diviner-payload-memory": "^3.9.19",
|
|
55
|
+
"@xyo-network/manifest": "^3.9.19",
|
|
56
|
+
"@xyo-network/module-factory-locator": "^3.9.19",
|
|
57
|
+
"@xyo-network/node-memory": "^3.9.19",
|
|
58
|
+
"typescript": "^5.8.2",
|
|
59
|
+
"vitest": "^3.0.7"
|
|
60
60
|
},
|
|
61
61
|
"publishConfig": {
|
|
62
62
|
"access": "public"
|
package/src/Diviner.ts
CHANGED
|
@@ -12,10 +12,11 @@ import { DivinerWrapper } from '@xyo-network/diviner-wrapper'
|
|
|
12
12
|
import type { ModuleState, StateDictionary } from '@xyo-network/module-model'
|
|
13
13
|
import { isModuleState, ModuleStateSchema } from '@xyo-network/module-model'
|
|
14
14
|
import { PayloadBuilder } from '@xyo-network/payload-builder'
|
|
15
|
-
import {
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
import type {
|
|
16
|
+
Payload, Schema,
|
|
17
|
+
WithStorageMeta,
|
|
18
18
|
} from '@xyo-network/payload-model'
|
|
19
|
+
import { SequenceConstants } from '@xyo-network/payload-model'
|
|
19
20
|
|
|
20
21
|
import { StatefulDivinerConfigSchema } from './Config.ts'
|
|
21
22
|
import type { StatefulDivinerParams } from './Params.ts'
|
package/src/DivinerMixin.ts
CHANGED
|
@@ -19,7 +19,8 @@ import {
|
|
|
19
19
|
ModuleStateSchema,
|
|
20
20
|
} from '@xyo-network/module-model'
|
|
21
21
|
import { PayloadBuilder } from '@xyo-network/payload-builder'
|
|
22
|
-
import {
|
|
22
|
+
import type { WithStorageMeta } from '@xyo-network/payload-model'
|
|
23
|
+
import { SequenceConstants } from '@xyo-network/payload-model'
|
|
23
24
|
|
|
24
25
|
import type { StatefulDivinerConfig } from './Config.ts'
|
|
25
26
|
|