@camstack/system 1.1.17 → 1.1.18

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.
@@ -376,10 +376,14 @@ var StorageOrchestratorService = class {
376
376
  */
377
377
  seedDefaults(input) {
378
378
  let added = 0;
379
- const rootOf = (id) => node_path.join(input.basePath, id);
379
+ const declById = new Map(input.declarations.map((d) => [d.id, d]));
380
+ const rootFor = (d) => {
381
+ const useMedia = d.defaultRoot === "media" && input.mediaBasePath;
382
+ return node_path.join(useMedia ? input.mediaBasePath : input.basePath, d.id);
383
+ };
380
384
  for (const d of input.declarations) {
381
385
  if (this.hasAnyLocationOfType(d.id)) continue;
382
- const base = d.defaultsTo ? this.getLocationById(`${d.defaultsTo}:default`)?.config["basePath"] ?? rootOf(d.defaultsTo) : rootOf(d.id);
386
+ const base = d.defaultsTo ? this.getLocationById(`${d.defaultsTo}:default`)?.config["basePath"] ?? rootFor(declById.get(d.defaultsTo) ?? d) : rootFor(d);
383
387
  this.upsertLocation({
384
388
  id: `${d.id}:default`,
385
389
  type: d.id,
@@ -1074,9 +1078,11 @@ var StorageOrchestratorAddon = class extends _camstack_types.BaseAddon {
1074
1078
  const registry = (0, _camstack_system.buildStorageLocationRegistry)(this.ctx.kernel.listStorageLocationDeclarations?.() ?? []);
1075
1079
  this.service.setRegistry(registry);
1076
1080
  this.service.pruneUndeclaredSystemLocations();
1081
+ const mediaRoot = process.env.CAMSTACK_MEDIA_ROOT?.trim();
1077
1082
  this.service.seedDefaults({
1078
1083
  providerId: "filesystem-storage",
1079
1084
  basePath: this.ctx.nodeDataDir,
1085
+ mediaBasePath: mediaRoot && mediaRoot.length > 0 ? mediaRoot : void 0,
1080
1086
  declarations: registry.list()
1081
1087
  });
1082
1088
  await this.service.backfillNodeIds(HUB_NODE_ID);
@@ -369,10 +369,14 @@ var StorageOrchestratorService = class {
369
369
  */
370
370
  seedDefaults(input) {
371
371
  let added = 0;
372
- const rootOf = (id) => path$1.join(input.basePath, id);
372
+ const declById = new Map(input.declarations.map((d) => [d.id, d]));
373
+ const rootFor = (d) => {
374
+ const useMedia = d.defaultRoot === "media" && input.mediaBasePath;
375
+ return path$1.join(useMedia ? input.mediaBasePath : input.basePath, d.id);
376
+ };
373
377
  for (const d of input.declarations) {
374
378
  if (this.hasAnyLocationOfType(d.id)) continue;
375
- const base = d.defaultsTo ? this.getLocationById(`${d.defaultsTo}:default`)?.config["basePath"] ?? rootOf(d.defaultsTo) : rootOf(d.id);
379
+ const base = d.defaultsTo ? this.getLocationById(`${d.defaultsTo}:default`)?.config["basePath"] ?? rootFor(declById.get(d.defaultsTo) ?? d) : rootFor(d);
376
380
  this.upsertLocation({
377
381
  id: `${d.id}:default`,
378
382
  type: d.id,
@@ -1067,9 +1071,11 @@ var StorageOrchestratorAddon = class extends BaseAddon {
1067
1071
  const registry = buildStorageLocationRegistry(this.ctx.kernel.listStorageLocationDeclarations?.() ?? []);
1068
1072
  this.service.setRegistry(registry);
1069
1073
  this.service.pruneUndeclaredSystemLocations();
1074
+ const mediaRoot = process.env.CAMSTACK_MEDIA_ROOT?.trim();
1070
1075
  this.service.seedDefaults({
1071
1076
  providerId: "filesystem-storage",
1072
1077
  basePath: this.ctx.nodeDataDir,
1078
+ mediaBasePath: mediaRoot && mediaRoot.length > 0 ? mediaRoot : void 0,
1073
1079
  declarations: registry.list()
1074
1080
  });
1075
1081
  await this.service.backfillNodeIds(HUB_NODE_ID);
@@ -229,6 +229,12 @@ export declare class StorageOrchestratorService {
229
229
  seedDefaults(input: {
230
230
  readonly providerId: string;
231
231
  readonly basePath: string;
232
+ /**
233
+ * Root for declarations marked `defaultRoot: 'media'` (the dedicated media
234
+ * volume, `CAMSTACK_MEDIA_ROOT`). Absent → media declarations fall back to
235
+ * `basePath` like everything else.
236
+ */
237
+ readonly mediaBasePath?: string;
232
238
  readonly declarations: readonly StorageLocationDeclaration[];
233
239
  }): void;
234
240
  /** Internal: check whether any location of the given type exists. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/system",
3
- "version": "1.1.17",
3
+ "version": "1.1.18",
4
4
  "description": "Core addon for CamStack — builtins, pipeline, process management, auth, logging, events",
5
5
  "keywords": [
6
6
  "camstack",