@xyo-network/sentinel-memory 7.0.9 → 7.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,2 @@
1
- export * from './MemorySentinel.ts';
2
- export * from './SentinelIntervalAutomationWrapper.ts';
3
- export * from './SentinelRunner.ts';
1
+ export * from '@xyo-network/sdk/sentinel-memory';
4
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA;AACnC,cAAc,wCAAwC,CAAA;AACtD,cAAc,qBAAqB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,cAAc,kCAAkC,CAAA"}
@@ -1,325 +1,3 @@
1
- // src/MemorySentinel.ts
2
- import { fulfilled, rejected } from "@ariestools/sdk";
3
- import { asDivinerInstance } from "@xyo-network/diviner-model";
4
- import { AbstractSentinel } from "@xyo-network/sentinel-abstract";
5
- import {
6
- asSentinelInstance,
7
- SentinelConfigSchema
8
- } from "@xyo-network/sentinel-model";
9
- import { asWitnessInstance } from "@xyo-network/witness-model";
10
-
11
- // src/SentinelRunner.ts
12
- import {
13
- assertEx,
14
- Base,
15
- forget,
16
- isDefined,
17
- spanRootAsync
18
- } from "@ariestools/sdk";
19
- import { PayloadBuilder } from "@xyo-network/sdk-protocol";
20
- import { isSentinelIntervalAutomation } from "@xyo-network/sentinel-model";
21
-
22
- // src/SentinelIntervalAutomationWrapper.ts
23
- import { PayloadWrapper } from "@xyo-network/sdk-protocol";
24
- var SentinelIntervalAutomationWrapper = class extends PayloadWrapper {
25
- constructor(payload) {
26
- super(payload);
27
- }
28
- get frequencyMillis() {
29
- const frequency = this.payload.frequency;
30
- if (frequency === void 0) return Number.POSITIVE_INFINITY;
31
- const frequencyUnits = this.payload.frequencyUnits;
32
- switch (frequencyUnits ?? "hour") {
33
- case "millis": {
34
- return frequency;
35
- }
36
- case "second": {
37
- return frequency * 1e3;
38
- }
39
- case "minute": {
40
- return frequency * 60 * 1e3;
41
- }
42
- case "hour": {
43
- return frequency * 60 * 60 * 1e3;
44
- }
45
- case "day": {
46
- return frequency * 24 * 60 * 60 * 1e3;
47
- }
48
- default: {
49
- return Number.POSITIVE_INFINITY;
50
- }
51
- }
52
- }
53
- get remaining() {
54
- return this.payload.remaining ?? Number.POSITIVE_INFINITY;
55
- }
56
- next() {
57
- const now = Date.now();
58
- const previousStart = this.payload?.start ?? now;
59
- const start = Math.max(previousStart, now);
60
- const nextStart = start + this.frequencyMillis;
61
- this.setStart(nextStart);
62
- this.consumeRemaining();
63
- this.checkEnd();
64
- return this;
65
- }
66
- checkEnd() {
67
- if ((this.payload.start ?? 0) > (this.payload.end ?? Number.POSITIVE_INFINITY)) {
68
- this.setStart(Number.POSITIVE_INFINITY);
69
- }
70
- }
71
- consumeRemaining(count = 1) {
72
- const remaining = Math.max(this.remaining - count, 0);
73
- this.setRemaining(remaining);
74
- if (remaining <= 0) this.setStart(Number.POSITIVE_INFINITY);
75
- }
76
- /**
77
- * Sets the remaining of the wrapped automation
78
- * @param remaining The remaining time in milliseconds
79
- */
80
- setRemaining(remaining) {
81
- this.payload.remaining = remaining;
82
- }
83
- /**
84
- * Sets the start of the wrapped automation
85
- * @param start The start time in milliseconds
86
- */
87
- setStart(start) {
88
- this.payload.start = start;
89
- }
90
- };
91
-
92
- // src/SentinelRunner.ts
93
- var SentinelRunner = class extends Base {
94
- _automations = {};
95
- onTriggerResult;
96
- sentinel;
97
- timeoutId;
98
- constructor(params) {
99
- super(params);
100
- this.sentinel = params.sentinel;
101
- this.onTriggerResult = params.onTriggerResult;
102
- if (params.automations) for (const automation of params.automations) forget(this.add(automation));
103
- }
104
- get automations() {
105
- return this._automations;
106
- }
107
- get next() {
108
- return Object.values(this._automations).reduce((previous, current) => {
109
- if (isSentinelIntervalAutomation(current) && isSentinelIntervalAutomation(previous)) {
110
- return (current.start ?? Number.POSITIVE_INFINITY) < (previous?.start ?? Number.POSITIVE_INFINITY) ? current : previous;
111
- }
112
- return current;
113
- }, void 0);
114
- }
115
- async add(automation, restart = true) {
116
- const hash = await PayloadBuilder.dataHash(automation);
117
- this._automations[hash] = automation;
118
- if (restart) this.restart();
119
- return hash;
120
- }
121
- find(hash) {
122
- return Object.entries(this._automations).find(([key]) => key === hash);
123
- }
124
- remove(hash, restart = true) {
125
- delete this._automations[hash];
126
- if (restart) this.restart();
127
- }
128
- removeAll() {
129
- this.stop();
130
- this._automations = {};
131
- }
132
- restart() {
133
- this.stop();
134
- this.start();
135
- }
136
- start() {
137
- this.startHandler();
138
- }
139
- startHandler() {
140
- assertEx(this.timeoutId === void 0, () => "Already started");
141
- const automation = this.next;
142
- if (isSentinelIntervalAutomation(automation)) {
143
- const now = Date.now();
144
- const start = Math.max(automation.start ?? now, now);
145
- const delay = Math.max(start - now, 0);
146
- if (delay < Number.POSITIVE_INFINITY) {
147
- this.timeoutId = setTimeout(async () => {
148
- this.timeoutId = void 0;
149
- return await spanRootAsync("start.setTimeout", async () => {
150
- try {
151
- await this.trigger(automation);
152
- this.stop();
153
- } catch (ex) {
154
- this.logger?.error("Error running automation", { error: ex });
155
- this.stop();
156
- } finally {
157
- this.start();
158
- }
159
- }, { tracer: this.tracer });
160
- }, delay);
161
- }
162
- }
163
- }
164
- stop() {
165
- if (isDefined(this.timeoutId)) {
166
- clearTimeout(this.timeoutId);
167
- this.timeoutId = void 0;
168
- }
169
- }
170
- async update(hash, automation, restart = true) {
171
- this.remove(hash, false);
172
- await this.add(automation, false);
173
- if (restart) this.restart();
174
- }
175
- async trigger(automation) {
176
- return await spanRootAsync("trigger", async () => {
177
- const wrapper = new SentinelIntervalAutomationWrapper(automation);
178
- this.remove(await wrapper.dataHash(), false);
179
- wrapper.next();
180
- await this.add(wrapper.payload, false);
181
- const triggerResult = await this.sentinel.report();
182
- this.onTriggerResult?.(triggerResult);
183
- }, { tracer: this.tracer });
184
- }
185
- };
186
-
187
- // src/MemorySentinel.ts
188
- var MemorySentinel = class extends AbstractSentinel {
189
- static configSchemas = [...super.configSchemas, SentinelConfigSchema];
190
- static defaultConfigSchema = SentinelConfigSchema;
191
- runner;
192
- async reportHandler(inPayloads = []) {
193
- await this.startedAsync("throw");
194
- this.logger?.debug(`reportHandler:in: ${JSON.stringify(inPayloads)}`);
195
- const job = await this.jobPromise;
196
- let index = 0;
197
- let previousResults = {};
198
- while (index < job.tasks.length) {
199
- const generatedPayloads = await this.runJob(job.tasks[index], previousResults, inPayloads);
200
- previousResults = generatedPayloads;
201
- index++;
202
- }
203
- const result = Object.values(previousResults).flat();
204
- this.logger?.debug(`reportHandler:out: ${JSON.stringify(result)}`);
205
- return result;
206
- }
207
- async startHandler() {
208
- await super.startHandler();
209
- if ((this.config.automations?.length ?? 0) > 0) {
210
- this.runner = new SentinelRunner({
211
- sentinel: this,
212
- automations: this.config.automations,
213
- traceProvider: this.params.traceProvider
214
- });
215
- this.runner.start();
216
- }
217
- }
218
- async stopHandler() {
219
- if (this.runner) {
220
- this.runner.stop();
221
- this.runner = void 0;
222
- }
223
- await super.stopHandler();
224
- }
225
- async inputAddresses(input) {
226
- if (Array.isArray(input)) {
227
- return (await Promise.all(input.map(async (inputItem) => await this.inputAddresses(inputItem)))).flat();
228
- } else {
229
- const resolved = await this.resolve(input);
230
- return resolved ? [resolved.address] : [];
231
- }
232
- }
233
- processPreviousResults(payloads, inputs) {
234
- return inputs.flatMap((input) => payloads[input] ?? []);
235
- }
236
- async runJob(tasks, previousResults, inPayloads) {
237
- await this.emit("jobStart", { inPayloads, mod: this });
238
- this.logger?.debug(`runJob:tasks: ${JSON.stringify(tasks.length)}`);
239
- this.logger?.debug(`runJob:previous: ${JSON.stringify(previousResults)}`);
240
- this.logger?.debug(`runJob:in: ${JSON.stringify(inPayloads)}`);
241
- const results = await Promise.allSettled(
242
- tasks?.map(async (task) => {
243
- const input = task.input ?? false;
244
- const inPayloadsFound = input === true ? inPayloads : input === false ? [] : this.processPreviousResults(previousResults, await this.inputAddresses(input));
245
- const witness = asWitnessInstance(task.mod);
246
- if (witness) {
247
- await this.emit("taskStart", {
248
- address: witness.address,
249
- inPayloads: inPayloadsFound,
250
- mod: this
251
- });
252
- const observed = await witness.observe(inPayloadsFound);
253
- this.logger?.debug(`observed [${witness.id}]: ${JSON.stringify(observed)}`);
254
- await this.emit("taskEnd", {
255
- address: witness.address,
256
- inPayloads: inPayloadsFound,
257
- mod: this,
258
- outPayloads: observed
259
- });
260
- return [witness.address, observed];
261
- }
262
- const diviner = asDivinerInstance(task.mod);
263
- if (diviner) {
264
- await this.emit("taskStart", {
265
- address: diviner.address,
266
- inPayloads: inPayloadsFound,
267
- mod: this
268
- });
269
- const divined = await diviner.divine(inPayloadsFound);
270
- this.logger?.debug(`divined [${diviner.id}]: ${JSON.stringify(divined)}`);
271
- await this.emit("taskEnd", {
272
- address: diviner.address,
273
- inPayloads: inPayloadsFound,
274
- mod: this,
275
- outPayloads: divined
276
- });
277
- return [diviner.address, divined];
278
- }
279
- const sentinel = asSentinelInstance(task.mod);
280
- if (sentinel) {
281
- await this.emit("taskStart", {
282
- address: sentinel.address,
283
- inPayloads: inPayloadsFound,
284
- mod: this
285
- });
286
- const reported = await sentinel.report(inPayloadsFound);
287
- this.logger?.debug(`reported [${sentinel.id}]: ${JSON.stringify(reported)}`);
288
- await this.emit("taskEnd", {
289
- address: sentinel.address,
290
- inPayloads: inPayloadsFound,
291
- mod: this,
292
- outPayloads: reported
293
- });
294
- return [sentinel.address, reported];
295
- }
296
- throw new Error("Unsupported module type");
297
- })
298
- );
299
- const finalResult = {};
300
- for (const result of results.filter(fulfilled)) {
301
- const [address, payloads] = result.value;
302
- finalResult[address] = finalResult[address] ?? [];
303
- finalResult[address].push(...payloads);
304
- }
305
- if (this.throwErrors) {
306
- const errors = results.filter(rejected).map((result) => result.reason);
307
- if (errors.length > 0) {
308
- throw new Error("At least one module failed");
309
- }
310
- }
311
- this.logger?.debug(`generateResults:out: ${JSON.stringify(finalResult)}`);
312
- await this.emit("jobEnd", {
313
- finalResult,
314
- inPayloads,
315
- mod: this
316
- });
317
- return finalResult;
318
- }
319
- };
320
- export {
321
- MemorySentinel,
322
- SentinelIntervalAutomationWrapper,
323
- SentinelRunner
324
- };
1
+ // src/index.ts
2
+ export * from "@xyo-network/sdk/sentinel-memory";
325
3
  //# sourceMappingURL=index.mjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../src/MemorySentinel.ts", "../../src/SentinelRunner.ts", "../../src/SentinelIntervalAutomationWrapper.ts"],
4
- "sourcesContent": ["import { fulfilled, rejected } from '@ariestools/sdk'\nimport { asDivinerInstance } from '@xyo-network/diviner-model'\nimport { type AnyConfigSchema, type ModuleIdentifier } from '@xyo-network/module-model'\nimport type {\n Payload, Schema, XyoAddress,\n} from '@xyo-network/sdk-protocol'\nimport { AbstractSentinel } from '@xyo-network/sentinel-abstract'\nimport type {\n ResolvedTask,\n SentinelConfig,\n SentinelInstance,\n SentinelModuleEventData,\n SentinelParams,\n} from '@xyo-network/sentinel-model'\nimport {\n asSentinelInstance,\n SentinelConfigSchema,\n} from '@xyo-network/sentinel-model'\nimport { asWitnessInstance } from '@xyo-network/witness-model'\n\nimport { SentinelRunner } from './SentinelRunner.ts'\n\nexport type MemorySentinelParams<TConfig extends AnyConfigSchema<SentinelConfig> = AnyConfigSchema<SentinelConfig>> = SentinelParams<TConfig>\n\nexport class MemorySentinel<\n TParams extends MemorySentinelParams = MemorySentinelParams,\n TEventData extends SentinelModuleEventData<SentinelInstance<TParams>> = SentinelModuleEventData<SentinelInstance<TParams>>,\n> extends AbstractSentinel<TParams, TEventData> {\n static override readonly configSchemas: Schema[] = [...super.configSchemas, SentinelConfigSchema]\n static override readonly defaultConfigSchema: Schema = SentinelConfigSchema\n\n private runner?: SentinelRunner\n\n async reportHandler(inPayloads: Payload[] = []): Promise<Payload[]> {\n await this.startedAsync('throw')\n this.logger?.debug(`reportHandler:in: ${JSON.stringify(inPayloads)}`)\n const job = await this.jobPromise\n\n let index = 0\n let previousResults: Record<XyoAddress, Payload[]> = {}\n while (index < job.tasks.length) {\n const generatedPayloads = await this.runJob(job.tasks[index], previousResults, inPayloads)\n previousResults = generatedPayloads\n index++\n }\n const result = Object.values(previousResults).flat()\n this.logger?.debug(`reportHandler:out: ${JSON.stringify(result)}`)\n return result\n }\n\n override async startHandler(): Promise<void> {\n await super.startHandler()\n if ((this.config.automations?.length ?? 0) > 0) {\n this.runner = new SentinelRunner({\n sentinel: this, automations: this.config.automations, traceProvider: this.params.traceProvider,\n })\n this.runner.start()\n }\n }\n\n override async stopHandler(): Promise<void> {\n if (this.runner) {\n this.runner.stop()\n this.runner = undefined\n }\n await super.stopHandler()\n }\n\n private async inputAddresses(input: ModuleIdentifier | ModuleIdentifier[]): Promise<XyoAddress[]> {\n if (Array.isArray(input)) {\n return (await Promise.all(input.map(async inputItem => await this.inputAddresses(inputItem)))).flat()\n } else {\n const resolved = await this.resolve(input)\n return resolved ? [resolved.address] : []\n }\n }\n\n private processPreviousResults(payloads: Record<string, Payload[]>, inputs: string[]) {\n return inputs.flatMap(input => payloads[input] ?? [])\n }\n\n private async runJob(\n tasks: ResolvedTask[],\n previousResults: Record<XyoAddress, Payload[]>,\n inPayloads?: Payload[],\n ): Promise<Record<XyoAddress, Payload[]>> {\n await this.emit('jobStart', { inPayloads, mod: this })\n this.logger?.debug(`runJob:tasks: ${JSON.stringify(tasks.length)}`)\n this.logger?.debug(`runJob:previous: ${JSON.stringify(previousResults)}`)\n this.logger?.debug(`runJob:in: ${JSON.stringify(inPayloads)}`)\n const results: PromiseSettledResult<[XyoAddress, Payload[]]>[] = await Promise.allSettled(\n tasks?.map(async (task) => {\n const input = task.input ?? false\n const inPayloadsFound\n = input === true\n ? inPayloads\n : input === false\n ? []\n : this.processPreviousResults(previousResults, await this.inputAddresses(input))\n const witness = asWitnessInstance(task.mod)\n if (witness) {\n await this.emit('taskStart', {\n address: witness.address, inPayloads: inPayloadsFound, mod: this,\n })\n const observed = await witness.observe(inPayloadsFound)\n this.logger?.debug(`observed [${witness.id}]: ${JSON.stringify(observed)}`)\n await this.emit('taskEnd', {\n address: witness.address, inPayloads: inPayloadsFound, mod: this, outPayloads: observed,\n })\n return [witness.address, observed]\n }\n const diviner = asDivinerInstance(task.mod)\n if (diviner) {\n await this.emit('taskStart', {\n address: diviner.address, inPayloads: inPayloadsFound, mod: this,\n })\n const divined = await diviner.divine(inPayloadsFound)\n this.logger?.debug(`divined [${diviner.id}]: ${JSON.stringify(divined)}`)\n await this.emit('taskEnd', {\n address: diviner.address, inPayloads: inPayloadsFound, mod: this, outPayloads: divined,\n })\n return [diviner.address, divined]\n }\n const sentinel = asSentinelInstance(task.mod)\n if (sentinel) {\n await this.emit('taskStart', {\n address: sentinel.address, inPayloads: inPayloadsFound, mod: this,\n })\n const reported = await sentinel.report(inPayloadsFound)\n this.logger?.debug(`reported [${sentinel.id}]: ${JSON.stringify(reported)}`)\n await this.emit('taskEnd', {\n address: sentinel.address, inPayloads: inPayloadsFound, mod: this, outPayloads: reported,\n })\n return [sentinel.address, reported]\n }\n throw new Error('Unsupported module type')\n }),\n )\n const finalResult: Record<XyoAddress, Payload[]> = {}\n for (const result of results.filter(fulfilled)) {\n const [address, payloads] = result.value\n finalResult[address] = finalResult[address] ?? []\n finalResult[address].push(...payloads)\n }\n if (this.throwErrors) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n const errors = results.filter(rejected).map(result => result.reason)\n if (errors.length > 0) {\n throw new Error('At least one module failed')\n }\n }\n this.logger?.debug(`generateResults:out: ${JSON.stringify(finalResult)}`)\n await this.emit('jobEnd', {\n finalResult, inPayloads, mod: this,\n })\n return finalResult\n }\n}\n", "import type { BaseParams, BrandedHash } from '@ariestools/sdk'\nimport {\n assertEx, Base, forget,\n isDefined, spanRootAsync,\n} from '@ariestools/sdk'\nimport type { Payload } from '@xyo-network/sdk-protocol'\nimport { PayloadBuilder } from '@xyo-network/sdk-protocol'\nimport type {\n SentinelAutomationPayload,\n SentinelInstance,\n SentinelIntervalAutomationPayload,\n} from '@xyo-network/sentinel-model'\nimport { isSentinelIntervalAutomation } from '@xyo-network/sentinel-model'\n\nimport { SentinelIntervalAutomationWrapper } from './SentinelIntervalAutomationWrapper.ts'\n\nexport type OnSentinelRunnerTriggerResult = (result: Payload[]) => void\n\nexport interface SentinelRunnerParams extends BaseParams {\n automations?: SentinelAutomationPayload[]\n onTriggerResult?: OnSentinelRunnerTriggerResult\n sentinel: SentinelInstance\n}\n\nexport class SentinelRunner extends Base {\n protected _automations: Record<string, SentinelAutomationPayload> = {}\n protected onTriggerResult: OnSentinelRunnerTriggerResult | undefined\n protected sentinel: SentinelInstance\n protected timeoutId?: ReturnType<typeof setTimeout> | string | number\n\n constructor(params: SentinelRunnerParams) {\n super(params)\n this.sentinel = params.sentinel\n this.onTriggerResult = params.onTriggerResult\n\n if (params.automations) for (const automation of params.automations) forget(this.add(automation))\n }\n\n get automations(): Record<string, SentinelAutomationPayload> {\n return this._automations\n }\n\n private get next() {\n return Object.values(this._automations).reduce<SentinelAutomationPayload | undefined>((previous, current) => {\n if (isSentinelIntervalAutomation(current) && isSentinelIntervalAutomation(previous)) {\n return (current.start ?? Number.POSITIVE_INFINITY) < (previous?.start ?? Number.POSITIVE_INFINITY) ? current : previous\n }\n return current\n }, undefined)\n }\n\n async add(automation: SentinelAutomationPayload, restart = true): Promise<BrandedHash> {\n const hash = await PayloadBuilder.dataHash(automation)\n this._automations[hash] = automation\n if (restart) this.restart()\n return hash\n }\n\n find(hash: string): [string, SentinelAutomationPayload] | undefined {\n return Object.entries(this._automations).find(([key]) => key === hash)\n }\n\n remove(hash: string, restart = true): void {\n delete this._automations[hash]\n if (restart) this.restart()\n }\n\n removeAll(): void {\n this.stop()\n this._automations = {}\n }\n\n restart(): void {\n this.stop()\n this.start()\n }\n\n start(): void {\n this.startHandler()\n }\n\n startHandler(): void {\n assertEx(this.timeoutId === undefined, () => 'Already started')\n const automation = this.next\n if (isSentinelIntervalAutomation(automation)) {\n const now = Date.now()\n const start = Math.max(automation.start ?? now, now)\n const delay = Math.max(start - now, 0)\n if (delay < Number.POSITIVE_INFINITY) {\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n this.timeoutId = setTimeout(async () => {\n this.timeoutId = undefined\n return await spanRootAsync('start.setTimeout', async () => {\n try {\n // Run the automation\n await this.trigger(automation)\n this.stop()\n } catch (ex) {\n this.logger?.error('Error running automation', { error: ex })\n this.stop()\n } finally {\n // No matter what start the next automation\n this.start()\n }\n }, { tracer: this.tracer })\n }, delay)\n }\n }\n }\n\n stop(): void {\n if (isDefined(this.timeoutId)) {\n clearTimeout(this.timeoutId)\n this.timeoutId = undefined\n }\n }\n\n async update(hash: string, automation: SentinelAutomationPayload, restart = true): Promise<void> {\n this.remove(hash, false)\n await this.add(automation, false)\n if (restart) this.restart()\n }\n\n private async trigger(automation: SentinelIntervalAutomationPayload) {\n return await spanRootAsync('trigger', async () => {\n const wrapper = new SentinelIntervalAutomationWrapper(automation)\n this.remove(await wrapper.dataHash(), false)\n wrapper.next()\n await this.add(wrapper.payload, false)\n const triggerResult = await this.sentinel.report()\n this.onTriggerResult?.(triggerResult)\n }, { tracer: this.tracer })\n }\n}\n", "import { PayloadWrapper } from '@xyo-network/sdk-protocol'\nimport type { SentinelIntervalAutomationPayload } from '@xyo-network/sentinel-model'\n\nexport class SentinelIntervalAutomationWrapper<\n T extends SentinelIntervalAutomationPayload = SentinelIntervalAutomationPayload,\n> extends PayloadWrapper<T> {\n constructor(payload: T) {\n super(payload)\n }\n\n protected get frequencyMillis(): number {\n const frequency = this.payload.frequency\n if (frequency === undefined) return Number.POSITIVE_INFINITY\n const frequencyUnits = this.payload.frequencyUnits\n switch (frequencyUnits ?? 'hour') {\n case 'millis': {\n return frequency\n }\n case 'second': {\n return frequency * 1000\n }\n case 'minute': {\n return frequency * 60 * 1000\n }\n case 'hour': {\n return frequency * 60 * 60 * 1000\n }\n case 'day': {\n return frequency * 24 * 60 * 60 * 1000\n }\n default: {\n return Number.POSITIVE_INFINITY\n }\n }\n }\n\n protected get remaining(): number {\n return this.payload.remaining ?? Number.POSITIVE_INFINITY\n }\n\n next(): this {\n const now = Date.now()\n const previousStart = this.payload?.start ?? now\n const start = Math.max(previousStart, now)\n const nextStart = start + this.frequencyMillis\n this.setStart(nextStart)\n this.consumeRemaining()\n this.checkEnd()\n return this\n }\n\n protected checkEnd(): void {\n if ((this.payload.start ?? 0) > (this.payload.end ?? Number.POSITIVE_INFINITY)) {\n this.setStart(Number.POSITIVE_INFINITY)\n }\n }\n\n protected consumeRemaining(count = 1): void {\n const remaining = Math.max(this.remaining - count, 0)\n this.setRemaining(remaining)\n if (remaining <= 0) this.setStart(Number.POSITIVE_INFINITY)\n }\n\n /**\n * Sets the remaining of the wrapped automation\n * @param remaining The remaining time in milliseconds\n */\n protected setRemaining(remaining: number): void {\n this.payload.remaining = remaining\n }\n\n /**\n * Sets the start of the wrapped automation\n * @param start The start time in milliseconds\n */\n protected setStart(start: number): void {\n this.payload.start = start\n }\n}\n"],
5
- "mappings": ";AAAA,SAAS,WAAW,gBAAgB;AACpC,SAAS,yBAAyB;AAKlC,SAAS,wBAAwB;AAQjC;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,yBAAyB;;;ACjBlC;AAAA,EACE;AAAA,EAAU;AAAA,EAAM;AAAA,EAChB;AAAA,EAAW;AAAA,OACN;AAEP,SAAS,sBAAsB;AAM/B,SAAS,oCAAoC;;;ACZ7C,SAAS,sBAAsB;AAGxB,IAAM,oCAAN,cAEG,eAAkB;AAAA,EAC1B,YAAY,SAAY;AACtB,UAAM,OAAO;AAAA,EACf;AAAA,EAEA,IAAc,kBAA0B;AACtC,UAAM,YAAY,KAAK,QAAQ;AAC/B,QAAI,cAAc,OAAW,QAAO,OAAO;AAC3C,UAAM,iBAAiB,KAAK,QA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AC;AAChD,kBAAY,OAAO,EAAE,KAAK,GAAG,QAAQ;AAAA,IACvC;AACA,QAAI,KAAK,aAAa;AAEpB,YAAM,SAAS,QAAQ,OAAO,QAAQ,EAAE,IAAI,YAAU,OAAO,MAAM;AACnE,UAAI,OAAO,SAAS,GAAG;AACrB,cAAM,IAAI,MAAM,4BAA4B;AAAA,MAC9C;AAAA,IACF;AACA,SAAK,QAAQ,MAAM,wBAAwB,KAAK,UAAU,WAAW,CAAC,EAAE;AACxE,UAAM,KAAK,KAAK,UAAU;AAAA,MACxB;AAAA,MAAa;AAAA,MAAY,KAAK;AAAA,IAChC,CAAC;AACD,WAAO;AAAA,EACT;AACF;",
3
+ "sources": ["../../src/index.ts"],
4
+ "sourcesContent": ["// Compatibility shim: this package re-exports from @xyo-network/sdk.\nexport * from '@xyo-network/sdk/sentinel-memory'\n"],
5
+ "mappings": ";AACA,cAAc;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xyo-network/sentinel-memory",
3
- "version": "7.0.9",
3
+ "version": "7.0.10",
4
4
  "description": "Primary SDK for using XYO Protocol 2.0",
5
5
  "homepage": "https://xyo.network",
6
6
  "bugs": {
@@ -34,16 +34,11 @@
34
34
  "README.md"
35
35
  ],
36
36
  "dependencies": {
37
- "@xyo-network/sentinel-model": "~7.0.9",
38
- "@xyo-network/module-model": "~7.0.9",
39
- "@xyo-network/witness-model": "~7.0.9",
40
- "@xyo-network/diviner-model": "~7.0.9",
41
- "@xyo-network/sentinel-abstract": "~7.0.9"
37
+ "@xyo-network/sdk": "~7.0.10"
42
38
  },
43
39
  "devDependencies": {
44
40
  "@ariestools/sdk": "~8.0.2",
45
41
  "@ariestools/threads": "~8.0.2",
46
- "@ariestools/vitest-extended": "~8.0.2",
47
42
  "@bitauth/libauth": "~3.0.0",
48
43
  "@metamask/providers": "~22.1.1",
49
44
  "@noble/post-quantum": "~0.6.1",
@@ -51,9 +46,9 @@
51
46
  "@opentelemetry/sdk-trace-base": "~2.9.0",
52
47
  "@scure/base": "~2.2.0",
53
48
  "@scure/bip39": "~2.2.0",
54
- "@xylabs/toolchain": "~8.6.3",
55
- "@xylabs/tsconfig": "~8.6.3",
56
- "@xyo-network/sdk-protocol": "~7.0.14",
49
+ "@xylabs/toolchain": "~8.6.8",
50
+ "@xylabs/tsconfig": "~8.6.8",
51
+ "@xyo-network/sdk-protocol": "~7.0.15",
57
52
  "ajv": "~8.20.0",
58
53
  "async-mutex": "~0.5.0",
59
54
  "debug": "~4.4.3",
@@ -65,14 +60,8 @@
65
60
  "lru-cache": "~11.5.1",
66
61
  "observable-fns": "~0.6.1",
67
62
  "typescript": "~6.0.3",
68
- "vite": "~8.1.3",
69
- "vitest": "~4.1.9",
70
63
  "webextension-polyfill": "~0.12.0",
71
- "zod": "~4.4.3",
72
- "@xyo-network/archivist-memory": "~7.0.9",
73
- "@xyo-network/witness-abstract": "~7.0.9",
74
- "@xyo-network/witness-adhoc": "~7.0.9",
75
- "@xyo-network/node-memory": "~7.0.9"
64
+ "zod": "~4.4.3"
76
65
  },
77
66
  "peerDependencies": {
78
67
  "@ariestools/sdk": "^8.0.2",
@@ -84,7 +73,7 @@
84
73
  "@opentelemetry/sdk-trace-base": "^2.9.0",
85
74
  "@scure/base": "^2.2.0",
86
75
  "@scure/bip39": "^2.2.0",
87
- "@xyo-network/sdk-protocol": "^7.0.14",
76
+ "@xyo-network/sdk-protocol": "^7.0.15",
88
77
  "ajv": "^8.20.0",
89
78
  "async-mutex": "^0.5.0",
90
79
  "debug": "^4.4.3",
@@ -101,5 +90,6 @@
101
90
  },
102
91
  "publishConfig": {
103
92
  "access": "public"
104
- }
93
+ },
94
+ "deprecated": "Use @xyo-network/sdk/sentinel-memory instead. Replace @xyo-network/sentinel-memory with @xyo-network/sdk/sentinel-memory. This package is a compatibility shim only and will not receive further updates."
105
95
  }
@@ -1,17 +0,0 @@
1
- import { type AnyConfigSchema } from '@xyo-network/module-model';
2
- import type { Payload, Schema } from '@xyo-network/sdk-protocol';
3
- import { AbstractSentinel } from '@xyo-network/sentinel-abstract';
4
- import type { SentinelConfig, SentinelInstance, SentinelModuleEventData, SentinelParams } from '@xyo-network/sentinel-model';
5
- export type MemorySentinelParams<TConfig extends AnyConfigSchema<SentinelConfig> = AnyConfigSchema<SentinelConfig>> = SentinelParams<TConfig>;
6
- export declare class MemorySentinel<TParams extends MemorySentinelParams = MemorySentinelParams, TEventData extends SentinelModuleEventData<SentinelInstance<TParams>> = SentinelModuleEventData<SentinelInstance<TParams>>> extends AbstractSentinel<TParams, TEventData> {
7
- static readonly configSchemas: Schema[];
8
- static readonly defaultConfigSchema: Schema;
9
- private runner?;
10
- reportHandler(inPayloads?: Payload[]): Promise<Payload[]>;
11
- startHandler(): Promise<void>;
12
- stopHandler(): Promise<void>;
13
- private inputAddresses;
14
- private processPreviousResults;
15
- private runJob;
16
- }
17
- //# sourceMappingURL=MemorySentinel.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"MemorySentinel.d.ts","sourceRoot":"","sources":["../../src/MemorySentinel.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,eAAe,EAAyB,MAAM,2BAA2B,CAAA;AACvF,OAAO,KAAK,EACV,OAAO,EAAE,MAAM,EAChB,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AACjE,OAAO,KAAK,EAEV,cAAc,EACd,gBAAgB,EAChB,uBAAuB,EACvB,cAAc,EACf,MAAM,6BAA6B,CAAA;AASpC,MAAM,MAAM,oBAAoB,CAAC,OAAO,SAAS,eAAe,CAAC,cAAc,CAAC,GAAG,eAAe,CAAC,cAAc,CAAC,IAAI,cAAc,CAAC,OAAO,CAAC,CAAA;AAE7I,qBAAa,cAAc,CACzB,OAAO,SAAS,oBAAoB,GAAG,oBAAoB,EAC3D,UAAU,SAAS,uBAAuB,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,GAAG,uBAAuB,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAC1H,SAAQ,gBAAgB,CAAC,OAAO,EAAE,UAAU,CAAC;IAC7C,gBAAyB,aAAa,EAAE,MAAM,EAAE,CAAiD;IACjG,gBAAyB,mBAAmB,EAAE,MAAM,CAAuB;IAE3E,OAAO,CAAC,MAAM,CAAC,CAAgB;IAEzB,aAAa,CAAC,UAAU,GAAE,OAAO,EAAO,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAiBpD,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAU7B,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;YAQ7B,cAAc;IAS5B,OAAO,CAAC,sBAAsB;YAIhB,MAAM;CA4ErB"}
@@ -1,21 +0,0 @@
1
- import { PayloadWrapper } from '@xyo-network/sdk-protocol';
2
- import type { SentinelIntervalAutomationPayload } from '@xyo-network/sentinel-model';
3
- export declare class SentinelIntervalAutomationWrapper<T extends SentinelIntervalAutomationPayload = SentinelIntervalAutomationPayload> extends PayloadWrapper<T> {
4
- constructor(payload: T);
5
- protected get frequencyMillis(): number;
6
- protected get remaining(): number;
7
- next(): this;
8
- protected checkEnd(): void;
9
- protected consumeRemaining(count?: number): void;
10
- /**
11
- * Sets the remaining of the wrapped automation
12
- * @param remaining The remaining time in milliseconds
13
- */
14
- protected setRemaining(remaining: number): void;
15
- /**
16
- * Sets the start of the wrapped automation
17
- * @param start The start time in milliseconds
18
- */
19
- protected setStart(start: number): void;
20
- }
21
- //# sourceMappingURL=SentinelIntervalAutomationWrapper.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SentinelIntervalAutomationWrapper.d.ts","sourceRoot":"","sources":["../../src/SentinelIntervalAutomationWrapper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAC1D,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,6BAA6B,CAAA;AAEpF,qBAAa,iCAAiC,CAC5C,CAAC,SAAS,iCAAiC,GAAG,iCAAiC,CAC/E,SAAQ,cAAc,CAAC,CAAC,CAAC;gBACb,OAAO,EAAE,CAAC;IAItB,SAAS,KAAK,eAAe,IAAI,MAAM,CAwBtC;IAED,SAAS,KAAK,SAAS,IAAI,MAAM,CAEhC;IAED,IAAI,IAAI,IAAI;IAWZ,SAAS,CAAC,QAAQ,IAAI,IAAI;IAM1B,SAAS,CAAC,gBAAgB,CAAC,KAAK,SAAI,GAAG,IAAI;IAM3C;;;OAGG;IACH,SAAS,CAAC,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAI/C;;;OAGG;IACH,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;CAGxC"}
@@ -1,30 +0,0 @@
1
- import type { BaseParams, BrandedHash } from '@ariestools/sdk';
2
- import { Base } from '@ariestools/sdk';
3
- import type { Payload } from '@xyo-network/sdk-protocol';
4
- import type { SentinelAutomationPayload, SentinelInstance } from '@xyo-network/sentinel-model';
5
- export type OnSentinelRunnerTriggerResult = (result: Payload[]) => void;
6
- export interface SentinelRunnerParams extends BaseParams {
7
- automations?: SentinelAutomationPayload[];
8
- onTriggerResult?: OnSentinelRunnerTriggerResult;
9
- sentinel: SentinelInstance;
10
- }
11
- export declare class SentinelRunner extends Base {
12
- protected _automations: Record<string, SentinelAutomationPayload>;
13
- protected onTriggerResult: OnSentinelRunnerTriggerResult | undefined;
14
- protected sentinel: SentinelInstance;
15
- protected timeoutId?: ReturnType<typeof setTimeout> | string | number;
16
- constructor(params: SentinelRunnerParams);
17
- get automations(): Record<string, SentinelAutomationPayload>;
18
- private get next();
19
- add(automation: SentinelAutomationPayload, restart?: boolean): Promise<BrandedHash>;
20
- find(hash: string): [string, SentinelAutomationPayload] | undefined;
21
- remove(hash: string, restart?: boolean): void;
22
- removeAll(): void;
23
- restart(): void;
24
- start(): void;
25
- startHandler(): void;
26
- stop(): void;
27
- update(hash: string, automation: SentinelAutomationPayload, restart?: boolean): Promise<void>;
28
- private trigger;
29
- }
30
- //# sourceMappingURL=SentinelRunner.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SentinelRunner.d.ts","sourceRoot":"","sources":["../../src/SentinelRunner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAC9D,OAAO,EACK,IAAI,EAEf,MAAM,iBAAiB,CAAA;AACxB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAA;AAExD,OAAO,KAAK,EACV,yBAAyB,EACzB,gBAAgB,EAEjB,MAAM,6BAA6B,CAAA;AAKpC,MAAM,MAAM,6BAA6B,GAAG,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,IAAI,CAAA;AAEvE,MAAM,WAAW,oBAAqB,SAAQ,UAAU;IACtD,WAAW,CAAC,EAAE,yBAAyB,EAAE,CAAA;IACzC,eAAe,CAAC,EAAE,6BAA6B,CAAA;IAC/C,QAAQ,EAAE,gBAAgB,CAAA;CAC3B;AAED,qBAAa,cAAe,SAAQ,IAAI;IACtC,SAAS,CAAC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,yBAAyB,CAAC,CAAK;IACtE,SAAS,CAAC,eAAe,EAAE,6BAA6B,GAAG,SAAS,CAAA;IACpE,SAAS,CAAC,QAAQ,EAAE,gBAAgB,CAAA;IACpC,SAAS,CAAC,SAAS,CAAC,EAAE,UAAU,CAAC,OAAO,UAAU,CAAC,GAAG,MAAM,GAAG,MAAM,CAAA;gBAEzD,MAAM,EAAE,oBAAoB;IAQxC,IAAI,WAAW,IAAI,MAAM,CAAC,MAAM,EAAE,yBAAyB,CAAC,CAE3D;IAED,OAAO,KAAK,IAAI,GAOf;IAEK,GAAG,CAAC,UAAU,EAAE,yBAAyB,EAAE,OAAO,UAAO,GAAG,OAAO,CAAC,WAAW,CAAC;IAOtF,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,C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