@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
|
@@ -3,7 +3,16 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
const require_chunk = require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const
|
|
6
|
+
const require_base_addon = require("../../base-addon-DD5dIfcZ.js");
|
|
7
|
+
const require_scoped_settings = require("../../scoped-settings-CylSSq_8.js");
|
|
8
|
+
const require_record_kind = require("../../record-kind-DoBfYHCs.js");
|
|
9
|
+
const require_settings_store_cap = require("../../settings-store.cap-wlJhCspr.js");
|
|
10
|
+
const require_relocate = require("../../relocate-CdVQAk-w.js");
|
|
11
|
+
const require_storage_location_mode = require("../../storage-location-mode-CS4sMzo-.js");
|
|
12
|
+
const require_storage_location = require("../../storage-location-CTweDMZf.js");
|
|
13
|
+
const require_storage_migration_cap = require("../../storage-migration.cap-CyyATY_p.js");
|
|
14
|
+
const require_integration_instances_cap = require("../../integration-instances.cap-dJIxg2_s.js");
|
|
15
|
+
const require_custom_actions = require("../../custom-actions-D92NRi2c.js");
|
|
7
16
|
const require_read_all_rows$1 = require("../../read-all-rows-CVoO1ONM.js");
|
|
8
17
|
let zod = require("zod");
|
|
9
18
|
let node_crypto = require("node:crypto");
|
|
@@ -34,21 +43,21 @@ var LOCATIONS_RECORD_KIND = "locations";
|
|
|
34
43
|
var LOCATION_SECRETS_FIELD = "secrets";
|
|
35
44
|
/** The ref the records door files the credential `key` of location `id` under. */
|
|
36
45
|
function locationSecretRef(id, key) {
|
|
37
|
-
return
|
|
46
|
+
return require_scoped_settings.recordSecretRef(STORAGE_RECORD_OWNER, LOCATIONS_RECORD_KIND, id, `${LOCATION_SECRETS_FIELD}{${encodeURIComponent(key)}}`);
|
|
38
47
|
}
|
|
39
48
|
/** The marker the location carries in memory for a credential kept in its record. */
|
|
40
49
|
function locationSecretMarker(id, key) {
|
|
41
|
-
return
|
|
50
|
+
return require_scoped_settings.makeSecretMarker(locationSecretRef(id, key));
|
|
42
51
|
}
|
|
43
52
|
/** Is `value` the marker of the credential `key` of location `id` kept in its own record? */
|
|
44
53
|
function isOwnLocationMarker(id, key, value) {
|
|
45
|
-
return
|
|
54
|
+
return require_scoped_settings.isSecretMarker(value) && value.$secret === locationSecretRef(id, key);
|
|
46
55
|
}
|
|
47
56
|
//#endregion
|
|
48
57
|
//#region src/builtins/storage-orchestrator/record-kinds.ts
|
|
49
58
|
var import_read_all_rows = require_read_all_rows$1.require_read_all_rows();
|
|
50
59
|
var StorageLocationBodySchema = zod.z.object({
|
|
51
|
-
type:
|
|
60
|
+
type: require_storage_location.StorageLocationTypeSchema,
|
|
52
61
|
displayName: zod.z.string(),
|
|
53
62
|
providerId: zod.z.string(),
|
|
54
63
|
config: zod.z.record(zod.z.string(), zod.z.unknown()),
|
|
@@ -57,7 +66,7 @@ var StorageLocationBodySchema = zod.z.object({
|
|
|
57
66
|
updatedAt: zod.z.number(),
|
|
58
67
|
nodeId: zod.z.string().optional(),
|
|
59
68
|
enabled: zod.z.boolean().optional(),
|
|
60
|
-
mode:
|
|
69
|
+
mode: require_storage_location_mode.StorageLocationModeSchema.optional(),
|
|
61
70
|
secrets: zod.z.record(zod.z.string(), zod.z.string().meta({ secret: true })).optional()
|
|
62
71
|
});
|
|
63
72
|
var StorageSeedMarkerBodySchema = zod.z.object({ seededAt: zod.z.number() });
|
|
@@ -71,7 +80,7 @@ var StorageDrainStateBodySchema = zod.z.object({
|
|
|
71
80
|
observedGrowthBytes: zod.z.number(),
|
|
72
81
|
observedElapsedMs: zod.z.number()
|
|
73
82
|
});
|
|
74
|
-
var _storageOrchestratorRecordKinds =
|
|
83
|
+
var _storageOrchestratorRecordKinds = require_record_kind.defineRecordKinds({
|
|
75
84
|
locations: {
|
|
76
85
|
schema: StorageLocationBodySchema,
|
|
77
86
|
class: "config",
|
|
@@ -214,7 +223,7 @@ var SqliteLocationStore = class {
|
|
|
214
223
|
function locationToBody(loc, staged = {}) {
|
|
215
224
|
const config = {};
|
|
216
225
|
const secrets = {};
|
|
217
|
-
for (const [key, value] of Object.entries(loc.config)) if (isOwnLocationMarker(loc.id, key, value)) secrets[key] =
|
|
226
|
+
for (const [key, value] of Object.entries(loc.config)) if (isOwnLocationMarker(loc.id, key, value)) secrets[key] = require_scoped_settings.REDACTED_SECRET;
|
|
218
227
|
else config[key] = value;
|
|
219
228
|
for (const [key, value] of Object.entries(staged)) if (value === null) delete secrets[key];
|
|
220
229
|
else secrets[key] = value;
|
|
@@ -233,7 +242,7 @@ function locationToBody(loc, staged = {}) {
|
|
|
233
242
|
};
|
|
234
243
|
}
|
|
235
244
|
function bodyToPersistedLocation(id, body) {
|
|
236
|
-
const parsedType =
|
|
245
|
+
const parsedType = require_storage_location.StorageLocationTypeSchema.safeParse(body.type);
|
|
237
246
|
if (!parsedType.success || id.length === 0) return null;
|
|
238
247
|
return {
|
|
239
248
|
id,
|
|
@@ -596,7 +605,7 @@ var StorageMigrationCoordinator = class {
|
|
|
596
605
|
if (remaining.length === 0) throw new Error(`"${storageClass}" has nothing left outside its write set — there is nothing to drain. To CHANGE where it writes, use storageMigration.start with a new destination.`);
|
|
597
606
|
for (const entry of remaining) {
|
|
598
607
|
const target = this.deps.locations.getLocationById(entry.toLocationId);
|
|
599
|
-
if (target !== void 0 && !
|
|
608
|
+
if (target !== void 0 && !require_storage_location_mode.mayWriteToLocation(target)) throw new Error(`The "${storageClass}" drain destination "${entry.toLocationId}" is not a write target (mode: ${require_storage_location_mode.resolveLocationMode(target)}) — it takes no writes, and a drain is the largest write there is. Set it active on the Storage screen first.`);
|
|
600
609
|
moves.push({
|
|
601
610
|
storageClass,
|
|
602
611
|
fromLocationId: entry.fromLocationId,
|
|
@@ -928,9 +937,9 @@ var StorageMigrationCoordinator = class {
|
|
|
928
937
|
for (const move of job.moves) {
|
|
929
938
|
if (move.freezeSource !== true) continue;
|
|
930
939
|
const loc = this.deps.locations.getLocationById(move.fromLocationId);
|
|
931
|
-
if (!loc || !
|
|
940
|
+
if (!loc || !require_storage_location_mode.mayWriteToLocation(loc)) continue;
|
|
932
941
|
const { createdAt: _c, updatedAt: _u, capacity: _cap, ...rest } = loc;
|
|
933
|
-
this.deps.locations.upsertLocation(
|
|
942
|
+
this.deps.locations.upsertLocation(require_storage_location_mode.withLocationMode(rest, "readonly"));
|
|
934
943
|
}
|
|
935
944
|
}
|
|
936
945
|
/**
|
|
@@ -1119,7 +1128,7 @@ function buildStorageLocationRegistry(perAddon) {
|
|
|
1119
1128
|
var LEGACY_LOCATION_SECRET_COLLECTION = "storage_locations";
|
|
1120
1129
|
/** The ref a credential of `id` was filed under before the move to the record. */
|
|
1121
1130
|
function legacyLocationSecretRef(id, key) {
|
|
1122
|
-
return
|
|
1131
|
+
return require_scoped_settings.buildSecretRef({
|
|
1123
1132
|
owner: STORAGE_RECORD_OWNER,
|
|
1124
1133
|
scope: {
|
|
1125
1134
|
kind: "row",
|
|
@@ -1134,8 +1143,8 @@ function legacyLocationSecretRef(id, key) {
|
|
|
1134
1143
|
* collection. Anything else (a record-bound marker, someone else's ref) is left alone.
|
|
1135
1144
|
*/
|
|
1136
1145
|
function isLegacyLocationMarker(id, value) {
|
|
1137
|
-
if (!
|
|
1138
|
-
const parts =
|
|
1146
|
+
if (!require_scoped_settings.isSecretMarker(value)) return false;
|
|
1147
|
+
const parts = require_scoped_settings.parseSecretRef(value.$secret);
|
|
1139
1148
|
if (parts === null || parts.scope.kind !== "row") return false;
|
|
1140
1149
|
return parts.scope.collection === LEGACY_LOCATION_SECRET_COLLECTION && parts.scope.rowId === id;
|
|
1141
1150
|
}
|
|
@@ -1907,7 +1916,7 @@ function nodeOwnsItsDataStore(env) {
|
|
|
1907
1916
|
*/
|
|
1908
1917
|
function createHubSettingsForward(forward) {
|
|
1909
1918
|
const send = (method, args) => forward({
|
|
1910
|
-
capName:
|
|
1919
|
+
capName: require_settings_store_cap.settingsStoreCapability.name,
|
|
1911
1920
|
method,
|
|
1912
1921
|
args
|
|
1913
1922
|
});
|
|
@@ -2092,7 +2101,7 @@ function resolveMinFreePercent(config, providerDefaultPercent, capacity, notice)
|
|
|
2092
2101
|
});
|
|
2093
2102
|
return fallback;
|
|
2094
2103
|
}
|
|
2095
|
-
const percent =
|
|
2104
|
+
const percent = require_storage_location.gbToBytes(minFreeGb) / totalBytes * 100;
|
|
2096
2105
|
return Math.min(100, percent);
|
|
2097
2106
|
}
|
|
2098
2107
|
//#endregion
|
|
@@ -2244,7 +2253,7 @@ var FRAMEWORK_CONFIG_KEYS = new Set([
|
|
|
2244
2253
|
]);
|
|
2245
2254
|
/** Secret config keys a provider declares, derived from its own form schema. */
|
|
2246
2255
|
function secretKeysOfProviderInfo(info) {
|
|
2247
|
-
return
|
|
2256
|
+
return require_scoped_settings.collectSecretConfigKeys(info.configSchema);
|
|
2248
2257
|
}
|
|
2249
2258
|
/**
|
|
2250
2259
|
* Which keys of THIS config must be treated as secret.
|
|
@@ -2291,7 +2300,7 @@ function redactLocationConfig(config, secretKeys) {
|
|
|
2291
2300
|
const out = {};
|
|
2292
2301
|
for (const [key, value] of Object.entries(config)) {
|
|
2293
2302
|
if (secretKeys.has(key) && value !== void 0 && value !== null && value !== "") {
|
|
2294
|
-
out[key] =
|
|
2303
|
+
out[key] = require_scoped_settings.REDACTED_SECRET;
|
|
2295
2304
|
touched = true;
|
|
2296
2305
|
continue;
|
|
2297
2306
|
}
|
|
@@ -2340,7 +2349,7 @@ function restoreRedactedSecrets(incoming, stored, secretKeys) {
|
|
|
2340
2349
|
* another node, a remote provider). The caller states it after a second confirmation.
|
|
2341
2350
|
*/
|
|
2342
2351
|
var forceDeleteLocationInput = zod.z.object({ id: zod.z.string().min(1) });
|
|
2343
|
-
var storageOrchestratorActions =
|
|
2352
|
+
var storageOrchestratorActions = require_custom_actions.defineCustomActions({ forceDeleteLocation: require_custom_actions.customAction(forceDeleteLocationInput, zod.z.object({ ok: zod.z.literal(true) }), {
|
|
2344
2353
|
kind: "mutation",
|
|
2345
2354
|
auth: "admin"
|
|
2346
2355
|
}) });
|
|
@@ -2394,7 +2403,7 @@ function providerSections(schema) {
|
|
|
2394
2403
|
return Array.isArray(sections) ? sections.filter(isConfigSection) : [];
|
|
2395
2404
|
}
|
|
2396
2405
|
function isStorageMode(value) {
|
|
2397
|
-
return
|
|
2406
|
+
return require_storage_location_mode.STORAGE_LOCATION_MODES.some((mode) => mode === value);
|
|
2398
2407
|
}
|
|
2399
2408
|
function namespaced(providerId, key) {
|
|
2400
2409
|
return `${providerId}.${key}`;
|
|
@@ -2513,11 +2522,11 @@ function protectionSection() {
|
|
|
2513
2522
|
};
|
|
2514
2523
|
}
|
|
2515
2524
|
function stateOf(location) {
|
|
2516
|
-
return
|
|
2525
|
+
return require_storage_location_mode.resolveLocationMode(location);
|
|
2517
2526
|
}
|
|
2518
2527
|
/** A form value that names a credential KEPT: left out, empty, the redaction token or the view. */
|
|
2519
2528
|
function keepsSecret(value) {
|
|
2520
|
-
return value === void 0 || value === "" || value === "__camstack_redacted__" ||
|
|
2529
|
+
return value === void 0 || value === "" || value === "__camstack_redacted__" || require_scoped_settings.isSecretFieldView(value) || require_scoped_settings.isSecretMarker(value);
|
|
2521
2530
|
}
|
|
2522
2531
|
function numberOrNull(value) {
|
|
2523
2532
|
if (value === void 0) return void 0;
|
|
@@ -2553,7 +2562,7 @@ var StorageLocationInstances = class {
|
|
|
2553
2562
|
for (const [key, value] of Object.entries(location.config)) {
|
|
2554
2563
|
if (key === LEGACY_READ_ONLY) continue;
|
|
2555
2564
|
if (secretKeys.has(key)) {
|
|
2556
|
-
const view =
|
|
2565
|
+
const view = require_scoped_settings.toSecretFieldView(value);
|
|
2557
2566
|
if (view !== null) formValues[key] = view;
|
|
2558
2567
|
} else formValues[key] = value;
|
|
2559
2568
|
}
|
|
@@ -2561,11 +2570,11 @@ var StorageLocationInstances = class {
|
|
|
2561
2570
|
id: location.id,
|
|
2562
2571
|
name: location.displayName,
|
|
2563
2572
|
configured: true,
|
|
2564
|
-
enabled:
|
|
2573
|
+
enabled: require_storage_location_mode.switchStateOfMode(mode),
|
|
2565
2574
|
kind: location.type,
|
|
2566
2575
|
formValues,
|
|
2567
2576
|
status: {
|
|
2568
|
-
state:
|
|
2577
|
+
state: require_storage_location_mode.switchStateOfMode(mode) ? "ok" : "off",
|
|
2569
2578
|
label: mode
|
|
2570
2579
|
}
|
|
2571
2580
|
};
|
|
@@ -2642,7 +2651,7 @@ var StorageLocationInstances = class {
|
|
|
2642
2651
|
continue;
|
|
2643
2652
|
}
|
|
2644
2653
|
if (secretKeys.has(key)) {
|
|
2645
|
-
if (
|
|
2654
|
+
if (require_scoped_settings.isSecretClear(value)) clear.push(key);
|
|
2646
2655
|
else if (keepsSecret(value)) continue;
|
|
2647
2656
|
else if (typeof value === "string") config[key] = value;
|
|
2648
2657
|
continue;
|
|
@@ -2723,7 +2732,7 @@ var StorageLocationInstances = class {
|
|
|
2723
2732
|
setInstanceEnabled = async ({ id, enabled }) => {
|
|
2724
2733
|
const stored = this.deps.locations().find((l) => l.id === id);
|
|
2725
2734
|
if (stored === void 0) throw new Error(`storage location '${id}' not found`);
|
|
2726
|
-
const move =
|
|
2735
|
+
const move = require_storage_location_mode.modeForSwitch(enabled, stateOf(stored));
|
|
2727
2736
|
if (move.kind === "refuse") throw new Error(`storage location '${id}': ${move.reason}`);
|
|
2728
2737
|
if (move.kind === "set") await this.deps.save(this.rebuilt(stored, { mode: move.mode }), []);
|
|
2729
2738
|
return { ok: true };
|
|
@@ -2815,7 +2824,7 @@ function isTerminal(job) {
|
|
|
2815
2824
|
* shrinking on purpose and whose leftovers the ratchet is already removing.
|
|
2816
2825
|
*/
|
|
2817
2826
|
function footageFrozen(location) {
|
|
2818
|
-
return
|
|
2827
|
+
return require_storage_location_mode.evictionPolicyOfLocation(location) === "never";
|
|
2819
2828
|
}
|
|
2820
2829
|
/**
|
|
2821
2830
|
* One operator-facing cleanup of leftover analytics rows/blobs, optional
|
|
@@ -3333,11 +3342,11 @@ var StorageOrchestratorService = class {
|
|
|
3333
3342
|
const repaired = [];
|
|
3334
3343
|
for (const type of new Set([...this.locations.values()].map((l) => l.type))) {
|
|
3335
3344
|
const ofType = [...this.locations.values()].filter((l) => l.type === type);
|
|
3336
|
-
if (ofType.some((l) =>
|
|
3345
|
+
if (ofType.some((l) => require_storage_location.isLocationEnabled(l))) continue;
|
|
3337
3346
|
const pick = ofType.find((l) => l.id === `${type}:default`) ?? ofType.toSorted((a, b) => a.id.localeCompare(b.id))[0];
|
|
3338
3347
|
if (!pick) continue;
|
|
3339
3348
|
const next = {
|
|
3340
|
-
...
|
|
3349
|
+
...require_storage_location_mode.withLocationMode(pick, "active"),
|
|
3341
3350
|
updatedAt: Date.now()
|
|
3342
3351
|
};
|
|
3343
3352
|
this.locations.set(next.id, next);
|
|
@@ -3408,7 +3417,7 @@ var StorageOrchestratorService = class {
|
|
|
3408
3417
|
* -named destination).
|
|
3409
3418
|
*/
|
|
3410
3419
|
writeTargets(type) {
|
|
3411
|
-
return [...this.locations.values()].filter((loc) => loc.type === type &&
|
|
3420
|
+
return [...this.locations.values()].filter((loc) => loc.type === type && require_storage_location.isLocationEnabled(loc)).toSorted((a, b) => a.id.localeCompare(b.id));
|
|
3412
3421
|
}
|
|
3413
3422
|
/**
|
|
3414
3423
|
* Change the WRITE SET as one compensated commit: each named location is
|
|
@@ -3434,8 +3443,8 @@ var StorageOrchestratorService = class {
|
|
|
3434
3443
|
for (const [id, enabled] of enabledByLocationId) {
|
|
3435
3444
|
const location = nextById.get(id);
|
|
3436
3445
|
if (!location) throw new Error(`Storage location "${id}" not found`);
|
|
3437
|
-
if (
|
|
3438
|
-
const updated =
|
|
3446
|
+
if (require_storage_location.isLocationEnabled(location) === enabled) continue;
|
|
3447
|
+
const updated = require_storage_location_mode.withLocationMode({
|
|
3439
3448
|
...location,
|
|
3440
3449
|
updatedAt: now
|
|
3441
3450
|
}, enabled ? "active" : "readonly");
|
|
@@ -3543,7 +3552,7 @@ var StorageOrchestratorService = class {
|
|
|
3543
3552
|
nodeId: "hub"
|
|
3544
3553
|
};
|
|
3545
3554
|
this.refuseSameTypeRootCollision(input, existing);
|
|
3546
|
-
const next =
|
|
3555
|
+
const next = require_storage_location_mode.withLocationMode({
|
|
3547
3556
|
...input,
|
|
3548
3557
|
createdAt: existing?.createdAt ?? now,
|
|
3549
3558
|
updatedAt: now
|
|
@@ -3583,8 +3592,8 @@ var StorageOrchestratorService = class {
|
|
|
3583
3592
|
if (!loc) throw new Error(`Storage location "${id}" not found`);
|
|
3584
3593
|
const ofType = [...this.locations.values()].filter((l) => l.type === loc.type);
|
|
3585
3594
|
if (ofType.length <= 1) throw new Error(`Cannot delete "${id}" — it is the only location for type "${loc.type}"`);
|
|
3586
|
-
const enabledOfType = ofType.filter((l) =>
|
|
3587
|
-
if (
|
|
3595
|
+
const enabledOfType = ofType.filter((l) => require_storage_location_mode.mayWriteToLocation(l));
|
|
3596
|
+
if (require_storage_location_mode.mayWriteToLocation(loc) && enabledOfType.length <= 1) throw new Error(`Cannot delete "${id}" — it is the only enabled location for type "${loc.type}"`);
|
|
3588
3597
|
const occupancy = await this.probeOccupancy(loc);
|
|
3589
3598
|
if (occupancy !== "empty") {
|
|
3590
3599
|
if (options?.force !== true) throw new Error(occupancy === "occupied" ? `Storage location "${id}" still holds data — drain it first (storage migration / relocate), or pass force to delete the record anyway and strand what is on it` : `Storage location "${id}" could not be checked for remaining data (unreachable provider, another node, or an unmounted root) — pass force to delete the record anyway`);
|
|
@@ -3986,10 +3995,10 @@ var StorageOrchestratorService = class {
|
|
|
3986
3995
|
*/
|
|
3987
3996
|
function resolveUpsertMode(input, existing, typeAlreadyHasLocation) {
|
|
3988
3997
|
if (input.mode !== void 0) {
|
|
3989
|
-
if (input.enabled === void 0 || input.enabled ===
|
|
3998
|
+
if (input.enabled === void 0 || input.enabled === require_storage_location_mode.modeMayWrite(input.mode)) return input.mode;
|
|
3990
3999
|
}
|
|
3991
4000
|
if (input.enabled !== void 0) return input.enabled ? "active" : "readonly";
|
|
3992
|
-
if (existing) return
|
|
4001
|
+
if (existing) return require_storage_location_mode.resolveLocationMode(existing);
|
|
3993
4002
|
return typeAlreadyHasLocation ? "readonly" : "active";
|
|
3994
4003
|
}
|
|
3995
4004
|
/** Types that may have zero enabled locations. Backups with none is sad, not illegal. */
|
|
@@ -4001,12 +4010,12 @@ var OPTIONAL_WRITE_TYPES = new Set(["backups"]);
|
|
|
4001
4010
|
*/
|
|
4002
4011
|
function refuseLastWriteTargetDisabled(existing, next, locations) {
|
|
4003
4012
|
if (OPTIONAL_WRITE_TYPES.has(next.type)) return;
|
|
4004
|
-
if (
|
|
4013
|
+
if (require_storage_location_mode.mayWriteToLocation(next)) return;
|
|
4005
4014
|
if (existing === void 0) return;
|
|
4006
|
-
if (!
|
|
4015
|
+
if (!require_storage_location_mode.mayWriteToLocation(existing)) return;
|
|
4007
4016
|
for (const loc of locations) {
|
|
4008
4017
|
if (loc.id === next.id || loc.type !== next.type) continue;
|
|
4009
|
-
if (
|
|
4018
|
+
if (require_storage_location_mode.mayWriteToLocation(loc)) return;
|
|
4010
4019
|
}
|
|
4011
4020
|
throw new Error(`Cannot disable "${next.id}": it is the last enabled location of type "${next.type}". Enable another location of this type first.`);
|
|
4012
4021
|
}
|
|
@@ -4023,7 +4032,7 @@ function refuseTypeWithoutWriteTarget(touched, result) {
|
|
|
4023
4032
|
if (OPTIONAL_WRITE_TYPES.has(type)) continue;
|
|
4024
4033
|
const ofType = rows.filter((loc) => loc.type === type);
|
|
4025
4034
|
if (ofType.length === 0) continue;
|
|
4026
|
-
if (ofType.some((loc) =>
|
|
4035
|
+
if (ofType.some((loc) => require_storage_location.isLocationEnabled(loc))) continue;
|
|
4027
4036
|
throw new Error(`Refusing the write-set change: it would leave type "${type}" with no enabled location. Enable one of ${ofType.map((loc) => loc.id).toSorted().join(", ")} first.`);
|
|
4028
4037
|
}
|
|
4029
4038
|
}
|
|
@@ -4339,14 +4348,14 @@ var StorageWritabilityMonitor = class {
|
|
|
4339
4348
|
}
|
|
4340
4349
|
for (const [type, info] of types) {
|
|
4341
4350
|
const findingId = `${WRITABILITY_FINDING_PREFIX}${type}`;
|
|
4342
|
-
if (!input.locations.some((l) => l.type === type &&
|
|
4351
|
+
if (!input.locations.some((l) => l.type === type && require_storage_location_mode.mayWriteToLocation(l))) {
|
|
4343
4352
|
this.failing.add(type);
|
|
4344
4353
|
this.deps.logger.warn("storage-orchestrator: declared type has no writable location", { meta: {
|
|
4345
4354
|
type,
|
|
4346
4355
|
addons: info.addons
|
|
4347
4356
|
} });
|
|
4348
4357
|
this.deps.emit({
|
|
4349
|
-
category:
|
|
4358
|
+
category: require_base_addon.EventCategory.SystemLivenessFailed,
|
|
4350
4359
|
data: {
|
|
4351
4360
|
findingId,
|
|
4352
4361
|
severity: "error",
|
|
@@ -4357,7 +4366,7 @@ var StorageWritabilityMonitor = class {
|
|
|
4357
4366
|
}
|
|
4358
4367
|
});
|
|
4359
4368
|
} else if (this.failing.delete(type) || first) this.deps.emit({
|
|
4360
|
-
category:
|
|
4369
|
+
category: require_base_addon.EventCategory.SystemLivenessRecovered,
|
|
4361
4370
|
data: { findingId }
|
|
4362
4371
|
});
|
|
4363
4372
|
}
|
|
@@ -4701,7 +4710,7 @@ var PRESSURE_SWEEP_INTERVAL_MS = 6e4;
|
|
|
4701
4710
|
* infra layer (every cap-bound event is a custom-shape payload).
|
|
4702
4711
|
*/
|
|
4703
4712
|
var CAP_PROVIDER_REGISTERED_CATEGORY = "capability:provider-registered";
|
|
4704
|
-
var StorageOrchestratorAddon = class extends
|
|
4713
|
+
var StorageOrchestratorAddon = class extends require_base_addon.BaseAddon {
|
|
4705
4714
|
locationsKind = null;
|
|
4706
4715
|
seedMarkersKind = null;
|
|
4707
4716
|
drainStateKind = null;
|
|
@@ -4770,7 +4779,7 @@ var StorageOrchestratorAddon = class extends require_dist.BaseAddon {
|
|
|
4770
4779
|
super({});
|
|
4771
4780
|
}
|
|
4772
4781
|
async onInitialize() {
|
|
4773
|
-
const records =
|
|
4782
|
+
const records = require_base_addon.normalizeNodeId(this.ctx.kernel.localNodeId) === HUB_NODE_ID ? this.ctx.records : void 0;
|
|
4774
4783
|
if (records !== void 0) {
|
|
4775
4784
|
await records.declare(storageOrchestratorRecordKinds);
|
|
4776
4785
|
this.locationsKind = SqliteLocationStore.recordStoresOf(records);
|
|
@@ -4805,7 +4814,7 @@ var StorageOrchestratorAddon = class extends require_dist.BaseAddon {
|
|
|
4805
4814
|
return Promise.all(rows.map(async (loc) => ({
|
|
4806
4815
|
...this.redacted(loc),
|
|
4807
4816
|
...this.occupancy.ownedFor(loc.id) !== void 0 ? { owned: this.occupancy.ownedFor(loc.id) } : {},
|
|
4808
|
-
capacity:
|
|
4817
|
+
capacity: require_storage_location_mode.mayReadLocation(loc) ? await this.localCapacityOf(loc) : null
|
|
4809
4818
|
})));
|
|
4810
4819
|
},
|
|
4811
4820
|
listLocationDeclarations: async () => service.listDeclarations(),
|
|
@@ -4915,8 +4924,8 @@ var StorageOrchestratorAddon = class extends require_dist.BaseAddon {
|
|
|
4915
4924
|
};
|
|
4916
4925
|
const migration = new StorageMigrationCoordinator({
|
|
4917
4926
|
locations: service,
|
|
4918
|
-
state: this.state("storage-migration",
|
|
4919
|
-
history: this.state("storage-migration-history", zod.z.array(
|
|
4927
|
+
state: this.state("storage-migration", require_relocate.StorageMigrationJobSchema.nullable(), null),
|
|
4928
|
+
history: this.state("storage-migration-history", zod.z.array(require_relocate.StorageMigrationJobSchema), []),
|
|
4920
4929
|
participants: {
|
|
4921
4930
|
pipeline: {
|
|
4922
4931
|
pause: async (leaseId) => {
|
|
@@ -5012,7 +5021,7 @@ var StorageOrchestratorAddon = class extends require_dist.BaseAddon {
|
|
|
5012
5021
|
});
|
|
5013
5022
|
const cleanup = new StorageCleanupCoordinator({
|
|
5014
5023
|
locations: service,
|
|
5015
|
-
state: this.state("storage-cleanup",
|
|
5024
|
+
state: this.state("storage-cleanup", require_relocate.StorageCleanupJobSchema.nullable(), null),
|
|
5016
5025
|
participants: {
|
|
5017
5026
|
startOrphan: async (restart) => {
|
|
5018
5027
|
return parseStarted(await this.ctx.api.addons.custom.mutate({
|
|
@@ -5129,19 +5138,19 @@ var StorageOrchestratorAddon = class extends require_dist.BaseAddon {
|
|
|
5129
5138
|
return {
|
|
5130
5139
|
providers: [
|
|
5131
5140
|
{
|
|
5132
|
-
capability:
|
|
5141
|
+
capability: require_storage_migration_cap.storageCapability,
|
|
5133
5142
|
provider
|
|
5134
5143
|
},
|
|
5135
5144
|
{
|
|
5136
|
-
capability:
|
|
5145
|
+
capability: require_storage_migration_cap.storageMigrationCapability,
|
|
5137
5146
|
provider: migrationProvider
|
|
5138
5147
|
},
|
|
5139
5148
|
{
|
|
5140
|
-
capability:
|
|
5149
|
+
capability: require_settings_store_cap.settingsStoreCapability,
|
|
5141
5150
|
provider: createDataStoreDispatch(getEngines, () => this.hubSettingsForward())
|
|
5142
5151
|
},
|
|
5143
5152
|
...instances === null ? [] : [{
|
|
5144
|
-
capability:
|
|
5153
|
+
capability: require_integration_instances_cap.integrationInstancesCapability,
|
|
5145
5154
|
provider: instances.toProvider()
|
|
5146
5155
|
}]
|
|
5147
5156
|
],
|
|
@@ -5305,7 +5314,7 @@ var StorageOrchestratorAddon = class extends require_dist.BaseAddon {
|
|
|
5305
5314
|
const localNode = svc.getLocalNodeId();
|
|
5306
5315
|
const readings = [];
|
|
5307
5316
|
for (const loc of svc.listLocations()) {
|
|
5308
|
-
if (!
|
|
5317
|
+
if (!require_storage_location_mode.mayReadLocation(loc) || (loc.nodeId ?? HUB_NODE_ID) !== localNode) continue;
|
|
5309
5318
|
const capacity = await this.localCapacityOf(loc).catch(() => null);
|
|
5310
5319
|
readings.push({
|
|
5311
5320
|
locationId: loc.id,
|
|
@@ -5333,7 +5342,7 @@ var StorageOrchestratorAddon = class extends require_dist.BaseAddon {
|
|
|
5333
5342
|
const byId = new Map(svc.listLocations().map((loc) => [loc.id, loc]));
|
|
5334
5343
|
const samples = await Promise.all([...thresholds.keys()].map(async (locationId) => {
|
|
5335
5344
|
const loc = byId.get(locationId);
|
|
5336
|
-
if (loc === void 0 || !
|
|
5345
|
+
if (loc === void 0 || !require_storage_location_mode.mayReadLocation(loc)) return {
|
|
5337
5346
|
locationId,
|
|
5338
5347
|
freePercent: null
|
|
5339
5348
|
};
|
|
@@ -5354,7 +5363,7 @@ var StorageOrchestratorAddon = class extends require_dist.BaseAddon {
|
|
|
5354
5363
|
};
|
|
5355
5364
|
}));
|
|
5356
5365
|
for (const edge of this.locationBandMonitor.observe(samples)) {
|
|
5357
|
-
const category = edge.band === "low" ?
|
|
5366
|
+
const category = edge.band === "low" ? require_base_addon.EventCategory.StorageLocationLow : edge.band === "critical" ? require_base_addon.EventCategory.StorageLocationCritical : require_base_addon.EventCategory.StorageLocationOk;
|
|
5358
5367
|
ctx.logger.info("storage: location band changed", { meta: {
|
|
5359
5368
|
locationId: edge.locationId,
|
|
5360
5369
|
band: edge.band,
|
|
@@ -5396,7 +5405,7 @@ var StorageOrchestratorAddon = class extends require_dist.BaseAddon {
|
|
|
5396
5405
|
const infos = await collectProviderInfos(this.storageProviders(), () => {});
|
|
5397
5406
|
const byProvider = new Map(infos.map((i) => [i.providerId, i]));
|
|
5398
5407
|
for (const loc of svc.listLocations()) {
|
|
5399
|
-
if (!
|
|
5408
|
+
if (!require_storage_location_mode.mayReadLocation(loc)) continue;
|
|
5400
5409
|
const info = byProvider.get(loc.providerId);
|
|
5401
5410
|
if (!info || !info.shouldSaveDiskSpace) continue;
|
|
5402
5411
|
const threshold = resolveMinFreePercent(loc.config, info.minFreePercent ?? 0, await this.localCapacityOf(loc), (message, meta) => this.logMinFreeRedundancyOnce(loc.id, message, meta));
|
|
@@ -5436,7 +5445,7 @@ var StorageOrchestratorAddon = class extends require_dist.BaseAddon {
|
|
|
5436
5445
|
const svc = this.service;
|
|
5437
5446
|
if (!svc) return [];
|
|
5438
5447
|
if (this.resolveDrainStore() === null) {
|
|
5439
|
-
const draining = svc.listLocations().filter((l) =>
|
|
5448
|
+
const draining = svc.listLocations().filter((l) => require_storage_location_mode.evictionPolicyOfLocation(l) === "drain");
|
|
5440
5449
|
if (draining.length > 0 && !this.drainPlanRefusalLogged) {
|
|
5441
5450
|
this.drainPlanRefusalLogged = true;
|
|
5442
5451
|
this.ctx.logger.warn("storage-orchestrator: REFUSING to drain — this node has no data-store engine to persist the drain cap, and a cap recomputed at every boot would delete on a pace nobody chose", { meta: { locationIds: draining.map((l) => l.id) } });
|
|
@@ -5444,9 +5453,9 @@ var StorageOrchestratorAddon = class extends require_dist.BaseAddon {
|
|
|
5444
5453
|
return [];
|
|
5445
5454
|
}
|
|
5446
5455
|
const locations = svc.listLocations();
|
|
5447
|
-
return locations.filter((loc) =>
|
|
5456
|
+
return locations.filter((loc) => require_storage_location_mode.evictionPolicyOfLocation(loc) === "drain").map((loc) => ({
|
|
5448
5457
|
locationId: loc.id,
|
|
5449
|
-
activePeerLocationIds: locations.filter((peer) => peer.type === loc.type && peer.id !== loc.id &&
|
|
5458
|
+
activePeerLocationIds: locations.filter((peer) => peer.type === loc.type && peer.id !== loc.id && require_storage_location_mode.mayWriteToLocation(peer)).map((peer) => peer.id)
|
|
5450
5459
|
}));
|
|
5451
5460
|
}
|
|
5452
5461
|
/** Drain progress for every draining location, as of the last sweep. */
|
|
@@ -5487,7 +5496,7 @@ var StorageOrchestratorAddon = class extends require_dist.BaseAddon {
|
|
|
5487
5496
|
};
|
|
5488
5497
|
});
|
|
5489
5498
|
for (const event of this.drainEventMonitor.observe(samples)) {
|
|
5490
|
-
const category = event.kind === "complete" ?
|
|
5499
|
+
const category = event.kind === "complete" ? require_base_addon.EventCategory.StorageDrainComplete : require_base_addon.EventCategory.StorageDrainProgress;
|
|
5491
5500
|
ctx.logger.info("storage drain: event", { meta: {
|
|
5492
5501
|
locationId: event.locationId,
|
|
5493
5502
|
kind: event.kind,
|
|
@@ -5580,7 +5589,7 @@ var StorageOrchestratorAddon = class extends require_dist.BaseAddon {
|
|
|
5580
5589
|
type: "addon",
|
|
5581
5590
|
id: this.ctx.id
|
|
5582
5591
|
},
|
|
5583
|
-
category:
|
|
5592
|
+
category: require_base_addon.EventCategory.StorageLocationsChanged,
|
|
5584
5593
|
data: {
|
|
5585
5594
|
locationId,
|
|
5586
5595
|
locationType,
|
|
@@ -5613,7 +5622,7 @@ var StorageOrchestratorAddon = class extends require_dist.BaseAddon {
|
|
|
5613
5622
|
async resolvedConfig(locationId, config) {
|
|
5614
5623
|
const secrets = this.ctx.secrets;
|
|
5615
5624
|
if (secrets === void 0) return config;
|
|
5616
|
-
const { value, unresolved } = await
|
|
5625
|
+
const { value, unresolved } = await require_base_addon.resolveSecretMarkers(config, secrets);
|
|
5617
5626
|
if (unresolved.length > 0) this.ctx.logger.error("storage location secret unavailable", { meta: {
|
|
5618
5627
|
locationId,
|
|
5619
5628
|
secrets: unresolved.map((u) => ({
|
|
@@ -5688,10 +5697,10 @@ var StorageOrchestratorAddon = class extends require_dist.BaseAddon {
|
|
|
5688
5697
|
if (typeof value === "string" && value.length > 0) {
|
|
5689
5698
|
staged[key] = value;
|
|
5690
5699
|
out[key] = locationSecretMarker(locationId, key);
|
|
5691
|
-
} else if (value === void 0 || value === "") if (
|
|
5700
|
+
} else if (value === void 0 || value === "") if (require_scoped_settings.isSecretMarker(stored[key])) out[key] = stored[key];
|
|
5692
5701
|
else delete out[key];
|
|
5693
5702
|
}
|
|
5694
|
-
for (const [key, value] of Object.entries(stored)) if (
|
|
5703
|
+
for (const [key, value] of Object.entries(stored)) if (require_scoped_settings.isSecretMarker(value) && !(key in out) && !clear.includes(key)) out[key] = value;
|
|
5695
5704
|
return {
|
|
5696
5705
|
config: Object.keys(staged).length > 0 || Object.keys(out).length !== Object.keys(config).length || Object.entries(out).some(([key, value]) => config[key] !== value) ? out : config,
|
|
5697
5706
|
staged
|
|
@@ -5776,9 +5785,9 @@ var StorageOrchestratorAddon = class extends require_dist.BaseAddon {
|
|
|
5776
5785
|
const svc = this.service;
|
|
5777
5786
|
if (!svc) return out;
|
|
5778
5787
|
for (const loc of svc.listLocations()) {
|
|
5779
|
-
if (!
|
|
5788
|
+
if (!require_storage_location_mode.mayReadLocation(loc)) continue;
|
|
5780
5789
|
const raw = loc.config["maxUsedGb"];
|
|
5781
|
-
if (typeof raw === "number" && Number.isFinite(raw) && raw > 0) out.set(loc.id,
|
|
5790
|
+
if (typeof raw === "number" && Number.isFinite(raw) && raw > 0) out.set(loc.id, require_storage_location.gbToBytes(raw));
|
|
5782
5791
|
}
|
|
5783
5792
|
return out;
|
|
5784
5793
|
}
|
|
@@ -5962,7 +5971,7 @@ var StorageOrchestratorAddon = class extends require_dist.BaseAddon {
|
|
|
5962
5971
|
if (!this.seedAnswered || !service.locationsAuthoritative()) return;
|
|
5963
5972
|
this.reseedRepairRunning = true;
|
|
5964
5973
|
try {
|
|
5965
|
-
await this.runMigrations(
|
|
5974
|
+
await this.runMigrations(require_base_addon.defineAddonMigrations(ADDON_MIGRATIONS, this.cataloguePorts(service, seedInput)), { only: [RESEED_PRUNED_DEFAULTS_ID] });
|
|
5966
5975
|
this.reseedRepairDone = true;
|
|
5967
5976
|
} catch (err) {
|
|
5968
5977
|
this.ctx.logger.warn("storage-orchestrator: the pruned-default repair did not run", { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
@@ -6001,7 +6010,7 @@ var StorageOrchestratorAddon = class extends require_dist.BaseAddon {
|
|
|
6001
6010
|
if (!service.hasStore() || this.locationsKind === null || this.ctx.secrets === void 0) return;
|
|
6002
6011
|
this.secretsMoveRunning = true;
|
|
6003
6012
|
try {
|
|
6004
|
-
await this.runMigrations(
|
|
6013
|
+
await this.runMigrations(require_base_addon.defineAddonMigrations(ADDON_MIGRATIONS, this.cataloguePorts(service, null)), { only: [LOCATION_SECRETS_TO_RECORD_ID] });
|
|
6005
6014
|
this.secretsMoveDone = true;
|
|
6006
6015
|
} catch (err) {
|
|
6007
6016
|
this.ctx.logger.error("storage-orchestrator: the location credentials were NOT moved to their records; they stay where they were", { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
@@ -1,4 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { b as EventCategory, c as normalizeNodeId, f as defineAddonMigrations, o as resolveSecretMarkers, t as BaseAddon } from "../../base-addon-Md14i7pe.mjs";
|
|
2
|
+
import { H as isSecretClear, J as REDACTED_SECRET, K as makeSecretMarker, U as isSecretFieldView, W as isSecretMarker, Y as collectSecretConfigKeys, b as buildSecretRef, o as recordSecretRef, q as toSecretFieldView, w as parseSecretRef } from "../../scoped-settings-DVWUIP7Z.mjs";
|
|
3
|
+
import { s as defineRecordKinds } from "../../record-kind-ub6NXqfh.mjs";
|
|
4
|
+
import { f as settingsStoreCapability } from "../../settings-store.cap-Ci4F2zul.mjs";
|
|
5
|
+
import { p as StorageCleanupJobSchema, v as StorageMigrationJobSchema } from "../../relocate-CoZZTui1.mjs";
|
|
6
|
+
import { a as mayReadLocation, c as modeMayWrite, d as withLocationMode, l as resolveLocationMode, n as StorageLocationModeSchema, o as mayWriteToLocation, r as evictionPolicyOfLocation, s as modeForSwitch, t as STORAGE_LOCATION_MODES, u as switchStateOfMode } from "../../storage-location-mode-B21UVRRX.mjs";
|
|
7
|
+
import { a as gbToBytes, i as StorageLocationTypeSchema, o as isLocationEnabled } from "../../storage-location-CBT8GCD6.mjs";
|
|
8
|
+
import { n as storageCapability, t as storageMigrationCapability } from "../../storage-migration.cap-D7QqGobp.mjs";
|
|
9
|
+
import { t as integrationInstancesCapability } from "../../integration-instances.cap-Cl9O-k4h.mjs";
|
|
10
|
+
import { n as defineCustomActions, t as customAction } from "../../custom-actions-BFUSalC9.mjs";
|
|
2
11
|
import { t as require_read_all_rows } from "../../read-all-rows-TaPqdWNF.mjs";
|
|
3
12
|
import { z } from "zod";
|
|
4
13
|
import { randomUUID } from "node:crypto";
|