@camstack/addon-agent-ui 1.2.161 → 1.2.162

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.
Files changed (2) hide show
  1. package/dist/addon.js +83 -14
  2. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -19855,6 +19855,29 @@ object({
19855
19855
  firstAt: number(),
19856
19856
  lastAt: number()
19857
19857
  });
19858
+ var NC_ALARM_TRIGGERED_MAX_SEC = 3600;
19859
+ var NcAlarmDelaySecSchema = number().int().min(0).max(600);
19860
+ var NcAlarmTriggeredSecSchema = number().int().min(0).max(NC_ALARM_TRIGGERED_MAX_SEC);
19861
+ var uniqueModes = (entries) => new Set(entries.map((e) => e.mode)).size === entries.length;
19862
+ var NcAlarmModeDelaysListSchema = array(object({
19863
+ mode: AlarmArmModeSchema,
19864
+ exitDelaySec: NcAlarmDelaySecSchema.optional(),
19865
+ entryDelaySec: NcAlarmDelaySecSchema.optional(),
19866
+ triggeredDurationSec: NcAlarmTriggeredSecSchema.optional()
19867
+ })).max(8).refine(uniqueModes, { message: "modeDelays: at most one entry per arm mode" });
19868
+ var NcAlarmModeDelaysEditListSchema = array(object({
19869
+ mode: AlarmArmModeSchema,
19870
+ exitDelaySec: NcAlarmDelaySecSchema.nullable().optional(),
19871
+ entryDelaySec: NcAlarmDelaySecSchema.nullable().optional(),
19872
+ triggeredDurationSec: NcAlarmTriggeredSecSchema.nullable().optional()
19873
+ })).max(8).refine(uniqueModes, { message: "modeDelays: at most one edit per arm mode" });
19874
+ /** One switch of the alarm table: put ONE device on, or take it off, ONE mode's list. */
19875
+ var NcAlarmNonBlockingEditSchema = object({
19876
+ mode: AlarmArmModeSchema,
19877
+ deviceId: number().int().positive(),
19878
+ /** true = on the list (may be open, does not block); false = off the list (blocks). */
19879
+ nonBlocking: boolean()
19880
+ });
19858
19881
  /**
19859
19882
  * The per-mode lists, at most one per mode. Two lists for one mode have no
19860
19883
  * meaning a reader could agree on (union? the last one?), so they are refused
@@ -19863,10 +19886,10 @@ object({
19863
19886
  var NcAlarmNonBlockingListSchema = array(object({
19864
19887
  mode: AlarmArmModeSchema,
19865
19888
  deviceIds: array(number().int()).max(200)
19866
- })).max(8).refine((lists) => new Set(lists.map((l) => l.mode)).size === lists.length, { message: "nonBlocking: at most one list per arm mode" });
19889
+ })).max(8).refine(uniqueModes, { message: "nonBlocking: at most one list per arm mode" });
19867
19890
  /**
19868
- * The three durations the panel's state machine runs on, who hears about its
19869
- * transitions, and which openings each mode tolerates.
19891
+ * The three durations — global, and per mode since D697 — the panel's state
19892
+ * machine runs on, who hears about its transitions, and which openings each mode tolerates.
19870
19893
  *
19871
19894
  * They live on the NOTIFICATION-RULES cap, not on `alarm-panel`, on purpose:
19872
19895
  * `alarm-panel` is `deviceNative` and its other provider mirrors somebody
@@ -19876,15 +19899,15 @@ var NcAlarmNonBlockingListSchema = array(object({
19876
19899
  */
19877
19900
  var NcAlarmSettingsSchema = object({
19878
19901
  /** Grace period between arming and the mode taking effect. 0 = immediate. */
19879
- exitDelaySec: number().int().min(0).max(600),
19902
+ exitDelaySec: NcAlarmDelaySecSchema,
19880
19903
  /** Grace period between a trigger and the alarm firing. 0 = immediate. */
19881
- entryDelaySec: number().int().min(0).max(600),
19904
+ entryDelaySec: NcAlarmDelaySecSchema,
19882
19905
  /**
19883
19906
  * How long `triggered` lasts before the panel re-arms itself.
19884
19907
  * **0 = until an operator disarms it** — the behaviour before this field
19885
19908
  * existed, and therefore what an untouched install keeps doing.
19886
19909
  */
19887
- triggeredDurationSec: number().int().min(0).max(3600),
19910
+ triggeredDurationSec: NcAlarmTriggeredSecSchema,
19888
19911
  /**
19889
19912
  * Deprecated by D630 — every transition is announced. Parsed, never read;
19890
19913
  * remove after one release. Optional so an older admin's patch (which still
@@ -19907,17 +19930,30 @@ var NcAlarmSettingsSchema = object({
19907
19930
  * per mode is meaningful. Defaulted to `[]` so a blob stored before D630
19908
19931
  * parses as "every opening blocks" — the behaviour it was written under.
19909
19932
  */
19910
- nonBlocking: NcAlarmNonBlockingListSchema.default([])
19933
+ nonBlocking: NcAlarmNonBlockingListSchema.default([]),
19934
+ /**
19935
+ * Per arm mode, the delays that mode OVERRIDES (D697). A mode with no entry, or an entry
19936
+ * without a field, uses the global value above — so `[]`, the default, is exactly the
19937
+ * behaviour of a blob stored before this field existed. Read through `resolveModeDelays`.
19938
+ */
19939
+ modeDelays: NcAlarmModeDelaysListSchema.default([])
19911
19940
  });
19912
19941
  /**
19913
19942
  * Every field optional — a tab edits one control at a time.
19914
19943
  *
19915
- * `nonBlocking` is re-declared WITHOUT its default: `.partial()` does not
19916
- * remove an inner `.default()`, so a patch that never named the field would
19917
- * parse to `nonBlocking: []` and wipe every mode's list on an unrelated edit
19918
- * (the same trap {@link NcRulePatchSchema} documents).
19944
+ * `nonBlocking` and `modeDelays` are re-declared WITHOUT their defaults:
19945
+ * `.partial()` does not remove an inner `.default()`, so a patch that never
19946
+ * named the field would parse to `[]` and wipe every mode's list on an
19947
+ * unrelated edit (the same trap {@link NcRulePatchSchema} documents). Here
19948
+ * `modeDelays` means EDITS, not the stored overrides.
19919
19949
  */
19920
- var NcAlarmSettingsPatchSchema = NcAlarmSettingsSchema.extend({ nonBlocking: NcAlarmNonBlockingListSchema }).partial();
19950
+ var NcAlarmSettingsPatchSchema = NcAlarmSettingsSchema.extend({
19951
+ nonBlocking: NcAlarmNonBlockingListSchema,
19952
+ /** Per-mode, per-field edits — NOT the whole list (see NcAlarmModeDelaysEditSchema). */
19953
+ modeDelays: NcAlarmModeDelaysEditListSchema,
19954
+ /** ONE membership change; the panel applies it to the list it holds at its turn. */
19955
+ nonBlockingEdit: NcAlarmNonBlockingEditSchema
19956
+ }).partial().refine((p) => p.nonBlocking === void 0 || p.nonBlockingEdit === void 0, { message: "nonBlocking and nonBlockingEdit are exclusive — send the whole lists or one edit" });
19921
19957
  /**
19922
19958
  * What one arm mode actually arms, DERIVED from the enabled rules gated on it.
19923
19959
  * Never authored, never stored — see `alarm-mode-coverage.ts` for why a stored
@@ -20017,6 +20053,28 @@ var NcAlarmConfigSchema = object({
20017
20053
  */
20018
20054
  live: NcAlarmLiveSchema.optional()
20019
20055
  });
20056
+ var NcAlarmSensorReadingSchema = _enum([
20057
+ "open",
20058
+ "closed",
20059
+ "unknown",
20060
+ "not-opening"
20061
+ ]);
20062
+ /** One device's state as the alarm reads it — the classifier the arm check uses. */
20063
+ var NcAlarmSensorStateSchema = object({
20064
+ deviceId: number().int().positive(),
20065
+ reading: NcAlarmSensorReadingSchema,
20066
+ /** The word as read (`open`, `closed`, `unlocked`, `stopped`, …); null when unknown / not an opening. */
20067
+ state: string().nullable(),
20068
+ /** Why `unknown`: the read failed, or the slice holds no word its cap defines (a placeholder included). */
20069
+ unknownWhy: _enum(["read-failed", "unknown-word"]).nullable(),
20070
+ /** The device manager's liveness as the centre mirrors it; null = not known. */
20071
+ online: boolean().nullable()
20072
+ });
20073
+ var NcAlarmSensorsInputSchema = object({ deviceIds: array(number().int().positive()).max(500) });
20074
+ var NcAlarmSensorsSchema = object({
20075
+ sensors: array(NcAlarmSensorStateSchema),
20076
+ readAt: number().int().nonnegative()
20077
+ });
20020
20078
  /**
20021
20079
  * ONE rule's demand on ONE camera's clip ring.
20022
20080
  *
@@ -20107,7 +20165,7 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
20107
20165
  }), method(object({}), NcAlarmConfigSchema, { auth: "admin" }), method(object({ patch: NcAlarmSettingsPatchSchema }), NcAlarmConfigSchema, {
20108
20166
  kind: "mutation",
20109
20167
  auth: "admin"
20110
- });
20168
+ }), method(NcAlarmSensorsInputSchema, NcAlarmSensorsSchema, { auth: "admin" });
20111
20169
  /**
20112
20170
  * Zod schemas for persisted record types.
20113
20171
  *
@@ -40562,6 +40620,12 @@ Object.freeze({
40562
40620
  addonId: null,
40563
40621
  access: "view"
40564
40622
  },
40623
+ "notificationRules.getAlarmSensors": {
40624
+ capName: "notification-rules",
40625
+ capScope: "system",
40626
+ addonId: null,
40627
+ access: "view"
40628
+ },
40565
40629
  "notificationRules.getClipRetentionAsks": {
40566
40630
  capName: "notification-rules",
40567
40631
  capScope: "system",
@@ -45045,6 +45109,11 @@ Object.freeze({
45045
45109
  form: "single",
45046
45110
  optional: false
45047
45111
  }],
45112
+ "notificationRules.getAlarmSensors": [{
45113
+ name: "deviceIds",
45114
+ form: "array",
45115
+ optional: false
45116
+ }],
45048
45117
  "notificationRules.setDeviceMuted": [{
45049
45118
  name: "deviceId",
45050
45119
  form: "single",
@@ -47184,7 +47253,7 @@ var AgentUIAddon = class extends BaseAddon {
47184
47253
  capability: adminUiCapability,
47185
47254
  provider: {
47186
47255
  getStaticDir: async () => ({ staticDir: path.resolve(__dirname) }),
47187
- getVersion: async () => ({ version: "1.2.161" })
47256
+ getVersion: async () => ({ version: "1.2.162" })
47188
47257
  }
47189
47258
  }];
47190
47259
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-agent-ui",
3
- "version": "1.2.161",
3
+ "version": "1.2.162",
4
4
  "description": "Agent UI — lightweight status dashboard served by every agent node",
5
5
  "keywords": [
6
6
  "camstack",