@camstack/server 1.2.927 → 1.2.929
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/package.json +11 -14
- package/system/dist/addon-id-CVg1_r5E.mjs +39 -0
- package/system/dist/addon-id-Di0lNJ89.js +50 -0
- package/system/dist/addon-pages.cap-Df9FQwN1.js +49 -0
- package/system/dist/addon-pages.cap-DksUlE8j.mjs +44 -0
- package/system/dist/addon-settings.cap-3-TIIMq_.mjs +592 -0
- package/system/dist/addon-settings.cap-DAiE0Nb0.js +651 -0
- package/system/dist/addon-widgets.cap-C4jxflbF.js +200 -0
- package/system/dist/addon-widgets.cap-D9m48X78.mjs +183 -0
- package/system/dist/base-addon-DD5dIfcZ.js +4624 -0
- package/system/dist/base-addon-Md14i7pe.mjs +4505 -0
- package/system/dist/base-device-2sL1DMm1.js +1103 -0
- package/system/dist/base-device-IuM1AwXZ.mjs +1098 -0
- package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +8 -6
- package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +3 -1
- package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +8 -6
- package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +3 -1
- package/system/dist/builtins/alerts/alerts.addon.js +113 -56
- package/system/dist/builtins/alerts/alerts.addon.mjs +58 -1
- package/system/dist/builtins/autotrack/index.js +21 -17
- package/system/dist/builtins/autotrack/index.mjs +5 -1
- package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +14 -11
- package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +5 -2
- package/system/dist/builtins/calendars/calendars.addon.js +8 -6
- package/system/dist/builtins/calendars/calendars.addon.mjs +3 -1
- package/system/dist/builtins/camera-grid/index.js +615 -58
- package/system/dist/builtins/camera-grid/index.mjs +558 -1
- package/system/dist/builtins/composer/composer.addon.js +788 -209
- package/system/dist/builtins/composer/composer.addon.mjs +583 -4
- package/system/dist/builtins/console-logging/index.js +4 -3
- package/system/dist/builtins/console-logging/index.mjs +2 -1
- package/system/dist/builtins/core-blocks/core-blocks.addon.js +7887 -381
- package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +7511 -5
- package/system/dist/builtins/core-notifier/core-notifier.addon.js +731 -21
- package/system/dist/builtins/core-notifier/core-notifier.addon.mjs +711 -1
- package/system/dist/builtins/device-history/device-history.addon.js +110 -31
- package/system/dist/builtins/device-history/device-history.addon.mjs +81 -2
- package/system/dist/builtins/device-manager/device-manager.addon.js +12806 -227
- package/system/dist/builtins/device-manager/device-manager.addon.mjs +12583 -5
- package/system/dist/builtins/hub-forwarder/index.js +4 -3
- package/system/dist/builtins/hub-forwarder/index.mjs +2 -1
- package/system/dist/builtins/keychain/index.js +31 -28
- package/system/dist/builtins/keychain/index.mjs +7 -4
- package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.js +15 -12
- package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +4 -1
- package/system/dist/builtins/local-auth/local-auth.addon.js +140 -39
- package/system/dist/builtins/local-auth/local-auth.addon.mjs +103 -3
- package/system/dist/builtins/local-network/local-network.addon.js +43 -39
- package/system/dist/builtins/local-network/local-network.addon.mjs +7 -3
- package/system/dist/builtins/loki-logging/index.js +23 -17
- package/system/dist/builtins/loki-logging/index.mjs +7 -1
- package/system/dist/builtins/native-metrics/native-metrics.addon.js +156 -15
- package/system/dist/builtins/native-metrics/native-metrics.addon.mjs +142 -1
- package/system/dist/builtins/platform-probe/index.js +25 -23
- package/system/dist/builtins/platform-probe/index.mjs +4 -2
- package/system/dist/builtins/record-entries/index.js +9 -7
- package/system/dist/builtins/record-entries/index.mjs +3 -1
- package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +4 -4
- package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
- package/system/dist/builtins/snapshot/index.js +97 -44
- package/system/dist/builtins/snapshot/index.mjs +54 -1
- package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.js +5 -4
- package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +2 -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 +87 -61
- package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +29 -3
- package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +81 -72
- package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +10 -1
- package/system/dist/builtins/system-config/system-config.addon.js +17 -14
- package/system/dist/builtins/system-config/system-config.addon.mjs +6 -3
- package/system/dist/builtins/winston-logging/index.js +7 -5
- package/system/dist/builtins/winston-logging/index.mjs +3 -1
- package/system/dist/calendars.cap-CaFlShS9.js +155 -0
- package/system/dist/calendars.cap-_C4eD4fi.mjs +138 -0
- package/system/dist/camstack-error-DJ-TUAi1.js +23 -0
- package/system/dist/camstack-error-viZYfcj9.mjs +18 -0
- package/system/dist/cap-call-context-Bd76CbOW.js +95 -0
- package/system/dist/cap-call-context-DNwdgGSQ.mjs +78 -0
- package/system/dist/capability-definition-C2rJdVeX.mjs +177 -0
- package/system/dist/capability-definition-HCmTem8c.js +242 -0
- package/system/dist/{capture-engine-BcuwOSXv.js → capture-engine-DZ0LIUqA.js} +5 -4
- package/system/dist/{capture-engine-Bz7eXFjT.mjs → capture-engine-DiwbjoWp.mjs} +2 -1
- package/system/dist/command-origin-claim-Cief660O.js +35 -0
- package/system/dist/command-origin-claim-D1Wy7Qld.mjs +24 -0
- package/system/dist/composition-sources-Caqv7O7z.mjs +391 -0
- package/system/dist/composition-sources-CgnHjm8Q.js +408 -0
- package/system/dist/{constants-D2etJ02O.js → constants-Ba3FTIHl.js} +1 -1
- package/system/dist/constants-C860Y6U4.js +26 -0
- package/system/dist/{constants-BcUTQd1M.mjs → constants-DB4piTD5.mjs} +1 -1
- package/system/dist/constants-DCLpoF4L.mjs +21 -0
- package/system/dist/coral-accelerators-7o8hqvcN.js +564 -0
- package/system/dist/coral-accelerators-BKcXP59c.mjs +521 -0
- package/system/dist/core-blocks.cap-C6iKAZ-x.mjs +17986 -0
- package/system/dist/core-blocks.cap-LEMqVwxO.js +18705 -0
- package/system/dist/custom-actions-BFUSalC9.mjs +25 -0
- package/system/dist/custom-actions-D92NRi2c.js +36 -0
- package/system/dist/database-snapshot.cap-DF38e-0P.js +162 -0
- package/system/dist/database-snapshot.cap-dhrc9xnY.mjs +133 -0
- package/system/dist/declared-device-BWphj9WE.js +303 -0
- package/system/dist/declared-device-CKERA1Hi.mjs +286 -0
- package/system/dist/{device-ca-ExMN3xW3.mjs → device-ca-BLM6fccc.mjs} +2 -1
- package/system/dist/{device-ca-CU8zh9Pi.js → device-ca-C5kJE6mL.js} +7 -6
- package/system/dist/device-certificate-Cddm4Idn.mjs +91 -0
- package/system/dist/device-certificate-CguVACQO.js +162 -0
- package/system/dist/device-identifiers-BQg9EQi1.js +600 -0
- package/system/dist/device-identifiers-iSuQCKmK.mjs +529 -0
- package/system/dist/device-kind-BJ2pfsjw.mjs +78 -0
- package/system/dist/device-kind-CsSiv_YF.js +101 -0
- package/system/dist/device-manager.cap-2abwVLCM.js +2874 -0
- package/system/dist/device-manager.cap-CFZSPfUh.mjs +2749 -0
- package/system/dist/device-provider.cap-3Uvk6f5-.mjs +331 -0
- package/system/dist/device-provider.cap-D7TV2kVH.js +366 -0
- package/system/dist/{device-row-store-CeW_GWh9.mjs → device-row-store-YF3jtmkk.mjs} +4 -1
- package/system/dist/{device-row-store-BMIR-n3m.js → device-row-store-doTfMOqn.js} +12 -9
- package/system/dist/device-transitions.cap-B5w5PYU_.js +860 -0
- package/system/dist/device-transitions.cap-DojcwEuX.mjs +819 -0
- package/system/dist/device-type-CbQsnFdC.js +477 -0
- package/system/dist/device-type-DgEvK3ch.mjs +454 -0
- package/system/dist/entry-kind-D9MuVJCK.mjs +44 -0
- package/system/dist/entry-kind-cq90c--V.js +55 -0
- package/system/dist/error.cap-CSM_SRfR.mjs +3423 -0
- package/system/dist/error.cap-DBhgPeWK.js +3848 -0
- package/system/dist/file-host-worker.js +1 -1
- package/system/dist/file-host-worker.mjs +1 -1
- package/system/dist/history-catalog-BKRarIL_.js +831 -0
- package/system/dist/history-catalog-BwTeQ4Mr.mjs +802 -0
- package/system/dist/{hub-identity-Csxx2Q8k.js → hub-identity-BMdR3Mw9.js} +2 -2
- package/system/dist/{hub-identity-BBXzP6Ve.mjs → hub-identity-DjMN9Ac2.mjs} +1 -1
- package/system/dist/{hub-mdns-ciao-By5577HM.js → hub-mdns-ciao--0v1TKME.js} +5 -5
- package/system/dist/{hub-mdns-ciao-DG17NbGU.mjs → hub-mdns-ciao-DBrtHOcc.mjs} +2 -2
- package/system/dist/index.js +763 -151
- package/system/dist/index.mjs +624 -12
- package/system/dist/integration-instances.cap-Cl9O-k4h.mjs +538 -0
- package/system/dist/integration-instances.cap-dJIxg2_s.js +549 -0
- package/system/dist/keychain-admin.cap-Db_oFX4H.js +425 -0
- package/system/dist/keychain-admin.cap-GtM7gVGG.mjs +396 -0
- package/system/dist/l10n-Bu6aUvSY.mjs +10 -0
- package/system/dist/l10n-CGMvp7NF.js +15 -0
- package/system/dist/labels-DX5S8deC.js +81 -0
- package/system/dist/labels-DsBcU7md.mjs +64 -0
- package/system/dist/{legacy-integration-rows-door-CVwOo5aq.js → legacy-integration-rows-door-B1nzxxr5.js} +2 -2
- package/system/dist/{legacy-integration-rows-door-D9tQOUzh.mjs → legacy-integration-rows-door-nTvo_6jQ.mjs} +1 -1
- package/system/dist/log-destination.cap-CxZzAVaR.mjs +143 -0
- package/system/dist/log-destination.cap-DELPJkZ0.js +148 -0
- package/system/dist/low-power-sleep.cap-7lfVU41N.js +103 -0
- package/system/dist/low-power-sleep.cap-tGPmaZ_V.mjs +92 -0
- package/system/dist/mask-shape-Ci8Co9w0.mjs +57 -0
- package/system/dist/mask-shape-CmPA2fst.js +92 -0
- package/system/dist/metrics-provider.cap-BNmcHDkQ.mjs +405 -0
- package/system/dist/metrics-provider.cap-BcmQUt6l.js +410 -0
- package/system/dist/migration-BMjgkyG2.js +380 -0
- package/system/dist/migration-DRJAtdy7.mjs +321 -0
- package/system/dist/network-access.cap-B5TWLDCC.js +1099 -0
- package/system/dist/network-access.cap-BJnGbE6n.mjs +1004 -0
- package/system/dist/notification-rules.cap-B__YBgnG.js +3422 -0
- package/system/dist/notification-rules.cap-D9ArZlwx.mjs +3357 -0
- package/system/dist/ops-log-CB4pIdqi.mjs +64 -0
- package/system/dist/ops-log-pxt9176Z.js +81 -0
- package/system/dist/pinned-binary-BOhOSNff.js +28 -0
- package/system/dist/pinned-binary-CrIRAi4G.mjs +23 -0
- package/system/dist/platform-probe.cap-1WrMhWHx.js +250 -0
- package/system/dist/platform-probe.cap-BFeqFLtQ.mjs +233 -0
- package/system/dist/prefix-walk-B4b2-9aK.mjs +790 -0
- package/system/dist/prefix-walk-DC0ljmbB.js +843 -0
- package/system/dist/ptz-autotrack.cap-BW7w0zHD.js +229 -0
- package/system/dist/ptz-autotrack.cap-DT2GypXw.mjs +224 -0
- package/system/dist/quantity-D3g5SxsZ.mjs +114 -0
- package/system/dist/quantity-lY1KiTSZ.js +143 -0
- package/system/dist/raw-secret-migration-DxuBFtvi.js +50 -0
- package/system/dist/raw-secret-migration-iv88mLoc.mjs +39 -0
- package/system/dist/record-entries.cap-sMUhTvTU.mjs +75 -0
- package/system/dist/record-entries.cap-ti1C046R.js +80 -0
- package/system/dist/record-kind-DoBfYHCs.js +203 -0
- package/system/dist/record-kind-ub6NXqfh.mjs +162 -0
- package/system/dist/recording-archive.cap-7OrIn9e5.mjs +1299 -0
- package/system/dist/recording-archive.cap-D7bo-QSM.js +1328 -0
- package/system/dist/records.cap-ClcWV64i.js +329 -0
- package/system/dist/records.cap-CwLT2ByG.mjs +294 -0
- package/system/dist/relocate-CdVQAk-w.js +804 -0
- package/system/dist/relocate-CoZZTui1.mjs +661 -0
- package/system/dist/rename-composition-block-7WIICIDq.mjs +33525 -0
- package/system/dist/rename-composition-block-CcWLwVhG.js +34692 -0
- package/system/dist/{restore-archive-kwtBd00M.mjs → restore-archive-CjAyKpgX.mjs} +3 -1
- package/system/dist/{restore-archive-CIFvqOze.js → restore-archive-CkTkv3Ss.js} +6 -4
- package/system/dist/scoped-settings-CylSSq_8.js +955 -0
- package/system/dist/scoped-settings-DVWUIP7Z.mjs +650 -0
- package/system/dist/server-name-BIhLuHvX.mjs +35 -0
- package/system/dist/server-name-OALNvpqC.js +52 -0
- package/system/dist/settings-store.cap-Ci4F2zul.mjs +569 -0
- package/system/dist/settings-store.cap-wlJhCspr.js +640 -0
- package/system/dist/snapshot.cap-3suPdBHV.js +250 -0
- package/system/dist/snapshot.cap-Bs8Oyaqh.mjs +245 -0
- package/system/dist/source-info-DGB7SdB_.mjs +190 -0
- package/system/dist/source-info-DtWf4k2j.js +225 -0
- package/system/dist/storage-admin.cap-BSv1NjKJ.mjs +883 -0
- package/system/dist/storage-admin.cap-he0OqvVM.js +906 -0
- package/system/dist/storage-location-CBT8GCD6.mjs +163 -0
- package/system/dist/storage-location-CTweDMZf.js +198 -0
- package/system/dist/storage-location-mode-B21UVRRX.mjs +167 -0
- package/system/dist/storage-location-mode-CS4sMzo-.js +232 -0
- package/system/dist/storage-migration.cap-CyyATY_p.js +330 -0
- package/system/dist/storage-migration.cap-D7QqGobp.mjs +313 -0
- package/system/dist/storage-occupancy.cap-2rmnS58Z.js +622 -0
- package/system/dist/storage-occupancy.cap-CqBztTl9.mjs +611 -0
- package/system/dist/storage-provider.cap-Bw0CfxVc.js +213 -0
- package/system/dist/storage-provider.cap-CMeck2w4.mjs +202 -0
- package/system/dist/stream-catalog.cap-Bp7SkgIf.mjs +6560 -0
- package/system/dist/stream-catalog.cap-D3uwePiA.js +6763 -0
- package/system/dist/streaming-shared-B8cXatuU.mjs +431 -0
- package/system/dist/streaming-shared-DQwFZOSi.js +526 -0
- package/system/dist/system-reasons-Be_k1W8g.js +25 -0
- package/system/dist/system-reasons-CYj4qwyS.mjs +20 -0
- package/system/dist/tag-BxLazvVb.js +2138 -0
- package/system/dist/tag-uZBAq6ox.mjs +2073 -0
- package/system/dist/user-management.cap-B9QDu8NE.js +825 -0
- package/system/dist/user-management.cap-DBIi77sB.mjs +766 -0
- package/system/dist/vector-store.cap-DnyfrYDn.js +330 -0
- package/system/dist/vector-store.cap-h2GHWQ1t.mjs +319 -0
- package/system/dist/{wal-maintenance-CTrCPzds.mjs → wal-maintenance-BG01rOn9.mjs} +0 -0
- package/system/dist/{wal-maintenance-dq7T3quB.js → wal-maintenance-DyrebYKF.js} +0 -0
- package/system/dist/zod-secret-DS7mj1bk.js +78 -0
- package/system/dist/zod-secret-zY4nM61M.mjs +73 -0
- package/system/package.json +1 -1
- package/system/dist/composition-sources-BI614LJx.mjs +0 -141
- package/system/dist/composition-sources-v_kkb8A9.js +0 -152
- package/system/dist/coral-accelerators-BSVsBVzt.js +0 -250
- package/system/dist/coral-accelerators-DBlgWB8k.mjs +0 -231
- package/system/dist/dist-BCHMSqzc.mjs +0 -143467
- package/system/dist/dist-BZfvhfS1.js +0 -146970
- package/system/dist/prefix-walk-DAOBSyH1.mjs +0 -88
- package/system/dist/prefix-walk-Dv6MLZlM.js +0 -99
- package/system/dist/rename-composition-block-C9HuBrKS.js +0 -112
- package/system/dist/rename-composition-block-DtaYmYAR.mjs +0 -101
|
@@ -0,0 +1,883 @@
|
|
|
1
|
+
import { c as method } from "./capability-definition-C2rJdVeX.mjs";
|
|
2
|
+
import { i as RecordRetentionSchema, n as RecordKindDeclarationSchema, r as RecordKindNameSchema } from "./record-kind-ub6NXqfh.mjs";
|
|
3
|
+
import { t as NOT_A_DEVICE } from "./system-reasons-CYj4qwyS.mjs";
|
|
4
|
+
import { a as DataStoreDatabaseSchema, c as QueryFilterSchema, d as TransactOpSchema, l as SettingsRecordSchema, n as AggregateResultSchema, o as DeclareCollectionInputSchema, r as BulkRecordSchema, s as MutationFilterSchema, t as AggregateFieldSchema, u as TransactGuardSchema } from "./settings-store.cap-Ci4F2zul.mjs";
|
|
5
|
+
import { a as MigrationOwnerStepSchema, i as MigrationOwnerResultSchema, n as MigrationLedgerEntrySchema, o as MigrationPendingEntrySchema, r as MigrationMetaSchema, s as MigrationStatusSchema, t as MigrationDryRunResultSchema } from "./migration-DRJAtdy7.mjs";
|
|
6
|
+
import { a as RecordWhereSchema, i as RecordQueryResultSchema, r as RecordQueryInputSchema } from "./records.cap-CwLT2ByG.mjs";
|
|
7
|
+
import { z } from "zod";
|
|
8
|
+
//#region ../types/dist/esm/capabilities/data-store-provider.cap.mjs
|
|
9
|
+
/**
|
|
10
|
+
* What one engine says about itself. The orchestrator uses `kind` to pick
|
|
11
|
+
* a registrant for a collection; `engineId` is what a log line names when
|
|
12
|
+
* a call is routed or refused.
|
|
13
|
+
*/
|
|
14
|
+
var EngineInfoSchema = /* @__PURE__ */ z.object({
|
|
15
|
+
engineId: /* @__PURE__ */ z.string(),
|
|
16
|
+
/**
|
|
17
|
+
* `relational` — rows, columns, indexes, the surface `settings-store`
|
|
18
|
+
* has always described. `vector` — an embedding store answering
|
|
19
|
+
* similarity queries. A registrant declares exactly one; an engine that
|
|
20
|
+
* does both registers twice, because "both" would make the routing
|
|
21
|
+
* decision ambiguous at exactly the point it must not be.
|
|
22
|
+
*/
|
|
23
|
+
kind: /* @__PURE__ */ z.enum(["relational", "vector"]),
|
|
24
|
+
displayName: /* @__PURE__ */ z.string()
|
|
25
|
+
});
|
|
26
|
+
/**
|
|
27
|
+
* data-store-provider — the engine contract behind the data door.
|
|
28
|
+
*
|
|
29
|
+
* The sibling of `storage-provider`, for rows instead of bytes. The
|
|
30
|
+
* orchestrator (singleton `settings-store` cap, owned by the
|
|
31
|
+
* storage-orchestrator builtin) dispatches every call to the registrant
|
|
32
|
+
* that serves the collection.
|
|
33
|
+
*
|
|
34
|
+
* `internal: true` — consumed only by the orchestrator. Public consumers
|
|
35
|
+
* go through `settings-store`; they never see this cap, and an engine
|
|
36
|
+
* never sees a caller.
|
|
37
|
+
*
|
|
38
|
+
* ⚠ **`internal: true` DOES NOT gate the mount, and until 2026-08-26 this
|
|
39
|
+
* comment claimed otherwise.** `resolveCapMount` never reads the field, so this
|
|
40
|
+
* cap was live on the AppRouter with every method at the default
|
|
41
|
+
* `auth: 'protected'` — i.e. readable by ANY authenticated session, admin or
|
|
42
|
+
* not. Verified against the live hub: `dataStoreProvider.query` returned raw
|
|
43
|
+
* settings rows including a provider credential, bypassing the secret redaction
|
|
44
|
+
* that `deviceManager.listAll` and friends go through.
|
|
45
|
+
*
|
|
46
|
+
* Every method is now `auth: 'admin'` EXPLICITLY, including the five reads —
|
|
47
|
+
* they had no options object at all, which is exactly how they kept the
|
|
48
|
+
* permissive default while the mutations looked deliberate. The explicit
|
|
49
|
+
* annotation is the fix that works today; making `internal` mean something at
|
|
50
|
+
* mount time is the systemic one, and it is not free: 22 caps declare it, only
|
|
51
|
+
* 4 are `mount: 'skip'`, and forcing admin on all of them would change the auth
|
|
52
|
+
* of surfaces the viewer and admin-ui call as non-admin users. That decision is
|
|
53
|
+
* the operator's, not a side effect of this file.
|
|
54
|
+
*
|
|
55
|
+
* Design notes:
|
|
56
|
+
* - **Stateless dispatch.** Every method carries its own
|
|
57
|
+
* `namespace` + `collection`, so an engine keeps no per-caller state
|
|
58
|
+
* and the orchestrator forwards the payload verbatim. Scoping is a
|
|
59
|
+
* property of the input, not of the connection — see the note on
|
|
60
|
+
* `settings-store` about what that does and does not guarantee.
|
|
61
|
+
* - **One registrant today** (`sqlite-settings`). The collection shape
|
|
62
|
+
* exists so a second engine is a registration rather than a second
|
|
63
|
+
* door ([D44](../../../../docs/decisions/adr-0044.md)).
|
|
64
|
+
*
|
|
65
|
+
* The method set is deliberately identical to `settings-store`'s: the
|
|
66
|
+
* orchestrator is a router, not a translator. A capability the door
|
|
67
|
+
* gains, an engine must be able to answer.
|
|
68
|
+
*/
|
|
69
|
+
var dataStoreProviderCapability = {
|
|
70
|
+
name: "data-store-provider",
|
|
71
|
+
scope: "system",
|
|
72
|
+
mode: "collection",
|
|
73
|
+
internal: true,
|
|
74
|
+
methods: {
|
|
75
|
+
/** Self-description — how the orchestrator picks a registrant. */
|
|
76
|
+
getEngineInfo: /* @__PURE__ */ method(/* @__PURE__ */ z.void(), EngineInfoSchema, { auth: "admin" }),
|
|
77
|
+
/** Get a single value by key from a collection. */
|
|
78
|
+
get: /* @__PURE__ */ method(/* @__PURE__ */ z.object({
|
|
79
|
+
namespace: /* @__PURE__ */ z.string().optional(),
|
|
80
|
+
collection: /* @__PURE__ */ z.string(),
|
|
81
|
+
key: /* @__PURE__ */ z.string()
|
|
82
|
+
}), /* @__PURE__ */ z.unknown(), { auth: "admin" }),
|
|
83
|
+
/** Set a value by key in a collection (upsert). */
|
|
84
|
+
set: /* @__PURE__ */ method(/* @__PURE__ */ z.object({
|
|
85
|
+
namespace: /* @__PURE__ */ z.string().optional(),
|
|
86
|
+
collection: /* @__PURE__ */ z.string(),
|
|
87
|
+
key: /* @__PURE__ */ z.string(),
|
|
88
|
+
value: /* @__PURE__ */ z.unknown()
|
|
89
|
+
}), /* @__PURE__ */ z.void(), {
|
|
90
|
+
kind: "mutation",
|
|
91
|
+
auth: "admin"
|
|
92
|
+
}),
|
|
93
|
+
/** Get all entries matching an optional filter. */
|
|
94
|
+
query: /* @__PURE__ */ method(/* @__PURE__ */ z.object({
|
|
95
|
+
namespace: /* @__PURE__ */ z.string().optional(),
|
|
96
|
+
collection: /* @__PURE__ */ z.string(),
|
|
97
|
+
filter: /* @__PURE__ */ QueryFilterSchema.optional(),
|
|
98
|
+
/**
|
|
99
|
+
* SQL-level column projection — MUST mirror `settings-store.query`.
|
|
100
|
+
*
|
|
101
|
+
* ⚠ An earlier version of this comment blamed Zod stripping, and that
|
|
102
|
+
* was wrong — corrected 2026-08-26 after the hop map
|
|
103
|
+
* (`docs/design/2026-08-26-topic-hop-map.md`) traced the path.
|
|
104
|
+
* There is **no Zod parse at all** between the door and the engine: the
|
|
105
|
+
* dispatcher forwards the payload verbatim and UDS carries it whole. A
|
|
106
|
+
* field declared here reaches `SqliteSettingsBackend` either way.
|
|
107
|
+
*
|
|
108
|
+
* What actually lost `columns` was the THIRD declaration of this shape:
|
|
109
|
+
* `SettingsQueryInput` in `interfaces/storage.ts`, a hand-written TS
|
|
110
|
+
* interface the engine destructures from. The field existed on both
|
|
111
|
+
* schemas and the engine still never read it, because nothing checks a
|
|
112
|
+
* registered provider against `InferProvider<cap>` —
|
|
113
|
+
* `ProviderRegistration.provider` is typed `object`.
|
|
114
|
+
*
|
|
115
|
+
* It is declared here anyway, and must stay in step with
|
|
116
|
+
* `settings-store.query`: a caller reading only the cap definitions has
|
|
117
|
+
* to be able to see that this call carries a projection.
|
|
118
|
+
* `data-door-schema-parity.spec.ts` keeps the two aligned.
|
|
119
|
+
*/
|
|
120
|
+
columns: /* @__PURE__ */ z.array(/* @__PURE__ */ z.string()).readonly().optional()
|
|
121
|
+
}), /* @__PURE__ */ z.array(SettingsRecordSchema).readonly(), { auth: "admin" }),
|
|
122
|
+
/** Insert a new record. */
|
|
123
|
+
insert: /* @__PURE__ */ method(/* @__PURE__ */ z.object({
|
|
124
|
+
namespace: /* @__PURE__ */ z.string().optional(),
|
|
125
|
+
collection: /* @__PURE__ */ z.string(),
|
|
126
|
+
record: /* @__PURE__ */ z.object({
|
|
127
|
+
id: /* @__PURE__ */ z.string().optional(),
|
|
128
|
+
data: /* @__PURE__ */ z.record(/* @__PURE__ */ z.string(), /* @__PURE__ */ z.unknown())
|
|
129
|
+
})
|
|
130
|
+
}), /* @__PURE__ */ z.object({
|
|
131
|
+
/**
|
|
132
|
+
* The id the row ACTUALLY got (D473): the one supplied, the UUID minted
|
|
133
|
+
* for an absent one, or the ROWID SQLite assigned on an `INTEGER`
|
|
134
|
+
* primary key — which is the only place an auto key is knowable.
|
|
135
|
+
*/
|
|
136
|
+
id: /* @__PURE__ */ z.union([/* @__PURE__ */ z.string(), /* @__PURE__ */ z.number()]) }), {
|
|
137
|
+
kind: "mutation",
|
|
138
|
+
auth: "admin"
|
|
139
|
+
}),
|
|
140
|
+
/**
|
|
141
|
+
* Make a slot hold this row, and answer with the id the row HAS. The
|
|
142
|
+
* engine half of `settings-store.upsert` — read that docblock for why the
|
|
143
|
+
* store needed a slot that is not the primary key (D482).
|
|
144
|
+
*/
|
|
145
|
+
upsert: /* @__PURE__ */ method(/* @__PURE__ */ z.object({
|
|
146
|
+
namespace: /* @__PURE__ */ z.string().optional(),
|
|
147
|
+
collection: /* @__PURE__ */ z.string(),
|
|
148
|
+
conflict: /* @__PURE__ */ z.array(/* @__PURE__ */ z.string()).readonly(),
|
|
149
|
+
record: BulkRecordSchema
|
|
150
|
+
}), /* @__PURE__ */ z.object({ id: /* @__PURE__ */ z.union([/* @__PURE__ */ z.string(), /* @__PURE__ */ z.number()]) }), {
|
|
151
|
+
kind: "mutation",
|
|
152
|
+
auth: "admin"
|
|
153
|
+
}),
|
|
154
|
+
/** Upsert many records in ONE transaction; see the door's `upsertMany`. */
|
|
155
|
+
upsertMany: /* @__PURE__ */ method(/* @__PURE__ */ z.object({
|
|
156
|
+
namespace: /* @__PURE__ */ z.string().optional(),
|
|
157
|
+
collection: /* @__PURE__ */ z.string(),
|
|
158
|
+
conflict: /* @__PURE__ */ z.array(/* @__PURE__ */ z.string()).readonly(),
|
|
159
|
+
records: /* @__PURE__ */ z.array(BulkRecordSchema).readonly()
|
|
160
|
+
}), /* @__PURE__ */ z.object({ upserted: /* @__PURE__ */ z.number().int() }), {
|
|
161
|
+
kind: "mutation",
|
|
162
|
+
auth: "admin"
|
|
163
|
+
}),
|
|
164
|
+
/** Insert many records in ONE transaction. All or nothing. */
|
|
165
|
+
insertMany: /* @__PURE__ */ method(/* @__PURE__ */ z.object({
|
|
166
|
+
namespace: /* @__PURE__ */ z.string().optional(),
|
|
167
|
+
collection: /* @__PURE__ */ z.string(),
|
|
168
|
+
records: /* @__PURE__ */ z.array(BulkRecordSchema).readonly()
|
|
169
|
+
}), /* @__PURE__ */ z.object({ inserted: /* @__PURE__ */ z.number().int() }), {
|
|
170
|
+
kind: "mutation",
|
|
171
|
+
auth: "admin"
|
|
172
|
+
}),
|
|
173
|
+
/** Several writes in ONE transaction behind an optional guard; see the door. */
|
|
174
|
+
transact: /* @__PURE__ */ method(/* @__PURE__ */ z.object({
|
|
175
|
+
namespace: /* @__PURE__ */ z.string().optional(),
|
|
176
|
+
guard: /* @__PURE__ */ TransactGuardSchema.optional(),
|
|
177
|
+
ops: /* @__PURE__ */ z.array(TransactOpSchema).readonly()
|
|
178
|
+
}), /* @__PURE__ */ z.object({
|
|
179
|
+
applied: /* @__PURE__ */ z.boolean(),
|
|
180
|
+
current: /* @__PURE__ */ z.unknown().optional()
|
|
181
|
+
}), {
|
|
182
|
+
kind: "mutation",
|
|
183
|
+
auth: "admin"
|
|
184
|
+
}),
|
|
185
|
+
/** Update an existing record by ID. */
|
|
186
|
+
update: /* @__PURE__ */ method(/* @__PURE__ */ z.object({
|
|
187
|
+
namespace: /* @__PURE__ */ z.string().optional(),
|
|
188
|
+
collection: /* @__PURE__ */ z.string(),
|
|
189
|
+
id: /* @__PURE__ */ z.string(),
|
|
190
|
+
data: /* @__PURE__ */ z.record(/* @__PURE__ */ z.string(), /* @__PURE__ */ z.unknown())
|
|
191
|
+
}), /* @__PURE__ */ z.void(), {
|
|
192
|
+
kind: "mutation",
|
|
193
|
+
auth: "admin"
|
|
194
|
+
}),
|
|
195
|
+
/** Delete a record by key/ID. */
|
|
196
|
+
delete: /* @__PURE__ */ method(/* @__PURE__ */ z.object({
|
|
197
|
+
namespace: /* @__PURE__ */ z.string().optional(),
|
|
198
|
+
collection: /* @__PURE__ */ z.string(),
|
|
199
|
+
key: /* @__PURE__ */ z.string()
|
|
200
|
+
}), /* @__PURE__ */ z.void(), {
|
|
201
|
+
kind: "mutation",
|
|
202
|
+
auth: "admin"
|
|
203
|
+
}),
|
|
204
|
+
/** Delete every record matching `filter`, in one statement. */
|
|
205
|
+
deleteWhere: /* @__PURE__ */ method(/* @__PURE__ */ z.object({
|
|
206
|
+
namespace: /* @__PURE__ */ z.string().optional(),
|
|
207
|
+
collection: /* @__PURE__ */ z.string(),
|
|
208
|
+
filter: MutationFilterSchema
|
|
209
|
+
}), /* @__PURE__ */ z.object({ deleted: /* @__PURE__ */ z.number().int() }), {
|
|
210
|
+
kind: "mutation",
|
|
211
|
+
auth: "admin"
|
|
212
|
+
}),
|
|
213
|
+
/** Apply `data` to every record matching `filter`, in one statement. */
|
|
214
|
+
updateWhere: /* @__PURE__ */ method(/* @__PURE__ */ z.object({
|
|
215
|
+
namespace: /* @__PURE__ */ z.string().optional(),
|
|
216
|
+
collection: /* @__PURE__ */ z.string(),
|
|
217
|
+
filter: MutationFilterSchema,
|
|
218
|
+
data: /* @__PURE__ */ z.record(/* @__PURE__ */ z.string(), /* @__PURE__ */ z.unknown())
|
|
219
|
+
}), /* @__PURE__ */ z.object({ updated: /* @__PURE__ */ z.number().int() }), {
|
|
220
|
+
kind: "mutation",
|
|
221
|
+
auth: "admin"
|
|
222
|
+
}),
|
|
223
|
+
/** Count entries in a collection, optionally filtered. */
|
|
224
|
+
count: /* @__PURE__ */ method(/* @__PURE__ */ z.object({
|
|
225
|
+
namespace: /* @__PURE__ */ z.string().optional(),
|
|
226
|
+
collection: /* @__PURE__ */ z.string(),
|
|
227
|
+
filter: /* @__PURE__ */ QueryFilterSchema.optional()
|
|
228
|
+
}), /* @__PURE__ */ z.number(), { auth: "admin" }),
|
|
229
|
+
/** `COUNT(*)` plus one SUM/MIN/MAX per field, in one statement. Mirror of
|
|
230
|
+
* `settings-store.aggregate` — see it for why an unresolvable field is
|
|
231
|
+
* refused rather than dropped. */
|
|
232
|
+
aggregate: /* @__PURE__ */ method(/* @__PURE__ */ z.object({
|
|
233
|
+
namespace: /* @__PURE__ */ z.string().optional(),
|
|
234
|
+
collection: /* @__PURE__ */ z.string(),
|
|
235
|
+
fields: /* @__PURE__ */ z.array(AggregateFieldSchema).readonly(),
|
|
236
|
+
filter: /* @__PURE__ */ QueryFilterSchema.optional()
|
|
237
|
+
}), AggregateResultSchema, { auth: "admin" }),
|
|
238
|
+
/** Grouped counts per ((field-origin)/bucketSize) bucket, filtered. */
|
|
239
|
+
histogram: /* @__PURE__ */ method(/* @__PURE__ */ z.object({
|
|
240
|
+
namespace: /* @__PURE__ */ z.string().optional(),
|
|
241
|
+
collection: /* @__PURE__ */ z.string(),
|
|
242
|
+
field: /* @__PURE__ */ z.string(),
|
|
243
|
+
bucketSize: /* @__PURE__ */ z.number().int().positive(),
|
|
244
|
+
origin: /* @__PURE__ */ z.number().int(),
|
|
245
|
+
filter: /* @__PURE__ */ QueryFilterSchema.optional()
|
|
246
|
+
}), /* @__PURE__ */ z.array(/* @__PURE__ */ z.object({
|
|
247
|
+
bucket: /* @__PURE__ */ z.number().int(),
|
|
248
|
+
count: /* @__PURE__ */ z.number().int()
|
|
249
|
+
})).readonly(), { auth: "admin" }),
|
|
250
|
+
/** Check if a collection is empty. */
|
|
251
|
+
isEmpty: /* @__PURE__ */ method(/* @__PURE__ */ z.object({
|
|
252
|
+
namespace: /* @__PURE__ */ z.string().optional(),
|
|
253
|
+
collection: /* @__PURE__ */ z.string()
|
|
254
|
+
}), /* @__PURE__ */ z.boolean(), { auth: "admin" }),
|
|
255
|
+
/** Declare a typed (SQL-backed) collection with columns + indexes. */
|
|
256
|
+
declareCollection: /* @__PURE__ */ method(DeclareCollectionInputSchema, /* @__PURE__ */ z.void(), {
|
|
257
|
+
kind: "mutation",
|
|
258
|
+
auth: "admin"
|
|
259
|
+
})
|
|
260
|
+
},
|
|
261
|
+
vocabulary: { notOperatorFacing: NOT_A_DEVICE.INTERNAL }
|
|
262
|
+
};
|
|
263
|
+
//#endregion
|
|
264
|
+
//#region ../types/dist/esm/migrations/api/migration-api.v1.schema.mjs
|
|
265
|
+
/**
|
|
266
|
+
* The wire shapes of the migration API, version 1 (planning#447).
|
|
267
|
+
*
|
|
268
|
+
* A migration is code that outlives the server it was written against: an addon at
|
|
269
|
+
* version 1.4 that is brought to 1.9 in one jump still runs its 1.4 catalogue, against
|
|
270
|
+
* the 1.9 kernel. The only thing that code may call is {@link MigrationApiV1}; this file
|
|
271
|
+
* is the contract of every method of it, one Zod pair per method.
|
|
272
|
+
*
|
|
273
|
+
* APPEND-ONLY. A released method is never removed and never changes meaning: an input
|
|
274
|
+
* field is never removed or made required, an enum never narrows, an output field is
|
|
275
|
+
* never removed. A change that cannot be expressed that way is `migration-api.v2`, next
|
|
276
|
+
* to this file. `scripts/check-migration-api-append-only.ts` holds the line against
|
|
277
|
+
* `scripts/migration-api-contract.json`, and every `behaviours` id below must have an
|
|
278
|
+
* `it('<id>'` in `migration-api.contract.spec.ts`.
|
|
279
|
+
*/
|
|
280
|
+
var Rows = /* @__PURE__ */ z.record(/* @__PURE__ */ z.string(), /* @__PURE__ */ z.unknown());
|
|
281
|
+
var IntegrationId = /* @__PURE__ */ z.object({ integrationId: /* @__PURE__ */ z.string().min(1) });
|
|
282
|
+
var RecordId = /* @__PURE__ */ z.object({ id: /* @__PURE__ */ z.string().min(1) });
|
|
283
|
+
var RecordRowSchema = /* @__PURE__ */ z.object({
|
|
284
|
+
id: /* @__PURE__ */ z.string(),
|
|
285
|
+
deviceId: /* @__PURE__ */ z.number().int().nullable(),
|
|
286
|
+
at: /* @__PURE__ */ z.number().nullable(),
|
|
287
|
+
expiresAt: /* @__PURE__ */ z.number().nullable(),
|
|
288
|
+
rev: /* @__PURE__ */ z.number().int(),
|
|
289
|
+
updatedAt: /* @__PURE__ */ z.number(),
|
|
290
|
+
data: Rows
|
|
291
|
+
});
|
|
292
|
+
var RecordPutShape = {
|
|
293
|
+
id: /* @__PURE__ */ z.string().min(1),
|
|
294
|
+
deviceId: /* @__PURE__ */ z.number().int().optional(),
|
|
295
|
+
at: /* @__PURE__ */ z.number().int().optional(),
|
|
296
|
+
expiresAt: /* @__PURE__ */ z.number().int().optional(),
|
|
297
|
+
data: Rows
|
|
298
|
+
};
|
|
299
|
+
var MigrationIntegrationSchema = /* @__PURE__ */ z.object({
|
|
300
|
+
id: /* @__PURE__ */ z.string(),
|
|
301
|
+
addonId: /* @__PURE__ */ z.string(),
|
|
302
|
+
name: /* @__PURE__ */ z.string(),
|
|
303
|
+
info: Rows,
|
|
304
|
+
/** The registry's stored switch: read by the one-switch migration, nothing else. */
|
|
305
|
+
enabled: /* @__PURE__ */ z.boolean().optional(),
|
|
306
|
+
originStableId: /* @__PURE__ */ z.string().optional()
|
|
307
|
+
});
|
|
308
|
+
var MigrationDeviceSchema = /* @__PURE__ */ z.object({
|
|
309
|
+
id: /* @__PURE__ */ z.number().int(),
|
|
310
|
+
integrationId: /* @__PURE__ */ z.string().nullable().optional(),
|
|
311
|
+
/** The owning device; null or absent for a root. */
|
|
312
|
+
parentDeviceId: /* @__PURE__ */ z.number().int().nullable().optional(),
|
|
313
|
+
type: /* @__PURE__ */ z.string().optional(),
|
|
314
|
+
name: /* @__PURE__ */ z.string().optional(),
|
|
315
|
+
stableId: /* @__PURE__ */ z.string().optional()
|
|
316
|
+
});
|
|
317
|
+
/** What the engine says about the migration API it serves: lets an addon notice an older server. */
|
|
318
|
+
var MigrationApiInfoSchema = /* @__PURE__ */ z.object({
|
|
319
|
+
version: /* @__PURE__ */ z.number().int(),
|
|
320
|
+
methods: /* @__PURE__ */ z.array(/* @__PURE__ */ z.string())
|
|
321
|
+
});
|
|
322
|
+
var LogInput = /* @__PURE__ */ z.object({
|
|
323
|
+
message: /* @__PURE__ */ z.string(),
|
|
324
|
+
meta: /* @__PURE__ */ Rows.optional(),
|
|
325
|
+
/** Grouping tags of the line; a line about a device carries `{ deviceId }`. */
|
|
326
|
+
tags: /* @__PURE__ */ z.object({ deviceId: /* @__PURE__ */ z.number().int().optional() }).optional()
|
|
327
|
+
});
|
|
328
|
+
var MIGRATION_API_V1_METHODS = {
|
|
329
|
+
"ledger.declare": {
|
|
330
|
+
input: /* @__PURE__ */ z.object({
|
|
331
|
+
owner: /* @__PURE__ */ z.string().min(1),
|
|
332
|
+
metas: /* @__PURE__ */ z.array(MigrationMetaSchema)
|
|
333
|
+
}),
|
|
334
|
+
output: /* @__PURE__ */ z.object({
|
|
335
|
+
bootId: /* @__PURE__ */ z.string(),
|
|
336
|
+
snapshot: /* @__PURE__ */ z.enum([
|
|
337
|
+
"none",
|
|
338
|
+
"written",
|
|
339
|
+
"refused"
|
|
340
|
+
]),
|
|
341
|
+
steps: /* @__PURE__ */ z.array(MigrationOwnerStepSchema),
|
|
342
|
+
/** The migration API the engine serves; absent from a server that predates it. */
|
|
343
|
+
migrationApi: /* @__PURE__ */ MigrationApiInfoSchema.optional()
|
|
344
|
+
}),
|
|
345
|
+
behaviours: ["ledger.declare.answers-steps-in-engine-order", "ledger.declare.answers-the-migration-api"]
|
|
346
|
+
},
|
|
347
|
+
"ledger.start": {
|
|
348
|
+
input: /* @__PURE__ */ z.object({ id: /* @__PURE__ */ z.string().min(1) }),
|
|
349
|
+
output: /* @__PURE__ */ z.object({
|
|
350
|
+
proceed: /* @__PURE__ */ z.boolean(),
|
|
351
|
+
state: /* @__PURE__ */ z.union([/* @__PURE__ */ z.literal("pending"), MigrationStatusSchema]),
|
|
352
|
+
reason: /* @__PURE__ */ z.string().nullable()
|
|
353
|
+
}),
|
|
354
|
+
behaviours: ["ledger.start.proceeds-when-predecessors-applied"]
|
|
355
|
+
},
|
|
356
|
+
"ledger.finish": {
|
|
357
|
+
input: /* @__PURE__ */ z.object({
|
|
358
|
+
id: /* @__PURE__ */ z.string().min(1),
|
|
359
|
+
result: MigrationOwnerResultSchema
|
|
360
|
+
}),
|
|
361
|
+
output: /* @__PURE__ */ z.object({
|
|
362
|
+
status: MigrationStatusSchema,
|
|
363
|
+
error: /* @__PURE__ */ z.string().nullable(),
|
|
364
|
+
rowsChanged: /* @__PURE__ */ z.number().int().nonnegative()
|
|
365
|
+
}),
|
|
366
|
+
behaviours: ["ledger.finish.records-the-outcome"]
|
|
367
|
+
},
|
|
368
|
+
"legacyRows.read": {
|
|
369
|
+
input: IntegrationId,
|
|
370
|
+
output: Rows,
|
|
371
|
+
behaviours: [
|
|
372
|
+
"legacyRows.read.returns-stored-rows",
|
|
373
|
+
"legacyRows.read.absent-store-is-empty",
|
|
374
|
+
"legacyRows.caller.sibling-package"
|
|
375
|
+
]
|
|
376
|
+
},
|
|
377
|
+
"legacyRows.clear": {
|
|
378
|
+
input: IntegrationId,
|
|
379
|
+
output: /* @__PURE__ */ z.object({
|
|
380
|
+
rows: /* @__PURE__ */ z.number().int().nonnegative(),
|
|
381
|
+
secrets: /* @__PURE__ */ z.number().int().nonnegative()
|
|
382
|
+
}),
|
|
383
|
+
behaviours: ["legacyRows.clear.deletes-the-rows", "legacyRows.clear.absent-store-is-noop"]
|
|
384
|
+
},
|
|
385
|
+
"legacyRows.patch": {
|
|
386
|
+
input: /* @__PURE__ */ IntegrationId.extend({ patch: Rows }),
|
|
387
|
+
output: /* @__PURE__ */ z.object({ written: /* @__PURE__ */ z.boolean() }),
|
|
388
|
+
behaviours: ["legacyRows.patch.upserts-keys-and-keeps-the-rest", "legacyRows.patch.absent-store-writes-nothing"]
|
|
389
|
+
},
|
|
390
|
+
"legacyRows.deleteKeys": {
|
|
391
|
+
input: /* @__PURE__ */ IntegrationId.extend({ keys: /* @__PURE__ */ z.array(/* @__PURE__ */ z.string().min(1)) }),
|
|
392
|
+
output: /* @__PURE__ */ z.object({
|
|
393
|
+
present: /* @__PURE__ */ z.boolean(),
|
|
394
|
+
removed: Rows
|
|
395
|
+
}),
|
|
396
|
+
behaviours: ["legacyRows.deleteKeys.removes-the-named-keys", "legacyRows.deleteKeys.absent-store-reports-not-present"]
|
|
397
|
+
},
|
|
398
|
+
"records.get": {
|
|
399
|
+
input: RecordId,
|
|
400
|
+
output: /* @__PURE__ */ RecordRowSchema.nullable(),
|
|
401
|
+
behaviours: ["records.get.returns-the-row-or-null"]
|
|
402
|
+
},
|
|
403
|
+
"records.getResolved": {
|
|
404
|
+
input: RecordId,
|
|
405
|
+
output: /* @__PURE__ */ RecordRowSchema.nullable(),
|
|
406
|
+
behaviours: ["records.getResolved.resolves-secret-fields"]
|
|
407
|
+
},
|
|
408
|
+
"records.put": {
|
|
409
|
+
input: /* @__PURE__ */ z.object({
|
|
410
|
+
...RecordPutShape,
|
|
411
|
+
ifRev: /* @__PURE__ */ z.number().int().optional()
|
|
412
|
+
}),
|
|
413
|
+
output: /* @__PURE__ */ z.object({ rev: /* @__PURE__ */ z.number().int() }),
|
|
414
|
+
behaviours: ["records.put.creates-and-replaces", "records.put.if-rev-conflict-throws"]
|
|
415
|
+
},
|
|
416
|
+
"records.putMany": {
|
|
417
|
+
input: /* @__PURE__ */ z.object({ records: /* @__PURE__ */ z.array(/* @__PURE__ */ z.object(RecordPutShape)) }),
|
|
418
|
+
output: /* @__PURE__ */ z.object({ count: /* @__PURE__ */ z.number().int().nonnegative() }),
|
|
419
|
+
behaviours: ["records.putMany.writes-every-row"]
|
|
420
|
+
},
|
|
421
|
+
"records.patch": {
|
|
422
|
+
input: /* @__PURE__ */ RecordId.extend({
|
|
423
|
+
partial: Rows,
|
|
424
|
+
ifRev: /* @__PURE__ */ z.number().int().optional()
|
|
425
|
+
}),
|
|
426
|
+
output: /* @__PURE__ */ z.object({ rev: /* @__PURE__ */ z.number().int() }),
|
|
427
|
+
behaviours: ["records.patch.merges-and-null-removes"]
|
|
428
|
+
},
|
|
429
|
+
"records.delete": {
|
|
430
|
+
input: RecordId,
|
|
431
|
+
output: /* @__PURE__ */ z.object({ deleted: /* @__PURE__ */ z.boolean() }),
|
|
432
|
+
behaviours: ["records.delete.reports-whether-a-row-went"]
|
|
433
|
+
},
|
|
434
|
+
"records.query": {
|
|
435
|
+
input: /* @__PURE__ */ z.object({
|
|
436
|
+
deviceId: /* @__PURE__ */ z.number().int().optional(),
|
|
437
|
+
atFrom: /* @__PURE__ */ z.number().optional(),
|
|
438
|
+
atTo: /* @__PURE__ */ z.number().optional(),
|
|
439
|
+
where: /* @__PURE__ */ RecordWhereSchema.optional(),
|
|
440
|
+
limit: /* @__PURE__ */ z.number().int().min(1).optional(),
|
|
441
|
+
cursor: /* @__PURE__ */ z.string().min(1).optional(),
|
|
442
|
+
resolveSecrets: /* @__PURE__ */ z.boolean().optional()
|
|
443
|
+
}),
|
|
444
|
+
output: /* @__PURE__ */ z.object({
|
|
445
|
+
records: /* @__PURE__ */ z.array(RecordRowSchema),
|
|
446
|
+
nextCursor: /* @__PURE__ */ z.string().nullable()
|
|
447
|
+
}),
|
|
448
|
+
behaviours: ["records.query.pages-with-a-cursor", "records.query.filters-on-a-declared-index"]
|
|
449
|
+
},
|
|
450
|
+
"records.deleteWhere": {
|
|
451
|
+
input: /* @__PURE__ */ z.object({
|
|
452
|
+
deviceId: /* @__PURE__ */ z.number().int().optional(),
|
|
453
|
+
atBefore: /* @__PURE__ */ z.number().optional(),
|
|
454
|
+
where: /* @__PURE__ */ RecordWhereSchema.optional()
|
|
455
|
+
}),
|
|
456
|
+
output: /* @__PURE__ */ z.object({ count: /* @__PURE__ */ z.number().int().nonnegative() }),
|
|
457
|
+
behaviours: ["records.deleteWhere.deletes-the-matching-rows"]
|
|
458
|
+
},
|
|
459
|
+
"settings.read": {
|
|
460
|
+
input: /* @__PURE__ */ z.object({}),
|
|
461
|
+
output: /* @__PURE__ */ z.object({ store: Rows }),
|
|
462
|
+
behaviours: ["settings.read.returns-the-addon-store"]
|
|
463
|
+
},
|
|
464
|
+
"settings.write": {
|
|
465
|
+
input: /* @__PURE__ */ z.object({ patch: Rows }),
|
|
466
|
+
output: /* @__PURE__ */ z.object({}),
|
|
467
|
+
behaviours: ["settings.write.merges-and-keeps-other-keys"]
|
|
468
|
+
},
|
|
469
|
+
"settings.deleteKeys": {
|
|
470
|
+
input: /* @__PURE__ */ z.object({ keys: /* @__PURE__ */ z.array(/* @__PURE__ */ z.string().min(1)) }),
|
|
471
|
+
output: /* @__PURE__ */ z.object({ removed: /* @__PURE__ */ z.array(/* @__PURE__ */ z.string()) }),
|
|
472
|
+
behaviours: ["settings.deleteKeys.removes-only-the-named-keys"]
|
|
473
|
+
},
|
|
474
|
+
"deviceSettings.listIds": {
|
|
475
|
+
input: /* @__PURE__ */ z.object({}),
|
|
476
|
+
output: /* @__PURE__ */ z.object({ deviceIds: /* @__PURE__ */ z.array(/* @__PURE__ */ z.number().int()) }),
|
|
477
|
+
behaviours: ["deviceSettings.listIds.names-only-the-addons-own-devices"]
|
|
478
|
+
},
|
|
479
|
+
"deviceSettings.read": {
|
|
480
|
+
input: /* @__PURE__ */ z.object({ deviceIds: /* @__PURE__ */ z.array(/* @__PURE__ */ z.number().int()) }),
|
|
481
|
+
output: /* @__PURE__ */ z.object({ blobs: /* @__PURE__ */ z.record(/* @__PURE__ */ z.string(), Rows) }),
|
|
482
|
+
behaviours: ["deviceSettings.read.returns-only-the-addons-own-blobs"]
|
|
483
|
+
},
|
|
484
|
+
"secrets.resolve": {
|
|
485
|
+
input: /* @__PURE__ */ z.object({ refs: /* @__PURE__ */ z.array(/* @__PURE__ */ z.string()) }),
|
|
486
|
+
output: /* @__PURE__ */ z.object({ values: /* @__PURE__ */ z.record(/* @__PURE__ */ z.string(), /* @__PURE__ */ z.string().nullable()) }),
|
|
487
|
+
behaviours: ["secrets.resolve.answers-null-for-a-missing-ref"]
|
|
488
|
+
},
|
|
489
|
+
"secrets.put": {
|
|
490
|
+
input: /* @__PURE__ */ z.object({
|
|
491
|
+
ref: /* @__PURE__ */ z.string().min(1),
|
|
492
|
+
value: /* @__PURE__ */ z.string()
|
|
493
|
+
}),
|
|
494
|
+
output: /* @__PURE__ */ z.object({}),
|
|
495
|
+
behaviours: ["secrets.put.stores-under-the-owner"]
|
|
496
|
+
},
|
|
497
|
+
"secrets.delete": {
|
|
498
|
+
input: /* @__PURE__ */ z.object({ refs: /* @__PURE__ */ z.array(/* @__PURE__ */ z.string()) }),
|
|
499
|
+
output: /* @__PURE__ */ z.object({ deleted: /* @__PURE__ */ z.number().int().nonnegative() }),
|
|
500
|
+
behaviours: ["secrets.delete.ignores-unknown-refs"]
|
|
501
|
+
},
|
|
502
|
+
"integrations.list": {
|
|
503
|
+
input: /* @__PURE__ */ z.object({}),
|
|
504
|
+
output: /* @__PURE__ */ z.object({ integrations: /* @__PURE__ */ z.array(MigrationIntegrationSchema) }),
|
|
505
|
+
behaviours: ["integrations.list.lists-every-integration"]
|
|
506
|
+
},
|
|
507
|
+
"integrations.get": {
|
|
508
|
+
input: /* @__PURE__ */ z.object({ id: /* @__PURE__ */ z.string().min(1) }),
|
|
509
|
+
output: /* @__PURE__ */ MigrationIntegrationSchema.nullable(),
|
|
510
|
+
behaviours: ["integrations.get.null-for-an-unknown-id"]
|
|
511
|
+
},
|
|
512
|
+
"devices.list": {
|
|
513
|
+
input: /* @__PURE__ */ z.object({
|
|
514
|
+
addonId: /* @__PURE__ */ z.string().min(1),
|
|
515
|
+
integrationId: /* @__PURE__ */ z.string().min(1).optional()
|
|
516
|
+
}),
|
|
517
|
+
output: /* @__PURE__ */ z.object({ devices: /* @__PURE__ */ z.array(MigrationDeviceSchema) }),
|
|
518
|
+
behaviours: ["devices.list.scoped-to-the-addon", "devices.list.filters-by-integration"]
|
|
519
|
+
},
|
|
520
|
+
"devices.get": {
|
|
521
|
+
input: /* @__PURE__ */ z.object({ deviceId: /* @__PURE__ */ z.number().int() }),
|
|
522
|
+
output: /* @__PURE__ */ z.object({
|
|
523
|
+
id: /* @__PURE__ */ z.number().int(),
|
|
524
|
+
integrationId: /* @__PURE__ */ z.string().nullable(),
|
|
525
|
+
/** Whether the device carries any stored config; its content is not offered. */
|
|
526
|
+
hasConfig: /* @__PURE__ */ z.boolean()
|
|
527
|
+
}).nullable(),
|
|
528
|
+
behaviours: ["devices.get.null-for-an-unknown-id", "devices.get.reports-link-and-config"]
|
|
529
|
+
},
|
|
530
|
+
"devices.aliases": {
|
|
531
|
+
input: /* @__PURE__ */ z.object({ deviceIds: /* @__PURE__ */ z.array(/* @__PURE__ */ z.number().int()) }),
|
|
532
|
+
output: /* @__PURE__ */ z.object({ aliases: /* @__PURE__ */ z.record(/* @__PURE__ */ z.string(), /* @__PURE__ */ z.string()) }),
|
|
533
|
+
behaviours: ["devices.aliases.answers-for-the-named-ids-only"]
|
|
534
|
+
},
|
|
535
|
+
"devices.setIntegrationId": {
|
|
536
|
+
input: /* @__PURE__ */ z.object({
|
|
537
|
+
deviceId: /* @__PURE__ */ z.number().int(),
|
|
538
|
+
integrationId: /* @__PURE__ */ z.string().min(1)
|
|
539
|
+
}),
|
|
540
|
+
output: /* @__PURE__ */ z.object({}),
|
|
541
|
+
behaviours: ["devices.setIntegrationId.links-the-device"]
|
|
542
|
+
},
|
|
543
|
+
"node.localNodeId": {
|
|
544
|
+
input: /* @__PURE__ */ z.object({}),
|
|
545
|
+
output: /* @__PURE__ */ z.object({ nodeId: /* @__PURE__ */ z.string() }),
|
|
546
|
+
behaviours: ["node.localNodeId.names-this-node"]
|
|
547
|
+
},
|
|
548
|
+
"log.info": {
|
|
549
|
+
input: LogInput,
|
|
550
|
+
output: /* @__PURE__ */ z.object({}),
|
|
551
|
+
behaviours: ["log.info.writes-a-line"]
|
|
552
|
+
},
|
|
553
|
+
"log.warn": {
|
|
554
|
+
input: LogInput,
|
|
555
|
+
output: /* @__PURE__ */ z.object({}),
|
|
556
|
+
behaviours: ["log.warn.writes-a-line"]
|
|
557
|
+
}
|
|
558
|
+
};
|
|
559
|
+
//#endregion
|
|
560
|
+
//#region ../types/dist/esm/capabilities/migrations.cap.mjs
|
|
561
|
+
/**
|
|
562
|
+
* migrations — the ledger and the controls of the boot-time migration engine
|
|
563
|
+
* (D987). Hub-only and internal: `sqlite-settings` is the registrant, because the
|
|
564
|
+
* ledger lives INSIDE the database files it serves (`camstack.db`, `events.db`,
|
|
565
|
+
* `history.db`) and only its connection or worker may touch them (D679).
|
|
566
|
+
*
|
|
567
|
+
* The engine itself runs in the owner's `afterOpen`, before any provider is
|
|
568
|
+
* returned; this cap is how the rest of the system READS what happened (the Alert
|
|
569
|
+
* Center reconciler) and how an operator acts on it (retry, restore the
|
|
570
|
+
* pre-migration snapshot). Every method is `admin`: `internal` does not gate the
|
|
571
|
+
* mount.
|
|
572
|
+
*/
|
|
573
|
+
var migrationsCapability = {
|
|
574
|
+
name: "migrations",
|
|
575
|
+
scope: "system",
|
|
576
|
+
mode: "singleton",
|
|
577
|
+
internal: true,
|
|
578
|
+
methods: {
|
|
579
|
+
/** Every ledger row of every owned database. The authority for "did it run". */
|
|
580
|
+
listLedger: /* @__PURE__ */ method(/* @__PURE__ */ z.object({}), /* @__PURE__ */ z.object({ entries: /* @__PURE__ */ z.array(MigrationLedgerEntrySchema) }), { auth: "admin" }),
|
|
581
|
+
/** The catalogued migrations that are not applied, with their state and reason. */
|
|
582
|
+
listPending: /* @__PURE__ */ method(/* @__PURE__ */ z.object({ owner: /* @__PURE__ */ z.string().optional() }), /* @__PURE__ */ z.object({ pending: /* @__PURE__ */ z.array(MigrationPendingEntrySchema) }), { auth: "admin" }),
|
|
583
|
+
/**
|
|
584
|
+
* Run ONE hub-store migration inside a transaction and roll it back: what it
|
|
585
|
+
* would change, per table, and whether it throws. Writes nothing.
|
|
586
|
+
*/
|
|
587
|
+
dryRun: /* @__PURE__ */ method(/* @__PURE__ */ z.object({ id: /* @__PURE__ */ z.string().min(1) }), MigrationDryRunResultSchema, { auth: "admin" }),
|
|
588
|
+
/** Record a failure the engine could not see itself (a runner that gave up). */
|
|
589
|
+
markFailed: /* @__PURE__ */ method(/* @__PURE__ */ z.object({
|
|
590
|
+
id: /* @__PURE__ */ z.string().min(1),
|
|
591
|
+
error: /* @__PURE__ */ z.string().min(1)
|
|
592
|
+
}), MigrationLedgerEntrySchema, {
|
|
593
|
+
kind: "mutation",
|
|
594
|
+
auth: "admin"
|
|
595
|
+
}),
|
|
596
|
+
/**
|
|
597
|
+
* Clear `failed`, `blocked` and `held` for this id and the ids it blocked, then
|
|
598
|
+
* run the pending migrations again (a snapshot first). Returns the rows it touched.
|
|
599
|
+
*/
|
|
600
|
+
retry: /* @__PURE__ */ method(/* @__PURE__ */ z.object({ id: /* @__PURE__ */ z.string().min(1) }), /* @__PURE__ */ z.object({ entries: /* @__PURE__ */ z.array(MigrationLedgerEntrySchema) }), {
|
|
601
|
+
kind: "mutation",
|
|
602
|
+
auth: "admin"
|
|
603
|
+
}),
|
|
604
|
+
/**
|
|
605
|
+
* Schedule the restore of a pre-migration snapshot at the next restart and HOLD
|
|
606
|
+
* the migrations it predates, so they do not simply run again.
|
|
607
|
+
*/
|
|
608
|
+
restorePreMigration: /* @__PURE__ */ method(/* @__PURE__ */ z.object({
|
|
609
|
+
database: DataStoreDatabaseSchema,
|
|
610
|
+
snapshotId: /* @__PURE__ */ z.string().min(1)
|
|
611
|
+
}), /* @__PURE__ */ z.object({
|
|
612
|
+
scheduled: /* @__PURE__ */ z.boolean(),
|
|
613
|
+
held: /* @__PURE__ */ z.array(/* @__PURE__ */ z.string()),
|
|
614
|
+
restartRequired: /* @__PURE__ */ z.boolean()
|
|
615
|
+
}), {
|
|
616
|
+
kind: "mutation",
|
|
617
|
+
auth: "admin"
|
|
618
|
+
}),
|
|
619
|
+
/**
|
|
620
|
+
* An ADDON offers its catalogue at its own boot (D987 M3). The engine checks it
|
|
621
|
+
* together with every other owner's, takes the pre-migration snapshot of each
|
|
622
|
+
* file a pending migration touches, and answers the owner's steps in the order
|
|
623
|
+
* the framework decides. A catalogue the engine refuses (a cycle, a foreign
|
|
624
|
+
* owner, a body kind the owner cannot run) is refused whole and writes nothing.
|
|
625
|
+
*/
|
|
626
|
+
declareOwner: /* @__PURE__ */ method(/* @__PURE__ */ z.object({
|
|
627
|
+
owner: /* @__PURE__ */ z.string().min(1),
|
|
628
|
+
metas: /* @__PURE__ */ z.array(MigrationMetaSchema),
|
|
629
|
+
/** Ids the owner deliberately removed: an applied row of one is fine, never "newer". */
|
|
630
|
+
retired: /* @__PURE__ */ z.array(/* @__PURE__ */ z.string().min(1)).optional()
|
|
631
|
+
}), /* @__PURE__ */ z.object({
|
|
632
|
+
bootId: /* @__PURE__ */ z.string(),
|
|
633
|
+
snapshot: /* @__PURE__ */ z.enum([
|
|
634
|
+
"none",
|
|
635
|
+
"written",
|
|
636
|
+
"refused"
|
|
637
|
+
]),
|
|
638
|
+
steps: /* @__PURE__ */ z.array(MigrationOwnerStepSchema),
|
|
639
|
+
/** The migration API this engine serves (additive: a server that predates it omits it). */
|
|
640
|
+
migrationApi: /* @__PURE__ */ MigrationApiInfoSchema.optional()
|
|
641
|
+
}), {
|
|
642
|
+
kind: "mutation",
|
|
643
|
+
auth: "admin"
|
|
644
|
+
}),
|
|
645
|
+
/**
|
|
646
|
+
* The gate before one owner migration runs: `proceed: false` when a
|
|
647
|
+
* predecessor is not applied (the row is written `blocked`), the id is held, or
|
|
648
|
+
* the snapshot was refused.
|
|
649
|
+
*/
|
|
650
|
+
startMigration: /* @__PURE__ */ method(/* @__PURE__ */ z.object({ id: /* @__PURE__ */ z.string().min(1) }), /* @__PURE__ */ z.object({
|
|
651
|
+
proceed: /* @__PURE__ */ z.boolean(),
|
|
652
|
+
state: /* @__PURE__ */ z.union([/* @__PURE__ */ z.literal("pending"), MigrationStatusSchema]),
|
|
653
|
+
reason: /* @__PURE__ */ z.string().nullable()
|
|
654
|
+
}), {
|
|
655
|
+
kind: "mutation",
|
|
656
|
+
auth: "admin"
|
|
657
|
+
}),
|
|
658
|
+
/**
|
|
659
|
+
* The owner's result for one migration. A `plan` is applied by the engine in one
|
|
660
|
+
* transaction with the `applied` row; a `procedure` outcome is recorded as it
|
|
661
|
+
* is; a `failed` report is recorded and blocks the dependents.
|
|
662
|
+
*/
|
|
663
|
+
finishMigration: /* @__PURE__ */ method(/* @__PURE__ */ z.object({
|
|
664
|
+
id: /* @__PURE__ */ z.string().min(1),
|
|
665
|
+
result: MigrationOwnerResultSchema
|
|
666
|
+
}), /* @__PURE__ */ z.object({
|
|
667
|
+
status: MigrationStatusSchema,
|
|
668
|
+
error: /* @__PURE__ */ z.string().nullable(),
|
|
669
|
+
rowsChanged: /* @__PURE__ */ z.number().int().nonnegative()
|
|
670
|
+
}), {
|
|
671
|
+
kind: "mutation",
|
|
672
|
+
auth: "admin"
|
|
673
|
+
}),
|
|
674
|
+
/**
|
|
675
|
+
* Migration-only. The stored rows of one integration, markers included, on
|
|
676
|
+
* the settings connection. Empty when the store is gone — a copy migration
|
|
677
|
+
* on a node that already dropped it is a no-op. Deleted with the last copy
|
|
678
|
+
* migration. Not a settings API.
|
|
679
|
+
*/
|
|
680
|
+
readLegacyIntegrationRows: /* @__PURE__ */ method(/* @__PURE__ */ z.object({ integrationId: /* @__PURE__ */ z.string().min(1) }), /* @__PURE__ */ z.record(/* @__PURE__ */ z.string(), /* @__PURE__ */ z.unknown()), { auth: "admin" }),
|
|
681
|
+
/**
|
|
682
|
+
* Migration-only. Delete that integration's rows. The caller releases the
|
|
683
|
+
* keychain values first. `secrets` is how many marker refs the rows held.
|
|
684
|
+
* A missing store deletes nothing. Deleted with the last copy migration.
|
|
685
|
+
*/
|
|
686
|
+
clearLegacyIntegrationRows: /* @__PURE__ */ method(/* @__PURE__ */ z.object({ integrationId: /* @__PURE__ */ z.string().min(1) }), /* @__PURE__ */ z.object({
|
|
687
|
+
rows: /* @__PURE__ */ z.number().int().nonnegative(),
|
|
688
|
+
secrets: /* @__PURE__ */ z.number().int().nonnegative()
|
|
689
|
+
}), {
|
|
690
|
+
kind: "mutation",
|
|
691
|
+
auth: "admin"
|
|
692
|
+
}),
|
|
693
|
+
/**
|
|
694
|
+
* Migration-only. Upsert the given keys and leave every other key as stored.
|
|
695
|
+
* `written` is false when the store is gone. Deleted with the last copy migration.
|
|
696
|
+
*/
|
|
697
|
+
patchLegacyIntegrationRows: /* @__PURE__ */ method(/* @__PURE__ */ z.object({
|
|
698
|
+
integrationId: /* @__PURE__ */ z.string().min(1),
|
|
699
|
+
patch: /* @__PURE__ */ z.record(/* @__PURE__ */ z.string(), /* @__PURE__ */ z.unknown())
|
|
700
|
+
}), /* @__PURE__ */ z.object({ written: /* @__PURE__ */ z.boolean() }), {
|
|
701
|
+
kind: "mutation",
|
|
702
|
+
auth: "admin"
|
|
703
|
+
}),
|
|
704
|
+
/**
|
|
705
|
+
* Migration-only. Remove the named keys. `present` is false when the store
|
|
706
|
+
* is gone; `removed` is what those keys held (markers included). Deleted
|
|
707
|
+
* with the last copy migration.
|
|
708
|
+
*/
|
|
709
|
+
deleteLegacyIntegrationRowKeys: /* @__PURE__ */ method(/* @__PURE__ */ z.object({
|
|
710
|
+
integrationId: /* @__PURE__ */ z.string().min(1),
|
|
711
|
+
keys: /* @__PURE__ */ z.array(/* @__PURE__ */ z.string().min(1))
|
|
712
|
+
}), /* @__PURE__ */ z.object({
|
|
713
|
+
present: /* @__PURE__ */ z.boolean(),
|
|
714
|
+
removed: /* @__PURE__ */ z.record(/* @__PURE__ */ z.string(), /* @__PURE__ */ z.unknown())
|
|
715
|
+
}), {
|
|
716
|
+
kind: "mutation",
|
|
717
|
+
auth: "admin"
|
|
718
|
+
})
|
|
719
|
+
},
|
|
720
|
+
vocabulary: { notOperatorFacing: NOT_A_DEVICE.INTERNAL }
|
|
721
|
+
};
|
|
722
|
+
//#endregion
|
|
723
|
+
//#region ../types/dist/esm/capabilities/storage-admin.cap.mjs
|
|
724
|
+
/** One table of the settings database. */
|
|
725
|
+
var StorageTableSchema = /* @__PURE__ */ z.object({
|
|
726
|
+
/** The table's full name, e.g. `recorder:addon-settings` or `addon-device-settings`. */
|
|
727
|
+
name: /* @__PURE__ */ z.string(),
|
|
728
|
+
/** The owner prefix of a scoped name (`recorder` for `recorder:addon-settings`), else null. */
|
|
729
|
+
owner: /* @__PURE__ */ z.string().nullable(),
|
|
730
|
+
rows: /* @__PURE__ */ z.number().int().nonnegative(),
|
|
731
|
+
/** Bytes the table's pages occupy (`dbstat`); null when the engine cannot measure. */
|
|
732
|
+
bytes: /* @__PURE__ */ z.number().int().nonnegative().nullable(),
|
|
733
|
+
/** Declared by an addon since this engine process started (a running addon claims it). */
|
|
734
|
+
declaredThisBoot: /* @__PURE__ */ z.boolean()
|
|
735
|
+
});
|
|
736
|
+
/** One declared record kind (D881) as System -> Data shows it. */
|
|
737
|
+
var StorageKindSchema = /* @__PURE__ */ z.object({
|
|
738
|
+
owner: /* @__PURE__ */ z.string(),
|
|
739
|
+
kind: /* @__PURE__ */ z.string(),
|
|
740
|
+
database: /* @__PURE__ */ z.enum(["settings", "events"]),
|
|
741
|
+
class: /* @__PURE__ */ z.string(),
|
|
742
|
+
state: /* @__PURE__ */ z.enum([
|
|
743
|
+
"declared",
|
|
744
|
+
"orphaned",
|
|
745
|
+
"dropped"
|
|
746
|
+
]),
|
|
747
|
+
/** An owner declared this kind since the engine started. */
|
|
748
|
+
declaredThisBoot: /* @__PURE__ */ z.boolean(),
|
|
749
|
+
/** `null` when the caller asked for no counts (`counts: false`). */
|
|
750
|
+
rows: /* @__PURE__ */ z.number().int().nonnegative().nullable(),
|
|
751
|
+
/** Rows x the average size of a sample; null for an empty kind. */
|
|
752
|
+
bytesEstimate: /* @__PURE__ */ z.number().int().nonnegative().nullable(),
|
|
753
|
+
writeTrigger: /* @__PURE__ */ z.string(),
|
|
754
|
+
retention: RecordRetentionSchema,
|
|
755
|
+
/** `true` when the kind is an entry kind (the generic entries UI lists it). */
|
|
756
|
+
entry: /* @__PURE__ */ z.boolean(),
|
|
757
|
+
/** The whole declaration, secret paths and entry descriptor included (the entries service builds its handle from it). */
|
|
758
|
+
declaration: RecordKindDeclarationSchema
|
|
759
|
+
});
|
|
760
|
+
/** A record kind nobody declared since its owner started, or whose owner is gone. */
|
|
761
|
+
var StaleKindFindingSchema = /* @__PURE__ */ z.object({
|
|
762
|
+
owner: /* @__PURE__ */ z.string(),
|
|
763
|
+
kind: /* @__PURE__ */ z.string(),
|
|
764
|
+
/** `unknown`: the owner could not be judged (not running, or its state unreadable) - never dropped. */
|
|
765
|
+
verdict: /* @__PURE__ */ z.enum(["orphaned", "unknown"]),
|
|
766
|
+
reason: /* @__PURE__ */ z.string(),
|
|
767
|
+
rows: /* @__PURE__ */ z.number().int().nonnegative().nullable(),
|
|
768
|
+
/** local-auth's tables are never dropped by this audit. */
|
|
769
|
+
protected: /* @__PURE__ */ z.boolean()
|
|
770
|
+
});
|
|
771
|
+
/** A stored global-settings key the running addon no longer declares. */
|
|
772
|
+
var StaleSettingsKeyFindingSchema = /* @__PURE__ */ z.object({
|
|
773
|
+
addonId: /* @__PURE__ */ z.string(),
|
|
774
|
+
/** The stored key as written, a per-node `<key>@<nodeId>` suffix included. */
|
|
775
|
+
key: /* @__PURE__ */ z.string(),
|
|
776
|
+
/**
|
|
777
|
+
* Keychain refs whose ONLY marker sits under this key: in use by stale data,
|
|
778
|
+
* not orphans yet. Removing the key releases them.
|
|
779
|
+
*/
|
|
780
|
+
secretRefs: /* @__PURE__ */ z.array(/* @__PURE__ */ z.string())
|
|
781
|
+
});
|
|
782
|
+
/** An addon the audit could not judge, with the reason. Never reported as stale. */
|
|
783
|
+
var StaleUnknownSchema = /* @__PURE__ */ z.object({
|
|
784
|
+
subject: /* @__PURE__ */ z.string(),
|
|
785
|
+
reason: /* @__PURE__ */ z.string()
|
|
786
|
+
});
|
|
787
|
+
var StaleDataReportSchema = /* @__PURE__ */ z.object({
|
|
788
|
+
/** Epoch ms of the last finished scan; `null` before the first. */
|
|
789
|
+
scannedAt: /* @__PURE__ */ z.number().nullable(),
|
|
790
|
+
scanning: /* @__PURE__ */ z.boolean(),
|
|
791
|
+
trigger: /* @__PURE__ */ z.enum([
|
|
792
|
+
"boot",
|
|
793
|
+
"interval",
|
|
794
|
+
"manual"
|
|
795
|
+
]).nullable(),
|
|
796
|
+
kinds: /* @__PURE__ */ z.array(StaleKindFindingSchema),
|
|
797
|
+
settingsKeys: /* @__PURE__ */ z.array(StaleSettingsKeyFindingSchema),
|
|
798
|
+
unknown: /* @__PURE__ */ z.array(StaleUnknownSchema)
|
|
799
|
+
});
|
|
800
|
+
/**
|
|
801
|
+
* storage-admin - the operator's maintenance reach into the databases: list
|
|
802
|
+
* their tables and record kinds, read a kind for diagnosis. Read-only: a table
|
|
803
|
+
* the code no longer creates is dropped by hand, offline (D901).
|
|
804
|
+
*
|
|
805
|
+
* Hub-only, internal and `auth: 'admin'` explicitly (`internal` does not gate
|
|
806
|
+
* the mount, see `data-store-provider`). `listTables` is LOGGED by the engine
|
|
807
|
+
* with the counts.
|
|
808
|
+
*
|
|
809
|
+
* `listTables` is READ-ONLY: it never creates a table, which `count` and `get`
|
|
810
|
+
* on an undeclared scoped name used to do.
|
|
811
|
+
*/
|
|
812
|
+
var storageAdminCapability = {
|
|
813
|
+
name: "storage-admin",
|
|
814
|
+
scope: "system",
|
|
815
|
+
mode: "singleton",
|
|
816
|
+
internal: true,
|
|
817
|
+
methods: {
|
|
818
|
+
/**
|
|
819
|
+
* Every table of the settings database with its row count and size,
|
|
820
|
+
* optionally only those owned by `ownerPrefix`. Reads only.
|
|
821
|
+
*/
|
|
822
|
+
listTables: /* @__PURE__ */ method(/* @__PURE__ */ z.object({ ownerPrefix: /* @__PURE__ */ z.string().min(1).optional() }), /* @__PURE__ */ z.object({ tables: /* @__PURE__ */ z.array(StorageTableSchema) }), { auth: "admin" }),
|
|
823
|
+
/** Every record kind of both files with rows, a size estimate, class and retention (D881). */
|
|
824
|
+
listKinds: /* @__PURE__ */ method(/* @__PURE__ */ z.object({
|
|
825
|
+
owner: /* @__PURE__ */ z.string().min(1).optional(),
|
|
826
|
+
/** `false` skips the per-kind row count (a catalog read only). Default true. */
|
|
827
|
+
counts: /* @__PURE__ */ z.boolean().optional()
|
|
828
|
+
}), /* @__PURE__ */ z.object({ kinds: /* @__PURE__ */ z.array(StorageKindSchema) }), { auth: "admin" }),
|
|
829
|
+
/**
|
|
830
|
+
* Read-only diagnosis of ANY owner's kind: the same indexed query as the
|
|
831
|
+
* owner's, secret fields redacted, audited in the engine log.
|
|
832
|
+
*/
|
|
833
|
+
readRecords: /* @__PURE__ */ method(/* @__PURE__ */ RecordQueryInputSchema.extend({
|
|
834
|
+
owner: /* @__PURE__ */ z.string().min(1),
|
|
835
|
+
kind: RecordKindNameSchema
|
|
836
|
+
}), RecordQueryResultSchema, { auth: "admin" }),
|
|
837
|
+
/**
|
|
838
|
+
* The last stale-data scan (read-only detection): record kinds left behind
|
|
839
|
+
* and settings keys no running addon declares. Held in memory; a scan runs
|
|
840
|
+
* at hub boot, every 24 h and on `scanStaleData`.
|
|
841
|
+
*/
|
|
842
|
+
staleDataReport: /* @__PURE__ */ method(/* @__PURE__ */ z.object({}), StaleDataReportSchema, { auth: "admin" }),
|
|
843
|
+
/** Scan now. Detection only: it logs findings (owner and key, never values) and changes nothing. */
|
|
844
|
+
scanStaleData: /* @__PURE__ */ method(/* @__PURE__ */ z.object({}), StaleDataReportSchema, {
|
|
845
|
+
kind: "mutation",
|
|
846
|
+
auth: "admin"
|
|
847
|
+
}),
|
|
848
|
+
/**
|
|
849
|
+
* Drop an ORPHANED kind: its rows, their keychain values, then mark it
|
|
850
|
+
* dropped. The verdict is re-checked at call time; anything not still
|
|
851
|
+
* orphaned (or a protected owner) is refused.
|
|
852
|
+
*/
|
|
853
|
+
dropOrphanedKind: /* @__PURE__ */ method(/* @__PURE__ */ z.object({
|
|
854
|
+
owner: /* @__PURE__ */ z.string().min(1),
|
|
855
|
+
kind: RecordKindNameSchema
|
|
856
|
+
}), /* @__PURE__ */ z.object({
|
|
857
|
+
deleted: /* @__PURE__ */ z.number().int().nonnegative(),
|
|
858
|
+
secretsReleased: /* @__PURE__ */ z.number().int().nonnegative()
|
|
859
|
+
}), {
|
|
860
|
+
kind: "mutation",
|
|
861
|
+
auth: "admin",
|
|
862
|
+
caller: "required"
|
|
863
|
+
}),
|
|
864
|
+
/**
|
|
865
|
+
* Unset one stale settings key on a running addon (an owner-side write that
|
|
866
|
+
* also clears the keychain values the key held). Re-checked at call time.
|
|
867
|
+
*/
|
|
868
|
+
unsetStaleSettingsKey: /* @__PURE__ */ method(/* @__PURE__ */ z.object({
|
|
869
|
+
addonId: /* @__PURE__ */ z.string().min(1),
|
|
870
|
+
key: /* @__PURE__ */ z.string().min(1)
|
|
871
|
+
}), /* @__PURE__ */ z.object({
|
|
872
|
+
removed: /* @__PURE__ */ z.boolean(),
|
|
873
|
+
secretsCleared: /* @__PURE__ */ z.number().int().nonnegative()
|
|
874
|
+
}), {
|
|
875
|
+
kind: "mutation",
|
|
876
|
+
auth: "admin",
|
|
877
|
+
caller: "required"
|
|
878
|
+
})
|
|
879
|
+
},
|
|
880
|
+
vocabulary: { notOperatorFacing: NOT_A_DEVICE.STORAGE }
|
|
881
|
+
};
|
|
882
|
+
//#endregion
|
|
883
|
+
export { dataStoreProviderCapability as i, migrationsCapability as n, MIGRATION_API_V1_METHODS as r, storageAdminCapability as t };
|