@camstack/addon-provider-reolink 1.2.167 → 1.2.168

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 CHANGED
@@ -15462,7 +15462,17 @@ var SiteZoneSchema = object({
15462
15462
  var ProviderStatusSchema = object({
15463
15463
  connected: boolean(),
15464
15464
  deviceCount: number(),
15465
- error: string().optional()
15465
+ error: string().optional(),
15466
+ /**
15467
+ * `'orchestrator'`: this provider writes NO camera's `motion` runtime slice
15468
+ * — the orchestrator is its only writer (D696). Set by `BaseDeviceProvider`,
15469
+ * which every provider bundles, so only a provider BUILT from D696-amended
15470
+ * code says it. ABSENT means an older provider that may still write it (raw
15471
+ * VMD writes, a boot seed), and the orchestrator's provider gate keeps that
15472
+ * provider's cameras unwritten (`camera-sensors/motion-slice-provider-gate.ts`)
15473
+ * — the provider twin of the runner's `getLocalLoad().motionSliceWriter`.
15474
+ */
15475
+ motionSliceWriter: literal("orchestrator").optional()
15466
15476
  });
15467
15477
  object({
15468
15478
  externalId: string(),
@@ -20964,6 +20974,29 @@ object({
20964
20974
  firstAt: number(),
20965
20975
  lastAt: number()
20966
20976
  });
20977
+ var NC_ALARM_TRIGGERED_MAX_SEC = 3600;
20978
+ var NcAlarmDelaySecSchema = number().int().min(0).max(600);
20979
+ var NcAlarmTriggeredSecSchema = number().int().min(0).max(NC_ALARM_TRIGGERED_MAX_SEC);
20980
+ var uniqueModes = (entries) => new Set(entries.map((e) => e.mode)).size === entries.length;
20981
+ var NcAlarmModeDelaysListSchema = array(object({
20982
+ mode: AlarmArmModeSchema,
20983
+ exitDelaySec: NcAlarmDelaySecSchema.optional(),
20984
+ entryDelaySec: NcAlarmDelaySecSchema.optional(),
20985
+ triggeredDurationSec: NcAlarmTriggeredSecSchema.optional()
20986
+ })).max(8).refine(uniqueModes, { message: "modeDelays: at most one entry per arm mode" });
20987
+ var NcAlarmModeDelaysEditListSchema = array(object({
20988
+ mode: AlarmArmModeSchema,
20989
+ exitDelaySec: NcAlarmDelaySecSchema.nullable().optional(),
20990
+ entryDelaySec: NcAlarmDelaySecSchema.nullable().optional(),
20991
+ triggeredDurationSec: NcAlarmTriggeredSecSchema.nullable().optional()
20992
+ })).max(8).refine(uniqueModes, { message: "modeDelays: at most one edit per arm mode" });
20993
+ /** One switch of the alarm table: put ONE device on, or take it off, ONE mode's list. */
20994
+ var NcAlarmNonBlockingEditSchema = object({
20995
+ mode: AlarmArmModeSchema,
20996
+ deviceId: number().int().positive(),
20997
+ /** true = on the list (may be open, does not block); false = off the list (blocks). */
20998
+ nonBlocking: boolean()
20999
+ });
20967
21000
  /**
20968
21001
  * The per-mode lists, at most one per mode. Two lists for one mode have no
20969
21002
  * meaning a reader could agree on (union? the last one?), so they are refused
@@ -20972,10 +21005,10 @@ object({
20972
21005
  var NcAlarmNonBlockingListSchema = array(object({
20973
21006
  mode: AlarmArmModeSchema,
20974
21007
  deviceIds: array(number().int()).max(200)
20975
- })).max(8).refine((lists) => new Set(lists.map((l) => l.mode)).size === lists.length, { message: "nonBlocking: at most one list per arm mode" });
21008
+ })).max(8).refine(uniqueModes, { message: "nonBlocking: at most one list per arm mode" });
20976
21009
  /**
20977
- * The three durations the panel's state machine runs on, who hears about its
20978
- * transitions, and which openings each mode tolerates.
21010
+ * The three durations — global, and per mode since D697 — the panel's state
21011
+ * machine runs on, who hears about its transitions, and which openings each mode tolerates.
20979
21012
  *
20980
21013
  * They live on the NOTIFICATION-RULES cap, not on `alarm-panel`, on purpose:
20981
21014
  * `alarm-panel` is `deviceNative` and its other provider mirrors somebody
@@ -20985,15 +21018,15 @@ var NcAlarmNonBlockingListSchema = array(object({
20985
21018
  */
20986
21019
  var NcAlarmSettingsSchema = object({
20987
21020
  /** Grace period between arming and the mode taking effect. 0 = immediate. */
20988
- exitDelaySec: number().int().min(0).max(600),
21021
+ exitDelaySec: NcAlarmDelaySecSchema,
20989
21022
  /** Grace period between a trigger and the alarm firing. 0 = immediate. */
20990
- entryDelaySec: number().int().min(0).max(600),
21023
+ entryDelaySec: NcAlarmDelaySecSchema,
20991
21024
  /**
20992
21025
  * How long `triggered` lasts before the panel re-arms itself.
20993
21026
  * **0 = until an operator disarms it** — the behaviour before this field
20994
21027
  * existed, and therefore what an untouched install keeps doing.
20995
21028
  */
20996
- triggeredDurationSec: number().int().min(0).max(3600),
21029
+ triggeredDurationSec: NcAlarmTriggeredSecSchema,
20997
21030
  /**
20998
21031
  * Deprecated by D630 — every transition is announced. Parsed, never read;
20999
21032
  * remove after one release. Optional so an older admin's patch (which still
@@ -21016,17 +21049,30 @@ var NcAlarmSettingsSchema = object({
21016
21049
  * per mode is meaningful. Defaulted to `[]` so a blob stored before D630
21017
21050
  * parses as "every opening blocks" — the behaviour it was written under.
21018
21051
  */
21019
- nonBlocking: NcAlarmNonBlockingListSchema.default([])
21052
+ nonBlocking: NcAlarmNonBlockingListSchema.default([]),
21053
+ /**
21054
+ * Per arm mode, the delays that mode OVERRIDES (D697). A mode with no entry, or an entry
21055
+ * without a field, uses the global value above — so `[]`, the default, is exactly the
21056
+ * behaviour of a blob stored before this field existed. Read through `resolveModeDelays`.
21057
+ */
21058
+ modeDelays: NcAlarmModeDelaysListSchema.default([])
21020
21059
  });
21021
21060
  /**
21022
21061
  * Every field optional — a tab edits one control at a time.
21023
21062
  *
21024
- * `nonBlocking` is re-declared WITHOUT its default: `.partial()` does not
21025
- * remove an inner `.default()`, so a patch that never named the field would
21026
- * parse to `nonBlocking: []` and wipe every mode's list on an unrelated edit
21027
- * (the same trap {@link NcRulePatchSchema} documents).
21063
+ * `nonBlocking` and `modeDelays` are re-declared WITHOUT their defaults:
21064
+ * `.partial()` does not remove an inner `.default()`, so a patch that never
21065
+ * named the field would parse to `[]` and wipe every mode's list on an
21066
+ * unrelated edit (the same trap {@link NcRulePatchSchema} documents). Here
21067
+ * `modeDelays` means EDITS, not the stored overrides.
21028
21068
  */
21029
- var NcAlarmSettingsPatchSchema = NcAlarmSettingsSchema.extend({ nonBlocking: NcAlarmNonBlockingListSchema }).partial();
21069
+ var NcAlarmSettingsPatchSchema = NcAlarmSettingsSchema.extend({
21070
+ nonBlocking: NcAlarmNonBlockingListSchema,
21071
+ /** Per-mode, per-field edits — NOT the whole list (see NcAlarmModeDelaysEditSchema). */
21072
+ modeDelays: NcAlarmModeDelaysEditListSchema,
21073
+ /** ONE membership change; the panel applies it to the list it holds at its turn. */
21074
+ nonBlockingEdit: NcAlarmNonBlockingEditSchema
21075
+ }).partial().refine((p) => p.nonBlocking === void 0 || p.nonBlockingEdit === void 0, { message: "nonBlocking and nonBlockingEdit are exclusive — send the whole lists or one edit" });
21030
21076
  /**
21031
21077
  * What one arm mode actually arms, DERIVED from the enabled rules gated on it.
21032
21078
  * Never authored, never stored — see `alarm-mode-coverage.ts` for why a stored
@@ -21126,6 +21172,28 @@ var NcAlarmConfigSchema = object({
21126
21172
  */
21127
21173
  live: NcAlarmLiveSchema.optional()
21128
21174
  });
21175
+ var NcAlarmSensorReadingSchema = _enum([
21176
+ "open",
21177
+ "closed",
21178
+ "unknown",
21179
+ "not-opening"
21180
+ ]);
21181
+ /** One device's state as the alarm reads it — the classifier the arm check uses. */
21182
+ var NcAlarmSensorStateSchema = object({
21183
+ deviceId: number().int().positive(),
21184
+ reading: NcAlarmSensorReadingSchema,
21185
+ /** The word as read (`open`, `closed`, `unlocked`, `stopped`, …); null when unknown / not an opening. */
21186
+ state: string().nullable(),
21187
+ /** Why `unknown`: the read failed, or the slice holds no word its cap defines (a placeholder included). */
21188
+ unknownWhy: _enum(["read-failed", "unknown-word"]).nullable(),
21189
+ /** The device manager's liveness as the centre mirrors it; null = not known. */
21190
+ online: boolean().nullable()
21191
+ });
21192
+ var NcAlarmSensorsInputSchema = object({ deviceIds: array(number().int().positive()).max(500) });
21193
+ var NcAlarmSensorsSchema = object({
21194
+ sensors: array(NcAlarmSensorStateSchema),
21195
+ readAt: number().int().nonnegative()
21196
+ });
21129
21197
  /**
21130
21198
  * ONE rule's demand on ONE camera's clip ring.
21131
21199
  *
@@ -21216,7 +21284,7 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
21216
21284
  }), method(object({}), NcAlarmConfigSchema, { auth: "admin" }), method(object({ patch: NcAlarmSettingsPatchSchema }), NcAlarmConfigSchema, {
21217
21285
  kind: "mutation",
21218
21286
  auth: "admin"
21219
- });
21287
+ }), method(NcAlarmSensorsInputSchema, NcAlarmSensorsSchema, { auth: "admin" });
21220
21288
  /**
21221
21289
  * Zod schemas for persisted record types.
21222
21290
  *
@@ -41502,13 +41570,14 @@ var BaseDeviceProvider = class extends BaseAddon {
41502
41570
  async getStatus() {
41503
41571
  const all = await this.ctx.kernel.devices?.getAll() ?? [];
41504
41572
  const summary = this.restoreFailureSummary();
41505
- if (summary === null) return {
41573
+ const base = {
41506
41574
  connected: true,
41507
- deviceCount: all.length
41575
+ deviceCount: all.length,
41576
+ motionSliceWriter: "orchestrator"
41508
41577
  };
41578
+ if (summary === null) return base;
41509
41579
  return {
41510
- connected: true,
41511
- deviceCount: all.length,
41580
+ ...base,
41512
41581
  error: summary
41513
41582
  };
41514
41583
  }
@@ -47107,6 +47176,12 @@ Object.freeze({
47107
47176
  addonId: null,
47108
47177
  access: "view"
47109
47178
  },
47179
+ "notificationRules.getAlarmSensors": {
47180
+ capName: "notification-rules",
47181
+ capScope: "system",
47182
+ addonId: null,
47183
+ access: "view"
47184
+ },
47110
47185
  "notificationRules.getClipRetentionAsks": {
47111
47186
  capName: "notification-rules",
47112
47187
  capScope: "system",
@@ -51590,6 +51665,11 @@ Object.freeze({
51590
51665
  form: "single",
51591
51666
  optional: false
51592
51667
  }],
51668
+ "notificationRules.getAlarmSensors": [{
51669
+ name: "deviceIds",
51670
+ form: "array",
51671
+ optional: false
51672
+ }],
51593
51673
  "notificationRules.setDeviceMuted": [{
51594
51674
  name: "deviceId",
51595
51675
  form: "single",
package/dist/addon.mjs CHANGED
@@ -15455,7 +15455,17 @@ var SiteZoneSchema = object({
15455
15455
  var ProviderStatusSchema = object({
15456
15456
  connected: boolean(),
15457
15457
  deviceCount: number(),
15458
- error: string().optional()
15458
+ error: string().optional(),
15459
+ /**
15460
+ * `'orchestrator'`: this provider writes NO camera's `motion` runtime slice
15461
+ * — the orchestrator is its only writer (D696). Set by `BaseDeviceProvider`,
15462
+ * which every provider bundles, so only a provider BUILT from D696-amended
15463
+ * code says it. ABSENT means an older provider that may still write it (raw
15464
+ * VMD writes, a boot seed), and the orchestrator's provider gate keeps that
15465
+ * provider's cameras unwritten (`camera-sensors/motion-slice-provider-gate.ts`)
15466
+ * — the provider twin of the runner's `getLocalLoad().motionSliceWriter`.
15467
+ */
15468
+ motionSliceWriter: literal("orchestrator").optional()
15459
15469
  });
15460
15470
  object({
15461
15471
  externalId: string(),
@@ -20957,6 +20967,29 @@ object({
20957
20967
  firstAt: number(),
20958
20968
  lastAt: number()
20959
20969
  });
20970
+ var NC_ALARM_TRIGGERED_MAX_SEC = 3600;
20971
+ var NcAlarmDelaySecSchema = number().int().min(0).max(600);
20972
+ var NcAlarmTriggeredSecSchema = number().int().min(0).max(NC_ALARM_TRIGGERED_MAX_SEC);
20973
+ var uniqueModes = (entries) => new Set(entries.map((e) => e.mode)).size === entries.length;
20974
+ var NcAlarmModeDelaysListSchema = array(object({
20975
+ mode: AlarmArmModeSchema,
20976
+ exitDelaySec: NcAlarmDelaySecSchema.optional(),
20977
+ entryDelaySec: NcAlarmDelaySecSchema.optional(),
20978
+ triggeredDurationSec: NcAlarmTriggeredSecSchema.optional()
20979
+ })).max(8).refine(uniqueModes, { message: "modeDelays: at most one entry per arm mode" });
20980
+ var NcAlarmModeDelaysEditListSchema = array(object({
20981
+ mode: AlarmArmModeSchema,
20982
+ exitDelaySec: NcAlarmDelaySecSchema.nullable().optional(),
20983
+ entryDelaySec: NcAlarmDelaySecSchema.nullable().optional(),
20984
+ triggeredDurationSec: NcAlarmTriggeredSecSchema.nullable().optional()
20985
+ })).max(8).refine(uniqueModes, { message: "modeDelays: at most one edit per arm mode" });
20986
+ /** One switch of the alarm table: put ONE device on, or take it off, ONE mode's list. */
20987
+ var NcAlarmNonBlockingEditSchema = object({
20988
+ mode: AlarmArmModeSchema,
20989
+ deviceId: number().int().positive(),
20990
+ /** true = on the list (may be open, does not block); false = off the list (blocks). */
20991
+ nonBlocking: boolean()
20992
+ });
20960
20993
  /**
20961
20994
  * The per-mode lists, at most one per mode. Two lists for one mode have no
20962
20995
  * meaning a reader could agree on (union? the last one?), so they are refused
@@ -20965,10 +20998,10 @@ object({
20965
20998
  var NcAlarmNonBlockingListSchema = array(object({
20966
20999
  mode: AlarmArmModeSchema,
20967
21000
  deviceIds: array(number().int()).max(200)
20968
- })).max(8).refine((lists) => new Set(lists.map((l) => l.mode)).size === lists.length, { message: "nonBlocking: at most one list per arm mode" });
21001
+ })).max(8).refine(uniqueModes, { message: "nonBlocking: at most one list per arm mode" });
20969
21002
  /**
20970
- * The three durations the panel's state machine runs on, who hears about its
20971
- * transitions, and which openings each mode tolerates.
21003
+ * The three durations — global, and per mode since D697 — the panel's state
21004
+ * machine runs on, who hears about its transitions, and which openings each mode tolerates.
20972
21005
  *
20973
21006
  * They live on the NOTIFICATION-RULES cap, not on `alarm-panel`, on purpose:
20974
21007
  * `alarm-panel` is `deviceNative` and its other provider mirrors somebody
@@ -20978,15 +21011,15 @@ var NcAlarmNonBlockingListSchema = array(object({
20978
21011
  */
20979
21012
  var NcAlarmSettingsSchema = object({
20980
21013
  /** Grace period between arming and the mode taking effect. 0 = immediate. */
20981
- exitDelaySec: number().int().min(0).max(600),
21014
+ exitDelaySec: NcAlarmDelaySecSchema,
20982
21015
  /** Grace period between a trigger and the alarm firing. 0 = immediate. */
20983
- entryDelaySec: number().int().min(0).max(600),
21016
+ entryDelaySec: NcAlarmDelaySecSchema,
20984
21017
  /**
20985
21018
  * How long `triggered` lasts before the panel re-arms itself.
20986
21019
  * **0 = until an operator disarms it** — the behaviour before this field
20987
21020
  * existed, and therefore what an untouched install keeps doing.
20988
21021
  */
20989
- triggeredDurationSec: number().int().min(0).max(3600),
21022
+ triggeredDurationSec: NcAlarmTriggeredSecSchema,
20990
21023
  /**
20991
21024
  * Deprecated by D630 — every transition is announced. Parsed, never read;
20992
21025
  * remove after one release. Optional so an older admin's patch (which still
@@ -21009,17 +21042,30 @@ var NcAlarmSettingsSchema = object({
21009
21042
  * per mode is meaningful. Defaulted to `[]` so a blob stored before D630
21010
21043
  * parses as "every opening blocks" — the behaviour it was written under.
21011
21044
  */
21012
- nonBlocking: NcAlarmNonBlockingListSchema.default([])
21045
+ nonBlocking: NcAlarmNonBlockingListSchema.default([]),
21046
+ /**
21047
+ * Per arm mode, the delays that mode OVERRIDES (D697). A mode with no entry, or an entry
21048
+ * without a field, uses the global value above — so `[]`, the default, is exactly the
21049
+ * behaviour of a blob stored before this field existed. Read through `resolveModeDelays`.
21050
+ */
21051
+ modeDelays: NcAlarmModeDelaysListSchema.default([])
21013
21052
  });
21014
21053
  /**
21015
21054
  * Every field optional — a tab edits one control at a time.
21016
21055
  *
21017
- * `nonBlocking` is re-declared WITHOUT its default: `.partial()` does not
21018
- * remove an inner `.default()`, so a patch that never named the field would
21019
- * parse to `nonBlocking: []` and wipe every mode's list on an unrelated edit
21020
- * (the same trap {@link NcRulePatchSchema} documents).
21056
+ * `nonBlocking` and `modeDelays` are re-declared WITHOUT their defaults:
21057
+ * `.partial()` does not remove an inner `.default()`, so a patch that never
21058
+ * named the field would parse to `[]` and wipe every mode's list on an
21059
+ * unrelated edit (the same trap {@link NcRulePatchSchema} documents). Here
21060
+ * `modeDelays` means EDITS, not the stored overrides.
21021
21061
  */
21022
- var NcAlarmSettingsPatchSchema = NcAlarmSettingsSchema.extend({ nonBlocking: NcAlarmNonBlockingListSchema }).partial();
21062
+ var NcAlarmSettingsPatchSchema = NcAlarmSettingsSchema.extend({
21063
+ nonBlocking: NcAlarmNonBlockingListSchema,
21064
+ /** Per-mode, per-field edits — NOT the whole list (see NcAlarmModeDelaysEditSchema). */
21065
+ modeDelays: NcAlarmModeDelaysEditListSchema,
21066
+ /** ONE membership change; the panel applies it to the list it holds at its turn. */
21067
+ nonBlockingEdit: NcAlarmNonBlockingEditSchema
21068
+ }).partial().refine((p) => p.nonBlocking === void 0 || p.nonBlockingEdit === void 0, { message: "nonBlocking and nonBlockingEdit are exclusive — send the whole lists or one edit" });
21023
21069
  /**
21024
21070
  * What one arm mode actually arms, DERIVED from the enabled rules gated on it.
21025
21071
  * Never authored, never stored — see `alarm-mode-coverage.ts` for why a stored
@@ -21119,6 +21165,28 @@ var NcAlarmConfigSchema = object({
21119
21165
  */
21120
21166
  live: NcAlarmLiveSchema.optional()
21121
21167
  });
21168
+ var NcAlarmSensorReadingSchema = _enum([
21169
+ "open",
21170
+ "closed",
21171
+ "unknown",
21172
+ "not-opening"
21173
+ ]);
21174
+ /** One device's state as the alarm reads it — the classifier the arm check uses. */
21175
+ var NcAlarmSensorStateSchema = object({
21176
+ deviceId: number().int().positive(),
21177
+ reading: NcAlarmSensorReadingSchema,
21178
+ /** The word as read (`open`, `closed`, `unlocked`, `stopped`, …); null when unknown / not an opening. */
21179
+ state: string().nullable(),
21180
+ /** Why `unknown`: the read failed, or the slice holds no word its cap defines (a placeholder included). */
21181
+ unknownWhy: _enum(["read-failed", "unknown-word"]).nullable(),
21182
+ /** The device manager's liveness as the centre mirrors it; null = not known. */
21183
+ online: boolean().nullable()
21184
+ });
21185
+ var NcAlarmSensorsInputSchema = object({ deviceIds: array(number().int().positive()).max(500) });
21186
+ var NcAlarmSensorsSchema = object({
21187
+ sensors: array(NcAlarmSensorStateSchema),
21188
+ readAt: number().int().nonnegative()
21189
+ });
21122
21190
  /**
21123
21191
  * ONE rule's demand on ONE camera's clip ring.
21124
21192
  *
@@ -21209,7 +21277,7 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
21209
21277
  }), method(object({}), NcAlarmConfigSchema, { auth: "admin" }), method(object({ patch: NcAlarmSettingsPatchSchema }), NcAlarmConfigSchema, {
21210
21278
  kind: "mutation",
21211
21279
  auth: "admin"
21212
- });
21280
+ }), method(NcAlarmSensorsInputSchema, NcAlarmSensorsSchema, { auth: "admin" });
21213
21281
  /**
21214
21282
  * Zod schemas for persisted record types.
21215
21283
  *
@@ -41495,13 +41563,14 @@ var BaseDeviceProvider = class extends BaseAddon {
41495
41563
  async getStatus() {
41496
41564
  const all = await this.ctx.kernel.devices?.getAll() ?? [];
41497
41565
  const summary = this.restoreFailureSummary();
41498
- if (summary === null) return {
41566
+ const base = {
41499
41567
  connected: true,
41500
- deviceCount: all.length
41568
+ deviceCount: all.length,
41569
+ motionSliceWriter: "orchestrator"
41501
41570
  };
41571
+ if (summary === null) return base;
41502
41572
  return {
41503
- connected: true,
41504
- deviceCount: all.length,
41573
+ ...base,
41505
41574
  error: summary
41506
41575
  };
41507
41576
  }
@@ -47100,6 +47169,12 @@ Object.freeze({
47100
47169
  addonId: null,
47101
47170
  access: "view"
47102
47171
  },
47172
+ "notificationRules.getAlarmSensors": {
47173
+ capName: "notification-rules",
47174
+ capScope: "system",
47175
+ addonId: null,
47176
+ access: "view"
47177
+ },
47103
47178
  "notificationRules.getClipRetentionAsks": {
47104
47179
  capName: "notification-rules",
47105
47180
  capScope: "system",
@@ -51583,6 +51658,11 @@ Object.freeze({
51583
51658
  form: "single",
51584
51659
  optional: false
51585
51660
  }],
51661
+ "notificationRules.getAlarmSensors": [{
51662
+ name: "deviceIds",
51663
+ form: "array",
51664
+ optional: false
51665
+ }],
51586
51666
  "notificationRules.setDeviceMuted": [{
51587
51667
  name: "deviceId",
51588
51668
  form: "single",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-reolink",
3
- "version": "1.2.167",
3
+ "version": "1.2.168",
4
4
  "description": "Reolink camera device provider addon for CamStack — native Baichuan protocol",
5
5
  "keywords": [
6
6
  "camstack",