@camstack/server 1.2.825 → 1.2.827
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/api/trpc/generated-cap-routers.js +257 -40
- package/dist/core/addon/addon-registry.service.js +3 -0
- package/package.json +41 -12
- package/system/dist/addon-runner.js +19 -2
- package/system/dist/addon-runner.mjs +19 -2
- package/system/dist/{agent-https-BBO2OtNH.mjs → agent-https-BSxTUzKT.mjs} +1 -1
- package/system/dist/{agent-https-B2nqARmj.js → agent-https-BlLVD9hG.js} +1 -1
- package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
- package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
- package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
- package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
- package/system/dist/builtins/alerts/alerts.addon.js +1 -1
- package/system/dist/builtins/alerts/alerts.addon.mjs +1 -1
- package/system/dist/builtins/autotrack/index.js +1 -1
- package/system/dist/builtins/autotrack/index.mjs +1 -1
- package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +2 -2
- package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +2 -2
- package/system/dist/builtins/calendars/calendars.addon.js +1 -1
- package/system/dist/builtins/calendars/calendars.addon.mjs +1 -1
- package/system/dist/builtins/camera-grid/index.js +1 -1
- package/system/dist/builtins/camera-grid/index.mjs +1 -1
- package/system/dist/builtins/composer/composer.addon.js +4 -4
- package/system/dist/builtins/composer/composer.addon.mjs +4 -4
- package/system/dist/builtins/console-logging/index.js +1 -1
- package/system/dist/builtins/console-logging/index.mjs +1 -1
- package/system/dist/builtins/core-blocks/core-blocks.addon.js +3 -3
- package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +3 -3
- package/system/dist/builtins/device-history/device-history.addon.js +2 -2
- package/system/dist/builtins/device-history/device-history.addon.mjs +2 -2
- package/system/dist/builtins/device-manager/device-bindings-store.d.ts +7 -4
- package/system/dist/builtins/device-manager/device-manager.addon.d.ts +2 -0
- package/system/dist/builtins/device-manager/device-manager.addon.js +269 -25
- package/system/dist/builtins/device-manager/device-manager.addon.mjs +269 -25
- package/system/dist/builtins/device-manager/device-meta-actions.d.ts +11 -1
- package/system/dist/builtins/device-manager/device-projection.d.ts +7 -0
- package/system/dist/builtins/device-manager/device-template/mirror-resolver.d.ts +2 -0
- package/system/dist/builtins/device-manager/device-template/template-filters.d.ts +13 -0
- package/system/dist/builtins/device-manager/device-template/template-host.d.ts +11 -3
- package/system/dist/builtins/device-manager/device-template-actions.d.ts +1 -0
- package/system/dist/builtins/device-manager/feature-deriver.d.ts +61 -0
- package/system/dist/builtins/hub-forwarder/index.js +1 -1
- package/system/dist/builtins/hub-forwarder/index.mjs +1 -1
- package/system/dist/builtins/keychain/index.js +4 -4
- package/system/dist/builtins/keychain/index.mjs +4 -4
- package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
- package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
- package/system/dist/builtins/local-auth/local-auth.addon.js +2 -2
- package/system/dist/builtins/local-auth/local-auth.addon.mjs +2 -2
- package/system/dist/builtins/local-network/local-network.addon.js +2 -2
- package/system/dist/builtins/local-network/local-network.addon.mjs +2 -2
- package/system/dist/builtins/loki-logging/index.js +1 -1
- package/system/dist/builtins/loki-logging/index.mjs +1 -1
- package/system/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
- package/system/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
- package/system/dist/builtins/platform-probe/index.js +1 -1
- package/system/dist/builtins/platform-probe/index.mjs +1 -1
- package/system/dist/builtins/record-entries/index.js +1 -1
- package/system/dist/builtins/record-entries/index.mjs +1 -1
- package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
- package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
- package/system/dist/builtins/snapshot/index.js +1 -1
- package/system/dist/builtins/snapshot/index.mjs +1 -1
- package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
- package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
- package/system/dist/builtins/sqlite-storage/index.js +1 -1
- package/system/dist/builtins/sqlite-storage/index.mjs +1 -1
- package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.js +3 -3
- package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +3 -3
- package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
- package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
- package/system/dist/builtins/system-config/system-config.addon.js +3 -3
- package/system/dist/builtins/system-config/system-config.addon.mjs +3 -3
- package/system/dist/builtins/winston-logging/index.js +1 -1
- package/system/dist/builtins/winston-logging/index.mjs +1 -1
- package/system/dist/{capture-engine-DP4HbT3W.js → capture-engine-1A7HAX3x.js} +1 -1
- package/system/dist/{capture-engine-C-rHYVFq.mjs → capture-engine-B0yQx6hA.mjs} +1 -1
- package/system/dist/{composition-sources-CM9c_jAj.js → composition-sources-BzM19ASO.js} +1 -1
- package/system/dist/{composition-sources-CL9JFN4y.mjs → composition-sources-CyJ0d6Sc.mjs} +1 -1
- package/system/dist/{constants-DzGFnCKZ.mjs → constants-B_FLEjP_.mjs} +1 -1
- package/system/dist/{constants-jk7JccZ0.js → constants-DSO4ZEO3.js} +1 -1
- package/system/dist/{device-ca-DZ_OQiCc.mjs → device-ca-CveuNCHp.mjs} +1 -1
- package/system/dist/{device-ca-B7_R5WJh.js → device-ca-DLTDsonl.js} +1 -1
- package/system/dist/device-template-worker.js +61 -1
- package/system/dist/device-template-worker.mjs +61 -1
- package/system/dist/{dist-BgRMQHuL.mjs → dist-CIyyHwVx.mjs} +373 -175
- package/system/dist/{dist-BpTL3uNe.js → dist-DhbzVygm.js} +408 -174
- package/system/dist/file-host-worker.js +1 -1
- package/system/dist/file-host-worker.mjs +1 -1
- package/system/dist/{hub-mdns-ciao-DIcBingB.mjs → hub-mdns-ciao-CQdCUsrI.mjs} +2 -2
- package/system/dist/{hub-mdns-ciao-DPUaYAD3.js → hub-mdns-ciao-C_ITDs0-.js} +2 -2
- package/system/dist/index.js +26 -9
- package/system/dist/index.mjs +27 -10
- package/system/dist/kernel/moleculer/migration-api-facade.d.ts +3 -1
- package/system/dist/{legacy-integration-rows-door-DYNePgj4.js → legacy-integration-rows-door-D_tfRhsx.js} +1 -1
- package/system/dist/{legacy-integration-rows-door-1GnkpMgH.mjs → legacy-integration-rows-door-tX6Qktxd.mjs} +1 -1
- package/system/dist/{rename-composition-block-Cp0_nwAI.mjs → rename-composition-block-COaMxshT.mjs} +1 -1
- package/system/dist/{rename-composition-block-Dn2z4fnA.js → rename-composition-block-DNhbAonr.js} +1 -1
- package/system/dist/{restore-archive-B3FEpUfz.mjs → restore-archive-BMqp_hMT.mjs} +1 -1
- package/system/dist/{restore-archive-BGa5pdp9.js → restore-archive-Dbzuv5hK.js} +1 -1
- package/system/dist/{template-protocol-CTP4eAo_.js → template-protocol-DRZ4cm95.js} +4 -1
- package/system/dist/{template-protocol-BmMM5VBf.mjs → template-protocol-D_6uVHKs.mjs} +4 -1
- package/system/dist/{wal-maintenance-GWFxnSnE.js → wal-maintenance-CWODOTsa.js} +0 -0
- package/system/dist/{wal-maintenance-BLWLlVfF.mjs → wal-maintenance-ITsLGvFA.mjs} +0 -0
- package/system/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
require("./chunk-Cek0wNdY.js");
|
|
2
|
-
const require_template_protocol = require("./template-protocol-
|
|
2
|
+
const require_template_protocol = require("./template-protocol-DRZ4cm95.js");
|
|
3
3
|
let node_worker_threads = require("node:worker_threads");
|
|
4
4
|
let _camstack_types_units_lean = require("@camstack/types/units-lean");
|
|
5
5
|
//#region src/builtins/device-manager/device-template/template-filters.ts
|
|
@@ -72,6 +72,22 @@ function roundFilter(input, digits) {
|
|
|
72
72
|
if (typeof input === "number") return Math.round(input * factor) / factor;
|
|
73
73
|
return input;
|
|
74
74
|
}
|
|
75
|
+
/**
|
|
76
|
+
* `trunc(n)`: cut to `n` decimals toward zero, never round (19.99 at one decimal is 19.9).
|
|
77
|
+
* The same arithmetic as the OSD's old formatter, so a migrated text prints what it did.
|
|
78
|
+
*/
|
|
79
|
+
function truncFilter(input, digits) {
|
|
80
|
+
const factor = 10 ** (typeof digits === "number" && Number.isInteger(digits) && digits >= 0 && digits <= 12 ? digits : 0);
|
|
81
|
+
if (input instanceof Quantity) return new Quantity(Math.trunc(input.value * factor) / factor, input.symbol);
|
|
82
|
+
if (typeof input === "number") return Math.trunc(input * factor) / factor;
|
|
83
|
+
return input;
|
|
84
|
+
}
|
|
85
|
+
/** `onoff`: a boolean reads `ON` / `OFF`; anything else passes through untouched (a number stays a number). */
|
|
86
|
+
function onoffFilter(input) {
|
|
87
|
+
if (input === true) return "ON";
|
|
88
|
+
if (input === false) return "OFF";
|
|
89
|
+
return input;
|
|
90
|
+
}
|
|
75
91
|
function defaultFilter(input, fallback) {
|
|
76
92
|
return isMissing(input) ? fallback : input;
|
|
77
93
|
}
|
|
@@ -105,6 +121,47 @@ function makeAgoFilter(nowMs) {
|
|
|
105
121
|
return at === void 0 ? void 0 : `${durationText(nowMs - at)} ago`;
|
|
106
122
|
};
|
|
107
123
|
}
|
|
124
|
+
var TIME_TOKENS = [
|
|
125
|
+
"YYYY",
|
|
126
|
+
"MM",
|
|
127
|
+
"DD",
|
|
128
|
+
"HH",
|
|
129
|
+
"mm",
|
|
130
|
+
"ss"
|
|
131
|
+
];
|
|
132
|
+
/**
|
|
133
|
+
* `time('HH:mm')`: an epoch timestamp as clock text, in the zone of the process
|
|
134
|
+
* (the server's). Tokens `YYYY MM DD HH mm ss`; everything else is literal and a
|
|
135
|
+
* source character is consumed once, so a substituted digit is never re-read.
|
|
136
|
+
*/
|
|
137
|
+
function timeFilter(input, pattern) {
|
|
138
|
+
const at = epochMs(input);
|
|
139
|
+
if (at === void 0 || typeof pattern !== "string") return void 0;
|
|
140
|
+
const date = new Date(at);
|
|
141
|
+
if (Number.isNaN(date.getTime())) return void 0;
|
|
142
|
+
const two = (n) => String(n).padStart(2, "0");
|
|
143
|
+
const parts = {
|
|
144
|
+
YYYY: String(date.getFullYear()).padStart(4, "0"),
|
|
145
|
+
MM: two(date.getMonth() + 1),
|
|
146
|
+
DD: two(date.getDate()),
|
|
147
|
+
HH: two(date.getHours()),
|
|
148
|
+
mm: two(date.getMinutes()),
|
|
149
|
+
ss: two(date.getSeconds())
|
|
150
|
+
};
|
|
151
|
+
let out = "";
|
|
152
|
+
let i = 0;
|
|
153
|
+
while (i < pattern.length) {
|
|
154
|
+
const token = TIME_TOKENS.find((t) => pattern.startsWith(t, i));
|
|
155
|
+
if (token !== void 0) {
|
|
156
|
+
out += parts[token] ?? "";
|
|
157
|
+
i += token.length;
|
|
158
|
+
} else {
|
|
159
|
+
out += pattern[i];
|
|
160
|
+
i += 1;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
return out;
|
|
164
|
+
}
|
|
108
165
|
/** `format('%.1f')`, `format('%d items')`, `format('%s')`: one value, one placeholder. */
|
|
109
166
|
function formatFilter(input, pattern) {
|
|
110
167
|
if (typeof pattern !== "string") return input;
|
|
@@ -206,8 +263,11 @@ function environmentFor(nowMs, printer) {
|
|
|
206
263
|
d: defaultFilter,
|
|
207
264
|
unit: unitFilter,
|
|
208
265
|
round: roundFilter,
|
|
266
|
+
trunc: truncFilter,
|
|
267
|
+
onoff: onoffFilter,
|
|
209
268
|
default: defaultFilter,
|
|
210
269
|
format: formatFilter,
|
|
270
|
+
time: timeFilter,
|
|
211
271
|
since: makeSinceFilter(nowMs),
|
|
212
272
|
ago: makeAgoFilter(nowMs)
|
|
213
273
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as createTemplateEnvironment, r as analyzeTemplate, t as isRenderRequest } from "./template-protocol-
|
|
1
|
+
import { i as createTemplateEnvironment, r as analyzeTemplate, t as isRenderRequest } from "./template-protocol-D_6uVHKs.mjs";
|
|
2
2
|
import { parentPort, workerData } from "node:worker_threads";
|
|
3
3
|
import { tryConvertUnit } from "@camstack/types/units-lean";
|
|
4
4
|
//#region src/builtins/device-manager/device-template/template-filters.ts
|
|
@@ -71,6 +71,22 @@ function roundFilter(input, digits) {
|
|
|
71
71
|
if (typeof input === "number") return Math.round(input * factor) / factor;
|
|
72
72
|
return input;
|
|
73
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* `trunc(n)`: cut to `n` decimals toward zero, never round (19.99 at one decimal is 19.9).
|
|
76
|
+
* The same arithmetic as the OSD's old formatter, so a migrated text prints what it did.
|
|
77
|
+
*/
|
|
78
|
+
function truncFilter(input, digits) {
|
|
79
|
+
const factor = 10 ** (typeof digits === "number" && Number.isInteger(digits) && digits >= 0 && digits <= 12 ? digits : 0);
|
|
80
|
+
if (input instanceof Quantity) return new Quantity(Math.trunc(input.value * factor) / factor, input.symbol);
|
|
81
|
+
if (typeof input === "number") return Math.trunc(input * factor) / factor;
|
|
82
|
+
return input;
|
|
83
|
+
}
|
|
84
|
+
/** `onoff`: a boolean reads `ON` / `OFF`; anything else passes through untouched (a number stays a number). */
|
|
85
|
+
function onoffFilter(input) {
|
|
86
|
+
if (input === true) return "ON";
|
|
87
|
+
if (input === false) return "OFF";
|
|
88
|
+
return input;
|
|
89
|
+
}
|
|
74
90
|
function defaultFilter(input, fallback) {
|
|
75
91
|
return isMissing(input) ? fallback : input;
|
|
76
92
|
}
|
|
@@ -104,6 +120,47 @@ function makeAgoFilter(nowMs) {
|
|
|
104
120
|
return at === void 0 ? void 0 : `${durationText(nowMs - at)} ago`;
|
|
105
121
|
};
|
|
106
122
|
}
|
|
123
|
+
var TIME_TOKENS = [
|
|
124
|
+
"YYYY",
|
|
125
|
+
"MM",
|
|
126
|
+
"DD",
|
|
127
|
+
"HH",
|
|
128
|
+
"mm",
|
|
129
|
+
"ss"
|
|
130
|
+
];
|
|
131
|
+
/**
|
|
132
|
+
* `time('HH:mm')`: an epoch timestamp as clock text, in the zone of the process
|
|
133
|
+
* (the server's). Tokens `YYYY MM DD HH mm ss`; everything else is literal and a
|
|
134
|
+
* source character is consumed once, so a substituted digit is never re-read.
|
|
135
|
+
*/
|
|
136
|
+
function timeFilter(input, pattern) {
|
|
137
|
+
const at = epochMs(input);
|
|
138
|
+
if (at === void 0 || typeof pattern !== "string") return void 0;
|
|
139
|
+
const date = new Date(at);
|
|
140
|
+
if (Number.isNaN(date.getTime())) return void 0;
|
|
141
|
+
const two = (n) => String(n).padStart(2, "0");
|
|
142
|
+
const parts = {
|
|
143
|
+
YYYY: String(date.getFullYear()).padStart(4, "0"),
|
|
144
|
+
MM: two(date.getMonth() + 1),
|
|
145
|
+
DD: two(date.getDate()),
|
|
146
|
+
HH: two(date.getHours()),
|
|
147
|
+
mm: two(date.getMinutes()),
|
|
148
|
+
ss: two(date.getSeconds())
|
|
149
|
+
};
|
|
150
|
+
let out = "";
|
|
151
|
+
let i = 0;
|
|
152
|
+
while (i < pattern.length) {
|
|
153
|
+
const token = TIME_TOKENS.find((t) => pattern.startsWith(t, i));
|
|
154
|
+
if (token !== void 0) {
|
|
155
|
+
out += parts[token] ?? "";
|
|
156
|
+
i += token.length;
|
|
157
|
+
} else {
|
|
158
|
+
out += pattern[i];
|
|
159
|
+
i += 1;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
return out;
|
|
163
|
+
}
|
|
107
164
|
/** `format('%.1f')`, `format('%d items')`, `format('%s')`: one value, one placeholder. */
|
|
108
165
|
function formatFilter(input, pattern) {
|
|
109
166
|
if (typeof pattern !== "string") return input;
|
|
@@ -205,8 +262,11 @@ function environmentFor(nowMs, printer) {
|
|
|
205
262
|
d: defaultFilter,
|
|
206
263
|
unit: unitFilter,
|
|
207
264
|
round: roundFilter,
|
|
265
|
+
trunc: truncFilter,
|
|
266
|
+
onoff: onoffFilter,
|
|
208
267
|
default: defaultFilter,
|
|
209
268
|
format: formatFilter,
|
|
269
|
+
time: timeFilter,
|
|
210
270
|
since: makeSinceFilter(nowMs),
|
|
211
271
|
ago: makeAgoFilter(nowMs)
|
|
212
272
|
}
|