@camstack/server 1.2.877 → 1.2.878
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/dist/api/trpc/generated-cap-mounts.js +2 -1
- package/dist/api/trpc/generated-cap-routers.js +308 -256
- package/package.json +10 -9
- 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/actions-store.d.ts +2 -0
- package/system/dist/builtins/core-blocks/core-block-store.d.ts +6 -0
- package/system/dist/builtins/core-blocks/core-blocks.addon.d.ts +3 -0
- package/system/dist/builtins/core-blocks/core-blocks.addon.js +410 -9
- package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +410 -9
- package/system/dist/builtins/core-blocks/record-kinds.d.ts +11 -1
- package/system/dist/builtins/core-blocks/scheduler/scheduler-store.d.ts +6 -0
- package/system/dist/builtins/core-blocks/tags-service.d.ts +50 -0
- package/system/dist/builtins/core-blocks/tags-wiring.d.ts +16 -0
- 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-manager.addon.js +59 -5
- package/system/dist/builtins/device-manager/device-manager.addon.mjs +59 -5
- package/system/dist/builtins/device-manager/device-meta-actions.d.ts +6 -0
- package/system/dist/builtins/device-manager/device-meta-types.d.ts +2 -0
- package/system/dist/builtins/device-manager/device-row-store.d.ts +1 -0
- package/system/dist/builtins/device-manager/device-template/template-grammar.d.ts +15 -1
- package/system/dist/builtins/device-manager/device-template/template-protocol.d.ts +8 -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 +3 -3
- package/system/dist/builtins/local-network/local-network.addon.mjs +3 -3
- 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-2V8c4s3c.js → capture-engine-DAGmlBmJ.js} +1 -1
- package/system/dist/{capture-engine-DQTpQ2x7.mjs → capture-engine-vlouhBCY.mjs} +1 -1
- package/system/dist/{composition-sources-De2-fnz1.js → composition-sources-Rm8xDXjA.js} +1 -1
- package/system/dist/{composition-sources-DjQfZJXB.mjs → composition-sources-TeHa4THk.mjs} +1 -1
- package/system/dist/{constants-CXQ72oX8.mjs → constants-Bq1Xl_Ku.mjs} +1 -1
- package/system/dist/{constants-BpNC8zLo.js → constants-DnUpXvIY.js} +1 -1
- package/system/dist/{device-ca-pvid0fx9.js → device-ca-DMudhY-2.js} +1 -1
- package/system/dist/{device-ca-DnZEQKUX.mjs → device-ca-yHLgyutP.mjs} +1 -1
- package/system/dist/device-template-worker.js +26 -3
- package/system/dist/device-template-worker.mjs +26 -3
- package/system/dist/{dist-BghIT0F5.js → dist-Bh5JIimH.js} +1700 -1178
- package/system/dist/{dist-CcfanEqn.mjs → dist-DemZNuSJ.mjs} +1647 -1179
- package/system/dist/file-host-worker.js +1 -1
- package/system/dist/file-host-worker.mjs +1 -1
- package/system/dist/{hub-identity-B5pg6urK.mjs → hub-identity-BxaJKDQk.mjs} +1 -1
- package/system/dist/{hub-identity-B74cag6Q.js → hub-identity-YfGdAaBm.js} +1 -1
- package/system/dist/{hub-mdns-ciao-8bwCOLeJ.js → hub-mdns-ciao-BkWOmG6H.js} +2 -2
- package/system/dist/{hub-mdns-ciao-Db9RuUVf.mjs → hub-mdns-ciao-aIsTpo0F.mjs} +2 -2
- package/system/dist/index.js +8 -8
- package/system/dist/index.mjs +8 -8
- package/system/dist/{legacy-integration-rows-door-DlZ8ad2x.js → legacy-integration-rows-door-C9PZZiKH.js} +1 -1
- package/system/dist/{legacy-integration-rows-door-XBECnCQb.mjs → legacy-integration-rows-door-DrfZZHWq.mjs} +1 -1
- package/system/dist/{rename-composition-block-BWGfsb6q.mjs → rename-composition-block-C2KFIOMP.mjs} +1 -1
- package/system/dist/{rename-composition-block-CQnWc7-b.js → rename-composition-block-Qp1dW4FP.js} +1 -1
- package/system/dist/{restore-archive-CI7Ejrq9.js → restore-archive-DGgj7aqA.js} +1 -1
- package/system/dist/{restore-archive-DsfZbucU.mjs → restore-archive-D_K6PqRk.mjs} +1 -1
- package/system/dist/{template-protocol-DRZ4cm95.js → template-protocol-D5ogm1rj.js} +8 -44
- package/system/dist/{template-protocol-D_6uVHKs.mjs → template-protocol-SgPDx3Hw.mjs} +8 -44
- package/system/dist/{wal-maintenance-Dl4QOdNz.mjs → wal-maintenance-BuiSFfF2.mjs} +0 -0
- package/system/dist/{wal-maintenance-WAuRngNc.js → wal-maintenance-DD8mfRDn.js} +0 -0
- package/system/package.json +4 -1
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `tags` cap (D1054). A tag lives on the record it labels — a core block, a
|
|
3
|
+
* scheduler, a template, an action, a device — and only its STYLE (colour token,
|
|
4
|
+
* icon) is registered here. This service is the one place that knows every owner
|
|
5
|
+
* kind, so `rename` and `remove` are ONE server operation that rewrites all of
|
|
6
|
+
* them; the browser never drives that sequence (a closed tab would split the
|
|
7
|
+
* fleet across two spellings).
|
|
8
|
+
*
|
|
9
|
+
* Owners are reached through {@link TagOwnerPort}s: the local stores directly,
|
|
10
|
+
* the devices through the device manager over `ctx.api` — never a second copy.
|
|
11
|
+
* Tags compare trimmed and case-insensitively (`sameTag`).
|
|
12
|
+
*/
|
|
13
|
+
import { type IScopedLogger, type ITagsProvider, type RecordKindHandle, type TagUsageCounts } from "@camstack/types";
|
|
14
|
+
import type { TagStyleRowBody } from "./record-kinds.js";
|
|
15
|
+
/** One record that may carry tags. `id` is the owner's own id, as text. */
|
|
16
|
+
export interface TagOwnerRecord {
|
|
17
|
+
readonly id: string;
|
|
18
|
+
readonly tags: readonly string[];
|
|
19
|
+
}
|
|
20
|
+
/** How the service reads and rewrites the tags of one owner kind. */
|
|
21
|
+
export interface TagOwnerPort {
|
|
22
|
+
list(): Promise<readonly TagOwnerRecord[]>;
|
|
23
|
+
setTags(id: string, tags: string[]): Promise<void>;
|
|
24
|
+
}
|
|
25
|
+
export type TagOwnerKind = keyof TagUsageCounts;
|
|
26
|
+
export type TagOwnerPorts = Readonly<Record<TagOwnerKind, TagOwnerPort>>;
|
|
27
|
+
export interface TagsServiceDeps {
|
|
28
|
+
readonly owners: TagOwnerPorts;
|
|
29
|
+
/** Row id = `tagKey(name)`. */
|
|
30
|
+
readonly styles: RecordKindHandle<TagStyleRowBody>;
|
|
31
|
+
readonly logger: IScopedLogger;
|
|
32
|
+
}
|
|
33
|
+
export declare class TagsService implements ITagsProvider {
|
|
34
|
+
private readonly deps;
|
|
35
|
+
constructor(deps: TagsServiceDeps);
|
|
36
|
+
private readStyles;
|
|
37
|
+
readonly list: ITagsProvider["list"];
|
|
38
|
+
readonly setStyle: ITagsProvider["setStyle"];
|
|
39
|
+
readonly rename: ITagsProvider["rename"];
|
|
40
|
+
readonly remove: ITagsProvider["remove"];
|
|
41
|
+
/**
|
|
42
|
+
* Apply `change` to every record carrying `tag`, on every owner kind. A record
|
|
43
|
+
* that fails is logged and the rest are still attempted; the call then throws,
|
|
44
|
+
* and the style is NOT touched — the tag still names the failed records, so the
|
|
45
|
+
* operator repeats the same call (every step is idempotent).
|
|
46
|
+
*/
|
|
47
|
+
private rewrite;
|
|
48
|
+
/** The style follows the tag; a merge onto a styled target keeps the TARGET's style. */
|
|
49
|
+
private moveStyle;
|
|
50
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Builds the `tags` cap provider (D1054) over the stores core-blocks owns and the
|
|
3
|
+
* device manager (over `ctx.api`, never a copy of its data).
|
|
4
|
+
*/
|
|
5
|
+
import { type AddonApi, type IScopedLogger, type RecordsAccess } from "@camstack/types";
|
|
6
|
+
import type { CoreBlockStore } from "./core-block-store.js";
|
|
7
|
+
import { type TagOwnerPort, TagsService } from "./tags-service.js";
|
|
8
|
+
export interface TagsRuntimeDeps {
|
|
9
|
+
readonly records: RecordsAccess;
|
|
10
|
+
readonly blocks: () => CoreBlockStore;
|
|
11
|
+
readonly api: () => AddonApi | undefined;
|
|
12
|
+
readonly logger: IScopedLogger;
|
|
13
|
+
/** A spec swaps the device owner; production reads the device manager over `api`. */
|
|
14
|
+
readonly devices?: TagOwnerPort;
|
|
15
|
+
}
|
|
16
|
+
export declare function buildTagsService(deps: TagsRuntimeDeps): TagsService;
|
|
@@ -3,8 +3,8 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
7
|
-
const require_capture_engine = require("../../capture-engine-
|
|
6
|
+
const require_dist = require("../../dist-Bh5JIimH.js");
|
|
7
|
+
const require_capture_engine = require("../../capture-engine-DAGmlBmJ.js");
|
|
8
8
|
const require_retention = require("../../retention-BcOSL6b9.js");
|
|
9
9
|
let node_crypto = require("node:crypto");
|
|
10
10
|
//#region src/builtins/device-history/capture/point-writer.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as catalogMetrics, c as DeviceDirectory, d as identityOf, f as subjectIdOf, i as capSeriesKey, l as isRealDeviceType, n as CaptureEngine, o as readPath, r as capItemSeriesKey, s as readUnit, t as CAP_KEY_PREFIX, u as SeriesRegistry } from "../../capture-engine-
|
|
1
|
+
import { $s as DeviceTransitionSchema, Br as deviceTransitionsCapability, Gl as DeviceType, Gs as wattMillisecondsToKwh, Ir as deviceRemovalHookCapability, Jc as defineRecordKinds, Jl as EventCategory, Ks as BaseAddon, Lr as deviceRunsCapability, Nn as armRemovalReconcile, Nr as deviceHistoryCapability, U as DEVICE_HISTORY_ENERGY_KEY, Xc as emitReadiness, bt as HISTORY_CATALOG, nl as historyUnitFor, nt as DeviceRunSchema, rc as InvalidRecordError, ul as isReadingQuantity, xt as HISTORY_ITEM_CATALOG, yc as RecordTooLargeError } from "../../dist-DemZNuSJ.mjs";
|
|
2
|
+
import { a as catalogMetrics, c as DeviceDirectory, d as identityOf, f as subjectIdOf, i as capSeriesKey, l as isRealDeviceType, n as CaptureEngine, o as readPath, r as capItemSeriesKey, s as readUnit, t as CAP_KEY_PREFIX, u as SeriesRegistry } from "../../capture-engine-vlouhBCY.mjs";
|
|
3
3
|
import { a as FIVE_MINUTES_MS, c as bucketEndOf, i as DAY_MS, l as bucketStartOf, n as RetentionJob, o as HOUR_MS, r as DepartureTracker, s as ROLLUP_GRACE_MS, t as DEFAULT_RETENTION, u as floorTo } from "../../retention-CUOVI1p7.mjs";
|
|
4
4
|
import { randomUUID } from "node:crypto";
|
|
5
5
|
//#region src/builtins/device-history/capture/point-writer.ts
|
|
@@ -3,14 +3,14 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
const require_chunk = require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-Bh5JIimH.js");
|
|
7
7
|
const require_read_all_rows$1 = require("../../read-all-rows-CVoO1ONM.js");
|
|
8
8
|
const require_log_redactor = require("../../log-redactor-BhIEMaG9.js");
|
|
9
|
-
const require_rename_composition_block = require("../../rename-composition-block-
|
|
9
|
+
const require_rename_composition_block = require("../../rename-composition-block-Qp1dW4FP.js");
|
|
10
10
|
const require_prefix_range = require("../../prefix-range-D_KueXbQ.js");
|
|
11
11
|
const require_prefix_walk = require("../../prefix-walk-Dv6MLZlM.js");
|
|
12
12
|
const require_retired_settings_keys = require("../../retired-settings-keys-C8nOOr5H.js");
|
|
13
|
-
const require_template_protocol = require("../../template-protocol-
|
|
13
|
+
const require_template_protocol = require("../../template-protocol-D5ogm1rj.js");
|
|
14
14
|
const require_dns_wire = require("../../dns-wire-B1BvF9Ao.js");
|
|
15
15
|
let zod = require("zod");
|
|
16
16
|
let node_crypto = require("node:crypto");
|
|
@@ -20,6 +20,7 @@ node_path = require_chunk.__toESM(node_path);
|
|
|
20
20
|
let _camstack_types_addon = require("@camstack/types/addon");
|
|
21
21
|
let node_module = require("node:module");
|
|
22
22
|
let node_worker_threads = require("node:worker_threads");
|
|
23
|
+
let _camstack_types_device_template_catalogue = require("@camstack/types/device-template-catalogue");
|
|
23
24
|
//#region src/builtins/device-manager/adoption-job-engine.ts
|
|
24
25
|
/** How many finished jobs are kept per (addonId, integrationId). */
|
|
25
26
|
var JOB_HISTORY = 20;
|
|
@@ -482,6 +483,7 @@ function toDeviceInfo(addonId, device, metadata = null, metaRow = null) {
|
|
|
482
483
|
...metaRow?.primaryChildEntityId !== void 0 ? { primaryChildEntityId: metaRow.primaryChildEntityId } : {},
|
|
483
484
|
...metaRow?.childLayout !== void 0 ? { childLayout: metaRow.childLayout } : {},
|
|
484
485
|
...metaRow?.primaryChildPreference !== void 0 ? { primaryChildPreference: metaRow.primaryChildPreference } : {},
|
|
486
|
+
...metaRow?.tags !== void 0 ? { tags: metaRow.tags } : {},
|
|
485
487
|
...metaRow?.display !== void 0 ? { display: metaRow.display } : {}
|
|
486
488
|
};
|
|
487
489
|
}
|
|
@@ -3064,6 +3066,7 @@ async function listAll(pctx, input) {
|
|
|
3064
3066
|
...m.primaryChildEntityId !== void 0 ? { primaryChildEntityId: m.primaryChildEntityId } : {},
|
|
3065
3067
|
...m.childLayout !== void 0 ? { childLayout: m.childLayout } : {},
|
|
3066
3068
|
...m.primaryChildPreference !== void 0 ? { primaryChildPreference: m.primaryChildPreference } : {},
|
|
3069
|
+
...m.tags !== void 0 ? { tags: m.tags } : {},
|
|
3067
3070
|
...m.display !== void 0 ? { display: m.display } : {},
|
|
3068
3071
|
...(() => {
|
|
3069
3072
|
if (slim) return {};
|
|
@@ -3116,6 +3119,7 @@ async function getDevice(pctx, input) {
|
|
|
3116
3119
|
...m.primaryChildEntityId !== void 0 ? { primaryChildEntityId: m.primaryChildEntityId } : {},
|
|
3117
3120
|
...m.childLayout !== void 0 ? { childLayout: m.childLayout } : {},
|
|
3118
3121
|
...m.primaryChildPreference !== void 0 ? { primaryChildPreference: m.primaryChildPreference } : {},
|
|
3122
|
+
...m.tags !== void 0 ? { tags: m.tags } : {},
|
|
3119
3123
|
...m.display !== void 0 ? { display: m.display } : {},
|
|
3120
3124
|
...sourceInfoGetDevice !== void 0 ? { sourceInfo: sourceInfoGetDevice } : {}
|
|
3121
3125
|
};
|
|
@@ -3195,6 +3199,7 @@ function projectChildren(pctx, parentDeviceId, ownerAddonId, childRows, liveChil
|
|
|
3195
3199
|
...m.primaryChildEntityId !== void 0 ? { primaryChildEntityId: m.primaryChildEntityId } : {},
|
|
3196
3200
|
...m.childLayout !== void 0 ? { childLayout: m.childLayout } : {},
|
|
3197
3201
|
...m.primaryChildPreference !== void 0 ? { primaryChildPreference: m.primaryChildPreference } : {},
|
|
3202
|
+
...m.tags !== void 0 ? { tags: m.tags } : {},
|
|
3198
3203
|
...m.display !== void 0 ? { display: m.display } : {},
|
|
3199
3204
|
...sourceInfoChild !== void 0 ? { sourceInfo: sourceInfoChild } : {}
|
|
3200
3205
|
});
|
|
@@ -7871,6 +7876,38 @@ async function setLocation(pctx, input) {
|
|
|
7871
7876
|
}
|
|
7872
7877
|
});
|
|
7873
7878
|
}
|
|
7879
|
+
/** The tags a write stores: normalised, `null` (the column's absent form) when none are left. */
|
|
7880
|
+
function storedTags(tags) {
|
|
7881
|
+
const normalized = require_dist.normalizeTags(tags);
|
|
7882
|
+
return normalized.length === 0 ? null : normalized;
|
|
7883
|
+
}
|
|
7884
|
+
/**
|
|
7885
|
+
* Replace the operator tags of one device (D1054). Normalised on write; `[]`
|
|
7886
|
+
* clears them. Unlike `setLocation`, nothing cascades: a tag labels the record
|
|
7887
|
+
* it is on. Emits `DeviceMetaChanged` (`field: 'tags'`).
|
|
7888
|
+
*/
|
|
7889
|
+
async function setTags(pctx, input) {
|
|
7890
|
+
const { deviceId } = input;
|
|
7891
|
+
const tags = storedTags(input.tags);
|
|
7892
|
+
await pctx.metaStore.withMetaWriteLock(async () => {
|
|
7893
|
+
if (!await pctx.metaStore.resolvePersistedById(deviceId)) throw new Error(`[device-manager] setTags: unknown device id=${deviceId}`);
|
|
7894
|
+
await pctx.metaStore.rows.patch(deviceId, { tags });
|
|
7895
|
+
});
|
|
7896
|
+
pctx.host.ctx.eventBus.emit({
|
|
7897
|
+
id: (0, node_crypto.randomUUID)(),
|
|
7898
|
+
timestamp: /* @__PURE__ */ new Date(),
|
|
7899
|
+
source: {
|
|
7900
|
+
type: "device",
|
|
7901
|
+
id: deviceId
|
|
7902
|
+
},
|
|
7903
|
+
category: require_dist.EventCategory.DeviceMetaChanged,
|
|
7904
|
+
data: {
|
|
7905
|
+
deviceId,
|
|
7906
|
+
field: "tags",
|
|
7907
|
+
value: tags ?? []
|
|
7908
|
+
}
|
|
7909
|
+
});
|
|
7910
|
+
}
|
|
7874
7911
|
/**
|
|
7875
7912
|
* Update the device type. Writes the meta row, emits a
|
|
7876
7913
|
* `DeviceMetaChanged` event. Used by the kernel to apply
|
|
@@ -8145,12 +8182,13 @@ async function setRoleDisplayDefaults(pctx, input) {
|
|
|
8145
8182
|
* a many-entity container.
|
|
8146
8183
|
*/
|
|
8147
8184
|
async function applyInitialMeta(pctx, input) {
|
|
8148
|
-
const { deviceId, name, location, type, integrationId, linkDeviceId, role } = input;
|
|
8185
|
+
const { deviceId, name, location, tags, type, integrationId, linkDeviceId, role } = input;
|
|
8149
8186
|
await pctx.metaStore.withMetaWriteLock(async () => {
|
|
8150
8187
|
if (!await pctx.metaStore.resolvePersistedById(deviceId)) throw new Error(`[device-manager] applyInitialMeta: unknown device id=${deviceId}`);
|
|
8151
8188
|
await pctx.metaStore.rows.patch(deviceId, {
|
|
8152
8189
|
...name !== void 0 ? { name } : {},
|
|
8153
8190
|
...location !== void 0 ? { location } : {},
|
|
8191
|
+
...tags !== void 0 ? { tags: storedTags(tags) } : {},
|
|
8154
8192
|
...type !== void 0 ? { type } : {},
|
|
8155
8193
|
...integrationId !== void 0 ? { integrationId } : {},
|
|
8156
8194
|
...linkDeviceId !== void 0 ? { linkDeviceId } : {},
|
|
@@ -8175,6 +8213,7 @@ async function applyInitialMeta(pctx, input) {
|
|
|
8175
8213
|
};
|
|
8176
8214
|
if (name !== void 0) emitMetaChanged("name", name);
|
|
8177
8215
|
if (location !== void 0) emitMetaChanged("location", location);
|
|
8216
|
+
if (tags !== void 0) emitMetaChanged("tags", storedTags(tags) ?? []);
|
|
8178
8217
|
if (type !== void 0) emitMetaChanged("type", type);
|
|
8179
8218
|
if (integrationId !== void 0) emitMetaChanged("integrationId", integrationId);
|
|
8180
8219
|
if (linkDeviceId !== void 0) emitMetaChanged("linkDeviceId", linkDeviceId);
|
|
@@ -9004,6 +9043,11 @@ function defaultTemplateWorkerPath() {
|
|
|
9004
9043
|
const packageRoot = node_path.dirname(require_.resolve("@camstack/server/system/package.json"));
|
|
9005
9044
|
return node_path.join(packageRoot, "dist", "device-template-worker.js");
|
|
9006
9045
|
}
|
|
9046
|
+
/** Filter caps and callable globals, derived once from the catalogue. */
|
|
9047
|
+
var GRAMMAR_POLICY = {
|
|
9048
|
+
filterMaxParams: (0, _camstack_types_device_template_catalogue.deviceTemplateFilterMaxParams)(),
|
|
9049
|
+
callableBounds: (0, _camstack_types_device_template_catalogue.deviceTemplateCallableBounds)()
|
|
9050
|
+
};
|
|
9007
9051
|
/** Room for the hidden source-unit arguments the renderer adds to `unit()` calls. */
|
|
9008
9052
|
var REWRITE_ALLOWANCE = 2048;
|
|
9009
9053
|
/**
|
|
@@ -9114,7 +9158,7 @@ var DeviceTemplateRenderer = class {
|
|
|
9114
9158
|
}
|
|
9115
9159
|
/** Vet a template without rendering it: its references, or the refusal. */
|
|
9116
9160
|
validate(source) {
|
|
9117
|
-
return require_template_protocol.analyzeTemplate(source, require_dist.DEVICE_TEMPLATE_FILTERS, require_dist.DEVICE_TEMPLATE_MAX_LENGTH);
|
|
9161
|
+
return require_template_protocol.analyzeTemplate(source, require_dist.DEVICE_TEMPLATE_FILTERS, require_dist.DEVICE_TEMPLATE_MAX_LENGTH, GRAMMAR_POLICY);
|
|
9118
9162
|
}
|
|
9119
9163
|
async render(source, resolver) {
|
|
9120
9164
|
const analysis = this.validate(source);
|
|
@@ -9319,6 +9363,8 @@ var DeviceTemplateRenderer = class {
|
|
|
9319
9363
|
if (existing !== null && this.ready !== null) return this.ready.then(() => existing);
|
|
9320
9364
|
const limits = {
|
|
9321
9365
|
allowedFilters: require_dist.DEVICE_TEMPLATE_FILTERS,
|
|
9366
|
+
filterMaxParams: GRAMMAR_POLICY.filterMaxParams,
|
|
9367
|
+
callableBounds: GRAMMAR_POLICY.callableBounds,
|
|
9322
9368
|
maxSourceLength: require_dist.DEVICE_TEMPLATE_MAX_LENGTH + REWRITE_ALLOWANCE,
|
|
9323
9369
|
maxOutput: require_dist.DEVICE_TEMPLATE_MAX_OUTPUT,
|
|
9324
9370
|
unavailable: "—"
|
|
@@ -10234,6 +10280,10 @@ var DEVICE_ROWS_COLUMNS = [
|
|
|
10234
10280
|
name: "location",
|
|
10235
10281
|
type: "TEXT"
|
|
10236
10282
|
},
|
|
10283
|
+
{
|
|
10284
|
+
name: "tags",
|
|
10285
|
+
type: "JSON"
|
|
10286
|
+
},
|
|
10237
10287
|
{
|
|
10238
10288
|
name: "disabled",
|
|
10239
10289
|
type: "BOOLEAN",
|
|
@@ -10394,6 +10444,7 @@ function decodeDeviceRow(data) {
|
|
|
10394
10444
|
const name = readString(data["name"]);
|
|
10395
10445
|
if (deviceId === void 0 || addonId === void 0 || stableId === void 0 || type === void 0 || name === void 0) return null;
|
|
10396
10446
|
const location = readString(data["location"]);
|
|
10447
|
+
const tags = readStringArray(data["tags"]);
|
|
10397
10448
|
const parentDeviceId = readNumber(data["parentDeviceId"]);
|
|
10398
10449
|
const userNamed = readBoolean(data["userNamed"]);
|
|
10399
10450
|
const features = readStringArray(data["features"]);
|
|
@@ -10415,6 +10466,7 @@ function decodeDeviceRow(data) {
|
|
|
10415
10466
|
type,
|
|
10416
10467
|
name,
|
|
10417
10468
|
location: location ?? null,
|
|
10469
|
+
...tags !== void 0 && tags.length > 0 ? { tags: [...tags] } : {},
|
|
10418
10470
|
disabled: readBoolean(data["disabled"]) ?? false,
|
|
10419
10471
|
parentDeviceId: parentDeviceId ?? null,
|
|
10420
10472
|
...alias !== void 0 ? { alias } : {},
|
|
@@ -10461,6 +10513,7 @@ function encodeDeviceRow(meta, extra = {}) {
|
|
|
10461
10513
|
alias: meta.alias ?? null,
|
|
10462
10514
|
userNamed: meta.userNamed ?? null,
|
|
10463
10515
|
location: meta.location,
|
|
10516
|
+
tags: meta.tags === void 0 || meta.tags.length === 0 ? null : [...meta.tags],
|
|
10464
10517
|
disabled: meta.disabled,
|
|
10465
10518
|
parentDeviceId: meta.parentDeviceId,
|
|
10466
10519
|
registered: extra.registered ?? false,
|
|
@@ -13937,6 +13990,7 @@ var DeviceManagerAddon = class extends require_dist.BaseAddon {
|
|
|
13937
13990
|
renderDeviceTemplates: (input) => templates.render(input),
|
|
13938
13991
|
checkDeviceTemplates: (input) => templates.check(input),
|
|
13939
13992
|
setLocation: (input) => setLocation(pctx, input),
|
|
13993
|
+
setTags: (input) => setTags(pctx, input),
|
|
13940
13994
|
setType: (input) => setType(pctx, input),
|
|
13941
13995
|
setIntegrationId: (input) => setIntegrationId(pctx, input),
|
|
13942
13996
|
setLinkDeviceId: (input) => setLinkDeviceId(pctx, input),
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $n as checkDeviceAlias, Bc as collectZodSecretPaths$1, Dr as defineExtensionSlotProvider, Eo as siteZoneKey, Fc as auditedFields, Fr as deviceOffersActions, Gl as DeviceType$1, Gn as buildStreamParamsConfigSchema, Hi as locationIconKey, Hr as enumerateItemArrayFields, Ia as reconcileReportedFeatures, Il as toSecretFieldView, J as DEVICE_TEMPLATE_FILTERS, Jc as defineRecordKinds, Jl as EventCategory$1, Jr as expandContainer, Kl as errMsg$1, Ks as BaseAddon, Li as legacyAutoLinkIds, Ll as transformSecretWrite, Mr as deviceExtensionCapability, Nt as MINUTES_PER_DAY, Oc as WELL_KNOWN_TAB_MAP, Ol as resolveSecretMarkers, Pl as sleep$2, Pr as deviceManagerCapability, Ps as implementedMethodsOf$1, Q as DEVICE_TEMPLATE_VALUES_CAP, Qc as expandCapMethods$1, Rl as userError, Rr as deviceStateCapability, S as CAP_NAMES_WITH_STATUS, Sc as SECRET_CLEAR, Ul as DeviceFeature, Ur as enumerateSchemaFields, Vc as commandEffect, Wl as DeviceRole, X as DEVICE_TEMPLATE_MAX_OUTPUT, Y as DEVICE_TEMPLATE_MAX_LENGTH, Yn as canonicalIconKey, Zr as extractSourceInfoFromMetadata, _a as parseStreamParamsFormPatch, _o as searchRank, _t as FieldClaimModeSchema, at as DiscoveryProposalBodySchema, b as CAMERA_SWITCH_ORDER, bo as settleDeviceFeatures, bs as capAppliesToDeviceKind, co as resolveTemplateRef, dl as isSecretClear, do as runtimeFieldUnit, fo as runtimeStatePolicyFor, il as isCommand$1, in as STREAM_PROFILE_META, it as DeviceTombstoneSchema, j as ConditionMirror, jl as secretTreeFromPaths, ki as isKernelDerivedFeature, la as normalizeTags, ll as isKeychainStoredField, lt as ExportNameRefusedError, ml as isSecretMarkerLike, ol as isDeviceConfigCap, pl as isSecretMarker, rt as DeviceStatusSchema, s as ALL_CAPABILITY_DEFINITIONS, si as formatMinutes, ua as normalizeUnit, ui as generateDeviceAlias, vt as FieldClaimSchema, yr as createDeviceExtensionProvider, ys as canonicalStoredDeviceType, z as DAY_NAMES, zl as vocabActionIdFor, zr as deviceStatusCapability } from "../../dist-DemZNuSJ.mjs";
|
|
2
2
|
import { t as require_read_all_rows } from "../../read-all-rows-TaPqdWNF.mjs";
|
|
3
3
|
import { a as redactLogText, i as redactLogMeta, n as isSecretArgumentKey } from "../../log-redactor-XLDrPzOi.mjs";
|
|
4
|
-
import { n as renameCompositionBlock, t as composedBlockIdOf } from "../../rename-composition-block-
|
|
4
|
+
import { n as renameCompositionBlock, t as composedBlockIdOf } from "../../rename-composition-block-C2KFIOMP.mjs";
|
|
5
5
|
import { t as prefixRange } from "../../prefix-range-Dl0znowN.mjs";
|
|
6
6
|
import { t as loadPrefixed } from "../../prefix-walk-DAOBSyH1.mjs";
|
|
7
7
|
import { n as purgeRetiredSettingsRows } from "../../retired-settings-keys-u6xQA6r7.mjs";
|
|
8
|
-
import { n as isRenderResponse, r as analyzeTemplate } from "../../template-protocol-
|
|
8
|
+
import { n as isRenderResponse, r as analyzeTemplate } from "../../template-protocol-SgPDx3Hw.mjs";
|
|
9
9
|
import { s as normalizeServiceType } from "../../dns-wire-Dm3H_7ST.mjs";
|
|
10
10
|
import { createRequire } from "node:module";
|
|
11
11
|
import { z } from "zod";
|
|
@@ -14,6 +14,7 @@ import { canonicalDeviceFingerprint } from "@camstack/types/node";
|
|
|
14
14
|
import * as path$1 from "node:path";
|
|
15
15
|
import { isCommand, readCommandOrigin } from "@camstack/types/addon";
|
|
16
16
|
import { Worker } from "node:worker_threads";
|
|
17
|
+
import { deviceTemplateCallableBounds, deviceTemplateFilterMaxParams } from "@camstack/types/device-template-catalogue";
|
|
17
18
|
//#region src/builtins/device-manager/adoption-job-engine.ts
|
|
18
19
|
/** How many finished jobs are kept per (addonId, integrationId). */
|
|
19
20
|
var JOB_HISTORY = 20;
|
|
@@ -476,6 +477,7 @@ function toDeviceInfo(addonId, device, metadata = null, metaRow = null) {
|
|
|
476
477
|
...metaRow?.primaryChildEntityId !== void 0 ? { primaryChildEntityId: metaRow.primaryChildEntityId } : {},
|
|
477
478
|
...metaRow?.childLayout !== void 0 ? { childLayout: metaRow.childLayout } : {},
|
|
478
479
|
...metaRow?.primaryChildPreference !== void 0 ? { primaryChildPreference: metaRow.primaryChildPreference } : {},
|
|
480
|
+
...metaRow?.tags !== void 0 ? { tags: metaRow.tags } : {},
|
|
479
481
|
...metaRow?.display !== void 0 ? { display: metaRow.display } : {}
|
|
480
482
|
};
|
|
481
483
|
}
|
|
@@ -3058,6 +3060,7 @@ async function listAll(pctx, input) {
|
|
|
3058
3060
|
...m.primaryChildEntityId !== void 0 ? { primaryChildEntityId: m.primaryChildEntityId } : {},
|
|
3059
3061
|
...m.childLayout !== void 0 ? { childLayout: m.childLayout } : {},
|
|
3060
3062
|
...m.primaryChildPreference !== void 0 ? { primaryChildPreference: m.primaryChildPreference } : {},
|
|
3063
|
+
...m.tags !== void 0 ? { tags: m.tags } : {},
|
|
3061
3064
|
...m.display !== void 0 ? { display: m.display } : {},
|
|
3062
3065
|
...(() => {
|
|
3063
3066
|
if (slim) return {};
|
|
@@ -3110,6 +3113,7 @@ async function getDevice(pctx, input) {
|
|
|
3110
3113
|
...m.primaryChildEntityId !== void 0 ? { primaryChildEntityId: m.primaryChildEntityId } : {},
|
|
3111
3114
|
...m.childLayout !== void 0 ? { childLayout: m.childLayout } : {},
|
|
3112
3115
|
...m.primaryChildPreference !== void 0 ? { primaryChildPreference: m.primaryChildPreference } : {},
|
|
3116
|
+
...m.tags !== void 0 ? { tags: m.tags } : {},
|
|
3113
3117
|
...m.display !== void 0 ? { display: m.display } : {},
|
|
3114
3118
|
...sourceInfoGetDevice !== void 0 ? { sourceInfo: sourceInfoGetDevice } : {}
|
|
3115
3119
|
};
|
|
@@ -3189,6 +3193,7 @@ function projectChildren(pctx, parentDeviceId, ownerAddonId, childRows, liveChil
|
|
|
3189
3193
|
...m.primaryChildEntityId !== void 0 ? { primaryChildEntityId: m.primaryChildEntityId } : {},
|
|
3190
3194
|
...m.childLayout !== void 0 ? { childLayout: m.childLayout } : {},
|
|
3191
3195
|
...m.primaryChildPreference !== void 0 ? { primaryChildPreference: m.primaryChildPreference } : {},
|
|
3196
|
+
...m.tags !== void 0 ? { tags: m.tags } : {},
|
|
3192
3197
|
...m.display !== void 0 ? { display: m.display } : {},
|
|
3193
3198
|
...sourceInfoChild !== void 0 ? { sourceInfo: sourceInfoChild } : {}
|
|
3194
3199
|
});
|
|
@@ -7865,6 +7870,38 @@ async function setLocation(pctx, input) {
|
|
|
7865
7870
|
}
|
|
7866
7871
|
});
|
|
7867
7872
|
}
|
|
7873
|
+
/** The tags a write stores: normalised, `null` (the column's absent form) when none are left. */
|
|
7874
|
+
function storedTags(tags) {
|
|
7875
|
+
const normalized = normalizeTags(tags);
|
|
7876
|
+
return normalized.length === 0 ? null : normalized;
|
|
7877
|
+
}
|
|
7878
|
+
/**
|
|
7879
|
+
* Replace the operator tags of one device (D1054). Normalised on write; `[]`
|
|
7880
|
+
* clears them. Unlike `setLocation`, nothing cascades: a tag labels the record
|
|
7881
|
+
* it is on. Emits `DeviceMetaChanged` (`field: 'tags'`).
|
|
7882
|
+
*/
|
|
7883
|
+
async function setTags(pctx, input) {
|
|
7884
|
+
const { deviceId } = input;
|
|
7885
|
+
const tags = storedTags(input.tags);
|
|
7886
|
+
await pctx.metaStore.withMetaWriteLock(async () => {
|
|
7887
|
+
if (!await pctx.metaStore.resolvePersistedById(deviceId)) throw new Error(`[device-manager] setTags: unknown device id=${deviceId}`);
|
|
7888
|
+
await pctx.metaStore.rows.patch(deviceId, { tags });
|
|
7889
|
+
});
|
|
7890
|
+
pctx.host.ctx.eventBus.emit({
|
|
7891
|
+
id: randomUUID(),
|
|
7892
|
+
timestamp: /* @__PURE__ */ new Date(),
|
|
7893
|
+
source: {
|
|
7894
|
+
type: "device",
|
|
7895
|
+
id: deviceId
|
|
7896
|
+
},
|
|
7897
|
+
category: EventCategory$1.DeviceMetaChanged,
|
|
7898
|
+
data: {
|
|
7899
|
+
deviceId,
|
|
7900
|
+
field: "tags",
|
|
7901
|
+
value: tags ?? []
|
|
7902
|
+
}
|
|
7903
|
+
});
|
|
7904
|
+
}
|
|
7868
7905
|
/**
|
|
7869
7906
|
* Update the device type. Writes the meta row, emits a
|
|
7870
7907
|
* `DeviceMetaChanged` event. Used by the kernel to apply
|
|
@@ -8139,12 +8176,13 @@ async function setRoleDisplayDefaults(pctx, input) {
|
|
|
8139
8176
|
* a many-entity container.
|
|
8140
8177
|
*/
|
|
8141
8178
|
async function applyInitialMeta(pctx, input) {
|
|
8142
|
-
const { deviceId, name, location, type, integrationId, linkDeviceId, role } = input;
|
|
8179
|
+
const { deviceId, name, location, tags, type, integrationId, linkDeviceId, role } = input;
|
|
8143
8180
|
await pctx.metaStore.withMetaWriteLock(async () => {
|
|
8144
8181
|
if (!await pctx.metaStore.resolvePersistedById(deviceId)) throw new Error(`[device-manager] applyInitialMeta: unknown device id=${deviceId}`);
|
|
8145
8182
|
await pctx.metaStore.rows.patch(deviceId, {
|
|
8146
8183
|
...name !== void 0 ? { name } : {},
|
|
8147
8184
|
...location !== void 0 ? { location } : {},
|
|
8185
|
+
...tags !== void 0 ? { tags: storedTags(tags) } : {},
|
|
8148
8186
|
...type !== void 0 ? { type } : {},
|
|
8149
8187
|
...integrationId !== void 0 ? { integrationId } : {},
|
|
8150
8188
|
...linkDeviceId !== void 0 ? { linkDeviceId } : {},
|
|
@@ -8169,6 +8207,7 @@ async function applyInitialMeta(pctx, input) {
|
|
|
8169
8207
|
};
|
|
8170
8208
|
if (name !== void 0) emitMetaChanged("name", name);
|
|
8171
8209
|
if (location !== void 0) emitMetaChanged("location", location);
|
|
8210
|
+
if (tags !== void 0) emitMetaChanged("tags", storedTags(tags) ?? []);
|
|
8172
8211
|
if (type !== void 0) emitMetaChanged("type", type);
|
|
8173
8212
|
if (integrationId !== void 0) emitMetaChanged("integrationId", integrationId);
|
|
8174
8213
|
if (linkDeviceId !== void 0) emitMetaChanged("linkDeviceId", linkDeviceId);
|
|
@@ -8998,6 +9037,11 @@ function defaultTemplateWorkerPath() {
|
|
|
8998
9037
|
const packageRoot = path$1.dirname(require_.resolve("@camstack/server/system/package.json"));
|
|
8999
9038
|
return path$1.join(packageRoot, "dist", "device-template-worker.js");
|
|
9000
9039
|
}
|
|
9040
|
+
/** Filter caps and callable globals, derived once from the catalogue. */
|
|
9041
|
+
var GRAMMAR_POLICY = {
|
|
9042
|
+
filterMaxParams: deviceTemplateFilterMaxParams(),
|
|
9043
|
+
callableBounds: deviceTemplateCallableBounds()
|
|
9044
|
+
};
|
|
9001
9045
|
/** Room for the hidden source-unit arguments the renderer adds to `unit()` calls. */
|
|
9002
9046
|
var REWRITE_ALLOWANCE = 2048;
|
|
9003
9047
|
/**
|
|
@@ -9108,7 +9152,7 @@ var DeviceTemplateRenderer = class {
|
|
|
9108
9152
|
}
|
|
9109
9153
|
/** Vet a template without rendering it: its references, or the refusal. */
|
|
9110
9154
|
validate(source) {
|
|
9111
|
-
return analyzeTemplate(source, DEVICE_TEMPLATE_FILTERS, DEVICE_TEMPLATE_MAX_LENGTH);
|
|
9155
|
+
return analyzeTemplate(source, DEVICE_TEMPLATE_FILTERS, DEVICE_TEMPLATE_MAX_LENGTH, GRAMMAR_POLICY);
|
|
9112
9156
|
}
|
|
9113
9157
|
async render(source, resolver) {
|
|
9114
9158
|
const analysis = this.validate(source);
|
|
@@ -9313,6 +9357,8 @@ var DeviceTemplateRenderer = class {
|
|
|
9313
9357
|
if (existing !== null && this.ready !== null) return this.ready.then(() => existing);
|
|
9314
9358
|
const limits = {
|
|
9315
9359
|
allowedFilters: DEVICE_TEMPLATE_FILTERS,
|
|
9360
|
+
filterMaxParams: GRAMMAR_POLICY.filterMaxParams,
|
|
9361
|
+
callableBounds: GRAMMAR_POLICY.callableBounds,
|
|
9316
9362
|
maxSourceLength: DEVICE_TEMPLATE_MAX_LENGTH + REWRITE_ALLOWANCE,
|
|
9317
9363
|
maxOutput: DEVICE_TEMPLATE_MAX_OUTPUT,
|
|
9318
9364
|
unavailable: "—"
|
|
@@ -10227,6 +10273,10 @@ var DEVICE_ROWS_COLUMNS = [
|
|
|
10227
10273
|
name: "location",
|
|
10228
10274
|
type: "TEXT"
|
|
10229
10275
|
},
|
|
10276
|
+
{
|
|
10277
|
+
name: "tags",
|
|
10278
|
+
type: "JSON"
|
|
10279
|
+
},
|
|
10230
10280
|
{
|
|
10231
10281
|
name: "disabled",
|
|
10232
10282
|
type: "BOOLEAN",
|
|
@@ -10387,6 +10437,7 @@ function decodeDeviceRow(data) {
|
|
|
10387
10437
|
const name = readString(data["name"]);
|
|
10388
10438
|
if (deviceId === void 0 || addonId === void 0 || stableId === void 0 || type === void 0 || name === void 0) return null;
|
|
10389
10439
|
const location = readString(data["location"]);
|
|
10440
|
+
const tags = readStringArray(data["tags"]);
|
|
10390
10441
|
const parentDeviceId = readNumber(data["parentDeviceId"]);
|
|
10391
10442
|
const userNamed = readBoolean(data["userNamed"]);
|
|
10392
10443
|
const features = readStringArray(data["features"]);
|
|
@@ -10408,6 +10459,7 @@ function decodeDeviceRow(data) {
|
|
|
10408
10459
|
type,
|
|
10409
10460
|
name,
|
|
10410
10461
|
location: location ?? null,
|
|
10462
|
+
...tags !== void 0 && tags.length > 0 ? { tags: [...tags] } : {},
|
|
10411
10463
|
disabled: readBoolean(data["disabled"]) ?? false,
|
|
10412
10464
|
parentDeviceId: parentDeviceId ?? null,
|
|
10413
10465
|
...alias !== void 0 ? { alias } : {},
|
|
@@ -10454,6 +10506,7 @@ function encodeDeviceRow(meta, extra = {}) {
|
|
|
10454
10506
|
alias: meta.alias ?? null,
|
|
10455
10507
|
userNamed: meta.userNamed ?? null,
|
|
10456
10508
|
location: meta.location,
|
|
10509
|
+
tags: meta.tags === void 0 || meta.tags.length === 0 ? null : [...meta.tags],
|
|
10457
10510
|
disabled: meta.disabled,
|
|
10458
10511
|
parentDeviceId: meta.parentDeviceId,
|
|
10459
10512
|
registered: extra.registered ?? false,
|
|
@@ -13930,6 +13983,7 @@ var DeviceManagerAddon = class extends BaseAddon {
|
|
|
13930
13983
|
renderDeviceTemplates: (input) => templates.render(input),
|
|
13931
13984
|
checkDeviceTemplates: (input) => templates.check(input),
|
|
13932
13985
|
setLocation: (input) => setLocation(pctx, input),
|
|
13986
|
+
setTags: (input) => setTags(pctx, input),
|
|
13933
13987
|
setType: (input) => setType(pctx, input),
|
|
13934
13988
|
setIntegrationId: (input) => setIntegrationId(pctx, input),
|
|
13935
13989
|
setLinkDeviceId: (input) => setLinkDeviceId(pctx, input),
|
|
@@ -110,6 +110,12 @@ export declare function setName(pctx: ProviderContext, input: Parameters<IDevice
|
|
|
110
110
|
*/
|
|
111
111
|
export declare function setLocation(pctx: ProviderContext, input: Parameters<IDeviceManagerProvider["setLocation"]>[0]): ReturnType<IDeviceManagerProvider["setLocation"]>;
|
|
112
112
|
/**
|
|
113
|
+
* Replace the operator tags of one device (D1054). Normalised on write; `[]`
|
|
114
|
+
* clears them. Unlike `setLocation`, nothing cascades: a tag labels the record
|
|
115
|
+
* it is on. Emits `DeviceMetaChanged` (`field: 'tags'`).
|
|
116
|
+
*/
|
|
117
|
+
export declare function setTags(pctx: ProviderContext, input: Parameters<IDeviceManagerProvider["setTags"]>[0]): ReturnType<IDeviceManagerProvider["setTags"]>;
|
|
118
|
+
/**
|
|
113
119
|
* Update the device type. Writes the meta row, emits a
|
|
114
120
|
* `DeviceMetaChanged` event. Used by the kernel to apply
|
|
115
121
|
* `initialMeta.type` before device construction so the device
|
|
@@ -110,6 +110,8 @@ export interface PersistedDeviceMeta {
|
|
|
110
110
|
* snapshot. Free-text — providers don't interpret it.
|
|
111
111
|
*/
|
|
112
112
|
location: string | null;
|
|
113
|
+
/** Operator tags (D1054), normalised on write. Absent = no tags. */
|
|
114
|
+
tags?: string[];
|
|
113
115
|
/**
|
|
114
116
|
* Soft-disabled flag. When `true`, the device class is still
|
|
115
117
|
* instantiated and visible in the UI (so the operator can flip
|
|
@@ -137,6 +137,7 @@ export interface DeviceRowPatch {
|
|
|
137
137
|
readonly alias?: string;
|
|
138
138
|
readonly userNamed?: boolean;
|
|
139
139
|
readonly location?: string | null;
|
|
140
|
+
readonly tags?: readonly string[] | null;
|
|
140
141
|
readonly disabled?: boolean;
|
|
141
142
|
readonly parentDeviceId?: number | null;
|
|
142
143
|
readonly registered?: boolean;
|
|
@@ -25,6 +25,20 @@ export interface NodePolicy {
|
|
|
25
25
|
readonly special: readonly string[];
|
|
26
26
|
}
|
|
27
27
|
export declare const NODE_POLICY: Readonly<Record<string, NodePolicy>>;
|
|
28
|
+
/**
|
|
29
|
+
* Argument caps and callable globals, derived by the host from the catalogue
|
|
30
|
+
* and handed to this walker. The worker receives the same object in
|
|
31
|
+
* `workerData` so this file never loads the types barrel (D453).
|
|
32
|
+
*/
|
|
33
|
+
export interface TemplateGrammarPolicy {
|
|
34
|
+
readonly filterMaxParams: Readonly<Record<string, number>>;
|
|
35
|
+
readonly callableBounds: readonly TemplateCallableBound[];
|
|
36
|
+
}
|
|
37
|
+
export interface TemplateCallableBound {
|
|
38
|
+
readonly name: string;
|
|
39
|
+
readonly min: number;
|
|
40
|
+
readonly max: number;
|
|
41
|
+
}
|
|
28
42
|
/** A `unit(…)` call: where its name token sits and the reference it converts, when it is a direct one. */
|
|
29
43
|
export interface UnitSite {
|
|
30
44
|
readonly lineno: number;
|
|
@@ -40,4 +54,4 @@ export type TemplateAnalysis = {
|
|
|
40
54
|
readonly refusal: DeviceTemplateRefusal;
|
|
41
55
|
};
|
|
42
56
|
/** Parse and vet a template. A template that passes may be handed to the worker. */
|
|
43
|
-
export declare function analyzeTemplate(source: string, allowedFilters: readonly string[], maxLength: number): TemplateAnalysis;
|
|
57
|
+
export declare function analyzeTemplate(source: string, allowedFilters: readonly string[], maxLength: number, policy: TemplateGrammarPolicy): TemplateAnalysis;
|
|
@@ -3,9 +3,17 @@
|
|
|
3
3
|
* the worker loads this file, so it imports nothing from the types barrel.
|
|
4
4
|
*/
|
|
5
5
|
import type { DeviceTemplateRefusalReason } from "@camstack/types";
|
|
6
|
+
/** One callable global's argument range, copied into the worker with the other limits. */
|
|
7
|
+
export interface TemplateBoundMessage {
|
|
8
|
+
readonly name: string;
|
|
9
|
+
readonly min: number;
|
|
10
|
+
readonly max: number;
|
|
11
|
+
}
|
|
6
12
|
/** Fixed at spawn: the worker cannot read the types barrel, so the limits travel with it. */
|
|
7
13
|
export interface TemplateWorkerData {
|
|
8
14
|
readonly allowedFilters: readonly string[];
|
|
15
|
+
readonly filterMaxParams: Readonly<Record<string, number>>;
|
|
16
|
+
readonly callableBounds: readonly TemplateBoundMessage[];
|
|
9
17
|
readonly maxSourceLength: number;
|
|
10
18
|
readonly maxOutput: number;
|
|
11
19
|
readonly unavailable: string;
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-Bh5JIimH.js");
|
|
7
7
|
const require_formatter = require("../../formatter-xbxeV4GD.js");
|
|
8
8
|
//#region src/builtins/hub-forwarder/hub-forwarder-destination.ts
|
|
9
9
|
var DEFAULT_OUTBOUND_BUFFER_SIZE = 500;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Gi as logDestinationCapability, Ks as BaseAddon } from "../../dist-DemZNuSJ.mjs";
|
|
2
2
|
import { t as formatLogLine } from "../../formatter-DkYZ4LXp.mjs";
|
|
3
3
|
//#region src/builtins/hub-forwarder/hub-forwarder-destination.ts
|
|
4
4
|
var DEFAULT_OUTBOUND_BUFFER_SIZE = 500;
|
|
@@ -3,11 +3,11 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
const require_chunk = require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
7
|
-
const require_device_ca = require("../../device-ca-
|
|
6
|
+
const require_dist = require("../../dist-Bh5JIimH.js");
|
|
7
|
+
const require_device_ca = require("../../device-ca-DMudhY-2.js");
|
|
8
8
|
const require_read_all_rows$1 = require("../../read-all-rows-CVoO1ONM.js");
|
|
9
|
-
const require_legacy_integration_rows_door = require("../../legacy-integration-rows-door-
|
|
10
|
-
const require_constants = require("../../constants-
|
|
9
|
+
const require_legacy_integration_rows_door = require("../../legacy-integration-rows-door-C9PZZiKH.js");
|
|
10
|
+
const require_constants = require("../../constants-DnUpXvIY.js");
|
|
11
11
|
const require_platform_key_source = require("../../platform-key-source-Di7HrlGR.js");
|
|
12
12
|
let node_crypto = require("node:crypto");
|
|
13
13
|
let _camstack_types_node = require("@camstack/types/node");
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { d as JWT_SIGNING_KEY_REF, n as DEVICE_CA_KEY_REF, p as SYSTEM_SECRET_OWNER } from "../../device-ca-
|
|
1
|
+
import { $c as formatSecretScope, Dt as KEYCHAIN_RESET_TRIGGER_ACTOR, Fi as keychainAdminCapability, Ii as keychainCapability, Jc as defineRecordKinds, Jl as EventCategory, Ks as BaseAddon, Ot as KeychainAuditEntrySchema, kt as KeychainResetRecordSchema, wl as parseSecretRef, xl as normalizeSecretOwner } from "../../dist-DemZNuSJ.mjs";
|
|
2
|
+
import { d as JWT_SIGNING_KEY_REF, n as DEVICE_CA_KEY_REF, p as SYSTEM_SECRET_OWNER } from "../../device-ca-yHLgyutP.mjs";
|
|
3
3
|
import { t as require_read_all_rows } from "../../read-all-rows-TaPqdWNF.mjs";
|
|
4
|
-
import { t as LEGACY_INTEGRATION_ROWS_TABLE } from "../../legacy-integration-rows-door-
|
|
5
|
-
import { a as MESH_CA_KEY_REF } from "../../constants-
|
|
4
|
+
import { t as LEGACY_INTEGRATION_ROWS_TABLE } from "../../legacy-integration-rows-door-DrfZZHWq.mjs";
|
|
5
|
+
import { a as MESH_CA_KEY_REF } from "../../constants-Bq1Xl_Ku.mjs";
|
|
6
6
|
import { n as getPlatformKeychainKey } from "../../platform-key-source-BWlq0jjn.mjs";
|
|
7
7
|
import { createCipheriv, createDecipheriv, createHmac, randomBytes, randomUUID, timingSafeEqual } from "node:crypto";
|
|
8
8
|
import { restrictDirToOwnerSync, restrictFileToOwnerSync, writeOwnerOnlyFileSync } from "@camstack/types/node";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_chunk = require("../../chunk-Cek0wNdY.js");
|
|
3
|
-
const require_dist = require("../../dist-
|
|
3
|
+
const require_dist = require("../../dist-Bh5JIimH.js");
|
|
4
4
|
let node_fs = require("node:fs");
|
|
5
5
|
let node_path = require("node:path");
|
|
6
6
|
node_path = require_chunk.__toESM(node_path);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Jl as EventCategory, Kl as errMsg, Ks as BaseAddon, Qt as RecordingStatusSchema, Uc as createEvent, Yi as mayWriteToLocation, Yt as RECORDING_SOURCE_CAMSTACK_ADDON } from "../../dist-DemZNuSJ.mjs";
|
|
2
2
|
import { constants } from "node:fs";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import * as fsp from "node:fs/promises";
|
|
@@ -3,10 +3,10 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
const require_chunk = require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-Bh5JIimH.js");
|
|
7
7
|
const require_safe_buffer$1 = require("../../safe-buffer-D3aoa-7X.js");
|
|
8
8
|
const require_ms$1 = require("../../ms-LB3giGoU.js");
|
|
9
|
-
const require_device_ca = require("../../device-ca-
|
|
9
|
+
const require_device_ca = require("../../device-ca-DMudhY-2.js");
|
|
10
10
|
const require_read_all_rows$1 = require("../../read-all-rows-CVoO1ONM.js");
|
|
11
11
|
let zod = require("zod");
|
|
12
12
|
let node_crypto = require("node:crypto");
|