@camstack/types 1.2.396 → 1.2.398
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/addon.js +17 -2
- package/dist/addon.mjs +15 -3
- package/dist/capabilities/dishwasher.cap.d.ts +9 -0
- package/dist/capabilities/index.d.ts +2 -2
- package/dist/capabilities/notification-rules.cap.d.ts +138 -0
- package/dist/capabilities/osd-manager.cap.d.ts +36 -0
- package/dist/capabilities/records.cap.d.ts +67 -3
- package/dist/capabilities/storage-admin.cap.d.ts +0 -2
- package/dist/capabilities/user-management.cap.d.ts +2 -28
- package/dist/client.d.ts +1 -1
- package/dist/client.js +324 -13
- package/dist/client.mjs +320 -14
- package/dist/enums/event-category.d.ts +17 -0
- package/dist/enums.js +1 -1
- package/dist/enums.mjs +1 -1
- package/dist/{event-category-eSqkye-K.js → event-category-7AwNbPjm.js} +17 -0
- package/dist/{event-category-DOl51-Ij.mjs → event-category-BfJwUd2S.mjs} +17 -0
- package/dist/generated/addon-api.d.ts +7 -14
- package/dist/generated/addon-cap-facts.d.ts +1 -1
- package/dist/generated/method-access-map.d.ts +1 -1
- package/dist/generated/system-proxy.d.ts +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js +426 -62
- package/dist/index.mjs +415 -61
- package/dist/interfaces/auth.d.ts +1 -1
- package/dist/interfaces/event-bus.d.ts +43 -5
- package/dist/notification/alert-episode.d.ts +7 -0
- package/dist/notification/system-event-classes.d.ts +73 -0
- package/dist/records/errors.d.ts +9 -1
- package/dist/records/index.d.ts +1 -0
- package/dist/records/record-kind.d.ts +62 -2
- package/dist/records/records-access.d.ts +36 -1
- package/dist/records/transact-rules.d.ts +7 -0
- package/dist/schemas/auth-records.d.ts +0 -12
- package/dist/{sleep-Re8daN0Y.js → sleep-CD18m9HF.js} +478 -311
- package/dist/{sleep-_sV1BE2f.mjs → sleep-DJFUfKvA.mjs} +461 -312
- package/package.json +1 -1
package/dist/client.js
CHANGED
|
@@ -22265,9 +22265,13 @@ var NcSystemEventKindSchema = zod.z.enum([
|
|
|
22265
22265
|
"node-updating",
|
|
22266
22266
|
"node-inference-unavailable",
|
|
22267
22267
|
"detection-blind",
|
|
22268
|
+
"motion-noisy",
|
|
22269
|
+
"motion-calm",
|
|
22268
22270
|
"recording-stalled",
|
|
22269
22271
|
"recording-healthy",
|
|
22270
22272
|
"recording-degraded",
|
|
22273
|
+
"device-attention-required",
|
|
22274
|
+
"device-attention-resolved",
|
|
22271
22275
|
"storage-location-low",
|
|
22272
22276
|
"storage-location-critical",
|
|
22273
22277
|
"storage-location-ok",
|
|
@@ -22291,6 +22295,8 @@ var NcSystemEventKindSchema = zod.z.enum([
|
|
|
22291
22295
|
"alert-critical",
|
|
22292
22296
|
"alert-error",
|
|
22293
22297
|
"alert-critical-resolved",
|
|
22298
|
+
"rule-broken",
|
|
22299
|
+
"rule-repaired",
|
|
22294
22300
|
"camera-online",
|
|
22295
22301
|
"camera-offline",
|
|
22296
22302
|
"camera-disabled",
|
|
@@ -28389,8 +28395,6 @@ function createSystemProxy(api) {
|
|
|
28389
28395
|
resetPassword: (input) => dispatch("userManagement", "resetPassword", "mutation", input),
|
|
28390
28396
|
setUserScopes: (input) => dispatch("userManagement", "setUserScopes", "mutation", input),
|
|
28391
28397
|
validateCredentials: (input) => dispatch("userManagement", "validateCredentials", "mutation", input),
|
|
28392
|
-
listApiKeys: (input) => dispatch("userManagement", "listApiKeys", "query", input),
|
|
28393
|
-
revokeApiKey: (input) => dispatch("userManagement", "revokeApiKey", "mutation", input),
|
|
28394
28398
|
setupTotp: (input) => dispatch("userManagement", "setupTotp", "mutation", input),
|
|
28395
28399
|
confirmTotp: (input) => dispatch("userManagement", "confirmTotp", "mutation", input),
|
|
28396
28400
|
disableTotp: (input) => dispatch("userManagement", "disableTotp", "mutation", input),
|
|
@@ -28741,8 +28745,8 @@ var NC_SYSTEM_EVENT_FILTER_KEYS = [
|
|
|
28741
28745
|
*/
|
|
28742
28746
|
function systemEventFilterApplies(kind, filter) {
|
|
28743
28747
|
switch (filter) {
|
|
28744
|
-
case "deviceIds": return kind.startsWith("device-") || kind.startsWith("stream-") || kind === "detection-blind" || kind.startsWith("recording-") || kind === "alarm-triggered";
|
|
28745
|
-
case "deviceTypes": return kind.startsWith("device-") || kind === "detection-blind";
|
|
28748
|
+
case "deviceIds": return kind.startsWith("device-") || kind.startsWith("stream-") || kind === "detection-blind" || kind.startsWith("motion-") || kind.startsWith("recording-") || kind === "alarm-triggered";
|
|
28749
|
+
case "deviceTypes": return kind.startsWith("device-") || kind === "detection-blind" || kind.startsWith("motion-");
|
|
28746
28750
|
case "nodeIds": return kind.startsWith("node-") || kind === "addon-crash-loop" || kind === "addon-update-available" || kind === "addon-updated" || kind === "server-update-available" || kind === "wrapper-update-available" || kind === "server-updated" || kind.startsWith("storage-location-") || kind.startsWith("alert-");
|
|
28747
28751
|
case "packageNames": return kind.endsWith("update-available") || kind === "addon-updated" || kind === "node-updating" || kind === "server-updated";
|
|
28748
28752
|
case "consumableLowPercent": return NC_CONSUMABLE_SYSTEM_EVENT_KINDS.includes(kind);
|
|
@@ -28784,8 +28788,8 @@ var NC_SYSTEM_EVENT_FAMILIES = [
|
|
|
28784
28788
|
function isSystemEventFamily(value) {
|
|
28785
28789
|
return NC_SYSTEM_EVENT_FAMILIES.some((family) => family === value);
|
|
28786
28790
|
}
|
|
28787
|
-
/**
|
|
28788
|
-
var
|
|
28791
|
+
/** Total over the enum: a kind added to the cap without a family fails tsc here. */
|
|
28792
|
+
var NC_SYSTEM_EVENT_FAMILY = {
|
|
28789
28793
|
"device-online": "device-events",
|
|
28790
28794
|
"device-offline": "device-events",
|
|
28791
28795
|
"device-disabled": "device-events",
|
|
@@ -28800,9 +28804,13 @@ var FAMILY_BY_NAME = new Map(Object.entries({
|
|
|
28800
28804
|
"stream-online": "device-events",
|
|
28801
28805
|
"stream-offline": "device-events",
|
|
28802
28806
|
"detection-blind": "device-events",
|
|
28807
|
+
"motion-noisy": "device-events",
|
|
28808
|
+
"motion-calm": "device-events",
|
|
28803
28809
|
"recording-stalled": "device-events",
|
|
28804
28810
|
"recording-healthy": "device-events",
|
|
28805
28811
|
"recording-degraded": "device-events",
|
|
28812
|
+
"device-attention-required": "device-events",
|
|
28813
|
+
"device-attention-resolved": "device-events",
|
|
28806
28814
|
"node-online": "system",
|
|
28807
28815
|
"node-offline": "system",
|
|
28808
28816
|
"node-restarting": "system",
|
|
@@ -28819,6 +28827,8 @@ var FAMILY_BY_NAME = new Map(Object.entries({
|
|
|
28819
28827
|
"alert-critical": "system",
|
|
28820
28828
|
"alert-error": "system",
|
|
28821
28829
|
"alert-critical-resolved": "system",
|
|
28830
|
+
"rule-broken": "system",
|
|
28831
|
+
"rule-repaired": "system",
|
|
28822
28832
|
"storage-location-low": "system",
|
|
28823
28833
|
"storage-location-critical": "system",
|
|
28824
28834
|
"storage-location-ok": "system",
|
|
@@ -28835,7 +28845,9 @@ var FAMILY_BY_NAME = new Map(Object.entries({
|
|
|
28835
28845
|
"camera-offline": null,
|
|
28836
28846
|
"camera-disabled": null,
|
|
28837
28847
|
"camera-enabled": null
|
|
28838
|
-
}
|
|
28848
|
+
};
|
|
28849
|
+
/** Read by NAME, for kinds that arrive as plain strings (a newer hub, the viewer's mirror). */
|
|
28850
|
+
var FAMILY_BY_NAME = new Map(Object.entries(NC_SYSTEM_EVENT_FAMILY));
|
|
28839
28851
|
[...NC_SYSTEM_EVENT_FILTER_KEYS];
|
|
28840
28852
|
/**
|
|
28841
28853
|
* The filters a family may carry. The base filters are the union of
|
|
@@ -28899,6 +28911,12 @@ var NC_SYSTEM_EVENT_KIND_GROUP_SPECS = [
|
|
|
28899
28911
|
label: "Detecting nothing",
|
|
28900
28912
|
kinds: ["detection-blind"]
|
|
28901
28913
|
},
|
|
28914
|
+
{
|
|
28915
|
+
id: "motion-noise",
|
|
28916
|
+
family: "device-events",
|
|
28917
|
+
label: "Motion without a subject",
|
|
28918
|
+
kinds: ["motion-noisy", "motion-calm"]
|
|
28919
|
+
},
|
|
28902
28920
|
{
|
|
28903
28921
|
id: "recording",
|
|
28904
28922
|
family: "device-events",
|
|
@@ -28909,6 +28927,12 @@ var NC_SYSTEM_EVENT_KIND_GROUP_SPECS = [
|
|
|
28909
28927
|
"recording-degraded"
|
|
28910
28928
|
]
|
|
28911
28929
|
},
|
|
28930
|
+
{
|
|
28931
|
+
id: "device-attention",
|
|
28932
|
+
family: "device-events",
|
|
28933
|
+
label: "Needs attention",
|
|
28934
|
+
kinds: ["device-attention-required", "device-attention-resolved"]
|
|
28935
|
+
},
|
|
28912
28936
|
{
|
|
28913
28937
|
id: "nodes",
|
|
28914
28938
|
family: "system",
|
|
@@ -28969,6 +28993,12 @@ var NC_SYSTEM_EVENT_KIND_GROUP_SPECS = [
|
|
|
28969
28993
|
"alert-critical-resolved"
|
|
28970
28994
|
]
|
|
28971
28995
|
},
|
|
28996
|
+
{
|
|
28997
|
+
id: "rule-health",
|
|
28998
|
+
family: "system",
|
|
28999
|
+
label: "Notification rules",
|
|
29000
|
+
kinds: ["rule-broken", "rule-repaired"]
|
|
29001
|
+
},
|
|
28972
29002
|
{
|
|
28973
29003
|
id: "alarm",
|
|
28974
29004
|
family: "alarm",
|
|
@@ -29858,6 +29888,7 @@ var ALERT_EPISODE = [
|
|
|
29858
29888
|
"alert-error",
|
|
29859
29889
|
"alert-critical-resolved"
|
|
29860
29890
|
];
|
|
29891
|
+
var DEVICE_ATTENTION = ["device-attention-required", "device-attention-resolved"];
|
|
29861
29892
|
var UPDATES = [
|
|
29862
29893
|
"addon-update-available",
|
|
29863
29894
|
"server-update-available",
|
|
@@ -29887,9 +29918,12 @@ var DEVICE_EVENTS = [
|
|
|
29887
29918
|
"stream-online",
|
|
29888
29919
|
"stream-offline",
|
|
29889
29920
|
"detection-blind",
|
|
29921
|
+
"motion-noisy",
|
|
29922
|
+
"motion-calm",
|
|
29890
29923
|
"recording-stalled",
|
|
29891
29924
|
"recording-healthy",
|
|
29892
29925
|
"recording-degraded",
|
|
29926
|
+
...DEVICE_ATTENTION,
|
|
29893
29927
|
...ALARM
|
|
29894
29928
|
];
|
|
29895
29929
|
/** Every kind a summary may speak about — the two summarisable families. */
|
|
@@ -30463,7 +30497,36 @@ var NC_TEMPLATE_VARS = [
|
|
|
30463
30497
|
families: ["rule"],
|
|
30464
30498
|
fields: [...RULE_TEXT],
|
|
30465
30499
|
kinds: ["system"],
|
|
30466
|
-
systemEventKinds: [
|
|
30500
|
+
systemEventKinds: [
|
|
30501
|
+
"detection-blind",
|
|
30502
|
+
"motion-noisy",
|
|
30503
|
+
"motion-calm",
|
|
30504
|
+
"recording-stalled"
|
|
30505
|
+
]
|
|
30506
|
+
},
|
|
30507
|
+
{
|
|
30508
|
+
name: "duty",
|
|
30509
|
+
label: "Motion share (%)",
|
|
30510
|
+
example: "55",
|
|
30511
|
+
group: "system",
|
|
30512
|
+
families: ["rule"],
|
|
30513
|
+
fields: [...RULE_TEXT],
|
|
30514
|
+
kinds: ["system"],
|
|
30515
|
+
systemEventKinds: ["motion-noisy", "motion-calm"]
|
|
30516
|
+
},
|
|
30517
|
+
{
|
|
30518
|
+
name: "sessions",
|
|
30519
|
+
label: "Detection sessions",
|
|
30520
|
+
example: "96",
|
|
30521
|
+
group: "system",
|
|
30522
|
+
families: ["rule"],
|
|
30523
|
+
fields: [...RULE_TEXT],
|
|
30524
|
+
kinds: ["system"],
|
|
30525
|
+
systemEventKinds: [
|
|
30526
|
+
"detection-blind",
|
|
30527
|
+
"motion-noisy",
|
|
30528
|
+
"motion-calm"
|
|
30529
|
+
]
|
|
30467
30530
|
},
|
|
30468
30531
|
{
|
|
30469
30532
|
name: "message",
|
|
@@ -30473,7 +30536,52 @@ var NC_TEMPLATE_VARS = [
|
|
|
30473
30536
|
families: ["rule"],
|
|
30474
30537
|
fields: [...RULE_TEXT],
|
|
30475
30538
|
kinds: ["system"],
|
|
30476
|
-
systemEventKinds: [
|
|
30539
|
+
systemEventKinds: [
|
|
30540
|
+
"recording-degraded",
|
|
30541
|
+
...DEVICE_ATTENTION,
|
|
30542
|
+
...ALERT_EPISODE
|
|
30543
|
+
]
|
|
30544
|
+
},
|
|
30545
|
+
{
|
|
30546
|
+
name: "ruleName",
|
|
30547
|
+
label: "Rule name",
|
|
30548
|
+
example: "Robot",
|
|
30549
|
+
group: "system",
|
|
30550
|
+
families: ["rule"],
|
|
30551
|
+
fields: [...RULE_TEXT],
|
|
30552
|
+
kinds: ["system"],
|
|
30553
|
+
systemEventKinds: ["rule-broken", "rule-repaired"]
|
|
30554
|
+
},
|
|
30555
|
+
{
|
|
30556
|
+
name: "ruleId",
|
|
30557
|
+
label: "Rule id",
|
|
30558
|
+
example: "3db3e226-9b82-4681-a200-de13b260aa48",
|
|
30559
|
+
group: "system",
|
|
30560
|
+
families: ["rule"],
|
|
30561
|
+
fields: [...RULE_TEXT],
|
|
30562
|
+
kinds: ["system"],
|
|
30563
|
+
systemEventKinds: ["rule-broken", "rule-repaired"]
|
|
30564
|
+
},
|
|
30565
|
+
{
|
|
30566
|
+
name: "brokenReason",
|
|
30567
|
+
label: "Why the rule is broken",
|
|
30568
|
+
description: "unparseable, device-deleted or target-deleted",
|
|
30569
|
+
example: "device-deleted",
|
|
30570
|
+
group: "system",
|
|
30571
|
+
families: ["rule"],
|
|
30572
|
+
fields: [...RULE_TEXT],
|
|
30573
|
+
kinds: ["system"],
|
|
30574
|
+
systemEventKinds: ["rule-broken"]
|
|
30575
|
+
},
|
|
30576
|
+
{
|
|
30577
|
+
name: "offendingIds",
|
|
30578
|
+
label: "Deleted devices or destinations",
|
|
30579
|
+
example: "4483",
|
|
30580
|
+
group: "system",
|
|
30581
|
+
families: ["rule"],
|
|
30582
|
+
fields: [...RULE_TEXT],
|
|
30583
|
+
kinds: ["system"],
|
|
30584
|
+
systemEventKinds: ["rule-broken"]
|
|
30477
30585
|
},
|
|
30478
30586
|
{
|
|
30479
30587
|
name: "locationName",
|
|
@@ -30676,7 +30784,11 @@ var NC_TEMPLATE_VARS = [
|
|
|
30676
30784
|
families: ["rule"],
|
|
30677
30785
|
fields: [...RULE_TEXT],
|
|
30678
30786
|
kinds: ["system"],
|
|
30679
|
-
systemEventKinds: [
|
|
30787
|
+
systemEventKinds: [
|
|
30788
|
+
"export-completed",
|
|
30789
|
+
...DEVICE_ATTENTION,
|
|
30790
|
+
...ALERT_EPISODE
|
|
30791
|
+
]
|
|
30680
30792
|
},
|
|
30681
30793
|
{
|
|
30682
30794
|
name: "severity",
|
|
@@ -30696,7 +30808,7 @@ var NC_TEMPLATE_VARS = [
|
|
|
30696
30808
|
families: ["rule"],
|
|
30697
30809
|
fields: [...RULE_TEXT],
|
|
30698
30810
|
kinds: ["system"],
|
|
30699
|
-
systemEventKinds: [...ALERT_EPISODE]
|
|
30811
|
+
systemEventKinds: [...DEVICE_ATTENTION, ...ALERT_EPISODE]
|
|
30700
30812
|
},
|
|
30701
30813
|
{
|
|
30702
30814
|
name: "source",
|
|
@@ -30716,7 +30828,7 @@ var NC_TEMPLATE_VARS = [
|
|
|
30716
30828
|
families: ["rule"],
|
|
30717
30829
|
fields: [...RULE_TEXT],
|
|
30718
30830
|
kinds: ["system"],
|
|
30719
|
-
systemEventKinds: [...ALERT_EPISODE]
|
|
30831
|
+
systemEventKinds: [...DEVICE_ATTENTION, ...ALERT_EPISODE]
|
|
30720
30832
|
},
|
|
30721
30833
|
{
|
|
30722
30834
|
name: "exportId",
|
|
@@ -30930,7 +31042,11 @@ var NC_TEMPLATE_HELD_BACK_SYSTEM_EVENT_KINDS = [
|
|
|
30930
31042
|
"node-updating",
|
|
30931
31043
|
"alert-critical",
|
|
30932
31044
|
"alert-error",
|
|
30933
|
-
"alert-critical-resolved"
|
|
31045
|
+
"alert-critical-resolved",
|
|
31046
|
+
"device-attention-required",
|
|
31047
|
+
"device-attention-resolved",
|
|
31048
|
+
"rule-broken",
|
|
31049
|
+
"rule-repaired"
|
|
30934
31050
|
];
|
|
30935
31051
|
/**
|
|
30936
31052
|
* Is this descriptor held back from the SERVED catalog as a whole (D647)?
|
|
@@ -30987,6 +31103,196 @@ function templateVarSystemEventApplies(d, ctx) {
|
|
|
30987
31103
|
return declared.some((k) => own.includes(k));
|
|
30988
31104
|
}
|
|
30989
31105
|
//#endregion
|
|
31106
|
+
//#region src/notification/system-event-classes.ts
|
|
31107
|
+
var NC_SYSTEM_EVENT_CLASS_SPECS = [
|
|
31108
|
+
{
|
|
31109
|
+
id: "device-connectivity",
|
|
31110
|
+
family: "device-events",
|
|
31111
|
+
label: "Device connectivity (offline / back online)",
|
|
31112
|
+
bad: ["device-offline"],
|
|
31113
|
+
recovery: ["device-online"],
|
|
31114
|
+
snapshotLabel: "Devices offline now",
|
|
31115
|
+
snapshotSection: "device-state"
|
|
31116
|
+
},
|
|
31117
|
+
{
|
|
31118
|
+
id: "device-switch",
|
|
31119
|
+
family: "device-events",
|
|
31120
|
+
label: "Device switched off / back on",
|
|
31121
|
+
bad: ["device-disabled"],
|
|
31122
|
+
recovery: ["device-enabled"],
|
|
31123
|
+
snapshotLabel: "Devices switched off now",
|
|
31124
|
+
snapshotSection: "device-state"
|
|
31125
|
+
},
|
|
31126
|
+
{
|
|
31127
|
+
id: "stream-connectivity",
|
|
31128
|
+
family: "device-events",
|
|
31129
|
+
label: "Stream connectivity (offline / back online)",
|
|
31130
|
+
bad: ["stream-offline"],
|
|
31131
|
+
recovery: ["stream-online"],
|
|
31132
|
+
snapshotLabel: "Streams offline now",
|
|
31133
|
+
snapshotSection: "streams"
|
|
31134
|
+
},
|
|
31135
|
+
{
|
|
31136
|
+
id: "battery",
|
|
31137
|
+
family: "device-events",
|
|
31138
|
+
label: "Battery (low / back to normal)",
|
|
31139
|
+
bad: ["device-battery-low"],
|
|
31140
|
+
recovery: ["device-battery-normal"],
|
|
31141
|
+
snapshotLabel: "Batteries low now",
|
|
31142
|
+
snapshotSection: "battery"
|
|
31143
|
+
},
|
|
31144
|
+
{
|
|
31145
|
+
id: "consumables",
|
|
31146
|
+
family: "device-events",
|
|
31147
|
+
label: "Consumables (low / replaced)",
|
|
31148
|
+
bad: ["device-consumable-low"],
|
|
31149
|
+
recovery: ["device-consumable-normal"],
|
|
31150
|
+
snapshotLabel: "Consumables low now",
|
|
31151
|
+
snapshotSection: "consumables"
|
|
31152
|
+
},
|
|
31153
|
+
{
|
|
31154
|
+
id: "tanks",
|
|
31155
|
+
family: "device-events",
|
|
31156
|
+
label: "Tanks (low or full / back to normal)",
|
|
31157
|
+
bad: ["device-tank-low", "device-tank-full"],
|
|
31158
|
+
recovery: ["device-tank-normal"],
|
|
31159
|
+
snapshotLabel: "Tanks low or full now",
|
|
31160
|
+
snapshotSection: "tanks"
|
|
31161
|
+
},
|
|
31162
|
+
{
|
|
31163
|
+
id: "motion-noise",
|
|
31164
|
+
family: "device-events",
|
|
31165
|
+
label: "Motion without a subject (constant / calm again)",
|
|
31166
|
+
bad: ["motion-noisy"],
|
|
31167
|
+
recovery: ["motion-calm"],
|
|
31168
|
+
snapshotLabel: "Cameras with constant motion now",
|
|
31169
|
+
snapshotSection: null
|
|
31170
|
+
},
|
|
31171
|
+
{
|
|
31172
|
+
id: "recording-health",
|
|
31173
|
+
family: "device-events",
|
|
31174
|
+
label: "Recording health (stalled or degraded / recording again)",
|
|
31175
|
+
bad: ["recording-stalled", "recording-degraded"],
|
|
31176
|
+
recovery: ["recording-healthy"],
|
|
31177
|
+
snapshotLabel: "Recordings stalled now",
|
|
31178
|
+
snapshotSection: null
|
|
31179
|
+
},
|
|
31180
|
+
{
|
|
31181
|
+
id: "device-attention",
|
|
31182
|
+
family: "device-events",
|
|
31183
|
+
label: "Device needs attention (raised / resolved)",
|
|
31184
|
+
bad: ["device-attention-required"],
|
|
31185
|
+
recovery: ["device-attention-resolved"],
|
|
31186
|
+
snapshotLabel: "Devices needing attention now",
|
|
31187
|
+
snapshotSection: null
|
|
31188
|
+
},
|
|
31189
|
+
{
|
|
31190
|
+
id: "node-connectivity",
|
|
31191
|
+
family: "system",
|
|
31192
|
+
label: "Node connectivity (offline / back online)",
|
|
31193
|
+
bad: ["node-offline"],
|
|
31194
|
+
recovery: ["node-online"],
|
|
31195
|
+
snapshotLabel: "Nodes offline now",
|
|
31196
|
+
snapshotSection: "nodes"
|
|
31197
|
+
},
|
|
31198
|
+
{
|
|
31199
|
+
id: "storage-space",
|
|
31200
|
+
family: "system",
|
|
31201
|
+
label: "Storage space (low or critical / ok again)",
|
|
31202
|
+
bad: ["storage-location-low", "storage-location-critical"],
|
|
31203
|
+
recovery: ["storage-location-ok"],
|
|
31204
|
+
snapshotLabel: "Storage locations low now",
|
|
31205
|
+
snapshotSection: null
|
|
31206
|
+
},
|
|
31207
|
+
{
|
|
31208
|
+
id: "critical-alerts",
|
|
31209
|
+
family: "system",
|
|
31210
|
+
label: "Critical alerts (raised / resolved)",
|
|
31211
|
+
bad: ["alert-critical"],
|
|
31212
|
+
recovery: ["alert-critical-resolved"],
|
|
31213
|
+
snapshotLabel: "Critical alerts open now",
|
|
31214
|
+
snapshotSection: null
|
|
31215
|
+
},
|
|
31216
|
+
{
|
|
31217
|
+
id: "rule-health",
|
|
31218
|
+
family: "system",
|
|
31219
|
+
label: "Rule health (broken / repaired)",
|
|
31220
|
+
bad: ["rule-broken"],
|
|
31221
|
+
recovery: ["rule-repaired"],
|
|
31222
|
+
snapshotLabel: "Notification rules broken now",
|
|
31223
|
+
snapshotSection: null
|
|
31224
|
+
}
|
|
31225
|
+
];
|
|
31226
|
+
var CLASS_BY_KIND = new Map(NC_SYSTEM_EVENT_CLASS_SPECS.flatMap((spec) => [...spec.bad, ...spec.recovery].map((kind) => [kind, spec])));
|
|
31227
|
+
/** Every edge of a class: what an instant rule selecting it listens to. */
|
|
31228
|
+
function systemEventClassKinds(spec) {
|
|
31229
|
+
return [...spec.bad, ...spec.recovery];
|
|
31230
|
+
}
|
|
31231
|
+
/** The class a kind belongs to, or `undefined` for a one-edge kind. */
|
|
31232
|
+
function systemEventClassOf(kind) {
|
|
31233
|
+
return CLASS_BY_KIND.get(kind);
|
|
31234
|
+
}
|
|
31235
|
+
/** The classes of ONE family, for that family's editor. */
|
|
31236
|
+
function systemEventClassesFor(family) {
|
|
31237
|
+
return NC_SYSTEM_EVENT_CLASS_SPECS.filter((spec) => spec.family === family);
|
|
31238
|
+
}
|
|
31239
|
+
/**
|
|
31240
|
+
* A kind list with the OTHER front of every class it touches: a bad edge
|
|
31241
|
+
* brings the class's recovery, a recovery brings the class's bad edges. A
|
|
31242
|
+
* sibling bad edge is never added by a bad edge — a rule on
|
|
31243
|
+
* `storage-location-critical` does not start hearing `storage-location-low`.
|
|
31244
|
+
* Input order is kept, each added edge right after the kind that brought it.
|
|
31245
|
+
* Kinds of no class (and legacy names) pass through.
|
|
31246
|
+
*/
|
|
31247
|
+
function expandSystemEventClasses(kinds) {
|
|
31248
|
+
const out = [];
|
|
31249
|
+
const seen = /* @__PURE__ */ new Set();
|
|
31250
|
+
const push = (kind) => {
|
|
31251
|
+
if (seen.has(kind)) return;
|
|
31252
|
+
seen.add(kind);
|
|
31253
|
+
out.push(kind);
|
|
31254
|
+
};
|
|
31255
|
+
const listed = new Set(kinds);
|
|
31256
|
+
for (const kind of kinds) {
|
|
31257
|
+
push(kind);
|
|
31258
|
+
const spec = systemEventClassOf(kind);
|
|
31259
|
+
if (spec === void 0) continue;
|
|
31260
|
+
const hasBad = spec.bad.some((k) => listed.has(k));
|
|
31261
|
+
if (spec.bad.some((k) => k === kind)) for (const edge of spec.recovery) push(edge);
|
|
31262
|
+
else if (!hasBad) for (const edge of spec.bad) push(edge);
|
|
31263
|
+
}
|
|
31264
|
+
return out;
|
|
31265
|
+
}
|
|
31266
|
+
/** Does this rule speak per EVENT (not a scheduled summary)? */
|
|
31267
|
+
function isInstantSystemRule(rule) {
|
|
31268
|
+
if (rule.delivery !== "system-event") return false;
|
|
31269
|
+
return rule.systemEventDelivery?.mode !== "summary";
|
|
31270
|
+
}
|
|
31271
|
+
/**
|
|
31272
|
+
* An INSTANT system rule with each class it touches completed with both edges;
|
|
31273
|
+
* the rule itself (same object) when there is nothing to add, a summary rule,
|
|
31274
|
+
* or a rule spanning families (`mixed` stays read-only, D637). A copy, never a
|
|
31275
|
+
* mutation.
|
|
31276
|
+
*/
|
|
31277
|
+
function withSystemEventClasses(rule) {
|
|
31278
|
+
const condition = rule.conditions.systemEvent;
|
|
31279
|
+
if (condition === void 0 || !isInstantSystemRule(rule)) return rule;
|
|
31280
|
+
const families = new Set(condition.kinds.map((kind) => NC_SYSTEM_EVENT_FAMILY[kind]));
|
|
31281
|
+
if (families.size !== 1 || families.has(null)) return rule;
|
|
31282
|
+
const kinds = expandSystemEventClasses(condition.kinds);
|
|
31283
|
+
if (kinds.length === condition.kinds.length) return rule;
|
|
31284
|
+
return {
|
|
31285
|
+
...rule,
|
|
31286
|
+
conditions: {
|
|
31287
|
+
...rule.conditions,
|
|
31288
|
+
systemEvent: {
|
|
31289
|
+
...condition,
|
|
31290
|
+
kinds
|
|
31291
|
+
}
|
|
31292
|
+
}
|
|
31293
|
+
};
|
|
31294
|
+
}
|
|
31295
|
+
//#endregion
|
|
30990
31296
|
//#region src/notification/system-event-summary.ts
|
|
30991
31297
|
/** The families a rule may summarise. The alarm is not one of them. */
|
|
30992
31298
|
var NC_SYSTEM_EVENT_SUMMARY_FAMILIES = ["device-events", "system"];
|
|
@@ -31560,6 +31866,7 @@ exports.NC_GROUPING_MIN_SEC = NC_GROUPING_MIN_SEC;
|
|
|
31560
31866
|
exports.NC_RULE_EDITOR_SECTION_ORDER = NC_RULE_EDITOR_SECTION_ORDER;
|
|
31561
31867
|
exports.NC_RULE_KIND_SPECS = NC_RULE_KIND_SPECS;
|
|
31562
31868
|
exports.NC_SENSOR_TRANSITION_UNSUPPORTED_REASON = NC_SENSOR_TRANSITION_UNSUPPORTED_REASON;
|
|
31869
|
+
exports.NC_SYSTEM_EVENT_CLASS_SPECS = NC_SYSTEM_EVENT_CLASS_SPECS;
|
|
31563
31870
|
exports.NC_SYSTEM_EVENT_FAMILY_FILTERS = NC_SYSTEM_EVENT_FAMILY_FILTERS;
|
|
31564
31871
|
exports.NC_SYSTEM_EVENT_KIND_GROUP_SPECS = NC_SYSTEM_EVENT_KIND_GROUP_SPECS;
|
|
31565
31872
|
exports.NC_SYSTEM_EVENT_SUMMARY_FAMILIES = NC_SYSTEM_EVENT_SUMMARY_FAMILIES;
|
|
@@ -31592,6 +31899,7 @@ exports.conditionVisibleForKind = conditionVisibleForKind;
|
|
|
31592
31899
|
exports.createSystemProxy = createSystemProxy;
|
|
31593
31900
|
exports.deviceRefusalFromMessage = deviceRefusalFromMessage;
|
|
31594
31901
|
exports.droppedConditionsForKind = droppedConditionsForKind;
|
|
31902
|
+
exports.expandSystemEventClasses = expandSystemEventClasses;
|
|
31595
31903
|
exports.iconCategoryLabel = iconCategoryLabel;
|
|
31596
31904
|
exports.iconEntry = iconEntry;
|
|
31597
31905
|
exports.iconsInCategory = iconsInCategory;
|
|
@@ -31627,6 +31935,8 @@ exports.stateLabel = stateLabel;
|
|
|
31627
31935
|
exports.subjectPathSampleFromBox = subjectPathSampleFromBox;
|
|
31628
31936
|
exports.subjectPathSvgPoints = subjectPathSvgPoints;
|
|
31629
31937
|
exports.summarizeReview = summarizeReview;
|
|
31938
|
+
exports.systemEventClassKinds = systemEventClassKinds;
|
|
31939
|
+
exports.systemEventClassesFor = systemEventClassesFor;
|
|
31630
31940
|
exports.systemEventDeliveryProblems = systemEventDeliveryProblems;
|
|
31631
31941
|
exports.systemEventFilterAppliesToAnyKind = systemEventFilterAppliesToAnyKind;
|
|
31632
31942
|
exports.systemEventKindsOfFamily = systemEventKindsOfFamily;
|
|
@@ -31635,3 +31945,4 @@ exports.templateCarriesSummary = templateCarriesSummary;
|
|
|
31635
31945
|
exports.templateVarDeliveryApplies = templateVarDeliveryApplies;
|
|
31636
31946
|
exports.templateVarKindApplies = templateVarKindApplies;
|
|
31637
31947
|
exports.templateVarSystemEventApplies = templateVarSystemEventApplies;
|
|
31948
|
+
exports.withSystemEventClasses = withSystemEventClasses;
|