@camstack/addon-export-hap 1.2.196 → 1.2.198
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/hap-export.addon.js +909 -689
- package/dist/hap-export.addon.mjs +909 -690
- package/package.json +2 -2
package/dist/hap-export.addon.js
CHANGED
|
@@ -852,7 +852,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
852
852
|
return EventCategory;
|
|
853
853
|
}({});
|
|
854
854
|
//#endregion
|
|
855
|
-
//#region ../types/dist/device-type-
|
|
855
|
+
//#region ../types/dist/device-type-DxCT0krO.mjs
|
|
856
856
|
/**
|
|
857
857
|
import { errMsg } from '@camstack/types'
|
|
858
858
|
* Extract a human-readable message from an unknown error value.
|
|
@@ -1014,6 +1014,13 @@ var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
|
|
|
1014
1014
|
* filters that want "all devices with on-motion behaviour".
|
|
1015
1015
|
*/
|
|
1016
1016
|
DeviceFeature["MotionTrigger"] = "motion-trigger";
|
|
1017
|
+
/**
|
|
1018
|
+
* Device can be run for a chosen time and then stopped. Mirrors the
|
|
1019
|
+
* `timed-run` wrapper cap — the cap is bound by the core-blocks addon, not by
|
|
1020
|
+
* a driver, so the flag is derived from the device's bindings
|
|
1021
|
+
* (`featuresOfBoundCaps`). Gates the quick-run control in the viewer.
|
|
1022
|
+
*/
|
|
1023
|
+
DeviceFeature["TimedRun"] = "timed-run";
|
|
1017
1024
|
/** Light supports rgb-triplet color via `color` cap. */
|
|
1018
1025
|
DeviceFeature["LightColorRgb"] = "light-color-rgb";
|
|
1019
1026
|
/** Light supports HSV color via `color` cap. */
|
|
@@ -6048,7 +6055,7 @@ var ZodIssueCode = {
|
|
|
6048
6055
|
var ZodFirstPartyTypeKind;
|
|
6049
6056
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
6050
6057
|
//#endregion
|
|
6051
|
-
//#region ../types/dist/sleep-
|
|
6058
|
+
//#region ../types/dist/sleep-CGPZyzB5.mjs
|
|
6052
6059
|
/**
|
|
6053
6060
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
6054
6061
|
* window to float samples (D455).
|
|
@@ -6412,6 +6419,59 @@ Object.fromEntries([
|
|
|
6412
6419
|
function isValuelessField(field) {
|
|
6413
6420
|
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";
|
|
6414
6421
|
}
|
|
6422
|
+
/**
|
|
6423
|
+
* Base collector: flatten a hydrated `ConfigUISchemaWithValues` into
|
|
6424
|
+
* `key → { value, default }`, recursing through `group` and `sub-tabs`
|
|
6425
|
+
* layout fields. Keeping `value` and `default` SEPARATE (rather than
|
|
6426
|
+
* pre-resolving) lets callers both read the effective value AND detect
|
|
6427
|
+
* overrides (`value` differs from `default`). Structural over `unknown`;
|
|
6428
|
+
* malformed input yields an empty map, never throws.
|
|
6429
|
+
*/
|
|
6430
|
+
function collectHydratedFieldEntries(schema) {
|
|
6431
|
+
const out = /* @__PURE__ */ new Map();
|
|
6432
|
+
if (typeof schema !== "object" || schema === null) return out;
|
|
6433
|
+
const sections = schema.sections;
|
|
6434
|
+
if (!Array.isArray(sections)) return out;
|
|
6435
|
+
for (const section of sections) if (typeof section === "object" && section !== null) collectFieldEntriesInto(section.fields, out);
|
|
6436
|
+
return out;
|
|
6437
|
+
}
|
|
6438
|
+
/** Recursive field walker for {@link collectHydratedFieldEntries}. */
|
|
6439
|
+
function collectFieldEntriesInto(fields, into) {
|
|
6440
|
+
if (!Array.isArray(fields)) return;
|
|
6441
|
+
for (const field of fields) {
|
|
6442
|
+
if (typeof field !== "object" || field === null) continue;
|
|
6443
|
+
const type = field.type;
|
|
6444
|
+
if (type === "group") {
|
|
6445
|
+
collectFieldEntriesInto(field.fields, into);
|
|
6446
|
+
continue;
|
|
6447
|
+
}
|
|
6448
|
+
if (type === "sub-tabs") {
|
|
6449
|
+
const tabs = field.tabs;
|
|
6450
|
+
if (Array.isArray(tabs)) {
|
|
6451
|
+
for (const tab of tabs) if (typeof tab === "object" && tab !== null) collectFieldEntriesInto(tab.fields, into);
|
|
6452
|
+
}
|
|
6453
|
+
continue;
|
|
6454
|
+
}
|
|
6455
|
+
const key = field.key;
|
|
6456
|
+
if (typeof key !== "string" || key.length === 0) continue;
|
|
6457
|
+
if (!("value" in field)) continue;
|
|
6458
|
+
into.set(key, {
|
|
6459
|
+
value: field.value,
|
|
6460
|
+
default: field.default
|
|
6461
|
+
});
|
|
6462
|
+
}
|
|
6463
|
+
}
|
|
6464
|
+
/**
|
|
6465
|
+
* Flatten a hydrated settings payload into `key → EFFECTIVE value`
|
|
6466
|
+
* (`value ?? default`). The read-side inverse of `hydrateSchema` for the
|
|
6467
|
+
* common "just give me the resolved values" case. Built on
|
|
6468
|
+
* {@link collectHydratedFieldEntries}.
|
|
6469
|
+
*/
|
|
6470
|
+
function collectHydratedFieldValues(schema) {
|
|
6471
|
+
const out = /* @__PURE__ */ new Map();
|
|
6472
|
+
for (const [key, entry] of collectHydratedFieldEntries(schema)) out.set(key, entry.value ?? entry.default);
|
|
6473
|
+
return out;
|
|
6474
|
+
}
|
|
6415
6475
|
function hydrateSchema(schema, values, options = {}) {
|
|
6416
6476
|
return {
|
|
6417
6477
|
...schema.tabs ? { tabs: [...schema.tabs] } : {},
|
|
@@ -7211,6 +7271,7 @@ var RecordIntegrationInstances = class {
|
|
|
7211
7271
|
this.secretKeys = topLevelSecretKeys(kind.declaration.secretPaths);
|
|
7212
7272
|
this.secretMaps = secretMapKeys(kind.declaration.secretPaths);
|
|
7213
7273
|
this.nameField = kind.declaration.entry?.nameField ?? "name";
|
|
7274
|
+
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`);
|
|
7214
7275
|
}
|
|
7215
7276
|
/**
|
|
7216
7277
|
* One instance read for the addon's own runtime; null when absent. When the keychain is
|
|
@@ -7252,10 +7313,21 @@ var RecordIntegrationInstances = class {
|
|
|
7252
7313
|
}
|
|
7253
7314
|
return out;
|
|
7254
7315
|
}
|
|
7316
|
+
/** The kind an instance body is of: the provider's `kindOf`, else its one declared kind. */
|
|
7317
|
+
kindOfBody(body) {
|
|
7318
|
+
if (this.hooks.kindOf !== void 0) {
|
|
7319
|
+
const id = this.hooks.kindOf(body);
|
|
7320
|
+
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)`);
|
|
7321
|
+
return id;
|
|
7322
|
+
}
|
|
7323
|
+
const only = this.hooks.description.kinds[0];
|
|
7324
|
+
if (only === void 0) throw new Error(`record kind '${this.kind.name}' declares no kinds`);
|
|
7325
|
+
return only.id;
|
|
7326
|
+
}
|
|
7255
7327
|
viewOf(record) {
|
|
7256
7328
|
const shown = secretViewsOf(this.records.owner, this.kind.name, record.id, this.kind.declaration, record.data);
|
|
7257
7329
|
const rawName = record.data[this.nameField];
|
|
7258
|
-
const kind = this.
|
|
7330
|
+
const kind = this.kindOfBody(record.data);
|
|
7259
7331
|
const health = this.hooks.health?.(record.data, record.id);
|
|
7260
7332
|
return {
|
|
7261
7333
|
id: record.id,
|
|
@@ -7263,7 +7335,7 @@ var RecordIntegrationInstances = class {
|
|
|
7263
7335
|
configured: this.hooks.configured(record.data),
|
|
7264
7336
|
enabled: isInstanceEnabled(record.data),
|
|
7265
7337
|
formValues: shown,
|
|
7266
|
-
|
|
7338
|
+
kind,
|
|
7267
7339
|
...health?.status !== void 0 ? { status: health.status } : {},
|
|
7268
7340
|
...health?.lastCheckedAt !== void 0 ? { lastCheckedAt: health.lastCheckedAt } : {}
|
|
7269
7341
|
};
|
|
@@ -7635,6 +7707,21 @@ var SCOPED_SETTINGS_SCOPES = [
|
|
|
7635
7707
|
"device-defaults",
|
|
7636
7708
|
"node"
|
|
7637
7709
|
];
|
|
7710
|
+
/** The one refusal of a key a scope did not declare. */
|
|
7711
|
+
function assertDeclaredKeys(keys, declared) {
|
|
7712
|
+
const undeclared = keys.filter((key) => !declared.has(key));
|
|
7713
|
+
if (undeclared.length > 0) throw new Error(`scoped settings: [${undeclared.join(", ")}] not declared for this scope (declared: [${[...declared].join(", ")}])`);
|
|
7714
|
+
}
|
|
7715
|
+
/** Build the handle over an addon's scoped read, write and unset. */
|
|
7716
|
+
function createScopedSettings(deps) {
|
|
7717
|
+
return {
|
|
7718
|
+
async get() {
|
|
7719
|
+
return deps.schema.parse(await deps.read());
|
|
7720
|
+
},
|
|
7721
|
+
patch: (patch) => deps.write(Object.fromEntries(Object.entries(patch))),
|
|
7722
|
+
unset: (keys) => deps.unset(keys)
|
|
7723
|
+
};
|
|
7724
|
+
}
|
|
7638
7725
|
/** A write to a secret path could not be stored in the keychain, so it was refused. */
|
|
7639
7726
|
var KeychainWriteRefusedError = class extends Error {
|
|
7640
7727
|
fieldPath;
|
|
@@ -8210,7 +8297,16 @@ function createHandle(raw, opts) {
|
|
|
8210
8297
|
return blob;
|
|
8211
8298
|
}
|
|
8212
8299
|
},
|
|
8213
|
-
writeAddonStore: writeAddon
|
|
8300
|
+
writeAddonStore: writeAddon,
|
|
8301
|
+
removeClearedKeys: (keys) => serialize("addon", async () => {
|
|
8302
|
+
const stored = await readStoredAddonBlob(raw);
|
|
8303
|
+
index.seen("addon", stored);
|
|
8304
|
+
const removable = keys.filter((key) => collectSecretMarkerRefs(stored[key]).length === 0);
|
|
8305
|
+
if (removable.length === 0) return;
|
|
8306
|
+
const patch = Object.fromEntries(removable.map((key) => [key, void 0]));
|
|
8307
|
+
await raw.writeAddonStore(patch);
|
|
8308
|
+
index.wrote("addon", patch);
|
|
8309
|
+
})
|
|
8214
8310
|
};
|
|
8215
8311
|
}
|
|
8216
8312
|
/** The context the addon sees, plus the private raw view and write outcome. */
|
|
@@ -8340,7 +8436,7 @@ function boundOf(list) {
|
|
|
8340
8436
|
* Base class for CamStack addons. Eliminates settings boilerplate:
|
|
8341
8437
|
*
|
|
8342
8438
|
* - Typed `config` property with automatic resolution from store + defaults
|
|
8343
|
-
* -
|
|
8439
|
+
* - the scoped settings API (`clusterSettings` / `nodeSettings` / `deviceDefaults`) auto-implemented
|
|
8344
8440
|
* - `getAddonSettings()` / `updateAddonSettings()` auto-implemented
|
|
8345
8441
|
* - `getDeviceSettings()` / `updateDeviceSettings()` auto-implemented
|
|
8346
8442
|
* - `ctx` accessor for the AddonContext (no manual `this.ctxRef` storage)
|
|
@@ -8350,7 +8446,7 @@ function boundOf(list) {
|
|
|
8350
8446
|
* Subclasses override:
|
|
8351
8447
|
* - `onInitialize()` — addon-specific init logic, return ProviderRegistration[]
|
|
8352
8448
|
* - `onShutdown()` — cleanup
|
|
8353
|
-
* - `
|
|
8449
|
+
* - `clusterSettingsSchema()` / `nodeSettingsSchema()` / `deviceSettingsSchema()` — UI schemas
|
|
8354
8450
|
*
|
|
8355
8451
|
* @example
|
|
8356
8452
|
* ```ts
|
|
@@ -8364,7 +8460,7 @@ function boundOf(list) {
|
|
|
8364
8460
|
* super({ maxRetries: 3, endpoint: 'http://localhost' })
|
|
8365
8461
|
* }
|
|
8366
8462
|
*
|
|
8367
|
-
* protected
|
|
8463
|
+
* protected clusterSettingsSchema() {
|
|
8368
8464
|
* return this.schema({
|
|
8369
8465
|
* sections: [{
|
|
8370
8466
|
* id: 'main', title: 'Settings',
|
|
@@ -8407,7 +8503,7 @@ var BaseAddon = class {
|
|
|
8407
8503
|
defaults;
|
|
8408
8504
|
/**
|
|
8409
8505
|
* Hidden-state paths that hold secrets (D787) — values the addon writes
|
|
8410
|
-
* itself (`
|
|
8506
|
+
* itself (`state()`, the scoped writers) that no form field declares.
|
|
8411
8507
|
* Stored in the keychain exactly like a `password` field. Syntax:
|
|
8412
8508
|
* `'snapshotSigningKey'`, `'identity.pincode'`, `'tokens[userId].accessToken'`
|
|
8413
8509
|
* (`key[<id field>]` addresses array items by id, never by index).
|
|
@@ -8417,7 +8513,7 @@ var BaseAddon = class {
|
|
|
8417
8513
|
/**
|
|
8418
8514
|
* D986 M4: the scoped schemas this addon declared, resolved once per capability
|
|
8419
8515
|
* (`loadScopedSchemas`) so the sync readers (`perNodeKeys`, the secret tree, the restart check)
|
|
8420
|
-
* see them. Empty until loaded
|
|
8516
|
+
* see them. Empty until loaded.
|
|
8421
8517
|
*/
|
|
8422
8518
|
_scopedByCap = /* @__PURE__ */ new Map();
|
|
8423
8519
|
_nodeKeysByCap = /* @__PURE__ */ new Map();
|
|
@@ -8603,7 +8699,7 @@ var BaseAddon = class {
|
|
|
8603
8699
|
/** Addon-specific cleanup. Override if needed. */
|
|
8604
8700
|
async onShutdown() {}
|
|
8605
8701
|
/**
|
|
8606
|
-
* Called after config is resolved during
|
|
8702
|
+
* Called after config is resolved during a settings write.
|
|
8607
8703
|
* Override to react to config changes (e.g. restart a sampler, reconnect a service).
|
|
8608
8704
|
* Not called during initialize() — use onInitialize() for initial setup.
|
|
8609
8705
|
*/
|
|
@@ -8632,82 +8728,12 @@ var BaseAddon = class {
|
|
|
8632
8728
|
scopedSettingsCapabilities() {
|
|
8633
8729
|
return [];
|
|
8634
8730
|
}
|
|
8635
|
-
/** Override to provide global-level settings UI schema. */
|
|
8636
|
-
globalSettingsSchema(_cap) {
|
|
8637
|
-
return null;
|
|
8638
|
-
}
|
|
8639
8731
|
/** Override to provide device-level settings UI schema. */
|
|
8640
8732
|
deviceSettingsSchema() {
|
|
8641
8733
|
return null;
|
|
8642
8734
|
}
|
|
8643
8735
|
/**
|
|
8644
|
-
*
|
|
8645
|
-
* ARE the configuration of its integration.
|
|
8646
|
-
*
|
|
8647
|
-
* Return the `ConfigSection.id`s, from {@link globalSettingsSchema}, that an
|
|
8648
|
-
* operator should find on the addon's integration page (System →
|
|
8649
|
-
* Integrations → <name>) rather than only in the cluster-wide list of every
|
|
8650
|
-
* addon. Empty (the default) means the addon has no integration-level
|
|
8651
|
-
* settings and no such surface is offered — this is opt-in, because whether
|
|
8652
|
-
* an addon's configuration IS its integration's configuration depends on the
|
|
8653
|
-
* nature of the integration.
|
|
8654
|
-
*
|
|
8655
|
-
* WHAT THIS IS NOT. It is not a scope. The selected sections keep living in
|
|
8656
|
-
* the ONE global schema, in the ONE addon store, written by the ONE
|
|
8657
|
-
* `updateGlobalSettings` path. There is deliberately no
|
|
8658
|
-
* `updateIntegrationSettings`: a second write path is how a surface acquires
|
|
8659
|
-
* a second store key, and this repo has shipped that twice (`btmPath@hub`,
|
|
8660
|
-
* D266). Selecting sections cannot introduce a key that selecting cannot.
|
|
8661
|
-
*
|
|
8662
|
-
* WHY IT IS A LIST OF SECTION IDS AND NOT A MARKER ON THE SECTION.
|
|
8663
|
-
* `ConfigFieldBase` used to carry `scope?: 'device' | 'global'` and it was
|
|
8664
|
-
* removed with the reason recorded at
|
|
8665
|
-
* `packages/types/src/interfaces/config-ui.ts:249` — *"a field's scope is
|
|
8666
|
-
* determined by WHICH schema it lives in, not by a field-level marker."* A
|
|
8667
|
-
* marker sprinkled across sections also has to borrow a field that already
|
|
8668
|
-
* means something else; borrowing `section.tab` put the literal word
|
|
8669
|
-
* "integration" into an operator-facing tab bar, because `tab` means "how to
|
|
8670
|
-
* GROUP this visually" and cannot also mean "where this lives" (D269
|
|
8671
|
-
* supersedes D268). One declaration, in one place, next to the schema whose
|
|
8672
|
-
* ids it names.
|
|
8673
|
-
*/
|
|
8674
|
-
integrationSettingSections() {
|
|
8675
|
-
return [];
|
|
8676
|
-
}
|
|
8677
|
-
async getGlobalSettings(overlay, cap, nodeId) {
|
|
8678
|
-
await this.loadScopedSchemas(cap);
|
|
8679
|
-
const schema = this.globalSettingsSchema(cap) ?? this.scopedFormSchema(cap);
|
|
8680
|
-
if (!schema) return { sections: [] };
|
|
8681
|
-
const projected = await this.readRawProjectedStore(nodeId, cap);
|
|
8682
|
-
return hydrateSchema(schema, overlay ? await this.overlayKeepingMarkers(projected, overlay) : projected, { inlineSecretsAsViews: true });
|
|
8683
|
-
}
|
|
8684
|
-
/**
|
|
8685
|
-
* The integration-level view of this addon's settings: exactly the sections
|
|
8686
|
-
* named by {@link integrationSettingSections}, hydrated from the SAME store
|
|
8687
|
-
* `getGlobalSettings` reads, and narrowed to cluster-scoped fields.
|
|
8688
|
-
*
|
|
8689
|
-
* Returns `null` when the addon declared nothing — an addon that opts out has
|
|
8690
|
-
* no integration settings surface at all, rather than an empty one that reads
|
|
8691
|
-
* as a failed load.
|
|
8692
|
-
*
|
|
8693
|
-
* Three properties hold BY CONSTRUCTION, which is why they are here in core
|
|
8694
|
-
* and not in whichever UI happens to render this:
|
|
8695
|
-
*
|
|
8696
|
-
* 1. **One key.** The payload is a SUBSET of the global schema, so a field
|
|
8697
|
-
* shown here is the same field, with the same bare key, that the addon's
|
|
8698
|
-
* own page shows. There is no integration-specific writer — callers save
|
|
8699
|
-
* through `updateGlobalSettings` — so a second store key is unreachable,
|
|
8700
|
-
* not merely discouraged.
|
|
8701
|
-
* 2. **No node scope.** `perNode: true` fields are DROPPED. Their store key
|
|
8702
|
-
* is `<key>@<nodeId>` and an integration is not a node; whichever node
|
|
8703
|
-
* such a field silently picked would be a wrong answer for the operator
|
|
8704
|
-
* who opened the page (D266).
|
|
8705
|
-
* 3. **No silent typo.** A declared id that names no section throws. The
|
|
8706
|
-
* alternative — skip it — turns a rename into a surface that quietly
|
|
8707
|
-
* empties, which looks exactly like an addon with nothing to configure.
|
|
8708
|
-
*/
|
|
8709
|
-
/**
|
|
8710
|
-
* The form schema of ONE integration instance, or `null` to use {@link globalSettingsSchema}.
|
|
8736
|
+
* The form schema of ONE integration instance, or `null` to use the scoped form.
|
|
8711
8737
|
*
|
|
8712
8738
|
* Override it only when an `instanceMode: multiple` addon's instances differ: an NVR integration
|
|
8713
8739
|
* needs its connection fields, the default integration the addon's own sections. It is the
|
|
@@ -8755,37 +8781,178 @@ var BaseAddon = class {
|
|
|
8755
8781
|
}
|
|
8756
8782
|
}
|
|
8757
8783
|
/**
|
|
8784
|
+
* Hook: values layered over the stored ones when the FORM of one scope is served
|
|
8785
|
+
* ({@link getScopedSettings}) — a preview that derives dependent options without writing.
|
|
8786
|
+
* Never applied to {@link ScopedSettings.get} or to a write. `null` ⇒ no overlay.
|
|
8787
|
+
*/
|
|
8788
|
+
async scopedSettingsOverlay(_scope, _cap, _nodeId) {
|
|
8789
|
+
return null;
|
|
8790
|
+
}
|
|
8791
|
+
/**
|
|
8792
|
+
* Hook: a write of one scope changed stored values (not called when the store reports no change,
|
|
8793
|
+
* e.g. the write-back of a stored secret). `keys` are the bare field keys of the write, node keys included.
|
|
8794
|
+
*/
|
|
8795
|
+
async onScopedSettingsChanged(_scope, _cap, _keys) {}
|
|
8796
|
+
/** Typed handle over the CLUSTER settings `cap` declares (`clusterSettingsSchema`). */
|
|
8797
|
+
clusterSettings(cap, schema) {
|
|
8798
|
+
return this.scopedHandle("cluster", cap, schema);
|
|
8799
|
+
}
|
|
8800
|
+
/** Typed handle over the fleet defaults of the per-device settings `cap` declares. */
|
|
8801
|
+
deviceDefaults(cap, schema) {
|
|
8802
|
+
return this.scopedHandle("device-defaults", cap, schema);
|
|
8803
|
+
}
|
|
8804
|
+
/**
|
|
8805
|
+
* Typed handle over the settings `cap` owns PER NODE. `nodeId` omitted ⇒ the local node. A node
|
|
8806
|
+
* with no row yields the schema defaults — never a bare-key fallback.
|
|
8807
|
+
*/
|
|
8808
|
+
nodeSettings(cap, schema, nodeId) {
|
|
8809
|
+
return this.scopedHandle("node", cap, schema, nodeId);
|
|
8810
|
+
}
|
|
8811
|
+
/**
|
|
8812
|
+
* {@link state} for a value that is kept per node: stored under `<key>@<nodeId>`, and the
|
|
8813
|
+
* settings store carries `nodeId` in the row data (D986 §1), so a forgotten node's rows go in one
|
|
8814
|
+
* central delete. `nodeId` omitted ⇒ the local node.
|
|
8815
|
+
*/
|
|
8816
|
+
nodeState(key, schema, fallback, nodeId) {
|
|
8817
|
+
this._declaredStateKeys.add(key);
|
|
8818
|
+
return createDurableState({
|
|
8819
|
+
key: nodeScopedKey(key, nodeId ?? this._ctx?.kernel?.localNodeId ?? ""),
|
|
8820
|
+
schema,
|
|
8821
|
+
fallback,
|
|
8822
|
+
read: async () => this.resolveStoredSecrets(await this.readAddonStoreWithRetry()),
|
|
8823
|
+
write: async (patch) => {
|
|
8824
|
+
await this._ctx?.settings?.writeAddonStore(patch);
|
|
8825
|
+
},
|
|
8826
|
+
onParseError: (k, e) => this._ctx?.logger?.warn?.(`durable-state: stored "${k}" failed validation — using fallback`, { meta: {
|
|
8827
|
+
addonId: this._ctx?.id,
|
|
8828
|
+
key: k,
|
|
8829
|
+
error: String(e)
|
|
8830
|
+
} })
|
|
8831
|
+
});
|
|
8832
|
+
}
|
|
8833
|
+
/** The loaded schema `cap` declares for `scope`, or `null`. */
|
|
8834
|
+
async declaredScopedSchema(scope, cap) {
|
|
8835
|
+
await this.loadScopedSchemas(cap);
|
|
8836
|
+
return this.loadedScopedSchemas(cap).find((entry) => entry.scope === scope)?.schema ?? null;
|
|
8837
|
+
}
|
|
8838
|
+
async requireScopedSchema(scope, cap) {
|
|
8839
|
+
const schema = await this.declaredScopedSchema(scope, cap);
|
|
8840
|
+
if (schema === null) throw new Error(`${this.constructor.name}: cap "${cap}" declares no ${scope} settings`);
|
|
8841
|
+
return schema;
|
|
8842
|
+
}
|
|
8843
|
+
scopedKeys(schema) {
|
|
8844
|
+
return new Set(schema.sections.flatMap((section) => collectValueFieldKeys(section.fields)));
|
|
8845
|
+
}
|
|
8846
|
+
/** `store` narrowed to the keys `schema` declares. */
|
|
8847
|
+
narrowToScope(store, schema) {
|
|
8848
|
+
const keys = this.scopedKeys(schema);
|
|
8849
|
+
return Object.fromEntries(Object.entries(store).filter(([key]) => keys.has(key)));
|
|
8850
|
+
}
|
|
8851
|
+
scopedHandle(scope, cap, schema, nodeId) {
|
|
8852
|
+
return createScopedSettings({
|
|
8853
|
+
schema,
|
|
8854
|
+
read: async () => {
|
|
8855
|
+
const declared = await this.requireScopedSchema(scope, cap);
|
|
8856
|
+
const stored = this.narrowToScope(await this.resolveGlobalStore(nodeId, cap), declared);
|
|
8857
|
+
const effective = collectHydratedFieldValues(hydrateSchema(declared, stored));
|
|
8858
|
+
return {
|
|
8859
|
+
...Object.fromEntries([...effective].filter(([, value]) => value !== void 0)),
|
|
8860
|
+
...stored
|
|
8861
|
+
};
|
|
8862
|
+
},
|
|
8863
|
+
write: (patch) => this.writeScoped(scope, cap, patch, nodeId),
|
|
8864
|
+
unset: (keys) => this.unsetScoped(scope, cap, keys, nodeId)
|
|
8865
|
+
});
|
|
8866
|
+
}
|
|
8867
|
+
/** The one write path of the scoped API: declared keys only, then the global patch. */
|
|
8868
|
+
async writeScoped(scope, cap, patch, nodeId) {
|
|
8869
|
+
assertDeclaredKeys(Object.keys(patch), this.scopedKeys(await this.requireScopedSchema(scope, cap)));
|
|
8870
|
+
if (await this.applyGlobalPatch(patch, scope === "node" ? nodeId : void 0, cap)) await this.onScopedSettingsChanged(scope, cap, Object.keys(patch));
|
|
8871
|
+
}
|
|
8872
|
+
/**
|
|
8873
|
+
* Remove declared keys of one scope. A secret goes through {@link clearSecrets} — its keychain
|
|
8874
|
+
* value is released exactly as there — and the emptied row is then removed; every other key is
|
|
8875
|
+
* removed by an `undefined` patch (which a secret transform would read as "keep").
|
|
8876
|
+
*/
|
|
8877
|
+
async unsetScoped(scope, cap, keys, nodeId) {
|
|
8878
|
+
assertDeclaredKeys(keys, this.scopedKeys(await this.requireScopedSchema(scope, cap)));
|
|
8879
|
+
const target = scope === "node" ? nodeId : void 0;
|
|
8880
|
+
const tree = this.addonSecretTree();
|
|
8881
|
+
const secretKeys = keys.filter((key) => tree.has(key));
|
|
8882
|
+
const plainKeys = keys.filter((key) => !tree.has(key));
|
|
8883
|
+
let changed = false;
|
|
8884
|
+
if (plainKeys.length > 0) {
|
|
8885
|
+
const patch = Object.fromEntries(plainKeys.map((key) => [key, void 0]));
|
|
8886
|
+
changed = await this.applyGlobalPatch(patch, target, cap) || changed;
|
|
8887
|
+
}
|
|
8888
|
+
if (secretKeys.length > 0) {
|
|
8889
|
+
await this.clearSecretKeys(secretKeys, target, cap);
|
|
8890
|
+
const node = normalizeNodeId(target ?? this._ctx?.kernel?.localNodeId);
|
|
8891
|
+
const rows = secretKeys.map((key) => scope === "node" ? nodeScopedKey(key, node) : key);
|
|
8892
|
+
if (this._secretSettings !== null) await this._secretSettings.removeClearedKeys(rows);
|
|
8893
|
+
else await this._ctx?.settings?.writeAddonStore(Object.fromEntries(rows.map((row) => [row, void 0])));
|
|
8894
|
+
changed = true;
|
|
8895
|
+
}
|
|
8896
|
+
if (changed) await this.onScopedSettingsChanged(scope, cap, [...keys]);
|
|
8897
|
+
}
|
|
8898
|
+
/**
|
|
8899
|
+
* The hydrated form of one scope of one capability's settings (any
|
|
8900
|
+
* {@link scopedSettingsOverlay} applied), or `null` when the capability declares nothing there.
|
|
8901
|
+
*/
|
|
8902
|
+
async getScopedSettings(scope, cap, nodeId) {
|
|
8903
|
+
const schema = await this.declaredScopedSchema(scope, cap);
|
|
8904
|
+
if (schema === null) return null;
|
|
8905
|
+
const stored = this.narrowToScope(await this.readRawProjectedStore(nodeId, cap), schema);
|
|
8906
|
+
const overlay = await this.scopedSettingsOverlay(scope, cap, nodeId);
|
|
8907
|
+
return hydrateSchema(schema, overlay ? await this.overlayKeepingMarkers(stored, overlay) : stored, { inlineSecretsAsViews: true });
|
|
8908
|
+
}
|
|
8909
|
+
/**
|
|
8910
|
+
* The scoped schemas this addon serves: one entry per loaded (capability, scope), capabilities
|
|
8911
|
+
* in declaration order, scopes in {@link SCOPED_SETTINGS_SCOPES} order. `[]` when it declares
|
|
8912
|
+
* nothing.
|
|
8913
|
+
*/
|
|
8914
|
+
async listScopedSettings() {
|
|
8915
|
+
await this.loadScopedSchemas();
|
|
8916
|
+
return [...this._scopedByCap].flatMap(([cap, entries]) => entries.map((entry) => ({
|
|
8917
|
+
cap,
|
|
8918
|
+
scope: entry.scope,
|
|
8919
|
+
sectionIds: entry.schema.sections.map((section) => section.id)
|
|
8920
|
+
})));
|
|
8921
|
+
}
|
|
8922
|
+
/** The OPERATOR's write of declared keys of one scope (D787 secret semantics). */
|
|
8923
|
+
async updateScopedSettings(scope, cap, patch, nodeId) {
|
|
8924
|
+
this._operatorWriteDepth++;
|
|
8925
|
+
try {
|
|
8926
|
+
await this.writeScoped(scope, cap, patch, nodeId);
|
|
8927
|
+
} finally {
|
|
8928
|
+
this._operatorWriteDepth--;
|
|
8929
|
+
}
|
|
8930
|
+
}
|
|
8931
|
+
/**
|
|
8932
|
+
* The effective values (`stored ?? default`) of one scope, a secret as its `set` view — never
|
|
8933
|
+
* its value. `null` when the capability declares nothing for the scope.
|
|
8934
|
+
*/
|
|
8935
|
+
async readScopedValues(scope, cap, nodeId) {
|
|
8936
|
+
const schema = await this.declaredScopedSchema(scope, cap);
|
|
8937
|
+
if (schema === null) return null;
|
|
8938
|
+
const form = hydrateSchema(schema, this.narrowToScope(await this.readRawProjectedStore(nodeId, cap), schema), { inlineSecretsAsViews: true });
|
|
8939
|
+
return Object.fromEntries([...collectHydratedFieldValues(form)].filter(([, value]) => value !== void 0));
|
|
8940
|
+
}
|
|
8941
|
+
/**
|
|
8758
8942
|
* What the create wizard and the integration edit page render for one instance: the addon's
|
|
8759
8943
|
* per-instance schema when it declares one, else its global schema (what they always showed).
|
|
8760
8944
|
*/
|
|
8761
8945
|
async getIntegrationFormSchema(instance, nodeId) {
|
|
8762
8946
|
const scoped = await this.integrationFormSchema(instance);
|
|
8763
|
-
if (scoped === null) return this.
|
|
8947
|
+
if (scoped === null) return this.scopedForm(nodeId);
|
|
8764
8948
|
return hydrateSchema(scoped, {}, { inlineSecretsAsViews: true });
|
|
8765
8949
|
}
|
|
8766
|
-
|
|
8767
|
-
|
|
8768
|
-
|
|
8769
|
-
const schema = this.
|
|
8770
|
-
if (!schema)
|
|
8771
|
-
|
|
8772
|
-
const sections = [];
|
|
8773
|
-
for (const id of declared) {
|
|
8774
|
-
const section = byId.get(id);
|
|
8775
|
-
if (!section) throw new Error(`${this.constructor.name}: integrationSettingSections() names unknown section "${id}". Known sections: [${[...byId.keys()].join(", ")}].`);
|
|
8776
|
-
const fields = dropPerNodeFields(section.fields);
|
|
8777
|
-
if (fields.length === 0) continue;
|
|
8778
|
-
sections.push({
|
|
8779
|
-
...section,
|
|
8780
|
-
fields
|
|
8781
|
-
});
|
|
8782
|
-
}
|
|
8783
|
-
if (sections.length === 0) return null;
|
|
8784
|
-
const projected = await this.readRawProjectedStore(nodeId);
|
|
8785
|
-
return hydrateSchema({
|
|
8786
|
-
...schema,
|
|
8787
|
-
sections
|
|
8788
|
-
}, projected, { inlineSecretsAsViews: true });
|
|
8950
|
+
/** The form of the scoped schemas this addon declared, hydrated from its store. */
|
|
8951
|
+
async scopedForm(nodeId) {
|
|
8952
|
+
await this.loadScopedSchemas();
|
|
8953
|
+
const schema = this.scopedFormSchema();
|
|
8954
|
+
if (!schema) return { sections: [] };
|
|
8955
|
+
return hydrateSchema(schema, await this.readRawProjectedStore(nodeId), { inlineSecretsAsViews: true });
|
|
8789
8956
|
}
|
|
8790
8957
|
/**
|
|
8791
8958
|
* The raw addon store PROJECTED onto the target node's bare per-node keys:
|
|
@@ -8794,8 +8961,8 @@ var BaseAddon = class {
|
|
|
8794
8961
|
* bare fallback), all `@`-scoped and stray bare per-node keys are dropped.
|
|
8795
8962
|
* A no-op passthrough when the schema declares no `perNode` field.
|
|
8796
8963
|
*
|
|
8797
|
-
* This is the sanctioned way for
|
|
8798
|
-
* the store for custom
|
|
8964
|
+
* This is the sanctioned way for an addon that needs
|
|
8965
|
+
* the store for custom logic (option narrowing, value snapping) to
|
|
8799
8966
|
* read it per-node — never `ctx.settings.readAddonStore()` directly.
|
|
8800
8967
|
* `nodeId` omitted ⇒ the local node (node-blind injection from ctx).
|
|
8801
8968
|
*
|
|
@@ -8847,7 +9014,7 @@ var BaseAddon = class {
|
|
|
8847
9014
|
}
|
|
8848
9015
|
/**
|
|
8849
9016
|
* Whether ONE global key of this addon's store was written, read three-way
|
|
8850
|
-
* (D651). For a question a hydrated view cannot answer:
|
|
9017
|
+
* (D651). For a question a hydrated view cannot answer: a hydrated form
|
|
8851
9018
|
* reports `value ?? default`, so "the operator chose the default" and "nobody
|
|
8852
9019
|
* chose" look the same, and a failed read looks like both. A `perNode` key is
|
|
8853
9020
|
* not supported here: its stored name is scoped.
|
|
@@ -8881,7 +9048,7 @@ var BaseAddon = class {
|
|
|
8881
9048
|
}
|
|
8882
9049
|
/**
|
|
8883
9050
|
* The OPERATOR's write — a settings form or an admin API call, dispatched by
|
|
8884
|
-
* the kernel.
|
|
9051
|
+
* the kernel. The one in-process write of the addon blob that is not a scoped write; a secret
|
|
8885
9052
|
* the operator sends is stored as sent even when it equals a pre-keychain
|
|
8886
9053
|
* inline value: the operator re-entering a password is a change, an addon
|
|
8887
9054
|
* writing back what it read is not (D787).
|
|
@@ -8894,9 +9061,6 @@ var BaseAddon = class {
|
|
|
8894
9061
|
this._operatorWriteDepth--;
|
|
8895
9062
|
}
|
|
8896
9063
|
}
|
|
8897
|
-
async updateGlobalSettings(patch, nodeId) {
|
|
8898
|
-
await this.applyGlobalPatch(patch, nodeId);
|
|
8899
|
-
}
|
|
8900
9064
|
/**
|
|
8901
9065
|
* REMOVE stored secrets — their keychain values and their markers (D787).
|
|
8902
9066
|
*
|
|
@@ -8906,6 +9070,9 @@ var BaseAddon = class {
|
|
|
8906
9070
|
* a keychain (an older kernel) it writes `''`, as such code always did.
|
|
8907
9071
|
*/
|
|
8908
9072
|
async clearSecrets(keys, nodeId) {
|
|
9073
|
+
await this.clearSecretKeys(keys, nodeId);
|
|
9074
|
+
}
|
|
9075
|
+
async clearSecretKeys(keys, nodeId, cap) {
|
|
8909
9076
|
const tree = this.addonSecretTree();
|
|
8910
9077
|
const keychain = this._ctx?.secrets !== void 0;
|
|
8911
9078
|
const stored = keychain ? await this.readAddonStoreWithRetry() : {};
|
|
@@ -8918,25 +9085,26 @@ var BaseAddon = class {
|
|
|
8918
9085
|
const keychainStored = tree.has(key) || collectSecretMarkerRefs(stored[key]).length > 0;
|
|
8919
9086
|
patch[key] = keychain && keychainStored ? SECRET_CLEAR : "";
|
|
8920
9087
|
}
|
|
8921
|
-
await this.applyGlobalPatch(patch, nodeId);
|
|
9088
|
+
await this.applyGlobalPatch(patch, nodeId, cap);
|
|
8922
9089
|
}
|
|
8923
|
-
|
|
8924
|
-
|
|
8925
|
-
|
|
9090
|
+
/** Resolves `true` when the write changed stored values. */
|
|
9091
|
+
async applyGlobalPatch(barePatch, nodeId, cap) {
|
|
9092
|
+
await this.loadScopedSchemas(cap);
|
|
9093
|
+
const keys = this.perNodeKeys(cap);
|
|
8926
9094
|
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
8927
9095
|
const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
8928
9096
|
const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
|
|
8929
9097
|
const handle = this._secretSettings;
|
|
8930
9098
|
if (handle !== null) {
|
|
8931
9099
|
const { changed } = await handle.writeAddonStore(scoped);
|
|
8932
|
-
if (!changed) return;
|
|
9100
|
+
if (!changed) return false;
|
|
8933
9101
|
} else await this._ctx?.settings?.writeAddonStore(scoped);
|
|
8934
|
-
if (target !== localNode) return;
|
|
9102
|
+
if (target !== localNode) return true;
|
|
8935
9103
|
await this.resolveConfig();
|
|
8936
9104
|
await this.onConfigChanged();
|
|
8937
9105
|
this.emitLifecycle(EventCategory.AddonUpdated, { level: "global" });
|
|
8938
|
-
|
|
8939
|
-
|
|
9106
|
+
this.maybeAutoRestart(Object.keys(barePatch), this.loadedScopedSchemas().map((entry) => entry.schema));
|
|
9107
|
+
return true;
|
|
8940
9108
|
}
|
|
8941
9109
|
/**
|
|
8942
9110
|
* The set of field keys the global settings schema declares `perNode: true`
|
|
@@ -8973,10 +9141,7 @@ var BaseAddon = class {
|
|
|
8973
9141
|
this._nodeKeysByCap = /* @__PURE__ */ new Map();
|
|
8974
9142
|
this._addonSecretTree = null;
|
|
8975
9143
|
}
|
|
8976
|
-
/**
|
|
8977
|
-
* The form the settings API serves while an addon declares no {@link globalSettingsSchema}: the
|
|
8978
|
-
* sections of its scoped schemas, so dropping the old hook does not blank the form.
|
|
8979
|
-
*/
|
|
9144
|
+
/** The form of an addon's scoped schemas: their sections, each shown once. */
|
|
8980
9145
|
scopedFormSchema(cap) {
|
|
8981
9146
|
const byId = /* @__PURE__ */ new Map();
|
|
8982
9147
|
for (const entry of this.loadedScopedSchemas(cap)) for (const section of entry.schema.sections) if (!byId.has(section.id)) byId.set(section.id, section);
|
|
@@ -8988,8 +9153,7 @@ var BaseAddon = class {
|
|
|
8988
9153
|
return [...this._scopedByCap.values()].flat();
|
|
8989
9154
|
}
|
|
8990
9155
|
/**
|
|
8991
|
-
* The field keys that are stored per node: every field of a {@link nodeSettingsSchema}
|
|
8992
|
-
* the fields the legacy {@link globalSettingsSchema} still marks `perNode: true`. Derived once
|
|
9156
|
+
* The field keys that are stored per node: every field of a {@link nodeSettingsSchema}. Derived once
|
|
8993
9157
|
* per `cap` argument and memoized (schemas are static declarations). Empty set ⇒ every
|
|
8994
9158
|
* per-node code path is bypassed and the settings API behaves like the node-agnostic one.
|
|
8995
9159
|
* Call {@link loadScopedSchemas} first (the async seams do).
|
|
@@ -8998,8 +9162,7 @@ var BaseAddon = class {
|
|
|
8998
9162
|
const cacheKey = cap ?? "";
|
|
8999
9163
|
const cached = this._nodeKeysByCap.get(cacheKey);
|
|
9000
9164
|
if (cached) return cached;
|
|
9001
|
-
const
|
|
9002
|
-
const keys = new Set(legacy ? legacy.sections.flatMap((section) => collectPerNodeFieldKeys(section.fields)) : []);
|
|
9165
|
+
const keys = /* @__PURE__ */ new Set();
|
|
9003
9166
|
for (const { scope, schema } of this.loadedScopedSchemas(cap)) {
|
|
9004
9167
|
if (scope !== "node") continue;
|
|
9005
9168
|
for (const section of schema.sections) for (const key of collectValueFieldKeys(section.fields)) keys.add(key);
|
|
@@ -9217,8 +9380,6 @@ var BaseAddon = class {
|
|
|
9217
9380
|
}
|
|
9218
9381
|
declaredKeySet() {
|
|
9219
9382
|
const keys = new Set(Object.keys(this.defaults));
|
|
9220
|
-
const schema = this.globalSettingsSchema();
|
|
9221
|
-
if (schema) for (const section of schema.sections) for (const key of collectFieldKeys(section.fields)) keys.add(key);
|
|
9222
9383
|
for (const { schema: scoped } of this.loadedScopedSchemas()) for (const section of scoped.sections) for (const key of collectFieldKeys(section.fields)) keys.add(key);
|
|
9223
9384
|
for (const key of this._declaredStateKeys) keys.add(key);
|
|
9224
9385
|
for (const path of this.secretStatePaths) {
|
|
@@ -9316,7 +9477,7 @@ var BaseAddon = class {
|
|
|
9316
9477
|
/** The addon store's secret tree: schema fields by TYPE, plus `secretStatePaths`. */
|
|
9317
9478
|
addonSecretTree() {
|
|
9318
9479
|
if (this._addonSecretTree === null) {
|
|
9319
|
-
const tree = new Map(
|
|
9480
|
+
const tree = /* @__PURE__ */ new Map();
|
|
9320
9481
|
for (const { schema } of this.loadedScopedSchemas()) for (const [key, node] of secretTreeFromSchema(schema)) tree.set(key, node);
|
|
9321
9482
|
this._addonSecretTree = mergeSecretStatePaths(tree, this.secretStatePaths);
|
|
9322
9483
|
}
|
|
@@ -9528,47 +9689,6 @@ function classifyStoreError(err) {
|
|
|
9528
9689
|
if (TRANSPORT_PHRASES.some((f) => message.includes(f))) return "transport";
|
|
9529
9690
|
return "permanent";
|
|
9530
9691
|
}
|
|
9531
|
-
/**
|
|
9532
|
-
* Collect the keys of every field marked `perNode: true`, recursing into
|
|
9533
|
-
* layout containers (`group` fields and `sub-tabs` tabs) the same way
|
|
9534
|
-
* `hydrateSchema` does. Valueless structural fields (separator/info/…)
|
|
9535
|
-
* don't declare `perNode` and are excluded by the `in` narrowing.
|
|
9536
|
-
*/
|
|
9537
|
-
/**
|
|
9538
|
-
* The same fields with every `perNode: true` one removed, recursing into layout
|
|
9539
|
-
* containers exactly as {@link collectPerNodeFieldKeys} does. A container left
|
|
9540
|
-
* with no child is dropped rather than rendered empty.
|
|
9541
|
-
*
|
|
9542
|
-
* Used by `getIntegrationSettings`: an integration is not a node, so a field
|
|
9543
|
-
* whose store key is `<key>@<nodeId>` has no node to belong to there.
|
|
9544
|
-
*/
|
|
9545
|
-
function dropPerNodeFields(fields) {
|
|
9546
|
-
const kept = [];
|
|
9547
|
-
for (const field of fields) {
|
|
9548
|
-
if (field.type === "group") {
|
|
9549
|
-
const inner = dropPerNodeFields(field.fields);
|
|
9550
|
-
if (inner.length > 0) kept.push({
|
|
9551
|
-
...field,
|
|
9552
|
-
fields: inner
|
|
9553
|
-
});
|
|
9554
|
-
continue;
|
|
9555
|
-
}
|
|
9556
|
-
if (field.type === "sub-tabs") {
|
|
9557
|
-
const tabs = field.tabs.map((tab) => ({
|
|
9558
|
-
...tab,
|
|
9559
|
-
fields: dropPerNodeFields(tab.fields)
|
|
9560
|
-
})).filter((tab) => tab.fields.length > 0);
|
|
9561
|
-
if (tabs.length > 0) kept.push({
|
|
9562
|
-
...field,
|
|
9563
|
-
tabs
|
|
9564
|
-
});
|
|
9565
|
-
continue;
|
|
9566
|
-
}
|
|
9567
|
-
if ("perNode" in field && field.perNode === true) continue;
|
|
9568
|
-
kept.push(field);
|
|
9569
|
-
}
|
|
9570
|
-
return kept;
|
|
9571
|
-
}
|
|
9572
9692
|
/** The keys of the value-holding fields, recursing into layout containers. */
|
|
9573
9693
|
function collectValueFieldKeys(fields) {
|
|
9574
9694
|
const collected = [];
|
|
@@ -9601,21 +9721,6 @@ function collectFieldKeys(fields) {
|
|
|
9601
9721
|
}
|
|
9602
9722
|
return collected;
|
|
9603
9723
|
}
|
|
9604
|
-
function collectPerNodeFieldKeys(fields) {
|
|
9605
|
-
const collected = [];
|
|
9606
|
-
for (const field of fields) {
|
|
9607
|
-
if (field.type === "group") {
|
|
9608
|
-
collected.push(...collectPerNodeFieldKeys(field.fields));
|
|
9609
|
-
continue;
|
|
9610
|
-
}
|
|
9611
|
-
if (field.type === "sub-tabs") {
|
|
9612
|
-
for (const tab of field.tabs) collected.push(...collectPerNodeFieldKeys(tab.fields));
|
|
9613
|
-
continue;
|
|
9614
|
-
}
|
|
9615
|
-
if ("perNode" in field && field.perNode === true) collected.push(field.key);
|
|
9616
|
-
}
|
|
9617
|
-
return collected;
|
|
9618
|
-
}
|
|
9619
9724
|
/**
|
|
9620
9725
|
* Normalize an `ICamstackAddon.initialize()` return value into the
|
|
9621
9726
|
* `AddonInitResult` envelope. Arrays are wrapped into `{ providers }`;
|
|
@@ -12438,13 +12543,25 @@ Object.freeze({
|
|
|
12438
12543
|
"path": "temperature",
|
|
12439
12544
|
"valueType": "number"
|
|
12440
12545
|
}],
|
|
12441
|
-
"timed-run": [
|
|
12442
|
-
|
|
12443
|
-
|
|
12444
|
-
|
|
12445
|
-
|
|
12446
|
-
|
|
12447
|
-
|
|
12546
|
+
"timed-run": [
|
|
12547
|
+
{
|
|
12548
|
+
"path": "activeUntil",
|
|
12549
|
+
"valueType": "number"
|
|
12550
|
+
},
|
|
12551
|
+
{
|
|
12552
|
+
"path": "requestedBy",
|
|
12553
|
+
"valueType": "string"
|
|
12554
|
+
},
|
|
12555
|
+
{
|
|
12556
|
+
"path": "quickRun.duration",
|
|
12557
|
+
"valueType": "number"
|
|
12558
|
+
},
|
|
12559
|
+
{
|
|
12560
|
+
"path": "quickRun.unit",
|
|
12561
|
+
"valueType": "enum",
|
|
12562
|
+
"enumValues": ["s", "min"]
|
|
12563
|
+
}
|
|
12564
|
+
],
|
|
12448
12565
|
"update": [
|
|
12449
12566
|
{
|
|
12450
12567
|
"path": "currentVersion",
|
|
@@ -12668,7 +12785,7 @@ object({
|
|
|
12668
12785
|
params: record(string(), union([string(), number()])).optional()
|
|
12669
12786
|
});
|
|
12670
12787
|
//#endregion
|
|
12671
|
-
//#region ../types/dist/composition-
|
|
12788
|
+
//#region ../types/dist/composition-Bx0JvKUU.mjs
|
|
12672
12789
|
var AUDIO_ENCODER_BY_CODEC = {
|
|
12673
12790
|
opus: "libopus",
|
|
12674
12791
|
aac: "aac",
|
|
@@ -14426,6 +14543,387 @@ var NodeColorIdSchema = _enum([
|
|
|
14426
14543
|
"node-h"
|
|
14427
14544
|
]);
|
|
14428
14545
|
//#endregion
|
|
14546
|
+
//#region ../types/dist/convert-BAzH15HU.mjs
|
|
14547
|
+
/**
|
|
14548
|
+
* Frozen unit → spec table. `•` in the doc marks each dimension's canonical
|
|
14549
|
+
* unit (`factor: 1, offset: 0`). °F derives from `°C = (°F − 32) × 5/9` ⇒
|
|
14550
|
+
* `factor = 5/9`, `offset = -160/9` (kept as exact expressions, not rounded
|
|
14551
|
+
* decimals). K derives from `°C = K − 273.15`.
|
|
14552
|
+
*/
|
|
14553
|
+
var UNIT_TABLE = {
|
|
14554
|
+
"°C": {
|
|
14555
|
+
dimension: "temperature",
|
|
14556
|
+
factor: 1,
|
|
14557
|
+
offset: 0
|
|
14558
|
+
},
|
|
14559
|
+
"°F": {
|
|
14560
|
+
dimension: "temperature",
|
|
14561
|
+
factor: 5 / 9,
|
|
14562
|
+
offset: -160 / 9
|
|
14563
|
+
},
|
|
14564
|
+
K: {
|
|
14565
|
+
dimension: "temperature",
|
|
14566
|
+
factor: 1,
|
|
14567
|
+
offset: -273.15
|
|
14568
|
+
},
|
|
14569
|
+
hPa: {
|
|
14570
|
+
dimension: "pressure",
|
|
14571
|
+
factor: 1,
|
|
14572
|
+
offset: 0
|
|
14573
|
+
},
|
|
14574
|
+
kPa: {
|
|
14575
|
+
dimension: "pressure",
|
|
14576
|
+
factor: 10,
|
|
14577
|
+
offset: 0
|
|
14578
|
+
},
|
|
14579
|
+
Pa: {
|
|
14580
|
+
dimension: "pressure",
|
|
14581
|
+
factor: .01,
|
|
14582
|
+
offset: 0
|
|
14583
|
+
},
|
|
14584
|
+
mbar: {
|
|
14585
|
+
dimension: "pressure",
|
|
14586
|
+
factor: 1,
|
|
14587
|
+
offset: 0
|
|
14588
|
+
},
|
|
14589
|
+
bar: {
|
|
14590
|
+
dimension: "pressure",
|
|
14591
|
+
factor: 1e3,
|
|
14592
|
+
offset: 0
|
|
14593
|
+
},
|
|
14594
|
+
inHg: {
|
|
14595
|
+
dimension: "pressure",
|
|
14596
|
+
factor: 33.8639,
|
|
14597
|
+
offset: 0
|
|
14598
|
+
},
|
|
14599
|
+
mmHg: {
|
|
14600
|
+
dimension: "pressure",
|
|
14601
|
+
factor: 1.33322,
|
|
14602
|
+
offset: 0
|
|
14603
|
+
},
|
|
14604
|
+
psi: {
|
|
14605
|
+
dimension: "pressure",
|
|
14606
|
+
factor: 68.9476,
|
|
14607
|
+
offset: 0
|
|
14608
|
+
},
|
|
14609
|
+
"m/s": {
|
|
14610
|
+
dimension: "speed",
|
|
14611
|
+
factor: 1,
|
|
14612
|
+
offset: 0
|
|
14613
|
+
},
|
|
14614
|
+
"km/h": {
|
|
14615
|
+
dimension: "speed",
|
|
14616
|
+
factor: 1 / 3.6,
|
|
14617
|
+
offset: 0
|
|
14618
|
+
},
|
|
14619
|
+
mph: {
|
|
14620
|
+
dimension: "speed",
|
|
14621
|
+
factor: .44704,
|
|
14622
|
+
offset: 0
|
|
14623
|
+
},
|
|
14624
|
+
kn: {
|
|
14625
|
+
dimension: "speed",
|
|
14626
|
+
factor: .514444,
|
|
14627
|
+
offset: 0
|
|
14628
|
+
},
|
|
14629
|
+
"mm/h": {
|
|
14630
|
+
dimension: "precipitation-rate",
|
|
14631
|
+
factor: 1,
|
|
14632
|
+
offset: 0
|
|
14633
|
+
},
|
|
14634
|
+
"in/h": {
|
|
14635
|
+
dimension: "precipitation-rate",
|
|
14636
|
+
factor: 25.4,
|
|
14637
|
+
offset: 0
|
|
14638
|
+
},
|
|
14639
|
+
m: {
|
|
14640
|
+
dimension: "length",
|
|
14641
|
+
factor: 1,
|
|
14642
|
+
offset: 0
|
|
14643
|
+
},
|
|
14644
|
+
mm: {
|
|
14645
|
+
dimension: "length",
|
|
14646
|
+
factor: .001,
|
|
14647
|
+
offset: 0
|
|
14648
|
+
},
|
|
14649
|
+
cm: {
|
|
14650
|
+
dimension: "length",
|
|
14651
|
+
factor: .01,
|
|
14652
|
+
offset: 0
|
|
14653
|
+
},
|
|
14654
|
+
km: {
|
|
14655
|
+
dimension: "length",
|
|
14656
|
+
factor: 1e3,
|
|
14657
|
+
offset: 0
|
|
14658
|
+
},
|
|
14659
|
+
in: {
|
|
14660
|
+
dimension: "length",
|
|
14661
|
+
factor: .0254,
|
|
14662
|
+
offset: 0
|
|
14663
|
+
},
|
|
14664
|
+
ft: {
|
|
14665
|
+
dimension: "length",
|
|
14666
|
+
factor: .3048,
|
|
14667
|
+
offset: 0
|
|
14668
|
+
},
|
|
14669
|
+
mi: {
|
|
14670
|
+
dimension: "length",
|
|
14671
|
+
factor: 1609.344,
|
|
14672
|
+
offset: 0
|
|
14673
|
+
},
|
|
14674
|
+
"m²": {
|
|
14675
|
+
dimension: "area",
|
|
14676
|
+
factor: 1,
|
|
14677
|
+
offset: 0
|
|
14678
|
+
},
|
|
14679
|
+
lx: {
|
|
14680
|
+
dimension: "illuminance",
|
|
14681
|
+
factor: 1,
|
|
14682
|
+
offset: 0
|
|
14683
|
+
},
|
|
14684
|
+
"W/m²": {
|
|
14685
|
+
dimension: "irradiance",
|
|
14686
|
+
factor: 1,
|
|
14687
|
+
offset: 0
|
|
14688
|
+
},
|
|
14689
|
+
W: {
|
|
14690
|
+
dimension: "power",
|
|
14691
|
+
factor: 1,
|
|
14692
|
+
offset: 0
|
|
14693
|
+
},
|
|
14694
|
+
kW: {
|
|
14695
|
+
dimension: "power",
|
|
14696
|
+
factor: 1e3,
|
|
14697
|
+
offset: 0
|
|
14698
|
+
},
|
|
14699
|
+
VA: {
|
|
14700
|
+
dimension: "apparent-power",
|
|
14701
|
+
factor: 1,
|
|
14702
|
+
offset: 0
|
|
14703
|
+
},
|
|
14704
|
+
Wh: {
|
|
14705
|
+
dimension: "energy",
|
|
14706
|
+
factor: 1,
|
|
14707
|
+
offset: 0
|
|
14708
|
+
},
|
|
14709
|
+
kWh: {
|
|
14710
|
+
dimension: "energy",
|
|
14711
|
+
factor: 1e3,
|
|
14712
|
+
offset: 0
|
|
14713
|
+
},
|
|
14714
|
+
MWh: {
|
|
14715
|
+
dimension: "energy",
|
|
14716
|
+
factor: 1e6,
|
|
14717
|
+
offset: 0
|
|
14718
|
+
},
|
|
14719
|
+
V: {
|
|
14720
|
+
dimension: "voltage",
|
|
14721
|
+
factor: 1,
|
|
14722
|
+
offset: 0
|
|
14723
|
+
},
|
|
14724
|
+
mV: {
|
|
14725
|
+
dimension: "voltage",
|
|
14726
|
+
factor: .001,
|
|
14727
|
+
offset: 0
|
|
14728
|
+
},
|
|
14729
|
+
A: {
|
|
14730
|
+
dimension: "current",
|
|
14731
|
+
factor: 1,
|
|
14732
|
+
offset: 0
|
|
14733
|
+
},
|
|
14734
|
+
mA: {
|
|
14735
|
+
dimension: "current",
|
|
14736
|
+
factor: .001,
|
|
14737
|
+
offset: 0
|
|
14738
|
+
},
|
|
14739
|
+
ppm: {
|
|
14740
|
+
dimension: "concentration-volume",
|
|
14741
|
+
factor: 1,
|
|
14742
|
+
offset: 0
|
|
14743
|
+
},
|
|
14744
|
+
ppb: {
|
|
14745
|
+
dimension: "concentration-volume",
|
|
14746
|
+
factor: .001,
|
|
14747
|
+
offset: 0
|
|
14748
|
+
},
|
|
14749
|
+
"µg/m³": {
|
|
14750
|
+
dimension: "concentration-mass",
|
|
14751
|
+
factor: 1,
|
|
14752
|
+
offset: 0
|
|
14753
|
+
},
|
|
14754
|
+
"mg/m³": {
|
|
14755
|
+
dimension: "concentration-mass",
|
|
14756
|
+
factor: 1e3,
|
|
14757
|
+
offset: 0
|
|
14758
|
+
},
|
|
14759
|
+
kg: {
|
|
14760
|
+
dimension: "mass",
|
|
14761
|
+
factor: 1,
|
|
14762
|
+
offset: 0
|
|
14763
|
+
},
|
|
14764
|
+
g: {
|
|
14765
|
+
dimension: "mass",
|
|
14766
|
+
factor: .001,
|
|
14767
|
+
offset: 0
|
|
14768
|
+
},
|
|
14769
|
+
lb: {
|
|
14770
|
+
dimension: "mass",
|
|
14771
|
+
factor: .453592,
|
|
14772
|
+
offset: 0
|
|
14773
|
+
},
|
|
14774
|
+
oz: {
|
|
14775
|
+
dimension: "mass",
|
|
14776
|
+
factor: .0283495,
|
|
14777
|
+
offset: 0
|
|
14778
|
+
},
|
|
14779
|
+
"%": {
|
|
14780
|
+
dimension: "percentage",
|
|
14781
|
+
factor: 1,
|
|
14782
|
+
offset: 0
|
|
14783
|
+
},
|
|
14784
|
+
L: {
|
|
14785
|
+
dimension: "volume",
|
|
14786
|
+
factor: 1,
|
|
14787
|
+
offset: 0
|
|
14788
|
+
},
|
|
14789
|
+
mL: {
|
|
14790
|
+
dimension: "volume",
|
|
14791
|
+
factor: .001,
|
|
14792
|
+
offset: 0
|
|
14793
|
+
},
|
|
14794
|
+
gal: {
|
|
14795
|
+
dimension: "volume",
|
|
14796
|
+
factor: 3.785411784,
|
|
14797
|
+
offset: 0
|
|
14798
|
+
},
|
|
14799
|
+
s: {
|
|
14800
|
+
dimension: "duration",
|
|
14801
|
+
factor: 1,
|
|
14802
|
+
offset: 0
|
|
14803
|
+
},
|
|
14804
|
+
ms: {
|
|
14805
|
+
dimension: "duration",
|
|
14806
|
+
factor: .001,
|
|
14807
|
+
offset: 0
|
|
14808
|
+
},
|
|
14809
|
+
min: {
|
|
14810
|
+
dimension: "duration",
|
|
14811
|
+
factor: 60,
|
|
14812
|
+
offset: 0
|
|
14813
|
+
},
|
|
14814
|
+
h: {
|
|
14815
|
+
dimension: "duration",
|
|
14816
|
+
factor: 3600,
|
|
14817
|
+
offset: 0
|
|
14818
|
+
},
|
|
14819
|
+
d: {
|
|
14820
|
+
dimension: "duration",
|
|
14821
|
+
factor: 86400,
|
|
14822
|
+
offset: 0
|
|
14823
|
+
},
|
|
14824
|
+
B: {
|
|
14825
|
+
dimension: "information",
|
|
14826
|
+
factor: 1,
|
|
14827
|
+
offset: 0
|
|
14828
|
+
},
|
|
14829
|
+
KiB: {
|
|
14830
|
+
dimension: "information",
|
|
14831
|
+
factor: 1024,
|
|
14832
|
+
offset: 0
|
|
14833
|
+
},
|
|
14834
|
+
MiB: {
|
|
14835
|
+
dimension: "information",
|
|
14836
|
+
factor: 1024 ** 2,
|
|
14837
|
+
offset: 0
|
|
14838
|
+
},
|
|
14839
|
+
GiB: {
|
|
14840
|
+
dimension: "information",
|
|
14841
|
+
factor: 1024 ** 3,
|
|
14842
|
+
offset: 0
|
|
14843
|
+
},
|
|
14844
|
+
TiB: {
|
|
14845
|
+
dimension: "information",
|
|
14846
|
+
factor: 1024 ** 4,
|
|
14847
|
+
offset: 0
|
|
14848
|
+
},
|
|
14849
|
+
kB: {
|
|
14850
|
+
dimension: "information",
|
|
14851
|
+
factor: 1e3,
|
|
14852
|
+
offset: 0
|
|
14853
|
+
},
|
|
14854
|
+
MB: {
|
|
14855
|
+
dimension: "information",
|
|
14856
|
+
factor: 1e6,
|
|
14857
|
+
offset: 0
|
|
14858
|
+
},
|
|
14859
|
+
GB: {
|
|
14860
|
+
dimension: "information",
|
|
14861
|
+
factor: 1e9,
|
|
14862
|
+
offset: 0
|
|
14863
|
+
},
|
|
14864
|
+
"°": {
|
|
14865
|
+
dimension: "angle",
|
|
14866
|
+
factor: 1,
|
|
14867
|
+
offset: 0
|
|
14868
|
+
},
|
|
14869
|
+
dBFS: {
|
|
14870
|
+
dimension: "sound-level",
|
|
14871
|
+
factor: 1,
|
|
14872
|
+
offset: 0
|
|
14873
|
+
},
|
|
14874
|
+
dBm: {
|
|
14875
|
+
dimension: "signal-level",
|
|
14876
|
+
factor: 1,
|
|
14877
|
+
offset: 0
|
|
14878
|
+
},
|
|
14879
|
+
mired: {
|
|
14880
|
+
dimension: "colour-temperature",
|
|
14881
|
+
factor: 1,
|
|
14882
|
+
offset: 0
|
|
14883
|
+
},
|
|
14884
|
+
kbps: {
|
|
14885
|
+
dimension: "bitrate",
|
|
14886
|
+
factor: 1,
|
|
14887
|
+
offset: 0
|
|
14888
|
+
},
|
|
14889
|
+
Mbps: {
|
|
14890
|
+
dimension: "bitrate",
|
|
14891
|
+
factor: 1e3,
|
|
14892
|
+
offset: 0
|
|
14893
|
+
},
|
|
14894
|
+
fps: {
|
|
14895
|
+
dimension: "rate",
|
|
14896
|
+
factor: 1,
|
|
14897
|
+
offset: 0
|
|
14898
|
+
}
|
|
14899
|
+
};
|
|
14900
|
+
/** Resolve a unit's `UnitSpec`, or `undefined` when the spelling is unknown. */
|
|
14901
|
+
function specFor(unit) {
|
|
14902
|
+
return Object.hasOwn(UNIT_TABLE, unit) ? UNIT_TABLE[unit] : void 0;
|
|
14903
|
+
}
|
|
14904
|
+
/** Value in `spec`'s unit → its dimension's canonical unit. */
|
|
14905
|
+
function toCanonical(value, spec) {
|
|
14906
|
+
return value * spec.factor + spec.offset;
|
|
14907
|
+
}
|
|
14908
|
+
/** Canonical-unit value → the unit described by `spec`. */
|
|
14909
|
+
function fromCanonical(canonical, spec) {
|
|
14910
|
+
return (canonical - spec.offset) / spec.factor;
|
|
14911
|
+
}
|
|
14912
|
+
/**
|
|
14913
|
+
* Graceful variant for the render path: returns the converted value, or
|
|
14914
|
+
* `undefined` when the conversion is refused (unknown unit / cross-dimension).
|
|
14915
|
+
* Never throws — a render caller falls back to the raw value + source unit.
|
|
14916
|
+
*/
|
|
14917
|
+
function tryConvertUnit(value, from, to) {
|
|
14918
|
+
if (from === to) return value;
|
|
14919
|
+
const fromSpec = specFor(from);
|
|
14920
|
+
if (!fromSpec) return void 0;
|
|
14921
|
+
const toSpec = specFor(to);
|
|
14922
|
+
if (!toSpec) return void 0;
|
|
14923
|
+
if (fromSpec.dimension !== toSpec.dimension) return void 0;
|
|
14924
|
+
return fromCanonical(toCanonical(value, fromSpec), toSpec);
|
|
14925
|
+
}
|
|
14926
|
+
//#endregion
|
|
14429
14927
|
//#region ../types/dist/index.mjs
|
|
14430
14928
|
var SMTP_INBOUND_DEFAULT_PORT = 2525;
|
|
14431
14929
|
var SMTP_INBOUND_DEFAULT_DOMAIN = "camstack.local";
|
|
@@ -43524,6 +44022,7 @@ var ExpressionBindingSourceSchema = union([
|
|
|
43524
44022
|
object({
|
|
43525
44023
|
kind: literal("global"),
|
|
43526
44024
|
sourceStableId: string(),
|
|
44025
|
+
addonId: string().optional(),
|
|
43527
44026
|
cap: string(),
|
|
43528
44027
|
fieldPath: string()
|
|
43529
44028
|
})
|
|
@@ -43590,385 +44089,6 @@ var SourceInfoSchema = object({
|
|
|
43590
44089
|
raw: record(string(), unknown()).optional()
|
|
43591
44090
|
});
|
|
43592
44091
|
/**
|
|
43593
|
-
* Frozen unit → spec table. `•` in the doc marks each dimension's canonical
|
|
43594
|
-
* unit (`factor: 1, offset: 0`). °F derives from `°C = (°F − 32) × 5/9` ⇒
|
|
43595
|
-
* `factor = 5/9`, `offset = -160/9` (kept as exact expressions, not rounded
|
|
43596
|
-
* decimals). K derives from `°C = K − 273.15`.
|
|
43597
|
-
*/
|
|
43598
|
-
var UNIT_TABLE = {
|
|
43599
|
-
"°C": {
|
|
43600
|
-
dimension: "temperature",
|
|
43601
|
-
factor: 1,
|
|
43602
|
-
offset: 0
|
|
43603
|
-
},
|
|
43604
|
-
"°F": {
|
|
43605
|
-
dimension: "temperature",
|
|
43606
|
-
factor: 5 / 9,
|
|
43607
|
-
offset: -160 / 9
|
|
43608
|
-
},
|
|
43609
|
-
K: {
|
|
43610
|
-
dimension: "temperature",
|
|
43611
|
-
factor: 1,
|
|
43612
|
-
offset: -273.15
|
|
43613
|
-
},
|
|
43614
|
-
hPa: {
|
|
43615
|
-
dimension: "pressure",
|
|
43616
|
-
factor: 1,
|
|
43617
|
-
offset: 0
|
|
43618
|
-
},
|
|
43619
|
-
kPa: {
|
|
43620
|
-
dimension: "pressure",
|
|
43621
|
-
factor: 10,
|
|
43622
|
-
offset: 0
|
|
43623
|
-
},
|
|
43624
|
-
Pa: {
|
|
43625
|
-
dimension: "pressure",
|
|
43626
|
-
factor: .01,
|
|
43627
|
-
offset: 0
|
|
43628
|
-
},
|
|
43629
|
-
mbar: {
|
|
43630
|
-
dimension: "pressure",
|
|
43631
|
-
factor: 1,
|
|
43632
|
-
offset: 0
|
|
43633
|
-
},
|
|
43634
|
-
bar: {
|
|
43635
|
-
dimension: "pressure",
|
|
43636
|
-
factor: 1e3,
|
|
43637
|
-
offset: 0
|
|
43638
|
-
},
|
|
43639
|
-
inHg: {
|
|
43640
|
-
dimension: "pressure",
|
|
43641
|
-
factor: 33.8639,
|
|
43642
|
-
offset: 0
|
|
43643
|
-
},
|
|
43644
|
-
mmHg: {
|
|
43645
|
-
dimension: "pressure",
|
|
43646
|
-
factor: 1.33322,
|
|
43647
|
-
offset: 0
|
|
43648
|
-
},
|
|
43649
|
-
psi: {
|
|
43650
|
-
dimension: "pressure",
|
|
43651
|
-
factor: 68.9476,
|
|
43652
|
-
offset: 0
|
|
43653
|
-
},
|
|
43654
|
-
"m/s": {
|
|
43655
|
-
dimension: "speed",
|
|
43656
|
-
factor: 1,
|
|
43657
|
-
offset: 0
|
|
43658
|
-
},
|
|
43659
|
-
"km/h": {
|
|
43660
|
-
dimension: "speed",
|
|
43661
|
-
factor: 1 / 3.6,
|
|
43662
|
-
offset: 0
|
|
43663
|
-
},
|
|
43664
|
-
mph: {
|
|
43665
|
-
dimension: "speed",
|
|
43666
|
-
factor: .44704,
|
|
43667
|
-
offset: 0
|
|
43668
|
-
},
|
|
43669
|
-
kn: {
|
|
43670
|
-
dimension: "speed",
|
|
43671
|
-
factor: .514444,
|
|
43672
|
-
offset: 0
|
|
43673
|
-
},
|
|
43674
|
-
"mm/h": {
|
|
43675
|
-
dimension: "precipitation-rate",
|
|
43676
|
-
factor: 1,
|
|
43677
|
-
offset: 0
|
|
43678
|
-
},
|
|
43679
|
-
"in/h": {
|
|
43680
|
-
dimension: "precipitation-rate",
|
|
43681
|
-
factor: 25.4,
|
|
43682
|
-
offset: 0
|
|
43683
|
-
},
|
|
43684
|
-
m: {
|
|
43685
|
-
dimension: "length",
|
|
43686
|
-
factor: 1,
|
|
43687
|
-
offset: 0
|
|
43688
|
-
},
|
|
43689
|
-
mm: {
|
|
43690
|
-
dimension: "length",
|
|
43691
|
-
factor: .001,
|
|
43692
|
-
offset: 0
|
|
43693
|
-
},
|
|
43694
|
-
cm: {
|
|
43695
|
-
dimension: "length",
|
|
43696
|
-
factor: .01,
|
|
43697
|
-
offset: 0
|
|
43698
|
-
},
|
|
43699
|
-
km: {
|
|
43700
|
-
dimension: "length",
|
|
43701
|
-
factor: 1e3,
|
|
43702
|
-
offset: 0
|
|
43703
|
-
},
|
|
43704
|
-
in: {
|
|
43705
|
-
dimension: "length",
|
|
43706
|
-
factor: .0254,
|
|
43707
|
-
offset: 0
|
|
43708
|
-
},
|
|
43709
|
-
ft: {
|
|
43710
|
-
dimension: "length",
|
|
43711
|
-
factor: .3048,
|
|
43712
|
-
offset: 0
|
|
43713
|
-
},
|
|
43714
|
-
mi: {
|
|
43715
|
-
dimension: "length",
|
|
43716
|
-
factor: 1609.344,
|
|
43717
|
-
offset: 0
|
|
43718
|
-
},
|
|
43719
|
-
"m²": {
|
|
43720
|
-
dimension: "area",
|
|
43721
|
-
factor: 1,
|
|
43722
|
-
offset: 0
|
|
43723
|
-
},
|
|
43724
|
-
lx: {
|
|
43725
|
-
dimension: "illuminance",
|
|
43726
|
-
factor: 1,
|
|
43727
|
-
offset: 0
|
|
43728
|
-
},
|
|
43729
|
-
"W/m²": {
|
|
43730
|
-
dimension: "irradiance",
|
|
43731
|
-
factor: 1,
|
|
43732
|
-
offset: 0
|
|
43733
|
-
},
|
|
43734
|
-
W: {
|
|
43735
|
-
dimension: "power",
|
|
43736
|
-
factor: 1,
|
|
43737
|
-
offset: 0
|
|
43738
|
-
},
|
|
43739
|
-
kW: {
|
|
43740
|
-
dimension: "power",
|
|
43741
|
-
factor: 1e3,
|
|
43742
|
-
offset: 0
|
|
43743
|
-
},
|
|
43744
|
-
VA: {
|
|
43745
|
-
dimension: "apparent-power",
|
|
43746
|
-
factor: 1,
|
|
43747
|
-
offset: 0
|
|
43748
|
-
},
|
|
43749
|
-
Wh: {
|
|
43750
|
-
dimension: "energy",
|
|
43751
|
-
factor: 1,
|
|
43752
|
-
offset: 0
|
|
43753
|
-
},
|
|
43754
|
-
kWh: {
|
|
43755
|
-
dimension: "energy",
|
|
43756
|
-
factor: 1e3,
|
|
43757
|
-
offset: 0
|
|
43758
|
-
},
|
|
43759
|
-
MWh: {
|
|
43760
|
-
dimension: "energy",
|
|
43761
|
-
factor: 1e6,
|
|
43762
|
-
offset: 0
|
|
43763
|
-
},
|
|
43764
|
-
V: {
|
|
43765
|
-
dimension: "voltage",
|
|
43766
|
-
factor: 1,
|
|
43767
|
-
offset: 0
|
|
43768
|
-
},
|
|
43769
|
-
mV: {
|
|
43770
|
-
dimension: "voltage",
|
|
43771
|
-
factor: .001,
|
|
43772
|
-
offset: 0
|
|
43773
|
-
},
|
|
43774
|
-
A: {
|
|
43775
|
-
dimension: "current",
|
|
43776
|
-
factor: 1,
|
|
43777
|
-
offset: 0
|
|
43778
|
-
},
|
|
43779
|
-
mA: {
|
|
43780
|
-
dimension: "current",
|
|
43781
|
-
factor: .001,
|
|
43782
|
-
offset: 0
|
|
43783
|
-
},
|
|
43784
|
-
ppm: {
|
|
43785
|
-
dimension: "concentration-volume",
|
|
43786
|
-
factor: 1,
|
|
43787
|
-
offset: 0
|
|
43788
|
-
},
|
|
43789
|
-
ppb: {
|
|
43790
|
-
dimension: "concentration-volume",
|
|
43791
|
-
factor: .001,
|
|
43792
|
-
offset: 0
|
|
43793
|
-
},
|
|
43794
|
-
"µg/m³": {
|
|
43795
|
-
dimension: "concentration-mass",
|
|
43796
|
-
factor: 1,
|
|
43797
|
-
offset: 0
|
|
43798
|
-
},
|
|
43799
|
-
"mg/m³": {
|
|
43800
|
-
dimension: "concentration-mass",
|
|
43801
|
-
factor: 1e3,
|
|
43802
|
-
offset: 0
|
|
43803
|
-
},
|
|
43804
|
-
kg: {
|
|
43805
|
-
dimension: "mass",
|
|
43806
|
-
factor: 1,
|
|
43807
|
-
offset: 0
|
|
43808
|
-
},
|
|
43809
|
-
g: {
|
|
43810
|
-
dimension: "mass",
|
|
43811
|
-
factor: .001,
|
|
43812
|
-
offset: 0
|
|
43813
|
-
},
|
|
43814
|
-
lb: {
|
|
43815
|
-
dimension: "mass",
|
|
43816
|
-
factor: .453592,
|
|
43817
|
-
offset: 0
|
|
43818
|
-
},
|
|
43819
|
-
oz: {
|
|
43820
|
-
dimension: "mass",
|
|
43821
|
-
factor: .0283495,
|
|
43822
|
-
offset: 0
|
|
43823
|
-
},
|
|
43824
|
-
"%": {
|
|
43825
|
-
dimension: "percentage",
|
|
43826
|
-
factor: 1,
|
|
43827
|
-
offset: 0
|
|
43828
|
-
},
|
|
43829
|
-
L: {
|
|
43830
|
-
dimension: "volume",
|
|
43831
|
-
factor: 1,
|
|
43832
|
-
offset: 0
|
|
43833
|
-
},
|
|
43834
|
-
mL: {
|
|
43835
|
-
dimension: "volume",
|
|
43836
|
-
factor: .001,
|
|
43837
|
-
offset: 0
|
|
43838
|
-
},
|
|
43839
|
-
gal: {
|
|
43840
|
-
dimension: "volume",
|
|
43841
|
-
factor: 3.785411784,
|
|
43842
|
-
offset: 0
|
|
43843
|
-
},
|
|
43844
|
-
s: {
|
|
43845
|
-
dimension: "duration",
|
|
43846
|
-
factor: 1,
|
|
43847
|
-
offset: 0
|
|
43848
|
-
},
|
|
43849
|
-
ms: {
|
|
43850
|
-
dimension: "duration",
|
|
43851
|
-
factor: .001,
|
|
43852
|
-
offset: 0
|
|
43853
|
-
},
|
|
43854
|
-
min: {
|
|
43855
|
-
dimension: "duration",
|
|
43856
|
-
factor: 60,
|
|
43857
|
-
offset: 0
|
|
43858
|
-
},
|
|
43859
|
-
h: {
|
|
43860
|
-
dimension: "duration",
|
|
43861
|
-
factor: 3600,
|
|
43862
|
-
offset: 0
|
|
43863
|
-
},
|
|
43864
|
-
d: {
|
|
43865
|
-
dimension: "duration",
|
|
43866
|
-
factor: 86400,
|
|
43867
|
-
offset: 0
|
|
43868
|
-
},
|
|
43869
|
-
B: {
|
|
43870
|
-
dimension: "information",
|
|
43871
|
-
factor: 1,
|
|
43872
|
-
offset: 0
|
|
43873
|
-
},
|
|
43874
|
-
KiB: {
|
|
43875
|
-
dimension: "information",
|
|
43876
|
-
factor: 1024,
|
|
43877
|
-
offset: 0
|
|
43878
|
-
},
|
|
43879
|
-
MiB: {
|
|
43880
|
-
dimension: "information",
|
|
43881
|
-
factor: 1024 ** 2,
|
|
43882
|
-
offset: 0
|
|
43883
|
-
},
|
|
43884
|
-
GiB: {
|
|
43885
|
-
dimension: "information",
|
|
43886
|
-
factor: 1024 ** 3,
|
|
43887
|
-
offset: 0
|
|
43888
|
-
},
|
|
43889
|
-
TiB: {
|
|
43890
|
-
dimension: "information",
|
|
43891
|
-
factor: 1024 ** 4,
|
|
43892
|
-
offset: 0
|
|
43893
|
-
},
|
|
43894
|
-
kB: {
|
|
43895
|
-
dimension: "information",
|
|
43896
|
-
factor: 1e3,
|
|
43897
|
-
offset: 0
|
|
43898
|
-
},
|
|
43899
|
-
MB: {
|
|
43900
|
-
dimension: "information",
|
|
43901
|
-
factor: 1e6,
|
|
43902
|
-
offset: 0
|
|
43903
|
-
},
|
|
43904
|
-
GB: {
|
|
43905
|
-
dimension: "information",
|
|
43906
|
-
factor: 1e9,
|
|
43907
|
-
offset: 0
|
|
43908
|
-
},
|
|
43909
|
-
"°": {
|
|
43910
|
-
dimension: "angle",
|
|
43911
|
-
factor: 1,
|
|
43912
|
-
offset: 0
|
|
43913
|
-
},
|
|
43914
|
-
dBFS: {
|
|
43915
|
-
dimension: "sound-level",
|
|
43916
|
-
factor: 1,
|
|
43917
|
-
offset: 0
|
|
43918
|
-
},
|
|
43919
|
-
dBm: {
|
|
43920
|
-
dimension: "signal-level",
|
|
43921
|
-
factor: 1,
|
|
43922
|
-
offset: 0
|
|
43923
|
-
},
|
|
43924
|
-
mired: {
|
|
43925
|
-
dimension: "colour-temperature",
|
|
43926
|
-
factor: 1,
|
|
43927
|
-
offset: 0
|
|
43928
|
-
},
|
|
43929
|
-
kbps: {
|
|
43930
|
-
dimension: "bitrate",
|
|
43931
|
-
factor: 1,
|
|
43932
|
-
offset: 0
|
|
43933
|
-
},
|
|
43934
|
-
Mbps: {
|
|
43935
|
-
dimension: "bitrate",
|
|
43936
|
-
factor: 1e3,
|
|
43937
|
-
offset: 0
|
|
43938
|
-
},
|
|
43939
|
-
fps: {
|
|
43940
|
-
dimension: "rate",
|
|
43941
|
-
factor: 1,
|
|
43942
|
-
offset: 0
|
|
43943
|
-
}
|
|
43944
|
-
};
|
|
43945
|
-
/** Resolve a unit's `UnitSpec`, or `undefined` when the spelling is unknown. */
|
|
43946
|
-
function specFor(unit) {
|
|
43947
|
-
return Object.hasOwn(UNIT_TABLE, unit) ? UNIT_TABLE[unit] : void 0;
|
|
43948
|
-
}
|
|
43949
|
-
/** Value in `spec`'s unit → its dimension's canonical unit. */
|
|
43950
|
-
function toCanonical(value, spec) {
|
|
43951
|
-
return value * spec.factor + spec.offset;
|
|
43952
|
-
}
|
|
43953
|
-
/** Canonical-unit value → the unit described by `spec`. */
|
|
43954
|
-
function fromCanonical(canonical, spec) {
|
|
43955
|
-
return (canonical - spec.offset) / spec.factor;
|
|
43956
|
-
}
|
|
43957
|
-
/**
|
|
43958
|
-
* Graceful variant for the render path: returns the converted value, or
|
|
43959
|
-
* `undefined` when the conversion is refused (unknown unit / cross-dimension).
|
|
43960
|
-
* Never throws — a render caller falls back to the raw value + source unit.
|
|
43961
|
-
*/
|
|
43962
|
-
function tryConvertUnit(value, from, to) {
|
|
43963
|
-
if (from === to) return value;
|
|
43964
|
-
const fromSpec = specFor(from);
|
|
43965
|
-
if (!fromSpec) return void 0;
|
|
43966
|
-
const toSpec = specFor(to);
|
|
43967
|
-
if (!toSpec) return void 0;
|
|
43968
|
-
if (fromSpec.dimension !== toSpec.dimension) return void 0;
|
|
43969
|
-
return fromCanonical(toCanonical(value, fromSpec), toSpec);
|
|
43970
|
-
}
|
|
43971
|
-
/**
|
|
43972
44092
|
* A number a person types for a physical quantity — the input side of the
|
|
43973
44093
|
* value + unit contract (D972).
|
|
43974
44094
|
*
|
|
@@ -45728,15 +45848,28 @@ var SettingsSchemaWithValuesSchema = object({
|
|
|
45728
45848
|
});
|
|
45729
45849
|
/** Patch object — keys are field names, values are the new field values. */
|
|
45730
45850
|
var SettingsPatchSchema = record(string(), unknown());
|
|
45851
|
+
/** The scope of a scoped-settings call (D986): where the capability declared the values. */
|
|
45852
|
+
var ScopedSettingsScopeSchema = _enum(SCOPED_SETTINGS_SCOPES);
|
|
45853
|
+
/** One scoped schema an addon serves: its capability, scope and section ids. */
|
|
45854
|
+
var ScopedSettingsDeclarationSchema = object({
|
|
45855
|
+
cap: string(),
|
|
45856
|
+
scope: ScopedSettingsScopeSchema,
|
|
45857
|
+
sectionIds: array(string())
|
|
45858
|
+
});
|
|
45731
45859
|
/** Standard success response for update operations. */
|
|
45732
45860
|
var SettingsUpdateResultSchema = object({ success: literal(true) });
|
|
45733
45861
|
method(object({
|
|
45734
45862
|
addonId: string(),
|
|
45735
|
-
|
|
45736
|
-
|
|
45737
|
-
|
|
45863
|
+
cap: string(),
|
|
45864
|
+
scope: ScopedSettingsScopeSchema,
|
|
45865
|
+
nodeId: string().optional()
|
|
45738
45866
|
}), SettingsSchemaWithValuesSchema.nullable()), method(object({
|
|
45739
45867
|
addonId: string(),
|
|
45868
|
+
nodeId: string().optional()
|
|
45869
|
+
}), array(ScopedSettingsDeclarationSchema).nullable()), method(object({
|
|
45870
|
+
addonId: string(),
|
|
45871
|
+
cap: string(),
|
|
45872
|
+
scope: ScopedSettingsScopeSchema,
|
|
45740
45873
|
nodeId: string().optional(),
|
|
45741
45874
|
patch: SettingsPatchSchema
|
|
45742
45875
|
}), SettingsUpdateResultSchema, {
|
|
@@ -45744,8 +45877,10 @@ method(object({
|
|
|
45744
45877
|
auth: "admin"
|
|
45745
45878
|
}), method(object({
|
|
45746
45879
|
addonId: string(),
|
|
45880
|
+
cap: string(),
|
|
45881
|
+
scope: ScopedSettingsScopeSchema,
|
|
45747
45882
|
nodeId: string().optional()
|
|
45748
|
-
}),
|
|
45883
|
+
}), record(string(), unknown()).nullable()), method(object({
|
|
45749
45884
|
addonId: string(),
|
|
45750
45885
|
nodeId: string().optional(),
|
|
45751
45886
|
instance: IntegrationInstanceRefSchema
|
|
@@ -47089,7 +47224,7 @@ var BackupDestinationInfoSchema = object({
|
|
|
47089
47224
|
id: string(),
|
|
47090
47225
|
/**
|
|
47091
47226
|
* Manifest id of the owning addon. The Settings button on the
|
|
47092
|
-
* destination card opens that addon's
|
|
47227
|
+
* destination card opens that addon's scoped settings panel.
|
|
47093
47228
|
*/
|
|
47094
47229
|
addonId: string(),
|
|
47095
47230
|
/** Operator-toggled enable flag from the destination-policy table. */
|
|
@@ -49676,7 +49811,7 @@ DeviceType.MediaPlayer, method(deviceOnly, _void(), {
|
|
|
49676
49811
|
kind: "mutation",
|
|
49677
49812
|
auth: "protected"
|
|
49678
49813
|
});
|
|
49679
|
-
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;
|
|
49814
|
+
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;
|
|
49680
49815
|
var NUMBER = {
|
|
49681
49816
|
kind: "fixed",
|
|
49682
49817
|
result: ["number"]
|
|
@@ -50969,7 +51104,7 @@ DeviceType.Camera, method(object({ deviceId: number() }), DayNightOptionsSchema)
|
|
|
50969
51104
|
});
|
|
50970
51105
|
/**
|
|
50971
51106
|
* Stable UI option list for the `hwaccel` setting. Decoder addons
|
|
50972
|
-
* reuse this
|
|
51107
|
+
* reuse this in their scoped settings form so the dropdown is
|
|
50973
51108
|
* identical everywhere. Order: auto → off → common backends by
|
|
50974
51109
|
* platform affinity (macOS, NVIDIA, Intel/AMD, Windows, Linux).
|
|
50975
51110
|
*/
|
|
@@ -51652,6 +51787,7 @@ var deviceExportCapability = {
|
|
|
51652
51787
|
})
|
|
51653
51788
|
}
|
|
51654
51789
|
};
|
|
51790
|
+
var DeviceAliasSchema = string().max(64).regex(/^[a-z][a-z0-9_]*$/);
|
|
51655
51791
|
/**
|
|
51656
51792
|
* A SITE ZONE — a named part of the property that several locations belong to.
|
|
51657
51793
|
*
|
|
@@ -52045,6 +52181,12 @@ var DeviceInfoSchema = object({
|
|
|
52045
52181
|
addonId: string(),
|
|
52046
52182
|
type: _enum(DeviceType),
|
|
52047
52183
|
name: string(),
|
|
52184
|
+
/** The name a value template uses for this device (`{{ stufa_veranda.temperature }}`),
|
|
52185
|
+
* entity_id style. Generated once from the name at first registration, unique
|
|
52186
|
+
* cluster-wide, editable through `setAlias`, NOT changed by a rename (D1021).
|
|
52187
|
+
* Optional: a record produced by an older build omits it until the boot
|
|
52188
|
+
* backfill has run. */
|
|
52189
|
+
alias: DeviceAliasSchema.optional(),
|
|
52048
52190
|
/** Operator-organisational location label. `null` when unset. */
|
|
52049
52191
|
location: string().nullable(),
|
|
52050
52192
|
/** Soft-disabled flag. */
|
|
@@ -52364,6 +52506,25 @@ method(object({
|
|
|
52364
52506
|
}), _void(), {
|
|
52365
52507
|
kind: "mutation",
|
|
52366
52508
|
auth: "admin"
|
|
52509
|
+
}), method(object({
|
|
52510
|
+
deviceId: number(),
|
|
52511
|
+
alias: string()
|
|
52512
|
+
}), discriminatedUnion("ok", [object({
|
|
52513
|
+
ok: literal(true),
|
|
52514
|
+
alias: DeviceAliasSchema
|
|
52515
|
+
}), object({
|
|
52516
|
+
ok: literal(false),
|
|
52517
|
+
reason: _enum([
|
|
52518
|
+
"empty",
|
|
52519
|
+
"too-long",
|
|
52520
|
+
"grammar",
|
|
52521
|
+
"reserved",
|
|
52522
|
+
"taken"
|
|
52523
|
+
]),
|
|
52524
|
+
takenBy: number().optional()
|
|
52525
|
+
})]), {
|
|
52526
|
+
kind: "mutation",
|
|
52527
|
+
auth: "admin"
|
|
52367
52528
|
}), method(object({
|
|
52368
52529
|
deviceId: number(),
|
|
52369
52530
|
location: string().nullable()
|
|
@@ -55501,10 +55662,11 @@ var IntegrationInstanceDescriptionSchema = object({
|
|
|
55501
55662
|
/** True when `testInstance` really probes the remote. */
|
|
55502
55663
|
canTest: boolean(),
|
|
55503
55664
|
/**
|
|
55504
|
-
* The kinds an instance can be of
|
|
55505
|
-
* Add flow asks which first and sends it as
|
|
55665
|
+
* The kinds an instance can be of (D1013 rule 1), each naming its `functionCap`. One entry:
|
|
55666
|
+
* nothing to choose; more than one: the Add flow asks which first and sends it as
|
|
55667
|
+
* `createInstance.kind`. Never empty: every instance belongs to exactly one kind.
|
|
55506
55668
|
*/
|
|
55507
|
-
kinds: array(IntegrationInstanceKindSchema).
|
|
55669
|
+
kinds: array(IntegrationInstanceKindSchema).min(1),
|
|
55508
55670
|
/**
|
|
55509
55671
|
* The provider accepts `createInstance.id` for an id that once existed (an adopted id, because
|
|
55510
55672
|
* devices carry it). The UI then offers "restore under its old id" on Add. Absent means no.
|
|
@@ -55540,8 +55702,8 @@ var IntegrationInstanceSchema = object({
|
|
|
55540
55702
|
* the body is the one store, `setInstanceEnabled` the one writer (epic #440, step 3).
|
|
55541
55703
|
*/
|
|
55542
55704
|
enabled: boolean().optional(),
|
|
55543
|
-
/** The kind of this instance
|
|
55544
|
-
kind: string().
|
|
55705
|
+
/** The kind of this instance: exactly one of `describe().kinds[].id` (D1013 rule 2). */
|
|
55706
|
+
kind: string().min(1),
|
|
55545
55707
|
/** Values for the instance form; a secret is a `SecretFieldView`, never text. */
|
|
55546
55708
|
formValues: record(string(), unknown()),
|
|
55547
55709
|
status: IntegrationInstanceStatusSchema.optional(),
|
|
@@ -65111,6 +65273,11 @@ var NcScheduleSchema = object({
|
|
|
65111
65273
|
* as a STATE SUMMARY at the end of each window of `schedule`.
|
|
65112
65274
|
*/
|
|
65113
65275
|
var NcSystemEventDeliveryModeSchema = _enum(["instant", "summary"]);
|
|
65276
|
+
_enum([
|
|
65277
|
+
"activation",
|
|
65278
|
+
"deactivation",
|
|
65279
|
+
"schedule"
|
|
65280
|
+
]);
|
|
65114
65281
|
/**
|
|
65115
65282
|
* How a summary window is SENT (D698): `rule` (absent) = ONE notification with
|
|
65116
65283
|
* every section; `section` = one notification per section with something to
|
|
@@ -65127,11 +65294,26 @@ var NcStateSummarySplitSchema = _enum(["rule", "section"]);
|
|
|
65127
65294
|
* midnight crossing); the send time is each window's END. Refused on the
|
|
65128
65295
|
* `alarm` family, which stays instant (`systemEventDeliveryProblems`).
|
|
65129
65296
|
*/
|
|
65130
|
-
var NcSystemEventDeliverySchema = discriminatedUnion("mode", [
|
|
65131
|
-
mode: literal("
|
|
65132
|
-
|
|
65133
|
-
|
|
65134
|
-
|
|
65297
|
+
var NcSystemEventDeliverySchema = discriminatedUnion("mode", [
|
|
65298
|
+
object({ mode: literal("instant") }),
|
|
65299
|
+
object({
|
|
65300
|
+
mode: literal("summary"),
|
|
65301
|
+
schedule: NcScheduleSchema,
|
|
65302
|
+
split: NcStateSummarySplitSchema.optional()
|
|
65303
|
+
}),
|
|
65304
|
+
object({
|
|
65305
|
+
mode: literal("modes"),
|
|
65306
|
+
/** The bad edge, and every kind that has a single edge. */
|
|
65307
|
+
onActivation: boolean(),
|
|
65308
|
+
/** The recovery edges of the classes of the selected kinds (derived, never stored per kind). */
|
|
65309
|
+
onDeactivation: boolean(),
|
|
65310
|
+
/** A state summary at the end of each window; absent = no summary. */
|
|
65311
|
+
onSchedule: object({
|
|
65312
|
+
schedule: NcScheduleSchema,
|
|
65313
|
+
grouping: NcStateSummarySplitSchema
|
|
65314
|
+
}).optional()
|
|
65315
|
+
})
|
|
65316
|
+
]);
|
|
65135
65317
|
/** Fuzzy plate matcher — OCR noise makes exact match useless (spec row 12/13). */
|
|
65136
65318
|
var NcPlateMatcherSchema = object({
|
|
65137
65319
|
/**
|
|
@@ -72651,6 +72833,7 @@ var RemoteLayoutComponentSchema = object({
|
|
|
72651
72833
|
});
|
|
72652
72834
|
});
|
|
72653
72835
|
method(object({}), array(RemoteLayoutComponentSchema), { auth: "protected" });
|
|
72836
|
+
DeviceType.MediaPlayer;
|
|
72654
72837
|
var RunningStateSourceSchema = _enum(["native", "assigned"]);
|
|
72655
72838
|
object({
|
|
72656
72839
|
/** null = unknown — never coerced to false (D393). */
|
|
@@ -75086,7 +75269,7 @@ var TerminalInstanceInfoSchema = object({
|
|
|
75086
75269
|
/**
|
|
75087
75270
|
* False while the node the instance is bound to is not in the cluster
|
|
75088
75271
|
* topology (forgotten, renamed, re-paired). The instance is kept; the
|
|
75089
|
-
* operator re-points it
|
|
75272
|
+
* operator re-points it on the Terminal page.
|
|
75090
75273
|
*/
|
|
75091
75274
|
nodeInCluster: boolean(),
|
|
75092
75275
|
profileId: string(),
|
|
@@ -75124,41 +75307,7 @@ var TerminalOutputBatchSchema = object({
|
|
|
75124
75307
|
snapshot: string().optional(),
|
|
75125
75308
|
events: array(TerminalOutputEventSchema).readonly()
|
|
75126
75309
|
});
|
|
75127
|
-
method(_void(), array(TerminalProfileInfoSchema).readonly(), { auth: "admin" }), method(_void(), array(
|
|
75128
|
-
targetNodeId: string().min(1),
|
|
75129
|
-
profileId: string().min(1),
|
|
75130
|
-
name: string().trim().min(1).max(160).optional(),
|
|
75131
|
-
executable: string().max(1024).optional(),
|
|
75132
|
-
args: array(string().max(2048)).max(64).optional(),
|
|
75133
|
-
cwd: string().max(1024).optional(),
|
|
75134
|
-
environment: array(string().max(4096)).max(64).optional(),
|
|
75135
|
-
profileSettings: ProfileSettingsBagSchema.optional()
|
|
75136
|
-
}), TerminalInstanceInfoSchema, {
|
|
75137
|
-
kind: "mutation",
|
|
75138
|
-
auth: "admin"
|
|
75139
|
-
}), method(object({
|
|
75140
|
-
instanceId: string().min(1),
|
|
75141
|
-
/** Re-point the instance to another node; the profile must exist there. */
|
|
75142
|
-
targetNodeId: string().min(1).max(256).optional(),
|
|
75143
|
-
name: string().trim().min(1).max(160).optional(),
|
|
75144
|
-
executable: string().max(1024).optional(),
|
|
75145
|
-
args: array(string().max(2048)).max(64).optional(),
|
|
75146
|
-
cwd: string().max(1024).optional(),
|
|
75147
|
-
environment: array(string().max(4096)).max(64).optional(),
|
|
75148
|
-
profileSettings: ProfileSettingsBagSchema.optional()
|
|
75149
|
-
}), TerminalInstanceInfoSchema, {
|
|
75150
|
-
kind: "mutation",
|
|
75151
|
-
auth: "admin"
|
|
75152
|
-
}), method(object({ instanceId: string().min(1) }), _void(), {
|
|
75153
|
-
kind: "mutation",
|
|
75154
|
-
auth: "admin"
|
|
75155
|
-
}), method(object({
|
|
75156
|
-
instanceId: string().min(1),
|
|
75157
|
-
enabled: boolean()
|
|
75158
|
-
}), TerminalInstanceInfoSchema, {
|
|
75159
|
-
kind: "mutation",
|
|
75160
|
-
auth: "admin"
|
|
75161
|
-
}), method(_void(), array(TerminalLegacyCameraSchema).readonly(), { auth: "admin" }), method(object({
|
|
75310
|
+
method(_void(), array(TerminalProfileInfoSchema).readonly(), { auth: "admin" }), method(_void(), array(TerminalLegacyCameraSchema).readonly(), { auth: "admin" }), method(object({
|
|
75162
75311
|
stableId: string().min(1),
|
|
75163
75312
|
name: string().trim().min(1).max(160).optional()
|
|
75164
75313
|
}), TerminalInstanceInfoSchema, {
|
|
@@ -75227,6 +75376,11 @@ var TimedRunUnitSchema = _enum(["s", "min"]);
|
|
|
75227
75376
|
_enum(["switch", "pet-fountain"]);
|
|
75228
75377
|
DeviceType.Heater, DeviceType.PetFountain;
|
|
75229
75378
|
DeviceType.Heater, DeviceType.PetFountain;
|
|
75379
|
+
/** One duration, as the one-tap run asks for it. */
|
|
75380
|
+
var TimedRunQuickRunSchema = object({
|
|
75381
|
+
duration: number().positive().finite(),
|
|
75382
|
+
unit: TimedRunUnitSchema
|
|
75383
|
+
});
|
|
75230
75384
|
/** Why a request was not carried out. Typed, so a caller can say it in words. */
|
|
75231
75385
|
var TimedRunRefusalSchema = _enum([
|
|
75232
75386
|
"unsupported-device",
|
|
@@ -75247,9 +75401,30 @@ object({
|
|
|
75247
75401
|
activeUntil: number().nullable(),
|
|
75248
75402
|
/** Who asked for the run (a user id or an addon id); `null` when nothing is armed or it did not say. */
|
|
75249
75403
|
requestedBy: string().nullable(),
|
|
75404
|
+
/**
|
|
75405
|
+
* The one-tap run of THIS device: what a "Run" button on any surface starts. `null` when
|
|
75406
|
+
* the device is gone or its type has no timed run; a status from before this field
|
|
75407
|
+
* existed has none, and a surface falls back to the type's default.
|
|
75408
|
+
*/
|
|
75409
|
+
quickRun: TimedRunQuickRunSchema.nullable(),
|
|
75250
75410
|
lastFetchedAt: number()
|
|
75251
75411
|
});
|
|
75252
|
-
|
|
75412
|
+
/** What the settings form needs: the unit, the bounds and the type's default. */
|
|
75413
|
+
var TimedRunOptionsSchema = object({
|
|
75414
|
+
unit: TimedRunUnitSchema,
|
|
75415
|
+
/** The longest run, in `unit`. */
|
|
75416
|
+
maxDuration: number(),
|
|
75417
|
+
defaultDuration: number()
|
|
75418
|
+
});
|
|
75419
|
+
/** The one-tap run duration, in the type's unit; `null` returns to the type's default. */
|
|
75420
|
+
var TimedRunSettingsPatchSchema = object({ quickRunDuration: number().positive().finite().nullable().optional() });
|
|
75421
|
+
method(object({ deviceId: number().int() }), TimedRunOptionsSchema), method(object({
|
|
75422
|
+
deviceId: number().int(),
|
|
75423
|
+
settings: TimedRunSettingsPatchSchema
|
|
75424
|
+
}), _void(), {
|
|
75425
|
+
kind: "mutation",
|
|
75426
|
+
auth: "admin"
|
|
75427
|
+
}), method(object({
|
|
75253
75428
|
deviceId: number().int(),
|
|
75254
75429
|
duration: number().positive().finite(),
|
|
75255
75430
|
unit: TimedRunUnitSchema
|
|
@@ -77955,21 +78130,28 @@ Object.freeze({
|
|
|
77955
78130
|
access: "view",
|
|
77956
78131
|
role: "admin"
|
|
77957
78132
|
},
|
|
77958
|
-
"addonSettings.
|
|
78133
|
+
"addonSettings.getIntegrationFormSchema": {
|
|
77959
78134
|
capName: "addon-settings",
|
|
77960
78135
|
capScope: "system",
|
|
77961
78136
|
addonId: null,
|
|
77962
78137
|
access: "view",
|
|
77963
78138
|
role: "admin"
|
|
77964
78139
|
},
|
|
77965
|
-
"addonSettings.
|
|
78140
|
+
"addonSettings.getScopedSettings": {
|
|
77966
78141
|
capName: "addon-settings",
|
|
77967
78142
|
capScope: "system",
|
|
77968
78143
|
addonId: null,
|
|
77969
78144
|
access: "view",
|
|
77970
78145
|
role: "admin"
|
|
77971
78146
|
},
|
|
77972
|
-
"addonSettings.
|
|
78147
|
+
"addonSettings.listScopedSettings": {
|
|
78148
|
+
capName: "addon-settings",
|
|
78149
|
+
capScope: "system",
|
|
78150
|
+
addonId: null,
|
|
78151
|
+
access: "view",
|
|
78152
|
+
role: "admin"
|
|
78153
|
+
},
|
|
78154
|
+
"addonSettings.readScopedValues": {
|
|
77973
78155
|
capName: "addon-settings",
|
|
77974
78156
|
capScope: "system",
|
|
77975
78157
|
addonId: null,
|
|
@@ -77990,7 +78172,7 @@ Object.freeze({
|
|
|
77990
78172
|
access: "create",
|
|
77991
78173
|
role: "admin"
|
|
77992
78174
|
},
|
|
77993
|
-
"addonSettings.
|
|
78175
|
+
"addonSettings.updateScopedSettings": {
|
|
77994
78176
|
capName: "addon-settings",
|
|
77995
78177
|
capScope: "system",
|
|
77996
78178
|
addonId: null,
|
|
@@ -80160,6 +80342,13 @@ Object.freeze({
|
|
|
80160
80342
|
access: "create",
|
|
80161
80343
|
role: "admin"
|
|
80162
80344
|
},
|
|
80345
|
+
"deviceManager.setAlias": {
|
|
80346
|
+
capName: "device-manager",
|
|
80347
|
+
capScope: "system",
|
|
80348
|
+
addonId: null,
|
|
80349
|
+
access: "create",
|
|
80350
|
+
role: "admin"
|
|
80351
|
+
},
|
|
80163
80352
|
"deviceManager.setChildLayout": {
|
|
80164
80353
|
capName: "device-manager",
|
|
80165
80354
|
capScope: "system",
|
|
@@ -86887,27 +87076,6 @@ Object.freeze({
|
|
|
86887
87076
|
access: "create",
|
|
86888
87077
|
role: "admin"
|
|
86889
87078
|
},
|
|
86890
|
-
"terminalSession.createInstance": {
|
|
86891
|
-
capName: "terminal-session",
|
|
86892
|
-
capScope: "system",
|
|
86893
|
-
addonId: null,
|
|
86894
|
-
access: "create",
|
|
86895
|
-
role: "admin"
|
|
86896
|
-
},
|
|
86897
|
-
"terminalSession.deleteInstance": {
|
|
86898
|
-
capName: "terminal-session",
|
|
86899
|
-
capScope: "system",
|
|
86900
|
-
addonId: null,
|
|
86901
|
-
access: "delete",
|
|
86902
|
-
role: "admin"
|
|
86903
|
-
},
|
|
86904
|
-
"terminalSession.listInstances": {
|
|
86905
|
-
capName: "terminal-session",
|
|
86906
|
-
capScope: "system",
|
|
86907
|
-
addonId: null,
|
|
86908
|
-
access: "view",
|
|
86909
|
-
role: "admin"
|
|
86910
|
-
},
|
|
86911
87079
|
"terminalSession.listLegacyCameras": {
|
|
86912
87080
|
capName: "terminal-session",
|
|
86913
87081
|
capScope: "system",
|
|
@@ -86950,20 +87118,6 @@ Object.freeze({
|
|
|
86950
87118
|
access: "create",
|
|
86951
87119
|
role: "admin"
|
|
86952
87120
|
},
|
|
86953
|
-
"terminalSession.setInstanceEnabled": {
|
|
86954
|
-
capName: "terminal-session",
|
|
86955
|
-
capScope: "system",
|
|
86956
|
-
addonId: null,
|
|
86957
|
-
access: "create",
|
|
86958
|
-
role: "admin"
|
|
86959
|
-
},
|
|
86960
|
-
"terminalSession.updateInstance": {
|
|
86961
|
-
capName: "terminal-session",
|
|
86962
|
-
capScope: "system",
|
|
86963
|
-
addonId: null,
|
|
86964
|
-
access: "create",
|
|
86965
|
-
role: "admin"
|
|
86966
|
-
},
|
|
86967
87121
|
"terminalSession.writeInput": {
|
|
86968
87122
|
capName: "terminal-session",
|
|
86969
87123
|
capScope: "system",
|
|
@@ -86978,6 +87132,13 @@ Object.freeze({
|
|
|
86978
87132
|
access: "create",
|
|
86979
87133
|
role: "viewer"
|
|
86980
87134
|
},
|
|
87135
|
+
"timedRun.getOptions": {
|
|
87136
|
+
capName: "timed-run",
|
|
87137
|
+
capScope: "device",
|
|
87138
|
+
addonId: null,
|
|
87139
|
+
access: "view",
|
|
87140
|
+
role: "viewer"
|
|
87141
|
+
},
|
|
86981
87142
|
"timedRun.getStatus": {
|
|
86982
87143
|
capName: "timed-run",
|
|
86983
87144
|
capScope: "device",
|
|
@@ -86992,6 +87153,13 @@ Object.freeze({
|
|
|
86992
87153
|
access: "create",
|
|
86993
87154
|
role: "viewer"
|
|
86994
87155
|
},
|
|
87156
|
+
"timedRun.setSettings": {
|
|
87157
|
+
capName: "timed-run",
|
|
87158
|
+
capScope: "device",
|
|
87159
|
+
addonId: null,
|
|
87160
|
+
access: "create",
|
|
87161
|
+
role: "admin"
|
|
87162
|
+
},
|
|
86995
87163
|
"toast.onToast": {
|
|
86996
87164
|
capName: "toast",
|
|
86997
87165
|
capScope: "system",
|
|
@@ -87947,6 +88115,7 @@ function applianceExport(ecosystem, deviceType) {
|
|
|
87947
88115
|
if (!isPlugApplianceType(deviceType)) return null;
|
|
87948
88116
|
return APPLIANCE_EXPORT[ecosystem][deviceType];
|
|
87949
88117
|
}
|
|
88118
|
+
string().min(1).max(4096);
|
|
87950
88119
|
Object.freeze({
|
|
87951
88120
|
"accessories.getStatus": [{
|
|
87952
88121
|
name: "deviceId",
|
|
@@ -88630,6 +88799,11 @@ Object.freeze({
|
|
|
88630
88799
|
form: "single",
|
|
88631
88800
|
optional: false
|
|
88632
88801
|
}],
|
|
88802
|
+
"deviceManager.setAlias": [{
|
|
88803
|
+
name: "deviceId",
|
|
88804
|
+
form: "single",
|
|
88805
|
+
optional: false
|
|
88806
|
+
}],
|
|
88633
88807
|
"deviceManager.setChildLayout": [{
|
|
88634
88808
|
name: "deviceId",
|
|
88635
88809
|
form: "single",
|
|
@@ -90694,6 +90868,11 @@ Object.freeze({
|
|
|
90694
90868
|
form: "single",
|
|
90695
90869
|
optional: false
|
|
90696
90870
|
}],
|
|
90871
|
+
"timedRun.getOptions": [{
|
|
90872
|
+
name: "deviceId",
|
|
90873
|
+
form: "single",
|
|
90874
|
+
optional: false
|
|
90875
|
+
}],
|
|
90697
90876
|
"timedRun.getStatus": [{
|
|
90698
90877
|
name: "deviceId",
|
|
90699
90878
|
form: "single",
|
|
@@ -90704,6 +90883,11 @@ Object.freeze({
|
|
|
90704
90883
|
form: "single",
|
|
90705
90884
|
optional: false
|
|
90706
90885
|
}],
|
|
90886
|
+
"timedRun.setSettings": [{
|
|
90887
|
+
name: "deviceId",
|
|
90888
|
+
form: "single",
|
|
90889
|
+
optional: false
|
|
90890
|
+
}],
|
|
90707
90891
|
"update.getStatus": [{
|
|
90708
90892
|
name: "deviceId",
|
|
90709
90893
|
form: "single",
|
|
@@ -91566,6 +91750,7 @@ var STATE_SUMMARY_VARS = [
|
|
|
91566
91750
|
[...RULE_TEXT],
|
|
91567
91751
|
[...RULE_TEXT],
|
|
91568
91752
|
[...RULE_TEXT],
|
|
91753
|
+
[...RULE_TEXT],
|
|
91569
91754
|
[...RULE_BODY_ONLY],
|
|
91570
91755
|
[...RULE_TEXT],
|
|
91571
91756
|
([...RULE_TEXT], [...DEVICE_EVENTS]),
|
|
@@ -159470,10 +159655,23 @@ var HAP_STREAM_PREFERENCE_OPTIONS = [
|
|
|
159470
159655
|
label: "Low"
|
|
159471
159656
|
}
|
|
159472
159657
|
];
|
|
159658
|
+
/** One device's advertised HAP state, persisted in the addon store. JSON-plain
|
|
159659
|
+
* mirror of `ExportTargetEntry` from `@camstack/types/node`. Keyed by
|
|
159660
|
+
* `String(deviceId)` in the `exportSyncState` store key. `externalIds` holds
|
|
159661
|
+
* the deterministic accessory UUID (diagnostic; rebuild uses the live mapper). */
|
|
159662
|
+
var ExportTargetEntrySchema = object({
|
|
159663
|
+
fingerprint: string(),
|
|
159664
|
+
externalIds: array(string())
|
|
159665
|
+
});
|
|
159666
|
+
/** Durable per-device export sync state — the Phase-C reconciler cache, kept under the
|
|
159667
|
+
* addon-store key `exportSyncState` (the key the addon always used).
|
|
159668
|
+
* Key = `String(deviceId)`, value = the device's export fingerprint at last
|
|
159669
|
+
* attach. Drives `diffExportTargets`: an unchanged restart hashes to the same
|
|
159670
|
+
* fingerprint → no rebuild. */
|
|
159671
|
+
var ExportSyncStateSchema = record(string(), ExportTargetEntrySchema);
|
|
159473
159672
|
var DEFAULT_CONFIG = {
|
|
159474
159673
|
interfaceName: "",
|
|
159475
|
-
clipRetentionDays: 14
|
|
159476
|
-
exportSyncState: {}
|
|
159674
|
+
clipRetentionDays: 14
|
|
159477
159675
|
};
|
|
159478
159676
|
var BANNED_PINCODES = new Set([
|
|
159479
159677
|
"000-00-000",
|
|
@@ -159578,7 +159776,13 @@ var ExportHapAddon = class extends BaseAddon {
|
|
|
159578
159776
|
role: "services",
|
|
159579
159777
|
instanceMode: "multiple",
|
|
159580
159778
|
kind: "bridge",
|
|
159581
|
-
canTest: false
|
|
159779
|
+
canTest: false,
|
|
159780
|
+
kinds: [{
|
|
159781
|
+
id: "bridge",
|
|
159782
|
+
label: "HomeKit bridge",
|
|
159783
|
+
functionCap: "device-export",
|
|
159784
|
+
role: "services"
|
|
159785
|
+
}]
|
|
159582
159786
|
},
|
|
159583
159787
|
formSchema: (id) => this.bridgeForm(id),
|
|
159584
159788
|
initialBody: (name) => ({
|
|
@@ -159792,7 +159996,7 @@ var ExportHapAddon = class extends BaseAddon {
|
|
|
159792
159996
|
await this.stopInstance(id);
|
|
159793
159997
|
for (const uuid of uuids) clearPairingFiles(uuid, this.ctx.logger);
|
|
159794
159998
|
await this.exposureHandle().delete(id);
|
|
159795
|
-
if (id === "export-hap") await this.
|
|
159999
|
+
if (id === "export-hap") await this.exportSyncState.set({});
|
|
159796
160000
|
this.ctx.logger.info("export-hap: bridge removed", { meta: { instanceId: id } });
|
|
159797
160001
|
}
|
|
159798
160002
|
/**
|
|
@@ -160164,9 +160368,11 @@ var ExportHapAddon = class extends BaseAddon {
|
|
|
160164
160368
|
return inst.accessoryUuidOf(inst.findEntry(deviceId)?.mapperKind ?? "camera", deviceId);
|
|
160165
160369
|
}
|
|
160166
160370
|
/** The reconcile cache of a bridge: the default one is persisted, the others live in memory (boot re-attach seeds them). */
|
|
160167
|
-
syncStateOf(inst) {
|
|
160168
|
-
return inst.id === "export-hap" ? syncStateFromJson(this.
|
|
160371
|
+
async syncStateOf(inst) {
|
|
160372
|
+
return inst.id === "export-hap" ? syncStateFromJson(await this.exportSyncState.get()) : inst.syncState;
|
|
160169
160373
|
}
|
|
160374
|
+
/** The persisted reconcile cache of the default bridge (store key `exportSyncState`). */
|
|
160375
|
+
exportSyncState = this.state("exportSyncState", ExportSyncStateSchema, {});
|
|
160170
160376
|
/**
|
|
160171
160377
|
* Export fingerprint of a device from its PERSISTED features + type
|
|
160172
160378
|
* (`canonicalDeviceFingerprint`). Returns `null` on a transient API error or
|
|
@@ -160192,7 +160398,7 @@ var ExportHapAddon = class extends BaseAddon {
|
|
|
160192
160398
|
deviceType: device.type,
|
|
160193
160399
|
features: device.features
|
|
160194
160400
|
});
|
|
160195
|
-
const persisted = this.syncStateOf(inst).get(deviceId)?.fingerprint;
|
|
160401
|
+
const persisted = (await this.syncStateOf(inst)).get(deviceId)?.fingerprint;
|
|
160196
160402
|
const withToken = withRecordabilityToken({
|
|
160197
160403
|
base: fresh,
|
|
160198
160404
|
token: await this.readRecordabilityToken(inst, deviceId, device.type),
|
|
@@ -160227,22 +160433,35 @@ var ExportHapAddon = class extends BaseAddon {
|
|
|
160227
160433
|
return null;
|
|
160228
160434
|
}
|
|
160229
160435
|
}
|
|
160436
|
+
/** Tail of the pending cache writes of each bridge: a read-modify-write of one bridge never overlaps another. */
|
|
160437
|
+
syncWrites = /* @__PURE__ */ new Map();
|
|
160438
|
+
/** Run one read-modify-write of a bridge's reconcile cache after the previous one finished. */
|
|
160439
|
+
serialisedSyncWrite(inst, write) {
|
|
160440
|
+
const next = (this.syncWrites.get(inst.id) ?? Promise.resolve()).then(write);
|
|
160441
|
+
this.syncWrites.set(inst.id, next.catch(() => void 0));
|
|
160442
|
+
return next;
|
|
160443
|
+
}
|
|
160230
160444
|
/** Persist a device's current export fingerprint into `exportSyncState`
|
|
160231
|
-
* (best-effort; called after a successful attach).
|
|
160232
|
-
|
|
160233
|
-
|
|
160234
|
-
|
|
160235
|
-
|
|
160236
|
-
|
|
160445
|
+
* (best-effort; called after a successful attach). Serialised per bridge, so two attaches
|
|
160446
|
+
* finishing together cannot each write back a cache that lacks the other's entry. */
|
|
160447
|
+
persistFingerprint(inst, deviceId, fingerprint) {
|
|
160448
|
+
return this.serialisedSyncWrite(inst, async () => {
|
|
160449
|
+
const state = await this.syncStateOf(inst);
|
|
160450
|
+
state.set(deviceId, {
|
|
160451
|
+
fingerprint,
|
|
160452
|
+
externalIds: [this.hapAccessoryUuid(inst, deviceId)]
|
|
160453
|
+
});
|
|
160454
|
+
if (inst.id === "export-hap") await this.exportSyncState.set(syncStateToJson(state));
|
|
160237
160455
|
});
|
|
160238
|
-
if (inst.id === "export-hap") await this.updateGlobalSettings({ exportSyncState: syncStateToJson(state) });
|
|
160239
160456
|
}
|
|
160240
|
-
/** Drop a device's `exportSyncState` entry (on unexpose). */
|
|
160241
|
-
|
|
160242
|
-
|
|
160243
|
-
|
|
160244
|
-
|
|
160245
|
-
|
|
160457
|
+
/** Drop a device's `exportSyncState` entry (on unexpose). Serialised with the writes above. */
|
|
160458
|
+
forgetFingerprint(inst, deviceId) {
|
|
160459
|
+
return this.serialisedSyncWrite(inst, async () => {
|
|
160460
|
+
const state = await this.syncStateOf(inst);
|
|
160461
|
+
if (!state.has(deviceId)) return;
|
|
160462
|
+
state.delete(deviceId);
|
|
160463
|
+
if (inst.id === "export-hap") await this.exportSyncState.set(syncStateToJson(state));
|
|
160464
|
+
});
|
|
160246
160465
|
}
|
|
160247
160466
|
/**
|
|
160248
160467
|
* Subscribe to a device-lifecycle event category and reconcile the exposed
|
|
@@ -160330,7 +160549,7 @@ var ExportHapAddon = class extends BaseAddon {
|
|
|
160330
160549
|
log.debug("export-hap: reconcile skipped — fingerprint unavailable (transient)");
|
|
160331
160550
|
return;
|
|
160332
160551
|
}
|
|
160333
|
-
const last = this.syncStateOf(inst).get(numericId);
|
|
160552
|
+
const last = (await this.syncStateOf(inst)).get(numericId);
|
|
160334
160553
|
if (last?.fingerprint === current) {
|
|
160335
160554
|
if (!inst.exposed.has(deviceId)) try {
|
|
160336
160555
|
await this.attachMapper(inst, entry);
|
|
@@ -160852,6 +161071,7 @@ exports.DEFAULT_DEVICE_SETTINGS = DEFAULT_DEVICE_SETTINGS;
|
|
|
160852
161071
|
exports.EXPORT_HAP_ADDON_ID = EXPORT_HAP_ADDON_ID;
|
|
160853
161072
|
exports.ExportHapAddon = ExportHapAddon;
|
|
160854
161073
|
exports.default = ExportHapAddon;
|
|
161074
|
+
exports.ExportSyncStateSchema = ExportSyncStateSchema;
|
|
160855
161075
|
exports.__toCommonJS = __toCommonJS;
|
|
160856
161076
|
exports.deriveUsername = deriveUsername;
|
|
160857
161077
|
exports.describeHksvCamera = describeHksvCamera;
|