@camstack/system 1.2.443 → 1.2.445
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/assets/record-entries/icon.svg +8 -0
- package/dist/addon-runner.js +81 -42
- package/dist/addon-runner.mjs +82 -43
- package/dist/{agent-https-DlpTMDqA.js → agent-https-CiOW0-sj.js} +810 -12
- package/dist/{agent-https-U0d4uvn2.mjs → agent-https-D4Q8iFNd.mjs} +697 -13
- package/dist/auth/admin-token-manager.d.ts +9 -3
- package/dist/auth/api-key-manager.d.ts +9 -3
- package/dist/auth/auth-audit-log.d.ts +9 -3
- package/dist/auth/device-credential-manager.d.ts +5 -1
- package/dist/auth/external-identity-manager.d.ts +8 -21
- package/dist/auth/login-session-manager.d.ts +11 -3
- package/dist/auth/scoped-token-manager.d.ts +8 -52
- package/dist/auth/totp-manager.d.ts +11 -3
- package/dist/auth/user-manager.d.ts +10 -17
- package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
- package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
- package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
- package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
- package/dist/builtins/alerts/alert-store.d.ts +32 -0
- package/dist/builtins/alerts/alerts.addon.d.ts +19 -4
- package/dist/builtins/alerts/alerts.addon.js +331 -159
- package/dist/builtins/alerts/alerts.addon.mjs +330 -159
- package/dist/builtins/alerts/record-kinds.d.ts +15 -0
- package/dist/builtins/autotrack/index.js +1 -1
- package/dist/builtins/autotrack/index.mjs +1 -1
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.d.ts +1 -0
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +134 -193
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +134 -193
- package/dist/builtins/backup-orchestrator/destination-policy.d.ts +4 -2
- package/dist/builtins/backup-orchestrator/encryption-key-store.d.ts +4 -2
- package/dist/builtins/backup-orchestrator/record-kinds.d.ts +58 -0
- package/dist/builtins/backup-orchestrator/schedule-store.d.ts +4 -2
- package/dist/builtins/backup-orchestrator/seed-marker-store.d.ts +4 -2
- package/dist/builtins/calendars/calendar-prefs-store.d.ts +13 -5
- package/dist/builtins/calendars/calendars.addon.d.ts +2 -2
- package/dist/builtins/calendars/calendars.addon.js +67 -64
- package/dist/builtins/calendars/calendars.addon.mjs +59 -64
- package/dist/builtins/calendars/record-kinds.d.ts +18 -0
- package/dist/builtins/camera-grid/index.js +1 -1
- package/dist/builtins/camera-grid/index.mjs +1 -1
- package/dist/builtins/cluster-agent/record-kinds.d.ts +36 -0
- package/dist/builtins/composer/composer.addon.js +2 -2
- package/dist/builtins/composer/composer.addon.mjs +2 -2
- package/dist/builtins/console-logging/index.js +1 -1
- package/dist/builtins/console-logging/index.mjs +1 -1
- package/dist/builtins/core-blocks/block-settings-store.d.ts +8 -4
- package/dist/builtins/core-blocks/core-block-store.d.ts +8 -16
- package/dist/builtins/core-blocks/core-blocks.addon.js +85 -112
- package/dist/builtins/core-blocks/core-blocks.addon.mjs +86 -113
- package/dist/builtins/core-blocks/index.mjs +1 -1
- package/dist/builtins/core-blocks/record-kinds.d.ts +26 -0
- package/dist/builtins/device-manager/device-manager.addon.js +111 -187
- package/dist/builtins/device-manager/device-manager.addon.mjs +110 -187
- package/dist/builtins/device-manager/device-tombstone-store.d.ts +9 -48
- package/dist/builtins/device-manager/record-kinds.d.ts +14 -0
- package/dist/builtins/hub-forwarder/index.js +1 -1
- package/dist/builtins/hub-forwarder/index.mjs +1 -1
- package/dist/builtins/keychain/index.js +152 -22
- package/dist/builtins/keychain/index.mjs +152 -22
- package/dist/builtins/keychain/keychain-service.d.ts +3 -2
- package/dist/builtins/keychain/keychain-store.d.ts +13 -2
- package/dist/builtins/keychain/record-kinds.d.ts +16 -0
- package/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
- package/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
- package/dist/builtins/local-auth/auth-schema.d.ts +3 -1
- package/dist/builtins/local-auth/local-auth.addon.js +2903 -2123
- package/dist/builtins/local-auth/local-auth.addon.mjs +2904 -2124
- package/dist/builtins/local-auth/oauth-session-manager.d.ts +8 -48
- package/dist/builtins/local-auth/record-kinds.d.ts +141 -0
- package/dist/builtins/local-network/local-network.addon.js +2 -2
- package/dist/builtins/local-network/local-network.addon.mjs +2 -2
- package/dist/builtins/loki-logging/index.js +1 -1
- package/dist/builtins/loki-logging/index.mjs +1 -1
- package/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
- package/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
- package/dist/builtins/platform-probe/index.js +1 -1
- package/dist/builtins/platform-probe/index.mjs +1 -1
- package/dist/builtins/record-entries/entries-service.d.ts +42 -0
- package/dist/builtins/record-entries/index.d.ts +1 -0
- package/dist/builtins/record-entries/index.js +142 -0
- package/dist/builtins/record-entries/index.mjs +136 -0
- package/dist/builtins/record-entries/record-entries.addon.d.ts +13 -0
- package/dist/builtins/records/legacy-table-row-count.d.ts +5 -0
- package/dist/builtins/records/phase6-declare-gate.d.ts +28 -0
- package/dist/builtins/records-isolated.d.ts +10 -0
- package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
- package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
- package/dist/builtins/snapshot/index.js +1 -1
- package/dist/builtins/snapshot/index.mjs +1 -1
- package/dist/builtins/sqlite-storage/file-host-client.d.ts +2 -0
- package/dist/builtins/sqlite-storage/file-host-handlers.d.ts +4 -0
- package/dist/builtins/sqlite-storage/file-host-protocol.d.ts +7 -1
- package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
- package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
- package/dist/builtins/sqlite-storage/index.js +1 -1
- package/dist/builtins/sqlite-storage/index.mjs +1 -1
- package/dist/builtins/sqlite-storage/integration-record-kinds.d.ts +30 -0
- package/dist/builtins/sqlite-storage/integration-registry.d.ts +10 -16
- package/dist/builtins/sqlite-storage/owned-sqlite-file.d.ts +7 -0
- package/dist/builtins/sqlite-storage/placement-router.d.ts +5 -0
- package/dist/builtins/sqlite-storage/records/count-settings-array-legacy.d.ts +5 -0
- package/dist/builtins/sqlite-storage/records/count-settings-brokers-legacy.d.ts +6 -0
- package/dist/builtins/sqlite-storage/records/records-catalog.d.ts +29 -0
- package/dist/builtins/sqlite-storage/records/records-engine-types.d.ts +51 -0
- package/dist/builtins/sqlite-storage/records/records-engine.d.ts +94 -0
- package/dist/builtins/sqlite-storage/records/records-explain.d.ts +18 -0
- package/dist/builtins/sqlite-storage/records/records-plan.d.ts +90 -0
- package/dist/builtins/sqlite-storage/records/records-probe.d.ts +33 -0
- package/dist/builtins/sqlite-storage/records/records-provider.d.ts +63 -0
- package/dist/builtins/sqlite-storage/records/records-rows.d.ts +46 -0
- package/dist/builtins/sqlite-storage/records/records-sql.d.ts +41 -0
- package/dist/builtins/sqlite-storage/sqlite-settings-backend.d.ts +17 -10
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.d.ts +8 -0
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +446 -5
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +446 -5
- package/dist/builtins/sqlite-storage/storage-admin-provider.d.ts +15 -1
- package/dist/builtins/storage-orchestrator/drain-state-store.d.ts +5 -2
- package/dist/builtins/storage-orchestrator/location-store.d.ts +7 -2
- package/dist/builtins/storage-orchestrator/record-kinds.d.ts +38 -0
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.d.ts +2 -0
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +196 -5
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +195 -6
- package/dist/builtins/system-config/record-kinds.d.ts +32 -0
- package/dist/builtins/system-config/system-config.addon.js +53 -618
- package/dist/builtins/system-config/system-config.addon.mjs +29 -577
- package/dist/builtins/winston-logging/index.js +1 -1
- package/dist/builtins/winston-logging/index.mjs +1 -1
- package/dist/{composition-sources-C8tUG2uL.mjs → composition-sources-BMt5cFYb.mjs} +1 -1
- package/dist/{composition-sources-BUXX1e8j.js → composition-sources-D3fi9Xns.js} +1 -1
- package/dist/{constants-CGwVaAV3.mjs → constants-BMHCxRzb.mjs} +1 -1
- package/dist/{constants-DWmm7_of.js → constants-Br879Axi.js} +1 -1
- package/dist/{device-ca-DGayRmC0.js → device-ca-CnJ_va7i.js} +1 -1
- package/dist/{device-ca-DBfiJ_SB.mjs → device-ca-T8osSMos.mjs} +1 -1
- package/dist/{dist-Bxt_S-9a.mjs → dist-BNunRyXT.mjs} +1133 -93
- package/dist/{dist-D9qT3jHr.js → dist-DgOG8flk.js} +1354 -92
- package/dist/file-host-worker.js +11 -1
- package/dist/file-host-worker.mjs +11 -1
- package/dist/{hub-mdns-ciao-B-wk9nzx.js → hub-mdns-ciao-BIkTHq-n.js} +2 -2
- package/dist/{hub-mdns-ciao-DpPcQDg-.mjs → hub-mdns-ciao-D16oRQ9K.mjs} +2 -2
- package/dist/index.d.ts +7 -0
- package/dist/index.js +3111 -2806
- package/dist/index.mjs +3083 -2795
- package/dist/kernel/index.d.ts +2 -0
- package/dist/kernel/moleculer/event-bus.d.ts +3 -1
- package/dist/kernel/moleculer/mesh-mtls/mesh-certificate-registry.d.ts +5 -1
- package/dist/kernel/moleculer/records-api-transport.d.ts +9 -0
- package/dist/kernel/moleculer/remote-logger.d.ts +2 -2
- package/dist/kernel/settings-view-types.d.ts +0 -7
- package/dist/kernel/transport/cap-route-resolver.d.ts +9 -38
- package/dist/phase6-declare-gate-Ci1-8uUn.js +98 -0
- package/dist/phase6-declare-gate-tkKOEitw.mjs +93 -0
- package/dist/read-all-rows-CVoO1ONM.js +29 -0
- package/dist/read-all-rows-TaPqdWNF.mjs +25 -0
- package/dist/records/read-all-rows.d.ts +6 -0
- package/dist/{restore-archive-9CGgeBzD.mjs → restore-archive-DR9MtO7J.mjs} +339 -9
- package/dist/{restore-archive-BMNXwWWD.js → restore-archive-DjJnCgap.js} +353 -5
- package/dist/tls/agent-https-names.d.ts +9 -13
- package/dist/{wal-maintenance-cRHR4rUY.js → wal-maintenance-CODGqhKY.js} +0 -0
- package/dist/{wal-maintenance-sIB32ONp.mjs → wal-maintenance-CfvgtQ7C.mjs} +0 -0
- package/package.json +22 -1
|
@@ -736,7 +736,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
736
736
|
return EventCategory;
|
|
737
737
|
}({});
|
|
738
738
|
//#endregion
|
|
739
|
-
//#region ../types/dist/sleep-
|
|
739
|
+
//#region ../types/dist/sleep-bZIhUvjd.mjs
|
|
740
740
|
/**
|
|
741
741
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
742
742
|
* window to float samples (D455).
|
|
@@ -848,21 +848,21 @@ function collectSecretConfigKeys(schema) {
|
|
|
848
848
|
for (const section of sectionsOf(schema)) for (const field of fieldsOf(section)) walkField(field, keys);
|
|
849
849
|
return keys;
|
|
850
850
|
}
|
|
851
|
-
function isRecord$
|
|
851
|
+
function isRecord$6(value) {
|
|
852
852
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
853
853
|
}
|
|
854
854
|
function sectionsOf(schema) {
|
|
855
|
-
if (!isRecord$
|
|
855
|
+
if (!isRecord$6(schema)) return [];
|
|
856
856
|
const sections = schema["sections"];
|
|
857
857
|
return Array.isArray(sections) ? sections : [];
|
|
858
858
|
}
|
|
859
859
|
function fieldsOf(node) {
|
|
860
|
-
if (!isRecord$
|
|
860
|
+
if (!isRecord$6(node)) return [];
|
|
861
861
|
const fields = node["fields"];
|
|
862
862
|
return Array.isArray(fields) ? fields : [];
|
|
863
863
|
}
|
|
864
864
|
function walkField(field, out) {
|
|
865
|
-
if (!isRecord$
|
|
865
|
+
if (!isRecord$6(field)) return;
|
|
866
866
|
const type = field["type"];
|
|
867
867
|
const key = field["key"];
|
|
868
868
|
if ((type === "password" || field["secret"] === true) && typeof key === "string" && key.length > 0) out.add(key);
|
|
@@ -900,7 +900,7 @@ function walkField(field, out) {
|
|
|
900
900
|
var SECRET_CLEAR = { $secretClear: true };
|
|
901
901
|
/** The `'***'` token D634 redaction writes for non-admins. */
|
|
902
902
|
var LEGACY_DEVICE_REDACTION = "***";
|
|
903
|
-
function isRecord$
|
|
903
|
+
function isRecord$5(value) {
|
|
904
904
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
905
905
|
}
|
|
906
906
|
function makeSecretMarker(ref) {
|
|
@@ -911,16 +911,16 @@ function makeSecretMarker(ref) {
|
|
|
911
911
|
}
|
|
912
912
|
/** A stored marker: an object whose `$secret` is a non-empty string. */
|
|
913
913
|
function isSecretMarker(value) {
|
|
914
|
-
if (!isRecord$
|
|
914
|
+
if (!isRecord$5(value)) return false;
|
|
915
915
|
const ref = value["$secret"];
|
|
916
916
|
return typeof ref === "string" && ref.length > 0;
|
|
917
917
|
}
|
|
918
918
|
/** Anything carrying a `$secret` key — a stored marker or a UI view of one. */
|
|
919
919
|
function isSecretMarkerLike(value) {
|
|
920
|
-
return isRecord$
|
|
920
|
+
return isRecord$5(value) && Object.prototype.hasOwnProperty.call(value, "$secret");
|
|
921
921
|
}
|
|
922
922
|
function isSecretClear(value) {
|
|
923
|
-
return isRecord$
|
|
923
|
+
return isRecord$5(value) && value["$secretClear"] === true;
|
|
924
924
|
}
|
|
925
925
|
/**
|
|
926
926
|
* The UI view of a stored secret field value: a marker becomes "set", inline
|
|
@@ -1589,7 +1589,7 @@ var KeychainWriteRefusedError = class extends Error {
|
|
|
1589
1589
|
}
|
|
1590
1590
|
};
|
|
1591
1591
|
var KEEP = { kind: "keep" };
|
|
1592
|
-
function isRecord$
|
|
1592
|
+
function isRecord$4(value) {
|
|
1593
1593
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1594
1594
|
}
|
|
1595
1595
|
function defaultMintId() {
|
|
@@ -1602,7 +1602,7 @@ function collectSecretMarkerRefs(value, out = []) {
|
|
|
1602
1602
|
return out;
|
|
1603
1603
|
}
|
|
1604
1604
|
if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
|
|
1605
|
-
else if (isRecord$
|
|
1605
|
+
else if (isRecord$4(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
|
|
1606
1606
|
return out;
|
|
1607
1607
|
}
|
|
1608
1608
|
async function storedValueEquals(secrets, marker, candidate) {
|
|
@@ -1657,7 +1657,7 @@ function rowId(row, idKey) {
|
|
|
1657
1657
|
return null;
|
|
1658
1658
|
}
|
|
1659
1659
|
async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
1660
|
-
const storedRows = Array.isArray(stored) ? stored.filter(isRecord$
|
|
1660
|
+
const storedRows = Array.isArray(stored) ? stored.filter(isRecord$4) : [];
|
|
1661
1661
|
if (!Array.isArray(incoming)) {
|
|
1662
1662
|
ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
|
|
1663
1663
|
return {
|
|
@@ -1673,7 +1673,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
|
1673
1673
|
const kept = /* @__PURE__ */ new Set();
|
|
1674
1674
|
const rows = [];
|
|
1675
1675
|
for (const row of incoming) {
|
|
1676
|
-
if (!isRecord$
|
|
1676
|
+
if (!isRecord$4(row)) {
|
|
1677
1677
|
rows.push(row);
|
|
1678
1678
|
continue;
|
|
1679
1679
|
}
|
|
@@ -1698,7 +1698,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
|
1698
1698
|
case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
|
|
1699
1699
|
case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
|
|
1700
1700
|
case "object": {
|
|
1701
|
-
if (!isRecord$
|
|
1701
|
+
if (!isRecord$4(incoming)) {
|
|
1702
1702
|
if (incoming === void 0) return KEEP;
|
|
1703
1703
|
ctx.deletes.push(...collectSecretMarkerRefs(stored));
|
|
1704
1704
|
return {
|
|
@@ -1706,7 +1706,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
|
1706
1706
|
value: incoming
|
|
1707
1707
|
};
|
|
1708
1708
|
}
|
|
1709
|
-
const storedObj = isRecord$
|
|
1709
|
+
const storedObj = isRecord$4(stored) ? stored : {};
|
|
1710
1710
|
return {
|
|
1711
1711
|
kind: "value",
|
|
1712
1712
|
value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
|
|
@@ -1829,7 +1829,7 @@ async function resolveSecretMarkers(value, secrets, options = {}) {
|
|
|
1829
1829
|
value: items
|
|
1830
1830
|
};
|
|
1831
1831
|
}
|
|
1832
|
-
if (isRecord$
|
|
1832
|
+
if (isRecord$4(v)) {
|
|
1833
1833
|
const out = {};
|
|
1834
1834
|
for (const [k, child] of Object.entries(v)) {
|
|
1835
1835
|
const s = substitute(child);
|
|
@@ -1861,7 +1861,7 @@ var SecretOverwriteRefusedError = class extends Error {
|
|
|
1861
1861
|
this.name = "SecretOverwriteRefusedError";
|
|
1862
1862
|
}
|
|
1863
1863
|
};
|
|
1864
|
-
function isRecord(value) {
|
|
1864
|
+
function isRecord$3(value) {
|
|
1865
1865
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1866
1866
|
}
|
|
1867
1867
|
function resolvedValue(pass, marker) {
|
|
@@ -1890,7 +1890,7 @@ function inArray(pass, incoming, stored) {
|
|
|
1890
1890
|
return incoming.map((item, index) => {
|
|
1891
1891
|
const twin = stored[index];
|
|
1892
1892
|
if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
|
|
1893
|
-
if (isRecord(item) && isRecord(twin)) return inArrayRow(pass, item, twin);
|
|
1893
|
+
if (isRecord$3(item) && isRecord$3(twin)) return inArrayRow(pass, item, twin);
|
|
1894
1894
|
if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
|
|
1895
1895
|
return item;
|
|
1896
1896
|
});
|
|
@@ -1901,7 +1901,7 @@ function inArrayRow(pass, incoming, stored) {
|
|
|
1901
1901
|
const twin = stored[key];
|
|
1902
1902
|
if (isSecretMarker(twin)) {
|
|
1903
1903
|
if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
|
|
1904
|
-
} else if (isRecord(value) && isRecord(twin)) out[key] = inArrayRow(pass, value, twin);
|
|
1904
|
+
} else if (isRecord$3(value) && isRecord$3(twin)) out[key] = inArrayRow(pass, value, twin);
|
|
1905
1905
|
else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
|
|
1906
1906
|
}
|
|
1907
1907
|
return out;
|
|
@@ -1909,7 +1909,7 @@ function inArrayRow(pass, incoming, stored) {
|
|
|
1909
1909
|
async function walk(pass, incoming, stored) {
|
|
1910
1910
|
if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
|
|
1911
1911
|
if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
|
|
1912
|
-
if (!isRecord(incoming) || !isRecord(stored)) return incoming;
|
|
1912
|
+
if (!isRecord$3(incoming) || !isRecord$3(stored)) return incoming;
|
|
1913
1913
|
const out = { ...incoming };
|
|
1914
1914
|
for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
|
|
1915
1915
|
return out;
|
|
@@ -1940,7 +1940,7 @@ async function restoreUnchangedSecrets(input) {
|
|
|
1940
1940
|
function isJsonEqual(a, b) {
|
|
1941
1941
|
if (Object.is(a, b)) return true;
|
|
1942
1942
|
if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
|
|
1943
|
-
if (isRecord(a) && isRecord(b)) {
|
|
1943
|
+
if (isRecord$3(a) && isRecord$3(b)) {
|
|
1944
1944
|
const keys = Object.keys(a);
|
|
1945
1945
|
if (keys.length !== Object.keys(b).length) return false;
|
|
1946
1946
|
return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
|
|
@@ -1964,7 +1964,7 @@ function markerKeysOf(blob, owner) {
|
|
|
1964
1964
|
}
|
|
1965
1965
|
function nodeFromStored(value, owner) {
|
|
1966
1966
|
if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
|
|
1967
|
-
if (!isRecord(value)) return null;
|
|
1967
|
+
if (!isRecord$3(value)) return null;
|
|
1968
1968
|
const children = /* @__PURE__ */ new Map();
|
|
1969
1969
|
for (const [key, child] of Object.entries(value)) {
|
|
1970
1970
|
const node = nodeFromStored(child, owner);
|
|
@@ -2765,7 +2765,7 @@ var BaseAddon = class {
|
|
|
2765
2765
|
if (!ctx) return;
|
|
2766
2766
|
const addonId = ctx.id;
|
|
2767
2767
|
setImmediate(() => {
|
|
2768
|
-
ctx.api.addons
|
|
2768
|
+
ctx.api.addons.restartAddon.mutate({ addonId }).then(() => {
|
|
2769
2769
|
ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: patchKeys.filter((k) => restartKeys.has(k)) } });
|
|
2770
2770
|
}).catch((err) => {
|
|
2771
2771
|
ctx.logger.error("addon auto-restart failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
@@ -3266,6 +3266,498 @@ var PeerBytesTicketSchema = z.object({
|
|
|
3266
3266
|
*/
|
|
3267
3267
|
declaredBytes: z.number().int().nonnegative().nullable()
|
|
3268
3268
|
});
|
|
3269
|
+
/** Limits and names of `ctx.records` (D881). One authority; the engine and the facade read it. */
|
|
3270
|
+
/** The files a kind may live in. `history` is device-history's (D850), never records. */
|
|
3271
|
+
var RECORD_DATABASES = ["settings", "events"];
|
|
3272
|
+
/** The classes of a kind: the `@durable` vocabulary, one authority (replaces the annotation). */
|
|
3273
|
+
var RECORD_CLASSES = [
|
|
3274
|
+
"config",
|
|
3275
|
+
"ledger",
|
|
3276
|
+
"audit",
|
|
3277
|
+
"mirror",
|
|
3278
|
+
"ephemeral"
|
|
3279
|
+
];
|
|
3280
|
+
var RECORD_DEFAULT_MAX_DATA_BYTES = 64 * 1024;
|
|
3281
|
+
var RECORD_MAX_DATA_BYTES = 1024 * 1024;
|
|
3282
|
+
var RECORD_BATCH_MAX = 1e3;
|
|
3283
|
+
var RECORD_BATCH_MAX_BYTES = 4 * 1024 * 1024;
|
|
3284
|
+
var RECORD_QUERY_MAX = 1e3;
|
|
3285
|
+
/** Rows one DELETE statement removes before the serving thread yields. */
|
|
3286
|
+
var RECORD_DELETE_BATCH = 5e3;
|
|
3287
|
+
/** A kind in the `settings` file may not bound itself above this (D447: high volume is `events`). */
|
|
3288
|
+
var RECORD_SETTINGS_MAX_ROWS = 5e4;
|
|
3289
|
+
/** The engine's TTL sweep cadence. */
|
|
3290
|
+
var RECORD_SWEEP_INTERVAL_MS = 10 * 6e4;
|
|
3291
|
+
/** The `Column`-free proof prefix: a ref collection for a kind's secret fields. */
|
|
3292
|
+
var RECORD_SECRET_COLLECTION_PREFIX = "records:";
|
|
3293
|
+
var PREFIX = "records/";
|
|
3294
|
+
/** The base of every records failure. `detail` is the human part of the message. */
|
|
3295
|
+
var RecordsError = class extends Error {
|
|
3296
|
+
code;
|
|
3297
|
+
detail;
|
|
3298
|
+
constructor(code, detail) {
|
|
3299
|
+
super(`${PREFIX}${code}: ${detail}`);
|
|
3300
|
+
this.name = "RecordsError";
|
|
3301
|
+
this.code = code;
|
|
3302
|
+
this.detail = detail;
|
|
3303
|
+
}
|
|
3304
|
+
};
|
|
3305
|
+
/** A write guarded by `ifRev` found another revision (or an existing row for `ifRev: 0`). */
|
|
3306
|
+
var RevConflictError = class extends RecordsError {
|
|
3307
|
+
constructor(detail) {
|
|
3308
|
+
super("rev-conflict", detail);
|
|
3309
|
+
this.name = "RevConflictError";
|
|
3310
|
+
}
|
|
3311
|
+
};
|
|
3312
|
+
/** `data` exceeds the kind's `maxDataBytes`. Bytes are never record fields (D613). */
|
|
3313
|
+
var RecordTooLargeError = class extends RecordsError {
|
|
3314
|
+
constructor(detail) {
|
|
3315
|
+
super("too-large", detail);
|
|
3316
|
+
this.name = "RecordTooLargeError";
|
|
3317
|
+
}
|
|
3318
|
+
};
|
|
3319
|
+
/** A filter, order or aggregate names a field no declared index serves. */
|
|
3320
|
+
var UnindexedFilterError = class extends RecordsError {
|
|
3321
|
+
constructor(detail) {
|
|
3322
|
+
super("unindexed-filter", detail);
|
|
3323
|
+
this.name = "UnindexedFilterError";
|
|
3324
|
+
}
|
|
3325
|
+
};
|
|
3326
|
+
/** A bulk delete with no predicate at all. */
|
|
3327
|
+
var FilterRequiredError = class extends RecordsError {
|
|
3328
|
+
constructor(detail) {
|
|
3329
|
+
super("filter-required", detail);
|
|
3330
|
+
this.name = "FilterRequiredError";
|
|
3331
|
+
}
|
|
3332
|
+
};
|
|
3333
|
+
/** The caller declared no such kind (another addon's kind is indistinguishable from none). */
|
|
3334
|
+
var UnknownRecordKindError = class extends RecordsError {
|
|
3335
|
+
constructor(detail) {
|
|
3336
|
+
super("unknown-kind", detail);
|
|
3337
|
+
this.name = "UnknownRecordKindError";
|
|
3338
|
+
}
|
|
3339
|
+
};
|
|
3340
|
+
var RecordNotFoundError = class extends RecordsError {
|
|
3341
|
+
constructor(detail) {
|
|
3342
|
+
super("not-found", detail);
|
|
3343
|
+
this.name = "RecordNotFoundError";
|
|
3344
|
+
}
|
|
3345
|
+
};
|
|
3346
|
+
/** A unique index refused the write. */
|
|
3347
|
+
var RecordUniqueViolationError = class extends RecordsError {
|
|
3348
|
+
constructor(detail) {
|
|
3349
|
+
super("unique-violation", detail);
|
|
3350
|
+
this.name = "RecordUniqueViolationError";
|
|
3351
|
+
}
|
|
3352
|
+
};
|
|
3353
|
+
/** A secret field held a plain string where only a keychain marker may be stored. */
|
|
3354
|
+
var PlaintextSecretError = class extends RecordsError {
|
|
3355
|
+
constructor(detail) {
|
|
3356
|
+
super("plaintext-secret", detail);
|
|
3357
|
+
this.name = "PlaintextSecretError";
|
|
3358
|
+
}
|
|
3359
|
+
};
|
|
3360
|
+
/** A marker whose ref is not the row's own (the D878 rule). */
|
|
3361
|
+
var ForeignSecretMarkerError = class extends RecordsError {
|
|
3362
|
+
constructor(detail) {
|
|
3363
|
+
super("foreign-marker", detail);
|
|
3364
|
+
this.name = "ForeignSecretMarkerError";
|
|
3365
|
+
}
|
|
3366
|
+
};
|
|
3367
|
+
var InvalidRecordError = class extends RecordsError {
|
|
3368
|
+
constructor(detail) {
|
|
3369
|
+
super("invalid-record", detail);
|
|
3370
|
+
this.name = "InvalidRecordError";
|
|
3371
|
+
}
|
|
3372
|
+
};
|
|
3373
|
+
/** A kind declaration the engine refuses (non-additive change, bad shape, wrong file). */
|
|
3374
|
+
var DeclarationRefusedError = class extends RecordsError {
|
|
3375
|
+
constructor(detail) {
|
|
3376
|
+
super("declaration-refused", detail);
|
|
3377
|
+
this.name = "DeclarationRefusedError";
|
|
3378
|
+
}
|
|
3379
|
+
};
|
|
3380
|
+
var NoCallerError = class extends RecordsError {
|
|
3381
|
+
constructor(detail) {
|
|
3382
|
+
super("no-caller", detail);
|
|
3383
|
+
this.name = "NoCallerError";
|
|
3384
|
+
}
|
|
3385
|
+
};
|
|
3386
|
+
var BatchTooLargeError = class extends RecordsError {
|
|
3387
|
+
constructor(detail) {
|
|
3388
|
+
super("batch-too-large", detail);
|
|
3389
|
+
this.name = "BatchTooLargeError";
|
|
3390
|
+
}
|
|
3391
|
+
};
|
|
3392
|
+
function defOf(schema) {
|
|
3393
|
+
const zodBag = Reflect.get(schema, "_zod");
|
|
3394
|
+
if (typeof zodBag !== "object" || zodBag === null) return {};
|
|
3395
|
+
const def = Reflect.get(zodBag, "def");
|
|
3396
|
+
if (typeof def !== "object" || def === null) return {};
|
|
3397
|
+
return def;
|
|
3398
|
+
}
|
|
3399
|
+
function declaredHere(schema) {
|
|
3400
|
+
return z.globalRegistry.get(schema)?.secret === true;
|
|
3401
|
+
}
|
|
3402
|
+
/** Wrapper kinds whose `innerType` is the field itself. */
|
|
3403
|
+
var WRAPPERS = new Set([
|
|
3404
|
+
"optional",
|
|
3405
|
+
"nullable",
|
|
3406
|
+
"default",
|
|
3407
|
+
"prefault",
|
|
3408
|
+
"catch",
|
|
3409
|
+
"readonly",
|
|
3410
|
+
"nonoptional"
|
|
3411
|
+
]);
|
|
3412
|
+
/**
|
|
3413
|
+
* The schema layers that make up ONE field: the schema itself and every
|
|
3414
|
+
* wrapper below it (optional / default / nullable / readonly / catch), plus
|
|
3415
|
+
* both sides of a pipe (`z.preprocess` puts the real schema on `out`,
|
|
3416
|
+
* `.transform` on `in`).
|
|
3417
|
+
*/
|
|
3418
|
+
function layersOf(schema) {
|
|
3419
|
+
const out = [];
|
|
3420
|
+
const queue = [schema];
|
|
3421
|
+
while (queue.length > 0) {
|
|
3422
|
+
const s = queue.shift();
|
|
3423
|
+
if (!s || out.includes(s)) continue;
|
|
3424
|
+
out.push(s);
|
|
3425
|
+
const def = defOf(s);
|
|
3426
|
+
if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
|
|
3427
|
+
if (def.type === "pipe") {
|
|
3428
|
+
if (def.in) queue.push(def.in);
|
|
3429
|
+
if (def.out) queue.push(def.out);
|
|
3430
|
+
}
|
|
3431
|
+
}
|
|
3432
|
+
return out;
|
|
3433
|
+
}
|
|
3434
|
+
/** True when any layer of this field declares `.meta({ secret: true })`. */
|
|
3435
|
+
function isZodSecret(schema) {
|
|
3436
|
+
return layersOf(schema).some(declaredHere);
|
|
3437
|
+
}
|
|
3438
|
+
/**
|
|
3439
|
+
* Every declared secret path in a config schema: dotted keys, `[]` for "each
|
|
3440
|
+
* element of this array" (`connection.password`, `rows[].token`). A declared
|
|
3441
|
+
* object or array is reported as one path and not descended into — everything
|
|
3442
|
+
* under it is secret.
|
|
3443
|
+
*/
|
|
3444
|
+
function collectZodSecretPaths(schema, prefix = "") {
|
|
3445
|
+
if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
|
|
3446
|
+
const paths = [];
|
|
3447
|
+
for (const layer of layersOf(schema)) {
|
|
3448
|
+
const def = defOf(layer);
|
|
3449
|
+
if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
|
|
3450
|
+
else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
|
|
3451
|
+
else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
|
|
3452
|
+
else if (def.type === "intersection") {
|
|
3453
|
+
if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
|
|
3454
|
+
if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
|
|
3455
|
+
}
|
|
3456
|
+
}
|
|
3457
|
+
return [...new Set(paths)];
|
|
3458
|
+
}
|
|
3459
|
+
/**
|
|
3460
|
+
* Secret fields of a record, addressed the way a Zod schema declares them
|
|
3461
|
+
* (`collectZodSecretPaths`): dotted keys, `[]` for "each element of this array"
|
|
3462
|
+
* (`auth.accessToken`, `headers[].value`).
|
|
3463
|
+
*
|
|
3464
|
+
* Array elements are matched by a DECLARED id key (`secretArrayKeys`:
|
|
3465
|
+
* `{ headers: 'name' }`), never by index, so reordering a list keeps every
|
|
3466
|
+
* keychain ref (the same rule as `arrayItemFieldPath`). The concrete path of a
|
|
3467
|
+
* leaf names its element: `headers[X-Api].value`.
|
|
3468
|
+
*
|
|
3469
|
+
* Pure and browser-safe. Nothing here mutates: every transform returns a new value.
|
|
3470
|
+
*/
|
|
3471
|
+
/** The array prefixes (declared form, e.g. `headers` or `a.headers`) of a path. */
|
|
3472
|
+
function parseSecretPath(path) {
|
|
3473
|
+
if (path.length === 0) throw new InvalidRecordError("an empty secret path");
|
|
3474
|
+
return path.split(".").map((raw) => {
|
|
3475
|
+
const each = raw.endsWith("[]");
|
|
3476
|
+
const key = each ? raw.slice(0, -2) : raw;
|
|
3477
|
+
if (key.length === 0) throw new InvalidRecordError(`secret path "${path}" has an empty segment`);
|
|
3478
|
+
return {
|
|
3479
|
+
key,
|
|
3480
|
+
each
|
|
3481
|
+
};
|
|
3482
|
+
});
|
|
3483
|
+
}
|
|
3484
|
+
/** The declared array prefixes of `path` that need an id key (`headers`, `a.rows`). */
|
|
3485
|
+
function secretArrayPrefixes(path) {
|
|
3486
|
+
const segments = parseSecretPath(path);
|
|
3487
|
+
const prefixes = [];
|
|
3488
|
+
const walked = [];
|
|
3489
|
+
for (const segment of segments) {
|
|
3490
|
+
walked.push(segment.key);
|
|
3491
|
+
if (segment.each) prefixes.push(walked.join("."));
|
|
3492
|
+
}
|
|
3493
|
+
return prefixes;
|
|
3494
|
+
}
|
|
3495
|
+
function isRecord$2(value) {
|
|
3496
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
3497
|
+
}
|
|
3498
|
+
function elementId(element, idKey, declared, prefix) {
|
|
3499
|
+
const id = isRecord$2(element) ? element[idKey] : void 0;
|
|
3500
|
+
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`);
|
|
3501
|
+
return id;
|
|
3502
|
+
}
|
|
3503
|
+
/**
|
|
3504
|
+
* Visit every secret leaf PRESENT in `data` (an absent branch has nothing to
|
|
3505
|
+
* visit). `replace` returns the new leaf value, or {@link REMOVE_LEAF}; the
|
|
3506
|
+
* result is a new body, `data` is untouched.
|
|
3507
|
+
*/
|
|
3508
|
+
var REMOVE_LEAF = Symbol("remove-leaf");
|
|
3509
|
+
function mapAt(node, segments, index, walkedKeys, concretePrefix, declared, arrayKeys, visit) {
|
|
3510
|
+
if (!isRecord$2(node)) return node;
|
|
3511
|
+
const segment = segments[index];
|
|
3512
|
+
if (segment === void 0) return node;
|
|
3513
|
+
if (!Object.prototype.hasOwnProperty.call(node, segment.key)) return node;
|
|
3514
|
+
const child = node[segment.key];
|
|
3515
|
+
const keys = [...walkedKeys, segment.key];
|
|
3516
|
+
const last = index === segments.length - 1;
|
|
3517
|
+
if (segment.each) {
|
|
3518
|
+
if (!Array.isArray(child)) return node;
|
|
3519
|
+
const prefix = keys.join(".");
|
|
3520
|
+
const idKey = arrayKeys[prefix];
|
|
3521
|
+
if (idKey === void 0) throw new InvalidRecordError(`"${declared}": no id key declared for the array "${prefix}"`);
|
|
3522
|
+
const mapped = child.map((element) => {
|
|
3523
|
+
const id = elementId(element, idKey, declared, prefix);
|
|
3524
|
+
const concrete = `${concretePrefix}${concretePrefix.length > 0 ? "." : ""}${segment.key}[${encodeURIComponent(id)}]`;
|
|
3525
|
+
return last ? element : mapAt(element, segments, index + 1, keys, concrete, declared, arrayKeys, visit);
|
|
3526
|
+
});
|
|
3527
|
+
return {
|
|
3528
|
+
...node,
|
|
3529
|
+
[segment.key]: mapped
|
|
3530
|
+
};
|
|
3531
|
+
}
|
|
3532
|
+
const concrete = `${concretePrefix}${concretePrefix.length > 0 ? "." : ""}${segment.key}`;
|
|
3533
|
+
if (last) {
|
|
3534
|
+
const replacement = visit({
|
|
3535
|
+
declared,
|
|
3536
|
+
concrete,
|
|
3537
|
+
value: child
|
|
3538
|
+
});
|
|
3539
|
+
if (replacement === REMOVE_LEAF) return Object.fromEntries(Object.entries(node).filter(([key]) => key !== segment.key));
|
|
3540
|
+
return {
|
|
3541
|
+
...node,
|
|
3542
|
+
[segment.key]: replacement
|
|
3543
|
+
};
|
|
3544
|
+
}
|
|
3545
|
+
return {
|
|
3546
|
+
...node,
|
|
3547
|
+
[segment.key]: mapAt(child, segments, index + 1, keys, concrete, declared, arrayKeys, visit)
|
|
3548
|
+
};
|
|
3549
|
+
}
|
|
3550
|
+
/** Replace/remove every present secret leaf; returns a NEW body. */
|
|
3551
|
+
function mapSecretLeaves(data, paths, arrayKeys, visit) {
|
|
3552
|
+
let current = data;
|
|
3553
|
+
for (const declared of paths) current = mapAt(current, parseSecretPath(declared), 0, [], "", declared, arrayKeys, visit);
|
|
3554
|
+
return current;
|
|
3555
|
+
}
|
|
3556
|
+
/** Every present secret leaf, read-only. */
|
|
3557
|
+
function collectSecretLeaves(data, paths, arrayKeys) {
|
|
3558
|
+
const found = [];
|
|
3559
|
+
mapSecretLeaves(data, paths, arrayKeys, (leaf) => {
|
|
3560
|
+
found.push(leaf);
|
|
3561
|
+
return leaf.value;
|
|
3562
|
+
});
|
|
3563
|
+
return found;
|
|
3564
|
+
}
|
|
3565
|
+
/**
|
|
3566
|
+
* The keychain collection name a kind's secrets live under. Prefixed so a
|
|
3567
|
+
* record's refs never collide with the refs a legacy collection of the same name
|
|
3568
|
+
* already holds during an adoption.
|
|
3569
|
+
*/
|
|
3570
|
+
function recordSecretCollection(kind) {
|
|
3571
|
+
return `${RECORD_SECRET_COLLECTION_PREFIX}${kind}`;
|
|
3572
|
+
}
|
|
3573
|
+
/** The ONE ref a row's secret field may carry: the engine and the facade both build it here. */
|
|
3574
|
+
function recordSecretRef(owner, kind, rowId, concretePath) {
|
|
3575
|
+
return buildSecretRef({
|
|
3576
|
+
owner,
|
|
3577
|
+
scope: {
|
|
3578
|
+
kind: "row",
|
|
3579
|
+
collection: recordSecretCollection(kind),
|
|
3580
|
+
rowId
|
|
3581
|
+
},
|
|
3582
|
+
fieldPath: concretePath
|
|
3583
|
+
});
|
|
3584
|
+
}
|
|
3585
|
+
/**
|
|
3586
|
+
* Record kinds (D881): the declaration an addon makes of one kind of fact, the
|
|
3587
|
+
* Zod row schema that describes it, and the helper that turns the two into the
|
|
3588
|
+
* JSON the engine stores.
|
|
3589
|
+
*
|
|
3590
|
+
* A kind is declared ONCE, next to the code that owns it, and the engine's
|
|
3591
|
+
* reconciler creates its indexes - nothing creates DDL at runtime from a write.
|
|
3592
|
+
* Everything the generic machinery needs (secret fields, the entry descriptor)
|
|
3593
|
+
* is DERIVED from the Zod schema: `.meta({ secret: true })` marks a credential,
|
|
3594
|
+
* never a field name (D879).
|
|
3595
|
+
*/
|
|
3596
|
+
/** A JSON field path: `trackId`, `auth.accessToken`. Charset-restricted: it is rendered into DDL. */
|
|
3597
|
+
var RecordFieldPathSchema = z.string().regex(/^[A-Za-z_][A-Za-z0-9_]{0,63}(\.[A-Za-z_][A-Za-z0-9_]{0,63}){0,3}$/);
|
|
3598
|
+
var RecordIndexSchema = z.object({
|
|
3599
|
+
name: z.string().regex(/^[a-z][a-z0-9_]{0,31}$/),
|
|
3600
|
+
fields: z.array(RecordFieldPathSchema).min(1).max(4),
|
|
3601
|
+
unique: z.boolean().optional()
|
|
3602
|
+
}).strict();
|
|
3603
|
+
var RecordRetentionSchema = z.union([
|
|
3604
|
+
z.object({
|
|
3605
|
+
ttlMs: z.number().int().positive(),
|
|
3606
|
+
from: z.enum(["at", "write"])
|
|
3607
|
+
}).strict(),
|
|
3608
|
+
z.object({
|
|
3609
|
+
maxRows: z.number().int().positive().optional(),
|
|
3610
|
+
maxRowsPerDevice: z.number().int().positive().optional()
|
|
3611
|
+
}).strict().refine((r) => r.maxRows !== void 0 || r.maxRowsPerDevice !== void 0, { message: "name maxRows, maxRowsPerDevice or both" }),
|
|
3612
|
+
z.object({
|
|
3613
|
+
owner: z.string().min(1),
|
|
3614
|
+
reason: z.string().min(1)
|
|
3615
|
+
}).strict(),
|
|
3616
|
+
z.object({ none: z.string().min(1) }).strict()
|
|
3617
|
+
]);
|
|
3618
|
+
/** The descriptor a generic entries UI reads (D881 "generic entries"). */
|
|
3619
|
+
var EntryDescriptorSchema = z.object({
|
|
3620
|
+
title: z.string().min(1),
|
|
3621
|
+
/** The record body field shown as the entry's name. */
|
|
3622
|
+
nameField: z.string().min(1),
|
|
3623
|
+
/** JSON Schema of the entry body; `secret: true` marks a password field. */
|
|
3624
|
+
fields: z.record(z.string(), z.unknown())
|
|
3625
|
+
}).strict();
|
|
3626
|
+
/** What crosses the wire and sits in the engine's catalog: JSON only, no Zod. */
|
|
3627
|
+
var RecordKindDeclarationSchema = z.object({
|
|
3628
|
+
database: z.enum(RECORD_DATABASES).default("settings"),
|
|
3629
|
+
class: z.enum(RECORD_CLASSES),
|
|
3630
|
+
writeTrigger: z.string().min(1),
|
|
3631
|
+
device: z.enum([
|
|
3632
|
+
"required",
|
|
3633
|
+
"optional",
|
|
3634
|
+
"none"
|
|
3635
|
+
]).default("none"),
|
|
3636
|
+
at: z.enum(["required", "none"]).default("none"),
|
|
3637
|
+
indexes: z.array(RecordIndexSchema).max(8).default([]),
|
|
3638
|
+
retention: RecordRetentionSchema,
|
|
3639
|
+
deviceRemoval: z.enum(["delete", "none"]).default("none"),
|
|
3640
|
+
maxDataBytes: z.number().int().positive().max(RECORD_MAX_DATA_BYTES).default(RECORD_DEFAULT_MAX_DATA_BYTES),
|
|
3641
|
+
/** Derived from the Zod schema; never written by hand. */
|
|
3642
|
+
secretPaths: z.array(z.string().min(1)).default([]),
|
|
3643
|
+
/** The id key of each array that carries a secret (`{ headers: 'name' }`). */
|
|
3644
|
+
secretArrayKeys: z.record(z.string(), z.string()).default({}),
|
|
3645
|
+
/** The legacy table this kind adopts from; the boot guard reads it (D853: no migration code). */
|
|
3646
|
+
adoptsFrom: z.string().min(1).optional(),
|
|
3647
|
+
/** Kinds that must agree through `transact` sit in one file under one family name. */
|
|
3648
|
+
transactFamily: z.string().min(1).optional(),
|
|
3649
|
+
entry: EntryDescriptorSchema.optional()
|
|
3650
|
+
}).strict();
|
|
3651
|
+
/** The kind names: lower-case, dash separated, short enough for an index name. */
|
|
3652
|
+
var RecordKindNameSchema = z.string().regex(/^[a-z][a-z0-9-]{0,47}$/);
|
|
3653
|
+
/** Cross-field rules a declaration must satisfy. Throws {@link DeclarationRefusedError}. */
|
|
3654
|
+
function assertValidDeclaration(name, decl) {
|
|
3655
|
+
const refuse = (why) => {
|
|
3656
|
+
throw new DeclarationRefusedError(`kind "${name}": ${why}`);
|
|
3657
|
+
};
|
|
3658
|
+
if (!RecordKindNameSchema.safeParse(name).success) refuse("the name must be lower-case-dashed");
|
|
3659
|
+
const seen = /* @__PURE__ */ new Set();
|
|
3660
|
+
for (const index of decl.indexes) {
|
|
3661
|
+
if (seen.has(index.name)) refuse(`index name "${index.name}" is declared twice`);
|
|
3662
|
+
seen.add(index.name);
|
|
3663
|
+
}
|
|
3664
|
+
const { retention } = decl;
|
|
3665
|
+
const hasSecrets = decl.secretPaths.length > 0;
|
|
3666
|
+
if ("ttlMs" in retention) {
|
|
3667
|
+
if (retention.from === "at" && decl.at !== "required") refuse("a ttl from \"at\" needs at: \"required\"");
|
|
3668
|
+
if (hasSecrets) refuse("a kind with secret fields cannot use engine TTL (its keychain values would be orphaned)");
|
|
3669
|
+
}
|
|
3670
|
+
if ("maxRows" in retention || "maxRowsPerDevice" in retention) {
|
|
3671
|
+
if (retention.maxRowsPerDevice !== void 0 && decl.device !== "required") refuse("maxRowsPerDevice needs device: \"required\"");
|
|
3672
|
+
if (decl.at !== "required") refuse("a row bound trims the oldest \"at\": it needs at: \"required\"");
|
|
3673
|
+
if (hasSecrets) refuse("a kind with secret fields cannot use an engine row bound");
|
|
3674
|
+
const bound = Math.max(retention.maxRows ?? 0, retention.maxRowsPerDevice ?? 0);
|
|
3675
|
+
if (decl.database === "settings" && bound > 5e4) refuse(`a row bound above ${RECORD_SETTINGS_MAX_ROWS} belongs in database: "events" (a big delete on the settings thread stalls every configuration read)`);
|
|
3676
|
+
}
|
|
3677
|
+
if (decl.deviceRemoval === "delete" && decl.device === "none") refuse("deviceRemoval: \"delete\" needs a device: \"required\" or \"optional\"");
|
|
3678
|
+
for (const path of decl.secretPaths) for (const prefix of secretArrayPrefixes(path)) if (decl.secretArrayKeys[prefix] === void 0) refuse(`secret path "${path}" crosses the array "${prefix}": declare its id key in secretArrayKeys`);
|
|
3679
|
+
}
|
|
3680
|
+
function bodyFieldsOf(schema) {
|
|
3681
|
+
return { ...z.toJSONSchema(schema, {
|
|
3682
|
+
unrepresentable: "any",
|
|
3683
|
+
io: "input"
|
|
3684
|
+
}) };
|
|
3685
|
+
}
|
|
3686
|
+
function isRecordLike(value) {
|
|
3687
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
3688
|
+
}
|
|
3689
|
+
/** Does every branch of the body schema carry `field`? (A discriminated union has several.) */
|
|
3690
|
+
function hasNameField(json, field) {
|
|
3691
|
+
const branches = json["oneOf"] ?? json["anyOf"];
|
|
3692
|
+
if (Array.isArray(branches)) return branches.length > 0 && branches.every((b) => isRecordLike(b) && hasNameField(b, field));
|
|
3693
|
+
const properties = json["properties"];
|
|
3694
|
+
return isRecordLike(properties) && Object.prototype.hasOwnProperty.call(properties, field);
|
|
3695
|
+
}
|
|
3696
|
+
/**
|
|
3697
|
+
* Declare the kinds of a package. The keys are the kind names. The result is
|
|
3698
|
+
* what `ctx.records.declare` sends to the engine and what `ctx.records.kind`
|
|
3699
|
+
* types its handle from.
|
|
3700
|
+
*/
|
|
3701
|
+
function defineRecordKinds(specs) {
|
|
3702
|
+
const out = {};
|
|
3703
|
+
for (const [name, spec] of Object.entries(specs)) {
|
|
3704
|
+
const secretPaths = collectZodSecretPaths(spec.schema);
|
|
3705
|
+
const nameField = spec.entry?.nameField ?? "name";
|
|
3706
|
+
const fields = bodyFieldsOf(spec.schema);
|
|
3707
|
+
if (spec.entry !== void 0 && !hasNameField(fields, nameField)) throw new DeclarationRefusedError(`kind "${name}": an entry kind's schema needs a "${nameField}" field`);
|
|
3708
|
+
const parsed = RecordKindDeclarationSchema.parse({
|
|
3709
|
+
database: spec.database,
|
|
3710
|
+
class: spec.class,
|
|
3711
|
+
writeTrigger: spec.writeTrigger,
|
|
3712
|
+
device: spec.device,
|
|
3713
|
+
at: spec.at,
|
|
3714
|
+
indexes: spec.indexes === void 0 ? void 0 : [...spec.indexes],
|
|
3715
|
+
retention: spec.retention,
|
|
3716
|
+
deviceRemoval: spec.deviceRemoval,
|
|
3717
|
+
maxDataBytes: spec.maxDataBytes,
|
|
3718
|
+
secretPaths: [...secretPaths],
|
|
3719
|
+
secretArrayKeys: spec.secretArrayKeys === void 0 ? void 0 : { ...spec.secretArrayKeys },
|
|
3720
|
+
adoptsFrom: spec.adoptsFrom,
|
|
3721
|
+
transactFamily: spec.transactFamily,
|
|
3722
|
+
entry: spec.entry === void 0 ? void 0 : {
|
|
3723
|
+
title: spec.entry.title,
|
|
3724
|
+
nameField,
|
|
3725
|
+
fields
|
|
3726
|
+
}
|
|
3727
|
+
});
|
|
3728
|
+
assertValidDeclaration(name, parsed);
|
|
3729
|
+
out[name] = {
|
|
3730
|
+
name,
|
|
3731
|
+
schema: spec.schema,
|
|
3732
|
+
declaration: parsed
|
|
3733
|
+
};
|
|
3734
|
+
}
|
|
3735
|
+
return out;
|
|
3736
|
+
}
|
|
3737
|
+
/** The wire form of a package's kinds: name -> declaration. */
|
|
3738
|
+
function declarationsOf(kinds) {
|
|
3739
|
+
return Object.fromEntries(Object.entries(kinds).map(([name, kind]) => [name, kind.declaration]));
|
|
3740
|
+
}
|
|
3741
|
+
/** When non-null, `from` names an addon-settings brokers blob, not a SQL table. */
|
|
3742
|
+
function parseSettingsBrokersAdoptsFrom(from) {
|
|
3743
|
+
if (!from.startsWith("@settings-brokers/")) return null;
|
|
3744
|
+
const addonId = from.slice(18);
|
|
3745
|
+
return addonId.length > 0 ? addonId : null;
|
|
3746
|
+
}
|
|
3747
|
+
/** When non-null, `from` names an addon-settings array blob, not a SQL table. */
|
|
3748
|
+
function parseSettingsArrayAdoptsFrom(from) {
|
|
3749
|
+
if (!from.startsWith("@settings-array/")) return null;
|
|
3750
|
+
const rest = from.slice(16);
|
|
3751
|
+
const slash = rest.indexOf("/");
|
|
3752
|
+
if (slash <= 0 || slash >= rest.length - 1) return null;
|
|
3753
|
+
const addonId = rest.slice(0, slash);
|
|
3754
|
+
const settingsKey = rest.slice(slash + 1);
|
|
3755
|
+
if (addonId.length === 0 || settingsKey.length === 0) return null;
|
|
3756
|
+
return {
|
|
3757
|
+
addonId,
|
|
3758
|
+
settingsKey
|
|
3759
|
+
};
|
|
3760
|
+
}
|
|
3269
3761
|
/** Shared Zod schemas used across streaming capabilities. */
|
|
3270
3762
|
var CamProfileSchema = z.enum([
|
|
3271
3763
|
"high",
|
|
@@ -4275,6 +4767,28 @@ function customAction(input, output, options) {
|
|
|
4275
4767
|
...options?.caller ? { caller: "required" } : {}
|
|
4276
4768
|
};
|
|
4277
4769
|
}
|
|
4770
|
+
/**
|
|
4771
|
+
* Every cap whose provider reads a `callerAddonId` in its input (the keychain's
|
|
4772
|
+
* owner check, device-history's `not-owner`, records' owner).
|
|
4773
|
+
*
|
|
4774
|
+
* The stamp is set ONLY by the transport (`stampCallerAddonId`, or stated by a
|
|
4775
|
+
* hub in-process caller). The generated HTTP/tRPC mount parses input with
|
|
4776
|
+
* `.loose()`, so without this a session could add the key itself and act as
|
|
4777
|
+
* another addon. The mount strips it for these caps.
|
|
4778
|
+
*/
|
|
4779
|
+
var CALLER_STAMPED_CAPABILITIES = [
|
|
4780
|
+
"keychain",
|
|
4781
|
+
"device-history",
|
|
4782
|
+
"records",
|
|
4783
|
+
"integrations",
|
|
4784
|
+
"device-manager"
|
|
4785
|
+
];
|
|
4786
|
+
/** A copy of `input` without the caller stamp. Anything that is not a plain object passes through. */
|
|
4787
|
+
function withoutCallerStamp(input) {
|
|
4788
|
+
if (input === null || typeof input !== "object" || Array.isArray(input)) return input;
|
|
4789
|
+
if (!Object.prototype.hasOwnProperty.call(input, "callerAddonId")) return input;
|
|
4790
|
+
return Object.fromEntries(Object.entries(input).filter(([key]) => key !== "callerAddonId"));
|
|
4791
|
+
}
|
|
4278
4792
|
var StaticDirOutputSchema = z.object({ staticDir: z.string() });
|
|
4279
4793
|
var VersionOutputSchema = z.object({ version: z.string() });
|
|
4280
4794
|
/**
|
|
@@ -4467,69 +4981,6 @@ var RUNTIME_DEFAULTS = {
|
|
|
4467
4981
|
"ffmpeg.threadCount": 0,
|
|
4468
4982
|
"auth.tokenExpiry": "30d"
|
|
4469
4983
|
};
|
|
4470
|
-
function defOf(schema) {
|
|
4471
|
-
return schema._zod?.def ?? {};
|
|
4472
|
-
}
|
|
4473
|
-
function declaredHere(schema) {
|
|
4474
|
-
return z.globalRegistry.get(schema)?.secret === true;
|
|
4475
|
-
}
|
|
4476
|
-
/** Wrapper kinds whose `innerType` is the field itself. */
|
|
4477
|
-
var WRAPPERS = new Set([
|
|
4478
|
-
"optional",
|
|
4479
|
-
"nullable",
|
|
4480
|
-
"default",
|
|
4481
|
-
"prefault",
|
|
4482
|
-
"catch",
|
|
4483
|
-
"readonly",
|
|
4484
|
-
"nonoptional"
|
|
4485
|
-
]);
|
|
4486
|
-
/**
|
|
4487
|
-
* The schema layers that make up ONE field: the schema itself and every
|
|
4488
|
-
* wrapper below it (optional / default / nullable / readonly / catch), plus
|
|
4489
|
-
* both sides of a pipe (`z.preprocess` puts the real schema on `out`,
|
|
4490
|
-
* `.transform` on `in`).
|
|
4491
|
-
*/
|
|
4492
|
-
function layersOf(schema) {
|
|
4493
|
-
const out = [];
|
|
4494
|
-
const queue = [schema];
|
|
4495
|
-
while (queue.length > 0) {
|
|
4496
|
-
const s = queue.shift();
|
|
4497
|
-
if (!s || out.includes(s)) continue;
|
|
4498
|
-
out.push(s);
|
|
4499
|
-
const def = defOf(s);
|
|
4500
|
-
if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
|
|
4501
|
-
if (def.type === "pipe") {
|
|
4502
|
-
if (def.in) queue.push(def.in);
|
|
4503
|
-
if (def.out) queue.push(def.out);
|
|
4504
|
-
}
|
|
4505
|
-
}
|
|
4506
|
-
return out;
|
|
4507
|
-
}
|
|
4508
|
-
/** True when any layer of this field declares `.meta({ secret: true })`. */
|
|
4509
|
-
function isZodSecret(schema) {
|
|
4510
|
-
return layersOf(schema).some(declaredHere);
|
|
4511
|
-
}
|
|
4512
|
-
/**
|
|
4513
|
-
* Every declared secret path in a config schema: dotted keys, `[]` for "each
|
|
4514
|
-
* element of this array" (`connection.password`, `rows[].token`). A declared
|
|
4515
|
-
* object or array is reported as one path and not descended into — everything
|
|
4516
|
-
* under it is secret.
|
|
4517
|
-
*/
|
|
4518
|
-
function collectZodSecretPaths(schema, prefix = "") {
|
|
4519
|
-
if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
|
|
4520
|
-
const paths = [];
|
|
4521
|
-
for (const layer of layersOf(schema)) {
|
|
4522
|
-
const def = defOf(layer);
|
|
4523
|
-
if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
|
|
4524
|
-
else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
|
|
4525
|
-
else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
|
|
4526
|
-
else if (def.type === "intersection") {
|
|
4527
|
-
if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
|
|
4528
|
-
if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
|
|
4529
|
-
}
|
|
4530
|
-
}
|
|
4531
|
-
return [...new Set(paths)];
|
|
4532
|
-
}
|
|
4533
4984
|
/**
|
|
4534
4985
|
* A user-facing error with a STABLE code (D863).
|
|
4535
4986
|
*
|
|
@@ -16328,6 +16779,254 @@ id: z.union([z.string(), z.number()]) }), {
|
|
|
16328
16779
|
})
|
|
16329
16780
|
}
|
|
16330
16781
|
};
|
|
16782
|
+
/**
|
|
16783
|
+
* records - an addon's own facts and documents (D881): ledgers, audit rows,
|
|
16784
|
+
* config documents, mirrors. The third storage API next to `ctx.settings`
|
|
16785
|
+
* (operator intent, D870) and device-history (numbers over time, D850).
|
|
16786
|
+
*
|
|
16787
|
+
* Who the OWNER is: `callerAddonId`, stamped by the transport on a call that
|
|
16788
|
+
* crossed a process and stated by a hub in-process caller (`ctx.records` does
|
|
16789
|
+
* that with the addon id closed over). It is deliberately NOT in any input
|
|
16790
|
+
* schema, so a session can never supply it, and a call with no stamp is refused
|
|
16791
|
+
* `records/no-caller`. A kind is readable and writable only by its owner; other
|
|
16792
|
+
* addons go through the owner's capability.
|
|
16793
|
+
*
|
|
16794
|
+
* Every read is three-way: a row, `null`, or the call THROWS. A failed read is
|
|
16795
|
+
* never `[]`. Secret fields are never on the wire: a read shows the
|
|
16796
|
+
* redaction token, `secretRefs` hands the owner's `ctx.secrets` the refs it
|
|
16797
|
+
* resolves itself, and a write may carry only a keychain marker bound to the
|
|
16798
|
+
* row's own ref.
|
|
16799
|
+
*
|
|
16800
|
+
* Internal: addons reach it through `ctx.records`, never directly.
|
|
16801
|
+
*/
|
|
16802
|
+
var RecordIdSchema = z.string().min(1).max(256);
|
|
16803
|
+
/** A JSON object body. Size is the engine's check (`maxDataBytes`), not a schema's. */
|
|
16804
|
+
var RecordBodySchema = z.record(z.string(), z.unknown());
|
|
16805
|
+
var RecordInputSchema = z.object({
|
|
16806
|
+
id: RecordIdSchema,
|
|
16807
|
+
/** The device this row belongs to (D865 removal, per-device reads). */
|
|
16808
|
+
deviceId: z.number().int().optional(),
|
|
16809
|
+
/** The domain clock, ms: observed / created / opened. */
|
|
16810
|
+
at: z.number().int().optional(),
|
|
16811
|
+
/** Producer-set expiry, ms. Refused on a kind whose retention is an engine TTL. */
|
|
16812
|
+
expiresAt: z.number().int().optional(),
|
|
16813
|
+
data: RecordBodySchema
|
|
16814
|
+
});
|
|
16815
|
+
var RecordViewSchema = z.object({
|
|
16816
|
+
id: z.string(),
|
|
16817
|
+
deviceId: z.number().int().nullable(),
|
|
16818
|
+
at: z.number().nullable(),
|
|
16819
|
+
expiresAt: z.number().nullable(),
|
|
16820
|
+
rev: z.number().int(),
|
|
16821
|
+
updatedAt: z.number(),
|
|
16822
|
+
data: RecordBodySchema
|
|
16823
|
+
});
|
|
16824
|
+
/** One predicate on a declared index field: equality, a set, or a range. */
|
|
16825
|
+
var RecordWhereValueSchema = z.union([
|
|
16826
|
+
z.string(),
|
|
16827
|
+
z.number(),
|
|
16828
|
+
z.boolean(),
|
|
16829
|
+
z.object({ in: z.array(z.union([
|
|
16830
|
+
z.string(),
|
|
16831
|
+
z.number(),
|
|
16832
|
+
z.boolean()
|
|
16833
|
+
])).min(1).max(RECORD_BATCH_MAX) }),
|
|
16834
|
+
z.object({
|
|
16835
|
+
gt: z.union([z.string(), z.number()]).optional(),
|
|
16836
|
+
gte: z.union([z.string(), z.number()]).optional(),
|
|
16837
|
+
lt: z.union([z.string(), z.number()]).optional(),
|
|
16838
|
+
lte: z.union([z.string(), z.number()]).optional()
|
|
16839
|
+
}).refine((r) => Object.keys(r).length > 0, { message: "name at least one bound" })
|
|
16840
|
+
]);
|
|
16841
|
+
/** Declared index fields only. Anything else does not compile, by design. */
|
|
16842
|
+
var RecordWhereSchema = z.record(RecordFieldPathSchema, RecordWhereValueSchema);
|
|
16843
|
+
var KindShape = { kind: RecordKindNameSchema };
|
|
16844
|
+
var TimeWindowShape = {
|
|
16845
|
+
deviceId: z.number().int().optional(),
|
|
16846
|
+
atFrom: z.number().optional(),
|
|
16847
|
+
atTo: z.number().optional()
|
|
16848
|
+
};
|
|
16849
|
+
var RecordQueryInputSchema = z.object({
|
|
16850
|
+
...KindShape,
|
|
16851
|
+
...TimeWindowShape,
|
|
16852
|
+
where: RecordWhereSchema.optional(),
|
|
16853
|
+
/** Without `where`: `at` (default for a kind with a clock) or `id`. With `where` the order is the index's. */
|
|
16854
|
+
order: z.enum(["at", "id"]).optional(),
|
|
16855
|
+
desc: z.boolean().optional(),
|
|
16856
|
+
limit: z.number().int().min(1).max(RECORD_QUERY_MAX).default(100),
|
|
16857
|
+
/** Opaque keyset cursor from a previous answer. There is no offset. */
|
|
16858
|
+
cursor: z.string().min(1).optional()
|
|
16859
|
+
});
|
|
16860
|
+
var RecordQueryResultSchema = z.object({
|
|
16861
|
+
records: z.array(RecordViewSchema),
|
|
16862
|
+
nextCursor: z.string().nullable()
|
|
16863
|
+
});
|
|
16864
|
+
var RecordKindStateSchema = z.enum([
|
|
16865
|
+
"created",
|
|
16866
|
+
"unchanged",
|
|
16867
|
+
"updated"
|
|
16868
|
+
]);
|
|
16869
|
+
var DeclareKindResultSchema = z.object({
|
|
16870
|
+
kindId: z.number().int(),
|
|
16871
|
+
state: RecordKindStateSchema,
|
|
16872
|
+
createdIndexes: z.array(z.string()),
|
|
16873
|
+
/** The boot guard: the kind is empty while its legacy table still holds rows. */
|
|
16874
|
+
adoptionPending: z.object({
|
|
16875
|
+
legacyTable: z.string(),
|
|
16876
|
+
legacyRows: z.number().int()
|
|
16877
|
+
}).nullable()
|
|
16878
|
+
});
|
|
16879
|
+
/** Keychain refs a write released (the old marker is gone from the row): the owner deletes the values. */
|
|
16880
|
+
var SecretRefsList = z.array(z.string());
|
|
16881
|
+
var RecordSecretRefsSchema = z.record(z.string(), z.record(z.string(), z.string()));
|
|
16882
|
+
var recordsCapability = {
|
|
16883
|
+
name: "records",
|
|
16884
|
+
scope: "system",
|
|
16885
|
+
mode: "singleton",
|
|
16886
|
+
internal: true,
|
|
16887
|
+
methods: {
|
|
16888
|
+
/** Reconcile this addon's kinds: create the catalog rows and the declared indexes. Additive only. */
|
|
16889
|
+
declareKinds: method(z.object({ kinds: z.record(RecordKindNameSchema, RecordKindDeclarationSchema) }), z.object({ kinds: z.record(z.string(), DeclareKindResultSchema) }), {
|
|
16890
|
+
kind: "mutation",
|
|
16891
|
+
auth: "admin"
|
|
16892
|
+
}),
|
|
16893
|
+
get: method(z.object({
|
|
16894
|
+
...KindShape,
|
|
16895
|
+
id: RecordIdSchema
|
|
16896
|
+
}), RecordViewSchema.nullable(), { auth: "admin" }),
|
|
16897
|
+
getMany: method(z.object({
|
|
16898
|
+
...KindShape,
|
|
16899
|
+
ids: z.array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
|
|
16900
|
+
}), z.array(RecordViewSchema), { auth: "admin" }),
|
|
16901
|
+
/** The keychain refs of the rows' secret fields, by id and concrete path. For the owner's `ctx.secrets`. */
|
|
16902
|
+
secretRefs: method(z.object({
|
|
16903
|
+
...KindShape,
|
|
16904
|
+
ids: z.array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
|
|
16905
|
+
}), RecordSecretRefsSchema, { auth: "admin" }),
|
|
16906
|
+
put: method(z.object({
|
|
16907
|
+
...KindShape,
|
|
16908
|
+
record: RecordInputSchema,
|
|
16909
|
+
/** Compare-and-set. `0` means "the row must not exist". */
|
|
16910
|
+
ifRev: z.number().int().min(0).optional()
|
|
16911
|
+
}), z.object({
|
|
16912
|
+
rev: z.number().int(),
|
|
16913
|
+
releasedRefs: SecretRefsList
|
|
16914
|
+
}), {
|
|
16915
|
+
kind: "mutation",
|
|
16916
|
+
auth: "admin"
|
|
16917
|
+
}),
|
|
16918
|
+
putMany: method(z.object({
|
|
16919
|
+
...KindShape,
|
|
16920
|
+
records: z.array(RecordInputSchema).min(1).max(RECORD_BATCH_MAX)
|
|
16921
|
+
}), z.object({
|
|
16922
|
+
count: z.number().int(),
|
|
16923
|
+
releasedRefs: SecretRefsList
|
|
16924
|
+
}), {
|
|
16925
|
+
kind: "mutation",
|
|
16926
|
+
auth: "admin"
|
|
16927
|
+
}),
|
|
16928
|
+
/** One-statement RFC 7396 merge: `null` removes a field; a merge never reads. */
|
|
16929
|
+
patch: method(z.object({
|
|
16930
|
+
...KindShape,
|
|
16931
|
+
id: RecordIdSchema,
|
|
16932
|
+
data: RecordBodySchema,
|
|
16933
|
+
at: z.number().int().nullable().optional(),
|
|
16934
|
+
expiresAt: z.number().int().nullable().optional(),
|
|
16935
|
+
ifRev: z.number().int().min(1).optional()
|
|
16936
|
+
}), z.object({
|
|
16937
|
+
rev: z.number().int(),
|
|
16938
|
+
releasedRefs: SecretRefsList
|
|
16939
|
+
}), {
|
|
16940
|
+
kind: "mutation",
|
|
16941
|
+
auth: "admin"
|
|
16942
|
+
}),
|
|
16943
|
+
delete: method(z.object({
|
|
16944
|
+
...KindShape,
|
|
16945
|
+
id: RecordIdSchema
|
|
16946
|
+
}), z.object({
|
|
16947
|
+
deleted: z.boolean(),
|
|
16948
|
+
secretRefs: SecretRefsList
|
|
16949
|
+
}), {
|
|
16950
|
+
kind: "mutation",
|
|
16951
|
+
auth: "admin"
|
|
16952
|
+
}),
|
|
16953
|
+
deleteMany: method(z.object({
|
|
16954
|
+
...KindShape,
|
|
16955
|
+
ids: z.array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
|
|
16956
|
+
}), z.object({
|
|
16957
|
+
deleted: z.number().int(),
|
|
16958
|
+
secretRefs: SecretRefsList
|
|
16959
|
+
}), {
|
|
16960
|
+
kind: "mutation",
|
|
16961
|
+
auth: "admin"
|
|
16962
|
+
}),
|
|
16963
|
+
query: method(RecordQueryInputSchema, RecordQueryResultSchema, { auth: "admin" }),
|
|
16964
|
+
count: method(z.object({
|
|
16965
|
+
...KindShape,
|
|
16966
|
+
...TimeWindowShape,
|
|
16967
|
+
where: RecordWhereSchema.optional()
|
|
16968
|
+
}), z.object({ count: z.number().int() }), { auth: "admin" }),
|
|
16969
|
+
histogram: method(z.object({
|
|
16970
|
+
...KindShape,
|
|
16971
|
+
deviceId: z.number().int().optional(),
|
|
16972
|
+
from: z.number(),
|
|
16973
|
+
to: z.number(),
|
|
16974
|
+
bucketMs: z.number().int().positive()
|
|
16975
|
+
}), z.object({ buckets: z.array(z.object({
|
|
16976
|
+
bucketStart: z.number(),
|
|
16977
|
+
count: z.number().int()
|
|
16978
|
+
})) }), { auth: "admin" }),
|
|
16979
|
+
/** Index-served only: every field must belong to ONE declared index. */
|
|
16980
|
+
aggregate: method(z.object({
|
|
16981
|
+
...KindShape,
|
|
16982
|
+
op: z.enum([
|
|
16983
|
+
"sum",
|
|
16984
|
+
"min",
|
|
16985
|
+
"max",
|
|
16986
|
+
"count"
|
|
16987
|
+
]),
|
|
16988
|
+
field: RecordFieldPathSchema.optional(),
|
|
16989
|
+
groupBy: RecordFieldPathSchema.optional(),
|
|
16990
|
+
where: RecordWhereSchema.optional()
|
|
16991
|
+
}), z.object({ rows: z.array(z.object({
|
|
16992
|
+
group: z.union([
|
|
16993
|
+
z.string(),
|
|
16994
|
+
z.number(),
|
|
16995
|
+
z.null()
|
|
16996
|
+
]),
|
|
16997
|
+
value: z.number().nullable()
|
|
16998
|
+
})) }), { auth: "admin" }),
|
|
16999
|
+
/** Batched (5 000 rows per statement, yielding between). Needs a predicate: there is no "delete all". */
|
|
17000
|
+
deleteWhere: method(z.object({
|
|
17001
|
+
...KindShape,
|
|
17002
|
+
deviceId: z.number().int().optional(),
|
|
17003
|
+
atBefore: z.number().optional(),
|
|
17004
|
+
where: RecordWhereSchema.optional()
|
|
17005
|
+
}), z.object({
|
|
17006
|
+
deleted: z.number().int(),
|
|
17007
|
+
secretRefs: SecretRefsList
|
|
17008
|
+
}), {
|
|
17009
|
+
kind: "mutation",
|
|
17010
|
+
auth: "admin"
|
|
17011
|
+
}),
|
|
17012
|
+
/** The D865 hook body: every kind of this addon declared `deviceRemoval: 'delete'`. */
|
|
17013
|
+
deleteDevice: method(z.object({
|
|
17014
|
+
deviceId: z.number().int(),
|
|
17015
|
+
kinds: z.array(RecordKindNameSchema).optional()
|
|
17016
|
+
}), z.object({
|
|
17017
|
+
deleted: z.record(z.string(), z.number().int()),
|
|
17018
|
+
secretRefs: SecretRefsList
|
|
17019
|
+
}), {
|
|
17020
|
+
kind: "mutation",
|
|
17021
|
+
auth: "admin"
|
|
17022
|
+
}),
|
|
17023
|
+
/** A monotonically increasing integer per kind (replaces "resume from the highest"). */
|
|
17024
|
+
allocateId: method(z.object(KindShape), z.object({ id: z.number().int() }), {
|
|
17025
|
+
kind: "mutation",
|
|
17026
|
+
auth: "admin"
|
|
17027
|
+
})
|
|
17028
|
+
}
|
|
17029
|
+
};
|
|
16331
17030
|
/** One table of the settings database. */
|
|
16332
17031
|
var StorageTableSchema = z.object({
|
|
16333
17032
|
/** The table's full name, e.g. `recorder:addon-settings` or `addon-device-settings`. */
|
|
@@ -16340,6 +17039,28 @@ var StorageTableSchema = z.object({
|
|
|
16340
17039
|
/** Declared by an addon since this engine process started (a running addon claims it). */
|
|
16341
17040
|
declaredThisBoot: z.boolean()
|
|
16342
17041
|
});
|
|
17042
|
+
/** One declared record kind (D881) as System -> Data shows it. */
|
|
17043
|
+
var StorageKindSchema = z.object({
|
|
17044
|
+
owner: z.string(),
|
|
17045
|
+
kind: z.string(),
|
|
17046
|
+
database: z.enum(["settings", "events"]),
|
|
17047
|
+
class: z.string(),
|
|
17048
|
+
state: z.enum([
|
|
17049
|
+
"declared",
|
|
17050
|
+
"orphaned",
|
|
17051
|
+
"dropped"
|
|
17052
|
+
]),
|
|
17053
|
+
/** `null` when the caller asked for no counts (`counts: false`). */
|
|
17054
|
+
rows: z.number().int().nonnegative().nullable(),
|
|
17055
|
+
/** Rows x the average size of a sample; null for an empty kind. */
|
|
17056
|
+
bytesEstimate: z.number().int().nonnegative().nullable(),
|
|
17057
|
+
writeTrigger: z.string(),
|
|
17058
|
+
retention: RecordRetentionSchema,
|
|
17059
|
+
/** `true` when the kind is an entry kind (the generic entries UI lists it). */
|
|
17060
|
+
entry: z.boolean(),
|
|
17061
|
+
/** The whole declaration, secret paths and entry descriptor included (the entries service builds its handle from it). */
|
|
17062
|
+
declaration: RecordKindDeclarationSchema
|
|
17063
|
+
});
|
|
16343
17064
|
/**
|
|
16344
17065
|
* The collections retired by exact name: the D870 ones (their data became keys
|
|
16345
17066
|
* of the camera's settings) and the three D871 leftovers (the `stats-5m` tables
|
|
@@ -16358,7 +17079,16 @@ var STORAGE_ADMIN_MOVED_COLLECTIONS = [
|
|
|
16358
17079
|
"pipeline-orchestrator:device-features",
|
|
16359
17080
|
"pipeline-analytics:stats-5m",
|
|
16360
17081
|
"pipeline-orchestrator:stats-5m",
|
|
16361
|
-
"vec_object_clip"
|
|
17082
|
+
"vec_object_clip",
|
|
17083
|
+
"addon-devices",
|
|
17084
|
+
"sections",
|
|
17085
|
+
"provider-settings",
|
|
17086
|
+
"device-settings",
|
|
17087
|
+
"ai:budgets",
|
|
17088
|
+
"pipeline-analytics:retrain-dataset-versions",
|
|
17089
|
+
"training:dataset-versions",
|
|
17090
|
+
"benchmark:replay-runs",
|
|
17091
|
+
"viewer-settings-snapshots"
|
|
16362
17092
|
];
|
|
16363
17093
|
/** The per-addon blob tables a scoped name may carry. */
|
|
16364
17094
|
var STORAGE_ADMIN_SCOPED_BASES = [
|
|
@@ -16408,6 +17138,121 @@ var storageAdminCapability = {
|
|
|
16408
17138
|
}), {
|
|
16409
17139
|
kind: "mutation",
|
|
16410
17140
|
auth: "admin"
|
|
17141
|
+
}),
|
|
17142
|
+
/** Every record kind of both files with rows, a size estimate, class and retention (D881). */
|
|
17143
|
+
listKinds: method(z.object({
|
|
17144
|
+
owner: z.string().min(1).optional(),
|
|
17145
|
+
/** `false` skips the per-kind row count (a catalog read only). Default true. */
|
|
17146
|
+
counts: z.boolean().optional()
|
|
17147
|
+
}), z.object({ kinds: z.array(StorageKindSchema) }), { auth: "admin" }),
|
|
17148
|
+
/**
|
|
17149
|
+
* Read-only diagnosis of ANY owner's kind: the same indexed query as the
|
|
17150
|
+
* owner's, secret fields redacted, audited in the engine log.
|
|
17151
|
+
*/
|
|
17152
|
+
readRecords: method(RecordQueryInputSchema.extend({
|
|
17153
|
+
owner: z.string().min(1),
|
|
17154
|
+
kind: RecordKindNameSchema
|
|
17155
|
+
}), RecordQueryResultSchema, { auth: "admin" }),
|
|
17156
|
+
/**
|
|
17157
|
+
* The migration copy path (D881): write rows into a kind AS ITS DECLARED
|
|
17158
|
+
* OWNER. Refused when that owner's manifest does not declare the kind.
|
|
17159
|
+
* Idempotent (a put by id, so a re-run resumes). A secret field carries a
|
|
17160
|
+
* keychain marker bound to the row's own ref - the operator script imports
|
|
17161
|
+
* the value first - and a plain string there is refused.
|
|
17162
|
+
*/
|
|
17163
|
+
adoptRecords: method(z.object({
|
|
17164
|
+
owner: z.string().min(1),
|
|
17165
|
+
kind: RecordKindNameSchema,
|
|
17166
|
+
records: z.array(RecordInputSchema).max(RECORD_BATCH_MAX),
|
|
17167
|
+
/** The LAST batch: the copy is complete, the boot guard stops asking. */
|
|
17168
|
+
complete: z.boolean().optional()
|
|
17169
|
+
}).refine((input) => input.records.length > 0 || input.complete === true, { message: "records must be non-empty unless complete is true" }), z.object({ adopted: z.number().int() }), {
|
|
17170
|
+
kind: "mutation",
|
|
17171
|
+
auth: "admin"
|
|
17172
|
+
}),
|
|
17173
|
+
/**
|
|
17174
|
+
* Read rows from a legacy KV table by physical name, without a running
|
|
17175
|
+
* `declareCollection`. Used by `records-adopt.ts` when the owner already
|
|
17176
|
+
* moved to records and the collection door refuses the name.
|
|
17177
|
+
*/
|
|
17178
|
+
readLegacyCollection: method(z.object({
|
|
17179
|
+
collection: z.string().min(1),
|
|
17180
|
+
cursor: z.string().optional(),
|
|
17181
|
+
limit: z.number().int().min(1).max(1e3).optional()
|
|
17182
|
+
}), z.object({
|
|
17183
|
+
rows: z.array(z.object({
|
|
17184
|
+
id: z.string(),
|
|
17185
|
+
data: z.record(z.string(), z.unknown())
|
|
17186
|
+
})),
|
|
17187
|
+
nextCursor: z.string().nullable()
|
|
17188
|
+
}), { auth: "admin" }),
|
|
17189
|
+
/** True when a declared kind lists `collection` as `adoptsFrom` and adoption finished. */
|
|
17190
|
+
isAdoptedLegacyTable: method(z.object({ collection: z.string().min(1) }), z.object({ adopted: z.boolean() }), { auth: "admin" })
|
|
17191
|
+
}
|
|
17192
|
+
};
|
|
17193
|
+
/**
|
|
17194
|
+
* record-entries - the ONE admin surface for every list of user-created entries
|
|
17195
|
+
* (D881): notification targets, brokers, LLM profiles, anything an addon
|
|
17196
|
+
* declares as an ENTRY kind (`entry: { title }` in `defineRecordKinds`).
|
|
17197
|
+
*
|
|
17198
|
+
* The UI is generic. `listEntryKinds` hands it, per kind, the JSON Schema of
|
|
17199
|
+
* the entry body with `secret: true` on every credential field, so a password
|
|
17200
|
+
* field is derived from the schema and never from a name. `putEntry` takes the
|
|
17201
|
+
* redaction token for an untouched secret (the stored value is kept), a string
|
|
17202
|
+
* for a new one, and the clear instruction to remove one. A read never carries
|
|
17203
|
+
* a secret value, and a locked keychain refuses the write with
|
|
17204
|
+
* `records/secret-unavailable` instead of storing plaintext.
|
|
17205
|
+
*
|
|
17206
|
+
* Hub-only, served in-process (it acts for each entry's owner on the keychain).
|
|
17207
|
+
*/
|
|
17208
|
+
var EntryKindInfoSchema = z.object({
|
|
17209
|
+
owner: z.string(),
|
|
17210
|
+
kind: RecordKindNameSchema,
|
|
17211
|
+
title: z.string(),
|
|
17212
|
+
nameField: z.string(),
|
|
17213
|
+
/** JSON Schema of the body; `secret: true` marks a password field. */
|
|
17214
|
+
fields: z.record(z.string(), z.unknown()),
|
|
17215
|
+
secretPaths: z.array(z.string()),
|
|
17216
|
+
rows: z.number().int().nonnegative()
|
|
17217
|
+
});
|
|
17218
|
+
var EntryViewSchema = z.object({
|
|
17219
|
+
id: RecordIdSchema,
|
|
17220
|
+
name: z.string(),
|
|
17221
|
+
rev: z.number().int(),
|
|
17222
|
+
updatedAt: z.number(),
|
|
17223
|
+
/** Secret fields hold the redaction token. */
|
|
17224
|
+
data: RecordBodySchema
|
|
17225
|
+
});
|
|
17226
|
+
var EntryAddress = {
|
|
17227
|
+
owner: z.string().min(1),
|
|
17228
|
+
kind: RecordKindNameSchema
|
|
17229
|
+
};
|
|
17230
|
+
var recordEntriesCapability = {
|
|
17231
|
+
name: "record-entries",
|
|
17232
|
+
scope: "system",
|
|
17233
|
+
mode: "singleton",
|
|
17234
|
+
methods: {
|
|
17235
|
+
listEntryKinds: method(z.object({}), z.object({ kinds: z.array(EntryKindInfoSchema) }), { auth: "admin" }),
|
|
17236
|
+
listEntries: method(z.object({ ...EntryAddress }), z.object({ entries: z.array(EntryViewSchema) }), { auth: "admin" }),
|
|
17237
|
+
/** Create (no `id`: one is generated) or edit. `ifRev` guards an edit against a concurrent one. */
|
|
17238
|
+
putEntry: method(z.object({
|
|
17239
|
+
...EntryAddress,
|
|
17240
|
+
id: RecordIdSchema.optional(),
|
|
17241
|
+
data: RecordBodySchema,
|
|
17242
|
+
ifRev: z.number().int().min(1).optional()
|
|
17243
|
+
}), z.object({
|
|
17244
|
+
id: z.string(),
|
|
17245
|
+
rev: z.number().int()
|
|
17246
|
+
}), {
|
|
17247
|
+
kind: "mutation",
|
|
17248
|
+
auth: "admin"
|
|
17249
|
+
}),
|
|
17250
|
+
deleteEntry: method(z.object({
|
|
17251
|
+
...EntryAddress,
|
|
17252
|
+
id: RecordIdSchema
|
|
17253
|
+
}), z.object({ deleted: z.boolean() }), {
|
|
17254
|
+
kind: "mutation",
|
|
17255
|
+
auth: "admin"
|
|
16411
17256
|
})
|
|
16412
17257
|
}
|
|
16413
17258
|
};
|
|
@@ -72675,13 +73520,14 @@ var BaseDevice = class {
|
|
|
72675
73520
|
get state() {
|
|
72676
73521
|
if (!this._stateProxyCache) {
|
|
72677
73522
|
const cache = {};
|
|
72678
|
-
const handler = { get: (
|
|
73523
|
+
const handler = { get: (target, key) => {
|
|
72679
73524
|
const k = key;
|
|
72680
|
-
|
|
73525
|
+
const existing = Reflect.get(target, k);
|
|
73526
|
+
if (existing !== void 0) return existing;
|
|
72681
73527
|
const cap = DEVICE_LOCAL_STATE_CAPS[k];
|
|
72682
73528
|
if (!cap) return void 0;
|
|
72683
73529
|
const proxy = this.sliceProxy(cap);
|
|
72684
|
-
|
|
73530
|
+
Reflect.set(target, k, proxy);
|
|
72685
73531
|
return proxy;
|
|
72686
73532
|
} };
|
|
72687
73533
|
this._stateProxyCache = new Proxy(cache, handler);
|
|
@@ -72880,7 +73726,7 @@ var BaseDevice = class {
|
|
|
72880
73726
|
async updateSourceInfo(patch) {
|
|
72881
73727
|
const next = mergeSourceInfo(this.sourceInfo, patch);
|
|
72882
73728
|
this._sourceInfoCache = Object.freeze({ ...next });
|
|
72883
|
-
const action = this.ctx.api
|
|
73729
|
+
const action = this.ctx.api.deviceManager?.setMetadata;
|
|
72884
73730
|
if (action) try {
|
|
72885
73731
|
await action.mutate({
|
|
72886
73732
|
deviceId: this.id,
|
|
@@ -72915,7 +73761,7 @@ var BaseDevice = class {
|
|
|
72915
73761
|
* device boot on a meta refresh.
|
|
72916
73762
|
*/
|
|
72917
73763
|
async refreshFeatures() {
|
|
72918
|
-
const action = this.ctx.api
|
|
73764
|
+
const action = this.ctx.api.deviceManager?.registerDevice;
|
|
72919
73765
|
if (!action) return;
|
|
72920
73766
|
try {
|
|
72921
73767
|
await action.mutate({
|
|
@@ -79530,6 +80376,30 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
79530
80376
|
addonId: null,
|
|
79531
80377
|
access: "create"
|
|
79532
80378
|
},
|
|
80379
|
+
"recordEntries.deleteEntry": {
|
|
80380
|
+
capName: "record-entries",
|
|
80381
|
+
capScope: "system",
|
|
80382
|
+
addonId: null,
|
|
80383
|
+
access: "delete"
|
|
80384
|
+
},
|
|
80385
|
+
"recordEntries.listEntries": {
|
|
80386
|
+
capName: "record-entries",
|
|
80387
|
+
capScope: "system",
|
|
80388
|
+
addonId: null,
|
|
80389
|
+
access: "view"
|
|
80390
|
+
},
|
|
80391
|
+
"recordEntries.listEntryKinds": {
|
|
80392
|
+
capName: "record-entries",
|
|
80393
|
+
capScope: "system",
|
|
80394
|
+
addonId: null,
|
|
80395
|
+
access: "view"
|
|
80396
|
+
},
|
|
80397
|
+
"recordEntries.putEntry": {
|
|
80398
|
+
capName: "record-entries",
|
|
80399
|
+
capScope: "system",
|
|
80400
|
+
addonId: null,
|
|
80401
|
+
access: "create"
|
|
80402
|
+
},
|
|
79533
80403
|
"recording.getAvailability": {
|
|
79534
80404
|
capName: "recording",
|
|
79535
80405
|
capScope: "device",
|
|
@@ -79830,6 +80700,102 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
79830
80700
|
addonId: null,
|
|
79831
80701
|
access: "view"
|
|
79832
80702
|
},
|
|
80703
|
+
"records.aggregate": {
|
|
80704
|
+
capName: "records",
|
|
80705
|
+
capScope: "system",
|
|
80706
|
+
addonId: null,
|
|
80707
|
+
access: "view"
|
|
80708
|
+
},
|
|
80709
|
+
"records.allocateId": {
|
|
80710
|
+
capName: "records",
|
|
80711
|
+
capScope: "system",
|
|
80712
|
+
addonId: null,
|
|
80713
|
+
access: "create"
|
|
80714
|
+
},
|
|
80715
|
+
"records.count": {
|
|
80716
|
+
capName: "records",
|
|
80717
|
+
capScope: "system",
|
|
80718
|
+
addonId: null,
|
|
80719
|
+
access: "view"
|
|
80720
|
+
},
|
|
80721
|
+
"records.declareKinds": {
|
|
80722
|
+
capName: "records",
|
|
80723
|
+
capScope: "system",
|
|
80724
|
+
addonId: null,
|
|
80725
|
+
access: "create"
|
|
80726
|
+
},
|
|
80727
|
+
"records.delete": {
|
|
80728
|
+
capName: "records",
|
|
80729
|
+
capScope: "system",
|
|
80730
|
+
addonId: null,
|
|
80731
|
+
access: "delete"
|
|
80732
|
+
},
|
|
80733
|
+
"records.deleteDevice": {
|
|
80734
|
+
capName: "records",
|
|
80735
|
+
capScope: "system",
|
|
80736
|
+
addonId: null,
|
|
80737
|
+
access: "delete"
|
|
80738
|
+
},
|
|
80739
|
+
"records.deleteMany": {
|
|
80740
|
+
capName: "records",
|
|
80741
|
+
capScope: "system",
|
|
80742
|
+
addonId: null,
|
|
80743
|
+
access: "delete"
|
|
80744
|
+
},
|
|
80745
|
+
"records.deleteWhere": {
|
|
80746
|
+
capName: "records",
|
|
80747
|
+
capScope: "system",
|
|
80748
|
+
addonId: null,
|
|
80749
|
+
access: "delete"
|
|
80750
|
+
},
|
|
80751
|
+
"records.get": {
|
|
80752
|
+
capName: "records",
|
|
80753
|
+
capScope: "system",
|
|
80754
|
+
addonId: null,
|
|
80755
|
+
access: "view"
|
|
80756
|
+
},
|
|
80757
|
+
"records.getMany": {
|
|
80758
|
+
capName: "records",
|
|
80759
|
+
capScope: "system",
|
|
80760
|
+
addonId: null,
|
|
80761
|
+
access: "view"
|
|
80762
|
+
},
|
|
80763
|
+
"records.histogram": {
|
|
80764
|
+
capName: "records",
|
|
80765
|
+
capScope: "system",
|
|
80766
|
+
addonId: null,
|
|
80767
|
+
access: "view"
|
|
80768
|
+
},
|
|
80769
|
+
"records.patch": {
|
|
80770
|
+
capName: "records",
|
|
80771
|
+
capScope: "system",
|
|
80772
|
+
addonId: null,
|
|
80773
|
+
access: "create"
|
|
80774
|
+
},
|
|
80775
|
+
"records.put": {
|
|
80776
|
+
capName: "records",
|
|
80777
|
+
capScope: "system",
|
|
80778
|
+
addonId: null,
|
|
80779
|
+
access: "create"
|
|
80780
|
+
},
|
|
80781
|
+
"records.putMany": {
|
|
80782
|
+
capName: "records",
|
|
80783
|
+
capScope: "system",
|
|
80784
|
+
addonId: null,
|
|
80785
|
+
access: "create"
|
|
80786
|
+
},
|
|
80787
|
+
"records.query": {
|
|
80788
|
+
capName: "records",
|
|
80789
|
+
capScope: "system",
|
|
80790
|
+
addonId: null,
|
|
80791
|
+
access: "view"
|
|
80792
|
+
},
|
|
80793
|
+
"records.secretRefs": {
|
|
80794
|
+
capName: "records",
|
|
80795
|
+
capScope: "system",
|
|
80796
|
+
addonId: null,
|
|
80797
|
+
access: "view"
|
|
80798
|
+
},
|
|
79833
80799
|
"sceneMonitor.captureReference": {
|
|
79834
80800
|
capName: "scene-monitor",
|
|
79835
80801
|
capScope: "device",
|
|
@@ -80262,18 +81228,48 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
80262
81228
|
addonId: null,
|
|
80263
81229
|
access: "create"
|
|
80264
81230
|
},
|
|
81231
|
+
"storageAdmin.adoptRecords": {
|
|
81232
|
+
capName: "storage-admin",
|
|
81233
|
+
capScope: "system",
|
|
81234
|
+
addonId: null,
|
|
81235
|
+
access: "create"
|
|
81236
|
+
},
|
|
80265
81237
|
"storageAdmin.dropCollection": {
|
|
80266
81238
|
capName: "storage-admin",
|
|
80267
81239
|
capScope: "system",
|
|
80268
81240
|
addonId: null,
|
|
80269
81241
|
access: "delete"
|
|
80270
81242
|
},
|
|
81243
|
+
"storageAdmin.isAdoptedLegacyTable": {
|
|
81244
|
+
capName: "storage-admin",
|
|
81245
|
+
capScope: "system",
|
|
81246
|
+
addonId: null,
|
|
81247
|
+
access: "view"
|
|
81248
|
+
},
|
|
81249
|
+
"storageAdmin.listKinds": {
|
|
81250
|
+
capName: "storage-admin",
|
|
81251
|
+
capScope: "system",
|
|
81252
|
+
addonId: null,
|
|
81253
|
+
access: "view"
|
|
81254
|
+
},
|
|
80271
81255
|
"storageAdmin.listTables": {
|
|
80272
81256
|
capName: "storage-admin",
|
|
80273
81257
|
capScope: "system",
|
|
80274
81258
|
addonId: null,
|
|
80275
81259
|
access: "view"
|
|
80276
81260
|
},
|
|
81261
|
+
"storageAdmin.readLegacyCollection": {
|
|
81262
|
+
capName: "storage-admin",
|
|
81263
|
+
capScope: "system",
|
|
81264
|
+
addonId: null,
|
|
81265
|
+
access: "view"
|
|
81266
|
+
},
|
|
81267
|
+
"storageAdmin.readRecords": {
|
|
81268
|
+
capName: "storage-admin",
|
|
81269
|
+
capScope: "system",
|
|
81270
|
+
addonId: null,
|
|
81271
|
+
access: "view"
|
|
81272
|
+
},
|
|
80277
81273
|
"storageEvictable.evict": {
|
|
80278
81274
|
capName: "storage-evictable",
|
|
80279
81275
|
capScope: "system",
|
|
@@ -81910,11 +82906,13 @@ var ALL_CAPABILITY_DEFINITIONS = [
|
|
|
81910
82906
|
ptzCapability,
|
|
81911
82907
|
ptzAutotrackCapability,
|
|
81912
82908
|
rebootCapability,
|
|
82909
|
+
recordEntriesCapability,
|
|
81913
82910
|
recordingCapability,
|
|
81914
82911
|
recordingArchiveCapability,
|
|
81915
82912
|
recordingExportCapability,
|
|
81916
82913
|
recordingOnboardCapability,
|
|
81917
82914
|
recordingSignalCapability,
|
|
82915
|
+
recordsCapability,
|
|
81918
82916
|
sceneMonitorCapability,
|
|
81919
82917
|
scriptRunnerCapability,
|
|
81920
82918
|
serverManagementCapability,
|
|
@@ -84133,6 +85131,37 @@ Object.freeze({
|
|
|
84133
85131
|
form: "single",
|
|
84134
85132
|
optional: false
|
|
84135
85133
|
}],
|
|
85134
|
+
"records.count": [{
|
|
85135
|
+
name: "deviceId",
|
|
85136
|
+
form: "single",
|
|
85137
|
+
optional: true
|
|
85138
|
+
}],
|
|
85139
|
+
"records.deleteDevice": [{
|
|
85140
|
+
name: "deviceId",
|
|
85141
|
+
form: "single",
|
|
85142
|
+
optional: false
|
|
85143
|
+
}],
|
|
85144
|
+
"records.deleteWhere": [{
|
|
85145
|
+
name: "deviceId",
|
|
85146
|
+
form: "single",
|
|
85147
|
+
optional: true
|
|
85148
|
+
}],
|
|
85149
|
+
"records.histogram": [{
|
|
85150
|
+
name: "deviceId",
|
|
85151
|
+
form: "single",
|
|
85152
|
+
optional: true
|
|
85153
|
+
}],
|
|
85154
|
+
"records.putMany": [{
|
|
85155
|
+
name: "records",
|
|
85156
|
+
form: "object-array",
|
|
85157
|
+
optional: false,
|
|
85158
|
+
itemField: "deviceId"
|
|
85159
|
+
}],
|
|
85160
|
+
"records.query": [{
|
|
85161
|
+
name: "deviceId",
|
|
85162
|
+
form: "single",
|
|
85163
|
+
optional: true
|
|
85164
|
+
}],
|
|
84136
85165
|
"sceneMonitor.captureReference": [{
|
|
84137
85166
|
name: "deviceId",
|
|
84138
85167
|
form: "single",
|
|
@@ -84249,6 +85278,17 @@ Object.freeze({
|
|
|
84249
85278
|
form: "single",
|
|
84250
85279
|
optional: false
|
|
84251
85280
|
}],
|
|
85281
|
+
"storageAdmin.adoptRecords": [{
|
|
85282
|
+
name: "records",
|
|
85283
|
+
form: "object-array",
|
|
85284
|
+
optional: false,
|
|
85285
|
+
itemField: "deviceId"
|
|
85286
|
+
}],
|
|
85287
|
+
"storageAdmin.readRecords": [{
|
|
85288
|
+
name: "deviceId",
|
|
85289
|
+
form: "single",
|
|
85290
|
+
optional: true
|
|
85291
|
+
}],
|
|
84252
85292
|
"streamBroker.acquireEgressTranscode": [{
|
|
84253
85293
|
name: "deviceId",
|
|
84254
85294
|
form: "single",
|
|
@@ -86293,4 +87333,4 @@ function enumerateInferenceDevices(hw) {
|
|
|
86293
87333
|
return out;
|
|
86294
87334
|
}
|
|
86295
87335
|
//#endregion
|
|
86296
|
-
export {
|
|
87336
|
+
export { STREAM_PROFILE_META as $, resolveSecretMarkers as $i, scopesAllowAddon as $n, RECORD_SWEEP_INTERVAL_MS as $r, extractNestedAddonId as $t, DataStoreDatabaseSchema as A, expandCapMethods as Ai, normalizeCoreBlockWrite as An, compositionSourceKey as Ar, coreBlockIdFromAddonId as At, KeychainAuditEntrySchema as B, makeSecretMarker as Bi, recordEntriesCapability as Bn, CALLER_STAMPED_CAPABILITIES as Br, describeComposableCaps as Bt, DAY_NAMES as C, createEvent as Ci, looseSchema as Cn, buildFfmpegArgs as Cr, canonicalIconKey as Ct, DEVICE_SAN_CREDENTIAL_PREFIX as D, defineRecordKinds as Di, metricsProviderCapability as Dn, compositionFeatureEnabled as Dr, compositionSourceRefs as Dt, DEVICE_NONCE_TTL_MS as E, defineCustomActions as Ei, memoizePinnedFfmpeg as En, composedDeviceStableId as Er, compositionFieldKey as Et, FieldClaimModeSchema as F, isKeychainStoredField as Fi, pickAppLinkHub as Fn, DeviceRole as Fr, databaseSnapshotCapability as Ft, MINUTES_PER_DAY as G, parseJsonObject as Gi, resolveBucketMs as Gn, FilterRequiredError as Gr, deviceStatusCapability as Gt, LOG_LEVEL_RANK as H, nodePin as Hi, reducePoints as Hn, DEVICE_SETTINGS_CONTRIBUTION_METHODS as Hr, deviceExtensionCapability as Ht, FieldClaimSchema as I, isSecretClear as Ii, planComposition as In, DeviceType as Ir, declarationOwnerNodeId as It, RECORDING_SOURCE_CAMSTACK_ADDON as J, parseSettingsArrayAdoptsFrom as Ji, resolveHubAddressRoles as Jn, NoCallerError as Jr, enumerateSchemaFields as Jt, MOTION_CLOSE_AFTER_MS as K, parseJsonUnknown as Ki, resolveCoreBlockEntry as Kn, ForeignSecretMarkerError as Kr, enumerateInferenceDevices as Kt, HUB_MDNS_SERVICE_TYPE as L, isSecretMarker as Li, platformProbeCapability as Ln, errMsg as Lr, decodeVectorBase64 as Lt, DeviceStatusSchema as M, hydrateSchema as Mi, objectInputDeclaresAddonId as Mn, disarmRoseMemory as Mr, coreBlocksCapability as Mt, DeviceTombstoneSchema as N, isDeviceConfigCap as Ni, objectInputDeclaresRequiredDeviceId as Nn, toExpressionValue as Nr, createDeviceExtensionProvider as Nt, DEVICE_SAN_USER_PREFIX as O, emitDownForOwnedCaps as Oi, modeMayWrite as On, compositionItemFieldPath as Or, coreBlockAddonId as Ot, FIRST_LEVEL_MACRO_CLASSES as P, isEvent as Pi, parseStreamParamsFormPatch as Pn, DeviceFeature as Pr, dataStoreProviderCapability as Pt, STORAGE_ADMIN_SCOPED_BASES as Q, resolveCapMount as Qi, runtimeStatePolicyFor as Qn, RECORD_DELETE_BATCH as Qr, expressionContainsBuiltinCall as Qt, HUB_MDNS_TXT_KEYS as R, isSecretMarkerLike as Ri, procedureAuthKey as Rn, BaseAddon as Rr, defineExtensionSlotProvider as Rt, DATA_STORE_DATABASES as S, collectZodSecretPaths as Si, logLevelAtMost as Sn, COMPOSER_ADDON_ID as Sr, cameraGridLayoutCapability as St, DEVICE_ENROLLMENT_TTL_MS as T, declarationsOf as Ti, mayWriteToLocation as Tn, composedDeviceRef as Tr, composerCapability as Tt, LegacyStorageLocationDefaultSchema as U, normalizeNodeId as Ui, replacedFieldKeys as Un, DEVICE_STATUS_METHOD as Ur, deviceManagerCapability as Ut, KeychainResetRecordSchema as V, mapSecretLeaves as Vi, recordsCapability as Vn, DATAPLANE_SECRET_HEADER as Vr, deviceCredentialsCapability as Vt, METHOD_ACCESS_MAP as W, normalizeSecretOwner as Wi, resolveAppConnections as Wn, DeclarationRefusedError as Wr, deviceStateCapability as Wt, STORAGE_ACCESS_FALLBACK as X, readinessKey as Xi, resolveMethodAuth as Xn, RECORD_BATCH_MAX as Xr, evictionPolicyOfLocation as Xt, RecordingStatusSchema as Y, parseSettingsBrokersAdoptsFrom as Yi, resolveLocationMode as Yn, PlaintextSecretError as Yr, evaluateCompositionField as Yt, STORAGE_ADMIN_MOVED_COLLECTIONS as Z, recordSecretRef as Zi, resolveNotificationTapAddress as Zn, RECORD_BATCH_MAX_BYTES as Zr, expandContainer as Zt, CatalogFileSchema as _, assertValidDeclaration as _i, legacyModeOf as _n, validateCustomAddress as _r, buildCapabilityLookup as _t, ApiKeyRecordSchema as a, toSecretFieldView as aa, RecordKindDeclarationSchema as ai, interpolate as an, snapshotCapability as ar, StorageLocationTypeSchema as at, DATABASE_SNAPSHOT_SUFFIX as b, collectSecretLeaves as bi, locationIconKey as bn, vectorStoreCapability as br, buildStreamParamsConfigSchema as bt, CAMERA_SWITCH_ORDER as c, withoutCallerStamp as ca, RecordUniqueViolationError as ci, isCollectionArrayMethod as cn, storageCapability as cr, UserRecordSchema as ct, CATALOG_LANGS as d, UnindexedFilterError as di, isObjectInput as dn, storageProviderCapability as dr, addonWidgetsCapability as dt, scopeKey as ea, REDACTED_SECRET as ei, filesystemBrowseCapability as en, scopesAllowDeviceCap as er, ScopedTokenSchema as et, COMPOSED_ITEM_FIXED_FIELDS as f, UnknownRecordKindError as fi, isVoidInput as fn, streamCatalogCapability as fr, alertsCapability as ft, CalendarPreferencesSchema as g, asString$1 as gi, legacyAutoLinkIds as gn, validateComposition as gr, batteryCapability as gt, CORE_BLOCK_ADDON_PREFIX as h, asNumber as hi, keychainCapability as hn, userManagementCapability as hr, bareAddonId as ht, AlertSchema as i, toNodeId as ia, ReadinessTimeoutError as ii, gbToBytes as in, siteZoneKey as ir, StorageLocationModeSchema as it, DeclaredDevices as j, formatSecretScope as ji, normalizeUnit as jn, createStatefulExpressionMemory as jr, coreBlockSourceKind as jt, DEVICE_TOMBSTONE_RETENTION_MS as k, emitReadiness as ki, motionCapability as kn, compositionSliceKey as kr, coreBlockComposition as kt, CAMSTACK_APP_LINK_ORIGIN as l, EventCategory as la, RevConflictError as li, isDefaultAppConnectionEndpoint as ln, storageMigrationCapability as lr, addonPagesCapability as lt, CORE_BLOCKS_ADDON_ID as m, asJsonObject as mi, keychainAdminCapability as mn, supportedRuntimes as mr, backupCapability as mt, AGENT_MDNS_TXT_KEYS as n, secretTreeFromSchema as na, RUNTIME_DEFAULTS as ni, formatDeviceRevoker as nn, settingsStoreCapability as nr, SsoBridgeClaimsSchema as nt, BaseDevice as o, transformSecretWrite as oa, RecordNotFoundError as oi, isAppLinkBase as on, splitTranslationRef as or, StorageMigrationJobSchema as ot, COMPOSER_RUNNER_ID as p, WELL_KNOWN_TAB_MAP as pi, kebabToCamel as pn, streamQualityLabel as pr, authProviderCapability as pt, NetworkTunnelStartedDataSchema as q, parseSecretRef as qi, resolveCoreBlockFiles as qn, InvalidRecordError as qr, enumerateItemArrayFields as qt, ALL_CAPABILITY_DEFINITIONS as r, sleep as ra, ReadinessRegistry as ri, formatMinutes as rn, shortHostname as rr, StorageCleanupJobSchema as rt, BatteryStatusSchema as s, userError as sa, RecordTooLargeError as si, isArrayOutputSchema as sn, storageAdminCapability as sr, TokenScopeSchema as st, AGENT_MDNS_SERVICE_TYPE as t, secretTreeFromPaths as ta, REMOVE_LEAF as ti, foldSnapshotByFunction as tn, scoreRuntimes as tr, ServerNameSchema as tt, CAP_NAMES_WITH_STATUS as u, SECRET_CLEAR as ui, isLocationEnabled as un, storageOccupancyCapability as ur, addonSettingsCapability as ut, CoreBlockSchema as v, buildSecretRef as vi, lifecycleJobSchema as vn, vectorDimFromBase64 as vr, buildDeviceEnrollmentLink as vt, DERIVED_CAMERA_SILENCED_CAP_NAMES as w, customAction as wi, mayReadLocation as wn, cloneStatefulExpressionMemory as wr, checkRoleAddress as wt, DATABASE_SNAPSHOT_TIMEOUT_MS as x, collectSecretMarkerRefs as xi, logDestinationCapability as xn, withLocationMode as xr, calendarsCapability as xt, DATABASE_SNAPSHOT_PARTIAL_SUFFIX as y, collectSecretConfigKeys as yi, localNetworkCapability as yn, vectorIndexDimConflictError as yr, buildDeviceSignatureMessage as yt, KEYCHAIN_RESET_TRIGGER_ACTOR as z, isSecretRefOwnedBy as zi, ptzAutotrackCapability as zn, BatchTooLargeError as zr, deriveBatteryPresence as zt };
|