@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.js
CHANGED
|
@@ -100695,7 +100695,7 @@ function parseBaichuanWebhookObject(mess) {
|
|
|
100695
100695
|
return parsed;
|
|
100696
100696
|
}
|
|
100697
100697
|
//#endregion
|
|
100698
|
-
//#region ../types/dist/event-category-
|
|
100698
|
+
//#region ../types/dist/event-category-78tcBemo.mjs
|
|
100699
100699
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
100700
100700
|
EventCategory["SystemBoot"] = "system.boot";
|
|
100701
100701
|
EventCategory["SystemAddonsReady"] = "system.addons-ready";
|
|
@@ -100816,6 +100816,23 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
100816
100816
|
*/
|
|
100817
100817
|
EventCategory["AddonLoadRecovered"] = "addon.load-recovered";
|
|
100818
100818
|
/**
|
|
100819
|
+
* An addon is RUNNING although its installed package is below what the
|
|
100820
|
+
* running server requires (`camstack.requires.addons` of the server, or the
|
|
100821
|
+
* addon's own `requires.server`). Raised once per streak by the unsupported-
|
|
100822
|
+
* addon tracker, on the hub and on agents; AlertCenter turns it into one
|
|
100823
|
+
* operator alert per node and package. The addon is never held back for it.
|
|
100824
|
+
*
|
|
100825
|
+
* Payload: `{ packageName, addonId, nodeId, installedVersion, requiredMinimum, serverVersion, unmet }`.
|
|
100826
|
+
*/
|
|
100827
|
+
EventCategory["AddonUnsupportedVersion"] = "addon.unsupported-version";
|
|
100828
|
+
/**
|
|
100829
|
+
* The package of an {@link AddonUnsupportedVersion} alert reached a supported
|
|
100830
|
+
* version, or is no longer installed on the node. AlertCenter dismisses the matching alert.
|
|
100831
|
+
*
|
|
100832
|
+
* Payload: `{ packageName, addonId, nodeId }`.
|
|
100833
|
+
*/
|
|
100834
|
+
EventCategory["AddonUnsupportedResolved"] = "addon.unsupported-resolved";
|
|
100835
|
+
/**
|
|
100819
100836
|
* Monitor scheduled the next retry for a failed addon. Transient —
|
|
100820
100837
|
* surfaced to the UI for live-updating the "next retry in Ns"
|
|
100821
100838
|
* countdown on the Addons page row, NOT persisted as an alert.
|
|
@@ -100926,7 +100943,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
100926
100943
|
EventCategory["ProcessRestarted"] = "process.restarted";
|
|
100927
100944
|
/**
|
|
100928
100945
|
* The SET of storage locations changed — one was created, edited, enabled,
|
|
100929
|
-
* disabled or deleted through
|
|
100946
|
+
* disabled or deleted through the location instances or the forced-delete action.
|
|
100930
100947
|
*
|
|
100931
100948
|
* Telemetry, not a transaction (D8/D11): every consumer that re-resolves on
|
|
100932
100949
|
* it must also converge on its own periodic path, because a dropped event
|
|
@@ -101481,7 +101498,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
101481
101498
|
return EventCategory;
|
|
101482
101499
|
}({});
|
|
101483
101500
|
//#endregion
|
|
101484
|
-
//#region ../types/dist/device-type-
|
|
101501
|
+
//#region ../types/dist/device-type-DxCT0krO.mjs
|
|
101485
101502
|
/**
|
|
101486
101503
|
import { errMsg } from '@camstack/types'
|
|
101487
101504
|
* Extract a human-readable message from an unknown error value.
|
|
@@ -101643,6 +101660,13 @@ var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
|
|
|
101643
101660
|
* filters that want "all devices with on-motion behaviour".
|
|
101644
101661
|
*/
|
|
101645
101662
|
DeviceFeature["MotionTrigger"] = "motion-trigger";
|
|
101663
|
+
/**
|
|
101664
|
+
* Device can be run for a chosen time and then stopped. Mirrors the
|
|
101665
|
+
* `timed-run` wrapper cap — the cap is bound by the core-blocks addon, not by
|
|
101666
|
+
* a driver, so the flag is derived from the device's bindings
|
|
101667
|
+
* (`featuresOfBoundCaps`). Gates the quick-run control in the viewer.
|
|
101668
|
+
*/
|
|
101669
|
+
DeviceFeature["TimedRun"] = "timed-run";
|
|
101646
101670
|
/** Light supports rgb-triplet color via `color` cap. */
|
|
101647
101671
|
DeviceFeature["LightColorRgb"] = "light-color-rgb";
|
|
101648
101672
|
/** Light supports HSV color via `color` cap. */
|
|
@@ -106677,7 +106701,7 @@ var ZodIssueCode = {
|
|
|
106677
106701
|
var ZodFirstPartyTypeKind;
|
|
106678
106702
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
106679
106703
|
//#endregion
|
|
106680
|
-
//#region ../types/dist/sleep-
|
|
106704
|
+
//#region ../types/dist/sleep-CGPZyzB5.mjs
|
|
106681
106705
|
/**
|
|
106682
106706
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
106683
106707
|
* window to float samples (D455).
|
|
@@ -107041,6 +107065,59 @@ Object.fromEntries([
|
|
|
107041
107065
|
function isValuelessField(field) {
|
|
107042
107066
|
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";
|
|
107043
107067
|
}
|
|
107068
|
+
/**
|
|
107069
|
+
* Base collector: flatten a hydrated `ConfigUISchemaWithValues` into
|
|
107070
|
+
* `key → { value, default }`, recursing through `group` and `sub-tabs`
|
|
107071
|
+
* layout fields. Keeping `value` and `default` SEPARATE (rather than
|
|
107072
|
+
* pre-resolving) lets callers both read the effective value AND detect
|
|
107073
|
+
* overrides (`value` differs from `default`). Structural over `unknown`;
|
|
107074
|
+
* malformed input yields an empty map, never throws.
|
|
107075
|
+
*/
|
|
107076
|
+
function collectHydratedFieldEntries(schema) {
|
|
107077
|
+
const out = /* @__PURE__ */ new Map();
|
|
107078
|
+
if (typeof schema !== "object" || schema === null) return out;
|
|
107079
|
+
const sections = schema.sections;
|
|
107080
|
+
if (!Array.isArray(sections)) return out;
|
|
107081
|
+
for (const section of sections) if (typeof section === "object" && section !== null) collectFieldEntriesInto(section.fields, out);
|
|
107082
|
+
return out;
|
|
107083
|
+
}
|
|
107084
|
+
/** Recursive field walker for {@link collectHydratedFieldEntries}. */
|
|
107085
|
+
function collectFieldEntriesInto(fields, into) {
|
|
107086
|
+
if (!Array.isArray(fields)) return;
|
|
107087
|
+
for (const field of fields) {
|
|
107088
|
+
if (typeof field !== "object" || field === null) continue;
|
|
107089
|
+
const type = field.type;
|
|
107090
|
+
if (type === "group") {
|
|
107091
|
+
collectFieldEntriesInto(field.fields, into);
|
|
107092
|
+
continue;
|
|
107093
|
+
}
|
|
107094
|
+
if (type === "sub-tabs") {
|
|
107095
|
+
const tabs = field.tabs;
|
|
107096
|
+
if (Array.isArray(tabs)) {
|
|
107097
|
+
for (const tab of tabs) if (typeof tab === "object" && tab !== null) collectFieldEntriesInto(tab.fields, into);
|
|
107098
|
+
}
|
|
107099
|
+
continue;
|
|
107100
|
+
}
|
|
107101
|
+
const key = field.key;
|
|
107102
|
+
if (typeof key !== "string" || key.length === 0) continue;
|
|
107103
|
+
if (!("value" in field)) continue;
|
|
107104
|
+
into.set(key, {
|
|
107105
|
+
value: field.value,
|
|
107106
|
+
default: field.default
|
|
107107
|
+
});
|
|
107108
|
+
}
|
|
107109
|
+
}
|
|
107110
|
+
/**
|
|
107111
|
+
* Flatten a hydrated settings payload into `key → EFFECTIVE value`
|
|
107112
|
+
* (`value ?? default`). The read-side inverse of `hydrateSchema` for the
|
|
107113
|
+
* common "just give me the resolved values" case. Built on
|
|
107114
|
+
* {@link collectHydratedFieldEntries}.
|
|
107115
|
+
*/
|
|
107116
|
+
function collectHydratedFieldValues(schema) {
|
|
107117
|
+
const out = /* @__PURE__ */ new Map();
|
|
107118
|
+
for (const [key, entry] of collectHydratedFieldEntries(schema)) out.set(key, entry.value ?? entry.default);
|
|
107119
|
+
return out;
|
|
107120
|
+
}
|
|
107044
107121
|
function hydrateSchema(schema, values, options = {}) {
|
|
107045
107122
|
return {
|
|
107046
107123
|
...schema.tabs ? { tabs: [...schema.tabs] } : {},
|
|
@@ -107856,6 +107933,7 @@ var RecordIntegrationInstances = class {
|
|
|
107856
107933
|
this.secretKeys = topLevelSecretKeys(kind.declaration.secretPaths);
|
|
107857
107934
|
this.secretMaps = secretMapKeys(kind.declaration.secretPaths);
|
|
107858
107935
|
this.nameField = kind.declaration.entry?.nameField ?? "name";
|
|
107936
|
+
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`);
|
|
107859
107937
|
}
|
|
107860
107938
|
/**
|
|
107861
107939
|
* One instance read for the addon's own runtime; null when absent. When the keychain is
|
|
@@ -107897,10 +107975,21 @@ var RecordIntegrationInstances = class {
|
|
|
107897
107975
|
}
|
|
107898
107976
|
return out;
|
|
107899
107977
|
}
|
|
107978
|
+
/** The kind an instance body is of: the provider's `kindOf`, else its one declared kind. */
|
|
107979
|
+
kindOfBody(body) {
|
|
107980
|
+
if (this.hooks.kindOf !== void 0) {
|
|
107981
|
+
const id = this.hooks.kindOf(body);
|
|
107982
|
+
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)`);
|
|
107983
|
+
return id;
|
|
107984
|
+
}
|
|
107985
|
+
const only = this.hooks.description.kinds[0];
|
|
107986
|
+
if (only === void 0) throw new Error(`record kind '${this.kind.name}' declares no kinds`);
|
|
107987
|
+
return only.id;
|
|
107988
|
+
}
|
|
107900
107989
|
viewOf(record) {
|
|
107901
107990
|
const shown = secretViewsOf(this.records.owner, this.kind.name, record.id, this.kind.declaration, record.data);
|
|
107902
107991
|
const rawName = record.data[this.nameField];
|
|
107903
|
-
const kind = this.
|
|
107992
|
+
const kind = this.kindOfBody(record.data);
|
|
107904
107993
|
const health = this.hooks.health?.(record.data, record.id);
|
|
107905
107994
|
return {
|
|
107906
107995
|
id: record.id,
|
|
@@ -107908,7 +107997,7 @@ var RecordIntegrationInstances = class {
|
|
|
107908
107997
|
configured: this.hooks.configured(record.data),
|
|
107909
107998
|
enabled: isInstanceEnabled(record.data),
|
|
107910
107999
|
formValues: shown,
|
|
107911
|
-
|
|
108000
|
+
kind,
|
|
107912
108001
|
...health?.status !== void 0 ? { status: health.status } : {},
|
|
107913
108002
|
...health?.lastCheckedAt !== void 0 ? { lastCheckedAt: health.lastCheckedAt } : {}
|
|
107914
108003
|
};
|
|
@@ -107941,17 +108030,35 @@ var RecordIntegrationInstances = class {
|
|
|
107941
108030
|
...kind !== void 0 ? { kind } : {}
|
|
107942
108031
|
});
|
|
107943
108032
|
if (minted === void 0) throw new Error("createInstance needs an id: this provider does not mint one");
|
|
108033
|
+
const initial = this.hooks.initialBody(name, kind);
|
|
108034
|
+
const patch = this.patchOf(values ?? {});
|
|
108035
|
+
if (Object.keys(patch).length > 0) Object.assign(patch, await this.hooks.validateWrite?.({
|
|
108036
|
+
kind,
|
|
108037
|
+
body: {
|
|
108038
|
+
...initial,
|
|
108039
|
+
...patch
|
|
108040
|
+
}
|
|
108041
|
+
}));
|
|
107944
108042
|
await this.handle.put({
|
|
107945
108043
|
id: minted,
|
|
107946
|
-
data:
|
|
108044
|
+
data: initial
|
|
107947
108045
|
}, { ifRev: 0 });
|
|
107948
|
-
const patch = this.patchOf(values ?? {});
|
|
107949
108046
|
if (Object.keys(patch).length > 0) await this.handle.patch(minted, patch);
|
|
107950
108047
|
await this.hooks.onChanged?.(minted, "created");
|
|
107951
108048
|
return { id: minted };
|
|
107952
108049
|
};
|
|
107953
108050
|
updateInstance = async ({ id, name, values }) => {
|
|
107954
108051
|
const patch = this.patchOf(values);
|
|
108052
|
+
if (this.hooks.validateWrite !== void 0 && Object.keys(patch).length > 0) {
|
|
108053
|
+
const stored = await this.handle.get(id);
|
|
108054
|
+
if (stored !== null) Object.assign(patch, await this.hooks.validateWrite({
|
|
108055
|
+
kind: void 0,
|
|
108056
|
+
body: {
|
|
108057
|
+
...stored.data,
|
|
108058
|
+
...patch
|
|
108059
|
+
}
|
|
108060
|
+
}));
|
|
108061
|
+
}
|
|
107955
108062
|
if (name !== void 0) patch[this.nameField] = name;
|
|
107956
108063
|
await this.handle.patch(id, patch);
|
|
107957
108064
|
await this.hooks.onChanged?.(id, "updated");
|
|
@@ -108262,6 +108369,21 @@ var SCOPED_SETTINGS_SCOPES = [
|
|
|
108262
108369
|
"device-defaults",
|
|
108263
108370
|
"node"
|
|
108264
108371
|
];
|
|
108372
|
+
/** The one refusal of a key a scope did not declare. */
|
|
108373
|
+
function assertDeclaredKeys(keys, declared) {
|
|
108374
|
+
const undeclared = keys.filter((key) => !declared.has(key));
|
|
108375
|
+
if (undeclared.length > 0) throw new Error(`scoped settings: [${undeclared.join(", ")}] not declared for this scope (declared: [${[...declared].join(", ")}])`);
|
|
108376
|
+
}
|
|
108377
|
+
/** Build the handle over an addon's scoped read, write and unset. */
|
|
108378
|
+
function createScopedSettings(deps) {
|
|
108379
|
+
return {
|
|
108380
|
+
async get() {
|
|
108381
|
+
return deps.schema.parse(await deps.read());
|
|
108382
|
+
},
|
|
108383
|
+
patch: (patch) => deps.write(Object.fromEntries(Object.entries(patch))),
|
|
108384
|
+
unset: (keys) => deps.unset(keys)
|
|
108385
|
+
};
|
|
108386
|
+
}
|
|
108265
108387
|
/** A write to a secret path could not be stored in the keychain, so it was refused. */
|
|
108266
108388
|
var KeychainWriteRefusedError = class extends Error {
|
|
108267
108389
|
fieldPath;
|
|
@@ -108837,7 +108959,16 @@ function createHandle(raw, opts) {
|
|
|
108837
108959
|
return blob;
|
|
108838
108960
|
}
|
|
108839
108961
|
},
|
|
108840
|
-
writeAddonStore: writeAddon
|
|
108962
|
+
writeAddonStore: writeAddon,
|
|
108963
|
+
removeClearedKeys: (keys) => serialize("addon", async () => {
|
|
108964
|
+
const stored = await readStoredAddonBlob(raw);
|
|
108965
|
+
index.seen("addon", stored);
|
|
108966
|
+
const removable = keys.filter((key) => collectSecretMarkerRefs(stored[key]).length === 0);
|
|
108967
|
+
if (removable.length === 0) return;
|
|
108968
|
+
const patch = Object.fromEntries(removable.map((key) => [key, void 0]));
|
|
108969
|
+
await raw.writeAddonStore(patch);
|
|
108970
|
+
index.wrote("addon", patch);
|
|
108971
|
+
})
|
|
108841
108972
|
};
|
|
108842
108973
|
}
|
|
108843
108974
|
/** The context the addon sees, plus the private raw view and write outcome. */
|
|
@@ -108967,7 +109098,7 @@ function boundOf(list) {
|
|
|
108967
109098
|
* Base class for CamStack addons. Eliminates settings boilerplate:
|
|
108968
109099
|
*
|
|
108969
109100
|
* - Typed `config` property with automatic resolution from store + defaults
|
|
108970
|
-
* -
|
|
109101
|
+
* - the scoped settings API (`clusterSettings` / `nodeSettings` / `deviceDefaults`) auto-implemented
|
|
108971
109102
|
* - `getAddonSettings()` / `updateAddonSettings()` auto-implemented
|
|
108972
109103
|
* - `getDeviceSettings()` / `updateDeviceSettings()` auto-implemented
|
|
108973
109104
|
* - `ctx` accessor for the AddonContext (no manual `this.ctxRef` storage)
|
|
@@ -108977,7 +109108,7 @@ function boundOf(list) {
|
|
|
108977
109108
|
* Subclasses override:
|
|
108978
109109
|
* - `onInitialize()` — addon-specific init logic, return ProviderRegistration[]
|
|
108979
109110
|
* - `onShutdown()` — cleanup
|
|
108980
|
-
* - `
|
|
109111
|
+
* - `clusterSettingsSchema()` / `nodeSettingsSchema()` / `deviceSettingsSchema()` — UI schemas
|
|
108981
109112
|
*
|
|
108982
109113
|
* @example
|
|
108983
109114
|
* ```ts
|
|
@@ -108991,7 +109122,7 @@ function boundOf(list) {
|
|
|
108991
109122
|
* super({ maxRetries: 3, endpoint: 'http://localhost' })
|
|
108992
109123
|
* }
|
|
108993
109124
|
*
|
|
108994
|
-
* protected
|
|
109125
|
+
* protected clusterSettingsSchema() {
|
|
108995
109126
|
* return this.schema({
|
|
108996
109127
|
* sections: [{
|
|
108997
109128
|
* id: 'main', title: 'Settings',
|
|
@@ -109034,7 +109165,7 @@ var BaseAddon = class {
|
|
|
109034
109165
|
defaults;
|
|
109035
109166
|
/**
|
|
109036
109167
|
* Hidden-state paths that hold secrets (D787) — values the addon writes
|
|
109037
|
-
* itself (`
|
|
109168
|
+
* itself (`state()`, the scoped writers) that no form field declares.
|
|
109038
109169
|
* Stored in the keychain exactly like a `password` field. Syntax:
|
|
109039
109170
|
* `'snapshotSigningKey'`, `'identity.pincode'`, `'tokens[userId].accessToken'`
|
|
109040
109171
|
* (`key[<id field>]` addresses array items by id, never by index).
|
|
@@ -109044,7 +109175,7 @@ var BaseAddon = class {
|
|
|
109044
109175
|
/**
|
|
109045
109176
|
* D986 M4: the scoped schemas this addon declared, resolved once per capability
|
|
109046
109177
|
* (`loadScopedSchemas`) so the sync readers (`perNodeKeys`, the secret tree, the restart check)
|
|
109047
|
-
* see them. Empty until loaded
|
|
109178
|
+
* see them. Empty until loaded.
|
|
109048
109179
|
*/
|
|
109049
109180
|
_scopedByCap = /* @__PURE__ */ new Map();
|
|
109050
109181
|
_nodeKeysByCap = /* @__PURE__ */ new Map();
|
|
@@ -109230,7 +109361,7 @@ var BaseAddon = class {
|
|
|
109230
109361
|
/** Addon-specific cleanup. Override if needed. */
|
|
109231
109362
|
async onShutdown() {}
|
|
109232
109363
|
/**
|
|
109233
|
-
* Called after config is resolved during
|
|
109364
|
+
* Called after config is resolved during a settings write.
|
|
109234
109365
|
* Override to react to config changes (e.g. restart a sampler, reconnect a service).
|
|
109235
109366
|
* Not called during initialize() — use onInitialize() for initial setup.
|
|
109236
109367
|
*/
|
|
@@ -109259,82 +109390,12 @@ var BaseAddon = class {
|
|
|
109259
109390
|
scopedSettingsCapabilities() {
|
|
109260
109391
|
return [];
|
|
109261
109392
|
}
|
|
109262
|
-
/** Override to provide global-level settings UI schema. */
|
|
109263
|
-
globalSettingsSchema(_cap) {
|
|
109264
|
-
return null;
|
|
109265
|
-
}
|
|
109266
109393
|
/** Override to provide device-level settings UI schema. */
|
|
109267
109394
|
deviceSettingsSchema() {
|
|
109268
109395
|
return null;
|
|
109269
109396
|
}
|
|
109270
109397
|
/**
|
|
109271
|
-
*
|
|
109272
|
-
* ARE the configuration of its integration.
|
|
109273
|
-
*
|
|
109274
|
-
* Return the `ConfigSection.id`s, from {@link globalSettingsSchema}, that an
|
|
109275
|
-
* operator should find on the addon's integration page (System →
|
|
109276
|
-
* Integrations → <name>) rather than only in the cluster-wide list of every
|
|
109277
|
-
* addon. Empty (the default) means the addon has no integration-level
|
|
109278
|
-
* settings and no such surface is offered — this is opt-in, because whether
|
|
109279
|
-
* an addon's configuration IS its integration's configuration depends on the
|
|
109280
|
-
* nature of the integration.
|
|
109281
|
-
*
|
|
109282
|
-
* WHAT THIS IS NOT. It is not a scope. The selected sections keep living in
|
|
109283
|
-
* the ONE global schema, in the ONE addon store, written by the ONE
|
|
109284
|
-
* `updateGlobalSettings` path. There is deliberately no
|
|
109285
|
-
* `updateIntegrationSettings`: a second write path is how a surface acquires
|
|
109286
|
-
* a second store key, and this repo has shipped that twice (`btmPath@hub`,
|
|
109287
|
-
* D266). Selecting sections cannot introduce a key that selecting cannot.
|
|
109288
|
-
*
|
|
109289
|
-
* WHY IT IS A LIST OF SECTION IDS AND NOT A MARKER ON THE SECTION.
|
|
109290
|
-
* `ConfigFieldBase` used to carry `scope?: 'device' | 'global'` and it was
|
|
109291
|
-
* removed with the reason recorded at
|
|
109292
|
-
* `packages/types/src/interfaces/config-ui.ts:249` — *"a field's scope is
|
|
109293
|
-
* determined by WHICH schema it lives in, not by a field-level marker."* A
|
|
109294
|
-
* marker sprinkled across sections also has to borrow a field that already
|
|
109295
|
-
* means something else; borrowing `section.tab` put the literal word
|
|
109296
|
-
* "integration" into an operator-facing tab bar, because `tab` means "how to
|
|
109297
|
-
* GROUP this visually" and cannot also mean "where this lives" (D269
|
|
109298
|
-
* supersedes D268). One declaration, in one place, next to the schema whose
|
|
109299
|
-
* ids it names.
|
|
109300
|
-
*/
|
|
109301
|
-
integrationSettingSections() {
|
|
109302
|
-
return [];
|
|
109303
|
-
}
|
|
109304
|
-
async getGlobalSettings(overlay, cap, nodeId) {
|
|
109305
|
-
await this.loadScopedSchemas(cap);
|
|
109306
|
-
const schema = this.globalSettingsSchema(cap) ?? this.scopedFormSchema(cap);
|
|
109307
|
-
if (!schema) return { sections: [] };
|
|
109308
|
-
const projected = await this.readRawProjectedStore(nodeId, cap);
|
|
109309
|
-
return hydrateSchema(schema, overlay ? await this.overlayKeepingMarkers(projected, overlay) : projected, { inlineSecretsAsViews: true });
|
|
109310
|
-
}
|
|
109311
|
-
/**
|
|
109312
|
-
* The integration-level view of this addon's settings: exactly the sections
|
|
109313
|
-
* named by {@link integrationSettingSections}, hydrated from the SAME store
|
|
109314
|
-
* `getGlobalSettings` reads, and narrowed to cluster-scoped fields.
|
|
109315
|
-
*
|
|
109316
|
-
* Returns `null` when the addon declared nothing — an addon that opts out has
|
|
109317
|
-
* no integration settings surface at all, rather than an empty one that reads
|
|
109318
|
-
* as a failed load.
|
|
109319
|
-
*
|
|
109320
|
-
* Three properties hold BY CONSTRUCTION, which is why they are here in core
|
|
109321
|
-
* and not in whichever UI happens to render this:
|
|
109322
|
-
*
|
|
109323
|
-
* 1. **One key.** The payload is a SUBSET of the global schema, so a field
|
|
109324
|
-
* shown here is the same field, with the same bare key, that the addon's
|
|
109325
|
-
* own page shows. There is no integration-specific writer — callers save
|
|
109326
|
-
* through `updateGlobalSettings` — so a second store key is unreachable,
|
|
109327
|
-
* not merely discouraged.
|
|
109328
|
-
* 2. **No node scope.** `perNode: true` fields are DROPPED. Their store key
|
|
109329
|
-
* is `<key>@<nodeId>` and an integration is not a node; whichever node
|
|
109330
|
-
* such a field silently picked would be a wrong answer for the operator
|
|
109331
|
-
* who opened the page (D266).
|
|
109332
|
-
* 3. **No silent typo.** A declared id that names no section throws. The
|
|
109333
|
-
* alternative — skip it — turns a rename into a surface that quietly
|
|
109334
|
-
* empties, which looks exactly like an addon with nothing to configure.
|
|
109335
|
-
*/
|
|
109336
|
-
/**
|
|
109337
|
-
* The form schema of ONE integration instance, or `null` to use {@link globalSettingsSchema}.
|
|
109398
|
+
* The form schema of ONE integration instance, or `null` to use the scoped form.
|
|
109338
109399
|
*
|
|
109339
109400
|
* Override it only when an `instanceMode: multiple` addon's instances differ: an NVR integration
|
|
109340
109401
|
* needs its connection fields, the default integration the addon's own sections. It is the
|
|
@@ -109382,37 +109443,178 @@ var BaseAddon = class {
|
|
|
109382
109443
|
}
|
|
109383
109444
|
}
|
|
109384
109445
|
/**
|
|
109446
|
+
* Hook: values layered over the stored ones when the FORM of one scope is served
|
|
109447
|
+
* ({@link getScopedSettings}) — a preview that derives dependent options without writing.
|
|
109448
|
+
* Never applied to {@link ScopedSettings.get} or to a write. `null` ⇒ no overlay.
|
|
109449
|
+
*/
|
|
109450
|
+
async scopedSettingsOverlay(_scope, _cap, _nodeId) {
|
|
109451
|
+
return null;
|
|
109452
|
+
}
|
|
109453
|
+
/**
|
|
109454
|
+
* Hook: a write of one scope changed stored values (not called when the store reports no change,
|
|
109455
|
+
* e.g. the write-back of a stored secret). `keys` are the bare field keys of the write, node keys included.
|
|
109456
|
+
*/
|
|
109457
|
+
async onScopedSettingsChanged(_scope, _cap, _keys) {}
|
|
109458
|
+
/** Typed handle over the CLUSTER settings `cap` declares (`clusterSettingsSchema`). */
|
|
109459
|
+
clusterSettings(cap, schema) {
|
|
109460
|
+
return this.scopedHandle("cluster", cap, schema);
|
|
109461
|
+
}
|
|
109462
|
+
/** Typed handle over the fleet defaults of the per-device settings `cap` declares. */
|
|
109463
|
+
deviceDefaults(cap, schema) {
|
|
109464
|
+
return this.scopedHandle("device-defaults", cap, schema);
|
|
109465
|
+
}
|
|
109466
|
+
/**
|
|
109467
|
+
* Typed handle over the settings `cap` owns PER NODE. `nodeId` omitted ⇒ the local node. A node
|
|
109468
|
+
* with no row yields the schema defaults — never a bare-key fallback.
|
|
109469
|
+
*/
|
|
109470
|
+
nodeSettings(cap, schema, nodeId) {
|
|
109471
|
+
return this.scopedHandle("node", cap, schema, nodeId);
|
|
109472
|
+
}
|
|
109473
|
+
/**
|
|
109474
|
+
* {@link state} for a value that is kept per node: stored under `<key>@<nodeId>`, and the
|
|
109475
|
+
* settings store carries `nodeId` in the row data (D986 §1), so a forgotten node's rows go in one
|
|
109476
|
+
* central delete. `nodeId` omitted ⇒ the local node.
|
|
109477
|
+
*/
|
|
109478
|
+
nodeState(key, schema, fallback, nodeId) {
|
|
109479
|
+
this._declaredStateKeys.add(key);
|
|
109480
|
+
return createDurableState({
|
|
109481
|
+
key: nodeScopedKey(key, nodeId ?? this._ctx?.kernel?.localNodeId ?? ""),
|
|
109482
|
+
schema,
|
|
109483
|
+
fallback,
|
|
109484
|
+
read: async () => this.resolveStoredSecrets(await this.readAddonStoreWithRetry()),
|
|
109485
|
+
write: async (patch) => {
|
|
109486
|
+
await this._ctx?.settings?.writeAddonStore(patch);
|
|
109487
|
+
},
|
|
109488
|
+
onParseError: (k, e) => this._ctx?.logger?.warn?.(`durable-state: stored "${k}" failed validation — using fallback`, { meta: {
|
|
109489
|
+
addonId: this._ctx?.id,
|
|
109490
|
+
key: k,
|
|
109491
|
+
error: String(e)
|
|
109492
|
+
} })
|
|
109493
|
+
});
|
|
109494
|
+
}
|
|
109495
|
+
/** The loaded schema `cap` declares for `scope`, or `null`. */
|
|
109496
|
+
async declaredScopedSchema(scope, cap) {
|
|
109497
|
+
await this.loadScopedSchemas(cap);
|
|
109498
|
+
return this.loadedScopedSchemas(cap).find((entry) => entry.scope === scope)?.schema ?? null;
|
|
109499
|
+
}
|
|
109500
|
+
async requireScopedSchema(scope, cap) {
|
|
109501
|
+
const schema = await this.declaredScopedSchema(scope, cap);
|
|
109502
|
+
if (schema === null) throw new Error(`${this.constructor.name}: cap "${cap}" declares no ${scope} settings`);
|
|
109503
|
+
return schema;
|
|
109504
|
+
}
|
|
109505
|
+
scopedKeys(schema) {
|
|
109506
|
+
return new Set(schema.sections.flatMap((section) => collectValueFieldKeys(section.fields)));
|
|
109507
|
+
}
|
|
109508
|
+
/** `store` narrowed to the keys `schema` declares. */
|
|
109509
|
+
narrowToScope(store, schema) {
|
|
109510
|
+
const keys = this.scopedKeys(schema);
|
|
109511
|
+
return Object.fromEntries(Object.entries(store).filter(([key]) => keys.has(key)));
|
|
109512
|
+
}
|
|
109513
|
+
scopedHandle(scope, cap, schema, nodeId) {
|
|
109514
|
+
return createScopedSettings({
|
|
109515
|
+
schema,
|
|
109516
|
+
read: async () => {
|
|
109517
|
+
const declared = await this.requireScopedSchema(scope, cap);
|
|
109518
|
+
const stored = this.narrowToScope(await this.resolveGlobalStore(nodeId, cap), declared);
|
|
109519
|
+
const effective = collectHydratedFieldValues(hydrateSchema(declared, stored));
|
|
109520
|
+
return {
|
|
109521
|
+
...Object.fromEntries([...effective].filter(([, value]) => value !== void 0)),
|
|
109522
|
+
...stored
|
|
109523
|
+
};
|
|
109524
|
+
},
|
|
109525
|
+
write: (patch) => this.writeScoped(scope, cap, patch, nodeId),
|
|
109526
|
+
unset: (keys) => this.unsetScoped(scope, cap, keys, nodeId)
|
|
109527
|
+
});
|
|
109528
|
+
}
|
|
109529
|
+
/** The one write path of the scoped API: declared keys only, then the global patch. */
|
|
109530
|
+
async writeScoped(scope, cap, patch, nodeId) {
|
|
109531
|
+
assertDeclaredKeys(Object.keys(patch), this.scopedKeys(await this.requireScopedSchema(scope, cap)));
|
|
109532
|
+
if (await this.applyGlobalPatch(patch, scope === "node" ? nodeId : void 0, cap)) await this.onScopedSettingsChanged(scope, cap, Object.keys(patch));
|
|
109533
|
+
}
|
|
109534
|
+
/**
|
|
109535
|
+
* Remove declared keys of one scope. A secret goes through {@link clearSecrets} — its keychain
|
|
109536
|
+
* value is released exactly as there — and the emptied row is then removed; every other key is
|
|
109537
|
+
* removed by an `undefined` patch (which a secret transform would read as "keep").
|
|
109538
|
+
*/
|
|
109539
|
+
async unsetScoped(scope, cap, keys, nodeId) {
|
|
109540
|
+
assertDeclaredKeys(keys, this.scopedKeys(await this.requireScopedSchema(scope, cap)));
|
|
109541
|
+
const target = scope === "node" ? nodeId : void 0;
|
|
109542
|
+
const tree = this.addonSecretTree();
|
|
109543
|
+
const secretKeys = keys.filter((key) => tree.has(key));
|
|
109544
|
+
const plainKeys = keys.filter((key) => !tree.has(key));
|
|
109545
|
+
let changed = false;
|
|
109546
|
+
if (plainKeys.length > 0) {
|
|
109547
|
+
const patch = Object.fromEntries(plainKeys.map((key) => [key, void 0]));
|
|
109548
|
+
changed = await this.applyGlobalPatch(patch, target, cap) || changed;
|
|
109549
|
+
}
|
|
109550
|
+
if (secretKeys.length > 0) {
|
|
109551
|
+
await this.clearSecretKeys(secretKeys, target, cap);
|
|
109552
|
+
const node = normalizeNodeId(target ?? this._ctx?.kernel?.localNodeId);
|
|
109553
|
+
const rows = secretKeys.map((key) => scope === "node" ? nodeScopedKey(key, node) : key);
|
|
109554
|
+
if (this._secretSettings !== null) await this._secretSettings.removeClearedKeys(rows);
|
|
109555
|
+
else await this._ctx?.settings?.writeAddonStore(Object.fromEntries(rows.map((row) => [row, void 0])));
|
|
109556
|
+
changed = true;
|
|
109557
|
+
}
|
|
109558
|
+
if (changed) await this.onScopedSettingsChanged(scope, cap, [...keys]);
|
|
109559
|
+
}
|
|
109560
|
+
/**
|
|
109561
|
+
* The hydrated form of one scope of one capability's settings (any
|
|
109562
|
+
* {@link scopedSettingsOverlay} applied), or `null` when the capability declares nothing there.
|
|
109563
|
+
*/
|
|
109564
|
+
async getScopedSettings(scope, cap, nodeId) {
|
|
109565
|
+
const schema = await this.declaredScopedSchema(scope, cap);
|
|
109566
|
+
if (schema === null) return null;
|
|
109567
|
+
const stored = this.narrowToScope(await this.readRawProjectedStore(nodeId, cap), schema);
|
|
109568
|
+
const overlay = await this.scopedSettingsOverlay(scope, cap, nodeId);
|
|
109569
|
+
return hydrateSchema(schema, overlay ? await this.overlayKeepingMarkers(stored, overlay) : stored, { inlineSecretsAsViews: true });
|
|
109570
|
+
}
|
|
109571
|
+
/**
|
|
109572
|
+
* The scoped schemas this addon serves: one entry per loaded (capability, scope), capabilities
|
|
109573
|
+
* in declaration order, scopes in {@link SCOPED_SETTINGS_SCOPES} order. `[]` when it declares
|
|
109574
|
+
* nothing.
|
|
109575
|
+
*/
|
|
109576
|
+
async listScopedSettings() {
|
|
109577
|
+
await this.loadScopedSchemas();
|
|
109578
|
+
return [...this._scopedByCap].flatMap(([cap, entries]) => entries.map((entry) => ({
|
|
109579
|
+
cap,
|
|
109580
|
+
scope: entry.scope,
|
|
109581
|
+
sectionIds: entry.schema.sections.map((section) => section.id)
|
|
109582
|
+
})));
|
|
109583
|
+
}
|
|
109584
|
+
/** The OPERATOR's write of declared keys of one scope (D787 secret semantics). */
|
|
109585
|
+
async updateScopedSettings(scope, cap, patch, nodeId) {
|
|
109586
|
+
this._operatorWriteDepth++;
|
|
109587
|
+
try {
|
|
109588
|
+
await this.writeScoped(scope, cap, patch, nodeId);
|
|
109589
|
+
} finally {
|
|
109590
|
+
this._operatorWriteDepth--;
|
|
109591
|
+
}
|
|
109592
|
+
}
|
|
109593
|
+
/**
|
|
109594
|
+
* The effective values (`stored ?? default`) of one scope, a secret as its `set` view — never
|
|
109595
|
+
* its value. `null` when the capability declares nothing for the scope.
|
|
109596
|
+
*/
|
|
109597
|
+
async readScopedValues(scope, cap, nodeId) {
|
|
109598
|
+
const schema = await this.declaredScopedSchema(scope, cap);
|
|
109599
|
+
if (schema === null) return null;
|
|
109600
|
+
const form = hydrateSchema(schema, this.narrowToScope(await this.readRawProjectedStore(nodeId, cap), schema), { inlineSecretsAsViews: true });
|
|
109601
|
+
return Object.fromEntries([...collectHydratedFieldValues(form)].filter(([, value]) => value !== void 0));
|
|
109602
|
+
}
|
|
109603
|
+
/**
|
|
109385
109604
|
* What the create wizard and the integration edit page render for one instance: the addon's
|
|
109386
109605
|
* per-instance schema when it declares one, else its global schema (what they always showed).
|
|
109387
109606
|
*/
|
|
109388
109607
|
async getIntegrationFormSchema(instance, nodeId) {
|
|
109389
109608
|
const scoped = await this.integrationFormSchema(instance);
|
|
109390
|
-
if (scoped === null) return this.
|
|
109609
|
+
if (scoped === null) return this.scopedForm(nodeId);
|
|
109391
109610
|
return hydrateSchema(scoped, {}, { inlineSecretsAsViews: true });
|
|
109392
109611
|
}
|
|
109393
|
-
|
|
109394
|
-
|
|
109395
|
-
|
|
109396
|
-
const schema = this.
|
|
109397
|
-
if (!schema)
|
|
109398
|
-
|
|
109399
|
-
const sections = [];
|
|
109400
|
-
for (const id of declared) {
|
|
109401
|
-
const section = byId.get(id);
|
|
109402
|
-
if (!section) throw new Error(`${this.constructor.name}: integrationSettingSections() names unknown section "${id}". Known sections: [${[...byId.keys()].join(", ")}].`);
|
|
109403
|
-
const fields = dropPerNodeFields(section.fields);
|
|
109404
|
-
if (fields.length === 0) continue;
|
|
109405
|
-
sections.push({
|
|
109406
|
-
...section,
|
|
109407
|
-
fields
|
|
109408
|
-
});
|
|
109409
|
-
}
|
|
109410
|
-
if (sections.length === 0) return null;
|
|
109411
|
-
const projected = await this.readRawProjectedStore(nodeId);
|
|
109412
|
-
return hydrateSchema({
|
|
109413
|
-
...schema,
|
|
109414
|
-
sections
|
|
109415
|
-
}, projected, { inlineSecretsAsViews: true });
|
|
109612
|
+
/** The form of the scoped schemas this addon declared, hydrated from its store. */
|
|
109613
|
+
async scopedForm(nodeId) {
|
|
109614
|
+
await this.loadScopedSchemas();
|
|
109615
|
+
const schema = this.scopedFormSchema();
|
|
109616
|
+
if (!schema) return { sections: [] };
|
|
109617
|
+
return hydrateSchema(schema, await this.readRawProjectedStore(nodeId), { inlineSecretsAsViews: true });
|
|
109416
109618
|
}
|
|
109417
109619
|
/**
|
|
109418
109620
|
* The raw addon store PROJECTED onto the target node's bare per-node keys:
|
|
@@ -109421,8 +109623,8 @@ var BaseAddon = class {
|
|
|
109421
109623
|
* bare fallback), all `@`-scoped and stray bare per-node keys are dropped.
|
|
109422
109624
|
* A no-op passthrough when the schema declares no `perNode` field.
|
|
109423
109625
|
*
|
|
109424
|
-
* This is the sanctioned way for
|
|
109425
|
-
* the store for custom
|
|
109626
|
+
* This is the sanctioned way for an addon that needs
|
|
109627
|
+
* the store for custom logic (option narrowing, value snapping) to
|
|
109426
109628
|
* read it per-node — never `ctx.settings.readAddonStore()` directly.
|
|
109427
109629
|
* `nodeId` omitted ⇒ the local node (node-blind injection from ctx).
|
|
109428
109630
|
*
|
|
@@ -109474,7 +109676,7 @@ var BaseAddon = class {
|
|
|
109474
109676
|
}
|
|
109475
109677
|
/**
|
|
109476
109678
|
* Whether ONE global key of this addon's store was written, read three-way
|
|
109477
|
-
* (D651). For a question a hydrated view cannot answer:
|
|
109679
|
+
* (D651). For a question a hydrated view cannot answer: a hydrated form
|
|
109478
109680
|
* reports `value ?? default`, so "the operator chose the default" and "nobody
|
|
109479
109681
|
* chose" look the same, and a failed read looks like both. A `perNode` key is
|
|
109480
109682
|
* not supported here: its stored name is scoped.
|
|
@@ -109508,7 +109710,7 @@ var BaseAddon = class {
|
|
|
109508
109710
|
}
|
|
109509
109711
|
/**
|
|
109510
109712
|
* The OPERATOR's write — a settings form or an admin API call, dispatched by
|
|
109511
|
-
* the kernel.
|
|
109713
|
+
* the kernel. The one in-process write of the addon blob that is not a scoped write; a secret
|
|
109512
109714
|
* the operator sends is stored as sent even when it equals a pre-keychain
|
|
109513
109715
|
* inline value: the operator re-entering a password is a change, an addon
|
|
109514
109716
|
* writing back what it read is not (D787).
|
|
@@ -109521,9 +109723,6 @@ var BaseAddon = class {
|
|
|
109521
109723
|
this._operatorWriteDepth--;
|
|
109522
109724
|
}
|
|
109523
109725
|
}
|
|
109524
|
-
async updateGlobalSettings(patch, nodeId) {
|
|
109525
|
-
await this.applyGlobalPatch(patch, nodeId);
|
|
109526
|
-
}
|
|
109527
109726
|
/**
|
|
109528
109727
|
* REMOVE stored secrets — their keychain values and their markers (D787).
|
|
109529
109728
|
*
|
|
@@ -109533,6 +109732,9 @@ var BaseAddon = class {
|
|
|
109533
109732
|
* a keychain (an older kernel) it writes `''`, as such code always did.
|
|
109534
109733
|
*/
|
|
109535
109734
|
async clearSecrets(keys, nodeId) {
|
|
109735
|
+
await this.clearSecretKeys(keys, nodeId);
|
|
109736
|
+
}
|
|
109737
|
+
async clearSecretKeys(keys, nodeId, cap) {
|
|
109536
109738
|
const tree = this.addonSecretTree();
|
|
109537
109739
|
const keychain = this._ctx?.secrets !== void 0;
|
|
109538
109740
|
const stored = keychain ? await this.readAddonStoreWithRetry() : {};
|
|
@@ -109545,25 +109747,26 @@ var BaseAddon = class {
|
|
|
109545
109747
|
const keychainStored = tree.has(key) || collectSecretMarkerRefs(stored[key]).length > 0;
|
|
109546
109748
|
patch[key] = keychain && keychainStored ? SECRET_CLEAR : "";
|
|
109547
109749
|
}
|
|
109548
|
-
await this.applyGlobalPatch(patch, nodeId);
|
|
109750
|
+
await this.applyGlobalPatch(patch, nodeId, cap);
|
|
109549
109751
|
}
|
|
109550
|
-
|
|
109551
|
-
|
|
109552
|
-
|
|
109752
|
+
/** Resolves `true` when the write changed stored values. */
|
|
109753
|
+
async applyGlobalPatch(barePatch, nodeId, cap) {
|
|
109754
|
+
await this.loadScopedSchemas(cap);
|
|
109755
|
+
const keys = this.perNodeKeys(cap);
|
|
109553
109756
|
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
109554
109757
|
const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
109555
109758
|
const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
|
|
109556
109759
|
const handle = this._secretSettings;
|
|
109557
109760
|
if (handle !== null) {
|
|
109558
109761
|
const { changed } = await handle.writeAddonStore(scoped);
|
|
109559
|
-
if (!changed) return;
|
|
109762
|
+
if (!changed) return false;
|
|
109560
109763
|
} else await this._ctx?.settings?.writeAddonStore(scoped);
|
|
109561
|
-
if (target !== localNode) return;
|
|
109764
|
+
if (target !== localNode) return true;
|
|
109562
109765
|
await this.resolveConfig();
|
|
109563
109766
|
await this.onConfigChanged();
|
|
109564
109767
|
this.emitLifecycle(EventCategory.AddonUpdated, { level: "global" });
|
|
109565
|
-
|
|
109566
|
-
|
|
109768
|
+
this.maybeAutoRestart(Object.keys(barePatch), this.loadedScopedSchemas().map((entry) => entry.schema));
|
|
109769
|
+
return true;
|
|
109567
109770
|
}
|
|
109568
109771
|
/**
|
|
109569
109772
|
* The set of field keys the global settings schema declares `perNode: true`
|
|
@@ -109600,10 +109803,7 @@ var BaseAddon = class {
|
|
|
109600
109803
|
this._nodeKeysByCap = /* @__PURE__ */ new Map();
|
|
109601
109804
|
this._addonSecretTree = null;
|
|
109602
109805
|
}
|
|
109603
|
-
/**
|
|
109604
|
-
* The form the settings API serves while an addon declares no {@link globalSettingsSchema}: the
|
|
109605
|
-
* sections of its scoped schemas, so dropping the old hook does not blank the form.
|
|
109606
|
-
*/
|
|
109806
|
+
/** The form of an addon's scoped schemas: their sections, each shown once. */
|
|
109607
109807
|
scopedFormSchema(cap) {
|
|
109608
109808
|
const byId = /* @__PURE__ */ new Map();
|
|
109609
109809
|
for (const entry of this.loadedScopedSchemas(cap)) for (const section of entry.schema.sections) if (!byId.has(section.id)) byId.set(section.id, section);
|
|
@@ -109615,8 +109815,7 @@ var BaseAddon = class {
|
|
|
109615
109815
|
return [...this._scopedByCap.values()].flat();
|
|
109616
109816
|
}
|
|
109617
109817
|
/**
|
|
109618
|
-
* The field keys that are stored per node: every field of a {@link nodeSettingsSchema}
|
|
109619
|
-
* the fields the legacy {@link globalSettingsSchema} still marks `perNode: true`. Derived once
|
|
109818
|
+
* The field keys that are stored per node: every field of a {@link nodeSettingsSchema}. Derived once
|
|
109620
109819
|
* per `cap` argument and memoized (schemas are static declarations). Empty set ⇒ every
|
|
109621
109820
|
* per-node code path is bypassed and the settings API behaves like the node-agnostic one.
|
|
109622
109821
|
* Call {@link loadScopedSchemas} first (the async seams do).
|
|
@@ -109625,8 +109824,7 @@ var BaseAddon = class {
|
|
|
109625
109824
|
const cacheKey = cap ?? "";
|
|
109626
109825
|
const cached = this._nodeKeysByCap.get(cacheKey);
|
|
109627
109826
|
if (cached) return cached;
|
|
109628
|
-
const
|
|
109629
|
-
const keys = new Set(legacy ? legacy.sections.flatMap((section) => collectPerNodeFieldKeys(section.fields)) : []);
|
|
109827
|
+
const keys = /* @__PURE__ */ new Set();
|
|
109630
109828
|
for (const { scope, schema } of this.loadedScopedSchemas(cap)) {
|
|
109631
109829
|
if (scope !== "node") continue;
|
|
109632
109830
|
for (const section of schema.sections) for (const key of collectValueFieldKeys(section.fields)) keys.add(key);
|
|
@@ -109844,8 +110042,6 @@ var BaseAddon = class {
|
|
|
109844
110042
|
}
|
|
109845
110043
|
declaredKeySet() {
|
|
109846
110044
|
const keys = new Set(Object.keys(this.defaults));
|
|
109847
|
-
const schema = this.globalSettingsSchema();
|
|
109848
|
-
if (schema) for (const section of schema.sections) for (const key of collectFieldKeys(section.fields)) keys.add(key);
|
|
109849
110045
|
for (const { schema: scoped } of this.loadedScopedSchemas()) for (const section of scoped.sections) for (const key of collectFieldKeys(section.fields)) keys.add(key);
|
|
109850
110046
|
for (const key of this._declaredStateKeys) keys.add(key);
|
|
109851
110047
|
for (const path of this.secretStatePaths) {
|
|
@@ -109943,7 +110139,7 @@ var BaseAddon = class {
|
|
|
109943
110139
|
/** The addon store's secret tree: schema fields by TYPE, plus `secretStatePaths`. */
|
|
109944
110140
|
addonSecretTree() {
|
|
109945
110141
|
if (this._addonSecretTree === null) {
|
|
109946
|
-
const tree = new Map(
|
|
110142
|
+
const tree = /* @__PURE__ */ new Map();
|
|
109947
110143
|
for (const { schema } of this.loadedScopedSchemas()) for (const [key, node] of secretTreeFromSchema(schema)) tree.set(key, node);
|
|
109948
110144
|
this._addonSecretTree = mergeSecretStatePaths(tree, this.secretStatePaths);
|
|
109949
110145
|
}
|
|
@@ -110155,47 +110351,6 @@ function classifyStoreError(err) {
|
|
|
110155
110351
|
if (TRANSPORT_PHRASES.some((f) => message.includes(f))) return "transport";
|
|
110156
110352
|
return "permanent";
|
|
110157
110353
|
}
|
|
110158
|
-
/**
|
|
110159
|
-
* Collect the keys of every field marked `perNode: true`, recursing into
|
|
110160
|
-
* layout containers (`group` fields and `sub-tabs` tabs) the same way
|
|
110161
|
-
* `hydrateSchema` does. Valueless structural fields (separator/info/…)
|
|
110162
|
-
* don't declare `perNode` and are excluded by the `in` narrowing.
|
|
110163
|
-
*/
|
|
110164
|
-
/**
|
|
110165
|
-
* The same fields with every `perNode: true` one removed, recursing into layout
|
|
110166
|
-
* containers exactly as {@link collectPerNodeFieldKeys} does. A container left
|
|
110167
|
-
* with no child is dropped rather than rendered empty.
|
|
110168
|
-
*
|
|
110169
|
-
* Used by `getIntegrationSettings`: an integration is not a node, so a field
|
|
110170
|
-
* whose store key is `<key>@<nodeId>` has no node to belong to there.
|
|
110171
|
-
*/
|
|
110172
|
-
function dropPerNodeFields(fields) {
|
|
110173
|
-
const kept = [];
|
|
110174
|
-
for (const field of fields) {
|
|
110175
|
-
if (field.type === "group") {
|
|
110176
|
-
const inner = dropPerNodeFields(field.fields);
|
|
110177
|
-
if (inner.length > 0) kept.push({
|
|
110178
|
-
...field,
|
|
110179
|
-
fields: inner
|
|
110180
|
-
});
|
|
110181
|
-
continue;
|
|
110182
|
-
}
|
|
110183
|
-
if (field.type === "sub-tabs") {
|
|
110184
|
-
const tabs = field.tabs.map((tab) => ({
|
|
110185
|
-
...tab,
|
|
110186
|
-
fields: dropPerNodeFields(tab.fields)
|
|
110187
|
-
})).filter((tab) => tab.fields.length > 0);
|
|
110188
|
-
if (tabs.length > 0) kept.push({
|
|
110189
|
-
...field,
|
|
110190
|
-
tabs
|
|
110191
|
-
});
|
|
110192
|
-
continue;
|
|
110193
|
-
}
|
|
110194
|
-
if ("perNode" in field && field.perNode === true) continue;
|
|
110195
|
-
kept.push(field);
|
|
110196
|
-
}
|
|
110197
|
-
return kept;
|
|
110198
|
-
}
|
|
110199
110354
|
/** The keys of the value-holding fields, recursing into layout containers. */
|
|
110200
110355
|
function collectValueFieldKeys(fields) {
|
|
110201
110356
|
const collected = [];
|
|
@@ -110228,21 +110383,6 @@ function collectFieldKeys(fields) {
|
|
|
110228
110383
|
}
|
|
110229
110384
|
return collected;
|
|
110230
110385
|
}
|
|
110231
|
-
function collectPerNodeFieldKeys(fields) {
|
|
110232
|
-
const collected = [];
|
|
110233
|
-
for (const field of fields) {
|
|
110234
|
-
if (field.type === "group") {
|
|
110235
|
-
collected.push(...collectPerNodeFieldKeys(field.fields));
|
|
110236
|
-
continue;
|
|
110237
|
-
}
|
|
110238
|
-
if (field.type === "sub-tabs") {
|
|
110239
|
-
for (const tab of field.tabs) collected.push(...collectPerNodeFieldKeys(tab.fields));
|
|
110240
|
-
continue;
|
|
110241
|
-
}
|
|
110242
|
-
if ("perNode" in field && field.perNode === true) collected.push(field.key);
|
|
110243
|
-
}
|
|
110244
|
-
return collected;
|
|
110245
|
-
}
|
|
110246
110386
|
/**
|
|
110247
110387
|
* Normalize an `ICamstackAddon.initialize()` return value into the
|
|
110248
110388
|
* `AddonInitResult` envelope. Arrays are wrapped into `{ providers }`;
|
|
@@ -111406,7 +111546,6 @@ var CAP_NAMES = Object.freeze([
|
|
|
111406
111546
|
"notifier",
|
|
111407
111547
|
"numeric-sensor",
|
|
111408
111548
|
"oauth-integration",
|
|
111409
|
-
"oidc-connections",
|
|
111410
111549
|
"osd",
|
|
111411
111550
|
"osd-manager",
|
|
111412
111551
|
"pet-feeder",
|
|
@@ -113113,13 +113252,25 @@ Object.freeze({
|
|
|
113113
113252
|
"path": "temperature",
|
|
113114
113253
|
"valueType": "number"
|
|
113115
113254
|
}],
|
|
113116
|
-
"timed-run": [
|
|
113117
|
-
|
|
113118
|
-
|
|
113119
|
-
|
|
113120
|
-
|
|
113121
|
-
|
|
113122
|
-
|
|
113255
|
+
"timed-run": [
|
|
113256
|
+
{
|
|
113257
|
+
"path": "activeUntil",
|
|
113258
|
+
"valueType": "number"
|
|
113259
|
+
},
|
|
113260
|
+
{
|
|
113261
|
+
"path": "requestedBy",
|
|
113262
|
+
"valueType": "string"
|
|
113263
|
+
},
|
|
113264
|
+
{
|
|
113265
|
+
"path": "quickRun.duration",
|
|
113266
|
+
"valueType": "number"
|
|
113267
|
+
},
|
|
113268
|
+
{
|
|
113269
|
+
"path": "quickRun.unit",
|
|
113270
|
+
"valueType": "enum",
|
|
113271
|
+
"enumValues": ["s", "min"]
|
|
113272
|
+
}
|
|
113273
|
+
],
|
|
113123
113274
|
"update": [
|
|
113124
113275
|
{
|
|
113125
113276
|
"path": "currentVersion",
|
|
@@ -113298,8 +113449,7 @@ Object.freeze({
|
|
|
113298
113449
|
"device-provider": { "reloadDevice": 18e4 },
|
|
113299
113450
|
"llm": {
|
|
113300
113451
|
"generate": 6e5,
|
|
113301
|
-
"generateVision": 6e5
|
|
113302
|
-
"testProfile": 6e5
|
|
113452
|
+
"generateVision": 6e5
|
|
113303
113453
|
},
|
|
113304
113454
|
"llm-runtime": {
|
|
113305
113455
|
"complete": 6e5,
|
|
@@ -113382,7 +113532,7 @@ function sleep(ms) {
|
|
|
113382
113532
|
return new Promise((resolve) => setTimeout(resolve, Math.max(0, ms)));
|
|
113383
113533
|
}
|
|
113384
113534
|
//#endregion
|
|
113385
|
-
//#region ../types/dist/composition-
|
|
113535
|
+
//#region ../types/dist/composition-Bx0JvKUU.mjs
|
|
113386
113536
|
/**
|
|
113387
113537
|
* The ffmpeg build every CamStack node downloads, per platform and arch.
|
|
113388
113538
|
*
|
|
@@ -114544,439 +114694,821 @@ var NodeColorIdSchema = _enum([
|
|
|
114544
114694
|
"node-h"
|
|
114545
114695
|
]);
|
|
114546
114696
|
//#endregion
|
|
114547
|
-
//#region ../types/dist/
|
|
114548
|
-
/**
|
|
114549
|
-
* The `smtp-inbound` broker kind (D999): a mailbox a device can send mail to.
|
|
114550
|
-
*
|
|
114551
|
-
* The `broker` cap carries these as `Record<string, unknown>` on the wire; the
|
|
114552
|
-
* provider and its consumers parse them with the schemas below at BOTH ends, so
|
|
114553
|
-
* the shape is declared once.
|
|
114554
|
-
*/
|
|
114555
|
-
/** The broker kind tag. */
|
|
114556
|
-
var SMTP_INBOUND_KIND = "smtp-inbound";
|
|
114557
|
-
/** The id the first mailbox is minted under (adopt-id), so a consumer can find it again. */
|
|
114558
|
-
var SMTP_INBOUND_DEFAULT_ID = "smtp-inbound-default";
|
|
114559
|
-
var SMTP_INBOUND_DEFAULT_PORT = 2525;
|
|
114560
|
-
var SMTP_INBOUND_DEFAULT_DOMAIN = "camstack.local";
|
|
114561
|
-
var SMTP_INBOUND_DEFAULT_MAX_MESSAGE_BYTES = 25 * 1024 * 1024;
|
|
114562
|
-
/** The text excerpt a message carries on the bus. */
|
|
114563
|
-
var SMTP_INBOUND_TEXT_MAX_CHARS = 4096;
|
|
114564
|
-
var PortSchema = number().int().min(1).max(65535);
|
|
114565
|
-
/** A recipient local-part: what stands before the `@`. */
|
|
114566
|
-
var SmtpRecipientSchema = string().min(1).max(64).regex(/^[A-Za-z0-9._+-]+$/);
|
|
114567
|
-
object({
|
|
114568
|
-
port: PortSchema.default(SMTP_INBOUND_DEFAULT_PORT),
|
|
114569
|
-
bindHost: string().min(1).default("0.0.0.0"),
|
|
114570
|
-
domain: string().min(1).default(SMTP_INBOUND_DEFAULT_DOMAIN),
|
|
114571
|
-
requireAuth: boolean().default(true),
|
|
114572
|
-
username: string().default(""),
|
|
114573
|
-
password: string().default("").meta({ secret: true }),
|
|
114574
|
-
starttls: boolean().default(false),
|
|
114575
|
-
maxMessageBytes: number().int().positive().default(SMTP_INBOUND_DEFAULT_MAX_MESSAGE_BYTES)
|
|
114576
|
-
});
|
|
114577
|
-
/**
|
|
114578
|
-
* What `getBrokerConfig` answers: what a device needs to send mail here.
|
|
114579
|
-
* `host` is null when the `internal` role of the network palette is not set;
|
|
114580
|
-
* `hostReason` then says where to set it.
|
|
114581
|
-
*/
|
|
114582
|
-
var SmtpInboundConfigSchema = object({
|
|
114583
|
-
host: string().min(1).nullable(),
|
|
114584
|
-
hostReason: string().nullable(),
|
|
114585
|
-
port: PortSchema,
|
|
114586
|
-
domain: string().min(1),
|
|
114587
|
-
requireAuth: boolean(),
|
|
114588
|
-
username: string(),
|
|
114589
|
-
password: string(),
|
|
114590
|
-
starttls: boolean()
|
|
114591
|
-
});
|
|
114592
|
-
object({
|
|
114593
|
-
recipients: array(SmtpRecipientSchema).min(1),
|
|
114594
|
-
/**
|
|
114595
|
-
* Who is subscribing. A second `subscribe` with the same id REPLACES that subscriber's
|
|
114596
|
-
* recipients (the way a consumer that restarted, or lost a device, declares its set again);
|
|
114597
|
-
* a recipient held by another subscriber is refused with `smtp-inbound/recipient-claimed`.
|
|
114598
|
-
* Absent, the subscriber is anonymous and unique.
|
|
114599
|
-
*/
|
|
114600
|
-
subscriberId: string().min(1).max(64).optional()
|
|
114601
|
-
});
|
|
114602
|
-
var SmtpInboundAttachmentSchema = object({
|
|
114603
|
-
filename: string(),
|
|
114604
|
-
contentType: string(),
|
|
114605
|
-
bytes: number().int().nonnegative()
|
|
114606
|
-
});
|
|
114607
|
-
/** The payload of one `broker.message` (the key is the recipient local-part). */
|
|
114608
|
-
var SmtpInboundMessageSchema = object({
|
|
114609
|
-
/** Monotonic per mailbox; a gap tells a consumer it missed an event. */
|
|
114610
|
-
seq: number().int().positive(),
|
|
114611
|
-
messageId: string(),
|
|
114612
|
-
receivedAt: number().int().nonnegative(),
|
|
114613
|
-
from: string(),
|
|
114614
|
-
to: string(),
|
|
114615
|
-
subject: string(),
|
|
114616
|
-
text: string().max(SMTP_INBOUND_TEXT_MAX_CHARS),
|
|
114617
|
-
attachments: array(SmtpInboundAttachmentSchema)
|
|
114618
|
-
});
|
|
114619
|
-
/** What `getState('since:<seq>')` answers: every retained message after `seq`. */
|
|
114620
|
-
var SmtpInboundSinceSchema = object({
|
|
114621
|
-
/** The newest seq issued so far (0 before any mail). */
|
|
114622
|
-
lastSeq: number().int().nonnegative(),
|
|
114623
|
-
/** The oldest seq still retained; messages below it are gone. */
|
|
114624
|
-
oldestSeq: number().int().nonnegative(),
|
|
114625
|
-
messages: array(object({
|
|
114626
|
-
key: string(),
|
|
114627
|
-
message: SmtpInboundMessageSchema
|
|
114628
|
-
}))
|
|
114629
|
-
});
|
|
114630
|
-
/** The key a consumer passes to `getState` to replay the ring, and its parser. */
|
|
114631
|
-
function smtpSinceKey(seq) {
|
|
114632
|
-
return `since:${seq}`;
|
|
114633
|
-
}
|
|
114634
|
-
new Set([
|
|
114635
|
-
"track",
|
|
114636
|
-
"face",
|
|
114637
|
-
"identity",
|
|
114638
|
-
"plate",
|
|
114639
|
-
"vehicle",
|
|
114640
|
-
"scene",
|
|
114641
|
-
"motion",
|
|
114642
|
-
"object",
|
|
114643
|
-
"audio",
|
|
114644
|
-
"mosaic"
|
|
114645
|
-
]);
|
|
114646
|
-
/**
|
|
114647
|
-
* The owner types that are event tables, in the order the event-media resolver
|
|
114648
|
-
* should consider them. Exported so a consumer asking "is this key an event?"
|
|
114649
|
-
* does not re-spell the list and drift from it.
|
|
114650
|
-
*/
|
|
114651
|
-
var EVENT_OWNER_TYPES = [
|
|
114652
|
-
"motion",
|
|
114653
|
-
"object",
|
|
114654
|
-
"audio"
|
|
114655
|
-
];
|
|
114656
|
-
/**
|
|
114657
|
-
* The same list as a Zod enum, for the cap inputs that must NAME the table
|
|
114658
|
-
* (D482: `getEventMedia` / `listEventMedia` take an owner, and an owner is
|
|
114659
|
-
* `(table, id)`).
|
|
114660
|
-
*
|
|
114661
|
-
* Built FROM {@link EVENT_OWNER_TYPES} rather than re-spelled: a fourth event
|
|
114662
|
-
* table would otherwise be accepted by the codec and refused at the door, with
|
|
114663
|
-
* nothing failing until a caller asked.
|
|
114664
|
-
*/
|
|
114665
|
-
var EventOwnerTypeSchema = _enum(EVENT_OWNER_TYPES);
|
|
114666
|
-
/** The same list as a Zod enum, for the cap input that carries it. */
|
|
114667
|
-
var MediaPresenceOwnerKindSchema = _enum([...EVENT_OWNER_TYPES, "track"]);
|
|
114668
|
-
new Set(EVENT_OWNER_TYPES);
|
|
114669
|
-
/**
|
|
114670
|
-
* What a published package needs from the rest of the install (D989).
|
|
114671
|
-
*
|
|
114672
|
-
* One published framework package (`@camstack/server`) carries the kernel, the
|
|
114673
|
-
* builtins and the capability contracts, so "which addon runs on which
|
|
114674
|
-
* framework" is a question of version, and the answer is DECLARED by the
|
|
114675
|
-
* package that knows it:
|
|
114676
|
-
*
|
|
114677
|
-
* - an addon says the oldest server it runs on (`requires.server: ">=X"`);
|
|
114678
|
-
* - the server says the oldest addon it works with
|
|
114679
|
-
* (`requires.addons: { "@camstack/addon-x": ">=Y" }`) and the oldest shell
|
|
114680
|
-
* around it (`requires.wrapper: { desktop, image }`);
|
|
114681
|
-
* - a wrapper (the desktop app, the container starter) says which server
|
|
114682
|
-
* range it can host, and reports its own kind and version.
|
|
114683
|
-
*
|
|
114684
|
-
* The publish workflow STAMPS these after the version bump
|
|
114685
|
-
* (`scripts/ci/stamp-requires.mjs`); nobody types a number by hand.
|
|
114686
|
-
*
|
|
114687
|
-
* A requirement that cannot be checked is NOT met: a shell that reports no
|
|
114688
|
-
* version counts as below the minimum, and an unreadable running version is
|
|
114689
|
-
* named in the result (a failed read is never a pass).
|
|
114690
|
-
*/
|
|
114691
|
-
/** `>=MAJOR.MINOR.PATCH[-prerelease]` — the only range shape a requirement uses. */
|
|
114692
|
-
var MinVersionSchema = string().regex(/^>=\d+\.\d+\.\d+(-[0-9A-Za-z.-]+)?$/, "a minimum is written \">=X.Y.Z\"");
|
|
114693
|
-
object({
|
|
114694
|
-
/** The oldest `@camstack/server` this package runs on. */
|
|
114695
|
-
server: MinVersionSchema.optional(),
|
|
114696
|
-
/** The oldest installed version of each named addon package. */
|
|
114697
|
-
addons: record(string(), MinVersionSchema).optional(),
|
|
114698
|
-
/** The oldest shell around the server, per shell kind. */
|
|
114699
|
-
wrapper: object({
|
|
114700
|
-
desktop: MinVersionSchema.optional(),
|
|
114701
|
-
image: MinVersionSchema.optional()
|
|
114702
|
-
}).optional()
|
|
114703
|
-
});
|
|
114704
|
-
/** One unmet requirement; each names the versions on both sides. */
|
|
114705
|
-
var UnmetRequirementSchema = discriminatedUnion("kind", [
|
|
114706
|
-
object({
|
|
114707
|
-
kind: literal("server-too-old"),
|
|
114708
|
-
required: string(),
|
|
114709
|
-
/** `null` — the running server version could not be read. */
|
|
114710
|
-
running: string().nullable()
|
|
114711
|
-
}),
|
|
114712
|
-
object({
|
|
114713
|
-
kind: literal("addon-too-old"),
|
|
114714
|
-
packageName: string(),
|
|
114715
|
-
required: string(),
|
|
114716
|
-
/** `null` — the addon is not installed (or its version is unreadable). */
|
|
114717
|
-
running: string().nullable()
|
|
114718
|
-
}),
|
|
114719
|
-
object({
|
|
114720
|
-
kind: literal("wrapper-too-old"),
|
|
114721
|
-
wrapper: _enum(["desktop", "image"]),
|
|
114722
|
-
required: string(),
|
|
114723
|
-
/** `null` — the wrapper reported no version. */
|
|
114724
|
-
running: string().nullable()
|
|
114725
|
-
})
|
|
114726
|
-
]);
|
|
114727
|
-
var RequiredAddonUpdateSchema = object({
|
|
114728
|
-
packageName: string(),
|
|
114729
|
-
/** The minimum the target server declares. */
|
|
114730
|
-
required: string(),
|
|
114731
|
-
/** What this node has; `null` when the addon is not installed. */
|
|
114732
|
-
installed: string().nullable()
|
|
114733
|
-
});
|
|
114734
|
-
/**
|
|
114735
|
-
* Which integration instance a settings form is for. An addon that serves several instances
|
|
114736
|
-
* (`instanceMode: multiple`) can show a different form per instance — an NVR integration
|
|
114737
|
-
* needs its connection, the default integration needs the addon's own sections.
|
|
114738
|
-
*
|
|
114739
|
-
* - `integrationId` is `null` in the create wizard: nothing exists yet, the operator is
|
|
114740
|
-
* setting up a NEW instance.
|
|
114741
|
-
* - `mode` is the wizard mode of the integration type (`getAvailableTypes`).
|
|
114742
|
-
* - `candidateStableId` is the discovery candidate a wizard was seeded from, if any.
|
|
114743
|
-
*/
|
|
114744
|
-
var IntegrationInstanceRefSchema = object({
|
|
114745
|
-
integrationId: string().nullable(),
|
|
114746
|
-
mode: _enum([
|
|
114747
|
-
"standalone",
|
|
114748
|
-
"account",
|
|
114749
|
-
"broker"
|
|
114750
|
-
]),
|
|
114751
|
-
candidateStableId: string().optional()
|
|
114752
|
-
});
|
|
114753
|
-
/**
|
|
114754
|
-
* notification-output — canonical, capability-gated notification delivery.
|
|
114755
|
-
*
|
|
114756
|
-
* Apprise-derived model (see
|
|
114757
|
-
* `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
|
|
114758
|
-
* callers emit ONE canonical `Notification`; each provider declares a
|
|
114759
|
-
* per-kind capability descriptor (`TargetKind`), and the pure degrade
|
|
114760
|
-
* engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
|
|
114761
|
-
* message to what the kind supports — callers never special-case a service.
|
|
114762
|
-
*
|
|
114763
|
-
* DESIGN DECISIONS (locked):
|
|
114764
|
-
* - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
|
|
114765
|
-
* `setTargetEnabled`), each provider persisting via the `settings-store`
|
|
114766
|
-
* cap. Rationale: the admin UI needs one uniform surface across the
|
|
114767
|
-
* notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
|
|
114768
|
-
* alternative would fork the UI per addon and cannot host the
|
|
114769
|
-
* discovery→adopt flow.
|
|
114770
|
-
* - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
|
|
114771
|
-
* the generated cap-mount auto-`concatCollection`-fans them across every
|
|
114772
|
-
* registered provider (notifiers addon + HA addon) so one catalog is
|
|
114773
|
-
* routable. `send` / `testTarget` / CRUD route to ONE provider by the
|
|
114774
|
-
* `addonId` the generated collection router extracts from the call input.
|
|
114775
|
-
* - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
|
|
114776
|
-
* transformer) + UDS MsgPack both round-trip typed arrays — already used by
|
|
114777
|
-
* `storage` / `storage-provider` / `recording` caps over the same path. No
|
|
114778
|
-
* base64 fallback needed.
|
|
114779
|
-
*
|
|
114780
|
-
* TODO (deferred, closed-set change — separate decision): add
|
|
114781
|
-
* `providerKind: 'notify'` so notification providers surface on the unified
|
|
114782
|
-
* admin "Integrations" page.
|
|
114783
|
-
*/
|
|
114784
|
-
/**
|
|
114785
|
-
* Zentik-derived typed-media enum — the superset across every kind. Each
|
|
114786
|
-
* adapter picks what it supports and the degrade engine filters the rest.
|
|
114787
|
-
*/
|
|
114788
|
-
var AttachmentMediaTypeSchema = _enum([
|
|
114789
|
-
"image",
|
|
114790
|
-
"video",
|
|
114791
|
-
"gif",
|
|
114792
|
-
"audio",
|
|
114793
|
-
"icon"
|
|
114794
|
-
]);
|
|
114795
|
-
/**
|
|
114796
|
-
* A single attachment. Exactly one of `url` (remote source, most adapters
|
|
114797
|
-
* prefer this) or `bytes` (inline source; required for Pushover-style
|
|
114798
|
-
* bytes-only kinds) MUST be present — the degrade engine expresses a
|
|
114799
|
-
* url→bytes fetch as a `needsFetch` directive the adapter executes.
|
|
114800
|
-
*/
|
|
114801
|
-
var AttachmentSchema = object({
|
|
114802
|
-
mediaType: AttachmentMediaTypeSchema,
|
|
114803
|
-
url: string().optional(),
|
|
114804
|
-
bytes: _instanceof(Uint8Array).optional(),
|
|
114805
|
-
mime: string().optional(),
|
|
114806
|
-
name: string().optional()
|
|
114807
|
-
}).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
|
|
114808
|
-
var NotificationFormatSchema = _enum([
|
|
114809
|
-
"text",
|
|
114810
|
-
"markdown",
|
|
114811
|
-
"html"
|
|
114812
|
-
]);
|
|
114697
|
+
//#region ../types/dist/convert-BAzH15HU.mjs
|
|
114813
114698
|
/**
|
|
114814
|
-
*
|
|
114815
|
-
*
|
|
114816
|
-
*
|
|
114817
|
-
*
|
|
114818
|
-
* notices — the same class of gap as a zone vocabulary nothing produced
|
|
114819
|
-
* ([D35](../../../docs/decisions/adr-0035.md)). Every adapter maps this set or
|
|
114820
|
-
* declares `actionIcons: false` and the degrade engine strips the field.
|
|
114821
|
-
*
|
|
114822
|
-
* Named by INTENT, never by glyph. "check" would tie the vocabulary to one
|
|
114823
|
-
* renderer's icon set; "acknowledge" survives an adapter that draws it
|
|
114824
|
-
* differently.
|
|
114825
|
-
*
|
|
114826
|
-
* ── A TOKEN IS NOT A WIRE VALUE ─────────────────────────────────────
|
|
114827
|
-
*
|
|
114828
|
-
* These names are for US. **No adapter may forward one verbatim.** Each maps
|
|
114829
|
-
* the whole set onto its own renderer's vocabulary through a
|
|
114830
|
-
* `Record<NotificationActionIcon, string>` — a Record, never a lookup with a
|
|
114831
|
-
* fallback, so adding a member here fails every adapter's build until someone
|
|
114832
|
-
* decides its glyph, which is the only place that decision can be made
|
|
114833
|
-
* honestly.
|
|
114834
|
-
*
|
|
114835
|
-
* This paragraph is the bug. Zentik declared `actionIcons: true` and passed
|
|
114836
|
-
* `disarm` straight through; iOS feeds that string to
|
|
114837
|
-
* `UNNotificationActionIcon(systemImageName:)`, `disarm` is not an SF Symbol,
|
|
114838
|
-
* and every snooze and alarm button arrived BLANK. A pass-through is not a
|
|
114839
|
-
* mapping, and "the field is documented" is not "the value renders".
|
|
114840
|
-
*
|
|
114841
|
-
* Adding a member is TRAIN-BOUND. The enum lives in the published
|
|
114842
|
-
* `@camstack/server` closure and the cap seam validates against the HUB's copy,
|
|
114843
|
-
* so an addon that emits a token the running hub does not know does not lose an
|
|
114844
|
-
* icon — its whole `send` fails Zod validation and the notification never
|
|
114845
|
-
* arrives. Never emit a new token from an addon before the train carrying it.
|
|
114699
|
+
* Frozen unit → spec table. `•` in the doc marks each dimension's canonical
|
|
114700
|
+
* unit (`factor: 1, offset: 0`). °F derives from `°C = (°F − 32) × 5/9` ⇒
|
|
114701
|
+
* `factor = 5/9`, `offset = -160/9` (kept as exact expressions, not rounded
|
|
114702
|
+
* decimals). K derives from `°C = K − 273.15`.
|
|
114846
114703
|
*/
|
|
114847
|
-
var
|
|
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
|
-
|
|
114897
|
-
|
|
114898
|
-
|
|
114899
|
-
|
|
114900
|
-
|
|
114901
|
-
|
|
114902
|
-
|
|
114903
|
-
|
|
114904
|
-
|
|
114704
|
+
var UNIT_TABLE = {
|
|
114705
|
+
"°C": {
|
|
114706
|
+
dimension: "temperature",
|
|
114707
|
+
factor: 1,
|
|
114708
|
+
offset: 0
|
|
114709
|
+
},
|
|
114710
|
+
"°F": {
|
|
114711
|
+
dimension: "temperature",
|
|
114712
|
+
factor: 5 / 9,
|
|
114713
|
+
offset: -160 / 9
|
|
114714
|
+
},
|
|
114715
|
+
K: {
|
|
114716
|
+
dimension: "temperature",
|
|
114717
|
+
factor: 1,
|
|
114718
|
+
offset: -273.15
|
|
114719
|
+
},
|
|
114720
|
+
hPa: {
|
|
114721
|
+
dimension: "pressure",
|
|
114722
|
+
factor: 1,
|
|
114723
|
+
offset: 0
|
|
114724
|
+
},
|
|
114725
|
+
kPa: {
|
|
114726
|
+
dimension: "pressure",
|
|
114727
|
+
factor: 10,
|
|
114728
|
+
offset: 0
|
|
114729
|
+
},
|
|
114730
|
+
Pa: {
|
|
114731
|
+
dimension: "pressure",
|
|
114732
|
+
factor: .01,
|
|
114733
|
+
offset: 0
|
|
114734
|
+
},
|
|
114735
|
+
mbar: {
|
|
114736
|
+
dimension: "pressure",
|
|
114737
|
+
factor: 1,
|
|
114738
|
+
offset: 0
|
|
114739
|
+
},
|
|
114740
|
+
bar: {
|
|
114741
|
+
dimension: "pressure",
|
|
114742
|
+
factor: 1e3,
|
|
114743
|
+
offset: 0
|
|
114744
|
+
},
|
|
114745
|
+
inHg: {
|
|
114746
|
+
dimension: "pressure",
|
|
114747
|
+
factor: 33.8639,
|
|
114748
|
+
offset: 0
|
|
114749
|
+
},
|
|
114750
|
+
mmHg: {
|
|
114751
|
+
dimension: "pressure",
|
|
114752
|
+
factor: 1.33322,
|
|
114753
|
+
offset: 0
|
|
114754
|
+
},
|
|
114755
|
+
psi: {
|
|
114756
|
+
dimension: "pressure",
|
|
114757
|
+
factor: 68.9476,
|
|
114758
|
+
offset: 0
|
|
114759
|
+
},
|
|
114760
|
+
"m/s": {
|
|
114761
|
+
dimension: "speed",
|
|
114762
|
+
factor: 1,
|
|
114763
|
+
offset: 0
|
|
114764
|
+
},
|
|
114765
|
+
"km/h": {
|
|
114766
|
+
dimension: "speed",
|
|
114767
|
+
factor: 1 / 3.6,
|
|
114768
|
+
offset: 0
|
|
114769
|
+
},
|
|
114770
|
+
mph: {
|
|
114771
|
+
dimension: "speed",
|
|
114772
|
+
factor: .44704,
|
|
114773
|
+
offset: 0
|
|
114774
|
+
},
|
|
114775
|
+
kn: {
|
|
114776
|
+
dimension: "speed",
|
|
114777
|
+
factor: .514444,
|
|
114778
|
+
offset: 0
|
|
114779
|
+
},
|
|
114780
|
+
"mm/h": {
|
|
114781
|
+
dimension: "precipitation-rate",
|
|
114782
|
+
factor: 1,
|
|
114783
|
+
offset: 0
|
|
114784
|
+
},
|
|
114785
|
+
"in/h": {
|
|
114786
|
+
dimension: "precipitation-rate",
|
|
114787
|
+
factor: 25.4,
|
|
114788
|
+
offset: 0
|
|
114789
|
+
},
|
|
114790
|
+
m: {
|
|
114791
|
+
dimension: "length",
|
|
114792
|
+
factor: 1,
|
|
114793
|
+
offset: 0
|
|
114794
|
+
},
|
|
114795
|
+
mm: {
|
|
114796
|
+
dimension: "length",
|
|
114797
|
+
factor: .001,
|
|
114798
|
+
offset: 0
|
|
114799
|
+
},
|
|
114800
|
+
cm: {
|
|
114801
|
+
dimension: "length",
|
|
114802
|
+
factor: .01,
|
|
114803
|
+
offset: 0
|
|
114804
|
+
},
|
|
114805
|
+
km: {
|
|
114806
|
+
dimension: "length",
|
|
114807
|
+
factor: 1e3,
|
|
114808
|
+
offset: 0
|
|
114809
|
+
},
|
|
114810
|
+
in: {
|
|
114811
|
+
dimension: "length",
|
|
114812
|
+
factor: .0254,
|
|
114813
|
+
offset: 0
|
|
114814
|
+
},
|
|
114815
|
+
ft: {
|
|
114816
|
+
dimension: "length",
|
|
114817
|
+
factor: .3048,
|
|
114818
|
+
offset: 0
|
|
114819
|
+
},
|
|
114820
|
+
mi: {
|
|
114821
|
+
dimension: "length",
|
|
114822
|
+
factor: 1609.344,
|
|
114823
|
+
offset: 0
|
|
114824
|
+
},
|
|
114825
|
+
"m²": {
|
|
114826
|
+
dimension: "area",
|
|
114827
|
+
factor: 1,
|
|
114828
|
+
offset: 0
|
|
114829
|
+
},
|
|
114830
|
+
lx: {
|
|
114831
|
+
dimension: "illuminance",
|
|
114832
|
+
factor: 1,
|
|
114833
|
+
offset: 0
|
|
114834
|
+
},
|
|
114835
|
+
"W/m²": {
|
|
114836
|
+
dimension: "irradiance",
|
|
114837
|
+
factor: 1,
|
|
114838
|
+
offset: 0
|
|
114839
|
+
},
|
|
114840
|
+
W: {
|
|
114841
|
+
dimension: "power",
|
|
114842
|
+
factor: 1,
|
|
114843
|
+
offset: 0
|
|
114844
|
+
},
|
|
114845
|
+
kW: {
|
|
114846
|
+
dimension: "power",
|
|
114847
|
+
factor: 1e3,
|
|
114848
|
+
offset: 0
|
|
114849
|
+
},
|
|
114850
|
+
VA: {
|
|
114851
|
+
dimension: "apparent-power",
|
|
114852
|
+
factor: 1,
|
|
114853
|
+
offset: 0
|
|
114854
|
+
},
|
|
114855
|
+
Wh: {
|
|
114856
|
+
dimension: "energy",
|
|
114857
|
+
factor: 1,
|
|
114858
|
+
offset: 0
|
|
114859
|
+
},
|
|
114860
|
+
kWh: {
|
|
114861
|
+
dimension: "energy",
|
|
114862
|
+
factor: 1e3,
|
|
114863
|
+
offset: 0
|
|
114864
|
+
},
|
|
114865
|
+
MWh: {
|
|
114866
|
+
dimension: "energy",
|
|
114867
|
+
factor: 1e6,
|
|
114868
|
+
offset: 0
|
|
114869
|
+
},
|
|
114870
|
+
V: {
|
|
114871
|
+
dimension: "voltage",
|
|
114872
|
+
factor: 1,
|
|
114873
|
+
offset: 0
|
|
114874
|
+
},
|
|
114875
|
+
mV: {
|
|
114876
|
+
dimension: "voltage",
|
|
114877
|
+
factor: .001,
|
|
114878
|
+
offset: 0
|
|
114879
|
+
},
|
|
114880
|
+
A: {
|
|
114881
|
+
dimension: "current",
|
|
114882
|
+
factor: 1,
|
|
114883
|
+
offset: 0
|
|
114884
|
+
},
|
|
114885
|
+
mA: {
|
|
114886
|
+
dimension: "current",
|
|
114887
|
+
factor: .001,
|
|
114888
|
+
offset: 0
|
|
114889
|
+
},
|
|
114890
|
+
ppm: {
|
|
114891
|
+
dimension: "concentration-volume",
|
|
114892
|
+
factor: 1,
|
|
114893
|
+
offset: 0
|
|
114894
|
+
},
|
|
114895
|
+
ppb: {
|
|
114896
|
+
dimension: "concentration-volume",
|
|
114897
|
+
factor: .001,
|
|
114898
|
+
offset: 0
|
|
114899
|
+
},
|
|
114900
|
+
"µg/m³": {
|
|
114901
|
+
dimension: "concentration-mass",
|
|
114902
|
+
factor: 1,
|
|
114903
|
+
offset: 0
|
|
114904
|
+
},
|
|
114905
|
+
"mg/m³": {
|
|
114906
|
+
dimension: "concentration-mass",
|
|
114907
|
+
factor: 1e3,
|
|
114908
|
+
offset: 0
|
|
114909
|
+
},
|
|
114910
|
+
kg: {
|
|
114911
|
+
dimension: "mass",
|
|
114912
|
+
factor: 1,
|
|
114913
|
+
offset: 0
|
|
114914
|
+
},
|
|
114915
|
+
g: {
|
|
114916
|
+
dimension: "mass",
|
|
114917
|
+
factor: .001,
|
|
114918
|
+
offset: 0
|
|
114919
|
+
},
|
|
114920
|
+
lb: {
|
|
114921
|
+
dimension: "mass",
|
|
114922
|
+
factor: .453592,
|
|
114923
|
+
offset: 0
|
|
114924
|
+
},
|
|
114925
|
+
oz: {
|
|
114926
|
+
dimension: "mass",
|
|
114927
|
+
factor: .0283495,
|
|
114928
|
+
offset: 0
|
|
114929
|
+
},
|
|
114930
|
+
"%": {
|
|
114931
|
+
dimension: "percentage",
|
|
114932
|
+
factor: 1,
|
|
114933
|
+
offset: 0
|
|
114934
|
+
},
|
|
114935
|
+
L: {
|
|
114936
|
+
dimension: "volume",
|
|
114937
|
+
factor: 1,
|
|
114938
|
+
offset: 0
|
|
114939
|
+
},
|
|
114940
|
+
mL: {
|
|
114941
|
+
dimension: "volume",
|
|
114942
|
+
factor: .001,
|
|
114943
|
+
offset: 0
|
|
114944
|
+
},
|
|
114945
|
+
gal: {
|
|
114946
|
+
dimension: "volume",
|
|
114947
|
+
factor: 3.785411784,
|
|
114948
|
+
offset: 0
|
|
114949
|
+
},
|
|
114950
|
+
s: {
|
|
114951
|
+
dimension: "duration",
|
|
114952
|
+
factor: 1,
|
|
114953
|
+
offset: 0
|
|
114954
|
+
},
|
|
114955
|
+
ms: {
|
|
114956
|
+
dimension: "duration",
|
|
114957
|
+
factor: .001,
|
|
114958
|
+
offset: 0
|
|
114959
|
+
},
|
|
114960
|
+
min: {
|
|
114961
|
+
dimension: "duration",
|
|
114962
|
+
factor: 60,
|
|
114963
|
+
offset: 0
|
|
114964
|
+
},
|
|
114965
|
+
h: {
|
|
114966
|
+
dimension: "duration",
|
|
114967
|
+
factor: 3600,
|
|
114968
|
+
offset: 0
|
|
114969
|
+
},
|
|
114970
|
+
d: {
|
|
114971
|
+
dimension: "duration",
|
|
114972
|
+
factor: 86400,
|
|
114973
|
+
offset: 0
|
|
114974
|
+
},
|
|
114975
|
+
B: {
|
|
114976
|
+
dimension: "information",
|
|
114977
|
+
factor: 1,
|
|
114978
|
+
offset: 0
|
|
114979
|
+
},
|
|
114980
|
+
KiB: {
|
|
114981
|
+
dimension: "information",
|
|
114982
|
+
factor: 1024,
|
|
114983
|
+
offset: 0
|
|
114984
|
+
},
|
|
114985
|
+
MiB: {
|
|
114986
|
+
dimension: "information",
|
|
114987
|
+
factor: 1024 ** 2,
|
|
114988
|
+
offset: 0
|
|
114989
|
+
},
|
|
114990
|
+
GiB: {
|
|
114991
|
+
dimension: "information",
|
|
114992
|
+
factor: 1024 ** 3,
|
|
114993
|
+
offset: 0
|
|
114994
|
+
},
|
|
114995
|
+
TiB: {
|
|
114996
|
+
dimension: "information",
|
|
114997
|
+
factor: 1024 ** 4,
|
|
114998
|
+
offset: 0
|
|
114999
|
+
},
|
|
115000
|
+
kB: {
|
|
115001
|
+
dimension: "information",
|
|
115002
|
+
factor: 1e3,
|
|
115003
|
+
offset: 0
|
|
115004
|
+
},
|
|
115005
|
+
MB: {
|
|
115006
|
+
dimension: "information",
|
|
115007
|
+
factor: 1e6,
|
|
115008
|
+
offset: 0
|
|
115009
|
+
},
|
|
115010
|
+
GB: {
|
|
115011
|
+
dimension: "information",
|
|
115012
|
+
factor: 1e9,
|
|
115013
|
+
offset: 0
|
|
115014
|
+
},
|
|
115015
|
+
"°": {
|
|
115016
|
+
dimension: "angle",
|
|
115017
|
+
factor: 1,
|
|
115018
|
+
offset: 0
|
|
115019
|
+
},
|
|
115020
|
+
dBFS: {
|
|
115021
|
+
dimension: "sound-level",
|
|
115022
|
+
factor: 1,
|
|
115023
|
+
offset: 0
|
|
115024
|
+
},
|
|
115025
|
+
dBm: {
|
|
115026
|
+
dimension: "signal-level",
|
|
115027
|
+
factor: 1,
|
|
115028
|
+
offset: 0
|
|
115029
|
+
},
|
|
115030
|
+
mired: {
|
|
115031
|
+
dimension: "colour-temperature",
|
|
115032
|
+
factor: 1,
|
|
115033
|
+
offset: 0
|
|
115034
|
+
},
|
|
115035
|
+
kbps: {
|
|
115036
|
+
dimension: "bitrate",
|
|
115037
|
+
factor: 1,
|
|
115038
|
+
offset: 0
|
|
115039
|
+
},
|
|
115040
|
+
Mbps: {
|
|
115041
|
+
dimension: "bitrate",
|
|
115042
|
+
factor: 1e3,
|
|
115043
|
+
offset: 0
|
|
115044
|
+
},
|
|
115045
|
+
fps: {
|
|
115046
|
+
dimension: "rate",
|
|
115047
|
+
factor: 1,
|
|
115048
|
+
offset: 0
|
|
115049
|
+
}
|
|
115050
|
+
};
|
|
115051
|
+
/** Resolve a unit's `UnitSpec`, or `undefined` when the spelling is unknown. */
|
|
115052
|
+
function specFor(unit) {
|
|
115053
|
+
return Object.hasOwn(UNIT_TABLE, unit) ? UNIT_TABLE[unit] : void 0;
|
|
115054
|
+
}
|
|
115055
|
+
/** Value in `spec`'s unit → its dimension's canonical unit. */
|
|
115056
|
+
function toCanonical(value, spec) {
|
|
115057
|
+
return value * spec.factor + spec.offset;
|
|
115058
|
+
}
|
|
115059
|
+
/** Canonical-unit value → the unit described by `spec`. */
|
|
115060
|
+
function fromCanonical(canonical, spec) {
|
|
115061
|
+
return (canonical - spec.offset) / spec.factor;
|
|
115062
|
+
}
|
|
114905
115063
|
/**
|
|
114906
|
-
*
|
|
114907
|
-
*
|
|
114908
|
-
*
|
|
114909
|
-
|
|
115064
|
+
* Graceful variant for the render path: returns the converted value, or
|
|
115065
|
+
* `undefined` when the conversion is refused (unknown unit / cross-dimension).
|
|
115066
|
+
* Never throws — a render caller falls back to the raw value + source unit.
|
|
115067
|
+
*/
|
|
115068
|
+
function tryConvertUnit(value, from, to) {
|
|
115069
|
+
if (from === to) return value;
|
|
115070
|
+
const fromSpec = specFor(from);
|
|
115071
|
+
if (!fromSpec) return void 0;
|
|
115072
|
+
const toSpec = specFor(to);
|
|
115073
|
+
if (!toSpec) return void 0;
|
|
115074
|
+
if (fromSpec.dimension !== toSpec.dimension) return void 0;
|
|
115075
|
+
return fromCanonical(toCanonical(value, fromSpec), toSpec);
|
|
115076
|
+
}
|
|
115077
|
+
//#endregion
|
|
115078
|
+
//#region ../types/dist/index.mjs
|
|
115079
|
+
/**
|
|
115080
|
+
* The `smtp-inbound` broker kind (D999): a mailbox a device can send mail to.
|
|
114910
115081
|
*
|
|
114911
|
-
*
|
|
114912
|
-
*
|
|
115082
|
+
* The `broker` cap carries these as `Record<string, unknown>` on the wire; the
|
|
115083
|
+
* provider and its consumers parse them with the schemas below at BOTH ends, so
|
|
115084
|
+
* the shape is declared once.
|
|
114913
115085
|
*/
|
|
114914
|
-
|
|
114915
|
-
|
|
114916
|
-
|
|
114917
|
-
|
|
114918
|
-
|
|
114919
|
-
|
|
114920
|
-
|
|
114921
|
-
|
|
114922
|
-
|
|
114923
|
-
|
|
114924
|
-
|
|
114925
|
-
|
|
114926
|
-
|
|
114927
|
-
|
|
114928
|
-
|
|
114929
|
-
|
|
114930
|
-
|
|
114931
|
-
|
|
114932
|
-
|
|
114933
|
-
|
|
114934
|
-
|
|
115086
|
+
/** The broker kind tag. */
|
|
115087
|
+
var SMTP_INBOUND_KIND = "smtp-inbound";
|
|
115088
|
+
/** The id the first mailbox is minted under (adopt-id), so a consumer can find it again. */
|
|
115089
|
+
var SMTP_INBOUND_DEFAULT_ID = "smtp-inbound-default";
|
|
115090
|
+
var SMTP_INBOUND_DEFAULT_PORT = 2525;
|
|
115091
|
+
var SMTP_INBOUND_DEFAULT_DOMAIN = "camstack.local";
|
|
115092
|
+
var SMTP_INBOUND_DEFAULT_MAX_MESSAGE_BYTES = 25 * 1024 * 1024;
|
|
115093
|
+
/** The text excerpt a message carries on the bus. */
|
|
115094
|
+
var SMTP_INBOUND_TEXT_MAX_CHARS = 4096;
|
|
115095
|
+
var PortSchema = number().int().min(1).max(65535);
|
|
115096
|
+
/** A recipient local-part: what stands before the `@`. */
|
|
115097
|
+
var SmtpRecipientSchema = string().min(1).max(64).regex(/^[A-Za-z0-9._+-]+$/);
|
|
115098
|
+
object({
|
|
115099
|
+
port: PortSchema.default(SMTP_INBOUND_DEFAULT_PORT),
|
|
115100
|
+
bindHost: string().min(1).default("0.0.0.0"),
|
|
115101
|
+
domain: string().min(1).default(SMTP_INBOUND_DEFAULT_DOMAIN),
|
|
115102
|
+
requireAuth: boolean().default(true),
|
|
115103
|
+
username: string().default(""),
|
|
115104
|
+
password: string().default("").meta({ secret: true }),
|
|
115105
|
+
starttls: boolean().default(false),
|
|
115106
|
+
maxMessageBytes: number().int().positive().default(SMTP_INBOUND_DEFAULT_MAX_MESSAGE_BYTES)
|
|
114935
115107
|
});
|
|
114936
115108
|
/**
|
|
114937
|
-
*
|
|
114938
|
-
* `
|
|
114939
|
-
*
|
|
114940
|
-
* the adapter maps this ordinal onto its native level. `level?` is an
|
|
114941
|
-
* optional kind-native level id (`emergency`, `silent`, …) that overrides
|
|
114942
|
-
* `priority` for that one target.
|
|
115109
|
+
* What `getBrokerConfig` answers: what a device needs to send mail here.
|
|
115110
|
+
* `host` is null when the `internal` role of the network palette is not set;
|
|
115111
|
+
* `hostReason` then says where to set it.
|
|
114943
115112
|
*/
|
|
114944
|
-
var
|
|
114945
|
-
|
|
114946
|
-
|
|
114947
|
-
|
|
114948
|
-
|
|
114949
|
-
|
|
114950
|
-
|
|
114951
|
-
|
|
114952
|
-
|
|
114953
|
-
|
|
114954
|
-
|
|
114955
|
-
|
|
114956
|
-
deviceId: number().optional(),
|
|
114957
|
-
eventId: string().optional(),
|
|
114958
|
-
metadata: record(string(), unknown()).optional(),
|
|
115113
|
+
var SmtpInboundConfigSchema = object({
|
|
115114
|
+
host: string().min(1).nullable(),
|
|
115115
|
+
hostReason: string().nullable(),
|
|
115116
|
+
port: PortSchema,
|
|
115117
|
+
domain: string().min(1),
|
|
115118
|
+
requireAuth: boolean(),
|
|
115119
|
+
username: string(),
|
|
115120
|
+
password: string(),
|
|
115121
|
+
starttls: boolean()
|
|
115122
|
+
});
|
|
115123
|
+
object({
|
|
115124
|
+
recipients: array(SmtpRecipientSchema).min(1),
|
|
114959
115125
|
/**
|
|
114960
|
-
*
|
|
114961
|
-
*
|
|
114962
|
-
*
|
|
115126
|
+
* Who is subscribing. A second `subscribe` with the same id REPLACES that subscriber's
|
|
115127
|
+
* recipients (the way a consumer that restarted, or lost a device, declares its set again);
|
|
115128
|
+
* a recipient held by another subscriber is refused with `smtp-inbound/recipient-claimed`.
|
|
115129
|
+
* Absent, the subscriber is anonymous and unique.
|
|
114963
115130
|
*/
|
|
114964
|
-
|
|
115131
|
+
subscriberId: string().min(1).max(64).optional()
|
|
114965
115132
|
});
|
|
114966
|
-
|
|
114967
|
-
|
|
114968
|
-
|
|
114969
|
-
|
|
114970
|
-
|
|
114971
|
-
|
|
114972
|
-
|
|
114973
|
-
|
|
114974
|
-
|
|
114975
|
-
|
|
114976
|
-
|
|
114977
|
-
|
|
114978
|
-
|
|
114979
|
-
|
|
115133
|
+
var SmtpInboundAttachmentSchema = object({
|
|
115134
|
+
filename: string(),
|
|
115135
|
+
contentType: string(),
|
|
115136
|
+
bytes: number().int().nonnegative()
|
|
115137
|
+
});
|
|
115138
|
+
/** The payload of one `broker.message` (the key is the recipient local-part). */
|
|
115139
|
+
var SmtpInboundMessageSchema = object({
|
|
115140
|
+
/** Monotonic per mailbox; a gap tells a consumer it missed an event. */
|
|
115141
|
+
seq: number().int().positive(),
|
|
115142
|
+
messageId: string(),
|
|
115143
|
+
receivedAt: number().int().nonnegative(),
|
|
115144
|
+
from: string(),
|
|
115145
|
+
to: string(),
|
|
115146
|
+
subject: string(),
|
|
115147
|
+
text: string().max(SMTP_INBOUND_TEXT_MAX_CHARS),
|
|
115148
|
+
attachments: array(SmtpInboundAttachmentSchema)
|
|
115149
|
+
});
|
|
115150
|
+
/** What `getState('since:<seq>')` answers: every retained message after `seq`. */
|
|
115151
|
+
var SmtpInboundSinceSchema = object({
|
|
115152
|
+
/** The newest seq issued so far (0 before any mail). */
|
|
115153
|
+
lastSeq: number().int().nonnegative(),
|
|
115154
|
+
/** The oldest seq still retained; messages below it are gone. */
|
|
115155
|
+
oldestSeq: number().int().nonnegative(),
|
|
115156
|
+
messages: array(object({
|
|
115157
|
+
key: string(),
|
|
115158
|
+
message: SmtpInboundMessageSchema
|
|
115159
|
+
}))
|
|
115160
|
+
});
|
|
115161
|
+
/** The key a consumer passes to `getState` to replay the ring, and its parser. */
|
|
115162
|
+
function smtpSinceKey(seq) {
|
|
115163
|
+
return `since:${seq}`;
|
|
115164
|
+
}
|
|
115165
|
+
new Set([
|
|
115166
|
+
"track",
|
|
115167
|
+
"face",
|
|
115168
|
+
"identity",
|
|
115169
|
+
"plate",
|
|
115170
|
+
"vehicle",
|
|
115171
|
+
"scene",
|
|
115172
|
+
"motion",
|
|
115173
|
+
"object",
|
|
115174
|
+
"audio",
|
|
115175
|
+
"mosaic"
|
|
115176
|
+
]);
|
|
115177
|
+
/**
|
|
115178
|
+
* The owner types that are event tables, in the order the event-media resolver
|
|
115179
|
+
* should consider them. Exported so a consumer asking "is this key an event?"
|
|
115180
|
+
* does not re-spell the list and drift from it.
|
|
115181
|
+
*/
|
|
115182
|
+
var EVENT_OWNER_TYPES = [
|
|
115183
|
+
"motion",
|
|
115184
|
+
"object",
|
|
115185
|
+
"audio"
|
|
115186
|
+
];
|
|
115187
|
+
/**
|
|
115188
|
+
* The same list as a Zod enum, for the cap inputs that must NAME the table
|
|
115189
|
+
* (D482: `getEventMedia` / `listEventMedia` take an owner, and an owner is
|
|
115190
|
+
* `(table, id)`).
|
|
115191
|
+
*
|
|
115192
|
+
* Built FROM {@link EVENT_OWNER_TYPES} rather than re-spelled: a fourth event
|
|
115193
|
+
* table would otherwise be accepted by the codec and refused at the door, with
|
|
115194
|
+
* nothing failing until a caller asked.
|
|
115195
|
+
*/
|
|
115196
|
+
var EventOwnerTypeSchema = _enum(EVENT_OWNER_TYPES);
|
|
115197
|
+
/** The same list as a Zod enum, for the cap input that carries it. */
|
|
115198
|
+
var MediaPresenceOwnerKindSchema = _enum([...EVENT_OWNER_TYPES, "track"]);
|
|
115199
|
+
new Set(EVENT_OWNER_TYPES);
|
|
115200
|
+
/**
|
|
115201
|
+
* What a published package needs from the rest of the install (D989).
|
|
115202
|
+
*
|
|
115203
|
+
* One published framework package (`@camstack/server`) carries the kernel, the
|
|
115204
|
+
* builtins and the capability contracts, so "which addon runs on which
|
|
115205
|
+
* framework" is a question of version, and the answer is DECLARED by the
|
|
115206
|
+
* package that knows it:
|
|
115207
|
+
*
|
|
115208
|
+
* - an addon says the oldest server it runs on (`requires.server: ">=X"`);
|
|
115209
|
+
* - the server says the oldest addon it works with
|
|
115210
|
+
* (`requires.addons: { "@camstack/addon-x": ">=Y" }`) and the oldest shell
|
|
115211
|
+
* around it (`requires.wrapper: { desktop, image }`);
|
|
115212
|
+
* - a wrapper (the desktop app, the container starter) says which server
|
|
115213
|
+
* range it can host, and reports its own kind and version.
|
|
115214
|
+
*
|
|
115215
|
+
* The publish workflow STAMPS these after the version bump
|
|
115216
|
+
* (`scripts/ci/stamp-requires.mjs`); nobody types a number by hand.
|
|
115217
|
+
*
|
|
115218
|
+
* A requirement that cannot be checked is NOT met: a shell that reports no
|
|
115219
|
+
* version counts as below the minimum, and an unreadable running version is
|
|
115220
|
+
* named in the result (a failed read is never a pass).
|
|
115221
|
+
*/
|
|
115222
|
+
/** `>=MAJOR.MINOR.PATCH[-prerelease]` — the only range shape a requirement uses. */
|
|
115223
|
+
var MinVersionSchema = string().regex(/^>=\d+\.\d+\.\d+(-[0-9A-Za-z.-]+)?$/, "a minimum is written \">=X.Y.Z\"");
|
|
115224
|
+
object({
|
|
115225
|
+
/** The oldest `@camstack/server` this package runs on. */
|
|
115226
|
+
server: MinVersionSchema.optional(),
|
|
115227
|
+
/** The oldest installed version of each named addon package. */
|
|
115228
|
+
addons: record(string(), MinVersionSchema).optional(),
|
|
115229
|
+
/** The oldest shell around the server, per shell kind. */
|
|
115230
|
+
wrapper: object({
|
|
115231
|
+
desktop: MinVersionSchema.optional(),
|
|
115232
|
+
image: MinVersionSchema.optional()
|
|
115233
|
+
}).optional()
|
|
115234
|
+
});
|
|
115235
|
+
/** One unmet requirement; each names the versions on both sides. */
|
|
115236
|
+
var UnmetRequirementSchema = discriminatedUnion("kind", [
|
|
115237
|
+
object({
|
|
115238
|
+
kind: literal("server-too-old"),
|
|
115239
|
+
required: string(),
|
|
115240
|
+
/** `null` — the running server version could not be read. */
|
|
115241
|
+
running: string().nullable()
|
|
115242
|
+
}),
|
|
115243
|
+
object({
|
|
115244
|
+
kind: literal("addon-too-old"),
|
|
115245
|
+
packageName: string(),
|
|
115246
|
+
required: string(),
|
|
115247
|
+
/** `null` — the addon is not installed (or its version is unreadable). */
|
|
115248
|
+
running: string().nullable()
|
|
115249
|
+
}),
|
|
115250
|
+
object({
|
|
115251
|
+
kind: literal("wrapper-too-old"),
|
|
115252
|
+
wrapper: _enum(["desktop", "image"]),
|
|
115253
|
+
required: string(),
|
|
115254
|
+
/** `null` — the wrapper reported no version. */
|
|
115255
|
+
running: string().nullable()
|
|
115256
|
+
})
|
|
115257
|
+
]);
|
|
115258
|
+
var RequiredAddonUpdateSchema = object({
|
|
115259
|
+
packageName: string(),
|
|
115260
|
+
/** The minimum the target server declares. */
|
|
115261
|
+
required: string(),
|
|
115262
|
+
/** What this node has; `null` when the addon is not installed. */
|
|
115263
|
+
installed: string().nullable()
|
|
115264
|
+
});
|
|
115265
|
+
/**
|
|
115266
|
+
* Which integration instance a settings form is for. An addon that serves several instances
|
|
115267
|
+
* (`instanceMode: multiple`) can show a different form per instance — an NVR integration
|
|
115268
|
+
* needs its connection, the default integration needs the addon's own sections.
|
|
115269
|
+
*
|
|
115270
|
+
* - `integrationId` is `null` in the create wizard: nothing exists yet, the operator is
|
|
115271
|
+
* setting up a NEW instance.
|
|
115272
|
+
* - `mode` is the wizard mode of the integration type (`getAvailableTypes`).
|
|
115273
|
+
* - `candidateStableId` is the discovery candidate a wizard was seeded from, if any.
|
|
115274
|
+
*/
|
|
115275
|
+
var IntegrationInstanceRefSchema = object({
|
|
115276
|
+
integrationId: string().nullable(),
|
|
115277
|
+
mode: _enum([
|
|
115278
|
+
"standalone",
|
|
115279
|
+
"account",
|
|
115280
|
+
"broker"
|
|
115281
|
+
]),
|
|
115282
|
+
candidateStableId: string().optional()
|
|
115283
|
+
});
|
|
115284
|
+
/**
|
|
115285
|
+
* notification-output — canonical, capability-gated notification delivery.
|
|
115286
|
+
*
|
|
115287
|
+
* Apprise-derived model (see
|
|
115288
|
+
* `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
|
|
115289
|
+
* callers emit ONE canonical `Notification`; each provider declares a
|
|
115290
|
+
* per-kind capability descriptor (`TargetKind`), and the pure degrade
|
|
115291
|
+
* engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
|
|
115292
|
+
* message to what the kind supports — callers never special-case a service.
|
|
115293
|
+
*
|
|
115294
|
+
* DESIGN DECISIONS (locked):
|
|
115295
|
+
* - A target is an INSTANCE of this function cap (epic #440, step 6): the
|
|
115296
|
+
* providers serve their targets as `integration-instances` records, one
|
|
115297
|
+
* record kind per target kind, and the admin lists, adds, edits, switches
|
|
115298
|
+
* and deletes them through that cap. This cap keeps what an instance cannot
|
|
115299
|
+
* say: the kind catalogue (`listTargetKinds`: capabilities, delivery
|
|
115300
|
+
* parameters, brand icon), dispatch (`send`, `testTarget`) and the form
|
|
115301
|
+
* helpers (`discoverTargets`, `probeTargetConfig`).
|
|
115302
|
+
* - `listTargetKinds` / `discoverTargets` return arrays → the generated
|
|
115303
|
+
* cap-mount auto-`concatCollection`-fans them across every registered
|
|
115304
|
+
* provider so one catalog is routable. `send` / `testTarget` /
|
|
115305
|
+
* `probeTargetConfig` route to ONE provider by the `addonId` the generated
|
|
115306
|
+
* collection router extracts from the call input.
|
|
115307
|
+
* - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
|
|
115308
|
+
* transformer) + UDS MsgPack both round-trip typed arrays — already used by
|
|
115309
|
+
* `storage` / `storage-provider` / `recording` caps over the same path. No
|
|
115310
|
+
* base64 fallback needed.
|
|
115311
|
+
*
|
|
115312
|
+
* TODO (deferred, closed-set change — separate decision): add
|
|
115313
|
+
* `providerKind: 'notify'` so notification providers surface on the unified
|
|
115314
|
+
* admin "Integrations" page.
|
|
115315
|
+
*/
|
|
115316
|
+
/**
|
|
115317
|
+
* Zentik-derived typed-media enum — the superset across every kind. Each
|
|
115318
|
+
* adapter picks what it supports and the degrade engine filters the rest.
|
|
115319
|
+
*/
|
|
115320
|
+
var AttachmentMediaTypeSchema = _enum([
|
|
115321
|
+
"image",
|
|
115322
|
+
"video",
|
|
115323
|
+
"gif",
|
|
115324
|
+
"audio",
|
|
115325
|
+
"icon"
|
|
115326
|
+
]);
|
|
115327
|
+
/**
|
|
115328
|
+
* A single attachment. Exactly one of `url` (remote source, most adapters
|
|
115329
|
+
* prefer this) or `bytes` (inline source; required for Pushover-style
|
|
115330
|
+
* bytes-only kinds) MUST be present — the degrade engine expresses a
|
|
115331
|
+
* url→bytes fetch as a `needsFetch` directive the adapter executes.
|
|
115332
|
+
*/
|
|
115333
|
+
var AttachmentSchema = object({
|
|
115334
|
+
mediaType: AttachmentMediaTypeSchema,
|
|
115335
|
+
url: string().optional(),
|
|
115336
|
+
bytes: _instanceof(Uint8Array).optional(),
|
|
115337
|
+
mime: string().optional(),
|
|
115338
|
+
name: string().optional()
|
|
115339
|
+
}).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
|
|
115340
|
+
var NotificationFormatSchema = _enum([
|
|
115341
|
+
"text",
|
|
115342
|
+
"markdown",
|
|
115343
|
+
"html"
|
|
115344
|
+
]);
|
|
115345
|
+
/**
|
|
115346
|
+
* The CLOSED icon vocabulary an action button may use.
|
|
115347
|
+
*
|
|
115348
|
+
* A closed set, not a free string, and that is the whole point: an arbitrary
|
|
115349
|
+
* icon name is one that ntfy renders, zentik silently drops, and nobody
|
|
115350
|
+
* notices — the same class of gap as a zone vocabulary nothing produced
|
|
115351
|
+
* ([D35](../../../docs/decisions/adr-0035.md)). Every adapter maps this set or
|
|
115352
|
+
* declares `actionIcons: false` and the degrade engine strips the field.
|
|
115353
|
+
*
|
|
115354
|
+
* Named by INTENT, never by glyph. "check" would tie the vocabulary to one
|
|
115355
|
+
* renderer's icon set; "acknowledge" survives an adapter that draws it
|
|
115356
|
+
* differently.
|
|
115357
|
+
*
|
|
115358
|
+
* ── A TOKEN IS NOT A WIRE VALUE ─────────────────────────────────────
|
|
115359
|
+
*
|
|
115360
|
+
* These names are for US. **No adapter may forward one verbatim.** Each maps
|
|
115361
|
+
* the whole set onto its own renderer's vocabulary through a
|
|
115362
|
+
* `Record<NotificationActionIcon, string>` — a Record, never a lookup with a
|
|
115363
|
+
* fallback, so adding a member here fails every adapter's build until someone
|
|
115364
|
+
* decides its glyph, which is the only place that decision can be made
|
|
115365
|
+
* honestly.
|
|
115366
|
+
*
|
|
115367
|
+
* This paragraph is the bug. Zentik declared `actionIcons: true` and passed
|
|
115368
|
+
* `disarm` straight through; iOS feeds that string to
|
|
115369
|
+
* `UNNotificationActionIcon(systemImageName:)`, `disarm` is not an SF Symbol,
|
|
115370
|
+
* and every snooze and alarm button arrived BLANK. A pass-through is not a
|
|
115371
|
+
* mapping, and "the field is documented" is not "the value renders".
|
|
115372
|
+
*
|
|
115373
|
+
* Adding a member is TRAIN-BOUND. The enum lives in the published
|
|
115374
|
+
* `@camstack/server` closure and the cap seam validates against the HUB's copy,
|
|
115375
|
+
* so an addon that emits a token the running hub does not know does not lose an
|
|
115376
|
+
* icon — its whole `send` fails Zod validation and the notification never
|
|
115377
|
+
* arrives. Never emit a new token from an addon before the train carrying it.
|
|
115378
|
+
*/
|
|
115379
|
+
var NotificationActionIconSchema = _enum([
|
|
115380
|
+
"acknowledge",
|
|
115381
|
+
"dismiss",
|
|
115382
|
+
"silence",
|
|
115383
|
+
"snooze",
|
|
115384
|
+
"view",
|
|
115385
|
+
"play",
|
|
115386
|
+
"open",
|
|
115387
|
+
"close",
|
|
115388
|
+
"lock",
|
|
115389
|
+
"unlock",
|
|
115390
|
+
"arm",
|
|
115391
|
+
"arm-home",
|
|
115392
|
+
"arm-away",
|
|
115393
|
+
"arm-night",
|
|
115394
|
+
"disarm",
|
|
115395
|
+
"light",
|
|
115396
|
+
"alert",
|
|
115397
|
+
"camera"
|
|
115398
|
+
]);
|
|
115399
|
+
/** A single tap-through action button. */
|
|
115400
|
+
var NotificationActionSchema = object({
|
|
115401
|
+
id: string(),
|
|
115402
|
+
label: string(),
|
|
115403
|
+
url: string().optional(),
|
|
115404
|
+
/** Dropped by the degrade engine for a kind with `caps.actionIcons: false`. */
|
|
115405
|
+
icon: NotificationActionIconSchema.optional(),
|
|
115406
|
+
/**
|
|
115407
|
+
* Renders in a warning style where the notifier supports it.
|
|
115408
|
+
*
|
|
115409
|
+
* A HINT, never a gate. The callback's authority is its token and nothing
|
|
115410
|
+
* else — see `notification-center/action-token.ts` for what that does and
|
|
115411
|
+
* does not buy.
|
|
115412
|
+
*/
|
|
115413
|
+
destructive: boolean().optional(),
|
|
115414
|
+
/**
|
|
115415
|
+
* How the tap should REACH the url.
|
|
115416
|
+
*
|
|
115417
|
+
* `navigate` (absent, and every button authored before this field) opens it:
|
|
115418
|
+
* the phone leaves the notification and shows whatever the callback returns.
|
|
115419
|
+
* That is right for a button whose answer the operator wants to read.
|
|
115420
|
+
*
|
|
115421
|
+
* `background` fires it as a POST and stays put. It exists for the buttons
|
|
115422
|
+
* whose whole point is not to interrupt — "silence this for 30 minutes" is
|
|
115423
|
+
* an answer to the notification, and being thrown into a browser tab to
|
|
115424
|
+
* confirm it costs more attention than the notification did. A backend that
|
|
115425
|
+
* cannot do a background call renders it as an ordinary link (the adapters
|
|
115426
|
+
* fall back rather than dropping the button), so this is a preference, never
|
|
115427
|
+
* a requirement.
|
|
115428
|
+
*/
|
|
115429
|
+
mode: _enum(["navigate", "background"]).optional()
|
|
115430
|
+
});
|
|
115431
|
+
/** A delivery parameter value: what a notifier declared it takes. */
|
|
115432
|
+
var DeliveryParamValueSchema = union([
|
|
115433
|
+
string(),
|
|
115434
|
+
number(),
|
|
115435
|
+
boolean()
|
|
115436
|
+
]);
|
|
115437
|
+
/**
|
|
115438
|
+
* One extra delivery parameter a notifier KIND declares (D938). A rule that
|
|
115439
|
+
* addresses a target of that kind may set it; a kind that declares nothing is
|
|
115440
|
+
* never handed one. The admin UI derives its control from this descriptor —
|
|
115441
|
+
* no editor knows a service by name.
|
|
115442
|
+
*
|
|
115443
|
+
* Optional fields are `.optional()`, never `.default()` (a Zod default does not
|
|
115444
|
+
* run on the addon cap path).
|
|
115445
|
+
*/
|
|
115446
|
+
var DeliveryParamSchema = object({
|
|
115447
|
+
key: string().min(1),
|
|
115448
|
+
label: string(),
|
|
115449
|
+
/** i18n key of the label, resolved by the declaring addon's namespace. */
|
|
115450
|
+
labelKey: string().optional(),
|
|
115451
|
+
type: _enum([
|
|
115452
|
+
"enum",
|
|
115453
|
+
"number",
|
|
115454
|
+
"boolean",
|
|
115455
|
+
"string"
|
|
115456
|
+
]),
|
|
115457
|
+
/** `enum` only: the closed set of accepted values. */
|
|
115458
|
+
options: array(object({
|
|
115459
|
+
value: string(),
|
|
115460
|
+
label: string()
|
|
115461
|
+
})).optional(),
|
|
115462
|
+
/** `number` only. */
|
|
115463
|
+
min: number().optional(),
|
|
115464
|
+
max: number().optional(),
|
|
115465
|
+
/** What the notifier does when the rule sets nothing; shown as the placeholder. */
|
|
115466
|
+
default: DeliveryParamValueSchema.optional()
|
|
115467
|
+
});
|
|
115468
|
+
/**
|
|
115469
|
+
* The canonical notification. `body` is the only hard field (Apprise model).
|
|
115470
|
+
* `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
|
|
115471
|
+
* NOT a fixed severity enum — each kind declares its own `caps.levels` and
|
|
115472
|
+
* the adapter maps this ordinal onto its native level. `level?` is an
|
|
115473
|
+
* optional kind-native level id (`emergency`, `silent`, …) that overrides
|
|
115474
|
+
* `priority` for that one target.
|
|
115475
|
+
*/
|
|
115476
|
+
var NotificationSchema = object({
|
|
115477
|
+
body: string(),
|
|
115478
|
+
title: string().optional(),
|
|
115479
|
+
format: NotificationFormatSchema.default("text"),
|
|
115480
|
+
priority: number().int().min(1).max(5).default(3),
|
|
115481
|
+
level: string().optional(),
|
|
115482
|
+
attachments: array(AttachmentSchema).optional(),
|
|
115483
|
+
clickUrl: string().optional(),
|
|
115484
|
+
actions: array(NotificationActionSchema).optional(),
|
|
115485
|
+
sound: string().optional(),
|
|
115486
|
+
ttl: number().optional(),
|
|
115487
|
+
tag: string().optional(),
|
|
115488
|
+
deviceId: number().optional(),
|
|
115489
|
+
eventId: string().optional(),
|
|
115490
|
+
metadata: record(string(), unknown()).optional(),
|
|
115491
|
+
/**
|
|
115492
|
+
* Values for the parameters the target's kind DECLARES in
|
|
115493
|
+
* {@link TargetKindSchema} `deliveryParams`. Already validated against the
|
|
115494
|
+
* declaration by the sender; a notifier reads only the keys it declared.
|
|
115495
|
+
*/
|
|
115496
|
+
delivery: record(string(), DeliveryParamValueSchema).optional()
|
|
115497
|
+
});
|
|
115498
|
+
/** One declared native severity/priority level for a kind. */
|
|
115499
|
+
var TargetKindLevelSchema = object({
|
|
115500
|
+
id: string(),
|
|
115501
|
+
label: string(),
|
|
115502
|
+
/** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
|
|
115503
|
+
ordinal: number().int().min(1).max(5).nullable(),
|
|
115504
|
+
flags: object({
|
|
115505
|
+
critical: boolean().optional(),
|
|
115506
|
+
silent: boolean().optional(),
|
|
115507
|
+
noPush: boolean().optional()
|
|
115508
|
+
}).optional(),
|
|
115509
|
+
/** e.g. Pushover `emergency` requires `retry` / `expire`. */
|
|
115510
|
+
requires: array(string()).optional(),
|
|
115511
|
+
description: string().optional()
|
|
114980
115512
|
});
|
|
114981
115513
|
/** The full capability block consulted before dispatch. */
|
|
114982
115514
|
var TargetKindCapsSchema = object({
|
|
@@ -115016,7 +115548,7 @@ var TargetKindCapsSchema = object({
|
|
|
115016
115548
|
* the union is large and not meant for runtime validation here; the exported
|
|
115017
115549
|
* `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
|
|
115018
115550
|
*/
|
|
115019
|
-
var ConfigSchemaPassthrough$
|
|
115551
|
+
var ConfigSchemaPassthrough$3 = unknown();
|
|
115020
115552
|
var TargetKindSchema = object({
|
|
115021
115553
|
kind: string(),
|
|
115022
115554
|
label: string(),
|
|
@@ -115053,7 +115585,7 @@ var TargetKindSchema = object({
|
|
|
115053
115585
|
* its raster path, which is the safe default for an unknown image.
|
|
115054
115586
|
*/
|
|
115055
115587
|
iconMediaType: string().optional(),
|
|
115056
|
-
configSchema: ConfigSchemaPassthrough$
|
|
115588
|
+
configSchema: ConfigSchemaPassthrough$3,
|
|
115057
115589
|
/**
|
|
115058
115590
|
* The config keys that decide WHERE this kind's secrets are sent (server,
|
|
115059
115591
|
* base URL, instance, chat, recipient). A save that changes any of them
|
|
@@ -115075,9 +115607,11 @@ var TargetKindSchema = object({
|
|
|
115075
115607
|
caps: TargetKindCapsSchema
|
|
115076
115608
|
});
|
|
115077
115609
|
/**
|
|
115078
|
-
* A
|
|
115079
|
-
*
|
|
115080
|
-
*
|
|
115610
|
+
* A target as a provider's own code sees it (the notification-center bridge, the
|
|
115611
|
+
* send path): the flat record body split into the name, the switch and the
|
|
115612
|
+
* kind's fields. `config` holds secrets; a reader that serves it to a client
|
|
115613
|
+
* REDACTS secret fields (a presence marker only) — never round-trip a stored
|
|
115614
|
+
* secret to the UI.
|
|
115081
115615
|
*/
|
|
115082
115616
|
var TargetSchema = object({
|
|
115083
115617
|
id: string(),
|
|
@@ -115120,13 +115654,13 @@ var ProbeTargetConfigResultSchema = object({
|
|
|
115120
115654
|
stateInstance: string().optional(),
|
|
115121
115655
|
error: string().optional()
|
|
115122
115656
|
});
|
|
115123
|
-
method(object({}), array(TargetKindSchema)), method(object({
|
|
115657
|
+
method(object({}), array(TargetKindSchema)), method(object({
|
|
115124
115658
|
kind: string(),
|
|
115125
115659
|
config: record(string(), unknown()).optional(),
|
|
115126
115660
|
/**
|
|
115127
115661
|
* When editing / duplicating, the blank password field never round-trips
|
|
115128
115662
|
* the stored token. Pass the source target id so the provider can restore
|
|
115129
|
-
* secrets server-side before dialling
|
|
115663
|
+
* secrets server-side before dialling.
|
|
115130
115664
|
*/
|
|
115131
115665
|
targetId: string().optional()
|
|
115132
115666
|
}), array(DiscoveredTargetSchema), { auth: "admin" }), method(object({
|
|
@@ -115149,27 +115683,6 @@ method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSche
|
|
|
115149
115683
|
}), TestResultSchema, {
|
|
115150
115684
|
kind: "mutation",
|
|
115151
115685
|
auth: "admin"
|
|
115152
|
-
}), method(object({
|
|
115153
|
-
target: TargetSchema,
|
|
115154
|
-
/**
|
|
115155
|
-
* Duplicate flow: create a NEW target id while copying secrets from an
|
|
115156
|
-
* existing row. The UI never holds the stored token; blank / redacted
|
|
115157
|
-
* password fields are restored from this source (D634 still applies if
|
|
115158
|
-
* destinations diverge without a re-typed secret).
|
|
115159
|
-
*/
|
|
115160
|
-
cloneSecretsFrom: string().optional()
|
|
115161
|
-
}), TargetSchema, {
|
|
115162
|
-
kind: "mutation",
|
|
115163
|
-
auth: "admin"
|
|
115164
|
-
}), method(object({ targetId: string() }), _void(), {
|
|
115165
|
-
kind: "mutation",
|
|
115166
|
-
auth: "admin"
|
|
115167
|
-
}), method(object({
|
|
115168
|
-
targetId: string(),
|
|
115169
|
-
enabled: boolean()
|
|
115170
|
-
}), _void(), {
|
|
115171
|
-
kind: "mutation",
|
|
115172
|
-
auth: "admin"
|
|
115173
115686
|
});
|
|
115174
115687
|
looseObject({
|
|
115175
115688
|
name: string().min(1),
|
|
@@ -124317,7 +124830,6 @@ var SYSTEM_CAP_VOCABULARY = {
|
|
|
124317
124830
|
"notification-output": system("notification delivery — reached through notifier devices and rules"),
|
|
124318
124831
|
"notification-rules": system("notification rules — authored on their own page"),
|
|
124319
124832
|
"oauth-integration": system(IDENTITY),
|
|
124320
|
-
"oidc-connections": system(IDENTITY),
|
|
124321
124833
|
"osd-manager": system(PIPELINE),
|
|
124322
124834
|
"pipeline-executor": system(PIPELINE),
|
|
124323
124835
|
"pipeline-orchestrator": system(PIPELINE),
|
|
@@ -144124,723 +144636,345 @@ var ICON_SYNONYMS = {
|
|
|
144124
144636
|
"capanno",
|
|
144125
144637
|
"deposito",
|
|
144126
144638
|
"cantina",
|
|
144127
|
-
"warehouse"
|
|
144128
|
-
],
|
|
144129
|
-
"washing-machine": [
|
|
144130
|
-
"lavatrice",
|
|
144131
|
-
"lavastoviglie",
|
|
144132
|
-
"asciugatrice"
|
|
144133
|
-
],
|
|
144134
|
-
waves: [
|
|
144135
|
-
"onde",
|
|
144136
|
-
"acqua",
|
|
144137
|
-
"vibrazione"
|
|
144138
|
-
],
|
|
144139
|
-
"waves-ladder": [
|
|
144140
|
-
"piscina",
|
|
144141
|
-
"vasca",
|
|
144142
|
-
"pool"
|
|
144143
|
-
],
|
|
144144
|
-
wifi: ["rete", "segnale"],
|
|
144145
|
-
"wifi-off": [
|
|
144146
|
-
"wifi",
|
|
144147
|
-
"assente",
|
|
144148
|
-
"offline",
|
|
144149
|
-
"disconnesso"
|
|
144150
|
-
],
|
|
144151
|
-
wind: [
|
|
144152
|
-
"vento",
|
|
144153
|
-
"aria",
|
|
144154
|
-
"gas",
|
|
144155
|
-
"monossido",
|
|
144156
|
-
"co"
|
|
144157
|
-
],
|
|
144158
|
-
workflow: [
|
|
144159
|
-
"automazione",
|
|
144160
|
-
"flusso",
|
|
144161
|
-
"scenario"
|
|
144162
|
-
],
|
|
144163
|
-
wrench: [
|
|
144164
|
-
"officina",
|
|
144165
|
-
"manutenzione",
|
|
144166
|
-
"attrezzi",
|
|
144167
|
-
"utenze"
|
|
144168
|
-
],
|
|
144169
|
-
zap: [
|
|
144170
|
-
"energia",
|
|
144171
|
-
"corrente",
|
|
144172
|
-
"consumo",
|
|
144173
|
-
"watt",
|
|
144174
|
-
"elettricita"
|
|
144175
|
-
]
|
|
144176
|
-
};
|
|
144177
|
-
/**
|
|
144178
|
-
* Spellings an operator may already have PERSISTED that no lucide package
|
|
144179
|
-
* accepts any more, and the catalog key they draw. They resolve
|
|
144180
|
-
* (`canonicalIconKey`) but are never offered. `gauge2` was this repo's own
|
|
144181
|
-
* pre-catalog spelling of `gauge`.
|
|
144182
|
-
*/
|
|
144183
|
-
var LEGACY_ICON_ALIASES = { gauge2: "gauge" };
|
|
144184
|
-
/**
|
|
144185
|
-
* icon-catalog — THE icon vocabulary (D854).
|
|
144186
|
-
*
|
|
144187
|
-
* Every place that picks or stores an icon — a device's display override, a
|
|
144188
|
-
* location, a site zone, a viewer accessory, an `icon` settings field — names
|
|
144189
|
-
* it by a key of this catalog and nothing else. There is no curated subset and
|
|
144190
|
-
* no second list: the catalog is every lucide icon that both surfaces can draw
|
|
144191
|
-
* (the admin UI's `lucide-react` and the viewer's `lucide-react-native`), the
|
|
144192
|
-
* intersection computed by `scripts/generate-icon-catalog.ts` into the
|
|
144193
|
-
* committed `icon-catalog.generated.ts`.
|
|
144194
|
-
*
|
|
144195
|
-
* Like the vocabularies it replaces, this module holds STRINGS only — no React,
|
|
144196
|
-
* no lucide import, no glyph. Each surface owns its glyph table (the web one
|
|
144197
|
-
* lives in `ui-library`, loaded lazily), and a test on each side pins that it
|
|
144198
|
-
* covers {@link ICON_KEYS}.
|
|
144199
|
-
*
|
|
144200
|
-
* ## What is persisted
|
|
144201
|
-
*
|
|
144202
|
-
* The canonical kebab-case lucide id ({@link IconKey}). Spellings that a lucide
|
|
144203
|
-
* package still accepts (`home` for `house`) and this repo's own legacy ones
|
|
144204
|
-
* (`gauge2`) RESOLVE ({@link canonicalIconKey}) so a stored value never goes
|
|
144205
|
-
* stale, but they are never OFFERED by search.
|
|
144206
|
-
*
|
|
144207
|
-
* ## Search
|
|
144208
|
-
*
|
|
144209
|
-
* Over the key, the Italian/English overlay in `icon-synonyms.ts`, any words
|
|
144210
|
-
* the caller adds, and lucide's English tags — in that order of weight.
|
|
144211
|
-
*/
|
|
144212
|
-
var KEY_SET$2 = new Set(ICON_KEYS);
|
|
144213
|
-
new Map([...Object.entries(ICON_ALIASES), ...Object.entries(LEGACY_ICON_ALIASES)]);
|
|
144214
|
-
/** Is this a canonical key of the catalog? (An alias is not — see {@link canonicalIconKey}.) */
|
|
144215
|
-
function isIconKey(value) {
|
|
144216
|
-
return typeof value === "string" && KEY_SET$2.has(value);
|
|
144217
|
-
}
|
|
144218
|
-
/**
|
|
144219
|
-
* Wire/storage schema for one icon key.
|
|
144220
|
-
*
|
|
144221
|
-
* Deliberately NOT a `z.enum` of the catalog: ~1,700 literals would be inlined
|
|
144222
|
-
* into every cap router, type and API-reference row that carries an icon. The
|
|
144223
|
-
* check is membership in the catalog and the type is {@link IconKey}.
|
|
144224
|
-
*/
|
|
144225
|
-
var IconKeySchema = custom(isIconKey, "Not an icon of the catalog");
|
|
144226
|
-
var ENTRIES = ICON_KEYS.map((key, index) => {
|
|
144227
|
-
const [categoryIndexes, tags] = ICON_META[index] ?? [[], []];
|
|
144228
|
-
const categories = categoryIndexes.flatMap((i) => {
|
|
144229
|
-
const id = ICON_CATEGORY_IDS[i];
|
|
144230
|
-
return id === void 0 ? [] : [id];
|
|
144231
|
-
});
|
|
144232
|
-
return {
|
|
144233
|
-
key,
|
|
144234
|
-
categories,
|
|
144235
|
-
primaryCategory: categories[0] ?? ICON_CATEGORY_IDS[0],
|
|
144236
|
-
tags,
|
|
144237
|
-
synonyms: ICON_SYNONYMS[key] ?? []
|
|
144238
|
-
};
|
|
144239
|
-
});
|
|
144240
|
-
new Map(ENTRIES.map((e) => [e.key, e]));
|
|
144241
|
-
/** Categories a picker offers first: the ones this product's icons mostly live in. */
|
|
144242
|
-
var LEADING_CATEGORIES = [
|
|
144243
|
-
"devices",
|
|
144244
|
-
"home",
|
|
144245
|
-
"security",
|
|
144246
|
-
"buildings",
|
|
144247
|
-
"connectivity",
|
|
144248
|
-
"multimedia",
|
|
144249
|
-
"nature",
|
|
144250
|
-
"weather",
|
|
144251
|
-
"transportation",
|
|
144252
|
-
"animals"
|
|
144253
|
-
];
|
|
144254
|
-
var PRIMARY_CATEGORIES = new Set(ENTRIES.map((e) => e.primaryCategory));
|
|
144255
|
-
[...LEADING_CATEGORIES, ...ICON_CATEGORY_IDS.filter((c) => !LEADING_CATEGORIES.includes(c))].filter((c) => PRIMARY_CATEGORIES.has(c));
|
|
144256
|
-
/**
|
|
144257
|
-
* One (location, icon) assignment as it travels.
|
|
144258
|
-
*
|
|
144259
|
-
* `locationKey` is ALWAYS {@link locationIconKey} of the label — never the
|
|
144260
|
-
* operator's casing. The registry matches labels trimmed + case-insensitively
|
|
144261
|
-
* everywhere (`addLocation`, `removeLocation`, `renameLocation`), and a
|
|
144262
|
-
* case-only rename (`kitchen` → `Kitchen`) is a real edit this repo supports; a
|
|
144263
|
-
* map keyed on the displayed casing would orphan its entry on exactly that
|
|
144264
|
-
* edit. Consumers join by keying their own label through `locationIconKey`.
|
|
144265
|
-
*/
|
|
144266
|
-
var LocationIconAssignmentSchema = object({
|
|
144267
|
-
locationKey: string(),
|
|
144268
|
-
icon: IconKeySchema
|
|
144269
|
-
});
|
|
144270
|
-
/**
|
|
144271
|
-
* One (location, description) assignment as it travels.
|
|
144272
|
-
*
|
|
144273
|
-
* Same key discipline as {@link LocationIconAssignmentSchema}, and for the same
|
|
144274
|
-
* reason: this lived for a while in the post-analysis addon's own settings,
|
|
144275
|
-
* keyed by a HAND-TYPED label matched exactly and case-sensitively. A rename in
|
|
144276
|
-
* the Locations page carried the icon and silently orphaned the description —
|
|
144277
|
-
* two authorities for one thing, joined by two different rules. Now both hang
|
|
144278
|
-
* off the location itself, on `locationIconKey`.
|
|
144279
|
-
*/
|
|
144280
|
-
var LocationDescriptionAssignmentSchema = object({
|
|
144281
|
-
locationKey: string(),
|
|
144282
|
-
description: string()
|
|
144283
|
-
});
|
|
144284
|
-
/**
|
|
144285
|
-
* WHO an action step acts on (D983) — one target shape for every place that
|
|
144286
|
-
* performs an action (automation steps, Action entries, notification
|
|
144287
|
-
* sequences, scheduler points):
|
|
144288
|
-
*
|
|
144289
|
-
* - `devices` — device ids the operator picked, frozen at save time;
|
|
144290
|
-
* - `domain` — every device that offers the step's VOCABULARY action,
|
|
144291
|
-
* optionally narrowed to one device type and one room, resolved WHEN THE
|
|
144292
|
-
* STEP RUNS (a device added later is included). The action always comes
|
|
144293
|
-
* from the vocabulary (`cover.open`), never from a raw cap name, so a
|
|
144294
|
-
* `domain` target needs an `actionId` (enforced on the step schema);
|
|
144295
|
-
* - `var` — a `$var` resolved from the run's scope.
|
|
144296
|
-
*
|
|
144297
|
-
* {@link ActionTargetResolver} turns a target into device ids. It is pure
|
|
144298
|
-
* (a {@link DeviceDirectory} is handed in) so the hub's core-blocks service and
|
|
144299
|
-
* a generated automation block share it.
|
|
144300
|
-
*
|
|
144301
|
-
* A room is the device's `location` label (`DeviceInfo.location`); two labels
|
|
144302
|
-
* name the same room when `locationIconKey` agrees (trimmed, lower-cased).
|
|
144303
|
-
*/
|
|
144304
|
-
var ActionTargetSchema = discriminatedUnion("kind", [
|
|
144305
|
-
object({
|
|
144306
|
-
kind: literal("devices"),
|
|
144307
|
-
ids: array(number().int()).min(1)
|
|
144308
|
-
}),
|
|
144309
|
-
object({
|
|
144310
|
-
kind: literal("domain"),
|
|
144311
|
-
/** Narrow to one kind of device. */
|
|
144312
|
-
deviceType: _enum(DeviceType).optional(),
|
|
144313
|
-
/** Narrow to one room: the `location` label devices carry. */
|
|
144314
|
-
roomId: string().min(1).optional()
|
|
144315
|
-
}),
|
|
144316
|
-
object({
|
|
144317
|
-
kind: literal("var"),
|
|
144318
|
-
name: string().min(1)
|
|
144319
|
-
})
|
|
144320
|
-
]);
|
|
144321
|
-
EventCategory.DeviceRegistered, EventCategory.DeviceUnregistered, EventCategory.DeviceUpdated, EventCategory.DeviceMetaChanged, EventCategory.DeviceBindingsChanged;
|
|
144322
|
-
var ExpressionBindingSourceSchema = union([
|
|
144323
|
-
object({
|
|
144324
|
-
kind: literal("field").optional(),
|
|
144325
|
-
sourceKey: string(),
|
|
144326
|
-
cap: string(),
|
|
144327
|
-
fieldPath: string()
|
|
144328
|
-
}),
|
|
144329
|
-
object({
|
|
144330
|
-
kind: literal("literal"),
|
|
144331
|
-
value: union([
|
|
144332
|
-
string(),
|
|
144333
|
-
number(),
|
|
144334
|
-
boolean(),
|
|
144335
|
-
_null()
|
|
144336
|
-
])
|
|
144337
|
-
}),
|
|
144338
|
-
object({
|
|
144339
|
-
kind: literal("global"),
|
|
144340
|
-
sourceStableId: string(),
|
|
144341
|
-
cap: string(),
|
|
144342
|
-
fieldPath: string()
|
|
144343
|
-
})
|
|
144344
|
-
]);
|
|
144345
|
-
object({
|
|
144346
|
-
expr: string().min(1).max(MAX_EXPRESSION_SOURCE_LENGTH),
|
|
144347
|
-
bindings: record(string().regex(EXPRESSION_IDENTIFIER_RE), ExpressionBindingSourceSchema)
|
|
144348
|
-
}).superRefine((src, ctx) => {
|
|
144349
|
-
const err = validateExpressionSource(src);
|
|
144350
|
-
if (err !== null) ctx.addIssue({
|
|
144351
|
-
code: "custom",
|
|
144352
|
-
message: err,
|
|
144353
|
-
path: ["expr"]
|
|
144354
|
-
});
|
|
144355
|
-
});
|
|
144356
|
-
/**
|
|
144357
|
-
* Identity envelope for a device's upstream-system metadata.
|
|
144358
|
-
*
|
|
144359
|
-
* Two jobs:
|
|
144360
|
-
*
|
|
144361
|
-
* 1. **Dispatch key.** `id` is the natural identifier the SOURCE system
|
|
144362
|
-
* uses to address this device (HA `entity_id`, Reolink MAC, ONVIF
|
|
144363
|
-
* WS-Discovery endpoint UUID, …). Provider code keeps a
|
|
144364
|
-
* `Map<sourceInfo.id, IDevice>` to route inbound push events in O(1)
|
|
144365
|
-
* without round-tripping through `stableId` / `id` mappings.
|
|
144366
|
-
*
|
|
144367
|
-
* 2. **Stability bridge.** `uniqueId` is the *immutable* upstream id when
|
|
144368
|
-
* one exists (HA `entity.unique_id`, Reolink MAC again — same as `id`
|
|
144369
|
-
* for vendors where MAC is the natural key). For systems where the
|
|
144370
|
-
* live dispatch key can be renamed (HA `entity_id` can be edited),
|
|
144371
|
-
* providers detect renames by matching `uniqueId` and patch `id`
|
|
144372
|
-
* in-place so dispatch keeps working.
|
|
144373
|
-
*
|
|
144374
|
-
* **Display unit and precision are NOT stored here.** They are a read-time
|
|
144375
|
-
* preference (D944). A polymorphic reading stores its `quantity` here once,
|
|
144376
|
-
* at adopt, and a date/time value stores `dateTimeShape` the same way —
|
|
144377
|
-
* neither is repeated on each sample. The `device_class` tag is an
|
|
144378
|
-
* HA-specific input consumed at the discovery boundary (`ha-domain-mapping`)
|
|
144379
|
-
* to derive the CamStack `DeviceRole`; it is never stored after that point.
|
|
144380
|
-
*
|
|
144381
|
-
* The `raw` escape hatch carries provider-specific attributes that don't
|
|
144382
|
-
* fit the structured slots (HA `attributes` whitelist, Reolink `deviceCache`
|
|
144383
|
-
* details, …). Providers control what lands here.
|
|
144384
|
-
*/
|
|
144385
|
-
var SourceInfoSchema = object({
|
|
144386
|
-
/** Live dispatch key — mutable when the source system allows rename. */
|
|
144387
|
-
id: string(),
|
|
144388
|
-
/** Source system tag — e.g. 'homeassistant' | 'reolink' | 'onvif'. */
|
|
144389
|
-
system: string(),
|
|
144390
|
-
/** Immutable upstream identifier when available (HA `unique_id`, … ).
|
|
144391
|
-
* Used to detect rename when `id` changes. */
|
|
144392
|
-
uniqueId: string().optional(),
|
|
144393
|
-
/** Quantity of a polymorphic reading, written once at adopt (D944). */
|
|
144394
|
-
quantity: ReadingQuantitySchema.optional(),
|
|
144395
|
-
/** Date / time / datetime shape of a string reading, written once at adopt. */
|
|
144396
|
-
dateTimeShape: _enum([
|
|
144397
|
-
"date",
|
|
144398
|
-
"time",
|
|
144399
|
-
"datetime"
|
|
144400
|
-
]).optional(),
|
|
144401
|
-
/** Provider-specific extras that don't fit the structured slots.
|
|
144402
|
-
* Whitelist what goes here per provider — do NOT dump entire HA
|
|
144403
|
-
* attribute blobs (would explode the meta JSON column). */
|
|
144404
|
-
raw: record(string(), unknown()).optional()
|
|
144405
|
-
});
|
|
144406
|
-
/**
|
|
144407
|
-
* Build the synthetic SourceInfo every existing provider falls back to
|
|
144408
|
-
* when no upstream value has been persisted. Keeps non-migrated providers
|
|
144409
|
-
* (Reolink / Hikvision / ONVIF / RTSP) functional without code
|
|
144410
|
-
* changes — `id` reuses the CamStack stableId, `system` reuses the addon
|
|
144411
|
-
* id. Real upstream identity replaces this once a provider migrates and
|
|
144412
|
-
* calls `updateSourceInfo()` with concrete values.
|
|
144413
|
-
*/
|
|
144414
|
-
function synthesizeSourceInfo(input) {
|
|
144415
|
-
return {
|
|
144416
|
-
id: input.stableId,
|
|
144417
|
-
system: input.addonId
|
|
144418
|
-
};
|
|
144419
|
-
}
|
|
144420
|
-
/**
|
|
144421
|
-
* Shallow-merge a partial patch over a prior SourceInfo. `undefined`
|
|
144422
|
-
* patch values are ignored (no field clobber); to clear a field
|
|
144423
|
-
* explicitly, providers omit it from the patch and rebuild from scratch
|
|
144424
|
-
* via `updateSourceInfo({})` cycles — uncommon enough that we don't
|
|
144425
|
-
* bother with a `null`-means-delete sentinel.
|
|
144426
|
-
*
|
|
144427
|
-
* The `raw` field is also shallow-merged: passing `raw: { foo: 1 }`
|
|
144428
|
-
* merges over existing `raw` keys instead of replacing the whole bag.
|
|
144429
|
-
*/
|
|
144430
|
-
function mergeSourceInfo(prev, patch) {
|
|
144431
|
-
const next = { ...prev };
|
|
144432
|
-
for (const [k, v] of Object.entries(patch)) {
|
|
144433
|
-
if (v === void 0) continue;
|
|
144434
|
-
if (k === "raw" && typeof v === "object" && v !== null) {
|
|
144435
|
-
next.raw = {
|
|
144436
|
-
...prev.raw,
|
|
144437
|
-
...v
|
|
144438
|
-
};
|
|
144439
|
-
continue;
|
|
144440
|
-
}
|
|
144441
|
-
next[k] = v;
|
|
144442
|
-
}
|
|
144443
|
-
return next;
|
|
144444
|
-
}
|
|
144445
|
-
/**
|
|
144446
|
-
* Key under which `SourceInfo` lives inside `DeviceMeta.metadata`. The
|
|
144447
|
-
* blob is a free-form `Record<string, unknown>` shared with hardware-
|
|
144448
|
-
* identity fields (`manufacturer`, `model`, `firmware`, …); SourceInfo
|
|
144449
|
-
* lives under a single nested key to keep it composable with those.
|
|
144450
|
-
*/
|
|
144451
|
-
var SOURCE_INFO_METADATA_KEY = "sourceInfo";
|
|
144452
|
-
/**
|
|
144453
|
-
* Extract a SourceInfo from a `DeviceMeta.metadata` blob, validating
|
|
144454
|
-
* with Zod. Returns `null` when the blob is missing or the nested
|
|
144455
|
-
* `sourceInfo` key fails validation — callers fall back to the
|
|
144456
|
-
* synthetic default in that case (see `synthesizeSourceInfo`).
|
|
144457
|
-
*/
|
|
144458
|
-
function extractSourceInfoFromMetadata(metadata) {
|
|
144459
|
-
if (!metadata) return null;
|
|
144460
|
-
const raw = metadata[SOURCE_INFO_METADATA_KEY];
|
|
144461
|
-
if (!raw) return null;
|
|
144462
|
-
const parsed = SourceInfoSchema.safeParse(raw);
|
|
144463
|
-
if (!parsed.success) return null;
|
|
144464
|
-
return parsed.data;
|
|
144465
|
-
}
|
|
144466
|
-
/**
|
|
144467
|
-
* Frozen unit → spec table. `•` in the doc marks each dimension's canonical
|
|
144468
|
-
* unit (`factor: 1, offset: 0`). °F derives from `°C = (°F − 32) × 5/9` ⇒
|
|
144469
|
-
* `factor = 5/9`, `offset = -160/9` (kept as exact expressions, not rounded
|
|
144470
|
-
* decimals). K derives from `°C = K − 273.15`.
|
|
144471
|
-
*/
|
|
144472
|
-
var UNIT_TABLE = {
|
|
144473
|
-
"°C": {
|
|
144474
|
-
dimension: "temperature",
|
|
144475
|
-
factor: 1,
|
|
144476
|
-
offset: 0
|
|
144477
|
-
},
|
|
144478
|
-
"°F": {
|
|
144479
|
-
dimension: "temperature",
|
|
144480
|
-
factor: 5 / 9,
|
|
144481
|
-
offset: -160 / 9
|
|
144482
|
-
},
|
|
144483
|
-
K: {
|
|
144484
|
-
dimension: "temperature",
|
|
144485
|
-
factor: 1,
|
|
144486
|
-
offset: -273.15
|
|
144487
|
-
},
|
|
144488
|
-
hPa: {
|
|
144489
|
-
dimension: "pressure",
|
|
144490
|
-
factor: 1,
|
|
144491
|
-
offset: 0
|
|
144492
|
-
},
|
|
144493
|
-
kPa: {
|
|
144494
|
-
dimension: "pressure",
|
|
144495
|
-
factor: 10,
|
|
144496
|
-
offset: 0
|
|
144497
|
-
},
|
|
144498
|
-
Pa: {
|
|
144499
|
-
dimension: "pressure",
|
|
144500
|
-
factor: .01,
|
|
144501
|
-
offset: 0
|
|
144502
|
-
},
|
|
144503
|
-
mbar: {
|
|
144504
|
-
dimension: "pressure",
|
|
144505
|
-
factor: 1,
|
|
144506
|
-
offset: 0
|
|
144507
|
-
},
|
|
144508
|
-
bar: {
|
|
144509
|
-
dimension: "pressure",
|
|
144510
|
-
factor: 1e3,
|
|
144511
|
-
offset: 0
|
|
144512
|
-
},
|
|
144513
|
-
inHg: {
|
|
144514
|
-
dimension: "pressure",
|
|
144515
|
-
factor: 33.8639,
|
|
144516
|
-
offset: 0
|
|
144517
|
-
},
|
|
144518
|
-
mmHg: {
|
|
144519
|
-
dimension: "pressure",
|
|
144520
|
-
factor: 1.33322,
|
|
144521
|
-
offset: 0
|
|
144522
|
-
},
|
|
144523
|
-
psi: {
|
|
144524
|
-
dimension: "pressure",
|
|
144525
|
-
factor: 68.9476,
|
|
144526
|
-
offset: 0
|
|
144527
|
-
},
|
|
144528
|
-
"m/s": {
|
|
144529
|
-
dimension: "speed",
|
|
144530
|
-
factor: 1,
|
|
144531
|
-
offset: 0
|
|
144532
|
-
},
|
|
144533
|
-
"km/h": {
|
|
144534
|
-
dimension: "speed",
|
|
144535
|
-
factor: 1 / 3.6,
|
|
144536
|
-
offset: 0
|
|
144537
|
-
},
|
|
144538
|
-
mph: {
|
|
144539
|
-
dimension: "speed",
|
|
144540
|
-
factor: .44704,
|
|
144541
|
-
offset: 0
|
|
144542
|
-
},
|
|
144543
|
-
kn: {
|
|
144544
|
-
dimension: "speed",
|
|
144545
|
-
factor: .514444,
|
|
144546
|
-
offset: 0
|
|
144547
|
-
},
|
|
144548
|
-
"mm/h": {
|
|
144549
|
-
dimension: "precipitation-rate",
|
|
144550
|
-
factor: 1,
|
|
144551
|
-
offset: 0
|
|
144552
|
-
},
|
|
144553
|
-
"in/h": {
|
|
144554
|
-
dimension: "precipitation-rate",
|
|
144555
|
-
factor: 25.4,
|
|
144556
|
-
offset: 0
|
|
144557
|
-
},
|
|
144558
|
-
m: {
|
|
144559
|
-
dimension: "length",
|
|
144560
|
-
factor: 1,
|
|
144561
|
-
offset: 0
|
|
144562
|
-
},
|
|
144563
|
-
mm: {
|
|
144564
|
-
dimension: "length",
|
|
144565
|
-
factor: .001,
|
|
144566
|
-
offset: 0
|
|
144567
|
-
},
|
|
144568
|
-
cm: {
|
|
144569
|
-
dimension: "length",
|
|
144570
|
-
factor: .01,
|
|
144571
|
-
offset: 0
|
|
144572
|
-
},
|
|
144573
|
-
km: {
|
|
144574
|
-
dimension: "length",
|
|
144575
|
-
factor: 1e3,
|
|
144576
|
-
offset: 0
|
|
144577
|
-
},
|
|
144578
|
-
in: {
|
|
144579
|
-
dimension: "length",
|
|
144580
|
-
factor: .0254,
|
|
144581
|
-
offset: 0
|
|
144582
|
-
},
|
|
144583
|
-
ft: {
|
|
144584
|
-
dimension: "length",
|
|
144585
|
-
factor: .3048,
|
|
144586
|
-
offset: 0
|
|
144587
|
-
},
|
|
144588
|
-
mi: {
|
|
144589
|
-
dimension: "length",
|
|
144590
|
-
factor: 1609.344,
|
|
144591
|
-
offset: 0
|
|
144592
|
-
},
|
|
144593
|
-
"m²": {
|
|
144594
|
-
dimension: "area",
|
|
144595
|
-
factor: 1,
|
|
144596
|
-
offset: 0
|
|
144597
|
-
},
|
|
144598
|
-
lx: {
|
|
144599
|
-
dimension: "illuminance",
|
|
144600
|
-
factor: 1,
|
|
144601
|
-
offset: 0
|
|
144602
|
-
},
|
|
144603
|
-
"W/m²": {
|
|
144604
|
-
dimension: "irradiance",
|
|
144605
|
-
factor: 1,
|
|
144606
|
-
offset: 0
|
|
144607
|
-
},
|
|
144608
|
-
W: {
|
|
144609
|
-
dimension: "power",
|
|
144610
|
-
factor: 1,
|
|
144611
|
-
offset: 0
|
|
144612
|
-
},
|
|
144613
|
-
kW: {
|
|
144614
|
-
dimension: "power",
|
|
144615
|
-
factor: 1e3,
|
|
144616
|
-
offset: 0
|
|
144617
|
-
},
|
|
144618
|
-
VA: {
|
|
144619
|
-
dimension: "apparent-power",
|
|
144620
|
-
factor: 1,
|
|
144621
|
-
offset: 0
|
|
144622
|
-
},
|
|
144623
|
-
Wh: {
|
|
144624
|
-
dimension: "energy",
|
|
144625
|
-
factor: 1,
|
|
144626
|
-
offset: 0
|
|
144627
|
-
},
|
|
144628
|
-
kWh: {
|
|
144629
|
-
dimension: "energy",
|
|
144630
|
-
factor: 1e3,
|
|
144631
|
-
offset: 0
|
|
144632
|
-
},
|
|
144633
|
-
MWh: {
|
|
144634
|
-
dimension: "energy",
|
|
144635
|
-
factor: 1e6,
|
|
144636
|
-
offset: 0
|
|
144637
|
-
},
|
|
144638
|
-
V: {
|
|
144639
|
-
dimension: "voltage",
|
|
144640
|
-
factor: 1,
|
|
144641
|
-
offset: 0
|
|
144642
|
-
},
|
|
144643
|
-
mV: {
|
|
144644
|
-
dimension: "voltage",
|
|
144645
|
-
factor: .001,
|
|
144646
|
-
offset: 0
|
|
144647
|
-
},
|
|
144648
|
-
A: {
|
|
144649
|
-
dimension: "current",
|
|
144650
|
-
factor: 1,
|
|
144651
|
-
offset: 0
|
|
144652
|
-
},
|
|
144653
|
-
mA: {
|
|
144654
|
-
dimension: "current",
|
|
144655
|
-
factor: .001,
|
|
144656
|
-
offset: 0
|
|
144657
|
-
},
|
|
144658
|
-
ppm: {
|
|
144659
|
-
dimension: "concentration-volume",
|
|
144660
|
-
factor: 1,
|
|
144661
|
-
offset: 0
|
|
144662
|
-
},
|
|
144663
|
-
ppb: {
|
|
144664
|
-
dimension: "concentration-volume",
|
|
144665
|
-
factor: .001,
|
|
144666
|
-
offset: 0
|
|
144667
|
-
},
|
|
144668
|
-
"µg/m³": {
|
|
144669
|
-
dimension: "concentration-mass",
|
|
144670
|
-
factor: 1,
|
|
144671
|
-
offset: 0
|
|
144672
|
-
},
|
|
144673
|
-
"mg/m³": {
|
|
144674
|
-
dimension: "concentration-mass",
|
|
144675
|
-
factor: 1e3,
|
|
144676
|
-
offset: 0
|
|
144677
|
-
},
|
|
144678
|
-
kg: {
|
|
144679
|
-
dimension: "mass",
|
|
144680
|
-
factor: 1,
|
|
144681
|
-
offset: 0
|
|
144682
|
-
},
|
|
144683
|
-
g: {
|
|
144684
|
-
dimension: "mass",
|
|
144685
|
-
factor: .001,
|
|
144686
|
-
offset: 0
|
|
144687
|
-
},
|
|
144688
|
-
lb: {
|
|
144689
|
-
dimension: "mass",
|
|
144690
|
-
factor: .453592,
|
|
144691
|
-
offset: 0
|
|
144692
|
-
},
|
|
144693
|
-
oz: {
|
|
144694
|
-
dimension: "mass",
|
|
144695
|
-
factor: .0283495,
|
|
144696
|
-
offset: 0
|
|
144697
|
-
},
|
|
144698
|
-
"%": {
|
|
144699
|
-
dimension: "percentage",
|
|
144700
|
-
factor: 1,
|
|
144701
|
-
offset: 0
|
|
144702
|
-
},
|
|
144703
|
-
L: {
|
|
144704
|
-
dimension: "volume",
|
|
144705
|
-
factor: 1,
|
|
144706
|
-
offset: 0
|
|
144707
|
-
},
|
|
144708
|
-
mL: {
|
|
144709
|
-
dimension: "volume",
|
|
144710
|
-
factor: .001,
|
|
144711
|
-
offset: 0
|
|
144712
|
-
},
|
|
144713
|
-
gal: {
|
|
144714
|
-
dimension: "volume",
|
|
144715
|
-
factor: 3.785411784,
|
|
144716
|
-
offset: 0
|
|
144717
|
-
},
|
|
144718
|
-
s: {
|
|
144719
|
-
dimension: "duration",
|
|
144720
|
-
factor: 1,
|
|
144721
|
-
offset: 0
|
|
144722
|
-
},
|
|
144723
|
-
ms: {
|
|
144724
|
-
dimension: "duration",
|
|
144725
|
-
factor: .001,
|
|
144726
|
-
offset: 0
|
|
144727
|
-
},
|
|
144728
|
-
min: {
|
|
144729
|
-
dimension: "duration",
|
|
144730
|
-
factor: 60,
|
|
144731
|
-
offset: 0
|
|
144732
|
-
},
|
|
144733
|
-
h: {
|
|
144734
|
-
dimension: "duration",
|
|
144735
|
-
factor: 3600,
|
|
144736
|
-
offset: 0
|
|
144737
|
-
},
|
|
144738
|
-
d: {
|
|
144739
|
-
dimension: "duration",
|
|
144740
|
-
factor: 86400,
|
|
144741
|
-
offset: 0
|
|
144742
|
-
},
|
|
144743
|
-
B: {
|
|
144744
|
-
dimension: "information",
|
|
144745
|
-
factor: 1,
|
|
144746
|
-
offset: 0
|
|
144747
|
-
},
|
|
144748
|
-
KiB: {
|
|
144749
|
-
dimension: "information",
|
|
144750
|
-
factor: 1024,
|
|
144751
|
-
offset: 0
|
|
144752
|
-
},
|
|
144753
|
-
MiB: {
|
|
144754
|
-
dimension: "information",
|
|
144755
|
-
factor: 1024 ** 2,
|
|
144756
|
-
offset: 0
|
|
144757
|
-
},
|
|
144758
|
-
GiB: {
|
|
144759
|
-
dimension: "information",
|
|
144760
|
-
factor: 1024 ** 3,
|
|
144761
|
-
offset: 0
|
|
144762
|
-
},
|
|
144763
|
-
TiB: {
|
|
144764
|
-
dimension: "information",
|
|
144765
|
-
factor: 1024 ** 4,
|
|
144766
|
-
offset: 0
|
|
144767
|
-
},
|
|
144768
|
-
kB: {
|
|
144769
|
-
dimension: "information",
|
|
144770
|
-
factor: 1e3,
|
|
144771
|
-
offset: 0
|
|
144772
|
-
},
|
|
144773
|
-
MB: {
|
|
144774
|
-
dimension: "information",
|
|
144775
|
-
factor: 1e6,
|
|
144776
|
-
offset: 0
|
|
144777
|
-
},
|
|
144778
|
-
GB: {
|
|
144779
|
-
dimension: "information",
|
|
144780
|
-
factor: 1e9,
|
|
144781
|
-
offset: 0
|
|
144782
|
-
},
|
|
144783
|
-
"°": {
|
|
144784
|
-
dimension: "angle",
|
|
144785
|
-
factor: 1,
|
|
144786
|
-
offset: 0
|
|
144787
|
-
},
|
|
144788
|
-
dBFS: {
|
|
144789
|
-
dimension: "sound-level",
|
|
144790
|
-
factor: 1,
|
|
144791
|
-
offset: 0
|
|
144792
|
-
},
|
|
144793
|
-
dBm: {
|
|
144794
|
-
dimension: "signal-level",
|
|
144795
|
-
factor: 1,
|
|
144796
|
-
offset: 0
|
|
144797
|
-
},
|
|
144798
|
-
mired: {
|
|
144799
|
-
dimension: "colour-temperature",
|
|
144800
|
-
factor: 1,
|
|
144801
|
-
offset: 0
|
|
144802
|
-
},
|
|
144803
|
-
kbps: {
|
|
144804
|
-
dimension: "bitrate",
|
|
144805
|
-
factor: 1,
|
|
144806
|
-
offset: 0
|
|
144807
|
-
},
|
|
144808
|
-
Mbps: {
|
|
144809
|
-
dimension: "bitrate",
|
|
144810
|
-
factor: 1e3,
|
|
144811
|
-
offset: 0
|
|
144812
|
-
},
|
|
144813
|
-
fps: {
|
|
144814
|
-
dimension: "rate",
|
|
144815
|
-
factor: 1,
|
|
144816
|
-
offset: 0
|
|
144817
|
-
}
|
|
144639
|
+
"warehouse"
|
|
144640
|
+
],
|
|
144641
|
+
"washing-machine": [
|
|
144642
|
+
"lavatrice",
|
|
144643
|
+
"lavastoviglie",
|
|
144644
|
+
"asciugatrice"
|
|
144645
|
+
],
|
|
144646
|
+
waves: [
|
|
144647
|
+
"onde",
|
|
144648
|
+
"acqua",
|
|
144649
|
+
"vibrazione"
|
|
144650
|
+
],
|
|
144651
|
+
"waves-ladder": [
|
|
144652
|
+
"piscina",
|
|
144653
|
+
"vasca",
|
|
144654
|
+
"pool"
|
|
144655
|
+
],
|
|
144656
|
+
wifi: ["rete", "segnale"],
|
|
144657
|
+
"wifi-off": [
|
|
144658
|
+
"wifi",
|
|
144659
|
+
"assente",
|
|
144660
|
+
"offline",
|
|
144661
|
+
"disconnesso"
|
|
144662
|
+
],
|
|
144663
|
+
wind: [
|
|
144664
|
+
"vento",
|
|
144665
|
+
"aria",
|
|
144666
|
+
"gas",
|
|
144667
|
+
"monossido",
|
|
144668
|
+
"co"
|
|
144669
|
+
],
|
|
144670
|
+
workflow: [
|
|
144671
|
+
"automazione",
|
|
144672
|
+
"flusso",
|
|
144673
|
+
"scenario"
|
|
144674
|
+
],
|
|
144675
|
+
wrench: [
|
|
144676
|
+
"officina",
|
|
144677
|
+
"manutenzione",
|
|
144678
|
+
"attrezzi",
|
|
144679
|
+
"utenze"
|
|
144680
|
+
],
|
|
144681
|
+
zap: [
|
|
144682
|
+
"energia",
|
|
144683
|
+
"corrente",
|
|
144684
|
+
"consumo",
|
|
144685
|
+
"watt",
|
|
144686
|
+
"elettricita"
|
|
144687
|
+
]
|
|
144818
144688
|
};
|
|
144819
|
-
/**
|
|
144820
|
-
|
|
144821
|
-
|
|
144689
|
+
/**
|
|
144690
|
+
* Spellings an operator may already have PERSISTED that no lucide package
|
|
144691
|
+
* accepts any more, and the catalog key they draw. They resolve
|
|
144692
|
+
* (`canonicalIconKey`) but are never offered. `gauge2` was this repo's own
|
|
144693
|
+
* pre-catalog spelling of `gauge`.
|
|
144694
|
+
*/
|
|
144695
|
+
var LEGACY_ICON_ALIASES = { gauge2: "gauge" };
|
|
144696
|
+
/**
|
|
144697
|
+
* icon-catalog — THE icon vocabulary (D854).
|
|
144698
|
+
*
|
|
144699
|
+
* Every place that picks or stores an icon — a device's display override, a
|
|
144700
|
+
* location, a site zone, a viewer accessory, an `icon` settings field — names
|
|
144701
|
+
* it by a key of this catalog and nothing else. There is no curated subset and
|
|
144702
|
+
* no second list: the catalog is every lucide icon that both surfaces can draw
|
|
144703
|
+
* (the admin UI's `lucide-react` and the viewer's `lucide-react-native`), the
|
|
144704
|
+
* intersection computed by `scripts/generate-icon-catalog.ts` into the
|
|
144705
|
+
* committed `icon-catalog.generated.ts`.
|
|
144706
|
+
*
|
|
144707
|
+
* Like the vocabularies it replaces, this module holds STRINGS only — no React,
|
|
144708
|
+
* no lucide import, no glyph. Each surface owns its glyph table (the web one
|
|
144709
|
+
* lives in `ui-library`, loaded lazily), and a test on each side pins that it
|
|
144710
|
+
* covers {@link ICON_KEYS}.
|
|
144711
|
+
*
|
|
144712
|
+
* ## What is persisted
|
|
144713
|
+
*
|
|
144714
|
+
* The canonical kebab-case lucide id ({@link IconKey}). Spellings that a lucide
|
|
144715
|
+
* package still accepts (`home` for `house`) and this repo's own legacy ones
|
|
144716
|
+
* (`gauge2`) RESOLVE ({@link canonicalIconKey}) so a stored value never goes
|
|
144717
|
+
* stale, but they are never OFFERED by search.
|
|
144718
|
+
*
|
|
144719
|
+
* ## Search
|
|
144720
|
+
*
|
|
144721
|
+
* Over the key, the Italian/English overlay in `icon-synonyms.ts`, any words
|
|
144722
|
+
* the caller adds, and lucide's English tags — in that order of weight.
|
|
144723
|
+
*/
|
|
144724
|
+
var KEY_SET$2 = new Set(ICON_KEYS);
|
|
144725
|
+
new Map([...Object.entries(ICON_ALIASES), ...Object.entries(LEGACY_ICON_ALIASES)]);
|
|
144726
|
+
/** Is this a canonical key of the catalog? (An alias is not — see {@link canonicalIconKey}.) */
|
|
144727
|
+
function isIconKey(value) {
|
|
144728
|
+
return typeof value === "string" && KEY_SET$2.has(value);
|
|
144822
144729
|
}
|
|
144823
|
-
/**
|
|
144824
|
-
|
|
144825
|
-
|
|
144730
|
+
/**
|
|
144731
|
+
* Wire/storage schema for one icon key.
|
|
144732
|
+
*
|
|
144733
|
+
* Deliberately NOT a `z.enum` of the catalog: ~1,700 literals would be inlined
|
|
144734
|
+
* into every cap router, type and API-reference row that carries an icon. The
|
|
144735
|
+
* check is membership in the catalog and the type is {@link IconKey}.
|
|
144736
|
+
*/
|
|
144737
|
+
var IconKeySchema = custom(isIconKey, "Not an icon of the catalog");
|
|
144738
|
+
var ENTRIES = ICON_KEYS.map((key, index) => {
|
|
144739
|
+
const [categoryIndexes, tags] = ICON_META[index] ?? [[], []];
|
|
144740
|
+
const categories = categoryIndexes.flatMap((i) => {
|
|
144741
|
+
const id = ICON_CATEGORY_IDS[i];
|
|
144742
|
+
return id === void 0 ? [] : [id];
|
|
144743
|
+
});
|
|
144744
|
+
return {
|
|
144745
|
+
key,
|
|
144746
|
+
categories,
|
|
144747
|
+
primaryCategory: categories[0] ?? ICON_CATEGORY_IDS[0],
|
|
144748
|
+
tags,
|
|
144749
|
+
synonyms: ICON_SYNONYMS[key] ?? []
|
|
144750
|
+
};
|
|
144751
|
+
});
|
|
144752
|
+
new Map(ENTRIES.map((e) => [e.key, e]));
|
|
144753
|
+
/** Categories a picker offers first: the ones this product's icons mostly live in. */
|
|
144754
|
+
var LEADING_CATEGORIES = [
|
|
144755
|
+
"devices",
|
|
144756
|
+
"home",
|
|
144757
|
+
"security",
|
|
144758
|
+
"buildings",
|
|
144759
|
+
"connectivity",
|
|
144760
|
+
"multimedia",
|
|
144761
|
+
"nature",
|
|
144762
|
+
"weather",
|
|
144763
|
+
"transportation",
|
|
144764
|
+
"animals"
|
|
144765
|
+
];
|
|
144766
|
+
var PRIMARY_CATEGORIES = new Set(ENTRIES.map((e) => e.primaryCategory));
|
|
144767
|
+
[...LEADING_CATEGORIES, ...ICON_CATEGORY_IDS.filter((c) => !LEADING_CATEGORIES.includes(c))].filter((c) => PRIMARY_CATEGORIES.has(c));
|
|
144768
|
+
/**
|
|
144769
|
+
* One (location, icon) assignment as it travels.
|
|
144770
|
+
*
|
|
144771
|
+
* `locationKey` is ALWAYS {@link locationIconKey} of the label — never the
|
|
144772
|
+
* operator's casing. The registry matches labels trimmed + case-insensitively
|
|
144773
|
+
* everywhere (`addLocation`, `removeLocation`, `renameLocation`), and a
|
|
144774
|
+
* case-only rename (`kitchen` → `Kitchen`) is a real edit this repo supports; a
|
|
144775
|
+
* map keyed on the displayed casing would orphan its entry on exactly that
|
|
144776
|
+
* edit. Consumers join by keying their own label through `locationIconKey`.
|
|
144777
|
+
*/
|
|
144778
|
+
var LocationIconAssignmentSchema = object({
|
|
144779
|
+
locationKey: string(),
|
|
144780
|
+
icon: IconKeySchema
|
|
144781
|
+
});
|
|
144782
|
+
/**
|
|
144783
|
+
* One (location, description) assignment as it travels.
|
|
144784
|
+
*
|
|
144785
|
+
* Same key discipline as {@link LocationIconAssignmentSchema}, and for the same
|
|
144786
|
+
* reason: this lived for a while in the post-analysis addon's own settings,
|
|
144787
|
+
* keyed by a HAND-TYPED label matched exactly and case-sensitively. A rename in
|
|
144788
|
+
* the Locations page carried the icon and silently orphaned the description —
|
|
144789
|
+
* two authorities for one thing, joined by two different rules. Now both hang
|
|
144790
|
+
* off the location itself, on `locationIconKey`.
|
|
144791
|
+
*/
|
|
144792
|
+
var LocationDescriptionAssignmentSchema = object({
|
|
144793
|
+
locationKey: string(),
|
|
144794
|
+
description: string()
|
|
144795
|
+
});
|
|
144796
|
+
/**
|
|
144797
|
+
* WHO an action step acts on (D983) — one target shape for every place that
|
|
144798
|
+
* performs an action (automation steps, Action entries, notification
|
|
144799
|
+
* sequences, scheduler points):
|
|
144800
|
+
*
|
|
144801
|
+
* - `devices` — device ids the operator picked, frozen at save time;
|
|
144802
|
+
* - `domain` — every device that offers the step's VOCABULARY action,
|
|
144803
|
+
* optionally narrowed to one device type and one room, resolved WHEN THE
|
|
144804
|
+
* STEP RUNS (a device added later is included). The action always comes
|
|
144805
|
+
* from the vocabulary (`cover.open`), never from a raw cap name, so a
|
|
144806
|
+
* `domain` target needs an `actionId` (enforced on the step schema);
|
|
144807
|
+
* - `var` — a `$var` resolved from the run's scope.
|
|
144808
|
+
*
|
|
144809
|
+
* {@link ActionTargetResolver} turns a target into device ids. It is pure
|
|
144810
|
+
* (a {@link DeviceDirectory} is handed in) so the hub's core-blocks service and
|
|
144811
|
+
* a generated automation block share it.
|
|
144812
|
+
*
|
|
144813
|
+
* A room is the device's `location` label (`DeviceInfo.location`); two labels
|
|
144814
|
+
* name the same room when `locationIconKey` agrees (trimmed, lower-cased).
|
|
144815
|
+
*/
|
|
144816
|
+
var ActionTargetSchema = discriminatedUnion("kind", [
|
|
144817
|
+
object({
|
|
144818
|
+
kind: literal("devices"),
|
|
144819
|
+
ids: array(number().int()).min(1)
|
|
144820
|
+
}),
|
|
144821
|
+
object({
|
|
144822
|
+
kind: literal("domain"),
|
|
144823
|
+
/** Narrow to one kind of device. */
|
|
144824
|
+
deviceType: _enum(DeviceType).optional(),
|
|
144825
|
+
/** Narrow to one room: the `location` label devices carry. */
|
|
144826
|
+
roomId: string().min(1).optional()
|
|
144827
|
+
}),
|
|
144828
|
+
object({
|
|
144829
|
+
kind: literal("var"),
|
|
144830
|
+
name: string().min(1)
|
|
144831
|
+
})
|
|
144832
|
+
]);
|
|
144833
|
+
EventCategory.DeviceRegistered, EventCategory.DeviceUnregistered, EventCategory.DeviceUpdated, EventCategory.DeviceMetaChanged, EventCategory.DeviceBindingsChanged;
|
|
144834
|
+
var ExpressionBindingSourceSchema = union([
|
|
144835
|
+
object({
|
|
144836
|
+
kind: literal("field").optional(),
|
|
144837
|
+
sourceKey: string(),
|
|
144838
|
+
cap: string(),
|
|
144839
|
+
fieldPath: string()
|
|
144840
|
+
}),
|
|
144841
|
+
object({
|
|
144842
|
+
kind: literal("literal"),
|
|
144843
|
+
value: union([
|
|
144844
|
+
string(),
|
|
144845
|
+
number(),
|
|
144846
|
+
boolean(),
|
|
144847
|
+
_null()
|
|
144848
|
+
])
|
|
144849
|
+
}),
|
|
144850
|
+
object({
|
|
144851
|
+
kind: literal("global"),
|
|
144852
|
+
sourceStableId: string(),
|
|
144853
|
+
addonId: string().optional(),
|
|
144854
|
+
cap: string(),
|
|
144855
|
+
fieldPath: string()
|
|
144856
|
+
})
|
|
144857
|
+
]);
|
|
144858
|
+
object({
|
|
144859
|
+
expr: string().min(1).max(MAX_EXPRESSION_SOURCE_LENGTH),
|
|
144860
|
+
bindings: record(string().regex(EXPRESSION_IDENTIFIER_RE), ExpressionBindingSourceSchema)
|
|
144861
|
+
}).superRefine((src, ctx) => {
|
|
144862
|
+
const err = validateExpressionSource(src);
|
|
144863
|
+
if (err !== null) ctx.addIssue({
|
|
144864
|
+
code: "custom",
|
|
144865
|
+
message: err,
|
|
144866
|
+
path: ["expr"]
|
|
144867
|
+
});
|
|
144868
|
+
});
|
|
144869
|
+
/**
|
|
144870
|
+
* Identity envelope for a device's upstream-system metadata.
|
|
144871
|
+
*
|
|
144872
|
+
* Two jobs:
|
|
144873
|
+
*
|
|
144874
|
+
* 1. **Dispatch key.** `id` is the natural identifier the SOURCE system
|
|
144875
|
+
* uses to address this device (HA `entity_id`, Reolink MAC, ONVIF
|
|
144876
|
+
* WS-Discovery endpoint UUID, …). Provider code keeps a
|
|
144877
|
+
* `Map<sourceInfo.id, IDevice>` to route inbound push events in O(1)
|
|
144878
|
+
* without round-tripping through `stableId` / `id` mappings.
|
|
144879
|
+
*
|
|
144880
|
+
* 2. **Stability bridge.** `uniqueId` is the *immutable* upstream id when
|
|
144881
|
+
* one exists (HA `entity.unique_id`, Reolink MAC again — same as `id`
|
|
144882
|
+
* for vendors where MAC is the natural key). For systems where the
|
|
144883
|
+
* live dispatch key can be renamed (HA `entity_id` can be edited),
|
|
144884
|
+
* providers detect renames by matching `uniqueId` and patch `id`
|
|
144885
|
+
* in-place so dispatch keeps working.
|
|
144886
|
+
*
|
|
144887
|
+
* **Display unit and precision are NOT stored here.** They are a read-time
|
|
144888
|
+
* preference (D944). A polymorphic reading stores its `quantity` here once,
|
|
144889
|
+
* at adopt, and a date/time value stores `dateTimeShape` the same way —
|
|
144890
|
+
* neither is repeated on each sample. The `device_class` tag is an
|
|
144891
|
+
* HA-specific input consumed at the discovery boundary (`ha-domain-mapping`)
|
|
144892
|
+
* to derive the CamStack `DeviceRole`; it is never stored after that point.
|
|
144893
|
+
*
|
|
144894
|
+
* The `raw` escape hatch carries provider-specific attributes that don't
|
|
144895
|
+
* fit the structured slots (HA `attributes` whitelist, Reolink `deviceCache`
|
|
144896
|
+
* details, …). Providers control what lands here.
|
|
144897
|
+
*/
|
|
144898
|
+
var SourceInfoSchema = object({
|
|
144899
|
+
/** Live dispatch key — mutable when the source system allows rename. */
|
|
144900
|
+
id: string(),
|
|
144901
|
+
/** Source system tag — e.g. 'homeassistant' | 'reolink' | 'onvif'. */
|
|
144902
|
+
system: string(),
|
|
144903
|
+
/** Immutable upstream identifier when available (HA `unique_id`, … ).
|
|
144904
|
+
* Used to detect rename when `id` changes. */
|
|
144905
|
+
uniqueId: string().optional(),
|
|
144906
|
+
/** Quantity of a polymorphic reading, written once at adopt (D944). */
|
|
144907
|
+
quantity: ReadingQuantitySchema.optional(),
|
|
144908
|
+
/** Date / time / datetime shape of a string reading, written once at adopt. */
|
|
144909
|
+
dateTimeShape: _enum([
|
|
144910
|
+
"date",
|
|
144911
|
+
"time",
|
|
144912
|
+
"datetime"
|
|
144913
|
+
]).optional(),
|
|
144914
|
+
/** Provider-specific extras that don't fit the structured slots.
|
|
144915
|
+
* Whitelist what goes here per provider — do NOT dump entire HA
|
|
144916
|
+
* attribute blobs (would explode the meta JSON column). */
|
|
144917
|
+
raw: record(string(), unknown()).optional()
|
|
144918
|
+
});
|
|
144919
|
+
/**
|
|
144920
|
+
* Build the synthetic SourceInfo every existing provider falls back to
|
|
144921
|
+
* when no upstream value has been persisted. Keeps non-migrated providers
|
|
144922
|
+
* (Reolink / Hikvision / ONVIF / RTSP) functional without code
|
|
144923
|
+
* changes — `id` reuses the CamStack stableId, `system` reuses the addon
|
|
144924
|
+
* id. Real upstream identity replaces this once a provider migrates and
|
|
144925
|
+
* calls `updateSourceInfo()` with concrete values.
|
|
144926
|
+
*/
|
|
144927
|
+
function synthesizeSourceInfo(input) {
|
|
144928
|
+
return {
|
|
144929
|
+
id: input.stableId,
|
|
144930
|
+
system: input.addonId
|
|
144931
|
+
};
|
|
144826
144932
|
}
|
|
144827
|
-
/**
|
|
144828
|
-
|
|
144829
|
-
|
|
144933
|
+
/**
|
|
144934
|
+
* Shallow-merge a partial patch over a prior SourceInfo. `undefined`
|
|
144935
|
+
* patch values are ignored (no field clobber); to clear a field
|
|
144936
|
+
* explicitly, providers omit it from the patch and rebuild from scratch
|
|
144937
|
+
* via `updateSourceInfo({})` cycles — uncommon enough that we don't
|
|
144938
|
+
* bother with a `null`-means-delete sentinel.
|
|
144939
|
+
*
|
|
144940
|
+
* The `raw` field is also shallow-merged: passing `raw: { foo: 1 }`
|
|
144941
|
+
* merges over existing `raw` keys instead of replacing the whole bag.
|
|
144942
|
+
*/
|
|
144943
|
+
function mergeSourceInfo(prev, patch) {
|
|
144944
|
+
const next = { ...prev };
|
|
144945
|
+
for (const [k, v] of Object.entries(patch)) {
|
|
144946
|
+
if (v === void 0) continue;
|
|
144947
|
+
if (k === "raw" && typeof v === "object" && v !== null) {
|
|
144948
|
+
next.raw = {
|
|
144949
|
+
...prev.raw,
|
|
144950
|
+
...v
|
|
144951
|
+
};
|
|
144952
|
+
continue;
|
|
144953
|
+
}
|
|
144954
|
+
next[k] = v;
|
|
144955
|
+
}
|
|
144956
|
+
return next;
|
|
144830
144957
|
}
|
|
144831
144958
|
/**
|
|
144832
|
-
*
|
|
144833
|
-
*
|
|
144834
|
-
*
|
|
144959
|
+
* Key under which `SourceInfo` lives inside `DeviceMeta.metadata`. The
|
|
144960
|
+
* blob is a free-form `Record<string, unknown>` shared with hardware-
|
|
144961
|
+
* identity fields (`manufacturer`, `model`, `firmware`, …); SourceInfo
|
|
144962
|
+
* lives under a single nested key to keep it composable with those.
|
|
144835
144963
|
*/
|
|
144836
|
-
|
|
144837
|
-
|
|
144838
|
-
|
|
144839
|
-
|
|
144840
|
-
|
|
144841
|
-
|
|
144842
|
-
|
|
144843
|
-
|
|
144964
|
+
var SOURCE_INFO_METADATA_KEY = "sourceInfo";
|
|
144965
|
+
/**
|
|
144966
|
+
* Extract a SourceInfo from a `DeviceMeta.metadata` blob, validating
|
|
144967
|
+
* with Zod. Returns `null` when the blob is missing or the nested
|
|
144968
|
+
* `sourceInfo` key fails validation — callers fall back to the
|
|
144969
|
+
* synthetic default in that case (see `synthesizeSourceInfo`).
|
|
144970
|
+
*/
|
|
144971
|
+
function extractSourceInfoFromMetadata(metadata) {
|
|
144972
|
+
if (!metadata) return null;
|
|
144973
|
+
const raw = metadata[SOURCE_INFO_METADATA_KEY];
|
|
144974
|
+
if (!raw) return null;
|
|
144975
|
+
const parsed = SourceInfoSchema.safeParse(raw);
|
|
144976
|
+
if (!parsed.success) return null;
|
|
144977
|
+
return parsed.data;
|
|
144844
144978
|
}
|
|
144845
144979
|
/**
|
|
144846
144980
|
* A number a person types for a physical quantity — the input side of the
|
|
@@ -146519,15 +146653,28 @@ var SettingsSchemaWithValuesSchema = object({
|
|
|
146519
146653
|
});
|
|
146520
146654
|
/** Patch object — keys are field names, values are the new field values. */
|
|
146521
146655
|
var SettingsPatchSchema = record(string(), unknown());
|
|
146656
|
+
/** The scope of a scoped-settings call (D986): where the capability declared the values. */
|
|
146657
|
+
var ScopedSettingsScopeSchema = _enum(SCOPED_SETTINGS_SCOPES);
|
|
146658
|
+
/** One scoped schema an addon serves: its capability, scope and section ids. */
|
|
146659
|
+
var ScopedSettingsDeclarationSchema = object({
|
|
146660
|
+
cap: string(),
|
|
146661
|
+
scope: ScopedSettingsScopeSchema,
|
|
146662
|
+
sectionIds: array(string())
|
|
146663
|
+
});
|
|
146522
146664
|
/** Standard success response for update operations. */
|
|
146523
146665
|
var SettingsUpdateResultSchema = object({ success: literal(true) });
|
|
146524
146666
|
method(object({
|
|
146525
146667
|
addonId: string(),
|
|
146526
|
-
|
|
146527
|
-
|
|
146528
|
-
|
|
146668
|
+
cap: string(),
|
|
146669
|
+
scope: ScopedSettingsScopeSchema,
|
|
146670
|
+
nodeId: string().optional()
|
|
146529
146671
|
}), SettingsSchemaWithValuesSchema.nullable()), method(object({
|
|
146530
146672
|
addonId: string(),
|
|
146673
|
+
nodeId: string().optional()
|
|
146674
|
+
}), array(ScopedSettingsDeclarationSchema).nullable()), method(object({
|
|
146675
|
+
addonId: string(),
|
|
146676
|
+
cap: string(),
|
|
146677
|
+
scope: ScopedSettingsScopeSchema,
|
|
146531
146678
|
nodeId: string().optional(),
|
|
146532
146679
|
patch: SettingsPatchSchema
|
|
146533
146680
|
}), SettingsUpdateResultSchema, {
|
|
@@ -146535,8 +146682,10 @@ method(object({
|
|
|
146535
146682
|
auth: "admin"
|
|
146536
146683
|
}), method(object({
|
|
146537
146684
|
addonId: string(),
|
|
146685
|
+
cap: string(),
|
|
146686
|
+
scope: ScopedSettingsScopeSchema,
|
|
146538
146687
|
nodeId: string().optional()
|
|
146539
|
-
}),
|
|
146688
|
+
}), record(string(), unknown()).nullable()), method(object({
|
|
146540
146689
|
addonId: string(),
|
|
146541
146690
|
nodeId: string().optional(),
|
|
146542
146691
|
instance: IntegrationInstanceRefSchema
|
|
@@ -148099,7 +148248,7 @@ var BackupDestinationInfoSchema = object({
|
|
|
148099
148248
|
id: string(),
|
|
148100
148249
|
/**
|
|
148101
148250
|
* Manifest id of the owning addon. The Settings button on the
|
|
148102
|
-
* destination card opens that addon's
|
|
148251
|
+
* destination card opens that addon's scoped settings panel.
|
|
148103
148252
|
*/
|
|
148104
148253
|
addonId: string(),
|
|
148105
148254
|
/** Operator-toggled enable flag from the destination-policy table. */
|
|
@@ -151513,7 +151662,7 @@ var mediaPlayerCapability = {
|
|
|
151513
151662
|
isMuted: { kind: "boolean" }
|
|
151514
151663
|
} }
|
|
151515
151664
|
};
|
|
151516
|
-
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;
|
|
151665
|
+
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;
|
|
151517
151666
|
var NUMBER = {
|
|
151518
151667
|
kind: "fixed",
|
|
151519
151668
|
result: ["number"]
|
|
@@ -153552,6 +153701,7 @@ method(InstancePinSchema, DeviceExportStatusSchema), method(_void(), array(Expor
|
|
|
153552
153701
|
kind: "mutation",
|
|
153553
153702
|
auth: "admin"
|
|
153554
153703
|
});
|
|
153704
|
+
var DeviceAliasSchema = string().max(64).regex(/^[a-z][a-z0-9_]*$/);
|
|
153555
153705
|
/**
|
|
153556
153706
|
* A SITE ZONE — a named part of the property that several locations belong to.
|
|
153557
153707
|
*
|
|
@@ -154038,6 +154188,12 @@ var DeviceInfoSchema = object({
|
|
|
154038
154188
|
addonId: string(),
|
|
154039
154189
|
type: _enum(DeviceType),
|
|
154040
154190
|
name: string(),
|
|
154191
|
+
/** The name a value template uses for this device (`{{ stufa_veranda.temperature }}`),
|
|
154192
|
+
* entity_id style. Generated once from the name at first registration, unique
|
|
154193
|
+
* cluster-wide, editable through `setAlias`, NOT changed by a rename (D1021).
|
|
154194
|
+
* Optional: a record produced by an older build omits it until the boot
|
|
154195
|
+
* backfill has run. */
|
|
154196
|
+
alias: DeviceAliasSchema.optional(),
|
|
154041
154197
|
/** Operator-organisational location label. `null` when unset. */
|
|
154042
154198
|
location: string().nullable(),
|
|
154043
154199
|
/** Soft-disabled flag. */
|
|
@@ -154357,6 +154513,25 @@ method(object({
|
|
|
154357
154513
|
}), _void(), {
|
|
154358
154514
|
kind: "mutation",
|
|
154359
154515
|
auth: "admin"
|
|
154516
|
+
}), method(object({
|
|
154517
|
+
deviceId: number(),
|
|
154518
|
+
alias: string()
|
|
154519
|
+
}), discriminatedUnion("ok", [object({
|
|
154520
|
+
ok: literal(true),
|
|
154521
|
+
alias: DeviceAliasSchema
|
|
154522
|
+
}), object({
|
|
154523
|
+
ok: literal(false),
|
|
154524
|
+
reason: _enum([
|
|
154525
|
+
"empty",
|
|
154526
|
+
"too-long",
|
|
154527
|
+
"grammar",
|
|
154528
|
+
"reserved",
|
|
154529
|
+
"taken"
|
|
154530
|
+
]),
|
|
154531
|
+
takenBy: number().optional()
|
|
154532
|
+
})]), {
|
|
154533
|
+
kind: "mutation",
|
|
154534
|
+
auth: "admin"
|
|
154360
154535
|
}), method(object({
|
|
154361
154536
|
deviceId: number(),
|
|
154362
154537
|
location: string().nullable()
|
|
@@ -158098,7 +158273,7 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
|
|
|
158098
158273
|
* or the redaction token KEEPS the stored secret; `{ $secretClear: true }`
|
|
158099
158274
|
* clears it.
|
|
158100
158275
|
*/
|
|
158101
|
-
var ConfigSchemaPassthrough$
|
|
158276
|
+
var ConfigSchemaPassthrough$2 = custom();
|
|
158102
158277
|
var IntegrationInstanceIdSchema = string().min(1);
|
|
158103
158278
|
var IntegrationInstanceModeSchema = _enum(["single", "multiple"]);
|
|
158104
158279
|
/**
|
|
@@ -158144,7 +158319,16 @@ var IntegrationInstanceKindSchema = object({
|
|
|
158144
158319
|
/** Relative hub path to start an interactive account link of an instance of this kind. */
|
|
158145
158320
|
connectPath: string().min(1).optional(),
|
|
158146
158321
|
/** Relative hub path to disconnect that account. */
|
|
158147
|
-
disconnectPath: string().min(1).optional()
|
|
158322
|
+
disconnectPath: string().min(1).optional(),
|
|
158323
|
+
/**
|
|
158324
|
+
* Parts of the edit dialog the flat form cannot draw (a node picker, a model source), named by a
|
|
158325
|
+
* GENERIC widget id the client maps to a component; a client that knows none of them shows none.
|
|
158326
|
+
* `connection` widgets write connection values, `model` widgets own the model choice.
|
|
158327
|
+
*/
|
|
158328
|
+
widgets: array(object({
|
|
158329
|
+
id: string().min(1),
|
|
158330
|
+
placement: _enum(["connection", "model"])
|
|
158331
|
+
})).optional()
|
|
158148
158332
|
});
|
|
158149
158333
|
/**
|
|
158150
158334
|
* How devices of an instance are found. `none`: the operator adds them by hand; `lan`: the addon
|
|
@@ -158185,10 +158369,11 @@ var IntegrationInstanceDescriptionSchema = object({
|
|
|
158185
158369
|
/** True when `testInstance` really probes the remote. */
|
|
158186
158370
|
canTest: boolean(),
|
|
158187
158371
|
/**
|
|
158188
|
-
* The kinds an instance can be of
|
|
158189
|
-
* Add flow asks which first and sends it as
|
|
158372
|
+
* The kinds an instance can be of (D1013 rule 1), each naming its `functionCap`. One entry:
|
|
158373
|
+
* nothing to choose; more than one: the Add flow asks which first and sends it as
|
|
158374
|
+
* `createInstance.kind`. Never empty: every instance belongs to exactly one kind.
|
|
158190
158375
|
*/
|
|
158191
|
-
kinds: array(IntegrationInstanceKindSchema).
|
|
158376
|
+
kinds: array(IntegrationInstanceKindSchema).min(1),
|
|
158192
158377
|
/**
|
|
158193
158378
|
* The provider accepts `createInstance.id` for an id that once existed (an adopted id, because
|
|
158194
158379
|
* devices carry it). The UI then offers "restore under its old id" on Add. Absent means no.
|
|
@@ -158224,8 +158409,8 @@ var IntegrationInstanceSchema = object({
|
|
|
158224
158409
|
* the body is the one store, `setInstanceEnabled` the one writer (epic #440, step 3).
|
|
158225
158410
|
*/
|
|
158226
158411
|
enabled: boolean().optional(),
|
|
158227
|
-
/** The kind of this instance
|
|
158228
|
-
kind: string().
|
|
158412
|
+
/** The kind of this instance: exactly one of `describe().kinds[].id` (D1013 rule 2). */
|
|
158413
|
+
kind: string().min(1),
|
|
158229
158414
|
/** Values for the instance form; a secret is a `SecretFieldView`, never text. */
|
|
158230
158415
|
formValues: record(string(), unknown()),
|
|
158231
158416
|
status: IntegrationInstanceStatusSchema.optional(),
|
|
@@ -158249,7 +158434,7 @@ var integrationInstancesCapability = {
|
|
|
158249
158434
|
id: IntegrationInstanceIdSchema.nullable(),
|
|
158250
158435
|
/** The kind of the create form (`id: null`) of a provider with several. */
|
|
158251
158436
|
kind: string().min(1).optional()
|
|
158252
|
-
}), ConfigSchemaPassthrough$
|
|
158437
|
+
}), ConfigSchemaPassthrough$2, { auth: "admin" }),
|
|
158253
158438
|
listInstances: method(_void(), array(IntegrationInstanceSchema).readonly(), { auth: "admin" }),
|
|
158254
158439
|
getInstance: method(object({ id: IntegrationInstanceIdSchema }), IntegrationInstanceSchema.nullable(), { auth: "admin" }),
|
|
158255
158440
|
/**
|
|
@@ -159351,12 +159536,12 @@ var LlmModelInfoSchema = object({
|
|
|
159351
159536
|
});
|
|
159352
159537
|
/**
|
|
159353
159538
|
* The provider-specific part of a profile, validated by the provider that owns
|
|
159354
|
-
* the kind (
|
|
159539
|
+
* the kind (saving an instance refuses what it does not accept). A field its
|
|
159355
159540
|
* `connectionSchema` declares `type: 'password'` is a secret: it is held in the
|
|
159356
159541
|
* keychain, never in the row, and reads back as the redaction marker.
|
|
159357
159542
|
*/
|
|
159358
159543
|
var LlmProviderConfigSchema = record(string(), unknown());
|
|
159359
|
-
|
|
159544
|
+
object({
|
|
159360
159545
|
id: string(),
|
|
159361
159546
|
name: string(),
|
|
159362
159547
|
/** The provider-declared kind (`LlmProfileKindDescriptor.kind`). */
|
|
@@ -159450,8 +159635,8 @@ var LlmProviderWidgetSchema = object({
|
|
|
159450
159635
|
/** ConfigUISchema tree passed through untyped on the wire (the
|
|
159451
159636
|
* notification-output `ConfigSchemaPassthrough` precedent at
|
|
159452
159637
|
* notification-output.cap.ts:151); the exported TS type re-tightens it. */
|
|
159453
|
-
var ConfigSchemaPassthrough$
|
|
159454
|
-
|
|
159638
|
+
var ConfigSchemaPassthrough$1 = unknown();
|
|
159639
|
+
object({
|
|
159455
159640
|
kind: LlmProfileKindSchema,
|
|
159456
159641
|
label: string(),
|
|
159457
159642
|
/** A generic icon name (`cloud`, `plug`, `cpu`) — never a glyph or a logo. */
|
|
@@ -159459,9 +159644,9 @@ var LlmProfileKindDescriptorSchema = object({
|
|
|
159459
159644
|
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
159460
159645
|
addonId: string(),
|
|
159461
159646
|
/** The provider's own fields (`providerConfig`); `password` fields are keychain-held. */
|
|
159462
|
-
connectionSchema: ConfigSchemaPassthrough$
|
|
159647
|
+
connectionSchema: ConfigSchemaPassthrough$1,
|
|
159463
159648
|
/** Provider fields that belong under "Advanced" (extra headers, runtime tuning). */
|
|
159464
|
-
advancedSchema: ConfigSchemaPassthrough$
|
|
159649
|
+
advancedSchema: ConfigSchemaPassthrough$1.optional(),
|
|
159465
159650
|
/** The kind's defaults; a model from `listModels` may override any of them. */
|
|
159466
159651
|
features: LlmModelFeaturesSchema,
|
|
159467
159652
|
/** `false` = the provider stamps `supportsVision` itself (from what a node reports). */
|
|
@@ -159590,20 +159775,7 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
|
|
|
159590
159775
|
}), method(object({
|
|
159591
159776
|
addonId: string().optional(),
|
|
159592
159777
|
requestId: string()
|
|
159593
|
-
}), _void(), { kind: "mutation" }), method(
|
|
159594
|
-
kind: "mutation",
|
|
159595
|
-
auth: "admin"
|
|
159596
|
-
}), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
|
|
159597
|
-
kind: "mutation",
|
|
159598
|
-
auth: "admin"
|
|
159599
|
-
}), method(ProfileRefInputSchema, _void(), {
|
|
159600
|
-
kind: "mutation",
|
|
159601
|
-
auth: "admin"
|
|
159602
|
-
}), method(ProfileRefInputSchema, LlmGenerateResultSchema, {
|
|
159603
|
-
kind: "mutation",
|
|
159604
|
-
auth: "admin",
|
|
159605
|
-
timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
|
|
159606
|
-
}), method(LlmListModelsInputSchema, LlmListModelsResultSchema, {
|
|
159778
|
+
}), _void(), { kind: "mutation" }), method(LlmListModelsInputSchema, LlmListModelsResultSchema, {
|
|
159607
159779
|
kind: "mutation",
|
|
159608
159780
|
auth: "admin"
|
|
159609
159781
|
}), method(object({}), array(LlmDefaultSchema)), method(object({
|
|
@@ -160687,20 +160859,7 @@ method(_void(), MeshStatusSchema), method(object({
|
|
|
160687
160859
|
/** Optional hostname override the host should advertise once joined. */
|
|
160688
160860
|
hostname: string().optional() }), object({
|
|
160689
160861
|
/** Authentication URL the operator should open in a browser. */
|
|
160690
|
-
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() }))
|
|
160691
|
-
/** Optional auth key — when provided, probes the key validity
|
|
160692
|
-
* against the provider's API. Omit when already joined to
|
|
160693
|
-
* just ping the daemon. */
|
|
160694
|
-
authKey: string().optional() }), object({
|
|
160695
|
-
ok: boolean(),
|
|
160696
|
-
/** Provider-side identifier resolved by the probe (tailnet
|
|
160697
|
-
* name for Tailscale, network id for ZeroTier, etc.). */
|
|
160698
|
-
tenant: string().optional(),
|
|
160699
|
-
/** Daemon binary version, when reachable. */
|
|
160700
|
-
daemonVersion: string().optional(),
|
|
160701
|
-
/** Human-readable error when `ok: false`. */
|
|
160702
|
-
error: string().optional()
|
|
160703
|
-
}), { kind: "mutation" });
|
|
160862
|
+
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() }));
|
|
160704
160863
|
/**
|
|
160705
160864
|
* A monotonic total between resets (D944). Energy uses `power-meter.energy`
|
|
160706
160865
|
* so dashboards keep one series; every other instantaneous reading lands here.
|
|
@@ -168547,6 +168706,11 @@ var NcScheduleSchema = object({
|
|
|
168547
168706
|
* as a STATE SUMMARY at the end of each window of `schedule`.
|
|
168548
168707
|
*/
|
|
168549
168708
|
var NcSystemEventDeliveryModeSchema = _enum(["instant", "summary"]);
|
|
168709
|
+
_enum([
|
|
168710
|
+
"activation",
|
|
168711
|
+
"deactivation",
|
|
168712
|
+
"schedule"
|
|
168713
|
+
]);
|
|
168550
168714
|
/**
|
|
168551
168715
|
* How a summary window is SENT (D698): `rule` (absent) = ONE notification with
|
|
168552
168716
|
* every section; `section` = one notification per section with something to
|
|
@@ -168563,11 +168727,26 @@ var NcStateSummarySplitSchema = _enum(["rule", "section"]);
|
|
|
168563
168727
|
* midnight crossing); the send time is each window's END. Refused on the
|
|
168564
168728
|
* `alarm` family, which stays instant (`systemEventDeliveryProblems`).
|
|
168565
168729
|
*/
|
|
168566
|
-
var NcSystemEventDeliverySchema = discriminatedUnion("mode", [
|
|
168567
|
-
mode: literal("
|
|
168568
|
-
|
|
168569
|
-
|
|
168570
|
-
|
|
168730
|
+
var NcSystemEventDeliverySchema = discriminatedUnion("mode", [
|
|
168731
|
+
object({ mode: literal("instant") }),
|
|
168732
|
+
object({
|
|
168733
|
+
mode: literal("summary"),
|
|
168734
|
+
schedule: NcScheduleSchema,
|
|
168735
|
+
split: NcStateSummarySplitSchema.optional()
|
|
168736
|
+
}),
|
|
168737
|
+
object({
|
|
168738
|
+
mode: literal("modes"),
|
|
168739
|
+
/** The bad edge, and every kind that has a single edge. */
|
|
168740
|
+
onActivation: boolean(),
|
|
168741
|
+
/** The recovery edges of the classes of the selected kinds (derived, never stored per kind). */
|
|
168742
|
+
onDeactivation: boolean(),
|
|
168743
|
+
/** A state summary at the end of each window; absent = no summary. */
|
|
168744
|
+
onSchedule: object({
|
|
168745
|
+
schedule: NcScheduleSchema,
|
|
168746
|
+
grouping: NcStateSummarySplitSchema
|
|
168747
|
+
}).optional()
|
|
168748
|
+
})
|
|
168749
|
+
]);
|
|
168571
168750
|
/** Fuzzy plate matcher — OCR noise makes exact match useless (spec row 12/13). */
|
|
168572
168751
|
var NcPlateMatcherSchema = object({
|
|
168573
168752
|
/**
|
|
@@ -170927,61 +171106,6 @@ var OauthIntegrationDescriptorSchema = object({
|
|
|
170927
171106
|
});
|
|
170928
171107
|
method(_void(), OauthIntegrationDescriptorSchema, { auth: "admin" });
|
|
170929
171108
|
/**
|
|
170930
|
-
* `oidc-connections` — CRUD for IdP rows under `auth-oidc` (D828 sibling).
|
|
170931
|
-
*
|
|
170932
|
-
* One hub-only singleton (`auth-oidc`). The Settings UI is a DataTable +
|
|
170933
|
-
* ItemFormDialog; there is no `editable-array` in `globalSettingsSchema`.
|
|
170934
|
-
* Operator-chosen `id` is the URL slug (`/addon/auth-oidc/<id>/…`) and is
|
|
170935
|
-
* immutable after create.
|
|
170936
|
-
*/
|
|
170937
|
-
var ConfigSchemaPassthrough$1 = unknown();
|
|
170938
|
-
var OidcConnectionSchema = object({
|
|
170939
|
-
id: string().min(1),
|
|
170940
|
-
displayName: string(),
|
|
170941
|
-
icon: string(),
|
|
170942
|
-
issuerUrl: string(),
|
|
170943
|
-
clientId: string(),
|
|
170944
|
-
/** Client id + secret present — never the secret value. */
|
|
170945
|
-
configured: boolean(),
|
|
170946
|
-
/**
|
|
170947
|
-
* Values for the connection form schema. `clientSecret` is a keychain
|
|
170948
|
-
* {@link SecretFieldView} or `null` / `''`, never plaintext (D789).
|
|
170949
|
-
*/
|
|
170950
|
-
formValues: record(string(), unknown()).optional()
|
|
170951
|
-
});
|
|
170952
|
-
/**
|
|
170953
|
-
* Patch one connection. Omitted or empty `clientSecret` keeps the stored
|
|
170954
|
-
* secret (D787). `{ $secretClear: true }` clears it. `id` is never renamed.
|
|
170955
|
-
*/
|
|
170956
|
-
var OidcConnectionUpdateInputSchema = object({
|
|
170957
|
-
id: string().min(1),
|
|
170958
|
-
displayName: string().min(1),
|
|
170959
|
-
icon: string().optional(),
|
|
170960
|
-
issuerUrl: string().optional(),
|
|
170961
|
-
clientId: string().optional(),
|
|
170962
|
-
clientSecret: union([string(), object({ $secretClear: literal(true) })]).optional(),
|
|
170963
|
-
redirectUri: string().optional(),
|
|
170964
|
-
scopes: string().optional(),
|
|
170965
|
-
usernameClaim: _enum([
|
|
170966
|
-
"preferred_username",
|
|
170967
|
-
"email",
|
|
170968
|
-
"sub"
|
|
170969
|
-
]).optional()
|
|
170970
|
-
});
|
|
170971
|
-
method(object({}), ConfigSchemaPassthrough$1, { auth: "admin" }), method(object({}), array(OidcConnectionSchema).readonly(), { auth: "admin" }), method(object({
|
|
170972
|
-
id: string().min(1).regex(/^[a-z0-9][a-z0-9-]{0,63}$/, "id must be a lowercase slug"),
|
|
170973
|
-
displayName: string().min(1)
|
|
170974
|
-
}), object({ id: string() }), {
|
|
170975
|
-
kind: "mutation",
|
|
170976
|
-
auth: "admin"
|
|
170977
|
-
}), method(OidcConnectionUpdateInputSchema, object({ ok: literal(true) }), {
|
|
170978
|
-
kind: "mutation",
|
|
170979
|
-
auth: "admin"
|
|
170980
|
-
}), method(object({ id: string().min(1) }), object({ ok: literal(true) }), {
|
|
170981
|
-
kind: "mutation",
|
|
170982
|
-
auth: "admin"
|
|
170983
|
-
});
|
|
170984
|
-
/**
|
|
170985
171109
|
* Generic on-screen-display (video overlay) cap. Each camera exposes
|
|
170986
171110
|
* a firmware-defined list of overlays (channel name, timestamp,
|
|
170987
171111
|
* watermark, logo, …); the cap models them as a homogeneous array of
|
|
@@ -177302,6 +177426,16 @@ var RemoteLayoutComponentSchema = object({
|
|
|
177302
177426
|
method(object({}), array(RemoteLayoutComponentSchema), { auth: "protected" });
|
|
177303
177427
|
var RUNNING_POWER_START_DELAY_MS = 3e4;
|
|
177304
177428
|
var RUNNING_POWER_STOP_DELAY_MS = 18e4;
|
|
177429
|
+
/**
|
|
177430
|
+
* Per-type overrides of the dwell defaults. A media player draws power the
|
|
177431
|
+
* moment it is on and stops drawing the moment it is off, so it needs neither
|
|
177432
|
+
* a long dwell nor a second sample. A type absent here keeps the global values.
|
|
177433
|
+
*/
|
|
177434
|
+
var RUNNING_POWER_DEFAULTS_BY_TYPE = { [DeviceType.MediaPlayer]: {
|
|
177435
|
+
startDwellMs: 1e4,
|
|
177436
|
+
stopDwellMs: 1e4,
|
|
177437
|
+
minSamples: 1
|
|
177438
|
+
} };
|
|
177305
177439
|
var RunningStateSourceSchema = _enum(["native", "assigned"]);
|
|
177306
177440
|
var RunningStateStatusSchema = object({
|
|
177307
177441
|
/** null = unknown — never coerced to false (D393). */
|
|
@@ -177319,93 +177453,27 @@ var RunningFlipEventDataSchema = object({
|
|
|
177319
177453
|
phase: string().nullable()
|
|
177320
177454
|
});
|
|
177321
177455
|
var RUNNING_DEVICE_TYPES = Object.values(DeviceType);
|
|
177322
|
-
/**
|
|
177323
|
-
|
|
177324
|
-
|
|
177325
|
-
|
|
177326
|
-
|
|
177327
|
-
|
|
177328
|
-
|
|
177329
|
-
|
|
177330
|
-
|
|
177331
|
-
|
|
177332
|
-
|
|
177333
|
-
|
|
177334
|
-
|
|
177335
|
-
|
|
177336
|
-
|
|
177337
|
-
|
|
177338
|
-
|
|
177339
|
-
|
|
177340
|
-
|
|
177341
|
-
|
|
177342
|
-
|
|
177343
|
-
DeviceType.WaterHeater,
|
|
177344
|
-
DeviceType.Humidifier,
|
|
177345
|
-
DeviceType.Fan,
|
|
177346
|
-
DeviceType.Climate,
|
|
177347
|
-
DeviceType.Thermostat,
|
|
177348
|
-
DeviceType.PetFeeder,
|
|
177349
|
-
DeviceType.Heater
|
|
177350
|
-
],
|
|
177351
|
-
apply: "add",
|
|
177352
|
-
path: "running",
|
|
177353
|
-
sources: [
|
|
177354
|
-
{
|
|
177355
|
-
kind: "switch",
|
|
177356
|
-
transforms: [{ kind: "identity" }]
|
|
177357
|
-
},
|
|
177358
|
-
{
|
|
177359
|
-
kind: "binary",
|
|
177360
|
-
transforms: [{ kind: "identity" }, { kind: "invert" }]
|
|
177361
|
-
},
|
|
177362
|
-
{
|
|
177363
|
-
kind: "numeric",
|
|
177364
|
-
requiredUnit: "W",
|
|
177365
|
-
transforms: [{
|
|
177366
|
-
kind: "threshold",
|
|
177367
|
-
comparisons: ["gte", "lte"],
|
|
177368
|
-
comparison: "gte",
|
|
177369
|
-
defaultThreshold: 5,
|
|
177370
|
-
defaultStartDwellMs: RUNNING_POWER_START_DELAY_MS,
|
|
177371
|
-
defaultStopDwellMs: RUNNING_POWER_STOP_DELAY_MS,
|
|
177372
|
-
thresholdUnit: "W"
|
|
177373
|
-
}]
|
|
177374
|
-
}
|
|
177375
|
-
],
|
|
177376
|
-
companions: [
|
|
177377
|
-
{
|
|
177378
|
-
kind: "constant",
|
|
177379
|
-
path: "source",
|
|
177380
|
-
value: "assigned",
|
|
177381
|
-
when: "always"
|
|
177382
|
-
},
|
|
177383
|
-
{
|
|
177384
|
-
kind: "constant",
|
|
177385
|
-
path: "phase",
|
|
177386
|
-
value: null,
|
|
177387
|
-
when: "add"
|
|
177388
|
-
},
|
|
177389
|
-
{
|
|
177390
|
-
kind: "clock",
|
|
177391
|
-
path: "lastFetchedAt",
|
|
177392
|
-
when: "always"
|
|
177393
|
-
},
|
|
177394
|
-
{
|
|
177395
|
-
kind: "transition-time",
|
|
177396
|
-
path: "since",
|
|
177397
|
-
sourceChangedAt: "prefer"
|
|
177398
|
-
}
|
|
177399
|
-
],
|
|
177400
|
-
sourceReport: {
|
|
177401
|
-
status: "assignment-status",
|
|
177402
|
-
runtimeField: "source",
|
|
177403
|
-
nativeValue: "native",
|
|
177404
|
-
assignedValue: "assigned"
|
|
177405
|
-
},
|
|
177406
|
-
advancedExpression: true
|
|
177407
|
-
}]
|
|
177408
|
-
};
|
|
177456
|
+
/**
|
|
177457
|
+
* Customize offers "running" only where a job makes sense (D933): a cycle,
|
|
177458
|
+
* a clean, a mow, playback, or another appliance that is on and working.
|
|
177459
|
+
* The cap itself stays on every type — a camera can still report running
|
|
177460
|
+
* natively; it just has no card.
|
|
177461
|
+
*/
|
|
177462
|
+
var RUNNING_CUSTOMIZE_DEVICE_TYPES = [
|
|
177463
|
+
DeviceType.Washer,
|
|
177464
|
+
DeviceType.Dryer,
|
|
177465
|
+
DeviceType.Dishwasher,
|
|
177466
|
+
DeviceType.Vacuum,
|
|
177467
|
+
DeviceType.LawnMower,
|
|
177468
|
+
DeviceType.MediaPlayer,
|
|
177469
|
+
DeviceType.WaterHeater,
|
|
177470
|
+
DeviceType.Humidifier,
|
|
177471
|
+
DeviceType.Fan,
|
|
177472
|
+
DeviceType.Climate,
|
|
177473
|
+
DeviceType.Thermostat,
|
|
177474
|
+
DeviceType.PetFeeder,
|
|
177475
|
+
DeviceType.Heater
|
|
177476
|
+
];
|
|
177409
177477
|
var runningStateCapability = {
|
|
177410
177478
|
name: "running-state",
|
|
177411
177479
|
scope: "device",
|
|
@@ -177425,7 +177493,79 @@ var runningStateCapability = {
|
|
|
177425
177493
|
durability: "restored",
|
|
177426
177494
|
history: { fields: { running: { kind: "boolean" } } },
|
|
177427
177495
|
volatileStateFields: ["lastFetchedAt"],
|
|
177428
|
-
customize:
|
|
177496
|
+
customize: {
|
|
177497
|
+
version: 1,
|
|
177498
|
+
overridable: [{
|
|
177499
|
+
path: "running",
|
|
177500
|
+
by: "running"
|
|
177501
|
+
}],
|
|
177502
|
+
targets: [{
|
|
177503
|
+
id: "running",
|
|
177504
|
+
cardinality: "scalar",
|
|
177505
|
+
vocabulary: {
|
|
177506
|
+
cap: "running-state",
|
|
177507
|
+
stateField: "running"
|
|
177508
|
+
},
|
|
177509
|
+
deviceTypes: RUNNING_CUSTOMIZE_DEVICE_TYPES,
|
|
177510
|
+
apply: "add",
|
|
177511
|
+
path: "running",
|
|
177512
|
+
sources: [
|
|
177513
|
+
{
|
|
177514
|
+
kind: "switch",
|
|
177515
|
+
transforms: [{ kind: "identity" }]
|
|
177516
|
+
},
|
|
177517
|
+
{
|
|
177518
|
+
kind: "binary",
|
|
177519
|
+
transforms: [{ kind: "identity" }, { kind: "invert" }]
|
|
177520
|
+
},
|
|
177521
|
+
{
|
|
177522
|
+
kind: "numeric",
|
|
177523
|
+
requiredUnit: "W",
|
|
177524
|
+
transforms: [{
|
|
177525
|
+
kind: "threshold",
|
|
177526
|
+
comparisons: ["gte", "lte"],
|
|
177527
|
+
comparison: "gte",
|
|
177528
|
+
defaultThreshold: 5,
|
|
177529
|
+
defaultStartDwellMs: RUNNING_POWER_START_DELAY_MS,
|
|
177530
|
+
defaultStopDwellMs: RUNNING_POWER_STOP_DELAY_MS,
|
|
177531
|
+
deviceTypeDefaults: RUNNING_POWER_DEFAULTS_BY_TYPE,
|
|
177532
|
+
thresholdUnit: "W"
|
|
177533
|
+
}]
|
|
177534
|
+
}
|
|
177535
|
+
],
|
|
177536
|
+
companions: [
|
|
177537
|
+
{
|
|
177538
|
+
kind: "constant",
|
|
177539
|
+
path: "source",
|
|
177540
|
+
value: "assigned",
|
|
177541
|
+
when: "always"
|
|
177542
|
+
},
|
|
177543
|
+
{
|
|
177544
|
+
kind: "constant",
|
|
177545
|
+
path: "phase",
|
|
177546
|
+
value: null,
|
|
177547
|
+
when: "add"
|
|
177548
|
+
},
|
|
177549
|
+
{
|
|
177550
|
+
kind: "clock",
|
|
177551
|
+
path: "lastFetchedAt",
|
|
177552
|
+
when: "always"
|
|
177553
|
+
},
|
|
177554
|
+
{
|
|
177555
|
+
kind: "transition-time",
|
|
177556
|
+
path: "since",
|
|
177557
|
+
sourceChangedAt: "prefer"
|
|
177558
|
+
}
|
|
177559
|
+
],
|
|
177560
|
+
sourceReport: {
|
|
177561
|
+
status: "assignment-status",
|
|
177562
|
+
runtimeField: "source",
|
|
177563
|
+
nativeValue: "native",
|
|
177564
|
+
assignedValue: "assigned"
|
|
177565
|
+
},
|
|
177566
|
+
advancedExpression: true
|
|
177567
|
+
}]
|
|
177568
|
+
}
|
|
177429
177569
|
};
|
|
177430
177570
|
/**
|
|
177431
177571
|
* scene-monitor — device-scoped reference-region state cap. An operator marks
|
|
@@ -178773,21 +178913,6 @@ method(object({
|
|
|
178773
178913
|
*/
|
|
178774
178914
|
ttlSec: union([number().int().positive(), literal("never")]).optional()
|
|
178775
178915
|
}), object({ token: string() }), { auth: "admin" }), method(object({ token: string() }), SsoBridgeClaimsSchema.nullable(), { auth: "admin" });
|
|
178776
|
-
var ProviderListEntrySchema = discriminatedUnion("shouldSaveDiskSpace", [object({
|
|
178777
|
-
providerId: string().min(1),
|
|
178778
|
-
displayName: string().min(1),
|
|
178779
|
-
configSchema: unknown(),
|
|
178780
|
-
nodeLocal: boolean(),
|
|
178781
|
-
shouldSaveDiskSpace: literal(true),
|
|
178782
|
-
minFreePercent: number().min(0).max(100)
|
|
178783
|
-
}), object({
|
|
178784
|
-
providerId: string().min(1),
|
|
178785
|
-
displayName: string().min(1),
|
|
178786
|
-
configSchema: unknown(),
|
|
178787
|
-
nodeLocal: boolean(),
|
|
178788
|
-
shouldSaveDiskSpace: literal(false),
|
|
178789
|
-
minFreePercent: literal(null)
|
|
178790
|
-
})]);
|
|
178791
178916
|
method(object({
|
|
178792
178917
|
location: StorageLocationRefSchema,
|
|
178793
178918
|
relativePath: string()
|
|
@@ -178849,42 +178974,7 @@ method(object({
|
|
|
178849
178974
|
}), _instanceof(Uint8Array), { auth: "admin" }), method(object({ downloadId: string() }), _void(), {
|
|
178850
178975
|
kind: "mutation",
|
|
178851
178976
|
auth: "admin"
|
|
178852
|
-
}), method(object({ type: StorageLocationTypeSchema.optional() }), array(StorageLocationSchema).readonly()), method(_void(), array(StorageLocationDeclarationSchema).readonly()), method(
|
|
178853
|
-
createdAt: true,
|
|
178854
|
-
updatedAt: true
|
|
178855
|
-
}), StorageLocationSchema, {
|
|
178856
|
-
kind: "mutation",
|
|
178857
|
-
auth: "admin"
|
|
178858
|
-
}), method(object({
|
|
178859
|
-
id: string(),
|
|
178860
|
-
force: boolean().optional()
|
|
178861
|
-
}), _void(), {
|
|
178862
|
-
kind: "mutation",
|
|
178863
|
-
auth: "admin"
|
|
178864
|
-
}), method(_void(), array(StorageDrainProgressSchema).readonly()), method(object({ id: string() }), object({
|
|
178865
|
-
ok: boolean(),
|
|
178866
|
-
error: string().optional()
|
|
178867
|
-
}), { auth: "admin" }), method(_void(), array(ProviderListEntrySchema).readonly()), method(object({
|
|
178868
|
-
providerId: string(),
|
|
178869
|
-
/**
|
|
178870
|
-
* The location this config is an UNSAVED edit of, when there is one.
|
|
178871
|
-
*
|
|
178872
|
-
* `listLocations` replaces every declared secret with the redaction
|
|
178873
|
-
* sentinel, so the edit modal's form state holds the sentinel for any
|
|
178874
|
-
* credential the operator did not retype — and posting that here
|
|
178875
|
-
* without a way to resolve it makes the provider try to authenticate
|
|
178876
|
-
* as `__camstack_redacted__` and report the operator's own working
|
|
178877
|
-
* password as wrong. Given this id, the orchestrator restores each
|
|
178878
|
-
* sentinel from the stored config (same rule as `upsertLocation`)
|
|
178879
|
-
* before dispatching. Omitted by the "Add location" wizard, where
|
|
178880
|
-
* every value was typed just now and nothing is stored yet.
|
|
178881
|
-
*/
|
|
178882
|
-
locationId: string().optional(),
|
|
178883
|
-
config: record(string(), unknown())
|
|
178884
|
-
}), object({
|
|
178885
|
-
ok: boolean(),
|
|
178886
|
-
error: string().optional()
|
|
178887
|
-
}), { auth: "admin" });
|
|
178977
|
+
}), method(object({ type: StorageLocationTypeSchema.optional() }), array(StorageLocationSchema).readonly()), method(_void(), array(StorageLocationDeclarationSchema).readonly()), method(_void(), array(StorageDrainProgressSchema).readonly());
|
|
178888
178978
|
/** One table of the settings database. */
|
|
178889
178979
|
var StorageTableSchema = object({
|
|
178890
178980
|
/** The table's full name, e.g. `recorder:addon-settings` or `addon-device-settings`. */
|
|
@@ -180406,7 +180496,7 @@ var TerminalInstanceInfoSchema = object({
|
|
|
180406
180496
|
/**
|
|
180407
180497
|
* False while the node the instance is bound to is not in the cluster
|
|
180408
180498
|
* topology (forgotten, renamed, re-paired). The instance is kept; the
|
|
180409
|
-
* operator re-points it
|
|
180499
|
+
* operator re-points it on the Terminal page.
|
|
180410
180500
|
*/
|
|
180411
180501
|
nodeInCluster: boolean(),
|
|
180412
180502
|
profileId: string(),
|
|
@@ -180444,41 +180534,7 @@ var TerminalOutputBatchSchema = object({
|
|
|
180444
180534
|
snapshot: string().optional(),
|
|
180445
180535
|
events: array(TerminalOutputEventSchema).readonly()
|
|
180446
180536
|
});
|
|
180447
|
-
method(_void(), array(TerminalProfileInfoSchema).readonly(), { auth: "admin" }), method(_void(), array(
|
|
180448
|
-
targetNodeId: string().min(1),
|
|
180449
|
-
profileId: string().min(1),
|
|
180450
|
-
name: string().trim().min(1).max(160).optional(),
|
|
180451
|
-
executable: string().max(1024).optional(),
|
|
180452
|
-
args: array(string().max(2048)).max(64).optional(),
|
|
180453
|
-
cwd: string().max(1024).optional(),
|
|
180454
|
-
environment: array(string().max(4096)).max(64).optional(),
|
|
180455
|
-
profileSettings: ProfileSettingsBagSchema.optional()
|
|
180456
|
-
}), TerminalInstanceInfoSchema, {
|
|
180457
|
-
kind: "mutation",
|
|
180458
|
-
auth: "admin"
|
|
180459
|
-
}), method(object({
|
|
180460
|
-
instanceId: string().min(1),
|
|
180461
|
-
/** Re-point the instance to another node; the profile must exist there. */
|
|
180462
|
-
targetNodeId: string().min(1).max(256).optional(),
|
|
180463
|
-
name: string().trim().min(1).max(160).optional(),
|
|
180464
|
-
executable: string().max(1024).optional(),
|
|
180465
|
-
args: array(string().max(2048)).max(64).optional(),
|
|
180466
|
-
cwd: string().max(1024).optional(),
|
|
180467
|
-
environment: array(string().max(4096)).max(64).optional(),
|
|
180468
|
-
profileSettings: ProfileSettingsBagSchema.optional()
|
|
180469
|
-
}), TerminalInstanceInfoSchema, {
|
|
180470
|
-
kind: "mutation",
|
|
180471
|
-
auth: "admin"
|
|
180472
|
-
}), method(object({ instanceId: string().min(1) }), _void(), {
|
|
180473
|
-
kind: "mutation",
|
|
180474
|
-
auth: "admin"
|
|
180475
|
-
}), method(object({
|
|
180476
|
-
instanceId: string().min(1),
|
|
180477
|
-
enabled: boolean()
|
|
180478
|
-
}), TerminalInstanceInfoSchema, {
|
|
180479
|
-
kind: "mutation",
|
|
180480
|
-
auth: "admin"
|
|
180481
|
-
}), method(_void(), array(TerminalLegacyCameraSchema).readonly(), { auth: "admin" }), method(object({
|
|
180537
|
+
method(_void(), array(TerminalProfileInfoSchema).readonly(), { auth: "admin" }), method(_void(), array(TerminalLegacyCameraSchema).readonly(), { auth: "admin" }), method(object({
|
|
180482
180538
|
stableId: string().min(1),
|
|
180483
180539
|
name: string().trim().min(1).max(160).optional()
|
|
180484
180540
|
}), TerminalInstanceInfoSchema, {
|
|
@@ -180547,6 +180603,11 @@ var TimedRunUnitSchema = _enum(["s", "min"]);
|
|
|
180547
180603
|
_enum(["switch", "pet-fountain"]);
|
|
180548
180604
|
DeviceType.Heater, DeviceType.PetFountain;
|
|
180549
180605
|
var TIMED_RUN_DEVICE_TYPES = [DeviceType.Heater, DeviceType.PetFountain];
|
|
180606
|
+
/** One duration, as the one-tap run asks for it. */
|
|
180607
|
+
var TimedRunQuickRunSchema = object({
|
|
180608
|
+
duration: number().positive().finite(),
|
|
180609
|
+
unit: TimedRunUnitSchema
|
|
180610
|
+
});
|
|
180550
180611
|
/** Why a request was not carried out. Typed, so a caller can say it in words. */
|
|
180551
180612
|
var TimedRunRefusalSchema = _enum([
|
|
180552
180613
|
"unsupported-device",
|
|
@@ -180567,8 +180628,23 @@ var TimedRunStatusSchema = object({
|
|
|
180567
180628
|
activeUntil: number().nullable(),
|
|
180568
180629
|
/** Who asked for the run (a user id or an addon id); `null` when nothing is armed or it did not say. */
|
|
180569
180630
|
requestedBy: string().nullable(),
|
|
180631
|
+
/**
|
|
180632
|
+
* The one-tap run of THIS device: what a "Run" button on any surface starts. `null` when
|
|
180633
|
+
* the device is gone or its type has no timed run; a status from before this field
|
|
180634
|
+
* existed has none, and a surface falls back to the type's default.
|
|
180635
|
+
*/
|
|
180636
|
+
quickRun: TimedRunQuickRunSchema.nullable(),
|
|
180570
180637
|
lastFetchedAt: number()
|
|
180571
180638
|
});
|
|
180639
|
+
/** What the settings form needs: the unit, the bounds and the type's default. */
|
|
180640
|
+
var TimedRunOptionsSchema = object({
|
|
180641
|
+
unit: TimedRunUnitSchema,
|
|
180642
|
+
/** The longest run, in `unit`. */
|
|
180643
|
+
maxDuration: number(),
|
|
180644
|
+
defaultDuration: number()
|
|
180645
|
+
});
|
|
180646
|
+
/** The one-tap run duration, in the type's unit; `null` returns to the type's default. */
|
|
180647
|
+
var TimedRunSettingsPatchSchema = object({ quickRunDuration: number().positive().finite().nullable().optional() });
|
|
180572
180648
|
var timedRunCapability = {
|
|
180573
180649
|
name: "timed-run",
|
|
180574
180650
|
scope: "device",
|
|
@@ -180576,7 +180652,24 @@ var timedRunCapability = {
|
|
|
180576
180652
|
kind: "wrapper",
|
|
180577
180653
|
defaultActive: true,
|
|
180578
180654
|
deviceTypes: TIMED_RUN_DEVICE_TYPES,
|
|
180655
|
+
deviceConfig: { ui: {
|
|
180656
|
+
kind: "derived-form",
|
|
180657
|
+
builderId: "timed-run",
|
|
180658
|
+
tab: "general"
|
|
180659
|
+
} },
|
|
180579
180660
|
methods: {
|
|
180661
|
+
getOptions: method(object({ deviceId: number().int() }), TimedRunOptionsSchema),
|
|
180662
|
+
/**
|
|
180663
|
+
* The one-tap run of this device. A duration above the type's maximum is
|
|
180664
|
+
* REFUSED (thrown), like `runFor`: the maximum is a safety bound.
|
|
180665
|
+
*/
|
|
180666
|
+
setSettings: method(object({
|
|
180667
|
+
deviceId: number().int(),
|
|
180668
|
+
settings: TimedRunSettingsPatchSchema
|
|
180669
|
+
}), _void(), {
|
|
180670
|
+
kind: "mutation",
|
|
180671
|
+
auth: "admin"
|
|
180672
|
+
}),
|
|
180580
180673
|
/**
|
|
180581
180674
|
* Turn the device on and arm its off. A run already armed is replaced (the
|
|
180582
180675
|
* new deadline wins). Refuses with a typed reason above the type's maximum.
|
|
@@ -185880,21 +185973,28 @@ Object.freeze({
|
|
|
185880
185973
|
access: "view",
|
|
185881
185974
|
role: "admin"
|
|
185882
185975
|
},
|
|
185883
|
-
"addonSettings.
|
|
185976
|
+
"addonSettings.getIntegrationFormSchema": {
|
|
185884
185977
|
capName: "addon-settings",
|
|
185885
185978
|
capScope: "system",
|
|
185886
185979
|
addonId: null,
|
|
185887
185980
|
access: "view",
|
|
185888
185981
|
role: "admin"
|
|
185889
185982
|
},
|
|
185890
|
-
"addonSettings.
|
|
185983
|
+
"addonSettings.getScopedSettings": {
|
|
185891
185984
|
capName: "addon-settings",
|
|
185892
185985
|
capScope: "system",
|
|
185893
185986
|
addonId: null,
|
|
185894
185987
|
access: "view",
|
|
185895
185988
|
role: "admin"
|
|
185896
185989
|
},
|
|
185897
|
-
"addonSettings.
|
|
185990
|
+
"addonSettings.listScopedSettings": {
|
|
185991
|
+
capName: "addon-settings",
|
|
185992
|
+
capScope: "system",
|
|
185993
|
+
addonId: null,
|
|
185994
|
+
access: "view",
|
|
185995
|
+
role: "admin"
|
|
185996
|
+
},
|
|
185997
|
+
"addonSettings.readScopedValues": {
|
|
185898
185998
|
capName: "addon-settings",
|
|
185899
185999
|
capScope: "system",
|
|
185900
186000
|
addonId: null,
|
|
@@ -185915,7 +186015,7 @@ Object.freeze({
|
|
|
185915
186015
|
access: "create",
|
|
185916
186016
|
role: "admin"
|
|
185917
186017
|
},
|
|
185918
|
-
"addonSettings.
|
|
186018
|
+
"addonSettings.updateScopedSettings": {
|
|
185919
186019
|
capName: "addon-settings",
|
|
185920
186020
|
capScope: "system",
|
|
185921
186021
|
addonId: null,
|
|
@@ -188085,6 +188185,13 @@ Object.freeze({
|
|
|
188085
188185
|
access: "create",
|
|
188086
188186
|
role: "admin"
|
|
188087
188187
|
},
|
|
188188
|
+
"deviceManager.setAlias": {
|
|
188189
|
+
capName: "device-manager",
|
|
188190
|
+
capScope: "system",
|
|
188191
|
+
addonId: null,
|
|
188192
|
+
access: "create",
|
|
188193
|
+
role: "admin"
|
|
188194
|
+
},
|
|
188088
188195
|
"deviceManager.setChildLayout": {
|
|
188089
188196
|
capName: "device-manager",
|
|
188090
188197
|
capScope: "system",
|
|
@@ -189373,13 +189480,6 @@ Object.freeze({
|
|
|
189373
189480
|
access: "delete",
|
|
189374
189481
|
role: "admin"
|
|
189375
189482
|
},
|
|
189376
|
-
"llm.deleteProfile": {
|
|
189377
|
-
capName: "llm",
|
|
189378
|
-
capScope: "system",
|
|
189379
|
-
addonId: null,
|
|
189380
|
-
access: "delete",
|
|
189381
|
-
role: "admin"
|
|
189382
|
-
},
|
|
189383
189483
|
"llm.generate": {
|
|
189384
189484
|
capName: "llm",
|
|
189385
189485
|
capScope: "system",
|
|
@@ -189443,20 +189543,6 @@ Object.freeze({
|
|
|
189443
189543
|
access: "view",
|
|
189444
189544
|
role: "admin"
|
|
189445
189545
|
},
|
|
189446
|
-
"llm.listProfileKinds": {
|
|
189447
|
-
capName: "llm",
|
|
189448
|
-
capScope: "system",
|
|
189449
|
-
addonId: null,
|
|
189450
|
-
access: "view",
|
|
189451
|
-
role: "admin"
|
|
189452
|
-
},
|
|
189453
|
-
"llm.listProfiles": {
|
|
189454
|
-
capName: "llm",
|
|
189455
|
-
capScope: "system",
|
|
189456
|
-
addonId: null,
|
|
189457
|
-
access: "view",
|
|
189458
|
-
role: "admin"
|
|
189459
|
-
},
|
|
189460
189546
|
"llm.listRuntimeNodes": {
|
|
189461
189547
|
capName: "llm",
|
|
189462
189548
|
capScope: "system",
|
|
@@ -189464,13 +189550,6 @@ Object.freeze({
|
|
|
189464
189550
|
access: "view",
|
|
189465
189551
|
role: "admin"
|
|
189466
189552
|
},
|
|
189467
|
-
"llm.migrateRawSecrets": {
|
|
189468
|
-
capName: "llm",
|
|
189469
|
-
capScope: "system",
|
|
189470
|
-
addonId: null,
|
|
189471
|
-
access: "create",
|
|
189472
|
-
role: "admin"
|
|
189473
|
-
},
|
|
189474
189553
|
"llm.resolveModelRef": {
|
|
189475
189554
|
capName: "llm",
|
|
189476
189555
|
capScope: "system",
|
|
@@ -189499,20 +189578,6 @@ Object.freeze({
|
|
|
189499
189578
|
access: "create",
|
|
189500
189579
|
role: "admin"
|
|
189501
189580
|
},
|
|
189502
|
-
"llm.testProfile": {
|
|
189503
|
-
capName: "llm",
|
|
189504
|
-
capScope: "system",
|
|
189505
|
-
addonId: null,
|
|
189506
|
-
access: "create",
|
|
189507
|
-
role: "admin"
|
|
189508
|
-
},
|
|
189509
|
-
"llm.upsertProfile": {
|
|
189510
|
-
capName: "llm",
|
|
189511
|
-
capScope: "system",
|
|
189512
|
-
addonId: null,
|
|
189513
|
-
access: "create",
|
|
189514
|
-
role: "admin"
|
|
189515
|
-
},
|
|
189516
189581
|
"llmRuntime.appleAvailability": {
|
|
189517
189582
|
capName: "llm-runtime",
|
|
189518
189583
|
capScope: "system",
|
|
@@ -190017,13 +190082,6 @@ Object.freeze({
|
|
|
190017
190082
|
access: "create",
|
|
190018
190083
|
role: "admin"
|
|
190019
190084
|
},
|
|
190020
|
-
"meshNetwork.testConnection": {
|
|
190021
|
-
capName: "mesh-network",
|
|
190022
|
-
capScope: "system",
|
|
190023
|
-
addonId: null,
|
|
190024
|
-
access: "create",
|
|
190025
|
-
role: "admin"
|
|
190026
|
-
},
|
|
190027
190085
|
"meter.getStatus": {
|
|
190028
190086
|
capName: "meter",
|
|
190029
190087
|
capScope: "device",
|
|
@@ -190682,13 +190740,6 @@ Object.freeze({
|
|
|
190682
190740
|
access: "create",
|
|
190683
190741
|
role: "admin"
|
|
190684
190742
|
},
|
|
190685
|
-
"notificationOutput.deleteTarget": {
|
|
190686
|
-
capName: "notification-output",
|
|
190687
|
-
capScope: "system",
|
|
190688
|
-
addonId: null,
|
|
190689
|
-
access: "delete",
|
|
190690
|
-
role: "admin"
|
|
190691
|
-
},
|
|
190692
190743
|
"notificationOutput.discoverTargets": {
|
|
190693
190744
|
capName: "notification-output",
|
|
190694
190745
|
capScope: "system",
|
|
@@ -190696,13 +190747,6 @@ Object.freeze({
|
|
|
190696
190747
|
access: "view",
|
|
190697
190748
|
role: "admin"
|
|
190698
190749
|
},
|
|
190699
|
-
"notificationOutput.getTarget": {
|
|
190700
|
-
capName: "notification-output",
|
|
190701
|
-
capScope: "system",
|
|
190702
|
-
addonId: null,
|
|
190703
|
-
access: "view",
|
|
190704
|
-
role: "admin"
|
|
190705
|
-
},
|
|
190706
190750
|
"notificationOutput.listTargetKinds": {
|
|
190707
190751
|
capName: "notification-output",
|
|
190708
190752
|
capScope: "system",
|
|
@@ -190710,13 +190754,6 @@ Object.freeze({
|
|
|
190710
190754
|
access: "view",
|
|
190711
190755
|
role: "admin"
|
|
190712
190756
|
},
|
|
190713
|
-
"notificationOutput.listTargets": {
|
|
190714
|
-
capName: "notification-output",
|
|
190715
|
-
capScope: "system",
|
|
190716
|
-
addonId: null,
|
|
190717
|
-
access: "view",
|
|
190718
|
-
role: "admin"
|
|
190719
|
-
},
|
|
190720
190757
|
"notificationOutput.probeTargetConfig": {
|
|
190721
190758
|
capName: "notification-output",
|
|
190722
190759
|
capScope: "system",
|
|
@@ -190731,13 +190768,6 @@ Object.freeze({
|
|
|
190731
190768
|
access: "create",
|
|
190732
190769
|
role: "admin"
|
|
190733
190770
|
},
|
|
190734
|
-
"notificationOutput.setTargetEnabled": {
|
|
190735
|
-
capName: "notification-output",
|
|
190736
|
-
capScope: "system",
|
|
190737
|
-
addonId: null,
|
|
190738
|
-
access: "create",
|
|
190739
|
-
role: "admin"
|
|
190740
|
-
},
|
|
190741
190771
|
"notificationOutput.testTarget": {
|
|
190742
190772
|
capName: "notification-output",
|
|
190743
190773
|
capScope: "system",
|
|
@@ -190745,13 +190775,6 @@ Object.freeze({
|
|
|
190745
190775
|
access: "create",
|
|
190746
190776
|
role: "admin"
|
|
190747
190777
|
},
|
|
190748
|
-
"notificationOutput.upsertTarget": {
|
|
190749
|
-
capName: "notification-output",
|
|
190750
|
-
capScope: "system",
|
|
190751
|
-
addonId: null,
|
|
190752
|
-
access: "create",
|
|
190753
|
-
role: "admin"
|
|
190754
|
-
},
|
|
190755
190778
|
"notificationRules.activateAlarmProfile": {
|
|
190756
190779
|
capName: "notification-rules",
|
|
190757
190780
|
capScope: "system",
|
|
@@ -191011,41 +191034,6 @@ Object.freeze({
|
|
|
191011
191034
|
access: "view",
|
|
191012
191035
|
role: "admin"
|
|
191013
191036
|
},
|
|
191014
|
-
"oidcConnections.connectionFormSchema": {
|
|
191015
|
-
capName: "oidc-connections",
|
|
191016
|
-
capScope: "system",
|
|
191017
|
-
addonId: null,
|
|
191018
|
-
access: "view",
|
|
191019
|
-
role: "admin"
|
|
191020
|
-
},
|
|
191021
|
-
"oidcConnections.createConnection": {
|
|
191022
|
-
capName: "oidc-connections",
|
|
191023
|
-
capScope: "system",
|
|
191024
|
-
addonId: null,
|
|
191025
|
-
access: "create",
|
|
191026
|
-
role: "admin"
|
|
191027
|
-
},
|
|
191028
|
-
"oidcConnections.deleteConnection": {
|
|
191029
|
-
capName: "oidc-connections",
|
|
191030
|
-
capScope: "system",
|
|
191031
|
-
addonId: null,
|
|
191032
|
-
access: "delete",
|
|
191033
|
-
role: "admin"
|
|
191034
|
-
},
|
|
191035
|
-
"oidcConnections.listConnections": {
|
|
191036
|
-
capName: "oidc-connections",
|
|
191037
|
-
capScope: "system",
|
|
191038
|
-
addonId: null,
|
|
191039
|
-
access: "view",
|
|
191040
|
-
role: "admin"
|
|
191041
|
-
},
|
|
191042
|
-
"oidcConnections.updateConnection": {
|
|
191043
|
-
capName: "oidc-connections",
|
|
191044
|
-
capScope: "system",
|
|
191045
|
-
addonId: null,
|
|
191046
|
-
access: "create",
|
|
191047
|
-
role: "admin"
|
|
191048
|
-
},
|
|
191049
191037
|
"osd.getStatus": {
|
|
191050
191038
|
capName: "osd",
|
|
191051
191039
|
capScope: "device",
|
|
@@ -194077,13 +194065,6 @@ Object.freeze({
|
|
|
194077
194065
|
access: "delete",
|
|
194078
194066
|
role: "admin"
|
|
194079
194067
|
},
|
|
194080
|
-
"storage.deleteLocation": {
|
|
194081
|
-
capName: "storage",
|
|
194082
|
-
capScope: "system",
|
|
194083
|
-
addonId: null,
|
|
194084
|
-
access: "delete",
|
|
194085
|
-
role: "admin"
|
|
194086
|
-
},
|
|
194087
194068
|
"storage.endDownload": {
|
|
194088
194069
|
capName: "storage",
|
|
194089
194070
|
capScope: "system",
|
|
@@ -194140,13 +194121,6 @@ Object.freeze({
|
|
|
194140
194121
|
access: "view",
|
|
194141
194122
|
role: "admin"
|
|
194142
194123
|
},
|
|
194143
|
-
"storage.listProviders": {
|
|
194144
|
-
capName: "storage",
|
|
194145
|
-
capScope: "system",
|
|
194146
|
-
addonId: null,
|
|
194147
|
-
access: "view",
|
|
194148
|
-
role: "admin"
|
|
194149
|
-
},
|
|
194150
194124
|
"storage.read": {
|
|
194151
194125
|
capName: "storage",
|
|
194152
194126
|
capScope: "system",
|
|
@@ -194168,27 +194142,6 @@ Object.freeze({
|
|
|
194168
194142
|
access: "view",
|
|
194169
194143
|
role: "admin"
|
|
194170
194144
|
},
|
|
194171
|
-
"storage.testConfig": {
|
|
194172
|
-
capName: "storage",
|
|
194173
|
-
capScope: "system",
|
|
194174
|
-
addonId: null,
|
|
194175
|
-
access: "view",
|
|
194176
|
-
role: "admin"
|
|
194177
|
-
},
|
|
194178
|
-
"storage.testLocation": {
|
|
194179
|
-
capName: "storage",
|
|
194180
|
-
capScope: "system",
|
|
194181
|
-
addonId: null,
|
|
194182
|
-
access: "view",
|
|
194183
|
-
role: "admin"
|
|
194184
|
-
},
|
|
194185
|
-
"storage.upsertLocation": {
|
|
194186
|
-
capName: "storage",
|
|
194187
|
-
capScope: "system",
|
|
194188
|
-
addonId: null,
|
|
194189
|
-
access: "create",
|
|
194190
|
-
role: "admin"
|
|
194191
|
-
},
|
|
194192
194145
|
"storage.write": {
|
|
194193
194146
|
capName: "storage",
|
|
194194
194147
|
capScope: "system",
|
|
@@ -194966,27 +194919,6 @@ Object.freeze({
|
|
|
194966
194919
|
access: "create",
|
|
194967
194920
|
role: "admin"
|
|
194968
194921
|
},
|
|
194969
|
-
"terminalSession.createInstance": {
|
|
194970
|
-
capName: "terminal-session",
|
|
194971
|
-
capScope: "system",
|
|
194972
|
-
addonId: null,
|
|
194973
|
-
access: "create",
|
|
194974
|
-
role: "admin"
|
|
194975
|
-
},
|
|
194976
|
-
"terminalSession.deleteInstance": {
|
|
194977
|
-
capName: "terminal-session",
|
|
194978
|
-
capScope: "system",
|
|
194979
|
-
addonId: null,
|
|
194980
|
-
access: "delete",
|
|
194981
|
-
role: "admin"
|
|
194982
|
-
},
|
|
194983
|
-
"terminalSession.listInstances": {
|
|
194984
|
-
capName: "terminal-session",
|
|
194985
|
-
capScope: "system",
|
|
194986
|
-
addonId: null,
|
|
194987
|
-
access: "view",
|
|
194988
|
-
role: "admin"
|
|
194989
|
-
},
|
|
194990
194922
|
"terminalSession.listLegacyCameras": {
|
|
194991
194923
|
capName: "terminal-session",
|
|
194992
194924
|
capScope: "system",
|
|
@@ -195029,20 +194961,6 @@ Object.freeze({
|
|
|
195029
194961
|
access: "create",
|
|
195030
194962
|
role: "admin"
|
|
195031
194963
|
},
|
|
195032
|
-
"terminalSession.setInstanceEnabled": {
|
|
195033
|
-
capName: "terminal-session",
|
|
195034
|
-
capScope: "system",
|
|
195035
|
-
addonId: null,
|
|
195036
|
-
access: "create",
|
|
195037
|
-
role: "admin"
|
|
195038
|
-
},
|
|
195039
|
-
"terminalSession.updateInstance": {
|
|
195040
|
-
capName: "terminal-session",
|
|
195041
|
-
capScope: "system",
|
|
195042
|
-
addonId: null,
|
|
195043
|
-
access: "create",
|
|
195044
|
-
role: "admin"
|
|
195045
|
-
},
|
|
195046
194964
|
"terminalSession.writeInput": {
|
|
195047
194965
|
capName: "terminal-session",
|
|
195048
194966
|
capScope: "system",
|
|
@@ -195057,6 +194975,13 @@ Object.freeze({
|
|
|
195057
194975
|
access: "create",
|
|
195058
194976
|
role: "viewer"
|
|
195059
194977
|
},
|
|
194978
|
+
"timedRun.getOptions": {
|
|
194979
|
+
capName: "timed-run",
|
|
194980
|
+
capScope: "device",
|
|
194981
|
+
addonId: null,
|
|
194982
|
+
access: "view",
|
|
194983
|
+
role: "viewer"
|
|
194984
|
+
},
|
|
195060
194985
|
"timedRun.getStatus": {
|
|
195061
194986
|
capName: "timed-run",
|
|
195062
194987
|
capScope: "device",
|
|
@@ -195071,6 +194996,13 @@ Object.freeze({
|
|
|
195071
194996
|
access: "create",
|
|
195072
194997
|
role: "viewer"
|
|
195073
194998
|
},
|
|
194999
|
+
"timedRun.setSettings": {
|
|
195000
|
+
capName: "timed-run",
|
|
195001
|
+
capScope: "device",
|
|
195002
|
+
addonId: null,
|
|
195003
|
+
access: "create",
|
|
195004
|
+
role: "admin"
|
|
195005
|
+
},
|
|
195074
195006
|
"toast.onToast": {
|
|
195075
195007
|
capName: "toast",
|
|
195076
195008
|
capScope: "system",
|
|
@@ -196153,6 +196085,7 @@ function createRuntimeStateBridge(params) {
|
|
|
196153
196085
|
getStatus
|
|
196154
196086
|
};
|
|
196155
196087
|
}
|
|
196088
|
+
string().min(1).max(4096);
|
|
196156
196089
|
Object.freeze({
|
|
196157
196090
|
"accessories.getStatus": [{
|
|
196158
196091
|
name: "deviceId",
|
|
@@ -196836,6 +196769,11 @@ Object.freeze({
|
|
|
196836
196769
|
form: "single",
|
|
196837
196770
|
optional: false
|
|
196838
196771
|
}],
|
|
196772
|
+
"deviceManager.setAlias": [{
|
|
196773
|
+
name: "deviceId",
|
|
196774
|
+
form: "single",
|
|
196775
|
+
optional: false
|
|
196776
|
+
}],
|
|
196839
196777
|
"deviceManager.setChildLayout": [{
|
|
196840
196778
|
name: "deviceId",
|
|
196841
196779
|
form: "single",
|
|
@@ -198900,6 +198838,11 @@ Object.freeze({
|
|
|
198900
198838
|
form: "single",
|
|
198901
198839
|
optional: false
|
|
198902
198840
|
}],
|
|
198841
|
+
"timedRun.getOptions": [{
|
|
198842
|
+
name: "deviceId",
|
|
198843
|
+
form: "single",
|
|
198844
|
+
optional: false
|
|
198845
|
+
}],
|
|
198903
198846
|
"timedRun.getStatus": [{
|
|
198904
198847
|
name: "deviceId",
|
|
198905
198848
|
form: "single",
|
|
@@ -198910,6 +198853,11 @@ Object.freeze({
|
|
|
198910
198853
|
form: "single",
|
|
198911
198854
|
optional: false
|
|
198912
198855
|
}],
|
|
198856
|
+
"timedRun.setSettings": [{
|
|
198857
|
+
name: "deviceId",
|
|
198858
|
+
form: "single",
|
|
198859
|
+
optional: false
|
|
198860
|
+
}],
|
|
198913
198861
|
"update.getStatus": [{
|
|
198914
198862
|
name: "deviceId",
|
|
198915
198863
|
form: "single",
|
|
@@ -199772,6 +199720,7 @@ var STATE_SUMMARY_VARS = [
|
|
|
199772
199720
|
[...RULE_TEXT],
|
|
199773
199721
|
[...RULE_TEXT],
|
|
199774
199722
|
[...RULE_TEXT],
|
|
199723
|
+
[...RULE_TEXT],
|
|
199775
199724
|
[...RULE_BODY_ONLY],
|
|
199776
199725
|
[...RULE_TEXT],
|
|
199777
199726
|
([...RULE_TEXT], [...DEVICE_EVENTS]),
|
|
@@ -221446,7 +221395,13 @@ function buildReolinkInstances(records, deps) {
|
|
|
221446
221395
|
},
|
|
221447
221396
|
instanceMode: "multiple",
|
|
221448
221397
|
kind: "connection",
|
|
221449
|
-
canTest: false
|
|
221398
|
+
canTest: false,
|
|
221399
|
+
kinds: [{
|
|
221400
|
+
id: "connection",
|
|
221401
|
+
label: "Reolink",
|
|
221402
|
+
functionCap: "device-provider",
|
|
221403
|
+
role: "devices"
|
|
221404
|
+
}]
|
|
221450
221405
|
},
|
|
221451
221406
|
formSchema: () => buildHubInstanceSchema(),
|
|
221452
221407
|
initialBody: (name) => ({ name }),
|