@camstack/addon-export-alexa 1.2.184 → 1.2.185
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/export-alexa.addon.js +1614 -1250
- package/dist/export-alexa.addon.mjs +1614 -1250
- package/package.json +2 -2
|
@@ -5987,7 +5987,7 @@ var ZodIssueCode = {
|
|
|
5987
5987
|
var ZodFirstPartyTypeKind;
|
|
5988
5988
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
5989
5989
|
//#endregion
|
|
5990
|
-
//#region ../types/dist/sleep-
|
|
5990
|
+
//#region ../types/dist/sleep-CmjWurK5.mjs
|
|
5991
5991
|
/**
|
|
5992
5992
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
5993
5993
|
* window to float samples (D455).
|
|
@@ -6671,130 +6671,92 @@ async function runAddonMigrations(host, migrations, logger, options = {}) {
|
|
|
6671
6671
|
blockOwner
|
|
6672
6672
|
};
|
|
6673
6673
|
}
|
|
6674
|
-
/**
|
|
6675
|
-
|
|
6676
|
-
|
|
6677
|
-
|
|
6678
|
-
|
|
6679
|
-
|
|
6680
|
-
|
|
6681
|
-
|
|
6682
|
-
|
|
6683
|
-
|
|
6684
|
-
|
|
6685
|
-
|
|
6686
|
-
|
|
6687
|
-
|
|
6688
|
-
|
|
6689
|
-
|
|
6690
|
-
|
|
6691
|
-
|
|
6692
|
-
const set = async (next) => {
|
|
6693
|
-
const validated = deps.schema.parse(next);
|
|
6694
|
-
await deps.write({ [deps.key]: validated });
|
|
6695
|
-
};
|
|
6696
|
-
const update = async (fn) => {
|
|
6697
|
-
await set(fn(await get()));
|
|
6698
|
-
};
|
|
6674
|
+
/** The record calls the one-switch migration makes, over the migration API. */
|
|
6675
|
+
function switchRecordsOverMigrationApi(api) {
|
|
6676
|
+
return { kind: (definition) => {
|
|
6677
|
+
const handle = api.records.kind(definition);
|
|
6678
|
+
return {
|
|
6679
|
+
get: (id) => handle.get({ id }),
|
|
6680
|
+
put: (input, opts) => handle.put({
|
|
6681
|
+
...input,
|
|
6682
|
+
...opts?.ifRev === void 0 ? {} : { ifRev: opts.ifRev }
|
|
6683
|
+
}),
|
|
6684
|
+
patch: (id, partial) => handle.patch({
|
|
6685
|
+
id,
|
|
6686
|
+
partial
|
|
6687
|
+
})
|
|
6688
|
+
};
|
|
6689
|
+
} };
|
|
6690
|
+
}
|
|
6691
|
+
function integrationRowsApiOver(api) {
|
|
6699
6692
|
return {
|
|
6700
|
-
|
|
6701
|
-
|
|
6702
|
-
|
|
6693
|
+
list: async () => (await api.integrations.list({})).integrations,
|
|
6694
|
+
readLegacyIntegrationRows: (input) => api.legacyRows.read(input),
|
|
6695
|
+
clearLegacyIntegrationRows: (input) => api.legacyRows.clear(input)
|
|
6703
6696
|
};
|
|
6704
6697
|
}
|
|
6705
|
-
|
|
6706
|
-
|
|
6707
|
-
|
|
6708
|
-
|
|
6709
|
-
|
|
6710
|
-
|
|
6711
|
-
|
|
6712
|
-
|
|
6713
|
-
|
|
6714
|
-
|
|
6715
|
-
* back, so UI forms and `resolveConfig` only ever see the bare key.
|
|
6716
|
-
*
|
|
6717
|
-
* Fields opt in via the `perNode: true` schema marker on `ConfigFieldBase`
|
|
6718
|
-
* (`interfaces/config-ui.ts`); `BaseAddon` derives the key set from the
|
|
6719
|
-
* schema and routes reads/writes through these helpers.
|
|
6720
|
-
*
|
|
6721
|
-
* ## No bare-key fallback — deliberate
|
|
6722
|
-
*
|
|
6723
|
-
* {@link readNodeValue} reads the node-scoped key ONLY. A node with no
|
|
6724
|
-
* scoped key resolves to `undefined` so the field's schema `default` wins —
|
|
6725
|
-
* NEVER `store[base]` and never another node's value. A bare legacy key in
|
|
6726
|
-
* the store is invisible to every node, hub included, so one node's
|
|
6727
|
-
* selection can never leak onto another. (This generalizes the
|
|
6728
|
-
* `decoder-backend-keys.ts` semantics — the no-fallback variant — over an
|
|
6729
|
-
* arbitrary set of per-node field keys.)
|
|
6730
|
-
*
|
|
6731
|
-
* Pure functions only — no I/O, no imports beyond the language. This is a
|
|
6732
|
-
* LEAF module: import it via its deep path, never from the root barrel.
|
|
6733
|
-
*/
|
|
6734
|
-
/**
|
|
6735
|
-
* Normalize a raw kernel node id to the bare node id used for scoping.
|
|
6736
|
-
* `localNodeId` can carry a `<node>/<addon>` suffix on forked child
|
|
6737
|
-
* processes; per-node settings are per-NODE, so strip the addon segment.
|
|
6738
|
-
* `undefined` / `null` / empty falls back to `'hub'`.
|
|
6739
|
-
*/
|
|
6740
|
-
function normalizeNodeId(raw) {
|
|
6741
|
-
if (raw === void 0 || raw === null || raw === "") return "hub";
|
|
6742
|
-
const slashIdx = raw.indexOf("/");
|
|
6743
|
-
if (slashIdx < 0) return raw;
|
|
6744
|
-
const bare = raw.slice(0, slashIdx);
|
|
6745
|
-
return bare === "" ? "hub" : bare;
|
|
6746
|
-
}
|
|
6747
|
-
/** The node-scoped store key for a per-node field: `<base>@<nodeId>`. */
|
|
6748
|
-
function nodeScopedKey(base, nodeId) {
|
|
6749
|
-
return `${base}@${normalizeNodeId(nodeId)}`;
|
|
6750
|
-
}
|
|
6751
|
-
/**
|
|
6752
|
-
* Read a node's value for a per-node field from the raw shared store:
|
|
6753
|
-
* the node-scoped key when present, otherwise `undefined`.
|
|
6754
|
-
* Deliberately NO bare-key fallback (see module doc) — the caller lets the
|
|
6755
|
-
* schema `default` win on `undefined`.
|
|
6756
|
-
*/
|
|
6757
|
-
function readNodeValue(store, base, nodeId) {
|
|
6758
|
-
return store[nodeScopedKey(base, nodeId)];
|
|
6759
|
-
}
|
|
6760
|
-
/**
|
|
6761
|
-
* Re-map a UI/settings patch so every bare perNode field persists under the
|
|
6762
|
-
* TARGET node's scoped key; all other keys pass through unchanged. Used on
|
|
6763
|
-
* the write path so a save for one node never clobbers another node's value
|
|
6764
|
-
* (and the bare key is never written). Returns a new object — the input
|
|
6765
|
-
* patch is not mutated.
|
|
6766
|
-
*/
|
|
6767
|
-
function scopePatch(patch, perNodeKeys, nodeId) {
|
|
6768
|
-
const out = {};
|
|
6769
|
-
for (const [key, value] of Object.entries(patch)) out[perNodeKeys.has(key) ? nodeScopedKey(key, nodeId) : key] = value;
|
|
6770
|
-
return out;
|
|
6771
|
-
}
|
|
6772
|
-
/**
|
|
6773
|
-
* Project the raw shared store onto the bare schema keys for ONE node so a
|
|
6774
|
-
* UI schema (whose field keys are bare) hydrates from that node's own
|
|
6775
|
-
* values:
|
|
6776
|
-
*
|
|
6777
|
-
* - EVERY `@`-scoped key (any node's) is dropped from the pass-through.
|
|
6778
|
-
* - Every bare perNode key is dropped from the pass-through (a stray bare
|
|
6779
|
-
* legacy key must never hydrate any node — no bare fallback).
|
|
6780
|
-
* - THIS node's effective value ({@link readNodeValue}) is then laid onto
|
|
6781
|
-
* each bare perNode key; when the node has no scoped key the bare key is
|
|
6782
|
-
* left ABSENT so the field's schema `default` wins.
|
|
6783
|
-
*
|
|
6784
|
-
* Returns a new object — the input store is not mutated.
|
|
6785
|
-
*/
|
|
6786
|
-
function projectStore(store, perNodeKeys, nodeId) {
|
|
6787
|
-
const out = {};
|
|
6788
|
-
for (const [key, value] of Object.entries(store)) {
|
|
6789
|
-
if (key.includes("@")) continue;
|
|
6790
|
-
if (perNodeKeys.has(key)) continue;
|
|
6791
|
-
out[key] = value;
|
|
6698
|
+
var PREFIX$1 = "records/";
|
|
6699
|
+
/** The base of every records failure. `detail` is the human part of the message. */
|
|
6700
|
+
var RecordsError = class extends Error {
|
|
6701
|
+
code;
|
|
6702
|
+
detail;
|
|
6703
|
+
constructor(code, detail) {
|
|
6704
|
+
super(`${PREFIX$1}${code}: ${detail}`);
|
|
6705
|
+
this.name = "RecordsError";
|
|
6706
|
+
this.code = code;
|
|
6707
|
+
this.detail = detail;
|
|
6792
6708
|
}
|
|
6793
|
-
|
|
6794
|
-
|
|
6795
|
-
|
|
6709
|
+
};
|
|
6710
|
+
/** A write guarded by `ifRev` found another revision (or an existing row for `ifRev: 0`). */
|
|
6711
|
+
var RevConflictError = class extends RecordsError {
|
|
6712
|
+
constructor(detail) {
|
|
6713
|
+
super("rev-conflict", detail);
|
|
6714
|
+
this.name = "RevConflictError";
|
|
6796
6715
|
}
|
|
6797
|
-
|
|
6716
|
+
};
|
|
6717
|
+
/** The keychain could not store or serve a value: explicit, never an empty string. */
|
|
6718
|
+
var RecordSecretUnavailableError = class extends RecordsError {
|
|
6719
|
+
constructor(detail) {
|
|
6720
|
+
super("secret-unavailable", detail);
|
|
6721
|
+
this.name = "RecordSecretUnavailableError";
|
|
6722
|
+
}
|
|
6723
|
+
};
|
|
6724
|
+
var InvalidRecordError = class extends RecordsError {
|
|
6725
|
+
constructor(detail) {
|
|
6726
|
+
super("invalid-record", detail);
|
|
6727
|
+
this.name = "InvalidRecordError";
|
|
6728
|
+
}
|
|
6729
|
+
};
|
|
6730
|
+
/** A kind declaration the engine refuses (non-additive change, bad shape, wrong file). */
|
|
6731
|
+
var DeclarationRefusedError = class extends RecordsError {
|
|
6732
|
+
constructor(detail) {
|
|
6733
|
+
super("declaration-refused", detail);
|
|
6734
|
+
this.name = "DeclarationRefusedError";
|
|
6735
|
+
}
|
|
6736
|
+
};
|
|
6737
|
+
function linkTargetOf(meta) {
|
|
6738
|
+
if (typeof meta !== "object" || meta === null) return void 0;
|
|
6739
|
+
const link = Reflect.get(meta, "link");
|
|
6740
|
+
const parsed = LinkTargetSchema.safeParse(link);
|
|
6741
|
+
return parsed.success ? parsed.data : void 0;
|
|
6742
|
+
}
|
|
6743
|
+
var LinkTargetSchema = object({
|
|
6744
|
+
cap: string().min(1),
|
|
6745
|
+
kind: string().min(1).optional()
|
|
6746
|
+
});
|
|
6747
|
+
/** The links a kind declares, read from the meta of its body fields. */
|
|
6748
|
+
function linksOfKind(kind) {
|
|
6749
|
+
const schema = kind.schema;
|
|
6750
|
+
if (!(schema instanceof ZodObject)) return [];
|
|
6751
|
+
const links = [];
|
|
6752
|
+
for (const [field, fieldSchema] of Object.entries(schema.shape)) {
|
|
6753
|
+
const to = linkTargetOf(globalRegistry.get(fieldSchema));
|
|
6754
|
+
if (to !== void 0) links.push({
|
|
6755
|
+
field,
|
|
6756
|
+
to
|
|
6757
|
+
});
|
|
6758
|
+
}
|
|
6759
|
+
return links;
|
|
6798
6760
|
}
|
|
6799
6761
|
/**
|
|
6800
6762
|
* The address of one keychain value: `secret://<owner>/<scope>/<fieldPath>`.
|
|
@@ -6930,6 +6892,643 @@ function parseSecretRef(ref) {
|
|
|
6930
6892
|
fieldPath
|
|
6931
6893
|
};
|
|
6932
6894
|
}
|
|
6895
|
+
/** Limits and names of `ctx.records` (D881). One authority; the engine and the facade read it. */
|
|
6896
|
+
/** The files a kind may live in. `history` is device-history's (D850), never records. */
|
|
6897
|
+
var RECORD_DATABASES = ["settings", "events"];
|
|
6898
|
+
/** The classes of a kind: the `@durable` vocabulary, one authority (replaces the annotation). */
|
|
6899
|
+
var RECORD_CLASSES = [
|
|
6900
|
+
"config",
|
|
6901
|
+
"ledger",
|
|
6902
|
+
"audit",
|
|
6903
|
+
"mirror",
|
|
6904
|
+
"ephemeral"
|
|
6905
|
+
];
|
|
6906
|
+
var RECORD_DEFAULT_MAX_DATA_BYTES = 64 * 1024;
|
|
6907
|
+
var RECORD_MAX_DATA_BYTES = 1024 * 1024;
|
|
6908
|
+
var RECORD_BATCH_MAX = 1e3;
|
|
6909
|
+
var RECORD_QUERY_MAX = 1e3;
|
|
6910
|
+
/** A kind in the `settings` file may not bound itself above this (D447: high volume is `events`). */
|
|
6911
|
+
var RECORD_SETTINGS_MAX_ROWS = 5e4;
|
|
6912
|
+
/** The `Column`-free proof prefix: a ref collection for a kind's secret fields. */
|
|
6913
|
+
var RECORD_SECRET_COLLECTION_PREFIX = "records:";
|
|
6914
|
+
/**
|
|
6915
|
+
* Secret fields of a record, addressed the way a Zod schema declares them
|
|
6916
|
+
* (`collectZodSecretPaths`): dotted keys, `[]` for "each element of this array"
|
|
6917
|
+
* (`auth.accessToken`, `headers[].value`).
|
|
6918
|
+
*
|
|
6919
|
+
* `{}` after a key means "each value of this map" (`applianceSecrets{}`): the map's own key
|
|
6920
|
+
* names the value (`applianceSecrets{fridge}`), so no id key is declared and a body that drops a
|
|
6921
|
+
* key releases exactly that key's secret.
|
|
6922
|
+
*
|
|
6923
|
+
* Array elements are matched by a DECLARED id key (`secretArrayKeys`:
|
|
6924
|
+
* `{ headers: 'name' }`), never by index, so reordering a list keeps every
|
|
6925
|
+
* keychain ref (the same rule as `arrayItemFieldPath`). The concrete path of a
|
|
6926
|
+
* leaf names its element: `headers[X-Api].value`.
|
|
6927
|
+
*
|
|
6928
|
+
* Pure and browser-safe. Nothing here mutates: every transform returns a new value.
|
|
6929
|
+
*/
|
|
6930
|
+
/** The array prefixes (declared form, e.g. `headers` or `a.headers`) of a path. */
|
|
6931
|
+
function parseSecretPath(path) {
|
|
6932
|
+
if (path.length === 0) throw new InvalidRecordError("an empty secret path");
|
|
6933
|
+
return path.split(".").map((raw) => {
|
|
6934
|
+
const each = raw.endsWith("[]");
|
|
6935
|
+
const map = raw.endsWith("{}");
|
|
6936
|
+
const key = each || map ? raw.slice(0, -2) : raw;
|
|
6937
|
+
if (key.length === 0) throw new InvalidRecordError(`secret path "${path}" has an empty segment`);
|
|
6938
|
+
return {
|
|
6939
|
+
key,
|
|
6940
|
+
each,
|
|
6941
|
+
map
|
|
6942
|
+
};
|
|
6943
|
+
});
|
|
6944
|
+
}
|
|
6945
|
+
/** The declared array prefixes of `path` that need an id key (`headers`, `a.rows`). */
|
|
6946
|
+
function secretArrayPrefixes(path) {
|
|
6947
|
+
const segments = parseSecretPath(path);
|
|
6948
|
+
const prefixes = [];
|
|
6949
|
+
const walked = [];
|
|
6950
|
+
for (const segment of segments) {
|
|
6951
|
+
walked.push(segment.key);
|
|
6952
|
+
if (segment.each) prefixes.push(walked.join("."));
|
|
6953
|
+
}
|
|
6954
|
+
return prefixes;
|
|
6955
|
+
}
|
|
6956
|
+
function isRecord$6(value) {
|
|
6957
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6958
|
+
}
|
|
6959
|
+
function elementId(element, idKey, declared, prefix) {
|
|
6960
|
+
const id = isRecord$6(element) ? element[idKey] : void 0;
|
|
6961
|
+
if (typeof id !== "string" || id.length === 0) throw new InvalidRecordError(`"${declared}": every element of "${prefix}" needs a non-empty string "${idKey}" to carry a secret`);
|
|
6962
|
+
return id;
|
|
6963
|
+
}
|
|
6964
|
+
/**
|
|
6965
|
+
* Visit every secret leaf PRESENT in `data` (an absent branch has nothing to
|
|
6966
|
+
* visit). `replace` returns the new leaf value, or {@link REMOVE_LEAF}; the
|
|
6967
|
+
* result is a new body, `data` is untouched.
|
|
6968
|
+
*/
|
|
6969
|
+
var REMOVE_LEAF = Symbol("remove-leaf");
|
|
6970
|
+
function mapAt(node, segments, index, walkedKeys, concretePrefix, declared, arrayKeys, visit) {
|
|
6971
|
+
if (!isRecord$6(node)) return node;
|
|
6972
|
+
const segment = segments[index];
|
|
6973
|
+
if (segment === void 0) return node;
|
|
6974
|
+
if (!Object.prototype.hasOwnProperty.call(node, segment.key)) return node;
|
|
6975
|
+
const child = node[segment.key];
|
|
6976
|
+
const keys = [...walkedKeys, segment.key];
|
|
6977
|
+
const last = index === segments.length - 1;
|
|
6978
|
+
if (segment.each) {
|
|
6979
|
+
if (!Array.isArray(child)) return node;
|
|
6980
|
+
const prefix = keys.join(".");
|
|
6981
|
+
const idKey = arrayKeys[prefix];
|
|
6982
|
+
if (idKey === void 0) throw new InvalidRecordError(`"${declared}": no id key declared for the array "${prefix}"`);
|
|
6983
|
+
const mapped = child.map((element) => {
|
|
6984
|
+
const id = elementId(element, idKey, declared, prefix);
|
|
6985
|
+
const concrete = `${concretePrefix}${concretePrefix.length > 0 ? "." : ""}${segment.key}[${encodeURIComponent(id)}]`;
|
|
6986
|
+
return last ? element : mapAt(element, segments, index + 1, keys, concrete, declared, arrayKeys, visit);
|
|
6987
|
+
});
|
|
6988
|
+
return {
|
|
6989
|
+
...node,
|
|
6990
|
+
[segment.key]: mapped
|
|
6991
|
+
};
|
|
6992
|
+
}
|
|
6993
|
+
if (segment.map) {
|
|
6994
|
+
if (!isRecord$6(child)) return node;
|
|
6995
|
+
const kept = Object.entries(child).map(([mapKey, value]) => {
|
|
6996
|
+
const concrete = `${concretePrefix}${concretePrefix.length > 0 ? "." : ""}${segment.key}{${encodeURIComponent(mapKey)}}`;
|
|
6997
|
+
if (!last) return [mapKey, mapAt(value, segments, index + 1, keys, concrete, declared, arrayKeys, visit)];
|
|
6998
|
+
return [mapKey, visit({
|
|
6999
|
+
declared,
|
|
7000
|
+
concrete,
|
|
7001
|
+
value
|
|
7002
|
+
})];
|
|
7003
|
+
}).filter(([, value]) => value !== REMOVE_LEAF);
|
|
7004
|
+
return {
|
|
7005
|
+
...node,
|
|
7006
|
+
[segment.key]: Object.fromEntries(kept)
|
|
7007
|
+
};
|
|
7008
|
+
}
|
|
7009
|
+
const concrete = `${concretePrefix}${concretePrefix.length > 0 ? "." : ""}${segment.key}`;
|
|
7010
|
+
if (last) {
|
|
7011
|
+
const replacement = visit({
|
|
7012
|
+
declared,
|
|
7013
|
+
concrete,
|
|
7014
|
+
value: child
|
|
7015
|
+
});
|
|
7016
|
+
if (replacement === REMOVE_LEAF) return Object.fromEntries(Object.entries(node).filter(([key]) => key !== segment.key));
|
|
7017
|
+
return {
|
|
7018
|
+
...node,
|
|
7019
|
+
[segment.key]: replacement
|
|
7020
|
+
};
|
|
7021
|
+
}
|
|
7022
|
+
return {
|
|
7023
|
+
...node,
|
|
7024
|
+
[segment.key]: mapAt(child, segments, index + 1, keys, concrete, declared, arrayKeys, visit)
|
|
7025
|
+
};
|
|
7026
|
+
}
|
|
7027
|
+
/** Replace/remove every present secret leaf; returns a NEW body. */
|
|
7028
|
+
function mapSecretLeaves(data, paths, arrayKeys, visit) {
|
|
7029
|
+
let current = data;
|
|
7030
|
+
for (const declared of paths) current = mapAt(current, parseSecretPath(declared), 0, [], "", declared, arrayKeys, visit);
|
|
7031
|
+
return current;
|
|
7032
|
+
}
|
|
7033
|
+
/**
|
|
7034
|
+
* The keychain collection name a kind's secrets live under. Prefixed so a
|
|
7035
|
+
* record's refs never collide with the refs a legacy collection of the same name
|
|
7036
|
+
* already holds during an adoption.
|
|
7037
|
+
*/
|
|
7038
|
+
function recordSecretCollection(kind) {
|
|
7039
|
+
return `${RECORD_SECRET_COLLECTION_PREFIX}${kind}`;
|
|
7040
|
+
}
|
|
7041
|
+
/** The ONE ref a row's secret field may carry: the engine and the facade both build it here. */
|
|
7042
|
+
function recordSecretRef(owner, kind, rowId, concretePath) {
|
|
7043
|
+
return buildSecretRef({
|
|
7044
|
+
owner,
|
|
7045
|
+
scope: {
|
|
7046
|
+
kind: "row",
|
|
7047
|
+
collection: recordSecretCollection(kind),
|
|
7048
|
+
rowId
|
|
7049
|
+
},
|
|
7050
|
+
fieldPath: concretePath
|
|
7051
|
+
});
|
|
7052
|
+
}
|
|
7053
|
+
/**
|
|
7054
|
+
* A stored secret, as an admin read shows it: a VIEW naming the row's own
|
|
7055
|
+
* keychain ref (`set: true`), never the value and no longer the bare redaction
|
|
7056
|
+
* token. The form hands it to the secret field, which reveals the value by ref
|
|
7057
|
+
* through the audited `keychain-admin.reveal`; sent back untouched it keeps the
|
|
7058
|
+
* stored secret (the records door reads a view as KEEP).
|
|
7059
|
+
*
|
|
7060
|
+
* ONE implementation for the entries service and for every addon that serves
|
|
7061
|
+
* its own instances (`RecordIntegrationInstances`).
|
|
7062
|
+
*/
|
|
7063
|
+
function isRecord$5(value) {
|
|
7064
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
7065
|
+
}
|
|
7066
|
+
function secretViewsOf(owner, kind, id, decl, data) {
|
|
7067
|
+
if (decl.secretPaths.length === 0) return data;
|
|
7068
|
+
const shown = mapSecretLeaves(data, decl.secretPaths, decl.secretArrayKeys, (leaf) => {
|
|
7069
|
+
if (leaf.value !== "__camstack_redacted__") return leaf.value;
|
|
7070
|
+
return {
|
|
7071
|
+
$secret: recordSecretRef(owner, kind, id, leaf.concrete),
|
|
7072
|
+
v: 1,
|
|
7073
|
+
set: true
|
|
7074
|
+
};
|
|
7075
|
+
});
|
|
7076
|
+
return isRecord$5(shown) ? shown : data;
|
|
7077
|
+
}
|
|
7078
|
+
/** The most instances one addon lists (an integrations page, not a table). */
|
|
7079
|
+
var INSTANCES_LIST_MAX = 1e3;
|
|
7080
|
+
/**
|
|
7081
|
+
* The ONE reader of an instance's switch (D996): an absent field means on, so a row written
|
|
7082
|
+
* before the field existed needs no migration. Every consumer of an instance body asks this.
|
|
7083
|
+
*/
|
|
7084
|
+
function isInstanceEnabled(body) {
|
|
7085
|
+
return body.enabled !== false;
|
|
7086
|
+
}
|
|
7087
|
+
/** The body key of the switch; only {@link RecordIntegrationInstances.setInstanceEnabled} writes it. */
|
|
7088
|
+
var SWITCH_KEY = "enabled";
|
|
7089
|
+
/** The keys of the kind's secret fields that sit at the top level of the body. */
|
|
7090
|
+
function topLevelSecretKeys(paths) {
|
|
7091
|
+
return new Set(paths.filter((p) => !p.includes(".") && !p.includes("[") && !p.includes("{")));
|
|
7092
|
+
}
|
|
7093
|
+
/** The keys of the kind's top-level MAPS whose values are secrets (`applianceSecrets{}`). */
|
|
7094
|
+
function secretMapKeys(paths) {
|
|
7095
|
+
return new Set(paths.filter((p) => p.endsWith("{}") && !p.slice(0, -2).match(/[.[{]/)).map((p) => p.slice(0, -2)));
|
|
7096
|
+
}
|
|
7097
|
+
/**
|
|
7098
|
+
* A patch value for a map of secrets: an entry that is omitted, `''`, the redaction token or the
|
|
7099
|
+
* view the form was given KEEPS its stored secret (it is left out of the merge); `{ $secretClear }`
|
|
7100
|
+
* or `null` removes the entry; any other string replaces it. Null when nothing is left to merge.
|
|
7101
|
+
*/
|
|
7102
|
+
function secretMapPatch(value) {
|
|
7103
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) return null;
|
|
7104
|
+
const out = {};
|
|
7105
|
+
for (const [key, entry] of Object.entries(value)) if (entry === null || isSecretClear(entry)) out[key] = null;
|
|
7106
|
+
else if (typeof entry === "string" && entry !== "" && entry !== "__camstack_redacted__" && !isSecretFieldView(entry)) out[key] = entry;
|
|
7107
|
+
return Object.keys(out).length > 0 ? out : null;
|
|
7108
|
+
}
|
|
7109
|
+
var RecordIntegrationInstances = class {
|
|
7110
|
+
records;
|
|
7111
|
+
kind;
|
|
7112
|
+
hooks;
|
|
7113
|
+
handle;
|
|
7114
|
+
secretKeys;
|
|
7115
|
+
secretMaps;
|
|
7116
|
+
nameField;
|
|
7117
|
+
switchListeners = /* @__PURE__ */ new Set();
|
|
7118
|
+
constructor(records, kind, hooks) {
|
|
7119
|
+
this.records = records;
|
|
7120
|
+
this.kind = kind;
|
|
7121
|
+
this.hooks = hooks;
|
|
7122
|
+
this.handle = records.kind(kind);
|
|
7123
|
+
this.secretKeys = topLevelSecretKeys(kind.declaration.secretPaths);
|
|
7124
|
+
this.secretMaps = secretMapKeys(kind.declaration.secretPaths);
|
|
7125
|
+
this.nameField = kind.declaration.entry?.nameField ?? "name";
|
|
7126
|
+
}
|
|
7127
|
+
/**
|
|
7128
|
+
* One instance read for the addon's own runtime; null when absent. When the keychain is
|
|
7129
|
+
* locked the row is served WITHOUT its secrets and says so (`secrets: 'unavailable'`), so the
|
|
7130
|
+
* caller can keep what it had instead of reconfiguring with an empty secret (D49).
|
|
7131
|
+
*/
|
|
7132
|
+
async readResolved(id) {
|
|
7133
|
+
try {
|
|
7134
|
+
const record = await this.handle.getResolved(id);
|
|
7135
|
+
return record === null ? null : {
|
|
7136
|
+
id,
|
|
7137
|
+
body: record.data,
|
|
7138
|
+
enabled: isInstanceEnabled(record.data),
|
|
7139
|
+
secrets: "resolved"
|
|
7140
|
+
};
|
|
7141
|
+
} catch (err) {
|
|
7142
|
+
if (!(err instanceof RecordSecretUnavailableError)) throw err;
|
|
7143
|
+
const stored = await this.handle.get(id);
|
|
7144
|
+
if (stored === null) return null;
|
|
7145
|
+
return {
|
|
7146
|
+
id,
|
|
7147
|
+
body: Object.fromEntries(Object.entries(stored.data).filter(([key]) => !this.secretKeys.has(key))),
|
|
7148
|
+
enabled: isInstanceEnabled(stored.data),
|
|
7149
|
+
secrets: "unavailable"
|
|
7150
|
+
};
|
|
7151
|
+
}
|
|
7152
|
+
}
|
|
7153
|
+
/** The body of {@link readResolved} alone; a locked keychain yields the row without secrets. */
|
|
7154
|
+
async getResolved(id) {
|
|
7155
|
+
return (await this.readResolved(id))?.body ?? null;
|
|
7156
|
+
}
|
|
7157
|
+
/** Every instance, secrets resolved where the keychain allows; an absent one is skipped. */
|
|
7158
|
+
async listResolved() {
|
|
7159
|
+
const page = await this.handle.query({ limit: INSTANCES_LIST_MAX });
|
|
7160
|
+
const out = [];
|
|
7161
|
+
for (const record of page.records) {
|
|
7162
|
+
const read = await this.readResolved(record.id);
|
|
7163
|
+
if (read !== null) out.push(read);
|
|
7164
|
+
}
|
|
7165
|
+
return out;
|
|
7166
|
+
}
|
|
7167
|
+
viewOf(record) {
|
|
7168
|
+
const shown = secretViewsOf(this.records.owner, this.kind.name, record.id, this.kind.declaration, record.data);
|
|
7169
|
+
const rawName = record.data[this.nameField];
|
|
7170
|
+
const kind = this.hooks.kindOf?.(record.data);
|
|
7171
|
+
const health = this.hooks.health?.(record.data, record.id);
|
|
7172
|
+
return {
|
|
7173
|
+
id: record.id,
|
|
7174
|
+
name: typeof rawName === "string" ? rawName : record.id,
|
|
7175
|
+
configured: this.hooks.configured(record.data),
|
|
7176
|
+
enabled: isInstanceEnabled(record.data),
|
|
7177
|
+
formValues: shown,
|
|
7178
|
+
...kind !== void 0 ? { kind } : {},
|
|
7179
|
+
...health?.status !== void 0 ? { status: health.status } : {},
|
|
7180
|
+
...health?.lastCheckedAt !== void 0 ? { lastCheckedAt: health.lastCheckedAt } : {}
|
|
7181
|
+
};
|
|
7182
|
+
}
|
|
7183
|
+
describe = async () => {
|
|
7184
|
+
const declared = linksOfKind(this.kind);
|
|
7185
|
+
const links = this.hooks.description.links !== void 0 || declared.length === 0 ? {} : { links: declared.map((link) => ({
|
|
7186
|
+
kind: this.kind.name,
|
|
7187
|
+
field: link.field,
|
|
7188
|
+
to: link.to
|
|
7189
|
+
})) };
|
|
7190
|
+
return {
|
|
7191
|
+
...this.hooks.description,
|
|
7192
|
+
...links,
|
|
7193
|
+
...this.hooks.mintId === void 0 ? {} : { mintsId: true }
|
|
7194
|
+
};
|
|
7195
|
+
};
|
|
7196
|
+
instanceFormSchema = async ({ id }) => this.hooks.formSchema(id);
|
|
7197
|
+
listInstances = async () => {
|
|
7198
|
+
return (await this.handle.query({ limit: INSTANCES_LIST_MAX })).records.map((record) => this.viewOf(record));
|
|
7199
|
+
};
|
|
7200
|
+
getInstance = async ({ id }) => {
|
|
7201
|
+
const record = await this.handle.get(id);
|
|
7202
|
+
return record === null ? null : this.viewOf(record);
|
|
7203
|
+
};
|
|
7204
|
+
/** Insert ONE row (`ifRev: 0`: an existing id is refused, never overwritten). */
|
|
7205
|
+
createInstance = async ({ id, name, kind, values }) => {
|
|
7206
|
+
const minted = id ?? this.hooks.mintId?.({
|
|
7207
|
+
name,
|
|
7208
|
+
...kind !== void 0 ? { kind } : {}
|
|
7209
|
+
});
|
|
7210
|
+
if (minted === void 0) throw new Error("createInstance needs an id: this provider does not mint one");
|
|
7211
|
+
await this.handle.put({
|
|
7212
|
+
id: minted,
|
|
7213
|
+
data: this.hooks.initialBody(name, kind)
|
|
7214
|
+
}, { ifRev: 0 });
|
|
7215
|
+
const patch = this.patchOf(values ?? {});
|
|
7216
|
+
if (Object.keys(patch).length > 0) await this.handle.patch(minted, patch);
|
|
7217
|
+
await this.hooks.onChanged?.(minted, "created");
|
|
7218
|
+
return { id: minted };
|
|
7219
|
+
};
|
|
7220
|
+
updateInstance = async ({ id, name, values }) => {
|
|
7221
|
+
const patch = this.patchOf(values);
|
|
7222
|
+
if (name !== void 0) patch[this.nameField] = name;
|
|
7223
|
+
await this.handle.patch(id, patch);
|
|
7224
|
+
await this.hooks.onChanged?.(id, "updated");
|
|
7225
|
+
return { ok: true };
|
|
7226
|
+
};
|
|
7227
|
+
/** The record patch a form `values` object means: secrets kept, cleared or replaced. */
|
|
7228
|
+
patchOf(values) {
|
|
7229
|
+
const patch = {};
|
|
7230
|
+
for (const [key, value] of Object.entries(values)) {
|
|
7231
|
+
if (value === void 0) continue;
|
|
7232
|
+
if (key === "enabled") continue;
|
|
7233
|
+
if (this.secretMaps.has(key)) {
|
|
7234
|
+
const entries = secretMapPatch(value);
|
|
7235
|
+
if (entries !== null) patch[key] = entries;
|
|
7236
|
+
} else if (!this.secretKeys.has(key)) patch[key] = value;
|
|
7237
|
+
else if (isSecretClear(value)) patch[key] = null;
|
|
7238
|
+
else if (typeof value === "string" && value !== "" && value !== "__camstack_redacted__" && !isSecretFieldView(value)) patch[key] = value;
|
|
7239
|
+
}
|
|
7240
|
+
return patch;
|
|
7241
|
+
}
|
|
7242
|
+
/**
|
|
7243
|
+
* Listen to the switch of ANY instance of this helper (in the process that serves it). The
|
|
7244
|
+
* durable replacement of the `integration.enabled` / `integration.disabled` events (D8): the
|
|
7245
|
+
* addon reconciles from the record, whichever way it flipped.
|
|
7246
|
+
*/
|
|
7247
|
+
onSwitched(listener) {
|
|
7248
|
+
this.switchListeners.add(listener);
|
|
7249
|
+
}
|
|
7250
|
+
/**
|
|
7251
|
+
* The ONE writer of the switch (D996, D1014): the record body's `enabled`, for every role. A
|
|
7252
|
+
* configured thing is an instance, so an id with no record yet (a default integration that was
|
|
7253
|
+
* never configured) gets its record from `initialBody` before the switch is written.
|
|
7254
|
+
*/
|
|
7255
|
+
setInstanceEnabled = async ({ id, enabled }) => {
|
|
7256
|
+
if (await this.handle.get(id) === null) await this.handle.put({
|
|
7257
|
+
id,
|
|
7258
|
+
data: this.hooks.initialBody(id)
|
|
7259
|
+
}, { ifRev: 0 });
|
|
7260
|
+
await this.handle.patch(id, { [SWITCH_KEY]: enabled });
|
|
7261
|
+
await this.hooks.onChanged?.(id, "enabled");
|
|
7262
|
+
for (const listener of this.switchListeners) await listener(id, enabled);
|
|
7263
|
+
return { ok: true };
|
|
7264
|
+
};
|
|
7265
|
+
/** The row and its keychain refs go together (the records door). */
|
|
7266
|
+
deleteInstance = async ({ id }) => {
|
|
7267
|
+
await this.handle.delete(id);
|
|
7268
|
+
await this.hooks.onChanged?.(id, "deleted");
|
|
7269
|
+
return { ok: true };
|
|
7270
|
+
};
|
|
7271
|
+
testInstance = async (input) => {
|
|
7272
|
+
if (this.hooks.test === void 0) return {
|
|
7273
|
+
success: false,
|
|
7274
|
+
status: "unsupported",
|
|
7275
|
+
error: "This integration declares no connection test"
|
|
7276
|
+
};
|
|
7277
|
+
return this.hooks.test(input);
|
|
7278
|
+
};
|
|
7279
|
+
/** The flat provider object to hand to `registerProvider`. */
|
|
7280
|
+
toProvider() {
|
|
7281
|
+
return {
|
|
7282
|
+
describe: this.describe,
|
|
7283
|
+
instanceFormSchema: this.instanceFormSchema,
|
|
7284
|
+
listInstances: this.listInstances,
|
|
7285
|
+
getInstance: this.getInstance,
|
|
7286
|
+
createInstance: this.createInstance,
|
|
7287
|
+
updateInstance: this.updateInstance,
|
|
7288
|
+
setInstanceEnabled: this.setInstanceEnabled,
|
|
7289
|
+
deleteInstance: this.deleteInstance,
|
|
7290
|
+
testInstance: this.testInstance
|
|
7291
|
+
};
|
|
7292
|
+
}
|
|
7293
|
+
};
|
|
7294
|
+
/**
|
|
7295
|
+
* The one-switch migration (epic #440, step 3). An integration's on/off state used to live in the
|
|
7296
|
+
* registry's `enabled` column for a device addon; it now lives only in the instance record's
|
|
7297
|
+
* body (`enabled`, D1007 superseded). This moves a registry `enabled = false` into the body, once.
|
|
7298
|
+
*
|
|
7299
|
+
* For every registry row of the addon that is OFF:
|
|
7300
|
+
* - no record under its id: the record is created from `initialBody(name)` with `enabled: false`
|
|
7301
|
+
* (a default integration that never had settings, Reolink's among them);
|
|
7302
|
+
* - a record whose body states no `enabled`: `enabled: false` is written into it;
|
|
7303
|
+
* - a record that already states `enabled` (either way) is the newer truth and is left alone.
|
|
7304
|
+
* A row that is ON writes nothing: an absent field reads as on. A rerun finds every off row with
|
|
7305
|
+
* a stated switch and does nothing, so nothing switched off comes back on and nothing switched on
|
|
7306
|
+
* goes off. The registry column itself is neither read afterwards nor written; its drop is step 5.
|
|
7307
|
+
*
|
|
7308
|
+
* It runs in the addon process, BEFORE the addon registers its `integration-instances` provider,
|
|
7309
|
+
* which is also why `integrations.list` still answers the stored column at that point.
|
|
7310
|
+
*/
|
|
7311
|
+
function registrySwitchToBodyId(addonId, date) {
|
|
7312
|
+
return `${addonId}/${date}-registry-switch-to-body`;
|
|
7313
|
+
}
|
|
7314
|
+
async function moveRegistrySwitchToBody(ports, spec) {
|
|
7315
|
+
const rows = await ports.listIntegrations(spec.addonId);
|
|
7316
|
+
let created = 0;
|
|
7317
|
+
let switched = 0;
|
|
7318
|
+
let kept = 0;
|
|
7319
|
+
for (const row of rows) {
|
|
7320
|
+
if (row.enabled) continue;
|
|
7321
|
+
const body = await ports.readBody(row.id);
|
|
7322
|
+
if (body === null) {
|
|
7323
|
+
if (await ports.createRecord(row.id, {
|
|
7324
|
+
...spec.initialBody(row.name),
|
|
7325
|
+
["enabled"]: false
|
|
7326
|
+
}) === "created") created += 1;
|
|
7327
|
+
else kept += 1;
|
|
7328
|
+
continue;
|
|
7329
|
+
}
|
|
7330
|
+
if ("enabled" in body) {
|
|
7331
|
+
kept += 1;
|
|
7332
|
+
continue;
|
|
7333
|
+
}
|
|
7334
|
+
await ports.switchOff(row.id);
|
|
7335
|
+
switched += 1;
|
|
7336
|
+
}
|
|
7337
|
+
const summary = {
|
|
7338
|
+
integrations: rows.length,
|
|
7339
|
+
off: rows.filter((r) => !r.enabled).length,
|
|
7340
|
+
created,
|
|
7341
|
+
switched,
|
|
7342
|
+
kept
|
|
7343
|
+
};
|
|
7344
|
+
return created === 0 && switched === 0 ? {
|
|
7345
|
+
outcome: "already-done",
|
|
7346
|
+
summary
|
|
7347
|
+
} : {
|
|
7348
|
+
outcome: "done",
|
|
7349
|
+
summary
|
|
7350
|
+
};
|
|
7351
|
+
}
|
|
7352
|
+
/** A migration entry: an addon states its kind and how a new body starts, nothing else. */
|
|
7353
|
+
function registrySwitchToBodyMigration(spec) {
|
|
7354
|
+
return {
|
|
7355
|
+
meta: {
|
|
7356
|
+
id: registrySwitchToBodyId(spec.addonId, spec.date),
|
|
7357
|
+
owner: spec.addonId,
|
|
7358
|
+
level: "addon-state",
|
|
7359
|
+
seq: spec.seq,
|
|
7360
|
+
dependsOn: [],
|
|
7361
|
+
store: "settings",
|
|
7362
|
+
scope: "cluster",
|
|
7363
|
+
onFailure: "block-owner",
|
|
7364
|
+
bodyKind: "procedure",
|
|
7365
|
+
description: "Move the registry enabled flag of every switched-off integration into its instance record body, creating the record when there is none",
|
|
7366
|
+
fixtureMark: "enabled"
|
|
7367
|
+
},
|
|
7368
|
+
procedure: (ports) => moveRegistrySwitchToBody(ports, {
|
|
7369
|
+
addonId: spec.addonId,
|
|
7370
|
+
initialBody: spec.initialBody
|
|
7371
|
+
})
|
|
7372
|
+
};
|
|
7373
|
+
}
|
|
7374
|
+
/** The hub and records sides of {@link registrySwitchToBodyMigration}. */
|
|
7375
|
+
function registrySwitchPortsOver(deps) {
|
|
7376
|
+
const handle = deps.records.kind({
|
|
7377
|
+
name: deps.kind.name,
|
|
7378
|
+
declaration: deps.kind.declaration,
|
|
7379
|
+
schema: record(string(), unknown())
|
|
7380
|
+
});
|
|
7381
|
+
return {
|
|
7382
|
+
listIntegrations: async (addonId) => (await deps.api.list()).filter((i) => i.addonId === addonId).map((i) => ({
|
|
7383
|
+
id: i.id,
|
|
7384
|
+
name: i.name,
|
|
7385
|
+
enabled: i.enabled !== false
|
|
7386
|
+
})),
|
|
7387
|
+
readBody: async (id) => (await handle.get(id))?.data ?? null,
|
|
7388
|
+
createRecord: async (id, body) => {
|
|
7389
|
+
if (await handle.get(id) !== null) return "exists";
|
|
7390
|
+
await handle.put({
|
|
7391
|
+
id,
|
|
7392
|
+
data: body
|
|
7393
|
+
}, { ifRev: 0 });
|
|
7394
|
+
return "created";
|
|
7395
|
+
},
|
|
7396
|
+
switchOff: async (id) => {
|
|
7397
|
+
await handle.patch(id, { [SWITCH_KEY]: false });
|
|
7398
|
+
}
|
|
7399
|
+
};
|
|
7400
|
+
}
|
|
7401
|
+
/**
|
|
7402
|
+
* Build a {@link DurableState} over a single store key. Transport-agnostic:
|
|
7403
|
+
* `read`/`write` are the addon-store or device-store accessors. The whole
|
|
7404
|
+
* validated value round-trips on every read/write — the schema is the
|
|
7405
|
+
* single source of truth for what is persisted, so no hand-listed field
|
|
7406
|
+
* set can drop a key on save.
|
|
7407
|
+
*/
|
|
7408
|
+
function createDurableState(deps) {
|
|
7409
|
+
const get = async () => {
|
|
7410
|
+
const raw = (await deps.read())[deps.key];
|
|
7411
|
+
if (raw === void 0) return deps.fallback;
|
|
7412
|
+
const parsed = deps.schema.safeParse(raw);
|
|
7413
|
+
if (!parsed.success) {
|
|
7414
|
+
deps.onParseError?.(deps.key, parsed.error);
|
|
7415
|
+
return deps.fallback;
|
|
7416
|
+
}
|
|
7417
|
+
return parsed.data;
|
|
7418
|
+
};
|
|
7419
|
+
const set = async (next) => {
|
|
7420
|
+
const validated = deps.schema.parse(next);
|
|
7421
|
+
await deps.write({ [deps.key]: validated });
|
|
7422
|
+
};
|
|
7423
|
+
const update = async (fn) => {
|
|
7424
|
+
await set(fn(await get()));
|
|
7425
|
+
};
|
|
7426
|
+
return {
|
|
7427
|
+
get,
|
|
7428
|
+
set,
|
|
7429
|
+
update
|
|
7430
|
+
};
|
|
7431
|
+
}
|
|
7432
|
+
/**
|
|
7433
|
+
* Per-node scoping for the shared addon-settings blob.
|
|
7434
|
+
*
|
|
7435
|
+
* An addon's settings store is hub-central (the `addon-settings` cap is
|
|
7436
|
+
* hub-routed — the hub instance answers for every node), so fields whose
|
|
7437
|
+
* value is a NODE fact (decoder backend, engine pick, probed hardware
|
|
7438
|
+
* capabilities) persist under the node-scoped key `<key>@<nodeId>` inside
|
|
7439
|
+
* the single shared blob. The SCHEMA field key stays bare: the write path
|
|
7440
|
+
* ({@link scopePatch}) maps the bare field onto the target node's scoped
|
|
7441
|
+
* key; the read/hydrate path ({@link projectStore}) maps THIS node's value
|
|
7442
|
+
* back, so UI forms and `resolveConfig` only ever see the bare key.
|
|
7443
|
+
*
|
|
7444
|
+
* Fields opt in via the `perNode: true` schema marker on `ConfigFieldBase`
|
|
7445
|
+
* (`interfaces/config-ui.ts`); `BaseAddon` derives the key set from the
|
|
7446
|
+
* schema and routes reads/writes through these helpers.
|
|
7447
|
+
*
|
|
7448
|
+
* ## No bare-key fallback — deliberate
|
|
7449
|
+
*
|
|
7450
|
+
* {@link readNodeValue} reads the node-scoped key ONLY. A node with no
|
|
7451
|
+
* scoped key resolves to `undefined` so the field's schema `default` wins —
|
|
7452
|
+
* NEVER `store[base]` and never another node's value. A bare legacy key in
|
|
7453
|
+
* the store is invisible to every node, hub included, so one node's
|
|
7454
|
+
* selection can never leak onto another. (This generalizes the
|
|
7455
|
+
* `decoder-backend-keys.ts` semantics — the no-fallback variant — over an
|
|
7456
|
+
* arbitrary set of per-node field keys.)
|
|
7457
|
+
*
|
|
7458
|
+
* Pure functions only — no I/O, no imports beyond the language. This is a
|
|
7459
|
+
* LEAF module: import it via its deep path, never from the root barrel.
|
|
7460
|
+
*/
|
|
7461
|
+
/**
|
|
7462
|
+
* Normalize a raw kernel node id to the bare node id used for scoping.
|
|
7463
|
+
* `localNodeId` can carry a `<node>/<addon>` suffix on forked child
|
|
7464
|
+
* processes; per-node settings are per-NODE, so strip the addon segment.
|
|
7465
|
+
* `undefined` / `null` / empty falls back to `'hub'`.
|
|
7466
|
+
*/
|
|
7467
|
+
function normalizeNodeId(raw) {
|
|
7468
|
+
if (raw === void 0 || raw === null || raw === "") return "hub";
|
|
7469
|
+
const slashIdx = raw.indexOf("/");
|
|
7470
|
+
if (slashIdx < 0) return raw;
|
|
7471
|
+
const bare = raw.slice(0, slashIdx);
|
|
7472
|
+
return bare === "" ? "hub" : bare;
|
|
7473
|
+
}
|
|
7474
|
+
/** The node-scoped store key for a per-node field: `<base>@<nodeId>`. */
|
|
7475
|
+
function nodeScopedKey(base, nodeId) {
|
|
7476
|
+
return `${base}@${normalizeNodeId(nodeId)}`;
|
|
7477
|
+
}
|
|
7478
|
+
/**
|
|
7479
|
+
* Read a node's value for a per-node field from the raw shared store:
|
|
7480
|
+
* the node-scoped key when present, otherwise `undefined`.
|
|
7481
|
+
* Deliberately NO bare-key fallback (see module doc) — the caller lets the
|
|
7482
|
+
* schema `default` win on `undefined`.
|
|
7483
|
+
*/
|
|
7484
|
+
function readNodeValue(store, base, nodeId) {
|
|
7485
|
+
return store[nodeScopedKey(base, nodeId)];
|
|
7486
|
+
}
|
|
7487
|
+
/**
|
|
7488
|
+
* Re-map a UI/settings patch so every bare perNode field persists under the
|
|
7489
|
+
* TARGET node's scoped key; all other keys pass through unchanged. Used on
|
|
7490
|
+
* the write path so a save for one node never clobbers another node's value
|
|
7491
|
+
* (and the bare key is never written). Returns a new object — the input
|
|
7492
|
+
* patch is not mutated.
|
|
7493
|
+
*/
|
|
7494
|
+
function scopePatch(patch, perNodeKeys, nodeId) {
|
|
7495
|
+
const out = {};
|
|
7496
|
+
for (const [key, value] of Object.entries(patch)) out[perNodeKeys.has(key) ? nodeScopedKey(key, nodeId) : key] = value;
|
|
7497
|
+
return out;
|
|
7498
|
+
}
|
|
7499
|
+
/**
|
|
7500
|
+
* Project the raw shared store onto the bare schema keys for ONE node so a
|
|
7501
|
+
* UI schema (whose field keys are bare) hydrates from that node's own
|
|
7502
|
+
* values:
|
|
7503
|
+
*
|
|
7504
|
+
* - EVERY `@`-scoped key (any node's) is dropped from the pass-through.
|
|
7505
|
+
* - Every bare perNode key is dropped from the pass-through (a stray bare
|
|
7506
|
+
* legacy key must never hydrate any node — no bare fallback).
|
|
7507
|
+
* - THIS node's effective value ({@link readNodeValue}) is then laid onto
|
|
7508
|
+
* each bare perNode key; when the node has no scoped key the bare key is
|
|
7509
|
+
* left ABSENT so the field's schema `default` wins.
|
|
7510
|
+
*
|
|
7511
|
+
* Returns a new object — the input store is not mutated.
|
|
7512
|
+
*/
|
|
7513
|
+
function projectStore(store, perNodeKeys, nodeId) {
|
|
7514
|
+
const out = {};
|
|
7515
|
+
for (const [key, value] of Object.entries(store)) {
|
|
7516
|
+
if (key.includes("@")) continue;
|
|
7517
|
+
if (perNodeKeys.has(key)) continue;
|
|
7518
|
+
out[key] = value;
|
|
7519
|
+
}
|
|
7520
|
+
for (const base of perNodeKeys) {
|
|
7521
|
+
const value = readNodeValue(store, base, nodeId);
|
|
7522
|
+
if (value !== void 0) out[base] = value;
|
|
7523
|
+
}
|
|
7524
|
+
return out;
|
|
7525
|
+
}
|
|
7526
|
+
/** Every scope, in the order the guard and the docs list them. */
|
|
7527
|
+
var SCOPED_SETTINGS_SCOPES = [
|
|
7528
|
+
"cluster",
|
|
7529
|
+
"device-defaults",
|
|
7530
|
+
"node"
|
|
7531
|
+
];
|
|
6933
7532
|
/** A write to a secret path could not be stored in the keychain, so it was refused. */
|
|
6934
7533
|
var KeychainWriteRefusedError = class extends Error {
|
|
6935
7534
|
fieldPath;
|
|
@@ -6940,7 +7539,7 @@ var KeychainWriteRefusedError = class extends Error {
|
|
|
6940
7539
|
}
|
|
6941
7540
|
};
|
|
6942
7541
|
var KEEP = { kind: "keep" };
|
|
6943
|
-
function isRecord$
|
|
7542
|
+
function isRecord$4(value) {
|
|
6944
7543
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6945
7544
|
}
|
|
6946
7545
|
function defaultMintId() {
|
|
@@ -6953,7 +7552,7 @@ function collectSecretMarkerRefs(value, out = []) {
|
|
|
6953
7552
|
return out;
|
|
6954
7553
|
}
|
|
6955
7554
|
if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
|
|
6956
|
-
else if (isRecord$
|
|
7555
|
+
else if (isRecord$4(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
|
|
6957
7556
|
return out;
|
|
6958
7557
|
}
|
|
6959
7558
|
async function storedValueEquals(secrets, marker, candidate) {
|
|
@@ -7008,7 +7607,7 @@ function rowId$3(row, idKey) {
|
|
|
7008
7607
|
return null;
|
|
7009
7608
|
}
|
|
7010
7609
|
async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
7011
|
-
const storedRows = Array.isArray(stored) ? stored.filter(isRecord$
|
|
7610
|
+
const storedRows = Array.isArray(stored) ? stored.filter(isRecord$4) : [];
|
|
7012
7611
|
if (!Array.isArray(incoming)) {
|
|
7013
7612
|
ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
|
|
7014
7613
|
return {
|
|
@@ -7024,7 +7623,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
|
7024
7623
|
const kept = /* @__PURE__ */ new Set();
|
|
7025
7624
|
const rows = [];
|
|
7026
7625
|
for (const row of incoming) {
|
|
7027
|
-
if (!isRecord$
|
|
7626
|
+
if (!isRecord$4(row)) {
|
|
7028
7627
|
rows.push(row);
|
|
7029
7628
|
continue;
|
|
7030
7629
|
}
|
|
@@ -7049,7 +7648,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
|
7049
7648
|
case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
|
|
7050
7649
|
case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
|
|
7051
7650
|
case "object": {
|
|
7052
|
-
if (!isRecord$
|
|
7651
|
+
if (!isRecord$4(incoming)) {
|
|
7053
7652
|
if (incoming === void 0) return KEEP;
|
|
7054
7653
|
ctx.deletes.push(...collectSecretMarkerRefs(stored));
|
|
7055
7654
|
return {
|
|
@@ -7057,7 +7656,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
|
7057
7656
|
value: incoming
|
|
7058
7657
|
};
|
|
7059
7658
|
}
|
|
7060
|
-
const storedObj = isRecord$
|
|
7659
|
+
const storedObj = isRecord$4(stored) ? stored : {};
|
|
7061
7660
|
return {
|
|
7062
7661
|
kind: "value",
|
|
7063
7662
|
value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
|
|
@@ -7180,7 +7779,7 @@ async function resolveSecretMarkers(value, secrets, options = {}) {
|
|
|
7180
7779
|
value: items
|
|
7181
7780
|
};
|
|
7182
7781
|
}
|
|
7183
|
-
if (isRecord$
|
|
7782
|
+
if (isRecord$4(v)) {
|
|
7184
7783
|
const out = {};
|
|
7185
7784
|
for (const [k, child] of Object.entries(v)) {
|
|
7186
7785
|
const s = substitute(child);
|
|
@@ -7212,7 +7811,7 @@ var SecretOverwriteRefusedError = class extends Error {
|
|
|
7212
7811
|
this.name = "SecretOverwriteRefusedError";
|
|
7213
7812
|
}
|
|
7214
7813
|
};
|
|
7215
|
-
function isRecord$
|
|
7814
|
+
function isRecord$3(value) {
|
|
7216
7815
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
7217
7816
|
}
|
|
7218
7817
|
function resolvedValue(pass, marker) {
|
|
@@ -7241,7 +7840,7 @@ function inArray(pass, incoming, stored) {
|
|
|
7241
7840
|
return incoming.map((item, index) => {
|
|
7242
7841
|
const twin = stored[index];
|
|
7243
7842
|
if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
|
|
7244
|
-
if (isRecord$
|
|
7843
|
+
if (isRecord$3(item) && isRecord$3(twin)) return inArrayRow(pass, item, twin);
|
|
7245
7844
|
if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
|
|
7246
7845
|
return item;
|
|
7247
7846
|
});
|
|
@@ -7252,7 +7851,7 @@ function inArrayRow(pass, incoming, stored) {
|
|
|
7252
7851
|
const twin = stored[key];
|
|
7253
7852
|
if (isSecretMarker(twin)) {
|
|
7254
7853
|
if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
|
|
7255
|
-
} else if (isRecord$
|
|
7854
|
+
} else if (isRecord$3(value) && isRecord$3(twin)) out[key] = inArrayRow(pass, value, twin);
|
|
7256
7855
|
else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
|
|
7257
7856
|
}
|
|
7258
7857
|
return out;
|
|
@@ -7260,7 +7859,7 @@ function inArrayRow(pass, incoming, stored) {
|
|
|
7260
7859
|
async function walk(pass, incoming, stored) {
|
|
7261
7860
|
if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
|
|
7262
7861
|
if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
|
|
7263
|
-
if (!isRecord$
|
|
7862
|
+
if (!isRecord$3(incoming) || !isRecord$3(stored)) return incoming;
|
|
7264
7863
|
const out = { ...incoming };
|
|
7265
7864
|
for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
|
|
7266
7865
|
return out;
|
|
@@ -7291,7 +7890,7 @@ async function restoreUnchangedSecrets(input) {
|
|
|
7291
7890
|
function isJsonEqual(a, b) {
|
|
7292
7891
|
if (Object.is(a, b)) return true;
|
|
7293
7892
|
if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
|
|
7294
|
-
if (isRecord$
|
|
7893
|
+
if (isRecord$3(a) && isRecord$3(b)) {
|
|
7295
7894
|
const keys = Object.keys(a);
|
|
7296
7895
|
if (keys.length !== Object.keys(b).length) return false;
|
|
7297
7896
|
return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
|
|
@@ -7315,7 +7914,7 @@ function markerKeysOf(blob, owner) {
|
|
|
7315
7914
|
}
|
|
7316
7915
|
function nodeFromStored(value, owner) {
|
|
7317
7916
|
if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
|
|
7318
|
-
if (!isRecord$
|
|
7917
|
+
if (!isRecord$3(value)) return null;
|
|
7319
7918
|
const children = /* @__PURE__ */ new Map();
|
|
7320
7919
|
for (const [key, child] of Object.entries(value)) {
|
|
7321
7920
|
const node = nodeFromStored(child, owner);
|
|
@@ -7610,6 +8209,28 @@ var SECRET_RETRY_MAX_MS = 5 * 6e4;
|
|
|
7610
8209
|
/** Coalesces a burst of `keychain.changed` events into one re-resolve. */
|
|
7611
8210
|
var SECRET_CHANGE_DEBOUNCE_MS = 250;
|
|
7612
8211
|
/**
|
|
8212
|
+
* Pair a catalogue with the function that builds its ports FROM THE MIGRATION API. The one
|
|
8213
|
+
* place a catalogue is bound: a migration reaches nothing a ports binder cannot reach
|
|
8214
|
+
* through `api` (guard `check-migration-ports-surface`).
|
|
8215
|
+
*/
|
|
8216
|
+
function migrationSet(catalogue, bindPorts) {
|
|
8217
|
+
return { bind: (api) => defineAddonMigrations(catalogue, bindPorts(api)) };
|
|
8218
|
+
}
|
|
8219
|
+
/** A mixed array is a mistake: the other kind would be dropped without a word. */
|
|
8220
|
+
function refuseMixed(form, kept, dropped) {
|
|
8221
|
+
if (dropped > 0) throw new Error(`runMigrations(${form}): ${dropped} of ${kept + dropped} entries are of the other kind and would be dropped; pass one kind per call`);
|
|
8222
|
+
}
|
|
8223
|
+
function catalogueOf(list) {
|
|
8224
|
+
const kept = list.filter((entry) => !("execute" in entry));
|
|
8225
|
+
refuseMixed("catalogue, (api) => ports", kept.length, list.length - kept.length);
|
|
8226
|
+
return kept;
|
|
8227
|
+
}
|
|
8228
|
+
function boundOf(list) {
|
|
8229
|
+
const kept = list.filter((entry) => "execute" in entry);
|
|
8230
|
+
refuseMixed("bound migrations", kept.length, list.length - kept.length);
|
|
8231
|
+
return kept;
|
|
8232
|
+
}
|
|
8233
|
+
/**
|
|
7613
8234
|
* Base class for CamStack addons. Eliminates settings boilerplate:
|
|
7614
8235
|
*
|
|
7615
8236
|
* - Typed `config` property with automatic resolution from store + defaults
|
|
@@ -7687,6 +8308,13 @@ var BaseAddon = class {
|
|
|
7687
8308
|
*/
|
|
7688
8309
|
secretStatePaths = [];
|
|
7689
8310
|
_addonSecretTree = null;
|
|
8311
|
+
/**
|
|
8312
|
+
* D986 M4: the scoped schemas this addon declared, resolved once per capability
|
|
8313
|
+
* (`loadScopedSchemas`) so the sync readers (`perNodeKeys`, the secret tree, the restart check)
|
|
8314
|
+
* see them. Empty until loaded: the readers then fall back to {@link globalSettingsSchema}.
|
|
8315
|
+
*/
|
|
8316
|
+
_scopedByCap = /* @__PURE__ */ new Map();
|
|
8317
|
+
_nodeKeysByCap = /* @__PURE__ */ new Map();
|
|
7690
8318
|
_deviceSecretTree = null;
|
|
7691
8319
|
/** Refs the last resolved config pointed at — a change to one re-resolves. */
|
|
7692
8320
|
_configSecretRefs = /* @__PURE__ */ new Set();
|
|
@@ -7756,6 +8384,7 @@ var BaseAddon = class {
|
|
|
7756
8384
|
this._ctx = context;
|
|
7757
8385
|
this._secretSettings = null;
|
|
7758
8386
|
}
|
|
8387
|
+
await this.loadScopedSchemas();
|
|
7759
8388
|
await this.resolveConfig();
|
|
7760
8389
|
if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
|
|
7761
8390
|
if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
|
|
@@ -7765,31 +8394,65 @@ var BaseAddon = class {
|
|
|
7765
8394
|
const normalized = normalizeAddonInitResult(result);
|
|
7766
8395
|
const providers = normalized && "providers" in normalized && normalized.providers ? normalized.providers : [];
|
|
7767
8396
|
this._registeredCapNames = providers.map((p) => p.capability.name);
|
|
8397
|
+
await this.loadScopedSchemas();
|
|
7768
8398
|
return normalized;
|
|
7769
8399
|
}
|
|
8400
|
+
async runMigrations(first, second, third) {
|
|
8401
|
+
if (typeof second === "function") return this.runMigrationSets([migrationSet(catalogueOf(first), second)], third);
|
|
8402
|
+
return this.runBound(boundOf(first), second);
|
|
8403
|
+
}
|
|
7770
8404
|
/**
|
|
7771
|
-
*
|
|
7772
|
-
*
|
|
7773
|
-
*
|
|
7774
|
-
* restored devices — with the catalogue bound to the addon's ports
|
|
7775
|
-
* (`defineAddonMigrations(ADDON_MIGRATIONS, ports)`).
|
|
7776
|
-
*
|
|
7777
|
-
* An engine that cannot be reached or refuses the catalogue is logged and runs
|
|
7778
|
-
* nothing; the boot continues. A migration that FAILED (or was blocked by one)
|
|
7779
|
-
* and declares `onFailure: 'block-owner'` makes this throw, so the addon does not
|
|
7780
|
-
* serve data whose shape it cannot trust; `tolerate` migrations never do.
|
|
7781
|
-
*
|
|
7782
|
-
* ALWAYS pass the whole catalogue; a phase that must run only some of it passes
|
|
7783
|
-
* `{ only: [ids] }` — never a filtered catalogue (the engine would judge the
|
|
7784
|
-
* omitted applied ids "newer").
|
|
8405
|
+
* Several catalogues of ONE owner in one declaration (the engine replaces an owner's
|
|
8406
|
+
* catalogue on every declare, so two calls would each judge the other's ids "newer").
|
|
8407
|
+
* Build each entry with `migrationSet(catalogue, (api) => ports)`.
|
|
7785
8408
|
*/
|
|
7786
|
-
async
|
|
8409
|
+
async runMigrationSets(sets, options) {
|
|
8410
|
+
const api = this.ctx.migrationApi;
|
|
8411
|
+
if (api === void 0) throw new Error(`${this.ctx.id}: the migration API is not available on this context`);
|
|
8412
|
+
return this.runBound(sets.flatMap((set) => set.bind(api)), options);
|
|
8413
|
+
}
|
|
8414
|
+
/**
|
|
8415
|
+
* A device addon states its instance kind once, before its migrations run, and the one-switch
|
|
8416
|
+
* migration (registry `enabled` to the instance body, epic #440 step 3) joins whatever
|
|
8417
|
+
* catalogue the addon runs, in the SAME declaration (the engine replaces an owner's catalogue
|
|
8418
|
+
* on every declare).
|
|
8419
|
+
*/
|
|
8420
|
+
declareRegistrySwitch(spec) {
|
|
8421
|
+
this.registrySwitchSpec = spec;
|
|
8422
|
+
}
|
|
8423
|
+
registrySwitchSpec = null;
|
|
8424
|
+
registrySwitchBound() {
|
|
8425
|
+
const spec = this.registrySwitchSpec;
|
|
8426
|
+
if (spec === null) return [];
|
|
8427
|
+
const api = this.ctx.migrationApi;
|
|
8428
|
+
if (api === void 0) {
|
|
8429
|
+
this.ctx.logger.warn("the registry switch migration is skipped: the migration API is not available on this context");
|
|
8430
|
+
return [];
|
|
8431
|
+
}
|
|
8432
|
+
return migrationSet([registrySwitchToBodyMigration({
|
|
8433
|
+
addonId: this.ctx.id,
|
|
8434
|
+
date: "2026-11-06",
|
|
8435
|
+
seq: 1e3,
|
|
8436
|
+
initialBody: spec.initialBody
|
|
8437
|
+
})], (a) => registrySwitchPortsOver({
|
|
8438
|
+
api: integrationRowsApiOver(a),
|
|
8439
|
+
records: switchRecordsOverMigrationApi(a),
|
|
8440
|
+
kind: spec.kind
|
|
8441
|
+
})).bind(api);
|
|
8442
|
+
}
|
|
8443
|
+
async runBound(declared, options) {
|
|
8444
|
+
const added = this.registrySwitchBound();
|
|
8445
|
+
const migrations = [...declared, ...added];
|
|
8446
|
+
const phased = options?.only === void 0 || added.length === 0 ? options : {
|
|
8447
|
+
...options,
|
|
8448
|
+
only: [...options.only, ...added.map((m) => m.meta.id)]
|
|
8449
|
+
};
|
|
7787
8450
|
const api = this.ctx.api.migrations;
|
|
7788
8451
|
const report = await runAddonMigrations({
|
|
7789
8452
|
declareOwner: (input) => api.declareOwner.mutate(input),
|
|
7790
8453
|
startMigration: (input) => api.startMigration.mutate(input),
|
|
7791
8454
|
finishMigration: (input) => api.finishMigration.mutate(input)
|
|
7792
|
-
}, migrations, this.ctx.logger,
|
|
8455
|
+
}, migrations, this.ctx.logger, phased);
|
|
7793
8456
|
if (report.blockOwner.length > 0) throw new AddonMigrationsBlockedError(report.blockOwner);
|
|
7794
8457
|
return report;
|
|
7795
8458
|
}
|
|
@@ -7853,6 +8516,16 @@ var BaseAddon = class {
|
|
|
7853
8516
|
schema(schema) {
|
|
7854
8517
|
return schema;
|
|
7855
8518
|
}
|
|
8519
|
+
/**
|
|
8520
|
+
* The capability names whose scoped settings schemas ({@link clusterSettingsSchema},
|
|
8521
|
+
* {@link nodeSettingsSchema}, {@link deviceDefaultsSchema}) this addon declares. Read BEFORE
|
|
8522
|
+
* `onInitialize`, when the providers it registers are not known yet: the first config resolve
|
|
8523
|
+
* must already know which keys are per node. Names the providers register at init are added
|
|
8524
|
+
* once known.
|
|
8525
|
+
*/
|
|
8526
|
+
scopedSettingsCapabilities() {
|
|
8527
|
+
return [];
|
|
8528
|
+
}
|
|
7856
8529
|
/** Override to provide global-level settings UI schema. */
|
|
7857
8530
|
globalSettingsSchema(_cap) {
|
|
7858
8531
|
return null;
|
|
@@ -7896,7 +8569,8 @@ var BaseAddon = class {
|
|
|
7896
8569
|
return [];
|
|
7897
8570
|
}
|
|
7898
8571
|
async getGlobalSettings(overlay, cap, nodeId) {
|
|
7899
|
-
|
|
8572
|
+
await this.loadScopedSchemas(cap);
|
|
8573
|
+
const schema = this.globalSettingsSchema(cap) ?? this.scopedFormSchema(cap);
|
|
7900
8574
|
if (!schema) return { sections: [] };
|
|
7901
8575
|
const projected = await this.readRawProjectedStore(nodeId, cap);
|
|
7902
8576
|
return hydrateSchema(schema, overlay ? await this.overlayKeepingMarkers(projected, overlay) : projected, { inlineSecretsAsViews: true });
|
|
@@ -7931,10 +8605,9 @@ var BaseAddon = class {
|
|
|
7931
8605
|
*
|
|
7932
8606
|
* Override it only when an `instanceMode: multiple` addon's instances differ: an NVR integration
|
|
7933
8607
|
* needs its connection fields, the default integration the addon's own sections. It is the
|
|
7934
|
-
* SHAPE of the form only — the values live
|
|
7935
|
-
* unchanged (`integrations.setSettings` for an account integration).
|
|
8608
|
+
* SHAPE of the form only — the values live on the instance record.
|
|
7936
8609
|
*/
|
|
7937
|
-
async
|
|
8610
|
+
async integrationFormSchema(_instance) {
|
|
7938
8611
|
return null;
|
|
7939
8612
|
}
|
|
7940
8613
|
/**
|
|
@@ -7980,7 +8653,7 @@ var BaseAddon = class {
|
|
|
7980
8653
|
* per-instance schema when it declares one, else its global schema (what they always showed).
|
|
7981
8654
|
*/
|
|
7982
8655
|
async getIntegrationFormSchema(instance, nodeId) {
|
|
7983
|
-
const scoped = await this.
|
|
8656
|
+
const scoped = await this.integrationFormSchema(instance);
|
|
7984
8657
|
if (scoped === null) return this.getGlobalSettings(void 0, void 0, nodeId);
|
|
7985
8658
|
return hydrateSchema(scoped, {}, { inlineSecretsAsViews: true });
|
|
7986
8659
|
}
|
|
@@ -8028,6 +8701,7 @@ var BaseAddon = class {
|
|
|
8028
8701
|
* resolved blob back is a no-op for every unchanged secret.
|
|
8029
8702
|
*/
|
|
8030
8703
|
async resolveGlobalStore(nodeId, cap) {
|
|
8704
|
+
await this.loadScopedSchemas(cap);
|
|
8031
8705
|
const raw = await this._ctx?.settings?.readAddonStore() ?? {};
|
|
8032
8706
|
return this.projectForNode(raw, nodeId, cap);
|
|
8033
8707
|
}
|
|
@@ -8038,6 +8712,7 @@ var BaseAddon = class {
|
|
|
8038
8712
|
}
|
|
8039
8713
|
/** The PROJECTED store with its markers — the form hydrate only (D798). */
|
|
8040
8714
|
async readRawProjectedStore(nodeId, cap) {
|
|
8715
|
+
await this.loadScopedSchemas(cap);
|
|
8041
8716
|
const raw = await this.rawSettings()?.readAddonStore() ?? {};
|
|
8042
8717
|
return this.projectForNode(raw, nodeId, cap);
|
|
8043
8718
|
}
|
|
@@ -8140,6 +8815,7 @@ var BaseAddon = class {
|
|
|
8140
8815
|
await this.applyGlobalPatch(patch, nodeId);
|
|
8141
8816
|
}
|
|
8142
8817
|
async applyGlobalPatch(barePatch, nodeId) {
|
|
8818
|
+
await this.loadScopedSchemas();
|
|
8143
8819
|
const keys = this.perNodeKeys();
|
|
8144
8820
|
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
8145
8821
|
const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
@@ -8153,7 +8829,8 @@ var BaseAddon = class {
|
|
|
8153
8829
|
await this.resolveConfig();
|
|
8154
8830
|
await this.onConfigChanged();
|
|
8155
8831
|
this.emitLifecycle(EventCategory.AddonUpdated, { level: "global" });
|
|
8156
|
-
|
|
8832
|
+
const legacy = this.globalSettingsSchema();
|
|
8833
|
+
this.maybeAutoRestart(Object.keys(barePatch), [...legacy === null ? [] : [legacy], ...this.loadedScopedSchemas().map((entry) => entry.schema)]);
|
|
8157
8834
|
}
|
|
8158
8835
|
/**
|
|
8159
8836
|
* The set of field keys the global settings schema declares `perNode: true`
|
|
@@ -8161,14 +8838,67 @@ var BaseAddon = class {
|
|
|
8161
8838
|
* declarations). Empty set ⇒ every per-node code path is bypassed and the
|
|
8162
8839
|
* settings API behaves exactly like the legacy node-agnostic one.
|
|
8163
8840
|
*/
|
|
8164
|
-
|
|
8841
|
+
/**
|
|
8842
|
+
* Load the scoped schemas of every capability this addon declares (the override and the
|
|
8843
|
+
* providers registered at init, plus `extraCap`) that is not loaded yet, then drop what was
|
|
8844
|
+
* derived from the previous set. Idempotent.
|
|
8845
|
+
*/
|
|
8846
|
+
async loadScopedSchemas(extraCap) {
|
|
8847
|
+
const caps = new Set([
|
|
8848
|
+
...this.scopedSettingsCapabilities(),
|
|
8849
|
+
...this._registeredCapNames,
|
|
8850
|
+
...extraCap === void 0 ? [] : [extraCap]
|
|
8851
|
+
]);
|
|
8852
|
+
let added = false;
|
|
8853
|
+
for (const cap of caps) {
|
|
8854
|
+
if (this._scopedByCap.has(cap)) continue;
|
|
8855
|
+
const loaded = [];
|
|
8856
|
+
for (const scope of SCOPED_SETTINGS_SCOPES) {
|
|
8857
|
+
const schema = await this.getScopedSettingsSchema(scope, cap);
|
|
8858
|
+
if (schema !== null) loaded.push({
|
|
8859
|
+
scope,
|
|
8860
|
+
schema
|
|
8861
|
+
});
|
|
8862
|
+
}
|
|
8863
|
+
this._scopedByCap.set(cap, loaded);
|
|
8864
|
+
added = true;
|
|
8865
|
+
}
|
|
8866
|
+
if (!added) return;
|
|
8867
|
+
this._nodeKeysByCap = /* @__PURE__ */ new Map();
|
|
8868
|
+
this._addonSecretTree = null;
|
|
8869
|
+
}
|
|
8870
|
+
/**
|
|
8871
|
+
* The form the settings API serves while an addon declares no {@link globalSettingsSchema}: the
|
|
8872
|
+
* sections of its scoped schemas, so dropping the old hook does not blank the form.
|
|
8873
|
+
*/
|
|
8874
|
+
scopedFormSchema(cap) {
|
|
8875
|
+
const byId = /* @__PURE__ */ new Map();
|
|
8876
|
+
for (const entry of this.loadedScopedSchemas(cap)) for (const section of entry.schema.sections) if (!byId.has(section.id)) byId.set(section.id, section);
|
|
8877
|
+
return byId.size === 0 ? null : { sections: [...byId.values()] };
|
|
8878
|
+
}
|
|
8879
|
+
/** Every loaded scoped schema of `cap`, or of every loaded capability. */
|
|
8880
|
+
loadedScopedSchemas(cap) {
|
|
8881
|
+
if (cap !== void 0) return this._scopedByCap.get(cap) ?? [];
|
|
8882
|
+
return [...this._scopedByCap.values()].flat();
|
|
8883
|
+
}
|
|
8884
|
+
/**
|
|
8885
|
+
* The field keys that are stored per node: every field of a {@link nodeSettingsSchema}, plus
|
|
8886
|
+
* the fields the legacy {@link globalSettingsSchema} still marks `perNode: true`. Derived once
|
|
8887
|
+
* per `cap` argument and memoized (schemas are static declarations). Empty set ⇒ every
|
|
8888
|
+
* per-node code path is bypassed and the settings API behaves like the node-agnostic one.
|
|
8889
|
+
* Call {@link loadScopedSchemas} first (the async seams do).
|
|
8890
|
+
*/
|
|
8165
8891
|
perNodeKeys(cap) {
|
|
8166
8892
|
const cacheKey = cap ?? "";
|
|
8167
|
-
const cached = this.
|
|
8893
|
+
const cached = this._nodeKeysByCap.get(cacheKey);
|
|
8168
8894
|
if (cached) return cached;
|
|
8169
|
-
const
|
|
8170
|
-
const keys = new Set(
|
|
8171
|
-
this.
|
|
8895
|
+
const legacy = this.globalSettingsSchema(cap);
|
|
8896
|
+
const keys = new Set(legacy ? legacy.sections.flatMap((section) => collectPerNodeFieldKeys(section.fields)) : []);
|
|
8897
|
+
for (const { scope, schema } of this.loadedScopedSchemas(cap)) {
|
|
8898
|
+
if (scope !== "node") continue;
|
|
8899
|
+
for (const section of schema.sections) for (const key of collectValueFieldKeys(section.fields)) keys.add(key);
|
|
8900
|
+
}
|
|
8901
|
+
this._nodeKeysByCap.set(cacheKey, keys);
|
|
8172
8902
|
return keys;
|
|
8173
8903
|
}
|
|
8174
8904
|
/**
|
|
@@ -8178,10 +8908,9 @@ var BaseAddon = class {
|
|
|
8178
8908
|
* time to return its response before the addon is torn down and
|
|
8179
8909
|
* re-initialised by `AddonRegistryService.restartAddon`.
|
|
8180
8910
|
*/
|
|
8181
|
-
maybeAutoRestart(patchKeys,
|
|
8182
|
-
if (!schema) return;
|
|
8911
|
+
maybeAutoRestart(patchKeys, schemas) {
|
|
8183
8912
|
const restartKeys = /* @__PURE__ */ new Set();
|
|
8184
|
-
for (const section of schema.sections) for (const field of section.fields) {
|
|
8913
|
+
for (const schema of schemas) for (const section of schema.sections) for (const field of section.fields) {
|
|
8185
8914
|
if (field.type === "separator" || field.type === "info") continue;
|
|
8186
8915
|
if (field.requiresRestart) restartKeys.add(field.key);
|
|
8187
8916
|
}
|
|
@@ -8377,12 +9106,14 @@ var BaseAddon = class {
|
|
|
8377
9106
|
* here, in the addon's own process, so the hub keeps no copy of it.
|
|
8378
9107
|
*/
|
|
8379
9108
|
async getDeclaredSettingsKeys() {
|
|
9109
|
+
await this.loadScopedSchemas();
|
|
8380
9110
|
return { keys: [...this.declaredKeySet()].toSorted() };
|
|
8381
9111
|
}
|
|
8382
9112
|
declaredKeySet() {
|
|
8383
9113
|
const keys = new Set(Object.keys(this.defaults));
|
|
8384
9114
|
const schema = this.globalSettingsSchema();
|
|
8385
9115
|
if (schema) for (const section of schema.sections) for (const key of collectFieldKeys(section.fields)) keys.add(key);
|
|
9116
|
+
for (const { schema: scoped } of this.loadedScopedSchemas()) for (const section of scoped.sections) for (const key of collectFieldKeys(section.fields)) keys.add(key);
|
|
8386
9117
|
for (const key of this._declaredStateKeys) keys.add(key);
|
|
8387
9118
|
for (const path of this.secretStatePaths) {
|
|
8388
9119
|
const root = path.split(/[.[]/, 1)[0];
|
|
@@ -8478,7 +9209,11 @@ var BaseAddon = class {
|
|
|
8478
9209
|
}
|
|
8479
9210
|
/** The addon store's secret tree: schema fields by TYPE, plus `secretStatePaths`. */
|
|
8480
9211
|
addonSecretTree() {
|
|
8481
|
-
this._addonSecretTree
|
|
9212
|
+
if (this._addonSecretTree === null) {
|
|
9213
|
+
const tree = new Map(secretTreeFromSchema(this.globalSettingsSchema()));
|
|
9214
|
+
for (const { schema } of this.loadedScopedSchemas()) for (const [key, node] of secretTreeFromSchema(schema)) tree.set(key, node);
|
|
9215
|
+
this._addonSecretTree = mergeSecretStatePaths(tree, this.secretStatePaths);
|
|
9216
|
+
}
|
|
8482
9217
|
return this._addonSecretTree;
|
|
8483
9218
|
}
|
|
8484
9219
|
deviceSecretTree() {
|
|
@@ -8728,6 +9463,23 @@ function dropPerNodeFields(fields) {
|
|
|
8728
9463
|
}
|
|
8729
9464
|
return kept;
|
|
8730
9465
|
}
|
|
9466
|
+
/** The keys of the value-holding fields, recursing into layout containers. */
|
|
9467
|
+
function collectValueFieldKeys(fields) {
|
|
9468
|
+
const collected = [];
|
|
9469
|
+
for (const field of fields) {
|
|
9470
|
+
if (field.type === "group") {
|
|
9471
|
+
collected.push(...collectValueFieldKeys(field.fields));
|
|
9472
|
+
continue;
|
|
9473
|
+
}
|
|
9474
|
+
if (field.type === "sub-tabs") {
|
|
9475
|
+
for (const tab of field.tabs) collected.push(...collectValueFieldKeys(tab.fields));
|
|
9476
|
+
continue;
|
|
9477
|
+
}
|
|
9478
|
+
if (field.type === "separator" || field.type === "info") continue;
|
|
9479
|
+
if ("key" in field && typeof field.key === "string") collected.push(field.key);
|
|
9480
|
+
}
|
|
9481
|
+
return collected;
|
|
9482
|
+
}
|
|
8731
9483
|
function collectFieldKeys(fields) {
|
|
8732
9484
|
const collected = [];
|
|
8733
9485
|
for (const field of fields) {
|
|
@@ -8773,228 +9525,6 @@ function normalizeAddonInitResult(result) {
|
|
|
8773
9525
|
if (Array.isArray(result)) return { providers: result };
|
|
8774
9526
|
return result;
|
|
8775
9527
|
}
|
|
8776
|
-
var PREFIX$1 = "records/";
|
|
8777
|
-
/** The base of every records failure. `detail` is the human part of the message. */
|
|
8778
|
-
var RecordsError = class extends Error {
|
|
8779
|
-
code;
|
|
8780
|
-
detail;
|
|
8781
|
-
constructor(code, detail) {
|
|
8782
|
-
super(`${PREFIX$1}${code}: ${detail}`);
|
|
8783
|
-
this.name = "RecordsError";
|
|
8784
|
-
this.code = code;
|
|
8785
|
-
this.detail = detail;
|
|
8786
|
-
}
|
|
8787
|
-
};
|
|
8788
|
-
/** A write guarded by `ifRev` found another revision (or an existing row for `ifRev: 0`). */
|
|
8789
|
-
var RevConflictError = class extends RecordsError {
|
|
8790
|
-
constructor(detail) {
|
|
8791
|
-
super("rev-conflict", detail);
|
|
8792
|
-
this.name = "RevConflictError";
|
|
8793
|
-
}
|
|
8794
|
-
};
|
|
8795
|
-
/** The keychain could not store or serve a value: explicit, never an empty string. */
|
|
8796
|
-
var RecordSecretUnavailableError = class extends RecordsError {
|
|
8797
|
-
constructor(detail) {
|
|
8798
|
-
super("secret-unavailable", detail);
|
|
8799
|
-
this.name = "RecordSecretUnavailableError";
|
|
8800
|
-
}
|
|
8801
|
-
};
|
|
8802
|
-
var InvalidRecordError = class extends RecordsError {
|
|
8803
|
-
constructor(detail) {
|
|
8804
|
-
super("invalid-record", detail);
|
|
8805
|
-
this.name = "InvalidRecordError";
|
|
8806
|
-
}
|
|
8807
|
-
};
|
|
8808
|
-
/** A kind declaration the engine refuses (non-additive change, bad shape, wrong file). */
|
|
8809
|
-
var DeclarationRefusedError = class extends RecordsError {
|
|
8810
|
-
constructor(detail) {
|
|
8811
|
-
super("declaration-refused", detail);
|
|
8812
|
-
this.name = "DeclarationRefusedError";
|
|
8813
|
-
}
|
|
8814
|
-
};
|
|
8815
|
-
/** Limits and names of `ctx.records` (D881). One authority; the engine and the facade read it. */
|
|
8816
|
-
/** The files a kind may live in. `history` is device-history's (D850), never records. */
|
|
8817
|
-
var RECORD_DATABASES = ["settings", "events"];
|
|
8818
|
-
/** The classes of a kind: the `@durable` vocabulary, one authority (replaces the annotation). */
|
|
8819
|
-
var RECORD_CLASSES = [
|
|
8820
|
-
"config",
|
|
8821
|
-
"ledger",
|
|
8822
|
-
"audit",
|
|
8823
|
-
"mirror",
|
|
8824
|
-
"ephemeral"
|
|
8825
|
-
];
|
|
8826
|
-
var RECORD_DEFAULT_MAX_DATA_BYTES = 64 * 1024;
|
|
8827
|
-
var RECORD_MAX_DATA_BYTES = 1024 * 1024;
|
|
8828
|
-
var RECORD_BATCH_MAX = 1e3;
|
|
8829
|
-
var RECORD_QUERY_MAX = 1e3;
|
|
8830
|
-
/** A kind in the `settings` file may not bound itself above this (D447: high volume is `events`). */
|
|
8831
|
-
var RECORD_SETTINGS_MAX_ROWS = 5e4;
|
|
8832
|
-
/** The `Column`-free proof prefix: a ref collection for a kind's secret fields. */
|
|
8833
|
-
var RECORD_SECRET_COLLECTION_PREFIX = "records:";
|
|
8834
|
-
/**
|
|
8835
|
-
* Secret fields of a record, addressed the way a Zod schema declares them
|
|
8836
|
-
* (`collectZodSecretPaths`): dotted keys, `[]` for "each element of this array"
|
|
8837
|
-
* (`auth.accessToken`, `headers[].value`).
|
|
8838
|
-
*
|
|
8839
|
-
* `{}` after a key means "each value of this map" (`applianceSecrets{}`): the map's own key
|
|
8840
|
-
* names the value (`applianceSecrets{fridge}`), so no id key is declared and a body that drops a
|
|
8841
|
-
* key releases exactly that key's secret.
|
|
8842
|
-
*
|
|
8843
|
-
* Array elements are matched by a DECLARED id key (`secretArrayKeys`:
|
|
8844
|
-
* `{ headers: 'name' }`), never by index, so reordering a list keeps every
|
|
8845
|
-
* keychain ref (the same rule as `arrayItemFieldPath`). The concrete path of a
|
|
8846
|
-
* leaf names its element: `headers[X-Api].value`.
|
|
8847
|
-
*
|
|
8848
|
-
* Pure and browser-safe. Nothing here mutates: every transform returns a new value.
|
|
8849
|
-
*/
|
|
8850
|
-
/** The array prefixes (declared form, e.g. `headers` or `a.headers`) of a path. */
|
|
8851
|
-
function parseSecretPath(path) {
|
|
8852
|
-
if (path.length === 0) throw new InvalidRecordError("an empty secret path");
|
|
8853
|
-
return path.split(".").map((raw) => {
|
|
8854
|
-
const each = raw.endsWith("[]");
|
|
8855
|
-
const map = raw.endsWith("{}");
|
|
8856
|
-
const key = each || map ? raw.slice(0, -2) : raw;
|
|
8857
|
-
if (key.length === 0) throw new InvalidRecordError(`secret path "${path}" has an empty segment`);
|
|
8858
|
-
return {
|
|
8859
|
-
key,
|
|
8860
|
-
each,
|
|
8861
|
-
map
|
|
8862
|
-
};
|
|
8863
|
-
});
|
|
8864
|
-
}
|
|
8865
|
-
/** The declared array prefixes of `path` that need an id key (`headers`, `a.rows`). */
|
|
8866
|
-
function secretArrayPrefixes(path) {
|
|
8867
|
-
const segments = parseSecretPath(path);
|
|
8868
|
-
const prefixes = [];
|
|
8869
|
-
const walked = [];
|
|
8870
|
-
for (const segment of segments) {
|
|
8871
|
-
walked.push(segment.key);
|
|
8872
|
-
if (segment.each) prefixes.push(walked.join("."));
|
|
8873
|
-
}
|
|
8874
|
-
return prefixes;
|
|
8875
|
-
}
|
|
8876
|
-
function isRecord$4(value) {
|
|
8877
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
8878
|
-
}
|
|
8879
|
-
function elementId(element, idKey, declared, prefix) {
|
|
8880
|
-
const id = isRecord$4(element) ? element[idKey] : void 0;
|
|
8881
|
-
if (typeof id !== "string" || id.length === 0) throw new InvalidRecordError(`"${declared}": every element of "${prefix}" needs a non-empty string "${idKey}" to carry a secret`);
|
|
8882
|
-
return id;
|
|
8883
|
-
}
|
|
8884
|
-
/**
|
|
8885
|
-
* Visit every secret leaf PRESENT in `data` (an absent branch has nothing to
|
|
8886
|
-
* visit). `replace` returns the new leaf value, or {@link REMOVE_LEAF}; the
|
|
8887
|
-
* result is a new body, `data` is untouched.
|
|
8888
|
-
*/
|
|
8889
|
-
var REMOVE_LEAF = Symbol("remove-leaf");
|
|
8890
|
-
function mapAt(node, segments, index, walkedKeys, concretePrefix, declared, arrayKeys, visit) {
|
|
8891
|
-
if (!isRecord$4(node)) return node;
|
|
8892
|
-
const segment = segments[index];
|
|
8893
|
-
if (segment === void 0) return node;
|
|
8894
|
-
if (!Object.prototype.hasOwnProperty.call(node, segment.key)) return node;
|
|
8895
|
-
const child = node[segment.key];
|
|
8896
|
-
const keys = [...walkedKeys, segment.key];
|
|
8897
|
-
const last = index === segments.length - 1;
|
|
8898
|
-
if (segment.each) {
|
|
8899
|
-
if (!Array.isArray(child)) return node;
|
|
8900
|
-
const prefix = keys.join(".");
|
|
8901
|
-
const idKey = arrayKeys[prefix];
|
|
8902
|
-
if (idKey === void 0) throw new InvalidRecordError(`"${declared}": no id key declared for the array "${prefix}"`);
|
|
8903
|
-
const mapped = child.map((element) => {
|
|
8904
|
-
const id = elementId(element, idKey, declared, prefix);
|
|
8905
|
-
const concrete = `${concretePrefix}${concretePrefix.length > 0 ? "." : ""}${segment.key}[${encodeURIComponent(id)}]`;
|
|
8906
|
-
return last ? element : mapAt(element, segments, index + 1, keys, concrete, declared, arrayKeys, visit);
|
|
8907
|
-
});
|
|
8908
|
-
return {
|
|
8909
|
-
...node,
|
|
8910
|
-
[segment.key]: mapped
|
|
8911
|
-
};
|
|
8912
|
-
}
|
|
8913
|
-
if (segment.map) {
|
|
8914
|
-
if (!isRecord$4(child)) return node;
|
|
8915
|
-
const kept = Object.entries(child).map(([mapKey, value]) => {
|
|
8916
|
-
const concrete = `${concretePrefix}${concretePrefix.length > 0 ? "." : ""}${segment.key}{${encodeURIComponent(mapKey)}}`;
|
|
8917
|
-
if (!last) return [mapKey, mapAt(value, segments, index + 1, keys, concrete, declared, arrayKeys, visit)];
|
|
8918
|
-
return [mapKey, visit({
|
|
8919
|
-
declared,
|
|
8920
|
-
concrete,
|
|
8921
|
-
value
|
|
8922
|
-
})];
|
|
8923
|
-
}).filter(([, value]) => value !== REMOVE_LEAF);
|
|
8924
|
-
return {
|
|
8925
|
-
...node,
|
|
8926
|
-
[segment.key]: Object.fromEntries(kept)
|
|
8927
|
-
};
|
|
8928
|
-
}
|
|
8929
|
-
const concrete = `${concretePrefix}${concretePrefix.length > 0 ? "." : ""}${segment.key}`;
|
|
8930
|
-
if (last) {
|
|
8931
|
-
const replacement = visit({
|
|
8932
|
-
declared,
|
|
8933
|
-
concrete,
|
|
8934
|
-
value: child
|
|
8935
|
-
});
|
|
8936
|
-
if (replacement === REMOVE_LEAF) return Object.fromEntries(Object.entries(node).filter(([key]) => key !== segment.key));
|
|
8937
|
-
return {
|
|
8938
|
-
...node,
|
|
8939
|
-
[segment.key]: replacement
|
|
8940
|
-
};
|
|
8941
|
-
}
|
|
8942
|
-
return {
|
|
8943
|
-
...node,
|
|
8944
|
-
[segment.key]: mapAt(child, segments, index + 1, keys, concrete, declared, arrayKeys, visit)
|
|
8945
|
-
};
|
|
8946
|
-
}
|
|
8947
|
-
/** Replace/remove every present secret leaf; returns a NEW body. */
|
|
8948
|
-
function mapSecretLeaves(data, paths, arrayKeys, visit) {
|
|
8949
|
-
let current = data;
|
|
8950
|
-
for (const declared of paths) current = mapAt(current, parseSecretPath(declared), 0, [], "", declared, arrayKeys, visit);
|
|
8951
|
-
return current;
|
|
8952
|
-
}
|
|
8953
|
-
/**
|
|
8954
|
-
* The keychain collection name a kind's secrets live under. Prefixed so a
|
|
8955
|
-
* record's refs never collide with the refs a legacy collection of the same name
|
|
8956
|
-
* already holds during an adoption.
|
|
8957
|
-
*/
|
|
8958
|
-
function recordSecretCollection(kind) {
|
|
8959
|
-
return `${RECORD_SECRET_COLLECTION_PREFIX}${kind}`;
|
|
8960
|
-
}
|
|
8961
|
-
/** The ONE ref a row's secret field may carry: the engine and the facade both build it here. */
|
|
8962
|
-
function recordSecretRef(owner, kind, rowId, concretePath) {
|
|
8963
|
-
return buildSecretRef({
|
|
8964
|
-
owner,
|
|
8965
|
-
scope: {
|
|
8966
|
-
kind: "row",
|
|
8967
|
-
collection: recordSecretCollection(kind),
|
|
8968
|
-
rowId
|
|
8969
|
-
},
|
|
8970
|
-
fieldPath: concretePath
|
|
8971
|
-
});
|
|
8972
|
-
}
|
|
8973
|
-
/**
|
|
8974
|
-
* A stored secret, as an admin read shows it: a VIEW naming the row's own
|
|
8975
|
-
* keychain ref (`set: true`), never the value and no longer the bare redaction
|
|
8976
|
-
* token. The form hands it to the secret field, which reveals the value by ref
|
|
8977
|
-
* through the audited `keychain-admin.reveal`; sent back untouched it keeps the
|
|
8978
|
-
* stored secret (the records door reads a view as KEEP).
|
|
8979
|
-
*
|
|
8980
|
-
* ONE implementation for the entries service and for every addon that serves
|
|
8981
|
-
* its own instances (`RecordIntegrationInstances`).
|
|
8982
|
-
*/
|
|
8983
|
-
function isRecord$3(value) {
|
|
8984
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
8985
|
-
}
|
|
8986
|
-
function secretViewsOf(owner, kind, id, decl, data) {
|
|
8987
|
-
if (decl.secretPaths.length === 0) return data;
|
|
8988
|
-
const shown = mapSecretLeaves(data, decl.secretPaths, decl.secretArrayKeys, (leaf) => {
|
|
8989
|
-
if (leaf.value !== "__camstack_redacted__") return leaf.value;
|
|
8990
|
-
return {
|
|
8991
|
-
$secret: recordSecretRef(owner, kind, id, leaf.concrete),
|
|
8992
|
-
v: 1,
|
|
8993
|
-
set: true
|
|
8994
|
-
};
|
|
8995
|
-
});
|
|
8996
|
-
return isRecord$3(shown) ? shown : data;
|
|
8997
|
-
}
|
|
8998
9528
|
/**
|
|
8999
9529
|
* The share-view scope kinds a share-link token can carry. The hub mints
|
|
9000
9530
|
* and validates them (`ShareViewGrantSchema` builds its
|
|
@@ -11095,6 +11625,10 @@ Object.freeze({
|
|
|
11095
11625
|
"all",
|
|
11096
11626
|
"one"
|
|
11097
11627
|
]
|
|
11628
|
+
},
|
|
11629
|
+
{
|
|
11630
|
+
"path": "positionUpdatedAt",
|
|
11631
|
+
"valueType": "number"
|
|
11098
11632
|
}
|
|
11099
11633
|
],
|
|
11100
11634
|
"meter": [{
|
|
@@ -11349,22 +11883,6 @@ Object.freeze({
|
|
|
11349
11883
|
"path": "pumpRunning",
|
|
11350
11884
|
"valueType": "boolean"
|
|
11351
11885
|
},
|
|
11352
|
-
{
|
|
11353
|
-
"path": "lastDrink",
|
|
11354
|
-
"valueType": "number"
|
|
11355
|
-
},
|
|
11356
|
-
{
|
|
11357
|
-
"path": "currentHourDrink",
|
|
11358
|
-
"valueType": "number"
|
|
11359
|
-
},
|
|
11360
|
-
{
|
|
11361
|
-
"path": "last24hDrink",
|
|
11362
|
-
"valueType": "number"
|
|
11363
|
-
},
|
|
11364
|
-
{
|
|
11365
|
-
"path": "todayDrink",
|
|
11366
|
-
"valueType": "number"
|
|
11367
|
-
},
|
|
11368
11886
|
{
|
|
11369
11887
|
"path": "error",
|
|
11370
11888
|
"valueType": "string"
|
|
@@ -11930,12 +12448,66 @@ Object.freeze({
|
|
|
11930
12448
|
}
|
|
11931
12449
|
]
|
|
11932
12450
|
});
|
|
12451
|
+
Object.freeze({
|
|
12452
|
+
"actions": { "run": 363e4 },
|
|
12453
|
+
"audio-analyzer": { "classify": 3e4 },
|
|
12454
|
+
"custom-model-registry": { "importModelBundle": 18e5 },
|
|
12455
|
+
"database-snapshot": { "writeSnapshot": 18e5 },
|
|
12456
|
+
"device-manager": {
|
|
12457
|
+
"migrateDevice": 72e4,
|
|
12458
|
+
"runDiscoverySweep": 12e4
|
|
12459
|
+
},
|
|
12460
|
+
"device-provider": { "reloadDevice": 18e4 },
|
|
12461
|
+
"llm": {
|
|
12462
|
+
"generate": 6e5,
|
|
12463
|
+
"generateVision": 6e5,
|
|
12464
|
+
"testProfile": 6e5
|
|
12465
|
+
},
|
|
12466
|
+
"llm-runtime": {
|
|
12467
|
+
"complete": 6e5,
|
|
12468
|
+
"completeApple": 6e5,
|
|
12469
|
+
"ensureStarted": 6e5,
|
|
12470
|
+
"installModel": 36e5
|
|
12471
|
+
},
|
|
12472
|
+
"local-network": { "scanNetwork": 9e4 },
|
|
12473
|
+
"model-convert": { "convert": 6e5 },
|
|
12474
|
+
"pipeline-analytics": {
|
|
12475
|
+
"addRetrainFrameFromRecording": 6e4,
|
|
12476
|
+
"offerRetrainArchive": 12e4,
|
|
12477
|
+
"proposeRetrainAnnotationsWithLlm": 18e4,
|
|
12478
|
+
"resolveRetrainTrainingCorpus": 6e4,
|
|
12479
|
+
"writeRetrainArchive": 36e5
|
|
12480
|
+
},
|
|
12481
|
+
"server-management": { "applyServerUpdate": 96e4 },
|
|
12482
|
+
"terminal-session": { "pullOutput": 15e3 },
|
|
12483
|
+
"training": {
|
|
12484
|
+
"canaryResult": 12e4,
|
|
12485
|
+
"cancelJob": 12e4,
|
|
12486
|
+
"planJob": 6e4,
|
|
12487
|
+
"registerResult": 18e5,
|
|
12488
|
+
"rollbackCanary": 12e4,
|
|
12489
|
+
"startJob": 12e4,
|
|
12490
|
+
"startJobBatch": 12e4
|
|
12491
|
+
},
|
|
12492
|
+
"training-provider": {
|
|
12493
|
+
"cancelJob": 6e4,
|
|
12494
|
+
"cleanupJob": 3e5,
|
|
12495
|
+
"getJob": 6e4,
|
|
12496
|
+
"listJobEvents": 6e4,
|
|
12497
|
+
"listJobs": 12e4,
|
|
12498
|
+
"offerArtifact": 3e5,
|
|
12499
|
+
"readResult": 3e5,
|
|
12500
|
+
"submitJob": 18e5,
|
|
12501
|
+
"uploadDataset": 72e5,
|
|
12502
|
+
"validateCredentials": 3e4
|
|
12503
|
+
}
|
|
12504
|
+
});
|
|
11933
12505
|
object({
|
|
11934
12506
|
code: string().regex(/^[a-z][a-z0-9-]*(\.[a-z0-9-]+)+$/),
|
|
11935
12507
|
params: record(string(), union([string(), number()])).optional()
|
|
11936
12508
|
});
|
|
11937
12509
|
//#endregion
|
|
11938
|
-
//#region ../types/dist/composition-
|
|
12510
|
+
//#region ../types/dist/composition-BmBHuDTQ.mjs
|
|
11939
12511
|
/**
|
|
11940
12512
|
* The ffmpeg build every CamStack node downloads, per platform and arch.
|
|
11941
12513
|
*
|
|
@@ -12239,7 +12811,7 @@ var table = {
|
|
|
12239
12811
|
},
|
|
12240
12812
|
dwell: {
|
|
12241
12813
|
minArgs: 3,
|
|
12242
|
-
maxArgs:
|
|
12814
|
+
maxArgs: 4,
|
|
12243
12815
|
apply: () => {
|
|
12244
12816
|
throw new ExpressionEvalError("dwell: stateful evaluation context is required");
|
|
12245
12817
|
}
|
|
@@ -13399,205 +13971,6 @@ function buildCapturingReply(envelope) {
|
|
|
13399
13971
|
};
|
|
13400
13972
|
return wrapper;
|
|
13401
13973
|
}
|
|
13402
|
-
/**
|
|
13403
|
-
* `RecordIntegrationInstances` - the `integration-instances` provider over ONE
|
|
13404
|
-
* entry kind, so an addon that holds a connection serves it in ~30 lines.
|
|
13405
|
-
*
|
|
13406
|
-
* Every instance is one record of the addon's own kind, keyed by the
|
|
13407
|
-
* `integrations` registry id. The records door does the secret work: a field the
|
|
13408
|
-
* kind marks `.meta({ secret: true })` is a keychain marker bound to the row, so
|
|
13409
|
-
* deleting the row deletes the secret, and one row's value is never another's.
|
|
13410
|
-
*
|
|
13411
|
-
* Patch rules for a secret (`updateInstance`): omitted, `''`, the redaction
|
|
13412
|
-
* token or the view the form was given KEEP the stored secret;
|
|
13413
|
-
* `{ $secretClear: true }` clears it; any other string replaces it.
|
|
13414
|
-
*/
|
|
13415
|
-
/** The most instances one addon lists (an integrations page, not a table). */
|
|
13416
|
-
var INSTANCES_LIST_MAX = 1e3;
|
|
13417
|
-
/** The keys of the kind's secret fields that sit at the top level of the body. */
|
|
13418
|
-
function topLevelSecretKeys(paths) {
|
|
13419
|
-
return new Set(paths.filter((p) => !p.includes(".") && !p.includes("[") && !p.includes("{")));
|
|
13420
|
-
}
|
|
13421
|
-
/** The keys of the kind's top-level MAPS whose values are secrets (`applianceSecrets{}`). */
|
|
13422
|
-
function secretMapKeys(paths) {
|
|
13423
|
-
return new Set(paths.filter((p) => p.endsWith("{}") && !p.slice(0, -2).match(/[.[{]/)).map((p) => p.slice(0, -2)));
|
|
13424
|
-
}
|
|
13425
|
-
/**
|
|
13426
|
-
* A patch value for a map of secrets: an entry that is omitted, `''`, the redaction token or the
|
|
13427
|
-
* view the form was given KEEPS its stored secret (it is left out of the merge); `{ $secretClear }`
|
|
13428
|
-
* or `null` removes the entry; any other string replaces it. Null when nothing is left to merge.
|
|
13429
|
-
*/
|
|
13430
|
-
function secretMapPatch(value) {
|
|
13431
|
-
if (typeof value !== "object" || value === null || Array.isArray(value)) return null;
|
|
13432
|
-
const out = {};
|
|
13433
|
-
for (const [key, entry] of Object.entries(value)) if (entry === null || isSecretClear(entry)) out[key] = null;
|
|
13434
|
-
else if (typeof entry === "string" && entry !== "" && entry !== "__camstack_redacted__" && !isSecretFieldView(entry)) out[key] = entry;
|
|
13435
|
-
return Object.keys(out).length > 0 ? out : null;
|
|
13436
|
-
}
|
|
13437
|
-
/** Does the kind's body schema carry an `enabled` field? */
|
|
13438
|
-
function declaresEnabled(kind) {
|
|
13439
|
-
const json = toJSONSchema(kind.schema, {
|
|
13440
|
-
unrepresentable: "any",
|
|
13441
|
-
io: "input"
|
|
13442
|
-
});
|
|
13443
|
-
const properties = Reflect.get(json, "properties");
|
|
13444
|
-
return typeof properties === "object" && properties !== null && "enabled" in properties;
|
|
13445
|
-
}
|
|
13446
|
-
var RecordIntegrationInstances = class {
|
|
13447
|
-
records;
|
|
13448
|
-
kind;
|
|
13449
|
-
hooks;
|
|
13450
|
-
handle;
|
|
13451
|
-
secretKeys;
|
|
13452
|
-
secretMaps;
|
|
13453
|
-
nameField;
|
|
13454
|
-
/** The `integrations` registry owns the on/off switch (`role: devices`); the body has none. */
|
|
13455
|
-
registryOwnsEnabled;
|
|
13456
|
-
constructor(records, kind, hooks) {
|
|
13457
|
-
this.records = records;
|
|
13458
|
-
this.kind = kind;
|
|
13459
|
-
this.hooks = hooks;
|
|
13460
|
-
this.handle = records.kind(kind);
|
|
13461
|
-
this.secretKeys = topLevelSecretKeys(kind.declaration.secretPaths);
|
|
13462
|
-
this.secretMaps = secretMapKeys(kind.declaration.secretPaths);
|
|
13463
|
-
this.nameField = kind.declaration.entry?.nameField ?? "name";
|
|
13464
|
-
this.registryOwnsEnabled = hooks.description.role === "devices";
|
|
13465
|
-
if (this.registryOwnsEnabled && declaresEnabled(kind)) throw new Error(`kind "${kind.name}": the integrations registry owns the on/off switch of a role "devices" addon, so the body must not declare "enabled"`);
|
|
13466
|
-
}
|
|
13467
|
-
/**
|
|
13468
|
-
* One instance read for the addon's own runtime; null when absent. When the keychain is
|
|
13469
|
-
* locked the row is served WITHOUT its secrets and says so (`secrets: 'unavailable'`), so the
|
|
13470
|
-
* caller can keep what it had instead of reconfiguring with an empty secret (D49).
|
|
13471
|
-
*/
|
|
13472
|
-
async readResolved(id) {
|
|
13473
|
-
try {
|
|
13474
|
-
const record = await this.handle.getResolved(id);
|
|
13475
|
-
return record === null ? null : {
|
|
13476
|
-
id,
|
|
13477
|
-
body: record.data,
|
|
13478
|
-
enabled: record.data.enabled !== false,
|
|
13479
|
-
secrets: "resolved"
|
|
13480
|
-
};
|
|
13481
|
-
} catch (err) {
|
|
13482
|
-
if (!(err instanceof RecordSecretUnavailableError)) throw err;
|
|
13483
|
-
const stored = await this.handle.get(id);
|
|
13484
|
-
if (stored === null) return null;
|
|
13485
|
-
return {
|
|
13486
|
-
id,
|
|
13487
|
-
body: Object.fromEntries(Object.entries(stored.data).filter(([key]) => !this.secretKeys.has(key))),
|
|
13488
|
-
enabled: stored.data.enabled !== false,
|
|
13489
|
-
secrets: "unavailable"
|
|
13490
|
-
};
|
|
13491
|
-
}
|
|
13492
|
-
}
|
|
13493
|
-
/** The body of {@link readResolved} alone; a locked keychain yields the row without secrets. */
|
|
13494
|
-
async getResolved(id) {
|
|
13495
|
-
return (await this.readResolved(id))?.body ?? null;
|
|
13496
|
-
}
|
|
13497
|
-
/** Every instance, secrets resolved where the keychain allows; an absent one is skipped. */
|
|
13498
|
-
async listResolved() {
|
|
13499
|
-
const page = await this.handle.query({ limit: INSTANCES_LIST_MAX });
|
|
13500
|
-
const out = [];
|
|
13501
|
-
for (const record of page.records) {
|
|
13502
|
-
const read = await this.readResolved(record.id);
|
|
13503
|
-
if (read !== null) out.push(read);
|
|
13504
|
-
}
|
|
13505
|
-
return out;
|
|
13506
|
-
}
|
|
13507
|
-
viewOf(record) {
|
|
13508
|
-
const shown = secretViewsOf(this.records.owner, this.kind.name, record.id, this.kind.declaration, record.data);
|
|
13509
|
-
const rawName = record.data[this.nameField];
|
|
13510
|
-
const kind = this.hooks.kindOf?.(record.data);
|
|
13511
|
-
const health = this.hooks.health?.(record.data, record.id);
|
|
13512
|
-
return {
|
|
13513
|
-
id: record.id,
|
|
13514
|
-
name: typeof rawName === "string" ? rawName : record.id,
|
|
13515
|
-
configured: this.hooks.configured(record.data),
|
|
13516
|
-
...this.registryOwnsEnabled ? {} : { enabled: record.data.enabled !== false },
|
|
13517
|
-
formValues: shown,
|
|
13518
|
-
...kind !== void 0 ? { kind } : {},
|
|
13519
|
-
...health?.status !== void 0 ? { status: health.status } : {},
|
|
13520
|
-
...health?.lastCheckedAt !== void 0 ? { lastCheckedAt: health.lastCheckedAt } : {}
|
|
13521
|
-
};
|
|
13522
|
-
}
|
|
13523
|
-
describe = async () => this.hooks.mintId === void 0 ? this.hooks.description : {
|
|
13524
|
-
...this.hooks.description,
|
|
13525
|
-
mintsId: true
|
|
13526
|
-
};
|
|
13527
|
-
instanceFormSchema = async ({ id }) => this.hooks.formSchema(id);
|
|
13528
|
-
listInstances = async () => {
|
|
13529
|
-
return (await this.handle.query({ limit: INSTANCES_LIST_MAX })).records.map((record) => this.viewOf(record));
|
|
13530
|
-
};
|
|
13531
|
-
getInstance = async ({ id }) => {
|
|
13532
|
-
const record = await this.handle.get(id);
|
|
13533
|
-
return record === null ? null : this.viewOf(record);
|
|
13534
|
-
};
|
|
13535
|
-
/** Insert ONE row (`ifRev: 0`: an existing id is refused, never overwritten). */
|
|
13536
|
-
createInstance = async ({ id, name, kind }) => {
|
|
13537
|
-
const minted = id ?? this.hooks.mintId?.({
|
|
13538
|
-
name,
|
|
13539
|
-
...kind !== void 0 ? { kind } : {}
|
|
13540
|
-
});
|
|
13541
|
-
if (minted === void 0) throw new Error("createInstance needs an id: this provider does not mint one");
|
|
13542
|
-
await this.handle.put({
|
|
13543
|
-
id: minted,
|
|
13544
|
-
data: this.hooks.initialBody(name, kind)
|
|
13545
|
-
}, { ifRev: 0 });
|
|
13546
|
-
await this.hooks.onChanged?.(minted, "created");
|
|
13547
|
-
return { id: minted };
|
|
13548
|
-
};
|
|
13549
|
-
updateInstance = async ({ id, name, values }) => {
|
|
13550
|
-
const patch = {};
|
|
13551
|
-
for (const [key, value] of Object.entries(values)) {
|
|
13552
|
-
if (value === void 0) continue;
|
|
13553
|
-
if (this.secretMaps.has(key)) {
|
|
13554
|
-
const entries = secretMapPatch(value);
|
|
13555
|
-
if (entries !== null) patch[key] = entries;
|
|
13556
|
-
} else if (!this.secretKeys.has(key)) patch[key] = value;
|
|
13557
|
-
else if (isSecretClear(value)) patch[key] = null;
|
|
13558
|
-
else if (typeof value === "string" && value !== "" && value !== "__camstack_redacted__" && !isSecretFieldView(value)) patch[key] = value;
|
|
13559
|
-
}
|
|
13560
|
-
if (name !== void 0) patch[this.nameField] = name;
|
|
13561
|
-
await this.handle.patch(id, patch);
|
|
13562
|
-
await this.hooks.onChanged?.(id, "updated");
|
|
13563
|
-
return { ok: true };
|
|
13564
|
-
};
|
|
13565
|
-
/** The switch lives in the record body; the addon is told so it applies it (D996). */
|
|
13566
|
-
setInstanceEnabled = async ({ id, enabled }) => {
|
|
13567
|
-
if (this.registryOwnsEnabled) throw new Error(`instance "${id}": the integrations registry owns the on/off switch of this addon; set it with integrations.update`);
|
|
13568
|
-
await this.handle.patch(id, { enabled });
|
|
13569
|
-
await this.hooks.onChanged?.(id, "enabled");
|
|
13570
|
-
return { ok: true };
|
|
13571
|
-
};
|
|
13572
|
-
/** The row and its keychain refs go together (the records door). */
|
|
13573
|
-
deleteInstance = async ({ id }) => {
|
|
13574
|
-
await this.handle.delete(id);
|
|
13575
|
-
await this.hooks.onChanged?.(id, "deleted");
|
|
13576
|
-
return { ok: true };
|
|
13577
|
-
};
|
|
13578
|
-
testInstance = async (input) => {
|
|
13579
|
-
if (this.hooks.test === void 0) return {
|
|
13580
|
-
success: false,
|
|
13581
|
-
status: "unsupported",
|
|
13582
|
-
error: "This integration declares no connection test"
|
|
13583
|
-
};
|
|
13584
|
-
return this.hooks.test(input);
|
|
13585
|
-
};
|
|
13586
|
-
/** The flat provider object to hand to `registerProvider`. */
|
|
13587
|
-
toProvider() {
|
|
13588
|
-
return {
|
|
13589
|
-
describe: this.describe,
|
|
13590
|
-
instanceFormSchema: this.instanceFormSchema,
|
|
13591
|
-
listInstances: this.listInstances,
|
|
13592
|
-
getInstance: this.getInstance,
|
|
13593
|
-
createInstance: this.createInstance,
|
|
13594
|
-
updateInstance: this.updateInstance,
|
|
13595
|
-
setInstanceEnabled: this.setInstanceEnabled,
|
|
13596
|
-
deleteInstance: this.deleteInstance,
|
|
13597
|
-
testInstance: this.testInstance
|
|
13598
|
-
};
|
|
13599
|
-
}
|
|
13600
|
-
};
|
|
13601
13974
|
var EncodeProfileSchema = object({
|
|
13602
13975
|
video: object({
|
|
13603
13976
|
codec: _enum([
|
|
@@ -15822,6 +16195,39 @@ var UnstampedEventMediaCountSchema = object({
|
|
|
15822
16195
|
/** Sum across both, or `null` when either lane could not be counted. */
|
|
15823
16196
|
total: number().int().nonnegative().nullable()
|
|
15824
16197
|
}).nullable();
|
|
16198
|
+
/**
|
|
16199
|
+
* Where the stored event media sits, per storage location: how many media rows
|
|
16200
|
+
* and how many bytes carry each location id, how many carry none (legacy,
|
|
16201
|
+
* resolved to the default `eventMedia` location), and how many name a location
|
|
16202
|
+
* that was not asked about (a deleted or never-listed one).
|
|
16203
|
+
*
|
|
16204
|
+
* One covering-index aggregate per asked location plus the NULL one, and one
|
|
16205
|
+
* unfiltered total that scans the covering index: O(rows), not a walk of the
|
|
16206
|
+
* rows themselves. `unlisted` is total minus the ASKED locations minus NULL, so
|
|
16207
|
+
* it is a deleted location only when every location id was asked.
|
|
16208
|
+
* `null` is "could not be measured", never zero.
|
|
16209
|
+
*/
|
|
16210
|
+
var MediaLocationCensusInputSchema = object({ locationIds: array(string().min(1)).max(50).readonly() });
|
|
16211
|
+
var MediaLocationCensusSchema = object({
|
|
16212
|
+
locations: array(object({
|
|
16213
|
+
locationId: string(),
|
|
16214
|
+
rows: number().int().nonnegative(),
|
|
16215
|
+
bytes: number().nonnegative()
|
|
16216
|
+
})).readonly(),
|
|
16217
|
+
unstamped: object({
|
|
16218
|
+
rows: number().int().nonnegative(),
|
|
16219
|
+
bytes: number().nonnegative()
|
|
16220
|
+
}),
|
|
16221
|
+
/** Rows stamped with a location id that was not in the asked list. */
|
|
16222
|
+
unlisted: object({
|
|
16223
|
+
rows: number().int().nonnegative(),
|
|
16224
|
+
bytes: number().nonnegative()
|
|
16225
|
+
}),
|
|
16226
|
+
total: object({
|
|
16227
|
+
rows: number().int().nonnegative(),
|
|
16228
|
+
bytes: number().nonnegative()
|
|
16229
|
+
})
|
|
16230
|
+
});
|
|
15825
16231
|
var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
|
|
15826
16232
|
/** The independently selectable logical storage classes — every class
|
|
15827
16233
|
* `storage.listLocationDeclarations` reports, so an operator never meets a
|
|
@@ -19919,31 +20325,21 @@ var APPLIANCE_CAP_VOCABULARY = {
|
|
|
19919
20325
|
"pet-fountain": {
|
|
19920
20326
|
scope: "device",
|
|
19921
20327
|
noun: t("Pet fountain", "Fontana per animali"),
|
|
19922
|
-
actions: [
|
|
19923
|
-
|
|
19924
|
-
|
|
19925
|
-
|
|
19926
|
-
|
|
19927
|
-
|
|
19928
|
-
|
|
19929
|
-
|
|
19930
|
-
|
|
19931
|
-
|
|
19932
|
-
|
|
19933
|
-
|
|
19934
|
-
|
|
19935
|
-
|
|
19936
|
-
|
|
19937
|
-
args: { on: false }
|
|
19938
|
-
},
|
|
19939
|
-
{
|
|
19940
|
-
id: "petFountain.resetDailyConsumption",
|
|
19941
|
-
method: "resetDailyConsumption",
|
|
19942
|
-
label: t("Clear daily consumption", "Azzera il consumo giornaliero"),
|
|
19943
|
-
phrase: t("Clear the daily water consumption of {device}", "Azzera il consumo giornaliero di acqua di {device}"),
|
|
19944
|
-
icon: "rotate-ccw"
|
|
19945
|
-
}
|
|
19946
|
-
],
|
|
20328
|
+
actions: [{
|
|
20329
|
+
id: "petFountain.pumpOn",
|
|
20330
|
+
method: "setPump",
|
|
20331
|
+
label: t("Pump on", "Pompa accesa"),
|
|
20332
|
+
phrase: t("Start the pump of {device}", "Avvia la pompa di {device}"),
|
|
20333
|
+
icon: "play",
|
|
20334
|
+
args: { on: true }
|
|
20335
|
+
}, {
|
|
20336
|
+
id: "petFountain.pumpOff",
|
|
20337
|
+
method: "setPump",
|
|
20338
|
+
label: t("Pump off", "Pompa spenta"),
|
|
20339
|
+
phrase: t("Stop the pump of {device}", "Ferma la pompa di {device}"),
|
|
20340
|
+
icon: "square",
|
|
20341
|
+
args: { on: false }
|
|
20342
|
+
}],
|
|
19947
20343
|
state: [{
|
|
19948
20344
|
kind: "boolean",
|
|
19949
20345
|
field: "empty",
|
|
@@ -43837,8 +44233,15 @@ var ActionInputSchema = object({
|
|
|
43837
44233
|
var ActionRunOriginSchema = object({
|
|
43838
44234
|
/** The automation block whose step started it. */
|
|
43839
44235
|
blockId: string().min(1).optional() });
|
|
43840
|
-
/**
|
|
43841
|
-
|
|
44236
|
+
/**
|
|
44237
|
+
* `started` = the caller did not ask to wait. `timed-out` = the run reached the
|
|
44238
|
+
* ceiling (`ACTION_RUN_MAX_MS`) and was stopped; it is never a `ran`.
|
|
44239
|
+
*/
|
|
44240
|
+
var ActionRunOutcomeSchema = union([
|
|
44241
|
+
AutomationRunOutcomeSchema,
|
|
44242
|
+
literal("started"),
|
|
44243
|
+
literal("timed-out")
|
|
44244
|
+
]);
|
|
43842
44245
|
var ActionRunResultSchema = object({
|
|
43843
44246
|
runId: string().min(1),
|
|
43844
44247
|
outcome: ActionRunOutcomeSchema,
|
|
@@ -44322,7 +44725,7 @@ async function runExportedAction(api, log, input) {
|
|
|
44322
44725
|
const result = await api.actions.run.mutate({ actionId });
|
|
44323
44726
|
if (result.outcome === "skipped-overlap") return refuse("already-running", result.message);
|
|
44324
44727
|
if (result.outcome === "skipped-cooldown") return refuse("cooldown", result.message);
|
|
44325
|
-
if (result.outcome === "failed" || result.outcome === "aborted") {
|
|
44728
|
+
if (result.outcome === "failed" || result.outcome === "aborted" || result.outcome === "timed-out") {
|
|
44326
44729
|
const message = result.message ?? result.outcome;
|
|
44327
44730
|
log.warn(`${exporter}: exported action failed`, {
|
|
44328
44731
|
tags,
|
|
@@ -44443,6 +44846,8 @@ method(object({}), array(ActionEntrySchema), { auth: "admin" }), method(object({
|
|
|
44443
44846
|
kind: "mutation",
|
|
44444
44847
|
auth: "admin"
|
|
44445
44848
|
});
|
|
44849
|
+
/** `timeoutMs` of `actions.run`: a waited call outlives any legal run. */
|
|
44850
|
+
var ACTION_RUN_TIMEOUT_MS = 363e4;
|
|
44446
44851
|
/**
|
|
44447
44852
|
* actions — the ONE surface for runnable actions, for the UI and for
|
|
44448
44853
|
* automations. Provided by the core-blocks builtin on the hub.
|
|
@@ -44461,6 +44866,12 @@ method(object({}), array(ActionEntrySchema), { auth: "admin" }), method(object({
|
|
|
44461
44866
|
* An admin, and an in-process caller (an automation block), may run any action.
|
|
44462
44867
|
* Every refusal is typed (`[not-linked] …`) and logged.
|
|
44463
44868
|
*
|
|
44869
|
+
* **A run lasts at most `ACTION_RUN_MAX_MS` (60 min).** The provider stops a
|
|
44870
|
+
* run that reaches it and answers `timed-out` (never `ran`); an action whose
|
|
44871
|
+
* `wait` steps alone add up to more is refused at create/update
|
|
44872
|
+
* (`[invalid-steps]`). `run` declares a `timeoutMs` above that ceiling, so a
|
|
44873
|
+
* waited call (an automation step) is never cut by the 60 s transport default.
|
|
44874
|
+
*
|
|
44464
44875
|
* A second `run` of an action that is already running is REFUSED — traced and
|
|
44465
44876
|
* logged — never queued.
|
|
44466
44877
|
*/
|
|
@@ -44487,7 +44898,8 @@ method(object({}), array(ActionEntrySchema), { auth: "admin" }), method(object({
|
|
|
44487
44898
|
role: "viewer",
|
|
44488
44899
|
auth: "protected",
|
|
44489
44900
|
kind: "mutation",
|
|
44490
|
-
caller: "required"
|
|
44901
|
+
caller: "required",
|
|
44902
|
+
timeoutMs: ACTION_RUN_TIMEOUT_MS
|
|
44491
44903
|
}), method(ActionIdInput, _void(), {
|
|
44492
44904
|
kind: "mutation",
|
|
44493
44905
|
auth: "admin"
|
|
@@ -46574,52 +46986,7 @@ DeviceType.Light, method(object({
|
|
|
46574
46986
|
level: number().min(0).max(100),
|
|
46575
46987
|
lastChangedAt: number()
|
|
46576
46988
|
});
|
|
46577
|
-
|
|
46578
|
-
* `broker` — unified pub/sub broker registry, system-scoped collection.
|
|
46579
|
-
*
|
|
46580
|
-
* The cap models any kind-tagged message broker the user wants to
|
|
46581
|
-
* register and that other addons might consume. The first two kinds
|
|
46582
|
-
* are MQTT (mosquitto / aedes embedded / cloud bridge) and
|
|
46583
|
-
* Home Assistant (HA WebSocket — subscribe_entities + call_service).
|
|
46584
|
-
* Future kinds (Zigbee2MQTT bridge, ZHA, KNX, Telegram, …) plug in
|
|
46585
|
-
* the same surface.
|
|
46586
|
-
*
|
|
46587
|
-
* Why one cap, not one cap per kind:
|
|
46588
|
-
* - The integrations page wants a single table of "every broker"
|
|
46589
|
-
* across kinds; a unified cap drives it without join logic.
|
|
46590
|
-
* - Generic admin operations (add / remove / test / status) are
|
|
46591
|
-
* identical across kinds — duplicating them per cap was busywork.
|
|
46592
|
-
* - The `network-access` cap precedent: same interface, many
|
|
46593
|
-
* `providerKind: 'ingress'` implementations (Tailscale, ngrok, …).
|
|
46594
|
-
*
|
|
46595
|
-
* What stays kind-specific:
|
|
46596
|
-
* - `getBrokerConfig` payload (kind decides whether it returns
|
|
46597
|
-
* mqtt URL+creds, HA baseUrl+token, …) — typed as
|
|
46598
|
-
* `Record<string, unknown>` at the wire; consumers narrow.
|
|
46599
|
-
* - `publish` / `subscribe` / `getState` arguments (target / filter /
|
|
46600
|
-
* key) — also typed as `Record<string, unknown>` so each kind can
|
|
46601
|
-
* evolve its surface (MQTT topic+qos vs HA entity_id+domain)
|
|
46602
|
-
* without rebreaking the cap signature.
|
|
46603
|
-
* - `add` `settings` payload (different fields per kind, validated by
|
|
46604
|
-
* the kind-specific provider).
|
|
46605
|
-
*
|
|
46606
|
-
* Bidirectionality:
|
|
46607
|
-
* - `publish` is RPC — synchronous result (provider-defined).
|
|
46608
|
-
* - `subscribe` returns a subscription handle; the actual message
|
|
46609
|
-
* stream flows over the typed event-bus as `broker.message` events
|
|
46610
|
-
* keyed by `(brokerId, subscriptionId)`. Consumers filter in their
|
|
46611
|
-
* event handler. Subscriptions persist across reconnects — the
|
|
46612
|
-
* provider re-subscribes upstream after a transport drop.
|
|
46613
|
-
*
|
|
46614
|
-
* Why event-bus push (not a subscription RPC stream):
|
|
46615
|
-
* - Matches the rest of CamStack's D8 contract — events for telemetry,
|
|
46616
|
-
* RPC for loss-is-a-bug. Broker messages are telemetry (a single
|
|
46617
|
-
* drop is recoverable via `getState({key})`).
|
|
46618
|
-
* - Frees `broker.subscribe` from holding a long-lived RPC channel.
|
|
46619
|
-
* - Cross-process: events already route through `$event-bus`; no
|
|
46620
|
-
* per-broker wire-shaping needed.
|
|
46621
|
-
*/
|
|
46622
|
-
var BrokerStatusEnum = _enum([
|
|
46989
|
+
_enum([
|
|
46623
46990
|
"connected",
|
|
46624
46991
|
"disconnected",
|
|
46625
46992
|
"connecting",
|
|
@@ -46627,141 +46994,12 @@ var BrokerStatusEnum = _enum([
|
|
|
46627
46994
|
"unreachable",
|
|
46628
46995
|
"error"
|
|
46629
46996
|
]);
|
|
46630
|
-
var BrokerInfoSchema = object({
|
|
46631
|
-
/** Stable broker id. Persisted; survives addon restarts. */
|
|
46632
|
-
id: string(),
|
|
46633
|
-
/** Addon id of the provider that OWNS this broker.
|
|
46634
|
-
*
|
|
46635
|
-
* The `broker` cap is a system-scoped collection: several addons
|
|
46636
|
-
* register a `broker` provider, each owning a DISJOINT set of
|
|
46637
|
-
* brokers (mqtt-broker owns `mqtt_*`, provider-homeassistant owns
|
|
46638
|
-
* `ha_*`). A broker therefore belongs to exactly one addon — like a
|
|
46639
|
-
* device belongs to one integration. The admin UI threads this id
|
|
46640
|
-
* back as the `{ addonId }` system-collection selector on every
|
|
46641
|
-
* id-keyed call (`get` / `getSettings` / `setSettings` / `remove` /
|
|
46642
|
-
* `testConnection`), so the call routes to the OWNING provider
|
|
46643
|
-
* instead of defaulting to the first-registered one. */
|
|
46644
|
-
addonId: string(),
|
|
46645
|
-
/** Human-readable name (operator-chosen at add-time). */
|
|
46646
|
-
name: string(),
|
|
46647
|
-
/** Provider-defined kind tag — `mqtt` / `home-assistant` / future. */
|
|
46648
|
-
kind: string(),
|
|
46649
|
-
status: BrokerStatusEnum,
|
|
46650
|
-
/** Free-form provider-specific info (HA version, MQTT broker
|
|
46651
|
-
* flavour, latency, mTLS active, …). */
|
|
46652
|
-
info: record(string(), unknown()),
|
|
46653
|
-
/** Ms epoch of the last connection probe / status update. */
|
|
46654
|
-
lastCheckedAt: number().nullable(),
|
|
46655
|
-
/** Last error message, when `status` indicates failure. */
|
|
46656
|
-
error: string().nullable()
|
|
46657
|
-
});
|
|
46658
46997
|
var RegistryStatusSchema = object({
|
|
46659
46998
|
brokerCount: number().int().nonnegative(),
|
|
46660
46999
|
connectedCount: number().int().nonnegative()
|
|
46661
47000
|
});
|
|
46662
|
-
/**
|
|
46663
|
-
* One entry per `broker` provider — which addon provides which broker
|
|
46664
|
-
* kind(s). The unified create picker reads this to know, for each
|
|
46665
|
-
* (addonId, kind) pair the operator can pick, where to route the
|
|
46666
|
-
* follow-up `getSettingsSchema` / `testSettings` / `add` calls (via the
|
|
46667
|
-
* `{ addonId }` selector). A provider only advertises a kind here when
|
|
46668
|
-
* it implements `getSettingsSchema` for that kind (so the picker never
|
|
46669
|
-
* offers a kind whose creation form can't be rendered).
|
|
46670
|
-
*/
|
|
46671
|
-
var BrokerProviderInfoSchema = object({
|
|
46672
|
-
/** Addon id of the `broker` provider this entry describes. */
|
|
46673
|
-
addonId: string(),
|
|
46674
|
-
/** Broker kinds this provider can create, with a display label. */
|
|
46675
|
-
kinds: array(object({
|
|
46676
|
-
kind: string(),
|
|
46677
|
-
label: string(),
|
|
46678
|
-
/**
|
|
46679
|
-
* Relative hub path to start an interactive account link (OAuth popup).
|
|
46680
|
-
* May include `{{brokerId}}`; admin-ui substitutes and appends `?popup=1`.
|
|
46681
|
-
*/
|
|
46682
|
-
interactiveConnectPath: string().min(1).optional(),
|
|
46683
|
-
/** Relative hub path to disconnect the linked account (same popup pattern). */
|
|
46684
|
-
interactiveDisconnectPath: string().min(1).optional(),
|
|
46685
|
-
/**
|
|
46686
|
-
* The kind signs in through a server-held interactive session instead of
|
|
46687
|
-
* (or before) typed credentials. `basePath` is a hub-relative route set
|
|
46688
|
-
* served by the owning addon (`/addon/<id>/...`) speaking the sign-in
|
|
46689
|
-
* contract: `POST {basePath}/start` (body: the form's settings) answers
|
|
46690
|
-
* `{ sessionId, loginUrl }`; `GET {basePath}/status?sessionId=` answers
|
|
46691
|
-
* `{ phase: 'starting' | 'awaiting-login' | 'captured' | 'error' |
|
|
46692
|
-
* 'cancelled', loginUrl, error }`; `POST {basePath}/commit`
|
|
46693
|
-
* (`{ sessionId, name, brokerId? }`) stores the credentials on a new or
|
|
46694
|
-
* existing broker and answers `{ brokerId }`; `POST {basePath}/cancel`
|
|
46695
|
-
* (`{ sessionId }`) drops the session. The dialog that edits a broker
|
|
46696
|
-
* offers it as the default path; the fields the session fills are
|
|
46697
|
-
* marked `filledBySignIn` in the kind's settings schema.
|
|
46698
|
-
*
|
|
46699
|
-
* `methods` lists the ways the session can sign in, recommended first:
|
|
46700
|
-
* `'device-code'` adds `POST {basePath}/code/start` (body: the form's
|
|
46701
|
-
* settings) answering `{ sessionId, userCode, verificationUrl,
|
|
46702
|
-
* expiresAt }` — the operator types `userCode` at `verificationUrl` on
|
|
46703
|
-
* any device, and the same `status` / `commit` / `cancel` routes follow
|
|
46704
|
-
* (status then carries `method`, `userCode`, `verificationUrl`,
|
|
46705
|
-
* `expiresAt` and the phases `'awaiting-code'` / `'expired'`);
|
|
46706
|
-
* `'proxy'` is the `{basePath}/start` flow above. Absent means
|
|
46707
|
-
* `['proxy']`.
|
|
46708
|
-
*/
|
|
46709
|
-
signIn: object({
|
|
46710
|
-
basePath: string().min(1),
|
|
46711
|
-
methods: array(_enum(["device-code", "proxy"])).optional()
|
|
46712
|
-
}).optional()
|
|
46713
|
-
}))
|
|
46714
|
-
});
|
|
46715
|
-
var ListInputSchema = object({
|
|
46716
|
-
/** Optional kind filter — `list({kind:'home-assistant'})` returns
|
|
46717
|
-
* only HA brokers. Omit to list every broker. */
|
|
46718
|
-
kind: string().optional() });
|
|
46719
47001
|
var GetInputSchema = object({ id: string() });
|
|
46720
|
-
var AddInputSchema = object({
|
|
46721
|
-
kind: string().min(1),
|
|
46722
|
-
name: string().min(1),
|
|
46723
|
-
/**
|
|
46724
|
-
* ADOPT an existing id instead of minting a new one.
|
|
46725
|
-
*
|
|
46726
|
-
* Written the day this cost an outage. A broker's id is not a detail: HA
|
|
46727
|
-
* devices carry it inside their `stableId` (`ha:ha_004:dev:…`), so a broker
|
|
46728
|
-
* lost from config and re-added as `ha_001` leaves every one of its devices
|
|
46729
|
-
* bound to a broker that no longer exists. Re-entering the password under the
|
|
46730
|
-
* ORIGINAL id turns a multi-step device migration back into re-entering a
|
|
46731
|
-
* password.
|
|
46732
|
-
*
|
|
46733
|
-
* A provider MUST refuse an id that is already in use — adopting a live
|
|
46734
|
-
* broker's id would silently take it over.
|
|
46735
|
-
*/
|
|
46736
|
-
id: string().min(1).optional(),
|
|
46737
|
-
/** Kind-specific settings (e.g. MQTT `{url,username,password}` or HA
|
|
46738
|
-
* `{baseUrl,accessToken}`). Validated by the kind-specific provider
|
|
46739
|
-
* branch on receipt — invalid shape rejects the add. */
|
|
46740
|
-
settings: record(string(), unknown())
|
|
46741
|
-
});
|
|
46742
|
-
var AddResultSchema = object({ id: string() });
|
|
46743
|
-
var RemoveInputSchema = object({ id: string() });
|
|
46744
|
-
var TestConnectionResultSchema = discriminatedUnion("ok", [object({
|
|
46745
|
-
ok: literal(true),
|
|
46746
|
-
latencyMs: number().nonnegative()
|
|
46747
|
-
}), object({
|
|
46748
|
-
ok: literal(false),
|
|
46749
|
-
error: string()
|
|
46750
|
-
})]);
|
|
46751
47002
|
var SettingsRecordSchema$1 = record(string(), unknown());
|
|
46752
|
-
var SettingsSchemaInputSchema = object({ kind: string() });
|
|
46753
|
-
var TestSettingsInputSchema = object({
|
|
46754
|
-
kind: string(),
|
|
46755
|
-
settings: SettingsRecordSchema$1
|
|
46756
|
-
});
|
|
46757
|
-
var TestSettingsResultSchema = discriminatedUnion("ok", [object({
|
|
46758
|
-
ok: literal(true),
|
|
46759
|
-
latencyMs: number().nonnegative().optional()
|
|
46760
|
-
}).strict(), object({
|
|
46761
|
-
ok: literal(false),
|
|
46762
|
-
error: string()
|
|
46763
|
-
})]);
|
|
46764
|
-
var SettingsSchemaResultSchema = unknown().nullable();
|
|
46765
47003
|
var PublishInputSchema = object({
|
|
46766
47004
|
brokerId: string(),
|
|
46767
47005
|
/** Kind-specific routing target.
|
|
@@ -46795,25 +47033,7 @@ var GetStateInputSchema = object({
|
|
|
46795
47033
|
* HA: entity_id (returns the cached entity state). */
|
|
46796
47034
|
key: string()
|
|
46797
47035
|
});
|
|
46798
|
-
method(
|
|
46799
|
-
kind: "mutation",
|
|
46800
|
-
auth: "admin"
|
|
46801
|
-
}), method(RemoveInputSchema, _void(), {
|
|
46802
|
-
kind: "mutation",
|
|
46803
|
-
auth: "admin"
|
|
46804
|
-
}), method(GetInputSchema, TestConnectionResultSchema, {
|
|
46805
|
-
kind: "mutation",
|
|
46806
|
-
auth: "admin"
|
|
46807
|
-
}), method(GetInputSchema, SettingsRecordSchema$1.nullable(), { auth: "admin" }), method(object({
|
|
46808
|
-
id: string(),
|
|
46809
|
-
settings: SettingsRecordSchema$1
|
|
46810
|
-
}), _void(), {
|
|
46811
|
-
kind: "mutation",
|
|
46812
|
-
auth: "admin"
|
|
46813
|
-
}), method(GetInputSchema, SettingsRecordSchema$1.nullable(), { auth: "admin" }), method(SettingsSchemaInputSchema, SettingsSchemaResultSchema, { auth: "admin" }), method(TestSettingsInputSchema, TestSettingsResultSchema, {
|
|
46814
|
-
kind: "mutation",
|
|
46815
|
-
auth: "admin"
|
|
46816
|
-
}), method(PublishInputSchema, unknown(), {
|
|
47036
|
+
method(GetInputSchema, SettingsRecordSchema$1.nullable(), { auth: "admin" }), method(PublishInputSchema, unknown(), {
|
|
46817
47037
|
kind: "mutation",
|
|
46818
47038
|
auth: "admin"
|
|
46819
47039
|
}), method(SubscribeInputSchema, SubscribeResultSchema, {
|
|
@@ -48739,6 +48959,9 @@ var MediaPlayerStatusSchema = object({
|
|
|
48739
48959
|
/** Repeat mode. Null when no repeat surface.
|
|
48740
48960
|
* Pair with `DeviceFeature.MediaPlayerRepeat`. */
|
|
48741
48961
|
repeat: MediaPlayerRepeatSchema.nullable(),
|
|
48962
|
+
/** Ms epoch when `position` was read from the device. Null when the driver
|
|
48963
|
+
* does not say; a UI that advances the position while playing counts from it. */
|
|
48964
|
+
positionUpdatedAt: number().nullable().default(null),
|
|
48742
48965
|
/** Ms epoch when the slice was last updated. */
|
|
48743
48966
|
lastChangedAt: number()
|
|
48744
48967
|
});
|
|
@@ -49318,7 +49541,9 @@ var ThresholdTransformDraftSchema = object({
|
|
|
49318
49541
|
comparison: _enum(["gte", "lte"]),
|
|
49319
49542
|
threshold: number(),
|
|
49320
49543
|
startDwellMs: number().nonnegative(),
|
|
49321
|
-
stopDwellMs: number().nonnegative()
|
|
49544
|
+
stopDwellMs: number().nonnegative(),
|
|
49545
|
+
/** Samples a start needs; absent = the compiler's default for the source (2 for running power, else 1). */
|
|
49546
|
+
minSamples: number().int().min(1).optional()
|
|
49322
49547
|
});
|
|
49323
49548
|
var CustomizeTransformDraftSchema = discriminatedUnion("kind", [
|
|
49324
49549
|
IdentityTransformDraftSchema,
|
|
@@ -50713,12 +50938,12 @@ var deviceExportCapability = {
|
|
|
50713
50938
|
kind: "poll"
|
|
50714
50939
|
},
|
|
50715
50940
|
/**
|
|
50716
|
-
* Each export provider
|
|
50717
|
-
* (enabled toggle, preferred stream, addon-specific knobs
|
|
50718
|
-
*
|
|
50719
|
-
* `
|
|
50720
|
-
* `
|
|
50721
|
-
*
|
|
50941
|
+
* Each export provider MAY contribute its own per-device "Export" panel
|
|
50942
|
+
* (enabled toggle, preferred stream, addon-specific knobs). The three
|
|
50943
|
+
* framework methods are mounted on the cap router when present.
|
|
50944
|
+
* `IDeviceExportProvider` leaves them optional: an exporter with no
|
|
50945
|
+
* per-device panel omits them (a `deviceConfig` cap's UI is derived and
|
|
50946
|
+
* never hand-written — D14 — and an exporter is not one of those).
|
|
50722
50947
|
*/
|
|
50723
50948
|
exposesDeviceSettings: true,
|
|
50724
50949
|
methods: {
|
|
@@ -50934,7 +51159,14 @@ var DiscoveryCandidateSchema = object({
|
|
|
50934
51159
|
/** `stableId` of the gateway candidate this device was found BEHIND. */
|
|
50935
51160
|
parentStableId: string().optional(),
|
|
50936
51161
|
/** `false` = shown for context but not pickable. Default true. */
|
|
50937
|
-
selectable: boolean().optional()
|
|
51162
|
+
selectable: boolean().optional(),
|
|
51163
|
+
/**
|
|
51164
|
+
* Keys of the provider's creation form (`getChildCreationSchema`) this candidate
|
|
51165
|
+
* cannot be adopted without — a key for an encrypted board, a pairing code. The
|
|
51166
|
+
* admin asks for exactly these, on the creation form prefilled with
|
|
51167
|
+
* `prefilledConfig`, before it adopts. Absent or empty = adopt as it is.
|
|
51168
|
+
*/
|
|
51169
|
+
needsParams: array(string()).optional()
|
|
50938
51170
|
});
|
|
50939
51171
|
/**
|
|
50940
51172
|
* Flat device summary returned by `createDevice` / `adoptDiscoveredDevice`.
|
|
@@ -50993,12 +51225,24 @@ method(_void(), _void(), { kind: "mutation" }), method(_void(), _void(), { kind:
|
|
|
50993
51225
|
}), array(DiscoveryCandidateSchema), {
|
|
50994
51226
|
kind: "mutation",
|
|
50995
51227
|
auth: "admin"
|
|
50996
|
-
}), method(object({}), CreationSchemaOutputSchema), method(object({
|
|
51228
|
+
}), method(object({}), CreationSchemaOutputSchema), method(object({
|
|
51229
|
+
/** The integration asked about; a provider whose integrations differ answers per one. */
|
|
51230
|
+
integrationId: string().optional() }), object({ deviceType: _enum(DeviceType).nullable() })), method(object({
|
|
51231
|
+
candidate: DiscoveryCandidateSchema,
|
|
51232
|
+
/** The integration the operator adopts into; a provider with several instances needs it. */
|
|
51233
|
+
integrationId: string().optional()
|
|
51234
|
+
}), DeviceSummarySchema, {
|
|
50997
51235
|
kind: "mutation",
|
|
50998
51236
|
auth: "admin"
|
|
50999
|
-
}), method(object({}), boolean()), method(object({
|
|
51237
|
+
}), method(object({}), boolean()), method(object({
|
|
51000
51238
|
type: _enum(DeviceType),
|
|
51001
|
-
|
|
51239
|
+
/** The integration asked about; a provider whose integrations differ answers per one. */
|
|
51240
|
+
integrationId: string().optional()
|
|
51241
|
+
}), CreationSchemaOutputSchema), method(object({
|
|
51242
|
+
type: _enum(DeviceType),
|
|
51243
|
+
config: record(string(), unknown()),
|
|
51244
|
+
/** The integration the operator adds the device to; a provider with several instances needs it. */
|
|
51245
|
+
integrationId: string().optional()
|
|
51002
51246
|
}), DeviceSummarySchema, {
|
|
51003
51247
|
kind: "mutation",
|
|
51004
51248
|
auth: "admin"
|
|
@@ -51708,7 +51952,10 @@ method(object({
|
|
|
51708
51952
|
auth: "admin"
|
|
51709
51953
|
}), method(object({
|
|
51710
51954
|
addonId: string(),
|
|
51711
|
-
type: _enum(DeviceType)
|
|
51955
|
+
type: _enum(DeviceType),
|
|
51956
|
+
/** The integration the form is for; a provider whose integrations differ (a hub
|
|
51957
|
+
* integration takes no manual add) answers per integration. Absent = the addon's own. */
|
|
51958
|
+
integrationId: string().optional()
|
|
51712
51959
|
}), unknown().nullable()), method(object({
|
|
51713
51960
|
addonId: string(),
|
|
51714
51961
|
type: _enum(DeviceType),
|
|
@@ -51792,7 +52039,11 @@ method(object({
|
|
|
51792
52039
|
kind: "mutation",
|
|
51793
52040
|
auth: "admin",
|
|
51794
52041
|
timeoutMs: 12e4
|
|
51795
|
-
}), method(object({
|
|
52042
|
+
}), method(object({
|
|
52043
|
+
addonId: string(),
|
|
52044
|
+
/** The integration the Add-Device dialog is open on; absent = the addon's own. */
|
|
52045
|
+
integrationId: string().optional()
|
|
52046
|
+
}), object({ deviceType: _enum(DeviceType).nullable() }), { auth: "admin" }), method(object({ addonId: string() }), unknown(), { auth: "admin" }), method(object({
|
|
51796
52047
|
deviceId: number(),
|
|
51797
52048
|
key: string(),
|
|
51798
52049
|
value: unknown()
|
|
@@ -54302,6 +54553,7 @@ var IntegrationWithStateSchema = object({
|
|
|
54302
54553
|
id: string(),
|
|
54303
54554
|
addonId: string(),
|
|
54304
54555
|
name: string(),
|
|
54556
|
+
/** A projection of the instance body's switch (`setInstanceEnabled` is the only writer). */
|
|
54305
54557
|
enabled: boolean(),
|
|
54306
54558
|
info: record(string(), unknown()).readonly(),
|
|
54307
54559
|
/** The discovery candidate this integration was set up from (D984). */
|
|
@@ -54314,6 +54566,7 @@ var IntegrationLiteSchema = object({
|
|
|
54314
54566
|
id: string(),
|
|
54315
54567
|
addonId: string(),
|
|
54316
54568
|
name: string(),
|
|
54569
|
+
/** A projection of the instance body's switch (`setInstanceEnabled` is the only writer). */
|
|
54317
54570
|
enabled: boolean(),
|
|
54318
54571
|
info: record(string(), unknown()).readonly(),
|
|
54319
54572
|
/** The discovery candidate this integration was set up from (D984). */
|
|
@@ -54396,7 +54649,7 @@ var TestConnectionStatusEnum = _enum([
|
|
|
54396
54649
|
"inconclusive",
|
|
54397
54650
|
"unsupported"
|
|
54398
54651
|
]);
|
|
54399
|
-
var TestConnectionResultSchema
|
|
54652
|
+
var TestConnectionResultSchema = object({
|
|
54400
54653
|
/** True ONLY for `validated`. Never true for a test that did not run. */
|
|
54401
54654
|
success: boolean(),
|
|
54402
54655
|
error: string().optional(),
|
|
@@ -54413,19 +54666,19 @@ var TestConnectionResultSchema$1 = object({
|
|
|
54413
54666
|
var CreateIntegrationInputSchema = object({
|
|
54414
54667
|
addonId: string(),
|
|
54415
54668
|
name: string(),
|
|
54416
|
-
enabled: boolean().optional(),
|
|
54417
54669
|
info: record(string(), unknown()).optional(),
|
|
54418
54670
|
/** `stableId` of the discovery candidate the form was seeded from (D984). */
|
|
54419
54671
|
originStableId: string().optional(),
|
|
54420
|
-
settings: record(string(), unknown()).optional()
|
|
54421
|
-
/** Keys of `settings` the form's schema declares secret (by type) — kept in
|
|
54422
|
-
* the keychain, not the table (D787). */
|
|
54423
|
-
secretKeys: array(string()).optional(),
|
|
54424
|
-
skipRestart: boolean().optional()
|
|
54672
|
+
settings: record(string(), unknown()).optional()
|
|
54425
54673
|
});
|
|
54426
54674
|
var UpdateIntegrationInputSchema = object({
|
|
54427
54675
|
id: string(),
|
|
54428
54676
|
name: string().optional(),
|
|
54677
|
+
/**
|
|
54678
|
+
* Accepted for a FIXED builtin only (`info.fixed`: alarm panel, camera grid, core blocks,
|
|
54679
|
+
* terminal), which keeps no instance record: the registry flag is its one store. Any other
|
|
54680
|
+
* integration is switched through `integration-instances.setInstanceEnabled`.
|
|
54681
|
+
*/
|
|
54429
54682
|
enabled: boolean().optional(),
|
|
54430
54683
|
info: record(string(), unknown()).optional()
|
|
54431
54684
|
});
|
|
@@ -54442,26 +54695,10 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
|
|
|
54442
54695
|
}), method(object({ id: string() }), DeleteIntegrationResultSchema, {
|
|
54443
54696
|
kind: "mutation",
|
|
54444
54697
|
auth: "admin"
|
|
54445
|
-
}), method(object({ id: string() }), record(string(), unknown()), { auth: "admin" }), method(object({
|
|
54446
|
-
id: string(),
|
|
54447
|
-
settings: record(string(), unknown()),
|
|
54448
|
-
/** Keys the form's schema declares secret (by type) — keychain-stored (D787). */
|
|
54449
|
-
secretKeys: array(string()).optional(),
|
|
54450
|
-
/** The integration's own addon applies the change in-process and asks the hub not to respawn it. */
|
|
54451
|
-
skipRestart: boolean().optional()
|
|
54452
|
-
}), object({ success: boolean() }), {
|
|
54453
|
-
kind: "mutation",
|
|
54454
|
-
auth: "admin"
|
|
54455
|
-
}), method(object({ id: string() }), object({
|
|
54456
|
-
rows: number().int().nonnegative(),
|
|
54457
|
-
secrets: number().int().nonnegative()
|
|
54458
|
-
}), {
|
|
54459
|
-
kind: "mutation",
|
|
54460
|
-
auth: "admin"
|
|
54461
54698
|
}), method(_void(), array(AvailableIntegrationTypeSchema), { auth: "admin" }), method(object({
|
|
54462
54699
|
addonId: string(),
|
|
54463
54700
|
settings: record(string(), unknown())
|
|
54464
|
-
}), TestConnectionResultSchema
|
|
54701
|
+
}), TestConnectionResultSchema, {
|
|
54465
54702
|
kind: "mutation",
|
|
54466
54703
|
auth: "admin"
|
|
54467
54704
|
});
|
|
@@ -54488,6 +54725,14 @@ var ConfigSchemaPassthrough$3 = custom();
|
|
|
54488
54725
|
var IntegrationInstanceIdSchema = string().min(1);
|
|
54489
54726
|
var IntegrationInstanceModeSchema = _enum(["single", "multiple"]);
|
|
54490
54727
|
/**
|
|
54728
|
+
* What the addon's instances ARE for the Integrations page (planning#416). `devices`: each
|
|
54729
|
+
* instance is an integration that brings devices (its record body owns the on/off switch);
|
|
54730
|
+
* `services`: a connection configured from the addon's own function page, never listed on
|
|
54731
|
+
* Integrations.
|
|
54732
|
+
* It is the same vocabulary as the manifest's `integrationRole`, which stays as an override.
|
|
54733
|
+
*/
|
|
54734
|
+
var IntegrationInstanceRoleSchema = _enum(["devices", "services"]);
|
|
54735
|
+
/**
|
|
54491
54736
|
* One kind of instance a provider can create (an adapter, an account type). The sign-in and
|
|
54492
54737
|
* connect fields follow the `broker` contract (`broker.cap.ts`): `signIn.basePath` is a
|
|
54493
54738
|
* hub-relative route set speaking the sign-in contract, `connectPath` / `disconnectPath` open an
|
|
@@ -54498,6 +54743,22 @@ var IntegrationInstanceKindSchema = object({
|
|
|
54498
54743
|
/** Stable id of the kind, sent back as `createInstance.kind`. */
|
|
54499
54744
|
id: string().min(1),
|
|
54500
54745
|
label: string().min(1),
|
|
54746
|
+
/**
|
|
54747
|
+
* The function capability this kind is configured for (`broker`, `smtp-provider`,
|
|
54748
|
+
* `device-provider`, ...). A page section is the kinds whose `functionCap` it names (D1013); a
|
|
54749
|
+
* provider with more than one section must name it on every kind.
|
|
54750
|
+
*/
|
|
54751
|
+
functionCap: string().min(1),
|
|
54752
|
+
/**
|
|
54753
|
+
* For `functionCap: 'broker'`: the registry kind of the broker an instance of this kind is
|
|
54754
|
+
* (`matter`, `home-assistant`, ...). A caller that needs a broker of one kind (a link field)
|
|
54755
|
+
* finds the instances whose kind names it; absent takes the kind `id`.
|
|
54756
|
+
*/
|
|
54757
|
+
brokerKind: string().min(1).optional(),
|
|
54758
|
+
/** What instances of this kind are for the Integrations page; absent takes the provider's `role`. */
|
|
54759
|
+
role: IntegrationInstanceRoleSchema.optional(),
|
|
54760
|
+
/** `testInstance` really probes the remote for this kind; absent takes the provider's `canTest`. */
|
|
54761
|
+
canTest: boolean().optional(),
|
|
54501
54762
|
/** The kind signs in through a server-held interactive session. */
|
|
54502
54763
|
signIn: object({
|
|
54503
54764
|
basePath: string().min(1),
|
|
@@ -54508,22 +54769,38 @@ var IntegrationInstanceKindSchema = object({
|
|
|
54508
54769
|
/** Relative hub path to disconnect that account. */
|
|
54509
54770
|
disconnectPath: string().min(1).optional()
|
|
54510
54771
|
});
|
|
54772
|
+
/**
|
|
54773
|
+
* How devices of an instance are found. `none`: the operator adds them by hand; `lan`: the addon
|
|
54774
|
+
* scans the network before any instance exists (the wizard offers the candidates); `account`: the
|
|
54775
|
+
* devices appear after the instance signs in. `scopedToInstance`: a discovery run belongs to ONE
|
|
54776
|
+
* instance and its candidates are claimed by it.
|
|
54777
|
+
*/
|
|
54778
|
+
var IntegrationInstanceDiscoverySchema = object({
|
|
54779
|
+
mode: _enum([
|
|
54780
|
+
"none",
|
|
54781
|
+
"lan",
|
|
54782
|
+
"account"
|
|
54783
|
+
]),
|
|
54784
|
+
scopedToInstance: boolean()
|
|
54785
|
+
});
|
|
54786
|
+
/**
|
|
54787
|
+
* One link a kind of this provider declares (D1013 rule 5): the body `field` of an instance of
|
|
54788
|
+
* `kind` holds the id of an instance of the function cap `to.cap` (of kind `to.kind`, when set).
|
|
54789
|
+
* The hub indexes these so the target's delete is refused while a link names it.
|
|
54790
|
+
*/
|
|
54791
|
+
var IntegrationInstanceLinkSchema = object({
|
|
54792
|
+
kind: string().min(1),
|
|
54793
|
+
field: string().min(1),
|
|
54794
|
+
to: object({
|
|
54795
|
+
cap: string().min(1),
|
|
54796
|
+
kind: string().min(1).optional()
|
|
54797
|
+
})
|
|
54798
|
+
});
|
|
54511
54799
|
var IntegrationInstanceDescriptionSchema = object({
|
|
54512
54800
|
/** What the instances are for the Integrations page; see {@link IntegrationInstanceRoleSchema}. */
|
|
54513
|
-
role:
|
|
54514
|
-
"devices",
|
|
54515
|
-
"services",
|
|
54516
|
-
"both"
|
|
54517
|
-
]),
|
|
54801
|
+
role: IntegrationInstanceRoleSchema,
|
|
54518
54802
|
/** How the devices of an instance are found; absent means `{ mode: 'none' }`. */
|
|
54519
|
-
discovery:
|
|
54520
|
-
mode: _enum([
|
|
54521
|
-
"none",
|
|
54522
|
-
"lan",
|
|
54523
|
-
"account"
|
|
54524
|
-
]),
|
|
54525
|
-
scopedToInstance: boolean()
|
|
54526
|
-
}).optional(),
|
|
54803
|
+
discovery: IntegrationInstanceDiscoverySchema.optional(),
|
|
54527
54804
|
/** `single`: at most one instance can exist (Loki). `multiple`: an account each. */
|
|
54528
54805
|
instanceMode: IntegrationInstanceModeSchema,
|
|
54529
54806
|
/** What the instance is, for the UI (`destination`, `relay`, `account`). */
|
|
@@ -54544,7 +54821,9 @@ var IntegrationInstanceDescriptionSchema = object({
|
|
|
54544
54821
|
* `createInstance` without an `id` works: the provider mints it. Absent means the caller must
|
|
54545
54822
|
* send an id (the UI then mints an opaque one).
|
|
54546
54823
|
*/
|
|
54547
|
-
mintsId: boolean().optional()
|
|
54824
|
+
mintsId: boolean().optional(),
|
|
54825
|
+
/** The links to other instances the provider's kinds declare; absent means none. */
|
|
54826
|
+
links: array(IntegrationInstanceLinkSchema).optional()
|
|
54548
54827
|
});
|
|
54549
54828
|
var IntegrationInstanceStatusSchema = object({
|
|
54550
54829
|
state: _enum([
|
|
@@ -54564,8 +54843,8 @@ var IntegrationInstanceSchema = object({
|
|
|
54564
54843
|
configured: boolean(),
|
|
54565
54844
|
/**
|
|
54566
54845
|
* The instance's own on/off switch (D996), derived from the record body (`enabled !== false`,
|
|
54567
|
-
* so a row written before the field existed is on).
|
|
54568
|
-
*
|
|
54846
|
+
* so a row written before the field existed is on). The same for every role, `devices` included:
|
|
54847
|
+
* the body is the one store, `setInstanceEnabled` the one writer (epic #440, step 3).
|
|
54569
54848
|
*/
|
|
54570
54849
|
enabled: boolean().optional(),
|
|
54571
54850
|
/** The kind of this instance (one of `describe().kinds[].id`), when the provider has kinds. */
|
|
@@ -54589,7 +54868,11 @@ var integrationInstancesCapability = {
|
|
|
54589
54868
|
methods: {
|
|
54590
54869
|
describe: method(_void(), IntegrationInstanceDescriptionSchema, { auth: "admin" }),
|
|
54591
54870
|
/** The form; `id: null` is the create form. */
|
|
54592
|
-
instanceFormSchema: method(object({
|
|
54871
|
+
instanceFormSchema: method(object({
|
|
54872
|
+
id: IntegrationInstanceIdSchema.nullable(),
|
|
54873
|
+
/** The kind of the create form (`id: null`) of a provider with several. */
|
|
54874
|
+
kind: string().min(1).optional()
|
|
54875
|
+
}), ConfigSchemaPassthrough$3, { auth: "admin" }),
|
|
54593
54876
|
listInstances: method(_void(), array(IntegrationInstanceSchema).readonly(), { auth: "admin" }),
|
|
54594
54877
|
getInstance: method(object({ id: IntegrationInstanceIdSchema }), IntegrationInstanceSchema.nullable(), { auth: "admin" }),
|
|
54595
54878
|
/**
|
|
@@ -54599,7 +54882,9 @@ var integrationInstancesCapability = {
|
|
|
54599
54882
|
createInstance: method(object({
|
|
54600
54883
|
id: IntegrationInstanceIdSchema.optional(),
|
|
54601
54884
|
name: string().min(1),
|
|
54602
|
-
kind: string().min(1).optional()
|
|
54885
|
+
kind: string().min(1).optional(),
|
|
54886
|
+
/** Form values written with the record (a link picked in the create dialog). */
|
|
54887
|
+
values: record(string(), unknown()).optional()
|
|
54603
54888
|
}), object({ id: string() }), {
|
|
54604
54889
|
kind: "mutation",
|
|
54605
54890
|
auth: "admin"
|
|
@@ -54609,7 +54894,8 @@ var integrationInstancesCapability = {
|
|
|
54609
54894
|
auth: "admin"
|
|
54610
54895
|
}),
|
|
54611
54896
|
/**
|
|
54612
|
-
* Switch ONE instance on or off
|
|
54897
|
+
* Switch ONE instance on or off, for every role; a missing record is created from the addon's
|
|
54898
|
+
* initial body. A row control, not a form field: `updateInstance.values` is the
|
|
54613
54899
|
* form patch (D62, D996). An off instance keeps its record and secrets and does no work.
|
|
54614
54900
|
*/
|
|
54615
54901
|
setInstanceEnabled: method(object({
|
|
@@ -54626,8 +54912,10 @@ var integrationInstancesCapability = {
|
|
|
54626
54912
|
}),
|
|
54627
54913
|
testInstance: optionalMethod(object({
|
|
54628
54914
|
id: IntegrationInstanceIdSchema.nullable(),
|
|
54629
|
-
values: record(string(), unknown())
|
|
54630
|
-
|
|
54915
|
+
values: record(string(), unknown()),
|
|
54916
|
+
/** The kind to test when `id` is null and the provider has several. */
|
|
54917
|
+
kind: string().min(1).optional()
|
|
54918
|
+
}), TestConnectionResultSchema, {
|
|
54631
54919
|
kind: "mutation",
|
|
54632
54920
|
auth: "admin"
|
|
54633
54921
|
})
|
|
@@ -57132,6 +57420,382 @@ var SystemMetricsSchema = object({
|
|
|
57132
57420
|
gpuMemoryPercent: number().optional()
|
|
57133
57421
|
});
|
|
57134
57422
|
method(_void(), SystemResourceSnapshotSchema), method(_void(), SystemResourceSnapshotSchema.nullable()), method(_void(), SystemMetricsSchema), method(object({ dirPath: string() }), DiskSpaceInfoSchema), method(_void(), MetricsGpuInfoSchema.nullable()), method(_void(), number().nullable()), method(object({ pids: array(number()) }), array(PidResourceStatsSchema)), method(_void(), array(AddonInstanceSchema).readonly()), method(object({ addonId: string() }), PidResourceStatsSchema.nullable()), method(_void(), array(NodeProcessSchema).readonly()), method(GetLoadSeriesInputSchema, NodeLoadSeriesSchema);
|
|
57423
|
+
/**
|
|
57424
|
+
* records - an addon's own facts and documents (D881): ledgers, audit rows,
|
|
57425
|
+
* config documents, mirrors. The third storage API next to `ctx.settings`
|
|
57426
|
+
* (operator intent, D870) and device-history (numbers over time, D850).
|
|
57427
|
+
*
|
|
57428
|
+
* Who the OWNER is: `callerAddonId`, stamped by the transport on a call that
|
|
57429
|
+
* crossed a process and stated by a hub in-process caller (`ctx.records` does
|
|
57430
|
+
* that with the addon id closed over). It is deliberately NOT in any input
|
|
57431
|
+
* schema, so a session can never supply it, and a call with no stamp is refused
|
|
57432
|
+
* `records/no-caller`. A kind is readable and writable only by its owner; other
|
|
57433
|
+
* addons go through the owner's capability.
|
|
57434
|
+
*
|
|
57435
|
+
* Every read is three-way: a row, `null`, or the call THROWS. A failed read is
|
|
57436
|
+
* never `[]`. Secret fields are never on the wire: a read shows the
|
|
57437
|
+
* redaction token, `secretRefs` hands the owner's `ctx.secrets` the refs it
|
|
57438
|
+
* resolves itself, and a write may carry only a keychain marker bound to the
|
|
57439
|
+
* row's own ref.
|
|
57440
|
+
*
|
|
57441
|
+
* Internal: addons reach it through `ctx.records`, never directly.
|
|
57442
|
+
*/
|
|
57443
|
+
var RecordIdSchema = string().min(1).max(256);
|
|
57444
|
+
/** A JSON object body. Size is the engine's check (`maxDataBytes`), not a schema's. */
|
|
57445
|
+
var RecordBodySchema = record(string(), unknown());
|
|
57446
|
+
var RecordInputSchema = object({
|
|
57447
|
+
id: RecordIdSchema,
|
|
57448
|
+
/** The device this row belongs to (D865 removal, per-device reads). */
|
|
57449
|
+
deviceId: number().int().optional(),
|
|
57450
|
+
/** The domain clock, ms: observed / created / opened. */
|
|
57451
|
+
at: number().int().optional(),
|
|
57452
|
+
/** Producer-set expiry, ms. Refused on a kind whose retention is an engine TTL. */
|
|
57453
|
+
expiresAt: number().int().optional(),
|
|
57454
|
+
data: RecordBodySchema
|
|
57455
|
+
});
|
|
57456
|
+
var RecordViewSchema = object({
|
|
57457
|
+
id: string(),
|
|
57458
|
+
deviceId: number().int().nullable(),
|
|
57459
|
+
at: number().nullable(),
|
|
57460
|
+
expiresAt: number().nullable(),
|
|
57461
|
+
rev: number().int(),
|
|
57462
|
+
updatedAt: number(),
|
|
57463
|
+
data: RecordBodySchema
|
|
57464
|
+
});
|
|
57465
|
+
/** Declared index fields only. Anything else does not compile, by design. */
|
|
57466
|
+
var RecordWhereSchema = record(RecordFieldPathSchema, union([
|
|
57467
|
+
string(),
|
|
57468
|
+
number(),
|
|
57469
|
+
boolean(),
|
|
57470
|
+
object({ in: array(union([
|
|
57471
|
+
string(),
|
|
57472
|
+
number(),
|
|
57473
|
+
boolean()
|
|
57474
|
+
])).min(1).max(RECORD_BATCH_MAX) }),
|
|
57475
|
+
object({
|
|
57476
|
+
gt: union([string(), number()]).optional(),
|
|
57477
|
+
gte: union([string(), number()]).optional(),
|
|
57478
|
+
lt: union([string(), number()]).optional(),
|
|
57479
|
+
lte: union([string(), number()]).optional()
|
|
57480
|
+
}).refine((r) => Object.keys(r).length > 0, { message: "name at least one bound" })
|
|
57481
|
+
]));
|
|
57482
|
+
var KindShape = { kind: RecordKindNameSchema };
|
|
57483
|
+
var TimeWindowShape = {
|
|
57484
|
+
deviceId: number().int().optional(),
|
|
57485
|
+
atFrom: number().optional(),
|
|
57486
|
+
atTo: number().optional()
|
|
57487
|
+
};
|
|
57488
|
+
var RecordQueryInputSchema = object({
|
|
57489
|
+
...KindShape,
|
|
57490
|
+
...TimeWindowShape,
|
|
57491
|
+
where: RecordWhereSchema.optional(),
|
|
57492
|
+
/** Without `where`: `at` (default for a kind with a clock) or `id`. With `where` the order is the index's. */
|
|
57493
|
+
order: _enum(["at", "id"]).optional(),
|
|
57494
|
+
desc: boolean().optional(),
|
|
57495
|
+
limit: number().int().min(1).max(RECORD_QUERY_MAX).default(100),
|
|
57496
|
+
/** Opaque keyset cursor from a previous answer. There is no offset. */
|
|
57497
|
+
cursor: string().min(1).optional()
|
|
57498
|
+
});
|
|
57499
|
+
var RecordQueryResultSchema = object({
|
|
57500
|
+
records: array(RecordViewSchema),
|
|
57501
|
+
nextCursor: string().nullable()
|
|
57502
|
+
});
|
|
57503
|
+
var RecordKindStateSchema = _enum([
|
|
57504
|
+
"created",
|
|
57505
|
+
"unchanged",
|
|
57506
|
+
"updated"
|
|
57507
|
+
]);
|
|
57508
|
+
var DeclareKindResultSchema = object({
|
|
57509
|
+
kindId: number().int(),
|
|
57510
|
+
state: RecordKindStateSchema,
|
|
57511
|
+
createdIndexes: array(string())
|
|
57512
|
+
});
|
|
57513
|
+
/** Keychain refs a write released (the old marker is gone from the row): the owner deletes the values. */
|
|
57514
|
+
var SecretRefsList = array(string());
|
|
57515
|
+
/**
|
|
57516
|
+
* One op of a `transact`: the single-row writes, each on a kind of the caller.
|
|
57517
|
+
* All ops of one call share ONE database file and ONE `transactFamily`.
|
|
57518
|
+
*/
|
|
57519
|
+
var RecordTransactOpSchema = discriminatedUnion("op", [
|
|
57520
|
+
object({
|
|
57521
|
+
op: literal("put"),
|
|
57522
|
+
kind: RecordKindNameSchema,
|
|
57523
|
+
record: RecordInputSchema,
|
|
57524
|
+
ifRev: number().int().min(0).optional()
|
|
57525
|
+
}),
|
|
57526
|
+
object({
|
|
57527
|
+
op: literal("patch"),
|
|
57528
|
+
kind: RecordKindNameSchema,
|
|
57529
|
+
id: RecordIdSchema,
|
|
57530
|
+
data: RecordBodySchema,
|
|
57531
|
+
at: number().int().nullable().optional(),
|
|
57532
|
+
expiresAt: number().int().nullable().optional(),
|
|
57533
|
+
ifRev: number().int().min(1).optional()
|
|
57534
|
+
}),
|
|
57535
|
+
object({
|
|
57536
|
+
op: literal("delete"),
|
|
57537
|
+
kind: RecordKindNameSchema,
|
|
57538
|
+
id: RecordIdSchema
|
|
57539
|
+
})
|
|
57540
|
+
]);
|
|
57541
|
+
var RecordSecretRefsSchema = record(string(), record(string(), string()));
|
|
57542
|
+
method(object({ kinds: record(RecordKindNameSchema, RecordKindDeclarationSchema) }), object({ kinds: record(string(), DeclareKindResultSchema) }), {
|
|
57543
|
+
kind: "mutation",
|
|
57544
|
+
auth: "admin"
|
|
57545
|
+
}), method(object({
|
|
57546
|
+
...KindShape,
|
|
57547
|
+
id: RecordIdSchema
|
|
57548
|
+
}), RecordViewSchema.nullable(), { auth: "admin" }), method(object({
|
|
57549
|
+
...KindShape,
|
|
57550
|
+
ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
|
|
57551
|
+
}), array(RecordViewSchema), { auth: "admin" }), method(object({
|
|
57552
|
+
...KindShape,
|
|
57553
|
+
ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
|
|
57554
|
+
}), RecordSecretRefsSchema, { auth: "admin" }), method(object({
|
|
57555
|
+
...KindShape,
|
|
57556
|
+
record: RecordInputSchema,
|
|
57557
|
+
/** Compare-and-set. `0` means "the row must not exist". */
|
|
57558
|
+
ifRev: number().int().min(0).optional()
|
|
57559
|
+
}), object({
|
|
57560
|
+
rev: number().int(),
|
|
57561
|
+
releasedRefs: SecretRefsList
|
|
57562
|
+
}), {
|
|
57563
|
+
kind: "mutation",
|
|
57564
|
+
auth: "admin"
|
|
57565
|
+
}), method(object({
|
|
57566
|
+
...KindShape,
|
|
57567
|
+
records: array(RecordInputSchema).min(1).max(RECORD_BATCH_MAX)
|
|
57568
|
+
}), object({
|
|
57569
|
+
count: number().int(),
|
|
57570
|
+
releasedRefs: SecretRefsList
|
|
57571
|
+
}), {
|
|
57572
|
+
kind: "mutation",
|
|
57573
|
+
auth: "admin"
|
|
57574
|
+
}), method(object({
|
|
57575
|
+
...KindShape,
|
|
57576
|
+
id: RecordIdSchema,
|
|
57577
|
+
data: RecordBodySchema,
|
|
57578
|
+
at: number().int().nullable().optional(),
|
|
57579
|
+
expiresAt: number().int().nullable().optional(),
|
|
57580
|
+
ifRev: number().int().min(1).optional()
|
|
57581
|
+
}), object({
|
|
57582
|
+
rev: number().int(),
|
|
57583
|
+
releasedRefs: SecretRefsList
|
|
57584
|
+
}), {
|
|
57585
|
+
kind: "mutation",
|
|
57586
|
+
auth: "admin"
|
|
57587
|
+
}), method(object({
|
|
57588
|
+
...KindShape,
|
|
57589
|
+
id: RecordIdSchema
|
|
57590
|
+
}), object({
|
|
57591
|
+
deleted: boolean(),
|
|
57592
|
+
secretRefs: SecretRefsList
|
|
57593
|
+
}), {
|
|
57594
|
+
kind: "mutation",
|
|
57595
|
+
auth: "admin"
|
|
57596
|
+
}), method(object({
|
|
57597
|
+
...KindShape,
|
|
57598
|
+
ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
|
|
57599
|
+
}), object({
|
|
57600
|
+
deleted: number().int(),
|
|
57601
|
+
secretRefs: SecretRefsList
|
|
57602
|
+
}), {
|
|
57603
|
+
kind: "mutation",
|
|
57604
|
+
auth: "admin"
|
|
57605
|
+
}), method(RecordQueryInputSchema, RecordQueryResultSchema, { auth: "admin" }), method(object({
|
|
57606
|
+
...KindShape,
|
|
57607
|
+
...TimeWindowShape,
|
|
57608
|
+
where: RecordWhereSchema.optional()
|
|
57609
|
+
}), object({ count: number().int() }), { auth: "admin" }), method(object({
|
|
57610
|
+
...KindShape,
|
|
57611
|
+
deviceId: number().int().optional(),
|
|
57612
|
+
from: number(),
|
|
57613
|
+
to: number(),
|
|
57614
|
+
bucketMs: number().int().positive()
|
|
57615
|
+
}), object({ buckets: array(object({
|
|
57616
|
+
bucketStart: number(),
|
|
57617
|
+
count: number().int()
|
|
57618
|
+
})) }), { auth: "admin" }), method(object({
|
|
57619
|
+
...KindShape,
|
|
57620
|
+
op: _enum([
|
|
57621
|
+
"sum",
|
|
57622
|
+
"min",
|
|
57623
|
+
"max",
|
|
57624
|
+
"count"
|
|
57625
|
+
]),
|
|
57626
|
+
field: RecordFieldPathSchema.optional(),
|
|
57627
|
+
groupBy: RecordFieldPathSchema.optional(),
|
|
57628
|
+
where: RecordWhereSchema.optional()
|
|
57629
|
+
}), object({ rows: array(object({
|
|
57630
|
+
group: union([
|
|
57631
|
+
string(),
|
|
57632
|
+
number(),
|
|
57633
|
+
_null()
|
|
57634
|
+
]),
|
|
57635
|
+
value: number().nullable()
|
|
57636
|
+
})) }), { auth: "admin" }), method(object({
|
|
57637
|
+
...KindShape,
|
|
57638
|
+
deviceId: number().int().optional(),
|
|
57639
|
+
atBefore: number().optional(),
|
|
57640
|
+
where: RecordWhereSchema.optional()
|
|
57641
|
+
}), object({
|
|
57642
|
+
deleted: number().int(),
|
|
57643
|
+
secretRefs: SecretRefsList
|
|
57644
|
+
}), {
|
|
57645
|
+
kind: "mutation",
|
|
57646
|
+
auth: "admin"
|
|
57647
|
+
}), method(object({ ops: array(RecordTransactOpSchema).min(1).max(RECORD_BATCH_MAX) }), object({
|
|
57648
|
+
results: array(object({
|
|
57649
|
+
rev: number().int().nullable(),
|
|
57650
|
+
deleted: boolean()
|
|
57651
|
+
})),
|
|
57652
|
+
releasedRefs: SecretRefsList,
|
|
57653
|
+
secretRefs: SecretRefsList
|
|
57654
|
+
}), {
|
|
57655
|
+
kind: "mutation",
|
|
57656
|
+
auth: "admin"
|
|
57657
|
+
}), method(object({
|
|
57658
|
+
deviceId: number().int(),
|
|
57659
|
+
kinds: array(RecordKindNameSchema).optional()
|
|
57660
|
+
}), object({
|
|
57661
|
+
deleted: record(string(), number().int()),
|
|
57662
|
+
secretRefs: SecretRefsList
|
|
57663
|
+
}), {
|
|
57664
|
+
kind: "mutation",
|
|
57665
|
+
auth: "admin"
|
|
57666
|
+
}), method(object(KindShape), object({ id: number().int() }), {
|
|
57667
|
+
kind: "mutation",
|
|
57668
|
+
auth: "admin"
|
|
57669
|
+
});
|
|
57670
|
+
/**
|
|
57671
|
+
* The wire shapes of the migration API, version 1 (planning#447).
|
|
57672
|
+
*
|
|
57673
|
+
* A migration is code that outlives the server it was written against: an addon at
|
|
57674
|
+
* version 1.4 that is brought to 1.9 in one jump still runs its 1.4 catalogue, against
|
|
57675
|
+
* the 1.9 kernel. The only thing that code may call is {@link MigrationApiV1}; this file
|
|
57676
|
+
* is the contract of every method of it, one Zod pair per method.
|
|
57677
|
+
*
|
|
57678
|
+
* APPEND-ONLY. A released method is never removed and never changes meaning: an input
|
|
57679
|
+
* field is never removed or made required, an enum never narrows, an output field is
|
|
57680
|
+
* never removed. A change that cannot be expressed that way is `migration-api.v2`, next
|
|
57681
|
+
* to this file. `scripts/check-migration-api-append-only.ts` holds the line against
|
|
57682
|
+
* `scripts/migration-api-contract.json`, and every `behaviours` id below must have an
|
|
57683
|
+
* `it('<id>'` in `migration-api.contract.spec.ts`.
|
|
57684
|
+
*/
|
|
57685
|
+
var Rows = record(string(), unknown());
|
|
57686
|
+
var IntegrationId = object({ integrationId: string().min(1) });
|
|
57687
|
+
var RecordId = object({ id: string().min(1) });
|
|
57688
|
+
var RecordRowSchema = object({
|
|
57689
|
+
id: string(),
|
|
57690
|
+
deviceId: number().int().nullable(),
|
|
57691
|
+
at: number().nullable(),
|
|
57692
|
+
expiresAt: number().nullable(),
|
|
57693
|
+
rev: number().int(),
|
|
57694
|
+
updatedAt: number(),
|
|
57695
|
+
data: Rows
|
|
57696
|
+
});
|
|
57697
|
+
var RecordPutShape = {
|
|
57698
|
+
id: string().min(1),
|
|
57699
|
+
deviceId: number().int().optional(),
|
|
57700
|
+
at: number().int().optional(),
|
|
57701
|
+
expiresAt: number().int().optional(),
|
|
57702
|
+
data: Rows
|
|
57703
|
+
};
|
|
57704
|
+
var MigrationIntegrationSchema = object({
|
|
57705
|
+
id: string(),
|
|
57706
|
+
addonId: string(),
|
|
57707
|
+
name: string(),
|
|
57708
|
+
info: Rows,
|
|
57709
|
+
/** The registry's stored switch: read by the one-switch migration, nothing else. */
|
|
57710
|
+
enabled: boolean().optional(),
|
|
57711
|
+
originStableId: string().optional()
|
|
57712
|
+
});
|
|
57713
|
+
var MigrationDeviceSchema = object({
|
|
57714
|
+
id: number().int(),
|
|
57715
|
+
integrationId: string().nullable().optional(),
|
|
57716
|
+
/** The owning device; null or absent for a root. */
|
|
57717
|
+
parentDeviceId: number().int().nullable().optional(),
|
|
57718
|
+
type: string().optional(),
|
|
57719
|
+
name: string().optional(),
|
|
57720
|
+
stableId: string().optional()
|
|
57721
|
+
});
|
|
57722
|
+
/** What the engine says about the migration API it serves: lets an addon notice an older server. */
|
|
57723
|
+
var MigrationApiInfoSchema = object({
|
|
57724
|
+
version: number().int(),
|
|
57725
|
+
methods: array(string())
|
|
57726
|
+
});
|
|
57727
|
+
object({
|
|
57728
|
+
message: string(),
|
|
57729
|
+
meta: Rows.optional(),
|
|
57730
|
+
/** Grouping tags of the line; a line about a device carries `{ deviceId }`. */
|
|
57731
|
+
tags: object({ deviceId: number().int().optional() }).optional()
|
|
57732
|
+
});
|
|
57733
|
+
object({
|
|
57734
|
+
owner: string().min(1),
|
|
57735
|
+
metas: array(MigrationMetaSchema)
|
|
57736
|
+
}), object({
|
|
57737
|
+
bootId: string(),
|
|
57738
|
+
snapshot: _enum([
|
|
57739
|
+
"none",
|
|
57740
|
+
"written",
|
|
57741
|
+
"refused"
|
|
57742
|
+
]),
|
|
57743
|
+
steps: array(MigrationOwnerStepSchema),
|
|
57744
|
+
/** The migration API the engine serves; absent from a server that predates it. */
|
|
57745
|
+
migrationApi: MigrationApiInfoSchema.optional()
|
|
57746
|
+
}), object({ id: string().min(1) }), object({
|
|
57747
|
+
proceed: boolean(),
|
|
57748
|
+
state: union([literal("pending"), MigrationStatusSchema]),
|
|
57749
|
+
reason: string().nullable()
|
|
57750
|
+
}), object({
|
|
57751
|
+
id: string().min(1),
|
|
57752
|
+
result: MigrationOwnerResultSchema
|
|
57753
|
+
}), object({
|
|
57754
|
+
status: MigrationStatusSchema,
|
|
57755
|
+
error: string().nullable(),
|
|
57756
|
+
rowsChanged: number().int().nonnegative()
|
|
57757
|
+
}), object({
|
|
57758
|
+
rows: number().int().nonnegative(),
|
|
57759
|
+
secrets: number().int().nonnegative()
|
|
57760
|
+
}), IntegrationId.extend({ patch: Rows }), object({ written: boolean() }), IntegrationId.extend({ keys: array(string().min(1)) }), object({
|
|
57761
|
+
present: boolean(),
|
|
57762
|
+
removed: Rows
|
|
57763
|
+
}), RecordRowSchema.nullable(), RecordRowSchema.nullable(), object({
|
|
57764
|
+
...RecordPutShape,
|
|
57765
|
+
ifRev: number().int().optional()
|
|
57766
|
+
}), object({ rev: number().int() }), object({ records: array(object(RecordPutShape)) }), object({ count: number().int().nonnegative() }), RecordId.extend({
|
|
57767
|
+
partial: Rows,
|
|
57768
|
+
ifRev: number().int().optional()
|
|
57769
|
+
}), object({ rev: number().int() }), object({ deleted: boolean() }), object({
|
|
57770
|
+
deviceId: number().int().optional(),
|
|
57771
|
+
atFrom: number().optional(),
|
|
57772
|
+
atTo: number().optional(),
|
|
57773
|
+
where: RecordWhereSchema.optional(),
|
|
57774
|
+
limit: number().int().min(1).optional(),
|
|
57775
|
+
cursor: string().min(1).optional(),
|
|
57776
|
+
resolveSecrets: boolean().optional()
|
|
57777
|
+
}), object({
|
|
57778
|
+
records: array(RecordRowSchema),
|
|
57779
|
+
nextCursor: string().nullable()
|
|
57780
|
+
}), object({
|
|
57781
|
+
deviceId: number().int().optional(),
|
|
57782
|
+
atBefore: number().optional(),
|
|
57783
|
+
where: RecordWhereSchema.optional()
|
|
57784
|
+
}), object({ count: number().int().nonnegative() }), object({}), object({ store: Rows }), object({ patch: Rows }), object({}), object({ keys: array(string().min(1)) }), object({ removed: array(string()) }), object({ refs: array(string()) }), object({ values: record(string(), string().nullable()) }), object({
|
|
57785
|
+
ref: string().min(1),
|
|
57786
|
+
value: string()
|
|
57787
|
+
}), object({}), object({ refs: array(string()) }), object({ deleted: number().int().nonnegative() }), object({}), object({ integrations: array(MigrationIntegrationSchema) }), object({ id: string().min(1) }), MigrationIntegrationSchema.nullable(), object({
|
|
57788
|
+
addonId: string().min(1),
|
|
57789
|
+
integrationId: string().min(1).optional()
|
|
57790
|
+
}), object({ devices: array(MigrationDeviceSchema) }), object({ deviceId: number().int() }), object({
|
|
57791
|
+
id: number().int(),
|
|
57792
|
+
integrationId: string().nullable(),
|
|
57793
|
+
/** Whether the device carries any stored config; its content is not offered. */
|
|
57794
|
+
hasConfig: boolean()
|
|
57795
|
+
}).nullable(), object({
|
|
57796
|
+
deviceId: number().int(),
|
|
57797
|
+
integrationId: string().min(1)
|
|
57798
|
+
}), object({}), object({}), object({ nodeId: string() }), object({}), object({});
|
|
57135
57799
|
method(object({}), object({ entries: array(MigrationLedgerEntrySchema) }), { auth: "admin" }), method(object({ owner: string().optional() }), object({ pending: array(MigrationPendingEntrySchema) }), { auth: "admin" }), method(object({ id: string().min(1) }), MigrationDryRunResultSchema, { auth: "admin" }), method(object({
|
|
57136
57800
|
id: string().min(1),
|
|
57137
57801
|
error: string().min(1)
|
|
@@ -57161,7 +57825,9 @@ method(object({}), object({ entries: array(MigrationLedgerEntrySchema) }), { aut
|
|
|
57161
57825
|
"written",
|
|
57162
57826
|
"refused"
|
|
57163
57827
|
]),
|
|
57164
|
-
steps: array(MigrationOwnerStepSchema)
|
|
57828
|
+
steps: array(MigrationOwnerStepSchema),
|
|
57829
|
+
/** The migration API this engine serves (additive: a server that predates it omits it). */
|
|
57830
|
+
migrationApi: MigrationApiInfoSchema.optional()
|
|
57165
57831
|
}), {
|
|
57166
57832
|
kind: "mutation",
|
|
57167
57833
|
auth: "admin"
|
|
@@ -57182,6 +57848,27 @@ method(object({}), object({ entries: array(MigrationLedgerEntrySchema) }), { aut
|
|
|
57182
57848
|
}), {
|
|
57183
57849
|
kind: "mutation",
|
|
57184
57850
|
auth: "admin"
|
|
57851
|
+
}), method(object({ integrationId: string().min(1) }), record(string(), unknown()), { auth: "admin" }), method(object({ integrationId: string().min(1) }), object({
|
|
57852
|
+
rows: number().int().nonnegative(),
|
|
57853
|
+
secrets: number().int().nonnegative()
|
|
57854
|
+
}), {
|
|
57855
|
+
kind: "mutation",
|
|
57856
|
+
auth: "admin"
|
|
57857
|
+
}), method(object({
|
|
57858
|
+
integrationId: string().min(1),
|
|
57859
|
+
patch: record(string(), unknown())
|
|
57860
|
+
}), object({ written: boolean() }), {
|
|
57861
|
+
kind: "mutation",
|
|
57862
|
+
auth: "admin"
|
|
57863
|
+
}), method(object({
|
|
57864
|
+
integrationId: string().min(1),
|
|
57865
|
+
keys: array(string().min(1))
|
|
57866
|
+
}), object({
|
|
57867
|
+
present: boolean(),
|
|
57868
|
+
removed: record(string(), unknown())
|
|
57869
|
+
}), {
|
|
57870
|
+
kind: "mutation",
|
|
57871
|
+
auth: "admin"
|
|
57185
57872
|
});
|
|
57186
57873
|
method(object({
|
|
57187
57874
|
sourceUrl: string(),
|
|
@@ -59807,7 +60494,10 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema$1).r
|
|
|
59807
60494
|
}), method(RelocateMediaInputSchema, object({ jobId: string() }), {
|
|
59808
60495
|
kind: "mutation",
|
|
59809
60496
|
auth: "admin"
|
|
59810
|
-
}), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(
|
|
60497
|
+
}), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(MediaLocationCensusInputSchema, MediaLocationCensusSchema, {
|
|
60498
|
+
kind: "query",
|
|
60499
|
+
auth: "admin"
|
|
60500
|
+
}), method(RelocatableMediaCountInputSchema, RelocatableMediaCountSchema, {
|
|
59811
60501
|
kind: "query",
|
|
59812
60502
|
auth: "admin"
|
|
59813
60503
|
}), method(object({}), array(RelocateJobSchema).readonly(), {
|
|
@@ -62214,7 +62904,7 @@ var BrokerStatusSchema$1 = _enum([
|
|
|
62214
62904
|
"unreachable",
|
|
62215
62905
|
"tls-error"
|
|
62216
62906
|
]);
|
|
62217
|
-
var BrokerInfoSchema
|
|
62907
|
+
var BrokerInfoSchema = object({
|
|
62218
62908
|
id: string(),
|
|
62219
62909
|
name: string(),
|
|
62220
62910
|
url: string(),
|
|
@@ -62277,7 +62967,7 @@ var StatusSchema = object({
|
|
|
62277
62967
|
brokerCount: number(),
|
|
62278
62968
|
embeddedRunning: boolean()
|
|
62279
62969
|
});
|
|
62280
|
-
method(_void(), array(BrokerInfoSchema
|
|
62970
|
+
method(_void(), array(BrokerInfoSchema)), method(IdInputSchema, BrokerConnectionDetailsSchema, { auth: "admin" }), method(AddBrokerInputSchema, AddBrokerResultSchema, {
|
|
62281
62971
|
kind: "mutation",
|
|
62282
62972
|
auth: "admin"
|
|
62283
62973
|
}), method(IdInputSchema, _void(), {
|
|
@@ -66552,14 +67242,6 @@ object({
|
|
|
66552
67242
|
empty: boolean().nullable(),
|
|
66553
67243
|
/** True while the pump is running. Null while unknown. */
|
|
66554
67244
|
pumpRunning: boolean().nullable(),
|
|
66555
|
-
/** Water drunk in the last drink, in litres. */
|
|
66556
|
-
lastDrink: number().min(0).nullable().meta(readingMeta("volume")),
|
|
66557
|
-
/** Water drunk in the current hour, in litres. */
|
|
66558
|
-
currentHourDrink: number().min(0).nullable().meta(readingMeta("volume")),
|
|
66559
|
-
/** Water drunk over the last 24 hours (rolling), in litres. */
|
|
66560
|
-
last24hDrink: number().min(0).nullable().meta(readingMeta("volume")),
|
|
66561
|
-
/** Water drunk since local midnight, in litres. Null when the fountain has no such sensor. */
|
|
66562
|
-
todayDrink: number().min(0).nullable().meta(readingMeta("volume")),
|
|
66563
67245
|
/** Decoded fault message. Null means healthy; a non-null string is an active fault. */
|
|
66564
67246
|
error: string().nullable(),
|
|
66565
67247
|
/** Ms epoch when the slice was last refreshed. */
|
|
@@ -66572,9 +67254,6 @@ DeviceType.PetFountain, method(object({
|
|
|
66572
67254
|
}), _void(), {
|
|
66573
67255
|
kind: "mutation",
|
|
66574
67256
|
auth: "protected"
|
|
66575
|
-
}), method(object({ deviceId: DeviceIdSchema$1 }), _void(), {
|
|
66576
|
-
kind: "mutation",
|
|
66577
|
-
auth: "protected"
|
|
66578
67257
|
});
|
|
66579
67258
|
/**
|
|
66580
67259
|
* The wire shapes of the Auto tune plan and apply (D745), used by the
|
|
@@ -68611,253 +69290,6 @@ DeviceType.Camera, DeviceType.Sensor, DeviceType.Switch, DeviceType.Gateway, met
|
|
|
68611
69290
|
auth: "admin"
|
|
68612
69291
|
});
|
|
68613
69292
|
/**
|
|
68614
|
-
* records - an addon's own facts and documents (D881): ledgers, audit rows,
|
|
68615
|
-
* config documents, mirrors. The third storage API next to `ctx.settings`
|
|
68616
|
-
* (operator intent, D870) and device-history (numbers over time, D850).
|
|
68617
|
-
*
|
|
68618
|
-
* Who the OWNER is: `callerAddonId`, stamped by the transport on a call that
|
|
68619
|
-
* crossed a process and stated by a hub in-process caller (`ctx.records` does
|
|
68620
|
-
* that with the addon id closed over). It is deliberately NOT in any input
|
|
68621
|
-
* schema, so a session can never supply it, and a call with no stamp is refused
|
|
68622
|
-
* `records/no-caller`. A kind is readable and writable only by its owner; other
|
|
68623
|
-
* addons go through the owner's capability.
|
|
68624
|
-
*
|
|
68625
|
-
* Every read is three-way: a row, `null`, or the call THROWS. A failed read is
|
|
68626
|
-
* never `[]`. Secret fields are never on the wire: a read shows the
|
|
68627
|
-
* redaction token, `secretRefs` hands the owner's `ctx.secrets` the refs it
|
|
68628
|
-
* resolves itself, and a write may carry only a keychain marker bound to the
|
|
68629
|
-
* row's own ref.
|
|
68630
|
-
*
|
|
68631
|
-
* Internal: addons reach it through `ctx.records`, never directly.
|
|
68632
|
-
*/
|
|
68633
|
-
var RecordIdSchema = string().min(1).max(256);
|
|
68634
|
-
/** A JSON object body. Size is the engine's check (`maxDataBytes`), not a schema's. */
|
|
68635
|
-
var RecordBodySchema = record(string(), unknown());
|
|
68636
|
-
var RecordInputSchema = object({
|
|
68637
|
-
id: RecordIdSchema,
|
|
68638
|
-
/** The device this row belongs to (D865 removal, per-device reads). */
|
|
68639
|
-
deviceId: number().int().optional(),
|
|
68640
|
-
/** The domain clock, ms: observed / created / opened. */
|
|
68641
|
-
at: number().int().optional(),
|
|
68642
|
-
/** Producer-set expiry, ms. Refused on a kind whose retention is an engine TTL. */
|
|
68643
|
-
expiresAt: number().int().optional(),
|
|
68644
|
-
data: RecordBodySchema
|
|
68645
|
-
});
|
|
68646
|
-
var RecordViewSchema = object({
|
|
68647
|
-
id: string(),
|
|
68648
|
-
deviceId: number().int().nullable(),
|
|
68649
|
-
at: number().nullable(),
|
|
68650
|
-
expiresAt: number().nullable(),
|
|
68651
|
-
rev: number().int(),
|
|
68652
|
-
updatedAt: number(),
|
|
68653
|
-
data: RecordBodySchema
|
|
68654
|
-
});
|
|
68655
|
-
/** Declared index fields only. Anything else does not compile, by design. */
|
|
68656
|
-
var RecordWhereSchema = record(RecordFieldPathSchema, union([
|
|
68657
|
-
string(),
|
|
68658
|
-
number(),
|
|
68659
|
-
boolean(),
|
|
68660
|
-
object({ in: array(union([
|
|
68661
|
-
string(),
|
|
68662
|
-
number(),
|
|
68663
|
-
boolean()
|
|
68664
|
-
])).min(1).max(RECORD_BATCH_MAX) }),
|
|
68665
|
-
object({
|
|
68666
|
-
gt: union([string(), number()]).optional(),
|
|
68667
|
-
gte: union([string(), number()]).optional(),
|
|
68668
|
-
lt: union([string(), number()]).optional(),
|
|
68669
|
-
lte: union([string(), number()]).optional()
|
|
68670
|
-
}).refine((r) => Object.keys(r).length > 0, { message: "name at least one bound" })
|
|
68671
|
-
]));
|
|
68672
|
-
var KindShape = { kind: RecordKindNameSchema };
|
|
68673
|
-
var TimeWindowShape = {
|
|
68674
|
-
deviceId: number().int().optional(),
|
|
68675
|
-
atFrom: number().optional(),
|
|
68676
|
-
atTo: number().optional()
|
|
68677
|
-
};
|
|
68678
|
-
var RecordQueryInputSchema = object({
|
|
68679
|
-
...KindShape,
|
|
68680
|
-
...TimeWindowShape,
|
|
68681
|
-
where: RecordWhereSchema.optional(),
|
|
68682
|
-
/** Without `where`: `at` (default for a kind with a clock) or `id`. With `where` the order is the index's. */
|
|
68683
|
-
order: _enum(["at", "id"]).optional(),
|
|
68684
|
-
desc: boolean().optional(),
|
|
68685
|
-
limit: number().int().min(1).max(RECORD_QUERY_MAX).default(100),
|
|
68686
|
-
/** Opaque keyset cursor from a previous answer. There is no offset. */
|
|
68687
|
-
cursor: string().min(1).optional()
|
|
68688
|
-
});
|
|
68689
|
-
var RecordQueryResultSchema = object({
|
|
68690
|
-
records: array(RecordViewSchema),
|
|
68691
|
-
nextCursor: string().nullable()
|
|
68692
|
-
});
|
|
68693
|
-
var RecordKindStateSchema = _enum([
|
|
68694
|
-
"created",
|
|
68695
|
-
"unchanged",
|
|
68696
|
-
"updated"
|
|
68697
|
-
]);
|
|
68698
|
-
var DeclareKindResultSchema = object({
|
|
68699
|
-
kindId: number().int(),
|
|
68700
|
-
state: RecordKindStateSchema,
|
|
68701
|
-
createdIndexes: array(string())
|
|
68702
|
-
});
|
|
68703
|
-
/** Keychain refs a write released (the old marker is gone from the row): the owner deletes the values. */
|
|
68704
|
-
var SecretRefsList = array(string());
|
|
68705
|
-
/**
|
|
68706
|
-
* One op of a `transact`: the single-row writes, each on a kind of the caller.
|
|
68707
|
-
* All ops of one call share ONE database file and ONE `transactFamily`.
|
|
68708
|
-
*/
|
|
68709
|
-
var RecordTransactOpSchema = discriminatedUnion("op", [
|
|
68710
|
-
object({
|
|
68711
|
-
op: literal("put"),
|
|
68712
|
-
kind: RecordKindNameSchema,
|
|
68713
|
-
record: RecordInputSchema,
|
|
68714
|
-
ifRev: number().int().min(0).optional()
|
|
68715
|
-
}),
|
|
68716
|
-
object({
|
|
68717
|
-
op: literal("patch"),
|
|
68718
|
-
kind: RecordKindNameSchema,
|
|
68719
|
-
id: RecordIdSchema,
|
|
68720
|
-
data: RecordBodySchema,
|
|
68721
|
-
at: number().int().nullable().optional(),
|
|
68722
|
-
expiresAt: number().int().nullable().optional(),
|
|
68723
|
-
ifRev: number().int().min(1).optional()
|
|
68724
|
-
}),
|
|
68725
|
-
object({
|
|
68726
|
-
op: literal("delete"),
|
|
68727
|
-
kind: RecordKindNameSchema,
|
|
68728
|
-
id: RecordIdSchema
|
|
68729
|
-
})
|
|
68730
|
-
]);
|
|
68731
|
-
var RecordSecretRefsSchema = record(string(), record(string(), string()));
|
|
68732
|
-
method(object({ kinds: record(RecordKindNameSchema, RecordKindDeclarationSchema) }), object({ kinds: record(string(), DeclareKindResultSchema) }), {
|
|
68733
|
-
kind: "mutation",
|
|
68734
|
-
auth: "admin"
|
|
68735
|
-
}), method(object({
|
|
68736
|
-
...KindShape,
|
|
68737
|
-
id: RecordIdSchema
|
|
68738
|
-
}), RecordViewSchema.nullable(), { auth: "admin" }), method(object({
|
|
68739
|
-
...KindShape,
|
|
68740
|
-
ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
|
|
68741
|
-
}), array(RecordViewSchema), { auth: "admin" }), method(object({
|
|
68742
|
-
...KindShape,
|
|
68743
|
-
ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
|
|
68744
|
-
}), RecordSecretRefsSchema, { auth: "admin" }), method(object({
|
|
68745
|
-
...KindShape,
|
|
68746
|
-
record: RecordInputSchema,
|
|
68747
|
-
/** Compare-and-set. `0` means "the row must not exist". */
|
|
68748
|
-
ifRev: number().int().min(0).optional()
|
|
68749
|
-
}), object({
|
|
68750
|
-
rev: number().int(),
|
|
68751
|
-
releasedRefs: SecretRefsList
|
|
68752
|
-
}), {
|
|
68753
|
-
kind: "mutation",
|
|
68754
|
-
auth: "admin"
|
|
68755
|
-
}), method(object({
|
|
68756
|
-
...KindShape,
|
|
68757
|
-
records: array(RecordInputSchema).min(1).max(RECORD_BATCH_MAX)
|
|
68758
|
-
}), object({
|
|
68759
|
-
count: number().int(),
|
|
68760
|
-
releasedRefs: SecretRefsList
|
|
68761
|
-
}), {
|
|
68762
|
-
kind: "mutation",
|
|
68763
|
-
auth: "admin"
|
|
68764
|
-
}), method(object({
|
|
68765
|
-
...KindShape,
|
|
68766
|
-
id: RecordIdSchema,
|
|
68767
|
-
data: RecordBodySchema,
|
|
68768
|
-
at: number().int().nullable().optional(),
|
|
68769
|
-
expiresAt: number().int().nullable().optional(),
|
|
68770
|
-
ifRev: number().int().min(1).optional()
|
|
68771
|
-
}), object({
|
|
68772
|
-
rev: number().int(),
|
|
68773
|
-
releasedRefs: SecretRefsList
|
|
68774
|
-
}), {
|
|
68775
|
-
kind: "mutation",
|
|
68776
|
-
auth: "admin"
|
|
68777
|
-
}), method(object({
|
|
68778
|
-
...KindShape,
|
|
68779
|
-
id: RecordIdSchema
|
|
68780
|
-
}), object({
|
|
68781
|
-
deleted: boolean(),
|
|
68782
|
-
secretRefs: SecretRefsList
|
|
68783
|
-
}), {
|
|
68784
|
-
kind: "mutation",
|
|
68785
|
-
auth: "admin"
|
|
68786
|
-
}), method(object({
|
|
68787
|
-
...KindShape,
|
|
68788
|
-
ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
|
|
68789
|
-
}), object({
|
|
68790
|
-
deleted: number().int(),
|
|
68791
|
-
secretRefs: SecretRefsList
|
|
68792
|
-
}), {
|
|
68793
|
-
kind: "mutation",
|
|
68794
|
-
auth: "admin"
|
|
68795
|
-
}), method(RecordQueryInputSchema, RecordQueryResultSchema, { auth: "admin" }), method(object({
|
|
68796
|
-
...KindShape,
|
|
68797
|
-
...TimeWindowShape,
|
|
68798
|
-
where: RecordWhereSchema.optional()
|
|
68799
|
-
}), object({ count: number().int() }), { auth: "admin" }), method(object({
|
|
68800
|
-
...KindShape,
|
|
68801
|
-
deviceId: number().int().optional(),
|
|
68802
|
-
from: number(),
|
|
68803
|
-
to: number(),
|
|
68804
|
-
bucketMs: number().int().positive()
|
|
68805
|
-
}), object({ buckets: array(object({
|
|
68806
|
-
bucketStart: number(),
|
|
68807
|
-
count: number().int()
|
|
68808
|
-
})) }), { auth: "admin" }), method(object({
|
|
68809
|
-
...KindShape,
|
|
68810
|
-
op: _enum([
|
|
68811
|
-
"sum",
|
|
68812
|
-
"min",
|
|
68813
|
-
"max",
|
|
68814
|
-
"count"
|
|
68815
|
-
]),
|
|
68816
|
-
field: RecordFieldPathSchema.optional(),
|
|
68817
|
-
groupBy: RecordFieldPathSchema.optional(),
|
|
68818
|
-
where: RecordWhereSchema.optional()
|
|
68819
|
-
}), object({ rows: array(object({
|
|
68820
|
-
group: union([
|
|
68821
|
-
string(),
|
|
68822
|
-
number(),
|
|
68823
|
-
_null()
|
|
68824
|
-
]),
|
|
68825
|
-
value: number().nullable()
|
|
68826
|
-
})) }), { auth: "admin" }), method(object({
|
|
68827
|
-
...KindShape,
|
|
68828
|
-
deviceId: number().int().optional(),
|
|
68829
|
-
atBefore: number().optional(),
|
|
68830
|
-
where: RecordWhereSchema.optional()
|
|
68831
|
-
}), object({
|
|
68832
|
-
deleted: number().int(),
|
|
68833
|
-
secretRefs: SecretRefsList
|
|
68834
|
-
}), {
|
|
68835
|
-
kind: "mutation",
|
|
68836
|
-
auth: "admin"
|
|
68837
|
-
}), method(object({ ops: array(RecordTransactOpSchema).min(1).max(RECORD_BATCH_MAX) }), object({
|
|
68838
|
-
results: array(object({
|
|
68839
|
-
rev: number().int().nullable(),
|
|
68840
|
-
deleted: boolean()
|
|
68841
|
-
})),
|
|
68842
|
-
releasedRefs: SecretRefsList,
|
|
68843
|
-
secretRefs: SecretRefsList
|
|
68844
|
-
}), {
|
|
68845
|
-
kind: "mutation",
|
|
68846
|
-
auth: "admin"
|
|
68847
|
-
}), method(object({
|
|
68848
|
-
deviceId: number().int(),
|
|
68849
|
-
kinds: array(RecordKindNameSchema).optional()
|
|
68850
|
-
}), object({
|
|
68851
|
-
deleted: record(string(), number().int()),
|
|
68852
|
-
secretRefs: SecretRefsList
|
|
68853
|
-
}), {
|
|
68854
|
-
kind: "mutation",
|
|
68855
|
-
auth: "admin"
|
|
68856
|
-
}), method(object(KindShape), object({ id: number().int() }), {
|
|
68857
|
-
kind: "mutation",
|
|
68858
|
-
auth: "admin"
|
|
68859
|
-
});
|
|
68860
|
-
/**
|
|
68861
69293
|
* record-entries - the ONE admin surface for every list of user-created entries
|
|
68862
69294
|
* (D881): notification targets, brokers, LLM profiles, anything an addon
|
|
68863
69295
|
* declares as an ENTRY kind (`entry: { title }` in `defineRecordKinds`).
|
|
@@ -77419,20 +77851,6 @@ Object.freeze({
|
|
|
77419
77851
|
access: "create",
|
|
77420
77852
|
role: "viewer"
|
|
77421
77853
|
},
|
|
77422
|
-
"broker.add": {
|
|
77423
|
-
capName: "broker",
|
|
77424
|
-
capScope: "system",
|
|
77425
|
-
addonId: null,
|
|
77426
|
-
access: "create",
|
|
77427
|
-
role: "admin"
|
|
77428
|
-
},
|
|
77429
|
-
"broker.get": {
|
|
77430
|
-
capName: "broker",
|
|
77431
|
-
capScope: "system",
|
|
77432
|
-
addonId: null,
|
|
77433
|
-
access: "view",
|
|
77434
|
-
role: "admin"
|
|
77435
|
-
},
|
|
77436
77854
|
"broker.getBrokerConfig": {
|
|
77437
77855
|
capName: "broker",
|
|
77438
77856
|
capScope: "system",
|
|
@@ -77440,20 +77858,6 @@ Object.freeze({
|
|
|
77440
77858
|
access: "view",
|
|
77441
77859
|
role: "admin"
|
|
77442
77860
|
},
|
|
77443
|
-
"broker.getSettings": {
|
|
77444
|
-
capName: "broker",
|
|
77445
|
-
capScope: "system",
|
|
77446
|
-
addonId: null,
|
|
77447
|
-
access: "view",
|
|
77448
|
-
role: "admin"
|
|
77449
|
-
},
|
|
77450
|
-
"broker.getSettingsSchema": {
|
|
77451
|
-
capName: "broker",
|
|
77452
|
-
capScope: "system",
|
|
77453
|
-
addonId: null,
|
|
77454
|
-
access: "view",
|
|
77455
|
-
role: "admin"
|
|
77456
|
-
},
|
|
77457
77861
|
"broker.getState": {
|
|
77458
77862
|
capName: "broker",
|
|
77459
77863
|
capScope: "system",
|
|
@@ -77468,20 +77872,6 @@ Object.freeze({
|
|
|
77468
77872
|
access: "view",
|
|
77469
77873
|
role: "admin"
|
|
77470
77874
|
},
|
|
77471
|
-
"broker.list": {
|
|
77472
|
-
capName: "broker",
|
|
77473
|
-
capScope: "system",
|
|
77474
|
-
addonId: null,
|
|
77475
|
-
access: "view",
|
|
77476
|
-
role: "admin"
|
|
77477
|
-
},
|
|
77478
|
-
"broker.listProviders": {
|
|
77479
|
-
capName: "broker",
|
|
77480
|
-
capScope: "system",
|
|
77481
|
-
addonId: null,
|
|
77482
|
-
access: "view",
|
|
77483
|
-
role: "admin"
|
|
77484
|
-
},
|
|
77485
77875
|
"broker.publish": {
|
|
77486
77876
|
capName: "broker",
|
|
77487
77877
|
capScope: "system",
|
|
@@ -77489,20 +77879,6 @@ Object.freeze({
|
|
|
77489
77879
|
access: "create",
|
|
77490
77880
|
role: "admin"
|
|
77491
77881
|
},
|
|
77492
|
-
"broker.remove": {
|
|
77493
|
-
capName: "broker",
|
|
77494
|
-
capScope: "system",
|
|
77495
|
-
addonId: null,
|
|
77496
|
-
access: "delete",
|
|
77497
|
-
role: "admin"
|
|
77498
|
-
},
|
|
77499
|
-
"broker.setSettings": {
|
|
77500
|
-
capName: "broker",
|
|
77501
|
-
capScope: "system",
|
|
77502
|
-
addonId: null,
|
|
77503
|
-
access: "create",
|
|
77504
|
-
role: "admin"
|
|
77505
|
-
},
|
|
77506
77882
|
"broker.subscribe": {
|
|
77507
77883
|
capName: "broker",
|
|
77508
77884
|
capScope: "system",
|
|
@@ -77510,20 +77886,6 @@ Object.freeze({
|
|
|
77510
77886
|
access: "create",
|
|
77511
77887
|
role: "admin"
|
|
77512
77888
|
},
|
|
77513
|
-
"broker.testConnection": {
|
|
77514
|
-
capName: "broker",
|
|
77515
|
-
capScope: "system",
|
|
77516
|
-
addonId: null,
|
|
77517
|
-
access: "create",
|
|
77518
|
-
role: "admin"
|
|
77519
|
-
},
|
|
77520
|
-
"broker.testSettings": {
|
|
77521
|
-
capName: "broker",
|
|
77522
|
-
capScope: "system",
|
|
77523
|
-
addonId: null,
|
|
77524
|
-
access: "create",
|
|
77525
|
-
role: "admin"
|
|
77526
|
-
},
|
|
77527
77889
|
"broker.unsubscribe": {
|
|
77528
77890
|
capName: "broker",
|
|
77529
77891
|
capScope: "system",
|
|
@@ -80121,13 +80483,6 @@ Object.freeze({
|
|
|
80121
80483
|
access: "create",
|
|
80122
80484
|
role: "admin"
|
|
80123
80485
|
},
|
|
80124
|
-
"integrations.clearSettings": {
|
|
80125
|
-
capName: "integrations",
|
|
80126
|
-
capScope: "system",
|
|
80127
|
-
addonId: null,
|
|
80128
|
-
access: "delete",
|
|
80129
|
-
role: "admin"
|
|
80130
|
-
},
|
|
80131
80486
|
"integrations.create": {
|
|
80132
80487
|
capName: "integrations",
|
|
80133
80488
|
capScope: "system",
|
|
@@ -80163,13 +80518,6 @@ Object.freeze({
|
|
|
80163
80518
|
access: "view",
|
|
80164
80519
|
role: "admin"
|
|
80165
80520
|
},
|
|
80166
|
-
"integrations.getSettings": {
|
|
80167
|
-
capName: "integrations",
|
|
80168
|
-
capScope: "system",
|
|
80169
|
-
addonId: null,
|
|
80170
|
-
access: "view",
|
|
80171
|
-
role: "admin"
|
|
80172
|
-
},
|
|
80173
80521
|
"integrations.list": {
|
|
80174
80522
|
capName: "integrations",
|
|
80175
80523
|
capScope: "system",
|
|
@@ -80177,13 +80525,6 @@ Object.freeze({
|
|
|
80177
80525
|
access: "view",
|
|
80178
80526
|
role: "admin"
|
|
80179
80527
|
},
|
|
80180
|
-
"integrations.setSettings": {
|
|
80181
|
-
capName: "integrations",
|
|
80182
|
-
capScope: "system",
|
|
80183
|
-
addonId: null,
|
|
80184
|
-
access: "create",
|
|
80185
|
-
role: "admin"
|
|
80186
|
-
},
|
|
80187
80528
|
"integrations.testConnection": {
|
|
80188
80529
|
capName: "integrations",
|
|
80189
80530
|
capScope: "system",
|
|
@@ -81178,6 +81519,13 @@ Object.freeze({
|
|
|
81178
81519
|
access: "view",
|
|
81179
81520
|
role: "admin"
|
|
81180
81521
|
},
|
|
81522
|
+
"migrations.clearLegacyIntegrationRows": {
|
|
81523
|
+
capName: "migrations",
|
|
81524
|
+
capScope: "system",
|
|
81525
|
+
addonId: null,
|
|
81526
|
+
access: "delete",
|
|
81527
|
+
role: "admin"
|
|
81528
|
+
},
|
|
81181
81529
|
"migrations.declareOwner": {
|
|
81182
81530
|
capName: "migrations",
|
|
81183
81531
|
capScope: "system",
|
|
@@ -81185,6 +81533,13 @@ Object.freeze({
|
|
|
81185
81533
|
access: "create",
|
|
81186
81534
|
role: "admin"
|
|
81187
81535
|
},
|
|
81536
|
+
"migrations.deleteLegacyIntegrationRowKeys": {
|
|
81537
|
+
capName: "migrations",
|
|
81538
|
+
capScope: "system",
|
|
81539
|
+
addonId: null,
|
|
81540
|
+
access: "delete",
|
|
81541
|
+
role: "admin"
|
|
81542
|
+
},
|
|
81188
81543
|
"migrations.dryRun": {
|
|
81189
81544
|
capName: "migrations",
|
|
81190
81545
|
capScope: "system",
|
|
@@ -81220,6 +81575,20 @@ Object.freeze({
|
|
|
81220
81575
|
access: "create",
|
|
81221
81576
|
role: "admin"
|
|
81222
81577
|
},
|
|
81578
|
+
"migrations.patchLegacyIntegrationRows": {
|
|
81579
|
+
capName: "migrations",
|
|
81580
|
+
capScope: "system",
|
|
81581
|
+
addonId: null,
|
|
81582
|
+
access: "create",
|
|
81583
|
+
role: "admin"
|
|
81584
|
+
},
|
|
81585
|
+
"migrations.readLegacyIntegrationRows": {
|
|
81586
|
+
capName: "migrations",
|
|
81587
|
+
capScope: "system",
|
|
81588
|
+
addonId: null,
|
|
81589
|
+
access: "view",
|
|
81590
|
+
role: "admin"
|
|
81591
|
+
},
|
|
81223
81592
|
"migrations.restorePreMigration": {
|
|
81224
81593
|
capName: "migrations",
|
|
81225
81594
|
capScope: "system",
|
|
@@ -82277,13 +82646,6 @@ Object.freeze({
|
|
|
82277
82646
|
access: "view",
|
|
82278
82647
|
role: "viewer"
|
|
82279
82648
|
},
|
|
82280
|
-
"petFountain.resetDailyConsumption": {
|
|
82281
|
-
capName: "pet-fountain",
|
|
82282
|
-
capScope: "device",
|
|
82283
|
-
addonId: null,
|
|
82284
|
-
access: "delete",
|
|
82285
|
-
role: "viewer"
|
|
82286
|
-
},
|
|
82287
82649
|
"petFountain.setPump": {
|
|
82288
82650
|
capName: "pet-fountain",
|
|
82289
82651
|
capScope: "device",
|
|
@@ -82480,6 +82842,13 @@ Object.freeze({
|
|
|
82480
82842
|
access: "view",
|
|
82481
82843
|
role: "viewer"
|
|
82482
82844
|
},
|
|
82845
|
+
"pipelineAnalytics.getMediaLocationCensus": {
|
|
82846
|
+
capName: "pipeline-analytics",
|
|
82847
|
+
capScope: "device",
|
|
82848
|
+
addonId: null,
|
|
82849
|
+
access: "view",
|
|
82850
|
+
role: "admin"
|
|
82851
|
+
},
|
|
82483
82852
|
"pipelineAnalytics.getMediaReclaimStatus": {
|
|
82484
82853
|
capName: "pipeline-analytics",
|
|
82485
82854
|
capScope: "device",
|
|
@@ -88698,11 +89067,6 @@ Object.freeze({
|
|
|
88698
89067
|
form: "single",
|
|
88699
89068
|
optional: false
|
|
88700
89069
|
}],
|
|
88701
|
-
"petFountain.resetDailyConsumption": [{
|
|
88702
|
-
name: "deviceId",
|
|
88703
|
-
form: "single",
|
|
88704
|
-
optional: false
|
|
88705
|
-
}],
|
|
88706
89070
|
"petFountain.setPump": [{
|
|
88707
89071
|
name: "deviceId",
|
|
88708
89072
|
form: "single",
|
|
@@ -105601,7 +105965,7 @@ var ExportAlexaAddon = class extends BaseAddon {
|
|
|
105601
105965
|
}),
|
|
105602
105966
|
mintId: () => `alexa-skill-${randomUUID().slice(0, 8)}`,
|
|
105603
105967
|
health: (body, id) => {
|
|
105604
|
-
if (body
|
|
105968
|
+
if (!isInstanceEnabled(body)) return { status: {
|
|
105605
105969
|
state: "off",
|
|
105606
105970
|
label: "Off"
|
|
105607
105971
|
} };
|