@camstack/system 1.2.209 → 1.2.210

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.
Files changed (53) hide show
  1. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
  2. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
  3. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
  4. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
  5. package/dist/builtins/alerts/alerts.addon.js +1 -1
  6. package/dist/builtins/alerts/alerts.addon.mjs +1 -1
  7. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +1 -1
  8. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +1 -1
  9. package/dist/builtins/console-logging/index.js +1 -1
  10. package/dist/builtins/console-logging/index.mjs +1 -1
  11. package/dist/builtins/core-blocks/core-blocks.addon.js +1 -1
  12. package/dist/builtins/core-blocks/core-blocks.addon.mjs +1 -1
  13. package/dist/builtins/device-manager/device-manager.addon.js +2 -2
  14. package/dist/builtins/device-manager/device-manager.addon.mjs +2 -2
  15. package/dist/builtins/doorbell/virtual-doorbell.addon.js +1 -1
  16. package/dist/builtins/doorbell/virtual-doorbell.addon.mjs +1 -1
  17. package/dist/builtins/hub-forwarder/index.js +1 -1
  18. package/dist/builtins/hub-forwarder/index.mjs +1 -1
  19. package/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  20. package/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  21. package/dist/builtins/local-auth/local-auth.addon.js +1 -1
  22. package/dist/builtins/local-auth/local-auth.addon.mjs +1 -1
  23. package/dist/builtins/local-network/local-network.addon.js +1 -1
  24. package/dist/builtins/local-network/local-network.addon.mjs +1 -1
  25. package/dist/builtins/loki-logging/index.js +1 -1
  26. package/dist/builtins/loki-logging/index.mjs +1 -1
  27. package/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
  28. package/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
  29. package/dist/builtins/platform-probe/index.js +1 -1
  30. package/dist/builtins/platform-probe/index.mjs +1 -1
  31. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  32. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  33. package/dist/builtins/snapshot/index.js +1 -1
  34. package/dist/builtins/snapshot/index.mjs +1 -1
  35. package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  36. package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
  37. package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +0 -0
  38. package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +0 -0
  39. package/dist/builtins/storage-orchestrator/location-repoint-move.d.ts +52 -0
  40. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.d.ts +13 -0
  41. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +112 -3
  42. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +112 -3
  43. package/dist/builtins/system-config/system-config.addon.js +1 -1
  44. package/dist/builtins/system-config/system-config.addon.mjs +1 -1
  45. package/dist/builtins/winston-logging/index.js +1 -1
  46. package/dist/builtins/winston-logging/index.mjs +1 -1
  47. package/dist/{dist-CNxDnJwz.js → dist-C_WvDOQ9.js} +69 -69
  48. package/dist/{dist-CLFBZQH6.mjs → dist-GU5g4fSq.mjs} +69 -69
  49. package/dist/index.js +1 -1
  50. package/dist/index.mjs +1 -1
  51. package/dist/{retired-settings-keys-D9wnrXOC.js → retired-settings-keys-BpasSgff.js} +1 -1
  52. package/dist/{retired-settings-keys-BQydEL_M.mjs → retired-settings-keys-qv-MlPVD.mjs} +1 -1
  53. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { $ as evictionPolicyOfLocation, At as resolveLocationMode, D as StorageMigrationJobSchema, E as StorageLocationTypeSchema, It as settingsStoreCapability, Jt as BaseAddon, Kt as withLocationMode, R as collectSecretConfigKeys, Rt as storageCapability, T as StorageLocationModeSchema, bn as EventCategory, ft as legacyModeOf, g as REDACTED_SECRET, m as LegacyStorageLocationDefaultSchema, mn as parseJsonObject, ot as isLocationEnabled, rt as gbToBytes, vt as mayReadLocation, w as StorageCleanupJobSchema, xt as modeMayWrite, yt as mayWriteToLocation, zt as storageMigrationCapability } from "../../dist-CLFBZQH6.mjs";
1
+ import { $ as evictionPolicyOfLocation, At as resolveLocationMode, D as StorageMigrationJobSchema, E as StorageLocationTypeSchema, It as settingsStoreCapability, Jt as BaseAddon, Kt as withLocationMode, R as collectSecretConfigKeys, Rt as storageCapability, T as StorageLocationModeSchema, bn as EventCategory, ft as legacyModeOf, g as REDACTED_SECRET, m as LegacyStorageLocationDefaultSchema, mn as parseJsonObject, ot as isLocationEnabled, rt as gbToBytes, vt as mayReadLocation, w as StorageCleanupJobSchema, xt as modeMayWrite, yt as mayWriteToLocation, zt as storageMigrationCapability } from "../../dist-GU5g4fSq.mjs";
2
2
  import { t as HUB_CAP_FWD_ACTION } from "../../hub-cap-forward-BdT320dq.mjs";
3
3
  import { z } from "zod";
4
4
  import { randomUUID } from "node:crypto";
@@ -1102,6 +1102,56 @@ function buildStorageLocationRegistry(perAddon) {
1102
1102
  };
1103
1103
  }
1104
1104
  //#endregion
1105
+ //#region src/builtins/storage-orchestrator/location-repoint-move.ts
1106
+ /**
1107
+ * Walk the source root and collect FILES.
1108
+ *
1109
+ * The storage cap's `list` reports names without saying which are directories,
1110
+ * so the walk decides by asking: an entry that lists children is a directory,
1111
+ * and one that lists none is a leaf. A leaf that turns out not to be readable
1112
+ * (an empty directory) is skipped by the copy loop, which is the only place
1113
+ * that can tell — and skipping it is right, since there is nothing to move.
1114
+ */
1115
+ async function collectFiles(io, prefix) {
1116
+ const entries = await io.list(prefix);
1117
+ const files = [];
1118
+ for (const entry of entries) {
1119
+ if ((await io.list(entry)).length > 0) {
1120
+ files.push(...await collectFiles(io, entry));
1121
+ continue;
1122
+ }
1123
+ files.push(entry);
1124
+ }
1125
+ return files;
1126
+ }
1127
+ /**
1128
+ * Copy every file from the source root to the destination, verify each, then
1129
+ * delete the originals. Throws with NOTHING deleted if any copy fails.
1130
+ */
1131
+ async function moveLocationTree(io) {
1132
+ const candidates = await collectFiles(io);
1133
+ const copied = [];
1134
+ let bytes = 0;
1135
+ for (const relativePath of candidates) {
1136
+ let data;
1137
+ try {
1138
+ data = await io.read(relativePath);
1139
+ } catch {
1140
+ continue;
1141
+ }
1142
+ await io.write(relativePath, data);
1143
+ const landed = await io.readBack(relativePath);
1144
+ if (landed.length !== data.length) throw new Error(`location repoint: size mismatch after copying "${relativePath}" (${String(landed.length)} != ${String(data.length)}) — nothing deleted`);
1145
+ copied.push(relativePath);
1146
+ bytes += data.length;
1147
+ }
1148
+ for (const relativePath of copied) await io.deleteSource(relativePath);
1149
+ return {
1150
+ files: copied.length,
1151
+ bytes
1152
+ };
1153
+ }
1154
+ //#endregion
1105
1155
  //#region src/builtins/storage-orchestrator/access-guards.ts
1106
1156
  /**
1107
1157
  * May `storage.resolve` return a path for this location?
@@ -3295,10 +3345,12 @@ var StorageOrchestratorAddon = class extends BaseAddon {
3295
3345
  upsertLocation: async (input) => {
3296
3346
  const stored = service.getLocationById(input.id);
3297
3347
  const config = restoreRedactedSecrets(input.config, stored?.config, this.secretKeysFor(input.providerId, stored?.config ?? {}));
3298
- const saved = service.upsertLocation(config === input.config ? input : {
3348
+ const next = config === input.config ? input : {
3299
3349
  ...input,
3300
3350
  config
3301
- });
3351
+ };
3352
+ await this.carryDataOnRepoint(stored, next);
3353
+ const saved = service.upsertLocation(next);
3302
3354
  this.announceLocationsChanged(saved.id, saved.type, "upsert");
3303
3355
  return this.redacted(saved);
3304
3356
  },
@@ -3791,6 +3843,63 @@ var StorageOrchestratorAddon = class extends BaseAddon {
3791
3843
  return this.secretKeysByProvider.get(providerId);
3792
3844
  }
3793
3845
  /** Which keys of a given stored config must never leave this process. */
3846
+ /**
3847
+ * Move a singleton location's bytes when its root changes.
3848
+ *
3849
+ * Runs BEFORE the row is saved: a copy that fails throws out of the mutation,
3850
+ * so the location keeps pointing at the intact original and the operator is
3851
+ * told why rather than discovering it in a blank panel weeks later.
3852
+ * `moveLocationTree` deletes nothing until every file has been read back from
3853
+ * the destination.
3854
+ *
3855
+ * A no-op for everything else — a rename, a mode change, a `multi` kind, or a
3856
+ * location being created for the first time.
3857
+ */
3858
+ async carryDataOnRepoint(stored, next) {
3859
+ if (stored === void 0) return;
3860
+ const service = this.service;
3861
+ if (service === null) return;
3862
+ if (service.listDeclarations().find((entry) => entry.id === next.type)?.cardinality !== "single") return;
3863
+ const from = stored.config["basePath"];
3864
+ const to = next.config["basePath"];
3865
+ if (typeof from !== "string" || typeof to !== "string" || from === to) return;
3866
+ const source = await service.getProviderFor(stored);
3867
+ const target = {
3868
+ ...stored,
3869
+ config: next.config
3870
+ };
3871
+ const destination = await service.getProviderFor(target);
3872
+ const moved = await moveLocationTree({
3873
+ list: (prefix) => source.list(prefix === void 0 ? { location: stored } : {
3874
+ location: stored,
3875
+ prefix
3876
+ }),
3877
+ read: (relativePath) => source.read({
3878
+ location: stored,
3879
+ relativePath
3880
+ }),
3881
+ write: (relativePath, data) => destination.write({
3882
+ location: target,
3883
+ relativePath,
3884
+ data
3885
+ }),
3886
+ readBack: (relativePath) => destination.read({
3887
+ location: target,
3888
+ relativePath
3889
+ }),
3890
+ deleteSource: (relativePath) => source.delete({
3891
+ location: stored,
3892
+ relativePath
3893
+ })
3894
+ });
3895
+ this.ctx.logger.info("storage-orchestrator: singleton location re-pointed — its data was carried over", { meta: {
3896
+ id: stored.id,
3897
+ type: stored.type,
3898
+ from,
3899
+ to,
3900
+ ...moved
3901
+ } });
3902
+ }
3794
3903
  secretKeysFor(providerId, config) {
3795
3904
  return secretKeysForConfig(config, this.declaredSecretKeys(providerId));
3796
3905
  }
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-CNxDnJwz.js");
6
+ const require_dist = require("../../dist-C_WvDOQ9.js");
7
7
  //#region src/builtins/system-config/system-config.addon.ts
8
8
  /**
9
9
  * Built-in `system-config` addon — Phase 4 of the settings redesign.
@@ -1,4 +1,4 @@
1
- import { Jt as BaseAddon, dn as hydrateSchema, qt as errMsg } from "../../dist-CLFBZQH6.mjs";
1
+ import { Jt as BaseAddon, dn as hydrateSchema, qt as errMsg } from "../../dist-GU5g4fSq.mjs";
2
2
  //#region src/builtins/system-config/system-config.addon.ts
3
3
  /**
4
4
  * Built-in `system-config` addon — Phase 4 of the settings redesign.
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  const require_chunk = require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-CNxDnJwz.js");
6
+ const require_dist = require("../../dist-C_WvDOQ9.js");
7
7
  const require_formatter = require("../../formatter-DqAKDlvN.js");
8
8
  let node_path = require("node:path");
9
9
  node_path = require_chunk.__toESM(node_path);
@@ -1,4 +1,4 @@
1
- import { Jt as BaseAddon, ht as logDestinationCapability } from "../../dist-CLFBZQH6.mjs";
1
+ import { Jt as BaseAddon, ht as logDestinationCapability } from "../../dist-GU5g4fSq.mjs";
2
2
  import { t as formatLogLine } from "../../formatter-B7qW8bPJ.mjs";
3
3
  import * as path$1 from "node:path";
4
4
  import path from "node:path";