@camstack/addon-post-analysis 1.2.274 → 1.2.276

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.
@@ -5390,7 +5390,7 @@ var ZodIssueCode = {
5390
5390
  var ZodFirstPartyTypeKind;
5391
5391
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5392
5392
  //#endregion
5393
- //#region ../types/dist/sleep-PEo0-Fz9.mjs
5393
+ //#region ../types/dist/sleep-pM_J7YnY.mjs
5394
5394
  /**
5395
5395
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5396
5396
  * window to float samples (D455).
@@ -17432,6 +17432,7 @@ sub("presence", "sensor", "sensor", "#22c55e", "presence", "Presence");
17432
17432
  sub("enum-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "generic", "Sensor state");
17433
17433
  sub("device-event", "sensor", "sensor", "#10b981", "button", "Device event");
17434
17434
  sub("lock", "control", "control", "#0ea5e9", "lock", "Lock");
17435
+ sub("cover", "control", "control", "#0ea5e9", "door", "Cover");
17435
17436
  sub("switch", "control", "control", TAXONOMY_COLORS.control, "switch", "Switch");
17436
17437
  sub("siren", "control", "control", "#dc2626", "siren", "Siren");
17437
17438
  sub("button", "control", "control", "#10b981", "button", "Button");
@@ -17757,6 +17758,10 @@ var NcSystemEventKindSchema = _enum([
17757
17758
  "alarm-disarmed",
17758
17759
  "alarm-arming",
17759
17760
  "alarm-arm-refused",
17761
+ "alarm-pending",
17762
+ "alarm-rearmed",
17763
+ "alarm-sensor-bypass",
17764
+ "alarm-check-failed",
17760
17765
  "addon-updated",
17761
17766
  "server-updated",
17762
17767
  "export-completed",
@@ -17788,9 +17793,13 @@ NcSystemEventKindSchema.options.filter((kind) => !NC_LEGACY_SYSTEM_EVENT_KINDS.h
17788
17793
  */
17789
17794
  var NC_ALARM_SYSTEM_EVENT_KINDS = [
17790
17795
  "alarm-arm-refused",
17796
+ "alarm-check-failed",
17791
17797
  "alarm-arming",
17792
17798
  "alarm-armed",
17799
+ "alarm-pending",
17793
17800
  "alarm-triggered",
17801
+ "alarm-rearmed",
17802
+ "alarm-sensor-bypass",
17794
17803
  "alarm-disarmed"
17795
17804
  ];
17796
17805
  /**
@@ -18388,6 +18397,19 @@ var NcMediaFrameSchema = _enum([
18388
18397
  "full",
18389
18398
  "boxed"
18390
18399
  ]);
18400
+ /**
18401
+ * How a SENSOR notification shows the cameras that link the sensor.
18402
+ *
18403
+ * `mosaic` — one image composed of every linked camera's photograph, taken at
18404
+ * the trigger. `each` — one image per camera where the target takes several
18405
+ * attachments; a target that takes one keeps the first camera's (the degrade
18406
+ * engine drops the rest by order). Either way ONE notification per event.
18407
+ * Absent = `mosaic`, applied by the Notification Center and deliberately NOT
18408
+ * a Zod default (see NcRulePatchSchema: a default materialises on every
18409
+ * partial patch). Meaningless for a rule whose subject is not a sensor, and a
18410
+ * sensor linked to one camera ships that camera's plain snapshot either way.
18411
+ */
18412
+ var NcLinkedCameraModeSchema = _enum(["mosaic", "each"]);
18391
18413
  var NcMediaPolicySchema = object({
18392
18414
  attach: _enum([
18393
18415
  "best",
@@ -18433,7 +18455,9 @@ var NcMediaPolicySchema = object({
18433
18455
  * A profile that is not assigned falls back to the cheapest, and the render
18434
18456
  * reports which one actually ran.
18435
18457
  */
18436
- profile: CamProfileSchema.optional()
18458
+ profile: CamProfileSchema.optional(),
18459
+ /** See {@link NcLinkedCameraModeSchema}. */
18460
+ linkedCameras: NcLinkedCameraModeSchema.optional()
18437
18461
  });
18438
18462
  /**
18439
18463
  * Cooldown GRANULARITY over the subject's class — how much a fired
@@ -18553,7 +18577,7 @@ var NcRuleInputSchema = object({
18553
18577
  cooldownSec: 60,
18554
18578
  scope: "rule-device"
18555
18579
  }),
18556
- /** `{{var}}` templating over camera/class/label/zones/confidence/time. */
18580
+ /** `{{var}}` title/body. The variables are declared in `NC_TEMPLATE_VARS` (@camstack/types) and depend on the rule kind — see `templateVarsFor`. */
18557
18581
  template: object({
18558
18582
  title: string().max(500).optional(),
18559
18583
  body: string().max(2e3).optional()
@@ -18733,6 +18757,22 @@ var NcRulePatchSchema = NcRuleInputSchema.partial().extend({
18733
18757
  throttle: NcThrottleSchema.optional(),
18734
18758
  priority: number().int().min(1).max(5).optional()
18735
18759
  });
18760
+ var NcRuleClearableKeySchema = _enum([
18761
+ "template",
18762
+ "schedule",
18763
+ "targetUsers",
18764
+ "snoozeOptions",
18765
+ "snoozeAllowGlobal",
18766
+ "waitForEnhancement",
18767
+ "actions",
18768
+ "confirm",
18769
+ "groupIdleSec"
18770
+ ]);
18771
+ var NcRuleUpdateInputSchema = object({
18772
+ ruleId: string(),
18773
+ patch: NcRulePatchSchema,
18774
+ clear: array(NcRuleClearableKeySchema).optional()
18775
+ });
18736
18776
  /** A persisted rule. */
18737
18777
  var NcRuleSchema = NcRuleInputSchema.extend({
18738
18778
  id: string(),
@@ -18764,6 +18804,85 @@ var NcTestResultSchema = object({
18764
18804
  className: string().optional(),
18765
18805
  label: string().optional()
18766
18806
  });
18807
+ /** The five rule kinds, as data. `NcRuleKind` in `notification/rule-kinds.ts`
18808
+ * is the same union; the template-vars spec pins the two together. */
18809
+ var NcRuleKindSchema = _enum([
18810
+ "detection",
18811
+ "sensor",
18812
+ "occupancy",
18813
+ "sound",
18814
+ "system"
18815
+ ]);
18816
+ /** Which producer renders a template: an ordinary rule, a timelapse, a digest. */
18817
+ var NcTemplateFamilySchema = _enum([
18818
+ "rule",
18819
+ "timelapse",
18820
+ "summary"
18821
+ ]);
18822
+ /** Which text field of that producer. `previewText` is the timelapse frame
18823
+ * caption, `captionText` the digest mosaic caption — both see fewer vars. */
18824
+ var NcTemplateFieldSchema = _enum([
18825
+ "title",
18826
+ "body",
18827
+ "previewText",
18828
+ "captionText"
18829
+ ]);
18830
+ var NcTemplateVarGroupSchema = _enum([
18831
+ "subject",
18832
+ "place",
18833
+ "time",
18834
+ "rule",
18835
+ "occupancy",
18836
+ "sound",
18837
+ "sensor",
18838
+ "system",
18839
+ "digest",
18840
+ "ai"
18841
+ ]);
18842
+ /**
18843
+ * ONE `{{var}}` a notification template may name.
18844
+ *
18845
+ * `families` / `fields` / `kinds` / `deliveries` / `systemEventKinds` say WHERE
18846
+ * it has a value; absent = no restriction on that axis. `systemEventKinds` is
18847
+ * read only for a `system` rule. `dynamic` declares a FAMILY of names
18848
+ * (`count_<class>`): the descriptor's `name` is the example member.
18849
+ */
18850
+ var NcTemplateVarDescriptorSchema = object({
18851
+ name: string().regex(/^\w+$/),
18852
+ label: string(),
18853
+ description: string().optional(),
18854
+ example: string(),
18855
+ group: NcTemplateVarGroupSchema,
18856
+ families: array(NcTemplateFamilySchema).min(1),
18857
+ fields: array(NcTemplateFieldSchema).optional(),
18858
+ kinds: array(NcRuleKindSchema).optional(),
18859
+ deliveries: array(NcDeliverySchema).optional(),
18860
+ systemEventKinds: array(NcSystemEventKindSchema).optional(),
18861
+ dynamic: object({
18862
+ prefix: literal("count_"),
18863
+ from: literal("classes")
18864
+ }).optional()
18865
+ });
18866
+ /** Input to `previewTemplate` — the editor's own context, plus the draft text. */
18867
+ var NcTemplatePreviewInputSchema = object({
18868
+ context: object({
18869
+ family: NcTemplateFamilySchema,
18870
+ field: NcTemplateFieldSchema,
18871
+ kind: NcRuleKindSchema.optional(),
18872
+ delivery: NcDeliverySchema.optional(),
18873
+ systemEventKinds: array(NcSystemEventKindSchema).optional()
18874
+ }),
18875
+ template: object({
18876
+ title: string().max(500).optional(),
18877
+ body: string().max(2e3).optional()
18878
+ })
18879
+ });
18880
+ var NcTemplatePreviewSchema = object({
18881
+ title: string().nullable(),
18882
+ body: string().nullable(),
18883
+ /** Names the template uses that this context never fills — they render empty. */
18884
+ unknown: array(string())
18885
+ });
18767
18886
  var NcConditionDescriptorSchema = object({
18768
18887
  /** Field id inside `NcConditions` (or `'schedule'` for the rule-level group). */
18769
18888
  id: string(),
@@ -18927,6 +19046,14 @@ var NC_CONDITION_CATALOG = [
18927
19046
  value: "backup-completed",
18928
19047
  label: "Backup completed"
18929
19048
  },
19049
+ {
19050
+ value: "alarm-arm-refused",
19051
+ label: "Alarm arm refused"
19052
+ },
19053
+ {
19054
+ value: "alarm-check-failed",
19055
+ label: "Alarm check failed (armed anyway)"
19056
+ },
18930
19057
  {
18931
19058
  value: "alarm-arming",
18932
19059
  label: "Alarm arming (exit delay)"
@@ -18935,10 +19062,22 @@ var NC_CONDITION_CATALOG = [
18935
19062
  value: "alarm-armed",
18936
19063
  label: "Alarm armed"
18937
19064
  },
19065
+ {
19066
+ value: "alarm-pending",
19067
+ label: "Alarm entry delay started"
19068
+ },
18938
19069
  {
18939
19070
  value: "alarm-triggered",
18940
19071
  label: "Alarm triggered"
18941
19072
  },
19073
+ {
19074
+ value: "alarm-rearmed",
19075
+ label: "Alarm re-armed after siren"
19076
+ },
19077
+ {
19078
+ value: "alarm-sensor-bypass",
19079
+ label: "Alarm sensor bypass"
19080
+ },
18942
19081
  {
18943
19082
  value: "alarm-disarmed",
18944
19083
  label: "Alarm disarmed"
@@ -19489,8 +19628,17 @@ var NcSnoozeSuppressedSchema = object({
19489
19628
  lastAt: number()
19490
19629
  });
19491
19630
  /**
19492
- * The three durations the panel's state machine runs on, plus who hears about
19493
- * an arm.
19631
+ * The per-mode lists, at most one per mode. Two lists for one mode have no
19632
+ * meaning a reader could agree on (union? the last one?), so they are refused
19633
+ * at the boundary rather than interpreted.
19634
+ */
19635
+ var NcAlarmNonBlockingListSchema = array(object({
19636
+ mode: AlarmArmModeSchema,
19637
+ deviceIds: array(number().int()).max(200)
19638
+ })).max(8).refine((lists) => new Set(lists.map((l) => l.mode)).size === lists.length, { message: "nonBlocking: at most one list per arm mode" });
19639
+ /**
19640
+ * The three durations the panel's state machine runs on, who hears about its
19641
+ * transitions, and which openings each mode tolerates.
19494
19642
  *
19495
19643
  * They live on the NOTIFICATION-RULES cap, not on `alarm-panel`, on purpose:
19496
19644
  * `alarm-panel` is `deviceNative` and its other provider mirrors somebody
@@ -19509,21 +19657,39 @@ var NcAlarmSettingsSchema = object({
19509
19657
  * existed, and therefore what an untouched install keeps doing.
19510
19658
  */
19511
19659
  triggeredDurationSec: number().int().min(0).max(3600),
19512
- /** Send a notification when a mode takes effect. */
19513
- announceArm: boolean(),
19514
19660
  /**
19515
- * Where that notification goes. Target ids from `notification-output`.
19661
+ * Deprecated by D630 — every transition is announced. Parsed, never read;
19662
+ * remove after one release. Optional so an older admin's patch (which still
19663
+ * sends it) parses rather than failing the whole save.
19664
+ */
19665
+ announceArm: boolean().optional(),
19666
+ /**
19667
+ * Target ids from `notification-output`: every alarm transition goes here.
19516
19668
  *
19517
- * Explicit rather than "everyone": an arm announcement is a household
19669
+ * Explicit rather than "everyone": an alarm announcement is a household
19518
19670
  * message, and broadcasting it to every configured endpoint (including a
19519
19671
  * webhook wired to something else) is not a default anybody would choose.
19520
- * Empty with `announceArm: true` sends nothing, and the server logs that —
19521
- * silence must be attributable.
19672
+ * Empty sends nothing, and the server logs that — silence must be
19673
+ * attributable.
19674
+ */
19675
+ announceTargets: array(string().min(1)).max(16),
19676
+ /**
19677
+ * Per arm mode, the covered devices whose being OPEN does not refuse the
19678
+ * arm (a window left ajar for the cat under `home`, say). At most one entry
19679
+ * per mode is meaningful. Defaulted to `[]` so a blob stored before D630
19680
+ * parses as "every opening blocks" — the behaviour it was written under.
19522
19681
  */
19523
- announceTargets: array(string().min(1)).max(16)
19682
+ nonBlocking: NcAlarmNonBlockingListSchema.default([])
19524
19683
  });
19525
- /** Every field optional — a tab edits one control at a time. */
19526
- var NcAlarmSettingsPatchSchema = NcAlarmSettingsSchema.partial();
19684
+ /**
19685
+ * Every field optional — a tab edits one control at a time.
19686
+ *
19687
+ * `nonBlocking` is re-declared WITHOUT its default: `.partial()` does not
19688
+ * remove an inner `.default()`, so a patch that never named the field would
19689
+ * parse to `nonBlocking: []` and wipe every mode's list on an unrelated edit
19690
+ * (the same trap {@link NcRulePatchSchema} documents).
19691
+ */
19692
+ var NcAlarmSettingsPatchSchema = NcAlarmSettingsSchema.extend({ nonBlocking: NcAlarmNonBlockingListSchema }).partial();
19527
19693
  /**
19528
19694
  * What one arm mode actually arms, DERIVED from the enabled rules gated on it.
19529
19695
  * Never authored, never stored — see `alarm-mode-coverage.ts` for why a stored
@@ -19568,6 +19734,36 @@ var NcAlarmModeCoverageSchema = object({
19568
19734
  */
19569
19735
  skippedDevices: array(NcAlarmSkippedDeviceSchema).default([])
19570
19736
  });
19737
+ /** One covered device that reads open, and whether that refuses the arm. */
19738
+ var NcAlarmOpeningSchema = object({
19739
+ deviceId: number().int(),
19740
+ name: string(),
19741
+ /** The device's state word as read (`open`, `unlocked`, …). */
19742
+ state: string(),
19743
+ /** False when the mode's non-blocking list names this device. */
19744
+ blocking: boolean()
19745
+ });
19746
+ /** A device the panel is currently ignoring, and which side of it it is on. */
19747
+ var NcAlarmExclusionViewSchema = object({
19748
+ deviceId: number().int(),
19749
+ name: string(),
19750
+ phase: _enum(["open", "closed"])
19751
+ });
19752
+ /** One mode's openings: devices read open, plus those whose state is unknown. */
19753
+ var NcAlarmModeOpeningsSchema = object({
19754
+ mode: AlarmArmModeSchema,
19755
+ devices: array(NcAlarmOpeningSchema),
19756
+ /** Covered devices whose state could not be read (D49): neither open nor closed. */
19757
+ unknown: array(number().int())
19758
+ });
19759
+ var NcAlarmLiveSchema = object({
19760
+ state: AlarmStateSchema,
19761
+ /** The mode being armed into (exit delay) or held; null when disarmed. */
19762
+ targetMode: AlarmArmModeSchema.nullable(),
19763
+ availableModes: array(AlarmArmModeSchema),
19764
+ openings: array(NcAlarmModeOpeningsSchema),
19765
+ exclusions: array(NcAlarmExclusionViewSchema)
19766
+ });
19571
19767
  var NcAlarmConfigSchema = object({
19572
19768
  /**
19573
19769
  * The panel's device id, or null when this install has no panel (the ensure
@@ -19577,7 +19773,13 @@ var NcAlarmConfigSchema = object({
19577
19773
  */
19578
19774
  deviceId: number().int().nullable(),
19579
19775
  settings: NcAlarmSettingsSchema,
19580
- coverage: array(NcAlarmModeCoverageSchema)
19776
+ coverage: array(NcAlarmModeCoverageSchema),
19777
+ /**
19778
+ * The panel as it is NOW — state, what each mode would find open, what is
19779
+ * excluded. Optional: a panel-less hub answers without it, and a client
19780
+ * must not read its absence as "nothing is open".
19781
+ */
19782
+ live: NcAlarmLiveSchema.optional()
19581
19783
  });
19582
19784
  /**
19583
19785
  * ONE rule's demand on ONE camera's clip ring.
@@ -19633,10 +19835,7 @@ var notificationRulesCapability = {
19633
19835
  auth: "admin",
19634
19836
  caller: "required"
19635
19837
  }),
19636
- updateRule: method(object({
19637
- ruleId: string(),
19638
- patch: NcRulePatchSchema
19639
- }), object({ rule: NcRuleSchema }), {
19838
+ updateRule: method(NcRuleUpdateInputSchema, object({ rule: NcRuleSchema }), {
19640
19839
  kind: "mutation",
19641
19840
  auth: "admin",
19642
19841
  caller: "required"
@@ -19724,6 +19923,18 @@ var notificationRulesCapability = {
19724
19923
  catalog: array(NcConditionDescriptorSchema),
19725
19924
  taxonomy: NcTaxonomySchema.optional()
19726
19925
  })),
19926
+ /** The declared `{{var}}` vocabulary; editors filter it with `templateVarsFor`. */
19927
+ getTemplateCatalog: method(object({}), object({ vars: array(NcTemplateVarDescriptorSchema) })),
19928
+ /**
19929
+ * Render a template with example values, through the hub's text catalog.
19930
+ * Pure: sends nothing. A MUTATION only for transport — a 2.5k-char draft in
19931
+ * a batched GET URL risks length limits — so access stays `view`, the same
19932
+ * as `getTemplateCatalog`.
19933
+ */
19934
+ previewTemplate: method(NcTemplatePreviewInputSchema, NcTemplatePreviewSchema, {
19935
+ kind: "mutation",
19936
+ access: "view"
19937
+ }),
19727
19938
  /**
19728
19939
  * Queryable delivery history — a read-only view over the durable outbox
19729
19940
  * (fired rule, subject summary, target, status, timestamps, error on a
@@ -19778,7 +19989,10 @@ var notificationRulesCapability = {
19778
19989
  caller: "required"
19779
19990
  }),
19780
19991
  /**
19781
- * The alarm panel's durations, plus what each mode ACTUALLY arms.
19992
+ * The alarm panel's settings, what each mode ACTUALLY arms, and — when a
19993
+ * panel exists — its `live` state: current state and target mode, what
19994
+ * each mode would find open (blocking or not, and what is unknown), and
19995
+ * the devices currently excluded.
19782
19996
  *
19783
19997
  * Coverage is returned by the same call as the settings on purpose: they
19784
19998
  * are read together or not at all. An editor that showed the delays
@@ -19788,7 +20002,9 @@ var notificationRulesCapability = {
19788
20002
  */
19789
20003
  getAlarmConfig: method(object({}), NcAlarmConfigSchema, { auth: "admin" }),
19790
20004
  /**
19791
- * Patch the durations. Returns the WHOLE config, coverage included, so a
20005
+ * Patch the settings (durations, recipients, per-mode non-blocking lists;
20006
+ * `announceArm` is accepted and ignored — D630). Returns the WHOLE config,
20007
+ * coverage and `live` included, so a
19792
20008
  * client never has to guess what the server settled on — the panel clamps
19793
20009
  * and normalises, and a form that re-rendered from its own input would
19794
20010
  * show a value the alarm is not using.
@@ -24938,6 +25154,7 @@ var CAP_TO_KIND = {
24938
25154
  "enum-sensor": "enum-sensor",
24939
25155
  "event-emitter": "device-event",
24940
25156
  "lock-control": "lock",
25157
+ cover: "cover",
24941
25158
  switch: "switch",
24942
25159
  button: "button",
24943
25160
  doorbell: "doorbell"
@@ -29207,15 +29424,37 @@ var controlCapability = {
29207
29424
  */
29208
29425
  durability: "session"
29209
29426
  };
29427
+ /**
29428
+ * Window covering / blinds / garage door / valve cap. Models HA
29429
+ * `cover.*` entities — anything that moves between an open and a
29430
+ * closed state with optional intermediate positioning and tilt.
29431
+ *
29432
+ * State follows HA's canonical lifecycle: `open` / `opening` /
29433
+ * `closing` / `closed` / `stopped`. `position` (0 closed, 100 open)
29434
+ * and `tiltPosition` are nullable — some shutters only support
29435
+ * full open/close, some Venetian blinds add tilt but no slat
29436
+ * positioning, garage doors are usually positionless. Providers
29437
+ * populate only what the hardware reports.
29438
+ *
29439
+ * The cap intentionally does NOT split tilt into a sibling cap:
29440
+ * physical hardware that has tilt always has the main position
29441
+ * surface too, so the coupling stays inside one slice + one method
29442
+ * group rather than spreading across two registrations.
29443
+ *
29444
+ * Sub-surface gating paired with `DeviceFeature` flags:
29445
+ * - `CoverPositionable` — intermediate `position` slider
29446
+ * - `CoverTilt` — slat-tilt slider
29447
+ */
29448
+ var CoverStateSchema = _enum([
29449
+ "open",
29450
+ "opening",
29451
+ "closing",
29452
+ "closed",
29453
+ "stopped"
29454
+ ]);
29210
29455
  var CoverStatusSchema = object({
29211
29456
  /** Lifecycle state of the cover. */
29212
- state: _enum([
29213
- "open",
29214
- "opening",
29215
- "closing",
29216
- "closed",
29217
- "stopped"
29218
- ]),
29457
+ state: CoverStateSchema,
29219
29458
  /** 0 = fully closed, 100 = fully open. Null when the device has
29220
29459
  * no intermediate position surface. */
29221
29460
  position: number().min(0).max(100).nullable(),
@@ -31280,16 +31519,37 @@ method(_void(), ListResultSchema), method(_void(), PreferredSchema), method(obje
31280
31519
  kind: "mutation",
31281
31520
  auth: "admin"
31282
31521
  });
31522
+ /**
31523
+ * Smart-lock cap. Models HA `lock.*` entities — anything with a
31524
+ * locked / unlocked binary state plus the four transient lifecycle
31525
+ * states (`locking` / `unlocking`) and the `jammed` failure state
31526
+ * that low-end deadbolts surface when the motor can't reach the
31527
+ * target position.
31528
+ *
31529
+ * Some HA locks require a PIN code on every lock/unlock operation
31530
+ * (workplace keypad locks, hospitality). The optional `code` field
31531
+ * on the methods passes it through to the upstream service — the
31532
+ * code is NEVER persisted in the runtime slice or any event payload.
31533
+ * Locks that REQUIRE a code set `DeviceFeature.LockPinRequired` so
31534
+ * the UI gates a code-entry field without a slice fetch.
31535
+ *
31536
+ * Locks that support a latch-release ("open door") action advertise
31537
+ * `DeviceFeature.LockOpen`. The `open` method triggers the latch
31538
+ * without a full lock/unlock cycle. Only available when the lock
31539
+ * reports `LockEntityFeature.OPEN` (bit value 1) in HA
31540
+ * `supported_features`.
31541
+ */
31542
+ var LockStateSchema = _enum([
31543
+ "locked",
31544
+ "unlocked",
31545
+ "locking",
31546
+ "unlocking",
31547
+ "jammed"
31548
+ ]);
31283
31549
  var LockControlStatusSchema = object({
31284
31550
  /** Lifecycle state of the lock. `jammed` means the motor reported
31285
31551
  * failure to reach the target — operator intervention required. */
31286
- state: _enum([
31287
- "locked",
31288
- "unlocked",
31289
- "locking",
31290
- "unlocking",
31291
- "jammed"
31292
- ]),
31552
+ state: LockStateSchema,
31293
31553
  /** Ms epoch when the slice was last updated. */
31294
31554
  lastChangedAt: number()
31295
31555
  });
@@ -38221,9 +38481,8 @@ var DEVICE_STATE_READERS = [
38221
38481
  field: "state"
38222
38482
  },
38223
38483
  {
38224
- cap: "lock",
38225
- field: "locked",
38226
- booleanWords: ["locked", "unlocked"]
38484
+ cap: "lock-control",
38485
+ field: "state"
38227
38486
  },
38228
38487
  {
38229
38488
  cap: "contact",
@@ -44313,6 +44572,12 @@ Object.freeze({
44313
44572
  addonId: null,
44314
44573
  access: "view"
44315
44574
  },
44575
+ "notificationRules.getTemplateCatalog": {
44576
+ capName: "notification-rules",
44577
+ capScope: "system",
44578
+ addonId: null,
44579
+ access: "view"
44580
+ },
44316
44581
  "notificationRules.listDeviceMutes": {
44317
44582
  capName: "notification-rules",
44318
44583
  capScope: "system",
@@ -44331,6 +44596,12 @@ Object.freeze({
44331
44596
  addonId: null,
44332
44597
  access: "view"
44333
44598
  },
44599
+ "notificationRules.previewTemplate": {
44600
+ capName: "notification-rules",
44601
+ capScope: "system",
44602
+ addonId: null,
44603
+ access: "view"
44604
+ },
44334
44605
  "notificationRules.resolveArtifactUrl": {
44335
44606
  capName: "notification-rules",
44336
44607
  capScope: "system",
@@ -49978,6 +50249,766 @@ function isScheduleActive(schedule, atMs) {
49978
50249
  }
49979
50250
  return schedule.invert === true ? !inside : inside;
49980
50251
  }
50252
+ var RULE_BODY_ONLY = ["body"];
50253
+ var RULE_TEXT = ["title", "body"];
50254
+ var BATTERY = ["device-battery-low", "device-battery-normal"];
50255
+ var CONSUMABLE = ["device-consumable-low", "device-consumable-normal"];
50256
+ var UPDATES = [
50257
+ "addon-update-available",
50258
+ "server-update-available",
50259
+ "wrapper-update-available"
50260
+ ];
50261
+ var PACKAGE_UPDATES = ["addon-update-available", "server-update-available"];
50262
+ var ALARM = [
50263
+ "alarm-triggered",
50264
+ "alarm-armed",
50265
+ "alarm-disarmed",
50266
+ "alarm-arming",
50267
+ "alarm-arm-refused",
50268
+ "alarm-pending",
50269
+ "alarm-rearmed",
50270
+ "alarm-sensor-bypass",
50271
+ "alarm-check-failed"
50272
+ ];
50273
+ var COMBINED_ALARM = ["alarm-triggered"];
50274
+ var DEVICE_EVENTS = [
50275
+ "device-online",
50276
+ "device-offline",
50277
+ "device-disabled",
50278
+ "device-enabled",
50279
+ ...BATTERY,
50280
+ ...CONSUMABLE,
50281
+ "stream-online",
50282
+ "stream-offline",
50283
+ "detection-blind",
50284
+ ...ALARM
50285
+ ];
50286
+ var NC_TEMPLATE_VARS = [
50287
+ {
50288
+ name: "camera",
50289
+ label: "Camera",
50290
+ example: "Ingresso",
50291
+ group: "subject",
50292
+ families: ["rule", "timelapse"],
50293
+ systemEventKinds: [...DEVICE_EVENTS, "export-completed"]
50294
+ },
50295
+ {
50296
+ name: "class",
50297
+ label: "Detected class",
50298
+ description: "The counted class on an occupancy row (e.g. \"person\"); the detected class elsewhere.",
50299
+ example: "person",
50300
+ group: "subject",
50301
+ families: ["rule"],
50302
+ fields: [...RULE_TEXT],
50303
+ kinds: [
50304
+ "detection",
50305
+ "sensor",
50306
+ "sound",
50307
+ "occupancy",
50308
+ "system"
50309
+ ],
50310
+ systemEventKinds: [...COMBINED_ALARM]
50311
+ },
50312
+ {
50313
+ name: "label",
50314
+ label: "Name or plate",
50315
+ description: "Recognised person or read plate; empty otherwise.",
50316
+ example: "Mario",
50317
+ group: "subject",
50318
+ families: ["rule"],
50319
+ fields: [...RULE_TEXT],
50320
+ kinds: ["detection", "system"],
50321
+ systemEventKinds: [...COMBINED_ALARM]
50322
+ },
50323
+ {
50324
+ name: "subject",
50325
+ label: "Subject sentence",
50326
+ description: "Composed in the notification language, e.g. \"person (Mario)\".",
50327
+ example: "persona (Mario)",
50328
+ group: "subject",
50329
+ families: ["rule"],
50330
+ fields: [...RULE_TEXT],
50331
+ kinds: [
50332
+ "detection",
50333
+ "sensor",
50334
+ "sound",
50335
+ "occupancy"
50336
+ ]
50337
+ },
50338
+ {
50339
+ name: "confidence",
50340
+ label: "Confidence",
50341
+ example: "87%",
50342
+ group: "subject",
50343
+ families: ["rule"],
50344
+ fields: [...RULE_TEXT],
50345
+ kinds: ["detection", "system"],
50346
+ systemEventKinds: [...COMBINED_ALARM]
50347
+ },
50348
+ {
50349
+ name: "count",
50350
+ label: "Count",
50351
+ description: "Occupancy count, subjects in a grouped notification, or the event count of a system notice.",
50352
+ example: "3",
50353
+ group: "subject",
50354
+ families: ["rule"],
50355
+ fields: [...RULE_TEXT],
50356
+ kinds: [
50357
+ "detection",
50358
+ "occupancy",
50359
+ "system"
50360
+ ],
50361
+ systemEventKinds: [
50362
+ "addon-crash-loop",
50363
+ ...PACKAGE_UPDATES,
50364
+ "addon-updated"
50365
+ ]
50366
+ },
50367
+ {
50368
+ name: "detectionSummary",
50369
+ label: "Detection summary",
50370
+ description: "Class composition, e.g. \"2 persons and 1 car\".",
50371
+ example: "2 persone e 1 auto",
50372
+ group: "subject",
50373
+ families: [
50374
+ "rule",
50375
+ "timelapse",
50376
+ "summary"
50377
+ ],
50378
+ fields: [...RULE_TEXT],
50379
+ kinds: ["detection"]
50380
+ },
50381
+ {
50382
+ name: "zones",
50383
+ label: "Zones",
50384
+ example: "Cancello, Vialetto",
50385
+ group: "place",
50386
+ families: ["rule"],
50387
+ fields: [...RULE_TEXT],
50388
+ kinds: ["detection", "system"],
50389
+ systemEventKinds: [...COMBINED_ALARM]
50390
+ },
50391
+ {
50392
+ name: "zone",
50393
+ label: "Zone",
50394
+ example: "Cancello",
50395
+ group: "place",
50396
+ families: ["rule"],
50397
+ fields: [...RULE_TEXT],
50398
+ kinds: [
50399
+ "detection",
50400
+ "occupancy",
50401
+ "system"
50402
+ ],
50403
+ systemEventKinds: [...COMBINED_ALARM]
50404
+ },
50405
+ {
50406
+ name: "inZones",
50407
+ label: "\"in <zones>\" fragment",
50408
+ description: "Leading space included; empty when no zone.",
50409
+ example: " in Cancello",
50410
+ group: "place",
50411
+ families: ["rule"],
50412
+ fields: [...RULE_TEXT],
50413
+ kinds: ["detection", "system"],
50414
+ systemEventKinds: [...COMBINED_ALARM]
50415
+ },
50416
+ {
50417
+ name: "scope",
50418
+ label: "Occupancy scope",
50419
+ example: "Cancello",
50420
+ group: "place",
50421
+ families: ["rule"],
50422
+ fields: [...RULE_TEXT],
50423
+ kinds: ["occupancy"]
50424
+ },
50425
+ {
50426
+ name: "time",
50427
+ label: "Time",
50428
+ description: "Hours and minutes, in the notification language.",
50429
+ example: "20:05",
50430
+ group: "time",
50431
+ families: [
50432
+ "rule",
50433
+ "timelapse",
50434
+ "summary"
50435
+ ],
50436
+ fields: [...RULE_TEXT]
50437
+ },
50438
+ {
50439
+ name: "rule",
50440
+ label: "Rule name",
50441
+ example: "Ingresso notte",
50442
+ group: "rule",
50443
+ families: [
50444
+ "rule",
50445
+ "timelapse",
50446
+ "summary"
50447
+ ]
50448
+ },
50449
+ {
50450
+ name: "from",
50451
+ label: "Window start",
50452
+ example: "07:00",
50453
+ group: "time",
50454
+ families: ["timelapse", "summary"]
50455
+ },
50456
+ {
50457
+ name: "to",
50458
+ label: "Window end",
50459
+ example: "08:00",
50460
+ group: "time",
50461
+ families: ["timelapse", "summary"]
50462
+ },
50463
+ {
50464
+ name: "capacity",
50465
+ label: "Capacity",
50466
+ example: "2",
50467
+ group: "occupancy",
50468
+ families: ["rule"],
50469
+ fields: [...RULE_TEXT],
50470
+ kinds: ["occupancy"]
50471
+ },
50472
+ {
50473
+ name: "op",
50474
+ label: "Occupied / free",
50475
+ example: "occupata",
50476
+ group: "occupancy",
50477
+ families: ["rule"],
50478
+ fields: [...RULE_TEXT],
50479
+ kinds: ["occupancy"]
50480
+ },
50481
+ {
50482
+ name: "sounds",
50483
+ label: "Sounds heard",
50484
+ example: "abbaio, clacson",
50485
+ group: "sound",
50486
+ families: ["rule"],
50487
+ fields: [...RULE_TEXT],
50488
+ kinds: ["sound"]
50489
+ },
50490
+ {
50491
+ name: "hitPercent",
50492
+ label: "Share of the window",
50493
+ description: "Level mode only: percentage of samples above the threshold.",
50494
+ example: "42",
50495
+ group: "sound",
50496
+ families: ["rule"],
50497
+ fields: [...RULE_TEXT],
50498
+ kinds: ["sound"]
50499
+ },
50500
+ {
50501
+ name: "db",
50502
+ label: "Peak level (dBFS)",
50503
+ example: "-18",
50504
+ group: "sound",
50505
+ families: ["rule"],
50506
+ fields: [...RULE_TEXT],
50507
+ kinds: ["sound"]
50508
+ },
50509
+ {
50510
+ name: "eventType",
50511
+ label: "Event type",
50512
+ description: "Raw device event token, e.g. \"press\" or \"open\"; empty when the device sends none.",
50513
+ example: "press",
50514
+ group: "sensor",
50515
+ families: ["rule"],
50516
+ fields: [...RULE_TEXT],
50517
+ kinds: ["sensor"]
50518
+ },
50519
+ {
50520
+ name: "ai",
50521
+ label: "AI sentence",
50522
+ description: "Where the AI description goes; appended on its own line when absent.",
50523
+ example: "Una persona lascia un pacco.",
50524
+ group: "ai",
50525
+ families: ["rule", "summary"],
50526
+ fields: [...RULE_BODY_ONLY],
50527
+ kinds: ["detection", "occupancy"]
50528
+ },
50529
+ {
50530
+ name: "eventKind",
50531
+ label: "Event kind",
50532
+ example: "device-offline",
50533
+ group: "system",
50534
+ families: ["rule"],
50535
+ fields: [...RULE_TEXT],
50536
+ kinds: ["system"]
50537
+ },
50538
+ {
50539
+ name: "deviceName",
50540
+ label: "Device",
50541
+ example: "Ingresso",
50542
+ group: "system",
50543
+ families: ["rule"],
50544
+ fields: [...RULE_TEXT],
50545
+ kinds: ["system"],
50546
+ systemEventKinds: [...DEVICE_EVENTS]
50547
+ },
50548
+ {
50549
+ name: "deviceId",
50550
+ label: "Device id",
50551
+ example: "617",
50552
+ group: "system",
50553
+ families: ["rule"],
50554
+ fields: [...RULE_TEXT],
50555
+ kinds: ["system"],
50556
+ systemEventKinds: [...DEVICE_EVENTS, "export-completed"]
50557
+ },
50558
+ {
50559
+ name: "percentage",
50560
+ label: "Percentage",
50561
+ example: "15",
50562
+ group: "system",
50563
+ families: ["rule"],
50564
+ fields: [...RULE_TEXT],
50565
+ kinds: ["system"],
50566
+ systemEventKinds: [...BATTERY, ...CONSUMABLE]
50567
+ },
50568
+ {
50569
+ name: "item",
50570
+ label: "Consumable",
50571
+ example: "Filtro",
50572
+ group: "system",
50573
+ families: ["rule"],
50574
+ fields: [...RULE_TEXT],
50575
+ kinds: ["system"],
50576
+ systemEventKinds: [...CONSUMABLE]
50577
+ },
50578
+ {
50579
+ name: "profile",
50580
+ label: "Stream profile",
50581
+ example: "high",
50582
+ group: "system",
50583
+ families: ["rule"],
50584
+ fields: [...RULE_TEXT],
50585
+ kinds: ["system"],
50586
+ systemEventKinds: ["stream-online", "stream-offline"]
50587
+ },
50588
+ {
50589
+ name: "node",
50590
+ label: "Node",
50591
+ example: "hub",
50592
+ group: "system",
50593
+ families: ["rule"],
50594
+ fields: [...RULE_TEXT],
50595
+ kinds: ["system"],
50596
+ systemEventKinds: [
50597
+ "node-online",
50598
+ "node-offline",
50599
+ "node-inference-unavailable",
50600
+ "addon-crash-loop",
50601
+ ...UPDATES,
50602
+ "addon-updated",
50603
+ "server-updated"
50604
+ ]
50605
+ },
50606
+ {
50607
+ name: "nodeId",
50608
+ label: "Node id",
50609
+ example: "hub",
50610
+ group: "system",
50611
+ families: ["rule"],
50612
+ fields: [...RULE_TEXT],
50613
+ kinds: ["system"],
50614
+ systemEventKinds: [
50615
+ "node-online",
50616
+ "node-offline",
50617
+ "node-inference-unavailable",
50618
+ "addon-crash-loop",
50619
+ ...UPDATES,
50620
+ "server-updated"
50621
+ ]
50622
+ },
50623
+ {
50624
+ name: "devices",
50625
+ label: "Devices",
50626
+ description: "node-inference-unavailable: the affected cameras, comma-joined. Alarm arm / refusal: HOW MANY devices are armed (or open).",
50627
+ example: "Ingresso, Garage",
50628
+ group: "system",
50629
+ families: ["rule"],
50630
+ fields: [...RULE_TEXT],
50631
+ kinds: ["system"],
50632
+ systemEventKinds: [
50633
+ "node-inference-unavailable",
50634
+ "alarm-armed",
50635
+ "alarm-arm-refused"
50636
+ ]
50637
+ },
50638
+ {
50639
+ name: "addons",
50640
+ label: "Addons",
50641
+ example: "stream-broker",
50642
+ group: "system",
50643
+ families: ["rule"],
50644
+ fields: [...RULE_TEXT],
50645
+ kinds: ["system"],
50646
+ systemEventKinds: ["addon-crash-loop"]
50647
+ },
50648
+ {
50649
+ name: "minutes",
50650
+ label: "Minutes",
50651
+ example: "12",
50652
+ group: "system",
50653
+ families: ["rule"],
50654
+ fields: [...RULE_TEXT],
50655
+ kinds: ["system"],
50656
+ systemEventKinds: ["detection-blind"]
50657
+ },
50658
+ {
50659
+ name: "package",
50660
+ label: "Package",
50661
+ example: "@camstack/addon-recorder",
50662
+ group: "system",
50663
+ families: ["rule"],
50664
+ fields: [...RULE_TEXT],
50665
+ kinds: ["system"],
50666
+ systemEventKinds: [
50667
+ ...UPDATES,
50668
+ "addon-updated",
50669
+ "server-updated"
50670
+ ]
50671
+ },
50672
+ {
50673
+ name: "packageName",
50674
+ label: "Package",
50675
+ example: "@camstack/addon-recorder",
50676
+ group: "system",
50677
+ families: ["rule"],
50678
+ fields: [...RULE_TEXT],
50679
+ kinds: ["system"],
50680
+ systemEventKinds: [...PACKAGE_UPDATES, "server-updated"]
50681
+ },
50682
+ {
50683
+ name: "nodes",
50684
+ label: "Nodes",
50685
+ description: "Comma-joined node ids, when an update spans more than one — the single-node case names it through {{nodeId}} instead. `incomingFromUpdateAvailable` (event-intake.ts) fills `nodes` from ONE shared textParams object for both addon- and server-update-available, exactly like packageName/currentVersion/latestVersion/count — only the shipped TEXT (system.server-update-available.body.onNodes) reads it today, but the var is real on both kinds.",
50686
+ example: "hub, little-unraid",
50687
+ group: "system",
50688
+ families: ["rule"],
50689
+ fields: [...RULE_TEXT],
50690
+ kinds: ["system"],
50691
+ systemEventKinds: [...PACKAGE_UPDATES]
50692
+ },
50693
+ {
50694
+ name: "currentVersion",
50695
+ label: "Current version",
50696
+ example: "1.2.377",
50697
+ group: "system",
50698
+ families: ["rule"],
50699
+ fields: [...RULE_TEXT],
50700
+ kinds: ["system"],
50701
+ systemEventKinds: [...UPDATES]
50702
+ },
50703
+ {
50704
+ name: "latestVersion",
50705
+ label: "Latest version",
50706
+ example: "1.2.378",
50707
+ group: "system",
50708
+ families: ["rule"],
50709
+ fields: [...RULE_TEXT],
50710
+ kinds: ["system"],
50711
+ systemEventKinds: [...UPDATES]
50712
+ },
50713
+ {
50714
+ name: "list",
50715
+ label: "Updated packages",
50716
+ description: "One line per package. `incomingFromUpdateAvailable` fills it for addon-/server-update-available too (the SAME shared textParams object as `nodes`) — `system.addon-update-available.body` reads it; `incomingFromAddonUpdates` fills it again, independently, for the completed `addon-updated` event.",
50717
+ example: "recorder, notifiers",
50718
+ group: "system",
50719
+ families: ["rule"],
50720
+ fields: [...RULE_TEXT],
50721
+ kinds: ["system"],
50722
+ systemEventKinds: [...PACKAGE_UPDATES, "addon-updated"]
50723
+ },
50724
+ {
50725
+ name: "fromVersion",
50726
+ label: "From version",
50727
+ example: "1.2.377",
50728
+ group: "system",
50729
+ families: ["rule"],
50730
+ fields: [...RULE_TEXT],
50731
+ kinds: ["system"],
50732
+ systemEventKinds: ["server-updated"]
50733
+ },
50734
+ {
50735
+ name: "toVersion",
50736
+ label: "To version",
50737
+ example: "1.2.378",
50738
+ group: "system",
50739
+ families: ["rule"],
50740
+ fields: [...RULE_TEXT],
50741
+ kinds: ["system"],
50742
+ systemEventKinds: ["server-updated"]
50743
+ },
50744
+ {
50745
+ name: "destinationsOk",
50746
+ label: "Destinations ok",
50747
+ example: "2",
50748
+ group: "system",
50749
+ families: ["rule"],
50750
+ fields: [...RULE_TEXT],
50751
+ kinds: ["system"],
50752
+ systemEventKinds: ["backup-completed"]
50753
+ },
50754
+ {
50755
+ name: "destinationsTotal",
50756
+ label: "Destinations",
50757
+ example: "2",
50758
+ group: "system",
50759
+ families: ["rule"],
50760
+ fields: [...RULE_TEXT],
50761
+ kinds: ["system"],
50762
+ systemEventKinds: ["backup-completed"]
50763
+ },
50764
+ {
50765
+ name: "destinationsFailed",
50766
+ label: "Destinations failed",
50767
+ example: "0",
50768
+ group: "system",
50769
+ families: ["rule"],
50770
+ fields: [...RULE_TEXT],
50771
+ kinds: ["system"],
50772
+ systemEventKinds: ["backup-completed"]
50773
+ },
50774
+ {
50775
+ name: "sizeMB",
50776
+ label: "Size (MB)",
50777
+ example: "412",
50778
+ group: "system",
50779
+ families: ["rule"],
50780
+ fields: [...RULE_TEXT],
50781
+ kinds: ["system"],
50782
+ systemEventKinds: ["backup-completed"]
50783
+ },
50784
+ {
50785
+ name: "backupId",
50786
+ label: "Backup id",
50787
+ example: "bk-20260924",
50788
+ group: "system",
50789
+ families: ["rule"],
50790
+ fields: [...RULE_TEXT],
50791
+ kinds: ["system"],
50792
+ systemEventKinds: ["backup-completed"]
50793
+ },
50794
+ {
50795
+ name: "title",
50796
+ label: "Export title",
50797
+ example: "Ingresso 08:00",
50798
+ group: "system",
50799
+ families: ["rule"],
50800
+ fields: [...RULE_TEXT],
50801
+ kinds: ["system"],
50802
+ systemEventKinds: ["export-completed"]
50803
+ },
50804
+ {
50805
+ name: "exportId",
50806
+ label: "Export id",
50807
+ example: "exp-20260924",
50808
+ group: "system",
50809
+ families: ["rule"],
50810
+ fields: [...RULE_TEXT],
50811
+ kinds: ["system"],
50812
+ systemEventKinds: ["export-completed"]
50813
+ },
50814
+ {
50815
+ name: "bytes",
50816
+ label: "Export size (bytes)",
50817
+ example: "10485760",
50818
+ group: "system",
50819
+ families: ["rule"],
50820
+ fields: [...RULE_TEXT],
50821
+ kinds: ["system"],
50822
+ systemEventKinds: ["export-completed"]
50823
+ },
50824
+ {
50825
+ name: "mode",
50826
+ label: "Alarm mode",
50827
+ example: "away",
50828
+ group: "system",
50829
+ families: ["rule"],
50830
+ fields: [...RULE_TEXT],
50831
+ kinds: ["system"],
50832
+ systemEventKinds: [
50833
+ "alarm-armed",
50834
+ "alarm-arming",
50835
+ "alarm-arm-refused",
50836
+ "alarm-pending",
50837
+ "alarm-rearmed",
50838
+ "alarm-check-failed"
50839
+ ]
50840
+ },
50841
+ {
50842
+ name: "seconds",
50843
+ label: "Seconds",
50844
+ description: "Arming: the exit delay left. Pending: the entry delay left to disarm.",
50845
+ example: "30",
50846
+ group: "system",
50847
+ families: ["rule"],
50848
+ fields: [...RULE_TEXT],
50849
+ kinds: ["system"],
50850
+ systemEventKinds: ["alarm-arming", "alarm-pending"]
50851
+ },
50852
+ {
50853
+ name: "rules",
50854
+ label: "Covering rules",
50855
+ description: "How many enabled rules the armed mode gates.",
50856
+ example: "2",
50857
+ group: "system",
50858
+ families: ["rule"],
50859
+ fields: [...RULE_TEXT],
50860
+ kinds: ["system"],
50861
+ systemEventKinds: ["alarm-armed"]
50862
+ },
50863
+ {
50864
+ name: "names",
50865
+ label: "Device names",
50866
+ description: "Armed: the devices armed. Arming: the devices this mode cannot arm. Refusal: the open sensors.",
50867
+ example: "Ingresso, Garage",
50868
+ group: "system",
50869
+ families: ["rule"],
50870
+ fields: [...RULE_TEXT],
50871
+ kinds: ["system"],
50872
+ systemEventKinds: [
50873
+ "alarm-armed",
50874
+ "alarm-arming",
50875
+ "alarm-arm-refused"
50876
+ ]
50877
+ },
50878
+ {
50879
+ name: "skippedNames",
50880
+ label: "Skipped devices",
50881
+ description: "Devices the mode names but cannot arm (muted, detection off, offline).",
50882
+ example: "Garage",
50883
+ group: "system",
50884
+ families: ["rule"],
50885
+ fields: [...RULE_TEXT],
50886
+ kinds: ["system"],
50887
+ systemEventKinds: ["alarm-armed"]
50888
+ },
50889
+ {
50890
+ name: "bypassedNames",
50891
+ label: "Bypassed sensors",
50892
+ description: "Sensors the operator armed around because they were open.",
50893
+ example: "Finestra veranda",
50894
+ group: "system",
50895
+ families: ["rule"],
50896
+ fields: [...RULE_TEXT],
50897
+ kinds: ["system"],
50898
+ systemEventKinds: ["alarm-armed", "alarm-arming"]
50899
+ },
50900
+ {
50901
+ name: "coverage",
50902
+ label: "Coverage %",
50903
+ example: "96",
50904
+ group: "digest",
50905
+ families: ["timelapse"],
50906
+ fields: [...RULE_TEXT]
50907
+ },
50908
+ {
50909
+ name: "events",
50910
+ label: "Events",
50911
+ example: "4",
50912
+ group: "digest",
50913
+ families: ["timelapse", "summary"],
50914
+ fields: [...RULE_TEXT]
50915
+ },
50916
+ {
50917
+ name: "detections",
50918
+ label: "Detections",
50919
+ example: "7",
50920
+ group: "digest",
50921
+ families: ["timelapse", "summary"],
50922
+ fields: [...RULE_TEXT]
50923
+ },
50924
+ {
50925
+ name: "count_person",
50926
+ label: "Count of one class",
50927
+ description: "count_<class>, e.g. count_person, count_car.",
50928
+ example: "3",
50929
+ group: "digest",
50930
+ families: ["timelapse", "summary"],
50931
+ fields: [...RULE_TEXT],
50932
+ dynamic: {
50933
+ prefix: "count_",
50934
+ from: "classes"
50935
+ }
50936
+ },
50937
+ {
50938
+ name: "cameras",
50939
+ label: "Cameras",
50940
+ example: "3",
50941
+ group: "digest",
50942
+ families: ["summary"],
50943
+ fields: [...RULE_TEXT]
50944
+ },
50945
+ {
50946
+ name: "matched",
50947
+ label: "Matched events",
50948
+ example: "12",
50949
+ group: "digest",
50950
+ families: ["summary"],
50951
+ fields: [...RULE_TEXT]
50952
+ },
50953
+ {
50954
+ name: "shown",
50955
+ label: "Events shown",
50956
+ example: "9",
50957
+ group: "digest",
50958
+ families: ["summary"],
50959
+ fields: [...RULE_TEXT]
50960
+ },
50961
+ {
50962
+ name: "total",
50963
+ label: "Events total",
50964
+ example: "12",
50965
+ group: "digest",
50966
+ families: ["summary"],
50967
+ fields: [...RULE_TEXT]
50968
+ }
50969
+ ];
50970
+ /** The caption fields see a fixed, smaller vocabulary (`timelapsePreviewText`,
50971
+ * `summaryCaptionText`). Declared here rather than as `fields` on every
50972
+ * descriptor so the whole rule stays in one line of code. */
50973
+ var CAPTION_VARS = {
50974
+ previewText: [
50975
+ "camera",
50976
+ "rule",
50977
+ "from",
50978
+ "to"
50979
+ ],
50980
+ captionText: [
50981
+ "rule",
50982
+ "from",
50983
+ "to"
50984
+ ]
50985
+ };
50986
+ function onAxis(declared, asked) {
50987
+ return declared === void 0 || asked === void 0 || declared.includes(asked);
50988
+ }
50989
+ function onSystemAxis(d, ctx) {
50990
+ if (ctx.kind !== "system" || d.systemEventKinds === void 0) return true;
50991
+ const asked = ctx.systemEventKinds ?? [];
50992
+ return asked.length === 0 || asked.some((k) => d.systemEventKinds?.includes(k) === true);
50993
+ }
50994
+ /**
50995
+ * The variables that have a value in `ctx`, in catalog order. Pure.
50996
+ *
50997
+ * `ctx` is trusted, typed input — untrusted input (a served/RPC boundary) is
50998
+ * validated once against {@link NcTemplateVarContextSchema} at the cap/bridge
50999
+ * boundary, not re-parsed on every call here (Task 4).
51000
+ */
51001
+ function templateVarsFor(ctx) {
51002
+ if (ctx.field === "previewText" || ctx.field === "captionText") {
51003
+ const allowed = CAPTION_VARS[ctx.field];
51004
+ return NC_TEMPLATE_VARS.filter((d) => d.families.includes(ctx.family) && allowed.includes(d.name) && d.dynamic === void 0);
51005
+ }
51006
+ return NC_TEMPLATE_VARS.filter((d) => d.families.includes(ctx.family) && onAxis(d.fields, ctx.field) && onAxis(d.kinds, ctx.kind) && onAxis(d.deliveries, ctx.delivery) && onSystemAxis(d, ctx));
51007
+ }
51008
+ /** True when `name` is supplied in `ctx`, dynamic families (`count_<class>`) included. */
51009
+ function isKnownTemplateVar(name, ctx) {
51010
+ return templateVarsFor(ctx).some((d) => d.dynamic !== void 0 ? name.startsWith(d.dynamic.prefix) && name.length > d.dynamic.prefix.length : d.name === name);
51011
+ }
49981
51012
  /**
49982
51013
  * Does `filter` say anything about `kind`?
49983
51014
  *
@@ -51002,6 +52033,12 @@ Object.defineProperty(exports, "AUDIO_MACRO_LABELS", {
51002
52033
  return AUDIO_MACRO_LABELS;
51003
52034
  }
51004
52035
  });
52036
+ Object.defineProperty(exports, "AlarmArmModeSchema", {
52037
+ enumerable: true,
52038
+ get: function() {
52039
+ return AlarmArmModeSchema;
52040
+ }
52041
+ });
51005
52042
  Object.defineProperty(exports, "ArchivedDebugNoteSchema", {
51006
52043
  enumerable: true,
51007
52044
  get: function() {
@@ -51044,6 +52081,12 @@ Object.defineProperty(exports, "CamProfileSchema", {
51044
52081
  return CamProfileSchema;
51045
52082
  }
51046
52083
  });
52084
+ Object.defineProperty(exports, "CoverStateSchema", {
52085
+ enumerable: true,
52086
+ get: function() {
52087
+ return CoverStateSchema;
52088
+ }
52089
+ });
51047
52090
  Object.defineProperty(exports, "DEFAULT_EVENT_COLOR", {
51048
52091
  enumerable: true,
51049
52092
  get: function() {
@@ -51128,6 +52171,12 @@ Object.defineProperty(exports, "LabelAttributionSchema", {
51128
52171
  return LabelAttributionSchema;
51129
52172
  }
51130
52173
  });
52174
+ Object.defineProperty(exports, "LockStateSchema", {
52175
+ enumerable: true,
52176
+ get: function() {
52177
+ return LockStateSchema;
52178
+ }
52179
+ });
51131
52180
  Object.defineProperty(exports, "MAX_ARCHIVED_DEBUG_NOTES", {
51132
52181
  enumerable: true,
51133
52182
  get: function() {
@@ -51188,6 +52237,24 @@ Object.defineProperty(exports, "NC_TAXONOMY", {
51188
52237
  return NC_TAXONOMY;
51189
52238
  }
51190
52239
  });
52240
+ Object.defineProperty(exports, "NC_TEMPLATE_VARS", {
52241
+ enumerable: true,
52242
+ get: function() {
52243
+ return NC_TEMPLATE_VARS;
52244
+ }
52245
+ });
52246
+ Object.defineProperty(exports, "NcAlarmConfigSchema", {
52247
+ enumerable: true,
52248
+ get: function() {
52249
+ return NcAlarmConfigSchema;
52250
+ }
52251
+ });
52252
+ Object.defineProperty(exports, "NcAlarmSettingsPatchSchema", {
52253
+ enumerable: true,
52254
+ get: function() {
52255
+ return NcAlarmSettingsPatchSchema;
52256
+ }
52257
+ });
51191
52258
  Object.defineProperty(exports, "NcConditionDescriptorSchema", {
51192
52259
  enumerable: true,
51193
52260
  get: function() {
@@ -51218,6 +52285,12 @@ Object.defineProperty(exports, "NcRuleTargetSchema", {
51218
52285
  return NcRuleTargetSchema;
51219
52286
  }
51220
52287
  });
52288
+ Object.defineProperty(exports, "NcRuleUpdateInputSchema", {
52289
+ enumerable: true,
52290
+ get: function() {
52291
+ return NcRuleUpdateInputSchema;
52292
+ }
52293
+ });
51221
52294
  Object.defineProperty(exports, "NcScheduleSchema", {
51222
52295
  enumerable: true,
51223
52296
  get: function() {
@@ -51254,6 +52327,24 @@ Object.defineProperty(exports, "NcTaxonomySchema", {
51254
52327
  return NcTaxonomySchema;
51255
52328
  }
51256
52329
  });
52330
+ Object.defineProperty(exports, "NcTemplatePreviewInputSchema", {
52331
+ enumerable: true,
52332
+ get: function() {
52333
+ return NcTemplatePreviewInputSchema;
52334
+ }
52335
+ });
52336
+ Object.defineProperty(exports, "NcTemplatePreviewSchema", {
52337
+ enumerable: true,
52338
+ get: function() {
52339
+ return NcTemplatePreviewSchema;
52340
+ }
52341
+ });
52342
+ Object.defineProperty(exports, "NcTemplateVarDescriptorSchema", {
52343
+ enumerable: true,
52344
+ get: function() {
52345
+ return NcTemplateVarDescriptorSchema;
52346
+ }
52347
+ });
51257
52348
  Object.defineProperty(exports, "OpsLogEntrySchema", {
51258
52349
  enumerable: true,
51259
52350
  get: function() {
@@ -51518,6 +52609,12 @@ Object.defineProperty(exports, "isEventOwnerType", {
51518
52609
  return isEventOwnerType;
51519
52610
  }
51520
52611
  });
52612
+ Object.defineProperty(exports, "isKnownTemplateVar", {
52613
+ enumerable: true,
52614
+ get: function() {
52615
+ return isKnownTemplateVar;
52616
+ }
52617
+ });
51521
52618
  Object.defineProperty(exports, "isMediaOwnerType", {
51522
52619
  enumerable: true,
51523
52620
  get: function() {
@@ -51680,6 +52777,12 @@ Object.defineProperty(exports, "systemEventFilterApplies", {
51680
52777
  return systemEventFilterApplies;
51681
52778
  }
51682
52779
  });
52780
+ Object.defineProperty(exports, "templateVarsFor", {
52781
+ enumerable: true,
52782
+ get: function() {
52783
+ return templateVarsFor;
52784
+ }
52785
+ });
51683
52786
  Object.defineProperty(exports, "unknown", {
51684
52787
  enumerable: true,
51685
52788
  get: function() {