@camstack/server 1.2.785 → 1.2.786
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 +7 -0
- package/dist/api/core/cap-providers.js +44 -7
- package/dist/api/trpc/generated-cap-routers.js +0 -9
- package/package.json +39 -11
- package/system/dist/addon-runner.js +11 -2
- package/system/dist/addon-runner.mjs +12 -3
- package/system/dist/{agent-https-CACfLh65.mjs → agent-https-D779EYj3.mjs} +1 -1
- package/system/dist/{agent-https-B7lqIrF1.js → agent-https-snFEmSqQ.js} +1 -1
- package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
- package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
- package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
- package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
- package/system/dist/builtins/alerts/alerts.addon.js +1 -1
- package/system/dist/builtins/alerts/alerts.addon.mjs +1 -1
- package/system/dist/builtins/autotrack/index.js +1 -1
- package/system/dist/builtins/autotrack/index.mjs +1 -1
- package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +2 -2
- package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +2 -2
- package/system/dist/builtins/calendars/calendars.addon.js +1 -1
- package/system/dist/builtins/calendars/calendars.addon.mjs +1 -1
- package/system/dist/builtins/camera-grid/index.js +1 -1
- package/system/dist/builtins/camera-grid/index.mjs +1 -1
- package/system/dist/builtins/composer/composed-device.d.ts +16 -0
- package/system/dist/builtins/composer/composer.addon.js +62 -13
- package/system/dist/builtins/composer/composer.addon.mjs +62 -13
- package/system/dist/builtins/console-logging/index.js +1 -1
- package/system/dist/builtins/console-logging/index.mjs +1 -1
- package/system/dist/builtins/core-blocks/actions-service.d.ts +16 -0
- package/system/dist/builtins/core-blocks/core-blocks.addon.js +235 -37
- package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +235 -37
- package/system/dist/builtins/core-blocks/migrations/fountain-drink-drop.d.ts +21 -0
- package/system/dist/builtins/core-blocks/migrations/index.d.ts +1 -0
- package/system/dist/builtins/device-history/device-history.addon.js +2 -2
- package/system/dist/builtins/device-history/device-history.addon.mjs +2 -2
- package/system/dist/builtins/device-manager/device-manager.addon.js +1 -1
- package/system/dist/builtins/device-manager/device-manager.addon.mjs +1 -1
- package/system/dist/builtins/hub-forwarder/index.js +1 -1
- package/system/dist/builtins/hub-forwarder/index.mjs +1 -1
- package/system/dist/builtins/keychain/index.js +4 -4
- package/system/dist/builtins/keychain/index.mjs +4 -4
- package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
- package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
- package/system/dist/builtins/local-auth/local-auth.addon.js +2 -2
- package/system/dist/builtins/local-auth/local-auth.addon.mjs +2 -2
- package/system/dist/builtins/local-network/local-network.addon.js +2 -2
- package/system/dist/builtins/local-network/local-network.addon.mjs +2 -2
- package/system/dist/builtins/loki-logging/index.js +2 -2
- package/system/dist/builtins/loki-logging/index.mjs +2 -2
- package/system/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
- package/system/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
- package/system/dist/builtins/platform-probe/index.js +1 -1
- package/system/dist/builtins/platform-probe/index.mjs +1 -1
- package/system/dist/builtins/record-entries/index.js +1 -1
- package/system/dist/builtins/record-entries/index.mjs +1 -1
- package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
- package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
- package/system/dist/builtins/snapshot/index.js +1 -1
- package/system/dist/builtins/snapshot/index.mjs +1 -1
- package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
- package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
- package/system/dist/builtins/sqlite-storage/index.js +1 -1
- package/system/dist/builtins/sqlite-storage/index.mjs +1 -1
- package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.js +3 -3
- package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +3 -3
- package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
- package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
- package/system/dist/builtins/system-config/system-config.addon.js +3 -3
- package/system/dist/builtins/system-config/system-config.addon.mjs +284 -284
- package/system/dist/builtins/winston-logging/index.js +1 -1
- package/system/dist/builtins/winston-logging/index.mjs +1 -1
- package/system/dist/{capture-engine-Dw82x5UW.mjs → capture-engine-DkTEWrRe.mjs} +1 -1
- package/system/dist/{capture-engine-n5mJUHzf.js → capture-engine-NZ11ORZS.js} +1 -1
- package/system/dist/{composition-sources-Cdow6PNn.js → composition-sources-B6GYTy_7.js} +1 -1
- package/system/dist/{composition-sources-D-bbLadz.mjs → composition-sources-B9-lkIvO.mjs} +1 -1
- package/system/dist/{constants-C6UsfDdP.mjs → constants--9ui1LK0.mjs} +1 -1
- package/system/dist/{constants-Dmc-T4Zw.js → constants-DR8hdi45.js} +1 -1
- package/system/dist/{device-ca-OQqtK7Yy.mjs → device-ca-D-7tAHJ_.mjs} +1 -1
- package/system/dist/{device-ca-v8lGdWVk.js → device-ca-sIFmKkGM.js} +1 -1
- package/system/dist/{dist-CRWinpyX.mjs → dist-D-iGSnX_.mjs} +1039 -821
- package/system/dist/{dist-1X5ccoX2.js → dist-h3Yla8gE.js} +1092 -820
- package/system/dist/file-host-worker.js +1 -1
- package/system/dist/file-host-worker.mjs +1 -1
- package/system/dist/{hub-mdns-ciao-hBZgojNT.js → hub-mdns-ciao-C5DkUEZF.js} +2 -2
- package/system/dist/{hub-mdns-ciao-BQqm5eSM.mjs → hub-mdns-ciao-DuEfM0fI.mjs} +2 -2
- package/system/dist/index.js +19 -10
- package/system/dist/index.mjs +20 -11
- package/system/dist/kernel/moleculer/migration-api-facade.d.ts +2 -0
- package/system/dist/kernel/transport/local-child-client.d.ts +9 -0
- package/system/dist/{legacy-integration-rows-door-B7bwfRev.mjs → legacy-integration-rows-door-BTdhD-Yp.mjs} +1 -1
- package/system/dist/{legacy-integration-rows-door-BUjw8YoW.js → legacy-integration-rows-door-DTDD5wwC.js} +1 -1
- package/system/dist/{restore-archive-D9vM-Kzb.js → restore-archive-CkAD_-E9.js} +1 -1
- package/system/dist/{restore-archive-TST7tvBk.mjs → restore-archive-DQWz5Wp-.mjs} +82 -82
- package/system/dist/{wal-maintenance-wfVwXxO4.js → wal-maintenance-CB-O-GPP.js} +0 -0
- package/system/dist/{wal-maintenance-C7dJSaPS.mjs → wal-maintenance-DouX1XsY.mjs} +0 -0
- package/system/package.json +1 -1
|
@@ -1171,7 +1171,7 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
|
|
|
1171
1171
|
return DeviceRole;
|
|
1172
1172
|
}({});
|
|
1173
1173
|
//#endregion
|
|
1174
|
-
//#region ../types/dist/sleep-
|
|
1174
|
+
//#region ../types/dist/sleep-CmjWurK5.mjs
|
|
1175
1175
|
/**
|
|
1176
1176
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
1177
1177
|
* window to float samples (D455).
|
|
@@ -1919,147 +1919,170 @@ async function runAddonMigrations(host, migrations, logger, options = {}) {
|
|
|
1919
1919
|
blockOwner
|
|
1920
1920
|
};
|
|
1921
1921
|
}
|
|
1922
|
-
/**
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
const set = async (next) => {
|
|
1941
|
-
const validated = deps.schema.parse(next);
|
|
1942
|
-
await deps.write({ [deps.key]: validated });
|
|
1943
|
-
};
|
|
1944
|
-
const update = async (fn) => {
|
|
1945
|
-
await set(fn(await get()));
|
|
1946
|
-
};
|
|
1922
|
+
/** The record calls the one-switch migration makes, over the migration API. */
|
|
1923
|
+
function switchRecordsOverMigrationApi(api) {
|
|
1924
|
+
return { kind: (definition) => {
|
|
1925
|
+
const handle = api.records.kind(definition);
|
|
1926
|
+
return {
|
|
1927
|
+
get: (id) => handle.get({ id }),
|
|
1928
|
+
put: (input, opts) => handle.put({
|
|
1929
|
+
...input,
|
|
1930
|
+
...opts?.ifRev === void 0 ? {} : { ifRev: opts.ifRev }
|
|
1931
|
+
}),
|
|
1932
|
+
patch: (id, partial) => handle.patch({
|
|
1933
|
+
id,
|
|
1934
|
+
partial
|
|
1935
|
+
})
|
|
1936
|
+
};
|
|
1937
|
+
} };
|
|
1938
|
+
}
|
|
1939
|
+
function integrationRowsApiOver(api) {
|
|
1947
1940
|
return {
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1941
|
+
list: async () => (await api.integrations.list({})).integrations,
|
|
1942
|
+
readLegacyIntegrationRows: (input) => api.legacyRows.read(input),
|
|
1943
|
+
clearLegacyIntegrationRows: (input) => api.legacyRows.clear(input)
|
|
1951
1944
|
};
|
|
1952
1945
|
}
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
* back, so UI forms and `resolveConfig` only ever see the bare key.
|
|
1964
|
-
*
|
|
1965
|
-
* Fields opt in via the `perNode: true` schema marker on `ConfigFieldBase`
|
|
1966
|
-
* (`interfaces/config-ui.ts`); `BaseAddon` derives the key set from the
|
|
1967
|
-
* schema and routes reads/writes through these helpers.
|
|
1968
|
-
*
|
|
1969
|
-
* ## No bare-key fallback — deliberate
|
|
1970
|
-
*
|
|
1971
|
-
* {@link readNodeValue} reads the node-scoped key ONLY. A node with no
|
|
1972
|
-
* scoped key resolves to `undefined` so the field's schema `default` wins —
|
|
1973
|
-
* NEVER `store[base]` and never another node's value. A bare legacy key in
|
|
1974
|
-
* the store is invisible to every node, hub included, so one node's
|
|
1975
|
-
* selection can never leak onto another. (This generalizes the
|
|
1976
|
-
* `decoder-backend-keys.ts` semantics — the no-fallback variant — over an
|
|
1977
|
-
* arbitrary set of per-node field keys.)
|
|
1978
|
-
*
|
|
1979
|
-
* Pure functions only — no I/O, no imports beyond the language. This is a
|
|
1980
|
-
* LEAF module: import it via its deep path, never from the root barrel.
|
|
1981
|
-
*/
|
|
1982
|
-
/**
|
|
1983
|
-
* Normalize a raw kernel node id to the bare node id used for scoping.
|
|
1984
|
-
* `localNodeId` can carry a `<node>/<addon>` suffix on forked child
|
|
1985
|
-
* processes; per-node settings are per-NODE, so strip the addon segment.
|
|
1986
|
-
* `undefined` / `null` / empty falls back to `'hub'`.
|
|
1987
|
-
*/
|
|
1988
|
-
function normalizeNodeId(raw) {
|
|
1989
|
-
if (raw === void 0 || raw === null || raw === "") return "hub";
|
|
1990
|
-
const slashIdx = raw.indexOf("/");
|
|
1991
|
-
if (slashIdx < 0) return raw;
|
|
1992
|
-
const bare = raw.slice(0, slashIdx);
|
|
1993
|
-
return bare === "" ? "hub" : bare;
|
|
1994
|
-
}
|
|
1995
|
-
/** The node-scoped store key for a per-node field: `<base>@<nodeId>`. */
|
|
1996
|
-
function nodeScopedKey(base, nodeId) {
|
|
1997
|
-
return `${base}@${normalizeNodeId(nodeId)}`;
|
|
1998
|
-
}
|
|
1999
|
-
/**
|
|
2000
|
-
* Read a node's value for a per-node field from the raw shared store:
|
|
2001
|
-
* the node-scoped key when present, otherwise `undefined`.
|
|
2002
|
-
* Deliberately NO bare-key fallback (see module doc) — the caller lets the
|
|
2003
|
-
* schema `default` win on `undefined`.
|
|
2004
|
-
*/
|
|
2005
|
-
function readNodeValue(store, base, nodeId) {
|
|
2006
|
-
return store[nodeScopedKey(base, nodeId)];
|
|
2007
|
-
}
|
|
2008
|
-
/**
|
|
2009
|
-
* Re-map a UI/settings patch so every bare perNode field persists under the
|
|
2010
|
-
* TARGET node's scoped key; all other keys pass through unchanged. Used on
|
|
2011
|
-
* the write path so a save for one node never clobbers another node's value
|
|
2012
|
-
* (and the bare key is never written). Returns a new object — the input
|
|
2013
|
-
* patch is not mutated.
|
|
2014
|
-
*/
|
|
2015
|
-
function scopePatch(patch, perNodeKeys, nodeId) {
|
|
2016
|
-
const out = {};
|
|
2017
|
-
for (const [key, value] of Object.entries(patch)) out[perNodeKeys.has(key) ? nodeScopedKey(key, nodeId) : key] = value;
|
|
2018
|
-
return out;
|
|
2019
|
-
}
|
|
2020
|
-
/**
|
|
2021
|
-
* Project the raw shared store onto the bare schema keys for ONE node so a
|
|
2022
|
-
* UI schema (whose field keys are bare) hydrates from that node's own
|
|
2023
|
-
* values:
|
|
2024
|
-
*
|
|
2025
|
-
* - EVERY `@`-scoped key (any node's) is dropped from the pass-through.
|
|
2026
|
-
* - Every bare perNode key is dropped from the pass-through (a stray bare
|
|
2027
|
-
* legacy key must never hydrate any node — no bare fallback).
|
|
2028
|
-
* - THIS node's effective value ({@link readNodeValue}) is then laid onto
|
|
2029
|
-
* each bare perNode key; when the node has no scoped key the bare key is
|
|
2030
|
-
* left ABSENT so the field's schema `default` wins.
|
|
2031
|
-
*
|
|
2032
|
-
* Returns a new object — the input store is not mutated.
|
|
2033
|
-
*/
|
|
2034
|
-
function projectStore(store, perNodeKeys, nodeId) {
|
|
2035
|
-
const out = {};
|
|
2036
|
-
for (const [key, value] of Object.entries(store)) {
|
|
2037
|
-
if (key.includes("@")) continue;
|
|
2038
|
-
if (perNodeKeys.has(key)) continue;
|
|
2039
|
-
out[key] = value;
|
|
1946
|
+
var PREFIX = "records/";
|
|
1947
|
+
/** The base of every records failure. `detail` is the human part of the message. */
|
|
1948
|
+
var RecordsError = class extends Error {
|
|
1949
|
+
code;
|
|
1950
|
+
detail;
|
|
1951
|
+
constructor(code, detail) {
|
|
1952
|
+
super(`${PREFIX}${code}: ${detail}`);
|
|
1953
|
+
this.name = "RecordsError";
|
|
1954
|
+
this.code = code;
|
|
1955
|
+
this.detail = detail;
|
|
2040
1956
|
}
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
1957
|
+
};
|
|
1958
|
+
/** A write guarded by `ifRev` found another revision (or an existing row for `ifRev: 0`). */
|
|
1959
|
+
var RevConflictError = class extends RecordsError {
|
|
1960
|
+
constructor(detail) {
|
|
1961
|
+
super("rev-conflict", detail);
|
|
1962
|
+
this.name = "RevConflictError";
|
|
2044
1963
|
}
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
1964
|
+
};
|
|
1965
|
+
/** `data` exceeds the kind's `maxDataBytes`. Bytes are never record fields (D613). */
|
|
1966
|
+
var RecordTooLargeError = class extends RecordsError {
|
|
1967
|
+
constructor(detail) {
|
|
1968
|
+
super("too-large", detail);
|
|
1969
|
+
this.name = "RecordTooLargeError";
|
|
1970
|
+
}
|
|
1971
|
+
};
|
|
1972
|
+
/** A filter, order or aggregate names a field no declared index serves. */
|
|
1973
|
+
var UnindexedFilterError = class extends RecordsError {
|
|
1974
|
+
constructor(detail) {
|
|
1975
|
+
super("unindexed-filter", detail);
|
|
1976
|
+
this.name = "UnindexedFilterError";
|
|
1977
|
+
}
|
|
1978
|
+
};
|
|
1979
|
+
/** A bulk delete with no predicate at all. */
|
|
1980
|
+
var FilterRequiredError = class extends RecordsError {
|
|
1981
|
+
constructor(detail) {
|
|
1982
|
+
super("filter-required", detail);
|
|
1983
|
+
this.name = "FilterRequiredError";
|
|
1984
|
+
}
|
|
1985
|
+
};
|
|
1986
|
+
/** The caller declared no such kind (another addon's kind is indistinguishable from none). */
|
|
1987
|
+
var UnknownRecordKindError = class extends RecordsError {
|
|
1988
|
+
constructor(detail) {
|
|
1989
|
+
super("unknown-kind", detail);
|
|
1990
|
+
this.name = "UnknownRecordKindError";
|
|
1991
|
+
}
|
|
1992
|
+
};
|
|
1993
|
+
var RecordNotFoundError = class extends RecordsError {
|
|
1994
|
+
constructor(detail) {
|
|
1995
|
+
super("not-found", detail);
|
|
1996
|
+
this.name = "RecordNotFoundError";
|
|
1997
|
+
}
|
|
1998
|
+
};
|
|
1999
|
+
/** A unique index refused the write. */
|
|
2000
|
+
var RecordUniqueViolationError = class extends RecordsError {
|
|
2001
|
+
constructor(detail) {
|
|
2002
|
+
super("unique-violation", detail);
|
|
2003
|
+
this.name = "RecordUniqueViolationError";
|
|
2004
|
+
}
|
|
2005
|
+
};
|
|
2006
|
+
/** A secret field held a plain string where only a keychain marker may be stored. */
|
|
2007
|
+
var PlaintextSecretError = class extends RecordsError {
|
|
2008
|
+
constructor(detail) {
|
|
2009
|
+
super("plaintext-secret", detail);
|
|
2010
|
+
this.name = "PlaintextSecretError";
|
|
2011
|
+
}
|
|
2012
|
+
};
|
|
2013
|
+
/** A marker whose ref is not the row's own (the D878 rule). */
|
|
2014
|
+
var ForeignSecretMarkerError = class extends RecordsError {
|
|
2015
|
+
constructor(detail) {
|
|
2016
|
+
super("foreign-marker", detail);
|
|
2017
|
+
this.name = "ForeignSecretMarkerError";
|
|
2018
|
+
}
|
|
2019
|
+
};
|
|
2020
|
+
/** The keychain could not store or serve a value: explicit, never an empty string. */
|
|
2021
|
+
var RecordSecretUnavailableError = class extends RecordsError {
|
|
2022
|
+
constructor(detail) {
|
|
2023
|
+
super("secret-unavailable", detail);
|
|
2024
|
+
this.name = "RecordSecretUnavailableError";
|
|
2025
|
+
}
|
|
2026
|
+
};
|
|
2027
|
+
var InvalidRecordError = class extends RecordsError {
|
|
2028
|
+
constructor(detail) {
|
|
2029
|
+
super("invalid-record", detail);
|
|
2030
|
+
this.name = "InvalidRecordError";
|
|
2031
|
+
}
|
|
2032
|
+
};
|
|
2033
|
+
/** A kind declaration the engine refuses (non-additive change, bad shape, wrong file). */
|
|
2034
|
+
var DeclarationRefusedError = class extends RecordsError {
|
|
2035
|
+
constructor(detail) {
|
|
2036
|
+
super("declaration-refused", detail);
|
|
2037
|
+
this.name = "DeclarationRefusedError";
|
|
2038
|
+
}
|
|
2039
|
+
};
|
|
2040
|
+
var NoCallerError = class extends RecordsError {
|
|
2041
|
+
constructor(detail) {
|
|
2042
|
+
super("no-caller", detail);
|
|
2043
|
+
this.name = "NoCallerError";
|
|
2044
|
+
}
|
|
2045
|
+
};
|
|
2046
|
+
var BatchTooLargeError = class extends RecordsError {
|
|
2047
|
+
constructor(detail) {
|
|
2048
|
+
super("batch-too-large", detail);
|
|
2049
|
+
this.name = "BatchTooLargeError";
|
|
2050
|
+
}
|
|
2051
|
+
};
|
|
2053
2052
|
/**
|
|
2054
|
-
*
|
|
2055
|
-
*
|
|
2056
|
-
* (
|
|
2053
|
+
* A `transact` the engine refuses before touching a row: an op on a kind the
|
|
2054
|
+
* caller did not declare in ONE file and ONE `transactFamily`. The detail names
|
|
2055
|
+
* which rule (`cross-file`, `cross-family`, `no-family`); it is never a silent split.
|
|
2057
2056
|
*/
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2057
|
+
var TransactRefusedError = class extends RecordsError {
|
|
2058
|
+
constructor(detail) {
|
|
2059
|
+
super("transact-refused", detail);
|
|
2060
|
+
this.name = "TransactRefusedError";
|
|
2061
|
+
}
|
|
2062
|
+
};
|
|
2063
|
+
function linkTargetOf(meta) {
|
|
2064
|
+
if (typeof meta !== "object" || meta === null) return void 0;
|
|
2065
|
+
const link = Reflect.get(meta, "link");
|
|
2066
|
+
const parsed = LinkTargetSchema.safeParse(link);
|
|
2067
|
+
return parsed.success ? parsed.data : void 0;
|
|
2068
|
+
}
|
|
2069
|
+
var LinkTargetSchema = zod.z.object({
|
|
2070
|
+
cap: zod.z.string().min(1),
|
|
2071
|
+
kind: zod.z.string().min(1).optional()
|
|
2072
|
+
});
|
|
2073
|
+
/** The links a kind declares, read from the meta of its body fields. */
|
|
2074
|
+
function linksOfKind(kind) {
|
|
2075
|
+
const schema = kind.schema;
|
|
2076
|
+
if (!(schema instanceof zod.z.ZodObject)) return [];
|
|
2077
|
+
const links = [];
|
|
2078
|
+
for (const [field, fieldSchema] of Object.entries(schema.shape)) {
|
|
2079
|
+
const to = linkTargetOf(zod.z.globalRegistry.get(fieldSchema));
|
|
2080
|
+
if (to !== void 0) links.push({
|
|
2081
|
+
field,
|
|
2082
|
+
to
|
|
2083
|
+
});
|
|
2084
|
+
}
|
|
2085
|
+
return links;
|
|
2063
2086
|
}
|
|
2064
2087
|
/**
|
|
2065
2088
|
* The address of one keychain value: `secret://<owner>/<scope>/<fieldPath>`.
|
|
@@ -2195,6 +2218,668 @@ function parseSecretRef(ref) {
|
|
|
2195
2218
|
fieldPath
|
|
2196
2219
|
};
|
|
2197
2220
|
}
|
|
2221
|
+
/** Limits and names of `ctx.records` (D881). One authority; the engine and the facade read it. */
|
|
2222
|
+
/** The files a kind may live in. `history` is device-history's (D850), never records. */
|
|
2223
|
+
var RECORD_DATABASES = ["settings", "events"];
|
|
2224
|
+
/** The classes of a kind: the `@durable` vocabulary, one authority (replaces the annotation). */
|
|
2225
|
+
var RECORD_CLASSES = [
|
|
2226
|
+
"config",
|
|
2227
|
+
"ledger",
|
|
2228
|
+
"audit",
|
|
2229
|
+
"mirror",
|
|
2230
|
+
"ephemeral"
|
|
2231
|
+
];
|
|
2232
|
+
var RECORD_DEFAULT_MAX_DATA_BYTES = 64 * 1024;
|
|
2233
|
+
var RECORD_MAX_DATA_BYTES = 1024 * 1024;
|
|
2234
|
+
var RECORD_BATCH_MAX = 1e3;
|
|
2235
|
+
var RECORD_BATCH_MAX_BYTES = 4 * 1024 * 1024;
|
|
2236
|
+
var RECORD_QUERY_MAX = 1e3;
|
|
2237
|
+
/** Rows one DELETE statement removes before the serving thread yields. */
|
|
2238
|
+
var RECORD_DELETE_BATCH = 5e3;
|
|
2239
|
+
/** A kind in the `settings` file may not bound itself above this (D447: high volume is `events`). */
|
|
2240
|
+
var RECORD_SETTINGS_MAX_ROWS = 5e4;
|
|
2241
|
+
/** The engine's TTL sweep cadence. */
|
|
2242
|
+
var RECORD_SWEEP_INTERVAL_MS = 10 * 6e4;
|
|
2243
|
+
/** The `Column`-free proof prefix: a ref collection for a kind's secret fields. */
|
|
2244
|
+
var RECORD_SECRET_COLLECTION_PREFIX = "records:";
|
|
2245
|
+
/**
|
|
2246
|
+
* Secret fields of a record, addressed the way a Zod schema declares them
|
|
2247
|
+
* (`collectZodSecretPaths`): dotted keys, `[]` for "each element of this array"
|
|
2248
|
+
* (`auth.accessToken`, `headers[].value`).
|
|
2249
|
+
*
|
|
2250
|
+
* `{}` after a key means "each value of this map" (`applianceSecrets{}`): the map's own key
|
|
2251
|
+
* names the value (`applianceSecrets{fridge}`), so no id key is declared and a body that drops a
|
|
2252
|
+
* key releases exactly that key's secret.
|
|
2253
|
+
*
|
|
2254
|
+
* Array elements are matched by a DECLARED id key (`secretArrayKeys`:
|
|
2255
|
+
* `{ headers: 'name' }`), never by index, so reordering a list keeps every
|
|
2256
|
+
* keychain ref (the same rule as `arrayItemFieldPath`). The concrete path of a
|
|
2257
|
+
* leaf names its element: `headers[X-Api].value`.
|
|
2258
|
+
*
|
|
2259
|
+
* Pure and browser-safe. Nothing here mutates: every transform returns a new value.
|
|
2260
|
+
*/
|
|
2261
|
+
/** The array prefixes (declared form, e.g. `headers` or `a.headers`) of a path. */
|
|
2262
|
+
function parseSecretPath(path) {
|
|
2263
|
+
if (path.length === 0) throw new InvalidRecordError("an empty secret path");
|
|
2264
|
+
return path.split(".").map((raw) => {
|
|
2265
|
+
const each = raw.endsWith("[]");
|
|
2266
|
+
const map = raw.endsWith("{}");
|
|
2267
|
+
const key = each || map ? raw.slice(0, -2) : raw;
|
|
2268
|
+
if (key.length === 0) throw new InvalidRecordError(`secret path "${path}" has an empty segment`);
|
|
2269
|
+
return {
|
|
2270
|
+
key,
|
|
2271
|
+
each,
|
|
2272
|
+
map
|
|
2273
|
+
};
|
|
2274
|
+
});
|
|
2275
|
+
}
|
|
2276
|
+
/** The declared array prefixes of `path` that need an id key (`headers`, `a.rows`). */
|
|
2277
|
+
function secretArrayPrefixes(path) {
|
|
2278
|
+
const segments = parseSecretPath(path);
|
|
2279
|
+
const prefixes = [];
|
|
2280
|
+
const walked = [];
|
|
2281
|
+
for (const segment of segments) {
|
|
2282
|
+
walked.push(segment.key);
|
|
2283
|
+
if (segment.each) prefixes.push(walked.join("."));
|
|
2284
|
+
}
|
|
2285
|
+
return prefixes;
|
|
2286
|
+
}
|
|
2287
|
+
function isRecord$6(value) {
|
|
2288
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
2289
|
+
}
|
|
2290
|
+
function elementId(element, idKey, declared, prefix) {
|
|
2291
|
+
const id = isRecord$6(element) ? element[idKey] : void 0;
|
|
2292
|
+
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`);
|
|
2293
|
+
return id;
|
|
2294
|
+
}
|
|
2295
|
+
/**
|
|
2296
|
+
* Visit every secret leaf PRESENT in `data` (an absent branch has nothing to
|
|
2297
|
+
* visit). `replace` returns the new leaf value, or {@link REMOVE_LEAF}; the
|
|
2298
|
+
* result is a new body, `data` is untouched.
|
|
2299
|
+
*/
|
|
2300
|
+
var REMOVE_LEAF = Symbol("remove-leaf");
|
|
2301
|
+
function mapAt(node, segments, index, walkedKeys, concretePrefix, declared, arrayKeys, visit) {
|
|
2302
|
+
if (!isRecord$6(node)) return node;
|
|
2303
|
+
const segment = segments[index];
|
|
2304
|
+
if (segment === void 0) return node;
|
|
2305
|
+
if (!Object.prototype.hasOwnProperty.call(node, segment.key)) return node;
|
|
2306
|
+
const child = node[segment.key];
|
|
2307
|
+
const keys = [...walkedKeys, segment.key];
|
|
2308
|
+
const last = index === segments.length - 1;
|
|
2309
|
+
if (segment.each) {
|
|
2310
|
+
if (!Array.isArray(child)) return node;
|
|
2311
|
+
const prefix = keys.join(".");
|
|
2312
|
+
const idKey = arrayKeys[prefix];
|
|
2313
|
+
if (idKey === void 0) throw new InvalidRecordError(`"${declared}": no id key declared for the array "${prefix}"`);
|
|
2314
|
+
const mapped = child.map((element) => {
|
|
2315
|
+
const id = elementId(element, idKey, declared, prefix);
|
|
2316
|
+
const concrete = `${concretePrefix}${concretePrefix.length > 0 ? "." : ""}${segment.key}[${encodeURIComponent(id)}]`;
|
|
2317
|
+
return last ? element : mapAt(element, segments, index + 1, keys, concrete, declared, arrayKeys, visit);
|
|
2318
|
+
});
|
|
2319
|
+
return {
|
|
2320
|
+
...node,
|
|
2321
|
+
[segment.key]: mapped
|
|
2322
|
+
};
|
|
2323
|
+
}
|
|
2324
|
+
if (segment.map) {
|
|
2325
|
+
if (!isRecord$6(child)) return node;
|
|
2326
|
+
const kept = Object.entries(child).map(([mapKey, value]) => {
|
|
2327
|
+
const concrete = `${concretePrefix}${concretePrefix.length > 0 ? "." : ""}${segment.key}{${encodeURIComponent(mapKey)}}`;
|
|
2328
|
+
if (!last) return [mapKey, mapAt(value, segments, index + 1, keys, concrete, declared, arrayKeys, visit)];
|
|
2329
|
+
return [mapKey, visit({
|
|
2330
|
+
declared,
|
|
2331
|
+
concrete,
|
|
2332
|
+
value
|
|
2333
|
+
})];
|
|
2334
|
+
}).filter(([, value]) => value !== REMOVE_LEAF);
|
|
2335
|
+
return {
|
|
2336
|
+
...node,
|
|
2337
|
+
[segment.key]: Object.fromEntries(kept)
|
|
2338
|
+
};
|
|
2339
|
+
}
|
|
2340
|
+
const concrete = `${concretePrefix}${concretePrefix.length > 0 ? "." : ""}${segment.key}`;
|
|
2341
|
+
if (last) {
|
|
2342
|
+
const replacement = visit({
|
|
2343
|
+
declared,
|
|
2344
|
+
concrete,
|
|
2345
|
+
value: child
|
|
2346
|
+
});
|
|
2347
|
+
if (replacement === REMOVE_LEAF) return Object.fromEntries(Object.entries(node).filter(([key]) => key !== segment.key));
|
|
2348
|
+
return {
|
|
2349
|
+
...node,
|
|
2350
|
+
[segment.key]: replacement
|
|
2351
|
+
};
|
|
2352
|
+
}
|
|
2353
|
+
return {
|
|
2354
|
+
...node,
|
|
2355
|
+
[segment.key]: mapAt(child, segments, index + 1, keys, concrete, declared, arrayKeys, visit)
|
|
2356
|
+
};
|
|
2357
|
+
}
|
|
2358
|
+
/** Replace/remove every present secret leaf; returns a NEW body. */
|
|
2359
|
+
function mapSecretLeaves(data, paths, arrayKeys, visit) {
|
|
2360
|
+
let current = data;
|
|
2361
|
+
for (const declared of paths) current = mapAt(current, parseSecretPath(declared), 0, [], "", declared, arrayKeys, visit);
|
|
2362
|
+
return current;
|
|
2363
|
+
}
|
|
2364
|
+
/** Every present secret leaf, read-only. */
|
|
2365
|
+
function collectSecretLeaves(data, paths, arrayKeys) {
|
|
2366
|
+
const found = [];
|
|
2367
|
+
mapSecretLeaves(data, paths, arrayKeys, (leaf) => {
|
|
2368
|
+
found.push(leaf);
|
|
2369
|
+
return leaf.value;
|
|
2370
|
+
});
|
|
2371
|
+
return found;
|
|
2372
|
+
}
|
|
2373
|
+
/**
|
|
2374
|
+
* The keychain collection name a kind's secrets live under. Prefixed so a
|
|
2375
|
+
* record's refs never collide with the refs a legacy collection of the same name
|
|
2376
|
+
* already holds during an adoption.
|
|
2377
|
+
*/
|
|
2378
|
+
function recordSecretCollection(kind) {
|
|
2379
|
+
return `${RECORD_SECRET_COLLECTION_PREFIX}${kind}`;
|
|
2380
|
+
}
|
|
2381
|
+
/** The ONE ref a row's secret field may carry: the engine and the facade both build it here. */
|
|
2382
|
+
function recordSecretRef(owner, kind, rowId, concretePath) {
|
|
2383
|
+
return buildSecretRef({
|
|
2384
|
+
owner,
|
|
2385
|
+
scope: {
|
|
2386
|
+
kind: "row",
|
|
2387
|
+
collection: recordSecretCollection(kind),
|
|
2388
|
+
rowId
|
|
2389
|
+
},
|
|
2390
|
+
fieldPath: concretePath
|
|
2391
|
+
});
|
|
2392
|
+
}
|
|
2393
|
+
/**
|
|
2394
|
+
* A stored secret, as an admin read shows it: a VIEW naming the row's own
|
|
2395
|
+
* keychain ref (`set: true`), never the value and no longer the bare redaction
|
|
2396
|
+
* token. The form hands it to the secret field, which reveals the value by ref
|
|
2397
|
+
* through the audited `keychain-admin.reveal`; sent back untouched it keeps the
|
|
2398
|
+
* stored secret (the records door reads a view as KEEP).
|
|
2399
|
+
*
|
|
2400
|
+
* ONE implementation for the entries service and for every addon that serves
|
|
2401
|
+
* its own instances (`RecordIntegrationInstances`).
|
|
2402
|
+
*/
|
|
2403
|
+
function isRecord$5(value) {
|
|
2404
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
2405
|
+
}
|
|
2406
|
+
function secretViewsOf(owner, kind, id, decl, data) {
|
|
2407
|
+
if (decl.secretPaths.length === 0) return data;
|
|
2408
|
+
const shown = mapSecretLeaves(data, decl.secretPaths, decl.secretArrayKeys, (leaf) => {
|
|
2409
|
+
if (leaf.value !== "__camstack_redacted__") return leaf.value;
|
|
2410
|
+
return {
|
|
2411
|
+
$secret: recordSecretRef(owner, kind, id, leaf.concrete),
|
|
2412
|
+
v: 1,
|
|
2413
|
+
set: true
|
|
2414
|
+
};
|
|
2415
|
+
});
|
|
2416
|
+
return isRecord$5(shown) ? shown : data;
|
|
2417
|
+
}
|
|
2418
|
+
/** The most instances one addon lists (an integrations page, not a table). */
|
|
2419
|
+
var INSTANCES_LIST_MAX = 1e3;
|
|
2420
|
+
/**
|
|
2421
|
+
* The ONE reader of an instance's switch (D996): an absent field means on, so a row written
|
|
2422
|
+
* before the field existed needs no migration. Every consumer of an instance body asks this.
|
|
2423
|
+
*/
|
|
2424
|
+
function isInstanceEnabled(body) {
|
|
2425
|
+
return body.enabled !== false;
|
|
2426
|
+
}
|
|
2427
|
+
/** The body key of the switch; only {@link RecordIntegrationInstances.setInstanceEnabled} writes it. */
|
|
2428
|
+
var SWITCH_KEY = "enabled";
|
|
2429
|
+
/** The keys of the kind's secret fields that sit at the top level of the body. */
|
|
2430
|
+
function topLevelSecretKeys(paths) {
|
|
2431
|
+
return new Set(paths.filter((p) => !p.includes(".") && !p.includes("[") && !p.includes("{")));
|
|
2432
|
+
}
|
|
2433
|
+
/** The keys of the kind's top-level MAPS whose values are secrets (`applianceSecrets{}`). */
|
|
2434
|
+
function secretMapKeys(paths) {
|
|
2435
|
+
return new Set(paths.filter((p) => p.endsWith("{}") && !p.slice(0, -2).match(/[.[{]/)).map((p) => p.slice(0, -2)));
|
|
2436
|
+
}
|
|
2437
|
+
/**
|
|
2438
|
+
* A patch value for a map of secrets: an entry that is omitted, `''`, the redaction token or the
|
|
2439
|
+
* view the form was given KEEPS its stored secret (it is left out of the merge); `{ $secretClear }`
|
|
2440
|
+
* or `null` removes the entry; any other string replaces it. Null when nothing is left to merge.
|
|
2441
|
+
*/
|
|
2442
|
+
function secretMapPatch(value) {
|
|
2443
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) return null;
|
|
2444
|
+
const out = {};
|
|
2445
|
+
for (const [key, entry] of Object.entries(value)) if (entry === null || isSecretClear(entry)) out[key] = null;
|
|
2446
|
+
else if (typeof entry === "string" && entry !== "" && entry !== "__camstack_redacted__" && !isSecretFieldView(entry)) out[key] = entry;
|
|
2447
|
+
return Object.keys(out).length > 0 ? out : null;
|
|
2448
|
+
}
|
|
2449
|
+
var RecordIntegrationInstances = class {
|
|
2450
|
+
records;
|
|
2451
|
+
kind;
|
|
2452
|
+
hooks;
|
|
2453
|
+
handle;
|
|
2454
|
+
secretKeys;
|
|
2455
|
+
secretMaps;
|
|
2456
|
+
nameField;
|
|
2457
|
+
switchListeners = /* @__PURE__ */ new Set();
|
|
2458
|
+
constructor(records, kind, hooks) {
|
|
2459
|
+
this.records = records;
|
|
2460
|
+
this.kind = kind;
|
|
2461
|
+
this.hooks = hooks;
|
|
2462
|
+
this.handle = records.kind(kind);
|
|
2463
|
+
this.secretKeys = topLevelSecretKeys(kind.declaration.secretPaths);
|
|
2464
|
+
this.secretMaps = secretMapKeys(kind.declaration.secretPaths);
|
|
2465
|
+
this.nameField = kind.declaration.entry?.nameField ?? "name";
|
|
2466
|
+
}
|
|
2467
|
+
/**
|
|
2468
|
+
* One instance read for the addon's own runtime; null when absent. When the keychain is
|
|
2469
|
+
* locked the row is served WITHOUT its secrets and says so (`secrets: 'unavailable'`), so the
|
|
2470
|
+
* caller can keep what it had instead of reconfiguring with an empty secret (D49).
|
|
2471
|
+
*/
|
|
2472
|
+
async readResolved(id) {
|
|
2473
|
+
try {
|
|
2474
|
+
const record = await this.handle.getResolved(id);
|
|
2475
|
+
return record === null ? null : {
|
|
2476
|
+
id,
|
|
2477
|
+
body: record.data,
|
|
2478
|
+
enabled: isInstanceEnabled(record.data),
|
|
2479
|
+
secrets: "resolved"
|
|
2480
|
+
};
|
|
2481
|
+
} catch (err) {
|
|
2482
|
+
if (!(err instanceof RecordSecretUnavailableError)) throw err;
|
|
2483
|
+
const stored = await this.handle.get(id);
|
|
2484
|
+
if (stored === null) return null;
|
|
2485
|
+
return {
|
|
2486
|
+
id,
|
|
2487
|
+
body: Object.fromEntries(Object.entries(stored.data).filter(([key]) => !this.secretKeys.has(key))),
|
|
2488
|
+
enabled: isInstanceEnabled(stored.data),
|
|
2489
|
+
secrets: "unavailable"
|
|
2490
|
+
};
|
|
2491
|
+
}
|
|
2492
|
+
}
|
|
2493
|
+
/** The body of {@link readResolved} alone; a locked keychain yields the row without secrets. */
|
|
2494
|
+
async getResolved(id) {
|
|
2495
|
+
return (await this.readResolved(id))?.body ?? null;
|
|
2496
|
+
}
|
|
2497
|
+
/** Every instance, secrets resolved where the keychain allows; an absent one is skipped. */
|
|
2498
|
+
async listResolved() {
|
|
2499
|
+
const page = await this.handle.query({ limit: INSTANCES_LIST_MAX });
|
|
2500
|
+
const out = [];
|
|
2501
|
+
for (const record of page.records) {
|
|
2502
|
+
const read = await this.readResolved(record.id);
|
|
2503
|
+
if (read !== null) out.push(read);
|
|
2504
|
+
}
|
|
2505
|
+
return out;
|
|
2506
|
+
}
|
|
2507
|
+
viewOf(record) {
|
|
2508
|
+
const shown = secretViewsOf(this.records.owner, this.kind.name, record.id, this.kind.declaration, record.data);
|
|
2509
|
+
const rawName = record.data[this.nameField];
|
|
2510
|
+
const kind = this.hooks.kindOf?.(record.data);
|
|
2511
|
+
const health = this.hooks.health?.(record.data, record.id);
|
|
2512
|
+
return {
|
|
2513
|
+
id: record.id,
|
|
2514
|
+
name: typeof rawName === "string" ? rawName : record.id,
|
|
2515
|
+
configured: this.hooks.configured(record.data),
|
|
2516
|
+
enabled: isInstanceEnabled(record.data),
|
|
2517
|
+
formValues: shown,
|
|
2518
|
+
...kind !== void 0 ? { kind } : {},
|
|
2519
|
+
...health?.status !== void 0 ? { status: health.status } : {},
|
|
2520
|
+
...health?.lastCheckedAt !== void 0 ? { lastCheckedAt: health.lastCheckedAt } : {}
|
|
2521
|
+
};
|
|
2522
|
+
}
|
|
2523
|
+
describe = async () => {
|
|
2524
|
+
const declared = linksOfKind(this.kind);
|
|
2525
|
+
const links = this.hooks.description.links !== void 0 || declared.length === 0 ? {} : { links: declared.map((link) => ({
|
|
2526
|
+
kind: this.kind.name,
|
|
2527
|
+
field: link.field,
|
|
2528
|
+
to: link.to
|
|
2529
|
+
})) };
|
|
2530
|
+
return {
|
|
2531
|
+
...this.hooks.description,
|
|
2532
|
+
...links,
|
|
2533
|
+
...this.hooks.mintId === void 0 ? {} : { mintsId: true }
|
|
2534
|
+
};
|
|
2535
|
+
};
|
|
2536
|
+
instanceFormSchema = async ({ id }) => this.hooks.formSchema(id);
|
|
2537
|
+
listInstances = async () => {
|
|
2538
|
+
return (await this.handle.query({ limit: INSTANCES_LIST_MAX })).records.map((record) => this.viewOf(record));
|
|
2539
|
+
};
|
|
2540
|
+
getInstance = async ({ id }) => {
|
|
2541
|
+
const record = await this.handle.get(id);
|
|
2542
|
+
return record === null ? null : this.viewOf(record);
|
|
2543
|
+
};
|
|
2544
|
+
/** Insert ONE row (`ifRev: 0`: an existing id is refused, never overwritten). */
|
|
2545
|
+
createInstance = async ({ id, name, kind, values }) => {
|
|
2546
|
+
const minted = id ?? this.hooks.mintId?.({
|
|
2547
|
+
name,
|
|
2548
|
+
...kind !== void 0 ? { kind } : {}
|
|
2549
|
+
});
|
|
2550
|
+
if (minted === void 0) throw new Error("createInstance needs an id: this provider does not mint one");
|
|
2551
|
+
await this.handle.put({
|
|
2552
|
+
id: minted,
|
|
2553
|
+
data: this.hooks.initialBody(name, kind)
|
|
2554
|
+
}, { ifRev: 0 });
|
|
2555
|
+
const patch = this.patchOf(values ?? {});
|
|
2556
|
+
if (Object.keys(patch).length > 0) await this.handle.patch(minted, patch);
|
|
2557
|
+
await this.hooks.onChanged?.(minted, "created");
|
|
2558
|
+
return { id: minted };
|
|
2559
|
+
};
|
|
2560
|
+
updateInstance = async ({ id, name, values }) => {
|
|
2561
|
+
const patch = this.patchOf(values);
|
|
2562
|
+
if (name !== void 0) patch[this.nameField] = name;
|
|
2563
|
+
await this.handle.patch(id, patch);
|
|
2564
|
+
await this.hooks.onChanged?.(id, "updated");
|
|
2565
|
+
return { ok: true };
|
|
2566
|
+
};
|
|
2567
|
+
/** The record patch a form `values` object means: secrets kept, cleared or replaced. */
|
|
2568
|
+
patchOf(values) {
|
|
2569
|
+
const patch = {};
|
|
2570
|
+
for (const [key, value] of Object.entries(values)) {
|
|
2571
|
+
if (value === void 0) continue;
|
|
2572
|
+
if (key === "enabled") continue;
|
|
2573
|
+
if (this.secretMaps.has(key)) {
|
|
2574
|
+
const entries = secretMapPatch(value);
|
|
2575
|
+
if (entries !== null) patch[key] = entries;
|
|
2576
|
+
} else if (!this.secretKeys.has(key)) patch[key] = value;
|
|
2577
|
+
else if (isSecretClear(value)) patch[key] = null;
|
|
2578
|
+
else if (typeof value === "string" && value !== "" && value !== "__camstack_redacted__" && !isSecretFieldView(value)) patch[key] = value;
|
|
2579
|
+
}
|
|
2580
|
+
return patch;
|
|
2581
|
+
}
|
|
2582
|
+
/**
|
|
2583
|
+
* Listen to the switch of ANY instance of this helper (in the process that serves it). The
|
|
2584
|
+
* durable replacement of the `integration.enabled` / `integration.disabled` events (D8): the
|
|
2585
|
+
* addon reconciles from the record, whichever way it flipped.
|
|
2586
|
+
*/
|
|
2587
|
+
onSwitched(listener) {
|
|
2588
|
+
this.switchListeners.add(listener);
|
|
2589
|
+
}
|
|
2590
|
+
/**
|
|
2591
|
+
* The ONE writer of the switch (D996, D1014): the record body's `enabled`, for every role. A
|
|
2592
|
+
* configured thing is an instance, so an id with no record yet (a default integration that was
|
|
2593
|
+
* never configured) gets its record from `initialBody` before the switch is written.
|
|
2594
|
+
*/
|
|
2595
|
+
setInstanceEnabled = async ({ id, enabled }) => {
|
|
2596
|
+
if (await this.handle.get(id) === null) await this.handle.put({
|
|
2597
|
+
id,
|
|
2598
|
+
data: this.hooks.initialBody(id)
|
|
2599
|
+
}, { ifRev: 0 });
|
|
2600
|
+
await this.handle.patch(id, { [SWITCH_KEY]: enabled });
|
|
2601
|
+
await this.hooks.onChanged?.(id, "enabled");
|
|
2602
|
+
for (const listener of this.switchListeners) await listener(id, enabled);
|
|
2603
|
+
return { ok: true };
|
|
2604
|
+
};
|
|
2605
|
+
/** The row and its keychain refs go together (the records door). */
|
|
2606
|
+
deleteInstance = async ({ id }) => {
|
|
2607
|
+
await this.handle.delete(id);
|
|
2608
|
+
await this.hooks.onChanged?.(id, "deleted");
|
|
2609
|
+
return { ok: true };
|
|
2610
|
+
};
|
|
2611
|
+
testInstance = async (input) => {
|
|
2612
|
+
if (this.hooks.test === void 0) return {
|
|
2613
|
+
success: false,
|
|
2614
|
+
status: "unsupported",
|
|
2615
|
+
error: "This integration declares no connection test"
|
|
2616
|
+
};
|
|
2617
|
+
return this.hooks.test(input);
|
|
2618
|
+
};
|
|
2619
|
+
/** The flat provider object to hand to `registerProvider`. */
|
|
2620
|
+
toProvider() {
|
|
2621
|
+
return {
|
|
2622
|
+
describe: this.describe,
|
|
2623
|
+
instanceFormSchema: this.instanceFormSchema,
|
|
2624
|
+
listInstances: this.listInstances,
|
|
2625
|
+
getInstance: this.getInstance,
|
|
2626
|
+
createInstance: this.createInstance,
|
|
2627
|
+
updateInstance: this.updateInstance,
|
|
2628
|
+
setInstanceEnabled: this.setInstanceEnabled,
|
|
2629
|
+
deleteInstance: this.deleteInstance,
|
|
2630
|
+
testInstance: this.testInstance
|
|
2631
|
+
};
|
|
2632
|
+
}
|
|
2633
|
+
};
|
|
2634
|
+
/**
|
|
2635
|
+
* The one-switch migration (epic #440, step 3). An integration's on/off state used to live in the
|
|
2636
|
+
* registry's `enabled` column for a device addon; it now lives only in the instance record's
|
|
2637
|
+
* body (`enabled`, D1007 superseded). This moves a registry `enabled = false` into the body, once.
|
|
2638
|
+
*
|
|
2639
|
+
* For every registry row of the addon that is OFF:
|
|
2640
|
+
* - no record under its id: the record is created from `initialBody(name)` with `enabled: false`
|
|
2641
|
+
* (a default integration that never had settings, Reolink's among them);
|
|
2642
|
+
* - a record whose body states no `enabled`: `enabled: false` is written into it;
|
|
2643
|
+
* - a record that already states `enabled` (either way) is the newer truth and is left alone.
|
|
2644
|
+
* A row that is ON writes nothing: an absent field reads as on. A rerun finds every off row with
|
|
2645
|
+
* a stated switch and does nothing, so nothing switched off comes back on and nothing switched on
|
|
2646
|
+
* goes off. The registry column itself is neither read afterwards nor written; its drop is step 5.
|
|
2647
|
+
*
|
|
2648
|
+
* It runs in the addon process, BEFORE the addon registers its `integration-instances` provider,
|
|
2649
|
+
* which is also why `integrations.list` still answers the stored column at that point.
|
|
2650
|
+
*/
|
|
2651
|
+
function registrySwitchToBodyId(addonId, date) {
|
|
2652
|
+
return `${addonId}/${date}-registry-switch-to-body`;
|
|
2653
|
+
}
|
|
2654
|
+
async function moveRegistrySwitchToBody(ports, spec) {
|
|
2655
|
+
const rows = await ports.listIntegrations(spec.addonId);
|
|
2656
|
+
let created = 0;
|
|
2657
|
+
let switched = 0;
|
|
2658
|
+
let kept = 0;
|
|
2659
|
+
for (const row of rows) {
|
|
2660
|
+
if (row.enabled) continue;
|
|
2661
|
+
const body = await ports.readBody(row.id);
|
|
2662
|
+
if (body === null) {
|
|
2663
|
+
if (await ports.createRecord(row.id, {
|
|
2664
|
+
...spec.initialBody(row.name),
|
|
2665
|
+
["enabled"]: false
|
|
2666
|
+
}) === "created") created += 1;
|
|
2667
|
+
else kept += 1;
|
|
2668
|
+
continue;
|
|
2669
|
+
}
|
|
2670
|
+
if ("enabled" in body) {
|
|
2671
|
+
kept += 1;
|
|
2672
|
+
continue;
|
|
2673
|
+
}
|
|
2674
|
+
await ports.switchOff(row.id);
|
|
2675
|
+
switched += 1;
|
|
2676
|
+
}
|
|
2677
|
+
const summary = {
|
|
2678
|
+
integrations: rows.length,
|
|
2679
|
+
off: rows.filter((r) => !r.enabled).length,
|
|
2680
|
+
created,
|
|
2681
|
+
switched,
|
|
2682
|
+
kept
|
|
2683
|
+
};
|
|
2684
|
+
return created === 0 && switched === 0 ? {
|
|
2685
|
+
outcome: "already-done",
|
|
2686
|
+
summary
|
|
2687
|
+
} : {
|
|
2688
|
+
outcome: "done",
|
|
2689
|
+
summary
|
|
2690
|
+
};
|
|
2691
|
+
}
|
|
2692
|
+
/** A migration entry: an addon states its kind and how a new body starts, nothing else. */
|
|
2693
|
+
function registrySwitchToBodyMigration(spec) {
|
|
2694
|
+
return {
|
|
2695
|
+
meta: {
|
|
2696
|
+
id: registrySwitchToBodyId(spec.addonId, spec.date),
|
|
2697
|
+
owner: spec.addonId,
|
|
2698
|
+
level: "addon-state",
|
|
2699
|
+
seq: spec.seq,
|
|
2700
|
+
dependsOn: [],
|
|
2701
|
+
store: "settings",
|
|
2702
|
+
scope: "cluster",
|
|
2703
|
+
onFailure: "block-owner",
|
|
2704
|
+
bodyKind: "procedure",
|
|
2705
|
+
description: "Move the registry enabled flag of every switched-off integration into its instance record body, creating the record when there is none",
|
|
2706
|
+
fixtureMark: "enabled"
|
|
2707
|
+
},
|
|
2708
|
+
procedure: (ports) => moveRegistrySwitchToBody(ports, {
|
|
2709
|
+
addonId: spec.addonId,
|
|
2710
|
+
initialBody: spec.initialBody
|
|
2711
|
+
})
|
|
2712
|
+
};
|
|
2713
|
+
}
|
|
2714
|
+
/** The hub and records sides of {@link registrySwitchToBodyMigration}. */
|
|
2715
|
+
function registrySwitchPortsOver(deps) {
|
|
2716
|
+
const handle = deps.records.kind({
|
|
2717
|
+
name: deps.kind.name,
|
|
2718
|
+
declaration: deps.kind.declaration,
|
|
2719
|
+
schema: zod.z.record(zod.z.string(), zod.z.unknown())
|
|
2720
|
+
});
|
|
2721
|
+
return {
|
|
2722
|
+
listIntegrations: async (addonId) => (await deps.api.list()).filter((i) => i.addonId === addonId).map((i) => ({
|
|
2723
|
+
id: i.id,
|
|
2724
|
+
name: i.name,
|
|
2725
|
+
enabled: i.enabled !== false
|
|
2726
|
+
})),
|
|
2727
|
+
readBody: async (id) => (await handle.get(id))?.data ?? null,
|
|
2728
|
+
createRecord: async (id, body) => {
|
|
2729
|
+
if (await handle.get(id) !== null) return "exists";
|
|
2730
|
+
await handle.put({
|
|
2731
|
+
id,
|
|
2732
|
+
data: body
|
|
2733
|
+
}, { ifRev: 0 });
|
|
2734
|
+
return "created";
|
|
2735
|
+
},
|
|
2736
|
+
switchOff: async (id) => {
|
|
2737
|
+
await handle.patch(id, { [SWITCH_KEY]: false });
|
|
2738
|
+
}
|
|
2739
|
+
};
|
|
2740
|
+
}
|
|
2741
|
+
/**
|
|
2742
|
+
* Build a {@link DurableState} over a single store key. Transport-agnostic:
|
|
2743
|
+
* `read`/`write` are the addon-store or device-store accessors. The whole
|
|
2744
|
+
* validated value round-trips on every read/write — the schema is the
|
|
2745
|
+
* single source of truth for what is persisted, so no hand-listed field
|
|
2746
|
+
* set can drop a key on save.
|
|
2747
|
+
*/
|
|
2748
|
+
function createDurableState(deps) {
|
|
2749
|
+
const get = async () => {
|
|
2750
|
+
const raw = (await deps.read())[deps.key];
|
|
2751
|
+
if (raw === void 0) return deps.fallback;
|
|
2752
|
+
const parsed = deps.schema.safeParse(raw);
|
|
2753
|
+
if (!parsed.success) {
|
|
2754
|
+
deps.onParseError?.(deps.key, parsed.error);
|
|
2755
|
+
return deps.fallback;
|
|
2756
|
+
}
|
|
2757
|
+
return parsed.data;
|
|
2758
|
+
};
|
|
2759
|
+
const set = async (next) => {
|
|
2760
|
+
const validated = deps.schema.parse(next);
|
|
2761
|
+
await deps.write({ [deps.key]: validated });
|
|
2762
|
+
};
|
|
2763
|
+
const update = async (fn) => {
|
|
2764
|
+
await set(fn(await get()));
|
|
2765
|
+
};
|
|
2766
|
+
return {
|
|
2767
|
+
get,
|
|
2768
|
+
set,
|
|
2769
|
+
update
|
|
2770
|
+
};
|
|
2771
|
+
}
|
|
2772
|
+
/**
|
|
2773
|
+
* Per-node scoping for the shared addon-settings blob.
|
|
2774
|
+
*
|
|
2775
|
+
* An addon's settings store is hub-central (the `addon-settings` cap is
|
|
2776
|
+
* hub-routed — the hub instance answers for every node), so fields whose
|
|
2777
|
+
* value is a NODE fact (decoder backend, engine pick, probed hardware
|
|
2778
|
+
* capabilities) persist under the node-scoped key `<key>@<nodeId>` inside
|
|
2779
|
+
* the single shared blob. The SCHEMA field key stays bare: the write path
|
|
2780
|
+
* ({@link scopePatch}) maps the bare field onto the target node's scoped
|
|
2781
|
+
* key; the read/hydrate path ({@link projectStore}) maps THIS node's value
|
|
2782
|
+
* back, so UI forms and `resolveConfig` only ever see the bare key.
|
|
2783
|
+
*
|
|
2784
|
+
* Fields opt in via the `perNode: true` schema marker on `ConfigFieldBase`
|
|
2785
|
+
* (`interfaces/config-ui.ts`); `BaseAddon` derives the key set from the
|
|
2786
|
+
* schema and routes reads/writes through these helpers.
|
|
2787
|
+
*
|
|
2788
|
+
* ## No bare-key fallback — deliberate
|
|
2789
|
+
*
|
|
2790
|
+
* {@link readNodeValue} reads the node-scoped key ONLY. A node with no
|
|
2791
|
+
* scoped key resolves to `undefined` so the field's schema `default` wins —
|
|
2792
|
+
* NEVER `store[base]` and never another node's value. A bare legacy key in
|
|
2793
|
+
* the store is invisible to every node, hub included, so one node's
|
|
2794
|
+
* selection can never leak onto another. (This generalizes the
|
|
2795
|
+
* `decoder-backend-keys.ts` semantics — the no-fallback variant — over an
|
|
2796
|
+
* arbitrary set of per-node field keys.)
|
|
2797
|
+
*
|
|
2798
|
+
* Pure functions only — no I/O, no imports beyond the language. This is a
|
|
2799
|
+
* LEAF module: import it via its deep path, never from the root barrel.
|
|
2800
|
+
*/
|
|
2801
|
+
/**
|
|
2802
|
+
* Normalize a raw kernel node id to the bare node id used for scoping.
|
|
2803
|
+
* `localNodeId` can carry a `<node>/<addon>` suffix on forked child
|
|
2804
|
+
* processes; per-node settings are per-NODE, so strip the addon segment.
|
|
2805
|
+
* `undefined` / `null` / empty falls back to `'hub'`.
|
|
2806
|
+
*/
|
|
2807
|
+
function normalizeNodeId(raw) {
|
|
2808
|
+
if (raw === void 0 || raw === null || raw === "") return "hub";
|
|
2809
|
+
const slashIdx = raw.indexOf("/");
|
|
2810
|
+
if (slashIdx < 0) return raw;
|
|
2811
|
+
const bare = raw.slice(0, slashIdx);
|
|
2812
|
+
return bare === "" ? "hub" : bare;
|
|
2813
|
+
}
|
|
2814
|
+
/** The node-scoped store key for a per-node field: `<base>@<nodeId>`. */
|
|
2815
|
+
function nodeScopedKey(base, nodeId) {
|
|
2816
|
+
return `${base}@${normalizeNodeId(nodeId)}`;
|
|
2817
|
+
}
|
|
2818
|
+
/**
|
|
2819
|
+
* Read a node's value for a per-node field from the raw shared store:
|
|
2820
|
+
* the node-scoped key when present, otherwise `undefined`.
|
|
2821
|
+
* Deliberately NO bare-key fallback (see module doc) — the caller lets the
|
|
2822
|
+
* schema `default` win on `undefined`.
|
|
2823
|
+
*/
|
|
2824
|
+
function readNodeValue(store, base, nodeId) {
|
|
2825
|
+
return store[nodeScopedKey(base, nodeId)];
|
|
2826
|
+
}
|
|
2827
|
+
/**
|
|
2828
|
+
* Re-map a UI/settings patch so every bare perNode field persists under the
|
|
2829
|
+
* TARGET node's scoped key; all other keys pass through unchanged. Used on
|
|
2830
|
+
* the write path so a save for one node never clobbers another node's value
|
|
2831
|
+
* (and the bare key is never written). Returns a new object — the input
|
|
2832
|
+
* patch is not mutated.
|
|
2833
|
+
*/
|
|
2834
|
+
function scopePatch(patch, perNodeKeys, nodeId) {
|
|
2835
|
+
const out = {};
|
|
2836
|
+
for (const [key, value] of Object.entries(patch)) out[perNodeKeys.has(key) ? nodeScopedKey(key, nodeId) : key] = value;
|
|
2837
|
+
return out;
|
|
2838
|
+
}
|
|
2839
|
+
/**
|
|
2840
|
+
* Project the raw shared store onto the bare schema keys for ONE node so a
|
|
2841
|
+
* UI schema (whose field keys are bare) hydrates from that node's own
|
|
2842
|
+
* values:
|
|
2843
|
+
*
|
|
2844
|
+
* - EVERY `@`-scoped key (any node's) is dropped from the pass-through.
|
|
2845
|
+
* - Every bare perNode key is dropped from the pass-through (a stray bare
|
|
2846
|
+
* legacy key must never hydrate any node — no bare fallback).
|
|
2847
|
+
* - THIS node's effective value ({@link readNodeValue}) is then laid onto
|
|
2848
|
+
* each bare perNode key; when the node has no scoped key the bare key is
|
|
2849
|
+
* left ABSENT so the field's schema `default` wins.
|
|
2850
|
+
*
|
|
2851
|
+
* Returns a new object — the input store is not mutated.
|
|
2852
|
+
*/
|
|
2853
|
+
function projectStore(store, perNodeKeys, nodeId) {
|
|
2854
|
+
const out = {};
|
|
2855
|
+
for (const [key, value] of Object.entries(store)) {
|
|
2856
|
+
if (key.includes("@")) continue;
|
|
2857
|
+
if (perNodeKeys.has(key)) continue;
|
|
2858
|
+
out[key] = value;
|
|
2859
|
+
}
|
|
2860
|
+
for (const base of perNodeKeys) {
|
|
2861
|
+
const value = readNodeValue(store, base, nodeId);
|
|
2862
|
+
if (value !== void 0) out[base] = value;
|
|
2863
|
+
}
|
|
2864
|
+
return out;
|
|
2865
|
+
}
|
|
2866
|
+
/** Every scope, in the order the guard and the docs list them. */
|
|
2867
|
+
var SCOPED_SETTINGS_SCOPES = [
|
|
2868
|
+
"cluster",
|
|
2869
|
+
"device-defaults",
|
|
2870
|
+
"node"
|
|
2871
|
+
];
|
|
2872
|
+
/**
|
|
2873
|
+
* The node id a node-scoped KEY carries: the part after the `@`. `null` for a key with no `@`
|
|
2874
|
+
* (a cluster or fleet-default key) or an empty node id. A schema key never contains `@`
|
|
2875
|
+
* (guard `check-scoped-settings-declared`), so the first `@` is the separator.
|
|
2876
|
+
*/
|
|
2877
|
+
function nodeIdOfScopedKey(key) {
|
|
2878
|
+
const at = key.indexOf("@");
|
|
2879
|
+
if (at <= 0) return null;
|
|
2880
|
+
const nodeId = key.slice(at + 1);
|
|
2881
|
+
return nodeId === "" ? null : nodeId;
|
|
2882
|
+
}
|
|
2198
2883
|
/** A write to a secret path could not be stored in the keychain, so it was refused. */
|
|
2199
2884
|
var KeychainWriteRefusedError = class extends Error {
|
|
2200
2885
|
fieldPath;
|
|
@@ -2205,7 +2890,7 @@ var KeychainWriteRefusedError = class extends Error {
|
|
|
2205
2890
|
}
|
|
2206
2891
|
};
|
|
2207
2892
|
var KEEP = { kind: "keep" };
|
|
2208
|
-
function isRecord$
|
|
2893
|
+
function isRecord$4(value) {
|
|
2209
2894
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
2210
2895
|
}
|
|
2211
2896
|
function defaultMintId() {
|
|
@@ -2218,7 +2903,7 @@ function collectSecretMarkerRefs(value, out = []) {
|
|
|
2218
2903
|
return out;
|
|
2219
2904
|
}
|
|
2220
2905
|
if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
|
|
2221
|
-
else if (isRecord$
|
|
2906
|
+
else if (isRecord$4(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
|
|
2222
2907
|
return out;
|
|
2223
2908
|
}
|
|
2224
2909
|
async function storedValueEquals(secrets, marker, candidate) {
|
|
@@ -2273,7 +2958,7 @@ function rowId(row, idKey) {
|
|
|
2273
2958
|
return null;
|
|
2274
2959
|
}
|
|
2275
2960
|
async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
2276
|
-
const storedRows = Array.isArray(stored) ? stored.filter(isRecord$
|
|
2961
|
+
const storedRows = Array.isArray(stored) ? stored.filter(isRecord$4) : [];
|
|
2277
2962
|
if (!Array.isArray(incoming)) {
|
|
2278
2963
|
ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
|
|
2279
2964
|
return {
|
|
@@ -2289,7 +2974,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
|
2289
2974
|
const kept = /* @__PURE__ */ new Set();
|
|
2290
2975
|
const rows = [];
|
|
2291
2976
|
for (const row of incoming) {
|
|
2292
|
-
if (!isRecord$
|
|
2977
|
+
if (!isRecord$4(row)) {
|
|
2293
2978
|
rows.push(row);
|
|
2294
2979
|
continue;
|
|
2295
2980
|
}
|
|
@@ -2314,7 +2999,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
|
2314
2999
|
case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
|
|
2315
3000
|
case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
|
|
2316
3001
|
case "object": {
|
|
2317
|
-
if (!isRecord$
|
|
3002
|
+
if (!isRecord$4(incoming)) {
|
|
2318
3003
|
if (incoming === void 0) return KEEP;
|
|
2319
3004
|
ctx.deletes.push(...collectSecretMarkerRefs(stored));
|
|
2320
3005
|
return {
|
|
@@ -2322,7 +3007,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
|
2322
3007
|
value: incoming
|
|
2323
3008
|
};
|
|
2324
3009
|
}
|
|
2325
|
-
const storedObj = isRecord$
|
|
3010
|
+
const storedObj = isRecord$4(stored) ? stored : {};
|
|
2326
3011
|
return {
|
|
2327
3012
|
kind: "value",
|
|
2328
3013
|
value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
|
|
@@ -2445,7 +3130,7 @@ async function resolveSecretMarkers(value, secrets, options = {}) {
|
|
|
2445
3130
|
value: items
|
|
2446
3131
|
};
|
|
2447
3132
|
}
|
|
2448
|
-
if (isRecord$
|
|
3133
|
+
if (isRecord$4(v)) {
|
|
2449
3134
|
const out = {};
|
|
2450
3135
|
for (const [k, child] of Object.entries(v)) {
|
|
2451
3136
|
const s = substitute(child);
|
|
@@ -2477,7 +3162,7 @@ var SecretOverwriteRefusedError = class extends Error {
|
|
|
2477
3162
|
this.name = "SecretOverwriteRefusedError";
|
|
2478
3163
|
}
|
|
2479
3164
|
};
|
|
2480
|
-
function isRecord$
|
|
3165
|
+
function isRecord$3(value) {
|
|
2481
3166
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
2482
3167
|
}
|
|
2483
3168
|
function resolvedValue(pass, marker) {
|
|
@@ -2506,7 +3191,7 @@ function inArray(pass, incoming, stored) {
|
|
|
2506
3191
|
return incoming.map((item, index) => {
|
|
2507
3192
|
const twin = stored[index];
|
|
2508
3193
|
if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
|
|
2509
|
-
if (isRecord$
|
|
3194
|
+
if (isRecord$3(item) && isRecord$3(twin)) return inArrayRow(pass, item, twin);
|
|
2510
3195
|
if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
|
|
2511
3196
|
return item;
|
|
2512
3197
|
});
|
|
@@ -2517,7 +3202,7 @@ function inArrayRow(pass, incoming, stored) {
|
|
|
2517
3202
|
const twin = stored[key];
|
|
2518
3203
|
if (isSecretMarker(twin)) {
|
|
2519
3204
|
if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
|
|
2520
|
-
} else if (isRecord$
|
|
3205
|
+
} else if (isRecord$3(value) && isRecord$3(twin)) out[key] = inArrayRow(pass, value, twin);
|
|
2521
3206
|
else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
|
|
2522
3207
|
}
|
|
2523
3208
|
return out;
|
|
@@ -2525,7 +3210,7 @@ function inArrayRow(pass, incoming, stored) {
|
|
|
2525
3210
|
async function walk(pass, incoming, stored) {
|
|
2526
3211
|
if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
|
|
2527
3212
|
if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
|
|
2528
|
-
if (!isRecord$
|
|
3213
|
+
if (!isRecord$3(incoming) || !isRecord$3(stored)) return incoming;
|
|
2529
3214
|
const out = { ...incoming };
|
|
2530
3215
|
for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
|
|
2531
3216
|
return out;
|
|
@@ -2556,7 +3241,7 @@ async function restoreUnchangedSecrets(input) {
|
|
|
2556
3241
|
function isJsonEqual(a, b) {
|
|
2557
3242
|
if (Object.is(a, b)) return true;
|
|
2558
3243
|
if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
|
|
2559
|
-
if (isRecord$
|
|
3244
|
+
if (isRecord$3(a) && isRecord$3(b)) {
|
|
2560
3245
|
const keys = Object.keys(a);
|
|
2561
3246
|
if (keys.length !== Object.keys(b).length) return false;
|
|
2562
3247
|
return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
|
|
@@ -2580,7 +3265,7 @@ function markerKeysOf(blob, owner) {
|
|
|
2580
3265
|
}
|
|
2581
3266
|
function nodeFromStored(value, owner) {
|
|
2582
3267
|
if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
|
|
2583
|
-
if (!isRecord$
|
|
3268
|
+
if (!isRecord$3(value)) return null;
|
|
2584
3269
|
const children = /* @__PURE__ */ new Map();
|
|
2585
3270
|
for (const [key, child] of Object.entries(value)) {
|
|
2586
3271
|
const node = nodeFromStored(child, owner);
|
|
@@ -3090,13 +3775,48 @@ var BaseAddon = class {
|
|
|
3090
3775
|
if (api === void 0) throw new Error(`${this.ctx.id}: the migration API is not available on this context`);
|
|
3091
3776
|
return this.runBound(sets.flatMap((set) => set.bind(api)), options);
|
|
3092
3777
|
}
|
|
3093
|
-
|
|
3778
|
+
/**
|
|
3779
|
+
* A device addon states its instance kind once, before its migrations run, and the one-switch
|
|
3780
|
+
* migration (registry `enabled` to the instance body, epic #440 step 3) joins whatever
|
|
3781
|
+
* catalogue the addon runs, in the SAME declaration (the engine replaces an owner's catalogue
|
|
3782
|
+
* on every declare).
|
|
3783
|
+
*/
|
|
3784
|
+
declareRegistrySwitch(spec) {
|
|
3785
|
+
this.registrySwitchSpec = spec;
|
|
3786
|
+
}
|
|
3787
|
+
registrySwitchSpec = null;
|
|
3788
|
+
registrySwitchBound() {
|
|
3789
|
+
const spec = this.registrySwitchSpec;
|
|
3790
|
+
if (spec === null) return [];
|
|
3791
|
+
const api = this.ctx.migrationApi;
|
|
3792
|
+
if (api === void 0) {
|
|
3793
|
+
this.ctx.logger.warn("the registry switch migration is skipped: the migration API is not available on this context");
|
|
3794
|
+
return [];
|
|
3795
|
+
}
|
|
3796
|
+
return migrationSet([registrySwitchToBodyMigration({
|
|
3797
|
+
addonId: this.ctx.id,
|
|
3798
|
+
date: "2026-11-06",
|
|
3799
|
+
seq: 1e3,
|
|
3800
|
+
initialBody: spec.initialBody
|
|
3801
|
+
})], (a) => registrySwitchPortsOver({
|
|
3802
|
+
api: integrationRowsApiOver(a),
|
|
3803
|
+
records: switchRecordsOverMigrationApi(a),
|
|
3804
|
+
kind: spec.kind
|
|
3805
|
+
})).bind(api);
|
|
3806
|
+
}
|
|
3807
|
+
async runBound(declared, options) {
|
|
3808
|
+
const added = this.registrySwitchBound();
|
|
3809
|
+
const migrations = [...declared, ...added];
|
|
3810
|
+
const phased = options?.only === void 0 || added.length === 0 ? options : {
|
|
3811
|
+
...options,
|
|
3812
|
+
only: [...options.only, ...added.map((m) => m.meta.id)]
|
|
3813
|
+
};
|
|
3094
3814
|
const api = this.ctx.api.migrations;
|
|
3095
3815
|
const report = await runAddonMigrations({
|
|
3096
3816
|
declareOwner: (input) => api.declareOwner.mutate(input),
|
|
3097
3817
|
startMigration: (input) => api.startMigration.mutate(input),
|
|
3098
3818
|
finishMigration: (input) => api.finishMigration.mutate(input)
|
|
3099
|
-
}, migrations, this.ctx.logger,
|
|
3819
|
+
}, migrations, this.ctx.logger, phased);
|
|
3100
3820
|
if (report.blockOwner.length > 0) throw new AddonMigrationsBlockedError(report.blockOwner);
|
|
3101
3821
|
return report;
|
|
3102
3822
|
}
|
|
@@ -4169,320 +4889,6 @@ function normalizeAddonInitResult(result) {
|
|
|
4169
4889
|
if (Array.isArray(result)) return { providers: result };
|
|
4170
4890
|
return result;
|
|
4171
4891
|
}
|
|
4172
|
-
var PREFIX = "records/";
|
|
4173
|
-
/** The base of every records failure. `detail` is the human part of the message. */
|
|
4174
|
-
var RecordsError = class extends Error {
|
|
4175
|
-
code;
|
|
4176
|
-
detail;
|
|
4177
|
-
constructor(code, detail) {
|
|
4178
|
-
super(`${PREFIX}${code}: ${detail}`);
|
|
4179
|
-
this.name = "RecordsError";
|
|
4180
|
-
this.code = code;
|
|
4181
|
-
this.detail = detail;
|
|
4182
|
-
}
|
|
4183
|
-
};
|
|
4184
|
-
/** A write guarded by `ifRev` found another revision (or an existing row for `ifRev: 0`). */
|
|
4185
|
-
var RevConflictError = class extends RecordsError {
|
|
4186
|
-
constructor(detail) {
|
|
4187
|
-
super("rev-conflict", detail);
|
|
4188
|
-
this.name = "RevConflictError";
|
|
4189
|
-
}
|
|
4190
|
-
};
|
|
4191
|
-
/** `data` exceeds the kind's `maxDataBytes`. Bytes are never record fields (D613). */
|
|
4192
|
-
var RecordTooLargeError = class extends RecordsError {
|
|
4193
|
-
constructor(detail) {
|
|
4194
|
-
super("too-large", detail);
|
|
4195
|
-
this.name = "RecordTooLargeError";
|
|
4196
|
-
}
|
|
4197
|
-
};
|
|
4198
|
-
/** A filter, order or aggregate names a field no declared index serves. */
|
|
4199
|
-
var UnindexedFilterError = class extends RecordsError {
|
|
4200
|
-
constructor(detail) {
|
|
4201
|
-
super("unindexed-filter", detail);
|
|
4202
|
-
this.name = "UnindexedFilterError";
|
|
4203
|
-
}
|
|
4204
|
-
};
|
|
4205
|
-
/** A bulk delete with no predicate at all. */
|
|
4206
|
-
var FilterRequiredError = class extends RecordsError {
|
|
4207
|
-
constructor(detail) {
|
|
4208
|
-
super("filter-required", detail);
|
|
4209
|
-
this.name = "FilterRequiredError";
|
|
4210
|
-
}
|
|
4211
|
-
};
|
|
4212
|
-
/** The caller declared no such kind (another addon's kind is indistinguishable from none). */
|
|
4213
|
-
var UnknownRecordKindError = class extends RecordsError {
|
|
4214
|
-
constructor(detail) {
|
|
4215
|
-
super("unknown-kind", detail);
|
|
4216
|
-
this.name = "UnknownRecordKindError";
|
|
4217
|
-
}
|
|
4218
|
-
};
|
|
4219
|
-
var RecordNotFoundError = class extends RecordsError {
|
|
4220
|
-
constructor(detail) {
|
|
4221
|
-
super("not-found", detail);
|
|
4222
|
-
this.name = "RecordNotFoundError";
|
|
4223
|
-
}
|
|
4224
|
-
};
|
|
4225
|
-
/** A unique index refused the write. */
|
|
4226
|
-
var RecordUniqueViolationError = class extends RecordsError {
|
|
4227
|
-
constructor(detail) {
|
|
4228
|
-
super("unique-violation", detail);
|
|
4229
|
-
this.name = "RecordUniqueViolationError";
|
|
4230
|
-
}
|
|
4231
|
-
};
|
|
4232
|
-
/** A secret field held a plain string where only a keychain marker may be stored. */
|
|
4233
|
-
var PlaintextSecretError = class extends RecordsError {
|
|
4234
|
-
constructor(detail) {
|
|
4235
|
-
super("plaintext-secret", detail);
|
|
4236
|
-
this.name = "PlaintextSecretError";
|
|
4237
|
-
}
|
|
4238
|
-
};
|
|
4239
|
-
/** A marker whose ref is not the row's own (the D878 rule). */
|
|
4240
|
-
var ForeignSecretMarkerError = class extends RecordsError {
|
|
4241
|
-
constructor(detail) {
|
|
4242
|
-
super("foreign-marker", detail);
|
|
4243
|
-
this.name = "ForeignSecretMarkerError";
|
|
4244
|
-
}
|
|
4245
|
-
};
|
|
4246
|
-
/** The keychain could not store or serve a value: explicit, never an empty string. */
|
|
4247
|
-
var RecordSecretUnavailableError = class extends RecordsError {
|
|
4248
|
-
constructor(detail) {
|
|
4249
|
-
super("secret-unavailable", detail);
|
|
4250
|
-
this.name = "RecordSecretUnavailableError";
|
|
4251
|
-
}
|
|
4252
|
-
};
|
|
4253
|
-
var InvalidRecordError = class extends RecordsError {
|
|
4254
|
-
constructor(detail) {
|
|
4255
|
-
super("invalid-record", detail);
|
|
4256
|
-
this.name = "InvalidRecordError";
|
|
4257
|
-
}
|
|
4258
|
-
};
|
|
4259
|
-
/** A kind declaration the engine refuses (non-additive change, bad shape, wrong file). */
|
|
4260
|
-
var DeclarationRefusedError = class extends RecordsError {
|
|
4261
|
-
constructor(detail) {
|
|
4262
|
-
super("declaration-refused", detail);
|
|
4263
|
-
this.name = "DeclarationRefusedError";
|
|
4264
|
-
}
|
|
4265
|
-
};
|
|
4266
|
-
var NoCallerError = class extends RecordsError {
|
|
4267
|
-
constructor(detail) {
|
|
4268
|
-
super("no-caller", detail);
|
|
4269
|
-
this.name = "NoCallerError";
|
|
4270
|
-
}
|
|
4271
|
-
};
|
|
4272
|
-
var BatchTooLargeError = class extends RecordsError {
|
|
4273
|
-
constructor(detail) {
|
|
4274
|
-
super("batch-too-large", detail);
|
|
4275
|
-
this.name = "BatchTooLargeError";
|
|
4276
|
-
}
|
|
4277
|
-
};
|
|
4278
|
-
/**
|
|
4279
|
-
* A `transact` the engine refuses before touching a row: an op on a kind the
|
|
4280
|
-
* caller did not declare in ONE file and ONE `transactFamily`. The detail names
|
|
4281
|
-
* which rule (`cross-file`, `cross-family`, `no-family`); it is never a silent split.
|
|
4282
|
-
*/
|
|
4283
|
-
var TransactRefusedError = class extends RecordsError {
|
|
4284
|
-
constructor(detail) {
|
|
4285
|
-
super("transact-refused", detail);
|
|
4286
|
-
this.name = "TransactRefusedError";
|
|
4287
|
-
}
|
|
4288
|
-
};
|
|
4289
|
-
/** Limits and names of `ctx.records` (D881). One authority; the engine and the facade read it. */
|
|
4290
|
-
/** The files a kind may live in. `history` is device-history's (D850), never records. */
|
|
4291
|
-
var RECORD_DATABASES = ["settings", "events"];
|
|
4292
|
-
/** The classes of a kind: the `@durable` vocabulary, one authority (replaces the annotation). */
|
|
4293
|
-
var RECORD_CLASSES = [
|
|
4294
|
-
"config",
|
|
4295
|
-
"ledger",
|
|
4296
|
-
"audit",
|
|
4297
|
-
"mirror",
|
|
4298
|
-
"ephemeral"
|
|
4299
|
-
];
|
|
4300
|
-
var RECORD_DEFAULT_MAX_DATA_BYTES = 64 * 1024;
|
|
4301
|
-
var RECORD_MAX_DATA_BYTES = 1024 * 1024;
|
|
4302
|
-
var RECORD_BATCH_MAX = 1e3;
|
|
4303
|
-
var RECORD_BATCH_MAX_BYTES = 4 * 1024 * 1024;
|
|
4304
|
-
var RECORD_QUERY_MAX = 1e3;
|
|
4305
|
-
/** Rows one DELETE statement removes before the serving thread yields. */
|
|
4306
|
-
var RECORD_DELETE_BATCH = 5e3;
|
|
4307
|
-
/** A kind in the `settings` file may not bound itself above this (D447: high volume is `events`). */
|
|
4308
|
-
var RECORD_SETTINGS_MAX_ROWS = 5e4;
|
|
4309
|
-
/** The engine's TTL sweep cadence. */
|
|
4310
|
-
var RECORD_SWEEP_INTERVAL_MS = 10 * 6e4;
|
|
4311
|
-
/** The `Column`-free proof prefix: a ref collection for a kind's secret fields. */
|
|
4312
|
-
var RECORD_SECRET_COLLECTION_PREFIX = "records:";
|
|
4313
|
-
/**
|
|
4314
|
-
* Secret fields of a record, addressed the way a Zod schema declares them
|
|
4315
|
-
* (`collectZodSecretPaths`): dotted keys, `[]` for "each element of this array"
|
|
4316
|
-
* (`auth.accessToken`, `headers[].value`).
|
|
4317
|
-
*
|
|
4318
|
-
* `{}` after a key means "each value of this map" (`applianceSecrets{}`): the map's own key
|
|
4319
|
-
* names the value (`applianceSecrets{fridge}`), so no id key is declared and a body that drops a
|
|
4320
|
-
* key releases exactly that key's secret.
|
|
4321
|
-
*
|
|
4322
|
-
* Array elements are matched by a DECLARED id key (`secretArrayKeys`:
|
|
4323
|
-
* `{ headers: 'name' }`), never by index, so reordering a list keeps every
|
|
4324
|
-
* keychain ref (the same rule as `arrayItemFieldPath`). The concrete path of a
|
|
4325
|
-
* leaf names its element: `headers[X-Api].value`.
|
|
4326
|
-
*
|
|
4327
|
-
* Pure and browser-safe. Nothing here mutates: every transform returns a new value.
|
|
4328
|
-
*/
|
|
4329
|
-
/** The array prefixes (declared form, e.g. `headers` or `a.headers`) of a path. */
|
|
4330
|
-
function parseSecretPath(path) {
|
|
4331
|
-
if (path.length === 0) throw new InvalidRecordError("an empty secret path");
|
|
4332
|
-
return path.split(".").map((raw) => {
|
|
4333
|
-
const each = raw.endsWith("[]");
|
|
4334
|
-
const map = raw.endsWith("{}");
|
|
4335
|
-
const key = each || map ? raw.slice(0, -2) : raw;
|
|
4336
|
-
if (key.length === 0) throw new InvalidRecordError(`secret path "${path}" has an empty segment`);
|
|
4337
|
-
return {
|
|
4338
|
-
key,
|
|
4339
|
-
each,
|
|
4340
|
-
map
|
|
4341
|
-
};
|
|
4342
|
-
});
|
|
4343
|
-
}
|
|
4344
|
-
/** The declared array prefixes of `path` that need an id key (`headers`, `a.rows`). */
|
|
4345
|
-
function secretArrayPrefixes(path) {
|
|
4346
|
-
const segments = parseSecretPath(path);
|
|
4347
|
-
const prefixes = [];
|
|
4348
|
-
const walked = [];
|
|
4349
|
-
for (const segment of segments) {
|
|
4350
|
-
walked.push(segment.key);
|
|
4351
|
-
if (segment.each) prefixes.push(walked.join("."));
|
|
4352
|
-
}
|
|
4353
|
-
return prefixes;
|
|
4354
|
-
}
|
|
4355
|
-
function isRecord$4(value) {
|
|
4356
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
4357
|
-
}
|
|
4358
|
-
function elementId(element, idKey, declared, prefix) {
|
|
4359
|
-
const id = isRecord$4(element) ? element[idKey] : void 0;
|
|
4360
|
-
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`);
|
|
4361
|
-
return id;
|
|
4362
|
-
}
|
|
4363
|
-
/**
|
|
4364
|
-
* Visit every secret leaf PRESENT in `data` (an absent branch has nothing to
|
|
4365
|
-
* visit). `replace` returns the new leaf value, or {@link REMOVE_LEAF}; the
|
|
4366
|
-
* result is a new body, `data` is untouched.
|
|
4367
|
-
*/
|
|
4368
|
-
var REMOVE_LEAF = Symbol("remove-leaf");
|
|
4369
|
-
function mapAt(node, segments, index, walkedKeys, concretePrefix, declared, arrayKeys, visit) {
|
|
4370
|
-
if (!isRecord$4(node)) return node;
|
|
4371
|
-
const segment = segments[index];
|
|
4372
|
-
if (segment === void 0) return node;
|
|
4373
|
-
if (!Object.prototype.hasOwnProperty.call(node, segment.key)) return node;
|
|
4374
|
-
const child = node[segment.key];
|
|
4375
|
-
const keys = [...walkedKeys, segment.key];
|
|
4376
|
-
const last = index === segments.length - 1;
|
|
4377
|
-
if (segment.each) {
|
|
4378
|
-
if (!Array.isArray(child)) return node;
|
|
4379
|
-
const prefix = keys.join(".");
|
|
4380
|
-
const idKey = arrayKeys[prefix];
|
|
4381
|
-
if (idKey === void 0) throw new InvalidRecordError(`"${declared}": no id key declared for the array "${prefix}"`);
|
|
4382
|
-
const mapped = child.map((element) => {
|
|
4383
|
-
const id = elementId(element, idKey, declared, prefix);
|
|
4384
|
-
const concrete = `${concretePrefix}${concretePrefix.length > 0 ? "." : ""}${segment.key}[${encodeURIComponent(id)}]`;
|
|
4385
|
-
return last ? element : mapAt(element, segments, index + 1, keys, concrete, declared, arrayKeys, visit);
|
|
4386
|
-
});
|
|
4387
|
-
return {
|
|
4388
|
-
...node,
|
|
4389
|
-
[segment.key]: mapped
|
|
4390
|
-
};
|
|
4391
|
-
}
|
|
4392
|
-
if (segment.map) {
|
|
4393
|
-
if (!isRecord$4(child)) return node;
|
|
4394
|
-
const kept = Object.entries(child).map(([mapKey, value]) => {
|
|
4395
|
-
const concrete = `${concretePrefix}${concretePrefix.length > 0 ? "." : ""}${segment.key}{${encodeURIComponent(mapKey)}}`;
|
|
4396
|
-
if (!last) return [mapKey, mapAt(value, segments, index + 1, keys, concrete, declared, arrayKeys, visit)];
|
|
4397
|
-
return [mapKey, visit({
|
|
4398
|
-
declared,
|
|
4399
|
-
concrete,
|
|
4400
|
-
value
|
|
4401
|
-
})];
|
|
4402
|
-
}).filter(([, value]) => value !== REMOVE_LEAF);
|
|
4403
|
-
return {
|
|
4404
|
-
...node,
|
|
4405
|
-
[segment.key]: Object.fromEntries(kept)
|
|
4406
|
-
};
|
|
4407
|
-
}
|
|
4408
|
-
const concrete = `${concretePrefix}${concretePrefix.length > 0 ? "." : ""}${segment.key}`;
|
|
4409
|
-
if (last) {
|
|
4410
|
-
const replacement = visit({
|
|
4411
|
-
declared,
|
|
4412
|
-
concrete,
|
|
4413
|
-
value: child
|
|
4414
|
-
});
|
|
4415
|
-
if (replacement === REMOVE_LEAF) return Object.fromEntries(Object.entries(node).filter(([key]) => key !== segment.key));
|
|
4416
|
-
return {
|
|
4417
|
-
...node,
|
|
4418
|
-
[segment.key]: replacement
|
|
4419
|
-
};
|
|
4420
|
-
}
|
|
4421
|
-
return {
|
|
4422
|
-
...node,
|
|
4423
|
-
[segment.key]: mapAt(child, segments, index + 1, keys, concrete, declared, arrayKeys, visit)
|
|
4424
|
-
};
|
|
4425
|
-
}
|
|
4426
|
-
/** Replace/remove every present secret leaf; returns a NEW body. */
|
|
4427
|
-
function mapSecretLeaves(data, paths, arrayKeys, visit) {
|
|
4428
|
-
let current = data;
|
|
4429
|
-
for (const declared of paths) current = mapAt(current, parseSecretPath(declared), 0, [], "", declared, arrayKeys, visit);
|
|
4430
|
-
return current;
|
|
4431
|
-
}
|
|
4432
|
-
/** Every present secret leaf, read-only. */
|
|
4433
|
-
function collectSecretLeaves(data, paths, arrayKeys) {
|
|
4434
|
-
const found = [];
|
|
4435
|
-
mapSecretLeaves(data, paths, arrayKeys, (leaf) => {
|
|
4436
|
-
found.push(leaf);
|
|
4437
|
-
return leaf.value;
|
|
4438
|
-
});
|
|
4439
|
-
return found;
|
|
4440
|
-
}
|
|
4441
|
-
/**
|
|
4442
|
-
* The keychain collection name a kind's secrets live under. Prefixed so a
|
|
4443
|
-
* record's refs never collide with the refs a legacy collection of the same name
|
|
4444
|
-
* already holds during an adoption.
|
|
4445
|
-
*/
|
|
4446
|
-
function recordSecretCollection(kind) {
|
|
4447
|
-
return `${RECORD_SECRET_COLLECTION_PREFIX}${kind}`;
|
|
4448
|
-
}
|
|
4449
|
-
/** The ONE ref a row's secret field may carry: the engine and the facade both build it here. */
|
|
4450
|
-
function recordSecretRef(owner, kind, rowId, concretePath) {
|
|
4451
|
-
return buildSecretRef({
|
|
4452
|
-
owner,
|
|
4453
|
-
scope: {
|
|
4454
|
-
kind: "row",
|
|
4455
|
-
collection: recordSecretCollection(kind),
|
|
4456
|
-
rowId
|
|
4457
|
-
},
|
|
4458
|
-
fieldPath: concretePath
|
|
4459
|
-
});
|
|
4460
|
-
}
|
|
4461
|
-
/**
|
|
4462
|
-
* A stored secret, as an admin read shows it: a VIEW naming the row's own
|
|
4463
|
-
* keychain ref (`set: true`), never the value and no longer the bare redaction
|
|
4464
|
-
* token. The form hands it to the secret field, which reveals the value by ref
|
|
4465
|
-
* through the audited `keychain-admin.reveal`; sent back untouched it keeps the
|
|
4466
|
-
* stored secret (the records door reads a view as KEEP).
|
|
4467
|
-
*
|
|
4468
|
-
* ONE implementation for the entries service and for every addon that serves
|
|
4469
|
-
* its own instances (`RecordIntegrationInstances`).
|
|
4470
|
-
*/
|
|
4471
|
-
function isRecord$3(value) {
|
|
4472
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
4473
|
-
}
|
|
4474
|
-
function secretViewsOf(owner, kind, id, decl, data) {
|
|
4475
|
-
if (decl.secretPaths.length === 0) return data;
|
|
4476
|
-
const shown = mapSecretLeaves(data, decl.secretPaths, decl.secretArrayKeys, (leaf) => {
|
|
4477
|
-
if (leaf.value !== "__camstack_redacted__") return leaf.value;
|
|
4478
|
-
return {
|
|
4479
|
-
$secret: recordSecretRef(owner, kind, id, leaf.concrete),
|
|
4480
|
-
v: 1,
|
|
4481
|
-
set: true
|
|
4482
|
-
};
|
|
4483
|
-
});
|
|
4484
|
-
return isRecord$3(shown) ? shown : data;
|
|
4485
|
-
}
|
|
4486
4892
|
/**
|
|
4487
4893
|
* Per-listener shared-secret header the hub injects on every reverse-proxied
|
|
4488
4894
|
* data-plane request and the addon's framework wrapper validates — so only the
|
|
@@ -4757,20 +5163,6 @@ function assertTransactScope(members) {
|
|
|
4757
5163
|
if (new Set(kinds.map((m) => m.declaration.transactFamily)).size > 1) throw new TransactRefusedError(`cross-family: the ops span more than one transactFamily (${kinds.map((m) => `${m.kind}=${String(m.declaration.transactFamily)}`).join(", ")})`);
|
|
4758
5164
|
}
|
|
4759
5165
|
/**
|
|
4760
|
-
* Entry kinds (D881): every list of user-created entries (notification
|
|
4761
|
-
* targets, brokers, LLM profiles) is ONE record kind with an id, a name and a
|
|
4762
|
-
* kind-specific body, and the admin UI lists/adds/edits/deletes all of them
|
|
4763
|
-
* through the `record-entries` capability with password fields derived from
|
|
4764
|
-
* the schema (`.meta({ secret: true })`).
|
|
4765
|
-
*/
|
|
4766
|
-
/** The body of a plain entry: a name and the fields the kind adds. */
|
|
4767
|
-
function entryBody(shape) {
|
|
4768
|
-
return zod.z.object({
|
|
4769
|
-
name: zod.z.string().min(1),
|
|
4770
|
-
...shape
|
|
4771
|
-
});
|
|
4772
|
-
}
|
|
4773
|
-
/**
|
|
4774
5166
|
* Declare one entry kind. An entry is configuration: never trimmed by the
|
|
4775
5167
|
* engine, never aged, belonging to no device.
|
|
4776
5168
|
*/
|
|
@@ -7426,6 +7818,10 @@ Object.freeze({
|
|
|
7426
7818
|
"all",
|
|
7427
7819
|
"one"
|
|
7428
7820
|
]
|
|
7821
|
+
},
|
|
7822
|
+
{
|
|
7823
|
+
"path": "positionUpdatedAt",
|
|
7824
|
+
"valueType": "number"
|
|
7429
7825
|
}
|
|
7430
7826
|
],
|
|
7431
7827
|
"meter": [{
|
|
@@ -7680,22 +8076,6 @@ Object.freeze({
|
|
|
7680
8076
|
"path": "pumpRunning",
|
|
7681
8077
|
"valueType": "boolean"
|
|
7682
8078
|
},
|
|
7683
|
-
{
|
|
7684
|
-
"path": "lastDrink",
|
|
7685
|
-
"valueType": "number"
|
|
7686
|
-
},
|
|
7687
|
-
{
|
|
7688
|
-
"path": "currentHourDrink",
|
|
7689
|
-
"valueType": "number"
|
|
7690
|
-
},
|
|
7691
|
-
{
|
|
7692
|
-
"path": "last24hDrink",
|
|
7693
|
-
"valueType": "number"
|
|
7694
|
-
},
|
|
7695
|
-
{
|
|
7696
|
-
"path": "todayDrink",
|
|
7697
|
-
"valueType": "number"
|
|
7698
|
-
},
|
|
7699
8079
|
{
|
|
7700
8080
|
"path": "error",
|
|
7701
8081
|
"valueType": "string"
|
|
@@ -8261,6 +8641,60 @@ Object.freeze({
|
|
|
8261
8641
|
}
|
|
8262
8642
|
]
|
|
8263
8643
|
});
|
|
8644
|
+
Object.freeze({
|
|
8645
|
+
"actions": { "run": 363e4 },
|
|
8646
|
+
"audio-analyzer": { "classify": 3e4 },
|
|
8647
|
+
"custom-model-registry": { "importModelBundle": 18e5 },
|
|
8648
|
+
"database-snapshot": { "writeSnapshot": 18e5 },
|
|
8649
|
+
"device-manager": {
|
|
8650
|
+
"migrateDevice": 72e4,
|
|
8651
|
+
"runDiscoverySweep": 12e4
|
|
8652
|
+
},
|
|
8653
|
+
"device-provider": { "reloadDevice": 18e4 },
|
|
8654
|
+
"llm": {
|
|
8655
|
+
"generate": 6e5,
|
|
8656
|
+
"generateVision": 6e5,
|
|
8657
|
+
"testProfile": 6e5
|
|
8658
|
+
},
|
|
8659
|
+
"llm-runtime": {
|
|
8660
|
+
"complete": 6e5,
|
|
8661
|
+
"completeApple": 6e5,
|
|
8662
|
+
"ensureStarted": 6e5,
|
|
8663
|
+
"installModel": 36e5
|
|
8664
|
+
},
|
|
8665
|
+
"local-network": { "scanNetwork": 9e4 },
|
|
8666
|
+
"model-convert": { "convert": 6e5 },
|
|
8667
|
+
"pipeline-analytics": {
|
|
8668
|
+
"addRetrainFrameFromRecording": 6e4,
|
|
8669
|
+
"offerRetrainArchive": 12e4,
|
|
8670
|
+
"proposeRetrainAnnotationsWithLlm": 18e4,
|
|
8671
|
+
"resolveRetrainTrainingCorpus": 6e4,
|
|
8672
|
+
"writeRetrainArchive": 36e5
|
|
8673
|
+
},
|
|
8674
|
+
"server-management": { "applyServerUpdate": 96e4 },
|
|
8675
|
+
"terminal-session": { "pullOutput": 15e3 },
|
|
8676
|
+
"training": {
|
|
8677
|
+
"canaryResult": 12e4,
|
|
8678
|
+
"cancelJob": 12e4,
|
|
8679
|
+
"planJob": 6e4,
|
|
8680
|
+
"registerResult": 18e5,
|
|
8681
|
+
"rollbackCanary": 12e4,
|
|
8682
|
+
"startJob": 12e4,
|
|
8683
|
+
"startJobBatch": 12e4
|
|
8684
|
+
},
|
|
8685
|
+
"training-provider": {
|
|
8686
|
+
"cancelJob": 6e4,
|
|
8687
|
+
"cleanupJob": 3e5,
|
|
8688
|
+
"getJob": 6e4,
|
|
8689
|
+
"listJobEvents": 6e4,
|
|
8690
|
+
"listJobs": 12e4,
|
|
8691
|
+
"offerArtifact": 3e5,
|
|
8692
|
+
"readResult": 3e5,
|
|
8693
|
+
"submitJob": 18e5,
|
|
8694
|
+
"uploadDataset": 72e5,
|
|
8695
|
+
"validateCredentials": 3e4
|
|
8696
|
+
}
|
|
8697
|
+
});
|
|
8264
8698
|
/**
|
|
8265
8699
|
* Runtime defaults — what `ConfigManager.get()` answers for a key nothing has
|
|
8266
8700
|
* stored, and what the settings store seeds on first boot. Only keys somebody
|
|
@@ -11346,245 +11780,6 @@ var IntegrationInstanceRefSchema = zod.z.object({
|
|
|
11346
11780
|
]),
|
|
11347
11781
|
candidateStableId: zod.z.string().optional()
|
|
11348
11782
|
});
|
|
11349
|
-
function linkTargetOf(meta) {
|
|
11350
|
-
if (typeof meta !== "object" || meta === null) return void 0;
|
|
11351
|
-
const link = Reflect.get(meta, "link");
|
|
11352
|
-
const parsed = LinkTargetSchema.safeParse(link);
|
|
11353
|
-
return parsed.success ? parsed.data : void 0;
|
|
11354
|
-
}
|
|
11355
|
-
var LinkTargetSchema = zod.z.object({
|
|
11356
|
-
cap: zod.z.string().min(1),
|
|
11357
|
-
kind: zod.z.string().min(1).optional()
|
|
11358
|
-
});
|
|
11359
|
-
/** The links a kind declares, read from the meta of its body fields. */
|
|
11360
|
-
function linksOfKind(kind) {
|
|
11361
|
-
const schema = kind.schema;
|
|
11362
|
-
if (!(schema instanceof zod.z.ZodObject)) return [];
|
|
11363
|
-
const links = [];
|
|
11364
|
-
for (const [field, fieldSchema] of Object.entries(schema.shape)) {
|
|
11365
|
-
const to = linkTargetOf(zod.z.globalRegistry.get(fieldSchema));
|
|
11366
|
-
if (to !== void 0) links.push({
|
|
11367
|
-
field,
|
|
11368
|
-
to
|
|
11369
|
-
});
|
|
11370
|
-
}
|
|
11371
|
-
return links;
|
|
11372
|
-
}
|
|
11373
|
-
/**
|
|
11374
|
-
* `RecordIntegrationInstances` - the `integration-instances` provider over ONE
|
|
11375
|
-
* entry kind, so an addon that holds a connection serves it in ~30 lines.
|
|
11376
|
-
*
|
|
11377
|
-
* Every instance is one record of the addon's own kind, keyed by the
|
|
11378
|
-
* `integrations` registry id. The records door does the secret work: a field the
|
|
11379
|
-
* kind marks `.meta({ secret: true })` is a keychain marker bound to the row, so
|
|
11380
|
-
* deleting the row deletes the secret, and one row's value is never another's.
|
|
11381
|
-
*
|
|
11382
|
-
* Patch rules for a secret (`updateInstance`): omitted, `''`, the redaction
|
|
11383
|
-
* token or the view the form was given KEEP the stored secret;
|
|
11384
|
-
* `{ $secretClear: true }` clears it; any other string replaces it.
|
|
11385
|
-
*/
|
|
11386
|
-
/** The most instances one addon lists (an integrations page, not a table). */
|
|
11387
|
-
var INSTANCES_LIST_MAX = 1e3;
|
|
11388
|
-
/** The keys of the kind's secret fields that sit at the top level of the body. */
|
|
11389
|
-
function topLevelSecretKeys(paths) {
|
|
11390
|
-
return new Set(paths.filter((p) => !p.includes(".") && !p.includes("[") && !p.includes("{")));
|
|
11391
|
-
}
|
|
11392
|
-
/** The keys of the kind's top-level MAPS whose values are secrets (`applianceSecrets{}`). */
|
|
11393
|
-
function secretMapKeys(paths) {
|
|
11394
|
-
return new Set(paths.filter((p) => p.endsWith("{}") && !p.slice(0, -2).match(/[.[{]/)).map((p) => p.slice(0, -2)));
|
|
11395
|
-
}
|
|
11396
|
-
/**
|
|
11397
|
-
* A patch value for a map of secrets: an entry that is omitted, `''`, the redaction token or the
|
|
11398
|
-
* view the form was given KEEPS its stored secret (it is left out of the merge); `{ $secretClear }`
|
|
11399
|
-
* or `null` removes the entry; any other string replaces it. Null when nothing is left to merge.
|
|
11400
|
-
*/
|
|
11401
|
-
function secretMapPatch(value) {
|
|
11402
|
-
if (typeof value !== "object" || value === null || Array.isArray(value)) return null;
|
|
11403
|
-
const out = {};
|
|
11404
|
-
for (const [key, entry] of Object.entries(value)) if (entry === null || isSecretClear(entry)) out[key] = null;
|
|
11405
|
-
else if (typeof entry === "string" && entry !== "" && entry !== "__camstack_redacted__" && !isSecretFieldView(entry)) out[key] = entry;
|
|
11406
|
-
return Object.keys(out).length > 0 ? out : null;
|
|
11407
|
-
}
|
|
11408
|
-
/** Does the kind's body schema carry an `enabled` field? */
|
|
11409
|
-
function declaresEnabled(kind) {
|
|
11410
|
-
const json = zod.z.toJSONSchema(kind.schema, {
|
|
11411
|
-
unrepresentable: "any",
|
|
11412
|
-
io: "input"
|
|
11413
|
-
});
|
|
11414
|
-
const properties = Reflect.get(json, "properties");
|
|
11415
|
-
return typeof properties === "object" && properties !== null && "enabled" in properties;
|
|
11416
|
-
}
|
|
11417
|
-
var RecordIntegrationInstances = class {
|
|
11418
|
-
records;
|
|
11419
|
-
kind;
|
|
11420
|
-
hooks;
|
|
11421
|
-
handle;
|
|
11422
|
-
secretKeys;
|
|
11423
|
-
secretMaps;
|
|
11424
|
-
nameField;
|
|
11425
|
-
/** The `integrations` registry owns the on/off switch (`role: devices`); the body has none. */
|
|
11426
|
-
registryOwnsEnabled;
|
|
11427
|
-
constructor(records, kind, hooks) {
|
|
11428
|
-
this.records = records;
|
|
11429
|
-
this.kind = kind;
|
|
11430
|
-
this.hooks = hooks;
|
|
11431
|
-
this.handle = records.kind(kind);
|
|
11432
|
-
this.secretKeys = topLevelSecretKeys(kind.declaration.secretPaths);
|
|
11433
|
-
this.secretMaps = secretMapKeys(kind.declaration.secretPaths);
|
|
11434
|
-
this.nameField = kind.declaration.entry?.nameField ?? "name";
|
|
11435
|
-
this.registryOwnsEnabled = hooks.description.role === "devices";
|
|
11436
|
-
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"`);
|
|
11437
|
-
}
|
|
11438
|
-
/**
|
|
11439
|
-
* One instance read for the addon's own runtime; null when absent. When the keychain is
|
|
11440
|
-
* locked the row is served WITHOUT its secrets and says so (`secrets: 'unavailable'`), so the
|
|
11441
|
-
* caller can keep what it had instead of reconfiguring with an empty secret (D49).
|
|
11442
|
-
*/
|
|
11443
|
-
async readResolved(id) {
|
|
11444
|
-
try {
|
|
11445
|
-
const record = await this.handle.getResolved(id);
|
|
11446
|
-
return record === null ? null : {
|
|
11447
|
-
id,
|
|
11448
|
-
body: record.data,
|
|
11449
|
-
enabled: record.data.enabled !== false,
|
|
11450
|
-
secrets: "resolved"
|
|
11451
|
-
};
|
|
11452
|
-
} catch (err) {
|
|
11453
|
-
if (!(err instanceof RecordSecretUnavailableError)) throw err;
|
|
11454
|
-
const stored = await this.handle.get(id);
|
|
11455
|
-
if (stored === null) return null;
|
|
11456
|
-
return {
|
|
11457
|
-
id,
|
|
11458
|
-
body: Object.fromEntries(Object.entries(stored.data).filter(([key]) => !this.secretKeys.has(key))),
|
|
11459
|
-
enabled: stored.data.enabled !== false,
|
|
11460
|
-
secrets: "unavailable"
|
|
11461
|
-
};
|
|
11462
|
-
}
|
|
11463
|
-
}
|
|
11464
|
-
/** The body of {@link readResolved} alone; a locked keychain yields the row without secrets. */
|
|
11465
|
-
async getResolved(id) {
|
|
11466
|
-
return (await this.readResolved(id))?.body ?? null;
|
|
11467
|
-
}
|
|
11468
|
-
/** Every instance, secrets resolved where the keychain allows; an absent one is skipped. */
|
|
11469
|
-
async listResolved() {
|
|
11470
|
-
const page = await this.handle.query({ limit: INSTANCES_LIST_MAX });
|
|
11471
|
-
const out = [];
|
|
11472
|
-
for (const record of page.records) {
|
|
11473
|
-
const read = await this.readResolved(record.id);
|
|
11474
|
-
if (read !== null) out.push(read);
|
|
11475
|
-
}
|
|
11476
|
-
return out;
|
|
11477
|
-
}
|
|
11478
|
-
viewOf(record) {
|
|
11479
|
-
const shown = secretViewsOf(this.records.owner, this.kind.name, record.id, this.kind.declaration, record.data);
|
|
11480
|
-
const rawName = record.data[this.nameField];
|
|
11481
|
-
const kind = this.hooks.kindOf?.(record.data);
|
|
11482
|
-
const health = this.hooks.health?.(record.data, record.id);
|
|
11483
|
-
return {
|
|
11484
|
-
id: record.id,
|
|
11485
|
-
name: typeof rawName === "string" ? rawName : record.id,
|
|
11486
|
-
configured: this.hooks.configured(record.data),
|
|
11487
|
-
...this.registryOwnsEnabled ? {} : { enabled: record.data.enabled !== false },
|
|
11488
|
-
formValues: shown,
|
|
11489
|
-
...kind !== void 0 ? { kind } : {},
|
|
11490
|
-
...health?.status !== void 0 ? { status: health.status } : {},
|
|
11491
|
-
...health?.lastCheckedAt !== void 0 ? { lastCheckedAt: health.lastCheckedAt } : {}
|
|
11492
|
-
};
|
|
11493
|
-
}
|
|
11494
|
-
describe = async () => {
|
|
11495
|
-
const declared = linksOfKind(this.kind);
|
|
11496
|
-
const links = this.hooks.description.links !== void 0 || declared.length === 0 ? {} : { links: declared.map((link) => ({
|
|
11497
|
-
kind: this.kind.name,
|
|
11498
|
-
field: link.field,
|
|
11499
|
-
to: link.to
|
|
11500
|
-
})) };
|
|
11501
|
-
return {
|
|
11502
|
-
...this.hooks.description,
|
|
11503
|
-
...links,
|
|
11504
|
-
...this.hooks.mintId === void 0 ? {} : { mintsId: true }
|
|
11505
|
-
};
|
|
11506
|
-
};
|
|
11507
|
-
instanceFormSchema = async ({ id }) => this.hooks.formSchema(id);
|
|
11508
|
-
listInstances = async () => {
|
|
11509
|
-
return (await this.handle.query({ limit: INSTANCES_LIST_MAX })).records.map((record) => this.viewOf(record));
|
|
11510
|
-
};
|
|
11511
|
-
getInstance = async ({ id }) => {
|
|
11512
|
-
const record = await this.handle.get(id);
|
|
11513
|
-
return record === null ? null : this.viewOf(record);
|
|
11514
|
-
};
|
|
11515
|
-
/** Insert ONE row (`ifRev: 0`: an existing id is refused, never overwritten). */
|
|
11516
|
-
createInstance = async ({ id, name, kind, values }) => {
|
|
11517
|
-
const minted = id ?? this.hooks.mintId?.({
|
|
11518
|
-
name,
|
|
11519
|
-
...kind !== void 0 ? { kind } : {}
|
|
11520
|
-
});
|
|
11521
|
-
if (minted === void 0) throw new Error("createInstance needs an id: this provider does not mint one");
|
|
11522
|
-
await this.handle.put({
|
|
11523
|
-
id: minted,
|
|
11524
|
-
data: this.hooks.initialBody(name, kind)
|
|
11525
|
-
}, { ifRev: 0 });
|
|
11526
|
-
const patch = this.patchOf(values ?? {});
|
|
11527
|
-
if (Object.keys(patch).length > 0) await this.handle.patch(minted, patch);
|
|
11528
|
-
await this.hooks.onChanged?.(minted, "created");
|
|
11529
|
-
return { id: minted };
|
|
11530
|
-
};
|
|
11531
|
-
updateInstance = async ({ id, name, values }) => {
|
|
11532
|
-
const patch = this.patchOf(values);
|
|
11533
|
-
if (name !== void 0) patch[this.nameField] = name;
|
|
11534
|
-
await this.handle.patch(id, patch);
|
|
11535
|
-
await this.hooks.onChanged?.(id, "updated");
|
|
11536
|
-
return { ok: true };
|
|
11537
|
-
};
|
|
11538
|
-
/** The record patch a form `values` object means: secrets kept, cleared or replaced. */
|
|
11539
|
-
patchOf(values) {
|
|
11540
|
-
const patch = {};
|
|
11541
|
-
for (const [key, value] of Object.entries(values)) {
|
|
11542
|
-
if (value === void 0) continue;
|
|
11543
|
-
if (this.secretMaps.has(key)) {
|
|
11544
|
-
const entries = secretMapPatch(value);
|
|
11545
|
-
if (entries !== null) patch[key] = entries;
|
|
11546
|
-
} else if (!this.secretKeys.has(key)) patch[key] = value;
|
|
11547
|
-
else if (isSecretClear(value)) patch[key] = null;
|
|
11548
|
-
else if (typeof value === "string" && value !== "" && value !== "__camstack_redacted__" && !isSecretFieldView(value)) patch[key] = value;
|
|
11549
|
-
}
|
|
11550
|
-
return patch;
|
|
11551
|
-
}
|
|
11552
|
-
/** The switch lives in the record body; the addon is told so it applies it (D996). */
|
|
11553
|
-
setInstanceEnabled = async ({ id, enabled }) => {
|
|
11554
|
-
if (this.registryOwnsEnabled) throw new Error(`instance "${id}": the integrations registry owns the on/off switch of this addon; set it with integrations.update`);
|
|
11555
|
-
await this.handle.patch(id, { enabled });
|
|
11556
|
-
await this.hooks.onChanged?.(id, "enabled");
|
|
11557
|
-
return { ok: true };
|
|
11558
|
-
};
|
|
11559
|
-
/** The row and its keychain refs go together (the records door). */
|
|
11560
|
-
deleteInstance = async ({ id }) => {
|
|
11561
|
-
await this.handle.delete(id);
|
|
11562
|
-
await this.hooks.onChanged?.(id, "deleted");
|
|
11563
|
-
return { ok: true };
|
|
11564
|
-
};
|
|
11565
|
-
testInstance = async (input) => {
|
|
11566
|
-
if (this.hooks.test === void 0) return {
|
|
11567
|
-
success: false,
|
|
11568
|
-
status: "unsupported",
|
|
11569
|
-
error: "This integration declares no connection test"
|
|
11570
|
-
};
|
|
11571
|
-
return this.hooks.test(input);
|
|
11572
|
-
};
|
|
11573
|
-
/** The flat provider object to hand to `registerProvider`. */
|
|
11574
|
-
toProvider() {
|
|
11575
|
-
return {
|
|
11576
|
-
describe: this.describe,
|
|
11577
|
-
instanceFormSchema: this.instanceFormSchema,
|
|
11578
|
-
listInstances: this.listInstances,
|
|
11579
|
-
getInstance: this.getInstance,
|
|
11580
|
-
createInstance: this.createInstance,
|
|
11581
|
-
updateInstance: this.updateInstance,
|
|
11582
|
-
setInstanceEnabled: this.setInstanceEnabled,
|
|
11583
|
-
deleteInstance: this.deleteInstance,
|
|
11584
|
-
testInstance: this.testInstance
|
|
11585
|
-
};
|
|
11586
|
-
}
|
|
11587
|
-
};
|
|
11588
11783
|
/**
|
|
11589
11784
|
* Shared video / audio encode profile schemas used by every consumer
|
|
11590
11785
|
* that asks the stream broker to spawn a derived stream
|
|
@@ -18584,31 +18779,21 @@ var APPLIANCE_CAP_VOCABULARY = {
|
|
|
18584
18779
|
"pet-fountain": {
|
|
18585
18780
|
scope: "device",
|
|
18586
18781
|
noun: t("Pet fountain", "Fontana per animali"),
|
|
18587
|
-
actions: [
|
|
18588
|
-
|
|
18589
|
-
|
|
18590
|
-
|
|
18591
|
-
|
|
18592
|
-
|
|
18593
|
-
|
|
18594
|
-
|
|
18595
|
-
|
|
18596
|
-
|
|
18597
|
-
|
|
18598
|
-
|
|
18599
|
-
|
|
18600
|
-
|
|
18601
|
-
|
|
18602
|
-
args: { on: false }
|
|
18603
|
-
},
|
|
18604
|
-
{
|
|
18605
|
-
id: "petFountain.resetDailyConsumption",
|
|
18606
|
-
method: "resetDailyConsumption",
|
|
18607
|
-
label: t("Clear daily consumption", "Azzera il consumo giornaliero"),
|
|
18608
|
-
phrase: t("Clear the daily water consumption of {device}", "Azzera il consumo giornaliero di acqua di {device}"),
|
|
18609
|
-
icon: "rotate-ccw"
|
|
18610
|
-
}
|
|
18611
|
-
],
|
|
18782
|
+
actions: [{
|
|
18783
|
+
id: "petFountain.pumpOn",
|
|
18784
|
+
method: "setPump",
|
|
18785
|
+
label: t("Pump on", "Pompa accesa"),
|
|
18786
|
+
phrase: t("Start the pump of {device}", "Avvia la pompa di {device}"),
|
|
18787
|
+
icon: "play",
|
|
18788
|
+
args: { on: true }
|
|
18789
|
+
}, {
|
|
18790
|
+
id: "petFountain.pumpOff",
|
|
18791
|
+
method: "setPump",
|
|
18792
|
+
label: t("Pump off", "Pompa spenta"),
|
|
18793
|
+
phrase: t("Stop the pump of {device}", "Ferma la pompa di {device}"),
|
|
18794
|
+
icon: "square",
|
|
18795
|
+
args: { on: false }
|
|
18796
|
+
}],
|
|
18612
18797
|
state: [{
|
|
18613
18798
|
kind: "boolean",
|
|
18614
18799
|
field: "empty",
|
|
@@ -43921,8 +44106,15 @@ var ActionInputSchema = zod.z.object({
|
|
|
43921
44106
|
var ActionRunOriginSchema = zod.z.object({
|
|
43922
44107
|
/** The automation block whose step started it. */
|
|
43923
44108
|
blockId: zod.z.string().min(1).optional() });
|
|
43924
|
-
/**
|
|
43925
|
-
|
|
44109
|
+
/**
|
|
44110
|
+
* `started` = the caller did not ask to wait. `timed-out` = the run reached the
|
|
44111
|
+
* ceiling (`ACTION_RUN_MAX_MS`) and was stopped; it is never a `ran`.
|
|
44112
|
+
*/
|
|
44113
|
+
var ActionRunOutcomeSchema = zod.z.union([
|
|
44114
|
+
AutomationRunOutcomeSchema,
|
|
44115
|
+
zod.z.literal("started"),
|
|
44116
|
+
zod.z.literal("timed-out")
|
|
44117
|
+
]);
|
|
43926
44118
|
var ActionRunResultSchema = zod.z.object({
|
|
43927
44119
|
runId: zod.z.string().min(1),
|
|
43928
44120
|
outcome: ActionRunOutcomeSchema,
|
|
@@ -44911,6 +45103,33 @@ var actionSourceCapability = {
|
|
|
44911
45103
|
}
|
|
44912
45104
|
};
|
|
44913
45105
|
/**
|
|
45106
|
+
* The longest an action run may last, and the transport bound that lets a
|
|
45107
|
+
* caller WAIT for it.
|
|
45108
|
+
*
|
|
45109
|
+
* An automation step awaits its action (`actions.run` with `wait: true`), so
|
|
45110
|
+
* the cap call stays open for the whole run. With no declared bound the call
|
|
45111
|
+
* ends at the 60 s socket default: the run carried on correctly while the
|
|
45112
|
+
* automation's trace said `UDS request timed out`, and a `single`-mode block
|
|
45113
|
+
* could start a second run over the first. The ceiling below is the one number
|
|
45114
|
+
* both ends agree on: the provider stops a run that reaches it, and the cap
|
|
45115
|
+
* method's `timeoutMs` outlives it, so the transport is never the layer that
|
|
45116
|
+
* gives up first.
|
|
45117
|
+
*/
|
|
45118
|
+
/** A run still going after this long is stopped and reported `timed-out`. */
|
|
45119
|
+
var ACTION_RUN_MAX_MS = 60 * 6e4;
|
|
45120
|
+
/** `timeoutMs` of `actions.run`: a waited call outlives any legal run. */
|
|
45121
|
+
var ACTION_RUN_TIMEOUT_MS = 363e4;
|
|
45122
|
+
/**
|
|
45123
|
+
* The time an action's `wait` steps add up to, in ms (cap steps take extra, never less).
|
|
45124
|
+
* An action step is `cap` or `wait` only (`ActionStepSchema`): steps cannot nest, so the
|
|
45125
|
+
* top-level sum is the whole sum.
|
|
45126
|
+
*/
|
|
45127
|
+
function actionWaitTotalMs(steps) {
|
|
45128
|
+
let total = 0;
|
|
45129
|
+
for (const step of steps) if (step.kind === "wait") total += step.seconds * 1e3;
|
|
45130
|
+
return total;
|
|
45131
|
+
}
|
|
45132
|
+
/**
|
|
44914
45133
|
* actions — the ONE surface for runnable actions, for the UI and for
|
|
44915
45134
|
* automations. Provided by the core-blocks builtin on the hub.
|
|
44916
45135
|
*
|
|
@@ -44928,6 +45147,12 @@ var actionSourceCapability = {
|
|
|
44928
45147
|
* An admin, and an in-process caller (an automation block), may run any action.
|
|
44929
45148
|
* Every refusal is typed (`[not-linked] …`) and logged.
|
|
44930
45149
|
*
|
|
45150
|
+
* **A run lasts at most `ACTION_RUN_MAX_MS` (60 min).** The provider stops a
|
|
45151
|
+
* run that reaches it and answers `timed-out` (never `ran`); an action whose
|
|
45152
|
+
* `wait` steps alone add up to more is refused at create/update
|
|
45153
|
+
* (`[invalid-steps]`). `run` declares a `timeoutMs` above that ceiling, so a
|
|
45154
|
+
* waited call (an automation step) is never cut by the 60 s transport default.
|
|
45155
|
+
*
|
|
44931
45156
|
* A second `run` of an action that is already running is REFUSED — traced and
|
|
44932
45157
|
* logged — never queued.
|
|
44933
45158
|
*/
|
|
@@ -44959,7 +45184,9 @@ var actionsCapability = {
|
|
|
44959
45184
|
/**
|
|
44960
45185
|
* Start an action. `wait` holds the call until the run ended (an automation
|
|
44961
45186
|
* step does); without it the call returns `started`. A non-admin names the
|
|
44962
|
-
* camera (`deviceId`) that links the action.
|
|
45187
|
+
* camera (`deviceId`) that links the action. A waited call stays open for
|
|
45188
|
+
* the whole run, so it declares `ACTION_RUN_TIMEOUT_MS` (above the ceiling
|
|
45189
|
+
* the provider enforces) instead of the 60 s transport default.
|
|
44963
45190
|
*/
|
|
44964
45191
|
run: method(zod.z.object({
|
|
44965
45192
|
actionId: zod.z.string().min(1),
|
|
@@ -44971,7 +45198,8 @@ var actionsCapability = {
|
|
|
44971
45198
|
role: "viewer",
|
|
44972
45199
|
auth: "protected",
|
|
44973
45200
|
kind: "mutation",
|
|
44974
|
-
caller: "required"
|
|
45201
|
+
caller: "required",
|
|
45202
|
+
timeoutMs: ACTION_RUN_TIMEOUT_MS
|
|
44975
45203
|
}),
|
|
44976
45204
|
stop: method(ActionIdInput, zod.z.void(), {
|
|
44977
45205
|
kind: "mutation",
|
|
@@ -51254,6 +51482,9 @@ var MediaPlayerStatusSchema = zod.z.object({
|
|
|
51254
51482
|
/** Repeat mode. Null when no repeat surface.
|
|
51255
51483
|
* Pair with `DeviceFeature.MediaPlayerRepeat`. */
|
|
51256
51484
|
repeat: MediaPlayerRepeatSchema.nullable(),
|
|
51485
|
+
/** Ms epoch when `position` was read from the device. Null when the driver
|
|
51486
|
+
* does not say; a UI that advances the position while playing counts from it. */
|
|
51487
|
+
positionUpdatedAt: zod.z.number().nullable().default(null),
|
|
51257
51488
|
/** Ms epoch when the slice was last updated. */
|
|
51258
51489
|
lastChangedAt: zod.z.number()
|
|
51259
51490
|
});
|
|
@@ -53080,7 +53311,7 @@ async function runFanOut(calls, invoke) {
|
|
|
53080
53311
|
}
|
|
53081
53312
|
/**
|
|
53082
53313
|
* Cap history catalog, projected from every `*.cap.ts` `history` block.
|
|
53083
|
-
* 43 caps with series (
|
|
53314
|
+
* 43 caps with series (79 series), 37 caps answered `'none'`.
|
|
53084
53315
|
* Field keys are `runtimeState` paths (`a.b` into fixed objects only).
|
|
53085
53316
|
*/
|
|
53086
53317
|
var HISTORY_CATALOG = {
|
|
@@ -53331,14 +53562,6 @@ var HISTORY_CATALOG = {
|
|
|
53331
53562
|
"waterVolume": {
|
|
53332
53563
|
kind: "gauge",
|
|
53333
53564
|
unit: "L"
|
|
53334
|
-
},
|
|
53335
|
-
"todayDrink": {
|
|
53336
|
-
kind: "gauge",
|
|
53337
|
-
unit: "L"
|
|
53338
|
-
},
|
|
53339
|
-
"last24hDrink": {
|
|
53340
|
-
kind: "gauge",
|
|
53341
|
-
unit: "L"
|
|
53342
53565
|
}
|
|
53343
53566
|
},
|
|
53344
53567
|
"power-meter": {
|
|
@@ -62174,6 +62397,7 @@ var IntegrationWithStateSchema = zod.z.object({
|
|
|
62174
62397
|
id: zod.z.string(),
|
|
62175
62398
|
addonId: zod.z.string(),
|
|
62176
62399
|
name: zod.z.string(),
|
|
62400
|
+
/** A projection of the instance body's switch (`setInstanceEnabled` is the only writer). */
|
|
62177
62401
|
enabled: zod.z.boolean(),
|
|
62178
62402
|
info: zod.z.record(zod.z.string(), zod.z.unknown()).readonly(),
|
|
62179
62403
|
/** The discovery candidate this integration was set up from (D984). */
|
|
@@ -62186,6 +62410,7 @@ var IntegrationLiteSchema = zod.z.object({
|
|
|
62186
62410
|
id: zod.z.string(),
|
|
62187
62411
|
addonId: zod.z.string(),
|
|
62188
62412
|
name: zod.z.string(),
|
|
62413
|
+
/** A projection of the instance body's switch (`setInstanceEnabled` is the only writer). */
|
|
62189
62414
|
enabled: zod.z.boolean(),
|
|
62190
62415
|
info: zod.z.record(zod.z.string(), zod.z.unknown()).readonly(),
|
|
62191
62416
|
/** The discovery candidate this integration was set up from (D984). */
|
|
@@ -62285,7 +62510,6 @@ var TestConnectionResultSchema = zod.z.object({
|
|
|
62285
62510
|
var CreateIntegrationInputSchema = zod.z.object({
|
|
62286
62511
|
addonId: zod.z.string(),
|
|
62287
62512
|
name: zod.z.string(),
|
|
62288
|
-
enabled: zod.z.boolean().optional(),
|
|
62289
62513
|
info: zod.z.record(zod.z.string(), zod.z.unknown()).optional(),
|
|
62290
62514
|
/** `stableId` of the discovery candidate the form was seeded from (D984). */
|
|
62291
62515
|
originStableId: zod.z.string().optional(),
|
|
@@ -62294,6 +62518,11 @@ var CreateIntegrationInputSchema = zod.z.object({
|
|
|
62294
62518
|
var UpdateIntegrationInputSchema = zod.z.object({
|
|
62295
62519
|
id: zod.z.string(),
|
|
62296
62520
|
name: zod.z.string().optional(),
|
|
62521
|
+
/**
|
|
62522
|
+
* Accepted for a FIXED builtin only (`info.fixed`: alarm panel, camera grid, core blocks,
|
|
62523
|
+
* terminal), which keeps no instance record: the registry flag is its one store. Any other
|
|
62524
|
+
* integration is switched through `integration-instances.setInstanceEnabled`.
|
|
62525
|
+
*/
|
|
62297
62526
|
enabled: zod.z.boolean().optional(),
|
|
62298
62527
|
info: zod.z.record(zod.z.string(), zod.z.unknown()).optional()
|
|
62299
62528
|
});
|
|
@@ -62357,7 +62586,7 @@ var IntegrationInstanceIdSchema = zod.z.string().min(1);
|
|
|
62357
62586
|
var IntegrationInstanceModeSchema = zod.z.enum(["single", "multiple"]);
|
|
62358
62587
|
/**
|
|
62359
62588
|
* What the addon's instances ARE for the Integrations page (planning#416). `devices`: each
|
|
62360
|
-
* instance is an integration that brings devices (
|
|
62589
|
+
* instance is an integration that brings devices (its record body owns the on/off switch);
|
|
62361
62590
|
* `services`: a connection configured from the addon's own function page, never listed on
|
|
62362
62591
|
* Integrations.
|
|
62363
62592
|
* It is the same vocabulary as the manifest's `integrationRole`, which stays as an override.
|
|
@@ -62474,8 +62703,8 @@ var IntegrationInstanceSchema = zod.z.object({
|
|
|
62474
62703
|
configured: zod.z.boolean(),
|
|
62475
62704
|
/**
|
|
62476
62705
|
* The instance's own on/off switch (D996), derived from the record body (`enabled !== false`,
|
|
62477
|
-
* so a row written before the field existed is on).
|
|
62478
|
-
*
|
|
62706
|
+
* so a row written before the field existed is on). The same for every role, `devices` included:
|
|
62707
|
+
* the body is the one store, `setInstanceEnabled` the one writer (epic #440, step 3).
|
|
62479
62708
|
*/
|
|
62480
62709
|
enabled: zod.z.boolean().optional(),
|
|
62481
62710
|
/** The kind of this instance (one of `describe().kinds[].id`), when the provider has kinds. */
|
|
@@ -62525,7 +62754,8 @@ var integrationInstancesCapability = {
|
|
|
62525
62754
|
auth: "admin"
|
|
62526
62755
|
}),
|
|
62527
62756
|
/**
|
|
62528
|
-
* Switch ONE instance on or off
|
|
62757
|
+
* Switch ONE instance on or off, for every role; a missing record is created from the addon's
|
|
62758
|
+
* initial body. A row control, not a form field: `updateInstance.values` is the
|
|
62529
62759
|
* form patch (D62, D996). An off instance keeps its record and secrets and does no work.
|
|
62530
62760
|
*/
|
|
62531
62761
|
setInstanceEnabled: method(zod.z.object({
|
|
@@ -66609,6 +66839,8 @@ var MigrationIntegrationSchema = zod.z.object({
|
|
|
66609
66839
|
addonId: zod.z.string(),
|
|
66610
66840
|
name: zod.z.string(),
|
|
66611
66841
|
info: Rows,
|
|
66842
|
+
/** The registry's stored switch: read by the one-switch migration, nothing else. */
|
|
66843
|
+
enabled: zod.z.boolean().optional(),
|
|
66612
66844
|
originStableId: zod.z.string().optional()
|
|
66613
66845
|
});
|
|
66614
66846
|
var MigrationDeviceSchema = zod.z.object({
|
|
@@ -78732,19 +78964,32 @@ var PetFountainStatusSchema = zod.z.object({
|
|
|
78732
78964
|
empty: zod.z.boolean().nullable(),
|
|
78733
78965
|
/** True while the pump is running. Null while unknown. */
|
|
78734
78966
|
pumpRunning: zod.z.boolean().nullable(),
|
|
78735
|
-
/** Water drunk in the last drink, in litres. */
|
|
78736
|
-
lastDrink: zod.z.number().min(0).nullable().meta(readingMeta("volume")),
|
|
78737
|
-
/** Water drunk in the current hour, in litres. */
|
|
78738
|
-
currentHourDrink: zod.z.number().min(0).nullable().meta(readingMeta("volume")),
|
|
78739
|
-
/** Water drunk over the last 24 hours (rolling), in litres. */
|
|
78740
|
-
last24hDrink: zod.z.number().min(0).nullable().meta(readingMeta("volume")),
|
|
78741
|
-
/** Water drunk since local midnight, in litres. Null when the fountain has no such sensor. */
|
|
78742
|
-
todayDrink: zod.z.number().min(0).nullable().meta(readingMeta("volume")),
|
|
78743
78967
|
/** Decoded fault message. Null means healthy; a non-null string is an active fault. */
|
|
78744
78968
|
error: zod.z.string().nullable(),
|
|
78745
78969
|
/** Ms epoch when the slice was last refreshed. */
|
|
78746
78970
|
lastFetchedAt: zod.z.number()
|
|
78747
78971
|
});
|
|
78972
|
+
/** The key of the `consumables` item derived from the tank. */
|
|
78973
|
+
var PET_FOUNTAIN_WATER_KEY = "water";
|
|
78974
|
+
/**
|
|
78975
|
+
* The fountain's tank as a `consumables` item: a `supply` drawn as a `tank`.
|
|
78976
|
+
* The level is the fountain's `waterLevel`; the verdict is left to whoever
|
|
78977
|
+
* reads a level (the notification centre judges a level-only supply). Only a fountain that reports no level falls back to its `empty`
|
|
78978
|
+
* flag — a measurement that failed is `null`, never 0 (D393).
|
|
78979
|
+
*/
|
|
78980
|
+
function petFountainWaterItem(status) {
|
|
78981
|
+
const verdict = status.waterLevel !== null || status.empty === null ? null : status.empty ? "empty" : "ok";
|
|
78982
|
+
return {
|
|
78983
|
+
key: PET_FOUNTAIN_WATER_KEY,
|
|
78984
|
+
label: "Water",
|
|
78985
|
+
level: status.waterLevel,
|
|
78986
|
+
status: verdict,
|
|
78987
|
+
kind: "supply",
|
|
78988
|
+
form: "tank",
|
|
78989
|
+
lastResetAt: null,
|
|
78990
|
+
resettable: false
|
|
78991
|
+
};
|
|
78992
|
+
}
|
|
78748
78993
|
var DeviceIdSchema$1 = zod.z.number().int().nonnegative();
|
|
78749
78994
|
var petFountainCapability = {
|
|
78750
78995
|
name: "pet-fountain",
|
|
@@ -78752,21 +78997,15 @@ var petFountainCapability = {
|
|
|
78752
78997
|
deviceNative: true,
|
|
78753
78998
|
mode: "singleton",
|
|
78754
78999
|
deviceTypes: [DeviceType.PetFountain],
|
|
78755
|
-
methods: {
|
|
78756
|
-
|
|
78757
|
-
|
|
78758
|
-
|
|
78759
|
-
|
|
78760
|
-
|
|
78761
|
-
|
|
78762
|
-
|
|
78763
|
-
|
|
78764
|
-
/** Clear the rolling daily consumption counters on the device. */
|
|
78765
|
-
resetDailyConsumption: method(zod.z.object({ deviceId: DeviceIdSchema$1 }), zod.z.void(), {
|
|
78766
|
-
kind: "mutation",
|
|
78767
|
-
auth: "protected"
|
|
78768
|
-
})
|
|
78769
|
-
},
|
|
79000
|
+
methods: {
|
|
79001
|
+
/** Start or stop the pump. */
|
|
79002
|
+
setPump: method(zod.z.object({
|
|
79003
|
+
deviceId: DeviceIdSchema$1,
|
|
79004
|
+
on: zod.z.boolean()
|
|
79005
|
+
}), zod.z.void(), {
|
|
79006
|
+
kind: "mutation",
|
|
79007
|
+
auth: "protected"
|
|
79008
|
+
}) },
|
|
78770
79009
|
status: {
|
|
78771
79010
|
schema: PetFountainStatusSchema,
|
|
78772
79011
|
kind: "push"
|
|
@@ -78790,14 +79029,6 @@ var petFountainCapability = {
|
|
|
78790
79029
|
waterVolume: {
|
|
78791
79030
|
kind: "gauge",
|
|
78792
79031
|
unit: "L"
|
|
78793
|
-
},
|
|
78794
|
-
todayDrink: {
|
|
78795
|
-
kind: "gauge",
|
|
78796
|
-
unit: "L"
|
|
78797
|
-
},
|
|
78798
|
-
last24hDrink: {
|
|
78799
|
-
kind: "gauge",
|
|
78800
|
-
unit: "L"
|
|
78801
79032
|
}
|
|
78802
79033
|
} }
|
|
78803
79034
|
};
|
|
@@ -101516,13 +101747,6 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
101516
101747
|
access: "view",
|
|
101517
101748
|
role: "viewer"
|
|
101518
101749
|
},
|
|
101519
|
-
"petFountain.resetDailyConsumption": {
|
|
101520
|
-
capName: "pet-fountain",
|
|
101521
|
-
capScope: "device",
|
|
101522
|
-
addonId: null,
|
|
101523
|
-
access: "delete",
|
|
101524
|
-
role: "viewer"
|
|
101525
|
-
},
|
|
101526
101750
|
"petFountain.setPump": {
|
|
101527
101751
|
capName: "pet-fountain",
|
|
101528
101752
|
capScope: "device",
|
|
@@ -108009,11 +108233,6 @@ Object.freeze({
|
|
|
108009
108233
|
form: "single",
|
|
108010
108234
|
optional: false
|
|
108011
108235
|
}],
|
|
108012
|
-
"petFountain.resetDailyConsumption": [{
|
|
108013
|
-
name: "deviceId",
|
|
108014
|
-
form: "single",
|
|
108015
|
-
optional: false
|
|
108016
|
-
}],
|
|
108017
108236
|
"petFountain.setPump": [{
|
|
108018
108237
|
name: "deviceId",
|
|
108019
108238
|
form: "single",
|
|
@@ -111576,8 +111795,13 @@ zod.z.object({
|
|
|
111576
111795
|
delay: zod.z.number().nonnegative().optional(),
|
|
111577
111796
|
commands: zod.z.record(zod.z.string(), zod.z.unknown())
|
|
111578
111797
|
});
|
|
111579
|
-
entryBody({ brokerId: zod.z.string() });
|
|
111580
111798
|
//#endregion
|
|
111799
|
+
Object.defineProperty(exports, "ACTION_RUN_MAX_MS", {
|
|
111800
|
+
enumerable: true,
|
|
111801
|
+
get: function() {
|
|
111802
|
+
return ACTION_RUN_MAX_MS;
|
|
111803
|
+
}
|
|
111804
|
+
});
|
|
111581
111805
|
Object.defineProperty(exports, "ACTION_TARGET_INVALIDATION_EVENTS", {
|
|
111582
111806
|
enumerable: true,
|
|
111583
111807
|
get: function() {
|
|
@@ -111770,6 +111994,12 @@ Object.defineProperty(exports, "ConditionMirror", {
|
|
|
111770
111994
|
return ConditionMirror;
|
|
111771
111995
|
}
|
|
111772
111996
|
});
|
|
111997
|
+
Object.defineProperty(exports, "ConsumableItemSchema", {
|
|
111998
|
+
enumerable: true,
|
|
111999
|
+
get: function() {
|
|
112000
|
+
return ConsumableItemSchema;
|
|
112001
|
+
}
|
|
112002
|
+
});
|
|
111773
112003
|
Object.defineProperty(exports, "ControlStatusSchema", {
|
|
111774
112004
|
enumerable: true,
|
|
111775
112005
|
get: function() {
|
|
@@ -112214,6 +112444,12 @@ Object.defineProperty(exports, "NoCallerError", {
|
|
|
112214
112444
|
return NoCallerError;
|
|
112215
112445
|
}
|
|
112216
112446
|
});
|
|
112447
|
+
Object.defineProperty(exports, "PET_FOUNTAIN_WATER_KEY", {
|
|
112448
|
+
enumerable: true,
|
|
112449
|
+
get: function() {
|
|
112450
|
+
return PET_FOUNTAIN_WATER_KEY;
|
|
112451
|
+
}
|
|
112452
|
+
});
|
|
112217
112453
|
Object.defineProperty(exports, "PREFERENCES_MAX_VALUE_BYTES", {
|
|
112218
112454
|
enumerable: true,
|
|
112219
112455
|
get: function() {
|
|
@@ -112232,6 +112468,12 @@ Object.defineProperty(exports, "PackageRequiresSchema", {
|
|
|
112232
112468
|
return PackageRequiresSchema;
|
|
112233
112469
|
}
|
|
112234
112470
|
});
|
|
112471
|
+
Object.defineProperty(exports, "PetFountainStatusSchema", {
|
|
112472
|
+
enumerable: true,
|
|
112473
|
+
get: function() {
|
|
112474
|
+
return PetFountainStatusSchema;
|
|
112475
|
+
}
|
|
112476
|
+
});
|
|
112235
112477
|
Object.defineProperty(exports, "PlaintextSecretError", {
|
|
112236
112478
|
enumerable: true,
|
|
112237
112479
|
get: function() {
|
|
@@ -112550,6 +112792,12 @@ Object.defineProperty(exports, "actionSourceCapability", {
|
|
|
112550
112792
|
return actionSourceCapability;
|
|
112551
112793
|
}
|
|
112552
112794
|
});
|
|
112795
|
+
Object.defineProperty(exports, "actionWaitTotalMs", {
|
|
112796
|
+
enumerable: true,
|
|
112797
|
+
get: function() {
|
|
112798
|
+
return actionWaitTotalMs;
|
|
112799
|
+
}
|
|
112800
|
+
});
|
|
112553
112801
|
Object.defineProperty(exports, "actionsCapability", {
|
|
112554
112802
|
enumerable: true,
|
|
112555
112803
|
get: function() {
|
|
@@ -112868,6 +113116,12 @@ Object.defineProperty(exports, "compositionSourceRefs", {
|
|
|
112868
113116
|
return compositionSourceRefs;
|
|
112869
113117
|
}
|
|
112870
113118
|
});
|
|
113119
|
+
Object.defineProperty(exports, "consumablesCapability", {
|
|
113120
|
+
enumerable: true,
|
|
113121
|
+
get: function() {
|
|
113122
|
+
return consumablesCapability;
|
|
113123
|
+
}
|
|
113124
|
+
});
|
|
112871
113125
|
Object.defineProperty(exports, "coreBlockAddonId", {
|
|
112872
113126
|
enumerable: true,
|
|
112873
113127
|
get: function() {
|
|
@@ -113366,6 +113620,12 @@ Object.defineProperty(exports, "isHistoryHelper", {
|
|
|
113366
113620
|
return isHistoryHelper;
|
|
113367
113621
|
}
|
|
113368
113622
|
});
|
|
113623
|
+
Object.defineProperty(exports, "isInstanceEnabled", {
|
|
113624
|
+
enumerable: true,
|
|
113625
|
+
get: function() {
|
|
113626
|
+
return isInstanceEnabled;
|
|
113627
|
+
}
|
|
113628
|
+
});
|
|
113369
113629
|
Object.defineProperty(exports, "isInternalActionId", {
|
|
113370
113630
|
enumerable: true,
|
|
113371
113631
|
get: function() {
|
|
@@ -113732,6 +113992,18 @@ Object.defineProperty(exports, "parseStreamParamsFormPatch", {
|
|
|
113732
113992
|
return parseStreamParamsFormPatch;
|
|
113733
113993
|
}
|
|
113734
113994
|
});
|
|
113995
|
+
Object.defineProperty(exports, "petFountainCapability", {
|
|
113996
|
+
enumerable: true,
|
|
113997
|
+
get: function() {
|
|
113998
|
+
return petFountainCapability;
|
|
113999
|
+
}
|
|
114000
|
+
});
|
|
114001
|
+
Object.defineProperty(exports, "petFountainWaterItem", {
|
|
114002
|
+
enumerable: true,
|
|
114003
|
+
get: function() {
|
|
114004
|
+
return petFountainWaterItem;
|
|
114005
|
+
}
|
|
114006
|
+
});
|
|
113735
114007
|
Object.defineProperty(exports, "pickAppLinkHub", {
|
|
113736
114008
|
enumerable: true,
|
|
113737
114009
|
get: function() {
|