@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
|
@@ -6016,7 +6016,7 @@ var ZodIssueCode = {
|
|
|
6016
6016
|
var ZodFirstPartyTypeKind;
|
|
6017
6017
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
6018
6018
|
//#endregion
|
|
6019
|
-
//#region ../types/dist/sleep-
|
|
6019
|
+
//#region ../types/dist/sleep-CmjWurK5.mjs
|
|
6020
6020
|
/**
|
|
6021
6021
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
6022
6022
|
* window to float samples (D455).
|
|
@@ -6700,130 +6700,92 @@ async function runAddonMigrations(host, migrations, logger, options = {}) {
|
|
|
6700
6700
|
blockOwner
|
|
6701
6701
|
};
|
|
6702
6702
|
}
|
|
6703
|
-
/**
|
|
6704
|
-
|
|
6705
|
-
|
|
6706
|
-
|
|
6707
|
-
|
|
6708
|
-
|
|
6709
|
-
|
|
6710
|
-
|
|
6711
|
-
|
|
6712
|
-
|
|
6713
|
-
|
|
6714
|
-
|
|
6715
|
-
|
|
6716
|
-
|
|
6717
|
-
|
|
6718
|
-
|
|
6719
|
-
|
|
6720
|
-
|
|
6721
|
-
const set = async (next) => {
|
|
6722
|
-
const validated = deps.schema.parse(next);
|
|
6723
|
-
await deps.write({ [deps.key]: validated });
|
|
6724
|
-
};
|
|
6725
|
-
const update = async (fn) => {
|
|
6726
|
-
await set(fn(await get()));
|
|
6727
|
-
};
|
|
6703
|
+
/** The record calls the one-switch migration makes, over the migration API. */
|
|
6704
|
+
function switchRecordsOverMigrationApi(api) {
|
|
6705
|
+
return { kind: (definition) => {
|
|
6706
|
+
const handle = api.records.kind(definition);
|
|
6707
|
+
return {
|
|
6708
|
+
get: (id) => handle.get({ id }),
|
|
6709
|
+
put: (input, opts) => handle.put({
|
|
6710
|
+
...input,
|
|
6711
|
+
...opts?.ifRev === void 0 ? {} : { ifRev: opts.ifRev }
|
|
6712
|
+
}),
|
|
6713
|
+
patch: (id, partial) => handle.patch({
|
|
6714
|
+
id,
|
|
6715
|
+
partial
|
|
6716
|
+
})
|
|
6717
|
+
};
|
|
6718
|
+
} };
|
|
6719
|
+
}
|
|
6720
|
+
function integrationRowsApiOver(api) {
|
|
6728
6721
|
return {
|
|
6729
|
-
|
|
6730
|
-
|
|
6731
|
-
|
|
6722
|
+
list: async () => (await api.integrations.list({})).integrations,
|
|
6723
|
+
readLegacyIntegrationRows: (input) => api.legacyRows.read(input),
|
|
6724
|
+
clearLegacyIntegrationRows: (input) => api.legacyRows.clear(input)
|
|
6732
6725
|
};
|
|
6733
6726
|
}
|
|
6734
|
-
|
|
6735
|
-
|
|
6736
|
-
|
|
6737
|
-
|
|
6738
|
-
|
|
6739
|
-
|
|
6740
|
-
|
|
6741
|
-
|
|
6742
|
-
|
|
6743
|
-
|
|
6744
|
-
* back, so UI forms and `resolveConfig` only ever see the bare key.
|
|
6745
|
-
*
|
|
6746
|
-
* Fields opt in via the `perNode: true` schema marker on `ConfigFieldBase`
|
|
6747
|
-
* (`interfaces/config-ui.ts`); `BaseAddon` derives the key set from the
|
|
6748
|
-
* schema and routes reads/writes through these helpers.
|
|
6749
|
-
*
|
|
6750
|
-
* ## No bare-key fallback — deliberate
|
|
6751
|
-
*
|
|
6752
|
-
* {@link readNodeValue} reads the node-scoped key ONLY. A node with no
|
|
6753
|
-
* scoped key resolves to `undefined` so the field's schema `default` wins —
|
|
6754
|
-
* NEVER `store[base]` and never another node's value. A bare legacy key in
|
|
6755
|
-
* the store is invisible to every node, hub included, so one node's
|
|
6756
|
-
* selection can never leak onto another. (This generalizes the
|
|
6757
|
-
* `decoder-backend-keys.ts` semantics — the no-fallback variant — over an
|
|
6758
|
-
* arbitrary set of per-node field keys.)
|
|
6759
|
-
*
|
|
6760
|
-
* Pure functions only — no I/O, no imports beyond the language. This is a
|
|
6761
|
-
* LEAF module: import it via its deep path, never from the root barrel.
|
|
6762
|
-
*/
|
|
6763
|
-
/**
|
|
6764
|
-
* Normalize a raw kernel node id to the bare node id used for scoping.
|
|
6765
|
-
* `localNodeId` can carry a `<node>/<addon>` suffix on forked child
|
|
6766
|
-
* processes; per-node settings are per-NODE, so strip the addon segment.
|
|
6767
|
-
* `undefined` / `null` / empty falls back to `'hub'`.
|
|
6768
|
-
*/
|
|
6769
|
-
function normalizeNodeId(raw) {
|
|
6770
|
-
if (raw === void 0 || raw === null || raw === "") return "hub";
|
|
6771
|
-
const slashIdx = raw.indexOf("/");
|
|
6772
|
-
if (slashIdx < 0) return raw;
|
|
6773
|
-
const bare = raw.slice(0, slashIdx);
|
|
6774
|
-
return bare === "" ? "hub" : bare;
|
|
6775
|
-
}
|
|
6776
|
-
/** The node-scoped store key for a per-node field: `<base>@<nodeId>`. */
|
|
6777
|
-
function nodeScopedKey(base, nodeId) {
|
|
6778
|
-
return `${base}@${normalizeNodeId(nodeId)}`;
|
|
6779
|
-
}
|
|
6780
|
-
/**
|
|
6781
|
-
* Read a node's value for a per-node field from the raw shared store:
|
|
6782
|
-
* the node-scoped key when present, otherwise `undefined`.
|
|
6783
|
-
* Deliberately NO bare-key fallback (see module doc) — the caller lets the
|
|
6784
|
-
* schema `default` win on `undefined`.
|
|
6785
|
-
*/
|
|
6786
|
-
function readNodeValue(store, base, nodeId) {
|
|
6787
|
-
return store[nodeScopedKey(base, nodeId)];
|
|
6788
|
-
}
|
|
6789
|
-
/**
|
|
6790
|
-
* Re-map a UI/settings patch so every bare perNode field persists under the
|
|
6791
|
-
* TARGET node's scoped key; all other keys pass through unchanged. Used on
|
|
6792
|
-
* the write path so a save for one node never clobbers another node's value
|
|
6793
|
-
* (and the bare key is never written). Returns a new object — the input
|
|
6794
|
-
* patch is not mutated.
|
|
6795
|
-
*/
|
|
6796
|
-
function scopePatch(patch, perNodeKeys, nodeId) {
|
|
6797
|
-
const out = {};
|
|
6798
|
-
for (const [key, value] of Object.entries(patch)) out[perNodeKeys.has(key) ? nodeScopedKey(key, nodeId) : key] = value;
|
|
6799
|
-
return out;
|
|
6800
|
-
}
|
|
6801
|
-
/**
|
|
6802
|
-
* Project the raw shared store onto the bare schema keys for ONE node so a
|
|
6803
|
-
* UI schema (whose field keys are bare) hydrates from that node's own
|
|
6804
|
-
* values:
|
|
6805
|
-
*
|
|
6806
|
-
* - EVERY `@`-scoped key (any node's) is dropped from the pass-through.
|
|
6807
|
-
* - Every bare perNode key is dropped from the pass-through (a stray bare
|
|
6808
|
-
* legacy key must never hydrate any node — no bare fallback).
|
|
6809
|
-
* - THIS node's effective value ({@link readNodeValue}) is then laid onto
|
|
6810
|
-
* each bare perNode key; when the node has no scoped key the bare key is
|
|
6811
|
-
* left ABSENT so the field's schema `default` wins.
|
|
6812
|
-
*
|
|
6813
|
-
* Returns a new object — the input store is not mutated.
|
|
6814
|
-
*/
|
|
6815
|
-
function projectStore(store, perNodeKeys, nodeId) {
|
|
6816
|
-
const out = {};
|
|
6817
|
-
for (const [key, value] of Object.entries(store)) {
|
|
6818
|
-
if (key.includes("@")) continue;
|
|
6819
|
-
if (perNodeKeys.has(key)) continue;
|
|
6820
|
-
out[key] = value;
|
|
6727
|
+
var PREFIX$1 = "records/";
|
|
6728
|
+
/** The base of every records failure. `detail` is the human part of the message. */
|
|
6729
|
+
var RecordsError = class extends Error {
|
|
6730
|
+
code;
|
|
6731
|
+
detail;
|
|
6732
|
+
constructor(code, detail) {
|
|
6733
|
+
super(`${PREFIX$1}${code}: ${detail}`);
|
|
6734
|
+
this.name = "RecordsError";
|
|
6735
|
+
this.code = code;
|
|
6736
|
+
this.detail = detail;
|
|
6821
6737
|
}
|
|
6822
|
-
|
|
6823
|
-
|
|
6824
|
-
|
|
6738
|
+
};
|
|
6739
|
+
/** A write guarded by `ifRev` found another revision (or an existing row for `ifRev: 0`). */
|
|
6740
|
+
var RevConflictError = class extends RecordsError {
|
|
6741
|
+
constructor(detail) {
|
|
6742
|
+
super("rev-conflict", detail);
|
|
6743
|
+
this.name = "RevConflictError";
|
|
6825
6744
|
}
|
|
6826
|
-
|
|
6745
|
+
};
|
|
6746
|
+
/** The keychain could not store or serve a value: explicit, never an empty string. */
|
|
6747
|
+
var RecordSecretUnavailableError = class extends RecordsError {
|
|
6748
|
+
constructor(detail) {
|
|
6749
|
+
super("secret-unavailable", detail);
|
|
6750
|
+
this.name = "RecordSecretUnavailableError";
|
|
6751
|
+
}
|
|
6752
|
+
};
|
|
6753
|
+
var InvalidRecordError = class extends RecordsError {
|
|
6754
|
+
constructor(detail) {
|
|
6755
|
+
super("invalid-record", detail);
|
|
6756
|
+
this.name = "InvalidRecordError";
|
|
6757
|
+
}
|
|
6758
|
+
};
|
|
6759
|
+
/** A kind declaration the engine refuses (non-additive change, bad shape, wrong file). */
|
|
6760
|
+
var DeclarationRefusedError = class extends RecordsError {
|
|
6761
|
+
constructor(detail) {
|
|
6762
|
+
super("declaration-refused", detail);
|
|
6763
|
+
this.name = "DeclarationRefusedError";
|
|
6764
|
+
}
|
|
6765
|
+
};
|
|
6766
|
+
function linkTargetOf(meta) {
|
|
6767
|
+
if (typeof meta !== "object" || meta === null) return void 0;
|
|
6768
|
+
const link = Reflect.get(meta, "link");
|
|
6769
|
+
const parsed = LinkTargetSchema.safeParse(link);
|
|
6770
|
+
return parsed.success ? parsed.data : void 0;
|
|
6771
|
+
}
|
|
6772
|
+
var LinkTargetSchema = object({
|
|
6773
|
+
cap: string().min(1),
|
|
6774
|
+
kind: string().min(1).optional()
|
|
6775
|
+
});
|
|
6776
|
+
/** The links a kind declares, read from the meta of its body fields. */
|
|
6777
|
+
function linksOfKind(kind) {
|
|
6778
|
+
const schema = kind.schema;
|
|
6779
|
+
if (!(schema instanceof ZodObject)) return [];
|
|
6780
|
+
const links = [];
|
|
6781
|
+
for (const [field, fieldSchema] of Object.entries(schema.shape)) {
|
|
6782
|
+
const to = linkTargetOf(globalRegistry.get(fieldSchema));
|
|
6783
|
+
if (to !== void 0) links.push({
|
|
6784
|
+
field,
|
|
6785
|
+
to
|
|
6786
|
+
});
|
|
6787
|
+
}
|
|
6788
|
+
return links;
|
|
6827
6789
|
}
|
|
6828
6790
|
/**
|
|
6829
6791
|
* The address of one keychain value: `secret://<owner>/<scope>/<fieldPath>`.
|
|
@@ -6959,6 +6921,643 @@ function parseSecretRef(ref) {
|
|
|
6959
6921
|
fieldPath
|
|
6960
6922
|
};
|
|
6961
6923
|
}
|
|
6924
|
+
/** Limits and names of `ctx.records` (D881). One authority; the engine and the facade read it. */
|
|
6925
|
+
/** The files a kind may live in. `history` is device-history's (D850), never records. */
|
|
6926
|
+
var RECORD_DATABASES = ["settings", "events"];
|
|
6927
|
+
/** The classes of a kind: the `@durable` vocabulary, one authority (replaces the annotation). */
|
|
6928
|
+
var RECORD_CLASSES = [
|
|
6929
|
+
"config",
|
|
6930
|
+
"ledger",
|
|
6931
|
+
"audit",
|
|
6932
|
+
"mirror",
|
|
6933
|
+
"ephemeral"
|
|
6934
|
+
];
|
|
6935
|
+
var RECORD_DEFAULT_MAX_DATA_BYTES = 64 * 1024;
|
|
6936
|
+
var RECORD_MAX_DATA_BYTES = 1024 * 1024;
|
|
6937
|
+
var RECORD_BATCH_MAX = 1e3;
|
|
6938
|
+
var RECORD_QUERY_MAX = 1e3;
|
|
6939
|
+
/** A kind in the `settings` file may not bound itself above this (D447: high volume is `events`). */
|
|
6940
|
+
var RECORD_SETTINGS_MAX_ROWS = 5e4;
|
|
6941
|
+
/** The `Column`-free proof prefix: a ref collection for a kind's secret fields. */
|
|
6942
|
+
var RECORD_SECRET_COLLECTION_PREFIX = "records:";
|
|
6943
|
+
/**
|
|
6944
|
+
* Secret fields of a record, addressed the way a Zod schema declares them
|
|
6945
|
+
* (`collectZodSecretPaths`): dotted keys, `[]` for "each element of this array"
|
|
6946
|
+
* (`auth.accessToken`, `headers[].value`).
|
|
6947
|
+
*
|
|
6948
|
+
* `{}` after a key means "each value of this map" (`applianceSecrets{}`): the map's own key
|
|
6949
|
+
* names the value (`applianceSecrets{fridge}`), so no id key is declared and a body that drops a
|
|
6950
|
+
* key releases exactly that key's secret.
|
|
6951
|
+
*
|
|
6952
|
+
* Array elements are matched by a DECLARED id key (`secretArrayKeys`:
|
|
6953
|
+
* `{ headers: 'name' }`), never by index, so reordering a list keeps every
|
|
6954
|
+
* keychain ref (the same rule as `arrayItemFieldPath`). The concrete path of a
|
|
6955
|
+
* leaf names its element: `headers[X-Api].value`.
|
|
6956
|
+
*
|
|
6957
|
+
* Pure and browser-safe. Nothing here mutates: every transform returns a new value.
|
|
6958
|
+
*/
|
|
6959
|
+
/** The array prefixes (declared form, e.g. `headers` or `a.headers`) of a path. */
|
|
6960
|
+
function parseSecretPath(path) {
|
|
6961
|
+
if (path.length === 0) throw new InvalidRecordError("an empty secret path");
|
|
6962
|
+
return path.split(".").map((raw) => {
|
|
6963
|
+
const each = raw.endsWith("[]");
|
|
6964
|
+
const map = raw.endsWith("{}");
|
|
6965
|
+
const key = each || map ? raw.slice(0, -2) : raw;
|
|
6966
|
+
if (key.length === 0) throw new InvalidRecordError(`secret path "${path}" has an empty segment`);
|
|
6967
|
+
return {
|
|
6968
|
+
key,
|
|
6969
|
+
each,
|
|
6970
|
+
map
|
|
6971
|
+
};
|
|
6972
|
+
});
|
|
6973
|
+
}
|
|
6974
|
+
/** The declared array prefixes of `path` that need an id key (`headers`, `a.rows`). */
|
|
6975
|
+
function secretArrayPrefixes(path) {
|
|
6976
|
+
const segments = parseSecretPath(path);
|
|
6977
|
+
const prefixes = [];
|
|
6978
|
+
const walked = [];
|
|
6979
|
+
for (const segment of segments) {
|
|
6980
|
+
walked.push(segment.key);
|
|
6981
|
+
if (segment.each) prefixes.push(walked.join("."));
|
|
6982
|
+
}
|
|
6983
|
+
return prefixes;
|
|
6984
|
+
}
|
|
6985
|
+
function isRecord$6(value) {
|
|
6986
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6987
|
+
}
|
|
6988
|
+
function elementId(element, idKey, declared, prefix) {
|
|
6989
|
+
const id = isRecord$6(element) ? element[idKey] : void 0;
|
|
6990
|
+
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`);
|
|
6991
|
+
return id;
|
|
6992
|
+
}
|
|
6993
|
+
/**
|
|
6994
|
+
* Visit every secret leaf PRESENT in `data` (an absent branch has nothing to
|
|
6995
|
+
* visit). `replace` returns the new leaf value, or {@link REMOVE_LEAF}; the
|
|
6996
|
+
* result is a new body, `data` is untouched.
|
|
6997
|
+
*/
|
|
6998
|
+
var REMOVE_LEAF = Symbol("remove-leaf");
|
|
6999
|
+
function mapAt(node, segments, index, walkedKeys, concretePrefix, declared, arrayKeys, visit) {
|
|
7000
|
+
if (!isRecord$6(node)) return node;
|
|
7001
|
+
const segment = segments[index];
|
|
7002
|
+
if (segment === void 0) return node;
|
|
7003
|
+
if (!Object.prototype.hasOwnProperty.call(node, segment.key)) return node;
|
|
7004
|
+
const child = node[segment.key];
|
|
7005
|
+
const keys = [...walkedKeys, segment.key];
|
|
7006
|
+
const last = index === segments.length - 1;
|
|
7007
|
+
if (segment.each) {
|
|
7008
|
+
if (!Array.isArray(child)) return node;
|
|
7009
|
+
const prefix = keys.join(".");
|
|
7010
|
+
const idKey = arrayKeys[prefix];
|
|
7011
|
+
if (idKey === void 0) throw new InvalidRecordError(`"${declared}": no id key declared for the array "${prefix}"`);
|
|
7012
|
+
const mapped = child.map((element) => {
|
|
7013
|
+
const id = elementId(element, idKey, declared, prefix);
|
|
7014
|
+
const concrete = `${concretePrefix}${concretePrefix.length > 0 ? "." : ""}${segment.key}[${encodeURIComponent(id)}]`;
|
|
7015
|
+
return last ? element : mapAt(element, segments, index + 1, keys, concrete, declared, arrayKeys, visit);
|
|
7016
|
+
});
|
|
7017
|
+
return {
|
|
7018
|
+
...node,
|
|
7019
|
+
[segment.key]: mapped
|
|
7020
|
+
};
|
|
7021
|
+
}
|
|
7022
|
+
if (segment.map) {
|
|
7023
|
+
if (!isRecord$6(child)) return node;
|
|
7024
|
+
const kept = Object.entries(child).map(([mapKey, value]) => {
|
|
7025
|
+
const concrete = `${concretePrefix}${concretePrefix.length > 0 ? "." : ""}${segment.key}{${encodeURIComponent(mapKey)}}`;
|
|
7026
|
+
if (!last) return [mapKey, mapAt(value, segments, index + 1, keys, concrete, declared, arrayKeys, visit)];
|
|
7027
|
+
return [mapKey, visit({
|
|
7028
|
+
declared,
|
|
7029
|
+
concrete,
|
|
7030
|
+
value
|
|
7031
|
+
})];
|
|
7032
|
+
}).filter(([, value]) => value !== REMOVE_LEAF);
|
|
7033
|
+
return {
|
|
7034
|
+
...node,
|
|
7035
|
+
[segment.key]: Object.fromEntries(kept)
|
|
7036
|
+
};
|
|
7037
|
+
}
|
|
7038
|
+
const concrete = `${concretePrefix}${concretePrefix.length > 0 ? "." : ""}${segment.key}`;
|
|
7039
|
+
if (last) {
|
|
7040
|
+
const replacement = visit({
|
|
7041
|
+
declared,
|
|
7042
|
+
concrete,
|
|
7043
|
+
value: child
|
|
7044
|
+
});
|
|
7045
|
+
if (replacement === REMOVE_LEAF) return Object.fromEntries(Object.entries(node).filter(([key]) => key !== segment.key));
|
|
7046
|
+
return {
|
|
7047
|
+
...node,
|
|
7048
|
+
[segment.key]: replacement
|
|
7049
|
+
};
|
|
7050
|
+
}
|
|
7051
|
+
return {
|
|
7052
|
+
...node,
|
|
7053
|
+
[segment.key]: mapAt(child, segments, index + 1, keys, concrete, declared, arrayKeys, visit)
|
|
7054
|
+
};
|
|
7055
|
+
}
|
|
7056
|
+
/** Replace/remove every present secret leaf; returns a NEW body. */
|
|
7057
|
+
function mapSecretLeaves(data, paths, arrayKeys, visit) {
|
|
7058
|
+
let current = data;
|
|
7059
|
+
for (const declared of paths) current = mapAt(current, parseSecretPath(declared), 0, [], "", declared, arrayKeys, visit);
|
|
7060
|
+
return current;
|
|
7061
|
+
}
|
|
7062
|
+
/**
|
|
7063
|
+
* The keychain collection name a kind's secrets live under. Prefixed so a
|
|
7064
|
+
* record's refs never collide with the refs a legacy collection of the same name
|
|
7065
|
+
* already holds during an adoption.
|
|
7066
|
+
*/
|
|
7067
|
+
function recordSecretCollection(kind) {
|
|
7068
|
+
return `${RECORD_SECRET_COLLECTION_PREFIX}${kind}`;
|
|
7069
|
+
}
|
|
7070
|
+
/** The ONE ref a row's secret field may carry: the engine and the facade both build it here. */
|
|
7071
|
+
function recordSecretRef(owner, kind, rowId, concretePath) {
|
|
7072
|
+
return buildSecretRef({
|
|
7073
|
+
owner,
|
|
7074
|
+
scope: {
|
|
7075
|
+
kind: "row",
|
|
7076
|
+
collection: recordSecretCollection(kind),
|
|
7077
|
+
rowId
|
|
7078
|
+
},
|
|
7079
|
+
fieldPath: concretePath
|
|
7080
|
+
});
|
|
7081
|
+
}
|
|
7082
|
+
/**
|
|
7083
|
+
* A stored secret, as an admin read shows it: a VIEW naming the row's own
|
|
7084
|
+
* keychain ref (`set: true`), never the value and no longer the bare redaction
|
|
7085
|
+
* token. The form hands it to the secret field, which reveals the value by ref
|
|
7086
|
+
* through the audited `keychain-admin.reveal`; sent back untouched it keeps the
|
|
7087
|
+
* stored secret (the records door reads a view as KEEP).
|
|
7088
|
+
*
|
|
7089
|
+
* ONE implementation for the entries service and for every addon that serves
|
|
7090
|
+
* its own instances (`RecordIntegrationInstances`).
|
|
7091
|
+
*/
|
|
7092
|
+
function isRecord$5(value) {
|
|
7093
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
7094
|
+
}
|
|
7095
|
+
function secretViewsOf(owner, kind, id, decl, data) {
|
|
7096
|
+
if (decl.secretPaths.length === 0) return data;
|
|
7097
|
+
const shown = mapSecretLeaves(data, decl.secretPaths, decl.secretArrayKeys, (leaf) => {
|
|
7098
|
+
if (leaf.value !== "__camstack_redacted__") return leaf.value;
|
|
7099
|
+
return {
|
|
7100
|
+
$secret: recordSecretRef(owner, kind, id, leaf.concrete),
|
|
7101
|
+
v: 1,
|
|
7102
|
+
set: true
|
|
7103
|
+
};
|
|
7104
|
+
});
|
|
7105
|
+
return isRecord$5(shown) ? shown : data;
|
|
7106
|
+
}
|
|
7107
|
+
/** The most instances one addon lists (an integrations page, not a table). */
|
|
7108
|
+
var INSTANCES_LIST_MAX = 1e3;
|
|
7109
|
+
/**
|
|
7110
|
+
* The ONE reader of an instance's switch (D996): an absent field means on, so a row written
|
|
7111
|
+
* before the field existed needs no migration. Every consumer of an instance body asks this.
|
|
7112
|
+
*/
|
|
7113
|
+
function isInstanceEnabled(body) {
|
|
7114
|
+
return body.enabled !== false;
|
|
7115
|
+
}
|
|
7116
|
+
/** The body key of the switch; only {@link RecordIntegrationInstances.setInstanceEnabled} writes it. */
|
|
7117
|
+
var SWITCH_KEY = "enabled";
|
|
7118
|
+
/** The keys of the kind's secret fields that sit at the top level of the body. */
|
|
7119
|
+
function topLevelSecretKeys(paths) {
|
|
7120
|
+
return new Set(paths.filter((p) => !p.includes(".") && !p.includes("[") && !p.includes("{")));
|
|
7121
|
+
}
|
|
7122
|
+
/** The keys of the kind's top-level MAPS whose values are secrets (`applianceSecrets{}`). */
|
|
7123
|
+
function secretMapKeys(paths) {
|
|
7124
|
+
return new Set(paths.filter((p) => p.endsWith("{}") && !p.slice(0, -2).match(/[.[{]/)).map((p) => p.slice(0, -2)));
|
|
7125
|
+
}
|
|
7126
|
+
/**
|
|
7127
|
+
* A patch value for a map of secrets: an entry that is omitted, `''`, the redaction token or the
|
|
7128
|
+
* view the form was given KEEPS its stored secret (it is left out of the merge); `{ $secretClear }`
|
|
7129
|
+
* or `null` removes the entry; any other string replaces it. Null when nothing is left to merge.
|
|
7130
|
+
*/
|
|
7131
|
+
function secretMapPatch(value) {
|
|
7132
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) return null;
|
|
7133
|
+
const out = {};
|
|
7134
|
+
for (const [key, entry] of Object.entries(value)) if (entry === null || isSecretClear(entry)) out[key] = null;
|
|
7135
|
+
else if (typeof entry === "string" && entry !== "" && entry !== "__camstack_redacted__" && !isSecretFieldView(entry)) out[key] = entry;
|
|
7136
|
+
return Object.keys(out).length > 0 ? out : null;
|
|
7137
|
+
}
|
|
7138
|
+
var RecordIntegrationInstances = class {
|
|
7139
|
+
records;
|
|
7140
|
+
kind;
|
|
7141
|
+
hooks;
|
|
7142
|
+
handle;
|
|
7143
|
+
secretKeys;
|
|
7144
|
+
secretMaps;
|
|
7145
|
+
nameField;
|
|
7146
|
+
switchListeners = /* @__PURE__ */ new Set();
|
|
7147
|
+
constructor(records, kind, hooks) {
|
|
7148
|
+
this.records = records;
|
|
7149
|
+
this.kind = kind;
|
|
7150
|
+
this.hooks = hooks;
|
|
7151
|
+
this.handle = records.kind(kind);
|
|
7152
|
+
this.secretKeys = topLevelSecretKeys(kind.declaration.secretPaths);
|
|
7153
|
+
this.secretMaps = secretMapKeys(kind.declaration.secretPaths);
|
|
7154
|
+
this.nameField = kind.declaration.entry?.nameField ?? "name";
|
|
7155
|
+
}
|
|
7156
|
+
/**
|
|
7157
|
+
* One instance read for the addon's own runtime; null when absent. When the keychain is
|
|
7158
|
+
* locked the row is served WITHOUT its secrets and says so (`secrets: 'unavailable'`), so the
|
|
7159
|
+
* caller can keep what it had instead of reconfiguring with an empty secret (D49).
|
|
7160
|
+
*/
|
|
7161
|
+
async readResolved(id) {
|
|
7162
|
+
try {
|
|
7163
|
+
const record = await this.handle.getResolved(id);
|
|
7164
|
+
return record === null ? null : {
|
|
7165
|
+
id,
|
|
7166
|
+
body: record.data,
|
|
7167
|
+
enabled: isInstanceEnabled(record.data),
|
|
7168
|
+
secrets: "resolved"
|
|
7169
|
+
};
|
|
7170
|
+
} catch (err) {
|
|
7171
|
+
if (!(err instanceof RecordSecretUnavailableError)) throw err;
|
|
7172
|
+
const stored = await this.handle.get(id);
|
|
7173
|
+
if (stored === null) return null;
|
|
7174
|
+
return {
|
|
7175
|
+
id,
|
|
7176
|
+
body: Object.fromEntries(Object.entries(stored.data).filter(([key]) => !this.secretKeys.has(key))),
|
|
7177
|
+
enabled: isInstanceEnabled(stored.data),
|
|
7178
|
+
secrets: "unavailable"
|
|
7179
|
+
};
|
|
7180
|
+
}
|
|
7181
|
+
}
|
|
7182
|
+
/** The body of {@link readResolved} alone; a locked keychain yields the row without secrets. */
|
|
7183
|
+
async getResolved(id) {
|
|
7184
|
+
return (await this.readResolved(id))?.body ?? null;
|
|
7185
|
+
}
|
|
7186
|
+
/** Every instance, secrets resolved where the keychain allows; an absent one is skipped. */
|
|
7187
|
+
async listResolved() {
|
|
7188
|
+
const page = await this.handle.query({ limit: INSTANCES_LIST_MAX });
|
|
7189
|
+
const out = [];
|
|
7190
|
+
for (const record of page.records) {
|
|
7191
|
+
const read = await this.readResolved(record.id);
|
|
7192
|
+
if (read !== null) out.push(read);
|
|
7193
|
+
}
|
|
7194
|
+
return out;
|
|
7195
|
+
}
|
|
7196
|
+
viewOf(record) {
|
|
7197
|
+
const shown = secretViewsOf(this.records.owner, this.kind.name, record.id, this.kind.declaration, record.data);
|
|
7198
|
+
const rawName = record.data[this.nameField];
|
|
7199
|
+
const kind = this.hooks.kindOf?.(record.data);
|
|
7200
|
+
const health = this.hooks.health?.(record.data, record.id);
|
|
7201
|
+
return {
|
|
7202
|
+
id: record.id,
|
|
7203
|
+
name: typeof rawName === "string" ? rawName : record.id,
|
|
7204
|
+
configured: this.hooks.configured(record.data),
|
|
7205
|
+
enabled: isInstanceEnabled(record.data),
|
|
7206
|
+
formValues: shown,
|
|
7207
|
+
...kind !== void 0 ? { kind } : {},
|
|
7208
|
+
...health?.status !== void 0 ? { status: health.status } : {},
|
|
7209
|
+
...health?.lastCheckedAt !== void 0 ? { lastCheckedAt: health.lastCheckedAt } : {}
|
|
7210
|
+
};
|
|
7211
|
+
}
|
|
7212
|
+
describe = async () => {
|
|
7213
|
+
const declared = linksOfKind(this.kind);
|
|
7214
|
+
const links = this.hooks.description.links !== void 0 || declared.length === 0 ? {} : { links: declared.map((link) => ({
|
|
7215
|
+
kind: this.kind.name,
|
|
7216
|
+
field: link.field,
|
|
7217
|
+
to: link.to
|
|
7218
|
+
})) };
|
|
7219
|
+
return {
|
|
7220
|
+
...this.hooks.description,
|
|
7221
|
+
...links,
|
|
7222
|
+
...this.hooks.mintId === void 0 ? {} : { mintsId: true }
|
|
7223
|
+
};
|
|
7224
|
+
};
|
|
7225
|
+
instanceFormSchema = async ({ id }) => this.hooks.formSchema(id);
|
|
7226
|
+
listInstances = async () => {
|
|
7227
|
+
return (await this.handle.query({ limit: INSTANCES_LIST_MAX })).records.map((record) => this.viewOf(record));
|
|
7228
|
+
};
|
|
7229
|
+
getInstance = async ({ id }) => {
|
|
7230
|
+
const record = await this.handle.get(id);
|
|
7231
|
+
return record === null ? null : this.viewOf(record);
|
|
7232
|
+
};
|
|
7233
|
+
/** Insert ONE row (`ifRev: 0`: an existing id is refused, never overwritten). */
|
|
7234
|
+
createInstance = async ({ id, name, kind, values }) => {
|
|
7235
|
+
const minted = id ?? this.hooks.mintId?.({
|
|
7236
|
+
name,
|
|
7237
|
+
...kind !== void 0 ? { kind } : {}
|
|
7238
|
+
});
|
|
7239
|
+
if (minted === void 0) throw new Error("createInstance needs an id: this provider does not mint one");
|
|
7240
|
+
await this.handle.put({
|
|
7241
|
+
id: minted,
|
|
7242
|
+
data: this.hooks.initialBody(name, kind)
|
|
7243
|
+
}, { ifRev: 0 });
|
|
7244
|
+
const patch = this.patchOf(values ?? {});
|
|
7245
|
+
if (Object.keys(patch).length > 0) await this.handle.patch(minted, patch);
|
|
7246
|
+
await this.hooks.onChanged?.(minted, "created");
|
|
7247
|
+
return { id: minted };
|
|
7248
|
+
};
|
|
7249
|
+
updateInstance = async ({ id, name, values }) => {
|
|
7250
|
+
const patch = this.patchOf(values);
|
|
7251
|
+
if (name !== void 0) patch[this.nameField] = name;
|
|
7252
|
+
await this.handle.patch(id, patch);
|
|
7253
|
+
await this.hooks.onChanged?.(id, "updated");
|
|
7254
|
+
return { ok: true };
|
|
7255
|
+
};
|
|
7256
|
+
/** The record patch a form `values` object means: secrets kept, cleared or replaced. */
|
|
7257
|
+
patchOf(values) {
|
|
7258
|
+
const patch = {};
|
|
7259
|
+
for (const [key, value] of Object.entries(values)) {
|
|
7260
|
+
if (value === void 0) continue;
|
|
7261
|
+
if (key === "enabled") continue;
|
|
7262
|
+
if (this.secretMaps.has(key)) {
|
|
7263
|
+
const entries = secretMapPatch(value);
|
|
7264
|
+
if (entries !== null) patch[key] = entries;
|
|
7265
|
+
} else if (!this.secretKeys.has(key)) patch[key] = value;
|
|
7266
|
+
else if (isSecretClear(value)) patch[key] = null;
|
|
7267
|
+
else if (typeof value === "string" && value !== "" && value !== "__camstack_redacted__" && !isSecretFieldView(value)) patch[key] = value;
|
|
7268
|
+
}
|
|
7269
|
+
return patch;
|
|
7270
|
+
}
|
|
7271
|
+
/**
|
|
7272
|
+
* Listen to the switch of ANY instance of this helper (in the process that serves it). The
|
|
7273
|
+
* durable replacement of the `integration.enabled` / `integration.disabled` events (D8): the
|
|
7274
|
+
* addon reconciles from the record, whichever way it flipped.
|
|
7275
|
+
*/
|
|
7276
|
+
onSwitched(listener) {
|
|
7277
|
+
this.switchListeners.add(listener);
|
|
7278
|
+
}
|
|
7279
|
+
/**
|
|
7280
|
+
* The ONE writer of the switch (D996, D1014): the record body's `enabled`, for every role. A
|
|
7281
|
+
* configured thing is an instance, so an id with no record yet (a default integration that was
|
|
7282
|
+
* never configured) gets its record from `initialBody` before the switch is written.
|
|
7283
|
+
*/
|
|
7284
|
+
setInstanceEnabled = async ({ id, enabled }) => {
|
|
7285
|
+
if (await this.handle.get(id) === null) await this.handle.put({
|
|
7286
|
+
id,
|
|
7287
|
+
data: this.hooks.initialBody(id)
|
|
7288
|
+
}, { ifRev: 0 });
|
|
7289
|
+
await this.handle.patch(id, { [SWITCH_KEY]: enabled });
|
|
7290
|
+
await this.hooks.onChanged?.(id, "enabled");
|
|
7291
|
+
for (const listener of this.switchListeners) await listener(id, enabled);
|
|
7292
|
+
return { ok: true };
|
|
7293
|
+
};
|
|
7294
|
+
/** The row and its keychain refs go together (the records door). */
|
|
7295
|
+
deleteInstance = async ({ id }) => {
|
|
7296
|
+
await this.handle.delete(id);
|
|
7297
|
+
await this.hooks.onChanged?.(id, "deleted");
|
|
7298
|
+
return { ok: true };
|
|
7299
|
+
};
|
|
7300
|
+
testInstance = async (input) => {
|
|
7301
|
+
if (this.hooks.test === void 0) return {
|
|
7302
|
+
success: false,
|
|
7303
|
+
status: "unsupported",
|
|
7304
|
+
error: "This integration declares no connection test"
|
|
7305
|
+
};
|
|
7306
|
+
return this.hooks.test(input);
|
|
7307
|
+
};
|
|
7308
|
+
/** The flat provider object to hand to `registerProvider`. */
|
|
7309
|
+
toProvider() {
|
|
7310
|
+
return {
|
|
7311
|
+
describe: this.describe,
|
|
7312
|
+
instanceFormSchema: this.instanceFormSchema,
|
|
7313
|
+
listInstances: this.listInstances,
|
|
7314
|
+
getInstance: this.getInstance,
|
|
7315
|
+
createInstance: this.createInstance,
|
|
7316
|
+
updateInstance: this.updateInstance,
|
|
7317
|
+
setInstanceEnabled: this.setInstanceEnabled,
|
|
7318
|
+
deleteInstance: this.deleteInstance,
|
|
7319
|
+
testInstance: this.testInstance
|
|
7320
|
+
};
|
|
7321
|
+
}
|
|
7322
|
+
};
|
|
7323
|
+
/**
|
|
7324
|
+
* The one-switch migration (epic #440, step 3). An integration's on/off state used to live in the
|
|
7325
|
+
* registry's `enabled` column for a device addon; it now lives only in the instance record's
|
|
7326
|
+
* body (`enabled`, D1007 superseded). This moves a registry `enabled = false` into the body, once.
|
|
7327
|
+
*
|
|
7328
|
+
* For every registry row of the addon that is OFF:
|
|
7329
|
+
* - no record under its id: the record is created from `initialBody(name)` with `enabled: false`
|
|
7330
|
+
* (a default integration that never had settings, Reolink's among them);
|
|
7331
|
+
* - a record whose body states no `enabled`: `enabled: false` is written into it;
|
|
7332
|
+
* - a record that already states `enabled` (either way) is the newer truth and is left alone.
|
|
7333
|
+
* A row that is ON writes nothing: an absent field reads as on. A rerun finds every off row with
|
|
7334
|
+
* a stated switch and does nothing, so nothing switched off comes back on and nothing switched on
|
|
7335
|
+
* goes off. The registry column itself is neither read afterwards nor written; its drop is step 5.
|
|
7336
|
+
*
|
|
7337
|
+
* It runs in the addon process, BEFORE the addon registers its `integration-instances` provider,
|
|
7338
|
+
* which is also why `integrations.list` still answers the stored column at that point.
|
|
7339
|
+
*/
|
|
7340
|
+
function registrySwitchToBodyId(addonId, date) {
|
|
7341
|
+
return `${addonId}/${date}-registry-switch-to-body`;
|
|
7342
|
+
}
|
|
7343
|
+
async function moveRegistrySwitchToBody(ports, spec) {
|
|
7344
|
+
const rows = await ports.listIntegrations(spec.addonId);
|
|
7345
|
+
let created = 0;
|
|
7346
|
+
let switched = 0;
|
|
7347
|
+
let kept = 0;
|
|
7348
|
+
for (const row of rows) {
|
|
7349
|
+
if (row.enabled) continue;
|
|
7350
|
+
const body = await ports.readBody(row.id);
|
|
7351
|
+
if (body === null) {
|
|
7352
|
+
if (await ports.createRecord(row.id, {
|
|
7353
|
+
...spec.initialBody(row.name),
|
|
7354
|
+
["enabled"]: false
|
|
7355
|
+
}) === "created") created += 1;
|
|
7356
|
+
else kept += 1;
|
|
7357
|
+
continue;
|
|
7358
|
+
}
|
|
7359
|
+
if ("enabled" in body) {
|
|
7360
|
+
kept += 1;
|
|
7361
|
+
continue;
|
|
7362
|
+
}
|
|
7363
|
+
await ports.switchOff(row.id);
|
|
7364
|
+
switched += 1;
|
|
7365
|
+
}
|
|
7366
|
+
const summary = {
|
|
7367
|
+
integrations: rows.length,
|
|
7368
|
+
off: rows.filter((r) => !r.enabled).length,
|
|
7369
|
+
created,
|
|
7370
|
+
switched,
|
|
7371
|
+
kept
|
|
7372
|
+
};
|
|
7373
|
+
return created === 0 && switched === 0 ? {
|
|
7374
|
+
outcome: "already-done",
|
|
7375
|
+
summary
|
|
7376
|
+
} : {
|
|
7377
|
+
outcome: "done",
|
|
7378
|
+
summary
|
|
7379
|
+
};
|
|
7380
|
+
}
|
|
7381
|
+
/** A migration entry: an addon states its kind and how a new body starts, nothing else. */
|
|
7382
|
+
function registrySwitchToBodyMigration(spec) {
|
|
7383
|
+
return {
|
|
7384
|
+
meta: {
|
|
7385
|
+
id: registrySwitchToBodyId(spec.addonId, spec.date),
|
|
7386
|
+
owner: spec.addonId,
|
|
7387
|
+
level: "addon-state",
|
|
7388
|
+
seq: spec.seq,
|
|
7389
|
+
dependsOn: [],
|
|
7390
|
+
store: "settings",
|
|
7391
|
+
scope: "cluster",
|
|
7392
|
+
onFailure: "block-owner",
|
|
7393
|
+
bodyKind: "procedure",
|
|
7394
|
+
description: "Move the registry enabled flag of every switched-off integration into its instance record body, creating the record when there is none",
|
|
7395
|
+
fixtureMark: "enabled"
|
|
7396
|
+
},
|
|
7397
|
+
procedure: (ports) => moveRegistrySwitchToBody(ports, {
|
|
7398
|
+
addonId: spec.addonId,
|
|
7399
|
+
initialBody: spec.initialBody
|
|
7400
|
+
})
|
|
7401
|
+
};
|
|
7402
|
+
}
|
|
7403
|
+
/** The hub and records sides of {@link registrySwitchToBodyMigration}. */
|
|
7404
|
+
function registrySwitchPortsOver(deps) {
|
|
7405
|
+
const handle = deps.records.kind({
|
|
7406
|
+
name: deps.kind.name,
|
|
7407
|
+
declaration: deps.kind.declaration,
|
|
7408
|
+
schema: record(string(), unknown())
|
|
7409
|
+
});
|
|
7410
|
+
return {
|
|
7411
|
+
listIntegrations: async (addonId) => (await deps.api.list()).filter((i) => i.addonId === addonId).map((i) => ({
|
|
7412
|
+
id: i.id,
|
|
7413
|
+
name: i.name,
|
|
7414
|
+
enabled: i.enabled !== false
|
|
7415
|
+
})),
|
|
7416
|
+
readBody: async (id) => (await handle.get(id))?.data ?? null,
|
|
7417
|
+
createRecord: async (id, body) => {
|
|
7418
|
+
if (await handle.get(id) !== null) return "exists";
|
|
7419
|
+
await handle.put({
|
|
7420
|
+
id,
|
|
7421
|
+
data: body
|
|
7422
|
+
}, { ifRev: 0 });
|
|
7423
|
+
return "created";
|
|
7424
|
+
},
|
|
7425
|
+
switchOff: async (id) => {
|
|
7426
|
+
await handle.patch(id, { [SWITCH_KEY]: false });
|
|
7427
|
+
}
|
|
7428
|
+
};
|
|
7429
|
+
}
|
|
7430
|
+
/**
|
|
7431
|
+
* Build a {@link DurableState} over a single store key. Transport-agnostic:
|
|
7432
|
+
* `read`/`write` are the addon-store or device-store accessors. The whole
|
|
7433
|
+
* validated value round-trips on every read/write — the schema is the
|
|
7434
|
+
* single source of truth for what is persisted, so no hand-listed field
|
|
7435
|
+
* set can drop a key on save.
|
|
7436
|
+
*/
|
|
7437
|
+
function createDurableState(deps) {
|
|
7438
|
+
const get = async () => {
|
|
7439
|
+
const raw = (await deps.read())[deps.key];
|
|
7440
|
+
if (raw === void 0) return deps.fallback;
|
|
7441
|
+
const parsed = deps.schema.safeParse(raw);
|
|
7442
|
+
if (!parsed.success) {
|
|
7443
|
+
deps.onParseError?.(deps.key, parsed.error);
|
|
7444
|
+
return deps.fallback;
|
|
7445
|
+
}
|
|
7446
|
+
return parsed.data;
|
|
7447
|
+
};
|
|
7448
|
+
const set = async (next) => {
|
|
7449
|
+
const validated = deps.schema.parse(next);
|
|
7450
|
+
await deps.write({ [deps.key]: validated });
|
|
7451
|
+
};
|
|
7452
|
+
const update = async (fn) => {
|
|
7453
|
+
await set(fn(await get()));
|
|
7454
|
+
};
|
|
7455
|
+
return {
|
|
7456
|
+
get,
|
|
7457
|
+
set,
|
|
7458
|
+
update
|
|
7459
|
+
};
|
|
7460
|
+
}
|
|
7461
|
+
/**
|
|
7462
|
+
* Per-node scoping for the shared addon-settings blob.
|
|
7463
|
+
*
|
|
7464
|
+
* An addon's settings store is hub-central (the `addon-settings` cap is
|
|
7465
|
+
* hub-routed — the hub instance answers for every node), so fields whose
|
|
7466
|
+
* value is a NODE fact (decoder backend, engine pick, probed hardware
|
|
7467
|
+
* capabilities) persist under the node-scoped key `<key>@<nodeId>` inside
|
|
7468
|
+
* the single shared blob. The SCHEMA field key stays bare: the write path
|
|
7469
|
+
* ({@link scopePatch}) maps the bare field onto the target node's scoped
|
|
7470
|
+
* key; the read/hydrate path ({@link projectStore}) maps THIS node's value
|
|
7471
|
+
* back, so UI forms and `resolveConfig` only ever see the bare key.
|
|
7472
|
+
*
|
|
7473
|
+
* Fields opt in via the `perNode: true` schema marker on `ConfigFieldBase`
|
|
7474
|
+
* (`interfaces/config-ui.ts`); `BaseAddon` derives the key set from the
|
|
7475
|
+
* schema and routes reads/writes through these helpers.
|
|
7476
|
+
*
|
|
7477
|
+
* ## No bare-key fallback — deliberate
|
|
7478
|
+
*
|
|
7479
|
+
* {@link readNodeValue} reads the node-scoped key ONLY. A node with no
|
|
7480
|
+
* scoped key resolves to `undefined` so the field's schema `default` wins —
|
|
7481
|
+
* NEVER `store[base]` and never another node's value. A bare legacy key in
|
|
7482
|
+
* the store is invisible to every node, hub included, so one node's
|
|
7483
|
+
* selection can never leak onto another. (This generalizes the
|
|
7484
|
+
* `decoder-backend-keys.ts` semantics — the no-fallback variant — over an
|
|
7485
|
+
* arbitrary set of per-node field keys.)
|
|
7486
|
+
*
|
|
7487
|
+
* Pure functions only — no I/O, no imports beyond the language. This is a
|
|
7488
|
+
* LEAF module: import it via its deep path, never from the root barrel.
|
|
7489
|
+
*/
|
|
7490
|
+
/**
|
|
7491
|
+
* Normalize a raw kernel node id to the bare node id used for scoping.
|
|
7492
|
+
* `localNodeId` can carry a `<node>/<addon>` suffix on forked child
|
|
7493
|
+
* processes; per-node settings are per-NODE, so strip the addon segment.
|
|
7494
|
+
* `undefined` / `null` / empty falls back to `'hub'`.
|
|
7495
|
+
*/
|
|
7496
|
+
function normalizeNodeId(raw) {
|
|
7497
|
+
if (raw === void 0 || raw === null || raw === "") return "hub";
|
|
7498
|
+
const slashIdx = raw.indexOf("/");
|
|
7499
|
+
if (slashIdx < 0) return raw;
|
|
7500
|
+
const bare = raw.slice(0, slashIdx);
|
|
7501
|
+
return bare === "" ? "hub" : bare;
|
|
7502
|
+
}
|
|
7503
|
+
/** The node-scoped store key for a per-node field: `<base>@<nodeId>`. */
|
|
7504
|
+
function nodeScopedKey(base, nodeId) {
|
|
7505
|
+
return `${base}@${normalizeNodeId(nodeId)}`;
|
|
7506
|
+
}
|
|
7507
|
+
/**
|
|
7508
|
+
* Read a node's value for a per-node field from the raw shared store:
|
|
7509
|
+
* the node-scoped key when present, otherwise `undefined`.
|
|
7510
|
+
* Deliberately NO bare-key fallback (see module doc) — the caller lets the
|
|
7511
|
+
* schema `default` win on `undefined`.
|
|
7512
|
+
*/
|
|
7513
|
+
function readNodeValue(store, base, nodeId) {
|
|
7514
|
+
return store[nodeScopedKey(base, nodeId)];
|
|
7515
|
+
}
|
|
7516
|
+
/**
|
|
7517
|
+
* Re-map a UI/settings patch so every bare perNode field persists under the
|
|
7518
|
+
* TARGET node's scoped key; all other keys pass through unchanged. Used on
|
|
7519
|
+
* the write path so a save for one node never clobbers another node's value
|
|
7520
|
+
* (and the bare key is never written). Returns a new object — the input
|
|
7521
|
+
* patch is not mutated.
|
|
7522
|
+
*/
|
|
7523
|
+
function scopePatch(patch, perNodeKeys, nodeId) {
|
|
7524
|
+
const out = {};
|
|
7525
|
+
for (const [key, value] of Object.entries(patch)) out[perNodeKeys.has(key) ? nodeScopedKey(key, nodeId) : key] = value;
|
|
7526
|
+
return out;
|
|
7527
|
+
}
|
|
7528
|
+
/**
|
|
7529
|
+
* Project the raw shared store onto the bare schema keys for ONE node so a
|
|
7530
|
+
* UI schema (whose field keys are bare) hydrates from that node's own
|
|
7531
|
+
* values:
|
|
7532
|
+
*
|
|
7533
|
+
* - EVERY `@`-scoped key (any node's) is dropped from the pass-through.
|
|
7534
|
+
* - Every bare perNode key is dropped from the pass-through (a stray bare
|
|
7535
|
+
* legacy key must never hydrate any node — no bare fallback).
|
|
7536
|
+
* - THIS node's effective value ({@link readNodeValue}) is then laid onto
|
|
7537
|
+
* each bare perNode key; when the node has no scoped key the bare key is
|
|
7538
|
+
* left ABSENT so the field's schema `default` wins.
|
|
7539
|
+
*
|
|
7540
|
+
* Returns a new object — the input store is not mutated.
|
|
7541
|
+
*/
|
|
7542
|
+
function projectStore(store, perNodeKeys, nodeId) {
|
|
7543
|
+
const out = {};
|
|
7544
|
+
for (const [key, value] of Object.entries(store)) {
|
|
7545
|
+
if (key.includes("@")) continue;
|
|
7546
|
+
if (perNodeKeys.has(key)) continue;
|
|
7547
|
+
out[key] = value;
|
|
7548
|
+
}
|
|
7549
|
+
for (const base of perNodeKeys) {
|
|
7550
|
+
const value = readNodeValue(store, base, nodeId);
|
|
7551
|
+
if (value !== void 0) out[base] = value;
|
|
7552
|
+
}
|
|
7553
|
+
return out;
|
|
7554
|
+
}
|
|
7555
|
+
/** Every scope, in the order the guard and the docs list them. */
|
|
7556
|
+
var SCOPED_SETTINGS_SCOPES = [
|
|
7557
|
+
"cluster",
|
|
7558
|
+
"device-defaults",
|
|
7559
|
+
"node"
|
|
7560
|
+
];
|
|
6962
7561
|
/** A write to a secret path could not be stored in the keychain, so it was refused. */
|
|
6963
7562
|
var KeychainWriteRefusedError = class extends Error {
|
|
6964
7563
|
fieldPath;
|
|
@@ -6969,7 +7568,7 @@ var KeychainWriteRefusedError = class extends Error {
|
|
|
6969
7568
|
}
|
|
6970
7569
|
};
|
|
6971
7570
|
var KEEP = { kind: "keep" };
|
|
6972
|
-
function isRecord$
|
|
7571
|
+
function isRecord$4(value) {
|
|
6973
7572
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6974
7573
|
}
|
|
6975
7574
|
function defaultMintId() {
|
|
@@ -6982,7 +7581,7 @@ function collectSecretMarkerRefs(value, out = []) {
|
|
|
6982
7581
|
return out;
|
|
6983
7582
|
}
|
|
6984
7583
|
if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
|
|
6985
|
-
else if (isRecord$
|
|
7584
|
+
else if (isRecord$4(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
|
|
6986
7585
|
return out;
|
|
6987
7586
|
}
|
|
6988
7587
|
async function storedValueEquals(secrets, marker, candidate) {
|
|
@@ -7037,7 +7636,7 @@ function rowId$3(row, idKey) {
|
|
|
7037
7636
|
return null;
|
|
7038
7637
|
}
|
|
7039
7638
|
async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
7040
|
-
const storedRows = Array.isArray(stored) ? stored.filter(isRecord$
|
|
7639
|
+
const storedRows = Array.isArray(stored) ? stored.filter(isRecord$4) : [];
|
|
7041
7640
|
if (!Array.isArray(incoming)) {
|
|
7042
7641
|
ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
|
|
7043
7642
|
return {
|
|
@@ -7053,7 +7652,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
|
7053
7652
|
const kept = /* @__PURE__ */ new Set();
|
|
7054
7653
|
const rows = [];
|
|
7055
7654
|
for (const row of incoming) {
|
|
7056
|
-
if (!isRecord$
|
|
7655
|
+
if (!isRecord$4(row)) {
|
|
7057
7656
|
rows.push(row);
|
|
7058
7657
|
continue;
|
|
7059
7658
|
}
|
|
@@ -7078,7 +7677,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
|
7078
7677
|
case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
|
|
7079
7678
|
case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
|
|
7080
7679
|
case "object": {
|
|
7081
|
-
if (!isRecord$
|
|
7680
|
+
if (!isRecord$4(incoming)) {
|
|
7082
7681
|
if (incoming === void 0) return KEEP;
|
|
7083
7682
|
ctx.deletes.push(...collectSecretMarkerRefs(stored));
|
|
7084
7683
|
return {
|
|
@@ -7086,7 +7685,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
|
7086
7685
|
value: incoming
|
|
7087
7686
|
};
|
|
7088
7687
|
}
|
|
7089
|
-
const storedObj = isRecord$
|
|
7688
|
+
const storedObj = isRecord$4(stored) ? stored : {};
|
|
7090
7689
|
return {
|
|
7091
7690
|
kind: "value",
|
|
7092
7691
|
value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
|
|
@@ -7209,7 +7808,7 @@ async function resolveSecretMarkers(value, secrets, options = {}) {
|
|
|
7209
7808
|
value: items
|
|
7210
7809
|
};
|
|
7211
7810
|
}
|
|
7212
|
-
if (isRecord$
|
|
7811
|
+
if (isRecord$4(v)) {
|
|
7213
7812
|
const out = {};
|
|
7214
7813
|
for (const [k, child] of Object.entries(v)) {
|
|
7215
7814
|
const s = substitute(child);
|
|
@@ -7241,7 +7840,7 @@ var SecretOverwriteRefusedError = class extends Error {
|
|
|
7241
7840
|
this.name = "SecretOverwriteRefusedError";
|
|
7242
7841
|
}
|
|
7243
7842
|
};
|
|
7244
|
-
function isRecord$
|
|
7843
|
+
function isRecord$3(value) {
|
|
7245
7844
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
7246
7845
|
}
|
|
7247
7846
|
function resolvedValue(pass, marker) {
|
|
@@ -7270,7 +7869,7 @@ function inArray(pass, incoming, stored) {
|
|
|
7270
7869
|
return incoming.map((item, index) => {
|
|
7271
7870
|
const twin = stored[index];
|
|
7272
7871
|
if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
|
|
7273
|
-
if (isRecord$
|
|
7872
|
+
if (isRecord$3(item) && isRecord$3(twin)) return inArrayRow(pass, item, twin);
|
|
7274
7873
|
if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
|
|
7275
7874
|
return item;
|
|
7276
7875
|
});
|
|
@@ -7281,7 +7880,7 @@ function inArrayRow(pass, incoming, stored) {
|
|
|
7281
7880
|
const twin = stored[key];
|
|
7282
7881
|
if (isSecretMarker(twin)) {
|
|
7283
7882
|
if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
|
|
7284
|
-
} else if (isRecord$
|
|
7883
|
+
} else if (isRecord$3(value) && isRecord$3(twin)) out[key] = inArrayRow(pass, value, twin);
|
|
7285
7884
|
else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
|
|
7286
7885
|
}
|
|
7287
7886
|
return out;
|
|
@@ -7289,7 +7888,7 @@ function inArrayRow(pass, incoming, stored) {
|
|
|
7289
7888
|
async function walk(pass, incoming, stored) {
|
|
7290
7889
|
if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
|
|
7291
7890
|
if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
|
|
7292
|
-
if (!isRecord$
|
|
7891
|
+
if (!isRecord$3(incoming) || !isRecord$3(stored)) return incoming;
|
|
7293
7892
|
const out = { ...incoming };
|
|
7294
7893
|
for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
|
|
7295
7894
|
return out;
|
|
@@ -7320,7 +7919,7 @@ async function restoreUnchangedSecrets(input) {
|
|
|
7320
7919
|
function isJsonEqual(a, b) {
|
|
7321
7920
|
if (Object.is(a, b)) return true;
|
|
7322
7921
|
if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
|
|
7323
|
-
if (isRecord$
|
|
7922
|
+
if (isRecord$3(a) && isRecord$3(b)) {
|
|
7324
7923
|
const keys = Object.keys(a);
|
|
7325
7924
|
if (keys.length !== Object.keys(b).length) return false;
|
|
7326
7925
|
return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
|
|
@@ -7344,7 +7943,7 @@ function markerKeysOf(blob, owner) {
|
|
|
7344
7943
|
}
|
|
7345
7944
|
function nodeFromStored(value, owner) {
|
|
7346
7945
|
if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
|
|
7347
|
-
if (!isRecord$
|
|
7946
|
+
if (!isRecord$3(value)) return null;
|
|
7348
7947
|
const children = /* @__PURE__ */ new Map();
|
|
7349
7948
|
for (const [key, child] of Object.entries(value)) {
|
|
7350
7949
|
const node = nodeFromStored(child, owner);
|
|
@@ -7639,6 +8238,28 @@ var SECRET_RETRY_MAX_MS = 5 * 6e4;
|
|
|
7639
8238
|
/** Coalesces a burst of `keychain.changed` events into one re-resolve. */
|
|
7640
8239
|
var SECRET_CHANGE_DEBOUNCE_MS = 250;
|
|
7641
8240
|
/**
|
|
8241
|
+
* Pair a catalogue with the function that builds its ports FROM THE MIGRATION API. The one
|
|
8242
|
+
* place a catalogue is bound: a migration reaches nothing a ports binder cannot reach
|
|
8243
|
+
* through `api` (guard `check-migration-ports-surface`).
|
|
8244
|
+
*/
|
|
8245
|
+
function migrationSet(catalogue, bindPorts) {
|
|
8246
|
+
return { bind: (api) => defineAddonMigrations(catalogue, bindPorts(api)) };
|
|
8247
|
+
}
|
|
8248
|
+
/** A mixed array is a mistake: the other kind would be dropped without a word. */
|
|
8249
|
+
function refuseMixed(form, kept, dropped) {
|
|
8250
|
+
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`);
|
|
8251
|
+
}
|
|
8252
|
+
function catalogueOf(list) {
|
|
8253
|
+
const kept = list.filter((entry) => !("execute" in entry));
|
|
8254
|
+
refuseMixed("catalogue, (api) => ports", kept.length, list.length - kept.length);
|
|
8255
|
+
return kept;
|
|
8256
|
+
}
|
|
8257
|
+
function boundOf(list) {
|
|
8258
|
+
const kept = list.filter((entry) => "execute" in entry);
|
|
8259
|
+
refuseMixed("bound migrations", kept.length, list.length - kept.length);
|
|
8260
|
+
return kept;
|
|
8261
|
+
}
|
|
8262
|
+
/**
|
|
7642
8263
|
* Base class for CamStack addons. Eliminates settings boilerplate:
|
|
7643
8264
|
*
|
|
7644
8265
|
* - Typed `config` property with automatic resolution from store + defaults
|
|
@@ -7716,6 +8337,13 @@ var BaseAddon = class {
|
|
|
7716
8337
|
*/
|
|
7717
8338
|
secretStatePaths = [];
|
|
7718
8339
|
_addonSecretTree = null;
|
|
8340
|
+
/**
|
|
8341
|
+
* D986 M4: the scoped schemas this addon declared, resolved once per capability
|
|
8342
|
+
* (`loadScopedSchemas`) so the sync readers (`perNodeKeys`, the secret tree, the restart check)
|
|
8343
|
+
* see them. Empty until loaded: the readers then fall back to {@link globalSettingsSchema}.
|
|
8344
|
+
*/
|
|
8345
|
+
_scopedByCap = /* @__PURE__ */ new Map();
|
|
8346
|
+
_nodeKeysByCap = /* @__PURE__ */ new Map();
|
|
7719
8347
|
_deviceSecretTree = null;
|
|
7720
8348
|
/** Refs the last resolved config pointed at — a change to one re-resolves. */
|
|
7721
8349
|
_configSecretRefs = /* @__PURE__ */ new Set();
|
|
@@ -7785,6 +8413,7 @@ var BaseAddon = class {
|
|
|
7785
8413
|
this._ctx = context;
|
|
7786
8414
|
this._secretSettings = null;
|
|
7787
8415
|
}
|
|
8416
|
+
await this.loadScopedSchemas();
|
|
7788
8417
|
await this.resolveConfig();
|
|
7789
8418
|
if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
|
|
7790
8419
|
if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
|
|
@@ -7794,31 +8423,65 @@ var BaseAddon = class {
|
|
|
7794
8423
|
const normalized = normalizeAddonInitResult(result);
|
|
7795
8424
|
const providers = normalized && "providers" in normalized && normalized.providers ? normalized.providers : [];
|
|
7796
8425
|
this._registeredCapNames = providers.map((p) => p.capability.name);
|
|
8426
|
+
await this.loadScopedSchemas();
|
|
7797
8427
|
return normalized;
|
|
7798
8428
|
}
|
|
8429
|
+
async runMigrations(first, second, third) {
|
|
8430
|
+
if (typeof second === "function") return this.runMigrationSets([migrationSet(catalogueOf(first), second)], third);
|
|
8431
|
+
return this.runBound(boundOf(first), second);
|
|
8432
|
+
}
|
|
7799
8433
|
/**
|
|
7800
|
-
*
|
|
7801
|
-
*
|
|
7802
|
-
*
|
|
7803
|
-
* restored devices — with the catalogue bound to the addon's ports
|
|
7804
|
-
* (`defineAddonMigrations(ADDON_MIGRATIONS, ports)`).
|
|
7805
|
-
*
|
|
7806
|
-
* An engine that cannot be reached or refuses the catalogue is logged and runs
|
|
7807
|
-
* nothing; the boot continues. A migration that FAILED (or was blocked by one)
|
|
7808
|
-
* and declares `onFailure: 'block-owner'` makes this throw, so the addon does not
|
|
7809
|
-
* serve data whose shape it cannot trust; `tolerate` migrations never do.
|
|
7810
|
-
*
|
|
7811
|
-
* ALWAYS pass the whole catalogue; a phase that must run only some of it passes
|
|
7812
|
-
* `{ only: [ids] }` — never a filtered catalogue (the engine would judge the
|
|
7813
|
-
* omitted applied ids "newer").
|
|
8434
|
+
* Several catalogues of ONE owner in one declaration (the engine replaces an owner's
|
|
8435
|
+
* catalogue on every declare, so two calls would each judge the other's ids "newer").
|
|
8436
|
+
* Build each entry with `migrationSet(catalogue, (api) => ports)`.
|
|
7814
8437
|
*/
|
|
7815
|
-
async
|
|
8438
|
+
async runMigrationSets(sets, options) {
|
|
8439
|
+
const api = this.ctx.migrationApi;
|
|
8440
|
+
if (api === void 0) throw new Error(`${this.ctx.id}: the migration API is not available on this context`);
|
|
8441
|
+
return this.runBound(sets.flatMap((set) => set.bind(api)), options);
|
|
8442
|
+
}
|
|
8443
|
+
/**
|
|
8444
|
+
* A device addon states its instance kind once, before its migrations run, and the one-switch
|
|
8445
|
+
* migration (registry `enabled` to the instance body, epic #440 step 3) joins whatever
|
|
8446
|
+
* catalogue the addon runs, in the SAME declaration (the engine replaces an owner's catalogue
|
|
8447
|
+
* on every declare).
|
|
8448
|
+
*/
|
|
8449
|
+
declareRegistrySwitch(spec) {
|
|
8450
|
+
this.registrySwitchSpec = spec;
|
|
8451
|
+
}
|
|
8452
|
+
registrySwitchSpec = null;
|
|
8453
|
+
registrySwitchBound() {
|
|
8454
|
+
const spec = this.registrySwitchSpec;
|
|
8455
|
+
if (spec === null) return [];
|
|
8456
|
+
const api = this.ctx.migrationApi;
|
|
8457
|
+
if (api === void 0) {
|
|
8458
|
+
this.ctx.logger.warn("the registry switch migration is skipped: the migration API is not available on this context");
|
|
8459
|
+
return [];
|
|
8460
|
+
}
|
|
8461
|
+
return migrationSet([registrySwitchToBodyMigration({
|
|
8462
|
+
addonId: this.ctx.id,
|
|
8463
|
+
date: "2026-11-06",
|
|
8464
|
+
seq: 1e3,
|
|
8465
|
+
initialBody: spec.initialBody
|
|
8466
|
+
})], (a) => registrySwitchPortsOver({
|
|
8467
|
+
api: integrationRowsApiOver(a),
|
|
8468
|
+
records: switchRecordsOverMigrationApi(a),
|
|
8469
|
+
kind: spec.kind
|
|
8470
|
+
})).bind(api);
|
|
8471
|
+
}
|
|
8472
|
+
async runBound(declared, options) {
|
|
8473
|
+
const added = this.registrySwitchBound();
|
|
8474
|
+
const migrations = [...declared, ...added];
|
|
8475
|
+
const phased = options?.only === void 0 || added.length === 0 ? options : {
|
|
8476
|
+
...options,
|
|
8477
|
+
only: [...options.only, ...added.map((m) => m.meta.id)]
|
|
8478
|
+
};
|
|
7816
8479
|
const api = this.ctx.api.migrations;
|
|
7817
8480
|
const report = await runAddonMigrations({
|
|
7818
8481
|
declareOwner: (input) => api.declareOwner.mutate(input),
|
|
7819
8482
|
startMigration: (input) => api.startMigration.mutate(input),
|
|
7820
8483
|
finishMigration: (input) => api.finishMigration.mutate(input)
|
|
7821
|
-
}, migrations, this.ctx.logger,
|
|
8484
|
+
}, migrations, this.ctx.logger, phased);
|
|
7822
8485
|
if (report.blockOwner.length > 0) throw new AddonMigrationsBlockedError(report.blockOwner);
|
|
7823
8486
|
return report;
|
|
7824
8487
|
}
|
|
@@ -7882,6 +8545,16 @@ var BaseAddon = class {
|
|
|
7882
8545
|
schema(schema) {
|
|
7883
8546
|
return schema;
|
|
7884
8547
|
}
|
|
8548
|
+
/**
|
|
8549
|
+
* The capability names whose scoped settings schemas ({@link clusterSettingsSchema},
|
|
8550
|
+
* {@link nodeSettingsSchema}, {@link deviceDefaultsSchema}) this addon declares. Read BEFORE
|
|
8551
|
+
* `onInitialize`, when the providers it registers are not known yet: the first config resolve
|
|
8552
|
+
* must already know which keys are per node. Names the providers register at init are added
|
|
8553
|
+
* once known.
|
|
8554
|
+
*/
|
|
8555
|
+
scopedSettingsCapabilities() {
|
|
8556
|
+
return [];
|
|
8557
|
+
}
|
|
7885
8558
|
/** Override to provide global-level settings UI schema. */
|
|
7886
8559
|
globalSettingsSchema(_cap) {
|
|
7887
8560
|
return null;
|
|
@@ -7925,7 +8598,8 @@ var BaseAddon = class {
|
|
|
7925
8598
|
return [];
|
|
7926
8599
|
}
|
|
7927
8600
|
async getGlobalSettings(overlay, cap, nodeId) {
|
|
7928
|
-
|
|
8601
|
+
await this.loadScopedSchemas(cap);
|
|
8602
|
+
const schema = this.globalSettingsSchema(cap) ?? this.scopedFormSchema(cap);
|
|
7929
8603
|
if (!schema) return { sections: [] };
|
|
7930
8604
|
const projected = await this.readRawProjectedStore(nodeId, cap);
|
|
7931
8605
|
return hydrateSchema(schema, overlay ? await this.overlayKeepingMarkers(projected, overlay) : projected, { inlineSecretsAsViews: true });
|
|
@@ -7960,10 +8634,9 @@ var BaseAddon = class {
|
|
|
7960
8634
|
*
|
|
7961
8635
|
* Override it only when an `instanceMode: multiple` addon's instances differ: an NVR integration
|
|
7962
8636
|
* needs its connection fields, the default integration the addon's own sections. It is the
|
|
7963
|
-
* SHAPE of the form only — the values live
|
|
7964
|
-
* unchanged (`integrations.setSettings` for an account integration).
|
|
8637
|
+
* SHAPE of the form only — the values live on the instance record.
|
|
7965
8638
|
*/
|
|
7966
|
-
async
|
|
8639
|
+
async integrationFormSchema(_instance) {
|
|
7967
8640
|
return null;
|
|
7968
8641
|
}
|
|
7969
8642
|
/**
|
|
@@ -8009,7 +8682,7 @@ var BaseAddon = class {
|
|
|
8009
8682
|
* per-instance schema when it declares one, else its global schema (what they always showed).
|
|
8010
8683
|
*/
|
|
8011
8684
|
async getIntegrationFormSchema(instance, nodeId) {
|
|
8012
|
-
const scoped = await this.
|
|
8685
|
+
const scoped = await this.integrationFormSchema(instance);
|
|
8013
8686
|
if (scoped === null) return this.getGlobalSettings(void 0, void 0, nodeId);
|
|
8014
8687
|
return hydrateSchema(scoped, {}, { inlineSecretsAsViews: true });
|
|
8015
8688
|
}
|
|
@@ -8057,6 +8730,7 @@ var BaseAddon = class {
|
|
|
8057
8730
|
* resolved blob back is a no-op for every unchanged secret.
|
|
8058
8731
|
*/
|
|
8059
8732
|
async resolveGlobalStore(nodeId, cap) {
|
|
8733
|
+
await this.loadScopedSchemas(cap);
|
|
8060
8734
|
const raw = await this._ctx?.settings?.readAddonStore() ?? {};
|
|
8061
8735
|
return this.projectForNode(raw, nodeId, cap);
|
|
8062
8736
|
}
|
|
@@ -8067,6 +8741,7 @@ var BaseAddon = class {
|
|
|
8067
8741
|
}
|
|
8068
8742
|
/** The PROJECTED store with its markers — the form hydrate only (D798). */
|
|
8069
8743
|
async readRawProjectedStore(nodeId, cap) {
|
|
8744
|
+
await this.loadScopedSchemas(cap);
|
|
8070
8745
|
const raw = await this.rawSettings()?.readAddonStore() ?? {};
|
|
8071
8746
|
return this.projectForNode(raw, nodeId, cap);
|
|
8072
8747
|
}
|
|
@@ -8169,6 +8844,7 @@ var BaseAddon = class {
|
|
|
8169
8844
|
await this.applyGlobalPatch(patch, nodeId);
|
|
8170
8845
|
}
|
|
8171
8846
|
async applyGlobalPatch(barePatch, nodeId) {
|
|
8847
|
+
await this.loadScopedSchemas();
|
|
8172
8848
|
const keys = this.perNodeKeys();
|
|
8173
8849
|
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
8174
8850
|
const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
@@ -8182,7 +8858,8 @@ var BaseAddon = class {
|
|
|
8182
8858
|
await this.resolveConfig();
|
|
8183
8859
|
await this.onConfigChanged();
|
|
8184
8860
|
this.emitLifecycle(EventCategory.AddonUpdated, { level: "global" });
|
|
8185
|
-
|
|
8861
|
+
const legacy = this.globalSettingsSchema();
|
|
8862
|
+
this.maybeAutoRestart(Object.keys(barePatch), [...legacy === null ? [] : [legacy], ...this.loadedScopedSchemas().map((entry) => entry.schema)]);
|
|
8186
8863
|
}
|
|
8187
8864
|
/**
|
|
8188
8865
|
* The set of field keys the global settings schema declares `perNode: true`
|
|
@@ -8190,14 +8867,67 @@ var BaseAddon = class {
|
|
|
8190
8867
|
* declarations). Empty set ⇒ every per-node code path is bypassed and the
|
|
8191
8868
|
* settings API behaves exactly like the legacy node-agnostic one.
|
|
8192
8869
|
*/
|
|
8193
|
-
|
|
8870
|
+
/**
|
|
8871
|
+
* Load the scoped schemas of every capability this addon declares (the override and the
|
|
8872
|
+
* providers registered at init, plus `extraCap`) that is not loaded yet, then drop what was
|
|
8873
|
+
* derived from the previous set. Idempotent.
|
|
8874
|
+
*/
|
|
8875
|
+
async loadScopedSchemas(extraCap) {
|
|
8876
|
+
const caps = new Set([
|
|
8877
|
+
...this.scopedSettingsCapabilities(),
|
|
8878
|
+
...this._registeredCapNames,
|
|
8879
|
+
...extraCap === void 0 ? [] : [extraCap]
|
|
8880
|
+
]);
|
|
8881
|
+
let added = false;
|
|
8882
|
+
for (const cap of caps) {
|
|
8883
|
+
if (this._scopedByCap.has(cap)) continue;
|
|
8884
|
+
const loaded = [];
|
|
8885
|
+
for (const scope of SCOPED_SETTINGS_SCOPES) {
|
|
8886
|
+
const schema = await this.getScopedSettingsSchema(scope, cap);
|
|
8887
|
+
if (schema !== null) loaded.push({
|
|
8888
|
+
scope,
|
|
8889
|
+
schema
|
|
8890
|
+
});
|
|
8891
|
+
}
|
|
8892
|
+
this._scopedByCap.set(cap, loaded);
|
|
8893
|
+
added = true;
|
|
8894
|
+
}
|
|
8895
|
+
if (!added) return;
|
|
8896
|
+
this._nodeKeysByCap = /* @__PURE__ */ new Map();
|
|
8897
|
+
this._addonSecretTree = null;
|
|
8898
|
+
}
|
|
8899
|
+
/**
|
|
8900
|
+
* The form the settings API serves while an addon declares no {@link globalSettingsSchema}: the
|
|
8901
|
+
* sections of its scoped schemas, so dropping the old hook does not blank the form.
|
|
8902
|
+
*/
|
|
8903
|
+
scopedFormSchema(cap) {
|
|
8904
|
+
const byId = /* @__PURE__ */ new Map();
|
|
8905
|
+
for (const entry of this.loadedScopedSchemas(cap)) for (const section of entry.schema.sections) if (!byId.has(section.id)) byId.set(section.id, section);
|
|
8906
|
+
return byId.size === 0 ? null : { sections: [...byId.values()] };
|
|
8907
|
+
}
|
|
8908
|
+
/** Every loaded scoped schema of `cap`, or of every loaded capability. */
|
|
8909
|
+
loadedScopedSchemas(cap) {
|
|
8910
|
+
if (cap !== void 0) return this._scopedByCap.get(cap) ?? [];
|
|
8911
|
+
return [...this._scopedByCap.values()].flat();
|
|
8912
|
+
}
|
|
8913
|
+
/**
|
|
8914
|
+
* The field keys that are stored per node: every field of a {@link nodeSettingsSchema}, plus
|
|
8915
|
+
* the fields the legacy {@link globalSettingsSchema} still marks `perNode: true`. Derived once
|
|
8916
|
+
* per `cap` argument and memoized (schemas are static declarations). Empty set ⇒ every
|
|
8917
|
+
* per-node code path is bypassed and the settings API behaves like the node-agnostic one.
|
|
8918
|
+
* Call {@link loadScopedSchemas} first (the async seams do).
|
|
8919
|
+
*/
|
|
8194
8920
|
perNodeKeys(cap) {
|
|
8195
8921
|
const cacheKey = cap ?? "";
|
|
8196
|
-
const cached = this.
|
|
8922
|
+
const cached = this._nodeKeysByCap.get(cacheKey);
|
|
8197
8923
|
if (cached) return cached;
|
|
8198
|
-
const
|
|
8199
|
-
const keys = new Set(
|
|
8200
|
-
this.
|
|
8924
|
+
const legacy = this.globalSettingsSchema(cap);
|
|
8925
|
+
const keys = new Set(legacy ? legacy.sections.flatMap((section) => collectPerNodeFieldKeys(section.fields)) : []);
|
|
8926
|
+
for (const { scope, schema } of this.loadedScopedSchemas(cap)) {
|
|
8927
|
+
if (scope !== "node") continue;
|
|
8928
|
+
for (const section of schema.sections) for (const key of collectValueFieldKeys(section.fields)) keys.add(key);
|
|
8929
|
+
}
|
|
8930
|
+
this._nodeKeysByCap.set(cacheKey, keys);
|
|
8201
8931
|
return keys;
|
|
8202
8932
|
}
|
|
8203
8933
|
/**
|
|
@@ -8207,10 +8937,9 @@ var BaseAddon = class {
|
|
|
8207
8937
|
* time to return its response before the addon is torn down and
|
|
8208
8938
|
* re-initialised by `AddonRegistryService.restartAddon`.
|
|
8209
8939
|
*/
|
|
8210
|
-
maybeAutoRestart(patchKeys,
|
|
8211
|
-
if (!schema) return;
|
|
8940
|
+
maybeAutoRestart(patchKeys, schemas) {
|
|
8212
8941
|
const restartKeys = /* @__PURE__ */ new Set();
|
|
8213
|
-
for (const section of schema.sections) for (const field of section.fields) {
|
|
8942
|
+
for (const schema of schemas) for (const section of schema.sections) for (const field of section.fields) {
|
|
8214
8943
|
if (field.type === "separator" || field.type === "info") continue;
|
|
8215
8944
|
if (field.requiresRestart) restartKeys.add(field.key);
|
|
8216
8945
|
}
|
|
@@ -8406,12 +9135,14 @@ var BaseAddon = class {
|
|
|
8406
9135
|
* here, in the addon's own process, so the hub keeps no copy of it.
|
|
8407
9136
|
*/
|
|
8408
9137
|
async getDeclaredSettingsKeys() {
|
|
9138
|
+
await this.loadScopedSchemas();
|
|
8409
9139
|
return { keys: [...this.declaredKeySet()].toSorted() };
|
|
8410
9140
|
}
|
|
8411
9141
|
declaredKeySet() {
|
|
8412
9142
|
const keys = new Set(Object.keys(this.defaults));
|
|
8413
9143
|
const schema = this.globalSettingsSchema();
|
|
8414
9144
|
if (schema) for (const section of schema.sections) for (const key of collectFieldKeys(section.fields)) keys.add(key);
|
|
9145
|
+
for (const { schema: scoped } of this.loadedScopedSchemas()) for (const section of scoped.sections) for (const key of collectFieldKeys(section.fields)) keys.add(key);
|
|
8415
9146
|
for (const key of this._declaredStateKeys) keys.add(key);
|
|
8416
9147
|
for (const path of this.secretStatePaths) {
|
|
8417
9148
|
const root = path.split(/[.[]/, 1)[0];
|
|
@@ -8507,7 +9238,11 @@ var BaseAddon = class {
|
|
|
8507
9238
|
}
|
|
8508
9239
|
/** The addon store's secret tree: schema fields by TYPE, plus `secretStatePaths`. */
|
|
8509
9240
|
addonSecretTree() {
|
|
8510
|
-
this._addonSecretTree
|
|
9241
|
+
if (this._addonSecretTree === null) {
|
|
9242
|
+
const tree = new Map(secretTreeFromSchema(this.globalSettingsSchema()));
|
|
9243
|
+
for (const { schema } of this.loadedScopedSchemas()) for (const [key, node] of secretTreeFromSchema(schema)) tree.set(key, node);
|
|
9244
|
+
this._addonSecretTree = mergeSecretStatePaths(tree, this.secretStatePaths);
|
|
9245
|
+
}
|
|
8511
9246
|
return this._addonSecretTree;
|
|
8512
9247
|
}
|
|
8513
9248
|
deviceSecretTree() {
|
|
@@ -8757,6 +9492,23 @@ function dropPerNodeFields(fields) {
|
|
|
8757
9492
|
}
|
|
8758
9493
|
return kept;
|
|
8759
9494
|
}
|
|
9495
|
+
/** The keys of the value-holding fields, recursing into layout containers. */
|
|
9496
|
+
function collectValueFieldKeys(fields) {
|
|
9497
|
+
const collected = [];
|
|
9498
|
+
for (const field of fields) {
|
|
9499
|
+
if (field.type === "group") {
|
|
9500
|
+
collected.push(...collectValueFieldKeys(field.fields));
|
|
9501
|
+
continue;
|
|
9502
|
+
}
|
|
9503
|
+
if (field.type === "sub-tabs") {
|
|
9504
|
+
for (const tab of field.tabs) collected.push(...collectValueFieldKeys(tab.fields));
|
|
9505
|
+
continue;
|
|
9506
|
+
}
|
|
9507
|
+
if (field.type === "separator" || field.type === "info") continue;
|
|
9508
|
+
if ("key" in field && typeof field.key === "string") collected.push(field.key);
|
|
9509
|
+
}
|
|
9510
|
+
return collected;
|
|
9511
|
+
}
|
|
8760
9512
|
function collectFieldKeys(fields) {
|
|
8761
9513
|
const collected = [];
|
|
8762
9514
|
for (const field of fields) {
|
|
@@ -8802,228 +9554,6 @@ function normalizeAddonInitResult(result) {
|
|
|
8802
9554
|
if (Array.isArray(result)) return { providers: result };
|
|
8803
9555
|
return result;
|
|
8804
9556
|
}
|
|
8805
|
-
var PREFIX$1 = "records/";
|
|
8806
|
-
/** The base of every records failure. `detail` is the human part of the message. */
|
|
8807
|
-
var RecordsError = class extends Error {
|
|
8808
|
-
code;
|
|
8809
|
-
detail;
|
|
8810
|
-
constructor(code, detail) {
|
|
8811
|
-
super(`${PREFIX$1}${code}: ${detail}`);
|
|
8812
|
-
this.name = "RecordsError";
|
|
8813
|
-
this.code = code;
|
|
8814
|
-
this.detail = detail;
|
|
8815
|
-
}
|
|
8816
|
-
};
|
|
8817
|
-
/** A write guarded by `ifRev` found another revision (or an existing row for `ifRev: 0`). */
|
|
8818
|
-
var RevConflictError = class extends RecordsError {
|
|
8819
|
-
constructor(detail) {
|
|
8820
|
-
super("rev-conflict", detail);
|
|
8821
|
-
this.name = "RevConflictError";
|
|
8822
|
-
}
|
|
8823
|
-
};
|
|
8824
|
-
/** The keychain could not store or serve a value: explicit, never an empty string. */
|
|
8825
|
-
var RecordSecretUnavailableError = class extends RecordsError {
|
|
8826
|
-
constructor(detail) {
|
|
8827
|
-
super("secret-unavailable", detail);
|
|
8828
|
-
this.name = "RecordSecretUnavailableError";
|
|
8829
|
-
}
|
|
8830
|
-
};
|
|
8831
|
-
var InvalidRecordError = class extends RecordsError {
|
|
8832
|
-
constructor(detail) {
|
|
8833
|
-
super("invalid-record", detail);
|
|
8834
|
-
this.name = "InvalidRecordError";
|
|
8835
|
-
}
|
|
8836
|
-
};
|
|
8837
|
-
/** A kind declaration the engine refuses (non-additive change, bad shape, wrong file). */
|
|
8838
|
-
var DeclarationRefusedError = class extends RecordsError {
|
|
8839
|
-
constructor(detail) {
|
|
8840
|
-
super("declaration-refused", detail);
|
|
8841
|
-
this.name = "DeclarationRefusedError";
|
|
8842
|
-
}
|
|
8843
|
-
};
|
|
8844
|
-
/** Limits and names of `ctx.records` (D881). One authority; the engine and the facade read it. */
|
|
8845
|
-
/** The files a kind may live in. `history` is device-history's (D850), never records. */
|
|
8846
|
-
var RECORD_DATABASES = ["settings", "events"];
|
|
8847
|
-
/** The classes of a kind: the `@durable` vocabulary, one authority (replaces the annotation). */
|
|
8848
|
-
var RECORD_CLASSES = [
|
|
8849
|
-
"config",
|
|
8850
|
-
"ledger",
|
|
8851
|
-
"audit",
|
|
8852
|
-
"mirror",
|
|
8853
|
-
"ephemeral"
|
|
8854
|
-
];
|
|
8855
|
-
var RECORD_DEFAULT_MAX_DATA_BYTES = 64 * 1024;
|
|
8856
|
-
var RECORD_MAX_DATA_BYTES = 1024 * 1024;
|
|
8857
|
-
var RECORD_BATCH_MAX = 1e3;
|
|
8858
|
-
var RECORD_QUERY_MAX = 1e3;
|
|
8859
|
-
/** A kind in the `settings` file may not bound itself above this (D447: high volume is `events`). */
|
|
8860
|
-
var RECORD_SETTINGS_MAX_ROWS = 5e4;
|
|
8861
|
-
/** The `Column`-free proof prefix: a ref collection for a kind's secret fields. */
|
|
8862
|
-
var RECORD_SECRET_COLLECTION_PREFIX = "records:";
|
|
8863
|
-
/**
|
|
8864
|
-
* Secret fields of a record, addressed the way a Zod schema declares them
|
|
8865
|
-
* (`collectZodSecretPaths`): dotted keys, `[]` for "each element of this array"
|
|
8866
|
-
* (`auth.accessToken`, `headers[].value`).
|
|
8867
|
-
*
|
|
8868
|
-
* `{}` after a key means "each value of this map" (`applianceSecrets{}`): the map's own key
|
|
8869
|
-
* names the value (`applianceSecrets{fridge}`), so no id key is declared and a body that drops a
|
|
8870
|
-
* key releases exactly that key's secret.
|
|
8871
|
-
*
|
|
8872
|
-
* Array elements are matched by a DECLARED id key (`secretArrayKeys`:
|
|
8873
|
-
* `{ headers: 'name' }`), never by index, so reordering a list keeps every
|
|
8874
|
-
* keychain ref (the same rule as `arrayItemFieldPath`). The concrete path of a
|
|
8875
|
-
* leaf names its element: `headers[X-Api].value`.
|
|
8876
|
-
*
|
|
8877
|
-
* Pure and browser-safe. Nothing here mutates: every transform returns a new value.
|
|
8878
|
-
*/
|
|
8879
|
-
/** The array prefixes (declared form, e.g. `headers` or `a.headers`) of a path. */
|
|
8880
|
-
function parseSecretPath(path) {
|
|
8881
|
-
if (path.length === 0) throw new InvalidRecordError("an empty secret path");
|
|
8882
|
-
return path.split(".").map((raw) => {
|
|
8883
|
-
const each = raw.endsWith("[]");
|
|
8884
|
-
const map = raw.endsWith("{}");
|
|
8885
|
-
const key = each || map ? raw.slice(0, -2) : raw;
|
|
8886
|
-
if (key.length === 0) throw new InvalidRecordError(`secret path "${path}" has an empty segment`);
|
|
8887
|
-
return {
|
|
8888
|
-
key,
|
|
8889
|
-
each,
|
|
8890
|
-
map
|
|
8891
|
-
};
|
|
8892
|
-
});
|
|
8893
|
-
}
|
|
8894
|
-
/** The declared array prefixes of `path` that need an id key (`headers`, `a.rows`). */
|
|
8895
|
-
function secretArrayPrefixes(path) {
|
|
8896
|
-
const segments = parseSecretPath(path);
|
|
8897
|
-
const prefixes = [];
|
|
8898
|
-
const walked = [];
|
|
8899
|
-
for (const segment of segments) {
|
|
8900
|
-
walked.push(segment.key);
|
|
8901
|
-
if (segment.each) prefixes.push(walked.join("."));
|
|
8902
|
-
}
|
|
8903
|
-
return prefixes;
|
|
8904
|
-
}
|
|
8905
|
-
function isRecord$4(value) {
|
|
8906
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
8907
|
-
}
|
|
8908
|
-
function elementId(element, idKey, declared, prefix) {
|
|
8909
|
-
const id = isRecord$4(element) ? element[idKey] : void 0;
|
|
8910
|
-
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`);
|
|
8911
|
-
return id;
|
|
8912
|
-
}
|
|
8913
|
-
/**
|
|
8914
|
-
* Visit every secret leaf PRESENT in `data` (an absent branch has nothing to
|
|
8915
|
-
* visit). `replace` returns the new leaf value, or {@link REMOVE_LEAF}; the
|
|
8916
|
-
* result is a new body, `data` is untouched.
|
|
8917
|
-
*/
|
|
8918
|
-
var REMOVE_LEAF = Symbol("remove-leaf");
|
|
8919
|
-
function mapAt(node, segments, index, walkedKeys, concretePrefix, declared, arrayKeys, visit) {
|
|
8920
|
-
if (!isRecord$4(node)) return node;
|
|
8921
|
-
const segment = segments[index];
|
|
8922
|
-
if (segment === void 0) return node;
|
|
8923
|
-
if (!Object.prototype.hasOwnProperty.call(node, segment.key)) return node;
|
|
8924
|
-
const child = node[segment.key];
|
|
8925
|
-
const keys = [...walkedKeys, segment.key];
|
|
8926
|
-
const last = index === segments.length - 1;
|
|
8927
|
-
if (segment.each) {
|
|
8928
|
-
if (!Array.isArray(child)) return node;
|
|
8929
|
-
const prefix = keys.join(".");
|
|
8930
|
-
const idKey = arrayKeys[prefix];
|
|
8931
|
-
if (idKey === void 0) throw new InvalidRecordError(`"${declared}": no id key declared for the array "${prefix}"`);
|
|
8932
|
-
const mapped = child.map((element) => {
|
|
8933
|
-
const id = elementId(element, idKey, declared, prefix);
|
|
8934
|
-
const concrete = `${concretePrefix}${concretePrefix.length > 0 ? "." : ""}${segment.key}[${encodeURIComponent(id)}]`;
|
|
8935
|
-
return last ? element : mapAt(element, segments, index + 1, keys, concrete, declared, arrayKeys, visit);
|
|
8936
|
-
});
|
|
8937
|
-
return {
|
|
8938
|
-
...node,
|
|
8939
|
-
[segment.key]: mapped
|
|
8940
|
-
};
|
|
8941
|
-
}
|
|
8942
|
-
if (segment.map) {
|
|
8943
|
-
if (!isRecord$4(child)) return node;
|
|
8944
|
-
const kept = Object.entries(child).map(([mapKey, value]) => {
|
|
8945
|
-
const concrete = `${concretePrefix}${concretePrefix.length > 0 ? "." : ""}${segment.key}{${encodeURIComponent(mapKey)}}`;
|
|
8946
|
-
if (!last) return [mapKey, mapAt(value, segments, index + 1, keys, concrete, declared, arrayKeys, visit)];
|
|
8947
|
-
return [mapKey, visit({
|
|
8948
|
-
declared,
|
|
8949
|
-
concrete,
|
|
8950
|
-
value
|
|
8951
|
-
})];
|
|
8952
|
-
}).filter(([, value]) => value !== REMOVE_LEAF);
|
|
8953
|
-
return {
|
|
8954
|
-
...node,
|
|
8955
|
-
[segment.key]: Object.fromEntries(kept)
|
|
8956
|
-
};
|
|
8957
|
-
}
|
|
8958
|
-
const concrete = `${concretePrefix}${concretePrefix.length > 0 ? "." : ""}${segment.key}`;
|
|
8959
|
-
if (last) {
|
|
8960
|
-
const replacement = visit({
|
|
8961
|
-
declared,
|
|
8962
|
-
concrete,
|
|
8963
|
-
value: child
|
|
8964
|
-
});
|
|
8965
|
-
if (replacement === REMOVE_LEAF) return Object.fromEntries(Object.entries(node).filter(([key]) => key !== segment.key));
|
|
8966
|
-
return {
|
|
8967
|
-
...node,
|
|
8968
|
-
[segment.key]: replacement
|
|
8969
|
-
};
|
|
8970
|
-
}
|
|
8971
|
-
return {
|
|
8972
|
-
...node,
|
|
8973
|
-
[segment.key]: mapAt(child, segments, index + 1, keys, concrete, declared, arrayKeys, visit)
|
|
8974
|
-
};
|
|
8975
|
-
}
|
|
8976
|
-
/** Replace/remove every present secret leaf; returns a NEW body. */
|
|
8977
|
-
function mapSecretLeaves(data, paths, arrayKeys, visit) {
|
|
8978
|
-
let current = data;
|
|
8979
|
-
for (const declared of paths) current = mapAt(current, parseSecretPath(declared), 0, [], "", declared, arrayKeys, visit);
|
|
8980
|
-
return current;
|
|
8981
|
-
}
|
|
8982
|
-
/**
|
|
8983
|
-
* The keychain collection name a kind's secrets live under. Prefixed so a
|
|
8984
|
-
* record's refs never collide with the refs a legacy collection of the same name
|
|
8985
|
-
* already holds during an adoption.
|
|
8986
|
-
*/
|
|
8987
|
-
function recordSecretCollection(kind) {
|
|
8988
|
-
return `${RECORD_SECRET_COLLECTION_PREFIX}${kind}`;
|
|
8989
|
-
}
|
|
8990
|
-
/** The ONE ref a row's secret field may carry: the engine and the facade both build it here. */
|
|
8991
|
-
function recordSecretRef(owner, kind, rowId, concretePath) {
|
|
8992
|
-
return buildSecretRef({
|
|
8993
|
-
owner,
|
|
8994
|
-
scope: {
|
|
8995
|
-
kind: "row",
|
|
8996
|
-
collection: recordSecretCollection(kind),
|
|
8997
|
-
rowId
|
|
8998
|
-
},
|
|
8999
|
-
fieldPath: concretePath
|
|
9000
|
-
});
|
|
9001
|
-
}
|
|
9002
|
-
/**
|
|
9003
|
-
* A stored secret, as an admin read shows it: a VIEW naming the row's own
|
|
9004
|
-
* keychain ref (`set: true`), never the value and no longer the bare redaction
|
|
9005
|
-
* token. The form hands it to the secret field, which reveals the value by ref
|
|
9006
|
-
* through the audited `keychain-admin.reveal`; sent back untouched it keeps the
|
|
9007
|
-
* stored secret (the records door reads a view as KEEP).
|
|
9008
|
-
*
|
|
9009
|
-
* ONE implementation for the entries service and for every addon that serves
|
|
9010
|
-
* its own instances (`RecordIntegrationInstances`).
|
|
9011
|
-
*/
|
|
9012
|
-
function isRecord$3(value) {
|
|
9013
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
9014
|
-
}
|
|
9015
|
-
function secretViewsOf(owner, kind, id, decl, data) {
|
|
9016
|
-
if (decl.secretPaths.length === 0) return data;
|
|
9017
|
-
const shown = mapSecretLeaves(data, decl.secretPaths, decl.secretArrayKeys, (leaf) => {
|
|
9018
|
-
if (leaf.value !== "__camstack_redacted__") return leaf.value;
|
|
9019
|
-
return {
|
|
9020
|
-
$secret: recordSecretRef(owner, kind, id, leaf.concrete),
|
|
9021
|
-
v: 1,
|
|
9022
|
-
set: true
|
|
9023
|
-
};
|
|
9024
|
-
});
|
|
9025
|
-
return isRecord$3(shown) ? shown : data;
|
|
9026
|
-
}
|
|
9027
9557
|
/**
|
|
9028
9558
|
* The share-view scope kinds a share-link token can carry. The hub mints
|
|
9029
9559
|
* and validates them (`ShareViewGrantSchema` builds its
|
|
@@ -11124,6 +11654,10 @@ Object.freeze({
|
|
|
11124
11654
|
"all",
|
|
11125
11655
|
"one"
|
|
11126
11656
|
]
|
|
11657
|
+
},
|
|
11658
|
+
{
|
|
11659
|
+
"path": "positionUpdatedAt",
|
|
11660
|
+
"valueType": "number"
|
|
11127
11661
|
}
|
|
11128
11662
|
],
|
|
11129
11663
|
"meter": [{
|
|
@@ -11378,22 +11912,6 @@ Object.freeze({
|
|
|
11378
11912
|
"path": "pumpRunning",
|
|
11379
11913
|
"valueType": "boolean"
|
|
11380
11914
|
},
|
|
11381
|
-
{
|
|
11382
|
-
"path": "lastDrink",
|
|
11383
|
-
"valueType": "number"
|
|
11384
|
-
},
|
|
11385
|
-
{
|
|
11386
|
-
"path": "currentHourDrink",
|
|
11387
|
-
"valueType": "number"
|
|
11388
|
-
},
|
|
11389
|
-
{
|
|
11390
|
-
"path": "last24hDrink",
|
|
11391
|
-
"valueType": "number"
|
|
11392
|
-
},
|
|
11393
|
-
{
|
|
11394
|
-
"path": "todayDrink",
|
|
11395
|
-
"valueType": "number"
|
|
11396
|
-
},
|
|
11397
11915
|
{
|
|
11398
11916
|
"path": "error",
|
|
11399
11917
|
"valueType": "string"
|
|
@@ -11959,12 +12477,66 @@ Object.freeze({
|
|
|
11959
12477
|
}
|
|
11960
12478
|
]
|
|
11961
12479
|
});
|
|
12480
|
+
Object.freeze({
|
|
12481
|
+
"actions": { "run": 363e4 },
|
|
12482
|
+
"audio-analyzer": { "classify": 3e4 },
|
|
12483
|
+
"custom-model-registry": { "importModelBundle": 18e5 },
|
|
12484
|
+
"database-snapshot": { "writeSnapshot": 18e5 },
|
|
12485
|
+
"device-manager": {
|
|
12486
|
+
"migrateDevice": 72e4,
|
|
12487
|
+
"runDiscoverySweep": 12e4
|
|
12488
|
+
},
|
|
12489
|
+
"device-provider": { "reloadDevice": 18e4 },
|
|
12490
|
+
"llm": {
|
|
12491
|
+
"generate": 6e5,
|
|
12492
|
+
"generateVision": 6e5,
|
|
12493
|
+
"testProfile": 6e5
|
|
12494
|
+
},
|
|
12495
|
+
"llm-runtime": {
|
|
12496
|
+
"complete": 6e5,
|
|
12497
|
+
"completeApple": 6e5,
|
|
12498
|
+
"ensureStarted": 6e5,
|
|
12499
|
+
"installModel": 36e5
|
|
12500
|
+
},
|
|
12501
|
+
"local-network": { "scanNetwork": 9e4 },
|
|
12502
|
+
"model-convert": { "convert": 6e5 },
|
|
12503
|
+
"pipeline-analytics": {
|
|
12504
|
+
"addRetrainFrameFromRecording": 6e4,
|
|
12505
|
+
"offerRetrainArchive": 12e4,
|
|
12506
|
+
"proposeRetrainAnnotationsWithLlm": 18e4,
|
|
12507
|
+
"resolveRetrainTrainingCorpus": 6e4,
|
|
12508
|
+
"writeRetrainArchive": 36e5
|
|
12509
|
+
},
|
|
12510
|
+
"server-management": { "applyServerUpdate": 96e4 },
|
|
12511
|
+
"terminal-session": { "pullOutput": 15e3 },
|
|
12512
|
+
"training": {
|
|
12513
|
+
"canaryResult": 12e4,
|
|
12514
|
+
"cancelJob": 12e4,
|
|
12515
|
+
"planJob": 6e4,
|
|
12516
|
+
"registerResult": 18e5,
|
|
12517
|
+
"rollbackCanary": 12e4,
|
|
12518
|
+
"startJob": 12e4,
|
|
12519
|
+
"startJobBatch": 12e4
|
|
12520
|
+
},
|
|
12521
|
+
"training-provider": {
|
|
12522
|
+
"cancelJob": 6e4,
|
|
12523
|
+
"cleanupJob": 3e5,
|
|
12524
|
+
"getJob": 6e4,
|
|
12525
|
+
"listJobEvents": 6e4,
|
|
12526
|
+
"listJobs": 12e4,
|
|
12527
|
+
"offerArtifact": 3e5,
|
|
12528
|
+
"readResult": 3e5,
|
|
12529
|
+
"submitJob": 18e5,
|
|
12530
|
+
"uploadDataset": 72e5,
|
|
12531
|
+
"validateCredentials": 3e4
|
|
12532
|
+
}
|
|
12533
|
+
});
|
|
11962
12534
|
object({
|
|
11963
12535
|
code: string().regex(/^[a-z][a-z0-9-]*(\.[a-z0-9-]+)+$/),
|
|
11964
12536
|
params: record(string(), union([string(), number()])).optional()
|
|
11965
12537
|
});
|
|
11966
12538
|
//#endregion
|
|
11967
|
-
//#region ../types/dist/composition-
|
|
12539
|
+
//#region ../types/dist/composition-BmBHuDTQ.mjs
|
|
11968
12540
|
/**
|
|
11969
12541
|
* The ffmpeg build every CamStack node downloads, per platform and arch.
|
|
11970
12542
|
*
|
|
@@ -12268,7 +12840,7 @@ var table = {
|
|
|
12268
12840
|
},
|
|
12269
12841
|
dwell: {
|
|
12270
12842
|
minArgs: 3,
|
|
12271
|
-
maxArgs:
|
|
12843
|
+
maxArgs: 4,
|
|
12272
12844
|
apply: () => {
|
|
12273
12845
|
throw new ExpressionEvalError("dwell: stateful evaluation context is required");
|
|
12274
12846
|
}
|
|
@@ -13428,205 +14000,6 @@ function buildCapturingReply(envelope) {
|
|
|
13428
14000
|
};
|
|
13429
14001
|
return wrapper;
|
|
13430
14002
|
}
|
|
13431
|
-
/**
|
|
13432
|
-
* `RecordIntegrationInstances` - the `integration-instances` provider over ONE
|
|
13433
|
-
* entry kind, so an addon that holds a connection serves it in ~30 lines.
|
|
13434
|
-
*
|
|
13435
|
-
* Every instance is one record of the addon's own kind, keyed by the
|
|
13436
|
-
* `integrations` registry id. The records door does the secret work: a field the
|
|
13437
|
-
* kind marks `.meta({ secret: true })` is a keychain marker bound to the row, so
|
|
13438
|
-
* deleting the row deletes the secret, and one row's value is never another's.
|
|
13439
|
-
*
|
|
13440
|
-
* Patch rules for a secret (`updateInstance`): omitted, `''`, the redaction
|
|
13441
|
-
* token or the view the form was given KEEP the stored secret;
|
|
13442
|
-
* `{ $secretClear: true }` clears it; any other string replaces it.
|
|
13443
|
-
*/
|
|
13444
|
-
/** The most instances one addon lists (an integrations page, not a table). */
|
|
13445
|
-
var INSTANCES_LIST_MAX = 1e3;
|
|
13446
|
-
/** The keys of the kind's secret fields that sit at the top level of the body. */
|
|
13447
|
-
function topLevelSecretKeys(paths) {
|
|
13448
|
-
return new Set(paths.filter((p) => !p.includes(".") && !p.includes("[") && !p.includes("{")));
|
|
13449
|
-
}
|
|
13450
|
-
/** The keys of the kind's top-level MAPS whose values are secrets (`applianceSecrets{}`). */
|
|
13451
|
-
function secretMapKeys(paths) {
|
|
13452
|
-
return new Set(paths.filter((p) => p.endsWith("{}") && !p.slice(0, -2).match(/[.[{]/)).map((p) => p.slice(0, -2)));
|
|
13453
|
-
}
|
|
13454
|
-
/**
|
|
13455
|
-
* A patch value for a map of secrets: an entry that is omitted, `''`, the redaction token or the
|
|
13456
|
-
* view the form was given KEEPS its stored secret (it is left out of the merge); `{ $secretClear }`
|
|
13457
|
-
* or `null` removes the entry; any other string replaces it. Null when nothing is left to merge.
|
|
13458
|
-
*/
|
|
13459
|
-
function secretMapPatch(value) {
|
|
13460
|
-
if (typeof value !== "object" || value === null || Array.isArray(value)) return null;
|
|
13461
|
-
const out = {};
|
|
13462
|
-
for (const [key, entry] of Object.entries(value)) if (entry === null || isSecretClear(entry)) out[key] = null;
|
|
13463
|
-
else if (typeof entry === "string" && entry !== "" && entry !== "__camstack_redacted__" && !isSecretFieldView(entry)) out[key] = entry;
|
|
13464
|
-
return Object.keys(out).length > 0 ? out : null;
|
|
13465
|
-
}
|
|
13466
|
-
/** Does the kind's body schema carry an `enabled` field? */
|
|
13467
|
-
function declaresEnabled(kind) {
|
|
13468
|
-
const json = toJSONSchema(kind.schema, {
|
|
13469
|
-
unrepresentable: "any",
|
|
13470
|
-
io: "input"
|
|
13471
|
-
});
|
|
13472
|
-
const properties = Reflect.get(json, "properties");
|
|
13473
|
-
return typeof properties === "object" && properties !== null && "enabled" in properties;
|
|
13474
|
-
}
|
|
13475
|
-
var RecordIntegrationInstances = class {
|
|
13476
|
-
records;
|
|
13477
|
-
kind;
|
|
13478
|
-
hooks;
|
|
13479
|
-
handle;
|
|
13480
|
-
secretKeys;
|
|
13481
|
-
secretMaps;
|
|
13482
|
-
nameField;
|
|
13483
|
-
/** The `integrations` registry owns the on/off switch (`role: devices`); the body has none. */
|
|
13484
|
-
registryOwnsEnabled;
|
|
13485
|
-
constructor(records, kind, hooks) {
|
|
13486
|
-
this.records = records;
|
|
13487
|
-
this.kind = kind;
|
|
13488
|
-
this.hooks = hooks;
|
|
13489
|
-
this.handle = records.kind(kind);
|
|
13490
|
-
this.secretKeys = topLevelSecretKeys(kind.declaration.secretPaths);
|
|
13491
|
-
this.secretMaps = secretMapKeys(kind.declaration.secretPaths);
|
|
13492
|
-
this.nameField = kind.declaration.entry?.nameField ?? "name";
|
|
13493
|
-
this.registryOwnsEnabled = hooks.description.role === "devices";
|
|
13494
|
-
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"`);
|
|
13495
|
-
}
|
|
13496
|
-
/**
|
|
13497
|
-
* One instance read for the addon's own runtime; null when absent. When the keychain is
|
|
13498
|
-
* locked the row is served WITHOUT its secrets and says so (`secrets: 'unavailable'`), so the
|
|
13499
|
-
* caller can keep what it had instead of reconfiguring with an empty secret (D49).
|
|
13500
|
-
*/
|
|
13501
|
-
async readResolved(id) {
|
|
13502
|
-
try {
|
|
13503
|
-
const record = await this.handle.getResolved(id);
|
|
13504
|
-
return record === null ? null : {
|
|
13505
|
-
id,
|
|
13506
|
-
body: record.data,
|
|
13507
|
-
enabled: record.data.enabled !== false,
|
|
13508
|
-
secrets: "resolved"
|
|
13509
|
-
};
|
|
13510
|
-
} catch (err) {
|
|
13511
|
-
if (!(err instanceof RecordSecretUnavailableError)) throw err;
|
|
13512
|
-
const stored = await this.handle.get(id);
|
|
13513
|
-
if (stored === null) return null;
|
|
13514
|
-
return {
|
|
13515
|
-
id,
|
|
13516
|
-
body: Object.fromEntries(Object.entries(stored.data).filter(([key]) => !this.secretKeys.has(key))),
|
|
13517
|
-
enabled: stored.data.enabled !== false,
|
|
13518
|
-
secrets: "unavailable"
|
|
13519
|
-
};
|
|
13520
|
-
}
|
|
13521
|
-
}
|
|
13522
|
-
/** The body of {@link readResolved} alone; a locked keychain yields the row without secrets. */
|
|
13523
|
-
async getResolved(id) {
|
|
13524
|
-
return (await this.readResolved(id))?.body ?? null;
|
|
13525
|
-
}
|
|
13526
|
-
/** Every instance, secrets resolved where the keychain allows; an absent one is skipped. */
|
|
13527
|
-
async listResolved() {
|
|
13528
|
-
const page = await this.handle.query({ limit: INSTANCES_LIST_MAX });
|
|
13529
|
-
const out = [];
|
|
13530
|
-
for (const record of page.records) {
|
|
13531
|
-
const read = await this.readResolved(record.id);
|
|
13532
|
-
if (read !== null) out.push(read);
|
|
13533
|
-
}
|
|
13534
|
-
return out;
|
|
13535
|
-
}
|
|
13536
|
-
viewOf(record) {
|
|
13537
|
-
const shown = secretViewsOf(this.records.owner, this.kind.name, record.id, this.kind.declaration, record.data);
|
|
13538
|
-
const rawName = record.data[this.nameField];
|
|
13539
|
-
const kind = this.hooks.kindOf?.(record.data);
|
|
13540
|
-
const health = this.hooks.health?.(record.data, record.id);
|
|
13541
|
-
return {
|
|
13542
|
-
id: record.id,
|
|
13543
|
-
name: typeof rawName === "string" ? rawName : record.id,
|
|
13544
|
-
configured: this.hooks.configured(record.data),
|
|
13545
|
-
...this.registryOwnsEnabled ? {} : { enabled: record.data.enabled !== false },
|
|
13546
|
-
formValues: shown,
|
|
13547
|
-
...kind !== void 0 ? { kind } : {},
|
|
13548
|
-
...health?.status !== void 0 ? { status: health.status } : {},
|
|
13549
|
-
...health?.lastCheckedAt !== void 0 ? { lastCheckedAt: health.lastCheckedAt } : {}
|
|
13550
|
-
};
|
|
13551
|
-
}
|
|
13552
|
-
describe = async () => this.hooks.mintId === void 0 ? this.hooks.description : {
|
|
13553
|
-
...this.hooks.description,
|
|
13554
|
-
mintsId: true
|
|
13555
|
-
};
|
|
13556
|
-
instanceFormSchema = async ({ id }) => this.hooks.formSchema(id);
|
|
13557
|
-
listInstances = async () => {
|
|
13558
|
-
return (await this.handle.query({ limit: INSTANCES_LIST_MAX })).records.map((record) => this.viewOf(record));
|
|
13559
|
-
};
|
|
13560
|
-
getInstance = async ({ id }) => {
|
|
13561
|
-
const record = await this.handle.get(id);
|
|
13562
|
-
return record === null ? null : this.viewOf(record);
|
|
13563
|
-
};
|
|
13564
|
-
/** Insert ONE row (`ifRev: 0`: an existing id is refused, never overwritten). */
|
|
13565
|
-
createInstance = async ({ id, name, kind }) => {
|
|
13566
|
-
const minted = id ?? this.hooks.mintId?.({
|
|
13567
|
-
name,
|
|
13568
|
-
...kind !== void 0 ? { kind } : {}
|
|
13569
|
-
});
|
|
13570
|
-
if (minted === void 0) throw new Error("createInstance needs an id: this provider does not mint one");
|
|
13571
|
-
await this.handle.put({
|
|
13572
|
-
id: minted,
|
|
13573
|
-
data: this.hooks.initialBody(name, kind)
|
|
13574
|
-
}, { ifRev: 0 });
|
|
13575
|
-
await this.hooks.onChanged?.(minted, "created");
|
|
13576
|
-
return { id: minted };
|
|
13577
|
-
};
|
|
13578
|
-
updateInstance = async ({ id, name, values }) => {
|
|
13579
|
-
const patch = {};
|
|
13580
|
-
for (const [key, value] of Object.entries(values)) {
|
|
13581
|
-
if (value === void 0) continue;
|
|
13582
|
-
if (this.secretMaps.has(key)) {
|
|
13583
|
-
const entries = secretMapPatch(value);
|
|
13584
|
-
if (entries !== null) patch[key] = entries;
|
|
13585
|
-
} else if (!this.secretKeys.has(key)) patch[key] = value;
|
|
13586
|
-
else if (isSecretClear(value)) patch[key] = null;
|
|
13587
|
-
else if (typeof value === "string" && value !== "" && value !== "__camstack_redacted__" && !isSecretFieldView(value)) patch[key] = value;
|
|
13588
|
-
}
|
|
13589
|
-
if (name !== void 0) patch[this.nameField] = name;
|
|
13590
|
-
await this.handle.patch(id, patch);
|
|
13591
|
-
await this.hooks.onChanged?.(id, "updated");
|
|
13592
|
-
return { ok: true };
|
|
13593
|
-
};
|
|
13594
|
-
/** The switch lives in the record body; the addon is told so it applies it (D996). */
|
|
13595
|
-
setInstanceEnabled = async ({ id, enabled }) => {
|
|
13596
|
-
if (this.registryOwnsEnabled) throw new Error(`instance "${id}": the integrations registry owns the on/off switch of this addon; set it with integrations.update`);
|
|
13597
|
-
await this.handle.patch(id, { enabled });
|
|
13598
|
-
await this.hooks.onChanged?.(id, "enabled");
|
|
13599
|
-
return { ok: true };
|
|
13600
|
-
};
|
|
13601
|
-
/** The row and its keychain refs go together (the records door). */
|
|
13602
|
-
deleteInstance = async ({ id }) => {
|
|
13603
|
-
await this.handle.delete(id);
|
|
13604
|
-
await this.hooks.onChanged?.(id, "deleted");
|
|
13605
|
-
return { ok: true };
|
|
13606
|
-
};
|
|
13607
|
-
testInstance = async (input) => {
|
|
13608
|
-
if (this.hooks.test === void 0) return {
|
|
13609
|
-
success: false,
|
|
13610
|
-
status: "unsupported",
|
|
13611
|
-
error: "This integration declares no connection test"
|
|
13612
|
-
};
|
|
13613
|
-
return this.hooks.test(input);
|
|
13614
|
-
};
|
|
13615
|
-
/** The flat provider object to hand to `registerProvider`. */
|
|
13616
|
-
toProvider() {
|
|
13617
|
-
return {
|
|
13618
|
-
describe: this.describe,
|
|
13619
|
-
instanceFormSchema: this.instanceFormSchema,
|
|
13620
|
-
listInstances: this.listInstances,
|
|
13621
|
-
getInstance: this.getInstance,
|
|
13622
|
-
createInstance: this.createInstance,
|
|
13623
|
-
updateInstance: this.updateInstance,
|
|
13624
|
-
setInstanceEnabled: this.setInstanceEnabled,
|
|
13625
|
-
deleteInstance: this.deleteInstance,
|
|
13626
|
-
testInstance: this.testInstance
|
|
13627
|
-
};
|
|
13628
|
-
}
|
|
13629
|
-
};
|
|
13630
14003
|
var EncodeProfileSchema = object({
|
|
13631
14004
|
video: object({
|
|
13632
14005
|
codec: _enum([
|
|
@@ -15851,6 +16224,39 @@ var UnstampedEventMediaCountSchema = object({
|
|
|
15851
16224
|
/** Sum across both, or `null` when either lane could not be counted. */
|
|
15852
16225
|
total: number().int().nonnegative().nullable()
|
|
15853
16226
|
}).nullable();
|
|
16227
|
+
/**
|
|
16228
|
+
* Where the stored event media sits, per storage location: how many media rows
|
|
16229
|
+
* and how many bytes carry each location id, how many carry none (legacy,
|
|
16230
|
+
* resolved to the default `eventMedia` location), and how many name a location
|
|
16231
|
+
* that was not asked about (a deleted or never-listed one).
|
|
16232
|
+
*
|
|
16233
|
+
* One covering-index aggregate per asked location plus the NULL one, and one
|
|
16234
|
+
* unfiltered total that scans the covering index: O(rows), not a walk of the
|
|
16235
|
+
* rows themselves. `unlisted` is total minus the ASKED locations minus NULL, so
|
|
16236
|
+
* it is a deleted location only when every location id was asked.
|
|
16237
|
+
* `null` is "could not be measured", never zero.
|
|
16238
|
+
*/
|
|
16239
|
+
var MediaLocationCensusInputSchema = object({ locationIds: array(string().min(1)).max(50).readonly() });
|
|
16240
|
+
var MediaLocationCensusSchema = object({
|
|
16241
|
+
locations: array(object({
|
|
16242
|
+
locationId: string(),
|
|
16243
|
+
rows: number().int().nonnegative(),
|
|
16244
|
+
bytes: number().nonnegative()
|
|
16245
|
+
})).readonly(),
|
|
16246
|
+
unstamped: object({
|
|
16247
|
+
rows: number().int().nonnegative(),
|
|
16248
|
+
bytes: number().nonnegative()
|
|
16249
|
+
}),
|
|
16250
|
+
/** Rows stamped with a location id that was not in the asked list. */
|
|
16251
|
+
unlisted: object({
|
|
16252
|
+
rows: number().int().nonnegative(),
|
|
16253
|
+
bytes: number().nonnegative()
|
|
16254
|
+
}),
|
|
16255
|
+
total: object({
|
|
16256
|
+
rows: number().int().nonnegative(),
|
|
16257
|
+
bytes: number().nonnegative()
|
|
16258
|
+
})
|
|
16259
|
+
});
|
|
15854
16260
|
var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
|
|
15855
16261
|
/** The independently selectable logical storage classes — every class
|
|
15856
16262
|
* `storage.listLocationDeclarations` reports, so an operator never meets a
|
|
@@ -19948,31 +20354,21 @@ var APPLIANCE_CAP_VOCABULARY = {
|
|
|
19948
20354
|
"pet-fountain": {
|
|
19949
20355
|
scope: "device",
|
|
19950
20356
|
noun: t("Pet fountain", "Fontana per animali"),
|
|
19951
|
-
actions: [
|
|
19952
|
-
|
|
19953
|
-
|
|
19954
|
-
|
|
19955
|
-
|
|
19956
|
-
|
|
19957
|
-
|
|
19958
|
-
|
|
19959
|
-
|
|
19960
|
-
|
|
19961
|
-
|
|
19962
|
-
|
|
19963
|
-
|
|
19964
|
-
|
|
19965
|
-
|
|
19966
|
-
args: { on: false }
|
|
19967
|
-
},
|
|
19968
|
-
{
|
|
19969
|
-
id: "petFountain.resetDailyConsumption",
|
|
19970
|
-
method: "resetDailyConsumption",
|
|
19971
|
-
label: t("Clear daily consumption", "Azzera il consumo giornaliero"),
|
|
19972
|
-
phrase: t("Clear the daily water consumption of {device}", "Azzera il consumo giornaliero di acqua di {device}"),
|
|
19973
|
-
icon: "rotate-ccw"
|
|
19974
|
-
}
|
|
19975
|
-
],
|
|
20357
|
+
actions: [{
|
|
20358
|
+
id: "petFountain.pumpOn",
|
|
20359
|
+
method: "setPump",
|
|
20360
|
+
label: t("Pump on", "Pompa accesa"),
|
|
20361
|
+
phrase: t("Start the pump of {device}", "Avvia la pompa di {device}"),
|
|
20362
|
+
icon: "play",
|
|
20363
|
+
args: { on: true }
|
|
20364
|
+
}, {
|
|
20365
|
+
id: "petFountain.pumpOff",
|
|
20366
|
+
method: "setPump",
|
|
20367
|
+
label: t("Pump off", "Pompa spenta"),
|
|
20368
|
+
phrase: t("Stop the pump of {device}", "Ferma la pompa di {device}"),
|
|
20369
|
+
icon: "square",
|
|
20370
|
+
args: { on: false }
|
|
20371
|
+
}],
|
|
19976
20372
|
state: [{
|
|
19977
20373
|
kind: "boolean",
|
|
19978
20374
|
field: "empty",
|
|
@@ -43866,8 +44262,15 @@ var ActionInputSchema = object({
|
|
|
43866
44262
|
var ActionRunOriginSchema = object({
|
|
43867
44263
|
/** The automation block whose step started it. */
|
|
43868
44264
|
blockId: string().min(1).optional() });
|
|
43869
|
-
/**
|
|
43870
|
-
|
|
44265
|
+
/**
|
|
44266
|
+
* `started` = the caller did not ask to wait. `timed-out` = the run reached the
|
|
44267
|
+
* ceiling (`ACTION_RUN_MAX_MS`) and was stopped; it is never a `ran`.
|
|
44268
|
+
*/
|
|
44269
|
+
var ActionRunOutcomeSchema = union([
|
|
44270
|
+
AutomationRunOutcomeSchema,
|
|
44271
|
+
literal("started"),
|
|
44272
|
+
literal("timed-out")
|
|
44273
|
+
]);
|
|
43871
44274
|
var ActionRunResultSchema = object({
|
|
43872
44275
|
runId: string().min(1),
|
|
43873
44276
|
outcome: ActionRunOutcomeSchema,
|
|
@@ -44351,7 +44754,7 @@ async function runExportedAction(api, log, input) {
|
|
|
44351
44754
|
const result = await api.actions.run.mutate({ actionId });
|
|
44352
44755
|
if (result.outcome === "skipped-overlap") return refuse("already-running", result.message);
|
|
44353
44756
|
if (result.outcome === "skipped-cooldown") return refuse("cooldown", result.message);
|
|
44354
|
-
if (result.outcome === "failed" || result.outcome === "aborted") {
|
|
44757
|
+
if (result.outcome === "failed" || result.outcome === "aborted" || result.outcome === "timed-out") {
|
|
44355
44758
|
const message = result.message ?? result.outcome;
|
|
44356
44759
|
log.warn(`${exporter}: exported action failed`, {
|
|
44357
44760
|
tags,
|
|
@@ -44472,6 +44875,8 @@ method(object({}), array(ActionEntrySchema), { auth: "admin" }), method(object({
|
|
|
44472
44875
|
kind: "mutation",
|
|
44473
44876
|
auth: "admin"
|
|
44474
44877
|
});
|
|
44878
|
+
/** `timeoutMs` of `actions.run`: a waited call outlives any legal run. */
|
|
44879
|
+
var ACTION_RUN_TIMEOUT_MS = 363e4;
|
|
44475
44880
|
/**
|
|
44476
44881
|
* actions — the ONE surface for runnable actions, for the UI and for
|
|
44477
44882
|
* automations. Provided by the core-blocks builtin on the hub.
|
|
@@ -44490,6 +44895,12 @@ method(object({}), array(ActionEntrySchema), { auth: "admin" }), method(object({
|
|
|
44490
44895
|
* An admin, and an in-process caller (an automation block), may run any action.
|
|
44491
44896
|
* Every refusal is typed (`[not-linked] …`) and logged.
|
|
44492
44897
|
*
|
|
44898
|
+
* **A run lasts at most `ACTION_RUN_MAX_MS` (60 min).** The provider stops a
|
|
44899
|
+
* run that reaches it and answers `timed-out` (never `ran`); an action whose
|
|
44900
|
+
* `wait` steps alone add up to more is refused at create/update
|
|
44901
|
+
* (`[invalid-steps]`). `run` declares a `timeoutMs` above that ceiling, so a
|
|
44902
|
+
* waited call (an automation step) is never cut by the 60 s transport default.
|
|
44903
|
+
*
|
|
44493
44904
|
* A second `run` of an action that is already running is REFUSED — traced and
|
|
44494
44905
|
* logged — never queued.
|
|
44495
44906
|
*/
|
|
@@ -44516,7 +44927,8 @@ method(object({}), array(ActionEntrySchema), { auth: "admin" }), method(object({
|
|
|
44516
44927
|
role: "viewer",
|
|
44517
44928
|
auth: "protected",
|
|
44518
44929
|
kind: "mutation",
|
|
44519
|
-
caller: "required"
|
|
44930
|
+
caller: "required",
|
|
44931
|
+
timeoutMs: ACTION_RUN_TIMEOUT_MS
|
|
44520
44932
|
}), method(ActionIdInput, _void(), {
|
|
44521
44933
|
kind: "mutation",
|
|
44522
44934
|
auth: "admin"
|
|
@@ -46603,52 +47015,7 @@ DeviceType.Light, method(object({
|
|
|
46603
47015
|
level: number().min(0).max(100),
|
|
46604
47016
|
lastChangedAt: number()
|
|
46605
47017
|
});
|
|
46606
|
-
|
|
46607
|
-
* `broker` — unified pub/sub broker registry, system-scoped collection.
|
|
46608
|
-
*
|
|
46609
|
-
* The cap models any kind-tagged message broker the user wants to
|
|
46610
|
-
* register and that other addons might consume. The first two kinds
|
|
46611
|
-
* are MQTT (mosquitto / aedes embedded / cloud bridge) and
|
|
46612
|
-
* Home Assistant (HA WebSocket — subscribe_entities + call_service).
|
|
46613
|
-
* Future kinds (Zigbee2MQTT bridge, ZHA, KNX, Telegram, …) plug in
|
|
46614
|
-
* the same surface.
|
|
46615
|
-
*
|
|
46616
|
-
* Why one cap, not one cap per kind:
|
|
46617
|
-
* - The integrations page wants a single table of "every broker"
|
|
46618
|
-
* across kinds; a unified cap drives it without join logic.
|
|
46619
|
-
* - Generic admin operations (add / remove / test / status) are
|
|
46620
|
-
* identical across kinds — duplicating them per cap was busywork.
|
|
46621
|
-
* - The `network-access` cap precedent: same interface, many
|
|
46622
|
-
* `providerKind: 'ingress'` implementations (Tailscale, ngrok, …).
|
|
46623
|
-
*
|
|
46624
|
-
* What stays kind-specific:
|
|
46625
|
-
* - `getBrokerConfig` payload (kind decides whether it returns
|
|
46626
|
-
* mqtt URL+creds, HA baseUrl+token, …) — typed as
|
|
46627
|
-
* `Record<string, unknown>` at the wire; consumers narrow.
|
|
46628
|
-
* - `publish` / `subscribe` / `getState` arguments (target / filter /
|
|
46629
|
-
* key) — also typed as `Record<string, unknown>` so each kind can
|
|
46630
|
-
* evolve its surface (MQTT topic+qos vs HA entity_id+domain)
|
|
46631
|
-
* without rebreaking the cap signature.
|
|
46632
|
-
* - `add` `settings` payload (different fields per kind, validated by
|
|
46633
|
-
* the kind-specific provider).
|
|
46634
|
-
*
|
|
46635
|
-
* Bidirectionality:
|
|
46636
|
-
* - `publish` is RPC — synchronous result (provider-defined).
|
|
46637
|
-
* - `subscribe` returns a subscription handle; the actual message
|
|
46638
|
-
* stream flows over the typed event-bus as `broker.message` events
|
|
46639
|
-
* keyed by `(brokerId, subscriptionId)`. Consumers filter in their
|
|
46640
|
-
* event handler. Subscriptions persist across reconnects — the
|
|
46641
|
-
* provider re-subscribes upstream after a transport drop.
|
|
46642
|
-
*
|
|
46643
|
-
* Why event-bus push (not a subscription RPC stream):
|
|
46644
|
-
* - Matches the rest of CamStack's D8 contract — events for telemetry,
|
|
46645
|
-
* RPC for loss-is-a-bug. Broker messages are telemetry (a single
|
|
46646
|
-
* drop is recoverable via `getState({key})`).
|
|
46647
|
-
* - Frees `broker.subscribe` from holding a long-lived RPC channel.
|
|
46648
|
-
* - Cross-process: events already route through `$event-bus`; no
|
|
46649
|
-
* per-broker wire-shaping needed.
|
|
46650
|
-
*/
|
|
46651
|
-
var BrokerStatusEnum = _enum([
|
|
47018
|
+
_enum([
|
|
46652
47019
|
"connected",
|
|
46653
47020
|
"disconnected",
|
|
46654
47021
|
"connecting",
|
|
@@ -46656,141 +47023,12 @@ var BrokerStatusEnum = _enum([
|
|
|
46656
47023
|
"unreachable",
|
|
46657
47024
|
"error"
|
|
46658
47025
|
]);
|
|
46659
|
-
var BrokerInfoSchema = object({
|
|
46660
|
-
/** Stable broker id. Persisted; survives addon restarts. */
|
|
46661
|
-
id: string(),
|
|
46662
|
-
/** Addon id of the provider that OWNS this broker.
|
|
46663
|
-
*
|
|
46664
|
-
* The `broker` cap is a system-scoped collection: several addons
|
|
46665
|
-
* register a `broker` provider, each owning a DISJOINT set of
|
|
46666
|
-
* brokers (mqtt-broker owns `mqtt_*`, provider-homeassistant owns
|
|
46667
|
-
* `ha_*`). A broker therefore belongs to exactly one addon — like a
|
|
46668
|
-
* device belongs to one integration. The admin UI threads this id
|
|
46669
|
-
* back as the `{ addonId }` system-collection selector on every
|
|
46670
|
-
* id-keyed call (`get` / `getSettings` / `setSettings` / `remove` /
|
|
46671
|
-
* `testConnection`), so the call routes to the OWNING provider
|
|
46672
|
-
* instead of defaulting to the first-registered one. */
|
|
46673
|
-
addonId: string(),
|
|
46674
|
-
/** Human-readable name (operator-chosen at add-time). */
|
|
46675
|
-
name: string(),
|
|
46676
|
-
/** Provider-defined kind tag — `mqtt` / `home-assistant` / future. */
|
|
46677
|
-
kind: string(),
|
|
46678
|
-
status: BrokerStatusEnum,
|
|
46679
|
-
/** Free-form provider-specific info (HA version, MQTT broker
|
|
46680
|
-
* flavour, latency, mTLS active, …). */
|
|
46681
|
-
info: record(string(), unknown()),
|
|
46682
|
-
/** Ms epoch of the last connection probe / status update. */
|
|
46683
|
-
lastCheckedAt: number().nullable(),
|
|
46684
|
-
/** Last error message, when `status` indicates failure. */
|
|
46685
|
-
error: string().nullable()
|
|
46686
|
-
});
|
|
46687
47026
|
var RegistryStatusSchema = object({
|
|
46688
47027
|
brokerCount: number().int().nonnegative(),
|
|
46689
47028
|
connectedCount: number().int().nonnegative()
|
|
46690
47029
|
});
|
|
46691
|
-
/**
|
|
46692
|
-
* One entry per `broker` provider — which addon provides which broker
|
|
46693
|
-
* kind(s). The unified create picker reads this to know, for each
|
|
46694
|
-
* (addonId, kind) pair the operator can pick, where to route the
|
|
46695
|
-
* follow-up `getSettingsSchema` / `testSettings` / `add` calls (via the
|
|
46696
|
-
* `{ addonId }` selector). A provider only advertises a kind here when
|
|
46697
|
-
* it implements `getSettingsSchema` for that kind (so the picker never
|
|
46698
|
-
* offers a kind whose creation form can't be rendered).
|
|
46699
|
-
*/
|
|
46700
|
-
var BrokerProviderInfoSchema = object({
|
|
46701
|
-
/** Addon id of the `broker` provider this entry describes. */
|
|
46702
|
-
addonId: string(),
|
|
46703
|
-
/** Broker kinds this provider can create, with a display label. */
|
|
46704
|
-
kinds: array(object({
|
|
46705
|
-
kind: string(),
|
|
46706
|
-
label: string(),
|
|
46707
|
-
/**
|
|
46708
|
-
* Relative hub path to start an interactive account link (OAuth popup).
|
|
46709
|
-
* May include `{{brokerId}}`; admin-ui substitutes and appends `?popup=1`.
|
|
46710
|
-
*/
|
|
46711
|
-
interactiveConnectPath: string().min(1).optional(),
|
|
46712
|
-
/** Relative hub path to disconnect the linked account (same popup pattern). */
|
|
46713
|
-
interactiveDisconnectPath: string().min(1).optional(),
|
|
46714
|
-
/**
|
|
46715
|
-
* The kind signs in through a server-held interactive session instead of
|
|
46716
|
-
* (or before) typed credentials. `basePath` is a hub-relative route set
|
|
46717
|
-
* served by the owning addon (`/addon/<id>/...`) speaking the sign-in
|
|
46718
|
-
* contract: `POST {basePath}/start` (body: the form's settings) answers
|
|
46719
|
-
* `{ sessionId, loginUrl }`; `GET {basePath}/status?sessionId=` answers
|
|
46720
|
-
* `{ phase: 'starting' | 'awaiting-login' | 'captured' | 'error' |
|
|
46721
|
-
* 'cancelled', loginUrl, error }`; `POST {basePath}/commit`
|
|
46722
|
-
* (`{ sessionId, name, brokerId? }`) stores the credentials on a new or
|
|
46723
|
-
* existing broker and answers `{ brokerId }`; `POST {basePath}/cancel`
|
|
46724
|
-
* (`{ sessionId }`) drops the session. The dialog that edits a broker
|
|
46725
|
-
* offers it as the default path; the fields the session fills are
|
|
46726
|
-
* marked `filledBySignIn` in the kind's settings schema.
|
|
46727
|
-
*
|
|
46728
|
-
* `methods` lists the ways the session can sign in, recommended first:
|
|
46729
|
-
* `'device-code'` adds `POST {basePath}/code/start` (body: the form's
|
|
46730
|
-
* settings) answering `{ sessionId, userCode, verificationUrl,
|
|
46731
|
-
* expiresAt }` — the operator types `userCode` at `verificationUrl` on
|
|
46732
|
-
* any device, and the same `status` / `commit` / `cancel` routes follow
|
|
46733
|
-
* (status then carries `method`, `userCode`, `verificationUrl`,
|
|
46734
|
-
* `expiresAt` and the phases `'awaiting-code'` / `'expired'`);
|
|
46735
|
-
* `'proxy'` is the `{basePath}/start` flow above. Absent means
|
|
46736
|
-
* `['proxy']`.
|
|
46737
|
-
*/
|
|
46738
|
-
signIn: object({
|
|
46739
|
-
basePath: string().min(1),
|
|
46740
|
-
methods: array(_enum(["device-code", "proxy"])).optional()
|
|
46741
|
-
}).optional()
|
|
46742
|
-
}))
|
|
46743
|
-
});
|
|
46744
|
-
var ListInputSchema = object({
|
|
46745
|
-
/** Optional kind filter — `list({kind:'home-assistant'})` returns
|
|
46746
|
-
* only HA brokers. Omit to list every broker. */
|
|
46747
|
-
kind: string().optional() });
|
|
46748
47030
|
var GetInputSchema = object({ id: string() });
|
|
46749
|
-
var AddInputSchema = object({
|
|
46750
|
-
kind: string().min(1),
|
|
46751
|
-
name: string().min(1),
|
|
46752
|
-
/**
|
|
46753
|
-
* ADOPT an existing id instead of minting a new one.
|
|
46754
|
-
*
|
|
46755
|
-
* Written the day this cost an outage. A broker's id is not a detail: HA
|
|
46756
|
-
* devices carry it inside their `stableId` (`ha:ha_004:dev:…`), so a broker
|
|
46757
|
-
* lost from config and re-added as `ha_001` leaves every one of its devices
|
|
46758
|
-
* bound to a broker that no longer exists. Re-entering the password under the
|
|
46759
|
-
* ORIGINAL id turns a multi-step device migration back into re-entering a
|
|
46760
|
-
* password.
|
|
46761
|
-
*
|
|
46762
|
-
* A provider MUST refuse an id that is already in use — adopting a live
|
|
46763
|
-
* broker's id would silently take it over.
|
|
46764
|
-
*/
|
|
46765
|
-
id: string().min(1).optional(),
|
|
46766
|
-
/** Kind-specific settings (e.g. MQTT `{url,username,password}` or HA
|
|
46767
|
-
* `{baseUrl,accessToken}`). Validated by the kind-specific provider
|
|
46768
|
-
* branch on receipt — invalid shape rejects the add. */
|
|
46769
|
-
settings: record(string(), unknown())
|
|
46770
|
-
});
|
|
46771
|
-
var AddResultSchema = object({ id: string() });
|
|
46772
|
-
var RemoveInputSchema = object({ id: string() });
|
|
46773
|
-
var TestConnectionResultSchema = discriminatedUnion("ok", [object({
|
|
46774
|
-
ok: literal(true),
|
|
46775
|
-
latencyMs: number().nonnegative()
|
|
46776
|
-
}), object({
|
|
46777
|
-
ok: literal(false),
|
|
46778
|
-
error: string()
|
|
46779
|
-
})]);
|
|
46780
47031
|
var SettingsRecordSchema$1 = record(string(), unknown());
|
|
46781
|
-
var SettingsSchemaInputSchema = object({ kind: string() });
|
|
46782
|
-
var TestSettingsInputSchema = object({
|
|
46783
|
-
kind: string(),
|
|
46784
|
-
settings: SettingsRecordSchema$1
|
|
46785
|
-
});
|
|
46786
|
-
var TestSettingsResultSchema = discriminatedUnion("ok", [object({
|
|
46787
|
-
ok: literal(true),
|
|
46788
|
-
latencyMs: number().nonnegative().optional()
|
|
46789
|
-
}).strict(), object({
|
|
46790
|
-
ok: literal(false),
|
|
46791
|
-
error: string()
|
|
46792
|
-
})]);
|
|
46793
|
-
var SettingsSchemaResultSchema = unknown().nullable();
|
|
46794
47032
|
var PublishInputSchema = object({
|
|
46795
47033
|
brokerId: string(),
|
|
46796
47034
|
/** Kind-specific routing target.
|
|
@@ -46824,25 +47062,7 @@ var GetStateInputSchema = object({
|
|
|
46824
47062
|
* HA: entity_id (returns the cached entity state). */
|
|
46825
47063
|
key: string()
|
|
46826
47064
|
});
|
|
46827
|
-
method(
|
|
46828
|
-
kind: "mutation",
|
|
46829
|
-
auth: "admin"
|
|
46830
|
-
}), method(RemoveInputSchema, _void(), {
|
|
46831
|
-
kind: "mutation",
|
|
46832
|
-
auth: "admin"
|
|
46833
|
-
}), method(GetInputSchema, TestConnectionResultSchema, {
|
|
46834
|
-
kind: "mutation",
|
|
46835
|
-
auth: "admin"
|
|
46836
|
-
}), method(GetInputSchema, SettingsRecordSchema$1.nullable(), { auth: "admin" }), method(object({
|
|
46837
|
-
id: string(),
|
|
46838
|
-
settings: SettingsRecordSchema$1
|
|
46839
|
-
}), _void(), {
|
|
46840
|
-
kind: "mutation",
|
|
46841
|
-
auth: "admin"
|
|
46842
|
-
}), method(GetInputSchema, SettingsRecordSchema$1.nullable(), { auth: "admin" }), method(SettingsSchemaInputSchema, SettingsSchemaResultSchema, { auth: "admin" }), method(TestSettingsInputSchema, TestSettingsResultSchema, {
|
|
46843
|
-
kind: "mutation",
|
|
46844
|
-
auth: "admin"
|
|
46845
|
-
}), method(PublishInputSchema, unknown(), {
|
|
47065
|
+
method(GetInputSchema, SettingsRecordSchema$1.nullable(), { auth: "admin" }), method(PublishInputSchema, unknown(), {
|
|
46846
47066
|
kind: "mutation",
|
|
46847
47067
|
auth: "admin"
|
|
46848
47068
|
}), method(SubscribeInputSchema, SubscribeResultSchema, {
|
|
@@ -48768,6 +48988,9 @@ var MediaPlayerStatusSchema = object({
|
|
|
48768
48988
|
/** Repeat mode. Null when no repeat surface.
|
|
48769
48989
|
* Pair with `DeviceFeature.MediaPlayerRepeat`. */
|
|
48770
48990
|
repeat: MediaPlayerRepeatSchema.nullable(),
|
|
48991
|
+
/** Ms epoch when `position` was read from the device. Null when the driver
|
|
48992
|
+
* does not say; a UI that advances the position while playing counts from it. */
|
|
48993
|
+
positionUpdatedAt: number().nullable().default(null),
|
|
48771
48994
|
/** Ms epoch when the slice was last updated. */
|
|
48772
48995
|
lastChangedAt: number()
|
|
48773
48996
|
});
|
|
@@ -49347,7 +49570,9 @@ var ThresholdTransformDraftSchema = object({
|
|
|
49347
49570
|
comparison: _enum(["gte", "lte"]),
|
|
49348
49571
|
threshold: number(),
|
|
49349
49572
|
startDwellMs: number().nonnegative(),
|
|
49350
|
-
stopDwellMs: number().nonnegative()
|
|
49573
|
+
stopDwellMs: number().nonnegative(),
|
|
49574
|
+
/** Samples a start needs; absent = the compiler's default for the source (2 for running power, else 1). */
|
|
49575
|
+
minSamples: number().int().min(1).optional()
|
|
49351
49576
|
});
|
|
49352
49577
|
var CustomizeTransformDraftSchema = discriminatedUnion("kind", [
|
|
49353
49578
|
IdentityTransformDraftSchema,
|
|
@@ -50742,12 +50967,12 @@ var deviceExportCapability = {
|
|
|
50742
50967
|
kind: "poll"
|
|
50743
50968
|
},
|
|
50744
50969
|
/**
|
|
50745
|
-
* Each export provider
|
|
50746
|
-
* (enabled toggle, preferred stream, addon-specific knobs
|
|
50747
|
-
*
|
|
50748
|
-
* `
|
|
50749
|
-
* `
|
|
50750
|
-
*
|
|
50970
|
+
* Each export provider MAY contribute its own per-device "Export" panel
|
|
50971
|
+
* (enabled toggle, preferred stream, addon-specific knobs). The three
|
|
50972
|
+
* framework methods are mounted on the cap router when present.
|
|
50973
|
+
* `IDeviceExportProvider` leaves them optional: an exporter with no
|
|
50974
|
+
* per-device panel omits them (a `deviceConfig` cap's UI is derived and
|
|
50975
|
+
* never hand-written — D14 — and an exporter is not one of those).
|
|
50751
50976
|
*/
|
|
50752
50977
|
exposesDeviceSettings: true,
|
|
50753
50978
|
methods: {
|
|
@@ -50963,7 +51188,14 @@ var DiscoveryCandidateSchema = object({
|
|
|
50963
51188
|
/** `stableId` of the gateway candidate this device was found BEHIND. */
|
|
50964
51189
|
parentStableId: string().optional(),
|
|
50965
51190
|
/** `false` = shown for context but not pickable. Default true. */
|
|
50966
|
-
selectable: boolean().optional()
|
|
51191
|
+
selectable: boolean().optional(),
|
|
51192
|
+
/**
|
|
51193
|
+
* Keys of the provider's creation form (`getChildCreationSchema`) this candidate
|
|
51194
|
+
* cannot be adopted without — a key for an encrypted board, a pairing code. The
|
|
51195
|
+
* admin asks for exactly these, on the creation form prefilled with
|
|
51196
|
+
* `prefilledConfig`, before it adopts. Absent or empty = adopt as it is.
|
|
51197
|
+
*/
|
|
51198
|
+
needsParams: array(string()).optional()
|
|
50967
51199
|
});
|
|
50968
51200
|
/**
|
|
50969
51201
|
* Flat device summary returned by `createDevice` / `adoptDiscoveredDevice`.
|
|
@@ -51022,12 +51254,24 @@ method(_void(), _void(), { kind: "mutation" }), method(_void(), _void(), { kind:
|
|
|
51022
51254
|
}), array(DiscoveryCandidateSchema), {
|
|
51023
51255
|
kind: "mutation",
|
|
51024
51256
|
auth: "admin"
|
|
51025
|
-
}), method(object({}), CreationSchemaOutputSchema), method(object({
|
|
51257
|
+
}), method(object({}), CreationSchemaOutputSchema), method(object({
|
|
51258
|
+
/** The integration asked about; a provider whose integrations differ answers per one. */
|
|
51259
|
+
integrationId: string().optional() }), object({ deviceType: _enum(DeviceType).nullable() })), method(object({
|
|
51260
|
+
candidate: DiscoveryCandidateSchema,
|
|
51261
|
+
/** The integration the operator adopts into; a provider with several instances needs it. */
|
|
51262
|
+
integrationId: string().optional()
|
|
51263
|
+
}), DeviceSummarySchema, {
|
|
51026
51264
|
kind: "mutation",
|
|
51027
51265
|
auth: "admin"
|
|
51028
|
-
}), method(object({}), boolean()), method(object({
|
|
51266
|
+
}), method(object({}), boolean()), method(object({
|
|
51029
51267
|
type: _enum(DeviceType),
|
|
51030
|
-
|
|
51268
|
+
/** The integration asked about; a provider whose integrations differ answers per one. */
|
|
51269
|
+
integrationId: string().optional()
|
|
51270
|
+
}), CreationSchemaOutputSchema), method(object({
|
|
51271
|
+
type: _enum(DeviceType),
|
|
51272
|
+
config: record(string(), unknown()),
|
|
51273
|
+
/** The integration the operator adds the device to; a provider with several instances needs it. */
|
|
51274
|
+
integrationId: string().optional()
|
|
51031
51275
|
}), DeviceSummarySchema, {
|
|
51032
51276
|
kind: "mutation",
|
|
51033
51277
|
auth: "admin"
|
|
@@ -51737,7 +51981,10 @@ method(object({
|
|
|
51737
51981
|
auth: "admin"
|
|
51738
51982
|
}), method(object({
|
|
51739
51983
|
addonId: string(),
|
|
51740
|
-
type: _enum(DeviceType)
|
|
51984
|
+
type: _enum(DeviceType),
|
|
51985
|
+
/** The integration the form is for; a provider whose integrations differ (a hub
|
|
51986
|
+
* integration takes no manual add) answers per integration. Absent = the addon's own. */
|
|
51987
|
+
integrationId: string().optional()
|
|
51741
51988
|
}), unknown().nullable()), method(object({
|
|
51742
51989
|
addonId: string(),
|
|
51743
51990
|
type: _enum(DeviceType),
|
|
@@ -51821,7 +52068,11 @@ method(object({
|
|
|
51821
52068
|
kind: "mutation",
|
|
51822
52069
|
auth: "admin",
|
|
51823
52070
|
timeoutMs: 12e4
|
|
51824
|
-
}), method(object({
|
|
52071
|
+
}), method(object({
|
|
52072
|
+
addonId: string(),
|
|
52073
|
+
/** The integration the Add-Device dialog is open on; absent = the addon's own. */
|
|
52074
|
+
integrationId: string().optional()
|
|
52075
|
+
}), object({ deviceType: _enum(DeviceType).nullable() }), { auth: "admin" }), method(object({ addonId: string() }), unknown(), { auth: "admin" }), method(object({
|
|
51825
52076
|
deviceId: number(),
|
|
51826
52077
|
key: string(),
|
|
51827
52078
|
value: unknown()
|
|
@@ -54331,6 +54582,7 @@ var IntegrationWithStateSchema = object({
|
|
|
54331
54582
|
id: string(),
|
|
54332
54583
|
addonId: string(),
|
|
54333
54584
|
name: string(),
|
|
54585
|
+
/** A projection of the instance body's switch (`setInstanceEnabled` is the only writer). */
|
|
54334
54586
|
enabled: boolean(),
|
|
54335
54587
|
info: record(string(), unknown()).readonly(),
|
|
54336
54588
|
/** The discovery candidate this integration was set up from (D984). */
|
|
@@ -54343,6 +54595,7 @@ var IntegrationLiteSchema = object({
|
|
|
54343
54595
|
id: string(),
|
|
54344
54596
|
addonId: string(),
|
|
54345
54597
|
name: string(),
|
|
54598
|
+
/** A projection of the instance body's switch (`setInstanceEnabled` is the only writer). */
|
|
54346
54599
|
enabled: boolean(),
|
|
54347
54600
|
info: record(string(), unknown()).readonly(),
|
|
54348
54601
|
/** The discovery candidate this integration was set up from (D984). */
|
|
@@ -54425,7 +54678,7 @@ var TestConnectionStatusEnum = _enum([
|
|
|
54425
54678
|
"inconclusive",
|
|
54426
54679
|
"unsupported"
|
|
54427
54680
|
]);
|
|
54428
|
-
var TestConnectionResultSchema
|
|
54681
|
+
var TestConnectionResultSchema = object({
|
|
54429
54682
|
/** True ONLY for `validated`. Never true for a test that did not run. */
|
|
54430
54683
|
success: boolean(),
|
|
54431
54684
|
error: string().optional(),
|
|
@@ -54442,19 +54695,19 @@ var TestConnectionResultSchema$1 = object({
|
|
|
54442
54695
|
var CreateIntegrationInputSchema = object({
|
|
54443
54696
|
addonId: string(),
|
|
54444
54697
|
name: string(),
|
|
54445
|
-
enabled: boolean().optional(),
|
|
54446
54698
|
info: record(string(), unknown()).optional(),
|
|
54447
54699
|
/** `stableId` of the discovery candidate the form was seeded from (D984). */
|
|
54448
54700
|
originStableId: string().optional(),
|
|
54449
|
-
settings: record(string(), unknown()).optional()
|
|
54450
|
-
/** Keys of `settings` the form's schema declares secret (by type) — kept in
|
|
54451
|
-
* the keychain, not the table (D787). */
|
|
54452
|
-
secretKeys: array(string()).optional(),
|
|
54453
|
-
skipRestart: boolean().optional()
|
|
54701
|
+
settings: record(string(), unknown()).optional()
|
|
54454
54702
|
});
|
|
54455
54703
|
var UpdateIntegrationInputSchema = object({
|
|
54456
54704
|
id: string(),
|
|
54457
54705
|
name: string().optional(),
|
|
54706
|
+
/**
|
|
54707
|
+
* Accepted for a FIXED builtin only (`info.fixed`: alarm panel, camera grid, core blocks,
|
|
54708
|
+
* terminal), which keeps no instance record: the registry flag is its one store. Any other
|
|
54709
|
+
* integration is switched through `integration-instances.setInstanceEnabled`.
|
|
54710
|
+
*/
|
|
54458
54711
|
enabled: boolean().optional(),
|
|
54459
54712
|
info: record(string(), unknown()).optional()
|
|
54460
54713
|
});
|
|
@@ -54471,26 +54724,10 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
|
|
|
54471
54724
|
}), method(object({ id: string() }), DeleteIntegrationResultSchema, {
|
|
54472
54725
|
kind: "mutation",
|
|
54473
54726
|
auth: "admin"
|
|
54474
|
-
}), method(object({ id: string() }), record(string(), unknown()), { auth: "admin" }), method(object({
|
|
54475
|
-
id: string(),
|
|
54476
|
-
settings: record(string(), unknown()),
|
|
54477
|
-
/** Keys the form's schema declares secret (by type) — keychain-stored (D787). */
|
|
54478
|
-
secretKeys: array(string()).optional(),
|
|
54479
|
-
/** The integration's own addon applies the change in-process and asks the hub not to respawn it. */
|
|
54480
|
-
skipRestart: boolean().optional()
|
|
54481
|
-
}), object({ success: boolean() }), {
|
|
54482
|
-
kind: "mutation",
|
|
54483
|
-
auth: "admin"
|
|
54484
|
-
}), method(object({ id: string() }), object({
|
|
54485
|
-
rows: number().int().nonnegative(),
|
|
54486
|
-
secrets: number().int().nonnegative()
|
|
54487
|
-
}), {
|
|
54488
|
-
kind: "mutation",
|
|
54489
|
-
auth: "admin"
|
|
54490
54727
|
}), method(_void(), array(AvailableIntegrationTypeSchema), { auth: "admin" }), method(object({
|
|
54491
54728
|
addonId: string(),
|
|
54492
54729
|
settings: record(string(), unknown())
|
|
54493
|
-
}), TestConnectionResultSchema
|
|
54730
|
+
}), TestConnectionResultSchema, {
|
|
54494
54731
|
kind: "mutation",
|
|
54495
54732
|
auth: "admin"
|
|
54496
54733
|
});
|
|
@@ -54517,6 +54754,14 @@ var ConfigSchemaPassthrough$3 = custom();
|
|
|
54517
54754
|
var IntegrationInstanceIdSchema = string().min(1);
|
|
54518
54755
|
var IntegrationInstanceModeSchema = _enum(["single", "multiple"]);
|
|
54519
54756
|
/**
|
|
54757
|
+
* What the addon's instances ARE for the Integrations page (planning#416). `devices`: each
|
|
54758
|
+
* instance is an integration that brings devices (its record body owns the on/off switch);
|
|
54759
|
+
* `services`: a connection configured from the addon's own function page, never listed on
|
|
54760
|
+
* Integrations.
|
|
54761
|
+
* It is the same vocabulary as the manifest's `integrationRole`, which stays as an override.
|
|
54762
|
+
*/
|
|
54763
|
+
var IntegrationInstanceRoleSchema = _enum(["devices", "services"]);
|
|
54764
|
+
/**
|
|
54520
54765
|
* One kind of instance a provider can create (an adapter, an account type). The sign-in and
|
|
54521
54766
|
* connect fields follow the `broker` contract (`broker.cap.ts`): `signIn.basePath` is a
|
|
54522
54767
|
* hub-relative route set speaking the sign-in contract, `connectPath` / `disconnectPath` open an
|
|
@@ -54527,6 +54772,22 @@ var IntegrationInstanceKindSchema = object({
|
|
|
54527
54772
|
/** Stable id of the kind, sent back as `createInstance.kind`. */
|
|
54528
54773
|
id: string().min(1),
|
|
54529
54774
|
label: string().min(1),
|
|
54775
|
+
/**
|
|
54776
|
+
* The function capability this kind is configured for (`broker`, `smtp-provider`,
|
|
54777
|
+
* `device-provider`, ...). A page section is the kinds whose `functionCap` it names (D1013); a
|
|
54778
|
+
* provider with more than one section must name it on every kind.
|
|
54779
|
+
*/
|
|
54780
|
+
functionCap: string().min(1),
|
|
54781
|
+
/**
|
|
54782
|
+
* For `functionCap: 'broker'`: the registry kind of the broker an instance of this kind is
|
|
54783
|
+
* (`matter`, `home-assistant`, ...). A caller that needs a broker of one kind (a link field)
|
|
54784
|
+
* finds the instances whose kind names it; absent takes the kind `id`.
|
|
54785
|
+
*/
|
|
54786
|
+
brokerKind: string().min(1).optional(),
|
|
54787
|
+
/** What instances of this kind are for the Integrations page; absent takes the provider's `role`. */
|
|
54788
|
+
role: IntegrationInstanceRoleSchema.optional(),
|
|
54789
|
+
/** `testInstance` really probes the remote for this kind; absent takes the provider's `canTest`. */
|
|
54790
|
+
canTest: boolean().optional(),
|
|
54530
54791
|
/** The kind signs in through a server-held interactive session. */
|
|
54531
54792
|
signIn: object({
|
|
54532
54793
|
basePath: string().min(1),
|
|
@@ -54537,22 +54798,38 @@ var IntegrationInstanceKindSchema = object({
|
|
|
54537
54798
|
/** Relative hub path to disconnect that account. */
|
|
54538
54799
|
disconnectPath: string().min(1).optional()
|
|
54539
54800
|
});
|
|
54801
|
+
/**
|
|
54802
|
+
* How devices of an instance are found. `none`: the operator adds them by hand; `lan`: the addon
|
|
54803
|
+
* scans the network before any instance exists (the wizard offers the candidates); `account`: the
|
|
54804
|
+
* devices appear after the instance signs in. `scopedToInstance`: a discovery run belongs to ONE
|
|
54805
|
+
* instance and its candidates are claimed by it.
|
|
54806
|
+
*/
|
|
54807
|
+
var IntegrationInstanceDiscoverySchema = object({
|
|
54808
|
+
mode: _enum([
|
|
54809
|
+
"none",
|
|
54810
|
+
"lan",
|
|
54811
|
+
"account"
|
|
54812
|
+
]),
|
|
54813
|
+
scopedToInstance: boolean()
|
|
54814
|
+
});
|
|
54815
|
+
/**
|
|
54816
|
+
* One link a kind of this provider declares (D1013 rule 5): the body `field` of an instance of
|
|
54817
|
+
* `kind` holds the id of an instance of the function cap `to.cap` (of kind `to.kind`, when set).
|
|
54818
|
+
* The hub indexes these so the target's delete is refused while a link names it.
|
|
54819
|
+
*/
|
|
54820
|
+
var IntegrationInstanceLinkSchema = object({
|
|
54821
|
+
kind: string().min(1),
|
|
54822
|
+
field: string().min(1),
|
|
54823
|
+
to: object({
|
|
54824
|
+
cap: string().min(1),
|
|
54825
|
+
kind: string().min(1).optional()
|
|
54826
|
+
})
|
|
54827
|
+
});
|
|
54540
54828
|
var IntegrationInstanceDescriptionSchema = object({
|
|
54541
54829
|
/** What the instances are for the Integrations page; see {@link IntegrationInstanceRoleSchema}. */
|
|
54542
|
-
role:
|
|
54543
|
-
"devices",
|
|
54544
|
-
"services",
|
|
54545
|
-
"both"
|
|
54546
|
-
]),
|
|
54830
|
+
role: IntegrationInstanceRoleSchema,
|
|
54547
54831
|
/** How the devices of an instance are found; absent means `{ mode: 'none' }`. */
|
|
54548
|
-
discovery:
|
|
54549
|
-
mode: _enum([
|
|
54550
|
-
"none",
|
|
54551
|
-
"lan",
|
|
54552
|
-
"account"
|
|
54553
|
-
]),
|
|
54554
|
-
scopedToInstance: boolean()
|
|
54555
|
-
}).optional(),
|
|
54832
|
+
discovery: IntegrationInstanceDiscoverySchema.optional(),
|
|
54556
54833
|
/** `single`: at most one instance can exist (Loki). `multiple`: an account each. */
|
|
54557
54834
|
instanceMode: IntegrationInstanceModeSchema,
|
|
54558
54835
|
/** What the instance is, for the UI (`destination`, `relay`, `account`). */
|
|
@@ -54573,7 +54850,9 @@ var IntegrationInstanceDescriptionSchema = object({
|
|
|
54573
54850
|
* `createInstance` without an `id` works: the provider mints it. Absent means the caller must
|
|
54574
54851
|
* send an id (the UI then mints an opaque one).
|
|
54575
54852
|
*/
|
|
54576
|
-
mintsId: boolean().optional()
|
|
54853
|
+
mintsId: boolean().optional(),
|
|
54854
|
+
/** The links to other instances the provider's kinds declare; absent means none. */
|
|
54855
|
+
links: array(IntegrationInstanceLinkSchema).optional()
|
|
54577
54856
|
});
|
|
54578
54857
|
var IntegrationInstanceStatusSchema = object({
|
|
54579
54858
|
state: _enum([
|
|
@@ -54593,8 +54872,8 @@ var IntegrationInstanceSchema = object({
|
|
|
54593
54872
|
configured: boolean(),
|
|
54594
54873
|
/**
|
|
54595
54874
|
* The instance's own on/off switch (D996), derived from the record body (`enabled !== false`,
|
|
54596
|
-
* so a row written before the field existed is on).
|
|
54597
|
-
*
|
|
54875
|
+
* so a row written before the field existed is on). The same for every role, `devices` included:
|
|
54876
|
+
* the body is the one store, `setInstanceEnabled` the one writer (epic #440, step 3).
|
|
54598
54877
|
*/
|
|
54599
54878
|
enabled: boolean().optional(),
|
|
54600
54879
|
/** The kind of this instance (one of `describe().kinds[].id`), when the provider has kinds. */
|
|
@@ -54618,7 +54897,11 @@ var integrationInstancesCapability = {
|
|
|
54618
54897
|
methods: {
|
|
54619
54898
|
describe: method(_void(), IntegrationInstanceDescriptionSchema, { auth: "admin" }),
|
|
54620
54899
|
/** The form; `id: null` is the create form. */
|
|
54621
|
-
instanceFormSchema: method(object({
|
|
54900
|
+
instanceFormSchema: method(object({
|
|
54901
|
+
id: IntegrationInstanceIdSchema.nullable(),
|
|
54902
|
+
/** The kind of the create form (`id: null`) of a provider with several. */
|
|
54903
|
+
kind: string().min(1).optional()
|
|
54904
|
+
}), ConfigSchemaPassthrough$3, { auth: "admin" }),
|
|
54622
54905
|
listInstances: method(_void(), array(IntegrationInstanceSchema).readonly(), { auth: "admin" }),
|
|
54623
54906
|
getInstance: method(object({ id: IntegrationInstanceIdSchema }), IntegrationInstanceSchema.nullable(), { auth: "admin" }),
|
|
54624
54907
|
/**
|
|
@@ -54628,7 +54911,9 @@ var integrationInstancesCapability = {
|
|
|
54628
54911
|
createInstance: method(object({
|
|
54629
54912
|
id: IntegrationInstanceIdSchema.optional(),
|
|
54630
54913
|
name: string().min(1),
|
|
54631
|
-
kind: string().min(1).optional()
|
|
54914
|
+
kind: string().min(1).optional(),
|
|
54915
|
+
/** Form values written with the record (a link picked in the create dialog). */
|
|
54916
|
+
values: record(string(), unknown()).optional()
|
|
54632
54917
|
}), object({ id: string() }), {
|
|
54633
54918
|
kind: "mutation",
|
|
54634
54919
|
auth: "admin"
|
|
@@ -54638,7 +54923,8 @@ var integrationInstancesCapability = {
|
|
|
54638
54923
|
auth: "admin"
|
|
54639
54924
|
}),
|
|
54640
54925
|
/**
|
|
54641
|
-
* Switch ONE instance on or off
|
|
54926
|
+
* Switch ONE instance on or off, for every role; a missing record is created from the addon's
|
|
54927
|
+
* initial body. A row control, not a form field: `updateInstance.values` is the
|
|
54642
54928
|
* form patch (D62, D996). An off instance keeps its record and secrets and does no work.
|
|
54643
54929
|
*/
|
|
54644
54930
|
setInstanceEnabled: method(object({
|
|
@@ -54655,8 +54941,10 @@ var integrationInstancesCapability = {
|
|
|
54655
54941
|
}),
|
|
54656
54942
|
testInstance: optionalMethod(object({
|
|
54657
54943
|
id: IntegrationInstanceIdSchema.nullable(),
|
|
54658
|
-
values: record(string(), unknown())
|
|
54659
|
-
|
|
54944
|
+
values: record(string(), unknown()),
|
|
54945
|
+
/** The kind to test when `id` is null and the provider has several. */
|
|
54946
|
+
kind: string().min(1).optional()
|
|
54947
|
+
}), TestConnectionResultSchema, {
|
|
54660
54948
|
kind: "mutation",
|
|
54661
54949
|
auth: "admin"
|
|
54662
54950
|
})
|
|
@@ -57161,6 +57449,382 @@ var SystemMetricsSchema = object({
|
|
|
57161
57449
|
gpuMemoryPercent: number().optional()
|
|
57162
57450
|
});
|
|
57163
57451
|
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);
|
|
57452
|
+
/**
|
|
57453
|
+
* records - an addon's own facts and documents (D881): ledgers, audit rows,
|
|
57454
|
+
* config documents, mirrors. The third storage API next to `ctx.settings`
|
|
57455
|
+
* (operator intent, D870) and device-history (numbers over time, D850).
|
|
57456
|
+
*
|
|
57457
|
+
* Who the OWNER is: `callerAddonId`, stamped by the transport on a call that
|
|
57458
|
+
* crossed a process and stated by a hub in-process caller (`ctx.records` does
|
|
57459
|
+
* that with the addon id closed over). It is deliberately NOT in any input
|
|
57460
|
+
* schema, so a session can never supply it, and a call with no stamp is refused
|
|
57461
|
+
* `records/no-caller`. A kind is readable and writable only by its owner; other
|
|
57462
|
+
* addons go through the owner's capability.
|
|
57463
|
+
*
|
|
57464
|
+
* Every read is three-way: a row, `null`, or the call THROWS. A failed read is
|
|
57465
|
+
* never `[]`. Secret fields are never on the wire: a read shows the
|
|
57466
|
+
* redaction token, `secretRefs` hands the owner's `ctx.secrets` the refs it
|
|
57467
|
+
* resolves itself, and a write may carry only a keychain marker bound to the
|
|
57468
|
+
* row's own ref.
|
|
57469
|
+
*
|
|
57470
|
+
* Internal: addons reach it through `ctx.records`, never directly.
|
|
57471
|
+
*/
|
|
57472
|
+
var RecordIdSchema = string().min(1).max(256);
|
|
57473
|
+
/** A JSON object body. Size is the engine's check (`maxDataBytes`), not a schema's. */
|
|
57474
|
+
var RecordBodySchema = record(string(), unknown());
|
|
57475
|
+
var RecordInputSchema = object({
|
|
57476
|
+
id: RecordIdSchema,
|
|
57477
|
+
/** The device this row belongs to (D865 removal, per-device reads). */
|
|
57478
|
+
deviceId: number().int().optional(),
|
|
57479
|
+
/** The domain clock, ms: observed / created / opened. */
|
|
57480
|
+
at: number().int().optional(),
|
|
57481
|
+
/** Producer-set expiry, ms. Refused on a kind whose retention is an engine TTL. */
|
|
57482
|
+
expiresAt: number().int().optional(),
|
|
57483
|
+
data: RecordBodySchema
|
|
57484
|
+
});
|
|
57485
|
+
var RecordViewSchema = object({
|
|
57486
|
+
id: string(),
|
|
57487
|
+
deviceId: number().int().nullable(),
|
|
57488
|
+
at: number().nullable(),
|
|
57489
|
+
expiresAt: number().nullable(),
|
|
57490
|
+
rev: number().int(),
|
|
57491
|
+
updatedAt: number(),
|
|
57492
|
+
data: RecordBodySchema
|
|
57493
|
+
});
|
|
57494
|
+
/** Declared index fields only. Anything else does not compile, by design. */
|
|
57495
|
+
var RecordWhereSchema = record(RecordFieldPathSchema, union([
|
|
57496
|
+
string(),
|
|
57497
|
+
number(),
|
|
57498
|
+
boolean(),
|
|
57499
|
+
object({ in: array(union([
|
|
57500
|
+
string(),
|
|
57501
|
+
number(),
|
|
57502
|
+
boolean()
|
|
57503
|
+
])).min(1).max(RECORD_BATCH_MAX) }),
|
|
57504
|
+
object({
|
|
57505
|
+
gt: union([string(), number()]).optional(),
|
|
57506
|
+
gte: union([string(), number()]).optional(),
|
|
57507
|
+
lt: union([string(), number()]).optional(),
|
|
57508
|
+
lte: union([string(), number()]).optional()
|
|
57509
|
+
}).refine((r) => Object.keys(r).length > 0, { message: "name at least one bound" })
|
|
57510
|
+
]));
|
|
57511
|
+
var KindShape = { kind: RecordKindNameSchema };
|
|
57512
|
+
var TimeWindowShape = {
|
|
57513
|
+
deviceId: number().int().optional(),
|
|
57514
|
+
atFrom: number().optional(),
|
|
57515
|
+
atTo: number().optional()
|
|
57516
|
+
};
|
|
57517
|
+
var RecordQueryInputSchema = object({
|
|
57518
|
+
...KindShape,
|
|
57519
|
+
...TimeWindowShape,
|
|
57520
|
+
where: RecordWhereSchema.optional(),
|
|
57521
|
+
/** Without `where`: `at` (default for a kind with a clock) or `id`. With `where` the order is the index's. */
|
|
57522
|
+
order: _enum(["at", "id"]).optional(),
|
|
57523
|
+
desc: boolean().optional(),
|
|
57524
|
+
limit: number().int().min(1).max(RECORD_QUERY_MAX).default(100),
|
|
57525
|
+
/** Opaque keyset cursor from a previous answer. There is no offset. */
|
|
57526
|
+
cursor: string().min(1).optional()
|
|
57527
|
+
});
|
|
57528
|
+
var RecordQueryResultSchema = object({
|
|
57529
|
+
records: array(RecordViewSchema),
|
|
57530
|
+
nextCursor: string().nullable()
|
|
57531
|
+
});
|
|
57532
|
+
var RecordKindStateSchema = _enum([
|
|
57533
|
+
"created",
|
|
57534
|
+
"unchanged",
|
|
57535
|
+
"updated"
|
|
57536
|
+
]);
|
|
57537
|
+
var DeclareKindResultSchema = object({
|
|
57538
|
+
kindId: number().int(),
|
|
57539
|
+
state: RecordKindStateSchema,
|
|
57540
|
+
createdIndexes: array(string())
|
|
57541
|
+
});
|
|
57542
|
+
/** Keychain refs a write released (the old marker is gone from the row): the owner deletes the values. */
|
|
57543
|
+
var SecretRefsList = array(string());
|
|
57544
|
+
/**
|
|
57545
|
+
* One op of a `transact`: the single-row writes, each on a kind of the caller.
|
|
57546
|
+
* All ops of one call share ONE database file and ONE `transactFamily`.
|
|
57547
|
+
*/
|
|
57548
|
+
var RecordTransactOpSchema = discriminatedUnion("op", [
|
|
57549
|
+
object({
|
|
57550
|
+
op: literal("put"),
|
|
57551
|
+
kind: RecordKindNameSchema,
|
|
57552
|
+
record: RecordInputSchema,
|
|
57553
|
+
ifRev: number().int().min(0).optional()
|
|
57554
|
+
}),
|
|
57555
|
+
object({
|
|
57556
|
+
op: literal("patch"),
|
|
57557
|
+
kind: RecordKindNameSchema,
|
|
57558
|
+
id: RecordIdSchema,
|
|
57559
|
+
data: RecordBodySchema,
|
|
57560
|
+
at: number().int().nullable().optional(),
|
|
57561
|
+
expiresAt: number().int().nullable().optional(),
|
|
57562
|
+
ifRev: number().int().min(1).optional()
|
|
57563
|
+
}),
|
|
57564
|
+
object({
|
|
57565
|
+
op: literal("delete"),
|
|
57566
|
+
kind: RecordKindNameSchema,
|
|
57567
|
+
id: RecordIdSchema
|
|
57568
|
+
})
|
|
57569
|
+
]);
|
|
57570
|
+
var RecordSecretRefsSchema = record(string(), record(string(), string()));
|
|
57571
|
+
method(object({ kinds: record(RecordKindNameSchema, RecordKindDeclarationSchema) }), object({ kinds: record(string(), DeclareKindResultSchema) }), {
|
|
57572
|
+
kind: "mutation",
|
|
57573
|
+
auth: "admin"
|
|
57574
|
+
}), method(object({
|
|
57575
|
+
...KindShape,
|
|
57576
|
+
id: RecordIdSchema
|
|
57577
|
+
}), RecordViewSchema.nullable(), { auth: "admin" }), method(object({
|
|
57578
|
+
...KindShape,
|
|
57579
|
+
ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
|
|
57580
|
+
}), array(RecordViewSchema), { auth: "admin" }), method(object({
|
|
57581
|
+
...KindShape,
|
|
57582
|
+
ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
|
|
57583
|
+
}), RecordSecretRefsSchema, { auth: "admin" }), method(object({
|
|
57584
|
+
...KindShape,
|
|
57585
|
+
record: RecordInputSchema,
|
|
57586
|
+
/** Compare-and-set. `0` means "the row must not exist". */
|
|
57587
|
+
ifRev: number().int().min(0).optional()
|
|
57588
|
+
}), object({
|
|
57589
|
+
rev: number().int(),
|
|
57590
|
+
releasedRefs: SecretRefsList
|
|
57591
|
+
}), {
|
|
57592
|
+
kind: "mutation",
|
|
57593
|
+
auth: "admin"
|
|
57594
|
+
}), method(object({
|
|
57595
|
+
...KindShape,
|
|
57596
|
+
records: array(RecordInputSchema).min(1).max(RECORD_BATCH_MAX)
|
|
57597
|
+
}), object({
|
|
57598
|
+
count: number().int(),
|
|
57599
|
+
releasedRefs: SecretRefsList
|
|
57600
|
+
}), {
|
|
57601
|
+
kind: "mutation",
|
|
57602
|
+
auth: "admin"
|
|
57603
|
+
}), method(object({
|
|
57604
|
+
...KindShape,
|
|
57605
|
+
id: RecordIdSchema,
|
|
57606
|
+
data: RecordBodySchema,
|
|
57607
|
+
at: number().int().nullable().optional(),
|
|
57608
|
+
expiresAt: number().int().nullable().optional(),
|
|
57609
|
+
ifRev: number().int().min(1).optional()
|
|
57610
|
+
}), object({
|
|
57611
|
+
rev: number().int(),
|
|
57612
|
+
releasedRefs: SecretRefsList
|
|
57613
|
+
}), {
|
|
57614
|
+
kind: "mutation",
|
|
57615
|
+
auth: "admin"
|
|
57616
|
+
}), method(object({
|
|
57617
|
+
...KindShape,
|
|
57618
|
+
id: RecordIdSchema
|
|
57619
|
+
}), object({
|
|
57620
|
+
deleted: boolean(),
|
|
57621
|
+
secretRefs: SecretRefsList
|
|
57622
|
+
}), {
|
|
57623
|
+
kind: "mutation",
|
|
57624
|
+
auth: "admin"
|
|
57625
|
+
}), method(object({
|
|
57626
|
+
...KindShape,
|
|
57627
|
+
ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
|
|
57628
|
+
}), object({
|
|
57629
|
+
deleted: number().int(),
|
|
57630
|
+
secretRefs: SecretRefsList
|
|
57631
|
+
}), {
|
|
57632
|
+
kind: "mutation",
|
|
57633
|
+
auth: "admin"
|
|
57634
|
+
}), method(RecordQueryInputSchema, RecordQueryResultSchema, { auth: "admin" }), method(object({
|
|
57635
|
+
...KindShape,
|
|
57636
|
+
...TimeWindowShape,
|
|
57637
|
+
where: RecordWhereSchema.optional()
|
|
57638
|
+
}), object({ count: number().int() }), { auth: "admin" }), method(object({
|
|
57639
|
+
...KindShape,
|
|
57640
|
+
deviceId: number().int().optional(),
|
|
57641
|
+
from: number(),
|
|
57642
|
+
to: number(),
|
|
57643
|
+
bucketMs: number().int().positive()
|
|
57644
|
+
}), object({ buckets: array(object({
|
|
57645
|
+
bucketStart: number(),
|
|
57646
|
+
count: number().int()
|
|
57647
|
+
})) }), { auth: "admin" }), method(object({
|
|
57648
|
+
...KindShape,
|
|
57649
|
+
op: _enum([
|
|
57650
|
+
"sum",
|
|
57651
|
+
"min",
|
|
57652
|
+
"max",
|
|
57653
|
+
"count"
|
|
57654
|
+
]),
|
|
57655
|
+
field: RecordFieldPathSchema.optional(),
|
|
57656
|
+
groupBy: RecordFieldPathSchema.optional(),
|
|
57657
|
+
where: RecordWhereSchema.optional()
|
|
57658
|
+
}), object({ rows: array(object({
|
|
57659
|
+
group: union([
|
|
57660
|
+
string(),
|
|
57661
|
+
number(),
|
|
57662
|
+
_null()
|
|
57663
|
+
]),
|
|
57664
|
+
value: number().nullable()
|
|
57665
|
+
})) }), { auth: "admin" }), method(object({
|
|
57666
|
+
...KindShape,
|
|
57667
|
+
deviceId: number().int().optional(),
|
|
57668
|
+
atBefore: number().optional(),
|
|
57669
|
+
where: RecordWhereSchema.optional()
|
|
57670
|
+
}), object({
|
|
57671
|
+
deleted: number().int(),
|
|
57672
|
+
secretRefs: SecretRefsList
|
|
57673
|
+
}), {
|
|
57674
|
+
kind: "mutation",
|
|
57675
|
+
auth: "admin"
|
|
57676
|
+
}), method(object({ ops: array(RecordTransactOpSchema).min(1).max(RECORD_BATCH_MAX) }), object({
|
|
57677
|
+
results: array(object({
|
|
57678
|
+
rev: number().int().nullable(),
|
|
57679
|
+
deleted: boolean()
|
|
57680
|
+
})),
|
|
57681
|
+
releasedRefs: SecretRefsList,
|
|
57682
|
+
secretRefs: SecretRefsList
|
|
57683
|
+
}), {
|
|
57684
|
+
kind: "mutation",
|
|
57685
|
+
auth: "admin"
|
|
57686
|
+
}), method(object({
|
|
57687
|
+
deviceId: number().int(),
|
|
57688
|
+
kinds: array(RecordKindNameSchema).optional()
|
|
57689
|
+
}), object({
|
|
57690
|
+
deleted: record(string(), number().int()),
|
|
57691
|
+
secretRefs: SecretRefsList
|
|
57692
|
+
}), {
|
|
57693
|
+
kind: "mutation",
|
|
57694
|
+
auth: "admin"
|
|
57695
|
+
}), method(object(KindShape), object({ id: number().int() }), {
|
|
57696
|
+
kind: "mutation",
|
|
57697
|
+
auth: "admin"
|
|
57698
|
+
});
|
|
57699
|
+
/**
|
|
57700
|
+
* The wire shapes of the migration API, version 1 (planning#447).
|
|
57701
|
+
*
|
|
57702
|
+
* A migration is code that outlives the server it was written against: an addon at
|
|
57703
|
+
* version 1.4 that is brought to 1.9 in one jump still runs its 1.4 catalogue, against
|
|
57704
|
+
* the 1.9 kernel. The only thing that code may call is {@link MigrationApiV1}; this file
|
|
57705
|
+
* is the contract of every method of it, one Zod pair per method.
|
|
57706
|
+
*
|
|
57707
|
+
* APPEND-ONLY. A released method is never removed and never changes meaning: an input
|
|
57708
|
+
* field is never removed or made required, an enum never narrows, an output field is
|
|
57709
|
+
* never removed. A change that cannot be expressed that way is `migration-api.v2`, next
|
|
57710
|
+
* to this file. `scripts/check-migration-api-append-only.ts` holds the line against
|
|
57711
|
+
* `scripts/migration-api-contract.json`, and every `behaviours` id below must have an
|
|
57712
|
+
* `it('<id>'` in `migration-api.contract.spec.ts`.
|
|
57713
|
+
*/
|
|
57714
|
+
var Rows = record(string(), unknown());
|
|
57715
|
+
var IntegrationId = object({ integrationId: string().min(1) });
|
|
57716
|
+
var RecordId = object({ id: string().min(1) });
|
|
57717
|
+
var RecordRowSchema = object({
|
|
57718
|
+
id: string(),
|
|
57719
|
+
deviceId: number().int().nullable(),
|
|
57720
|
+
at: number().nullable(),
|
|
57721
|
+
expiresAt: number().nullable(),
|
|
57722
|
+
rev: number().int(),
|
|
57723
|
+
updatedAt: number(),
|
|
57724
|
+
data: Rows
|
|
57725
|
+
});
|
|
57726
|
+
var RecordPutShape = {
|
|
57727
|
+
id: string().min(1),
|
|
57728
|
+
deviceId: number().int().optional(),
|
|
57729
|
+
at: number().int().optional(),
|
|
57730
|
+
expiresAt: number().int().optional(),
|
|
57731
|
+
data: Rows
|
|
57732
|
+
};
|
|
57733
|
+
var MigrationIntegrationSchema = object({
|
|
57734
|
+
id: string(),
|
|
57735
|
+
addonId: string(),
|
|
57736
|
+
name: string(),
|
|
57737
|
+
info: Rows,
|
|
57738
|
+
/** The registry's stored switch: read by the one-switch migration, nothing else. */
|
|
57739
|
+
enabled: boolean().optional(),
|
|
57740
|
+
originStableId: string().optional()
|
|
57741
|
+
});
|
|
57742
|
+
var MigrationDeviceSchema = object({
|
|
57743
|
+
id: number().int(),
|
|
57744
|
+
integrationId: string().nullable().optional(),
|
|
57745
|
+
/** The owning device; null or absent for a root. */
|
|
57746
|
+
parentDeviceId: number().int().nullable().optional(),
|
|
57747
|
+
type: string().optional(),
|
|
57748
|
+
name: string().optional(),
|
|
57749
|
+
stableId: string().optional()
|
|
57750
|
+
});
|
|
57751
|
+
/** What the engine says about the migration API it serves: lets an addon notice an older server. */
|
|
57752
|
+
var MigrationApiInfoSchema = object({
|
|
57753
|
+
version: number().int(),
|
|
57754
|
+
methods: array(string())
|
|
57755
|
+
});
|
|
57756
|
+
object({
|
|
57757
|
+
message: string(),
|
|
57758
|
+
meta: Rows.optional(),
|
|
57759
|
+
/** Grouping tags of the line; a line about a device carries `{ deviceId }`. */
|
|
57760
|
+
tags: object({ deviceId: number().int().optional() }).optional()
|
|
57761
|
+
});
|
|
57762
|
+
object({
|
|
57763
|
+
owner: string().min(1),
|
|
57764
|
+
metas: array(MigrationMetaSchema)
|
|
57765
|
+
}), object({
|
|
57766
|
+
bootId: string(),
|
|
57767
|
+
snapshot: _enum([
|
|
57768
|
+
"none",
|
|
57769
|
+
"written",
|
|
57770
|
+
"refused"
|
|
57771
|
+
]),
|
|
57772
|
+
steps: array(MigrationOwnerStepSchema),
|
|
57773
|
+
/** The migration API the engine serves; absent from a server that predates it. */
|
|
57774
|
+
migrationApi: MigrationApiInfoSchema.optional()
|
|
57775
|
+
}), object({ id: string().min(1) }), object({
|
|
57776
|
+
proceed: boolean(),
|
|
57777
|
+
state: union([literal("pending"), MigrationStatusSchema]),
|
|
57778
|
+
reason: string().nullable()
|
|
57779
|
+
}), object({
|
|
57780
|
+
id: string().min(1),
|
|
57781
|
+
result: MigrationOwnerResultSchema
|
|
57782
|
+
}), object({
|
|
57783
|
+
status: MigrationStatusSchema,
|
|
57784
|
+
error: string().nullable(),
|
|
57785
|
+
rowsChanged: number().int().nonnegative()
|
|
57786
|
+
}), object({
|
|
57787
|
+
rows: number().int().nonnegative(),
|
|
57788
|
+
secrets: number().int().nonnegative()
|
|
57789
|
+
}), IntegrationId.extend({ patch: Rows }), object({ written: boolean() }), IntegrationId.extend({ keys: array(string().min(1)) }), object({
|
|
57790
|
+
present: boolean(),
|
|
57791
|
+
removed: Rows
|
|
57792
|
+
}), RecordRowSchema.nullable(), RecordRowSchema.nullable(), object({
|
|
57793
|
+
...RecordPutShape,
|
|
57794
|
+
ifRev: number().int().optional()
|
|
57795
|
+
}), object({ rev: number().int() }), object({ records: array(object(RecordPutShape)) }), object({ count: number().int().nonnegative() }), RecordId.extend({
|
|
57796
|
+
partial: Rows,
|
|
57797
|
+
ifRev: number().int().optional()
|
|
57798
|
+
}), object({ rev: number().int() }), object({ deleted: boolean() }), object({
|
|
57799
|
+
deviceId: number().int().optional(),
|
|
57800
|
+
atFrom: number().optional(),
|
|
57801
|
+
atTo: number().optional(),
|
|
57802
|
+
where: RecordWhereSchema.optional(),
|
|
57803
|
+
limit: number().int().min(1).optional(),
|
|
57804
|
+
cursor: string().min(1).optional(),
|
|
57805
|
+
resolveSecrets: boolean().optional()
|
|
57806
|
+
}), object({
|
|
57807
|
+
records: array(RecordRowSchema),
|
|
57808
|
+
nextCursor: string().nullable()
|
|
57809
|
+
}), object({
|
|
57810
|
+
deviceId: number().int().optional(),
|
|
57811
|
+
atBefore: number().optional(),
|
|
57812
|
+
where: RecordWhereSchema.optional()
|
|
57813
|
+
}), 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({
|
|
57814
|
+
ref: string().min(1),
|
|
57815
|
+
value: string()
|
|
57816
|
+
}), object({}), object({ refs: array(string()) }), object({ deleted: number().int().nonnegative() }), object({}), object({ integrations: array(MigrationIntegrationSchema) }), object({ id: string().min(1) }), MigrationIntegrationSchema.nullable(), object({
|
|
57817
|
+
addonId: string().min(1),
|
|
57818
|
+
integrationId: string().min(1).optional()
|
|
57819
|
+
}), object({ devices: array(MigrationDeviceSchema) }), object({ deviceId: number().int() }), object({
|
|
57820
|
+
id: number().int(),
|
|
57821
|
+
integrationId: string().nullable(),
|
|
57822
|
+
/** Whether the device carries any stored config; its content is not offered. */
|
|
57823
|
+
hasConfig: boolean()
|
|
57824
|
+
}).nullable(), object({
|
|
57825
|
+
deviceId: number().int(),
|
|
57826
|
+
integrationId: string().min(1)
|
|
57827
|
+
}), object({}), object({}), object({ nodeId: string() }), object({}), object({});
|
|
57164
57828
|
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({
|
|
57165
57829
|
id: string().min(1),
|
|
57166
57830
|
error: string().min(1)
|
|
@@ -57190,7 +57854,9 @@ method(object({}), object({ entries: array(MigrationLedgerEntrySchema) }), { aut
|
|
|
57190
57854
|
"written",
|
|
57191
57855
|
"refused"
|
|
57192
57856
|
]),
|
|
57193
|
-
steps: array(MigrationOwnerStepSchema)
|
|
57857
|
+
steps: array(MigrationOwnerStepSchema),
|
|
57858
|
+
/** The migration API this engine serves (additive: a server that predates it omits it). */
|
|
57859
|
+
migrationApi: MigrationApiInfoSchema.optional()
|
|
57194
57860
|
}), {
|
|
57195
57861
|
kind: "mutation",
|
|
57196
57862
|
auth: "admin"
|
|
@@ -57211,6 +57877,27 @@ method(object({}), object({ entries: array(MigrationLedgerEntrySchema) }), { aut
|
|
|
57211
57877
|
}), {
|
|
57212
57878
|
kind: "mutation",
|
|
57213
57879
|
auth: "admin"
|
|
57880
|
+
}), method(object({ integrationId: string().min(1) }), record(string(), unknown()), { auth: "admin" }), method(object({ integrationId: string().min(1) }), object({
|
|
57881
|
+
rows: number().int().nonnegative(),
|
|
57882
|
+
secrets: number().int().nonnegative()
|
|
57883
|
+
}), {
|
|
57884
|
+
kind: "mutation",
|
|
57885
|
+
auth: "admin"
|
|
57886
|
+
}), method(object({
|
|
57887
|
+
integrationId: string().min(1),
|
|
57888
|
+
patch: record(string(), unknown())
|
|
57889
|
+
}), object({ written: boolean() }), {
|
|
57890
|
+
kind: "mutation",
|
|
57891
|
+
auth: "admin"
|
|
57892
|
+
}), method(object({
|
|
57893
|
+
integrationId: string().min(1),
|
|
57894
|
+
keys: array(string().min(1))
|
|
57895
|
+
}), object({
|
|
57896
|
+
present: boolean(),
|
|
57897
|
+
removed: record(string(), unknown())
|
|
57898
|
+
}), {
|
|
57899
|
+
kind: "mutation",
|
|
57900
|
+
auth: "admin"
|
|
57214
57901
|
});
|
|
57215
57902
|
method(object({
|
|
57216
57903
|
sourceUrl: string(),
|
|
@@ -59836,7 +60523,10 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema$1).r
|
|
|
59836
60523
|
}), method(RelocateMediaInputSchema, object({ jobId: string() }), {
|
|
59837
60524
|
kind: "mutation",
|
|
59838
60525
|
auth: "admin"
|
|
59839
|
-
}), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(
|
|
60526
|
+
}), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(MediaLocationCensusInputSchema, MediaLocationCensusSchema, {
|
|
60527
|
+
kind: "query",
|
|
60528
|
+
auth: "admin"
|
|
60529
|
+
}), method(RelocatableMediaCountInputSchema, RelocatableMediaCountSchema, {
|
|
59840
60530
|
kind: "query",
|
|
59841
60531
|
auth: "admin"
|
|
59842
60532
|
}), method(object({}), array(RelocateJobSchema).readonly(), {
|
|
@@ -62243,7 +62933,7 @@ var BrokerStatusSchema$1 = _enum([
|
|
|
62243
62933
|
"unreachable",
|
|
62244
62934
|
"tls-error"
|
|
62245
62935
|
]);
|
|
62246
|
-
var BrokerInfoSchema
|
|
62936
|
+
var BrokerInfoSchema = object({
|
|
62247
62937
|
id: string(),
|
|
62248
62938
|
name: string(),
|
|
62249
62939
|
url: string(),
|
|
@@ -62306,7 +62996,7 @@ var StatusSchema = object({
|
|
|
62306
62996
|
brokerCount: number(),
|
|
62307
62997
|
embeddedRunning: boolean()
|
|
62308
62998
|
});
|
|
62309
|
-
method(_void(), array(BrokerInfoSchema
|
|
62999
|
+
method(_void(), array(BrokerInfoSchema)), method(IdInputSchema, BrokerConnectionDetailsSchema, { auth: "admin" }), method(AddBrokerInputSchema, AddBrokerResultSchema, {
|
|
62310
63000
|
kind: "mutation",
|
|
62311
63001
|
auth: "admin"
|
|
62312
63002
|
}), method(IdInputSchema, _void(), {
|
|
@@ -66581,14 +67271,6 @@ object({
|
|
|
66581
67271
|
empty: boolean().nullable(),
|
|
66582
67272
|
/** True while the pump is running. Null while unknown. */
|
|
66583
67273
|
pumpRunning: boolean().nullable(),
|
|
66584
|
-
/** Water drunk in the last drink, in litres. */
|
|
66585
|
-
lastDrink: number().min(0).nullable().meta(readingMeta("volume")),
|
|
66586
|
-
/** Water drunk in the current hour, in litres. */
|
|
66587
|
-
currentHourDrink: number().min(0).nullable().meta(readingMeta("volume")),
|
|
66588
|
-
/** Water drunk over the last 24 hours (rolling), in litres. */
|
|
66589
|
-
last24hDrink: number().min(0).nullable().meta(readingMeta("volume")),
|
|
66590
|
-
/** Water drunk since local midnight, in litres. Null when the fountain has no such sensor. */
|
|
66591
|
-
todayDrink: number().min(0).nullable().meta(readingMeta("volume")),
|
|
66592
67274
|
/** Decoded fault message. Null means healthy; a non-null string is an active fault. */
|
|
66593
67275
|
error: string().nullable(),
|
|
66594
67276
|
/** Ms epoch when the slice was last refreshed. */
|
|
@@ -66601,9 +67283,6 @@ DeviceType.PetFountain, method(object({
|
|
|
66601
67283
|
}), _void(), {
|
|
66602
67284
|
kind: "mutation",
|
|
66603
67285
|
auth: "protected"
|
|
66604
|
-
}), method(object({ deviceId: DeviceIdSchema$1 }), _void(), {
|
|
66605
|
-
kind: "mutation",
|
|
66606
|
-
auth: "protected"
|
|
66607
67286
|
});
|
|
66608
67287
|
/**
|
|
66609
67288
|
* The wire shapes of the Auto tune plan and apply (D745), used by the
|
|
@@ -68640,253 +69319,6 @@ DeviceType.Camera, DeviceType.Sensor, DeviceType.Switch, DeviceType.Gateway, met
|
|
|
68640
69319
|
auth: "admin"
|
|
68641
69320
|
});
|
|
68642
69321
|
/**
|
|
68643
|
-
* records - an addon's own facts and documents (D881): ledgers, audit rows,
|
|
68644
|
-
* config documents, mirrors. The third storage API next to `ctx.settings`
|
|
68645
|
-
* (operator intent, D870) and device-history (numbers over time, D850).
|
|
68646
|
-
*
|
|
68647
|
-
* Who the OWNER is: `callerAddonId`, stamped by the transport on a call that
|
|
68648
|
-
* crossed a process and stated by a hub in-process caller (`ctx.records` does
|
|
68649
|
-
* that with the addon id closed over). It is deliberately NOT in any input
|
|
68650
|
-
* schema, so a session can never supply it, and a call with no stamp is refused
|
|
68651
|
-
* `records/no-caller`. A kind is readable and writable only by its owner; other
|
|
68652
|
-
* addons go through the owner's capability.
|
|
68653
|
-
*
|
|
68654
|
-
* Every read is three-way: a row, `null`, or the call THROWS. A failed read is
|
|
68655
|
-
* never `[]`. Secret fields are never on the wire: a read shows the
|
|
68656
|
-
* redaction token, `secretRefs` hands the owner's `ctx.secrets` the refs it
|
|
68657
|
-
* resolves itself, and a write may carry only a keychain marker bound to the
|
|
68658
|
-
* row's own ref.
|
|
68659
|
-
*
|
|
68660
|
-
* Internal: addons reach it through `ctx.records`, never directly.
|
|
68661
|
-
*/
|
|
68662
|
-
var RecordIdSchema = string().min(1).max(256);
|
|
68663
|
-
/** A JSON object body. Size is the engine's check (`maxDataBytes`), not a schema's. */
|
|
68664
|
-
var RecordBodySchema = record(string(), unknown());
|
|
68665
|
-
var RecordInputSchema = object({
|
|
68666
|
-
id: RecordIdSchema,
|
|
68667
|
-
/** The device this row belongs to (D865 removal, per-device reads). */
|
|
68668
|
-
deviceId: number().int().optional(),
|
|
68669
|
-
/** The domain clock, ms: observed / created / opened. */
|
|
68670
|
-
at: number().int().optional(),
|
|
68671
|
-
/** Producer-set expiry, ms. Refused on a kind whose retention is an engine TTL. */
|
|
68672
|
-
expiresAt: number().int().optional(),
|
|
68673
|
-
data: RecordBodySchema
|
|
68674
|
-
});
|
|
68675
|
-
var RecordViewSchema = object({
|
|
68676
|
-
id: string(),
|
|
68677
|
-
deviceId: number().int().nullable(),
|
|
68678
|
-
at: number().nullable(),
|
|
68679
|
-
expiresAt: number().nullable(),
|
|
68680
|
-
rev: number().int(),
|
|
68681
|
-
updatedAt: number(),
|
|
68682
|
-
data: RecordBodySchema
|
|
68683
|
-
});
|
|
68684
|
-
/** Declared index fields only. Anything else does not compile, by design. */
|
|
68685
|
-
var RecordWhereSchema = record(RecordFieldPathSchema, union([
|
|
68686
|
-
string(),
|
|
68687
|
-
number(),
|
|
68688
|
-
boolean(),
|
|
68689
|
-
object({ in: array(union([
|
|
68690
|
-
string(),
|
|
68691
|
-
number(),
|
|
68692
|
-
boolean()
|
|
68693
|
-
])).min(1).max(RECORD_BATCH_MAX) }),
|
|
68694
|
-
object({
|
|
68695
|
-
gt: union([string(), number()]).optional(),
|
|
68696
|
-
gte: union([string(), number()]).optional(),
|
|
68697
|
-
lt: union([string(), number()]).optional(),
|
|
68698
|
-
lte: union([string(), number()]).optional()
|
|
68699
|
-
}).refine((r) => Object.keys(r).length > 0, { message: "name at least one bound" })
|
|
68700
|
-
]));
|
|
68701
|
-
var KindShape = { kind: RecordKindNameSchema };
|
|
68702
|
-
var TimeWindowShape = {
|
|
68703
|
-
deviceId: number().int().optional(),
|
|
68704
|
-
atFrom: number().optional(),
|
|
68705
|
-
atTo: number().optional()
|
|
68706
|
-
};
|
|
68707
|
-
var RecordQueryInputSchema = object({
|
|
68708
|
-
...KindShape,
|
|
68709
|
-
...TimeWindowShape,
|
|
68710
|
-
where: RecordWhereSchema.optional(),
|
|
68711
|
-
/** Without `where`: `at` (default for a kind with a clock) or `id`. With `where` the order is the index's. */
|
|
68712
|
-
order: _enum(["at", "id"]).optional(),
|
|
68713
|
-
desc: boolean().optional(),
|
|
68714
|
-
limit: number().int().min(1).max(RECORD_QUERY_MAX).default(100),
|
|
68715
|
-
/** Opaque keyset cursor from a previous answer. There is no offset. */
|
|
68716
|
-
cursor: string().min(1).optional()
|
|
68717
|
-
});
|
|
68718
|
-
var RecordQueryResultSchema = object({
|
|
68719
|
-
records: array(RecordViewSchema),
|
|
68720
|
-
nextCursor: string().nullable()
|
|
68721
|
-
});
|
|
68722
|
-
var RecordKindStateSchema = _enum([
|
|
68723
|
-
"created",
|
|
68724
|
-
"unchanged",
|
|
68725
|
-
"updated"
|
|
68726
|
-
]);
|
|
68727
|
-
var DeclareKindResultSchema = object({
|
|
68728
|
-
kindId: number().int(),
|
|
68729
|
-
state: RecordKindStateSchema,
|
|
68730
|
-
createdIndexes: array(string())
|
|
68731
|
-
});
|
|
68732
|
-
/** Keychain refs a write released (the old marker is gone from the row): the owner deletes the values. */
|
|
68733
|
-
var SecretRefsList = array(string());
|
|
68734
|
-
/**
|
|
68735
|
-
* One op of a `transact`: the single-row writes, each on a kind of the caller.
|
|
68736
|
-
* All ops of one call share ONE database file and ONE `transactFamily`.
|
|
68737
|
-
*/
|
|
68738
|
-
var RecordTransactOpSchema = discriminatedUnion("op", [
|
|
68739
|
-
object({
|
|
68740
|
-
op: literal("put"),
|
|
68741
|
-
kind: RecordKindNameSchema,
|
|
68742
|
-
record: RecordInputSchema,
|
|
68743
|
-
ifRev: number().int().min(0).optional()
|
|
68744
|
-
}),
|
|
68745
|
-
object({
|
|
68746
|
-
op: literal("patch"),
|
|
68747
|
-
kind: RecordKindNameSchema,
|
|
68748
|
-
id: RecordIdSchema,
|
|
68749
|
-
data: RecordBodySchema,
|
|
68750
|
-
at: number().int().nullable().optional(),
|
|
68751
|
-
expiresAt: number().int().nullable().optional(),
|
|
68752
|
-
ifRev: number().int().min(1).optional()
|
|
68753
|
-
}),
|
|
68754
|
-
object({
|
|
68755
|
-
op: literal("delete"),
|
|
68756
|
-
kind: RecordKindNameSchema,
|
|
68757
|
-
id: RecordIdSchema
|
|
68758
|
-
})
|
|
68759
|
-
]);
|
|
68760
|
-
var RecordSecretRefsSchema = record(string(), record(string(), string()));
|
|
68761
|
-
method(object({ kinds: record(RecordKindNameSchema, RecordKindDeclarationSchema) }), object({ kinds: record(string(), DeclareKindResultSchema) }), {
|
|
68762
|
-
kind: "mutation",
|
|
68763
|
-
auth: "admin"
|
|
68764
|
-
}), method(object({
|
|
68765
|
-
...KindShape,
|
|
68766
|
-
id: RecordIdSchema
|
|
68767
|
-
}), RecordViewSchema.nullable(), { auth: "admin" }), method(object({
|
|
68768
|
-
...KindShape,
|
|
68769
|
-
ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
|
|
68770
|
-
}), array(RecordViewSchema), { auth: "admin" }), method(object({
|
|
68771
|
-
...KindShape,
|
|
68772
|
-
ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
|
|
68773
|
-
}), RecordSecretRefsSchema, { auth: "admin" }), method(object({
|
|
68774
|
-
...KindShape,
|
|
68775
|
-
record: RecordInputSchema,
|
|
68776
|
-
/** Compare-and-set. `0` means "the row must not exist". */
|
|
68777
|
-
ifRev: number().int().min(0).optional()
|
|
68778
|
-
}), object({
|
|
68779
|
-
rev: number().int(),
|
|
68780
|
-
releasedRefs: SecretRefsList
|
|
68781
|
-
}), {
|
|
68782
|
-
kind: "mutation",
|
|
68783
|
-
auth: "admin"
|
|
68784
|
-
}), method(object({
|
|
68785
|
-
...KindShape,
|
|
68786
|
-
records: array(RecordInputSchema).min(1).max(RECORD_BATCH_MAX)
|
|
68787
|
-
}), object({
|
|
68788
|
-
count: number().int(),
|
|
68789
|
-
releasedRefs: SecretRefsList
|
|
68790
|
-
}), {
|
|
68791
|
-
kind: "mutation",
|
|
68792
|
-
auth: "admin"
|
|
68793
|
-
}), method(object({
|
|
68794
|
-
...KindShape,
|
|
68795
|
-
id: RecordIdSchema,
|
|
68796
|
-
data: RecordBodySchema,
|
|
68797
|
-
at: number().int().nullable().optional(),
|
|
68798
|
-
expiresAt: number().int().nullable().optional(),
|
|
68799
|
-
ifRev: number().int().min(1).optional()
|
|
68800
|
-
}), object({
|
|
68801
|
-
rev: number().int(),
|
|
68802
|
-
releasedRefs: SecretRefsList
|
|
68803
|
-
}), {
|
|
68804
|
-
kind: "mutation",
|
|
68805
|
-
auth: "admin"
|
|
68806
|
-
}), method(object({
|
|
68807
|
-
...KindShape,
|
|
68808
|
-
id: RecordIdSchema
|
|
68809
|
-
}), object({
|
|
68810
|
-
deleted: boolean(),
|
|
68811
|
-
secretRefs: SecretRefsList
|
|
68812
|
-
}), {
|
|
68813
|
-
kind: "mutation",
|
|
68814
|
-
auth: "admin"
|
|
68815
|
-
}), method(object({
|
|
68816
|
-
...KindShape,
|
|
68817
|
-
ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
|
|
68818
|
-
}), object({
|
|
68819
|
-
deleted: number().int(),
|
|
68820
|
-
secretRefs: SecretRefsList
|
|
68821
|
-
}), {
|
|
68822
|
-
kind: "mutation",
|
|
68823
|
-
auth: "admin"
|
|
68824
|
-
}), method(RecordQueryInputSchema, RecordQueryResultSchema, { auth: "admin" }), method(object({
|
|
68825
|
-
...KindShape,
|
|
68826
|
-
...TimeWindowShape,
|
|
68827
|
-
where: RecordWhereSchema.optional()
|
|
68828
|
-
}), object({ count: number().int() }), { auth: "admin" }), method(object({
|
|
68829
|
-
...KindShape,
|
|
68830
|
-
deviceId: number().int().optional(),
|
|
68831
|
-
from: number(),
|
|
68832
|
-
to: number(),
|
|
68833
|
-
bucketMs: number().int().positive()
|
|
68834
|
-
}), object({ buckets: array(object({
|
|
68835
|
-
bucketStart: number(),
|
|
68836
|
-
count: number().int()
|
|
68837
|
-
})) }), { auth: "admin" }), method(object({
|
|
68838
|
-
...KindShape,
|
|
68839
|
-
op: _enum([
|
|
68840
|
-
"sum",
|
|
68841
|
-
"min",
|
|
68842
|
-
"max",
|
|
68843
|
-
"count"
|
|
68844
|
-
]),
|
|
68845
|
-
field: RecordFieldPathSchema.optional(),
|
|
68846
|
-
groupBy: RecordFieldPathSchema.optional(),
|
|
68847
|
-
where: RecordWhereSchema.optional()
|
|
68848
|
-
}), object({ rows: array(object({
|
|
68849
|
-
group: union([
|
|
68850
|
-
string(),
|
|
68851
|
-
number(),
|
|
68852
|
-
_null()
|
|
68853
|
-
]),
|
|
68854
|
-
value: number().nullable()
|
|
68855
|
-
})) }), { auth: "admin" }), method(object({
|
|
68856
|
-
...KindShape,
|
|
68857
|
-
deviceId: number().int().optional(),
|
|
68858
|
-
atBefore: number().optional(),
|
|
68859
|
-
where: RecordWhereSchema.optional()
|
|
68860
|
-
}), object({
|
|
68861
|
-
deleted: number().int(),
|
|
68862
|
-
secretRefs: SecretRefsList
|
|
68863
|
-
}), {
|
|
68864
|
-
kind: "mutation",
|
|
68865
|
-
auth: "admin"
|
|
68866
|
-
}), method(object({ ops: array(RecordTransactOpSchema).min(1).max(RECORD_BATCH_MAX) }), object({
|
|
68867
|
-
results: array(object({
|
|
68868
|
-
rev: number().int().nullable(),
|
|
68869
|
-
deleted: boolean()
|
|
68870
|
-
})),
|
|
68871
|
-
releasedRefs: SecretRefsList,
|
|
68872
|
-
secretRefs: SecretRefsList
|
|
68873
|
-
}), {
|
|
68874
|
-
kind: "mutation",
|
|
68875
|
-
auth: "admin"
|
|
68876
|
-
}), method(object({
|
|
68877
|
-
deviceId: number().int(),
|
|
68878
|
-
kinds: array(RecordKindNameSchema).optional()
|
|
68879
|
-
}), object({
|
|
68880
|
-
deleted: record(string(), number().int()),
|
|
68881
|
-
secretRefs: SecretRefsList
|
|
68882
|
-
}), {
|
|
68883
|
-
kind: "mutation",
|
|
68884
|
-
auth: "admin"
|
|
68885
|
-
}), method(object(KindShape), object({ id: number().int() }), {
|
|
68886
|
-
kind: "mutation",
|
|
68887
|
-
auth: "admin"
|
|
68888
|
-
});
|
|
68889
|
-
/**
|
|
68890
69322
|
* record-entries - the ONE admin surface for every list of user-created entries
|
|
68891
69323
|
* (D881): notification targets, brokers, LLM profiles, anything an addon
|
|
68892
69324
|
* declares as an ENTRY kind (`entry: { title }` in `defineRecordKinds`).
|
|
@@ -77448,20 +77880,6 @@ Object.freeze({
|
|
|
77448
77880
|
access: "create",
|
|
77449
77881
|
role: "viewer"
|
|
77450
77882
|
},
|
|
77451
|
-
"broker.add": {
|
|
77452
|
-
capName: "broker",
|
|
77453
|
-
capScope: "system",
|
|
77454
|
-
addonId: null,
|
|
77455
|
-
access: "create",
|
|
77456
|
-
role: "admin"
|
|
77457
|
-
},
|
|
77458
|
-
"broker.get": {
|
|
77459
|
-
capName: "broker",
|
|
77460
|
-
capScope: "system",
|
|
77461
|
-
addonId: null,
|
|
77462
|
-
access: "view",
|
|
77463
|
-
role: "admin"
|
|
77464
|
-
},
|
|
77465
77883
|
"broker.getBrokerConfig": {
|
|
77466
77884
|
capName: "broker",
|
|
77467
77885
|
capScope: "system",
|
|
@@ -77469,20 +77887,6 @@ Object.freeze({
|
|
|
77469
77887
|
access: "view",
|
|
77470
77888
|
role: "admin"
|
|
77471
77889
|
},
|
|
77472
|
-
"broker.getSettings": {
|
|
77473
|
-
capName: "broker",
|
|
77474
|
-
capScope: "system",
|
|
77475
|
-
addonId: null,
|
|
77476
|
-
access: "view",
|
|
77477
|
-
role: "admin"
|
|
77478
|
-
},
|
|
77479
|
-
"broker.getSettingsSchema": {
|
|
77480
|
-
capName: "broker",
|
|
77481
|
-
capScope: "system",
|
|
77482
|
-
addonId: null,
|
|
77483
|
-
access: "view",
|
|
77484
|
-
role: "admin"
|
|
77485
|
-
},
|
|
77486
77890
|
"broker.getState": {
|
|
77487
77891
|
capName: "broker",
|
|
77488
77892
|
capScope: "system",
|
|
@@ -77497,20 +77901,6 @@ Object.freeze({
|
|
|
77497
77901
|
access: "view",
|
|
77498
77902
|
role: "admin"
|
|
77499
77903
|
},
|
|
77500
|
-
"broker.list": {
|
|
77501
|
-
capName: "broker",
|
|
77502
|
-
capScope: "system",
|
|
77503
|
-
addonId: null,
|
|
77504
|
-
access: "view",
|
|
77505
|
-
role: "admin"
|
|
77506
|
-
},
|
|
77507
|
-
"broker.listProviders": {
|
|
77508
|
-
capName: "broker",
|
|
77509
|
-
capScope: "system",
|
|
77510
|
-
addonId: null,
|
|
77511
|
-
access: "view",
|
|
77512
|
-
role: "admin"
|
|
77513
|
-
},
|
|
77514
77904
|
"broker.publish": {
|
|
77515
77905
|
capName: "broker",
|
|
77516
77906
|
capScope: "system",
|
|
@@ -77518,20 +77908,6 @@ Object.freeze({
|
|
|
77518
77908
|
access: "create",
|
|
77519
77909
|
role: "admin"
|
|
77520
77910
|
},
|
|
77521
|
-
"broker.remove": {
|
|
77522
|
-
capName: "broker",
|
|
77523
|
-
capScope: "system",
|
|
77524
|
-
addonId: null,
|
|
77525
|
-
access: "delete",
|
|
77526
|
-
role: "admin"
|
|
77527
|
-
},
|
|
77528
|
-
"broker.setSettings": {
|
|
77529
|
-
capName: "broker",
|
|
77530
|
-
capScope: "system",
|
|
77531
|
-
addonId: null,
|
|
77532
|
-
access: "create",
|
|
77533
|
-
role: "admin"
|
|
77534
|
-
},
|
|
77535
77911
|
"broker.subscribe": {
|
|
77536
77912
|
capName: "broker",
|
|
77537
77913
|
capScope: "system",
|
|
@@ -77539,20 +77915,6 @@ Object.freeze({
|
|
|
77539
77915
|
access: "create",
|
|
77540
77916
|
role: "admin"
|
|
77541
77917
|
},
|
|
77542
|
-
"broker.testConnection": {
|
|
77543
|
-
capName: "broker",
|
|
77544
|
-
capScope: "system",
|
|
77545
|
-
addonId: null,
|
|
77546
|
-
access: "create",
|
|
77547
|
-
role: "admin"
|
|
77548
|
-
},
|
|
77549
|
-
"broker.testSettings": {
|
|
77550
|
-
capName: "broker",
|
|
77551
|
-
capScope: "system",
|
|
77552
|
-
addonId: null,
|
|
77553
|
-
access: "create",
|
|
77554
|
-
role: "admin"
|
|
77555
|
-
},
|
|
77556
77918
|
"broker.unsubscribe": {
|
|
77557
77919
|
capName: "broker",
|
|
77558
77920
|
capScope: "system",
|
|
@@ -80150,13 +80512,6 @@ Object.freeze({
|
|
|
80150
80512
|
access: "create",
|
|
80151
80513
|
role: "admin"
|
|
80152
80514
|
},
|
|
80153
|
-
"integrations.clearSettings": {
|
|
80154
|
-
capName: "integrations",
|
|
80155
|
-
capScope: "system",
|
|
80156
|
-
addonId: null,
|
|
80157
|
-
access: "delete",
|
|
80158
|
-
role: "admin"
|
|
80159
|
-
},
|
|
80160
80515
|
"integrations.create": {
|
|
80161
80516
|
capName: "integrations",
|
|
80162
80517
|
capScope: "system",
|
|
@@ -80192,13 +80547,6 @@ Object.freeze({
|
|
|
80192
80547
|
access: "view",
|
|
80193
80548
|
role: "admin"
|
|
80194
80549
|
},
|
|
80195
|
-
"integrations.getSettings": {
|
|
80196
|
-
capName: "integrations",
|
|
80197
|
-
capScope: "system",
|
|
80198
|
-
addonId: null,
|
|
80199
|
-
access: "view",
|
|
80200
|
-
role: "admin"
|
|
80201
|
-
},
|
|
80202
80550
|
"integrations.list": {
|
|
80203
80551
|
capName: "integrations",
|
|
80204
80552
|
capScope: "system",
|
|
@@ -80206,13 +80554,6 @@ Object.freeze({
|
|
|
80206
80554
|
access: "view",
|
|
80207
80555
|
role: "admin"
|
|
80208
80556
|
},
|
|
80209
|
-
"integrations.setSettings": {
|
|
80210
|
-
capName: "integrations",
|
|
80211
|
-
capScope: "system",
|
|
80212
|
-
addonId: null,
|
|
80213
|
-
access: "create",
|
|
80214
|
-
role: "admin"
|
|
80215
|
-
},
|
|
80216
80557
|
"integrations.testConnection": {
|
|
80217
80558
|
capName: "integrations",
|
|
80218
80559
|
capScope: "system",
|
|
@@ -81207,6 +81548,13 @@ Object.freeze({
|
|
|
81207
81548
|
access: "view",
|
|
81208
81549
|
role: "admin"
|
|
81209
81550
|
},
|
|
81551
|
+
"migrations.clearLegacyIntegrationRows": {
|
|
81552
|
+
capName: "migrations",
|
|
81553
|
+
capScope: "system",
|
|
81554
|
+
addonId: null,
|
|
81555
|
+
access: "delete",
|
|
81556
|
+
role: "admin"
|
|
81557
|
+
},
|
|
81210
81558
|
"migrations.declareOwner": {
|
|
81211
81559
|
capName: "migrations",
|
|
81212
81560
|
capScope: "system",
|
|
@@ -81214,6 +81562,13 @@ Object.freeze({
|
|
|
81214
81562
|
access: "create",
|
|
81215
81563
|
role: "admin"
|
|
81216
81564
|
},
|
|
81565
|
+
"migrations.deleteLegacyIntegrationRowKeys": {
|
|
81566
|
+
capName: "migrations",
|
|
81567
|
+
capScope: "system",
|
|
81568
|
+
addonId: null,
|
|
81569
|
+
access: "delete",
|
|
81570
|
+
role: "admin"
|
|
81571
|
+
},
|
|
81217
81572
|
"migrations.dryRun": {
|
|
81218
81573
|
capName: "migrations",
|
|
81219
81574
|
capScope: "system",
|
|
@@ -81249,6 +81604,20 @@ Object.freeze({
|
|
|
81249
81604
|
access: "create",
|
|
81250
81605
|
role: "admin"
|
|
81251
81606
|
},
|
|
81607
|
+
"migrations.patchLegacyIntegrationRows": {
|
|
81608
|
+
capName: "migrations",
|
|
81609
|
+
capScope: "system",
|
|
81610
|
+
addonId: null,
|
|
81611
|
+
access: "create",
|
|
81612
|
+
role: "admin"
|
|
81613
|
+
},
|
|
81614
|
+
"migrations.readLegacyIntegrationRows": {
|
|
81615
|
+
capName: "migrations",
|
|
81616
|
+
capScope: "system",
|
|
81617
|
+
addonId: null,
|
|
81618
|
+
access: "view",
|
|
81619
|
+
role: "admin"
|
|
81620
|
+
},
|
|
81252
81621
|
"migrations.restorePreMigration": {
|
|
81253
81622
|
capName: "migrations",
|
|
81254
81623
|
capScope: "system",
|
|
@@ -82306,13 +82675,6 @@ Object.freeze({
|
|
|
82306
82675
|
access: "view",
|
|
82307
82676
|
role: "viewer"
|
|
82308
82677
|
},
|
|
82309
|
-
"petFountain.resetDailyConsumption": {
|
|
82310
|
-
capName: "pet-fountain",
|
|
82311
|
-
capScope: "device",
|
|
82312
|
-
addonId: null,
|
|
82313
|
-
access: "delete",
|
|
82314
|
-
role: "viewer"
|
|
82315
|
-
},
|
|
82316
82678
|
"petFountain.setPump": {
|
|
82317
82679
|
capName: "pet-fountain",
|
|
82318
82680
|
capScope: "device",
|
|
@@ -82509,6 +82871,13 @@ Object.freeze({
|
|
|
82509
82871
|
access: "view",
|
|
82510
82872
|
role: "viewer"
|
|
82511
82873
|
},
|
|
82874
|
+
"pipelineAnalytics.getMediaLocationCensus": {
|
|
82875
|
+
capName: "pipeline-analytics",
|
|
82876
|
+
capScope: "device",
|
|
82877
|
+
addonId: null,
|
|
82878
|
+
access: "view",
|
|
82879
|
+
role: "admin"
|
|
82880
|
+
},
|
|
82512
82881
|
"pipelineAnalytics.getMediaReclaimStatus": {
|
|
82513
82882
|
capName: "pipeline-analytics",
|
|
82514
82883
|
capScope: "device",
|
|
@@ -88727,11 +89096,6 @@ Object.freeze({
|
|
|
88727
89096
|
form: "single",
|
|
88728
89097
|
optional: false
|
|
88729
89098
|
}],
|
|
88730
|
-
"petFountain.resetDailyConsumption": [{
|
|
88731
|
-
name: "deviceId",
|
|
88732
|
-
form: "single",
|
|
88733
|
-
optional: false
|
|
88734
|
-
}],
|
|
88735
89099
|
"petFountain.setPump": [{
|
|
88736
89100
|
name: "deviceId",
|
|
88737
89101
|
form: "single",
|
|
@@ -105630,7 +105994,7 @@ var ExportAlexaAddon = class extends BaseAddon {
|
|
|
105630
105994
|
}),
|
|
105631
105995
|
mintId: () => `alexa-skill-${(0, node_crypto.randomUUID)().slice(0, 8)}`,
|
|
105632
105996
|
health: (body, id) => {
|
|
105633
|
-
if (body
|
|
105997
|
+
if (!isInstanceEnabled(body)) return { status: {
|
|
105634
105998
|
state: "off",
|
|
105635
105999
|
label: "Off"
|
|
105636
106000
|
} };
|