@camstack/types 1.2.295 → 1.2.297

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.
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Controllable openings on the alarm: defaults for the two switches, and the
3
+ * actuation each cap gets when "secure on arm" fires.
4
+ *
5
+ * Controllable = cover / lock-control / switch. Contacts stay passive: they
6
+ * block by default and have no secure switch.
7
+ */
8
+ import { type NcAlarmControllableCap } from './alarm-membership.js';
9
+ export interface AlarmDeviceBlocksInput {
10
+ readonly controllable: boolean;
11
+ readonly deviceId: number;
12
+ /** Contact opt-out list (existing). */
13
+ readonly nonBlocking: readonly number[];
14
+ /** Controllable opt-IN list (default empty = do not block). */
15
+ readonly blocking: readonly number[];
16
+ }
17
+ /** Whether this device refuses the arm when open. */
18
+ export declare function alarmDeviceBlocksArming(input: AlarmDeviceBlocksInput): boolean;
19
+ export interface AlarmDeviceSecureOnArmInput {
20
+ readonly controllable: boolean;
21
+ readonly deviceId: number;
22
+ /** Controllable opt-OUT list (default empty = secure ON). */
23
+ readonly secureOnArmOff: readonly number[];
24
+ }
25
+ /** Whether this controllable should be closed/locked/turned off on arm. */
26
+ export declare function alarmDeviceSecureOnArm(input: AlarmDeviceSecureOnArmInput): boolean;
27
+ export interface NcAlarmSecureActuation {
28
+ readonly cap: NcAlarmControllableCap;
29
+ readonly method: string;
30
+ readonly args: Readonly<Record<string, unknown>>;
31
+ }
32
+ /** The one secure command for a controllable opening cap, or null for contacts. */
33
+ export declare function secureActuationFor(cap: string): NcAlarmSecureActuation | null;
@@ -19,8 +19,15 @@ import type { NcConditions, NcRuleActionSequence } from '../capabilities/notific
19
19
  * engine's opening table (`alarm-openings.ts`, which is checked against this
20
20
  * list with `satisfies`). Only these carry an opening edge the alarm refuses.
21
21
  */
22
- export declare const NC_ALARM_OPENING_EVENT_KINDS: readonly ["contact", "cover", "lock"];
22
+ export declare const NC_ALARM_OPENING_EVENT_KINDS: readonly ["contact", "cover", "lock", "switch"];
23
23
  export type NcAlarmOpeningEventKind = (typeof NC_ALARM_OPENING_EVENT_KINDS)[number];
24
+ /**
25
+ * Opening caps that can be ACTUATED to a secure state on arm (close / lock /
26
+ * off). Contacts are openings but not controllable — they only block.
27
+ */
28
+ export declare const NC_ALARM_CONTROLLABLE_CAPS: readonly ["cover", "lock-control", "switch"];
29
+ export type NcAlarmControllableCap = (typeof NC_ALARM_CONTROLLABLE_CAPS)[number];
30
+ export declare function isAlarmControllableCap(cap: string): cap is NcAlarmControllableCap;
24
31
  /** What the alarm-membership question reads off a rule. */
25
32
  export interface NcAlarmMembershipSubject {
26
33
  readonly conditions: Pick<NcConditions, 'deviceState' | 'sensorKinds' | 'sensorTransition'>;
@@ -5,7 +5,7 @@
5
5
  * The engine and both clients call these; nobody re-implements them. No I/O, no clock.
6
6
  */
7
7
  import type { AlarmArmMode } from '../capabilities/alarm-panel.cap.js';
8
- import { type NcAlarmModeDelays, type NcAlarmModeDelaysEdit, type NcAlarmNonBlocking, type NcAlarmNonBlockingEdit, type NcAlarmSettings, type NcAlarmSettingsPatch } from '../capabilities/notification-rules.cap.js';
8
+ import { type NcAlarmBlocking, type NcAlarmBlockingEdit, type NcAlarmModeDelays, type NcAlarmModeDelaysEdit, type NcAlarmModeDeviceList, type NcAlarmNonBlocking, type NcAlarmNonBlockingEdit, type NcAlarmSecureOnArmEdit, type NcAlarmSecureOnArmOff, type NcAlarmSettings, type NcAlarmSettingsPatch } from '../capabilities/notification-rules.cap.js';
9
9
  export type NcAlarmDelayField = 'exitDelaySec' | 'entryDelaySec' | 'triggeredDurationSec';
10
10
  export declare const NC_ALARM_DELAY_FIELDS: readonly NcAlarmDelayField[];
11
11
  export type NcAlarmDelaySource = 'mode' | 'default';
@@ -19,10 +19,13 @@ export interface NcAlarmResolvedDelays {
19
19
  * A settings answer as it travels on the wire. Clients do not parse answers, so a hub older
20
20
  * than D697 sends no `modeDelays` (nor, before D636, `nonBlocking`); every reader here treats an absent key as "no overrides".
21
21
  */
22
- export type NcAlarmSettingsAnswer = Omit<NcAlarmSettings, 'modeDelays' | 'nonBlocking'> & {
22
+ export type NcAlarmSettingsAnswer = Omit<NcAlarmSettings, 'modeDelays' | 'nonBlocking' | 'blocking' | 'secureOnArmOff'> & {
23
23
  readonly modeDelays?: readonly NcAlarmModeDelays[];
24
24
  /** Absent on a hub older than D636: read as "no lists". */
25
25
  readonly nonBlocking?: readonly NcAlarmNonBlocking[];
26
+ /** Absent on a hub older than secure-on-arm: read as "no lists". */
27
+ readonly blocking?: readonly NcAlarmBlocking[];
28
+ readonly secureOnArmOff?: readonly NcAlarmSecureOnArmOff[];
26
29
  };
27
30
  export type NcAlarmDelaySettings = Pick<NcAlarmSettingsAnswer, NcAlarmDelayField | 'modeDelays'>;
28
31
  /** What `mode` actually runs on: its own overrides, the global value for every other field. */
@@ -32,9 +35,9 @@ export declare function resolveModeDelays(settings: NcAlarmDelaySettings, mode:
32
35
  * an entry with no field left is dropped (the mode inherits everything again).
33
36
  */
34
37
  export declare function applyModeDelaysEdits(current: readonly NcAlarmModeDelays[], edits: readonly NcAlarmModeDelaysEdit[]): NcAlarmModeDelays[];
35
- export type NcAlarmNonBlockingEditResult = {
38
+ export type NcAlarmModeDeviceListEditResult = {
36
39
  readonly kind: 'applied';
37
- readonly lists: NcAlarmNonBlocking[];
40
+ readonly lists: NcAlarmModeDeviceList[];
38
41
  readonly changed: boolean;
39
42
  } | {
40
43
  readonly kind: 'refused';
@@ -42,11 +45,29 @@ export type NcAlarmNonBlockingEditResult = {
42
45
  readonly mode: AlarmArmMode;
43
46
  readonly max: number;
44
47
  };
48
+ /** Alias kept for callers that name the non-blocking edit result. */
49
+ export type NcAlarmNonBlockingEditResult = NcAlarmModeDeviceListEditResult;
45
50
  /**
46
- * Put ONE device on, or take it off, ONE mode's list. A no-op answers `changed: false`; an add
47
- * to a full list is REFUSED by reason (never silently dropped); an emptied list drops its entry.
51
+ * Put ONE device on, or take it off, ONE mode's device-id list. A no-op answers
52
+ * `changed: false`; an add to a full list is REFUSED by reason (never silently
53
+ * dropped); an emptied list drops its entry.
54
+ */
55
+ export declare function applyModeDeviceListEdit(lists: readonly NcAlarmModeDeviceList[], edit: {
56
+ readonly mode: AlarmArmMode;
57
+ readonly deviceId: number;
58
+ readonly present: boolean;
59
+ }): NcAlarmModeDeviceListEditResult;
60
+ /**
61
+ * Put ONE device on, or take it off, ONE mode's non-blocking list.
48
62
  */
49
63
  export declare function applyNonBlockingEdit(lists: readonly NcAlarmNonBlocking[], edit: NcAlarmNonBlockingEdit): NcAlarmNonBlockingEditResult;
64
+ /** Controllable opt-in to blocking. */
65
+ export declare function applyBlockingEdit(lists: readonly NcAlarmBlocking[], edit: NcAlarmBlockingEdit): NcAlarmModeDeviceListEditResult;
66
+ /**
67
+ * Controllable secure-on-arm: `secureOnArm: true` removes from the opt-out list;
68
+ * `false` adds to it.
69
+ */
70
+ export declare function applySecureOnArmEdit(lists: readonly NcAlarmSecureOnArmOff[], edit: NcAlarmSecureOnArmEdit): NcAlarmModeDeviceListEditResult;
50
71
  /**
51
72
  * True iff every key the patch sent is reflected in what the host returned. A host older than
52
73
  * this build strips the keys it does not know; this is how a client tells "saved" from "parsed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/types",
3
- "version": "1.2.295",
3
+ "version": "1.2.297",
4
4
  "description": "Shared types, interfaces, and model catalogs for the CamStack detection ecosystem",
5
5
  "keywords": [
6
6
  "camstack",