@xyo-network/sentinel 2.72.8 → 2.73.0

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.
Files changed (52) hide show
  1. package/dist/index.d.mts +291 -0
  2. package/dist/index.d.ts +291 -0
  3. package/dist/index.js +7542 -0
  4. package/dist/index.js.map +1 -0
  5. package/dist/index.mjs +7517 -0
  6. package/dist/index.mjs.map +1 -0
  7. package/package.json +40 -27
  8. package/src/AbstractSentinel.ts +1 -1
  9. package/tsup.config.ts +16 -0
  10. package/dist/cjs/AbstractSentinel.js +0 -125
  11. package/dist/cjs/AbstractSentinel.js.map +0 -1
  12. package/dist/cjs/Automation.js +0 -5
  13. package/dist/cjs/Automation.js.map +0 -1
  14. package/dist/cjs/MemorySentinel.js +0 -50
  15. package/dist/cjs/MemorySentinel.js.map +0 -1
  16. package/dist/cjs/SentinelIntervalAutomationWrapper.js +0 -51
  17. package/dist/cjs/SentinelIntervalAutomationWrapper.js.map +0 -1
  18. package/dist/cjs/SentinelRunner.js +0 -102
  19. package/dist/cjs/SentinelRunner.js.map +0 -1
  20. package/dist/cjs/Wrapper.js +0 -29
  21. package/dist/cjs/Wrapper.js.map +0 -1
  22. package/dist/cjs/index.js +0 -11
  23. package/dist/cjs/index.js.map +0 -1
  24. package/dist/docs.json +0 -68111
  25. package/dist/esm/AbstractSentinel.js +0 -98
  26. package/dist/esm/AbstractSentinel.js.map +0 -1
  27. package/dist/esm/Automation.js +0 -2
  28. package/dist/esm/Automation.js.map +0 -1
  29. package/dist/esm/MemorySentinel.js +0 -41
  30. package/dist/esm/MemorySentinel.js.map +0 -1
  31. package/dist/esm/SentinelIntervalAutomationWrapper.js +0 -44
  32. package/dist/esm/SentinelIntervalAutomationWrapper.js.map +0 -1
  33. package/dist/esm/SentinelRunner.js +0 -86
  34. package/dist/esm/SentinelRunner.js.map +0 -1
  35. package/dist/esm/Wrapper.js +0 -20
  36. package/dist/esm/Wrapper.js.map +0 -1
  37. package/dist/esm/index.js +0 -8
  38. package/dist/esm/index.js.map +0 -1
  39. package/dist/types/AbstractSentinel.d.ts +0 -22
  40. package/dist/types/AbstractSentinel.d.ts.map +0 -1
  41. package/dist/types/Automation.d.ts +0 -28
  42. package/dist/types/Automation.d.ts.map +0 -1
  43. package/dist/types/MemorySentinel.d.ts +0 -11
  44. package/dist/types/MemorySentinel.d.ts.map +0 -1
  45. package/dist/types/SentinelIntervalAutomationWrapper.d.ts +0 -11
  46. package/dist/types/SentinelIntervalAutomationWrapper.d.ts.map +0 -1
  47. package/dist/types/SentinelRunner.d.ts +0 -24
  48. package/dist/types/SentinelRunner.d.ts.map +0 -1
  49. package/dist/types/Wrapper.d.ts +0 -14
  50. package/dist/types/Wrapper.d.ts.map +0 -1
  51. package/dist/types/index.d.ts +0 -8
  52. package/dist/types/index.d.ts.map +0 -1
@@ -0,0 +1,291 @@
1
+ import * as _xyo_network_wallet_model from '@xyo-network/wallet-model';
2
+ import * as _xyo_network_archivist_model from '@xyo-network/archivist-model';
3
+ import * as _xyo_network_module_model from '@xyo-network/module-model';
4
+ import * as _xyo_network_payload_model from '@xyo-network/payload-model';
5
+ import { Payload } from '@xyo-network/payload-model';
6
+ import * as _xyo_network_account_model from '@xyo-network/account-model';
7
+ import * as _xyo_network_core from '@xyo-network/core';
8
+ import { AnyObject } from '@xyo-network/core';
9
+ import { AbstractArchivingModule, ArchivistInstance } from '@xyo-network/archivist';
10
+ import { QueryBoundWitness } from '@xyo-network/boundwitness-builder';
11
+ import { BoundWitness } from '@xyo-network/boundwitness-model';
12
+ import { ModuleConfig, ModuleQueryHandlerResult, AnyConfigSchema, ModuleWrapper } from '@xyo-network/module';
13
+ import { SentinelParams, SentinelModuleEventData, SentinelInstance, CustomSentinelInstance, SentinelQueryBase, SentinelConfig, SentinelModule } from '@xyo-network/sentinel-model';
14
+ export * from '@xyo-network/sentinel-model';
15
+ import { WitnessInstance } from '@xyo-network/witness';
16
+ import { PayloadWrapper } from '@xyo-network/payload-wrapper';
17
+ import * as _xyo_network_object_identity from '@xyo-network/object-identity';
18
+
19
+ declare abstract class AbstractSentinel<TParams extends SentinelParams = SentinelParams, TEventData extends SentinelModuleEventData<SentinelInstance<TParams>> = SentinelModuleEventData<SentinelInstance<TParams>>> extends AbstractArchivingModule<TParams, TEventData> implements CustomSentinelInstance<TParams, TEventData> {
20
+ history: BoundWitness[];
21
+ get queries(): string[];
22
+ protected get _queryAccountPaths(): Record<SentinelQueryBase['schema'], string>;
23
+ addArchivist(address: string[]): void;
24
+ addWitness(address: string[]): void;
25
+ archivists(): Promise<_xyo_network_archivist_model.ArchivistInstance<_xyo_network_core.BaseParamsFields & {
26
+ account?: _xyo_network_account_model.AccountInstance | "random" | undefined;
27
+ config: _xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & {
28
+ accountDerivationPath?: string | undefined;
29
+ readonly archivist?: _xyo_network_module_model.ArchivistModuleConfig | undefined;
30
+ readonly name?: string | undefined;
31
+ readonly paging?: Record<string, {
32
+ size?: number | undefined;
33
+ }> | undefined;
34
+ readonly schema: string;
35
+ readonly security?: {
36
+ readonly allowAnonymous?: boolean | undefined;
37
+ readonly allowed?: Record<string, (string | _xyo_network_module_model.CosigningAddressSet)[]> | undefined;
38
+ readonly disallowed?: Record<string, string[]> | undefined;
39
+ } | undefined;
40
+ readonly sign?: boolean | undefined;
41
+ readonly storeQueries?: boolean | undefined;
42
+ readonly timestamp?: boolean | undefined;
43
+ } & Omit<Omit<_xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & {
44
+ accountDerivationPath?: string | undefined;
45
+ readonly archivist?: _xyo_network_module_model.ArchivistModuleConfig | undefined;
46
+ readonly name?: string | undefined;
47
+ readonly paging?: Record<string, {
48
+ size?: number | undefined;
49
+ }> | undefined;
50
+ readonly schema: "network.xyo.archivist.config";
51
+ readonly security?: {
52
+ readonly allowAnonymous?: boolean | undefined;
53
+ readonly allowed?: Record<string, (string | _xyo_network_module_model.CosigningAddressSet)[]> | undefined;
54
+ readonly disallowed?: Record<string, string[]> | undefined;
55
+ } | undefined;
56
+ readonly sign?: boolean | undefined;
57
+ readonly storeQueries?: boolean | undefined;
58
+ readonly timestamp?: boolean | undefined;
59
+ } & Omit<{
60
+ parents?: _xyo_network_archivist_model.ArchivistParents | undefined;
61
+ requireAllParents?: boolean | undefined;
62
+ schema: "network.xyo.archivist.config";
63
+ storeParentReads?: boolean | undefined;
64
+ } & Omit<undefined, "schema">, "schema"> & {
65
+ schema: "network.xyo.archivist.config";
66
+ }, "schema"> & {
67
+ schema: string;
68
+ }, "schema"> & {
69
+ schema: string;
70
+ };
71
+ ephemeralQueryAccountEnabled?: boolean | undefined;
72
+ wallet?: _xyo_network_wallet_model.WalletInstance | undefined;
73
+ }, _xyo_network_archivist_model.ArchivistModuleEventData>[]>;
74
+ removeArchivist(address: string[]): void;
75
+ removeWitness(address: string[]): void;
76
+ report(inPayloads?: Payload[]): Promise<Payload[]>;
77
+ witnesses(): Promise<WitnessInstance[]>;
78
+ protected queryHandler<T extends QueryBoundWitness = QueryBoundWitness, TConfig extends ModuleConfig = ModuleConfig>(query: T, payloads?: Payload[], queryConfig?: TConfig): Promise<ModuleQueryHandlerResult>;
79
+ abstract reportHandler(payloads?: Payload[]): Promise<Payload[]>;
80
+ }
81
+
82
+ type SentinelAutomationSchema = 'network.xyo.automation';
83
+ declare const SentinelAutomationSchema: SentinelAutomationSchema;
84
+ type SentinelBaseAutomationPayload<T extends AnyObject = AnyObject> = Payload<T & {
85
+ schema: SentinelAutomationSchema;
86
+ type?: 'interval' | 'change';
87
+ /** @field The list of witnesses to invoke [all if undefined] */
88
+ witnesses?: string[];
89
+ }>;
90
+ type SentinelIntervalAutomationPayload = SentinelBaseAutomationPayload<{
91
+ /** @field epoch after which any reoccurrence stops */
92
+ end?: number;
93
+ /** @field time between triggers [non-repeating if undefined] */
94
+ frequency?: number;
95
+ /** @field units for frequency field [hour if undefined] */
96
+ frequencyUnits?: 'second' | 'minute' | 'hour' | 'day';
97
+ /** @field remaining triggers [infinite if undefined] */
98
+ remaining?: number;
99
+ /** @field epoch of the next trigger */
100
+ start: number;
101
+ type: 'interval';
102
+ }>;
103
+ type SentinelChangeAutomationPayload = SentinelBaseAutomationPayload<{
104
+ type: 'change';
105
+ }>;
106
+ type SentinelAutomationPayload = SentinelIntervalAutomationPayload | SentinelChangeAutomationPayload;
107
+
108
+ type MemorySentinelParams<TConfig extends AnyConfigSchema<SentinelConfig> = AnyConfigSchema<SentinelConfig>> = SentinelParams<AnyConfigSchema<TConfig>>;
109
+ declare class MemorySentinel<TParams extends MemorySentinelParams = MemorySentinelParams, TEventData extends SentinelModuleEventData<SentinelInstance<TParams>> = SentinelModuleEventData<SentinelInstance<TParams>>> extends AbstractSentinel<TParams, TEventData> {
110
+ static configSchemas: "network.xyo.sentinel.config"[];
111
+ reportHandler(payloads?: Payload[]): Promise<Payload[]>;
112
+ private generateResults;
113
+ }
114
+
115
+ declare class SentinelIntervalAutomationWrapper<T extends SentinelIntervalAutomationPayload = SentinelIntervalAutomationPayload> extends PayloadWrapper<T> {
116
+ constructor(payload: T);
117
+ protected get frequencyMillis(): number;
118
+ protected get remaining(): number;
119
+ next(): this;
120
+ protected checkEnd(): void;
121
+ protected consumeRemaining(count?: number): void;
122
+ }
123
+
124
+ type OnSentinelRunnerTriggerResult = (result: Payload[]) => void;
125
+ declare class SentinelRunner {
126
+ protected _automations: Record<string, SentinelAutomationPayload>;
127
+ protected onTriggerResult: OnSentinelRunnerTriggerResult | undefined;
128
+ protected sentinel: SentinelInstance;
129
+ protected timeoutId?: NodeJS.Timeout | string | number;
130
+ constructor(sentinel: SentinelInstance, automations?: SentinelAutomationPayload[], onTriggerResult?: OnSentinelRunnerTriggerResult);
131
+ get automations(): Record<string, SentinelAutomationPayload>;
132
+ private get next();
133
+ add(automation: SentinelAutomationPayload, restart?: boolean): Promise<string>;
134
+ find(hash: string): void;
135
+ remove(hash: string, restart?: boolean): Promise<void>;
136
+ removeAll(): void;
137
+ restart(): Promise<void>;
138
+ start(): Promise<void>;
139
+ stop(): void;
140
+ update(hash: string, automation: SentinelAutomationPayload, restart?: boolean): Promise<void>;
141
+ private trigger;
142
+ }
143
+
144
+ declare class SentinelWrapper<TModule extends SentinelModule = SentinelModule> extends ModuleWrapper<TModule> implements SentinelInstance<TModule['params']> {
145
+ static instanceIdentityCheck: _xyo_network_object_identity.ObjectTypeCheck<SentinelInstance<_xyo_network_core.BaseParamsFields & {
146
+ account?: _xyo_network_account_model.AccountInstance | "random" | undefined;
147
+ config: _xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & {
148
+ accountDerivationPath?: string | undefined;
149
+ readonly archivist?: _xyo_network_module_model.ArchivistModuleConfig | undefined;
150
+ readonly name?: string | undefined;
151
+ readonly paging?: Record<string, {
152
+ size?: number | undefined;
153
+ }> | undefined;
154
+ readonly schema: string;
155
+ readonly security?: {
156
+ readonly allowAnonymous?: boolean | undefined;
157
+ readonly allowed?: Record<string, (string | _xyo_network_module_model.CosigningAddressSet)[]> | undefined;
158
+ readonly disallowed?: Record<string, string[]> | undefined;
159
+ } | undefined;
160
+ readonly sign?: boolean | undefined;
161
+ readonly storeQueries?: boolean | undefined;
162
+ readonly timestamp?: boolean | undefined;
163
+ } & Omit<Omit<_xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & {
164
+ accountDerivationPath?: string | undefined;
165
+ readonly archivist?: _xyo_network_module_model.ArchivistModuleConfig | undefined;
166
+ readonly name?: string | undefined;
167
+ readonly paging?: Record<string, {
168
+ size?: number | undefined;
169
+ }> | undefined;
170
+ readonly schema: "network.xyo.sentinel.config";
171
+ readonly security?: {
172
+ readonly allowAnonymous?: boolean | undefined;
173
+ readonly allowed?: Record<string, (string | _xyo_network_module_model.CosigningAddressSet)[]> | undefined;
174
+ readonly disallowed?: Record<string, string[]> | undefined;
175
+ } | undefined;
176
+ readonly sign?: boolean | undefined;
177
+ readonly storeQueries?: boolean | undefined;
178
+ readonly timestamp?: boolean | undefined;
179
+ } & Omit<_xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & {
180
+ accountDerivationPath?: string | undefined;
181
+ readonly archivist?: _xyo_network_module_model.ArchivistModuleConfig | undefined;
182
+ readonly name?: string | undefined;
183
+ readonly paging?: Record<string, {
184
+ size?: number | undefined;
185
+ }> | undefined;
186
+ readonly schema: string;
187
+ readonly security?: {
188
+ readonly allowAnonymous?: boolean | undefined;
189
+ readonly allowed?: Record<string, (string | _xyo_network_module_model.CosigningAddressSet)[]> | undefined;
190
+ readonly disallowed?: Record<string, string[]> | undefined;
191
+ } | undefined;
192
+ readonly sign?: boolean | undefined;
193
+ readonly storeQueries?: boolean | undefined;
194
+ readonly timestamp?: boolean | undefined;
195
+ } & Omit<{
196
+ archivists?: string[] | undefined;
197
+ schema: string;
198
+ }, "schema"> & {
199
+ schema: string;
200
+ } & {
201
+ schema: "network.xyo.sentinel.config";
202
+ witnesses?: string[] | undefined;
203
+ } & {
204
+ schema: string;
205
+ }, "schema"> & {
206
+ schema: "network.xyo.sentinel.config";
207
+ }, "schema"> & {
208
+ schema: string;
209
+ }, "schema"> & {
210
+ schema: string;
211
+ };
212
+ ephemeralQueryAccountEnabled?: boolean | undefined;
213
+ wallet?: _xyo_network_wallet_model.WalletInstance | undefined;
214
+ }>>;
215
+ static moduleIdentityCheck: _xyo_network_module_model.ModuleTypeCheck<SentinelModule<_xyo_network_core.BaseParamsFields & {
216
+ account?: _xyo_network_account_model.AccountInstance | "random" | undefined;
217
+ config: _xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & {
218
+ accountDerivationPath?: string | undefined;
219
+ readonly archivist?: _xyo_network_module_model.ArchivistModuleConfig | undefined;
220
+ readonly name?: string | undefined;
221
+ readonly paging?: Record<string, {
222
+ size?: number | undefined;
223
+ }> | undefined;
224
+ readonly schema: string;
225
+ readonly security?: {
226
+ readonly allowAnonymous?: boolean | undefined;
227
+ readonly allowed?: Record<string, (string | _xyo_network_module_model.CosigningAddressSet)[]> | undefined;
228
+ readonly disallowed?: Record<string, string[]> | undefined;
229
+ } | undefined;
230
+ readonly sign?: boolean | undefined;
231
+ readonly storeQueries?: boolean | undefined;
232
+ readonly timestamp?: boolean | undefined;
233
+ } & Omit<Omit<_xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & {
234
+ accountDerivationPath?: string | undefined;
235
+ readonly archivist?: _xyo_network_module_model.ArchivistModuleConfig | undefined;
236
+ readonly name?: string | undefined;
237
+ readonly paging?: Record<string, {
238
+ size?: number | undefined;
239
+ }> | undefined;
240
+ readonly schema: "network.xyo.sentinel.config";
241
+ readonly security?: {
242
+ readonly allowAnonymous?: boolean | undefined;
243
+ readonly allowed?: Record<string, (string | _xyo_network_module_model.CosigningAddressSet)[]> | undefined;
244
+ readonly disallowed?: Record<string, string[]> | undefined;
245
+ } | undefined;
246
+ readonly sign?: boolean | undefined;
247
+ readonly storeQueries?: boolean | undefined;
248
+ readonly timestamp?: boolean | undefined;
249
+ } & Omit<_xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & {
250
+ accountDerivationPath?: string | undefined;
251
+ readonly archivist?: _xyo_network_module_model.ArchivistModuleConfig | undefined;
252
+ readonly name?: string | undefined;
253
+ readonly paging?: Record<string, {
254
+ size?: number | undefined;
255
+ }> | undefined;
256
+ readonly schema: string;
257
+ readonly security?: {
258
+ readonly allowAnonymous?: boolean | undefined;
259
+ readonly allowed?: Record<string, (string | _xyo_network_module_model.CosigningAddressSet)[]> | undefined;
260
+ readonly disallowed?: Record<string, string[]> | undefined;
261
+ } | undefined;
262
+ readonly sign?: boolean | undefined;
263
+ readonly storeQueries?: boolean | undefined;
264
+ readonly timestamp?: boolean | undefined;
265
+ } & Omit<{
266
+ archivists?: string[] | undefined;
267
+ schema: string;
268
+ }, "schema"> & {
269
+ schema: string;
270
+ } & {
271
+ schema: "network.xyo.sentinel.config";
272
+ witnesses?: string[] | undefined;
273
+ } & {
274
+ schema: string;
275
+ }, "schema"> & {
276
+ schema: "network.xyo.sentinel.config";
277
+ }, "schema"> & {
278
+ schema: string;
279
+ }, "schema"> & {
280
+ schema: string;
281
+ };
282
+ ephemeralQueryAccountEnabled?: boolean | undefined;
283
+ wallet?: _xyo_network_wallet_model.WalletInstance | undefined;
284
+ }>>;
285
+ static requiredQueries: string[];
286
+ archivists(): Promise<ArchivistInstance[]>;
287
+ report(payloads?: Payload[]): Promise<Payload[]>;
288
+ witnesses(): Promise<WitnessInstance[]>;
289
+ }
290
+
291
+ export { AbstractSentinel, MemorySentinel, MemorySentinelParams, OnSentinelRunnerTriggerResult, SentinelAutomationPayload, SentinelAutomationSchema, SentinelBaseAutomationPayload, SentinelChangeAutomationPayload, SentinelIntervalAutomationPayload, SentinelIntervalAutomationWrapper, SentinelRunner, SentinelWrapper };
@@ -0,0 +1,291 @@
1
+ import * as _xyo_network_wallet_model from '@xyo-network/wallet-model';
2
+ import * as _xyo_network_archivist_model from '@xyo-network/archivist-model';
3
+ import * as _xyo_network_module_model from '@xyo-network/module-model';
4
+ import * as _xyo_network_payload_model from '@xyo-network/payload-model';
5
+ import { Payload } from '@xyo-network/payload-model';
6
+ import * as _xyo_network_account_model from '@xyo-network/account-model';
7
+ import * as _xyo_network_core from '@xyo-network/core';
8
+ import { AnyObject } from '@xyo-network/core';
9
+ import { AbstractArchivingModule, ArchivistInstance } from '@xyo-network/archivist';
10
+ import { QueryBoundWitness } from '@xyo-network/boundwitness-builder';
11
+ import { BoundWitness } from '@xyo-network/boundwitness-model';
12
+ import { ModuleConfig, ModuleQueryHandlerResult, AnyConfigSchema, ModuleWrapper } from '@xyo-network/module';
13
+ import { SentinelParams, SentinelModuleEventData, SentinelInstance, CustomSentinelInstance, SentinelQueryBase, SentinelConfig, SentinelModule } from '@xyo-network/sentinel-model';
14
+ export * from '@xyo-network/sentinel-model';
15
+ import { WitnessInstance } from '@xyo-network/witness';
16
+ import { PayloadWrapper } from '@xyo-network/payload-wrapper';
17
+ import * as _xyo_network_object_identity from '@xyo-network/object-identity';
18
+
19
+ declare abstract class AbstractSentinel<TParams extends SentinelParams = SentinelParams, TEventData extends SentinelModuleEventData<SentinelInstance<TParams>> = SentinelModuleEventData<SentinelInstance<TParams>>> extends AbstractArchivingModule<TParams, TEventData> implements CustomSentinelInstance<TParams, TEventData> {
20
+ history: BoundWitness[];
21
+ get queries(): string[];
22
+ protected get _queryAccountPaths(): Record<SentinelQueryBase['schema'], string>;
23
+ addArchivist(address: string[]): void;
24
+ addWitness(address: string[]): void;
25
+ archivists(): Promise<_xyo_network_archivist_model.ArchivistInstance<_xyo_network_core.BaseParamsFields & {
26
+ account?: _xyo_network_account_model.AccountInstance | "random" | undefined;
27
+ config: _xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & {
28
+ accountDerivationPath?: string | undefined;
29
+ readonly archivist?: _xyo_network_module_model.ArchivistModuleConfig | undefined;
30
+ readonly name?: string | undefined;
31
+ readonly paging?: Record<string, {
32
+ size?: number | undefined;
33
+ }> | undefined;
34
+ readonly schema: string;
35
+ readonly security?: {
36
+ readonly allowAnonymous?: boolean | undefined;
37
+ readonly allowed?: Record<string, (string | _xyo_network_module_model.CosigningAddressSet)[]> | undefined;
38
+ readonly disallowed?: Record<string, string[]> | undefined;
39
+ } | undefined;
40
+ readonly sign?: boolean | undefined;
41
+ readonly storeQueries?: boolean | undefined;
42
+ readonly timestamp?: boolean | undefined;
43
+ } & Omit<Omit<_xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & {
44
+ accountDerivationPath?: string | undefined;
45
+ readonly archivist?: _xyo_network_module_model.ArchivistModuleConfig | undefined;
46
+ readonly name?: string | undefined;
47
+ readonly paging?: Record<string, {
48
+ size?: number | undefined;
49
+ }> | undefined;
50
+ readonly schema: "network.xyo.archivist.config";
51
+ readonly security?: {
52
+ readonly allowAnonymous?: boolean | undefined;
53
+ readonly allowed?: Record<string, (string | _xyo_network_module_model.CosigningAddressSet)[]> | undefined;
54
+ readonly disallowed?: Record<string, string[]> | undefined;
55
+ } | undefined;
56
+ readonly sign?: boolean | undefined;
57
+ readonly storeQueries?: boolean | undefined;
58
+ readonly timestamp?: boolean | undefined;
59
+ } & Omit<{
60
+ parents?: _xyo_network_archivist_model.ArchivistParents | undefined;
61
+ requireAllParents?: boolean | undefined;
62
+ schema: "network.xyo.archivist.config";
63
+ storeParentReads?: boolean | undefined;
64
+ } & Omit<undefined, "schema">, "schema"> & {
65
+ schema: "network.xyo.archivist.config";
66
+ }, "schema"> & {
67
+ schema: string;
68
+ }, "schema"> & {
69
+ schema: string;
70
+ };
71
+ ephemeralQueryAccountEnabled?: boolean | undefined;
72
+ wallet?: _xyo_network_wallet_model.WalletInstance | undefined;
73
+ }, _xyo_network_archivist_model.ArchivistModuleEventData>[]>;
74
+ removeArchivist(address: string[]): void;
75
+ removeWitness(address: string[]): void;
76
+ report(inPayloads?: Payload[]): Promise<Payload[]>;
77
+ witnesses(): Promise<WitnessInstance[]>;
78
+ protected queryHandler<T extends QueryBoundWitness = QueryBoundWitness, TConfig extends ModuleConfig = ModuleConfig>(query: T, payloads?: Payload[], queryConfig?: TConfig): Promise<ModuleQueryHandlerResult>;
79
+ abstract reportHandler(payloads?: Payload[]): Promise<Payload[]>;
80
+ }
81
+
82
+ type SentinelAutomationSchema = 'network.xyo.automation';
83
+ declare const SentinelAutomationSchema: SentinelAutomationSchema;
84
+ type SentinelBaseAutomationPayload<T extends AnyObject = AnyObject> = Payload<T & {
85
+ schema: SentinelAutomationSchema;
86
+ type?: 'interval' | 'change';
87
+ /** @field The list of witnesses to invoke [all if undefined] */
88
+ witnesses?: string[];
89
+ }>;
90
+ type SentinelIntervalAutomationPayload = SentinelBaseAutomationPayload<{
91
+ /** @field epoch after which any reoccurrence stops */
92
+ end?: number;
93
+ /** @field time between triggers [non-repeating if undefined] */
94
+ frequency?: number;
95
+ /** @field units for frequency field [hour if undefined] */
96
+ frequencyUnits?: 'second' | 'minute' | 'hour' | 'day';
97
+ /** @field remaining triggers [infinite if undefined] */
98
+ remaining?: number;
99
+ /** @field epoch of the next trigger */
100
+ start: number;
101
+ type: 'interval';
102
+ }>;
103
+ type SentinelChangeAutomationPayload = SentinelBaseAutomationPayload<{
104
+ type: 'change';
105
+ }>;
106
+ type SentinelAutomationPayload = SentinelIntervalAutomationPayload | SentinelChangeAutomationPayload;
107
+
108
+ type MemorySentinelParams<TConfig extends AnyConfigSchema<SentinelConfig> = AnyConfigSchema<SentinelConfig>> = SentinelParams<AnyConfigSchema<TConfig>>;
109
+ declare class MemorySentinel<TParams extends MemorySentinelParams = MemorySentinelParams, TEventData extends SentinelModuleEventData<SentinelInstance<TParams>> = SentinelModuleEventData<SentinelInstance<TParams>>> extends AbstractSentinel<TParams, TEventData> {
110
+ static configSchemas: "network.xyo.sentinel.config"[];
111
+ reportHandler(payloads?: Payload[]): Promise<Payload[]>;
112
+ private generateResults;
113
+ }
114
+
115
+ declare class SentinelIntervalAutomationWrapper<T extends SentinelIntervalAutomationPayload = SentinelIntervalAutomationPayload> extends PayloadWrapper<T> {
116
+ constructor(payload: T);
117
+ protected get frequencyMillis(): number;
118
+ protected get remaining(): number;
119
+ next(): this;
120
+ protected checkEnd(): void;
121
+ protected consumeRemaining(count?: number): void;
122
+ }
123
+
124
+ type OnSentinelRunnerTriggerResult = (result: Payload[]) => void;
125
+ declare class SentinelRunner {
126
+ protected _automations: Record<string, SentinelAutomationPayload>;
127
+ protected onTriggerResult: OnSentinelRunnerTriggerResult | undefined;
128
+ protected sentinel: SentinelInstance;
129
+ protected timeoutId?: NodeJS.Timeout | string | number;
130
+ constructor(sentinel: SentinelInstance, automations?: SentinelAutomationPayload[], onTriggerResult?: OnSentinelRunnerTriggerResult);
131
+ get automations(): Record<string, SentinelAutomationPayload>;
132
+ private get next();
133
+ add(automation: SentinelAutomationPayload, restart?: boolean): Promise<string>;
134
+ find(hash: string): void;
135
+ remove(hash: string, restart?: boolean): Promise<void>;
136
+ removeAll(): void;
137
+ restart(): Promise<void>;
138
+ start(): Promise<void>;
139
+ stop(): void;
140
+ update(hash: string, automation: SentinelAutomationPayload, restart?: boolean): Promise<void>;
141
+ private trigger;
142
+ }
143
+
144
+ declare class SentinelWrapper<TModule extends SentinelModule = SentinelModule> extends ModuleWrapper<TModule> implements SentinelInstance<TModule['params']> {
145
+ static instanceIdentityCheck: _xyo_network_object_identity.ObjectTypeCheck<SentinelInstance<_xyo_network_core.BaseParamsFields & {
146
+ account?: _xyo_network_account_model.AccountInstance | "random" | undefined;
147
+ config: _xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & {
148
+ accountDerivationPath?: string | undefined;
149
+ readonly archivist?: _xyo_network_module_model.ArchivistModuleConfig | undefined;
150
+ readonly name?: string | undefined;
151
+ readonly paging?: Record<string, {
152
+ size?: number | undefined;
153
+ }> | undefined;
154
+ readonly schema: string;
155
+ readonly security?: {
156
+ readonly allowAnonymous?: boolean | undefined;
157
+ readonly allowed?: Record<string, (string | _xyo_network_module_model.CosigningAddressSet)[]> | undefined;
158
+ readonly disallowed?: Record<string, string[]> | undefined;
159
+ } | undefined;
160
+ readonly sign?: boolean | undefined;
161
+ readonly storeQueries?: boolean | undefined;
162
+ readonly timestamp?: boolean | undefined;
163
+ } & Omit<Omit<_xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & {
164
+ accountDerivationPath?: string | undefined;
165
+ readonly archivist?: _xyo_network_module_model.ArchivistModuleConfig | undefined;
166
+ readonly name?: string | undefined;
167
+ readonly paging?: Record<string, {
168
+ size?: number | undefined;
169
+ }> | undefined;
170
+ readonly schema: "network.xyo.sentinel.config";
171
+ readonly security?: {
172
+ readonly allowAnonymous?: boolean | undefined;
173
+ readonly allowed?: Record<string, (string | _xyo_network_module_model.CosigningAddressSet)[]> | undefined;
174
+ readonly disallowed?: Record<string, string[]> | undefined;
175
+ } | undefined;
176
+ readonly sign?: boolean | undefined;
177
+ readonly storeQueries?: boolean | undefined;
178
+ readonly timestamp?: boolean | undefined;
179
+ } & Omit<_xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & {
180
+ accountDerivationPath?: string | undefined;
181
+ readonly archivist?: _xyo_network_module_model.ArchivistModuleConfig | undefined;
182
+ readonly name?: string | undefined;
183
+ readonly paging?: Record<string, {
184
+ size?: number | undefined;
185
+ }> | undefined;
186
+ readonly schema: string;
187
+ readonly security?: {
188
+ readonly allowAnonymous?: boolean | undefined;
189
+ readonly allowed?: Record<string, (string | _xyo_network_module_model.CosigningAddressSet)[]> | undefined;
190
+ readonly disallowed?: Record<string, string[]> | undefined;
191
+ } | undefined;
192
+ readonly sign?: boolean | undefined;
193
+ readonly storeQueries?: boolean | undefined;
194
+ readonly timestamp?: boolean | undefined;
195
+ } & Omit<{
196
+ archivists?: string[] | undefined;
197
+ schema: string;
198
+ }, "schema"> & {
199
+ schema: string;
200
+ } & {
201
+ schema: "network.xyo.sentinel.config";
202
+ witnesses?: string[] | undefined;
203
+ } & {
204
+ schema: string;
205
+ }, "schema"> & {
206
+ schema: "network.xyo.sentinel.config";
207
+ }, "schema"> & {
208
+ schema: string;
209
+ }, "schema"> & {
210
+ schema: string;
211
+ };
212
+ ephemeralQueryAccountEnabled?: boolean | undefined;
213
+ wallet?: _xyo_network_wallet_model.WalletInstance | undefined;
214
+ }>>;
215
+ static moduleIdentityCheck: _xyo_network_module_model.ModuleTypeCheck<SentinelModule<_xyo_network_core.BaseParamsFields & {
216
+ account?: _xyo_network_account_model.AccountInstance | "random" | undefined;
217
+ config: _xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & {
218
+ accountDerivationPath?: string | undefined;
219
+ readonly archivist?: _xyo_network_module_model.ArchivistModuleConfig | undefined;
220
+ readonly name?: string | undefined;
221
+ readonly paging?: Record<string, {
222
+ size?: number | undefined;
223
+ }> | undefined;
224
+ readonly schema: string;
225
+ readonly security?: {
226
+ readonly allowAnonymous?: boolean | undefined;
227
+ readonly allowed?: Record<string, (string | _xyo_network_module_model.CosigningAddressSet)[]> | undefined;
228
+ readonly disallowed?: Record<string, string[]> | undefined;
229
+ } | undefined;
230
+ readonly sign?: boolean | undefined;
231
+ readonly storeQueries?: boolean | undefined;
232
+ readonly timestamp?: boolean | undefined;
233
+ } & Omit<Omit<_xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & {
234
+ accountDerivationPath?: string | undefined;
235
+ readonly archivist?: _xyo_network_module_model.ArchivistModuleConfig | undefined;
236
+ readonly name?: string | undefined;
237
+ readonly paging?: Record<string, {
238
+ size?: number | undefined;
239
+ }> | undefined;
240
+ readonly schema: "network.xyo.sentinel.config";
241
+ readonly security?: {
242
+ readonly allowAnonymous?: boolean | undefined;
243
+ readonly allowed?: Record<string, (string | _xyo_network_module_model.CosigningAddressSet)[]> | undefined;
244
+ readonly disallowed?: Record<string, string[]> | undefined;
245
+ } | undefined;
246
+ readonly sign?: boolean | undefined;
247
+ readonly storeQueries?: boolean | undefined;
248
+ readonly timestamp?: boolean | undefined;
249
+ } & Omit<_xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & {
250
+ accountDerivationPath?: string | undefined;
251
+ readonly archivist?: _xyo_network_module_model.ArchivistModuleConfig | undefined;
252
+ readonly name?: string | undefined;
253
+ readonly paging?: Record<string, {
254
+ size?: number | undefined;
255
+ }> | undefined;
256
+ readonly schema: string;
257
+ readonly security?: {
258
+ readonly allowAnonymous?: boolean | undefined;
259
+ readonly allowed?: Record<string, (string | _xyo_network_module_model.CosigningAddressSet)[]> | undefined;
260
+ readonly disallowed?: Record<string, string[]> | undefined;
261
+ } | undefined;
262
+ readonly sign?: boolean | undefined;
263
+ readonly storeQueries?: boolean | undefined;
264
+ readonly timestamp?: boolean | undefined;
265
+ } & Omit<{
266
+ archivists?: string[] | undefined;
267
+ schema: string;
268
+ }, "schema"> & {
269
+ schema: string;
270
+ } & {
271
+ schema: "network.xyo.sentinel.config";
272
+ witnesses?: string[] | undefined;
273
+ } & {
274
+ schema: string;
275
+ }, "schema"> & {
276
+ schema: "network.xyo.sentinel.config";
277
+ }, "schema"> & {
278
+ schema: string;
279
+ }, "schema"> & {
280
+ schema: string;
281
+ };
282
+ ephemeralQueryAccountEnabled?: boolean | undefined;
283
+ wallet?: _xyo_network_wallet_model.WalletInstance | undefined;
284
+ }>>;
285
+ static requiredQueries: string[];
286
+ archivists(): Promise<ArchivistInstance[]>;
287
+ report(payloads?: Payload[]): Promise<Payload[]>;
288
+ witnesses(): Promise<WitnessInstance[]>;
289
+ }
290
+
291
+ export { AbstractSentinel, MemorySentinel, MemorySentinelParams, OnSentinelRunnerTriggerResult, SentinelAutomationPayload, SentinelAutomationSchema, SentinelBaseAutomationPayload, SentinelChangeAutomationPayload, SentinelIntervalAutomationPayload, SentinelIntervalAutomationWrapper, SentinelRunner, SentinelWrapper };