@camstack/server 1.2.929 → 1.2.930
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 +6 -0
- package/package.json +9 -11
- package/system/dist/builtins/alerts/alerts.addon.js +1 -1
- package/system/dist/builtins/alerts/alerts.addon.mjs +1 -1
- package/system/dist/builtins/composer/composer.addon.js +3 -3
- package/system/dist/builtins/composer/composer.addon.mjs +3 -3
- package/system/dist/builtins/core-blocks/actions-service.d.ts +18 -1
- package/system/dist/builtins/core-blocks/core-blocks.addon.js +986 -208
- package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +985 -208
- package/system/dist/builtins/core-blocks/tcp-connect.d.ts +3 -0
- package/system/dist/builtins/core-notifier/core-notifier.addon.js +6 -487
- package/system/dist/builtins/core-notifier/core-notifier.addon.mjs +3 -484
- package/system/dist/builtins/device-manager/device-manager.addon.js +3 -3
- package/system/dist/builtins/device-manager/device-manager.addon.mjs +3 -3
- package/system/dist/{composition-sources-Caqv7O7z.mjs → composition-sources-BEUWn2s_.mjs} +1 -1
- package/system/dist/{composition-sources-CgnHjm8Q.js → composition-sources-acfR4hDq.js} +1 -1
- package/system/dist/{core-blocks.cap-LEMqVwxO.js → core-blocks.cap-BMeMCBrx.js} +37 -9
- package/system/dist/{core-blocks.cap-C6iKAZ-x.mjs → core-blocks.cap-BRPsLAij.mjs} +32 -10
- package/system/dist/index.js +2 -2
- package/system/dist/index.mjs +2 -2
- package/system/dist/{notification-rules.cap-B__YBgnG.js → notification-rules.cap-BDh0LDhV.js} +6 -0
- package/system/dist/{notification-rules.cap-D9ArZlwx.mjs → notification-rules.cap-DUmiMBQB.mjs} +1 -1
- package/system/dist/notification-targets-CRH-9Dy5.js +509 -0
- package/system/dist/notification-targets-DaNE-pIt.mjs +486 -0
- package/system/dist/{prefix-walk-DC0ljmbB.js → prefix-walk-BkMxoXpL.js} +1 -1
- package/system/dist/{prefix-walk-B4b2-9aK.mjs → prefix-walk-ifwg_ukx.mjs} +1 -1
- package/system/dist/{rename-composition-block-CcWLwVhG.js → rename-composition-block-BJsL58Ih.js} +121 -15
- package/system/dist/{rename-composition-block-7WIICIDq.mjs → rename-composition-block-OAtErZgq.mjs} +121 -15
- package/system/package.json +1 -1
package/system/dist/{rename-composition-block-7WIICIDq.mjs → rename-composition-block-OAtErZgq.mjs}
RENAMED
|
@@ -3,7 +3,7 @@ import { A as AudioLevelSchema, C as featureProbeCapability, D as AudioChunkInpu
|
|
|
3
3
|
import { b as EventCategory } from "./base-addon-Md14i7pe.mjs";
|
|
4
4
|
import { Z as errMsg } from "./scoped-settings-DVWUIP7Z.mjs";
|
|
5
5
|
import { a as expandCapMethods, c as method, i as event, l as optionalMethod } from "./capability-definition-C2rJdVeX.mjs";
|
|
6
|
-
import { a as notificationRulesCapability, c as alarmPanelCapability,
|
|
6
|
+
import { a as notificationRulesCapability, c as alarmPanelCapability, f as notificationOutputCapability, n as NcConditionsSchema, r as NcScheduleSchema, t as NcConditionDescriptorSchema } from "./notification-rules.cap-DUmiMBQB.mjs";
|
|
7
7
|
import { a as deviceManagerCapability, b as ResyncResultSchema, i as LinkedDevicesSlotValueSchema, r as LINKED_DEVICES_SLOT, x as deviceAdoptionCapability } from "./device-manager.cap-CFZSPfUh.mjs";
|
|
8
8
|
import { d as CameraSwitchIdSchema, u as CameraSwitchGroupSchema } from "./device-identifiers-iSuQCKmK.mjs";
|
|
9
9
|
import { i as deviceRemovalHookCapability, o as deviceHistoryCapability, r as deviceRunsCapability, t as deviceTransitionsCapability } from "./device-transitions.cap-DojcwEuX.mjs";
|
|
@@ -19,7 +19,7 @@ import { r as MODEL_FORMATS, t as platformProbeCapability } from "./platform-pro
|
|
|
19
19
|
import { a as authProviderCapability, c as TokenScopeSchema, i as deviceCredentialsCapability, r as ssoBridgeCapability, t as userManagementCapability } from "./user-management.cap-DBIi77sB.mjs";
|
|
20
20
|
import { n as DeviceRole, r as DeviceType } from "./device-type-DgEvK3ch.mjs";
|
|
21
21
|
import { d as AppLoginPathSchema } from "./device-certificate-Cddm4Idn.mjs";
|
|
22
|
-
import { $ as alertsCapability, B as customKeyOfRole,
|
|
22
|
+
import { $ as alertsCapability, B as customKeyOfRole, C as powerSourceCapability, Dt as TemplateTimeWindowValueSchema, Et as TemplateEventValueSchema, G as IrNativeCodeSchema, Gt as paramMetaOf, H as isRemoteRole, Ht as convertQuantityInput, I as irSourceProblem, J as TransmitSettingsSchema, Jt as unwrapSchema, K as IrNativeFormatSchema, Kt as enumerateItemArrayFields, L as remoteSourceSteps, M as mediaPlayerCapability, N as REMOTE_STEP_DELAY_MAX_MS, Ot as AutomationWhenSchema, P as RemoteSourceSchema, Tt as TemplateEntriesValueSchema, U as isRemoteWidgetRole, Ut as isQuantityValue, V as isRemoteCustomKey, Vt as QuantityUnitError, Wt as paramMeta, X as CompositionRunStatusSchema, Y as CompositionBlockStateSchema, _t as AutomationRecipeSchema, c as coreBlocksCapability, ct as SchedulerConflictSchema, dt as SchedulerPreviewSchema, et as AutomationRunOutcomeSchema, fn as vocabCall, ft as SchedulerSchema, gt as AutomationBranchStepSchema, ht as ActionStepSchema, j as MediaPlayerStatusSchema, kt as EVENT_LEAF_ID_RE, nn as EventVocabularyEntrySchema, pt as SchedulerStatusSchema, q as IrTimingsSchema, qt as enumerateSchemaFields, st as LOCAL_DATE_PATTERN, tt as AutomationRunTraceSchema, un as findVocabAction, ut as SchedulerInputSchema, wt as TemplateActionValueSchema, z as RemoteRoleSchema } from "./core-blocks.cap-BRPsLAij.mjs";
|
|
23
23
|
import { i as addonSettingsCapability, o as unitDimension, s as unitsForDimension } from "./addon-settings.cap-3-TIIMq_.mjs";
|
|
24
24
|
import { R as COMPOSED_DEVICE_STABLE_ID_PREFIX, T as CompositionSchema, r as errorCapability, x as COMPOSER_ADDON_ID } from "./error.cap-CSM_SRfR.mjs";
|
|
25
25
|
import { a as normalizeUnit } from "./source-info-DGB7SdB_.mjs";
|
|
@@ -1520,19 +1520,84 @@ function normalizeCommandStepUnits(step, resolver, path) {
|
|
|
1520
1520
|
warnings
|
|
1521
1521
|
};
|
|
1522
1522
|
}
|
|
1523
|
+
/** One step's own units, then every step nested under it (a block's body, a branch, an `else`). */
|
|
1524
|
+
function normalizeStepUnits(action, resolver, path) {
|
|
1525
|
+
const nested = (steps, at) => normalizeActionUnits(steps ?? [], resolver, at);
|
|
1526
|
+
switch (action.kind) {
|
|
1527
|
+
case "command": {
|
|
1528
|
+
const own = normalizeCommandStepUnits(action, resolver, path);
|
|
1529
|
+
if (!("else" in action) || action.else === void 0) return own;
|
|
1530
|
+
const inner = nested(action.else, `${path}.else`);
|
|
1531
|
+
const { argUnits: _stale, ...kept } = action;
|
|
1532
|
+
return {
|
|
1533
|
+
value: {
|
|
1534
|
+
...kept,
|
|
1535
|
+
...own.value,
|
|
1536
|
+
else: inner.value
|
|
1537
|
+
},
|
|
1538
|
+
warnings: [...own.warnings, ...inner.warnings]
|
|
1539
|
+
};
|
|
1540
|
+
}
|
|
1541
|
+
case "wait": {
|
|
1542
|
+
if (!("else" in action) || action.else === void 0) return {
|
|
1543
|
+
value: action,
|
|
1544
|
+
warnings: []
|
|
1545
|
+
};
|
|
1546
|
+
const inner = nested(action.else, `${path}.else`);
|
|
1547
|
+
return {
|
|
1548
|
+
value: {
|
|
1549
|
+
...action,
|
|
1550
|
+
else: inner.value
|
|
1551
|
+
},
|
|
1552
|
+
warnings: inner.warnings
|
|
1553
|
+
};
|
|
1554
|
+
}
|
|
1555
|
+
case "parallel":
|
|
1556
|
+
case "repeat": {
|
|
1557
|
+
const inner = nested(action.steps, `${path}.steps`);
|
|
1558
|
+
return {
|
|
1559
|
+
value: {
|
|
1560
|
+
...action,
|
|
1561
|
+
steps: inner.value
|
|
1562
|
+
},
|
|
1563
|
+
warnings: inner.warnings
|
|
1564
|
+
};
|
|
1565
|
+
}
|
|
1566
|
+
case "choose": {
|
|
1567
|
+
const branches = action.branches.map((branch, i) => ({
|
|
1568
|
+
branch,
|
|
1569
|
+
inner: nested(branch.steps, `${path}.branches.${i}.steps`)
|
|
1570
|
+
}));
|
|
1571
|
+
const other = action.else === void 0 ? void 0 : nested(action.else, `${path}.else`);
|
|
1572
|
+
return {
|
|
1573
|
+
value: {
|
|
1574
|
+
...action,
|
|
1575
|
+
branches: branches.map(({ branch, inner }) => ({
|
|
1576
|
+
...branch,
|
|
1577
|
+
steps: inner.value
|
|
1578
|
+
})),
|
|
1579
|
+
...other === void 0 ? {} : { else: other.value }
|
|
1580
|
+
},
|
|
1581
|
+
warnings: [...branches.flatMap(({ inner }) => inner.warnings), ...other?.warnings ?? []]
|
|
1582
|
+
};
|
|
1583
|
+
}
|
|
1584
|
+
default: return {
|
|
1585
|
+
value: action,
|
|
1586
|
+
warnings: []
|
|
1587
|
+
};
|
|
1588
|
+
}
|
|
1589
|
+
}
|
|
1523
1590
|
/**
|
|
1524
1591
|
* Normalise the command steps of an action list (an internal Action's steps, or a
|
|
1525
|
-
* recipe's actions)
|
|
1592
|
+
* recipe's actions), at any depth: a `choose` branch, a `parallel` or `repeat` body and
|
|
1593
|
+
* an `else` are walked like the top level. Other step kinds pass through. Throws
|
|
1594
|
+
* {@link QuantityUnitError}.
|
|
1526
1595
|
*/
|
|
1527
1596
|
function normalizeActionUnits(actions, resolver, path = "steps") {
|
|
1528
1597
|
const out = [];
|
|
1529
1598
|
const warnings = [];
|
|
1530
1599
|
actions.forEach((action, i) => {
|
|
1531
|
-
|
|
1532
|
-
out.push(action);
|
|
1533
|
-
return;
|
|
1534
|
-
}
|
|
1535
|
-
const normalized = normalizeCommandStepUnits(action, resolver, `${path}.${i}`);
|
|
1600
|
+
const normalized = normalizeStepUnits(action, resolver, `${path}.${i}`);
|
|
1536
1601
|
out.push(normalized.value);
|
|
1537
1602
|
warnings.push(...normalized.warnings);
|
|
1538
1603
|
});
|
|
@@ -1941,15 +2006,47 @@ var actionSourceCapability = {
|
|
|
1941
2006
|
var ACTION_RUN_MAX_MS = 60 * 6e4;
|
|
1942
2007
|
/** `timeoutMs` of `actions.run`: a waited call outlives any legal run. */
|
|
1943
2008
|
var ACTION_RUN_TIMEOUT_MS = 363e4;
|
|
2009
|
+
function listMs(steps) {
|
|
2010
|
+
return steps.reduce((total, step) => total + stepMs(step), 0);
|
|
2011
|
+
}
|
|
2012
|
+
/** How long a repeat's iterations run at most: the bound the schema already forces on every loop form. */
|
|
2013
|
+
function repeatMs(step) {
|
|
2014
|
+
const body = listMs(step.steps);
|
|
2015
|
+
switch (step.loop.by) {
|
|
2016
|
+
case "count": return step.loop.count * body;
|
|
2017
|
+
case "forEach": return step.loop.target.ids.length * body;
|
|
2018
|
+
case "while":
|
|
2019
|
+
case "until": return step.loop.maxIterations * (body + (step.loop.waitS ?? 0) * 1e3);
|
|
2020
|
+
}
|
|
2021
|
+
}
|
|
2022
|
+
/** The longest one step holds the run, in ms: its own wait, or what it nests. Device commands take extra, never less. */
|
|
2023
|
+
function stepMs(step) {
|
|
2024
|
+
switch (step.kind) {
|
|
2025
|
+
case "wait": {
|
|
2026
|
+
const own = step.seconds * 1e3;
|
|
2027
|
+
return "else" in step && step.else !== void 0 ? Math.max(own, listMs(step.else)) : own;
|
|
2028
|
+
}
|
|
2029
|
+
case "wait-until": return step.timeoutS * 1e3;
|
|
2030
|
+
case "probe":
|
|
2031
|
+
case "http-request": return (step.retryUntilSeconds ?? 0) * 1e3;
|
|
2032
|
+
case "repeat": return repeatMs(step);
|
|
2033
|
+
case "parallel": return Math.max(0, ...step.steps.map(stepMs));
|
|
2034
|
+
case "choose": return Math.max(0, ...step.branches.map((branch) => listMs(branch.steps)), listMs(step.else ?? []));
|
|
2035
|
+
case "command": return "else" in step && step.else !== void 0 ? listMs(step.else) : 0;
|
|
2036
|
+
case "action":
|
|
2037
|
+
case "notify":
|
|
2038
|
+
case "set":
|
|
2039
|
+
case "stop": return 0;
|
|
2040
|
+
}
|
|
2041
|
+
}
|
|
1944
2042
|
/**
|
|
1945
|
-
* The time an action's
|
|
1946
|
-
*
|
|
1947
|
-
*
|
|
2043
|
+
* The most time an action's steps hold the run for by waiting alone, in ms: a
|
|
2044
|
+
* wait, a wait-until up to its timeout, a retry window, a repeat (its bound
|
|
2045
|
+
* times its body), the longest of a parallel's members and of a choose's
|
|
2046
|
+
* branches. Device commands take extra, never less.
|
|
1948
2047
|
*/
|
|
1949
2048
|
function actionWaitTotalMs(steps) {
|
|
1950
|
-
|
|
1951
|
-
for (const step of steps) if (step.kind === "wait") total += step.seconds * 1e3;
|
|
1952
|
-
return total;
|
|
2049
|
+
return listMs(steps);
|
|
1953
2050
|
}
|
|
1954
2051
|
//#endregion
|
|
1955
2052
|
//#region ../types/dist/esm/capabilities/actions.cap.mjs
|
|
@@ -21920,7 +22017,16 @@ var powerMeterCapability = {
|
|
|
21920
22017
|
/* @__PURE__ */ powerTarget("energy", "kWh"),
|
|
21921
22018
|
/* @__PURE__ */ powerTarget("voltage", "V"),
|
|
21922
22019
|
/* @__PURE__ */ powerTarget("current", "A")
|
|
21923
|
-
]
|
|
22020
|
+
],
|
|
22021
|
+
sourceGroups: [{
|
|
22022
|
+
id: "meter-device",
|
|
22023
|
+
targets: [
|
|
22024
|
+
"power",
|
|
22025
|
+
"energy",
|
|
22026
|
+
"voltage",
|
|
22027
|
+
"current"
|
|
22028
|
+
]
|
|
22029
|
+
}]
|
|
21924
22030
|
},
|
|
21925
22031
|
vocabulary: {
|
|
21926
22032
|
noun: /* @__PURE__ */ t("Power meter", "Misuratore di energia"),
|