@camstack/types 1.2.296 → 1.2.298
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 +2 -1
- package/dist/addon.mjs +2 -1
- package/dist/capabilities/calendar-source.cap.d.ts +75 -0
- package/dist/capabilities/calendars.cap.d.ts +68 -0
- package/dist/capabilities/index.d.ts +8 -2
- package/dist/capabilities/notification-rules.cap.d.ts +619 -0
- package/dist/generated/addon-api.d.ts +80 -0
- package/dist/generated/capability-router-map.d.ts +10 -4
- package/dist/generated/collection-array-methods.d.ts +1 -1
- package/dist/generated/method-access-map.d.ts +1 -1
- package/dist/generated/system-proxy.d.ts +3 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +451 -0
- package/dist/index.mjs +426 -1
- package/dist/notification/alarm-profiles.d.ts +70 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -21424,6 +21424,39 @@ var NcAlarmSettingsSchema = zod.z.object({
|
|
|
21424
21424
|
modeDelays: NcAlarmModeDelaysListSchema.default([])
|
|
21425
21425
|
});
|
|
21426
21426
|
/**
|
|
21427
|
+
* One named alarm configuration profile — a full {@link NcAlarmSettings} blob
|
|
21428
|
+
* (memberships including secure-on-arm, delays, announce targets). The id is
|
|
21429
|
+
* assigned by the server; clients show the name.
|
|
21430
|
+
*/
|
|
21431
|
+
var NcAlarmProfileMetaSchema = zod.z.object({
|
|
21432
|
+
id: zod.z.string().min(1).max(64),
|
|
21433
|
+
name: zod.z.string().min(1).max(64),
|
|
21434
|
+
/** The seeded Default profile — cannot be deleted. */
|
|
21435
|
+
isDefault: zod.z.boolean()
|
|
21436
|
+
});
|
|
21437
|
+
/**
|
|
21438
|
+
* Profiles ride on {@link NcAlarmConfig}: one globally active profile, whose
|
|
21439
|
+
* settings are what arm decisions and `settings` already expose. Switching
|
|
21440
|
+
* active applies that profile's blob onto the panel.
|
|
21441
|
+
*/
|
|
21442
|
+
var NcAlarmProfilesViewSchema = zod.z.object({
|
|
21443
|
+
activeId: zod.z.string().min(1),
|
|
21444
|
+
items: zod.z.array(NcAlarmProfileMetaSchema).min(1)
|
|
21445
|
+
});
|
|
21446
|
+
var NcAlarmCreateProfileInputSchema = zod.z.object({
|
|
21447
|
+
name: zod.z.string().min(1).max(64),
|
|
21448
|
+
/**
|
|
21449
|
+
* Omit / undefined → system defaults (empty memberships, stock delays).
|
|
21450
|
+
* Set → clone that profile's settings.
|
|
21451
|
+
*/
|
|
21452
|
+
cloneFromId: zod.z.string().min(1).max(64).optional()
|
|
21453
|
+
});
|
|
21454
|
+
var NcAlarmRenameProfileInputSchema = zod.z.object({
|
|
21455
|
+
id: zod.z.string().min(1).max(64),
|
|
21456
|
+
name: zod.z.string().min(1).max(64)
|
|
21457
|
+
});
|
|
21458
|
+
var NcAlarmProfileIdInputSchema = zod.z.object({ id: zod.z.string().min(1).max(64) });
|
|
21459
|
+
/**
|
|
21427
21460
|
* Every field optional — a tab edits one control at a time.
|
|
21428
21461
|
*
|
|
21429
21462
|
* List fields and `modeDelays` are re-declared WITHOUT their defaults:
|
|
@@ -21534,6 +21567,11 @@ var NcAlarmConfigSchema = zod.z.object({
|
|
|
21534
21567
|
*/
|
|
21535
21568
|
deviceId: zod.z.number().int().nullable(),
|
|
21536
21569
|
settings: NcAlarmSettingsSchema,
|
|
21570
|
+
/**
|
|
21571
|
+
* Named configuration profiles. Optional so an older hub answer still parses;
|
|
21572
|
+
* a client without this field shows no picker (single implicit Default).
|
|
21573
|
+
*/
|
|
21574
|
+
profiles: NcAlarmProfilesViewSchema.optional(),
|
|
21537
21575
|
coverage: zod.z.array(NcAlarmModeCoverageSchema),
|
|
21538
21576
|
/**
|
|
21539
21577
|
* The panel as it is NOW — state, what each mode would find open, what is
|
|
@@ -21844,6 +21882,36 @@ var notificationRulesCapability = {
|
|
|
21844
21882
|
auth: "admin"
|
|
21845
21883
|
}),
|
|
21846
21884
|
/**
|
|
21885
|
+
* Create a named profile. Without `cloneFromId` the new profile starts at
|
|
21886
|
+
* system defaults (empty memberships); with it, a copy of that profile.
|
|
21887
|
+
* Does not activate — the operator switches explicitly.
|
|
21888
|
+
*/
|
|
21889
|
+
createAlarmProfile: require_sleep.method(NcAlarmCreateProfileInputSchema, NcAlarmConfigSchema, {
|
|
21890
|
+
kind: "mutation",
|
|
21891
|
+
auth: "admin"
|
|
21892
|
+
}),
|
|
21893
|
+
/** Rename a profile (Default included — only the name, never the id). */
|
|
21894
|
+
renameAlarmProfile: require_sleep.method(NcAlarmRenameProfileInputSchema, NcAlarmConfigSchema, {
|
|
21895
|
+
kind: "mutation",
|
|
21896
|
+
auth: "admin"
|
|
21897
|
+
}),
|
|
21898
|
+
/**
|
|
21899
|
+
* Delete a non-default profile. If it was active, Default becomes active
|
|
21900
|
+
* and its settings are applied for arm decisions.
|
|
21901
|
+
*/
|
|
21902
|
+
deleteAlarmProfile: require_sleep.method(NcAlarmProfileIdInputSchema, NcAlarmConfigSchema, {
|
|
21903
|
+
kind: "mutation",
|
|
21904
|
+
auth: "admin"
|
|
21905
|
+
}),
|
|
21906
|
+
/**
|
|
21907
|
+
* Make this profile active: its membership/delays blob is applied to the
|
|
21908
|
+
* panel so the next arm uses it.
|
|
21909
|
+
*/
|
|
21910
|
+
activateAlarmProfile: require_sleep.method(NcAlarmProfileIdInputSchema, NcAlarmConfigSchema, {
|
|
21911
|
+
kind: "mutation",
|
|
21912
|
+
auth: "admin"
|
|
21913
|
+
}),
|
|
21914
|
+
/**
|
|
21847
21915
|
* The CURRENT state of each asked device as the alarm reads it (D697) — open, closed,
|
|
21848
21916
|
* unknown (why) or not an opening, plus liveness. Classified by the same table the arm
|
|
21849
21917
|
* check uses (`alarm-openings.ts`), so the editor and the arm can never disagree. The
|
|
@@ -33657,6 +33725,87 @@ var buttonCapability = {
|
|
|
33657
33725
|
}) }
|
|
33658
33726
|
};
|
|
33659
33727
|
//#endregion
|
|
33728
|
+
//#region src/capabilities/calendar-source.cap.ts
|
|
33729
|
+
/**
|
|
33730
|
+
* `calendar-source` — collection cap exposing per-provider calendars and
|
|
33731
|
+
* their events. Every addon that contributes calendars (Home Assistant,
|
|
33732
|
+
* a future Google Calendar addon, …) registers a provider here. The hub
|
|
33733
|
+
* singleton `calendars` walks the collection and merges the answers.
|
|
33734
|
+
*
|
|
33735
|
+
* Mirrors `addon-pages-source`: the public listing is a different shape
|
|
33736
|
+
* (source-stamped ids) and lives on the aggregator.
|
|
33737
|
+
*/
|
|
33738
|
+
var CalendarSourceKindSchema = zod.z.enum(["ha", "addon"]);
|
|
33739
|
+
var CalendarInfoSchema = zod.z.object({
|
|
33740
|
+
/** Provider-local id (e.g. HA `calendar.family`). The aggregator prefixes. */
|
|
33741
|
+
id: zod.z.string().min(1),
|
|
33742
|
+
name: zod.z.string().min(1),
|
|
33743
|
+
source: CalendarSourceKindSchema,
|
|
33744
|
+
enabled: zod.z.boolean()
|
|
33745
|
+
});
|
|
33746
|
+
var CalendarEventSchema = zod.z.object({
|
|
33747
|
+
id: zod.z.string().min(1),
|
|
33748
|
+
calendarId: zod.z.string().min(1),
|
|
33749
|
+
title: zod.z.string(),
|
|
33750
|
+
startMs: zod.z.number().int(),
|
|
33751
|
+
endMs: zod.z.number().int(),
|
|
33752
|
+
allDay: zod.z.boolean().optional(),
|
|
33753
|
+
description: zod.z.string().optional(),
|
|
33754
|
+
location: zod.z.string().optional()
|
|
33755
|
+
});
|
|
33756
|
+
var CalendarListEventsInputSchema = zod.z.object({
|
|
33757
|
+
calendarIds: zod.z.array(zod.z.string().min(1)).max(64).optional(),
|
|
33758
|
+
startMs: zod.z.number().int(),
|
|
33759
|
+
endMs: zod.z.number().int()
|
|
33760
|
+
});
|
|
33761
|
+
var calendarSourceCapability = {
|
|
33762
|
+
name: "calendar-source",
|
|
33763
|
+
scope: "system",
|
|
33764
|
+
mode: "collection",
|
|
33765
|
+
internal: true,
|
|
33766
|
+
methods: {
|
|
33767
|
+
listCalendars: require_sleep.method(zod.z.void(), zod.z.array(CalendarInfoSchema).readonly(), { auth: "admin" }),
|
|
33768
|
+
listEvents: require_sleep.method(CalendarListEventsInputSchema, zod.z.array(CalendarEventSchema).readonly(), { auth: "admin" })
|
|
33769
|
+
}
|
|
33770
|
+
};
|
|
33771
|
+
//#endregion
|
|
33772
|
+
//#region src/capabilities/calendars.cap.ts
|
|
33773
|
+
/**
|
|
33774
|
+
* `calendars` — system-scoped singleton. Public surface admin-ui and the
|
|
33775
|
+
* notification-center calendar-events producer consume.
|
|
33776
|
+
*
|
|
33777
|
+
* Walks every `calendar-source` provider, stamps each calendar with a
|
|
33778
|
+
* cluster-stable id (`<sourceAddonId>:<localId>`) and the providing
|
|
33779
|
+
* addon's id, and fans `listEvents` out the same way. Home Assistant
|
|
33780
|
+
* import is a built-in refresh of the HA source rather than a second
|
|
33781
|
+
* registry — `importFromHomeAssistant` asks that source to re-discover.
|
|
33782
|
+
*/
|
|
33783
|
+
var CalendarEntrySchema = CalendarInfoSchema.extend({
|
|
33784
|
+
/** Cluster-stable id: `<providerAddonId>:<localId>`. */
|
|
33785
|
+
id: zod.z.string().min(1),
|
|
33786
|
+
/** The addon that registered the calendar-source provider. */
|
|
33787
|
+
providerAddonId: zod.z.string().min(1).optional()
|
|
33788
|
+
});
|
|
33789
|
+
var CalendarImportResultSchema = zod.z.object({
|
|
33790
|
+
imported: zod.z.number().int().nonnegative(),
|
|
33791
|
+
/** Absent when no HA calendar-source provider was reachable. */
|
|
33792
|
+
providerAddonId: zod.z.string().min(1).optional(),
|
|
33793
|
+
error: zod.z.string().optional()
|
|
33794
|
+
});
|
|
33795
|
+
var calendarsCapability = {
|
|
33796
|
+
name: "calendars",
|
|
33797
|
+
scope: "system",
|
|
33798
|
+
mode: "singleton",
|
|
33799
|
+
methods: {
|
|
33800
|
+
listCalendars: require_sleep.method(zod.z.void(), zod.z.array(CalendarEntrySchema).readonly(), { auth: "admin" }),
|
|
33801
|
+
listEvents: require_sleep.method(CalendarListEventsInputSchema, zod.z.array(CalendarEventSchema).readonly(), { auth: "admin" }),
|
|
33802
|
+
importFromHomeAssistant: require_sleep.method(zod.z.void(), CalendarImportResultSchema, {
|
|
33803
|
+
auth: "admin",
|
|
33804
|
+
kind: "mutation"
|
|
33805
|
+
})
|
|
33806
|
+
}
|
|
33807
|
+
};
|
|
33808
|
+
//#endregion
|
|
33660
33809
|
//#region src/capabilities/camera-credentials.cap.ts
|
|
33661
33810
|
/**
|
|
33662
33811
|
* camera-credentials — device-scoped cap exposing the camera's network
|
|
@@ -52087,6 +52236,8 @@ var CAPABILITY_NAMES = {
|
|
|
52087
52236
|
brightness: "brightness",
|
|
52088
52237
|
broker: "broker",
|
|
52089
52238
|
button: "button",
|
|
52239
|
+
calendarSource: "calendar-source",
|
|
52240
|
+
calendars: "calendars",
|
|
52090
52241
|
cameraCredentials: "camera-credentials",
|
|
52091
52242
|
cameraGridLayout: "camera-grid-layout",
|
|
52092
52243
|
cameraPipelineConfig: "camera-pipeline-config",
|
|
@@ -52328,6 +52479,14 @@ var CAPABILITY_ROUTER_KEYS = [
|
|
|
52328
52479
|
key: "button",
|
|
52329
52480
|
name: "button"
|
|
52330
52481
|
},
|
|
52482
|
+
{
|
|
52483
|
+
key: "calendarSource",
|
|
52484
|
+
name: "calendar-source"
|
|
52485
|
+
},
|
|
52486
|
+
{
|
|
52487
|
+
key: "calendars",
|
|
52488
|
+
name: "calendars"
|
|
52489
|
+
},
|
|
52331
52490
|
{
|
|
52332
52491
|
key: "cameraCredentials",
|
|
52333
52492
|
name: "camera-credentials"
|
|
@@ -52916,6 +53075,8 @@ var ALL_CAPABILITY_DEFINITIONS = [
|
|
|
52916
53075
|
brightnessCapability,
|
|
52917
53076
|
brokerCapability,
|
|
52918
53077
|
buttonCapability,
|
|
53078
|
+
calendarSourceCapability,
|
|
53079
|
+
calendarsCapability,
|
|
52919
53080
|
cameraCredentialsCapability,
|
|
52920
53081
|
cameraGridLayoutCapability,
|
|
52921
53082
|
cameraPipelineConfigCapability,
|
|
@@ -53838,6 +53999,36 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
53838
53999
|
addonId: null,
|
|
53839
54000
|
access: "create"
|
|
53840
54001
|
},
|
|
54002
|
+
"calendars.importFromHomeAssistant": {
|
|
54003
|
+
capName: "calendars",
|
|
54004
|
+
capScope: "system",
|
|
54005
|
+
addonId: null,
|
|
54006
|
+
access: "create"
|
|
54007
|
+
},
|
|
54008
|
+
"calendars.listCalendars": {
|
|
54009
|
+
capName: "calendars",
|
|
54010
|
+
capScope: "system",
|
|
54011
|
+
addonId: null,
|
|
54012
|
+
access: "view"
|
|
54013
|
+
},
|
|
54014
|
+
"calendars.listEvents": {
|
|
54015
|
+
capName: "calendars",
|
|
54016
|
+
capScope: "system",
|
|
54017
|
+
addonId: null,
|
|
54018
|
+
access: "view"
|
|
54019
|
+
},
|
|
54020
|
+
"calendarSource.listCalendars": {
|
|
54021
|
+
capName: "calendar-source",
|
|
54022
|
+
capScope: "system",
|
|
54023
|
+
addonId: null,
|
|
54024
|
+
access: "view"
|
|
54025
|
+
},
|
|
54026
|
+
"calendarSource.listEvents": {
|
|
54027
|
+
capName: "calendar-source",
|
|
54028
|
+
capScope: "system",
|
|
54029
|
+
addonId: null,
|
|
54030
|
+
access: "view"
|
|
54031
|
+
},
|
|
53841
54032
|
"cameraCredentials.getCredentials": {
|
|
53842
54033
|
capName: "camera-credentials",
|
|
53843
54034
|
capScope: "device",
|
|
@@ -56640,12 +56831,24 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
56640
56831
|
addonId: null,
|
|
56641
56832
|
access: "create"
|
|
56642
56833
|
},
|
|
56834
|
+
"notificationRules.activateAlarmProfile": {
|
|
56835
|
+
capName: "notification-rules",
|
|
56836
|
+
capScope: "system",
|
|
56837
|
+
addonId: null,
|
|
56838
|
+
access: "create"
|
|
56839
|
+
},
|
|
56643
56840
|
"notificationRules.cancelSnooze": {
|
|
56644
56841
|
capName: "notification-rules",
|
|
56645
56842
|
capScope: "system",
|
|
56646
56843
|
addonId: null,
|
|
56647
56844
|
access: "create"
|
|
56648
56845
|
},
|
|
56846
|
+
"notificationRules.createAlarmProfile": {
|
|
56847
|
+
capName: "notification-rules",
|
|
56848
|
+
capScope: "system",
|
|
56849
|
+
addonId: null,
|
|
56850
|
+
access: "create"
|
|
56851
|
+
},
|
|
56649
56852
|
"notificationRules.createRule": {
|
|
56650
56853
|
capName: "notification-rules",
|
|
56651
56854
|
capScope: "system",
|
|
@@ -56658,6 +56861,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
56658
56861
|
addonId: null,
|
|
56659
56862
|
access: "create"
|
|
56660
56863
|
},
|
|
56864
|
+
"notificationRules.deleteAlarmProfile": {
|
|
56865
|
+
capName: "notification-rules",
|
|
56866
|
+
capScope: "system",
|
|
56867
|
+
addonId: null,
|
|
56868
|
+
access: "delete"
|
|
56869
|
+
},
|
|
56661
56870
|
"notificationRules.deleteRule": {
|
|
56662
56871
|
capName: "notification-rules",
|
|
56663
56872
|
capScope: "system",
|
|
@@ -56742,6 +56951,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
56742
56951
|
addonId: null,
|
|
56743
56952
|
access: "view"
|
|
56744
56953
|
},
|
|
56954
|
+
"notificationRules.renameAlarmProfile": {
|
|
56955
|
+
capName: "notification-rules",
|
|
56956
|
+
capScope: "system",
|
|
56957
|
+
addonId: null,
|
|
56958
|
+
access: "create"
|
|
56959
|
+
},
|
|
56745
56960
|
"notificationRules.resolveArtifactUrl": {
|
|
56746
56961
|
capName: "notification-rules",
|
|
56747
56962
|
capScope: "system",
|
|
@@ -60298,6 +60513,8 @@ var KNOWN_CAP_NAMES = [
|
|
|
60298
60513
|
"brightness",
|
|
60299
60514
|
"broker",
|
|
60300
60515
|
"button",
|
|
60516
|
+
"calendar-source",
|
|
60517
|
+
"calendars",
|
|
60301
60518
|
"camera-credentials",
|
|
60302
60519
|
"camera-grid-layout",
|
|
60303
60520
|
"camera-pipeline-config",
|
|
@@ -60544,6 +60761,8 @@ var SYSTEM_CAP_NAMES = [
|
|
|
60544
60761
|
"auth-provider",
|
|
60545
60762
|
"backup",
|
|
60546
60763
|
"broker",
|
|
60764
|
+
"calendar-source",
|
|
60765
|
+
"calendars",
|
|
60547
60766
|
"composer",
|
|
60548
60767
|
"connection-test",
|
|
60549
60768
|
"core-blocks",
|
|
@@ -63930,6 +64149,11 @@ function createSystemProxy(api) {
|
|
|
63930
64149
|
getState: (input) => dispatch("broker", "getState", "query", input),
|
|
63931
64150
|
getStatus: (input) => dispatch("broker", "getStatus", "query", input)
|
|
63932
64151
|
},
|
|
64152
|
+
calendars: {
|
|
64153
|
+
listCalendars: (input) => dispatch("calendars", "listCalendars", "query", input),
|
|
64154
|
+
listEvents: (input) => dispatch("calendars", "listEvents", "query", input),
|
|
64155
|
+
importFromHomeAssistant: (input) => dispatch("calendars", "importFromHomeAssistant", "mutation", input)
|
|
64156
|
+
},
|
|
63933
64157
|
connectionTest: {
|
|
63934
64158
|
testSettings: (input) => dispatch("connectionTest", "testSettings", "mutation", input),
|
|
63935
64159
|
describeTest: (input) => dispatch("connectionTest", "describeTest", "query", input)
|
|
@@ -64213,6 +64437,10 @@ function createSystemProxy(api) {
|
|
|
64213
64437
|
cancelSnooze: (input) => dispatch("notificationRules", "cancelSnooze", "mutation", input),
|
|
64214
64438
|
getAlarmConfig: (input) => dispatch("notificationRules", "getAlarmConfig", "query", input),
|
|
64215
64439
|
setAlarmConfig: (input) => dispatch("notificationRules", "setAlarmConfig", "mutation", input),
|
|
64440
|
+
createAlarmProfile: (input) => dispatch("notificationRules", "createAlarmProfile", "mutation", input),
|
|
64441
|
+
renameAlarmProfile: (input) => dispatch("notificationRules", "renameAlarmProfile", "mutation", input),
|
|
64442
|
+
deleteAlarmProfile: (input) => dispatch("notificationRules", "deleteAlarmProfile", "mutation", input),
|
|
64443
|
+
activateAlarmProfile: (input) => dispatch("notificationRules", "activateAlarmProfile", "mutation", input),
|
|
64216
64444
|
getAlarmSensors: (input) => dispatch("notificationRules", "getAlarmSensors", "query", input)
|
|
64217
64445
|
},
|
|
64218
64446
|
osdManager: {
|
|
@@ -66527,6 +66755,203 @@ function alarmPatchLanded(patch, returned) {
|
|
|
66527
66755
|
return true;
|
|
66528
66756
|
}
|
|
66529
66757
|
//#endregion
|
|
66758
|
+
//#region src/notification/alarm-profiles.ts
|
|
66759
|
+
/** Stable id of the always-present Default profile (migrated from flat settings). */
|
|
66760
|
+
var NC_ALARM_DEFAULT_PROFILE_ID = "default";
|
|
66761
|
+
var NC_ALARM_DEFAULT_PROFILE_NAME = "Default";
|
|
66762
|
+
/** Stock delays — same numbers the panel shipped with before any editor existed. */
|
|
66763
|
+
var NC_ALARM_SYSTEM_DEFAULT_DELAYS = {
|
|
66764
|
+
exitDelaySec: 30,
|
|
66765
|
+
entryDelaySec: 20,
|
|
66766
|
+
triggeredDurationSec: 0
|
|
66767
|
+
};
|
|
66768
|
+
/** Empty memberships + stock delays + no announce targets. */
|
|
66769
|
+
function ncAlarmSystemDefaultSettings() {
|
|
66770
|
+
return {
|
|
66771
|
+
...NC_ALARM_SYSTEM_DEFAULT_DELAYS,
|
|
66772
|
+
announceTargets: [],
|
|
66773
|
+
nonBlocking: [],
|
|
66774
|
+
blocking: [],
|
|
66775
|
+
secureOnArmOff: [],
|
|
66776
|
+
modeDelays: []
|
|
66777
|
+
};
|
|
66778
|
+
}
|
|
66779
|
+
function isDefaultAlarmProfileId(id) {
|
|
66780
|
+
return id === NC_ALARM_DEFAULT_PROFILE_ID;
|
|
66781
|
+
}
|
|
66782
|
+
/** Deep-enough copy of a settings blob (arrays replaced, never mutated). */
|
|
66783
|
+
function cloneAlarmSettings(settings) {
|
|
66784
|
+
return {
|
|
66785
|
+
exitDelaySec: settings.exitDelaySec,
|
|
66786
|
+
entryDelaySec: settings.entryDelaySec,
|
|
66787
|
+
triggeredDurationSec: settings.triggeredDurationSec,
|
|
66788
|
+
...settings.announceArm !== void 0 ? { announceArm: settings.announceArm } : {},
|
|
66789
|
+
announceTargets: [...settings.announceTargets],
|
|
66790
|
+
nonBlocking: settings.nonBlocking.map((l) => ({
|
|
66791
|
+
mode: l.mode,
|
|
66792
|
+
deviceIds: [...l.deviceIds]
|
|
66793
|
+
})),
|
|
66794
|
+
blocking: settings.blocking.map((l) => ({
|
|
66795
|
+
mode: l.mode,
|
|
66796
|
+
deviceIds: [...l.deviceIds]
|
|
66797
|
+
})),
|
|
66798
|
+
secureOnArmOff: settings.secureOnArmOff.map((l) => ({
|
|
66799
|
+
mode: l.mode,
|
|
66800
|
+
deviceIds: [...l.deviceIds]
|
|
66801
|
+
})),
|
|
66802
|
+
modeDelays: settings.modeDelays.map((e) => ({ ...e }))
|
|
66803
|
+
};
|
|
66804
|
+
}
|
|
66805
|
+
/**
|
|
66806
|
+
* Seed Default from the panel's current flat settings when no profiles exist yet
|
|
66807
|
+
* (first boot after this feature, or a wiped profiles key).
|
|
66808
|
+
*/
|
|
66809
|
+
function ensureAlarmProfiles(state, currentSettings) {
|
|
66810
|
+
if (state !== null && state !== void 0 && state.profiles.length > 0) {
|
|
66811
|
+
if (!state.profiles.some((p) => p.id === "default")) return {
|
|
66812
|
+
activeId: state.activeId,
|
|
66813
|
+
profiles: [{
|
|
66814
|
+
id: NC_ALARM_DEFAULT_PROFILE_ID,
|
|
66815
|
+
name: NC_ALARM_DEFAULT_PROFILE_NAME,
|
|
66816
|
+
settings: cloneAlarmSettings(currentSettings)
|
|
66817
|
+
}, ...state.profiles]
|
|
66818
|
+
};
|
|
66819
|
+
return state.profiles.some((p) => p.id === state.activeId) ? state : {
|
|
66820
|
+
activeId: NC_ALARM_DEFAULT_PROFILE_ID,
|
|
66821
|
+
profiles: state.profiles
|
|
66822
|
+
};
|
|
66823
|
+
}
|
|
66824
|
+
return {
|
|
66825
|
+
activeId: NC_ALARM_DEFAULT_PROFILE_ID,
|
|
66826
|
+
profiles: [{
|
|
66827
|
+
id: NC_ALARM_DEFAULT_PROFILE_ID,
|
|
66828
|
+
name: NC_ALARM_DEFAULT_PROFILE_NAME,
|
|
66829
|
+
settings: cloneAlarmSettings(currentSettings)
|
|
66830
|
+
}]
|
|
66831
|
+
};
|
|
66832
|
+
}
|
|
66833
|
+
function normalizeName(name) {
|
|
66834
|
+
return name.trim();
|
|
66835
|
+
}
|
|
66836
|
+
function nameTaken(state, name, exceptId) {
|
|
66837
|
+
const lower = name.toLowerCase();
|
|
66838
|
+
return state.profiles.some((p) => p.id !== exceptId && p.name.trim().toLowerCase() === lower);
|
|
66839
|
+
}
|
|
66840
|
+
function createAlarmProfile(state, input) {
|
|
66841
|
+
const name = normalizeName(input.name);
|
|
66842
|
+
if (name.length === 0) return {
|
|
66843
|
+
kind: "refused",
|
|
66844
|
+
reason: "name-empty"
|
|
66845
|
+
};
|
|
66846
|
+
if (nameTaken(state, name)) return {
|
|
66847
|
+
kind: "refused",
|
|
66848
|
+
reason: "name-taken",
|
|
66849
|
+
detail: name
|
|
66850
|
+
};
|
|
66851
|
+
if (isDefaultAlarmProfileId(input.id)) return {
|
|
66852
|
+
kind: "refused",
|
|
66853
|
+
reason: "cannot-rename-default-id"
|
|
66854
|
+
};
|
|
66855
|
+
let settings;
|
|
66856
|
+
if (input.source.kind === "defaults") settings = ncAlarmSystemDefaultSettings();
|
|
66857
|
+
else {
|
|
66858
|
+
const fromId = input.source.fromId;
|
|
66859
|
+
const src = state.profiles.find((p) => p.id === fromId);
|
|
66860
|
+
if (src === void 0) return {
|
|
66861
|
+
kind: "refused",
|
|
66862
|
+
reason: "clone-source-missing",
|
|
66863
|
+
detail: fromId
|
|
66864
|
+
};
|
|
66865
|
+
settings = cloneAlarmSettings(src.settings);
|
|
66866
|
+
}
|
|
66867
|
+
return {
|
|
66868
|
+
kind: "ok",
|
|
66869
|
+
state: {
|
|
66870
|
+
activeId: state.activeId,
|
|
66871
|
+
profiles: [...state.profiles, {
|
|
66872
|
+
id: input.id,
|
|
66873
|
+
name,
|
|
66874
|
+
settings
|
|
66875
|
+
}]
|
|
66876
|
+
}
|
|
66877
|
+
};
|
|
66878
|
+
}
|
|
66879
|
+
function renameAlarmProfile(state, input) {
|
|
66880
|
+
const name = normalizeName(input.name);
|
|
66881
|
+
if (name.length === 0) return {
|
|
66882
|
+
kind: "refused",
|
|
66883
|
+
reason: "name-empty"
|
|
66884
|
+
};
|
|
66885
|
+
const at = state.profiles.findIndex((p) => p.id === input.id);
|
|
66886
|
+
if (at < 0) return {
|
|
66887
|
+
kind: "refused",
|
|
66888
|
+
reason: "not-found",
|
|
66889
|
+
detail: input.id
|
|
66890
|
+
};
|
|
66891
|
+
if (nameTaken(state, name, input.id)) return {
|
|
66892
|
+
kind: "refused",
|
|
66893
|
+
reason: "name-taken",
|
|
66894
|
+
detail: name
|
|
66895
|
+
};
|
|
66896
|
+
const next = state.profiles.map((p, i) => i === at ? {
|
|
66897
|
+
...p,
|
|
66898
|
+
name
|
|
66899
|
+
} : p);
|
|
66900
|
+
return {
|
|
66901
|
+
kind: "ok",
|
|
66902
|
+
state: {
|
|
66903
|
+
activeId: state.activeId,
|
|
66904
|
+
profiles: next
|
|
66905
|
+
}
|
|
66906
|
+
};
|
|
66907
|
+
}
|
|
66908
|
+
function deleteAlarmProfile(state, id) {
|
|
66909
|
+
if (isDefaultAlarmProfileId(id)) return {
|
|
66910
|
+
kind: "refused",
|
|
66911
|
+
reason: "cannot-delete-default"
|
|
66912
|
+
};
|
|
66913
|
+
if (!state.profiles.some((p) => p.id === id)) return {
|
|
66914
|
+
kind: "refused",
|
|
66915
|
+
reason: "not-found",
|
|
66916
|
+
detail: id
|
|
66917
|
+
};
|
|
66918
|
+
const profiles = state.profiles.filter((p) => p.id !== id);
|
|
66919
|
+
return {
|
|
66920
|
+
kind: "ok",
|
|
66921
|
+
state: {
|
|
66922
|
+
activeId: state.activeId === id ? NC_ALARM_DEFAULT_PROFILE_ID : state.activeId,
|
|
66923
|
+
profiles
|
|
66924
|
+
}
|
|
66925
|
+
};
|
|
66926
|
+
}
|
|
66927
|
+
function activateAlarmProfile(state, id) {
|
|
66928
|
+
if (!state.profiles.some((p) => p.id === id)) return {
|
|
66929
|
+
kind: "refused",
|
|
66930
|
+
reason: "not-found",
|
|
66931
|
+
detail: id
|
|
66932
|
+
};
|
|
66933
|
+
return {
|
|
66934
|
+
kind: "ok",
|
|
66935
|
+
state: {
|
|
66936
|
+
activeId: id,
|
|
66937
|
+
profiles: state.profiles
|
|
66938
|
+
}
|
|
66939
|
+
};
|
|
66940
|
+
}
|
|
66941
|
+
/** Persist the live flat settings into the active profile's blob. */
|
|
66942
|
+
function syncActiveAlarmProfileSettings(state, settings) {
|
|
66943
|
+
return {
|
|
66944
|
+
activeId: state.activeId,
|
|
66945
|
+
profiles: state.profiles.map((p) => p.id === state.activeId ? {
|
|
66946
|
+
...p,
|
|
66947
|
+
settings: cloneAlarmSettings(settings)
|
|
66948
|
+
} : p)
|
|
66949
|
+
};
|
|
66950
|
+
}
|
|
66951
|
+
function alarmProfileById(state, id) {
|
|
66952
|
+
return state.profiles.find((p) => p.id === id);
|
|
66953
|
+
}
|
|
66954
|
+
//#endregion
|
|
66530
66955
|
//#region src/notification/sensor-raised.ts
|
|
66531
66956
|
/**
|
|
66532
66957
|
* WHICH WAY A BOOLEAN SENSOR MOVED — read off the one slice a sensor event
|
|
@@ -70560,6 +70985,12 @@ exports.CONTAINER_CHILD_PRIORITY = CONTAINER_CHILD_PRIORITY;
|
|
|
70560
70985
|
exports.CORE_BLOCKS_ADDON_ID = CORE_BLOCKS_ADDON_ID;
|
|
70561
70986
|
exports.CORE_BLOCK_ADDON_PREFIX = CORE_BLOCK_ADDON_PREFIX;
|
|
70562
70987
|
exports.CUSTOMIZATION_BLOCK_NAME_PREFIX = require_composition.CUSTOMIZATION_BLOCK_NAME_PREFIX;
|
|
70988
|
+
exports.CalendarEntrySchema = CalendarEntrySchema;
|
|
70989
|
+
exports.CalendarEventSchema = CalendarEventSchema;
|
|
70990
|
+
exports.CalendarImportResultSchema = CalendarImportResultSchema;
|
|
70991
|
+
exports.CalendarInfoSchema = CalendarInfoSchema;
|
|
70992
|
+
exports.CalendarListEventsInputSchema = CalendarListEventsInputSchema;
|
|
70993
|
+
exports.CalendarSourceKindSchema = CalendarSourceKindSchema;
|
|
70563
70994
|
exports.CamProfileSchema = require_sleep.CamProfileSchema;
|
|
70564
70995
|
exports.CamStreamDescriptorSchema = CamStreamDescriptorSchema;
|
|
70565
70996
|
exports.CamStreamKindSchema = require_sleep.CamStreamKindSchema;
|
|
@@ -71157,11 +71588,14 @@ exports.NAVIGATION_ACTION_CATALOG = NAVIGATION_ACTION_CATALOG;
|
|
|
71157
71588
|
exports.NAVIGATION_LIGHT_LEVEL_MAX = NAVIGATION_LIGHT_LEVEL_MAX;
|
|
71158
71589
|
exports.NAVIGATION_LIGHT_LEVEL_MIN = NAVIGATION_LIGHT_LEVEL_MIN;
|
|
71159
71590
|
exports.NC_ALARM_CONTROLLABLE_CAPS = NC_ALARM_CONTROLLABLE_CAPS;
|
|
71591
|
+
exports.NC_ALARM_DEFAULT_PROFILE_ID = NC_ALARM_DEFAULT_PROFILE_ID;
|
|
71592
|
+
exports.NC_ALARM_DEFAULT_PROFILE_NAME = NC_ALARM_DEFAULT_PROFILE_NAME;
|
|
71160
71593
|
exports.NC_ALARM_DELAY_FIELDS = NC_ALARM_DELAY_FIELDS;
|
|
71161
71594
|
exports.NC_ALARM_DELAY_MAX_SEC = NC_ALARM_DELAY_MAX_SEC;
|
|
71162
71595
|
exports.NC_ALARM_NONBLOCKING_MAX = NC_ALARM_NONBLOCKING_MAX;
|
|
71163
71596
|
exports.NC_ALARM_OPENING_EVENT_KINDS = NC_ALARM_OPENING_EVENT_KINDS;
|
|
71164
71597
|
exports.NC_ALARM_SENSORS_MAX = NC_ALARM_SENSORS_MAX;
|
|
71598
|
+
exports.NC_ALARM_SYSTEM_DEFAULT_DELAYS = NC_ALARM_SYSTEM_DEFAULT_DELAYS;
|
|
71165
71599
|
exports.NC_ALARM_SYSTEM_EVENT_KINDS = NC_ALARM_SYSTEM_EVENT_KINDS;
|
|
71166
71600
|
exports.NC_ALARM_TRIGGERED_MAX_SEC = NC_ALARM_TRIGGERED_MAX_SEC;
|
|
71167
71601
|
exports.NC_AUDIO_CONFIRM_HITS_DEFAULT = NC_AUDIO_CONFIRM_HITS_DEFAULT;
|
|
@@ -71256,12 +71690,17 @@ exports.NavigationStatusSchema = NavigationStatusSchema;
|
|
|
71256
71690
|
exports.NcAlarmBlockingEditSchema = NcAlarmBlockingEditSchema;
|
|
71257
71691
|
exports.NcAlarmBlockingSchema = NcAlarmBlockingSchema;
|
|
71258
71692
|
exports.NcAlarmConfigSchema = NcAlarmConfigSchema;
|
|
71693
|
+
exports.NcAlarmCreateProfileInputSchema = NcAlarmCreateProfileInputSchema;
|
|
71259
71694
|
exports.NcAlarmModeCoverageSchema = NcAlarmModeCoverageSchema;
|
|
71260
71695
|
exports.NcAlarmModeDelaysEditSchema = NcAlarmModeDelaysEditSchema;
|
|
71261
71696
|
exports.NcAlarmModeDelaysSchema = NcAlarmModeDelaysSchema;
|
|
71262
71697
|
exports.NcAlarmModeDeviceListSchema = NcAlarmModeDeviceListSchema;
|
|
71263
71698
|
exports.NcAlarmNonBlockingEditSchema = NcAlarmNonBlockingEditSchema;
|
|
71264
71699
|
exports.NcAlarmNonBlockingSchema = NcAlarmNonBlockingSchema;
|
|
71700
|
+
exports.NcAlarmProfileIdInputSchema = NcAlarmProfileIdInputSchema;
|
|
71701
|
+
exports.NcAlarmProfileMetaSchema = NcAlarmProfileMetaSchema;
|
|
71702
|
+
exports.NcAlarmProfilesViewSchema = NcAlarmProfilesViewSchema;
|
|
71703
|
+
exports.NcAlarmRenameProfileInputSchema = NcAlarmRenameProfileInputSchema;
|
|
71265
71704
|
exports.NcAlarmSecureOnArmEditSchema = NcAlarmSecureOnArmEditSchema;
|
|
71266
71705
|
exports.NcAlarmSecureOnArmOffSchema = NcAlarmSecureOnArmOffSchema;
|
|
71267
71706
|
exports.NcAlarmSensorReadingSchema = NcAlarmSensorReadingSchema;
|
|
@@ -71836,6 +72275,7 @@ exports.ZoneScopeBreakdownSchema = ZoneScopeBreakdownSchema;
|
|
|
71836
72275
|
exports.__resetLogChannelRegistryForTests = __resetLogChannelRegistryForTests;
|
|
71837
72276
|
exports.accessoriesCapability = accessoriesCapability;
|
|
71838
72277
|
exports.accessoryStableId = accessoryStableId;
|
|
72278
|
+
exports.activateAlarmProfile = activateAlarmProfile;
|
|
71839
72279
|
exports.addonPagesCapability = addonPagesCapability;
|
|
71840
72280
|
exports.addonPagesSourceCapability = addonPagesSourceCapability;
|
|
71841
72281
|
exports.addonRoutesCapability = addonRoutesCapability;
|
|
@@ -71849,6 +72289,7 @@ exports.alarmDeviceBlocksArming = alarmDeviceBlocksArming;
|
|
|
71849
72289
|
exports.alarmDeviceSecureOnArm = alarmDeviceSecureOnArm;
|
|
71850
72290
|
exports.alarmPanelCapability = alarmPanelCapability;
|
|
71851
72291
|
exports.alarmPatchLanded = alarmPatchLanded;
|
|
72292
|
+
exports.alarmProfileById = alarmProfileById;
|
|
71852
72293
|
exports.alertsCapability = alertsCapability;
|
|
71853
72294
|
exports.ambientLightSensorCapability = ambientLightSensorCapability;
|
|
71854
72295
|
exports.applyBlockingEdit = applyBlockingEdit;
|
|
@@ -71900,6 +72341,8 @@ exports.buildStreamParamsConfigSchema = buildStreamParamsConfigSchema;
|
|
|
71900
72341
|
exports.buildVideoArgs = require_composition.buildVideoArgs;
|
|
71901
72342
|
exports.builtCapabilityBlockers = builtCapabilityBlockers;
|
|
71902
72343
|
exports.buttonCapability = buttonCapability;
|
|
72344
|
+
exports.calendarSourceCapability = calendarSourceCapability;
|
|
72345
|
+
exports.calendarsCapability = calendarsCapability;
|
|
71903
72346
|
exports.cameraCredentialsCapability = cameraCredentialsCapability;
|
|
71904
72347
|
exports.cameraGridLayoutCapability = cameraGridLayoutCapability;
|
|
71905
72348
|
exports.cameraOwnsMotionViaSensor = cameraOwnsMotionViaSensor;
|
|
@@ -71917,6 +72360,7 @@ exports.climateControlCapability = climateControlCapability;
|
|
|
71917
72360
|
exports.clipExportFailure = clipExportFailure;
|
|
71918
72361
|
exports.clipExportFailureOf = clipExportFailureOf;
|
|
71919
72362
|
exports.clipReasonHeaderValue = clipReasonHeaderValue;
|
|
72363
|
+
exports.cloneAlarmSettings = cloneAlarmSettings;
|
|
71920
72364
|
exports.cloneStatefulExpressionMemory = require_composition.cloneStatefulExpressionMemory;
|
|
71921
72365
|
exports.clusterModelSettingKey = clusterModelSettingKey;
|
|
71922
72366
|
exports.clusterStepSettingFieldsFor = clusterStepSettingFieldsFor;
|
|
@@ -71962,6 +72406,7 @@ exports.coreBlocksCapability = coreBlocksCapability;
|
|
|
71962
72406
|
exports.cosineSimilarity = cosineSimilarity;
|
|
71963
72407
|
exports.countConditionLeaves = countConditionLeaves;
|
|
71964
72408
|
exports.coverCapability = coverCapability;
|
|
72409
|
+
exports.createAlarmProfile = createAlarmProfile;
|
|
71965
72410
|
exports.createDeviceExtensionProvider = createDeviceExtensionProvider;
|
|
71966
72411
|
exports.createDeviceProxy = require_sleep.createDeviceProxy;
|
|
71967
72412
|
exports.createDurableState = require_sleep.createDurableState;
|
|
@@ -71990,6 +72435,7 @@ exports.defaultDeliveryForSection = defaultDeliveryForSection;
|
|
|
71990
72435
|
exports.defaultDeviceFor = defaultDeviceFor;
|
|
71991
72436
|
exports.defineCustomActions = require_sleep.defineCustomActions;
|
|
71992
72437
|
exports.defineExtensionSlotProvider = defineExtensionSlotProvider;
|
|
72438
|
+
exports.deleteAlarmProfile = deleteAlarmProfile;
|
|
71993
72439
|
exports.deriveBatteryPresence = deriveBatteryPresence;
|
|
71994
72440
|
exports.deriveCameraSwitches = deriveCameraSwitches;
|
|
71995
72441
|
exports.deriveDetailCropRect = deriveDetailCropRect;
|
|
@@ -72038,6 +72484,7 @@ exports.emitReadiness = require_sleep.emitReadiness;
|
|
|
72038
72484
|
exports.emitsCollectionSelector = emitsCollectionSelector;
|
|
72039
72485
|
exports.encodeProfileFromStreamShape = encodeProfileFromStreamShape;
|
|
72040
72486
|
exports.encodeVectorBase64 = encodeVectorBase64;
|
|
72487
|
+
exports.ensureAlarmProfiles = ensureAlarmProfiles;
|
|
72041
72488
|
exports.enumSensorCapability = enumSensorCapability;
|
|
72042
72489
|
exports.enumerateInferenceDevices = enumerateInferenceDevices;
|
|
72043
72490
|
exports.enumerateItemArrayFields = enumerateItemArrayFields;
|
|
@@ -72125,6 +72572,7 @@ exports.isBaseConditionKey = isBaseConditionKey;
|
|
|
72125
72572
|
exports.isBatteryPresenceFault = isBatteryPresenceFault;
|
|
72126
72573
|
exports.isClusterScopedStep = isClusterScopedStep;
|
|
72127
72574
|
exports.isCollectionArrayMethod = isCollectionArrayMethod;
|
|
72575
|
+
exports.isDefaultAlarmProfileId = isDefaultAlarmProfileId;
|
|
72128
72576
|
exports.isDeployableToAgent = isDeployableToAgent;
|
|
72129
72577
|
exports.isDetectionMacroClass = isDetectionMacroClass;
|
|
72130
72578
|
exports.isDeviceConfigCap = require_sleep.isDeviceConfigCap;
|
|
@@ -72215,6 +72663,7 @@ exports.motionZonesCapability = motionZonesCapability;
|
|
|
72215
72663
|
exports.mqttBrokerCapability = mqttBrokerCapability;
|
|
72216
72664
|
exports.nativeObjectDetectionCapability = nativeObjectDetectionCapability;
|
|
72217
72665
|
exports.navigationCapability = navigationCapability;
|
|
72666
|
+
exports.ncAlarmSystemDefaultSettings = ncAlarmSystemDefaultSettings;
|
|
72218
72667
|
exports.networkAccessCapability = networkAccessCapability;
|
|
72219
72668
|
exports.networkLinkCapability = networkLinkCapability;
|
|
72220
72669
|
exports.networkQualityCapability = networkQualityCapability;
|
|
@@ -72306,6 +72755,7 @@ exports.recordingOnboardCapability = recordingOnboardCapability;
|
|
|
72306
72755
|
exports.recordingSignalCapability = recordingSignalCapability;
|
|
72307
72756
|
exports.rectsToCells = rectsToCells;
|
|
72308
72757
|
exports.reducePoints = reducePoints;
|
|
72758
|
+
exports.renameAlarmProfile = renameAlarmProfile;
|
|
72309
72759
|
exports.replacedFieldKeys = replacedFieldKeys;
|
|
72310
72760
|
exports.requiredTopLevelKeys = requiredTopLevelKeys;
|
|
72311
72761
|
exports.requiresPython = requiresPython;
|
|
@@ -72407,6 +72857,7 @@ exports.summarizeEffectiveScope = summarizeEffectiveScope;
|
|
|
72407
72857
|
exports.supportedRuntimes = supportedRuntimes;
|
|
72408
72858
|
exports.switchCapability = switchCapability;
|
|
72409
72859
|
exports.switchedOffIds = switchedOffIds;
|
|
72860
|
+
exports.syncActiveAlarmProfileSettings = syncActiveAlarmProfileSettings;
|
|
72410
72861
|
exports.synthesizeSourceInfo = synthesizeSourceInfo;
|
|
72411
72862
|
exports.systemCapability = systemCapability;
|
|
72412
72863
|
exports.systemEventDeliveryProblems = systemEventDeliveryProblems;
|