@xyo-network/sentinel 2.84.7 → 2.84.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/MemorySentinel.d.cts +3 -0
- package/dist/browser/MemorySentinel.d.cts.map +1 -1
- package/dist/browser/MemorySentinel.d.mts +3 -0
- package/dist/browser/MemorySentinel.d.mts.map +1 -1
- package/dist/browser/MemorySentinel.d.ts +3 -0
- package/dist/browser/MemorySentinel.d.ts.map +1 -1
- package/dist/browser/SentinelIntervalAutomationWrapper.d.cts +11 -1
- package/dist/browser/SentinelIntervalAutomationWrapper.d.cts.map +1 -1
- package/dist/browser/SentinelIntervalAutomationWrapper.d.mts +11 -1
- package/dist/browser/SentinelIntervalAutomationWrapper.d.mts.map +1 -1
- package/dist/browser/SentinelIntervalAutomationWrapper.d.ts +11 -1
- package/dist/browser/SentinelIntervalAutomationWrapper.d.ts.map +1 -1
- package/dist/browser/SentinelRunner.d.cts +1 -2
- package/dist/browser/SentinelRunner.d.cts.map +1 -1
- package/dist/browser/SentinelRunner.d.mts +1 -2
- package/dist/browser/SentinelRunner.d.mts.map +1 -1
- package/dist/browser/SentinelRunner.d.ts +1 -2
- package/dist/browser/SentinelRunner.d.ts.map +1 -1
- package/dist/browser/index.cjs +132 -98
- package/dist/browser/index.cjs.map +1 -1
- package/dist/browser/index.d.cts +0 -1
- package/dist/browser/index.d.cts.map +1 -1
- package/dist/browser/index.d.mts +0 -1
- package/dist/browser/index.d.mts.map +1 -1
- package/dist/browser/index.d.ts +0 -1
- package/dist/browser/index.d.ts.map +1 -1
- package/dist/browser/index.js +126 -90
- package/dist/browser/index.js.map +1 -1
- package/dist/node/MemorySentinel.d.cts +3 -0
- package/dist/node/MemorySentinel.d.cts.map +1 -1
- package/dist/node/MemorySentinel.d.mts +3 -0
- package/dist/node/MemorySentinel.d.mts.map +1 -1
- package/dist/node/MemorySentinel.d.ts +3 -0
- package/dist/node/MemorySentinel.d.ts.map +1 -1
- package/dist/node/SentinelIntervalAutomationWrapper.d.cts +11 -1
- package/dist/node/SentinelIntervalAutomationWrapper.d.cts.map +1 -1
- package/dist/node/SentinelIntervalAutomationWrapper.d.mts +11 -1
- package/dist/node/SentinelIntervalAutomationWrapper.d.mts.map +1 -1
- package/dist/node/SentinelIntervalAutomationWrapper.d.ts +11 -1
- package/dist/node/SentinelIntervalAutomationWrapper.d.ts.map +1 -1
- package/dist/node/SentinelRunner.d.cts +1 -2
- package/dist/node/SentinelRunner.d.cts.map +1 -1
- package/dist/node/SentinelRunner.d.mts +1 -2
- package/dist/node/SentinelRunner.d.mts.map +1 -1
- package/dist/node/SentinelRunner.d.ts +1 -2
- package/dist/node/SentinelRunner.d.ts.map +1 -1
- package/dist/node/index.cjs +134 -102
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.d.cts +0 -1
- package/dist/node/index.d.cts.map +1 -1
- package/dist/node/index.d.mts +0 -1
- package/dist/node/index.d.mts.map +1 -1
- package/dist/node/index.d.ts +0 -1
- package/dist/node/index.d.ts.map +1 -1
- package/dist/node/index.js +128 -90
- package/dist/node/index.js.map +1 -1
- package/package.json +16 -16
- package/src/MemorySentinel.ts +23 -0
- package/src/SentinelIntervalAutomationWrapper.ts +31 -12
- package/src/SentinelRunner.ts +22 -14
- package/src/index.ts +0 -1
- package/dist/browser/Automation.d.cts +0 -71
- package/dist/browser/Automation.d.cts.map +0 -1
- package/dist/browser/Automation.d.mts +0 -71
- package/dist/browser/Automation.d.mts.map +0 -1
- package/dist/browser/Automation.d.ts +0 -71
- package/dist/browser/Automation.d.ts.map +0 -1
- package/dist/node/Automation.d.cts +0 -71
- package/dist/node/Automation.d.cts.map +0 -1
- package/dist/node/Automation.d.mts +0 -71
- package/dist/node/Automation.d.mts.map +0 -1
- package/dist/node/Automation.d.ts +0 -71
- package/dist/node/Automation.d.ts.map +0 -1
- package/src/Automation.ts +0 -55
package/dist/browser/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,qCAAqC,CAAA;AACnD,cAAc,kBAAkB,CAAA;AAChC,cAAc,WAAW,CAAA;AACzB,cAAc,gCAAgC,CAAA;AAC9C,cAAc,6BAA6B,CAAA"}
|
package/dist/browser/index.js
CHANGED
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
// src/Automation.ts
|
|
2
|
-
import { isPayloadOfSchemaType } from "@xyo-network/payload-model";
|
|
3
|
-
var SentinelAutomationSchema = "network.xyo.automation";
|
|
4
|
-
var SentinelIntervalAutomationSchema = "network.xyo.automation.interval";
|
|
5
|
-
var SentinelEventAutomationSchema = "network.xyo.automation.event";
|
|
6
|
-
var isSentinelIntervalAutomation = isPayloadOfSchemaType(SentinelIntervalAutomationSchema);
|
|
7
|
-
|
|
8
1
|
// src/MemorySentinel.ts
|
|
9
2
|
import { fulfilled, rejected } from "@xylabs/promise";
|
|
10
3
|
import { asDivinerInstance } from "@xyo-network/diviner-model";
|
|
@@ -13,62 +6,13 @@ import {
|
|
|
13
6
|
SentinelConfigSchema
|
|
14
7
|
} from "@xyo-network/sentinel-model";
|
|
15
8
|
import { asWitnessInstance } from "@xyo-network/witness-model";
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
while (index < job.tasks.length) {
|
|
24
|
-
const generatedPayloads = await this.generateResults(job.tasks[index], previousResults, inPayloads);
|
|
25
|
-
previousResults = generatedPayloads;
|
|
26
|
-
index++;
|
|
27
|
-
}
|
|
28
|
-
return Object.values(previousResults).flat();
|
|
29
|
-
}
|
|
30
|
-
async generateResults(tasks, previousResults, inPayloads) {
|
|
31
|
-
const results = await Promise.allSettled(
|
|
32
|
-
tasks?.map(async (task) => {
|
|
33
|
-
const witness = asWitnessInstance(task.module);
|
|
34
|
-
const input = task.input ?? false;
|
|
35
|
-
const inPayloadsFound = input === true ? inPayloads : input === false ? [] : this.processPreviousResults(previousResults, await this.inputAddresses(input));
|
|
36
|
-
if (witness) {
|
|
37
|
-
return [witness.address, await witness.observe(inPayloadsFound)];
|
|
38
|
-
}
|
|
39
|
-
const diviner = asDivinerInstance(task.module);
|
|
40
|
-
if (diviner) {
|
|
41
|
-
return [diviner.address, await diviner.divine(inPayloadsFound)];
|
|
42
|
-
}
|
|
43
|
-
throw new Error("Unsupported module type");
|
|
44
|
-
})
|
|
45
|
-
);
|
|
46
|
-
const finalResult = {};
|
|
47
|
-
for (const result of results.filter(fulfilled)) {
|
|
48
|
-
const [address, payloads] = result.value;
|
|
49
|
-
finalResult[address] = finalResult[address] ?? [];
|
|
50
|
-
finalResult[address].push(...payloads);
|
|
51
|
-
}
|
|
52
|
-
if (this.throwErrors) {
|
|
53
|
-
const errors = results.filter(rejected).map((result) => result.reason);
|
|
54
|
-
if (errors.length > 0) {
|
|
55
|
-
throw new Error("At least one module failed");
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
return finalResult;
|
|
59
|
-
}
|
|
60
|
-
async inputAddresses(input) {
|
|
61
|
-
if (Array.isArray(input)) {
|
|
62
|
-
return (await Promise.all(input.map(async (inputItem) => await this.inputAddresses(inputItem)))).flat();
|
|
63
|
-
} else {
|
|
64
|
-
const resolved = await this.resolve(input);
|
|
65
|
-
return resolved ? [resolved.address] : [];
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
processPreviousResults(payloads, inputs) {
|
|
69
|
-
return inputs.flatMap((input) => payloads[input] ?? []);
|
|
70
|
-
}
|
|
71
|
-
};
|
|
9
|
+
|
|
10
|
+
// src/SentinelRunner.ts
|
|
11
|
+
import { assertEx } from "@xylabs/assert";
|
|
12
|
+
import { PayloadWrapper as PayloadWrapper2 } from "@xyo-network/payload-wrapper";
|
|
13
|
+
import {
|
|
14
|
+
isSentinelIntervalAutomation
|
|
15
|
+
} from "@xyo-network/sentinel-model";
|
|
72
16
|
|
|
73
17
|
// src/SentinelIntervalAutomationWrapper.ts
|
|
74
18
|
import { PayloadWrapper } from "@xyo-network/payload-wrapper";
|
|
@@ -80,7 +24,8 @@ var SentinelIntervalAutomationWrapper = class extends PayloadWrapper {
|
|
|
80
24
|
const frequency = this.jsonPayload().frequency;
|
|
81
25
|
if (frequency === void 0)
|
|
82
26
|
return Number.POSITIVE_INFINITY;
|
|
83
|
-
|
|
27
|
+
const frequencyUnits = this.jsonPayload().frequencyUnits;
|
|
28
|
+
switch (frequencyUnits ?? "hour") {
|
|
84
29
|
case "second": {
|
|
85
30
|
return frequency * 1e3;
|
|
86
31
|
}
|
|
@@ -93,34 +38,52 @@ var SentinelIntervalAutomationWrapper = class extends PayloadWrapper {
|
|
|
93
38
|
case "day": {
|
|
94
39
|
return frequency * 24 * 60 * 60 * 1e3;
|
|
95
40
|
}
|
|
41
|
+
default: {
|
|
42
|
+
return Number.POSITIVE_INFINITY;
|
|
43
|
+
}
|
|
96
44
|
}
|
|
97
45
|
}
|
|
98
46
|
get remaining() {
|
|
99
|
-
return this.
|
|
47
|
+
return this.jsonPayload().remaining ?? Number.POSITIVE_INFINITY;
|
|
100
48
|
}
|
|
101
49
|
next() {
|
|
102
|
-
|
|
50
|
+
const now = Date.now();
|
|
51
|
+
const previousStart = this.jsonPayload()?.start ?? now;
|
|
52
|
+
const start = Math.max(previousStart, now);
|
|
53
|
+
const nextStart = start + this.frequencyMillis;
|
|
54
|
+
this.setStart(nextStart);
|
|
103
55
|
this.consumeRemaining();
|
|
104
56
|
this.checkEnd();
|
|
105
57
|
return this;
|
|
106
58
|
}
|
|
107
59
|
checkEnd() {
|
|
108
60
|
if (this.jsonPayload().start > (this.jsonPayload().end ?? Number.POSITIVE_INFINITY)) {
|
|
109
|
-
this.
|
|
61
|
+
this.setStart(Number.POSITIVE_INFINITY);
|
|
110
62
|
}
|
|
111
63
|
}
|
|
112
64
|
consumeRemaining(count = 1) {
|
|
113
|
-
const remaining = this.remaining - count;
|
|
114
|
-
this.
|
|
115
|
-
if (remaining <= 0)
|
|
116
|
-
this.
|
|
117
|
-
|
|
65
|
+
const remaining = Math.max(this.remaining - count, 0);
|
|
66
|
+
this.setRemaining(remaining);
|
|
67
|
+
if (remaining <= 0)
|
|
68
|
+
this.setStart(Number.POSITIVE_INFINITY);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Sets the remaining of the wrapped automation
|
|
72
|
+
* @param remaining The remaining time in milliseconds
|
|
73
|
+
*/
|
|
74
|
+
setRemaining(remaining) {
|
|
75
|
+
this.obj.remaining = remaining;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Sets the start of the wrapped automation
|
|
79
|
+
* @param start The start time in milliseconds
|
|
80
|
+
*/
|
|
81
|
+
setStart(start) {
|
|
82
|
+
this.obj.start = start;
|
|
118
83
|
}
|
|
119
84
|
};
|
|
120
85
|
|
|
121
86
|
// src/SentinelRunner.ts
|
|
122
|
-
import { assertEx } from "@xylabs/assert";
|
|
123
|
-
import { PayloadWrapper as PayloadWrapper2 } from "@xyo-network/payload-wrapper";
|
|
124
87
|
var SentinelRunner = class {
|
|
125
88
|
_automations = {};
|
|
126
89
|
onTriggerResult;
|
|
@@ -168,20 +131,22 @@ var SentinelRunner = class {
|
|
|
168
131
|
await this.start();
|
|
169
132
|
}
|
|
170
133
|
async start() {
|
|
134
|
+
await Promise.resolve();
|
|
171
135
|
assertEx(this.timeoutId === void 0, "Already started");
|
|
172
136
|
const automation = this.next;
|
|
173
137
|
if (isSentinelIntervalAutomation(automation)) {
|
|
174
|
-
const
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
this.timeoutId = setTimeout(
|
|
179
|
-
|
|
180
|
-
this.
|
|
138
|
+
const now = Date.now();
|
|
139
|
+
const start = Math.max(automation.start ?? now, now);
|
|
140
|
+
const delay = Math.max(start - now, 0);
|
|
141
|
+
if (delay < Number.POSITIVE_INFINITY) {
|
|
142
|
+
this.timeoutId = setTimeout(async () => {
|
|
143
|
+
try {
|
|
144
|
+
await this.trigger(automation);
|
|
145
|
+
this.stop();
|
|
146
|
+
} finally {
|
|
181
147
|
await this.start();
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
);
|
|
148
|
+
}
|
|
149
|
+
}, delay);
|
|
185
150
|
}
|
|
186
151
|
}
|
|
187
152
|
}
|
|
@@ -204,7 +169,82 @@ var SentinelRunner = class {
|
|
|
204
169
|
await this.add(wrapper.jsonPayload(), false);
|
|
205
170
|
const triggerResult = await this.sentinel.report();
|
|
206
171
|
this.onTriggerResult?.(triggerResult);
|
|
207
|
-
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
// src/MemorySentinel.ts
|
|
176
|
+
var MemorySentinel = class extends AbstractSentinel {
|
|
177
|
+
static configSchemas = [SentinelConfigSchema];
|
|
178
|
+
runner;
|
|
179
|
+
async reportHandler(inPayloads = []) {
|
|
180
|
+
await this.started("throw");
|
|
181
|
+
const job = await this.jobPromise;
|
|
182
|
+
let index = 0;
|
|
183
|
+
let previousResults = {};
|
|
184
|
+
while (index < job.tasks.length) {
|
|
185
|
+
const generatedPayloads = await this.generateResults(job.tasks[index], previousResults, inPayloads);
|
|
186
|
+
previousResults = generatedPayloads;
|
|
187
|
+
index++;
|
|
188
|
+
}
|
|
189
|
+
return Object.values(previousResults).flat();
|
|
190
|
+
}
|
|
191
|
+
async start(timeout) {
|
|
192
|
+
if (await super.start(timeout)) {
|
|
193
|
+
if ((this.config.automations?.length ?? 0) > 0) {
|
|
194
|
+
this.runner = new SentinelRunner(this, this.config.automations);
|
|
195
|
+
await this.runner.start();
|
|
196
|
+
}
|
|
197
|
+
return true;
|
|
198
|
+
}
|
|
199
|
+
return false;
|
|
200
|
+
}
|
|
201
|
+
async stop(timeout) {
|
|
202
|
+
if (this.runner) {
|
|
203
|
+
this.runner.stop();
|
|
204
|
+
this.runner = void 0;
|
|
205
|
+
}
|
|
206
|
+
return await super.stop(timeout);
|
|
207
|
+
}
|
|
208
|
+
async generateResults(tasks, previousResults, inPayloads) {
|
|
209
|
+
const results = await Promise.allSettled(
|
|
210
|
+
tasks?.map(async (task) => {
|
|
211
|
+
const witness = asWitnessInstance(task.module);
|
|
212
|
+
const input = task.input ?? false;
|
|
213
|
+
const inPayloadsFound = input === true ? inPayloads : input === false ? [] : this.processPreviousResults(previousResults, await this.inputAddresses(input));
|
|
214
|
+
if (witness) {
|
|
215
|
+
return [witness.address, await witness.observe(inPayloadsFound)];
|
|
216
|
+
}
|
|
217
|
+
const diviner = asDivinerInstance(task.module);
|
|
218
|
+
if (diviner) {
|
|
219
|
+
return [diviner.address, await diviner.divine(inPayloadsFound)];
|
|
220
|
+
}
|
|
221
|
+
throw new Error("Unsupported module type");
|
|
222
|
+
})
|
|
223
|
+
);
|
|
224
|
+
const finalResult = {};
|
|
225
|
+
for (const result of results.filter(fulfilled)) {
|
|
226
|
+
const [address, payloads] = result.value;
|
|
227
|
+
finalResult[address] = finalResult[address] ?? [];
|
|
228
|
+
finalResult[address].push(...payloads);
|
|
229
|
+
}
|
|
230
|
+
if (this.throwErrors) {
|
|
231
|
+
const errors = results.filter(rejected).map((result) => result.reason);
|
|
232
|
+
if (errors.length > 0) {
|
|
233
|
+
throw new Error("At least one module failed");
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
return finalResult;
|
|
237
|
+
}
|
|
238
|
+
async inputAddresses(input) {
|
|
239
|
+
if (Array.isArray(input)) {
|
|
240
|
+
return (await Promise.all(input.map(async (inputItem) => await this.inputAddresses(inputItem)))).flat();
|
|
241
|
+
} else {
|
|
242
|
+
const resolved = await this.resolve(input);
|
|
243
|
+
return resolved ? [resolved.address] : [];
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
processPreviousResults(payloads, inputs) {
|
|
247
|
+
return inputs.flatMap((input) => payloads[input] ?? []);
|
|
208
248
|
}
|
|
209
249
|
};
|
|
210
250
|
|
|
@@ -238,12 +278,8 @@ export * from "@xyo-network/sentinel-abstract";
|
|
|
238
278
|
export * from "@xyo-network/sentinel-model";
|
|
239
279
|
export {
|
|
240
280
|
MemorySentinel,
|
|
241
|
-
SentinelAutomationSchema,
|
|
242
|
-
SentinelEventAutomationSchema,
|
|
243
|
-
SentinelIntervalAutomationSchema,
|
|
244
281
|
SentinelIntervalAutomationWrapper,
|
|
245
282
|
SentinelRunner,
|
|
246
|
-
SentinelWrapper
|
|
247
|
-
isSentinelIntervalAutomation
|
|
283
|
+
SentinelWrapper
|
|
248
284
|
};
|
|
249
285
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Automation.ts","../../src/MemorySentinel.ts","../../src/SentinelIntervalAutomationWrapper.ts","../../src/SentinelRunner.ts","../../src/Wrapper.ts","../../src/index.ts"],"sourcesContent":["import { isPayloadOfSchemaType, Payload } from '@xyo-network/payload-model'\nimport { Task } from '@xyo-network/sentinel-model'\n\nexport type SentinelAutomationSchema = 'network.xyo.automation'\nexport const SentinelAutomationSchema: SentinelAutomationSchema = 'network.xyo.automation'\n\nexport type SentinelIntervalAutomationSchema = 'network.xyo.automation.interval'\nexport const SentinelIntervalAutomationSchema: SentinelIntervalAutomationSchema = 'network.xyo.automation.interval'\n\nexport type SentinelEventAutomationSchema = 'network.xyo.automation.event'\nexport const SentinelEventAutomationSchema: SentinelEventAutomationSchema = 'network.xyo.automation.event'\n\nexport type SentinelBaseAutomationPayload<T extends Payload> = Payload<\n {\n tasks?: Task[]\n type?: 'interval' | 'event'\n } & T\n>\n\n/** Settings for an Interval Automation */\nexport type SentinelIntervalAutomationPayload = SentinelBaseAutomationPayload<{\n /** Epoch after which any reoccurrence stops */\n end?: number\n\n /** Time between triggers [non-repeating if undefined] */\n frequency?: number\n\n /** Units for frequency field [hour if undefined] */\n frequencyUnits?: 'second' | 'minute' | 'hour' | 'day'\n\n /** Remaining triggers [infinite if undefined] */\n remaining?: number\n\n schema: SentinelIntervalAutomationSchema\n\n /** Epoch of the next trigger */\n start: number\n\n /** The type of automation */\n type: 'interval'\n}>\n\nexport const isSentinelIntervalAutomation = isPayloadOfSchemaType<SentinelIntervalAutomationPayload>(SentinelIntervalAutomationSchema)\n\n/** Settings for an Event Automation */\nexport type SentinelEventAutomationPayload = SentinelBaseAutomationPayload<{\n schema: SentinelEventAutomationSchema\n type: 'event'\n}>\n\n/** Settings for an Automation */\nexport type SentinelAutomationPayload = Payload<\n SentinelIntervalAutomationPayload | SentinelEventAutomationPayload,\n SentinelAutomationSchema | SentinelIntervalAutomationSchema | SentinelEventAutomationSchema\n>\n","import { Address } from '@xylabs/hex'\nimport { fulfilled, rejected } from '@xylabs/promise'\nimport { asDivinerInstance } from '@xyo-network/diviner-model'\nimport { AnyConfigSchema } from '@xyo-network/module-model'\nimport { Payload } from '@xyo-network/payload-model'\nimport { AbstractSentinel } from '@xyo-network/sentinel-abstract'\nimport {\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\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 configSchemas = [SentinelConfigSchema]\n\n async reportHandler(inPayloads: Payload[] = []): Promise<Payload[]> {\n await this.started('throw')\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.generateResults(job.tasks[index], previousResults, inPayloads)\n previousResults = generatedPayloads\n index++\n }\n return Object.values(previousResults).flat()\n }\n\n private async generateResults(\n tasks: ResolvedTask[],\n previousResults: Record<Address, Payload[]>,\n inPayloads?: Payload[],\n ): Promise<Record<Address, Payload[]>> {\n const results: PromiseSettledResult<[Address, Payload[]]>[] = await Promise.allSettled(\n tasks?.map(async (task) => {\n const witness = asWitnessInstance(task.module)\n const input = task.input ?? false\n const inPayloadsFound =\n input === true ? inPayloads : input === false ? [] : this.processPreviousResults(previousResults, await this.inputAddresses(input))\n if (witness) {\n return [witness.address, await witness.observe(inPayloadsFound)]\n }\n const diviner = asDivinerInstance(task.module)\n if (diviner) {\n return [diviner.address, await diviner.divine(inPayloadsFound)]\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 return finalResult\n }\n\n private async inputAddresses(input: string | string[]): Promise<string[]> {\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","import { PayloadWrapper } from '@xyo-network/payload-wrapper'\n\nimport { SentinelIntervalAutomationPayload } from './Automation'\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.jsonPayload().frequency\n if (frequency === undefined) return Number.POSITIVE_INFINITY\n switch (this.jsonPayload().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 }\n }\n\n protected get remaining() {\n //if remaining is not defined, we assume Infinity\n return this.payload().remaining ?? Number.POSITIVE_INFINITY\n }\n\n next() {\n this.jsonPayload().start = this.jsonPayload().start + this.frequencyMillis\n this.consumeRemaining()\n this.checkEnd()\n return this\n }\n\n protected checkEnd() {\n if (this.jsonPayload().start > (this.jsonPayload().end ?? Number.POSITIVE_INFINITY)) {\n this.jsonPayload().start = Number.POSITIVE_INFINITY\n }\n }\n\n protected consumeRemaining(count = 1) {\n const remaining = this.remaining - count\n this.jsonPayload().remaining = remaining\n\n if (remaining <= 0) {\n this.jsonPayload().start = Number.POSITIVE_INFINITY\n }\n }\n}\n","import { assertEx } from '@xylabs/assert'\nimport { Payload } from '@xyo-network/payload-model'\nimport { PayloadWrapper } from '@xyo-network/payload-wrapper'\nimport { SentinelInstance } from '@xyo-network/sentinel-model'\n\nimport { isSentinelIntervalAutomation, SentinelAutomationPayload, SentinelIntervalAutomationPayload } from './Automation'\nimport { SentinelIntervalAutomationWrapper } from './SentinelIntervalAutomationWrapper'\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) 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 PayloadWrapper.hashAsync(automation)\n this._automations[hash] = automation\n if (restart) await this.restart()\n return hash\n }\n\n find(hash: string) {\n Object.entries(this._automations).find(([key]) => key === hash)\n }\n\n async remove(hash: string, restart = true) {\n delete this._automations[hash]\n if (restart) await this.restart()\n }\n\n removeAll() {\n this.stop()\n this._automations = {}\n }\n\n async restart() {\n this.stop()\n await this.start()\n }\n\n async start() {\n assertEx(this.timeoutId === undefined, 'Already started')\n const automation = this.next\n if (isSentinelIntervalAutomation(automation)) {\n const delay = automation.start - Date.now()\n if (delay < 0) {\n //automation is due, just do it\n await this.trigger(automation)\n } else {\n this.timeoutId = setTimeout(\n async () => {\n this.timeoutId = undefined\n await this.start()\n },\n delay > 0 ? delay : 0,\n )\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.hashAsync(), false)\n wrapper.next()\n await this.add(wrapper.jsonPayload(), false)\n const triggerResult = await this.sentinel.report()\n this.onTriggerResult?.(triggerResult)\n await this.start()\n }\n}\n","import { ArchivistInstance } from '@xyo-network/archivist'\nimport { constructableModuleWrapper, ModuleWrapper } from '@xyo-network/module-wrapper'\nimport { Payload } from '@xyo-network/payload-model'\nimport {\n isSentinelInstance,\n isSentinelModule,\n SentinelInstance,\n SentinelModule,\n SentinelReportQuery,\n SentinelReportQuerySchema,\n} from '@xyo-network/sentinel-model'\nimport { WitnessInstance } from '@xyo-network/witness-model'\n\nconstructableModuleWrapper()\nexport class SentinelWrapper<TModule extends SentinelModule = SentinelModule>\n extends ModuleWrapper<TModule>\n implements SentinelInstance<TModule['params']>\n{\n static override instanceIdentityCheck = isSentinelInstance\n static override moduleIdentityCheck = isSentinelModule\n static override requiredQueries = [SentinelReportQuerySchema, ...super.requiredQueries]\n\n archivists(): Promise<ArchivistInstance[]> {\n throw new Error('Not supported')\n }\n\n async report(payloads?: Payload[]): Promise<Payload[]> {\n const queryPayload: SentinelReportQuery = { schema: SentinelReportQuerySchema }\n const result = await this.sendQuery(queryPayload, payloads)\n return result\n }\n\n witnesses(): Promise<WitnessInstance[]> {\n throw new Error('Not supported')\n }\n}\n","export * from './Automation'\nexport * from './MemorySentinel'\nexport * from './SentinelIntervalAutomationWrapper'\nexport * from './SentinelRunner'\nexport * from './Wrapper'\nexport * from '@xyo-network/sentinel-abstract'\nexport * from '@xyo-network/sentinel-model'\n"],"mappings":";AAAA,SAAS,6BAAsC;AAIxC,IAAM,2BAAqD;AAG3D,IAAM,mCAAqE;AAG3E,IAAM,gCAA+D;AAgCrE,IAAM,+BAA+B,sBAAyD,gCAAgC;;;ACzCrI,SAAS,WAAW,gBAAgB;AACpC,SAAS,yBAAyB;AAGlC,SAAS,wBAAwB;AACjC;AAAA,EAGE;AAAA,OAIK;AACP,SAAS,yBAAyB;AAI3B,IAAM,iBAAN,cAGG,iBAAsC;AAAA,EAC9C,OAAgB,gBAAgB,CAAC,oBAAoB;AAAA,EAErD,MAAM,cAAc,aAAwB,CAAC,GAAuB;AAClE,UAAM,KAAK,QAAQ,OAAO;AAC1B,UAAM,MAAM,MAAM,KAAK;AAEvB,QAAI,QAAQ;AACZ,QAAI,kBAA8C,CAAC;AACnD,WAAO,QAAQ,IAAI,MAAM,QAAQ;AAC/B,YAAM,oBAAoB,MAAM,KAAK,gBAAgB,IAAI,MAAM,KAAK,GAAG,iBAAiB,UAAU;AAClG,wBAAkB;AAClB;AAAA,IACF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AAA,EACtC,OAAgB,kBAAkB,CAAC,2BAA2B,GAAG,MAAM,eAAe;AAAA,EAEtF,aAA2C;AACzC,UAAM,IAAI,MAAM,eAAe;AAAA,EACjC;AAAA,EAEA,MAAM,OAAO,UAA0C;AACrD,UAAM,eAAoC,EAAE,QAAQ,0BAA0B;AAC9E,UAAM,SAAS,MAAM,KAAK,UAAU,cAAc,QAAQ;AAC1D,WAAO;AAAA,EACT;AAAA,EAEA,YAAwC;AACtC,UAAM,IAAI,MAAM,eAAe;AAAA,EACjC;AACF;;;AC9BA,cAAc;AACd,cAAc;","names":["PayloadWrapper","PayloadWrapper"]}
|
|
1
|
+
{"version":3,"sources":["../../src/MemorySentinel.ts","../../src/SentinelRunner.ts","../../src/SentinelIntervalAutomationWrapper.ts","../../src/Wrapper.ts","../../src/index.ts"],"sourcesContent":["import { Address } from '@xylabs/hex'\nimport { fulfilled, rejected } from '@xylabs/promise'\nimport { asDivinerInstance } from '@xyo-network/diviner-model'\nimport { AnyConfigSchema } from '@xyo-network/module-model'\nimport { Payload } from '@xyo-network/payload-model'\nimport { AbstractSentinel } from '@xyo-network/sentinel-abstract'\nimport {\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'\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 configSchemas = [SentinelConfigSchema]\n\n private runner?: SentinelRunner\n\n async reportHandler(inPayloads: Payload[] = []): Promise<Payload[]> {\n await this.started('throw')\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.generateResults(job.tasks[index], previousResults, inPayloads)\n previousResults = generatedPayloads\n index++\n }\n return Object.values(previousResults).flat()\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 await 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 generateResults(\n tasks: ResolvedTask[],\n previousResults: Record<Address, Payload[]>,\n inPayloads?: Payload[],\n ): Promise<Record<Address, Payload[]>> {\n const results: PromiseSettledResult<[Address, Payload[]]>[] = await Promise.allSettled(\n tasks?.map(async (task) => {\n const witness = asWitnessInstance(task.module)\n const input = task.input ?? false\n const inPayloadsFound =\n input === true ? inPayloads : input === false ? [] : this.processPreviousResults(previousResults, await this.inputAddresses(input))\n if (witness) {\n return [witness.address, await witness.observe(inPayloadsFound)]\n }\n const diviner = asDivinerInstance(task.module)\n if (diviner) {\n return [diviner.address, await diviner.divine(inPayloadsFound)]\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 return finalResult\n }\n\n private async inputAddresses(input: string | string[]): Promise<string[]> {\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","import { assertEx } from '@xylabs/assert'\nimport { Payload } from '@xyo-network/payload-model'\nimport { PayloadWrapper } from '@xyo-network/payload-wrapper'\nimport {\n isSentinelIntervalAutomation,\n SentinelAutomationPayload,\n SentinelInstance,\n SentinelIntervalAutomationPayload,\n} from '@xyo-network/sentinel-model'\n\nimport { SentinelIntervalAutomationWrapper } from './SentinelIntervalAutomationWrapper'\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) 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 PayloadWrapper.hashAsync(automation)\n this._automations[hash] = automation\n if (restart) await this.restart()\n return hash\n }\n\n find(hash: string) {\n Object.entries(this._automations).find(([key]) => key === hash)\n }\n\n async remove(hash: string, restart = true) {\n delete this._automations[hash]\n if (restart) await this.restart()\n }\n\n removeAll() {\n this.stop()\n this._automations = {}\n }\n\n async restart() {\n this.stop()\n await this.start()\n }\n\n async start() {\n // NOTE: Keep async to match module start signature\n await Promise.resolve()\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 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 await 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.hashAsync(), false)\n wrapper.next()\n await this.add(wrapper.jsonPayload(), 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.jsonPayload().frequency\n if (frequency === undefined) return Number.POSITIVE_INFINITY\n const frequencyUnits = this.jsonPayload().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.jsonPayload().remaining ?? Number.POSITIVE_INFINITY\n }\n\n next() {\n const now = Date.now()\n const previousStart = this.jsonPayload()?.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.jsonPayload().start > (this.jsonPayload().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.obj.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.obj.start = start\n }\n}\n","import { ArchivistInstance } from '@xyo-network/archivist'\nimport { constructableModuleWrapper, ModuleWrapper } from '@xyo-network/module-wrapper'\nimport { Payload } from '@xyo-network/payload-model'\nimport {\n isSentinelInstance,\n isSentinelModule,\n SentinelInstance,\n SentinelModule,\n SentinelReportQuery,\n SentinelReportQuerySchema,\n} from '@xyo-network/sentinel-model'\nimport { WitnessInstance } from '@xyo-network/witness-model'\n\nconstructableModuleWrapper()\nexport class SentinelWrapper<TModule extends SentinelModule = SentinelModule>\n extends ModuleWrapper<TModule>\n implements SentinelInstance<TModule['params']>\n{\n static override instanceIdentityCheck = isSentinelInstance\n static override moduleIdentityCheck = isSentinelModule\n static override requiredQueries = [SentinelReportQuerySchema, ...super.requiredQueries]\n\n archivists(): Promise<ArchivistInstance[]> {\n throw new Error('Not supported')\n }\n\n async report(payloads?: Payload[]): Promise<Payload[]> {\n const queryPayload: SentinelReportQuery = { schema: SentinelReportQuerySchema }\n const result = await this.sendQuery(queryPayload, payloads)\n return result\n }\n\n witnesses(): Promise<WitnessInstance[]> {\n throw new Error('Not supported')\n }\n}\n","export * from './MemorySentinel'\nexport * from './SentinelIntervalAutomationWrapper'\nexport * from './SentinelRunner'\nexport * from './Wrapper'\nexport * from '@xyo-network/sentinel-abst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CAAC;AAAA,EACxD;AACF;;;AG5GA,SAAS,4BAA4B,qBAAqB;AAE1D;AAAA,EACE;AAAA,EACA;AAAA,EAIA;AAAA,OACK;AAGP,2BAA2B;AACpB,IAAM,kBAAN,cACG,cAEV;AAAA,EACE,OAAgB,wBAAwB;AAAA,EACxC,OAAgB,sBAAsB;AAAA,EACtC,OAAgB,kBAAkB,CAAC,2BAA2B,GAAG,MAAM,eAAe;AAAA,EAEtF,aAA2C;AACzC,UAAM,IAAI,MAAM,eAAe;AAAA,EACjC;AAAA,EAEA,MAAM,OAAO,UAA0C;AACrD,UAAM,eAAoC,EAAE,QAAQ,0BAA0B;AAC9E,UAAM,SAAS,MAAM,KAAK,UAAU,cAAc,QAAQ;AAC1D,WAAO;AAAA,EACT;AAAA,EAEA,YAAwC;AACtC,UAAM,IAAI,MAAM,eAAe;AAAA,EACjC;AACF;;;AC/BA,cAAc;AACd,cAAc;","names":["PayloadWrapper","PayloadWrapper"]}
|
|
@@ -5,7 +5,10 @@ import { SentinelConfig, SentinelInstance, SentinelModuleEventData, SentinelPara
|
|
|
5
5
|
export type MemorySentinelParams<TConfig extends AnyConfigSchema<SentinelConfig> = AnyConfigSchema<SentinelConfig>> = SentinelParams<TConfig>;
|
|
6
6
|
export declare class MemorySentinel<TParams extends MemorySentinelParams = MemorySentinelParams, TEventData extends SentinelModuleEventData<SentinelInstance<TParams>> = SentinelModuleEventData<SentinelInstance<TParams>>> extends AbstractSentinel<TParams, TEventData> {
|
|
7
7
|
static configSchemas: "network.xyo.sentinel.config"[];
|
|
8
|
+
private runner?;
|
|
8
9
|
reportHandler(inPayloads?: Payload[]): Promise<Payload[]>;
|
|
10
|
+
start(timeout?: number | undefined): Promise<boolean>;
|
|
11
|
+
stop(timeout?: number | undefined): Promise<boolean>;
|
|
9
12
|
private generateResults;
|
|
10
13
|
private inputAddresses;
|
|
11
14
|
private processPreviousResults;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MemorySentinel.d.ts","sourceRoot":"","sources":["../../src/MemorySentinel.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AACjE,OAAO,EAEL,cAAc,EAEd,gBAAgB,EAChB,uBAAuB,EACvB,cAAc,EACf,MAAM,6BAA6B,CAAA;
|
|
1
|
+
{"version":3,"file":"MemorySentinel.d.ts","sourceRoot":"","sources":["../../src/MemorySentinel.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AACjE,OAAO,EAEL,cAAc,EAEd,gBAAgB,EAChB,uBAAuB,EACvB,cAAc,EACf,MAAM,6BAA6B,CAAA;AAKpC,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,OAAgB,aAAa,kCAAyB;IAEtD,OAAO,CAAC,MAAM,CAAC,CAAgB;IAEzB,aAAa,CAAC,UAAU,GAAE,OAAO,EAAO,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAcpD,KAAK,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC;IAWrD,IAAI,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC;YAQrD,eAAe;YAoCf,cAAc;IAS5B,OAAO,CAAC,sBAAsB;CAG/B"}
|
|
@@ -5,7 +5,10 @@ import { SentinelConfig, SentinelInstance, SentinelModuleEventData, SentinelPara
|
|
|
5
5
|
export type MemorySentinelParams<TConfig extends AnyConfigSchema<SentinelConfig> = AnyConfigSchema<SentinelConfig>> = SentinelParams<TConfig>;
|
|
6
6
|
export declare class MemorySentinel<TParams extends MemorySentinelParams = MemorySentinelParams, TEventData extends SentinelModuleEventData<SentinelInstance<TParams>> = SentinelModuleEventData<SentinelInstance<TParams>>> extends AbstractSentinel<TParams, TEventData> {
|
|
7
7
|
static configSchemas: "network.xyo.sentinel.config"[];
|
|
8
|
+
private runner?;
|
|
8
9
|
reportHandler(inPayloads?: Payload[]): Promise<Payload[]>;
|
|
10
|
+
start(timeout?: number | undefined): Promise<boolean>;
|
|
11
|
+
stop(timeout?: number | undefined): Promise<boolean>;
|
|
9
12
|
private generateResults;
|
|
10
13
|
private inputAddresses;
|
|
11
14
|
private processPreviousResults;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MemorySentinel.d.ts","sourceRoot":"","sources":["../../src/MemorySentinel.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AACjE,OAAO,EAEL,cAAc,EAEd,gBAAgB,EAChB,uBAAuB,EACvB,cAAc,EACf,MAAM,6BAA6B,CAAA;
|
|
1
|
+
{"version":3,"file":"MemorySentinel.d.ts","sourceRoot":"","sources":["../../src/MemorySentinel.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AACjE,OAAO,EAEL,cAAc,EAEd,gBAAgB,EAChB,uBAAuB,EACvB,cAAc,EACf,MAAM,6BAA6B,CAAA;AAKpC,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,OAAgB,aAAa,kCAAyB;IAEtD,OAAO,CAAC,MAAM,CAAC,CAAgB;IAEzB,aAAa,CAAC,UAAU,GAAE,OAAO,EAAO,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAcpD,KAAK,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC;IAWrD,IAAI,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC;YAQrD,eAAe;YAoCf,cAAc;IAS5B,OAAO,CAAC,sBAAsB;CAG/B"}
|
|
@@ -5,7 +5,10 @@ import { SentinelConfig, SentinelInstance, SentinelModuleEventData, SentinelPara
|
|
|
5
5
|
export type MemorySentinelParams<TConfig extends AnyConfigSchema<SentinelConfig> = AnyConfigSchema<SentinelConfig>> = SentinelParams<TConfig>;
|
|
6
6
|
export declare class MemorySentinel<TParams extends MemorySentinelParams = MemorySentinelParams, TEventData extends SentinelModuleEventData<SentinelInstance<TParams>> = SentinelModuleEventData<SentinelInstance<TParams>>> extends AbstractSentinel<TParams, TEventData> {
|
|
7
7
|
static configSchemas: "network.xyo.sentinel.config"[];
|
|
8
|
+
private runner?;
|
|
8
9
|
reportHandler(inPayloads?: Payload[]): Promise<Payload[]>;
|
|
10
|
+
start(timeout?: number | undefined): Promise<boolean>;
|
|
11
|
+
stop(timeout?: number | undefined): Promise<boolean>;
|
|
9
12
|
private generateResults;
|
|
10
13
|
private inputAddresses;
|
|
11
14
|
private processPreviousResults;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MemorySentinel.d.ts","sourceRoot":"","sources":["../../src/MemorySentinel.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AACjE,OAAO,EAEL,cAAc,EAEd,gBAAgB,EAChB,uBAAuB,EACvB,cAAc,EACf,MAAM,6BAA6B,CAAA;
|
|
1
|
+
{"version":3,"file":"MemorySentinel.d.ts","sourceRoot":"","sources":["../../src/MemorySentinel.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AACjE,OAAO,EAEL,cAAc,EAEd,gBAAgB,EAChB,uBAAuB,EACvB,cAAc,EACf,MAAM,6BAA6B,CAAA;AAKpC,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,OAAgB,aAAa,kCAAyB;IAEtD,OAAO,CAAC,MAAM,CAAC,CAAgB;IAEzB,aAAa,CAAC,UAAU,GAAE,OAAO,EAAO,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAcpD,KAAK,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC;IAWrD,IAAI,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC;YAQrD,eAAe;YAoCf,cAAc;IAS5B,OAAO,CAAC,sBAAsB;CAG/B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PayloadWrapper } from '@xyo-network/payload-wrapper';
|
|
2
|
-
import { SentinelIntervalAutomationPayload } from '
|
|
2
|
+
import { SentinelIntervalAutomationPayload } from '@xyo-network/sentinel-model';
|
|
3
3
|
export declare class SentinelIntervalAutomationWrapper<T extends SentinelIntervalAutomationPayload = SentinelIntervalAutomationPayload> extends PayloadWrapper<T> {
|
|
4
4
|
constructor(payload: T);
|
|
5
5
|
protected get frequencyMillis(): number;
|
|
@@ -7,5 +7,15 @@ export declare class SentinelIntervalAutomationWrapper<T extends SentinelInterva
|
|
|
7
7
|
next(): this;
|
|
8
8
|
protected checkEnd(): void;
|
|
9
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;
|
|
10
20
|
}
|
|
11
21
|
//# sourceMappingURL=SentinelIntervalAutomationWrapper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SentinelIntervalAutomationWrapper.d.ts","sourceRoot":"","sources":["../../src/SentinelIntervalAutomationWrapper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;
|
|
1
|
+
{"version":3,"file":"SentinelIntervalAutomationWrapper.d.ts","sourceRoot":"","sources":["../../src/SentinelIntervalAutomationWrapper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAC7D,OAAO,EAAE,iCAAiC,EAAE,MAAM,6BAA6B,CAAA;AAE/E,qBAAa,iCAAiC,CAC5C,CAAC,SAAS,iCAAiC,GAAG,iCAAiC,CAC/E,SAAQ,cAAc,CAAC,CAAC,CAAC;gBACb,OAAO,EAAE,CAAC;IAItB,SAAS,KAAK,eAAe,WAqB5B;IAED,SAAS,KAAK,SAAS,WAEtB;IAED,IAAI;IAWJ,SAAS,CAAC,QAAQ;IAMlB,SAAS,CAAC,gBAAgB,CAAC,KAAK,SAAI;IAMpC;;;OAGG;IACH,SAAS,CAAC,YAAY,CAAC,SAAS,EAAE,MAAM;IAIxC;;;OAGG;IACH,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,MAAM;CAGjC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PayloadWrapper } from '@xyo-network/payload-wrapper';
|
|
2
|
-
import { SentinelIntervalAutomationPayload } from '
|
|
2
|
+
import { SentinelIntervalAutomationPayload } from '@xyo-network/sentinel-model';
|
|
3
3
|
export declare class SentinelIntervalAutomationWrapper<T extends SentinelIntervalAutomationPayload = SentinelIntervalAutomationPayload> extends PayloadWrapper<T> {
|
|
4
4
|
constructor(payload: T);
|
|
5
5
|
protected get frequencyMillis(): number;
|
|
@@ -7,5 +7,15 @@ export declare class SentinelIntervalAutomationWrapper<T extends SentinelInterva
|
|
|
7
7
|
next(): this;
|
|
8
8
|
protected checkEnd(): void;
|
|
9
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;
|
|
10
20
|
}
|
|
11
21
|
//# sourceMappingURL=SentinelIntervalAutomationWrapper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SentinelIntervalAutomationWrapper.d.ts","sourceRoot":"","sources":["../../src/SentinelIntervalAutomationWrapper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;
|
|
1
|
+
{"version":3,"file":"SentinelIntervalAutomationWrapper.d.ts","sourceRoot":"","sources":["../../src/SentinelIntervalAutomationWrapper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAC7D,OAAO,EAAE,iCAAiC,EAAE,MAAM,6BAA6B,CAAA;AAE/E,qBAAa,iCAAiC,CAC5C,CAAC,SAAS,iCAAiC,GAAG,iCAAiC,CAC/E,SAAQ,cAAc,CAAC,CAAC,CAAC;gBACb,OAAO,EAAE,CAAC;IAItB,SAAS,KAAK,eAAe,WAqB5B;IAED,SAAS,KAAK,SAAS,WAEtB;IAED,IAAI;IAWJ,SAAS,CAAC,QAAQ;IAMlB,SAAS,CAAC,gBAAgB,CAAC,KAAK,SAAI;IAMpC;;;OAGG;IACH,SAAS,CAAC,YAAY,CAAC,SAAS,EAAE,MAAM;IAIxC;;;OAGG;IACH,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,MAAM;CAGjC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PayloadWrapper } from '@xyo-network/payload-wrapper';
|
|
2
|
-
import { SentinelIntervalAutomationPayload } from '
|
|
2
|
+
import { SentinelIntervalAutomationPayload } from '@xyo-network/sentinel-model';
|
|
3
3
|
export declare class SentinelIntervalAutomationWrapper<T extends SentinelIntervalAutomationPayload = SentinelIntervalAutomationPayload> extends PayloadWrapper<T> {
|
|
4
4
|
constructor(payload: T);
|
|
5
5
|
protected get frequencyMillis(): number;
|
|
@@ -7,5 +7,15 @@ export declare class SentinelIntervalAutomationWrapper<T extends SentinelInterva
|
|
|
7
7
|
next(): this;
|
|
8
8
|
protected checkEnd(): void;
|
|
9
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;
|
|
10
20
|
}
|
|
11
21
|
//# sourceMappingURL=SentinelIntervalAutomationWrapper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SentinelIntervalAutomationWrapper.d.ts","sourceRoot":"","sources":["../../src/SentinelIntervalAutomationWrapper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;
|
|
1
|
+
{"version":3,"file":"SentinelIntervalAutomationWrapper.d.ts","sourceRoot":"","sources":["../../src/SentinelIntervalAutomationWrapper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAC7D,OAAO,EAAE,iCAAiC,EAAE,MAAM,6BAA6B,CAAA;AAE/E,qBAAa,iCAAiC,CAC5C,CAAC,SAAS,iCAAiC,GAAG,iCAAiC,CAC/E,SAAQ,cAAc,CAAC,CAAC,CAAC;gBACb,OAAO,EAAE,CAAC;IAItB,SAAS,KAAK,eAAe,WAqB5B;IAED,SAAS,KAAK,SAAS,WAEtB;IAED,IAAI;IAWJ,SAAS,CAAC,QAAQ;IAMlB,SAAS,CAAC,gBAAgB,CAAC,KAAK,SAAI;IAMpC;;;OAGG;IACH,SAAS,CAAC,YAAY,CAAC,SAAS,EAAE,MAAM;IAIxC;;;OAGG;IACH,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,MAAM;CAGjC"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { Payload } from '@xyo-network/payload-model';
|
|
3
|
-
import { SentinelInstance } from '@xyo-network/sentinel-model';
|
|
4
|
-
import { SentinelAutomationPayload } from './Automation';
|
|
3
|
+
import { SentinelAutomationPayload, SentinelInstance } from '@xyo-network/sentinel-model';
|
|
5
4
|
export type OnSentinelRunnerTriggerResult = (result: Payload[]) => void;
|
|
6
5
|
export declare class SentinelRunner {
|
|
7
6
|
protected _automations: Record<string, SentinelAutomationPayload>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SentinelRunner.d.ts","sourceRoot":"","sources":["../../src/SentinelRunner.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAEpD,OAAO,
|
|
1
|
+
{"version":3,"file":"SentinelRunner.d.ts","sourceRoot":"","sources":["../../src/SentinelRunner.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAEpD,OAAO,EAEL,yBAAyB,EACzB,gBAAgB,EAEjB,MAAM,6BAA6B,CAAA;AAIpC,MAAM,MAAM,6BAA6B,GAAG,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,IAAI,CAAA;AAEvE,qBAAa,cAAc;IACzB,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,MAAM,CAAC,OAAO,GAAG,MAAM,GAAG,MAAM,CAAA;gBAE1C,QAAQ,EAAE,gBAAgB,EAAE,WAAW,CAAC,EAAE,yBAAyB,EAAE,EAAE,eAAe,CAAC,EAAE,6BAA6B;IAMlI,IAAI,WAAW,8CAEd;IAED,OAAO,KAAK,IAAI,GASf;IAEK,GAAG,CAAC,UAAU,EAAE,yBAAyB,EAAE,OAAO,UAAO;IAO/D,IAAI,CAAC,IAAI,EAAE,MAAM;IAIX,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,UAAO;IAKzC,SAAS;IAKH,OAAO;IAKP,KAAK;IAwBX,IAAI;IAOE,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,yBAAyB,EAAE,OAAO,UAAO;YAMlE,OAAO;CAStB"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { Payload } from '@xyo-network/payload-model';
|
|
3
|
-
import { SentinelInstance } from '@xyo-network/sentinel-model';
|
|
4
|
-
import { SentinelAutomationPayload } from './Automation';
|
|
3
|
+
import { SentinelAutomationPayload, SentinelInstance } from '@xyo-network/sentinel-model';
|
|
5
4
|
export type OnSentinelRunnerTriggerResult = (result: Payload[]) => void;
|
|
6
5
|
export declare class SentinelRunner {
|
|
7
6
|
protected _automations: Record<string, SentinelAutomationPayload>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SentinelRunner.d.ts","sourceRoot":"","sources":["../../src/SentinelRunner.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAEpD,OAAO,
|
|
1
|
+
{"version":3,"file":"SentinelRunner.d.ts","sourceRoot":"","sources":["../../src/SentinelRunner.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAEpD,OAAO,EAEL,yBAAyB,EACzB,gBAAgB,EAEjB,MAAM,6BAA6B,CAAA;AAIpC,MAAM,MAAM,6BAA6B,GAAG,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,IAAI,CAAA;AAEvE,qBAAa,cAAc;IACzB,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,MAAM,CAAC,OAAO,GAAG,MAAM,GAAG,MAAM,CAAA;gBAE1C,QAAQ,EAAE,gBAAgB,EAAE,WAAW,CAAC,EAAE,yBAAyB,EAAE,EAAE,eAAe,CAAC,EAAE,6BAA6B;IAMlI,IAAI,WAAW,8CAEd;IAED,OAAO,KAAK,IAAI,GASf;IAEK,GAAG,CAAC,UAAU,EAAE,yBAAyB,EAAE,OAAO,UAAO;IAO/D,IAAI,CAAC,IAAI,EAAE,MAAM;IAIX,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,UAAO;IAKzC,SAAS;IAKH,OAAO;IAKP,KAAK;IAwBX,IAAI;IAOE,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,yBAAyB,EAAE,OAAO,UAAO;YAMlE,OAAO;CAStB"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { Payload } from '@xyo-network/payload-model';
|
|
3
|
-
import { SentinelInstance } from '@xyo-network/sentinel-model';
|
|
4
|
-
import { SentinelAutomationPayload } from './Automation';
|
|
3
|
+
import { SentinelAutomationPayload, SentinelInstance } from '@xyo-network/sentinel-model';
|
|
5
4
|
export type OnSentinelRunnerTriggerResult = (result: Payload[]) => void;
|
|
6
5
|
export declare class SentinelRunner {
|
|
7
6
|
protected _automations: Record<string, SentinelAutomationPayload>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SentinelRunner.d.ts","sourceRoot":"","sources":["../../src/SentinelRunner.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAEpD,OAAO,
|
|
1
|
+
{"version":3,"file":"SentinelRunner.d.ts","sourceRoot":"","sources":["../../src/SentinelRunner.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAEpD,OAAO,EAEL,yBAAyB,EACzB,gBAAgB,EAEjB,MAAM,6BAA6B,CAAA;AAIpC,MAAM,MAAM,6BAA6B,GAAG,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,IAAI,CAAA;AAEvE,qBAAa,cAAc;IACzB,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,MAAM,CAAC,OAAO,GAAG,MAAM,GAAG,MAAM,CAAA;gBAE1C,QAAQ,EAAE,gBAAgB,EAAE,WAAW,CAAC,EAAE,yBAAyB,EAAE,EAAE,eAAe,CAAC,EAAE,6BAA6B;IAMlI,IAAI,WAAW,8CAEd;IAED,OAAO,KAAK,IAAI,GASf;IAEK,GAAG,CAAC,UAAU,EAAE,yBAAyB,EAAE,OAAO,UAAO;IAO/D,IAAI,CAAC,IAAI,EAAE,MAAM;IAIX,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,UAAO;IAKzC,SAAS;IAKH,OAAO;IAKP,KAAK;IAwBX,IAAI;IAOE,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,yBAAyB,EAAE,OAAO,UAAO;YAMlE,OAAO;CAStB"}
|