@camstack/addon-provider-hikvision 1.2.185 → 1.2.186
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/addon.js +1820 -1865
- package/dist/addon.mjs +1820 -1865
- package/package.json +2 -2
package/dist/addon.js
CHANGED
|
@@ -32,7 +32,7 @@ require("node:zlib");
|
|
|
32
32
|
let node_net = require("node:net");
|
|
33
33
|
let node_http = require("node:http");
|
|
34
34
|
let node_https = require("node:https");
|
|
35
|
-
//#region ../types/dist/event-category-
|
|
35
|
+
//#region ../types/dist/event-category-78tcBemo.mjs
|
|
36
36
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
37
37
|
EventCategory["SystemBoot"] = "system.boot";
|
|
38
38
|
EventCategory["SystemAddonsReady"] = "system.addons-ready";
|
|
@@ -153,6 +153,23 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
153
153
|
*/
|
|
154
154
|
EventCategory["AddonLoadRecovered"] = "addon.load-recovered";
|
|
155
155
|
/**
|
|
156
|
+
* An addon is RUNNING although its installed package is below what the
|
|
157
|
+
* running server requires (`camstack.requires.addons` of the server, or the
|
|
158
|
+
* addon's own `requires.server`). Raised once per streak by the unsupported-
|
|
159
|
+
* addon tracker, on the hub and on agents; AlertCenter turns it into one
|
|
160
|
+
* operator alert per node and package. The addon is never held back for it.
|
|
161
|
+
*
|
|
162
|
+
* Payload: `{ packageName, addonId, nodeId, installedVersion, requiredMinimum, serverVersion, unmet }`.
|
|
163
|
+
*/
|
|
164
|
+
EventCategory["AddonUnsupportedVersion"] = "addon.unsupported-version";
|
|
165
|
+
/**
|
|
166
|
+
* The package of an {@link AddonUnsupportedVersion} alert reached a supported
|
|
167
|
+
* version, or is no longer installed on the node. AlertCenter dismisses the matching alert.
|
|
168
|
+
*
|
|
169
|
+
* Payload: `{ packageName, addonId, nodeId }`.
|
|
170
|
+
*/
|
|
171
|
+
EventCategory["AddonUnsupportedResolved"] = "addon.unsupported-resolved";
|
|
172
|
+
/**
|
|
156
173
|
* Monitor scheduled the next retry for a failed addon. Transient —
|
|
157
174
|
* surfaced to the UI for live-updating the "next retry in Ns"
|
|
158
175
|
* countdown on the Addons page row, NOT persisted as an alert.
|
|
@@ -263,7 +280,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
263
280
|
EventCategory["ProcessRestarted"] = "process.restarted";
|
|
264
281
|
/**
|
|
265
282
|
* The SET of storage locations changed — one was created, edited, enabled,
|
|
266
|
-
* disabled or deleted through
|
|
283
|
+
* disabled or deleted through the location instances or the forced-delete action.
|
|
267
284
|
*
|
|
268
285
|
* Telemetry, not a transaction (D8/D11): every consumer that re-resolves on
|
|
269
286
|
* it must also converge on its own periodic path, because a dropped event
|
|
@@ -818,7 +835,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
818
835
|
return EventCategory;
|
|
819
836
|
}({});
|
|
820
837
|
//#endregion
|
|
821
|
-
//#region ../types/dist/device-type-
|
|
838
|
+
//#region ../types/dist/device-type-DxCT0krO.mjs
|
|
822
839
|
/**
|
|
823
840
|
import { errMsg } from '@camstack/types'
|
|
824
841
|
* Extract a human-readable message from an unknown error value.
|
|
@@ -980,6 +997,13 @@ var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
|
|
|
980
997
|
* filters that want "all devices with on-motion behaviour".
|
|
981
998
|
*/
|
|
982
999
|
DeviceFeature["MotionTrigger"] = "motion-trigger";
|
|
1000
|
+
/**
|
|
1001
|
+
* Device can be run for a chosen time and then stopped. Mirrors the
|
|
1002
|
+
* `timed-run` wrapper cap — the cap is bound by the core-blocks addon, not by
|
|
1003
|
+
* a driver, so the flag is derived from the device's bindings
|
|
1004
|
+
* (`featuresOfBoundCaps`). Gates the quick-run control in the viewer.
|
|
1005
|
+
*/
|
|
1006
|
+
DeviceFeature["TimedRun"] = "timed-run";
|
|
983
1007
|
/** Light supports rgb-triplet color via `color` cap. */
|
|
984
1008
|
DeviceFeature["LightColorRgb"] = "light-color-rgb";
|
|
985
1009
|
/** Light supports HSV color via `color` cap. */
|
|
@@ -6014,7 +6038,7 @@ var ZodIssueCode = {
|
|
|
6014
6038
|
var ZodFirstPartyTypeKind;
|
|
6015
6039
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
6016
6040
|
//#endregion
|
|
6017
|
-
//#region ../types/dist/sleep-
|
|
6041
|
+
//#region ../types/dist/sleep-CGPZyzB5.mjs
|
|
6018
6042
|
/**
|
|
6019
6043
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
6020
6044
|
* window to float samples (D455).
|
|
@@ -6378,6 +6402,59 @@ Object.fromEntries([
|
|
|
6378
6402
|
function isValuelessField(field) {
|
|
6379
6403
|
return field.type === "separator" || field.type === "info" || field.type === "qr-code" || field.type === "button" || field.type === "object-array" || field.type === "widget" || field.type === "addon-action-button" || field.type === "device-action-button" || field.type === "account-sign-in" || field.type === "secret-presence";
|
|
6380
6404
|
}
|
|
6405
|
+
/**
|
|
6406
|
+
* Base collector: flatten a hydrated `ConfigUISchemaWithValues` into
|
|
6407
|
+
* `key → { value, default }`, recursing through `group` and `sub-tabs`
|
|
6408
|
+
* layout fields. Keeping `value` and `default` SEPARATE (rather than
|
|
6409
|
+
* pre-resolving) lets callers both read the effective value AND detect
|
|
6410
|
+
* overrides (`value` differs from `default`). Structural over `unknown`;
|
|
6411
|
+
* malformed input yields an empty map, never throws.
|
|
6412
|
+
*/
|
|
6413
|
+
function collectHydratedFieldEntries(schema) {
|
|
6414
|
+
const out = /* @__PURE__ */ new Map();
|
|
6415
|
+
if (typeof schema !== "object" || schema === null) return out;
|
|
6416
|
+
const sections = schema.sections;
|
|
6417
|
+
if (!Array.isArray(sections)) return out;
|
|
6418
|
+
for (const section of sections) if (typeof section === "object" && section !== null) collectFieldEntriesInto(section.fields, out);
|
|
6419
|
+
return out;
|
|
6420
|
+
}
|
|
6421
|
+
/** Recursive field walker for {@link collectHydratedFieldEntries}. */
|
|
6422
|
+
function collectFieldEntriesInto(fields, into) {
|
|
6423
|
+
if (!Array.isArray(fields)) return;
|
|
6424
|
+
for (const field of fields) {
|
|
6425
|
+
if (typeof field !== "object" || field === null) continue;
|
|
6426
|
+
const type = field.type;
|
|
6427
|
+
if (type === "group") {
|
|
6428
|
+
collectFieldEntriesInto(field.fields, into);
|
|
6429
|
+
continue;
|
|
6430
|
+
}
|
|
6431
|
+
if (type === "sub-tabs") {
|
|
6432
|
+
const tabs = field.tabs;
|
|
6433
|
+
if (Array.isArray(tabs)) {
|
|
6434
|
+
for (const tab of tabs) if (typeof tab === "object" && tab !== null) collectFieldEntriesInto(tab.fields, into);
|
|
6435
|
+
}
|
|
6436
|
+
continue;
|
|
6437
|
+
}
|
|
6438
|
+
const key = field.key;
|
|
6439
|
+
if (typeof key !== "string" || key.length === 0) continue;
|
|
6440
|
+
if (!("value" in field)) continue;
|
|
6441
|
+
into.set(key, {
|
|
6442
|
+
value: field.value,
|
|
6443
|
+
default: field.default
|
|
6444
|
+
});
|
|
6445
|
+
}
|
|
6446
|
+
}
|
|
6447
|
+
/**
|
|
6448
|
+
* Flatten a hydrated settings payload into `key → EFFECTIVE value`
|
|
6449
|
+
* (`value ?? default`). The read-side inverse of `hydrateSchema` for the
|
|
6450
|
+
* common "just give me the resolved values" case. Built on
|
|
6451
|
+
* {@link collectHydratedFieldEntries}.
|
|
6452
|
+
*/
|
|
6453
|
+
function collectHydratedFieldValues(schema) {
|
|
6454
|
+
const out = /* @__PURE__ */ new Map();
|
|
6455
|
+
for (const [key, entry] of collectHydratedFieldEntries(schema)) out.set(key, entry.value ?? entry.default);
|
|
6456
|
+
return out;
|
|
6457
|
+
}
|
|
6381
6458
|
function hydrateSchema(schema, values, options = {}) {
|
|
6382
6459
|
return {
|
|
6383
6460
|
...schema.tabs ? { tabs: [...schema.tabs] } : {},
|
|
@@ -7272,6 +7349,7 @@ var RecordIntegrationInstances = class {
|
|
|
7272
7349
|
this.secretKeys = topLevelSecretKeys(kind.declaration.secretPaths);
|
|
7273
7350
|
this.secretMaps = secretMapKeys(kind.declaration.secretPaths);
|
|
7274
7351
|
this.nameField = kind.declaration.entry?.nameField ?? "name";
|
|
7352
|
+
if (hooks.kindOf === void 0 && hooks.description.kinds.length !== 1) throw new Error(`record kind '${kind.name}': describe().kinds has ${hooks.description.kinds.length} entries, so kindOf is required to say which one an instance is`);
|
|
7275
7353
|
}
|
|
7276
7354
|
/**
|
|
7277
7355
|
* One instance read for the addon's own runtime; null when absent. When the keychain is
|
|
@@ -7313,10 +7391,21 @@ var RecordIntegrationInstances = class {
|
|
|
7313
7391
|
}
|
|
7314
7392
|
return out;
|
|
7315
7393
|
}
|
|
7394
|
+
/** The kind an instance body is of: the provider's `kindOf`, else its one declared kind. */
|
|
7395
|
+
kindOfBody(body) {
|
|
7396
|
+
if (this.hooks.kindOf !== void 0) {
|
|
7397
|
+
const id = this.hooks.kindOf(body);
|
|
7398
|
+
if (!this.hooks.description.kinds.some((declared) => declared.id === id)) throw new Error(`record kind '${this.kind.name}': kindOf returned '${id}', which describe().kinds does not declare (D1013)`);
|
|
7399
|
+
return id;
|
|
7400
|
+
}
|
|
7401
|
+
const only = this.hooks.description.kinds[0];
|
|
7402
|
+
if (only === void 0) throw new Error(`record kind '${this.kind.name}' declares no kinds`);
|
|
7403
|
+
return only.id;
|
|
7404
|
+
}
|
|
7316
7405
|
viewOf(record) {
|
|
7317
7406
|
const shown = secretViewsOf(this.records.owner, this.kind.name, record.id, this.kind.declaration, record.data);
|
|
7318
7407
|
const rawName = record.data[this.nameField];
|
|
7319
|
-
const kind = this.
|
|
7408
|
+
const kind = this.kindOfBody(record.data);
|
|
7320
7409
|
const health = this.hooks.health?.(record.data, record.id);
|
|
7321
7410
|
return {
|
|
7322
7411
|
id: record.id,
|
|
@@ -7324,7 +7413,7 @@ var RecordIntegrationInstances = class {
|
|
|
7324
7413
|
configured: this.hooks.configured(record.data),
|
|
7325
7414
|
enabled: isInstanceEnabled(record.data),
|
|
7326
7415
|
formValues: shown,
|
|
7327
|
-
|
|
7416
|
+
kind,
|
|
7328
7417
|
...health?.status !== void 0 ? { status: health.status } : {},
|
|
7329
7418
|
...health?.lastCheckedAt !== void 0 ? { lastCheckedAt: health.lastCheckedAt } : {}
|
|
7330
7419
|
};
|
|
@@ -7357,17 +7446,35 @@ var RecordIntegrationInstances = class {
|
|
|
7357
7446
|
...kind !== void 0 ? { kind } : {}
|
|
7358
7447
|
});
|
|
7359
7448
|
if (minted === void 0) throw new Error("createInstance needs an id: this provider does not mint one");
|
|
7449
|
+
const initial = this.hooks.initialBody(name, kind);
|
|
7450
|
+
const patch = this.patchOf(values ?? {});
|
|
7451
|
+
if (Object.keys(patch).length > 0) Object.assign(patch, await this.hooks.validateWrite?.({
|
|
7452
|
+
kind,
|
|
7453
|
+
body: {
|
|
7454
|
+
...initial,
|
|
7455
|
+
...patch
|
|
7456
|
+
}
|
|
7457
|
+
}));
|
|
7360
7458
|
await this.handle.put({
|
|
7361
7459
|
id: minted,
|
|
7362
|
-
data:
|
|
7460
|
+
data: initial
|
|
7363
7461
|
}, { ifRev: 0 });
|
|
7364
|
-
const patch = this.patchOf(values ?? {});
|
|
7365
7462
|
if (Object.keys(patch).length > 0) await this.handle.patch(minted, patch);
|
|
7366
7463
|
await this.hooks.onChanged?.(minted, "created");
|
|
7367
7464
|
return { id: minted };
|
|
7368
7465
|
};
|
|
7369
7466
|
updateInstance = async ({ id, name, values }) => {
|
|
7370
7467
|
const patch = this.patchOf(values);
|
|
7468
|
+
if (this.hooks.validateWrite !== void 0 && Object.keys(patch).length > 0) {
|
|
7469
|
+
const stored = await this.handle.get(id);
|
|
7470
|
+
if (stored !== null) Object.assign(patch, await this.hooks.validateWrite({
|
|
7471
|
+
kind: void 0,
|
|
7472
|
+
body: {
|
|
7473
|
+
...stored.data,
|
|
7474
|
+
...patch
|
|
7475
|
+
}
|
|
7476
|
+
}));
|
|
7477
|
+
}
|
|
7371
7478
|
if (name !== void 0) patch[this.nameField] = name;
|
|
7372
7479
|
await this.handle.patch(id, patch);
|
|
7373
7480
|
await this.hooks.onChanged?.(id, "updated");
|
|
@@ -7678,6 +7785,21 @@ var SCOPED_SETTINGS_SCOPES = [
|
|
|
7678
7785
|
"device-defaults",
|
|
7679
7786
|
"node"
|
|
7680
7787
|
];
|
|
7788
|
+
/** The one refusal of a key a scope did not declare. */
|
|
7789
|
+
function assertDeclaredKeys(keys, declared) {
|
|
7790
|
+
const undeclared = keys.filter((key) => !declared.has(key));
|
|
7791
|
+
if (undeclared.length > 0) throw new Error(`scoped settings: [${undeclared.join(", ")}] not declared for this scope (declared: [${[...declared].join(", ")}])`);
|
|
7792
|
+
}
|
|
7793
|
+
/** Build the handle over an addon's scoped read, write and unset. */
|
|
7794
|
+
function createScopedSettings(deps) {
|
|
7795
|
+
return {
|
|
7796
|
+
async get() {
|
|
7797
|
+
return deps.schema.parse(await deps.read());
|
|
7798
|
+
},
|
|
7799
|
+
patch: (patch) => deps.write(Object.fromEntries(Object.entries(patch))),
|
|
7800
|
+
unset: (keys) => deps.unset(keys)
|
|
7801
|
+
};
|
|
7802
|
+
}
|
|
7681
7803
|
/** A write to a secret path could not be stored in the keychain, so it was refused. */
|
|
7682
7804
|
var KeychainWriteRefusedError = class extends Error {
|
|
7683
7805
|
fieldPath;
|
|
@@ -8253,7 +8375,16 @@ function createHandle(raw, opts) {
|
|
|
8253
8375
|
return blob;
|
|
8254
8376
|
}
|
|
8255
8377
|
},
|
|
8256
|
-
writeAddonStore: writeAddon
|
|
8378
|
+
writeAddonStore: writeAddon,
|
|
8379
|
+
removeClearedKeys: (keys) => serialize("addon", async () => {
|
|
8380
|
+
const stored = await readStoredAddonBlob(raw);
|
|
8381
|
+
index.seen("addon", stored);
|
|
8382
|
+
const removable = keys.filter((key) => collectSecretMarkerRefs(stored[key]).length === 0);
|
|
8383
|
+
if (removable.length === 0) return;
|
|
8384
|
+
const patch = Object.fromEntries(removable.map((key) => [key, void 0]));
|
|
8385
|
+
await raw.writeAddonStore(patch);
|
|
8386
|
+
index.wrote("addon", patch);
|
|
8387
|
+
})
|
|
8257
8388
|
};
|
|
8258
8389
|
}
|
|
8259
8390
|
/** The context the addon sees, plus the private raw view and write outcome. */
|
|
@@ -8383,7 +8514,7 @@ function boundOf(list) {
|
|
|
8383
8514
|
* Base class for CamStack addons. Eliminates settings boilerplate:
|
|
8384
8515
|
*
|
|
8385
8516
|
* - Typed `config` property with automatic resolution from store + defaults
|
|
8386
|
-
* -
|
|
8517
|
+
* - the scoped settings API (`clusterSettings` / `nodeSettings` / `deviceDefaults`) auto-implemented
|
|
8387
8518
|
* - `getAddonSettings()` / `updateAddonSettings()` auto-implemented
|
|
8388
8519
|
* - `getDeviceSettings()` / `updateDeviceSettings()` auto-implemented
|
|
8389
8520
|
* - `ctx` accessor for the AddonContext (no manual `this.ctxRef` storage)
|
|
@@ -8393,7 +8524,7 @@ function boundOf(list) {
|
|
|
8393
8524
|
* Subclasses override:
|
|
8394
8525
|
* - `onInitialize()` — addon-specific init logic, return ProviderRegistration[]
|
|
8395
8526
|
* - `onShutdown()` — cleanup
|
|
8396
|
-
* - `
|
|
8527
|
+
* - `clusterSettingsSchema()` / `nodeSettingsSchema()` / `deviceSettingsSchema()` — UI schemas
|
|
8397
8528
|
*
|
|
8398
8529
|
* @example
|
|
8399
8530
|
* ```ts
|
|
@@ -8407,7 +8538,7 @@ function boundOf(list) {
|
|
|
8407
8538
|
* super({ maxRetries: 3, endpoint: 'http://localhost' })
|
|
8408
8539
|
* }
|
|
8409
8540
|
*
|
|
8410
|
-
* protected
|
|
8541
|
+
* protected clusterSettingsSchema() {
|
|
8411
8542
|
* return this.schema({
|
|
8412
8543
|
* sections: [{
|
|
8413
8544
|
* id: 'main', title: 'Settings',
|
|
@@ -8450,7 +8581,7 @@ var BaseAddon = class {
|
|
|
8450
8581
|
defaults;
|
|
8451
8582
|
/**
|
|
8452
8583
|
* Hidden-state paths that hold secrets (D787) — values the addon writes
|
|
8453
|
-
* itself (`
|
|
8584
|
+
* itself (`state()`, the scoped writers) that no form field declares.
|
|
8454
8585
|
* Stored in the keychain exactly like a `password` field. Syntax:
|
|
8455
8586
|
* `'snapshotSigningKey'`, `'identity.pincode'`, `'tokens[userId].accessToken'`
|
|
8456
8587
|
* (`key[<id field>]` addresses array items by id, never by index).
|
|
@@ -8460,7 +8591,7 @@ var BaseAddon = class {
|
|
|
8460
8591
|
/**
|
|
8461
8592
|
* D986 M4: the scoped schemas this addon declared, resolved once per capability
|
|
8462
8593
|
* (`loadScopedSchemas`) so the sync readers (`perNodeKeys`, the secret tree, the restart check)
|
|
8463
|
-
* see them. Empty until loaded
|
|
8594
|
+
* see them. Empty until loaded.
|
|
8464
8595
|
*/
|
|
8465
8596
|
_scopedByCap = /* @__PURE__ */ new Map();
|
|
8466
8597
|
_nodeKeysByCap = /* @__PURE__ */ new Map();
|
|
@@ -8646,7 +8777,7 @@ var BaseAddon = class {
|
|
|
8646
8777
|
/** Addon-specific cleanup. Override if needed. */
|
|
8647
8778
|
async onShutdown() {}
|
|
8648
8779
|
/**
|
|
8649
|
-
* Called after config is resolved during
|
|
8780
|
+
* Called after config is resolved during a settings write.
|
|
8650
8781
|
* Override to react to config changes (e.g. restart a sampler, reconnect a service).
|
|
8651
8782
|
* Not called during initialize() — use onInitialize() for initial setup.
|
|
8652
8783
|
*/
|
|
@@ -8675,82 +8806,12 @@ var BaseAddon = class {
|
|
|
8675
8806
|
scopedSettingsCapabilities() {
|
|
8676
8807
|
return [];
|
|
8677
8808
|
}
|
|
8678
|
-
/** Override to provide global-level settings UI schema. */
|
|
8679
|
-
globalSettingsSchema(_cap) {
|
|
8680
|
-
return null;
|
|
8681
|
-
}
|
|
8682
8809
|
/** Override to provide device-level settings UI schema. */
|
|
8683
8810
|
deviceSettingsSchema() {
|
|
8684
8811
|
return null;
|
|
8685
8812
|
}
|
|
8686
8813
|
/**
|
|
8687
|
-
*
|
|
8688
|
-
* ARE the configuration of its integration.
|
|
8689
|
-
*
|
|
8690
|
-
* Return the `ConfigSection.id`s, from {@link globalSettingsSchema}, that an
|
|
8691
|
-
* operator should find on the addon's integration page (System →
|
|
8692
|
-
* Integrations → <name>) rather than only in the cluster-wide list of every
|
|
8693
|
-
* addon. Empty (the default) means the addon has no integration-level
|
|
8694
|
-
* settings and no such surface is offered — this is opt-in, because whether
|
|
8695
|
-
* an addon's configuration IS its integration's configuration depends on the
|
|
8696
|
-
* nature of the integration.
|
|
8697
|
-
*
|
|
8698
|
-
* WHAT THIS IS NOT. It is not a scope. The selected sections keep living in
|
|
8699
|
-
* the ONE global schema, in the ONE addon store, written by the ONE
|
|
8700
|
-
* `updateGlobalSettings` path. There is deliberately no
|
|
8701
|
-
* `updateIntegrationSettings`: a second write path is how a surface acquires
|
|
8702
|
-
* a second store key, and this repo has shipped that twice (`btmPath@hub`,
|
|
8703
|
-
* D266). Selecting sections cannot introduce a key that selecting cannot.
|
|
8704
|
-
*
|
|
8705
|
-
* WHY IT IS A LIST OF SECTION IDS AND NOT A MARKER ON THE SECTION.
|
|
8706
|
-
* `ConfigFieldBase` used to carry `scope?: 'device' | 'global'` and it was
|
|
8707
|
-
* removed with the reason recorded at
|
|
8708
|
-
* `packages/types/src/interfaces/config-ui.ts:249` — *"a field's scope is
|
|
8709
|
-
* determined by WHICH schema it lives in, not by a field-level marker."* A
|
|
8710
|
-
* marker sprinkled across sections also has to borrow a field that already
|
|
8711
|
-
* means something else; borrowing `section.tab` put the literal word
|
|
8712
|
-
* "integration" into an operator-facing tab bar, because `tab` means "how to
|
|
8713
|
-
* GROUP this visually" and cannot also mean "where this lives" (D269
|
|
8714
|
-
* supersedes D268). One declaration, in one place, next to the schema whose
|
|
8715
|
-
* ids it names.
|
|
8716
|
-
*/
|
|
8717
|
-
integrationSettingSections() {
|
|
8718
|
-
return [];
|
|
8719
|
-
}
|
|
8720
|
-
async getGlobalSettings(overlay, cap, nodeId) {
|
|
8721
|
-
await this.loadScopedSchemas(cap);
|
|
8722
|
-
const schema = this.globalSettingsSchema(cap) ?? this.scopedFormSchema(cap);
|
|
8723
|
-
if (!schema) return { sections: [] };
|
|
8724
|
-
const projected = await this.readRawProjectedStore(nodeId, cap);
|
|
8725
|
-
return hydrateSchema(schema, overlay ? await this.overlayKeepingMarkers(projected, overlay) : projected, { inlineSecretsAsViews: true });
|
|
8726
|
-
}
|
|
8727
|
-
/**
|
|
8728
|
-
* The integration-level view of this addon's settings: exactly the sections
|
|
8729
|
-
* named by {@link integrationSettingSections}, hydrated from the SAME store
|
|
8730
|
-
* `getGlobalSettings` reads, and narrowed to cluster-scoped fields.
|
|
8731
|
-
*
|
|
8732
|
-
* Returns `null` when the addon declared nothing — an addon that opts out has
|
|
8733
|
-
* no integration settings surface at all, rather than an empty one that reads
|
|
8734
|
-
* as a failed load.
|
|
8735
|
-
*
|
|
8736
|
-
* Three properties hold BY CONSTRUCTION, which is why they are here in core
|
|
8737
|
-
* and not in whichever UI happens to render this:
|
|
8738
|
-
*
|
|
8739
|
-
* 1. **One key.** The payload is a SUBSET of the global schema, so a field
|
|
8740
|
-
* shown here is the same field, with the same bare key, that the addon's
|
|
8741
|
-
* own page shows. There is no integration-specific writer — callers save
|
|
8742
|
-
* through `updateGlobalSettings` — so a second store key is unreachable,
|
|
8743
|
-
* not merely discouraged.
|
|
8744
|
-
* 2. **No node scope.** `perNode: true` fields are DROPPED. Their store key
|
|
8745
|
-
* is `<key>@<nodeId>` and an integration is not a node; whichever node
|
|
8746
|
-
* such a field silently picked would be a wrong answer for the operator
|
|
8747
|
-
* who opened the page (D266).
|
|
8748
|
-
* 3. **No silent typo.** A declared id that names no section throws. The
|
|
8749
|
-
* alternative — skip it — turns a rename into a surface that quietly
|
|
8750
|
-
* empties, which looks exactly like an addon with nothing to configure.
|
|
8751
|
-
*/
|
|
8752
|
-
/**
|
|
8753
|
-
* The form schema of ONE integration instance, or `null` to use {@link globalSettingsSchema}.
|
|
8814
|
+
* The form schema of ONE integration instance, or `null` to use the scoped form.
|
|
8754
8815
|
*
|
|
8755
8816
|
* Override it only when an `instanceMode: multiple` addon's instances differ: an NVR integration
|
|
8756
8817
|
* needs its connection fields, the default integration the addon's own sections. It is the
|
|
@@ -8798,37 +8859,178 @@ var BaseAddon = class {
|
|
|
8798
8859
|
}
|
|
8799
8860
|
}
|
|
8800
8861
|
/**
|
|
8862
|
+
* Hook: values layered over the stored ones when the FORM of one scope is served
|
|
8863
|
+
* ({@link getScopedSettings}) — a preview that derives dependent options without writing.
|
|
8864
|
+
* Never applied to {@link ScopedSettings.get} or to a write. `null` ⇒ no overlay.
|
|
8865
|
+
*/
|
|
8866
|
+
async scopedSettingsOverlay(_scope, _cap, _nodeId) {
|
|
8867
|
+
return null;
|
|
8868
|
+
}
|
|
8869
|
+
/**
|
|
8870
|
+
* Hook: a write of one scope changed stored values (not called when the store reports no change,
|
|
8871
|
+
* e.g. the write-back of a stored secret). `keys` are the bare field keys of the write, node keys included.
|
|
8872
|
+
*/
|
|
8873
|
+
async onScopedSettingsChanged(_scope, _cap, _keys) {}
|
|
8874
|
+
/** Typed handle over the CLUSTER settings `cap` declares (`clusterSettingsSchema`). */
|
|
8875
|
+
clusterSettings(cap, schema) {
|
|
8876
|
+
return this.scopedHandle("cluster", cap, schema);
|
|
8877
|
+
}
|
|
8878
|
+
/** Typed handle over the fleet defaults of the per-device settings `cap` declares. */
|
|
8879
|
+
deviceDefaults(cap, schema) {
|
|
8880
|
+
return this.scopedHandle("device-defaults", cap, schema);
|
|
8881
|
+
}
|
|
8882
|
+
/**
|
|
8883
|
+
* Typed handle over the settings `cap` owns PER NODE. `nodeId` omitted ⇒ the local node. A node
|
|
8884
|
+
* with no row yields the schema defaults — never a bare-key fallback.
|
|
8885
|
+
*/
|
|
8886
|
+
nodeSettings(cap, schema, nodeId) {
|
|
8887
|
+
return this.scopedHandle("node", cap, schema, nodeId);
|
|
8888
|
+
}
|
|
8889
|
+
/**
|
|
8890
|
+
* {@link state} for a value that is kept per node: stored under `<key>@<nodeId>`, and the
|
|
8891
|
+
* settings store carries `nodeId` in the row data (D986 §1), so a forgotten node's rows go in one
|
|
8892
|
+
* central delete. `nodeId` omitted ⇒ the local node.
|
|
8893
|
+
*/
|
|
8894
|
+
nodeState(key, schema, fallback, nodeId) {
|
|
8895
|
+
this._declaredStateKeys.add(key);
|
|
8896
|
+
return createDurableState({
|
|
8897
|
+
key: nodeScopedKey(key, nodeId ?? this._ctx?.kernel?.localNodeId ?? ""),
|
|
8898
|
+
schema,
|
|
8899
|
+
fallback,
|
|
8900
|
+
read: async () => this.resolveStoredSecrets(await this.readAddonStoreWithRetry()),
|
|
8901
|
+
write: async (patch) => {
|
|
8902
|
+
await this._ctx?.settings?.writeAddonStore(patch);
|
|
8903
|
+
},
|
|
8904
|
+
onParseError: (k, e) => this._ctx?.logger?.warn?.(`durable-state: stored "${k}" failed validation — using fallback`, { meta: {
|
|
8905
|
+
addonId: this._ctx?.id,
|
|
8906
|
+
key: k,
|
|
8907
|
+
error: String(e)
|
|
8908
|
+
} })
|
|
8909
|
+
});
|
|
8910
|
+
}
|
|
8911
|
+
/** The loaded schema `cap` declares for `scope`, or `null`. */
|
|
8912
|
+
async declaredScopedSchema(scope, cap) {
|
|
8913
|
+
await this.loadScopedSchemas(cap);
|
|
8914
|
+
return this.loadedScopedSchemas(cap).find((entry) => entry.scope === scope)?.schema ?? null;
|
|
8915
|
+
}
|
|
8916
|
+
async requireScopedSchema(scope, cap) {
|
|
8917
|
+
const schema = await this.declaredScopedSchema(scope, cap);
|
|
8918
|
+
if (schema === null) throw new Error(`${this.constructor.name}: cap "${cap}" declares no ${scope} settings`);
|
|
8919
|
+
return schema;
|
|
8920
|
+
}
|
|
8921
|
+
scopedKeys(schema) {
|
|
8922
|
+
return new Set(schema.sections.flatMap((section) => collectValueFieldKeys(section.fields)));
|
|
8923
|
+
}
|
|
8924
|
+
/** `store` narrowed to the keys `schema` declares. */
|
|
8925
|
+
narrowToScope(store, schema) {
|
|
8926
|
+
const keys = this.scopedKeys(schema);
|
|
8927
|
+
return Object.fromEntries(Object.entries(store).filter(([key]) => keys.has(key)));
|
|
8928
|
+
}
|
|
8929
|
+
scopedHandle(scope, cap, schema, nodeId) {
|
|
8930
|
+
return createScopedSettings({
|
|
8931
|
+
schema,
|
|
8932
|
+
read: async () => {
|
|
8933
|
+
const declared = await this.requireScopedSchema(scope, cap);
|
|
8934
|
+
const stored = this.narrowToScope(await this.resolveGlobalStore(nodeId, cap), declared);
|
|
8935
|
+
const effective = collectHydratedFieldValues(hydrateSchema(declared, stored));
|
|
8936
|
+
return {
|
|
8937
|
+
...Object.fromEntries([...effective].filter(([, value]) => value !== void 0)),
|
|
8938
|
+
...stored
|
|
8939
|
+
};
|
|
8940
|
+
},
|
|
8941
|
+
write: (patch) => this.writeScoped(scope, cap, patch, nodeId),
|
|
8942
|
+
unset: (keys) => this.unsetScoped(scope, cap, keys, nodeId)
|
|
8943
|
+
});
|
|
8944
|
+
}
|
|
8945
|
+
/** The one write path of the scoped API: declared keys only, then the global patch. */
|
|
8946
|
+
async writeScoped(scope, cap, patch, nodeId) {
|
|
8947
|
+
assertDeclaredKeys(Object.keys(patch), this.scopedKeys(await this.requireScopedSchema(scope, cap)));
|
|
8948
|
+
if (await this.applyGlobalPatch(patch, scope === "node" ? nodeId : void 0, cap)) await this.onScopedSettingsChanged(scope, cap, Object.keys(patch));
|
|
8949
|
+
}
|
|
8950
|
+
/**
|
|
8951
|
+
* Remove declared keys of one scope. A secret goes through {@link clearSecrets} — its keychain
|
|
8952
|
+
* value is released exactly as there — and the emptied row is then removed; every other key is
|
|
8953
|
+
* removed by an `undefined` patch (which a secret transform would read as "keep").
|
|
8954
|
+
*/
|
|
8955
|
+
async unsetScoped(scope, cap, keys, nodeId) {
|
|
8956
|
+
assertDeclaredKeys(keys, this.scopedKeys(await this.requireScopedSchema(scope, cap)));
|
|
8957
|
+
const target = scope === "node" ? nodeId : void 0;
|
|
8958
|
+
const tree = this.addonSecretTree();
|
|
8959
|
+
const secretKeys = keys.filter((key) => tree.has(key));
|
|
8960
|
+
const plainKeys = keys.filter((key) => !tree.has(key));
|
|
8961
|
+
let changed = false;
|
|
8962
|
+
if (plainKeys.length > 0) {
|
|
8963
|
+
const patch = Object.fromEntries(plainKeys.map((key) => [key, void 0]));
|
|
8964
|
+
changed = await this.applyGlobalPatch(patch, target, cap) || changed;
|
|
8965
|
+
}
|
|
8966
|
+
if (secretKeys.length > 0) {
|
|
8967
|
+
await this.clearSecretKeys(secretKeys, target, cap);
|
|
8968
|
+
const node = normalizeNodeId(target ?? this._ctx?.kernel?.localNodeId);
|
|
8969
|
+
const rows = secretKeys.map((key) => scope === "node" ? nodeScopedKey(key, node) : key);
|
|
8970
|
+
if (this._secretSettings !== null) await this._secretSettings.removeClearedKeys(rows);
|
|
8971
|
+
else await this._ctx?.settings?.writeAddonStore(Object.fromEntries(rows.map((row) => [row, void 0])));
|
|
8972
|
+
changed = true;
|
|
8973
|
+
}
|
|
8974
|
+
if (changed) await this.onScopedSettingsChanged(scope, cap, [...keys]);
|
|
8975
|
+
}
|
|
8976
|
+
/**
|
|
8977
|
+
* The hydrated form of one scope of one capability's settings (any
|
|
8978
|
+
* {@link scopedSettingsOverlay} applied), or `null` when the capability declares nothing there.
|
|
8979
|
+
*/
|
|
8980
|
+
async getScopedSettings(scope, cap, nodeId) {
|
|
8981
|
+
const schema = await this.declaredScopedSchema(scope, cap);
|
|
8982
|
+
if (schema === null) return null;
|
|
8983
|
+
const stored = this.narrowToScope(await this.readRawProjectedStore(nodeId, cap), schema);
|
|
8984
|
+
const overlay = await this.scopedSettingsOverlay(scope, cap, nodeId);
|
|
8985
|
+
return hydrateSchema(schema, overlay ? await this.overlayKeepingMarkers(stored, overlay) : stored, { inlineSecretsAsViews: true });
|
|
8986
|
+
}
|
|
8987
|
+
/**
|
|
8988
|
+
* The scoped schemas this addon serves: one entry per loaded (capability, scope), capabilities
|
|
8989
|
+
* in declaration order, scopes in {@link SCOPED_SETTINGS_SCOPES} order. `[]` when it declares
|
|
8990
|
+
* nothing.
|
|
8991
|
+
*/
|
|
8992
|
+
async listScopedSettings() {
|
|
8993
|
+
await this.loadScopedSchemas();
|
|
8994
|
+
return [...this._scopedByCap].flatMap(([cap, entries]) => entries.map((entry) => ({
|
|
8995
|
+
cap,
|
|
8996
|
+
scope: entry.scope,
|
|
8997
|
+
sectionIds: entry.schema.sections.map((section) => section.id)
|
|
8998
|
+
})));
|
|
8999
|
+
}
|
|
9000
|
+
/** The OPERATOR's write of declared keys of one scope (D787 secret semantics). */
|
|
9001
|
+
async updateScopedSettings(scope, cap, patch, nodeId) {
|
|
9002
|
+
this._operatorWriteDepth++;
|
|
9003
|
+
try {
|
|
9004
|
+
await this.writeScoped(scope, cap, patch, nodeId);
|
|
9005
|
+
} finally {
|
|
9006
|
+
this._operatorWriteDepth--;
|
|
9007
|
+
}
|
|
9008
|
+
}
|
|
9009
|
+
/**
|
|
9010
|
+
* The effective values (`stored ?? default`) of one scope, a secret as its `set` view — never
|
|
9011
|
+
* its value. `null` when the capability declares nothing for the scope.
|
|
9012
|
+
*/
|
|
9013
|
+
async readScopedValues(scope, cap, nodeId) {
|
|
9014
|
+
const schema = await this.declaredScopedSchema(scope, cap);
|
|
9015
|
+
if (schema === null) return null;
|
|
9016
|
+
const form = hydrateSchema(schema, this.narrowToScope(await this.readRawProjectedStore(nodeId, cap), schema), { inlineSecretsAsViews: true });
|
|
9017
|
+
return Object.fromEntries([...collectHydratedFieldValues(form)].filter(([, value]) => value !== void 0));
|
|
9018
|
+
}
|
|
9019
|
+
/**
|
|
8801
9020
|
* What the create wizard and the integration edit page render for one instance: the addon's
|
|
8802
9021
|
* per-instance schema when it declares one, else its global schema (what they always showed).
|
|
8803
9022
|
*/
|
|
8804
9023
|
async getIntegrationFormSchema(instance, nodeId) {
|
|
8805
9024
|
const scoped = await this.integrationFormSchema(instance);
|
|
8806
|
-
if (scoped === null) return this.
|
|
9025
|
+
if (scoped === null) return this.scopedForm(nodeId);
|
|
8807
9026
|
return hydrateSchema(scoped, {}, { inlineSecretsAsViews: true });
|
|
8808
9027
|
}
|
|
8809
|
-
|
|
8810
|
-
|
|
8811
|
-
|
|
8812
|
-
const schema = this.
|
|
8813
|
-
if (!schema)
|
|
8814
|
-
|
|
8815
|
-
const sections = [];
|
|
8816
|
-
for (const id of declared) {
|
|
8817
|
-
const section = byId.get(id);
|
|
8818
|
-
if (!section) throw new Error(`${this.constructor.name}: integrationSettingSections() names unknown section "${id}". Known sections: [${[...byId.keys()].join(", ")}].`);
|
|
8819
|
-
const fields = dropPerNodeFields(section.fields);
|
|
8820
|
-
if (fields.length === 0) continue;
|
|
8821
|
-
sections.push({
|
|
8822
|
-
...section,
|
|
8823
|
-
fields
|
|
8824
|
-
});
|
|
8825
|
-
}
|
|
8826
|
-
if (sections.length === 0) return null;
|
|
8827
|
-
const projected = await this.readRawProjectedStore(nodeId);
|
|
8828
|
-
return hydrateSchema({
|
|
8829
|
-
...schema,
|
|
8830
|
-
sections
|
|
8831
|
-
}, projected, { inlineSecretsAsViews: true });
|
|
9028
|
+
/** The form of the scoped schemas this addon declared, hydrated from its store. */
|
|
9029
|
+
async scopedForm(nodeId) {
|
|
9030
|
+
await this.loadScopedSchemas();
|
|
9031
|
+
const schema = this.scopedFormSchema();
|
|
9032
|
+
if (!schema) return { sections: [] };
|
|
9033
|
+
return hydrateSchema(schema, await this.readRawProjectedStore(nodeId), { inlineSecretsAsViews: true });
|
|
8832
9034
|
}
|
|
8833
9035
|
/**
|
|
8834
9036
|
* The raw addon store PROJECTED onto the target node's bare per-node keys:
|
|
@@ -8837,8 +9039,8 @@ var BaseAddon = class {
|
|
|
8837
9039
|
* bare fallback), all `@`-scoped and stray bare per-node keys are dropped.
|
|
8838
9040
|
* A no-op passthrough when the schema declares no `perNode` field.
|
|
8839
9041
|
*
|
|
8840
|
-
* This is the sanctioned way for
|
|
8841
|
-
* the store for custom
|
|
9042
|
+
* This is the sanctioned way for an addon that needs
|
|
9043
|
+
* the store for custom logic (option narrowing, value snapping) to
|
|
8842
9044
|
* read it per-node — never `ctx.settings.readAddonStore()` directly.
|
|
8843
9045
|
* `nodeId` omitted ⇒ the local node (node-blind injection from ctx).
|
|
8844
9046
|
*
|
|
@@ -8890,7 +9092,7 @@ var BaseAddon = class {
|
|
|
8890
9092
|
}
|
|
8891
9093
|
/**
|
|
8892
9094
|
* Whether ONE global key of this addon's store was written, read three-way
|
|
8893
|
-
* (D651). For a question a hydrated view cannot answer:
|
|
9095
|
+
* (D651). For a question a hydrated view cannot answer: a hydrated form
|
|
8894
9096
|
* reports `value ?? default`, so "the operator chose the default" and "nobody
|
|
8895
9097
|
* chose" look the same, and a failed read looks like both. A `perNode` key is
|
|
8896
9098
|
* not supported here: its stored name is scoped.
|
|
@@ -8924,7 +9126,7 @@ var BaseAddon = class {
|
|
|
8924
9126
|
}
|
|
8925
9127
|
/**
|
|
8926
9128
|
* The OPERATOR's write — a settings form or an admin API call, dispatched by
|
|
8927
|
-
* the kernel.
|
|
9129
|
+
* the kernel. The one in-process write of the addon blob that is not a scoped write; a secret
|
|
8928
9130
|
* the operator sends is stored as sent even when it equals a pre-keychain
|
|
8929
9131
|
* inline value: the operator re-entering a password is a change, an addon
|
|
8930
9132
|
* writing back what it read is not (D787).
|
|
@@ -8937,9 +9139,6 @@ var BaseAddon = class {
|
|
|
8937
9139
|
this._operatorWriteDepth--;
|
|
8938
9140
|
}
|
|
8939
9141
|
}
|
|
8940
|
-
async updateGlobalSettings(patch, nodeId) {
|
|
8941
|
-
await this.applyGlobalPatch(patch, nodeId);
|
|
8942
|
-
}
|
|
8943
9142
|
/**
|
|
8944
9143
|
* REMOVE stored secrets — their keychain values and their markers (D787).
|
|
8945
9144
|
*
|
|
@@ -8949,6 +9148,9 @@ var BaseAddon = class {
|
|
|
8949
9148
|
* a keychain (an older kernel) it writes `''`, as such code always did.
|
|
8950
9149
|
*/
|
|
8951
9150
|
async clearSecrets(keys, nodeId) {
|
|
9151
|
+
await this.clearSecretKeys(keys, nodeId);
|
|
9152
|
+
}
|
|
9153
|
+
async clearSecretKeys(keys, nodeId, cap) {
|
|
8952
9154
|
const tree = this.addonSecretTree();
|
|
8953
9155
|
const keychain = this._ctx?.secrets !== void 0;
|
|
8954
9156
|
const stored = keychain ? await this.readAddonStoreWithRetry() : {};
|
|
@@ -8961,25 +9163,26 @@ var BaseAddon = class {
|
|
|
8961
9163
|
const keychainStored = tree.has(key) || collectSecretMarkerRefs(stored[key]).length > 0;
|
|
8962
9164
|
patch[key] = keychain && keychainStored ? SECRET_CLEAR : "";
|
|
8963
9165
|
}
|
|
8964
|
-
await this.applyGlobalPatch(patch, nodeId);
|
|
9166
|
+
await this.applyGlobalPatch(patch, nodeId, cap);
|
|
8965
9167
|
}
|
|
8966
|
-
|
|
8967
|
-
|
|
8968
|
-
|
|
9168
|
+
/** Resolves `true` when the write changed stored values. */
|
|
9169
|
+
async applyGlobalPatch(barePatch, nodeId, cap) {
|
|
9170
|
+
await this.loadScopedSchemas(cap);
|
|
9171
|
+
const keys = this.perNodeKeys(cap);
|
|
8969
9172
|
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
8970
9173
|
const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
8971
9174
|
const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
|
|
8972
9175
|
const handle = this._secretSettings;
|
|
8973
9176
|
if (handle !== null) {
|
|
8974
9177
|
const { changed } = await handle.writeAddonStore(scoped);
|
|
8975
|
-
if (!changed) return;
|
|
9178
|
+
if (!changed) return false;
|
|
8976
9179
|
} else await this._ctx?.settings?.writeAddonStore(scoped);
|
|
8977
|
-
if (target !== localNode) return;
|
|
9180
|
+
if (target !== localNode) return true;
|
|
8978
9181
|
await this.resolveConfig();
|
|
8979
9182
|
await this.onConfigChanged();
|
|
8980
9183
|
this.emitLifecycle(EventCategory.AddonUpdated, { level: "global" });
|
|
8981
|
-
|
|
8982
|
-
|
|
9184
|
+
this.maybeAutoRestart(Object.keys(barePatch), this.loadedScopedSchemas().map((entry) => entry.schema));
|
|
9185
|
+
return true;
|
|
8983
9186
|
}
|
|
8984
9187
|
/**
|
|
8985
9188
|
* The set of field keys the global settings schema declares `perNode: true`
|
|
@@ -9016,10 +9219,7 @@ var BaseAddon = class {
|
|
|
9016
9219
|
this._nodeKeysByCap = /* @__PURE__ */ new Map();
|
|
9017
9220
|
this._addonSecretTree = null;
|
|
9018
9221
|
}
|
|
9019
|
-
/**
|
|
9020
|
-
* The form the settings API serves while an addon declares no {@link globalSettingsSchema}: the
|
|
9021
|
-
* sections of its scoped schemas, so dropping the old hook does not blank the form.
|
|
9022
|
-
*/
|
|
9222
|
+
/** The form of an addon's scoped schemas: their sections, each shown once. */
|
|
9023
9223
|
scopedFormSchema(cap) {
|
|
9024
9224
|
const byId = /* @__PURE__ */ new Map();
|
|
9025
9225
|
for (const entry of this.loadedScopedSchemas(cap)) for (const section of entry.schema.sections) if (!byId.has(section.id)) byId.set(section.id, section);
|
|
@@ -9031,8 +9231,7 @@ var BaseAddon = class {
|
|
|
9031
9231
|
return [...this._scopedByCap.values()].flat();
|
|
9032
9232
|
}
|
|
9033
9233
|
/**
|
|
9034
|
-
* The field keys that are stored per node: every field of a {@link nodeSettingsSchema}
|
|
9035
|
-
* the fields the legacy {@link globalSettingsSchema} still marks `perNode: true`. Derived once
|
|
9234
|
+
* The field keys that are stored per node: every field of a {@link nodeSettingsSchema}. Derived once
|
|
9036
9235
|
* per `cap` argument and memoized (schemas are static declarations). Empty set ⇒ every
|
|
9037
9236
|
* per-node code path is bypassed and the settings API behaves like the node-agnostic one.
|
|
9038
9237
|
* Call {@link loadScopedSchemas} first (the async seams do).
|
|
@@ -9041,8 +9240,7 @@ var BaseAddon = class {
|
|
|
9041
9240
|
const cacheKey = cap ?? "";
|
|
9042
9241
|
const cached = this._nodeKeysByCap.get(cacheKey);
|
|
9043
9242
|
if (cached) return cached;
|
|
9044
|
-
const
|
|
9045
|
-
const keys = new Set(legacy ? legacy.sections.flatMap((section) => collectPerNodeFieldKeys(section.fields)) : []);
|
|
9243
|
+
const keys = /* @__PURE__ */ new Set();
|
|
9046
9244
|
for (const { scope, schema } of this.loadedScopedSchemas(cap)) {
|
|
9047
9245
|
if (scope !== "node") continue;
|
|
9048
9246
|
for (const section of schema.sections) for (const key of collectValueFieldKeys(section.fields)) keys.add(key);
|
|
@@ -9260,8 +9458,6 @@ var BaseAddon = class {
|
|
|
9260
9458
|
}
|
|
9261
9459
|
declaredKeySet() {
|
|
9262
9460
|
const keys = new Set(Object.keys(this.defaults));
|
|
9263
|
-
const schema = this.globalSettingsSchema();
|
|
9264
|
-
if (schema) for (const section of schema.sections) for (const key of collectFieldKeys(section.fields)) keys.add(key);
|
|
9265
9461
|
for (const { schema: scoped } of this.loadedScopedSchemas()) for (const section of scoped.sections) for (const key of collectFieldKeys(section.fields)) keys.add(key);
|
|
9266
9462
|
for (const key of this._declaredStateKeys) keys.add(key);
|
|
9267
9463
|
for (const path of this.secretStatePaths) {
|
|
@@ -9359,7 +9555,7 @@ var BaseAddon = class {
|
|
|
9359
9555
|
/** The addon store's secret tree: schema fields by TYPE, plus `secretStatePaths`. */
|
|
9360
9556
|
addonSecretTree() {
|
|
9361
9557
|
if (this._addonSecretTree === null) {
|
|
9362
|
-
const tree = new Map(
|
|
9558
|
+
const tree = /* @__PURE__ */ new Map();
|
|
9363
9559
|
for (const { schema } of this.loadedScopedSchemas()) for (const [key, node] of secretTreeFromSchema(schema)) tree.set(key, node);
|
|
9364
9560
|
this._addonSecretTree = mergeSecretStatePaths(tree, this.secretStatePaths);
|
|
9365
9561
|
}
|
|
@@ -9571,47 +9767,6 @@ function classifyStoreError(err) {
|
|
|
9571
9767
|
if (TRANSPORT_PHRASES.some((f) => message.includes(f))) return "transport";
|
|
9572
9768
|
return "permanent";
|
|
9573
9769
|
}
|
|
9574
|
-
/**
|
|
9575
|
-
* Collect the keys of every field marked `perNode: true`, recursing into
|
|
9576
|
-
* layout containers (`group` fields and `sub-tabs` tabs) the same way
|
|
9577
|
-
* `hydrateSchema` does. Valueless structural fields (separator/info/…)
|
|
9578
|
-
* don't declare `perNode` and are excluded by the `in` narrowing.
|
|
9579
|
-
*/
|
|
9580
|
-
/**
|
|
9581
|
-
* The same fields with every `perNode: true` one removed, recursing into layout
|
|
9582
|
-
* containers exactly as {@link collectPerNodeFieldKeys} does. A container left
|
|
9583
|
-
* with no child is dropped rather than rendered empty.
|
|
9584
|
-
*
|
|
9585
|
-
* Used by `getIntegrationSettings`: an integration is not a node, so a field
|
|
9586
|
-
* whose store key is `<key>@<nodeId>` has no node to belong to there.
|
|
9587
|
-
*/
|
|
9588
|
-
function dropPerNodeFields(fields) {
|
|
9589
|
-
const kept = [];
|
|
9590
|
-
for (const field of fields) {
|
|
9591
|
-
if (field.type === "group") {
|
|
9592
|
-
const inner = dropPerNodeFields(field.fields);
|
|
9593
|
-
if (inner.length > 0) kept.push({
|
|
9594
|
-
...field,
|
|
9595
|
-
fields: inner
|
|
9596
|
-
});
|
|
9597
|
-
continue;
|
|
9598
|
-
}
|
|
9599
|
-
if (field.type === "sub-tabs") {
|
|
9600
|
-
const tabs = field.tabs.map((tab) => ({
|
|
9601
|
-
...tab,
|
|
9602
|
-
fields: dropPerNodeFields(tab.fields)
|
|
9603
|
-
})).filter((tab) => tab.fields.length > 0);
|
|
9604
|
-
if (tabs.length > 0) kept.push({
|
|
9605
|
-
...field,
|
|
9606
|
-
tabs
|
|
9607
|
-
});
|
|
9608
|
-
continue;
|
|
9609
|
-
}
|
|
9610
|
-
if ("perNode" in field && field.perNode === true) continue;
|
|
9611
|
-
kept.push(field);
|
|
9612
|
-
}
|
|
9613
|
-
return kept;
|
|
9614
|
-
}
|
|
9615
9770
|
/** The keys of the value-holding fields, recursing into layout containers. */
|
|
9616
9771
|
function collectValueFieldKeys(fields) {
|
|
9617
9772
|
const collected = [];
|
|
@@ -9644,21 +9799,6 @@ function collectFieldKeys(fields) {
|
|
|
9644
9799
|
}
|
|
9645
9800
|
return collected;
|
|
9646
9801
|
}
|
|
9647
|
-
function collectPerNodeFieldKeys(fields) {
|
|
9648
|
-
const collected = [];
|
|
9649
|
-
for (const field of fields) {
|
|
9650
|
-
if (field.type === "group") {
|
|
9651
|
-
collected.push(...collectPerNodeFieldKeys(field.fields));
|
|
9652
|
-
continue;
|
|
9653
|
-
}
|
|
9654
|
-
if (field.type === "sub-tabs") {
|
|
9655
|
-
for (const tab of field.tabs) collected.push(...collectPerNodeFieldKeys(tab.fields));
|
|
9656
|
-
continue;
|
|
9657
|
-
}
|
|
9658
|
-
if ("perNode" in field && field.perNode === true) collected.push(field.key);
|
|
9659
|
-
}
|
|
9660
|
-
return collected;
|
|
9661
|
-
}
|
|
9662
9802
|
/**
|
|
9663
9803
|
* Normalize an `ICamstackAddon.initialize()` return value into the
|
|
9664
9804
|
* `AddonInitResult` envelope. Arrays are wrapped into `{ providers }`;
|
|
@@ -10725,7 +10865,6 @@ var CAP_NAMES = Object.freeze([
|
|
|
10725
10865
|
"notifier",
|
|
10726
10866
|
"numeric-sensor",
|
|
10727
10867
|
"oauth-integration",
|
|
10728
|
-
"oidc-connections",
|
|
10729
10868
|
"osd",
|
|
10730
10869
|
"osd-manager",
|
|
10731
10870
|
"pet-feeder",
|
|
@@ -12432,13 +12571,25 @@ Object.freeze({
|
|
|
12432
12571
|
"path": "temperature",
|
|
12433
12572
|
"valueType": "number"
|
|
12434
12573
|
}],
|
|
12435
|
-
"timed-run": [
|
|
12436
|
-
|
|
12437
|
-
|
|
12438
|
-
|
|
12439
|
-
|
|
12440
|
-
|
|
12441
|
-
|
|
12574
|
+
"timed-run": [
|
|
12575
|
+
{
|
|
12576
|
+
"path": "activeUntil",
|
|
12577
|
+
"valueType": "number"
|
|
12578
|
+
},
|
|
12579
|
+
{
|
|
12580
|
+
"path": "requestedBy",
|
|
12581
|
+
"valueType": "string"
|
|
12582
|
+
},
|
|
12583
|
+
{
|
|
12584
|
+
"path": "quickRun.duration",
|
|
12585
|
+
"valueType": "number"
|
|
12586
|
+
},
|
|
12587
|
+
{
|
|
12588
|
+
"path": "quickRun.unit",
|
|
12589
|
+
"valueType": "enum",
|
|
12590
|
+
"enumValues": ["s", "min"]
|
|
12591
|
+
}
|
|
12592
|
+
],
|
|
12442
12593
|
"update": [
|
|
12443
12594
|
{
|
|
12444
12595
|
"path": "currentVersion",
|
|
@@ -12617,8 +12768,7 @@ Object.freeze({
|
|
|
12617
12768
|
"device-provider": { "reloadDevice": 18e4 },
|
|
12618
12769
|
"llm": {
|
|
12619
12770
|
"generate": 6e5,
|
|
12620
|
-
"generateVision": 6e5
|
|
12621
|
-
"testProfile": 6e5
|
|
12771
|
+
"generateVision": 6e5
|
|
12622
12772
|
},
|
|
12623
12773
|
"llm-runtime": {
|
|
12624
12774
|
"complete": 6e5,
|
|
@@ -12677,7 +12827,7 @@ function userError(code, params, englishFallback) {
|
|
|
12677
12827
|
return new CamstackError(code, params, englishFallback);
|
|
12678
12828
|
}
|
|
12679
12829
|
//#endregion
|
|
12680
|
-
//#region ../types/dist/composition-
|
|
12830
|
+
//#region ../types/dist/composition-Bx0JvKUU.mjs
|
|
12681
12831
|
/**
|
|
12682
12832
|
* The ffmpeg build every CamStack node downloads, per platform and arch.
|
|
12683
12833
|
*
|
|
@@ -13839,462 +13989,844 @@ var NodeColorIdSchema = _enum([
|
|
|
13839
13989
|
"node-h"
|
|
13840
13990
|
]);
|
|
13841
13991
|
//#endregion
|
|
13842
|
-
//#region ../types/dist/
|
|
13843
|
-
var SMTP_INBOUND_DEFAULT_PORT = 2525;
|
|
13844
|
-
var SMTP_INBOUND_DEFAULT_DOMAIN = "camstack.local";
|
|
13845
|
-
var SMTP_INBOUND_DEFAULT_MAX_MESSAGE_BYTES = 25 * 1024 * 1024;
|
|
13846
|
-
/** The text excerpt a message carries on the bus. */
|
|
13847
|
-
var SMTP_INBOUND_TEXT_MAX_CHARS = 4096;
|
|
13848
|
-
var PortSchema = number().int().min(1).max(65535);
|
|
13849
|
-
/** A recipient local-part: what stands before the `@`. */
|
|
13850
|
-
var SmtpRecipientSchema = string().min(1).max(64).regex(/^[A-Za-z0-9._+-]+$/);
|
|
13851
|
-
object({
|
|
13852
|
-
port: PortSchema.default(SMTP_INBOUND_DEFAULT_PORT),
|
|
13853
|
-
bindHost: string().min(1).default("0.0.0.0"),
|
|
13854
|
-
domain: string().min(1).default(SMTP_INBOUND_DEFAULT_DOMAIN),
|
|
13855
|
-
requireAuth: boolean().default(true),
|
|
13856
|
-
username: string().default(""),
|
|
13857
|
-
password: string().default("").meta({ secret: true }),
|
|
13858
|
-
starttls: boolean().default(false),
|
|
13859
|
-
maxMessageBytes: number().int().positive().default(SMTP_INBOUND_DEFAULT_MAX_MESSAGE_BYTES)
|
|
13860
|
-
});
|
|
13861
|
-
object({
|
|
13862
|
-
host: string().min(1).nullable(),
|
|
13863
|
-
hostReason: string().nullable(),
|
|
13864
|
-
port: PortSchema,
|
|
13865
|
-
domain: string().min(1),
|
|
13866
|
-
requireAuth: boolean(),
|
|
13867
|
-
username: string(),
|
|
13868
|
-
password: string(),
|
|
13869
|
-
starttls: boolean()
|
|
13870
|
-
});
|
|
13871
|
-
object({
|
|
13872
|
-
recipients: array(SmtpRecipientSchema).min(1),
|
|
13873
|
-
/**
|
|
13874
|
-
* Who is subscribing. A second `subscribe` with the same id REPLACES that subscriber's
|
|
13875
|
-
* recipients (the way a consumer that restarted, or lost a device, declares its set again);
|
|
13876
|
-
* a recipient held by another subscriber is refused with `smtp-inbound/recipient-claimed`.
|
|
13877
|
-
* Absent, the subscriber is anonymous and unique.
|
|
13878
|
-
*/
|
|
13879
|
-
subscriberId: string().min(1).max(64).optional()
|
|
13880
|
-
});
|
|
13881
|
-
var SmtpInboundAttachmentSchema = object({
|
|
13882
|
-
filename: string(),
|
|
13883
|
-
contentType: string(),
|
|
13884
|
-
bytes: number().int().nonnegative()
|
|
13885
|
-
});
|
|
13886
|
-
/** The payload of one `broker.message` (the key is the recipient local-part). */
|
|
13887
|
-
var SmtpInboundMessageSchema = object({
|
|
13888
|
-
/** Monotonic per mailbox; a gap tells a consumer it missed an event. */
|
|
13889
|
-
seq: number().int().positive(),
|
|
13890
|
-
messageId: string(),
|
|
13891
|
-
receivedAt: number().int().nonnegative(),
|
|
13892
|
-
from: string(),
|
|
13893
|
-
to: string(),
|
|
13894
|
-
subject: string(),
|
|
13895
|
-
text: string().max(SMTP_INBOUND_TEXT_MAX_CHARS),
|
|
13896
|
-
attachments: array(SmtpInboundAttachmentSchema)
|
|
13897
|
-
});
|
|
13898
|
-
object({
|
|
13899
|
-
/** The newest seq issued so far (0 before any mail). */
|
|
13900
|
-
lastSeq: number().int().nonnegative(),
|
|
13901
|
-
/** The oldest seq still retained; messages below it are gone. */
|
|
13902
|
-
oldestSeq: number().int().nonnegative(),
|
|
13903
|
-
messages: array(object({
|
|
13904
|
-
key: string(),
|
|
13905
|
-
message: SmtpInboundMessageSchema
|
|
13906
|
-
}))
|
|
13907
|
-
});
|
|
13908
|
-
new Set([
|
|
13909
|
-
"track",
|
|
13910
|
-
"face",
|
|
13911
|
-
"identity",
|
|
13912
|
-
"plate",
|
|
13913
|
-
"vehicle",
|
|
13914
|
-
"scene",
|
|
13915
|
-
"motion",
|
|
13916
|
-
"object",
|
|
13917
|
-
"audio",
|
|
13918
|
-
"mosaic"
|
|
13919
|
-
]);
|
|
13920
|
-
/**
|
|
13921
|
-
* The owner types that are event tables, in the order the event-media resolver
|
|
13922
|
-
* should consider them. Exported so a consumer asking "is this key an event?"
|
|
13923
|
-
* does not re-spell the list and drift from it.
|
|
13924
|
-
*/
|
|
13925
|
-
var EVENT_OWNER_TYPES = [
|
|
13926
|
-
"motion",
|
|
13927
|
-
"object",
|
|
13928
|
-
"audio"
|
|
13929
|
-
];
|
|
13930
|
-
/**
|
|
13931
|
-
* The same list as a Zod enum, for the cap inputs that must NAME the table
|
|
13932
|
-
* (D482: `getEventMedia` / `listEventMedia` take an owner, and an owner is
|
|
13933
|
-
* `(table, id)`).
|
|
13934
|
-
*
|
|
13935
|
-
* Built FROM {@link EVENT_OWNER_TYPES} rather than re-spelled: a fourth event
|
|
13936
|
-
* table would otherwise be accepted by the codec and refused at the door, with
|
|
13937
|
-
* nothing failing until a caller asked.
|
|
13938
|
-
*/
|
|
13939
|
-
var EventOwnerTypeSchema = _enum(EVENT_OWNER_TYPES);
|
|
13940
|
-
/** The same list as a Zod enum, for the cap input that carries it. */
|
|
13941
|
-
var MediaPresenceOwnerKindSchema = _enum([...EVENT_OWNER_TYPES, "track"]);
|
|
13942
|
-
new Set(EVENT_OWNER_TYPES);
|
|
13943
|
-
/**
|
|
13944
|
-
* What a published package needs from the rest of the install (D989).
|
|
13945
|
-
*
|
|
13946
|
-
* One published framework package (`@camstack/server`) carries the kernel, the
|
|
13947
|
-
* builtins and the capability contracts, so "which addon runs on which
|
|
13948
|
-
* framework" is a question of version, and the answer is DECLARED by the
|
|
13949
|
-
* package that knows it:
|
|
13950
|
-
*
|
|
13951
|
-
* - an addon says the oldest server it runs on (`requires.server: ">=X"`);
|
|
13952
|
-
* - the server says the oldest addon it works with
|
|
13953
|
-
* (`requires.addons: { "@camstack/addon-x": ">=Y" }`) and the oldest shell
|
|
13954
|
-
* around it (`requires.wrapper: { desktop, image }`);
|
|
13955
|
-
* - a wrapper (the desktop app, the container starter) says which server
|
|
13956
|
-
* range it can host, and reports its own kind and version.
|
|
13957
|
-
*
|
|
13958
|
-
* The publish workflow STAMPS these after the version bump
|
|
13959
|
-
* (`scripts/ci/stamp-requires.mjs`); nobody types a number by hand.
|
|
13960
|
-
*
|
|
13961
|
-
* A requirement that cannot be checked is NOT met: a shell that reports no
|
|
13962
|
-
* version counts as below the minimum, and an unreadable running version is
|
|
13963
|
-
* named in the result (a failed read is never a pass).
|
|
13964
|
-
*/
|
|
13965
|
-
/** `>=MAJOR.MINOR.PATCH[-prerelease]` — the only range shape a requirement uses. */
|
|
13966
|
-
var MinVersionSchema = string().regex(/^>=\d+\.\d+\.\d+(-[0-9A-Za-z.-]+)?$/, "a minimum is written \">=X.Y.Z\"");
|
|
13967
|
-
object({
|
|
13968
|
-
/** The oldest `@camstack/server` this package runs on. */
|
|
13969
|
-
server: MinVersionSchema.optional(),
|
|
13970
|
-
/** The oldest installed version of each named addon package. */
|
|
13971
|
-
addons: record(string(), MinVersionSchema).optional(),
|
|
13972
|
-
/** The oldest shell around the server, per shell kind. */
|
|
13973
|
-
wrapper: object({
|
|
13974
|
-
desktop: MinVersionSchema.optional(),
|
|
13975
|
-
image: MinVersionSchema.optional()
|
|
13976
|
-
}).optional()
|
|
13977
|
-
});
|
|
13978
|
-
/** One unmet requirement; each names the versions on both sides. */
|
|
13979
|
-
var UnmetRequirementSchema = discriminatedUnion("kind", [
|
|
13980
|
-
object({
|
|
13981
|
-
kind: literal("server-too-old"),
|
|
13982
|
-
required: string(),
|
|
13983
|
-
/** `null` — the running server version could not be read. */
|
|
13984
|
-
running: string().nullable()
|
|
13985
|
-
}),
|
|
13986
|
-
object({
|
|
13987
|
-
kind: literal("addon-too-old"),
|
|
13988
|
-
packageName: string(),
|
|
13989
|
-
required: string(),
|
|
13990
|
-
/** `null` — the addon is not installed (or its version is unreadable). */
|
|
13991
|
-
running: string().nullable()
|
|
13992
|
-
}),
|
|
13993
|
-
object({
|
|
13994
|
-
kind: literal("wrapper-too-old"),
|
|
13995
|
-
wrapper: _enum(["desktop", "image"]),
|
|
13996
|
-
required: string(),
|
|
13997
|
-
/** `null` — the wrapper reported no version. */
|
|
13998
|
-
running: string().nullable()
|
|
13999
|
-
})
|
|
14000
|
-
]);
|
|
14001
|
-
var RequiredAddonUpdateSchema = object({
|
|
14002
|
-
packageName: string(),
|
|
14003
|
-
/** The minimum the target server declares. */
|
|
14004
|
-
required: string(),
|
|
14005
|
-
/** What this node has; `null` when the addon is not installed. */
|
|
14006
|
-
installed: string().nullable()
|
|
14007
|
-
});
|
|
14008
|
-
/**
|
|
14009
|
-
* Which integration instance a settings form is for. An addon that serves several instances
|
|
14010
|
-
* (`instanceMode: multiple`) can show a different form per instance — an NVR integration
|
|
14011
|
-
* needs its connection, the default integration needs the addon's own sections.
|
|
14012
|
-
*
|
|
14013
|
-
* - `integrationId` is `null` in the create wizard: nothing exists yet, the operator is
|
|
14014
|
-
* setting up a NEW instance.
|
|
14015
|
-
* - `mode` is the wizard mode of the integration type (`getAvailableTypes`).
|
|
14016
|
-
* - `candidateStableId` is the discovery candidate a wizard was seeded from, if any.
|
|
14017
|
-
*/
|
|
14018
|
-
var IntegrationInstanceRefSchema = object({
|
|
14019
|
-
integrationId: string().nullable(),
|
|
14020
|
-
mode: _enum([
|
|
14021
|
-
"standalone",
|
|
14022
|
-
"account",
|
|
14023
|
-
"broker"
|
|
14024
|
-
]),
|
|
14025
|
-
candidateStableId: string().optional()
|
|
14026
|
-
});
|
|
14027
|
-
/**
|
|
14028
|
-
* notification-output — canonical, capability-gated notification delivery.
|
|
14029
|
-
*
|
|
14030
|
-
* Apprise-derived model (see
|
|
14031
|
-
* `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
|
|
14032
|
-
* callers emit ONE canonical `Notification`; each provider declares a
|
|
14033
|
-
* per-kind capability descriptor (`TargetKind`), and the pure degrade
|
|
14034
|
-
* engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
|
|
14035
|
-
* message to what the kind supports — callers never special-case a service.
|
|
14036
|
-
*
|
|
14037
|
-
* DESIGN DECISIONS (locked):
|
|
14038
|
-
* - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
|
|
14039
|
-
* `setTargetEnabled`), each provider persisting via the `settings-store`
|
|
14040
|
-
* cap. Rationale: the admin UI needs one uniform surface across the
|
|
14041
|
-
* notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
|
|
14042
|
-
* alternative would fork the UI per addon and cannot host the
|
|
14043
|
-
* discovery→adopt flow.
|
|
14044
|
-
* - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
|
|
14045
|
-
* the generated cap-mount auto-`concatCollection`-fans them across every
|
|
14046
|
-
* registered provider (notifiers addon + HA addon) so one catalog is
|
|
14047
|
-
* routable. `send` / `testTarget` / CRUD route to ONE provider by the
|
|
14048
|
-
* `addonId` the generated collection router extracts from the call input.
|
|
14049
|
-
* - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
|
|
14050
|
-
* transformer) + UDS MsgPack both round-trip typed arrays — already used by
|
|
14051
|
-
* `storage` / `storage-provider` / `recording` caps over the same path. No
|
|
14052
|
-
* base64 fallback needed.
|
|
14053
|
-
*
|
|
14054
|
-
* TODO (deferred, closed-set change — separate decision): add
|
|
14055
|
-
* `providerKind: 'notify'` so notification providers surface on the unified
|
|
14056
|
-
* admin "Integrations" page.
|
|
14057
|
-
*/
|
|
13992
|
+
//#region ../types/dist/convert-BAzH15HU.mjs
|
|
14058
13993
|
/**
|
|
14059
|
-
*
|
|
14060
|
-
*
|
|
14061
|
-
|
|
14062
|
-
|
|
14063
|
-
"image",
|
|
14064
|
-
"video",
|
|
14065
|
-
"gif",
|
|
14066
|
-
"audio",
|
|
14067
|
-
"icon"
|
|
14068
|
-
]);
|
|
14069
|
-
/**
|
|
14070
|
-
* A single attachment. Exactly one of `url` (remote source, most adapters
|
|
14071
|
-
* prefer this) or `bytes` (inline source; required for Pushover-style
|
|
14072
|
-
* bytes-only kinds) MUST be present — the degrade engine expresses a
|
|
14073
|
-
* url→bytes fetch as a `needsFetch` directive the adapter executes.
|
|
14074
|
-
*/
|
|
14075
|
-
var AttachmentSchema = object({
|
|
14076
|
-
mediaType: AttachmentMediaTypeSchema,
|
|
14077
|
-
url: string().optional(),
|
|
14078
|
-
bytes: _instanceof(Uint8Array).optional(),
|
|
14079
|
-
mime: string().optional(),
|
|
14080
|
-
name: string().optional()
|
|
14081
|
-
}).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
|
|
14082
|
-
var NotificationFormatSchema = _enum([
|
|
14083
|
-
"text",
|
|
14084
|
-
"markdown",
|
|
14085
|
-
"html"
|
|
14086
|
-
]);
|
|
14087
|
-
/**
|
|
14088
|
-
* The CLOSED icon vocabulary an action button may use.
|
|
14089
|
-
*
|
|
14090
|
-
* A closed set, not a free string, and that is the whole point: an arbitrary
|
|
14091
|
-
* icon name is one that ntfy renders, zentik silently drops, and nobody
|
|
14092
|
-
* notices — the same class of gap as a zone vocabulary nothing produced
|
|
14093
|
-
* ([D35](../../../docs/decisions/adr-0035.md)). Every adapter maps this set or
|
|
14094
|
-
* declares `actionIcons: false` and the degrade engine strips the field.
|
|
14095
|
-
*
|
|
14096
|
-
* Named by INTENT, never by glyph. "check" would tie the vocabulary to one
|
|
14097
|
-
* renderer's icon set; "acknowledge" survives an adapter that draws it
|
|
14098
|
-
* differently.
|
|
14099
|
-
*
|
|
14100
|
-
* ── A TOKEN IS NOT A WIRE VALUE ─────────────────────────────────────
|
|
14101
|
-
*
|
|
14102
|
-
* These names are for US. **No adapter may forward one verbatim.** Each maps
|
|
14103
|
-
* the whole set onto its own renderer's vocabulary through a
|
|
14104
|
-
* `Record<NotificationActionIcon, string>` — a Record, never a lookup with a
|
|
14105
|
-
* fallback, so adding a member here fails every adapter's build until someone
|
|
14106
|
-
* decides its glyph, which is the only place that decision can be made
|
|
14107
|
-
* honestly.
|
|
14108
|
-
*
|
|
14109
|
-
* This paragraph is the bug. Zentik declared `actionIcons: true` and passed
|
|
14110
|
-
* `disarm` straight through; iOS feeds that string to
|
|
14111
|
-
* `UNNotificationActionIcon(systemImageName:)`, `disarm` is not an SF Symbol,
|
|
14112
|
-
* and every snooze and alarm button arrived BLANK. A pass-through is not a
|
|
14113
|
-
* mapping, and "the field is documented" is not "the value renders".
|
|
14114
|
-
*
|
|
14115
|
-
* Adding a member is TRAIN-BOUND. The enum lives in the published
|
|
14116
|
-
* `@camstack/server` closure and the cap seam validates against the HUB's copy,
|
|
14117
|
-
* so an addon that emits a token the running hub does not know does not lose an
|
|
14118
|
-
* icon — its whole `send` fails Zod validation and the notification never
|
|
14119
|
-
* arrives. Never emit a new token from an addon before the train carrying it.
|
|
13994
|
+
* Frozen unit → spec table. `•` in the doc marks each dimension's canonical
|
|
13995
|
+
* unit (`factor: 1, offset: 0`). °F derives from `°C = (°F − 32) × 5/9` ⇒
|
|
13996
|
+
* `factor = 5/9`, `offset = -160/9` (kept as exact expressions, not rounded
|
|
13997
|
+
* decimals). K derives from `°C = K − 273.15`.
|
|
14120
13998
|
*/
|
|
14121
|
-
var
|
|
14122
|
-
"
|
|
14123
|
-
|
|
14124
|
-
|
|
14125
|
-
|
|
14126
|
-
|
|
14127
|
-
"
|
|
14128
|
-
|
|
14129
|
-
|
|
14130
|
-
|
|
14131
|
-
|
|
14132
|
-
|
|
14133
|
-
|
|
14134
|
-
|
|
14135
|
-
|
|
14136
|
-
|
|
14137
|
-
|
|
14138
|
-
|
|
14139
|
-
|
|
14140
|
-
|
|
14141
|
-
|
|
14142
|
-
|
|
14143
|
-
|
|
14144
|
-
|
|
14145
|
-
|
|
14146
|
-
|
|
14147
|
-
|
|
14148
|
-
|
|
14149
|
-
|
|
14150
|
-
|
|
14151
|
-
|
|
14152
|
-
|
|
14153
|
-
|
|
14154
|
-
|
|
14155
|
-
|
|
14156
|
-
|
|
14157
|
-
|
|
14158
|
-
|
|
14159
|
-
|
|
14160
|
-
|
|
14161
|
-
|
|
14162
|
-
|
|
14163
|
-
|
|
14164
|
-
|
|
14165
|
-
|
|
14166
|
-
|
|
14167
|
-
|
|
14168
|
-
|
|
14169
|
-
|
|
14170
|
-
|
|
14171
|
-
|
|
14172
|
-
|
|
14173
|
-
|
|
14174
|
-
|
|
14175
|
-
|
|
14176
|
-
|
|
14177
|
-
|
|
14178
|
-
|
|
14179
|
-
|
|
14180
|
-
|
|
14181
|
-
|
|
14182
|
-
|
|
14183
|
-
|
|
14184
|
-
|
|
14185
|
-
|
|
14186
|
-
|
|
14187
|
-
|
|
14188
|
-
|
|
14189
|
-
|
|
14190
|
-
|
|
14191
|
-
|
|
14192
|
-
|
|
14193
|
-
|
|
14194
|
-
|
|
14195
|
-
|
|
14196
|
-
|
|
14197
|
-
|
|
14198
|
-
|
|
14199
|
-
|
|
14200
|
-
|
|
14201
|
-
|
|
14202
|
-
|
|
14203
|
-
|
|
14204
|
-
|
|
14205
|
-
|
|
14206
|
-
|
|
14207
|
-
|
|
14208
|
-
|
|
14209
|
-
|
|
13999
|
+
var UNIT_TABLE = {
|
|
14000
|
+
"°C": {
|
|
14001
|
+
dimension: "temperature",
|
|
14002
|
+
factor: 1,
|
|
14003
|
+
offset: 0
|
|
14004
|
+
},
|
|
14005
|
+
"°F": {
|
|
14006
|
+
dimension: "temperature",
|
|
14007
|
+
factor: 5 / 9,
|
|
14008
|
+
offset: -160 / 9
|
|
14009
|
+
},
|
|
14010
|
+
K: {
|
|
14011
|
+
dimension: "temperature",
|
|
14012
|
+
factor: 1,
|
|
14013
|
+
offset: -273.15
|
|
14014
|
+
},
|
|
14015
|
+
hPa: {
|
|
14016
|
+
dimension: "pressure",
|
|
14017
|
+
factor: 1,
|
|
14018
|
+
offset: 0
|
|
14019
|
+
},
|
|
14020
|
+
kPa: {
|
|
14021
|
+
dimension: "pressure",
|
|
14022
|
+
factor: 10,
|
|
14023
|
+
offset: 0
|
|
14024
|
+
},
|
|
14025
|
+
Pa: {
|
|
14026
|
+
dimension: "pressure",
|
|
14027
|
+
factor: .01,
|
|
14028
|
+
offset: 0
|
|
14029
|
+
},
|
|
14030
|
+
mbar: {
|
|
14031
|
+
dimension: "pressure",
|
|
14032
|
+
factor: 1,
|
|
14033
|
+
offset: 0
|
|
14034
|
+
},
|
|
14035
|
+
bar: {
|
|
14036
|
+
dimension: "pressure",
|
|
14037
|
+
factor: 1e3,
|
|
14038
|
+
offset: 0
|
|
14039
|
+
},
|
|
14040
|
+
inHg: {
|
|
14041
|
+
dimension: "pressure",
|
|
14042
|
+
factor: 33.8639,
|
|
14043
|
+
offset: 0
|
|
14044
|
+
},
|
|
14045
|
+
mmHg: {
|
|
14046
|
+
dimension: "pressure",
|
|
14047
|
+
factor: 1.33322,
|
|
14048
|
+
offset: 0
|
|
14049
|
+
},
|
|
14050
|
+
psi: {
|
|
14051
|
+
dimension: "pressure",
|
|
14052
|
+
factor: 68.9476,
|
|
14053
|
+
offset: 0
|
|
14054
|
+
},
|
|
14055
|
+
"m/s": {
|
|
14056
|
+
dimension: "speed",
|
|
14057
|
+
factor: 1,
|
|
14058
|
+
offset: 0
|
|
14059
|
+
},
|
|
14060
|
+
"km/h": {
|
|
14061
|
+
dimension: "speed",
|
|
14062
|
+
factor: 1 / 3.6,
|
|
14063
|
+
offset: 0
|
|
14064
|
+
},
|
|
14065
|
+
mph: {
|
|
14066
|
+
dimension: "speed",
|
|
14067
|
+
factor: .44704,
|
|
14068
|
+
offset: 0
|
|
14069
|
+
},
|
|
14070
|
+
kn: {
|
|
14071
|
+
dimension: "speed",
|
|
14072
|
+
factor: .514444,
|
|
14073
|
+
offset: 0
|
|
14074
|
+
},
|
|
14075
|
+
"mm/h": {
|
|
14076
|
+
dimension: "precipitation-rate",
|
|
14077
|
+
factor: 1,
|
|
14078
|
+
offset: 0
|
|
14079
|
+
},
|
|
14080
|
+
"in/h": {
|
|
14081
|
+
dimension: "precipitation-rate",
|
|
14082
|
+
factor: 25.4,
|
|
14083
|
+
offset: 0
|
|
14084
|
+
},
|
|
14085
|
+
m: {
|
|
14086
|
+
dimension: "length",
|
|
14087
|
+
factor: 1,
|
|
14088
|
+
offset: 0
|
|
14089
|
+
},
|
|
14090
|
+
mm: {
|
|
14091
|
+
dimension: "length",
|
|
14092
|
+
factor: .001,
|
|
14093
|
+
offset: 0
|
|
14094
|
+
},
|
|
14095
|
+
cm: {
|
|
14096
|
+
dimension: "length",
|
|
14097
|
+
factor: .01,
|
|
14098
|
+
offset: 0
|
|
14099
|
+
},
|
|
14100
|
+
km: {
|
|
14101
|
+
dimension: "length",
|
|
14102
|
+
factor: 1e3,
|
|
14103
|
+
offset: 0
|
|
14104
|
+
},
|
|
14105
|
+
in: {
|
|
14106
|
+
dimension: "length",
|
|
14107
|
+
factor: .0254,
|
|
14108
|
+
offset: 0
|
|
14109
|
+
},
|
|
14110
|
+
ft: {
|
|
14111
|
+
dimension: "length",
|
|
14112
|
+
factor: .3048,
|
|
14113
|
+
offset: 0
|
|
14114
|
+
},
|
|
14115
|
+
mi: {
|
|
14116
|
+
dimension: "length",
|
|
14117
|
+
factor: 1609.344,
|
|
14118
|
+
offset: 0
|
|
14119
|
+
},
|
|
14120
|
+
"m²": {
|
|
14121
|
+
dimension: "area",
|
|
14122
|
+
factor: 1,
|
|
14123
|
+
offset: 0
|
|
14124
|
+
},
|
|
14125
|
+
lx: {
|
|
14126
|
+
dimension: "illuminance",
|
|
14127
|
+
factor: 1,
|
|
14128
|
+
offset: 0
|
|
14129
|
+
},
|
|
14130
|
+
"W/m²": {
|
|
14131
|
+
dimension: "irradiance",
|
|
14132
|
+
factor: 1,
|
|
14133
|
+
offset: 0
|
|
14134
|
+
},
|
|
14135
|
+
W: {
|
|
14136
|
+
dimension: "power",
|
|
14137
|
+
factor: 1,
|
|
14138
|
+
offset: 0
|
|
14139
|
+
},
|
|
14140
|
+
kW: {
|
|
14141
|
+
dimension: "power",
|
|
14142
|
+
factor: 1e3,
|
|
14143
|
+
offset: 0
|
|
14144
|
+
},
|
|
14145
|
+
VA: {
|
|
14146
|
+
dimension: "apparent-power",
|
|
14147
|
+
factor: 1,
|
|
14148
|
+
offset: 0
|
|
14149
|
+
},
|
|
14150
|
+
Wh: {
|
|
14151
|
+
dimension: "energy",
|
|
14152
|
+
factor: 1,
|
|
14153
|
+
offset: 0
|
|
14154
|
+
},
|
|
14155
|
+
kWh: {
|
|
14156
|
+
dimension: "energy",
|
|
14157
|
+
factor: 1e3,
|
|
14158
|
+
offset: 0
|
|
14159
|
+
},
|
|
14160
|
+
MWh: {
|
|
14161
|
+
dimension: "energy",
|
|
14162
|
+
factor: 1e6,
|
|
14163
|
+
offset: 0
|
|
14164
|
+
},
|
|
14165
|
+
V: {
|
|
14166
|
+
dimension: "voltage",
|
|
14167
|
+
factor: 1,
|
|
14168
|
+
offset: 0
|
|
14169
|
+
},
|
|
14170
|
+
mV: {
|
|
14171
|
+
dimension: "voltage",
|
|
14172
|
+
factor: .001,
|
|
14173
|
+
offset: 0
|
|
14174
|
+
},
|
|
14175
|
+
A: {
|
|
14176
|
+
dimension: "current",
|
|
14177
|
+
factor: 1,
|
|
14178
|
+
offset: 0
|
|
14179
|
+
},
|
|
14180
|
+
mA: {
|
|
14181
|
+
dimension: "current",
|
|
14182
|
+
factor: .001,
|
|
14183
|
+
offset: 0
|
|
14184
|
+
},
|
|
14185
|
+
ppm: {
|
|
14186
|
+
dimension: "concentration-volume",
|
|
14187
|
+
factor: 1,
|
|
14188
|
+
offset: 0
|
|
14189
|
+
},
|
|
14190
|
+
ppb: {
|
|
14191
|
+
dimension: "concentration-volume",
|
|
14192
|
+
factor: .001,
|
|
14193
|
+
offset: 0
|
|
14194
|
+
},
|
|
14195
|
+
"µg/m³": {
|
|
14196
|
+
dimension: "concentration-mass",
|
|
14197
|
+
factor: 1,
|
|
14198
|
+
offset: 0
|
|
14199
|
+
},
|
|
14200
|
+
"mg/m³": {
|
|
14201
|
+
dimension: "concentration-mass",
|
|
14202
|
+
factor: 1e3,
|
|
14203
|
+
offset: 0
|
|
14204
|
+
},
|
|
14205
|
+
kg: {
|
|
14206
|
+
dimension: "mass",
|
|
14207
|
+
factor: 1,
|
|
14208
|
+
offset: 0
|
|
14209
|
+
},
|
|
14210
|
+
g: {
|
|
14211
|
+
dimension: "mass",
|
|
14212
|
+
factor: .001,
|
|
14213
|
+
offset: 0
|
|
14214
|
+
},
|
|
14215
|
+
lb: {
|
|
14216
|
+
dimension: "mass",
|
|
14217
|
+
factor: .453592,
|
|
14218
|
+
offset: 0
|
|
14219
|
+
},
|
|
14220
|
+
oz: {
|
|
14221
|
+
dimension: "mass",
|
|
14222
|
+
factor: .0283495,
|
|
14223
|
+
offset: 0
|
|
14224
|
+
},
|
|
14225
|
+
"%": {
|
|
14226
|
+
dimension: "percentage",
|
|
14227
|
+
factor: 1,
|
|
14228
|
+
offset: 0
|
|
14229
|
+
},
|
|
14230
|
+
L: {
|
|
14231
|
+
dimension: "volume",
|
|
14232
|
+
factor: 1,
|
|
14233
|
+
offset: 0
|
|
14234
|
+
},
|
|
14235
|
+
mL: {
|
|
14236
|
+
dimension: "volume",
|
|
14237
|
+
factor: .001,
|
|
14238
|
+
offset: 0
|
|
14239
|
+
},
|
|
14240
|
+
gal: {
|
|
14241
|
+
dimension: "volume",
|
|
14242
|
+
factor: 3.785411784,
|
|
14243
|
+
offset: 0
|
|
14244
|
+
},
|
|
14245
|
+
s: {
|
|
14246
|
+
dimension: "duration",
|
|
14247
|
+
factor: 1,
|
|
14248
|
+
offset: 0
|
|
14249
|
+
},
|
|
14250
|
+
ms: {
|
|
14251
|
+
dimension: "duration",
|
|
14252
|
+
factor: .001,
|
|
14253
|
+
offset: 0
|
|
14254
|
+
},
|
|
14255
|
+
min: {
|
|
14256
|
+
dimension: "duration",
|
|
14257
|
+
factor: 60,
|
|
14258
|
+
offset: 0
|
|
14259
|
+
},
|
|
14260
|
+
h: {
|
|
14261
|
+
dimension: "duration",
|
|
14262
|
+
factor: 3600,
|
|
14263
|
+
offset: 0
|
|
14264
|
+
},
|
|
14265
|
+
d: {
|
|
14266
|
+
dimension: "duration",
|
|
14267
|
+
factor: 86400,
|
|
14268
|
+
offset: 0
|
|
14269
|
+
},
|
|
14270
|
+
B: {
|
|
14271
|
+
dimension: "information",
|
|
14272
|
+
factor: 1,
|
|
14273
|
+
offset: 0
|
|
14274
|
+
},
|
|
14275
|
+
KiB: {
|
|
14276
|
+
dimension: "information",
|
|
14277
|
+
factor: 1024,
|
|
14278
|
+
offset: 0
|
|
14279
|
+
},
|
|
14280
|
+
MiB: {
|
|
14281
|
+
dimension: "information",
|
|
14282
|
+
factor: 1024 ** 2,
|
|
14283
|
+
offset: 0
|
|
14284
|
+
},
|
|
14285
|
+
GiB: {
|
|
14286
|
+
dimension: "information",
|
|
14287
|
+
factor: 1024 ** 3,
|
|
14288
|
+
offset: 0
|
|
14289
|
+
},
|
|
14290
|
+
TiB: {
|
|
14291
|
+
dimension: "information",
|
|
14292
|
+
factor: 1024 ** 4,
|
|
14293
|
+
offset: 0
|
|
14294
|
+
},
|
|
14295
|
+
kB: {
|
|
14296
|
+
dimension: "information",
|
|
14297
|
+
factor: 1e3,
|
|
14298
|
+
offset: 0
|
|
14299
|
+
},
|
|
14300
|
+
MB: {
|
|
14301
|
+
dimension: "information",
|
|
14302
|
+
factor: 1e6,
|
|
14303
|
+
offset: 0
|
|
14304
|
+
},
|
|
14305
|
+
GB: {
|
|
14306
|
+
dimension: "information",
|
|
14307
|
+
factor: 1e9,
|
|
14308
|
+
offset: 0
|
|
14309
|
+
},
|
|
14310
|
+
"°": {
|
|
14311
|
+
dimension: "angle",
|
|
14312
|
+
factor: 1,
|
|
14313
|
+
offset: 0
|
|
14314
|
+
},
|
|
14315
|
+
dBFS: {
|
|
14316
|
+
dimension: "sound-level",
|
|
14317
|
+
factor: 1,
|
|
14318
|
+
offset: 0
|
|
14319
|
+
},
|
|
14320
|
+
dBm: {
|
|
14321
|
+
dimension: "signal-level",
|
|
14322
|
+
factor: 1,
|
|
14323
|
+
offset: 0
|
|
14324
|
+
},
|
|
14325
|
+
mired: {
|
|
14326
|
+
dimension: "colour-temperature",
|
|
14327
|
+
factor: 1,
|
|
14328
|
+
offset: 0
|
|
14329
|
+
},
|
|
14330
|
+
kbps: {
|
|
14331
|
+
dimension: "bitrate",
|
|
14332
|
+
factor: 1,
|
|
14333
|
+
offset: 0
|
|
14334
|
+
},
|
|
14335
|
+
Mbps: {
|
|
14336
|
+
dimension: "bitrate",
|
|
14337
|
+
factor: 1e3,
|
|
14338
|
+
offset: 0
|
|
14339
|
+
},
|
|
14340
|
+
fps: {
|
|
14341
|
+
dimension: "rate",
|
|
14342
|
+
factor: 1,
|
|
14343
|
+
offset: 0
|
|
14344
|
+
}
|
|
14345
|
+
};
|
|
14346
|
+
/** Resolve a unit's `UnitSpec`, or `undefined` when the spelling is unknown. */
|
|
14347
|
+
function specFor(unit) {
|
|
14348
|
+
return Object.hasOwn(UNIT_TABLE, unit) ? UNIT_TABLE[unit] : void 0;
|
|
14349
|
+
}
|
|
14350
|
+
/** Value in `spec`'s unit → its dimension's canonical unit. */
|
|
14351
|
+
function toCanonical(value, spec) {
|
|
14352
|
+
return value * spec.factor + spec.offset;
|
|
14353
|
+
}
|
|
14354
|
+
/** Canonical-unit value → the unit described by `spec`. */
|
|
14355
|
+
function fromCanonical(canonical, spec) {
|
|
14356
|
+
return (canonical - spec.offset) / spec.factor;
|
|
14357
|
+
}
|
|
14210
14358
|
/**
|
|
14211
|
-
*
|
|
14212
|
-
* `
|
|
14213
|
-
*
|
|
14214
|
-
* the adapter maps this ordinal onto its native level. `level?` is an
|
|
14215
|
-
* optional kind-native level id (`emergency`, `silent`, …) that overrides
|
|
14216
|
-
* `priority` for that one target.
|
|
14359
|
+
* Graceful variant for the render path: returns the converted value, or
|
|
14360
|
+
* `undefined` when the conversion is refused (unknown unit / cross-dimension).
|
|
14361
|
+
* Never throws — a render caller falls back to the raw value + source unit.
|
|
14217
14362
|
*/
|
|
14218
|
-
|
|
14219
|
-
|
|
14220
|
-
|
|
14221
|
-
|
|
14222
|
-
|
|
14223
|
-
|
|
14224
|
-
|
|
14225
|
-
|
|
14226
|
-
|
|
14227
|
-
|
|
14228
|
-
|
|
14229
|
-
|
|
14230
|
-
|
|
14231
|
-
|
|
14232
|
-
|
|
14233
|
-
|
|
14234
|
-
|
|
14235
|
-
|
|
14236
|
-
|
|
14237
|
-
|
|
14238
|
-
|
|
14363
|
+
function tryConvertUnit(value, from, to) {
|
|
14364
|
+
if (from === to) return value;
|
|
14365
|
+
const fromSpec = specFor(from);
|
|
14366
|
+
if (!fromSpec) return void 0;
|
|
14367
|
+
const toSpec = specFor(to);
|
|
14368
|
+
if (!toSpec) return void 0;
|
|
14369
|
+
if (fromSpec.dimension !== toSpec.dimension) return void 0;
|
|
14370
|
+
return fromCanonical(toCanonical(value, fromSpec), toSpec);
|
|
14371
|
+
}
|
|
14372
|
+
//#endregion
|
|
14373
|
+
//#region ../types/dist/index.mjs
|
|
14374
|
+
var SMTP_INBOUND_DEFAULT_PORT = 2525;
|
|
14375
|
+
var SMTP_INBOUND_DEFAULT_DOMAIN = "camstack.local";
|
|
14376
|
+
var SMTP_INBOUND_DEFAULT_MAX_MESSAGE_BYTES = 25 * 1024 * 1024;
|
|
14377
|
+
/** The text excerpt a message carries on the bus. */
|
|
14378
|
+
var SMTP_INBOUND_TEXT_MAX_CHARS = 4096;
|
|
14379
|
+
var PortSchema = number().int().min(1).max(65535);
|
|
14380
|
+
/** A recipient local-part: what stands before the `@`. */
|
|
14381
|
+
var SmtpRecipientSchema = string().min(1).max(64).regex(/^[A-Za-z0-9._+-]+$/);
|
|
14382
|
+
object({
|
|
14383
|
+
port: PortSchema.default(SMTP_INBOUND_DEFAULT_PORT),
|
|
14384
|
+
bindHost: string().min(1).default("0.0.0.0"),
|
|
14385
|
+
domain: string().min(1).default(SMTP_INBOUND_DEFAULT_DOMAIN),
|
|
14386
|
+
requireAuth: boolean().default(true),
|
|
14387
|
+
username: string().default(""),
|
|
14388
|
+
password: string().default("").meta({ secret: true }),
|
|
14389
|
+
starttls: boolean().default(false),
|
|
14390
|
+
maxMessageBytes: number().int().positive().default(SMTP_INBOUND_DEFAULT_MAX_MESSAGE_BYTES)
|
|
14239
14391
|
});
|
|
14240
|
-
|
|
14241
|
-
|
|
14242
|
-
|
|
14243
|
-
|
|
14244
|
-
|
|
14245
|
-
|
|
14246
|
-
|
|
14247
|
-
|
|
14248
|
-
|
|
14249
|
-
noPush: boolean().optional()
|
|
14250
|
-
}).optional(),
|
|
14251
|
-
/** e.g. Pushover `emergency` requires `retry` / `expire`. */
|
|
14252
|
-
requires: array(string()).optional(),
|
|
14253
|
-
description: string().optional()
|
|
14392
|
+
object({
|
|
14393
|
+
host: string().min(1).nullable(),
|
|
14394
|
+
hostReason: string().nullable(),
|
|
14395
|
+
port: PortSchema,
|
|
14396
|
+
domain: string().min(1),
|
|
14397
|
+
requireAuth: boolean(),
|
|
14398
|
+
username: string(),
|
|
14399
|
+
password: string(),
|
|
14400
|
+
starttls: boolean()
|
|
14254
14401
|
});
|
|
14255
|
-
|
|
14256
|
-
|
|
14257
|
-
attachments: object({
|
|
14258
|
-
mediaTypes: array(AttachmentMediaTypeSchema),
|
|
14259
|
-
mode: _enum([
|
|
14260
|
-
"url",
|
|
14261
|
-
"bytes",
|
|
14262
|
-
"both"
|
|
14263
|
-
]),
|
|
14264
|
-
max: number().int().nonnegative(),
|
|
14265
|
-
maxBytes: number().int().positive().optional()
|
|
14266
|
-
}),
|
|
14267
|
-
/** Max action buttons (0 = none). */
|
|
14268
|
-
actions: number().int().nonnegative(),
|
|
14402
|
+
object({
|
|
14403
|
+
recipients: array(SmtpRecipientSchema).min(1),
|
|
14269
14404
|
/**
|
|
14270
|
-
*
|
|
14271
|
-
*
|
|
14272
|
-
*
|
|
14273
|
-
*
|
|
14274
|
-
* this repo that once. Absent is read as false by the degrade engine, which
|
|
14275
|
-
* is the safe direction: an icon that is not rendered costs nothing, an icon
|
|
14276
|
-
* assumed and dropped costs the operator's trust in the field.
|
|
14405
|
+
* Who is subscribing. A second `subscribe` with the same id REPLACES that subscriber's
|
|
14406
|
+
* recipients (the way a consumer that restarted, or lost a device, declares its set again);
|
|
14407
|
+
* a recipient held by another subscriber is refused with `smtp-inbound/recipient-claimed`.
|
|
14408
|
+
* Absent, the subscriber is anonymous and unique.
|
|
14277
14409
|
*/
|
|
14278
|
-
|
|
14279
|
-
levels: array(TargetKindLevelSchema),
|
|
14280
|
-
format: array(NotificationFormatSchema),
|
|
14281
|
-
clickUrl: boolean(),
|
|
14282
|
-
sound: boolean(),
|
|
14283
|
-
ttl: boolean(),
|
|
14284
|
-
bodyMaxLen: number().int().positive()
|
|
14410
|
+
subscriberId: string().min(1).max(64).optional()
|
|
14285
14411
|
});
|
|
14286
|
-
|
|
14287
|
-
|
|
14288
|
-
|
|
14289
|
-
|
|
14290
|
-
|
|
14291
|
-
|
|
14292
|
-
|
|
14293
|
-
|
|
14294
|
-
|
|
14295
|
-
|
|
14296
|
-
|
|
14297
|
-
|
|
14412
|
+
var SmtpInboundAttachmentSchema = object({
|
|
14413
|
+
filename: string(),
|
|
14414
|
+
contentType: string(),
|
|
14415
|
+
bytes: number().int().nonnegative()
|
|
14416
|
+
});
|
|
14417
|
+
/** The payload of one `broker.message` (the key is the recipient local-part). */
|
|
14418
|
+
var SmtpInboundMessageSchema = object({
|
|
14419
|
+
/** Monotonic per mailbox; a gap tells a consumer it missed an event. */
|
|
14420
|
+
seq: number().int().positive(),
|
|
14421
|
+
messageId: string(),
|
|
14422
|
+
receivedAt: number().int().nonnegative(),
|
|
14423
|
+
from: string(),
|
|
14424
|
+
to: string(),
|
|
14425
|
+
subject: string(),
|
|
14426
|
+
text: string().max(SMTP_INBOUND_TEXT_MAX_CHARS),
|
|
14427
|
+
attachments: array(SmtpInboundAttachmentSchema)
|
|
14428
|
+
});
|
|
14429
|
+
object({
|
|
14430
|
+
/** The newest seq issued so far (0 before any mail). */
|
|
14431
|
+
lastSeq: number().int().nonnegative(),
|
|
14432
|
+
/** The oldest seq still retained; messages below it are gone. */
|
|
14433
|
+
oldestSeq: number().int().nonnegative(),
|
|
14434
|
+
messages: array(object({
|
|
14435
|
+
key: string(),
|
|
14436
|
+
message: SmtpInboundMessageSchema
|
|
14437
|
+
}))
|
|
14438
|
+
});
|
|
14439
|
+
new Set([
|
|
14440
|
+
"track",
|
|
14441
|
+
"face",
|
|
14442
|
+
"identity",
|
|
14443
|
+
"plate",
|
|
14444
|
+
"vehicle",
|
|
14445
|
+
"scene",
|
|
14446
|
+
"motion",
|
|
14447
|
+
"object",
|
|
14448
|
+
"audio",
|
|
14449
|
+
"mosaic"
|
|
14450
|
+
]);
|
|
14451
|
+
/**
|
|
14452
|
+
* The owner types that are event tables, in the order the event-media resolver
|
|
14453
|
+
* should consider them. Exported so a consumer asking "is this key an event?"
|
|
14454
|
+
* does not re-spell the list and drift from it.
|
|
14455
|
+
*/
|
|
14456
|
+
var EVENT_OWNER_TYPES = [
|
|
14457
|
+
"motion",
|
|
14458
|
+
"object",
|
|
14459
|
+
"audio"
|
|
14460
|
+
];
|
|
14461
|
+
/**
|
|
14462
|
+
* The same list as a Zod enum, for the cap inputs that must NAME the table
|
|
14463
|
+
* (D482: `getEventMedia` / `listEventMedia` take an owner, and an owner is
|
|
14464
|
+
* `(table, id)`).
|
|
14465
|
+
*
|
|
14466
|
+
* Built FROM {@link EVENT_OWNER_TYPES} rather than re-spelled: a fourth event
|
|
14467
|
+
* table would otherwise be accepted by the codec and refused at the door, with
|
|
14468
|
+
* nothing failing until a caller asked.
|
|
14469
|
+
*/
|
|
14470
|
+
var EventOwnerTypeSchema = _enum(EVENT_OWNER_TYPES);
|
|
14471
|
+
/** The same list as a Zod enum, for the cap input that carries it. */
|
|
14472
|
+
var MediaPresenceOwnerKindSchema = _enum([...EVENT_OWNER_TYPES, "track"]);
|
|
14473
|
+
new Set(EVENT_OWNER_TYPES);
|
|
14474
|
+
/**
|
|
14475
|
+
* What a published package needs from the rest of the install (D989).
|
|
14476
|
+
*
|
|
14477
|
+
* One published framework package (`@camstack/server`) carries the kernel, the
|
|
14478
|
+
* builtins and the capability contracts, so "which addon runs on which
|
|
14479
|
+
* framework" is a question of version, and the answer is DECLARED by the
|
|
14480
|
+
* package that knows it:
|
|
14481
|
+
*
|
|
14482
|
+
* - an addon says the oldest server it runs on (`requires.server: ">=X"`);
|
|
14483
|
+
* - the server says the oldest addon it works with
|
|
14484
|
+
* (`requires.addons: { "@camstack/addon-x": ">=Y" }`) and the oldest shell
|
|
14485
|
+
* around it (`requires.wrapper: { desktop, image }`);
|
|
14486
|
+
* - a wrapper (the desktop app, the container starter) says which server
|
|
14487
|
+
* range it can host, and reports its own kind and version.
|
|
14488
|
+
*
|
|
14489
|
+
* The publish workflow STAMPS these after the version bump
|
|
14490
|
+
* (`scripts/ci/stamp-requires.mjs`); nobody types a number by hand.
|
|
14491
|
+
*
|
|
14492
|
+
* A requirement that cannot be checked is NOT met: a shell that reports no
|
|
14493
|
+
* version counts as below the minimum, and an unreadable running version is
|
|
14494
|
+
* named in the result (a failed read is never a pass).
|
|
14495
|
+
*/
|
|
14496
|
+
/** `>=MAJOR.MINOR.PATCH[-prerelease]` — the only range shape a requirement uses. */
|
|
14497
|
+
var MinVersionSchema = string().regex(/^>=\d+\.\d+\.\d+(-[0-9A-Za-z.-]+)?$/, "a minimum is written \">=X.Y.Z\"");
|
|
14498
|
+
object({
|
|
14499
|
+
/** The oldest `@camstack/server` this package runs on. */
|
|
14500
|
+
server: MinVersionSchema.optional(),
|
|
14501
|
+
/** The oldest installed version of each named addon package. */
|
|
14502
|
+
addons: record(string(), MinVersionSchema).optional(),
|
|
14503
|
+
/** The oldest shell around the server, per shell kind. */
|
|
14504
|
+
wrapper: object({
|
|
14505
|
+
desktop: MinVersionSchema.optional(),
|
|
14506
|
+
image: MinVersionSchema.optional()
|
|
14507
|
+
}).optional()
|
|
14508
|
+
});
|
|
14509
|
+
/** One unmet requirement; each names the versions on both sides. */
|
|
14510
|
+
var UnmetRequirementSchema = discriminatedUnion("kind", [
|
|
14511
|
+
object({
|
|
14512
|
+
kind: literal("server-too-old"),
|
|
14513
|
+
required: string(),
|
|
14514
|
+
/** `null` — the running server version could not be read. */
|
|
14515
|
+
running: string().nullable()
|
|
14516
|
+
}),
|
|
14517
|
+
object({
|
|
14518
|
+
kind: literal("addon-too-old"),
|
|
14519
|
+
packageName: string(),
|
|
14520
|
+
required: string(),
|
|
14521
|
+
/** `null` — the addon is not installed (or its version is unreadable). */
|
|
14522
|
+
running: string().nullable()
|
|
14523
|
+
}),
|
|
14524
|
+
object({
|
|
14525
|
+
kind: literal("wrapper-too-old"),
|
|
14526
|
+
wrapper: _enum(["desktop", "image"]),
|
|
14527
|
+
required: string(),
|
|
14528
|
+
/** `null` — the wrapper reported no version. */
|
|
14529
|
+
running: string().nullable()
|
|
14530
|
+
})
|
|
14531
|
+
]);
|
|
14532
|
+
var RequiredAddonUpdateSchema = object({
|
|
14533
|
+
packageName: string(),
|
|
14534
|
+
/** The minimum the target server declares. */
|
|
14535
|
+
required: string(),
|
|
14536
|
+
/** What this node has; `null` when the addon is not installed. */
|
|
14537
|
+
installed: string().nullable()
|
|
14538
|
+
});
|
|
14539
|
+
/**
|
|
14540
|
+
* Which integration instance a settings form is for. An addon that serves several instances
|
|
14541
|
+
* (`instanceMode: multiple`) can show a different form per instance — an NVR integration
|
|
14542
|
+
* needs its connection, the default integration needs the addon's own sections.
|
|
14543
|
+
*
|
|
14544
|
+
* - `integrationId` is `null` in the create wizard: nothing exists yet, the operator is
|
|
14545
|
+
* setting up a NEW instance.
|
|
14546
|
+
* - `mode` is the wizard mode of the integration type (`getAvailableTypes`).
|
|
14547
|
+
* - `candidateStableId` is the discovery candidate a wizard was seeded from, if any.
|
|
14548
|
+
*/
|
|
14549
|
+
var IntegrationInstanceRefSchema = object({
|
|
14550
|
+
integrationId: string().nullable(),
|
|
14551
|
+
mode: _enum([
|
|
14552
|
+
"standalone",
|
|
14553
|
+
"account",
|
|
14554
|
+
"broker"
|
|
14555
|
+
]),
|
|
14556
|
+
candidateStableId: string().optional()
|
|
14557
|
+
});
|
|
14558
|
+
/**
|
|
14559
|
+
* notification-output — canonical, capability-gated notification delivery.
|
|
14560
|
+
*
|
|
14561
|
+
* Apprise-derived model (see
|
|
14562
|
+
* `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
|
|
14563
|
+
* callers emit ONE canonical `Notification`; each provider declares a
|
|
14564
|
+
* per-kind capability descriptor (`TargetKind`), and the pure degrade
|
|
14565
|
+
* engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
|
|
14566
|
+
* message to what the kind supports — callers never special-case a service.
|
|
14567
|
+
*
|
|
14568
|
+
* DESIGN DECISIONS (locked):
|
|
14569
|
+
* - A target is an INSTANCE of this function cap (epic #440, step 6): the
|
|
14570
|
+
* providers serve their targets as `integration-instances` records, one
|
|
14571
|
+
* record kind per target kind, and the admin lists, adds, edits, switches
|
|
14572
|
+
* and deletes them through that cap. This cap keeps what an instance cannot
|
|
14573
|
+
* say: the kind catalogue (`listTargetKinds`: capabilities, delivery
|
|
14574
|
+
* parameters, brand icon), dispatch (`send`, `testTarget`) and the form
|
|
14575
|
+
* helpers (`discoverTargets`, `probeTargetConfig`).
|
|
14576
|
+
* - `listTargetKinds` / `discoverTargets` return arrays → the generated
|
|
14577
|
+
* cap-mount auto-`concatCollection`-fans them across every registered
|
|
14578
|
+
* provider so one catalog is routable. `send` / `testTarget` /
|
|
14579
|
+
* `probeTargetConfig` route to ONE provider by the `addonId` the generated
|
|
14580
|
+
* collection router extracts from the call input.
|
|
14581
|
+
* - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
|
|
14582
|
+
* transformer) + UDS MsgPack both round-trip typed arrays — already used by
|
|
14583
|
+
* `storage` / `storage-provider` / `recording` caps over the same path. No
|
|
14584
|
+
* base64 fallback needed.
|
|
14585
|
+
*
|
|
14586
|
+
* TODO (deferred, closed-set change — separate decision): add
|
|
14587
|
+
* `providerKind: 'notify'` so notification providers surface on the unified
|
|
14588
|
+
* admin "Integrations" page.
|
|
14589
|
+
*/
|
|
14590
|
+
/**
|
|
14591
|
+
* Zentik-derived typed-media enum — the superset across every kind. Each
|
|
14592
|
+
* adapter picks what it supports and the degrade engine filters the rest.
|
|
14593
|
+
*/
|
|
14594
|
+
var AttachmentMediaTypeSchema = _enum([
|
|
14595
|
+
"image",
|
|
14596
|
+
"video",
|
|
14597
|
+
"gif",
|
|
14598
|
+
"audio",
|
|
14599
|
+
"icon"
|
|
14600
|
+
]);
|
|
14601
|
+
/**
|
|
14602
|
+
* A single attachment. Exactly one of `url` (remote source, most adapters
|
|
14603
|
+
* prefer this) or `bytes` (inline source; required for Pushover-style
|
|
14604
|
+
* bytes-only kinds) MUST be present — the degrade engine expresses a
|
|
14605
|
+
* url→bytes fetch as a `needsFetch` directive the adapter executes.
|
|
14606
|
+
*/
|
|
14607
|
+
var AttachmentSchema = object({
|
|
14608
|
+
mediaType: AttachmentMediaTypeSchema,
|
|
14609
|
+
url: string().optional(),
|
|
14610
|
+
bytes: _instanceof(Uint8Array).optional(),
|
|
14611
|
+
mime: string().optional(),
|
|
14612
|
+
name: string().optional()
|
|
14613
|
+
}).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
|
|
14614
|
+
var NotificationFormatSchema = _enum([
|
|
14615
|
+
"text",
|
|
14616
|
+
"markdown",
|
|
14617
|
+
"html"
|
|
14618
|
+
]);
|
|
14619
|
+
/**
|
|
14620
|
+
* The CLOSED icon vocabulary an action button may use.
|
|
14621
|
+
*
|
|
14622
|
+
* A closed set, not a free string, and that is the whole point: an arbitrary
|
|
14623
|
+
* icon name is one that ntfy renders, zentik silently drops, and nobody
|
|
14624
|
+
* notices — the same class of gap as a zone vocabulary nothing produced
|
|
14625
|
+
* ([D35](../../../docs/decisions/adr-0035.md)). Every adapter maps this set or
|
|
14626
|
+
* declares `actionIcons: false` and the degrade engine strips the field.
|
|
14627
|
+
*
|
|
14628
|
+
* Named by INTENT, never by glyph. "check" would tie the vocabulary to one
|
|
14629
|
+
* renderer's icon set; "acknowledge" survives an adapter that draws it
|
|
14630
|
+
* differently.
|
|
14631
|
+
*
|
|
14632
|
+
* ── A TOKEN IS NOT A WIRE VALUE ─────────────────────────────────────
|
|
14633
|
+
*
|
|
14634
|
+
* These names are for US. **No adapter may forward one verbatim.** Each maps
|
|
14635
|
+
* the whole set onto its own renderer's vocabulary through a
|
|
14636
|
+
* `Record<NotificationActionIcon, string>` — a Record, never a lookup with a
|
|
14637
|
+
* fallback, so adding a member here fails every adapter's build until someone
|
|
14638
|
+
* decides its glyph, which is the only place that decision can be made
|
|
14639
|
+
* honestly.
|
|
14640
|
+
*
|
|
14641
|
+
* This paragraph is the bug. Zentik declared `actionIcons: true` and passed
|
|
14642
|
+
* `disarm` straight through; iOS feeds that string to
|
|
14643
|
+
* `UNNotificationActionIcon(systemImageName:)`, `disarm` is not an SF Symbol,
|
|
14644
|
+
* and every snooze and alarm button arrived BLANK. A pass-through is not a
|
|
14645
|
+
* mapping, and "the field is documented" is not "the value renders".
|
|
14646
|
+
*
|
|
14647
|
+
* Adding a member is TRAIN-BOUND. The enum lives in the published
|
|
14648
|
+
* `@camstack/server` closure and the cap seam validates against the HUB's copy,
|
|
14649
|
+
* so an addon that emits a token the running hub does not know does not lose an
|
|
14650
|
+
* icon — its whole `send` fails Zod validation and the notification never
|
|
14651
|
+
* arrives. Never emit a new token from an addon before the train carrying it.
|
|
14652
|
+
*/
|
|
14653
|
+
var NotificationActionIconSchema = _enum([
|
|
14654
|
+
"acknowledge",
|
|
14655
|
+
"dismiss",
|
|
14656
|
+
"silence",
|
|
14657
|
+
"snooze",
|
|
14658
|
+
"view",
|
|
14659
|
+
"play",
|
|
14660
|
+
"open",
|
|
14661
|
+
"close",
|
|
14662
|
+
"lock",
|
|
14663
|
+
"unlock",
|
|
14664
|
+
"arm",
|
|
14665
|
+
"arm-home",
|
|
14666
|
+
"arm-away",
|
|
14667
|
+
"arm-night",
|
|
14668
|
+
"disarm",
|
|
14669
|
+
"light",
|
|
14670
|
+
"alert",
|
|
14671
|
+
"camera"
|
|
14672
|
+
]);
|
|
14673
|
+
/** A single tap-through action button. */
|
|
14674
|
+
var NotificationActionSchema = object({
|
|
14675
|
+
id: string(),
|
|
14676
|
+
label: string(),
|
|
14677
|
+
url: string().optional(),
|
|
14678
|
+
/** Dropped by the degrade engine for a kind with `caps.actionIcons: false`. */
|
|
14679
|
+
icon: NotificationActionIconSchema.optional(),
|
|
14680
|
+
/**
|
|
14681
|
+
* Renders in a warning style where the notifier supports it.
|
|
14682
|
+
*
|
|
14683
|
+
* A HINT, never a gate. The callback's authority is its token and nothing
|
|
14684
|
+
* else — see `notification-center/action-token.ts` for what that does and
|
|
14685
|
+
* does not buy.
|
|
14686
|
+
*/
|
|
14687
|
+
destructive: boolean().optional(),
|
|
14688
|
+
/**
|
|
14689
|
+
* How the tap should REACH the url.
|
|
14690
|
+
*
|
|
14691
|
+
* `navigate` (absent, and every button authored before this field) opens it:
|
|
14692
|
+
* the phone leaves the notification and shows whatever the callback returns.
|
|
14693
|
+
* That is right for a button whose answer the operator wants to read.
|
|
14694
|
+
*
|
|
14695
|
+
* `background` fires it as a POST and stays put. It exists for the buttons
|
|
14696
|
+
* whose whole point is not to interrupt — "silence this for 30 minutes" is
|
|
14697
|
+
* an answer to the notification, and being thrown into a browser tab to
|
|
14698
|
+
* confirm it costs more attention than the notification did. A backend that
|
|
14699
|
+
* cannot do a background call renders it as an ordinary link (the adapters
|
|
14700
|
+
* fall back rather than dropping the button), so this is a preference, never
|
|
14701
|
+
* a requirement.
|
|
14702
|
+
*/
|
|
14703
|
+
mode: _enum(["navigate", "background"]).optional()
|
|
14704
|
+
});
|
|
14705
|
+
/** A delivery parameter value: what a notifier declared it takes. */
|
|
14706
|
+
var DeliveryParamValueSchema = union([
|
|
14707
|
+
string(),
|
|
14708
|
+
number(),
|
|
14709
|
+
boolean()
|
|
14710
|
+
]);
|
|
14711
|
+
/**
|
|
14712
|
+
* One extra delivery parameter a notifier KIND declares (D938). A rule that
|
|
14713
|
+
* addresses a target of that kind may set it; a kind that declares nothing is
|
|
14714
|
+
* never handed one. The admin UI derives its control from this descriptor —
|
|
14715
|
+
* no editor knows a service by name.
|
|
14716
|
+
*
|
|
14717
|
+
* Optional fields are `.optional()`, never `.default()` (a Zod default does not
|
|
14718
|
+
* run on the addon cap path).
|
|
14719
|
+
*/
|
|
14720
|
+
var DeliveryParamSchema = object({
|
|
14721
|
+
key: string().min(1),
|
|
14722
|
+
label: string(),
|
|
14723
|
+
/** i18n key of the label, resolved by the declaring addon's namespace. */
|
|
14724
|
+
labelKey: string().optional(),
|
|
14725
|
+
type: _enum([
|
|
14726
|
+
"enum",
|
|
14727
|
+
"number",
|
|
14728
|
+
"boolean",
|
|
14729
|
+
"string"
|
|
14730
|
+
]),
|
|
14731
|
+
/** `enum` only: the closed set of accepted values. */
|
|
14732
|
+
options: array(object({
|
|
14733
|
+
value: string(),
|
|
14734
|
+
label: string()
|
|
14735
|
+
})).optional(),
|
|
14736
|
+
/** `number` only. */
|
|
14737
|
+
min: number().optional(),
|
|
14738
|
+
max: number().optional(),
|
|
14739
|
+
/** What the notifier does when the rule sets nothing; shown as the placeholder. */
|
|
14740
|
+
default: DeliveryParamValueSchema.optional()
|
|
14741
|
+
});
|
|
14742
|
+
/**
|
|
14743
|
+
* The canonical notification. `body` is the only hard field (Apprise model).
|
|
14744
|
+
* `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
|
|
14745
|
+
* NOT a fixed severity enum — each kind declares its own `caps.levels` and
|
|
14746
|
+
* the adapter maps this ordinal onto its native level. `level?` is an
|
|
14747
|
+
* optional kind-native level id (`emergency`, `silent`, …) that overrides
|
|
14748
|
+
* `priority` for that one target.
|
|
14749
|
+
*/
|
|
14750
|
+
var NotificationSchema = object({
|
|
14751
|
+
body: string(),
|
|
14752
|
+
title: string().optional(),
|
|
14753
|
+
format: NotificationFormatSchema.default("text"),
|
|
14754
|
+
priority: number().int().min(1).max(5).default(3),
|
|
14755
|
+
level: string().optional(),
|
|
14756
|
+
attachments: array(AttachmentSchema).optional(),
|
|
14757
|
+
clickUrl: string().optional(),
|
|
14758
|
+
actions: array(NotificationActionSchema).optional(),
|
|
14759
|
+
sound: string().optional(),
|
|
14760
|
+
ttl: number().optional(),
|
|
14761
|
+
tag: string().optional(),
|
|
14762
|
+
deviceId: number().optional(),
|
|
14763
|
+
eventId: string().optional(),
|
|
14764
|
+
metadata: record(string(), unknown()).optional(),
|
|
14765
|
+
/**
|
|
14766
|
+
* Values for the parameters the target's kind DECLARES in
|
|
14767
|
+
* {@link TargetKindSchema} `deliveryParams`. Already validated against the
|
|
14768
|
+
* declaration by the sender; a notifier reads only the keys it declared.
|
|
14769
|
+
*/
|
|
14770
|
+
delivery: record(string(), DeliveryParamValueSchema).optional()
|
|
14771
|
+
});
|
|
14772
|
+
/** One declared native severity/priority level for a kind. */
|
|
14773
|
+
var TargetKindLevelSchema = object({
|
|
14774
|
+
id: string(),
|
|
14775
|
+
label: string(),
|
|
14776
|
+
/** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
|
|
14777
|
+
ordinal: number().int().min(1).max(5).nullable(),
|
|
14778
|
+
flags: object({
|
|
14779
|
+
critical: boolean().optional(),
|
|
14780
|
+
silent: boolean().optional(),
|
|
14781
|
+
noPush: boolean().optional()
|
|
14782
|
+
}).optional(),
|
|
14783
|
+
/** e.g. Pushover `emergency` requires `retry` / `expire`. */
|
|
14784
|
+
requires: array(string()).optional(),
|
|
14785
|
+
description: string().optional()
|
|
14786
|
+
});
|
|
14787
|
+
/** The full capability block consulted before dispatch. */
|
|
14788
|
+
var TargetKindCapsSchema = object({
|
|
14789
|
+
attachments: object({
|
|
14790
|
+
mediaTypes: array(AttachmentMediaTypeSchema),
|
|
14791
|
+
mode: _enum([
|
|
14792
|
+
"url",
|
|
14793
|
+
"bytes",
|
|
14794
|
+
"both"
|
|
14795
|
+
]),
|
|
14796
|
+
max: number().int().nonnegative(),
|
|
14797
|
+
maxBytes: number().int().positive().optional()
|
|
14798
|
+
}),
|
|
14799
|
+
/** Max action buttons (0 = none). */
|
|
14800
|
+
actions: number().int().nonnegative(),
|
|
14801
|
+
/**
|
|
14802
|
+
* Whether this kind renders a per-action ICON.
|
|
14803
|
+
*
|
|
14804
|
+
* `.optional()`, deliberately NOT `.default(false)`: a Zod default does not
|
|
14805
|
+
* run on the addon cap path — three production failures in one day taught
|
|
14806
|
+
* this repo that once. Absent is read as false by the degrade engine, which
|
|
14807
|
+
* is the safe direction: an icon that is not rendered costs nothing, an icon
|
|
14808
|
+
* assumed and dropped costs the operator's trust in the field.
|
|
14809
|
+
*/
|
|
14810
|
+
actionIcons: boolean().optional(),
|
|
14811
|
+
levels: array(TargetKindLevelSchema),
|
|
14812
|
+
format: array(NotificationFormatSchema),
|
|
14813
|
+
clickUrl: boolean(),
|
|
14814
|
+
sound: boolean(),
|
|
14815
|
+
ttl: boolean(),
|
|
14816
|
+
bodyMaxLen: number().int().positive()
|
|
14817
|
+
});
|
|
14818
|
+
/**
|
|
14819
|
+
* `configSchema` is a `ConfigUISchema` tree passed through to the admin
|
|
14820
|
+
* FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
|
|
14821
|
+
* `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
|
|
14822
|
+
* the union is large and not meant for runtime validation here; the exported
|
|
14823
|
+
* `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
|
|
14824
|
+
*/
|
|
14825
|
+
var ConfigSchemaPassthrough$3 = unknown();
|
|
14826
|
+
var TargetKindSchema = object({
|
|
14827
|
+
kind: string(),
|
|
14828
|
+
label: string(),
|
|
14829
|
+
icon: string(),
|
|
14298
14830
|
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
14299
14831
|
addonId: string(),
|
|
14300
14832
|
/**
|
|
@@ -14327,7 +14859,7 @@ var TargetKindSchema = object({
|
|
|
14327
14859
|
* its raster path, which is the safe default for an unknown image.
|
|
14328
14860
|
*/
|
|
14329
14861
|
iconMediaType: string().optional(),
|
|
14330
|
-
configSchema: ConfigSchemaPassthrough$
|
|
14862
|
+
configSchema: ConfigSchemaPassthrough$3,
|
|
14331
14863
|
/**
|
|
14332
14864
|
* The config keys that decide WHERE this kind's secrets are sent (server,
|
|
14333
14865
|
* base URL, instance, chat, recipient). A save that changes any of them
|
|
@@ -14349,9 +14881,11 @@ var TargetKindSchema = object({
|
|
|
14349
14881
|
caps: TargetKindCapsSchema
|
|
14350
14882
|
});
|
|
14351
14883
|
/**
|
|
14352
|
-
* A
|
|
14353
|
-
*
|
|
14354
|
-
*
|
|
14884
|
+
* A target as a provider's own code sees it (the notification-center bridge, the
|
|
14885
|
+
* send path): the flat record body split into the name, the switch and the
|
|
14886
|
+
* kind's fields. `config` holds secrets; a reader that serves it to a client
|
|
14887
|
+
* REDACTS secret fields (a presence marker only) — never round-trip a stored
|
|
14888
|
+
* secret to the UI.
|
|
14355
14889
|
*/
|
|
14356
14890
|
var TargetSchema = object({
|
|
14357
14891
|
id: string(),
|
|
@@ -14394,13 +14928,13 @@ var ProbeTargetConfigResultSchema = object({
|
|
|
14394
14928
|
stateInstance: string().optional(),
|
|
14395
14929
|
error: string().optional()
|
|
14396
14930
|
});
|
|
14397
|
-
method(object({}), array(TargetKindSchema)), method(object({
|
|
14931
|
+
method(object({}), array(TargetKindSchema)), method(object({
|
|
14398
14932
|
kind: string(),
|
|
14399
14933
|
config: record(string(), unknown()).optional(),
|
|
14400
14934
|
/**
|
|
14401
14935
|
* When editing / duplicating, the blank password field never round-trips
|
|
14402
14936
|
* the stored token. Pass the source target id so the provider can restore
|
|
14403
|
-
* secrets server-side before dialling
|
|
14937
|
+
* secrets server-side before dialling.
|
|
14404
14938
|
*/
|
|
14405
14939
|
targetId: string().optional()
|
|
14406
14940
|
}), array(DiscoveredTargetSchema), { auth: "admin" }), method(object({
|
|
@@ -14423,27 +14957,6 @@ method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSche
|
|
|
14423
14957
|
}), TestResultSchema, {
|
|
14424
14958
|
kind: "mutation",
|
|
14425
14959
|
auth: "admin"
|
|
14426
|
-
}), method(object({
|
|
14427
|
-
target: TargetSchema,
|
|
14428
|
-
/**
|
|
14429
|
-
* Duplicate flow: create a NEW target id while copying secrets from an
|
|
14430
|
-
* existing row. The UI never holds the stored token; blank / redacted
|
|
14431
|
-
* password fields are restored from this source (D634 still applies if
|
|
14432
|
-
* destinations diverge without a re-typed secret).
|
|
14433
|
-
*/
|
|
14434
|
-
cloneSecretsFrom: string().optional()
|
|
14435
|
-
}), TargetSchema, {
|
|
14436
|
-
kind: "mutation",
|
|
14437
|
-
auth: "admin"
|
|
14438
|
-
}), method(object({ targetId: string() }), _void(), {
|
|
14439
|
-
kind: "mutation",
|
|
14440
|
-
auth: "admin"
|
|
14441
|
-
}), method(object({
|
|
14442
|
-
targetId: string(),
|
|
14443
|
-
enabled: boolean()
|
|
14444
|
-
}), _void(), {
|
|
14445
|
-
kind: "mutation",
|
|
14446
|
-
auth: "admin"
|
|
14447
14960
|
});
|
|
14448
14961
|
looseObject({
|
|
14449
14962
|
name: string().min(1),
|
|
@@ -23344,7 +23857,6 @@ var SYSTEM_CAP_VOCABULARY = {
|
|
|
23344
23857
|
"notification-output": system("notification delivery — reached through notifier devices and rules"),
|
|
23345
23858
|
"notification-rules": system("notification rules — authored on their own page"),
|
|
23346
23859
|
"oauth-integration": system(IDENTITY),
|
|
23347
|
-
"oidc-connections": system(IDENTITY),
|
|
23348
23860
|
"osd-manager": system(PIPELINE),
|
|
23349
23861
|
"pipeline-executor": system(PIPELINE),
|
|
23350
23862
|
"pipeline-orchestrator": system(PIPELINE),
|
|
@@ -43152,722 +43664,344 @@ var ICON_SYNONYMS = {
|
|
|
43152
43664
|
"deposito",
|
|
43153
43665
|
"cantina",
|
|
43154
43666
|
"warehouse"
|
|
43155
|
-
],
|
|
43156
|
-
"washing-machine": [
|
|
43157
|
-
"lavatrice",
|
|
43158
|
-
"lavastoviglie",
|
|
43159
|
-
"asciugatrice"
|
|
43160
|
-
],
|
|
43161
|
-
waves: [
|
|
43162
|
-
"onde",
|
|
43163
|
-
"acqua",
|
|
43164
|
-
"vibrazione"
|
|
43165
|
-
],
|
|
43166
|
-
"waves-ladder": [
|
|
43167
|
-
"piscina",
|
|
43168
|
-
"vasca",
|
|
43169
|
-
"pool"
|
|
43170
|
-
],
|
|
43171
|
-
wifi: ["rete", "segnale"],
|
|
43172
|
-
"wifi-off": [
|
|
43173
|
-
"wifi",
|
|
43174
|
-
"assente",
|
|
43175
|
-
"offline",
|
|
43176
|
-
"disconnesso"
|
|
43177
|
-
],
|
|
43178
|
-
wind: [
|
|
43179
|
-
"vento",
|
|
43180
|
-
"aria",
|
|
43181
|
-
"gas",
|
|
43182
|
-
"monossido",
|
|
43183
|
-
"co"
|
|
43184
|
-
],
|
|
43185
|
-
workflow: [
|
|
43186
|
-
"automazione",
|
|
43187
|
-
"flusso",
|
|
43188
|
-
"scenario"
|
|
43189
|
-
],
|
|
43190
|
-
wrench: [
|
|
43191
|
-
"officina",
|
|
43192
|
-
"manutenzione",
|
|
43193
|
-
"attrezzi",
|
|
43194
|
-
"utenze"
|
|
43195
|
-
],
|
|
43196
|
-
zap: [
|
|
43197
|
-
"energia",
|
|
43198
|
-
"corrente",
|
|
43199
|
-
"consumo",
|
|
43200
|
-
"watt",
|
|
43201
|
-
"elettricita"
|
|
43202
|
-
]
|
|
43203
|
-
};
|
|
43204
|
-
/**
|
|
43205
|
-
* Spellings an operator may already have PERSISTED that no lucide package
|
|
43206
|
-
* accepts any more, and the catalog key they draw. They resolve
|
|
43207
|
-
* (`canonicalIconKey`) but are never offered. `gauge2` was this repo's own
|
|
43208
|
-
* pre-catalog spelling of `gauge`.
|
|
43209
|
-
*/
|
|
43210
|
-
var LEGACY_ICON_ALIASES = { gauge2: "gauge" };
|
|
43211
|
-
/**
|
|
43212
|
-
* icon-catalog — THE icon vocabulary (D854).
|
|
43213
|
-
*
|
|
43214
|
-
* Every place that picks or stores an icon — a device's display override, a
|
|
43215
|
-
* location, a site zone, a viewer accessory, an `icon` settings field — names
|
|
43216
|
-
* it by a key of this catalog and nothing else. There is no curated subset and
|
|
43217
|
-
* no second list: the catalog is every lucide icon that both surfaces can draw
|
|
43218
|
-
* (the admin UI's `lucide-react` and the viewer's `lucide-react-native`), the
|
|
43219
|
-
* intersection computed by `scripts/generate-icon-catalog.ts` into the
|
|
43220
|
-
* committed `icon-catalog.generated.ts`.
|
|
43221
|
-
*
|
|
43222
|
-
* Like the vocabularies it replaces, this module holds STRINGS only — no React,
|
|
43223
|
-
* no lucide import, no glyph. Each surface owns its glyph table (the web one
|
|
43224
|
-
* lives in `ui-library`, loaded lazily), and a test on each side pins that it
|
|
43225
|
-
* covers {@link ICON_KEYS}.
|
|
43226
|
-
*
|
|
43227
|
-
* ## What is persisted
|
|
43228
|
-
*
|
|
43229
|
-
* The canonical kebab-case lucide id ({@link IconKey}). Spellings that a lucide
|
|
43230
|
-
* package still accepts (`home` for `house`) and this repo's own legacy ones
|
|
43231
|
-
* (`gauge2`) RESOLVE ({@link canonicalIconKey}) so a stored value never goes
|
|
43232
|
-
* stale, but they are never OFFERED by search.
|
|
43233
|
-
*
|
|
43234
|
-
* ## Search
|
|
43235
|
-
*
|
|
43236
|
-
* Over the key, the Italian/English overlay in `icon-synonyms.ts`, any words
|
|
43237
|
-
* the caller adds, and lucide's English tags — in that order of weight.
|
|
43238
|
-
*/
|
|
43239
|
-
var KEY_SET$2 = new Set(ICON_KEYS);
|
|
43240
|
-
new Map([...Object.entries(ICON_ALIASES), ...Object.entries(LEGACY_ICON_ALIASES)]);
|
|
43241
|
-
/** Is this a canonical key of the catalog? (An alias is not — see {@link canonicalIconKey}.) */
|
|
43242
|
-
function isIconKey(value) {
|
|
43243
|
-
return typeof value === "string" && KEY_SET$2.has(value);
|
|
43244
|
-
}
|
|
43245
|
-
/**
|
|
43246
|
-
* Wire/storage schema for one icon key.
|
|
43247
|
-
*
|
|
43248
|
-
* Deliberately NOT a `z.enum` of the catalog: ~1,700 literals would be inlined
|
|
43249
|
-
* into every cap router, type and API-reference row that carries an icon. The
|
|
43250
|
-
* check is membership in the catalog and the type is {@link IconKey}.
|
|
43251
|
-
*/
|
|
43252
|
-
var IconKeySchema = custom(isIconKey, "Not an icon of the catalog");
|
|
43253
|
-
var ENTRIES = ICON_KEYS.map((key, index) => {
|
|
43254
|
-
const [categoryIndexes, tags] = ICON_META[index] ?? [[], []];
|
|
43255
|
-
const categories = categoryIndexes.flatMap((i) => {
|
|
43256
|
-
const id = ICON_CATEGORY_IDS[i];
|
|
43257
|
-
return id === void 0 ? [] : [id];
|
|
43258
|
-
});
|
|
43259
|
-
return {
|
|
43260
|
-
key,
|
|
43261
|
-
categories,
|
|
43262
|
-
primaryCategory: categories[0] ?? ICON_CATEGORY_IDS[0],
|
|
43263
|
-
tags,
|
|
43264
|
-
synonyms: ICON_SYNONYMS[key] ?? []
|
|
43265
|
-
};
|
|
43266
|
-
});
|
|
43267
|
-
new Map(ENTRIES.map((e) => [e.key, e]));
|
|
43268
|
-
/** Categories a picker offers first: the ones this product's icons mostly live in. */
|
|
43269
|
-
var LEADING_CATEGORIES = [
|
|
43270
|
-
"devices",
|
|
43271
|
-
"home",
|
|
43272
|
-
"security",
|
|
43273
|
-
"buildings",
|
|
43274
|
-
"connectivity",
|
|
43275
|
-
"multimedia",
|
|
43276
|
-
"nature",
|
|
43277
|
-
"weather",
|
|
43278
|
-
"transportation",
|
|
43279
|
-
"animals"
|
|
43280
|
-
];
|
|
43281
|
-
var PRIMARY_CATEGORIES = new Set(ENTRIES.map((e) => e.primaryCategory));
|
|
43282
|
-
[...LEADING_CATEGORIES, ...ICON_CATEGORY_IDS.filter((c) => !LEADING_CATEGORIES.includes(c))].filter((c) => PRIMARY_CATEGORIES.has(c));
|
|
43283
|
-
/**
|
|
43284
|
-
* One (location, icon) assignment as it travels.
|
|
43285
|
-
*
|
|
43286
|
-
* `locationKey` is ALWAYS {@link locationIconKey} of the label — never the
|
|
43287
|
-
* operator's casing. The registry matches labels trimmed + case-insensitively
|
|
43288
|
-
* everywhere (`addLocation`, `removeLocation`, `renameLocation`), and a
|
|
43289
|
-
* case-only rename (`kitchen` → `Kitchen`) is a real edit this repo supports; a
|
|
43290
|
-
* map keyed on the displayed casing would orphan its entry on exactly that
|
|
43291
|
-
* edit. Consumers join by keying their own label through `locationIconKey`.
|
|
43292
|
-
*/
|
|
43293
|
-
var LocationIconAssignmentSchema = object({
|
|
43294
|
-
locationKey: string(),
|
|
43295
|
-
icon: IconKeySchema
|
|
43296
|
-
});
|
|
43297
|
-
/**
|
|
43298
|
-
* One (location, description) assignment as it travels.
|
|
43299
|
-
*
|
|
43300
|
-
* Same key discipline as {@link LocationIconAssignmentSchema}, and for the same
|
|
43301
|
-
* reason: this lived for a while in the post-analysis addon's own settings,
|
|
43302
|
-
* keyed by a HAND-TYPED label matched exactly and case-sensitively. A rename in
|
|
43303
|
-
* the Locations page carried the icon and silently orphaned the description —
|
|
43304
|
-
* two authorities for one thing, joined by two different rules. Now both hang
|
|
43305
|
-
* off the location itself, on `locationIconKey`.
|
|
43306
|
-
*/
|
|
43307
|
-
var LocationDescriptionAssignmentSchema = object({
|
|
43308
|
-
locationKey: string(),
|
|
43309
|
-
description: string()
|
|
43310
|
-
});
|
|
43311
|
-
/**
|
|
43312
|
-
* WHO an action step acts on (D983) — one target shape for every place that
|
|
43313
|
-
* performs an action (automation steps, Action entries, notification
|
|
43314
|
-
* sequences, scheduler points):
|
|
43315
|
-
*
|
|
43316
|
-
* - `devices` — device ids the operator picked, frozen at save time;
|
|
43317
|
-
* - `domain` — every device that offers the step's VOCABULARY action,
|
|
43318
|
-
* optionally narrowed to one device type and one room, resolved WHEN THE
|
|
43319
|
-
* STEP RUNS (a device added later is included). The action always comes
|
|
43320
|
-
* from the vocabulary (`cover.open`), never from a raw cap name, so a
|
|
43321
|
-
* `domain` target needs an `actionId` (enforced on the step schema);
|
|
43322
|
-
* - `var` — a `$var` resolved from the run's scope.
|
|
43323
|
-
*
|
|
43324
|
-
* {@link ActionTargetResolver} turns a target into device ids. It is pure
|
|
43325
|
-
* (a {@link DeviceDirectory} is handed in) so the hub's core-blocks service and
|
|
43326
|
-
* a generated automation block share it.
|
|
43327
|
-
*
|
|
43328
|
-
* A room is the device's `location` label (`DeviceInfo.location`); two labels
|
|
43329
|
-
* name the same room when `locationIconKey` agrees (trimmed, lower-cased).
|
|
43330
|
-
*/
|
|
43331
|
-
var ActionTargetSchema = discriminatedUnion("kind", [
|
|
43332
|
-
object({
|
|
43333
|
-
kind: literal("devices"),
|
|
43334
|
-
ids: array(number().int()).min(1)
|
|
43335
|
-
}),
|
|
43336
|
-
object({
|
|
43337
|
-
kind: literal("domain"),
|
|
43338
|
-
/** Narrow to one kind of device. */
|
|
43339
|
-
deviceType: _enum(DeviceType).optional(),
|
|
43340
|
-
/** Narrow to one room: the `location` label devices carry. */
|
|
43341
|
-
roomId: string().min(1).optional()
|
|
43342
|
-
}),
|
|
43343
|
-
object({
|
|
43344
|
-
kind: literal("var"),
|
|
43345
|
-
name: string().min(1)
|
|
43346
|
-
})
|
|
43347
|
-
]);
|
|
43348
|
-
EventCategory.DeviceRegistered, EventCategory.DeviceUnregistered, EventCategory.DeviceUpdated, EventCategory.DeviceMetaChanged, EventCategory.DeviceBindingsChanged;
|
|
43349
|
-
var ExpressionBindingSourceSchema = union([
|
|
43350
|
-
object({
|
|
43351
|
-
kind: literal("field").optional(),
|
|
43352
|
-
sourceKey: string(),
|
|
43353
|
-
cap: string(),
|
|
43354
|
-
fieldPath: string()
|
|
43355
|
-
}),
|
|
43356
|
-
object({
|
|
43357
|
-
kind: literal("literal"),
|
|
43358
|
-
value: union([
|
|
43359
|
-
string(),
|
|
43360
|
-
number(),
|
|
43361
|
-
boolean(),
|
|
43362
|
-
_null()
|
|
43363
|
-
])
|
|
43364
|
-
}),
|
|
43365
|
-
object({
|
|
43366
|
-
kind: literal("global"),
|
|
43367
|
-
sourceStableId: string(),
|
|
43368
|
-
cap: string(),
|
|
43369
|
-
fieldPath: string()
|
|
43370
|
-
})
|
|
43371
|
-
]);
|
|
43372
|
-
object({
|
|
43373
|
-
expr: string().min(1).max(MAX_EXPRESSION_SOURCE_LENGTH),
|
|
43374
|
-
bindings: record(string().regex(EXPRESSION_IDENTIFIER_RE), ExpressionBindingSourceSchema)
|
|
43375
|
-
}).superRefine((src, ctx) => {
|
|
43376
|
-
const err = validateExpressionSource(src);
|
|
43377
|
-
if (err !== null) ctx.addIssue({
|
|
43378
|
-
code: "custom",
|
|
43379
|
-
message: err,
|
|
43380
|
-
path: ["expr"]
|
|
43381
|
-
});
|
|
43382
|
-
});
|
|
43383
|
-
/**
|
|
43384
|
-
* Identity envelope for a device's upstream-system metadata.
|
|
43385
|
-
*
|
|
43386
|
-
* Two jobs:
|
|
43387
|
-
*
|
|
43388
|
-
* 1. **Dispatch key.** `id` is the natural identifier the SOURCE system
|
|
43389
|
-
* uses to address this device (HA `entity_id`, Reolink MAC, ONVIF
|
|
43390
|
-
* WS-Discovery endpoint UUID, …). Provider code keeps a
|
|
43391
|
-
* `Map<sourceInfo.id, IDevice>` to route inbound push events in O(1)
|
|
43392
|
-
* without round-tripping through `stableId` / `id` mappings.
|
|
43393
|
-
*
|
|
43394
|
-
* 2. **Stability bridge.** `uniqueId` is the *immutable* upstream id when
|
|
43395
|
-
* one exists (HA `entity.unique_id`, Reolink MAC again — same as `id`
|
|
43396
|
-
* for vendors where MAC is the natural key). For systems where the
|
|
43397
|
-
* live dispatch key can be renamed (HA `entity_id` can be edited),
|
|
43398
|
-
* providers detect renames by matching `uniqueId` and patch `id`
|
|
43399
|
-
* in-place so dispatch keeps working.
|
|
43400
|
-
*
|
|
43401
|
-
* **Display unit and precision are NOT stored here.** They are a read-time
|
|
43402
|
-
* preference (D944). A polymorphic reading stores its `quantity` here once,
|
|
43403
|
-
* at adopt, and a date/time value stores `dateTimeShape` the same way —
|
|
43404
|
-
* neither is repeated on each sample. The `device_class` tag is an
|
|
43405
|
-
* HA-specific input consumed at the discovery boundary (`ha-domain-mapping`)
|
|
43406
|
-
* to derive the CamStack `DeviceRole`; it is never stored after that point.
|
|
43407
|
-
*
|
|
43408
|
-
* The `raw` escape hatch carries provider-specific attributes that don't
|
|
43409
|
-
* fit the structured slots (HA `attributes` whitelist, Reolink `deviceCache`
|
|
43410
|
-
* details, …). Providers control what lands here.
|
|
43411
|
-
*/
|
|
43412
|
-
var SourceInfoSchema = object({
|
|
43413
|
-
/** Live dispatch key — mutable when the source system allows rename. */
|
|
43414
|
-
id: string(),
|
|
43415
|
-
/** Source system tag — e.g. 'homeassistant' | 'reolink' | 'onvif'. */
|
|
43416
|
-
system: string(),
|
|
43417
|
-
/** Immutable upstream identifier when available (HA `unique_id`, … ).
|
|
43418
|
-
* Used to detect rename when `id` changes. */
|
|
43419
|
-
uniqueId: string().optional(),
|
|
43420
|
-
/** Quantity of a polymorphic reading, written once at adopt (D944). */
|
|
43421
|
-
quantity: ReadingQuantitySchema.optional(),
|
|
43422
|
-
/** Date / time / datetime shape of a string reading, written once at adopt. */
|
|
43423
|
-
dateTimeShape: _enum([
|
|
43424
|
-
"date",
|
|
43425
|
-
"time",
|
|
43426
|
-
"datetime"
|
|
43427
|
-
]).optional(),
|
|
43428
|
-
/** Provider-specific extras that don't fit the structured slots.
|
|
43429
|
-
* Whitelist what goes here per provider — do NOT dump entire HA
|
|
43430
|
-
* attribute blobs (would explode the meta JSON column). */
|
|
43431
|
-
raw: record(string(), unknown()).optional()
|
|
43432
|
-
});
|
|
43433
|
-
/**
|
|
43434
|
-
* Build the synthetic SourceInfo every existing provider falls back to
|
|
43435
|
-
* when no upstream value has been persisted. Keeps non-migrated providers
|
|
43436
|
-
* (Reolink / Hikvision / ONVIF / RTSP) functional without code
|
|
43437
|
-
* changes — `id` reuses the CamStack stableId, `system` reuses the addon
|
|
43438
|
-
* id. Real upstream identity replaces this once a provider migrates and
|
|
43439
|
-
* calls `updateSourceInfo()` with concrete values.
|
|
43440
|
-
*/
|
|
43441
|
-
function synthesizeSourceInfo(input) {
|
|
43442
|
-
return {
|
|
43443
|
-
id: input.stableId,
|
|
43444
|
-
system: input.addonId
|
|
43445
|
-
};
|
|
43446
|
-
}
|
|
43447
|
-
/**
|
|
43448
|
-
* Shallow-merge a partial patch over a prior SourceInfo. `undefined`
|
|
43449
|
-
* patch values are ignored (no field clobber); to clear a field
|
|
43450
|
-
* explicitly, providers omit it from the patch and rebuild from scratch
|
|
43451
|
-
* via `updateSourceInfo({})` cycles — uncommon enough that we don't
|
|
43452
|
-
* bother with a `null`-means-delete sentinel.
|
|
43453
|
-
*
|
|
43454
|
-
* The `raw` field is also shallow-merged: passing `raw: { foo: 1 }`
|
|
43455
|
-
* merges over existing `raw` keys instead of replacing the whole bag.
|
|
43456
|
-
*/
|
|
43457
|
-
function mergeSourceInfo(prev, patch) {
|
|
43458
|
-
const next = { ...prev };
|
|
43459
|
-
for (const [k, v] of Object.entries(patch)) {
|
|
43460
|
-
if (v === void 0) continue;
|
|
43461
|
-
if (k === "raw" && typeof v === "object" && v !== null) {
|
|
43462
|
-
next.raw = {
|
|
43463
|
-
...prev.raw,
|
|
43464
|
-
...v
|
|
43465
|
-
};
|
|
43466
|
-
continue;
|
|
43467
|
-
}
|
|
43468
|
-
next[k] = v;
|
|
43469
|
-
}
|
|
43470
|
-
return next;
|
|
43471
|
-
}
|
|
43472
|
-
/**
|
|
43473
|
-
* Key under which `SourceInfo` lives inside `DeviceMeta.metadata`. The
|
|
43474
|
-
* blob is a free-form `Record<string, unknown>` shared with hardware-
|
|
43475
|
-
* identity fields (`manufacturer`, `model`, `firmware`, …); SourceInfo
|
|
43476
|
-
* lives under a single nested key to keep it composable with those.
|
|
43477
|
-
*/
|
|
43478
|
-
var SOURCE_INFO_METADATA_KEY = "sourceInfo";
|
|
43479
|
-
/**
|
|
43480
|
-
* Extract a SourceInfo from a `DeviceMeta.metadata` blob, validating
|
|
43481
|
-
* with Zod. Returns `null` when the blob is missing or the nested
|
|
43482
|
-
* `sourceInfo` key fails validation — callers fall back to the
|
|
43483
|
-
* synthetic default in that case (see `synthesizeSourceInfo`).
|
|
43484
|
-
*/
|
|
43485
|
-
function extractSourceInfoFromMetadata(metadata) {
|
|
43486
|
-
if (!metadata) return null;
|
|
43487
|
-
const raw = metadata[SOURCE_INFO_METADATA_KEY];
|
|
43488
|
-
if (!raw) return null;
|
|
43489
|
-
const parsed = SourceInfoSchema.safeParse(raw);
|
|
43490
|
-
if (!parsed.success) return null;
|
|
43491
|
-
return parsed.data;
|
|
43492
|
-
}
|
|
43493
|
-
/**
|
|
43494
|
-
* Frozen unit → spec table. `•` in the doc marks each dimension's canonical
|
|
43495
|
-
* unit (`factor: 1, offset: 0`). °F derives from `°C = (°F − 32) × 5/9` ⇒
|
|
43496
|
-
* `factor = 5/9`, `offset = -160/9` (kept as exact expressions, not rounded
|
|
43497
|
-
* decimals). K derives from `°C = K − 273.15`.
|
|
43498
|
-
*/
|
|
43499
|
-
var UNIT_TABLE = {
|
|
43500
|
-
"°C": {
|
|
43501
|
-
dimension: "temperature",
|
|
43502
|
-
factor: 1,
|
|
43503
|
-
offset: 0
|
|
43504
|
-
},
|
|
43505
|
-
"°F": {
|
|
43506
|
-
dimension: "temperature",
|
|
43507
|
-
factor: 5 / 9,
|
|
43508
|
-
offset: -160 / 9
|
|
43509
|
-
},
|
|
43510
|
-
K: {
|
|
43511
|
-
dimension: "temperature",
|
|
43512
|
-
factor: 1,
|
|
43513
|
-
offset: -273.15
|
|
43514
|
-
},
|
|
43515
|
-
hPa: {
|
|
43516
|
-
dimension: "pressure",
|
|
43517
|
-
factor: 1,
|
|
43518
|
-
offset: 0
|
|
43519
|
-
},
|
|
43520
|
-
kPa: {
|
|
43521
|
-
dimension: "pressure",
|
|
43522
|
-
factor: 10,
|
|
43523
|
-
offset: 0
|
|
43524
|
-
},
|
|
43525
|
-
Pa: {
|
|
43526
|
-
dimension: "pressure",
|
|
43527
|
-
factor: .01,
|
|
43528
|
-
offset: 0
|
|
43529
|
-
},
|
|
43530
|
-
mbar: {
|
|
43531
|
-
dimension: "pressure",
|
|
43532
|
-
factor: 1,
|
|
43533
|
-
offset: 0
|
|
43534
|
-
},
|
|
43535
|
-
bar: {
|
|
43536
|
-
dimension: "pressure",
|
|
43537
|
-
factor: 1e3,
|
|
43538
|
-
offset: 0
|
|
43539
|
-
},
|
|
43540
|
-
inHg: {
|
|
43541
|
-
dimension: "pressure",
|
|
43542
|
-
factor: 33.8639,
|
|
43543
|
-
offset: 0
|
|
43544
|
-
},
|
|
43545
|
-
mmHg: {
|
|
43546
|
-
dimension: "pressure",
|
|
43547
|
-
factor: 1.33322,
|
|
43548
|
-
offset: 0
|
|
43549
|
-
},
|
|
43550
|
-
psi: {
|
|
43551
|
-
dimension: "pressure",
|
|
43552
|
-
factor: 68.9476,
|
|
43553
|
-
offset: 0
|
|
43554
|
-
},
|
|
43555
|
-
"m/s": {
|
|
43556
|
-
dimension: "speed",
|
|
43557
|
-
factor: 1,
|
|
43558
|
-
offset: 0
|
|
43559
|
-
},
|
|
43560
|
-
"km/h": {
|
|
43561
|
-
dimension: "speed",
|
|
43562
|
-
factor: 1 / 3.6,
|
|
43563
|
-
offset: 0
|
|
43564
|
-
},
|
|
43565
|
-
mph: {
|
|
43566
|
-
dimension: "speed",
|
|
43567
|
-
factor: .44704,
|
|
43568
|
-
offset: 0
|
|
43569
|
-
},
|
|
43570
|
-
kn: {
|
|
43571
|
-
dimension: "speed",
|
|
43572
|
-
factor: .514444,
|
|
43573
|
-
offset: 0
|
|
43574
|
-
},
|
|
43575
|
-
"mm/h": {
|
|
43576
|
-
dimension: "precipitation-rate",
|
|
43577
|
-
factor: 1,
|
|
43578
|
-
offset: 0
|
|
43579
|
-
},
|
|
43580
|
-
"in/h": {
|
|
43581
|
-
dimension: "precipitation-rate",
|
|
43582
|
-
factor: 25.4,
|
|
43583
|
-
offset: 0
|
|
43584
|
-
},
|
|
43585
|
-
m: {
|
|
43586
|
-
dimension: "length",
|
|
43587
|
-
factor: 1,
|
|
43588
|
-
offset: 0
|
|
43589
|
-
},
|
|
43590
|
-
mm: {
|
|
43591
|
-
dimension: "length",
|
|
43592
|
-
factor: .001,
|
|
43593
|
-
offset: 0
|
|
43594
|
-
},
|
|
43595
|
-
cm: {
|
|
43596
|
-
dimension: "length",
|
|
43597
|
-
factor: .01,
|
|
43598
|
-
offset: 0
|
|
43599
|
-
},
|
|
43600
|
-
km: {
|
|
43601
|
-
dimension: "length",
|
|
43602
|
-
factor: 1e3,
|
|
43603
|
-
offset: 0
|
|
43604
|
-
},
|
|
43605
|
-
in: {
|
|
43606
|
-
dimension: "length",
|
|
43607
|
-
factor: .0254,
|
|
43608
|
-
offset: 0
|
|
43609
|
-
},
|
|
43610
|
-
ft: {
|
|
43611
|
-
dimension: "length",
|
|
43612
|
-
factor: .3048,
|
|
43613
|
-
offset: 0
|
|
43614
|
-
},
|
|
43615
|
-
mi: {
|
|
43616
|
-
dimension: "length",
|
|
43617
|
-
factor: 1609.344,
|
|
43618
|
-
offset: 0
|
|
43619
|
-
},
|
|
43620
|
-
"m²": {
|
|
43621
|
-
dimension: "area",
|
|
43622
|
-
factor: 1,
|
|
43623
|
-
offset: 0
|
|
43624
|
-
},
|
|
43625
|
-
lx: {
|
|
43626
|
-
dimension: "illuminance",
|
|
43627
|
-
factor: 1,
|
|
43628
|
-
offset: 0
|
|
43629
|
-
},
|
|
43630
|
-
"W/m²": {
|
|
43631
|
-
dimension: "irradiance",
|
|
43632
|
-
factor: 1,
|
|
43633
|
-
offset: 0
|
|
43634
|
-
},
|
|
43635
|
-
W: {
|
|
43636
|
-
dimension: "power",
|
|
43637
|
-
factor: 1,
|
|
43638
|
-
offset: 0
|
|
43639
|
-
},
|
|
43640
|
-
kW: {
|
|
43641
|
-
dimension: "power",
|
|
43642
|
-
factor: 1e3,
|
|
43643
|
-
offset: 0
|
|
43644
|
-
},
|
|
43645
|
-
VA: {
|
|
43646
|
-
dimension: "apparent-power",
|
|
43647
|
-
factor: 1,
|
|
43648
|
-
offset: 0
|
|
43649
|
-
},
|
|
43650
|
-
Wh: {
|
|
43651
|
-
dimension: "energy",
|
|
43652
|
-
factor: 1,
|
|
43653
|
-
offset: 0
|
|
43654
|
-
},
|
|
43655
|
-
kWh: {
|
|
43656
|
-
dimension: "energy",
|
|
43657
|
-
factor: 1e3,
|
|
43658
|
-
offset: 0
|
|
43659
|
-
},
|
|
43660
|
-
MWh: {
|
|
43661
|
-
dimension: "energy",
|
|
43662
|
-
factor: 1e6,
|
|
43663
|
-
offset: 0
|
|
43664
|
-
},
|
|
43665
|
-
V: {
|
|
43666
|
-
dimension: "voltage",
|
|
43667
|
-
factor: 1,
|
|
43668
|
-
offset: 0
|
|
43669
|
-
},
|
|
43670
|
-
mV: {
|
|
43671
|
-
dimension: "voltage",
|
|
43672
|
-
factor: .001,
|
|
43673
|
-
offset: 0
|
|
43674
|
-
},
|
|
43675
|
-
A: {
|
|
43676
|
-
dimension: "current",
|
|
43677
|
-
factor: 1,
|
|
43678
|
-
offset: 0
|
|
43679
|
-
},
|
|
43680
|
-
mA: {
|
|
43681
|
-
dimension: "current",
|
|
43682
|
-
factor: .001,
|
|
43683
|
-
offset: 0
|
|
43684
|
-
},
|
|
43685
|
-
ppm: {
|
|
43686
|
-
dimension: "concentration-volume",
|
|
43687
|
-
factor: 1,
|
|
43688
|
-
offset: 0
|
|
43689
|
-
},
|
|
43690
|
-
ppb: {
|
|
43691
|
-
dimension: "concentration-volume",
|
|
43692
|
-
factor: .001,
|
|
43693
|
-
offset: 0
|
|
43694
|
-
},
|
|
43695
|
-
"µg/m³": {
|
|
43696
|
-
dimension: "concentration-mass",
|
|
43697
|
-
factor: 1,
|
|
43698
|
-
offset: 0
|
|
43699
|
-
},
|
|
43700
|
-
"mg/m³": {
|
|
43701
|
-
dimension: "concentration-mass",
|
|
43702
|
-
factor: 1e3,
|
|
43703
|
-
offset: 0
|
|
43704
|
-
},
|
|
43705
|
-
kg: {
|
|
43706
|
-
dimension: "mass",
|
|
43707
|
-
factor: 1,
|
|
43708
|
-
offset: 0
|
|
43709
|
-
},
|
|
43710
|
-
g: {
|
|
43711
|
-
dimension: "mass",
|
|
43712
|
-
factor: .001,
|
|
43713
|
-
offset: 0
|
|
43714
|
-
},
|
|
43715
|
-
lb: {
|
|
43716
|
-
dimension: "mass",
|
|
43717
|
-
factor: .453592,
|
|
43718
|
-
offset: 0
|
|
43719
|
-
},
|
|
43720
|
-
oz: {
|
|
43721
|
-
dimension: "mass",
|
|
43722
|
-
factor: .0283495,
|
|
43723
|
-
offset: 0
|
|
43724
|
-
},
|
|
43725
|
-
"%": {
|
|
43726
|
-
dimension: "percentage",
|
|
43727
|
-
factor: 1,
|
|
43728
|
-
offset: 0
|
|
43729
|
-
},
|
|
43730
|
-
L: {
|
|
43731
|
-
dimension: "volume",
|
|
43732
|
-
factor: 1,
|
|
43733
|
-
offset: 0
|
|
43734
|
-
},
|
|
43735
|
-
mL: {
|
|
43736
|
-
dimension: "volume",
|
|
43737
|
-
factor: .001,
|
|
43738
|
-
offset: 0
|
|
43739
|
-
},
|
|
43740
|
-
gal: {
|
|
43741
|
-
dimension: "volume",
|
|
43742
|
-
factor: 3.785411784,
|
|
43743
|
-
offset: 0
|
|
43744
|
-
},
|
|
43745
|
-
s: {
|
|
43746
|
-
dimension: "duration",
|
|
43747
|
-
factor: 1,
|
|
43748
|
-
offset: 0
|
|
43749
|
-
},
|
|
43750
|
-
ms: {
|
|
43751
|
-
dimension: "duration",
|
|
43752
|
-
factor: .001,
|
|
43753
|
-
offset: 0
|
|
43754
|
-
},
|
|
43755
|
-
min: {
|
|
43756
|
-
dimension: "duration",
|
|
43757
|
-
factor: 60,
|
|
43758
|
-
offset: 0
|
|
43759
|
-
},
|
|
43760
|
-
h: {
|
|
43761
|
-
dimension: "duration",
|
|
43762
|
-
factor: 3600,
|
|
43763
|
-
offset: 0
|
|
43764
|
-
},
|
|
43765
|
-
d: {
|
|
43766
|
-
dimension: "duration",
|
|
43767
|
-
factor: 86400,
|
|
43768
|
-
offset: 0
|
|
43769
|
-
},
|
|
43770
|
-
B: {
|
|
43771
|
-
dimension: "information",
|
|
43772
|
-
factor: 1,
|
|
43773
|
-
offset: 0
|
|
43774
|
-
},
|
|
43775
|
-
KiB: {
|
|
43776
|
-
dimension: "information",
|
|
43777
|
-
factor: 1024,
|
|
43778
|
-
offset: 0
|
|
43779
|
-
},
|
|
43780
|
-
MiB: {
|
|
43781
|
-
dimension: "information",
|
|
43782
|
-
factor: 1024 ** 2,
|
|
43783
|
-
offset: 0
|
|
43784
|
-
},
|
|
43785
|
-
GiB: {
|
|
43786
|
-
dimension: "information",
|
|
43787
|
-
factor: 1024 ** 3,
|
|
43788
|
-
offset: 0
|
|
43789
|
-
},
|
|
43790
|
-
TiB: {
|
|
43791
|
-
dimension: "information",
|
|
43792
|
-
factor: 1024 ** 4,
|
|
43793
|
-
offset: 0
|
|
43794
|
-
},
|
|
43795
|
-
kB: {
|
|
43796
|
-
dimension: "information",
|
|
43797
|
-
factor: 1e3,
|
|
43798
|
-
offset: 0
|
|
43799
|
-
},
|
|
43800
|
-
MB: {
|
|
43801
|
-
dimension: "information",
|
|
43802
|
-
factor: 1e6,
|
|
43803
|
-
offset: 0
|
|
43804
|
-
},
|
|
43805
|
-
GB: {
|
|
43806
|
-
dimension: "information",
|
|
43807
|
-
factor: 1e9,
|
|
43808
|
-
offset: 0
|
|
43809
|
-
},
|
|
43810
|
-
"°": {
|
|
43811
|
-
dimension: "angle",
|
|
43812
|
-
factor: 1,
|
|
43813
|
-
offset: 0
|
|
43814
|
-
},
|
|
43815
|
-
dBFS: {
|
|
43816
|
-
dimension: "sound-level",
|
|
43817
|
-
factor: 1,
|
|
43818
|
-
offset: 0
|
|
43819
|
-
},
|
|
43820
|
-
dBm: {
|
|
43821
|
-
dimension: "signal-level",
|
|
43822
|
-
factor: 1,
|
|
43823
|
-
offset: 0
|
|
43824
|
-
},
|
|
43825
|
-
mired: {
|
|
43826
|
-
dimension: "colour-temperature",
|
|
43827
|
-
factor: 1,
|
|
43828
|
-
offset: 0
|
|
43829
|
-
},
|
|
43830
|
-
kbps: {
|
|
43831
|
-
dimension: "bitrate",
|
|
43832
|
-
factor: 1,
|
|
43833
|
-
offset: 0
|
|
43834
|
-
},
|
|
43835
|
-
Mbps: {
|
|
43836
|
-
dimension: "bitrate",
|
|
43837
|
-
factor: 1e3,
|
|
43838
|
-
offset: 0
|
|
43839
|
-
},
|
|
43840
|
-
fps: {
|
|
43841
|
-
dimension: "rate",
|
|
43842
|
-
factor: 1,
|
|
43843
|
-
offset: 0
|
|
43844
|
-
}
|
|
43667
|
+
],
|
|
43668
|
+
"washing-machine": [
|
|
43669
|
+
"lavatrice",
|
|
43670
|
+
"lavastoviglie",
|
|
43671
|
+
"asciugatrice"
|
|
43672
|
+
],
|
|
43673
|
+
waves: [
|
|
43674
|
+
"onde",
|
|
43675
|
+
"acqua",
|
|
43676
|
+
"vibrazione"
|
|
43677
|
+
],
|
|
43678
|
+
"waves-ladder": [
|
|
43679
|
+
"piscina",
|
|
43680
|
+
"vasca",
|
|
43681
|
+
"pool"
|
|
43682
|
+
],
|
|
43683
|
+
wifi: ["rete", "segnale"],
|
|
43684
|
+
"wifi-off": [
|
|
43685
|
+
"wifi",
|
|
43686
|
+
"assente",
|
|
43687
|
+
"offline",
|
|
43688
|
+
"disconnesso"
|
|
43689
|
+
],
|
|
43690
|
+
wind: [
|
|
43691
|
+
"vento",
|
|
43692
|
+
"aria",
|
|
43693
|
+
"gas",
|
|
43694
|
+
"monossido",
|
|
43695
|
+
"co"
|
|
43696
|
+
],
|
|
43697
|
+
workflow: [
|
|
43698
|
+
"automazione",
|
|
43699
|
+
"flusso",
|
|
43700
|
+
"scenario"
|
|
43701
|
+
],
|
|
43702
|
+
wrench: [
|
|
43703
|
+
"officina",
|
|
43704
|
+
"manutenzione",
|
|
43705
|
+
"attrezzi",
|
|
43706
|
+
"utenze"
|
|
43707
|
+
],
|
|
43708
|
+
zap: [
|
|
43709
|
+
"energia",
|
|
43710
|
+
"corrente",
|
|
43711
|
+
"consumo",
|
|
43712
|
+
"watt",
|
|
43713
|
+
"elettricita"
|
|
43714
|
+
]
|
|
43845
43715
|
};
|
|
43846
|
-
/**
|
|
43847
|
-
|
|
43848
|
-
|
|
43716
|
+
/**
|
|
43717
|
+
* Spellings an operator may already have PERSISTED that no lucide package
|
|
43718
|
+
* accepts any more, and the catalog key they draw. They resolve
|
|
43719
|
+
* (`canonicalIconKey`) but are never offered. `gauge2` was this repo's own
|
|
43720
|
+
* pre-catalog spelling of `gauge`.
|
|
43721
|
+
*/
|
|
43722
|
+
var LEGACY_ICON_ALIASES = { gauge2: "gauge" };
|
|
43723
|
+
/**
|
|
43724
|
+
* icon-catalog — THE icon vocabulary (D854).
|
|
43725
|
+
*
|
|
43726
|
+
* Every place that picks or stores an icon — a device's display override, a
|
|
43727
|
+
* location, a site zone, a viewer accessory, an `icon` settings field — names
|
|
43728
|
+
* it by a key of this catalog and nothing else. There is no curated subset and
|
|
43729
|
+
* no second list: the catalog is every lucide icon that both surfaces can draw
|
|
43730
|
+
* (the admin UI's `lucide-react` and the viewer's `lucide-react-native`), the
|
|
43731
|
+
* intersection computed by `scripts/generate-icon-catalog.ts` into the
|
|
43732
|
+
* committed `icon-catalog.generated.ts`.
|
|
43733
|
+
*
|
|
43734
|
+
* Like the vocabularies it replaces, this module holds STRINGS only — no React,
|
|
43735
|
+
* no lucide import, no glyph. Each surface owns its glyph table (the web one
|
|
43736
|
+
* lives in `ui-library`, loaded lazily), and a test on each side pins that it
|
|
43737
|
+
* covers {@link ICON_KEYS}.
|
|
43738
|
+
*
|
|
43739
|
+
* ## What is persisted
|
|
43740
|
+
*
|
|
43741
|
+
* The canonical kebab-case lucide id ({@link IconKey}). Spellings that a lucide
|
|
43742
|
+
* package still accepts (`home` for `house`) and this repo's own legacy ones
|
|
43743
|
+
* (`gauge2`) RESOLVE ({@link canonicalIconKey}) so a stored value never goes
|
|
43744
|
+
* stale, but they are never OFFERED by search.
|
|
43745
|
+
*
|
|
43746
|
+
* ## Search
|
|
43747
|
+
*
|
|
43748
|
+
* Over the key, the Italian/English overlay in `icon-synonyms.ts`, any words
|
|
43749
|
+
* the caller adds, and lucide's English tags — in that order of weight.
|
|
43750
|
+
*/
|
|
43751
|
+
var KEY_SET$2 = new Set(ICON_KEYS);
|
|
43752
|
+
new Map([...Object.entries(ICON_ALIASES), ...Object.entries(LEGACY_ICON_ALIASES)]);
|
|
43753
|
+
/** Is this a canonical key of the catalog? (An alias is not — see {@link canonicalIconKey}.) */
|
|
43754
|
+
function isIconKey(value) {
|
|
43755
|
+
return typeof value === "string" && KEY_SET$2.has(value);
|
|
43849
43756
|
}
|
|
43850
|
-
/**
|
|
43851
|
-
|
|
43852
|
-
|
|
43757
|
+
/**
|
|
43758
|
+
* Wire/storage schema for one icon key.
|
|
43759
|
+
*
|
|
43760
|
+
* Deliberately NOT a `z.enum` of the catalog: ~1,700 literals would be inlined
|
|
43761
|
+
* into every cap router, type and API-reference row that carries an icon. The
|
|
43762
|
+
* check is membership in the catalog and the type is {@link IconKey}.
|
|
43763
|
+
*/
|
|
43764
|
+
var IconKeySchema = custom(isIconKey, "Not an icon of the catalog");
|
|
43765
|
+
var ENTRIES = ICON_KEYS.map((key, index) => {
|
|
43766
|
+
const [categoryIndexes, tags] = ICON_META[index] ?? [[], []];
|
|
43767
|
+
const categories = categoryIndexes.flatMap((i) => {
|
|
43768
|
+
const id = ICON_CATEGORY_IDS[i];
|
|
43769
|
+
return id === void 0 ? [] : [id];
|
|
43770
|
+
});
|
|
43771
|
+
return {
|
|
43772
|
+
key,
|
|
43773
|
+
categories,
|
|
43774
|
+
primaryCategory: categories[0] ?? ICON_CATEGORY_IDS[0],
|
|
43775
|
+
tags,
|
|
43776
|
+
synonyms: ICON_SYNONYMS[key] ?? []
|
|
43777
|
+
};
|
|
43778
|
+
});
|
|
43779
|
+
new Map(ENTRIES.map((e) => [e.key, e]));
|
|
43780
|
+
/** Categories a picker offers first: the ones this product's icons mostly live in. */
|
|
43781
|
+
var LEADING_CATEGORIES = [
|
|
43782
|
+
"devices",
|
|
43783
|
+
"home",
|
|
43784
|
+
"security",
|
|
43785
|
+
"buildings",
|
|
43786
|
+
"connectivity",
|
|
43787
|
+
"multimedia",
|
|
43788
|
+
"nature",
|
|
43789
|
+
"weather",
|
|
43790
|
+
"transportation",
|
|
43791
|
+
"animals"
|
|
43792
|
+
];
|
|
43793
|
+
var PRIMARY_CATEGORIES = new Set(ENTRIES.map((e) => e.primaryCategory));
|
|
43794
|
+
[...LEADING_CATEGORIES, ...ICON_CATEGORY_IDS.filter((c) => !LEADING_CATEGORIES.includes(c))].filter((c) => PRIMARY_CATEGORIES.has(c));
|
|
43795
|
+
/**
|
|
43796
|
+
* One (location, icon) assignment as it travels.
|
|
43797
|
+
*
|
|
43798
|
+
* `locationKey` is ALWAYS {@link locationIconKey} of the label — never the
|
|
43799
|
+
* operator's casing. The registry matches labels trimmed + case-insensitively
|
|
43800
|
+
* everywhere (`addLocation`, `removeLocation`, `renameLocation`), and a
|
|
43801
|
+
* case-only rename (`kitchen` → `Kitchen`) is a real edit this repo supports; a
|
|
43802
|
+
* map keyed on the displayed casing would orphan its entry on exactly that
|
|
43803
|
+
* edit. Consumers join by keying their own label through `locationIconKey`.
|
|
43804
|
+
*/
|
|
43805
|
+
var LocationIconAssignmentSchema = object({
|
|
43806
|
+
locationKey: string(),
|
|
43807
|
+
icon: IconKeySchema
|
|
43808
|
+
});
|
|
43809
|
+
/**
|
|
43810
|
+
* One (location, description) assignment as it travels.
|
|
43811
|
+
*
|
|
43812
|
+
* Same key discipline as {@link LocationIconAssignmentSchema}, and for the same
|
|
43813
|
+
* reason: this lived for a while in the post-analysis addon's own settings,
|
|
43814
|
+
* keyed by a HAND-TYPED label matched exactly and case-sensitively. A rename in
|
|
43815
|
+
* the Locations page carried the icon and silently orphaned the description —
|
|
43816
|
+
* two authorities for one thing, joined by two different rules. Now both hang
|
|
43817
|
+
* off the location itself, on `locationIconKey`.
|
|
43818
|
+
*/
|
|
43819
|
+
var LocationDescriptionAssignmentSchema = object({
|
|
43820
|
+
locationKey: string(),
|
|
43821
|
+
description: string()
|
|
43822
|
+
});
|
|
43823
|
+
/**
|
|
43824
|
+
* WHO an action step acts on (D983) — one target shape for every place that
|
|
43825
|
+
* performs an action (automation steps, Action entries, notification
|
|
43826
|
+
* sequences, scheduler points):
|
|
43827
|
+
*
|
|
43828
|
+
* - `devices` — device ids the operator picked, frozen at save time;
|
|
43829
|
+
* - `domain` — every device that offers the step's VOCABULARY action,
|
|
43830
|
+
* optionally narrowed to one device type and one room, resolved WHEN THE
|
|
43831
|
+
* STEP RUNS (a device added later is included). The action always comes
|
|
43832
|
+
* from the vocabulary (`cover.open`), never from a raw cap name, so a
|
|
43833
|
+
* `domain` target needs an `actionId` (enforced on the step schema);
|
|
43834
|
+
* - `var` — a `$var` resolved from the run's scope.
|
|
43835
|
+
*
|
|
43836
|
+
* {@link ActionTargetResolver} turns a target into device ids. It is pure
|
|
43837
|
+
* (a {@link DeviceDirectory} is handed in) so the hub's core-blocks service and
|
|
43838
|
+
* a generated automation block share it.
|
|
43839
|
+
*
|
|
43840
|
+
* A room is the device's `location` label (`DeviceInfo.location`); two labels
|
|
43841
|
+
* name the same room when `locationIconKey` agrees (trimmed, lower-cased).
|
|
43842
|
+
*/
|
|
43843
|
+
var ActionTargetSchema = discriminatedUnion("kind", [
|
|
43844
|
+
object({
|
|
43845
|
+
kind: literal("devices"),
|
|
43846
|
+
ids: array(number().int()).min(1)
|
|
43847
|
+
}),
|
|
43848
|
+
object({
|
|
43849
|
+
kind: literal("domain"),
|
|
43850
|
+
/** Narrow to one kind of device. */
|
|
43851
|
+
deviceType: _enum(DeviceType).optional(),
|
|
43852
|
+
/** Narrow to one room: the `location` label devices carry. */
|
|
43853
|
+
roomId: string().min(1).optional()
|
|
43854
|
+
}),
|
|
43855
|
+
object({
|
|
43856
|
+
kind: literal("var"),
|
|
43857
|
+
name: string().min(1)
|
|
43858
|
+
})
|
|
43859
|
+
]);
|
|
43860
|
+
EventCategory.DeviceRegistered, EventCategory.DeviceUnregistered, EventCategory.DeviceUpdated, EventCategory.DeviceMetaChanged, EventCategory.DeviceBindingsChanged;
|
|
43861
|
+
var ExpressionBindingSourceSchema = union([
|
|
43862
|
+
object({
|
|
43863
|
+
kind: literal("field").optional(),
|
|
43864
|
+
sourceKey: string(),
|
|
43865
|
+
cap: string(),
|
|
43866
|
+
fieldPath: string()
|
|
43867
|
+
}),
|
|
43868
|
+
object({
|
|
43869
|
+
kind: literal("literal"),
|
|
43870
|
+
value: union([
|
|
43871
|
+
string(),
|
|
43872
|
+
number(),
|
|
43873
|
+
boolean(),
|
|
43874
|
+
_null()
|
|
43875
|
+
])
|
|
43876
|
+
}),
|
|
43877
|
+
object({
|
|
43878
|
+
kind: literal("global"),
|
|
43879
|
+
sourceStableId: string(),
|
|
43880
|
+
addonId: string().optional(),
|
|
43881
|
+
cap: string(),
|
|
43882
|
+
fieldPath: string()
|
|
43883
|
+
})
|
|
43884
|
+
]);
|
|
43885
|
+
object({
|
|
43886
|
+
expr: string().min(1).max(MAX_EXPRESSION_SOURCE_LENGTH),
|
|
43887
|
+
bindings: record(string().regex(EXPRESSION_IDENTIFIER_RE), ExpressionBindingSourceSchema)
|
|
43888
|
+
}).superRefine((src, ctx) => {
|
|
43889
|
+
const err = validateExpressionSource(src);
|
|
43890
|
+
if (err !== null) ctx.addIssue({
|
|
43891
|
+
code: "custom",
|
|
43892
|
+
message: err,
|
|
43893
|
+
path: ["expr"]
|
|
43894
|
+
});
|
|
43895
|
+
});
|
|
43896
|
+
/**
|
|
43897
|
+
* Identity envelope for a device's upstream-system metadata.
|
|
43898
|
+
*
|
|
43899
|
+
* Two jobs:
|
|
43900
|
+
*
|
|
43901
|
+
* 1. **Dispatch key.** `id` is the natural identifier the SOURCE system
|
|
43902
|
+
* uses to address this device (HA `entity_id`, Reolink MAC, ONVIF
|
|
43903
|
+
* WS-Discovery endpoint UUID, …). Provider code keeps a
|
|
43904
|
+
* `Map<sourceInfo.id, IDevice>` to route inbound push events in O(1)
|
|
43905
|
+
* without round-tripping through `stableId` / `id` mappings.
|
|
43906
|
+
*
|
|
43907
|
+
* 2. **Stability bridge.** `uniqueId` is the *immutable* upstream id when
|
|
43908
|
+
* one exists (HA `entity.unique_id`, Reolink MAC again — same as `id`
|
|
43909
|
+
* for vendors where MAC is the natural key). For systems where the
|
|
43910
|
+
* live dispatch key can be renamed (HA `entity_id` can be edited),
|
|
43911
|
+
* providers detect renames by matching `uniqueId` and patch `id`
|
|
43912
|
+
* in-place so dispatch keeps working.
|
|
43913
|
+
*
|
|
43914
|
+
* **Display unit and precision are NOT stored here.** They are a read-time
|
|
43915
|
+
* preference (D944). A polymorphic reading stores its `quantity` here once,
|
|
43916
|
+
* at adopt, and a date/time value stores `dateTimeShape` the same way —
|
|
43917
|
+
* neither is repeated on each sample. The `device_class` tag is an
|
|
43918
|
+
* HA-specific input consumed at the discovery boundary (`ha-domain-mapping`)
|
|
43919
|
+
* to derive the CamStack `DeviceRole`; it is never stored after that point.
|
|
43920
|
+
*
|
|
43921
|
+
* The `raw` escape hatch carries provider-specific attributes that don't
|
|
43922
|
+
* fit the structured slots (HA `attributes` whitelist, Reolink `deviceCache`
|
|
43923
|
+
* details, …). Providers control what lands here.
|
|
43924
|
+
*/
|
|
43925
|
+
var SourceInfoSchema = object({
|
|
43926
|
+
/** Live dispatch key — mutable when the source system allows rename. */
|
|
43927
|
+
id: string(),
|
|
43928
|
+
/** Source system tag — e.g. 'homeassistant' | 'reolink' | 'onvif'. */
|
|
43929
|
+
system: string(),
|
|
43930
|
+
/** Immutable upstream identifier when available (HA `unique_id`, … ).
|
|
43931
|
+
* Used to detect rename when `id` changes. */
|
|
43932
|
+
uniqueId: string().optional(),
|
|
43933
|
+
/** Quantity of a polymorphic reading, written once at adopt (D944). */
|
|
43934
|
+
quantity: ReadingQuantitySchema.optional(),
|
|
43935
|
+
/** Date / time / datetime shape of a string reading, written once at adopt. */
|
|
43936
|
+
dateTimeShape: _enum([
|
|
43937
|
+
"date",
|
|
43938
|
+
"time",
|
|
43939
|
+
"datetime"
|
|
43940
|
+
]).optional(),
|
|
43941
|
+
/** Provider-specific extras that don't fit the structured slots.
|
|
43942
|
+
* Whitelist what goes here per provider — do NOT dump entire HA
|
|
43943
|
+
* attribute blobs (would explode the meta JSON column). */
|
|
43944
|
+
raw: record(string(), unknown()).optional()
|
|
43945
|
+
});
|
|
43946
|
+
/**
|
|
43947
|
+
* Build the synthetic SourceInfo every existing provider falls back to
|
|
43948
|
+
* when no upstream value has been persisted. Keeps non-migrated providers
|
|
43949
|
+
* (Reolink / Hikvision / ONVIF / RTSP) functional without code
|
|
43950
|
+
* changes — `id` reuses the CamStack stableId, `system` reuses the addon
|
|
43951
|
+
* id. Real upstream identity replaces this once a provider migrates and
|
|
43952
|
+
* calls `updateSourceInfo()` with concrete values.
|
|
43953
|
+
*/
|
|
43954
|
+
function synthesizeSourceInfo(input) {
|
|
43955
|
+
return {
|
|
43956
|
+
id: input.stableId,
|
|
43957
|
+
system: input.addonId
|
|
43958
|
+
};
|
|
43853
43959
|
}
|
|
43854
|
-
/**
|
|
43855
|
-
|
|
43856
|
-
|
|
43960
|
+
/**
|
|
43961
|
+
* Shallow-merge a partial patch over a prior SourceInfo. `undefined`
|
|
43962
|
+
* patch values are ignored (no field clobber); to clear a field
|
|
43963
|
+
* explicitly, providers omit it from the patch and rebuild from scratch
|
|
43964
|
+
* via `updateSourceInfo({})` cycles — uncommon enough that we don't
|
|
43965
|
+
* bother with a `null`-means-delete sentinel.
|
|
43966
|
+
*
|
|
43967
|
+
* The `raw` field is also shallow-merged: passing `raw: { foo: 1 }`
|
|
43968
|
+
* merges over existing `raw` keys instead of replacing the whole bag.
|
|
43969
|
+
*/
|
|
43970
|
+
function mergeSourceInfo(prev, patch) {
|
|
43971
|
+
const next = { ...prev };
|
|
43972
|
+
for (const [k, v] of Object.entries(patch)) {
|
|
43973
|
+
if (v === void 0) continue;
|
|
43974
|
+
if (k === "raw" && typeof v === "object" && v !== null) {
|
|
43975
|
+
next.raw = {
|
|
43976
|
+
...prev.raw,
|
|
43977
|
+
...v
|
|
43978
|
+
};
|
|
43979
|
+
continue;
|
|
43980
|
+
}
|
|
43981
|
+
next[k] = v;
|
|
43982
|
+
}
|
|
43983
|
+
return next;
|
|
43857
43984
|
}
|
|
43858
43985
|
/**
|
|
43859
|
-
*
|
|
43860
|
-
*
|
|
43861
|
-
*
|
|
43986
|
+
* Key under which `SourceInfo` lives inside `DeviceMeta.metadata`. The
|
|
43987
|
+
* blob is a free-form `Record<string, unknown>` shared with hardware-
|
|
43988
|
+
* identity fields (`manufacturer`, `model`, `firmware`, …); SourceInfo
|
|
43989
|
+
* lives under a single nested key to keep it composable with those.
|
|
43862
43990
|
*/
|
|
43863
|
-
|
|
43864
|
-
|
|
43865
|
-
|
|
43866
|
-
|
|
43867
|
-
|
|
43868
|
-
|
|
43869
|
-
|
|
43870
|
-
|
|
43991
|
+
var SOURCE_INFO_METADATA_KEY = "sourceInfo";
|
|
43992
|
+
/**
|
|
43993
|
+
* Extract a SourceInfo from a `DeviceMeta.metadata` blob, validating
|
|
43994
|
+
* with Zod. Returns `null` when the blob is missing or the nested
|
|
43995
|
+
* `sourceInfo` key fails validation — callers fall back to the
|
|
43996
|
+
* synthetic default in that case (see `synthesizeSourceInfo`).
|
|
43997
|
+
*/
|
|
43998
|
+
function extractSourceInfoFromMetadata(metadata) {
|
|
43999
|
+
if (!metadata) return null;
|
|
44000
|
+
const raw = metadata[SOURCE_INFO_METADATA_KEY];
|
|
44001
|
+
if (!raw) return null;
|
|
44002
|
+
const parsed = SourceInfoSchema.safeParse(raw);
|
|
44003
|
+
if (!parsed.success) return null;
|
|
44004
|
+
return parsed.data;
|
|
43871
44005
|
}
|
|
43872
44006
|
/**
|
|
43873
44007
|
* A number a person types for a physical quantity — the input side of the
|
|
@@ -45546,15 +45680,28 @@ var SettingsSchemaWithValuesSchema = object({
|
|
|
45546
45680
|
});
|
|
45547
45681
|
/** Patch object — keys are field names, values are the new field values. */
|
|
45548
45682
|
var SettingsPatchSchema = record(string(), unknown());
|
|
45683
|
+
/** The scope of a scoped-settings call (D986): where the capability declared the values. */
|
|
45684
|
+
var ScopedSettingsScopeSchema = _enum(SCOPED_SETTINGS_SCOPES);
|
|
45685
|
+
/** One scoped schema an addon serves: its capability, scope and section ids. */
|
|
45686
|
+
var ScopedSettingsDeclarationSchema = object({
|
|
45687
|
+
cap: string(),
|
|
45688
|
+
scope: ScopedSettingsScopeSchema,
|
|
45689
|
+
sectionIds: array(string())
|
|
45690
|
+
});
|
|
45549
45691
|
/** Standard success response for update operations. */
|
|
45550
45692
|
var SettingsUpdateResultSchema = object({ success: literal(true) });
|
|
45551
45693
|
method(object({
|
|
45552
45694
|
addonId: string(),
|
|
45553
|
-
|
|
45554
|
-
|
|
45555
|
-
|
|
45695
|
+
cap: string(),
|
|
45696
|
+
scope: ScopedSettingsScopeSchema,
|
|
45697
|
+
nodeId: string().optional()
|
|
45556
45698
|
}), SettingsSchemaWithValuesSchema.nullable()), method(object({
|
|
45557
45699
|
addonId: string(),
|
|
45700
|
+
nodeId: string().optional()
|
|
45701
|
+
}), array(ScopedSettingsDeclarationSchema).nullable()), method(object({
|
|
45702
|
+
addonId: string(),
|
|
45703
|
+
cap: string(),
|
|
45704
|
+
scope: ScopedSettingsScopeSchema,
|
|
45558
45705
|
nodeId: string().optional(),
|
|
45559
45706
|
patch: SettingsPatchSchema
|
|
45560
45707
|
}), SettingsUpdateResultSchema, {
|
|
@@ -45562,8 +45709,10 @@ method(object({
|
|
|
45562
45709
|
auth: "admin"
|
|
45563
45710
|
}), method(object({
|
|
45564
45711
|
addonId: string(),
|
|
45712
|
+
cap: string(),
|
|
45713
|
+
scope: ScopedSettingsScopeSchema,
|
|
45565
45714
|
nodeId: string().optional()
|
|
45566
|
-
}),
|
|
45715
|
+
}), record(string(), unknown()).nullable()), method(object({
|
|
45567
45716
|
addonId: string(),
|
|
45568
45717
|
nodeId: string().optional(),
|
|
45569
45718
|
instance: IntegrationInstanceRefSchema
|
|
@@ -47126,7 +47275,7 @@ var BackupDestinationInfoSchema = object({
|
|
|
47126
47275
|
id: string(),
|
|
47127
47276
|
/**
|
|
47128
47277
|
* Manifest id of the owning addon. The Settings button on the
|
|
47129
|
-
* destination card opens that addon's
|
|
47278
|
+
* destination card opens that addon's scoped settings panel.
|
|
47130
47279
|
*/
|
|
47131
47280
|
addonId: string(),
|
|
47132
47281
|
/** Operator-toggled enable flag from the destination-policy table. */
|
|
@@ -50540,7 +50689,7 @@ var mediaPlayerCapability = {
|
|
|
50540
50689
|
isMuted: { kind: "boolean" }
|
|
50541
50690
|
} }
|
|
50542
50691
|
};
|
|
50543
|
-
DeviceType.Camera, DeviceType.Sensor, DeviceType.Button, DeviceType.Switch, DeviceType.PetFeeder, DeviceType.Container, DeviceType.Thermostat, DeviceType.EventEmitter, DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Thermostat, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.Fan, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.PetFountain, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Heater, DeviceType.Dryer, DeviceType.Gateway, DeviceType.Camera, DeviceType.Fan, DeviceType.Lock, DeviceType.Camera, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Heater, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Heater, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Heater, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Heater, DeviceType.Gateway, DeviceType.Hub, DeviceType.Camera, DeviceType.Sensor, DeviceType.MediaPlayer, DeviceType.Vacuum, DeviceType.Generic, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.PetFountain, DeviceType.Fan, DeviceType.Humidifier, DeviceType.Climate, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.MediaPlayer, DeviceType.WaterHeater, DeviceType.Humidifier, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.PetFeeder, DeviceType.Heater;
|
|
50692
|
+
DeviceType.Camera, DeviceType.Sensor, DeviceType.Button, DeviceType.Switch, DeviceType.PetFeeder, DeviceType.Container, DeviceType.Thermostat, DeviceType.EventEmitter, DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Thermostat, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.Fan, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.PetFountain, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Heater, DeviceType.Dryer, DeviceType.Gateway, DeviceType.Camera, DeviceType.Fan, DeviceType.Lock, DeviceType.Camera, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Heater, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Heater, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Heater, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Heater, DeviceType.Gateway, DeviceType.Hub, DeviceType.Camera, DeviceType.Sensor, DeviceType.MediaPlayer, DeviceType.Vacuum, DeviceType.Generic, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.PetFountain, DeviceType.Fan, DeviceType.Humidifier, DeviceType.Climate, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.MediaPlayer, DeviceType.WaterHeater, DeviceType.Humidifier, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.PetFeeder, DeviceType.Heater, DeviceType.MediaPlayer;
|
|
50544
50693
|
var NUMBER = {
|
|
50545
50694
|
kind: "fixed",
|
|
50546
50695
|
result: ["number"]
|
|
@@ -52562,6 +52711,7 @@ method(InstancePinSchema, DeviceExportStatusSchema), method(_void(), array(Expor
|
|
|
52562
52711
|
kind: "mutation",
|
|
52563
52712
|
auth: "admin"
|
|
52564
52713
|
});
|
|
52714
|
+
var DeviceAliasSchema = string().max(64).regex(/^[a-z][a-z0-9_]*$/);
|
|
52565
52715
|
/**
|
|
52566
52716
|
* A SITE ZONE — a named part of the property that several locations belong to.
|
|
52567
52717
|
*
|
|
@@ -53048,6 +53198,12 @@ var DeviceInfoSchema = object({
|
|
|
53048
53198
|
addonId: string(),
|
|
53049
53199
|
type: _enum(DeviceType),
|
|
53050
53200
|
name: string(),
|
|
53201
|
+
/** The name a value template uses for this device (`{{ stufa_veranda.temperature }}`),
|
|
53202
|
+
* entity_id style. Generated once from the name at first registration, unique
|
|
53203
|
+
* cluster-wide, editable through `setAlias`, NOT changed by a rename (D1021).
|
|
53204
|
+
* Optional: a record produced by an older build omits it until the boot
|
|
53205
|
+
* backfill has run. */
|
|
53206
|
+
alias: DeviceAliasSchema.optional(),
|
|
53051
53207
|
/** Operator-organisational location label. `null` when unset. */
|
|
53052
53208
|
location: string().nullable(),
|
|
53053
53209
|
/** Soft-disabled flag. */
|
|
@@ -53367,6 +53523,25 @@ method(object({
|
|
|
53367
53523
|
}), _void(), {
|
|
53368
53524
|
kind: "mutation",
|
|
53369
53525
|
auth: "admin"
|
|
53526
|
+
}), method(object({
|
|
53527
|
+
deviceId: number(),
|
|
53528
|
+
alias: string()
|
|
53529
|
+
}), discriminatedUnion("ok", [object({
|
|
53530
|
+
ok: literal(true),
|
|
53531
|
+
alias: DeviceAliasSchema
|
|
53532
|
+
}), object({
|
|
53533
|
+
ok: literal(false),
|
|
53534
|
+
reason: _enum([
|
|
53535
|
+
"empty",
|
|
53536
|
+
"too-long",
|
|
53537
|
+
"grammar",
|
|
53538
|
+
"reserved",
|
|
53539
|
+
"taken"
|
|
53540
|
+
]),
|
|
53541
|
+
takenBy: number().optional()
|
|
53542
|
+
})]), {
|
|
53543
|
+
kind: "mutation",
|
|
53544
|
+
auth: "admin"
|
|
53370
53545
|
}), method(object({
|
|
53371
53546
|
deviceId: number(),
|
|
53372
53547
|
location: string().nullable()
|
|
@@ -57095,7 +57270,7 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
|
|
|
57095
57270
|
* or the redaction token KEEPS the stored secret; `{ $secretClear: true }`
|
|
57096
57271
|
* clears it.
|
|
57097
57272
|
*/
|
|
57098
|
-
var ConfigSchemaPassthrough$
|
|
57273
|
+
var ConfigSchemaPassthrough$2 = custom();
|
|
57099
57274
|
var IntegrationInstanceIdSchema = string().min(1);
|
|
57100
57275
|
var IntegrationInstanceModeSchema = _enum(["single", "multiple"]);
|
|
57101
57276
|
/**
|
|
@@ -57141,7 +57316,16 @@ var IntegrationInstanceKindSchema = object({
|
|
|
57141
57316
|
/** Relative hub path to start an interactive account link of an instance of this kind. */
|
|
57142
57317
|
connectPath: string().min(1).optional(),
|
|
57143
57318
|
/** Relative hub path to disconnect that account. */
|
|
57144
|
-
disconnectPath: string().min(1).optional()
|
|
57319
|
+
disconnectPath: string().min(1).optional(),
|
|
57320
|
+
/**
|
|
57321
|
+
* Parts of the edit dialog the flat form cannot draw (a node picker, a model source), named by a
|
|
57322
|
+
* GENERIC widget id the client maps to a component; a client that knows none of them shows none.
|
|
57323
|
+
* `connection` widgets write connection values, `model` widgets own the model choice.
|
|
57324
|
+
*/
|
|
57325
|
+
widgets: array(object({
|
|
57326
|
+
id: string().min(1),
|
|
57327
|
+
placement: _enum(["connection", "model"])
|
|
57328
|
+
})).optional()
|
|
57145
57329
|
});
|
|
57146
57330
|
/**
|
|
57147
57331
|
* How devices of an instance are found. `none`: the operator adds them by hand; `lan`: the addon
|
|
@@ -57182,10 +57366,11 @@ var IntegrationInstanceDescriptionSchema = object({
|
|
|
57182
57366
|
/** True when `testInstance` really probes the remote. */
|
|
57183
57367
|
canTest: boolean(),
|
|
57184
57368
|
/**
|
|
57185
|
-
* The kinds an instance can be of
|
|
57186
|
-
* Add flow asks which first and sends it as
|
|
57369
|
+
* The kinds an instance can be of (D1013 rule 1), each naming its `functionCap`. One entry:
|
|
57370
|
+
* nothing to choose; more than one: the Add flow asks which first and sends it as
|
|
57371
|
+
* `createInstance.kind`. Never empty: every instance belongs to exactly one kind.
|
|
57187
57372
|
*/
|
|
57188
|
-
kinds: array(IntegrationInstanceKindSchema).
|
|
57373
|
+
kinds: array(IntegrationInstanceKindSchema).min(1),
|
|
57189
57374
|
/**
|
|
57190
57375
|
* The provider accepts `createInstance.id` for an id that once existed (an adopted id, because
|
|
57191
57376
|
* devices carry it). The UI then offers "restore under its old id" on Add. Absent means no.
|
|
@@ -57221,8 +57406,8 @@ var IntegrationInstanceSchema = object({
|
|
|
57221
57406
|
* the body is the one store, `setInstanceEnabled` the one writer (epic #440, step 3).
|
|
57222
57407
|
*/
|
|
57223
57408
|
enabled: boolean().optional(),
|
|
57224
|
-
/** The kind of this instance
|
|
57225
|
-
kind: string().
|
|
57409
|
+
/** The kind of this instance: exactly one of `describe().kinds[].id` (D1013 rule 2). */
|
|
57410
|
+
kind: string().min(1),
|
|
57226
57411
|
/** Values for the instance form; a secret is a `SecretFieldView`, never text. */
|
|
57227
57412
|
formValues: record(string(), unknown()),
|
|
57228
57413
|
status: IntegrationInstanceStatusSchema.optional(),
|
|
@@ -57246,7 +57431,7 @@ var integrationInstancesCapability = {
|
|
|
57246
57431
|
id: IntegrationInstanceIdSchema.nullable(),
|
|
57247
57432
|
/** The kind of the create form (`id: null`) of a provider with several. */
|
|
57248
57433
|
kind: string().min(1).optional()
|
|
57249
|
-
}), ConfigSchemaPassthrough$
|
|
57434
|
+
}), ConfigSchemaPassthrough$2, { auth: "admin" }),
|
|
57250
57435
|
listInstances: method(_void(), array(IntegrationInstanceSchema).readonly(), { auth: "admin" }),
|
|
57251
57436
|
getInstance: method(object({ id: IntegrationInstanceIdSchema }), IntegrationInstanceSchema.nullable(), { auth: "admin" }),
|
|
57252
57437
|
/**
|
|
@@ -58348,12 +58533,12 @@ var LlmModelInfoSchema = object({
|
|
|
58348
58533
|
});
|
|
58349
58534
|
/**
|
|
58350
58535
|
* The provider-specific part of a profile, validated by the provider that owns
|
|
58351
|
-
* the kind (
|
|
58536
|
+
* the kind (saving an instance refuses what it does not accept). A field its
|
|
58352
58537
|
* `connectionSchema` declares `type: 'password'` is a secret: it is held in the
|
|
58353
58538
|
* keychain, never in the row, and reads back as the redaction marker.
|
|
58354
58539
|
*/
|
|
58355
58540
|
var LlmProviderConfigSchema = record(string(), unknown());
|
|
58356
|
-
|
|
58541
|
+
object({
|
|
58357
58542
|
id: string(),
|
|
58358
58543
|
name: string(),
|
|
58359
58544
|
/** The provider-declared kind (`LlmProfileKindDescriptor.kind`). */
|
|
@@ -58447,8 +58632,8 @@ var LlmProviderWidgetSchema = object({
|
|
|
58447
58632
|
/** ConfigUISchema tree passed through untyped on the wire (the
|
|
58448
58633
|
* notification-output `ConfigSchemaPassthrough` precedent at
|
|
58449
58634
|
* notification-output.cap.ts:151); the exported TS type re-tightens it. */
|
|
58450
|
-
var ConfigSchemaPassthrough$
|
|
58451
|
-
|
|
58635
|
+
var ConfigSchemaPassthrough$1 = unknown();
|
|
58636
|
+
object({
|
|
58452
58637
|
kind: LlmProfileKindSchema,
|
|
58453
58638
|
label: string(),
|
|
58454
58639
|
/** A generic icon name (`cloud`, `plug`, `cpu`) — never a glyph or a logo. */
|
|
@@ -58456,9 +58641,9 @@ var LlmProfileKindDescriptorSchema = object({
|
|
|
58456
58641
|
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
58457
58642
|
addonId: string(),
|
|
58458
58643
|
/** The provider's own fields (`providerConfig`); `password` fields are keychain-held. */
|
|
58459
|
-
connectionSchema: ConfigSchemaPassthrough$
|
|
58644
|
+
connectionSchema: ConfigSchemaPassthrough$1,
|
|
58460
58645
|
/** Provider fields that belong under "Advanced" (extra headers, runtime tuning). */
|
|
58461
|
-
advancedSchema: ConfigSchemaPassthrough$
|
|
58646
|
+
advancedSchema: ConfigSchemaPassthrough$1.optional(),
|
|
58462
58647
|
/** The kind's defaults; a model from `listModels` may override any of them. */
|
|
58463
58648
|
features: LlmModelFeaturesSchema,
|
|
58464
58649
|
/** `false` = the provider stamps `supportsVision` itself (from what a node reports). */
|
|
@@ -58587,20 +58772,7 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
|
|
|
58587
58772
|
}), method(object({
|
|
58588
58773
|
addonId: string().optional(),
|
|
58589
58774
|
requestId: string()
|
|
58590
|
-
}), _void(), { kind: "mutation" }), method(
|
|
58591
|
-
kind: "mutation",
|
|
58592
|
-
auth: "admin"
|
|
58593
|
-
}), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
|
|
58594
|
-
kind: "mutation",
|
|
58595
|
-
auth: "admin"
|
|
58596
|
-
}), method(ProfileRefInputSchema, _void(), {
|
|
58597
|
-
kind: "mutation",
|
|
58598
|
-
auth: "admin"
|
|
58599
|
-
}), method(ProfileRefInputSchema, LlmGenerateResultSchema, {
|
|
58600
|
-
kind: "mutation",
|
|
58601
|
-
auth: "admin",
|
|
58602
|
-
timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
|
|
58603
|
-
}), method(LlmListModelsInputSchema, LlmListModelsResultSchema, {
|
|
58775
|
+
}), _void(), { kind: "mutation" }), method(LlmListModelsInputSchema, LlmListModelsResultSchema, {
|
|
58604
58776
|
kind: "mutation",
|
|
58605
58777
|
auth: "admin"
|
|
58606
58778
|
}), method(object({}), array(LlmDefaultSchema)), method(object({
|
|
@@ -59663,20 +59835,7 @@ method(_void(), MeshStatusSchema), method(object({
|
|
|
59663
59835
|
/** Optional hostname override the host should advertise once joined. */
|
|
59664
59836
|
hostname: string().optional() }), object({
|
|
59665
59837
|
/** Authentication URL the operator should open in a browser. */
|
|
59666
|
-
loginUrl: string() }), { kind: "mutation" }), method(_void(), object({ left: literal(true) }), { kind: "mutation" }), method(_void(), object({ loggedOut: literal(true) }), { kind: "mutation" }), method(_void(), object({ peers: array(MeshPeerSchema).readonly() }))
|
|
59667
|
-
/** Optional auth key — when provided, probes the key validity
|
|
59668
|
-
* against the provider's API. Omit when already joined to
|
|
59669
|
-
* just ping the daemon. */
|
|
59670
|
-
authKey: string().optional() }), object({
|
|
59671
|
-
ok: boolean(),
|
|
59672
|
-
/** Provider-side identifier resolved by the probe (tailnet
|
|
59673
|
-
* name for Tailscale, network id for ZeroTier, etc.). */
|
|
59674
|
-
tenant: string().optional(),
|
|
59675
|
-
/** Daemon binary version, when reachable. */
|
|
59676
|
-
daemonVersion: string().optional(),
|
|
59677
|
-
/** Human-readable error when `ok: false`. */
|
|
59678
|
-
error: string().optional()
|
|
59679
|
-
}), { kind: "mutation" });
|
|
59838
|
+
loginUrl: string() }), { kind: "mutation" }), method(_void(), object({ left: literal(true) }), { kind: "mutation" }), method(_void(), object({ loggedOut: literal(true) }), { kind: "mutation" }), method(_void(), object({ peers: array(MeshPeerSchema).readonly() }));
|
|
59680
59839
|
/**
|
|
59681
59840
|
* A monotonic total between resets (D944). Energy uses `power-meter.energy`
|
|
59682
59841
|
* so dashboards keep one series; every other instantaneous reading lands here.
|
|
@@ -67503,6 +67662,11 @@ var NcScheduleSchema = object({
|
|
|
67503
67662
|
* as a STATE SUMMARY at the end of each window of `schedule`.
|
|
67504
67663
|
*/
|
|
67505
67664
|
var NcSystemEventDeliveryModeSchema = _enum(["instant", "summary"]);
|
|
67665
|
+
_enum([
|
|
67666
|
+
"activation",
|
|
67667
|
+
"deactivation",
|
|
67668
|
+
"schedule"
|
|
67669
|
+
]);
|
|
67506
67670
|
/**
|
|
67507
67671
|
* How a summary window is SENT (D698): `rule` (absent) = ONE notification with
|
|
67508
67672
|
* every section; `section` = one notification per section with something to
|
|
@@ -67519,11 +67683,26 @@ var NcStateSummarySplitSchema = _enum(["rule", "section"]);
|
|
|
67519
67683
|
* midnight crossing); the send time is each window's END. Refused on the
|
|
67520
67684
|
* `alarm` family, which stays instant (`systemEventDeliveryProblems`).
|
|
67521
67685
|
*/
|
|
67522
|
-
var NcSystemEventDeliverySchema = discriminatedUnion("mode", [
|
|
67523
|
-
mode: literal("
|
|
67524
|
-
|
|
67525
|
-
|
|
67526
|
-
|
|
67686
|
+
var NcSystemEventDeliverySchema = discriminatedUnion("mode", [
|
|
67687
|
+
object({ mode: literal("instant") }),
|
|
67688
|
+
object({
|
|
67689
|
+
mode: literal("summary"),
|
|
67690
|
+
schedule: NcScheduleSchema,
|
|
67691
|
+
split: NcStateSummarySplitSchema.optional()
|
|
67692
|
+
}),
|
|
67693
|
+
object({
|
|
67694
|
+
mode: literal("modes"),
|
|
67695
|
+
/** The bad edge, and every kind that has a single edge. */
|
|
67696
|
+
onActivation: boolean(),
|
|
67697
|
+
/** The recovery edges of the classes of the selected kinds (derived, never stored per kind). */
|
|
67698
|
+
onDeactivation: boolean(),
|
|
67699
|
+
/** A state summary at the end of each window; absent = no summary. */
|
|
67700
|
+
onSchedule: object({
|
|
67701
|
+
schedule: NcScheduleSchema,
|
|
67702
|
+
grouping: NcStateSummarySplitSchema
|
|
67703
|
+
}).optional()
|
|
67704
|
+
})
|
|
67705
|
+
]);
|
|
67527
67706
|
/** Fuzzy plate matcher — OCR noise makes exact match useless (spec row 12/13). */
|
|
67528
67707
|
var NcPlateMatcherSchema = object({
|
|
67529
67708
|
/**
|
|
@@ -69883,61 +70062,6 @@ var OauthIntegrationDescriptorSchema = object({
|
|
|
69883
70062
|
});
|
|
69884
70063
|
method(_void(), OauthIntegrationDescriptorSchema, { auth: "admin" });
|
|
69885
70064
|
/**
|
|
69886
|
-
* `oidc-connections` — CRUD for IdP rows under `auth-oidc` (D828 sibling).
|
|
69887
|
-
*
|
|
69888
|
-
* One hub-only singleton (`auth-oidc`). The Settings UI is a DataTable +
|
|
69889
|
-
* ItemFormDialog; there is no `editable-array` in `globalSettingsSchema`.
|
|
69890
|
-
* Operator-chosen `id` is the URL slug (`/addon/auth-oidc/<id>/…`) and is
|
|
69891
|
-
* immutable after create.
|
|
69892
|
-
*/
|
|
69893
|
-
var ConfigSchemaPassthrough$1 = unknown();
|
|
69894
|
-
var OidcConnectionSchema = object({
|
|
69895
|
-
id: string().min(1),
|
|
69896
|
-
displayName: string(),
|
|
69897
|
-
icon: string(),
|
|
69898
|
-
issuerUrl: string(),
|
|
69899
|
-
clientId: string(),
|
|
69900
|
-
/** Client id + secret present — never the secret value. */
|
|
69901
|
-
configured: boolean(),
|
|
69902
|
-
/**
|
|
69903
|
-
* Values for the connection form schema. `clientSecret` is a keychain
|
|
69904
|
-
* {@link SecretFieldView} or `null` / `''`, never plaintext (D789).
|
|
69905
|
-
*/
|
|
69906
|
-
formValues: record(string(), unknown()).optional()
|
|
69907
|
-
});
|
|
69908
|
-
/**
|
|
69909
|
-
* Patch one connection. Omitted or empty `clientSecret` keeps the stored
|
|
69910
|
-
* secret (D787). `{ $secretClear: true }` clears it. `id` is never renamed.
|
|
69911
|
-
*/
|
|
69912
|
-
var OidcConnectionUpdateInputSchema = object({
|
|
69913
|
-
id: string().min(1),
|
|
69914
|
-
displayName: string().min(1),
|
|
69915
|
-
icon: string().optional(),
|
|
69916
|
-
issuerUrl: string().optional(),
|
|
69917
|
-
clientId: string().optional(),
|
|
69918
|
-
clientSecret: union([string(), object({ $secretClear: literal(true) })]).optional(),
|
|
69919
|
-
redirectUri: string().optional(),
|
|
69920
|
-
scopes: string().optional(),
|
|
69921
|
-
usernameClaim: _enum([
|
|
69922
|
-
"preferred_username",
|
|
69923
|
-
"email",
|
|
69924
|
-
"sub"
|
|
69925
|
-
]).optional()
|
|
69926
|
-
});
|
|
69927
|
-
method(object({}), ConfigSchemaPassthrough$1, { auth: "admin" }), method(object({}), array(OidcConnectionSchema).readonly(), { auth: "admin" }), method(object({
|
|
69928
|
-
id: string().min(1).regex(/^[a-z0-9][a-z0-9-]{0,63}$/, "id must be a lowercase slug"),
|
|
69929
|
-
displayName: string().min(1)
|
|
69930
|
-
}), object({ id: string() }), {
|
|
69931
|
-
kind: "mutation",
|
|
69932
|
-
auth: "admin"
|
|
69933
|
-
}), method(OidcConnectionUpdateInputSchema, object({ ok: literal(true) }), {
|
|
69934
|
-
kind: "mutation",
|
|
69935
|
-
auth: "admin"
|
|
69936
|
-
}), method(object({ id: string().min(1) }), object({ ok: literal(true) }), {
|
|
69937
|
-
kind: "mutation",
|
|
69938
|
-
auth: "admin"
|
|
69939
|
-
});
|
|
69940
|
-
/**
|
|
69941
70065
|
* Generic on-screen-display (video overlay) cap. Each camera exposes
|
|
69942
70066
|
* a firmware-defined list of overlays (channel name, timestamp,
|
|
69943
70067
|
* watermark, logo, …); the cap models them as a homogeneous array of
|
|
@@ -76258,6 +76382,16 @@ var RemoteLayoutComponentSchema = object({
|
|
|
76258
76382
|
method(object({}), array(RemoteLayoutComponentSchema), { auth: "protected" });
|
|
76259
76383
|
var RUNNING_POWER_START_DELAY_MS = 3e4;
|
|
76260
76384
|
var RUNNING_POWER_STOP_DELAY_MS = 18e4;
|
|
76385
|
+
/**
|
|
76386
|
+
* Per-type overrides of the dwell defaults. A media player draws power the
|
|
76387
|
+
* moment it is on and stops drawing the moment it is off, so it needs neither
|
|
76388
|
+
* a long dwell nor a second sample. A type absent here keeps the global values.
|
|
76389
|
+
*/
|
|
76390
|
+
var RUNNING_POWER_DEFAULTS_BY_TYPE = { [DeviceType.MediaPlayer]: {
|
|
76391
|
+
startDwellMs: 1e4,
|
|
76392
|
+
stopDwellMs: 1e4,
|
|
76393
|
+
minSamples: 1
|
|
76394
|
+
} };
|
|
76261
76395
|
var RunningStateSourceSchema = _enum(["native", "assigned"]);
|
|
76262
76396
|
var RunningStateStatusSchema = object({
|
|
76263
76397
|
/** null = unknown — never coerced to false (D393). */
|
|
@@ -76275,93 +76409,27 @@ var RunningFlipEventDataSchema = object({
|
|
|
76275
76409
|
phase: string().nullable()
|
|
76276
76410
|
});
|
|
76277
76411
|
var RUNNING_DEVICE_TYPES = Object.values(DeviceType);
|
|
76278
|
-
/**
|
|
76279
|
-
|
|
76280
|
-
|
|
76281
|
-
|
|
76282
|
-
|
|
76283
|
-
|
|
76284
|
-
|
|
76285
|
-
|
|
76286
|
-
|
|
76287
|
-
|
|
76288
|
-
|
|
76289
|
-
|
|
76290
|
-
|
|
76291
|
-
|
|
76292
|
-
|
|
76293
|
-
|
|
76294
|
-
|
|
76295
|
-
|
|
76296
|
-
|
|
76297
|
-
|
|
76298
|
-
|
|
76299
|
-
DeviceType.WaterHeater,
|
|
76300
|
-
DeviceType.Humidifier,
|
|
76301
|
-
DeviceType.Fan,
|
|
76302
|
-
DeviceType.Climate,
|
|
76303
|
-
DeviceType.Thermostat,
|
|
76304
|
-
DeviceType.PetFeeder,
|
|
76305
|
-
DeviceType.Heater
|
|
76306
|
-
],
|
|
76307
|
-
apply: "add",
|
|
76308
|
-
path: "running",
|
|
76309
|
-
sources: [
|
|
76310
|
-
{
|
|
76311
|
-
kind: "switch",
|
|
76312
|
-
transforms: [{ kind: "identity" }]
|
|
76313
|
-
},
|
|
76314
|
-
{
|
|
76315
|
-
kind: "binary",
|
|
76316
|
-
transforms: [{ kind: "identity" }, { kind: "invert" }]
|
|
76317
|
-
},
|
|
76318
|
-
{
|
|
76319
|
-
kind: "numeric",
|
|
76320
|
-
requiredUnit: "W",
|
|
76321
|
-
transforms: [{
|
|
76322
|
-
kind: "threshold",
|
|
76323
|
-
comparisons: ["gte", "lte"],
|
|
76324
|
-
comparison: "gte",
|
|
76325
|
-
defaultThreshold: 5,
|
|
76326
|
-
defaultStartDwellMs: RUNNING_POWER_START_DELAY_MS,
|
|
76327
|
-
defaultStopDwellMs: RUNNING_POWER_STOP_DELAY_MS,
|
|
76328
|
-
thresholdUnit: "W"
|
|
76329
|
-
}]
|
|
76330
|
-
}
|
|
76331
|
-
],
|
|
76332
|
-
companions: [
|
|
76333
|
-
{
|
|
76334
|
-
kind: "constant",
|
|
76335
|
-
path: "source",
|
|
76336
|
-
value: "assigned",
|
|
76337
|
-
when: "always"
|
|
76338
|
-
},
|
|
76339
|
-
{
|
|
76340
|
-
kind: "constant",
|
|
76341
|
-
path: "phase",
|
|
76342
|
-
value: null,
|
|
76343
|
-
when: "add"
|
|
76344
|
-
},
|
|
76345
|
-
{
|
|
76346
|
-
kind: "clock",
|
|
76347
|
-
path: "lastFetchedAt",
|
|
76348
|
-
when: "always"
|
|
76349
|
-
},
|
|
76350
|
-
{
|
|
76351
|
-
kind: "transition-time",
|
|
76352
|
-
path: "since",
|
|
76353
|
-
sourceChangedAt: "prefer"
|
|
76354
|
-
}
|
|
76355
|
-
],
|
|
76356
|
-
sourceReport: {
|
|
76357
|
-
status: "assignment-status",
|
|
76358
|
-
runtimeField: "source",
|
|
76359
|
-
nativeValue: "native",
|
|
76360
|
-
assignedValue: "assigned"
|
|
76361
|
-
},
|
|
76362
|
-
advancedExpression: true
|
|
76363
|
-
}]
|
|
76364
|
-
};
|
|
76412
|
+
/**
|
|
76413
|
+
* Customize offers "running" only where a job makes sense (D933): a cycle,
|
|
76414
|
+
* a clean, a mow, playback, or another appliance that is on and working.
|
|
76415
|
+
* The cap itself stays on every type — a camera can still report running
|
|
76416
|
+
* natively; it just has no card.
|
|
76417
|
+
*/
|
|
76418
|
+
var RUNNING_CUSTOMIZE_DEVICE_TYPES = [
|
|
76419
|
+
DeviceType.Washer,
|
|
76420
|
+
DeviceType.Dryer,
|
|
76421
|
+
DeviceType.Dishwasher,
|
|
76422
|
+
DeviceType.Vacuum,
|
|
76423
|
+
DeviceType.LawnMower,
|
|
76424
|
+
DeviceType.MediaPlayer,
|
|
76425
|
+
DeviceType.WaterHeater,
|
|
76426
|
+
DeviceType.Humidifier,
|
|
76427
|
+
DeviceType.Fan,
|
|
76428
|
+
DeviceType.Climate,
|
|
76429
|
+
DeviceType.Thermostat,
|
|
76430
|
+
DeviceType.PetFeeder,
|
|
76431
|
+
DeviceType.Heater
|
|
76432
|
+
];
|
|
76365
76433
|
var runningStateCapability = {
|
|
76366
76434
|
name: "running-state",
|
|
76367
76435
|
scope: "device",
|
|
@@ -76381,7 +76449,79 @@ var runningStateCapability = {
|
|
|
76381
76449
|
durability: "restored",
|
|
76382
76450
|
history: { fields: { running: { kind: "boolean" } } },
|
|
76383
76451
|
volatileStateFields: ["lastFetchedAt"],
|
|
76384
|
-
customize:
|
|
76452
|
+
customize: {
|
|
76453
|
+
version: 1,
|
|
76454
|
+
overridable: [{
|
|
76455
|
+
path: "running",
|
|
76456
|
+
by: "running"
|
|
76457
|
+
}],
|
|
76458
|
+
targets: [{
|
|
76459
|
+
id: "running",
|
|
76460
|
+
cardinality: "scalar",
|
|
76461
|
+
vocabulary: {
|
|
76462
|
+
cap: "running-state",
|
|
76463
|
+
stateField: "running"
|
|
76464
|
+
},
|
|
76465
|
+
deviceTypes: RUNNING_CUSTOMIZE_DEVICE_TYPES,
|
|
76466
|
+
apply: "add",
|
|
76467
|
+
path: "running",
|
|
76468
|
+
sources: [
|
|
76469
|
+
{
|
|
76470
|
+
kind: "switch",
|
|
76471
|
+
transforms: [{ kind: "identity" }]
|
|
76472
|
+
},
|
|
76473
|
+
{
|
|
76474
|
+
kind: "binary",
|
|
76475
|
+
transforms: [{ kind: "identity" }, { kind: "invert" }]
|
|
76476
|
+
},
|
|
76477
|
+
{
|
|
76478
|
+
kind: "numeric",
|
|
76479
|
+
requiredUnit: "W",
|
|
76480
|
+
transforms: [{
|
|
76481
|
+
kind: "threshold",
|
|
76482
|
+
comparisons: ["gte", "lte"],
|
|
76483
|
+
comparison: "gte",
|
|
76484
|
+
defaultThreshold: 5,
|
|
76485
|
+
defaultStartDwellMs: RUNNING_POWER_START_DELAY_MS,
|
|
76486
|
+
defaultStopDwellMs: RUNNING_POWER_STOP_DELAY_MS,
|
|
76487
|
+
deviceTypeDefaults: RUNNING_POWER_DEFAULTS_BY_TYPE,
|
|
76488
|
+
thresholdUnit: "W"
|
|
76489
|
+
}]
|
|
76490
|
+
}
|
|
76491
|
+
],
|
|
76492
|
+
companions: [
|
|
76493
|
+
{
|
|
76494
|
+
kind: "constant",
|
|
76495
|
+
path: "source",
|
|
76496
|
+
value: "assigned",
|
|
76497
|
+
when: "always"
|
|
76498
|
+
},
|
|
76499
|
+
{
|
|
76500
|
+
kind: "constant",
|
|
76501
|
+
path: "phase",
|
|
76502
|
+
value: null,
|
|
76503
|
+
when: "add"
|
|
76504
|
+
},
|
|
76505
|
+
{
|
|
76506
|
+
kind: "clock",
|
|
76507
|
+
path: "lastFetchedAt",
|
|
76508
|
+
when: "always"
|
|
76509
|
+
},
|
|
76510
|
+
{
|
|
76511
|
+
kind: "transition-time",
|
|
76512
|
+
path: "since",
|
|
76513
|
+
sourceChangedAt: "prefer"
|
|
76514
|
+
}
|
|
76515
|
+
],
|
|
76516
|
+
sourceReport: {
|
|
76517
|
+
status: "assignment-status",
|
|
76518
|
+
runtimeField: "source",
|
|
76519
|
+
nativeValue: "native",
|
|
76520
|
+
assignedValue: "assigned"
|
|
76521
|
+
},
|
|
76522
|
+
advancedExpression: true
|
|
76523
|
+
}]
|
|
76524
|
+
}
|
|
76385
76525
|
};
|
|
76386
76526
|
/**
|
|
76387
76527
|
* scene-monitor — device-scoped reference-region state cap. An operator marks
|
|
@@ -77729,21 +77869,6 @@ method(object({
|
|
|
77729
77869
|
*/
|
|
77730
77870
|
ttlSec: union([number().int().positive(), literal("never")]).optional()
|
|
77731
77871
|
}), object({ token: string() }), { auth: "admin" }), method(object({ token: string() }), SsoBridgeClaimsSchema.nullable(), { auth: "admin" });
|
|
77732
|
-
var ProviderListEntrySchema = discriminatedUnion("shouldSaveDiskSpace", [object({
|
|
77733
|
-
providerId: string().min(1),
|
|
77734
|
-
displayName: string().min(1),
|
|
77735
|
-
configSchema: unknown(),
|
|
77736
|
-
nodeLocal: boolean(),
|
|
77737
|
-
shouldSaveDiskSpace: literal(true),
|
|
77738
|
-
minFreePercent: number().min(0).max(100)
|
|
77739
|
-
}), object({
|
|
77740
|
-
providerId: string().min(1),
|
|
77741
|
-
displayName: string().min(1),
|
|
77742
|
-
configSchema: unknown(),
|
|
77743
|
-
nodeLocal: boolean(),
|
|
77744
|
-
shouldSaveDiskSpace: literal(false),
|
|
77745
|
-
minFreePercent: literal(null)
|
|
77746
|
-
})]);
|
|
77747
77872
|
method(object({
|
|
77748
77873
|
location: StorageLocationRefSchema,
|
|
77749
77874
|
relativePath: string()
|
|
@@ -77805,42 +77930,7 @@ method(object({
|
|
|
77805
77930
|
}), _instanceof(Uint8Array), { auth: "admin" }), method(object({ downloadId: string() }), _void(), {
|
|
77806
77931
|
kind: "mutation",
|
|
77807
77932
|
auth: "admin"
|
|
77808
|
-
}), method(object({ type: StorageLocationTypeSchema.optional() }), array(StorageLocationSchema).readonly()), method(_void(), array(StorageLocationDeclarationSchema).readonly()), method(
|
|
77809
|
-
createdAt: true,
|
|
77810
|
-
updatedAt: true
|
|
77811
|
-
}), StorageLocationSchema, {
|
|
77812
|
-
kind: "mutation",
|
|
77813
|
-
auth: "admin"
|
|
77814
|
-
}), method(object({
|
|
77815
|
-
id: string(),
|
|
77816
|
-
force: boolean().optional()
|
|
77817
|
-
}), _void(), {
|
|
77818
|
-
kind: "mutation",
|
|
77819
|
-
auth: "admin"
|
|
77820
|
-
}), method(_void(), array(StorageDrainProgressSchema).readonly()), method(object({ id: string() }), object({
|
|
77821
|
-
ok: boolean(),
|
|
77822
|
-
error: string().optional()
|
|
77823
|
-
}), { auth: "admin" }), method(_void(), array(ProviderListEntrySchema).readonly()), method(object({
|
|
77824
|
-
providerId: string(),
|
|
77825
|
-
/**
|
|
77826
|
-
* The location this config is an UNSAVED edit of, when there is one.
|
|
77827
|
-
*
|
|
77828
|
-
* `listLocations` replaces every declared secret with the redaction
|
|
77829
|
-
* sentinel, so the edit modal's form state holds the sentinel for any
|
|
77830
|
-
* credential the operator did not retype — and posting that here
|
|
77831
|
-
* without a way to resolve it makes the provider try to authenticate
|
|
77832
|
-
* as `__camstack_redacted__` and report the operator's own working
|
|
77833
|
-
* password as wrong. Given this id, the orchestrator restores each
|
|
77834
|
-
* sentinel from the stored config (same rule as `upsertLocation`)
|
|
77835
|
-
* before dispatching. Omitted by the "Add location" wizard, where
|
|
77836
|
-
* every value was typed just now and nothing is stored yet.
|
|
77837
|
-
*/
|
|
77838
|
-
locationId: string().optional(),
|
|
77839
|
-
config: record(string(), unknown())
|
|
77840
|
-
}), object({
|
|
77841
|
-
ok: boolean(),
|
|
77842
|
-
error: string().optional()
|
|
77843
|
-
}), { auth: "admin" });
|
|
77933
|
+
}), method(object({ type: StorageLocationTypeSchema.optional() }), array(StorageLocationSchema).readonly()), method(_void(), array(StorageLocationDeclarationSchema).readonly()), method(_void(), array(StorageDrainProgressSchema).readonly());
|
|
77844
77934
|
/** One table of the settings database. */
|
|
77845
77935
|
var StorageTableSchema = object({
|
|
77846
77936
|
/** The table's full name, e.g. `recorder:addon-settings` or `addon-device-settings`. */
|
|
@@ -79362,7 +79452,7 @@ var TerminalInstanceInfoSchema = object({
|
|
|
79362
79452
|
/**
|
|
79363
79453
|
* False while the node the instance is bound to is not in the cluster
|
|
79364
79454
|
* topology (forgotten, renamed, re-paired). The instance is kept; the
|
|
79365
|
-
* operator re-points it
|
|
79455
|
+
* operator re-points it on the Terminal page.
|
|
79366
79456
|
*/
|
|
79367
79457
|
nodeInCluster: boolean(),
|
|
79368
79458
|
profileId: string(),
|
|
@@ -79400,41 +79490,7 @@ var TerminalOutputBatchSchema = object({
|
|
|
79400
79490
|
snapshot: string().optional(),
|
|
79401
79491
|
events: array(TerminalOutputEventSchema).readonly()
|
|
79402
79492
|
});
|
|
79403
|
-
method(_void(), array(TerminalProfileInfoSchema).readonly(), { auth: "admin" }), method(_void(), array(
|
|
79404
|
-
targetNodeId: string().min(1),
|
|
79405
|
-
profileId: string().min(1),
|
|
79406
|
-
name: string().trim().min(1).max(160).optional(),
|
|
79407
|
-
executable: string().max(1024).optional(),
|
|
79408
|
-
args: array(string().max(2048)).max(64).optional(),
|
|
79409
|
-
cwd: string().max(1024).optional(),
|
|
79410
|
-
environment: array(string().max(4096)).max(64).optional(),
|
|
79411
|
-
profileSettings: ProfileSettingsBagSchema.optional()
|
|
79412
|
-
}), TerminalInstanceInfoSchema, {
|
|
79413
|
-
kind: "mutation",
|
|
79414
|
-
auth: "admin"
|
|
79415
|
-
}), method(object({
|
|
79416
|
-
instanceId: string().min(1),
|
|
79417
|
-
/** Re-point the instance to another node; the profile must exist there. */
|
|
79418
|
-
targetNodeId: string().min(1).max(256).optional(),
|
|
79419
|
-
name: string().trim().min(1).max(160).optional(),
|
|
79420
|
-
executable: string().max(1024).optional(),
|
|
79421
|
-
args: array(string().max(2048)).max(64).optional(),
|
|
79422
|
-
cwd: string().max(1024).optional(),
|
|
79423
|
-
environment: array(string().max(4096)).max(64).optional(),
|
|
79424
|
-
profileSettings: ProfileSettingsBagSchema.optional()
|
|
79425
|
-
}), TerminalInstanceInfoSchema, {
|
|
79426
|
-
kind: "mutation",
|
|
79427
|
-
auth: "admin"
|
|
79428
|
-
}), method(object({ instanceId: string().min(1) }), _void(), {
|
|
79429
|
-
kind: "mutation",
|
|
79430
|
-
auth: "admin"
|
|
79431
|
-
}), method(object({
|
|
79432
|
-
instanceId: string().min(1),
|
|
79433
|
-
enabled: boolean()
|
|
79434
|
-
}), TerminalInstanceInfoSchema, {
|
|
79435
|
-
kind: "mutation",
|
|
79436
|
-
auth: "admin"
|
|
79437
|
-
}), method(_void(), array(TerminalLegacyCameraSchema).readonly(), { auth: "admin" }), method(object({
|
|
79493
|
+
method(_void(), array(TerminalProfileInfoSchema).readonly(), { auth: "admin" }), method(_void(), array(TerminalLegacyCameraSchema).readonly(), { auth: "admin" }), method(object({
|
|
79438
79494
|
stableId: string().min(1),
|
|
79439
79495
|
name: string().trim().min(1).max(160).optional()
|
|
79440
79496
|
}), TerminalInstanceInfoSchema, {
|
|
@@ -79503,6 +79559,11 @@ var TimedRunUnitSchema = _enum(["s", "min"]);
|
|
|
79503
79559
|
_enum(["switch", "pet-fountain"]);
|
|
79504
79560
|
DeviceType.Heater, DeviceType.PetFountain;
|
|
79505
79561
|
var TIMED_RUN_DEVICE_TYPES = [DeviceType.Heater, DeviceType.PetFountain];
|
|
79562
|
+
/** One duration, as the one-tap run asks for it. */
|
|
79563
|
+
var TimedRunQuickRunSchema = object({
|
|
79564
|
+
duration: number().positive().finite(),
|
|
79565
|
+
unit: TimedRunUnitSchema
|
|
79566
|
+
});
|
|
79506
79567
|
/** Why a request was not carried out. Typed, so a caller can say it in words. */
|
|
79507
79568
|
var TimedRunRefusalSchema = _enum([
|
|
79508
79569
|
"unsupported-device",
|
|
@@ -79523,8 +79584,23 @@ var TimedRunStatusSchema = object({
|
|
|
79523
79584
|
activeUntil: number().nullable(),
|
|
79524
79585
|
/** Who asked for the run (a user id or an addon id); `null` when nothing is armed or it did not say. */
|
|
79525
79586
|
requestedBy: string().nullable(),
|
|
79587
|
+
/**
|
|
79588
|
+
* The one-tap run of THIS device: what a "Run" button on any surface starts. `null` when
|
|
79589
|
+
* the device is gone or its type has no timed run; a status from before this field
|
|
79590
|
+
* existed has none, and a surface falls back to the type's default.
|
|
79591
|
+
*/
|
|
79592
|
+
quickRun: TimedRunQuickRunSchema.nullable(),
|
|
79526
79593
|
lastFetchedAt: number()
|
|
79527
79594
|
});
|
|
79595
|
+
/** What the settings form needs: the unit, the bounds and the type's default. */
|
|
79596
|
+
var TimedRunOptionsSchema = object({
|
|
79597
|
+
unit: TimedRunUnitSchema,
|
|
79598
|
+
/** The longest run, in `unit`. */
|
|
79599
|
+
maxDuration: number(),
|
|
79600
|
+
defaultDuration: number()
|
|
79601
|
+
});
|
|
79602
|
+
/** The one-tap run duration, in the type's unit; `null` returns to the type's default. */
|
|
79603
|
+
var TimedRunSettingsPatchSchema = object({ quickRunDuration: number().positive().finite().nullable().optional() });
|
|
79528
79604
|
var timedRunCapability = {
|
|
79529
79605
|
name: "timed-run",
|
|
79530
79606
|
scope: "device",
|
|
@@ -79532,7 +79608,24 @@ var timedRunCapability = {
|
|
|
79532
79608
|
kind: "wrapper",
|
|
79533
79609
|
defaultActive: true,
|
|
79534
79610
|
deviceTypes: TIMED_RUN_DEVICE_TYPES,
|
|
79611
|
+
deviceConfig: { ui: {
|
|
79612
|
+
kind: "derived-form",
|
|
79613
|
+
builderId: "timed-run",
|
|
79614
|
+
tab: "general"
|
|
79615
|
+
} },
|
|
79535
79616
|
methods: {
|
|
79617
|
+
getOptions: method(object({ deviceId: number().int() }), TimedRunOptionsSchema),
|
|
79618
|
+
/**
|
|
79619
|
+
* The one-tap run of this device. A duration above the type's maximum is
|
|
79620
|
+
* REFUSED (thrown), like `runFor`: the maximum is a safety bound.
|
|
79621
|
+
*/
|
|
79622
|
+
setSettings: method(object({
|
|
79623
|
+
deviceId: number().int(),
|
|
79624
|
+
settings: TimedRunSettingsPatchSchema
|
|
79625
|
+
}), _void(), {
|
|
79626
|
+
kind: "mutation",
|
|
79627
|
+
auth: "admin"
|
|
79628
|
+
}),
|
|
79536
79629
|
/**
|
|
79537
79630
|
* Turn the device on and arm its off. A run already armed is replaced (the
|
|
79538
79631
|
* new deadline wins). Refuses with a typed reason above the type's maximum.
|
|
@@ -84851,21 +84944,28 @@ Object.freeze({
|
|
|
84851
84944
|
access: "view",
|
|
84852
84945
|
role: "admin"
|
|
84853
84946
|
},
|
|
84854
|
-
"addonSettings.
|
|
84947
|
+
"addonSettings.getIntegrationFormSchema": {
|
|
84948
|
+
capName: "addon-settings",
|
|
84949
|
+
capScope: "system",
|
|
84950
|
+
addonId: null,
|
|
84951
|
+
access: "view",
|
|
84952
|
+
role: "admin"
|
|
84953
|
+
},
|
|
84954
|
+
"addonSettings.getScopedSettings": {
|
|
84855
84955
|
capName: "addon-settings",
|
|
84856
84956
|
capScope: "system",
|
|
84857
84957
|
addonId: null,
|
|
84858
84958
|
access: "view",
|
|
84859
84959
|
role: "admin"
|
|
84860
84960
|
},
|
|
84861
|
-
"addonSettings.
|
|
84961
|
+
"addonSettings.listScopedSettings": {
|
|
84862
84962
|
capName: "addon-settings",
|
|
84863
84963
|
capScope: "system",
|
|
84864
84964
|
addonId: null,
|
|
84865
84965
|
access: "view",
|
|
84866
84966
|
role: "admin"
|
|
84867
84967
|
},
|
|
84868
|
-
"addonSettings.
|
|
84968
|
+
"addonSettings.readScopedValues": {
|
|
84869
84969
|
capName: "addon-settings",
|
|
84870
84970
|
capScope: "system",
|
|
84871
84971
|
addonId: null,
|
|
@@ -84886,7 +84986,7 @@ Object.freeze({
|
|
|
84886
84986
|
access: "create",
|
|
84887
84987
|
role: "admin"
|
|
84888
84988
|
},
|
|
84889
|
-
"addonSettings.
|
|
84989
|
+
"addonSettings.updateScopedSettings": {
|
|
84890
84990
|
capName: "addon-settings",
|
|
84891
84991
|
capScope: "system",
|
|
84892
84992
|
addonId: null,
|
|
@@ -87056,6 +87156,13 @@ Object.freeze({
|
|
|
87056
87156
|
access: "create",
|
|
87057
87157
|
role: "admin"
|
|
87058
87158
|
},
|
|
87159
|
+
"deviceManager.setAlias": {
|
|
87160
|
+
capName: "device-manager",
|
|
87161
|
+
capScope: "system",
|
|
87162
|
+
addonId: null,
|
|
87163
|
+
access: "create",
|
|
87164
|
+
role: "admin"
|
|
87165
|
+
},
|
|
87059
87166
|
"deviceManager.setChildLayout": {
|
|
87060
87167
|
capName: "device-manager",
|
|
87061
87168
|
capScope: "system",
|
|
@@ -88344,13 +88451,6 @@ Object.freeze({
|
|
|
88344
88451
|
access: "delete",
|
|
88345
88452
|
role: "admin"
|
|
88346
88453
|
},
|
|
88347
|
-
"llm.deleteProfile": {
|
|
88348
|
-
capName: "llm",
|
|
88349
|
-
capScope: "system",
|
|
88350
|
-
addonId: null,
|
|
88351
|
-
access: "delete",
|
|
88352
|
-
role: "admin"
|
|
88353
|
-
},
|
|
88354
88454
|
"llm.generate": {
|
|
88355
88455
|
capName: "llm",
|
|
88356
88456
|
capScope: "system",
|
|
@@ -88414,20 +88514,6 @@ Object.freeze({
|
|
|
88414
88514
|
access: "view",
|
|
88415
88515
|
role: "admin"
|
|
88416
88516
|
},
|
|
88417
|
-
"llm.listProfileKinds": {
|
|
88418
|
-
capName: "llm",
|
|
88419
|
-
capScope: "system",
|
|
88420
|
-
addonId: null,
|
|
88421
|
-
access: "view",
|
|
88422
|
-
role: "admin"
|
|
88423
|
-
},
|
|
88424
|
-
"llm.listProfiles": {
|
|
88425
|
-
capName: "llm",
|
|
88426
|
-
capScope: "system",
|
|
88427
|
-
addonId: null,
|
|
88428
|
-
access: "view",
|
|
88429
|
-
role: "admin"
|
|
88430
|
-
},
|
|
88431
88517
|
"llm.listRuntimeNodes": {
|
|
88432
88518
|
capName: "llm",
|
|
88433
88519
|
capScope: "system",
|
|
@@ -88435,13 +88521,6 @@ Object.freeze({
|
|
|
88435
88521
|
access: "view",
|
|
88436
88522
|
role: "admin"
|
|
88437
88523
|
},
|
|
88438
|
-
"llm.migrateRawSecrets": {
|
|
88439
|
-
capName: "llm",
|
|
88440
|
-
capScope: "system",
|
|
88441
|
-
addonId: null,
|
|
88442
|
-
access: "create",
|
|
88443
|
-
role: "admin"
|
|
88444
|
-
},
|
|
88445
88524
|
"llm.resolveModelRef": {
|
|
88446
88525
|
capName: "llm",
|
|
88447
88526
|
capScope: "system",
|
|
@@ -88470,20 +88549,6 @@ Object.freeze({
|
|
|
88470
88549
|
access: "create",
|
|
88471
88550
|
role: "admin"
|
|
88472
88551
|
},
|
|
88473
|
-
"llm.testProfile": {
|
|
88474
|
-
capName: "llm",
|
|
88475
|
-
capScope: "system",
|
|
88476
|
-
addonId: null,
|
|
88477
|
-
access: "create",
|
|
88478
|
-
role: "admin"
|
|
88479
|
-
},
|
|
88480
|
-
"llm.upsertProfile": {
|
|
88481
|
-
capName: "llm",
|
|
88482
|
-
capScope: "system",
|
|
88483
|
-
addonId: null,
|
|
88484
|
-
access: "create",
|
|
88485
|
-
role: "admin"
|
|
88486
|
-
},
|
|
88487
88552
|
"llmRuntime.appleAvailability": {
|
|
88488
88553
|
capName: "llm-runtime",
|
|
88489
88554
|
capScope: "system",
|
|
@@ -88988,13 +89053,6 @@ Object.freeze({
|
|
|
88988
89053
|
access: "create",
|
|
88989
89054
|
role: "admin"
|
|
88990
89055
|
},
|
|
88991
|
-
"meshNetwork.testConnection": {
|
|
88992
|
-
capName: "mesh-network",
|
|
88993
|
-
capScope: "system",
|
|
88994
|
-
addonId: null,
|
|
88995
|
-
access: "create",
|
|
88996
|
-
role: "admin"
|
|
88997
|
-
},
|
|
88998
89056
|
"meter.getStatus": {
|
|
88999
89057
|
capName: "meter",
|
|
89000
89058
|
capScope: "device",
|
|
@@ -89653,13 +89711,6 @@ Object.freeze({
|
|
|
89653
89711
|
access: "create",
|
|
89654
89712
|
role: "admin"
|
|
89655
89713
|
},
|
|
89656
|
-
"notificationOutput.deleteTarget": {
|
|
89657
|
-
capName: "notification-output",
|
|
89658
|
-
capScope: "system",
|
|
89659
|
-
addonId: null,
|
|
89660
|
-
access: "delete",
|
|
89661
|
-
role: "admin"
|
|
89662
|
-
},
|
|
89663
89714
|
"notificationOutput.discoverTargets": {
|
|
89664
89715
|
capName: "notification-output",
|
|
89665
89716
|
capScope: "system",
|
|
@@ -89667,13 +89718,6 @@ Object.freeze({
|
|
|
89667
89718
|
access: "view",
|
|
89668
89719
|
role: "admin"
|
|
89669
89720
|
},
|
|
89670
|
-
"notificationOutput.getTarget": {
|
|
89671
|
-
capName: "notification-output",
|
|
89672
|
-
capScope: "system",
|
|
89673
|
-
addonId: null,
|
|
89674
|
-
access: "view",
|
|
89675
|
-
role: "admin"
|
|
89676
|
-
},
|
|
89677
89721
|
"notificationOutput.listTargetKinds": {
|
|
89678
89722
|
capName: "notification-output",
|
|
89679
89723
|
capScope: "system",
|
|
@@ -89681,13 +89725,6 @@ Object.freeze({
|
|
|
89681
89725
|
access: "view",
|
|
89682
89726
|
role: "admin"
|
|
89683
89727
|
},
|
|
89684
|
-
"notificationOutput.listTargets": {
|
|
89685
|
-
capName: "notification-output",
|
|
89686
|
-
capScope: "system",
|
|
89687
|
-
addonId: null,
|
|
89688
|
-
access: "view",
|
|
89689
|
-
role: "admin"
|
|
89690
|
-
},
|
|
89691
89728
|
"notificationOutput.probeTargetConfig": {
|
|
89692
89729
|
capName: "notification-output",
|
|
89693
89730
|
capScope: "system",
|
|
@@ -89702,13 +89739,6 @@ Object.freeze({
|
|
|
89702
89739
|
access: "create",
|
|
89703
89740
|
role: "admin"
|
|
89704
89741
|
},
|
|
89705
|
-
"notificationOutput.setTargetEnabled": {
|
|
89706
|
-
capName: "notification-output",
|
|
89707
|
-
capScope: "system",
|
|
89708
|
-
addonId: null,
|
|
89709
|
-
access: "create",
|
|
89710
|
-
role: "admin"
|
|
89711
|
-
},
|
|
89712
89742
|
"notificationOutput.testTarget": {
|
|
89713
89743
|
capName: "notification-output",
|
|
89714
89744
|
capScope: "system",
|
|
@@ -89716,13 +89746,6 @@ Object.freeze({
|
|
|
89716
89746
|
access: "create",
|
|
89717
89747
|
role: "admin"
|
|
89718
89748
|
},
|
|
89719
|
-
"notificationOutput.upsertTarget": {
|
|
89720
|
-
capName: "notification-output",
|
|
89721
|
-
capScope: "system",
|
|
89722
|
-
addonId: null,
|
|
89723
|
-
access: "create",
|
|
89724
|
-
role: "admin"
|
|
89725
|
-
},
|
|
89726
89749
|
"notificationRules.activateAlarmProfile": {
|
|
89727
89750
|
capName: "notification-rules",
|
|
89728
89751
|
capScope: "system",
|
|
@@ -89982,41 +90005,6 @@ Object.freeze({
|
|
|
89982
90005
|
access: "view",
|
|
89983
90006
|
role: "admin"
|
|
89984
90007
|
},
|
|
89985
|
-
"oidcConnections.connectionFormSchema": {
|
|
89986
|
-
capName: "oidc-connections",
|
|
89987
|
-
capScope: "system",
|
|
89988
|
-
addonId: null,
|
|
89989
|
-
access: "view",
|
|
89990
|
-
role: "admin"
|
|
89991
|
-
},
|
|
89992
|
-
"oidcConnections.createConnection": {
|
|
89993
|
-
capName: "oidc-connections",
|
|
89994
|
-
capScope: "system",
|
|
89995
|
-
addonId: null,
|
|
89996
|
-
access: "create",
|
|
89997
|
-
role: "admin"
|
|
89998
|
-
},
|
|
89999
|
-
"oidcConnections.deleteConnection": {
|
|
90000
|
-
capName: "oidc-connections",
|
|
90001
|
-
capScope: "system",
|
|
90002
|
-
addonId: null,
|
|
90003
|
-
access: "delete",
|
|
90004
|
-
role: "admin"
|
|
90005
|
-
},
|
|
90006
|
-
"oidcConnections.listConnections": {
|
|
90007
|
-
capName: "oidc-connections",
|
|
90008
|
-
capScope: "system",
|
|
90009
|
-
addonId: null,
|
|
90010
|
-
access: "view",
|
|
90011
|
-
role: "admin"
|
|
90012
|
-
},
|
|
90013
|
-
"oidcConnections.updateConnection": {
|
|
90014
|
-
capName: "oidc-connections",
|
|
90015
|
-
capScope: "system",
|
|
90016
|
-
addonId: null,
|
|
90017
|
-
access: "create",
|
|
90018
|
-
role: "admin"
|
|
90019
|
-
},
|
|
90020
90008
|
"osd.getStatus": {
|
|
90021
90009
|
capName: "osd",
|
|
90022
90010
|
capScope: "device",
|
|
@@ -93048,13 +93036,6 @@ Object.freeze({
|
|
|
93048
93036
|
access: "delete",
|
|
93049
93037
|
role: "admin"
|
|
93050
93038
|
},
|
|
93051
|
-
"storage.deleteLocation": {
|
|
93052
|
-
capName: "storage",
|
|
93053
|
-
capScope: "system",
|
|
93054
|
-
addonId: null,
|
|
93055
|
-
access: "delete",
|
|
93056
|
-
role: "admin"
|
|
93057
|
-
},
|
|
93058
93039
|
"storage.endDownload": {
|
|
93059
93040
|
capName: "storage",
|
|
93060
93041
|
capScope: "system",
|
|
@@ -93111,13 +93092,6 @@ Object.freeze({
|
|
|
93111
93092
|
access: "view",
|
|
93112
93093
|
role: "admin"
|
|
93113
93094
|
},
|
|
93114
|
-
"storage.listProviders": {
|
|
93115
|
-
capName: "storage",
|
|
93116
|
-
capScope: "system",
|
|
93117
|
-
addonId: null,
|
|
93118
|
-
access: "view",
|
|
93119
|
-
role: "admin"
|
|
93120
|
-
},
|
|
93121
93095
|
"storage.read": {
|
|
93122
93096
|
capName: "storage",
|
|
93123
93097
|
capScope: "system",
|
|
@@ -93139,27 +93113,6 @@ Object.freeze({
|
|
|
93139
93113
|
access: "view",
|
|
93140
93114
|
role: "admin"
|
|
93141
93115
|
},
|
|
93142
|
-
"storage.testConfig": {
|
|
93143
|
-
capName: "storage",
|
|
93144
|
-
capScope: "system",
|
|
93145
|
-
addonId: null,
|
|
93146
|
-
access: "view",
|
|
93147
|
-
role: "admin"
|
|
93148
|
-
},
|
|
93149
|
-
"storage.testLocation": {
|
|
93150
|
-
capName: "storage",
|
|
93151
|
-
capScope: "system",
|
|
93152
|
-
addonId: null,
|
|
93153
|
-
access: "view",
|
|
93154
|
-
role: "admin"
|
|
93155
|
-
},
|
|
93156
|
-
"storage.upsertLocation": {
|
|
93157
|
-
capName: "storage",
|
|
93158
|
-
capScope: "system",
|
|
93159
|
-
addonId: null,
|
|
93160
|
-
access: "create",
|
|
93161
|
-
role: "admin"
|
|
93162
|
-
},
|
|
93163
93116
|
"storage.write": {
|
|
93164
93117
|
capName: "storage",
|
|
93165
93118
|
capScope: "system",
|
|
@@ -93937,27 +93890,6 @@ Object.freeze({
|
|
|
93937
93890
|
access: "create",
|
|
93938
93891
|
role: "admin"
|
|
93939
93892
|
},
|
|
93940
|
-
"terminalSession.createInstance": {
|
|
93941
|
-
capName: "terminal-session",
|
|
93942
|
-
capScope: "system",
|
|
93943
|
-
addonId: null,
|
|
93944
|
-
access: "create",
|
|
93945
|
-
role: "admin"
|
|
93946
|
-
},
|
|
93947
|
-
"terminalSession.deleteInstance": {
|
|
93948
|
-
capName: "terminal-session",
|
|
93949
|
-
capScope: "system",
|
|
93950
|
-
addonId: null,
|
|
93951
|
-
access: "delete",
|
|
93952
|
-
role: "admin"
|
|
93953
|
-
},
|
|
93954
|
-
"terminalSession.listInstances": {
|
|
93955
|
-
capName: "terminal-session",
|
|
93956
|
-
capScope: "system",
|
|
93957
|
-
addonId: null,
|
|
93958
|
-
access: "view",
|
|
93959
|
-
role: "admin"
|
|
93960
|
-
},
|
|
93961
93893
|
"terminalSession.listLegacyCameras": {
|
|
93962
93894
|
capName: "terminal-session",
|
|
93963
93895
|
capScope: "system",
|
|
@@ -94000,20 +93932,6 @@ Object.freeze({
|
|
|
94000
93932
|
access: "create",
|
|
94001
93933
|
role: "admin"
|
|
94002
93934
|
},
|
|
94003
|
-
"terminalSession.setInstanceEnabled": {
|
|
94004
|
-
capName: "terminal-session",
|
|
94005
|
-
capScope: "system",
|
|
94006
|
-
addonId: null,
|
|
94007
|
-
access: "create",
|
|
94008
|
-
role: "admin"
|
|
94009
|
-
},
|
|
94010
|
-
"terminalSession.updateInstance": {
|
|
94011
|
-
capName: "terminal-session",
|
|
94012
|
-
capScope: "system",
|
|
94013
|
-
addonId: null,
|
|
94014
|
-
access: "create",
|
|
94015
|
-
role: "admin"
|
|
94016
|
-
},
|
|
94017
93935
|
"terminalSession.writeInput": {
|
|
94018
93936
|
capName: "terminal-session",
|
|
94019
93937
|
capScope: "system",
|
|
@@ -94028,6 +93946,13 @@ Object.freeze({
|
|
|
94028
93946
|
access: "create",
|
|
94029
93947
|
role: "viewer"
|
|
94030
93948
|
},
|
|
93949
|
+
"timedRun.getOptions": {
|
|
93950
|
+
capName: "timed-run",
|
|
93951
|
+
capScope: "device",
|
|
93952
|
+
addonId: null,
|
|
93953
|
+
access: "view",
|
|
93954
|
+
role: "viewer"
|
|
93955
|
+
},
|
|
94031
93956
|
"timedRun.getStatus": {
|
|
94032
93957
|
capName: "timed-run",
|
|
94033
93958
|
capScope: "device",
|
|
@@ -94042,6 +93967,13 @@ Object.freeze({
|
|
|
94042
93967
|
access: "create",
|
|
94043
93968
|
role: "viewer"
|
|
94044
93969
|
},
|
|
93970
|
+
"timedRun.setSettings": {
|
|
93971
|
+
capName: "timed-run",
|
|
93972
|
+
capScope: "device",
|
|
93973
|
+
addonId: null,
|
|
93974
|
+
access: "create",
|
|
93975
|
+
role: "admin"
|
|
93976
|
+
},
|
|
94045
93977
|
"toast.onToast": {
|
|
94046
93978
|
capName: "toast",
|
|
94047
93979
|
capScope: "system",
|
|
@@ -95190,6 +95122,7 @@ function createRuntimeStateBridge(params) {
|
|
|
95190
95122
|
getStatus
|
|
95191
95123
|
};
|
|
95192
95124
|
}
|
|
95125
|
+
string().min(1).max(4096);
|
|
95193
95126
|
Object.freeze({
|
|
95194
95127
|
"accessories.getStatus": [{
|
|
95195
95128
|
name: "deviceId",
|
|
@@ -95873,6 +95806,11 @@ Object.freeze({
|
|
|
95873
95806
|
form: "single",
|
|
95874
95807
|
optional: false
|
|
95875
95808
|
}],
|
|
95809
|
+
"deviceManager.setAlias": [{
|
|
95810
|
+
name: "deviceId",
|
|
95811
|
+
form: "single",
|
|
95812
|
+
optional: false
|
|
95813
|
+
}],
|
|
95876
95814
|
"deviceManager.setChildLayout": [{
|
|
95877
95815
|
name: "deviceId",
|
|
95878
95816
|
form: "single",
|
|
@@ -97937,6 +97875,11 @@ Object.freeze({
|
|
|
97937
97875
|
form: "single",
|
|
97938
97876
|
optional: false
|
|
97939
97877
|
}],
|
|
97878
|
+
"timedRun.getOptions": [{
|
|
97879
|
+
name: "deviceId",
|
|
97880
|
+
form: "single",
|
|
97881
|
+
optional: false
|
|
97882
|
+
}],
|
|
97940
97883
|
"timedRun.getStatus": [{
|
|
97941
97884
|
name: "deviceId",
|
|
97942
97885
|
form: "single",
|
|
@@ -97947,6 +97890,11 @@ Object.freeze({
|
|
|
97947
97890
|
form: "single",
|
|
97948
97891
|
optional: false
|
|
97949
97892
|
}],
|
|
97893
|
+
"timedRun.setSettings": [{
|
|
97894
|
+
name: "deviceId",
|
|
97895
|
+
form: "single",
|
|
97896
|
+
optional: false
|
|
97897
|
+
}],
|
|
97950
97898
|
"update.getStatus": [{
|
|
97951
97899
|
name: "deviceId",
|
|
97952
97900
|
form: "single",
|
|
@@ -98809,6 +98757,7 @@ var STATE_SUMMARY_VARS = [
|
|
|
98809
98757
|
[...RULE_TEXT],
|
|
98810
98758
|
[...RULE_TEXT],
|
|
98811
98759
|
[...RULE_TEXT],
|
|
98760
|
+
[...RULE_TEXT],
|
|
98812
98761
|
[...RULE_BODY_ONLY],
|
|
98813
98762
|
[...RULE_TEXT],
|
|
98814
98763
|
([...RULE_TEXT], [...DEVICE_EVENTS]),
|
|
@@ -113104,7 +113053,13 @@ function buildHikvisionInstances(records) {
|
|
|
113104
113053
|
},
|
|
113105
113054
|
instanceMode: "single",
|
|
113106
113055
|
kind: "connection",
|
|
113107
|
-
canTest: false
|
|
113056
|
+
canTest: false,
|
|
113057
|
+
kinds: [{
|
|
113058
|
+
id: "connection",
|
|
113059
|
+
label: "Hikvision",
|
|
113060
|
+
functionCap: "device-provider",
|
|
113061
|
+
role: "devices"
|
|
113062
|
+
}]
|
|
113108
113063
|
},
|
|
113109
113064
|
formSchema: () => ({ sections: [] }),
|
|
113110
113065
|
initialBody: (name) => ({ name }),
|