@camstack/addon-provider-reolink 1.2.232 → 1.2.234
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/addon.js +1797 -1842
- package/dist/addon.mjs +1797 -1842
- package/package.json +2 -2
package/dist/addon.mjs
CHANGED
|
@@ -100687,7 +100687,7 @@ function parseBaichuanWebhookObject(mess) {
|
|
|
100687
100687
|
return parsed;
|
|
100688
100688
|
}
|
|
100689
100689
|
//#endregion
|
|
100690
|
-
//#region ../types/dist/event-category-
|
|
100690
|
+
//#region ../types/dist/event-category-78tcBemo.mjs
|
|
100691
100691
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
100692
100692
|
EventCategory["SystemBoot"] = "system.boot";
|
|
100693
100693
|
EventCategory["SystemAddonsReady"] = "system.addons-ready";
|
|
@@ -100808,6 +100808,23 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
100808
100808
|
*/
|
|
100809
100809
|
EventCategory["AddonLoadRecovered"] = "addon.load-recovered";
|
|
100810
100810
|
/**
|
|
100811
|
+
* An addon is RUNNING although its installed package is below what the
|
|
100812
|
+
* running server requires (`camstack.requires.addons` of the server, or the
|
|
100813
|
+
* addon's own `requires.server`). Raised once per streak by the unsupported-
|
|
100814
|
+
* addon tracker, on the hub and on agents; AlertCenter turns it into one
|
|
100815
|
+
* operator alert per node and package. The addon is never held back for it.
|
|
100816
|
+
*
|
|
100817
|
+
* Payload: `{ packageName, addonId, nodeId, installedVersion, requiredMinimum, serverVersion, unmet }`.
|
|
100818
|
+
*/
|
|
100819
|
+
EventCategory["AddonUnsupportedVersion"] = "addon.unsupported-version";
|
|
100820
|
+
/**
|
|
100821
|
+
* The package of an {@link AddonUnsupportedVersion} alert reached a supported
|
|
100822
|
+
* version, or is no longer installed on the node. AlertCenter dismisses the matching alert.
|
|
100823
|
+
*
|
|
100824
|
+
* Payload: `{ packageName, addonId, nodeId }`.
|
|
100825
|
+
*/
|
|
100826
|
+
EventCategory["AddonUnsupportedResolved"] = "addon.unsupported-resolved";
|
|
100827
|
+
/**
|
|
100811
100828
|
* Monitor scheduled the next retry for a failed addon. Transient —
|
|
100812
100829
|
* surfaced to the UI for live-updating the "next retry in Ns"
|
|
100813
100830
|
* countdown on the Addons page row, NOT persisted as an alert.
|
|
@@ -100918,7 +100935,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
100918
100935
|
EventCategory["ProcessRestarted"] = "process.restarted";
|
|
100919
100936
|
/**
|
|
100920
100937
|
* The SET of storage locations changed — one was created, edited, enabled,
|
|
100921
|
-
* disabled or deleted through
|
|
100938
|
+
* disabled or deleted through the location instances or the forced-delete action.
|
|
100922
100939
|
*
|
|
100923
100940
|
* Telemetry, not a transaction (D8/D11): every consumer that re-resolves on
|
|
100924
100941
|
* it must also converge on its own periodic path, because a dropped event
|
|
@@ -101473,7 +101490,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
101473
101490
|
return EventCategory;
|
|
101474
101491
|
}({});
|
|
101475
101492
|
//#endregion
|
|
101476
|
-
//#region ../types/dist/device-type-
|
|
101493
|
+
//#region ../types/dist/device-type-DxCT0krO.mjs
|
|
101477
101494
|
/**
|
|
101478
101495
|
import { errMsg } from '@camstack/types'
|
|
101479
101496
|
* Extract a human-readable message from an unknown error value.
|
|
@@ -101635,6 +101652,13 @@ var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
|
|
|
101635
101652
|
* filters that want "all devices with on-motion behaviour".
|
|
101636
101653
|
*/
|
|
101637
101654
|
DeviceFeature["MotionTrigger"] = "motion-trigger";
|
|
101655
|
+
/**
|
|
101656
|
+
* Device can be run for a chosen time and then stopped. Mirrors the
|
|
101657
|
+
* `timed-run` wrapper cap — the cap is bound by the core-blocks addon, not by
|
|
101658
|
+
* a driver, so the flag is derived from the device's bindings
|
|
101659
|
+
* (`featuresOfBoundCaps`). Gates the quick-run control in the viewer.
|
|
101660
|
+
*/
|
|
101661
|
+
DeviceFeature["TimedRun"] = "timed-run";
|
|
101638
101662
|
/** Light supports rgb-triplet color via `color` cap. */
|
|
101639
101663
|
DeviceFeature["LightColorRgb"] = "light-color-rgb";
|
|
101640
101664
|
/** Light supports HSV color via `color` cap. */
|
|
@@ -106669,7 +106693,7 @@ var ZodIssueCode = {
|
|
|
106669
106693
|
var ZodFirstPartyTypeKind;
|
|
106670
106694
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
106671
106695
|
//#endregion
|
|
106672
|
-
//#region ../types/dist/sleep-
|
|
106696
|
+
//#region ../types/dist/sleep-CGPZyzB5.mjs
|
|
106673
106697
|
/**
|
|
106674
106698
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
106675
106699
|
* window to float samples (D455).
|
|
@@ -107033,6 +107057,59 @@ Object.fromEntries([
|
|
|
107033
107057
|
function isValuelessField(field) {
|
|
107034
107058
|
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";
|
|
107035
107059
|
}
|
|
107060
|
+
/**
|
|
107061
|
+
* Base collector: flatten a hydrated `ConfigUISchemaWithValues` into
|
|
107062
|
+
* `key → { value, default }`, recursing through `group` and `sub-tabs`
|
|
107063
|
+
* layout fields. Keeping `value` and `default` SEPARATE (rather than
|
|
107064
|
+
* pre-resolving) lets callers both read the effective value AND detect
|
|
107065
|
+
* overrides (`value` differs from `default`). Structural over `unknown`;
|
|
107066
|
+
* malformed input yields an empty map, never throws.
|
|
107067
|
+
*/
|
|
107068
|
+
function collectHydratedFieldEntries(schema) {
|
|
107069
|
+
const out = /* @__PURE__ */ new Map();
|
|
107070
|
+
if (typeof schema !== "object" || schema === null) return out;
|
|
107071
|
+
const sections = schema.sections;
|
|
107072
|
+
if (!Array.isArray(sections)) return out;
|
|
107073
|
+
for (const section of sections) if (typeof section === "object" && section !== null) collectFieldEntriesInto(section.fields, out);
|
|
107074
|
+
return out;
|
|
107075
|
+
}
|
|
107076
|
+
/** Recursive field walker for {@link collectHydratedFieldEntries}. */
|
|
107077
|
+
function collectFieldEntriesInto(fields, into) {
|
|
107078
|
+
if (!Array.isArray(fields)) return;
|
|
107079
|
+
for (const field of fields) {
|
|
107080
|
+
if (typeof field !== "object" || field === null) continue;
|
|
107081
|
+
const type = field.type;
|
|
107082
|
+
if (type === "group") {
|
|
107083
|
+
collectFieldEntriesInto(field.fields, into);
|
|
107084
|
+
continue;
|
|
107085
|
+
}
|
|
107086
|
+
if (type === "sub-tabs") {
|
|
107087
|
+
const tabs = field.tabs;
|
|
107088
|
+
if (Array.isArray(tabs)) {
|
|
107089
|
+
for (const tab of tabs) if (typeof tab === "object" && tab !== null) collectFieldEntriesInto(tab.fields, into);
|
|
107090
|
+
}
|
|
107091
|
+
continue;
|
|
107092
|
+
}
|
|
107093
|
+
const key = field.key;
|
|
107094
|
+
if (typeof key !== "string" || key.length === 0) continue;
|
|
107095
|
+
if (!("value" in field)) continue;
|
|
107096
|
+
into.set(key, {
|
|
107097
|
+
value: field.value,
|
|
107098
|
+
default: field.default
|
|
107099
|
+
});
|
|
107100
|
+
}
|
|
107101
|
+
}
|
|
107102
|
+
/**
|
|
107103
|
+
* Flatten a hydrated settings payload into `key → EFFECTIVE value`
|
|
107104
|
+
* (`value ?? default`). The read-side inverse of `hydrateSchema` for the
|
|
107105
|
+
* common "just give me the resolved values" case. Built on
|
|
107106
|
+
* {@link collectHydratedFieldEntries}.
|
|
107107
|
+
*/
|
|
107108
|
+
function collectHydratedFieldValues(schema) {
|
|
107109
|
+
const out = /* @__PURE__ */ new Map();
|
|
107110
|
+
for (const [key, entry] of collectHydratedFieldEntries(schema)) out.set(key, entry.value ?? entry.default);
|
|
107111
|
+
return out;
|
|
107112
|
+
}
|
|
107036
107113
|
function hydrateSchema(schema, values, options = {}) {
|
|
107037
107114
|
return {
|
|
107038
107115
|
...schema.tabs ? { tabs: [...schema.tabs] } : {},
|
|
@@ -107848,6 +107925,7 @@ var RecordIntegrationInstances = class {
|
|
|
107848
107925
|
this.secretKeys = topLevelSecretKeys(kind.declaration.secretPaths);
|
|
107849
107926
|
this.secretMaps = secretMapKeys(kind.declaration.secretPaths);
|
|
107850
107927
|
this.nameField = kind.declaration.entry?.nameField ?? "name";
|
|
107928
|
+
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`);
|
|
107851
107929
|
}
|
|
107852
107930
|
/**
|
|
107853
107931
|
* One instance read for the addon's own runtime; null when absent. When the keychain is
|
|
@@ -107889,10 +107967,21 @@ var RecordIntegrationInstances = class {
|
|
|
107889
107967
|
}
|
|
107890
107968
|
return out;
|
|
107891
107969
|
}
|
|
107970
|
+
/** The kind an instance body is of: the provider's `kindOf`, else its one declared kind. */
|
|
107971
|
+
kindOfBody(body) {
|
|
107972
|
+
if (this.hooks.kindOf !== void 0) {
|
|
107973
|
+
const id = this.hooks.kindOf(body);
|
|
107974
|
+
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)`);
|
|
107975
|
+
return id;
|
|
107976
|
+
}
|
|
107977
|
+
const only = this.hooks.description.kinds[0];
|
|
107978
|
+
if (only === void 0) throw new Error(`record kind '${this.kind.name}' declares no kinds`);
|
|
107979
|
+
return only.id;
|
|
107980
|
+
}
|
|
107892
107981
|
viewOf(record) {
|
|
107893
107982
|
const shown = secretViewsOf(this.records.owner, this.kind.name, record.id, this.kind.declaration, record.data);
|
|
107894
107983
|
const rawName = record.data[this.nameField];
|
|
107895
|
-
const kind = this.
|
|
107984
|
+
const kind = this.kindOfBody(record.data);
|
|
107896
107985
|
const health = this.hooks.health?.(record.data, record.id);
|
|
107897
107986
|
return {
|
|
107898
107987
|
id: record.id,
|
|
@@ -107900,7 +107989,7 @@ var RecordIntegrationInstances = class {
|
|
|
107900
107989
|
configured: this.hooks.configured(record.data),
|
|
107901
107990
|
enabled: isInstanceEnabled(record.data),
|
|
107902
107991
|
formValues: shown,
|
|
107903
|
-
|
|
107992
|
+
kind,
|
|
107904
107993
|
...health?.status !== void 0 ? { status: health.status } : {},
|
|
107905
107994
|
...health?.lastCheckedAt !== void 0 ? { lastCheckedAt: health.lastCheckedAt } : {}
|
|
107906
107995
|
};
|
|
@@ -107933,17 +108022,35 @@ var RecordIntegrationInstances = class {
|
|
|
107933
108022
|
...kind !== void 0 ? { kind } : {}
|
|
107934
108023
|
});
|
|
107935
108024
|
if (minted === void 0) throw new Error("createInstance needs an id: this provider does not mint one");
|
|
108025
|
+
const initial = this.hooks.initialBody(name, kind);
|
|
108026
|
+
const patch = this.patchOf(values ?? {});
|
|
108027
|
+
if (Object.keys(patch).length > 0) Object.assign(patch, await this.hooks.validateWrite?.({
|
|
108028
|
+
kind,
|
|
108029
|
+
body: {
|
|
108030
|
+
...initial,
|
|
108031
|
+
...patch
|
|
108032
|
+
}
|
|
108033
|
+
}));
|
|
107936
108034
|
await this.handle.put({
|
|
107937
108035
|
id: minted,
|
|
107938
|
-
data:
|
|
108036
|
+
data: initial
|
|
107939
108037
|
}, { ifRev: 0 });
|
|
107940
|
-
const patch = this.patchOf(values ?? {});
|
|
107941
108038
|
if (Object.keys(patch).length > 0) await this.handle.patch(minted, patch);
|
|
107942
108039
|
await this.hooks.onChanged?.(minted, "created");
|
|
107943
108040
|
return { id: minted };
|
|
107944
108041
|
};
|
|
107945
108042
|
updateInstance = async ({ id, name, values }) => {
|
|
107946
108043
|
const patch = this.patchOf(values);
|
|
108044
|
+
if (this.hooks.validateWrite !== void 0 && Object.keys(patch).length > 0) {
|
|
108045
|
+
const stored = await this.handle.get(id);
|
|
108046
|
+
if (stored !== null) Object.assign(patch, await this.hooks.validateWrite({
|
|
108047
|
+
kind: void 0,
|
|
108048
|
+
body: {
|
|
108049
|
+
...stored.data,
|
|
108050
|
+
...patch
|
|
108051
|
+
}
|
|
108052
|
+
}));
|
|
108053
|
+
}
|
|
107947
108054
|
if (name !== void 0) patch[this.nameField] = name;
|
|
107948
108055
|
await this.handle.patch(id, patch);
|
|
107949
108056
|
await this.hooks.onChanged?.(id, "updated");
|
|
@@ -108254,6 +108361,21 @@ var SCOPED_SETTINGS_SCOPES = [
|
|
|
108254
108361
|
"device-defaults",
|
|
108255
108362
|
"node"
|
|
108256
108363
|
];
|
|
108364
|
+
/** The one refusal of a key a scope did not declare. */
|
|
108365
|
+
function assertDeclaredKeys(keys, declared) {
|
|
108366
|
+
const undeclared = keys.filter((key) => !declared.has(key));
|
|
108367
|
+
if (undeclared.length > 0) throw new Error(`scoped settings: [${undeclared.join(", ")}] not declared for this scope (declared: [${[...declared].join(", ")}])`);
|
|
108368
|
+
}
|
|
108369
|
+
/** Build the handle over an addon's scoped read, write and unset. */
|
|
108370
|
+
function createScopedSettings(deps) {
|
|
108371
|
+
return {
|
|
108372
|
+
async get() {
|
|
108373
|
+
return deps.schema.parse(await deps.read());
|
|
108374
|
+
},
|
|
108375
|
+
patch: (patch) => deps.write(Object.fromEntries(Object.entries(patch))),
|
|
108376
|
+
unset: (keys) => deps.unset(keys)
|
|
108377
|
+
};
|
|
108378
|
+
}
|
|
108257
108379
|
/** A write to a secret path could not be stored in the keychain, so it was refused. */
|
|
108258
108380
|
var KeychainWriteRefusedError = class extends Error {
|
|
108259
108381
|
fieldPath;
|
|
@@ -108829,7 +108951,16 @@ function createHandle(raw, opts) {
|
|
|
108829
108951
|
return blob;
|
|
108830
108952
|
}
|
|
108831
108953
|
},
|
|
108832
|
-
writeAddonStore: writeAddon
|
|
108954
|
+
writeAddonStore: writeAddon,
|
|
108955
|
+
removeClearedKeys: (keys) => serialize("addon", async () => {
|
|
108956
|
+
const stored = await readStoredAddonBlob(raw);
|
|
108957
|
+
index.seen("addon", stored);
|
|
108958
|
+
const removable = keys.filter((key) => collectSecretMarkerRefs(stored[key]).length === 0);
|
|
108959
|
+
if (removable.length === 0) return;
|
|
108960
|
+
const patch = Object.fromEntries(removable.map((key) => [key, void 0]));
|
|
108961
|
+
await raw.writeAddonStore(patch);
|
|
108962
|
+
index.wrote("addon", patch);
|
|
108963
|
+
})
|
|
108833
108964
|
};
|
|
108834
108965
|
}
|
|
108835
108966
|
/** The context the addon sees, plus the private raw view and write outcome. */
|
|
@@ -108959,7 +109090,7 @@ function boundOf(list) {
|
|
|
108959
109090
|
* Base class for CamStack addons. Eliminates settings boilerplate:
|
|
108960
109091
|
*
|
|
108961
109092
|
* - Typed `config` property with automatic resolution from store + defaults
|
|
108962
|
-
* -
|
|
109093
|
+
* - the scoped settings API (`clusterSettings` / `nodeSettings` / `deviceDefaults`) auto-implemented
|
|
108963
109094
|
* - `getAddonSettings()` / `updateAddonSettings()` auto-implemented
|
|
108964
109095
|
* - `getDeviceSettings()` / `updateDeviceSettings()` auto-implemented
|
|
108965
109096
|
* - `ctx` accessor for the AddonContext (no manual `this.ctxRef` storage)
|
|
@@ -108969,7 +109100,7 @@ function boundOf(list) {
|
|
|
108969
109100
|
* Subclasses override:
|
|
108970
109101
|
* - `onInitialize()` — addon-specific init logic, return ProviderRegistration[]
|
|
108971
109102
|
* - `onShutdown()` — cleanup
|
|
108972
|
-
* - `
|
|
109103
|
+
* - `clusterSettingsSchema()` / `nodeSettingsSchema()` / `deviceSettingsSchema()` — UI schemas
|
|
108973
109104
|
*
|
|
108974
109105
|
* @example
|
|
108975
109106
|
* ```ts
|
|
@@ -108983,7 +109114,7 @@ function boundOf(list) {
|
|
|
108983
109114
|
* super({ maxRetries: 3, endpoint: 'http://localhost' })
|
|
108984
109115
|
* }
|
|
108985
109116
|
*
|
|
108986
|
-
* protected
|
|
109117
|
+
* protected clusterSettingsSchema() {
|
|
108987
109118
|
* return this.schema({
|
|
108988
109119
|
* sections: [{
|
|
108989
109120
|
* id: 'main', title: 'Settings',
|
|
@@ -109026,7 +109157,7 @@ var BaseAddon = class {
|
|
|
109026
109157
|
defaults;
|
|
109027
109158
|
/**
|
|
109028
109159
|
* Hidden-state paths that hold secrets (D787) — values the addon writes
|
|
109029
|
-
* itself (`
|
|
109160
|
+
* itself (`state()`, the scoped writers) that no form field declares.
|
|
109030
109161
|
* Stored in the keychain exactly like a `password` field. Syntax:
|
|
109031
109162
|
* `'snapshotSigningKey'`, `'identity.pincode'`, `'tokens[userId].accessToken'`
|
|
109032
109163
|
* (`key[<id field>]` addresses array items by id, never by index).
|
|
@@ -109036,7 +109167,7 @@ var BaseAddon = class {
|
|
|
109036
109167
|
/**
|
|
109037
109168
|
* D986 M4: the scoped schemas this addon declared, resolved once per capability
|
|
109038
109169
|
* (`loadScopedSchemas`) so the sync readers (`perNodeKeys`, the secret tree, the restart check)
|
|
109039
|
-
* see them. Empty until loaded
|
|
109170
|
+
* see them. Empty until loaded.
|
|
109040
109171
|
*/
|
|
109041
109172
|
_scopedByCap = /* @__PURE__ */ new Map();
|
|
109042
109173
|
_nodeKeysByCap = /* @__PURE__ */ new Map();
|
|
@@ -109222,7 +109353,7 @@ var BaseAddon = class {
|
|
|
109222
109353
|
/** Addon-specific cleanup. Override if needed. */
|
|
109223
109354
|
async onShutdown() {}
|
|
109224
109355
|
/**
|
|
109225
|
-
* Called after config is resolved during
|
|
109356
|
+
* Called after config is resolved during a settings write.
|
|
109226
109357
|
* Override to react to config changes (e.g. restart a sampler, reconnect a service).
|
|
109227
109358
|
* Not called during initialize() — use onInitialize() for initial setup.
|
|
109228
109359
|
*/
|
|
@@ -109251,82 +109382,12 @@ var BaseAddon = class {
|
|
|
109251
109382
|
scopedSettingsCapabilities() {
|
|
109252
109383
|
return [];
|
|
109253
109384
|
}
|
|
109254
|
-
/** Override to provide global-level settings UI schema. */
|
|
109255
|
-
globalSettingsSchema(_cap) {
|
|
109256
|
-
return null;
|
|
109257
|
-
}
|
|
109258
109385
|
/** Override to provide device-level settings UI schema. */
|
|
109259
109386
|
deviceSettingsSchema() {
|
|
109260
109387
|
return null;
|
|
109261
109388
|
}
|
|
109262
109389
|
/**
|
|
109263
|
-
*
|
|
109264
|
-
* ARE the configuration of its integration.
|
|
109265
|
-
*
|
|
109266
|
-
* Return the `ConfigSection.id`s, from {@link globalSettingsSchema}, that an
|
|
109267
|
-
* operator should find on the addon's integration page (System →
|
|
109268
|
-
* Integrations → <name>) rather than only in the cluster-wide list of every
|
|
109269
|
-
* addon. Empty (the default) means the addon has no integration-level
|
|
109270
|
-
* settings and no such surface is offered — this is opt-in, because whether
|
|
109271
|
-
* an addon's configuration IS its integration's configuration depends on the
|
|
109272
|
-
* nature of the integration.
|
|
109273
|
-
*
|
|
109274
|
-
* WHAT THIS IS NOT. It is not a scope. The selected sections keep living in
|
|
109275
|
-
* the ONE global schema, in the ONE addon store, written by the ONE
|
|
109276
|
-
* `updateGlobalSettings` path. There is deliberately no
|
|
109277
|
-
* `updateIntegrationSettings`: a second write path is how a surface acquires
|
|
109278
|
-
* a second store key, and this repo has shipped that twice (`btmPath@hub`,
|
|
109279
|
-
* D266). Selecting sections cannot introduce a key that selecting cannot.
|
|
109280
|
-
*
|
|
109281
|
-
* WHY IT IS A LIST OF SECTION IDS AND NOT A MARKER ON THE SECTION.
|
|
109282
|
-
* `ConfigFieldBase` used to carry `scope?: 'device' | 'global'` and it was
|
|
109283
|
-
* removed with the reason recorded at
|
|
109284
|
-
* `packages/types/src/interfaces/config-ui.ts:249` — *"a field's scope is
|
|
109285
|
-
* determined by WHICH schema it lives in, not by a field-level marker."* A
|
|
109286
|
-
* marker sprinkled across sections also has to borrow a field that already
|
|
109287
|
-
* means something else; borrowing `section.tab` put the literal word
|
|
109288
|
-
* "integration" into an operator-facing tab bar, because `tab` means "how to
|
|
109289
|
-
* GROUP this visually" and cannot also mean "where this lives" (D269
|
|
109290
|
-
* supersedes D268). One declaration, in one place, next to the schema whose
|
|
109291
|
-
* ids it names.
|
|
109292
|
-
*/
|
|
109293
|
-
integrationSettingSections() {
|
|
109294
|
-
return [];
|
|
109295
|
-
}
|
|
109296
|
-
async getGlobalSettings(overlay, cap, nodeId) {
|
|
109297
|
-
await this.loadScopedSchemas(cap);
|
|
109298
|
-
const schema = this.globalSettingsSchema(cap) ?? this.scopedFormSchema(cap);
|
|
109299
|
-
if (!schema) return { sections: [] };
|
|
109300
|
-
const projected = await this.readRawProjectedStore(nodeId, cap);
|
|
109301
|
-
return hydrateSchema(schema, overlay ? await this.overlayKeepingMarkers(projected, overlay) : projected, { inlineSecretsAsViews: true });
|
|
109302
|
-
}
|
|
109303
|
-
/**
|
|
109304
|
-
* The integration-level view of this addon's settings: exactly the sections
|
|
109305
|
-
* named by {@link integrationSettingSections}, hydrated from the SAME store
|
|
109306
|
-
* `getGlobalSettings` reads, and narrowed to cluster-scoped fields.
|
|
109307
|
-
*
|
|
109308
|
-
* Returns `null` when the addon declared nothing — an addon that opts out has
|
|
109309
|
-
* no integration settings surface at all, rather than an empty one that reads
|
|
109310
|
-
* as a failed load.
|
|
109311
|
-
*
|
|
109312
|
-
* Three properties hold BY CONSTRUCTION, which is why they are here in core
|
|
109313
|
-
* and not in whichever UI happens to render this:
|
|
109314
|
-
*
|
|
109315
|
-
* 1. **One key.** The payload is a SUBSET of the global schema, so a field
|
|
109316
|
-
* shown here is the same field, with the same bare key, that the addon's
|
|
109317
|
-
* own page shows. There is no integration-specific writer — callers save
|
|
109318
|
-
* through `updateGlobalSettings` — so a second store key is unreachable,
|
|
109319
|
-
* not merely discouraged.
|
|
109320
|
-
* 2. **No node scope.** `perNode: true` fields are DROPPED. Their store key
|
|
109321
|
-
* is `<key>@<nodeId>` and an integration is not a node; whichever node
|
|
109322
|
-
* such a field silently picked would be a wrong answer for the operator
|
|
109323
|
-
* who opened the page (D266).
|
|
109324
|
-
* 3. **No silent typo.** A declared id that names no section throws. The
|
|
109325
|
-
* alternative — skip it — turns a rename into a surface that quietly
|
|
109326
|
-
* empties, which looks exactly like an addon with nothing to configure.
|
|
109327
|
-
*/
|
|
109328
|
-
/**
|
|
109329
|
-
* The form schema of ONE integration instance, or `null` to use {@link globalSettingsSchema}.
|
|
109390
|
+
* The form schema of ONE integration instance, or `null` to use the scoped form.
|
|
109330
109391
|
*
|
|
109331
109392
|
* Override it only when an `instanceMode: multiple` addon's instances differ: an NVR integration
|
|
109332
109393
|
* needs its connection fields, the default integration the addon's own sections. It is the
|
|
@@ -109374,37 +109435,178 @@ var BaseAddon = class {
|
|
|
109374
109435
|
}
|
|
109375
109436
|
}
|
|
109376
109437
|
/**
|
|
109438
|
+
* Hook: values layered over the stored ones when the FORM of one scope is served
|
|
109439
|
+
* ({@link getScopedSettings}) — a preview that derives dependent options without writing.
|
|
109440
|
+
* Never applied to {@link ScopedSettings.get} or to a write. `null` ⇒ no overlay.
|
|
109441
|
+
*/
|
|
109442
|
+
async scopedSettingsOverlay(_scope, _cap, _nodeId) {
|
|
109443
|
+
return null;
|
|
109444
|
+
}
|
|
109445
|
+
/**
|
|
109446
|
+
* Hook: a write of one scope changed stored values (not called when the store reports no change,
|
|
109447
|
+
* e.g. the write-back of a stored secret). `keys` are the bare field keys of the write, node keys included.
|
|
109448
|
+
*/
|
|
109449
|
+
async onScopedSettingsChanged(_scope, _cap, _keys) {}
|
|
109450
|
+
/** Typed handle over the CLUSTER settings `cap` declares (`clusterSettingsSchema`). */
|
|
109451
|
+
clusterSettings(cap, schema) {
|
|
109452
|
+
return this.scopedHandle("cluster", cap, schema);
|
|
109453
|
+
}
|
|
109454
|
+
/** Typed handle over the fleet defaults of the per-device settings `cap` declares. */
|
|
109455
|
+
deviceDefaults(cap, schema) {
|
|
109456
|
+
return this.scopedHandle("device-defaults", cap, schema);
|
|
109457
|
+
}
|
|
109458
|
+
/**
|
|
109459
|
+
* Typed handle over the settings `cap` owns PER NODE. `nodeId` omitted ⇒ the local node. A node
|
|
109460
|
+
* with no row yields the schema defaults — never a bare-key fallback.
|
|
109461
|
+
*/
|
|
109462
|
+
nodeSettings(cap, schema, nodeId) {
|
|
109463
|
+
return this.scopedHandle("node", cap, schema, nodeId);
|
|
109464
|
+
}
|
|
109465
|
+
/**
|
|
109466
|
+
* {@link state} for a value that is kept per node: stored under `<key>@<nodeId>`, and the
|
|
109467
|
+
* settings store carries `nodeId` in the row data (D986 §1), so a forgotten node's rows go in one
|
|
109468
|
+
* central delete. `nodeId` omitted ⇒ the local node.
|
|
109469
|
+
*/
|
|
109470
|
+
nodeState(key, schema, fallback, nodeId) {
|
|
109471
|
+
this._declaredStateKeys.add(key);
|
|
109472
|
+
return createDurableState({
|
|
109473
|
+
key: nodeScopedKey(key, nodeId ?? this._ctx?.kernel?.localNodeId ?? ""),
|
|
109474
|
+
schema,
|
|
109475
|
+
fallback,
|
|
109476
|
+
read: async () => this.resolveStoredSecrets(await this.readAddonStoreWithRetry()),
|
|
109477
|
+
write: async (patch) => {
|
|
109478
|
+
await this._ctx?.settings?.writeAddonStore(patch);
|
|
109479
|
+
},
|
|
109480
|
+
onParseError: (k, e) => this._ctx?.logger?.warn?.(`durable-state: stored "${k}" failed validation — using fallback`, { meta: {
|
|
109481
|
+
addonId: this._ctx?.id,
|
|
109482
|
+
key: k,
|
|
109483
|
+
error: String(e)
|
|
109484
|
+
} })
|
|
109485
|
+
});
|
|
109486
|
+
}
|
|
109487
|
+
/** The loaded schema `cap` declares for `scope`, or `null`. */
|
|
109488
|
+
async declaredScopedSchema(scope, cap) {
|
|
109489
|
+
await this.loadScopedSchemas(cap);
|
|
109490
|
+
return this.loadedScopedSchemas(cap).find((entry) => entry.scope === scope)?.schema ?? null;
|
|
109491
|
+
}
|
|
109492
|
+
async requireScopedSchema(scope, cap) {
|
|
109493
|
+
const schema = await this.declaredScopedSchema(scope, cap);
|
|
109494
|
+
if (schema === null) throw new Error(`${this.constructor.name}: cap "${cap}" declares no ${scope} settings`);
|
|
109495
|
+
return schema;
|
|
109496
|
+
}
|
|
109497
|
+
scopedKeys(schema) {
|
|
109498
|
+
return new Set(schema.sections.flatMap((section) => collectValueFieldKeys(section.fields)));
|
|
109499
|
+
}
|
|
109500
|
+
/** `store` narrowed to the keys `schema` declares. */
|
|
109501
|
+
narrowToScope(store, schema) {
|
|
109502
|
+
const keys = this.scopedKeys(schema);
|
|
109503
|
+
return Object.fromEntries(Object.entries(store).filter(([key]) => keys.has(key)));
|
|
109504
|
+
}
|
|
109505
|
+
scopedHandle(scope, cap, schema, nodeId) {
|
|
109506
|
+
return createScopedSettings({
|
|
109507
|
+
schema,
|
|
109508
|
+
read: async () => {
|
|
109509
|
+
const declared = await this.requireScopedSchema(scope, cap);
|
|
109510
|
+
const stored = this.narrowToScope(await this.resolveGlobalStore(nodeId, cap), declared);
|
|
109511
|
+
const effective = collectHydratedFieldValues(hydrateSchema(declared, stored));
|
|
109512
|
+
return {
|
|
109513
|
+
...Object.fromEntries([...effective].filter(([, value]) => value !== void 0)),
|
|
109514
|
+
...stored
|
|
109515
|
+
};
|
|
109516
|
+
},
|
|
109517
|
+
write: (patch) => this.writeScoped(scope, cap, patch, nodeId),
|
|
109518
|
+
unset: (keys) => this.unsetScoped(scope, cap, keys, nodeId)
|
|
109519
|
+
});
|
|
109520
|
+
}
|
|
109521
|
+
/** The one write path of the scoped API: declared keys only, then the global patch. */
|
|
109522
|
+
async writeScoped(scope, cap, patch, nodeId) {
|
|
109523
|
+
assertDeclaredKeys(Object.keys(patch), this.scopedKeys(await this.requireScopedSchema(scope, cap)));
|
|
109524
|
+
if (await this.applyGlobalPatch(patch, scope === "node" ? nodeId : void 0, cap)) await this.onScopedSettingsChanged(scope, cap, Object.keys(patch));
|
|
109525
|
+
}
|
|
109526
|
+
/**
|
|
109527
|
+
* Remove declared keys of one scope. A secret goes through {@link clearSecrets} — its keychain
|
|
109528
|
+
* value is released exactly as there — and the emptied row is then removed; every other key is
|
|
109529
|
+
* removed by an `undefined` patch (which a secret transform would read as "keep").
|
|
109530
|
+
*/
|
|
109531
|
+
async unsetScoped(scope, cap, keys, nodeId) {
|
|
109532
|
+
assertDeclaredKeys(keys, this.scopedKeys(await this.requireScopedSchema(scope, cap)));
|
|
109533
|
+
const target = scope === "node" ? nodeId : void 0;
|
|
109534
|
+
const tree = this.addonSecretTree();
|
|
109535
|
+
const secretKeys = keys.filter((key) => tree.has(key));
|
|
109536
|
+
const plainKeys = keys.filter((key) => !tree.has(key));
|
|
109537
|
+
let changed = false;
|
|
109538
|
+
if (plainKeys.length > 0) {
|
|
109539
|
+
const patch = Object.fromEntries(plainKeys.map((key) => [key, void 0]));
|
|
109540
|
+
changed = await this.applyGlobalPatch(patch, target, cap) || changed;
|
|
109541
|
+
}
|
|
109542
|
+
if (secretKeys.length > 0) {
|
|
109543
|
+
await this.clearSecretKeys(secretKeys, target, cap);
|
|
109544
|
+
const node = normalizeNodeId(target ?? this._ctx?.kernel?.localNodeId);
|
|
109545
|
+
const rows = secretKeys.map((key) => scope === "node" ? nodeScopedKey(key, node) : key);
|
|
109546
|
+
if (this._secretSettings !== null) await this._secretSettings.removeClearedKeys(rows);
|
|
109547
|
+
else await this._ctx?.settings?.writeAddonStore(Object.fromEntries(rows.map((row) => [row, void 0])));
|
|
109548
|
+
changed = true;
|
|
109549
|
+
}
|
|
109550
|
+
if (changed) await this.onScopedSettingsChanged(scope, cap, [...keys]);
|
|
109551
|
+
}
|
|
109552
|
+
/**
|
|
109553
|
+
* The hydrated form of one scope of one capability's settings (any
|
|
109554
|
+
* {@link scopedSettingsOverlay} applied), or `null` when the capability declares nothing there.
|
|
109555
|
+
*/
|
|
109556
|
+
async getScopedSettings(scope, cap, nodeId) {
|
|
109557
|
+
const schema = await this.declaredScopedSchema(scope, cap);
|
|
109558
|
+
if (schema === null) return null;
|
|
109559
|
+
const stored = this.narrowToScope(await this.readRawProjectedStore(nodeId, cap), schema);
|
|
109560
|
+
const overlay = await this.scopedSettingsOverlay(scope, cap, nodeId);
|
|
109561
|
+
return hydrateSchema(schema, overlay ? await this.overlayKeepingMarkers(stored, overlay) : stored, { inlineSecretsAsViews: true });
|
|
109562
|
+
}
|
|
109563
|
+
/**
|
|
109564
|
+
* The scoped schemas this addon serves: one entry per loaded (capability, scope), capabilities
|
|
109565
|
+
* in declaration order, scopes in {@link SCOPED_SETTINGS_SCOPES} order. `[]` when it declares
|
|
109566
|
+
* nothing.
|
|
109567
|
+
*/
|
|
109568
|
+
async listScopedSettings() {
|
|
109569
|
+
await this.loadScopedSchemas();
|
|
109570
|
+
return [...this._scopedByCap].flatMap(([cap, entries]) => entries.map((entry) => ({
|
|
109571
|
+
cap,
|
|
109572
|
+
scope: entry.scope,
|
|
109573
|
+
sectionIds: entry.schema.sections.map((section) => section.id)
|
|
109574
|
+
})));
|
|
109575
|
+
}
|
|
109576
|
+
/** The OPERATOR's write of declared keys of one scope (D787 secret semantics). */
|
|
109577
|
+
async updateScopedSettings(scope, cap, patch, nodeId) {
|
|
109578
|
+
this._operatorWriteDepth++;
|
|
109579
|
+
try {
|
|
109580
|
+
await this.writeScoped(scope, cap, patch, nodeId);
|
|
109581
|
+
} finally {
|
|
109582
|
+
this._operatorWriteDepth--;
|
|
109583
|
+
}
|
|
109584
|
+
}
|
|
109585
|
+
/**
|
|
109586
|
+
* The effective values (`stored ?? default`) of one scope, a secret as its `set` view — never
|
|
109587
|
+
* its value. `null` when the capability declares nothing for the scope.
|
|
109588
|
+
*/
|
|
109589
|
+
async readScopedValues(scope, cap, nodeId) {
|
|
109590
|
+
const schema = await this.declaredScopedSchema(scope, cap);
|
|
109591
|
+
if (schema === null) return null;
|
|
109592
|
+
const form = hydrateSchema(schema, this.narrowToScope(await this.readRawProjectedStore(nodeId, cap), schema), { inlineSecretsAsViews: true });
|
|
109593
|
+
return Object.fromEntries([...collectHydratedFieldValues(form)].filter(([, value]) => value !== void 0));
|
|
109594
|
+
}
|
|
109595
|
+
/**
|
|
109377
109596
|
* What the create wizard and the integration edit page render for one instance: the addon's
|
|
109378
109597
|
* per-instance schema when it declares one, else its global schema (what they always showed).
|
|
109379
109598
|
*/
|
|
109380
109599
|
async getIntegrationFormSchema(instance, nodeId) {
|
|
109381
109600
|
const scoped = await this.integrationFormSchema(instance);
|
|
109382
|
-
if (scoped === null) return this.
|
|
109601
|
+
if (scoped === null) return this.scopedForm(nodeId);
|
|
109383
109602
|
return hydrateSchema(scoped, {}, { inlineSecretsAsViews: true });
|
|
109384
109603
|
}
|
|
109385
|
-
|
|
109386
|
-
|
|
109387
|
-
|
|
109388
|
-
const schema = this.
|
|
109389
|
-
if (!schema)
|
|
109390
|
-
|
|
109391
|
-
const sections = [];
|
|
109392
|
-
for (const id of declared) {
|
|
109393
|
-
const section = byId.get(id);
|
|
109394
|
-
if (!section) throw new Error(`${this.constructor.name}: integrationSettingSections() names unknown section "${id}". Known sections: [${[...byId.keys()].join(", ")}].`);
|
|
109395
|
-
const fields = dropPerNodeFields(section.fields);
|
|
109396
|
-
if (fields.length === 0) continue;
|
|
109397
|
-
sections.push({
|
|
109398
|
-
...section,
|
|
109399
|
-
fields
|
|
109400
|
-
});
|
|
109401
|
-
}
|
|
109402
|
-
if (sections.length === 0) return null;
|
|
109403
|
-
const projected = await this.readRawProjectedStore(nodeId);
|
|
109404
|
-
return hydrateSchema({
|
|
109405
|
-
...schema,
|
|
109406
|
-
sections
|
|
109407
|
-
}, projected, { inlineSecretsAsViews: true });
|
|
109604
|
+
/** The form of the scoped schemas this addon declared, hydrated from its store. */
|
|
109605
|
+
async scopedForm(nodeId) {
|
|
109606
|
+
await this.loadScopedSchemas();
|
|
109607
|
+
const schema = this.scopedFormSchema();
|
|
109608
|
+
if (!schema) return { sections: [] };
|
|
109609
|
+
return hydrateSchema(schema, await this.readRawProjectedStore(nodeId), { inlineSecretsAsViews: true });
|
|
109408
109610
|
}
|
|
109409
109611
|
/**
|
|
109410
109612
|
* The raw addon store PROJECTED onto the target node's bare per-node keys:
|
|
@@ -109413,8 +109615,8 @@ var BaseAddon = class {
|
|
|
109413
109615
|
* bare fallback), all `@`-scoped and stray bare per-node keys are dropped.
|
|
109414
109616
|
* A no-op passthrough when the schema declares no `perNode` field.
|
|
109415
109617
|
*
|
|
109416
|
-
* This is the sanctioned way for
|
|
109417
|
-
* the store for custom
|
|
109618
|
+
* This is the sanctioned way for an addon that needs
|
|
109619
|
+
* the store for custom logic (option narrowing, value snapping) to
|
|
109418
109620
|
* read it per-node — never `ctx.settings.readAddonStore()` directly.
|
|
109419
109621
|
* `nodeId` omitted ⇒ the local node (node-blind injection from ctx).
|
|
109420
109622
|
*
|
|
@@ -109466,7 +109668,7 @@ var BaseAddon = class {
|
|
|
109466
109668
|
}
|
|
109467
109669
|
/**
|
|
109468
109670
|
* Whether ONE global key of this addon's store was written, read three-way
|
|
109469
|
-
* (D651). For a question a hydrated view cannot answer:
|
|
109671
|
+
* (D651). For a question a hydrated view cannot answer: a hydrated form
|
|
109470
109672
|
* reports `value ?? default`, so "the operator chose the default" and "nobody
|
|
109471
109673
|
* chose" look the same, and a failed read looks like both. A `perNode` key is
|
|
109472
109674
|
* not supported here: its stored name is scoped.
|
|
@@ -109500,7 +109702,7 @@ var BaseAddon = class {
|
|
|
109500
109702
|
}
|
|
109501
109703
|
/**
|
|
109502
109704
|
* The OPERATOR's write — a settings form or an admin API call, dispatched by
|
|
109503
|
-
* the kernel.
|
|
109705
|
+
* the kernel. The one in-process write of the addon blob that is not a scoped write; a secret
|
|
109504
109706
|
* the operator sends is stored as sent even when it equals a pre-keychain
|
|
109505
109707
|
* inline value: the operator re-entering a password is a change, an addon
|
|
109506
109708
|
* writing back what it read is not (D787).
|
|
@@ -109513,9 +109715,6 @@ var BaseAddon = class {
|
|
|
109513
109715
|
this._operatorWriteDepth--;
|
|
109514
109716
|
}
|
|
109515
109717
|
}
|
|
109516
|
-
async updateGlobalSettings(patch, nodeId) {
|
|
109517
|
-
await this.applyGlobalPatch(patch, nodeId);
|
|
109518
|
-
}
|
|
109519
109718
|
/**
|
|
109520
109719
|
* REMOVE stored secrets — their keychain values and their markers (D787).
|
|
109521
109720
|
*
|
|
@@ -109525,6 +109724,9 @@ var BaseAddon = class {
|
|
|
109525
109724
|
* a keychain (an older kernel) it writes `''`, as such code always did.
|
|
109526
109725
|
*/
|
|
109527
109726
|
async clearSecrets(keys, nodeId) {
|
|
109727
|
+
await this.clearSecretKeys(keys, nodeId);
|
|
109728
|
+
}
|
|
109729
|
+
async clearSecretKeys(keys, nodeId, cap) {
|
|
109528
109730
|
const tree = this.addonSecretTree();
|
|
109529
109731
|
const keychain = this._ctx?.secrets !== void 0;
|
|
109530
109732
|
const stored = keychain ? await this.readAddonStoreWithRetry() : {};
|
|
@@ -109537,25 +109739,26 @@ var BaseAddon = class {
|
|
|
109537
109739
|
const keychainStored = tree.has(key) || collectSecretMarkerRefs(stored[key]).length > 0;
|
|
109538
109740
|
patch[key] = keychain && keychainStored ? SECRET_CLEAR : "";
|
|
109539
109741
|
}
|
|
109540
|
-
await this.applyGlobalPatch(patch, nodeId);
|
|
109742
|
+
await this.applyGlobalPatch(patch, nodeId, cap);
|
|
109541
109743
|
}
|
|
109542
|
-
|
|
109543
|
-
|
|
109544
|
-
|
|
109744
|
+
/** Resolves `true` when the write changed stored values. */
|
|
109745
|
+
async applyGlobalPatch(barePatch, nodeId, cap) {
|
|
109746
|
+
await this.loadScopedSchemas(cap);
|
|
109747
|
+
const keys = this.perNodeKeys(cap);
|
|
109545
109748
|
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
109546
109749
|
const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
109547
109750
|
const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
|
|
109548
109751
|
const handle = this._secretSettings;
|
|
109549
109752
|
if (handle !== null) {
|
|
109550
109753
|
const { changed } = await handle.writeAddonStore(scoped);
|
|
109551
|
-
if (!changed) return;
|
|
109754
|
+
if (!changed) return false;
|
|
109552
109755
|
} else await this._ctx?.settings?.writeAddonStore(scoped);
|
|
109553
|
-
if (target !== localNode) return;
|
|
109756
|
+
if (target !== localNode) return true;
|
|
109554
109757
|
await this.resolveConfig();
|
|
109555
109758
|
await this.onConfigChanged();
|
|
109556
109759
|
this.emitLifecycle(EventCategory.AddonUpdated, { level: "global" });
|
|
109557
|
-
|
|
109558
|
-
|
|
109760
|
+
this.maybeAutoRestart(Object.keys(barePatch), this.loadedScopedSchemas().map((entry) => entry.schema));
|
|
109761
|
+
return true;
|
|
109559
109762
|
}
|
|
109560
109763
|
/**
|
|
109561
109764
|
* The set of field keys the global settings schema declares `perNode: true`
|
|
@@ -109592,10 +109795,7 @@ var BaseAddon = class {
|
|
|
109592
109795
|
this._nodeKeysByCap = /* @__PURE__ */ new Map();
|
|
109593
109796
|
this._addonSecretTree = null;
|
|
109594
109797
|
}
|
|
109595
|
-
/**
|
|
109596
|
-
* The form the settings API serves while an addon declares no {@link globalSettingsSchema}: the
|
|
109597
|
-
* sections of its scoped schemas, so dropping the old hook does not blank the form.
|
|
109598
|
-
*/
|
|
109798
|
+
/** The form of an addon's scoped schemas: their sections, each shown once. */
|
|
109599
109799
|
scopedFormSchema(cap) {
|
|
109600
109800
|
const byId = /* @__PURE__ */ new Map();
|
|
109601
109801
|
for (const entry of this.loadedScopedSchemas(cap)) for (const section of entry.schema.sections) if (!byId.has(section.id)) byId.set(section.id, section);
|
|
@@ -109607,8 +109807,7 @@ var BaseAddon = class {
|
|
|
109607
109807
|
return [...this._scopedByCap.values()].flat();
|
|
109608
109808
|
}
|
|
109609
109809
|
/**
|
|
109610
|
-
* The field keys that are stored per node: every field of a {@link nodeSettingsSchema}
|
|
109611
|
-
* the fields the legacy {@link globalSettingsSchema} still marks `perNode: true`. Derived once
|
|
109810
|
+
* The field keys that are stored per node: every field of a {@link nodeSettingsSchema}. Derived once
|
|
109612
109811
|
* per `cap` argument and memoized (schemas are static declarations). Empty set ⇒ every
|
|
109613
109812
|
* per-node code path is bypassed and the settings API behaves like the node-agnostic one.
|
|
109614
109813
|
* Call {@link loadScopedSchemas} first (the async seams do).
|
|
@@ -109617,8 +109816,7 @@ var BaseAddon = class {
|
|
|
109617
109816
|
const cacheKey = cap ?? "";
|
|
109618
109817
|
const cached = this._nodeKeysByCap.get(cacheKey);
|
|
109619
109818
|
if (cached) return cached;
|
|
109620
|
-
const
|
|
109621
|
-
const keys = new Set(legacy ? legacy.sections.flatMap((section) => collectPerNodeFieldKeys(section.fields)) : []);
|
|
109819
|
+
const keys = /* @__PURE__ */ new Set();
|
|
109622
109820
|
for (const { scope, schema } of this.loadedScopedSchemas(cap)) {
|
|
109623
109821
|
if (scope !== "node") continue;
|
|
109624
109822
|
for (const section of schema.sections) for (const key of collectValueFieldKeys(section.fields)) keys.add(key);
|
|
@@ -109836,8 +110034,6 @@ var BaseAddon = class {
|
|
|
109836
110034
|
}
|
|
109837
110035
|
declaredKeySet() {
|
|
109838
110036
|
const keys = new Set(Object.keys(this.defaults));
|
|
109839
|
-
const schema = this.globalSettingsSchema();
|
|
109840
|
-
if (schema) for (const section of schema.sections) for (const key of collectFieldKeys(section.fields)) keys.add(key);
|
|
109841
110037
|
for (const { schema: scoped } of this.loadedScopedSchemas()) for (const section of scoped.sections) for (const key of collectFieldKeys(section.fields)) keys.add(key);
|
|
109842
110038
|
for (const key of this._declaredStateKeys) keys.add(key);
|
|
109843
110039
|
for (const path of this.secretStatePaths) {
|
|
@@ -109935,7 +110131,7 @@ var BaseAddon = class {
|
|
|
109935
110131
|
/** The addon store's secret tree: schema fields by TYPE, plus `secretStatePaths`. */
|
|
109936
110132
|
addonSecretTree() {
|
|
109937
110133
|
if (this._addonSecretTree === null) {
|
|
109938
|
-
const tree = new Map(
|
|
110134
|
+
const tree = /* @__PURE__ */ new Map();
|
|
109939
110135
|
for (const { schema } of this.loadedScopedSchemas()) for (const [key, node] of secretTreeFromSchema(schema)) tree.set(key, node);
|
|
109940
110136
|
this._addonSecretTree = mergeSecretStatePaths(tree, this.secretStatePaths);
|
|
109941
110137
|
}
|
|
@@ -110147,47 +110343,6 @@ function classifyStoreError(err) {
|
|
|
110147
110343
|
if (TRANSPORT_PHRASES.some((f) => message.includes(f))) return "transport";
|
|
110148
110344
|
return "permanent";
|
|
110149
110345
|
}
|
|
110150
|
-
/**
|
|
110151
|
-
* Collect the keys of every field marked `perNode: true`, recursing into
|
|
110152
|
-
* layout containers (`group` fields and `sub-tabs` tabs) the same way
|
|
110153
|
-
* `hydrateSchema` does. Valueless structural fields (separator/info/…)
|
|
110154
|
-
* don't declare `perNode` and are excluded by the `in` narrowing.
|
|
110155
|
-
*/
|
|
110156
|
-
/**
|
|
110157
|
-
* The same fields with every `perNode: true` one removed, recursing into layout
|
|
110158
|
-
* containers exactly as {@link collectPerNodeFieldKeys} does. A container left
|
|
110159
|
-
* with no child is dropped rather than rendered empty.
|
|
110160
|
-
*
|
|
110161
|
-
* Used by `getIntegrationSettings`: an integration is not a node, so a field
|
|
110162
|
-
* whose store key is `<key>@<nodeId>` has no node to belong to there.
|
|
110163
|
-
*/
|
|
110164
|
-
function dropPerNodeFields(fields) {
|
|
110165
|
-
const kept = [];
|
|
110166
|
-
for (const field of fields) {
|
|
110167
|
-
if (field.type === "group") {
|
|
110168
|
-
const inner = dropPerNodeFields(field.fields);
|
|
110169
|
-
if (inner.length > 0) kept.push({
|
|
110170
|
-
...field,
|
|
110171
|
-
fields: inner
|
|
110172
|
-
});
|
|
110173
|
-
continue;
|
|
110174
|
-
}
|
|
110175
|
-
if (field.type === "sub-tabs") {
|
|
110176
|
-
const tabs = field.tabs.map((tab) => ({
|
|
110177
|
-
...tab,
|
|
110178
|
-
fields: dropPerNodeFields(tab.fields)
|
|
110179
|
-
})).filter((tab) => tab.fields.length > 0);
|
|
110180
|
-
if (tabs.length > 0) kept.push({
|
|
110181
|
-
...field,
|
|
110182
|
-
tabs
|
|
110183
|
-
});
|
|
110184
|
-
continue;
|
|
110185
|
-
}
|
|
110186
|
-
if ("perNode" in field && field.perNode === true) continue;
|
|
110187
|
-
kept.push(field);
|
|
110188
|
-
}
|
|
110189
|
-
return kept;
|
|
110190
|
-
}
|
|
110191
110346
|
/** The keys of the value-holding fields, recursing into layout containers. */
|
|
110192
110347
|
function collectValueFieldKeys(fields) {
|
|
110193
110348
|
const collected = [];
|
|
@@ -110220,21 +110375,6 @@ function collectFieldKeys(fields) {
|
|
|
110220
110375
|
}
|
|
110221
110376
|
return collected;
|
|
110222
110377
|
}
|
|
110223
|
-
function collectPerNodeFieldKeys(fields) {
|
|
110224
|
-
const collected = [];
|
|
110225
|
-
for (const field of fields) {
|
|
110226
|
-
if (field.type === "group") {
|
|
110227
|
-
collected.push(...collectPerNodeFieldKeys(field.fields));
|
|
110228
|
-
continue;
|
|
110229
|
-
}
|
|
110230
|
-
if (field.type === "sub-tabs") {
|
|
110231
|
-
for (const tab of field.tabs) collected.push(...collectPerNodeFieldKeys(tab.fields));
|
|
110232
|
-
continue;
|
|
110233
|
-
}
|
|
110234
|
-
if ("perNode" in field && field.perNode === true) collected.push(field.key);
|
|
110235
|
-
}
|
|
110236
|
-
return collected;
|
|
110237
|
-
}
|
|
110238
110378
|
/**
|
|
110239
110379
|
* Normalize an `ICamstackAddon.initialize()` return value into the
|
|
110240
110380
|
* `AddonInitResult` envelope. Arrays are wrapped into `{ providers }`;
|
|
@@ -111398,7 +111538,6 @@ var CAP_NAMES = Object.freeze([
|
|
|
111398
111538
|
"notifier",
|
|
111399
111539
|
"numeric-sensor",
|
|
111400
111540
|
"oauth-integration",
|
|
111401
|
-
"oidc-connections",
|
|
111402
111541
|
"osd",
|
|
111403
111542
|
"osd-manager",
|
|
111404
111543
|
"pet-feeder",
|
|
@@ -113105,13 +113244,25 @@ Object.freeze({
|
|
|
113105
113244
|
"path": "temperature",
|
|
113106
113245
|
"valueType": "number"
|
|
113107
113246
|
}],
|
|
113108
|
-
"timed-run": [
|
|
113109
|
-
|
|
113110
|
-
|
|
113111
|
-
|
|
113112
|
-
|
|
113113
|
-
|
|
113114
|
-
|
|
113247
|
+
"timed-run": [
|
|
113248
|
+
{
|
|
113249
|
+
"path": "activeUntil",
|
|
113250
|
+
"valueType": "number"
|
|
113251
|
+
},
|
|
113252
|
+
{
|
|
113253
|
+
"path": "requestedBy",
|
|
113254
|
+
"valueType": "string"
|
|
113255
|
+
},
|
|
113256
|
+
{
|
|
113257
|
+
"path": "quickRun.duration",
|
|
113258
|
+
"valueType": "number"
|
|
113259
|
+
},
|
|
113260
|
+
{
|
|
113261
|
+
"path": "quickRun.unit",
|
|
113262
|
+
"valueType": "enum",
|
|
113263
|
+
"enumValues": ["s", "min"]
|
|
113264
|
+
}
|
|
113265
|
+
],
|
|
113115
113266
|
"update": [
|
|
113116
113267
|
{
|
|
113117
113268
|
"path": "currentVersion",
|
|
@@ -113290,8 +113441,7 @@ Object.freeze({
|
|
|
113290
113441
|
"device-provider": { "reloadDevice": 18e4 },
|
|
113291
113442
|
"llm": {
|
|
113292
113443
|
"generate": 6e5,
|
|
113293
|
-
"generateVision": 6e5
|
|
113294
|
-
"testProfile": 6e5
|
|
113444
|
+
"generateVision": 6e5
|
|
113295
113445
|
},
|
|
113296
113446
|
"llm-runtime": {
|
|
113297
113447
|
"complete": 6e5,
|
|
@@ -113374,7 +113524,7 @@ function sleep(ms) {
|
|
|
113374
113524
|
return new Promise((resolve) => setTimeout(resolve, Math.max(0, ms)));
|
|
113375
113525
|
}
|
|
113376
113526
|
//#endregion
|
|
113377
|
-
//#region ../types/dist/composition-
|
|
113527
|
+
//#region ../types/dist/composition-Bx0JvKUU.mjs
|
|
113378
113528
|
/**
|
|
113379
113529
|
* The ffmpeg build every CamStack node downloads, per platform and arch.
|
|
113380
113530
|
*
|
|
@@ -114536,439 +114686,821 @@ var NodeColorIdSchema = _enum([
|
|
|
114536
114686
|
"node-h"
|
|
114537
114687
|
]);
|
|
114538
114688
|
//#endregion
|
|
114539
|
-
//#region ../types/dist/
|
|
114540
|
-
/**
|
|
114541
|
-
* The `smtp-inbound` broker kind (D999): a mailbox a device can send mail to.
|
|
114542
|
-
*
|
|
114543
|
-
* The `broker` cap carries these as `Record<string, unknown>` on the wire; the
|
|
114544
|
-
* provider and its consumers parse them with the schemas below at BOTH ends, so
|
|
114545
|
-
* the shape is declared once.
|
|
114546
|
-
*/
|
|
114547
|
-
/** The broker kind tag. */
|
|
114548
|
-
var SMTP_INBOUND_KIND = "smtp-inbound";
|
|
114549
|
-
/** The id the first mailbox is minted under (adopt-id), so a consumer can find it again. */
|
|
114550
|
-
var SMTP_INBOUND_DEFAULT_ID = "smtp-inbound-default";
|
|
114551
|
-
var SMTP_INBOUND_DEFAULT_PORT = 2525;
|
|
114552
|
-
var SMTP_INBOUND_DEFAULT_DOMAIN = "camstack.local";
|
|
114553
|
-
var SMTP_INBOUND_DEFAULT_MAX_MESSAGE_BYTES = 25 * 1024 * 1024;
|
|
114554
|
-
/** The text excerpt a message carries on the bus. */
|
|
114555
|
-
var SMTP_INBOUND_TEXT_MAX_CHARS = 4096;
|
|
114556
|
-
var PortSchema = number().int().min(1).max(65535);
|
|
114557
|
-
/** A recipient local-part: what stands before the `@`. */
|
|
114558
|
-
var SmtpRecipientSchema = string().min(1).max(64).regex(/^[A-Za-z0-9._+-]+$/);
|
|
114559
|
-
object({
|
|
114560
|
-
port: PortSchema.default(SMTP_INBOUND_DEFAULT_PORT),
|
|
114561
|
-
bindHost: string().min(1).default("0.0.0.0"),
|
|
114562
|
-
domain: string().min(1).default(SMTP_INBOUND_DEFAULT_DOMAIN),
|
|
114563
|
-
requireAuth: boolean().default(true),
|
|
114564
|
-
username: string().default(""),
|
|
114565
|
-
password: string().default("").meta({ secret: true }),
|
|
114566
|
-
starttls: boolean().default(false),
|
|
114567
|
-
maxMessageBytes: number().int().positive().default(SMTP_INBOUND_DEFAULT_MAX_MESSAGE_BYTES)
|
|
114568
|
-
});
|
|
114569
|
-
/**
|
|
114570
|
-
* What `getBrokerConfig` answers: what a device needs to send mail here.
|
|
114571
|
-
* `host` is null when the `internal` role of the network palette is not set;
|
|
114572
|
-
* `hostReason` then says where to set it.
|
|
114573
|
-
*/
|
|
114574
|
-
var SmtpInboundConfigSchema = object({
|
|
114575
|
-
host: string().min(1).nullable(),
|
|
114576
|
-
hostReason: string().nullable(),
|
|
114577
|
-
port: PortSchema,
|
|
114578
|
-
domain: string().min(1),
|
|
114579
|
-
requireAuth: boolean(),
|
|
114580
|
-
username: string(),
|
|
114581
|
-
password: string(),
|
|
114582
|
-
starttls: boolean()
|
|
114583
|
-
});
|
|
114584
|
-
object({
|
|
114585
|
-
recipients: array(SmtpRecipientSchema).min(1),
|
|
114586
|
-
/**
|
|
114587
|
-
* Who is subscribing. A second `subscribe` with the same id REPLACES that subscriber's
|
|
114588
|
-
* recipients (the way a consumer that restarted, or lost a device, declares its set again);
|
|
114589
|
-
* a recipient held by another subscriber is refused with `smtp-inbound/recipient-claimed`.
|
|
114590
|
-
* Absent, the subscriber is anonymous and unique.
|
|
114591
|
-
*/
|
|
114592
|
-
subscriberId: string().min(1).max(64).optional()
|
|
114593
|
-
});
|
|
114594
|
-
var SmtpInboundAttachmentSchema = object({
|
|
114595
|
-
filename: string(),
|
|
114596
|
-
contentType: string(),
|
|
114597
|
-
bytes: number().int().nonnegative()
|
|
114598
|
-
});
|
|
114599
|
-
/** The payload of one `broker.message` (the key is the recipient local-part). */
|
|
114600
|
-
var SmtpInboundMessageSchema = object({
|
|
114601
|
-
/** Monotonic per mailbox; a gap tells a consumer it missed an event. */
|
|
114602
|
-
seq: number().int().positive(),
|
|
114603
|
-
messageId: string(),
|
|
114604
|
-
receivedAt: number().int().nonnegative(),
|
|
114605
|
-
from: string(),
|
|
114606
|
-
to: string(),
|
|
114607
|
-
subject: string(),
|
|
114608
|
-
text: string().max(SMTP_INBOUND_TEXT_MAX_CHARS),
|
|
114609
|
-
attachments: array(SmtpInboundAttachmentSchema)
|
|
114610
|
-
});
|
|
114611
|
-
/** What `getState('since:<seq>')` answers: every retained message after `seq`. */
|
|
114612
|
-
var SmtpInboundSinceSchema = object({
|
|
114613
|
-
/** The newest seq issued so far (0 before any mail). */
|
|
114614
|
-
lastSeq: number().int().nonnegative(),
|
|
114615
|
-
/** The oldest seq still retained; messages below it are gone. */
|
|
114616
|
-
oldestSeq: number().int().nonnegative(),
|
|
114617
|
-
messages: array(object({
|
|
114618
|
-
key: string(),
|
|
114619
|
-
message: SmtpInboundMessageSchema
|
|
114620
|
-
}))
|
|
114621
|
-
});
|
|
114622
|
-
/** The key a consumer passes to `getState` to replay the ring, and its parser. */
|
|
114623
|
-
function smtpSinceKey(seq) {
|
|
114624
|
-
return `since:${seq}`;
|
|
114625
|
-
}
|
|
114626
|
-
new Set([
|
|
114627
|
-
"track",
|
|
114628
|
-
"face",
|
|
114629
|
-
"identity",
|
|
114630
|
-
"plate",
|
|
114631
|
-
"vehicle",
|
|
114632
|
-
"scene",
|
|
114633
|
-
"motion",
|
|
114634
|
-
"object",
|
|
114635
|
-
"audio",
|
|
114636
|
-
"mosaic"
|
|
114637
|
-
]);
|
|
114638
|
-
/**
|
|
114639
|
-
* The owner types that are event tables, in the order the event-media resolver
|
|
114640
|
-
* should consider them. Exported so a consumer asking "is this key an event?"
|
|
114641
|
-
* does not re-spell the list and drift from it.
|
|
114642
|
-
*/
|
|
114643
|
-
var EVENT_OWNER_TYPES = [
|
|
114644
|
-
"motion",
|
|
114645
|
-
"object",
|
|
114646
|
-
"audio"
|
|
114647
|
-
];
|
|
114648
|
-
/**
|
|
114649
|
-
* The same list as a Zod enum, for the cap inputs that must NAME the table
|
|
114650
|
-
* (D482: `getEventMedia` / `listEventMedia` take an owner, and an owner is
|
|
114651
|
-
* `(table, id)`).
|
|
114652
|
-
*
|
|
114653
|
-
* Built FROM {@link EVENT_OWNER_TYPES} rather than re-spelled: a fourth event
|
|
114654
|
-
* table would otherwise be accepted by the codec and refused at the door, with
|
|
114655
|
-
* nothing failing until a caller asked.
|
|
114656
|
-
*/
|
|
114657
|
-
var EventOwnerTypeSchema = _enum(EVENT_OWNER_TYPES);
|
|
114658
|
-
/** The same list as a Zod enum, for the cap input that carries it. */
|
|
114659
|
-
var MediaPresenceOwnerKindSchema = _enum([...EVENT_OWNER_TYPES, "track"]);
|
|
114660
|
-
new Set(EVENT_OWNER_TYPES);
|
|
114661
|
-
/**
|
|
114662
|
-
* What a published package needs from the rest of the install (D989).
|
|
114663
|
-
*
|
|
114664
|
-
* One published framework package (`@camstack/server`) carries the kernel, the
|
|
114665
|
-
* builtins and the capability contracts, so "which addon runs on which
|
|
114666
|
-
* framework" is a question of version, and the answer is DECLARED by the
|
|
114667
|
-
* package that knows it:
|
|
114668
|
-
*
|
|
114669
|
-
* - an addon says the oldest server it runs on (`requires.server: ">=X"`);
|
|
114670
|
-
* - the server says the oldest addon it works with
|
|
114671
|
-
* (`requires.addons: { "@camstack/addon-x": ">=Y" }`) and the oldest shell
|
|
114672
|
-
* around it (`requires.wrapper: { desktop, image }`);
|
|
114673
|
-
* - a wrapper (the desktop app, the container starter) says which server
|
|
114674
|
-
* range it can host, and reports its own kind and version.
|
|
114675
|
-
*
|
|
114676
|
-
* The publish workflow STAMPS these after the version bump
|
|
114677
|
-
* (`scripts/ci/stamp-requires.mjs`); nobody types a number by hand.
|
|
114678
|
-
*
|
|
114679
|
-
* A requirement that cannot be checked is NOT met: a shell that reports no
|
|
114680
|
-
* version counts as below the minimum, and an unreadable running version is
|
|
114681
|
-
* named in the result (a failed read is never a pass).
|
|
114682
|
-
*/
|
|
114683
|
-
/** `>=MAJOR.MINOR.PATCH[-prerelease]` — the only range shape a requirement uses. */
|
|
114684
|
-
var MinVersionSchema = string().regex(/^>=\d+\.\d+\.\d+(-[0-9A-Za-z.-]+)?$/, "a minimum is written \">=X.Y.Z\"");
|
|
114685
|
-
object({
|
|
114686
|
-
/** The oldest `@camstack/server` this package runs on. */
|
|
114687
|
-
server: MinVersionSchema.optional(),
|
|
114688
|
-
/** The oldest installed version of each named addon package. */
|
|
114689
|
-
addons: record(string(), MinVersionSchema).optional(),
|
|
114690
|
-
/** The oldest shell around the server, per shell kind. */
|
|
114691
|
-
wrapper: object({
|
|
114692
|
-
desktop: MinVersionSchema.optional(),
|
|
114693
|
-
image: MinVersionSchema.optional()
|
|
114694
|
-
}).optional()
|
|
114695
|
-
});
|
|
114696
|
-
/** One unmet requirement; each names the versions on both sides. */
|
|
114697
|
-
var UnmetRequirementSchema = discriminatedUnion("kind", [
|
|
114698
|
-
object({
|
|
114699
|
-
kind: literal("server-too-old"),
|
|
114700
|
-
required: string(),
|
|
114701
|
-
/** `null` — the running server version could not be read. */
|
|
114702
|
-
running: string().nullable()
|
|
114703
|
-
}),
|
|
114704
|
-
object({
|
|
114705
|
-
kind: literal("addon-too-old"),
|
|
114706
|
-
packageName: string(),
|
|
114707
|
-
required: string(),
|
|
114708
|
-
/** `null` — the addon is not installed (or its version is unreadable). */
|
|
114709
|
-
running: string().nullable()
|
|
114710
|
-
}),
|
|
114711
|
-
object({
|
|
114712
|
-
kind: literal("wrapper-too-old"),
|
|
114713
|
-
wrapper: _enum(["desktop", "image"]),
|
|
114714
|
-
required: string(),
|
|
114715
|
-
/** `null` — the wrapper reported no version. */
|
|
114716
|
-
running: string().nullable()
|
|
114717
|
-
})
|
|
114718
|
-
]);
|
|
114719
|
-
var RequiredAddonUpdateSchema = object({
|
|
114720
|
-
packageName: string(),
|
|
114721
|
-
/** The minimum the target server declares. */
|
|
114722
|
-
required: string(),
|
|
114723
|
-
/** What this node has; `null` when the addon is not installed. */
|
|
114724
|
-
installed: string().nullable()
|
|
114725
|
-
});
|
|
114726
|
-
/**
|
|
114727
|
-
* Which integration instance a settings form is for. An addon that serves several instances
|
|
114728
|
-
* (`instanceMode: multiple`) can show a different form per instance — an NVR integration
|
|
114729
|
-
* needs its connection, the default integration needs the addon's own sections.
|
|
114730
|
-
*
|
|
114731
|
-
* - `integrationId` is `null` in the create wizard: nothing exists yet, the operator is
|
|
114732
|
-
* setting up a NEW instance.
|
|
114733
|
-
* - `mode` is the wizard mode of the integration type (`getAvailableTypes`).
|
|
114734
|
-
* - `candidateStableId` is the discovery candidate a wizard was seeded from, if any.
|
|
114735
|
-
*/
|
|
114736
|
-
var IntegrationInstanceRefSchema = object({
|
|
114737
|
-
integrationId: string().nullable(),
|
|
114738
|
-
mode: _enum([
|
|
114739
|
-
"standalone",
|
|
114740
|
-
"account",
|
|
114741
|
-
"broker"
|
|
114742
|
-
]),
|
|
114743
|
-
candidateStableId: string().optional()
|
|
114744
|
-
});
|
|
114745
|
-
/**
|
|
114746
|
-
* notification-output — canonical, capability-gated notification delivery.
|
|
114747
|
-
*
|
|
114748
|
-
* Apprise-derived model (see
|
|
114749
|
-
* `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
|
|
114750
|
-
* callers emit ONE canonical `Notification`; each provider declares a
|
|
114751
|
-
* per-kind capability descriptor (`TargetKind`), and the pure degrade
|
|
114752
|
-
* engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
|
|
114753
|
-
* message to what the kind supports — callers never special-case a service.
|
|
114754
|
-
*
|
|
114755
|
-
* DESIGN DECISIONS (locked):
|
|
114756
|
-
* - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
|
|
114757
|
-
* `setTargetEnabled`), each provider persisting via the `settings-store`
|
|
114758
|
-
* cap. Rationale: the admin UI needs one uniform surface across the
|
|
114759
|
-
* notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
|
|
114760
|
-
* alternative would fork the UI per addon and cannot host the
|
|
114761
|
-
* discovery→adopt flow.
|
|
114762
|
-
* - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
|
|
114763
|
-
* the generated cap-mount auto-`concatCollection`-fans them across every
|
|
114764
|
-
* registered provider (notifiers addon + HA addon) so one catalog is
|
|
114765
|
-
* routable. `send` / `testTarget` / CRUD route to ONE provider by the
|
|
114766
|
-
* `addonId` the generated collection router extracts from the call input.
|
|
114767
|
-
* - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
|
|
114768
|
-
* transformer) + UDS MsgPack both round-trip typed arrays — already used by
|
|
114769
|
-
* `storage` / `storage-provider` / `recording` caps over the same path. No
|
|
114770
|
-
* base64 fallback needed.
|
|
114771
|
-
*
|
|
114772
|
-
* TODO (deferred, closed-set change — separate decision): add
|
|
114773
|
-
* `providerKind: 'notify'` so notification providers surface on the unified
|
|
114774
|
-
* admin "Integrations" page.
|
|
114775
|
-
*/
|
|
114776
|
-
/**
|
|
114777
|
-
* Zentik-derived typed-media enum — the superset across every kind. Each
|
|
114778
|
-
* adapter picks what it supports and the degrade engine filters the rest.
|
|
114779
|
-
*/
|
|
114780
|
-
var AttachmentMediaTypeSchema = _enum([
|
|
114781
|
-
"image",
|
|
114782
|
-
"video",
|
|
114783
|
-
"gif",
|
|
114784
|
-
"audio",
|
|
114785
|
-
"icon"
|
|
114786
|
-
]);
|
|
114787
|
-
/**
|
|
114788
|
-
* A single attachment. Exactly one of `url` (remote source, most adapters
|
|
114789
|
-
* prefer this) or `bytes` (inline source; required for Pushover-style
|
|
114790
|
-
* bytes-only kinds) MUST be present — the degrade engine expresses a
|
|
114791
|
-
* url→bytes fetch as a `needsFetch` directive the adapter executes.
|
|
114792
|
-
*/
|
|
114793
|
-
var AttachmentSchema = object({
|
|
114794
|
-
mediaType: AttachmentMediaTypeSchema,
|
|
114795
|
-
url: string().optional(),
|
|
114796
|
-
bytes: _instanceof(Uint8Array).optional(),
|
|
114797
|
-
mime: string().optional(),
|
|
114798
|
-
name: string().optional()
|
|
114799
|
-
}).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
|
|
114800
|
-
var NotificationFormatSchema = _enum([
|
|
114801
|
-
"text",
|
|
114802
|
-
"markdown",
|
|
114803
|
-
"html"
|
|
114804
|
-
]);
|
|
114689
|
+
//#region ../types/dist/convert-BAzH15HU.mjs
|
|
114805
114690
|
/**
|
|
114806
|
-
*
|
|
114807
|
-
*
|
|
114808
|
-
*
|
|
114809
|
-
*
|
|
114810
|
-
* notices — the same class of gap as a zone vocabulary nothing produced
|
|
114811
|
-
* ([D35](../../../docs/decisions/adr-0035.md)). Every adapter maps this set or
|
|
114812
|
-
* declares `actionIcons: false` and the degrade engine strips the field.
|
|
114813
|
-
*
|
|
114814
|
-
* Named by INTENT, never by glyph. "check" would tie the vocabulary to one
|
|
114815
|
-
* renderer's icon set; "acknowledge" survives an adapter that draws it
|
|
114816
|
-
* differently.
|
|
114817
|
-
*
|
|
114818
|
-
* ── A TOKEN IS NOT A WIRE VALUE ─────────────────────────────────────
|
|
114819
|
-
*
|
|
114820
|
-
* These names are for US. **No adapter may forward one verbatim.** Each maps
|
|
114821
|
-
* the whole set onto its own renderer's vocabulary through a
|
|
114822
|
-
* `Record<NotificationActionIcon, string>` — a Record, never a lookup with a
|
|
114823
|
-
* fallback, so adding a member here fails every adapter's build until someone
|
|
114824
|
-
* decides its glyph, which is the only place that decision can be made
|
|
114825
|
-
* honestly.
|
|
114826
|
-
*
|
|
114827
|
-
* This paragraph is the bug. Zentik declared `actionIcons: true` and passed
|
|
114828
|
-
* `disarm` straight through; iOS feeds that string to
|
|
114829
|
-
* `UNNotificationActionIcon(systemImageName:)`, `disarm` is not an SF Symbol,
|
|
114830
|
-
* and every snooze and alarm button arrived BLANK. A pass-through is not a
|
|
114831
|
-
* mapping, and "the field is documented" is not "the value renders".
|
|
114832
|
-
*
|
|
114833
|
-
* Adding a member is TRAIN-BOUND. The enum lives in the published
|
|
114834
|
-
* `@camstack/server` closure and the cap seam validates against the HUB's copy,
|
|
114835
|
-
* so an addon that emits a token the running hub does not know does not lose an
|
|
114836
|
-
* icon — its whole `send` fails Zod validation and the notification never
|
|
114837
|
-
* arrives. Never emit a new token from an addon before the train carrying it.
|
|
114691
|
+
* Frozen unit → spec table. `•` in the doc marks each dimension's canonical
|
|
114692
|
+
* unit (`factor: 1, offset: 0`). °F derives from `°C = (°F − 32) × 5/9` ⇒
|
|
114693
|
+
* `factor = 5/9`, `offset = -160/9` (kept as exact expressions, not rounded
|
|
114694
|
+
* decimals). K derives from `°C = K − 273.15`.
|
|
114838
114695
|
*/
|
|
114839
|
-
var
|
|
114840
|
-
"
|
|
114841
|
-
|
|
114842
|
-
|
|
114843
|
-
|
|
114844
|
-
|
|
114845
|
-
"
|
|
114846
|
-
|
|
114847
|
-
|
|
114848
|
-
|
|
114849
|
-
|
|
114850
|
-
|
|
114851
|
-
|
|
114852
|
-
|
|
114853
|
-
|
|
114854
|
-
|
|
114855
|
-
|
|
114856
|
-
|
|
114857
|
-
|
|
114858
|
-
|
|
114859
|
-
|
|
114860
|
-
|
|
114861
|
-
|
|
114862
|
-
|
|
114863
|
-
|
|
114864
|
-
|
|
114865
|
-
|
|
114866
|
-
|
|
114867
|
-
|
|
114868
|
-
|
|
114869
|
-
|
|
114870
|
-
|
|
114871
|
-
|
|
114872
|
-
|
|
114873
|
-
|
|
114874
|
-
|
|
114875
|
-
|
|
114876
|
-
|
|
114877
|
-
|
|
114878
|
-
|
|
114879
|
-
|
|
114880
|
-
|
|
114881
|
-
|
|
114882
|
-
|
|
114883
|
-
|
|
114884
|
-
|
|
114885
|
-
|
|
114886
|
-
|
|
114887
|
-
|
|
114888
|
-
|
|
114889
|
-
|
|
114890
|
-
|
|
114891
|
-
|
|
114892
|
-
|
|
114893
|
-
|
|
114894
|
-
|
|
114895
|
-
|
|
114896
|
-
|
|
114696
|
+
var UNIT_TABLE = {
|
|
114697
|
+
"°C": {
|
|
114698
|
+
dimension: "temperature",
|
|
114699
|
+
factor: 1,
|
|
114700
|
+
offset: 0
|
|
114701
|
+
},
|
|
114702
|
+
"°F": {
|
|
114703
|
+
dimension: "temperature",
|
|
114704
|
+
factor: 5 / 9,
|
|
114705
|
+
offset: -160 / 9
|
|
114706
|
+
},
|
|
114707
|
+
K: {
|
|
114708
|
+
dimension: "temperature",
|
|
114709
|
+
factor: 1,
|
|
114710
|
+
offset: -273.15
|
|
114711
|
+
},
|
|
114712
|
+
hPa: {
|
|
114713
|
+
dimension: "pressure",
|
|
114714
|
+
factor: 1,
|
|
114715
|
+
offset: 0
|
|
114716
|
+
},
|
|
114717
|
+
kPa: {
|
|
114718
|
+
dimension: "pressure",
|
|
114719
|
+
factor: 10,
|
|
114720
|
+
offset: 0
|
|
114721
|
+
},
|
|
114722
|
+
Pa: {
|
|
114723
|
+
dimension: "pressure",
|
|
114724
|
+
factor: .01,
|
|
114725
|
+
offset: 0
|
|
114726
|
+
},
|
|
114727
|
+
mbar: {
|
|
114728
|
+
dimension: "pressure",
|
|
114729
|
+
factor: 1,
|
|
114730
|
+
offset: 0
|
|
114731
|
+
},
|
|
114732
|
+
bar: {
|
|
114733
|
+
dimension: "pressure",
|
|
114734
|
+
factor: 1e3,
|
|
114735
|
+
offset: 0
|
|
114736
|
+
},
|
|
114737
|
+
inHg: {
|
|
114738
|
+
dimension: "pressure",
|
|
114739
|
+
factor: 33.8639,
|
|
114740
|
+
offset: 0
|
|
114741
|
+
},
|
|
114742
|
+
mmHg: {
|
|
114743
|
+
dimension: "pressure",
|
|
114744
|
+
factor: 1.33322,
|
|
114745
|
+
offset: 0
|
|
114746
|
+
},
|
|
114747
|
+
psi: {
|
|
114748
|
+
dimension: "pressure",
|
|
114749
|
+
factor: 68.9476,
|
|
114750
|
+
offset: 0
|
|
114751
|
+
},
|
|
114752
|
+
"m/s": {
|
|
114753
|
+
dimension: "speed",
|
|
114754
|
+
factor: 1,
|
|
114755
|
+
offset: 0
|
|
114756
|
+
},
|
|
114757
|
+
"km/h": {
|
|
114758
|
+
dimension: "speed",
|
|
114759
|
+
factor: 1 / 3.6,
|
|
114760
|
+
offset: 0
|
|
114761
|
+
},
|
|
114762
|
+
mph: {
|
|
114763
|
+
dimension: "speed",
|
|
114764
|
+
factor: .44704,
|
|
114765
|
+
offset: 0
|
|
114766
|
+
},
|
|
114767
|
+
kn: {
|
|
114768
|
+
dimension: "speed",
|
|
114769
|
+
factor: .514444,
|
|
114770
|
+
offset: 0
|
|
114771
|
+
},
|
|
114772
|
+
"mm/h": {
|
|
114773
|
+
dimension: "precipitation-rate",
|
|
114774
|
+
factor: 1,
|
|
114775
|
+
offset: 0
|
|
114776
|
+
},
|
|
114777
|
+
"in/h": {
|
|
114778
|
+
dimension: "precipitation-rate",
|
|
114779
|
+
factor: 25.4,
|
|
114780
|
+
offset: 0
|
|
114781
|
+
},
|
|
114782
|
+
m: {
|
|
114783
|
+
dimension: "length",
|
|
114784
|
+
factor: 1,
|
|
114785
|
+
offset: 0
|
|
114786
|
+
},
|
|
114787
|
+
mm: {
|
|
114788
|
+
dimension: "length",
|
|
114789
|
+
factor: .001,
|
|
114790
|
+
offset: 0
|
|
114791
|
+
},
|
|
114792
|
+
cm: {
|
|
114793
|
+
dimension: "length",
|
|
114794
|
+
factor: .01,
|
|
114795
|
+
offset: 0
|
|
114796
|
+
},
|
|
114797
|
+
km: {
|
|
114798
|
+
dimension: "length",
|
|
114799
|
+
factor: 1e3,
|
|
114800
|
+
offset: 0
|
|
114801
|
+
},
|
|
114802
|
+
in: {
|
|
114803
|
+
dimension: "length",
|
|
114804
|
+
factor: .0254,
|
|
114805
|
+
offset: 0
|
|
114806
|
+
},
|
|
114807
|
+
ft: {
|
|
114808
|
+
dimension: "length",
|
|
114809
|
+
factor: .3048,
|
|
114810
|
+
offset: 0
|
|
114811
|
+
},
|
|
114812
|
+
mi: {
|
|
114813
|
+
dimension: "length",
|
|
114814
|
+
factor: 1609.344,
|
|
114815
|
+
offset: 0
|
|
114816
|
+
},
|
|
114817
|
+
"m²": {
|
|
114818
|
+
dimension: "area",
|
|
114819
|
+
factor: 1,
|
|
114820
|
+
offset: 0
|
|
114821
|
+
},
|
|
114822
|
+
lx: {
|
|
114823
|
+
dimension: "illuminance",
|
|
114824
|
+
factor: 1,
|
|
114825
|
+
offset: 0
|
|
114826
|
+
},
|
|
114827
|
+
"W/m²": {
|
|
114828
|
+
dimension: "irradiance",
|
|
114829
|
+
factor: 1,
|
|
114830
|
+
offset: 0
|
|
114831
|
+
},
|
|
114832
|
+
W: {
|
|
114833
|
+
dimension: "power",
|
|
114834
|
+
factor: 1,
|
|
114835
|
+
offset: 0
|
|
114836
|
+
},
|
|
114837
|
+
kW: {
|
|
114838
|
+
dimension: "power",
|
|
114839
|
+
factor: 1e3,
|
|
114840
|
+
offset: 0
|
|
114841
|
+
},
|
|
114842
|
+
VA: {
|
|
114843
|
+
dimension: "apparent-power",
|
|
114844
|
+
factor: 1,
|
|
114845
|
+
offset: 0
|
|
114846
|
+
},
|
|
114847
|
+
Wh: {
|
|
114848
|
+
dimension: "energy",
|
|
114849
|
+
factor: 1,
|
|
114850
|
+
offset: 0
|
|
114851
|
+
},
|
|
114852
|
+
kWh: {
|
|
114853
|
+
dimension: "energy",
|
|
114854
|
+
factor: 1e3,
|
|
114855
|
+
offset: 0
|
|
114856
|
+
},
|
|
114857
|
+
MWh: {
|
|
114858
|
+
dimension: "energy",
|
|
114859
|
+
factor: 1e6,
|
|
114860
|
+
offset: 0
|
|
114861
|
+
},
|
|
114862
|
+
V: {
|
|
114863
|
+
dimension: "voltage",
|
|
114864
|
+
factor: 1,
|
|
114865
|
+
offset: 0
|
|
114866
|
+
},
|
|
114867
|
+
mV: {
|
|
114868
|
+
dimension: "voltage",
|
|
114869
|
+
factor: .001,
|
|
114870
|
+
offset: 0
|
|
114871
|
+
},
|
|
114872
|
+
A: {
|
|
114873
|
+
dimension: "current",
|
|
114874
|
+
factor: 1,
|
|
114875
|
+
offset: 0
|
|
114876
|
+
},
|
|
114877
|
+
mA: {
|
|
114878
|
+
dimension: "current",
|
|
114879
|
+
factor: .001,
|
|
114880
|
+
offset: 0
|
|
114881
|
+
},
|
|
114882
|
+
ppm: {
|
|
114883
|
+
dimension: "concentration-volume",
|
|
114884
|
+
factor: 1,
|
|
114885
|
+
offset: 0
|
|
114886
|
+
},
|
|
114887
|
+
ppb: {
|
|
114888
|
+
dimension: "concentration-volume",
|
|
114889
|
+
factor: .001,
|
|
114890
|
+
offset: 0
|
|
114891
|
+
},
|
|
114892
|
+
"µg/m³": {
|
|
114893
|
+
dimension: "concentration-mass",
|
|
114894
|
+
factor: 1,
|
|
114895
|
+
offset: 0
|
|
114896
|
+
},
|
|
114897
|
+
"mg/m³": {
|
|
114898
|
+
dimension: "concentration-mass",
|
|
114899
|
+
factor: 1e3,
|
|
114900
|
+
offset: 0
|
|
114901
|
+
},
|
|
114902
|
+
kg: {
|
|
114903
|
+
dimension: "mass",
|
|
114904
|
+
factor: 1,
|
|
114905
|
+
offset: 0
|
|
114906
|
+
},
|
|
114907
|
+
g: {
|
|
114908
|
+
dimension: "mass",
|
|
114909
|
+
factor: .001,
|
|
114910
|
+
offset: 0
|
|
114911
|
+
},
|
|
114912
|
+
lb: {
|
|
114913
|
+
dimension: "mass",
|
|
114914
|
+
factor: .453592,
|
|
114915
|
+
offset: 0
|
|
114916
|
+
},
|
|
114917
|
+
oz: {
|
|
114918
|
+
dimension: "mass",
|
|
114919
|
+
factor: .0283495,
|
|
114920
|
+
offset: 0
|
|
114921
|
+
},
|
|
114922
|
+
"%": {
|
|
114923
|
+
dimension: "percentage",
|
|
114924
|
+
factor: 1,
|
|
114925
|
+
offset: 0
|
|
114926
|
+
},
|
|
114927
|
+
L: {
|
|
114928
|
+
dimension: "volume",
|
|
114929
|
+
factor: 1,
|
|
114930
|
+
offset: 0
|
|
114931
|
+
},
|
|
114932
|
+
mL: {
|
|
114933
|
+
dimension: "volume",
|
|
114934
|
+
factor: .001,
|
|
114935
|
+
offset: 0
|
|
114936
|
+
},
|
|
114937
|
+
gal: {
|
|
114938
|
+
dimension: "volume",
|
|
114939
|
+
factor: 3.785411784,
|
|
114940
|
+
offset: 0
|
|
114941
|
+
},
|
|
114942
|
+
s: {
|
|
114943
|
+
dimension: "duration",
|
|
114944
|
+
factor: 1,
|
|
114945
|
+
offset: 0
|
|
114946
|
+
},
|
|
114947
|
+
ms: {
|
|
114948
|
+
dimension: "duration",
|
|
114949
|
+
factor: .001,
|
|
114950
|
+
offset: 0
|
|
114951
|
+
},
|
|
114952
|
+
min: {
|
|
114953
|
+
dimension: "duration",
|
|
114954
|
+
factor: 60,
|
|
114955
|
+
offset: 0
|
|
114956
|
+
},
|
|
114957
|
+
h: {
|
|
114958
|
+
dimension: "duration",
|
|
114959
|
+
factor: 3600,
|
|
114960
|
+
offset: 0
|
|
114961
|
+
},
|
|
114962
|
+
d: {
|
|
114963
|
+
dimension: "duration",
|
|
114964
|
+
factor: 86400,
|
|
114965
|
+
offset: 0
|
|
114966
|
+
},
|
|
114967
|
+
B: {
|
|
114968
|
+
dimension: "information",
|
|
114969
|
+
factor: 1,
|
|
114970
|
+
offset: 0
|
|
114971
|
+
},
|
|
114972
|
+
KiB: {
|
|
114973
|
+
dimension: "information",
|
|
114974
|
+
factor: 1024,
|
|
114975
|
+
offset: 0
|
|
114976
|
+
},
|
|
114977
|
+
MiB: {
|
|
114978
|
+
dimension: "information",
|
|
114979
|
+
factor: 1024 ** 2,
|
|
114980
|
+
offset: 0
|
|
114981
|
+
},
|
|
114982
|
+
GiB: {
|
|
114983
|
+
dimension: "information",
|
|
114984
|
+
factor: 1024 ** 3,
|
|
114985
|
+
offset: 0
|
|
114986
|
+
},
|
|
114987
|
+
TiB: {
|
|
114988
|
+
dimension: "information",
|
|
114989
|
+
factor: 1024 ** 4,
|
|
114990
|
+
offset: 0
|
|
114991
|
+
},
|
|
114992
|
+
kB: {
|
|
114993
|
+
dimension: "information",
|
|
114994
|
+
factor: 1e3,
|
|
114995
|
+
offset: 0
|
|
114996
|
+
},
|
|
114997
|
+
MB: {
|
|
114998
|
+
dimension: "information",
|
|
114999
|
+
factor: 1e6,
|
|
115000
|
+
offset: 0
|
|
115001
|
+
},
|
|
115002
|
+
GB: {
|
|
115003
|
+
dimension: "information",
|
|
115004
|
+
factor: 1e9,
|
|
115005
|
+
offset: 0
|
|
115006
|
+
},
|
|
115007
|
+
"°": {
|
|
115008
|
+
dimension: "angle",
|
|
115009
|
+
factor: 1,
|
|
115010
|
+
offset: 0
|
|
115011
|
+
},
|
|
115012
|
+
dBFS: {
|
|
115013
|
+
dimension: "sound-level",
|
|
115014
|
+
factor: 1,
|
|
115015
|
+
offset: 0
|
|
115016
|
+
},
|
|
115017
|
+
dBm: {
|
|
115018
|
+
dimension: "signal-level",
|
|
115019
|
+
factor: 1,
|
|
115020
|
+
offset: 0
|
|
115021
|
+
},
|
|
115022
|
+
mired: {
|
|
115023
|
+
dimension: "colour-temperature",
|
|
115024
|
+
factor: 1,
|
|
115025
|
+
offset: 0
|
|
115026
|
+
},
|
|
115027
|
+
kbps: {
|
|
115028
|
+
dimension: "bitrate",
|
|
115029
|
+
factor: 1,
|
|
115030
|
+
offset: 0
|
|
115031
|
+
},
|
|
115032
|
+
Mbps: {
|
|
115033
|
+
dimension: "bitrate",
|
|
115034
|
+
factor: 1e3,
|
|
115035
|
+
offset: 0
|
|
115036
|
+
},
|
|
115037
|
+
fps: {
|
|
115038
|
+
dimension: "rate",
|
|
115039
|
+
factor: 1,
|
|
115040
|
+
offset: 0
|
|
115041
|
+
}
|
|
115042
|
+
};
|
|
115043
|
+
/** Resolve a unit's `UnitSpec`, or `undefined` when the spelling is unknown. */
|
|
115044
|
+
function specFor(unit) {
|
|
115045
|
+
return Object.hasOwn(UNIT_TABLE, unit) ? UNIT_TABLE[unit] : void 0;
|
|
115046
|
+
}
|
|
115047
|
+
/** Value in `spec`'s unit → its dimension's canonical unit. */
|
|
115048
|
+
function toCanonical(value, spec) {
|
|
115049
|
+
return value * spec.factor + spec.offset;
|
|
115050
|
+
}
|
|
115051
|
+
/** Canonical-unit value → the unit described by `spec`. */
|
|
115052
|
+
function fromCanonical(canonical, spec) {
|
|
115053
|
+
return (canonical - spec.offset) / spec.factor;
|
|
115054
|
+
}
|
|
114897
115055
|
/**
|
|
114898
|
-
*
|
|
114899
|
-
*
|
|
114900
|
-
*
|
|
114901
|
-
|
|
115056
|
+
* Graceful variant for the render path: returns the converted value, or
|
|
115057
|
+
* `undefined` when the conversion is refused (unknown unit / cross-dimension).
|
|
115058
|
+
* Never throws — a render caller falls back to the raw value + source unit.
|
|
115059
|
+
*/
|
|
115060
|
+
function tryConvertUnit(value, from, to) {
|
|
115061
|
+
if (from === to) return value;
|
|
115062
|
+
const fromSpec = specFor(from);
|
|
115063
|
+
if (!fromSpec) return void 0;
|
|
115064
|
+
const toSpec = specFor(to);
|
|
115065
|
+
if (!toSpec) return void 0;
|
|
115066
|
+
if (fromSpec.dimension !== toSpec.dimension) return void 0;
|
|
115067
|
+
return fromCanonical(toCanonical(value, fromSpec), toSpec);
|
|
115068
|
+
}
|
|
115069
|
+
//#endregion
|
|
115070
|
+
//#region ../types/dist/index.mjs
|
|
115071
|
+
/**
|
|
115072
|
+
* The `smtp-inbound` broker kind (D999): a mailbox a device can send mail to.
|
|
114902
115073
|
*
|
|
114903
|
-
*
|
|
114904
|
-
*
|
|
115074
|
+
* The `broker` cap carries these as `Record<string, unknown>` on the wire; the
|
|
115075
|
+
* provider and its consumers parse them with the schemas below at BOTH ends, so
|
|
115076
|
+
* the shape is declared once.
|
|
114905
115077
|
*/
|
|
114906
|
-
|
|
114907
|
-
|
|
114908
|
-
|
|
114909
|
-
|
|
114910
|
-
|
|
114911
|
-
|
|
114912
|
-
|
|
114913
|
-
|
|
114914
|
-
|
|
114915
|
-
|
|
114916
|
-
|
|
114917
|
-
|
|
114918
|
-
|
|
114919
|
-
|
|
114920
|
-
|
|
114921
|
-
|
|
114922
|
-
|
|
114923
|
-
|
|
114924
|
-
|
|
114925
|
-
|
|
114926
|
-
|
|
115078
|
+
/** The broker kind tag. */
|
|
115079
|
+
var SMTP_INBOUND_KIND = "smtp-inbound";
|
|
115080
|
+
/** The id the first mailbox is minted under (adopt-id), so a consumer can find it again. */
|
|
115081
|
+
var SMTP_INBOUND_DEFAULT_ID = "smtp-inbound-default";
|
|
115082
|
+
var SMTP_INBOUND_DEFAULT_PORT = 2525;
|
|
115083
|
+
var SMTP_INBOUND_DEFAULT_DOMAIN = "camstack.local";
|
|
115084
|
+
var SMTP_INBOUND_DEFAULT_MAX_MESSAGE_BYTES = 25 * 1024 * 1024;
|
|
115085
|
+
/** The text excerpt a message carries on the bus. */
|
|
115086
|
+
var SMTP_INBOUND_TEXT_MAX_CHARS = 4096;
|
|
115087
|
+
var PortSchema = number().int().min(1).max(65535);
|
|
115088
|
+
/** A recipient local-part: what stands before the `@`. */
|
|
115089
|
+
var SmtpRecipientSchema = string().min(1).max(64).regex(/^[A-Za-z0-9._+-]+$/);
|
|
115090
|
+
object({
|
|
115091
|
+
port: PortSchema.default(SMTP_INBOUND_DEFAULT_PORT),
|
|
115092
|
+
bindHost: string().min(1).default("0.0.0.0"),
|
|
115093
|
+
domain: string().min(1).default(SMTP_INBOUND_DEFAULT_DOMAIN),
|
|
115094
|
+
requireAuth: boolean().default(true),
|
|
115095
|
+
username: string().default(""),
|
|
115096
|
+
password: string().default("").meta({ secret: true }),
|
|
115097
|
+
starttls: boolean().default(false),
|
|
115098
|
+
maxMessageBytes: number().int().positive().default(SMTP_INBOUND_DEFAULT_MAX_MESSAGE_BYTES)
|
|
114927
115099
|
});
|
|
114928
115100
|
/**
|
|
114929
|
-
*
|
|
114930
|
-
* `
|
|
114931
|
-
*
|
|
114932
|
-
* the adapter maps this ordinal onto its native level. `level?` is an
|
|
114933
|
-
* optional kind-native level id (`emergency`, `silent`, …) that overrides
|
|
114934
|
-
* `priority` for that one target.
|
|
115101
|
+
* What `getBrokerConfig` answers: what a device needs to send mail here.
|
|
115102
|
+
* `host` is null when the `internal` role of the network palette is not set;
|
|
115103
|
+
* `hostReason` then says where to set it.
|
|
114935
115104
|
*/
|
|
114936
|
-
var
|
|
114937
|
-
|
|
114938
|
-
|
|
114939
|
-
|
|
114940
|
-
|
|
114941
|
-
|
|
114942
|
-
|
|
114943
|
-
|
|
114944
|
-
|
|
114945
|
-
|
|
114946
|
-
|
|
114947
|
-
|
|
114948
|
-
deviceId: number().optional(),
|
|
114949
|
-
eventId: string().optional(),
|
|
114950
|
-
metadata: record(string(), unknown()).optional(),
|
|
115105
|
+
var SmtpInboundConfigSchema = object({
|
|
115106
|
+
host: string().min(1).nullable(),
|
|
115107
|
+
hostReason: string().nullable(),
|
|
115108
|
+
port: PortSchema,
|
|
115109
|
+
domain: string().min(1),
|
|
115110
|
+
requireAuth: boolean(),
|
|
115111
|
+
username: string(),
|
|
115112
|
+
password: string(),
|
|
115113
|
+
starttls: boolean()
|
|
115114
|
+
});
|
|
115115
|
+
object({
|
|
115116
|
+
recipients: array(SmtpRecipientSchema).min(1),
|
|
114951
115117
|
/**
|
|
114952
|
-
*
|
|
114953
|
-
*
|
|
114954
|
-
*
|
|
115118
|
+
* Who is subscribing. A second `subscribe` with the same id REPLACES that subscriber's
|
|
115119
|
+
* recipients (the way a consumer that restarted, or lost a device, declares its set again);
|
|
115120
|
+
* a recipient held by another subscriber is refused with `smtp-inbound/recipient-claimed`.
|
|
115121
|
+
* Absent, the subscriber is anonymous and unique.
|
|
114955
115122
|
*/
|
|
114956
|
-
|
|
115123
|
+
subscriberId: string().min(1).max(64).optional()
|
|
114957
115124
|
});
|
|
114958
|
-
|
|
114959
|
-
|
|
114960
|
-
|
|
114961
|
-
|
|
114962
|
-
|
|
114963
|
-
|
|
114964
|
-
|
|
114965
|
-
|
|
114966
|
-
|
|
114967
|
-
|
|
114968
|
-
|
|
114969
|
-
|
|
114970
|
-
|
|
114971
|
-
|
|
115125
|
+
var SmtpInboundAttachmentSchema = object({
|
|
115126
|
+
filename: string(),
|
|
115127
|
+
contentType: string(),
|
|
115128
|
+
bytes: number().int().nonnegative()
|
|
115129
|
+
});
|
|
115130
|
+
/** The payload of one `broker.message` (the key is the recipient local-part). */
|
|
115131
|
+
var SmtpInboundMessageSchema = object({
|
|
115132
|
+
/** Monotonic per mailbox; a gap tells a consumer it missed an event. */
|
|
115133
|
+
seq: number().int().positive(),
|
|
115134
|
+
messageId: string(),
|
|
115135
|
+
receivedAt: number().int().nonnegative(),
|
|
115136
|
+
from: string(),
|
|
115137
|
+
to: string(),
|
|
115138
|
+
subject: string(),
|
|
115139
|
+
text: string().max(SMTP_INBOUND_TEXT_MAX_CHARS),
|
|
115140
|
+
attachments: array(SmtpInboundAttachmentSchema)
|
|
115141
|
+
});
|
|
115142
|
+
/** What `getState('since:<seq>')` answers: every retained message after `seq`. */
|
|
115143
|
+
var SmtpInboundSinceSchema = object({
|
|
115144
|
+
/** The newest seq issued so far (0 before any mail). */
|
|
115145
|
+
lastSeq: number().int().nonnegative(),
|
|
115146
|
+
/** The oldest seq still retained; messages below it are gone. */
|
|
115147
|
+
oldestSeq: number().int().nonnegative(),
|
|
115148
|
+
messages: array(object({
|
|
115149
|
+
key: string(),
|
|
115150
|
+
message: SmtpInboundMessageSchema
|
|
115151
|
+
}))
|
|
115152
|
+
});
|
|
115153
|
+
/** The key a consumer passes to `getState` to replay the ring, and its parser. */
|
|
115154
|
+
function smtpSinceKey(seq) {
|
|
115155
|
+
return `since:${seq}`;
|
|
115156
|
+
}
|
|
115157
|
+
new Set([
|
|
115158
|
+
"track",
|
|
115159
|
+
"face",
|
|
115160
|
+
"identity",
|
|
115161
|
+
"plate",
|
|
115162
|
+
"vehicle",
|
|
115163
|
+
"scene",
|
|
115164
|
+
"motion",
|
|
115165
|
+
"object",
|
|
115166
|
+
"audio",
|
|
115167
|
+
"mosaic"
|
|
115168
|
+
]);
|
|
115169
|
+
/**
|
|
115170
|
+
* The owner types that are event tables, in the order the event-media resolver
|
|
115171
|
+
* should consider them. Exported so a consumer asking "is this key an event?"
|
|
115172
|
+
* does not re-spell the list and drift from it.
|
|
115173
|
+
*/
|
|
115174
|
+
var EVENT_OWNER_TYPES = [
|
|
115175
|
+
"motion",
|
|
115176
|
+
"object",
|
|
115177
|
+
"audio"
|
|
115178
|
+
];
|
|
115179
|
+
/**
|
|
115180
|
+
* The same list as a Zod enum, for the cap inputs that must NAME the table
|
|
115181
|
+
* (D482: `getEventMedia` / `listEventMedia` take an owner, and an owner is
|
|
115182
|
+
* `(table, id)`).
|
|
115183
|
+
*
|
|
115184
|
+
* Built FROM {@link EVENT_OWNER_TYPES} rather than re-spelled: a fourth event
|
|
115185
|
+
* table would otherwise be accepted by the codec and refused at the door, with
|
|
115186
|
+
* nothing failing until a caller asked.
|
|
115187
|
+
*/
|
|
115188
|
+
var EventOwnerTypeSchema = _enum(EVENT_OWNER_TYPES);
|
|
115189
|
+
/** The same list as a Zod enum, for the cap input that carries it. */
|
|
115190
|
+
var MediaPresenceOwnerKindSchema = _enum([...EVENT_OWNER_TYPES, "track"]);
|
|
115191
|
+
new Set(EVENT_OWNER_TYPES);
|
|
115192
|
+
/**
|
|
115193
|
+
* What a published package needs from the rest of the install (D989).
|
|
115194
|
+
*
|
|
115195
|
+
* One published framework package (`@camstack/server`) carries the kernel, the
|
|
115196
|
+
* builtins and the capability contracts, so "which addon runs on which
|
|
115197
|
+
* framework" is a question of version, and the answer is DECLARED by the
|
|
115198
|
+
* package that knows it:
|
|
115199
|
+
*
|
|
115200
|
+
* - an addon says the oldest server it runs on (`requires.server: ">=X"`);
|
|
115201
|
+
* - the server says the oldest addon it works with
|
|
115202
|
+
* (`requires.addons: { "@camstack/addon-x": ">=Y" }`) and the oldest shell
|
|
115203
|
+
* around it (`requires.wrapper: { desktop, image }`);
|
|
115204
|
+
* - a wrapper (the desktop app, the container starter) says which server
|
|
115205
|
+
* range it can host, and reports its own kind and version.
|
|
115206
|
+
*
|
|
115207
|
+
* The publish workflow STAMPS these after the version bump
|
|
115208
|
+
* (`scripts/ci/stamp-requires.mjs`); nobody types a number by hand.
|
|
115209
|
+
*
|
|
115210
|
+
* A requirement that cannot be checked is NOT met: a shell that reports no
|
|
115211
|
+
* version counts as below the minimum, and an unreadable running version is
|
|
115212
|
+
* named in the result (a failed read is never a pass).
|
|
115213
|
+
*/
|
|
115214
|
+
/** `>=MAJOR.MINOR.PATCH[-prerelease]` — the only range shape a requirement uses. */
|
|
115215
|
+
var MinVersionSchema = string().regex(/^>=\d+\.\d+\.\d+(-[0-9A-Za-z.-]+)?$/, "a minimum is written \">=X.Y.Z\"");
|
|
115216
|
+
object({
|
|
115217
|
+
/** The oldest `@camstack/server` this package runs on. */
|
|
115218
|
+
server: MinVersionSchema.optional(),
|
|
115219
|
+
/** The oldest installed version of each named addon package. */
|
|
115220
|
+
addons: record(string(), MinVersionSchema).optional(),
|
|
115221
|
+
/** The oldest shell around the server, per shell kind. */
|
|
115222
|
+
wrapper: object({
|
|
115223
|
+
desktop: MinVersionSchema.optional(),
|
|
115224
|
+
image: MinVersionSchema.optional()
|
|
115225
|
+
}).optional()
|
|
115226
|
+
});
|
|
115227
|
+
/** One unmet requirement; each names the versions on both sides. */
|
|
115228
|
+
var UnmetRequirementSchema = discriminatedUnion("kind", [
|
|
115229
|
+
object({
|
|
115230
|
+
kind: literal("server-too-old"),
|
|
115231
|
+
required: string(),
|
|
115232
|
+
/** `null` — the running server version could not be read. */
|
|
115233
|
+
running: string().nullable()
|
|
115234
|
+
}),
|
|
115235
|
+
object({
|
|
115236
|
+
kind: literal("addon-too-old"),
|
|
115237
|
+
packageName: string(),
|
|
115238
|
+
required: string(),
|
|
115239
|
+
/** `null` — the addon is not installed (or its version is unreadable). */
|
|
115240
|
+
running: string().nullable()
|
|
115241
|
+
}),
|
|
115242
|
+
object({
|
|
115243
|
+
kind: literal("wrapper-too-old"),
|
|
115244
|
+
wrapper: _enum(["desktop", "image"]),
|
|
115245
|
+
required: string(),
|
|
115246
|
+
/** `null` — the wrapper reported no version. */
|
|
115247
|
+
running: string().nullable()
|
|
115248
|
+
})
|
|
115249
|
+
]);
|
|
115250
|
+
var RequiredAddonUpdateSchema = object({
|
|
115251
|
+
packageName: string(),
|
|
115252
|
+
/** The minimum the target server declares. */
|
|
115253
|
+
required: string(),
|
|
115254
|
+
/** What this node has; `null` when the addon is not installed. */
|
|
115255
|
+
installed: string().nullable()
|
|
115256
|
+
});
|
|
115257
|
+
/**
|
|
115258
|
+
* Which integration instance a settings form is for. An addon that serves several instances
|
|
115259
|
+
* (`instanceMode: multiple`) can show a different form per instance — an NVR integration
|
|
115260
|
+
* needs its connection, the default integration needs the addon's own sections.
|
|
115261
|
+
*
|
|
115262
|
+
* - `integrationId` is `null` in the create wizard: nothing exists yet, the operator is
|
|
115263
|
+
* setting up a NEW instance.
|
|
115264
|
+
* - `mode` is the wizard mode of the integration type (`getAvailableTypes`).
|
|
115265
|
+
* - `candidateStableId` is the discovery candidate a wizard was seeded from, if any.
|
|
115266
|
+
*/
|
|
115267
|
+
var IntegrationInstanceRefSchema = object({
|
|
115268
|
+
integrationId: string().nullable(),
|
|
115269
|
+
mode: _enum([
|
|
115270
|
+
"standalone",
|
|
115271
|
+
"account",
|
|
115272
|
+
"broker"
|
|
115273
|
+
]),
|
|
115274
|
+
candidateStableId: string().optional()
|
|
115275
|
+
});
|
|
115276
|
+
/**
|
|
115277
|
+
* notification-output — canonical, capability-gated notification delivery.
|
|
115278
|
+
*
|
|
115279
|
+
* Apprise-derived model (see
|
|
115280
|
+
* `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
|
|
115281
|
+
* callers emit ONE canonical `Notification`; each provider declares a
|
|
115282
|
+
* per-kind capability descriptor (`TargetKind`), and the pure degrade
|
|
115283
|
+
* engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
|
|
115284
|
+
* message to what the kind supports — callers never special-case a service.
|
|
115285
|
+
*
|
|
115286
|
+
* DESIGN DECISIONS (locked):
|
|
115287
|
+
* - A target is an INSTANCE of this function cap (epic #440, step 6): the
|
|
115288
|
+
* providers serve their targets as `integration-instances` records, one
|
|
115289
|
+
* record kind per target kind, and the admin lists, adds, edits, switches
|
|
115290
|
+
* and deletes them through that cap. This cap keeps what an instance cannot
|
|
115291
|
+
* say: the kind catalogue (`listTargetKinds`: capabilities, delivery
|
|
115292
|
+
* parameters, brand icon), dispatch (`send`, `testTarget`) and the form
|
|
115293
|
+
* helpers (`discoverTargets`, `probeTargetConfig`).
|
|
115294
|
+
* - `listTargetKinds` / `discoverTargets` return arrays → the generated
|
|
115295
|
+
* cap-mount auto-`concatCollection`-fans them across every registered
|
|
115296
|
+
* provider so one catalog is routable. `send` / `testTarget` /
|
|
115297
|
+
* `probeTargetConfig` route to ONE provider by the `addonId` the generated
|
|
115298
|
+
* collection router extracts from the call input.
|
|
115299
|
+
* - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
|
|
115300
|
+
* transformer) + UDS MsgPack both round-trip typed arrays — already used by
|
|
115301
|
+
* `storage` / `storage-provider` / `recording` caps over the same path. No
|
|
115302
|
+
* base64 fallback needed.
|
|
115303
|
+
*
|
|
115304
|
+
* TODO (deferred, closed-set change — separate decision): add
|
|
115305
|
+
* `providerKind: 'notify'` so notification providers surface on the unified
|
|
115306
|
+
* admin "Integrations" page.
|
|
115307
|
+
*/
|
|
115308
|
+
/**
|
|
115309
|
+
* Zentik-derived typed-media enum — the superset across every kind. Each
|
|
115310
|
+
* adapter picks what it supports and the degrade engine filters the rest.
|
|
115311
|
+
*/
|
|
115312
|
+
var AttachmentMediaTypeSchema = _enum([
|
|
115313
|
+
"image",
|
|
115314
|
+
"video",
|
|
115315
|
+
"gif",
|
|
115316
|
+
"audio",
|
|
115317
|
+
"icon"
|
|
115318
|
+
]);
|
|
115319
|
+
/**
|
|
115320
|
+
* A single attachment. Exactly one of `url` (remote source, most adapters
|
|
115321
|
+
* prefer this) or `bytes` (inline source; required for Pushover-style
|
|
115322
|
+
* bytes-only kinds) MUST be present — the degrade engine expresses a
|
|
115323
|
+
* url→bytes fetch as a `needsFetch` directive the adapter executes.
|
|
115324
|
+
*/
|
|
115325
|
+
var AttachmentSchema = object({
|
|
115326
|
+
mediaType: AttachmentMediaTypeSchema,
|
|
115327
|
+
url: string().optional(),
|
|
115328
|
+
bytes: _instanceof(Uint8Array).optional(),
|
|
115329
|
+
mime: string().optional(),
|
|
115330
|
+
name: string().optional()
|
|
115331
|
+
}).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
|
|
115332
|
+
var NotificationFormatSchema = _enum([
|
|
115333
|
+
"text",
|
|
115334
|
+
"markdown",
|
|
115335
|
+
"html"
|
|
115336
|
+
]);
|
|
115337
|
+
/**
|
|
115338
|
+
* The CLOSED icon vocabulary an action button may use.
|
|
115339
|
+
*
|
|
115340
|
+
* A closed set, not a free string, and that is the whole point: an arbitrary
|
|
115341
|
+
* icon name is one that ntfy renders, zentik silently drops, and nobody
|
|
115342
|
+
* notices — the same class of gap as a zone vocabulary nothing produced
|
|
115343
|
+
* ([D35](../../../docs/decisions/adr-0035.md)). Every adapter maps this set or
|
|
115344
|
+
* declares `actionIcons: false` and the degrade engine strips the field.
|
|
115345
|
+
*
|
|
115346
|
+
* Named by INTENT, never by glyph. "check" would tie the vocabulary to one
|
|
115347
|
+
* renderer's icon set; "acknowledge" survives an adapter that draws it
|
|
115348
|
+
* differently.
|
|
115349
|
+
*
|
|
115350
|
+
* ── A TOKEN IS NOT A WIRE VALUE ─────────────────────────────────────
|
|
115351
|
+
*
|
|
115352
|
+
* These names are for US. **No adapter may forward one verbatim.** Each maps
|
|
115353
|
+
* the whole set onto its own renderer's vocabulary through a
|
|
115354
|
+
* `Record<NotificationActionIcon, string>` — a Record, never a lookup with a
|
|
115355
|
+
* fallback, so adding a member here fails every adapter's build until someone
|
|
115356
|
+
* decides its glyph, which is the only place that decision can be made
|
|
115357
|
+
* honestly.
|
|
115358
|
+
*
|
|
115359
|
+
* This paragraph is the bug. Zentik declared `actionIcons: true` and passed
|
|
115360
|
+
* `disarm` straight through; iOS feeds that string to
|
|
115361
|
+
* `UNNotificationActionIcon(systemImageName:)`, `disarm` is not an SF Symbol,
|
|
115362
|
+
* and every snooze and alarm button arrived BLANK. A pass-through is not a
|
|
115363
|
+
* mapping, and "the field is documented" is not "the value renders".
|
|
115364
|
+
*
|
|
115365
|
+
* Adding a member is TRAIN-BOUND. The enum lives in the published
|
|
115366
|
+
* `@camstack/server` closure and the cap seam validates against the HUB's copy,
|
|
115367
|
+
* so an addon that emits a token the running hub does not know does not lose an
|
|
115368
|
+
* icon — its whole `send` fails Zod validation and the notification never
|
|
115369
|
+
* arrives. Never emit a new token from an addon before the train carrying it.
|
|
115370
|
+
*/
|
|
115371
|
+
var NotificationActionIconSchema = _enum([
|
|
115372
|
+
"acknowledge",
|
|
115373
|
+
"dismiss",
|
|
115374
|
+
"silence",
|
|
115375
|
+
"snooze",
|
|
115376
|
+
"view",
|
|
115377
|
+
"play",
|
|
115378
|
+
"open",
|
|
115379
|
+
"close",
|
|
115380
|
+
"lock",
|
|
115381
|
+
"unlock",
|
|
115382
|
+
"arm",
|
|
115383
|
+
"arm-home",
|
|
115384
|
+
"arm-away",
|
|
115385
|
+
"arm-night",
|
|
115386
|
+
"disarm",
|
|
115387
|
+
"light",
|
|
115388
|
+
"alert",
|
|
115389
|
+
"camera"
|
|
115390
|
+
]);
|
|
115391
|
+
/** A single tap-through action button. */
|
|
115392
|
+
var NotificationActionSchema = object({
|
|
115393
|
+
id: string(),
|
|
115394
|
+
label: string(),
|
|
115395
|
+
url: string().optional(),
|
|
115396
|
+
/** Dropped by the degrade engine for a kind with `caps.actionIcons: false`. */
|
|
115397
|
+
icon: NotificationActionIconSchema.optional(),
|
|
115398
|
+
/**
|
|
115399
|
+
* Renders in a warning style where the notifier supports it.
|
|
115400
|
+
*
|
|
115401
|
+
* A HINT, never a gate. The callback's authority is its token and nothing
|
|
115402
|
+
* else — see `notification-center/action-token.ts` for what that does and
|
|
115403
|
+
* does not buy.
|
|
115404
|
+
*/
|
|
115405
|
+
destructive: boolean().optional(),
|
|
115406
|
+
/**
|
|
115407
|
+
* How the tap should REACH the url.
|
|
115408
|
+
*
|
|
115409
|
+
* `navigate` (absent, and every button authored before this field) opens it:
|
|
115410
|
+
* the phone leaves the notification and shows whatever the callback returns.
|
|
115411
|
+
* That is right for a button whose answer the operator wants to read.
|
|
115412
|
+
*
|
|
115413
|
+
* `background` fires it as a POST and stays put. It exists for the buttons
|
|
115414
|
+
* whose whole point is not to interrupt — "silence this for 30 minutes" is
|
|
115415
|
+
* an answer to the notification, and being thrown into a browser tab to
|
|
115416
|
+
* confirm it costs more attention than the notification did. A backend that
|
|
115417
|
+
* cannot do a background call renders it as an ordinary link (the adapters
|
|
115418
|
+
* fall back rather than dropping the button), so this is a preference, never
|
|
115419
|
+
* a requirement.
|
|
115420
|
+
*/
|
|
115421
|
+
mode: _enum(["navigate", "background"]).optional()
|
|
115422
|
+
});
|
|
115423
|
+
/** A delivery parameter value: what a notifier declared it takes. */
|
|
115424
|
+
var DeliveryParamValueSchema = union([
|
|
115425
|
+
string(),
|
|
115426
|
+
number(),
|
|
115427
|
+
boolean()
|
|
115428
|
+
]);
|
|
115429
|
+
/**
|
|
115430
|
+
* One extra delivery parameter a notifier KIND declares (D938). A rule that
|
|
115431
|
+
* addresses a target of that kind may set it; a kind that declares nothing is
|
|
115432
|
+
* never handed one. The admin UI derives its control from this descriptor —
|
|
115433
|
+
* no editor knows a service by name.
|
|
115434
|
+
*
|
|
115435
|
+
* Optional fields are `.optional()`, never `.default()` (a Zod default does not
|
|
115436
|
+
* run on the addon cap path).
|
|
115437
|
+
*/
|
|
115438
|
+
var DeliveryParamSchema = object({
|
|
115439
|
+
key: string().min(1),
|
|
115440
|
+
label: string(),
|
|
115441
|
+
/** i18n key of the label, resolved by the declaring addon's namespace. */
|
|
115442
|
+
labelKey: string().optional(),
|
|
115443
|
+
type: _enum([
|
|
115444
|
+
"enum",
|
|
115445
|
+
"number",
|
|
115446
|
+
"boolean",
|
|
115447
|
+
"string"
|
|
115448
|
+
]),
|
|
115449
|
+
/** `enum` only: the closed set of accepted values. */
|
|
115450
|
+
options: array(object({
|
|
115451
|
+
value: string(),
|
|
115452
|
+
label: string()
|
|
115453
|
+
})).optional(),
|
|
115454
|
+
/** `number` only. */
|
|
115455
|
+
min: number().optional(),
|
|
115456
|
+
max: number().optional(),
|
|
115457
|
+
/** What the notifier does when the rule sets nothing; shown as the placeholder. */
|
|
115458
|
+
default: DeliveryParamValueSchema.optional()
|
|
115459
|
+
});
|
|
115460
|
+
/**
|
|
115461
|
+
* The canonical notification. `body` is the only hard field (Apprise model).
|
|
115462
|
+
* `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
|
|
115463
|
+
* NOT a fixed severity enum — each kind declares its own `caps.levels` and
|
|
115464
|
+
* the adapter maps this ordinal onto its native level. `level?` is an
|
|
115465
|
+
* optional kind-native level id (`emergency`, `silent`, …) that overrides
|
|
115466
|
+
* `priority` for that one target.
|
|
115467
|
+
*/
|
|
115468
|
+
var NotificationSchema = object({
|
|
115469
|
+
body: string(),
|
|
115470
|
+
title: string().optional(),
|
|
115471
|
+
format: NotificationFormatSchema.default("text"),
|
|
115472
|
+
priority: number().int().min(1).max(5).default(3),
|
|
115473
|
+
level: string().optional(),
|
|
115474
|
+
attachments: array(AttachmentSchema).optional(),
|
|
115475
|
+
clickUrl: string().optional(),
|
|
115476
|
+
actions: array(NotificationActionSchema).optional(),
|
|
115477
|
+
sound: string().optional(),
|
|
115478
|
+
ttl: number().optional(),
|
|
115479
|
+
tag: string().optional(),
|
|
115480
|
+
deviceId: number().optional(),
|
|
115481
|
+
eventId: string().optional(),
|
|
115482
|
+
metadata: record(string(), unknown()).optional(),
|
|
115483
|
+
/**
|
|
115484
|
+
* Values for the parameters the target's kind DECLARES in
|
|
115485
|
+
* {@link TargetKindSchema} `deliveryParams`. Already validated against the
|
|
115486
|
+
* declaration by the sender; a notifier reads only the keys it declared.
|
|
115487
|
+
*/
|
|
115488
|
+
delivery: record(string(), DeliveryParamValueSchema).optional()
|
|
115489
|
+
});
|
|
115490
|
+
/** One declared native severity/priority level for a kind. */
|
|
115491
|
+
var TargetKindLevelSchema = object({
|
|
115492
|
+
id: string(),
|
|
115493
|
+
label: string(),
|
|
115494
|
+
/** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
|
|
115495
|
+
ordinal: number().int().min(1).max(5).nullable(),
|
|
115496
|
+
flags: object({
|
|
115497
|
+
critical: boolean().optional(),
|
|
115498
|
+
silent: boolean().optional(),
|
|
115499
|
+
noPush: boolean().optional()
|
|
115500
|
+
}).optional(),
|
|
115501
|
+
/** e.g. Pushover `emergency` requires `retry` / `expire`. */
|
|
115502
|
+
requires: array(string()).optional(),
|
|
115503
|
+
description: string().optional()
|
|
114972
115504
|
});
|
|
114973
115505
|
/** The full capability block consulted before dispatch. */
|
|
114974
115506
|
var TargetKindCapsSchema = object({
|
|
@@ -115008,7 +115540,7 @@ var TargetKindCapsSchema = object({
|
|
|
115008
115540
|
* the union is large and not meant for runtime validation here; the exported
|
|
115009
115541
|
* `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
|
|
115010
115542
|
*/
|
|
115011
|
-
var ConfigSchemaPassthrough$
|
|
115543
|
+
var ConfigSchemaPassthrough$3 = unknown();
|
|
115012
115544
|
var TargetKindSchema = object({
|
|
115013
115545
|
kind: string(),
|
|
115014
115546
|
label: string(),
|
|
@@ -115045,7 +115577,7 @@ var TargetKindSchema = object({
|
|
|
115045
115577
|
* its raster path, which is the safe default for an unknown image.
|
|
115046
115578
|
*/
|
|
115047
115579
|
iconMediaType: string().optional(),
|
|
115048
|
-
configSchema: ConfigSchemaPassthrough$
|
|
115580
|
+
configSchema: ConfigSchemaPassthrough$3,
|
|
115049
115581
|
/**
|
|
115050
115582
|
* The config keys that decide WHERE this kind's secrets are sent (server,
|
|
115051
115583
|
* base URL, instance, chat, recipient). A save that changes any of them
|
|
@@ -115067,9 +115599,11 @@ var TargetKindSchema = object({
|
|
|
115067
115599
|
caps: TargetKindCapsSchema
|
|
115068
115600
|
});
|
|
115069
115601
|
/**
|
|
115070
|
-
* A
|
|
115071
|
-
*
|
|
115072
|
-
*
|
|
115602
|
+
* A target as a provider's own code sees it (the notification-center bridge, the
|
|
115603
|
+
* send path): the flat record body split into the name, the switch and the
|
|
115604
|
+
* kind's fields. `config` holds secrets; a reader that serves it to a client
|
|
115605
|
+
* REDACTS secret fields (a presence marker only) — never round-trip a stored
|
|
115606
|
+
* secret to the UI.
|
|
115073
115607
|
*/
|
|
115074
115608
|
var TargetSchema = object({
|
|
115075
115609
|
id: string(),
|
|
@@ -115112,13 +115646,13 @@ var ProbeTargetConfigResultSchema = object({
|
|
|
115112
115646
|
stateInstance: string().optional(),
|
|
115113
115647
|
error: string().optional()
|
|
115114
115648
|
});
|
|
115115
|
-
method(object({}), array(TargetKindSchema)), method(object({
|
|
115649
|
+
method(object({}), array(TargetKindSchema)), method(object({
|
|
115116
115650
|
kind: string(),
|
|
115117
115651
|
config: record(string(), unknown()).optional(),
|
|
115118
115652
|
/**
|
|
115119
115653
|
* When editing / duplicating, the blank password field never round-trips
|
|
115120
115654
|
* the stored token. Pass the source target id so the provider can restore
|
|
115121
|
-
* secrets server-side before dialling
|
|
115655
|
+
* secrets server-side before dialling.
|
|
115122
115656
|
*/
|
|
115123
115657
|
targetId: string().optional()
|
|
115124
115658
|
}), array(DiscoveredTargetSchema), { auth: "admin" }), method(object({
|
|
@@ -115141,27 +115675,6 @@ method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSche
|
|
|
115141
115675
|
}), TestResultSchema, {
|
|
115142
115676
|
kind: "mutation",
|
|
115143
115677
|
auth: "admin"
|
|
115144
|
-
}), method(object({
|
|
115145
|
-
target: TargetSchema,
|
|
115146
|
-
/**
|
|
115147
|
-
* Duplicate flow: create a NEW target id while copying secrets from an
|
|
115148
|
-
* existing row. The UI never holds the stored token; blank / redacted
|
|
115149
|
-
* password fields are restored from this source (D634 still applies if
|
|
115150
|
-
* destinations diverge without a re-typed secret).
|
|
115151
|
-
*/
|
|
115152
|
-
cloneSecretsFrom: string().optional()
|
|
115153
|
-
}), TargetSchema, {
|
|
115154
|
-
kind: "mutation",
|
|
115155
|
-
auth: "admin"
|
|
115156
|
-
}), method(object({ targetId: string() }), _void(), {
|
|
115157
|
-
kind: "mutation",
|
|
115158
|
-
auth: "admin"
|
|
115159
|
-
}), method(object({
|
|
115160
|
-
targetId: string(),
|
|
115161
|
-
enabled: boolean()
|
|
115162
|
-
}), _void(), {
|
|
115163
|
-
kind: "mutation",
|
|
115164
|
-
auth: "admin"
|
|
115165
115678
|
});
|
|
115166
115679
|
looseObject({
|
|
115167
115680
|
name: string().min(1),
|
|
@@ -124309,7 +124822,6 @@ var SYSTEM_CAP_VOCABULARY = {
|
|
|
124309
124822
|
"notification-output": system("notification delivery — reached through notifier devices and rules"),
|
|
124310
124823
|
"notification-rules": system("notification rules — authored on their own page"),
|
|
124311
124824
|
"oauth-integration": system(IDENTITY),
|
|
124312
|
-
"oidc-connections": system(IDENTITY),
|
|
124313
124825
|
"osd-manager": system(PIPELINE),
|
|
124314
124826
|
"pipeline-executor": system(PIPELINE),
|
|
124315
124827
|
"pipeline-orchestrator": system(PIPELINE),
|
|
@@ -144116,723 +144628,345 @@ var ICON_SYNONYMS = {
|
|
|
144116
144628
|
"capanno",
|
|
144117
144629
|
"deposito",
|
|
144118
144630
|
"cantina",
|
|
144119
|
-
"warehouse"
|
|
144120
|
-
],
|
|
144121
|
-
"washing-machine": [
|
|
144122
|
-
"lavatrice",
|
|
144123
|
-
"lavastoviglie",
|
|
144124
|
-
"asciugatrice"
|
|
144125
|
-
],
|
|
144126
|
-
waves: [
|
|
144127
|
-
"onde",
|
|
144128
|
-
"acqua",
|
|
144129
|
-
"vibrazione"
|
|
144130
|
-
],
|
|
144131
|
-
"waves-ladder": [
|
|
144132
|
-
"piscina",
|
|
144133
|
-
"vasca",
|
|
144134
|
-
"pool"
|
|
144135
|
-
],
|
|
144136
|
-
wifi: ["rete", "segnale"],
|
|
144137
|
-
"wifi-off": [
|
|
144138
|
-
"wifi",
|
|
144139
|
-
"assente",
|
|
144140
|
-
"offline",
|
|
144141
|
-
"disconnesso"
|
|
144142
|
-
],
|
|
144143
|
-
wind: [
|
|
144144
|
-
"vento",
|
|
144145
|
-
"aria",
|
|
144146
|
-
"gas",
|
|
144147
|
-
"monossido",
|
|
144148
|
-
"co"
|
|
144149
|
-
],
|
|
144150
|
-
workflow: [
|
|
144151
|
-
"automazione",
|
|
144152
|
-
"flusso",
|
|
144153
|
-
"scenario"
|
|
144154
|
-
],
|
|
144155
|
-
wrench: [
|
|
144156
|
-
"officina",
|
|
144157
|
-
"manutenzione",
|
|
144158
|
-
"attrezzi",
|
|
144159
|
-
"utenze"
|
|
144160
|
-
],
|
|
144161
|
-
zap: [
|
|
144162
|
-
"energia",
|
|
144163
|
-
"corrente",
|
|
144164
|
-
"consumo",
|
|
144165
|
-
"watt",
|
|
144166
|
-
"elettricita"
|
|
144167
|
-
]
|
|
144168
|
-
};
|
|
144169
|
-
/**
|
|
144170
|
-
* Spellings an operator may already have PERSISTED that no lucide package
|
|
144171
|
-
* accepts any more, and the catalog key they draw. They resolve
|
|
144172
|
-
* (`canonicalIconKey`) but are never offered. `gauge2` was this repo's own
|
|
144173
|
-
* pre-catalog spelling of `gauge`.
|
|
144174
|
-
*/
|
|
144175
|
-
var LEGACY_ICON_ALIASES = { gauge2: "gauge" };
|
|
144176
|
-
/**
|
|
144177
|
-
* icon-catalog — THE icon vocabulary (D854).
|
|
144178
|
-
*
|
|
144179
|
-
* Every place that picks or stores an icon — a device's display override, a
|
|
144180
|
-
* location, a site zone, a viewer accessory, an `icon` settings field — names
|
|
144181
|
-
* it by a key of this catalog and nothing else. There is no curated subset and
|
|
144182
|
-
* no second list: the catalog is every lucide icon that both surfaces can draw
|
|
144183
|
-
* (the admin UI's `lucide-react` and the viewer's `lucide-react-native`), the
|
|
144184
|
-
* intersection computed by `scripts/generate-icon-catalog.ts` into the
|
|
144185
|
-
* committed `icon-catalog.generated.ts`.
|
|
144186
|
-
*
|
|
144187
|
-
* Like the vocabularies it replaces, this module holds STRINGS only — no React,
|
|
144188
|
-
* no lucide import, no glyph. Each surface owns its glyph table (the web one
|
|
144189
|
-
* lives in `ui-library`, loaded lazily), and a test on each side pins that it
|
|
144190
|
-
* covers {@link ICON_KEYS}.
|
|
144191
|
-
*
|
|
144192
|
-
* ## What is persisted
|
|
144193
|
-
*
|
|
144194
|
-
* The canonical kebab-case lucide id ({@link IconKey}). Spellings that a lucide
|
|
144195
|
-
* package still accepts (`home` for `house`) and this repo's own legacy ones
|
|
144196
|
-
* (`gauge2`) RESOLVE ({@link canonicalIconKey}) so a stored value never goes
|
|
144197
|
-
* stale, but they are never OFFERED by search.
|
|
144198
|
-
*
|
|
144199
|
-
* ## Search
|
|
144200
|
-
*
|
|
144201
|
-
* Over the key, the Italian/English overlay in `icon-synonyms.ts`, any words
|
|
144202
|
-
* the caller adds, and lucide's English tags — in that order of weight.
|
|
144203
|
-
*/
|
|
144204
|
-
var KEY_SET$2 = new Set(ICON_KEYS);
|
|
144205
|
-
new Map([...Object.entries(ICON_ALIASES), ...Object.entries(LEGACY_ICON_ALIASES)]);
|
|
144206
|
-
/** Is this a canonical key of the catalog? (An alias is not — see {@link canonicalIconKey}.) */
|
|
144207
|
-
function isIconKey(value) {
|
|
144208
|
-
return typeof value === "string" && KEY_SET$2.has(value);
|
|
144209
|
-
}
|
|
144210
|
-
/**
|
|
144211
|
-
* Wire/storage schema for one icon key.
|
|
144212
|
-
*
|
|
144213
|
-
* Deliberately NOT a `z.enum` of the catalog: ~1,700 literals would be inlined
|
|
144214
|
-
* into every cap router, type and API-reference row that carries an icon. The
|
|
144215
|
-
* check is membership in the catalog and the type is {@link IconKey}.
|
|
144216
|
-
*/
|
|
144217
|
-
var IconKeySchema = custom(isIconKey, "Not an icon of the catalog");
|
|
144218
|
-
var ENTRIES = ICON_KEYS.map((key, index) => {
|
|
144219
|
-
const [categoryIndexes, tags] = ICON_META[index] ?? [[], []];
|
|
144220
|
-
const categories = categoryIndexes.flatMap((i) => {
|
|
144221
|
-
const id = ICON_CATEGORY_IDS[i];
|
|
144222
|
-
return id === void 0 ? [] : [id];
|
|
144223
|
-
});
|
|
144224
|
-
return {
|
|
144225
|
-
key,
|
|
144226
|
-
categories,
|
|
144227
|
-
primaryCategory: categories[0] ?? ICON_CATEGORY_IDS[0],
|
|
144228
|
-
tags,
|
|
144229
|
-
synonyms: ICON_SYNONYMS[key] ?? []
|
|
144230
|
-
};
|
|
144231
|
-
});
|
|
144232
|
-
new Map(ENTRIES.map((e) => [e.key, e]));
|
|
144233
|
-
/** Categories a picker offers first: the ones this product's icons mostly live in. */
|
|
144234
|
-
var LEADING_CATEGORIES = [
|
|
144235
|
-
"devices",
|
|
144236
|
-
"home",
|
|
144237
|
-
"security",
|
|
144238
|
-
"buildings",
|
|
144239
|
-
"connectivity",
|
|
144240
|
-
"multimedia",
|
|
144241
|
-
"nature",
|
|
144242
|
-
"weather",
|
|
144243
|
-
"transportation",
|
|
144244
|
-
"animals"
|
|
144245
|
-
];
|
|
144246
|
-
var PRIMARY_CATEGORIES = new Set(ENTRIES.map((e) => e.primaryCategory));
|
|
144247
|
-
[...LEADING_CATEGORIES, ...ICON_CATEGORY_IDS.filter((c) => !LEADING_CATEGORIES.includes(c))].filter((c) => PRIMARY_CATEGORIES.has(c));
|
|
144248
|
-
/**
|
|
144249
|
-
* One (location, icon) assignment as it travels.
|
|
144250
|
-
*
|
|
144251
|
-
* `locationKey` is ALWAYS {@link locationIconKey} of the label — never the
|
|
144252
|
-
* operator's casing. The registry matches labels trimmed + case-insensitively
|
|
144253
|
-
* everywhere (`addLocation`, `removeLocation`, `renameLocation`), and a
|
|
144254
|
-
* case-only rename (`kitchen` → `Kitchen`) is a real edit this repo supports; a
|
|
144255
|
-
* map keyed on the displayed casing would orphan its entry on exactly that
|
|
144256
|
-
* edit. Consumers join by keying their own label through `locationIconKey`.
|
|
144257
|
-
*/
|
|
144258
|
-
var LocationIconAssignmentSchema = object({
|
|
144259
|
-
locationKey: string(),
|
|
144260
|
-
icon: IconKeySchema
|
|
144261
|
-
});
|
|
144262
|
-
/**
|
|
144263
|
-
* One (location, description) assignment as it travels.
|
|
144264
|
-
*
|
|
144265
|
-
* Same key discipline as {@link LocationIconAssignmentSchema}, and for the same
|
|
144266
|
-
* reason: this lived for a while in the post-analysis addon's own settings,
|
|
144267
|
-
* keyed by a HAND-TYPED label matched exactly and case-sensitively. A rename in
|
|
144268
|
-
* the Locations page carried the icon and silently orphaned the description —
|
|
144269
|
-
* two authorities for one thing, joined by two different rules. Now both hang
|
|
144270
|
-
* off the location itself, on `locationIconKey`.
|
|
144271
|
-
*/
|
|
144272
|
-
var LocationDescriptionAssignmentSchema = object({
|
|
144273
|
-
locationKey: string(),
|
|
144274
|
-
description: string()
|
|
144275
|
-
});
|
|
144276
|
-
/**
|
|
144277
|
-
* WHO an action step acts on (D983) — one target shape for every place that
|
|
144278
|
-
* performs an action (automation steps, Action entries, notification
|
|
144279
|
-
* sequences, scheduler points):
|
|
144280
|
-
*
|
|
144281
|
-
* - `devices` — device ids the operator picked, frozen at save time;
|
|
144282
|
-
* - `domain` — every device that offers the step's VOCABULARY action,
|
|
144283
|
-
* optionally narrowed to one device type and one room, resolved WHEN THE
|
|
144284
|
-
* STEP RUNS (a device added later is included). The action always comes
|
|
144285
|
-
* from the vocabulary (`cover.open`), never from a raw cap name, so a
|
|
144286
|
-
* `domain` target needs an `actionId` (enforced on the step schema);
|
|
144287
|
-
* - `var` — a `$var` resolved from the run's scope.
|
|
144288
|
-
*
|
|
144289
|
-
* {@link ActionTargetResolver} turns a target into device ids. It is pure
|
|
144290
|
-
* (a {@link DeviceDirectory} is handed in) so the hub's core-blocks service and
|
|
144291
|
-
* a generated automation block share it.
|
|
144292
|
-
*
|
|
144293
|
-
* A room is the device's `location` label (`DeviceInfo.location`); two labels
|
|
144294
|
-
* name the same room when `locationIconKey` agrees (trimmed, lower-cased).
|
|
144295
|
-
*/
|
|
144296
|
-
var ActionTargetSchema = discriminatedUnion("kind", [
|
|
144297
|
-
object({
|
|
144298
|
-
kind: literal("devices"),
|
|
144299
|
-
ids: array(number().int()).min(1)
|
|
144300
|
-
}),
|
|
144301
|
-
object({
|
|
144302
|
-
kind: literal("domain"),
|
|
144303
|
-
/** Narrow to one kind of device. */
|
|
144304
|
-
deviceType: _enum(DeviceType).optional(),
|
|
144305
|
-
/** Narrow to one room: the `location` label devices carry. */
|
|
144306
|
-
roomId: string().min(1).optional()
|
|
144307
|
-
}),
|
|
144308
|
-
object({
|
|
144309
|
-
kind: literal("var"),
|
|
144310
|
-
name: string().min(1)
|
|
144311
|
-
})
|
|
144312
|
-
]);
|
|
144313
|
-
EventCategory.DeviceRegistered, EventCategory.DeviceUnregistered, EventCategory.DeviceUpdated, EventCategory.DeviceMetaChanged, EventCategory.DeviceBindingsChanged;
|
|
144314
|
-
var ExpressionBindingSourceSchema = union([
|
|
144315
|
-
object({
|
|
144316
|
-
kind: literal("field").optional(),
|
|
144317
|
-
sourceKey: string(),
|
|
144318
|
-
cap: string(),
|
|
144319
|
-
fieldPath: string()
|
|
144320
|
-
}),
|
|
144321
|
-
object({
|
|
144322
|
-
kind: literal("literal"),
|
|
144323
|
-
value: union([
|
|
144324
|
-
string(),
|
|
144325
|
-
number(),
|
|
144326
|
-
boolean(),
|
|
144327
|
-
_null()
|
|
144328
|
-
])
|
|
144329
|
-
}),
|
|
144330
|
-
object({
|
|
144331
|
-
kind: literal("global"),
|
|
144332
|
-
sourceStableId: string(),
|
|
144333
|
-
cap: string(),
|
|
144334
|
-
fieldPath: string()
|
|
144335
|
-
})
|
|
144336
|
-
]);
|
|
144337
|
-
object({
|
|
144338
|
-
expr: string().min(1).max(MAX_EXPRESSION_SOURCE_LENGTH),
|
|
144339
|
-
bindings: record(string().regex(EXPRESSION_IDENTIFIER_RE), ExpressionBindingSourceSchema)
|
|
144340
|
-
}).superRefine((src, ctx) => {
|
|
144341
|
-
const err = validateExpressionSource(src);
|
|
144342
|
-
if (err !== null) ctx.addIssue({
|
|
144343
|
-
code: "custom",
|
|
144344
|
-
message: err,
|
|
144345
|
-
path: ["expr"]
|
|
144346
|
-
});
|
|
144347
|
-
});
|
|
144348
|
-
/**
|
|
144349
|
-
* Identity envelope for a device's upstream-system metadata.
|
|
144350
|
-
*
|
|
144351
|
-
* Two jobs:
|
|
144352
|
-
*
|
|
144353
|
-
* 1. **Dispatch key.** `id` is the natural identifier the SOURCE system
|
|
144354
|
-
* uses to address this device (HA `entity_id`, Reolink MAC, ONVIF
|
|
144355
|
-
* WS-Discovery endpoint UUID, …). Provider code keeps a
|
|
144356
|
-
* `Map<sourceInfo.id, IDevice>` to route inbound push events in O(1)
|
|
144357
|
-
* without round-tripping through `stableId` / `id` mappings.
|
|
144358
|
-
*
|
|
144359
|
-
* 2. **Stability bridge.** `uniqueId` is the *immutable* upstream id when
|
|
144360
|
-
* one exists (HA `entity.unique_id`, Reolink MAC again — same as `id`
|
|
144361
|
-
* for vendors where MAC is the natural key). For systems where the
|
|
144362
|
-
* live dispatch key can be renamed (HA `entity_id` can be edited),
|
|
144363
|
-
* providers detect renames by matching `uniqueId` and patch `id`
|
|
144364
|
-
* in-place so dispatch keeps working.
|
|
144365
|
-
*
|
|
144366
|
-
* **Display unit and precision are NOT stored here.** They are a read-time
|
|
144367
|
-
* preference (D944). A polymorphic reading stores its `quantity` here once,
|
|
144368
|
-
* at adopt, and a date/time value stores `dateTimeShape` the same way —
|
|
144369
|
-
* neither is repeated on each sample. The `device_class` tag is an
|
|
144370
|
-
* HA-specific input consumed at the discovery boundary (`ha-domain-mapping`)
|
|
144371
|
-
* to derive the CamStack `DeviceRole`; it is never stored after that point.
|
|
144372
|
-
*
|
|
144373
|
-
* The `raw` escape hatch carries provider-specific attributes that don't
|
|
144374
|
-
* fit the structured slots (HA `attributes` whitelist, Reolink `deviceCache`
|
|
144375
|
-
* details, …). Providers control what lands here.
|
|
144376
|
-
*/
|
|
144377
|
-
var SourceInfoSchema = object({
|
|
144378
|
-
/** Live dispatch key — mutable when the source system allows rename. */
|
|
144379
|
-
id: string(),
|
|
144380
|
-
/** Source system tag — e.g. 'homeassistant' | 'reolink' | 'onvif'. */
|
|
144381
|
-
system: string(),
|
|
144382
|
-
/** Immutable upstream identifier when available (HA `unique_id`, … ).
|
|
144383
|
-
* Used to detect rename when `id` changes. */
|
|
144384
|
-
uniqueId: string().optional(),
|
|
144385
|
-
/** Quantity of a polymorphic reading, written once at adopt (D944). */
|
|
144386
|
-
quantity: ReadingQuantitySchema.optional(),
|
|
144387
|
-
/** Date / time / datetime shape of a string reading, written once at adopt. */
|
|
144388
|
-
dateTimeShape: _enum([
|
|
144389
|
-
"date",
|
|
144390
|
-
"time",
|
|
144391
|
-
"datetime"
|
|
144392
|
-
]).optional(),
|
|
144393
|
-
/** Provider-specific extras that don't fit the structured slots.
|
|
144394
|
-
* Whitelist what goes here per provider — do NOT dump entire HA
|
|
144395
|
-
* attribute blobs (would explode the meta JSON column). */
|
|
144396
|
-
raw: record(string(), unknown()).optional()
|
|
144397
|
-
});
|
|
144398
|
-
/**
|
|
144399
|
-
* Build the synthetic SourceInfo every existing provider falls back to
|
|
144400
|
-
* when no upstream value has been persisted. Keeps non-migrated providers
|
|
144401
|
-
* (Reolink / Hikvision / ONVIF / RTSP) functional without code
|
|
144402
|
-
* changes — `id` reuses the CamStack stableId, `system` reuses the addon
|
|
144403
|
-
* id. Real upstream identity replaces this once a provider migrates and
|
|
144404
|
-
* calls `updateSourceInfo()` with concrete values.
|
|
144405
|
-
*/
|
|
144406
|
-
function synthesizeSourceInfo(input) {
|
|
144407
|
-
return {
|
|
144408
|
-
id: input.stableId,
|
|
144409
|
-
system: input.addonId
|
|
144410
|
-
};
|
|
144411
|
-
}
|
|
144412
|
-
/**
|
|
144413
|
-
* Shallow-merge a partial patch over a prior SourceInfo. `undefined`
|
|
144414
|
-
* patch values are ignored (no field clobber); to clear a field
|
|
144415
|
-
* explicitly, providers omit it from the patch and rebuild from scratch
|
|
144416
|
-
* via `updateSourceInfo({})` cycles — uncommon enough that we don't
|
|
144417
|
-
* bother with a `null`-means-delete sentinel.
|
|
144418
|
-
*
|
|
144419
|
-
* The `raw` field is also shallow-merged: passing `raw: { foo: 1 }`
|
|
144420
|
-
* merges over existing `raw` keys instead of replacing the whole bag.
|
|
144421
|
-
*/
|
|
144422
|
-
function mergeSourceInfo(prev, patch) {
|
|
144423
|
-
const next = { ...prev };
|
|
144424
|
-
for (const [k, v] of Object.entries(patch)) {
|
|
144425
|
-
if (v === void 0) continue;
|
|
144426
|
-
if (k === "raw" && typeof v === "object" && v !== null) {
|
|
144427
|
-
next.raw = {
|
|
144428
|
-
...prev.raw,
|
|
144429
|
-
...v
|
|
144430
|
-
};
|
|
144431
|
-
continue;
|
|
144432
|
-
}
|
|
144433
|
-
next[k] = v;
|
|
144434
|
-
}
|
|
144435
|
-
return next;
|
|
144436
|
-
}
|
|
144437
|
-
/**
|
|
144438
|
-
* Key under which `SourceInfo` lives inside `DeviceMeta.metadata`. The
|
|
144439
|
-
* blob is a free-form `Record<string, unknown>` shared with hardware-
|
|
144440
|
-
* identity fields (`manufacturer`, `model`, `firmware`, …); SourceInfo
|
|
144441
|
-
* lives under a single nested key to keep it composable with those.
|
|
144442
|
-
*/
|
|
144443
|
-
var SOURCE_INFO_METADATA_KEY = "sourceInfo";
|
|
144444
|
-
/**
|
|
144445
|
-
* Extract a SourceInfo from a `DeviceMeta.metadata` blob, validating
|
|
144446
|
-
* with Zod. Returns `null` when the blob is missing or the nested
|
|
144447
|
-
* `sourceInfo` key fails validation — callers fall back to the
|
|
144448
|
-
* synthetic default in that case (see `synthesizeSourceInfo`).
|
|
144449
|
-
*/
|
|
144450
|
-
function extractSourceInfoFromMetadata(metadata) {
|
|
144451
|
-
if (!metadata) return null;
|
|
144452
|
-
const raw = metadata[SOURCE_INFO_METADATA_KEY];
|
|
144453
|
-
if (!raw) return null;
|
|
144454
|
-
const parsed = SourceInfoSchema.safeParse(raw);
|
|
144455
|
-
if (!parsed.success) return null;
|
|
144456
|
-
return parsed.data;
|
|
144457
|
-
}
|
|
144458
|
-
/**
|
|
144459
|
-
* Frozen unit → spec table. `•` in the doc marks each dimension's canonical
|
|
144460
|
-
* unit (`factor: 1, offset: 0`). °F derives from `°C = (°F − 32) × 5/9` ⇒
|
|
144461
|
-
* `factor = 5/9`, `offset = -160/9` (kept as exact expressions, not rounded
|
|
144462
|
-
* decimals). K derives from `°C = K − 273.15`.
|
|
144463
|
-
*/
|
|
144464
|
-
var UNIT_TABLE = {
|
|
144465
|
-
"°C": {
|
|
144466
|
-
dimension: "temperature",
|
|
144467
|
-
factor: 1,
|
|
144468
|
-
offset: 0
|
|
144469
|
-
},
|
|
144470
|
-
"°F": {
|
|
144471
|
-
dimension: "temperature",
|
|
144472
|
-
factor: 5 / 9,
|
|
144473
|
-
offset: -160 / 9
|
|
144474
|
-
},
|
|
144475
|
-
K: {
|
|
144476
|
-
dimension: "temperature",
|
|
144477
|
-
factor: 1,
|
|
144478
|
-
offset: -273.15
|
|
144479
|
-
},
|
|
144480
|
-
hPa: {
|
|
144481
|
-
dimension: "pressure",
|
|
144482
|
-
factor: 1,
|
|
144483
|
-
offset: 0
|
|
144484
|
-
},
|
|
144485
|
-
kPa: {
|
|
144486
|
-
dimension: "pressure",
|
|
144487
|
-
factor: 10,
|
|
144488
|
-
offset: 0
|
|
144489
|
-
},
|
|
144490
|
-
Pa: {
|
|
144491
|
-
dimension: "pressure",
|
|
144492
|
-
factor: .01,
|
|
144493
|
-
offset: 0
|
|
144494
|
-
},
|
|
144495
|
-
mbar: {
|
|
144496
|
-
dimension: "pressure",
|
|
144497
|
-
factor: 1,
|
|
144498
|
-
offset: 0
|
|
144499
|
-
},
|
|
144500
|
-
bar: {
|
|
144501
|
-
dimension: "pressure",
|
|
144502
|
-
factor: 1e3,
|
|
144503
|
-
offset: 0
|
|
144504
|
-
},
|
|
144505
|
-
inHg: {
|
|
144506
|
-
dimension: "pressure",
|
|
144507
|
-
factor: 33.8639,
|
|
144508
|
-
offset: 0
|
|
144509
|
-
},
|
|
144510
|
-
mmHg: {
|
|
144511
|
-
dimension: "pressure",
|
|
144512
|
-
factor: 1.33322,
|
|
144513
|
-
offset: 0
|
|
144514
|
-
},
|
|
144515
|
-
psi: {
|
|
144516
|
-
dimension: "pressure",
|
|
144517
|
-
factor: 68.9476,
|
|
144518
|
-
offset: 0
|
|
144519
|
-
},
|
|
144520
|
-
"m/s": {
|
|
144521
|
-
dimension: "speed",
|
|
144522
|
-
factor: 1,
|
|
144523
|
-
offset: 0
|
|
144524
|
-
},
|
|
144525
|
-
"km/h": {
|
|
144526
|
-
dimension: "speed",
|
|
144527
|
-
factor: 1 / 3.6,
|
|
144528
|
-
offset: 0
|
|
144529
|
-
},
|
|
144530
|
-
mph: {
|
|
144531
|
-
dimension: "speed",
|
|
144532
|
-
factor: .44704,
|
|
144533
|
-
offset: 0
|
|
144534
|
-
},
|
|
144535
|
-
kn: {
|
|
144536
|
-
dimension: "speed",
|
|
144537
|
-
factor: .514444,
|
|
144538
|
-
offset: 0
|
|
144539
|
-
},
|
|
144540
|
-
"mm/h": {
|
|
144541
|
-
dimension: "precipitation-rate",
|
|
144542
|
-
factor: 1,
|
|
144543
|
-
offset: 0
|
|
144544
|
-
},
|
|
144545
|
-
"in/h": {
|
|
144546
|
-
dimension: "precipitation-rate",
|
|
144547
|
-
factor: 25.4,
|
|
144548
|
-
offset: 0
|
|
144549
|
-
},
|
|
144550
|
-
m: {
|
|
144551
|
-
dimension: "length",
|
|
144552
|
-
factor: 1,
|
|
144553
|
-
offset: 0
|
|
144554
|
-
},
|
|
144555
|
-
mm: {
|
|
144556
|
-
dimension: "length",
|
|
144557
|
-
factor: .001,
|
|
144558
|
-
offset: 0
|
|
144559
|
-
},
|
|
144560
|
-
cm: {
|
|
144561
|
-
dimension: "length",
|
|
144562
|
-
factor: .01,
|
|
144563
|
-
offset: 0
|
|
144564
|
-
},
|
|
144565
|
-
km: {
|
|
144566
|
-
dimension: "length",
|
|
144567
|
-
factor: 1e3,
|
|
144568
|
-
offset: 0
|
|
144569
|
-
},
|
|
144570
|
-
in: {
|
|
144571
|
-
dimension: "length",
|
|
144572
|
-
factor: .0254,
|
|
144573
|
-
offset: 0
|
|
144574
|
-
},
|
|
144575
|
-
ft: {
|
|
144576
|
-
dimension: "length",
|
|
144577
|
-
factor: .3048,
|
|
144578
|
-
offset: 0
|
|
144579
|
-
},
|
|
144580
|
-
mi: {
|
|
144581
|
-
dimension: "length",
|
|
144582
|
-
factor: 1609.344,
|
|
144583
|
-
offset: 0
|
|
144584
|
-
},
|
|
144585
|
-
"m²": {
|
|
144586
|
-
dimension: "area",
|
|
144587
|
-
factor: 1,
|
|
144588
|
-
offset: 0
|
|
144589
|
-
},
|
|
144590
|
-
lx: {
|
|
144591
|
-
dimension: "illuminance",
|
|
144592
|
-
factor: 1,
|
|
144593
|
-
offset: 0
|
|
144594
|
-
},
|
|
144595
|
-
"W/m²": {
|
|
144596
|
-
dimension: "irradiance",
|
|
144597
|
-
factor: 1,
|
|
144598
|
-
offset: 0
|
|
144599
|
-
},
|
|
144600
|
-
W: {
|
|
144601
|
-
dimension: "power",
|
|
144602
|
-
factor: 1,
|
|
144603
|
-
offset: 0
|
|
144604
|
-
},
|
|
144605
|
-
kW: {
|
|
144606
|
-
dimension: "power",
|
|
144607
|
-
factor: 1e3,
|
|
144608
|
-
offset: 0
|
|
144609
|
-
},
|
|
144610
|
-
VA: {
|
|
144611
|
-
dimension: "apparent-power",
|
|
144612
|
-
factor: 1,
|
|
144613
|
-
offset: 0
|
|
144614
|
-
},
|
|
144615
|
-
Wh: {
|
|
144616
|
-
dimension: "energy",
|
|
144617
|
-
factor: 1,
|
|
144618
|
-
offset: 0
|
|
144619
|
-
},
|
|
144620
|
-
kWh: {
|
|
144621
|
-
dimension: "energy",
|
|
144622
|
-
factor: 1e3,
|
|
144623
|
-
offset: 0
|
|
144624
|
-
},
|
|
144625
|
-
MWh: {
|
|
144626
|
-
dimension: "energy",
|
|
144627
|
-
factor: 1e6,
|
|
144628
|
-
offset: 0
|
|
144629
|
-
},
|
|
144630
|
-
V: {
|
|
144631
|
-
dimension: "voltage",
|
|
144632
|
-
factor: 1,
|
|
144633
|
-
offset: 0
|
|
144634
|
-
},
|
|
144635
|
-
mV: {
|
|
144636
|
-
dimension: "voltage",
|
|
144637
|
-
factor: .001,
|
|
144638
|
-
offset: 0
|
|
144639
|
-
},
|
|
144640
|
-
A: {
|
|
144641
|
-
dimension: "current",
|
|
144642
|
-
factor: 1,
|
|
144643
|
-
offset: 0
|
|
144644
|
-
},
|
|
144645
|
-
mA: {
|
|
144646
|
-
dimension: "current",
|
|
144647
|
-
factor: .001,
|
|
144648
|
-
offset: 0
|
|
144649
|
-
},
|
|
144650
|
-
ppm: {
|
|
144651
|
-
dimension: "concentration-volume",
|
|
144652
|
-
factor: 1,
|
|
144653
|
-
offset: 0
|
|
144654
|
-
},
|
|
144655
|
-
ppb: {
|
|
144656
|
-
dimension: "concentration-volume",
|
|
144657
|
-
factor: .001,
|
|
144658
|
-
offset: 0
|
|
144659
|
-
},
|
|
144660
|
-
"µg/m³": {
|
|
144661
|
-
dimension: "concentration-mass",
|
|
144662
|
-
factor: 1,
|
|
144663
|
-
offset: 0
|
|
144664
|
-
},
|
|
144665
|
-
"mg/m³": {
|
|
144666
|
-
dimension: "concentration-mass",
|
|
144667
|
-
factor: 1e3,
|
|
144668
|
-
offset: 0
|
|
144669
|
-
},
|
|
144670
|
-
kg: {
|
|
144671
|
-
dimension: "mass",
|
|
144672
|
-
factor: 1,
|
|
144673
|
-
offset: 0
|
|
144674
|
-
},
|
|
144675
|
-
g: {
|
|
144676
|
-
dimension: "mass",
|
|
144677
|
-
factor: .001,
|
|
144678
|
-
offset: 0
|
|
144679
|
-
},
|
|
144680
|
-
lb: {
|
|
144681
|
-
dimension: "mass",
|
|
144682
|
-
factor: .453592,
|
|
144683
|
-
offset: 0
|
|
144684
|
-
},
|
|
144685
|
-
oz: {
|
|
144686
|
-
dimension: "mass",
|
|
144687
|
-
factor: .0283495,
|
|
144688
|
-
offset: 0
|
|
144689
|
-
},
|
|
144690
|
-
"%": {
|
|
144691
|
-
dimension: "percentage",
|
|
144692
|
-
factor: 1,
|
|
144693
|
-
offset: 0
|
|
144694
|
-
},
|
|
144695
|
-
L: {
|
|
144696
|
-
dimension: "volume",
|
|
144697
|
-
factor: 1,
|
|
144698
|
-
offset: 0
|
|
144699
|
-
},
|
|
144700
|
-
mL: {
|
|
144701
|
-
dimension: "volume",
|
|
144702
|
-
factor: .001,
|
|
144703
|
-
offset: 0
|
|
144704
|
-
},
|
|
144705
|
-
gal: {
|
|
144706
|
-
dimension: "volume",
|
|
144707
|
-
factor: 3.785411784,
|
|
144708
|
-
offset: 0
|
|
144709
|
-
},
|
|
144710
|
-
s: {
|
|
144711
|
-
dimension: "duration",
|
|
144712
|
-
factor: 1,
|
|
144713
|
-
offset: 0
|
|
144714
|
-
},
|
|
144715
|
-
ms: {
|
|
144716
|
-
dimension: "duration",
|
|
144717
|
-
factor: .001,
|
|
144718
|
-
offset: 0
|
|
144719
|
-
},
|
|
144720
|
-
min: {
|
|
144721
|
-
dimension: "duration",
|
|
144722
|
-
factor: 60,
|
|
144723
|
-
offset: 0
|
|
144724
|
-
},
|
|
144725
|
-
h: {
|
|
144726
|
-
dimension: "duration",
|
|
144727
|
-
factor: 3600,
|
|
144728
|
-
offset: 0
|
|
144729
|
-
},
|
|
144730
|
-
d: {
|
|
144731
|
-
dimension: "duration",
|
|
144732
|
-
factor: 86400,
|
|
144733
|
-
offset: 0
|
|
144734
|
-
},
|
|
144735
|
-
B: {
|
|
144736
|
-
dimension: "information",
|
|
144737
|
-
factor: 1,
|
|
144738
|
-
offset: 0
|
|
144739
|
-
},
|
|
144740
|
-
KiB: {
|
|
144741
|
-
dimension: "information",
|
|
144742
|
-
factor: 1024,
|
|
144743
|
-
offset: 0
|
|
144744
|
-
},
|
|
144745
|
-
MiB: {
|
|
144746
|
-
dimension: "information",
|
|
144747
|
-
factor: 1024 ** 2,
|
|
144748
|
-
offset: 0
|
|
144749
|
-
},
|
|
144750
|
-
GiB: {
|
|
144751
|
-
dimension: "information",
|
|
144752
|
-
factor: 1024 ** 3,
|
|
144753
|
-
offset: 0
|
|
144754
|
-
},
|
|
144755
|
-
TiB: {
|
|
144756
|
-
dimension: "information",
|
|
144757
|
-
factor: 1024 ** 4,
|
|
144758
|
-
offset: 0
|
|
144759
|
-
},
|
|
144760
|
-
kB: {
|
|
144761
|
-
dimension: "information",
|
|
144762
|
-
factor: 1e3,
|
|
144763
|
-
offset: 0
|
|
144764
|
-
},
|
|
144765
|
-
MB: {
|
|
144766
|
-
dimension: "information",
|
|
144767
|
-
factor: 1e6,
|
|
144768
|
-
offset: 0
|
|
144769
|
-
},
|
|
144770
|
-
GB: {
|
|
144771
|
-
dimension: "information",
|
|
144772
|
-
factor: 1e9,
|
|
144773
|
-
offset: 0
|
|
144774
|
-
},
|
|
144775
|
-
"°": {
|
|
144776
|
-
dimension: "angle",
|
|
144777
|
-
factor: 1,
|
|
144778
|
-
offset: 0
|
|
144779
|
-
},
|
|
144780
|
-
dBFS: {
|
|
144781
|
-
dimension: "sound-level",
|
|
144782
|
-
factor: 1,
|
|
144783
|
-
offset: 0
|
|
144784
|
-
},
|
|
144785
|
-
dBm: {
|
|
144786
|
-
dimension: "signal-level",
|
|
144787
|
-
factor: 1,
|
|
144788
|
-
offset: 0
|
|
144789
|
-
},
|
|
144790
|
-
mired: {
|
|
144791
|
-
dimension: "colour-temperature",
|
|
144792
|
-
factor: 1,
|
|
144793
|
-
offset: 0
|
|
144794
|
-
},
|
|
144795
|
-
kbps: {
|
|
144796
|
-
dimension: "bitrate",
|
|
144797
|
-
factor: 1,
|
|
144798
|
-
offset: 0
|
|
144799
|
-
},
|
|
144800
|
-
Mbps: {
|
|
144801
|
-
dimension: "bitrate",
|
|
144802
|
-
factor: 1e3,
|
|
144803
|
-
offset: 0
|
|
144804
|
-
},
|
|
144805
|
-
fps: {
|
|
144806
|
-
dimension: "rate",
|
|
144807
|
-
factor: 1,
|
|
144808
|
-
offset: 0
|
|
144809
|
-
}
|
|
144631
|
+
"warehouse"
|
|
144632
|
+
],
|
|
144633
|
+
"washing-machine": [
|
|
144634
|
+
"lavatrice",
|
|
144635
|
+
"lavastoviglie",
|
|
144636
|
+
"asciugatrice"
|
|
144637
|
+
],
|
|
144638
|
+
waves: [
|
|
144639
|
+
"onde",
|
|
144640
|
+
"acqua",
|
|
144641
|
+
"vibrazione"
|
|
144642
|
+
],
|
|
144643
|
+
"waves-ladder": [
|
|
144644
|
+
"piscina",
|
|
144645
|
+
"vasca",
|
|
144646
|
+
"pool"
|
|
144647
|
+
],
|
|
144648
|
+
wifi: ["rete", "segnale"],
|
|
144649
|
+
"wifi-off": [
|
|
144650
|
+
"wifi",
|
|
144651
|
+
"assente",
|
|
144652
|
+
"offline",
|
|
144653
|
+
"disconnesso"
|
|
144654
|
+
],
|
|
144655
|
+
wind: [
|
|
144656
|
+
"vento",
|
|
144657
|
+
"aria",
|
|
144658
|
+
"gas",
|
|
144659
|
+
"monossido",
|
|
144660
|
+
"co"
|
|
144661
|
+
],
|
|
144662
|
+
workflow: [
|
|
144663
|
+
"automazione",
|
|
144664
|
+
"flusso",
|
|
144665
|
+
"scenario"
|
|
144666
|
+
],
|
|
144667
|
+
wrench: [
|
|
144668
|
+
"officina",
|
|
144669
|
+
"manutenzione",
|
|
144670
|
+
"attrezzi",
|
|
144671
|
+
"utenze"
|
|
144672
|
+
],
|
|
144673
|
+
zap: [
|
|
144674
|
+
"energia",
|
|
144675
|
+
"corrente",
|
|
144676
|
+
"consumo",
|
|
144677
|
+
"watt",
|
|
144678
|
+
"elettricita"
|
|
144679
|
+
]
|
|
144810
144680
|
};
|
|
144811
|
-
/**
|
|
144812
|
-
|
|
144813
|
-
|
|
144681
|
+
/**
|
|
144682
|
+
* Spellings an operator may already have PERSISTED that no lucide package
|
|
144683
|
+
* accepts any more, and the catalog key they draw. They resolve
|
|
144684
|
+
* (`canonicalIconKey`) but are never offered. `gauge2` was this repo's own
|
|
144685
|
+
* pre-catalog spelling of `gauge`.
|
|
144686
|
+
*/
|
|
144687
|
+
var LEGACY_ICON_ALIASES = { gauge2: "gauge" };
|
|
144688
|
+
/**
|
|
144689
|
+
* icon-catalog — THE icon vocabulary (D854).
|
|
144690
|
+
*
|
|
144691
|
+
* Every place that picks or stores an icon — a device's display override, a
|
|
144692
|
+
* location, a site zone, a viewer accessory, an `icon` settings field — names
|
|
144693
|
+
* it by a key of this catalog and nothing else. There is no curated subset and
|
|
144694
|
+
* no second list: the catalog is every lucide icon that both surfaces can draw
|
|
144695
|
+
* (the admin UI's `lucide-react` and the viewer's `lucide-react-native`), the
|
|
144696
|
+
* intersection computed by `scripts/generate-icon-catalog.ts` into the
|
|
144697
|
+
* committed `icon-catalog.generated.ts`.
|
|
144698
|
+
*
|
|
144699
|
+
* Like the vocabularies it replaces, this module holds STRINGS only — no React,
|
|
144700
|
+
* no lucide import, no glyph. Each surface owns its glyph table (the web one
|
|
144701
|
+
* lives in `ui-library`, loaded lazily), and a test on each side pins that it
|
|
144702
|
+
* covers {@link ICON_KEYS}.
|
|
144703
|
+
*
|
|
144704
|
+
* ## What is persisted
|
|
144705
|
+
*
|
|
144706
|
+
* The canonical kebab-case lucide id ({@link IconKey}). Spellings that a lucide
|
|
144707
|
+
* package still accepts (`home` for `house`) and this repo's own legacy ones
|
|
144708
|
+
* (`gauge2`) RESOLVE ({@link canonicalIconKey}) so a stored value never goes
|
|
144709
|
+
* stale, but they are never OFFERED by search.
|
|
144710
|
+
*
|
|
144711
|
+
* ## Search
|
|
144712
|
+
*
|
|
144713
|
+
* Over the key, the Italian/English overlay in `icon-synonyms.ts`, any words
|
|
144714
|
+
* the caller adds, and lucide's English tags — in that order of weight.
|
|
144715
|
+
*/
|
|
144716
|
+
var KEY_SET$2 = new Set(ICON_KEYS);
|
|
144717
|
+
new Map([...Object.entries(ICON_ALIASES), ...Object.entries(LEGACY_ICON_ALIASES)]);
|
|
144718
|
+
/** Is this a canonical key of the catalog? (An alias is not — see {@link canonicalIconKey}.) */
|
|
144719
|
+
function isIconKey(value) {
|
|
144720
|
+
return typeof value === "string" && KEY_SET$2.has(value);
|
|
144814
144721
|
}
|
|
144815
|
-
/**
|
|
144816
|
-
|
|
144817
|
-
|
|
144722
|
+
/**
|
|
144723
|
+
* Wire/storage schema for one icon key.
|
|
144724
|
+
*
|
|
144725
|
+
* Deliberately NOT a `z.enum` of the catalog: ~1,700 literals would be inlined
|
|
144726
|
+
* into every cap router, type and API-reference row that carries an icon. The
|
|
144727
|
+
* check is membership in the catalog and the type is {@link IconKey}.
|
|
144728
|
+
*/
|
|
144729
|
+
var IconKeySchema = custom(isIconKey, "Not an icon of the catalog");
|
|
144730
|
+
var ENTRIES = ICON_KEYS.map((key, index) => {
|
|
144731
|
+
const [categoryIndexes, tags] = ICON_META[index] ?? [[], []];
|
|
144732
|
+
const categories = categoryIndexes.flatMap((i) => {
|
|
144733
|
+
const id = ICON_CATEGORY_IDS[i];
|
|
144734
|
+
return id === void 0 ? [] : [id];
|
|
144735
|
+
});
|
|
144736
|
+
return {
|
|
144737
|
+
key,
|
|
144738
|
+
categories,
|
|
144739
|
+
primaryCategory: categories[0] ?? ICON_CATEGORY_IDS[0],
|
|
144740
|
+
tags,
|
|
144741
|
+
synonyms: ICON_SYNONYMS[key] ?? []
|
|
144742
|
+
};
|
|
144743
|
+
});
|
|
144744
|
+
new Map(ENTRIES.map((e) => [e.key, e]));
|
|
144745
|
+
/** Categories a picker offers first: the ones this product's icons mostly live in. */
|
|
144746
|
+
var LEADING_CATEGORIES = [
|
|
144747
|
+
"devices",
|
|
144748
|
+
"home",
|
|
144749
|
+
"security",
|
|
144750
|
+
"buildings",
|
|
144751
|
+
"connectivity",
|
|
144752
|
+
"multimedia",
|
|
144753
|
+
"nature",
|
|
144754
|
+
"weather",
|
|
144755
|
+
"transportation",
|
|
144756
|
+
"animals"
|
|
144757
|
+
];
|
|
144758
|
+
var PRIMARY_CATEGORIES = new Set(ENTRIES.map((e) => e.primaryCategory));
|
|
144759
|
+
[...LEADING_CATEGORIES, ...ICON_CATEGORY_IDS.filter((c) => !LEADING_CATEGORIES.includes(c))].filter((c) => PRIMARY_CATEGORIES.has(c));
|
|
144760
|
+
/**
|
|
144761
|
+
* One (location, icon) assignment as it travels.
|
|
144762
|
+
*
|
|
144763
|
+
* `locationKey` is ALWAYS {@link locationIconKey} of the label — never the
|
|
144764
|
+
* operator's casing. The registry matches labels trimmed + case-insensitively
|
|
144765
|
+
* everywhere (`addLocation`, `removeLocation`, `renameLocation`), and a
|
|
144766
|
+
* case-only rename (`kitchen` → `Kitchen`) is a real edit this repo supports; a
|
|
144767
|
+
* map keyed on the displayed casing would orphan its entry on exactly that
|
|
144768
|
+
* edit. Consumers join by keying their own label through `locationIconKey`.
|
|
144769
|
+
*/
|
|
144770
|
+
var LocationIconAssignmentSchema = object({
|
|
144771
|
+
locationKey: string(),
|
|
144772
|
+
icon: IconKeySchema
|
|
144773
|
+
});
|
|
144774
|
+
/**
|
|
144775
|
+
* One (location, description) assignment as it travels.
|
|
144776
|
+
*
|
|
144777
|
+
* Same key discipline as {@link LocationIconAssignmentSchema}, and for the same
|
|
144778
|
+
* reason: this lived for a while in the post-analysis addon's own settings,
|
|
144779
|
+
* keyed by a HAND-TYPED label matched exactly and case-sensitively. A rename in
|
|
144780
|
+
* the Locations page carried the icon and silently orphaned the description —
|
|
144781
|
+
* two authorities for one thing, joined by two different rules. Now both hang
|
|
144782
|
+
* off the location itself, on `locationIconKey`.
|
|
144783
|
+
*/
|
|
144784
|
+
var LocationDescriptionAssignmentSchema = object({
|
|
144785
|
+
locationKey: string(),
|
|
144786
|
+
description: string()
|
|
144787
|
+
});
|
|
144788
|
+
/**
|
|
144789
|
+
* WHO an action step acts on (D983) — one target shape for every place that
|
|
144790
|
+
* performs an action (automation steps, Action entries, notification
|
|
144791
|
+
* sequences, scheduler points):
|
|
144792
|
+
*
|
|
144793
|
+
* - `devices` — device ids the operator picked, frozen at save time;
|
|
144794
|
+
* - `domain` — every device that offers the step's VOCABULARY action,
|
|
144795
|
+
* optionally narrowed to one device type and one room, resolved WHEN THE
|
|
144796
|
+
* STEP RUNS (a device added later is included). The action always comes
|
|
144797
|
+
* from the vocabulary (`cover.open`), never from a raw cap name, so a
|
|
144798
|
+
* `domain` target needs an `actionId` (enforced on the step schema);
|
|
144799
|
+
* - `var` — a `$var` resolved from the run's scope.
|
|
144800
|
+
*
|
|
144801
|
+
* {@link ActionTargetResolver} turns a target into device ids. It is pure
|
|
144802
|
+
* (a {@link DeviceDirectory} is handed in) so the hub's core-blocks service and
|
|
144803
|
+
* a generated automation block share it.
|
|
144804
|
+
*
|
|
144805
|
+
* A room is the device's `location` label (`DeviceInfo.location`); two labels
|
|
144806
|
+
* name the same room when `locationIconKey` agrees (trimmed, lower-cased).
|
|
144807
|
+
*/
|
|
144808
|
+
var ActionTargetSchema = discriminatedUnion("kind", [
|
|
144809
|
+
object({
|
|
144810
|
+
kind: literal("devices"),
|
|
144811
|
+
ids: array(number().int()).min(1)
|
|
144812
|
+
}),
|
|
144813
|
+
object({
|
|
144814
|
+
kind: literal("domain"),
|
|
144815
|
+
/** Narrow to one kind of device. */
|
|
144816
|
+
deviceType: _enum(DeviceType).optional(),
|
|
144817
|
+
/** Narrow to one room: the `location` label devices carry. */
|
|
144818
|
+
roomId: string().min(1).optional()
|
|
144819
|
+
}),
|
|
144820
|
+
object({
|
|
144821
|
+
kind: literal("var"),
|
|
144822
|
+
name: string().min(1)
|
|
144823
|
+
})
|
|
144824
|
+
]);
|
|
144825
|
+
EventCategory.DeviceRegistered, EventCategory.DeviceUnregistered, EventCategory.DeviceUpdated, EventCategory.DeviceMetaChanged, EventCategory.DeviceBindingsChanged;
|
|
144826
|
+
var ExpressionBindingSourceSchema = union([
|
|
144827
|
+
object({
|
|
144828
|
+
kind: literal("field").optional(),
|
|
144829
|
+
sourceKey: string(),
|
|
144830
|
+
cap: string(),
|
|
144831
|
+
fieldPath: string()
|
|
144832
|
+
}),
|
|
144833
|
+
object({
|
|
144834
|
+
kind: literal("literal"),
|
|
144835
|
+
value: union([
|
|
144836
|
+
string(),
|
|
144837
|
+
number(),
|
|
144838
|
+
boolean(),
|
|
144839
|
+
_null()
|
|
144840
|
+
])
|
|
144841
|
+
}),
|
|
144842
|
+
object({
|
|
144843
|
+
kind: literal("global"),
|
|
144844
|
+
sourceStableId: string(),
|
|
144845
|
+
addonId: string().optional(),
|
|
144846
|
+
cap: string(),
|
|
144847
|
+
fieldPath: string()
|
|
144848
|
+
})
|
|
144849
|
+
]);
|
|
144850
|
+
object({
|
|
144851
|
+
expr: string().min(1).max(MAX_EXPRESSION_SOURCE_LENGTH),
|
|
144852
|
+
bindings: record(string().regex(EXPRESSION_IDENTIFIER_RE), ExpressionBindingSourceSchema)
|
|
144853
|
+
}).superRefine((src, ctx) => {
|
|
144854
|
+
const err = validateExpressionSource(src);
|
|
144855
|
+
if (err !== null) ctx.addIssue({
|
|
144856
|
+
code: "custom",
|
|
144857
|
+
message: err,
|
|
144858
|
+
path: ["expr"]
|
|
144859
|
+
});
|
|
144860
|
+
});
|
|
144861
|
+
/**
|
|
144862
|
+
* Identity envelope for a device's upstream-system metadata.
|
|
144863
|
+
*
|
|
144864
|
+
* Two jobs:
|
|
144865
|
+
*
|
|
144866
|
+
* 1. **Dispatch key.** `id` is the natural identifier the SOURCE system
|
|
144867
|
+
* uses to address this device (HA `entity_id`, Reolink MAC, ONVIF
|
|
144868
|
+
* WS-Discovery endpoint UUID, …). Provider code keeps a
|
|
144869
|
+
* `Map<sourceInfo.id, IDevice>` to route inbound push events in O(1)
|
|
144870
|
+
* without round-tripping through `stableId` / `id` mappings.
|
|
144871
|
+
*
|
|
144872
|
+
* 2. **Stability bridge.** `uniqueId` is the *immutable* upstream id when
|
|
144873
|
+
* one exists (HA `entity.unique_id`, Reolink MAC again — same as `id`
|
|
144874
|
+
* for vendors where MAC is the natural key). For systems where the
|
|
144875
|
+
* live dispatch key can be renamed (HA `entity_id` can be edited),
|
|
144876
|
+
* providers detect renames by matching `uniqueId` and patch `id`
|
|
144877
|
+
* in-place so dispatch keeps working.
|
|
144878
|
+
*
|
|
144879
|
+
* **Display unit and precision are NOT stored here.** They are a read-time
|
|
144880
|
+
* preference (D944). A polymorphic reading stores its `quantity` here once,
|
|
144881
|
+
* at adopt, and a date/time value stores `dateTimeShape` the same way —
|
|
144882
|
+
* neither is repeated on each sample. The `device_class` tag is an
|
|
144883
|
+
* HA-specific input consumed at the discovery boundary (`ha-domain-mapping`)
|
|
144884
|
+
* to derive the CamStack `DeviceRole`; it is never stored after that point.
|
|
144885
|
+
*
|
|
144886
|
+
* The `raw` escape hatch carries provider-specific attributes that don't
|
|
144887
|
+
* fit the structured slots (HA `attributes` whitelist, Reolink `deviceCache`
|
|
144888
|
+
* details, …). Providers control what lands here.
|
|
144889
|
+
*/
|
|
144890
|
+
var SourceInfoSchema = object({
|
|
144891
|
+
/** Live dispatch key — mutable when the source system allows rename. */
|
|
144892
|
+
id: string(),
|
|
144893
|
+
/** Source system tag — e.g. 'homeassistant' | 'reolink' | 'onvif'. */
|
|
144894
|
+
system: string(),
|
|
144895
|
+
/** Immutable upstream identifier when available (HA `unique_id`, … ).
|
|
144896
|
+
* Used to detect rename when `id` changes. */
|
|
144897
|
+
uniqueId: string().optional(),
|
|
144898
|
+
/** Quantity of a polymorphic reading, written once at adopt (D944). */
|
|
144899
|
+
quantity: ReadingQuantitySchema.optional(),
|
|
144900
|
+
/** Date / time / datetime shape of a string reading, written once at adopt. */
|
|
144901
|
+
dateTimeShape: _enum([
|
|
144902
|
+
"date",
|
|
144903
|
+
"time",
|
|
144904
|
+
"datetime"
|
|
144905
|
+
]).optional(),
|
|
144906
|
+
/** Provider-specific extras that don't fit the structured slots.
|
|
144907
|
+
* Whitelist what goes here per provider — do NOT dump entire HA
|
|
144908
|
+
* attribute blobs (would explode the meta JSON column). */
|
|
144909
|
+
raw: record(string(), unknown()).optional()
|
|
144910
|
+
});
|
|
144911
|
+
/**
|
|
144912
|
+
* Build the synthetic SourceInfo every existing provider falls back to
|
|
144913
|
+
* when no upstream value has been persisted. Keeps non-migrated providers
|
|
144914
|
+
* (Reolink / Hikvision / ONVIF / RTSP) functional without code
|
|
144915
|
+
* changes — `id` reuses the CamStack stableId, `system` reuses the addon
|
|
144916
|
+
* id. Real upstream identity replaces this once a provider migrates and
|
|
144917
|
+
* calls `updateSourceInfo()` with concrete values.
|
|
144918
|
+
*/
|
|
144919
|
+
function synthesizeSourceInfo(input) {
|
|
144920
|
+
return {
|
|
144921
|
+
id: input.stableId,
|
|
144922
|
+
system: input.addonId
|
|
144923
|
+
};
|
|
144818
144924
|
}
|
|
144819
|
-
/**
|
|
144820
|
-
|
|
144821
|
-
|
|
144925
|
+
/**
|
|
144926
|
+
* Shallow-merge a partial patch over a prior SourceInfo. `undefined`
|
|
144927
|
+
* patch values are ignored (no field clobber); to clear a field
|
|
144928
|
+
* explicitly, providers omit it from the patch and rebuild from scratch
|
|
144929
|
+
* via `updateSourceInfo({})` cycles — uncommon enough that we don't
|
|
144930
|
+
* bother with a `null`-means-delete sentinel.
|
|
144931
|
+
*
|
|
144932
|
+
* The `raw` field is also shallow-merged: passing `raw: { foo: 1 }`
|
|
144933
|
+
* merges over existing `raw` keys instead of replacing the whole bag.
|
|
144934
|
+
*/
|
|
144935
|
+
function mergeSourceInfo(prev, patch) {
|
|
144936
|
+
const next = { ...prev };
|
|
144937
|
+
for (const [k, v] of Object.entries(patch)) {
|
|
144938
|
+
if (v === void 0) continue;
|
|
144939
|
+
if (k === "raw" && typeof v === "object" && v !== null) {
|
|
144940
|
+
next.raw = {
|
|
144941
|
+
...prev.raw,
|
|
144942
|
+
...v
|
|
144943
|
+
};
|
|
144944
|
+
continue;
|
|
144945
|
+
}
|
|
144946
|
+
next[k] = v;
|
|
144947
|
+
}
|
|
144948
|
+
return next;
|
|
144822
144949
|
}
|
|
144823
144950
|
/**
|
|
144824
|
-
*
|
|
144825
|
-
*
|
|
144826
|
-
*
|
|
144951
|
+
* Key under which `SourceInfo` lives inside `DeviceMeta.metadata`. The
|
|
144952
|
+
* blob is a free-form `Record<string, unknown>` shared with hardware-
|
|
144953
|
+
* identity fields (`manufacturer`, `model`, `firmware`, …); SourceInfo
|
|
144954
|
+
* lives under a single nested key to keep it composable with those.
|
|
144827
144955
|
*/
|
|
144828
|
-
|
|
144829
|
-
|
|
144830
|
-
|
|
144831
|
-
|
|
144832
|
-
|
|
144833
|
-
|
|
144834
|
-
|
|
144835
|
-
|
|
144956
|
+
var SOURCE_INFO_METADATA_KEY = "sourceInfo";
|
|
144957
|
+
/**
|
|
144958
|
+
* Extract a SourceInfo from a `DeviceMeta.metadata` blob, validating
|
|
144959
|
+
* with Zod. Returns `null` when the blob is missing or the nested
|
|
144960
|
+
* `sourceInfo` key fails validation — callers fall back to the
|
|
144961
|
+
* synthetic default in that case (see `synthesizeSourceInfo`).
|
|
144962
|
+
*/
|
|
144963
|
+
function extractSourceInfoFromMetadata(metadata) {
|
|
144964
|
+
if (!metadata) return null;
|
|
144965
|
+
const raw = metadata[SOURCE_INFO_METADATA_KEY];
|
|
144966
|
+
if (!raw) return null;
|
|
144967
|
+
const parsed = SourceInfoSchema.safeParse(raw);
|
|
144968
|
+
if (!parsed.success) return null;
|
|
144969
|
+
return parsed.data;
|
|
144836
144970
|
}
|
|
144837
144971
|
/**
|
|
144838
144972
|
* A number a person types for a physical quantity — the input side of the
|
|
@@ -146511,15 +146645,28 @@ var SettingsSchemaWithValuesSchema = object({
|
|
|
146511
146645
|
});
|
|
146512
146646
|
/** Patch object — keys are field names, values are the new field values. */
|
|
146513
146647
|
var SettingsPatchSchema = record(string(), unknown());
|
|
146648
|
+
/** The scope of a scoped-settings call (D986): where the capability declared the values. */
|
|
146649
|
+
var ScopedSettingsScopeSchema = _enum(SCOPED_SETTINGS_SCOPES);
|
|
146650
|
+
/** One scoped schema an addon serves: its capability, scope and section ids. */
|
|
146651
|
+
var ScopedSettingsDeclarationSchema = object({
|
|
146652
|
+
cap: string(),
|
|
146653
|
+
scope: ScopedSettingsScopeSchema,
|
|
146654
|
+
sectionIds: array(string())
|
|
146655
|
+
});
|
|
146514
146656
|
/** Standard success response for update operations. */
|
|
146515
146657
|
var SettingsUpdateResultSchema = object({ success: literal(true) });
|
|
146516
146658
|
method(object({
|
|
146517
146659
|
addonId: string(),
|
|
146518
|
-
|
|
146519
|
-
|
|
146520
|
-
|
|
146660
|
+
cap: string(),
|
|
146661
|
+
scope: ScopedSettingsScopeSchema,
|
|
146662
|
+
nodeId: string().optional()
|
|
146521
146663
|
}), SettingsSchemaWithValuesSchema.nullable()), method(object({
|
|
146522
146664
|
addonId: string(),
|
|
146665
|
+
nodeId: string().optional()
|
|
146666
|
+
}), array(ScopedSettingsDeclarationSchema).nullable()), method(object({
|
|
146667
|
+
addonId: string(),
|
|
146668
|
+
cap: string(),
|
|
146669
|
+
scope: ScopedSettingsScopeSchema,
|
|
146523
146670
|
nodeId: string().optional(),
|
|
146524
146671
|
patch: SettingsPatchSchema
|
|
146525
146672
|
}), SettingsUpdateResultSchema, {
|
|
@@ -146527,8 +146674,10 @@ method(object({
|
|
|
146527
146674
|
auth: "admin"
|
|
146528
146675
|
}), method(object({
|
|
146529
146676
|
addonId: string(),
|
|
146677
|
+
cap: string(),
|
|
146678
|
+
scope: ScopedSettingsScopeSchema,
|
|
146530
146679
|
nodeId: string().optional()
|
|
146531
|
-
}),
|
|
146680
|
+
}), record(string(), unknown()).nullable()), method(object({
|
|
146532
146681
|
addonId: string(),
|
|
146533
146682
|
nodeId: string().optional(),
|
|
146534
146683
|
instance: IntegrationInstanceRefSchema
|
|
@@ -148091,7 +148240,7 @@ var BackupDestinationInfoSchema = object({
|
|
|
148091
148240
|
id: string(),
|
|
148092
148241
|
/**
|
|
148093
148242
|
* Manifest id of the owning addon. The Settings button on the
|
|
148094
|
-
* destination card opens that addon's
|
|
148243
|
+
* destination card opens that addon's scoped settings panel.
|
|
148095
148244
|
*/
|
|
148096
148245
|
addonId: string(),
|
|
148097
148246
|
/** Operator-toggled enable flag from the destination-policy table. */
|
|
@@ -151505,7 +151654,7 @@ var mediaPlayerCapability = {
|
|
|
151505
151654
|
isMuted: { kind: "boolean" }
|
|
151506
151655
|
} }
|
|
151507
151656
|
};
|
|
151508
|
-
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;
|
|
151657
|
+
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;
|
|
151509
151658
|
var NUMBER = {
|
|
151510
151659
|
kind: "fixed",
|
|
151511
151660
|
result: ["number"]
|
|
@@ -153544,6 +153693,7 @@ method(InstancePinSchema, DeviceExportStatusSchema), method(_void(), array(Expor
|
|
|
153544
153693
|
kind: "mutation",
|
|
153545
153694
|
auth: "admin"
|
|
153546
153695
|
});
|
|
153696
|
+
var DeviceAliasSchema = string().max(64).regex(/^[a-z][a-z0-9_]*$/);
|
|
153547
153697
|
/**
|
|
153548
153698
|
* A SITE ZONE — a named part of the property that several locations belong to.
|
|
153549
153699
|
*
|
|
@@ -154030,6 +154180,12 @@ var DeviceInfoSchema = object({
|
|
|
154030
154180
|
addonId: string(),
|
|
154031
154181
|
type: _enum(DeviceType),
|
|
154032
154182
|
name: string(),
|
|
154183
|
+
/** The name a value template uses for this device (`{{ stufa_veranda.temperature }}`),
|
|
154184
|
+
* entity_id style. Generated once from the name at first registration, unique
|
|
154185
|
+
* cluster-wide, editable through `setAlias`, NOT changed by a rename (D1021).
|
|
154186
|
+
* Optional: a record produced by an older build omits it until the boot
|
|
154187
|
+
* backfill has run. */
|
|
154188
|
+
alias: DeviceAliasSchema.optional(),
|
|
154033
154189
|
/** Operator-organisational location label. `null` when unset. */
|
|
154034
154190
|
location: string().nullable(),
|
|
154035
154191
|
/** Soft-disabled flag. */
|
|
@@ -154349,6 +154505,25 @@ method(object({
|
|
|
154349
154505
|
}), _void(), {
|
|
154350
154506
|
kind: "mutation",
|
|
154351
154507
|
auth: "admin"
|
|
154508
|
+
}), method(object({
|
|
154509
|
+
deviceId: number(),
|
|
154510
|
+
alias: string()
|
|
154511
|
+
}), discriminatedUnion("ok", [object({
|
|
154512
|
+
ok: literal(true),
|
|
154513
|
+
alias: DeviceAliasSchema
|
|
154514
|
+
}), object({
|
|
154515
|
+
ok: literal(false),
|
|
154516
|
+
reason: _enum([
|
|
154517
|
+
"empty",
|
|
154518
|
+
"too-long",
|
|
154519
|
+
"grammar",
|
|
154520
|
+
"reserved",
|
|
154521
|
+
"taken"
|
|
154522
|
+
]),
|
|
154523
|
+
takenBy: number().optional()
|
|
154524
|
+
})]), {
|
|
154525
|
+
kind: "mutation",
|
|
154526
|
+
auth: "admin"
|
|
154352
154527
|
}), method(object({
|
|
154353
154528
|
deviceId: number(),
|
|
154354
154529
|
location: string().nullable()
|
|
@@ -158090,7 +158265,7 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
|
|
|
158090
158265
|
* or the redaction token KEEPS the stored secret; `{ $secretClear: true }`
|
|
158091
158266
|
* clears it.
|
|
158092
158267
|
*/
|
|
158093
|
-
var ConfigSchemaPassthrough$
|
|
158268
|
+
var ConfigSchemaPassthrough$2 = custom();
|
|
158094
158269
|
var IntegrationInstanceIdSchema = string().min(1);
|
|
158095
158270
|
var IntegrationInstanceModeSchema = _enum(["single", "multiple"]);
|
|
158096
158271
|
/**
|
|
@@ -158136,7 +158311,16 @@ var IntegrationInstanceKindSchema = object({
|
|
|
158136
158311
|
/** Relative hub path to start an interactive account link of an instance of this kind. */
|
|
158137
158312
|
connectPath: string().min(1).optional(),
|
|
158138
158313
|
/** Relative hub path to disconnect that account. */
|
|
158139
|
-
disconnectPath: string().min(1).optional()
|
|
158314
|
+
disconnectPath: string().min(1).optional(),
|
|
158315
|
+
/**
|
|
158316
|
+
* Parts of the edit dialog the flat form cannot draw (a node picker, a model source), named by a
|
|
158317
|
+
* GENERIC widget id the client maps to a component; a client that knows none of them shows none.
|
|
158318
|
+
* `connection` widgets write connection values, `model` widgets own the model choice.
|
|
158319
|
+
*/
|
|
158320
|
+
widgets: array(object({
|
|
158321
|
+
id: string().min(1),
|
|
158322
|
+
placement: _enum(["connection", "model"])
|
|
158323
|
+
})).optional()
|
|
158140
158324
|
});
|
|
158141
158325
|
/**
|
|
158142
158326
|
* How devices of an instance are found. `none`: the operator adds them by hand; `lan`: the addon
|
|
@@ -158177,10 +158361,11 @@ var IntegrationInstanceDescriptionSchema = object({
|
|
|
158177
158361
|
/** True when `testInstance` really probes the remote. */
|
|
158178
158362
|
canTest: boolean(),
|
|
158179
158363
|
/**
|
|
158180
|
-
* The kinds an instance can be of
|
|
158181
|
-
* Add flow asks which first and sends it as
|
|
158364
|
+
* The kinds an instance can be of (D1013 rule 1), each naming its `functionCap`. One entry:
|
|
158365
|
+
* nothing to choose; more than one: the Add flow asks which first and sends it as
|
|
158366
|
+
* `createInstance.kind`. Never empty: every instance belongs to exactly one kind.
|
|
158182
158367
|
*/
|
|
158183
|
-
kinds: array(IntegrationInstanceKindSchema).
|
|
158368
|
+
kinds: array(IntegrationInstanceKindSchema).min(1),
|
|
158184
158369
|
/**
|
|
158185
158370
|
* The provider accepts `createInstance.id` for an id that once existed (an adopted id, because
|
|
158186
158371
|
* devices carry it). The UI then offers "restore under its old id" on Add. Absent means no.
|
|
@@ -158216,8 +158401,8 @@ var IntegrationInstanceSchema = object({
|
|
|
158216
158401
|
* the body is the one store, `setInstanceEnabled` the one writer (epic #440, step 3).
|
|
158217
158402
|
*/
|
|
158218
158403
|
enabled: boolean().optional(),
|
|
158219
|
-
/** The kind of this instance
|
|
158220
|
-
kind: string().
|
|
158404
|
+
/** The kind of this instance: exactly one of `describe().kinds[].id` (D1013 rule 2). */
|
|
158405
|
+
kind: string().min(1),
|
|
158221
158406
|
/** Values for the instance form; a secret is a `SecretFieldView`, never text. */
|
|
158222
158407
|
formValues: record(string(), unknown()),
|
|
158223
158408
|
status: IntegrationInstanceStatusSchema.optional(),
|
|
@@ -158241,7 +158426,7 @@ var integrationInstancesCapability = {
|
|
|
158241
158426
|
id: IntegrationInstanceIdSchema.nullable(),
|
|
158242
158427
|
/** The kind of the create form (`id: null`) of a provider with several. */
|
|
158243
158428
|
kind: string().min(1).optional()
|
|
158244
|
-
}), ConfigSchemaPassthrough$
|
|
158429
|
+
}), ConfigSchemaPassthrough$2, { auth: "admin" }),
|
|
158245
158430
|
listInstances: method(_void(), array(IntegrationInstanceSchema).readonly(), { auth: "admin" }),
|
|
158246
158431
|
getInstance: method(object({ id: IntegrationInstanceIdSchema }), IntegrationInstanceSchema.nullable(), { auth: "admin" }),
|
|
158247
158432
|
/**
|
|
@@ -159343,12 +159528,12 @@ var LlmModelInfoSchema = object({
|
|
|
159343
159528
|
});
|
|
159344
159529
|
/**
|
|
159345
159530
|
* The provider-specific part of a profile, validated by the provider that owns
|
|
159346
|
-
* the kind (
|
|
159531
|
+
* the kind (saving an instance refuses what it does not accept). A field its
|
|
159347
159532
|
* `connectionSchema` declares `type: 'password'` is a secret: it is held in the
|
|
159348
159533
|
* keychain, never in the row, and reads back as the redaction marker.
|
|
159349
159534
|
*/
|
|
159350
159535
|
var LlmProviderConfigSchema = record(string(), unknown());
|
|
159351
|
-
|
|
159536
|
+
object({
|
|
159352
159537
|
id: string(),
|
|
159353
159538
|
name: string(),
|
|
159354
159539
|
/** The provider-declared kind (`LlmProfileKindDescriptor.kind`). */
|
|
@@ -159442,8 +159627,8 @@ var LlmProviderWidgetSchema = object({
|
|
|
159442
159627
|
/** ConfigUISchema tree passed through untyped on the wire (the
|
|
159443
159628
|
* notification-output `ConfigSchemaPassthrough` precedent at
|
|
159444
159629
|
* notification-output.cap.ts:151); the exported TS type re-tightens it. */
|
|
159445
|
-
var ConfigSchemaPassthrough$
|
|
159446
|
-
|
|
159630
|
+
var ConfigSchemaPassthrough$1 = unknown();
|
|
159631
|
+
object({
|
|
159447
159632
|
kind: LlmProfileKindSchema,
|
|
159448
159633
|
label: string(),
|
|
159449
159634
|
/** A generic icon name (`cloud`, `plug`, `cpu`) — never a glyph or a logo. */
|
|
@@ -159451,9 +159636,9 @@ var LlmProfileKindDescriptorSchema = object({
|
|
|
159451
159636
|
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
159452
159637
|
addonId: string(),
|
|
159453
159638
|
/** The provider's own fields (`providerConfig`); `password` fields are keychain-held. */
|
|
159454
|
-
connectionSchema: ConfigSchemaPassthrough$
|
|
159639
|
+
connectionSchema: ConfigSchemaPassthrough$1,
|
|
159455
159640
|
/** Provider fields that belong under "Advanced" (extra headers, runtime tuning). */
|
|
159456
|
-
advancedSchema: ConfigSchemaPassthrough$
|
|
159641
|
+
advancedSchema: ConfigSchemaPassthrough$1.optional(),
|
|
159457
159642
|
/** The kind's defaults; a model from `listModels` may override any of them. */
|
|
159458
159643
|
features: LlmModelFeaturesSchema,
|
|
159459
159644
|
/** `false` = the provider stamps `supportsVision` itself (from what a node reports). */
|
|
@@ -159582,20 +159767,7 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
|
|
|
159582
159767
|
}), method(object({
|
|
159583
159768
|
addonId: string().optional(),
|
|
159584
159769
|
requestId: string()
|
|
159585
|
-
}), _void(), { kind: "mutation" }), method(
|
|
159586
|
-
kind: "mutation",
|
|
159587
|
-
auth: "admin"
|
|
159588
|
-
}), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
|
|
159589
|
-
kind: "mutation",
|
|
159590
|
-
auth: "admin"
|
|
159591
|
-
}), method(ProfileRefInputSchema, _void(), {
|
|
159592
|
-
kind: "mutation",
|
|
159593
|
-
auth: "admin"
|
|
159594
|
-
}), method(ProfileRefInputSchema, LlmGenerateResultSchema, {
|
|
159595
|
-
kind: "mutation",
|
|
159596
|
-
auth: "admin",
|
|
159597
|
-
timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
|
|
159598
|
-
}), method(LlmListModelsInputSchema, LlmListModelsResultSchema, {
|
|
159770
|
+
}), _void(), { kind: "mutation" }), method(LlmListModelsInputSchema, LlmListModelsResultSchema, {
|
|
159599
159771
|
kind: "mutation",
|
|
159600
159772
|
auth: "admin"
|
|
159601
159773
|
}), method(object({}), array(LlmDefaultSchema)), method(object({
|
|
@@ -160679,20 +160851,7 @@ method(_void(), MeshStatusSchema), method(object({
|
|
|
160679
160851
|
/** Optional hostname override the host should advertise once joined. */
|
|
160680
160852
|
hostname: string().optional() }), object({
|
|
160681
160853
|
/** Authentication URL the operator should open in a browser. */
|
|
160682
|
-
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() }))
|
|
160683
|
-
/** Optional auth key — when provided, probes the key validity
|
|
160684
|
-
* against the provider's API. Omit when already joined to
|
|
160685
|
-
* just ping the daemon. */
|
|
160686
|
-
authKey: string().optional() }), object({
|
|
160687
|
-
ok: boolean(),
|
|
160688
|
-
/** Provider-side identifier resolved by the probe (tailnet
|
|
160689
|
-
* name for Tailscale, network id for ZeroTier, etc.). */
|
|
160690
|
-
tenant: string().optional(),
|
|
160691
|
-
/** Daemon binary version, when reachable. */
|
|
160692
|
-
daemonVersion: string().optional(),
|
|
160693
|
-
/** Human-readable error when `ok: false`. */
|
|
160694
|
-
error: string().optional()
|
|
160695
|
-
}), { kind: "mutation" });
|
|
160854
|
+
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() }));
|
|
160696
160855
|
/**
|
|
160697
160856
|
* A monotonic total between resets (D944). Energy uses `power-meter.energy`
|
|
160698
160857
|
* so dashboards keep one series; every other instantaneous reading lands here.
|
|
@@ -168539,6 +168698,11 @@ var NcScheduleSchema = object({
|
|
|
168539
168698
|
* as a STATE SUMMARY at the end of each window of `schedule`.
|
|
168540
168699
|
*/
|
|
168541
168700
|
var NcSystemEventDeliveryModeSchema = _enum(["instant", "summary"]);
|
|
168701
|
+
_enum([
|
|
168702
|
+
"activation",
|
|
168703
|
+
"deactivation",
|
|
168704
|
+
"schedule"
|
|
168705
|
+
]);
|
|
168542
168706
|
/**
|
|
168543
168707
|
* How a summary window is SENT (D698): `rule` (absent) = ONE notification with
|
|
168544
168708
|
* every section; `section` = one notification per section with something to
|
|
@@ -168555,11 +168719,26 @@ var NcStateSummarySplitSchema = _enum(["rule", "section"]);
|
|
|
168555
168719
|
* midnight crossing); the send time is each window's END. Refused on the
|
|
168556
168720
|
* `alarm` family, which stays instant (`systemEventDeliveryProblems`).
|
|
168557
168721
|
*/
|
|
168558
|
-
var NcSystemEventDeliverySchema = discriminatedUnion("mode", [
|
|
168559
|
-
mode: literal("
|
|
168560
|
-
|
|
168561
|
-
|
|
168562
|
-
|
|
168722
|
+
var NcSystemEventDeliverySchema = discriminatedUnion("mode", [
|
|
168723
|
+
object({ mode: literal("instant") }),
|
|
168724
|
+
object({
|
|
168725
|
+
mode: literal("summary"),
|
|
168726
|
+
schedule: NcScheduleSchema,
|
|
168727
|
+
split: NcStateSummarySplitSchema.optional()
|
|
168728
|
+
}),
|
|
168729
|
+
object({
|
|
168730
|
+
mode: literal("modes"),
|
|
168731
|
+
/** The bad edge, and every kind that has a single edge. */
|
|
168732
|
+
onActivation: boolean(),
|
|
168733
|
+
/** The recovery edges of the classes of the selected kinds (derived, never stored per kind). */
|
|
168734
|
+
onDeactivation: boolean(),
|
|
168735
|
+
/** A state summary at the end of each window; absent = no summary. */
|
|
168736
|
+
onSchedule: object({
|
|
168737
|
+
schedule: NcScheduleSchema,
|
|
168738
|
+
grouping: NcStateSummarySplitSchema
|
|
168739
|
+
}).optional()
|
|
168740
|
+
})
|
|
168741
|
+
]);
|
|
168563
168742
|
/** Fuzzy plate matcher — OCR noise makes exact match useless (spec row 12/13). */
|
|
168564
168743
|
var NcPlateMatcherSchema = object({
|
|
168565
168744
|
/**
|
|
@@ -170919,61 +171098,6 @@ var OauthIntegrationDescriptorSchema = object({
|
|
|
170919
171098
|
});
|
|
170920
171099
|
method(_void(), OauthIntegrationDescriptorSchema, { auth: "admin" });
|
|
170921
171100
|
/**
|
|
170922
|
-
* `oidc-connections` — CRUD for IdP rows under `auth-oidc` (D828 sibling).
|
|
170923
|
-
*
|
|
170924
|
-
* One hub-only singleton (`auth-oidc`). The Settings UI is a DataTable +
|
|
170925
|
-
* ItemFormDialog; there is no `editable-array` in `globalSettingsSchema`.
|
|
170926
|
-
* Operator-chosen `id` is the URL slug (`/addon/auth-oidc/<id>/…`) and is
|
|
170927
|
-
* immutable after create.
|
|
170928
|
-
*/
|
|
170929
|
-
var ConfigSchemaPassthrough$1 = unknown();
|
|
170930
|
-
var OidcConnectionSchema = object({
|
|
170931
|
-
id: string().min(1),
|
|
170932
|
-
displayName: string(),
|
|
170933
|
-
icon: string(),
|
|
170934
|
-
issuerUrl: string(),
|
|
170935
|
-
clientId: string(),
|
|
170936
|
-
/** Client id + secret present — never the secret value. */
|
|
170937
|
-
configured: boolean(),
|
|
170938
|
-
/**
|
|
170939
|
-
* Values for the connection form schema. `clientSecret` is a keychain
|
|
170940
|
-
* {@link SecretFieldView} or `null` / `''`, never plaintext (D789).
|
|
170941
|
-
*/
|
|
170942
|
-
formValues: record(string(), unknown()).optional()
|
|
170943
|
-
});
|
|
170944
|
-
/**
|
|
170945
|
-
* Patch one connection. Omitted or empty `clientSecret` keeps the stored
|
|
170946
|
-
* secret (D787). `{ $secretClear: true }` clears it. `id` is never renamed.
|
|
170947
|
-
*/
|
|
170948
|
-
var OidcConnectionUpdateInputSchema = object({
|
|
170949
|
-
id: string().min(1),
|
|
170950
|
-
displayName: string().min(1),
|
|
170951
|
-
icon: string().optional(),
|
|
170952
|
-
issuerUrl: string().optional(),
|
|
170953
|
-
clientId: string().optional(),
|
|
170954
|
-
clientSecret: union([string(), object({ $secretClear: literal(true) })]).optional(),
|
|
170955
|
-
redirectUri: string().optional(),
|
|
170956
|
-
scopes: string().optional(),
|
|
170957
|
-
usernameClaim: _enum([
|
|
170958
|
-
"preferred_username",
|
|
170959
|
-
"email",
|
|
170960
|
-
"sub"
|
|
170961
|
-
]).optional()
|
|
170962
|
-
});
|
|
170963
|
-
method(object({}), ConfigSchemaPassthrough$1, { auth: "admin" }), method(object({}), array(OidcConnectionSchema).readonly(), { auth: "admin" }), method(object({
|
|
170964
|
-
id: string().min(1).regex(/^[a-z0-9][a-z0-9-]{0,63}$/, "id must be a lowercase slug"),
|
|
170965
|
-
displayName: string().min(1)
|
|
170966
|
-
}), object({ id: string() }), {
|
|
170967
|
-
kind: "mutation",
|
|
170968
|
-
auth: "admin"
|
|
170969
|
-
}), method(OidcConnectionUpdateInputSchema, object({ ok: literal(true) }), {
|
|
170970
|
-
kind: "mutation",
|
|
170971
|
-
auth: "admin"
|
|
170972
|
-
}), method(object({ id: string().min(1) }), object({ ok: literal(true) }), {
|
|
170973
|
-
kind: "mutation",
|
|
170974
|
-
auth: "admin"
|
|
170975
|
-
});
|
|
170976
|
-
/**
|
|
170977
171101
|
* Generic on-screen-display (video overlay) cap. Each camera exposes
|
|
170978
171102
|
* a firmware-defined list of overlays (channel name, timestamp,
|
|
170979
171103
|
* watermark, logo, …); the cap models them as a homogeneous array of
|
|
@@ -177294,6 +177418,16 @@ var RemoteLayoutComponentSchema = object({
|
|
|
177294
177418
|
method(object({}), array(RemoteLayoutComponentSchema), { auth: "protected" });
|
|
177295
177419
|
var RUNNING_POWER_START_DELAY_MS = 3e4;
|
|
177296
177420
|
var RUNNING_POWER_STOP_DELAY_MS = 18e4;
|
|
177421
|
+
/**
|
|
177422
|
+
* Per-type overrides of the dwell defaults. A media player draws power the
|
|
177423
|
+
* moment it is on and stops drawing the moment it is off, so it needs neither
|
|
177424
|
+
* a long dwell nor a second sample. A type absent here keeps the global values.
|
|
177425
|
+
*/
|
|
177426
|
+
var RUNNING_POWER_DEFAULTS_BY_TYPE = { [DeviceType.MediaPlayer]: {
|
|
177427
|
+
startDwellMs: 1e4,
|
|
177428
|
+
stopDwellMs: 1e4,
|
|
177429
|
+
minSamples: 1
|
|
177430
|
+
} };
|
|
177297
177431
|
var RunningStateSourceSchema = _enum(["native", "assigned"]);
|
|
177298
177432
|
var RunningStateStatusSchema = object({
|
|
177299
177433
|
/** null = unknown — never coerced to false (D393). */
|
|
@@ -177311,93 +177445,27 @@ var RunningFlipEventDataSchema = object({
|
|
|
177311
177445
|
phase: string().nullable()
|
|
177312
177446
|
});
|
|
177313
177447
|
var RUNNING_DEVICE_TYPES = Object.values(DeviceType);
|
|
177314
|
-
/**
|
|
177315
|
-
|
|
177316
|
-
|
|
177317
|
-
|
|
177318
|
-
|
|
177319
|
-
|
|
177320
|
-
|
|
177321
|
-
|
|
177322
|
-
|
|
177323
|
-
|
|
177324
|
-
|
|
177325
|
-
|
|
177326
|
-
|
|
177327
|
-
|
|
177328
|
-
|
|
177329
|
-
|
|
177330
|
-
|
|
177331
|
-
|
|
177332
|
-
|
|
177333
|
-
|
|
177334
|
-
|
|
177335
|
-
DeviceType.WaterHeater,
|
|
177336
|
-
DeviceType.Humidifier,
|
|
177337
|
-
DeviceType.Fan,
|
|
177338
|
-
DeviceType.Climate,
|
|
177339
|
-
DeviceType.Thermostat,
|
|
177340
|
-
DeviceType.PetFeeder,
|
|
177341
|
-
DeviceType.Heater
|
|
177342
|
-
],
|
|
177343
|
-
apply: "add",
|
|
177344
|
-
path: "running",
|
|
177345
|
-
sources: [
|
|
177346
|
-
{
|
|
177347
|
-
kind: "switch",
|
|
177348
|
-
transforms: [{ kind: "identity" }]
|
|
177349
|
-
},
|
|
177350
|
-
{
|
|
177351
|
-
kind: "binary",
|
|
177352
|
-
transforms: [{ kind: "identity" }, { kind: "invert" }]
|
|
177353
|
-
},
|
|
177354
|
-
{
|
|
177355
|
-
kind: "numeric",
|
|
177356
|
-
requiredUnit: "W",
|
|
177357
|
-
transforms: [{
|
|
177358
|
-
kind: "threshold",
|
|
177359
|
-
comparisons: ["gte", "lte"],
|
|
177360
|
-
comparison: "gte",
|
|
177361
|
-
defaultThreshold: 5,
|
|
177362
|
-
defaultStartDwellMs: RUNNING_POWER_START_DELAY_MS,
|
|
177363
|
-
defaultStopDwellMs: RUNNING_POWER_STOP_DELAY_MS,
|
|
177364
|
-
thresholdUnit: "W"
|
|
177365
|
-
}]
|
|
177366
|
-
}
|
|
177367
|
-
],
|
|
177368
|
-
companions: [
|
|
177369
|
-
{
|
|
177370
|
-
kind: "constant",
|
|
177371
|
-
path: "source",
|
|
177372
|
-
value: "assigned",
|
|
177373
|
-
when: "always"
|
|
177374
|
-
},
|
|
177375
|
-
{
|
|
177376
|
-
kind: "constant",
|
|
177377
|
-
path: "phase",
|
|
177378
|
-
value: null,
|
|
177379
|
-
when: "add"
|
|
177380
|
-
},
|
|
177381
|
-
{
|
|
177382
|
-
kind: "clock",
|
|
177383
|
-
path: "lastFetchedAt",
|
|
177384
|
-
when: "always"
|
|
177385
|
-
},
|
|
177386
|
-
{
|
|
177387
|
-
kind: "transition-time",
|
|
177388
|
-
path: "since",
|
|
177389
|
-
sourceChangedAt: "prefer"
|
|
177390
|
-
}
|
|
177391
|
-
],
|
|
177392
|
-
sourceReport: {
|
|
177393
|
-
status: "assignment-status",
|
|
177394
|
-
runtimeField: "source",
|
|
177395
|
-
nativeValue: "native",
|
|
177396
|
-
assignedValue: "assigned"
|
|
177397
|
-
},
|
|
177398
|
-
advancedExpression: true
|
|
177399
|
-
}]
|
|
177400
|
-
};
|
|
177448
|
+
/**
|
|
177449
|
+
* Customize offers "running" only where a job makes sense (D933): a cycle,
|
|
177450
|
+
* a clean, a mow, playback, or another appliance that is on and working.
|
|
177451
|
+
* The cap itself stays on every type — a camera can still report running
|
|
177452
|
+
* natively; it just has no card.
|
|
177453
|
+
*/
|
|
177454
|
+
var RUNNING_CUSTOMIZE_DEVICE_TYPES = [
|
|
177455
|
+
DeviceType.Washer,
|
|
177456
|
+
DeviceType.Dryer,
|
|
177457
|
+
DeviceType.Dishwasher,
|
|
177458
|
+
DeviceType.Vacuum,
|
|
177459
|
+
DeviceType.LawnMower,
|
|
177460
|
+
DeviceType.MediaPlayer,
|
|
177461
|
+
DeviceType.WaterHeater,
|
|
177462
|
+
DeviceType.Humidifier,
|
|
177463
|
+
DeviceType.Fan,
|
|
177464
|
+
DeviceType.Climate,
|
|
177465
|
+
DeviceType.Thermostat,
|
|
177466
|
+
DeviceType.PetFeeder,
|
|
177467
|
+
DeviceType.Heater
|
|
177468
|
+
];
|
|
177401
177469
|
var runningStateCapability = {
|
|
177402
177470
|
name: "running-state",
|
|
177403
177471
|
scope: "device",
|
|
@@ -177417,7 +177485,79 @@ var runningStateCapability = {
|
|
|
177417
177485
|
durability: "restored",
|
|
177418
177486
|
history: { fields: { running: { kind: "boolean" } } },
|
|
177419
177487
|
volatileStateFields: ["lastFetchedAt"],
|
|
177420
|
-
customize:
|
|
177488
|
+
customize: {
|
|
177489
|
+
version: 1,
|
|
177490
|
+
overridable: [{
|
|
177491
|
+
path: "running",
|
|
177492
|
+
by: "running"
|
|
177493
|
+
}],
|
|
177494
|
+
targets: [{
|
|
177495
|
+
id: "running",
|
|
177496
|
+
cardinality: "scalar",
|
|
177497
|
+
vocabulary: {
|
|
177498
|
+
cap: "running-state",
|
|
177499
|
+
stateField: "running"
|
|
177500
|
+
},
|
|
177501
|
+
deviceTypes: RUNNING_CUSTOMIZE_DEVICE_TYPES,
|
|
177502
|
+
apply: "add",
|
|
177503
|
+
path: "running",
|
|
177504
|
+
sources: [
|
|
177505
|
+
{
|
|
177506
|
+
kind: "switch",
|
|
177507
|
+
transforms: [{ kind: "identity" }]
|
|
177508
|
+
},
|
|
177509
|
+
{
|
|
177510
|
+
kind: "binary",
|
|
177511
|
+
transforms: [{ kind: "identity" }, { kind: "invert" }]
|
|
177512
|
+
},
|
|
177513
|
+
{
|
|
177514
|
+
kind: "numeric",
|
|
177515
|
+
requiredUnit: "W",
|
|
177516
|
+
transforms: [{
|
|
177517
|
+
kind: "threshold",
|
|
177518
|
+
comparisons: ["gte", "lte"],
|
|
177519
|
+
comparison: "gte",
|
|
177520
|
+
defaultThreshold: 5,
|
|
177521
|
+
defaultStartDwellMs: RUNNING_POWER_START_DELAY_MS,
|
|
177522
|
+
defaultStopDwellMs: RUNNING_POWER_STOP_DELAY_MS,
|
|
177523
|
+
deviceTypeDefaults: RUNNING_POWER_DEFAULTS_BY_TYPE,
|
|
177524
|
+
thresholdUnit: "W"
|
|
177525
|
+
}]
|
|
177526
|
+
}
|
|
177527
|
+
],
|
|
177528
|
+
companions: [
|
|
177529
|
+
{
|
|
177530
|
+
kind: "constant",
|
|
177531
|
+
path: "source",
|
|
177532
|
+
value: "assigned",
|
|
177533
|
+
when: "always"
|
|
177534
|
+
},
|
|
177535
|
+
{
|
|
177536
|
+
kind: "constant",
|
|
177537
|
+
path: "phase",
|
|
177538
|
+
value: null,
|
|
177539
|
+
when: "add"
|
|
177540
|
+
},
|
|
177541
|
+
{
|
|
177542
|
+
kind: "clock",
|
|
177543
|
+
path: "lastFetchedAt",
|
|
177544
|
+
when: "always"
|
|
177545
|
+
},
|
|
177546
|
+
{
|
|
177547
|
+
kind: "transition-time",
|
|
177548
|
+
path: "since",
|
|
177549
|
+
sourceChangedAt: "prefer"
|
|
177550
|
+
}
|
|
177551
|
+
],
|
|
177552
|
+
sourceReport: {
|
|
177553
|
+
status: "assignment-status",
|
|
177554
|
+
runtimeField: "source",
|
|
177555
|
+
nativeValue: "native",
|
|
177556
|
+
assignedValue: "assigned"
|
|
177557
|
+
},
|
|
177558
|
+
advancedExpression: true
|
|
177559
|
+
}]
|
|
177560
|
+
}
|
|
177421
177561
|
};
|
|
177422
177562
|
/**
|
|
177423
177563
|
* scene-monitor — device-scoped reference-region state cap. An operator marks
|
|
@@ -178765,21 +178905,6 @@ method(object({
|
|
|
178765
178905
|
*/
|
|
178766
178906
|
ttlSec: union([number().int().positive(), literal("never")]).optional()
|
|
178767
178907
|
}), object({ token: string() }), { auth: "admin" }), method(object({ token: string() }), SsoBridgeClaimsSchema.nullable(), { auth: "admin" });
|
|
178768
|
-
var ProviderListEntrySchema = discriminatedUnion("shouldSaveDiskSpace", [object({
|
|
178769
|
-
providerId: string().min(1),
|
|
178770
|
-
displayName: string().min(1),
|
|
178771
|
-
configSchema: unknown(),
|
|
178772
|
-
nodeLocal: boolean(),
|
|
178773
|
-
shouldSaveDiskSpace: literal(true),
|
|
178774
|
-
minFreePercent: number().min(0).max(100)
|
|
178775
|
-
}), object({
|
|
178776
|
-
providerId: string().min(1),
|
|
178777
|
-
displayName: string().min(1),
|
|
178778
|
-
configSchema: unknown(),
|
|
178779
|
-
nodeLocal: boolean(),
|
|
178780
|
-
shouldSaveDiskSpace: literal(false),
|
|
178781
|
-
minFreePercent: literal(null)
|
|
178782
|
-
})]);
|
|
178783
178908
|
method(object({
|
|
178784
178909
|
location: StorageLocationRefSchema,
|
|
178785
178910
|
relativePath: string()
|
|
@@ -178841,42 +178966,7 @@ method(object({
|
|
|
178841
178966
|
}), _instanceof(Uint8Array), { auth: "admin" }), method(object({ downloadId: string() }), _void(), {
|
|
178842
178967
|
kind: "mutation",
|
|
178843
178968
|
auth: "admin"
|
|
178844
|
-
}), method(object({ type: StorageLocationTypeSchema.optional() }), array(StorageLocationSchema).readonly()), method(_void(), array(StorageLocationDeclarationSchema).readonly()), method(
|
|
178845
|
-
createdAt: true,
|
|
178846
|
-
updatedAt: true
|
|
178847
|
-
}), StorageLocationSchema, {
|
|
178848
|
-
kind: "mutation",
|
|
178849
|
-
auth: "admin"
|
|
178850
|
-
}), method(object({
|
|
178851
|
-
id: string(),
|
|
178852
|
-
force: boolean().optional()
|
|
178853
|
-
}), _void(), {
|
|
178854
|
-
kind: "mutation",
|
|
178855
|
-
auth: "admin"
|
|
178856
|
-
}), method(_void(), array(StorageDrainProgressSchema).readonly()), method(object({ id: string() }), object({
|
|
178857
|
-
ok: boolean(),
|
|
178858
|
-
error: string().optional()
|
|
178859
|
-
}), { auth: "admin" }), method(_void(), array(ProviderListEntrySchema).readonly()), method(object({
|
|
178860
|
-
providerId: string(),
|
|
178861
|
-
/**
|
|
178862
|
-
* The location this config is an UNSAVED edit of, when there is one.
|
|
178863
|
-
*
|
|
178864
|
-
* `listLocations` replaces every declared secret with the redaction
|
|
178865
|
-
* sentinel, so the edit modal's form state holds the sentinel for any
|
|
178866
|
-
* credential the operator did not retype — and posting that here
|
|
178867
|
-
* without a way to resolve it makes the provider try to authenticate
|
|
178868
|
-
* as `__camstack_redacted__` and report the operator's own working
|
|
178869
|
-
* password as wrong. Given this id, the orchestrator restores each
|
|
178870
|
-
* sentinel from the stored config (same rule as `upsertLocation`)
|
|
178871
|
-
* before dispatching. Omitted by the "Add location" wizard, where
|
|
178872
|
-
* every value was typed just now and nothing is stored yet.
|
|
178873
|
-
*/
|
|
178874
|
-
locationId: string().optional(),
|
|
178875
|
-
config: record(string(), unknown())
|
|
178876
|
-
}), object({
|
|
178877
|
-
ok: boolean(),
|
|
178878
|
-
error: string().optional()
|
|
178879
|
-
}), { auth: "admin" });
|
|
178969
|
+
}), method(object({ type: StorageLocationTypeSchema.optional() }), array(StorageLocationSchema).readonly()), method(_void(), array(StorageLocationDeclarationSchema).readonly()), method(_void(), array(StorageDrainProgressSchema).readonly());
|
|
178880
178970
|
/** One table of the settings database. */
|
|
178881
178971
|
var StorageTableSchema = object({
|
|
178882
178972
|
/** The table's full name, e.g. `recorder:addon-settings` or `addon-device-settings`. */
|
|
@@ -180398,7 +180488,7 @@ var TerminalInstanceInfoSchema = object({
|
|
|
180398
180488
|
/**
|
|
180399
180489
|
* False while the node the instance is bound to is not in the cluster
|
|
180400
180490
|
* topology (forgotten, renamed, re-paired). The instance is kept; the
|
|
180401
|
-
* operator re-points it
|
|
180491
|
+
* operator re-points it on the Terminal page.
|
|
180402
180492
|
*/
|
|
180403
180493
|
nodeInCluster: boolean(),
|
|
180404
180494
|
profileId: string(),
|
|
@@ -180436,41 +180526,7 @@ var TerminalOutputBatchSchema = object({
|
|
|
180436
180526
|
snapshot: string().optional(),
|
|
180437
180527
|
events: array(TerminalOutputEventSchema).readonly()
|
|
180438
180528
|
});
|
|
180439
|
-
method(_void(), array(TerminalProfileInfoSchema).readonly(), { auth: "admin" }), method(_void(), array(
|
|
180440
|
-
targetNodeId: string().min(1),
|
|
180441
|
-
profileId: string().min(1),
|
|
180442
|
-
name: string().trim().min(1).max(160).optional(),
|
|
180443
|
-
executable: string().max(1024).optional(),
|
|
180444
|
-
args: array(string().max(2048)).max(64).optional(),
|
|
180445
|
-
cwd: string().max(1024).optional(),
|
|
180446
|
-
environment: array(string().max(4096)).max(64).optional(),
|
|
180447
|
-
profileSettings: ProfileSettingsBagSchema.optional()
|
|
180448
|
-
}), TerminalInstanceInfoSchema, {
|
|
180449
|
-
kind: "mutation",
|
|
180450
|
-
auth: "admin"
|
|
180451
|
-
}), method(object({
|
|
180452
|
-
instanceId: string().min(1),
|
|
180453
|
-
/** Re-point the instance to another node; the profile must exist there. */
|
|
180454
|
-
targetNodeId: string().min(1).max(256).optional(),
|
|
180455
|
-
name: string().trim().min(1).max(160).optional(),
|
|
180456
|
-
executable: string().max(1024).optional(),
|
|
180457
|
-
args: array(string().max(2048)).max(64).optional(),
|
|
180458
|
-
cwd: string().max(1024).optional(),
|
|
180459
|
-
environment: array(string().max(4096)).max(64).optional(),
|
|
180460
|
-
profileSettings: ProfileSettingsBagSchema.optional()
|
|
180461
|
-
}), TerminalInstanceInfoSchema, {
|
|
180462
|
-
kind: "mutation",
|
|
180463
|
-
auth: "admin"
|
|
180464
|
-
}), method(object({ instanceId: string().min(1) }), _void(), {
|
|
180465
|
-
kind: "mutation",
|
|
180466
|
-
auth: "admin"
|
|
180467
|
-
}), method(object({
|
|
180468
|
-
instanceId: string().min(1),
|
|
180469
|
-
enabled: boolean()
|
|
180470
|
-
}), TerminalInstanceInfoSchema, {
|
|
180471
|
-
kind: "mutation",
|
|
180472
|
-
auth: "admin"
|
|
180473
|
-
}), method(_void(), array(TerminalLegacyCameraSchema).readonly(), { auth: "admin" }), method(object({
|
|
180529
|
+
method(_void(), array(TerminalProfileInfoSchema).readonly(), { auth: "admin" }), method(_void(), array(TerminalLegacyCameraSchema).readonly(), { auth: "admin" }), method(object({
|
|
180474
180530
|
stableId: string().min(1),
|
|
180475
180531
|
name: string().trim().min(1).max(160).optional()
|
|
180476
180532
|
}), TerminalInstanceInfoSchema, {
|
|
@@ -180539,6 +180595,11 @@ var TimedRunUnitSchema = _enum(["s", "min"]);
|
|
|
180539
180595
|
_enum(["switch", "pet-fountain"]);
|
|
180540
180596
|
DeviceType.Heater, DeviceType.PetFountain;
|
|
180541
180597
|
var TIMED_RUN_DEVICE_TYPES = [DeviceType.Heater, DeviceType.PetFountain];
|
|
180598
|
+
/** One duration, as the one-tap run asks for it. */
|
|
180599
|
+
var TimedRunQuickRunSchema = object({
|
|
180600
|
+
duration: number().positive().finite(),
|
|
180601
|
+
unit: TimedRunUnitSchema
|
|
180602
|
+
});
|
|
180542
180603
|
/** Why a request was not carried out. Typed, so a caller can say it in words. */
|
|
180543
180604
|
var TimedRunRefusalSchema = _enum([
|
|
180544
180605
|
"unsupported-device",
|
|
@@ -180559,8 +180620,23 @@ var TimedRunStatusSchema = object({
|
|
|
180559
180620
|
activeUntil: number().nullable(),
|
|
180560
180621
|
/** Who asked for the run (a user id or an addon id); `null` when nothing is armed or it did not say. */
|
|
180561
180622
|
requestedBy: string().nullable(),
|
|
180623
|
+
/**
|
|
180624
|
+
* The one-tap run of THIS device: what a "Run" button on any surface starts. `null` when
|
|
180625
|
+
* the device is gone or its type has no timed run; a status from before this field
|
|
180626
|
+
* existed has none, and a surface falls back to the type's default.
|
|
180627
|
+
*/
|
|
180628
|
+
quickRun: TimedRunQuickRunSchema.nullable(),
|
|
180562
180629
|
lastFetchedAt: number()
|
|
180563
180630
|
});
|
|
180631
|
+
/** What the settings form needs: the unit, the bounds and the type's default. */
|
|
180632
|
+
var TimedRunOptionsSchema = object({
|
|
180633
|
+
unit: TimedRunUnitSchema,
|
|
180634
|
+
/** The longest run, in `unit`. */
|
|
180635
|
+
maxDuration: number(),
|
|
180636
|
+
defaultDuration: number()
|
|
180637
|
+
});
|
|
180638
|
+
/** The one-tap run duration, in the type's unit; `null` returns to the type's default. */
|
|
180639
|
+
var TimedRunSettingsPatchSchema = object({ quickRunDuration: number().positive().finite().nullable().optional() });
|
|
180564
180640
|
var timedRunCapability = {
|
|
180565
180641
|
name: "timed-run",
|
|
180566
180642
|
scope: "device",
|
|
@@ -180568,7 +180644,24 @@ var timedRunCapability = {
|
|
|
180568
180644
|
kind: "wrapper",
|
|
180569
180645
|
defaultActive: true,
|
|
180570
180646
|
deviceTypes: TIMED_RUN_DEVICE_TYPES,
|
|
180647
|
+
deviceConfig: { ui: {
|
|
180648
|
+
kind: "derived-form",
|
|
180649
|
+
builderId: "timed-run",
|
|
180650
|
+
tab: "general"
|
|
180651
|
+
} },
|
|
180571
180652
|
methods: {
|
|
180653
|
+
getOptions: method(object({ deviceId: number().int() }), TimedRunOptionsSchema),
|
|
180654
|
+
/**
|
|
180655
|
+
* The one-tap run of this device. A duration above the type's maximum is
|
|
180656
|
+
* REFUSED (thrown), like `runFor`: the maximum is a safety bound.
|
|
180657
|
+
*/
|
|
180658
|
+
setSettings: method(object({
|
|
180659
|
+
deviceId: number().int(),
|
|
180660
|
+
settings: TimedRunSettingsPatchSchema
|
|
180661
|
+
}), _void(), {
|
|
180662
|
+
kind: "mutation",
|
|
180663
|
+
auth: "admin"
|
|
180664
|
+
}),
|
|
180572
180665
|
/**
|
|
180573
180666
|
* Turn the device on and arm its off. A run already armed is replaced (the
|
|
180574
180667
|
* new deadline wins). Refuses with a typed reason above the type's maximum.
|
|
@@ -185872,21 +185965,28 @@ Object.freeze({
|
|
|
185872
185965
|
access: "view",
|
|
185873
185966
|
role: "admin"
|
|
185874
185967
|
},
|
|
185875
|
-
"addonSettings.
|
|
185968
|
+
"addonSettings.getIntegrationFormSchema": {
|
|
185876
185969
|
capName: "addon-settings",
|
|
185877
185970
|
capScope: "system",
|
|
185878
185971
|
addonId: null,
|
|
185879
185972
|
access: "view",
|
|
185880
185973
|
role: "admin"
|
|
185881
185974
|
},
|
|
185882
|
-
"addonSettings.
|
|
185975
|
+
"addonSettings.getScopedSettings": {
|
|
185883
185976
|
capName: "addon-settings",
|
|
185884
185977
|
capScope: "system",
|
|
185885
185978
|
addonId: null,
|
|
185886
185979
|
access: "view",
|
|
185887
185980
|
role: "admin"
|
|
185888
185981
|
},
|
|
185889
|
-
"addonSettings.
|
|
185982
|
+
"addonSettings.listScopedSettings": {
|
|
185983
|
+
capName: "addon-settings",
|
|
185984
|
+
capScope: "system",
|
|
185985
|
+
addonId: null,
|
|
185986
|
+
access: "view",
|
|
185987
|
+
role: "admin"
|
|
185988
|
+
},
|
|
185989
|
+
"addonSettings.readScopedValues": {
|
|
185890
185990
|
capName: "addon-settings",
|
|
185891
185991
|
capScope: "system",
|
|
185892
185992
|
addonId: null,
|
|
@@ -185907,7 +186007,7 @@ Object.freeze({
|
|
|
185907
186007
|
access: "create",
|
|
185908
186008
|
role: "admin"
|
|
185909
186009
|
},
|
|
185910
|
-
"addonSettings.
|
|
186010
|
+
"addonSettings.updateScopedSettings": {
|
|
185911
186011
|
capName: "addon-settings",
|
|
185912
186012
|
capScope: "system",
|
|
185913
186013
|
addonId: null,
|
|
@@ -188077,6 +188177,13 @@ Object.freeze({
|
|
|
188077
188177
|
access: "create",
|
|
188078
188178
|
role: "admin"
|
|
188079
188179
|
},
|
|
188180
|
+
"deviceManager.setAlias": {
|
|
188181
|
+
capName: "device-manager",
|
|
188182
|
+
capScope: "system",
|
|
188183
|
+
addonId: null,
|
|
188184
|
+
access: "create",
|
|
188185
|
+
role: "admin"
|
|
188186
|
+
},
|
|
188080
188187
|
"deviceManager.setChildLayout": {
|
|
188081
188188
|
capName: "device-manager",
|
|
188082
188189
|
capScope: "system",
|
|
@@ -189365,13 +189472,6 @@ Object.freeze({
|
|
|
189365
189472
|
access: "delete",
|
|
189366
189473
|
role: "admin"
|
|
189367
189474
|
},
|
|
189368
|
-
"llm.deleteProfile": {
|
|
189369
|
-
capName: "llm",
|
|
189370
|
-
capScope: "system",
|
|
189371
|
-
addonId: null,
|
|
189372
|
-
access: "delete",
|
|
189373
|
-
role: "admin"
|
|
189374
|
-
},
|
|
189375
189475
|
"llm.generate": {
|
|
189376
189476
|
capName: "llm",
|
|
189377
189477
|
capScope: "system",
|
|
@@ -189435,20 +189535,6 @@ Object.freeze({
|
|
|
189435
189535
|
access: "view",
|
|
189436
189536
|
role: "admin"
|
|
189437
189537
|
},
|
|
189438
|
-
"llm.listProfileKinds": {
|
|
189439
|
-
capName: "llm",
|
|
189440
|
-
capScope: "system",
|
|
189441
|
-
addonId: null,
|
|
189442
|
-
access: "view",
|
|
189443
|
-
role: "admin"
|
|
189444
|
-
},
|
|
189445
|
-
"llm.listProfiles": {
|
|
189446
|
-
capName: "llm",
|
|
189447
|
-
capScope: "system",
|
|
189448
|
-
addonId: null,
|
|
189449
|
-
access: "view",
|
|
189450
|
-
role: "admin"
|
|
189451
|
-
},
|
|
189452
189538
|
"llm.listRuntimeNodes": {
|
|
189453
189539
|
capName: "llm",
|
|
189454
189540
|
capScope: "system",
|
|
@@ -189456,13 +189542,6 @@ Object.freeze({
|
|
|
189456
189542
|
access: "view",
|
|
189457
189543
|
role: "admin"
|
|
189458
189544
|
},
|
|
189459
|
-
"llm.migrateRawSecrets": {
|
|
189460
|
-
capName: "llm",
|
|
189461
|
-
capScope: "system",
|
|
189462
|
-
addonId: null,
|
|
189463
|
-
access: "create",
|
|
189464
|
-
role: "admin"
|
|
189465
|
-
},
|
|
189466
189545
|
"llm.resolveModelRef": {
|
|
189467
189546
|
capName: "llm",
|
|
189468
189547
|
capScope: "system",
|
|
@@ -189491,20 +189570,6 @@ Object.freeze({
|
|
|
189491
189570
|
access: "create",
|
|
189492
189571
|
role: "admin"
|
|
189493
189572
|
},
|
|
189494
|
-
"llm.testProfile": {
|
|
189495
|
-
capName: "llm",
|
|
189496
|
-
capScope: "system",
|
|
189497
|
-
addonId: null,
|
|
189498
|
-
access: "create",
|
|
189499
|
-
role: "admin"
|
|
189500
|
-
},
|
|
189501
|
-
"llm.upsertProfile": {
|
|
189502
|
-
capName: "llm",
|
|
189503
|
-
capScope: "system",
|
|
189504
|
-
addonId: null,
|
|
189505
|
-
access: "create",
|
|
189506
|
-
role: "admin"
|
|
189507
|
-
},
|
|
189508
189573
|
"llmRuntime.appleAvailability": {
|
|
189509
189574
|
capName: "llm-runtime",
|
|
189510
189575
|
capScope: "system",
|
|
@@ -190009,13 +190074,6 @@ Object.freeze({
|
|
|
190009
190074
|
access: "create",
|
|
190010
190075
|
role: "admin"
|
|
190011
190076
|
},
|
|
190012
|
-
"meshNetwork.testConnection": {
|
|
190013
|
-
capName: "mesh-network",
|
|
190014
|
-
capScope: "system",
|
|
190015
|
-
addonId: null,
|
|
190016
|
-
access: "create",
|
|
190017
|
-
role: "admin"
|
|
190018
|
-
},
|
|
190019
190077
|
"meter.getStatus": {
|
|
190020
190078
|
capName: "meter",
|
|
190021
190079
|
capScope: "device",
|
|
@@ -190674,13 +190732,6 @@ Object.freeze({
|
|
|
190674
190732
|
access: "create",
|
|
190675
190733
|
role: "admin"
|
|
190676
190734
|
},
|
|
190677
|
-
"notificationOutput.deleteTarget": {
|
|
190678
|
-
capName: "notification-output",
|
|
190679
|
-
capScope: "system",
|
|
190680
|
-
addonId: null,
|
|
190681
|
-
access: "delete",
|
|
190682
|
-
role: "admin"
|
|
190683
|
-
},
|
|
190684
190735
|
"notificationOutput.discoverTargets": {
|
|
190685
190736
|
capName: "notification-output",
|
|
190686
190737
|
capScope: "system",
|
|
@@ -190688,13 +190739,6 @@ Object.freeze({
|
|
|
190688
190739
|
access: "view",
|
|
190689
190740
|
role: "admin"
|
|
190690
190741
|
},
|
|
190691
|
-
"notificationOutput.getTarget": {
|
|
190692
|
-
capName: "notification-output",
|
|
190693
|
-
capScope: "system",
|
|
190694
|
-
addonId: null,
|
|
190695
|
-
access: "view",
|
|
190696
|
-
role: "admin"
|
|
190697
|
-
},
|
|
190698
190742
|
"notificationOutput.listTargetKinds": {
|
|
190699
190743
|
capName: "notification-output",
|
|
190700
190744
|
capScope: "system",
|
|
@@ -190702,13 +190746,6 @@ Object.freeze({
|
|
|
190702
190746
|
access: "view",
|
|
190703
190747
|
role: "admin"
|
|
190704
190748
|
},
|
|
190705
|
-
"notificationOutput.listTargets": {
|
|
190706
|
-
capName: "notification-output",
|
|
190707
|
-
capScope: "system",
|
|
190708
|
-
addonId: null,
|
|
190709
|
-
access: "view",
|
|
190710
|
-
role: "admin"
|
|
190711
|
-
},
|
|
190712
190749
|
"notificationOutput.probeTargetConfig": {
|
|
190713
190750
|
capName: "notification-output",
|
|
190714
190751
|
capScope: "system",
|
|
@@ -190723,13 +190760,6 @@ Object.freeze({
|
|
|
190723
190760
|
access: "create",
|
|
190724
190761
|
role: "admin"
|
|
190725
190762
|
},
|
|
190726
|
-
"notificationOutput.setTargetEnabled": {
|
|
190727
|
-
capName: "notification-output",
|
|
190728
|
-
capScope: "system",
|
|
190729
|
-
addonId: null,
|
|
190730
|
-
access: "create",
|
|
190731
|
-
role: "admin"
|
|
190732
|
-
},
|
|
190733
190763
|
"notificationOutput.testTarget": {
|
|
190734
190764
|
capName: "notification-output",
|
|
190735
190765
|
capScope: "system",
|
|
@@ -190737,13 +190767,6 @@ Object.freeze({
|
|
|
190737
190767
|
access: "create",
|
|
190738
190768
|
role: "admin"
|
|
190739
190769
|
},
|
|
190740
|
-
"notificationOutput.upsertTarget": {
|
|
190741
|
-
capName: "notification-output",
|
|
190742
|
-
capScope: "system",
|
|
190743
|
-
addonId: null,
|
|
190744
|
-
access: "create",
|
|
190745
|
-
role: "admin"
|
|
190746
|
-
},
|
|
190747
190770
|
"notificationRules.activateAlarmProfile": {
|
|
190748
190771
|
capName: "notification-rules",
|
|
190749
190772
|
capScope: "system",
|
|
@@ -191003,41 +191026,6 @@ Object.freeze({
|
|
|
191003
191026
|
access: "view",
|
|
191004
191027
|
role: "admin"
|
|
191005
191028
|
},
|
|
191006
|
-
"oidcConnections.connectionFormSchema": {
|
|
191007
|
-
capName: "oidc-connections",
|
|
191008
|
-
capScope: "system",
|
|
191009
|
-
addonId: null,
|
|
191010
|
-
access: "view",
|
|
191011
|
-
role: "admin"
|
|
191012
|
-
},
|
|
191013
|
-
"oidcConnections.createConnection": {
|
|
191014
|
-
capName: "oidc-connections",
|
|
191015
|
-
capScope: "system",
|
|
191016
|
-
addonId: null,
|
|
191017
|
-
access: "create",
|
|
191018
|
-
role: "admin"
|
|
191019
|
-
},
|
|
191020
|
-
"oidcConnections.deleteConnection": {
|
|
191021
|
-
capName: "oidc-connections",
|
|
191022
|
-
capScope: "system",
|
|
191023
|
-
addonId: null,
|
|
191024
|
-
access: "delete",
|
|
191025
|
-
role: "admin"
|
|
191026
|
-
},
|
|
191027
|
-
"oidcConnections.listConnections": {
|
|
191028
|
-
capName: "oidc-connections",
|
|
191029
|
-
capScope: "system",
|
|
191030
|
-
addonId: null,
|
|
191031
|
-
access: "view",
|
|
191032
|
-
role: "admin"
|
|
191033
|
-
},
|
|
191034
|
-
"oidcConnections.updateConnection": {
|
|
191035
|
-
capName: "oidc-connections",
|
|
191036
|
-
capScope: "system",
|
|
191037
|
-
addonId: null,
|
|
191038
|
-
access: "create",
|
|
191039
|
-
role: "admin"
|
|
191040
|
-
},
|
|
191041
191029
|
"osd.getStatus": {
|
|
191042
191030
|
capName: "osd",
|
|
191043
191031
|
capScope: "device",
|
|
@@ -194069,13 +194057,6 @@ Object.freeze({
|
|
|
194069
194057
|
access: "delete",
|
|
194070
194058
|
role: "admin"
|
|
194071
194059
|
},
|
|
194072
|
-
"storage.deleteLocation": {
|
|
194073
|
-
capName: "storage",
|
|
194074
|
-
capScope: "system",
|
|
194075
|
-
addonId: null,
|
|
194076
|
-
access: "delete",
|
|
194077
|
-
role: "admin"
|
|
194078
|
-
},
|
|
194079
194060
|
"storage.endDownload": {
|
|
194080
194061
|
capName: "storage",
|
|
194081
194062
|
capScope: "system",
|
|
@@ -194132,13 +194113,6 @@ Object.freeze({
|
|
|
194132
194113
|
access: "view",
|
|
194133
194114
|
role: "admin"
|
|
194134
194115
|
},
|
|
194135
|
-
"storage.listProviders": {
|
|
194136
|
-
capName: "storage",
|
|
194137
|
-
capScope: "system",
|
|
194138
|
-
addonId: null,
|
|
194139
|
-
access: "view",
|
|
194140
|
-
role: "admin"
|
|
194141
|
-
},
|
|
194142
194116
|
"storage.read": {
|
|
194143
194117
|
capName: "storage",
|
|
194144
194118
|
capScope: "system",
|
|
@@ -194160,27 +194134,6 @@ Object.freeze({
|
|
|
194160
194134
|
access: "view",
|
|
194161
194135
|
role: "admin"
|
|
194162
194136
|
},
|
|
194163
|
-
"storage.testConfig": {
|
|
194164
|
-
capName: "storage",
|
|
194165
|
-
capScope: "system",
|
|
194166
|
-
addonId: null,
|
|
194167
|
-
access: "view",
|
|
194168
|
-
role: "admin"
|
|
194169
|
-
},
|
|
194170
|
-
"storage.testLocation": {
|
|
194171
|
-
capName: "storage",
|
|
194172
|
-
capScope: "system",
|
|
194173
|
-
addonId: null,
|
|
194174
|
-
access: "view",
|
|
194175
|
-
role: "admin"
|
|
194176
|
-
},
|
|
194177
|
-
"storage.upsertLocation": {
|
|
194178
|
-
capName: "storage",
|
|
194179
|
-
capScope: "system",
|
|
194180
|
-
addonId: null,
|
|
194181
|
-
access: "create",
|
|
194182
|
-
role: "admin"
|
|
194183
|
-
},
|
|
194184
194137
|
"storage.write": {
|
|
194185
194138
|
capName: "storage",
|
|
194186
194139
|
capScope: "system",
|
|
@@ -194958,27 +194911,6 @@ Object.freeze({
|
|
|
194958
194911
|
access: "create",
|
|
194959
194912
|
role: "admin"
|
|
194960
194913
|
},
|
|
194961
|
-
"terminalSession.createInstance": {
|
|
194962
|
-
capName: "terminal-session",
|
|
194963
|
-
capScope: "system",
|
|
194964
|
-
addonId: null,
|
|
194965
|
-
access: "create",
|
|
194966
|
-
role: "admin"
|
|
194967
|
-
},
|
|
194968
|
-
"terminalSession.deleteInstance": {
|
|
194969
|
-
capName: "terminal-session",
|
|
194970
|
-
capScope: "system",
|
|
194971
|
-
addonId: null,
|
|
194972
|
-
access: "delete",
|
|
194973
|
-
role: "admin"
|
|
194974
|
-
},
|
|
194975
|
-
"terminalSession.listInstances": {
|
|
194976
|
-
capName: "terminal-session",
|
|
194977
|
-
capScope: "system",
|
|
194978
|
-
addonId: null,
|
|
194979
|
-
access: "view",
|
|
194980
|
-
role: "admin"
|
|
194981
|
-
},
|
|
194982
194914
|
"terminalSession.listLegacyCameras": {
|
|
194983
194915
|
capName: "terminal-session",
|
|
194984
194916
|
capScope: "system",
|
|
@@ -195021,20 +194953,6 @@ Object.freeze({
|
|
|
195021
194953
|
access: "create",
|
|
195022
194954
|
role: "admin"
|
|
195023
194955
|
},
|
|
195024
|
-
"terminalSession.setInstanceEnabled": {
|
|
195025
|
-
capName: "terminal-session",
|
|
195026
|
-
capScope: "system",
|
|
195027
|
-
addonId: null,
|
|
195028
|
-
access: "create",
|
|
195029
|
-
role: "admin"
|
|
195030
|
-
},
|
|
195031
|
-
"terminalSession.updateInstance": {
|
|
195032
|
-
capName: "terminal-session",
|
|
195033
|
-
capScope: "system",
|
|
195034
|
-
addonId: null,
|
|
195035
|
-
access: "create",
|
|
195036
|
-
role: "admin"
|
|
195037
|
-
},
|
|
195038
194956
|
"terminalSession.writeInput": {
|
|
195039
194957
|
capName: "terminal-session",
|
|
195040
194958
|
capScope: "system",
|
|
@@ -195049,6 +194967,13 @@ Object.freeze({
|
|
|
195049
194967
|
access: "create",
|
|
195050
194968
|
role: "viewer"
|
|
195051
194969
|
},
|
|
194970
|
+
"timedRun.getOptions": {
|
|
194971
|
+
capName: "timed-run",
|
|
194972
|
+
capScope: "device",
|
|
194973
|
+
addonId: null,
|
|
194974
|
+
access: "view",
|
|
194975
|
+
role: "viewer"
|
|
194976
|
+
},
|
|
195052
194977
|
"timedRun.getStatus": {
|
|
195053
194978
|
capName: "timed-run",
|
|
195054
194979
|
capScope: "device",
|
|
@@ -195063,6 +194988,13 @@ Object.freeze({
|
|
|
195063
194988
|
access: "create",
|
|
195064
194989
|
role: "viewer"
|
|
195065
194990
|
},
|
|
194991
|
+
"timedRun.setSettings": {
|
|
194992
|
+
capName: "timed-run",
|
|
194993
|
+
capScope: "device",
|
|
194994
|
+
addonId: null,
|
|
194995
|
+
access: "create",
|
|
194996
|
+
role: "admin"
|
|
194997
|
+
},
|
|
195066
194998
|
"toast.onToast": {
|
|
195067
194999
|
capName: "toast",
|
|
195068
195000
|
capScope: "system",
|
|
@@ -196145,6 +196077,7 @@ function createRuntimeStateBridge(params) {
|
|
|
196145
196077
|
getStatus
|
|
196146
196078
|
};
|
|
196147
196079
|
}
|
|
196080
|
+
string().min(1).max(4096);
|
|
196148
196081
|
Object.freeze({
|
|
196149
196082
|
"accessories.getStatus": [{
|
|
196150
196083
|
name: "deviceId",
|
|
@@ -196828,6 +196761,11 @@ Object.freeze({
|
|
|
196828
196761
|
form: "single",
|
|
196829
196762
|
optional: false
|
|
196830
196763
|
}],
|
|
196764
|
+
"deviceManager.setAlias": [{
|
|
196765
|
+
name: "deviceId",
|
|
196766
|
+
form: "single",
|
|
196767
|
+
optional: false
|
|
196768
|
+
}],
|
|
196831
196769
|
"deviceManager.setChildLayout": [{
|
|
196832
196770
|
name: "deviceId",
|
|
196833
196771
|
form: "single",
|
|
@@ -198892,6 +198830,11 @@ Object.freeze({
|
|
|
198892
198830
|
form: "single",
|
|
198893
198831
|
optional: false
|
|
198894
198832
|
}],
|
|
198833
|
+
"timedRun.getOptions": [{
|
|
198834
|
+
name: "deviceId",
|
|
198835
|
+
form: "single",
|
|
198836
|
+
optional: false
|
|
198837
|
+
}],
|
|
198895
198838
|
"timedRun.getStatus": [{
|
|
198896
198839
|
name: "deviceId",
|
|
198897
198840
|
form: "single",
|
|
@@ -198902,6 +198845,11 @@ Object.freeze({
|
|
|
198902
198845
|
form: "single",
|
|
198903
198846
|
optional: false
|
|
198904
198847
|
}],
|
|
198848
|
+
"timedRun.setSettings": [{
|
|
198849
|
+
name: "deviceId",
|
|
198850
|
+
form: "single",
|
|
198851
|
+
optional: false
|
|
198852
|
+
}],
|
|
198905
198853
|
"update.getStatus": [{
|
|
198906
198854
|
name: "deviceId",
|
|
198907
198855
|
form: "single",
|
|
@@ -199764,6 +199712,7 @@ var STATE_SUMMARY_VARS = [
|
|
|
199764
199712
|
[...RULE_TEXT],
|
|
199765
199713
|
[...RULE_TEXT],
|
|
199766
199714
|
[...RULE_TEXT],
|
|
199715
|
+
[...RULE_TEXT],
|
|
199767
199716
|
[...RULE_BODY_ONLY],
|
|
199768
199717
|
[...RULE_TEXT],
|
|
199769
199718
|
([...RULE_TEXT], [...DEVICE_EVENTS]),
|
|
@@ -221438,7 +221387,13 @@ function buildReolinkInstances(records, deps) {
|
|
|
221438
221387
|
},
|
|
221439
221388
|
instanceMode: "multiple",
|
|
221440
221389
|
kind: "connection",
|
|
221441
|
-
canTest: false
|
|
221390
|
+
canTest: false,
|
|
221391
|
+
kinds: [{
|
|
221392
|
+
id: "connection",
|
|
221393
|
+
label: "Reolink",
|
|
221394
|
+
functionCap: "device-provider",
|
|
221395
|
+
role: "devices"
|
|
221396
|
+
}]
|
|
221442
221397
|
},
|
|
221443
221398
|
formSchema: () => buildHubInstanceSchema(),
|
|
221444
221399
|
initialBody: (name) => ({ name }),
|