@camstack/addon-provider-homematic 1.2.185 → 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 +12 -0
- package/dist/_stub.js +2 -2
- package/dist/{_virtual_mf-localSharedImportMap___mfe_internal__addon_provider_homematic_page-Cdu55gHq.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 +1841 -1859
- package/dist/addon.mjs +1841 -1859
- package/dist/{hostInit-BTFBzWSC.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-DYzwyh0X.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] } : {},
|
|
@@ -6699,10 +6776,33 @@ function integrationRowsApiOver(api) {
|
|
|
6699
6776
|
};
|
|
6700
6777
|
}
|
|
6701
6778
|
var PREFIX = "records/";
|
|
6779
|
+
/**
|
|
6780
|
+
* Cross-realm brand. An addon bundles its own copy of this module (D15) while
|
|
6781
|
+
* `ctx.records` is the HOST's door, so an error thrown by the host is an
|
|
6782
|
+
* instance of the host's classes, not of the addon's. The brand plus the code
|
|
6783
|
+
* make `instanceof` answer by identity of the failure, not of the copy.
|
|
6784
|
+
*/
|
|
6785
|
+
var RECORDS_ERROR_BRAND = Symbol.for("camstack.records-error");
|
|
6786
|
+
function carriesBrand(value) {
|
|
6787
|
+
return typeof value === "object" && value !== null && Reflect.get(value, RECORDS_ERROR_BRAND) === true;
|
|
6788
|
+
}
|
|
6702
6789
|
/** The base of every records failure. `detail` is the human part of the message. */
|
|
6703
6790
|
var RecordsError = class extends Error {
|
|
6791
|
+
/** The code a subclass stands for; the base stands for every code. */
|
|
6792
|
+
static code = void 0;
|
|
6793
|
+
/**
|
|
6794
|
+
* `instanceof` across copies of this module: any branded error is a
|
|
6795
|
+
* `RecordsError`, and is an instance of a subclass only when its code is the
|
|
6796
|
+
* subclass's code. Same-copy answers are unchanged.
|
|
6797
|
+
*/
|
|
6798
|
+
static [Symbol.hasInstance](value) {
|
|
6799
|
+
if (Function.prototype[Symbol.hasInstance].call(this, value)) return true;
|
|
6800
|
+
if (!carriesBrand(value)) return false;
|
|
6801
|
+
return this.code === void 0 || value.code === this.code;
|
|
6802
|
+
}
|
|
6704
6803
|
code;
|
|
6705
6804
|
detail;
|
|
6805
|
+
[RECORDS_ERROR_BRAND] = true;
|
|
6706
6806
|
constructor(code, detail) {
|
|
6707
6807
|
super(`${PREFIX}${code}: ${detail}`);
|
|
6708
6808
|
this.name = "RecordsError";
|
|
@@ -6711,29 +6811,33 @@ var RecordsError = class extends Error {
|
|
|
6711
6811
|
}
|
|
6712
6812
|
};
|
|
6713
6813
|
/** A write guarded by `ifRev` found another revision (or an existing row for `ifRev: 0`). */
|
|
6714
|
-
var RevConflictError = class extends RecordsError {
|
|
6814
|
+
var RevConflictError = class RevConflictError extends RecordsError {
|
|
6815
|
+
static code = "rev-conflict";
|
|
6715
6816
|
constructor(detail) {
|
|
6716
|
-
super(
|
|
6817
|
+
super(RevConflictError.code, detail);
|
|
6717
6818
|
this.name = "RevConflictError";
|
|
6718
6819
|
}
|
|
6719
6820
|
};
|
|
6720
6821
|
/** The keychain could not store or serve a value: explicit, never an empty string. */
|
|
6721
|
-
var RecordSecretUnavailableError = class extends RecordsError {
|
|
6822
|
+
var RecordSecretUnavailableError = class RecordSecretUnavailableError extends RecordsError {
|
|
6823
|
+
static code = "secret-unavailable";
|
|
6722
6824
|
constructor(detail) {
|
|
6723
|
-
super(
|
|
6825
|
+
super(RecordSecretUnavailableError.code, detail);
|
|
6724
6826
|
this.name = "RecordSecretUnavailableError";
|
|
6725
6827
|
}
|
|
6726
6828
|
};
|
|
6727
|
-
var InvalidRecordError = class extends RecordsError {
|
|
6829
|
+
var InvalidRecordError = class InvalidRecordError extends RecordsError {
|
|
6830
|
+
static code = "invalid-record";
|
|
6728
6831
|
constructor(detail) {
|
|
6729
|
-
super(
|
|
6832
|
+
super(InvalidRecordError.code, detail);
|
|
6730
6833
|
this.name = "InvalidRecordError";
|
|
6731
6834
|
}
|
|
6732
6835
|
};
|
|
6733
6836
|
/** A kind declaration the engine refuses (non-additive change, bad shape, wrong file). */
|
|
6734
|
-
var DeclarationRefusedError = class extends RecordsError {
|
|
6837
|
+
var DeclarationRefusedError = class DeclarationRefusedError extends RecordsError {
|
|
6838
|
+
static code = "declaration-refused";
|
|
6735
6839
|
constructor(detail) {
|
|
6736
|
-
super(
|
|
6840
|
+
super(DeclarationRefusedError.code, detail);
|
|
6737
6841
|
this.name = "DeclarationRefusedError";
|
|
6738
6842
|
}
|
|
6739
6843
|
};
|
|
@@ -7135,6 +7239,7 @@ var RecordIntegrationInstances = class {
|
|
|
7135
7239
|
this.secretKeys = topLevelSecretKeys(kind.declaration.secretPaths);
|
|
7136
7240
|
this.secretMaps = secretMapKeys(kind.declaration.secretPaths);
|
|
7137
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`);
|
|
7138
7243
|
}
|
|
7139
7244
|
/**
|
|
7140
7245
|
* One instance read for the addon's own runtime; null when absent. When the keychain is
|
|
@@ -7176,10 +7281,21 @@ var RecordIntegrationInstances = class {
|
|
|
7176
7281
|
}
|
|
7177
7282
|
return out;
|
|
7178
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
|
+
}
|
|
7179
7295
|
viewOf(record) {
|
|
7180
7296
|
const shown = secretViewsOf(this.records.owner, this.kind.name, record.id, this.kind.declaration, record.data);
|
|
7181
7297
|
const rawName = record.data[this.nameField];
|
|
7182
|
-
const kind = this.
|
|
7298
|
+
const kind = this.kindOfBody(record.data);
|
|
7183
7299
|
const health = this.hooks.health?.(record.data, record.id);
|
|
7184
7300
|
return {
|
|
7185
7301
|
id: record.id,
|
|
@@ -7187,7 +7303,7 @@ var RecordIntegrationInstances = class {
|
|
|
7187
7303
|
configured: this.hooks.configured(record.data),
|
|
7188
7304
|
enabled: isInstanceEnabled(record.data),
|
|
7189
7305
|
formValues: shown,
|
|
7190
|
-
|
|
7306
|
+
kind,
|
|
7191
7307
|
...health?.status !== void 0 ? { status: health.status } : {},
|
|
7192
7308
|
...health?.lastCheckedAt !== void 0 ? { lastCheckedAt: health.lastCheckedAt } : {}
|
|
7193
7309
|
};
|
|
@@ -7220,17 +7336,35 @@ var RecordIntegrationInstances = class {
|
|
|
7220
7336
|
...kind !== void 0 ? { kind } : {}
|
|
7221
7337
|
});
|
|
7222
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
|
+
}));
|
|
7223
7348
|
await this.handle.put({
|
|
7224
7349
|
id: minted,
|
|
7225
|
-
data:
|
|
7350
|
+
data: initial
|
|
7226
7351
|
}, { ifRev: 0 });
|
|
7227
|
-
const patch = this.patchOf(values ?? {});
|
|
7228
7352
|
if (Object.keys(patch).length > 0) await this.handle.patch(minted, patch);
|
|
7229
7353
|
await this.hooks.onChanged?.(minted, "created");
|
|
7230
7354
|
return { id: minted };
|
|
7231
7355
|
};
|
|
7232
7356
|
updateInstance = async ({ id, name, values }) => {
|
|
7233
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
|
+
}
|
|
7234
7368
|
if (name !== void 0) patch[this.nameField] = name;
|
|
7235
7369
|
await this.handle.patch(id, patch);
|
|
7236
7370
|
await this.hooks.onChanged?.(id, "updated");
|
|
@@ -7541,6 +7675,21 @@ var SCOPED_SETTINGS_SCOPES = [
|
|
|
7541
7675
|
"device-defaults",
|
|
7542
7676
|
"node"
|
|
7543
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
|
+
}
|
|
7544
7693
|
/** A write to a secret path could not be stored in the keychain, so it was refused. */
|
|
7545
7694
|
var KeychainWriteRefusedError = class extends Error {
|
|
7546
7695
|
fieldPath;
|
|
@@ -8116,7 +8265,16 @@ function createHandle(raw, opts) {
|
|
|
8116
8265
|
return blob;
|
|
8117
8266
|
}
|
|
8118
8267
|
},
|
|
8119
|
-
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
|
+
})
|
|
8120
8278
|
};
|
|
8121
8279
|
}
|
|
8122
8280
|
/** The context the addon sees, plus the private raw view and write outcome. */
|
|
@@ -8246,7 +8404,7 @@ function boundOf(list) {
|
|
|
8246
8404
|
* Base class for CamStack addons. Eliminates settings boilerplate:
|
|
8247
8405
|
*
|
|
8248
8406
|
* - Typed `config` property with automatic resolution from store + defaults
|
|
8249
|
-
* -
|
|
8407
|
+
* - the scoped settings API (`clusterSettings` / `nodeSettings` / `deviceDefaults`) auto-implemented
|
|
8250
8408
|
* - `getAddonSettings()` / `updateAddonSettings()` auto-implemented
|
|
8251
8409
|
* - `getDeviceSettings()` / `updateDeviceSettings()` auto-implemented
|
|
8252
8410
|
* - `ctx` accessor for the AddonContext (no manual `this.ctxRef` storage)
|
|
@@ -8256,7 +8414,7 @@ function boundOf(list) {
|
|
|
8256
8414
|
* Subclasses override:
|
|
8257
8415
|
* - `onInitialize()` — addon-specific init logic, return ProviderRegistration[]
|
|
8258
8416
|
* - `onShutdown()` — cleanup
|
|
8259
|
-
* - `
|
|
8417
|
+
* - `clusterSettingsSchema()` / `nodeSettingsSchema()` / `deviceSettingsSchema()` — UI schemas
|
|
8260
8418
|
*
|
|
8261
8419
|
* @example
|
|
8262
8420
|
* ```ts
|
|
@@ -8270,7 +8428,7 @@ function boundOf(list) {
|
|
|
8270
8428
|
* super({ maxRetries: 3, endpoint: 'http://localhost' })
|
|
8271
8429
|
* }
|
|
8272
8430
|
*
|
|
8273
|
-
* protected
|
|
8431
|
+
* protected clusterSettingsSchema() {
|
|
8274
8432
|
* return this.schema({
|
|
8275
8433
|
* sections: [{
|
|
8276
8434
|
* id: 'main', title: 'Settings',
|
|
@@ -8313,7 +8471,7 @@ var BaseAddon = class {
|
|
|
8313
8471
|
defaults;
|
|
8314
8472
|
/**
|
|
8315
8473
|
* Hidden-state paths that hold secrets (D787) — values the addon writes
|
|
8316
|
-
* itself (`
|
|
8474
|
+
* itself (`state()`, the scoped writers) that no form field declares.
|
|
8317
8475
|
* Stored in the keychain exactly like a `password` field. Syntax:
|
|
8318
8476
|
* `'snapshotSigningKey'`, `'identity.pincode'`, `'tokens[userId].accessToken'`
|
|
8319
8477
|
* (`key[<id field>]` addresses array items by id, never by index).
|
|
@@ -8323,7 +8481,7 @@ var BaseAddon = class {
|
|
|
8323
8481
|
/**
|
|
8324
8482
|
* D986 M4: the scoped schemas this addon declared, resolved once per capability
|
|
8325
8483
|
* (`loadScopedSchemas`) so the sync readers (`perNodeKeys`, the secret tree, the restart check)
|
|
8326
|
-
* see them. Empty until loaded
|
|
8484
|
+
* see them. Empty until loaded.
|
|
8327
8485
|
*/
|
|
8328
8486
|
_scopedByCap = /* @__PURE__ */ new Map();
|
|
8329
8487
|
_nodeKeysByCap = /* @__PURE__ */ new Map();
|
|
@@ -8509,7 +8667,7 @@ var BaseAddon = class {
|
|
|
8509
8667
|
/** Addon-specific cleanup. Override if needed. */
|
|
8510
8668
|
async onShutdown() {}
|
|
8511
8669
|
/**
|
|
8512
|
-
* Called after config is resolved during
|
|
8670
|
+
* Called after config is resolved during a settings write.
|
|
8513
8671
|
* Override to react to config changes (e.g. restart a sampler, reconnect a service).
|
|
8514
8672
|
* Not called during initialize() — use onInitialize() for initial setup.
|
|
8515
8673
|
*/
|
|
@@ -8538,82 +8696,12 @@ var BaseAddon = class {
|
|
|
8538
8696
|
scopedSettingsCapabilities() {
|
|
8539
8697
|
return [];
|
|
8540
8698
|
}
|
|
8541
|
-
/** Override to provide global-level settings UI schema. */
|
|
8542
|
-
globalSettingsSchema(_cap) {
|
|
8543
|
-
return null;
|
|
8544
|
-
}
|
|
8545
8699
|
/** Override to provide device-level settings UI schema. */
|
|
8546
8700
|
deviceSettingsSchema() {
|
|
8547
8701
|
return null;
|
|
8548
8702
|
}
|
|
8549
8703
|
/**
|
|
8550
|
-
*
|
|
8551
|
-
* ARE the configuration of its integration.
|
|
8552
|
-
*
|
|
8553
|
-
* Return the `ConfigSection.id`s, from {@link globalSettingsSchema}, that an
|
|
8554
|
-
* operator should find on the addon's integration page (System →
|
|
8555
|
-
* Integrations → <name>) rather than only in the cluster-wide list of every
|
|
8556
|
-
* addon. Empty (the default) means the addon has no integration-level
|
|
8557
|
-
* settings and no such surface is offered — this is opt-in, because whether
|
|
8558
|
-
* an addon's configuration IS its integration's configuration depends on the
|
|
8559
|
-
* nature of the integration.
|
|
8560
|
-
*
|
|
8561
|
-
* WHAT THIS IS NOT. It is not a scope. The selected sections keep living in
|
|
8562
|
-
* the ONE global schema, in the ONE addon store, written by the ONE
|
|
8563
|
-
* `updateGlobalSettings` path. There is deliberately no
|
|
8564
|
-
* `updateIntegrationSettings`: a second write path is how a surface acquires
|
|
8565
|
-
* a second store key, and this repo has shipped that twice (`btmPath@hub`,
|
|
8566
|
-
* D266). Selecting sections cannot introduce a key that selecting cannot.
|
|
8567
|
-
*
|
|
8568
|
-
* WHY IT IS A LIST OF SECTION IDS AND NOT A MARKER ON THE SECTION.
|
|
8569
|
-
* `ConfigFieldBase` used to carry `scope?: 'device' | 'global'` and it was
|
|
8570
|
-
* removed with the reason recorded at
|
|
8571
|
-
* `packages/types/src/interfaces/config-ui.ts:249` — *"a field's scope is
|
|
8572
|
-
* determined by WHICH schema it lives in, not by a field-level marker."* A
|
|
8573
|
-
* marker sprinkled across sections also has to borrow a field that already
|
|
8574
|
-
* means something else; borrowing `section.tab` put the literal word
|
|
8575
|
-
* "integration" into an operator-facing tab bar, because `tab` means "how to
|
|
8576
|
-
* GROUP this visually" and cannot also mean "where this lives" (D269
|
|
8577
|
-
* supersedes D268). One declaration, in one place, next to the schema whose
|
|
8578
|
-
* ids it names.
|
|
8579
|
-
*/
|
|
8580
|
-
integrationSettingSections() {
|
|
8581
|
-
return [];
|
|
8582
|
-
}
|
|
8583
|
-
async getGlobalSettings(overlay, cap, nodeId) {
|
|
8584
|
-
await this.loadScopedSchemas(cap);
|
|
8585
|
-
const schema = this.globalSettingsSchema(cap) ?? this.scopedFormSchema(cap);
|
|
8586
|
-
if (!schema) return { sections: [] };
|
|
8587
|
-
const projected = await this.readRawProjectedStore(nodeId, cap);
|
|
8588
|
-
return hydrateSchema(schema, overlay ? await this.overlayKeepingMarkers(projected, overlay) : projected, { inlineSecretsAsViews: true });
|
|
8589
|
-
}
|
|
8590
|
-
/**
|
|
8591
|
-
* The integration-level view of this addon's settings: exactly the sections
|
|
8592
|
-
* named by {@link integrationSettingSections}, hydrated from the SAME store
|
|
8593
|
-
* `getGlobalSettings` reads, and narrowed to cluster-scoped fields.
|
|
8594
|
-
*
|
|
8595
|
-
* Returns `null` when the addon declared nothing — an addon that opts out has
|
|
8596
|
-
* no integration settings surface at all, rather than an empty one that reads
|
|
8597
|
-
* as a failed load.
|
|
8598
|
-
*
|
|
8599
|
-
* Three properties hold BY CONSTRUCTION, which is why they are here in core
|
|
8600
|
-
* and not in whichever UI happens to render this:
|
|
8601
|
-
*
|
|
8602
|
-
* 1. **One key.** The payload is a SUBSET of the global schema, so a field
|
|
8603
|
-
* shown here is the same field, with the same bare key, that the addon's
|
|
8604
|
-
* own page shows. There is no integration-specific writer — callers save
|
|
8605
|
-
* through `updateGlobalSettings` — so a second store key is unreachable,
|
|
8606
|
-
* not merely discouraged.
|
|
8607
|
-
* 2. **No node scope.** `perNode: true` fields are DROPPED. Their store key
|
|
8608
|
-
* is `<key>@<nodeId>` and an integration is not a node; whichever node
|
|
8609
|
-
* such a field silently picked would be a wrong answer for the operator
|
|
8610
|
-
* who opened the page (D266).
|
|
8611
|
-
* 3. **No silent typo.** A declared id that names no section throws. The
|
|
8612
|
-
* alternative — skip it — turns a rename into a surface that quietly
|
|
8613
|
-
* empties, which looks exactly like an addon with nothing to configure.
|
|
8614
|
-
*/
|
|
8615
|
-
/**
|
|
8616
|
-
* 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.
|
|
8617
8705
|
*
|
|
8618
8706
|
* Override it only when an `instanceMode: multiple` addon's instances differ: an NVR integration
|
|
8619
8707
|
* needs its connection fields, the default integration the addon's own sections. It is the
|
|
@@ -8661,37 +8749,178 @@ var BaseAddon = class {
|
|
|
8661
8749
|
}
|
|
8662
8750
|
}
|
|
8663
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
|
+
/**
|
|
8664
8910
|
* What the create wizard and the integration edit page render for one instance: the addon's
|
|
8665
8911
|
* per-instance schema when it declares one, else its global schema (what they always showed).
|
|
8666
8912
|
*/
|
|
8667
8913
|
async getIntegrationFormSchema(instance, nodeId) {
|
|
8668
8914
|
const scoped = await this.integrationFormSchema(instance);
|
|
8669
|
-
if (scoped === null) return this.
|
|
8915
|
+
if (scoped === null) return this.scopedForm(nodeId);
|
|
8670
8916
|
return hydrateSchema(scoped, {}, { inlineSecretsAsViews: true });
|
|
8671
8917
|
}
|
|
8672
|
-
|
|
8673
|
-
|
|
8674
|
-
|
|
8675
|
-
const schema = this.
|
|
8676
|
-
if (!schema)
|
|
8677
|
-
|
|
8678
|
-
const sections = [];
|
|
8679
|
-
for (const id of declared) {
|
|
8680
|
-
const section = byId.get(id);
|
|
8681
|
-
if (!section) throw new Error(`${this.constructor.name}: integrationSettingSections() names unknown section "${id}". Known sections: [${[...byId.keys()].join(", ")}].`);
|
|
8682
|
-
const fields = dropPerNodeFields(section.fields);
|
|
8683
|
-
if (fields.length === 0) continue;
|
|
8684
|
-
sections.push({
|
|
8685
|
-
...section,
|
|
8686
|
-
fields
|
|
8687
|
-
});
|
|
8688
|
-
}
|
|
8689
|
-
if (sections.length === 0) return null;
|
|
8690
|
-
const projected = await this.readRawProjectedStore(nodeId);
|
|
8691
|
-
return hydrateSchema({
|
|
8692
|
-
...schema,
|
|
8693
|
-
sections
|
|
8694
|
-
}, 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 });
|
|
8695
8924
|
}
|
|
8696
8925
|
/**
|
|
8697
8926
|
* The raw addon store PROJECTED onto the target node's bare per-node keys:
|
|
@@ -8700,8 +8929,8 @@ var BaseAddon = class {
|
|
|
8700
8929
|
* bare fallback), all `@`-scoped and stray bare per-node keys are dropped.
|
|
8701
8930
|
* A no-op passthrough when the schema declares no `perNode` field.
|
|
8702
8931
|
*
|
|
8703
|
-
* This is the sanctioned way for
|
|
8704
|
-
* 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
|
|
8705
8934
|
* read it per-node — never `ctx.settings.readAddonStore()` directly.
|
|
8706
8935
|
* `nodeId` omitted ⇒ the local node (node-blind injection from ctx).
|
|
8707
8936
|
*
|
|
@@ -8753,7 +8982,7 @@ var BaseAddon = class {
|
|
|
8753
8982
|
}
|
|
8754
8983
|
/**
|
|
8755
8984
|
* Whether ONE global key of this addon's store was written, read three-way
|
|
8756
|
-
* (D651). For a question a hydrated view cannot answer:
|
|
8985
|
+
* (D651). For a question a hydrated view cannot answer: a hydrated form
|
|
8757
8986
|
* reports `value ?? default`, so "the operator chose the default" and "nobody
|
|
8758
8987
|
* chose" look the same, and a failed read looks like both. A `perNode` key is
|
|
8759
8988
|
* not supported here: its stored name is scoped.
|
|
@@ -8787,7 +9016,7 @@ var BaseAddon = class {
|
|
|
8787
9016
|
}
|
|
8788
9017
|
/**
|
|
8789
9018
|
* The OPERATOR's write — a settings form or an admin API call, dispatched by
|
|
8790
|
-
* the kernel.
|
|
9019
|
+
* the kernel. The one in-process write of the addon blob that is not a scoped write; a secret
|
|
8791
9020
|
* the operator sends is stored as sent even when it equals a pre-keychain
|
|
8792
9021
|
* inline value: the operator re-entering a password is a change, an addon
|
|
8793
9022
|
* writing back what it read is not (D787).
|
|
@@ -8800,9 +9029,6 @@ var BaseAddon = class {
|
|
|
8800
9029
|
this._operatorWriteDepth--;
|
|
8801
9030
|
}
|
|
8802
9031
|
}
|
|
8803
|
-
async updateGlobalSettings(patch, nodeId) {
|
|
8804
|
-
await this.applyGlobalPatch(patch, nodeId);
|
|
8805
|
-
}
|
|
8806
9032
|
/**
|
|
8807
9033
|
* REMOVE stored secrets — their keychain values and their markers (D787).
|
|
8808
9034
|
*
|
|
@@ -8812,6 +9038,9 @@ var BaseAddon = class {
|
|
|
8812
9038
|
* a keychain (an older kernel) it writes `''`, as such code always did.
|
|
8813
9039
|
*/
|
|
8814
9040
|
async clearSecrets(keys, nodeId) {
|
|
9041
|
+
await this.clearSecretKeys(keys, nodeId);
|
|
9042
|
+
}
|
|
9043
|
+
async clearSecretKeys(keys, nodeId, cap) {
|
|
8815
9044
|
const tree = this.addonSecretTree();
|
|
8816
9045
|
const keychain = this._ctx?.secrets !== void 0;
|
|
8817
9046
|
const stored = keychain ? await this.readAddonStoreWithRetry() : {};
|
|
@@ -8824,25 +9053,26 @@ var BaseAddon = class {
|
|
|
8824
9053
|
const keychainStored = tree.has(key) || collectSecretMarkerRefs(stored[key]).length > 0;
|
|
8825
9054
|
patch[key] = keychain && keychainStored ? SECRET_CLEAR : "";
|
|
8826
9055
|
}
|
|
8827
|
-
await this.applyGlobalPatch(patch, nodeId);
|
|
9056
|
+
await this.applyGlobalPatch(patch, nodeId, cap);
|
|
8828
9057
|
}
|
|
8829
|
-
|
|
8830
|
-
|
|
8831
|
-
|
|
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);
|
|
8832
9062
|
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
8833
9063
|
const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
8834
9064
|
const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
|
|
8835
9065
|
const handle = this._secretSettings;
|
|
8836
9066
|
if (handle !== null) {
|
|
8837
9067
|
const { changed } = await handle.writeAddonStore(scoped);
|
|
8838
|
-
if (!changed) return;
|
|
9068
|
+
if (!changed) return false;
|
|
8839
9069
|
} else await this._ctx?.settings?.writeAddonStore(scoped);
|
|
8840
|
-
if (target !== localNode) return;
|
|
9070
|
+
if (target !== localNode) return true;
|
|
8841
9071
|
await this.resolveConfig();
|
|
8842
9072
|
await this.onConfigChanged();
|
|
8843
9073
|
this.emitLifecycle(EventCategory.AddonUpdated, { level: "global" });
|
|
8844
|
-
|
|
8845
|
-
|
|
9074
|
+
this.maybeAutoRestart(Object.keys(barePatch), this.loadedScopedSchemas().map((entry) => entry.schema));
|
|
9075
|
+
return true;
|
|
8846
9076
|
}
|
|
8847
9077
|
/**
|
|
8848
9078
|
* The set of field keys the global settings schema declares `perNode: true`
|
|
@@ -8879,10 +9109,7 @@ var BaseAddon = class {
|
|
|
8879
9109
|
this._nodeKeysByCap = /* @__PURE__ */ new Map();
|
|
8880
9110
|
this._addonSecretTree = null;
|
|
8881
9111
|
}
|
|
8882
|
-
/**
|
|
8883
|
-
* The form the settings API serves while an addon declares no {@link globalSettingsSchema}: the
|
|
8884
|
-
* sections of its scoped schemas, so dropping the old hook does not blank the form.
|
|
8885
|
-
*/
|
|
9112
|
+
/** The form of an addon's scoped schemas: their sections, each shown once. */
|
|
8886
9113
|
scopedFormSchema(cap) {
|
|
8887
9114
|
const byId = /* @__PURE__ */ new Map();
|
|
8888
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);
|
|
@@ -8894,8 +9121,7 @@ var BaseAddon = class {
|
|
|
8894
9121
|
return [...this._scopedByCap.values()].flat();
|
|
8895
9122
|
}
|
|
8896
9123
|
/**
|
|
8897
|
-
* The field keys that are stored per node: every field of a {@link nodeSettingsSchema}
|
|
8898
|
-
* 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
|
|
8899
9125
|
* per `cap` argument and memoized (schemas are static declarations). Empty set ⇒ every
|
|
8900
9126
|
* per-node code path is bypassed and the settings API behaves like the node-agnostic one.
|
|
8901
9127
|
* Call {@link loadScopedSchemas} first (the async seams do).
|
|
@@ -8904,8 +9130,7 @@ var BaseAddon = class {
|
|
|
8904
9130
|
const cacheKey = cap ?? "";
|
|
8905
9131
|
const cached = this._nodeKeysByCap.get(cacheKey);
|
|
8906
9132
|
if (cached) return cached;
|
|
8907
|
-
const
|
|
8908
|
-
const keys = new Set(legacy ? legacy.sections.flatMap((section) => collectPerNodeFieldKeys(section.fields)) : []);
|
|
9133
|
+
const keys = /* @__PURE__ */ new Set();
|
|
8909
9134
|
for (const { scope, schema } of this.loadedScopedSchemas(cap)) {
|
|
8910
9135
|
if (scope !== "node") continue;
|
|
8911
9136
|
for (const section of schema.sections) for (const key of collectValueFieldKeys(section.fields)) keys.add(key);
|
|
@@ -9123,8 +9348,6 @@ var BaseAddon = class {
|
|
|
9123
9348
|
}
|
|
9124
9349
|
declaredKeySet() {
|
|
9125
9350
|
const keys = new Set(Object.keys(this.defaults));
|
|
9126
|
-
const schema = this.globalSettingsSchema();
|
|
9127
|
-
if (schema) for (const section of schema.sections) for (const key of collectFieldKeys(section.fields)) keys.add(key);
|
|
9128
9351
|
for (const { schema: scoped } of this.loadedScopedSchemas()) for (const section of scoped.sections) for (const key of collectFieldKeys(section.fields)) keys.add(key);
|
|
9129
9352
|
for (const key of this._declaredStateKeys) keys.add(key);
|
|
9130
9353
|
for (const path of this.secretStatePaths) {
|
|
@@ -9222,7 +9445,7 @@ var BaseAddon = class {
|
|
|
9222
9445
|
/** The addon store's secret tree: schema fields by TYPE, plus `secretStatePaths`. */
|
|
9223
9446
|
addonSecretTree() {
|
|
9224
9447
|
if (this._addonSecretTree === null) {
|
|
9225
|
-
const tree = new Map(
|
|
9448
|
+
const tree = /* @__PURE__ */ new Map();
|
|
9226
9449
|
for (const { schema } of this.loadedScopedSchemas()) for (const [key, node] of secretTreeFromSchema(schema)) tree.set(key, node);
|
|
9227
9450
|
this._addonSecretTree = mergeSecretStatePaths(tree, this.secretStatePaths);
|
|
9228
9451
|
}
|
|
@@ -9434,47 +9657,6 @@ function classifyStoreError(err) {
|
|
|
9434
9657
|
if (TRANSPORT_PHRASES.some((f) => message.includes(f))) return "transport";
|
|
9435
9658
|
return "permanent";
|
|
9436
9659
|
}
|
|
9437
|
-
/**
|
|
9438
|
-
* Collect the keys of every field marked `perNode: true`, recursing into
|
|
9439
|
-
* layout containers (`group` fields and `sub-tabs` tabs) the same way
|
|
9440
|
-
* `hydrateSchema` does. Valueless structural fields (separator/info/…)
|
|
9441
|
-
* don't declare `perNode` and are excluded by the `in` narrowing.
|
|
9442
|
-
*/
|
|
9443
|
-
/**
|
|
9444
|
-
* The same fields with every `perNode: true` one removed, recursing into layout
|
|
9445
|
-
* containers exactly as {@link collectPerNodeFieldKeys} does. A container left
|
|
9446
|
-
* with no child is dropped rather than rendered empty.
|
|
9447
|
-
*
|
|
9448
|
-
* Used by `getIntegrationSettings`: an integration is not a node, so a field
|
|
9449
|
-
* whose store key is `<key>@<nodeId>` has no node to belong to there.
|
|
9450
|
-
*/
|
|
9451
|
-
function dropPerNodeFields(fields) {
|
|
9452
|
-
const kept = [];
|
|
9453
|
-
for (const field of fields) {
|
|
9454
|
-
if (field.type === "group") {
|
|
9455
|
-
const inner = dropPerNodeFields(field.fields);
|
|
9456
|
-
if (inner.length > 0) kept.push({
|
|
9457
|
-
...field,
|
|
9458
|
-
fields: inner
|
|
9459
|
-
});
|
|
9460
|
-
continue;
|
|
9461
|
-
}
|
|
9462
|
-
if (field.type === "sub-tabs") {
|
|
9463
|
-
const tabs = field.tabs.map((tab) => ({
|
|
9464
|
-
...tab,
|
|
9465
|
-
fields: dropPerNodeFields(tab.fields)
|
|
9466
|
-
})).filter((tab) => tab.fields.length > 0);
|
|
9467
|
-
if (tabs.length > 0) kept.push({
|
|
9468
|
-
...field,
|
|
9469
|
-
tabs
|
|
9470
|
-
});
|
|
9471
|
-
continue;
|
|
9472
|
-
}
|
|
9473
|
-
if ("perNode" in field && field.perNode === true) continue;
|
|
9474
|
-
kept.push(field);
|
|
9475
|
-
}
|
|
9476
|
-
return kept;
|
|
9477
|
-
}
|
|
9478
9660
|
/** The keys of the value-holding fields, recursing into layout containers. */
|
|
9479
9661
|
function collectValueFieldKeys(fields) {
|
|
9480
9662
|
const collected = [];
|
|
@@ -9507,21 +9689,6 @@ function collectFieldKeys(fields) {
|
|
|
9507
9689
|
}
|
|
9508
9690
|
return collected;
|
|
9509
9691
|
}
|
|
9510
|
-
function collectPerNodeFieldKeys(fields) {
|
|
9511
|
-
const collected = [];
|
|
9512
|
-
for (const field of fields) {
|
|
9513
|
-
if (field.type === "group") {
|
|
9514
|
-
collected.push(...collectPerNodeFieldKeys(field.fields));
|
|
9515
|
-
continue;
|
|
9516
|
-
}
|
|
9517
|
-
if (field.type === "sub-tabs") {
|
|
9518
|
-
for (const tab of field.tabs) collected.push(...collectPerNodeFieldKeys(tab.fields));
|
|
9519
|
-
continue;
|
|
9520
|
-
}
|
|
9521
|
-
if ("perNode" in field && field.perNode === true) collected.push(field.key);
|
|
9522
|
-
}
|
|
9523
|
-
return collected;
|
|
9524
|
-
}
|
|
9525
9692
|
/**
|
|
9526
9693
|
* Normalize an `ICamstackAddon.initialize()` return value into the
|
|
9527
9694
|
* `AddonInitResult` envelope. Arrays are wrapped into `{ providers }`;
|
|
@@ -10615,7 +10782,6 @@ var CAP_NAMES = Object.freeze([
|
|
|
10615
10782
|
"notifier",
|
|
10616
10783
|
"numeric-sensor",
|
|
10617
10784
|
"oauth-integration",
|
|
10618
|
-
"oidc-connections",
|
|
10619
10785
|
"osd",
|
|
10620
10786
|
"osd-manager",
|
|
10621
10787
|
"pet-feeder",
|
|
@@ -12322,13 +12488,25 @@ Object.freeze({
|
|
|
12322
12488
|
"path": "temperature",
|
|
12323
12489
|
"valueType": "number"
|
|
12324
12490
|
}],
|
|
12325
|
-
"timed-run": [
|
|
12326
|
-
|
|
12327
|
-
|
|
12328
|
-
|
|
12329
|
-
|
|
12330
|
-
|
|
12331
|
-
|
|
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
|
+
],
|
|
12332
12510
|
"update": [
|
|
12333
12511
|
{
|
|
12334
12512
|
"path": "currentVersion",
|
|
@@ -12507,8 +12685,7 @@ Object.freeze({
|
|
|
12507
12685
|
"device-provider": { "reloadDevice": 18e4 },
|
|
12508
12686
|
"llm": {
|
|
12509
12687
|
"generate": 6e5,
|
|
12510
|
-
"generateVision": 6e5
|
|
12511
|
-
"testProfile": 6e5
|
|
12688
|
+
"generateVision": 6e5
|
|
12512
12689
|
},
|
|
12513
12690
|
"llm-runtime": {
|
|
12514
12691
|
"complete": 6e5,
|
|
@@ -12553,7 +12730,7 @@ object({
|
|
|
12553
12730
|
params: record(string(), union([string(), number()])).optional()
|
|
12554
12731
|
});
|
|
12555
12732
|
//#endregion
|
|
12556
|
-
//#region ../types/dist/composition-
|
|
12733
|
+
//#region ../types/dist/composition-Bx0JvKUU.mjs
|
|
12557
12734
|
/**
|
|
12558
12735
|
* The ffmpeg build every CamStack node downloads, per platform and arch.
|
|
12559
12736
|
*
|
|
@@ -13715,442 +13892,828 @@ var NodeColorIdSchema = _enum([
|
|
|
13715
13892
|
"node-h"
|
|
13716
13893
|
]);
|
|
13717
13894
|
//#endregion
|
|
13718
|
-
//#region ../types/dist/
|
|
13719
|
-
var SMTP_INBOUND_DEFAULT_PORT = 2525;
|
|
13720
|
-
var SMTP_INBOUND_DEFAULT_DOMAIN = "camstack.local";
|
|
13721
|
-
var SMTP_INBOUND_DEFAULT_MAX_MESSAGE_BYTES = 25 * 1024 * 1024;
|
|
13722
|
-
/** The text excerpt a message carries on the bus. */
|
|
13723
|
-
var SMTP_INBOUND_TEXT_MAX_CHARS = 4096;
|
|
13724
|
-
var PortSchema = number().int().min(1).max(65535);
|
|
13725
|
-
/** A recipient local-part: what stands before the `@`. */
|
|
13726
|
-
var SmtpRecipientSchema = string().min(1).max(64).regex(/^[A-Za-z0-9._+-]+$/);
|
|
13727
|
-
object({
|
|
13728
|
-
port: PortSchema.default(SMTP_INBOUND_DEFAULT_PORT),
|
|
13729
|
-
bindHost: string().min(1).default("0.0.0.0"),
|
|
13730
|
-
domain: string().min(1).default(SMTP_INBOUND_DEFAULT_DOMAIN),
|
|
13731
|
-
requireAuth: boolean().default(true),
|
|
13732
|
-
username: string().default(""),
|
|
13733
|
-
password: string().default("").meta({ secret: true }),
|
|
13734
|
-
starttls: boolean().default(false),
|
|
13735
|
-
maxMessageBytes: number().int().positive().default(SMTP_INBOUND_DEFAULT_MAX_MESSAGE_BYTES)
|
|
13736
|
-
});
|
|
13737
|
-
object({
|
|
13738
|
-
host: string().min(1).nullable(),
|
|
13739
|
-
hostReason: string().nullable(),
|
|
13740
|
-
port: PortSchema,
|
|
13741
|
-
domain: string().min(1),
|
|
13742
|
-
requireAuth: boolean(),
|
|
13743
|
-
username: string(),
|
|
13744
|
-
password: string(),
|
|
13745
|
-
starttls: boolean()
|
|
13746
|
-
});
|
|
13747
|
-
object({
|
|
13748
|
-
recipients: array(SmtpRecipientSchema).min(1),
|
|
13749
|
-
/**
|
|
13750
|
-
* Who is subscribing. A second `subscribe` with the same id REPLACES that subscriber's
|
|
13751
|
-
* recipients (the way a consumer that restarted, or lost a device, declares its set again);
|
|
13752
|
-
* a recipient held by another subscriber is refused with `smtp-inbound/recipient-claimed`.
|
|
13753
|
-
* Absent, the subscriber is anonymous and unique.
|
|
13754
|
-
*/
|
|
13755
|
-
subscriberId: string().min(1).max(64).optional()
|
|
13756
|
-
});
|
|
13757
|
-
var SmtpInboundAttachmentSchema = object({
|
|
13758
|
-
filename: string(),
|
|
13759
|
-
contentType: string(),
|
|
13760
|
-
bytes: number().int().nonnegative()
|
|
13761
|
-
});
|
|
13762
|
-
/** The payload of one `broker.message` (the key is the recipient local-part). */
|
|
13763
|
-
var SmtpInboundMessageSchema = object({
|
|
13764
|
-
/** Monotonic per mailbox; a gap tells a consumer it missed an event. */
|
|
13765
|
-
seq: number().int().positive(),
|
|
13766
|
-
messageId: string(),
|
|
13767
|
-
receivedAt: number().int().nonnegative(),
|
|
13768
|
-
from: string(),
|
|
13769
|
-
to: string(),
|
|
13770
|
-
subject: string(),
|
|
13771
|
-
text: string().max(SMTP_INBOUND_TEXT_MAX_CHARS),
|
|
13772
|
-
attachments: array(SmtpInboundAttachmentSchema)
|
|
13773
|
-
});
|
|
13774
|
-
object({
|
|
13775
|
-
/** The newest seq issued so far (0 before any mail). */
|
|
13776
|
-
lastSeq: number().int().nonnegative(),
|
|
13777
|
-
/** The oldest seq still retained; messages below it are gone. */
|
|
13778
|
-
oldestSeq: number().int().nonnegative(),
|
|
13779
|
-
messages: array(object({
|
|
13780
|
-
key: string(),
|
|
13781
|
-
message: SmtpInboundMessageSchema
|
|
13782
|
-
}))
|
|
13783
|
-
});
|
|
13784
|
-
new Set([
|
|
13785
|
-
"track",
|
|
13786
|
-
"face",
|
|
13787
|
-
"identity",
|
|
13788
|
-
"plate",
|
|
13789
|
-
"vehicle",
|
|
13790
|
-
"scene",
|
|
13791
|
-
"motion",
|
|
13792
|
-
"object",
|
|
13793
|
-
"audio",
|
|
13794
|
-
"mosaic"
|
|
13795
|
-
]);
|
|
13796
|
-
/**
|
|
13797
|
-
* The owner types that are event tables, in the order the event-media resolver
|
|
13798
|
-
* should consider them. Exported so a consumer asking "is this key an event?"
|
|
13799
|
-
* does not re-spell the list and drift from it.
|
|
13800
|
-
*/
|
|
13801
|
-
var EVENT_OWNER_TYPES = [
|
|
13802
|
-
"motion",
|
|
13803
|
-
"object",
|
|
13804
|
-
"audio"
|
|
13805
|
-
];
|
|
13806
|
-
/**
|
|
13807
|
-
* The same list as a Zod enum, for the cap inputs that must NAME the table
|
|
13808
|
-
* (D482: `getEventMedia` / `listEventMedia` take an owner, and an owner is
|
|
13809
|
-
* `(table, id)`).
|
|
13810
|
-
*
|
|
13811
|
-
* Built FROM {@link EVENT_OWNER_TYPES} rather than re-spelled: a fourth event
|
|
13812
|
-
* table would otherwise be accepted by the codec and refused at the door, with
|
|
13813
|
-
* nothing failing until a caller asked.
|
|
13814
|
-
*/
|
|
13815
|
-
var EventOwnerTypeSchema = _enum(EVENT_OWNER_TYPES);
|
|
13816
|
-
/** The same list as a Zod enum, for the cap input that carries it. */
|
|
13817
|
-
var MediaPresenceOwnerKindSchema = _enum([...EVENT_OWNER_TYPES, "track"]);
|
|
13818
|
-
new Set(EVENT_OWNER_TYPES);
|
|
13819
|
-
/**
|
|
13820
|
-
* What a published package needs from the rest of the install (D989).
|
|
13821
|
-
*
|
|
13822
|
-
* One published framework package (`@camstack/server`) carries the kernel, the
|
|
13823
|
-
* builtins and the capability contracts, so "which addon runs on which
|
|
13824
|
-
* framework" is a question of version, and the answer is DECLARED by the
|
|
13825
|
-
* package that knows it:
|
|
13826
|
-
*
|
|
13827
|
-
* - an addon says the oldest server it runs on (`requires.server: ">=X"`);
|
|
13828
|
-
* - the server says the oldest addon it works with
|
|
13829
|
-
* (`requires.addons: { "@camstack/addon-x": ">=Y" }`) and the oldest shell
|
|
13830
|
-
* around it (`requires.wrapper: { desktop, image }`);
|
|
13831
|
-
* - a wrapper (the desktop app, the container starter) says which server
|
|
13832
|
-
* range it can host, and reports its own kind and version.
|
|
13833
|
-
*
|
|
13834
|
-
* The publish workflow STAMPS these after the version bump
|
|
13835
|
-
* (`scripts/ci/stamp-requires.mjs`); nobody types a number by hand.
|
|
13836
|
-
*
|
|
13837
|
-
* A requirement that cannot be checked is NOT met: a shell that reports no
|
|
13838
|
-
* version counts as below the minimum, and an unreadable running version is
|
|
13839
|
-
* named in the result (a failed read is never a pass).
|
|
13840
|
-
*/
|
|
13841
|
-
/** `>=MAJOR.MINOR.PATCH[-prerelease]` — the only range shape a requirement uses. */
|
|
13842
|
-
var MinVersionSchema = string().regex(/^>=\d+\.\d+\.\d+(-[0-9A-Za-z.-]+)?$/, "a minimum is written \">=X.Y.Z\"");
|
|
13843
|
-
object({
|
|
13844
|
-
/** The oldest `@camstack/server` this package runs on. */
|
|
13845
|
-
server: MinVersionSchema.optional(),
|
|
13846
|
-
/** The oldest installed version of each named addon package. */
|
|
13847
|
-
addons: record(string(), MinVersionSchema).optional(),
|
|
13848
|
-
/** The oldest shell around the server, per shell kind. */
|
|
13849
|
-
wrapper: object({
|
|
13850
|
-
desktop: MinVersionSchema.optional(),
|
|
13851
|
-
image: MinVersionSchema.optional()
|
|
13852
|
-
}).optional()
|
|
13853
|
-
});
|
|
13854
|
-
/** One unmet requirement; each names the versions on both sides. */
|
|
13855
|
-
var UnmetRequirementSchema = discriminatedUnion("kind", [
|
|
13856
|
-
object({
|
|
13857
|
-
kind: literal("server-too-old"),
|
|
13858
|
-
required: string(),
|
|
13859
|
-
/** `null` — the running server version could not be read. */
|
|
13860
|
-
running: string().nullable()
|
|
13861
|
-
}),
|
|
13862
|
-
object({
|
|
13863
|
-
kind: literal("addon-too-old"),
|
|
13864
|
-
packageName: string(),
|
|
13865
|
-
required: string(),
|
|
13866
|
-
/** `null` — the addon is not installed (or its version is unreadable). */
|
|
13867
|
-
running: string().nullable()
|
|
13868
|
-
}),
|
|
13869
|
-
object({
|
|
13870
|
-
kind: literal("wrapper-too-old"),
|
|
13871
|
-
wrapper: _enum(["desktop", "image"]),
|
|
13872
|
-
required: string(),
|
|
13873
|
-
/** `null` — the wrapper reported no version. */
|
|
13874
|
-
running: string().nullable()
|
|
13875
|
-
})
|
|
13876
|
-
]);
|
|
13877
|
-
var RequiredAddonUpdateSchema = object({
|
|
13878
|
-
packageName: string(),
|
|
13879
|
-
/** The minimum the target server declares. */
|
|
13880
|
-
required: string(),
|
|
13881
|
-
/** What this node has; `null` when the addon is not installed. */
|
|
13882
|
-
installed: string().nullable()
|
|
13883
|
-
});
|
|
13884
|
-
/**
|
|
13885
|
-
* Which integration instance a settings form is for. An addon that serves several instances
|
|
13886
|
-
* (`instanceMode: multiple`) can show a different form per instance — an NVR integration
|
|
13887
|
-
* needs its connection, the default integration needs the addon's own sections.
|
|
13888
|
-
*
|
|
13889
|
-
* - `integrationId` is `null` in the create wizard: nothing exists yet, the operator is
|
|
13890
|
-
* setting up a NEW instance.
|
|
13891
|
-
* - `mode` is the wizard mode of the integration type (`getAvailableTypes`).
|
|
13892
|
-
* - `candidateStableId` is the discovery candidate a wizard was seeded from, if any.
|
|
13893
|
-
*/
|
|
13894
|
-
var IntegrationInstanceRefSchema = object({
|
|
13895
|
-
integrationId: string().nullable(),
|
|
13896
|
-
mode: _enum([
|
|
13897
|
-
"standalone",
|
|
13898
|
-
"account",
|
|
13899
|
-
"broker"
|
|
13900
|
-
]),
|
|
13901
|
-
candidateStableId: string().optional()
|
|
13902
|
-
});
|
|
13903
|
-
/**
|
|
13904
|
-
* notification-output — canonical, capability-gated notification delivery.
|
|
13905
|
-
*
|
|
13906
|
-
* Apprise-derived model (see
|
|
13907
|
-
* `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
|
|
13908
|
-
* callers emit ONE canonical `Notification`; each provider declares a
|
|
13909
|
-
* per-kind capability descriptor (`TargetKind`), and the pure degrade
|
|
13910
|
-
* engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
|
|
13911
|
-
* message to what the kind supports — callers never special-case a service.
|
|
13912
|
-
*
|
|
13913
|
-
* DESIGN DECISIONS (locked):
|
|
13914
|
-
* - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
|
|
13915
|
-
* `setTargetEnabled`), each provider persisting via the `settings-store`
|
|
13916
|
-
* cap. Rationale: the admin UI needs one uniform surface across the
|
|
13917
|
-
* notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
|
|
13918
|
-
* alternative would fork the UI per addon and cannot host the
|
|
13919
|
-
* discovery→adopt flow.
|
|
13920
|
-
* - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
|
|
13921
|
-
* the generated cap-mount auto-`concatCollection`-fans them across every
|
|
13922
|
-
* registered provider (notifiers addon + HA addon) so one catalog is
|
|
13923
|
-
* routable. `send` / `testTarget` / CRUD route to ONE provider by the
|
|
13924
|
-
* `addonId` the generated collection router extracts from the call input.
|
|
13925
|
-
* - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
|
|
13926
|
-
* transformer) + UDS MsgPack both round-trip typed arrays — already used by
|
|
13927
|
-
* `storage` / `storage-provider` / `recording` caps over the same path. No
|
|
13928
|
-
* base64 fallback needed.
|
|
13929
|
-
*
|
|
13930
|
-
* TODO (deferred, closed-set change — separate decision): add
|
|
13931
|
-
* `providerKind: 'notify'` so notification providers surface on the unified
|
|
13932
|
-
* admin "Integrations" page.
|
|
13933
|
-
*/
|
|
13934
|
-
/**
|
|
13935
|
-
* Zentik-derived typed-media enum — the superset across every kind. Each
|
|
13936
|
-
* adapter picks what it supports and the degrade engine filters the rest.
|
|
13937
|
-
*/
|
|
13938
|
-
var AttachmentMediaTypeSchema = _enum([
|
|
13939
|
-
"image",
|
|
13940
|
-
"video",
|
|
13941
|
-
"gif",
|
|
13942
|
-
"audio",
|
|
13943
|
-
"icon"
|
|
13944
|
-
]);
|
|
13945
|
-
/**
|
|
13946
|
-
* A single attachment. Exactly one of `url` (remote source, most adapters
|
|
13947
|
-
* prefer this) or `bytes` (inline source; required for Pushover-style
|
|
13948
|
-
* bytes-only kinds) MUST be present — the degrade engine expresses a
|
|
13949
|
-
* url→bytes fetch as a `needsFetch` directive the adapter executes.
|
|
13950
|
-
*/
|
|
13951
|
-
var AttachmentSchema = object({
|
|
13952
|
-
mediaType: AttachmentMediaTypeSchema,
|
|
13953
|
-
url: string().optional(),
|
|
13954
|
-
bytes: _instanceof(Uint8Array).optional(),
|
|
13955
|
-
mime: string().optional(),
|
|
13956
|
-
name: string().optional()
|
|
13957
|
-
}).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
|
|
13958
|
-
var NotificationFormatSchema = _enum([
|
|
13959
|
-
"text",
|
|
13960
|
-
"markdown",
|
|
13961
|
-
"html"
|
|
13962
|
-
]);
|
|
13895
|
+
//#region ../types/dist/convert-BAzH15HU.mjs
|
|
13963
13896
|
/**
|
|
13964
|
-
*
|
|
13965
|
-
*
|
|
13966
|
-
*
|
|
13967
|
-
*
|
|
13968
|
-
* notices — the same class of gap as a zone vocabulary nothing produced
|
|
13969
|
-
* ([D35](../../../docs/decisions/adr-0035.md)). Every adapter maps this set or
|
|
13970
|
-
* declares `actionIcons: false` and the degrade engine strips the field.
|
|
13971
|
-
*
|
|
13972
|
-
* Named by INTENT, never by glyph. "check" would tie the vocabulary to one
|
|
13973
|
-
* renderer's icon set; "acknowledge" survives an adapter that draws it
|
|
13974
|
-
* differently.
|
|
13975
|
-
*
|
|
13976
|
-
* ── A TOKEN IS NOT A WIRE VALUE ─────────────────────────────────────
|
|
13977
|
-
*
|
|
13978
|
-
* These names are for US. **No adapter may forward one verbatim.** Each maps
|
|
13979
|
-
* the whole set onto its own renderer's vocabulary through a
|
|
13980
|
-
* `Record<NotificationActionIcon, string>` — a Record, never a lookup with a
|
|
13981
|
-
* fallback, so adding a member here fails every adapter's build until someone
|
|
13982
|
-
* decides its glyph, which is the only place that decision can be made
|
|
13983
|
-
* honestly.
|
|
13984
|
-
*
|
|
13985
|
-
* This paragraph is the bug. Zentik declared `actionIcons: true` and passed
|
|
13986
|
-
* `disarm` straight through; iOS feeds that string to
|
|
13987
|
-
* `UNNotificationActionIcon(systemImageName:)`, `disarm` is not an SF Symbol,
|
|
13988
|
-
* and every snooze and alarm button arrived BLANK. A pass-through is not a
|
|
13989
|
-
* mapping, and "the field is documented" is not "the value renders".
|
|
13990
|
-
*
|
|
13991
|
-
* Adding a member is TRAIN-BOUND. The enum lives in the published
|
|
13992
|
-
* `@camstack/server` closure and the cap seam validates against the HUB's copy,
|
|
13993
|
-
* so an addon that emits a token the running hub does not know does not lose an
|
|
13994
|
-
* icon — its whole `send` fails Zod validation and the notification never
|
|
13995
|
-
* 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`.
|
|
13996
13901
|
*/
|
|
13997
|
-
var
|
|
13998
|
-
"
|
|
13999
|
-
|
|
14000
|
-
|
|
14001
|
-
|
|
14002
|
-
|
|
14003
|
-
"
|
|
14004
|
-
|
|
14005
|
-
|
|
14006
|
-
|
|
14007
|
-
|
|
14008
|
-
|
|
14009
|
-
|
|
14010
|
-
|
|
14011
|
-
|
|
14012
|
-
|
|
14013
|
-
|
|
14014
|
-
|
|
14015
|
-
|
|
14016
|
-
|
|
14017
|
-
|
|
14018
|
-
|
|
14019
|
-
|
|
14020
|
-
|
|
14021
|
-
|
|
14022
|
-
|
|
14023
|
-
|
|
14024
|
-
|
|
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
|
-
|
|
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
|
+
}
|
|
14055
14265
|
/**
|
|
14056
|
-
*
|
|
14057
|
-
*
|
|
14058
|
-
*
|
|
14059
|
-
* no editor knows a service by name.
|
|
14060
|
-
*
|
|
14061
|
-
* Optional fields are `.optional()`, never `.default()` (a Zod default does not
|
|
14062
|
-
* run on the addon cap path).
|
|
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.
|
|
14063
14269
|
*/
|
|
14064
|
-
|
|
14065
|
-
|
|
14066
|
-
|
|
14067
|
-
|
|
14068
|
-
|
|
14069
|
-
|
|
14070
|
-
|
|
14071
|
-
|
|
14072
|
-
|
|
14073
|
-
|
|
14074
|
-
|
|
14075
|
-
|
|
14076
|
-
|
|
14077
|
-
|
|
14078
|
-
|
|
14079
|
-
|
|
14080
|
-
|
|
14081
|
-
|
|
14082
|
-
|
|
14083
|
-
|
|
14084
|
-
|
|
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)
|
|
14085
14298
|
});
|
|
14086
|
-
|
|
14087
|
-
|
|
14088
|
-
|
|
14089
|
-
|
|
14090
|
-
|
|
14091
|
-
|
|
14092
|
-
|
|
14093
|
-
|
|
14094
|
-
|
|
14095
|
-
|
|
14096
|
-
|
|
14097
|
-
|
|
14098
|
-
priority: number().int().min(1).max(5).default(3),
|
|
14099
|
-
level: string().optional(),
|
|
14100
|
-
attachments: array(AttachmentSchema).optional(),
|
|
14101
|
-
clickUrl: string().optional(),
|
|
14102
|
-
actions: array(NotificationActionSchema).optional(),
|
|
14103
|
-
sound: string().optional(),
|
|
14104
|
-
ttl: number().optional(),
|
|
14105
|
-
tag: string().optional(),
|
|
14106
|
-
deviceId: number().optional(),
|
|
14107
|
-
eventId: string().optional(),
|
|
14108
|
-
metadata: record(string(), unknown()).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()
|
|
14308
|
+
});
|
|
14309
|
+
object({
|
|
14310
|
+
recipients: array(SmtpRecipientSchema).min(1),
|
|
14109
14311
|
/**
|
|
14110
|
-
*
|
|
14111
|
-
*
|
|
14112
|
-
*
|
|
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.
|
|
14113
14316
|
*/
|
|
14114
|
-
|
|
14317
|
+
subscriberId: string().min(1).max(64).optional()
|
|
14115
14318
|
});
|
|
14116
|
-
|
|
14117
|
-
|
|
14118
|
-
|
|
14119
|
-
|
|
14120
|
-
/** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
|
|
14121
|
-
ordinal: number().int().min(1).max(5).nullable(),
|
|
14122
|
-
flags: object({
|
|
14123
|
-
critical: boolean().optional(),
|
|
14124
|
-
silent: boolean().optional(),
|
|
14125
|
-
noPush: boolean().optional()
|
|
14126
|
-
}).optional(),
|
|
14127
|
-
/** e.g. Pushover `emergency` requires `retry` / `expire`. */
|
|
14128
|
-
requires: array(string()).optional(),
|
|
14129
|
-
description: string().optional()
|
|
14319
|
+
var SmtpInboundAttachmentSchema = object({
|
|
14320
|
+
filename: string(),
|
|
14321
|
+
contentType: string(),
|
|
14322
|
+
bytes: number().int().nonnegative()
|
|
14130
14323
|
});
|
|
14131
|
-
/** The
|
|
14132
|
-
var
|
|
14133
|
-
|
|
14134
|
-
|
|
14135
|
-
|
|
14136
|
-
|
|
14137
|
-
|
|
14138
|
-
|
|
14139
|
-
|
|
14140
|
-
|
|
14141
|
-
|
|
14142
|
-
|
|
14143
|
-
|
|
14144
|
-
|
|
14145
|
-
|
|
14146
|
-
|
|
14147
|
-
|
|
14148
|
-
|
|
14149
|
-
|
|
14150
|
-
|
|
14151
|
-
|
|
14152
|
-
|
|
14153
|
-
|
|
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
|
+
*/
|
|
14154
14717
|
actionIcons: boolean().optional(),
|
|
14155
14718
|
levels: array(TargetKindLevelSchema),
|
|
14156
14719
|
format: array(NotificationFormatSchema),
|
|
@@ -14166,7 +14729,7 @@ var TargetKindCapsSchema = object({
|
|
|
14166
14729
|
* the union is large and not meant for runtime validation here; the exported
|
|
14167
14730
|
* `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
|
|
14168
14731
|
*/
|
|
14169
|
-
var ConfigSchemaPassthrough$
|
|
14732
|
+
var ConfigSchemaPassthrough$3 = unknown();
|
|
14170
14733
|
var TargetKindSchema = object({
|
|
14171
14734
|
kind: string(),
|
|
14172
14735
|
label: string(),
|
|
@@ -14203,7 +14766,7 @@ var TargetKindSchema = object({
|
|
|
14203
14766
|
* its raster path, which is the safe default for an unknown image.
|
|
14204
14767
|
*/
|
|
14205
14768
|
iconMediaType: string().optional(),
|
|
14206
|
-
configSchema: ConfigSchemaPassthrough$
|
|
14769
|
+
configSchema: ConfigSchemaPassthrough$3,
|
|
14207
14770
|
/**
|
|
14208
14771
|
* The config keys that decide WHERE this kind's secrets are sent (server,
|
|
14209
14772
|
* base URL, instance, chat, recipient). A save that changes any of them
|
|
@@ -14225,9 +14788,11 @@ var TargetKindSchema = object({
|
|
|
14225
14788
|
caps: TargetKindCapsSchema
|
|
14226
14789
|
});
|
|
14227
14790
|
/**
|
|
14228
|
-
* A
|
|
14229
|
-
*
|
|
14230
|
-
*
|
|
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.
|
|
14231
14796
|
*/
|
|
14232
14797
|
var TargetSchema = object({
|
|
14233
14798
|
id: string(),
|
|
@@ -14270,13 +14835,13 @@ var ProbeTargetConfigResultSchema = object({
|
|
|
14270
14835
|
stateInstance: string().optional(),
|
|
14271
14836
|
error: string().optional()
|
|
14272
14837
|
});
|
|
14273
|
-
method(object({}), array(TargetKindSchema)), method(object({
|
|
14838
|
+
method(object({}), array(TargetKindSchema)), method(object({
|
|
14274
14839
|
kind: string(),
|
|
14275
14840
|
config: record(string(), unknown()).optional(),
|
|
14276
14841
|
/**
|
|
14277
14842
|
* When editing / duplicating, the blank password field never round-trips
|
|
14278
14843
|
* the stored token. Pass the source target id so the provider can restore
|
|
14279
|
-
* secrets server-side before dialling
|
|
14844
|
+
* secrets server-side before dialling.
|
|
14280
14845
|
*/
|
|
14281
14846
|
targetId: string().optional()
|
|
14282
14847
|
}), array(DiscoveredTargetSchema), { auth: "admin" }), method(object({
|
|
@@ -14299,27 +14864,6 @@ method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSche
|
|
|
14299
14864
|
}), TestResultSchema, {
|
|
14300
14865
|
kind: "mutation",
|
|
14301
14866
|
auth: "admin"
|
|
14302
|
-
}), method(object({
|
|
14303
|
-
target: TargetSchema,
|
|
14304
|
-
/**
|
|
14305
|
-
* Duplicate flow: create a NEW target id while copying secrets from an
|
|
14306
|
-
* existing row. The UI never holds the stored token; blank / redacted
|
|
14307
|
-
* password fields are restored from this source (D634 still applies if
|
|
14308
|
-
* destinations diverge without a re-typed secret).
|
|
14309
|
-
*/
|
|
14310
|
-
cloneSecretsFrom: string().optional()
|
|
14311
|
-
}), TargetSchema, {
|
|
14312
|
-
kind: "mutation",
|
|
14313
|
-
auth: "admin"
|
|
14314
|
-
}), method(object({ targetId: string() }), _void(), {
|
|
14315
|
-
kind: "mutation",
|
|
14316
|
-
auth: "admin"
|
|
14317
|
-
}), method(object({
|
|
14318
|
-
targetId: string(),
|
|
14319
|
-
enabled: boolean()
|
|
14320
|
-
}), _void(), {
|
|
14321
|
-
kind: "mutation",
|
|
14322
|
-
auth: "admin"
|
|
14323
14867
|
});
|
|
14324
14868
|
looseObject({
|
|
14325
14869
|
name: string().min(1),
|
|
@@ -22730,7 +23274,6 @@ var SYSTEM_CAP_VOCABULARY = {
|
|
|
22730
23274
|
"notification-output": system("notification delivery — reached through notifier devices and rules"),
|
|
22731
23275
|
"notification-rules": system("notification rules — authored on their own page"),
|
|
22732
23276
|
"oauth-integration": system(IDENTITY),
|
|
22733
|
-
"oidc-connections": system(IDENTITY),
|
|
22734
23277
|
"osd-manager": system(PIPELINE),
|
|
22735
23278
|
"pipeline-executor": system(PIPELINE),
|
|
22736
23279
|
"pipeline-orchestrator": system(PIPELINE),
|
|
@@ -42612,727 +43155,345 @@ var LEGACY_ICON_ALIASES = { gauge2: "gauge" };
|
|
|
42612
43155
|
*
|
|
42613
43156
|
* ## What is persisted
|
|
42614
43157
|
*
|
|
42615
|
-
* The canonical kebab-case lucide id ({@link IconKey}). Spellings that a lucide
|
|
42616
|
-
* package still accepts (`home` for `house`) and this repo's own legacy ones
|
|
42617
|
-
* (`gauge2`) RESOLVE ({@link canonicalIconKey}) so a stored value never goes
|
|
42618
|
-
* stale, but they are never OFFERED by search.
|
|
42619
|
-
*
|
|
42620
|
-
* ## Search
|
|
42621
|
-
*
|
|
42622
|
-
* Over the key, the Italian/English overlay in `icon-synonyms.ts`, any words
|
|
42623
|
-
* the caller adds, and lucide's English tags — in that order of weight.
|
|
42624
|
-
*/
|
|
42625
|
-
var KEY_SET$2 = new Set(ICON_KEYS);
|
|
42626
|
-
new Map([...Object.entries(ICON_ALIASES), ...Object.entries(LEGACY_ICON_ALIASES)]);
|
|
42627
|
-
/** Is this a canonical key of the catalog? (An alias is not — see {@link canonicalIconKey}.) */
|
|
42628
|
-
function isIconKey(value) {
|
|
42629
|
-
return typeof value === "string" && KEY_SET$2.has(value);
|
|
42630
|
-
}
|
|
42631
|
-
/**
|
|
42632
|
-
* Wire/storage schema for one icon key.
|
|
42633
|
-
*
|
|
42634
|
-
* Deliberately NOT a `z.enum` of the catalog: ~1,700 literals would be inlined
|
|
42635
|
-
* into every cap router, type and API-reference row that carries an icon. The
|
|
42636
|
-
* check is membership in the catalog and the type is {@link IconKey}.
|
|
42637
|
-
*/
|
|
42638
|
-
var IconKeySchema = custom(isIconKey, "Not an icon of the catalog");
|
|
42639
|
-
var ENTRIES = ICON_KEYS.map((key, index) => {
|
|
42640
|
-
const [categoryIndexes, tags] = ICON_META[index] ?? [[], []];
|
|
42641
|
-
const categories = categoryIndexes.flatMap((i) => {
|
|
42642
|
-
const id = ICON_CATEGORY_IDS[i];
|
|
42643
|
-
return id === void 0 ? [] : [id];
|
|
42644
|
-
});
|
|
42645
|
-
return {
|
|
42646
|
-
key,
|
|
42647
|
-
categories,
|
|
42648
|
-
primaryCategory: categories[0] ?? ICON_CATEGORY_IDS[0],
|
|
42649
|
-
tags,
|
|
42650
|
-
synonyms: ICON_SYNONYMS[key] ?? []
|
|
42651
|
-
};
|
|
42652
|
-
});
|
|
42653
|
-
new Map(ENTRIES.map((e) => [e.key, e]));
|
|
42654
|
-
/** Categories a picker offers first: the ones this product's icons mostly live in. */
|
|
42655
|
-
var LEADING_CATEGORIES = [
|
|
42656
|
-
"devices",
|
|
42657
|
-
"home",
|
|
42658
|
-
"security",
|
|
42659
|
-
"buildings",
|
|
42660
|
-
"connectivity",
|
|
42661
|
-
"multimedia",
|
|
42662
|
-
"nature",
|
|
42663
|
-
"weather",
|
|
42664
|
-
"transportation",
|
|
42665
|
-
"animals"
|
|
42666
|
-
];
|
|
42667
|
-
var PRIMARY_CATEGORIES = new Set(ENTRIES.map((e) => e.primaryCategory));
|
|
42668
|
-
[...LEADING_CATEGORIES, ...ICON_CATEGORY_IDS.filter((c) => !LEADING_CATEGORIES.includes(c))].filter((c) => PRIMARY_CATEGORIES.has(c));
|
|
42669
|
-
/**
|
|
42670
|
-
* One (location, icon) assignment as it travels.
|
|
42671
|
-
*
|
|
42672
|
-
* `locationKey` is ALWAYS {@link locationIconKey} of the label — never the
|
|
42673
|
-
* operator's casing. The registry matches labels trimmed + case-insensitively
|
|
42674
|
-
* everywhere (`addLocation`, `removeLocation`, `renameLocation`), and a
|
|
42675
|
-
* case-only rename (`kitchen` → `Kitchen`) is a real edit this repo supports; a
|
|
42676
|
-
* map keyed on the displayed casing would orphan its entry on exactly that
|
|
42677
|
-
* edit. Consumers join by keying their own label through `locationIconKey`.
|
|
42678
|
-
*/
|
|
42679
|
-
var LocationIconAssignmentSchema = object({
|
|
42680
|
-
locationKey: string(),
|
|
42681
|
-
icon: IconKeySchema
|
|
42682
|
-
});
|
|
42683
|
-
/**
|
|
42684
|
-
* One (location, description) assignment as it travels.
|
|
42685
|
-
*
|
|
42686
|
-
* Same key discipline as {@link LocationIconAssignmentSchema}, and for the same
|
|
42687
|
-
* reason: this lived for a while in the post-analysis addon's own settings,
|
|
42688
|
-
* keyed by a HAND-TYPED label matched exactly and case-sensitively. A rename in
|
|
42689
|
-
* the Locations page carried the icon and silently orphaned the description —
|
|
42690
|
-
* two authorities for one thing, joined by two different rules. Now both hang
|
|
42691
|
-
* off the location itself, on `locationIconKey`.
|
|
42692
|
-
*/
|
|
42693
|
-
var LocationDescriptionAssignmentSchema = object({
|
|
42694
|
-
locationKey: string(),
|
|
42695
|
-
description: string()
|
|
42696
|
-
});
|
|
42697
|
-
/**
|
|
42698
|
-
* WHO an action step acts on (D983) — one target shape for every place that
|
|
42699
|
-
* performs an action (automation steps, Action entries, notification
|
|
42700
|
-
* sequences, scheduler points):
|
|
42701
|
-
*
|
|
42702
|
-
* - `devices` — device ids the operator picked, frozen at save time;
|
|
42703
|
-
* - `domain` — every device that offers the step's VOCABULARY action,
|
|
42704
|
-
* optionally narrowed to one device type and one room, resolved WHEN THE
|
|
42705
|
-
* STEP RUNS (a device added later is included). The action always comes
|
|
42706
|
-
* from the vocabulary (`cover.open`), never from a raw cap name, so a
|
|
42707
|
-
* `domain` target needs an `actionId` (enforced on the step schema);
|
|
42708
|
-
* - `var` — a `$var` resolved from the run's scope.
|
|
42709
|
-
*
|
|
42710
|
-
* {@link ActionTargetResolver} turns a target into device ids. It is pure
|
|
42711
|
-
* (a {@link DeviceDirectory} is handed in) so the hub's core-blocks service and
|
|
42712
|
-
* a generated automation block share it.
|
|
42713
|
-
*
|
|
42714
|
-
* A room is the device's `location` label (`DeviceInfo.location`); two labels
|
|
42715
|
-
* name the same room when `locationIconKey` agrees (trimmed, lower-cased).
|
|
42716
|
-
*/
|
|
42717
|
-
var ActionTargetSchema = discriminatedUnion("kind", [
|
|
42718
|
-
object({
|
|
42719
|
-
kind: literal("devices"),
|
|
42720
|
-
ids: array(number().int()).min(1)
|
|
42721
|
-
}),
|
|
42722
|
-
object({
|
|
42723
|
-
kind: literal("domain"),
|
|
42724
|
-
/** Narrow to one kind of device. */
|
|
42725
|
-
deviceType: _enum(DeviceType).optional(),
|
|
42726
|
-
/** Narrow to one room: the `location` label devices carry. */
|
|
42727
|
-
roomId: string().min(1).optional()
|
|
42728
|
-
}),
|
|
42729
|
-
object({
|
|
42730
|
-
kind: literal("var"),
|
|
42731
|
-
name: string().min(1)
|
|
42732
|
-
})
|
|
42733
|
-
]);
|
|
42734
|
-
EventCategory.DeviceRegistered, EventCategory.DeviceUnregistered, EventCategory.DeviceUpdated, EventCategory.DeviceMetaChanged, EventCategory.DeviceBindingsChanged;
|
|
42735
|
-
var ExpressionBindingSourceSchema = union([
|
|
42736
|
-
object({
|
|
42737
|
-
kind: literal("field").optional(),
|
|
42738
|
-
sourceKey: string(),
|
|
42739
|
-
cap: string(),
|
|
42740
|
-
fieldPath: string()
|
|
42741
|
-
}),
|
|
42742
|
-
object({
|
|
42743
|
-
kind: literal("literal"),
|
|
42744
|
-
value: union([
|
|
42745
|
-
string(),
|
|
42746
|
-
number(),
|
|
42747
|
-
boolean(),
|
|
42748
|
-
_null()
|
|
42749
|
-
])
|
|
42750
|
-
}),
|
|
42751
|
-
object({
|
|
42752
|
-
kind: literal("global"),
|
|
42753
|
-
sourceStableId: string(),
|
|
42754
|
-
cap: string(),
|
|
42755
|
-
fieldPath: string()
|
|
42756
|
-
})
|
|
42757
|
-
]);
|
|
42758
|
-
object({
|
|
42759
|
-
expr: string().min(1).max(MAX_EXPRESSION_SOURCE_LENGTH),
|
|
42760
|
-
bindings: record(string().regex(EXPRESSION_IDENTIFIER_RE), ExpressionBindingSourceSchema)
|
|
42761
|
-
}).superRefine((src, ctx) => {
|
|
42762
|
-
const err = validateExpressionSource(src);
|
|
42763
|
-
if (err !== null) ctx.addIssue({
|
|
42764
|
-
code: "custom",
|
|
42765
|
-
message: err,
|
|
42766
|
-
path: ["expr"]
|
|
42767
|
-
});
|
|
42768
|
-
});
|
|
42769
|
-
/**
|
|
42770
|
-
* Identity envelope for a device's upstream-system metadata.
|
|
42771
|
-
*
|
|
42772
|
-
* Two jobs:
|
|
42773
|
-
*
|
|
42774
|
-
* 1. **Dispatch key.** `id` is the natural identifier the SOURCE system
|
|
42775
|
-
* uses to address this device (HA `entity_id`, Reolink MAC, ONVIF
|
|
42776
|
-
* WS-Discovery endpoint UUID, …). Provider code keeps a
|
|
42777
|
-
* `Map<sourceInfo.id, IDevice>` to route inbound push events in O(1)
|
|
42778
|
-
* without round-tripping through `stableId` / `id` mappings.
|
|
42779
|
-
*
|
|
42780
|
-
* 2. **Stability bridge.** `uniqueId` is the *immutable* upstream id when
|
|
42781
|
-
* one exists (HA `entity.unique_id`, Reolink MAC again — same as `id`
|
|
42782
|
-
* for vendors where MAC is the natural key). For systems where the
|
|
42783
|
-
* live dispatch key can be renamed (HA `entity_id` can be edited),
|
|
42784
|
-
* providers detect renames by matching `uniqueId` and patch `id`
|
|
42785
|
-
* in-place so dispatch keeps working.
|
|
42786
|
-
*
|
|
42787
|
-
* **Display unit and precision are NOT stored here.** They are a read-time
|
|
42788
|
-
* preference (D944). A polymorphic reading stores its `quantity` here once,
|
|
42789
|
-
* at adopt, and a date/time value stores `dateTimeShape` the same way —
|
|
42790
|
-
* neither is repeated on each sample. The `device_class` tag is an
|
|
42791
|
-
* HA-specific input consumed at the discovery boundary (`ha-domain-mapping`)
|
|
42792
|
-
* to derive the CamStack `DeviceRole`; it is never stored after that point.
|
|
42793
|
-
*
|
|
42794
|
-
* The `raw` escape hatch carries provider-specific attributes that don't
|
|
42795
|
-
* fit the structured slots (HA `attributes` whitelist, Reolink `deviceCache`
|
|
42796
|
-
* details, …). Providers control what lands here.
|
|
42797
|
-
*/
|
|
42798
|
-
var SourceInfoSchema = object({
|
|
42799
|
-
/** Live dispatch key — mutable when the source system allows rename. */
|
|
42800
|
-
id: string(),
|
|
42801
|
-
/** Source system tag — e.g. 'homeassistant' | 'reolink' | 'onvif'. */
|
|
42802
|
-
system: string(),
|
|
42803
|
-
/** Immutable upstream identifier when available (HA `unique_id`, … ).
|
|
42804
|
-
* Used to detect rename when `id` changes. */
|
|
42805
|
-
uniqueId: string().optional(),
|
|
42806
|
-
/** Quantity of a polymorphic reading, written once at adopt (D944). */
|
|
42807
|
-
quantity: ReadingQuantitySchema.optional(),
|
|
42808
|
-
/** Date / time / datetime shape of a string reading, written once at adopt. */
|
|
42809
|
-
dateTimeShape: _enum([
|
|
42810
|
-
"date",
|
|
42811
|
-
"time",
|
|
42812
|
-
"datetime"
|
|
42813
|
-
]).optional(),
|
|
42814
|
-
/** Provider-specific extras that don't fit the structured slots.
|
|
42815
|
-
* Whitelist what goes here per provider — do NOT dump entire HA
|
|
42816
|
-
* attribute blobs (would explode the meta JSON column). */
|
|
42817
|
-
raw: record(string(), unknown()).optional()
|
|
42818
|
-
});
|
|
42819
|
-
/**
|
|
42820
|
-
* Build the synthetic SourceInfo every existing provider falls back to
|
|
42821
|
-
* when no upstream value has been persisted. Keeps non-migrated providers
|
|
42822
|
-
* (Reolink / Hikvision / ONVIF / RTSP) functional without code
|
|
42823
|
-
* changes — `id` reuses the CamStack stableId, `system` reuses the addon
|
|
42824
|
-
* id. Real upstream identity replaces this once a provider migrates and
|
|
42825
|
-
* calls `updateSourceInfo()` with concrete values.
|
|
42826
|
-
*/
|
|
42827
|
-
function synthesizeSourceInfo(input) {
|
|
42828
|
-
return {
|
|
42829
|
-
id: input.stableId,
|
|
42830
|
-
system: input.addonId
|
|
42831
|
-
};
|
|
42832
|
-
}
|
|
42833
|
-
/**
|
|
42834
|
-
* Shallow-merge a partial patch over a prior SourceInfo. `undefined`
|
|
42835
|
-
* patch values are ignored (no field clobber); to clear a field
|
|
42836
|
-
* explicitly, providers omit it from the patch and rebuild from scratch
|
|
42837
|
-
* via `updateSourceInfo({})` cycles — uncommon enough that we don't
|
|
42838
|
-
* bother with a `null`-means-delete sentinel.
|
|
42839
|
-
*
|
|
42840
|
-
* The `raw` field is also shallow-merged: passing `raw: { foo: 1 }`
|
|
42841
|
-
* merges over existing `raw` keys instead of replacing the whole bag.
|
|
42842
|
-
*/
|
|
42843
|
-
function mergeSourceInfo(prev, patch) {
|
|
42844
|
-
const next = { ...prev };
|
|
42845
|
-
for (const [k, v] of Object.entries(patch)) {
|
|
42846
|
-
if (v === void 0) continue;
|
|
42847
|
-
if (k === "raw" && typeof v === "object" && v !== null) {
|
|
42848
|
-
next.raw = {
|
|
42849
|
-
...prev.raw,
|
|
42850
|
-
...v
|
|
42851
|
-
};
|
|
42852
|
-
continue;
|
|
42853
|
-
}
|
|
42854
|
-
next[k] = v;
|
|
42855
|
-
}
|
|
42856
|
-
return next;
|
|
42857
|
-
}
|
|
42858
|
-
/**
|
|
42859
|
-
* Coerce common unit-of-measurement string variants to a canonical form
|
|
42860
|
-
* so the UI's display templates can rely on stable strings. Pure
|
|
42861
|
-
* passthrough for unknown units — kept conservative on purpose, the goal
|
|
42862
|
-
* is to normalise the long tail of HA `unit_of_measurement` values that
|
|
42863
|
-
* have multiple historical spellings (`'°C'` vs `'C'` vs `'celsius'`).
|
|
42864
|
-
*
|
|
42865
|
-
* Extend the map as we encounter real-world data. Returning the raw
|
|
42866
|
-
* input for unknown values is intentional: providers should never
|
|
42867
|
-
* lose information silently here.
|
|
42868
|
-
*/
|
|
42869
|
-
function normalizeUnit(raw) {
|
|
42870
|
-
if (raw == null) return void 0;
|
|
42871
|
-
const trimmed = raw.trim();
|
|
42872
|
-
if (trimmed === "") return void 0;
|
|
42873
|
-
const lower = trimmed.toLowerCase();
|
|
42874
|
-
if (lower === "°c" || lower === "c" || lower === "celsius") return "°C";
|
|
42875
|
-
if (lower === "°f" || lower === "f" || lower === "fahrenheit") return "°F";
|
|
42876
|
-
if (lower === "k" || lower === "kelvin") return "K";
|
|
42877
|
-
if (lower === "%" || lower === "percent" || lower === "percentage") return "%";
|
|
42878
|
-
if (lower === "lx" || lower === "lux") return "lx";
|
|
42879
|
-
if (lower === "hpa" || lower === "hectopascal") return "hPa";
|
|
42880
|
-
if (lower === "kpa") return "kPa";
|
|
42881
|
-
if (lower === "pa") return "Pa";
|
|
42882
|
-
if (lower === "mbar" || lower === "millibar") return "mbar";
|
|
42883
|
-
if (lower === "w" || lower === "watt") return "W";
|
|
42884
|
-
if (lower === "kw" || lower === "kilowatt") return "kW";
|
|
42885
|
-
if (lower === "wh" || lower === "watt-hour") return "Wh";
|
|
42886
|
-
if (lower === "kwh" || lower === "kilowatt-hour") return "kWh";
|
|
42887
|
-
if (lower === "v" || lower === "volt") return "V";
|
|
42888
|
-
if (lower === "a" || lower === "amp" || lower === "ampere") return "A";
|
|
42889
|
-
if (lower === "ma" || lower === "milliampere") return "mA";
|
|
42890
|
-
if (lower === "va") return "VA";
|
|
42891
|
-
if (lower === "ppm") return "ppm";
|
|
42892
|
-
if (lower === "ppb") return "ppb";
|
|
42893
|
-
if (lower === "µg/m³" || lower === "ug/m3" || lower === "µg/m3") return "µg/m³";
|
|
42894
|
-
if (lower === "km/h" || lower === "kph") return "km/h";
|
|
42895
|
-
if (lower === "mph") return "mph";
|
|
42896
|
-
if (lower === "m/s") return "m/s";
|
|
42897
|
-
if (lower === "m") return "m";
|
|
42898
|
-
if (lower === "m²" || lower === "m2") return "m²";
|
|
42899
|
-
if (lower === "mm") return "mm";
|
|
42900
|
-
if (lower === "cm") return "cm";
|
|
42901
|
-
if (lower === "km") return "km";
|
|
42902
|
-
if (lower === "in" || lower === "inch" || lower === "inches") return "in";
|
|
42903
|
-
if (lower === "ft" || lower === "foot" || lower === "feet") return "ft";
|
|
42904
|
-
if (lower === "kg") return "kg";
|
|
42905
|
-
if (lower === "g") return "g";
|
|
42906
|
-
if (lower === "l" || lower === "liter" || lower === "litre" || lower === "liters" || lower === "litres") return "L";
|
|
42907
|
-
if (lower === "ml") return "mL";
|
|
42908
|
-
if (lower === "gal" || lower === "gallon" || lower === "gallons") return "gal";
|
|
42909
|
-
if (lower === "s" || lower === "sec" || lower === "second" || lower === "seconds") return "s";
|
|
42910
|
-
if (lower === "ms") return "ms";
|
|
42911
|
-
if (lower === "min" || lower === "minute" || lower === "minutes") return "min";
|
|
42912
|
-
if (lower === "h" || lower === "hr" || lower === "hour" || lower === "hours") return "h";
|
|
42913
|
-
if (lower === "d" || lower === "day" || lower === "days") return "d";
|
|
42914
|
-
if (lower === "b" || lower === "byte" || lower === "bytes") return "B";
|
|
42915
|
-
if (lower === "kib") return "KiB";
|
|
42916
|
-
if (lower === "mib") return "MiB";
|
|
42917
|
-
if (lower === "gib") return "GiB";
|
|
42918
|
-
if (lower === "tib") return "TiB";
|
|
42919
|
-
if (lower === "kb") return "kB";
|
|
42920
|
-
if (lower === "mb") return "MB";
|
|
42921
|
-
if (lower === "gb") return "GB";
|
|
42922
|
-
if (lower === "dbm") return "dBm";
|
|
42923
|
-
if (lower === "dbfs") return "dBFS";
|
|
42924
|
-
if (lower === "inhg") return "inHg";
|
|
42925
|
-
if (lower === "mm/h" || lower === "mm/hr") return "mm/h";
|
|
42926
|
-
if (lower === "in/h" || lower === "in/hr") return "in/h";
|
|
42927
|
-
if (lower === "w/m²" || lower === "w/m2") return "W/m²";
|
|
42928
|
-
if (lower === "°" || lower === "deg" || lower === "degree" || lower === "degrees") return "°";
|
|
42929
|
-
if (lower === "kbps") return "kbps";
|
|
42930
|
-
if (lower === "fps") return "fps";
|
|
42931
|
-
return trimmed;
|
|
42932
|
-
}
|
|
42933
|
-
/**
|
|
42934
|
-
* Key under which `SourceInfo` lives inside `DeviceMeta.metadata`. The
|
|
42935
|
-
* blob is a free-form `Record<string, unknown>` shared with hardware-
|
|
42936
|
-
* identity fields (`manufacturer`, `model`, `firmware`, …); SourceInfo
|
|
42937
|
-
* lives under a single nested key to keep it composable with those.
|
|
42938
|
-
*/
|
|
42939
|
-
var SOURCE_INFO_METADATA_KEY = "sourceInfo";
|
|
42940
|
-
/**
|
|
42941
|
-
* Extract a SourceInfo from a `DeviceMeta.metadata` blob, validating
|
|
42942
|
-
* with Zod. Returns `null` when the blob is missing or the nested
|
|
42943
|
-
* `sourceInfo` key fails validation — callers fall back to the
|
|
42944
|
-
* synthetic default in that case (see `synthesizeSourceInfo`).
|
|
42945
|
-
*/
|
|
42946
|
-
function extractSourceInfoFromMetadata(metadata) {
|
|
42947
|
-
if (!metadata) return null;
|
|
42948
|
-
const raw = metadata[SOURCE_INFO_METADATA_KEY];
|
|
42949
|
-
if (!raw) return null;
|
|
42950
|
-
const parsed = SourceInfoSchema.safeParse(raw);
|
|
42951
|
-
if (!parsed.success) return null;
|
|
42952
|
-
return parsed.data;
|
|
42953
|
-
}
|
|
42954
|
-
/**
|
|
42955
|
-
* Frozen unit → spec table. `•` in the doc marks each dimension's canonical
|
|
42956
|
-
* unit (`factor: 1, offset: 0`). °F derives from `°C = (°F − 32) × 5/9` ⇒
|
|
42957
|
-
* `factor = 5/9`, `offset = -160/9` (kept as exact expressions, not rounded
|
|
42958
|
-
* decimals). K derives from `°C = K − 273.15`.
|
|
42959
|
-
*/
|
|
42960
|
-
var UNIT_TABLE = {
|
|
42961
|
-
"°C": {
|
|
42962
|
-
dimension: "temperature",
|
|
42963
|
-
factor: 1,
|
|
42964
|
-
offset: 0
|
|
42965
|
-
},
|
|
42966
|
-
"°F": {
|
|
42967
|
-
dimension: "temperature",
|
|
42968
|
-
factor: 5 / 9,
|
|
42969
|
-
offset: -160 / 9
|
|
42970
|
-
},
|
|
42971
|
-
K: {
|
|
42972
|
-
dimension: "temperature",
|
|
42973
|
-
factor: 1,
|
|
42974
|
-
offset: -273.15
|
|
42975
|
-
},
|
|
42976
|
-
hPa: {
|
|
42977
|
-
dimension: "pressure",
|
|
42978
|
-
factor: 1,
|
|
42979
|
-
offset: 0
|
|
42980
|
-
},
|
|
42981
|
-
kPa: {
|
|
42982
|
-
dimension: "pressure",
|
|
42983
|
-
factor: 10,
|
|
42984
|
-
offset: 0
|
|
42985
|
-
},
|
|
42986
|
-
Pa: {
|
|
42987
|
-
dimension: "pressure",
|
|
42988
|
-
factor: .01,
|
|
42989
|
-
offset: 0
|
|
42990
|
-
},
|
|
42991
|
-
mbar: {
|
|
42992
|
-
dimension: "pressure",
|
|
42993
|
-
factor: 1,
|
|
42994
|
-
offset: 0
|
|
42995
|
-
},
|
|
42996
|
-
bar: {
|
|
42997
|
-
dimension: "pressure",
|
|
42998
|
-
factor: 1e3,
|
|
42999
|
-
offset: 0
|
|
43000
|
-
},
|
|
43001
|
-
inHg: {
|
|
43002
|
-
dimension: "pressure",
|
|
43003
|
-
factor: 33.8639,
|
|
43004
|
-
offset: 0
|
|
43005
|
-
},
|
|
43006
|
-
mmHg: {
|
|
43007
|
-
dimension: "pressure",
|
|
43008
|
-
factor: 1.33322,
|
|
43009
|
-
offset: 0
|
|
43010
|
-
},
|
|
43011
|
-
psi: {
|
|
43012
|
-
dimension: "pressure",
|
|
43013
|
-
factor: 68.9476,
|
|
43014
|
-
offset: 0
|
|
43015
|
-
},
|
|
43016
|
-
"m/s": {
|
|
43017
|
-
dimension: "speed",
|
|
43018
|
-
factor: 1,
|
|
43019
|
-
offset: 0
|
|
43020
|
-
},
|
|
43021
|
-
"km/h": {
|
|
43022
|
-
dimension: "speed",
|
|
43023
|
-
factor: 1 / 3.6,
|
|
43024
|
-
offset: 0
|
|
43025
|
-
},
|
|
43026
|
-
mph: {
|
|
43027
|
-
dimension: "speed",
|
|
43028
|
-
factor: .44704,
|
|
43029
|
-
offset: 0
|
|
43030
|
-
},
|
|
43031
|
-
kn: {
|
|
43032
|
-
dimension: "speed",
|
|
43033
|
-
factor: .514444,
|
|
43034
|
-
offset: 0
|
|
43035
|
-
},
|
|
43036
|
-
"mm/h": {
|
|
43037
|
-
dimension: "precipitation-rate",
|
|
43038
|
-
factor: 1,
|
|
43039
|
-
offset: 0
|
|
43040
|
-
},
|
|
43041
|
-
"in/h": {
|
|
43042
|
-
dimension: "precipitation-rate",
|
|
43043
|
-
factor: 25.4,
|
|
43044
|
-
offset: 0
|
|
43045
|
-
},
|
|
43046
|
-
m: {
|
|
43047
|
-
dimension: "length",
|
|
43048
|
-
factor: 1,
|
|
43049
|
-
offset: 0
|
|
43050
|
-
},
|
|
43051
|
-
mm: {
|
|
43052
|
-
dimension: "length",
|
|
43053
|
-
factor: .001,
|
|
43054
|
-
offset: 0
|
|
43055
|
-
},
|
|
43056
|
-
cm: {
|
|
43057
|
-
dimension: "length",
|
|
43058
|
-
factor: .01,
|
|
43059
|
-
offset: 0
|
|
43060
|
-
},
|
|
43061
|
-
km: {
|
|
43062
|
-
dimension: "length",
|
|
43063
|
-
factor: 1e3,
|
|
43064
|
-
offset: 0
|
|
43065
|
-
},
|
|
43066
|
-
in: {
|
|
43067
|
-
dimension: "length",
|
|
43068
|
-
factor: .0254,
|
|
43069
|
-
offset: 0
|
|
43070
|
-
},
|
|
43071
|
-
ft: {
|
|
43072
|
-
dimension: "length",
|
|
43073
|
-
factor: .3048,
|
|
43074
|
-
offset: 0
|
|
43075
|
-
},
|
|
43076
|
-
mi: {
|
|
43077
|
-
dimension: "length",
|
|
43078
|
-
factor: 1609.344,
|
|
43079
|
-
offset: 0
|
|
43080
|
-
},
|
|
43081
|
-
"m²": {
|
|
43082
|
-
dimension: "area",
|
|
43083
|
-
factor: 1,
|
|
43084
|
-
offset: 0
|
|
43085
|
-
},
|
|
43086
|
-
lx: {
|
|
43087
|
-
dimension: "illuminance",
|
|
43088
|
-
factor: 1,
|
|
43089
|
-
offset: 0
|
|
43090
|
-
},
|
|
43091
|
-
"W/m²": {
|
|
43092
|
-
dimension: "irradiance",
|
|
43093
|
-
factor: 1,
|
|
43094
|
-
offset: 0
|
|
43095
|
-
},
|
|
43096
|
-
W: {
|
|
43097
|
-
dimension: "power",
|
|
43098
|
-
factor: 1,
|
|
43099
|
-
offset: 0
|
|
43100
|
-
},
|
|
43101
|
-
kW: {
|
|
43102
|
-
dimension: "power",
|
|
43103
|
-
factor: 1e3,
|
|
43104
|
-
offset: 0
|
|
43105
|
-
},
|
|
43106
|
-
VA: {
|
|
43107
|
-
dimension: "apparent-power",
|
|
43108
|
-
factor: 1,
|
|
43109
|
-
offset: 0
|
|
43110
|
-
},
|
|
43111
|
-
Wh: {
|
|
43112
|
-
dimension: "energy",
|
|
43113
|
-
factor: 1,
|
|
43114
|
-
offset: 0
|
|
43115
|
-
},
|
|
43116
|
-
kWh: {
|
|
43117
|
-
dimension: "energy",
|
|
43118
|
-
factor: 1e3,
|
|
43119
|
-
offset: 0
|
|
43120
|
-
},
|
|
43121
|
-
MWh: {
|
|
43122
|
-
dimension: "energy",
|
|
43123
|
-
factor: 1e6,
|
|
43124
|
-
offset: 0
|
|
43125
|
-
},
|
|
43126
|
-
V: {
|
|
43127
|
-
dimension: "voltage",
|
|
43128
|
-
factor: 1,
|
|
43129
|
-
offset: 0
|
|
43130
|
-
},
|
|
43131
|
-
mV: {
|
|
43132
|
-
dimension: "voltage",
|
|
43133
|
-
factor: .001,
|
|
43134
|
-
offset: 0
|
|
43135
|
-
},
|
|
43136
|
-
A: {
|
|
43137
|
-
dimension: "current",
|
|
43138
|
-
factor: 1,
|
|
43139
|
-
offset: 0
|
|
43140
|
-
},
|
|
43141
|
-
mA: {
|
|
43142
|
-
dimension: "current",
|
|
43143
|
-
factor: .001,
|
|
43144
|
-
offset: 0
|
|
43145
|
-
},
|
|
43146
|
-
ppm: {
|
|
43147
|
-
dimension: "concentration-volume",
|
|
43148
|
-
factor: 1,
|
|
43149
|
-
offset: 0
|
|
43150
|
-
},
|
|
43151
|
-
ppb: {
|
|
43152
|
-
dimension: "concentration-volume",
|
|
43153
|
-
factor: .001,
|
|
43154
|
-
offset: 0
|
|
43155
|
-
},
|
|
43156
|
-
"µg/m³": {
|
|
43157
|
-
dimension: "concentration-mass",
|
|
43158
|
-
factor: 1,
|
|
43159
|
-
offset: 0
|
|
43160
|
-
},
|
|
43161
|
-
"mg/m³": {
|
|
43162
|
-
dimension: "concentration-mass",
|
|
43163
|
-
factor: 1e3,
|
|
43164
|
-
offset: 0
|
|
43165
|
-
},
|
|
43166
|
-
kg: {
|
|
43167
|
-
dimension: "mass",
|
|
43168
|
-
factor: 1,
|
|
43169
|
-
offset: 0
|
|
43170
|
-
},
|
|
43171
|
-
g: {
|
|
43172
|
-
dimension: "mass",
|
|
43173
|
-
factor: .001,
|
|
43174
|
-
offset: 0
|
|
43175
|
-
},
|
|
43176
|
-
lb: {
|
|
43177
|
-
dimension: "mass",
|
|
43178
|
-
factor: .453592,
|
|
43179
|
-
offset: 0
|
|
43180
|
-
},
|
|
43181
|
-
oz: {
|
|
43182
|
-
dimension: "mass",
|
|
43183
|
-
factor: .0283495,
|
|
43184
|
-
offset: 0
|
|
43185
|
-
},
|
|
43186
|
-
"%": {
|
|
43187
|
-
dimension: "percentage",
|
|
43188
|
-
factor: 1,
|
|
43189
|
-
offset: 0
|
|
43190
|
-
},
|
|
43191
|
-
L: {
|
|
43192
|
-
dimension: "volume",
|
|
43193
|
-
factor: 1,
|
|
43194
|
-
offset: 0
|
|
43195
|
-
},
|
|
43196
|
-
mL: {
|
|
43197
|
-
dimension: "volume",
|
|
43198
|
-
factor: .001,
|
|
43199
|
-
offset: 0
|
|
43200
|
-
},
|
|
43201
|
-
gal: {
|
|
43202
|
-
dimension: "volume",
|
|
43203
|
-
factor: 3.785411784,
|
|
43204
|
-
offset: 0
|
|
43205
|
-
},
|
|
43206
|
-
s: {
|
|
43207
|
-
dimension: "duration",
|
|
43208
|
-
factor: 1,
|
|
43209
|
-
offset: 0
|
|
43210
|
-
},
|
|
43211
|
-
ms: {
|
|
43212
|
-
dimension: "duration",
|
|
43213
|
-
factor: .001,
|
|
43214
|
-
offset: 0
|
|
43215
|
-
},
|
|
43216
|
-
min: {
|
|
43217
|
-
dimension: "duration",
|
|
43218
|
-
factor: 60,
|
|
43219
|
-
offset: 0
|
|
43220
|
-
},
|
|
43221
|
-
h: {
|
|
43222
|
-
dimension: "duration",
|
|
43223
|
-
factor: 3600,
|
|
43224
|
-
offset: 0
|
|
43225
|
-
},
|
|
43226
|
-
d: {
|
|
43227
|
-
dimension: "duration",
|
|
43228
|
-
factor: 86400,
|
|
43229
|
-
offset: 0
|
|
43230
|
-
},
|
|
43231
|
-
B: {
|
|
43232
|
-
dimension: "information",
|
|
43233
|
-
factor: 1,
|
|
43234
|
-
offset: 0
|
|
43235
|
-
},
|
|
43236
|
-
KiB: {
|
|
43237
|
-
dimension: "information",
|
|
43238
|
-
factor: 1024,
|
|
43239
|
-
offset: 0
|
|
43240
|
-
},
|
|
43241
|
-
MiB: {
|
|
43242
|
-
dimension: "information",
|
|
43243
|
-
factor: 1024 ** 2,
|
|
43244
|
-
offset: 0
|
|
43245
|
-
},
|
|
43246
|
-
GiB: {
|
|
43247
|
-
dimension: "information",
|
|
43248
|
-
factor: 1024 ** 3,
|
|
43249
|
-
offset: 0
|
|
43250
|
-
},
|
|
43251
|
-
TiB: {
|
|
43252
|
-
dimension: "information",
|
|
43253
|
-
factor: 1024 ** 4,
|
|
43254
|
-
offset: 0
|
|
43255
|
-
},
|
|
43256
|
-
kB: {
|
|
43257
|
-
dimension: "information",
|
|
43258
|
-
factor: 1e3,
|
|
43259
|
-
offset: 0
|
|
43260
|
-
},
|
|
43261
|
-
MB: {
|
|
43262
|
-
dimension: "information",
|
|
43263
|
-
factor: 1e6,
|
|
43264
|
-
offset: 0
|
|
43265
|
-
},
|
|
43266
|
-
GB: {
|
|
43267
|
-
dimension: "information",
|
|
43268
|
-
factor: 1e9,
|
|
43269
|
-
offset: 0
|
|
43270
|
-
},
|
|
43271
|
-
"°": {
|
|
43272
|
-
dimension: "angle",
|
|
43273
|
-
factor: 1,
|
|
43274
|
-
offset: 0
|
|
43275
|
-
},
|
|
43276
|
-
dBFS: {
|
|
43277
|
-
dimension: "sound-level",
|
|
43278
|
-
factor: 1,
|
|
43279
|
-
offset: 0
|
|
43280
|
-
},
|
|
43281
|
-
dBm: {
|
|
43282
|
-
dimension: "signal-level",
|
|
43283
|
-
factor: 1,
|
|
43284
|
-
offset: 0
|
|
43285
|
-
},
|
|
43286
|
-
mired: {
|
|
43287
|
-
dimension: "colour-temperature",
|
|
43288
|
-
factor: 1,
|
|
43289
|
-
offset: 0
|
|
43290
|
-
},
|
|
43291
|
-
kbps: {
|
|
43292
|
-
dimension: "bitrate",
|
|
43293
|
-
factor: 1,
|
|
43294
|
-
offset: 0
|
|
43295
|
-
},
|
|
43296
|
-
Mbps: {
|
|
43297
|
-
dimension: "bitrate",
|
|
43298
|
-
factor: 1e3,
|
|
43299
|
-
offset: 0
|
|
43300
|
-
},
|
|
43301
|
-
fps: {
|
|
43302
|
-
dimension: "rate",
|
|
43303
|
-
factor: 1,
|
|
43304
|
-
offset: 0
|
|
43305
|
-
}
|
|
43306
|
-
};
|
|
43307
|
-
/** Resolve a unit's `UnitSpec`, or `undefined` when the spelling is unknown. */
|
|
43308
|
-
function specFor(unit) {
|
|
43309
|
-
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);
|
|
43310
43173
|
}
|
|
43311
|
-
/**
|
|
43312
|
-
|
|
43313
|
-
|
|
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
|
+
};
|
|
43314
43376
|
}
|
|
43315
|
-
/**
|
|
43316
|
-
|
|
43317
|
-
|
|
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;
|
|
43318
43401
|
}
|
|
43319
|
-
/**
|
|
43320
|
-
|
|
43321
|
-
|
|
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;
|
|
43322
43476
|
}
|
|
43323
43477
|
/**
|
|
43324
|
-
*
|
|
43325
|
-
*
|
|
43326
|
-
*
|
|
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.
|
|
43327
43482
|
*/
|
|
43328
|
-
|
|
43329
|
-
|
|
43330
|
-
|
|
43331
|
-
|
|
43332
|
-
|
|
43333
|
-
|
|
43334
|
-
|
|
43335
|
-
|
|
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;
|
|
43336
43497
|
}
|
|
43337
43498
|
/**
|
|
43338
43499
|
* A number a person types for a physical quantity — the input side of the
|
|
@@ -45011,15 +45172,28 @@ var SettingsSchemaWithValuesSchema = object({
|
|
|
45011
45172
|
});
|
|
45012
45173
|
/** Patch object — keys are field names, values are the new field values. */
|
|
45013
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
|
+
});
|
|
45014
45183
|
/** Standard success response for update operations. */
|
|
45015
45184
|
var SettingsUpdateResultSchema = object({ success: literal(true) });
|
|
45016
45185
|
method(object({
|
|
45017
45186
|
addonId: string(),
|
|
45018
|
-
|
|
45019
|
-
|
|
45020
|
-
|
|
45187
|
+
cap: string(),
|
|
45188
|
+
scope: ScopedSettingsScopeSchema,
|
|
45189
|
+
nodeId: string().optional()
|
|
45021
45190
|
}), SettingsSchemaWithValuesSchema.nullable()), method(object({
|
|
45022
45191
|
addonId: string(),
|
|
45192
|
+
nodeId: string().optional()
|
|
45193
|
+
}), array(ScopedSettingsDeclarationSchema).nullable()), method(object({
|
|
45194
|
+
addonId: string(),
|
|
45195
|
+
cap: string(),
|
|
45196
|
+
scope: ScopedSettingsScopeSchema,
|
|
45023
45197
|
nodeId: string().optional(),
|
|
45024
45198
|
patch: SettingsPatchSchema
|
|
45025
45199
|
}), SettingsUpdateResultSchema, {
|
|
@@ -45027,8 +45201,10 @@ method(object({
|
|
|
45027
45201
|
auth: "admin"
|
|
45028
45202
|
}), method(object({
|
|
45029
45203
|
addonId: string(),
|
|
45204
|
+
cap: string(),
|
|
45205
|
+
scope: ScopedSettingsScopeSchema,
|
|
45030
45206
|
nodeId: string().optional()
|
|
45031
|
-
}),
|
|
45207
|
+
}), record(string(), unknown()).nullable()), method(object({
|
|
45032
45208
|
addonId: string(),
|
|
45033
45209
|
nodeId: string().optional(),
|
|
45034
45210
|
instance: IntegrationInstanceRefSchema
|
|
@@ -46591,7 +46767,7 @@ var BackupDestinationInfoSchema = object({
|
|
|
46591
46767
|
id: string(),
|
|
46592
46768
|
/**
|
|
46593
46769
|
* Manifest id of the owning addon. The Settings button on the
|
|
46594
|
-
* destination card opens that addon's
|
|
46770
|
+
* destination card opens that addon's scoped settings panel.
|
|
46595
46771
|
*/
|
|
46596
46772
|
addonId: string(),
|
|
46597
46773
|
/** Operator-toggled enable flag from the destination-policy table. */
|
|
@@ -50005,7 +50181,7 @@ var mediaPlayerCapability = {
|
|
|
50005
50181
|
isMuted: { kind: "boolean" }
|
|
50006
50182
|
} }
|
|
50007
50183
|
};
|
|
50008
|
-
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;
|
|
50009
50185
|
var NUMBER = {
|
|
50010
50186
|
kind: "fixed",
|
|
50011
50187
|
result: ["number"]
|
|
@@ -52044,6 +52220,7 @@ method(InstancePinSchema, DeviceExportStatusSchema), method(_void(), array(Expor
|
|
|
52044
52220
|
kind: "mutation",
|
|
52045
52221
|
auth: "admin"
|
|
52046
52222
|
});
|
|
52223
|
+
var DeviceAliasSchema = string().max(64).regex(/^[a-z][a-z0-9_]*$/);
|
|
52047
52224
|
/**
|
|
52048
52225
|
* A SITE ZONE — a named part of the property that several locations belong to.
|
|
52049
52226
|
*
|
|
@@ -52530,6 +52707,12 @@ var DeviceInfoSchema = object({
|
|
|
52530
52707
|
addonId: string(),
|
|
52531
52708
|
type: _enum(DeviceType),
|
|
52532
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(),
|
|
52533
52716
|
/** Operator-organisational location label. `null` when unset. */
|
|
52534
52717
|
location: string().nullable(),
|
|
52535
52718
|
/** Soft-disabled flag. */
|
|
@@ -52849,6 +53032,25 @@ method(object({
|
|
|
52849
53032
|
}), _void(), {
|
|
52850
53033
|
kind: "mutation",
|
|
52851
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"
|
|
52852
53054
|
}), method(object({
|
|
52853
53055
|
deviceId: number(),
|
|
52854
53056
|
location: string().nullable()
|
|
@@ -56558,7 +56760,7 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
|
|
|
56558
56760
|
* or the redaction token KEEPS the stored secret; `{ $secretClear: true }`
|
|
56559
56761
|
* clears it.
|
|
56560
56762
|
*/
|
|
56561
|
-
var ConfigSchemaPassthrough$
|
|
56763
|
+
var ConfigSchemaPassthrough$2 = custom();
|
|
56562
56764
|
var IntegrationInstanceIdSchema = string().min(1);
|
|
56563
56765
|
var IntegrationInstanceModeSchema = _enum(["single", "multiple"]);
|
|
56564
56766
|
/**
|
|
@@ -56604,7 +56806,16 @@ var IntegrationInstanceKindSchema = object({
|
|
|
56604
56806
|
/** Relative hub path to start an interactive account link of an instance of this kind. */
|
|
56605
56807
|
connectPath: string().min(1).optional(),
|
|
56606
56808
|
/** Relative hub path to disconnect that account. */
|
|
56607
|
-
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()
|
|
56608
56819
|
});
|
|
56609
56820
|
/**
|
|
56610
56821
|
* How devices of an instance are found. `none`: the operator adds them by hand; `lan`: the addon
|
|
@@ -56645,10 +56856,11 @@ var IntegrationInstanceDescriptionSchema = object({
|
|
|
56645
56856
|
/** True when `testInstance` really probes the remote. */
|
|
56646
56857
|
canTest: boolean(),
|
|
56647
56858
|
/**
|
|
56648
|
-
* The kinds an instance can be of
|
|
56649
|
-
* 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.
|
|
56650
56862
|
*/
|
|
56651
|
-
kinds: array(IntegrationInstanceKindSchema).
|
|
56863
|
+
kinds: array(IntegrationInstanceKindSchema).min(1),
|
|
56652
56864
|
/**
|
|
56653
56865
|
* The provider accepts `createInstance.id` for an id that once existed (an adopted id, because
|
|
56654
56866
|
* devices carry it). The UI then offers "restore under its old id" on Add. Absent means no.
|
|
@@ -56684,8 +56896,8 @@ var IntegrationInstanceSchema = object({
|
|
|
56684
56896
|
* the body is the one store, `setInstanceEnabled` the one writer (epic #440, step 3).
|
|
56685
56897
|
*/
|
|
56686
56898
|
enabled: boolean().optional(),
|
|
56687
|
-
/** The kind of this instance
|
|
56688
|
-
kind: string().
|
|
56899
|
+
/** The kind of this instance: exactly one of `describe().kinds[].id` (D1013 rule 2). */
|
|
56900
|
+
kind: string().min(1),
|
|
56689
56901
|
/** Values for the instance form; a secret is a `SecretFieldView`, never text. */
|
|
56690
56902
|
formValues: record(string(), unknown()),
|
|
56691
56903
|
status: IntegrationInstanceStatusSchema.optional(),
|
|
@@ -56709,7 +56921,7 @@ var integrationInstancesCapability = {
|
|
|
56709
56921
|
id: IntegrationInstanceIdSchema.nullable(),
|
|
56710
56922
|
/** The kind of the create form (`id: null`) of a provider with several. */
|
|
56711
56923
|
kind: string().min(1).optional()
|
|
56712
|
-
}), ConfigSchemaPassthrough$
|
|
56924
|
+
}), ConfigSchemaPassthrough$2, { auth: "admin" }),
|
|
56713
56925
|
listInstances: method(_void(), array(IntegrationInstanceSchema).readonly(), { auth: "admin" }),
|
|
56714
56926
|
getInstance: method(object({ id: IntegrationInstanceIdSchema }), IntegrationInstanceSchema.nullable(), { auth: "admin" }),
|
|
56715
56927
|
/**
|
|
@@ -57811,12 +58023,12 @@ var LlmModelInfoSchema = object({
|
|
|
57811
58023
|
});
|
|
57812
58024
|
/**
|
|
57813
58025
|
* The provider-specific part of a profile, validated by the provider that owns
|
|
57814
|
-
* the kind (
|
|
58026
|
+
* the kind (saving an instance refuses what it does not accept). A field its
|
|
57815
58027
|
* `connectionSchema` declares `type: 'password'` is a secret: it is held in the
|
|
57816
58028
|
* keychain, never in the row, and reads back as the redaction marker.
|
|
57817
58029
|
*/
|
|
57818
58030
|
var LlmProviderConfigSchema = record(string(), unknown());
|
|
57819
|
-
|
|
58031
|
+
object({
|
|
57820
58032
|
id: string(),
|
|
57821
58033
|
name: string(),
|
|
57822
58034
|
/** The provider-declared kind (`LlmProfileKindDescriptor.kind`). */
|
|
@@ -57910,8 +58122,8 @@ var LlmProviderWidgetSchema = object({
|
|
|
57910
58122
|
/** ConfigUISchema tree passed through untyped on the wire (the
|
|
57911
58123
|
* notification-output `ConfigSchemaPassthrough` precedent at
|
|
57912
58124
|
* notification-output.cap.ts:151); the exported TS type re-tightens it. */
|
|
57913
|
-
var ConfigSchemaPassthrough$
|
|
57914
|
-
|
|
58125
|
+
var ConfigSchemaPassthrough$1 = unknown();
|
|
58126
|
+
object({
|
|
57915
58127
|
kind: LlmProfileKindSchema,
|
|
57916
58128
|
label: string(),
|
|
57917
58129
|
/** A generic icon name (`cloud`, `plug`, `cpu`) — never a glyph or a logo. */
|
|
@@ -57919,9 +58131,9 @@ var LlmProfileKindDescriptorSchema = object({
|
|
|
57919
58131
|
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
57920
58132
|
addonId: string(),
|
|
57921
58133
|
/** The provider's own fields (`providerConfig`); `password` fields are keychain-held. */
|
|
57922
|
-
connectionSchema: ConfigSchemaPassthrough$
|
|
58134
|
+
connectionSchema: ConfigSchemaPassthrough$1,
|
|
57923
58135
|
/** Provider fields that belong under "Advanced" (extra headers, runtime tuning). */
|
|
57924
|
-
advancedSchema: ConfigSchemaPassthrough$
|
|
58136
|
+
advancedSchema: ConfigSchemaPassthrough$1.optional(),
|
|
57925
58137
|
/** The kind's defaults; a model from `listModels` may override any of them. */
|
|
57926
58138
|
features: LlmModelFeaturesSchema,
|
|
57927
58139
|
/** `false` = the provider stamps `supportsVision` itself (from what a node reports). */
|
|
@@ -58050,20 +58262,7 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
|
|
|
58050
58262
|
}), method(object({
|
|
58051
58263
|
addonId: string().optional(),
|
|
58052
58264
|
requestId: string()
|
|
58053
|
-
}), _void(), { kind: "mutation" }), method(
|
|
58054
|
-
kind: "mutation",
|
|
58055
|
-
auth: "admin"
|
|
58056
|
-
}), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
|
|
58057
|
-
kind: "mutation",
|
|
58058
|
-
auth: "admin"
|
|
58059
|
-
}), method(ProfileRefInputSchema, _void(), {
|
|
58060
|
-
kind: "mutation",
|
|
58061
|
-
auth: "admin"
|
|
58062
|
-
}), method(ProfileRefInputSchema, LlmGenerateResultSchema, {
|
|
58063
|
-
kind: "mutation",
|
|
58064
|
-
auth: "admin",
|
|
58065
|
-
timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
|
|
58066
|
-
}), method(LlmListModelsInputSchema, LlmListModelsResultSchema, {
|
|
58265
|
+
}), _void(), { kind: "mutation" }), method(LlmListModelsInputSchema, LlmListModelsResultSchema, {
|
|
58067
58266
|
kind: "mutation",
|
|
58068
58267
|
auth: "admin"
|
|
58069
58268
|
}), method(object({}), array(LlmDefaultSchema)), method(object({
|
|
@@ -59126,20 +59325,7 @@ method(_void(), MeshStatusSchema), method(object({
|
|
|
59126
59325
|
/** Optional hostname override the host should advertise once joined. */
|
|
59127
59326
|
hostname: string().optional() }), object({
|
|
59128
59327
|
/** Authentication URL the operator should open in a browser. */
|
|
59129
|
-
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() }))
|
|
59130
|
-
/** Optional auth key — when provided, probes the key validity
|
|
59131
|
-
* against the provider's API. Omit when already joined to
|
|
59132
|
-
* just ping the daemon. */
|
|
59133
|
-
authKey: string().optional() }), object({
|
|
59134
|
-
ok: boolean(),
|
|
59135
|
-
/** Provider-side identifier resolved by the probe (tailnet
|
|
59136
|
-
* name for Tailscale, network id for ZeroTier, etc.). */
|
|
59137
|
-
tenant: string().optional(),
|
|
59138
|
-
/** Daemon binary version, when reachable. */
|
|
59139
|
-
daemonVersion: string().optional(),
|
|
59140
|
-
/** Human-readable error when `ok: false`. */
|
|
59141
|
-
error: string().optional()
|
|
59142
|
-
}), { 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() }));
|
|
59143
59329
|
/**
|
|
59144
59330
|
* A monotonic total between resets (D944). Energy uses `power-meter.energy`
|
|
59145
59331
|
* so dashboards keep one series; every other instantaneous reading lands here.
|
|
@@ -66966,6 +67152,11 @@ var NcScheduleSchema = object({
|
|
|
66966
67152
|
* as a STATE SUMMARY at the end of each window of `schedule`.
|
|
66967
67153
|
*/
|
|
66968
67154
|
var NcSystemEventDeliveryModeSchema = _enum(["instant", "summary"]);
|
|
67155
|
+
_enum([
|
|
67156
|
+
"activation",
|
|
67157
|
+
"deactivation",
|
|
67158
|
+
"schedule"
|
|
67159
|
+
]);
|
|
66969
67160
|
/**
|
|
66970
67161
|
* How a summary window is SENT (D698): `rule` (absent) = ONE notification with
|
|
66971
67162
|
* every section; `section` = one notification per section with something to
|
|
@@ -66982,11 +67173,26 @@ var NcStateSummarySplitSchema = _enum(["rule", "section"]);
|
|
|
66982
67173
|
* midnight crossing); the send time is each window's END. Refused on the
|
|
66983
67174
|
* `alarm` family, which stays instant (`systemEventDeliveryProblems`).
|
|
66984
67175
|
*/
|
|
66985
|
-
var NcSystemEventDeliverySchema = discriminatedUnion("mode", [
|
|
66986
|
-
mode: literal("
|
|
66987
|
-
|
|
66988
|
-
|
|
66989
|
-
|
|
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
|
+
]);
|
|
66990
67196
|
/** Fuzzy plate matcher — OCR noise makes exact match useless (spec row 12/13). */
|
|
66991
67197
|
var NcPlateMatcherSchema = object({
|
|
66992
67198
|
/**
|
|
@@ -69346,61 +69552,6 @@ var OauthIntegrationDescriptorSchema = object({
|
|
|
69346
69552
|
});
|
|
69347
69553
|
method(_void(), OauthIntegrationDescriptorSchema, { auth: "admin" });
|
|
69348
69554
|
/**
|
|
69349
|
-
* `oidc-connections` — CRUD for IdP rows under `auth-oidc` (D828 sibling).
|
|
69350
|
-
*
|
|
69351
|
-
* One hub-only singleton (`auth-oidc`). The Settings UI is a DataTable +
|
|
69352
|
-
* ItemFormDialog; there is no `editable-array` in `globalSettingsSchema`.
|
|
69353
|
-
* Operator-chosen `id` is the URL slug (`/addon/auth-oidc/<id>/…`) and is
|
|
69354
|
-
* immutable after create.
|
|
69355
|
-
*/
|
|
69356
|
-
var ConfigSchemaPassthrough$1 = unknown();
|
|
69357
|
-
var OidcConnectionSchema = object({
|
|
69358
|
-
id: string().min(1),
|
|
69359
|
-
displayName: string(),
|
|
69360
|
-
icon: string(),
|
|
69361
|
-
issuerUrl: string(),
|
|
69362
|
-
clientId: string(),
|
|
69363
|
-
/** Client id + secret present — never the secret value. */
|
|
69364
|
-
configured: boolean(),
|
|
69365
|
-
/**
|
|
69366
|
-
* Values for the connection form schema. `clientSecret` is a keychain
|
|
69367
|
-
* {@link SecretFieldView} or `null` / `''`, never plaintext (D789).
|
|
69368
|
-
*/
|
|
69369
|
-
formValues: record(string(), unknown()).optional()
|
|
69370
|
-
});
|
|
69371
|
-
/**
|
|
69372
|
-
* Patch one connection. Omitted or empty `clientSecret` keeps the stored
|
|
69373
|
-
* secret (D787). `{ $secretClear: true }` clears it. `id` is never renamed.
|
|
69374
|
-
*/
|
|
69375
|
-
var OidcConnectionUpdateInputSchema = object({
|
|
69376
|
-
id: string().min(1),
|
|
69377
|
-
displayName: string().min(1),
|
|
69378
|
-
icon: string().optional(),
|
|
69379
|
-
issuerUrl: string().optional(),
|
|
69380
|
-
clientId: string().optional(),
|
|
69381
|
-
clientSecret: union([string(), object({ $secretClear: literal(true) })]).optional(),
|
|
69382
|
-
redirectUri: string().optional(),
|
|
69383
|
-
scopes: string().optional(),
|
|
69384
|
-
usernameClaim: _enum([
|
|
69385
|
-
"preferred_username",
|
|
69386
|
-
"email",
|
|
69387
|
-
"sub"
|
|
69388
|
-
]).optional()
|
|
69389
|
-
});
|
|
69390
|
-
method(object({}), ConfigSchemaPassthrough$1, { auth: "admin" }), method(object({}), array(OidcConnectionSchema).readonly(), { auth: "admin" }), method(object({
|
|
69391
|
-
id: string().min(1).regex(/^[a-z0-9][a-z0-9-]{0,63}$/, "id must be a lowercase slug"),
|
|
69392
|
-
displayName: string().min(1)
|
|
69393
|
-
}), object({ id: string() }), {
|
|
69394
|
-
kind: "mutation",
|
|
69395
|
-
auth: "admin"
|
|
69396
|
-
}), method(OidcConnectionUpdateInputSchema, object({ ok: literal(true) }), {
|
|
69397
|
-
kind: "mutation",
|
|
69398
|
-
auth: "admin"
|
|
69399
|
-
}), method(object({ id: string().min(1) }), object({ ok: literal(true) }), {
|
|
69400
|
-
kind: "mutation",
|
|
69401
|
-
auth: "admin"
|
|
69402
|
-
});
|
|
69403
|
-
/**
|
|
69404
69555
|
* Generic on-screen-display (video overlay) cap. Each camera exposes
|
|
69405
69556
|
* a firmware-defined list of overlays (channel name, timestamp,
|
|
69406
69557
|
* watermark, logo, …); the cap models them as a homogeneous array of
|
|
@@ -75115,6 +75266,16 @@ var RemoteLayoutComponentSchema = object({
|
|
|
75115
75266
|
method(object({}), array(RemoteLayoutComponentSchema), { auth: "protected" });
|
|
75116
75267
|
var RUNNING_POWER_START_DELAY_MS = 3e4;
|
|
75117
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
|
+
} };
|
|
75118
75279
|
var RunningStateSourceSchema = _enum(["native", "assigned"]);
|
|
75119
75280
|
var RunningStateStatusSchema = object({
|
|
75120
75281
|
/** null = unknown — never coerced to false (D393). */
|
|
@@ -75132,93 +75293,27 @@ var RunningFlipEventDataSchema = object({
|
|
|
75132
75293
|
phase: string().nullable()
|
|
75133
75294
|
});
|
|
75134
75295
|
var RUNNING_DEVICE_TYPES = Object.values(DeviceType);
|
|
75135
|
-
/**
|
|
75136
|
-
|
|
75137
|
-
|
|
75138
|
-
|
|
75139
|
-
|
|
75140
|
-
|
|
75141
|
-
|
|
75142
|
-
|
|
75143
|
-
|
|
75144
|
-
|
|
75145
|
-
|
|
75146
|
-
|
|
75147
|
-
|
|
75148
|
-
|
|
75149
|
-
|
|
75150
|
-
|
|
75151
|
-
|
|
75152
|
-
|
|
75153
|
-
|
|
75154
|
-
|
|
75155
|
-
|
|
75156
|
-
DeviceType.WaterHeater,
|
|
75157
|
-
DeviceType.Humidifier,
|
|
75158
|
-
DeviceType.Fan,
|
|
75159
|
-
DeviceType.Climate,
|
|
75160
|
-
DeviceType.Thermostat,
|
|
75161
|
-
DeviceType.PetFeeder,
|
|
75162
|
-
DeviceType.Heater
|
|
75163
|
-
],
|
|
75164
|
-
apply: "add",
|
|
75165
|
-
path: "running",
|
|
75166
|
-
sources: [
|
|
75167
|
-
{
|
|
75168
|
-
kind: "switch",
|
|
75169
|
-
transforms: [{ kind: "identity" }]
|
|
75170
|
-
},
|
|
75171
|
-
{
|
|
75172
|
-
kind: "binary",
|
|
75173
|
-
transforms: [{ kind: "identity" }, { kind: "invert" }]
|
|
75174
|
-
},
|
|
75175
|
-
{
|
|
75176
|
-
kind: "numeric",
|
|
75177
|
-
requiredUnit: "W",
|
|
75178
|
-
transforms: [{
|
|
75179
|
-
kind: "threshold",
|
|
75180
|
-
comparisons: ["gte", "lte"],
|
|
75181
|
-
comparison: "gte",
|
|
75182
|
-
defaultThreshold: 5,
|
|
75183
|
-
defaultStartDwellMs: RUNNING_POWER_START_DELAY_MS,
|
|
75184
|
-
defaultStopDwellMs: RUNNING_POWER_STOP_DELAY_MS,
|
|
75185
|
-
thresholdUnit: "W"
|
|
75186
|
-
}]
|
|
75187
|
-
}
|
|
75188
|
-
],
|
|
75189
|
-
companions: [
|
|
75190
|
-
{
|
|
75191
|
-
kind: "constant",
|
|
75192
|
-
path: "source",
|
|
75193
|
-
value: "assigned",
|
|
75194
|
-
when: "always"
|
|
75195
|
-
},
|
|
75196
|
-
{
|
|
75197
|
-
kind: "constant",
|
|
75198
|
-
path: "phase",
|
|
75199
|
-
value: null,
|
|
75200
|
-
when: "add"
|
|
75201
|
-
},
|
|
75202
|
-
{
|
|
75203
|
-
kind: "clock",
|
|
75204
|
-
path: "lastFetchedAt",
|
|
75205
|
-
when: "always"
|
|
75206
|
-
},
|
|
75207
|
-
{
|
|
75208
|
-
kind: "transition-time",
|
|
75209
|
-
path: "since",
|
|
75210
|
-
sourceChangedAt: "prefer"
|
|
75211
|
-
}
|
|
75212
|
-
],
|
|
75213
|
-
sourceReport: {
|
|
75214
|
-
status: "assignment-status",
|
|
75215
|
-
runtimeField: "source",
|
|
75216
|
-
nativeValue: "native",
|
|
75217
|
-
assignedValue: "assigned"
|
|
75218
|
-
},
|
|
75219
|
-
advancedExpression: true
|
|
75220
|
-
}]
|
|
75221
|
-
};
|
|
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
|
+
];
|
|
75222
75317
|
var runningStateCapability = {
|
|
75223
75318
|
name: "running-state",
|
|
75224
75319
|
scope: "device",
|
|
@@ -75238,7 +75333,79 @@ var runningStateCapability = {
|
|
|
75238
75333
|
durability: "restored",
|
|
75239
75334
|
history: { fields: { running: { kind: "boolean" } } },
|
|
75240
75335
|
volatileStateFields: ["lastFetchedAt"],
|
|
75241
|
-
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
|
+
}
|
|
75242
75409
|
};
|
|
75243
75410
|
/**
|
|
75244
75411
|
* scene-monitor — device-scoped reference-region state cap. An operator marks
|
|
@@ -76482,21 +76649,6 @@ method(object({
|
|
|
76482
76649
|
*/
|
|
76483
76650
|
ttlSec: union([number().int().positive(), literal("never")]).optional()
|
|
76484
76651
|
}), object({ token: string() }), { auth: "admin" }), method(object({ token: string() }), SsoBridgeClaimsSchema.nullable(), { auth: "admin" });
|
|
76485
|
-
var ProviderListEntrySchema = discriminatedUnion("shouldSaveDiskSpace", [object({
|
|
76486
|
-
providerId: string().min(1),
|
|
76487
|
-
displayName: string().min(1),
|
|
76488
|
-
configSchema: unknown(),
|
|
76489
|
-
nodeLocal: boolean(),
|
|
76490
|
-
shouldSaveDiskSpace: literal(true),
|
|
76491
|
-
minFreePercent: number().min(0).max(100)
|
|
76492
|
-
}), object({
|
|
76493
|
-
providerId: string().min(1),
|
|
76494
|
-
displayName: string().min(1),
|
|
76495
|
-
configSchema: unknown(),
|
|
76496
|
-
nodeLocal: boolean(),
|
|
76497
|
-
shouldSaveDiskSpace: literal(false),
|
|
76498
|
-
minFreePercent: literal(null)
|
|
76499
|
-
})]);
|
|
76500
76652
|
method(object({
|
|
76501
76653
|
location: StorageLocationRefSchema,
|
|
76502
76654
|
relativePath: string()
|
|
@@ -76558,42 +76710,7 @@ method(object({
|
|
|
76558
76710
|
}), _instanceof(Uint8Array), { auth: "admin" }), method(object({ downloadId: string() }), _void(), {
|
|
76559
76711
|
kind: "mutation",
|
|
76560
76712
|
auth: "admin"
|
|
76561
|
-
}), method(object({ type: StorageLocationTypeSchema.optional() }), array(StorageLocationSchema).readonly()), method(_void(), array(StorageLocationDeclarationSchema).readonly()), method(
|
|
76562
|
-
createdAt: true,
|
|
76563
|
-
updatedAt: true
|
|
76564
|
-
}), StorageLocationSchema, {
|
|
76565
|
-
kind: "mutation",
|
|
76566
|
-
auth: "admin"
|
|
76567
|
-
}), method(object({
|
|
76568
|
-
id: string(),
|
|
76569
|
-
force: boolean().optional()
|
|
76570
|
-
}), _void(), {
|
|
76571
|
-
kind: "mutation",
|
|
76572
|
-
auth: "admin"
|
|
76573
|
-
}), method(_void(), array(StorageDrainProgressSchema).readonly()), method(object({ id: string() }), object({
|
|
76574
|
-
ok: boolean(),
|
|
76575
|
-
error: string().optional()
|
|
76576
|
-
}), { auth: "admin" }), method(_void(), array(ProviderListEntrySchema).readonly()), method(object({
|
|
76577
|
-
providerId: string(),
|
|
76578
|
-
/**
|
|
76579
|
-
* The location this config is an UNSAVED edit of, when there is one.
|
|
76580
|
-
*
|
|
76581
|
-
* `listLocations` replaces every declared secret with the redaction
|
|
76582
|
-
* sentinel, so the edit modal's form state holds the sentinel for any
|
|
76583
|
-
* credential the operator did not retype — and posting that here
|
|
76584
|
-
* without a way to resolve it makes the provider try to authenticate
|
|
76585
|
-
* as `__camstack_redacted__` and report the operator's own working
|
|
76586
|
-
* password as wrong. Given this id, the orchestrator restores each
|
|
76587
|
-
* sentinel from the stored config (same rule as `upsertLocation`)
|
|
76588
|
-
* before dispatching. Omitted by the "Add location" wizard, where
|
|
76589
|
-
* every value was typed just now and nothing is stored yet.
|
|
76590
|
-
*/
|
|
76591
|
-
locationId: string().optional(),
|
|
76592
|
-
config: record(string(), unknown())
|
|
76593
|
-
}), object({
|
|
76594
|
-
ok: boolean(),
|
|
76595
|
-
error: string().optional()
|
|
76596
|
-
}), { auth: "admin" });
|
|
76713
|
+
}), method(object({ type: StorageLocationTypeSchema.optional() }), array(StorageLocationSchema).readonly()), method(_void(), array(StorageLocationDeclarationSchema).readonly()), method(_void(), array(StorageDrainProgressSchema).readonly());
|
|
76597
76714
|
/** One table of the settings database. */
|
|
76598
76715
|
var StorageTableSchema = object({
|
|
76599
76716
|
/** The table's full name, e.g. `recorder:addon-settings` or `addon-device-settings`. */
|
|
@@ -78115,7 +78232,7 @@ var TerminalInstanceInfoSchema = object({
|
|
|
78115
78232
|
/**
|
|
78116
78233
|
* False while the node the instance is bound to is not in the cluster
|
|
78117
78234
|
* topology (forgotten, renamed, re-paired). The instance is kept; the
|
|
78118
|
-
* operator re-points it
|
|
78235
|
+
* operator re-points it on the Terminal page.
|
|
78119
78236
|
*/
|
|
78120
78237
|
nodeInCluster: boolean(),
|
|
78121
78238
|
profileId: string(),
|
|
@@ -78153,41 +78270,7 @@ var TerminalOutputBatchSchema = object({
|
|
|
78153
78270
|
snapshot: string().optional(),
|
|
78154
78271
|
events: array(TerminalOutputEventSchema).readonly()
|
|
78155
78272
|
});
|
|
78156
|
-
method(_void(), array(TerminalProfileInfoSchema).readonly(), { auth: "admin" }), method(_void(), array(
|
|
78157
|
-
targetNodeId: string().min(1),
|
|
78158
|
-
profileId: string().min(1),
|
|
78159
|
-
name: string().trim().min(1).max(160).optional(),
|
|
78160
|
-
executable: string().max(1024).optional(),
|
|
78161
|
-
args: array(string().max(2048)).max(64).optional(),
|
|
78162
|
-
cwd: string().max(1024).optional(),
|
|
78163
|
-
environment: array(string().max(4096)).max(64).optional(),
|
|
78164
|
-
profileSettings: ProfileSettingsBagSchema.optional()
|
|
78165
|
-
}), TerminalInstanceInfoSchema, {
|
|
78166
|
-
kind: "mutation",
|
|
78167
|
-
auth: "admin"
|
|
78168
|
-
}), method(object({
|
|
78169
|
-
instanceId: string().min(1),
|
|
78170
|
-
/** Re-point the instance to another node; the profile must exist there. */
|
|
78171
|
-
targetNodeId: string().min(1).max(256).optional(),
|
|
78172
|
-
name: string().trim().min(1).max(160).optional(),
|
|
78173
|
-
executable: string().max(1024).optional(),
|
|
78174
|
-
args: array(string().max(2048)).max(64).optional(),
|
|
78175
|
-
cwd: string().max(1024).optional(),
|
|
78176
|
-
environment: array(string().max(4096)).max(64).optional(),
|
|
78177
|
-
profileSettings: ProfileSettingsBagSchema.optional()
|
|
78178
|
-
}), TerminalInstanceInfoSchema, {
|
|
78179
|
-
kind: "mutation",
|
|
78180
|
-
auth: "admin"
|
|
78181
|
-
}), method(object({ instanceId: string().min(1) }), _void(), {
|
|
78182
|
-
kind: "mutation",
|
|
78183
|
-
auth: "admin"
|
|
78184
|
-
}), method(object({
|
|
78185
|
-
instanceId: string().min(1),
|
|
78186
|
-
enabled: boolean()
|
|
78187
|
-
}), TerminalInstanceInfoSchema, {
|
|
78188
|
-
kind: "mutation",
|
|
78189
|
-
auth: "admin"
|
|
78190
|
-
}), 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({
|
|
78191
78274
|
stableId: string().min(1),
|
|
78192
78275
|
name: string().trim().min(1).max(160).optional()
|
|
78193
78276
|
}), TerminalInstanceInfoSchema, {
|
|
@@ -78256,6 +78339,11 @@ var TimedRunUnitSchema = _enum(["s", "min"]);
|
|
|
78256
78339
|
_enum(["switch", "pet-fountain"]);
|
|
78257
78340
|
DeviceType.Heater, DeviceType.PetFountain;
|
|
78258
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
|
+
});
|
|
78259
78347
|
/** Why a request was not carried out. Typed, so a caller can say it in words. */
|
|
78260
78348
|
var TimedRunRefusalSchema = _enum([
|
|
78261
78349
|
"unsupported-device",
|
|
@@ -78276,8 +78364,23 @@ var TimedRunStatusSchema = object({
|
|
|
78276
78364
|
activeUntil: number().nullable(),
|
|
78277
78365
|
/** Who asked for the run (a user id or an addon id); `null` when nothing is armed or it did not say. */
|
|
78278
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(),
|
|
78279
78373
|
lastFetchedAt: number()
|
|
78280
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() });
|
|
78281
78384
|
var timedRunCapability = {
|
|
78282
78385
|
name: "timed-run",
|
|
78283
78386
|
scope: "device",
|
|
@@ -78285,7 +78388,24 @@ var timedRunCapability = {
|
|
|
78285
78388
|
kind: "wrapper",
|
|
78286
78389
|
defaultActive: true,
|
|
78287
78390
|
deviceTypes: TIMED_RUN_DEVICE_TYPES,
|
|
78391
|
+
deviceConfig: { ui: {
|
|
78392
|
+
kind: "derived-form",
|
|
78393
|
+
builderId: "timed-run",
|
|
78394
|
+
tab: "general"
|
|
78395
|
+
} },
|
|
78288
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
|
+
}),
|
|
78289
78409
|
/**
|
|
78290
78410
|
* Turn the device on and arm its off. A run already armed is replaced (the
|
|
78291
78411
|
* new deadline wins). Refuses with a typed reason above the type's maximum.
|
|
@@ -83078,21 +83198,28 @@ Object.freeze({
|
|
|
83078
83198
|
access: "view",
|
|
83079
83199
|
role: "admin"
|
|
83080
83200
|
},
|
|
83081
|
-
"addonSettings.
|
|
83201
|
+
"addonSettings.getIntegrationFormSchema": {
|
|
83082
83202
|
capName: "addon-settings",
|
|
83083
83203
|
capScope: "system",
|
|
83084
83204
|
addonId: null,
|
|
83085
83205
|
access: "view",
|
|
83086
83206
|
role: "admin"
|
|
83087
83207
|
},
|
|
83088
|
-
"addonSettings.
|
|
83208
|
+
"addonSettings.getScopedSettings": {
|
|
83209
|
+
capName: "addon-settings",
|
|
83210
|
+
capScope: "system",
|
|
83211
|
+
addonId: null,
|
|
83212
|
+
access: "view",
|
|
83213
|
+
role: "admin"
|
|
83214
|
+
},
|
|
83215
|
+
"addonSettings.listScopedSettings": {
|
|
83089
83216
|
capName: "addon-settings",
|
|
83090
83217
|
capScope: "system",
|
|
83091
83218
|
addonId: null,
|
|
83092
83219
|
access: "view",
|
|
83093
83220
|
role: "admin"
|
|
83094
83221
|
},
|
|
83095
|
-
"addonSettings.
|
|
83222
|
+
"addonSettings.readScopedValues": {
|
|
83096
83223
|
capName: "addon-settings",
|
|
83097
83224
|
capScope: "system",
|
|
83098
83225
|
addonId: null,
|
|
@@ -83113,7 +83240,7 @@ Object.freeze({
|
|
|
83113
83240
|
access: "create",
|
|
83114
83241
|
role: "admin"
|
|
83115
83242
|
},
|
|
83116
|
-
"addonSettings.
|
|
83243
|
+
"addonSettings.updateScopedSettings": {
|
|
83117
83244
|
capName: "addon-settings",
|
|
83118
83245
|
capScope: "system",
|
|
83119
83246
|
addonId: null,
|
|
@@ -85283,6 +85410,13 @@ Object.freeze({
|
|
|
85283
85410
|
access: "create",
|
|
85284
85411
|
role: "admin"
|
|
85285
85412
|
},
|
|
85413
|
+
"deviceManager.setAlias": {
|
|
85414
|
+
capName: "device-manager",
|
|
85415
|
+
capScope: "system",
|
|
85416
|
+
addonId: null,
|
|
85417
|
+
access: "create",
|
|
85418
|
+
role: "admin"
|
|
85419
|
+
},
|
|
85286
85420
|
"deviceManager.setChildLayout": {
|
|
85287
85421
|
capName: "device-manager",
|
|
85288
85422
|
capScope: "system",
|
|
@@ -86571,13 +86705,6 @@ Object.freeze({
|
|
|
86571
86705
|
access: "delete",
|
|
86572
86706
|
role: "admin"
|
|
86573
86707
|
},
|
|
86574
|
-
"llm.deleteProfile": {
|
|
86575
|
-
capName: "llm",
|
|
86576
|
-
capScope: "system",
|
|
86577
|
-
addonId: null,
|
|
86578
|
-
access: "delete",
|
|
86579
|
-
role: "admin"
|
|
86580
|
-
},
|
|
86581
86708
|
"llm.generate": {
|
|
86582
86709
|
capName: "llm",
|
|
86583
86710
|
capScope: "system",
|
|
@@ -86641,20 +86768,6 @@ Object.freeze({
|
|
|
86641
86768
|
access: "view",
|
|
86642
86769
|
role: "admin"
|
|
86643
86770
|
},
|
|
86644
|
-
"llm.listProfileKinds": {
|
|
86645
|
-
capName: "llm",
|
|
86646
|
-
capScope: "system",
|
|
86647
|
-
addonId: null,
|
|
86648
|
-
access: "view",
|
|
86649
|
-
role: "admin"
|
|
86650
|
-
},
|
|
86651
|
-
"llm.listProfiles": {
|
|
86652
|
-
capName: "llm",
|
|
86653
|
-
capScope: "system",
|
|
86654
|
-
addonId: null,
|
|
86655
|
-
access: "view",
|
|
86656
|
-
role: "admin"
|
|
86657
|
-
},
|
|
86658
86771
|
"llm.listRuntimeNodes": {
|
|
86659
86772
|
capName: "llm",
|
|
86660
86773
|
capScope: "system",
|
|
@@ -86662,13 +86775,6 @@ Object.freeze({
|
|
|
86662
86775
|
access: "view",
|
|
86663
86776
|
role: "admin"
|
|
86664
86777
|
},
|
|
86665
|
-
"llm.migrateRawSecrets": {
|
|
86666
|
-
capName: "llm",
|
|
86667
|
-
capScope: "system",
|
|
86668
|
-
addonId: null,
|
|
86669
|
-
access: "create",
|
|
86670
|
-
role: "admin"
|
|
86671
|
-
},
|
|
86672
86778
|
"llm.resolveModelRef": {
|
|
86673
86779
|
capName: "llm",
|
|
86674
86780
|
capScope: "system",
|
|
@@ -86697,20 +86803,6 @@ Object.freeze({
|
|
|
86697
86803
|
access: "create",
|
|
86698
86804
|
role: "admin"
|
|
86699
86805
|
},
|
|
86700
|
-
"llm.testProfile": {
|
|
86701
|
-
capName: "llm",
|
|
86702
|
-
capScope: "system",
|
|
86703
|
-
addonId: null,
|
|
86704
|
-
access: "create",
|
|
86705
|
-
role: "admin"
|
|
86706
|
-
},
|
|
86707
|
-
"llm.upsertProfile": {
|
|
86708
|
-
capName: "llm",
|
|
86709
|
-
capScope: "system",
|
|
86710
|
-
addonId: null,
|
|
86711
|
-
access: "create",
|
|
86712
|
-
role: "admin"
|
|
86713
|
-
},
|
|
86714
86806
|
"llmRuntime.appleAvailability": {
|
|
86715
86807
|
capName: "llm-runtime",
|
|
86716
86808
|
capScope: "system",
|
|
@@ -87215,13 +87307,6 @@ Object.freeze({
|
|
|
87215
87307
|
access: "create",
|
|
87216
87308
|
role: "admin"
|
|
87217
87309
|
},
|
|
87218
|
-
"meshNetwork.testConnection": {
|
|
87219
|
-
capName: "mesh-network",
|
|
87220
|
-
capScope: "system",
|
|
87221
|
-
addonId: null,
|
|
87222
|
-
access: "create",
|
|
87223
|
-
role: "admin"
|
|
87224
|
-
},
|
|
87225
87310
|
"meter.getStatus": {
|
|
87226
87311
|
capName: "meter",
|
|
87227
87312
|
capScope: "device",
|
|
@@ -87880,13 +87965,6 @@ Object.freeze({
|
|
|
87880
87965
|
access: "create",
|
|
87881
87966
|
role: "admin"
|
|
87882
87967
|
},
|
|
87883
|
-
"notificationOutput.deleteTarget": {
|
|
87884
|
-
capName: "notification-output",
|
|
87885
|
-
capScope: "system",
|
|
87886
|
-
addonId: null,
|
|
87887
|
-
access: "delete",
|
|
87888
|
-
role: "admin"
|
|
87889
|
-
},
|
|
87890
87968
|
"notificationOutput.discoverTargets": {
|
|
87891
87969
|
capName: "notification-output",
|
|
87892
87970
|
capScope: "system",
|
|
@@ -87894,13 +87972,6 @@ Object.freeze({
|
|
|
87894
87972
|
access: "view",
|
|
87895
87973
|
role: "admin"
|
|
87896
87974
|
},
|
|
87897
|
-
"notificationOutput.getTarget": {
|
|
87898
|
-
capName: "notification-output",
|
|
87899
|
-
capScope: "system",
|
|
87900
|
-
addonId: null,
|
|
87901
|
-
access: "view",
|
|
87902
|
-
role: "admin"
|
|
87903
|
-
},
|
|
87904
87975
|
"notificationOutput.listTargetKinds": {
|
|
87905
87976
|
capName: "notification-output",
|
|
87906
87977
|
capScope: "system",
|
|
@@ -87908,13 +87979,6 @@ Object.freeze({
|
|
|
87908
87979
|
access: "view",
|
|
87909
87980
|
role: "admin"
|
|
87910
87981
|
},
|
|
87911
|
-
"notificationOutput.listTargets": {
|
|
87912
|
-
capName: "notification-output",
|
|
87913
|
-
capScope: "system",
|
|
87914
|
-
addonId: null,
|
|
87915
|
-
access: "view",
|
|
87916
|
-
role: "admin"
|
|
87917
|
-
},
|
|
87918
87982
|
"notificationOutput.probeTargetConfig": {
|
|
87919
87983
|
capName: "notification-output",
|
|
87920
87984
|
capScope: "system",
|
|
@@ -87929,13 +87993,6 @@ Object.freeze({
|
|
|
87929
87993
|
access: "create",
|
|
87930
87994
|
role: "admin"
|
|
87931
87995
|
},
|
|
87932
|
-
"notificationOutput.setTargetEnabled": {
|
|
87933
|
-
capName: "notification-output",
|
|
87934
|
-
capScope: "system",
|
|
87935
|
-
addonId: null,
|
|
87936
|
-
access: "create",
|
|
87937
|
-
role: "admin"
|
|
87938
|
-
},
|
|
87939
87996
|
"notificationOutput.testTarget": {
|
|
87940
87997
|
capName: "notification-output",
|
|
87941
87998
|
capScope: "system",
|
|
@@ -87943,13 +88000,6 @@ Object.freeze({
|
|
|
87943
88000
|
access: "create",
|
|
87944
88001
|
role: "admin"
|
|
87945
88002
|
},
|
|
87946
|
-
"notificationOutput.upsertTarget": {
|
|
87947
|
-
capName: "notification-output",
|
|
87948
|
-
capScope: "system",
|
|
87949
|
-
addonId: null,
|
|
87950
|
-
access: "create",
|
|
87951
|
-
role: "admin"
|
|
87952
|
-
},
|
|
87953
88003
|
"notificationRules.activateAlarmProfile": {
|
|
87954
88004
|
capName: "notification-rules",
|
|
87955
88005
|
capScope: "system",
|
|
@@ -88209,41 +88259,6 @@ Object.freeze({
|
|
|
88209
88259
|
access: "view",
|
|
88210
88260
|
role: "admin"
|
|
88211
88261
|
},
|
|
88212
|
-
"oidcConnections.connectionFormSchema": {
|
|
88213
|
-
capName: "oidc-connections",
|
|
88214
|
-
capScope: "system",
|
|
88215
|
-
addonId: null,
|
|
88216
|
-
access: "view",
|
|
88217
|
-
role: "admin"
|
|
88218
|
-
},
|
|
88219
|
-
"oidcConnections.createConnection": {
|
|
88220
|
-
capName: "oidc-connections",
|
|
88221
|
-
capScope: "system",
|
|
88222
|
-
addonId: null,
|
|
88223
|
-
access: "create",
|
|
88224
|
-
role: "admin"
|
|
88225
|
-
},
|
|
88226
|
-
"oidcConnections.deleteConnection": {
|
|
88227
|
-
capName: "oidc-connections",
|
|
88228
|
-
capScope: "system",
|
|
88229
|
-
addonId: null,
|
|
88230
|
-
access: "delete",
|
|
88231
|
-
role: "admin"
|
|
88232
|
-
},
|
|
88233
|
-
"oidcConnections.listConnections": {
|
|
88234
|
-
capName: "oidc-connections",
|
|
88235
|
-
capScope: "system",
|
|
88236
|
-
addonId: null,
|
|
88237
|
-
access: "view",
|
|
88238
|
-
role: "admin"
|
|
88239
|
-
},
|
|
88240
|
-
"oidcConnections.updateConnection": {
|
|
88241
|
-
capName: "oidc-connections",
|
|
88242
|
-
capScope: "system",
|
|
88243
|
-
addonId: null,
|
|
88244
|
-
access: "create",
|
|
88245
|
-
role: "admin"
|
|
88246
|
-
},
|
|
88247
88262
|
"osd.getStatus": {
|
|
88248
88263
|
capName: "osd",
|
|
88249
88264
|
capScope: "device",
|
|
@@ -91275,13 +91290,6 @@ Object.freeze({
|
|
|
91275
91290
|
access: "delete",
|
|
91276
91291
|
role: "admin"
|
|
91277
91292
|
},
|
|
91278
|
-
"storage.deleteLocation": {
|
|
91279
|
-
capName: "storage",
|
|
91280
|
-
capScope: "system",
|
|
91281
|
-
addonId: null,
|
|
91282
|
-
access: "delete",
|
|
91283
|
-
role: "admin"
|
|
91284
|
-
},
|
|
91285
91293
|
"storage.endDownload": {
|
|
91286
91294
|
capName: "storage",
|
|
91287
91295
|
capScope: "system",
|
|
@@ -91338,13 +91346,6 @@ Object.freeze({
|
|
|
91338
91346
|
access: "view",
|
|
91339
91347
|
role: "admin"
|
|
91340
91348
|
},
|
|
91341
|
-
"storage.listProviders": {
|
|
91342
|
-
capName: "storage",
|
|
91343
|
-
capScope: "system",
|
|
91344
|
-
addonId: null,
|
|
91345
|
-
access: "view",
|
|
91346
|
-
role: "admin"
|
|
91347
|
-
},
|
|
91348
91349
|
"storage.read": {
|
|
91349
91350
|
capName: "storage",
|
|
91350
91351
|
capScope: "system",
|
|
@@ -91366,27 +91367,6 @@ Object.freeze({
|
|
|
91366
91367
|
access: "view",
|
|
91367
91368
|
role: "admin"
|
|
91368
91369
|
},
|
|
91369
|
-
"storage.testConfig": {
|
|
91370
|
-
capName: "storage",
|
|
91371
|
-
capScope: "system",
|
|
91372
|
-
addonId: null,
|
|
91373
|
-
access: "view",
|
|
91374
|
-
role: "admin"
|
|
91375
|
-
},
|
|
91376
|
-
"storage.testLocation": {
|
|
91377
|
-
capName: "storage",
|
|
91378
|
-
capScope: "system",
|
|
91379
|
-
addonId: null,
|
|
91380
|
-
access: "view",
|
|
91381
|
-
role: "admin"
|
|
91382
|
-
},
|
|
91383
|
-
"storage.upsertLocation": {
|
|
91384
|
-
capName: "storage",
|
|
91385
|
-
capScope: "system",
|
|
91386
|
-
addonId: null,
|
|
91387
|
-
access: "create",
|
|
91388
|
-
role: "admin"
|
|
91389
|
-
},
|
|
91390
91370
|
"storage.write": {
|
|
91391
91371
|
capName: "storage",
|
|
91392
91372
|
capScope: "system",
|
|
@@ -92164,27 +92144,6 @@ Object.freeze({
|
|
|
92164
92144
|
access: "create",
|
|
92165
92145
|
role: "admin"
|
|
92166
92146
|
},
|
|
92167
|
-
"terminalSession.createInstance": {
|
|
92168
|
-
capName: "terminal-session",
|
|
92169
|
-
capScope: "system",
|
|
92170
|
-
addonId: null,
|
|
92171
|
-
access: "create",
|
|
92172
|
-
role: "admin"
|
|
92173
|
-
},
|
|
92174
|
-
"terminalSession.deleteInstance": {
|
|
92175
|
-
capName: "terminal-session",
|
|
92176
|
-
capScope: "system",
|
|
92177
|
-
addonId: null,
|
|
92178
|
-
access: "delete",
|
|
92179
|
-
role: "admin"
|
|
92180
|
-
},
|
|
92181
|
-
"terminalSession.listInstances": {
|
|
92182
|
-
capName: "terminal-session",
|
|
92183
|
-
capScope: "system",
|
|
92184
|
-
addonId: null,
|
|
92185
|
-
access: "view",
|
|
92186
|
-
role: "admin"
|
|
92187
|
-
},
|
|
92188
92147
|
"terminalSession.listLegacyCameras": {
|
|
92189
92148
|
capName: "terminal-session",
|
|
92190
92149
|
capScope: "system",
|
|
@@ -92227,20 +92186,6 @@ Object.freeze({
|
|
|
92227
92186
|
access: "create",
|
|
92228
92187
|
role: "admin"
|
|
92229
92188
|
},
|
|
92230
|
-
"terminalSession.setInstanceEnabled": {
|
|
92231
|
-
capName: "terminal-session",
|
|
92232
|
-
capScope: "system",
|
|
92233
|
-
addonId: null,
|
|
92234
|
-
access: "create",
|
|
92235
|
-
role: "admin"
|
|
92236
|
-
},
|
|
92237
|
-
"terminalSession.updateInstance": {
|
|
92238
|
-
capName: "terminal-session",
|
|
92239
|
-
capScope: "system",
|
|
92240
|
-
addonId: null,
|
|
92241
|
-
access: "create",
|
|
92242
|
-
role: "admin"
|
|
92243
|
-
},
|
|
92244
92189
|
"terminalSession.writeInput": {
|
|
92245
92190
|
capName: "terminal-session",
|
|
92246
92191
|
capScope: "system",
|
|
@@ -92255,6 +92200,13 @@ Object.freeze({
|
|
|
92255
92200
|
access: "create",
|
|
92256
92201
|
role: "viewer"
|
|
92257
92202
|
},
|
|
92203
|
+
"timedRun.getOptions": {
|
|
92204
|
+
capName: "timed-run",
|
|
92205
|
+
capScope: "device",
|
|
92206
|
+
addonId: null,
|
|
92207
|
+
access: "view",
|
|
92208
|
+
role: "viewer"
|
|
92209
|
+
},
|
|
92258
92210
|
"timedRun.getStatus": {
|
|
92259
92211
|
capName: "timed-run",
|
|
92260
92212
|
capScope: "device",
|
|
@@ -92269,6 +92221,13 @@ Object.freeze({
|
|
|
92269
92221
|
access: "create",
|
|
92270
92222
|
role: "viewer"
|
|
92271
92223
|
},
|
|
92224
|
+
"timedRun.setSettings": {
|
|
92225
|
+
capName: "timed-run",
|
|
92226
|
+
capScope: "device",
|
|
92227
|
+
addonId: null,
|
|
92228
|
+
access: "create",
|
|
92229
|
+
role: "admin"
|
|
92230
|
+
},
|
|
92272
92231
|
"toast.onToast": {
|
|
92273
92232
|
capName: "toast",
|
|
92274
92233
|
capScope: "system",
|
|
@@ -93199,6 +93158,7 @@ function offered(received) {
|
|
|
93199
93158
|
};
|
|
93200
93159
|
}
|
|
93201
93160
|
offered(HA_AS), withheld(HOMEKIT_REASON), withheld(ALEXA_REASON), withheld(GOOGLE_REASON), withheld(MATTER_REASON);
|
|
93161
|
+
string().min(1).max(4096);
|
|
93202
93162
|
Object.freeze({
|
|
93203
93163
|
"accessories.getStatus": [{
|
|
93204
93164
|
name: "deviceId",
|
|
@@ -93882,6 +93842,11 @@ Object.freeze({
|
|
|
93882
93842
|
form: "single",
|
|
93883
93843
|
optional: false
|
|
93884
93844
|
}],
|
|
93845
|
+
"deviceManager.setAlias": [{
|
|
93846
|
+
name: "deviceId",
|
|
93847
|
+
form: "single",
|
|
93848
|
+
optional: false
|
|
93849
|
+
}],
|
|
93885
93850
|
"deviceManager.setChildLayout": [{
|
|
93886
93851
|
name: "deviceId",
|
|
93887
93852
|
form: "single",
|
|
@@ -95946,6 +95911,11 @@ Object.freeze({
|
|
|
95946
95911
|
form: "single",
|
|
95947
95912
|
optional: false
|
|
95948
95913
|
}],
|
|
95914
|
+
"timedRun.getOptions": [{
|
|
95915
|
+
name: "deviceId",
|
|
95916
|
+
form: "single",
|
|
95917
|
+
optional: false
|
|
95918
|
+
}],
|
|
95949
95919
|
"timedRun.getStatus": [{
|
|
95950
95920
|
name: "deviceId",
|
|
95951
95921
|
form: "single",
|
|
@@ -95956,6 +95926,11 @@ Object.freeze({
|
|
|
95956
95926
|
form: "single",
|
|
95957
95927
|
optional: false
|
|
95958
95928
|
}],
|
|
95929
|
+
"timedRun.setSettings": [{
|
|
95930
|
+
name: "deviceId",
|
|
95931
|
+
form: "single",
|
|
95932
|
+
optional: false
|
|
95933
|
+
}],
|
|
95959
95934
|
"update.getStatus": [{
|
|
95960
95935
|
name: "deviceId",
|
|
95961
95936
|
form: "single",
|
|
@@ -96818,6 +96793,7 @@ var STATE_SUMMARY_VARS = [
|
|
|
96818
96793
|
[...RULE_TEXT],
|
|
96819
96794
|
[...RULE_TEXT],
|
|
96820
96795
|
[...RULE_TEXT],
|
|
96796
|
+
[...RULE_TEXT],
|
|
96821
96797
|
[...RULE_BODY_ONLY],
|
|
96822
96798
|
[...RULE_TEXT],
|
|
96823
96799
|
([...RULE_TEXT], [...DEVICE_EVENTS]),
|
|
@@ -122109,7 +122085,13 @@ function buildHomematicInstances(records, deps) {
|
|
|
122109
122085
|
},
|
|
122110
122086
|
instanceMode: "multiple",
|
|
122111
122087
|
kind: "connection",
|
|
122112
|
-
canTest: true
|
|
122088
|
+
canTest: true,
|
|
122089
|
+
kinds: [{
|
|
122090
|
+
id: "connection",
|
|
122091
|
+
label: "Homematic",
|
|
122092
|
+
functionCap: "device-provider",
|
|
122093
|
+
role: "devices"
|
|
122094
|
+
}]
|
|
122113
122095
|
},
|
|
122114
122096
|
formSchema: () => buildConnectionFormSchema(),
|
|
122115
122097
|
initialBody: (name) => ({ name }),
|