@camstack/types 1.2.297 → 1.2.299

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.
@@ -10,10 +10,13 @@
10
10
  * fires, and the operator was never told. One predicate, so the engine and the
11
11
  * warning cannot disagree about which rules are the alarm.
12
12
  *
13
- * Structural inputs (conditions + the enabled `onTrigger` sequences), so the
13
+ * Structural inputs (conditions + the ENABLED on-match bindings), so the
14
14
  * admin's form state and the engine's rule both answer without a cast.
15
+ * Sequence bindings need {@link NcAlarmMembershipSubject.sequenceActionsOf} —
16
+ * without it a sequence-ref cannot prove membership (fail closed for the
17
+ * opening-edge refusal: better a closing notification than a silent open).
15
18
  */
16
- import type { NcConditions, NcRuleActionSequence } from '../capabilities/notification-rules.cap.js';
19
+ import type { NcConditions, NcRuleAction, NcRuleActions } from '../capabilities/notification-rules.cap.js';
17
20
  /**
18
21
  * The sensor-event kinds that are OPENINGS to the alarm — the keys of the
19
22
  * engine's opening table (`alarm-openings.ts`, which is checked against this
@@ -31,14 +34,23 @@ export declare function isAlarmControllableCap(cap: string): cap is NcAlarmContr
31
34
  /** What the alarm-membership question reads off a rule. */
32
35
  export interface NcAlarmMembershipSubject {
33
36
  readonly conditions: Pick<NcConditions, 'deviceState' | 'sensorKinds' | 'sensorTransition'>;
34
- readonly onTrigger?: readonly NcRuleActionSequence[];
37
+ /** The rule's actions block. Absent = no actuation. */
38
+ readonly actions?: NcRuleActions;
39
+ /**
40
+ * Resolve a shared sequence's steps. Required when an `onTrigger` binding is
41
+ * a sequence ref — without it that binding cannot prove membership.
42
+ */
43
+ readonly sequenceActionsOf?: (sequenceId: string) => readonly NcRuleAction[] | undefined;
35
44
  }
36
45
  /**
37
46
  * A rule belongs to the alarm when its `deviceState` gate names ANY device's
38
- * `armed_*` word, or an ENABLED `onTrigger` sequence pulls the alarm panel's
39
- * trigger (D630).
47
+ * `armed_*` word, or an on-match binding pulls the alarm panel's trigger
48
+ * (D630). Button-only sequences do NOT count — they are not an automatic
49
+ * escalation.
40
50
  */
41
51
  export declare function ruleBelongsToAlarm(rule: NcAlarmMembershipSubject): boolean;
52
+ /** Copy the editors show when {@link sensorTransitionNeverFires} is true. */
53
+ export declare const NC_SENSOR_TRANSITION_NEVER_FIRES_WARNING = "This rule belongs to the alarm, and an alarm rule fires only when an opening OPENS. Set to \u201Conly when it clears\u201D, it can never fire.";
42
54
  /**
43
55
  * An alarm rule over openings only, asking for the CLEAR: the alarm edge
44
56
  * refuses every closing, and the chosen edge refuses every opening, so nothing
@@ -46,5 +58,3 @@ export declare function ruleBelongsToAlarm(rule: NcAlarmMembershipSubject): bool
46
58
  * can change with an action edit — but every editor must SAY it.
47
59
  */
48
60
  export declare function sensorTransitionNeverFires(rule: NcAlarmMembershipSubject): boolean;
49
- /** The warning an editor shows for {@link sensorTransitionNeverFires}. */
50
- export declare const NC_SENSOR_TRANSITION_NEVER_FIRES_WARNING = "This rule belongs to the alarm, and an alarm rule fires only when an opening OPENS. Set to \u201Conly when it clears\u201D, it can never fire.";
@@ -0,0 +1,70 @@
1
+ /**
2
+ * Alarm configuration profiles — named snapshots of {@link NcAlarmSettings}.
3
+ *
4
+ * One active profile globally (not per arm mode): summer vs winter is a whole
5
+ * membership set, and arm decisions always read the flat settings the active
6
+ * profile last applied. Pure functions only — no I/O, no clock.
7
+ *
8
+ * Create without a source → system defaults (empty memberships, stock delays).
9
+ * Create with `cloneFromId` → a copy of that profile's settings.
10
+ * The Default profile always exists after {@link ensureAlarmProfiles}; it cannot
11
+ * be deleted. Switching active applies that profile's blob for arm decisions.
12
+ */
13
+ import type { NcAlarmSettings } from '../capabilities/notification-rules.cap.js';
14
+ /** Stable id of the always-present Default profile (migrated from flat settings). */
15
+ export declare const NC_ALARM_DEFAULT_PROFILE_ID = "default";
16
+ export declare const NC_ALARM_DEFAULT_PROFILE_NAME = "Default";
17
+ /** Stock delays — same numbers the panel shipped with before any editor existed. */
18
+ export declare const NC_ALARM_SYSTEM_DEFAULT_DELAYS: {
19
+ readonly exitDelaySec: 30;
20
+ readonly entryDelaySec: 20;
21
+ readonly triggeredDurationSec: 0;
22
+ };
23
+ /** Empty memberships + stock delays + no announce targets. */
24
+ export declare function ncAlarmSystemDefaultSettings(): NcAlarmSettings;
25
+ export interface NcAlarmProfileRecord {
26
+ readonly id: string;
27
+ readonly name: string;
28
+ readonly settings: NcAlarmSettings;
29
+ }
30
+ export interface NcAlarmProfilesState {
31
+ readonly activeId: string;
32
+ readonly profiles: readonly NcAlarmProfileRecord[];
33
+ }
34
+ export type NcAlarmProfileCreateSource = {
35
+ readonly kind: 'defaults';
36
+ } | {
37
+ readonly kind: 'clone';
38
+ readonly fromId: string;
39
+ };
40
+ export type NcAlarmProfilesMutationResult = {
41
+ readonly kind: 'ok';
42
+ readonly state: NcAlarmProfilesState;
43
+ } | {
44
+ readonly kind: 'refused';
45
+ readonly reason: NcAlarmProfilesRefuseReason;
46
+ readonly detail?: string;
47
+ };
48
+ export type NcAlarmProfilesRefuseReason = 'not-found' | 'name-empty' | 'name-taken' | 'cannot-delete-default' | 'cannot-rename-default-id' | 'clone-source-missing';
49
+ export declare function isDefaultAlarmProfileId(id: string): boolean;
50
+ /** Deep-enough copy of a settings blob (arrays replaced, never mutated). */
51
+ export declare function cloneAlarmSettings(settings: NcAlarmSettings): NcAlarmSettings;
52
+ /**
53
+ * Seed Default from the panel's current flat settings when no profiles exist yet
54
+ * (first boot after this feature, or a wiped profiles key).
55
+ */
56
+ export declare function ensureAlarmProfiles(state: NcAlarmProfilesState | null | undefined, currentSettings: NcAlarmSettings): NcAlarmProfilesState;
57
+ export declare function createAlarmProfile(state: NcAlarmProfilesState, input: {
58
+ readonly name: string;
59
+ readonly id: string;
60
+ readonly source: NcAlarmProfileCreateSource;
61
+ }): NcAlarmProfilesMutationResult;
62
+ export declare function renameAlarmProfile(state: NcAlarmProfilesState, input: {
63
+ readonly id: string;
64
+ readonly name: string;
65
+ }): NcAlarmProfilesMutationResult;
66
+ export declare function deleteAlarmProfile(state: NcAlarmProfilesState, id: string): NcAlarmProfilesMutationResult;
67
+ export declare function activateAlarmProfile(state: NcAlarmProfilesState, id: string): NcAlarmProfilesMutationResult;
68
+ /** Persist the live flat settings into the active profile's blob. */
69
+ export declare function syncActiveAlarmProfileSettings(state: NcAlarmProfilesState, settings: NcAlarmSettings): NcAlarmProfilesState;
70
+ export declare function alarmProfileById(state: NcAlarmProfilesState, id: string): NcAlarmProfileRecord | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/types",
3
- "version": "1.2.297",
3
+ "version": "1.2.299",
4
4
  "description": "Shared types, interfaces, and model catalogs for the CamStack detection ecosystem",
5
5
  "keywords": [
6
6
  "camstack",