@xyo-network/sentinel 2.74.4 → 2.75.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.
- package/dist/browser/AbstractSentinel.cjs +113 -0
- package/dist/browser/AbstractSentinel.cjs.map +1 -0
- package/dist/browser/AbstractSentinel.d.mts.map +1 -0
- package/dist/browser/AbstractSentinel.d.ts.map +1 -0
- package/dist/browser/AbstractSentinel.js +94 -0
- package/dist/browser/AbstractSentinel.js.map +1 -0
- package/dist/browser/Automation.cjs +27 -0
- package/dist/browser/Automation.cjs.map +1 -0
- package/dist/browser/Automation.d.mts.map +1 -0
- package/dist/browser/Automation.d.ts.map +1 -0
- package/dist/browser/Automation.js +6 -0
- package/dist/browser/Automation.js.map +1 -0
- package/dist/browser/MemorySentinel.cjs +149 -0
- package/dist/browser/MemorySentinel.cjs.map +1 -0
- package/dist/browser/MemorySentinel.d.mts.map +1 -0
- package/dist/browser/MemorySentinel.d.ts.map +1 -0
- package/dist/browser/MemorySentinel.js +133 -0
- package/dist/browser/MemorySentinel.js.map +1 -0
- package/dist/browser/SentinelIntervalAutomationWrapper.cjs +68 -0
- package/dist/browser/SentinelIntervalAutomationWrapper.cjs.map +1 -0
- package/dist/browser/SentinelIntervalAutomationWrapper.d.mts.map +1 -0
- package/dist/browser/SentinelIntervalAutomationWrapper.d.ts.map +1 -0
- package/dist/browser/SentinelIntervalAutomationWrapper.js +47 -0
- package/dist/browser/SentinelIntervalAutomationWrapper.js.map +1 -0
- package/dist/browser/SentinelRunner.cjs +157 -0
- package/dist/browser/SentinelRunner.cjs.map +1 -0
- package/dist/browser/SentinelRunner.d.mts.map +1 -0
- package/dist/browser/SentinelRunner.d.ts.map +1 -0
- package/dist/browser/SentinelRunner.js +136 -0
- package/dist/browser/SentinelRunner.js.map +1 -0
- package/dist/browser/Wrapper.cjs +45 -0
- package/dist/browser/Wrapper.cjs.map +1 -0
- package/dist/browser/Wrapper.d.mts.map +1 -0
- package/dist/browser/Wrapper.d.ts.map +1 -0
- package/dist/browser/Wrapper.js +28 -0
- package/dist/browser/Wrapper.js.map +1 -0
- package/dist/{index.js → browser/index.cjs} +1 -11
- package/dist/browser/index.cjs.map +1 -0
- package/dist/browser/index.d.mts.map +1 -0
- package/dist/browser/index.d.ts.map +1 -0
- package/dist/{index.mjs → browser/index.js} +1 -1
- package/dist/browser/index.js.map +1 -0
- package/dist/node/AbstractSentinel.d.mts +22 -0
- package/dist/node/AbstractSentinel.d.mts.map +1 -0
- package/dist/node/AbstractSentinel.d.ts +22 -0
- package/dist/node/AbstractSentinel.d.ts.map +1 -0
- package/dist/node/AbstractSentinel.js +115 -0
- package/dist/node/AbstractSentinel.js.map +1 -0
- package/dist/node/AbstractSentinel.mjs +93 -0
- package/dist/node/AbstractSentinel.mjs.map +1 -0
- package/dist/node/Automation.d.mts +28 -0
- package/dist/node/Automation.d.mts.map +1 -0
- package/dist/node/Automation.d.ts +28 -0
- package/dist/node/Automation.d.ts.map +1 -0
- package/dist/node/Automation.js +29 -0
- package/dist/node/Automation.js.map +1 -0
- package/dist/node/Automation.mjs +5 -0
- package/dist/node/Automation.mjs.map +1 -0
- package/dist/node/MemorySentinel.d.mts +10 -0
- package/dist/node/MemorySentinel.d.mts.map +1 -0
- package/dist/node/MemorySentinel.d.ts +10 -0
- package/dist/node/MemorySentinel.d.ts.map +1 -0
- package/dist/node/MemorySentinel.js +61 -0
- package/dist/node/MemorySentinel.js.map +1 -0
- package/dist/node/MemorySentinel.mjs +40 -0
- package/dist/node/MemorySentinel.mjs.map +1 -0
- package/dist/node/SentinelIntervalAutomationWrapper.d.mts +11 -0
- package/dist/node/SentinelIntervalAutomationWrapper.d.mts.map +1 -0
- package/dist/node/SentinelIntervalAutomationWrapper.d.ts +11 -0
- package/dist/node/SentinelIntervalAutomationWrapper.d.ts.map +1 -0
- package/dist/node/SentinelIntervalAutomationWrapper.js +70 -0
- package/dist/node/SentinelIntervalAutomationWrapper.js.map +1 -0
- package/dist/node/SentinelIntervalAutomationWrapper.mjs +46 -0
- package/dist/node/SentinelIntervalAutomationWrapper.mjs.map +1 -0
- package/dist/node/SentinelRunner.d.mts +24 -0
- package/dist/node/SentinelRunner.d.mts.map +1 -0
- package/dist/node/SentinelRunner.d.ts +24 -0
- package/dist/node/SentinelRunner.d.ts.map +1 -0
- package/dist/node/SentinelRunner.js +114 -0
- package/dist/node/SentinelRunner.js.map +1 -0
- package/dist/node/SentinelRunner.mjs +90 -0
- package/dist/node/SentinelRunner.mjs.map +1 -0
- package/dist/node/Wrapper.d.mts +14 -0
- package/dist/node/Wrapper.d.mts.map +1 -0
- package/dist/node/Wrapper.d.ts +14 -0
- package/dist/node/Wrapper.d.ts.map +1 -0
- package/dist/node/Wrapper.js +47 -0
- package/dist/node/Wrapper.js.map +1 -0
- package/dist/node/Wrapper.mjs +27 -0
- package/dist/node/Wrapper.mjs.map +1 -0
- package/dist/node/index.d.mts +8 -0
- package/dist/node/index.d.mts.map +1 -0
- package/dist/node/index.d.ts +8 -0
- package/dist/node/index.d.ts.map +1 -0
- package/dist/node/index.js +35 -0
- package/dist/node/index.js.map +1 -0
- package/dist/node/index.mjs +8 -0
- package/dist/node/index.mjs.map +1 -0
- package/package.json +37 -34
- package/dist/AbstractSentinel.d.mts.map +0 -1
- package/dist/AbstractSentinel.d.ts.map +0 -1
- package/dist/Automation.d.mts.map +0 -1
- package/dist/Automation.d.ts.map +0 -1
- package/dist/MemorySentinel.d.mts.map +0 -1
- package/dist/MemorySentinel.d.ts.map +0 -1
- package/dist/SentinelIntervalAutomationWrapper.d.mts.map +0 -1
- package/dist/SentinelIntervalAutomationWrapper.d.ts.map +0 -1
- package/dist/SentinelRunner.d.mts.map +0 -1
- package/dist/SentinelRunner.d.ts.map +0 -1
- package/dist/Wrapper.d.mts.map +0 -1
- package/dist/Wrapper.d.ts.map +0 -1
- package/dist/docs.json +0 -63876
- package/dist/index.d.mts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/index.mjs.map +0 -1
- /package/dist/{AbstractSentinel.d.mts → browser/AbstractSentinel.d.mts} +0 -0
- /package/dist/{AbstractSentinel.d.ts → browser/AbstractSentinel.d.ts} +0 -0
- /package/dist/{Automation.d.mts → browser/Automation.d.mts} +0 -0
- /package/dist/{Automation.d.ts → browser/Automation.d.ts} +0 -0
- /package/dist/{MemorySentinel.d.mts → browser/MemorySentinel.d.mts} +0 -0
- /package/dist/{MemorySentinel.d.ts → browser/MemorySentinel.d.ts} +0 -0
- /package/dist/{SentinelIntervalAutomationWrapper.d.mts → browser/SentinelIntervalAutomationWrapper.d.mts} +0 -0
- /package/dist/{SentinelIntervalAutomationWrapper.d.ts → browser/SentinelIntervalAutomationWrapper.d.ts} +0 -0
- /package/dist/{SentinelRunner.d.mts → browser/SentinelRunner.d.mts} +0 -0
- /package/dist/{SentinelRunner.d.ts → browser/SentinelRunner.d.ts} +0 -0
- /package/dist/{Wrapper.d.mts → browser/Wrapper.d.mts} +0 -0
- /package/dist/{Wrapper.d.ts → browser/Wrapper.d.ts} +0 -0
- /package/dist/{index.d.mts → browser/index.d.mts} +0 -0
- /package/dist/{index.d.ts → browser/index.d.ts} +0 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var MemorySentinel_exports = {};
|
|
20
|
+
__export(MemorySentinel_exports, {
|
|
21
|
+
MemorySentinel: () => MemorySentinel
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(MemorySentinel_exports);
|
|
24
|
+
var import_assert = require("@xylabs/assert");
|
|
25
|
+
var import_promise = require("@xylabs/promise");
|
|
26
|
+
var import_error = require("@xyo-network/error");
|
|
27
|
+
var import_sentinel_model = require("@xyo-network/sentinel-model");
|
|
28
|
+
var import_AbstractSentinel = require("./AbstractSentinel");
|
|
29
|
+
class MemorySentinel extends import_AbstractSentinel.AbstractSentinel {
|
|
30
|
+
static configSchemas = [import_sentinel_model.SentinelConfigSchema];
|
|
31
|
+
async reportHandler(payloads = []) {
|
|
32
|
+
await this.started("throw");
|
|
33
|
+
const errors = [];
|
|
34
|
+
const allWitnesses = [...await this.witnesses()];
|
|
35
|
+
const resultPayloads = [];
|
|
36
|
+
try {
|
|
37
|
+
const [generatedPayloads, generatedErrors] = await this.generateResults(allWitnesses);
|
|
38
|
+
const combinedPayloads = [...generatedPayloads, ...payloads];
|
|
39
|
+
resultPayloads.push(...combinedPayloads);
|
|
40
|
+
errors.push(...generatedErrors);
|
|
41
|
+
} catch (ex) {
|
|
42
|
+
(0, import_error.handleError)(ex, (error) => {
|
|
43
|
+
errors.push(error);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
const [boundWitness] = await this.bindQueryResult({ schema: import_sentinel_model.SentinelReportQuerySchema }, resultPayloads);
|
|
47
|
+
this.history.push((0, import_assert.assertEx)(boundWitness));
|
|
48
|
+
return [boundWitness, ...resultPayloads];
|
|
49
|
+
}
|
|
50
|
+
async generateResults(witnesses) {
|
|
51
|
+
const results = await Promise.allSettled(witnesses?.map((witness) => witness.observe()));
|
|
52
|
+
const payloads = results.filter(import_promise.fulfilled).map((result) => result.value).flat();
|
|
53
|
+
const errors = results.filter(import_promise.rejected).map((result) => result.reason).flat();
|
|
54
|
+
return [payloads, errors];
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
58
|
+
0 && (module.exports = {
|
|
59
|
+
MemorySentinel
|
|
60
|
+
});
|
|
61
|
+
//# sourceMappingURL=MemorySentinel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/MemorySentinel.ts"],"sourcesContent":["import { assertEx } from '@xylabs/assert'\nimport { fulfilled, rejected } from '@xylabs/promise'\nimport { handleError } from '@xyo-network/error'\nimport { Payload } from '@xyo-network/payload-model'\nimport {\n SentinelConfig,\n SentinelConfigSchema,\n SentinelInstance,\n SentinelModuleEventData,\n SentinelParams,\n SentinelReportQuerySchema,\n} from '@xyo-network/sentinel-model'\nimport { WitnessInstance } from '@xyo-network/witness'\n\nimport { AbstractSentinel } from './AbstractSentinel'\n\nexport type MemorySentinelParams<TConfig extends SentinelConfig = 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(payloads: Payload[] = []): Promise<Payload[]> {\n await this.started('throw')\n const errors: Error[] = []\n const allWitnesses = [...(await this.witnesses())]\n const resultPayloads: Payload[] = []\n\n try {\n const [generatedPayloads, generatedErrors] = await this.generateResults(allWitnesses)\n const combinedPayloads = [...generatedPayloads, ...payloads]\n resultPayloads.push(...combinedPayloads)\n errors.push(...generatedErrors)\n } catch (ex) {\n handleError(ex, (error) => {\n errors.push(error)\n })\n }\n\n const [boundWitness] = await this.bindQueryResult({ schema: SentinelReportQuerySchema }, resultPayloads)\n this.history.push(assertEx(boundWitness))\n return [boundWitness, ...resultPayloads]\n }\n\n private async generateResults(witnesses: WitnessInstance[]): Promise<[Payload[], Error[]]> {\n const results = await Promise.allSettled(witnesses?.map((witness) => witness.observe()))\n const payloads = results\n .filter(fulfilled)\n .map((result) => result.value)\n .flat()\n const errors = results\n .filter(rejected)\n .map((result) => result.reason)\n .flat()\n return [payloads, errors]\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAyB;AACzB,qBAAoC;AACpC,mBAA4B;AAE5B,4BAOO;AAGP,8BAAiC;AAI1B,MAAM,uBAGH,yCAAsC;AAAA,EAC9C,OAAgB,gBAAgB,CAAC,0CAAoB;AAAA,EAErD,MAAM,cAAc,WAAsB,CAAC,GAAuB;AAChE,UAAM,KAAK,QAAQ,OAAO;AAC1B,UAAM,SAAkB,CAAC;AACzB,UAAM,eAAe,CAAC,GAAI,MAAM,KAAK,UAAU,CAAE;AACjD,UAAM,iBAA4B,CAAC;AAEnC,QAAI;AACF,YAAM,CAAC,mBAAmB,eAAe,IAAI,MAAM,KAAK,gBAAgB,YAAY;AACpF,YAAM,mBAAmB,CAAC,GAAG,mBAAmB,GAAG,QAAQ;AAC3D,qBAAe,KAAK,GAAG,gBAAgB;AACvC,aAAO,KAAK,GAAG,eAAe;AAAA,IAChC,SAAS,IAAI;AACX,oCAAY,IAAI,CAAC,UAAU;AACzB,eAAO,KAAK,KAAK;AAAA,MACnB,CAAC;AAAA,IACH;AAEA,UAAM,CAAC,YAAY,IAAI,MAAM,KAAK,gBAAgB,EAAE,QAAQ,gDAA0B,GAAG,cAAc;AACvG,SAAK,QAAQ,SAAK,wBAAS,YAAY,CAAC;AACxC,WAAO,CAAC,cAAc,GAAG,cAAc;AAAA,EACzC;AAAA,EAEA,MAAc,gBAAgB,WAA6D;AACzF,UAAM,UAAU,MAAM,QAAQ,WAAW,WAAW,IAAI,CAAC,YAAY,QAAQ,QAAQ,CAAC,CAAC;AACvF,UAAM,WAAW,QACd,OAAO,wBAAS,EAChB,IAAI,CAAC,WAAW,OAAO,KAAK,EAC5B,KAAK;AACR,UAAM,SAAS,QACZ,OAAO,uBAAQ,EACf,IAAI,CAAC,WAAW,OAAO,MAAM,EAC7B,KAAK;AACR,WAAO,CAAC,UAAU,MAAM;AAAA,EAC1B;AACF;","names":[]}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { assertEx } from "@xylabs/assert";
|
|
2
|
+
import { fulfilled, rejected } from "@xylabs/promise";
|
|
3
|
+
import { handleError } from "@xyo-network/error";
|
|
4
|
+
import {
|
|
5
|
+
SentinelConfigSchema,
|
|
6
|
+
SentinelReportQuerySchema
|
|
7
|
+
} from "@xyo-network/sentinel-model";
|
|
8
|
+
import { AbstractSentinel } from "./AbstractSentinel";
|
|
9
|
+
class MemorySentinel extends AbstractSentinel {
|
|
10
|
+
static configSchemas = [SentinelConfigSchema];
|
|
11
|
+
async reportHandler(payloads = []) {
|
|
12
|
+
await this.started("throw");
|
|
13
|
+
const errors = [];
|
|
14
|
+
const allWitnesses = [...await this.witnesses()];
|
|
15
|
+
const resultPayloads = [];
|
|
16
|
+
try {
|
|
17
|
+
const [generatedPayloads, generatedErrors] = await this.generateResults(allWitnesses);
|
|
18
|
+
const combinedPayloads = [...generatedPayloads, ...payloads];
|
|
19
|
+
resultPayloads.push(...combinedPayloads);
|
|
20
|
+
errors.push(...generatedErrors);
|
|
21
|
+
} catch (ex) {
|
|
22
|
+
handleError(ex, (error) => {
|
|
23
|
+
errors.push(error);
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
const [boundWitness] = await this.bindQueryResult({ schema: SentinelReportQuerySchema }, resultPayloads);
|
|
27
|
+
this.history.push(assertEx(boundWitness));
|
|
28
|
+
return [boundWitness, ...resultPayloads];
|
|
29
|
+
}
|
|
30
|
+
async generateResults(witnesses) {
|
|
31
|
+
const results = await Promise.allSettled(witnesses?.map((witness) => witness.observe()));
|
|
32
|
+
const payloads = results.filter(fulfilled).map((result) => result.value).flat();
|
|
33
|
+
const errors = results.filter(rejected).map((result) => result.reason).flat();
|
|
34
|
+
return [payloads, errors];
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
export {
|
|
38
|
+
MemorySentinel
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=MemorySentinel.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/MemorySentinel.ts"],"sourcesContent":["import { assertEx } from '@xylabs/assert'\nimport { fulfilled, rejected } from '@xylabs/promise'\nimport { handleError } from '@xyo-network/error'\nimport { Payload } from '@xyo-network/payload-model'\nimport {\n SentinelConfig,\n SentinelConfigSchema,\n SentinelInstance,\n SentinelModuleEventData,\n SentinelParams,\n SentinelReportQuerySchema,\n} from '@xyo-network/sentinel-model'\nimport { WitnessInstance } from '@xyo-network/witness'\n\nimport { AbstractSentinel } from './AbstractSentinel'\n\nexport type MemorySentinelParams<TConfig extends SentinelConfig = 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(payloads: Payload[] = []): Promise<Payload[]> {\n await this.started('throw')\n const errors: Error[] = []\n const allWitnesses = [...(await this.witnesses())]\n const resultPayloads: Payload[] = []\n\n try {\n const [generatedPayloads, generatedErrors] = await this.generateResults(allWitnesses)\n const combinedPayloads = [...generatedPayloads, ...payloads]\n resultPayloads.push(...combinedPayloads)\n errors.push(...generatedErrors)\n } catch (ex) {\n handleError(ex, (error) => {\n errors.push(error)\n })\n }\n\n const [boundWitness] = await this.bindQueryResult({ schema: SentinelReportQuerySchema }, resultPayloads)\n this.history.push(assertEx(boundWitness))\n return [boundWitness, ...resultPayloads]\n }\n\n private async generateResults(witnesses: WitnessInstance[]): Promise<[Payload[], Error[]]> {\n const results = await Promise.allSettled(witnesses?.map((witness) => witness.observe()))\n const payloads = results\n .filter(fulfilled)\n .map((result) => result.value)\n .flat()\n const errors = results\n .filter(rejected)\n .map((result) => result.reason)\n .flat()\n return [payloads, errors]\n }\n}\n"],"mappings":"AAAA,SAAS,gBAAgB;AACzB,SAAS,WAAW,gBAAgB;AACpC,SAAS,mBAAmB;AAE5B;AAAA,EAEE;AAAA,EAIA;AAAA,OACK;AAGP,SAAS,wBAAwB;AAI1B,MAAM,uBAGH,iBAAsC;AAAA,EAC9C,OAAgB,gBAAgB,CAAC,oBAAoB;AAAA,EAErD,MAAM,cAAc,WAAsB,CAAC,GAAuB;AAChE,UAAM,KAAK,QAAQ,OAAO;AAC1B,UAAM,SAAkB,CAAC;AACzB,UAAM,eAAe,CAAC,GAAI,MAAM,KAAK,UAAU,CAAE;AACjD,UAAM,iBAA4B,CAAC;AAEnC,QAAI;AACF,YAAM,CAAC,mBAAmB,eAAe,IAAI,MAAM,KAAK,gBAAgB,YAAY;AACpF,YAAM,mBAAmB,CAAC,GAAG,mBAAmB,GAAG,QAAQ;AAC3D,qBAAe,KAAK,GAAG,gBAAgB;AACvC,aAAO,KAAK,GAAG,eAAe;AAAA,IAChC,SAAS,IAAI;AACX,kBAAY,IAAI,CAAC,UAAU;AACzB,eAAO,KAAK,KAAK;AAAA,MACnB,CAAC;AAAA,IACH;AAEA,UAAM,CAAC,YAAY,IAAI,MAAM,KAAK,gBAAgB,EAAE,QAAQ,0BAA0B,GAAG,cAAc;AACvG,SAAK,QAAQ,KAAK,SAAS,YAAY,CAAC;AACxC,WAAO,CAAC,cAAc,GAAG,cAAc;AAAA,EACzC;AAAA,EAEA,MAAc,gBAAgB,WAA6D;AACzF,UAAM,UAAU,MAAM,QAAQ,WAAW,WAAW,IAAI,CAAC,YAAY,QAAQ,QAAQ,CAAC,CAAC;AACvF,UAAM,WAAW,QACd,OAAO,SAAS,EAChB,IAAI,CAAC,WAAW,OAAO,KAAK,EAC5B,KAAK;AACR,UAAM,SAAS,QACZ,OAAO,QAAQ,EACf,IAAI,CAAC,WAAW,OAAO,MAAM,EAC7B,KAAK;AACR,WAAO,CAAC,UAAU,MAAM;AAAA,EAC1B;AACF;","names":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { PayloadWrapper } from '@xyo-network/payload-wrapper';
|
|
2
|
+
import { SentinelIntervalAutomationPayload } from './Automation';
|
|
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
|
+
//# sourceMappingURL=SentinelIntervalAutomationWrapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SentinelIntervalAutomationWrapper.d.ts","sourceRoot":"","sources":["../../src/SentinelIntervalAutomationWrapper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAE7D,OAAO,EAAE,iCAAiC,EAAE,MAAM,cAAc,CAAA;AAEhE,qBAAa,iCAAiC,CAC5C,CAAC,SAAS,iCAAiC,GAAG,iCAAiC,CAC/E,SAAQ,cAAc,CAAC,CAAC,CAAC;gBACb,OAAO,EAAE,CAAC;IAItB,SAAS,KAAK,eAAe,WAa5B;IAED,SAAS,KAAK,SAAS,WAGtB;IAED,IAAI;IAOJ,SAAS,CAAC,QAAQ;IAMlB,SAAS,CAAC,gBAAgB,CAAC,KAAK,SAAI;CAQrC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { PayloadWrapper } from '@xyo-network/payload-wrapper';
|
|
2
|
+
import { SentinelIntervalAutomationPayload } from './Automation';
|
|
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
|
+
//# sourceMappingURL=SentinelIntervalAutomationWrapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SentinelIntervalAutomationWrapper.d.ts","sourceRoot":"","sources":["../../src/SentinelIntervalAutomationWrapper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAE7D,OAAO,EAAE,iCAAiC,EAAE,MAAM,cAAc,CAAA;AAEhE,qBAAa,iCAAiC,CAC5C,CAAC,SAAS,iCAAiC,GAAG,iCAAiC,CAC/E,SAAQ,cAAc,CAAC,CAAC,CAAC;gBACb,OAAO,EAAE,CAAC;IAItB,SAAS,KAAK,eAAe,WAa5B;IAED,SAAS,KAAK,SAAS,WAGtB;IAED,IAAI;IAOJ,SAAS,CAAC,QAAQ;IAMlB,SAAS,CAAC,gBAAgB,CAAC,KAAK,SAAI;CAQrC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var SentinelIntervalAutomationWrapper_exports = {};
|
|
20
|
+
__export(SentinelIntervalAutomationWrapper_exports, {
|
|
21
|
+
SentinelIntervalAutomationWrapper: () => SentinelIntervalAutomationWrapper
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(SentinelIntervalAutomationWrapper_exports);
|
|
24
|
+
var import_payload_wrapper = require("@xyo-network/payload-wrapper");
|
|
25
|
+
class SentinelIntervalAutomationWrapper extends import_payload_wrapper.PayloadWrapper {
|
|
26
|
+
constructor(payload) {
|
|
27
|
+
super(payload);
|
|
28
|
+
}
|
|
29
|
+
get frequencyMillis() {
|
|
30
|
+
const frequency = this.payload().frequency;
|
|
31
|
+
if (frequency === void 0)
|
|
32
|
+
return Infinity;
|
|
33
|
+
switch (this.payload().frequencyUnits ?? "hour") {
|
|
34
|
+
case "second":
|
|
35
|
+
return frequency * 1e3;
|
|
36
|
+
case "minute":
|
|
37
|
+
return frequency * 60 * 1e3;
|
|
38
|
+
case "hour":
|
|
39
|
+
return frequency * 60 * 60 * 1e3;
|
|
40
|
+
case "day":
|
|
41
|
+
return frequency * 24 * 60 * 60 * 1e3;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
get remaining() {
|
|
45
|
+
return this.payload().remaining ?? Infinity;
|
|
46
|
+
}
|
|
47
|
+
next() {
|
|
48
|
+
this.payload().start = this.payload().start + this.frequencyMillis;
|
|
49
|
+
this.consumeRemaining();
|
|
50
|
+
this.checkEnd();
|
|
51
|
+
return this;
|
|
52
|
+
}
|
|
53
|
+
checkEnd() {
|
|
54
|
+
if (this.payload().start > (this.payload().end ?? Infinity)) {
|
|
55
|
+
this.payload().start = Infinity;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
consumeRemaining(count = 1) {
|
|
59
|
+
const remaining = this.remaining - count;
|
|
60
|
+
this.payload().remaining = remaining;
|
|
61
|
+
if (remaining <= 0) {
|
|
62
|
+
this.payload().start = Infinity;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
67
|
+
0 && (module.exports = {
|
|
68
|
+
SentinelIntervalAutomationWrapper
|
|
69
|
+
});
|
|
70
|
+
//# sourceMappingURL=SentinelIntervalAutomationWrapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/SentinelIntervalAutomationWrapper.ts"],"sourcesContent":["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.payload().frequency\n if (frequency === undefined) return Infinity\n switch (this.payload().frequencyUnits ?? 'hour') {\n case 'second':\n return frequency * 1000\n case 'minute':\n return frequency * 60 * 1000\n case 'hour':\n return frequency * 60 * 60 * 1000\n case 'day':\n return frequency * 24 * 60 * 60 * 1000\n }\n }\n\n protected get remaining() {\n //if remaining is not defined, we assume Infinity\n return this.payload().remaining ?? Infinity\n }\n\n next() {\n this.payload().start = this.payload().start + this.frequencyMillis\n this.consumeRemaining()\n this.checkEnd()\n return this\n }\n\n protected checkEnd() {\n if (this.payload().start > (this.payload().end ?? Infinity)) {\n this.payload().start = Infinity\n }\n }\n\n protected consumeRemaining(count = 1) {\n const remaining = this.remaining - count\n this.payload().remaining = remaining\n\n if (remaining <= 0) {\n this.payload().start = Infinity\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,6BAA+B;AAIxB,MAAM,0CAEH,sCAAkB;AAAA,EAC1B,YAAY,SAAY;AACtB,UAAM,OAAO;AAAA,EACf;AAAA,EAEA,IAAc,kBAAkB;AAC9B,UAAM,YAAY,KAAK,QAAQ,EAAE;AACjC,QAAI,cAAc;AAAW,aAAO;AACpC,YAAQ,KAAK,QAAQ,EAAE,kBAAkB,QAAQ;AAAA,MAC/C,KAAK;AACH,eAAO,YAAY;AAAA,MACrB,KAAK;AACH,eAAO,YAAY,KAAK;AAAA,MAC1B,KAAK;AACH,eAAO,YAAY,KAAK,KAAK;AAAA,MAC/B,KAAK;AACH,eAAO,YAAY,KAAK,KAAK,KAAK;AAAA,IACtC;AAAA,EACF;AAAA,EAEA,IAAc,YAAY;AAExB,WAAO,KAAK,QAAQ,EAAE,aAAa;AAAA,EACrC;AAAA,EAEA,OAAO;AACL,SAAK,QAAQ,EAAE,QAAQ,KAAK,QAAQ,EAAE,QAAQ,KAAK;AACnD,SAAK,iBAAiB;AACtB,SAAK,SAAS;AACd,WAAO;AAAA,EACT;AAAA,EAEU,WAAW;AACnB,QAAI,KAAK,QAAQ,EAAE,SAAS,KAAK,QAAQ,EAAE,OAAO,WAAW;AAC3D,WAAK,QAAQ,EAAE,QAAQ;AAAA,IACzB;AAAA,EACF;AAAA,EAEU,iBAAiB,QAAQ,GAAG;AACpC,UAAM,YAAY,KAAK,YAAY;AACnC,SAAK,QAAQ,EAAE,YAAY;AAE3B,QAAI,aAAa,GAAG;AAClB,WAAK,QAAQ,EAAE,QAAQ;AAAA,IACzB;AAAA,EACF;AACF;","names":[]}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { PayloadWrapper } from "@xyo-network/payload-wrapper";
|
|
2
|
+
class SentinelIntervalAutomationWrapper extends PayloadWrapper {
|
|
3
|
+
constructor(payload) {
|
|
4
|
+
super(payload);
|
|
5
|
+
}
|
|
6
|
+
get frequencyMillis() {
|
|
7
|
+
const frequency = this.payload().frequency;
|
|
8
|
+
if (frequency === void 0)
|
|
9
|
+
return Infinity;
|
|
10
|
+
switch (this.payload().frequencyUnits ?? "hour") {
|
|
11
|
+
case "second":
|
|
12
|
+
return frequency * 1e3;
|
|
13
|
+
case "minute":
|
|
14
|
+
return frequency * 60 * 1e3;
|
|
15
|
+
case "hour":
|
|
16
|
+
return frequency * 60 * 60 * 1e3;
|
|
17
|
+
case "day":
|
|
18
|
+
return frequency * 24 * 60 * 60 * 1e3;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
get remaining() {
|
|
22
|
+
return this.payload().remaining ?? Infinity;
|
|
23
|
+
}
|
|
24
|
+
next() {
|
|
25
|
+
this.payload().start = this.payload().start + this.frequencyMillis;
|
|
26
|
+
this.consumeRemaining();
|
|
27
|
+
this.checkEnd();
|
|
28
|
+
return this;
|
|
29
|
+
}
|
|
30
|
+
checkEnd() {
|
|
31
|
+
if (this.payload().start > (this.payload().end ?? Infinity)) {
|
|
32
|
+
this.payload().start = Infinity;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
consumeRemaining(count = 1) {
|
|
36
|
+
const remaining = this.remaining - count;
|
|
37
|
+
this.payload().remaining = remaining;
|
|
38
|
+
if (remaining <= 0) {
|
|
39
|
+
this.payload().start = Infinity;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
export {
|
|
44
|
+
SentinelIntervalAutomationWrapper
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=SentinelIntervalAutomationWrapper.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/SentinelIntervalAutomationWrapper.ts"],"sourcesContent":["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.payload().frequency\n if (frequency === undefined) return Infinity\n switch (this.payload().frequencyUnits ?? 'hour') {\n case 'second':\n return frequency * 1000\n case 'minute':\n return frequency * 60 * 1000\n case 'hour':\n return frequency * 60 * 60 * 1000\n case 'day':\n return frequency * 24 * 60 * 60 * 1000\n }\n }\n\n protected get remaining() {\n //if remaining is not defined, we assume Infinity\n return this.payload().remaining ?? Infinity\n }\n\n next() {\n this.payload().start = this.payload().start + this.frequencyMillis\n this.consumeRemaining()\n this.checkEnd()\n return this\n }\n\n protected checkEnd() {\n if (this.payload().start > (this.payload().end ?? Infinity)) {\n this.payload().start = Infinity\n }\n }\n\n protected consumeRemaining(count = 1) {\n const remaining = this.remaining - count\n this.payload().remaining = remaining\n\n if (remaining <= 0) {\n this.payload().start = Infinity\n }\n }\n}\n"],"mappings":"AAAA,SAAS,sBAAsB;AAIxB,MAAM,0CAEH,eAAkB;AAAA,EAC1B,YAAY,SAAY;AACtB,UAAM,OAAO;AAAA,EACf;AAAA,EAEA,IAAc,kBAAkB;AAC9B,UAAM,YAAY,KAAK,QAAQ,EAAE;AACjC,QAAI,cAAc;AAAW,aAAO;AACpC,YAAQ,KAAK,QAAQ,EAAE,kBAAkB,QAAQ;AAAA,MAC/C,KAAK;AACH,eAAO,YAAY;AAAA,MACrB,KAAK;AACH,eAAO,YAAY,KAAK;AAAA,MAC1B,KAAK;AACH,eAAO,YAAY,KAAK,KAAK;AAAA,MAC/B,KAAK;AACH,eAAO,YAAY,KAAK,KAAK,KAAK;AAAA,IACtC;AAAA,EACF;AAAA,EAEA,IAAc,YAAY;AAExB,WAAO,KAAK,QAAQ,EAAE,aAAa;AAAA,EACrC;AAAA,EAEA,OAAO;AACL,SAAK,QAAQ,EAAE,QAAQ,KAAK,QAAQ,EAAE,QAAQ,KAAK;AACnD,SAAK,iBAAiB;AACtB,SAAK,SAAS;AACd,WAAO;AAAA,EACT;AAAA,EAEU,WAAW;AACnB,QAAI,KAAK,QAAQ,EAAE,SAAS,KAAK,QAAQ,EAAE,OAAO,WAAW;AAC3D,WAAK,QAAQ,EAAE,QAAQ;AAAA,IACzB;AAAA,EACF;AAAA,EAEU,iBAAiB,QAAQ,GAAG;AACpC,UAAM,YAAY,KAAK,YAAY;AACnC,SAAK,QAAQ,EAAE,YAAY;AAE3B,QAAI,aAAa,GAAG;AAClB,WAAK,QAAQ,EAAE,QAAQ;AAAA,IACzB;AAAA,EACF;AACF;","names":[]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { Payload } from '@xyo-network/payload-model';
|
|
3
|
+
import { SentinelInstance } from '@xyo-network/sentinel-model';
|
|
4
|
+
import { SentinelAutomationPayload } from './Automation';
|
|
5
|
+
export type OnSentinelRunnerTriggerResult = (result: Payload[]) => void;
|
|
6
|
+
export declare class SentinelRunner {
|
|
7
|
+
protected _automations: Record<string, SentinelAutomationPayload>;
|
|
8
|
+
protected onTriggerResult: OnSentinelRunnerTriggerResult | undefined;
|
|
9
|
+
protected sentinel: SentinelInstance;
|
|
10
|
+
protected timeoutId?: NodeJS.Timeout | string | number;
|
|
11
|
+
constructor(sentinel: SentinelInstance, automations?: SentinelAutomationPayload[], onTriggerResult?: OnSentinelRunnerTriggerResult);
|
|
12
|
+
get automations(): Record<string, SentinelAutomationPayload>;
|
|
13
|
+
private get next();
|
|
14
|
+
add(automation: SentinelAutomationPayload, restart?: boolean): Promise<string>;
|
|
15
|
+
find(hash: string): void;
|
|
16
|
+
remove(hash: string, restart?: boolean): Promise<void>;
|
|
17
|
+
removeAll(): void;
|
|
18
|
+
restart(): Promise<void>;
|
|
19
|
+
start(): Promise<void>;
|
|
20
|
+
stop(): void;
|
|
21
|
+
update(hash: string, automation: SentinelAutomationPayload, restart?: boolean): Promise<void>;
|
|
22
|
+
private trigger;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=SentinelRunner.d.ts.map
|
|
@@ -0,0 +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,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAE9D,OAAO,EAAE,yBAAyB,EAAqC,MAAM,cAAc,CAAA;AAG3F,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,GAMf;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;IAoBX,IAAI;IAOE,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,yBAAyB,EAAE,OAAO,UAAO;YAMlE,OAAO;CAStB"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { Payload } from '@xyo-network/payload-model';
|
|
3
|
+
import { SentinelInstance } from '@xyo-network/sentinel-model';
|
|
4
|
+
import { SentinelAutomationPayload } from './Automation';
|
|
5
|
+
export type OnSentinelRunnerTriggerResult = (result: Payload[]) => void;
|
|
6
|
+
export declare class SentinelRunner {
|
|
7
|
+
protected _automations: Record<string, SentinelAutomationPayload>;
|
|
8
|
+
protected onTriggerResult: OnSentinelRunnerTriggerResult | undefined;
|
|
9
|
+
protected sentinel: SentinelInstance;
|
|
10
|
+
protected timeoutId?: NodeJS.Timeout | string | number;
|
|
11
|
+
constructor(sentinel: SentinelInstance, automations?: SentinelAutomationPayload[], onTriggerResult?: OnSentinelRunnerTriggerResult);
|
|
12
|
+
get automations(): Record<string, SentinelAutomationPayload>;
|
|
13
|
+
private get next();
|
|
14
|
+
add(automation: SentinelAutomationPayload, restart?: boolean): Promise<string>;
|
|
15
|
+
find(hash: string): void;
|
|
16
|
+
remove(hash: string, restart?: boolean): Promise<void>;
|
|
17
|
+
removeAll(): void;
|
|
18
|
+
restart(): Promise<void>;
|
|
19
|
+
start(): Promise<void>;
|
|
20
|
+
stop(): void;
|
|
21
|
+
update(hash: string, automation: SentinelAutomationPayload, restart?: boolean): Promise<void>;
|
|
22
|
+
private trigger;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=SentinelRunner.d.ts.map
|
|
@@ -0,0 +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,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAE9D,OAAO,EAAE,yBAAyB,EAAqC,MAAM,cAAc,CAAA;AAG3F,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,GAMf;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;IAoBX,IAAI;IAOE,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,yBAAyB,EAAE,OAAO,UAAO;YAMlE,OAAO;CAStB"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var SentinelRunner_exports = {};
|
|
20
|
+
__export(SentinelRunner_exports, {
|
|
21
|
+
SentinelRunner: () => SentinelRunner
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(SentinelRunner_exports);
|
|
24
|
+
var import_assert = require("@xylabs/assert");
|
|
25
|
+
var import_payload_wrapper = require("@xyo-network/payload-wrapper");
|
|
26
|
+
var import_SentinelIntervalAutomationWrapper = require("./SentinelIntervalAutomationWrapper");
|
|
27
|
+
class SentinelRunner {
|
|
28
|
+
_automations = {};
|
|
29
|
+
onTriggerResult;
|
|
30
|
+
sentinel;
|
|
31
|
+
timeoutId;
|
|
32
|
+
constructor(sentinel, automations, onTriggerResult) {
|
|
33
|
+
this.sentinel = sentinel;
|
|
34
|
+
this.onTriggerResult = onTriggerResult;
|
|
35
|
+
automations?.forEach((automation) => this.add(automation));
|
|
36
|
+
}
|
|
37
|
+
get automations() {
|
|
38
|
+
return this._automations;
|
|
39
|
+
}
|
|
40
|
+
get next() {
|
|
41
|
+
return Object.values(this._automations).reduce((previous, current) => {
|
|
42
|
+
if (current.type === "interval") {
|
|
43
|
+
return current.start < (previous?.start ?? Infinity) ? current : previous;
|
|
44
|
+
}
|
|
45
|
+
}, void 0);
|
|
46
|
+
}
|
|
47
|
+
async add(automation, restart = true) {
|
|
48
|
+
const hash = await import_payload_wrapper.PayloadWrapper.hashAsync(automation);
|
|
49
|
+
this._automations[hash] = automation;
|
|
50
|
+
if (restart)
|
|
51
|
+
await this.restart();
|
|
52
|
+
return hash;
|
|
53
|
+
}
|
|
54
|
+
find(hash) {
|
|
55
|
+
Object.entries(this._automations).find(([key]) => key === hash);
|
|
56
|
+
}
|
|
57
|
+
async remove(hash, restart = true) {
|
|
58
|
+
delete this._automations[hash];
|
|
59
|
+
if (restart)
|
|
60
|
+
await this.restart();
|
|
61
|
+
}
|
|
62
|
+
removeAll() {
|
|
63
|
+
this.stop();
|
|
64
|
+
this._automations = {};
|
|
65
|
+
}
|
|
66
|
+
async restart() {
|
|
67
|
+
this.stop();
|
|
68
|
+
await this.start();
|
|
69
|
+
}
|
|
70
|
+
async start() {
|
|
71
|
+
(0, import_assert.assertEx)(this.timeoutId === void 0, "Already started");
|
|
72
|
+
const automation = this.next;
|
|
73
|
+
if (automation) {
|
|
74
|
+
const delay = automation.start - Date.now();
|
|
75
|
+
if (delay < 0) {
|
|
76
|
+
await this.trigger(automation);
|
|
77
|
+
} else {
|
|
78
|
+
this.timeoutId = setTimeout(
|
|
79
|
+
async () => {
|
|
80
|
+
this.timeoutId = void 0;
|
|
81
|
+
await this.start();
|
|
82
|
+
},
|
|
83
|
+
delay > 0 ? delay : 0
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
stop() {
|
|
89
|
+
if (this.timeoutId) {
|
|
90
|
+
clearTimeout(this.timeoutId);
|
|
91
|
+
this.timeoutId = void 0;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
async update(hash, automation, restart = true) {
|
|
95
|
+
await this.remove(hash, false);
|
|
96
|
+
await this.add(automation, false);
|
|
97
|
+
if (restart)
|
|
98
|
+
await this.restart();
|
|
99
|
+
}
|
|
100
|
+
async trigger(automation) {
|
|
101
|
+
const wrapper = new import_SentinelIntervalAutomationWrapper.SentinelIntervalAutomationWrapper(automation);
|
|
102
|
+
await this.remove(await wrapper.hashAsync(), false);
|
|
103
|
+
wrapper.next();
|
|
104
|
+
await this.add(wrapper.payload(), false);
|
|
105
|
+
const triggerResult = await this.sentinel.report();
|
|
106
|
+
this.onTriggerResult?.(triggerResult);
|
|
107
|
+
await this.start();
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
111
|
+
0 && (module.exports = {
|
|
112
|
+
SentinelRunner
|
|
113
|
+
});
|
|
114
|
+
//# sourceMappingURL=SentinelRunner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/SentinelRunner.ts"],"sourcesContent":["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 { 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 automations?.forEach((automation) => this.add(automation))\n }\n\n get automations() {\n return this._automations\n }\n\n private get next() {\n return Object.values(this._automations).reduce<SentinelIntervalAutomationPayload | undefined>((previous, current) => {\n if (current.type === 'interval') {\n return current.start < (previous?.start ?? Infinity) ? current : previous\n }\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 (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.payload(), false)\n const triggerResult = await this.sentinel.report()\n this.onTriggerResult?.(triggerResult)\n await this.start()\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAyB;AAEzB,6BAA+B;AAI/B,+CAAkD;AAI3C,MAAM,eAAe;AAAA,EAChB,eAA0D,CAAC;AAAA,EAC3D;AAAA,EACA;AAAA,EACA;AAAA,EAEV,YAAY,UAA4B,aAA2C,iBAAiD;AAClI,SAAK,WAAW;AAChB,SAAK,kBAAkB;AACvB,iBAAa,QAAQ,CAAC,eAAe,KAAK,IAAI,UAAU,CAAC;AAAA,EAC3D;AAAA,EAEA,IAAI,cAAc;AAChB,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,IAAY,OAAO;AACjB,WAAO,OAAO,OAAO,KAAK,YAAY,EAAE,OAAsD,CAAC,UAAU,YAAY;AACnH,UAAI,QAAQ,SAAS,YAAY;AAC/B,eAAO,QAAQ,SAAS,UAAU,SAAS,YAAY,UAAU;AAAA,MACnE;AAAA,IACF,GAAG,MAAS;AAAA,EACd;AAAA,EAEA,MAAM,IAAI,YAAuC,UAAU,MAAM;AAC/D,UAAM,OAAO,MAAM,sCAAe,UAAU,UAAU;AACtD,SAAK,aAAa,IAAI,IAAI;AAC1B,QAAI;AAAS,YAAM,KAAK,QAAQ;AAChC,WAAO;AAAA,EACT;AAAA,EAEA,KAAK,MAAc;AACjB,WAAO,QAAQ,KAAK,YAAY,EAAE,KAAK,CAAC,CAAC,GAAG,MAAM,QAAQ,IAAI;AAAA,EAChE;AAAA,EAEA,MAAM,OAAO,MAAc,UAAU,MAAM;AACzC,WAAO,KAAK,aAAa,IAAI;AAC7B,QAAI;AAAS,YAAM,KAAK,QAAQ;AAAA,EAClC;AAAA,EAEA,YAAY;AACV,SAAK,KAAK;AACV,SAAK,eAAe,CAAC;AAAA,EACvB;AAAA,EAEA,MAAM,UAAU;AACd,SAAK,KAAK;AACV,UAAM,KAAK,MAAM;AAAA,EACnB;AAAA,EAEA,MAAM,QAAQ;AACZ,gCAAS,KAAK,cAAc,QAAW,iBAAiB;AACxD,UAAM,aAAa,KAAK;AACxB,QAAI,YAAY;AACd,YAAM,QAAQ,WAAW,QAAQ,KAAK,IAAI;AAC1C,UAAI,QAAQ,GAAG;AAEb,cAAM,KAAK,QAAQ,UAAU;AAAA,MAC/B,OAAO;AACL,aAAK,YAAY;AAAA,UACf,YAAY;AACV,iBAAK,YAAY;AACjB,kBAAM,KAAK,MAAM;AAAA,UACnB;AAAA,UACA,QAAQ,IAAI,QAAQ;AAAA,QACtB;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EAEA,OAAO;AACL,QAAI,KAAK,WAAW;AAClB,mBAAa,KAAK,SAAS;AAC3B,WAAK,YAAY;AAAA,IACnB;AAAA,EACF;AAAA,EAEA,MAAM,OAAO,MAAc,YAAuC,UAAU,MAAM;AAChF,UAAM,KAAK,OAAO,MAAM,KAAK;AAC7B,UAAM,KAAK,IAAI,YAAY,KAAK;AAChC,QAAI;AAAS,YAAM,KAAK,QAAQ;AAAA,EAClC;AAAA,EAEA,MAAc,QAAQ,YAA+C;AACnE,UAAM,UAAU,IAAI,2EAAkC,UAAU;AAChE,UAAM,KAAK,OAAO,MAAM,QAAQ,UAAU,GAAG,KAAK;AAClD,YAAQ,KAAK;AACb,UAAM,KAAK,IAAI,QAAQ,QAAQ,GAAG,KAAK;AACvC,UAAM,gBAAgB,MAAM,KAAK,SAAS,OAAO;AACjD,SAAK,kBAAkB,aAAa;AACpC,UAAM,KAAK,MAAM;AAAA,EACnB;AACF;","names":[]}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { assertEx } from "@xylabs/assert";
|
|
2
|
+
import { PayloadWrapper } from "@xyo-network/payload-wrapper";
|
|
3
|
+
import { SentinelIntervalAutomationWrapper } from "./SentinelIntervalAutomationWrapper";
|
|
4
|
+
class SentinelRunner {
|
|
5
|
+
_automations = {};
|
|
6
|
+
onTriggerResult;
|
|
7
|
+
sentinel;
|
|
8
|
+
timeoutId;
|
|
9
|
+
constructor(sentinel, automations, onTriggerResult) {
|
|
10
|
+
this.sentinel = sentinel;
|
|
11
|
+
this.onTriggerResult = onTriggerResult;
|
|
12
|
+
automations?.forEach((automation) => this.add(automation));
|
|
13
|
+
}
|
|
14
|
+
get automations() {
|
|
15
|
+
return this._automations;
|
|
16
|
+
}
|
|
17
|
+
get next() {
|
|
18
|
+
return Object.values(this._automations).reduce((previous, current) => {
|
|
19
|
+
if (current.type === "interval") {
|
|
20
|
+
return current.start < (previous?.start ?? Infinity) ? current : previous;
|
|
21
|
+
}
|
|
22
|
+
}, void 0);
|
|
23
|
+
}
|
|
24
|
+
async add(automation, restart = true) {
|
|
25
|
+
const hash = await PayloadWrapper.hashAsync(automation);
|
|
26
|
+
this._automations[hash] = automation;
|
|
27
|
+
if (restart)
|
|
28
|
+
await this.restart();
|
|
29
|
+
return hash;
|
|
30
|
+
}
|
|
31
|
+
find(hash) {
|
|
32
|
+
Object.entries(this._automations).find(([key]) => key === hash);
|
|
33
|
+
}
|
|
34
|
+
async remove(hash, restart = true) {
|
|
35
|
+
delete this._automations[hash];
|
|
36
|
+
if (restart)
|
|
37
|
+
await this.restart();
|
|
38
|
+
}
|
|
39
|
+
removeAll() {
|
|
40
|
+
this.stop();
|
|
41
|
+
this._automations = {};
|
|
42
|
+
}
|
|
43
|
+
async restart() {
|
|
44
|
+
this.stop();
|
|
45
|
+
await this.start();
|
|
46
|
+
}
|
|
47
|
+
async start() {
|
|
48
|
+
assertEx(this.timeoutId === void 0, "Already started");
|
|
49
|
+
const automation = this.next;
|
|
50
|
+
if (automation) {
|
|
51
|
+
const delay = automation.start - Date.now();
|
|
52
|
+
if (delay < 0) {
|
|
53
|
+
await this.trigger(automation);
|
|
54
|
+
} else {
|
|
55
|
+
this.timeoutId = setTimeout(
|
|
56
|
+
async () => {
|
|
57
|
+
this.timeoutId = void 0;
|
|
58
|
+
await this.start();
|
|
59
|
+
},
|
|
60
|
+
delay > 0 ? delay : 0
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
stop() {
|
|
66
|
+
if (this.timeoutId) {
|
|
67
|
+
clearTimeout(this.timeoutId);
|
|
68
|
+
this.timeoutId = void 0;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
async update(hash, automation, restart = true) {
|
|
72
|
+
await this.remove(hash, false);
|
|
73
|
+
await this.add(automation, false);
|
|
74
|
+
if (restart)
|
|
75
|
+
await this.restart();
|
|
76
|
+
}
|
|
77
|
+
async trigger(automation) {
|
|
78
|
+
const wrapper = new SentinelIntervalAutomationWrapper(automation);
|
|
79
|
+
await this.remove(await wrapper.hashAsync(), false);
|
|
80
|
+
wrapper.next();
|
|
81
|
+
await this.add(wrapper.payload(), false);
|
|
82
|
+
const triggerResult = await this.sentinel.report();
|
|
83
|
+
this.onTriggerResult?.(triggerResult);
|
|
84
|
+
await this.start();
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
export {
|
|
88
|
+
SentinelRunner
|
|
89
|
+
};
|
|
90
|
+
//# sourceMappingURL=SentinelRunner.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/SentinelRunner.ts"],"sourcesContent":["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 { 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 automations?.forEach((automation) => this.add(automation))\n }\n\n get automations() {\n return this._automations\n }\n\n private get next() {\n return Object.values(this._automations).reduce<SentinelIntervalAutomationPayload | undefined>((previous, current) => {\n if (current.type === 'interval') {\n return current.start < (previous?.start ?? Infinity) ? current : previous\n }\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 (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.payload(), false)\n const triggerResult = await this.sentinel.report()\n this.onTriggerResult?.(triggerResult)\n await this.start()\n }\n}\n"],"mappings":"AAAA,SAAS,gBAAgB;AAEzB,SAAS,sBAAsB;AAI/B,SAAS,yCAAyC;AAI3C,MAAM,eAAe;AAAA,EAChB,eAA0D,CAAC;AAAA,EAC3D;AAAA,EACA;AAAA,EACA;AAAA,EAEV,YAAY,UAA4B,aAA2C,iBAAiD;AAClI,SAAK,WAAW;AAChB,SAAK,kBAAkB;AACvB,iBAAa,QAAQ,CAAC,eAAe,KAAK,IAAI,UAAU,CAAC;AAAA,EAC3D;AAAA,EAEA,IAAI,cAAc;AAChB,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,IAAY,OAAO;AACjB,WAAO,OAAO,OAAO,KAAK,YAAY,EAAE,OAAsD,CAAC,UAAU,YAAY;AACnH,UAAI,QAAQ,SAAS,YAAY;AAC/B,eAAO,QAAQ,SAAS,UAAU,SAAS,YAAY,UAAU;AAAA,MACnE;AAAA,IACF,GAAG,MAAS;AAAA,EACd;AAAA,EAEA,MAAM,IAAI,YAAuC,UAAU,MAAM;AAC/D,UAAM,OAAO,MAAM,eAAe,UAAU,UAAU;AACtD,SAAK,aAAa,IAAI,IAAI;AAC1B,QAAI;AAAS,YAAM,KAAK,QAAQ;AAChC,WAAO;AAAA,EACT;AAAA,EAEA,KAAK,MAAc;AACjB,WAAO,QAAQ,KAAK,YAAY,EAAE,KAAK,CAAC,CAAC,GAAG,MAAM,QAAQ,IAAI;AAAA,EAChE;AAAA,EAEA,MAAM,OAAO,MAAc,UAAU,MAAM;AACzC,WAAO,KAAK,aAAa,IAAI;AAC7B,QAAI;AAAS,YAAM,KAAK,QAAQ;AAAA,EAClC;AAAA,EAEA,YAAY;AACV,SAAK,KAAK;AACV,SAAK,eAAe,CAAC;AAAA,EACvB;AAAA,EAEA,MAAM,UAAU;AACd,SAAK,KAAK;AACV,UAAM,KAAK,MAAM;AAAA,EACnB;AAAA,EAEA,MAAM,QAAQ;AACZ,aAAS,KAAK,cAAc,QAAW,iBAAiB;AACxD,UAAM,aAAa,KAAK;AACxB,QAAI,YAAY;AACd,YAAM,QAAQ,WAAW,QAAQ,KAAK,IAAI;AAC1C,UAAI,QAAQ,GAAG;AAEb,cAAM,KAAK,QAAQ,UAAU;AAAA,MAC/B,OAAO;AACL,aAAK,YAAY;AAAA,UACf,YAAY;AACV,iBAAK,YAAY;AACjB,kBAAM,KAAK,MAAM;AAAA,UACnB;AAAA,UACA,QAAQ,IAAI,QAAQ;AAAA,QACtB;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EAEA,OAAO;AACL,QAAI,KAAK,WAAW;AAClB,mBAAa,KAAK,SAAS;AAC3B,WAAK,YAAY;AAAA,IACnB;AAAA,EACF;AAAA,EAEA,MAAM,OAAO,MAAc,YAAuC,UAAU,MAAM;AAChF,UAAM,KAAK,OAAO,MAAM,KAAK;AAC7B,UAAM,KAAK,IAAI,YAAY,KAAK;AAChC,QAAI;AAAS,YAAM,KAAK,QAAQ;AAAA,EAClC;AAAA,EAEA,MAAc,QAAQ,YAA+C;AACnE,UAAM,UAAU,IAAI,kCAAkC,UAAU;AAChE,UAAM,KAAK,OAAO,MAAM,QAAQ,UAAU,GAAG,KAAK;AAClD,YAAQ,KAAK;AACb,UAAM,KAAK,IAAI,QAAQ,QAAQ,GAAG,KAAK;AACvC,UAAM,gBAAgB,MAAM,KAAK,SAAS,OAAO;AACjD,SAAK,kBAAkB,aAAa;AACpC,UAAM,KAAK,MAAM;AAAA,EACnB;AACF;","names":[]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ArchivistInstance } from '@xyo-network/archivist';
|
|
2
|
+
import { ModuleWrapper } from '@xyo-network/module';
|
|
3
|
+
import { Payload } from '@xyo-network/payload-model';
|
|
4
|
+
import { SentinelInstance, SentinelModule } from '@xyo-network/sentinel-model';
|
|
5
|
+
import { WitnessInstance } from '@xyo-network/witness';
|
|
6
|
+
export declare class SentinelWrapper<TModule extends SentinelModule = SentinelModule> extends ModuleWrapper<TModule> implements SentinelInstance<TModule['params']> {
|
|
7
|
+
static instanceIdentityCheck: import("@xyo-network/object").ObjectTypeCheck<SentinelInstance>;
|
|
8
|
+
static moduleIdentityCheck: import("@xyo-network/module").ModuleTypeCheck<SentinelModule>;
|
|
9
|
+
static requiredQueries: string[];
|
|
10
|
+
archivists(): Promise<ArchivistInstance[]>;
|
|
11
|
+
report(payloads?: Payload[]): Promise<Payload[]>;
|
|
12
|
+
witnesses(): Promise<WitnessInstance[]>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=Wrapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Wrapper.d.ts","sourceRoot":"","sources":["../../src/Wrapper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,EAA8B,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAC/E,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AACpD,OAAO,EAGL,gBAAgB,EAChB,cAAc,EAGf,MAAM,6BAA6B,CAAA;AACpC,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAGtD,qBAAa,eAAe,CAAC,OAAO,SAAS,cAAc,GAAG,cAAc,CAC1E,SAAQ,aAAa,CAAC,OAAO,CAC7B,YAAW,gBAAgB,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAE9C,OAAgB,qBAAqB,kEAAqB;IAC1D,OAAgB,mBAAmB,gEAAmB;IACtD,OAAgB,eAAe,WAAwD;IAEvF,UAAU,IAAI,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAIpC,MAAM,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAMtD,SAAS,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC;CAGxC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ArchivistInstance } from '@xyo-network/archivist';
|
|
2
|
+
import { ModuleWrapper } from '@xyo-network/module';
|
|
3
|
+
import { Payload } from '@xyo-network/payload-model';
|
|
4
|
+
import { SentinelInstance, SentinelModule } from '@xyo-network/sentinel-model';
|
|
5
|
+
import { WitnessInstance } from '@xyo-network/witness';
|
|
6
|
+
export declare class SentinelWrapper<TModule extends SentinelModule = SentinelModule> extends ModuleWrapper<TModule> implements SentinelInstance<TModule['params']> {
|
|
7
|
+
static instanceIdentityCheck: import("@xyo-network/object").ObjectTypeCheck<SentinelInstance>;
|
|
8
|
+
static moduleIdentityCheck: import("@xyo-network/module").ModuleTypeCheck<SentinelModule>;
|
|
9
|
+
static requiredQueries: string[];
|
|
10
|
+
archivists(): Promise<ArchivistInstance[]>;
|
|
11
|
+
report(payloads?: Payload[]): Promise<Payload[]>;
|
|
12
|
+
witnesses(): Promise<WitnessInstance[]>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=Wrapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Wrapper.d.ts","sourceRoot":"","sources":["../../src/Wrapper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,EAA8B,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAC/E,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AACpD,OAAO,EAGL,gBAAgB,EAChB,cAAc,EAGf,MAAM,6BAA6B,CAAA;AACpC,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAGtD,qBAAa,eAAe,CAAC,OAAO,SAAS,cAAc,GAAG,cAAc,CAC1E,SAAQ,aAAa,CAAC,OAAO,CAC7B,YAAW,gBAAgB,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAE9C,OAAgB,qBAAqB,kEAAqB;IAC1D,OAAgB,mBAAmB,gEAAmB;IACtD,OAAgB,eAAe,WAAwD;IAEvF,UAAU,IAAI,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAIpC,MAAM,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAMtD,SAAS,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC;CAGxC"}
|