@camstack/types 1.2.284 → 1.2.286
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/capabilities/device-provider.cap.d.ts +2 -0
- package/dist/capabilities/index.d.ts +1 -1
- package/dist/capabilities/notification-rules.cap.d.ts +230 -8
- package/dist/device/base-device-provider.d.ts +2 -0
- package/dist/generated/addon-api.d.ts +7 -0
- package/dist/generated/method-access-map.d.ts +1 -1
- package/dist/generated/method-device-selectors.d.ts +2 -2
- package/dist/generated/system-proxy.d.ts +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +312 -21
- package/dist/index.mjs +297 -22
- package/dist/notification/alarm-settings.d.ts +58 -0
- package/package.json +1 -1
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Alarm settings, as pure functions (D697). Inheritance of per-mode delays, application of a
|
|
3
|
+
* patch's per-field edits and single-membership edit, and the "did my patch land" check.
|
|
4
|
+
*
|
|
5
|
+
* The engine and both clients call these; nobody re-implements them. No I/O, no clock.
|
|
6
|
+
*/
|
|
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';
|
|
9
|
+
export type NcAlarmDelayField = 'exitDelaySec' | 'entryDelaySec' | 'triggeredDurationSec';
|
|
10
|
+
export declare const NC_ALARM_DELAY_FIELDS: readonly NcAlarmDelayField[];
|
|
11
|
+
export type NcAlarmDelaySource = 'mode' | 'default';
|
|
12
|
+
export interface NcAlarmResolvedDelays {
|
|
13
|
+
readonly exitDelaySec: number;
|
|
14
|
+
readonly entryDelaySec: number;
|
|
15
|
+
readonly triggeredDurationSec: number;
|
|
16
|
+
readonly source: Readonly<Record<NcAlarmDelayField, NcAlarmDelaySource>>;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* A settings answer as it travels on the wire. Clients do not parse answers, so a hub older
|
|
20
|
+
* than D697 sends no `modeDelays` (nor, before D636, `nonBlocking`); every reader here treats an absent key as "no overrides".
|
|
21
|
+
*/
|
|
22
|
+
export type NcAlarmSettingsAnswer = Omit<NcAlarmSettings, 'modeDelays' | 'nonBlocking'> & {
|
|
23
|
+
readonly modeDelays?: readonly NcAlarmModeDelays[];
|
|
24
|
+
/** Absent on a hub older than D636: read as "no lists". */
|
|
25
|
+
readonly nonBlocking?: readonly NcAlarmNonBlocking[];
|
|
26
|
+
};
|
|
27
|
+
export type NcAlarmDelaySettings = Pick<NcAlarmSettingsAnswer, NcAlarmDelayField | 'modeDelays'>;
|
|
28
|
+
/** What `mode` actually runs on: its own overrides, the global value for every other field. */
|
|
29
|
+
export declare function resolveModeDelays(settings: NcAlarmDelaySettings, mode: AlarmArmMode): NcAlarmResolvedDelays;
|
|
30
|
+
/**
|
|
31
|
+
* Apply per-field edits to the stored overrides. Returns new arrays, never mutates the input;
|
|
32
|
+
* an entry with no field left is dropped (the mode inherits everything again).
|
|
33
|
+
*/
|
|
34
|
+
export declare function applyModeDelaysEdits(current: readonly NcAlarmModeDelays[], edits: readonly NcAlarmModeDelaysEdit[]): NcAlarmModeDelays[];
|
|
35
|
+
export type NcAlarmNonBlockingEditResult = {
|
|
36
|
+
readonly kind: 'applied';
|
|
37
|
+
readonly lists: NcAlarmNonBlocking[];
|
|
38
|
+
readonly changed: boolean;
|
|
39
|
+
} | {
|
|
40
|
+
readonly kind: 'refused';
|
|
41
|
+
readonly reason: 'list-full';
|
|
42
|
+
readonly mode: AlarmArmMode;
|
|
43
|
+
readonly max: number;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
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.
|
|
48
|
+
*/
|
|
49
|
+
export declare function applyNonBlockingEdit(lists: readonly NcAlarmNonBlocking[], edit: NcAlarmNonBlockingEdit): NcAlarmNonBlockingEditResult;
|
|
50
|
+
/**
|
|
51
|
+
* True iff every key the patch sent is reflected in what the host returned. A host older than
|
|
52
|
+
* this build strips the keys it does not know; this is how a client tells "saved" from "parsed
|
|
53
|
+
* and dropped". `announceArm` is ignored (parsed, never read). A `null` clear "lands" on a host
|
|
54
|
+
* that stripped the key (it lacks the field) — harmless, because such a host stores no overrides.
|
|
55
|
+
* A whole-list `nonBlocking` naming a mode the panel does not offer reads as "not landed" (the host
|
|
56
|
+
* drops it); only older clients and the prune send whole lists, and they do not call this.
|
|
57
|
+
*/
|
|
58
|
+
export declare function alarmPatchLanded(patch: NcAlarmSettingsPatch, returned: NcAlarmSettingsAnswer): boolean;
|