@camstack/addon-provider-homematic 1.2.186 → 1.2.187
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/_stub.js +2 -2
- package/dist/{_virtual_mf-localSharedImportMap___mfe_internal__addon_provider_homematic_page-B2MUy4xX.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_provider_homematic_page-Cox4Mvzw.mjs} +5 -5
- package/dist/_virtual_mf___mfe_internal__addon_provider_homematic_page__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-CkOfgmef.mjs +26 -0
- package/dist/addon-provider-homematic.css +1 -1
- package/dist/addon.js +1817 -1862
- package/dist/addon.mjs +1817 -1862
- package/dist/{hostInit-BAkCZOkk.mjs → hostInit-CjWUx6YU.mjs} +4 -4
- package/dist/remoteEntry.js +1 -1
- package/dist/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_provider_homematic_page__remoteEntry_js-AieCvGW_.mjs → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_provider_homematic_page__remoteEntry_js-D56PzNof.mjs} +1 -1
- package/package.json +3 -3
- package/dist/_virtual_mf___mfe_internal__addon_provider_homematic_page__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-D0LApVbg.mjs +0 -26
package/dist/addon.js
CHANGED
|
@@ -8,7 +8,7 @@ let crypto$1 = require("crypto");
|
|
|
8
8
|
let fs_promises = require("fs/promises");
|
|
9
9
|
let path = require("path");
|
|
10
10
|
let node_os = require("node:os");
|
|
11
|
-
//#region ../types/dist/event-category-
|
|
11
|
+
//#region ../types/dist/event-category-78tcBemo.mjs
|
|
12
12
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
13
13
|
EventCategory["SystemBoot"] = "system.boot";
|
|
14
14
|
EventCategory["SystemAddonsReady"] = "system.addons-ready";
|
|
@@ -129,6 +129,23 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
129
129
|
*/
|
|
130
130
|
EventCategory["AddonLoadRecovered"] = "addon.load-recovered";
|
|
131
131
|
/**
|
|
132
|
+
* An addon is RUNNING although its installed package is below what the
|
|
133
|
+
* running server requires (`camstack.requires.addons` of the server, or the
|
|
134
|
+
* addon's own `requires.server`). Raised once per streak by the unsupported-
|
|
135
|
+
* addon tracker, on the hub and on agents; AlertCenter turns it into one
|
|
136
|
+
* operator alert per node and package. The addon is never held back for it.
|
|
137
|
+
*
|
|
138
|
+
* Payload: `{ packageName, addonId, nodeId, installedVersion, requiredMinimum, serverVersion, unmet }`.
|
|
139
|
+
*/
|
|
140
|
+
EventCategory["AddonUnsupportedVersion"] = "addon.unsupported-version";
|
|
141
|
+
/**
|
|
142
|
+
* The package of an {@link AddonUnsupportedVersion} alert reached a supported
|
|
143
|
+
* version, or is no longer installed on the node. AlertCenter dismisses the matching alert.
|
|
144
|
+
*
|
|
145
|
+
* Payload: `{ packageName, addonId, nodeId }`.
|
|
146
|
+
*/
|
|
147
|
+
EventCategory["AddonUnsupportedResolved"] = "addon.unsupported-resolved";
|
|
148
|
+
/**
|
|
132
149
|
* Monitor scheduled the next retry for a failed addon. Transient —
|
|
133
150
|
* surfaced to the UI for live-updating the "next retry in Ns"
|
|
134
151
|
* countdown on the Addons page row, NOT persisted as an alert.
|
|
@@ -239,7 +256,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
239
256
|
EventCategory["ProcessRestarted"] = "process.restarted";
|
|
240
257
|
/**
|
|
241
258
|
* The SET of storage locations changed — one was created, edited, enabled,
|
|
242
|
-
* disabled or deleted through
|
|
259
|
+
* disabled or deleted through the location instances or the forced-delete action.
|
|
243
260
|
*
|
|
244
261
|
* Telemetry, not a transaction (D8/D11): every consumer that re-resolves on
|
|
245
262
|
* it must also converge on its own periodic path, because a dropped event
|
|
@@ -794,7 +811,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
794
811
|
return EventCategory;
|
|
795
812
|
}({});
|
|
796
813
|
//#endregion
|
|
797
|
-
//#region ../types/dist/device-type-
|
|
814
|
+
//#region ../types/dist/device-type-DxCT0krO.mjs
|
|
798
815
|
/**
|
|
799
816
|
import { errMsg } from '@camstack/types'
|
|
800
817
|
* Extract a human-readable message from an unknown error value.
|
|
@@ -956,6 +973,13 @@ var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
|
|
|
956
973
|
* filters that want "all devices with on-motion behaviour".
|
|
957
974
|
*/
|
|
958
975
|
DeviceFeature["MotionTrigger"] = "motion-trigger";
|
|
976
|
+
/**
|
|
977
|
+
* Device can be run for a chosen time and then stopped. Mirrors the
|
|
978
|
+
* `timed-run` wrapper cap — the cap is bound by the core-blocks addon, not by
|
|
979
|
+
* a driver, so the flag is derived from the device's bindings
|
|
980
|
+
* (`featuresOfBoundCaps`). Gates the quick-run control in the viewer.
|
|
981
|
+
*/
|
|
982
|
+
DeviceFeature["TimedRun"] = "timed-run";
|
|
959
983
|
/** Light supports rgb-triplet color via `color` cap. */
|
|
960
984
|
DeviceFeature["LightColorRgb"] = "light-color-rgb";
|
|
961
985
|
/** Light supports HSV color via `color` cap. */
|
|
@@ -5990,7 +6014,7 @@ var ZodIssueCode = {
|
|
|
5990
6014
|
var ZodFirstPartyTypeKind;
|
|
5991
6015
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
5992
6016
|
//#endregion
|
|
5993
|
-
//#region ../types/dist/sleep-
|
|
6017
|
+
//#region ../types/dist/sleep-CGPZyzB5.mjs
|
|
5994
6018
|
/**
|
|
5995
6019
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
5996
6020
|
* window to float samples (D455).
|
|
@@ -6354,6 +6378,59 @@ Object.fromEntries([
|
|
|
6354
6378
|
function isValuelessField(field) {
|
|
6355
6379
|
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";
|
|
6356
6380
|
}
|
|
6381
|
+
/**
|
|
6382
|
+
* Base collector: flatten a hydrated `ConfigUISchemaWithValues` into
|
|
6383
|
+
* `key → { value, default }`, recursing through `group` and `sub-tabs`
|
|
6384
|
+
* layout fields. Keeping `value` and `default` SEPARATE (rather than
|
|
6385
|
+
* pre-resolving) lets callers both read the effective value AND detect
|
|
6386
|
+
* overrides (`value` differs from `default`). Structural over `unknown`;
|
|
6387
|
+
* malformed input yields an empty map, never throws.
|
|
6388
|
+
*/
|
|
6389
|
+
function collectHydratedFieldEntries(schema) {
|
|
6390
|
+
const out = /* @__PURE__ */ new Map();
|
|
6391
|
+
if (typeof schema !== "object" || schema === null) return out;
|
|
6392
|
+
const sections = schema.sections;
|
|
6393
|
+
if (!Array.isArray(sections)) return out;
|
|
6394
|
+
for (const section of sections) if (typeof section === "object" && section !== null) collectFieldEntriesInto(section.fields, out);
|
|
6395
|
+
return out;
|
|
6396
|
+
}
|
|
6397
|
+
/** Recursive field walker for {@link collectHydratedFieldEntries}. */
|
|
6398
|
+
function collectFieldEntriesInto(fields, into) {
|
|
6399
|
+
if (!Array.isArray(fields)) return;
|
|
6400
|
+
for (const field of fields) {
|
|
6401
|
+
if (typeof field !== "object" || field === null) continue;
|
|
6402
|
+
const type = field.type;
|
|
6403
|
+
if (type === "group") {
|
|
6404
|
+
collectFieldEntriesInto(field.fields, into);
|
|
6405
|
+
continue;
|
|
6406
|
+
}
|
|
6407
|
+
if (type === "sub-tabs") {
|
|
6408
|
+
const tabs = field.tabs;
|
|
6409
|
+
if (Array.isArray(tabs)) {
|
|
6410
|
+
for (const tab of tabs) if (typeof tab === "object" && tab !== null) collectFieldEntriesInto(tab.fields, into);
|
|
6411
|
+
}
|
|
6412
|
+
continue;
|
|
6413
|
+
}
|
|
6414
|
+
const key = field.key;
|
|
6415
|
+
if (typeof key !== "string" || key.length === 0) continue;
|
|
6416
|
+
if (!("value" in field)) continue;
|
|
6417
|
+
into.set(key, {
|
|
6418
|
+
value: field.value,
|
|
6419
|
+
default: field.default
|
|
6420
|
+
});
|
|
6421
|
+
}
|
|
6422
|
+
}
|
|
6423
|
+
/**
|
|
6424
|
+
* Flatten a hydrated settings payload into `key → EFFECTIVE value`
|
|
6425
|
+
* (`value ?? default`). The read-side inverse of `hydrateSchema` for the
|
|
6426
|
+
* common "just give me the resolved values" case. Built on
|
|
6427
|
+
* {@link collectHydratedFieldEntries}.
|
|
6428
|
+
*/
|
|
6429
|
+
function collectHydratedFieldValues(schema) {
|
|
6430
|
+
const out = /* @__PURE__ */ new Map();
|
|
6431
|
+
for (const [key, entry] of collectHydratedFieldEntries(schema)) out.set(key, entry.value ?? entry.default);
|
|
6432
|
+
return out;
|
|
6433
|
+
}
|
|
6357
6434
|
function hydrateSchema(schema, values, options = {}) {
|
|
6358
6435
|
return {
|
|
6359
6436
|
...schema.tabs ? { tabs: [...schema.tabs] } : {},
|
|
@@ -7162,6 +7239,7 @@ var RecordIntegrationInstances = class {
|
|
|
7162
7239
|
this.secretKeys = topLevelSecretKeys(kind.declaration.secretPaths);
|
|
7163
7240
|
this.secretMaps = secretMapKeys(kind.declaration.secretPaths);
|
|
7164
7241
|
this.nameField = kind.declaration.entry?.nameField ?? "name";
|
|
7242
|
+
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`);
|
|
7165
7243
|
}
|
|
7166
7244
|
/**
|
|
7167
7245
|
* One instance read for the addon's own runtime; null when absent. When the keychain is
|
|
@@ -7203,10 +7281,21 @@ var RecordIntegrationInstances = class {
|
|
|
7203
7281
|
}
|
|
7204
7282
|
return out;
|
|
7205
7283
|
}
|
|
7284
|
+
/** The kind an instance body is of: the provider's `kindOf`, else its one declared kind. */
|
|
7285
|
+
kindOfBody(body) {
|
|
7286
|
+
if (this.hooks.kindOf !== void 0) {
|
|
7287
|
+
const id = this.hooks.kindOf(body);
|
|
7288
|
+
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)`);
|
|
7289
|
+
return id;
|
|
7290
|
+
}
|
|
7291
|
+
const only = this.hooks.description.kinds[0];
|
|
7292
|
+
if (only === void 0) throw new Error(`record kind '${this.kind.name}' declares no kinds`);
|
|
7293
|
+
return only.id;
|
|
7294
|
+
}
|
|
7206
7295
|
viewOf(record) {
|
|
7207
7296
|
const shown = secretViewsOf(this.records.owner, this.kind.name, record.id, this.kind.declaration, record.data);
|
|
7208
7297
|
const rawName = record.data[this.nameField];
|
|
7209
|
-
const kind = this.
|
|
7298
|
+
const kind = this.kindOfBody(record.data);
|
|
7210
7299
|
const health = this.hooks.health?.(record.data, record.id);
|
|
7211
7300
|
return {
|
|
7212
7301
|
id: record.id,
|
|
@@ -7214,7 +7303,7 @@ var RecordIntegrationInstances = class {
|
|
|
7214
7303
|
configured: this.hooks.configured(record.data),
|
|
7215
7304
|
enabled: isInstanceEnabled(record.data),
|
|
7216
7305
|
formValues: shown,
|
|
7217
|
-
|
|
7306
|
+
kind,
|
|
7218
7307
|
...health?.status !== void 0 ? { status: health.status } : {},
|
|
7219
7308
|
...health?.lastCheckedAt !== void 0 ? { lastCheckedAt: health.lastCheckedAt } : {}
|
|
7220
7309
|
};
|
|
@@ -7247,17 +7336,35 @@ var RecordIntegrationInstances = class {
|
|
|
7247
7336
|
...kind !== void 0 ? { kind } : {}
|
|
7248
7337
|
});
|
|
7249
7338
|
if (minted === void 0) throw new Error("createInstance needs an id: this provider does not mint one");
|
|
7339
|
+
const initial = this.hooks.initialBody(name, kind);
|
|
7340
|
+
const patch = this.patchOf(values ?? {});
|
|
7341
|
+
if (Object.keys(patch).length > 0) Object.assign(patch, await this.hooks.validateWrite?.({
|
|
7342
|
+
kind,
|
|
7343
|
+
body: {
|
|
7344
|
+
...initial,
|
|
7345
|
+
...patch
|
|
7346
|
+
}
|
|
7347
|
+
}));
|
|
7250
7348
|
await this.handle.put({
|
|
7251
7349
|
id: minted,
|
|
7252
|
-
data:
|
|
7350
|
+
data: initial
|
|
7253
7351
|
}, { ifRev: 0 });
|
|
7254
|
-
const patch = this.patchOf(values ?? {});
|
|
7255
7352
|
if (Object.keys(patch).length > 0) await this.handle.patch(minted, patch);
|
|
7256
7353
|
await this.hooks.onChanged?.(minted, "created");
|
|
7257
7354
|
return { id: minted };
|
|
7258
7355
|
};
|
|
7259
7356
|
updateInstance = async ({ id, name, values }) => {
|
|
7260
7357
|
const patch = this.patchOf(values);
|
|
7358
|
+
if (this.hooks.validateWrite !== void 0 && Object.keys(patch).length > 0) {
|
|
7359
|
+
const stored = await this.handle.get(id);
|
|
7360
|
+
if (stored !== null) Object.assign(patch, await this.hooks.validateWrite({
|
|
7361
|
+
kind: void 0,
|
|
7362
|
+
body: {
|
|
7363
|
+
...stored.data,
|
|
7364
|
+
...patch
|
|
7365
|
+
}
|
|
7366
|
+
}));
|
|
7367
|
+
}
|
|
7261
7368
|
if (name !== void 0) patch[this.nameField] = name;
|
|
7262
7369
|
await this.handle.patch(id, patch);
|
|
7263
7370
|
await this.hooks.onChanged?.(id, "updated");
|
|
@@ -7568,6 +7675,21 @@ var SCOPED_SETTINGS_SCOPES = [
|
|
|
7568
7675
|
"device-defaults",
|
|
7569
7676
|
"node"
|
|
7570
7677
|
];
|
|
7678
|
+
/** The one refusal of a key a scope did not declare. */
|
|
7679
|
+
function assertDeclaredKeys(keys, declared) {
|
|
7680
|
+
const undeclared = keys.filter((key) => !declared.has(key));
|
|
7681
|
+
if (undeclared.length > 0) throw new Error(`scoped settings: [${undeclared.join(", ")}] not declared for this scope (declared: [${[...declared].join(", ")}])`);
|
|
7682
|
+
}
|
|
7683
|
+
/** Build the handle over an addon's scoped read, write and unset. */
|
|
7684
|
+
function createScopedSettings(deps) {
|
|
7685
|
+
return {
|
|
7686
|
+
async get() {
|
|
7687
|
+
return deps.schema.parse(await deps.read());
|
|
7688
|
+
},
|
|
7689
|
+
patch: (patch) => deps.write(Object.fromEntries(Object.entries(patch))),
|
|
7690
|
+
unset: (keys) => deps.unset(keys)
|
|
7691
|
+
};
|
|
7692
|
+
}
|
|
7571
7693
|
/** A write to a secret path could not be stored in the keychain, so it was refused. */
|
|
7572
7694
|
var KeychainWriteRefusedError = class extends Error {
|
|
7573
7695
|
fieldPath;
|
|
@@ -8143,7 +8265,16 @@ function createHandle(raw, opts) {
|
|
|
8143
8265
|
return blob;
|
|
8144
8266
|
}
|
|
8145
8267
|
},
|
|
8146
|
-
writeAddonStore: writeAddon
|
|
8268
|
+
writeAddonStore: writeAddon,
|
|
8269
|
+
removeClearedKeys: (keys) => serialize("addon", async () => {
|
|
8270
|
+
const stored = await readStoredAddonBlob(raw);
|
|
8271
|
+
index.seen("addon", stored);
|
|
8272
|
+
const removable = keys.filter((key) => collectSecretMarkerRefs(stored[key]).length === 0);
|
|
8273
|
+
if (removable.length === 0) return;
|
|
8274
|
+
const patch = Object.fromEntries(removable.map((key) => [key, void 0]));
|
|
8275
|
+
await raw.writeAddonStore(patch);
|
|
8276
|
+
index.wrote("addon", patch);
|
|
8277
|
+
})
|
|
8147
8278
|
};
|
|
8148
8279
|
}
|
|
8149
8280
|
/** The context the addon sees, plus the private raw view and write outcome. */
|
|
@@ -8273,7 +8404,7 @@ function boundOf(list) {
|
|
|
8273
8404
|
* Base class for CamStack addons. Eliminates settings boilerplate:
|
|
8274
8405
|
*
|
|
8275
8406
|
* - Typed `config` property with automatic resolution from store + defaults
|
|
8276
|
-
* -
|
|
8407
|
+
* - the scoped settings API (`clusterSettings` / `nodeSettings` / `deviceDefaults`) auto-implemented
|
|
8277
8408
|
* - `getAddonSettings()` / `updateAddonSettings()` auto-implemented
|
|
8278
8409
|
* - `getDeviceSettings()` / `updateDeviceSettings()` auto-implemented
|
|
8279
8410
|
* - `ctx` accessor for the AddonContext (no manual `this.ctxRef` storage)
|
|
@@ -8283,7 +8414,7 @@ function boundOf(list) {
|
|
|
8283
8414
|
* Subclasses override:
|
|
8284
8415
|
* - `onInitialize()` — addon-specific init logic, return ProviderRegistration[]
|
|
8285
8416
|
* - `onShutdown()` — cleanup
|
|
8286
|
-
* - `
|
|
8417
|
+
* - `clusterSettingsSchema()` / `nodeSettingsSchema()` / `deviceSettingsSchema()` — UI schemas
|
|
8287
8418
|
*
|
|
8288
8419
|
* @example
|
|
8289
8420
|
* ```ts
|
|
@@ -8297,7 +8428,7 @@ function boundOf(list) {
|
|
|
8297
8428
|
* super({ maxRetries: 3, endpoint: 'http://localhost' })
|
|
8298
8429
|
* }
|
|
8299
8430
|
*
|
|
8300
|
-
* protected
|
|
8431
|
+
* protected clusterSettingsSchema() {
|
|
8301
8432
|
* return this.schema({
|
|
8302
8433
|
* sections: [{
|
|
8303
8434
|
* id: 'main', title: 'Settings',
|
|
@@ -8340,7 +8471,7 @@ var BaseAddon = class {
|
|
|
8340
8471
|
defaults;
|
|
8341
8472
|
/**
|
|
8342
8473
|
* Hidden-state paths that hold secrets (D787) — values the addon writes
|
|
8343
|
-
* itself (`
|
|
8474
|
+
* itself (`state()`, the scoped writers) that no form field declares.
|
|
8344
8475
|
* Stored in the keychain exactly like a `password` field. Syntax:
|
|
8345
8476
|
* `'snapshotSigningKey'`, `'identity.pincode'`, `'tokens[userId].accessToken'`
|
|
8346
8477
|
* (`key[<id field>]` addresses array items by id, never by index).
|
|
@@ -8350,7 +8481,7 @@ var BaseAddon = class {
|
|
|
8350
8481
|
/**
|
|
8351
8482
|
* D986 M4: the scoped schemas this addon declared, resolved once per capability
|
|
8352
8483
|
* (`loadScopedSchemas`) so the sync readers (`perNodeKeys`, the secret tree, the restart check)
|
|
8353
|
-
* see them. Empty until loaded
|
|
8484
|
+
* see them. Empty until loaded.
|
|
8354
8485
|
*/
|
|
8355
8486
|
_scopedByCap = /* @__PURE__ */ new Map();
|
|
8356
8487
|
_nodeKeysByCap = /* @__PURE__ */ new Map();
|
|
@@ -8536,7 +8667,7 @@ var BaseAddon = class {
|
|
|
8536
8667
|
/** Addon-specific cleanup. Override if needed. */
|
|
8537
8668
|
async onShutdown() {}
|
|
8538
8669
|
/**
|
|
8539
|
-
* Called after config is resolved during
|
|
8670
|
+
* Called after config is resolved during a settings write.
|
|
8540
8671
|
* Override to react to config changes (e.g. restart a sampler, reconnect a service).
|
|
8541
8672
|
* Not called during initialize() — use onInitialize() for initial setup.
|
|
8542
8673
|
*/
|
|
@@ -8565,82 +8696,12 @@ var BaseAddon = class {
|
|
|
8565
8696
|
scopedSettingsCapabilities() {
|
|
8566
8697
|
return [];
|
|
8567
8698
|
}
|
|
8568
|
-
/** Override to provide global-level settings UI schema. */
|
|
8569
|
-
globalSettingsSchema(_cap) {
|
|
8570
|
-
return null;
|
|
8571
|
-
}
|
|
8572
8699
|
/** Override to provide device-level settings UI schema. */
|
|
8573
8700
|
deviceSettingsSchema() {
|
|
8574
8701
|
return null;
|
|
8575
8702
|
}
|
|
8576
8703
|
/**
|
|
8577
|
-
*
|
|
8578
|
-
* ARE the configuration of its integration.
|
|
8579
|
-
*
|
|
8580
|
-
* Return the `ConfigSection.id`s, from {@link globalSettingsSchema}, that an
|
|
8581
|
-
* operator should find on the addon's integration page (System →
|
|
8582
|
-
* Integrations → <name>) rather than only in the cluster-wide list of every
|
|
8583
|
-
* addon. Empty (the default) means the addon has no integration-level
|
|
8584
|
-
* settings and no such surface is offered — this is opt-in, because whether
|
|
8585
|
-
* an addon's configuration IS its integration's configuration depends on the
|
|
8586
|
-
* nature of the integration.
|
|
8587
|
-
*
|
|
8588
|
-
* WHAT THIS IS NOT. It is not a scope. The selected sections keep living in
|
|
8589
|
-
* the ONE global schema, in the ONE addon store, written by the ONE
|
|
8590
|
-
* `updateGlobalSettings` path. There is deliberately no
|
|
8591
|
-
* `updateIntegrationSettings`: a second write path is how a surface acquires
|
|
8592
|
-
* a second store key, and this repo has shipped that twice (`btmPath@hub`,
|
|
8593
|
-
* D266). Selecting sections cannot introduce a key that selecting cannot.
|
|
8594
|
-
*
|
|
8595
|
-
* WHY IT IS A LIST OF SECTION IDS AND NOT A MARKER ON THE SECTION.
|
|
8596
|
-
* `ConfigFieldBase` used to carry `scope?: 'device' | 'global'` and it was
|
|
8597
|
-
* removed with the reason recorded at
|
|
8598
|
-
* `packages/types/src/interfaces/config-ui.ts:249` — *"a field's scope is
|
|
8599
|
-
* determined by WHICH schema it lives in, not by a field-level marker."* A
|
|
8600
|
-
* marker sprinkled across sections also has to borrow a field that already
|
|
8601
|
-
* means something else; borrowing `section.tab` put the literal word
|
|
8602
|
-
* "integration" into an operator-facing tab bar, because `tab` means "how to
|
|
8603
|
-
* GROUP this visually" and cannot also mean "where this lives" (D269
|
|
8604
|
-
* supersedes D268). One declaration, in one place, next to the schema whose
|
|
8605
|
-
* ids it names.
|
|
8606
|
-
*/
|
|
8607
|
-
integrationSettingSections() {
|
|
8608
|
-
return [];
|
|
8609
|
-
}
|
|
8610
|
-
async getGlobalSettings(overlay, cap, nodeId) {
|
|
8611
|
-
await this.loadScopedSchemas(cap);
|
|
8612
|
-
const schema = this.globalSettingsSchema(cap) ?? this.scopedFormSchema(cap);
|
|
8613
|
-
if (!schema) return { sections: [] };
|
|
8614
|
-
const projected = await this.readRawProjectedStore(nodeId, cap);
|
|
8615
|
-
return hydrateSchema(schema, overlay ? await this.overlayKeepingMarkers(projected, overlay) : projected, { inlineSecretsAsViews: true });
|
|
8616
|
-
}
|
|
8617
|
-
/**
|
|
8618
|
-
* The integration-level view of this addon's settings: exactly the sections
|
|
8619
|
-
* named by {@link integrationSettingSections}, hydrated from the SAME store
|
|
8620
|
-
* `getGlobalSettings` reads, and narrowed to cluster-scoped fields.
|
|
8621
|
-
*
|
|
8622
|
-
* Returns `null` when the addon declared nothing — an addon that opts out has
|
|
8623
|
-
* no integration settings surface at all, rather than an empty one that reads
|
|
8624
|
-
* as a failed load.
|
|
8625
|
-
*
|
|
8626
|
-
* Three properties hold BY CONSTRUCTION, which is why they are here in core
|
|
8627
|
-
* and not in whichever UI happens to render this:
|
|
8628
|
-
*
|
|
8629
|
-
* 1. **One key.** The payload is a SUBSET of the global schema, so a field
|
|
8630
|
-
* shown here is the same field, with the same bare key, that the addon's
|
|
8631
|
-
* own page shows. There is no integration-specific writer — callers save
|
|
8632
|
-
* through `updateGlobalSettings` — so a second store key is unreachable,
|
|
8633
|
-
* not merely discouraged.
|
|
8634
|
-
* 2. **No node scope.** `perNode: true` fields are DROPPED. Their store key
|
|
8635
|
-
* is `<key>@<nodeId>` and an integration is not a node; whichever node
|
|
8636
|
-
* such a field silently picked would be a wrong answer for the operator
|
|
8637
|
-
* who opened the page (D266).
|
|
8638
|
-
* 3. **No silent typo.** A declared id that names no section throws. The
|
|
8639
|
-
* alternative — skip it — turns a rename into a surface that quietly
|
|
8640
|
-
* empties, which looks exactly like an addon with nothing to configure.
|
|
8641
|
-
*/
|
|
8642
|
-
/**
|
|
8643
|
-
* The form schema of ONE integration instance, or `null` to use {@link globalSettingsSchema}.
|
|
8704
|
+
* The form schema of ONE integration instance, or `null` to use the scoped form.
|
|
8644
8705
|
*
|
|
8645
8706
|
* Override it only when an `instanceMode: multiple` addon's instances differ: an NVR integration
|
|
8646
8707
|
* needs its connection fields, the default integration the addon's own sections. It is the
|
|
@@ -8688,37 +8749,178 @@ var BaseAddon = class {
|
|
|
8688
8749
|
}
|
|
8689
8750
|
}
|
|
8690
8751
|
/**
|
|
8752
|
+
* Hook: values layered over the stored ones when the FORM of one scope is served
|
|
8753
|
+
* ({@link getScopedSettings}) — a preview that derives dependent options without writing.
|
|
8754
|
+
* Never applied to {@link ScopedSettings.get} or to a write. `null` ⇒ no overlay.
|
|
8755
|
+
*/
|
|
8756
|
+
async scopedSettingsOverlay(_scope, _cap, _nodeId) {
|
|
8757
|
+
return null;
|
|
8758
|
+
}
|
|
8759
|
+
/**
|
|
8760
|
+
* Hook: a write of one scope changed stored values (not called when the store reports no change,
|
|
8761
|
+
* e.g. the write-back of a stored secret). `keys` are the bare field keys of the write, node keys included.
|
|
8762
|
+
*/
|
|
8763
|
+
async onScopedSettingsChanged(_scope, _cap, _keys) {}
|
|
8764
|
+
/** Typed handle over the CLUSTER settings `cap` declares (`clusterSettingsSchema`). */
|
|
8765
|
+
clusterSettings(cap, schema) {
|
|
8766
|
+
return this.scopedHandle("cluster", cap, schema);
|
|
8767
|
+
}
|
|
8768
|
+
/** Typed handle over the fleet defaults of the per-device settings `cap` declares. */
|
|
8769
|
+
deviceDefaults(cap, schema) {
|
|
8770
|
+
return this.scopedHandle("device-defaults", cap, schema);
|
|
8771
|
+
}
|
|
8772
|
+
/**
|
|
8773
|
+
* Typed handle over the settings `cap` owns PER NODE. `nodeId` omitted ⇒ the local node. A node
|
|
8774
|
+
* with no row yields the schema defaults — never a bare-key fallback.
|
|
8775
|
+
*/
|
|
8776
|
+
nodeSettings(cap, schema, nodeId) {
|
|
8777
|
+
return this.scopedHandle("node", cap, schema, nodeId);
|
|
8778
|
+
}
|
|
8779
|
+
/**
|
|
8780
|
+
* {@link state} for a value that is kept per node: stored under `<key>@<nodeId>`, and the
|
|
8781
|
+
* settings store carries `nodeId` in the row data (D986 §1), so a forgotten node's rows go in one
|
|
8782
|
+
* central delete. `nodeId` omitted ⇒ the local node.
|
|
8783
|
+
*/
|
|
8784
|
+
nodeState(key, schema, fallback, nodeId) {
|
|
8785
|
+
this._declaredStateKeys.add(key);
|
|
8786
|
+
return createDurableState({
|
|
8787
|
+
key: nodeScopedKey(key, nodeId ?? this._ctx?.kernel?.localNodeId ?? ""),
|
|
8788
|
+
schema,
|
|
8789
|
+
fallback,
|
|
8790
|
+
read: async () => this.resolveStoredSecrets(await this.readAddonStoreWithRetry()),
|
|
8791
|
+
write: async (patch) => {
|
|
8792
|
+
await this._ctx?.settings?.writeAddonStore(patch);
|
|
8793
|
+
},
|
|
8794
|
+
onParseError: (k, e) => this._ctx?.logger?.warn?.(`durable-state: stored "${k}" failed validation — using fallback`, { meta: {
|
|
8795
|
+
addonId: this._ctx?.id,
|
|
8796
|
+
key: k,
|
|
8797
|
+
error: String(e)
|
|
8798
|
+
} })
|
|
8799
|
+
});
|
|
8800
|
+
}
|
|
8801
|
+
/** The loaded schema `cap` declares for `scope`, or `null`. */
|
|
8802
|
+
async declaredScopedSchema(scope, cap) {
|
|
8803
|
+
await this.loadScopedSchemas(cap);
|
|
8804
|
+
return this.loadedScopedSchemas(cap).find((entry) => entry.scope === scope)?.schema ?? null;
|
|
8805
|
+
}
|
|
8806
|
+
async requireScopedSchema(scope, cap) {
|
|
8807
|
+
const schema = await this.declaredScopedSchema(scope, cap);
|
|
8808
|
+
if (schema === null) throw new Error(`${this.constructor.name}: cap "${cap}" declares no ${scope} settings`);
|
|
8809
|
+
return schema;
|
|
8810
|
+
}
|
|
8811
|
+
scopedKeys(schema) {
|
|
8812
|
+
return new Set(schema.sections.flatMap((section) => collectValueFieldKeys(section.fields)));
|
|
8813
|
+
}
|
|
8814
|
+
/** `store` narrowed to the keys `schema` declares. */
|
|
8815
|
+
narrowToScope(store, schema) {
|
|
8816
|
+
const keys = this.scopedKeys(schema);
|
|
8817
|
+
return Object.fromEntries(Object.entries(store).filter(([key]) => keys.has(key)));
|
|
8818
|
+
}
|
|
8819
|
+
scopedHandle(scope, cap, schema, nodeId) {
|
|
8820
|
+
return createScopedSettings({
|
|
8821
|
+
schema,
|
|
8822
|
+
read: async () => {
|
|
8823
|
+
const declared = await this.requireScopedSchema(scope, cap);
|
|
8824
|
+
const stored = this.narrowToScope(await this.resolveGlobalStore(nodeId, cap), declared);
|
|
8825
|
+
const effective = collectHydratedFieldValues(hydrateSchema(declared, stored));
|
|
8826
|
+
return {
|
|
8827
|
+
...Object.fromEntries([...effective].filter(([, value]) => value !== void 0)),
|
|
8828
|
+
...stored
|
|
8829
|
+
};
|
|
8830
|
+
},
|
|
8831
|
+
write: (patch) => this.writeScoped(scope, cap, patch, nodeId),
|
|
8832
|
+
unset: (keys) => this.unsetScoped(scope, cap, keys, nodeId)
|
|
8833
|
+
});
|
|
8834
|
+
}
|
|
8835
|
+
/** The one write path of the scoped API: declared keys only, then the global patch. */
|
|
8836
|
+
async writeScoped(scope, cap, patch, nodeId) {
|
|
8837
|
+
assertDeclaredKeys(Object.keys(patch), this.scopedKeys(await this.requireScopedSchema(scope, cap)));
|
|
8838
|
+
if (await this.applyGlobalPatch(patch, scope === "node" ? nodeId : void 0, cap)) await this.onScopedSettingsChanged(scope, cap, Object.keys(patch));
|
|
8839
|
+
}
|
|
8840
|
+
/**
|
|
8841
|
+
* Remove declared keys of one scope. A secret goes through {@link clearSecrets} — its keychain
|
|
8842
|
+
* value is released exactly as there — and the emptied row is then removed; every other key is
|
|
8843
|
+
* removed by an `undefined` patch (which a secret transform would read as "keep").
|
|
8844
|
+
*/
|
|
8845
|
+
async unsetScoped(scope, cap, keys, nodeId) {
|
|
8846
|
+
assertDeclaredKeys(keys, this.scopedKeys(await this.requireScopedSchema(scope, cap)));
|
|
8847
|
+
const target = scope === "node" ? nodeId : void 0;
|
|
8848
|
+
const tree = this.addonSecretTree();
|
|
8849
|
+
const secretKeys = keys.filter((key) => tree.has(key));
|
|
8850
|
+
const plainKeys = keys.filter((key) => !tree.has(key));
|
|
8851
|
+
let changed = false;
|
|
8852
|
+
if (plainKeys.length > 0) {
|
|
8853
|
+
const patch = Object.fromEntries(plainKeys.map((key) => [key, void 0]));
|
|
8854
|
+
changed = await this.applyGlobalPatch(patch, target, cap) || changed;
|
|
8855
|
+
}
|
|
8856
|
+
if (secretKeys.length > 0) {
|
|
8857
|
+
await this.clearSecretKeys(secretKeys, target, cap);
|
|
8858
|
+
const node = normalizeNodeId(target ?? this._ctx?.kernel?.localNodeId);
|
|
8859
|
+
const rows = secretKeys.map((key) => scope === "node" ? nodeScopedKey(key, node) : key);
|
|
8860
|
+
if (this._secretSettings !== null) await this._secretSettings.removeClearedKeys(rows);
|
|
8861
|
+
else await this._ctx?.settings?.writeAddonStore(Object.fromEntries(rows.map((row) => [row, void 0])));
|
|
8862
|
+
changed = true;
|
|
8863
|
+
}
|
|
8864
|
+
if (changed) await this.onScopedSettingsChanged(scope, cap, [...keys]);
|
|
8865
|
+
}
|
|
8866
|
+
/**
|
|
8867
|
+
* The hydrated form of one scope of one capability's settings (any
|
|
8868
|
+
* {@link scopedSettingsOverlay} applied), or `null` when the capability declares nothing there.
|
|
8869
|
+
*/
|
|
8870
|
+
async getScopedSettings(scope, cap, nodeId) {
|
|
8871
|
+
const schema = await this.declaredScopedSchema(scope, cap);
|
|
8872
|
+
if (schema === null) return null;
|
|
8873
|
+
const stored = this.narrowToScope(await this.readRawProjectedStore(nodeId, cap), schema);
|
|
8874
|
+
const overlay = await this.scopedSettingsOverlay(scope, cap, nodeId);
|
|
8875
|
+
return hydrateSchema(schema, overlay ? await this.overlayKeepingMarkers(stored, overlay) : stored, { inlineSecretsAsViews: true });
|
|
8876
|
+
}
|
|
8877
|
+
/**
|
|
8878
|
+
* The scoped schemas this addon serves: one entry per loaded (capability, scope), capabilities
|
|
8879
|
+
* in declaration order, scopes in {@link SCOPED_SETTINGS_SCOPES} order. `[]` when it declares
|
|
8880
|
+
* nothing.
|
|
8881
|
+
*/
|
|
8882
|
+
async listScopedSettings() {
|
|
8883
|
+
await this.loadScopedSchemas();
|
|
8884
|
+
return [...this._scopedByCap].flatMap(([cap, entries]) => entries.map((entry) => ({
|
|
8885
|
+
cap,
|
|
8886
|
+
scope: entry.scope,
|
|
8887
|
+
sectionIds: entry.schema.sections.map((section) => section.id)
|
|
8888
|
+
})));
|
|
8889
|
+
}
|
|
8890
|
+
/** The OPERATOR's write of declared keys of one scope (D787 secret semantics). */
|
|
8891
|
+
async updateScopedSettings(scope, cap, patch, nodeId) {
|
|
8892
|
+
this._operatorWriteDepth++;
|
|
8893
|
+
try {
|
|
8894
|
+
await this.writeScoped(scope, cap, patch, nodeId);
|
|
8895
|
+
} finally {
|
|
8896
|
+
this._operatorWriteDepth--;
|
|
8897
|
+
}
|
|
8898
|
+
}
|
|
8899
|
+
/**
|
|
8900
|
+
* The effective values (`stored ?? default`) of one scope, a secret as its `set` view — never
|
|
8901
|
+
* its value. `null` when the capability declares nothing for the scope.
|
|
8902
|
+
*/
|
|
8903
|
+
async readScopedValues(scope, cap, nodeId) {
|
|
8904
|
+
const schema = await this.declaredScopedSchema(scope, cap);
|
|
8905
|
+
if (schema === null) return null;
|
|
8906
|
+
const form = hydrateSchema(schema, this.narrowToScope(await this.readRawProjectedStore(nodeId, cap), schema), { inlineSecretsAsViews: true });
|
|
8907
|
+
return Object.fromEntries([...collectHydratedFieldValues(form)].filter(([, value]) => value !== void 0));
|
|
8908
|
+
}
|
|
8909
|
+
/**
|
|
8691
8910
|
* What the create wizard and the integration edit page render for one instance: the addon's
|
|
8692
8911
|
* per-instance schema when it declares one, else its global schema (what they always showed).
|
|
8693
8912
|
*/
|
|
8694
8913
|
async getIntegrationFormSchema(instance, nodeId) {
|
|
8695
8914
|
const scoped = await this.integrationFormSchema(instance);
|
|
8696
|
-
if (scoped === null) return this.
|
|
8915
|
+
if (scoped === null) return this.scopedForm(nodeId);
|
|
8697
8916
|
return hydrateSchema(scoped, {}, { inlineSecretsAsViews: true });
|
|
8698
8917
|
}
|
|
8699
|
-
|
|
8700
|
-
|
|
8701
|
-
|
|
8702
|
-
const schema = this.
|
|
8703
|
-
if (!schema)
|
|
8704
|
-
|
|
8705
|
-
const sections = [];
|
|
8706
|
-
for (const id of declared) {
|
|
8707
|
-
const section = byId.get(id);
|
|
8708
|
-
if (!section) throw new Error(`${this.constructor.name}: integrationSettingSections() names unknown section "${id}". Known sections: [${[...byId.keys()].join(", ")}].`);
|
|
8709
|
-
const fields = dropPerNodeFields(section.fields);
|
|
8710
|
-
if (fields.length === 0) continue;
|
|
8711
|
-
sections.push({
|
|
8712
|
-
...section,
|
|
8713
|
-
fields
|
|
8714
|
-
});
|
|
8715
|
-
}
|
|
8716
|
-
if (sections.length === 0) return null;
|
|
8717
|
-
const projected = await this.readRawProjectedStore(nodeId);
|
|
8718
|
-
return hydrateSchema({
|
|
8719
|
-
...schema,
|
|
8720
|
-
sections
|
|
8721
|
-
}, projected, { inlineSecretsAsViews: true });
|
|
8918
|
+
/** The form of the scoped schemas this addon declared, hydrated from its store. */
|
|
8919
|
+
async scopedForm(nodeId) {
|
|
8920
|
+
await this.loadScopedSchemas();
|
|
8921
|
+
const schema = this.scopedFormSchema();
|
|
8922
|
+
if (!schema) return { sections: [] };
|
|
8923
|
+
return hydrateSchema(schema, await this.readRawProjectedStore(nodeId), { inlineSecretsAsViews: true });
|
|
8722
8924
|
}
|
|
8723
8925
|
/**
|
|
8724
8926
|
* The raw addon store PROJECTED onto the target node's bare per-node keys:
|
|
@@ -8727,8 +8929,8 @@ var BaseAddon = class {
|
|
|
8727
8929
|
* bare fallback), all `@`-scoped and stray bare per-node keys are dropped.
|
|
8728
8930
|
* A no-op passthrough when the schema declares no `perNode` field.
|
|
8729
8931
|
*
|
|
8730
|
-
* This is the sanctioned way for
|
|
8731
|
-
* the store for custom
|
|
8932
|
+
* This is the sanctioned way for an addon that needs
|
|
8933
|
+
* the store for custom logic (option narrowing, value snapping) to
|
|
8732
8934
|
* read it per-node — never `ctx.settings.readAddonStore()` directly.
|
|
8733
8935
|
* `nodeId` omitted ⇒ the local node (node-blind injection from ctx).
|
|
8734
8936
|
*
|
|
@@ -8780,7 +8982,7 @@ var BaseAddon = class {
|
|
|
8780
8982
|
}
|
|
8781
8983
|
/**
|
|
8782
8984
|
* Whether ONE global key of this addon's store was written, read three-way
|
|
8783
|
-
* (D651). For a question a hydrated view cannot answer:
|
|
8985
|
+
* (D651). For a question a hydrated view cannot answer: a hydrated form
|
|
8784
8986
|
* reports `value ?? default`, so "the operator chose the default" and "nobody
|
|
8785
8987
|
* chose" look the same, and a failed read looks like both. A `perNode` key is
|
|
8786
8988
|
* not supported here: its stored name is scoped.
|
|
@@ -8814,7 +9016,7 @@ var BaseAddon = class {
|
|
|
8814
9016
|
}
|
|
8815
9017
|
/**
|
|
8816
9018
|
* The OPERATOR's write — a settings form or an admin API call, dispatched by
|
|
8817
|
-
* the kernel.
|
|
9019
|
+
* the kernel. The one in-process write of the addon blob that is not a scoped write; a secret
|
|
8818
9020
|
* the operator sends is stored as sent even when it equals a pre-keychain
|
|
8819
9021
|
* inline value: the operator re-entering a password is a change, an addon
|
|
8820
9022
|
* writing back what it read is not (D787).
|
|
@@ -8827,9 +9029,6 @@ var BaseAddon = class {
|
|
|
8827
9029
|
this._operatorWriteDepth--;
|
|
8828
9030
|
}
|
|
8829
9031
|
}
|
|
8830
|
-
async updateGlobalSettings(patch, nodeId) {
|
|
8831
|
-
await this.applyGlobalPatch(patch, nodeId);
|
|
8832
|
-
}
|
|
8833
9032
|
/**
|
|
8834
9033
|
* REMOVE stored secrets — their keychain values and their markers (D787).
|
|
8835
9034
|
*
|
|
@@ -8839,6 +9038,9 @@ var BaseAddon = class {
|
|
|
8839
9038
|
* a keychain (an older kernel) it writes `''`, as such code always did.
|
|
8840
9039
|
*/
|
|
8841
9040
|
async clearSecrets(keys, nodeId) {
|
|
9041
|
+
await this.clearSecretKeys(keys, nodeId);
|
|
9042
|
+
}
|
|
9043
|
+
async clearSecretKeys(keys, nodeId, cap) {
|
|
8842
9044
|
const tree = this.addonSecretTree();
|
|
8843
9045
|
const keychain = this._ctx?.secrets !== void 0;
|
|
8844
9046
|
const stored = keychain ? await this.readAddonStoreWithRetry() : {};
|
|
@@ -8851,25 +9053,26 @@ var BaseAddon = class {
|
|
|
8851
9053
|
const keychainStored = tree.has(key) || collectSecretMarkerRefs(stored[key]).length > 0;
|
|
8852
9054
|
patch[key] = keychain && keychainStored ? SECRET_CLEAR : "";
|
|
8853
9055
|
}
|
|
8854
|
-
await this.applyGlobalPatch(patch, nodeId);
|
|
9056
|
+
await this.applyGlobalPatch(patch, nodeId, cap);
|
|
8855
9057
|
}
|
|
8856
|
-
|
|
8857
|
-
|
|
8858
|
-
|
|
9058
|
+
/** Resolves `true` when the write changed stored values. */
|
|
9059
|
+
async applyGlobalPatch(barePatch, nodeId, cap) {
|
|
9060
|
+
await this.loadScopedSchemas(cap);
|
|
9061
|
+
const keys = this.perNodeKeys(cap);
|
|
8859
9062
|
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
8860
9063
|
const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
8861
9064
|
const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
|
|
8862
9065
|
const handle = this._secretSettings;
|
|
8863
9066
|
if (handle !== null) {
|
|
8864
9067
|
const { changed } = await handle.writeAddonStore(scoped);
|
|
8865
|
-
if (!changed) return;
|
|
9068
|
+
if (!changed) return false;
|
|
8866
9069
|
} else await this._ctx?.settings?.writeAddonStore(scoped);
|
|
8867
|
-
if (target !== localNode) return;
|
|
9070
|
+
if (target !== localNode) return true;
|
|
8868
9071
|
await this.resolveConfig();
|
|
8869
9072
|
await this.onConfigChanged();
|
|
8870
9073
|
this.emitLifecycle(EventCategory.AddonUpdated, { level: "global" });
|
|
8871
|
-
|
|
8872
|
-
|
|
9074
|
+
this.maybeAutoRestart(Object.keys(barePatch), this.loadedScopedSchemas().map((entry) => entry.schema));
|
|
9075
|
+
return true;
|
|
8873
9076
|
}
|
|
8874
9077
|
/**
|
|
8875
9078
|
* The set of field keys the global settings schema declares `perNode: true`
|
|
@@ -8906,10 +9109,7 @@ var BaseAddon = class {
|
|
|
8906
9109
|
this._nodeKeysByCap = /* @__PURE__ */ new Map();
|
|
8907
9110
|
this._addonSecretTree = null;
|
|
8908
9111
|
}
|
|
8909
|
-
/**
|
|
8910
|
-
* The form the settings API serves while an addon declares no {@link globalSettingsSchema}: the
|
|
8911
|
-
* sections of its scoped schemas, so dropping the old hook does not blank the form.
|
|
8912
|
-
*/
|
|
9112
|
+
/** The form of an addon's scoped schemas: their sections, each shown once. */
|
|
8913
9113
|
scopedFormSchema(cap) {
|
|
8914
9114
|
const byId = /* @__PURE__ */ new Map();
|
|
8915
9115
|
for (const entry of this.loadedScopedSchemas(cap)) for (const section of entry.schema.sections) if (!byId.has(section.id)) byId.set(section.id, section);
|
|
@@ -8921,8 +9121,7 @@ var BaseAddon = class {
|
|
|
8921
9121
|
return [...this._scopedByCap.values()].flat();
|
|
8922
9122
|
}
|
|
8923
9123
|
/**
|
|
8924
|
-
* The field keys that are stored per node: every field of a {@link nodeSettingsSchema}
|
|
8925
|
-
* the fields the legacy {@link globalSettingsSchema} still marks `perNode: true`. Derived once
|
|
9124
|
+
* The field keys that are stored per node: every field of a {@link nodeSettingsSchema}. Derived once
|
|
8926
9125
|
* per `cap` argument and memoized (schemas are static declarations). Empty set ⇒ every
|
|
8927
9126
|
* per-node code path is bypassed and the settings API behaves like the node-agnostic one.
|
|
8928
9127
|
* Call {@link loadScopedSchemas} first (the async seams do).
|
|
@@ -8931,8 +9130,7 @@ var BaseAddon = class {
|
|
|
8931
9130
|
const cacheKey = cap ?? "";
|
|
8932
9131
|
const cached = this._nodeKeysByCap.get(cacheKey);
|
|
8933
9132
|
if (cached) return cached;
|
|
8934
|
-
const
|
|
8935
|
-
const keys = new Set(legacy ? legacy.sections.flatMap((section) => collectPerNodeFieldKeys(section.fields)) : []);
|
|
9133
|
+
const keys = /* @__PURE__ */ new Set();
|
|
8936
9134
|
for (const { scope, schema } of this.loadedScopedSchemas(cap)) {
|
|
8937
9135
|
if (scope !== "node") continue;
|
|
8938
9136
|
for (const section of schema.sections) for (const key of collectValueFieldKeys(section.fields)) keys.add(key);
|
|
@@ -9150,8 +9348,6 @@ var BaseAddon = class {
|
|
|
9150
9348
|
}
|
|
9151
9349
|
declaredKeySet() {
|
|
9152
9350
|
const keys = new Set(Object.keys(this.defaults));
|
|
9153
|
-
const schema = this.globalSettingsSchema();
|
|
9154
|
-
if (schema) for (const section of schema.sections) for (const key of collectFieldKeys(section.fields)) keys.add(key);
|
|
9155
9351
|
for (const { schema: scoped } of this.loadedScopedSchemas()) for (const section of scoped.sections) for (const key of collectFieldKeys(section.fields)) keys.add(key);
|
|
9156
9352
|
for (const key of this._declaredStateKeys) keys.add(key);
|
|
9157
9353
|
for (const path of this.secretStatePaths) {
|
|
@@ -9249,7 +9445,7 @@ var BaseAddon = class {
|
|
|
9249
9445
|
/** The addon store's secret tree: schema fields by TYPE, plus `secretStatePaths`. */
|
|
9250
9446
|
addonSecretTree() {
|
|
9251
9447
|
if (this._addonSecretTree === null) {
|
|
9252
|
-
const tree = new Map(
|
|
9448
|
+
const tree = /* @__PURE__ */ new Map();
|
|
9253
9449
|
for (const { schema } of this.loadedScopedSchemas()) for (const [key, node] of secretTreeFromSchema(schema)) tree.set(key, node);
|
|
9254
9450
|
this._addonSecretTree = mergeSecretStatePaths(tree, this.secretStatePaths);
|
|
9255
9451
|
}
|
|
@@ -9461,47 +9657,6 @@ function classifyStoreError(err) {
|
|
|
9461
9657
|
if (TRANSPORT_PHRASES.some((f) => message.includes(f))) return "transport";
|
|
9462
9658
|
return "permanent";
|
|
9463
9659
|
}
|
|
9464
|
-
/**
|
|
9465
|
-
* Collect the keys of every field marked `perNode: true`, recursing into
|
|
9466
|
-
* layout containers (`group` fields and `sub-tabs` tabs) the same way
|
|
9467
|
-
* `hydrateSchema` does. Valueless structural fields (separator/info/…)
|
|
9468
|
-
* don't declare `perNode` and are excluded by the `in` narrowing.
|
|
9469
|
-
*/
|
|
9470
|
-
/**
|
|
9471
|
-
* The same fields with every `perNode: true` one removed, recursing into layout
|
|
9472
|
-
* containers exactly as {@link collectPerNodeFieldKeys} does. A container left
|
|
9473
|
-
* with no child is dropped rather than rendered empty.
|
|
9474
|
-
*
|
|
9475
|
-
* Used by `getIntegrationSettings`: an integration is not a node, so a field
|
|
9476
|
-
* whose store key is `<key>@<nodeId>` has no node to belong to there.
|
|
9477
|
-
*/
|
|
9478
|
-
function dropPerNodeFields(fields) {
|
|
9479
|
-
const kept = [];
|
|
9480
|
-
for (const field of fields) {
|
|
9481
|
-
if (field.type === "group") {
|
|
9482
|
-
const inner = dropPerNodeFields(field.fields);
|
|
9483
|
-
if (inner.length > 0) kept.push({
|
|
9484
|
-
...field,
|
|
9485
|
-
fields: inner
|
|
9486
|
-
});
|
|
9487
|
-
continue;
|
|
9488
|
-
}
|
|
9489
|
-
if (field.type === "sub-tabs") {
|
|
9490
|
-
const tabs = field.tabs.map((tab) => ({
|
|
9491
|
-
...tab,
|
|
9492
|
-
fields: dropPerNodeFields(tab.fields)
|
|
9493
|
-
})).filter((tab) => tab.fields.length > 0);
|
|
9494
|
-
if (tabs.length > 0) kept.push({
|
|
9495
|
-
...field,
|
|
9496
|
-
tabs
|
|
9497
|
-
});
|
|
9498
|
-
continue;
|
|
9499
|
-
}
|
|
9500
|
-
if ("perNode" in field && field.perNode === true) continue;
|
|
9501
|
-
kept.push(field);
|
|
9502
|
-
}
|
|
9503
|
-
return kept;
|
|
9504
|
-
}
|
|
9505
9660
|
/** The keys of the value-holding fields, recursing into layout containers. */
|
|
9506
9661
|
function collectValueFieldKeys(fields) {
|
|
9507
9662
|
const collected = [];
|
|
@@ -9534,21 +9689,6 @@ function collectFieldKeys(fields) {
|
|
|
9534
9689
|
}
|
|
9535
9690
|
return collected;
|
|
9536
9691
|
}
|
|
9537
|
-
function collectPerNodeFieldKeys(fields) {
|
|
9538
|
-
const collected = [];
|
|
9539
|
-
for (const field of fields) {
|
|
9540
|
-
if (field.type === "group") {
|
|
9541
|
-
collected.push(...collectPerNodeFieldKeys(field.fields));
|
|
9542
|
-
continue;
|
|
9543
|
-
}
|
|
9544
|
-
if (field.type === "sub-tabs") {
|
|
9545
|
-
for (const tab of field.tabs) collected.push(...collectPerNodeFieldKeys(tab.fields));
|
|
9546
|
-
continue;
|
|
9547
|
-
}
|
|
9548
|
-
if ("perNode" in field && field.perNode === true) collected.push(field.key);
|
|
9549
|
-
}
|
|
9550
|
-
return collected;
|
|
9551
|
-
}
|
|
9552
9692
|
/**
|
|
9553
9693
|
* Normalize an `ICamstackAddon.initialize()` return value into the
|
|
9554
9694
|
* `AddonInitResult` envelope. Arrays are wrapped into `{ providers }`;
|
|
@@ -10642,7 +10782,6 @@ var CAP_NAMES = Object.freeze([
|
|
|
10642
10782
|
"notifier",
|
|
10643
10783
|
"numeric-sensor",
|
|
10644
10784
|
"oauth-integration",
|
|
10645
|
-
"oidc-connections",
|
|
10646
10785
|
"osd",
|
|
10647
10786
|
"osd-manager",
|
|
10648
10787
|
"pet-feeder",
|
|
@@ -12349,13 +12488,25 @@ Object.freeze({
|
|
|
12349
12488
|
"path": "temperature",
|
|
12350
12489
|
"valueType": "number"
|
|
12351
12490
|
}],
|
|
12352
|
-
"timed-run": [
|
|
12353
|
-
|
|
12354
|
-
|
|
12355
|
-
|
|
12356
|
-
|
|
12357
|
-
|
|
12358
|
-
|
|
12491
|
+
"timed-run": [
|
|
12492
|
+
{
|
|
12493
|
+
"path": "activeUntil",
|
|
12494
|
+
"valueType": "number"
|
|
12495
|
+
},
|
|
12496
|
+
{
|
|
12497
|
+
"path": "requestedBy",
|
|
12498
|
+
"valueType": "string"
|
|
12499
|
+
},
|
|
12500
|
+
{
|
|
12501
|
+
"path": "quickRun.duration",
|
|
12502
|
+
"valueType": "number"
|
|
12503
|
+
},
|
|
12504
|
+
{
|
|
12505
|
+
"path": "quickRun.unit",
|
|
12506
|
+
"valueType": "enum",
|
|
12507
|
+
"enumValues": ["s", "min"]
|
|
12508
|
+
}
|
|
12509
|
+
],
|
|
12359
12510
|
"update": [
|
|
12360
12511
|
{
|
|
12361
12512
|
"path": "currentVersion",
|
|
@@ -12534,8 +12685,7 @@ Object.freeze({
|
|
|
12534
12685
|
"device-provider": { "reloadDevice": 18e4 },
|
|
12535
12686
|
"llm": {
|
|
12536
12687
|
"generate": 6e5,
|
|
12537
|
-
"generateVision": 6e5
|
|
12538
|
-
"testProfile": 6e5
|
|
12688
|
+
"generateVision": 6e5
|
|
12539
12689
|
},
|
|
12540
12690
|
"llm-runtime": {
|
|
12541
12691
|
"complete": 6e5,
|
|
@@ -12580,7 +12730,7 @@ object({
|
|
|
12580
12730
|
params: record(string(), union([string(), number()])).optional()
|
|
12581
12731
|
});
|
|
12582
12732
|
//#endregion
|
|
12583
|
-
//#region ../types/dist/composition-
|
|
12733
|
+
//#region ../types/dist/composition-Bx0JvKUU.mjs
|
|
12584
12734
|
/**
|
|
12585
12735
|
* The ffmpeg build every CamStack node downloads, per platform and arch.
|
|
12586
12736
|
*
|
|
@@ -13742,458 +13892,844 @@ var NodeColorIdSchema = _enum([
|
|
|
13742
13892
|
"node-h"
|
|
13743
13893
|
]);
|
|
13744
13894
|
//#endregion
|
|
13745
|
-
//#region ../types/dist/
|
|
13746
|
-
var SMTP_INBOUND_DEFAULT_PORT = 2525;
|
|
13747
|
-
var SMTP_INBOUND_DEFAULT_DOMAIN = "camstack.local";
|
|
13748
|
-
var SMTP_INBOUND_DEFAULT_MAX_MESSAGE_BYTES = 25 * 1024 * 1024;
|
|
13749
|
-
/** The text excerpt a message carries on the bus. */
|
|
13750
|
-
var SMTP_INBOUND_TEXT_MAX_CHARS = 4096;
|
|
13751
|
-
var PortSchema = number().int().min(1).max(65535);
|
|
13752
|
-
/** A recipient local-part: what stands before the `@`. */
|
|
13753
|
-
var SmtpRecipientSchema = string().min(1).max(64).regex(/^[A-Za-z0-9._+-]+$/);
|
|
13754
|
-
object({
|
|
13755
|
-
port: PortSchema.default(SMTP_INBOUND_DEFAULT_PORT),
|
|
13756
|
-
bindHost: string().min(1).default("0.0.0.0"),
|
|
13757
|
-
domain: string().min(1).default(SMTP_INBOUND_DEFAULT_DOMAIN),
|
|
13758
|
-
requireAuth: boolean().default(true),
|
|
13759
|
-
username: string().default(""),
|
|
13760
|
-
password: string().default("").meta({ secret: true }),
|
|
13761
|
-
starttls: boolean().default(false),
|
|
13762
|
-
maxMessageBytes: number().int().positive().default(SMTP_INBOUND_DEFAULT_MAX_MESSAGE_BYTES)
|
|
13763
|
-
});
|
|
13764
|
-
object({
|
|
13765
|
-
host: string().min(1).nullable(),
|
|
13766
|
-
hostReason: string().nullable(),
|
|
13767
|
-
port: PortSchema,
|
|
13768
|
-
domain: string().min(1),
|
|
13769
|
-
requireAuth: boolean(),
|
|
13770
|
-
username: string(),
|
|
13771
|
-
password: string(),
|
|
13772
|
-
starttls: boolean()
|
|
13773
|
-
});
|
|
13774
|
-
object({
|
|
13775
|
-
recipients: array(SmtpRecipientSchema).min(1),
|
|
13776
|
-
/**
|
|
13777
|
-
* Who is subscribing. A second `subscribe` with the same id REPLACES that subscriber's
|
|
13778
|
-
* recipients (the way a consumer that restarted, or lost a device, declares its set again);
|
|
13779
|
-
* a recipient held by another subscriber is refused with `smtp-inbound/recipient-claimed`.
|
|
13780
|
-
* Absent, the subscriber is anonymous and unique.
|
|
13781
|
-
*/
|
|
13782
|
-
subscriberId: string().min(1).max(64).optional()
|
|
13783
|
-
});
|
|
13784
|
-
var SmtpInboundAttachmentSchema = object({
|
|
13785
|
-
filename: string(),
|
|
13786
|
-
contentType: string(),
|
|
13787
|
-
bytes: number().int().nonnegative()
|
|
13788
|
-
});
|
|
13789
|
-
/** The payload of one `broker.message` (the key is the recipient local-part). */
|
|
13790
|
-
var SmtpInboundMessageSchema = object({
|
|
13791
|
-
/** Monotonic per mailbox; a gap tells a consumer it missed an event. */
|
|
13792
|
-
seq: number().int().positive(),
|
|
13793
|
-
messageId: string(),
|
|
13794
|
-
receivedAt: number().int().nonnegative(),
|
|
13795
|
-
from: string(),
|
|
13796
|
-
to: string(),
|
|
13797
|
-
subject: string(),
|
|
13798
|
-
text: string().max(SMTP_INBOUND_TEXT_MAX_CHARS),
|
|
13799
|
-
attachments: array(SmtpInboundAttachmentSchema)
|
|
13800
|
-
});
|
|
13801
|
-
object({
|
|
13802
|
-
/** The newest seq issued so far (0 before any mail). */
|
|
13803
|
-
lastSeq: number().int().nonnegative(),
|
|
13804
|
-
/** The oldest seq still retained; messages below it are gone. */
|
|
13805
|
-
oldestSeq: number().int().nonnegative(),
|
|
13806
|
-
messages: array(object({
|
|
13807
|
-
key: string(),
|
|
13808
|
-
message: SmtpInboundMessageSchema
|
|
13809
|
-
}))
|
|
13810
|
-
});
|
|
13811
|
-
new Set([
|
|
13812
|
-
"track",
|
|
13813
|
-
"face",
|
|
13814
|
-
"identity",
|
|
13815
|
-
"plate",
|
|
13816
|
-
"vehicle",
|
|
13817
|
-
"scene",
|
|
13818
|
-
"motion",
|
|
13819
|
-
"object",
|
|
13820
|
-
"audio",
|
|
13821
|
-
"mosaic"
|
|
13822
|
-
]);
|
|
13823
|
-
/**
|
|
13824
|
-
* The owner types that are event tables, in the order the event-media resolver
|
|
13825
|
-
* should consider them. Exported so a consumer asking "is this key an event?"
|
|
13826
|
-
* does not re-spell the list and drift from it.
|
|
13827
|
-
*/
|
|
13828
|
-
var EVENT_OWNER_TYPES = [
|
|
13829
|
-
"motion",
|
|
13830
|
-
"object",
|
|
13831
|
-
"audio"
|
|
13832
|
-
];
|
|
13833
|
-
/**
|
|
13834
|
-
* The same list as a Zod enum, for the cap inputs that must NAME the table
|
|
13835
|
-
* (D482: `getEventMedia` / `listEventMedia` take an owner, and an owner is
|
|
13836
|
-
* `(table, id)`).
|
|
13837
|
-
*
|
|
13838
|
-
* Built FROM {@link EVENT_OWNER_TYPES} rather than re-spelled: a fourth event
|
|
13839
|
-
* table would otherwise be accepted by the codec and refused at the door, with
|
|
13840
|
-
* nothing failing until a caller asked.
|
|
13841
|
-
*/
|
|
13842
|
-
var EventOwnerTypeSchema = _enum(EVENT_OWNER_TYPES);
|
|
13843
|
-
/** The same list as a Zod enum, for the cap input that carries it. */
|
|
13844
|
-
var MediaPresenceOwnerKindSchema = _enum([...EVENT_OWNER_TYPES, "track"]);
|
|
13845
|
-
new Set(EVENT_OWNER_TYPES);
|
|
13846
|
-
/**
|
|
13847
|
-
* What a published package needs from the rest of the install (D989).
|
|
13848
|
-
*
|
|
13849
|
-
* One published framework package (`@camstack/server`) carries the kernel, the
|
|
13850
|
-
* builtins and the capability contracts, so "which addon runs on which
|
|
13851
|
-
* framework" is a question of version, and the answer is DECLARED by the
|
|
13852
|
-
* package that knows it:
|
|
13853
|
-
*
|
|
13854
|
-
* - an addon says the oldest server it runs on (`requires.server: ">=X"`);
|
|
13855
|
-
* - the server says the oldest addon it works with
|
|
13856
|
-
* (`requires.addons: { "@camstack/addon-x": ">=Y" }`) and the oldest shell
|
|
13857
|
-
* around it (`requires.wrapper: { desktop, image }`);
|
|
13858
|
-
* - a wrapper (the desktop app, the container starter) says which server
|
|
13859
|
-
* range it can host, and reports its own kind and version.
|
|
13860
|
-
*
|
|
13861
|
-
* The publish workflow STAMPS these after the version bump
|
|
13862
|
-
* (`scripts/ci/stamp-requires.mjs`); nobody types a number by hand.
|
|
13863
|
-
*
|
|
13864
|
-
* A requirement that cannot be checked is NOT met: a shell that reports no
|
|
13865
|
-
* version counts as below the minimum, and an unreadable running version is
|
|
13866
|
-
* named in the result (a failed read is never a pass).
|
|
13867
|
-
*/
|
|
13868
|
-
/** `>=MAJOR.MINOR.PATCH[-prerelease]` — the only range shape a requirement uses. */
|
|
13869
|
-
var MinVersionSchema = string().regex(/^>=\d+\.\d+\.\d+(-[0-9A-Za-z.-]+)?$/, "a minimum is written \">=X.Y.Z\"");
|
|
13870
|
-
object({
|
|
13871
|
-
/** The oldest `@camstack/server` this package runs on. */
|
|
13872
|
-
server: MinVersionSchema.optional(),
|
|
13873
|
-
/** The oldest installed version of each named addon package. */
|
|
13874
|
-
addons: record(string(), MinVersionSchema).optional(),
|
|
13875
|
-
/** The oldest shell around the server, per shell kind. */
|
|
13876
|
-
wrapper: object({
|
|
13877
|
-
desktop: MinVersionSchema.optional(),
|
|
13878
|
-
image: MinVersionSchema.optional()
|
|
13879
|
-
}).optional()
|
|
13880
|
-
});
|
|
13881
|
-
/** One unmet requirement; each names the versions on both sides. */
|
|
13882
|
-
var UnmetRequirementSchema = discriminatedUnion("kind", [
|
|
13883
|
-
object({
|
|
13884
|
-
kind: literal("server-too-old"),
|
|
13885
|
-
required: string(),
|
|
13886
|
-
/** `null` — the running server version could not be read. */
|
|
13887
|
-
running: string().nullable()
|
|
13888
|
-
}),
|
|
13889
|
-
object({
|
|
13890
|
-
kind: literal("addon-too-old"),
|
|
13891
|
-
packageName: string(),
|
|
13892
|
-
required: string(),
|
|
13893
|
-
/** `null` — the addon is not installed (or its version is unreadable). */
|
|
13894
|
-
running: string().nullable()
|
|
13895
|
-
}),
|
|
13896
|
-
object({
|
|
13897
|
-
kind: literal("wrapper-too-old"),
|
|
13898
|
-
wrapper: _enum(["desktop", "image"]),
|
|
13899
|
-
required: string(),
|
|
13900
|
-
/** `null` — the wrapper reported no version. */
|
|
13901
|
-
running: string().nullable()
|
|
13902
|
-
})
|
|
13903
|
-
]);
|
|
13904
|
-
var RequiredAddonUpdateSchema = object({
|
|
13905
|
-
packageName: string(),
|
|
13906
|
-
/** The minimum the target server declares. */
|
|
13907
|
-
required: string(),
|
|
13908
|
-
/** What this node has; `null` when the addon is not installed. */
|
|
13909
|
-
installed: string().nullable()
|
|
13910
|
-
});
|
|
13911
|
-
/**
|
|
13912
|
-
* Which integration instance a settings form is for. An addon that serves several instances
|
|
13913
|
-
* (`instanceMode: multiple`) can show a different form per instance — an NVR integration
|
|
13914
|
-
* needs its connection, the default integration needs the addon's own sections.
|
|
13915
|
-
*
|
|
13916
|
-
* - `integrationId` is `null` in the create wizard: nothing exists yet, the operator is
|
|
13917
|
-
* setting up a NEW instance.
|
|
13918
|
-
* - `mode` is the wizard mode of the integration type (`getAvailableTypes`).
|
|
13919
|
-
* - `candidateStableId` is the discovery candidate a wizard was seeded from, if any.
|
|
13920
|
-
*/
|
|
13921
|
-
var IntegrationInstanceRefSchema = object({
|
|
13922
|
-
integrationId: string().nullable(),
|
|
13923
|
-
mode: _enum([
|
|
13924
|
-
"standalone",
|
|
13925
|
-
"account",
|
|
13926
|
-
"broker"
|
|
13927
|
-
]),
|
|
13928
|
-
candidateStableId: string().optional()
|
|
13929
|
-
});
|
|
13930
|
-
/**
|
|
13931
|
-
* notification-output — canonical, capability-gated notification delivery.
|
|
13932
|
-
*
|
|
13933
|
-
* Apprise-derived model (see
|
|
13934
|
-
* `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
|
|
13935
|
-
* callers emit ONE canonical `Notification`; each provider declares a
|
|
13936
|
-
* per-kind capability descriptor (`TargetKind`), and the pure degrade
|
|
13937
|
-
* engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
|
|
13938
|
-
* message to what the kind supports — callers never special-case a service.
|
|
13939
|
-
*
|
|
13940
|
-
* DESIGN DECISIONS (locked):
|
|
13941
|
-
* - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
|
|
13942
|
-
* `setTargetEnabled`), each provider persisting via the `settings-store`
|
|
13943
|
-
* cap. Rationale: the admin UI needs one uniform surface across the
|
|
13944
|
-
* notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
|
|
13945
|
-
* alternative would fork the UI per addon and cannot host the
|
|
13946
|
-
* discovery→adopt flow.
|
|
13947
|
-
* - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
|
|
13948
|
-
* the generated cap-mount auto-`concatCollection`-fans them across every
|
|
13949
|
-
* registered provider (notifiers addon + HA addon) so one catalog is
|
|
13950
|
-
* routable. `send` / `testTarget` / CRUD route to ONE provider by the
|
|
13951
|
-
* `addonId` the generated collection router extracts from the call input.
|
|
13952
|
-
* - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
|
|
13953
|
-
* transformer) + UDS MsgPack both round-trip typed arrays — already used by
|
|
13954
|
-
* `storage` / `storage-provider` / `recording` caps over the same path. No
|
|
13955
|
-
* base64 fallback needed.
|
|
13956
|
-
*
|
|
13957
|
-
* TODO (deferred, closed-set change — separate decision): add
|
|
13958
|
-
* `providerKind: 'notify'` so notification providers surface on the unified
|
|
13959
|
-
* admin "Integrations" page.
|
|
13960
|
-
*/
|
|
13961
|
-
/**
|
|
13962
|
-
* Zentik-derived typed-media enum — the superset across every kind. Each
|
|
13963
|
-
* adapter picks what it supports and the degrade engine filters the rest.
|
|
13964
|
-
*/
|
|
13965
|
-
var AttachmentMediaTypeSchema = _enum([
|
|
13966
|
-
"image",
|
|
13967
|
-
"video",
|
|
13968
|
-
"gif",
|
|
13969
|
-
"audio",
|
|
13970
|
-
"icon"
|
|
13971
|
-
]);
|
|
13972
|
-
/**
|
|
13973
|
-
* A single attachment. Exactly one of `url` (remote source, most adapters
|
|
13974
|
-
* prefer this) or `bytes` (inline source; required for Pushover-style
|
|
13975
|
-
* bytes-only kinds) MUST be present — the degrade engine expresses a
|
|
13976
|
-
* url→bytes fetch as a `needsFetch` directive the adapter executes.
|
|
13977
|
-
*/
|
|
13978
|
-
var AttachmentSchema = object({
|
|
13979
|
-
mediaType: AttachmentMediaTypeSchema,
|
|
13980
|
-
url: string().optional(),
|
|
13981
|
-
bytes: _instanceof(Uint8Array).optional(),
|
|
13982
|
-
mime: string().optional(),
|
|
13983
|
-
name: string().optional()
|
|
13984
|
-
}).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
|
|
13985
|
-
var NotificationFormatSchema = _enum([
|
|
13986
|
-
"text",
|
|
13987
|
-
"markdown",
|
|
13988
|
-
"html"
|
|
13989
|
-
]);
|
|
13895
|
+
//#region ../types/dist/convert-BAzH15HU.mjs
|
|
13990
13896
|
/**
|
|
13991
|
-
*
|
|
13992
|
-
*
|
|
13993
|
-
*
|
|
13994
|
-
*
|
|
13995
|
-
* notices — the same class of gap as a zone vocabulary nothing produced
|
|
13996
|
-
* ([D35](../../../docs/decisions/adr-0035.md)). Every adapter maps this set or
|
|
13997
|
-
* declares `actionIcons: false` and the degrade engine strips the field.
|
|
13998
|
-
*
|
|
13999
|
-
* Named by INTENT, never by glyph. "check" would tie the vocabulary to one
|
|
14000
|
-
* renderer's icon set; "acknowledge" survives an adapter that draws it
|
|
14001
|
-
* differently.
|
|
14002
|
-
*
|
|
14003
|
-
* ── A TOKEN IS NOT A WIRE VALUE ─────────────────────────────────────
|
|
14004
|
-
*
|
|
14005
|
-
* These names are for US. **No adapter may forward one verbatim.** Each maps
|
|
14006
|
-
* the whole set onto its own renderer's vocabulary through a
|
|
14007
|
-
* `Record<NotificationActionIcon, string>` — a Record, never a lookup with a
|
|
14008
|
-
* fallback, so adding a member here fails every adapter's build until someone
|
|
14009
|
-
* decides its glyph, which is the only place that decision can be made
|
|
14010
|
-
* honestly.
|
|
14011
|
-
*
|
|
14012
|
-
* This paragraph is the bug. Zentik declared `actionIcons: true` and passed
|
|
14013
|
-
* `disarm` straight through; iOS feeds that string to
|
|
14014
|
-
* `UNNotificationActionIcon(systemImageName:)`, `disarm` is not an SF Symbol,
|
|
14015
|
-
* and every snooze and alarm button arrived BLANK. A pass-through is not a
|
|
14016
|
-
* mapping, and "the field is documented" is not "the value renders".
|
|
14017
|
-
*
|
|
14018
|
-
* Adding a member is TRAIN-BOUND. The enum lives in the published
|
|
14019
|
-
* `@camstack/server` closure and the cap seam validates against the HUB's copy,
|
|
14020
|
-
* so an addon that emits a token the running hub does not know does not lose an
|
|
14021
|
-
* icon — its whole `send` fails Zod validation and the notification never
|
|
14022
|
-
* arrives. Never emit a new token from an addon before the train carrying it.
|
|
13897
|
+
* Frozen unit → spec table. `•` in the doc marks each dimension's canonical
|
|
13898
|
+
* unit (`factor: 1, offset: 0`). °F derives from `°C = (°F − 32) × 5/9` ⇒
|
|
13899
|
+
* `factor = 5/9`, `offset = -160/9` (kept as exact expressions, not rounded
|
|
13900
|
+
* decimals). K derives from `°C = K − 273.15`.
|
|
14023
13901
|
*/
|
|
14024
|
-
var
|
|
14025
|
-
"
|
|
14026
|
-
|
|
14027
|
-
|
|
14028
|
-
|
|
14029
|
-
|
|
14030
|
-
"
|
|
14031
|
-
|
|
14032
|
-
|
|
14033
|
-
|
|
14034
|
-
|
|
14035
|
-
|
|
14036
|
-
|
|
14037
|
-
|
|
14038
|
-
|
|
14039
|
-
|
|
14040
|
-
|
|
14041
|
-
|
|
14042
|
-
|
|
14043
|
-
|
|
14044
|
-
|
|
14045
|
-
|
|
14046
|
-
|
|
14047
|
-
|
|
14048
|
-
|
|
14049
|
-
|
|
14050
|
-
|
|
14051
|
-
|
|
14052
|
-
|
|
14053
|
-
|
|
14054
|
-
|
|
14055
|
-
|
|
14056
|
-
|
|
14057
|
-
|
|
14058
|
-
|
|
14059
|
-
|
|
14060
|
-
|
|
14061
|
-
|
|
14062
|
-
|
|
14063
|
-
|
|
14064
|
-
|
|
14065
|
-
|
|
14066
|
-
|
|
14067
|
-
|
|
14068
|
-
|
|
14069
|
-
|
|
14070
|
-
|
|
14071
|
-
|
|
14072
|
-
|
|
14073
|
-
|
|
14074
|
-
|
|
14075
|
-
|
|
14076
|
-
|
|
14077
|
-
|
|
14078
|
-
|
|
14079
|
-
|
|
14080
|
-
|
|
14081
|
-
|
|
14082
|
-
|
|
14083
|
-
|
|
14084
|
-
|
|
14085
|
-
|
|
14086
|
-
|
|
14087
|
-
|
|
14088
|
-
|
|
14089
|
-
|
|
14090
|
-
|
|
14091
|
-
|
|
14092
|
-
|
|
14093
|
-
|
|
14094
|
-
|
|
14095
|
-
|
|
14096
|
-
|
|
14097
|
-
|
|
14098
|
-
|
|
14099
|
-
|
|
14100
|
-
|
|
14101
|
-
|
|
14102
|
-
|
|
14103
|
-
|
|
14104
|
-
|
|
14105
|
-
|
|
14106
|
-
|
|
14107
|
-
|
|
14108
|
-
|
|
14109
|
-
|
|
14110
|
-
|
|
14111
|
-
|
|
14112
|
-
|
|
13902
|
+
var UNIT_TABLE = {
|
|
13903
|
+
"°C": {
|
|
13904
|
+
dimension: "temperature",
|
|
13905
|
+
factor: 1,
|
|
13906
|
+
offset: 0
|
|
13907
|
+
},
|
|
13908
|
+
"°F": {
|
|
13909
|
+
dimension: "temperature",
|
|
13910
|
+
factor: 5 / 9,
|
|
13911
|
+
offset: -160 / 9
|
|
13912
|
+
},
|
|
13913
|
+
K: {
|
|
13914
|
+
dimension: "temperature",
|
|
13915
|
+
factor: 1,
|
|
13916
|
+
offset: -273.15
|
|
13917
|
+
},
|
|
13918
|
+
hPa: {
|
|
13919
|
+
dimension: "pressure",
|
|
13920
|
+
factor: 1,
|
|
13921
|
+
offset: 0
|
|
13922
|
+
},
|
|
13923
|
+
kPa: {
|
|
13924
|
+
dimension: "pressure",
|
|
13925
|
+
factor: 10,
|
|
13926
|
+
offset: 0
|
|
13927
|
+
},
|
|
13928
|
+
Pa: {
|
|
13929
|
+
dimension: "pressure",
|
|
13930
|
+
factor: .01,
|
|
13931
|
+
offset: 0
|
|
13932
|
+
},
|
|
13933
|
+
mbar: {
|
|
13934
|
+
dimension: "pressure",
|
|
13935
|
+
factor: 1,
|
|
13936
|
+
offset: 0
|
|
13937
|
+
},
|
|
13938
|
+
bar: {
|
|
13939
|
+
dimension: "pressure",
|
|
13940
|
+
factor: 1e3,
|
|
13941
|
+
offset: 0
|
|
13942
|
+
},
|
|
13943
|
+
inHg: {
|
|
13944
|
+
dimension: "pressure",
|
|
13945
|
+
factor: 33.8639,
|
|
13946
|
+
offset: 0
|
|
13947
|
+
},
|
|
13948
|
+
mmHg: {
|
|
13949
|
+
dimension: "pressure",
|
|
13950
|
+
factor: 1.33322,
|
|
13951
|
+
offset: 0
|
|
13952
|
+
},
|
|
13953
|
+
psi: {
|
|
13954
|
+
dimension: "pressure",
|
|
13955
|
+
factor: 68.9476,
|
|
13956
|
+
offset: 0
|
|
13957
|
+
},
|
|
13958
|
+
"m/s": {
|
|
13959
|
+
dimension: "speed",
|
|
13960
|
+
factor: 1,
|
|
13961
|
+
offset: 0
|
|
13962
|
+
},
|
|
13963
|
+
"km/h": {
|
|
13964
|
+
dimension: "speed",
|
|
13965
|
+
factor: 1 / 3.6,
|
|
13966
|
+
offset: 0
|
|
13967
|
+
},
|
|
13968
|
+
mph: {
|
|
13969
|
+
dimension: "speed",
|
|
13970
|
+
factor: .44704,
|
|
13971
|
+
offset: 0
|
|
13972
|
+
},
|
|
13973
|
+
kn: {
|
|
13974
|
+
dimension: "speed",
|
|
13975
|
+
factor: .514444,
|
|
13976
|
+
offset: 0
|
|
13977
|
+
},
|
|
13978
|
+
"mm/h": {
|
|
13979
|
+
dimension: "precipitation-rate",
|
|
13980
|
+
factor: 1,
|
|
13981
|
+
offset: 0
|
|
13982
|
+
},
|
|
13983
|
+
"in/h": {
|
|
13984
|
+
dimension: "precipitation-rate",
|
|
13985
|
+
factor: 25.4,
|
|
13986
|
+
offset: 0
|
|
13987
|
+
},
|
|
13988
|
+
m: {
|
|
13989
|
+
dimension: "length",
|
|
13990
|
+
factor: 1,
|
|
13991
|
+
offset: 0
|
|
13992
|
+
},
|
|
13993
|
+
mm: {
|
|
13994
|
+
dimension: "length",
|
|
13995
|
+
factor: .001,
|
|
13996
|
+
offset: 0
|
|
13997
|
+
},
|
|
13998
|
+
cm: {
|
|
13999
|
+
dimension: "length",
|
|
14000
|
+
factor: .01,
|
|
14001
|
+
offset: 0
|
|
14002
|
+
},
|
|
14003
|
+
km: {
|
|
14004
|
+
dimension: "length",
|
|
14005
|
+
factor: 1e3,
|
|
14006
|
+
offset: 0
|
|
14007
|
+
},
|
|
14008
|
+
in: {
|
|
14009
|
+
dimension: "length",
|
|
14010
|
+
factor: .0254,
|
|
14011
|
+
offset: 0
|
|
14012
|
+
},
|
|
14013
|
+
ft: {
|
|
14014
|
+
dimension: "length",
|
|
14015
|
+
factor: .3048,
|
|
14016
|
+
offset: 0
|
|
14017
|
+
},
|
|
14018
|
+
mi: {
|
|
14019
|
+
dimension: "length",
|
|
14020
|
+
factor: 1609.344,
|
|
14021
|
+
offset: 0
|
|
14022
|
+
},
|
|
14023
|
+
"m²": {
|
|
14024
|
+
dimension: "area",
|
|
14025
|
+
factor: 1,
|
|
14026
|
+
offset: 0
|
|
14027
|
+
},
|
|
14028
|
+
lx: {
|
|
14029
|
+
dimension: "illuminance",
|
|
14030
|
+
factor: 1,
|
|
14031
|
+
offset: 0
|
|
14032
|
+
},
|
|
14033
|
+
"W/m²": {
|
|
14034
|
+
dimension: "irradiance",
|
|
14035
|
+
factor: 1,
|
|
14036
|
+
offset: 0
|
|
14037
|
+
},
|
|
14038
|
+
W: {
|
|
14039
|
+
dimension: "power",
|
|
14040
|
+
factor: 1,
|
|
14041
|
+
offset: 0
|
|
14042
|
+
},
|
|
14043
|
+
kW: {
|
|
14044
|
+
dimension: "power",
|
|
14045
|
+
factor: 1e3,
|
|
14046
|
+
offset: 0
|
|
14047
|
+
},
|
|
14048
|
+
VA: {
|
|
14049
|
+
dimension: "apparent-power",
|
|
14050
|
+
factor: 1,
|
|
14051
|
+
offset: 0
|
|
14052
|
+
},
|
|
14053
|
+
Wh: {
|
|
14054
|
+
dimension: "energy",
|
|
14055
|
+
factor: 1,
|
|
14056
|
+
offset: 0
|
|
14057
|
+
},
|
|
14058
|
+
kWh: {
|
|
14059
|
+
dimension: "energy",
|
|
14060
|
+
factor: 1e3,
|
|
14061
|
+
offset: 0
|
|
14062
|
+
},
|
|
14063
|
+
MWh: {
|
|
14064
|
+
dimension: "energy",
|
|
14065
|
+
factor: 1e6,
|
|
14066
|
+
offset: 0
|
|
14067
|
+
},
|
|
14068
|
+
V: {
|
|
14069
|
+
dimension: "voltage",
|
|
14070
|
+
factor: 1,
|
|
14071
|
+
offset: 0
|
|
14072
|
+
},
|
|
14073
|
+
mV: {
|
|
14074
|
+
dimension: "voltage",
|
|
14075
|
+
factor: .001,
|
|
14076
|
+
offset: 0
|
|
14077
|
+
},
|
|
14078
|
+
A: {
|
|
14079
|
+
dimension: "current",
|
|
14080
|
+
factor: 1,
|
|
14081
|
+
offset: 0
|
|
14082
|
+
},
|
|
14083
|
+
mA: {
|
|
14084
|
+
dimension: "current",
|
|
14085
|
+
factor: .001,
|
|
14086
|
+
offset: 0
|
|
14087
|
+
},
|
|
14088
|
+
ppm: {
|
|
14089
|
+
dimension: "concentration-volume",
|
|
14090
|
+
factor: 1,
|
|
14091
|
+
offset: 0
|
|
14092
|
+
},
|
|
14093
|
+
ppb: {
|
|
14094
|
+
dimension: "concentration-volume",
|
|
14095
|
+
factor: .001,
|
|
14096
|
+
offset: 0
|
|
14097
|
+
},
|
|
14098
|
+
"µg/m³": {
|
|
14099
|
+
dimension: "concentration-mass",
|
|
14100
|
+
factor: 1,
|
|
14101
|
+
offset: 0
|
|
14102
|
+
},
|
|
14103
|
+
"mg/m³": {
|
|
14104
|
+
dimension: "concentration-mass",
|
|
14105
|
+
factor: 1e3,
|
|
14106
|
+
offset: 0
|
|
14107
|
+
},
|
|
14108
|
+
kg: {
|
|
14109
|
+
dimension: "mass",
|
|
14110
|
+
factor: 1,
|
|
14111
|
+
offset: 0
|
|
14112
|
+
},
|
|
14113
|
+
g: {
|
|
14114
|
+
dimension: "mass",
|
|
14115
|
+
factor: .001,
|
|
14116
|
+
offset: 0
|
|
14117
|
+
},
|
|
14118
|
+
lb: {
|
|
14119
|
+
dimension: "mass",
|
|
14120
|
+
factor: .453592,
|
|
14121
|
+
offset: 0
|
|
14122
|
+
},
|
|
14123
|
+
oz: {
|
|
14124
|
+
dimension: "mass",
|
|
14125
|
+
factor: .0283495,
|
|
14126
|
+
offset: 0
|
|
14127
|
+
},
|
|
14128
|
+
"%": {
|
|
14129
|
+
dimension: "percentage",
|
|
14130
|
+
factor: 1,
|
|
14131
|
+
offset: 0
|
|
14132
|
+
},
|
|
14133
|
+
L: {
|
|
14134
|
+
dimension: "volume",
|
|
14135
|
+
factor: 1,
|
|
14136
|
+
offset: 0
|
|
14137
|
+
},
|
|
14138
|
+
mL: {
|
|
14139
|
+
dimension: "volume",
|
|
14140
|
+
factor: .001,
|
|
14141
|
+
offset: 0
|
|
14142
|
+
},
|
|
14143
|
+
gal: {
|
|
14144
|
+
dimension: "volume",
|
|
14145
|
+
factor: 3.785411784,
|
|
14146
|
+
offset: 0
|
|
14147
|
+
},
|
|
14148
|
+
s: {
|
|
14149
|
+
dimension: "duration",
|
|
14150
|
+
factor: 1,
|
|
14151
|
+
offset: 0
|
|
14152
|
+
},
|
|
14153
|
+
ms: {
|
|
14154
|
+
dimension: "duration",
|
|
14155
|
+
factor: .001,
|
|
14156
|
+
offset: 0
|
|
14157
|
+
},
|
|
14158
|
+
min: {
|
|
14159
|
+
dimension: "duration",
|
|
14160
|
+
factor: 60,
|
|
14161
|
+
offset: 0
|
|
14162
|
+
},
|
|
14163
|
+
h: {
|
|
14164
|
+
dimension: "duration",
|
|
14165
|
+
factor: 3600,
|
|
14166
|
+
offset: 0
|
|
14167
|
+
},
|
|
14168
|
+
d: {
|
|
14169
|
+
dimension: "duration",
|
|
14170
|
+
factor: 86400,
|
|
14171
|
+
offset: 0
|
|
14172
|
+
},
|
|
14173
|
+
B: {
|
|
14174
|
+
dimension: "information",
|
|
14175
|
+
factor: 1,
|
|
14176
|
+
offset: 0
|
|
14177
|
+
},
|
|
14178
|
+
KiB: {
|
|
14179
|
+
dimension: "information",
|
|
14180
|
+
factor: 1024,
|
|
14181
|
+
offset: 0
|
|
14182
|
+
},
|
|
14183
|
+
MiB: {
|
|
14184
|
+
dimension: "information",
|
|
14185
|
+
factor: 1024 ** 2,
|
|
14186
|
+
offset: 0
|
|
14187
|
+
},
|
|
14188
|
+
GiB: {
|
|
14189
|
+
dimension: "information",
|
|
14190
|
+
factor: 1024 ** 3,
|
|
14191
|
+
offset: 0
|
|
14192
|
+
},
|
|
14193
|
+
TiB: {
|
|
14194
|
+
dimension: "information",
|
|
14195
|
+
factor: 1024 ** 4,
|
|
14196
|
+
offset: 0
|
|
14197
|
+
},
|
|
14198
|
+
kB: {
|
|
14199
|
+
dimension: "information",
|
|
14200
|
+
factor: 1e3,
|
|
14201
|
+
offset: 0
|
|
14202
|
+
},
|
|
14203
|
+
MB: {
|
|
14204
|
+
dimension: "information",
|
|
14205
|
+
factor: 1e6,
|
|
14206
|
+
offset: 0
|
|
14207
|
+
},
|
|
14208
|
+
GB: {
|
|
14209
|
+
dimension: "information",
|
|
14210
|
+
factor: 1e9,
|
|
14211
|
+
offset: 0
|
|
14212
|
+
},
|
|
14213
|
+
"°": {
|
|
14214
|
+
dimension: "angle",
|
|
14215
|
+
factor: 1,
|
|
14216
|
+
offset: 0
|
|
14217
|
+
},
|
|
14218
|
+
dBFS: {
|
|
14219
|
+
dimension: "sound-level",
|
|
14220
|
+
factor: 1,
|
|
14221
|
+
offset: 0
|
|
14222
|
+
},
|
|
14223
|
+
dBm: {
|
|
14224
|
+
dimension: "signal-level",
|
|
14225
|
+
factor: 1,
|
|
14226
|
+
offset: 0
|
|
14227
|
+
},
|
|
14228
|
+
mired: {
|
|
14229
|
+
dimension: "colour-temperature",
|
|
14230
|
+
factor: 1,
|
|
14231
|
+
offset: 0
|
|
14232
|
+
},
|
|
14233
|
+
kbps: {
|
|
14234
|
+
dimension: "bitrate",
|
|
14235
|
+
factor: 1,
|
|
14236
|
+
offset: 0
|
|
14237
|
+
},
|
|
14238
|
+
Mbps: {
|
|
14239
|
+
dimension: "bitrate",
|
|
14240
|
+
factor: 1e3,
|
|
14241
|
+
offset: 0
|
|
14242
|
+
},
|
|
14243
|
+
fps: {
|
|
14244
|
+
dimension: "rate",
|
|
14245
|
+
factor: 1,
|
|
14246
|
+
offset: 0
|
|
14247
|
+
}
|
|
14248
|
+
};
|
|
14249
|
+
/** Resolve a unit's `UnitSpec`, or `undefined` when the spelling is unknown. */
|
|
14250
|
+
function specFor(unit) {
|
|
14251
|
+
return Object.hasOwn(UNIT_TABLE, unit) ? UNIT_TABLE[unit] : void 0;
|
|
14252
|
+
}
|
|
14253
|
+
/** The dimension a unit belongs to, or `undefined` for an unknown unit. */
|
|
14254
|
+
function unitDimension(unit) {
|
|
14255
|
+
return specFor(unit)?.dimension;
|
|
14256
|
+
}
|
|
14257
|
+
/** Value in `spec`'s unit → its dimension's canonical unit. */
|
|
14258
|
+
function toCanonical(value, spec) {
|
|
14259
|
+
return value * spec.factor + spec.offset;
|
|
14260
|
+
}
|
|
14261
|
+
/** Canonical-unit value → the unit described by `spec`. */
|
|
14262
|
+
function fromCanonical(canonical, spec) {
|
|
14263
|
+
return (canonical - spec.offset) / spec.factor;
|
|
14264
|
+
}
|
|
14113
14265
|
/**
|
|
14114
|
-
*
|
|
14115
|
-
* `
|
|
14116
|
-
*
|
|
14117
|
-
* the adapter maps this ordinal onto its native level. `level?` is an
|
|
14118
|
-
* optional kind-native level id (`emergency`, `silent`, …) that overrides
|
|
14119
|
-
* `priority` for that one target.
|
|
14266
|
+
* Graceful variant for the render path: returns the converted value, or
|
|
14267
|
+
* `undefined` when the conversion is refused (unknown unit / cross-dimension).
|
|
14268
|
+
* Never throws — a render caller falls back to the raw value + source unit.
|
|
14120
14269
|
*/
|
|
14121
|
-
|
|
14122
|
-
|
|
14123
|
-
|
|
14124
|
-
|
|
14125
|
-
|
|
14126
|
-
|
|
14127
|
-
|
|
14128
|
-
|
|
14129
|
-
|
|
14130
|
-
|
|
14131
|
-
|
|
14132
|
-
|
|
14133
|
-
|
|
14134
|
-
|
|
14135
|
-
|
|
14136
|
-
|
|
14137
|
-
|
|
14138
|
-
|
|
14139
|
-
|
|
14140
|
-
|
|
14141
|
-
|
|
14270
|
+
function tryConvertUnit(value, from, to) {
|
|
14271
|
+
if (from === to) return value;
|
|
14272
|
+
const fromSpec = specFor(from);
|
|
14273
|
+
if (!fromSpec) return void 0;
|
|
14274
|
+
const toSpec = specFor(to);
|
|
14275
|
+
if (!toSpec) return void 0;
|
|
14276
|
+
if (fromSpec.dimension !== toSpec.dimension) return void 0;
|
|
14277
|
+
return fromCanonical(toCanonical(value, fromSpec), toSpec);
|
|
14278
|
+
}
|
|
14279
|
+
//#endregion
|
|
14280
|
+
//#region ../types/dist/index.mjs
|
|
14281
|
+
var SMTP_INBOUND_DEFAULT_PORT = 2525;
|
|
14282
|
+
var SMTP_INBOUND_DEFAULT_DOMAIN = "camstack.local";
|
|
14283
|
+
var SMTP_INBOUND_DEFAULT_MAX_MESSAGE_BYTES = 25 * 1024 * 1024;
|
|
14284
|
+
/** The text excerpt a message carries on the bus. */
|
|
14285
|
+
var SMTP_INBOUND_TEXT_MAX_CHARS = 4096;
|
|
14286
|
+
var PortSchema = number().int().min(1).max(65535);
|
|
14287
|
+
/** A recipient local-part: what stands before the `@`. */
|
|
14288
|
+
var SmtpRecipientSchema = string().min(1).max(64).regex(/^[A-Za-z0-9._+-]+$/);
|
|
14289
|
+
object({
|
|
14290
|
+
port: PortSchema.default(SMTP_INBOUND_DEFAULT_PORT),
|
|
14291
|
+
bindHost: string().min(1).default("0.0.0.0"),
|
|
14292
|
+
domain: string().min(1).default(SMTP_INBOUND_DEFAULT_DOMAIN),
|
|
14293
|
+
requireAuth: boolean().default(true),
|
|
14294
|
+
username: string().default(""),
|
|
14295
|
+
password: string().default("").meta({ secret: true }),
|
|
14296
|
+
starttls: boolean().default(false),
|
|
14297
|
+
maxMessageBytes: number().int().positive().default(SMTP_INBOUND_DEFAULT_MAX_MESSAGE_BYTES)
|
|
14142
14298
|
});
|
|
14143
|
-
|
|
14144
|
-
|
|
14145
|
-
|
|
14146
|
-
|
|
14147
|
-
|
|
14148
|
-
|
|
14149
|
-
|
|
14150
|
-
|
|
14151
|
-
|
|
14152
|
-
noPush: boolean().optional()
|
|
14153
|
-
}).optional(),
|
|
14154
|
-
/** e.g. Pushover `emergency` requires `retry` / `expire`. */
|
|
14155
|
-
requires: array(string()).optional(),
|
|
14156
|
-
description: string().optional()
|
|
14299
|
+
object({
|
|
14300
|
+
host: string().min(1).nullable(),
|
|
14301
|
+
hostReason: string().nullable(),
|
|
14302
|
+
port: PortSchema,
|
|
14303
|
+
domain: string().min(1),
|
|
14304
|
+
requireAuth: boolean(),
|
|
14305
|
+
username: string(),
|
|
14306
|
+
password: string(),
|
|
14307
|
+
starttls: boolean()
|
|
14157
14308
|
});
|
|
14158
|
-
|
|
14159
|
-
|
|
14160
|
-
attachments: object({
|
|
14161
|
-
mediaTypes: array(AttachmentMediaTypeSchema),
|
|
14162
|
-
mode: _enum([
|
|
14163
|
-
"url",
|
|
14164
|
-
"bytes",
|
|
14165
|
-
"both"
|
|
14166
|
-
]),
|
|
14167
|
-
max: number().int().nonnegative(),
|
|
14168
|
-
maxBytes: number().int().positive().optional()
|
|
14169
|
-
}),
|
|
14170
|
-
/** Max action buttons (0 = none). */
|
|
14171
|
-
actions: number().int().nonnegative(),
|
|
14309
|
+
object({
|
|
14310
|
+
recipients: array(SmtpRecipientSchema).min(1),
|
|
14172
14311
|
/**
|
|
14173
|
-
*
|
|
14174
|
-
*
|
|
14175
|
-
*
|
|
14176
|
-
*
|
|
14177
|
-
* this repo that once. Absent is read as false by the degrade engine, which
|
|
14178
|
-
* is the safe direction: an icon that is not rendered costs nothing, an icon
|
|
14179
|
-
* assumed and dropped costs the operator's trust in the field.
|
|
14312
|
+
* Who is subscribing. A second `subscribe` with the same id REPLACES that subscriber's
|
|
14313
|
+
* recipients (the way a consumer that restarted, or lost a device, declares its set again);
|
|
14314
|
+
* a recipient held by another subscriber is refused with `smtp-inbound/recipient-claimed`.
|
|
14315
|
+
* Absent, the subscriber is anonymous and unique.
|
|
14180
14316
|
*/
|
|
14181
|
-
|
|
14182
|
-
levels: array(TargetKindLevelSchema),
|
|
14183
|
-
format: array(NotificationFormatSchema),
|
|
14184
|
-
clickUrl: boolean(),
|
|
14185
|
-
sound: boolean(),
|
|
14186
|
-
ttl: boolean(),
|
|
14187
|
-
bodyMaxLen: number().int().positive()
|
|
14317
|
+
subscriberId: string().min(1).max(64).optional()
|
|
14188
14318
|
});
|
|
14189
|
-
|
|
14190
|
-
|
|
14191
|
-
|
|
14319
|
+
var SmtpInboundAttachmentSchema = object({
|
|
14320
|
+
filename: string(),
|
|
14321
|
+
contentType: string(),
|
|
14322
|
+
bytes: number().int().nonnegative()
|
|
14323
|
+
});
|
|
14324
|
+
/** The payload of one `broker.message` (the key is the recipient local-part). */
|
|
14325
|
+
var SmtpInboundMessageSchema = object({
|
|
14326
|
+
/** Monotonic per mailbox; a gap tells a consumer it missed an event. */
|
|
14327
|
+
seq: number().int().positive(),
|
|
14328
|
+
messageId: string(),
|
|
14329
|
+
receivedAt: number().int().nonnegative(),
|
|
14330
|
+
from: string(),
|
|
14331
|
+
to: string(),
|
|
14332
|
+
subject: string(),
|
|
14333
|
+
text: string().max(SMTP_INBOUND_TEXT_MAX_CHARS),
|
|
14334
|
+
attachments: array(SmtpInboundAttachmentSchema)
|
|
14335
|
+
});
|
|
14336
|
+
object({
|
|
14337
|
+
/** The newest seq issued so far (0 before any mail). */
|
|
14338
|
+
lastSeq: number().int().nonnegative(),
|
|
14339
|
+
/** The oldest seq still retained; messages below it are gone. */
|
|
14340
|
+
oldestSeq: number().int().nonnegative(),
|
|
14341
|
+
messages: array(object({
|
|
14342
|
+
key: string(),
|
|
14343
|
+
message: SmtpInboundMessageSchema
|
|
14344
|
+
}))
|
|
14345
|
+
});
|
|
14346
|
+
new Set([
|
|
14347
|
+
"track",
|
|
14348
|
+
"face",
|
|
14349
|
+
"identity",
|
|
14350
|
+
"plate",
|
|
14351
|
+
"vehicle",
|
|
14352
|
+
"scene",
|
|
14353
|
+
"motion",
|
|
14354
|
+
"object",
|
|
14355
|
+
"audio",
|
|
14356
|
+
"mosaic"
|
|
14357
|
+
]);
|
|
14358
|
+
/**
|
|
14359
|
+
* The owner types that are event tables, in the order the event-media resolver
|
|
14360
|
+
* should consider them. Exported so a consumer asking "is this key an event?"
|
|
14361
|
+
* does not re-spell the list and drift from it.
|
|
14362
|
+
*/
|
|
14363
|
+
var EVENT_OWNER_TYPES = [
|
|
14364
|
+
"motion",
|
|
14365
|
+
"object",
|
|
14366
|
+
"audio"
|
|
14367
|
+
];
|
|
14368
|
+
/**
|
|
14369
|
+
* The same list as a Zod enum, for the cap inputs that must NAME the table
|
|
14370
|
+
* (D482: `getEventMedia` / `listEventMedia` take an owner, and an owner is
|
|
14371
|
+
* `(table, id)`).
|
|
14372
|
+
*
|
|
14373
|
+
* Built FROM {@link EVENT_OWNER_TYPES} rather than re-spelled: a fourth event
|
|
14374
|
+
* table would otherwise be accepted by the codec and refused at the door, with
|
|
14375
|
+
* nothing failing until a caller asked.
|
|
14376
|
+
*/
|
|
14377
|
+
var EventOwnerTypeSchema = _enum(EVENT_OWNER_TYPES);
|
|
14378
|
+
/** The same list as a Zod enum, for the cap input that carries it. */
|
|
14379
|
+
var MediaPresenceOwnerKindSchema = _enum([...EVENT_OWNER_TYPES, "track"]);
|
|
14380
|
+
new Set(EVENT_OWNER_TYPES);
|
|
14381
|
+
/**
|
|
14382
|
+
* What a published package needs from the rest of the install (D989).
|
|
14383
|
+
*
|
|
14384
|
+
* One published framework package (`@camstack/server`) carries the kernel, the
|
|
14385
|
+
* builtins and the capability contracts, so "which addon runs on which
|
|
14386
|
+
* framework" is a question of version, and the answer is DECLARED by the
|
|
14387
|
+
* package that knows it:
|
|
14388
|
+
*
|
|
14389
|
+
* - an addon says the oldest server it runs on (`requires.server: ">=X"`);
|
|
14390
|
+
* - the server says the oldest addon it works with
|
|
14391
|
+
* (`requires.addons: { "@camstack/addon-x": ">=Y" }`) and the oldest shell
|
|
14392
|
+
* around it (`requires.wrapper: { desktop, image }`);
|
|
14393
|
+
* - a wrapper (the desktop app, the container starter) says which server
|
|
14394
|
+
* range it can host, and reports its own kind and version.
|
|
14395
|
+
*
|
|
14396
|
+
* The publish workflow STAMPS these after the version bump
|
|
14397
|
+
* (`scripts/ci/stamp-requires.mjs`); nobody types a number by hand.
|
|
14398
|
+
*
|
|
14399
|
+
* A requirement that cannot be checked is NOT met: a shell that reports no
|
|
14400
|
+
* version counts as below the minimum, and an unreadable running version is
|
|
14401
|
+
* named in the result (a failed read is never a pass).
|
|
14402
|
+
*/
|
|
14403
|
+
/** `>=MAJOR.MINOR.PATCH[-prerelease]` — the only range shape a requirement uses. */
|
|
14404
|
+
var MinVersionSchema = string().regex(/^>=\d+\.\d+\.\d+(-[0-9A-Za-z.-]+)?$/, "a minimum is written \">=X.Y.Z\"");
|
|
14405
|
+
object({
|
|
14406
|
+
/** The oldest `@camstack/server` this package runs on. */
|
|
14407
|
+
server: MinVersionSchema.optional(),
|
|
14408
|
+
/** The oldest installed version of each named addon package. */
|
|
14409
|
+
addons: record(string(), MinVersionSchema).optional(),
|
|
14410
|
+
/** The oldest shell around the server, per shell kind. */
|
|
14411
|
+
wrapper: object({
|
|
14412
|
+
desktop: MinVersionSchema.optional(),
|
|
14413
|
+
image: MinVersionSchema.optional()
|
|
14414
|
+
}).optional()
|
|
14415
|
+
});
|
|
14416
|
+
/** One unmet requirement; each names the versions on both sides. */
|
|
14417
|
+
var UnmetRequirementSchema = discriminatedUnion("kind", [
|
|
14418
|
+
object({
|
|
14419
|
+
kind: literal("server-too-old"),
|
|
14420
|
+
required: string(),
|
|
14421
|
+
/** `null` — the running server version could not be read. */
|
|
14422
|
+
running: string().nullable()
|
|
14423
|
+
}),
|
|
14424
|
+
object({
|
|
14425
|
+
kind: literal("addon-too-old"),
|
|
14426
|
+
packageName: string(),
|
|
14427
|
+
required: string(),
|
|
14428
|
+
/** `null` — the addon is not installed (or its version is unreadable). */
|
|
14429
|
+
running: string().nullable()
|
|
14430
|
+
}),
|
|
14431
|
+
object({
|
|
14432
|
+
kind: literal("wrapper-too-old"),
|
|
14433
|
+
wrapper: _enum(["desktop", "image"]),
|
|
14434
|
+
required: string(),
|
|
14435
|
+
/** `null` — the wrapper reported no version. */
|
|
14436
|
+
running: string().nullable()
|
|
14437
|
+
})
|
|
14438
|
+
]);
|
|
14439
|
+
var RequiredAddonUpdateSchema = object({
|
|
14440
|
+
packageName: string(),
|
|
14441
|
+
/** The minimum the target server declares. */
|
|
14442
|
+
required: string(),
|
|
14443
|
+
/** What this node has; `null` when the addon is not installed. */
|
|
14444
|
+
installed: string().nullable()
|
|
14445
|
+
});
|
|
14446
|
+
/**
|
|
14447
|
+
* Which integration instance a settings form is for. An addon that serves several instances
|
|
14448
|
+
* (`instanceMode: multiple`) can show a different form per instance — an NVR integration
|
|
14449
|
+
* needs its connection, the default integration needs the addon's own sections.
|
|
14450
|
+
*
|
|
14451
|
+
* - `integrationId` is `null` in the create wizard: nothing exists yet, the operator is
|
|
14452
|
+
* setting up a NEW instance.
|
|
14453
|
+
* - `mode` is the wizard mode of the integration type (`getAvailableTypes`).
|
|
14454
|
+
* - `candidateStableId` is the discovery candidate a wizard was seeded from, if any.
|
|
14455
|
+
*/
|
|
14456
|
+
var IntegrationInstanceRefSchema = object({
|
|
14457
|
+
integrationId: string().nullable(),
|
|
14458
|
+
mode: _enum([
|
|
14459
|
+
"standalone",
|
|
14460
|
+
"account",
|
|
14461
|
+
"broker"
|
|
14462
|
+
]),
|
|
14463
|
+
candidateStableId: string().optional()
|
|
14464
|
+
});
|
|
14465
|
+
/**
|
|
14466
|
+
* notification-output — canonical, capability-gated notification delivery.
|
|
14467
|
+
*
|
|
14468
|
+
* Apprise-derived model (see
|
|
14469
|
+
* `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
|
|
14470
|
+
* callers emit ONE canonical `Notification`; each provider declares a
|
|
14471
|
+
* per-kind capability descriptor (`TargetKind`), and the pure degrade
|
|
14472
|
+
* engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
|
|
14473
|
+
* message to what the kind supports — callers never special-case a service.
|
|
14474
|
+
*
|
|
14475
|
+
* DESIGN DECISIONS (locked):
|
|
14476
|
+
* - A target is an INSTANCE of this function cap (epic #440, step 6): the
|
|
14477
|
+
* providers serve their targets as `integration-instances` records, one
|
|
14478
|
+
* record kind per target kind, and the admin lists, adds, edits, switches
|
|
14479
|
+
* and deletes them through that cap. This cap keeps what an instance cannot
|
|
14480
|
+
* say: the kind catalogue (`listTargetKinds`: capabilities, delivery
|
|
14481
|
+
* parameters, brand icon), dispatch (`send`, `testTarget`) and the form
|
|
14482
|
+
* helpers (`discoverTargets`, `probeTargetConfig`).
|
|
14483
|
+
* - `listTargetKinds` / `discoverTargets` return arrays → the generated
|
|
14484
|
+
* cap-mount auto-`concatCollection`-fans them across every registered
|
|
14485
|
+
* provider so one catalog is routable. `send` / `testTarget` /
|
|
14486
|
+
* `probeTargetConfig` route to ONE provider by the `addonId` the generated
|
|
14487
|
+
* collection router extracts from the call input.
|
|
14488
|
+
* - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
|
|
14489
|
+
* transformer) + UDS MsgPack both round-trip typed arrays — already used by
|
|
14490
|
+
* `storage` / `storage-provider` / `recording` caps over the same path. No
|
|
14491
|
+
* base64 fallback needed.
|
|
14492
|
+
*
|
|
14493
|
+
* TODO (deferred, closed-set change — separate decision): add
|
|
14494
|
+
* `providerKind: 'notify'` so notification providers surface on the unified
|
|
14495
|
+
* admin "Integrations" page.
|
|
14496
|
+
*/
|
|
14497
|
+
/**
|
|
14498
|
+
* Zentik-derived typed-media enum — the superset across every kind. Each
|
|
14499
|
+
* adapter picks what it supports and the degrade engine filters the rest.
|
|
14500
|
+
*/
|
|
14501
|
+
var AttachmentMediaTypeSchema = _enum([
|
|
14502
|
+
"image",
|
|
14503
|
+
"video",
|
|
14504
|
+
"gif",
|
|
14505
|
+
"audio",
|
|
14506
|
+
"icon"
|
|
14507
|
+
]);
|
|
14508
|
+
/**
|
|
14509
|
+
* A single attachment. Exactly one of `url` (remote source, most adapters
|
|
14510
|
+
* prefer this) or `bytes` (inline source; required for Pushover-style
|
|
14511
|
+
* bytes-only kinds) MUST be present — the degrade engine expresses a
|
|
14512
|
+
* url→bytes fetch as a `needsFetch` directive the adapter executes.
|
|
14513
|
+
*/
|
|
14514
|
+
var AttachmentSchema = object({
|
|
14515
|
+
mediaType: AttachmentMediaTypeSchema,
|
|
14516
|
+
url: string().optional(),
|
|
14517
|
+
bytes: _instanceof(Uint8Array).optional(),
|
|
14518
|
+
mime: string().optional(),
|
|
14519
|
+
name: string().optional()
|
|
14520
|
+
}).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
|
|
14521
|
+
var NotificationFormatSchema = _enum([
|
|
14522
|
+
"text",
|
|
14523
|
+
"markdown",
|
|
14524
|
+
"html"
|
|
14525
|
+
]);
|
|
14526
|
+
/**
|
|
14527
|
+
* The CLOSED icon vocabulary an action button may use.
|
|
14528
|
+
*
|
|
14529
|
+
* A closed set, not a free string, and that is the whole point: an arbitrary
|
|
14530
|
+
* icon name is one that ntfy renders, zentik silently drops, and nobody
|
|
14531
|
+
* notices — the same class of gap as a zone vocabulary nothing produced
|
|
14532
|
+
* ([D35](../../../docs/decisions/adr-0035.md)). Every adapter maps this set or
|
|
14533
|
+
* declares `actionIcons: false` and the degrade engine strips the field.
|
|
14534
|
+
*
|
|
14535
|
+
* Named by INTENT, never by glyph. "check" would tie the vocabulary to one
|
|
14536
|
+
* renderer's icon set; "acknowledge" survives an adapter that draws it
|
|
14537
|
+
* differently.
|
|
14538
|
+
*
|
|
14539
|
+
* ── A TOKEN IS NOT A WIRE VALUE ─────────────────────────────────────
|
|
14540
|
+
*
|
|
14541
|
+
* These names are for US. **No adapter may forward one verbatim.** Each maps
|
|
14542
|
+
* the whole set onto its own renderer's vocabulary through a
|
|
14543
|
+
* `Record<NotificationActionIcon, string>` — a Record, never a lookup with a
|
|
14544
|
+
* fallback, so adding a member here fails every adapter's build until someone
|
|
14545
|
+
* decides its glyph, which is the only place that decision can be made
|
|
14546
|
+
* honestly.
|
|
14547
|
+
*
|
|
14548
|
+
* This paragraph is the bug. Zentik declared `actionIcons: true` and passed
|
|
14549
|
+
* `disarm` straight through; iOS feeds that string to
|
|
14550
|
+
* `UNNotificationActionIcon(systemImageName:)`, `disarm` is not an SF Symbol,
|
|
14551
|
+
* and every snooze and alarm button arrived BLANK. A pass-through is not a
|
|
14552
|
+
* mapping, and "the field is documented" is not "the value renders".
|
|
14553
|
+
*
|
|
14554
|
+
* Adding a member is TRAIN-BOUND. The enum lives in the published
|
|
14555
|
+
* `@camstack/server` closure and the cap seam validates against the HUB's copy,
|
|
14556
|
+
* so an addon that emits a token the running hub does not know does not lose an
|
|
14557
|
+
* icon — its whole `send` fails Zod validation and the notification never
|
|
14558
|
+
* arrives. Never emit a new token from an addon before the train carrying it.
|
|
14559
|
+
*/
|
|
14560
|
+
var NotificationActionIconSchema = _enum([
|
|
14561
|
+
"acknowledge",
|
|
14562
|
+
"dismiss",
|
|
14563
|
+
"silence",
|
|
14564
|
+
"snooze",
|
|
14565
|
+
"view",
|
|
14566
|
+
"play",
|
|
14567
|
+
"open",
|
|
14568
|
+
"close",
|
|
14569
|
+
"lock",
|
|
14570
|
+
"unlock",
|
|
14571
|
+
"arm",
|
|
14572
|
+
"arm-home",
|
|
14573
|
+
"arm-away",
|
|
14574
|
+
"arm-night",
|
|
14575
|
+
"disarm",
|
|
14576
|
+
"light",
|
|
14577
|
+
"alert",
|
|
14578
|
+
"camera"
|
|
14579
|
+
]);
|
|
14580
|
+
/** A single tap-through action button. */
|
|
14581
|
+
var NotificationActionSchema = object({
|
|
14582
|
+
id: string(),
|
|
14583
|
+
label: string(),
|
|
14584
|
+
url: string().optional(),
|
|
14585
|
+
/** Dropped by the degrade engine for a kind with `caps.actionIcons: false`. */
|
|
14586
|
+
icon: NotificationActionIconSchema.optional(),
|
|
14587
|
+
/**
|
|
14588
|
+
* Renders in a warning style where the notifier supports it.
|
|
14589
|
+
*
|
|
14590
|
+
* A HINT, never a gate. The callback's authority is its token and nothing
|
|
14591
|
+
* else — see `notification-center/action-token.ts` for what that does and
|
|
14592
|
+
* does not buy.
|
|
14593
|
+
*/
|
|
14594
|
+
destructive: boolean().optional(),
|
|
14595
|
+
/**
|
|
14596
|
+
* How the tap should REACH the url.
|
|
14597
|
+
*
|
|
14598
|
+
* `navigate` (absent, and every button authored before this field) opens it:
|
|
14599
|
+
* the phone leaves the notification and shows whatever the callback returns.
|
|
14600
|
+
* That is right for a button whose answer the operator wants to read.
|
|
14601
|
+
*
|
|
14602
|
+
* `background` fires it as a POST and stays put. It exists for the buttons
|
|
14603
|
+
* whose whole point is not to interrupt — "silence this for 30 minutes" is
|
|
14604
|
+
* an answer to the notification, and being thrown into a browser tab to
|
|
14605
|
+
* confirm it costs more attention than the notification did. A backend that
|
|
14606
|
+
* cannot do a background call renders it as an ordinary link (the adapters
|
|
14607
|
+
* fall back rather than dropping the button), so this is a preference, never
|
|
14608
|
+
* a requirement.
|
|
14609
|
+
*/
|
|
14610
|
+
mode: _enum(["navigate", "background"]).optional()
|
|
14611
|
+
});
|
|
14612
|
+
/** A delivery parameter value: what a notifier declared it takes. */
|
|
14613
|
+
var DeliveryParamValueSchema = union([
|
|
14614
|
+
string(),
|
|
14615
|
+
number(),
|
|
14616
|
+
boolean()
|
|
14617
|
+
]);
|
|
14618
|
+
/**
|
|
14619
|
+
* One extra delivery parameter a notifier KIND declares (D938). A rule that
|
|
14620
|
+
* addresses a target of that kind may set it; a kind that declares nothing is
|
|
14621
|
+
* never handed one. The admin UI derives its control from this descriptor —
|
|
14622
|
+
* no editor knows a service by name.
|
|
14623
|
+
*
|
|
14624
|
+
* Optional fields are `.optional()`, never `.default()` (a Zod default does not
|
|
14625
|
+
* run on the addon cap path).
|
|
14626
|
+
*/
|
|
14627
|
+
var DeliveryParamSchema = object({
|
|
14628
|
+
key: string().min(1),
|
|
14629
|
+
label: string(),
|
|
14630
|
+
/** i18n key of the label, resolved by the declaring addon's namespace. */
|
|
14631
|
+
labelKey: string().optional(),
|
|
14632
|
+
type: _enum([
|
|
14633
|
+
"enum",
|
|
14634
|
+
"number",
|
|
14635
|
+
"boolean",
|
|
14636
|
+
"string"
|
|
14637
|
+
]),
|
|
14638
|
+
/** `enum` only: the closed set of accepted values. */
|
|
14639
|
+
options: array(object({
|
|
14640
|
+
value: string(),
|
|
14641
|
+
label: string()
|
|
14642
|
+
})).optional(),
|
|
14643
|
+
/** `number` only. */
|
|
14644
|
+
min: number().optional(),
|
|
14645
|
+
max: number().optional(),
|
|
14646
|
+
/** What the notifier does when the rule sets nothing; shown as the placeholder. */
|
|
14647
|
+
default: DeliveryParamValueSchema.optional()
|
|
14648
|
+
});
|
|
14649
|
+
/**
|
|
14650
|
+
* The canonical notification. `body` is the only hard field (Apprise model).
|
|
14651
|
+
* `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
|
|
14652
|
+
* NOT a fixed severity enum — each kind declares its own `caps.levels` and
|
|
14653
|
+
* the adapter maps this ordinal onto its native level. `level?` is an
|
|
14654
|
+
* optional kind-native level id (`emergency`, `silent`, …) that overrides
|
|
14655
|
+
* `priority` for that one target.
|
|
14656
|
+
*/
|
|
14657
|
+
var NotificationSchema = object({
|
|
14658
|
+
body: string(),
|
|
14659
|
+
title: string().optional(),
|
|
14660
|
+
format: NotificationFormatSchema.default("text"),
|
|
14661
|
+
priority: number().int().min(1).max(5).default(3),
|
|
14662
|
+
level: string().optional(),
|
|
14663
|
+
attachments: array(AttachmentSchema).optional(),
|
|
14664
|
+
clickUrl: string().optional(),
|
|
14665
|
+
actions: array(NotificationActionSchema).optional(),
|
|
14666
|
+
sound: string().optional(),
|
|
14667
|
+
ttl: number().optional(),
|
|
14668
|
+
tag: string().optional(),
|
|
14669
|
+
deviceId: number().optional(),
|
|
14670
|
+
eventId: string().optional(),
|
|
14671
|
+
metadata: record(string(), unknown()).optional(),
|
|
14672
|
+
/**
|
|
14673
|
+
* Values for the parameters the target's kind DECLARES in
|
|
14674
|
+
* {@link TargetKindSchema} `deliveryParams`. Already validated against the
|
|
14675
|
+
* declaration by the sender; a notifier reads only the keys it declared.
|
|
14676
|
+
*/
|
|
14677
|
+
delivery: record(string(), DeliveryParamValueSchema).optional()
|
|
14678
|
+
});
|
|
14679
|
+
/** One declared native severity/priority level for a kind. */
|
|
14680
|
+
var TargetKindLevelSchema = object({
|
|
14681
|
+
id: string(),
|
|
14682
|
+
label: string(),
|
|
14683
|
+
/** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
|
|
14684
|
+
ordinal: number().int().min(1).max(5).nullable(),
|
|
14685
|
+
flags: object({
|
|
14686
|
+
critical: boolean().optional(),
|
|
14687
|
+
silent: boolean().optional(),
|
|
14688
|
+
noPush: boolean().optional()
|
|
14689
|
+
}).optional(),
|
|
14690
|
+
/** e.g. Pushover `emergency` requires `retry` / `expire`. */
|
|
14691
|
+
requires: array(string()).optional(),
|
|
14692
|
+
description: string().optional()
|
|
14693
|
+
});
|
|
14694
|
+
/** The full capability block consulted before dispatch. */
|
|
14695
|
+
var TargetKindCapsSchema = object({
|
|
14696
|
+
attachments: object({
|
|
14697
|
+
mediaTypes: array(AttachmentMediaTypeSchema),
|
|
14698
|
+
mode: _enum([
|
|
14699
|
+
"url",
|
|
14700
|
+
"bytes",
|
|
14701
|
+
"both"
|
|
14702
|
+
]),
|
|
14703
|
+
max: number().int().nonnegative(),
|
|
14704
|
+
maxBytes: number().int().positive().optional()
|
|
14705
|
+
}),
|
|
14706
|
+
/** Max action buttons (0 = none). */
|
|
14707
|
+
actions: number().int().nonnegative(),
|
|
14708
|
+
/**
|
|
14709
|
+
* Whether this kind renders a per-action ICON.
|
|
14710
|
+
*
|
|
14711
|
+
* `.optional()`, deliberately NOT `.default(false)`: a Zod default does not
|
|
14712
|
+
* run on the addon cap path — three production failures in one day taught
|
|
14713
|
+
* this repo that once. Absent is read as false by the degrade engine, which
|
|
14714
|
+
* is the safe direction: an icon that is not rendered costs nothing, an icon
|
|
14715
|
+
* assumed and dropped costs the operator's trust in the field.
|
|
14716
|
+
*/
|
|
14717
|
+
actionIcons: boolean().optional(),
|
|
14718
|
+
levels: array(TargetKindLevelSchema),
|
|
14719
|
+
format: array(NotificationFormatSchema),
|
|
14720
|
+
clickUrl: boolean(),
|
|
14721
|
+
sound: boolean(),
|
|
14722
|
+
ttl: boolean(),
|
|
14723
|
+
bodyMaxLen: number().int().positive()
|
|
14724
|
+
});
|
|
14725
|
+
/**
|
|
14726
|
+
* `configSchema` is a `ConfigUISchema` tree passed through to the admin
|
|
14727
|
+
* FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
|
|
14192
14728
|
* `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
|
|
14193
14729
|
* the union is large and not meant for runtime validation here; the exported
|
|
14194
14730
|
* `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
|
|
14195
14731
|
*/
|
|
14196
|
-
var ConfigSchemaPassthrough$
|
|
14732
|
+
var ConfigSchemaPassthrough$3 = unknown();
|
|
14197
14733
|
var TargetKindSchema = object({
|
|
14198
14734
|
kind: string(),
|
|
14199
14735
|
label: string(),
|
|
@@ -14230,7 +14766,7 @@ var TargetKindSchema = object({
|
|
|
14230
14766
|
* its raster path, which is the safe default for an unknown image.
|
|
14231
14767
|
*/
|
|
14232
14768
|
iconMediaType: string().optional(),
|
|
14233
|
-
configSchema: ConfigSchemaPassthrough$
|
|
14769
|
+
configSchema: ConfigSchemaPassthrough$3,
|
|
14234
14770
|
/**
|
|
14235
14771
|
* The config keys that decide WHERE this kind's secrets are sent (server,
|
|
14236
14772
|
* base URL, instance, chat, recipient). A save that changes any of them
|
|
@@ -14252,9 +14788,11 @@ var TargetKindSchema = object({
|
|
|
14252
14788
|
caps: TargetKindCapsSchema
|
|
14253
14789
|
});
|
|
14254
14790
|
/**
|
|
14255
|
-
* A
|
|
14256
|
-
*
|
|
14257
|
-
*
|
|
14791
|
+
* A target as a provider's own code sees it (the notification-center bridge, the
|
|
14792
|
+
* send path): the flat record body split into the name, the switch and the
|
|
14793
|
+
* kind's fields. `config` holds secrets; a reader that serves it to a client
|
|
14794
|
+
* REDACTS secret fields (a presence marker only) — never round-trip a stored
|
|
14795
|
+
* secret to the UI.
|
|
14258
14796
|
*/
|
|
14259
14797
|
var TargetSchema = object({
|
|
14260
14798
|
id: string(),
|
|
@@ -14297,13 +14835,13 @@ var ProbeTargetConfigResultSchema = object({
|
|
|
14297
14835
|
stateInstance: string().optional(),
|
|
14298
14836
|
error: string().optional()
|
|
14299
14837
|
});
|
|
14300
|
-
method(object({}), array(TargetKindSchema)), method(object({
|
|
14838
|
+
method(object({}), array(TargetKindSchema)), method(object({
|
|
14301
14839
|
kind: string(),
|
|
14302
14840
|
config: record(string(), unknown()).optional(),
|
|
14303
14841
|
/**
|
|
14304
14842
|
* When editing / duplicating, the blank password field never round-trips
|
|
14305
14843
|
* the stored token. Pass the source target id so the provider can restore
|
|
14306
|
-
* secrets server-side before dialling
|
|
14844
|
+
* secrets server-side before dialling.
|
|
14307
14845
|
*/
|
|
14308
14846
|
targetId: string().optional()
|
|
14309
14847
|
}), array(DiscoveredTargetSchema), { auth: "admin" }), method(object({
|
|
@@ -14326,27 +14864,6 @@ method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSche
|
|
|
14326
14864
|
}), TestResultSchema, {
|
|
14327
14865
|
kind: "mutation",
|
|
14328
14866
|
auth: "admin"
|
|
14329
|
-
}), method(object({
|
|
14330
|
-
target: TargetSchema,
|
|
14331
|
-
/**
|
|
14332
|
-
* Duplicate flow: create a NEW target id while copying secrets from an
|
|
14333
|
-
* existing row. The UI never holds the stored token; blank / redacted
|
|
14334
|
-
* password fields are restored from this source (D634 still applies if
|
|
14335
|
-
* destinations diverge without a re-typed secret).
|
|
14336
|
-
*/
|
|
14337
|
-
cloneSecretsFrom: string().optional()
|
|
14338
|
-
}), TargetSchema, {
|
|
14339
|
-
kind: "mutation",
|
|
14340
|
-
auth: "admin"
|
|
14341
|
-
}), method(object({ targetId: string() }), _void(), {
|
|
14342
|
-
kind: "mutation",
|
|
14343
|
-
auth: "admin"
|
|
14344
|
-
}), method(object({
|
|
14345
|
-
targetId: string(),
|
|
14346
|
-
enabled: boolean()
|
|
14347
|
-
}), _void(), {
|
|
14348
|
-
kind: "mutation",
|
|
14349
|
-
auth: "admin"
|
|
14350
14867
|
});
|
|
14351
14868
|
looseObject({
|
|
14352
14869
|
name: string().min(1),
|
|
@@ -22757,7 +23274,6 @@ var SYSTEM_CAP_VOCABULARY = {
|
|
|
22757
23274
|
"notification-output": system("notification delivery — reached through notifier devices and rules"),
|
|
22758
23275
|
"notification-rules": system("notification rules — authored on their own page"),
|
|
22759
23276
|
"oauth-integration": system(IDENTITY),
|
|
22760
|
-
"oidc-connections": system(IDENTITY),
|
|
22761
23277
|
"osd-manager": system(PIPELINE),
|
|
22762
23278
|
"pipeline-executor": system(PIPELINE),
|
|
22763
23279
|
"pipeline-orchestrator": system(PIPELINE),
|
|
@@ -42639,727 +43155,345 @@ var LEGACY_ICON_ALIASES = { gauge2: "gauge" };
|
|
|
42639
43155
|
*
|
|
42640
43156
|
* ## What is persisted
|
|
42641
43157
|
*
|
|
42642
|
-
* The canonical kebab-case lucide id ({@link IconKey}). Spellings that a lucide
|
|
42643
|
-
* package still accepts (`home` for `house`) and this repo's own legacy ones
|
|
42644
|
-
* (`gauge2`) RESOLVE ({@link canonicalIconKey}) so a stored value never goes
|
|
42645
|
-
* stale, but they are never OFFERED by search.
|
|
42646
|
-
*
|
|
42647
|
-
* ## Search
|
|
42648
|
-
*
|
|
42649
|
-
* Over the key, the Italian/English overlay in `icon-synonyms.ts`, any words
|
|
42650
|
-
* the caller adds, and lucide's English tags — in that order of weight.
|
|
42651
|
-
*/
|
|
42652
|
-
var KEY_SET$2 = new Set(ICON_KEYS);
|
|
42653
|
-
new Map([...Object.entries(ICON_ALIASES), ...Object.entries(LEGACY_ICON_ALIASES)]);
|
|
42654
|
-
/** Is this a canonical key of the catalog? (An alias is not — see {@link canonicalIconKey}.) */
|
|
42655
|
-
function isIconKey(value) {
|
|
42656
|
-
return typeof value === "string" && KEY_SET$2.has(value);
|
|
42657
|
-
}
|
|
42658
|
-
/**
|
|
42659
|
-
* Wire/storage schema for one icon key.
|
|
42660
|
-
*
|
|
42661
|
-
* Deliberately NOT a `z.enum` of the catalog: ~1,700 literals would be inlined
|
|
42662
|
-
* into every cap router, type and API-reference row that carries an icon. The
|
|
42663
|
-
* check is membership in the catalog and the type is {@link IconKey}.
|
|
42664
|
-
*/
|
|
42665
|
-
var IconKeySchema = custom(isIconKey, "Not an icon of the catalog");
|
|
42666
|
-
var ENTRIES = ICON_KEYS.map((key, index) => {
|
|
42667
|
-
const [categoryIndexes, tags] = ICON_META[index] ?? [[], []];
|
|
42668
|
-
const categories = categoryIndexes.flatMap((i) => {
|
|
42669
|
-
const id = ICON_CATEGORY_IDS[i];
|
|
42670
|
-
return id === void 0 ? [] : [id];
|
|
42671
|
-
});
|
|
42672
|
-
return {
|
|
42673
|
-
key,
|
|
42674
|
-
categories,
|
|
42675
|
-
primaryCategory: categories[0] ?? ICON_CATEGORY_IDS[0],
|
|
42676
|
-
tags,
|
|
42677
|
-
synonyms: ICON_SYNONYMS[key] ?? []
|
|
42678
|
-
};
|
|
42679
|
-
});
|
|
42680
|
-
new Map(ENTRIES.map((e) => [e.key, e]));
|
|
42681
|
-
/** Categories a picker offers first: the ones this product's icons mostly live in. */
|
|
42682
|
-
var LEADING_CATEGORIES = [
|
|
42683
|
-
"devices",
|
|
42684
|
-
"home",
|
|
42685
|
-
"security",
|
|
42686
|
-
"buildings",
|
|
42687
|
-
"connectivity",
|
|
42688
|
-
"multimedia",
|
|
42689
|
-
"nature",
|
|
42690
|
-
"weather",
|
|
42691
|
-
"transportation",
|
|
42692
|
-
"animals"
|
|
42693
|
-
];
|
|
42694
|
-
var PRIMARY_CATEGORIES = new Set(ENTRIES.map((e) => e.primaryCategory));
|
|
42695
|
-
[...LEADING_CATEGORIES, ...ICON_CATEGORY_IDS.filter((c) => !LEADING_CATEGORIES.includes(c))].filter((c) => PRIMARY_CATEGORIES.has(c));
|
|
42696
|
-
/**
|
|
42697
|
-
* One (location, icon) assignment as it travels.
|
|
42698
|
-
*
|
|
42699
|
-
* `locationKey` is ALWAYS {@link locationIconKey} of the label — never the
|
|
42700
|
-
* operator's casing. The registry matches labels trimmed + case-insensitively
|
|
42701
|
-
* everywhere (`addLocation`, `removeLocation`, `renameLocation`), and a
|
|
42702
|
-
* case-only rename (`kitchen` → `Kitchen`) is a real edit this repo supports; a
|
|
42703
|
-
* map keyed on the displayed casing would orphan its entry on exactly that
|
|
42704
|
-
* edit. Consumers join by keying their own label through `locationIconKey`.
|
|
42705
|
-
*/
|
|
42706
|
-
var LocationIconAssignmentSchema = object({
|
|
42707
|
-
locationKey: string(),
|
|
42708
|
-
icon: IconKeySchema
|
|
42709
|
-
});
|
|
42710
|
-
/**
|
|
42711
|
-
* One (location, description) assignment as it travels.
|
|
42712
|
-
*
|
|
42713
|
-
* Same key discipline as {@link LocationIconAssignmentSchema}, and for the same
|
|
42714
|
-
* reason: this lived for a while in the post-analysis addon's own settings,
|
|
42715
|
-
* keyed by a HAND-TYPED label matched exactly and case-sensitively. A rename in
|
|
42716
|
-
* the Locations page carried the icon and silently orphaned the description —
|
|
42717
|
-
* two authorities for one thing, joined by two different rules. Now both hang
|
|
42718
|
-
* off the location itself, on `locationIconKey`.
|
|
42719
|
-
*/
|
|
42720
|
-
var LocationDescriptionAssignmentSchema = object({
|
|
42721
|
-
locationKey: string(),
|
|
42722
|
-
description: string()
|
|
42723
|
-
});
|
|
42724
|
-
/**
|
|
42725
|
-
* WHO an action step acts on (D983) — one target shape for every place that
|
|
42726
|
-
* performs an action (automation steps, Action entries, notification
|
|
42727
|
-
* sequences, scheduler points):
|
|
42728
|
-
*
|
|
42729
|
-
* - `devices` — device ids the operator picked, frozen at save time;
|
|
42730
|
-
* - `domain` — every device that offers the step's VOCABULARY action,
|
|
42731
|
-
* optionally narrowed to one device type and one room, resolved WHEN THE
|
|
42732
|
-
* STEP RUNS (a device added later is included). The action always comes
|
|
42733
|
-
* from the vocabulary (`cover.open`), never from a raw cap name, so a
|
|
42734
|
-
* `domain` target needs an `actionId` (enforced on the step schema);
|
|
42735
|
-
* - `var` — a `$var` resolved from the run's scope.
|
|
42736
|
-
*
|
|
42737
|
-
* {@link ActionTargetResolver} turns a target into device ids. It is pure
|
|
42738
|
-
* (a {@link DeviceDirectory} is handed in) so the hub's core-blocks service and
|
|
42739
|
-
* a generated automation block share it.
|
|
42740
|
-
*
|
|
42741
|
-
* A room is the device's `location` label (`DeviceInfo.location`); two labels
|
|
42742
|
-
* name the same room when `locationIconKey` agrees (trimmed, lower-cased).
|
|
42743
|
-
*/
|
|
42744
|
-
var ActionTargetSchema = discriminatedUnion("kind", [
|
|
42745
|
-
object({
|
|
42746
|
-
kind: literal("devices"),
|
|
42747
|
-
ids: array(number().int()).min(1)
|
|
42748
|
-
}),
|
|
42749
|
-
object({
|
|
42750
|
-
kind: literal("domain"),
|
|
42751
|
-
/** Narrow to one kind of device. */
|
|
42752
|
-
deviceType: _enum(DeviceType).optional(),
|
|
42753
|
-
/** Narrow to one room: the `location` label devices carry. */
|
|
42754
|
-
roomId: string().min(1).optional()
|
|
42755
|
-
}),
|
|
42756
|
-
object({
|
|
42757
|
-
kind: literal("var"),
|
|
42758
|
-
name: string().min(1)
|
|
42759
|
-
})
|
|
42760
|
-
]);
|
|
42761
|
-
EventCategory.DeviceRegistered, EventCategory.DeviceUnregistered, EventCategory.DeviceUpdated, EventCategory.DeviceMetaChanged, EventCategory.DeviceBindingsChanged;
|
|
42762
|
-
var ExpressionBindingSourceSchema = union([
|
|
42763
|
-
object({
|
|
42764
|
-
kind: literal("field").optional(),
|
|
42765
|
-
sourceKey: string(),
|
|
42766
|
-
cap: string(),
|
|
42767
|
-
fieldPath: string()
|
|
42768
|
-
}),
|
|
42769
|
-
object({
|
|
42770
|
-
kind: literal("literal"),
|
|
42771
|
-
value: union([
|
|
42772
|
-
string(),
|
|
42773
|
-
number(),
|
|
42774
|
-
boolean(),
|
|
42775
|
-
_null()
|
|
42776
|
-
])
|
|
42777
|
-
}),
|
|
42778
|
-
object({
|
|
42779
|
-
kind: literal("global"),
|
|
42780
|
-
sourceStableId: string(),
|
|
42781
|
-
cap: string(),
|
|
42782
|
-
fieldPath: string()
|
|
42783
|
-
})
|
|
42784
|
-
]);
|
|
42785
|
-
object({
|
|
42786
|
-
expr: string().min(1).max(MAX_EXPRESSION_SOURCE_LENGTH),
|
|
42787
|
-
bindings: record(string().regex(EXPRESSION_IDENTIFIER_RE), ExpressionBindingSourceSchema)
|
|
42788
|
-
}).superRefine((src, ctx) => {
|
|
42789
|
-
const err = validateExpressionSource(src);
|
|
42790
|
-
if (err !== null) ctx.addIssue({
|
|
42791
|
-
code: "custom",
|
|
42792
|
-
message: err,
|
|
42793
|
-
path: ["expr"]
|
|
42794
|
-
});
|
|
42795
|
-
});
|
|
42796
|
-
/**
|
|
42797
|
-
* Identity envelope for a device's upstream-system metadata.
|
|
42798
|
-
*
|
|
42799
|
-
* Two jobs:
|
|
42800
|
-
*
|
|
42801
|
-
* 1. **Dispatch key.** `id` is the natural identifier the SOURCE system
|
|
42802
|
-
* uses to address this device (HA `entity_id`, Reolink MAC, ONVIF
|
|
42803
|
-
* WS-Discovery endpoint UUID, …). Provider code keeps a
|
|
42804
|
-
* `Map<sourceInfo.id, IDevice>` to route inbound push events in O(1)
|
|
42805
|
-
* without round-tripping through `stableId` / `id` mappings.
|
|
42806
|
-
*
|
|
42807
|
-
* 2. **Stability bridge.** `uniqueId` is the *immutable* upstream id when
|
|
42808
|
-
* one exists (HA `entity.unique_id`, Reolink MAC again — same as `id`
|
|
42809
|
-
* for vendors where MAC is the natural key). For systems where the
|
|
42810
|
-
* live dispatch key can be renamed (HA `entity_id` can be edited),
|
|
42811
|
-
* providers detect renames by matching `uniqueId` and patch `id`
|
|
42812
|
-
* in-place so dispatch keeps working.
|
|
42813
|
-
*
|
|
42814
|
-
* **Display unit and precision are NOT stored here.** They are a read-time
|
|
42815
|
-
* preference (D944). A polymorphic reading stores its `quantity` here once,
|
|
42816
|
-
* at adopt, and a date/time value stores `dateTimeShape` the same way —
|
|
42817
|
-
* neither is repeated on each sample. The `device_class` tag is an
|
|
42818
|
-
* HA-specific input consumed at the discovery boundary (`ha-domain-mapping`)
|
|
42819
|
-
* to derive the CamStack `DeviceRole`; it is never stored after that point.
|
|
42820
|
-
*
|
|
42821
|
-
* The `raw` escape hatch carries provider-specific attributes that don't
|
|
42822
|
-
* fit the structured slots (HA `attributes` whitelist, Reolink `deviceCache`
|
|
42823
|
-
* details, …). Providers control what lands here.
|
|
42824
|
-
*/
|
|
42825
|
-
var SourceInfoSchema = object({
|
|
42826
|
-
/** Live dispatch key — mutable when the source system allows rename. */
|
|
42827
|
-
id: string(),
|
|
42828
|
-
/** Source system tag — e.g. 'homeassistant' | 'reolink' | 'onvif'. */
|
|
42829
|
-
system: string(),
|
|
42830
|
-
/** Immutable upstream identifier when available (HA `unique_id`, … ).
|
|
42831
|
-
* Used to detect rename when `id` changes. */
|
|
42832
|
-
uniqueId: string().optional(),
|
|
42833
|
-
/** Quantity of a polymorphic reading, written once at adopt (D944). */
|
|
42834
|
-
quantity: ReadingQuantitySchema.optional(),
|
|
42835
|
-
/** Date / time / datetime shape of a string reading, written once at adopt. */
|
|
42836
|
-
dateTimeShape: _enum([
|
|
42837
|
-
"date",
|
|
42838
|
-
"time",
|
|
42839
|
-
"datetime"
|
|
42840
|
-
]).optional(),
|
|
42841
|
-
/** Provider-specific extras that don't fit the structured slots.
|
|
42842
|
-
* Whitelist what goes here per provider — do NOT dump entire HA
|
|
42843
|
-
* attribute blobs (would explode the meta JSON column). */
|
|
42844
|
-
raw: record(string(), unknown()).optional()
|
|
42845
|
-
});
|
|
42846
|
-
/**
|
|
42847
|
-
* Build the synthetic SourceInfo every existing provider falls back to
|
|
42848
|
-
* when no upstream value has been persisted. Keeps non-migrated providers
|
|
42849
|
-
* (Reolink / Hikvision / ONVIF / RTSP) functional without code
|
|
42850
|
-
* changes — `id` reuses the CamStack stableId, `system` reuses the addon
|
|
42851
|
-
* id. Real upstream identity replaces this once a provider migrates and
|
|
42852
|
-
* calls `updateSourceInfo()` with concrete values.
|
|
42853
|
-
*/
|
|
42854
|
-
function synthesizeSourceInfo(input) {
|
|
42855
|
-
return {
|
|
42856
|
-
id: input.stableId,
|
|
42857
|
-
system: input.addonId
|
|
42858
|
-
};
|
|
42859
|
-
}
|
|
42860
|
-
/**
|
|
42861
|
-
* Shallow-merge a partial patch over a prior SourceInfo. `undefined`
|
|
42862
|
-
* patch values are ignored (no field clobber); to clear a field
|
|
42863
|
-
* explicitly, providers omit it from the patch and rebuild from scratch
|
|
42864
|
-
* via `updateSourceInfo({})` cycles — uncommon enough that we don't
|
|
42865
|
-
* bother with a `null`-means-delete sentinel.
|
|
42866
|
-
*
|
|
42867
|
-
* The `raw` field is also shallow-merged: passing `raw: { foo: 1 }`
|
|
42868
|
-
* merges over existing `raw` keys instead of replacing the whole bag.
|
|
42869
|
-
*/
|
|
42870
|
-
function mergeSourceInfo(prev, patch) {
|
|
42871
|
-
const next = { ...prev };
|
|
42872
|
-
for (const [k, v] of Object.entries(patch)) {
|
|
42873
|
-
if (v === void 0) continue;
|
|
42874
|
-
if (k === "raw" && typeof v === "object" && v !== null) {
|
|
42875
|
-
next.raw = {
|
|
42876
|
-
...prev.raw,
|
|
42877
|
-
...v
|
|
42878
|
-
};
|
|
42879
|
-
continue;
|
|
42880
|
-
}
|
|
42881
|
-
next[k] = v;
|
|
42882
|
-
}
|
|
42883
|
-
return next;
|
|
42884
|
-
}
|
|
42885
|
-
/**
|
|
42886
|
-
* Coerce common unit-of-measurement string variants to a canonical form
|
|
42887
|
-
* so the UI's display templates can rely on stable strings. Pure
|
|
42888
|
-
* passthrough for unknown units — kept conservative on purpose, the goal
|
|
42889
|
-
* is to normalise the long tail of HA `unit_of_measurement` values that
|
|
42890
|
-
* have multiple historical spellings (`'°C'` vs `'C'` vs `'celsius'`).
|
|
42891
|
-
*
|
|
42892
|
-
* Extend the map as we encounter real-world data. Returning the raw
|
|
42893
|
-
* input for unknown values is intentional: providers should never
|
|
42894
|
-
* lose information silently here.
|
|
42895
|
-
*/
|
|
42896
|
-
function normalizeUnit(raw) {
|
|
42897
|
-
if (raw == null) return void 0;
|
|
42898
|
-
const trimmed = raw.trim();
|
|
42899
|
-
if (trimmed === "") return void 0;
|
|
42900
|
-
const lower = trimmed.toLowerCase();
|
|
42901
|
-
if (lower === "°c" || lower === "c" || lower === "celsius") return "°C";
|
|
42902
|
-
if (lower === "°f" || lower === "f" || lower === "fahrenheit") return "°F";
|
|
42903
|
-
if (lower === "k" || lower === "kelvin") return "K";
|
|
42904
|
-
if (lower === "%" || lower === "percent" || lower === "percentage") return "%";
|
|
42905
|
-
if (lower === "lx" || lower === "lux") return "lx";
|
|
42906
|
-
if (lower === "hpa" || lower === "hectopascal") return "hPa";
|
|
42907
|
-
if (lower === "kpa") return "kPa";
|
|
42908
|
-
if (lower === "pa") return "Pa";
|
|
42909
|
-
if (lower === "mbar" || lower === "millibar") return "mbar";
|
|
42910
|
-
if (lower === "w" || lower === "watt") return "W";
|
|
42911
|
-
if (lower === "kw" || lower === "kilowatt") return "kW";
|
|
42912
|
-
if (lower === "wh" || lower === "watt-hour") return "Wh";
|
|
42913
|
-
if (lower === "kwh" || lower === "kilowatt-hour") return "kWh";
|
|
42914
|
-
if (lower === "v" || lower === "volt") return "V";
|
|
42915
|
-
if (lower === "a" || lower === "amp" || lower === "ampere") return "A";
|
|
42916
|
-
if (lower === "ma" || lower === "milliampere") return "mA";
|
|
42917
|
-
if (lower === "va") return "VA";
|
|
42918
|
-
if (lower === "ppm") return "ppm";
|
|
42919
|
-
if (lower === "ppb") return "ppb";
|
|
42920
|
-
if (lower === "µg/m³" || lower === "ug/m3" || lower === "µg/m3") return "µg/m³";
|
|
42921
|
-
if (lower === "km/h" || lower === "kph") return "km/h";
|
|
42922
|
-
if (lower === "mph") return "mph";
|
|
42923
|
-
if (lower === "m/s") return "m/s";
|
|
42924
|
-
if (lower === "m") return "m";
|
|
42925
|
-
if (lower === "m²" || lower === "m2") return "m²";
|
|
42926
|
-
if (lower === "mm") return "mm";
|
|
42927
|
-
if (lower === "cm") return "cm";
|
|
42928
|
-
if (lower === "km") return "km";
|
|
42929
|
-
if (lower === "in" || lower === "inch" || lower === "inches") return "in";
|
|
42930
|
-
if (lower === "ft" || lower === "foot" || lower === "feet") return "ft";
|
|
42931
|
-
if (lower === "kg") return "kg";
|
|
42932
|
-
if (lower === "g") return "g";
|
|
42933
|
-
if (lower === "l" || lower === "liter" || lower === "litre" || lower === "liters" || lower === "litres") return "L";
|
|
42934
|
-
if (lower === "ml") return "mL";
|
|
42935
|
-
if (lower === "gal" || lower === "gallon" || lower === "gallons") return "gal";
|
|
42936
|
-
if (lower === "s" || lower === "sec" || lower === "second" || lower === "seconds") return "s";
|
|
42937
|
-
if (lower === "ms") return "ms";
|
|
42938
|
-
if (lower === "min" || lower === "minute" || lower === "minutes") return "min";
|
|
42939
|
-
if (lower === "h" || lower === "hr" || lower === "hour" || lower === "hours") return "h";
|
|
42940
|
-
if (lower === "d" || lower === "day" || lower === "days") return "d";
|
|
42941
|
-
if (lower === "b" || lower === "byte" || lower === "bytes") return "B";
|
|
42942
|
-
if (lower === "kib") return "KiB";
|
|
42943
|
-
if (lower === "mib") return "MiB";
|
|
42944
|
-
if (lower === "gib") return "GiB";
|
|
42945
|
-
if (lower === "tib") return "TiB";
|
|
42946
|
-
if (lower === "kb") return "kB";
|
|
42947
|
-
if (lower === "mb") return "MB";
|
|
42948
|
-
if (lower === "gb") return "GB";
|
|
42949
|
-
if (lower === "dbm") return "dBm";
|
|
42950
|
-
if (lower === "dbfs") return "dBFS";
|
|
42951
|
-
if (lower === "inhg") return "inHg";
|
|
42952
|
-
if (lower === "mm/h" || lower === "mm/hr") return "mm/h";
|
|
42953
|
-
if (lower === "in/h" || lower === "in/hr") return "in/h";
|
|
42954
|
-
if (lower === "w/m²" || lower === "w/m2") return "W/m²";
|
|
42955
|
-
if (lower === "°" || lower === "deg" || lower === "degree" || lower === "degrees") return "°";
|
|
42956
|
-
if (lower === "kbps") return "kbps";
|
|
42957
|
-
if (lower === "fps") return "fps";
|
|
42958
|
-
return trimmed;
|
|
42959
|
-
}
|
|
42960
|
-
/**
|
|
42961
|
-
* Key under which `SourceInfo` lives inside `DeviceMeta.metadata`. The
|
|
42962
|
-
* blob is a free-form `Record<string, unknown>` shared with hardware-
|
|
42963
|
-
* identity fields (`manufacturer`, `model`, `firmware`, …); SourceInfo
|
|
42964
|
-
* lives under a single nested key to keep it composable with those.
|
|
42965
|
-
*/
|
|
42966
|
-
var SOURCE_INFO_METADATA_KEY = "sourceInfo";
|
|
42967
|
-
/**
|
|
42968
|
-
* Extract a SourceInfo from a `DeviceMeta.metadata` blob, validating
|
|
42969
|
-
* with Zod. Returns `null` when the blob is missing or the nested
|
|
42970
|
-
* `sourceInfo` key fails validation — callers fall back to the
|
|
42971
|
-
* synthetic default in that case (see `synthesizeSourceInfo`).
|
|
42972
|
-
*/
|
|
42973
|
-
function extractSourceInfoFromMetadata(metadata) {
|
|
42974
|
-
if (!metadata) return null;
|
|
42975
|
-
const raw = metadata[SOURCE_INFO_METADATA_KEY];
|
|
42976
|
-
if (!raw) return null;
|
|
42977
|
-
const parsed = SourceInfoSchema.safeParse(raw);
|
|
42978
|
-
if (!parsed.success) return null;
|
|
42979
|
-
return parsed.data;
|
|
42980
|
-
}
|
|
42981
|
-
/**
|
|
42982
|
-
* Frozen unit → spec table. `•` in the doc marks each dimension's canonical
|
|
42983
|
-
* unit (`factor: 1, offset: 0`). °F derives from `°C = (°F − 32) × 5/9` ⇒
|
|
42984
|
-
* `factor = 5/9`, `offset = -160/9` (kept as exact expressions, not rounded
|
|
42985
|
-
* decimals). K derives from `°C = K − 273.15`.
|
|
42986
|
-
*/
|
|
42987
|
-
var UNIT_TABLE = {
|
|
42988
|
-
"°C": {
|
|
42989
|
-
dimension: "temperature",
|
|
42990
|
-
factor: 1,
|
|
42991
|
-
offset: 0
|
|
42992
|
-
},
|
|
42993
|
-
"°F": {
|
|
42994
|
-
dimension: "temperature",
|
|
42995
|
-
factor: 5 / 9,
|
|
42996
|
-
offset: -160 / 9
|
|
42997
|
-
},
|
|
42998
|
-
K: {
|
|
42999
|
-
dimension: "temperature",
|
|
43000
|
-
factor: 1,
|
|
43001
|
-
offset: -273.15
|
|
43002
|
-
},
|
|
43003
|
-
hPa: {
|
|
43004
|
-
dimension: "pressure",
|
|
43005
|
-
factor: 1,
|
|
43006
|
-
offset: 0
|
|
43007
|
-
},
|
|
43008
|
-
kPa: {
|
|
43009
|
-
dimension: "pressure",
|
|
43010
|
-
factor: 10,
|
|
43011
|
-
offset: 0
|
|
43012
|
-
},
|
|
43013
|
-
Pa: {
|
|
43014
|
-
dimension: "pressure",
|
|
43015
|
-
factor: .01,
|
|
43016
|
-
offset: 0
|
|
43017
|
-
},
|
|
43018
|
-
mbar: {
|
|
43019
|
-
dimension: "pressure",
|
|
43020
|
-
factor: 1,
|
|
43021
|
-
offset: 0
|
|
43022
|
-
},
|
|
43023
|
-
bar: {
|
|
43024
|
-
dimension: "pressure",
|
|
43025
|
-
factor: 1e3,
|
|
43026
|
-
offset: 0
|
|
43027
|
-
},
|
|
43028
|
-
inHg: {
|
|
43029
|
-
dimension: "pressure",
|
|
43030
|
-
factor: 33.8639,
|
|
43031
|
-
offset: 0
|
|
43032
|
-
},
|
|
43033
|
-
mmHg: {
|
|
43034
|
-
dimension: "pressure",
|
|
43035
|
-
factor: 1.33322,
|
|
43036
|
-
offset: 0
|
|
43037
|
-
},
|
|
43038
|
-
psi: {
|
|
43039
|
-
dimension: "pressure",
|
|
43040
|
-
factor: 68.9476,
|
|
43041
|
-
offset: 0
|
|
43042
|
-
},
|
|
43043
|
-
"m/s": {
|
|
43044
|
-
dimension: "speed",
|
|
43045
|
-
factor: 1,
|
|
43046
|
-
offset: 0
|
|
43047
|
-
},
|
|
43048
|
-
"km/h": {
|
|
43049
|
-
dimension: "speed",
|
|
43050
|
-
factor: 1 / 3.6,
|
|
43051
|
-
offset: 0
|
|
43052
|
-
},
|
|
43053
|
-
mph: {
|
|
43054
|
-
dimension: "speed",
|
|
43055
|
-
factor: .44704,
|
|
43056
|
-
offset: 0
|
|
43057
|
-
},
|
|
43058
|
-
kn: {
|
|
43059
|
-
dimension: "speed",
|
|
43060
|
-
factor: .514444,
|
|
43061
|
-
offset: 0
|
|
43062
|
-
},
|
|
43063
|
-
"mm/h": {
|
|
43064
|
-
dimension: "precipitation-rate",
|
|
43065
|
-
factor: 1,
|
|
43066
|
-
offset: 0
|
|
43067
|
-
},
|
|
43068
|
-
"in/h": {
|
|
43069
|
-
dimension: "precipitation-rate",
|
|
43070
|
-
factor: 25.4,
|
|
43071
|
-
offset: 0
|
|
43072
|
-
},
|
|
43073
|
-
m: {
|
|
43074
|
-
dimension: "length",
|
|
43075
|
-
factor: 1,
|
|
43076
|
-
offset: 0
|
|
43077
|
-
},
|
|
43078
|
-
mm: {
|
|
43079
|
-
dimension: "length",
|
|
43080
|
-
factor: .001,
|
|
43081
|
-
offset: 0
|
|
43082
|
-
},
|
|
43083
|
-
cm: {
|
|
43084
|
-
dimension: "length",
|
|
43085
|
-
factor: .01,
|
|
43086
|
-
offset: 0
|
|
43087
|
-
},
|
|
43088
|
-
km: {
|
|
43089
|
-
dimension: "length",
|
|
43090
|
-
factor: 1e3,
|
|
43091
|
-
offset: 0
|
|
43092
|
-
},
|
|
43093
|
-
in: {
|
|
43094
|
-
dimension: "length",
|
|
43095
|
-
factor: .0254,
|
|
43096
|
-
offset: 0
|
|
43097
|
-
},
|
|
43098
|
-
ft: {
|
|
43099
|
-
dimension: "length",
|
|
43100
|
-
factor: .3048,
|
|
43101
|
-
offset: 0
|
|
43102
|
-
},
|
|
43103
|
-
mi: {
|
|
43104
|
-
dimension: "length",
|
|
43105
|
-
factor: 1609.344,
|
|
43106
|
-
offset: 0
|
|
43107
|
-
},
|
|
43108
|
-
"m²": {
|
|
43109
|
-
dimension: "area",
|
|
43110
|
-
factor: 1,
|
|
43111
|
-
offset: 0
|
|
43112
|
-
},
|
|
43113
|
-
lx: {
|
|
43114
|
-
dimension: "illuminance",
|
|
43115
|
-
factor: 1,
|
|
43116
|
-
offset: 0
|
|
43117
|
-
},
|
|
43118
|
-
"W/m²": {
|
|
43119
|
-
dimension: "irradiance",
|
|
43120
|
-
factor: 1,
|
|
43121
|
-
offset: 0
|
|
43122
|
-
},
|
|
43123
|
-
W: {
|
|
43124
|
-
dimension: "power",
|
|
43125
|
-
factor: 1,
|
|
43126
|
-
offset: 0
|
|
43127
|
-
},
|
|
43128
|
-
kW: {
|
|
43129
|
-
dimension: "power",
|
|
43130
|
-
factor: 1e3,
|
|
43131
|
-
offset: 0
|
|
43132
|
-
},
|
|
43133
|
-
VA: {
|
|
43134
|
-
dimension: "apparent-power",
|
|
43135
|
-
factor: 1,
|
|
43136
|
-
offset: 0
|
|
43137
|
-
},
|
|
43138
|
-
Wh: {
|
|
43139
|
-
dimension: "energy",
|
|
43140
|
-
factor: 1,
|
|
43141
|
-
offset: 0
|
|
43142
|
-
},
|
|
43143
|
-
kWh: {
|
|
43144
|
-
dimension: "energy",
|
|
43145
|
-
factor: 1e3,
|
|
43146
|
-
offset: 0
|
|
43147
|
-
},
|
|
43148
|
-
MWh: {
|
|
43149
|
-
dimension: "energy",
|
|
43150
|
-
factor: 1e6,
|
|
43151
|
-
offset: 0
|
|
43152
|
-
},
|
|
43153
|
-
V: {
|
|
43154
|
-
dimension: "voltage",
|
|
43155
|
-
factor: 1,
|
|
43156
|
-
offset: 0
|
|
43157
|
-
},
|
|
43158
|
-
mV: {
|
|
43159
|
-
dimension: "voltage",
|
|
43160
|
-
factor: .001,
|
|
43161
|
-
offset: 0
|
|
43162
|
-
},
|
|
43163
|
-
A: {
|
|
43164
|
-
dimension: "current",
|
|
43165
|
-
factor: 1,
|
|
43166
|
-
offset: 0
|
|
43167
|
-
},
|
|
43168
|
-
mA: {
|
|
43169
|
-
dimension: "current",
|
|
43170
|
-
factor: .001,
|
|
43171
|
-
offset: 0
|
|
43172
|
-
},
|
|
43173
|
-
ppm: {
|
|
43174
|
-
dimension: "concentration-volume",
|
|
43175
|
-
factor: 1,
|
|
43176
|
-
offset: 0
|
|
43177
|
-
},
|
|
43178
|
-
ppb: {
|
|
43179
|
-
dimension: "concentration-volume",
|
|
43180
|
-
factor: .001,
|
|
43181
|
-
offset: 0
|
|
43182
|
-
},
|
|
43183
|
-
"µg/m³": {
|
|
43184
|
-
dimension: "concentration-mass",
|
|
43185
|
-
factor: 1,
|
|
43186
|
-
offset: 0
|
|
43187
|
-
},
|
|
43188
|
-
"mg/m³": {
|
|
43189
|
-
dimension: "concentration-mass",
|
|
43190
|
-
factor: 1e3,
|
|
43191
|
-
offset: 0
|
|
43192
|
-
},
|
|
43193
|
-
kg: {
|
|
43194
|
-
dimension: "mass",
|
|
43195
|
-
factor: 1,
|
|
43196
|
-
offset: 0
|
|
43197
|
-
},
|
|
43198
|
-
g: {
|
|
43199
|
-
dimension: "mass",
|
|
43200
|
-
factor: .001,
|
|
43201
|
-
offset: 0
|
|
43202
|
-
},
|
|
43203
|
-
lb: {
|
|
43204
|
-
dimension: "mass",
|
|
43205
|
-
factor: .453592,
|
|
43206
|
-
offset: 0
|
|
43207
|
-
},
|
|
43208
|
-
oz: {
|
|
43209
|
-
dimension: "mass",
|
|
43210
|
-
factor: .0283495,
|
|
43211
|
-
offset: 0
|
|
43212
|
-
},
|
|
43213
|
-
"%": {
|
|
43214
|
-
dimension: "percentage",
|
|
43215
|
-
factor: 1,
|
|
43216
|
-
offset: 0
|
|
43217
|
-
},
|
|
43218
|
-
L: {
|
|
43219
|
-
dimension: "volume",
|
|
43220
|
-
factor: 1,
|
|
43221
|
-
offset: 0
|
|
43222
|
-
},
|
|
43223
|
-
mL: {
|
|
43224
|
-
dimension: "volume",
|
|
43225
|
-
factor: .001,
|
|
43226
|
-
offset: 0
|
|
43227
|
-
},
|
|
43228
|
-
gal: {
|
|
43229
|
-
dimension: "volume",
|
|
43230
|
-
factor: 3.785411784,
|
|
43231
|
-
offset: 0
|
|
43232
|
-
},
|
|
43233
|
-
s: {
|
|
43234
|
-
dimension: "duration",
|
|
43235
|
-
factor: 1,
|
|
43236
|
-
offset: 0
|
|
43237
|
-
},
|
|
43238
|
-
ms: {
|
|
43239
|
-
dimension: "duration",
|
|
43240
|
-
factor: .001,
|
|
43241
|
-
offset: 0
|
|
43242
|
-
},
|
|
43243
|
-
min: {
|
|
43244
|
-
dimension: "duration",
|
|
43245
|
-
factor: 60,
|
|
43246
|
-
offset: 0
|
|
43247
|
-
},
|
|
43248
|
-
h: {
|
|
43249
|
-
dimension: "duration",
|
|
43250
|
-
factor: 3600,
|
|
43251
|
-
offset: 0
|
|
43252
|
-
},
|
|
43253
|
-
d: {
|
|
43254
|
-
dimension: "duration",
|
|
43255
|
-
factor: 86400,
|
|
43256
|
-
offset: 0
|
|
43257
|
-
},
|
|
43258
|
-
B: {
|
|
43259
|
-
dimension: "information",
|
|
43260
|
-
factor: 1,
|
|
43261
|
-
offset: 0
|
|
43262
|
-
},
|
|
43263
|
-
KiB: {
|
|
43264
|
-
dimension: "information",
|
|
43265
|
-
factor: 1024,
|
|
43266
|
-
offset: 0
|
|
43267
|
-
},
|
|
43268
|
-
MiB: {
|
|
43269
|
-
dimension: "information",
|
|
43270
|
-
factor: 1024 ** 2,
|
|
43271
|
-
offset: 0
|
|
43272
|
-
},
|
|
43273
|
-
GiB: {
|
|
43274
|
-
dimension: "information",
|
|
43275
|
-
factor: 1024 ** 3,
|
|
43276
|
-
offset: 0
|
|
43277
|
-
},
|
|
43278
|
-
TiB: {
|
|
43279
|
-
dimension: "information",
|
|
43280
|
-
factor: 1024 ** 4,
|
|
43281
|
-
offset: 0
|
|
43282
|
-
},
|
|
43283
|
-
kB: {
|
|
43284
|
-
dimension: "information",
|
|
43285
|
-
factor: 1e3,
|
|
43286
|
-
offset: 0
|
|
43287
|
-
},
|
|
43288
|
-
MB: {
|
|
43289
|
-
dimension: "information",
|
|
43290
|
-
factor: 1e6,
|
|
43291
|
-
offset: 0
|
|
43292
|
-
},
|
|
43293
|
-
GB: {
|
|
43294
|
-
dimension: "information",
|
|
43295
|
-
factor: 1e9,
|
|
43296
|
-
offset: 0
|
|
43297
|
-
},
|
|
43298
|
-
"°": {
|
|
43299
|
-
dimension: "angle",
|
|
43300
|
-
factor: 1,
|
|
43301
|
-
offset: 0
|
|
43302
|
-
},
|
|
43303
|
-
dBFS: {
|
|
43304
|
-
dimension: "sound-level",
|
|
43305
|
-
factor: 1,
|
|
43306
|
-
offset: 0
|
|
43307
|
-
},
|
|
43308
|
-
dBm: {
|
|
43309
|
-
dimension: "signal-level",
|
|
43310
|
-
factor: 1,
|
|
43311
|
-
offset: 0
|
|
43312
|
-
},
|
|
43313
|
-
mired: {
|
|
43314
|
-
dimension: "colour-temperature",
|
|
43315
|
-
factor: 1,
|
|
43316
|
-
offset: 0
|
|
43317
|
-
},
|
|
43318
|
-
kbps: {
|
|
43319
|
-
dimension: "bitrate",
|
|
43320
|
-
factor: 1,
|
|
43321
|
-
offset: 0
|
|
43322
|
-
},
|
|
43323
|
-
Mbps: {
|
|
43324
|
-
dimension: "bitrate",
|
|
43325
|
-
factor: 1e3,
|
|
43326
|
-
offset: 0
|
|
43327
|
-
},
|
|
43328
|
-
fps: {
|
|
43329
|
-
dimension: "rate",
|
|
43330
|
-
factor: 1,
|
|
43331
|
-
offset: 0
|
|
43332
|
-
}
|
|
43333
|
-
};
|
|
43334
|
-
/** Resolve a unit's `UnitSpec`, or `undefined` when the spelling is unknown. */
|
|
43335
|
-
function specFor(unit) {
|
|
43336
|
-
return Object.hasOwn(UNIT_TABLE, unit) ? UNIT_TABLE[unit] : void 0;
|
|
43158
|
+
* The canonical kebab-case lucide id ({@link IconKey}). Spellings that a lucide
|
|
43159
|
+
* package still accepts (`home` for `house`) and this repo's own legacy ones
|
|
43160
|
+
* (`gauge2`) RESOLVE ({@link canonicalIconKey}) so a stored value never goes
|
|
43161
|
+
* stale, but they are never OFFERED by search.
|
|
43162
|
+
*
|
|
43163
|
+
* ## Search
|
|
43164
|
+
*
|
|
43165
|
+
* Over the key, the Italian/English overlay in `icon-synonyms.ts`, any words
|
|
43166
|
+
* the caller adds, and lucide's English tags — in that order of weight.
|
|
43167
|
+
*/
|
|
43168
|
+
var KEY_SET$2 = new Set(ICON_KEYS);
|
|
43169
|
+
new Map([...Object.entries(ICON_ALIASES), ...Object.entries(LEGACY_ICON_ALIASES)]);
|
|
43170
|
+
/** Is this a canonical key of the catalog? (An alias is not — see {@link canonicalIconKey}.) */
|
|
43171
|
+
function isIconKey(value) {
|
|
43172
|
+
return typeof value === "string" && KEY_SET$2.has(value);
|
|
43337
43173
|
}
|
|
43338
|
-
/**
|
|
43339
|
-
|
|
43340
|
-
|
|
43174
|
+
/**
|
|
43175
|
+
* Wire/storage schema for one icon key.
|
|
43176
|
+
*
|
|
43177
|
+
* Deliberately NOT a `z.enum` of the catalog: ~1,700 literals would be inlined
|
|
43178
|
+
* into every cap router, type and API-reference row that carries an icon. The
|
|
43179
|
+
* check is membership in the catalog and the type is {@link IconKey}.
|
|
43180
|
+
*/
|
|
43181
|
+
var IconKeySchema = custom(isIconKey, "Not an icon of the catalog");
|
|
43182
|
+
var ENTRIES = ICON_KEYS.map((key, index) => {
|
|
43183
|
+
const [categoryIndexes, tags] = ICON_META[index] ?? [[], []];
|
|
43184
|
+
const categories = categoryIndexes.flatMap((i) => {
|
|
43185
|
+
const id = ICON_CATEGORY_IDS[i];
|
|
43186
|
+
return id === void 0 ? [] : [id];
|
|
43187
|
+
});
|
|
43188
|
+
return {
|
|
43189
|
+
key,
|
|
43190
|
+
categories,
|
|
43191
|
+
primaryCategory: categories[0] ?? ICON_CATEGORY_IDS[0],
|
|
43192
|
+
tags,
|
|
43193
|
+
synonyms: ICON_SYNONYMS[key] ?? []
|
|
43194
|
+
};
|
|
43195
|
+
});
|
|
43196
|
+
new Map(ENTRIES.map((e) => [e.key, e]));
|
|
43197
|
+
/** Categories a picker offers first: the ones this product's icons mostly live in. */
|
|
43198
|
+
var LEADING_CATEGORIES = [
|
|
43199
|
+
"devices",
|
|
43200
|
+
"home",
|
|
43201
|
+
"security",
|
|
43202
|
+
"buildings",
|
|
43203
|
+
"connectivity",
|
|
43204
|
+
"multimedia",
|
|
43205
|
+
"nature",
|
|
43206
|
+
"weather",
|
|
43207
|
+
"transportation",
|
|
43208
|
+
"animals"
|
|
43209
|
+
];
|
|
43210
|
+
var PRIMARY_CATEGORIES = new Set(ENTRIES.map((e) => e.primaryCategory));
|
|
43211
|
+
[...LEADING_CATEGORIES, ...ICON_CATEGORY_IDS.filter((c) => !LEADING_CATEGORIES.includes(c))].filter((c) => PRIMARY_CATEGORIES.has(c));
|
|
43212
|
+
/**
|
|
43213
|
+
* One (location, icon) assignment as it travels.
|
|
43214
|
+
*
|
|
43215
|
+
* `locationKey` is ALWAYS {@link locationIconKey} of the label — never the
|
|
43216
|
+
* operator's casing. The registry matches labels trimmed + case-insensitively
|
|
43217
|
+
* everywhere (`addLocation`, `removeLocation`, `renameLocation`), and a
|
|
43218
|
+
* case-only rename (`kitchen` → `Kitchen`) is a real edit this repo supports; a
|
|
43219
|
+
* map keyed on the displayed casing would orphan its entry on exactly that
|
|
43220
|
+
* edit. Consumers join by keying their own label through `locationIconKey`.
|
|
43221
|
+
*/
|
|
43222
|
+
var LocationIconAssignmentSchema = object({
|
|
43223
|
+
locationKey: string(),
|
|
43224
|
+
icon: IconKeySchema
|
|
43225
|
+
});
|
|
43226
|
+
/**
|
|
43227
|
+
* One (location, description) assignment as it travels.
|
|
43228
|
+
*
|
|
43229
|
+
* Same key discipline as {@link LocationIconAssignmentSchema}, and for the same
|
|
43230
|
+
* reason: this lived for a while in the post-analysis addon's own settings,
|
|
43231
|
+
* keyed by a HAND-TYPED label matched exactly and case-sensitively. A rename in
|
|
43232
|
+
* the Locations page carried the icon and silently orphaned the description —
|
|
43233
|
+
* two authorities for one thing, joined by two different rules. Now both hang
|
|
43234
|
+
* off the location itself, on `locationIconKey`.
|
|
43235
|
+
*/
|
|
43236
|
+
var LocationDescriptionAssignmentSchema = object({
|
|
43237
|
+
locationKey: string(),
|
|
43238
|
+
description: string()
|
|
43239
|
+
});
|
|
43240
|
+
/**
|
|
43241
|
+
* WHO an action step acts on (D983) — one target shape for every place that
|
|
43242
|
+
* performs an action (automation steps, Action entries, notification
|
|
43243
|
+
* sequences, scheduler points):
|
|
43244
|
+
*
|
|
43245
|
+
* - `devices` — device ids the operator picked, frozen at save time;
|
|
43246
|
+
* - `domain` — every device that offers the step's VOCABULARY action,
|
|
43247
|
+
* optionally narrowed to one device type and one room, resolved WHEN THE
|
|
43248
|
+
* STEP RUNS (a device added later is included). The action always comes
|
|
43249
|
+
* from the vocabulary (`cover.open`), never from a raw cap name, so a
|
|
43250
|
+
* `domain` target needs an `actionId` (enforced on the step schema);
|
|
43251
|
+
* - `var` — a `$var` resolved from the run's scope.
|
|
43252
|
+
*
|
|
43253
|
+
* {@link ActionTargetResolver} turns a target into device ids. It is pure
|
|
43254
|
+
* (a {@link DeviceDirectory} is handed in) so the hub's core-blocks service and
|
|
43255
|
+
* a generated automation block share it.
|
|
43256
|
+
*
|
|
43257
|
+
* A room is the device's `location` label (`DeviceInfo.location`); two labels
|
|
43258
|
+
* name the same room when `locationIconKey` agrees (trimmed, lower-cased).
|
|
43259
|
+
*/
|
|
43260
|
+
var ActionTargetSchema = discriminatedUnion("kind", [
|
|
43261
|
+
object({
|
|
43262
|
+
kind: literal("devices"),
|
|
43263
|
+
ids: array(number().int()).min(1)
|
|
43264
|
+
}),
|
|
43265
|
+
object({
|
|
43266
|
+
kind: literal("domain"),
|
|
43267
|
+
/** Narrow to one kind of device. */
|
|
43268
|
+
deviceType: _enum(DeviceType).optional(),
|
|
43269
|
+
/** Narrow to one room: the `location` label devices carry. */
|
|
43270
|
+
roomId: string().min(1).optional()
|
|
43271
|
+
}),
|
|
43272
|
+
object({
|
|
43273
|
+
kind: literal("var"),
|
|
43274
|
+
name: string().min(1)
|
|
43275
|
+
})
|
|
43276
|
+
]);
|
|
43277
|
+
EventCategory.DeviceRegistered, EventCategory.DeviceUnregistered, EventCategory.DeviceUpdated, EventCategory.DeviceMetaChanged, EventCategory.DeviceBindingsChanged;
|
|
43278
|
+
var ExpressionBindingSourceSchema = union([
|
|
43279
|
+
object({
|
|
43280
|
+
kind: literal("field").optional(),
|
|
43281
|
+
sourceKey: string(),
|
|
43282
|
+
cap: string(),
|
|
43283
|
+
fieldPath: string()
|
|
43284
|
+
}),
|
|
43285
|
+
object({
|
|
43286
|
+
kind: literal("literal"),
|
|
43287
|
+
value: union([
|
|
43288
|
+
string(),
|
|
43289
|
+
number(),
|
|
43290
|
+
boolean(),
|
|
43291
|
+
_null()
|
|
43292
|
+
])
|
|
43293
|
+
}),
|
|
43294
|
+
object({
|
|
43295
|
+
kind: literal("global"),
|
|
43296
|
+
sourceStableId: string(),
|
|
43297
|
+
addonId: string().optional(),
|
|
43298
|
+
cap: string(),
|
|
43299
|
+
fieldPath: string()
|
|
43300
|
+
})
|
|
43301
|
+
]);
|
|
43302
|
+
object({
|
|
43303
|
+
expr: string().min(1).max(MAX_EXPRESSION_SOURCE_LENGTH),
|
|
43304
|
+
bindings: record(string().regex(EXPRESSION_IDENTIFIER_RE), ExpressionBindingSourceSchema)
|
|
43305
|
+
}).superRefine((src, ctx) => {
|
|
43306
|
+
const err = validateExpressionSource(src);
|
|
43307
|
+
if (err !== null) ctx.addIssue({
|
|
43308
|
+
code: "custom",
|
|
43309
|
+
message: err,
|
|
43310
|
+
path: ["expr"]
|
|
43311
|
+
});
|
|
43312
|
+
});
|
|
43313
|
+
/**
|
|
43314
|
+
* Identity envelope for a device's upstream-system metadata.
|
|
43315
|
+
*
|
|
43316
|
+
* Two jobs:
|
|
43317
|
+
*
|
|
43318
|
+
* 1. **Dispatch key.** `id` is the natural identifier the SOURCE system
|
|
43319
|
+
* uses to address this device (HA `entity_id`, Reolink MAC, ONVIF
|
|
43320
|
+
* WS-Discovery endpoint UUID, …). Provider code keeps a
|
|
43321
|
+
* `Map<sourceInfo.id, IDevice>` to route inbound push events in O(1)
|
|
43322
|
+
* without round-tripping through `stableId` / `id` mappings.
|
|
43323
|
+
*
|
|
43324
|
+
* 2. **Stability bridge.** `uniqueId` is the *immutable* upstream id when
|
|
43325
|
+
* one exists (HA `entity.unique_id`, Reolink MAC again — same as `id`
|
|
43326
|
+
* for vendors where MAC is the natural key). For systems where the
|
|
43327
|
+
* live dispatch key can be renamed (HA `entity_id` can be edited),
|
|
43328
|
+
* providers detect renames by matching `uniqueId` and patch `id`
|
|
43329
|
+
* in-place so dispatch keeps working.
|
|
43330
|
+
*
|
|
43331
|
+
* **Display unit and precision are NOT stored here.** They are a read-time
|
|
43332
|
+
* preference (D944). A polymorphic reading stores its `quantity` here once,
|
|
43333
|
+
* at adopt, and a date/time value stores `dateTimeShape` the same way —
|
|
43334
|
+
* neither is repeated on each sample. The `device_class` tag is an
|
|
43335
|
+
* HA-specific input consumed at the discovery boundary (`ha-domain-mapping`)
|
|
43336
|
+
* to derive the CamStack `DeviceRole`; it is never stored after that point.
|
|
43337
|
+
*
|
|
43338
|
+
* The `raw` escape hatch carries provider-specific attributes that don't
|
|
43339
|
+
* fit the structured slots (HA `attributes` whitelist, Reolink `deviceCache`
|
|
43340
|
+
* details, …). Providers control what lands here.
|
|
43341
|
+
*/
|
|
43342
|
+
var SourceInfoSchema = object({
|
|
43343
|
+
/** Live dispatch key — mutable when the source system allows rename. */
|
|
43344
|
+
id: string(),
|
|
43345
|
+
/** Source system tag — e.g. 'homeassistant' | 'reolink' | 'onvif'. */
|
|
43346
|
+
system: string(),
|
|
43347
|
+
/** Immutable upstream identifier when available (HA `unique_id`, … ).
|
|
43348
|
+
* Used to detect rename when `id` changes. */
|
|
43349
|
+
uniqueId: string().optional(),
|
|
43350
|
+
/** Quantity of a polymorphic reading, written once at adopt (D944). */
|
|
43351
|
+
quantity: ReadingQuantitySchema.optional(),
|
|
43352
|
+
/** Date / time / datetime shape of a string reading, written once at adopt. */
|
|
43353
|
+
dateTimeShape: _enum([
|
|
43354
|
+
"date",
|
|
43355
|
+
"time",
|
|
43356
|
+
"datetime"
|
|
43357
|
+
]).optional(),
|
|
43358
|
+
/** Provider-specific extras that don't fit the structured slots.
|
|
43359
|
+
* Whitelist what goes here per provider — do NOT dump entire HA
|
|
43360
|
+
* attribute blobs (would explode the meta JSON column). */
|
|
43361
|
+
raw: record(string(), unknown()).optional()
|
|
43362
|
+
});
|
|
43363
|
+
/**
|
|
43364
|
+
* Build the synthetic SourceInfo every existing provider falls back to
|
|
43365
|
+
* when no upstream value has been persisted. Keeps non-migrated providers
|
|
43366
|
+
* (Reolink / Hikvision / ONVIF / RTSP) functional without code
|
|
43367
|
+
* changes — `id` reuses the CamStack stableId, `system` reuses the addon
|
|
43368
|
+
* id. Real upstream identity replaces this once a provider migrates and
|
|
43369
|
+
* calls `updateSourceInfo()` with concrete values.
|
|
43370
|
+
*/
|
|
43371
|
+
function synthesizeSourceInfo(input) {
|
|
43372
|
+
return {
|
|
43373
|
+
id: input.stableId,
|
|
43374
|
+
system: input.addonId
|
|
43375
|
+
};
|
|
43341
43376
|
}
|
|
43342
|
-
/**
|
|
43343
|
-
|
|
43344
|
-
|
|
43377
|
+
/**
|
|
43378
|
+
* Shallow-merge a partial patch over a prior SourceInfo. `undefined`
|
|
43379
|
+
* patch values are ignored (no field clobber); to clear a field
|
|
43380
|
+
* explicitly, providers omit it from the patch and rebuild from scratch
|
|
43381
|
+
* via `updateSourceInfo({})` cycles — uncommon enough that we don't
|
|
43382
|
+
* bother with a `null`-means-delete sentinel.
|
|
43383
|
+
*
|
|
43384
|
+
* The `raw` field is also shallow-merged: passing `raw: { foo: 1 }`
|
|
43385
|
+
* merges over existing `raw` keys instead of replacing the whole bag.
|
|
43386
|
+
*/
|
|
43387
|
+
function mergeSourceInfo(prev, patch) {
|
|
43388
|
+
const next = { ...prev };
|
|
43389
|
+
for (const [k, v] of Object.entries(patch)) {
|
|
43390
|
+
if (v === void 0) continue;
|
|
43391
|
+
if (k === "raw" && typeof v === "object" && v !== null) {
|
|
43392
|
+
next.raw = {
|
|
43393
|
+
...prev.raw,
|
|
43394
|
+
...v
|
|
43395
|
+
};
|
|
43396
|
+
continue;
|
|
43397
|
+
}
|
|
43398
|
+
next[k] = v;
|
|
43399
|
+
}
|
|
43400
|
+
return next;
|
|
43345
43401
|
}
|
|
43346
|
-
/**
|
|
43347
|
-
|
|
43348
|
-
|
|
43402
|
+
/**
|
|
43403
|
+
* Coerce common unit-of-measurement string variants to a canonical form
|
|
43404
|
+
* so the UI's display templates can rely on stable strings. Pure
|
|
43405
|
+
* passthrough for unknown units — kept conservative on purpose, the goal
|
|
43406
|
+
* is to normalise the long tail of HA `unit_of_measurement` values that
|
|
43407
|
+
* have multiple historical spellings (`'°C'` vs `'C'` vs `'celsius'`).
|
|
43408
|
+
*
|
|
43409
|
+
* Extend the map as we encounter real-world data. Returning the raw
|
|
43410
|
+
* input for unknown values is intentional: providers should never
|
|
43411
|
+
* lose information silently here.
|
|
43412
|
+
*/
|
|
43413
|
+
function normalizeUnit(raw) {
|
|
43414
|
+
if (raw == null) return void 0;
|
|
43415
|
+
const trimmed = raw.trim();
|
|
43416
|
+
if (trimmed === "") return void 0;
|
|
43417
|
+
const lower = trimmed.toLowerCase();
|
|
43418
|
+
if (lower === "°c" || lower === "c" || lower === "celsius") return "°C";
|
|
43419
|
+
if (lower === "°f" || lower === "f" || lower === "fahrenheit") return "°F";
|
|
43420
|
+
if (lower === "k" || lower === "kelvin") return "K";
|
|
43421
|
+
if (lower === "%" || lower === "percent" || lower === "percentage") return "%";
|
|
43422
|
+
if (lower === "lx" || lower === "lux") return "lx";
|
|
43423
|
+
if (lower === "hpa" || lower === "hectopascal") return "hPa";
|
|
43424
|
+
if (lower === "kpa") return "kPa";
|
|
43425
|
+
if (lower === "pa") return "Pa";
|
|
43426
|
+
if (lower === "mbar" || lower === "millibar") return "mbar";
|
|
43427
|
+
if (lower === "w" || lower === "watt") return "W";
|
|
43428
|
+
if (lower === "kw" || lower === "kilowatt") return "kW";
|
|
43429
|
+
if (lower === "wh" || lower === "watt-hour") return "Wh";
|
|
43430
|
+
if (lower === "kwh" || lower === "kilowatt-hour") return "kWh";
|
|
43431
|
+
if (lower === "v" || lower === "volt") return "V";
|
|
43432
|
+
if (lower === "a" || lower === "amp" || lower === "ampere") return "A";
|
|
43433
|
+
if (lower === "ma" || lower === "milliampere") return "mA";
|
|
43434
|
+
if (lower === "va") return "VA";
|
|
43435
|
+
if (lower === "ppm") return "ppm";
|
|
43436
|
+
if (lower === "ppb") return "ppb";
|
|
43437
|
+
if (lower === "µg/m³" || lower === "ug/m3" || lower === "µg/m3") return "µg/m³";
|
|
43438
|
+
if (lower === "km/h" || lower === "kph") return "km/h";
|
|
43439
|
+
if (lower === "mph") return "mph";
|
|
43440
|
+
if (lower === "m/s") return "m/s";
|
|
43441
|
+
if (lower === "m") return "m";
|
|
43442
|
+
if (lower === "m²" || lower === "m2") return "m²";
|
|
43443
|
+
if (lower === "mm") return "mm";
|
|
43444
|
+
if (lower === "cm") return "cm";
|
|
43445
|
+
if (lower === "km") return "km";
|
|
43446
|
+
if (lower === "in" || lower === "inch" || lower === "inches") return "in";
|
|
43447
|
+
if (lower === "ft" || lower === "foot" || lower === "feet") return "ft";
|
|
43448
|
+
if (lower === "kg") return "kg";
|
|
43449
|
+
if (lower === "g") return "g";
|
|
43450
|
+
if (lower === "l" || lower === "liter" || lower === "litre" || lower === "liters" || lower === "litres") return "L";
|
|
43451
|
+
if (lower === "ml") return "mL";
|
|
43452
|
+
if (lower === "gal" || lower === "gallon" || lower === "gallons") return "gal";
|
|
43453
|
+
if (lower === "s" || lower === "sec" || lower === "second" || lower === "seconds") return "s";
|
|
43454
|
+
if (lower === "ms") return "ms";
|
|
43455
|
+
if (lower === "min" || lower === "minute" || lower === "minutes") return "min";
|
|
43456
|
+
if (lower === "h" || lower === "hr" || lower === "hour" || lower === "hours") return "h";
|
|
43457
|
+
if (lower === "d" || lower === "day" || lower === "days") return "d";
|
|
43458
|
+
if (lower === "b" || lower === "byte" || lower === "bytes") return "B";
|
|
43459
|
+
if (lower === "kib") return "KiB";
|
|
43460
|
+
if (lower === "mib") return "MiB";
|
|
43461
|
+
if (lower === "gib") return "GiB";
|
|
43462
|
+
if (lower === "tib") return "TiB";
|
|
43463
|
+
if (lower === "kb") return "kB";
|
|
43464
|
+
if (lower === "mb") return "MB";
|
|
43465
|
+
if (lower === "gb") return "GB";
|
|
43466
|
+
if (lower === "dbm") return "dBm";
|
|
43467
|
+
if (lower === "dbfs") return "dBFS";
|
|
43468
|
+
if (lower === "inhg") return "inHg";
|
|
43469
|
+
if (lower === "mm/h" || lower === "mm/hr") return "mm/h";
|
|
43470
|
+
if (lower === "in/h" || lower === "in/hr") return "in/h";
|
|
43471
|
+
if (lower === "w/m²" || lower === "w/m2") return "W/m²";
|
|
43472
|
+
if (lower === "°" || lower === "deg" || lower === "degree" || lower === "degrees") return "°";
|
|
43473
|
+
if (lower === "kbps") return "kbps";
|
|
43474
|
+
if (lower === "fps") return "fps";
|
|
43475
|
+
return trimmed;
|
|
43349
43476
|
}
|
|
43350
43477
|
/**
|
|
43351
|
-
*
|
|
43352
|
-
*
|
|
43353
|
-
*
|
|
43478
|
+
* Key under which `SourceInfo` lives inside `DeviceMeta.metadata`. The
|
|
43479
|
+
* blob is a free-form `Record<string, unknown>` shared with hardware-
|
|
43480
|
+
* identity fields (`manufacturer`, `model`, `firmware`, …); SourceInfo
|
|
43481
|
+
* lives under a single nested key to keep it composable with those.
|
|
43354
43482
|
*/
|
|
43355
|
-
|
|
43356
|
-
|
|
43357
|
-
|
|
43358
|
-
|
|
43359
|
-
|
|
43360
|
-
|
|
43361
|
-
|
|
43362
|
-
|
|
43483
|
+
var SOURCE_INFO_METADATA_KEY = "sourceInfo";
|
|
43484
|
+
/**
|
|
43485
|
+
* Extract a SourceInfo from a `DeviceMeta.metadata` blob, validating
|
|
43486
|
+
* with Zod. Returns `null` when the blob is missing or the nested
|
|
43487
|
+
* `sourceInfo` key fails validation — callers fall back to the
|
|
43488
|
+
* synthetic default in that case (see `synthesizeSourceInfo`).
|
|
43489
|
+
*/
|
|
43490
|
+
function extractSourceInfoFromMetadata(metadata) {
|
|
43491
|
+
if (!metadata) return null;
|
|
43492
|
+
const raw = metadata[SOURCE_INFO_METADATA_KEY];
|
|
43493
|
+
if (!raw) return null;
|
|
43494
|
+
const parsed = SourceInfoSchema.safeParse(raw);
|
|
43495
|
+
if (!parsed.success) return null;
|
|
43496
|
+
return parsed.data;
|
|
43363
43497
|
}
|
|
43364
43498
|
/**
|
|
43365
43499
|
* A number a person types for a physical quantity — the input side of the
|
|
@@ -45038,15 +45172,28 @@ var SettingsSchemaWithValuesSchema = object({
|
|
|
45038
45172
|
});
|
|
45039
45173
|
/** Patch object — keys are field names, values are the new field values. */
|
|
45040
45174
|
var SettingsPatchSchema = record(string(), unknown());
|
|
45175
|
+
/** The scope of a scoped-settings call (D986): where the capability declared the values. */
|
|
45176
|
+
var ScopedSettingsScopeSchema = _enum(SCOPED_SETTINGS_SCOPES);
|
|
45177
|
+
/** One scoped schema an addon serves: its capability, scope and section ids. */
|
|
45178
|
+
var ScopedSettingsDeclarationSchema = object({
|
|
45179
|
+
cap: string(),
|
|
45180
|
+
scope: ScopedSettingsScopeSchema,
|
|
45181
|
+
sectionIds: array(string())
|
|
45182
|
+
});
|
|
45041
45183
|
/** Standard success response for update operations. */
|
|
45042
45184
|
var SettingsUpdateResultSchema = object({ success: literal(true) });
|
|
45043
45185
|
method(object({
|
|
45044
45186
|
addonId: string(),
|
|
45045
|
-
|
|
45046
|
-
|
|
45047
|
-
|
|
45187
|
+
cap: string(),
|
|
45188
|
+
scope: ScopedSettingsScopeSchema,
|
|
45189
|
+
nodeId: string().optional()
|
|
45048
45190
|
}), SettingsSchemaWithValuesSchema.nullable()), method(object({
|
|
45049
45191
|
addonId: string(),
|
|
45192
|
+
nodeId: string().optional()
|
|
45193
|
+
}), array(ScopedSettingsDeclarationSchema).nullable()), method(object({
|
|
45194
|
+
addonId: string(),
|
|
45195
|
+
cap: string(),
|
|
45196
|
+
scope: ScopedSettingsScopeSchema,
|
|
45050
45197
|
nodeId: string().optional(),
|
|
45051
45198
|
patch: SettingsPatchSchema
|
|
45052
45199
|
}), SettingsUpdateResultSchema, {
|
|
@@ -45054,8 +45201,10 @@ method(object({
|
|
|
45054
45201
|
auth: "admin"
|
|
45055
45202
|
}), method(object({
|
|
45056
45203
|
addonId: string(),
|
|
45204
|
+
cap: string(),
|
|
45205
|
+
scope: ScopedSettingsScopeSchema,
|
|
45057
45206
|
nodeId: string().optional()
|
|
45058
|
-
}),
|
|
45207
|
+
}), record(string(), unknown()).nullable()), method(object({
|
|
45059
45208
|
addonId: string(),
|
|
45060
45209
|
nodeId: string().optional(),
|
|
45061
45210
|
instance: IntegrationInstanceRefSchema
|
|
@@ -46618,7 +46767,7 @@ var BackupDestinationInfoSchema = object({
|
|
|
46618
46767
|
id: string(),
|
|
46619
46768
|
/**
|
|
46620
46769
|
* Manifest id of the owning addon. The Settings button on the
|
|
46621
|
-
* destination card opens that addon's
|
|
46770
|
+
* destination card opens that addon's scoped settings panel.
|
|
46622
46771
|
*/
|
|
46623
46772
|
addonId: string(),
|
|
46624
46773
|
/** Operator-toggled enable flag from the destination-policy table. */
|
|
@@ -50032,7 +50181,7 @@ var mediaPlayerCapability = {
|
|
|
50032
50181
|
isMuted: { kind: "boolean" }
|
|
50033
50182
|
} }
|
|
50034
50183
|
};
|
|
50035
|
-
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;
|
|
50184
|
+
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;
|
|
50036
50185
|
var NUMBER = {
|
|
50037
50186
|
kind: "fixed",
|
|
50038
50187
|
result: ["number"]
|
|
@@ -52071,6 +52220,7 @@ method(InstancePinSchema, DeviceExportStatusSchema), method(_void(), array(Expor
|
|
|
52071
52220
|
kind: "mutation",
|
|
52072
52221
|
auth: "admin"
|
|
52073
52222
|
});
|
|
52223
|
+
var DeviceAliasSchema = string().max(64).regex(/^[a-z][a-z0-9_]*$/);
|
|
52074
52224
|
/**
|
|
52075
52225
|
* A SITE ZONE — a named part of the property that several locations belong to.
|
|
52076
52226
|
*
|
|
@@ -52557,6 +52707,12 @@ var DeviceInfoSchema = object({
|
|
|
52557
52707
|
addonId: string(),
|
|
52558
52708
|
type: _enum(DeviceType),
|
|
52559
52709
|
name: string(),
|
|
52710
|
+
/** The name a value template uses for this device (`{{ stufa_veranda.temperature }}`),
|
|
52711
|
+
* entity_id style. Generated once from the name at first registration, unique
|
|
52712
|
+
* cluster-wide, editable through `setAlias`, NOT changed by a rename (D1021).
|
|
52713
|
+
* Optional: a record produced by an older build omits it until the boot
|
|
52714
|
+
* backfill has run. */
|
|
52715
|
+
alias: DeviceAliasSchema.optional(),
|
|
52560
52716
|
/** Operator-organisational location label. `null` when unset. */
|
|
52561
52717
|
location: string().nullable(),
|
|
52562
52718
|
/** Soft-disabled flag. */
|
|
@@ -52876,6 +53032,25 @@ method(object({
|
|
|
52876
53032
|
}), _void(), {
|
|
52877
53033
|
kind: "mutation",
|
|
52878
53034
|
auth: "admin"
|
|
53035
|
+
}), method(object({
|
|
53036
|
+
deviceId: number(),
|
|
53037
|
+
alias: string()
|
|
53038
|
+
}), discriminatedUnion("ok", [object({
|
|
53039
|
+
ok: literal(true),
|
|
53040
|
+
alias: DeviceAliasSchema
|
|
53041
|
+
}), object({
|
|
53042
|
+
ok: literal(false),
|
|
53043
|
+
reason: _enum([
|
|
53044
|
+
"empty",
|
|
53045
|
+
"too-long",
|
|
53046
|
+
"grammar",
|
|
53047
|
+
"reserved",
|
|
53048
|
+
"taken"
|
|
53049
|
+
]),
|
|
53050
|
+
takenBy: number().optional()
|
|
53051
|
+
})]), {
|
|
53052
|
+
kind: "mutation",
|
|
53053
|
+
auth: "admin"
|
|
52879
53054
|
}), method(object({
|
|
52880
53055
|
deviceId: number(),
|
|
52881
53056
|
location: string().nullable()
|
|
@@ -56585,7 +56760,7 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
|
|
|
56585
56760
|
* or the redaction token KEEPS the stored secret; `{ $secretClear: true }`
|
|
56586
56761
|
* clears it.
|
|
56587
56762
|
*/
|
|
56588
|
-
var ConfigSchemaPassthrough$
|
|
56763
|
+
var ConfigSchemaPassthrough$2 = custom();
|
|
56589
56764
|
var IntegrationInstanceIdSchema = string().min(1);
|
|
56590
56765
|
var IntegrationInstanceModeSchema = _enum(["single", "multiple"]);
|
|
56591
56766
|
/**
|
|
@@ -56631,7 +56806,16 @@ var IntegrationInstanceKindSchema = object({
|
|
|
56631
56806
|
/** Relative hub path to start an interactive account link of an instance of this kind. */
|
|
56632
56807
|
connectPath: string().min(1).optional(),
|
|
56633
56808
|
/** Relative hub path to disconnect that account. */
|
|
56634
|
-
disconnectPath: string().min(1).optional()
|
|
56809
|
+
disconnectPath: string().min(1).optional(),
|
|
56810
|
+
/**
|
|
56811
|
+
* Parts of the edit dialog the flat form cannot draw (a node picker, a model source), named by a
|
|
56812
|
+
* GENERIC widget id the client maps to a component; a client that knows none of them shows none.
|
|
56813
|
+
* `connection` widgets write connection values, `model` widgets own the model choice.
|
|
56814
|
+
*/
|
|
56815
|
+
widgets: array(object({
|
|
56816
|
+
id: string().min(1),
|
|
56817
|
+
placement: _enum(["connection", "model"])
|
|
56818
|
+
})).optional()
|
|
56635
56819
|
});
|
|
56636
56820
|
/**
|
|
56637
56821
|
* How devices of an instance are found. `none`: the operator adds them by hand; `lan`: the addon
|
|
@@ -56672,10 +56856,11 @@ var IntegrationInstanceDescriptionSchema = object({
|
|
|
56672
56856
|
/** True when `testInstance` really probes the remote. */
|
|
56673
56857
|
canTest: boolean(),
|
|
56674
56858
|
/**
|
|
56675
|
-
* The kinds an instance can be of
|
|
56676
|
-
* Add flow asks which first and sends it as
|
|
56859
|
+
* The kinds an instance can be of (D1013 rule 1), each naming its `functionCap`. One entry:
|
|
56860
|
+
* nothing to choose; more than one: the Add flow asks which first and sends it as
|
|
56861
|
+
* `createInstance.kind`. Never empty: every instance belongs to exactly one kind.
|
|
56677
56862
|
*/
|
|
56678
|
-
kinds: array(IntegrationInstanceKindSchema).
|
|
56863
|
+
kinds: array(IntegrationInstanceKindSchema).min(1),
|
|
56679
56864
|
/**
|
|
56680
56865
|
* The provider accepts `createInstance.id` for an id that once existed (an adopted id, because
|
|
56681
56866
|
* devices carry it). The UI then offers "restore under its old id" on Add. Absent means no.
|
|
@@ -56711,8 +56896,8 @@ var IntegrationInstanceSchema = object({
|
|
|
56711
56896
|
* the body is the one store, `setInstanceEnabled` the one writer (epic #440, step 3).
|
|
56712
56897
|
*/
|
|
56713
56898
|
enabled: boolean().optional(),
|
|
56714
|
-
/** The kind of this instance
|
|
56715
|
-
kind: string().
|
|
56899
|
+
/** The kind of this instance: exactly one of `describe().kinds[].id` (D1013 rule 2). */
|
|
56900
|
+
kind: string().min(1),
|
|
56716
56901
|
/** Values for the instance form; a secret is a `SecretFieldView`, never text. */
|
|
56717
56902
|
formValues: record(string(), unknown()),
|
|
56718
56903
|
status: IntegrationInstanceStatusSchema.optional(),
|
|
@@ -56736,7 +56921,7 @@ var integrationInstancesCapability = {
|
|
|
56736
56921
|
id: IntegrationInstanceIdSchema.nullable(),
|
|
56737
56922
|
/** The kind of the create form (`id: null`) of a provider with several. */
|
|
56738
56923
|
kind: string().min(1).optional()
|
|
56739
|
-
}), ConfigSchemaPassthrough$
|
|
56924
|
+
}), ConfigSchemaPassthrough$2, { auth: "admin" }),
|
|
56740
56925
|
listInstances: method(_void(), array(IntegrationInstanceSchema).readonly(), { auth: "admin" }),
|
|
56741
56926
|
getInstance: method(object({ id: IntegrationInstanceIdSchema }), IntegrationInstanceSchema.nullable(), { auth: "admin" }),
|
|
56742
56927
|
/**
|
|
@@ -57838,12 +58023,12 @@ var LlmModelInfoSchema = object({
|
|
|
57838
58023
|
});
|
|
57839
58024
|
/**
|
|
57840
58025
|
* The provider-specific part of a profile, validated by the provider that owns
|
|
57841
|
-
* the kind (
|
|
58026
|
+
* the kind (saving an instance refuses what it does not accept). A field its
|
|
57842
58027
|
* `connectionSchema` declares `type: 'password'` is a secret: it is held in the
|
|
57843
58028
|
* keychain, never in the row, and reads back as the redaction marker.
|
|
57844
58029
|
*/
|
|
57845
58030
|
var LlmProviderConfigSchema = record(string(), unknown());
|
|
57846
|
-
|
|
58031
|
+
object({
|
|
57847
58032
|
id: string(),
|
|
57848
58033
|
name: string(),
|
|
57849
58034
|
/** The provider-declared kind (`LlmProfileKindDescriptor.kind`). */
|
|
@@ -57937,8 +58122,8 @@ var LlmProviderWidgetSchema = object({
|
|
|
57937
58122
|
/** ConfigUISchema tree passed through untyped on the wire (the
|
|
57938
58123
|
* notification-output `ConfigSchemaPassthrough` precedent at
|
|
57939
58124
|
* notification-output.cap.ts:151); the exported TS type re-tightens it. */
|
|
57940
|
-
var ConfigSchemaPassthrough$
|
|
57941
|
-
|
|
58125
|
+
var ConfigSchemaPassthrough$1 = unknown();
|
|
58126
|
+
object({
|
|
57942
58127
|
kind: LlmProfileKindSchema,
|
|
57943
58128
|
label: string(),
|
|
57944
58129
|
/** A generic icon name (`cloud`, `plug`, `cpu`) — never a glyph or a logo. */
|
|
@@ -57946,9 +58131,9 @@ var LlmProfileKindDescriptorSchema = object({
|
|
|
57946
58131
|
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
57947
58132
|
addonId: string(),
|
|
57948
58133
|
/** The provider's own fields (`providerConfig`); `password` fields are keychain-held. */
|
|
57949
|
-
connectionSchema: ConfigSchemaPassthrough$
|
|
58134
|
+
connectionSchema: ConfigSchemaPassthrough$1,
|
|
57950
58135
|
/** Provider fields that belong under "Advanced" (extra headers, runtime tuning). */
|
|
57951
|
-
advancedSchema: ConfigSchemaPassthrough$
|
|
58136
|
+
advancedSchema: ConfigSchemaPassthrough$1.optional(),
|
|
57952
58137
|
/** The kind's defaults; a model from `listModels` may override any of them. */
|
|
57953
58138
|
features: LlmModelFeaturesSchema,
|
|
57954
58139
|
/** `false` = the provider stamps `supportsVision` itself (from what a node reports). */
|
|
@@ -58077,20 +58262,7 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
|
|
|
58077
58262
|
}), method(object({
|
|
58078
58263
|
addonId: string().optional(),
|
|
58079
58264
|
requestId: string()
|
|
58080
|
-
}), _void(), { kind: "mutation" }), method(
|
|
58081
|
-
kind: "mutation",
|
|
58082
|
-
auth: "admin"
|
|
58083
|
-
}), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
|
|
58084
|
-
kind: "mutation",
|
|
58085
|
-
auth: "admin"
|
|
58086
|
-
}), method(ProfileRefInputSchema, _void(), {
|
|
58087
|
-
kind: "mutation",
|
|
58088
|
-
auth: "admin"
|
|
58089
|
-
}), method(ProfileRefInputSchema, LlmGenerateResultSchema, {
|
|
58090
|
-
kind: "mutation",
|
|
58091
|
-
auth: "admin",
|
|
58092
|
-
timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
|
|
58093
|
-
}), method(LlmListModelsInputSchema, LlmListModelsResultSchema, {
|
|
58265
|
+
}), _void(), { kind: "mutation" }), method(LlmListModelsInputSchema, LlmListModelsResultSchema, {
|
|
58094
58266
|
kind: "mutation",
|
|
58095
58267
|
auth: "admin"
|
|
58096
58268
|
}), method(object({}), array(LlmDefaultSchema)), method(object({
|
|
@@ -59153,20 +59325,7 @@ method(_void(), MeshStatusSchema), method(object({
|
|
|
59153
59325
|
/** Optional hostname override the host should advertise once joined. */
|
|
59154
59326
|
hostname: string().optional() }), object({
|
|
59155
59327
|
/** Authentication URL the operator should open in a browser. */
|
|
59156
|
-
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() }))
|
|
59157
|
-
/** Optional auth key — when provided, probes the key validity
|
|
59158
|
-
* against the provider's API. Omit when already joined to
|
|
59159
|
-
* just ping the daemon. */
|
|
59160
|
-
authKey: string().optional() }), object({
|
|
59161
|
-
ok: boolean(),
|
|
59162
|
-
/** Provider-side identifier resolved by the probe (tailnet
|
|
59163
|
-
* name for Tailscale, network id for ZeroTier, etc.). */
|
|
59164
|
-
tenant: string().optional(),
|
|
59165
|
-
/** Daemon binary version, when reachable. */
|
|
59166
|
-
daemonVersion: string().optional(),
|
|
59167
|
-
/** Human-readable error when `ok: false`. */
|
|
59168
|
-
error: string().optional()
|
|
59169
|
-
}), { kind: "mutation" });
|
|
59328
|
+
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() }));
|
|
59170
59329
|
/**
|
|
59171
59330
|
* A monotonic total between resets (D944). Energy uses `power-meter.energy`
|
|
59172
59331
|
* so dashboards keep one series; every other instantaneous reading lands here.
|
|
@@ -66993,6 +67152,11 @@ var NcScheduleSchema = object({
|
|
|
66993
67152
|
* as a STATE SUMMARY at the end of each window of `schedule`.
|
|
66994
67153
|
*/
|
|
66995
67154
|
var NcSystemEventDeliveryModeSchema = _enum(["instant", "summary"]);
|
|
67155
|
+
_enum([
|
|
67156
|
+
"activation",
|
|
67157
|
+
"deactivation",
|
|
67158
|
+
"schedule"
|
|
67159
|
+
]);
|
|
66996
67160
|
/**
|
|
66997
67161
|
* How a summary window is SENT (D698): `rule` (absent) = ONE notification with
|
|
66998
67162
|
* every section; `section` = one notification per section with something to
|
|
@@ -67009,11 +67173,26 @@ var NcStateSummarySplitSchema = _enum(["rule", "section"]);
|
|
|
67009
67173
|
* midnight crossing); the send time is each window's END. Refused on the
|
|
67010
67174
|
* `alarm` family, which stays instant (`systemEventDeliveryProblems`).
|
|
67011
67175
|
*/
|
|
67012
|
-
var NcSystemEventDeliverySchema = discriminatedUnion("mode", [
|
|
67013
|
-
mode: literal("
|
|
67014
|
-
|
|
67015
|
-
|
|
67016
|
-
|
|
67176
|
+
var NcSystemEventDeliverySchema = discriminatedUnion("mode", [
|
|
67177
|
+
object({ mode: literal("instant") }),
|
|
67178
|
+
object({
|
|
67179
|
+
mode: literal("summary"),
|
|
67180
|
+
schedule: NcScheduleSchema,
|
|
67181
|
+
split: NcStateSummarySplitSchema.optional()
|
|
67182
|
+
}),
|
|
67183
|
+
object({
|
|
67184
|
+
mode: literal("modes"),
|
|
67185
|
+
/** The bad edge, and every kind that has a single edge. */
|
|
67186
|
+
onActivation: boolean(),
|
|
67187
|
+
/** The recovery edges of the classes of the selected kinds (derived, never stored per kind). */
|
|
67188
|
+
onDeactivation: boolean(),
|
|
67189
|
+
/** A state summary at the end of each window; absent = no summary. */
|
|
67190
|
+
onSchedule: object({
|
|
67191
|
+
schedule: NcScheduleSchema,
|
|
67192
|
+
grouping: NcStateSummarySplitSchema
|
|
67193
|
+
}).optional()
|
|
67194
|
+
})
|
|
67195
|
+
]);
|
|
67017
67196
|
/** Fuzzy plate matcher — OCR noise makes exact match useless (spec row 12/13). */
|
|
67018
67197
|
var NcPlateMatcherSchema = object({
|
|
67019
67198
|
/**
|
|
@@ -69373,61 +69552,6 @@ var OauthIntegrationDescriptorSchema = object({
|
|
|
69373
69552
|
});
|
|
69374
69553
|
method(_void(), OauthIntegrationDescriptorSchema, { auth: "admin" });
|
|
69375
69554
|
/**
|
|
69376
|
-
* `oidc-connections` — CRUD for IdP rows under `auth-oidc` (D828 sibling).
|
|
69377
|
-
*
|
|
69378
|
-
* One hub-only singleton (`auth-oidc`). The Settings UI is a DataTable +
|
|
69379
|
-
* ItemFormDialog; there is no `editable-array` in `globalSettingsSchema`.
|
|
69380
|
-
* Operator-chosen `id` is the URL slug (`/addon/auth-oidc/<id>/…`) and is
|
|
69381
|
-
* immutable after create.
|
|
69382
|
-
*/
|
|
69383
|
-
var ConfigSchemaPassthrough$1 = unknown();
|
|
69384
|
-
var OidcConnectionSchema = object({
|
|
69385
|
-
id: string().min(1),
|
|
69386
|
-
displayName: string(),
|
|
69387
|
-
icon: string(),
|
|
69388
|
-
issuerUrl: string(),
|
|
69389
|
-
clientId: string(),
|
|
69390
|
-
/** Client id + secret present — never the secret value. */
|
|
69391
|
-
configured: boolean(),
|
|
69392
|
-
/**
|
|
69393
|
-
* Values for the connection form schema. `clientSecret` is a keychain
|
|
69394
|
-
* {@link SecretFieldView} or `null` / `''`, never plaintext (D789).
|
|
69395
|
-
*/
|
|
69396
|
-
formValues: record(string(), unknown()).optional()
|
|
69397
|
-
});
|
|
69398
|
-
/**
|
|
69399
|
-
* Patch one connection. Omitted or empty `clientSecret` keeps the stored
|
|
69400
|
-
* secret (D787). `{ $secretClear: true }` clears it. `id` is never renamed.
|
|
69401
|
-
*/
|
|
69402
|
-
var OidcConnectionUpdateInputSchema = object({
|
|
69403
|
-
id: string().min(1),
|
|
69404
|
-
displayName: string().min(1),
|
|
69405
|
-
icon: string().optional(),
|
|
69406
|
-
issuerUrl: string().optional(),
|
|
69407
|
-
clientId: string().optional(),
|
|
69408
|
-
clientSecret: union([string(), object({ $secretClear: literal(true) })]).optional(),
|
|
69409
|
-
redirectUri: string().optional(),
|
|
69410
|
-
scopes: string().optional(),
|
|
69411
|
-
usernameClaim: _enum([
|
|
69412
|
-
"preferred_username",
|
|
69413
|
-
"email",
|
|
69414
|
-
"sub"
|
|
69415
|
-
]).optional()
|
|
69416
|
-
});
|
|
69417
|
-
method(object({}), ConfigSchemaPassthrough$1, { auth: "admin" }), method(object({}), array(OidcConnectionSchema).readonly(), { auth: "admin" }), method(object({
|
|
69418
|
-
id: string().min(1).regex(/^[a-z0-9][a-z0-9-]{0,63}$/, "id must be a lowercase slug"),
|
|
69419
|
-
displayName: string().min(1)
|
|
69420
|
-
}), object({ id: string() }), {
|
|
69421
|
-
kind: "mutation",
|
|
69422
|
-
auth: "admin"
|
|
69423
|
-
}), method(OidcConnectionUpdateInputSchema, object({ ok: literal(true) }), {
|
|
69424
|
-
kind: "mutation",
|
|
69425
|
-
auth: "admin"
|
|
69426
|
-
}), method(object({ id: string().min(1) }), object({ ok: literal(true) }), {
|
|
69427
|
-
kind: "mutation",
|
|
69428
|
-
auth: "admin"
|
|
69429
|
-
});
|
|
69430
|
-
/**
|
|
69431
69555
|
* Generic on-screen-display (video overlay) cap. Each camera exposes
|
|
69432
69556
|
* a firmware-defined list of overlays (channel name, timestamp,
|
|
69433
69557
|
* watermark, logo, …); the cap models them as a homogeneous array of
|
|
@@ -75142,6 +75266,16 @@ var RemoteLayoutComponentSchema = object({
|
|
|
75142
75266
|
method(object({}), array(RemoteLayoutComponentSchema), { auth: "protected" });
|
|
75143
75267
|
var RUNNING_POWER_START_DELAY_MS = 3e4;
|
|
75144
75268
|
var RUNNING_POWER_STOP_DELAY_MS = 18e4;
|
|
75269
|
+
/**
|
|
75270
|
+
* Per-type overrides of the dwell defaults. A media player draws power the
|
|
75271
|
+
* moment it is on and stops drawing the moment it is off, so it needs neither
|
|
75272
|
+
* a long dwell nor a second sample. A type absent here keeps the global values.
|
|
75273
|
+
*/
|
|
75274
|
+
var RUNNING_POWER_DEFAULTS_BY_TYPE = { [DeviceType.MediaPlayer]: {
|
|
75275
|
+
startDwellMs: 1e4,
|
|
75276
|
+
stopDwellMs: 1e4,
|
|
75277
|
+
minSamples: 1
|
|
75278
|
+
} };
|
|
75145
75279
|
var RunningStateSourceSchema = _enum(["native", "assigned"]);
|
|
75146
75280
|
var RunningStateStatusSchema = object({
|
|
75147
75281
|
/** null = unknown — never coerced to false (D393). */
|
|
@@ -75159,93 +75293,27 @@ var RunningFlipEventDataSchema = object({
|
|
|
75159
75293
|
phase: string().nullable()
|
|
75160
75294
|
});
|
|
75161
75295
|
var RUNNING_DEVICE_TYPES = Object.values(DeviceType);
|
|
75162
|
-
/**
|
|
75163
|
-
|
|
75164
|
-
|
|
75165
|
-
|
|
75166
|
-
|
|
75167
|
-
|
|
75168
|
-
|
|
75169
|
-
|
|
75170
|
-
|
|
75171
|
-
|
|
75172
|
-
|
|
75173
|
-
|
|
75174
|
-
|
|
75175
|
-
|
|
75176
|
-
|
|
75177
|
-
|
|
75178
|
-
|
|
75179
|
-
|
|
75180
|
-
|
|
75181
|
-
|
|
75182
|
-
|
|
75183
|
-
DeviceType.WaterHeater,
|
|
75184
|
-
DeviceType.Humidifier,
|
|
75185
|
-
DeviceType.Fan,
|
|
75186
|
-
DeviceType.Climate,
|
|
75187
|
-
DeviceType.Thermostat,
|
|
75188
|
-
DeviceType.PetFeeder,
|
|
75189
|
-
DeviceType.Heater
|
|
75190
|
-
],
|
|
75191
|
-
apply: "add",
|
|
75192
|
-
path: "running",
|
|
75193
|
-
sources: [
|
|
75194
|
-
{
|
|
75195
|
-
kind: "switch",
|
|
75196
|
-
transforms: [{ kind: "identity" }]
|
|
75197
|
-
},
|
|
75198
|
-
{
|
|
75199
|
-
kind: "binary",
|
|
75200
|
-
transforms: [{ kind: "identity" }, { kind: "invert" }]
|
|
75201
|
-
},
|
|
75202
|
-
{
|
|
75203
|
-
kind: "numeric",
|
|
75204
|
-
requiredUnit: "W",
|
|
75205
|
-
transforms: [{
|
|
75206
|
-
kind: "threshold",
|
|
75207
|
-
comparisons: ["gte", "lte"],
|
|
75208
|
-
comparison: "gte",
|
|
75209
|
-
defaultThreshold: 5,
|
|
75210
|
-
defaultStartDwellMs: RUNNING_POWER_START_DELAY_MS,
|
|
75211
|
-
defaultStopDwellMs: RUNNING_POWER_STOP_DELAY_MS,
|
|
75212
|
-
thresholdUnit: "W"
|
|
75213
|
-
}]
|
|
75214
|
-
}
|
|
75215
|
-
],
|
|
75216
|
-
companions: [
|
|
75217
|
-
{
|
|
75218
|
-
kind: "constant",
|
|
75219
|
-
path: "source",
|
|
75220
|
-
value: "assigned",
|
|
75221
|
-
when: "always"
|
|
75222
|
-
},
|
|
75223
|
-
{
|
|
75224
|
-
kind: "constant",
|
|
75225
|
-
path: "phase",
|
|
75226
|
-
value: null,
|
|
75227
|
-
when: "add"
|
|
75228
|
-
},
|
|
75229
|
-
{
|
|
75230
|
-
kind: "clock",
|
|
75231
|
-
path: "lastFetchedAt",
|
|
75232
|
-
when: "always"
|
|
75233
|
-
},
|
|
75234
|
-
{
|
|
75235
|
-
kind: "transition-time",
|
|
75236
|
-
path: "since",
|
|
75237
|
-
sourceChangedAt: "prefer"
|
|
75238
|
-
}
|
|
75239
|
-
],
|
|
75240
|
-
sourceReport: {
|
|
75241
|
-
status: "assignment-status",
|
|
75242
|
-
runtimeField: "source",
|
|
75243
|
-
nativeValue: "native",
|
|
75244
|
-
assignedValue: "assigned"
|
|
75245
|
-
},
|
|
75246
|
-
advancedExpression: true
|
|
75247
|
-
}]
|
|
75248
|
-
};
|
|
75296
|
+
/**
|
|
75297
|
+
* Customize offers "running" only where a job makes sense (D933): a cycle,
|
|
75298
|
+
* a clean, a mow, playback, or another appliance that is on and working.
|
|
75299
|
+
* The cap itself stays on every type — a camera can still report running
|
|
75300
|
+
* natively; it just has no card.
|
|
75301
|
+
*/
|
|
75302
|
+
var RUNNING_CUSTOMIZE_DEVICE_TYPES = [
|
|
75303
|
+
DeviceType.Washer,
|
|
75304
|
+
DeviceType.Dryer,
|
|
75305
|
+
DeviceType.Dishwasher,
|
|
75306
|
+
DeviceType.Vacuum,
|
|
75307
|
+
DeviceType.LawnMower,
|
|
75308
|
+
DeviceType.MediaPlayer,
|
|
75309
|
+
DeviceType.WaterHeater,
|
|
75310
|
+
DeviceType.Humidifier,
|
|
75311
|
+
DeviceType.Fan,
|
|
75312
|
+
DeviceType.Climate,
|
|
75313
|
+
DeviceType.Thermostat,
|
|
75314
|
+
DeviceType.PetFeeder,
|
|
75315
|
+
DeviceType.Heater
|
|
75316
|
+
];
|
|
75249
75317
|
var runningStateCapability = {
|
|
75250
75318
|
name: "running-state",
|
|
75251
75319
|
scope: "device",
|
|
@@ -75265,7 +75333,79 @@ var runningStateCapability = {
|
|
|
75265
75333
|
durability: "restored",
|
|
75266
75334
|
history: { fields: { running: { kind: "boolean" } } },
|
|
75267
75335
|
volatileStateFields: ["lastFetchedAt"],
|
|
75268
|
-
customize:
|
|
75336
|
+
customize: {
|
|
75337
|
+
version: 1,
|
|
75338
|
+
overridable: [{
|
|
75339
|
+
path: "running",
|
|
75340
|
+
by: "running"
|
|
75341
|
+
}],
|
|
75342
|
+
targets: [{
|
|
75343
|
+
id: "running",
|
|
75344
|
+
cardinality: "scalar",
|
|
75345
|
+
vocabulary: {
|
|
75346
|
+
cap: "running-state",
|
|
75347
|
+
stateField: "running"
|
|
75348
|
+
},
|
|
75349
|
+
deviceTypes: RUNNING_CUSTOMIZE_DEVICE_TYPES,
|
|
75350
|
+
apply: "add",
|
|
75351
|
+
path: "running",
|
|
75352
|
+
sources: [
|
|
75353
|
+
{
|
|
75354
|
+
kind: "switch",
|
|
75355
|
+
transforms: [{ kind: "identity" }]
|
|
75356
|
+
},
|
|
75357
|
+
{
|
|
75358
|
+
kind: "binary",
|
|
75359
|
+
transforms: [{ kind: "identity" }, { kind: "invert" }]
|
|
75360
|
+
},
|
|
75361
|
+
{
|
|
75362
|
+
kind: "numeric",
|
|
75363
|
+
requiredUnit: "W",
|
|
75364
|
+
transforms: [{
|
|
75365
|
+
kind: "threshold",
|
|
75366
|
+
comparisons: ["gte", "lte"],
|
|
75367
|
+
comparison: "gte",
|
|
75368
|
+
defaultThreshold: 5,
|
|
75369
|
+
defaultStartDwellMs: RUNNING_POWER_START_DELAY_MS,
|
|
75370
|
+
defaultStopDwellMs: RUNNING_POWER_STOP_DELAY_MS,
|
|
75371
|
+
deviceTypeDefaults: RUNNING_POWER_DEFAULTS_BY_TYPE,
|
|
75372
|
+
thresholdUnit: "W"
|
|
75373
|
+
}]
|
|
75374
|
+
}
|
|
75375
|
+
],
|
|
75376
|
+
companions: [
|
|
75377
|
+
{
|
|
75378
|
+
kind: "constant",
|
|
75379
|
+
path: "source",
|
|
75380
|
+
value: "assigned",
|
|
75381
|
+
when: "always"
|
|
75382
|
+
},
|
|
75383
|
+
{
|
|
75384
|
+
kind: "constant",
|
|
75385
|
+
path: "phase",
|
|
75386
|
+
value: null,
|
|
75387
|
+
when: "add"
|
|
75388
|
+
},
|
|
75389
|
+
{
|
|
75390
|
+
kind: "clock",
|
|
75391
|
+
path: "lastFetchedAt",
|
|
75392
|
+
when: "always"
|
|
75393
|
+
},
|
|
75394
|
+
{
|
|
75395
|
+
kind: "transition-time",
|
|
75396
|
+
path: "since",
|
|
75397
|
+
sourceChangedAt: "prefer"
|
|
75398
|
+
}
|
|
75399
|
+
],
|
|
75400
|
+
sourceReport: {
|
|
75401
|
+
status: "assignment-status",
|
|
75402
|
+
runtimeField: "source",
|
|
75403
|
+
nativeValue: "native",
|
|
75404
|
+
assignedValue: "assigned"
|
|
75405
|
+
},
|
|
75406
|
+
advancedExpression: true
|
|
75407
|
+
}]
|
|
75408
|
+
}
|
|
75269
75409
|
};
|
|
75270
75410
|
/**
|
|
75271
75411
|
* scene-monitor — device-scoped reference-region state cap. An operator marks
|
|
@@ -76509,21 +76649,6 @@ method(object({
|
|
|
76509
76649
|
*/
|
|
76510
76650
|
ttlSec: union([number().int().positive(), literal("never")]).optional()
|
|
76511
76651
|
}), object({ token: string() }), { auth: "admin" }), method(object({ token: string() }), SsoBridgeClaimsSchema.nullable(), { auth: "admin" });
|
|
76512
|
-
var ProviderListEntrySchema = discriminatedUnion("shouldSaveDiskSpace", [object({
|
|
76513
|
-
providerId: string().min(1),
|
|
76514
|
-
displayName: string().min(1),
|
|
76515
|
-
configSchema: unknown(),
|
|
76516
|
-
nodeLocal: boolean(),
|
|
76517
|
-
shouldSaveDiskSpace: literal(true),
|
|
76518
|
-
minFreePercent: number().min(0).max(100)
|
|
76519
|
-
}), object({
|
|
76520
|
-
providerId: string().min(1),
|
|
76521
|
-
displayName: string().min(1),
|
|
76522
|
-
configSchema: unknown(),
|
|
76523
|
-
nodeLocal: boolean(),
|
|
76524
|
-
shouldSaveDiskSpace: literal(false),
|
|
76525
|
-
minFreePercent: literal(null)
|
|
76526
|
-
})]);
|
|
76527
76652
|
method(object({
|
|
76528
76653
|
location: StorageLocationRefSchema,
|
|
76529
76654
|
relativePath: string()
|
|
@@ -76585,42 +76710,7 @@ method(object({
|
|
|
76585
76710
|
}), _instanceof(Uint8Array), { auth: "admin" }), method(object({ downloadId: string() }), _void(), {
|
|
76586
76711
|
kind: "mutation",
|
|
76587
76712
|
auth: "admin"
|
|
76588
|
-
}), method(object({ type: StorageLocationTypeSchema.optional() }), array(StorageLocationSchema).readonly()), method(_void(), array(StorageLocationDeclarationSchema).readonly()), method(
|
|
76589
|
-
createdAt: true,
|
|
76590
|
-
updatedAt: true
|
|
76591
|
-
}), StorageLocationSchema, {
|
|
76592
|
-
kind: "mutation",
|
|
76593
|
-
auth: "admin"
|
|
76594
|
-
}), method(object({
|
|
76595
|
-
id: string(),
|
|
76596
|
-
force: boolean().optional()
|
|
76597
|
-
}), _void(), {
|
|
76598
|
-
kind: "mutation",
|
|
76599
|
-
auth: "admin"
|
|
76600
|
-
}), method(_void(), array(StorageDrainProgressSchema).readonly()), method(object({ id: string() }), object({
|
|
76601
|
-
ok: boolean(),
|
|
76602
|
-
error: string().optional()
|
|
76603
|
-
}), { auth: "admin" }), method(_void(), array(ProviderListEntrySchema).readonly()), method(object({
|
|
76604
|
-
providerId: string(),
|
|
76605
|
-
/**
|
|
76606
|
-
* The location this config is an UNSAVED edit of, when there is one.
|
|
76607
|
-
*
|
|
76608
|
-
* `listLocations` replaces every declared secret with the redaction
|
|
76609
|
-
* sentinel, so the edit modal's form state holds the sentinel for any
|
|
76610
|
-
* credential the operator did not retype — and posting that here
|
|
76611
|
-
* without a way to resolve it makes the provider try to authenticate
|
|
76612
|
-
* as `__camstack_redacted__` and report the operator's own working
|
|
76613
|
-
* password as wrong. Given this id, the orchestrator restores each
|
|
76614
|
-
* sentinel from the stored config (same rule as `upsertLocation`)
|
|
76615
|
-
* before dispatching. Omitted by the "Add location" wizard, where
|
|
76616
|
-
* every value was typed just now and nothing is stored yet.
|
|
76617
|
-
*/
|
|
76618
|
-
locationId: string().optional(),
|
|
76619
|
-
config: record(string(), unknown())
|
|
76620
|
-
}), object({
|
|
76621
|
-
ok: boolean(),
|
|
76622
|
-
error: string().optional()
|
|
76623
|
-
}), { auth: "admin" });
|
|
76713
|
+
}), method(object({ type: StorageLocationTypeSchema.optional() }), array(StorageLocationSchema).readonly()), method(_void(), array(StorageLocationDeclarationSchema).readonly()), method(_void(), array(StorageDrainProgressSchema).readonly());
|
|
76624
76714
|
/** One table of the settings database. */
|
|
76625
76715
|
var StorageTableSchema = object({
|
|
76626
76716
|
/** The table's full name, e.g. `recorder:addon-settings` or `addon-device-settings`. */
|
|
@@ -78142,7 +78232,7 @@ var TerminalInstanceInfoSchema = object({
|
|
|
78142
78232
|
/**
|
|
78143
78233
|
* False while the node the instance is bound to is not in the cluster
|
|
78144
78234
|
* topology (forgotten, renamed, re-paired). The instance is kept; the
|
|
78145
|
-
* operator re-points it
|
|
78235
|
+
* operator re-points it on the Terminal page.
|
|
78146
78236
|
*/
|
|
78147
78237
|
nodeInCluster: boolean(),
|
|
78148
78238
|
profileId: string(),
|
|
@@ -78180,41 +78270,7 @@ var TerminalOutputBatchSchema = object({
|
|
|
78180
78270
|
snapshot: string().optional(),
|
|
78181
78271
|
events: array(TerminalOutputEventSchema).readonly()
|
|
78182
78272
|
});
|
|
78183
|
-
method(_void(), array(TerminalProfileInfoSchema).readonly(), { auth: "admin" }), method(_void(), array(
|
|
78184
|
-
targetNodeId: string().min(1),
|
|
78185
|
-
profileId: string().min(1),
|
|
78186
|
-
name: string().trim().min(1).max(160).optional(),
|
|
78187
|
-
executable: string().max(1024).optional(),
|
|
78188
|
-
args: array(string().max(2048)).max(64).optional(),
|
|
78189
|
-
cwd: string().max(1024).optional(),
|
|
78190
|
-
environment: array(string().max(4096)).max(64).optional(),
|
|
78191
|
-
profileSettings: ProfileSettingsBagSchema.optional()
|
|
78192
|
-
}), TerminalInstanceInfoSchema, {
|
|
78193
|
-
kind: "mutation",
|
|
78194
|
-
auth: "admin"
|
|
78195
|
-
}), method(object({
|
|
78196
|
-
instanceId: string().min(1),
|
|
78197
|
-
/** Re-point the instance to another node; the profile must exist there. */
|
|
78198
|
-
targetNodeId: string().min(1).max(256).optional(),
|
|
78199
|
-
name: string().trim().min(1).max(160).optional(),
|
|
78200
|
-
executable: string().max(1024).optional(),
|
|
78201
|
-
args: array(string().max(2048)).max(64).optional(),
|
|
78202
|
-
cwd: string().max(1024).optional(),
|
|
78203
|
-
environment: array(string().max(4096)).max(64).optional(),
|
|
78204
|
-
profileSettings: ProfileSettingsBagSchema.optional()
|
|
78205
|
-
}), TerminalInstanceInfoSchema, {
|
|
78206
|
-
kind: "mutation",
|
|
78207
|
-
auth: "admin"
|
|
78208
|
-
}), method(object({ instanceId: string().min(1) }), _void(), {
|
|
78209
|
-
kind: "mutation",
|
|
78210
|
-
auth: "admin"
|
|
78211
|
-
}), method(object({
|
|
78212
|
-
instanceId: string().min(1),
|
|
78213
|
-
enabled: boolean()
|
|
78214
|
-
}), TerminalInstanceInfoSchema, {
|
|
78215
|
-
kind: "mutation",
|
|
78216
|
-
auth: "admin"
|
|
78217
|
-
}), method(_void(), array(TerminalLegacyCameraSchema).readonly(), { auth: "admin" }), method(object({
|
|
78273
|
+
method(_void(), array(TerminalProfileInfoSchema).readonly(), { auth: "admin" }), method(_void(), array(TerminalLegacyCameraSchema).readonly(), { auth: "admin" }), method(object({
|
|
78218
78274
|
stableId: string().min(1),
|
|
78219
78275
|
name: string().trim().min(1).max(160).optional()
|
|
78220
78276
|
}), TerminalInstanceInfoSchema, {
|
|
@@ -78283,6 +78339,11 @@ var TimedRunUnitSchema = _enum(["s", "min"]);
|
|
|
78283
78339
|
_enum(["switch", "pet-fountain"]);
|
|
78284
78340
|
DeviceType.Heater, DeviceType.PetFountain;
|
|
78285
78341
|
var TIMED_RUN_DEVICE_TYPES = [DeviceType.Heater, DeviceType.PetFountain];
|
|
78342
|
+
/** One duration, as the one-tap run asks for it. */
|
|
78343
|
+
var TimedRunQuickRunSchema = object({
|
|
78344
|
+
duration: number().positive().finite(),
|
|
78345
|
+
unit: TimedRunUnitSchema
|
|
78346
|
+
});
|
|
78286
78347
|
/** Why a request was not carried out. Typed, so a caller can say it in words. */
|
|
78287
78348
|
var TimedRunRefusalSchema = _enum([
|
|
78288
78349
|
"unsupported-device",
|
|
@@ -78303,8 +78364,23 @@ var TimedRunStatusSchema = object({
|
|
|
78303
78364
|
activeUntil: number().nullable(),
|
|
78304
78365
|
/** Who asked for the run (a user id or an addon id); `null` when nothing is armed or it did not say. */
|
|
78305
78366
|
requestedBy: string().nullable(),
|
|
78367
|
+
/**
|
|
78368
|
+
* The one-tap run of THIS device: what a "Run" button on any surface starts. `null` when
|
|
78369
|
+
* the device is gone or its type has no timed run; a status from before this field
|
|
78370
|
+
* existed has none, and a surface falls back to the type's default.
|
|
78371
|
+
*/
|
|
78372
|
+
quickRun: TimedRunQuickRunSchema.nullable(),
|
|
78306
78373
|
lastFetchedAt: number()
|
|
78307
78374
|
});
|
|
78375
|
+
/** What the settings form needs: the unit, the bounds and the type's default. */
|
|
78376
|
+
var TimedRunOptionsSchema = object({
|
|
78377
|
+
unit: TimedRunUnitSchema,
|
|
78378
|
+
/** The longest run, in `unit`. */
|
|
78379
|
+
maxDuration: number(),
|
|
78380
|
+
defaultDuration: number()
|
|
78381
|
+
});
|
|
78382
|
+
/** The one-tap run duration, in the type's unit; `null` returns to the type's default. */
|
|
78383
|
+
var TimedRunSettingsPatchSchema = object({ quickRunDuration: number().positive().finite().nullable().optional() });
|
|
78308
78384
|
var timedRunCapability = {
|
|
78309
78385
|
name: "timed-run",
|
|
78310
78386
|
scope: "device",
|
|
@@ -78312,7 +78388,24 @@ var timedRunCapability = {
|
|
|
78312
78388
|
kind: "wrapper",
|
|
78313
78389
|
defaultActive: true,
|
|
78314
78390
|
deviceTypes: TIMED_RUN_DEVICE_TYPES,
|
|
78391
|
+
deviceConfig: { ui: {
|
|
78392
|
+
kind: "derived-form",
|
|
78393
|
+
builderId: "timed-run",
|
|
78394
|
+
tab: "general"
|
|
78395
|
+
} },
|
|
78315
78396
|
methods: {
|
|
78397
|
+
getOptions: method(object({ deviceId: number().int() }), TimedRunOptionsSchema),
|
|
78398
|
+
/**
|
|
78399
|
+
* The one-tap run of this device. A duration above the type's maximum is
|
|
78400
|
+
* REFUSED (thrown), like `runFor`: the maximum is a safety bound.
|
|
78401
|
+
*/
|
|
78402
|
+
setSettings: method(object({
|
|
78403
|
+
deviceId: number().int(),
|
|
78404
|
+
settings: TimedRunSettingsPatchSchema
|
|
78405
|
+
}), _void(), {
|
|
78406
|
+
kind: "mutation",
|
|
78407
|
+
auth: "admin"
|
|
78408
|
+
}),
|
|
78316
78409
|
/**
|
|
78317
78410
|
* Turn the device on and arm its off. A run already armed is replaced (the
|
|
78318
78411
|
* new deadline wins). Refuses with a typed reason above the type's maximum.
|
|
@@ -83105,21 +83198,28 @@ Object.freeze({
|
|
|
83105
83198
|
access: "view",
|
|
83106
83199
|
role: "admin"
|
|
83107
83200
|
},
|
|
83108
|
-
"addonSettings.
|
|
83201
|
+
"addonSettings.getIntegrationFormSchema": {
|
|
83109
83202
|
capName: "addon-settings",
|
|
83110
83203
|
capScope: "system",
|
|
83111
83204
|
addonId: null,
|
|
83112
83205
|
access: "view",
|
|
83113
83206
|
role: "admin"
|
|
83114
83207
|
},
|
|
83115
|
-
"addonSettings.
|
|
83208
|
+
"addonSettings.getScopedSettings": {
|
|
83209
|
+
capName: "addon-settings",
|
|
83210
|
+
capScope: "system",
|
|
83211
|
+
addonId: null,
|
|
83212
|
+
access: "view",
|
|
83213
|
+
role: "admin"
|
|
83214
|
+
},
|
|
83215
|
+
"addonSettings.listScopedSettings": {
|
|
83116
83216
|
capName: "addon-settings",
|
|
83117
83217
|
capScope: "system",
|
|
83118
83218
|
addonId: null,
|
|
83119
83219
|
access: "view",
|
|
83120
83220
|
role: "admin"
|
|
83121
83221
|
},
|
|
83122
|
-
"addonSettings.
|
|
83222
|
+
"addonSettings.readScopedValues": {
|
|
83123
83223
|
capName: "addon-settings",
|
|
83124
83224
|
capScope: "system",
|
|
83125
83225
|
addonId: null,
|
|
@@ -83140,7 +83240,7 @@ Object.freeze({
|
|
|
83140
83240
|
access: "create",
|
|
83141
83241
|
role: "admin"
|
|
83142
83242
|
},
|
|
83143
|
-
"addonSettings.
|
|
83243
|
+
"addonSettings.updateScopedSettings": {
|
|
83144
83244
|
capName: "addon-settings",
|
|
83145
83245
|
capScope: "system",
|
|
83146
83246
|
addonId: null,
|
|
@@ -85310,6 +85410,13 @@ Object.freeze({
|
|
|
85310
85410
|
access: "create",
|
|
85311
85411
|
role: "admin"
|
|
85312
85412
|
},
|
|
85413
|
+
"deviceManager.setAlias": {
|
|
85414
|
+
capName: "device-manager",
|
|
85415
|
+
capScope: "system",
|
|
85416
|
+
addonId: null,
|
|
85417
|
+
access: "create",
|
|
85418
|
+
role: "admin"
|
|
85419
|
+
},
|
|
85313
85420
|
"deviceManager.setChildLayout": {
|
|
85314
85421
|
capName: "device-manager",
|
|
85315
85422
|
capScope: "system",
|
|
@@ -86598,13 +86705,6 @@ Object.freeze({
|
|
|
86598
86705
|
access: "delete",
|
|
86599
86706
|
role: "admin"
|
|
86600
86707
|
},
|
|
86601
|
-
"llm.deleteProfile": {
|
|
86602
|
-
capName: "llm",
|
|
86603
|
-
capScope: "system",
|
|
86604
|
-
addonId: null,
|
|
86605
|
-
access: "delete",
|
|
86606
|
-
role: "admin"
|
|
86607
|
-
},
|
|
86608
86708
|
"llm.generate": {
|
|
86609
86709
|
capName: "llm",
|
|
86610
86710
|
capScope: "system",
|
|
@@ -86668,20 +86768,6 @@ Object.freeze({
|
|
|
86668
86768
|
access: "view",
|
|
86669
86769
|
role: "admin"
|
|
86670
86770
|
},
|
|
86671
|
-
"llm.listProfileKinds": {
|
|
86672
|
-
capName: "llm",
|
|
86673
|
-
capScope: "system",
|
|
86674
|
-
addonId: null,
|
|
86675
|
-
access: "view",
|
|
86676
|
-
role: "admin"
|
|
86677
|
-
},
|
|
86678
|
-
"llm.listProfiles": {
|
|
86679
|
-
capName: "llm",
|
|
86680
|
-
capScope: "system",
|
|
86681
|
-
addonId: null,
|
|
86682
|
-
access: "view",
|
|
86683
|
-
role: "admin"
|
|
86684
|
-
},
|
|
86685
86771
|
"llm.listRuntimeNodes": {
|
|
86686
86772
|
capName: "llm",
|
|
86687
86773
|
capScope: "system",
|
|
@@ -86689,13 +86775,6 @@ Object.freeze({
|
|
|
86689
86775
|
access: "view",
|
|
86690
86776
|
role: "admin"
|
|
86691
86777
|
},
|
|
86692
|
-
"llm.migrateRawSecrets": {
|
|
86693
|
-
capName: "llm",
|
|
86694
|
-
capScope: "system",
|
|
86695
|
-
addonId: null,
|
|
86696
|
-
access: "create",
|
|
86697
|
-
role: "admin"
|
|
86698
|
-
},
|
|
86699
86778
|
"llm.resolveModelRef": {
|
|
86700
86779
|
capName: "llm",
|
|
86701
86780
|
capScope: "system",
|
|
@@ -86724,20 +86803,6 @@ Object.freeze({
|
|
|
86724
86803
|
access: "create",
|
|
86725
86804
|
role: "admin"
|
|
86726
86805
|
},
|
|
86727
|
-
"llm.testProfile": {
|
|
86728
|
-
capName: "llm",
|
|
86729
|
-
capScope: "system",
|
|
86730
|
-
addonId: null,
|
|
86731
|
-
access: "create",
|
|
86732
|
-
role: "admin"
|
|
86733
|
-
},
|
|
86734
|
-
"llm.upsertProfile": {
|
|
86735
|
-
capName: "llm",
|
|
86736
|
-
capScope: "system",
|
|
86737
|
-
addonId: null,
|
|
86738
|
-
access: "create",
|
|
86739
|
-
role: "admin"
|
|
86740
|
-
},
|
|
86741
86806
|
"llmRuntime.appleAvailability": {
|
|
86742
86807
|
capName: "llm-runtime",
|
|
86743
86808
|
capScope: "system",
|
|
@@ -87242,13 +87307,6 @@ Object.freeze({
|
|
|
87242
87307
|
access: "create",
|
|
87243
87308
|
role: "admin"
|
|
87244
87309
|
},
|
|
87245
|
-
"meshNetwork.testConnection": {
|
|
87246
|
-
capName: "mesh-network",
|
|
87247
|
-
capScope: "system",
|
|
87248
|
-
addonId: null,
|
|
87249
|
-
access: "create",
|
|
87250
|
-
role: "admin"
|
|
87251
|
-
},
|
|
87252
87310
|
"meter.getStatus": {
|
|
87253
87311
|
capName: "meter",
|
|
87254
87312
|
capScope: "device",
|
|
@@ -87907,13 +87965,6 @@ Object.freeze({
|
|
|
87907
87965
|
access: "create",
|
|
87908
87966
|
role: "admin"
|
|
87909
87967
|
},
|
|
87910
|
-
"notificationOutput.deleteTarget": {
|
|
87911
|
-
capName: "notification-output",
|
|
87912
|
-
capScope: "system",
|
|
87913
|
-
addonId: null,
|
|
87914
|
-
access: "delete",
|
|
87915
|
-
role: "admin"
|
|
87916
|
-
},
|
|
87917
87968
|
"notificationOutput.discoverTargets": {
|
|
87918
87969
|
capName: "notification-output",
|
|
87919
87970
|
capScope: "system",
|
|
@@ -87921,13 +87972,6 @@ Object.freeze({
|
|
|
87921
87972
|
access: "view",
|
|
87922
87973
|
role: "admin"
|
|
87923
87974
|
},
|
|
87924
|
-
"notificationOutput.getTarget": {
|
|
87925
|
-
capName: "notification-output",
|
|
87926
|
-
capScope: "system",
|
|
87927
|
-
addonId: null,
|
|
87928
|
-
access: "view",
|
|
87929
|
-
role: "admin"
|
|
87930
|
-
},
|
|
87931
87975
|
"notificationOutput.listTargetKinds": {
|
|
87932
87976
|
capName: "notification-output",
|
|
87933
87977
|
capScope: "system",
|
|
@@ -87935,13 +87979,6 @@ Object.freeze({
|
|
|
87935
87979
|
access: "view",
|
|
87936
87980
|
role: "admin"
|
|
87937
87981
|
},
|
|
87938
|
-
"notificationOutput.listTargets": {
|
|
87939
|
-
capName: "notification-output",
|
|
87940
|
-
capScope: "system",
|
|
87941
|
-
addonId: null,
|
|
87942
|
-
access: "view",
|
|
87943
|
-
role: "admin"
|
|
87944
|
-
},
|
|
87945
87982
|
"notificationOutput.probeTargetConfig": {
|
|
87946
87983
|
capName: "notification-output",
|
|
87947
87984
|
capScope: "system",
|
|
@@ -87956,13 +87993,6 @@ Object.freeze({
|
|
|
87956
87993
|
access: "create",
|
|
87957
87994
|
role: "admin"
|
|
87958
87995
|
},
|
|
87959
|
-
"notificationOutput.setTargetEnabled": {
|
|
87960
|
-
capName: "notification-output",
|
|
87961
|
-
capScope: "system",
|
|
87962
|
-
addonId: null,
|
|
87963
|
-
access: "create",
|
|
87964
|
-
role: "admin"
|
|
87965
|
-
},
|
|
87966
87996
|
"notificationOutput.testTarget": {
|
|
87967
87997
|
capName: "notification-output",
|
|
87968
87998
|
capScope: "system",
|
|
@@ -87970,13 +88000,6 @@ Object.freeze({
|
|
|
87970
88000
|
access: "create",
|
|
87971
88001
|
role: "admin"
|
|
87972
88002
|
},
|
|
87973
|
-
"notificationOutput.upsertTarget": {
|
|
87974
|
-
capName: "notification-output",
|
|
87975
|
-
capScope: "system",
|
|
87976
|
-
addonId: null,
|
|
87977
|
-
access: "create",
|
|
87978
|
-
role: "admin"
|
|
87979
|
-
},
|
|
87980
88003
|
"notificationRules.activateAlarmProfile": {
|
|
87981
88004
|
capName: "notification-rules",
|
|
87982
88005
|
capScope: "system",
|
|
@@ -88236,41 +88259,6 @@ Object.freeze({
|
|
|
88236
88259
|
access: "view",
|
|
88237
88260
|
role: "admin"
|
|
88238
88261
|
},
|
|
88239
|
-
"oidcConnections.connectionFormSchema": {
|
|
88240
|
-
capName: "oidc-connections",
|
|
88241
|
-
capScope: "system",
|
|
88242
|
-
addonId: null,
|
|
88243
|
-
access: "view",
|
|
88244
|
-
role: "admin"
|
|
88245
|
-
},
|
|
88246
|
-
"oidcConnections.createConnection": {
|
|
88247
|
-
capName: "oidc-connections",
|
|
88248
|
-
capScope: "system",
|
|
88249
|
-
addonId: null,
|
|
88250
|
-
access: "create",
|
|
88251
|
-
role: "admin"
|
|
88252
|
-
},
|
|
88253
|
-
"oidcConnections.deleteConnection": {
|
|
88254
|
-
capName: "oidc-connections",
|
|
88255
|
-
capScope: "system",
|
|
88256
|
-
addonId: null,
|
|
88257
|
-
access: "delete",
|
|
88258
|
-
role: "admin"
|
|
88259
|
-
},
|
|
88260
|
-
"oidcConnections.listConnections": {
|
|
88261
|
-
capName: "oidc-connections",
|
|
88262
|
-
capScope: "system",
|
|
88263
|
-
addonId: null,
|
|
88264
|
-
access: "view",
|
|
88265
|
-
role: "admin"
|
|
88266
|
-
},
|
|
88267
|
-
"oidcConnections.updateConnection": {
|
|
88268
|
-
capName: "oidc-connections",
|
|
88269
|
-
capScope: "system",
|
|
88270
|
-
addonId: null,
|
|
88271
|
-
access: "create",
|
|
88272
|
-
role: "admin"
|
|
88273
|
-
},
|
|
88274
88262
|
"osd.getStatus": {
|
|
88275
88263
|
capName: "osd",
|
|
88276
88264
|
capScope: "device",
|
|
@@ -91302,13 +91290,6 @@ Object.freeze({
|
|
|
91302
91290
|
access: "delete",
|
|
91303
91291
|
role: "admin"
|
|
91304
91292
|
},
|
|
91305
|
-
"storage.deleteLocation": {
|
|
91306
|
-
capName: "storage",
|
|
91307
|
-
capScope: "system",
|
|
91308
|
-
addonId: null,
|
|
91309
|
-
access: "delete",
|
|
91310
|
-
role: "admin"
|
|
91311
|
-
},
|
|
91312
91293
|
"storage.endDownload": {
|
|
91313
91294
|
capName: "storage",
|
|
91314
91295
|
capScope: "system",
|
|
@@ -91365,13 +91346,6 @@ Object.freeze({
|
|
|
91365
91346
|
access: "view",
|
|
91366
91347
|
role: "admin"
|
|
91367
91348
|
},
|
|
91368
|
-
"storage.listProviders": {
|
|
91369
|
-
capName: "storage",
|
|
91370
|
-
capScope: "system",
|
|
91371
|
-
addonId: null,
|
|
91372
|
-
access: "view",
|
|
91373
|
-
role: "admin"
|
|
91374
|
-
},
|
|
91375
91349
|
"storage.read": {
|
|
91376
91350
|
capName: "storage",
|
|
91377
91351
|
capScope: "system",
|
|
@@ -91393,27 +91367,6 @@ Object.freeze({
|
|
|
91393
91367
|
access: "view",
|
|
91394
91368
|
role: "admin"
|
|
91395
91369
|
},
|
|
91396
|
-
"storage.testConfig": {
|
|
91397
|
-
capName: "storage",
|
|
91398
|
-
capScope: "system",
|
|
91399
|
-
addonId: null,
|
|
91400
|
-
access: "view",
|
|
91401
|
-
role: "admin"
|
|
91402
|
-
},
|
|
91403
|
-
"storage.testLocation": {
|
|
91404
|
-
capName: "storage",
|
|
91405
|
-
capScope: "system",
|
|
91406
|
-
addonId: null,
|
|
91407
|
-
access: "view",
|
|
91408
|
-
role: "admin"
|
|
91409
|
-
},
|
|
91410
|
-
"storage.upsertLocation": {
|
|
91411
|
-
capName: "storage",
|
|
91412
|
-
capScope: "system",
|
|
91413
|
-
addonId: null,
|
|
91414
|
-
access: "create",
|
|
91415
|
-
role: "admin"
|
|
91416
|
-
},
|
|
91417
91370
|
"storage.write": {
|
|
91418
91371
|
capName: "storage",
|
|
91419
91372
|
capScope: "system",
|
|
@@ -92191,27 +92144,6 @@ Object.freeze({
|
|
|
92191
92144
|
access: "create",
|
|
92192
92145
|
role: "admin"
|
|
92193
92146
|
},
|
|
92194
|
-
"terminalSession.createInstance": {
|
|
92195
|
-
capName: "terminal-session",
|
|
92196
|
-
capScope: "system",
|
|
92197
|
-
addonId: null,
|
|
92198
|
-
access: "create",
|
|
92199
|
-
role: "admin"
|
|
92200
|
-
},
|
|
92201
|
-
"terminalSession.deleteInstance": {
|
|
92202
|
-
capName: "terminal-session",
|
|
92203
|
-
capScope: "system",
|
|
92204
|
-
addonId: null,
|
|
92205
|
-
access: "delete",
|
|
92206
|
-
role: "admin"
|
|
92207
|
-
},
|
|
92208
|
-
"terminalSession.listInstances": {
|
|
92209
|
-
capName: "terminal-session",
|
|
92210
|
-
capScope: "system",
|
|
92211
|
-
addonId: null,
|
|
92212
|
-
access: "view",
|
|
92213
|
-
role: "admin"
|
|
92214
|
-
},
|
|
92215
92147
|
"terminalSession.listLegacyCameras": {
|
|
92216
92148
|
capName: "terminal-session",
|
|
92217
92149
|
capScope: "system",
|
|
@@ -92254,20 +92186,6 @@ Object.freeze({
|
|
|
92254
92186
|
access: "create",
|
|
92255
92187
|
role: "admin"
|
|
92256
92188
|
},
|
|
92257
|
-
"terminalSession.setInstanceEnabled": {
|
|
92258
|
-
capName: "terminal-session",
|
|
92259
|
-
capScope: "system",
|
|
92260
|
-
addonId: null,
|
|
92261
|
-
access: "create",
|
|
92262
|
-
role: "admin"
|
|
92263
|
-
},
|
|
92264
|
-
"terminalSession.updateInstance": {
|
|
92265
|
-
capName: "terminal-session",
|
|
92266
|
-
capScope: "system",
|
|
92267
|
-
addonId: null,
|
|
92268
|
-
access: "create",
|
|
92269
|
-
role: "admin"
|
|
92270
|
-
},
|
|
92271
92189
|
"terminalSession.writeInput": {
|
|
92272
92190
|
capName: "terminal-session",
|
|
92273
92191
|
capScope: "system",
|
|
@@ -92282,6 +92200,13 @@ Object.freeze({
|
|
|
92282
92200
|
access: "create",
|
|
92283
92201
|
role: "viewer"
|
|
92284
92202
|
},
|
|
92203
|
+
"timedRun.getOptions": {
|
|
92204
|
+
capName: "timed-run",
|
|
92205
|
+
capScope: "device",
|
|
92206
|
+
addonId: null,
|
|
92207
|
+
access: "view",
|
|
92208
|
+
role: "viewer"
|
|
92209
|
+
},
|
|
92285
92210
|
"timedRun.getStatus": {
|
|
92286
92211
|
capName: "timed-run",
|
|
92287
92212
|
capScope: "device",
|
|
@@ -92296,6 +92221,13 @@ Object.freeze({
|
|
|
92296
92221
|
access: "create",
|
|
92297
92222
|
role: "viewer"
|
|
92298
92223
|
},
|
|
92224
|
+
"timedRun.setSettings": {
|
|
92225
|
+
capName: "timed-run",
|
|
92226
|
+
capScope: "device",
|
|
92227
|
+
addonId: null,
|
|
92228
|
+
access: "create",
|
|
92229
|
+
role: "admin"
|
|
92230
|
+
},
|
|
92299
92231
|
"toast.onToast": {
|
|
92300
92232
|
capName: "toast",
|
|
92301
92233
|
capScope: "system",
|
|
@@ -93226,6 +93158,7 @@ function offered(received) {
|
|
|
93226
93158
|
};
|
|
93227
93159
|
}
|
|
93228
93160
|
offered(HA_AS), withheld(HOMEKIT_REASON), withheld(ALEXA_REASON), withheld(GOOGLE_REASON), withheld(MATTER_REASON);
|
|
93161
|
+
string().min(1).max(4096);
|
|
93229
93162
|
Object.freeze({
|
|
93230
93163
|
"accessories.getStatus": [{
|
|
93231
93164
|
name: "deviceId",
|
|
@@ -93909,6 +93842,11 @@ Object.freeze({
|
|
|
93909
93842
|
form: "single",
|
|
93910
93843
|
optional: false
|
|
93911
93844
|
}],
|
|
93845
|
+
"deviceManager.setAlias": [{
|
|
93846
|
+
name: "deviceId",
|
|
93847
|
+
form: "single",
|
|
93848
|
+
optional: false
|
|
93849
|
+
}],
|
|
93912
93850
|
"deviceManager.setChildLayout": [{
|
|
93913
93851
|
name: "deviceId",
|
|
93914
93852
|
form: "single",
|
|
@@ -95973,6 +95911,11 @@ Object.freeze({
|
|
|
95973
95911
|
form: "single",
|
|
95974
95912
|
optional: false
|
|
95975
95913
|
}],
|
|
95914
|
+
"timedRun.getOptions": [{
|
|
95915
|
+
name: "deviceId",
|
|
95916
|
+
form: "single",
|
|
95917
|
+
optional: false
|
|
95918
|
+
}],
|
|
95976
95919
|
"timedRun.getStatus": [{
|
|
95977
95920
|
name: "deviceId",
|
|
95978
95921
|
form: "single",
|
|
@@ -95983,6 +95926,11 @@ Object.freeze({
|
|
|
95983
95926
|
form: "single",
|
|
95984
95927
|
optional: false
|
|
95985
95928
|
}],
|
|
95929
|
+
"timedRun.setSettings": [{
|
|
95930
|
+
name: "deviceId",
|
|
95931
|
+
form: "single",
|
|
95932
|
+
optional: false
|
|
95933
|
+
}],
|
|
95986
95934
|
"update.getStatus": [{
|
|
95987
95935
|
name: "deviceId",
|
|
95988
95936
|
form: "single",
|
|
@@ -96845,6 +96793,7 @@ var STATE_SUMMARY_VARS = [
|
|
|
96845
96793
|
[...RULE_TEXT],
|
|
96846
96794
|
[...RULE_TEXT],
|
|
96847
96795
|
[...RULE_TEXT],
|
|
96796
|
+
[...RULE_TEXT],
|
|
96848
96797
|
[...RULE_BODY_ONLY],
|
|
96849
96798
|
[...RULE_TEXT],
|
|
96850
96799
|
([...RULE_TEXT], [...DEVICE_EVENTS]),
|
|
@@ -122136,7 +122085,13 @@ function buildHomematicInstances(records, deps) {
|
|
|
122136
122085
|
},
|
|
122137
122086
|
instanceMode: "multiple",
|
|
122138
122087
|
kind: "connection",
|
|
122139
|
-
canTest: true
|
|
122088
|
+
canTest: true,
|
|
122089
|
+
kinds: [{
|
|
122090
|
+
id: "connection",
|
|
122091
|
+
label: "Homematic",
|
|
122092
|
+
functionCap: "device-provider",
|
|
122093
|
+
role: "devices"
|
|
122094
|
+
}]
|
|
122140
122095
|
},
|
|
122141
122096
|
formSchema: () => buildConnectionFormSchema(),
|
|
122142
122097
|
initialBody: (name) => ({ name }),
|