zen-fs-config 0.7.2 → 0.7.3

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/dist/index.js CHANGED
@@ -5053,10 +5053,11 @@ async function connect(appId, options = {}) {
5053
5053
  log4(`connect: failed to load app data group "${d.id}":`, err);
5054
5054
  }
5055
5055
  }
5056
- let dataGroup2 = appDataGroups2[0];
5057
- if (!dataGroup2) {
5058
- dataGroup2 = await repo2.createAppDataGroup("default", []);
5059
- appDataGroups2.push(dataGroup2);
5056
+ const dataGroup2 = appDataGroups2[0];
5057
+ if (!dataGroup2 && descriptors2.length > 0) {
5058
+ log4(
5059
+ `connect: ${descriptors2.length} data group descriptor(s) found but none could be loaded; leaving them untouched (no empty group is created)`
5060
+ );
5060
5061
  }
5061
5062
  return {
5062
5063
  groupType: options.groupType ?? "config-sync",
@@ -5114,11 +5115,17 @@ async function connect(appId, options = {}) {
5114
5115
  let dataGroup = appDataGroups[0];
5115
5116
  if (groupType === "data-sync") {
5116
5117
  if (!dataGroup) {
5117
- dataGroup = await repo.createAppDataGroup("default", []);
5118
- appDataGroups.push(dataGroup);
5118
+ if (descriptors.length > 0) {
5119
+ log4(
5120
+ `connect: ${descriptors.length} data group descriptor(s) exist but could not be loaded; refusing to create/overwrite "default"`
5121
+ );
5122
+ } else {
5123
+ dataGroup = await repo.createAppDataGroup("default", []);
5124
+ appDataGroups.push(dataGroup);
5125
+ }
5119
5126
  }
5120
5127
  const backendId = `${type}-primary`;
5121
- if (!dataGroup.listBackends().some((b) => b.id === backendId)) {
5128
+ if (dataGroup && !dataGroup.listBackends().some((b) => b.id === backendId)) {
5122
5129
  await dataGroup.addBackend(backendId, type, backendOptions);
5123
5130
  }
5124
5131
  }
package/dist/index.mjs CHANGED
@@ -4497,10 +4497,11 @@ async function connect(appId, options = {}) {
4497
4497
  log4(`connect: failed to load app data group "${d.id}":`, err);
4498
4498
  }
4499
4499
  }
4500
- let dataGroup2 = appDataGroups2[0];
4501
- if (!dataGroup2) {
4502
- dataGroup2 = await repo2.createAppDataGroup("default", []);
4503
- appDataGroups2.push(dataGroup2);
4500
+ const dataGroup2 = appDataGroups2[0];
4501
+ if (!dataGroup2 && descriptors2.length > 0) {
4502
+ log4(
4503
+ `connect: ${descriptors2.length} data group descriptor(s) found but none could be loaded; leaving them untouched (no empty group is created)`
4504
+ );
4504
4505
  }
4505
4506
  return {
4506
4507
  groupType: options.groupType ?? "config-sync",
@@ -4558,11 +4559,17 @@ async function connect(appId, options = {}) {
4558
4559
  let dataGroup = appDataGroups[0];
4559
4560
  if (groupType === "data-sync") {
4560
4561
  if (!dataGroup) {
4561
- dataGroup = await repo.createAppDataGroup("default", []);
4562
- appDataGroups.push(dataGroup);
4562
+ if (descriptors.length > 0) {
4563
+ log4(
4564
+ `connect: ${descriptors.length} data group descriptor(s) exist but could not be loaded; refusing to create/overwrite "default"`
4565
+ );
4566
+ } else {
4567
+ dataGroup = await repo.createAppDataGroup("default", []);
4568
+ appDataGroups.push(dataGroup);
4569
+ }
4563
4570
  }
4564
4571
  const backendId = `${type}-primary`;
4565
- if (!dataGroup.listBackends().some((b) => b.id === backendId)) {
4572
+ if (dataGroup && !dataGroup.listBackends().some((b) => b.id === backendId)) {
4566
4573
  await dataGroup.addBackend(backendId, type, backendOptions);
4567
4574
  }
4568
4575
  }
@@ -31012,10 +31012,11 @@ var ZenFSConfig = (() => {
31012
31012
  log8(`connect: failed to load app data group "${d.id}":`, err2);
31013
31013
  }
31014
31014
  }
31015
- let dataGroup2 = appDataGroups2[0];
31016
- if (!dataGroup2) {
31017
- dataGroup2 = await repo2.createAppDataGroup("default", []);
31018
- appDataGroups2.push(dataGroup2);
31015
+ const dataGroup2 = appDataGroups2[0];
31016
+ if (!dataGroup2 && descriptors2.length > 0) {
31017
+ log8(
31018
+ `connect: ${descriptors2.length} data group descriptor(s) found but none could be loaded; leaving them untouched (no empty group is created)`
31019
+ );
31019
31020
  }
31020
31021
  return {
31021
31022
  groupType: options.groupType ?? "config-sync",
@@ -31073,11 +31074,17 @@ var ZenFSConfig = (() => {
31073
31074
  let dataGroup = appDataGroups[0];
31074
31075
  if (groupType === "data-sync") {
31075
31076
  if (!dataGroup) {
31076
- dataGroup = await repo.createAppDataGroup("default", []);
31077
- appDataGroups.push(dataGroup);
31077
+ if (descriptors.length > 0) {
31078
+ log8(
31079
+ `connect: ${descriptors.length} data group descriptor(s) exist but could not be loaded; refusing to create/overwrite "default"`
31080
+ );
31081
+ } else {
31082
+ dataGroup = await repo.createAppDataGroup("default", []);
31083
+ appDataGroups.push(dataGroup);
31084
+ }
31078
31085
  }
31079
31086
  const backendId = `${type}-primary`;
31080
- if (!dataGroup.listBackends().some((b) => b.id === backendId)) {
31087
+ if (dataGroup && !dataGroup.listBackends().some((b) => b.id === backendId)) {
31081
31088
  await dataGroup.addBackend(backendId, type, backendOptions);
31082
31089
  }
31083
31090
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zen-fs-config",
3
- "version": "0.7.2",
3
+ "version": "0.7.3",
4
4
  "description": "Distributed config management library built on ZenFS, zen-fs-cache, and zen-fs-sync",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",