@xyo-network/sentinel-memory 2.111.2 → 3.0.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 (84) hide show
  1. package/dist/neutral/index.d.ts +51 -4
  2. package/package.json +25 -44
  3. package/xy.config.ts +12 -0
  4. package/dist/browser/MemorySentinel.d.cts +0 -17
  5. package/dist/browser/MemorySentinel.d.cts.map +0 -1
  6. package/dist/browser/MemorySentinel.d.mts +0 -17
  7. package/dist/browser/MemorySentinel.d.mts.map +0 -1
  8. package/dist/browser/MemorySentinel.d.ts +0 -17
  9. package/dist/browser/MemorySentinel.d.ts.map +0 -1
  10. package/dist/browser/SentinelIntervalAutomationWrapper.d.cts +0 -13
  11. package/dist/browser/SentinelIntervalAutomationWrapper.d.cts.map +0 -1
  12. package/dist/browser/SentinelIntervalAutomationWrapper.d.mts +0 -13
  13. package/dist/browser/SentinelIntervalAutomationWrapper.d.mts.map +0 -1
  14. package/dist/browser/SentinelIntervalAutomationWrapper.d.ts +0 -13
  15. package/dist/browser/SentinelIntervalAutomationWrapper.d.ts.map +0 -1
  16. package/dist/browser/SentinelRunner.d.cts +0 -22
  17. package/dist/browser/SentinelRunner.d.cts.map +0 -1
  18. package/dist/browser/SentinelRunner.d.mts +0 -22
  19. package/dist/browser/SentinelRunner.d.mts.map +0 -1
  20. package/dist/browser/SentinelRunner.d.ts +0 -22
  21. package/dist/browser/SentinelRunner.d.ts.map +0 -1
  22. package/dist/browser/index.cjs +0 -349
  23. package/dist/browser/index.cjs.map +0 -1
  24. package/dist/browser/index.d.cts +0 -4
  25. package/dist/browser/index.d.cts.map +0 -1
  26. package/dist/browser/index.d.mts +0 -4
  27. package/dist/browser/index.d.mts.map +0 -1
  28. package/dist/browser/index.d.ts +0 -4
  29. package/dist/browser/index.d.ts.map +0 -1
  30. package/dist/browser/index.mjs +0 -328
  31. package/dist/browser/index.mjs.map +0 -1
  32. package/dist/neutral/MemorySentinel.d.cts +0 -17
  33. package/dist/neutral/MemorySentinel.d.cts.map +0 -1
  34. package/dist/neutral/MemorySentinel.d.mts +0 -17
  35. package/dist/neutral/MemorySentinel.d.mts.map +0 -1
  36. package/dist/neutral/MemorySentinel.d.ts +0 -17
  37. package/dist/neutral/MemorySentinel.d.ts.map +0 -1
  38. package/dist/neutral/SentinelIntervalAutomationWrapper.d.cts +0 -13
  39. package/dist/neutral/SentinelIntervalAutomationWrapper.d.cts.map +0 -1
  40. package/dist/neutral/SentinelIntervalAutomationWrapper.d.mts +0 -13
  41. package/dist/neutral/SentinelIntervalAutomationWrapper.d.mts.map +0 -1
  42. package/dist/neutral/SentinelIntervalAutomationWrapper.d.ts +0 -13
  43. package/dist/neutral/SentinelIntervalAutomationWrapper.d.ts.map +0 -1
  44. package/dist/neutral/SentinelRunner.d.cts +0 -22
  45. package/dist/neutral/SentinelRunner.d.cts.map +0 -1
  46. package/dist/neutral/SentinelRunner.d.mts +0 -22
  47. package/dist/neutral/SentinelRunner.d.mts.map +0 -1
  48. package/dist/neutral/SentinelRunner.d.ts +0 -22
  49. package/dist/neutral/SentinelRunner.d.ts.map +0 -1
  50. package/dist/neutral/index.cjs +0 -349
  51. package/dist/neutral/index.cjs.map +0 -1
  52. package/dist/neutral/index.d.cts +0 -4
  53. package/dist/neutral/index.d.cts.map +0 -1
  54. package/dist/neutral/index.d.mts +0 -4
  55. package/dist/neutral/index.d.mts.map +0 -1
  56. package/dist/neutral/index.d.ts.map +0 -1
  57. package/dist/node/MemorySentinel.d.cts +0 -17
  58. package/dist/node/MemorySentinel.d.cts.map +0 -1
  59. package/dist/node/MemorySentinel.d.mts +0 -17
  60. package/dist/node/MemorySentinel.d.mts.map +0 -1
  61. package/dist/node/MemorySentinel.d.ts +0 -17
  62. package/dist/node/MemorySentinel.d.ts.map +0 -1
  63. package/dist/node/SentinelIntervalAutomationWrapper.d.cts +0 -13
  64. package/dist/node/SentinelIntervalAutomationWrapper.d.cts.map +0 -1
  65. package/dist/node/SentinelIntervalAutomationWrapper.d.mts +0 -13
  66. package/dist/node/SentinelIntervalAutomationWrapper.d.mts.map +0 -1
  67. package/dist/node/SentinelIntervalAutomationWrapper.d.ts +0 -13
  68. package/dist/node/SentinelIntervalAutomationWrapper.d.ts.map +0 -1
  69. package/dist/node/SentinelRunner.d.cts +0 -22
  70. package/dist/node/SentinelRunner.d.cts.map +0 -1
  71. package/dist/node/SentinelRunner.d.mts +0 -22
  72. package/dist/node/SentinelRunner.d.mts.map +0 -1
  73. package/dist/node/SentinelRunner.d.ts +0 -22
  74. package/dist/node/SentinelRunner.d.ts.map +0 -1
  75. package/dist/node/index.cjs +0 -363
  76. package/dist/node/index.cjs.map +0 -1
  77. package/dist/node/index.d.cts +0 -4
  78. package/dist/node/index.d.cts.map +0 -1
  79. package/dist/node/index.d.mts +0 -4
  80. package/dist/node/index.d.mts.map +0 -1
  81. package/dist/node/index.d.ts +0 -4
  82. package/dist/node/index.d.ts.map +0 -1
  83. package/dist/node/index.mjs +0 -336
  84. package/dist/node/index.mjs.map +0 -1
@@ -1,363 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __reflectGet = Reflect.get;
8
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
10
- var __export = (target, all) => {
11
- for (var name in all)
12
- __defProp(target, name, { get: all[name], enumerable: true });
13
- };
14
- var __copyProps = (to, from, except, desc) => {
15
- if (from && typeof from === "object" || typeof from === "function") {
16
- for (let key of __getOwnPropNames(from))
17
- if (!__hasOwnProp.call(to, key) && key !== except)
18
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
19
- }
20
- return to;
21
- };
22
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
23
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
24
- var __superGet = (cls, obj, key) => __reflectGet(__getProtoOf(cls), key, obj);
25
-
26
- // src/index.ts
27
- var src_exports = {};
28
- __export(src_exports, {
29
- MemorySentinel: () => MemorySentinel,
30
- SentinelIntervalAutomationWrapper: () => SentinelIntervalAutomationWrapper,
31
- SentinelRunner: () => SentinelRunner
32
- });
33
- module.exports = __toCommonJS(src_exports);
34
-
35
- // src/MemorySentinel.ts
36
- var import_promise = require("@xylabs/promise");
37
- var import_diviner_model = require("@xyo-network/diviner-model");
38
- var import_sentinel_abstract = require("@xyo-network/sentinel-abstract");
39
- var import_sentinel_model2 = require("@xyo-network/sentinel-model");
40
- var import_witness_model = require("@xyo-network/witness-model");
41
-
42
- // src/SentinelRunner.ts
43
- var import_assert = require("@xylabs/assert");
44
- var import_forget = require("@xylabs/forget");
45
- var import_payload_builder = require("@xyo-network/payload-builder");
46
- var import_sentinel_model = require("@xyo-network/sentinel-model");
47
-
48
- // src/SentinelIntervalAutomationWrapper.ts
49
- var import_payload_wrapper = require("@xyo-network/payload-wrapper");
50
- var _SentinelIntervalAutomationWrapper = class _SentinelIntervalAutomationWrapper extends import_payload_wrapper.PayloadWrapper {
51
- constructor(payload) {
52
- super(payload);
53
- }
54
- get frequencyMillis() {
55
- const frequency = this.payload.frequency;
56
- if (frequency === void 0) return Number.POSITIVE_INFINITY;
57
- const frequencyUnits = this.payload.frequencyUnits;
58
- switch (frequencyUnits ?? "hour") {
59
- case "second": {
60
- return frequency * 1e3;
61
- }
62
- case "minute": {
63
- return frequency * 60 * 1e3;
64
- }
65
- case "hour": {
66
- return frequency * 60 * 60 * 1e3;
67
- }
68
- case "day": {
69
- return frequency * 24 * 60 * 60 * 1e3;
70
- }
71
- default: {
72
- return Number.POSITIVE_INFINITY;
73
- }
74
- }
75
- }
76
- get remaining() {
77
- return this.payload.remaining ?? Number.POSITIVE_INFINITY;
78
- }
79
- next() {
80
- var _a;
81
- const now = Date.now();
82
- const previousStart = ((_a = this.payload) == null ? void 0 : _a.start) ?? now;
83
- const start = Math.max(previousStart, now);
84
- const nextStart = start + this.frequencyMillis;
85
- this.setStart(nextStart);
86
- this.consumeRemaining();
87
- this.checkEnd();
88
- return this;
89
- }
90
- checkEnd() {
91
- if (this.payload.start > (this.payload.end ?? Number.POSITIVE_INFINITY)) {
92
- this.setStart(Number.POSITIVE_INFINITY);
93
- }
94
- }
95
- consumeRemaining(count = 1) {
96
- const remaining = Math.max(this.remaining - count, 0);
97
- this.setRemaining(remaining);
98
- if (remaining <= 0) this.setStart(Number.POSITIVE_INFINITY);
99
- }
100
- /**
101
- * Sets the remaining of the wrapped automation
102
- * @param remaining The remaining time in milliseconds
103
- */
104
- setRemaining(remaining) {
105
- this.payload.remaining = remaining;
106
- }
107
- /**
108
- * Sets the start of the wrapped automation
109
- * @param start The start time in milliseconds
110
- */
111
- setStart(start) {
112
- this.payload.start = start;
113
- }
114
- };
115
- __name(_SentinelIntervalAutomationWrapper, "SentinelIntervalAutomationWrapper");
116
- var SentinelIntervalAutomationWrapper = _SentinelIntervalAutomationWrapper;
117
-
118
- // src/SentinelRunner.ts
119
- var _SentinelRunner = class _SentinelRunner {
120
- _automations = {};
121
- onTriggerResult;
122
- sentinel;
123
- timeoutId;
124
- constructor(sentinel, automations, onTriggerResult) {
125
- this.sentinel = sentinel;
126
- this.onTriggerResult = onTriggerResult;
127
- if (automations) for (const automation of automations) (0, import_forget.forget)(this.add(automation));
128
- }
129
- get automations() {
130
- return this._automations;
131
- }
132
- get next() {
133
- return Object.values(this._automations).reduce((previous, current) => {
134
- if ((0, import_sentinel_model.isSentinelIntervalAutomation)(current) && (0, import_sentinel_model.isSentinelIntervalAutomation)(previous)) {
135
- return current.start < ((previous == null ? void 0 : previous.start) ?? Number.POSITIVE_INFINITY) ? current : previous;
136
- }
137
- return current;
138
- }, void 0);
139
- }
140
- async add(automation, restart = true) {
141
- const hash = await import_payload_builder.PayloadBuilder.dataHash(automation);
142
- this._automations[hash] = automation;
143
- if (restart) this.restart();
144
- return hash;
145
- }
146
- find(hash) {
147
- return Object.entries(this._automations).find(([key]) => key === hash);
148
- }
149
- remove(hash, restart = true) {
150
- delete this._automations[hash];
151
- if (restart) this.restart();
152
- }
153
- removeAll() {
154
- this.stop();
155
- this._automations = {};
156
- }
157
- restart() {
158
- this.stop();
159
- this.start();
160
- }
161
- start() {
162
- (0, import_assert.assertEx)(this.timeoutId === void 0, () => "Already started");
163
- const automation = this.next;
164
- if ((0, import_sentinel_model.isSentinelIntervalAutomation)(automation)) {
165
- const now = Date.now();
166
- const start = Math.max(automation.start ?? now, now);
167
- const delay = Math.max(start - now, 0);
168
- if (delay < Number.POSITIVE_INFINITY) {
169
- this.timeoutId = setTimeout(async () => {
170
- try {
171
- await this.trigger(automation);
172
- this.stop();
173
- } finally {
174
- this.start();
175
- }
176
- }, delay);
177
- }
178
- }
179
- }
180
- stop() {
181
- if (this.timeoutId) {
182
- clearTimeout(this.timeoutId);
183
- this.timeoutId = void 0;
184
- }
185
- }
186
- async update(hash, automation, restart = true) {
187
- await this.remove(hash, false);
188
- await this.add(automation, false);
189
- if (restart) await this.restart();
190
- }
191
- async trigger(automation) {
192
- var _a;
193
- const wrapper = new SentinelIntervalAutomationWrapper(automation);
194
- await this.remove(await wrapper.dataHash(), false);
195
- wrapper.next();
196
- await this.add(wrapper.payload, false);
197
- const triggerResult = await this.sentinel.report();
198
- (_a = this.onTriggerResult) == null ? void 0 : _a.call(this, triggerResult);
199
- }
200
- };
201
- __name(_SentinelRunner, "SentinelRunner");
202
- var SentinelRunner = _SentinelRunner;
203
-
204
- // src/MemorySentinel.ts
205
- var _MemorySentinel = class _MemorySentinel extends import_sentinel_abstract.AbstractSentinel {
206
- runner;
207
- async reportHandler(inPayloads = []) {
208
- var _a, _b;
209
- await this.started("throw");
210
- (_a = this.logger) == null ? void 0 : _a.debug(`reportHandler:in: ${JSON.stringify(inPayloads)}`);
211
- const job = await this.jobPromise;
212
- let index = 0;
213
- let previousResults = {};
214
- while (index < job.tasks.length) {
215
- const generatedPayloads = await this.runJob(job.tasks[index], previousResults, inPayloads);
216
- previousResults = generatedPayloads;
217
- index++;
218
- }
219
- const result = Object.values(previousResults).flat();
220
- (_b = this.logger) == null ? void 0 : _b.debug(`reportHandler:out: ${JSON.stringify(result)}`);
221
- return result;
222
- }
223
- async start(timeout) {
224
- var _a;
225
- if (await super.start(timeout)) {
226
- if ((((_a = this.config.automations) == null ? void 0 : _a.length) ?? 0) > 0) {
227
- this.runner = new SentinelRunner(this, this.config.automations);
228
- this.runner.start();
229
- }
230
- return true;
231
- }
232
- return false;
233
- }
234
- async stop(timeout) {
235
- if (this.runner) {
236
- this.runner.stop();
237
- this.runner = void 0;
238
- }
239
- return await super.stop(timeout);
240
- }
241
- async inputAddresses(input) {
242
- if (Array.isArray(input)) {
243
- return (await Promise.all(input.map(async (inputItem) => await this.inputAddresses(inputItem)))).flat();
244
- } else {
245
- const resolved = await this.resolve(input);
246
- return resolved ? [
247
- resolved.address
248
- ] : [];
249
- }
250
- }
251
- processPreviousResults(payloads, inputs) {
252
- return inputs.flatMap((input) => payloads[input] ?? []);
253
- }
254
- async runJob(tasks, previousResults, inPayloads) {
255
- var _a, _b, _c, _d;
256
- await this.emit("jobStart", {
257
- inPayloads,
258
- mod: this
259
- });
260
- (_a = this.logger) == null ? void 0 : _a.debug(`runJob:tasks: ${JSON.stringify(tasks.length)}`);
261
- (_b = this.logger) == null ? void 0 : _b.debug(`runJob:previous: ${JSON.stringify(previousResults)}`);
262
- (_c = this.logger) == null ? void 0 : _c.debug(`runJob:in: ${JSON.stringify(inPayloads)}`);
263
- const results = await Promise.allSettled(tasks == null ? void 0 : tasks.map(async (task) => {
264
- var _a2, _b2, _c2;
265
- const input = task.input ?? false;
266
- const inPayloadsFound = input === true ? inPayloads : input === false ? [] : this.processPreviousResults(previousResults, await this.inputAddresses(input));
267
- const witness = (0, import_witness_model.asWitnessInstance)(task.mod);
268
- if (witness) {
269
- await this.emit("taskStart", {
270
- address: witness.address,
271
- inPayloads: inPayloadsFound,
272
- mod: this
273
- });
274
- const observed = await witness.observe(inPayloadsFound);
275
- (_a2 = this.logger) == null ? void 0 : _a2.debug(`observed [${witness.id}]: ${JSON.stringify(observed)}`);
276
- await this.emit("taskEnd", {
277
- address: witness.address,
278
- inPayloads: inPayloadsFound,
279
- mod: this,
280
- outPayloads: observed
281
- });
282
- return [
283
- witness.address,
284
- observed
285
- ];
286
- }
287
- const diviner = (0, import_diviner_model.asDivinerInstance)(task.mod);
288
- if (diviner) {
289
- await this.emit("taskStart", {
290
- address: diviner.address,
291
- inPayloads: inPayloadsFound,
292
- mod: this
293
- });
294
- const divined = await diviner.divine(inPayloadsFound);
295
- (_b2 = this.logger) == null ? void 0 : _b2.debug(`divined [${diviner.id}]: ${JSON.stringify(divined)}`);
296
- await this.emit("taskEnd", {
297
- address: diviner.address,
298
- inPayloads: inPayloadsFound,
299
- mod: this,
300
- outPayloads: divined
301
- });
302
- return [
303
- diviner.address,
304
- divined
305
- ];
306
- }
307
- const sentinel = (0, import_sentinel_model2.asSentinelInstance)(task.mod);
308
- if (sentinel) {
309
- await this.emit("taskStart", {
310
- address: sentinel.address,
311
- inPayloads: inPayloadsFound,
312
- mod: this
313
- });
314
- const reported = await sentinel.report(inPayloadsFound);
315
- (_c2 = this.logger) == null ? void 0 : _c2.debug(`reported [${sentinel.id}]: ${JSON.stringify(reported)}`);
316
- await this.emit("taskEnd", {
317
- address: sentinel.address,
318
- inPayloads: inPayloadsFound,
319
- mod: this,
320
- outPayloads: reported
321
- });
322
- return [
323
- sentinel.address,
324
- reported
325
- ];
326
- }
327
- throw new Error("Unsupported module type");
328
- }));
329
- const finalResult = {};
330
- for (const result of results.filter(import_promise.fulfilled)) {
331
- const [address, payloads] = result.value;
332
- finalResult[address] = finalResult[address] ?? [];
333
- finalResult[address].push(...payloads);
334
- }
335
- if (this.throwErrors) {
336
- const errors = results.filter(import_promise.rejected).map((result) => result.reason);
337
- if (errors.length > 0) {
338
- throw new Error("At least one module failed");
339
- }
340
- }
341
- (_d = this.logger) == null ? void 0 : _d.debug(`generateResults:out: ${JSON.stringify(finalResult)}`);
342
- await this.emit("jobEnd", {
343
- finalResult,
344
- inPayloads,
345
- mod: this
346
- });
347
- return finalResult;
348
- }
349
- };
350
- __name(_MemorySentinel, "MemorySentinel");
351
- __publicField(_MemorySentinel, "configSchemas", [
352
- ...__superGet(_MemorySentinel, _MemorySentinel, "configSchemas"),
353
- import_sentinel_model2.SentinelConfigSchema
354
- ]);
355
- __publicField(_MemorySentinel, "defaultConfigSchema", import_sentinel_model2.SentinelConfigSchema);
356
- var MemorySentinel = _MemorySentinel;
357
- // Annotate the CommonJS export names for ESM import in node:
358
- 0 && (module.exports = {
359
- MemorySentinel,
360
- SentinelIntervalAutomationWrapper,
361
- SentinelRunner
362
- });
363
- //# sourceMappingURL=index.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/index.ts","../../src/MemorySentinel.ts","../../src/SentinelRunner.ts","../../src/SentinelIntervalAutomationWrapper.ts"],"sourcesContent":["export * from './MemorySentinel.ts'\nexport * from './SentinelIntervalAutomationWrapper.ts'\nexport * from './SentinelRunner.ts'\n","import { Address } from '@xylabs/hex'\nimport { fulfilled, rejected } from '@xylabs/promise'\nimport { asDivinerInstance } from '@xyo-network/diviner-model'\nimport { AnyConfigSchema, ModuleIdentifier } from '@xyo-network/module-model'\nimport { Payload, Schema } from '@xyo-network/payload-model'\nimport { AbstractSentinel } from '@xyo-network/sentinel-abstract'\nimport {\n asSentinelInstance,\n ResolvedTask,\n SentinelConfig,\n SentinelConfigSchema,\n SentinelInstance,\n SentinelModuleEventData,\n SentinelParams,\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.started('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<Address, 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 start(timeout?: number | undefined): Promise<boolean> {\n if (await super.start(timeout)) {\n if ((this.config.automations?.length ?? 0) > 0) {\n this.runner = new SentinelRunner(this, this.config.automations)\n this.runner.start()\n }\n return true\n }\n return false\n }\n\n override async stop(timeout?: number | undefined): Promise<boolean> {\n if (this.runner) {\n this.runner.stop()\n this.runner = undefined\n }\n return await super.stop(timeout)\n }\n\n private async inputAddresses(input: ModuleIdentifier | ModuleIdentifier[]): Promise<Address[]> {\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<Address, Payload[]>,\n inPayloads?: Payload[],\n ): Promise<Record<Address, 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<[Address, 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', { address: witness.address, inPayloads: inPayloadsFound, mod: this })\n const observed = await witness.observe(inPayloadsFound)\n this.logger?.debug(`observed [${witness.id}]: ${JSON.stringify(observed)}`)\n await this.emit('taskEnd', { address: witness.address, inPayloads: inPayloadsFound, mod: this, outPayloads: observed })\n return [witness.address, observed]\n }\n const diviner = asDivinerInstance(task.mod)\n if (diviner) {\n await this.emit('taskStart', { address: diviner.address, inPayloads: inPayloadsFound, mod: this })\n const divined = await diviner.divine(inPayloadsFound)\n this.logger?.debug(`divined [${diviner.id}]: ${JSON.stringify(divined)}`)\n await this.emit('taskEnd', { address: diviner.address, inPayloads: inPayloadsFound, mod: this, outPayloads: divined })\n return [diviner.address, divined]\n }\n const sentinel = asSentinelInstance(task.mod)\n if (sentinel) {\n await this.emit('taskStart', { address: sentinel.address, inPayloads: inPayloadsFound, mod: this })\n const reported = await sentinel.report(inPayloadsFound)\n this.logger?.debug(`reported [${sentinel.id}]: ${JSON.stringify(reported)}`)\n await this.emit('taskEnd', { address: sentinel.address, inPayloads: inPayloadsFound, mod: this, outPayloads: reported })\n return [sentinel.address, reported]\n }\n throw new Error('Unsupported module type')\n }),\n )\n const finalResult: Record<Address, 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 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', { finalResult, inPayloads, mod: this })\n return finalResult\n }\n}\n","import { assertEx } from '@xylabs/assert'\nimport { forget } from '@xylabs/forget'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport { Payload } from '@xyo-network/payload-model'\nimport {\n isSentinelIntervalAutomation,\n SentinelAutomationPayload,\n SentinelInstance,\n SentinelIntervalAutomationPayload,\n} from '@xyo-network/sentinel-model'\n\nimport { SentinelIntervalAutomationWrapper } from './SentinelIntervalAutomationWrapper.ts'\n\nexport type OnSentinelRunnerTriggerResult = (result: Payload[]) => void\n\nexport class SentinelRunner {\n protected _automations: Record<string, SentinelAutomationPayload> = {}\n protected onTriggerResult: OnSentinelRunnerTriggerResult | undefined\n protected sentinel: SentinelInstance\n protected timeoutId?: NodeJS.Timeout | string | number\n\n constructor(sentinel: SentinelInstance, automations?: SentinelAutomationPayload[], onTriggerResult?: OnSentinelRunnerTriggerResult) {\n this.sentinel = sentinel\n this.onTriggerResult = onTriggerResult\n if (automations) for (const automation of automations) forget(this.add(automation))\n }\n\n get automations() {\n return this._automations\n }\n\n private get next() {\n // eslint-disable-next-line unicorn/no-array-reduce\n return Object.values(this._automations).reduce<SentinelAutomationPayload | undefined>((previous, current) => {\n if (isSentinelIntervalAutomation(current) && isSentinelIntervalAutomation(previous)) {\n return current.start < (previous?.start ?? Number.POSITIVE_INFINITY) ? current : previous\n }\n return current\n // eslint-disable-next-line unicorn/no-useless-undefined\n }, undefined)\n }\n\n async add(automation: SentinelAutomationPayload, restart = true) {\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) {\n return Object.entries(this._automations).find(([key]) => key === hash)\n }\n\n remove(hash: string, restart = true) {\n delete this._automations[hash]\n if (restart) this.restart()\n }\n\n removeAll() {\n this.stop()\n this._automations = {}\n }\n\n restart() {\n this.stop()\n this.start()\n }\n\n start() {\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 try {\n // Run the automation\n await this.trigger(automation)\n this.stop()\n } finally {\n // No matter what start the next automation\n this.start()\n }\n }, delay)\n }\n }\n }\n\n stop() {\n if (this.timeoutId) {\n clearTimeout(this.timeoutId)\n this.timeoutId = undefined\n }\n }\n\n async update(hash: string, automation: SentinelAutomationPayload, restart = true) {\n await this.remove(hash, false)\n await this.add(automation, false)\n if (restart) await this.restart()\n }\n\n private async trigger(automation: SentinelIntervalAutomationPayload) {\n const wrapper = new SentinelIntervalAutomationWrapper(automation)\n await 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 // await this.start()\n }\n}\n","import { PayloadWrapper } from '@xyo-network/payload-wrapper'\nimport { 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() {\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 '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() {\n return this.payload.remaining ?? Number.POSITIVE_INFINITY\n }\n\n next() {\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() {\n if (this.payload.start > (this.payload.end ?? Number.POSITIVE_INFINITY)) {\n this.setStart(Number.POSITIVE_INFINITY)\n }\n }\n\n protected consumeRemaining(count = 1) {\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) {\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) {\n this.payload.start = start\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;ACCA,qBAAoC;AACpC,2BAAkC;AAGlC,+BAAiC;AACjC,IAAAA,yBAQO;AACP,2BAAkC;;;ACflC,oBAAyB;AACzB,oBAAuB;AACvB,6BAA+B;AAE/B,4BAKO;;;ACTP,6BAA+B;AAGxB,IAAMC,qCAAN,MAAMA,2CAEHC,sCAAAA;EACRC,YAAYC,SAAY;AACtB,UAAMA,OAAAA;EACR;EAEA,IAAcC,kBAAkB;AAC9B,UAAMC,YAAY,KAAKF,QAAQE;AAC/B,QAAIA,cAAcC,OAAW,QAAOC,OAAOC;AAC3C,UAAMC,iBAAiB,KAAKN,QAAQM;AACpC,YAAQA,kBAAkB,QAAA;MACxB,KAAK,UAAU;AACb,eAAOJ,YAAY;MACrB;MACA,KAAK,UAAU;AACb,eAAOA,YAAY,KAAK;MAC1B;MACA,KAAK,QAAQ;AACX,eAAOA,YAAY,KAAK,KAAK;MAC/B;MACA,KAAK,OAAO;AACV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utomationWrapper","PayloadWrapper","constructor","payload","frequencyMillis","frequency","undefined","Number","POSITIVE_INFINITY","frequencyUnits","remaining","next","now","Date","previousStart","start","Math","max","nextStart","setStart","consumeRemaining","checkEnd","end","count","setRemaining","SentinelRunner","_automations","onTriggerResult","sentinel","timeoutId","constructor","automations","automation","forget","add","next","Object","values","reduce","previous","current","isSentinelIntervalAutomation","start","Number","POSITIVE_INFINITY","undefined","restart","hash","PayloadBuilder","dataHash","find","entries","key","remove","removeAll","stop","assertEx","now","Date","Math","max","delay","setTimeout","trigger","clearTimeout","update","wrapper","SentinelIntervalAutomationWrapper","payload","triggerResult","report","MemorySentinel","AbstractSentinel","runner","reportHandler","inPayloads","started","logger","debug","JSON","stringify","job","jobPromise","index","previousResults","tasks","length","generatedPayloads","runJob","result","Object","values","flat","start","timeout","config","automations","SentinelRunner","stop","undefined","inputAddresses","input","Array","isArray","Promise","all","map","inputItem","resolved","resolve","address","processPreviousResults","payloads","inputs","flatMap","emit","mod","results","allSettled","task","_a","_b","_c","inPayloadsFound","witness","asWitnessInstance","observed","observe","id","outPayloads","diviner","asDivinerInstance","divined","divine","sentinel","asSentinelInstance","reported","report","Error","finalResult","filter","fulfilled","value","push","throwErrors","errors","rejected","reason","configSchemas","SentinelConfigSchema","defaultConfigSchema"]}
@@ -1,4 +0,0 @@
1
- export * from './MemorySentinel.ts';
2
- export * from './SentinelIntervalAutomationWrapper.ts';
3
- export * from './SentinelRunner.ts';
4
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
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,4 +0,0 @@
1
- export * from './MemorySentinel.ts';
2
- export * from './SentinelIntervalAutomationWrapper.ts';
3
- export * from './SentinelRunner.ts';
4
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
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,4 +0,0 @@
1
- export * from './MemorySentinel.ts';
2
- export * from './SentinelIntervalAutomationWrapper.ts';
3
- export * from './SentinelRunner.ts';
4
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
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"}