@camstack/addon-provider-bosch 0.1.38 → 0.1.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/{account-integration-offline-DhHNdL3k.mjs → account-integration-offline-DTnyqayb.mjs} +1 -1
- package/dist/{account-integration-offline-CeMaWElV.js → account-integration-offline-DwgBg38i.js} +1 -1
- package/dist/{bosch-instances-Y9sMCElY.js → bosch-instances-DEH7DYwo.js} +1509 -1259
- package/dist/{bosch-instances-CIuDwXQ8.mjs → bosch-instances-Yqi-WAZN.mjs} +1504 -1248
- package/dist/home-connect/addon.js +10 -10
- package/dist/home-connect/addon.mjs +10 -10
- package/dist/homecom/addon.js +10 -10
- package/dist/homecom/addon.mjs +10 -10
- package/dist/shc/addon.js +9 -9
- package/dist/shc/addon.mjs +9 -9
- package/package.json +2 -2
|
@@ -5981,7 +5981,7 @@ var ZodIssueCode = {
|
|
|
5981
5981
|
var ZodFirstPartyTypeKind;
|
|
5982
5982
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
5983
5983
|
//#endregion
|
|
5984
|
-
//#region ../types/dist/sleep-
|
|
5984
|
+
//#region ../types/dist/sleep-CmjWurK5.mjs
|
|
5985
5985
|
/**
|
|
5986
5986
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
5987
5987
|
* window to float samples (D455).
|
|
@@ -6665,137 +6665,153 @@ async function runAddonMigrations(host, migrations, logger, options = {}) {
|
|
|
6665
6665
|
blockOwner
|
|
6666
6666
|
};
|
|
6667
6667
|
}
|
|
6668
|
-
|
|
6669
|
-
* Build a {@link DurableState} over a single store key. Transport-agnostic:
|
|
6670
|
-
* `read`/`write` are the addon-store or device-store accessors. The whole
|
|
6671
|
-
* validated value round-trips on every read/write — the schema is the
|
|
6672
|
-
* single source of truth for what is persisted, so no hand-listed field
|
|
6673
|
-
* set can drop a key on save.
|
|
6674
|
-
*/
|
|
6675
|
-
function createDurableState(deps) {
|
|
6676
|
-
const get = async () => {
|
|
6677
|
-
const raw = (await deps.read())[deps.key];
|
|
6678
|
-
if (raw === void 0) return deps.fallback;
|
|
6679
|
-
const parsed = deps.schema.safeParse(raw);
|
|
6680
|
-
if (!parsed.success) {
|
|
6681
|
-
deps.onParseError?.(deps.key, parsed.error);
|
|
6682
|
-
return deps.fallback;
|
|
6683
|
-
}
|
|
6684
|
-
return parsed.data;
|
|
6685
|
-
};
|
|
6686
|
-
const set = async (next) => {
|
|
6687
|
-
const validated = deps.schema.parse(next);
|
|
6688
|
-
await deps.write({ [deps.key]: validated });
|
|
6689
|
-
};
|
|
6690
|
-
const update = async (fn) => {
|
|
6691
|
-
await set(fn(await get()));
|
|
6692
|
-
};
|
|
6668
|
+
function secretsOverMigrationApi(api) {
|
|
6693
6669
|
return {
|
|
6694
|
-
|
|
6695
|
-
|
|
6696
|
-
|
|
6670
|
+
resolve: async (refs) => {
|
|
6671
|
+
const { values } = await api.secrets.resolve({ refs: [...refs] });
|
|
6672
|
+
const out = {};
|
|
6673
|
+
for (const ref of refs) {
|
|
6674
|
+
const value = values[ref];
|
|
6675
|
+
out[ref] = value === null || value === void 0 ? { kind: "missing" } : {
|
|
6676
|
+
kind: "value",
|
|
6677
|
+
value,
|
|
6678
|
+
version: 0
|
|
6679
|
+
};
|
|
6680
|
+
}
|
|
6681
|
+
return out;
|
|
6682
|
+
},
|
|
6683
|
+
delete: async (refs) => (await api.secrets.delete({ refs: [...refs] })).deleted
|
|
6697
6684
|
};
|
|
6698
6685
|
}
|
|
6699
|
-
/**
|
|
6700
|
-
|
|
6701
|
-
|
|
6702
|
-
|
|
6703
|
-
|
|
6704
|
-
|
|
6705
|
-
|
|
6706
|
-
|
|
6707
|
-
|
|
6708
|
-
|
|
6709
|
-
|
|
6710
|
-
|
|
6711
|
-
|
|
6712
|
-
|
|
6713
|
-
|
|
6714
|
-
|
|
6715
|
-
* ## No bare-key fallback — deliberate
|
|
6716
|
-
*
|
|
6717
|
-
* {@link readNodeValue} reads the node-scoped key ONLY. A node with no
|
|
6718
|
-
* scoped key resolves to `undefined` so the field's schema `default` wins —
|
|
6719
|
-
* NEVER `store[base]` and never another node's value. A bare legacy key in
|
|
6720
|
-
* the store is invisible to every node, hub included, so one node's
|
|
6721
|
-
* selection can never leak onto another. (This generalizes the
|
|
6722
|
-
* `decoder-backend-keys.ts` semantics — the no-fallback variant — over an
|
|
6723
|
-
* arbitrary set of per-node field keys.)
|
|
6724
|
-
*
|
|
6725
|
-
* Pure functions only — no I/O, no imports beyond the language. This is a
|
|
6726
|
-
* LEAF module: import it via its deep path, never from the root barrel.
|
|
6727
|
-
*/
|
|
6728
|
-
/**
|
|
6729
|
-
* Normalize a raw kernel node id to the bare node id used for scoping.
|
|
6730
|
-
* `localNodeId` can carry a `<node>/<addon>` suffix on forked child
|
|
6731
|
-
* processes; per-node settings are per-NODE, so strip the addon segment.
|
|
6732
|
-
* `undefined` / `null` / empty falls back to `'hub'`.
|
|
6733
|
-
*/
|
|
6734
|
-
function normalizeNodeId(raw) {
|
|
6735
|
-
if (raw === void 0 || raw === null || raw === "") return "hub";
|
|
6736
|
-
const slashIdx = raw.indexOf("/");
|
|
6737
|
-
if (slashIdx < 0) return raw;
|
|
6738
|
-
const bare = raw.slice(0, slashIdx);
|
|
6739
|
-
return bare === "" ? "hub" : bare;
|
|
6686
|
+
/** The record calls the one-switch migration makes, over the migration API. */
|
|
6687
|
+
function switchRecordsOverMigrationApi(api) {
|
|
6688
|
+
return { kind: (definition) => {
|
|
6689
|
+
const handle = api.records.kind(definition);
|
|
6690
|
+
return {
|
|
6691
|
+
get: (id) => handle.get({ id }),
|
|
6692
|
+
put: (input, opts) => handle.put({
|
|
6693
|
+
...input,
|
|
6694
|
+
...opts?.ifRev === void 0 ? {} : { ifRev: opts.ifRev }
|
|
6695
|
+
}),
|
|
6696
|
+
patch: (id, partial) => handle.patch({
|
|
6697
|
+
id,
|
|
6698
|
+
partial
|
|
6699
|
+
})
|
|
6700
|
+
};
|
|
6701
|
+
} };
|
|
6740
6702
|
}
|
|
6741
|
-
/**
|
|
6742
|
-
function
|
|
6743
|
-
return
|
|
6703
|
+
/** `ctx.records` as the migration API offers it: bind a kind, read and write by id. */
|
|
6704
|
+
function recordsOverMigrationApi(api) {
|
|
6705
|
+
return { kind: (definition) => {
|
|
6706
|
+
const handle = api.records.kind(definition);
|
|
6707
|
+
return {
|
|
6708
|
+
get: (id) => handle.get({ id }),
|
|
6709
|
+
getResolved: (id) => handle.getResolved({ id }),
|
|
6710
|
+
put: (input, opts) => handle.put({
|
|
6711
|
+
...input,
|
|
6712
|
+
...opts?.ifRev === void 0 ? {} : { ifRev: opts.ifRev }
|
|
6713
|
+
}),
|
|
6714
|
+
delete: (id) => handle.delete({ id })
|
|
6715
|
+
};
|
|
6716
|
+
} };
|
|
6744
6717
|
}
|
|
6745
|
-
|
|
6746
|
-
|
|
6747
|
-
|
|
6748
|
-
|
|
6749
|
-
|
|
6750
|
-
|
|
6751
|
-
function readNodeValue(store, base, nodeId) {
|
|
6752
|
-
return store[nodeScopedKey(base, nodeId)];
|
|
6718
|
+
function integrationRowsApiOver(api) {
|
|
6719
|
+
return {
|
|
6720
|
+
list: async () => (await api.integrations.list({})).integrations,
|
|
6721
|
+
readLegacyIntegrationRows: (input) => api.legacyRows.read(input),
|
|
6722
|
+
clearLegacyIntegrationRows: (input) => api.legacyRows.clear(input)
|
|
6723
|
+
};
|
|
6753
6724
|
}
|
|
6754
6725
|
/**
|
|
6755
|
-
*
|
|
6756
|
-
*
|
|
6757
|
-
* the
|
|
6758
|
-
*
|
|
6759
|
-
* patch is not mutated.
|
|
6726
|
+
* One serial lane per migration API: a log line is delivered after the line before it, so the
|
|
6727
|
+
* order the steps wrote them in is the order the hub reads them in. A delivery that fails
|
|
6728
|
+
* is reported once through the same door; if that fails too nothing is left to tell, and the
|
|
6729
|
+
* line is dropped rather than thrown into a migration step or left as an unhandled rejection.
|
|
6760
6730
|
*/
|
|
6761
|
-
|
|
6762
|
-
|
|
6763
|
-
|
|
6764
|
-
|
|
6731
|
+
var lanes = /* @__PURE__ */ new WeakMap();
|
|
6732
|
+
function deliver(api, send) {
|
|
6733
|
+
const next = (lanes.get(api) ?? Promise.resolve()).then(send).then(() => void 0).catch(async (error) => {
|
|
6734
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
6735
|
+
await api.log.warn({ message: `a migration log line could not be delivered: ${reason}` }).catch(() => void 0);
|
|
6736
|
+
});
|
|
6737
|
+
lanes.set(api, next);
|
|
6738
|
+
return next;
|
|
6765
6739
|
}
|
|
6766
|
-
|
|
6767
|
-
|
|
6768
|
-
|
|
6769
|
-
|
|
6770
|
-
|
|
6771
|
-
|
|
6772
|
-
|
|
6773
|
-
|
|
6774
|
-
|
|
6775
|
-
|
|
6776
|
-
|
|
6777
|
-
|
|
6778
|
-
|
|
6779
|
-
*/
|
|
6780
|
-
|
|
6781
|
-
|
|
6782
|
-
|
|
6783
|
-
|
|
6784
|
-
|
|
6785
|
-
|
|
6740
|
+
function warnOver(api) {
|
|
6741
|
+
return (message) => deliver(api, () => api.log.warn({ message }));
|
|
6742
|
+
}
|
|
6743
|
+
/** What the rows-to-records move needs, over the migration API. */
|
|
6744
|
+
function rowsDepsOver(api) {
|
|
6745
|
+
return {
|
|
6746
|
+
api: integrationRowsApiOver(api),
|
|
6747
|
+
records: recordsOverMigrationApi(api),
|
|
6748
|
+
secrets: secretsOverMigrationApi(api),
|
|
6749
|
+
warn: warnOver(api)
|
|
6750
|
+
};
|
|
6751
|
+
}
|
|
6752
|
+
var PREFIX = "records/";
|
|
6753
|
+
/** The base of every records failure. `detail` is the human part of the message. */
|
|
6754
|
+
var RecordsError = class extends Error {
|
|
6755
|
+
code;
|
|
6756
|
+
detail;
|
|
6757
|
+
constructor(code, detail) {
|
|
6758
|
+
super(`${PREFIX}${code}: ${detail}`);
|
|
6759
|
+
this.name = "RecordsError";
|
|
6760
|
+
this.code = code;
|
|
6761
|
+
this.detail = detail;
|
|
6786
6762
|
}
|
|
6787
|
-
|
|
6788
|
-
|
|
6789
|
-
|
|
6763
|
+
};
|
|
6764
|
+
/** A write guarded by `ifRev` found another revision (or an existing row for `ifRev: 0`). */
|
|
6765
|
+
var RevConflictError = class extends RecordsError {
|
|
6766
|
+
constructor(detail) {
|
|
6767
|
+
super("rev-conflict", detail);
|
|
6768
|
+
this.name = "RevConflictError";
|
|
6790
6769
|
}
|
|
6791
|
-
|
|
6770
|
+
};
|
|
6771
|
+
/** The keychain could not store or serve a value: explicit, never an empty string. */
|
|
6772
|
+
var RecordSecretUnavailableError = class extends RecordsError {
|
|
6773
|
+
constructor(detail) {
|
|
6774
|
+
super("secret-unavailable", detail);
|
|
6775
|
+
this.name = "RecordSecretUnavailableError";
|
|
6776
|
+
}
|
|
6777
|
+
};
|
|
6778
|
+
var InvalidRecordError = class extends RecordsError {
|
|
6779
|
+
constructor(detail) {
|
|
6780
|
+
super("invalid-record", detail);
|
|
6781
|
+
this.name = "InvalidRecordError";
|
|
6782
|
+
}
|
|
6783
|
+
};
|
|
6784
|
+
/** A kind declaration the engine refuses (non-additive change, bad shape, wrong file). */
|
|
6785
|
+
var DeclarationRefusedError = class extends RecordsError {
|
|
6786
|
+
constructor(detail) {
|
|
6787
|
+
super("declaration-refused", detail);
|
|
6788
|
+
this.name = "DeclarationRefusedError";
|
|
6789
|
+
}
|
|
6790
|
+
};
|
|
6791
|
+
function linkTargetOf(meta) {
|
|
6792
|
+
if (typeof meta !== "object" || meta === null) return void 0;
|
|
6793
|
+
const link = Reflect.get(meta, "link");
|
|
6794
|
+
const parsed = LinkTargetSchema.safeParse(link);
|
|
6795
|
+
return parsed.success ? parsed.data : void 0;
|
|
6796
|
+
}
|
|
6797
|
+
var LinkTargetSchema = object({
|
|
6798
|
+
cap: string().min(1),
|
|
6799
|
+
kind: string().min(1).optional()
|
|
6800
|
+
});
|
|
6801
|
+
/** The links a kind declares, read from the meta of its body fields. */
|
|
6802
|
+
function linksOfKind(kind) {
|
|
6803
|
+
const schema = kind.schema;
|
|
6804
|
+
if (!(schema instanceof ZodObject)) return [];
|
|
6805
|
+
const links = [];
|
|
6806
|
+
for (const [field, fieldSchema] of Object.entries(schema.shape)) {
|
|
6807
|
+
const to = linkTargetOf(globalRegistry.get(fieldSchema));
|
|
6808
|
+
if (to !== void 0) links.push({
|
|
6809
|
+
field,
|
|
6810
|
+
to
|
|
6811
|
+
});
|
|
6812
|
+
}
|
|
6813
|
+
return links;
|
|
6792
6814
|
}
|
|
6793
|
-
/** Every scope, in the order the guard and the docs list them. */
|
|
6794
|
-
var SCOPED_SETTINGS_SCOPES = [
|
|
6795
|
-
"cluster",
|
|
6796
|
-
"device-defaults",
|
|
6797
|
-
"node"
|
|
6798
|
-
];
|
|
6799
6815
|
/**
|
|
6800
6816
|
* The address of one keychain value: `secret://<owner>/<scope>/<fieldPath>`.
|
|
6801
6817
|
*
|
|
@@ -6930,6 +6946,652 @@ function parseSecretRef(ref) {
|
|
|
6930
6946
|
fieldPath
|
|
6931
6947
|
};
|
|
6932
6948
|
}
|
|
6949
|
+
/** Limits and names of `ctx.records` (D881). One authority; the engine and the facade read it. */
|
|
6950
|
+
/** The files a kind may live in. `history` is device-history's (D850), never records. */
|
|
6951
|
+
var RECORD_DATABASES = ["settings", "events"];
|
|
6952
|
+
/** The classes of a kind: the `@durable` vocabulary, one authority (replaces the annotation). */
|
|
6953
|
+
var RECORD_CLASSES = [
|
|
6954
|
+
"config",
|
|
6955
|
+
"ledger",
|
|
6956
|
+
"audit",
|
|
6957
|
+
"mirror",
|
|
6958
|
+
"ephemeral"
|
|
6959
|
+
];
|
|
6960
|
+
var RECORD_DEFAULT_MAX_DATA_BYTES = 64 * 1024;
|
|
6961
|
+
var RECORD_MAX_DATA_BYTES = 1024 * 1024;
|
|
6962
|
+
var RECORD_BATCH_MAX = 1e3;
|
|
6963
|
+
var RECORD_QUERY_MAX = 1e3;
|
|
6964
|
+
/** A kind in the `settings` file may not bound itself above this (D447: high volume is `events`). */
|
|
6965
|
+
var RECORD_SETTINGS_MAX_ROWS = 5e4;
|
|
6966
|
+
/** The `Column`-free proof prefix: a ref collection for a kind's secret fields. */
|
|
6967
|
+
var RECORD_SECRET_COLLECTION_PREFIX = "records:";
|
|
6968
|
+
/**
|
|
6969
|
+
* Secret fields of a record, addressed the way a Zod schema declares them
|
|
6970
|
+
* (`collectZodSecretPaths`): dotted keys, `[]` for "each element of this array"
|
|
6971
|
+
* (`auth.accessToken`, `headers[].value`).
|
|
6972
|
+
*
|
|
6973
|
+
* `{}` after a key means "each value of this map" (`applianceSecrets{}`): the map's own key
|
|
6974
|
+
* names the value (`applianceSecrets{fridge}`), so no id key is declared and a body that drops a
|
|
6975
|
+
* key releases exactly that key's secret.
|
|
6976
|
+
*
|
|
6977
|
+
* Array elements are matched by a DECLARED id key (`secretArrayKeys`:
|
|
6978
|
+
* `{ headers: 'name' }`), never by index, so reordering a list keeps every
|
|
6979
|
+
* keychain ref (the same rule as `arrayItemFieldPath`). The concrete path of a
|
|
6980
|
+
* leaf names its element: `headers[X-Api].value`.
|
|
6981
|
+
*
|
|
6982
|
+
* Pure and browser-safe. Nothing here mutates: every transform returns a new value.
|
|
6983
|
+
*/
|
|
6984
|
+
/** The array prefixes (declared form, e.g. `headers` or `a.headers`) of a path. */
|
|
6985
|
+
function parseSecretPath(path) {
|
|
6986
|
+
if (path.length === 0) throw new InvalidRecordError("an empty secret path");
|
|
6987
|
+
return path.split(".").map((raw) => {
|
|
6988
|
+
const each = raw.endsWith("[]");
|
|
6989
|
+
const map = raw.endsWith("{}");
|
|
6990
|
+
const key = each || map ? raw.slice(0, -2) : raw;
|
|
6991
|
+
if (key.length === 0) throw new InvalidRecordError(`secret path "${path}" has an empty segment`);
|
|
6992
|
+
return {
|
|
6993
|
+
key,
|
|
6994
|
+
each,
|
|
6995
|
+
map
|
|
6996
|
+
};
|
|
6997
|
+
});
|
|
6998
|
+
}
|
|
6999
|
+
/** The declared array prefixes of `path` that need an id key (`headers`, `a.rows`). */
|
|
7000
|
+
function secretArrayPrefixes(path) {
|
|
7001
|
+
const segments = parseSecretPath(path);
|
|
7002
|
+
const prefixes = [];
|
|
7003
|
+
const walked = [];
|
|
7004
|
+
for (const segment of segments) {
|
|
7005
|
+
walked.push(segment.key);
|
|
7006
|
+
if (segment.each) prefixes.push(walked.join("."));
|
|
7007
|
+
}
|
|
7008
|
+
return prefixes;
|
|
7009
|
+
}
|
|
7010
|
+
function isRecord$6(value) {
|
|
7011
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
7012
|
+
}
|
|
7013
|
+
function elementId(element, idKey, declared, prefix) {
|
|
7014
|
+
const id = isRecord$6(element) ? element[idKey] : void 0;
|
|
7015
|
+
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`);
|
|
7016
|
+
return id;
|
|
7017
|
+
}
|
|
7018
|
+
/**
|
|
7019
|
+
* Visit every secret leaf PRESENT in `data` (an absent branch has nothing to
|
|
7020
|
+
* visit). `replace` returns the new leaf value, or {@link REMOVE_LEAF}; the
|
|
7021
|
+
* result is a new body, `data` is untouched.
|
|
7022
|
+
*/
|
|
7023
|
+
var REMOVE_LEAF = Symbol("remove-leaf");
|
|
7024
|
+
function mapAt(node, segments, index, walkedKeys, concretePrefix, declared, arrayKeys, visit) {
|
|
7025
|
+
if (!isRecord$6(node)) return node;
|
|
7026
|
+
const segment = segments[index];
|
|
7027
|
+
if (segment === void 0) return node;
|
|
7028
|
+
if (!Object.prototype.hasOwnProperty.call(node, segment.key)) return node;
|
|
7029
|
+
const child = node[segment.key];
|
|
7030
|
+
const keys = [...walkedKeys, segment.key];
|
|
7031
|
+
const last = index === segments.length - 1;
|
|
7032
|
+
if (segment.each) {
|
|
7033
|
+
if (!Array.isArray(child)) return node;
|
|
7034
|
+
const prefix = keys.join(".");
|
|
7035
|
+
const idKey = arrayKeys[prefix];
|
|
7036
|
+
if (idKey === void 0) throw new InvalidRecordError(`"${declared}": no id key declared for the array "${prefix}"`);
|
|
7037
|
+
const mapped = child.map((element) => {
|
|
7038
|
+
const id = elementId(element, idKey, declared, prefix);
|
|
7039
|
+
const concrete = `${concretePrefix}${concretePrefix.length > 0 ? "." : ""}${segment.key}[${encodeURIComponent(id)}]`;
|
|
7040
|
+
return last ? element : mapAt(element, segments, index + 1, keys, concrete, declared, arrayKeys, visit);
|
|
7041
|
+
});
|
|
7042
|
+
return {
|
|
7043
|
+
...node,
|
|
7044
|
+
[segment.key]: mapped
|
|
7045
|
+
};
|
|
7046
|
+
}
|
|
7047
|
+
if (segment.map) {
|
|
7048
|
+
if (!isRecord$6(child)) return node;
|
|
7049
|
+
const kept = Object.entries(child).map(([mapKey, value]) => {
|
|
7050
|
+
const concrete = `${concretePrefix}${concretePrefix.length > 0 ? "." : ""}${segment.key}{${encodeURIComponent(mapKey)}}`;
|
|
7051
|
+
if (!last) return [mapKey, mapAt(value, segments, index + 1, keys, concrete, declared, arrayKeys, visit)];
|
|
7052
|
+
return [mapKey, visit({
|
|
7053
|
+
declared,
|
|
7054
|
+
concrete,
|
|
7055
|
+
value
|
|
7056
|
+
})];
|
|
7057
|
+
}).filter(([, value]) => value !== REMOVE_LEAF);
|
|
7058
|
+
return {
|
|
7059
|
+
...node,
|
|
7060
|
+
[segment.key]: Object.fromEntries(kept)
|
|
7061
|
+
};
|
|
7062
|
+
}
|
|
7063
|
+
const concrete = `${concretePrefix}${concretePrefix.length > 0 ? "." : ""}${segment.key}`;
|
|
7064
|
+
if (last) {
|
|
7065
|
+
const replacement = visit({
|
|
7066
|
+
declared,
|
|
7067
|
+
concrete,
|
|
7068
|
+
value: child
|
|
7069
|
+
});
|
|
7070
|
+
if (replacement === REMOVE_LEAF) return Object.fromEntries(Object.entries(node).filter(([key]) => key !== segment.key));
|
|
7071
|
+
return {
|
|
7072
|
+
...node,
|
|
7073
|
+
[segment.key]: replacement
|
|
7074
|
+
};
|
|
7075
|
+
}
|
|
7076
|
+
return {
|
|
7077
|
+
...node,
|
|
7078
|
+
[segment.key]: mapAt(child, segments, index + 1, keys, concrete, declared, arrayKeys, visit)
|
|
7079
|
+
};
|
|
7080
|
+
}
|
|
7081
|
+
/** Replace/remove every present secret leaf; returns a NEW body. */
|
|
7082
|
+
function mapSecretLeaves(data, paths, arrayKeys, visit) {
|
|
7083
|
+
let current = data;
|
|
7084
|
+
for (const declared of paths) current = mapAt(current, parseSecretPath(declared), 0, [], "", declared, arrayKeys, visit);
|
|
7085
|
+
return current;
|
|
7086
|
+
}
|
|
7087
|
+
/** Every present secret leaf, read-only. */
|
|
7088
|
+
function collectSecretLeaves(data, paths, arrayKeys) {
|
|
7089
|
+
const found = [];
|
|
7090
|
+
mapSecretLeaves(data, paths, arrayKeys, (leaf) => {
|
|
7091
|
+
found.push(leaf);
|
|
7092
|
+
return leaf.value;
|
|
7093
|
+
});
|
|
7094
|
+
return found;
|
|
7095
|
+
}
|
|
7096
|
+
/**
|
|
7097
|
+
* The keychain collection name a kind's secrets live under. Prefixed so a
|
|
7098
|
+
* record's refs never collide with the refs a legacy collection of the same name
|
|
7099
|
+
* already holds during an adoption.
|
|
7100
|
+
*/
|
|
7101
|
+
function recordSecretCollection(kind) {
|
|
7102
|
+
return `${RECORD_SECRET_COLLECTION_PREFIX}${kind}`;
|
|
7103
|
+
}
|
|
7104
|
+
/** The ONE ref a row's secret field may carry: the engine and the facade both build it here. */
|
|
7105
|
+
function recordSecretRef(owner, kind, rowId, concretePath) {
|
|
7106
|
+
return buildSecretRef({
|
|
7107
|
+
owner,
|
|
7108
|
+
scope: {
|
|
7109
|
+
kind: "row",
|
|
7110
|
+
collection: recordSecretCollection(kind),
|
|
7111
|
+
rowId
|
|
7112
|
+
},
|
|
7113
|
+
fieldPath: concretePath
|
|
7114
|
+
});
|
|
7115
|
+
}
|
|
7116
|
+
/**
|
|
7117
|
+
* A stored secret, as an admin read shows it: a VIEW naming the row's own
|
|
7118
|
+
* keychain ref (`set: true`), never the value and no longer the bare redaction
|
|
7119
|
+
* token. The form hands it to the secret field, which reveals the value by ref
|
|
7120
|
+
* through the audited `keychain-admin.reveal`; sent back untouched it keeps the
|
|
7121
|
+
* stored secret (the records door reads a view as KEEP).
|
|
7122
|
+
*
|
|
7123
|
+
* ONE implementation for the entries service and for every addon that serves
|
|
7124
|
+
* its own instances (`RecordIntegrationInstances`).
|
|
7125
|
+
*/
|
|
7126
|
+
function isRecord$5(value) {
|
|
7127
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
7128
|
+
}
|
|
7129
|
+
function secretViewsOf(owner, kind, id, decl, data) {
|
|
7130
|
+
if (decl.secretPaths.length === 0) return data;
|
|
7131
|
+
const shown = mapSecretLeaves(data, decl.secretPaths, decl.secretArrayKeys, (leaf) => {
|
|
7132
|
+
if (leaf.value !== "__camstack_redacted__") return leaf.value;
|
|
7133
|
+
return {
|
|
7134
|
+
$secret: recordSecretRef(owner, kind, id, leaf.concrete),
|
|
7135
|
+
v: 1,
|
|
7136
|
+
set: true
|
|
7137
|
+
};
|
|
7138
|
+
});
|
|
7139
|
+
return isRecord$5(shown) ? shown : data;
|
|
7140
|
+
}
|
|
7141
|
+
/** The most instances one addon lists (an integrations page, not a table). */
|
|
7142
|
+
var INSTANCES_LIST_MAX = 1e3;
|
|
7143
|
+
/**
|
|
7144
|
+
* The ONE reader of an instance's switch (D996): an absent field means on, so a row written
|
|
7145
|
+
* before the field existed needs no migration. Every consumer of an instance body asks this.
|
|
7146
|
+
*/
|
|
7147
|
+
function isInstanceEnabled(body) {
|
|
7148
|
+
return body.enabled !== false;
|
|
7149
|
+
}
|
|
7150
|
+
/** The body key of the switch; only {@link RecordIntegrationInstances.setInstanceEnabled} writes it. */
|
|
7151
|
+
var SWITCH_KEY = "enabled";
|
|
7152
|
+
/** The keys of the kind's secret fields that sit at the top level of the body. */
|
|
7153
|
+
function topLevelSecretKeys(paths) {
|
|
7154
|
+
return new Set(paths.filter((p) => !p.includes(".") && !p.includes("[") && !p.includes("{")));
|
|
7155
|
+
}
|
|
7156
|
+
/** The keys of the kind's top-level MAPS whose values are secrets (`applianceSecrets{}`). */
|
|
7157
|
+
function secretMapKeys(paths) {
|
|
7158
|
+
return new Set(paths.filter((p) => p.endsWith("{}") && !p.slice(0, -2).match(/[.[{]/)).map((p) => p.slice(0, -2)));
|
|
7159
|
+
}
|
|
7160
|
+
/**
|
|
7161
|
+
* A patch value for a map of secrets: an entry that is omitted, `''`, the redaction token or the
|
|
7162
|
+
* view the form was given KEEPS its stored secret (it is left out of the merge); `{ $secretClear }`
|
|
7163
|
+
* or `null` removes the entry; any other string replaces it. Null when nothing is left to merge.
|
|
7164
|
+
*/
|
|
7165
|
+
function secretMapPatch(value) {
|
|
7166
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) return null;
|
|
7167
|
+
const out = {};
|
|
7168
|
+
for (const [key, entry] of Object.entries(value)) if (entry === null || isSecretClear(entry)) out[key] = null;
|
|
7169
|
+
else if (typeof entry === "string" && entry !== "" && entry !== "__camstack_redacted__" && !isSecretFieldView(entry)) out[key] = entry;
|
|
7170
|
+
return Object.keys(out).length > 0 ? out : null;
|
|
7171
|
+
}
|
|
7172
|
+
var RecordIntegrationInstances = class {
|
|
7173
|
+
records;
|
|
7174
|
+
kind;
|
|
7175
|
+
hooks;
|
|
7176
|
+
handle;
|
|
7177
|
+
secretKeys;
|
|
7178
|
+
secretMaps;
|
|
7179
|
+
nameField;
|
|
7180
|
+
switchListeners = /* @__PURE__ */ new Set();
|
|
7181
|
+
constructor(records, kind, hooks) {
|
|
7182
|
+
this.records = records;
|
|
7183
|
+
this.kind = kind;
|
|
7184
|
+
this.hooks = hooks;
|
|
7185
|
+
this.handle = records.kind(kind);
|
|
7186
|
+
this.secretKeys = topLevelSecretKeys(kind.declaration.secretPaths);
|
|
7187
|
+
this.secretMaps = secretMapKeys(kind.declaration.secretPaths);
|
|
7188
|
+
this.nameField = kind.declaration.entry?.nameField ?? "name";
|
|
7189
|
+
}
|
|
7190
|
+
/**
|
|
7191
|
+
* One instance read for the addon's own runtime; null when absent. When the keychain is
|
|
7192
|
+
* locked the row is served WITHOUT its secrets and says so (`secrets: 'unavailable'`), so the
|
|
7193
|
+
* caller can keep what it had instead of reconfiguring with an empty secret (D49).
|
|
7194
|
+
*/
|
|
7195
|
+
async readResolved(id) {
|
|
7196
|
+
try {
|
|
7197
|
+
const record = await this.handle.getResolved(id);
|
|
7198
|
+
return record === null ? null : {
|
|
7199
|
+
id,
|
|
7200
|
+
body: record.data,
|
|
7201
|
+
enabled: isInstanceEnabled(record.data),
|
|
7202
|
+
secrets: "resolved"
|
|
7203
|
+
};
|
|
7204
|
+
} catch (err) {
|
|
7205
|
+
if (!(err instanceof RecordSecretUnavailableError)) throw err;
|
|
7206
|
+
const stored = await this.handle.get(id);
|
|
7207
|
+
if (stored === null) return null;
|
|
7208
|
+
return {
|
|
7209
|
+
id,
|
|
7210
|
+
body: Object.fromEntries(Object.entries(stored.data).filter(([key]) => !this.secretKeys.has(key))),
|
|
7211
|
+
enabled: isInstanceEnabled(stored.data),
|
|
7212
|
+
secrets: "unavailable"
|
|
7213
|
+
};
|
|
7214
|
+
}
|
|
7215
|
+
}
|
|
7216
|
+
/** The body of {@link readResolved} alone; a locked keychain yields the row without secrets. */
|
|
7217
|
+
async getResolved(id) {
|
|
7218
|
+
return (await this.readResolved(id))?.body ?? null;
|
|
7219
|
+
}
|
|
7220
|
+
/** Every instance, secrets resolved where the keychain allows; an absent one is skipped. */
|
|
7221
|
+
async listResolved() {
|
|
7222
|
+
const page = await this.handle.query({ limit: INSTANCES_LIST_MAX });
|
|
7223
|
+
const out = [];
|
|
7224
|
+
for (const record of page.records) {
|
|
7225
|
+
const read = await this.readResolved(record.id);
|
|
7226
|
+
if (read !== null) out.push(read);
|
|
7227
|
+
}
|
|
7228
|
+
return out;
|
|
7229
|
+
}
|
|
7230
|
+
viewOf(record) {
|
|
7231
|
+
const shown = secretViewsOf(this.records.owner, this.kind.name, record.id, this.kind.declaration, record.data);
|
|
7232
|
+
const rawName = record.data[this.nameField];
|
|
7233
|
+
const kind = this.hooks.kindOf?.(record.data);
|
|
7234
|
+
const health = this.hooks.health?.(record.data, record.id);
|
|
7235
|
+
return {
|
|
7236
|
+
id: record.id,
|
|
7237
|
+
name: typeof rawName === "string" ? rawName : record.id,
|
|
7238
|
+
configured: this.hooks.configured(record.data),
|
|
7239
|
+
enabled: isInstanceEnabled(record.data),
|
|
7240
|
+
formValues: shown,
|
|
7241
|
+
...kind !== void 0 ? { kind } : {},
|
|
7242
|
+
...health?.status !== void 0 ? { status: health.status } : {},
|
|
7243
|
+
...health?.lastCheckedAt !== void 0 ? { lastCheckedAt: health.lastCheckedAt } : {}
|
|
7244
|
+
};
|
|
7245
|
+
}
|
|
7246
|
+
describe = async () => {
|
|
7247
|
+
const declared = linksOfKind(this.kind);
|
|
7248
|
+
const links = this.hooks.description.links !== void 0 || declared.length === 0 ? {} : { links: declared.map((link) => ({
|
|
7249
|
+
kind: this.kind.name,
|
|
7250
|
+
field: link.field,
|
|
7251
|
+
to: link.to
|
|
7252
|
+
})) };
|
|
7253
|
+
return {
|
|
7254
|
+
...this.hooks.description,
|
|
7255
|
+
...links,
|
|
7256
|
+
...this.hooks.mintId === void 0 ? {} : { mintsId: true }
|
|
7257
|
+
};
|
|
7258
|
+
};
|
|
7259
|
+
instanceFormSchema = async ({ id }) => this.hooks.formSchema(id);
|
|
7260
|
+
listInstances = async () => {
|
|
7261
|
+
return (await this.handle.query({ limit: INSTANCES_LIST_MAX })).records.map((record) => this.viewOf(record));
|
|
7262
|
+
};
|
|
7263
|
+
getInstance = async ({ id }) => {
|
|
7264
|
+
const record = await this.handle.get(id);
|
|
7265
|
+
return record === null ? null : this.viewOf(record);
|
|
7266
|
+
};
|
|
7267
|
+
/** Insert ONE row (`ifRev: 0`: an existing id is refused, never overwritten). */
|
|
7268
|
+
createInstance = async ({ id, name, kind, values }) => {
|
|
7269
|
+
const minted = id ?? this.hooks.mintId?.({
|
|
7270
|
+
name,
|
|
7271
|
+
...kind !== void 0 ? { kind } : {}
|
|
7272
|
+
});
|
|
7273
|
+
if (minted === void 0) throw new Error("createInstance needs an id: this provider does not mint one");
|
|
7274
|
+
await this.handle.put({
|
|
7275
|
+
id: minted,
|
|
7276
|
+
data: this.hooks.initialBody(name, kind)
|
|
7277
|
+
}, { ifRev: 0 });
|
|
7278
|
+
const patch = this.patchOf(values ?? {});
|
|
7279
|
+
if (Object.keys(patch).length > 0) await this.handle.patch(minted, patch);
|
|
7280
|
+
await this.hooks.onChanged?.(minted, "created");
|
|
7281
|
+
return { id: minted };
|
|
7282
|
+
};
|
|
7283
|
+
updateInstance = async ({ id, name, values }) => {
|
|
7284
|
+
const patch = this.patchOf(values);
|
|
7285
|
+
if (name !== void 0) patch[this.nameField] = name;
|
|
7286
|
+
await this.handle.patch(id, patch);
|
|
7287
|
+
await this.hooks.onChanged?.(id, "updated");
|
|
7288
|
+
return { ok: true };
|
|
7289
|
+
};
|
|
7290
|
+
/** The record patch a form `values` object means: secrets kept, cleared or replaced. */
|
|
7291
|
+
patchOf(values) {
|
|
7292
|
+
const patch = {};
|
|
7293
|
+
for (const [key, value] of Object.entries(values)) {
|
|
7294
|
+
if (value === void 0) continue;
|
|
7295
|
+
if (key === "enabled") continue;
|
|
7296
|
+
if (this.secretMaps.has(key)) {
|
|
7297
|
+
const entries = secretMapPatch(value);
|
|
7298
|
+
if (entries !== null) patch[key] = entries;
|
|
7299
|
+
} else if (!this.secretKeys.has(key)) patch[key] = value;
|
|
7300
|
+
else if (isSecretClear(value)) patch[key] = null;
|
|
7301
|
+
else if (typeof value === "string" && value !== "" && value !== "__camstack_redacted__" && !isSecretFieldView(value)) patch[key] = value;
|
|
7302
|
+
}
|
|
7303
|
+
return patch;
|
|
7304
|
+
}
|
|
7305
|
+
/**
|
|
7306
|
+
* Listen to the switch of ANY instance of this helper (in the process that serves it). The
|
|
7307
|
+
* durable replacement of the `integration.enabled` / `integration.disabled` events (D8): the
|
|
7308
|
+
* addon reconciles from the record, whichever way it flipped.
|
|
7309
|
+
*/
|
|
7310
|
+
onSwitched(listener) {
|
|
7311
|
+
this.switchListeners.add(listener);
|
|
7312
|
+
}
|
|
7313
|
+
/**
|
|
7314
|
+
* The ONE writer of the switch (D996, D1014): the record body's `enabled`, for every role. A
|
|
7315
|
+
* configured thing is an instance, so an id with no record yet (a default integration that was
|
|
7316
|
+
* never configured) gets its record from `initialBody` before the switch is written.
|
|
7317
|
+
*/
|
|
7318
|
+
setInstanceEnabled = async ({ id, enabled }) => {
|
|
7319
|
+
if (await this.handle.get(id) === null) await this.handle.put({
|
|
7320
|
+
id,
|
|
7321
|
+
data: this.hooks.initialBody(id)
|
|
7322
|
+
}, { ifRev: 0 });
|
|
7323
|
+
await this.handle.patch(id, { [SWITCH_KEY]: enabled });
|
|
7324
|
+
await this.hooks.onChanged?.(id, "enabled");
|
|
7325
|
+
for (const listener of this.switchListeners) await listener(id, enabled);
|
|
7326
|
+
return { ok: true };
|
|
7327
|
+
};
|
|
7328
|
+
/** The row and its keychain refs go together (the records door). */
|
|
7329
|
+
deleteInstance = async ({ id }) => {
|
|
7330
|
+
await this.handle.delete(id);
|
|
7331
|
+
await this.hooks.onChanged?.(id, "deleted");
|
|
7332
|
+
return { ok: true };
|
|
7333
|
+
};
|
|
7334
|
+
testInstance = async (input) => {
|
|
7335
|
+
if (this.hooks.test === void 0) return {
|
|
7336
|
+
success: false,
|
|
7337
|
+
status: "unsupported",
|
|
7338
|
+
error: "This integration declares no connection test"
|
|
7339
|
+
};
|
|
7340
|
+
return this.hooks.test(input);
|
|
7341
|
+
};
|
|
7342
|
+
/** The flat provider object to hand to `registerProvider`. */
|
|
7343
|
+
toProvider() {
|
|
7344
|
+
return {
|
|
7345
|
+
describe: this.describe,
|
|
7346
|
+
instanceFormSchema: this.instanceFormSchema,
|
|
7347
|
+
listInstances: this.listInstances,
|
|
7348
|
+
getInstance: this.getInstance,
|
|
7349
|
+
createInstance: this.createInstance,
|
|
7350
|
+
updateInstance: this.updateInstance,
|
|
7351
|
+
setInstanceEnabled: this.setInstanceEnabled,
|
|
7352
|
+
deleteInstance: this.deleteInstance,
|
|
7353
|
+
testInstance: this.testInstance
|
|
7354
|
+
};
|
|
7355
|
+
}
|
|
7356
|
+
};
|
|
7357
|
+
/**
|
|
7358
|
+
* The one-switch migration (epic #440, step 3). An integration's on/off state used to live in the
|
|
7359
|
+
* registry's `enabled` column for a device addon; it now lives only in the instance record's
|
|
7360
|
+
* body (`enabled`, D1007 superseded). This moves a registry `enabled = false` into the body, once.
|
|
7361
|
+
*
|
|
7362
|
+
* For every registry row of the addon that is OFF:
|
|
7363
|
+
* - no record under its id: the record is created from `initialBody(name)` with `enabled: false`
|
|
7364
|
+
* (a default integration that never had settings, Reolink's among them);
|
|
7365
|
+
* - a record whose body states no `enabled`: `enabled: false` is written into it;
|
|
7366
|
+
* - a record that already states `enabled` (either way) is the newer truth and is left alone.
|
|
7367
|
+
* A row that is ON writes nothing: an absent field reads as on. A rerun finds every off row with
|
|
7368
|
+
* a stated switch and does nothing, so nothing switched off comes back on and nothing switched on
|
|
7369
|
+
* goes off. The registry column itself is neither read afterwards nor written; its drop is step 5.
|
|
7370
|
+
*
|
|
7371
|
+
* It runs in the addon process, BEFORE the addon registers its `integration-instances` provider,
|
|
7372
|
+
* which is also why `integrations.list` still answers the stored column at that point.
|
|
7373
|
+
*/
|
|
7374
|
+
function registrySwitchToBodyId(addonId, date) {
|
|
7375
|
+
return `${addonId}/${date}-registry-switch-to-body`;
|
|
7376
|
+
}
|
|
7377
|
+
async function moveRegistrySwitchToBody(ports, spec) {
|
|
7378
|
+
const rows = await ports.listIntegrations(spec.addonId);
|
|
7379
|
+
let created = 0;
|
|
7380
|
+
let switched = 0;
|
|
7381
|
+
let kept = 0;
|
|
7382
|
+
for (const row of rows) {
|
|
7383
|
+
if (row.enabled) continue;
|
|
7384
|
+
const body = await ports.readBody(row.id);
|
|
7385
|
+
if (body === null) {
|
|
7386
|
+
if (await ports.createRecord(row.id, {
|
|
7387
|
+
...spec.initialBody(row.name),
|
|
7388
|
+
["enabled"]: false
|
|
7389
|
+
}) === "created") created += 1;
|
|
7390
|
+
else kept += 1;
|
|
7391
|
+
continue;
|
|
7392
|
+
}
|
|
7393
|
+
if ("enabled" in body) {
|
|
7394
|
+
kept += 1;
|
|
7395
|
+
continue;
|
|
7396
|
+
}
|
|
7397
|
+
await ports.switchOff(row.id);
|
|
7398
|
+
switched += 1;
|
|
7399
|
+
}
|
|
7400
|
+
const summary = {
|
|
7401
|
+
integrations: rows.length,
|
|
7402
|
+
off: rows.filter((r) => !r.enabled).length,
|
|
7403
|
+
created,
|
|
7404
|
+
switched,
|
|
7405
|
+
kept
|
|
7406
|
+
};
|
|
7407
|
+
return created === 0 && switched === 0 ? {
|
|
7408
|
+
outcome: "already-done",
|
|
7409
|
+
summary
|
|
7410
|
+
} : {
|
|
7411
|
+
outcome: "done",
|
|
7412
|
+
summary
|
|
7413
|
+
};
|
|
7414
|
+
}
|
|
7415
|
+
/** A migration entry: an addon states its kind and how a new body starts, nothing else. */
|
|
7416
|
+
function registrySwitchToBodyMigration(spec) {
|
|
7417
|
+
return {
|
|
7418
|
+
meta: {
|
|
7419
|
+
id: registrySwitchToBodyId(spec.addonId, spec.date),
|
|
7420
|
+
owner: spec.addonId,
|
|
7421
|
+
level: "addon-state",
|
|
7422
|
+
seq: spec.seq,
|
|
7423
|
+
dependsOn: [],
|
|
7424
|
+
store: "settings",
|
|
7425
|
+
scope: "cluster",
|
|
7426
|
+
onFailure: "block-owner",
|
|
7427
|
+
bodyKind: "procedure",
|
|
7428
|
+
description: "Move the registry enabled flag of every switched-off integration into its instance record body, creating the record when there is none",
|
|
7429
|
+
fixtureMark: "enabled"
|
|
7430
|
+
},
|
|
7431
|
+
procedure: (ports) => moveRegistrySwitchToBody(ports, {
|
|
7432
|
+
addonId: spec.addonId,
|
|
7433
|
+
initialBody: spec.initialBody
|
|
7434
|
+
})
|
|
7435
|
+
};
|
|
7436
|
+
}
|
|
7437
|
+
/** The hub and records sides of {@link registrySwitchToBodyMigration}. */
|
|
7438
|
+
function registrySwitchPortsOver(deps) {
|
|
7439
|
+
const handle = deps.records.kind({
|
|
7440
|
+
name: deps.kind.name,
|
|
7441
|
+
declaration: deps.kind.declaration,
|
|
7442
|
+
schema: record(string(), unknown())
|
|
7443
|
+
});
|
|
7444
|
+
return {
|
|
7445
|
+
listIntegrations: async (addonId) => (await deps.api.list()).filter((i) => i.addonId === addonId).map((i) => ({
|
|
7446
|
+
id: i.id,
|
|
7447
|
+
name: i.name,
|
|
7448
|
+
enabled: i.enabled !== false
|
|
7449
|
+
})),
|
|
7450
|
+
readBody: async (id) => (await handle.get(id))?.data ?? null,
|
|
7451
|
+
createRecord: async (id, body) => {
|
|
7452
|
+
if (await handle.get(id) !== null) return "exists";
|
|
7453
|
+
await handle.put({
|
|
7454
|
+
id,
|
|
7455
|
+
data: body
|
|
7456
|
+
}, { ifRev: 0 });
|
|
7457
|
+
return "created";
|
|
7458
|
+
},
|
|
7459
|
+
switchOff: async (id) => {
|
|
7460
|
+
await handle.patch(id, { [SWITCH_KEY]: false });
|
|
7461
|
+
}
|
|
7462
|
+
};
|
|
7463
|
+
}
|
|
7464
|
+
/**
|
|
7465
|
+
* Build a {@link DurableState} over a single store key. Transport-agnostic:
|
|
7466
|
+
* `read`/`write` are the addon-store or device-store accessors. The whole
|
|
7467
|
+
* validated value round-trips on every read/write — the schema is the
|
|
7468
|
+
* single source of truth for what is persisted, so no hand-listed field
|
|
7469
|
+
* set can drop a key on save.
|
|
7470
|
+
*/
|
|
7471
|
+
function createDurableState(deps) {
|
|
7472
|
+
const get = async () => {
|
|
7473
|
+
const raw = (await deps.read())[deps.key];
|
|
7474
|
+
if (raw === void 0) return deps.fallback;
|
|
7475
|
+
const parsed = deps.schema.safeParse(raw);
|
|
7476
|
+
if (!parsed.success) {
|
|
7477
|
+
deps.onParseError?.(deps.key, parsed.error);
|
|
7478
|
+
return deps.fallback;
|
|
7479
|
+
}
|
|
7480
|
+
return parsed.data;
|
|
7481
|
+
};
|
|
7482
|
+
const set = async (next) => {
|
|
7483
|
+
const validated = deps.schema.parse(next);
|
|
7484
|
+
await deps.write({ [deps.key]: validated });
|
|
7485
|
+
};
|
|
7486
|
+
const update = async (fn) => {
|
|
7487
|
+
await set(fn(await get()));
|
|
7488
|
+
};
|
|
7489
|
+
return {
|
|
7490
|
+
get,
|
|
7491
|
+
set,
|
|
7492
|
+
update
|
|
7493
|
+
};
|
|
7494
|
+
}
|
|
7495
|
+
/**
|
|
7496
|
+
* Per-node scoping for the shared addon-settings blob.
|
|
7497
|
+
*
|
|
7498
|
+
* An addon's settings store is hub-central (the `addon-settings` cap is
|
|
7499
|
+
* hub-routed — the hub instance answers for every node), so fields whose
|
|
7500
|
+
* value is a NODE fact (decoder backend, engine pick, probed hardware
|
|
7501
|
+
* capabilities) persist under the node-scoped key `<key>@<nodeId>` inside
|
|
7502
|
+
* the single shared blob. The SCHEMA field key stays bare: the write path
|
|
7503
|
+
* ({@link scopePatch}) maps the bare field onto the target node's scoped
|
|
7504
|
+
* key; the read/hydrate path ({@link projectStore}) maps THIS node's value
|
|
7505
|
+
* back, so UI forms and `resolveConfig` only ever see the bare key.
|
|
7506
|
+
*
|
|
7507
|
+
* Fields opt in via the `perNode: true` schema marker on `ConfigFieldBase`
|
|
7508
|
+
* (`interfaces/config-ui.ts`); `BaseAddon` derives the key set from the
|
|
7509
|
+
* schema and routes reads/writes through these helpers.
|
|
7510
|
+
*
|
|
7511
|
+
* ## No bare-key fallback — deliberate
|
|
7512
|
+
*
|
|
7513
|
+
* {@link readNodeValue} reads the node-scoped key ONLY. A node with no
|
|
7514
|
+
* scoped key resolves to `undefined` so the field's schema `default` wins —
|
|
7515
|
+
* NEVER `store[base]` and never another node's value. A bare legacy key in
|
|
7516
|
+
* the store is invisible to every node, hub included, so one node's
|
|
7517
|
+
* selection can never leak onto another. (This generalizes the
|
|
7518
|
+
* `decoder-backend-keys.ts` semantics — the no-fallback variant — over an
|
|
7519
|
+
* arbitrary set of per-node field keys.)
|
|
7520
|
+
*
|
|
7521
|
+
* Pure functions only — no I/O, no imports beyond the language. This is a
|
|
7522
|
+
* LEAF module: import it via its deep path, never from the root barrel.
|
|
7523
|
+
*/
|
|
7524
|
+
/**
|
|
7525
|
+
* Normalize a raw kernel node id to the bare node id used for scoping.
|
|
7526
|
+
* `localNodeId` can carry a `<node>/<addon>` suffix on forked child
|
|
7527
|
+
* processes; per-node settings are per-NODE, so strip the addon segment.
|
|
7528
|
+
* `undefined` / `null` / empty falls back to `'hub'`.
|
|
7529
|
+
*/
|
|
7530
|
+
function normalizeNodeId(raw) {
|
|
7531
|
+
if (raw === void 0 || raw === null || raw === "") return "hub";
|
|
7532
|
+
const slashIdx = raw.indexOf("/");
|
|
7533
|
+
if (slashIdx < 0) return raw;
|
|
7534
|
+
const bare = raw.slice(0, slashIdx);
|
|
7535
|
+
return bare === "" ? "hub" : bare;
|
|
7536
|
+
}
|
|
7537
|
+
/** The node-scoped store key for a per-node field: `<base>@<nodeId>`. */
|
|
7538
|
+
function nodeScopedKey(base, nodeId) {
|
|
7539
|
+
return `${base}@${normalizeNodeId(nodeId)}`;
|
|
7540
|
+
}
|
|
7541
|
+
/**
|
|
7542
|
+
* Read a node's value for a per-node field from the raw shared store:
|
|
7543
|
+
* the node-scoped key when present, otherwise `undefined`.
|
|
7544
|
+
* Deliberately NO bare-key fallback (see module doc) — the caller lets the
|
|
7545
|
+
* schema `default` win on `undefined`.
|
|
7546
|
+
*/
|
|
7547
|
+
function readNodeValue(store, base, nodeId) {
|
|
7548
|
+
return store[nodeScopedKey(base, nodeId)];
|
|
7549
|
+
}
|
|
7550
|
+
/**
|
|
7551
|
+
* Re-map a UI/settings patch so every bare perNode field persists under the
|
|
7552
|
+
* TARGET node's scoped key; all other keys pass through unchanged. Used on
|
|
7553
|
+
* the write path so a save for one node never clobbers another node's value
|
|
7554
|
+
* (and the bare key is never written). Returns a new object — the input
|
|
7555
|
+
* patch is not mutated.
|
|
7556
|
+
*/
|
|
7557
|
+
function scopePatch(patch, perNodeKeys, nodeId) {
|
|
7558
|
+
const out = {};
|
|
7559
|
+
for (const [key, value] of Object.entries(patch)) out[perNodeKeys.has(key) ? nodeScopedKey(key, nodeId) : key] = value;
|
|
7560
|
+
return out;
|
|
7561
|
+
}
|
|
7562
|
+
/**
|
|
7563
|
+
* Project the raw shared store onto the bare schema keys for ONE node so a
|
|
7564
|
+
* UI schema (whose field keys are bare) hydrates from that node's own
|
|
7565
|
+
* values:
|
|
7566
|
+
*
|
|
7567
|
+
* - EVERY `@`-scoped key (any node's) is dropped from the pass-through.
|
|
7568
|
+
* - Every bare perNode key is dropped from the pass-through (a stray bare
|
|
7569
|
+
* legacy key must never hydrate any node — no bare fallback).
|
|
7570
|
+
* - THIS node's effective value ({@link readNodeValue}) is then laid onto
|
|
7571
|
+
* each bare perNode key; when the node has no scoped key the bare key is
|
|
7572
|
+
* left ABSENT so the field's schema `default` wins.
|
|
7573
|
+
*
|
|
7574
|
+
* Returns a new object — the input store is not mutated.
|
|
7575
|
+
*/
|
|
7576
|
+
function projectStore(store, perNodeKeys, nodeId) {
|
|
7577
|
+
const out = {};
|
|
7578
|
+
for (const [key, value] of Object.entries(store)) {
|
|
7579
|
+
if (key.includes("@")) continue;
|
|
7580
|
+
if (perNodeKeys.has(key)) continue;
|
|
7581
|
+
out[key] = value;
|
|
7582
|
+
}
|
|
7583
|
+
for (const base of perNodeKeys) {
|
|
7584
|
+
const value = readNodeValue(store, base, nodeId);
|
|
7585
|
+
if (value !== void 0) out[base] = value;
|
|
7586
|
+
}
|
|
7587
|
+
return out;
|
|
7588
|
+
}
|
|
7589
|
+
/** Every scope, in the order the guard and the docs list them. */
|
|
7590
|
+
var SCOPED_SETTINGS_SCOPES = [
|
|
7591
|
+
"cluster",
|
|
7592
|
+
"device-defaults",
|
|
7593
|
+
"node"
|
|
7594
|
+
];
|
|
6933
7595
|
/** A write to a secret path could not be stored in the keychain, so it was refused. */
|
|
6934
7596
|
var KeychainWriteRefusedError = class extends Error {
|
|
6935
7597
|
fieldPath;
|
|
@@ -6940,7 +7602,7 @@ var KeychainWriteRefusedError = class extends Error {
|
|
|
6940
7602
|
}
|
|
6941
7603
|
};
|
|
6942
7604
|
var KEEP = { kind: "keep" };
|
|
6943
|
-
function isRecord$
|
|
7605
|
+
function isRecord$4(value) {
|
|
6944
7606
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6945
7607
|
}
|
|
6946
7608
|
function defaultMintId() {
|
|
@@ -6953,7 +7615,7 @@ function collectSecretMarkerRefs(value, out = []) {
|
|
|
6953
7615
|
return out;
|
|
6954
7616
|
}
|
|
6955
7617
|
if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
|
|
6956
|
-
else if (isRecord$
|
|
7618
|
+
else if (isRecord$4(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
|
|
6957
7619
|
return out;
|
|
6958
7620
|
}
|
|
6959
7621
|
async function storedValueEquals(secrets, marker, candidate) {
|
|
@@ -7008,7 +7670,7 @@ function rowId(row, idKey) {
|
|
|
7008
7670
|
return null;
|
|
7009
7671
|
}
|
|
7010
7672
|
async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
7011
|
-
const storedRows = Array.isArray(stored) ? stored.filter(isRecord$
|
|
7673
|
+
const storedRows = Array.isArray(stored) ? stored.filter(isRecord$4) : [];
|
|
7012
7674
|
if (!Array.isArray(incoming)) {
|
|
7013
7675
|
ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
|
|
7014
7676
|
return {
|
|
@@ -7024,7 +7686,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
|
7024
7686
|
const kept = /* @__PURE__ */ new Set();
|
|
7025
7687
|
const rows = [];
|
|
7026
7688
|
for (const row of incoming) {
|
|
7027
|
-
if (!isRecord$
|
|
7689
|
+
if (!isRecord$4(row)) {
|
|
7028
7690
|
rows.push(row);
|
|
7029
7691
|
continue;
|
|
7030
7692
|
}
|
|
@@ -7049,7 +7711,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
|
7049
7711
|
case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
|
|
7050
7712
|
case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
|
|
7051
7713
|
case "object": {
|
|
7052
|
-
if (!isRecord$
|
|
7714
|
+
if (!isRecord$4(incoming)) {
|
|
7053
7715
|
if (incoming === void 0) return KEEP;
|
|
7054
7716
|
ctx.deletes.push(...collectSecretMarkerRefs(stored));
|
|
7055
7717
|
return {
|
|
@@ -7057,7 +7719,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
|
7057
7719
|
value: incoming
|
|
7058
7720
|
};
|
|
7059
7721
|
}
|
|
7060
|
-
const storedObj = isRecord$
|
|
7722
|
+
const storedObj = isRecord$4(stored) ? stored : {};
|
|
7061
7723
|
return {
|
|
7062
7724
|
kind: "value",
|
|
7063
7725
|
value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
|
|
@@ -7180,7 +7842,7 @@ async function resolveSecretMarkers(value, secrets, options = {}) {
|
|
|
7180
7842
|
value: items
|
|
7181
7843
|
};
|
|
7182
7844
|
}
|
|
7183
|
-
if (isRecord$
|
|
7845
|
+
if (isRecord$4(v)) {
|
|
7184
7846
|
const out = {};
|
|
7185
7847
|
for (const [k, child] of Object.entries(v)) {
|
|
7186
7848
|
const s = substitute(child);
|
|
@@ -7212,7 +7874,7 @@ var SecretOverwriteRefusedError = class extends Error {
|
|
|
7212
7874
|
this.name = "SecretOverwriteRefusedError";
|
|
7213
7875
|
}
|
|
7214
7876
|
};
|
|
7215
|
-
function isRecord$
|
|
7877
|
+
function isRecord$3(value) {
|
|
7216
7878
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
7217
7879
|
}
|
|
7218
7880
|
function resolvedValue(pass, marker) {
|
|
@@ -7241,7 +7903,7 @@ function inArray(pass, incoming, stored) {
|
|
|
7241
7903
|
return incoming.map((item, index) => {
|
|
7242
7904
|
const twin = stored[index];
|
|
7243
7905
|
if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
|
|
7244
|
-
if (isRecord$
|
|
7906
|
+
if (isRecord$3(item) && isRecord$3(twin)) return inArrayRow(pass, item, twin);
|
|
7245
7907
|
if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
|
|
7246
7908
|
return item;
|
|
7247
7909
|
});
|
|
@@ -7252,7 +7914,7 @@ function inArrayRow(pass, incoming, stored) {
|
|
|
7252
7914
|
const twin = stored[key];
|
|
7253
7915
|
if (isSecretMarker(twin)) {
|
|
7254
7916
|
if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
|
|
7255
|
-
} else if (isRecord$
|
|
7917
|
+
} else if (isRecord$3(value) && isRecord$3(twin)) out[key] = inArrayRow(pass, value, twin);
|
|
7256
7918
|
else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
|
|
7257
7919
|
}
|
|
7258
7920
|
return out;
|
|
@@ -7260,7 +7922,7 @@ function inArrayRow(pass, incoming, stored) {
|
|
|
7260
7922
|
async function walk(pass, incoming, stored) {
|
|
7261
7923
|
if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
|
|
7262
7924
|
if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
|
|
7263
|
-
if (!isRecord$
|
|
7925
|
+
if (!isRecord$3(incoming) || !isRecord$3(stored)) return incoming;
|
|
7264
7926
|
const out = { ...incoming };
|
|
7265
7927
|
for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
|
|
7266
7928
|
return out;
|
|
@@ -7291,7 +7953,7 @@ async function restoreUnchangedSecrets(input) {
|
|
|
7291
7953
|
function isJsonEqual(a, b) {
|
|
7292
7954
|
if (Object.is(a, b)) return true;
|
|
7293
7955
|
if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
|
|
7294
|
-
if (isRecord$
|
|
7956
|
+
if (isRecord$3(a) && isRecord$3(b)) {
|
|
7295
7957
|
const keys = Object.keys(a);
|
|
7296
7958
|
if (keys.length !== Object.keys(b).length) return false;
|
|
7297
7959
|
return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
|
|
@@ -7315,7 +7977,7 @@ function markerKeysOf(blob, owner) {
|
|
|
7315
7977
|
}
|
|
7316
7978
|
function nodeFromStored(value, owner) {
|
|
7317
7979
|
if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
|
|
7318
|
-
if (!isRecord$
|
|
7980
|
+
if (!isRecord$3(value)) return null;
|
|
7319
7981
|
const children = /* @__PURE__ */ new Map();
|
|
7320
7982
|
for (const [key, child] of Object.entries(value)) {
|
|
7321
7983
|
const node = nodeFromStored(child, owner);
|
|
@@ -7610,6 +8272,28 @@ var SECRET_RETRY_MAX_MS = 5 * 6e4;
|
|
|
7610
8272
|
/** Coalesces a burst of `keychain.changed` events into one re-resolve. */
|
|
7611
8273
|
var SECRET_CHANGE_DEBOUNCE_MS = 250;
|
|
7612
8274
|
/**
|
|
8275
|
+
* Pair a catalogue with the function that builds its ports FROM THE MIGRATION API. The one
|
|
8276
|
+
* place a catalogue is bound: a migration reaches nothing a ports binder cannot reach
|
|
8277
|
+
* through `api` (guard `check-migration-ports-surface`).
|
|
8278
|
+
*/
|
|
8279
|
+
function migrationSet(catalogue, bindPorts) {
|
|
8280
|
+
return { bind: (api) => defineAddonMigrations(catalogue, bindPorts(api)) };
|
|
8281
|
+
}
|
|
8282
|
+
/** A mixed array is a mistake: the other kind would be dropped without a word. */
|
|
8283
|
+
function refuseMixed(form, kept, dropped) {
|
|
8284
|
+
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`);
|
|
8285
|
+
}
|
|
8286
|
+
function catalogueOf(list) {
|
|
8287
|
+
const kept = list.filter((entry) => !("execute" in entry));
|
|
8288
|
+
refuseMixed("catalogue, (api) => ports", kept.length, list.length - kept.length);
|
|
8289
|
+
return kept;
|
|
8290
|
+
}
|
|
8291
|
+
function boundOf(list) {
|
|
8292
|
+
const kept = list.filter((entry) => "execute" in entry);
|
|
8293
|
+
refuseMixed("bound migrations", kept.length, list.length - kept.length);
|
|
8294
|
+
return kept;
|
|
8295
|
+
}
|
|
8296
|
+
/**
|
|
7613
8297
|
* Base class for CamStack addons. Eliminates settings boilerplate:
|
|
7614
8298
|
*
|
|
7615
8299
|
* - Typed `config` property with automatic resolution from store + defaults
|
|
@@ -7776,29 +8460,62 @@ var BaseAddon = class {
|
|
|
7776
8460
|
await this.loadScopedSchemas();
|
|
7777
8461
|
return normalized;
|
|
7778
8462
|
}
|
|
8463
|
+
async runMigrations(first, second, third) {
|
|
8464
|
+
if (typeof second === "function") return this.runMigrationSets([migrationSet(catalogueOf(first), second)], third);
|
|
8465
|
+
return this.runBound(boundOf(first), second);
|
|
8466
|
+
}
|
|
7779
8467
|
/**
|
|
7780
|
-
*
|
|
7781
|
-
*
|
|
7782
|
-
*
|
|
7783
|
-
* restored devices — with the catalogue bound to the addon's ports
|
|
7784
|
-
* (`defineAddonMigrations(ADDON_MIGRATIONS, ports)`).
|
|
7785
|
-
*
|
|
7786
|
-
* An engine that cannot be reached or refuses the catalogue is logged and runs
|
|
7787
|
-
* nothing; the boot continues. A migration that FAILED (or was blocked by one)
|
|
7788
|
-
* and declares `onFailure: 'block-owner'` makes this throw, so the addon does not
|
|
7789
|
-
* serve data whose shape it cannot trust; `tolerate` migrations never do.
|
|
7790
|
-
*
|
|
7791
|
-
* ALWAYS pass the whole catalogue; a phase that must run only some of it passes
|
|
7792
|
-
* `{ only: [ids] }` — never a filtered catalogue (the engine would judge the
|
|
7793
|
-
* omitted applied ids "newer").
|
|
8468
|
+
* Several catalogues of ONE owner in one declaration (the engine replaces an owner's
|
|
8469
|
+
* catalogue on every declare, so two calls would each judge the other's ids "newer").
|
|
8470
|
+
* Build each entry with `migrationSet(catalogue, (api) => ports)`.
|
|
7794
8471
|
*/
|
|
7795
|
-
async
|
|
8472
|
+
async runMigrationSets(sets, options) {
|
|
8473
|
+
const api = this.ctx.migrationApi;
|
|
8474
|
+
if (api === void 0) throw new Error(`${this.ctx.id}: the migration API is not available on this context`);
|
|
8475
|
+
return this.runBound(sets.flatMap((set) => set.bind(api)), options);
|
|
8476
|
+
}
|
|
8477
|
+
/**
|
|
8478
|
+
* A device addon states its instance kind once, before its migrations run, and the one-switch
|
|
8479
|
+
* migration (registry `enabled` to the instance body, epic #440 step 3) joins whatever
|
|
8480
|
+
* catalogue the addon runs, in the SAME declaration (the engine replaces an owner's catalogue
|
|
8481
|
+
* on every declare).
|
|
8482
|
+
*/
|
|
8483
|
+
declareRegistrySwitch(spec) {
|
|
8484
|
+
this.registrySwitchSpec = spec;
|
|
8485
|
+
}
|
|
8486
|
+
registrySwitchSpec = null;
|
|
8487
|
+
registrySwitchBound() {
|
|
8488
|
+
const spec = this.registrySwitchSpec;
|
|
8489
|
+
if (spec === null) return [];
|
|
8490
|
+
const api = this.ctx.migrationApi;
|
|
8491
|
+
if (api === void 0) {
|
|
8492
|
+
this.ctx.logger.warn("the registry switch migration is skipped: the migration API is not available on this context");
|
|
8493
|
+
return [];
|
|
8494
|
+
}
|
|
8495
|
+
return migrationSet([registrySwitchToBodyMigration({
|
|
8496
|
+
addonId: this.ctx.id,
|
|
8497
|
+
date: "2026-11-06",
|
|
8498
|
+
seq: 1e3,
|
|
8499
|
+
initialBody: spec.initialBody
|
|
8500
|
+
})], (a) => registrySwitchPortsOver({
|
|
8501
|
+
api: integrationRowsApiOver(a),
|
|
8502
|
+
records: switchRecordsOverMigrationApi(a),
|
|
8503
|
+
kind: spec.kind
|
|
8504
|
+
})).bind(api);
|
|
8505
|
+
}
|
|
8506
|
+
async runBound(declared, options) {
|
|
8507
|
+
const added = this.registrySwitchBound();
|
|
8508
|
+
const migrations = [...declared, ...added];
|
|
8509
|
+
const phased = options?.only === void 0 || added.length === 0 ? options : {
|
|
8510
|
+
...options,
|
|
8511
|
+
only: [...options.only, ...added.map((m) => m.meta.id)]
|
|
8512
|
+
};
|
|
7796
8513
|
const api = this.ctx.api.migrations;
|
|
7797
8514
|
const report = await runAddonMigrations({
|
|
7798
8515
|
declareOwner: (input) => api.declareOwner.mutate(input),
|
|
7799
8516
|
startMigration: (input) => api.startMigration.mutate(input),
|
|
7800
8517
|
finishMigration: (input) => api.finishMigration.mutate(input)
|
|
7801
|
-
}, migrations, this.ctx.logger,
|
|
8518
|
+
}, migrations, this.ctx.logger, phased);
|
|
7802
8519
|
if (report.blockOwner.length > 0) throw new AddonMigrationsBlockedError(report.blockOwner);
|
|
7803
8520
|
return report;
|
|
7804
8521
|
}
|
|
@@ -8871,237 +9588,6 @@ function normalizeAddonInitResult(result) {
|
|
|
8871
9588
|
if (Array.isArray(result)) return { providers: result };
|
|
8872
9589
|
return result;
|
|
8873
9590
|
}
|
|
8874
|
-
var PREFIX = "records/";
|
|
8875
|
-
/** The base of every records failure. `detail` is the human part of the message. */
|
|
8876
|
-
var RecordsError = class extends Error {
|
|
8877
|
-
code;
|
|
8878
|
-
detail;
|
|
8879
|
-
constructor(code, detail) {
|
|
8880
|
-
super(`${PREFIX}${code}: ${detail}`);
|
|
8881
|
-
this.name = "RecordsError";
|
|
8882
|
-
this.code = code;
|
|
8883
|
-
this.detail = detail;
|
|
8884
|
-
}
|
|
8885
|
-
};
|
|
8886
|
-
/** A write guarded by `ifRev` found another revision (or an existing row for `ifRev: 0`). */
|
|
8887
|
-
var RevConflictError = class extends RecordsError {
|
|
8888
|
-
constructor(detail) {
|
|
8889
|
-
super("rev-conflict", detail);
|
|
8890
|
-
this.name = "RevConflictError";
|
|
8891
|
-
}
|
|
8892
|
-
};
|
|
8893
|
-
/** The keychain could not store or serve a value: explicit, never an empty string. */
|
|
8894
|
-
var RecordSecretUnavailableError = class extends RecordsError {
|
|
8895
|
-
constructor(detail) {
|
|
8896
|
-
super("secret-unavailable", detail);
|
|
8897
|
-
this.name = "RecordSecretUnavailableError";
|
|
8898
|
-
}
|
|
8899
|
-
};
|
|
8900
|
-
var InvalidRecordError = class extends RecordsError {
|
|
8901
|
-
constructor(detail) {
|
|
8902
|
-
super("invalid-record", detail);
|
|
8903
|
-
this.name = "InvalidRecordError";
|
|
8904
|
-
}
|
|
8905
|
-
};
|
|
8906
|
-
/** A kind declaration the engine refuses (non-additive change, bad shape, wrong file). */
|
|
8907
|
-
var DeclarationRefusedError = class extends RecordsError {
|
|
8908
|
-
constructor(detail) {
|
|
8909
|
-
super("declaration-refused", detail);
|
|
8910
|
-
this.name = "DeclarationRefusedError";
|
|
8911
|
-
}
|
|
8912
|
-
};
|
|
8913
|
-
/** Limits and names of `ctx.records` (D881). One authority; the engine and the facade read it. */
|
|
8914
|
-
/** The files a kind may live in. `history` is device-history's (D850), never records. */
|
|
8915
|
-
var RECORD_DATABASES = ["settings", "events"];
|
|
8916
|
-
/** The classes of a kind: the `@durable` vocabulary, one authority (replaces the annotation). */
|
|
8917
|
-
var RECORD_CLASSES = [
|
|
8918
|
-
"config",
|
|
8919
|
-
"ledger",
|
|
8920
|
-
"audit",
|
|
8921
|
-
"mirror",
|
|
8922
|
-
"ephemeral"
|
|
8923
|
-
];
|
|
8924
|
-
var RECORD_DEFAULT_MAX_DATA_BYTES = 64 * 1024;
|
|
8925
|
-
var RECORD_MAX_DATA_BYTES = 1024 * 1024;
|
|
8926
|
-
var RECORD_BATCH_MAX = 1e3;
|
|
8927
|
-
var RECORD_QUERY_MAX = 1e3;
|
|
8928
|
-
/** A kind in the `settings` file may not bound itself above this (D447: high volume is `events`). */
|
|
8929
|
-
var RECORD_SETTINGS_MAX_ROWS = 5e4;
|
|
8930
|
-
/** The `Column`-free proof prefix: a ref collection for a kind's secret fields. */
|
|
8931
|
-
var RECORD_SECRET_COLLECTION_PREFIX = "records:";
|
|
8932
|
-
/**
|
|
8933
|
-
* Secret fields of a record, addressed the way a Zod schema declares them
|
|
8934
|
-
* (`collectZodSecretPaths`): dotted keys, `[]` for "each element of this array"
|
|
8935
|
-
* (`auth.accessToken`, `headers[].value`).
|
|
8936
|
-
*
|
|
8937
|
-
* `{}` after a key means "each value of this map" (`applianceSecrets{}`): the map's own key
|
|
8938
|
-
* names the value (`applianceSecrets{fridge}`), so no id key is declared and a body that drops a
|
|
8939
|
-
* key releases exactly that key's secret.
|
|
8940
|
-
*
|
|
8941
|
-
* Array elements are matched by a DECLARED id key (`secretArrayKeys`:
|
|
8942
|
-
* `{ headers: 'name' }`), never by index, so reordering a list keeps every
|
|
8943
|
-
* keychain ref (the same rule as `arrayItemFieldPath`). The concrete path of a
|
|
8944
|
-
* leaf names its element: `headers[X-Api].value`.
|
|
8945
|
-
*
|
|
8946
|
-
* Pure and browser-safe. Nothing here mutates: every transform returns a new value.
|
|
8947
|
-
*/
|
|
8948
|
-
/** The array prefixes (declared form, e.g. `headers` or `a.headers`) of a path. */
|
|
8949
|
-
function parseSecretPath(path) {
|
|
8950
|
-
if (path.length === 0) throw new InvalidRecordError("an empty secret path");
|
|
8951
|
-
return path.split(".").map((raw) => {
|
|
8952
|
-
const each = raw.endsWith("[]");
|
|
8953
|
-
const map = raw.endsWith("{}");
|
|
8954
|
-
const key = each || map ? raw.slice(0, -2) : raw;
|
|
8955
|
-
if (key.length === 0) throw new InvalidRecordError(`secret path "${path}" has an empty segment`);
|
|
8956
|
-
return {
|
|
8957
|
-
key,
|
|
8958
|
-
each,
|
|
8959
|
-
map
|
|
8960
|
-
};
|
|
8961
|
-
});
|
|
8962
|
-
}
|
|
8963
|
-
/** The declared array prefixes of `path` that need an id key (`headers`, `a.rows`). */
|
|
8964
|
-
function secretArrayPrefixes(path) {
|
|
8965
|
-
const segments = parseSecretPath(path);
|
|
8966
|
-
const prefixes = [];
|
|
8967
|
-
const walked = [];
|
|
8968
|
-
for (const segment of segments) {
|
|
8969
|
-
walked.push(segment.key);
|
|
8970
|
-
if (segment.each) prefixes.push(walked.join("."));
|
|
8971
|
-
}
|
|
8972
|
-
return prefixes;
|
|
8973
|
-
}
|
|
8974
|
-
function isRecord$4(value) {
|
|
8975
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
8976
|
-
}
|
|
8977
|
-
function elementId(element, idKey, declared, prefix) {
|
|
8978
|
-
const id = isRecord$4(element) ? element[idKey] : void 0;
|
|
8979
|
-
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`);
|
|
8980
|
-
return id;
|
|
8981
|
-
}
|
|
8982
|
-
/**
|
|
8983
|
-
* Visit every secret leaf PRESENT in `data` (an absent branch has nothing to
|
|
8984
|
-
* visit). `replace` returns the new leaf value, or {@link REMOVE_LEAF}; the
|
|
8985
|
-
* result is a new body, `data` is untouched.
|
|
8986
|
-
*/
|
|
8987
|
-
var REMOVE_LEAF = Symbol("remove-leaf");
|
|
8988
|
-
function mapAt(node, segments, index, walkedKeys, concretePrefix, declared, arrayKeys, visit) {
|
|
8989
|
-
if (!isRecord$4(node)) return node;
|
|
8990
|
-
const segment = segments[index];
|
|
8991
|
-
if (segment === void 0) return node;
|
|
8992
|
-
if (!Object.prototype.hasOwnProperty.call(node, segment.key)) return node;
|
|
8993
|
-
const child = node[segment.key];
|
|
8994
|
-
const keys = [...walkedKeys, segment.key];
|
|
8995
|
-
const last = index === segments.length - 1;
|
|
8996
|
-
if (segment.each) {
|
|
8997
|
-
if (!Array.isArray(child)) return node;
|
|
8998
|
-
const prefix = keys.join(".");
|
|
8999
|
-
const idKey = arrayKeys[prefix];
|
|
9000
|
-
if (idKey === void 0) throw new InvalidRecordError(`"${declared}": no id key declared for the array "${prefix}"`);
|
|
9001
|
-
const mapped = child.map((element) => {
|
|
9002
|
-
const id = elementId(element, idKey, declared, prefix);
|
|
9003
|
-
const concrete = `${concretePrefix}${concretePrefix.length > 0 ? "." : ""}${segment.key}[${encodeURIComponent(id)}]`;
|
|
9004
|
-
return last ? element : mapAt(element, segments, index + 1, keys, concrete, declared, arrayKeys, visit);
|
|
9005
|
-
});
|
|
9006
|
-
return {
|
|
9007
|
-
...node,
|
|
9008
|
-
[segment.key]: mapped
|
|
9009
|
-
};
|
|
9010
|
-
}
|
|
9011
|
-
if (segment.map) {
|
|
9012
|
-
if (!isRecord$4(child)) return node;
|
|
9013
|
-
const kept = Object.entries(child).map(([mapKey, value]) => {
|
|
9014
|
-
const concrete = `${concretePrefix}${concretePrefix.length > 0 ? "." : ""}${segment.key}{${encodeURIComponent(mapKey)}}`;
|
|
9015
|
-
if (!last) return [mapKey, mapAt(value, segments, index + 1, keys, concrete, declared, arrayKeys, visit)];
|
|
9016
|
-
return [mapKey, visit({
|
|
9017
|
-
declared,
|
|
9018
|
-
concrete,
|
|
9019
|
-
value
|
|
9020
|
-
})];
|
|
9021
|
-
}).filter(([, value]) => value !== REMOVE_LEAF);
|
|
9022
|
-
return {
|
|
9023
|
-
...node,
|
|
9024
|
-
[segment.key]: Object.fromEntries(kept)
|
|
9025
|
-
};
|
|
9026
|
-
}
|
|
9027
|
-
const concrete = `${concretePrefix}${concretePrefix.length > 0 ? "." : ""}${segment.key}`;
|
|
9028
|
-
if (last) {
|
|
9029
|
-
const replacement = visit({
|
|
9030
|
-
declared,
|
|
9031
|
-
concrete,
|
|
9032
|
-
value: child
|
|
9033
|
-
});
|
|
9034
|
-
if (replacement === REMOVE_LEAF) return Object.fromEntries(Object.entries(node).filter(([key]) => key !== segment.key));
|
|
9035
|
-
return {
|
|
9036
|
-
...node,
|
|
9037
|
-
[segment.key]: replacement
|
|
9038
|
-
};
|
|
9039
|
-
}
|
|
9040
|
-
return {
|
|
9041
|
-
...node,
|
|
9042
|
-
[segment.key]: mapAt(child, segments, index + 1, keys, concrete, declared, arrayKeys, visit)
|
|
9043
|
-
};
|
|
9044
|
-
}
|
|
9045
|
-
/** Replace/remove every present secret leaf; returns a NEW body. */
|
|
9046
|
-
function mapSecretLeaves(data, paths, arrayKeys, visit) {
|
|
9047
|
-
let current = data;
|
|
9048
|
-
for (const declared of paths) current = mapAt(current, parseSecretPath(declared), 0, [], "", declared, arrayKeys, visit);
|
|
9049
|
-
return current;
|
|
9050
|
-
}
|
|
9051
|
-
/** Every present secret leaf, read-only. */
|
|
9052
|
-
function collectSecretLeaves(data, paths, arrayKeys) {
|
|
9053
|
-
const found = [];
|
|
9054
|
-
mapSecretLeaves(data, paths, arrayKeys, (leaf) => {
|
|
9055
|
-
found.push(leaf);
|
|
9056
|
-
return leaf.value;
|
|
9057
|
-
});
|
|
9058
|
-
return found;
|
|
9059
|
-
}
|
|
9060
|
-
/**
|
|
9061
|
-
* The keychain collection name a kind's secrets live under. Prefixed so a
|
|
9062
|
-
* record's refs never collide with the refs a legacy collection of the same name
|
|
9063
|
-
* already holds during an adoption.
|
|
9064
|
-
*/
|
|
9065
|
-
function recordSecretCollection(kind) {
|
|
9066
|
-
return `${RECORD_SECRET_COLLECTION_PREFIX}${kind}`;
|
|
9067
|
-
}
|
|
9068
|
-
/** The ONE ref a row's secret field may carry: the engine and the facade both build it here. */
|
|
9069
|
-
function recordSecretRef(owner, kind, rowId, concretePath) {
|
|
9070
|
-
return buildSecretRef({
|
|
9071
|
-
owner,
|
|
9072
|
-
scope: {
|
|
9073
|
-
kind: "row",
|
|
9074
|
-
collection: recordSecretCollection(kind),
|
|
9075
|
-
rowId
|
|
9076
|
-
},
|
|
9077
|
-
fieldPath: concretePath
|
|
9078
|
-
});
|
|
9079
|
-
}
|
|
9080
|
-
/**
|
|
9081
|
-
* A stored secret, as an admin read shows it: a VIEW naming the row's own
|
|
9082
|
-
* keychain ref (`set: true`), never the value and no longer the bare redaction
|
|
9083
|
-
* token. The form hands it to the secret field, which reveals the value by ref
|
|
9084
|
-
* through the audited `keychain-admin.reveal`; sent back untouched it keeps the
|
|
9085
|
-
* stored secret (the records door reads a view as KEEP).
|
|
9086
|
-
*
|
|
9087
|
-
* ONE implementation for the entries service and for every addon that serves
|
|
9088
|
-
* its own instances (`RecordIntegrationInstances`).
|
|
9089
|
-
*/
|
|
9090
|
-
function isRecord$3(value) {
|
|
9091
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
9092
|
-
}
|
|
9093
|
-
function secretViewsOf(owner, kind, id, decl, data) {
|
|
9094
|
-
if (decl.secretPaths.length === 0) return data;
|
|
9095
|
-
const shown = mapSecretLeaves(data, decl.secretPaths, decl.secretArrayKeys, (leaf) => {
|
|
9096
|
-
if (leaf.value !== "__camstack_redacted__") return leaf.value;
|
|
9097
|
-
return {
|
|
9098
|
-
$secret: recordSecretRef(owner, kind, id, leaf.concrete),
|
|
9099
|
-
v: 1,
|
|
9100
|
-
set: true
|
|
9101
|
-
};
|
|
9102
|
-
});
|
|
9103
|
-
return isRecord$3(shown) ? shown : data;
|
|
9104
|
-
}
|
|
9105
9591
|
/**
|
|
9106
9592
|
* The share-view scope kinds a share-link token can carry. The hub mints
|
|
9107
9593
|
* and validates them (`ShareViewGrantSchema` builds its
|
|
@@ -9355,6 +9841,7 @@ function defineRecordKinds(specs) {
|
|
|
9355
9841
|
function entryBody(shape) {
|
|
9356
9842
|
return object({
|
|
9357
9843
|
name: string().min(1),
|
|
9844
|
+
enabled: boolean().optional(),
|
|
9358
9845
|
...shape
|
|
9359
9846
|
});
|
|
9360
9847
|
}
|
|
@@ -11220,6 +11707,10 @@ Object.freeze({
|
|
|
11220
11707
|
"all",
|
|
11221
11708
|
"one"
|
|
11222
11709
|
]
|
|
11710
|
+
},
|
|
11711
|
+
{
|
|
11712
|
+
"path": "positionUpdatedAt",
|
|
11713
|
+
"valueType": "number"
|
|
11223
11714
|
}
|
|
11224
11715
|
],
|
|
11225
11716
|
"meter": [{
|
|
@@ -11474,22 +11965,6 @@ Object.freeze({
|
|
|
11474
11965
|
"path": "pumpRunning",
|
|
11475
11966
|
"valueType": "boolean"
|
|
11476
11967
|
},
|
|
11477
|
-
{
|
|
11478
|
-
"path": "lastDrink",
|
|
11479
|
-
"valueType": "number"
|
|
11480
|
-
},
|
|
11481
|
-
{
|
|
11482
|
-
"path": "currentHourDrink",
|
|
11483
|
-
"valueType": "number"
|
|
11484
|
-
},
|
|
11485
|
-
{
|
|
11486
|
-
"path": "last24hDrink",
|
|
11487
|
-
"valueType": "number"
|
|
11488
|
-
},
|
|
11489
|
-
{
|
|
11490
|
-
"path": "todayDrink",
|
|
11491
|
-
"valueType": "number"
|
|
11492
|
-
},
|
|
11493
11968
|
{
|
|
11494
11969
|
"path": "error",
|
|
11495
11970
|
"valueType": "string"
|
|
@@ -12055,12 +12530,66 @@ Object.freeze({
|
|
|
12055
12530
|
}
|
|
12056
12531
|
]
|
|
12057
12532
|
});
|
|
12533
|
+
Object.freeze({
|
|
12534
|
+
"actions": { "run": 363e4 },
|
|
12535
|
+
"audio-analyzer": { "classify": 3e4 },
|
|
12536
|
+
"custom-model-registry": { "importModelBundle": 18e5 },
|
|
12537
|
+
"database-snapshot": { "writeSnapshot": 18e5 },
|
|
12538
|
+
"device-manager": {
|
|
12539
|
+
"migrateDevice": 72e4,
|
|
12540
|
+
"runDiscoverySweep": 12e4
|
|
12541
|
+
},
|
|
12542
|
+
"device-provider": { "reloadDevice": 18e4 },
|
|
12543
|
+
"llm": {
|
|
12544
|
+
"generate": 6e5,
|
|
12545
|
+
"generateVision": 6e5,
|
|
12546
|
+
"testProfile": 6e5
|
|
12547
|
+
},
|
|
12548
|
+
"llm-runtime": {
|
|
12549
|
+
"complete": 6e5,
|
|
12550
|
+
"completeApple": 6e5,
|
|
12551
|
+
"ensureStarted": 6e5,
|
|
12552
|
+
"installModel": 36e5
|
|
12553
|
+
},
|
|
12554
|
+
"local-network": { "scanNetwork": 9e4 },
|
|
12555
|
+
"model-convert": { "convert": 6e5 },
|
|
12556
|
+
"pipeline-analytics": {
|
|
12557
|
+
"addRetrainFrameFromRecording": 6e4,
|
|
12558
|
+
"offerRetrainArchive": 12e4,
|
|
12559
|
+
"proposeRetrainAnnotationsWithLlm": 18e4,
|
|
12560
|
+
"resolveRetrainTrainingCorpus": 6e4,
|
|
12561
|
+
"writeRetrainArchive": 36e5
|
|
12562
|
+
},
|
|
12563
|
+
"server-management": { "applyServerUpdate": 96e4 },
|
|
12564
|
+
"terminal-session": { "pullOutput": 15e3 },
|
|
12565
|
+
"training": {
|
|
12566
|
+
"canaryResult": 12e4,
|
|
12567
|
+
"cancelJob": 12e4,
|
|
12568
|
+
"planJob": 6e4,
|
|
12569
|
+
"registerResult": 18e5,
|
|
12570
|
+
"rollbackCanary": 12e4,
|
|
12571
|
+
"startJob": 12e4,
|
|
12572
|
+
"startJobBatch": 12e4
|
|
12573
|
+
},
|
|
12574
|
+
"training-provider": {
|
|
12575
|
+
"cancelJob": 6e4,
|
|
12576
|
+
"cleanupJob": 3e5,
|
|
12577
|
+
"getJob": 6e4,
|
|
12578
|
+
"listJobEvents": 6e4,
|
|
12579
|
+
"listJobs": 12e4,
|
|
12580
|
+
"offerArtifact": 3e5,
|
|
12581
|
+
"readResult": 3e5,
|
|
12582
|
+
"submitJob": 18e5,
|
|
12583
|
+
"uploadDataset": 72e5,
|
|
12584
|
+
"validateCredentials": 3e4
|
|
12585
|
+
}
|
|
12586
|
+
});
|
|
12058
12587
|
object({
|
|
12059
12588
|
code: string().regex(/^[a-z][a-z0-9-]*(\.[a-z0-9-]+)+$/),
|
|
12060
12589
|
params: record(string(), union([string(), number()])).optional()
|
|
12061
12590
|
});
|
|
12062
12591
|
//#endregion
|
|
12063
|
-
//#region ../types/dist/composition-
|
|
12592
|
+
//#region ../types/dist/composition-BmBHuDTQ.mjs
|
|
12064
12593
|
/**
|
|
12065
12594
|
* The ffmpeg build every CamStack node downloads, per platform and arch.
|
|
12066
12595
|
*
|
|
@@ -12364,7 +12893,7 @@ var table = {
|
|
|
12364
12893
|
},
|
|
12365
12894
|
dwell: {
|
|
12366
12895
|
minArgs: 3,
|
|
12367
|
-
maxArgs:
|
|
12896
|
+
maxArgs: 4,
|
|
12368
12897
|
apply: () => {
|
|
12369
12898
|
throw new ExpressionEvalError("dwell: stateful evaluation context is required");
|
|
12370
12899
|
}
|
|
@@ -13407,219 +13936,6 @@ var IntegrationInstanceRefSchema = object({
|
|
|
13407
13936
|
]),
|
|
13408
13937
|
candidateStableId: string().optional()
|
|
13409
13938
|
});
|
|
13410
|
-
/**
|
|
13411
|
-
* `RecordIntegrationInstances` - the `integration-instances` provider over ONE
|
|
13412
|
-
* entry kind, so an addon that holds a connection serves it in ~30 lines.
|
|
13413
|
-
*
|
|
13414
|
-
* Every instance is one record of the addon's own kind, keyed by the
|
|
13415
|
-
* `integrations` registry id. The records door does the secret work: a field the
|
|
13416
|
-
* kind marks `.meta({ secret: true })` is a keychain marker bound to the row, so
|
|
13417
|
-
* deleting the row deletes the secret, and one row's value is never another's.
|
|
13418
|
-
*
|
|
13419
|
-
* Patch rules for a secret (`updateInstance`): omitted, `''`, the redaction
|
|
13420
|
-
* token or the view the form was given KEEP the stored secret;
|
|
13421
|
-
* `{ $secretClear: true }` clears it; any other string replaces it.
|
|
13422
|
-
*/
|
|
13423
|
-
/** The most instances one addon lists (an integrations page, not a table). */
|
|
13424
|
-
var INSTANCES_LIST_MAX = 1e3;
|
|
13425
|
-
/** The keys of the kind's secret fields that sit at the top level of the body. */
|
|
13426
|
-
function topLevelSecretKeys(paths) {
|
|
13427
|
-
return new Set(paths.filter((p) => !p.includes(".") && !p.includes("[") && !p.includes("{")));
|
|
13428
|
-
}
|
|
13429
|
-
/** The keys of the kind's top-level MAPS whose values are secrets (`applianceSecrets{}`). */
|
|
13430
|
-
function secretMapKeys(paths) {
|
|
13431
|
-
return new Set(paths.filter((p) => p.endsWith("{}") && !p.slice(0, -2).match(/[.[{]/)).map((p) => p.slice(0, -2)));
|
|
13432
|
-
}
|
|
13433
|
-
/**
|
|
13434
|
-
* A patch value for a map of secrets: an entry that is omitted, `''`, the redaction token or the
|
|
13435
|
-
* view the form was given KEEPS its stored secret (it is left out of the merge); `{ $secretClear }`
|
|
13436
|
-
* or `null` removes the entry; any other string replaces it. Null when nothing is left to merge.
|
|
13437
|
-
*/
|
|
13438
|
-
function secretMapPatch(value) {
|
|
13439
|
-
if (typeof value !== "object" || value === null || Array.isArray(value)) return null;
|
|
13440
|
-
const out = {};
|
|
13441
|
-
for (const [key, entry] of Object.entries(value)) if (entry === null || isSecretClear(entry)) out[key] = null;
|
|
13442
|
-
else if (typeof entry === "string" && entry !== "" && entry !== "__camstack_redacted__" && !isSecretFieldView(entry)) out[key] = entry;
|
|
13443
|
-
return Object.keys(out).length > 0 ? out : null;
|
|
13444
|
-
}
|
|
13445
|
-
/** Does the kind's body schema carry an `enabled` field? */
|
|
13446
|
-
function declaresEnabled(kind) {
|
|
13447
|
-
const json = toJSONSchema(kind.schema, {
|
|
13448
|
-
unrepresentable: "any",
|
|
13449
|
-
io: "input"
|
|
13450
|
-
});
|
|
13451
|
-
const properties = Reflect.get(json, "properties");
|
|
13452
|
-
return typeof properties === "object" && properties !== null && "enabled" in properties;
|
|
13453
|
-
}
|
|
13454
|
-
var RecordIntegrationInstances = class {
|
|
13455
|
-
records;
|
|
13456
|
-
kind;
|
|
13457
|
-
hooks;
|
|
13458
|
-
handle;
|
|
13459
|
-
secretKeys;
|
|
13460
|
-
secretMaps;
|
|
13461
|
-
nameField;
|
|
13462
|
-
/** The `integrations` registry owns the on/off switch (`role: devices`); the body has none. */
|
|
13463
|
-
registryOwnsEnabled;
|
|
13464
|
-
constructor(records, kind, hooks) {
|
|
13465
|
-
this.records = records;
|
|
13466
|
-
this.kind = kind;
|
|
13467
|
-
this.hooks = hooks;
|
|
13468
|
-
this.handle = records.kind(kind);
|
|
13469
|
-
this.secretKeys = topLevelSecretKeys(kind.declaration.secretPaths);
|
|
13470
|
-
this.secretMaps = secretMapKeys(kind.declaration.secretPaths);
|
|
13471
|
-
this.nameField = kind.declaration.entry?.nameField ?? "name";
|
|
13472
|
-
this.registryOwnsEnabled = hooks.description.role === "devices";
|
|
13473
|
-
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"`);
|
|
13474
|
-
}
|
|
13475
|
-
/**
|
|
13476
|
-
* One instance read for the addon's own runtime; null when absent. When the keychain is
|
|
13477
|
-
* locked the row is served WITHOUT its secrets and says so (`secrets: 'unavailable'`), so the
|
|
13478
|
-
* caller can keep what it had instead of reconfiguring with an empty secret (D49).
|
|
13479
|
-
*/
|
|
13480
|
-
async readResolved(id) {
|
|
13481
|
-
try {
|
|
13482
|
-
const record = await this.handle.getResolved(id);
|
|
13483
|
-
return record === null ? null : {
|
|
13484
|
-
id,
|
|
13485
|
-
body: record.data,
|
|
13486
|
-
enabled: record.data.enabled !== false,
|
|
13487
|
-
secrets: "resolved"
|
|
13488
|
-
};
|
|
13489
|
-
} catch (err) {
|
|
13490
|
-
if (!(err instanceof RecordSecretUnavailableError)) throw err;
|
|
13491
|
-
const stored = await this.handle.get(id);
|
|
13492
|
-
if (stored === null) return null;
|
|
13493
|
-
return {
|
|
13494
|
-
id,
|
|
13495
|
-
body: Object.fromEntries(Object.entries(stored.data).filter(([key]) => !this.secretKeys.has(key))),
|
|
13496
|
-
enabled: stored.data.enabled !== false,
|
|
13497
|
-
secrets: "unavailable"
|
|
13498
|
-
};
|
|
13499
|
-
}
|
|
13500
|
-
}
|
|
13501
|
-
/** The body of {@link readResolved} alone; a locked keychain yields the row without secrets. */
|
|
13502
|
-
async getResolved(id) {
|
|
13503
|
-
return (await this.readResolved(id))?.body ?? null;
|
|
13504
|
-
}
|
|
13505
|
-
/** Every instance, secrets resolved where the keychain allows; an absent one is skipped. */
|
|
13506
|
-
async listResolved() {
|
|
13507
|
-
const page = await this.handle.query({ limit: INSTANCES_LIST_MAX });
|
|
13508
|
-
const out = [];
|
|
13509
|
-
for (const record of page.records) {
|
|
13510
|
-
const read = await this.readResolved(record.id);
|
|
13511
|
-
if (read !== null) out.push(read);
|
|
13512
|
-
}
|
|
13513
|
-
return out;
|
|
13514
|
-
}
|
|
13515
|
-
viewOf(record) {
|
|
13516
|
-
const shown = secretViewsOf(this.records.owner, this.kind.name, record.id, this.kind.declaration, record.data);
|
|
13517
|
-
const rawName = record.data[this.nameField];
|
|
13518
|
-
const kind = this.hooks.kindOf?.(record.data);
|
|
13519
|
-
const health = this.hooks.health?.(record.data, record.id);
|
|
13520
|
-
return {
|
|
13521
|
-
id: record.id,
|
|
13522
|
-
name: typeof rawName === "string" ? rawName : record.id,
|
|
13523
|
-
configured: this.hooks.configured(record.data),
|
|
13524
|
-
...this.registryOwnsEnabled ? {} : { enabled: record.data.enabled !== false },
|
|
13525
|
-
formValues: shown,
|
|
13526
|
-
...kind !== void 0 ? { kind } : {},
|
|
13527
|
-
...health?.status !== void 0 ? { status: health.status } : {},
|
|
13528
|
-
...health?.lastCheckedAt !== void 0 ? { lastCheckedAt: health.lastCheckedAt } : {}
|
|
13529
|
-
};
|
|
13530
|
-
}
|
|
13531
|
-
describe = async () => this.hooks.mintId === void 0 ? this.hooks.description : {
|
|
13532
|
-
...this.hooks.description,
|
|
13533
|
-
mintsId: true
|
|
13534
|
-
};
|
|
13535
|
-
/**
|
|
13536
|
-
* The record an id names. A caller holding the `integrations` registry id (the Integrations
|
|
13537
|
-
* page) reaches a kind whose body links to it through `integrationId`; an id that is itself a
|
|
13538
|
-
* record id answers as it is. An id that names nothing comes back unchanged.
|
|
13539
|
-
*/
|
|
13540
|
-
async resolveRecordId(id) {
|
|
13541
|
-
if (await this.handle.get(id) !== null) return id;
|
|
13542
|
-
const linked = (await this.handle.query({ limit: INSTANCES_LIST_MAX })).records.find((record) => record.data["integrationId"] === id);
|
|
13543
|
-
return linked === void 0 ? id : linked.id;
|
|
13544
|
-
}
|
|
13545
|
-
instanceFormSchema = async ({ id }) => this.hooks.formSchema(id === null ? null : await this.resolveRecordId(id));
|
|
13546
|
-
listInstances = async () => {
|
|
13547
|
-
return (await this.handle.query({ limit: INSTANCES_LIST_MAX })).records.map((record) => this.viewOf(record));
|
|
13548
|
-
};
|
|
13549
|
-
getInstance = async ({ id }) => {
|
|
13550
|
-
const record = await this.handle.get(await this.resolveRecordId(id));
|
|
13551
|
-
return record === null ? null : this.viewOf(record);
|
|
13552
|
-
};
|
|
13553
|
-
/** Insert ONE row (`ifRev: 0`: an existing id is refused, never overwritten). */
|
|
13554
|
-
createInstance = async ({ id, name, kind }) => {
|
|
13555
|
-
const minted = id ?? this.hooks.mintId?.({
|
|
13556
|
-
name,
|
|
13557
|
-
...kind !== void 0 ? { kind } : {}
|
|
13558
|
-
});
|
|
13559
|
-
if (minted === void 0) throw new Error("createInstance needs an id: this provider does not mint one");
|
|
13560
|
-
await this.handle.put({
|
|
13561
|
-
id: minted,
|
|
13562
|
-
data: this.hooks.initialBody(name, kind)
|
|
13563
|
-
}, { ifRev: 0 });
|
|
13564
|
-
await this.hooks.onChanged?.(minted, "created");
|
|
13565
|
-
return { id: minted };
|
|
13566
|
-
};
|
|
13567
|
-
updateInstance = async ({ id: askedId, name, values }) => {
|
|
13568
|
-
const id = await this.resolveRecordId(askedId);
|
|
13569
|
-
const patch = {};
|
|
13570
|
-
for (const [key, value] of Object.entries(values)) {
|
|
13571
|
-
if (value === void 0) continue;
|
|
13572
|
-
if (this.secretMaps.has(key)) {
|
|
13573
|
-
const entries = secretMapPatch(value);
|
|
13574
|
-
if (entries !== null) patch[key] = entries;
|
|
13575
|
-
} else if (!this.secretKeys.has(key)) patch[key] = value;
|
|
13576
|
-
else if (isSecretClear(value)) patch[key] = null;
|
|
13577
|
-
else if (typeof value === "string" && value !== "" && value !== "__camstack_redacted__" && !isSecretFieldView(value)) patch[key] = value;
|
|
13578
|
-
}
|
|
13579
|
-
if (name !== void 0) patch[this.nameField] = name;
|
|
13580
|
-
await this.handle.patch(id, patch);
|
|
13581
|
-
await this.hooks.onChanged?.(id, "updated");
|
|
13582
|
-
return { ok: true };
|
|
13583
|
-
};
|
|
13584
|
-
/** The switch lives in the record body; the addon is told so it applies it (D996). */
|
|
13585
|
-
setInstanceEnabled = async ({ id, enabled }) => {
|
|
13586
|
-
if (this.registryOwnsEnabled) throw new Error(`instance "${id}": the integrations registry owns the on/off switch of this addon; set it with integrations.update`);
|
|
13587
|
-
await this.handle.patch(id, { enabled });
|
|
13588
|
-
await this.hooks.onChanged?.(id, "enabled");
|
|
13589
|
-
return { ok: true };
|
|
13590
|
-
};
|
|
13591
|
-
/** The row and its keychain refs go together (the records door). */
|
|
13592
|
-
deleteInstance = async ({ id }) => {
|
|
13593
|
-
await this.handle.delete(id);
|
|
13594
|
-
await this.hooks.onChanged?.(id, "deleted");
|
|
13595
|
-
return { ok: true };
|
|
13596
|
-
};
|
|
13597
|
-
testInstance = async (input) => {
|
|
13598
|
-
if (this.hooks.test === void 0) return {
|
|
13599
|
-
success: false,
|
|
13600
|
-
status: "unsupported",
|
|
13601
|
-
error: "This integration declares no connection test"
|
|
13602
|
-
};
|
|
13603
|
-
return this.hooks.test(input.id === null ? input : {
|
|
13604
|
-
...input,
|
|
13605
|
-
id: await this.resolveRecordId(input.id)
|
|
13606
|
-
});
|
|
13607
|
-
};
|
|
13608
|
-
/** The flat provider object to hand to `registerProvider`. */
|
|
13609
|
-
toProvider() {
|
|
13610
|
-
return {
|
|
13611
|
-
describe: this.describe,
|
|
13612
|
-
instanceFormSchema: this.instanceFormSchema,
|
|
13613
|
-
listInstances: this.listInstances,
|
|
13614
|
-
getInstance: this.getInstance,
|
|
13615
|
-
createInstance: this.createInstance,
|
|
13616
|
-
updateInstance: this.updateInstance,
|
|
13617
|
-
setInstanceEnabled: this.setInstanceEnabled,
|
|
13618
|
-
deleteInstance: this.deleteInstance,
|
|
13619
|
-
testInstance: this.testInstance
|
|
13620
|
-
};
|
|
13621
|
-
}
|
|
13622
|
-
};
|
|
13623
13939
|
var EncodeProfileSchema = object({
|
|
13624
13940
|
video: object({
|
|
13625
13941
|
codec: _enum([
|
|
@@ -14828,25 +15144,6 @@ function integrationRowsPortsOverApi(deps) {
|
|
|
14828
15144
|
}
|
|
14829
15145
|
};
|
|
14830
15146
|
}
|
|
14831
|
-
function defaultIntegrationApiOver(api) {
|
|
14832
|
-
return {
|
|
14833
|
-
list: () => api.integrations.list.query(),
|
|
14834
|
-
readLegacyIntegrationRows: (input) => api.migrations.readLegacyIntegrationRows.query(input),
|
|
14835
|
-
clearLegacyIntegrationRows: (input) => api.migrations.clearLegacyIntegrationRows.mutate(input),
|
|
14836
|
-
listDevices: (addonId) => api.deviceManager.listAll.query({
|
|
14837
|
-
addonId,
|
|
14838
|
-
projection: "slim"
|
|
14839
|
-
}),
|
|
14840
|
-
setDeviceIntegrationId: async (deviceId, integrationId) => {
|
|
14841
|
-
await api.deviceManager.setIntegrationId.mutate({
|
|
14842
|
-
deviceId,
|
|
14843
|
-
integrationId
|
|
14844
|
-
});
|
|
14845
|
-
},
|
|
14846
|
-
readDeviceHasConfig: async (deviceId) => Object.keys((await api.deviceManager.getDevice.query({ deviceId }))?.config ?? {}).length > 0,
|
|
14847
|
-
readDeviceIntegrationId: async (deviceId) => (await api.deviceManager.getDevice.query({ deviceId }))?.integrationId ?? null
|
|
14848
|
-
};
|
|
14849
|
-
}
|
|
14850
15147
|
/**
|
|
14851
15148
|
* The trainer contract — what the hub hands the cloud trainer and what it
|
|
14852
15149
|
* gets back (cloud training, D805+).
|
|
@@ -15935,6 +16232,39 @@ var UnstampedEventMediaCountSchema = object({
|
|
|
15935
16232
|
/** Sum across both, or `null` when either lane could not be counted. */
|
|
15936
16233
|
total: number().int().nonnegative().nullable()
|
|
15937
16234
|
}).nullable();
|
|
16235
|
+
/**
|
|
16236
|
+
* Where the stored event media sits, per storage location: how many media rows
|
|
16237
|
+
* and how many bytes carry each location id, how many carry none (legacy,
|
|
16238
|
+
* resolved to the default `eventMedia` location), and how many name a location
|
|
16239
|
+
* that was not asked about (a deleted or never-listed one).
|
|
16240
|
+
*
|
|
16241
|
+
* One covering-index aggregate per asked location plus the NULL one, and one
|
|
16242
|
+
* unfiltered total that scans the covering index: O(rows), not a walk of the
|
|
16243
|
+
* rows themselves. `unlisted` is total minus the ASKED locations minus NULL, so
|
|
16244
|
+
* it is a deleted location only when every location id was asked.
|
|
16245
|
+
* `null` is "could not be measured", never zero.
|
|
16246
|
+
*/
|
|
16247
|
+
var MediaLocationCensusInputSchema = object({ locationIds: array(string().min(1)).max(50).readonly() });
|
|
16248
|
+
var MediaLocationCensusSchema = object({
|
|
16249
|
+
locations: array(object({
|
|
16250
|
+
locationId: string(),
|
|
16251
|
+
rows: number().int().nonnegative(),
|
|
16252
|
+
bytes: number().nonnegative()
|
|
16253
|
+
})).readonly(),
|
|
16254
|
+
unstamped: object({
|
|
16255
|
+
rows: number().int().nonnegative(),
|
|
16256
|
+
bytes: number().nonnegative()
|
|
16257
|
+
}),
|
|
16258
|
+
/** Rows stamped with a location id that was not in the asked list. */
|
|
16259
|
+
unlisted: object({
|
|
16260
|
+
rows: number().int().nonnegative(),
|
|
16261
|
+
bytes: number().nonnegative()
|
|
16262
|
+
}),
|
|
16263
|
+
total: object({
|
|
16264
|
+
rows: number().int().nonnegative(),
|
|
16265
|
+
bytes: number().nonnegative()
|
|
16266
|
+
})
|
|
16267
|
+
});
|
|
15938
16268
|
var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
|
|
15939
16269
|
/** The independently selectable logical storage classes — every class
|
|
15940
16270
|
* `storage.listLocationDeclarations` reports, so an operator never meets a
|
|
@@ -19914,31 +20244,21 @@ var APPLIANCE_CAP_VOCABULARY = {
|
|
|
19914
20244
|
"pet-fountain": {
|
|
19915
20245
|
scope: "device",
|
|
19916
20246
|
noun: t("Pet fountain", "Fontana per animali"),
|
|
19917
|
-
actions: [
|
|
19918
|
-
|
|
19919
|
-
|
|
19920
|
-
|
|
19921
|
-
|
|
19922
|
-
|
|
19923
|
-
|
|
19924
|
-
|
|
19925
|
-
|
|
19926
|
-
|
|
19927
|
-
|
|
19928
|
-
|
|
19929
|
-
|
|
19930
|
-
|
|
19931
|
-
|
|
19932
|
-
args: { on: false }
|
|
19933
|
-
},
|
|
19934
|
-
{
|
|
19935
|
-
id: "petFountain.resetDailyConsumption",
|
|
19936
|
-
method: "resetDailyConsumption",
|
|
19937
|
-
label: t("Clear daily consumption", "Azzera il consumo giornaliero"),
|
|
19938
|
-
phrase: t("Clear the daily water consumption of {device}", "Azzera il consumo giornaliero di acqua di {device}"),
|
|
19939
|
-
icon: "rotate-ccw"
|
|
19940
|
-
}
|
|
19941
|
-
],
|
|
20247
|
+
actions: [{
|
|
20248
|
+
id: "petFountain.pumpOn",
|
|
20249
|
+
method: "setPump",
|
|
20250
|
+
label: t("Pump on", "Pompa accesa"),
|
|
20251
|
+
phrase: t("Start the pump of {device}", "Avvia la pompa di {device}"),
|
|
20252
|
+
icon: "play",
|
|
20253
|
+
args: { on: true }
|
|
20254
|
+
}, {
|
|
20255
|
+
id: "petFountain.pumpOff",
|
|
20256
|
+
method: "setPump",
|
|
20257
|
+
label: t("Pump off", "Pompa spenta"),
|
|
20258
|
+
phrase: t("Stop the pump of {device}", "Ferma la pompa di {device}"),
|
|
20259
|
+
icon: "square",
|
|
20260
|
+
args: { on: false }
|
|
20261
|
+
}],
|
|
19942
20262
|
state: [{
|
|
19943
20263
|
kind: "boolean",
|
|
19944
20264
|
field: "empty",
|
|
@@ -43971,8 +44291,15 @@ var ActionInputSchema = object({
|
|
|
43971
44291
|
var ActionRunOriginSchema = object({
|
|
43972
44292
|
/** The automation block whose step started it. */
|
|
43973
44293
|
blockId: string().min(1).optional() });
|
|
43974
|
-
/**
|
|
43975
|
-
|
|
44294
|
+
/**
|
|
44295
|
+
* `started` = the caller did not ask to wait. `timed-out` = the run reached the
|
|
44296
|
+
* ceiling (`ACTION_RUN_MAX_MS`) and was stopped; it is never a `ran`.
|
|
44297
|
+
*/
|
|
44298
|
+
var ActionRunOutcomeSchema = union([
|
|
44299
|
+
AutomationRunOutcomeSchema,
|
|
44300
|
+
literal("started"),
|
|
44301
|
+
literal("timed-out")
|
|
44302
|
+
]);
|
|
43976
44303
|
var ActionRunResultSchema = object({
|
|
43977
44304
|
runId: string().min(1),
|
|
43978
44305
|
outcome: ActionRunOutcomeSchema,
|
|
@@ -44494,6 +44821,8 @@ method(object({}), array(ActionEntrySchema), { auth: "admin" }), method(object({
|
|
|
44494
44821
|
kind: "mutation",
|
|
44495
44822
|
auth: "admin"
|
|
44496
44823
|
});
|
|
44824
|
+
/** `timeoutMs` of `actions.run`: a waited call outlives any legal run. */
|
|
44825
|
+
var ACTION_RUN_TIMEOUT_MS = 363e4;
|
|
44497
44826
|
/**
|
|
44498
44827
|
* actions — the ONE surface for runnable actions, for the UI and for
|
|
44499
44828
|
* automations. Provided by the core-blocks builtin on the hub.
|
|
@@ -44512,6 +44841,12 @@ method(object({}), array(ActionEntrySchema), { auth: "admin" }), method(object({
|
|
|
44512
44841
|
* An admin, and an in-process caller (an automation block), may run any action.
|
|
44513
44842
|
* Every refusal is typed (`[not-linked] …`) and logged.
|
|
44514
44843
|
*
|
|
44844
|
+
* **A run lasts at most `ACTION_RUN_MAX_MS` (60 min).** The provider stops a
|
|
44845
|
+
* run that reaches it and answers `timed-out` (never `ran`); an action whose
|
|
44846
|
+
* `wait` steps alone add up to more is refused at create/update
|
|
44847
|
+
* (`[invalid-steps]`). `run` declares a `timeoutMs` above that ceiling, so a
|
|
44848
|
+
* waited call (an automation step) is never cut by the 60 s transport default.
|
|
44849
|
+
*
|
|
44515
44850
|
* A second `run` of an action that is already running is REFUSED — traced and
|
|
44516
44851
|
* logged — never queued.
|
|
44517
44852
|
*/
|
|
@@ -44538,7 +44873,8 @@ method(object({}), array(ActionEntrySchema), { auth: "admin" }), method(object({
|
|
|
44538
44873
|
role: "viewer",
|
|
44539
44874
|
auth: "protected",
|
|
44540
44875
|
kind: "mutation",
|
|
44541
|
-
caller: "required"
|
|
44876
|
+
caller: "required",
|
|
44877
|
+
timeoutMs: ACTION_RUN_TIMEOUT_MS
|
|
44542
44878
|
}), method(ActionIdInput, _void(), {
|
|
44543
44879
|
kind: "mutation",
|
|
44544
44880
|
auth: "admin"
|
|
@@ -47050,52 +47386,7 @@ onBrightnessChanged: { data: object({
|
|
|
47050
47386
|
minIntervalMs: 0
|
|
47051
47387
|
} } }
|
|
47052
47388
|
};
|
|
47053
|
-
|
|
47054
|
-
* `broker` — unified pub/sub broker registry, system-scoped collection.
|
|
47055
|
-
*
|
|
47056
|
-
* The cap models any kind-tagged message broker the user wants to
|
|
47057
|
-
* register and that other addons might consume. The first two kinds
|
|
47058
|
-
* are MQTT (mosquitto / aedes embedded / cloud bridge) and
|
|
47059
|
-
* Home Assistant (HA WebSocket — subscribe_entities + call_service).
|
|
47060
|
-
* Future kinds (Zigbee2MQTT bridge, ZHA, KNX, Telegram, …) plug in
|
|
47061
|
-
* the same surface.
|
|
47062
|
-
*
|
|
47063
|
-
* Why one cap, not one cap per kind:
|
|
47064
|
-
* - The integrations page wants a single table of "every broker"
|
|
47065
|
-
* across kinds; a unified cap drives it without join logic.
|
|
47066
|
-
* - Generic admin operations (add / remove / test / status) are
|
|
47067
|
-
* identical across kinds — duplicating them per cap was busywork.
|
|
47068
|
-
* - The `network-access` cap precedent: same interface, many
|
|
47069
|
-
* `providerKind: 'ingress'` implementations (Tailscale, ngrok, …).
|
|
47070
|
-
*
|
|
47071
|
-
* What stays kind-specific:
|
|
47072
|
-
* - `getBrokerConfig` payload (kind decides whether it returns
|
|
47073
|
-
* mqtt URL+creds, HA baseUrl+token, …) — typed as
|
|
47074
|
-
* `Record<string, unknown>` at the wire; consumers narrow.
|
|
47075
|
-
* - `publish` / `subscribe` / `getState` arguments (target / filter /
|
|
47076
|
-
* key) — also typed as `Record<string, unknown>` so each kind can
|
|
47077
|
-
* evolve its surface (MQTT topic+qos vs HA entity_id+domain)
|
|
47078
|
-
* without rebreaking the cap signature.
|
|
47079
|
-
* - `add` `settings` payload (different fields per kind, validated by
|
|
47080
|
-
* the kind-specific provider).
|
|
47081
|
-
*
|
|
47082
|
-
* Bidirectionality:
|
|
47083
|
-
* - `publish` is RPC — synchronous result (provider-defined).
|
|
47084
|
-
* - `subscribe` returns a subscription handle; the actual message
|
|
47085
|
-
* stream flows over the typed event-bus as `broker.message` events
|
|
47086
|
-
* keyed by `(brokerId, subscriptionId)`. Consumers filter in their
|
|
47087
|
-
* event handler. Subscriptions persist across reconnects — the
|
|
47088
|
-
* provider re-subscribes upstream after a transport drop.
|
|
47089
|
-
*
|
|
47090
|
-
* Why event-bus push (not a subscription RPC stream):
|
|
47091
|
-
* - Matches the rest of CamStack's D8 contract — events for telemetry,
|
|
47092
|
-
* RPC for loss-is-a-bug. Broker messages are telemetry (a single
|
|
47093
|
-
* drop is recoverable via `getState({key})`).
|
|
47094
|
-
* - Frees `broker.subscribe` from holding a long-lived RPC channel.
|
|
47095
|
-
* - Cross-process: events already route through `$event-bus`; no
|
|
47096
|
-
* per-broker wire-shaping needed.
|
|
47097
|
-
*/
|
|
47098
|
-
var BrokerStatusEnum = _enum([
|
|
47389
|
+
_enum([
|
|
47099
47390
|
"connected",
|
|
47100
47391
|
"disconnected",
|
|
47101
47392
|
"connecting",
|
|
@@ -47103,141 +47394,12 @@ var BrokerStatusEnum = _enum([
|
|
|
47103
47394
|
"unreachable",
|
|
47104
47395
|
"error"
|
|
47105
47396
|
]);
|
|
47106
|
-
var BrokerInfoSchema = object({
|
|
47107
|
-
/** Stable broker id. Persisted; survives addon restarts. */
|
|
47108
|
-
id: string(),
|
|
47109
|
-
/** Addon id of the provider that OWNS this broker.
|
|
47110
|
-
*
|
|
47111
|
-
* The `broker` cap is a system-scoped collection: several addons
|
|
47112
|
-
* register a `broker` provider, each owning a DISJOINT set of
|
|
47113
|
-
* brokers (mqtt-broker owns `mqtt_*`, provider-homeassistant owns
|
|
47114
|
-
* `ha_*`). A broker therefore belongs to exactly one addon — like a
|
|
47115
|
-
* device belongs to one integration. The admin UI threads this id
|
|
47116
|
-
* back as the `{ addonId }` system-collection selector on every
|
|
47117
|
-
* id-keyed call (`get` / `getSettings` / `setSettings` / `remove` /
|
|
47118
|
-
* `testConnection`), so the call routes to the OWNING provider
|
|
47119
|
-
* instead of defaulting to the first-registered one. */
|
|
47120
|
-
addonId: string(),
|
|
47121
|
-
/** Human-readable name (operator-chosen at add-time). */
|
|
47122
|
-
name: string(),
|
|
47123
|
-
/** Provider-defined kind tag — `mqtt` / `home-assistant` / future. */
|
|
47124
|
-
kind: string(),
|
|
47125
|
-
status: BrokerStatusEnum,
|
|
47126
|
-
/** Free-form provider-specific info (HA version, MQTT broker
|
|
47127
|
-
* flavour, latency, mTLS active, …). */
|
|
47128
|
-
info: record(string(), unknown()),
|
|
47129
|
-
/** Ms epoch of the last connection probe / status update. */
|
|
47130
|
-
lastCheckedAt: number().nullable(),
|
|
47131
|
-
/** Last error message, when `status` indicates failure. */
|
|
47132
|
-
error: string().nullable()
|
|
47133
|
-
});
|
|
47134
47397
|
var RegistryStatusSchema = object({
|
|
47135
47398
|
brokerCount: number().int().nonnegative(),
|
|
47136
47399
|
connectedCount: number().int().nonnegative()
|
|
47137
47400
|
});
|
|
47138
|
-
/**
|
|
47139
|
-
* One entry per `broker` provider — which addon provides which broker
|
|
47140
|
-
* kind(s). The unified create picker reads this to know, for each
|
|
47141
|
-
* (addonId, kind) pair the operator can pick, where to route the
|
|
47142
|
-
* follow-up `getSettingsSchema` / `testSettings` / `add` calls (via the
|
|
47143
|
-
* `{ addonId }` selector). A provider only advertises a kind here when
|
|
47144
|
-
* it implements `getSettingsSchema` for that kind (so the picker never
|
|
47145
|
-
* offers a kind whose creation form can't be rendered).
|
|
47146
|
-
*/
|
|
47147
|
-
var BrokerProviderInfoSchema = object({
|
|
47148
|
-
/** Addon id of the `broker` provider this entry describes. */
|
|
47149
|
-
addonId: string(),
|
|
47150
|
-
/** Broker kinds this provider can create, with a display label. */
|
|
47151
|
-
kinds: array(object({
|
|
47152
|
-
kind: string(),
|
|
47153
|
-
label: string(),
|
|
47154
|
-
/**
|
|
47155
|
-
* Relative hub path to start an interactive account link (OAuth popup).
|
|
47156
|
-
* May include `{{brokerId}}`; admin-ui substitutes and appends `?popup=1`.
|
|
47157
|
-
*/
|
|
47158
|
-
interactiveConnectPath: string().min(1).optional(),
|
|
47159
|
-
/** Relative hub path to disconnect the linked account (same popup pattern). */
|
|
47160
|
-
interactiveDisconnectPath: string().min(1).optional(),
|
|
47161
|
-
/**
|
|
47162
|
-
* The kind signs in through a server-held interactive session instead of
|
|
47163
|
-
* (or before) typed credentials. `basePath` is a hub-relative route set
|
|
47164
|
-
* served by the owning addon (`/addon/<id>/...`) speaking the sign-in
|
|
47165
|
-
* contract: `POST {basePath}/start` (body: the form's settings) answers
|
|
47166
|
-
* `{ sessionId, loginUrl }`; `GET {basePath}/status?sessionId=` answers
|
|
47167
|
-
* `{ phase: 'starting' | 'awaiting-login' | 'captured' | 'error' |
|
|
47168
|
-
* 'cancelled', loginUrl, error }`; `POST {basePath}/commit`
|
|
47169
|
-
* (`{ sessionId, name, brokerId? }`) stores the credentials on a new or
|
|
47170
|
-
* existing broker and answers `{ brokerId }`; `POST {basePath}/cancel`
|
|
47171
|
-
* (`{ sessionId }`) drops the session. The dialog that edits a broker
|
|
47172
|
-
* offers it as the default path; the fields the session fills are
|
|
47173
|
-
* marked `filledBySignIn` in the kind's settings schema.
|
|
47174
|
-
*
|
|
47175
|
-
* `methods` lists the ways the session can sign in, recommended first:
|
|
47176
|
-
* `'device-code'` adds `POST {basePath}/code/start` (body: the form's
|
|
47177
|
-
* settings) answering `{ sessionId, userCode, verificationUrl,
|
|
47178
|
-
* expiresAt }` — the operator types `userCode` at `verificationUrl` on
|
|
47179
|
-
* any device, and the same `status` / `commit` / `cancel` routes follow
|
|
47180
|
-
* (status then carries `method`, `userCode`, `verificationUrl`,
|
|
47181
|
-
* `expiresAt` and the phases `'awaiting-code'` / `'expired'`);
|
|
47182
|
-
* `'proxy'` is the `{basePath}/start` flow above. Absent means
|
|
47183
|
-
* `['proxy']`.
|
|
47184
|
-
*/
|
|
47185
|
-
signIn: object({
|
|
47186
|
-
basePath: string().min(1),
|
|
47187
|
-
methods: array(_enum(["device-code", "proxy"])).optional()
|
|
47188
|
-
}).optional()
|
|
47189
|
-
}))
|
|
47190
|
-
});
|
|
47191
|
-
var ListInputSchema = object({
|
|
47192
|
-
/** Optional kind filter — `list({kind:'home-assistant'})` returns
|
|
47193
|
-
* only HA brokers. Omit to list every broker. */
|
|
47194
|
-
kind: string().optional() });
|
|
47195
47401
|
var GetInputSchema = object({ id: string() });
|
|
47196
|
-
var AddInputSchema = object({
|
|
47197
|
-
kind: string().min(1),
|
|
47198
|
-
name: string().min(1),
|
|
47199
|
-
/**
|
|
47200
|
-
* ADOPT an existing id instead of minting a new one.
|
|
47201
|
-
*
|
|
47202
|
-
* Written the day this cost an outage. A broker's id is not a detail: HA
|
|
47203
|
-
* devices carry it inside their `stableId` (`ha:ha_004:dev:…`), so a broker
|
|
47204
|
-
* lost from config and re-added as `ha_001` leaves every one of its devices
|
|
47205
|
-
* bound to a broker that no longer exists. Re-entering the password under the
|
|
47206
|
-
* ORIGINAL id turns a multi-step device migration back into re-entering a
|
|
47207
|
-
* password.
|
|
47208
|
-
*
|
|
47209
|
-
* A provider MUST refuse an id that is already in use — adopting a live
|
|
47210
|
-
* broker's id would silently take it over.
|
|
47211
|
-
*/
|
|
47212
|
-
id: string().min(1).optional(),
|
|
47213
|
-
/** Kind-specific settings (e.g. MQTT `{url,username,password}` or HA
|
|
47214
|
-
* `{baseUrl,accessToken}`). Validated by the kind-specific provider
|
|
47215
|
-
* branch on receipt — invalid shape rejects the add. */
|
|
47216
|
-
settings: record(string(), unknown())
|
|
47217
|
-
});
|
|
47218
|
-
var AddResultSchema = object({ id: string() });
|
|
47219
|
-
var RemoveInputSchema = object({ id: string() });
|
|
47220
|
-
var TestConnectionResultSchema = discriminatedUnion("ok", [object({
|
|
47221
|
-
ok: literal(true),
|
|
47222
|
-
latencyMs: number().nonnegative()
|
|
47223
|
-
}), object({
|
|
47224
|
-
ok: literal(false),
|
|
47225
|
-
error: string()
|
|
47226
|
-
})]);
|
|
47227
47402
|
var SettingsRecordSchema$1 = record(string(), unknown());
|
|
47228
|
-
var SettingsSchemaInputSchema = object({ kind: string() });
|
|
47229
|
-
var TestSettingsInputSchema = object({
|
|
47230
|
-
kind: string(),
|
|
47231
|
-
settings: SettingsRecordSchema$1
|
|
47232
|
-
});
|
|
47233
|
-
var TestSettingsResultSchema = discriminatedUnion("ok", [object({
|
|
47234
|
-
ok: literal(true),
|
|
47235
|
-
latencyMs: number().nonnegative().optional()
|
|
47236
|
-
}).strict(), object({
|
|
47237
|
-
ok: literal(false),
|
|
47238
|
-
error: string()
|
|
47239
|
-
})]);
|
|
47240
|
-
var SettingsSchemaResultSchema = unknown().nullable();
|
|
47241
47403
|
var PublishInputSchema = object({
|
|
47242
47404
|
brokerId: string(),
|
|
47243
47405
|
/** Kind-specific routing target.
|
|
@@ -47271,25 +47433,7 @@ var GetStateInputSchema = object({
|
|
|
47271
47433
|
* HA: entity_id (returns the cached entity state). */
|
|
47272
47434
|
key: string()
|
|
47273
47435
|
});
|
|
47274
|
-
method(
|
|
47275
|
-
kind: "mutation",
|
|
47276
|
-
auth: "admin"
|
|
47277
|
-
}), method(RemoveInputSchema, _void(), {
|
|
47278
|
-
kind: "mutation",
|
|
47279
|
-
auth: "admin"
|
|
47280
|
-
}), method(GetInputSchema, TestConnectionResultSchema, {
|
|
47281
|
-
kind: "mutation",
|
|
47282
|
-
auth: "admin"
|
|
47283
|
-
}), method(GetInputSchema, SettingsRecordSchema$1.nullable(), { auth: "admin" }), method(object({
|
|
47284
|
-
id: string(),
|
|
47285
|
-
settings: SettingsRecordSchema$1
|
|
47286
|
-
}), _void(), {
|
|
47287
|
-
kind: "mutation",
|
|
47288
|
-
auth: "admin"
|
|
47289
|
-
}), method(GetInputSchema, SettingsRecordSchema$1.nullable(), { auth: "admin" }), method(SettingsSchemaInputSchema, SettingsSchemaResultSchema, { auth: "admin" }), method(TestSettingsInputSchema, TestSettingsResultSchema, {
|
|
47290
|
-
kind: "mutation",
|
|
47291
|
-
auth: "admin"
|
|
47292
|
-
}), method(PublishInputSchema, unknown(), {
|
|
47436
|
+
method(GetInputSchema, SettingsRecordSchema$1.nullable(), { auth: "admin" }), method(PublishInputSchema, unknown(), {
|
|
47293
47437
|
kind: "mutation",
|
|
47294
47438
|
auth: "admin"
|
|
47295
47439
|
}), method(SubscribeInputSchema, SubscribeResultSchema, {
|
|
@@ -49765,6 +49909,9 @@ var MediaPlayerStatusSchema = object({
|
|
|
49765
49909
|
/** Repeat mode. Null when no repeat surface.
|
|
49766
49910
|
* Pair with `DeviceFeature.MediaPlayerRepeat`. */
|
|
49767
49911
|
repeat: MediaPlayerRepeatSchema.nullable(),
|
|
49912
|
+
/** Ms epoch when `position` was read from the device. Null when the driver
|
|
49913
|
+
* does not say; a UI that advances the position while playing counts from it. */
|
|
49914
|
+
positionUpdatedAt: number().nullable().default(null),
|
|
49768
49915
|
/** Ms epoch when the slice was last updated. */
|
|
49769
49916
|
lastChangedAt: number()
|
|
49770
49917
|
});
|
|
@@ -50400,7 +50547,9 @@ var ThresholdTransformDraftSchema = object({
|
|
|
50400
50547
|
comparison: _enum(["gte", "lte"]),
|
|
50401
50548
|
threshold: number(),
|
|
50402
50549
|
startDwellMs: number().nonnegative(),
|
|
50403
|
-
stopDwellMs: number().nonnegative()
|
|
50550
|
+
stopDwellMs: number().nonnegative(),
|
|
50551
|
+
/** Samples a start needs; absent = the compiler's default for the source (2 for running power, else 1). */
|
|
50552
|
+
minSamples: number().int().min(1).optional()
|
|
50404
50553
|
});
|
|
50405
50554
|
var CustomizeTransformDraftSchema = discriminatedUnion("kind", [
|
|
50406
50555
|
IdentityTransformDraftSchema,
|
|
@@ -52248,7 +52397,9 @@ var deviceProviderCapability = {
|
|
|
52248
52397
|
* provider does not support manual creation. Lets the Add-Device dialog
|
|
52249
52398
|
* pick the right type instead of assuming Camera.
|
|
52250
52399
|
*/
|
|
52251
|
-
getManualCreationType: method(object({
|
|
52400
|
+
getManualCreationType: method(object({
|
|
52401
|
+
/** The integration asked about; a provider whose integrations differ answers per one. */
|
|
52402
|
+
integrationId: string().optional() }), object({ deviceType: _enum(DeviceType).nullable() })),
|
|
52252
52403
|
adoptDiscoveredDevice: method(object({
|
|
52253
52404
|
candidate: DiscoveryCandidateSchema,
|
|
52254
52405
|
/** The integration the operator adopts into; a provider with several instances needs it. */
|
|
@@ -52264,7 +52415,11 @@ var deviceProviderCapability = {
|
|
|
52264
52415
|
* devices of that type. The output is a `ConfigUISchema` — the
|
|
52265
52416
|
* router type-asserts it at the boundary.
|
|
52266
52417
|
*/
|
|
52267
|
-
getChildCreationSchema: method(object({
|
|
52418
|
+
getChildCreationSchema: method(object({
|
|
52419
|
+
type: _enum(DeviceType),
|
|
52420
|
+
/** The integration asked about; a provider whose integrations differ answers per one. */
|
|
52421
|
+
integrationId: string().optional()
|
|
52422
|
+
}), CreationSchemaOutputSchema),
|
|
52268
52423
|
createDevice: method(object({
|
|
52269
52424
|
type: _enum(DeviceType),
|
|
52270
52425
|
config: record(string(), unknown()),
|
|
@@ -52994,7 +53149,10 @@ method(object({
|
|
|
52994
53149
|
auth: "admin"
|
|
52995
53150
|
}), method(object({
|
|
52996
53151
|
addonId: string(),
|
|
52997
|
-
type: _enum(DeviceType)
|
|
53152
|
+
type: _enum(DeviceType),
|
|
53153
|
+
/** The integration the form is for; a provider whose integrations differ (a hub
|
|
53154
|
+
* integration takes no manual add) answers per integration. Absent = the addon's own. */
|
|
53155
|
+
integrationId: string().optional()
|
|
52998
53156
|
}), unknown().nullable()), method(object({
|
|
52999
53157
|
addonId: string(),
|
|
53000
53158
|
type: _enum(DeviceType),
|
|
@@ -53078,7 +53236,11 @@ method(object({
|
|
|
53078
53236
|
kind: "mutation",
|
|
53079
53237
|
auth: "admin",
|
|
53080
53238
|
timeoutMs: 12e4
|
|
53081
|
-
}), method(object({
|
|
53239
|
+
}), method(object({
|
|
53240
|
+
addonId: string(),
|
|
53241
|
+
/** The integration the Add-Device dialog is open on; absent = the addon's own. */
|
|
53242
|
+
integrationId: string().optional()
|
|
53243
|
+
}), object({ deviceType: _enum(DeviceType).nullable() }), { auth: "admin" }), method(object({ addonId: string() }), unknown(), { auth: "admin" }), method(object({
|
|
53082
53244
|
deviceId: number(),
|
|
53083
53245
|
key: string(),
|
|
53084
53246
|
value: unknown()
|
|
@@ -56264,6 +56426,7 @@ var IntegrationWithStateSchema = object({
|
|
|
56264
56426
|
id: string(),
|
|
56265
56427
|
addonId: string(),
|
|
56266
56428
|
name: string(),
|
|
56429
|
+
/** A projection of the instance body's switch (`setInstanceEnabled` is the only writer). */
|
|
56267
56430
|
enabled: boolean(),
|
|
56268
56431
|
info: record(string(), unknown()).readonly(),
|
|
56269
56432
|
/** The discovery candidate this integration was set up from (D984). */
|
|
@@ -56276,6 +56439,7 @@ var IntegrationLiteSchema = object({
|
|
|
56276
56439
|
id: string(),
|
|
56277
56440
|
addonId: string(),
|
|
56278
56441
|
name: string(),
|
|
56442
|
+
/** A projection of the instance body's switch (`setInstanceEnabled` is the only writer). */
|
|
56279
56443
|
enabled: boolean(),
|
|
56280
56444
|
info: record(string(), unknown()).readonly(),
|
|
56281
56445
|
/** The discovery candidate this integration was set up from (D984). */
|
|
@@ -56358,7 +56522,7 @@ var TestConnectionStatusEnum = _enum([
|
|
|
56358
56522
|
"inconclusive",
|
|
56359
56523
|
"unsupported"
|
|
56360
56524
|
]);
|
|
56361
|
-
var TestConnectionResultSchema
|
|
56525
|
+
var TestConnectionResultSchema = object({
|
|
56362
56526
|
/** True ONLY for `validated`. Never true for a test that did not run. */
|
|
56363
56527
|
success: boolean(),
|
|
56364
56528
|
error: string().optional(),
|
|
@@ -56375,7 +56539,6 @@ var TestConnectionResultSchema$1 = object({
|
|
|
56375
56539
|
var CreateIntegrationInputSchema = object({
|
|
56376
56540
|
addonId: string(),
|
|
56377
56541
|
name: string(),
|
|
56378
|
-
enabled: boolean().optional(),
|
|
56379
56542
|
info: record(string(), unknown()).optional(),
|
|
56380
56543
|
/** `stableId` of the discovery candidate the form was seeded from (D984). */
|
|
56381
56544
|
originStableId: string().optional(),
|
|
@@ -56384,6 +56547,11 @@ var CreateIntegrationInputSchema = object({
|
|
|
56384
56547
|
var UpdateIntegrationInputSchema = object({
|
|
56385
56548
|
id: string(),
|
|
56386
56549
|
name: string().optional(),
|
|
56550
|
+
/**
|
|
56551
|
+
* Accepted for a FIXED builtin only (`info.fixed`: alarm panel, camera grid, core blocks,
|
|
56552
|
+
* terminal), which keeps no instance record: the registry flag is its one store. Any other
|
|
56553
|
+
* integration is switched through `integration-instances.setInstanceEnabled`.
|
|
56554
|
+
*/
|
|
56387
56555
|
enabled: boolean().optional(),
|
|
56388
56556
|
info: record(string(), unknown()).optional()
|
|
56389
56557
|
});
|
|
@@ -56403,7 +56571,7 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
|
|
|
56403
56571
|
}), method(_void(), array(AvailableIntegrationTypeSchema), { auth: "admin" }), method(object({
|
|
56404
56572
|
addonId: string(),
|
|
56405
56573
|
settings: record(string(), unknown())
|
|
56406
|
-
}), TestConnectionResultSchema
|
|
56574
|
+
}), TestConnectionResultSchema, {
|
|
56407
56575
|
kind: "mutation",
|
|
56408
56576
|
auth: "admin"
|
|
56409
56577
|
});
|
|
@@ -56430,6 +56598,14 @@ var ConfigSchemaPassthrough$3 = custom();
|
|
|
56430
56598
|
var IntegrationInstanceIdSchema = string().min(1);
|
|
56431
56599
|
var IntegrationInstanceModeSchema = _enum(["single", "multiple"]);
|
|
56432
56600
|
/**
|
|
56601
|
+
* What the addon's instances ARE for the Integrations page (planning#416). `devices`: each
|
|
56602
|
+
* instance is an integration that brings devices (its record body owns the on/off switch);
|
|
56603
|
+
* `services`: a connection configured from the addon's own function page, never listed on
|
|
56604
|
+
* Integrations.
|
|
56605
|
+
* It is the same vocabulary as the manifest's `integrationRole`, which stays as an override.
|
|
56606
|
+
*/
|
|
56607
|
+
var IntegrationInstanceRoleSchema = _enum(["devices", "services"]);
|
|
56608
|
+
/**
|
|
56433
56609
|
* One kind of instance a provider can create (an adapter, an account type). The sign-in and
|
|
56434
56610
|
* connect fields follow the `broker` contract (`broker.cap.ts`): `signIn.basePath` is a
|
|
56435
56611
|
* hub-relative route set speaking the sign-in contract, `connectPath` / `disconnectPath` open an
|
|
@@ -56440,6 +56616,22 @@ var IntegrationInstanceKindSchema = object({
|
|
|
56440
56616
|
/** Stable id of the kind, sent back as `createInstance.kind`. */
|
|
56441
56617
|
id: string().min(1),
|
|
56442
56618
|
label: string().min(1),
|
|
56619
|
+
/**
|
|
56620
|
+
* The function capability this kind is configured for (`broker`, `smtp-provider`,
|
|
56621
|
+
* `device-provider`, ...). A page section is the kinds whose `functionCap` it names (D1013); a
|
|
56622
|
+
* provider with more than one section must name it on every kind.
|
|
56623
|
+
*/
|
|
56624
|
+
functionCap: string().min(1),
|
|
56625
|
+
/**
|
|
56626
|
+
* For `functionCap: 'broker'`: the registry kind of the broker an instance of this kind is
|
|
56627
|
+
* (`matter`, `home-assistant`, ...). A caller that needs a broker of one kind (a link field)
|
|
56628
|
+
* finds the instances whose kind names it; absent takes the kind `id`.
|
|
56629
|
+
*/
|
|
56630
|
+
brokerKind: string().min(1).optional(),
|
|
56631
|
+
/** What instances of this kind are for the Integrations page; absent takes the provider's `role`. */
|
|
56632
|
+
role: IntegrationInstanceRoleSchema.optional(),
|
|
56633
|
+
/** `testInstance` really probes the remote for this kind; absent takes the provider's `canTest`. */
|
|
56634
|
+
canTest: boolean().optional(),
|
|
56443
56635
|
/** The kind signs in through a server-held interactive session. */
|
|
56444
56636
|
signIn: object({
|
|
56445
56637
|
basePath: string().min(1),
|
|
@@ -56450,22 +56642,38 @@ var IntegrationInstanceKindSchema = object({
|
|
|
56450
56642
|
/** Relative hub path to disconnect that account. */
|
|
56451
56643
|
disconnectPath: string().min(1).optional()
|
|
56452
56644
|
});
|
|
56645
|
+
/**
|
|
56646
|
+
* How devices of an instance are found. `none`: the operator adds them by hand; `lan`: the addon
|
|
56647
|
+
* scans the network before any instance exists (the wizard offers the candidates); `account`: the
|
|
56648
|
+
* devices appear after the instance signs in. `scopedToInstance`: a discovery run belongs to ONE
|
|
56649
|
+
* instance and its candidates are claimed by it.
|
|
56650
|
+
*/
|
|
56651
|
+
var IntegrationInstanceDiscoverySchema = object({
|
|
56652
|
+
mode: _enum([
|
|
56653
|
+
"none",
|
|
56654
|
+
"lan",
|
|
56655
|
+
"account"
|
|
56656
|
+
]),
|
|
56657
|
+
scopedToInstance: boolean()
|
|
56658
|
+
});
|
|
56659
|
+
/**
|
|
56660
|
+
* One link a kind of this provider declares (D1013 rule 5): the body `field` of an instance of
|
|
56661
|
+
* `kind` holds the id of an instance of the function cap `to.cap` (of kind `to.kind`, when set).
|
|
56662
|
+
* The hub indexes these so the target's delete is refused while a link names it.
|
|
56663
|
+
*/
|
|
56664
|
+
var IntegrationInstanceLinkSchema = object({
|
|
56665
|
+
kind: string().min(1),
|
|
56666
|
+
field: string().min(1),
|
|
56667
|
+
to: object({
|
|
56668
|
+
cap: string().min(1),
|
|
56669
|
+
kind: string().min(1).optional()
|
|
56670
|
+
})
|
|
56671
|
+
});
|
|
56453
56672
|
var IntegrationInstanceDescriptionSchema = object({
|
|
56454
56673
|
/** What the instances are for the Integrations page; see {@link IntegrationInstanceRoleSchema}. */
|
|
56455
|
-
role:
|
|
56456
|
-
"devices",
|
|
56457
|
-
"services",
|
|
56458
|
-
"both"
|
|
56459
|
-
]),
|
|
56674
|
+
role: IntegrationInstanceRoleSchema,
|
|
56460
56675
|
/** How the devices of an instance are found; absent means `{ mode: 'none' }`. */
|
|
56461
|
-
discovery:
|
|
56462
|
-
mode: _enum([
|
|
56463
|
-
"none",
|
|
56464
|
-
"lan",
|
|
56465
|
-
"account"
|
|
56466
|
-
]),
|
|
56467
|
-
scopedToInstance: boolean()
|
|
56468
|
-
}).optional(),
|
|
56676
|
+
discovery: IntegrationInstanceDiscoverySchema.optional(),
|
|
56469
56677
|
/** `single`: at most one instance can exist (Loki). `multiple`: an account each. */
|
|
56470
56678
|
instanceMode: IntegrationInstanceModeSchema,
|
|
56471
56679
|
/** What the instance is, for the UI (`destination`, `relay`, `account`). */
|
|
@@ -56486,7 +56694,9 @@ var IntegrationInstanceDescriptionSchema = object({
|
|
|
56486
56694
|
* `createInstance` without an `id` works: the provider mints it. Absent means the caller must
|
|
56487
56695
|
* send an id (the UI then mints an opaque one).
|
|
56488
56696
|
*/
|
|
56489
|
-
mintsId: boolean().optional()
|
|
56697
|
+
mintsId: boolean().optional(),
|
|
56698
|
+
/** The links to other instances the provider's kinds declare; absent means none. */
|
|
56699
|
+
links: array(IntegrationInstanceLinkSchema).optional()
|
|
56490
56700
|
});
|
|
56491
56701
|
var IntegrationInstanceStatusSchema = object({
|
|
56492
56702
|
state: _enum([
|
|
@@ -56506,8 +56716,8 @@ var IntegrationInstanceSchema = object({
|
|
|
56506
56716
|
configured: boolean(),
|
|
56507
56717
|
/**
|
|
56508
56718
|
* The instance's own on/off switch (D996), derived from the record body (`enabled !== false`,
|
|
56509
|
-
* so a row written before the field existed is on).
|
|
56510
|
-
*
|
|
56719
|
+
* so a row written before the field existed is on). The same for every role, `devices` included:
|
|
56720
|
+
* the body is the one store, `setInstanceEnabled` the one writer (epic #440, step 3).
|
|
56511
56721
|
*/
|
|
56512
56722
|
enabled: boolean().optional(),
|
|
56513
56723
|
/** The kind of this instance (one of `describe().kinds[].id`), when the provider has kinds. */
|
|
@@ -56531,7 +56741,11 @@ var integrationInstancesCapability = {
|
|
|
56531
56741
|
methods: {
|
|
56532
56742
|
describe: method(_void(), IntegrationInstanceDescriptionSchema, { auth: "admin" }),
|
|
56533
56743
|
/** The form; `id: null` is the create form. */
|
|
56534
|
-
instanceFormSchema: method(object({
|
|
56744
|
+
instanceFormSchema: method(object({
|
|
56745
|
+
id: IntegrationInstanceIdSchema.nullable(),
|
|
56746
|
+
/** The kind of the create form (`id: null`) of a provider with several. */
|
|
56747
|
+
kind: string().min(1).optional()
|
|
56748
|
+
}), ConfigSchemaPassthrough$3, { auth: "admin" }),
|
|
56535
56749
|
listInstances: method(_void(), array(IntegrationInstanceSchema).readonly(), { auth: "admin" }),
|
|
56536
56750
|
getInstance: method(object({ id: IntegrationInstanceIdSchema }), IntegrationInstanceSchema.nullable(), { auth: "admin" }),
|
|
56537
56751
|
/**
|
|
@@ -56541,7 +56755,9 @@ var integrationInstancesCapability = {
|
|
|
56541
56755
|
createInstance: method(object({
|
|
56542
56756
|
id: IntegrationInstanceIdSchema.optional(),
|
|
56543
56757
|
name: string().min(1),
|
|
56544
|
-
kind: string().min(1).optional()
|
|
56758
|
+
kind: string().min(1).optional(),
|
|
56759
|
+
/** Form values written with the record (a link picked in the create dialog). */
|
|
56760
|
+
values: record(string(), unknown()).optional()
|
|
56545
56761
|
}), object({ id: string() }), {
|
|
56546
56762
|
kind: "mutation",
|
|
56547
56763
|
auth: "admin"
|
|
@@ -56551,7 +56767,8 @@ var integrationInstancesCapability = {
|
|
|
56551
56767
|
auth: "admin"
|
|
56552
56768
|
}),
|
|
56553
56769
|
/**
|
|
56554
|
-
* Switch ONE instance on or off
|
|
56770
|
+
* Switch ONE instance on or off, for every role; a missing record is created from the addon's
|
|
56771
|
+
* initial body. A row control, not a form field: `updateInstance.values` is the
|
|
56555
56772
|
* form patch (D62, D996). An off instance keeps its record and secrets and does no work.
|
|
56556
56773
|
*/
|
|
56557
56774
|
setInstanceEnabled: method(object({
|
|
@@ -56568,8 +56785,10 @@ var integrationInstancesCapability = {
|
|
|
56568
56785
|
}),
|
|
56569
56786
|
testInstance: optionalMethod(object({
|
|
56570
56787
|
id: IntegrationInstanceIdSchema.nullable(),
|
|
56571
|
-
values: record(string(), unknown())
|
|
56572
|
-
|
|
56788
|
+
values: record(string(), unknown()),
|
|
56789
|
+
/** The kind to test when `id` is null and the provider has several. */
|
|
56790
|
+
kind: string().min(1).optional()
|
|
56791
|
+
}), TestConnectionResultSchema, {
|
|
56573
56792
|
kind: "mutation",
|
|
56574
56793
|
auth: "admin"
|
|
56575
56794
|
})
|
|
@@ -59326,6 +59545,382 @@ var SystemMetricsSchema = object({
|
|
|
59326
59545
|
gpuMemoryPercent: number().optional()
|
|
59327
59546
|
});
|
|
59328
59547
|
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);
|
|
59548
|
+
/**
|
|
59549
|
+
* records - an addon's own facts and documents (D881): ledgers, audit rows,
|
|
59550
|
+
* config documents, mirrors. The third storage API next to `ctx.settings`
|
|
59551
|
+
* (operator intent, D870) and device-history (numbers over time, D850).
|
|
59552
|
+
*
|
|
59553
|
+
* Who the OWNER is: `callerAddonId`, stamped by the transport on a call that
|
|
59554
|
+
* crossed a process and stated by a hub in-process caller (`ctx.records` does
|
|
59555
|
+
* that with the addon id closed over). It is deliberately NOT in any input
|
|
59556
|
+
* schema, so a session can never supply it, and a call with no stamp is refused
|
|
59557
|
+
* `records/no-caller`. A kind is readable and writable only by its owner; other
|
|
59558
|
+
* addons go through the owner's capability.
|
|
59559
|
+
*
|
|
59560
|
+
* Every read is three-way: a row, `null`, or the call THROWS. A failed read is
|
|
59561
|
+
* never `[]`. Secret fields are never on the wire: a read shows the
|
|
59562
|
+
* redaction token, `secretRefs` hands the owner's `ctx.secrets` the refs it
|
|
59563
|
+
* resolves itself, and a write may carry only a keychain marker bound to the
|
|
59564
|
+
* row's own ref.
|
|
59565
|
+
*
|
|
59566
|
+
* Internal: addons reach it through `ctx.records`, never directly.
|
|
59567
|
+
*/
|
|
59568
|
+
var RecordIdSchema = string().min(1).max(256);
|
|
59569
|
+
/** A JSON object body. Size is the engine's check (`maxDataBytes`), not a schema's. */
|
|
59570
|
+
var RecordBodySchema = record(string(), unknown());
|
|
59571
|
+
var RecordInputSchema = object({
|
|
59572
|
+
id: RecordIdSchema,
|
|
59573
|
+
/** The device this row belongs to (D865 removal, per-device reads). */
|
|
59574
|
+
deviceId: number().int().optional(),
|
|
59575
|
+
/** The domain clock, ms: observed / created / opened. */
|
|
59576
|
+
at: number().int().optional(),
|
|
59577
|
+
/** Producer-set expiry, ms. Refused on a kind whose retention is an engine TTL. */
|
|
59578
|
+
expiresAt: number().int().optional(),
|
|
59579
|
+
data: RecordBodySchema
|
|
59580
|
+
});
|
|
59581
|
+
var RecordViewSchema = object({
|
|
59582
|
+
id: string(),
|
|
59583
|
+
deviceId: number().int().nullable(),
|
|
59584
|
+
at: number().nullable(),
|
|
59585
|
+
expiresAt: number().nullable(),
|
|
59586
|
+
rev: number().int(),
|
|
59587
|
+
updatedAt: number(),
|
|
59588
|
+
data: RecordBodySchema
|
|
59589
|
+
});
|
|
59590
|
+
/** Declared index fields only. Anything else does not compile, by design. */
|
|
59591
|
+
var RecordWhereSchema = record(RecordFieldPathSchema, union([
|
|
59592
|
+
string(),
|
|
59593
|
+
number(),
|
|
59594
|
+
boolean(),
|
|
59595
|
+
object({ in: array(union([
|
|
59596
|
+
string(),
|
|
59597
|
+
number(),
|
|
59598
|
+
boolean()
|
|
59599
|
+
])).min(1).max(RECORD_BATCH_MAX) }),
|
|
59600
|
+
object({
|
|
59601
|
+
gt: union([string(), number()]).optional(),
|
|
59602
|
+
gte: union([string(), number()]).optional(),
|
|
59603
|
+
lt: union([string(), number()]).optional(),
|
|
59604
|
+
lte: union([string(), number()]).optional()
|
|
59605
|
+
}).refine((r) => Object.keys(r).length > 0, { message: "name at least one bound" })
|
|
59606
|
+
]));
|
|
59607
|
+
var KindShape = { kind: RecordKindNameSchema };
|
|
59608
|
+
var TimeWindowShape = {
|
|
59609
|
+
deviceId: number().int().optional(),
|
|
59610
|
+
atFrom: number().optional(),
|
|
59611
|
+
atTo: number().optional()
|
|
59612
|
+
};
|
|
59613
|
+
var RecordQueryInputSchema = object({
|
|
59614
|
+
...KindShape,
|
|
59615
|
+
...TimeWindowShape,
|
|
59616
|
+
where: RecordWhereSchema.optional(),
|
|
59617
|
+
/** Without `where`: `at` (default for a kind with a clock) or `id`. With `where` the order is the index's. */
|
|
59618
|
+
order: _enum(["at", "id"]).optional(),
|
|
59619
|
+
desc: boolean().optional(),
|
|
59620
|
+
limit: number().int().min(1).max(RECORD_QUERY_MAX).default(100),
|
|
59621
|
+
/** Opaque keyset cursor from a previous answer. There is no offset. */
|
|
59622
|
+
cursor: string().min(1).optional()
|
|
59623
|
+
});
|
|
59624
|
+
var RecordQueryResultSchema = object({
|
|
59625
|
+
records: array(RecordViewSchema),
|
|
59626
|
+
nextCursor: string().nullable()
|
|
59627
|
+
});
|
|
59628
|
+
var RecordKindStateSchema = _enum([
|
|
59629
|
+
"created",
|
|
59630
|
+
"unchanged",
|
|
59631
|
+
"updated"
|
|
59632
|
+
]);
|
|
59633
|
+
var DeclareKindResultSchema = object({
|
|
59634
|
+
kindId: number().int(),
|
|
59635
|
+
state: RecordKindStateSchema,
|
|
59636
|
+
createdIndexes: array(string())
|
|
59637
|
+
});
|
|
59638
|
+
/** Keychain refs a write released (the old marker is gone from the row): the owner deletes the values. */
|
|
59639
|
+
var SecretRefsList = array(string());
|
|
59640
|
+
/**
|
|
59641
|
+
* One op of a `transact`: the single-row writes, each on a kind of the caller.
|
|
59642
|
+
* All ops of one call share ONE database file and ONE `transactFamily`.
|
|
59643
|
+
*/
|
|
59644
|
+
var RecordTransactOpSchema = discriminatedUnion("op", [
|
|
59645
|
+
object({
|
|
59646
|
+
op: literal("put"),
|
|
59647
|
+
kind: RecordKindNameSchema,
|
|
59648
|
+
record: RecordInputSchema,
|
|
59649
|
+
ifRev: number().int().min(0).optional()
|
|
59650
|
+
}),
|
|
59651
|
+
object({
|
|
59652
|
+
op: literal("patch"),
|
|
59653
|
+
kind: RecordKindNameSchema,
|
|
59654
|
+
id: RecordIdSchema,
|
|
59655
|
+
data: RecordBodySchema,
|
|
59656
|
+
at: number().int().nullable().optional(),
|
|
59657
|
+
expiresAt: number().int().nullable().optional(),
|
|
59658
|
+
ifRev: number().int().min(1).optional()
|
|
59659
|
+
}),
|
|
59660
|
+
object({
|
|
59661
|
+
op: literal("delete"),
|
|
59662
|
+
kind: RecordKindNameSchema,
|
|
59663
|
+
id: RecordIdSchema
|
|
59664
|
+
})
|
|
59665
|
+
]);
|
|
59666
|
+
var RecordSecretRefsSchema = record(string(), record(string(), string()));
|
|
59667
|
+
method(object({ kinds: record(RecordKindNameSchema, RecordKindDeclarationSchema) }), object({ kinds: record(string(), DeclareKindResultSchema) }), {
|
|
59668
|
+
kind: "mutation",
|
|
59669
|
+
auth: "admin"
|
|
59670
|
+
}), method(object({
|
|
59671
|
+
...KindShape,
|
|
59672
|
+
id: RecordIdSchema
|
|
59673
|
+
}), RecordViewSchema.nullable(), { auth: "admin" }), method(object({
|
|
59674
|
+
...KindShape,
|
|
59675
|
+
ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
|
|
59676
|
+
}), array(RecordViewSchema), { auth: "admin" }), method(object({
|
|
59677
|
+
...KindShape,
|
|
59678
|
+
ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
|
|
59679
|
+
}), RecordSecretRefsSchema, { auth: "admin" }), method(object({
|
|
59680
|
+
...KindShape,
|
|
59681
|
+
record: RecordInputSchema,
|
|
59682
|
+
/** Compare-and-set. `0` means "the row must not exist". */
|
|
59683
|
+
ifRev: number().int().min(0).optional()
|
|
59684
|
+
}), object({
|
|
59685
|
+
rev: number().int(),
|
|
59686
|
+
releasedRefs: SecretRefsList
|
|
59687
|
+
}), {
|
|
59688
|
+
kind: "mutation",
|
|
59689
|
+
auth: "admin"
|
|
59690
|
+
}), method(object({
|
|
59691
|
+
...KindShape,
|
|
59692
|
+
records: array(RecordInputSchema).min(1).max(RECORD_BATCH_MAX)
|
|
59693
|
+
}), object({
|
|
59694
|
+
count: number().int(),
|
|
59695
|
+
releasedRefs: SecretRefsList
|
|
59696
|
+
}), {
|
|
59697
|
+
kind: "mutation",
|
|
59698
|
+
auth: "admin"
|
|
59699
|
+
}), method(object({
|
|
59700
|
+
...KindShape,
|
|
59701
|
+
id: RecordIdSchema,
|
|
59702
|
+
data: RecordBodySchema,
|
|
59703
|
+
at: number().int().nullable().optional(),
|
|
59704
|
+
expiresAt: number().int().nullable().optional(),
|
|
59705
|
+
ifRev: number().int().min(1).optional()
|
|
59706
|
+
}), object({
|
|
59707
|
+
rev: number().int(),
|
|
59708
|
+
releasedRefs: SecretRefsList
|
|
59709
|
+
}), {
|
|
59710
|
+
kind: "mutation",
|
|
59711
|
+
auth: "admin"
|
|
59712
|
+
}), method(object({
|
|
59713
|
+
...KindShape,
|
|
59714
|
+
id: RecordIdSchema
|
|
59715
|
+
}), object({
|
|
59716
|
+
deleted: boolean(),
|
|
59717
|
+
secretRefs: SecretRefsList
|
|
59718
|
+
}), {
|
|
59719
|
+
kind: "mutation",
|
|
59720
|
+
auth: "admin"
|
|
59721
|
+
}), method(object({
|
|
59722
|
+
...KindShape,
|
|
59723
|
+
ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
|
|
59724
|
+
}), object({
|
|
59725
|
+
deleted: number().int(),
|
|
59726
|
+
secretRefs: SecretRefsList
|
|
59727
|
+
}), {
|
|
59728
|
+
kind: "mutation",
|
|
59729
|
+
auth: "admin"
|
|
59730
|
+
}), method(RecordQueryInputSchema, RecordQueryResultSchema, { auth: "admin" }), method(object({
|
|
59731
|
+
...KindShape,
|
|
59732
|
+
...TimeWindowShape,
|
|
59733
|
+
where: RecordWhereSchema.optional()
|
|
59734
|
+
}), object({ count: number().int() }), { auth: "admin" }), method(object({
|
|
59735
|
+
...KindShape,
|
|
59736
|
+
deviceId: number().int().optional(),
|
|
59737
|
+
from: number(),
|
|
59738
|
+
to: number(),
|
|
59739
|
+
bucketMs: number().int().positive()
|
|
59740
|
+
}), object({ buckets: array(object({
|
|
59741
|
+
bucketStart: number(),
|
|
59742
|
+
count: number().int()
|
|
59743
|
+
})) }), { auth: "admin" }), method(object({
|
|
59744
|
+
...KindShape,
|
|
59745
|
+
op: _enum([
|
|
59746
|
+
"sum",
|
|
59747
|
+
"min",
|
|
59748
|
+
"max",
|
|
59749
|
+
"count"
|
|
59750
|
+
]),
|
|
59751
|
+
field: RecordFieldPathSchema.optional(),
|
|
59752
|
+
groupBy: RecordFieldPathSchema.optional(),
|
|
59753
|
+
where: RecordWhereSchema.optional()
|
|
59754
|
+
}), object({ rows: array(object({
|
|
59755
|
+
group: union([
|
|
59756
|
+
string(),
|
|
59757
|
+
number(),
|
|
59758
|
+
_null()
|
|
59759
|
+
]),
|
|
59760
|
+
value: number().nullable()
|
|
59761
|
+
})) }), { auth: "admin" }), method(object({
|
|
59762
|
+
...KindShape,
|
|
59763
|
+
deviceId: number().int().optional(),
|
|
59764
|
+
atBefore: number().optional(),
|
|
59765
|
+
where: RecordWhereSchema.optional()
|
|
59766
|
+
}), object({
|
|
59767
|
+
deleted: number().int(),
|
|
59768
|
+
secretRefs: SecretRefsList
|
|
59769
|
+
}), {
|
|
59770
|
+
kind: "mutation",
|
|
59771
|
+
auth: "admin"
|
|
59772
|
+
}), method(object({ ops: array(RecordTransactOpSchema).min(1).max(RECORD_BATCH_MAX) }), object({
|
|
59773
|
+
results: array(object({
|
|
59774
|
+
rev: number().int().nullable(),
|
|
59775
|
+
deleted: boolean()
|
|
59776
|
+
})),
|
|
59777
|
+
releasedRefs: SecretRefsList,
|
|
59778
|
+
secretRefs: SecretRefsList
|
|
59779
|
+
}), {
|
|
59780
|
+
kind: "mutation",
|
|
59781
|
+
auth: "admin"
|
|
59782
|
+
}), method(object({
|
|
59783
|
+
deviceId: number().int(),
|
|
59784
|
+
kinds: array(RecordKindNameSchema).optional()
|
|
59785
|
+
}), object({
|
|
59786
|
+
deleted: record(string(), number().int()),
|
|
59787
|
+
secretRefs: SecretRefsList
|
|
59788
|
+
}), {
|
|
59789
|
+
kind: "mutation",
|
|
59790
|
+
auth: "admin"
|
|
59791
|
+
}), method(object(KindShape), object({ id: number().int() }), {
|
|
59792
|
+
kind: "mutation",
|
|
59793
|
+
auth: "admin"
|
|
59794
|
+
});
|
|
59795
|
+
/**
|
|
59796
|
+
* The wire shapes of the migration API, version 1 (planning#447).
|
|
59797
|
+
*
|
|
59798
|
+
* A migration is code that outlives the server it was written against: an addon at
|
|
59799
|
+
* version 1.4 that is brought to 1.9 in one jump still runs its 1.4 catalogue, against
|
|
59800
|
+
* the 1.9 kernel. The only thing that code may call is {@link MigrationApiV1}; this file
|
|
59801
|
+
* is the contract of every method of it, one Zod pair per method.
|
|
59802
|
+
*
|
|
59803
|
+
* APPEND-ONLY. A released method is never removed and never changes meaning: an input
|
|
59804
|
+
* field is never removed or made required, an enum never narrows, an output field is
|
|
59805
|
+
* never removed. A change that cannot be expressed that way is `migration-api.v2`, next
|
|
59806
|
+
* to this file. `scripts/check-migration-api-append-only.ts` holds the line against
|
|
59807
|
+
* `scripts/migration-api-contract.json`, and every `behaviours` id below must have an
|
|
59808
|
+
* `it('<id>'` in `migration-api.contract.spec.ts`.
|
|
59809
|
+
*/
|
|
59810
|
+
var Rows = record(string(), unknown());
|
|
59811
|
+
var IntegrationId = object({ integrationId: string().min(1) });
|
|
59812
|
+
var RecordId = object({ id: string().min(1) });
|
|
59813
|
+
var RecordRowSchema = object({
|
|
59814
|
+
id: string(),
|
|
59815
|
+
deviceId: number().int().nullable(),
|
|
59816
|
+
at: number().nullable(),
|
|
59817
|
+
expiresAt: number().nullable(),
|
|
59818
|
+
rev: number().int(),
|
|
59819
|
+
updatedAt: number(),
|
|
59820
|
+
data: Rows
|
|
59821
|
+
});
|
|
59822
|
+
var RecordPutShape = {
|
|
59823
|
+
id: string().min(1),
|
|
59824
|
+
deviceId: number().int().optional(),
|
|
59825
|
+
at: number().int().optional(),
|
|
59826
|
+
expiresAt: number().int().optional(),
|
|
59827
|
+
data: Rows
|
|
59828
|
+
};
|
|
59829
|
+
var MigrationIntegrationSchema = object({
|
|
59830
|
+
id: string(),
|
|
59831
|
+
addonId: string(),
|
|
59832
|
+
name: string(),
|
|
59833
|
+
info: Rows,
|
|
59834
|
+
/** The registry's stored switch: read by the one-switch migration, nothing else. */
|
|
59835
|
+
enabled: boolean().optional(),
|
|
59836
|
+
originStableId: string().optional()
|
|
59837
|
+
});
|
|
59838
|
+
var MigrationDeviceSchema = object({
|
|
59839
|
+
id: number().int(),
|
|
59840
|
+
integrationId: string().nullable().optional(),
|
|
59841
|
+
/** The owning device; null or absent for a root. */
|
|
59842
|
+
parentDeviceId: number().int().nullable().optional(),
|
|
59843
|
+
type: string().optional(),
|
|
59844
|
+
name: string().optional(),
|
|
59845
|
+
stableId: string().optional()
|
|
59846
|
+
});
|
|
59847
|
+
/** What the engine says about the migration API it serves: lets an addon notice an older server. */
|
|
59848
|
+
var MigrationApiInfoSchema = object({
|
|
59849
|
+
version: number().int(),
|
|
59850
|
+
methods: array(string())
|
|
59851
|
+
});
|
|
59852
|
+
object({
|
|
59853
|
+
message: string(),
|
|
59854
|
+
meta: Rows.optional(),
|
|
59855
|
+
/** Grouping tags of the line; a line about a device carries `{ deviceId }`. */
|
|
59856
|
+
tags: object({ deviceId: number().int().optional() }).optional()
|
|
59857
|
+
});
|
|
59858
|
+
object({
|
|
59859
|
+
owner: string().min(1),
|
|
59860
|
+
metas: array(MigrationMetaSchema)
|
|
59861
|
+
}), object({
|
|
59862
|
+
bootId: string(),
|
|
59863
|
+
snapshot: _enum([
|
|
59864
|
+
"none",
|
|
59865
|
+
"written",
|
|
59866
|
+
"refused"
|
|
59867
|
+
]),
|
|
59868
|
+
steps: array(MigrationOwnerStepSchema),
|
|
59869
|
+
/** The migration API the engine serves; absent from a server that predates it. */
|
|
59870
|
+
migrationApi: MigrationApiInfoSchema.optional()
|
|
59871
|
+
}), object({ id: string().min(1) }), object({
|
|
59872
|
+
proceed: boolean(),
|
|
59873
|
+
state: union([literal("pending"), MigrationStatusSchema]),
|
|
59874
|
+
reason: string().nullable()
|
|
59875
|
+
}), object({
|
|
59876
|
+
id: string().min(1),
|
|
59877
|
+
result: MigrationOwnerResultSchema
|
|
59878
|
+
}), object({
|
|
59879
|
+
status: MigrationStatusSchema,
|
|
59880
|
+
error: string().nullable(),
|
|
59881
|
+
rowsChanged: number().int().nonnegative()
|
|
59882
|
+
}), object({
|
|
59883
|
+
rows: number().int().nonnegative(),
|
|
59884
|
+
secrets: number().int().nonnegative()
|
|
59885
|
+
}), IntegrationId.extend({ patch: Rows }), object({ written: boolean() }), IntegrationId.extend({ keys: array(string().min(1)) }), object({
|
|
59886
|
+
present: boolean(),
|
|
59887
|
+
removed: Rows
|
|
59888
|
+
}), RecordRowSchema.nullable(), RecordRowSchema.nullable(), object({
|
|
59889
|
+
...RecordPutShape,
|
|
59890
|
+
ifRev: number().int().optional()
|
|
59891
|
+
}), object({ rev: number().int() }), object({ records: array(object(RecordPutShape)) }), object({ count: number().int().nonnegative() }), RecordId.extend({
|
|
59892
|
+
partial: Rows,
|
|
59893
|
+
ifRev: number().int().optional()
|
|
59894
|
+
}), object({ rev: number().int() }), object({ deleted: boolean() }), object({
|
|
59895
|
+
deviceId: number().int().optional(),
|
|
59896
|
+
atFrom: number().optional(),
|
|
59897
|
+
atTo: number().optional(),
|
|
59898
|
+
where: RecordWhereSchema.optional(),
|
|
59899
|
+
limit: number().int().min(1).optional(),
|
|
59900
|
+
cursor: string().min(1).optional(),
|
|
59901
|
+
resolveSecrets: boolean().optional()
|
|
59902
|
+
}), object({
|
|
59903
|
+
records: array(RecordRowSchema),
|
|
59904
|
+
nextCursor: string().nullable()
|
|
59905
|
+
}), object({
|
|
59906
|
+
deviceId: number().int().optional(),
|
|
59907
|
+
atBefore: number().optional(),
|
|
59908
|
+
where: RecordWhereSchema.optional()
|
|
59909
|
+
}), 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({
|
|
59910
|
+
ref: string().min(1),
|
|
59911
|
+
value: string()
|
|
59912
|
+
}), object({}), object({ refs: array(string()) }), object({ deleted: number().int().nonnegative() }), object({}), object({ integrations: array(MigrationIntegrationSchema) }), object({ id: string().min(1) }), MigrationIntegrationSchema.nullable(), object({
|
|
59913
|
+
addonId: string().min(1),
|
|
59914
|
+
integrationId: string().min(1).optional()
|
|
59915
|
+
}), object({ devices: array(MigrationDeviceSchema) }), object({ deviceId: number().int() }), object({
|
|
59916
|
+
id: number().int(),
|
|
59917
|
+
integrationId: string().nullable(),
|
|
59918
|
+
/** Whether the device carries any stored config; its content is not offered. */
|
|
59919
|
+
hasConfig: boolean()
|
|
59920
|
+
}).nullable(), object({
|
|
59921
|
+
deviceId: number().int(),
|
|
59922
|
+
integrationId: string().min(1)
|
|
59923
|
+
}), object({}), object({}), object({ nodeId: string() }), object({}), object({});
|
|
59329
59924
|
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({
|
|
59330
59925
|
id: string().min(1),
|
|
59331
59926
|
error: string().min(1)
|
|
@@ -59355,7 +59950,9 @@ method(object({}), object({ entries: array(MigrationLedgerEntrySchema) }), { aut
|
|
|
59355
59950
|
"written",
|
|
59356
59951
|
"refused"
|
|
59357
59952
|
]),
|
|
59358
|
-
steps: array(MigrationOwnerStepSchema)
|
|
59953
|
+
steps: array(MigrationOwnerStepSchema),
|
|
59954
|
+
/** The migration API this engine serves (additive: a server that predates it omits it). */
|
|
59955
|
+
migrationApi: MigrationApiInfoSchema.optional()
|
|
59359
59956
|
}), {
|
|
59360
59957
|
kind: "mutation",
|
|
59361
59958
|
auth: "admin"
|
|
@@ -62022,7 +62619,10 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
62022
62619
|
}), method(RelocateMediaInputSchema, object({ jobId: string() }), {
|
|
62023
62620
|
kind: "mutation",
|
|
62024
62621
|
auth: "admin"
|
|
62025
|
-
}), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(
|
|
62622
|
+
}), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(MediaLocationCensusInputSchema, MediaLocationCensusSchema, {
|
|
62623
|
+
kind: "query",
|
|
62624
|
+
auth: "admin"
|
|
62625
|
+
}), method(RelocatableMediaCountInputSchema, RelocatableMediaCountSchema, {
|
|
62026
62626
|
kind: "query",
|
|
62027
62627
|
auth: "admin"
|
|
62028
62628
|
}), method(object({}), array(RelocateJobSchema).readonly(), {
|
|
@@ -64677,7 +65277,7 @@ var BrokerStatusSchema$1 = _enum([
|
|
|
64677
65277
|
"unreachable",
|
|
64678
65278
|
"tls-error"
|
|
64679
65279
|
]);
|
|
64680
|
-
var BrokerInfoSchema
|
|
65280
|
+
var BrokerInfoSchema = object({
|
|
64681
65281
|
id: string(),
|
|
64682
65282
|
name: string(),
|
|
64683
65283
|
url: string(),
|
|
@@ -64740,7 +65340,7 @@ var StatusSchema = object({
|
|
|
64740
65340
|
brokerCount: number(),
|
|
64741
65341
|
embeddedRunning: boolean()
|
|
64742
65342
|
});
|
|
64743
|
-
method(_void(), array(BrokerInfoSchema
|
|
65343
|
+
method(_void(), array(BrokerInfoSchema)), method(IdInputSchema, BrokerConnectionDetailsSchema, { auth: "admin" }), method(AddBrokerInputSchema, AddBrokerResultSchema, {
|
|
64744
65344
|
kind: "mutation",
|
|
64745
65345
|
auth: "admin"
|
|
64746
65346
|
}), method(IdInputSchema, _void(), {
|
|
@@ -69362,14 +69962,6 @@ var PetFountainStatusSchema = object({
|
|
|
69362
69962
|
empty: boolean().nullable(),
|
|
69363
69963
|
/** True while the pump is running. Null while unknown. */
|
|
69364
69964
|
pumpRunning: boolean().nullable(),
|
|
69365
|
-
/** Water drunk in the last drink, in litres. */
|
|
69366
|
-
lastDrink: number().min(0).nullable().meta(readingMeta("volume")),
|
|
69367
|
-
/** Water drunk in the current hour, in litres. */
|
|
69368
|
-
currentHourDrink: number().min(0).nullable().meta(readingMeta("volume")),
|
|
69369
|
-
/** Water drunk over the last 24 hours (rolling), in litres. */
|
|
69370
|
-
last24hDrink: number().min(0).nullable().meta(readingMeta("volume")),
|
|
69371
|
-
/** Water drunk since local midnight, in litres. Null when the fountain has no such sensor. */
|
|
69372
|
-
todayDrink: number().min(0).nullable().meta(readingMeta("volume")),
|
|
69373
69965
|
/** Decoded fault message. Null means healthy; a non-null string is an active fault. */
|
|
69374
69966
|
error: string().nullable(),
|
|
69375
69967
|
/** Ms epoch when the slice was last refreshed. */
|
|
@@ -69382,21 +69974,15 @@ var petFountainCapability = {
|
|
|
69382
69974
|
deviceNative: true,
|
|
69383
69975
|
mode: "singleton",
|
|
69384
69976
|
deviceTypes: [DeviceType.PetFountain],
|
|
69385
|
-
methods: {
|
|
69386
|
-
|
|
69387
|
-
|
|
69388
|
-
|
|
69389
|
-
|
|
69390
|
-
|
|
69391
|
-
|
|
69392
|
-
|
|
69393
|
-
|
|
69394
|
-
/** Clear the rolling daily consumption counters on the device. */
|
|
69395
|
-
resetDailyConsumption: method(object({ deviceId: DeviceIdSchema$1 }), _void(), {
|
|
69396
|
-
kind: "mutation",
|
|
69397
|
-
auth: "protected"
|
|
69398
|
-
})
|
|
69399
|
-
},
|
|
69977
|
+
methods: {
|
|
69978
|
+
/** Start or stop the pump. */
|
|
69979
|
+
setPump: method(object({
|
|
69980
|
+
deviceId: DeviceIdSchema$1,
|
|
69981
|
+
on: boolean()
|
|
69982
|
+
}), _void(), {
|
|
69983
|
+
kind: "mutation",
|
|
69984
|
+
auth: "protected"
|
|
69985
|
+
}) },
|
|
69400
69986
|
status: {
|
|
69401
69987
|
schema: PetFountainStatusSchema,
|
|
69402
69988
|
kind: "push"
|
|
@@ -69420,14 +70006,6 @@ var petFountainCapability = {
|
|
|
69420
70006
|
waterVolume: {
|
|
69421
70007
|
kind: "gauge",
|
|
69422
70008
|
unit: "L"
|
|
69423
|
-
},
|
|
69424
|
-
todayDrink: {
|
|
69425
|
-
kind: "gauge",
|
|
69426
|
-
unit: "L"
|
|
69427
|
-
},
|
|
69428
|
-
last24hDrink: {
|
|
69429
|
-
kind: "gauge",
|
|
69430
|
-
unit: "L"
|
|
69431
70009
|
}
|
|
69432
70010
|
} }
|
|
69433
70011
|
};
|
|
@@ -71922,253 +72500,6 @@ DeviceType.Camera, DeviceType.Sensor, DeviceType.Switch, DeviceType.Gateway, met
|
|
|
71922
72500
|
auth: "admin"
|
|
71923
72501
|
});
|
|
71924
72502
|
/**
|
|
71925
|
-
* records - an addon's own facts and documents (D881): ledgers, audit rows,
|
|
71926
|
-
* config documents, mirrors. The third storage API next to `ctx.settings`
|
|
71927
|
-
* (operator intent, D870) and device-history (numbers over time, D850).
|
|
71928
|
-
*
|
|
71929
|
-
* Who the OWNER is: `callerAddonId`, stamped by the transport on a call that
|
|
71930
|
-
* crossed a process and stated by a hub in-process caller (`ctx.records` does
|
|
71931
|
-
* that with the addon id closed over). It is deliberately NOT in any input
|
|
71932
|
-
* schema, so a session can never supply it, and a call with no stamp is refused
|
|
71933
|
-
* `records/no-caller`. A kind is readable and writable only by its owner; other
|
|
71934
|
-
* addons go through the owner's capability.
|
|
71935
|
-
*
|
|
71936
|
-
* Every read is three-way: a row, `null`, or the call THROWS. A failed read is
|
|
71937
|
-
* never `[]`. Secret fields are never on the wire: a read shows the
|
|
71938
|
-
* redaction token, `secretRefs` hands the owner's `ctx.secrets` the refs it
|
|
71939
|
-
* resolves itself, and a write may carry only a keychain marker bound to the
|
|
71940
|
-
* row's own ref.
|
|
71941
|
-
*
|
|
71942
|
-
* Internal: addons reach it through `ctx.records`, never directly.
|
|
71943
|
-
*/
|
|
71944
|
-
var RecordIdSchema = string().min(1).max(256);
|
|
71945
|
-
/** A JSON object body. Size is the engine's check (`maxDataBytes`), not a schema's. */
|
|
71946
|
-
var RecordBodySchema = record(string(), unknown());
|
|
71947
|
-
var RecordInputSchema = object({
|
|
71948
|
-
id: RecordIdSchema,
|
|
71949
|
-
/** The device this row belongs to (D865 removal, per-device reads). */
|
|
71950
|
-
deviceId: number().int().optional(),
|
|
71951
|
-
/** The domain clock, ms: observed / created / opened. */
|
|
71952
|
-
at: number().int().optional(),
|
|
71953
|
-
/** Producer-set expiry, ms. Refused on a kind whose retention is an engine TTL. */
|
|
71954
|
-
expiresAt: number().int().optional(),
|
|
71955
|
-
data: RecordBodySchema
|
|
71956
|
-
});
|
|
71957
|
-
var RecordViewSchema = object({
|
|
71958
|
-
id: string(),
|
|
71959
|
-
deviceId: number().int().nullable(),
|
|
71960
|
-
at: number().nullable(),
|
|
71961
|
-
expiresAt: number().nullable(),
|
|
71962
|
-
rev: number().int(),
|
|
71963
|
-
updatedAt: number(),
|
|
71964
|
-
data: RecordBodySchema
|
|
71965
|
-
});
|
|
71966
|
-
/** Declared index fields only. Anything else does not compile, by design. */
|
|
71967
|
-
var RecordWhereSchema = record(RecordFieldPathSchema, union([
|
|
71968
|
-
string(),
|
|
71969
|
-
number(),
|
|
71970
|
-
boolean(),
|
|
71971
|
-
object({ in: array(union([
|
|
71972
|
-
string(),
|
|
71973
|
-
number(),
|
|
71974
|
-
boolean()
|
|
71975
|
-
])).min(1).max(RECORD_BATCH_MAX) }),
|
|
71976
|
-
object({
|
|
71977
|
-
gt: union([string(), number()]).optional(),
|
|
71978
|
-
gte: union([string(), number()]).optional(),
|
|
71979
|
-
lt: union([string(), number()]).optional(),
|
|
71980
|
-
lte: union([string(), number()]).optional()
|
|
71981
|
-
}).refine((r) => Object.keys(r).length > 0, { message: "name at least one bound" })
|
|
71982
|
-
]));
|
|
71983
|
-
var KindShape = { kind: RecordKindNameSchema };
|
|
71984
|
-
var TimeWindowShape = {
|
|
71985
|
-
deviceId: number().int().optional(),
|
|
71986
|
-
atFrom: number().optional(),
|
|
71987
|
-
atTo: number().optional()
|
|
71988
|
-
};
|
|
71989
|
-
var RecordQueryInputSchema = object({
|
|
71990
|
-
...KindShape,
|
|
71991
|
-
...TimeWindowShape,
|
|
71992
|
-
where: RecordWhereSchema.optional(),
|
|
71993
|
-
/** Without `where`: `at` (default for a kind with a clock) or `id`. With `where` the order is the index's. */
|
|
71994
|
-
order: _enum(["at", "id"]).optional(),
|
|
71995
|
-
desc: boolean().optional(),
|
|
71996
|
-
limit: number().int().min(1).max(RECORD_QUERY_MAX).default(100),
|
|
71997
|
-
/** Opaque keyset cursor from a previous answer. There is no offset. */
|
|
71998
|
-
cursor: string().min(1).optional()
|
|
71999
|
-
});
|
|
72000
|
-
var RecordQueryResultSchema = object({
|
|
72001
|
-
records: array(RecordViewSchema),
|
|
72002
|
-
nextCursor: string().nullable()
|
|
72003
|
-
});
|
|
72004
|
-
var RecordKindStateSchema = _enum([
|
|
72005
|
-
"created",
|
|
72006
|
-
"unchanged",
|
|
72007
|
-
"updated"
|
|
72008
|
-
]);
|
|
72009
|
-
var DeclareKindResultSchema = object({
|
|
72010
|
-
kindId: number().int(),
|
|
72011
|
-
state: RecordKindStateSchema,
|
|
72012
|
-
createdIndexes: array(string())
|
|
72013
|
-
});
|
|
72014
|
-
/** Keychain refs a write released (the old marker is gone from the row): the owner deletes the values. */
|
|
72015
|
-
var SecretRefsList = array(string());
|
|
72016
|
-
/**
|
|
72017
|
-
* One op of a `transact`: the single-row writes, each on a kind of the caller.
|
|
72018
|
-
* All ops of one call share ONE database file and ONE `transactFamily`.
|
|
72019
|
-
*/
|
|
72020
|
-
var RecordTransactOpSchema = discriminatedUnion("op", [
|
|
72021
|
-
object({
|
|
72022
|
-
op: literal("put"),
|
|
72023
|
-
kind: RecordKindNameSchema,
|
|
72024
|
-
record: RecordInputSchema,
|
|
72025
|
-
ifRev: number().int().min(0).optional()
|
|
72026
|
-
}),
|
|
72027
|
-
object({
|
|
72028
|
-
op: literal("patch"),
|
|
72029
|
-
kind: RecordKindNameSchema,
|
|
72030
|
-
id: RecordIdSchema,
|
|
72031
|
-
data: RecordBodySchema,
|
|
72032
|
-
at: number().int().nullable().optional(),
|
|
72033
|
-
expiresAt: number().int().nullable().optional(),
|
|
72034
|
-
ifRev: number().int().min(1).optional()
|
|
72035
|
-
}),
|
|
72036
|
-
object({
|
|
72037
|
-
op: literal("delete"),
|
|
72038
|
-
kind: RecordKindNameSchema,
|
|
72039
|
-
id: RecordIdSchema
|
|
72040
|
-
})
|
|
72041
|
-
]);
|
|
72042
|
-
var RecordSecretRefsSchema = record(string(), record(string(), string()));
|
|
72043
|
-
method(object({ kinds: record(RecordKindNameSchema, RecordKindDeclarationSchema) }), object({ kinds: record(string(), DeclareKindResultSchema) }), {
|
|
72044
|
-
kind: "mutation",
|
|
72045
|
-
auth: "admin"
|
|
72046
|
-
}), method(object({
|
|
72047
|
-
...KindShape,
|
|
72048
|
-
id: RecordIdSchema
|
|
72049
|
-
}), RecordViewSchema.nullable(), { auth: "admin" }), method(object({
|
|
72050
|
-
...KindShape,
|
|
72051
|
-
ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
|
|
72052
|
-
}), array(RecordViewSchema), { auth: "admin" }), method(object({
|
|
72053
|
-
...KindShape,
|
|
72054
|
-
ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
|
|
72055
|
-
}), RecordSecretRefsSchema, { auth: "admin" }), method(object({
|
|
72056
|
-
...KindShape,
|
|
72057
|
-
record: RecordInputSchema,
|
|
72058
|
-
/** Compare-and-set. `0` means "the row must not exist". */
|
|
72059
|
-
ifRev: number().int().min(0).optional()
|
|
72060
|
-
}), object({
|
|
72061
|
-
rev: number().int(),
|
|
72062
|
-
releasedRefs: SecretRefsList
|
|
72063
|
-
}), {
|
|
72064
|
-
kind: "mutation",
|
|
72065
|
-
auth: "admin"
|
|
72066
|
-
}), method(object({
|
|
72067
|
-
...KindShape,
|
|
72068
|
-
records: array(RecordInputSchema).min(1).max(RECORD_BATCH_MAX)
|
|
72069
|
-
}), object({
|
|
72070
|
-
count: number().int(),
|
|
72071
|
-
releasedRefs: SecretRefsList
|
|
72072
|
-
}), {
|
|
72073
|
-
kind: "mutation",
|
|
72074
|
-
auth: "admin"
|
|
72075
|
-
}), method(object({
|
|
72076
|
-
...KindShape,
|
|
72077
|
-
id: RecordIdSchema,
|
|
72078
|
-
data: RecordBodySchema,
|
|
72079
|
-
at: number().int().nullable().optional(),
|
|
72080
|
-
expiresAt: number().int().nullable().optional(),
|
|
72081
|
-
ifRev: number().int().min(1).optional()
|
|
72082
|
-
}), object({
|
|
72083
|
-
rev: number().int(),
|
|
72084
|
-
releasedRefs: SecretRefsList
|
|
72085
|
-
}), {
|
|
72086
|
-
kind: "mutation",
|
|
72087
|
-
auth: "admin"
|
|
72088
|
-
}), method(object({
|
|
72089
|
-
...KindShape,
|
|
72090
|
-
id: RecordIdSchema
|
|
72091
|
-
}), object({
|
|
72092
|
-
deleted: boolean(),
|
|
72093
|
-
secretRefs: SecretRefsList
|
|
72094
|
-
}), {
|
|
72095
|
-
kind: "mutation",
|
|
72096
|
-
auth: "admin"
|
|
72097
|
-
}), method(object({
|
|
72098
|
-
...KindShape,
|
|
72099
|
-
ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
|
|
72100
|
-
}), object({
|
|
72101
|
-
deleted: number().int(),
|
|
72102
|
-
secretRefs: SecretRefsList
|
|
72103
|
-
}), {
|
|
72104
|
-
kind: "mutation",
|
|
72105
|
-
auth: "admin"
|
|
72106
|
-
}), method(RecordQueryInputSchema, RecordQueryResultSchema, { auth: "admin" }), method(object({
|
|
72107
|
-
...KindShape,
|
|
72108
|
-
...TimeWindowShape,
|
|
72109
|
-
where: RecordWhereSchema.optional()
|
|
72110
|
-
}), object({ count: number().int() }), { auth: "admin" }), method(object({
|
|
72111
|
-
...KindShape,
|
|
72112
|
-
deviceId: number().int().optional(),
|
|
72113
|
-
from: number(),
|
|
72114
|
-
to: number(),
|
|
72115
|
-
bucketMs: number().int().positive()
|
|
72116
|
-
}), object({ buckets: array(object({
|
|
72117
|
-
bucketStart: number(),
|
|
72118
|
-
count: number().int()
|
|
72119
|
-
})) }), { auth: "admin" }), method(object({
|
|
72120
|
-
...KindShape,
|
|
72121
|
-
op: _enum([
|
|
72122
|
-
"sum",
|
|
72123
|
-
"min",
|
|
72124
|
-
"max",
|
|
72125
|
-
"count"
|
|
72126
|
-
]),
|
|
72127
|
-
field: RecordFieldPathSchema.optional(),
|
|
72128
|
-
groupBy: RecordFieldPathSchema.optional(),
|
|
72129
|
-
where: RecordWhereSchema.optional()
|
|
72130
|
-
}), object({ rows: array(object({
|
|
72131
|
-
group: union([
|
|
72132
|
-
string(),
|
|
72133
|
-
number(),
|
|
72134
|
-
_null()
|
|
72135
|
-
]),
|
|
72136
|
-
value: number().nullable()
|
|
72137
|
-
})) }), { auth: "admin" }), method(object({
|
|
72138
|
-
...KindShape,
|
|
72139
|
-
deviceId: number().int().optional(),
|
|
72140
|
-
atBefore: number().optional(),
|
|
72141
|
-
where: RecordWhereSchema.optional()
|
|
72142
|
-
}), object({
|
|
72143
|
-
deleted: number().int(),
|
|
72144
|
-
secretRefs: SecretRefsList
|
|
72145
|
-
}), {
|
|
72146
|
-
kind: "mutation",
|
|
72147
|
-
auth: "admin"
|
|
72148
|
-
}), method(object({ ops: array(RecordTransactOpSchema).min(1).max(RECORD_BATCH_MAX) }), object({
|
|
72149
|
-
results: array(object({
|
|
72150
|
-
rev: number().int().nullable(),
|
|
72151
|
-
deleted: boolean()
|
|
72152
|
-
})),
|
|
72153
|
-
releasedRefs: SecretRefsList,
|
|
72154
|
-
secretRefs: SecretRefsList
|
|
72155
|
-
}), {
|
|
72156
|
-
kind: "mutation",
|
|
72157
|
-
auth: "admin"
|
|
72158
|
-
}), method(object({
|
|
72159
|
-
deviceId: number().int(),
|
|
72160
|
-
kinds: array(RecordKindNameSchema).optional()
|
|
72161
|
-
}), object({
|
|
72162
|
-
deleted: record(string(), number().int()),
|
|
72163
|
-
secretRefs: SecretRefsList
|
|
72164
|
-
}), {
|
|
72165
|
-
kind: "mutation",
|
|
72166
|
-
auth: "admin"
|
|
72167
|
-
}), method(object(KindShape), object({ id: number().int() }), {
|
|
72168
|
-
kind: "mutation",
|
|
72169
|
-
auth: "admin"
|
|
72170
|
-
});
|
|
72171
|
-
/**
|
|
72172
72503
|
* record-entries - the ONE admin surface for every list of user-created entries
|
|
72173
72504
|
* (D881): notification targets, brokers, LLM profiles, anything an addon
|
|
72174
72505
|
* declares as an ENTRY kind (`entry: { title }` in `defineRecordKinds`).
|
|
@@ -81935,7 +82266,7 @@ var BaseDeviceProvider = class extends BaseAddon {
|
|
|
81935
82266
|
* `deviceClasses` map (first registered type). `null` when manual creation is
|
|
81936
82267
|
* unsupported. Lets the Add-Device dialog pick the right type per provider.
|
|
81937
82268
|
*/
|
|
81938
|
-
async getManualCreationType() {
|
|
82269
|
+
async getManualCreationType(_input) {
|
|
81939
82270
|
if (!await this.supportsManualCreation()) return { deviceType: null };
|
|
81940
82271
|
return { deviceType: Object.values(DeviceType).find((t) => this.deviceClasses[t] !== void 0) ?? null };
|
|
81941
82272
|
}
|
|
@@ -81946,7 +82277,7 @@ var BaseDeviceProvider = class extends BaseAddon {
|
|
|
81946
82277
|
return true;
|
|
81947
82278
|
}
|
|
81948
82279
|
async getChildCreationSchema(input) {
|
|
81949
|
-
return this.onGetCreationSchema(input.type);
|
|
82280
|
+
return this.onGetCreationSchema(input.type, { integrationId: input.integrationId });
|
|
81950
82281
|
}
|
|
81951
82282
|
/**
|
|
81952
82283
|
* Default kernel-orchestrated `createDevice` implementation. The
|
|
@@ -83367,20 +83698,6 @@ Object.freeze({
|
|
|
83367
83698
|
access: "create",
|
|
83368
83699
|
role: "viewer"
|
|
83369
83700
|
},
|
|
83370
|
-
"broker.add": {
|
|
83371
|
-
capName: "broker",
|
|
83372
|
-
capScope: "system",
|
|
83373
|
-
addonId: null,
|
|
83374
|
-
access: "create",
|
|
83375
|
-
role: "admin"
|
|
83376
|
-
},
|
|
83377
|
-
"broker.get": {
|
|
83378
|
-
capName: "broker",
|
|
83379
|
-
capScope: "system",
|
|
83380
|
-
addonId: null,
|
|
83381
|
-
access: "view",
|
|
83382
|
-
role: "admin"
|
|
83383
|
-
},
|
|
83384
83701
|
"broker.getBrokerConfig": {
|
|
83385
83702
|
capName: "broker",
|
|
83386
83703
|
capScope: "system",
|
|
@@ -83388,20 +83705,6 @@ Object.freeze({
|
|
|
83388
83705
|
access: "view",
|
|
83389
83706
|
role: "admin"
|
|
83390
83707
|
},
|
|
83391
|
-
"broker.getSettings": {
|
|
83392
|
-
capName: "broker",
|
|
83393
|
-
capScope: "system",
|
|
83394
|
-
addonId: null,
|
|
83395
|
-
access: "view",
|
|
83396
|
-
role: "admin"
|
|
83397
|
-
},
|
|
83398
|
-
"broker.getSettingsSchema": {
|
|
83399
|
-
capName: "broker",
|
|
83400
|
-
capScope: "system",
|
|
83401
|
-
addonId: null,
|
|
83402
|
-
access: "view",
|
|
83403
|
-
role: "admin"
|
|
83404
|
-
},
|
|
83405
83708
|
"broker.getState": {
|
|
83406
83709
|
capName: "broker",
|
|
83407
83710
|
capScope: "system",
|
|
@@ -83416,20 +83719,6 @@ Object.freeze({
|
|
|
83416
83719
|
access: "view",
|
|
83417
83720
|
role: "admin"
|
|
83418
83721
|
},
|
|
83419
|
-
"broker.list": {
|
|
83420
|
-
capName: "broker",
|
|
83421
|
-
capScope: "system",
|
|
83422
|
-
addonId: null,
|
|
83423
|
-
access: "view",
|
|
83424
|
-
role: "admin"
|
|
83425
|
-
},
|
|
83426
|
-
"broker.listProviders": {
|
|
83427
|
-
capName: "broker",
|
|
83428
|
-
capScope: "system",
|
|
83429
|
-
addonId: null,
|
|
83430
|
-
access: "view",
|
|
83431
|
-
role: "admin"
|
|
83432
|
-
},
|
|
83433
83722
|
"broker.publish": {
|
|
83434
83723
|
capName: "broker",
|
|
83435
83724
|
capScope: "system",
|
|
@@ -83437,20 +83726,6 @@ Object.freeze({
|
|
|
83437
83726
|
access: "create",
|
|
83438
83727
|
role: "admin"
|
|
83439
83728
|
},
|
|
83440
|
-
"broker.remove": {
|
|
83441
|
-
capName: "broker",
|
|
83442
|
-
capScope: "system",
|
|
83443
|
-
addonId: null,
|
|
83444
|
-
access: "delete",
|
|
83445
|
-
role: "admin"
|
|
83446
|
-
},
|
|
83447
|
-
"broker.setSettings": {
|
|
83448
|
-
capName: "broker",
|
|
83449
|
-
capScope: "system",
|
|
83450
|
-
addonId: null,
|
|
83451
|
-
access: "create",
|
|
83452
|
-
role: "admin"
|
|
83453
|
-
},
|
|
83454
83729
|
"broker.subscribe": {
|
|
83455
83730
|
capName: "broker",
|
|
83456
83731
|
capScope: "system",
|
|
@@ -83458,20 +83733,6 @@ Object.freeze({
|
|
|
83458
83733
|
access: "create",
|
|
83459
83734
|
role: "admin"
|
|
83460
83735
|
},
|
|
83461
|
-
"broker.testConnection": {
|
|
83462
|
-
capName: "broker",
|
|
83463
|
-
capScope: "system",
|
|
83464
|
-
addonId: null,
|
|
83465
|
-
access: "create",
|
|
83466
|
-
role: "admin"
|
|
83467
|
-
},
|
|
83468
|
-
"broker.testSettings": {
|
|
83469
|
-
capName: "broker",
|
|
83470
|
-
capScope: "system",
|
|
83471
|
-
addonId: null,
|
|
83472
|
-
access: "create",
|
|
83473
|
-
role: "admin"
|
|
83474
|
-
},
|
|
83475
83736
|
"broker.unsubscribe": {
|
|
83476
83737
|
capName: "broker",
|
|
83477
83738
|
capScope: "system",
|
|
@@ -88232,13 +88493,6 @@ Object.freeze({
|
|
|
88232
88493
|
access: "view",
|
|
88233
88494
|
role: "viewer"
|
|
88234
88495
|
},
|
|
88235
|
-
"petFountain.resetDailyConsumption": {
|
|
88236
|
-
capName: "pet-fountain",
|
|
88237
|
-
capScope: "device",
|
|
88238
|
-
addonId: null,
|
|
88239
|
-
access: "delete",
|
|
88240
|
-
role: "viewer"
|
|
88241
|
-
},
|
|
88242
88496
|
"petFountain.setPump": {
|
|
88243
88497
|
capName: "pet-fountain",
|
|
88244
88498
|
capScope: "device",
|
|
@@ -88435,6 +88689,13 @@ Object.freeze({
|
|
|
88435
88689
|
access: "view",
|
|
88436
88690
|
role: "viewer"
|
|
88437
88691
|
},
|
|
88692
|
+
"pipelineAnalytics.getMediaLocationCensus": {
|
|
88693
|
+
capName: "pipeline-analytics",
|
|
88694
|
+
capScope: "device",
|
|
88695
|
+
addonId: null,
|
|
88696
|
+
access: "view",
|
|
88697
|
+
role: "admin"
|
|
88698
|
+
},
|
|
88438
88699
|
"pipelineAnalytics.getMediaReclaimStatus": {
|
|
88439
88700
|
capName: "pipeline-analytics",
|
|
88440
88701
|
capScope: "device",
|
|
@@ -94628,11 +94889,6 @@ Object.freeze({
|
|
|
94628
94889
|
form: "single",
|
|
94629
94890
|
optional: false
|
|
94630
94891
|
}],
|
|
94631
|
-
"petFountain.resetDailyConsumption": [{
|
|
94632
|
-
name: "deviceId",
|
|
94633
|
-
form: "single",
|
|
94634
|
-
optional: false
|
|
94635
|
-
}],
|
|
94636
94892
|
"petFountain.setPump": [{
|
|
94637
94893
|
name: "deviceId",
|
|
94638
94894
|
form: "single",
|
|
@@ -98446,18 +98702,6 @@ Object.defineProperty(exports, "customAction", {
|
|
|
98446
98702
|
return customAction;
|
|
98447
98703
|
}
|
|
98448
98704
|
});
|
|
98449
|
-
Object.defineProperty(exports, "defaultIntegrationApiOver", {
|
|
98450
|
-
enumerable: true,
|
|
98451
|
-
get: function() {
|
|
98452
|
-
return defaultIntegrationApiOver;
|
|
98453
|
-
}
|
|
98454
|
-
});
|
|
98455
|
-
Object.defineProperty(exports, "defineAddonMigrations", {
|
|
98456
|
-
enumerable: true,
|
|
98457
|
-
get: function() {
|
|
98458
|
-
return defineAddonMigrations;
|
|
98459
|
-
}
|
|
98460
|
-
});
|
|
98461
98705
|
Object.defineProperty(exports, "defineCustomActions", {
|
|
98462
98706
|
enumerable: true,
|
|
98463
98707
|
get: function() {
|
|
@@ -98584,6 +98828,12 @@ Object.defineProperty(exports, "record", {
|
|
|
98584
98828
|
return record;
|
|
98585
98829
|
}
|
|
98586
98830
|
});
|
|
98831
|
+
Object.defineProperty(exports, "rowsDepsOver", {
|
|
98832
|
+
enumerable: true,
|
|
98833
|
+
get: function() {
|
|
98834
|
+
return rowsDepsOver;
|
|
98835
|
+
}
|
|
98836
|
+
});
|
|
98587
98837
|
Object.defineProperty(exports, "runningFromDishwasherOperation", {
|
|
98588
98838
|
enumerable: true,
|
|
98589
98839
|
get: function() {
|