@camstack/addon-provider-bosch 0.1.42 → 0.1.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/{account-integration-offline-cC99EePp.mjs → account-integration-offline-BrrnCsrl.mjs} +1 -1
- package/dist/{account-integration-offline-D2xBMGsR.js → account-integration-offline-Ctzpu6DI.js} +1 -1
- package/dist/{bosch-instances-BmvHlGiY.mjs → bosch-instances-BtKXLOoG.mjs} +1811 -1862
- package/dist/{bosch-instances-CINVxMF_.js → bosch-instances-CppS1lTA.js} +1811 -1862
- package/dist/home-connect/addon.js +9 -3
- package/dist/home-connect/addon.mjs +9 -3
- package/dist/homecom/addon.js +9 -3
- package/dist/homecom/addon.mjs +9 -3
- package/dist/shc/addon.js +8 -2
- package/dist/shc/addon.mjs +8 -2
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "node:crypto";
|
|
2
|
-
//#region ../types/dist/event-category-
|
|
2
|
+
//#region ../types/dist/event-category-78tcBemo.mjs
|
|
3
3
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
4
4
|
EventCategory["SystemBoot"] = "system.boot";
|
|
5
5
|
EventCategory["SystemAddonsReady"] = "system.addons-ready";
|
|
@@ -120,6 +120,23 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
120
120
|
*/
|
|
121
121
|
EventCategory["AddonLoadRecovered"] = "addon.load-recovered";
|
|
122
122
|
/**
|
|
123
|
+
* An addon is RUNNING although its installed package is below what the
|
|
124
|
+
* running server requires (`camstack.requires.addons` of the server, or the
|
|
125
|
+
* addon's own `requires.server`). Raised once per streak by the unsupported-
|
|
126
|
+
* addon tracker, on the hub and on agents; AlertCenter turns it into one
|
|
127
|
+
* operator alert per node and package. The addon is never held back for it.
|
|
128
|
+
*
|
|
129
|
+
* Payload: `{ packageName, addonId, nodeId, installedVersion, requiredMinimum, serverVersion, unmet }`.
|
|
130
|
+
*/
|
|
131
|
+
EventCategory["AddonUnsupportedVersion"] = "addon.unsupported-version";
|
|
132
|
+
/**
|
|
133
|
+
* The package of an {@link AddonUnsupportedVersion} alert reached a supported
|
|
134
|
+
* version, or is no longer installed on the node. AlertCenter dismisses the matching alert.
|
|
135
|
+
*
|
|
136
|
+
* Payload: `{ packageName, addonId, nodeId }`.
|
|
137
|
+
*/
|
|
138
|
+
EventCategory["AddonUnsupportedResolved"] = "addon.unsupported-resolved";
|
|
139
|
+
/**
|
|
123
140
|
* Monitor scheduled the next retry for a failed addon. Transient —
|
|
124
141
|
* surfaced to the UI for live-updating the "next retry in Ns"
|
|
125
142
|
* countdown on the Addons page row, NOT persisted as an alert.
|
|
@@ -230,7 +247,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
230
247
|
EventCategory["ProcessRestarted"] = "process.restarted";
|
|
231
248
|
/**
|
|
232
249
|
* The SET of storage locations changed — one was created, edited, enabled,
|
|
233
|
-
* disabled or deleted through
|
|
250
|
+
* disabled or deleted through the location instances or the forced-delete action.
|
|
234
251
|
*
|
|
235
252
|
* Telemetry, not a transaction (D8/D11): every consumer that re-resolves on
|
|
236
253
|
* it must also converge on its own periodic path, because a dropped event
|
|
@@ -785,7 +802,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
785
802
|
return EventCategory;
|
|
786
803
|
}({});
|
|
787
804
|
//#endregion
|
|
788
|
-
//#region ../types/dist/device-type-
|
|
805
|
+
//#region ../types/dist/device-type-DxCT0krO.mjs
|
|
789
806
|
/**
|
|
790
807
|
import { errMsg } from '@camstack/types'
|
|
791
808
|
* Extract a human-readable message from an unknown error value.
|
|
@@ -947,6 +964,13 @@ var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
|
|
|
947
964
|
* filters that want "all devices with on-motion behaviour".
|
|
948
965
|
*/
|
|
949
966
|
DeviceFeature["MotionTrigger"] = "motion-trigger";
|
|
967
|
+
/**
|
|
968
|
+
* Device can be run for a chosen time and then stopped. Mirrors the
|
|
969
|
+
* `timed-run` wrapper cap — the cap is bound by the core-blocks addon, not by
|
|
970
|
+
* a driver, so the flag is derived from the device's bindings
|
|
971
|
+
* (`featuresOfBoundCaps`). Gates the quick-run control in the viewer.
|
|
972
|
+
*/
|
|
973
|
+
DeviceFeature["TimedRun"] = "timed-run";
|
|
950
974
|
/** Light supports rgb-triplet color via `color` cap. */
|
|
951
975
|
DeviceFeature["LightColorRgb"] = "light-color-rgb";
|
|
952
976
|
/** Light supports HSV color via `color` cap. */
|
|
@@ -5981,7 +6005,7 @@ var ZodIssueCode = {
|
|
|
5981
6005
|
var ZodFirstPartyTypeKind;
|
|
5982
6006
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
5983
6007
|
//#endregion
|
|
5984
|
-
//#region ../types/dist/sleep-
|
|
6008
|
+
//#region ../types/dist/sleep-CGPZyzB5.mjs
|
|
5985
6009
|
/**
|
|
5986
6010
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
5987
6011
|
* window to float samples (D455).
|
|
@@ -6345,6 +6369,59 @@ Object.fromEntries([
|
|
|
6345
6369
|
function isValuelessField(field) {
|
|
6346
6370
|
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";
|
|
6347
6371
|
}
|
|
6372
|
+
/**
|
|
6373
|
+
* Base collector: flatten a hydrated `ConfigUISchemaWithValues` into
|
|
6374
|
+
* `key → { value, default }`, recursing through `group` and `sub-tabs`
|
|
6375
|
+
* layout fields. Keeping `value` and `default` SEPARATE (rather than
|
|
6376
|
+
* pre-resolving) lets callers both read the effective value AND detect
|
|
6377
|
+
* overrides (`value` differs from `default`). Structural over `unknown`;
|
|
6378
|
+
* malformed input yields an empty map, never throws.
|
|
6379
|
+
*/
|
|
6380
|
+
function collectHydratedFieldEntries(schema) {
|
|
6381
|
+
const out = /* @__PURE__ */ new Map();
|
|
6382
|
+
if (typeof schema !== "object" || schema === null) return out;
|
|
6383
|
+
const sections = schema.sections;
|
|
6384
|
+
if (!Array.isArray(sections)) return out;
|
|
6385
|
+
for (const section of sections) if (typeof section === "object" && section !== null) collectFieldEntriesInto(section.fields, out);
|
|
6386
|
+
return out;
|
|
6387
|
+
}
|
|
6388
|
+
/** Recursive field walker for {@link collectHydratedFieldEntries}. */
|
|
6389
|
+
function collectFieldEntriesInto(fields, into) {
|
|
6390
|
+
if (!Array.isArray(fields)) return;
|
|
6391
|
+
for (const field of fields) {
|
|
6392
|
+
if (typeof field !== "object" || field === null) continue;
|
|
6393
|
+
const type = field.type;
|
|
6394
|
+
if (type === "group") {
|
|
6395
|
+
collectFieldEntriesInto(field.fields, into);
|
|
6396
|
+
continue;
|
|
6397
|
+
}
|
|
6398
|
+
if (type === "sub-tabs") {
|
|
6399
|
+
const tabs = field.tabs;
|
|
6400
|
+
if (Array.isArray(tabs)) {
|
|
6401
|
+
for (const tab of tabs) if (typeof tab === "object" && tab !== null) collectFieldEntriesInto(tab.fields, into);
|
|
6402
|
+
}
|
|
6403
|
+
continue;
|
|
6404
|
+
}
|
|
6405
|
+
const key = field.key;
|
|
6406
|
+
if (typeof key !== "string" || key.length === 0) continue;
|
|
6407
|
+
if (!("value" in field)) continue;
|
|
6408
|
+
into.set(key, {
|
|
6409
|
+
value: field.value,
|
|
6410
|
+
default: field.default
|
|
6411
|
+
});
|
|
6412
|
+
}
|
|
6413
|
+
}
|
|
6414
|
+
/**
|
|
6415
|
+
* Flatten a hydrated settings payload into `key → EFFECTIVE value`
|
|
6416
|
+
* (`value ?? default`). The read-side inverse of `hydrateSchema` for the
|
|
6417
|
+
* common "just give me the resolved values" case. Built on
|
|
6418
|
+
* {@link collectHydratedFieldEntries}.
|
|
6419
|
+
*/
|
|
6420
|
+
function collectHydratedFieldValues(schema) {
|
|
6421
|
+
const out = /* @__PURE__ */ new Map();
|
|
6422
|
+
for (const [key, entry] of collectHydratedFieldEntries(schema)) out.set(key, entry.value ?? entry.default);
|
|
6423
|
+
return out;
|
|
6424
|
+
}
|
|
6348
6425
|
function hydrateSchema(schema, values, options = {}) {
|
|
6349
6426
|
return {
|
|
6350
6427
|
...schema.tabs ? { tabs: [...schema.tabs] } : {},
|
|
@@ -7213,6 +7290,7 @@ var RecordIntegrationInstances = class {
|
|
|
7213
7290
|
this.secretKeys = topLevelSecretKeys(kind.declaration.secretPaths);
|
|
7214
7291
|
this.secretMaps = secretMapKeys(kind.declaration.secretPaths);
|
|
7215
7292
|
this.nameField = kind.declaration.entry?.nameField ?? "name";
|
|
7293
|
+
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`);
|
|
7216
7294
|
}
|
|
7217
7295
|
/**
|
|
7218
7296
|
* One instance read for the addon's own runtime; null when absent. When the keychain is
|
|
@@ -7254,10 +7332,21 @@ var RecordIntegrationInstances = class {
|
|
|
7254
7332
|
}
|
|
7255
7333
|
return out;
|
|
7256
7334
|
}
|
|
7335
|
+
/** The kind an instance body is of: the provider's `kindOf`, else its one declared kind. */
|
|
7336
|
+
kindOfBody(body) {
|
|
7337
|
+
if (this.hooks.kindOf !== void 0) {
|
|
7338
|
+
const id = this.hooks.kindOf(body);
|
|
7339
|
+
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)`);
|
|
7340
|
+
return id;
|
|
7341
|
+
}
|
|
7342
|
+
const only = this.hooks.description.kinds[0];
|
|
7343
|
+
if (only === void 0) throw new Error(`record kind '${this.kind.name}' declares no kinds`);
|
|
7344
|
+
return only.id;
|
|
7345
|
+
}
|
|
7257
7346
|
viewOf(record) {
|
|
7258
7347
|
const shown = secretViewsOf(this.records.owner, this.kind.name, record.id, this.kind.declaration, record.data);
|
|
7259
7348
|
const rawName = record.data[this.nameField];
|
|
7260
|
-
const kind = this.
|
|
7349
|
+
const kind = this.kindOfBody(record.data);
|
|
7261
7350
|
const health = this.hooks.health?.(record.data, record.id);
|
|
7262
7351
|
return {
|
|
7263
7352
|
id: record.id,
|
|
@@ -7265,7 +7354,7 @@ var RecordIntegrationInstances = class {
|
|
|
7265
7354
|
configured: this.hooks.configured(record.data),
|
|
7266
7355
|
enabled: isInstanceEnabled(record.data),
|
|
7267
7356
|
formValues: shown,
|
|
7268
|
-
|
|
7357
|
+
kind,
|
|
7269
7358
|
...health?.status !== void 0 ? { status: health.status } : {},
|
|
7270
7359
|
...health?.lastCheckedAt !== void 0 ? { lastCheckedAt: health.lastCheckedAt } : {}
|
|
7271
7360
|
};
|
|
@@ -7298,17 +7387,35 @@ var RecordIntegrationInstances = class {
|
|
|
7298
7387
|
...kind !== void 0 ? { kind } : {}
|
|
7299
7388
|
});
|
|
7300
7389
|
if (minted === void 0) throw new Error("createInstance needs an id: this provider does not mint one");
|
|
7390
|
+
const initial = this.hooks.initialBody(name, kind);
|
|
7391
|
+
const patch = this.patchOf(values ?? {});
|
|
7392
|
+
if (Object.keys(patch).length > 0) Object.assign(patch, await this.hooks.validateWrite?.({
|
|
7393
|
+
kind,
|
|
7394
|
+
body: {
|
|
7395
|
+
...initial,
|
|
7396
|
+
...patch
|
|
7397
|
+
}
|
|
7398
|
+
}));
|
|
7301
7399
|
await this.handle.put({
|
|
7302
7400
|
id: minted,
|
|
7303
|
-
data:
|
|
7401
|
+
data: initial
|
|
7304
7402
|
}, { ifRev: 0 });
|
|
7305
|
-
const patch = this.patchOf(values ?? {});
|
|
7306
7403
|
if (Object.keys(patch).length > 0) await this.handle.patch(minted, patch);
|
|
7307
7404
|
await this.hooks.onChanged?.(minted, "created");
|
|
7308
7405
|
return { id: minted };
|
|
7309
7406
|
};
|
|
7310
7407
|
updateInstance = async ({ id, name, values }) => {
|
|
7311
7408
|
const patch = this.patchOf(values);
|
|
7409
|
+
if (this.hooks.validateWrite !== void 0 && Object.keys(patch).length > 0) {
|
|
7410
|
+
const stored = await this.handle.get(id);
|
|
7411
|
+
if (stored !== null) Object.assign(patch, await this.hooks.validateWrite({
|
|
7412
|
+
kind: void 0,
|
|
7413
|
+
body: {
|
|
7414
|
+
...stored.data,
|
|
7415
|
+
...patch
|
|
7416
|
+
}
|
|
7417
|
+
}));
|
|
7418
|
+
}
|
|
7312
7419
|
if (name !== void 0) patch[this.nameField] = name;
|
|
7313
7420
|
await this.handle.patch(id, patch);
|
|
7314
7421
|
await this.hooks.onChanged?.(id, "updated");
|
|
@@ -7619,6 +7726,21 @@ var SCOPED_SETTINGS_SCOPES = [
|
|
|
7619
7726
|
"device-defaults",
|
|
7620
7727
|
"node"
|
|
7621
7728
|
];
|
|
7729
|
+
/** The one refusal of a key a scope did not declare. */
|
|
7730
|
+
function assertDeclaredKeys(keys, declared) {
|
|
7731
|
+
const undeclared = keys.filter((key) => !declared.has(key));
|
|
7732
|
+
if (undeclared.length > 0) throw new Error(`scoped settings: [${undeclared.join(", ")}] not declared for this scope (declared: [${[...declared].join(", ")}])`);
|
|
7733
|
+
}
|
|
7734
|
+
/** Build the handle over an addon's scoped read, write and unset. */
|
|
7735
|
+
function createScopedSettings(deps) {
|
|
7736
|
+
return {
|
|
7737
|
+
async get() {
|
|
7738
|
+
return deps.schema.parse(await deps.read());
|
|
7739
|
+
},
|
|
7740
|
+
patch: (patch) => deps.write(Object.fromEntries(Object.entries(patch))),
|
|
7741
|
+
unset: (keys) => deps.unset(keys)
|
|
7742
|
+
};
|
|
7743
|
+
}
|
|
7622
7744
|
/** A write to a secret path could not be stored in the keychain, so it was refused. */
|
|
7623
7745
|
var KeychainWriteRefusedError = class extends Error {
|
|
7624
7746
|
fieldPath;
|
|
@@ -8194,7 +8316,16 @@ function createHandle(raw, opts) {
|
|
|
8194
8316
|
return blob;
|
|
8195
8317
|
}
|
|
8196
8318
|
},
|
|
8197
|
-
writeAddonStore: writeAddon
|
|
8319
|
+
writeAddonStore: writeAddon,
|
|
8320
|
+
removeClearedKeys: (keys) => serialize("addon", async () => {
|
|
8321
|
+
const stored = await readStoredAddonBlob(raw);
|
|
8322
|
+
index.seen("addon", stored);
|
|
8323
|
+
const removable = keys.filter((key) => collectSecretMarkerRefs(stored[key]).length === 0);
|
|
8324
|
+
if (removable.length === 0) return;
|
|
8325
|
+
const patch = Object.fromEntries(removable.map((key) => [key, void 0]));
|
|
8326
|
+
await raw.writeAddonStore(patch);
|
|
8327
|
+
index.wrote("addon", patch);
|
|
8328
|
+
})
|
|
8198
8329
|
};
|
|
8199
8330
|
}
|
|
8200
8331
|
/** The context the addon sees, plus the private raw view and write outcome. */
|
|
@@ -8324,7 +8455,7 @@ function boundOf(list) {
|
|
|
8324
8455
|
* Base class for CamStack addons. Eliminates settings boilerplate:
|
|
8325
8456
|
*
|
|
8326
8457
|
* - Typed `config` property with automatic resolution from store + defaults
|
|
8327
|
-
* -
|
|
8458
|
+
* - the scoped settings API (`clusterSettings` / `nodeSettings` / `deviceDefaults`) auto-implemented
|
|
8328
8459
|
* - `getAddonSettings()` / `updateAddonSettings()` auto-implemented
|
|
8329
8460
|
* - `getDeviceSettings()` / `updateDeviceSettings()` auto-implemented
|
|
8330
8461
|
* - `ctx` accessor for the AddonContext (no manual `this.ctxRef` storage)
|
|
@@ -8334,7 +8465,7 @@ function boundOf(list) {
|
|
|
8334
8465
|
* Subclasses override:
|
|
8335
8466
|
* - `onInitialize()` — addon-specific init logic, return ProviderRegistration[]
|
|
8336
8467
|
* - `onShutdown()` — cleanup
|
|
8337
|
-
* - `
|
|
8468
|
+
* - `clusterSettingsSchema()` / `nodeSettingsSchema()` / `deviceSettingsSchema()` — UI schemas
|
|
8338
8469
|
*
|
|
8339
8470
|
* @example
|
|
8340
8471
|
* ```ts
|
|
@@ -8348,7 +8479,7 @@ function boundOf(list) {
|
|
|
8348
8479
|
* super({ maxRetries: 3, endpoint: 'http://localhost' })
|
|
8349
8480
|
* }
|
|
8350
8481
|
*
|
|
8351
|
-
* protected
|
|
8482
|
+
* protected clusterSettingsSchema() {
|
|
8352
8483
|
* return this.schema({
|
|
8353
8484
|
* sections: [{
|
|
8354
8485
|
* id: 'main', title: 'Settings',
|
|
@@ -8391,7 +8522,7 @@ var BaseAddon = class {
|
|
|
8391
8522
|
defaults;
|
|
8392
8523
|
/**
|
|
8393
8524
|
* Hidden-state paths that hold secrets (D787) — values the addon writes
|
|
8394
|
-
* itself (`
|
|
8525
|
+
* itself (`state()`, the scoped writers) that no form field declares.
|
|
8395
8526
|
* Stored in the keychain exactly like a `password` field. Syntax:
|
|
8396
8527
|
* `'snapshotSigningKey'`, `'identity.pincode'`, `'tokens[userId].accessToken'`
|
|
8397
8528
|
* (`key[<id field>]` addresses array items by id, never by index).
|
|
@@ -8401,7 +8532,7 @@ var BaseAddon = class {
|
|
|
8401
8532
|
/**
|
|
8402
8533
|
* D986 M4: the scoped schemas this addon declared, resolved once per capability
|
|
8403
8534
|
* (`loadScopedSchemas`) so the sync readers (`perNodeKeys`, the secret tree, the restart check)
|
|
8404
|
-
* see them. Empty until loaded
|
|
8535
|
+
* see them. Empty until loaded.
|
|
8405
8536
|
*/
|
|
8406
8537
|
_scopedByCap = /* @__PURE__ */ new Map();
|
|
8407
8538
|
_nodeKeysByCap = /* @__PURE__ */ new Map();
|
|
@@ -8587,7 +8718,7 @@ var BaseAddon = class {
|
|
|
8587
8718
|
/** Addon-specific cleanup. Override if needed. */
|
|
8588
8719
|
async onShutdown() {}
|
|
8589
8720
|
/**
|
|
8590
|
-
* Called after config is resolved during
|
|
8721
|
+
* Called after config is resolved during a settings write.
|
|
8591
8722
|
* Override to react to config changes (e.g. restart a sampler, reconnect a service).
|
|
8592
8723
|
* Not called during initialize() — use onInitialize() for initial setup.
|
|
8593
8724
|
*/
|
|
@@ -8616,82 +8747,12 @@ var BaseAddon = class {
|
|
|
8616
8747
|
scopedSettingsCapabilities() {
|
|
8617
8748
|
return [];
|
|
8618
8749
|
}
|
|
8619
|
-
/** Override to provide global-level settings UI schema. */
|
|
8620
|
-
globalSettingsSchema(_cap) {
|
|
8621
|
-
return null;
|
|
8622
|
-
}
|
|
8623
8750
|
/** Override to provide device-level settings UI schema. */
|
|
8624
8751
|
deviceSettingsSchema() {
|
|
8625
8752
|
return null;
|
|
8626
8753
|
}
|
|
8627
8754
|
/**
|
|
8628
|
-
*
|
|
8629
|
-
* ARE the configuration of its integration.
|
|
8630
|
-
*
|
|
8631
|
-
* Return the `ConfigSection.id`s, from {@link globalSettingsSchema}, that an
|
|
8632
|
-
* operator should find on the addon's integration page (System →
|
|
8633
|
-
* Integrations → <name>) rather than only in the cluster-wide list of every
|
|
8634
|
-
* addon. Empty (the default) means the addon has no integration-level
|
|
8635
|
-
* settings and no such surface is offered — this is opt-in, because whether
|
|
8636
|
-
* an addon's configuration IS its integration's configuration depends on the
|
|
8637
|
-
* nature of the integration.
|
|
8638
|
-
*
|
|
8639
|
-
* WHAT THIS IS NOT. It is not a scope. The selected sections keep living in
|
|
8640
|
-
* the ONE global schema, in the ONE addon store, written by the ONE
|
|
8641
|
-
* `updateGlobalSettings` path. There is deliberately no
|
|
8642
|
-
* `updateIntegrationSettings`: a second write path is how a surface acquires
|
|
8643
|
-
* a second store key, and this repo has shipped that twice (`btmPath@hub`,
|
|
8644
|
-
* D266). Selecting sections cannot introduce a key that selecting cannot.
|
|
8645
|
-
*
|
|
8646
|
-
* WHY IT IS A LIST OF SECTION IDS AND NOT A MARKER ON THE SECTION.
|
|
8647
|
-
* `ConfigFieldBase` used to carry `scope?: 'device' | 'global'` and it was
|
|
8648
|
-
* removed with the reason recorded at
|
|
8649
|
-
* `packages/types/src/interfaces/config-ui.ts:249` — *"a field's scope is
|
|
8650
|
-
* determined by WHICH schema it lives in, not by a field-level marker."* A
|
|
8651
|
-
* marker sprinkled across sections also has to borrow a field that already
|
|
8652
|
-
* means something else; borrowing `section.tab` put the literal word
|
|
8653
|
-
* "integration" into an operator-facing tab bar, because `tab` means "how to
|
|
8654
|
-
* GROUP this visually" and cannot also mean "where this lives" (D269
|
|
8655
|
-
* supersedes D268). One declaration, in one place, next to the schema whose
|
|
8656
|
-
* ids it names.
|
|
8657
|
-
*/
|
|
8658
|
-
integrationSettingSections() {
|
|
8659
|
-
return [];
|
|
8660
|
-
}
|
|
8661
|
-
async getGlobalSettings(overlay, cap, nodeId) {
|
|
8662
|
-
await this.loadScopedSchemas(cap);
|
|
8663
|
-
const schema = this.globalSettingsSchema(cap) ?? this.scopedFormSchema(cap);
|
|
8664
|
-
if (!schema) return { sections: [] };
|
|
8665
|
-
const projected = await this.readRawProjectedStore(nodeId, cap);
|
|
8666
|
-
return hydrateSchema(schema, overlay ? await this.overlayKeepingMarkers(projected, overlay) : projected, { inlineSecretsAsViews: true });
|
|
8667
|
-
}
|
|
8668
|
-
/**
|
|
8669
|
-
* The integration-level view of this addon's settings: exactly the sections
|
|
8670
|
-
* named by {@link integrationSettingSections}, hydrated from the SAME store
|
|
8671
|
-
* `getGlobalSettings` reads, and narrowed to cluster-scoped fields.
|
|
8672
|
-
*
|
|
8673
|
-
* Returns `null` when the addon declared nothing — an addon that opts out has
|
|
8674
|
-
* no integration settings surface at all, rather than an empty one that reads
|
|
8675
|
-
* as a failed load.
|
|
8676
|
-
*
|
|
8677
|
-
* Three properties hold BY CONSTRUCTION, which is why they are here in core
|
|
8678
|
-
* and not in whichever UI happens to render this:
|
|
8679
|
-
*
|
|
8680
|
-
* 1. **One key.** The payload is a SUBSET of the global schema, so a field
|
|
8681
|
-
* shown here is the same field, with the same bare key, that the addon's
|
|
8682
|
-
* own page shows. There is no integration-specific writer — callers save
|
|
8683
|
-
* through `updateGlobalSettings` — so a second store key is unreachable,
|
|
8684
|
-
* not merely discouraged.
|
|
8685
|
-
* 2. **No node scope.** `perNode: true` fields are DROPPED. Their store key
|
|
8686
|
-
* is `<key>@<nodeId>` and an integration is not a node; whichever node
|
|
8687
|
-
* such a field silently picked would be a wrong answer for the operator
|
|
8688
|
-
* who opened the page (D266).
|
|
8689
|
-
* 3. **No silent typo.** A declared id that names no section throws. The
|
|
8690
|
-
* alternative — skip it — turns a rename into a surface that quietly
|
|
8691
|
-
* empties, which looks exactly like an addon with nothing to configure.
|
|
8692
|
-
*/
|
|
8693
|
-
/**
|
|
8694
|
-
* The form schema of ONE integration instance, or `null` to use {@link globalSettingsSchema}.
|
|
8755
|
+
* The form schema of ONE integration instance, or `null` to use the scoped form.
|
|
8695
8756
|
*
|
|
8696
8757
|
* Override it only when an `instanceMode: multiple` addon's instances differ: an NVR integration
|
|
8697
8758
|
* needs its connection fields, the default integration the addon's own sections. It is the
|
|
@@ -8739,37 +8800,178 @@ var BaseAddon = class {
|
|
|
8739
8800
|
}
|
|
8740
8801
|
}
|
|
8741
8802
|
/**
|
|
8803
|
+
* Hook: values layered over the stored ones when the FORM of one scope is served
|
|
8804
|
+
* ({@link getScopedSettings}) — a preview that derives dependent options without writing.
|
|
8805
|
+
* Never applied to {@link ScopedSettings.get} or to a write. `null` ⇒ no overlay.
|
|
8806
|
+
*/
|
|
8807
|
+
async scopedSettingsOverlay(_scope, _cap, _nodeId) {
|
|
8808
|
+
return null;
|
|
8809
|
+
}
|
|
8810
|
+
/**
|
|
8811
|
+
* Hook: a write of one scope changed stored values (not called when the store reports no change,
|
|
8812
|
+
* e.g. the write-back of a stored secret). `keys` are the bare field keys of the write, node keys included.
|
|
8813
|
+
*/
|
|
8814
|
+
async onScopedSettingsChanged(_scope, _cap, _keys) {}
|
|
8815
|
+
/** Typed handle over the CLUSTER settings `cap` declares (`clusterSettingsSchema`). */
|
|
8816
|
+
clusterSettings(cap, schema) {
|
|
8817
|
+
return this.scopedHandle("cluster", cap, schema);
|
|
8818
|
+
}
|
|
8819
|
+
/** Typed handle over the fleet defaults of the per-device settings `cap` declares. */
|
|
8820
|
+
deviceDefaults(cap, schema) {
|
|
8821
|
+
return this.scopedHandle("device-defaults", cap, schema);
|
|
8822
|
+
}
|
|
8823
|
+
/**
|
|
8824
|
+
* Typed handle over the settings `cap` owns PER NODE. `nodeId` omitted ⇒ the local node. A node
|
|
8825
|
+
* with no row yields the schema defaults — never a bare-key fallback.
|
|
8826
|
+
*/
|
|
8827
|
+
nodeSettings(cap, schema, nodeId) {
|
|
8828
|
+
return this.scopedHandle("node", cap, schema, nodeId);
|
|
8829
|
+
}
|
|
8830
|
+
/**
|
|
8831
|
+
* {@link state} for a value that is kept per node: stored under `<key>@<nodeId>`, and the
|
|
8832
|
+
* settings store carries `nodeId` in the row data (D986 §1), so a forgotten node's rows go in one
|
|
8833
|
+
* central delete. `nodeId` omitted ⇒ the local node.
|
|
8834
|
+
*/
|
|
8835
|
+
nodeState(key, schema, fallback, nodeId) {
|
|
8836
|
+
this._declaredStateKeys.add(key);
|
|
8837
|
+
return createDurableState({
|
|
8838
|
+
key: nodeScopedKey(key, nodeId ?? this._ctx?.kernel?.localNodeId ?? ""),
|
|
8839
|
+
schema,
|
|
8840
|
+
fallback,
|
|
8841
|
+
read: async () => this.resolveStoredSecrets(await this.readAddonStoreWithRetry()),
|
|
8842
|
+
write: async (patch) => {
|
|
8843
|
+
await this._ctx?.settings?.writeAddonStore(patch);
|
|
8844
|
+
},
|
|
8845
|
+
onParseError: (k, e) => this._ctx?.logger?.warn?.(`durable-state: stored "${k}" failed validation — using fallback`, { meta: {
|
|
8846
|
+
addonId: this._ctx?.id,
|
|
8847
|
+
key: k,
|
|
8848
|
+
error: String(e)
|
|
8849
|
+
} })
|
|
8850
|
+
});
|
|
8851
|
+
}
|
|
8852
|
+
/** The loaded schema `cap` declares for `scope`, or `null`. */
|
|
8853
|
+
async declaredScopedSchema(scope, cap) {
|
|
8854
|
+
await this.loadScopedSchemas(cap);
|
|
8855
|
+
return this.loadedScopedSchemas(cap).find((entry) => entry.scope === scope)?.schema ?? null;
|
|
8856
|
+
}
|
|
8857
|
+
async requireScopedSchema(scope, cap) {
|
|
8858
|
+
const schema = await this.declaredScopedSchema(scope, cap);
|
|
8859
|
+
if (schema === null) throw new Error(`${this.constructor.name}: cap "${cap}" declares no ${scope} settings`);
|
|
8860
|
+
return schema;
|
|
8861
|
+
}
|
|
8862
|
+
scopedKeys(schema) {
|
|
8863
|
+
return new Set(schema.sections.flatMap((section) => collectValueFieldKeys(section.fields)));
|
|
8864
|
+
}
|
|
8865
|
+
/** `store` narrowed to the keys `schema` declares. */
|
|
8866
|
+
narrowToScope(store, schema) {
|
|
8867
|
+
const keys = this.scopedKeys(schema);
|
|
8868
|
+
return Object.fromEntries(Object.entries(store).filter(([key]) => keys.has(key)));
|
|
8869
|
+
}
|
|
8870
|
+
scopedHandle(scope, cap, schema, nodeId) {
|
|
8871
|
+
return createScopedSettings({
|
|
8872
|
+
schema,
|
|
8873
|
+
read: async () => {
|
|
8874
|
+
const declared = await this.requireScopedSchema(scope, cap);
|
|
8875
|
+
const stored = this.narrowToScope(await this.resolveGlobalStore(nodeId, cap), declared);
|
|
8876
|
+
const effective = collectHydratedFieldValues(hydrateSchema(declared, stored));
|
|
8877
|
+
return {
|
|
8878
|
+
...Object.fromEntries([...effective].filter(([, value]) => value !== void 0)),
|
|
8879
|
+
...stored
|
|
8880
|
+
};
|
|
8881
|
+
},
|
|
8882
|
+
write: (patch) => this.writeScoped(scope, cap, patch, nodeId),
|
|
8883
|
+
unset: (keys) => this.unsetScoped(scope, cap, keys, nodeId)
|
|
8884
|
+
});
|
|
8885
|
+
}
|
|
8886
|
+
/** The one write path of the scoped API: declared keys only, then the global patch. */
|
|
8887
|
+
async writeScoped(scope, cap, patch, nodeId) {
|
|
8888
|
+
assertDeclaredKeys(Object.keys(patch), this.scopedKeys(await this.requireScopedSchema(scope, cap)));
|
|
8889
|
+
if (await this.applyGlobalPatch(patch, scope === "node" ? nodeId : void 0, cap)) await this.onScopedSettingsChanged(scope, cap, Object.keys(patch));
|
|
8890
|
+
}
|
|
8891
|
+
/**
|
|
8892
|
+
* Remove declared keys of one scope. A secret goes through {@link clearSecrets} — its keychain
|
|
8893
|
+
* value is released exactly as there — and the emptied row is then removed; every other key is
|
|
8894
|
+
* removed by an `undefined` patch (which a secret transform would read as "keep").
|
|
8895
|
+
*/
|
|
8896
|
+
async unsetScoped(scope, cap, keys, nodeId) {
|
|
8897
|
+
assertDeclaredKeys(keys, this.scopedKeys(await this.requireScopedSchema(scope, cap)));
|
|
8898
|
+
const target = scope === "node" ? nodeId : void 0;
|
|
8899
|
+
const tree = this.addonSecretTree();
|
|
8900
|
+
const secretKeys = keys.filter((key) => tree.has(key));
|
|
8901
|
+
const plainKeys = keys.filter((key) => !tree.has(key));
|
|
8902
|
+
let changed = false;
|
|
8903
|
+
if (plainKeys.length > 0) {
|
|
8904
|
+
const patch = Object.fromEntries(plainKeys.map((key) => [key, void 0]));
|
|
8905
|
+
changed = await this.applyGlobalPatch(patch, target, cap) || changed;
|
|
8906
|
+
}
|
|
8907
|
+
if (secretKeys.length > 0) {
|
|
8908
|
+
await this.clearSecretKeys(secretKeys, target, cap);
|
|
8909
|
+
const node = normalizeNodeId(target ?? this._ctx?.kernel?.localNodeId);
|
|
8910
|
+
const rows = secretKeys.map((key) => scope === "node" ? nodeScopedKey(key, node) : key);
|
|
8911
|
+
if (this._secretSettings !== null) await this._secretSettings.removeClearedKeys(rows);
|
|
8912
|
+
else await this._ctx?.settings?.writeAddonStore(Object.fromEntries(rows.map((row) => [row, void 0])));
|
|
8913
|
+
changed = true;
|
|
8914
|
+
}
|
|
8915
|
+
if (changed) await this.onScopedSettingsChanged(scope, cap, [...keys]);
|
|
8916
|
+
}
|
|
8917
|
+
/**
|
|
8918
|
+
* The hydrated form of one scope of one capability's settings (any
|
|
8919
|
+
* {@link scopedSettingsOverlay} applied), or `null` when the capability declares nothing there.
|
|
8920
|
+
*/
|
|
8921
|
+
async getScopedSettings(scope, cap, nodeId) {
|
|
8922
|
+
const schema = await this.declaredScopedSchema(scope, cap);
|
|
8923
|
+
if (schema === null) return null;
|
|
8924
|
+
const stored = this.narrowToScope(await this.readRawProjectedStore(nodeId, cap), schema);
|
|
8925
|
+
const overlay = await this.scopedSettingsOverlay(scope, cap, nodeId);
|
|
8926
|
+
return hydrateSchema(schema, overlay ? await this.overlayKeepingMarkers(stored, overlay) : stored, { inlineSecretsAsViews: true });
|
|
8927
|
+
}
|
|
8928
|
+
/**
|
|
8929
|
+
* The scoped schemas this addon serves: one entry per loaded (capability, scope), capabilities
|
|
8930
|
+
* in declaration order, scopes in {@link SCOPED_SETTINGS_SCOPES} order. `[]` when it declares
|
|
8931
|
+
* nothing.
|
|
8932
|
+
*/
|
|
8933
|
+
async listScopedSettings() {
|
|
8934
|
+
await this.loadScopedSchemas();
|
|
8935
|
+
return [...this._scopedByCap].flatMap(([cap, entries]) => entries.map((entry) => ({
|
|
8936
|
+
cap,
|
|
8937
|
+
scope: entry.scope,
|
|
8938
|
+
sectionIds: entry.schema.sections.map((section) => section.id)
|
|
8939
|
+
})));
|
|
8940
|
+
}
|
|
8941
|
+
/** The OPERATOR's write of declared keys of one scope (D787 secret semantics). */
|
|
8942
|
+
async updateScopedSettings(scope, cap, patch, nodeId) {
|
|
8943
|
+
this._operatorWriteDepth++;
|
|
8944
|
+
try {
|
|
8945
|
+
await this.writeScoped(scope, cap, patch, nodeId);
|
|
8946
|
+
} finally {
|
|
8947
|
+
this._operatorWriteDepth--;
|
|
8948
|
+
}
|
|
8949
|
+
}
|
|
8950
|
+
/**
|
|
8951
|
+
* The effective values (`stored ?? default`) of one scope, a secret as its `set` view — never
|
|
8952
|
+
* its value. `null` when the capability declares nothing for the scope.
|
|
8953
|
+
*/
|
|
8954
|
+
async readScopedValues(scope, cap, nodeId) {
|
|
8955
|
+
const schema = await this.declaredScopedSchema(scope, cap);
|
|
8956
|
+
if (schema === null) return null;
|
|
8957
|
+
const form = hydrateSchema(schema, this.narrowToScope(await this.readRawProjectedStore(nodeId, cap), schema), { inlineSecretsAsViews: true });
|
|
8958
|
+
return Object.fromEntries([...collectHydratedFieldValues(form)].filter(([, value]) => value !== void 0));
|
|
8959
|
+
}
|
|
8960
|
+
/**
|
|
8742
8961
|
* What the create wizard and the integration edit page render for one instance: the addon's
|
|
8743
8962
|
* per-instance schema when it declares one, else its global schema (what they always showed).
|
|
8744
8963
|
*/
|
|
8745
8964
|
async getIntegrationFormSchema(instance, nodeId) {
|
|
8746
8965
|
const scoped = await this.integrationFormSchema(instance);
|
|
8747
|
-
if (scoped === null) return this.
|
|
8966
|
+
if (scoped === null) return this.scopedForm(nodeId);
|
|
8748
8967
|
return hydrateSchema(scoped, {}, { inlineSecretsAsViews: true });
|
|
8749
8968
|
}
|
|
8750
|
-
|
|
8751
|
-
|
|
8752
|
-
|
|
8753
|
-
const schema = this.
|
|
8754
|
-
if (!schema)
|
|
8755
|
-
|
|
8756
|
-
const sections = [];
|
|
8757
|
-
for (const id of declared) {
|
|
8758
|
-
const section = byId.get(id);
|
|
8759
|
-
if (!section) throw new Error(`${this.constructor.name}: integrationSettingSections() names unknown section "${id}". Known sections: [${[...byId.keys()].join(", ")}].`);
|
|
8760
|
-
const fields = dropPerNodeFields(section.fields);
|
|
8761
|
-
if (fields.length === 0) continue;
|
|
8762
|
-
sections.push({
|
|
8763
|
-
...section,
|
|
8764
|
-
fields
|
|
8765
|
-
});
|
|
8766
|
-
}
|
|
8767
|
-
if (sections.length === 0) return null;
|
|
8768
|
-
const projected = await this.readRawProjectedStore(nodeId);
|
|
8769
|
-
return hydrateSchema({
|
|
8770
|
-
...schema,
|
|
8771
|
-
sections
|
|
8772
|
-
}, projected, { inlineSecretsAsViews: true });
|
|
8969
|
+
/** The form of the scoped schemas this addon declared, hydrated from its store. */
|
|
8970
|
+
async scopedForm(nodeId) {
|
|
8971
|
+
await this.loadScopedSchemas();
|
|
8972
|
+
const schema = this.scopedFormSchema();
|
|
8973
|
+
if (!schema) return { sections: [] };
|
|
8974
|
+
return hydrateSchema(schema, await this.readRawProjectedStore(nodeId), { inlineSecretsAsViews: true });
|
|
8773
8975
|
}
|
|
8774
8976
|
/**
|
|
8775
8977
|
* The raw addon store PROJECTED onto the target node's bare per-node keys:
|
|
@@ -8778,8 +8980,8 @@ var BaseAddon = class {
|
|
|
8778
8980
|
* bare fallback), all `@`-scoped and stray bare per-node keys are dropped.
|
|
8779
8981
|
* A no-op passthrough when the schema declares no `perNode` field.
|
|
8780
8982
|
*
|
|
8781
|
-
* This is the sanctioned way for
|
|
8782
|
-
* the store for custom
|
|
8983
|
+
* This is the sanctioned way for an addon that needs
|
|
8984
|
+
* the store for custom logic (option narrowing, value snapping) to
|
|
8783
8985
|
* read it per-node — never `ctx.settings.readAddonStore()` directly.
|
|
8784
8986
|
* `nodeId` omitted ⇒ the local node (node-blind injection from ctx).
|
|
8785
8987
|
*
|
|
@@ -8831,7 +9033,7 @@ var BaseAddon = class {
|
|
|
8831
9033
|
}
|
|
8832
9034
|
/**
|
|
8833
9035
|
* Whether ONE global key of this addon's store was written, read three-way
|
|
8834
|
-
* (D651). For a question a hydrated view cannot answer:
|
|
9036
|
+
* (D651). For a question a hydrated view cannot answer: a hydrated form
|
|
8835
9037
|
* reports `value ?? default`, so "the operator chose the default" and "nobody
|
|
8836
9038
|
* chose" look the same, and a failed read looks like both. A `perNode` key is
|
|
8837
9039
|
* not supported here: its stored name is scoped.
|
|
@@ -8865,7 +9067,7 @@ var BaseAddon = class {
|
|
|
8865
9067
|
}
|
|
8866
9068
|
/**
|
|
8867
9069
|
* The OPERATOR's write — a settings form or an admin API call, dispatched by
|
|
8868
|
-
* the kernel.
|
|
9070
|
+
* the kernel. The one in-process write of the addon blob that is not a scoped write; a secret
|
|
8869
9071
|
* the operator sends is stored as sent even when it equals a pre-keychain
|
|
8870
9072
|
* inline value: the operator re-entering a password is a change, an addon
|
|
8871
9073
|
* writing back what it read is not (D787).
|
|
@@ -8878,9 +9080,6 @@ var BaseAddon = class {
|
|
|
8878
9080
|
this._operatorWriteDepth--;
|
|
8879
9081
|
}
|
|
8880
9082
|
}
|
|
8881
|
-
async updateGlobalSettings(patch, nodeId) {
|
|
8882
|
-
await this.applyGlobalPatch(patch, nodeId);
|
|
8883
|
-
}
|
|
8884
9083
|
/**
|
|
8885
9084
|
* REMOVE stored secrets — their keychain values and their markers (D787).
|
|
8886
9085
|
*
|
|
@@ -8890,6 +9089,9 @@ var BaseAddon = class {
|
|
|
8890
9089
|
* a keychain (an older kernel) it writes `''`, as such code always did.
|
|
8891
9090
|
*/
|
|
8892
9091
|
async clearSecrets(keys, nodeId) {
|
|
9092
|
+
await this.clearSecretKeys(keys, nodeId);
|
|
9093
|
+
}
|
|
9094
|
+
async clearSecretKeys(keys, nodeId, cap) {
|
|
8893
9095
|
const tree = this.addonSecretTree();
|
|
8894
9096
|
const keychain = this._ctx?.secrets !== void 0;
|
|
8895
9097
|
const stored = keychain ? await this.readAddonStoreWithRetry() : {};
|
|
@@ -8902,25 +9104,26 @@ var BaseAddon = class {
|
|
|
8902
9104
|
const keychainStored = tree.has(key) || collectSecretMarkerRefs(stored[key]).length > 0;
|
|
8903
9105
|
patch[key] = keychain && keychainStored ? SECRET_CLEAR : "";
|
|
8904
9106
|
}
|
|
8905
|
-
await this.applyGlobalPatch(patch, nodeId);
|
|
9107
|
+
await this.applyGlobalPatch(patch, nodeId, cap);
|
|
8906
9108
|
}
|
|
8907
|
-
|
|
8908
|
-
|
|
8909
|
-
|
|
9109
|
+
/** Resolves `true` when the write changed stored values. */
|
|
9110
|
+
async applyGlobalPatch(barePatch, nodeId, cap) {
|
|
9111
|
+
await this.loadScopedSchemas(cap);
|
|
9112
|
+
const keys = this.perNodeKeys(cap);
|
|
8910
9113
|
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
8911
9114
|
const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
8912
9115
|
const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
|
|
8913
9116
|
const handle = this._secretSettings;
|
|
8914
9117
|
if (handle !== null) {
|
|
8915
9118
|
const { changed } = await handle.writeAddonStore(scoped);
|
|
8916
|
-
if (!changed) return;
|
|
9119
|
+
if (!changed) return false;
|
|
8917
9120
|
} else await this._ctx?.settings?.writeAddonStore(scoped);
|
|
8918
|
-
if (target !== localNode) return;
|
|
9121
|
+
if (target !== localNode) return true;
|
|
8919
9122
|
await this.resolveConfig();
|
|
8920
9123
|
await this.onConfigChanged();
|
|
8921
9124
|
this.emitLifecycle(EventCategory.AddonUpdated, { level: "global" });
|
|
8922
|
-
|
|
8923
|
-
|
|
9125
|
+
this.maybeAutoRestart(Object.keys(barePatch), this.loadedScopedSchemas().map((entry) => entry.schema));
|
|
9126
|
+
return true;
|
|
8924
9127
|
}
|
|
8925
9128
|
/**
|
|
8926
9129
|
* The set of field keys the global settings schema declares `perNode: true`
|
|
@@ -8957,10 +9160,7 @@ var BaseAddon = class {
|
|
|
8957
9160
|
this._nodeKeysByCap = /* @__PURE__ */ new Map();
|
|
8958
9161
|
this._addonSecretTree = null;
|
|
8959
9162
|
}
|
|
8960
|
-
/**
|
|
8961
|
-
* The form the settings API serves while an addon declares no {@link globalSettingsSchema}: the
|
|
8962
|
-
* sections of its scoped schemas, so dropping the old hook does not blank the form.
|
|
8963
|
-
*/
|
|
9163
|
+
/** The form of an addon's scoped schemas: their sections, each shown once. */
|
|
8964
9164
|
scopedFormSchema(cap) {
|
|
8965
9165
|
const byId = /* @__PURE__ */ new Map();
|
|
8966
9166
|
for (const entry of this.loadedScopedSchemas(cap)) for (const section of entry.schema.sections) if (!byId.has(section.id)) byId.set(section.id, section);
|
|
@@ -8972,8 +9172,7 @@ var BaseAddon = class {
|
|
|
8972
9172
|
return [...this._scopedByCap.values()].flat();
|
|
8973
9173
|
}
|
|
8974
9174
|
/**
|
|
8975
|
-
* The field keys that are stored per node: every field of a {@link nodeSettingsSchema}
|
|
8976
|
-
* the fields the legacy {@link globalSettingsSchema} still marks `perNode: true`. Derived once
|
|
9175
|
+
* The field keys that are stored per node: every field of a {@link nodeSettingsSchema}. Derived once
|
|
8977
9176
|
* per `cap` argument and memoized (schemas are static declarations). Empty set ⇒ every
|
|
8978
9177
|
* per-node code path is bypassed and the settings API behaves like the node-agnostic one.
|
|
8979
9178
|
* Call {@link loadScopedSchemas} first (the async seams do).
|
|
@@ -8982,8 +9181,7 @@ var BaseAddon = class {
|
|
|
8982
9181
|
const cacheKey = cap ?? "";
|
|
8983
9182
|
const cached = this._nodeKeysByCap.get(cacheKey);
|
|
8984
9183
|
if (cached) return cached;
|
|
8985
|
-
const
|
|
8986
|
-
const keys = new Set(legacy ? legacy.sections.flatMap((section) => collectPerNodeFieldKeys(section.fields)) : []);
|
|
9184
|
+
const keys = /* @__PURE__ */ new Set();
|
|
8987
9185
|
for (const { scope, schema } of this.loadedScopedSchemas(cap)) {
|
|
8988
9186
|
if (scope !== "node") continue;
|
|
8989
9187
|
for (const section of schema.sections) for (const key of collectValueFieldKeys(section.fields)) keys.add(key);
|
|
@@ -9201,8 +9399,6 @@ var BaseAddon = class {
|
|
|
9201
9399
|
}
|
|
9202
9400
|
declaredKeySet() {
|
|
9203
9401
|
const keys = new Set(Object.keys(this.defaults));
|
|
9204
|
-
const schema = this.globalSettingsSchema();
|
|
9205
|
-
if (schema) for (const section of schema.sections) for (const key of collectFieldKeys(section.fields)) keys.add(key);
|
|
9206
9402
|
for (const { schema: scoped } of this.loadedScopedSchemas()) for (const section of scoped.sections) for (const key of collectFieldKeys(section.fields)) keys.add(key);
|
|
9207
9403
|
for (const key of this._declaredStateKeys) keys.add(key);
|
|
9208
9404
|
for (const path of this.secretStatePaths) {
|
|
@@ -9300,7 +9496,7 @@ var BaseAddon = class {
|
|
|
9300
9496
|
/** The addon store's secret tree: schema fields by TYPE, plus `secretStatePaths`. */
|
|
9301
9497
|
addonSecretTree() {
|
|
9302
9498
|
if (this._addonSecretTree === null) {
|
|
9303
|
-
const tree = new Map(
|
|
9499
|
+
const tree = /* @__PURE__ */ new Map();
|
|
9304
9500
|
for (const { schema } of this.loadedScopedSchemas()) for (const [key, node] of secretTreeFromSchema(schema)) tree.set(key, node);
|
|
9305
9501
|
this._addonSecretTree = mergeSecretStatePaths(tree, this.secretStatePaths);
|
|
9306
9502
|
}
|
|
@@ -9512,47 +9708,6 @@ function classifyStoreError(err) {
|
|
|
9512
9708
|
if (TRANSPORT_PHRASES.some((f) => message.includes(f))) return "transport";
|
|
9513
9709
|
return "permanent";
|
|
9514
9710
|
}
|
|
9515
|
-
/**
|
|
9516
|
-
* Collect the keys of every field marked `perNode: true`, recursing into
|
|
9517
|
-
* layout containers (`group` fields and `sub-tabs` tabs) the same way
|
|
9518
|
-
* `hydrateSchema` does. Valueless structural fields (separator/info/…)
|
|
9519
|
-
* don't declare `perNode` and are excluded by the `in` narrowing.
|
|
9520
|
-
*/
|
|
9521
|
-
/**
|
|
9522
|
-
* The same fields with every `perNode: true` one removed, recursing into layout
|
|
9523
|
-
* containers exactly as {@link collectPerNodeFieldKeys} does. A container left
|
|
9524
|
-
* with no child is dropped rather than rendered empty.
|
|
9525
|
-
*
|
|
9526
|
-
* Used by `getIntegrationSettings`: an integration is not a node, so a field
|
|
9527
|
-
* whose store key is `<key>@<nodeId>` has no node to belong to there.
|
|
9528
|
-
*/
|
|
9529
|
-
function dropPerNodeFields(fields) {
|
|
9530
|
-
const kept = [];
|
|
9531
|
-
for (const field of fields) {
|
|
9532
|
-
if (field.type === "group") {
|
|
9533
|
-
const inner = dropPerNodeFields(field.fields);
|
|
9534
|
-
if (inner.length > 0) kept.push({
|
|
9535
|
-
...field,
|
|
9536
|
-
fields: inner
|
|
9537
|
-
});
|
|
9538
|
-
continue;
|
|
9539
|
-
}
|
|
9540
|
-
if (field.type === "sub-tabs") {
|
|
9541
|
-
const tabs = field.tabs.map((tab) => ({
|
|
9542
|
-
...tab,
|
|
9543
|
-
fields: dropPerNodeFields(tab.fields)
|
|
9544
|
-
})).filter((tab) => tab.fields.length > 0);
|
|
9545
|
-
if (tabs.length > 0) kept.push({
|
|
9546
|
-
...field,
|
|
9547
|
-
tabs
|
|
9548
|
-
});
|
|
9549
|
-
continue;
|
|
9550
|
-
}
|
|
9551
|
-
if ("perNode" in field && field.perNode === true) continue;
|
|
9552
|
-
kept.push(field);
|
|
9553
|
-
}
|
|
9554
|
-
return kept;
|
|
9555
|
-
}
|
|
9556
9711
|
/** The keys of the value-holding fields, recursing into layout containers. */
|
|
9557
9712
|
function collectValueFieldKeys(fields) {
|
|
9558
9713
|
const collected = [];
|
|
@@ -9585,21 +9740,6 @@ function collectFieldKeys(fields) {
|
|
|
9585
9740
|
}
|
|
9586
9741
|
return collected;
|
|
9587
9742
|
}
|
|
9588
|
-
function collectPerNodeFieldKeys(fields) {
|
|
9589
|
-
const collected = [];
|
|
9590
|
-
for (const field of fields) {
|
|
9591
|
-
if (field.type === "group") {
|
|
9592
|
-
collected.push(...collectPerNodeFieldKeys(field.fields));
|
|
9593
|
-
continue;
|
|
9594
|
-
}
|
|
9595
|
-
if (field.type === "sub-tabs") {
|
|
9596
|
-
for (const tab of field.tabs) collected.push(...collectPerNodeFieldKeys(tab.fields));
|
|
9597
|
-
continue;
|
|
9598
|
-
}
|
|
9599
|
-
if ("perNode" in field && field.perNode === true) collected.push(field.key);
|
|
9600
|
-
}
|
|
9601
|
-
return collected;
|
|
9602
|
-
}
|
|
9603
9743
|
/**
|
|
9604
9744
|
* Normalize an `ICamstackAddon.initialize()` return value into the
|
|
9605
9745
|
* `AddonInitResult` envelope. Arrays are wrapped into `{ providers }`;
|
|
@@ -10676,7 +10816,6 @@ var CAP_NAMES = Object.freeze([
|
|
|
10676
10816
|
"notifier",
|
|
10677
10817
|
"numeric-sensor",
|
|
10678
10818
|
"oauth-integration",
|
|
10679
|
-
"oidc-connections",
|
|
10680
10819
|
"osd",
|
|
10681
10820
|
"osd-manager",
|
|
10682
10821
|
"pet-feeder",
|
|
@@ -12383,13 +12522,25 @@ Object.freeze({
|
|
|
12383
12522
|
"path": "temperature",
|
|
12384
12523
|
"valueType": "number"
|
|
12385
12524
|
}],
|
|
12386
|
-
"timed-run": [
|
|
12387
|
-
|
|
12388
|
-
|
|
12389
|
-
|
|
12390
|
-
|
|
12391
|
-
|
|
12392
|
-
|
|
12525
|
+
"timed-run": [
|
|
12526
|
+
{
|
|
12527
|
+
"path": "activeUntil",
|
|
12528
|
+
"valueType": "number"
|
|
12529
|
+
},
|
|
12530
|
+
{
|
|
12531
|
+
"path": "requestedBy",
|
|
12532
|
+
"valueType": "string"
|
|
12533
|
+
},
|
|
12534
|
+
{
|
|
12535
|
+
"path": "quickRun.duration",
|
|
12536
|
+
"valueType": "number"
|
|
12537
|
+
},
|
|
12538
|
+
{
|
|
12539
|
+
"path": "quickRun.unit",
|
|
12540
|
+
"valueType": "enum",
|
|
12541
|
+
"enumValues": ["s", "min"]
|
|
12542
|
+
}
|
|
12543
|
+
],
|
|
12393
12544
|
"update": [
|
|
12394
12545
|
{
|
|
12395
12546
|
"path": "currentVersion",
|
|
@@ -12568,8 +12719,7 @@ Object.freeze({
|
|
|
12568
12719
|
"device-provider": { "reloadDevice": 18e4 },
|
|
12569
12720
|
"llm": {
|
|
12570
12721
|
"generate": 6e5,
|
|
12571
|
-
"generateVision": 6e5
|
|
12572
|
-
"testProfile": 6e5
|
|
12722
|
+
"generateVision": 6e5
|
|
12573
12723
|
},
|
|
12574
12724
|
"llm-runtime": {
|
|
12575
12725
|
"complete": 6e5,
|
|
@@ -12614,7 +12764,7 @@ object({
|
|
|
12614
12764
|
params: record(string(), union([string(), number()])).optional()
|
|
12615
12765
|
});
|
|
12616
12766
|
//#endregion
|
|
12617
|
-
//#region ../types/dist/composition-
|
|
12767
|
+
//#region ../types/dist/composition-Bx0JvKUU.mjs
|
|
12618
12768
|
/**
|
|
12619
12769
|
* The ffmpeg build every CamStack node downloads, per platform and arch.
|
|
12620
12770
|
*
|
|
@@ -13776,458 +13926,844 @@ var NodeColorIdSchema = _enum([
|
|
|
13776
13926
|
"node-h"
|
|
13777
13927
|
]);
|
|
13778
13928
|
//#endregion
|
|
13779
|
-
//#region ../types/dist/
|
|
13780
|
-
var SMTP_INBOUND_DEFAULT_PORT = 2525;
|
|
13781
|
-
var SMTP_INBOUND_DEFAULT_DOMAIN = "camstack.local";
|
|
13782
|
-
var SMTP_INBOUND_DEFAULT_MAX_MESSAGE_BYTES = 25 * 1024 * 1024;
|
|
13783
|
-
/** The text excerpt a message carries on the bus. */
|
|
13784
|
-
var SMTP_INBOUND_TEXT_MAX_CHARS = 4096;
|
|
13785
|
-
var PortSchema = number().int().min(1).max(65535);
|
|
13786
|
-
/** A recipient local-part: what stands before the `@`. */
|
|
13787
|
-
var SmtpRecipientSchema = string().min(1).max(64).regex(/^[A-Za-z0-9._+-]+$/);
|
|
13788
|
-
object({
|
|
13789
|
-
port: PortSchema.default(SMTP_INBOUND_DEFAULT_PORT),
|
|
13790
|
-
bindHost: string().min(1).default("0.0.0.0"),
|
|
13791
|
-
domain: string().min(1).default(SMTP_INBOUND_DEFAULT_DOMAIN),
|
|
13792
|
-
requireAuth: boolean().default(true),
|
|
13793
|
-
username: string().default(""),
|
|
13794
|
-
password: string().default("").meta({ secret: true }),
|
|
13795
|
-
starttls: boolean().default(false),
|
|
13796
|
-
maxMessageBytes: number().int().positive().default(SMTP_INBOUND_DEFAULT_MAX_MESSAGE_BYTES)
|
|
13797
|
-
});
|
|
13798
|
-
object({
|
|
13799
|
-
host: string().min(1).nullable(),
|
|
13800
|
-
hostReason: string().nullable(),
|
|
13801
|
-
port: PortSchema,
|
|
13802
|
-
domain: string().min(1),
|
|
13803
|
-
requireAuth: boolean(),
|
|
13804
|
-
username: string(),
|
|
13805
|
-
password: string(),
|
|
13806
|
-
starttls: boolean()
|
|
13807
|
-
});
|
|
13808
|
-
object({
|
|
13809
|
-
recipients: array(SmtpRecipientSchema).min(1),
|
|
13810
|
-
/**
|
|
13811
|
-
* Who is subscribing. A second `subscribe` with the same id REPLACES that subscriber's
|
|
13812
|
-
* recipients (the way a consumer that restarted, or lost a device, declares its set again);
|
|
13813
|
-
* a recipient held by another subscriber is refused with `smtp-inbound/recipient-claimed`.
|
|
13814
|
-
* Absent, the subscriber is anonymous and unique.
|
|
13815
|
-
*/
|
|
13816
|
-
subscriberId: string().min(1).max(64).optional()
|
|
13817
|
-
});
|
|
13818
|
-
var SmtpInboundAttachmentSchema = object({
|
|
13819
|
-
filename: string(),
|
|
13820
|
-
contentType: string(),
|
|
13821
|
-
bytes: number().int().nonnegative()
|
|
13822
|
-
});
|
|
13823
|
-
/** The payload of one `broker.message` (the key is the recipient local-part). */
|
|
13824
|
-
var SmtpInboundMessageSchema = object({
|
|
13825
|
-
/** Monotonic per mailbox; a gap tells a consumer it missed an event. */
|
|
13826
|
-
seq: number().int().positive(),
|
|
13827
|
-
messageId: string(),
|
|
13828
|
-
receivedAt: number().int().nonnegative(),
|
|
13829
|
-
from: string(),
|
|
13830
|
-
to: string(),
|
|
13831
|
-
subject: string(),
|
|
13832
|
-
text: string().max(SMTP_INBOUND_TEXT_MAX_CHARS),
|
|
13833
|
-
attachments: array(SmtpInboundAttachmentSchema)
|
|
13834
|
-
});
|
|
13835
|
-
object({
|
|
13836
|
-
/** The newest seq issued so far (0 before any mail). */
|
|
13837
|
-
lastSeq: number().int().nonnegative(),
|
|
13838
|
-
/** The oldest seq still retained; messages below it are gone. */
|
|
13839
|
-
oldestSeq: number().int().nonnegative(),
|
|
13840
|
-
messages: array(object({
|
|
13841
|
-
key: string(),
|
|
13842
|
-
message: SmtpInboundMessageSchema
|
|
13843
|
-
}))
|
|
13844
|
-
});
|
|
13845
|
-
new Set([
|
|
13846
|
-
"track",
|
|
13847
|
-
"face",
|
|
13848
|
-
"identity",
|
|
13849
|
-
"plate",
|
|
13850
|
-
"vehicle",
|
|
13851
|
-
"scene",
|
|
13852
|
-
"motion",
|
|
13853
|
-
"object",
|
|
13854
|
-
"audio",
|
|
13855
|
-
"mosaic"
|
|
13856
|
-
]);
|
|
13857
|
-
/**
|
|
13858
|
-
* The owner types that are event tables, in the order the event-media resolver
|
|
13859
|
-
* should consider them. Exported so a consumer asking "is this key an event?"
|
|
13860
|
-
* does not re-spell the list and drift from it.
|
|
13861
|
-
*/
|
|
13862
|
-
var EVENT_OWNER_TYPES = [
|
|
13863
|
-
"motion",
|
|
13864
|
-
"object",
|
|
13865
|
-
"audio"
|
|
13866
|
-
];
|
|
13867
|
-
/**
|
|
13868
|
-
* The same list as a Zod enum, for the cap inputs that must NAME the table
|
|
13869
|
-
* (D482: `getEventMedia` / `listEventMedia` take an owner, and an owner is
|
|
13870
|
-
* `(table, id)`).
|
|
13871
|
-
*
|
|
13872
|
-
* Built FROM {@link EVENT_OWNER_TYPES} rather than re-spelled: a fourth event
|
|
13873
|
-
* table would otherwise be accepted by the codec and refused at the door, with
|
|
13874
|
-
* nothing failing until a caller asked.
|
|
13875
|
-
*/
|
|
13876
|
-
var EventOwnerTypeSchema = _enum(EVENT_OWNER_TYPES);
|
|
13877
|
-
/** The same list as a Zod enum, for the cap input that carries it. */
|
|
13878
|
-
var MediaPresenceOwnerKindSchema = _enum([...EVENT_OWNER_TYPES, "track"]);
|
|
13879
|
-
new Set(EVENT_OWNER_TYPES);
|
|
13880
|
-
/**
|
|
13881
|
-
* What a published package needs from the rest of the install (D989).
|
|
13882
|
-
*
|
|
13883
|
-
* One published framework package (`@camstack/server`) carries the kernel, the
|
|
13884
|
-
* builtins and the capability contracts, so "which addon runs on which
|
|
13885
|
-
* framework" is a question of version, and the answer is DECLARED by the
|
|
13886
|
-
* package that knows it:
|
|
13887
|
-
*
|
|
13888
|
-
* - an addon says the oldest server it runs on (`requires.server: ">=X"`);
|
|
13889
|
-
* - the server says the oldest addon it works with
|
|
13890
|
-
* (`requires.addons: { "@camstack/addon-x": ">=Y" }`) and the oldest shell
|
|
13891
|
-
* around it (`requires.wrapper: { desktop, image }`);
|
|
13892
|
-
* - a wrapper (the desktop app, the container starter) says which server
|
|
13893
|
-
* range it can host, and reports its own kind and version.
|
|
13894
|
-
*
|
|
13895
|
-
* The publish workflow STAMPS these after the version bump
|
|
13896
|
-
* (`scripts/ci/stamp-requires.mjs`); nobody types a number by hand.
|
|
13897
|
-
*
|
|
13898
|
-
* A requirement that cannot be checked is NOT met: a shell that reports no
|
|
13899
|
-
* version counts as below the minimum, and an unreadable running version is
|
|
13900
|
-
* named in the result (a failed read is never a pass).
|
|
13901
|
-
*/
|
|
13902
|
-
/** `>=MAJOR.MINOR.PATCH[-prerelease]` — the only range shape a requirement uses. */
|
|
13903
|
-
var MinVersionSchema = string().regex(/^>=\d+\.\d+\.\d+(-[0-9A-Za-z.-]+)?$/, "a minimum is written \">=X.Y.Z\"");
|
|
13904
|
-
object({
|
|
13905
|
-
/** The oldest `@camstack/server` this package runs on. */
|
|
13906
|
-
server: MinVersionSchema.optional(),
|
|
13907
|
-
/** The oldest installed version of each named addon package. */
|
|
13908
|
-
addons: record(string(), MinVersionSchema).optional(),
|
|
13909
|
-
/** The oldest shell around the server, per shell kind. */
|
|
13910
|
-
wrapper: object({
|
|
13911
|
-
desktop: MinVersionSchema.optional(),
|
|
13912
|
-
image: MinVersionSchema.optional()
|
|
13913
|
-
}).optional()
|
|
13914
|
-
});
|
|
13915
|
-
/** One unmet requirement; each names the versions on both sides. */
|
|
13916
|
-
var UnmetRequirementSchema = discriminatedUnion("kind", [
|
|
13917
|
-
object({
|
|
13918
|
-
kind: literal("server-too-old"),
|
|
13919
|
-
required: string(),
|
|
13920
|
-
/** `null` — the running server version could not be read. */
|
|
13921
|
-
running: string().nullable()
|
|
13922
|
-
}),
|
|
13923
|
-
object({
|
|
13924
|
-
kind: literal("addon-too-old"),
|
|
13925
|
-
packageName: string(),
|
|
13926
|
-
required: string(),
|
|
13927
|
-
/** `null` — the addon is not installed (or its version is unreadable). */
|
|
13928
|
-
running: string().nullable()
|
|
13929
|
-
}),
|
|
13930
|
-
object({
|
|
13931
|
-
kind: literal("wrapper-too-old"),
|
|
13932
|
-
wrapper: _enum(["desktop", "image"]),
|
|
13933
|
-
required: string(),
|
|
13934
|
-
/** `null` — the wrapper reported no version. */
|
|
13935
|
-
running: string().nullable()
|
|
13936
|
-
})
|
|
13937
|
-
]);
|
|
13938
|
-
var RequiredAddonUpdateSchema = object({
|
|
13939
|
-
packageName: string(),
|
|
13940
|
-
/** The minimum the target server declares. */
|
|
13941
|
-
required: string(),
|
|
13942
|
-
/** What this node has; `null` when the addon is not installed. */
|
|
13943
|
-
installed: string().nullable()
|
|
13944
|
-
});
|
|
13945
|
-
/**
|
|
13946
|
-
* Which integration instance a settings form is for. An addon that serves several instances
|
|
13947
|
-
* (`instanceMode: multiple`) can show a different form per instance — an NVR integration
|
|
13948
|
-
* needs its connection, the default integration needs the addon's own sections.
|
|
13949
|
-
*
|
|
13950
|
-
* - `integrationId` is `null` in the create wizard: nothing exists yet, the operator is
|
|
13951
|
-
* setting up a NEW instance.
|
|
13952
|
-
* - `mode` is the wizard mode of the integration type (`getAvailableTypes`).
|
|
13953
|
-
* - `candidateStableId` is the discovery candidate a wizard was seeded from, if any.
|
|
13954
|
-
*/
|
|
13955
|
-
var IntegrationInstanceRefSchema = object({
|
|
13956
|
-
integrationId: string().nullable(),
|
|
13957
|
-
mode: _enum([
|
|
13958
|
-
"standalone",
|
|
13959
|
-
"account",
|
|
13960
|
-
"broker"
|
|
13961
|
-
]),
|
|
13962
|
-
candidateStableId: string().optional()
|
|
13963
|
-
});
|
|
13964
|
-
/**
|
|
13965
|
-
* notification-output — canonical, capability-gated notification delivery.
|
|
13966
|
-
*
|
|
13967
|
-
* Apprise-derived model (see
|
|
13968
|
-
* `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
|
|
13969
|
-
* callers emit ONE canonical `Notification`; each provider declares a
|
|
13970
|
-
* per-kind capability descriptor (`TargetKind`), and the pure degrade
|
|
13971
|
-
* engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
|
|
13972
|
-
* message to what the kind supports — callers never special-case a service.
|
|
13973
|
-
*
|
|
13974
|
-
* DESIGN DECISIONS (locked):
|
|
13975
|
-
* - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
|
|
13976
|
-
* `setTargetEnabled`), each provider persisting via the `settings-store`
|
|
13977
|
-
* cap. Rationale: the admin UI needs one uniform surface across the
|
|
13978
|
-
* notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
|
|
13979
|
-
* alternative would fork the UI per addon and cannot host the
|
|
13980
|
-
* discovery→adopt flow.
|
|
13981
|
-
* - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
|
|
13982
|
-
* the generated cap-mount auto-`concatCollection`-fans them across every
|
|
13983
|
-
* registered provider (notifiers addon + HA addon) so one catalog is
|
|
13984
|
-
* routable. `send` / `testTarget` / CRUD route to ONE provider by the
|
|
13985
|
-
* `addonId` the generated collection router extracts from the call input.
|
|
13986
|
-
* - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
|
|
13987
|
-
* transformer) + UDS MsgPack both round-trip typed arrays — already used by
|
|
13988
|
-
* `storage` / `storage-provider` / `recording` caps over the same path. No
|
|
13989
|
-
* base64 fallback needed.
|
|
13990
|
-
*
|
|
13991
|
-
* TODO (deferred, closed-set change — separate decision): add
|
|
13992
|
-
* `providerKind: 'notify'` so notification providers surface on the unified
|
|
13993
|
-
* admin "Integrations" page.
|
|
13994
|
-
*/
|
|
13995
|
-
/**
|
|
13996
|
-
* Zentik-derived typed-media enum — the superset across every kind. Each
|
|
13997
|
-
* adapter picks what it supports and the degrade engine filters the rest.
|
|
13998
|
-
*/
|
|
13999
|
-
var AttachmentMediaTypeSchema = _enum([
|
|
14000
|
-
"image",
|
|
14001
|
-
"video",
|
|
14002
|
-
"gif",
|
|
14003
|
-
"audio",
|
|
14004
|
-
"icon"
|
|
14005
|
-
]);
|
|
14006
|
-
/**
|
|
14007
|
-
* A single attachment. Exactly one of `url` (remote source, most adapters
|
|
14008
|
-
* prefer this) or `bytes` (inline source; required for Pushover-style
|
|
14009
|
-
* bytes-only kinds) MUST be present — the degrade engine expresses a
|
|
14010
|
-
* url→bytes fetch as a `needsFetch` directive the adapter executes.
|
|
14011
|
-
*/
|
|
14012
|
-
var AttachmentSchema = object({
|
|
14013
|
-
mediaType: AttachmentMediaTypeSchema,
|
|
14014
|
-
url: string().optional(),
|
|
14015
|
-
bytes: _instanceof(Uint8Array).optional(),
|
|
14016
|
-
mime: string().optional(),
|
|
14017
|
-
name: string().optional()
|
|
14018
|
-
}).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
|
|
14019
|
-
var NotificationFormatSchema = _enum([
|
|
14020
|
-
"text",
|
|
14021
|
-
"markdown",
|
|
14022
|
-
"html"
|
|
14023
|
-
]);
|
|
13929
|
+
//#region ../types/dist/convert-BAzH15HU.mjs
|
|
14024
13930
|
/**
|
|
14025
|
-
*
|
|
14026
|
-
*
|
|
14027
|
-
*
|
|
14028
|
-
*
|
|
14029
|
-
* notices — the same class of gap as a zone vocabulary nothing produced
|
|
14030
|
-
* ([D35](../../../docs/decisions/adr-0035.md)). Every adapter maps this set or
|
|
14031
|
-
* declares `actionIcons: false` and the degrade engine strips the field.
|
|
14032
|
-
*
|
|
14033
|
-
* Named by INTENT, never by glyph. "check" would tie the vocabulary to one
|
|
14034
|
-
* renderer's icon set; "acknowledge" survives an adapter that draws it
|
|
14035
|
-
* differently.
|
|
14036
|
-
*
|
|
14037
|
-
* ── A TOKEN IS NOT A WIRE VALUE ─────────────────────────────────────
|
|
14038
|
-
*
|
|
14039
|
-
* These names are for US. **No adapter may forward one verbatim.** Each maps
|
|
14040
|
-
* the whole set onto its own renderer's vocabulary through a
|
|
14041
|
-
* `Record<NotificationActionIcon, string>` — a Record, never a lookup with a
|
|
14042
|
-
* fallback, so adding a member here fails every adapter's build until someone
|
|
14043
|
-
* decides its glyph, which is the only place that decision can be made
|
|
14044
|
-
* honestly.
|
|
14045
|
-
*
|
|
14046
|
-
* This paragraph is the bug. Zentik declared `actionIcons: true` and passed
|
|
14047
|
-
* `disarm` straight through; iOS feeds that string to
|
|
14048
|
-
* `UNNotificationActionIcon(systemImageName:)`, `disarm` is not an SF Symbol,
|
|
14049
|
-
* and every snooze and alarm button arrived BLANK. A pass-through is not a
|
|
14050
|
-
* mapping, and "the field is documented" is not "the value renders".
|
|
14051
|
-
*
|
|
14052
|
-
* Adding a member is TRAIN-BOUND. The enum lives in the published
|
|
14053
|
-
* `@camstack/server` closure and the cap seam validates against the HUB's copy,
|
|
14054
|
-
* so an addon that emits a token the running hub does not know does not lose an
|
|
14055
|
-
* icon — its whole `send` fails Zod validation and the notification never
|
|
14056
|
-
* arrives. Never emit a new token from an addon before the train carrying it.
|
|
13931
|
+
* Frozen unit → spec table. `•` in the doc marks each dimension's canonical
|
|
13932
|
+
* unit (`factor: 1, offset: 0`). °F derives from `°C = (°F − 32) × 5/9` ⇒
|
|
13933
|
+
* `factor = 5/9`, `offset = -160/9` (kept as exact expressions, not rounded
|
|
13934
|
+
* decimals). K derives from `°C = K − 273.15`.
|
|
14057
13935
|
*/
|
|
14058
|
-
var
|
|
14059
|
-
"
|
|
14060
|
-
|
|
14061
|
-
|
|
14062
|
-
|
|
14063
|
-
|
|
14064
|
-
"
|
|
14065
|
-
|
|
14066
|
-
|
|
14067
|
-
|
|
14068
|
-
|
|
14069
|
-
|
|
14070
|
-
|
|
14071
|
-
|
|
14072
|
-
|
|
14073
|
-
|
|
14074
|
-
|
|
14075
|
-
|
|
14076
|
-
|
|
14077
|
-
|
|
14078
|
-
|
|
14079
|
-
|
|
14080
|
-
|
|
14081
|
-
|
|
14082
|
-
|
|
14083
|
-
|
|
14084
|
-
|
|
14085
|
-
|
|
14086
|
-
|
|
14087
|
-
|
|
14088
|
-
|
|
14089
|
-
|
|
14090
|
-
|
|
14091
|
-
|
|
14092
|
-
|
|
14093
|
-
|
|
14094
|
-
|
|
14095
|
-
|
|
14096
|
-
|
|
14097
|
-
|
|
14098
|
-
|
|
14099
|
-
|
|
14100
|
-
|
|
14101
|
-
|
|
14102
|
-
|
|
14103
|
-
|
|
14104
|
-
|
|
14105
|
-
|
|
14106
|
-
|
|
14107
|
-
|
|
14108
|
-
|
|
14109
|
-
|
|
14110
|
-
|
|
14111
|
-
|
|
14112
|
-
|
|
14113
|
-
|
|
14114
|
-
|
|
14115
|
-
|
|
14116
|
-
|
|
14117
|
-
|
|
14118
|
-
|
|
14119
|
-
|
|
14120
|
-
|
|
14121
|
-
|
|
14122
|
-
|
|
14123
|
-
|
|
14124
|
-
|
|
14125
|
-
|
|
14126
|
-
|
|
14127
|
-
|
|
14128
|
-
|
|
14129
|
-
|
|
14130
|
-
|
|
14131
|
-
|
|
14132
|
-
|
|
14133
|
-
|
|
14134
|
-
|
|
14135
|
-
|
|
14136
|
-
|
|
14137
|
-
|
|
14138
|
-
|
|
14139
|
-
|
|
14140
|
-
|
|
14141
|
-
|
|
14142
|
-
|
|
14143
|
-
|
|
14144
|
-
|
|
14145
|
-
|
|
14146
|
-
|
|
13936
|
+
var UNIT_TABLE = {
|
|
13937
|
+
"°C": {
|
|
13938
|
+
dimension: "temperature",
|
|
13939
|
+
factor: 1,
|
|
13940
|
+
offset: 0
|
|
13941
|
+
},
|
|
13942
|
+
"°F": {
|
|
13943
|
+
dimension: "temperature",
|
|
13944
|
+
factor: 5 / 9,
|
|
13945
|
+
offset: -160 / 9
|
|
13946
|
+
},
|
|
13947
|
+
K: {
|
|
13948
|
+
dimension: "temperature",
|
|
13949
|
+
factor: 1,
|
|
13950
|
+
offset: -273.15
|
|
13951
|
+
},
|
|
13952
|
+
hPa: {
|
|
13953
|
+
dimension: "pressure",
|
|
13954
|
+
factor: 1,
|
|
13955
|
+
offset: 0
|
|
13956
|
+
},
|
|
13957
|
+
kPa: {
|
|
13958
|
+
dimension: "pressure",
|
|
13959
|
+
factor: 10,
|
|
13960
|
+
offset: 0
|
|
13961
|
+
},
|
|
13962
|
+
Pa: {
|
|
13963
|
+
dimension: "pressure",
|
|
13964
|
+
factor: .01,
|
|
13965
|
+
offset: 0
|
|
13966
|
+
},
|
|
13967
|
+
mbar: {
|
|
13968
|
+
dimension: "pressure",
|
|
13969
|
+
factor: 1,
|
|
13970
|
+
offset: 0
|
|
13971
|
+
},
|
|
13972
|
+
bar: {
|
|
13973
|
+
dimension: "pressure",
|
|
13974
|
+
factor: 1e3,
|
|
13975
|
+
offset: 0
|
|
13976
|
+
},
|
|
13977
|
+
inHg: {
|
|
13978
|
+
dimension: "pressure",
|
|
13979
|
+
factor: 33.8639,
|
|
13980
|
+
offset: 0
|
|
13981
|
+
},
|
|
13982
|
+
mmHg: {
|
|
13983
|
+
dimension: "pressure",
|
|
13984
|
+
factor: 1.33322,
|
|
13985
|
+
offset: 0
|
|
13986
|
+
},
|
|
13987
|
+
psi: {
|
|
13988
|
+
dimension: "pressure",
|
|
13989
|
+
factor: 68.9476,
|
|
13990
|
+
offset: 0
|
|
13991
|
+
},
|
|
13992
|
+
"m/s": {
|
|
13993
|
+
dimension: "speed",
|
|
13994
|
+
factor: 1,
|
|
13995
|
+
offset: 0
|
|
13996
|
+
},
|
|
13997
|
+
"km/h": {
|
|
13998
|
+
dimension: "speed",
|
|
13999
|
+
factor: 1 / 3.6,
|
|
14000
|
+
offset: 0
|
|
14001
|
+
},
|
|
14002
|
+
mph: {
|
|
14003
|
+
dimension: "speed",
|
|
14004
|
+
factor: .44704,
|
|
14005
|
+
offset: 0
|
|
14006
|
+
},
|
|
14007
|
+
kn: {
|
|
14008
|
+
dimension: "speed",
|
|
14009
|
+
factor: .514444,
|
|
14010
|
+
offset: 0
|
|
14011
|
+
},
|
|
14012
|
+
"mm/h": {
|
|
14013
|
+
dimension: "precipitation-rate",
|
|
14014
|
+
factor: 1,
|
|
14015
|
+
offset: 0
|
|
14016
|
+
},
|
|
14017
|
+
"in/h": {
|
|
14018
|
+
dimension: "precipitation-rate",
|
|
14019
|
+
factor: 25.4,
|
|
14020
|
+
offset: 0
|
|
14021
|
+
},
|
|
14022
|
+
m: {
|
|
14023
|
+
dimension: "length",
|
|
14024
|
+
factor: 1,
|
|
14025
|
+
offset: 0
|
|
14026
|
+
},
|
|
14027
|
+
mm: {
|
|
14028
|
+
dimension: "length",
|
|
14029
|
+
factor: .001,
|
|
14030
|
+
offset: 0
|
|
14031
|
+
},
|
|
14032
|
+
cm: {
|
|
14033
|
+
dimension: "length",
|
|
14034
|
+
factor: .01,
|
|
14035
|
+
offset: 0
|
|
14036
|
+
},
|
|
14037
|
+
km: {
|
|
14038
|
+
dimension: "length",
|
|
14039
|
+
factor: 1e3,
|
|
14040
|
+
offset: 0
|
|
14041
|
+
},
|
|
14042
|
+
in: {
|
|
14043
|
+
dimension: "length",
|
|
14044
|
+
factor: .0254,
|
|
14045
|
+
offset: 0
|
|
14046
|
+
},
|
|
14047
|
+
ft: {
|
|
14048
|
+
dimension: "length",
|
|
14049
|
+
factor: .3048,
|
|
14050
|
+
offset: 0
|
|
14051
|
+
},
|
|
14052
|
+
mi: {
|
|
14053
|
+
dimension: "length",
|
|
14054
|
+
factor: 1609.344,
|
|
14055
|
+
offset: 0
|
|
14056
|
+
},
|
|
14057
|
+
"m²": {
|
|
14058
|
+
dimension: "area",
|
|
14059
|
+
factor: 1,
|
|
14060
|
+
offset: 0
|
|
14061
|
+
},
|
|
14062
|
+
lx: {
|
|
14063
|
+
dimension: "illuminance",
|
|
14064
|
+
factor: 1,
|
|
14065
|
+
offset: 0
|
|
14066
|
+
},
|
|
14067
|
+
"W/m²": {
|
|
14068
|
+
dimension: "irradiance",
|
|
14069
|
+
factor: 1,
|
|
14070
|
+
offset: 0
|
|
14071
|
+
},
|
|
14072
|
+
W: {
|
|
14073
|
+
dimension: "power",
|
|
14074
|
+
factor: 1,
|
|
14075
|
+
offset: 0
|
|
14076
|
+
},
|
|
14077
|
+
kW: {
|
|
14078
|
+
dimension: "power",
|
|
14079
|
+
factor: 1e3,
|
|
14080
|
+
offset: 0
|
|
14081
|
+
},
|
|
14082
|
+
VA: {
|
|
14083
|
+
dimension: "apparent-power",
|
|
14084
|
+
factor: 1,
|
|
14085
|
+
offset: 0
|
|
14086
|
+
},
|
|
14087
|
+
Wh: {
|
|
14088
|
+
dimension: "energy",
|
|
14089
|
+
factor: 1,
|
|
14090
|
+
offset: 0
|
|
14091
|
+
},
|
|
14092
|
+
kWh: {
|
|
14093
|
+
dimension: "energy",
|
|
14094
|
+
factor: 1e3,
|
|
14095
|
+
offset: 0
|
|
14096
|
+
},
|
|
14097
|
+
MWh: {
|
|
14098
|
+
dimension: "energy",
|
|
14099
|
+
factor: 1e6,
|
|
14100
|
+
offset: 0
|
|
14101
|
+
},
|
|
14102
|
+
V: {
|
|
14103
|
+
dimension: "voltage",
|
|
14104
|
+
factor: 1,
|
|
14105
|
+
offset: 0
|
|
14106
|
+
},
|
|
14107
|
+
mV: {
|
|
14108
|
+
dimension: "voltage",
|
|
14109
|
+
factor: .001,
|
|
14110
|
+
offset: 0
|
|
14111
|
+
},
|
|
14112
|
+
A: {
|
|
14113
|
+
dimension: "current",
|
|
14114
|
+
factor: 1,
|
|
14115
|
+
offset: 0
|
|
14116
|
+
},
|
|
14117
|
+
mA: {
|
|
14118
|
+
dimension: "current",
|
|
14119
|
+
factor: .001,
|
|
14120
|
+
offset: 0
|
|
14121
|
+
},
|
|
14122
|
+
ppm: {
|
|
14123
|
+
dimension: "concentration-volume",
|
|
14124
|
+
factor: 1,
|
|
14125
|
+
offset: 0
|
|
14126
|
+
},
|
|
14127
|
+
ppb: {
|
|
14128
|
+
dimension: "concentration-volume",
|
|
14129
|
+
factor: .001,
|
|
14130
|
+
offset: 0
|
|
14131
|
+
},
|
|
14132
|
+
"µg/m³": {
|
|
14133
|
+
dimension: "concentration-mass",
|
|
14134
|
+
factor: 1,
|
|
14135
|
+
offset: 0
|
|
14136
|
+
},
|
|
14137
|
+
"mg/m³": {
|
|
14138
|
+
dimension: "concentration-mass",
|
|
14139
|
+
factor: 1e3,
|
|
14140
|
+
offset: 0
|
|
14141
|
+
},
|
|
14142
|
+
kg: {
|
|
14143
|
+
dimension: "mass",
|
|
14144
|
+
factor: 1,
|
|
14145
|
+
offset: 0
|
|
14146
|
+
},
|
|
14147
|
+
g: {
|
|
14148
|
+
dimension: "mass",
|
|
14149
|
+
factor: .001,
|
|
14150
|
+
offset: 0
|
|
14151
|
+
},
|
|
14152
|
+
lb: {
|
|
14153
|
+
dimension: "mass",
|
|
14154
|
+
factor: .453592,
|
|
14155
|
+
offset: 0
|
|
14156
|
+
},
|
|
14157
|
+
oz: {
|
|
14158
|
+
dimension: "mass",
|
|
14159
|
+
factor: .0283495,
|
|
14160
|
+
offset: 0
|
|
14161
|
+
},
|
|
14162
|
+
"%": {
|
|
14163
|
+
dimension: "percentage",
|
|
14164
|
+
factor: 1,
|
|
14165
|
+
offset: 0
|
|
14166
|
+
},
|
|
14167
|
+
L: {
|
|
14168
|
+
dimension: "volume",
|
|
14169
|
+
factor: 1,
|
|
14170
|
+
offset: 0
|
|
14171
|
+
},
|
|
14172
|
+
mL: {
|
|
14173
|
+
dimension: "volume",
|
|
14174
|
+
factor: .001,
|
|
14175
|
+
offset: 0
|
|
14176
|
+
},
|
|
14177
|
+
gal: {
|
|
14178
|
+
dimension: "volume",
|
|
14179
|
+
factor: 3.785411784,
|
|
14180
|
+
offset: 0
|
|
14181
|
+
},
|
|
14182
|
+
s: {
|
|
14183
|
+
dimension: "duration",
|
|
14184
|
+
factor: 1,
|
|
14185
|
+
offset: 0
|
|
14186
|
+
},
|
|
14187
|
+
ms: {
|
|
14188
|
+
dimension: "duration",
|
|
14189
|
+
factor: .001,
|
|
14190
|
+
offset: 0
|
|
14191
|
+
},
|
|
14192
|
+
min: {
|
|
14193
|
+
dimension: "duration",
|
|
14194
|
+
factor: 60,
|
|
14195
|
+
offset: 0
|
|
14196
|
+
},
|
|
14197
|
+
h: {
|
|
14198
|
+
dimension: "duration",
|
|
14199
|
+
factor: 3600,
|
|
14200
|
+
offset: 0
|
|
14201
|
+
},
|
|
14202
|
+
d: {
|
|
14203
|
+
dimension: "duration",
|
|
14204
|
+
factor: 86400,
|
|
14205
|
+
offset: 0
|
|
14206
|
+
},
|
|
14207
|
+
B: {
|
|
14208
|
+
dimension: "information",
|
|
14209
|
+
factor: 1,
|
|
14210
|
+
offset: 0
|
|
14211
|
+
},
|
|
14212
|
+
KiB: {
|
|
14213
|
+
dimension: "information",
|
|
14214
|
+
factor: 1024,
|
|
14215
|
+
offset: 0
|
|
14216
|
+
},
|
|
14217
|
+
MiB: {
|
|
14218
|
+
dimension: "information",
|
|
14219
|
+
factor: 1024 ** 2,
|
|
14220
|
+
offset: 0
|
|
14221
|
+
},
|
|
14222
|
+
GiB: {
|
|
14223
|
+
dimension: "information",
|
|
14224
|
+
factor: 1024 ** 3,
|
|
14225
|
+
offset: 0
|
|
14226
|
+
},
|
|
14227
|
+
TiB: {
|
|
14228
|
+
dimension: "information",
|
|
14229
|
+
factor: 1024 ** 4,
|
|
14230
|
+
offset: 0
|
|
14231
|
+
},
|
|
14232
|
+
kB: {
|
|
14233
|
+
dimension: "information",
|
|
14234
|
+
factor: 1e3,
|
|
14235
|
+
offset: 0
|
|
14236
|
+
},
|
|
14237
|
+
MB: {
|
|
14238
|
+
dimension: "information",
|
|
14239
|
+
factor: 1e6,
|
|
14240
|
+
offset: 0
|
|
14241
|
+
},
|
|
14242
|
+
GB: {
|
|
14243
|
+
dimension: "information",
|
|
14244
|
+
factor: 1e9,
|
|
14245
|
+
offset: 0
|
|
14246
|
+
},
|
|
14247
|
+
"°": {
|
|
14248
|
+
dimension: "angle",
|
|
14249
|
+
factor: 1,
|
|
14250
|
+
offset: 0
|
|
14251
|
+
},
|
|
14252
|
+
dBFS: {
|
|
14253
|
+
dimension: "sound-level",
|
|
14254
|
+
factor: 1,
|
|
14255
|
+
offset: 0
|
|
14256
|
+
},
|
|
14257
|
+
dBm: {
|
|
14258
|
+
dimension: "signal-level",
|
|
14259
|
+
factor: 1,
|
|
14260
|
+
offset: 0
|
|
14261
|
+
},
|
|
14262
|
+
mired: {
|
|
14263
|
+
dimension: "colour-temperature",
|
|
14264
|
+
factor: 1,
|
|
14265
|
+
offset: 0
|
|
14266
|
+
},
|
|
14267
|
+
kbps: {
|
|
14268
|
+
dimension: "bitrate",
|
|
14269
|
+
factor: 1,
|
|
14270
|
+
offset: 0
|
|
14271
|
+
},
|
|
14272
|
+
Mbps: {
|
|
14273
|
+
dimension: "bitrate",
|
|
14274
|
+
factor: 1e3,
|
|
14275
|
+
offset: 0
|
|
14276
|
+
},
|
|
14277
|
+
fps: {
|
|
14278
|
+
dimension: "rate",
|
|
14279
|
+
factor: 1,
|
|
14280
|
+
offset: 0
|
|
14281
|
+
}
|
|
14282
|
+
};
|
|
14283
|
+
/** Resolve a unit's `UnitSpec`, or `undefined` when the spelling is unknown. */
|
|
14284
|
+
function specFor(unit) {
|
|
14285
|
+
return Object.hasOwn(UNIT_TABLE, unit) ? UNIT_TABLE[unit] : void 0;
|
|
14286
|
+
}
|
|
14287
|
+
/** The dimension a unit belongs to, or `undefined` for an unknown unit. */
|
|
14288
|
+
function unitDimension(unit) {
|
|
14289
|
+
return specFor(unit)?.dimension;
|
|
14290
|
+
}
|
|
14291
|
+
/** Value in `spec`'s unit → its dimension's canonical unit. */
|
|
14292
|
+
function toCanonical(value, spec) {
|
|
14293
|
+
return value * spec.factor + spec.offset;
|
|
14294
|
+
}
|
|
14295
|
+
/** Canonical-unit value → the unit described by `spec`. */
|
|
14296
|
+
function fromCanonical(canonical, spec) {
|
|
14297
|
+
return (canonical - spec.offset) / spec.factor;
|
|
14298
|
+
}
|
|
14147
14299
|
/**
|
|
14148
|
-
*
|
|
14149
|
-
* `
|
|
14150
|
-
*
|
|
14151
|
-
* the adapter maps this ordinal onto its native level. `level?` is an
|
|
14152
|
-
* optional kind-native level id (`emergency`, `silent`, …) that overrides
|
|
14153
|
-
* `priority` for that one target.
|
|
14300
|
+
* Graceful variant for the render path: returns the converted value, or
|
|
14301
|
+
* `undefined` when the conversion is refused (unknown unit / cross-dimension).
|
|
14302
|
+
* Never throws — a render caller falls back to the raw value + source unit.
|
|
14154
14303
|
*/
|
|
14155
|
-
|
|
14156
|
-
|
|
14157
|
-
|
|
14158
|
-
|
|
14159
|
-
|
|
14160
|
-
|
|
14161
|
-
|
|
14162
|
-
|
|
14163
|
-
|
|
14164
|
-
|
|
14165
|
-
|
|
14166
|
-
|
|
14167
|
-
|
|
14168
|
-
|
|
14169
|
-
|
|
14170
|
-
|
|
14171
|
-
|
|
14172
|
-
|
|
14173
|
-
|
|
14174
|
-
|
|
14175
|
-
|
|
14304
|
+
function tryConvertUnit(value, from, to) {
|
|
14305
|
+
if (from === to) return value;
|
|
14306
|
+
const fromSpec = specFor(from);
|
|
14307
|
+
if (!fromSpec) return void 0;
|
|
14308
|
+
const toSpec = specFor(to);
|
|
14309
|
+
if (!toSpec) return void 0;
|
|
14310
|
+
if (fromSpec.dimension !== toSpec.dimension) return void 0;
|
|
14311
|
+
return fromCanonical(toCanonical(value, fromSpec), toSpec);
|
|
14312
|
+
}
|
|
14313
|
+
//#endregion
|
|
14314
|
+
//#region ../types/dist/index.mjs
|
|
14315
|
+
var SMTP_INBOUND_DEFAULT_PORT = 2525;
|
|
14316
|
+
var SMTP_INBOUND_DEFAULT_DOMAIN = "camstack.local";
|
|
14317
|
+
var SMTP_INBOUND_DEFAULT_MAX_MESSAGE_BYTES = 25 * 1024 * 1024;
|
|
14318
|
+
/** The text excerpt a message carries on the bus. */
|
|
14319
|
+
var SMTP_INBOUND_TEXT_MAX_CHARS = 4096;
|
|
14320
|
+
var PortSchema = number().int().min(1).max(65535);
|
|
14321
|
+
/** A recipient local-part: what stands before the `@`. */
|
|
14322
|
+
var SmtpRecipientSchema = string().min(1).max(64).regex(/^[A-Za-z0-9._+-]+$/);
|
|
14323
|
+
object({
|
|
14324
|
+
port: PortSchema.default(SMTP_INBOUND_DEFAULT_PORT),
|
|
14325
|
+
bindHost: string().min(1).default("0.0.0.0"),
|
|
14326
|
+
domain: string().min(1).default(SMTP_INBOUND_DEFAULT_DOMAIN),
|
|
14327
|
+
requireAuth: boolean().default(true),
|
|
14328
|
+
username: string().default(""),
|
|
14329
|
+
password: string().default("").meta({ secret: true }),
|
|
14330
|
+
starttls: boolean().default(false),
|
|
14331
|
+
maxMessageBytes: number().int().positive().default(SMTP_INBOUND_DEFAULT_MAX_MESSAGE_BYTES)
|
|
14176
14332
|
});
|
|
14177
|
-
|
|
14178
|
-
|
|
14179
|
-
|
|
14180
|
-
|
|
14181
|
-
|
|
14182
|
-
|
|
14183
|
-
|
|
14184
|
-
|
|
14185
|
-
|
|
14186
|
-
noPush: boolean().optional()
|
|
14187
|
-
}).optional(),
|
|
14188
|
-
/** e.g. Pushover `emergency` requires `retry` / `expire`. */
|
|
14189
|
-
requires: array(string()).optional(),
|
|
14190
|
-
description: string().optional()
|
|
14333
|
+
object({
|
|
14334
|
+
host: string().min(1).nullable(),
|
|
14335
|
+
hostReason: string().nullable(),
|
|
14336
|
+
port: PortSchema,
|
|
14337
|
+
domain: string().min(1),
|
|
14338
|
+
requireAuth: boolean(),
|
|
14339
|
+
username: string(),
|
|
14340
|
+
password: string(),
|
|
14341
|
+
starttls: boolean()
|
|
14191
14342
|
});
|
|
14192
|
-
|
|
14193
|
-
|
|
14194
|
-
attachments: object({
|
|
14195
|
-
mediaTypes: array(AttachmentMediaTypeSchema),
|
|
14196
|
-
mode: _enum([
|
|
14197
|
-
"url",
|
|
14198
|
-
"bytes",
|
|
14199
|
-
"both"
|
|
14200
|
-
]),
|
|
14201
|
-
max: number().int().nonnegative(),
|
|
14202
|
-
maxBytes: number().int().positive().optional()
|
|
14203
|
-
}),
|
|
14204
|
-
/** Max action buttons (0 = none). */
|
|
14205
|
-
actions: number().int().nonnegative(),
|
|
14343
|
+
object({
|
|
14344
|
+
recipients: array(SmtpRecipientSchema).min(1),
|
|
14206
14345
|
/**
|
|
14207
|
-
*
|
|
14208
|
-
*
|
|
14209
|
-
*
|
|
14210
|
-
*
|
|
14211
|
-
* this repo that once. Absent is read as false by the degrade engine, which
|
|
14212
|
-
* is the safe direction: an icon that is not rendered costs nothing, an icon
|
|
14213
|
-
* assumed and dropped costs the operator's trust in the field.
|
|
14346
|
+
* Who is subscribing. A second `subscribe` with the same id REPLACES that subscriber's
|
|
14347
|
+
* recipients (the way a consumer that restarted, or lost a device, declares its set again);
|
|
14348
|
+
* a recipient held by another subscriber is refused with `smtp-inbound/recipient-claimed`.
|
|
14349
|
+
* Absent, the subscriber is anonymous and unique.
|
|
14214
14350
|
*/
|
|
14215
|
-
|
|
14216
|
-
levels: array(TargetKindLevelSchema),
|
|
14217
|
-
format: array(NotificationFormatSchema),
|
|
14218
|
-
clickUrl: boolean(),
|
|
14219
|
-
sound: boolean(),
|
|
14220
|
-
ttl: boolean(),
|
|
14221
|
-
bodyMaxLen: number().int().positive()
|
|
14351
|
+
subscriberId: string().min(1).max(64).optional()
|
|
14222
14352
|
});
|
|
14223
|
-
|
|
14224
|
-
|
|
14225
|
-
|
|
14226
|
-
|
|
14227
|
-
|
|
14353
|
+
var SmtpInboundAttachmentSchema = object({
|
|
14354
|
+
filename: string(),
|
|
14355
|
+
contentType: string(),
|
|
14356
|
+
bytes: number().int().nonnegative()
|
|
14357
|
+
});
|
|
14358
|
+
/** The payload of one `broker.message` (the key is the recipient local-part). */
|
|
14359
|
+
var SmtpInboundMessageSchema = object({
|
|
14360
|
+
/** Monotonic per mailbox; a gap tells a consumer it missed an event. */
|
|
14361
|
+
seq: number().int().positive(),
|
|
14362
|
+
messageId: string(),
|
|
14363
|
+
receivedAt: number().int().nonnegative(),
|
|
14364
|
+
from: string(),
|
|
14365
|
+
to: string(),
|
|
14366
|
+
subject: string(),
|
|
14367
|
+
text: string().max(SMTP_INBOUND_TEXT_MAX_CHARS),
|
|
14368
|
+
attachments: array(SmtpInboundAttachmentSchema)
|
|
14369
|
+
});
|
|
14370
|
+
object({
|
|
14371
|
+
/** The newest seq issued so far (0 before any mail). */
|
|
14372
|
+
lastSeq: number().int().nonnegative(),
|
|
14373
|
+
/** The oldest seq still retained; messages below it are gone. */
|
|
14374
|
+
oldestSeq: number().int().nonnegative(),
|
|
14375
|
+
messages: array(object({
|
|
14376
|
+
key: string(),
|
|
14377
|
+
message: SmtpInboundMessageSchema
|
|
14378
|
+
}))
|
|
14379
|
+
});
|
|
14380
|
+
new Set([
|
|
14381
|
+
"track",
|
|
14382
|
+
"face",
|
|
14383
|
+
"identity",
|
|
14384
|
+
"plate",
|
|
14385
|
+
"vehicle",
|
|
14386
|
+
"scene",
|
|
14387
|
+
"motion",
|
|
14388
|
+
"object",
|
|
14389
|
+
"audio",
|
|
14390
|
+
"mosaic"
|
|
14391
|
+
]);
|
|
14392
|
+
/**
|
|
14393
|
+
* The owner types that are event tables, in the order the event-media resolver
|
|
14394
|
+
* should consider them. Exported so a consumer asking "is this key an event?"
|
|
14395
|
+
* does not re-spell the list and drift from it.
|
|
14396
|
+
*/
|
|
14397
|
+
var EVENT_OWNER_TYPES = [
|
|
14398
|
+
"motion",
|
|
14399
|
+
"object",
|
|
14400
|
+
"audio"
|
|
14401
|
+
];
|
|
14402
|
+
/**
|
|
14403
|
+
* The same list as a Zod enum, for the cap inputs that must NAME the table
|
|
14404
|
+
* (D482: `getEventMedia` / `listEventMedia` take an owner, and an owner is
|
|
14405
|
+
* `(table, id)`).
|
|
14406
|
+
*
|
|
14407
|
+
* Built FROM {@link EVENT_OWNER_TYPES} rather than re-spelled: a fourth event
|
|
14408
|
+
* table would otherwise be accepted by the codec and refused at the door, with
|
|
14409
|
+
* nothing failing until a caller asked.
|
|
14410
|
+
*/
|
|
14411
|
+
var EventOwnerTypeSchema = _enum(EVENT_OWNER_TYPES);
|
|
14412
|
+
/** The same list as a Zod enum, for the cap input that carries it. */
|
|
14413
|
+
var MediaPresenceOwnerKindSchema = _enum([...EVENT_OWNER_TYPES, "track"]);
|
|
14414
|
+
new Set(EVENT_OWNER_TYPES);
|
|
14415
|
+
/**
|
|
14416
|
+
* What a published package needs from the rest of the install (D989).
|
|
14417
|
+
*
|
|
14418
|
+
* One published framework package (`@camstack/server`) carries the kernel, the
|
|
14419
|
+
* builtins and the capability contracts, so "which addon runs on which
|
|
14420
|
+
* framework" is a question of version, and the answer is DECLARED by the
|
|
14421
|
+
* package that knows it:
|
|
14422
|
+
*
|
|
14423
|
+
* - an addon says the oldest server it runs on (`requires.server: ">=X"`);
|
|
14424
|
+
* - the server says the oldest addon it works with
|
|
14425
|
+
* (`requires.addons: { "@camstack/addon-x": ">=Y" }`) and the oldest shell
|
|
14426
|
+
* around it (`requires.wrapper: { desktop, image }`);
|
|
14427
|
+
* - a wrapper (the desktop app, the container starter) says which server
|
|
14428
|
+
* range it can host, and reports its own kind and version.
|
|
14429
|
+
*
|
|
14430
|
+
* The publish workflow STAMPS these after the version bump
|
|
14431
|
+
* (`scripts/ci/stamp-requires.mjs`); nobody types a number by hand.
|
|
14432
|
+
*
|
|
14433
|
+
* A requirement that cannot be checked is NOT met: a shell that reports no
|
|
14434
|
+
* version counts as below the minimum, and an unreadable running version is
|
|
14435
|
+
* named in the result (a failed read is never a pass).
|
|
14436
|
+
*/
|
|
14437
|
+
/** `>=MAJOR.MINOR.PATCH[-prerelease]` — the only range shape a requirement uses. */
|
|
14438
|
+
var MinVersionSchema = string().regex(/^>=\d+\.\d+\.\d+(-[0-9A-Za-z.-]+)?$/, "a minimum is written \">=X.Y.Z\"");
|
|
14439
|
+
object({
|
|
14440
|
+
/** The oldest `@camstack/server` this package runs on. */
|
|
14441
|
+
server: MinVersionSchema.optional(),
|
|
14442
|
+
/** The oldest installed version of each named addon package. */
|
|
14443
|
+
addons: record(string(), MinVersionSchema).optional(),
|
|
14444
|
+
/** The oldest shell around the server, per shell kind. */
|
|
14445
|
+
wrapper: object({
|
|
14446
|
+
desktop: MinVersionSchema.optional(),
|
|
14447
|
+
image: MinVersionSchema.optional()
|
|
14448
|
+
}).optional()
|
|
14449
|
+
});
|
|
14450
|
+
/** One unmet requirement; each names the versions on both sides. */
|
|
14451
|
+
var UnmetRequirementSchema = discriminatedUnion("kind", [
|
|
14452
|
+
object({
|
|
14453
|
+
kind: literal("server-too-old"),
|
|
14454
|
+
required: string(),
|
|
14455
|
+
/** `null` — the running server version could not be read. */
|
|
14456
|
+
running: string().nullable()
|
|
14457
|
+
}),
|
|
14458
|
+
object({
|
|
14459
|
+
kind: literal("addon-too-old"),
|
|
14460
|
+
packageName: string(),
|
|
14461
|
+
required: string(),
|
|
14462
|
+
/** `null` — the addon is not installed (or its version is unreadable). */
|
|
14463
|
+
running: string().nullable()
|
|
14464
|
+
}),
|
|
14465
|
+
object({
|
|
14466
|
+
kind: literal("wrapper-too-old"),
|
|
14467
|
+
wrapper: _enum(["desktop", "image"]),
|
|
14468
|
+
required: string(),
|
|
14469
|
+
/** `null` — the wrapper reported no version. */
|
|
14470
|
+
running: string().nullable()
|
|
14471
|
+
})
|
|
14472
|
+
]);
|
|
14473
|
+
var RequiredAddonUpdateSchema = object({
|
|
14474
|
+
packageName: string(),
|
|
14475
|
+
/** The minimum the target server declares. */
|
|
14476
|
+
required: string(),
|
|
14477
|
+
/** What this node has; `null` when the addon is not installed. */
|
|
14478
|
+
installed: string().nullable()
|
|
14479
|
+
});
|
|
14480
|
+
/**
|
|
14481
|
+
* Which integration instance a settings form is for. An addon that serves several instances
|
|
14482
|
+
* (`instanceMode: multiple`) can show a different form per instance — an NVR integration
|
|
14483
|
+
* needs its connection, the default integration needs the addon's own sections.
|
|
14484
|
+
*
|
|
14485
|
+
* - `integrationId` is `null` in the create wizard: nothing exists yet, the operator is
|
|
14486
|
+
* setting up a NEW instance.
|
|
14487
|
+
* - `mode` is the wizard mode of the integration type (`getAvailableTypes`).
|
|
14488
|
+
* - `candidateStableId` is the discovery candidate a wizard was seeded from, if any.
|
|
14489
|
+
*/
|
|
14490
|
+
var IntegrationInstanceRefSchema = object({
|
|
14491
|
+
integrationId: string().nullable(),
|
|
14492
|
+
mode: _enum([
|
|
14493
|
+
"standalone",
|
|
14494
|
+
"account",
|
|
14495
|
+
"broker"
|
|
14496
|
+
]),
|
|
14497
|
+
candidateStableId: string().optional()
|
|
14498
|
+
});
|
|
14499
|
+
/**
|
|
14500
|
+
* notification-output — canonical, capability-gated notification delivery.
|
|
14501
|
+
*
|
|
14502
|
+
* Apprise-derived model (see
|
|
14503
|
+
* `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
|
|
14504
|
+
* callers emit ONE canonical `Notification`; each provider declares a
|
|
14505
|
+
* per-kind capability descriptor (`TargetKind`), and the pure degrade
|
|
14506
|
+
* engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
|
|
14507
|
+
* message to what the kind supports — callers never special-case a service.
|
|
14508
|
+
*
|
|
14509
|
+
* DESIGN DECISIONS (locked):
|
|
14510
|
+
* - A target is an INSTANCE of this function cap (epic #440, step 6): the
|
|
14511
|
+
* providers serve their targets as `integration-instances` records, one
|
|
14512
|
+
* record kind per target kind, and the admin lists, adds, edits, switches
|
|
14513
|
+
* and deletes them through that cap. This cap keeps what an instance cannot
|
|
14514
|
+
* say: the kind catalogue (`listTargetKinds`: capabilities, delivery
|
|
14515
|
+
* parameters, brand icon), dispatch (`send`, `testTarget`) and the form
|
|
14516
|
+
* helpers (`discoverTargets`, `probeTargetConfig`).
|
|
14517
|
+
* - `listTargetKinds` / `discoverTargets` return arrays → the generated
|
|
14518
|
+
* cap-mount auto-`concatCollection`-fans them across every registered
|
|
14519
|
+
* provider so one catalog is routable. `send` / `testTarget` /
|
|
14520
|
+
* `probeTargetConfig` route to ONE provider by the `addonId` the generated
|
|
14521
|
+
* collection router extracts from the call input.
|
|
14522
|
+
* - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
|
|
14523
|
+
* transformer) + UDS MsgPack both round-trip typed arrays — already used by
|
|
14524
|
+
* `storage` / `storage-provider` / `recording` caps over the same path. No
|
|
14525
|
+
* base64 fallback needed.
|
|
14526
|
+
*
|
|
14527
|
+
* TODO (deferred, closed-set change — separate decision): add
|
|
14528
|
+
* `providerKind: 'notify'` so notification providers surface on the unified
|
|
14529
|
+
* admin "Integrations" page.
|
|
14530
|
+
*/
|
|
14531
|
+
/**
|
|
14532
|
+
* Zentik-derived typed-media enum — the superset across every kind. Each
|
|
14533
|
+
* adapter picks what it supports and the degrade engine filters the rest.
|
|
14534
|
+
*/
|
|
14535
|
+
var AttachmentMediaTypeSchema = _enum([
|
|
14536
|
+
"image",
|
|
14537
|
+
"video",
|
|
14538
|
+
"gif",
|
|
14539
|
+
"audio",
|
|
14540
|
+
"icon"
|
|
14541
|
+
]);
|
|
14542
|
+
/**
|
|
14543
|
+
* A single attachment. Exactly one of `url` (remote source, most adapters
|
|
14544
|
+
* prefer this) or `bytes` (inline source; required for Pushover-style
|
|
14545
|
+
* bytes-only kinds) MUST be present — the degrade engine expresses a
|
|
14546
|
+
* url→bytes fetch as a `needsFetch` directive the adapter executes.
|
|
14547
|
+
*/
|
|
14548
|
+
var AttachmentSchema = object({
|
|
14549
|
+
mediaType: AttachmentMediaTypeSchema,
|
|
14550
|
+
url: string().optional(),
|
|
14551
|
+
bytes: _instanceof(Uint8Array).optional(),
|
|
14552
|
+
mime: string().optional(),
|
|
14553
|
+
name: string().optional()
|
|
14554
|
+
}).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
|
|
14555
|
+
var NotificationFormatSchema = _enum([
|
|
14556
|
+
"text",
|
|
14557
|
+
"markdown",
|
|
14558
|
+
"html"
|
|
14559
|
+
]);
|
|
14560
|
+
/**
|
|
14561
|
+
* The CLOSED icon vocabulary an action button may use.
|
|
14562
|
+
*
|
|
14563
|
+
* A closed set, not a free string, and that is the whole point: an arbitrary
|
|
14564
|
+
* icon name is one that ntfy renders, zentik silently drops, and nobody
|
|
14565
|
+
* notices — the same class of gap as a zone vocabulary nothing produced
|
|
14566
|
+
* ([D35](../../../docs/decisions/adr-0035.md)). Every adapter maps this set or
|
|
14567
|
+
* declares `actionIcons: false` and the degrade engine strips the field.
|
|
14568
|
+
*
|
|
14569
|
+
* Named by INTENT, never by glyph. "check" would tie the vocabulary to one
|
|
14570
|
+
* renderer's icon set; "acknowledge" survives an adapter that draws it
|
|
14571
|
+
* differently.
|
|
14572
|
+
*
|
|
14573
|
+
* ── A TOKEN IS NOT A WIRE VALUE ─────────────────────────────────────
|
|
14574
|
+
*
|
|
14575
|
+
* These names are for US. **No adapter may forward one verbatim.** Each maps
|
|
14576
|
+
* the whole set onto its own renderer's vocabulary through a
|
|
14577
|
+
* `Record<NotificationActionIcon, string>` — a Record, never a lookup with a
|
|
14578
|
+
* fallback, so adding a member here fails every adapter's build until someone
|
|
14579
|
+
* decides its glyph, which is the only place that decision can be made
|
|
14580
|
+
* honestly.
|
|
14581
|
+
*
|
|
14582
|
+
* This paragraph is the bug. Zentik declared `actionIcons: true` and passed
|
|
14583
|
+
* `disarm` straight through; iOS feeds that string to
|
|
14584
|
+
* `UNNotificationActionIcon(systemImageName:)`, `disarm` is not an SF Symbol,
|
|
14585
|
+
* and every snooze and alarm button arrived BLANK. A pass-through is not a
|
|
14586
|
+
* mapping, and "the field is documented" is not "the value renders".
|
|
14587
|
+
*
|
|
14588
|
+
* Adding a member is TRAIN-BOUND. The enum lives in the published
|
|
14589
|
+
* `@camstack/server` closure and the cap seam validates against the HUB's copy,
|
|
14590
|
+
* so an addon that emits a token the running hub does not know does not lose an
|
|
14591
|
+
* icon — its whole `send` fails Zod validation and the notification never
|
|
14592
|
+
* arrives. Never emit a new token from an addon before the train carrying it.
|
|
14593
|
+
*/
|
|
14594
|
+
var NotificationActionIconSchema = _enum([
|
|
14595
|
+
"acknowledge",
|
|
14596
|
+
"dismiss",
|
|
14597
|
+
"silence",
|
|
14598
|
+
"snooze",
|
|
14599
|
+
"view",
|
|
14600
|
+
"play",
|
|
14601
|
+
"open",
|
|
14602
|
+
"close",
|
|
14603
|
+
"lock",
|
|
14604
|
+
"unlock",
|
|
14605
|
+
"arm",
|
|
14606
|
+
"arm-home",
|
|
14607
|
+
"arm-away",
|
|
14608
|
+
"arm-night",
|
|
14609
|
+
"disarm",
|
|
14610
|
+
"light",
|
|
14611
|
+
"alert",
|
|
14612
|
+
"camera"
|
|
14613
|
+
]);
|
|
14614
|
+
/** A single tap-through action button. */
|
|
14615
|
+
var NotificationActionSchema = object({
|
|
14616
|
+
id: string(),
|
|
14617
|
+
label: string(),
|
|
14618
|
+
url: string().optional(),
|
|
14619
|
+
/** Dropped by the degrade engine for a kind with `caps.actionIcons: false`. */
|
|
14620
|
+
icon: NotificationActionIconSchema.optional(),
|
|
14621
|
+
/**
|
|
14622
|
+
* Renders in a warning style where the notifier supports it.
|
|
14623
|
+
*
|
|
14624
|
+
* A HINT, never a gate. The callback's authority is its token and nothing
|
|
14625
|
+
* else — see `notification-center/action-token.ts` for what that does and
|
|
14626
|
+
* does not buy.
|
|
14627
|
+
*/
|
|
14628
|
+
destructive: boolean().optional(),
|
|
14629
|
+
/**
|
|
14630
|
+
* How the tap should REACH the url.
|
|
14631
|
+
*
|
|
14632
|
+
* `navigate` (absent, and every button authored before this field) opens it:
|
|
14633
|
+
* the phone leaves the notification and shows whatever the callback returns.
|
|
14634
|
+
* That is right for a button whose answer the operator wants to read.
|
|
14635
|
+
*
|
|
14636
|
+
* `background` fires it as a POST and stays put. It exists for the buttons
|
|
14637
|
+
* whose whole point is not to interrupt — "silence this for 30 minutes" is
|
|
14638
|
+
* an answer to the notification, and being thrown into a browser tab to
|
|
14639
|
+
* confirm it costs more attention than the notification did. A backend that
|
|
14640
|
+
* cannot do a background call renders it as an ordinary link (the adapters
|
|
14641
|
+
* fall back rather than dropping the button), so this is a preference, never
|
|
14642
|
+
* a requirement.
|
|
14643
|
+
*/
|
|
14644
|
+
mode: _enum(["navigate", "background"]).optional()
|
|
14645
|
+
});
|
|
14646
|
+
/** A delivery parameter value: what a notifier declared it takes. */
|
|
14647
|
+
var DeliveryParamValueSchema = union([
|
|
14648
|
+
string(),
|
|
14649
|
+
number(),
|
|
14650
|
+
boolean()
|
|
14651
|
+
]);
|
|
14652
|
+
/**
|
|
14653
|
+
* One extra delivery parameter a notifier KIND declares (D938). A rule that
|
|
14654
|
+
* addresses a target of that kind may set it; a kind that declares nothing is
|
|
14655
|
+
* never handed one. The admin UI derives its control from this descriptor —
|
|
14656
|
+
* no editor knows a service by name.
|
|
14657
|
+
*
|
|
14658
|
+
* Optional fields are `.optional()`, never `.default()` (a Zod default does not
|
|
14659
|
+
* run on the addon cap path).
|
|
14660
|
+
*/
|
|
14661
|
+
var DeliveryParamSchema = object({
|
|
14662
|
+
key: string().min(1),
|
|
14663
|
+
label: string(),
|
|
14664
|
+
/** i18n key of the label, resolved by the declaring addon's namespace. */
|
|
14665
|
+
labelKey: string().optional(),
|
|
14666
|
+
type: _enum([
|
|
14667
|
+
"enum",
|
|
14668
|
+
"number",
|
|
14669
|
+
"boolean",
|
|
14670
|
+
"string"
|
|
14671
|
+
]),
|
|
14672
|
+
/** `enum` only: the closed set of accepted values. */
|
|
14673
|
+
options: array(object({
|
|
14674
|
+
value: string(),
|
|
14675
|
+
label: string()
|
|
14676
|
+
})).optional(),
|
|
14677
|
+
/** `number` only. */
|
|
14678
|
+
min: number().optional(),
|
|
14679
|
+
max: number().optional(),
|
|
14680
|
+
/** What the notifier does when the rule sets nothing; shown as the placeholder. */
|
|
14681
|
+
default: DeliveryParamValueSchema.optional()
|
|
14682
|
+
});
|
|
14683
|
+
/**
|
|
14684
|
+
* The canonical notification. `body` is the only hard field (Apprise model).
|
|
14685
|
+
* `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
|
|
14686
|
+
* NOT a fixed severity enum — each kind declares its own `caps.levels` and
|
|
14687
|
+
* the adapter maps this ordinal onto its native level. `level?` is an
|
|
14688
|
+
* optional kind-native level id (`emergency`, `silent`, …) that overrides
|
|
14689
|
+
* `priority` for that one target.
|
|
14690
|
+
*/
|
|
14691
|
+
var NotificationSchema = object({
|
|
14692
|
+
body: string(),
|
|
14693
|
+
title: string().optional(),
|
|
14694
|
+
format: NotificationFormatSchema.default("text"),
|
|
14695
|
+
priority: number().int().min(1).max(5).default(3),
|
|
14696
|
+
level: string().optional(),
|
|
14697
|
+
attachments: array(AttachmentSchema).optional(),
|
|
14698
|
+
clickUrl: string().optional(),
|
|
14699
|
+
actions: array(NotificationActionSchema).optional(),
|
|
14700
|
+
sound: string().optional(),
|
|
14701
|
+
ttl: number().optional(),
|
|
14702
|
+
tag: string().optional(),
|
|
14703
|
+
deviceId: number().optional(),
|
|
14704
|
+
eventId: string().optional(),
|
|
14705
|
+
metadata: record(string(), unknown()).optional(),
|
|
14706
|
+
/**
|
|
14707
|
+
* Values for the parameters the target's kind DECLARES in
|
|
14708
|
+
* {@link TargetKindSchema} `deliveryParams`. Already validated against the
|
|
14709
|
+
* declaration by the sender; a notifier reads only the keys it declared.
|
|
14710
|
+
*/
|
|
14711
|
+
delivery: record(string(), DeliveryParamValueSchema).optional()
|
|
14712
|
+
});
|
|
14713
|
+
/** One declared native severity/priority level for a kind. */
|
|
14714
|
+
var TargetKindLevelSchema = object({
|
|
14715
|
+
id: string(),
|
|
14716
|
+
label: string(),
|
|
14717
|
+
/** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
|
|
14718
|
+
ordinal: number().int().min(1).max(5).nullable(),
|
|
14719
|
+
flags: object({
|
|
14720
|
+
critical: boolean().optional(),
|
|
14721
|
+
silent: boolean().optional(),
|
|
14722
|
+
noPush: boolean().optional()
|
|
14723
|
+
}).optional(),
|
|
14724
|
+
/** e.g. Pushover `emergency` requires `retry` / `expire`. */
|
|
14725
|
+
requires: array(string()).optional(),
|
|
14726
|
+
description: string().optional()
|
|
14727
|
+
});
|
|
14728
|
+
/** The full capability block consulted before dispatch. */
|
|
14729
|
+
var TargetKindCapsSchema = object({
|
|
14730
|
+
attachments: object({
|
|
14731
|
+
mediaTypes: array(AttachmentMediaTypeSchema),
|
|
14732
|
+
mode: _enum([
|
|
14733
|
+
"url",
|
|
14734
|
+
"bytes",
|
|
14735
|
+
"both"
|
|
14736
|
+
]),
|
|
14737
|
+
max: number().int().nonnegative(),
|
|
14738
|
+
maxBytes: number().int().positive().optional()
|
|
14739
|
+
}),
|
|
14740
|
+
/** Max action buttons (0 = none). */
|
|
14741
|
+
actions: number().int().nonnegative(),
|
|
14742
|
+
/**
|
|
14743
|
+
* Whether this kind renders a per-action ICON.
|
|
14744
|
+
*
|
|
14745
|
+
* `.optional()`, deliberately NOT `.default(false)`: a Zod default does not
|
|
14746
|
+
* run on the addon cap path — three production failures in one day taught
|
|
14747
|
+
* this repo that once. Absent is read as false by the degrade engine, which
|
|
14748
|
+
* is the safe direction: an icon that is not rendered costs nothing, an icon
|
|
14749
|
+
* assumed and dropped costs the operator's trust in the field.
|
|
14750
|
+
*/
|
|
14751
|
+
actionIcons: boolean().optional(),
|
|
14752
|
+
levels: array(TargetKindLevelSchema),
|
|
14753
|
+
format: array(NotificationFormatSchema),
|
|
14754
|
+
clickUrl: boolean(),
|
|
14755
|
+
sound: boolean(),
|
|
14756
|
+
ttl: boolean(),
|
|
14757
|
+
bodyMaxLen: number().int().positive()
|
|
14758
|
+
});
|
|
14759
|
+
/**
|
|
14760
|
+
* `configSchema` is a `ConfigUISchema` tree passed through to the admin
|
|
14761
|
+
* FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
|
|
14762
|
+
* `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
|
|
14763
|
+
* the union is large and not meant for runtime validation here; the exported
|
|
14228
14764
|
* `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
|
|
14229
14765
|
*/
|
|
14230
|
-
var ConfigSchemaPassthrough$
|
|
14766
|
+
var ConfigSchemaPassthrough$3 = unknown();
|
|
14231
14767
|
var TargetKindSchema = object({
|
|
14232
14768
|
kind: string(),
|
|
14233
14769
|
label: string(),
|
|
@@ -14264,7 +14800,7 @@ var TargetKindSchema = object({
|
|
|
14264
14800
|
* its raster path, which is the safe default for an unknown image.
|
|
14265
14801
|
*/
|
|
14266
14802
|
iconMediaType: string().optional(),
|
|
14267
|
-
configSchema: ConfigSchemaPassthrough$
|
|
14803
|
+
configSchema: ConfigSchemaPassthrough$3,
|
|
14268
14804
|
/**
|
|
14269
14805
|
* The config keys that decide WHERE this kind's secrets are sent (server,
|
|
14270
14806
|
* base URL, instance, chat, recipient). A save that changes any of them
|
|
@@ -14286,9 +14822,11 @@ var TargetKindSchema = object({
|
|
|
14286
14822
|
caps: TargetKindCapsSchema
|
|
14287
14823
|
});
|
|
14288
14824
|
/**
|
|
14289
|
-
* A
|
|
14290
|
-
*
|
|
14291
|
-
*
|
|
14825
|
+
* A target as a provider's own code sees it (the notification-center bridge, the
|
|
14826
|
+
* send path): the flat record body split into the name, the switch and the
|
|
14827
|
+
* kind's fields. `config` holds secrets; a reader that serves it to a client
|
|
14828
|
+
* REDACTS secret fields (a presence marker only) — never round-trip a stored
|
|
14829
|
+
* secret to the UI.
|
|
14292
14830
|
*/
|
|
14293
14831
|
var TargetSchema = object({
|
|
14294
14832
|
id: string(),
|
|
@@ -14331,13 +14869,13 @@ var ProbeTargetConfigResultSchema = object({
|
|
|
14331
14869
|
stateInstance: string().optional(),
|
|
14332
14870
|
error: string().optional()
|
|
14333
14871
|
});
|
|
14334
|
-
method(object({}), array(TargetKindSchema)), method(object({
|
|
14872
|
+
method(object({}), array(TargetKindSchema)), method(object({
|
|
14335
14873
|
kind: string(),
|
|
14336
14874
|
config: record(string(), unknown()).optional(),
|
|
14337
14875
|
/**
|
|
14338
14876
|
* When editing / duplicating, the blank password field never round-trips
|
|
14339
14877
|
* the stored token. Pass the source target id so the provider can restore
|
|
14340
|
-
* secrets server-side before dialling
|
|
14878
|
+
* secrets server-side before dialling.
|
|
14341
14879
|
*/
|
|
14342
14880
|
targetId: string().optional()
|
|
14343
14881
|
}), array(DiscoveredTargetSchema), { auth: "admin" }), method(object({
|
|
@@ -14360,27 +14898,6 @@ method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSche
|
|
|
14360
14898
|
}), TestResultSchema, {
|
|
14361
14899
|
kind: "mutation",
|
|
14362
14900
|
auth: "admin"
|
|
14363
|
-
}), method(object({
|
|
14364
|
-
target: TargetSchema,
|
|
14365
|
-
/**
|
|
14366
|
-
* Duplicate flow: create a NEW target id while copying secrets from an
|
|
14367
|
-
* existing row. The UI never holds the stored token; blank / redacted
|
|
14368
|
-
* password fields are restored from this source (D634 still applies if
|
|
14369
|
-
* destinations diverge without a re-typed secret).
|
|
14370
|
-
*/
|
|
14371
|
-
cloneSecretsFrom: string().optional()
|
|
14372
|
-
}), TargetSchema, {
|
|
14373
|
-
kind: "mutation",
|
|
14374
|
-
auth: "admin"
|
|
14375
|
-
}), method(object({ targetId: string() }), _void(), {
|
|
14376
|
-
kind: "mutation",
|
|
14377
|
-
auth: "admin"
|
|
14378
|
-
}), method(object({
|
|
14379
|
-
targetId: string(),
|
|
14380
|
-
enabled: boolean()
|
|
14381
|
-
}), _void(), {
|
|
14382
|
-
kind: "mutation",
|
|
14383
|
-
auth: "admin"
|
|
14384
14901
|
});
|
|
14385
14902
|
looseObject({
|
|
14386
14903
|
name: string().min(1),
|
|
@@ -22772,7 +23289,6 @@ var SYSTEM_CAP_VOCABULARY = {
|
|
|
22772
23289
|
"notification-output": system("notification delivery — reached through notifier devices and rules"),
|
|
22773
23290
|
"notification-rules": system("notification rules — authored on their own page"),
|
|
22774
23291
|
"oauth-integration": system(IDENTITY),
|
|
22775
|
-
"oidc-connections": system(IDENTITY),
|
|
22776
23292
|
"osd-manager": system(PIPELINE),
|
|
22777
23293
|
"pipeline-executor": system(PIPELINE),
|
|
22778
23294
|
"pipeline-orchestrator": system(PIPELINE),
|
|
@@ -42655,726 +43171,344 @@ var LEGACY_ICON_ALIASES = { gauge2: "gauge" };
|
|
|
42655
43171
|
* ## What is persisted
|
|
42656
43172
|
*
|
|
42657
43173
|
* The canonical kebab-case lucide id ({@link IconKey}). Spellings that a lucide
|
|
42658
|
-
* package still accepts (`home` for `house`) and this repo's own legacy ones
|
|
42659
|
-
* (`gauge2`) RESOLVE ({@link canonicalIconKey}) so a stored value never goes
|
|
42660
|
-
* stale, but they are never OFFERED by search.
|
|
42661
|
-
*
|
|
42662
|
-
* ## Search
|
|
42663
|
-
*
|
|
42664
|
-
* Over the key, the Italian/English overlay in `icon-synonyms.ts`, any words
|
|
42665
|
-
* the caller adds, and lucide's English tags — in that order of weight.
|
|
42666
|
-
*/
|
|
42667
|
-
var KEY_SET$2 = new Set(ICON_KEYS);
|
|
42668
|
-
new Map([...Object.entries(ICON_ALIASES), ...Object.entries(LEGACY_ICON_ALIASES)]);
|
|
42669
|
-
/** Is this a canonical key of the catalog? (An alias is not — see {@link canonicalIconKey}.) */
|
|
42670
|
-
function isIconKey(value) {
|
|
42671
|
-
return typeof value === "string" && KEY_SET$2.has(value);
|
|
42672
|
-
}
|
|
42673
|
-
/**
|
|
42674
|
-
* Wire/storage schema for one icon key.
|
|
42675
|
-
*
|
|
42676
|
-
* Deliberately NOT a `z.enum` of the catalog: ~1,700 literals would be inlined
|
|
42677
|
-
* into every cap router, type and API-reference row that carries an icon. The
|
|
42678
|
-
* check is membership in the catalog and the type is {@link IconKey}.
|
|
42679
|
-
*/
|
|
42680
|
-
var IconKeySchema = custom(isIconKey, "Not an icon of the catalog");
|
|
42681
|
-
var ENTRIES = ICON_KEYS.map((key, index) => {
|
|
42682
|
-
const [categoryIndexes, tags] = ICON_META[index] ?? [[], []];
|
|
42683
|
-
const categories = categoryIndexes.flatMap((i) => {
|
|
42684
|
-
const id = ICON_CATEGORY_IDS[i];
|
|
42685
|
-
return id === void 0 ? [] : [id];
|
|
42686
|
-
});
|
|
42687
|
-
return {
|
|
42688
|
-
key,
|
|
42689
|
-
categories,
|
|
42690
|
-
primaryCategory: categories[0] ?? ICON_CATEGORY_IDS[0],
|
|
42691
|
-
tags,
|
|
42692
|
-
synonyms: ICON_SYNONYMS[key] ?? []
|
|
42693
|
-
};
|
|
42694
|
-
});
|
|
42695
|
-
new Map(ENTRIES.map((e) => [e.key, e]));
|
|
42696
|
-
/** Categories a picker offers first: the ones this product's icons mostly live in. */
|
|
42697
|
-
var LEADING_CATEGORIES = [
|
|
42698
|
-
"devices",
|
|
42699
|
-
"home",
|
|
42700
|
-
"security",
|
|
42701
|
-
"buildings",
|
|
42702
|
-
"connectivity",
|
|
42703
|
-
"multimedia",
|
|
42704
|
-
"nature",
|
|
42705
|
-
"weather",
|
|
42706
|
-
"transportation",
|
|
42707
|
-
"animals"
|
|
42708
|
-
];
|
|
42709
|
-
var PRIMARY_CATEGORIES = new Set(ENTRIES.map((e) => e.primaryCategory));
|
|
42710
|
-
[...LEADING_CATEGORIES, ...ICON_CATEGORY_IDS.filter((c) => !LEADING_CATEGORIES.includes(c))].filter((c) => PRIMARY_CATEGORIES.has(c));
|
|
42711
|
-
/**
|
|
42712
|
-
* One (location, icon) assignment as it travels.
|
|
42713
|
-
*
|
|
42714
|
-
* `locationKey` is ALWAYS {@link locationIconKey} of the label — never the
|
|
42715
|
-
* operator's casing. The registry matches labels trimmed + case-insensitively
|
|
42716
|
-
* everywhere (`addLocation`, `removeLocation`, `renameLocation`), and a
|
|
42717
|
-
* case-only rename (`kitchen` → `Kitchen`) is a real edit this repo supports; a
|
|
42718
|
-
* map keyed on the displayed casing would orphan its entry on exactly that
|
|
42719
|
-
* edit. Consumers join by keying their own label through `locationIconKey`.
|
|
42720
|
-
*/
|
|
42721
|
-
var LocationIconAssignmentSchema = object({
|
|
42722
|
-
locationKey: string(),
|
|
42723
|
-
icon: IconKeySchema
|
|
42724
|
-
});
|
|
42725
|
-
/**
|
|
42726
|
-
* One (location, description) assignment as it travels.
|
|
42727
|
-
*
|
|
42728
|
-
* Same key discipline as {@link LocationIconAssignmentSchema}, and for the same
|
|
42729
|
-
* reason: this lived for a while in the post-analysis addon's own settings,
|
|
42730
|
-
* keyed by a HAND-TYPED label matched exactly and case-sensitively. A rename in
|
|
42731
|
-
* the Locations page carried the icon and silently orphaned the description —
|
|
42732
|
-
* two authorities for one thing, joined by two different rules. Now both hang
|
|
42733
|
-
* off the location itself, on `locationIconKey`.
|
|
42734
|
-
*/
|
|
42735
|
-
var LocationDescriptionAssignmentSchema = object({
|
|
42736
|
-
locationKey: string(),
|
|
42737
|
-
description: string()
|
|
42738
|
-
});
|
|
42739
|
-
/**
|
|
42740
|
-
* WHO an action step acts on (D983) — one target shape for every place that
|
|
42741
|
-
* performs an action (automation steps, Action entries, notification
|
|
42742
|
-
* sequences, scheduler points):
|
|
42743
|
-
*
|
|
42744
|
-
* - `devices` — device ids the operator picked, frozen at save time;
|
|
42745
|
-
* - `domain` — every device that offers the step's VOCABULARY action,
|
|
42746
|
-
* optionally narrowed to one device type and one room, resolved WHEN THE
|
|
42747
|
-
* STEP RUNS (a device added later is included). The action always comes
|
|
42748
|
-
* from the vocabulary (`cover.open`), never from a raw cap name, so a
|
|
42749
|
-
* `domain` target needs an `actionId` (enforced on the step schema);
|
|
42750
|
-
* - `var` — a `$var` resolved from the run's scope.
|
|
42751
|
-
*
|
|
42752
|
-
* {@link ActionTargetResolver} turns a target into device ids. It is pure
|
|
42753
|
-
* (a {@link DeviceDirectory} is handed in) so the hub's core-blocks service and
|
|
42754
|
-
* a generated automation block share it.
|
|
42755
|
-
*
|
|
42756
|
-
* A room is the device's `location` label (`DeviceInfo.location`); two labels
|
|
42757
|
-
* name the same room when `locationIconKey` agrees (trimmed, lower-cased).
|
|
42758
|
-
*/
|
|
42759
|
-
var ActionTargetSchema = discriminatedUnion("kind", [
|
|
42760
|
-
object({
|
|
42761
|
-
kind: literal("devices"),
|
|
42762
|
-
ids: array(number().int()).min(1)
|
|
42763
|
-
}),
|
|
42764
|
-
object({
|
|
42765
|
-
kind: literal("domain"),
|
|
42766
|
-
/** Narrow to one kind of device. */
|
|
42767
|
-
deviceType: _enum(DeviceType).optional(),
|
|
42768
|
-
/** Narrow to one room: the `location` label devices carry. */
|
|
42769
|
-
roomId: string().min(1).optional()
|
|
42770
|
-
}),
|
|
42771
|
-
object({
|
|
42772
|
-
kind: literal("var"),
|
|
42773
|
-
name: string().min(1)
|
|
42774
|
-
})
|
|
42775
|
-
]);
|
|
42776
|
-
EventCategory.DeviceRegistered, EventCategory.DeviceUnregistered, EventCategory.DeviceUpdated, EventCategory.DeviceMetaChanged, EventCategory.DeviceBindingsChanged;
|
|
42777
|
-
var ExpressionBindingSourceSchema = union([
|
|
42778
|
-
object({
|
|
42779
|
-
kind: literal("field").optional(),
|
|
42780
|
-
sourceKey: string(),
|
|
42781
|
-
cap: string(),
|
|
42782
|
-
fieldPath: string()
|
|
42783
|
-
}),
|
|
42784
|
-
object({
|
|
42785
|
-
kind: literal("literal"),
|
|
42786
|
-
value: union([
|
|
42787
|
-
string(),
|
|
42788
|
-
number(),
|
|
42789
|
-
boolean(),
|
|
42790
|
-
_null()
|
|
42791
|
-
])
|
|
42792
|
-
}),
|
|
42793
|
-
object({
|
|
42794
|
-
kind: literal("global"),
|
|
42795
|
-
sourceStableId: string(),
|
|
42796
|
-
cap: string(),
|
|
42797
|
-
fieldPath: string()
|
|
42798
|
-
})
|
|
42799
|
-
]);
|
|
42800
|
-
object({
|
|
42801
|
-
expr: string().min(1).max(MAX_EXPRESSION_SOURCE_LENGTH),
|
|
42802
|
-
bindings: record(string().regex(EXPRESSION_IDENTIFIER_RE), ExpressionBindingSourceSchema)
|
|
42803
|
-
}).superRefine((src, ctx) => {
|
|
42804
|
-
const err = validateExpressionSource(src);
|
|
42805
|
-
if (err !== null) ctx.addIssue({
|
|
42806
|
-
code: "custom",
|
|
42807
|
-
message: err,
|
|
42808
|
-
path: ["expr"]
|
|
42809
|
-
});
|
|
42810
|
-
});
|
|
42811
|
-
/**
|
|
42812
|
-
* Identity envelope for a device's upstream-system metadata.
|
|
42813
|
-
*
|
|
42814
|
-
* Two jobs:
|
|
42815
|
-
*
|
|
42816
|
-
* 1. **Dispatch key.** `id` is the natural identifier the SOURCE system
|
|
42817
|
-
* uses to address this device (HA `entity_id`, Reolink MAC, ONVIF
|
|
42818
|
-
* WS-Discovery endpoint UUID, …). Provider code keeps a
|
|
42819
|
-
* `Map<sourceInfo.id, IDevice>` to route inbound push events in O(1)
|
|
42820
|
-
* without round-tripping through `stableId` / `id` mappings.
|
|
42821
|
-
*
|
|
42822
|
-
* 2. **Stability bridge.** `uniqueId` is the *immutable* upstream id when
|
|
42823
|
-
* one exists (HA `entity.unique_id`, Reolink MAC again — same as `id`
|
|
42824
|
-
* for vendors where MAC is the natural key). For systems where the
|
|
42825
|
-
* live dispatch key can be renamed (HA `entity_id` can be edited),
|
|
42826
|
-
* providers detect renames by matching `uniqueId` and patch `id`
|
|
42827
|
-
* in-place so dispatch keeps working.
|
|
42828
|
-
*
|
|
42829
|
-
* **Display unit and precision are NOT stored here.** They are a read-time
|
|
42830
|
-
* preference (D944). A polymorphic reading stores its `quantity` here once,
|
|
42831
|
-
* at adopt, and a date/time value stores `dateTimeShape` the same way —
|
|
42832
|
-
* neither is repeated on each sample. The `device_class` tag is an
|
|
42833
|
-
* HA-specific input consumed at the discovery boundary (`ha-domain-mapping`)
|
|
42834
|
-
* to derive the CamStack `DeviceRole`; it is never stored after that point.
|
|
42835
|
-
*
|
|
42836
|
-
* The `raw` escape hatch carries provider-specific attributes that don't
|
|
42837
|
-
* fit the structured slots (HA `attributes` whitelist, Reolink `deviceCache`
|
|
42838
|
-
* details, …). Providers control what lands here.
|
|
42839
|
-
*/
|
|
42840
|
-
var SourceInfoSchema = object({
|
|
42841
|
-
/** Live dispatch key — mutable when the source system allows rename. */
|
|
42842
|
-
id: string(),
|
|
42843
|
-
/** Source system tag — e.g. 'homeassistant' | 'reolink' | 'onvif'. */
|
|
42844
|
-
system: string(),
|
|
42845
|
-
/** Immutable upstream identifier when available (HA `unique_id`, … ).
|
|
42846
|
-
* Used to detect rename when `id` changes. */
|
|
42847
|
-
uniqueId: string().optional(),
|
|
42848
|
-
/** Quantity of a polymorphic reading, written once at adopt (D944). */
|
|
42849
|
-
quantity: ReadingQuantitySchema.optional(),
|
|
42850
|
-
/** Date / time / datetime shape of a string reading, written once at adopt. */
|
|
42851
|
-
dateTimeShape: _enum([
|
|
42852
|
-
"date",
|
|
42853
|
-
"time",
|
|
42854
|
-
"datetime"
|
|
42855
|
-
]).optional(),
|
|
42856
|
-
/** Provider-specific extras that don't fit the structured slots.
|
|
42857
|
-
* Whitelist what goes here per provider — do NOT dump entire HA
|
|
42858
|
-
* attribute blobs (would explode the meta JSON column). */
|
|
42859
|
-
raw: record(string(), unknown()).optional()
|
|
42860
|
-
});
|
|
42861
|
-
/**
|
|
42862
|
-
* Build the synthetic SourceInfo every existing provider falls back to
|
|
42863
|
-
* when no upstream value has been persisted. Keeps non-migrated providers
|
|
42864
|
-
* (Reolink / Hikvision / ONVIF / RTSP) functional without code
|
|
42865
|
-
* changes — `id` reuses the CamStack stableId, `system` reuses the addon
|
|
42866
|
-
* id. Real upstream identity replaces this once a provider migrates and
|
|
42867
|
-
* calls `updateSourceInfo()` with concrete values.
|
|
42868
|
-
*/
|
|
42869
|
-
function synthesizeSourceInfo(input) {
|
|
42870
|
-
return {
|
|
42871
|
-
id: input.stableId,
|
|
42872
|
-
system: input.addonId
|
|
42873
|
-
};
|
|
42874
|
-
}
|
|
42875
|
-
/**
|
|
42876
|
-
* Shallow-merge a partial patch over a prior SourceInfo. `undefined`
|
|
42877
|
-
* patch values are ignored (no field clobber); to clear a field
|
|
42878
|
-
* explicitly, providers omit it from the patch and rebuild from scratch
|
|
42879
|
-
* via `updateSourceInfo({})` cycles — uncommon enough that we don't
|
|
42880
|
-
* bother with a `null`-means-delete sentinel.
|
|
42881
|
-
*
|
|
42882
|
-
* The `raw` field is also shallow-merged: passing `raw: { foo: 1 }`
|
|
42883
|
-
* merges over existing `raw` keys instead of replacing the whole bag.
|
|
42884
|
-
*/
|
|
42885
|
-
function mergeSourceInfo(prev, patch) {
|
|
42886
|
-
const next = { ...prev };
|
|
42887
|
-
for (const [k, v] of Object.entries(patch)) {
|
|
42888
|
-
if (v === void 0) continue;
|
|
42889
|
-
if (k === "raw" && typeof v === "object" && v !== null) {
|
|
42890
|
-
next.raw = {
|
|
42891
|
-
...prev.raw,
|
|
42892
|
-
...v
|
|
42893
|
-
};
|
|
42894
|
-
continue;
|
|
42895
|
-
}
|
|
42896
|
-
next[k] = v;
|
|
42897
|
-
}
|
|
42898
|
-
return next;
|
|
42899
|
-
}
|
|
42900
|
-
/**
|
|
42901
|
-
* Coerce common unit-of-measurement string variants to a canonical form
|
|
42902
|
-
* so the UI's display templates can rely on stable strings. Pure
|
|
42903
|
-
* passthrough for unknown units — kept conservative on purpose, the goal
|
|
42904
|
-
* is to normalise the long tail of HA `unit_of_measurement` values that
|
|
42905
|
-
* have multiple historical spellings (`'°C'` vs `'C'` vs `'celsius'`).
|
|
42906
|
-
*
|
|
42907
|
-
* Extend the map as we encounter real-world data. Returning the raw
|
|
42908
|
-
* input for unknown values is intentional: providers should never
|
|
42909
|
-
* lose information silently here.
|
|
42910
|
-
*/
|
|
42911
|
-
function normalizeUnit(raw) {
|
|
42912
|
-
if (raw == null) return void 0;
|
|
42913
|
-
const trimmed = raw.trim();
|
|
42914
|
-
if (trimmed === "") return void 0;
|
|
42915
|
-
const lower = trimmed.toLowerCase();
|
|
42916
|
-
if (lower === "°c" || lower === "c" || lower === "celsius") return "°C";
|
|
42917
|
-
if (lower === "°f" || lower === "f" || lower === "fahrenheit") return "°F";
|
|
42918
|
-
if (lower === "k" || lower === "kelvin") return "K";
|
|
42919
|
-
if (lower === "%" || lower === "percent" || lower === "percentage") return "%";
|
|
42920
|
-
if (lower === "lx" || lower === "lux") return "lx";
|
|
42921
|
-
if (lower === "hpa" || lower === "hectopascal") return "hPa";
|
|
42922
|
-
if (lower === "kpa") return "kPa";
|
|
42923
|
-
if (lower === "pa") return "Pa";
|
|
42924
|
-
if (lower === "mbar" || lower === "millibar") return "mbar";
|
|
42925
|
-
if (lower === "w" || lower === "watt") return "W";
|
|
42926
|
-
if (lower === "kw" || lower === "kilowatt") return "kW";
|
|
42927
|
-
if (lower === "wh" || lower === "watt-hour") return "Wh";
|
|
42928
|
-
if (lower === "kwh" || lower === "kilowatt-hour") return "kWh";
|
|
42929
|
-
if (lower === "v" || lower === "volt") return "V";
|
|
42930
|
-
if (lower === "a" || lower === "amp" || lower === "ampere") return "A";
|
|
42931
|
-
if (lower === "ma" || lower === "milliampere") return "mA";
|
|
42932
|
-
if (lower === "va") return "VA";
|
|
42933
|
-
if (lower === "ppm") return "ppm";
|
|
42934
|
-
if (lower === "ppb") return "ppb";
|
|
42935
|
-
if (lower === "µg/m³" || lower === "ug/m3" || lower === "µg/m3") return "µg/m³";
|
|
42936
|
-
if (lower === "km/h" || lower === "kph") return "km/h";
|
|
42937
|
-
if (lower === "mph") return "mph";
|
|
42938
|
-
if (lower === "m/s") return "m/s";
|
|
42939
|
-
if (lower === "m") return "m";
|
|
42940
|
-
if (lower === "m²" || lower === "m2") return "m²";
|
|
42941
|
-
if (lower === "mm") return "mm";
|
|
42942
|
-
if (lower === "cm") return "cm";
|
|
42943
|
-
if (lower === "km") return "km";
|
|
42944
|
-
if (lower === "in" || lower === "inch" || lower === "inches") return "in";
|
|
42945
|
-
if (lower === "ft" || lower === "foot" || lower === "feet") return "ft";
|
|
42946
|
-
if (lower === "kg") return "kg";
|
|
42947
|
-
if (lower === "g") return "g";
|
|
42948
|
-
if (lower === "l" || lower === "liter" || lower === "litre" || lower === "liters" || lower === "litres") return "L";
|
|
42949
|
-
if (lower === "ml") return "mL";
|
|
42950
|
-
if (lower === "gal" || lower === "gallon" || lower === "gallons") return "gal";
|
|
42951
|
-
if (lower === "s" || lower === "sec" || lower === "second" || lower === "seconds") return "s";
|
|
42952
|
-
if (lower === "ms") return "ms";
|
|
42953
|
-
if (lower === "min" || lower === "minute" || lower === "minutes") return "min";
|
|
42954
|
-
if (lower === "h" || lower === "hr" || lower === "hour" || lower === "hours") return "h";
|
|
42955
|
-
if (lower === "d" || lower === "day" || lower === "days") return "d";
|
|
42956
|
-
if (lower === "b" || lower === "byte" || lower === "bytes") return "B";
|
|
42957
|
-
if (lower === "kib") return "KiB";
|
|
42958
|
-
if (lower === "mib") return "MiB";
|
|
42959
|
-
if (lower === "gib") return "GiB";
|
|
42960
|
-
if (lower === "tib") return "TiB";
|
|
42961
|
-
if (lower === "kb") return "kB";
|
|
42962
|
-
if (lower === "mb") return "MB";
|
|
42963
|
-
if (lower === "gb") return "GB";
|
|
42964
|
-
if (lower === "dbm") return "dBm";
|
|
42965
|
-
if (lower === "dbfs") return "dBFS";
|
|
42966
|
-
if (lower === "inhg") return "inHg";
|
|
42967
|
-
if (lower === "mm/h" || lower === "mm/hr") return "mm/h";
|
|
42968
|
-
if (lower === "in/h" || lower === "in/hr") return "in/h";
|
|
42969
|
-
if (lower === "w/m²" || lower === "w/m2") return "W/m²";
|
|
42970
|
-
if (lower === "°" || lower === "deg" || lower === "degree" || lower === "degrees") return "°";
|
|
42971
|
-
if (lower === "kbps") return "kbps";
|
|
42972
|
-
if (lower === "fps") return "fps";
|
|
42973
|
-
return trimmed;
|
|
42974
|
-
}
|
|
42975
|
-
/**
|
|
42976
|
-
* Key under which `SourceInfo` lives inside `DeviceMeta.metadata`. The
|
|
42977
|
-
* blob is a free-form `Record<string, unknown>` shared with hardware-
|
|
42978
|
-
* identity fields (`manufacturer`, `model`, `firmware`, …); SourceInfo
|
|
42979
|
-
* lives under a single nested key to keep it composable with those.
|
|
42980
|
-
*/
|
|
42981
|
-
var SOURCE_INFO_METADATA_KEY = "sourceInfo";
|
|
42982
|
-
/**
|
|
42983
|
-
* Extract a SourceInfo from a `DeviceMeta.metadata` blob, validating
|
|
42984
|
-
* with Zod. Returns `null` when the blob is missing or the nested
|
|
42985
|
-
* `sourceInfo` key fails validation — callers fall back to the
|
|
42986
|
-
* synthetic default in that case (see `synthesizeSourceInfo`).
|
|
42987
|
-
*/
|
|
42988
|
-
function extractSourceInfoFromMetadata(metadata) {
|
|
42989
|
-
if (!metadata) return null;
|
|
42990
|
-
const raw = metadata[SOURCE_INFO_METADATA_KEY];
|
|
42991
|
-
if (!raw) return null;
|
|
42992
|
-
const parsed = SourceInfoSchema.safeParse(raw);
|
|
42993
|
-
if (!parsed.success) return null;
|
|
42994
|
-
return parsed.data;
|
|
42995
|
-
}
|
|
42996
|
-
/**
|
|
42997
|
-
* Frozen unit → spec table. `•` in the doc marks each dimension's canonical
|
|
42998
|
-
* unit (`factor: 1, offset: 0`). °F derives from `°C = (°F − 32) × 5/9` ⇒
|
|
42999
|
-
* `factor = 5/9`, `offset = -160/9` (kept as exact expressions, not rounded
|
|
43000
|
-
* decimals). K derives from `°C = K − 273.15`.
|
|
43001
|
-
*/
|
|
43002
|
-
var UNIT_TABLE = {
|
|
43003
|
-
"°C": {
|
|
43004
|
-
dimension: "temperature",
|
|
43005
|
-
factor: 1,
|
|
43006
|
-
offset: 0
|
|
43007
|
-
},
|
|
43008
|
-
"°F": {
|
|
43009
|
-
dimension: "temperature",
|
|
43010
|
-
factor: 5 / 9,
|
|
43011
|
-
offset: -160 / 9
|
|
43012
|
-
},
|
|
43013
|
-
K: {
|
|
43014
|
-
dimension: "temperature",
|
|
43015
|
-
factor: 1,
|
|
43016
|
-
offset: -273.15
|
|
43017
|
-
},
|
|
43018
|
-
hPa: {
|
|
43019
|
-
dimension: "pressure",
|
|
43020
|
-
factor: 1,
|
|
43021
|
-
offset: 0
|
|
43022
|
-
},
|
|
43023
|
-
kPa: {
|
|
43024
|
-
dimension: "pressure",
|
|
43025
|
-
factor: 10,
|
|
43026
|
-
offset: 0
|
|
43027
|
-
},
|
|
43028
|
-
Pa: {
|
|
43029
|
-
dimension: "pressure",
|
|
43030
|
-
factor: .01,
|
|
43031
|
-
offset: 0
|
|
43032
|
-
},
|
|
43033
|
-
mbar: {
|
|
43034
|
-
dimension: "pressure",
|
|
43035
|
-
factor: 1,
|
|
43036
|
-
offset: 0
|
|
43037
|
-
},
|
|
43038
|
-
bar: {
|
|
43039
|
-
dimension: "pressure",
|
|
43040
|
-
factor: 1e3,
|
|
43041
|
-
offset: 0
|
|
43042
|
-
},
|
|
43043
|
-
inHg: {
|
|
43044
|
-
dimension: "pressure",
|
|
43045
|
-
factor: 33.8639,
|
|
43046
|
-
offset: 0
|
|
43047
|
-
},
|
|
43048
|
-
mmHg: {
|
|
43049
|
-
dimension: "pressure",
|
|
43050
|
-
factor: 1.33322,
|
|
43051
|
-
offset: 0
|
|
43052
|
-
},
|
|
43053
|
-
psi: {
|
|
43054
|
-
dimension: "pressure",
|
|
43055
|
-
factor: 68.9476,
|
|
43056
|
-
offset: 0
|
|
43057
|
-
},
|
|
43058
|
-
"m/s": {
|
|
43059
|
-
dimension: "speed",
|
|
43060
|
-
factor: 1,
|
|
43061
|
-
offset: 0
|
|
43062
|
-
},
|
|
43063
|
-
"km/h": {
|
|
43064
|
-
dimension: "speed",
|
|
43065
|
-
factor: 1 / 3.6,
|
|
43066
|
-
offset: 0
|
|
43067
|
-
},
|
|
43068
|
-
mph: {
|
|
43069
|
-
dimension: "speed",
|
|
43070
|
-
factor: .44704,
|
|
43071
|
-
offset: 0
|
|
43072
|
-
},
|
|
43073
|
-
kn: {
|
|
43074
|
-
dimension: "speed",
|
|
43075
|
-
factor: .514444,
|
|
43076
|
-
offset: 0
|
|
43077
|
-
},
|
|
43078
|
-
"mm/h": {
|
|
43079
|
-
dimension: "precipitation-rate",
|
|
43080
|
-
factor: 1,
|
|
43081
|
-
offset: 0
|
|
43082
|
-
},
|
|
43083
|
-
"in/h": {
|
|
43084
|
-
dimension: "precipitation-rate",
|
|
43085
|
-
factor: 25.4,
|
|
43086
|
-
offset: 0
|
|
43087
|
-
},
|
|
43088
|
-
m: {
|
|
43089
|
-
dimension: "length",
|
|
43090
|
-
factor: 1,
|
|
43091
|
-
offset: 0
|
|
43092
|
-
},
|
|
43093
|
-
mm: {
|
|
43094
|
-
dimension: "length",
|
|
43095
|
-
factor: .001,
|
|
43096
|
-
offset: 0
|
|
43097
|
-
},
|
|
43098
|
-
cm: {
|
|
43099
|
-
dimension: "length",
|
|
43100
|
-
factor: .01,
|
|
43101
|
-
offset: 0
|
|
43102
|
-
},
|
|
43103
|
-
km: {
|
|
43104
|
-
dimension: "length",
|
|
43105
|
-
factor: 1e3,
|
|
43106
|
-
offset: 0
|
|
43107
|
-
},
|
|
43108
|
-
in: {
|
|
43109
|
-
dimension: "length",
|
|
43110
|
-
factor: .0254,
|
|
43111
|
-
offset: 0
|
|
43112
|
-
},
|
|
43113
|
-
ft: {
|
|
43114
|
-
dimension: "length",
|
|
43115
|
-
factor: .3048,
|
|
43116
|
-
offset: 0
|
|
43117
|
-
},
|
|
43118
|
-
mi: {
|
|
43119
|
-
dimension: "length",
|
|
43120
|
-
factor: 1609.344,
|
|
43121
|
-
offset: 0
|
|
43122
|
-
},
|
|
43123
|
-
"m²": {
|
|
43124
|
-
dimension: "area",
|
|
43125
|
-
factor: 1,
|
|
43126
|
-
offset: 0
|
|
43127
|
-
},
|
|
43128
|
-
lx: {
|
|
43129
|
-
dimension: "illuminance",
|
|
43130
|
-
factor: 1,
|
|
43131
|
-
offset: 0
|
|
43132
|
-
},
|
|
43133
|
-
"W/m²": {
|
|
43134
|
-
dimension: "irradiance",
|
|
43135
|
-
factor: 1,
|
|
43136
|
-
offset: 0
|
|
43137
|
-
},
|
|
43138
|
-
W: {
|
|
43139
|
-
dimension: "power",
|
|
43140
|
-
factor: 1,
|
|
43141
|
-
offset: 0
|
|
43142
|
-
},
|
|
43143
|
-
kW: {
|
|
43144
|
-
dimension: "power",
|
|
43145
|
-
factor: 1e3,
|
|
43146
|
-
offset: 0
|
|
43147
|
-
},
|
|
43148
|
-
VA: {
|
|
43149
|
-
dimension: "apparent-power",
|
|
43150
|
-
factor: 1,
|
|
43151
|
-
offset: 0
|
|
43152
|
-
},
|
|
43153
|
-
Wh: {
|
|
43154
|
-
dimension: "energy",
|
|
43155
|
-
factor: 1,
|
|
43156
|
-
offset: 0
|
|
43157
|
-
},
|
|
43158
|
-
kWh: {
|
|
43159
|
-
dimension: "energy",
|
|
43160
|
-
factor: 1e3,
|
|
43161
|
-
offset: 0
|
|
43162
|
-
},
|
|
43163
|
-
MWh: {
|
|
43164
|
-
dimension: "energy",
|
|
43165
|
-
factor: 1e6,
|
|
43166
|
-
offset: 0
|
|
43167
|
-
},
|
|
43168
|
-
V: {
|
|
43169
|
-
dimension: "voltage",
|
|
43170
|
-
factor: 1,
|
|
43171
|
-
offset: 0
|
|
43172
|
-
},
|
|
43173
|
-
mV: {
|
|
43174
|
-
dimension: "voltage",
|
|
43175
|
-
factor: .001,
|
|
43176
|
-
offset: 0
|
|
43177
|
-
},
|
|
43178
|
-
A: {
|
|
43179
|
-
dimension: "current",
|
|
43180
|
-
factor: 1,
|
|
43181
|
-
offset: 0
|
|
43182
|
-
},
|
|
43183
|
-
mA: {
|
|
43184
|
-
dimension: "current",
|
|
43185
|
-
factor: .001,
|
|
43186
|
-
offset: 0
|
|
43187
|
-
},
|
|
43188
|
-
ppm: {
|
|
43189
|
-
dimension: "concentration-volume",
|
|
43190
|
-
factor: 1,
|
|
43191
|
-
offset: 0
|
|
43192
|
-
},
|
|
43193
|
-
ppb: {
|
|
43194
|
-
dimension: "concentration-volume",
|
|
43195
|
-
factor: .001,
|
|
43196
|
-
offset: 0
|
|
43197
|
-
},
|
|
43198
|
-
"µg/m³": {
|
|
43199
|
-
dimension: "concentration-mass",
|
|
43200
|
-
factor: 1,
|
|
43201
|
-
offset: 0
|
|
43202
|
-
},
|
|
43203
|
-
"mg/m³": {
|
|
43204
|
-
dimension: "concentration-mass",
|
|
43205
|
-
factor: 1e3,
|
|
43206
|
-
offset: 0
|
|
43207
|
-
},
|
|
43208
|
-
kg: {
|
|
43209
|
-
dimension: "mass",
|
|
43210
|
-
factor: 1,
|
|
43211
|
-
offset: 0
|
|
43212
|
-
},
|
|
43213
|
-
g: {
|
|
43214
|
-
dimension: "mass",
|
|
43215
|
-
factor: .001,
|
|
43216
|
-
offset: 0
|
|
43217
|
-
},
|
|
43218
|
-
lb: {
|
|
43219
|
-
dimension: "mass",
|
|
43220
|
-
factor: .453592,
|
|
43221
|
-
offset: 0
|
|
43222
|
-
},
|
|
43223
|
-
oz: {
|
|
43224
|
-
dimension: "mass",
|
|
43225
|
-
factor: .0283495,
|
|
43226
|
-
offset: 0
|
|
43227
|
-
},
|
|
43228
|
-
"%": {
|
|
43229
|
-
dimension: "percentage",
|
|
43230
|
-
factor: 1,
|
|
43231
|
-
offset: 0
|
|
43232
|
-
},
|
|
43233
|
-
L: {
|
|
43234
|
-
dimension: "volume",
|
|
43235
|
-
factor: 1,
|
|
43236
|
-
offset: 0
|
|
43237
|
-
},
|
|
43238
|
-
mL: {
|
|
43239
|
-
dimension: "volume",
|
|
43240
|
-
factor: .001,
|
|
43241
|
-
offset: 0
|
|
43242
|
-
},
|
|
43243
|
-
gal: {
|
|
43244
|
-
dimension: "volume",
|
|
43245
|
-
factor: 3.785411784,
|
|
43246
|
-
offset: 0
|
|
43247
|
-
},
|
|
43248
|
-
s: {
|
|
43249
|
-
dimension: "duration",
|
|
43250
|
-
factor: 1,
|
|
43251
|
-
offset: 0
|
|
43252
|
-
},
|
|
43253
|
-
ms: {
|
|
43254
|
-
dimension: "duration",
|
|
43255
|
-
factor: .001,
|
|
43256
|
-
offset: 0
|
|
43257
|
-
},
|
|
43258
|
-
min: {
|
|
43259
|
-
dimension: "duration",
|
|
43260
|
-
factor: 60,
|
|
43261
|
-
offset: 0
|
|
43262
|
-
},
|
|
43263
|
-
h: {
|
|
43264
|
-
dimension: "duration",
|
|
43265
|
-
factor: 3600,
|
|
43266
|
-
offset: 0
|
|
43267
|
-
},
|
|
43268
|
-
d: {
|
|
43269
|
-
dimension: "duration",
|
|
43270
|
-
factor: 86400,
|
|
43271
|
-
offset: 0
|
|
43272
|
-
},
|
|
43273
|
-
B: {
|
|
43274
|
-
dimension: "information",
|
|
43275
|
-
factor: 1,
|
|
43276
|
-
offset: 0
|
|
43277
|
-
},
|
|
43278
|
-
KiB: {
|
|
43279
|
-
dimension: "information",
|
|
43280
|
-
factor: 1024,
|
|
43281
|
-
offset: 0
|
|
43282
|
-
},
|
|
43283
|
-
MiB: {
|
|
43284
|
-
dimension: "information",
|
|
43285
|
-
factor: 1024 ** 2,
|
|
43286
|
-
offset: 0
|
|
43287
|
-
},
|
|
43288
|
-
GiB: {
|
|
43289
|
-
dimension: "information",
|
|
43290
|
-
factor: 1024 ** 3,
|
|
43291
|
-
offset: 0
|
|
43292
|
-
},
|
|
43293
|
-
TiB: {
|
|
43294
|
-
dimension: "information",
|
|
43295
|
-
factor: 1024 ** 4,
|
|
43296
|
-
offset: 0
|
|
43297
|
-
},
|
|
43298
|
-
kB: {
|
|
43299
|
-
dimension: "information",
|
|
43300
|
-
factor: 1e3,
|
|
43301
|
-
offset: 0
|
|
43302
|
-
},
|
|
43303
|
-
MB: {
|
|
43304
|
-
dimension: "information",
|
|
43305
|
-
factor: 1e6,
|
|
43306
|
-
offset: 0
|
|
43307
|
-
},
|
|
43308
|
-
GB: {
|
|
43309
|
-
dimension: "information",
|
|
43310
|
-
factor: 1e9,
|
|
43311
|
-
offset: 0
|
|
43312
|
-
},
|
|
43313
|
-
"°": {
|
|
43314
|
-
dimension: "angle",
|
|
43315
|
-
factor: 1,
|
|
43316
|
-
offset: 0
|
|
43317
|
-
},
|
|
43318
|
-
dBFS: {
|
|
43319
|
-
dimension: "sound-level",
|
|
43320
|
-
factor: 1,
|
|
43321
|
-
offset: 0
|
|
43322
|
-
},
|
|
43323
|
-
dBm: {
|
|
43324
|
-
dimension: "signal-level",
|
|
43325
|
-
factor: 1,
|
|
43326
|
-
offset: 0
|
|
43327
|
-
},
|
|
43328
|
-
mired: {
|
|
43329
|
-
dimension: "colour-temperature",
|
|
43330
|
-
factor: 1,
|
|
43331
|
-
offset: 0
|
|
43332
|
-
},
|
|
43333
|
-
kbps: {
|
|
43334
|
-
dimension: "bitrate",
|
|
43335
|
-
factor: 1,
|
|
43336
|
-
offset: 0
|
|
43337
|
-
},
|
|
43338
|
-
Mbps: {
|
|
43339
|
-
dimension: "bitrate",
|
|
43340
|
-
factor: 1e3,
|
|
43341
|
-
offset: 0
|
|
43342
|
-
},
|
|
43343
|
-
fps: {
|
|
43344
|
-
dimension: "rate",
|
|
43345
|
-
factor: 1,
|
|
43346
|
-
offset: 0
|
|
43347
|
-
}
|
|
43348
|
-
};
|
|
43349
|
-
/** Resolve a unit's `UnitSpec`, or `undefined` when the spelling is unknown. */
|
|
43350
|
-
function specFor(unit) {
|
|
43351
|
-
return Object.hasOwn(UNIT_TABLE, unit) ? UNIT_TABLE[unit] : void 0;
|
|
43174
|
+
* package still accepts (`home` for `house`) and this repo's own legacy ones
|
|
43175
|
+
* (`gauge2`) RESOLVE ({@link canonicalIconKey}) so a stored value never goes
|
|
43176
|
+
* stale, but they are never OFFERED by search.
|
|
43177
|
+
*
|
|
43178
|
+
* ## Search
|
|
43179
|
+
*
|
|
43180
|
+
* Over the key, the Italian/English overlay in `icon-synonyms.ts`, any words
|
|
43181
|
+
* the caller adds, and lucide's English tags — in that order of weight.
|
|
43182
|
+
*/
|
|
43183
|
+
var KEY_SET$2 = new Set(ICON_KEYS);
|
|
43184
|
+
new Map([...Object.entries(ICON_ALIASES), ...Object.entries(LEGACY_ICON_ALIASES)]);
|
|
43185
|
+
/** Is this a canonical key of the catalog? (An alias is not — see {@link canonicalIconKey}.) */
|
|
43186
|
+
function isIconKey(value) {
|
|
43187
|
+
return typeof value === "string" && KEY_SET$2.has(value);
|
|
43352
43188
|
}
|
|
43353
|
-
/**
|
|
43354
|
-
|
|
43355
|
-
|
|
43189
|
+
/**
|
|
43190
|
+
* Wire/storage schema for one icon key.
|
|
43191
|
+
*
|
|
43192
|
+
* Deliberately NOT a `z.enum` of the catalog: ~1,700 literals would be inlined
|
|
43193
|
+
* into every cap router, type and API-reference row that carries an icon. The
|
|
43194
|
+
* check is membership in the catalog and the type is {@link IconKey}.
|
|
43195
|
+
*/
|
|
43196
|
+
var IconKeySchema = custom(isIconKey, "Not an icon of the catalog");
|
|
43197
|
+
var ENTRIES = ICON_KEYS.map((key, index) => {
|
|
43198
|
+
const [categoryIndexes, tags] = ICON_META[index] ?? [[], []];
|
|
43199
|
+
const categories = categoryIndexes.flatMap((i) => {
|
|
43200
|
+
const id = ICON_CATEGORY_IDS[i];
|
|
43201
|
+
return id === void 0 ? [] : [id];
|
|
43202
|
+
});
|
|
43203
|
+
return {
|
|
43204
|
+
key,
|
|
43205
|
+
categories,
|
|
43206
|
+
primaryCategory: categories[0] ?? ICON_CATEGORY_IDS[0],
|
|
43207
|
+
tags,
|
|
43208
|
+
synonyms: ICON_SYNONYMS[key] ?? []
|
|
43209
|
+
};
|
|
43210
|
+
});
|
|
43211
|
+
new Map(ENTRIES.map((e) => [e.key, e]));
|
|
43212
|
+
/** Categories a picker offers first: the ones this product's icons mostly live in. */
|
|
43213
|
+
var LEADING_CATEGORIES = [
|
|
43214
|
+
"devices",
|
|
43215
|
+
"home",
|
|
43216
|
+
"security",
|
|
43217
|
+
"buildings",
|
|
43218
|
+
"connectivity",
|
|
43219
|
+
"multimedia",
|
|
43220
|
+
"nature",
|
|
43221
|
+
"weather",
|
|
43222
|
+
"transportation",
|
|
43223
|
+
"animals"
|
|
43224
|
+
];
|
|
43225
|
+
var PRIMARY_CATEGORIES = new Set(ENTRIES.map((e) => e.primaryCategory));
|
|
43226
|
+
[...LEADING_CATEGORIES, ...ICON_CATEGORY_IDS.filter((c) => !LEADING_CATEGORIES.includes(c))].filter((c) => PRIMARY_CATEGORIES.has(c));
|
|
43227
|
+
/**
|
|
43228
|
+
* One (location, icon) assignment as it travels.
|
|
43229
|
+
*
|
|
43230
|
+
* `locationKey` is ALWAYS {@link locationIconKey} of the label — never the
|
|
43231
|
+
* operator's casing. The registry matches labels trimmed + case-insensitively
|
|
43232
|
+
* everywhere (`addLocation`, `removeLocation`, `renameLocation`), and a
|
|
43233
|
+
* case-only rename (`kitchen` → `Kitchen`) is a real edit this repo supports; a
|
|
43234
|
+
* map keyed on the displayed casing would orphan its entry on exactly that
|
|
43235
|
+
* edit. Consumers join by keying their own label through `locationIconKey`.
|
|
43236
|
+
*/
|
|
43237
|
+
var LocationIconAssignmentSchema = object({
|
|
43238
|
+
locationKey: string(),
|
|
43239
|
+
icon: IconKeySchema
|
|
43240
|
+
});
|
|
43241
|
+
/**
|
|
43242
|
+
* One (location, description) assignment as it travels.
|
|
43243
|
+
*
|
|
43244
|
+
* Same key discipline as {@link LocationIconAssignmentSchema}, and for the same
|
|
43245
|
+
* reason: this lived for a while in the post-analysis addon's own settings,
|
|
43246
|
+
* keyed by a HAND-TYPED label matched exactly and case-sensitively. A rename in
|
|
43247
|
+
* the Locations page carried the icon and silently orphaned the description —
|
|
43248
|
+
* two authorities for one thing, joined by two different rules. Now both hang
|
|
43249
|
+
* off the location itself, on `locationIconKey`.
|
|
43250
|
+
*/
|
|
43251
|
+
var LocationDescriptionAssignmentSchema = object({
|
|
43252
|
+
locationKey: string(),
|
|
43253
|
+
description: string()
|
|
43254
|
+
});
|
|
43255
|
+
/**
|
|
43256
|
+
* WHO an action step acts on (D983) — one target shape for every place that
|
|
43257
|
+
* performs an action (automation steps, Action entries, notification
|
|
43258
|
+
* sequences, scheduler points):
|
|
43259
|
+
*
|
|
43260
|
+
* - `devices` — device ids the operator picked, frozen at save time;
|
|
43261
|
+
* - `domain` — every device that offers the step's VOCABULARY action,
|
|
43262
|
+
* optionally narrowed to one device type and one room, resolved WHEN THE
|
|
43263
|
+
* STEP RUNS (a device added later is included). The action always comes
|
|
43264
|
+
* from the vocabulary (`cover.open`), never from a raw cap name, so a
|
|
43265
|
+
* `domain` target needs an `actionId` (enforced on the step schema);
|
|
43266
|
+
* - `var` — a `$var` resolved from the run's scope.
|
|
43267
|
+
*
|
|
43268
|
+
* {@link ActionTargetResolver} turns a target into device ids. It is pure
|
|
43269
|
+
* (a {@link DeviceDirectory} is handed in) so the hub's core-blocks service and
|
|
43270
|
+
* a generated automation block share it.
|
|
43271
|
+
*
|
|
43272
|
+
* A room is the device's `location` label (`DeviceInfo.location`); two labels
|
|
43273
|
+
* name the same room when `locationIconKey` agrees (trimmed, lower-cased).
|
|
43274
|
+
*/
|
|
43275
|
+
var ActionTargetSchema = discriminatedUnion("kind", [
|
|
43276
|
+
object({
|
|
43277
|
+
kind: literal("devices"),
|
|
43278
|
+
ids: array(number().int()).min(1)
|
|
43279
|
+
}),
|
|
43280
|
+
object({
|
|
43281
|
+
kind: literal("domain"),
|
|
43282
|
+
/** Narrow to one kind of device. */
|
|
43283
|
+
deviceType: _enum(DeviceType).optional(),
|
|
43284
|
+
/** Narrow to one room: the `location` label devices carry. */
|
|
43285
|
+
roomId: string().min(1).optional()
|
|
43286
|
+
}),
|
|
43287
|
+
object({
|
|
43288
|
+
kind: literal("var"),
|
|
43289
|
+
name: string().min(1)
|
|
43290
|
+
})
|
|
43291
|
+
]);
|
|
43292
|
+
EventCategory.DeviceRegistered, EventCategory.DeviceUnregistered, EventCategory.DeviceUpdated, EventCategory.DeviceMetaChanged, EventCategory.DeviceBindingsChanged;
|
|
43293
|
+
var ExpressionBindingSourceSchema = union([
|
|
43294
|
+
object({
|
|
43295
|
+
kind: literal("field").optional(),
|
|
43296
|
+
sourceKey: string(),
|
|
43297
|
+
cap: string(),
|
|
43298
|
+
fieldPath: string()
|
|
43299
|
+
}),
|
|
43300
|
+
object({
|
|
43301
|
+
kind: literal("literal"),
|
|
43302
|
+
value: union([
|
|
43303
|
+
string(),
|
|
43304
|
+
number(),
|
|
43305
|
+
boolean(),
|
|
43306
|
+
_null()
|
|
43307
|
+
])
|
|
43308
|
+
}),
|
|
43309
|
+
object({
|
|
43310
|
+
kind: literal("global"),
|
|
43311
|
+
sourceStableId: string(),
|
|
43312
|
+
addonId: string().optional(),
|
|
43313
|
+
cap: string(),
|
|
43314
|
+
fieldPath: string()
|
|
43315
|
+
})
|
|
43316
|
+
]);
|
|
43317
|
+
object({
|
|
43318
|
+
expr: string().min(1).max(MAX_EXPRESSION_SOURCE_LENGTH),
|
|
43319
|
+
bindings: record(string().regex(EXPRESSION_IDENTIFIER_RE), ExpressionBindingSourceSchema)
|
|
43320
|
+
}).superRefine((src, ctx) => {
|
|
43321
|
+
const err = validateExpressionSource(src);
|
|
43322
|
+
if (err !== null) ctx.addIssue({
|
|
43323
|
+
code: "custom",
|
|
43324
|
+
message: err,
|
|
43325
|
+
path: ["expr"]
|
|
43326
|
+
});
|
|
43327
|
+
});
|
|
43328
|
+
/**
|
|
43329
|
+
* Identity envelope for a device's upstream-system metadata.
|
|
43330
|
+
*
|
|
43331
|
+
* Two jobs:
|
|
43332
|
+
*
|
|
43333
|
+
* 1. **Dispatch key.** `id` is the natural identifier the SOURCE system
|
|
43334
|
+
* uses to address this device (HA `entity_id`, Reolink MAC, ONVIF
|
|
43335
|
+
* WS-Discovery endpoint UUID, …). Provider code keeps a
|
|
43336
|
+
* `Map<sourceInfo.id, IDevice>` to route inbound push events in O(1)
|
|
43337
|
+
* without round-tripping through `stableId` / `id` mappings.
|
|
43338
|
+
*
|
|
43339
|
+
* 2. **Stability bridge.** `uniqueId` is the *immutable* upstream id when
|
|
43340
|
+
* one exists (HA `entity.unique_id`, Reolink MAC again — same as `id`
|
|
43341
|
+
* for vendors where MAC is the natural key). For systems where the
|
|
43342
|
+
* live dispatch key can be renamed (HA `entity_id` can be edited),
|
|
43343
|
+
* providers detect renames by matching `uniqueId` and patch `id`
|
|
43344
|
+
* in-place so dispatch keeps working.
|
|
43345
|
+
*
|
|
43346
|
+
* **Display unit and precision are NOT stored here.** They are a read-time
|
|
43347
|
+
* preference (D944). A polymorphic reading stores its `quantity` here once,
|
|
43348
|
+
* at adopt, and a date/time value stores `dateTimeShape` the same way —
|
|
43349
|
+
* neither is repeated on each sample. The `device_class` tag is an
|
|
43350
|
+
* HA-specific input consumed at the discovery boundary (`ha-domain-mapping`)
|
|
43351
|
+
* to derive the CamStack `DeviceRole`; it is never stored after that point.
|
|
43352
|
+
*
|
|
43353
|
+
* The `raw` escape hatch carries provider-specific attributes that don't
|
|
43354
|
+
* fit the structured slots (HA `attributes` whitelist, Reolink `deviceCache`
|
|
43355
|
+
* details, …). Providers control what lands here.
|
|
43356
|
+
*/
|
|
43357
|
+
var SourceInfoSchema = object({
|
|
43358
|
+
/** Live dispatch key — mutable when the source system allows rename. */
|
|
43359
|
+
id: string(),
|
|
43360
|
+
/** Source system tag — e.g. 'homeassistant' | 'reolink' | 'onvif'. */
|
|
43361
|
+
system: string(),
|
|
43362
|
+
/** Immutable upstream identifier when available (HA `unique_id`, … ).
|
|
43363
|
+
* Used to detect rename when `id` changes. */
|
|
43364
|
+
uniqueId: string().optional(),
|
|
43365
|
+
/** Quantity of a polymorphic reading, written once at adopt (D944). */
|
|
43366
|
+
quantity: ReadingQuantitySchema.optional(),
|
|
43367
|
+
/** Date / time / datetime shape of a string reading, written once at adopt. */
|
|
43368
|
+
dateTimeShape: _enum([
|
|
43369
|
+
"date",
|
|
43370
|
+
"time",
|
|
43371
|
+
"datetime"
|
|
43372
|
+
]).optional(),
|
|
43373
|
+
/** Provider-specific extras that don't fit the structured slots.
|
|
43374
|
+
* Whitelist what goes here per provider — do NOT dump entire HA
|
|
43375
|
+
* attribute blobs (would explode the meta JSON column). */
|
|
43376
|
+
raw: record(string(), unknown()).optional()
|
|
43377
|
+
});
|
|
43378
|
+
/**
|
|
43379
|
+
* Build the synthetic SourceInfo every existing provider falls back to
|
|
43380
|
+
* when no upstream value has been persisted. Keeps non-migrated providers
|
|
43381
|
+
* (Reolink / Hikvision / ONVIF / RTSP) functional without code
|
|
43382
|
+
* changes — `id` reuses the CamStack stableId, `system` reuses the addon
|
|
43383
|
+
* id. Real upstream identity replaces this once a provider migrates and
|
|
43384
|
+
* calls `updateSourceInfo()` with concrete values.
|
|
43385
|
+
*/
|
|
43386
|
+
function synthesizeSourceInfo(input) {
|
|
43387
|
+
return {
|
|
43388
|
+
id: input.stableId,
|
|
43389
|
+
system: input.addonId
|
|
43390
|
+
};
|
|
43356
43391
|
}
|
|
43357
|
-
/**
|
|
43358
|
-
|
|
43359
|
-
|
|
43392
|
+
/**
|
|
43393
|
+
* Shallow-merge a partial patch over a prior SourceInfo. `undefined`
|
|
43394
|
+
* patch values are ignored (no field clobber); to clear a field
|
|
43395
|
+
* explicitly, providers omit it from the patch and rebuild from scratch
|
|
43396
|
+
* via `updateSourceInfo({})` cycles — uncommon enough that we don't
|
|
43397
|
+
* bother with a `null`-means-delete sentinel.
|
|
43398
|
+
*
|
|
43399
|
+
* The `raw` field is also shallow-merged: passing `raw: { foo: 1 }`
|
|
43400
|
+
* merges over existing `raw` keys instead of replacing the whole bag.
|
|
43401
|
+
*/
|
|
43402
|
+
function mergeSourceInfo(prev, patch) {
|
|
43403
|
+
const next = { ...prev };
|
|
43404
|
+
for (const [k, v] of Object.entries(patch)) {
|
|
43405
|
+
if (v === void 0) continue;
|
|
43406
|
+
if (k === "raw" && typeof v === "object" && v !== null) {
|
|
43407
|
+
next.raw = {
|
|
43408
|
+
...prev.raw,
|
|
43409
|
+
...v
|
|
43410
|
+
};
|
|
43411
|
+
continue;
|
|
43412
|
+
}
|
|
43413
|
+
next[k] = v;
|
|
43414
|
+
}
|
|
43415
|
+
return next;
|
|
43360
43416
|
}
|
|
43361
|
-
/**
|
|
43362
|
-
|
|
43363
|
-
|
|
43417
|
+
/**
|
|
43418
|
+
* Coerce common unit-of-measurement string variants to a canonical form
|
|
43419
|
+
* so the UI's display templates can rely on stable strings. Pure
|
|
43420
|
+
* passthrough for unknown units — kept conservative on purpose, the goal
|
|
43421
|
+
* is to normalise the long tail of HA `unit_of_measurement` values that
|
|
43422
|
+
* have multiple historical spellings (`'°C'` vs `'C'` vs `'celsius'`).
|
|
43423
|
+
*
|
|
43424
|
+
* Extend the map as we encounter real-world data. Returning the raw
|
|
43425
|
+
* input for unknown values is intentional: providers should never
|
|
43426
|
+
* lose information silently here.
|
|
43427
|
+
*/
|
|
43428
|
+
function normalizeUnit(raw) {
|
|
43429
|
+
if (raw == null) return void 0;
|
|
43430
|
+
const trimmed = raw.trim();
|
|
43431
|
+
if (trimmed === "") return void 0;
|
|
43432
|
+
const lower = trimmed.toLowerCase();
|
|
43433
|
+
if (lower === "°c" || lower === "c" || lower === "celsius") return "°C";
|
|
43434
|
+
if (lower === "°f" || lower === "f" || lower === "fahrenheit") return "°F";
|
|
43435
|
+
if (lower === "k" || lower === "kelvin") return "K";
|
|
43436
|
+
if (lower === "%" || lower === "percent" || lower === "percentage") return "%";
|
|
43437
|
+
if (lower === "lx" || lower === "lux") return "lx";
|
|
43438
|
+
if (lower === "hpa" || lower === "hectopascal") return "hPa";
|
|
43439
|
+
if (lower === "kpa") return "kPa";
|
|
43440
|
+
if (lower === "pa") return "Pa";
|
|
43441
|
+
if (lower === "mbar" || lower === "millibar") return "mbar";
|
|
43442
|
+
if (lower === "w" || lower === "watt") return "W";
|
|
43443
|
+
if (lower === "kw" || lower === "kilowatt") return "kW";
|
|
43444
|
+
if (lower === "wh" || lower === "watt-hour") return "Wh";
|
|
43445
|
+
if (lower === "kwh" || lower === "kilowatt-hour") return "kWh";
|
|
43446
|
+
if (lower === "v" || lower === "volt") return "V";
|
|
43447
|
+
if (lower === "a" || lower === "amp" || lower === "ampere") return "A";
|
|
43448
|
+
if (lower === "ma" || lower === "milliampere") return "mA";
|
|
43449
|
+
if (lower === "va") return "VA";
|
|
43450
|
+
if (lower === "ppm") return "ppm";
|
|
43451
|
+
if (lower === "ppb") return "ppb";
|
|
43452
|
+
if (lower === "µg/m³" || lower === "ug/m3" || lower === "µg/m3") return "µg/m³";
|
|
43453
|
+
if (lower === "km/h" || lower === "kph") return "km/h";
|
|
43454
|
+
if (lower === "mph") return "mph";
|
|
43455
|
+
if (lower === "m/s") return "m/s";
|
|
43456
|
+
if (lower === "m") return "m";
|
|
43457
|
+
if (lower === "m²" || lower === "m2") return "m²";
|
|
43458
|
+
if (lower === "mm") return "mm";
|
|
43459
|
+
if (lower === "cm") return "cm";
|
|
43460
|
+
if (lower === "km") return "km";
|
|
43461
|
+
if (lower === "in" || lower === "inch" || lower === "inches") return "in";
|
|
43462
|
+
if (lower === "ft" || lower === "foot" || lower === "feet") return "ft";
|
|
43463
|
+
if (lower === "kg") return "kg";
|
|
43464
|
+
if (lower === "g") return "g";
|
|
43465
|
+
if (lower === "l" || lower === "liter" || lower === "litre" || lower === "liters" || lower === "litres") return "L";
|
|
43466
|
+
if (lower === "ml") return "mL";
|
|
43467
|
+
if (lower === "gal" || lower === "gallon" || lower === "gallons") return "gal";
|
|
43468
|
+
if (lower === "s" || lower === "sec" || lower === "second" || lower === "seconds") return "s";
|
|
43469
|
+
if (lower === "ms") return "ms";
|
|
43470
|
+
if (lower === "min" || lower === "minute" || lower === "minutes") return "min";
|
|
43471
|
+
if (lower === "h" || lower === "hr" || lower === "hour" || lower === "hours") return "h";
|
|
43472
|
+
if (lower === "d" || lower === "day" || lower === "days") return "d";
|
|
43473
|
+
if (lower === "b" || lower === "byte" || lower === "bytes") return "B";
|
|
43474
|
+
if (lower === "kib") return "KiB";
|
|
43475
|
+
if (lower === "mib") return "MiB";
|
|
43476
|
+
if (lower === "gib") return "GiB";
|
|
43477
|
+
if (lower === "tib") return "TiB";
|
|
43478
|
+
if (lower === "kb") return "kB";
|
|
43479
|
+
if (lower === "mb") return "MB";
|
|
43480
|
+
if (lower === "gb") return "GB";
|
|
43481
|
+
if (lower === "dbm") return "dBm";
|
|
43482
|
+
if (lower === "dbfs") return "dBFS";
|
|
43483
|
+
if (lower === "inhg") return "inHg";
|
|
43484
|
+
if (lower === "mm/h" || lower === "mm/hr") return "mm/h";
|
|
43485
|
+
if (lower === "in/h" || lower === "in/hr") return "in/h";
|
|
43486
|
+
if (lower === "w/m²" || lower === "w/m2") return "W/m²";
|
|
43487
|
+
if (lower === "°" || lower === "deg" || lower === "degree" || lower === "degrees") return "°";
|
|
43488
|
+
if (lower === "kbps") return "kbps";
|
|
43489
|
+
if (lower === "fps") return "fps";
|
|
43490
|
+
return trimmed;
|
|
43364
43491
|
}
|
|
43365
43492
|
/**
|
|
43366
|
-
*
|
|
43367
|
-
*
|
|
43368
|
-
*
|
|
43493
|
+
* Key under which `SourceInfo` lives inside `DeviceMeta.metadata`. The
|
|
43494
|
+
* blob is a free-form `Record<string, unknown>` shared with hardware-
|
|
43495
|
+
* identity fields (`manufacturer`, `model`, `firmware`, …); SourceInfo
|
|
43496
|
+
* lives under a single nested key to keep it composable with those.
|
|
43369
43497
|
*/
|
|
43370
|
-
|
|
43371
|
-
|
|
43372
|
-
|
|
43373
|
-
|
|
43374
|
-
|
|
43375
|
-
|
|
43376
|
-
|
|
43377
|
-
|
|
43498
|
+
var SOURCE_INFO_METADATA_KEY = "sourceInfo";
|
|
43499
|
+
/**
|
|
43500
|
+
* Extract a SourceInfo from a `DeviceMeta.metadata` blob, validating
|
|
43501
|
+
* with Zod. Returns `null` when the blob is missing or the nested
|
|
43502
|
+
* `sourceInfo` key fails validation — callers fall back to the
|
|
43503
|
+
* synthetic default in that case (see `synthesizeSourceInfo`).
|
|
43504
|
+
*/
|
|
43505
|
+
function extractSourceInfoFromMetadata(metadata) {
|
|
43506
|
+
if (!metadata) return null;
|
|
43507
|
+
const raw = metadata[SOURCE_INFO_METADATA_KEY];
|
|
43508
|
+
if (!raw) return null;
|
|
43509
|
+
const parsed = SourceInfoSchema.safeParse(raw);
|
|
43510
|
+
if (!parsed.success) return null;
|
|
43511
|
+
return parsed.data;
|
|
43378
43512
|
}
|
|
43379
43513
|
/**
|
|
43380
43514
|
* A number a person types for a physical quantity — the input side of the
|
|
@@ -45053,15 +45187,28 @@ var SettingsSchemaWithValuesSchema = object({
|
|
|
45053
45187
|
});
|
|
45054
45188
|
/** Patch object — keys are field names, values are the new field values. */
|
|
45055
45189
|
var SettingsPatchSchema = record(string(), unknown());
|
|
45190
|
+
/** The scope of a scoped-settings call (D986): where the capability declared the values. */
|
|
45191
|
+
var ScopedSettingsScopeSchema = _enum(SCOPED_SETTINGS_SCOPES);
|
|
45192
|
+
/** One scoped schema an addon serves: its capability, scope and section ids. */
|
|
45193
|
+
var ScopedSettingsDeclarationSchema = object({
|
|
45194
|
+
cap: string(),
|
|
45195
|
+
scope: ScopedSettingsScopeSchema,
|
|
45196
|
+
sectionIds: array(string())
|
|
45197
|
+
});
|
|
45056
45198
|
/** Standard success response for update operations. */
|
|
45057
45199
|
var SettingsUpdateResultSchema = object({ success: literal(true) });
|
|
45058
45200
|
method(object({
|
|
45059
45201
|
addonId: string(),
|
|
45060
|
-
|
|
45061
|
-
|
|
45062
|
-
|
|
45202
|
+
cap: string(),
|
|
45203
|
+
scope: ScopedSettingsScopeSchema,
|
|
45204
|
+
nodeId: string().optional()
|
|
45063
45205
|
}), SettingsSchemaWithValuesSchema.nullable()), method(object({
|
|
45064
45206
|
addonId: string(),
|
|
45207
|
+
nodeId: string().optional()
|
|
45208
|
+
}), array(ScopedSettingsDeclarationSchema).nullable()), method(object({
|
|
45209
|
+
addonId: string(),
|
|
45210
|
+
cap: string(),
|
|
45211
|
+
scope: ScopedSettingsScopeSchema,
|
|
45065
45212
|
nodeId: string().optional(),
|
|
45066
45213
|
patch: SettingsPatchSchema
|
|
45067
45214
|
}), SettingsUpdateResultSchema, {
|
|
@@ -45069,8 +45216,10 @@ method(object({
|
|
|
45069
45216
|
auth: "admin"
|
|
45070
45217
|
}), method(object({
|
|
45071
45218
|
addonId: string(),
|
|
45219
|
+
cap: string(),
|
|
45220
|
+
scope: ScopedSettingsScopeSchema,
|
|
45072
45221
|
nodeId: string().optional()
|
|
45073
|
-
}),
|
|
45222
|
+
}), record(string(), unknown()).nullable()), method(object({
|
|
45074
45223
|
addonId: string(),
|
|
45075
45224
|
nodeId: string().optional(),
|
|
45076
45225
|
instance: IntegrationInstanceRefSchema
|
|
@@ -46633,7 +46782,7 @@ var BackupDestinationInfoSchema = object({
|
|
|
46633
46782
|
id: string(),
|
|
46634
46783
|
/**
|
|
46635
46784
|
* Manifest id of the owning addon. The Settings button on the
|
|
46636
|
-
* destination card opens that addon's
|
|
46785
|
+
* destination card opens that addon's scoped settings panel.
|
|
46637
46786
|
*/
|
|
46638
46787
|
addonId: string(),
|
|
46639
46788
|
/** Operator-toggled enable flag from the destination-policy table. */
|
|
@@ -50047,7 +50196,7 @@ var mediaPlayerCapability = {
|
|
|
50047
50196
|
isMuted: { kind: "boolean" }
|
|
50048
50197
|
} }
|
|
50049
50198
|
};
|
|
50050
|
-
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;
|
|
50199
|
+
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;
|
|
50051
50200
|
var NUMBER = {
|
|
50052
50201
|
kind: "fixed",
|
|
50053
50202
|
result: ["number"]
|
|
@@ -52065,6 +52214,7 @@ method(InstancePinSchema, DeviceExportStatusSchema), method(_void(), array(Expor
|
|
|
52065
52214
|
kind: "mutation",
|
|
52066
52215
|
auth: "admin"
|
|
52067
52216
|
});
|
|
52217
|
+
var DeviceAliasSchema = string().max(64).regex(/^[a-z][a-z0-9_]*$/);
|
|
52068
52218
|
/**
|
|
52069
52219
|
* A SITE ZONE — a named part of the property that several locations belong to.
|
|
52070
52220
|
*
|
|
@@ -52551,6 +52701,12 @@ var DeviceInfoSchema = object({
|
|
|
52551
52701
|
addonId: string(),
|
|
52552
52702
|
type: _enum(DeviceType),
|
|
52553
52703
|
name: string(),
|
|
52704
|
+
/** The name a value template uses for this device (`{{ stufa_veranda.temperature }}`),
|
|
52705
|
+
* entity_id style. Generated once from the name at first registration, unique
|
|
52706
|
+
* cluster-wide, editable through `setAlias`, NOT changed by a rename (D1021).
|
|
52707
|
+
* Optional: a record produced by an older build omits it until the boot
|
|
52708
|
+
* backfill has run. */
|
|
52709
|
+
alias: DeviceAliasSchema.optional(),
|
|
52554
52710
|
/** Operator-organisational location label. `null` when unset. */
|
|
52555
52711
|
location: string().nullable(),
|
|
52556
52712
|
/** Soft-disabled flag. */
|
|
@@ -52870,6 +53026,25 @@ method(object({
|
|
|
52870
53026
|
}), _void(), {
|
|
52871
53027
|
kind: "mutation",
|
|
52872
53028
|
auth: "admin"
|
|
53029
|
+
}), method(object({
|
|
53030
|
+
deviceId: number(),
|
|
53031
|
+
alias: string()
|
|
53032
|
+
}), discriminatedUnion("ok", [object({
|
|
53033
|
+
ok: literal(true),
|
|
53034
|
+
alias: DeviceAliasSchema
|
|
53035
|
+
}), object({
|
|
53036
|
+
ok: literal(false),
|
|
53037
|
+
reason: _enum([
|
|
53038
|
+
"empty",
|
|
53039
|
+
"too-long",
|
|
53040
|
+
"grammar",
|
|
53041
|
+
"reserved",
|
|
53042
|
+
"taken"
|
|
53043
|
+
]),
|
|
53044
|
+
takenBy: number().optional()
|
|
53045
|
+
})]), {
|
|
53046
|
+
kind: "mutation",
|
|
53047
|
+
auth: "admin"
|
|
52873
53048
|
}), method(object({
|
|
52874
53049
|
deviceId: number(),
|
|
52875
53050
|
location: string().nullable()
|
|
@@ -56579,7 +56754,7 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
|
|
|
56579
56754
|
* or the redaction token KEEPS the stored secret; `{ $secretClear: true }`
|
|
56580
56755
|
* clears it.
|
|
56581
56756
|
*/
|
|
56582
|
-
var ConfigSchemaPassthrough$
|
|
56757
|
+
var ConfigSchemaPassthrough$2 = custom();
|
|
56583
56758
|
var IntegrationInstanceIdSchema = string().min(1);
|
|
56584
56759
|
var IntegrationInstanceModeSchema = _enum(["single", "multiple"]);
|
|
56585
56760
|
/**
|
|
@@ -56625,7 +56800,16 @@ var IntegrationInstanceKindSchema = object({
|
|
|
56625
56800
|
/** Relative hub path to start an interactive account link of an instance of this kind. */
|
|
56626
56801
|
connectPath: string().min(1).optional(),
|
|
56627
56802
|
/** Relative hub path to disconnect that account. */
|
|
56628
|
-
disconnectPath: string().min(1).optional()
|
|
56803
|
+
disconnectPath: string().min(1).optional(),
|
|
56804
|
+
/**
|
|
56805
|
+
* Parts of the edit dialog the flat form cannot draw (a node picker, a model source), named by a
|
|
56806
|
+
* GENERIC widget id the client maps to a component; a client that knows none of them shows none.
|
|
56807
|
+
* `connection` widgets write connection values, `model` widgets own the model choice.
|
|
56808
|
+
*/
|
|
56809
|
+
widgets: array(object({
|
|
56810
|
+
id: string().min(1),
|
|
56811
|
+
placement: _enum(["connection", "model"])
|
|
56812
|
+
})).optional()
|
|
56629
56813
|
});
|
|
56630
56814
|
/**
|
|
56631
56815
|
* How devices of an instance are found. `none`: the operator adds them by hand; `lan`: the addon
|
|
@@ -56666,10 +56850,11 @@ var IntegrationInstanceDescriptionSchema = object({
|
|
|
56666
56850
|
/** True when `testInstance` really probes the remote. */
|
|
56667
56851
|
canTest: boolean(),
|
|
56668
56852
|
/**
|
|
56669
|
-
* The kinds an instance can be of
|
|
56670
|
-
* Add flow asks which first and sends it as
|
|
56853
|
+
* The kinds an instance can be of (D1013 rule 1), each naming its `functionCap`. One entry:
|
|
56854
|
+
* nothing to choose; more than one: the Add flow asks which first and sends it as
|
|
56855
|
+
* `createInstance.kind`. Never empty: every instance belongs to exactly one kind.
|
|
56671
56856
|
*/
|
|
56672
|
-
kinds: array(IntegrationInstanceKindSchema).
|
|
56857
|
+
kinds: array(IntegrationInstanceKindSchema).min(1),
|
|
56673
56858
|
/**
|
|
56674
56859
|
* The provider accepts `createInstance.id` for an id that once existed (an adopted id, because
|
|
56675
56860
|
* devices carry it). The UI then offers "restore under its old id" on Add. Absent means no.
|
|
@@ -56705,8 +56890,8 @@ var IntegrationInstanceSchema = object({
|
|
|
56705
56890
|
* the body is the one store, `setInstanceEnabled` the one writer (epic #440, step 3).
|
|
56706
56891
|
*/
|
|
56707
56892
|
enabled: boolean().optional(),
|
|
56708
|
-
/** The kind of this instance
|
|
56709
|
-
kind: string().
|
|
56893
|
+
/** The kind of this instance: exactly one of `describe().kinds[].id` (D1013 rule 2). */
|
|
56894
|
+
kind: string().min(1),
|
|
56710
56895
|
/** Values for the instance form; a secret is a `SecretFieldView`, never text. */
|
|
56711
56896
|
formValues: record(string(), unknown()),
|
|
56712
56897
|
status: IntegrationInstanceStatusSchema.optional(),
|
|
@@ -56730,7 +56915,7 @@ var integrationInstancesCapability = {
|
|
|
56730
56915
|
id: IntegrationInstanceIdSchema.nullable(),
|
|
56731
56916
|
/** The kind of the create form (`id: null`) of a provider with several. */
|
|
56732
56917
|
kind: string().min(1).optional()
|
|
56733
|
-
}), ConfigSchemaPassthrough$
|
|
56918
|
+
}), ConfigSchemaPassthrough$2, { auth: "admin" }),
|
|
56734
56919
|
listInstances: method(_void(), array(IntegrationInstanceSchema).readonly(), { auth: "admin" }),
|
|
56735
56920
|
getInstance: method(object({ id: IntegrationInstanceIdSchema }), IntegrationInstanceSchema.nullable(), { auth: "admin" }),
|
|
56736
56921
|
/**
|
|
@@ -57832,12 +58017,12 @@ var LlmModelInfoSchema = object({
|
|
|
57832
58017
|
});
|
|
57833
58018
|
/**
|
|
57834
58019
|
* The provider-specific part of a profile, validated by the provider that owns
|
|
57835
|
-
* the kind (
|
|
58020
|
+
* the kind (saving an instance refuses what it does not accept). A field its
|
|
57836
58021
|
* `connectionSchema` declares `type: 'password'` is a secret: it is held in the
|
|
57837
58022
|
* keychain, never in the row, and reads back as the redaction marker.
|
|
57838
58023
|
*/
|
|
57839
58024
|
var LlmProviderConfigSchema = record(string(), unknown());
|
|
57840
|
-
|
|
58025
|
+
object({
|
|
57841
58026
|
id: string(),
|
|
57842
58027
|
name: string(),
|
|
57843
58028
|
/** The provider-declared kind (`LlmProfileKindDescriptor.kind`). */
|
|
@@ -57931,8 +58116,8 @@ var LlmProviderWidgetSchema = object({
|
|
|
57931
58116
|
/** ConfigUISchema tree passed through untyped on the wire (the
|
|
57932
58117
|
* notification-output `ConfigSchemaPassthrough` precedent at
|
|
57933
58118
|
* notification-output.cap.ts:151); the exported TS type re-tightens it. */
|
|
57934
|
-
var ConfigSchemaPassthrough$
|
|
57935
|
-
|
|
58119
|
+
var ConfigSchemaPassthrough$1 = unknown();
|
|
58120
|
+
object({
|
|
57936
58121
|
kind: LlmProfileKindSchema,
|
|
57937
58122
|
label: string(),
|
|
57938
58123
|
/** A generic icon name (`cloud`, `plug`, `cpu`) — never a glyph or a logo. */
|
|
@@ -57940,9 +58125,9 @@ var LlmProfileKindDescriptorSchema = object({
|
|
|
57940
58125
|
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
57941
58126
|
addonId: string(),
|
|
57942
58127
|
/** The provider's own fields (`providerConfig`); `password` fields are keychain-held. */
|
|
57943
|
-
connectionSchema: ConfigSchemaPassthrough$
|
|
58128
|
+
connectionSchema: ConfigSchemaPassthrough$1,
|
|
57944
58129
|
/** Provider fields that belong under "Advanced" (extra headers, runtime tuning). */
|
|
57945
|
-
advancedSchema: ConfigSchemaPassthrough$
|
|
58130
|
+
advancedSchema: ConfigSchemaPassthrough$1.optional(),
|
|
57946
58131
|
/** The kind's defaults; a model from `listModels` may override any of them. */
|
|
57947
58132
|
features: LlmModelFeaturesSchema,
|
|
57948
58133
|
/** `false` = the provider stamps `supportsVision` itself (from what a node reports). */
|
|
@@ -58071,20 +58256,7 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
|
|
|
58071
58256
|
}), method(object({
|
|
58072
58257
|
addonId: string().optional(),
|
|
58073
58258
|
requestId: string()
|
|
58074
|
-
}), _void(), { kind: "mutation" }), method(
|
|
58075
|
-
kind: "mutation",
|
|
58076
|
-
auth: "admin"
|
|
58077
|
-
}), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
|
|
58078
|
-
kind: "mutation",
|
|
58079
|
-
auth: "admin"
|
|
58080
|
-
}), method(ProfileRefInputSchema, _void(), {
|
|
58081
|
-
kind: "mutation",
|
|
58082
|
-
auth: "admin"
|
|
58083
|
-
}), method(ProfileRefInputSchema, LlmGenerateResultSchema, {
|
|
58084
|
-
kind: "mutation",
|
|
58085
|
-
auth: "admin",
|
|
58086
|
-
timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
|
|
58087
|
-
}), method(LlmListModelsInputSchema, LlmListModelsResultSchema, {
|
|
58259
|
+
}), _void(), { kind: "mutation" }), method(LlmListModelsInputSchema, LlmListModelsResultSchema, {
|
|
58088
58260
|
kind: "mutation",
|
|
58089
58261
|
auth: "admin"
|
|
58090
58262
|
}), method(object({}), array(LlmDefaultSchema)), method(object({
|
|
@@ -59147,20 +59319,7 @@ method(_void(), MeshStatusSchema), method(object({
|
|
|
59147
59319
|
/** Optional hostname override the host should advertise once joined. */
|
|
59148
59320
|
hostname: string().optional() }), object({
|
|
59149
59321
|
/** Authentication URL the operator should open in a browser. */
|
|
59150
|
-
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() }))
|
|
59151
|
-
/** Optional auth key — when provided, probes the key validity
|
|
59152
|
-
* against the provider's API. Omit when already joined to
|
|
59153
|
-
* just ping the daemon. */
|
|
59154
|
-
authKey: string().optional() }), object({
|
|
59155
|
-
ok: boolean(),
|
|
59156
|
-
/** Provider-side identifier resolved by the probe (tailnet
|
|
59157
|
-
* name for Tailscale, network id for ZeroTier, etc.). */
|
|
59158
|
-
tenant: string().optional(),
|
|
59159
|
-
/** Daemon binary version, when reachable. */
|
|
59160
|
-
daemonVersion: string().optional(),
|
|
59161
|
-
/** Human-readable error when `ok: false`. */
|
|
59162
|
-
error: string().optional()
|
|
59163
|
-
}), { kind: "mutation" });
|
|
59322
|
+
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() }));
|
|
59164
59323
|
/**
|
|
59165
59324
|
* A monotonic total between resets (D944). Energy uses `power-meter.energy`
|
|
59166
59325
|
* so dashboards keep one series; every other instantaneous reading lands here.
|
|
@@ -66987,6 +67146,11 @@ var NcScheduleSchema = object({
|
|
|
66987
67146
|
* as a STATE SUMMARY at the end of each window of `schedule`.
|
|
66988
67147
|
*/
|
|
66989
67148
|
var NcSystemEventDeliveryModeSchema = _enum(["instant", "summary"]);
|
|
67149
|
+
_enum([
|
|
67150
|
+
"activation",
|
|
67151
|
+
"deactivation",
|
|
67152
|
+
"schedule"
|
|
67153
|
+
]);
|
|
66990
67154
|
/**
|
|
66991
67155
|
* How a summary window is SENT (D698): `rule` (absent) = ONE notification with
|
|
66992
67156
|
* every section; `section` = one notification per section with something to
|
|
@@ -67003,11 +67167,26 @@ var NcStateSummarySplitSchema = _enum(["rule", "section"]);
|
|
|
67003
67167
|
* midnight crossing); the send time is each window's END. Refused on the
|
|
67004
67168
|
* `alarm` family, which stays instant (`systemEventDeliveryProblems`).
|
|
67005
67169
|
*/
|
|
67006
|
-
var NcSystemEventDeliverySchema = discriminatedUnion("mode", [
|
|
67007
|
-
mode: literal("
|
|
67008
|
-
|
|
67009
|
-
|
|
67010
|
-
|
|
67170
|
+
var NcSystemEventDeliverySchema = discriminatedUnion("mode", [
|
|
67171
|
+
object({ mode: literal("instant") }),
|
|
67172
|
+
object({
|
|
67173
|
+
mode: literal("summary"),
|
|
67174
|
+
schedule: NcScheduleSchema,
|
|
67175
|
+
split: NcStateSummarySplitSchema.optional()
|
|
67176
|
+
}),
|
|
67177
|
+
object({
|
|
67178
|
+
mode: literal("modes"),
|
|
67179
|
+
/** The bad edge, and every kind that has a single edge. */
|
|
67180
|
+
onActivation: boolean(),
|
|
67181
|
+
/** The recovery edges of the classes of the selected kinds (derived, never stored per kind). */
|
|
67182
|
+
onDeactivation: boolean(),
|
|
67183
|
+
/** A state summary at the end of each window; absent = no summary. */
|
|
67184
|
+
onSchedule: object({
|
|
67185
|
+
schedule: NcScheduleSchema,
|
|
67186
|
+
grouping: NcStateSummarySplitSchema
|
|
67187
|
+
}).optional()
|
|
67188
|
+
})
|
|
67189
|
+
]);
|
|
67011
67190
|
/** Fuzzy plate matcher — OCR noise makes exact match useless (spec row 12/13). */
|
|
67012
67191
|
var NcPlateMatcherSchema = object({
|
|
67013
67192
|
/**
|
|
@@ -69367,61 +69546,6 @@ var OauthIntegrationDescriptorSchema = object({
|
|
|
69367
69546
|
});
|
|
69368
69547
|
method(_void(), OauthIntegrationDescriptorSchema, { auth: "admin" });
|
|
69369
69548
|
/**
|
|
69370
|
-
* `oidc-connections` — CRUD for IdP rows under `auth-oidc` (D828 sibling).
|
|
69371
|
-
*
|
|
69372
|
-
* One hub-only singleton (`auth-oidc`). The Settings UI is a DataTable +
|
|
69373
|
-
* ItemFormDialog; there is no `editable-array` in `globalSettingsSchema`.
|
|
69374
|
-
* Operator-chosen `id` is the URL slug (`/addon/auth-oidc/<id>/…`) and is
|
|
69375
|
-
* immutable after create.
|
|
69376
|
-
*/
|
|
69377
|
-
var ConfigSchemaPassthrough$1 = unknown();
|
|
69378
|
-
var OidcConnectionSchema = object({
|
|
69379
|
-
id: string().min(1),
|
|
69380
|
-
displayName: string(),
|
|
69381
|
-
icon: string(),
|
|
69382
|
-
issuerUrl: string(),
|
|
69383
|
-
clientId: string(),
|
|
69384
|
-
/** Client id + secret present — never the secret value. */
|
|
69385
|
-
configured: boolean(),
|
|
69386
|
-
/**
|
|
69387
|
-
* Values for the connection form schema. `clientSecret` is a keychain
|
|
69388
|
-
* {@link SecretFieldView} or `null` / `''`, never plaintext (D789).
|
|
69389
|
-
*/
|
|
69390
|
-
formValues: record(string(), unknown()).optional()
|
|
69391
|
-
});
|
|
69392
|
-
/**
|
|
69393
|
-
* Patch one connection. Omitted or empty `clientSecret` keeps the stored
|
|
69394
|
-
* secret (D787). `{ $secretClear: true }` clears it. `id` is never renamed.
|
|
69395
|
-
*/
|
|
69396
|
-
var OidcConnectionUpdateInputSchema = object({
|
|
69397
|
-
id: string().min(1),
|
|
69398
|
-
displayName: string().min(1),
|
|
69399
|
-
icon: string().optional(),
|
|
69400
|
-
issuerUrl: string().optional(),
|
|
69401
|
-
clientId: string().optional(),
|
|
69402
|
-
clientSecret: union([string(), object({ $secretClear: literal(true) })]).optional(),
|
|
69403
|
-
redirectUri: string().optional(),
|
|
69404
|
-
scopes: string().optional(),
|
|
69405
|
-
usernameClaim: _enum([
|
|
69406
|
-
"preferred_username",
|
|
69407
|
-
"email",
|
|
69408
|
-
"sub"
|
|
69409
|
-
]).optional()
|
|
69410
|
-
});
|
|
69411
|
-
method(object({}), ConfigSchemaPassthrough$1, { auth: "admin" }), method(object({}), array(OidcConnectionSchema).readonly(), { auth: "admin" }), method(object({
|
|
69412
|
-
id: string().min(1).regex(/^[a-z0-9][a-z0-9-]{0,63}$/, "id must be a lowercase slug"),
|
|
69413
|
-
displayName: string().min(1)
|
|
69414
|
-
}), object({ id: string() }), {
|
|
69415
|
-
kind: "mutation",
|
|
69416
|
-
auth: "admin"
|
|
69417
|
-
}), method(OidcConnectionUpdateInputSchema, object({ ok: literal(true) }), {
|
|
69418
|
-
kind: "mutation",
|
|
69419
|
-
auth: "admin"
|
|
69420
|
-
}), method(object({ id: string().min(1) }), object({ ok: literal(true) }), {
|
|
69421
|
-
kind: "mutation",
|
|
69422
|
-
auth: "admin"
|
|
69423
|
-
});
|
|
69424
|
-
/**
|
|
69425
69549
|
* Generic on-screen-display (video overlay) cap. Each camera exposes
|
|
69426
69550
|
* a firmware-defined list of overlays (channel name, timestamp,
|
|
69427
69551
|
* watermark, logo, …); the cap models them as a homogeneous array of
|
|
@@ -75136,6 +75260,16 @@ var RemoteLayoutComponentSchema = object({
|
|
|
75136
75260
|
method(object({}), array(RemoteLayoutComponentSchema), { auth: "protected" });
|
|
75137
75261
|
var RUNNING_POWER_START_DELAY_MS = 3e4;
|
|
75138
75262
|
var RUNNING_POWER_STOP_DELAY_MS = 18e4;
|
|
75263
|
+
/**
|
|
75264
|
+
* Per-type overrides of the dwell defaults. A media player draws power the
|
|
75265
|
+
* moment it is on and stops drawing the moment it is off, so it needs neither
|
|
75266
|
+
* a long dwell nor a second sample. A type absent here keeps the global values.
|
|
75267
|
+
*/
|
|
75268
|
+
var RUNNING_POWER_DEFAULTS_BY_TYPE = { [DeviceType.MediaPlayer]: {
|
|
75269
|
+
startDwellMs: 1e4,
|
|
75270
|
+
stopDwellMs: 1e4,
|
|
75271
|
+
minSamples: 1
|
|
75272
|
+
} };
|
|
75139
75273
|
/** Before any provider reading — all fields unknown (D933). */
|
|
75140
75274
|
var RUNNING_STATE_COLD = {
|
|
75141
75275
|
running: null,
|
|
@@ -75161,93 +75295,27 @@ var RunningFlipEventDataSchema = object({
|
|
|
75161
75295
|
phase: string().nullable()
|
|
75162
75296
|
});
|
|
75163
75297
|
var RUNNING_DEVICE_TYPES = Object.values(DeviceType);
|
|
75164
|
-
/**
|
|
75165
|
-
|
|
75166
|
-
|
|
75167
|
-
|
|
75168
|
-
|
|
75169
|
-
|
|
75170
|
-
|
|
75171
|
-
|
|
75172
|
-
|
|
75173
|
-
|
|
75174
|
-
|
|
75175
|
-
|
|
75176
|
-
|
|
75177
|
-
|
|
75178
|
-
|
|
75179
|
-
|
|
75180
|
-
|
|
75181
|
-
|
|
75182
|
-
|
|
75183
|
-
|
|
75184
|
-
|
|
75185
|
-
DeviceType.WaterHeater,
|
|
75186
|
-
DeviceType.Humidifier,
|
|
75187
|
-
DeviceType.Fan,
|
|
75188
|
-
DeviceType.Climate,
|
|
75189
|
-
DeviceType.Thermostat,
|
|
75190
|
-
DeviceType.PetFeeder,
|
|
75191
|
-
DeviceType.Heater
|
|
75192
|
-
],
|
|
75193
|
-
apply: "add",
|
|
75194
|
-
path: "running",
|
|
75195
|
-
sources: [
|
|
75196
|
-
{
|
|
75197
|
-
kind: "switch",
|
|
75198
|
-
transforms: [{ kind: "identity" }]
|
|
75199
|
-
},
|
|
75200
|
-
{
|
|
75201
|
-
kind: "binary",
|
|
75202
|
-
transforms: [{ kind: "identity" }, { kind: "invert" }]
|
|
75203
|
-
},
|
|
75204
|
-
{
|
|
75205
|
-
kind: "numeric",
|
|
75206
|
-
requiredUnit: "W",
|
|
75207
|
-
transforms: [{
|
|
75208
|
-
kind: "threshold",
|
|
75209
|
-
comparisons: ["gte", "lte"],
|
|
75210
|
-
comparison: "gte",
|
|
75211
|
-
defaultThreshold: 5,
|
|
75212
|
-
defaultStartDwellMs: RUNNING_POWER_START_DELAY_MS,
|
|
75213
|
-
defaultStopDwellMs: RUNNING_POWER_STOP_DELAY_MS,
|
|
75214
|
-
thresholdUnit: "W"
|
|
75215
|
-
}]
|
|
75216
|
-
}
|
|
75217
|
-
],
|
|
75218
|
-
companions: [
|
|
75219
|
-
{
|
|
75220
|
-
kind: "constant",
|
|
75221
|
-
path: "source",
|
|
75222
|
-
value: "assigned",
|
|
75223
|
-
when: "always"
|
|
75224
|
-
},
|
|
75225
|
-
{
|
|
75226
|
-
kind: "constant",
|
|
75227
|
-
path: "phase",
|
|
75228
|
-
value: null,
|
|
75229
|
-
when: "add"
|
|
75230
|
-
},
|
|
75231
|
-
{
|
|
75232
|
-
kind: "clock",
|
|
75233
|
-
path: "lastFetchedAt",
|
|
75234
|
-
when: "always"
|
|
75235
|
-
},
|
|
75236
|
-
{
|
|
75237
|
-
kind: "transition-time",
|
|
75238
|
-
path: "since",
|
|
75239
|
-
sourceChangedAt: "prefer"
|
|
75240
|
-
}
|
|
75241
|
-
],
|
|
75242
|
-
sourceReport: {
|
|
75243
|
-
status: "assignment-status",
|
|
75244
|
-
runtimeField: "source",
|
|
75245
|
-
nativeValue: "native",
|
|
75246
|
-
assignedValue: "assigned"
|
|
75247
|
-
},
|
|
75248
|
-
advancedExpression: true
|
|
75249
|
-
}]
|
|
75250
|
-
};
|
|
75298
|
+
/**
|
|
75299
|
+
* Customize offers "running" only where a job makes sense (D933): a cycle,
|
|
75300
|
+
* a clean, a mow, playback, or another appliance that is on and working.
|
|
75301
|
+
* The cap itself stays on every type — a camera can still report running
|
|
75302
|
+
* natively; it just has no card.
|
|
75303
|
+
*/
|
|
75304
|
+
var RUNNING_CUSTOMIZE_DEVICE_TYPES = [
|
|
75305
|
+
DeviceType.Washer,
|
|
75306
|
+
DeviceType.Dryer,
|
|
75307
|
+
DeviceType.Dishwasher,
|
|
75308
|
+
DeviceType.Vacuum,
|
|
75309
|
+
DeviceType.LawnMower,
|
|
75310
|
+
DeviceType.MediaPlayer,
|
|
75311
|
+
DeviceType.WaterHeater,
|
|
75312
|
+
DeviceType.Humidifier,
|
|
75313
|
+
DeviceType.Fan,
|
|
75314
|
+
DeviceType.Climate,
|
|
75315
|
+
DeviceType.Thermostat,
|
|
75316
|
+
DeviceType.PetFeeder,
|
|
75317
|
+
DeviceType.Heater
|
|
75318
|
+
];
|
|
75251
75319
|
var runningStateCapability = {
|
|
75252
75320
|
name: "running-state",
|
|
75253
75321
|
scope: "device",
|
|
@@ -75267,7 +75335,79 @@ var runningStateCapability = {
|
|
|
75267
75335
|
durability: "restored",
|
|
75268
75336
|
history: { fields: { running: { kind: "boolean" } } },
|
|
75269
75337
|
volatileStateFields: ["lastFetchedAt"],
|
|
75270
|
-
customize:
|
|
75338
|
+
customize: {
|
|
75339
|
+
version: 1,
|
|
75340
|
+
overridable: [{
|
|
75341
|
+
path: "running",
|
|
75342
|
+
by: "running"
|
|
75343
|
+
}],
|
|
75344
|
+
targets: [{
|
|
75345
|
+
id: "running",
|
|
75346
|
+
cardinality: "scalar",
|
|
75347
|
+
vocabulary: {
|
|
75348
|
+
cap: "running-state",
|
|
75349
|
+
stateField: "running"
|
|
75350
|
+
},
|
|
75351
|
+
deviceTypes: RUNNING_CUSTOMIZE_DEVICE_TYPES,
|
|
75352
|
+
apply: "add",
|
|
75353
|
+
path: "running",
|
|
75354
|
+
sources: [
|
|
75355
|
+
{
|
|
75356
|
+
kind: "switch",
|
|
75357
|
+
transforms: [{ kind: "identity" }]
|
|
75358
|
+
},
|
|
75359
|
+
{
|
|
75360
|
+
kind: "binary",
|
|
75361
|
+
transforms: [{ kind: "identity" }, { kind: "invert" }]
|
|
75362
|
+
},
|
|
75363
|
+
{
|
|
75364
|
+
kind: "numeric",
|
|
75365
|
+
requiredUnit: "W",
|
|
75366
|
+
transforms: [{
|
|
75367
|
+
kind: "threshold",
|
|
75368
|
+
comparisons: ["gte", "lte"],
|
|
75369
|
+
comparison: "gte",
|
|
75370
|
+
defaultThreshold: 5,
|
|
75371
|
+
defaultStartDwellMs: RUNNING_POWER_START_DELAY_MS,
|
|
75372
|
+
defaultStopDwellMs: RUNNING_POWER_STOP_DELAY_MS,
|
|
75373
|
+
deviceTypeDefaults: RUNNING_POWER_DEFAULTS_BY_TYPE,
|
|
75374
|
+
thresholdUnit: "W"
|
|
75375
|
+
}]
|
|
75376
|
+
}
|
|
75377
|
+
],
|
|
75378
|
+
companions: [
|
|
75379
|
+
{
|
|
75380
|
+
kind: "constant",
|
|
75381
|
+
path: "source",
|
|
75382
|
+
value: "assigned",
|
|
75383
|
+
when: "always"
|
|
75384
|
+
},
|
|
75385
|
+
{
|
|
75386
|
+
kind: "constant",
|
|
75387
|
+
path: "phase",
|
|
75388
|
+
value: null,
|
|
75389
|
+
when: "add"
|
|
75390
|
+
},
|
|
75391
|
+
{
|
|
75392
|
+
kind: "clock",
|
|
75393
|
+
path: "lastFetchedAt",
|
|
75394
|
+
when: "always"
|
|
75395
|
+
},
|
|
75396
|
+
{
|
|
75397
|
+
kind: "transition-time",
|
|
75398
|
+
path: "since",
|
|
75399
|
+
sourceChangedAt: "prefer"
|
|
75400
|
+
}
|
|
75401
|
+
],
|
|
75402
|
+
sourceReport: {
|
|
75403
|
+
status: "assignment-status",
|
|
75404
|
+
runtimeField: "source",
|
|
75405
|
+
nativeValue: "native",
|
|
75406
|
+
assignedValue: "assigned"
|
|
75407
|
+
},
|
|
75408
|
+
advancedExpression: true
|
|
75409
|
+
}]
|
|
75410
|
+
}
|
|
75271
75411
|
};
|
|
75272
75412
|
/**
|
|
75273
75413
|
* scene-monitor — device-scoped reference-region state cap. An operator marks
|
|
@@ -76511,21 +76651,6 @@ method(object({
|
|
|
76511
76651
|
*/
|
|
76512
76652
|
ttlSec: union([number().int().positive(), literal("never")]).optional()
|
|
76513
76653
|
}), object({ token: string() }), { auth: "admin" }), method(object({ token: string() }), SsoBridgeClaimsSchema.nullable(), { auth: "admin" });
|
|
76514
|
-
var ProviderListEntrySchema = discriminatedUnion("shouldSaveDiskSpace", [object({
|
|
76515
|
-
providerId: string().min(1),
|
|
76516
|
-
displayName: string().min(1),
|
|
76517
|
-
configSchema: unknown(),
|
|
76518
|
-
nodeLocal: boolean(),
|
|
76519
|
-
shouldSaveDiskSpace: literal(true),
|
|
76520
|
-
minFreePercent: number().min(0).max(100)
|
|
76521
|
-
}), object({
|
|
76522
|
-
providerId: string().min(1),
|
|
76523
|
-
displayName: string().min(1),
|
|
76524
|
-
configSchema: unknown(),
|
|
76525
|
-
nodeLocal: boolean(),
|
|
76526
|
-
shouldSaveDiskSpace: literal(false),
|
|
76527
|
-
minFreePercent: literal(null)
|
|
76528
|
-
})]);
|
|
76529
76654
|
method(object({
|
|
76530
76655
|
location: StorageLocationRefSchema,
|
|
76531
76656
|
relativePath: string()
|
|
@@ -76587,42 +76712,7 @@ method(object({
|
|
|
76587
76712
|
}), _instanceof(Uint8Array), { auth: "admin" }), method(object({ downloadId: string() }), _void(), {
|
|
76588
76713
|
kind: "mutation",
|
|
76589
76714
|
auth: "admin"
|
|
76590
|
-
}), method(object({ type: StorageLocationTypeSchema.optional() }), array(StorageLocationSchema).readonly()), method(_void(), array(StorageLocationDeclarationSchema).readonly()), method(
|
|
76591
|
-
createdAt: true,
|
|
76592
|
-
updatedAt: true
|
|
76593
|
-
}), StorageLocationSchema, {
|
|
76594
|
-
kind: "mutation",
|
|
76595
|
-
auth: "admin"
|
|
76596
|
-
}), method(object({
|
|
76597
|
-
id: string(),
|
|
76598
|
-
force: boolean().optional()
|
|
76599
|
-
}), _void(), {
|
|
76600
|
-
kind: "mutation",
|
|
76601
|
-
auth: "admin"
|
|
76602
|
-
}), method(_void(), array(StorageDrainProgressSchema).readonly()), method(object({ id: string() }), object({
|
|
76603
|
-
ok: boolean(),
|
|
76604
|
-
error: string().optional()
|
|
76605
|
-
}), { auth: "admin" }), method(_void(), array(ProviderListEntrySchema).readonly()), method(object({
|
|
76606
|
-
providerId: string(),
|
|
76607
|
-
/**
|
|
76608
|
-
* The location this config is an UNSAVED edit of, when there is one.
|
|
76609
|
-
*
|
|
76610
|
-
* `listLocations` replaces every declared secret with the redaction
|
|
76611
|
-
* sentinel, so the edit modal's form state holds the sentinel for any
|
|
76612
|
-
* credential the operator did not retype — and posting that here
|
|
76613
|
-
* without a way to resolve it makes the provider try to authenticate
|
|
76614
|
-
* as `__camstack_redacted__` and report the operator's own working
|
|
76615
|
-
* password as wrong. Given this id, the orchestrator restores each
|
|
76616
|
-
* sentinel from the stored config (same rule as `upsertLocation`)
|
|
76617
|
-
* before dispatching. Omitted by the "Add location" wizard, where
|
|
76618
|
-
* every value was typed just now and nothing is stored yet.
|
|
76619
|
-
*/
|
|
76620
|
-
locationId: string().optional(),
|
|
76621
|
-
config: record(string(), unknown())
|
|
76622
|
-
}), object({
|
|
76623
|
-
ok: boolean(),
|
|
76624
|
-
error: string().optional()
|
|
76625
|
-
}), { auth: "admin" });
|
|
76715
|
+
}), method(object({ type: StorageLocationTypeSchema.optional() }), array(StorageLocationSchema).readonly()), method(_void(), array(StorageLocationDeclarationSchema).readonly()), method(_void(), array(StorageDrainProgressSchema).readonly());
|
|
76626
76716
|
/** One table of the settings database. */
|
|
76627
76717
|
var StorageTableSchema = object({
|
|
76628
76718
|
/** The table's full name, e.g. `recorder:addon-settings` or `addon-device-settings`. */
|
|
@@ -78144,7 +78234,7 @@ var TerminalInstanceInfoSchema = object({
|
|
|
78144
78234
|
/**
|
|
78145
78235
|
* False while the node the instance is bound to is not in the cluster
|
|
78146
78236
|
* topology (forgotten, renamed, re-paired). The instance is kept; the
|
|
78147
|
-
* operator re-points it
|
|
78237
|
+
* operator re-points it on the Terminal page.
|
|
78148
78238
|
*/
|
|
78149
78239
|
nodeInCluster: boolean(),
|
|
78150
78240
|
profileId: string(),
|
|
@@ -78182,41 +78272,7 @@ var TerminalOutputBatchSchema = object({
|
|
|
78182
78272
|
snapshot: string().optional(),
|
|
78183
78273
|
events: array(TerminalOutputEventSchema).readonly()
|
|
78184
78274
|
});
|
|
78185
|
-
method(_void(), array(TerminalProfileInfoSchema).readonly(), { auth: "admin" }), method(_void(), array(
|
|
78186
|
-
targetNodeId: string().min(1),
|
|
78187
|
-
profileId: string().min(1),
|
|
78188
|
-
name: string().trim().min(1).max(160).optional(),
|
|
78189
|
-
executable: string().max(1024).optional(),
|
|
78190
|
-
args: array(string().max(2048)).max(64).optional(),
|
|
78191
|
-
cwd: string().max(1024).optional(),
|
|
78192
|
-
environment: array(string().max(4096)).max(64).optional(),
|
|
78193
|
-
profileSettings: ProfileSettingsBagSchema.optional()
|
|
78194
|
-
}), TerminalInstanceInfoSchema, {
|
|
78195
|
-
kind: "mutation",
|
|
78196
|
-
auth: "admin"
|
|
78197
|
-
}), method(object({
|
|
78198
|
-
instanceId: string().min(1),
|
|
78199
|
-
/** Re-point the instance to another node; the profile must exist there. */
|
|
78200
|
-
targetNodeId: string().min(1).max(256).optional(),
|
|
78201
|
-
name: string().trim().min(1).max(160).optional(),
|
|
78202
|
-
executable: string().max(1024).optional(),
|
|
78203
|
-
args: array(string().max(2048)).max(64).optional(),
|
|
78204
|
-
cwd: string().max(1024).optional(),
|
|
78205
|
-
environment: array(string().max(4096)).max(64).optional(),
|
|
78206
|
-
profileSettings: ProfileSettingsBagSchema.optional()
|
|
78207
|
-
}), TerminalInstanceInfoSchema, {
|
|
78208
|
-
kind: "mutation",
|
|
78209
|
-
auth: "admin"
|
|
78210
|
-
}), method(object({ instanceId: string().min(1) }), _void(), {
|
|
78211
|
-
kind: "mutation",
|
|
78212
|
-
auth: "admin"
|
|
78213
|
-
}), method(object({
|
|
78214
|
-
instanceId: string().min(1),
|
|
78215
|
-
enabled: boolean()
|
|
78216
|
-
}), TerminalInstanceInfoSchema, {
|
|
78217
|
-
kind: "mutation",
|
|
78218
|
-
auth: "admin"
|
|
78219
|
-
}), method(_void(), array(TerminalLegacyCameraSchema).readonly(), { auth: "admin" }), method(object({
|
|
78275
|
+
method(_void(), array(TerminalProfileInfoSchema).readonly(), { auth: "admin" }), method(_void(), array(TerminalLegacyCameraSchema).readonly(), { auth: "admin" }), method(object({
|
|
78220
78276
|
stableId: string().min(1),
|
|
78221
78277
|
name: string().trim().min(1).max(160).optional()
|
|
78222
78278
|
}), TerminalInstanceInfoSchema, {
|
|
@@ -78285,6 +78341,11 @@ var TimedRunUnitSchema = _enum(["s", "min"]);
|
|
|
78285
78341
|
_enum(["switch", "pet-fountain"]);
|
|
78286
78342
|
DeviceType.Heater, DeviceType.PetFountain;
|
|
78287
78343
|
var TIMED_RUN_DEVICE_TYPES = [DeviceType.Heater, DeviceType.PetFountain];
|
|
78344
|
+
/** One duration, as the one-tap run asks for it. */
|
|
78345
|
+
var TimedRunQuickRunSchema = object({
|
|
78346
|
+
duration: number().positive().finite(),
|
|
78347
|
+
unit: TimedRunUnitSchema
|
|
78348
|
+
});
|
|
78288
78349
|
/** Why a request was not carried out. Typed, so a caller can say it in words. */
|
|
78289
78350
|
var TimedRunRefusalSchema = _enum([
|
|
78290
78351
|
"unsupported-device",
|
|
@@ -78305,8 +78366,23 @@ var TimedRunStatusSchema = object({
|
|
|
78305
78366
|
activeUntil: number().nullable(),
|
|
78306
78367
|
/** Who asked for the run (a user id or an addon id); `null` when nothing is armed or it did not say. */
|
|
78307
78368
|
requestedBy: string().nullable(),
|
|
78369
|
+
/**
|
|
78370
|
+
* The one-tap run of THIS device: what a "Run" button on any surface starts. `null` when
|
|
78371
|
+
* the device is gone or its type has no timed run; a status from before this field
|
|
78372
|
+
* existed has none, and a surface falls back to the type's default.
|
|
78373
|
+
*/
|
|
78374
|
+
quickRun: TimedRunQuickRunSchema.nullable(),
|
|
78308
78375
|
lastFetchedAt: number()
|
|
78309
78376
|
});
|
|
78377
|
+
/** What the settings form needs: the unit, the bounds and the type's default. */
|
|
78378
|
+
var TimedRunOptionsSchema = object({
|
|
78379
|
+
unit: TimedRunUnitSchema,
|
|
78380
|
+
/** The longest run, in `unit`. */
|
|
78381
|
+
maxDuration: number(),
|
|
78382
|
+
defaultDuration: number()
|
|
78383
|
+
});
|
|
78384
|
+
/** The one-tap run duration, in the type's unit; `null` returns to the type's default. */
|
|
78385
|
+
var TimedRunSettingsPatchSchema = object({ quickRunDuration: number().positive().finite().nullable().optional() });
|
|
78310
78386
|
var timedRunCapability = {
|
|
78311
78387
|
name: "timed-run",
|
|
78312
78388
|
scope: "device",
|
|
@@ -78314,7 +78390,24 @@ var timedRunCapability = {
|
|
|
78314
78390
|
kind: "wrapper",
|
|
78315
78391
|
defaultActive: true,
|
|
78316
78392
|
deviceTypes: TIMED_RUN_DEVICE_TYPES,
|
|
78393
|
+
deviceConfig: { ui: {
|
|
78394
|
+
kind: "derived-form",
|
|
78395
|
+
builderId: "timed-run",
|
|
78396
|
+
tab: "general"
|
|
78397
|
+
} },
|
|
78317
78398
|
methods: {
|
|
78399
|
+
getOptions: method(object({ deviceId: number().int() }), TimedRunOptionsSchema),
|
|
78400
|
+
/**
|
|
78401
|
+
* The one-tap run of this device. A duration above the type's maximum is
|
|
78402
|
+
* REFUSED (thrown), like `runFor`: the maximum is a safety bound.
|
|
78403
|
+
*/
|
|
78404
|
+
setSettings: method(object({
|
|
78405
|
+
deviceId: number().int(),
|
|
78406
|
+
settings: TimedRunSettingsPatchSchema
|
|
78407
|
+
}), _void(), {
|
|
78408
|
+
kind: "mutation",
|
|
78409
|
+
auth: "admin"
|
|
78410
|
+
}),
|
|
78318
78411
|
/**
|
|
78319
78412
|
* Turn the device on and arm its off. A run already armed is replaced (the
|
|
78320
78413
|
* new deadline wins). Refuses with a typed reason above the type's maximum.
|
|
@@ -83046,21 +83139,28 @@ Object.freeze({
|
|
|
83046
83139
|
access: "view",
|
|
83047
83140
|
role: "admin"
|
|
83048
83141
|
},
|
|
83049
|
-
"addonSettings.
|
|
83142
|
+
"addonSettings.getIntegrationFormSchema": {
|
|
83050
83143
|
capName: "addon-settings",
|
|
83051
83144
|
capScope: "system",
|
|
83052
83145
|
addonId: null,
|
|
83053
83146
|
access: "view",
|
|
83054
83147
|
role: "admin"
|
|
83055
83148
|
},
|
|
83056
|
-
"addonSettings.
|
|
83149
|
+
"addonSettings.getScopedSettings": {
|
|
83150
|
+
capName: "addon-settings",
|
|
83151
|
+
capScope: "system",
|
|
83152
|
+
addonId: null,
|
|
83153
|
+
access: "view",
|
|
83154
|
+
role: "admin"
|
|
83155
|
+
},
|
|
83156
|
+
"addonSettings.listScopedSettings": {
|
|
83057
83157
|
capName: "addon-settings",
|
|
83058
83158
|
capScope: "system",
|
|
83059
83159
|
addonId: null,
|
|
83060
83160
|
access: "view",
|
|
83061
83161
|
role: "admin"
|
|
83062
83162
|
},
|
|
83063
|
-
"addonSettings.
|
|
83163
|
+
"addonSettings.readScopedValues": {
|
|
83064
83164
|
capName: "addon-settings",
|
|
83065
83165
|
capScope: "system",
|
|
83066
83166
|
addonId: null,
|
|
@@ -83081,7 +83181,7 @@ Object.freeze({
|
|
|
83081
83181
|
access: "create",
|
|
83082
83182
|
role: "admin"
|
|
83083
83183
|
},
|
|
83084
|
-
"addonSettings.
|
|
83184
|
+
"addonSettings.updateScopedSettings": {
|
|
83085
83185
|
capName: "addon-settings",
|
|
83086
83186
|
capScope: "system",
|
|
83087
83187
|
addonId: null,
|
|
@@ -85251,6 +85351,13 @@ Object.freeze({
|
|
|
85251
85351
|
access: "create",
|
|
85252
85352
|
role: "admin"
|
|
85253
85353
|
},
|
|
85354
|
+
"deviceManager.setAlias": {
|
|
85355
|
+
capName: "device-manager",
|
|
85356
|
+
capScope: "system",
|
|
85357
|
+
addonId: null,
|
|
85358
|
+
access: "create",
|
|
85359
|
+
role: "admin"
|
|
85360
|
+
},
|
|
85254
85361
|
"deviceManager.setChildLayout": {
|
|
85255
85362
|
capName: "device-manager",
|
|
85256
85363
|
capScope: "system",
|
|
@@ -86539,13 +86646,6 @@ Object.freeze({
|
|
|
86539
86646
|
access: "delete",
|
|
86540
86647
|
role: "admin"
|
|
86541
86648
|
},
|
|
86542
|
-
"llm.deleteProfile": {
|
|
86543
|
-
capName: "llm",
|
|
86544
|
-
capScope: "system",
|
|
86545
|
-
addonId: null,
|
|
86546
|
-
access: "delete",
|
|
86547
|
-
role: "admin"
|
|
86548
|
-
},
|
|
86549
86649
|
"llm.generate": {
|
|
86550
86650
|
capName: "llm",
|
|
86551
86651
|
capScope: "system",
|
|
@@ -86609,20 +86709,6 @@ Object.freeze({
|
|
|
86609
86709
|
access: "view",
|
|
86610
86710
|
role: "admin"
|
|
86611
86711
|
},
|
|
86612
|
-
"llm.listProfileKinds": {
|
|
86613
|
-
capName: "llm",
|
|
86614
|
-
capScope: "system",
|
|
86615
|
-
addonId: null,
|
|
86616
|
-
access: "view",
|
|
86617
|
-
role: "admin"
|
|
86618
|
-
},
|
|
86619
|
-
"llm.listProfiles": {
|
|
86620
|
-
capName: "llm",
|
|
86621
|
-
capScope: "system",
|
|
86622
|
-
addonId: null,
|
|
86623
|
-
access: "view",
|
|
86624
|
-
role: "admin"
|
|
86625
|
-
},
|
|
86626
86712
|
"llm.listRuntimeNodes": {
|
|
86627
86713
|
capName: "llm",
|
|
86628
86714
|
capScope: "system",
|
|
@@ -86630,13 +86716,6 @@ Object.freeze({
|
|
|
86630
86716
|
access: "view",
|
|
86631
86717
|
role: "admin"
|
|
86632
86718
|
},
|
|
86633
|
-
"llm.migrateRawSecrets": {
|
|
86634
|
-
capName: "llm",
|
|
86635
|
-
capScope: "system",
|
|
86636
|
-
addonId: null,
|
|
86637
|
-
access: "create",
|
|
86638
|
-
role: "admin"
|
|
86639
|
-
},
|
|
86640
86719
|
"llm.resolveModelRef": {
|
|
86641
86720
|
capName: "llm",
|
|
86642
86721
|
capScope: "system",
|
|
@@ -86665,20 +86744,6 @@ Object.freeze({
|
|
|
86665
86744
|
access: "create",
|
|
86666
86745
|
role: "admin"
|
|
86667
86746
|
},
|
|
86668
|
-
"llm.testProfile": {
|
|
86669
|
-
capName: "llm",
|
|
86670
|
-
capScope: "system",
|
|
86671
|
-
addonId: null,
|
|
86672
|
-
access: "create",
|
|
86673
|
-
role: "admin"
|
|
86674
|
-
},
|
|
86675
|
-
"llm.upsertProfile": {
|
|
86676
|
-
capName: "llm",
|
|
86677
|
-
capScope: "system",
|
|
86678
|
-
addonId: null,
|
|
86679
|
-
access: "create",
|
|
86680
|
-
role: "admin"
|
|
86681
|
-
},
|
|
86682
86747
|
"llmRuntime.appleAvailability": {
|
|
86683
86748
|
capName: "llm-runtime",
|
|
86684
86749
|
capScope: "system",
|
|
@@ -87183,13 +87248,6 @@ Object.freeze({
|
|
|
87183
87248
|
access: "create",
|
|
87184
87249
|
role: "admin"
|
|
87185
87250
|
},
|
|
87186
|
-
"meshNetwork.testConnection": {
|
|
87187
|
-
capName: "mesh-network",
|
|
87188
|
-
capScope: "system",
|
|
87189
|
-
addonId: null,
|
|
87190
|
-
access: "create",
|
|
87191
|
-
role: "admin"
|
|
87192
|
-
},
|
|
87193
87251
|
"meter.getStatus": {
|
|
87194
87252
|
capName: "meter",
|
|
87195
87253
|
capScope: "device",
|
|
@@ -87848,13 +87906,6 @@ Object.freeze({
|
|
|
87848
87906
|
access: "create",
|
|
87849
87907
|
role: "admin"
|
|
87850
87908
|
},
|
|
87851
|
-
"notificationOutput.deleteTarget": {
|
|
87852
|
-
capName: "notification-output",
|
|
87853
|
-
capScope: "system",
|
|
87854
|
-
addonId: null,
|
|
87855
|
-
access: "delete",
|
|
87856
|
-
role: "admin"
|
|
87857
|
-
},
|
|
87858
87909
|
"notificationOutput.discoverTargets": {
|
|
87859
87910
|
capName: "notification-output",
|
|
87860
87911
|
capScope: "system",
|
|
@@ -87862,13 +87913,6 @@ Object.freeze({
|
|
|
87862
87913
|
access: "view",
|
|
87863
87914
|
role: "admin"
|
|
87864
87915
|
},
|
|
87865
|
-
"notificationOutput.getTarget": {
|
|
87866
|
-
capName: "notification-output",
|
|
87867
|
-
capScope: "system",
|
|
87868
|
-
addonId: null,
|
|
87869
|
-
access: "view",
|
|
87870
|
-
role: "admin"
|
|
87871
|
-
},
|
|
87872
87916
|
"notificationOutput.listTargetKinds": {
|
|
87873
87917
|
capName: "notification-output",
|
|
87874
87918
|
capScope: "system",
|
|
@@ -87876,13 +87920,6 @@ Object.freeze({
|
|
|
87876
87920
|
access: "view",
|
|
87877
87921
|
role: "admin"
|
|
87878
87922
|
},
|
|
87879
|
-
"notificationOutput.listTargets": {
|
|
87880
|
-
capName: "notification-output",
|
|
87881
|
-
capScope: "system",
|
|
87882
|
-
addonId: null,
|
|
87883
|
-
access: "view",
|
|
87884
|
-
role: "admin"
|
|
87885
|
-
},
|
|
87886
87923
|
"notificationOutput.probeTargetConfig": {
|
|
87887
87924
|
capName: "notification-output",
|
|
87888
87925
|
capScope: "system",
|
|
@@ -87897,13 +87934,6 @@ Object.freeze({
|
|
|
87897
87934
|
access: "create",
|
|
87898
87935
|
role: "admin"
|
|
87899
87936
|
},
|
|
87900
|
-
"notificationOutput.setTargetEnabled": {
|
|
87901
|
-
capName: "notification-output",
|
|
87902
|
-
capScope: "system",
|
|
87903
|
-
addonId: null,
|
|
87904
|
-
access: "create",
|
|
87905
|
-
role: "admin"
|
|
87906
|
-
},
|
|
87907
87937
|
"notificationOutput.testTarget": {
|
|
87908
87938
|
capName: "notification-output",
|
|
87909
87939
|
capScope: "system",
|
|
@@ -87911,13 +87941,6 @@ Object.freeze({
|
|
|
87911
87941
|
access: "create",
|
|
87912
87942
|
role: "admin"
|
|
87913
87943
|
},
|
|
87914
|
-
"notificationOutput.upsertTarget": {
|
|
87915
|
-
capName: "notification-output",
|
|
87916
|
-
capScope: "system",
|
|
87917
|
-
addonId: null,
|
|
87918
|
-
access: "create",
|
|
87919
|
-
role: "admin"
|
|
87920
|
-
},
|
|
87921
87944
|
"notificationRules.activateAlarmProfile": {
|
|
87922
87945
|
capName: "notification-rules",
|
|
87923
87946
|
capScope: "system",
|
|
@@ -88177,41 +88200,6 @@ Object.freeze({
|
|
|
88177
88200
|
access: "view",
|
|
88178
88201
|
role: "admin"
|
|
88179
88202
|
},
|
|
88180
|
-
"oidcConnections.connectionFormSchema": {
|
|
88181
|
-
capName: "oidc-connections",
|
|
88182
|
-
capScope: "system",
|
|
88183
|
-
addonId: null,
|
|
88184
|
-
access: "view",
|
|
88185
|
-
role: "admin"
|
|
88186
|
-
},
|
|
88187
|
-
"oidcConnections.createConnection": {
|
|
88188
|
-
capName: "oidc-connections",
|
|
88189
|
-
capScope: "system",
|
|
88190
|
-
addonId: null,
|
|
88191
|
-
access: "create",
|
|
88192
|
-
role: "admin"
|
|
88193
|
-
},
|
|
88194
|
-
"oidcConnections.deleteConnection": {
|
|
88195
|
-
capName: "oidc-connections",
|
|
88196
|
-
capScope: "system",
|
|
88197
|
-
addonId: null,
|
|
88198
|
-
access: "delete",
|
|
88199
|
-
role: "admin"
|
|
88200
|
-
},
|
|
88201
|
-
"oidcConnections.listConnections": {
|
|
88202
|
-
capName: "oidc-connections",
|
|
88203
|
-
capScope: "system",
|
|
88204
|
-
addonId: null,
|
|
88205
|
-
access: "view",
|
|
88206
|
-
role: "admin"
|
|
88207
|
-
},
|
|
88208
|
-
"oidcConnections.updateConnection": {
|
|
88209
|
-
capName: "oidc-connections",
|
|
88210
|
-
capScope: "system",
|
|
88211
|
-
addonId: null,
|
|
88212
|
-
access: "create",
|
|
88213
|
-
role: "admin"
|
|
88214
|
-
},
|
|
88215
88203
|
"osd.getStatus": {
|
|
88216
88204
|
capName: "osd",
|
|
88217
88205
|
capScope: "device",
|
|
@@ -91243,13 +91231,6 @@ Object.freeze({
|
|
|
91243
91231
|
access: "delete",
|
|
91244
91232
|
role: "admin"
|
|
91245
91233
|
},
|
|
91246
|
-
"storage.deleteLocation": {
|
|
91247
|
-
capName: "storage",
|
|
91248
|
-
capScope: "system",
|
|
91249
|
-
addonId: null,
|
|
91250
|
-
access: "delete",
|
|
91251
|
-
role: "admin"
|
|
91252
|
-
},
|
|
91253
91234
|
"storage.endDownload": {
|
|
91254
91235
|
capName: "storage",
|
|
91255
91236
|
capScope: "system",
|
|
@@ -91306,13 +91287,6 @@ Object.freeze({
|
|
|
91306
91287
|
access: "view",
|
|
91307
91288
|
role: "admin"
|
|
91308
91289
|
},
|
|
91309
|
-
"storage.listProviders": {
|
|
91310
|
-
capName: "storage",
|
|
91311
|
-
capScope: "system",
|
|
91312
|
-
addonId: null,
|
|
91313
|
-
access: "view",
|
|
91314
|
-
role: "admin"
|
|
91315
|
-
},
|
|
91316
91290
|
"storage.read": {
|
|
91317
91291
|
capName: "storage",
|
|
91318
91292
|
capScope: "system",
|
|
@@ -91334,27 +91308,6 @@ Object.freeze({
|
|
|
91334
91308
|
access: "view",
|
|
91335
91309
|
role: "admin"
|
|
91336
91310
|
},
|
|
91337
|
-
"storage.testConfig": {
|
|
91338
|
-
capName: "storage",
|
|
91339
|
-
capScope: "system",
|
|
91340
|
-
addonId: null,
|
|
91341
|
-
access: "view",
|
|
91342
|
-
role: "admin"
|
|
91343
|
-
},
|
|
91344
|
-
"storage.testLocation": {
|
|
91345
|
-
capName: "storage",
|
|
91346
|
-
capScope: "system",
|
|
91347
|
-
addonId: null,
|
|
91348
|
-
access: "view",
|
|
91349
|
-
role: "admin"
|
|
91350
|
-
},
|
|
91351
|
-
"storage.upsertLocation": {
|
|
91352
|
-
capName: "storage",
|
|
91353
|
-
capScope: "system",
|
|
91354
|
-
addonId: null,
|
|
91355
|
-
access: "create",
|
|
91356
|
-
role: "admin"
|
|
91357
|
-
},
|
|
91358
91311
|
"storage.write": {
|
|
91359
91312
|
capName: "storage",
|
|
91360
91313
|
capScope: "system",
|
|
@@ -92132,27 +92085,6 @@ Object.freeze({
|
|
|
92132
92085
|
access: "create",
|
|
92133
92086
|
role: "admin"
|
|
92134
92087
|
},
|
|
92135
|
-
"terminalSession.createInstance": {
|
|
92136
|
-
capName: "terminal-session",
|
|
92137
|
-
capScope: "system",
|
|
92138
|
-
addonId: null,
|
|
92139
|
-
access: "create",
|
|
92140
|
-
role: "admin"
|
|
92141
|
-
},
|
|
92142
|
-
"terminalSession.deleteInstance": {
|
|
92143
|
-
capName: "terminal-session",
|
|
92144
|
-
capScope: "system",
|
|
92145
|
-
addonId: null,
|
|
92146
|
-
access: "delete",
|
|
92147
|
-
role: "admin"
|
|
92148
|
-
},
|
|
92149
|
-
"terminalSession.listInstances": {
|
|
92150
|
-
capName: "terminal-session",
|
|
92151
|
-
capScope: "system",
|
|
92152
|
-
addonId: null,
|
|
92153
|
-
access: "view",
|
|
92154
|
-
role: "admin"
|
|
92155
|
-
},
|
|
92156
92088
|
"terminalSession.listLegacyCameras": {
|
|
92157
92089
|
capName: "terminal-session",
|
|
92158
92090
|
capScope: "system",
|
|
@@ -92195,20 +92127,6 @@ Object.freeze({
|
|
|
92195
92127
|
access: "create",
|
|
92196
92128
|
role: "admin"
|
|
92197
92129
|
},
|
|
92198
|
-
"terminalSession.setInstanceEnabled": {
|
|
92199
|
-
capName: "terminal-session",
|
|
92200
|
-
capScope: "system",
|
|
92201
|
-
addonId: null,
|
|
92202
|
-
access: "create",
|
|
92203
|
-
role: "admin"
|
|
92204
|
-
},
|
|
92205
|
-
"terminalSession.updateInstance": {
|
|
92206
|
-
capName: "terminal-session",
|
|
92207
|
-
capScope: "system",
|
|
92208
|
-
addonId: null,
|
|
92209
|
-
access: "create",
|
|
92210
|
-
role: "admin"
|
|
92211
|
-
},
|
|
92212
92130
|
"terminalSession.writeInput": {
|
|
92213
92131
|
capName: "terminal-session",
|
|
92214
92132
|
capScope: "system",
|
|
@@ -92223,6 +92141,13 @@ Object.freeze({
|
|
|
92223
92141
|
access: "create",
|
|
92224
92142
|
role: "viewer"
|
|
92225
92143
|
},
|
|
92144
|
+
"timedRun.getOptions": {
|
|
92145
|
+
capName: "timed-run",
|
|
92146
|
+
capScope: "device",
|
|
92147
|
+
addonId: null,
|
|
92148
|
+
access: "view",
|
|
92149
|
+
role: "viewer"
|
|
92150
|
+
},
|
|
92226
92151
|
"timedRun.getStatus": {
|
|
92227
92152
|
capName: "timed-run",
|
|
92228
92153
|
capScope: "device",
|
|
@@ -92237,6 +92162,13 @@ Object.freeze({
|
|
|
92237
92162
|
access: "create",
|
|
92238
92163
|
role: "viewer"
|
|
92239
92164
|
},
|
|
92165
|
+
"timedRun.setSettings": {
|
|
92166
|
+
capName: "timed-run",
|
|
92167
|
+
capScope: "device",
|
|
92168
|
+
addonId: null,
|
|
92169
|
+
access: "create",
|
|
92170
|
+
role: "admin"
|
|
92171
|
+
},
|
|
92240
92172
|
"toast.onToast": {
|
|
92241
92173
|
capName: "toast",
|
|
92242
92174
|
capScope: "system",
|
|
@@ -93167,6 +93099,7 @@ function offered(received) {
|
|
|
93167
93099
|
};
|
|
93168
93100
|
}
|
|
93169
93101
|
offered(HA_AS), withheld(HOMEKIT_REASON), withheld(ALEXA_REASON), withheld(GOOGLE_REASON), withheld(MATTER_REASON);
|
|
93102
|
+
string().min(1).max(4096);
|
|
93170
93103
|
Object.freeze({
|
|
93171
93104
|
"accessories.getStatus": [{
|
|
93172
93105
|
name: "deviceId",
|
|
@@ -93850,6 +93783,11 @@ Object.freeze({
|
|
|
93850
93783
|
form: "single",
|
|
93851
93784
|
optional: false
|
|
93852
93785
|
}],
|
|
93786
|
+
"deviceManager.setAlias": [{
|
|
93787
|
+
name: "deviceId",
|
|
93788
|
+
form: "single",
|
|
93789
|
+
optional: false
|
|
93790
|
+
}],
|
|
93853
93791
|
"deviceManager.setChildLayout": [{
|
|
93854
93792
|
name: "deviceId",
|
|
93855
93793
|
form: "single",
|
|
@@ -95914,6 +95852,11 @@ Object.freeze({
|
|
|
95914
95852
|
form: "single",
|
|
95915
95853
|
optional: false
|
|
95916
95854
|
}],
|
|
95855
|
+
"timedRun.getOptions": [{
|
|
95856
|
+
name: "deviceId",
|
|
95857
|
+
form: "single",
|
|
95858
|
+
optional: false
|
|
95859
|
+
}],
|
|
95917
95860
|
"timedRun.getStatus": [{
|
|
95918
95861
|
name: "deviceId",
|
|
95919
95862
|
form: "single",
|
|
@@ -95924,6 +95867,11 @@ Object.freeze({
|
|
|
95924
95867
|
form: "single",
|
|
95925
95868
|
optional: false
|
|
95926
95869
|
}],
|
|
95870
|
+
"timedRun.setSettings": [{
|
|
95871
|
+
name: "deviceId",
|
|
95872
|
+
form: "single",
|
|
95873
|
+
optional: false
|
|
95874
|
+
}],
|
|
95927
95875
|
"update.getStatus": [{
|
|
95928
95876
|
name: "deviceId",
|
|
95929
95877
|
form: "single",
|
|
@@ -96786,6 +96734,7 @@ var STATE_SUMMARY_VARS = [
|
|
|
96786
96734
|
[...RULE_TEXT],
|
|
96787
96735
|
[...RULE_TEXT],
|
|
96788
96736
|
[...RULE_TEXT],
|
|
96737
|
+
[...RULE_TEXT],
|
|
96789
96738
|
[...RULE_BODY_ONLY],
|
|
96790
96739
|
[...RULE_TEXT],
|
|
96791
96740
|
([...RULE_TEXT], [...DEVICE_EVENTS]),
|