@camstack/types 1.2.297 → 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/capabilities/index.d.ts +1 -1
- package/dist/capabilities/notification-rules.cap.d.ts +619 -0
- package/dist/generated/addon-api.d.ts +28 -0
- package/dist/generated/method-access-map.d.ts +1 -1
- package/dist/generated/system-proxy.d.ts +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +311 -0
- package/dist/index.mjs +294 -1
- package/dist/notification/alarm-profiles.d.ts +70 -0
- package/package.json +1 -1
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* scope+access check inside `protectedProcedure` (see
|
|
7
7
|
* `server/backend/src/api/trpc/trpc.middleware.ts`).
|
|
8
8
|
*
|
|
9
|
-
* Coverage:
|
|
9
|
+
* Coverage: 1211 method paths across 165 capabilities.
|
|
10
10
|
*/
|
|
11
11
|
import type { CapabilityMethodAccess } from '../capabilities/capability-definition.js';
|
|
12
12
|
export interface MethodAccessRecord {
|
|
@@ -85,7 +85,7 @@ export interface SystemProxy {
|
|
|
85
85
|
readonly networkQuality: Pick<InferProvider<typeof networkQualityCapability>, 'getAllStats'>;
|
|
86
86
|
readonly nodes: Pick<InferProvider<typeof nodesCapability>, 'topology' | 'directory' | 'deployAddon' | 'undeployAddon' | 'restartAddon' | 'restartProcess' | 'restartNode' | 'shutdownNode' | 'renameNode' | 'clusterAddonStatus' | 'getCapUsageGraph' | 'getNodeAddons' | 'setProcessLogLevel' | 'executeQuery'>;
|
|
87
87
|
readonly notificationOutput: Pick<InferProvider<typeof notificationOutputCapability>, 'listTargetKinds' | 'listTargets' | 'discoverTargets' | 'send' | 'testTarget' | 'upsertTarget' | 'deleteTarget' | 'setTargetEnabled'>;
|
|
88
|
-
readonly notificationRules: Pick<InferProvider<typeof notificationRulesCapability>, 'listRules' | 'getRule' | 'createRule' | 'updateRule' | 'deleteRule' | 'setRuleEnabled' | 'getClipRetentionAsks' | 'listDeviceMutes' | 'testRule' | 'previewStateSummary' | 'getConditionCatalog' | 'getTemplateCatalog' | 'previewTemplate' | 'getHistory' | 'getRuleLastRuns' | 'resolveArtifactUrl' | 'listSnoozes' | 'createSnooze' | 'cancelSnooze' | 'getAlarmConfig' | 'setAlarmConfig' | 'getAlarmSensors'>;
|
|
88
|
+
readonly notificationRules: Pick<InferProvider<typeof notificationRulesCapability>, 'listRules' | 'getRule' | 'createRule' | 'updateRule' | 'deleteRule' | 'setRuleEnabled' | 'getClipRetentionAsks' | 'listDeviceMutes' | 'testRule' | 'previewStateSummary' | 'getConditionCatalog' | 'getTemplateCatalog' | 'previewTemplate' | 'getHistory' | 'getRuleLastRuns' | 'resolveArtifactUrl' | 'listSnoozes' | 'createSnooze' | 'cancelSnooze' | 'getAlarmConfig' | 'setAlarmConfig' | 'createAlarmProfile' | 'renameAlarmProfile' | 'deleteAlarmProfile' | 'activateAlarmProfile' | 'getAlarmSensors'>;
|
|
89
89
|
readonly osdManager: Pick<InferProvider<typeof osdManagerCapability>, 'getConditionSupport' | 'copyDeviceConfiguration' | 'listTemplates' | 'upsertTemplate' | 'deleteTemplate'>;
|
|
90
90
|
readonly pipelineExecutor: Pick<InferProvider<typeof pipelineExecutorCapability>, 'getAvailableEngines' | 'getSelectedEngine' | 'getDefaultSteps' | 'getEngineProvisioning' | 'getVideoPipelineSteps' | 'setVideoPipelineSteps' | 'clearDeviceOverrides' | 'getInferenceDeviceHealth' | 'rearmInferenceDevice' | 'getSchema' | 'getGlobalSteps' | 'getGlobalPipelineConfig' | 'getOrchestratorConfigSchema' | 'validatePipeline' | 'listTemplates' | 'saveTemplate' | 'updateTemplate' | 'deleteTemplate' | 'getCapabilities' | 'getAddonModels' | 'downloadModel' | 'deleteModel' | 'cacheFrameInPool' | 'inferCached' | 'uncacheFrame' | 'getEffectiveTuning' | 'listLoadedEngines' | 'spinEngine' | 'killEngine' | 'listReferenceImages' | 'getReferenceImage' | 'getReferenceAudioFiles' | 'getReferenceAudio' | 'getAudioCapabilities' | 'runAudioTest' | 'getDetectionConfigSchema'>;
|
|
91
91
|
readonly pipelineOrchestrator: Pick<InferProvider<typeof pipelineOrchestratorCapability>, 'requestOccupancyLook' | 'pauseForStorageMigration' | 'resumeForStorageMigration' | 'rebalance' | 'getPipelineAssignments' | 'getAgentLoad' | 'getClusterModelChoice' | 'getGlobalMetrics' | 'getCapabilityBindings' | 'setCapabilityBinding' | 'getIngestOwner' | 'getAudioNodeLoad' | 'getAudioAssignments' | 'getAgentSettings' | 'listAgentSettings' | 'removeAgentSettings' | 'setAgentMaxCameras' | 'setAgentDetectWeight' | 'setAgentCapabilities' | 'setAgentDecodeLimits' | 'setAgentReachableHost' | 'setAgentInferenceDevices' | 'getNodeInferenceDevices' | 'resetNodePipelineDefaults' | 'getCameraStatuses' | 'setCameraSensors' | 'reconcileFromDisk' | 'getReconcileFromDiskStatus' | 'listTemplates' | 'saveTemplate' | 'updateTemplate' | 'deleteTemplate'>;
|
package/dist/index.d.ts
CHANGED
|
@@ -241,6 +241,7 @@ export { isScheduleActive } from './notification/schedule.js';
|
|
|
241
241
|
export { isAlarmControllableCap, NC_ALARM_CONTROLLABLE_CAPS, NC_ALARM_OPENING_EVENT_KINDS, NC_SENSOR_TRANSITION_NEVER_FIRES_WARNING, type NcAlarmControllableCap, type NcAlarmMembershipSubject, type NcAlarmOpeningEventKind, ruleBelongsToAlarm, sensorTransitionNeverFires, } from './notification/alarm-membership.js';
|
|
242
242
|
export { alarmDeviceBlocksArming, alarmDeviceSecureOnArm, type AlarmDeviceBlocksInput, type AlarmDeviceSecureOnArmInput, type NcAlarmSecureActuation, secureActuationFor, } from './notification/alarm-controllable.js';
|
|
243
243
|
export { alarmPatchLanded, applyBlockingEdit, applyModeDelaysEdits, applyModeDeviceListEdit, applyNonBlockingEdit, applySecureOnArmEdit, NC_ALARM_DELAY_FIELDS, type NcAlarmDelayField, type NcAlarmDelaySettings, type NcAlarmDelaySource, type NcAlarmModeDeviceListEditResult, type NcAlarmNonBlockingEditResult, type NcAlarmResolvedDelays, resolveModeDelays, } from './notification/alarm-settings.js';
|
|
244
|
+
export { activateAlarmProfile, alarmProfileById, cloneAlarmSettings, createAlarmProfile, deleteAlarmProfile, ensureAlarmProfiles, isDefaultAlarmProfileId, NC_ALARM_DEFAULT_PROFILE_ID, NC_ALARM_DEFAULT_PROFILE_NAME, NC_ALARM_SYSTEM_DEFAULT_DELAYS, ncAlarmSystemDefaultSettings, type NcAlarmProfileCreateSource, type NcAlarmProfileRecord, type NcAlarmProfilesMutationResult, type NcAlarmProfilesRefuseReason, type NcAlarmProfilesState, renameAlarmProfile, syncActiveAlarmProfileSettings, } from './notification/alarm-profiles.js';
|
|
244
245
|
export { NC_SENSOR_RAISED_FIELD_BY_KIND, NC_SENSOR_TRANSITION_KINDS, NC_SENSOR_TRANSITION_UNSUPPORTED_REASON, sensorRaisedOf, sensorTransitionOffered, } from './notification/sensor-raised.js';
|
|
245
246
|
export { NC_TEMPLATE_HELD_BACK_SYSTEM_EVENT_KINDS, NC_TEMPLATE_VARS, isHeldBackTemplateVar, isKnownTemplateVar, servedTemplateVars, templateVarDeliveryApplies, templateVarKindApplies, templateVarSystemEventApplies, templateVarsFor, } from './notification/template-vars.js';
|
|
246
247
|
export { NC_SYSTEM_EVENT_FILTER_KEYS, type NcSystemEventFilterKey, systemEventFilterApplies, systemEventFilterAppliesToAnyKind, } from './notification/system-event-filters.js';
|
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
|
|
@@ -56763,12 +56831,24 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
56763
56831
|
addonId: null,
|
|
56764
56832
|
access: "create"
|
|
56765
56833
|
},
|
|
56834
|
+
"notificationRules.activateAlarmProfile": {
|
|
56835
|
+
capName: "notification-rules",
|
|
56836
|
+
capScope: "system",
|
|
56837
|
+
addonId: null,
|
|
56838
|
+
access: "create"
|
|
56839
|
+
},
|
|
56766
56840
|
"notificationRules.cancelSnooze": {
|
|
56767
56841
|
capName: "notification-rules",
|
|
56768
56842
|
capScope: "system",
|
|
56769
56843
|
addonId: null,
|
|
56770
56844
|
access: "create"
|
|
56771
56845
|
},
|
|
56846
|
+
"notificationRules.createAlarmProfile": {
|
|
56847
|
+
capName: "notification-rules",
|
|
56848
|
+
capScope: "system",
|
|
56849
|
+
addonId: null,
|
|
56850
|
+
access: "create"
|
|
56851
|
+
},
|
|
56772
56852
|
"notificationRules.createRule": {
|
|
56773
56853
|
capName: "notification-rules",
|
|
56774
56854
|
capScope: "system",
|
|
@@ -56781,6 +56861,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
56781
56861
|
addonId: null,
|
|
56782
56862
|
access: "create"
|
|
56783
56863
|
},
|
|
56864
|
+
"notificationRules.deleteAlarmProfile": {
|
|
56865
|
+
capName: "notification-rules",
|
|
56866
|
+
capScope: "system",
|
|
56867
|
+
addonId: null,
|
|
56868
|
+
access: "delete"
|
|
56869
|
+
},
|
|
56784
56870
|
"notificationRules.deleteRule": {
|
|
56785
56871
|
capName: "notification-rules",
|
|
56786
56872
|
capScope: "system",
|
|
@@ -56865,6 +56951,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
56865
56951
|
addonId: null,
|
|
56866
56952
|
access: "view"
|
|
56867
56953
|
},
|
|
56954
|
+
"notificationRules.renameAlarmProfile": {
|
|
56955
|
+
capName: "notification-rules",
|
|
56956
|
+
capScope: "system",
|
|
56957
|
+
addonId: null,
|
|
56958
|
+
access: "create"
|
|
56959
|
+
},
|
|
56868
56960
|
"notificationRules.resolveArtifactUrl": {
|
|
56869
56961
|
capName: "notification-rules",
|
|
56870
56962
|
capScope: "system",
|
|
@@ -64345,6 +64437,10 @@ function createSystemProxy(api) {
|
|
|
64345
64437
|
cancelSnooze: (input) => dispatch("notificationRules", "cancelSnooze", "mutation", input),
|
|
64346
64438
|
getAlarmConfig: (input) => dispatch("notificationRules", "getAlarmConfig", "query", input),
|
|
64347
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),
|
|
64348
64444
|
getAlarmSensors: (input) => dispatch("notificationRules", "getAlarmSensors", "query", input)
|
|
64349
64445
|
},
|
|
64350
64446
|
osdManager: {
|
|
@@ -66659,6 +66755,203 @@ function alarmPatchLanded(patch, returned) {
|
|
|
66659
66755
|
return true;
|
|
66660
66756
|
}
|
|
66661
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
|
|
66662
66955
|
//#region src/notification/sensor-raised.ts
|
|
66663
66956
|
/**
|
|
66664
66957
|
* WHICH WAY A BOOLEAN SENSOR MOVED — read off the one slice a sensor event
|
|
@@ -71295,11 +71588,14 @@ exports.NAVIGATION_ACTION_CATALOG = NAVIGATION_ACTION_CATALOG;
|
|
|
71295
71588
|
exports.NAVIGATION_LIGHT_LEVEL_MAX = NAVIGATION_LIGHT_LEVEL_MAX;
|
|
71296
71589
|
exports.NAVIGATION_LIGHT_LEVEL_MIN = NAVIGATION_LIGHT_LEVEL_MIN;
|
|
71297
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;
|
|
71298
71593
|
exports.NC_ALARM_DELAY_FIELDS = NC_ALARM_DELAY_FIELDS;
|
|
71299
71594
|
exports.NC_ALARM_DELAY_MAX_SEC = NC_ALARM_DELAY_MAX_SEC;
|
|
71300
71595
|
exports.NC_ALARM_NONBLOCKING_MAX = NC_ALARM_NONBLOCKING_MAX;
|
|
71301
71596
|
exports.NC_ALARM_OPENING_EVENT_KINDS = NC_ALARM_OPENING_EVENT_KINDS;
|
|
71302
71597
|
exports.NC_ALARM_SENSORS_MAX = NC_ALARM_SENSORS_MAX;
|
|
71598
|
+
exports.NC_ALARM_SYSTEM_DEFAULT_DELAYS = NC_ALARM_SYSTEM_DEFAULT_DELAYS;
|
|
71303
71599
|
exports.NC_ALARM_SYSTEM_EVENT_KINDS = NC_ALARM_SYSTEM_EVENT_KINDS;
|
|
71304
71600
|
exports.NC_ALARM_TRIGGERED_MAX_SEC = NC_ALARM_TRIGGERED_MAX_SEC;
|
|
71305
71601
|
exports.NC_AUDIO_CONFIRM_HITS_DEFAULT = NC_AUDIO_CONFIRM_HITS_DEFAULT;
|
|
@@ -71394,12 +71690,17 @@ exports.NavigationStatusSchema = NavigationStatusSchema;
|
|
|
71394
71690
|
exports.NcAlarmBlockingEditSchema = NcAlarmBlockingEditSchema;
|
|
71395
71691
|
exports.NcAlarmBlockingSchema = NcAlarmBlockingSchema;
|
|
71396
71692
|
exports.NcAlarmConfigSchema = NcAlarmConfigSchema;
|
|
71693
|
+
exports.NcAlarmCreateProfileInputSchema = NcAlarmCreateProfileInputSchema;
|
|
71397
71694
|
exports.NcAlarmModeCoverageSchema = NcAlarmModeCoverageSchema;
|
|
71398
71695
|
exports.NcAlarmModeDelaysEditSchema = NcAlarmModeDelaysEditSchema;
|
|
71399
71696
|
exports.NcAlarmModeDelaysSchema = NcAlarmModeDelaysSchema;
|
|
71400
71697
|
exports.NcAlarmModeDeviceListSchema = NcAlarmModeDeviceListSchema;
|
|
71401
71698
|
exports.NcAlarmNonBlockingEditSchema = NcAlarmNonBlockingEditSchema;
|
|
71402
71699
|
exports.NcAlarmNonBlockingSchema = NcAlarmNonBlockingSchema;
|
|
71700
|
+
exports.NcAlarmProfileIdInputSchema = NcAlarmProfileIdInputSchema;
|
|
71701
|
+
exports.NcAlarmProfileMetaSchema = NcAlarmProfileMetaSchema;
|
|
71702
|
+
exports.NcAlarmProfilesViewSchema = NcAlarmProfilesViewSchema;
|
|
71703
|
+
exports.NcAlarmRenameProfileInputSchema = NcAlarmRenameProfileInputSchema;
|
|
71403
71704
|
exports.NcAlarmSecureOnArmEditSchema = NcAlarmSecureOnArmEditSchema;
|
|
71404
71705
|
exports.NcAlarmSecureOnArmOffSchema = NcAlarmSecureOnArmOffSchema;
|
|
71405
71706
|
exports.NcAlarmSensorReadingSchema = NcAlarmSensorReadingSchema;
|
|
@@ -71974,6 +72275,7 @@ exports.ZoneScopeBreakdownSchema = ZoneScopeBreakdownSchema;
|
|
|
71974
72275
|
exports.__resetLogChannelRegistryForTests = __resetLogChannelRegistryForTests;
|
|
71975
72276
|
exports.accessoriesCapability = accessoriesCapability;
|
|
71976
72277
|
exports.accessoryStableId = accessoryStableId;
|
|
72278
|
+
exports.activateAlarmProfile = activateAlarmProfile;
|
|
71977
72279
|
exports.addonPagesCapability = addonPagesCapability;
|
|
71978
72280
|
exports.addonPagesSourceCapability = addonPagesSourceCapability;
|
|
71979
72281
|
exports.addonRoutesCapability = addonRoutesCapability;
|
|
@@ -71987,6 +72289,7 @@ exports.alarmDeviceBlocksArming = alarmDeviceBlocksArming;
|
|
|
71987
72289
|
exports.alarmDeviceSecureOnArm = alarmDeviceSecureOnArm;
|
|
71988
72290
|
exports.alarmPanelCapability = alarmPanelCapability;
|
|
71989
72291
|
exports.alarmPatchLanded = alarmPatchLanded;
|
|
72292
|
+
exports.alarmProfileById = alarmProfileById;
|
|
71990
72293
|
exports.alertsCapability = alertsCapability;
|
|
71991
72294
|
exports.ambientLightSensorCapability = ambientLightSensorCapability;
|
|
71992
72295
|
exports.applyBlockingEdit = applyBlockingEdit;
|
|
@@ -72057,6 +72360,7 @@ exports.climateControlCapability = climateControlCapability;
|
|
|
72057
72360
|
exports.clipExportFailure = clipExportFailure;
|
|
72058
72361
|
exports.clipExportFailureOf = clipExportFailureOf;
|
|
72059
72362
|
exports.clipReasonHeaderValue = clipReasonHeaderValue;
|
|
72363
|
+
exports.cloneAlarmSettings = cloneAlarmSettings;
|
|
72060
72364
|
exports.cloneStatefulExpressionMemory = require_composition.cloneStatefulExpressionMemory;
|
|
72061
72365
|
exports.clusterModelSettingKey = clusterModelSettingKey;
|
|
72062
72366
|
exports.clusterStepSettingFieldsFor = clusterStepSettingFieldsFor;
|
|
@@ -72102,6 +72406,7 @@ exports.coreBlocksCapability = coreBlocksCapability;
|
|
|
72102
72406
|
exports.cosineSimilarity = cosineSimilarity;
|
|
72103
72407
|
exports.countConditionLeaves = countConditionLeaves;
|
|
72104
72408
|
exports.coverCapability = coverCapability;
|
|
72409
|
+
exports.createAlarmProfile = createAlarmProfile;
|
|
72105
72410
|
exports.createDeviceExtensionProvider = createDeviceExtensionProvider;
|
|
72106
72411
|
exports.createDeviceProxy = require_sleep.createDeviceProxy;
|
|
72107
72412
|
exports.createDurableState = require_sleep.createDurableState;
|
|
@@ -72130,6 +72435,7 @@ exports.defaultDeliveryForSection = defaultDeliveryForSection;
|
|
|
72130
72435
|
exports.defaultDeviceFor = defaultDeviceFor;
|
|
72131
72436
|
exports.defineCustomActions = require_sleep.defineCustomActions;
|
|
72132
72437
|
exports.defineExtensionSlotProvider = defineExtensionSlotProvider;
|
|
72438
|
+
exports.deleteAlarmProfile = deleteAlarmProfile;
|
|
72133
72439
|
exports.deriveBatteryPresence = deriveBatteryPresence;
|
|
72134
72440
|
exports.deriveCameraSwitches = deriveCameraSwitches;
|
|
72135
72441
|
exports.deriveDetailCropRect = deriveDetailCropRect;
|
|
@@ -72178,6 +72484,7 @@ exports.emitReadiness = require_sleep.emitReadiness;
|
|
|
72178
72484
|
exports.emitsCollectionSelector = emitsCollectionSelector;
|
|
72179
72485
|
exports.encodeProfileFromStreamShape = encodeProfileFromStreamShape;
|
|
72180
72486
|
exports.encodeVectorBase64 = encodeVectorBase64;
|
|
72487
|
+
exports.ensureAlarmProfiles = ensureAlarmProfiles;
|
|
72181
72488
|
exports.enumSensorCapability = enumSensorCapability;
|
|
72182
72489
|
exports.enumerateInferenceDevices = enumerateInferenceDevices;
|
|
72183
72490
|
exports.enumerateItemArrayFields = enumerateItemArrayFields;
|
|
@@ -72265,6 +72572,7 @@ exports.isBaseConditionKey = isBaseConditionKey;
|
|
|
72265
72572
|
exports.isBatteryPresenceFault = isBatteryPresenceFault;
|
|
72266
72573
|
exports.isClusterScopedStep = isClusterScopedStep;
|
|
72267
72574
|
exports.isCollectionArrayMethod = isCollectionArrayMethod;
|
|
72575
|
+
exports.isDefaultAlarmProfileId = isDefaultAlarmProfileId;
|
|
72268
72576
|
exports.isDeployableToAgent = isDeployableToAgent;
|
|
72269
72577
|
exports.isDetectionMacroClass = isDetectionMacroClass;
|
|
72270
72578
|
exports.isDeviceConfigCap = require_sleep.isDeviceConfigCap;
|
|
@@ -72355,6 +72663,7 @@ exports.motionZonesCapability = motionZonesCapability;
|
|
|
72355
72663
|
exports.mqttBrokerCapability = mqttBrokerCapability;
|
|
72356
72664
|
exports.nativeObjectDetectionCapability = nativeObjectDetectionCapability;
|
|
72357
72665
|
exports.navigationCapability = navigationCapability;
|
|
72666
|
+
exports.ncAlarmSystemDefaultSettings = ncAlarmSystemDefaultSettings;
|
|
72358
72667
|
exports.networkAccessCapability = networkAccessCapability;
|
|
72359
72668
|
exports.networkLinkCapability = networkLinkCapability;
|
|
72360
72669
|
exports.networkQualityCapability = networkQualityCapability;
|
|
@@ -72446,6 +72755,7 @@ exports.recordingOnboardCapability = recordingOnboardCapability;
|
|
|
72446
72755
|
exports.recordingSignalCapability = recordingSignalCapability;
|
|
72447
72756
|
exports.rectsToCells = rectsToCells;
|
|
72448
72757
|
exports.reducePoints = reducePoints;
|
|
72758
|
+
exports.renameAlarmProfile = renameAlarmProfile;
|
|
72449
72759
|
exports.replacedFieldKeys = replacedFieldKeys;
|
|
72450
72760
|
exports.requiredTopLevelKeys = requiredTopLevelKeys;
|
|
72451
72761
|
exports.requiresPython = requiresPython;
|
|
@@ -72547,6 +72857,7 @@ exports.summarizeEffectiveScope = summarizeEffectiveScope;
|
|
|
72547
72857
|
exports.supportedRuntimes = supportedRuntimes;
|
|
72548
72858
|
exports.switchCapability = switchCapability;
|
|
72549
72859
|
exports.switchedOffIds = switchedOffIds;
|
|
72860
|
+
exports.syncActiveAlarmProfileSettings = syncActiveAlarmProfileSettings;
|
|
72550
72861
|
exports.synthesizeSourceInfo = synthesizeSourceInfo;
|
|
72551
72862
|
exports.systemCapability = systemCapability;
|
|
72552
72863
|
exports.systemEventDeliveryProblems = systemEventDeliveryProblems;
|