@camstack/types 1.2.537 → 1.2.539
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/CHANGELOG.md +14 -0
- package/dist/addon.d.ts +2 -2
- package/dist/addon.js +3 -1
- package/dist/addon.mjs +2 -2
- package/dist/audit/command-origin-claim.d.ts +79 -0
- package/dist/audit/device-transition.d.ts +2 -2
- package/dist/automation/action.d.ts +4 -0
- package/dist/automation/index.d.ts +0 -1
- package/dist/automation/recipe.d.ts +9 -18
- package/dist/automation/step-runner.d.ts +2 -0
- package/dist/capabilities/action-source.cap.d.ts +1 -0
- package/dist/capabilities/actions.cap.d.ts +7 -0
- package/dist/capabilities/index.d.ts +1 -1
- package/dist/capabilities/notification-rules.cap.d.ts +79 -1897
- package/dist/client.js +27 -977
- package/dist/client.mjs +27 -977
- package/dist/generated/addon-api.d.ts +0 -35
- package/dist/generated/system-proxy.d.ts +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +61 -206
- package/dist/index.mjs +56 -198
- package/dist/notification/alarm-membership.d.ts +12 -11
- package/dist/{sleep-DIg2Mx82.js → sleep-DgCXXFc3.js} +64 -9
- package/dist/{sleep-B36hHDDz.mjs → sleep-VrfKAAGN.mjs} +53 -10
- package/package.json +1 -1
- package/dist/automation/nc-action-target.d.ts +0 -21
|
@@ -6385,41 +6385,6 @@ export type AppRouter = TrpcCoreRouter<{
|
|
|
6385
6385
|
output: z.infer<typeof notificationRulesCapability.methods.setRuleEnabled.output>;
|
|
6386
6386
|
meta: object;
|
|
6387
6387
|
}>;
|
|
6388
|
-
listSequences: TRPCQueryProcedure<{
|
|
6389
|
-
input: {
|
|
6390
|
-
[x: string]: unknown;
|
|
6391
|
-
} & z.input<typeof notificationRulesCapability.methods.listSequences.input>;
|
|
6392
|
-
output: z.infer<typeof notificationRulesCapability.methods.listSequences.output>;
|
|
6393
|
-
meta: object;
|
|
6394
|
-
}>;
|
|
6395
|
-
getSequence: TRPCQueryProcedure<{
|
|
6396
|
-
input: {
|
|
6397
|
-
[x: string]: unknown;
|
|
6398
|
-
} & z.input<typeof notificationRulesCapability.methods.getSequence.input>;
|
|
6399
|
-
output: z.infer<typeof notificationRulesCapability.methods.getSequence.output>;
|
|
6400
|
-
meta: object;
|
|
6401
|
-
}>;
|
|
6402
|
-
createSequence: TRPCMutationProcedure<{
|
|
6403
|
-
input: {
|
|
6404
|
-
[x: string]: unknown;
|
|
6405
|
-
} & z.input<typeof notificationRulesCapability.methods.createSequence.input>;
|
|
6406
|
-
output: z.infer<typeof notificationRulesCapability.methods.createSequence.output>;
|
|
6407
|
-
meta: object;
|
|
6408
|
-
}>;
|
|
6409
|
-
updateSequence: TRPCMutationProcedure<{
|
|
6410
|
-
input: {
|
|
6411
|
-
[x: string]: unknown;
|
|
6412
|
-
} & z.input<typeof notificationRulesCapability.methods.updateSequence.input>;
|
|
6413
|
-
output: z.infer<typeof notificationRulesCapability.methods.updateSequence.output>;
|
|
6414
|
-
meta: object;
|
|
6415
|
-
}>;
|
|
6416
|
-
deleteSequence: TRPCMutationProcedure<{
|
|
6417
|
-
input: {
|
|
6418
|
-
[x: string]: unknown;
|
|
6419
|
-
} & z.input<typeof notificationRulesCapability.methods.deleteSequence.input>;
|
|
6420
|
-
output: z.infer<typeof notificationRulesCapability.methods.deleteSequence.output>;
|
|
6421
|
-
meta: object;
|
|
6422
|
-
}>;
|
|
6423
6388
|
getClipRetentionAsks: TRPCQueryProcedure<{
|
|
6424
6389
|
input: {
|
|
6425
6390
|
[x: string]: unknown;
|
|
@@ -110,7 +110,7 @@ export interface SystemProxy {
|
|
|
110
110
|
readonly networkQuality: Pick<InferProvider<typeof networkQualityCapability>, 'getAllStats'>;
|
|
111
111
|
readonly nodes: Pick<InferProvider<typeof nodesCapability>, 'topology' | 'directory' | 'deployAddon' | 'undeployAddon' | 'restartAddon' | 'restartProcess' | 'restartNode' | 'shutdownNode' | 'renameNode' | 'clusterAddonStatus' | 'getCapUsageGraph' | 'getNodeAddons' | 'setProcessLogLevel' | 'executeQuery'>;
|
|
112
112
|
readonly notificationOutput: Pick<InferProvider<typeof notificationOutputCapability>, 'listTargetKinds' | 'discoverTargets' | 'probeTargetConfig' | 'send' | 'testTarget'>;
|
|
113
|
-
readonly notificationRules: Pick<InferProvider<typeof notificationRulesCapability>, 'listRules' | 'getRule' | 'createRule' | 'updateRule' | 'deleteRule' | 'setRuleEnabled' | '
|
|
113
|
+
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'>;
|
|
114
114
|
readonly osdManager: Pick<InferProvider<typeof osdManagerCapability>, 'getConditionSupport' | 'copyDeviceConfiguration' | 'listTemplates' | 'upsertTemplate' | 'deleteTemplate'>;
|
|
115
115
|
readonly pipelineExecutor: Pick<InferProvider<typeof pipelineExecutorCapability>, 'getAvailableEngines' | 'getSelectedEngine' | 'getEngineProvisioning' | 'getVideoPipelineSteps' | 'setVideoPipelineSteps' | 'getInferenceDeviceHealth' | 'rearmInferenceDevice' | 'getSchema' | 'getOrchestratorConfigSchema' | 'validatePipeline' | 'getCapabilities' | 'getAddonModels' | 'downloadModel' | 'deleteModel' | 'cacheFrameInPool' | 'inferCached' | 'uncacheFrame' | 'getEffectiveTuning' | 'listLoadedEngines' | 'spinEngine' | 'killEngine' | 'listReferenceImages' | 'getReferenceImage' | 'getReferenceAudioFiles' | 'getReferenceAudio' | 'getAudioCapabilities' | 'runAudioTest' | 'getDetectionConfigSchema'>;
|
|
116
116
|
readonly pipelineOrchestrator: Pick<InferProvider<typeof pipelineOrchestratorCapability>, 'requestOccupancyLook' | 'pauseForStorageMigration' | 'resumeForStorageMigration' | 'rebalance' | 'getPipelineAssignments' | 'getAgentLoad' | 'getClusterModelChoice' | 'getGlobalMetrics' | 'getCapabilityBindings' | 'setCapabilityBinding' | 'getIngestOwner' | 'getAudioNodeLoad' | 'getAudioAssignments' | 'getAgentSettings' | 'listAgentSettings' | 'removeAgentSettings' | 'setAgentMaxCameras' | 'setAgentCapabilities' | 'setAgentDecodeLimits' | 'setAgentReachableHost' | 'setAgentInferenceDevices' | 'setNodeStepSettings' | 'getNodeInferenceDevices' | 'forgetInferenceDevice' | 'resetNodePipelineDefaults' | 'planAutoTune' | 'applyAutoTune' | 'setLoadBalancingShares' | 'getPlacementStats' | 'suggestShares' | 'getEffectiveShares' | 'setShareSource' | 'getNodeBenchmarkPreflight' | 'startNodeBenchmark' | 'getNodeBenchmarkStatus' | 'abortNodeBenchmark' | 'getNodeBenchmarkCandidates' | 'listNodeBenchmarkResults' | 'deleteNodeBenchmarkResult' | 'getCameraStatuses' | 'setCameraSensors' | 'reconcileFromDisk' | 'getReconcileFromDiskStatus'>;
|
package/dist/index.d.ts
CHANGED
|
@@ -198,7 +198,6 @@ export type { PreparedRecipe, UnitResolver, UnitWarning, UnitsNormalized, } from
|
|
|
198
198
|
export * from './automation/action.js';
|
|
199
199
|
export * from './automation/action-target.js';
|
|
200
200
|
export * from './automation/scheduler.js';
|
|
201
|
-
export * from './automation/nc-action-target.js';
|
|
202
201
|
export * from './automation/step-condition.js';
|
|
203
202
|
export * from './automation/step-runner.js';
|
|
204
203
|
export * from './automation/export-entities.js';
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_sleep = require("./sleep-
|
|
2
|
+
const require_sleep = require("./sleep-DgCXXFc3.js");
|
|
3
3
|
const require_event_category = require("./event-category-BC4RRerT.js");
|
|
4
4
|
const require_composed_stable_id = require("./composed-stable-id-C3J6LxC9.js");
|
|
5
5
|
const require_composition = require("./composition-BcVAbtBc.js");
|
|
@@ -32888,30 +32888,21 @@ function convertLegacyWhen(half) {
|
|
|
32888
32888
|
* (instants) and state leaves (durations). It replaces the flat trigger list
|
|
32889
32889
|
* plus the separate condition tree; the firing rule is in that file and in
|
|
32890
32890
|
* ADR "one tree".
|
|
32891
|
-
* - **Actions** — `
|
|
32892
|
-
* fragment of §3.2.2. See {@link AutomationActionSchema}
|
|
32893
|
-
* this had to diverge from "verbatim", and why.
|
|
32891
|
+
* - **Actions** — the `wait` and `cap` steps, plus the `{kind:'code'}`
|
|
32892
|
+
* fragment of §3.2.2. See {@link AutomationActionSchema}.
|
|
32894
32893
|
*
|
|
32895
32894
|
* A recipe stored in the old shape (`triggers` + `conditions`) still LOADS:
|
|
32896
32895
|
* {@link AutomationRecipeSchema} (the parse-anywhere schema) converts it on parse. Nothing writes it.
|
|
32897
32896
|
*/
|
|
32898
32897
|
/**
|
|
32899
|
-
* One action step.
|
|
32898
|
+
* One action step: `wait`, or a `cap` call.
|
|
32900
32899
|
*
|
|
32901
|
-
*
|
|
32902
|
-
*
|
|
32903
|
-
*
|
|
32904
|
-
*
|
|
32905
|
-
*
|
|
32906
|
-
*
|
|
32907
|
-
* a literal `z.number().int()`, and the NC runner's own `RunSequencesInput`
|
|
32908
|
-
* documents its subject device as *"for the log tag, never for routing"*. So an
|
|
32909
|
-
* NC action can never target the device that triggered it — which is fine for
|
|
32910
|
-
* the NC (its rules already scope to a device) and fatal for an automation
|
|
32911
|
-
* ("sound the siren of the camera that saw the person"). `deviceId` therefore
|
|
32912
|
-
* also accepts `{ $var }`, resolved from the run's `vars` bag BEFORE the runner
|
|
32913
|
-
* is called. The runner still receives a number and is untouched; the
|
|
32914
|
-
* resolution is the recipe's job, not the runner's.
|
|
32900
|
+
* A cap step's target is who it acts on (D983: `devices`, a `domain`, or a
|
|
32901
|
+
* `{ $var }` resolved from the run's variables); the legacy `deviceId` is still
|
|
32902
|
+
* READ, never written. The step runner (`runSteps`) owns the device-scope
|
|
32903
|
+
* check, the stop-at-first-failure and the variable substitution, once, for
|
|
32904
|
+
* every caller — automations, Actions, and the notification centre, which runs
|
|
32905
|
+
* only Actions (planning#473).
|
|
32915
32906
|
*/
|
|
32916
32907
|
var AutomationWaitStepSchema = zod.z.object({
|
|
32917
32908
|
kind: zod.z.literal("wait"),
|
|
@@ -35571,6 +35562,8 @@ var IDLE_ACTION_STATUS = {
|
|
|
35571
35562
|
lastRunAt: null,
|
|
35572
35563
|
lastError: null
|
|
35573
35564
|
};
|
|
35565
|
+
/** The throttle window of an action, in seconds; absent or 0 = no throttle. */
|
|
35566
|
+
var ActionMinDelaySecSchema = zod.z.number().int().min(0).max(86400);
|
|
35574
35567
|
var ActionEntrySchema = zod.z.object({
|
|
35575
35568
|
/** `internal:<uuid>` or `<addonId>:<localId>`. */
|
|
35576
35569
|
id: zod.z.string().min(3),
|
|
@@ -35583,6 +35576,14 @@ var ActionEntrySchema = zod.z.object({
|
|
|
35583
35576
|
/** Internal only: cap and wait steps. No action-in-action, so no cycles. */
|
|
35584
35577
|
steps: zod.z.array(ActionStepSchema).min(1).max(50).optional(),
|
|
35585
35578
|
variables: zod.z.array(ActionVariableSchema).max(20).optional(),
|
|
35579
|
+
/**
|
|
35580
|
+
* Internal only: the least time between two run STARTS. A run that begins
|
|
35581
|
+
* inside the window is skipped (`skipped-cooldown`), traced and logged. It
|
|
35582
|
+
* is an actuator's budget — "how often may this gate physically open" —
|
|
35583
|
+
* not a notification cooldown, and it is shared by every caller of the
|
|
35584
|
+
* action (two rules, a button, an automation).
|
|
35585
|
+
*/
|
|
35586
|
+
minDelaySec: ActionMinDelaySecSchema.optional(),
|
|
35586
35587
|
status: ActionStatusSchema
|
|
35587
35588
|
}).superRefine((entry, ctx) => {
|
|
35588
35589
|
if (entry.source === "internal") {
|
|
@@ -35613,7 +35614,8 @@ var ActionEntrySchema = zod.z.object({
|
|
|
35613
35614
|
var ActionInputSchema = zod.z.object({
|
|
35614
35615
|
name: zod.z.string().min(1).max(120),
|
|
35615
35616
|
steps: zod.z.array(ActionStepSchema).min(1).max(50),
|
|
35616
|
-
variables: zod.z.array(ActionVariableSchema).max(20).optional()
|
|
35617
|
+
variables: zod.z.array(ActionVariableSchema).max(20).optional(),
|
|
35618
|
+
minDelaySec: ActionMinDelaySecSchema.optional()
|
|
35617
35619
|
});
|
|
35618
35620
|
/** Who started a run. Absent = the operator pressed it. */
|
|
35619
35621
|
var ActionRunOriginSchema = zod.z.object({
|
|
@@ -35666,30 +35668,6 @@ var ActionRunChangedSchema = zod.z.object({
|
|
|
35666
35668
|
lastError: zod.z.string().nullable()
|
|
35667
35669
|
});
|
|
35668
35670
|
//#endregion
|
|
35669
|
-
//#region src/automation/nc-action-target.ts
|
|
35670
|
-
function normalizeNcCapTarget(action) {
|
|
35671
|
-
const target = action.target ?? (action.deviceId === void 0 ? void 0 : {
|
|
35672
|
-
kind: "devices",
|
|
35673
|
-
ids: [action.deviceId]
|
|
35674
|
-
});
|
|
35675
|
-
if (target === void 0) throw new Error(`rule action ${action.cap}.${action.method} has no target`);
|
|
35676
|
-
return {
|
|
35677
|
-
target,
|
|
35678
|
-
actionId: action.actionId ?? (action.deviceId === void 0 ? void 0 : require_sleep.vocabActionIdFor(action.cap, action.method, action.args))
|
|
35679
|
-
};
|
|
35680
|
-
}
|
|
35681
|
-
/** The step as it is stored from now on: `target` (and `actionId`) set, no `deviceId`. */
|
|
35682
|
-
function normalizeNcAction(action) {
|
|
35683
|
-
if (action.kind !== "cap") return action;
|
|
35684
|
-
const { deviceId: _legacy, target: _target, actionId: _actionId, ...rest } = action;
|
|
35685
|
-
const { target, actionId } = normalizeNcCapTarget(action);
|
|
35686
|
-
return {
|
|
35687
|
-
...rest,
|
|
35688
|
-
...actionId === void 0 ? {} : { actionId },
|
|
35689
|
-
target
|
|
35690
|
-
};
|
|
35691
|
-
}
|
|
35692
|
-
//#endregion
|
|
35693
35671
|
//#region src/automation/step-condition.ts
|
|
35694
35672
|
/**
|
|
35695
35673
|
* The guard of a conditional step (#472): the step's `if` is the ONE `when`
|
|
@@ -35927,6 +35905,10 @@ function newSlotNonce() {
|
|
|
35927
35905
|
function slotPattern(nonce) {
|
|
35928
35906
|
return new RegExp(`${VAR_SLOT_OPEN}${nonce}:([A-Za-z_][A-Za-z0-9_]*)${VAR_SLOT_CLOSE}`, "g");
|
|
35929
35907
|
}
|
|
35908
|
+
/** `text` with every `{{vars.x}}` slot (the only slot the run-time holds) replaced by `replacement`. */
|
|
35909
|
+
function holdVarSlots(text, replacement) {
|
|
35910
|
+
return text.replace(TEMPLATE_RE, () => replacement);
|
|
35911
|
+
}
|
|
35930
35912
|
/** True when a string, once its `{{vars.x}}` slots are set aside, still carries template markup. */
|
|
35931
35913
|
function carriesDeviceTemplate(text) {
|
|
35932
35914
|
return TEMPLATE_MARKUP_RE.test(text.replace(TEMPLATE_RE, ""));
|
|
@@ -71795,101 +71777,21 @@ var NcZoneConditionSchema = zod.z.object({
|
|
|
71795
71777
|
* membership lists are OR within the list (spec §2.3).
|
|
71796
71778
|
*/
|
|
71797
71779
|
/**
|
|
71798
|
-
* What a rule
|
|
71780
|
+
* What a rule or a button runs: an **Action** of the `actions` surface
|
|
71781
|
+
* (`internal:<uuid>` or an addon's), by id, and nothing else (planning#473).
|
|
71799
71782
|
*
|
|
71800
|
-
*
|
|
71801
|
-
*
|
|
71802
|
-
*
|
|
71803
|
-
*
|
|
71804
|
-
*
|
|
71805
|
-
*
|
|
71806
|
-
* That is not decoration. A rule can be authored by a NON-ADMIN — personal
|
|
71807
|
-
* rules are a supported flow — and the executor runs with the addon's
|
|
71808
|
-
* privileges, so an unbounded action is an arbitrary RPC channel with a
|
|
71809
|
-
* privilege escalation attached. Restricting to device scope excludes the
|
|
71810
|
-
* system caps (`device-manager.removeDevice` and friends) by construction,
|
|
71811
|
-
* costs nothing to maintain, and cannot rot: a cap that stops being
|
|
71812
|
-
* device-scoped stops being actuatable in the same change.
|
|
71813
|
-
*
|
|
71814
|
-
* The executor enforces it; {@link NcRuleActionSchema} carries the intent.
|
|
71783
|
+
* The notification centre has no step vocabulary of its own. The steps, the
|
|
71784
|
+
* device-scope boundary, the stop-at-first-failure, the throttle
|
|
71785
|
+
* (`minDelaySec`), the variables and the runs ledger all belong to the Action;
|
|
71786
|
+
* an operator edits them in ONE place (the Actions page) and a rule points at
|
|
71787
|
+
* the result. A rule can be authored by a non-admin (personal rules), which is
|
|
71788
|
+
* safe for the same reason: it can only name an Action an admin already wrote.
|
|
71815
71789
|
*/
|
|
71790
|
+
var NcActionIdSchema = zod.z.string().min(1);
|
|
71791
|
+
/** Action ids one hook edge runs, in order. Capped so a slot never becomes a second editor. */
|
|
71792
|
+
var NcHookActionIdsSchema = zod.z.array(NcActionIdSchema).max(4);
|
|
71816
71793
|
/**
|
|
71817
|
-
* One
|
|
71818
|
-
*
|
|
71819
|
-
* `wait` is a first-class step rather than a property of the next action: it is
|
|
71820
|
-
* what makes a sequence a SEQUENCE and not a list — "unlock, wait 5s, open"
|
|
71821
|
-
* cannot be expressed otherwise.
|
|
71822
|
-
*/
|
|
71823
|
-
var NcRuleActionSchema = zod.z.discriminatedUnion("kind", [zod.z.object({
|
|
71824
|
-
kind: zod.z.literal("wait"),
|
|
71825
|
-
seconds: zod.z.number().min(0).max(300)
|
|
71826
|
-
}), zod.z.object({
|
|
71827
|
-
kind: zod.z.literal("cap"),
|
|
71828
|
-
/**
|
|
71829
|
-
* WHO the step acts on (D983) — the only shape that is written. A sequence
|
|
71830
|
-
* stored before D983 carries `deviceId`; the sequence store reads it as a
|
|
71831
|
-
* `devices` target.
|
|
71832
|
-
*/
|
|
71833
|
-
target: ActionTargetSchema.optional(),
|
|
71834
|
-
/** The vocabulary action the step performs; required for a `domain` target. */
|
|
71835
|
-
actionId: zod.z.string().min(1).optional(),
|
|
71836
|
-
/** @deprecated The pre-D983 single device. Read, never written. */
|
|
71837
|
-
deviceId: zod.z.number().int().optional(),
|
|
71838
|
-
/** Capability name, e.g. `alarm-panel`. */
|
|
71839
|
-
cap: zod.z.string().min(1),
|
|
71840
|
-
/** Method on it. The executor refuses a non-device-scoped cap. */
|
|
71841
|
-
method: zod.z.string().min(1),
|
|
71842
|
-
/** Method arguments, minus `deviceId` (the executor injects it). */
|
|
71843
|
-
args: zod.z.record(zod.z.string(), zod.z.unknown()).optional()
|
|
71844
|
-
}).refine((step) => step.target !== void 0 || step.deviceId !== void 0, {
|
|
71845
|
-
message: "a cap step needs a target",
|
|
71846
|
-
path: ["target"]
|
|
71847
|
-
}).refine((step) => step.target?.kind !== "domain" || step.actionId !== void 0, {
|
|
71848
|
-
message: "a domain target needs the vocabulary action it applies to (actionId)",
|
|
71849
|
-
path: ["actionId"]
|
|
71850
|
-
})]);
|
|
71851
|
-
/**
|
|
71852
|
-
* A named, ordered run of steps shared across rules, with its own throttle.
|
|
71853
|
-
*
|
|
71854
|
-
* Sequences live in the notification centre's sequence store — never inline on
|
|
71855
|
-
* a rule. A rule binds to one by id ({@link NcActionBindingSchema}), and a
|
|
71856
|
-
* button names one the same way. `minDelaySec` exists because a noisy rule
|
|
71857
|
-
* otherwise hammers a physical actuator — the rule's own cooldown governs
|
|
71858
|
-
* NOTIFICATIONS, which is a different budget from "how often may this gate
|
|
71859
|
-
* actually open". The throttle key is the sequence id, so two rules sharing
|
|
71860
|
-
* one sequence share its budget.
|
|
71861
|
-
*/
|
|
71862
|
-
var NcSharedSequenceSchema = zod.z.object({
|
|
71863
|
-
id: zod.z.string().min(1),
|
|
71864
|
-
name: zod.z.string().min(1).max(120),
|
|
71865
|
-
minDelaySec: zod.z.number().int().min(0).max(86400).optional(),
|
|
71866
|
-
actions: zod.z.array(NcRuleActionSchema).min(1)
|
|
71867
|
-
});
|
|
71868
|
-
/** Create / update body — the id is minted by the provider. */
|
|
71869
|
-
var NcSharedSequenceInputSchema = zod.z.object({
|
|
71870
|
-
name: zod.z.string().min(1).max(120),
|
|
71871
|
-
minDelaySec: zod.z.number().int().min(0).max(86400).optional(),
|
|
71872
|
-
actions: zod.z.array(NcRuleActionSchema).min(1)
|
|
71873
|
-
});
|
|
71874
|
-
/**
|
|
71875
|
-
* What one hook slot may run: a shared sequence, or a single step authored
|
|
71876
|
-
* inline ("Do").
|
|
71877
|
-
*
|
|
71878
|
-
* A button may ONLY name a sequence — a one-shot Do on a public callback would
|
|
71879
|
-
* be a parallel actuation vocabulary with no throttle and no shared authoring
|
|
71880
|
-
* surface.
|
|
71881
|
-
*/
|
|
71882
|
-
var NcActionBindingSchema = zod.z.discriminatedUnion("kind", [zod.z.object({
|
|
71883
|
-
kind: zod.z.literal("sequence"),
|
|
71884
|
-
sequenceId: zod.z.string().min(1)
|
|
71885
|
-
}), zod.z.object({
|
|
71886
|
-
kind: zod.z.literal("do"),
|
|
71887
|
-
action: NcRuleActionSchema
|
|
71888
|
-
})]);
|
|
71889
|
-
/** Bindings on one hook edge. Cap keeps a slot from becoming a second sequence editor. */
|
|
71890
|
-
var NcHookBindingsSchema = zod.z.array(NcActionBindingSchema).max(4);
|
|
71891
|
-
/**
|
|
71892
|
-
* One button carried by the notification, running a shared sequence on tap.
|
|
71794
|
+
* One button carried by the notification, running an Action on tap.
|
|
71893
71795
|
*
|
|
71894
71796
|
* **Read this before adding a button that does something physical.** The tap
|
|
71895
71797
|
* arrives over a link that travelled through third-party infrastructure — ntfy,
|
|
@@ -71904,9 +71806,9 @@ var NcRuleNotificationButtonSchema = zod.z.object({
|
|
|
71904
71806
|
/** Stable id — travels in the callback and identifies the button in logs. */
|
|
71905
71807
|
id: zod.z.string().min(1).max(64),
|
|
71906
71808
|
label: zod.z.string().min(1).max(40),
|
|
71907
|
-
/**
|
|
71908
|
-
*
|
|
71909
|
-
|
|
71809
|
+
/** The Action the tap runs. The dispatcher drops a button whose Action does
|
|
71810
|
+
* not exist rather than minting a token for nothing. */
|
|
71811
|
+
actionId: NcActionIdSchema,
|
|
71910
71812
|
icon: NotificationActionIconSchema.optional(),
|
|
71911
71813
|
destructive: zod.z.boolean().optional()
|
|
71912
71814
|
});
|
|
@@ -71921,33 +71823,20 @@ var NcRuleNotificationButtonSchema = zod.z.object({
|
|
|
71921
71823
|
* leave). A delivery with no clear edge never produces this hook.
|
|
71922
71824
|
*/
|
|
71923
71825
|
var NcRuleActionsSchema = zod.z.object({
|
|
71924
|
-
onActivation:
|
|
71925
|
-
onDeactivation:
|
|
71826
|
+
onActivation: NcHookActionIdsSchema.optional(),
|
|
71827
|
+
onDeactivation: NcHookActionIdsSchema.optional(),
|
|
71926
71828
|
/** Runs on a positive / raised match. */
|
|
71927
|
-
onTrigger:
|
|
71829
|
+
onTrigger: NcHookActionIdsSchema.optional(),
|
|
71928
71830
|
/** Runs on a clear / leave match, when the subject carries one. */
|
|
71929
|
-
onTriggerOff:
|
|
71831
|
+
onTriggerOff: NcHookActionIdsSchema.optional(),
|
|
71930
71832
|
/**
|
|
71931
|
-
* Buttons the NOTIFICATION carries, each running one
|
|
71932
|
-
*
|
|
71933
|
-
*
|
|
71833
|
+
* Buttons the NOTIFICATION carries, each running one Action when tapped.
|
|
71834
|
+
* Deliberately a REFERENCE — a button that could define its own steps would
|
|
71835
|
+
* be a parallel actuation vocabulary.
|
|
71934
71836
|
*/
|
|
71935
71837
|
buttons: zod.z.array(NcRuleNotificationButtonSchema).max(8).optional()
|
|
71936
71838
|
});
|
|
71937
71839
|
/**
|
|
71938
|
-
* @deprecated Legacy inline sequence shape (pre shared-sequence store). Kept
|
|
71939
|
-
* only so boot migration / tests can recognise and rewrite persisted rows.
|
|
71940
|
-
* New code must use {@link NcSharedSequence} + {@link NcActionBinding}.
|
|
71941
|
-
*/
|
|
71942
|
-
var NcLegacyRuleActionSequenceSchema = zod.z.object({
|
|
71943
|
-
name: zod.z.string().min(1).max(120),
|
|
71944
|
-
enabled: zod.z.boolean(),
|
|
71945
|
-
minDelaySec: zod.z.number().int().min(0).max(86400).optional(),
|
|
71946
|
-
actions: zod.z.array(NcRuleActionSchema).min(1)
|
|
71947
|
-
});
|
|
71948
|
-
/** @deprecated Alias kept for call sites mid-migration; prefer {@link NcSharedSequence}. */
|
|
71949
|
-
var NcRuleActionSequenceSchema = NcLegacyRuleActionSequenceSchema;
|
|
71950
|
-
/**
|
|
71951
71840
|
* "This rule applies only while `deviceId` is in one of `states`."
|
|
71952
71841
|
*
|
|
71953
71842
|
* The states are the DEVICE's own vocabulary — `AlarmState` for a panel,
|
|
@@ -74353,28 +74242,6 @@ var notificationRulesCapability = {
|
|
|
74353
74242
|
auth: "admin"
|
|
74354
74243
|
}),
|
|
74355
74244
|
/**
|
|
74356
|
-
* Shared action sequences — named step lists rules and buttons bind to by
|
|
74357
|
-
* id. One store for the whole notification centre so two rules sharing a
|
|
74358
|
-
* gate share its throttle too.
|
|
74359
|
-
*/
|
|
74360
|
-
listSequences: require_sleep.method(zod.z.object({}), zod.z.object({ sequences: zod.z.array(NcSharedSequenceSchema) }), { auth: "admin" }),
|
|
74361
|
-
getSequence: require_sleep.method(zod.z.object({ sequenceId: zod.z.string().min(1) }), zod.z.object({ sequence: NcSharedSequenceSchema.nullable() }), { auth: "admin" }),
|
|
74362
|
-
createSequence: require_sleep.method(zod.z.object({ sequence: NcSharedSequenceInputSchema }), zod.z.object({ sequence: NcSharedSequenceSchema }), {
|
|
74363
|
-
kind: "mutation",
|
|
74364
|
-
auth: "admin"
|
|
74365
|
-
}),
|
|
74366
|
-
updateSequence: require_sleep.method(zod.z.object({
|
|
74367
|
-
sequenceId: zod.z.string().min(1),
|
|
74368
|
-
sequence: NcSharedSequenceInputSchema
|
|
74369
|
-
}), zod.z.object({ sequence: NcSharedSequenceSchema }), {
|
|
74370
|
-
kind: "mutation",
|
|
74371
|
-
auth: "admin"
|
|
74372
|
-
}),
|
|
74373
|
-
deleteSequence: require_sleep.method(zod.z.object({ sequenceId: zod.z.string().min(1) }), zod.z.object({ success: zod.z.literal(true) }), {
|
|
74374
|
-
kind: "mutation",
|
|
74375
|
-
auth: "admin"
|
|
74376
|
-
}),
|
|
74377
|
-
/**
|
|
74378
74245
|
* WHAT THE RULES ACTUALLY ASK the stream broker to retain, per camera.
|
|
74379
74246
|
*
|
|
74380
74247
|
* The notification centre owns the rules, so it is the only thing that can
|
|
@@ -122942,11 +122809,6 @@ function createSystemProxy(api) {
|
|
|
122942
122809
|
updateRule: (input) => dispatch("notificationRules", "updateRule", "mutation", input),
|
|
122943
122810
|
deleteRule: (input) => dispatch("notificationRules", "deleteRule", "mutation", input),
|
|
122944
122811
|
setRuleEnabled: (input) => dispatch("notificationRules", "setRuleEnabled", "mutation", input),
|
|
122945
|
-
listSequences: (input) => dispatch("notificationRules", "listSequences", "query", input),
|
|
122946
|
-
getSequence: (input) => dispatch("notificationRules", "getSequence", "query", input),
|
|
122947
|
-
createSequence: (input) => dispatch("notificationRules", "createSequence", "mutation", input),
|
|
122948
|
-
updateSequence: (input) => dispatch("notificationRules", "updateSequence", "mutation", input),
|
|
122949
|
-
deleteSequence: (input) => dispatch("notificationRules", "deleteSequence", "mutation", input),
|
|
122950
122812
|
getClipRetentionAsks: (input) => dispatch("notificationRules", "getClipRetentionAsks", "query", input),
|
|
122951
122813
|
listDeviceMutes: (input) => dispatch("notificationRules", "listDeviceMutes", "query", input),
|
|
122952
122814
|
testRule: (input) => dispatch("notificationRules", "testRule", "mutation", input),
|
|
@@ -125518,12 +125380,8 @@ var NC_ALARM_CONTROLLABLE_CAPS = [
|
|
|
125518
125380
|
function isAlarmControllableCap(cap) {
|
|
125519
125381
|
return NC_ALARM_CONTROLLABLE_CAPS.includes(cap);
|
|
125520
125382
|
}
|
|
125521
|
-
function
|
|
125522
|
-
|
|
125523
|
-
const action = binding.action;
|
|
125524
|
-
return action.kind === "cap" && action.cap === ALARM_PANEL_CAP && action.method === ALARM_PANEL_TRIGGER_METHOD;
|
|
125525
|
-
}
|
|
125526
|
-
const steps = sequenceActionsOf?.(binding.sequenceId);
|
|
125383
|
+
function actionPullsAlarmTrigger(actionId, actionStepsOf) {
|
|
125384
|
+
const steps = actionStepsOf?.(actionId);
|
|
125527
125385
|
if (steps === void 0) return false;
|
|
125528
125386
|
return steps.some((step) => step.kind === "cap" && step.cap === ALARM_PANEL_CAP && step.method === ALARM_PANEL_TRIGGER_METHOD);
|
|
125529
125387
|
}
|
|
@@ -125533,19 +125391,19 @@ function ruleGatedOnArmedState(rule) {
|
|
|
125533
125391
|
}
|
|
125534
125392
|
/**
|
|
125535
125393
|
* A rule belongs to the alarm when its `deviceState` gate names ANY device's
|
|
125536
|
-
* `armed_*` word, or an on-match
|
|
125537
|
-
* (D630). Button-only
|
|
125394
|
+
* `armed_*` word, or an on-match Action pulls the alarm panel's trigger
|
|
125395
|
+
* (D630). Button-only Actions do NOT count — they are not an automatic
|
|
125538
125396
|
* escalation.
|
|
125539
125397
|
*/
|
|
125540
125398
|
function ruleBelongsToAlarm(rule) {
|
|
125541
125399
|
if (ruleGatedOnArmedState(rule)) return true;
|
|
125542
|
-
for (const
|
|
125400
|
+
for (const actionId of rule.actions?.onTrigger ?? []) if (actionPullsAlarmTrigger(actionId, rule.actionStepsOf)) return true;
|
|
125543
125401
|
return false;
|
|
125544
125402
|
}
|
|
125545
125403
|
/**
|
|
125546
125404
|
* A rule gated on `armed_*` auto-triggers the CamStack `alarm-panel` on match
|
|
125547
|
-
* — no `onTrigger`
|
|
125548
|
-
* An explicit `alarm-panel.trigger`
|
|
125405
|
+
* — no `onTrigger` Action required. Sirens are never part of this path.
|
|
125406
|
+
* An explicit `alarm-panel.trigger` step without an armed gate stays
|
|
125549
125407
|
* explicit actuation only ({@link ruleBelongsToAlarm}).
|
|
125550
125408
|
*/
|
|
125551
125409
|
function ruleAutoTriggersAlarm(rule) {
|
|
@@ -135027,6 +134885,7 @@ exports.ActionError = ActionError;
|
|
|
135027
134885
|
exports.ActionErrorCodeSchema = ActionErrorCodeSchema;
|
|
135028
134886
|
exports.ActionInputSchema = ActionInputSchema;
|
|
135029
134887
|
exports.ActionLinksSchema = ActionLinksSchema;
|
|
134888
|
+
exports.ActionMinDelaySecSchema = ActionMinDelaySecSchema;
|
|
135030
134889
|
exports.ActionRunChangedSchema = ActionRunChangedSchema;
|
|
135031
134890
|
exports.ActionRunOriginSchema = ActionRunOriginSchema;
|
|
135032
134891
|
exports.ActionRunOutcomeSchema = ActionRunOutcomeSchema;
|
|
@@ -136379,7 +136238,7 @@ exports.NavigationMoveCommandSchema = NavigationMoveCommandSchema;
|
|
|
136379
136238
|
exports.NavigationPointSchema = NavigationPointSchema;
|
|
136380
136239
|
exports.NavigationRuntimeStateSchema = NavigationRuntimeStateSchema;
|
|
136381
136240
|
exports.NavigationStatusSchema = NavigationStatusSchema;
|
|
136382
|
-
exports.
|
|
136241
|
+
exports.NcActionIdSchema = NcActionIdSchema;
|
|
136383
136242
|
exports.NcAlarmBlockingEditSchema = NcAlarmBlockingEditSchema;
|
|
136384
136243
|
exports.NcAlarmBlockingSchema = NcAlarmBlockingSchema;
|
|
136385
136244
|
exports.NcAlarmConfigSchema = NcAlarmConfigSchema;
|
|
@@ -136420,16 +136279,13 @@ exports.NcHistoryFilterSchema = NcHistoryFilterSchema;
|
|
|
136420
136279
|
exports.NcHistoryRecordKindSchema = NcHistoryRecordKindSchema;
|
|
136421
136280
|
exports.NcHistoryStatusSchema = NcHistoryStatusSchema;
|
|
136422
136281
|
exports.NcHistorySubjectSchema = NcHistorySubjectSchema;
|
|
136423
|
-
exports.
|
|
136424
|
-
exports.NcLegacyRuleActionSequenceSchema = NcLegacyRuleActionSequenceSchema;
|
|
136282
|
+
exports.NcHookActionIdsSchema = NcHookActionIdsSchema;
|
|
136425
136283
|
exports.NcLinkedCameraModeSchema = NcLinkedCameraModeSchema;
|
|
136426
136284
|
exports.NcMediaFrameSchema = NcMediaFrameSchema;
|
|
136427
136285
|
exports.NcMediaImageSchema = NcMediaImageSchema;
|
|
136428
136286
|
exports.NcMediaPolicySchema = NcMediaPolicySchema;
|
|
136429
136287
|
exports.NcOccupancyConditionSchema = NcOccupancyConditionSchema;
|
|
136430
136288
|
exports.NcPlateMatcherSchema = NcPlateMatcherSchema;
|
|
136431
|
-
exports.NcRuleActionSchema = NcRuleActionSchema;
|
|
136432
|
-
exports.NcRuleActionSequenceSchema = NcRuleActionSequenceSchema;
|
|
136433
136289
|
exports.NcRuleActionsSchema = NcRuleActionsSchema;
|
|
136434
136290
|
exports.NcRuleClearableKeySchema = NcRuleClearableKeySchema;
|
|
136435
136291
|
exports.NcRuleInputSchema = NcRuleInputSchema;
|
|
@@ -136445,8 +136301,6 @@ exports.NcSceneConditionSchema = NcSceneConditionSchema;
|
|
|
136445
136301
|
exports.NcScheduleSchema = NcScheduleSchema;
|
|
136446
136302
|
exports.NcScheduleWindowSchema = NcScheduleWindowSchema;
|
|
136447
136303
|
exports.NcSensorTransitionSchema = NcSensorTransitionSchema;
|
|
136448
|
-
exports.NcSharedSequenceInputSchema = NcSharedSequenceInputSchema;
|
|
136449
|
-
exports.NcSharedSequenceSchema = NcSharedSequenceSchema;
|
|
136450
136304
|
exports.NcSnoozeInputSchema = NcSnoozeInputSchema;
|
|
136451
136305
|
exports.NcSnoozeSchema = NcSnoozeSchema;
|
|
136452
136306
|
exports.NcSnoozeScopeSchema = NcSnoozeScopeSchema;
|
|
@@ -136966,6 +136820,7 @@ exports.RollingWindowSchema = require_composition.RollingWindowSchema;
|
|
|
136966
136820
|
exports.RootStepSupplySchema = RootStepSupplySchema;
|
|
136967
136821
|
exports.RtpSourceSchema = RtpSourceSchema;
|
|
136968
136822
|
exports.RtspRestreamEntrySchema = RtspRestreamEntrySchema;
|
|
136823
|
+
exports.RuleFireOriginSchema = require_sleep.RuleFireOriginSchema;
|
|
136969
136824
|
exports.RunGate = RunGate;
|
|
136970
136825
|
exports.RunnerBootCheckSchema = RunnerBootCheckSchema;
|
|
136971
136826
|
exports.RunnerCameraConfigSchema = RunnerCameraConfigSchema;
|
|
@@ -137971,6 +137826,7 @@ exports.historyItemFieldPath = require_sleep.historyItemFieldPath;
|
|
|
137971
137826
|
exports.historyRetentionFromSettings = require_composition.historyRetentionFromSettings;
|
|
137972
137827
|
exports.historyUnitFor = require_sleep.historyUnitFor;
|
|
137973
137828
|
exports.holdRefusalOf = holdRefusalOf;
|
|
137829
|
+
exports.holdVarSlots = holdVarSlots;
|
|
137974
137830
|
exports.htmlToText = htmlToText;
|
|
137975
137831
|
exports.hubAddressHostname = hubAddressHostname;
|
|
137976
137832
|
exports.hubMotionNativeProvider = hubMotionNativeProvider;
|
|
@@ -138236,8 +138092,6 @@ exports.normalizeAudioLabel = normalizeAudioLabel;
|
|
|
138236
138092
|
exports.normalizeCapStep = normalizeCapStep;
|
|
138237
138093
|
exports.normalizeConditionUnits = normalizeConditionUnits;
|
|
138238
138094
|
exports.normalizeCoreBlockWrite = normalizeCoreBlockWrite;
|
|
138239
|
-
exports.normalizeNcAction = normalizeNcAction;
|
|
138240
|
-
exports.normalizeNcCapTarget = normalizeNcCapTarget;
|
|
138241
138095
|
exports.normalizeNcMediaPolicy = normalizeNcMediaPolicy;
|
|
138242
138096
|
exports.normalizeNodeId = require_sleep.normalizeNodeId;
|
|
138243
138097
|
exports.normalizeOffSeconds = normalizeOffSeconds;
|
|
@@ -138526,6 +138380,7 @@ exports.ruleBelongsToAlarm = ruleBelongsToAlarm;
|
|
|
138526
138380
|
exports.ruleDeviceCompatCapNames = ruleDeviceCompatCapNames;
|
|
138527
138381
|
exports.ruleDeviceCompatCapQueries = ruleDeviceCompatCapQueries;
|
|
138528
138382
|
exports.ruleEditorSectionsForKind = ruleEditorSectionsForKind;
|
|
138383
|
+
exports.ruleFireOfClaim = require_sleep.ruleFireOfClaim;
|
|
138529
138384
|
exports.ruleGatedOnArmedState = ruleGatedOnArmedState;
|
|
138530
138385
|
exports.ruleGroupingApplies = ruleGroupingApplies;
|
|
138531
138386
|
exports.ruleKindOf = ruleKindOf;
|