@camstack/addon-post-analysis 1.2.280 → 1.2.281
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/{dist-VeiAavYR.js → dist-BtqlSCQT.js} +397 -23
- package/dist/{dist-Z6AO1MsY.mjs → dist-DkERzZfY.mjs} +368 -24
- package/dist/embedding-encoder/index.js +1 -1
- package/dist/embedding-encoder/index.mjs +1 -1
- package/dist/pipeline-analytics/_stub.js +2 -2
- package/dist/pipeline-analytics/{_virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_analytics_widgets-C_C1P6Bk.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_analytics_widgets-d-u88SNA.mjs} +2 -2
- package/dist/pipeline-analytics/_virtual_mf___mfe_internal__addon_pipeline_analytics_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-OkXjMLHG.mjs +26 -0
- package/dist/pipeline-analytics/{_virtual_mf___mfe_internal__addon_pipeline_analytics_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-B62fofgN.mjs → _virtual_mf___mfe_internal__addon_pipeline_analytics_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-BA7N1yDM.mjs} +1 -1
- package/dist/pipeline-analytics/{hostInit-B5__n3rE.mjs → hostInit-Cq_8hgwY.mjs} +2 -2
- package/dist/pipeline-analytics/index.js +156 -2
- package/dist/pipeline-analytics/index.mjs +156 -2
- package/dist/pipeline-analytics/remoteEntry.js +1 -1
- package/package.json +1 -1
- package/dist/pipeline-analytics/_virtual_mf___mfe_internal__addon_pipeline_analytics_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-DBnj0lb3.mjs +0 -26
|
@@ -29,6 +29,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
29
29
|
enumerable: true
|
|
30
30
|
}) : target, mod));
|
|
31
31
|
//#endregion
|
|
32
|
+
let node_crypto = require("node:crypto");
|
|
32
33
|
//#region ../types/dist/event-category-BVDXG4tB.mjs
|
|
33
34
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
34
35
|
EventCategory["SystemBoot"] = "system.boot";
|
|
@@ -7598,6 +7599,39 @@ function sleep(ms) {
|
|
|
7598
7599
|
return new Promise((resolve) => setTimeout(resolve, Math.max(0, ms)));
|
|
7599
7600
|
}
|
|
7600
7601
|
//#endregion
|
|
7602
|
+
//#region ../types/dist/canonical-hash-CPK2Dy60.mjs
|
|
7603
|
+
/**
|
|
7604
|
+
* Deterministic SHA-256 hash of an arbitrary serialisable value. The
|
|
7605
|
+
* canonical form sorts object keys alphabetically at every depth so two
|
|
7606
|
+
* structurally-equal inputs with different key insertion orders produce
|
|
7607
|
+
* the same hash. Returns a 64-char lowercase hex digest.
|
|
7608
|
+
*
|
|
7609
|
+
* Used by export adapters (Alexa, HAP) to short-circuit re-discovery /
|
|
7610
|
+
* accessory-rebuild work when the upstream shape is byte-identical to
|
|
7611
|
+
* the last applied state — preventing user-visible "re-discovery"
|
|
7612
|
+
* notifications on every addon-runner respawn. Each respawn re-fires
|
|
7613
|
+
* `DeviceBindingsChanged` for every cap registration, which without
|
|
7614
|
+
* this guard would propagate redundant pushes.
|
|
7615
|
+
*
|
|
7616
|
+
* Note: this is a SYMPTOMATIC fix layered on top of the binding-change
|
|
7617
|
+
* subscription. The proper fix is a single "device ready" lifecycle
|
|
7618
|
+
* barrier so exports react only when the full cap set has landed —
|
|
7619
|
+
* tracked separately for post-HA-integration work.
|
|
7620
|
+
*/
|
|
7621
|
+
function canonicalHash(value) {
|
|
7622
|
+
const canonical = JSON.stringify(value, replaceWithSortedKeys);
|
|
7623
|
+
return (0, node_crypto.createHash)("sha256").update(canonical ?? "").digest("hex");
|
|
7624
|
+
}
|
|
7625
|
+
function replaceWithSortedKeys(_key, value) {
|
|
7626
|
+
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
7627
|
+
const obj = value;
|
|
7628
|
+
const out = {};
|
|
7629
|
+
for (const k of Object.keys(obj).toSorted()) out[k] = obj[k];
|
|
7630
|
+
return out;
|
|
7631
|
+
}
|
|
7632
|
+
return value;
|
|
7633
|
+
}
|
|
7634
|
+
//#endregion
|
|
7601
7635
|
//#region ../types/dist/err-msg-IQTHeDzc.mjs
|
|
7602
7636
|
/**
|
|
7603
7637
|
import { errMsg } from '@camstack/types'
|
|
@@ -18996,9 +19030,29 @@ var NcTestResultSchema = object({
|
|
|
18996
19030
|
className: string().optional(),
|
|
18997
19031
|
label: string().optional()
|
|
18998
19032
|
});
|
|
18999
|
-
/** The
|
|
19000
|
-
*
|
|
19033
|
+
/** The rule kinds, as data. `NcRuleKind` in `notification/rule-kinds.ts` is the
|
|
19034
|
+
* same union; the template-vars spec pins the two together. `mixed` is DERIVED
|
|
19035
|
+
* (a stored system rule whose kinds span families, D637) and never authored. */
|
|
19001
19036
|
var NcRuleKindSchema = _enum([
|
|
19037
|
+
"detection",
|
|
19038
|
+
"sensor",
|
|
19039
|
+
"occupancy",
|
|
19040
|
+
"sound",
|
|
19041
|
+
"device-events",
|
|
19042
|
+
"system",
|
|
19043
|
+
"alarm",
|
|
19044
|
+
"mixed"
|
|
19045
|
+
]);
|
|
19046
|
+
/**
|
|
19047
|
+
* The kinds a SERVED template-variable descriptor may name: the five that
|
|
19048
|
+
* existed before D637, frozen. `getTemplateCatalog` ships `kinds` to every
|
|
19049
|
+
* installed viewer, and a viewer at `@camstack/types` 1.2.25x parses them with a
|
|
19050
|
+
* strict five-member enum — one `device-events` in one descriptor fails the
|
|
19051
|
+
* whole catalog parse. So the WIRE says `system`, and the MATCH widens it:
|
|
19052
|
+
* `templateVarKindApplies` reads a `system` descriptor as applying to every
|
|
19053
|
+
* system rule kind (`device-events`, `system`, `alarm`, `mixed`).
|
|
19054
|
+
*/
|
|
19055
|
+
var NcTemplateVarKindSchema = _enum([
|
|
19002
19056
|
"detection",
|
|
19003
19057
|
"sensor",
|
|
19004
19058
|
"occupancy",
|
|
@@ -19036,7 +19090,7 @@ var NcTemplateVarGroupSchema = _enum([
|
|
|
19036
19090
|
*
|
|
19037
19091
|
* `families` / `fields` / `kinds` / `deliveries` / `systemEventKinds` say WHERE
|
|
19038
19092
|
* it has a value; absent = no restriction on that axis. `systemEventKinds` is
|
|
19039
|
-
* read only for a
|
|
19093
|
+
* read only for a system-event rule (any family, or `mixed`). `dynamic` declares a FAMILY of names
|
|
19040
19094
|
* (`count_<class>`): the descriptor's `name` is the example member.
|
|
19041
19095
|
*/
|
|
19042
19096
|
var NcTemplateVarDescriptorSchema = object({
|
|
@@ -19047,7 +19101,7 @@ var NcTemplateVarDescriptorSchema = object({
|
|
|
19047
19101
|
group: NcTemplateVarGroupSchema,
|
|
19048
19102
|
families: array(NcTemplateFamilySchema).min(1),
|
|
19049
19103
|
fields: array(NcTemplateFieldSchema).optional(),
|
|
19050
|
-
kinds: array(
|
|
19104
|
+
kinds: array(NcTemplateVarKindSchema).optional(),
|
|
19051
19105
|
deliveries: array(NcDeliverySchema).optional(),
|
|
19052
19106
|
systemEventKinds: array(NcSystemEventKindSchema).optional(),
|
|
19053
19107
|
dynamic: object({
|
|
@@ -33200,7 +33254,30 @@ var RenameNodeResultSchema = object({
|
|
|
33200
33254
|
nodeId: string(),
|
|
33201
33255
|
name: string()
|
|
33202
33256
|
});
|
|
33203
|
-
|
|
33257
|
+
/**
|
|
33258
|
+
* The cheap node list. A consumer's rule for a STORED node id (a rule's
|
|
33259
|
+
* `nodeIds`) that is missing from `nodes`, whatever `complete` says: render it
|
|
33260
|
+
* as a removable chip labelled unknown, never drop it (D49). Even a complete
|
|
33261
|
+
* list omits a node that joined and left between two history captures, so a
|
|
33262
|
+
* missing id means "not known to the hub", never "removed". Only the operator
|
|
33263
|
+
* removes it.
|
|
33264
|
+
*
|
|
33265
|
+
* `complete` changes only the WORDING: `false` = no history read has ever
|
|
33266
|
+
* answered, so the list may be missing offline nodes the hub does know (D315).
|
|
33267
|
+
*
|
|
33268
|
+
* `name` is the history row's name (≤ 30 s behind a rename), or the id when
|
|
33269
|
+
* the history has none.
|
|
33270
|
+
*/
|
|
33271
|
+
var NodeDirectorySchema = object({
|
|
33272
|
+
nodes: array(object({
|
|
33273
|
+
id: string(),
|
|
33274
|
+
name: string(),
|
|
33275
|
+
isHub: boolean(),
|
|
33276
|
+
isOnline: boolean()
|
|
33277
|
+
})).readonly(),
|
|
33278
|
+
complete: boolean()
|
|
33279
|
+
});
|
|
33280
|
+
method(_void(), array(TopologyNodeSchema).readonly(), { auth: "admin" }), method(_void(), NodeDirectorySchema, { auth: "admin" }), method(NodeAddonInputSchema, SuccessSchema, {
|
|
33204
33281
|
kind: "mutation",
|
|
33205
33282
|
auth: "admin"
|
|
33206
33283
|
}), method(NodeAddonInputSchema, SuccessSchema, {
|
|
@@ -44726,6 +44803,12 @@ Object.freeze({
|
|
|
44726
44803
|
addonId: null,
|
|
44727
44804
|
access: "create"
|
|
44728
44805
|
},
|
|
44806
|
+
"nodes.directory": {
|
|
44807
|
+
capName: "nodes",
|
|
44808
|
+
capScope: "system",
|
|
44809
|
+
addonId: null,
|
|
44810
|
+
access: "view"
|
|
44811
|
+
},
|
|
44729
44812
|
"nodes.executeQuery": {
|
|
44730
44813
|
capName: "nodes",
|
|
44731
44814
|
capScope: "system",
|
|
@@ -50510,6 +50593,253 @@ function audioModeOf(value) {
|
|
|
50510
50593
|
return null;
|
|
50511
50594
|
}
|
|
50512
50595
|
new Set(["devices", "classes"]);
|
|
50596
|
+
/** Every filter, for the callers that must cover all four (guards, tests). */
|
|
50597
|
+
var NC_SYSTEM_EVENT_FILTER_KEYS = [
|
|
50598
|
+
"deviceIds",
|
|
50599
|
+
"deviceTypes",
|
|
50600
|
+
"nodeIds",
|
|
50601
|
+
"packageNames"
|
|
50602
|
+
];
|
|
50603
|
+
/**
|
|
50604
|
+
* Does `filter` say anything about `kind`?
|
|
50605
|
+
*
|
|
50606
|
+
* `false` means the filter is not part of this kind's vocabulary: the engine
|
|
50607
|
+
* ignores it and an editor hides its input. It never means "excluded".
|
|
50608
|
+
*/
|
|
50609
|
+
function systemEventFilterApplies(kind, filter) {
|
|
50610
|
+
switch (filter) {
|
|
50611
|
+
case "deviceIds": return kind.startsWith("device-") || kind.startsWith("stream-") || kind === "detection-blind" || kind === "alarm-triggered";
|
|
50612
|
+
case "deviceTypes": return kind.startsWith("device-") || kind === "detection-blind";
|
|
50613
|
+
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";
|
|
50614
|
+
case "packageNames": return kind.endsWith("update-available") || kind === "addon-updated" || kind === "server-updated";
|
|
50615
|
+
}
|
|
50616
|
+
}
|
|
50617
|
+
/**
|
|
50618
|
+
* WHICH FAMILY every system-event kind belongs to, and which narrowing filters
|
|
50619
|
+
* each family may carry: one table, read by the hub validator, by `ruleKindOf`
|
|
50620
|
+
* and by both rule editors (D637).
|
|
50621
|
+
*
|
|
50622
|
+
* A system rule used to be one editor for thirty-one kinds and five filters.
|
|
50623
|
+
* "Eventi di sistema" carried battery kinds under a liveness `deviceTypes` filter
|
|
50624
|
+
* and went silent for two weeks (D636). The three families are three questions:
|
|
50625
|
+
* about devices, about the installation, and about the alarm panel. A rule
|
|
50626
|
+
* answers one of them. The engine never needed to know, and it still does not:
|
|
50627
|
+
* a mixed stored rule keeps firing. Only AUTHORING is strict.
|
|
50628
|
+
*
|
|
50629
|
+
* The legacy `camera-*` tail has no family (`null`). It is parsed, never produced,
|
|
50630
|
+
* never offered.
|
|
50631
|
+
*/
|
|
50632
|
+
var NC_SYSTEM_EVENT_FAMILIES = [
|
|
50633
|
+
"device-events",
|
|
50634
|
+
"system",
|
|
50635
|
+
"alarm"
|
|
50636
|
+
];
|
|
50637
|
+
function isSystemEventFamily(value) {
|
|
50638
|
+
return NC_SYSTEM_EVENT_FAMILIES.some((family) => family === value);
|
|
50639
|
+
}
|
|
50640
|
+
/** Total over the enum: a kind added to the cap without a family fails tsc here. */
|
|
50641
|
+
var NC_SYSTEM_EVENT_FAMILY = {
|
|
50642
|
+
"device-online": "device-events",
|
|
50643
|
+
"device-offline": "device-events",
|
|
50644
|
+
"device-disabled": "device-events",
|
|
50645
|
+
"device-enabled": "device-events",
|
|
50646
|
+
"device-battery-low": "device-events",
|
|
50647
|
+
"device-battery-normal": "device-events",
|
|
50648
|
+
"device-consumable-low": "device-events",
|
|
50649
|
+
"device-consumable-normal": "device-events",
|
|
50650
|
+
"stream-online": "device-events",
|
|
50651
|
+
"stream-offline": "device-events",
|
|
50652
|
+
"detection-blind": "device-events",
|
|
50653
|
+
"node-online": "system",
|
|
50654
|
+
"node-offline": "system",
|
|
50655
|
+
"node-inference-unavailable": "system",
|
|
50656
|
+
"addon-crash-loop": "system",
|
|
50657
|
+
"addon-update-available": "system",
|
|
50658
|
+
"addon-updated": "system",
|
|
50659
|
+
"server-update-available": "system",
|
|
50660
|
+
"server-updated": "system",
|
|
50661
|
+
"wrapper-update-available": "system",
|
|
50662
|
+
"backup-completed": "system",
|
|
50663
|
+
"export-completed": "system",
|
|
50664
|
+
"alarm-triggered": "alarm",
|
|
50665
|
+
"alarm-armed": "alarm",
|
|
50666
|
+
"alarm-disarmed": "alarm",
|
|
50667
|
+
"alarm-arming": "alarm",
|
|
50668
|
+
"alarm-arm-refused": "alarm",
|
|
50669
|
+
"alarm-pending": "alarm",
|
|
50670
|
+
"alarm-rearmed": "alarm",
|
|
50671
|
+
"alarm-sensor-bypass": "alarm",
|
|
50672
|
+
"alarm-check-failed": "alarm",
|
|
50673
|
+
"camera-online": null,
|
|
50674
|
+
"camera-offline": null,
|
|
50675
|
+
"camera-disabled": null,
|
|
50676
|
+
"camera-enabled": null
|
|
50677
|
+
};
|
|
50678
|
+
new Map(Object.entries(NC_SYSTEM_EVENT_FAMILY));
|
|
50679
|
+
var NC_SYSTEM_EVENT_CONDITION_FILTER_KEYS = [...NC_SYSTEM_EVENT_FILTER_KEYS, "excludeDeviceIds"];
|
|
50680
|
+
/**
|
|
50681
|
+
* The filters a family may carry. The four base filters are the union of
|
|
50682
|
+
* `systemEventFilterApplies` over the family's kinds (the spec pins that
|
|
50683
|
+
* equality). `excludeDeviceIds` is a device-events filter only: an alarm is
|
|
50684
|
+
* narrowed to the camera that triggered it and excludes nothing.
|
|
50685
|
+
*/
|
|
50686
|
+
var NC_SYSTEM_EVENT_FAMILY_FILTERS = {
|
|
50687
|
+
"device-events": [
|
|
50688
|
+
"deviceIds",
|
|
50689
|
+
"excludeDeviceIds",
|
|
50690
|
+
"deviceTypes"
|
|
50691
|
+
],
|
|
50692
|
+
system: ["nodeIds", "packageNames"],
|
|
50693
|
+
alarm: ["deviceIds"]
|
|
50694
|
+
};
|
|
50695
|
+
var NC_SYSTEM_EVENT_KIND_GROUP_SPECS = [
|
|
50696
|
+
{
|
|
50697
|
+
id: "device-state",
|
|
50698
|
+
family: "device-events",
|
|
50699
|
+
label: "Device state",
|
|
50700
|
+
kinds: [
|
|
50701
|
+
"device-offline",
|
|
50702
|
+
"device-online",
|
|
50703
|
+
"device-disabled",
|
|
50704
|
+
"device-enabled"
|
|
50705
|
+
]
|
|
50706
|
+
},
|
|
50707
|
+
{
|
|
50708
|
+
id: "streams",
|
|
50709
|
+
family: "device-events",
|
|
50710
|
+
label: "Streams",
|
|
50711
|
+
kinds: ["stream-offline", "stream-online"]
|
|
50712
|
+
},
|
|
50713
|
+
{
|
|
50714
|
+
id: "battery",
|
|
50715
|
+
family: "device-events",
|
|
50716
|
+
label: "Battery",
|
|
50717
|
+
kinds: ["device-battery-low", "device-battery-normal"]
|
|
50718
|
+
},
|
|
50719
|
+
{
|
|
50720
|
+
id: "consumables",
|
|
50721
|
+
family: "device-events",
|
|
50722
|
+
label: "Consumables",
|
|
50723
|
+
kinds: ["device-consumable-low", "device-consumable-normal"]
|
|
50724
|
+
},
|
|
50725
|
+
{
|
|
50726
|
+
id: "detection-blind",
|
|
50727
|
+
family: "device-events",
|
|
50728
|
+
label: "Detecting nothing",
|
|
50729
|
+
kinds: ["detection-blind"]
|
|
50730
|
+
},
|
|
50731
|
+
{
|
|
50732
|
+
id: "nodes",
|
|
50733
|
+
family: "system",
|
|
50734
|
+
label: "Nodes",
|
|
50735
|
+
kinds: [
|
|
50736
|
+
"node-offline",
|
|
50737
|
+
"node-online",
|
|
50738
|
+
"node-inference-unavailable"
|
|
50739
|
+
]
|
|
50740
|
+
},
|
|
50741
|
+
{
|
|
50742
|
+
id: "addons",
|
|
50743
|
+
family: "system",
|
|
50744
|
+
label: "Addons",
|
|
50745
|
+
kinds: [
|
|
50746
|
+
"addon-crash-loop",
|
|
50747
|
+
"addon-update-available",
|
|
50748
|
+
"addon-updated"
|
|
50749
|
+
]
|
|
50750
|
+
},
|
|
50751
|
+
{
|
|
50752
|
+
id: "updates",
|
|
50753
|
+
family: "system",
|
|
50754
|
+
label: "Server & container updates",
|
|
50755
|
+
kinds: [
|
|
50756
|
+
"server-update-available",
|
|
50757
|
+
"server-updated",
|
|
50758
|
+
"wrapper-update-available"
|
|
50759
|
+
]
|
|
50760
|
+
},
|
|
50761
|
+
{
|
|
50762
|
+
id: "backups-exports",
|
|
50763
|
+
family: "system",
|
|
50764
|
+
label: "Backups & exports",
|
|
50765
|
+
kinds: ["backup-completed", "export-completed"]
|
|
50766
|
+
},
|
|
50767
|
+
{
|
|
50768
|
+
id: "alarm",
|
|
50769
|
+
family: "alarm",
|
|
50770
|
+
label: "Alarm",
|
|
50771
|
+
kinds: NC_ALARM_SYSTEM_EVENT_KINDS
|
|
50772
|
+
}
|
|
50773
|
+
];
|
|
50774
|
+
function systemEventKindsOfFamily(family) {
|
|
50775
|
+
return NC_SYSTEM_EVENT_KIND_GROUP_SPECS.filter((g) => g.family === family).flatMap((g) => g.kinds);
|
|
50776
|
+
}
|
|
50777
|
+
/**
|
|
50778
|
+
* Why the hub refuses this condition on a new or updated rule. Empty = accepted.
|
|
50779
|
+
* Families are reported in `NC_SYSTEM_EVENT_FAMILIES` order, and filters in
|
|
50780
|
+
* `NC_SYSTEM_EVENT_CONDITION_FILTER_KEYS` order, so a refusal reads the same
|
|
50781
|
+
* every time.
|
|
50782
|
+
*/
|
|
50783
|
+
function systemEventFamilyProblems(condition) {
|
|
50784
|
+
if (condition === void 0 || condition.kinds.length === 0) return [{ code: "no-kinds" }];
|
|
50785
|
+
const problems = [];
|
|
50786
|
+
const present = /* @__PURE__ */ new Set();
|
|
50787
|
+
for (const kind of condition.kinds) {
|
|
50788
|
+
const family = NC_SYSTEM_EVENT_FAMILY[kind];
|
|
50789
|
+
if (family === null) problems.push({
|
|
50790
|
+
code: "legacy-kind",
|
|
50791
|
+
kind
|
|
50792
|
+
});
|
|
50793
|
+
else present.add(family);
|
|
50794
|
+
}
|
|
50795
|
+
const families = NC_SYSTEM_EVENT_FAMILIES.filter((f) => present.has(f));
|
|
50796
|
+
if (families.length > 1) problems.push({
|
|
50797
|
+
code: "mixed-families",
|
|
50798
|
+
families
|
|
50799
|
+
});
|
|
50800
|
+
const [family] = families;
|
|
50801
|
+
if (families.length !== 1 || family === void 0) return problems;
|
|
50802
|
+
const allowed = NC_SYSTEM_EVENT_FAMILY_FILTERS[family];
|
|
50803
|
+
for (const filter of NC_SYSTEM_EVENT_CONDITION_FILTER_KEYS) if (condition[filter] !== void 0 && !allowed.includes(filter)) problems.push({
|
|
50804
|
+
code: "filter-outside-family",
|
|
50805
|
+
filter,
|
|
50806
|
+
family
|
|
50807
|
+
});
|
|
50808
|
+
return problems;
|
|
50809
|
+
}
|
|
50810
|
+
function describeSystemEventFamilyProblem(problem) {
|
|
50811
|
+
switch (problem.code) {
|
|
50812
|
+
case "no-kinds": return "a system-event rule needs at least one event kind";
|
|
50813
|
+
case "legacy-kind": return `'${problem.kind}' is a legacy kind and cannot be authored`;
|
|
50814
|
+
case "mixed-families": return `event kinds span ${problem.families.join(" + ")} — one rule per family`;
|
|
50815
|
+
case "filter-outside-family": return `filter '${problem.filter}' is not allowed on a ${problem.family} rule`;
|
|
50816
|
+
}
|
|
50817
|
+
}
|
|
50818
|
+
/** Every kind a `system-event` rule can derive — the three families and `mixed`. */
|
|
50819
|
+
var NC_SYSTEM_RULE_KINDS = [
|
|
50820
|
+
"device-events",
|
|
50821
|
+
"system",
|
|
50822
|
+
"alarm",
|
|
50823
|
+
"mixed"
|
|
50824
|
+
];
|
|
50825
|
+
/** Is this a kind a `system-event` rule derives (any family, or `mixed`)? */
|
|
50826
|
+
function isSystemRuleKind(kind) {
|
|
50827
|
+
return NC_SYSTEM_RULE_KINDS.some((k) => k === kind);
|
|
50828
|
+
}
|
|
50829
|
+
/** The family a kind authors, or undefined (a camera kind, or `mixed`). */
|
|
50830
|
+
function systemFamilyOfKind(kind) {
|
|
50831
|
+
return isSystemEventFamily(kind) ? kind : void 0;
|
|
50832
|
+
}
|
|
50833
|
+
/** The delivery a system rule rides — named once, compared everywhere. */
|
|
50834
|
+
var NC_SYSTEM_DELIVERY = "system-event";
|
|
50835
|
+
/**
|
|
50836
|
+
* Is this a SYSTEM rule — one about the installation rather than about anything
|
|
50837
|
+
* a camera saw? Takes a plain `string` so a rule carrying a delivery this build
|
|
50838
|
+
* has never heard of still gets an answer instead of a type error.
|
|
50839
|
+
*/
|
|
50840
|
+
function isSystemDelivery(delivery) {
|
|
50841
|
+
return delivery === NC_SYSTEM_DELIVERY;
|
|
50842
|
+
}
|
|
50513
50843
|
NC_AUDIO_DEFAULTS.hitPercent, NC_AUDIO_DEFAULTS.samplingSeconds;
|
|
50514
50844
|
var WEEKDAY_TO_DAY = {
|
|
50515
50845
|
Sun: 0,
|
|
@@ -51308,10 +51638,38 @@ var CAPTION_VARS = {
|
|
|
51308
51638
|
function onAxis(declared, asked) {
|
|
51309
51639
|
return declared === void 0 || asked === void 0 || declared.includes(asked);
|
|
51310
51640
|
}
|
|
51311
|
-
|
|
51312
|
-
|
|
51641
|
+
/**
|
|
51642
|
+
* Does a descriptor declared for `declared` kinds have a value for a rule of
|
|
51643
|
+
* `kind`?
|
|
51644
|
+
*
|
|
51645
|
+
* `system` on the WIRE stands for every system rule kind (D637): the served
|
|
51646
|
+
* catalog keeps the five pre-D637 tokens so installed viewers still parse it
|
|
51647
|
+
* (`NcTemplateVarKindSchema`), and the family split lives here, in the match.
|
|
51648
|
+
* Exported so the admin's local interpreter of the served catalog asks the
|
|
51649
|
+
* same question instead of restating it.
|
|
51650
|
+
*/
|
|
51651
|
+
function templateVarKindApplies(declared, kind) {
|
|
51652
|
+
if (declared === void 0 || kind === void 0) return true;
|
|
51653
|
+
if (declared.some((k) => k === kind)) return true;
|
|
51654
|
+
return isSystemRuleKind(kind) && declared.includes("system");
|
|
51655
|
+
}
|
|
51656
|
+
/**
|
|
51657
|
+
* Is a descriptor that names `systemEventKinds` on the event-kind axis of a
|
|
51658
|
+
* system rule? Read only for a system rule kind; any other kind ignores it.
|
|
51659
|
+
*
|
|
51660
|
+
* Event kinds chosen: the descriptor must speak about one of them. None chosen
|
|
51661
|
+
* yet: a FAMILY kind watches its own family's event kinds (a device-events rule
|
|
51662
|
+
* is never offered the alarm's `{{mode}}`), and `mixed` watches all of them.
|
|
51663
|
+
*/
|
|
51664
|
+
function templateVarSystemEventApplies(d, ctx) {
|
|
51665
|
+
if (!isSystemRuleKind(ctx.kind) || d.systemEventKinds === void 0) return true;
|
|
51666
|
+
const declared = d.systemEventKinds;
|
|
51313
51667
|
const asked = ctx.systemEventKinds ?? [];
|
|
51314
|
-
|
|
51668
|
+
if (asked.length > 0) return asked.some((k) => declared.includes(k));
|
|
51669
|
+
const family = ctx.kind === void 0 ? void 0 : systemFamilyOfKind(ctx.kind);
|
|
51670
|
+
if (family === void 0) return true;
|
|
51671
|
+
const own = systemEventKindsOfFamily(family);
|
|
51672
|
+
return declared.some((k) => own.includes(k));
|
|
51315
51673
|
}
|
|
51316
51674
|
/**
|
|
51317
51675
|
* The variables that have a value in `ctx`, in catalog order. Pure.
|
|
@@ -51325,27 +51683,13 @@ function templateVarsFor(ctx) {
|
|
|
51325
51683
|
const allowed = CAPTION_VARS[ctx.field];
|
|
51326
51684
|
return NC_TEMPLATE_VARS.filter((d) => d.families.includes(ctx.family) && allowed.includes(d.name) && d.dynamic === void 0);
|
|
51327
51685
|
}
|
|
51328
|
-
return NC_TEMPLATE_VARS.filter((d) => d.families.includes(ctx.family) && onAxis(d.fields, ctx.field) &&
|
|
51686
|
+
return NC_TEMPLATE_VARS.filter((d) => d.families.includes(ctx.family) && onAxis(d.fields, ctx.field) && templateVarKindApplies(d.kinds, ctx.kind) && onAxis(d.deliveries, ctx.delivery) && templateVarSystemEventApplies(d, ctx));
|
|
51329
51687
|
}
|
|
51330
51688
|
/** True when `name` is supplied in `ctx`, dynamic families (`count_<class>`) included. */
|
|
51331
51689
|
function isKnownTemplateVar(name, ctx) {
|
|
51332
51690
|
return templateVarsFor(ctx).some((d) => d.dynamic !== void 0 ? name.startsWith(d.dynamic.prefix) && name.length > d.dynamic.prefix.length : d.name === name);
|
|
51333
51691
|
}
|
|
51334
51692
|
/**
|
|
51335
|
-
* Does `filter` say anything about `kind`?
|
|
51336
|
-
*
|
|
51337
|
-
* `false` means the filter is not part of this kind's vocabulary: the engine
|
|
51338
|
-
* ignores it and an editor hides its input. It never means "excluded".
|
|
51339
|
-
*/
|
|
51340
|
-
function systemEventFilterApplies(kind, filter) {
|
|
51341
|
-
switch (filter) {
|
|
51342
|
-
case "deviceIds": return kind.startsWith("device-") || kind.startsWith("stream-") || kind === "detection-blind" || kind === "alarm-triggered" || kind === "export-completed";
|
|
51343
|
-
case "deviceTypes": return kind.startsWith("device-") || kind === "detection-blind";
|
|
51344
|
-
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";
|
|
51345
|
-
case "packageNames": return kind.endsWith("update-available") || kind === "addon-updated" || kind === "server-updated";
|
|
51346
|
-
}
|
|
51347
|
-
}
|
|
51348
|
-
/**
|
|
51349
51693
|
* TimelapseRule — the STANDALONE scheduled timelapse producer's rule model.
|
|
51350
51694
|
*
|
|
51351
51695
|
* Spec: `docs/superpowers/specs/2026-07-24-nc-occupancy-timelapse-design.md`
|
|
@@ -52583,6 +52927,12 @@ Object.defineProperty(exports, "NcConditionDescriptorSchema", {
|
|
|
52583
52927
|
return NcConditionDescriptorSchema;
|
|
52584
52928
|
}
|
|
52585
52929
|
});
|
|
52930
|
+
Object.defineProperty(exports, "NcConditionsSchema", {
|
|
52931
|
+
enumerable: true,
|
|
52932
|
+
get: function() {
|
|
52933
|
+
return NcConditionsSchema;
|
|
52934
|
+
}
|
|
52935
|
+
});
|
|
52586
52936
|
Object.defineProperty(exports, "NcRuleInputSchema", {
|
|
52587
52937
|
enumerable: true,
|
|
52588
52938
|
get: function() {
|
|
@@ -52823,6 +53173,12 @@ Object.defineProperty(exports, "buildEventKindDescriptor", {
|
|
|
52823
53173
|
return buildEventKindDescriptor;
|
|
52824
53174
|
}
|
|
52825
53175
|
});
|
|
53176
|
+
Object.defineProperty(exports, "canonicalHash", {
|
|
53177
|
+
enumerable: true,
|
|
53178
|
+
get: function() {
|
|
53179
|
+
return canonicalHash;
|
|
53180
|
+
}
|
|
53181
|
+
});
|
|
52826
53182
|
Object.defineProperty(exports, "cosineSimilarity", {
|
|
52827
53183
|
enumerable: true,
|
|
52828
53184
|
get: function() {
|
|
@@ -52853,6 +53209,12 @@ Object.defineProperty(exports, "deriveRecordingMode", {
|
|
|
52853
53209
|
return deriveRecordingMode;
|
|
52854
53210
|
}
|
|
52855
53211
|
});
|
|
53212
|
+
Object.defineProperty(exports, "describeSystemEventFamilyProblem", {
|
|
53213
|
+
enumerable: true,
|
|
53214
|
+
get: function() {
|
|
53215
|
+
return describeSystemEventFamilyProblem;
|
|
53216
|
+
}
|
|
53217
|
+
});
|
|
52856
53218
|
Object.defineProperty(exports, "discriminatedUnion", {
|
|
52857
53219
|
enumerable: true,
|
|
52858
53220
|
get: function() {
|
|
@@ -52955,6 +53317,12 @@ Object.defineProperty(exports, "isSourceCap", {
|
|
|
52955
53317
|
return isSourceCap;
|
|
52956
53318
|
}
|
|
52957
53319
|
});
|
|
53320
|
+
Object.defineProperty(exports, "isSystemDelivery", {
|
|
53321
|
+
enumerable: true,
|
|
53322
|
+
get: function() {
|
|
53323
|
+
return isSystemDelivery;
|
|
53324
|
+
}
|
|
53325
|
+
});
|
|
52958
53326
|
Object.defineProperty(exports, "kebabToCamel", {
|
|
52959
53327
|
enumerable: true,
|
|
52960
53328
|
get: function() {
|
|
@@ -53093,6 +53461,12 @@ Object.defineProperty(exports, "subKindsOf", {
|
|
|
53093
53461
|
return subKindsOf;
|
|
53094
53462
|
}
|
|
53095
53463
|
});
|
|
53464
|
+
Object.defineProperty(exports, "systemEventFamilyProblems", {
|
|
53465
|
+
enumerable: true,
|
|
53466
|
+
get: function() {
|
|
53467
|
+
return systemEventFamilyProblems;
|
|
53468
|
+
}
|
|
53469
|
+
});
|
|
53096
53470
|
Object.defineProperty(exports, "systemEventFilterApplies", {
|
|
53097
53471
|
enumerable: true,
|
|
53098
53472
|
get: function() {
|