zen-fs-config 0.6.1 → 0.6.2
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 +269 -177
- package/dist/index.mjs +269 -177
- package/dist/zen-fs-config.js +265 -176
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -423,7 +423,7 @@ async function defaultNodeDir(appId, kind, groupId) {
|
|
|
423
423
|
}
|
|
424
424
|
|
|
425
425
|
// src/config-repo.ts
|
|
426
|
-
import { createLogger as
|
|
426
|
+
import { createLogger as createLogger3 } from "@richard432/localstorage-logger";
|
|
427
427
|
|
|
428
428
|
// src/version.ts
|
|
429
429
|
function versionPathFor(configFilePath) {
|
|
@@ -909,6 +909,9 @@ async function migrateVersionSidecars(fs, options = {}) {
|
|
|
909
909
|
return result;
|
|
910
910
|
}
|
|
911
911
|
|
|
912
|
+
// src/group-meta.ts
|
|
913
|
+
import { createLogger as createLogger2 } from "@richard432/localstorage-logger";
|
|
914
|
+
|
|
912
915
|
// src/canonical-json.ts
|
|
913
916
|
var FEATURE_ORDER = ["tombstones", "versions", "conflicts", "configHost", "appData"];
|
|
914
917
|
var GROUP_DESCRIPTOR_ORDER = ["schemaVersion", "kind", "id", "name", "features"];
|
|
@@ -982,6 +985,7 @@ function mergeDescriptorCreatedAt(descriptor, existing) {
|
|
|
982
985
|
}
|
|
983
986
|
|
|
984
987
|
// src/group-meta.ts
|
|
988
|
+
var log2 = createLogger2("zen-fs-config:tombstones");
|
|
985
989
|
var META_DIR = "/.meta";
|
|
986
990
|
var GROUP_DESCRIPTOR_FILE = `${META_DIR}/group.json`;
|
|
987
991
|
var META_BACKENDS_DIR = `${META_DIR}/backends`;
|
|
@@ -1052,6 +1056,141 @@ function encodeMetaPath(filePath) {
|
|
|
1052
1056
|
const normalized = filePath.startsWith("/") ? filePath : `/${filePath}`;
|
|
1053
1057
|
return normalized.replace(/^\//, "").replace(/\//g, "__").replace(/\./g, "++");
|
|
1054
1058
|
}
|
|
1059
|
+
function decodeMetaPath(entry) {
|
|
1060
|
+
if (!entry.endsWith(".json")) return null;
|
|
1061
|
+
const encoded = entry.slice(0, -".json".length);
|
|
1062
|
+
if (!encoded) return null;
|
|
1063
|
+
return `/${encoded.replace(/__/g, "/").replace(/\+\+/g, ".")}`;
|
|
1064
|
+
}
|
|
1065
|
+
function fallbackTombstone(path) {
|
|
1066
|
+
return { path, deletedAt: 0, deletedBy: "unknown", confirmedBy: [] };
|
|
1067
|
+
}
|
|
1068
|
+
function normalizeTombstoneRecord(value, fallbackPath) {
|
|
1069
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
1070
|
+
const record = value;
|
|
1071
|
+
const rawPath = typeof record.path === "string" ? record.path : fallbackPath;
|
|
1072
|
+
if (!rawPath) return null;
|
|
1073
|
+
const path = rawPath.startsWith("/") ? rawPath : `/${rawPath}`;
|
|
1074
|
+
const confirmedBy = Array.isArray(record.confirmedBy) ? record.confirmedBy.filter((id) => typeof id === "string") : [];
|
|
1075
|
+
return {
|
|
1076
|
+
path,
|
|
1077
|
+
deletedAt: typeof record.deletedAt === "number" ? record.deletedAt : 0,
|
|
1078
|
+
deletedBy: typeof record.deletedBy === "string" ? record.deletedBy : "unknown",
|
|
1079
|
+
confirmedBy
|
|
1080
|
+
};
|
|
1081
|
+
}
|
|
1082
|
+
function extractJsonObjects(raw) {
|
|
1083
|
+
const objects = [];
|
|
1084
|
+
let depth = 0;
|
|
1085
|
+
let start = -1;
|
|
1086
|
+
let inString = false;
|
|
1087
|
+
let escaped = false;
|
|
1088
|
+
for (let i = 0; i < raw.length; i++) {
|
|
1089
|
+
const ch = raw[i];
|
|
1090
|
+
if (inString) {
|
|
1091
|
+
if (escaped) escaped = false;
|
|
1092
|
+
else if (ch === "\\") escaped = true;
|
|
1093
|
+
else if (ch === '"') inString = false;
|
|
1094
|
+
continue;
|
|
1095
|
+
}
|
|
1096
|
+
if (ch === '"') {
|
|
1097
|
+
inString = true;
|
|
1098
|
+
continue;
|
|
1099
|
+
}
|
|
1100
|
+
if (ch === "{") {
|
|
1101
|
+
if (depth === 0) start = i;
|
|
1102
|
+
depth++;
|
|
1103
|
+
continue;
|
|
1104
|
+
}
|
|
1105
|
+
if (ch === "}") {
|
|
1106
|
+
if (depth === 0) continue;
|
|
1107
|
+
depth--;
|
|
1108
|
+
if (depth === 0 && start >= 0) {
|
|
1109
|
+
objects.push(raw.slice(start, i + 1));
|
|
1110
|
+
start = -1;
|
|
1111
|
+
}
|
|
1112
|
+
}
|
|
1113
|
+
}
|
|
1114
|
+
return objects;
|
|
1115
|
+
}
|
|
1116
|
+
function parseTombstoneFile(raw, fallbackPath) {
|
|
1117
|
+
const problems = [];
|
|
1118
|
+
const text = raw.trim();
|
|
1119
|
+
if (text === "") {
|
|
1120
|
+
problems.push("empty body");
|
|
1121
|
+
if (fallbackPath) {
|
|
1122
|
+
problems.push("path derived from filename");
|
|
1123
|
+
return { tombstones: [fallbackTombstone(fallbackPath)], problems };
|
|
1124
|
+
}
|
|
1125
|
+
problems.push("no path derivable from filename \u2014 skipped");
|
|
1126
|
+
return { tombstones: [], problems };
|
|
1127
|
+
}
|
|
1128
|
+
try {
|
|
1129
|
+
const parsed = normalizeTombstoneRecord(JSON.parse(text), fallbackPath);
|
|
1130
|
+
if (parsed) return { tombstones: [parsed], problems: [] };
|
|
1131
|
+
problems.push('JSON parsed but has no usable "path"');
|
|
1132
|
+
} catch (err) {
|
|
1133
|
+
problems.push(`JSON parse error: ${err instanceof Error ? err.message : String(err)}`);
|
|
1134
|
+
}
|
|
1135
|
+
const recovered = extractJsonObjects(text).map((chunk) => {
|
|
1136
|
+
try {
|
|
1137
|
+
return normalizeTombstoneRecord(JSON.parse(chunk));
|
|
1138
|
+
} catch {
|
|
1139
|
+
return null;
|
|
1140
|
+
}
|
|
1141
|
+
}).filter((t) => t !== null);
|
|
1142
|
+
if (recovered.length > 0) {
|
|
1143
|
+
if (recovered.length > 1) problems.push(`${recovered.length} concatenated documents recovered`);
|
|
1144
|
+
return { tombstones: recovered, problems };
|
|
1145
|
+
}
|
|
1146
|
+
if (fallbackPath) {
|
|
1147
|
+
problems.push("no recoverable document; path derived from filename");
|
|
1148
|
+
return { tombstones: [fallbackTombstone(fallbackPath)], problems };
|
|
1149
|
+
}
|
|
1150
|
+
problems.push("no recoverable document and no path derivable from filename \u2014 skipped");
|
|
1151
|
+
return { tombstones: [], problems };
|
|
1152
|
+
}
|
|
1153
|
+
function mergeTombstone(byPath, tombstone) {
|
|
1154
|
+
const prev = byPath.get(tombstone.path);
|
|
1155
|
+
if (!prev) {
|
|
1156
|
+
byPath.set(tombstone.path, tombstone);
|
|
1157
|
+
return;
|
|
1158
|
+
}
|
|
1159
|
+
for (const id of tombstone.confirmedBy) {
|
|
1160
|
+
if (!prev.confirmedBy.includes(id)) prev.confirmedBy.push(id);
|
|
1161
|
+
}
|
|
1162
|
+
}
|
|
1163
|
+
async function readTombstonesFromFs(fs, warn) {
|
|
1164
|
+
const byPath = /* @__PURE__ */ new Map();
|
|
1165
|
+
for (const dir of [TOMBSTONES_DIR, LEGACY_TOMBSTONES_DIR]) {
|
|
1166
|
+
let entries;
|
|
1167
|
+
try {
|
|
1168
|
+
entries = await fs.readdir(dir);
|
|
1169
|
+
} catch {
|
|
1170
|
+
continue;
|
|
1171
|
+
}
|
|
1172
|
+
for (const entry of entries) {
|
|
1173
|
+
if (!entry.endsWith(".json")) continue;
|
|
1174
|
+
const filePath = `${dir}/${entry}`;
|
|
1175
|
+
let raw;
|
|
1176
|
+
try {
|
|
1177
|
+
raw = new TextDecoder().decode(toBytes(await fs.readFile(filePath)));
|
|
1178
|
+
} catch (err) {
|
|
1179
|
+
warn(
|
|
1180
|
+
`[Tombstones] unreadable tombstone ${filePath}: ${err instanceof Error ? err.message : String(err)} \u2014 skipped`
|
|
1181
|
+
);
|
|
1182
|
+
continue;
|
|
1183
|
+
}
|
|
1184
|
+
const { tombstones, problems } = parseTombstoneFile(raw, decodeMetaPath(entry) ?? void 0);
|
|
1185
|
+
if (problems.length > 0) {
|
|
1186
|
+
const action = tombstones.length > 0 ? tombstones.map((t) => `"${t.path}" treated as deleted`).join(", ") : "skipped";
|
|
1187
|
+
warn(`[Tombstones] corrupt tombstone ${filePath}: ${problems.join("; ")} \u2192 ${action}`);
|
|
1188
|
+
}
|
|
1189
|
+
for (const tombstone of tombstones) mergeTombstone(byPath, tombstone);
|
|
1190
|
+
}
|
|
1191
|
+
}
|
|
1192
|
+
return Array.from(byPath.values());
|
|
1193
|
+
}
|
|
1055
1194
|
async function readGroupDescriptor(fs) {
|
|
1056
1195
|
const parsed = await readJson(fs, GROUP_DESCRIPTOR_FILE);
|
|
1057
1196
|
if (!parsed) return null;
|
|
@@ -1129,29 +1268,7 @@ var TombstoneStore = class {
|
|
|
1129
1268
|
}
|
|
1130
1269
|
/** All tombstones, new path first, legacy only for paths not already seen. */
|
|
1131
1270
|
async list() {
|
|
1132
|
-
|
|
1133
|
-
for (const dir of [TOMBSTONES_DIR, LEGACY_TOMBSTONES_DIR]) {
|
|
1134
|
-
let entries;
|
|
1135
|
-
try {
|
|
1136
|
-
entries = await this.fs.readdir(dir);
|
|
1137
|
-
} catch {
|
|
1138
|
-
continue;
|
|
1139
|
-
}
|
|
1140
|
-
for (const entry of entries) {
|
|
1141
|
-
if (!entry.endsWith(".json")) continue;
|
|
1142
|
-
const data = await readJson(this.fs, `${dir}/${entry}`);
|
|
1143
|
-
if (!data || typeof data.path !== "string") continue;
|
|
1144
|
-
const prev = byPath.get(data.path);
|
|
1145
|
-
if (prev) {
|
|
1146
|
-
for (const id of data.confirmedBy ?? []) {
|
|
1147
|
-
if (!prev.confirmedBy.includes(id)) prev.confirmedBy.push(id);
|
|
1148
|
-
}
|
|
1149
|
-
} else {
|
|
1150
|
-
byPath.set(data.path, data);
|
|
1151
|
-
}
|
|
1152
|
-
}
|
|
1153
|
-
}
|
|
1154
|
-
return Array.from(byPath.values());
|
|
1271
|
+
return readTombstonesFromFs(this.fs, (message) => log2.warn(message));
|
|
1155
1272
|
}
|
|
1156
1273
|
/** Write a tombstone (new + legacy mirror). */
|
|
1157
1274
|
async write(tombstone) {
|
|
@@ -1383,7 +1500,7 @@ var ConflictStore = class {
|
|
|
1383
1500
|
};
|
|
1384
1501
|
|
|
1385
1502
|
// src/config-repo.ts
|
|
1386
|
-
var
|
|
1503
|
+
var log3 = createLogger3("zen-fs-config:config-repo");
|
|
1387
1504
|
var GROUP_DESCRIPTOR_FILE2 = `${META_DIR}/group.json`;
|
|
1388
1505
|
var GROUP_TYPE_FILE = `${CONFIG_DIR}/group-type`;
|
|
1389
1506
|
var LEGACY_GROUP_TYPE_FILE = `${META_DIR}/group-type`;
|
|
@@ -1636,7 +1753,7 @@ var ConfigRepo = class {
|
|
|
1636
1753
|
const bytes = this.serializer.serialize(data, fullPath);
|
|
1637
1754
|
this.configCache.set(fullPath, data);
|
|
1638
1755
|
this.persistConfig(fullPath, bytes).catch((err) => {
|
|
1639
|
-
|
|
1756
|
+
log3.error(`[zen-fs-config] Failed to persist ${fullPath}:`, err);
|
|
1640
1757
|
});
|
|
1641
1758
|
}
|
|
1642
1759
|
// -----------------------------------------------------------------------
|
|
@@ -1790,7 +1907,7 @@ var ConfigRepo = class {
|
|
|
1790
1907
|
await removeDirectoryTree(this.cachedFS, normalizedPath);
|
|
1791
1908
|
this.invalidateTombstoneCache();
|
|
1792
1909
|
this.schedulePostDeleteSync();
|
|
1793
|
-
|
|
1910
|
+
log3.log(`[ConfigRepo] deleteFile(directory): ${normalizedPath} (${files.length} file(s))`);
|
|
1794
1911
|
return;
|
|
1795
1912
|
}
|
|
1796
1913
|
await this.writeTombstoneFor(normalizedPath);
|
|
@@ -1811,7 +1928,7 @@ var ConfigRepo = class {
|
|
|
1811
1928
|
} catch {
|
|
1812
1929
|
}
|
|
1813
1930
|
}
|
|
1814
|
-
|
|
1931
|
+
log3.log(`[ConfigRepo] deleteFile: ${normalizedPath} (tombstone at ${tombstonePathFor(normalizedPath)})`);
|
|
1815
1932
|
this.invalidateTombstoneCache();
|
|
1816
1933
|
this.schedulePostDeleteSync();
|
|
1817
1934
|
}
|
|
@@ -1829,7 +1946,7 @@ var ConfigRepo = class {
|
|
|
1829
1946
|
this.postDeleteSyncTimer = void 0;
|
|
1830
1947
|
if (this.disposed) return;
|
|
1831
1948
|
this.syncEngine.syncAll().catch((err) => {
|
|
1832
|
-
|
|
1949
|
+
log3.warn("[ConfigRepo] post-delete sync failed:", err);
|
|
1833
1950
|
});
|
|
1834
1951
|
}, 500);
|
|
1835
1952
|
}
|
|
@@ -1841,32 +1958,7 @@ var ConfigRepo = class {
|
|
|
1841
1958
|
if (this.tombstoneCache !== null) {
|
|
1842
1959
|
return this.tombstoneCache;
|
|
1843
1960
|
}
|
|
1844
|
-
|
|
1845
|
-
for (const dir of [TOMBSTONES_DIR, LEGACY_TOMBSTONES_DIR]) {
|
|
1846
|
-
let entries;
|
|
1847
|
-
try {
|
|
1848
|
-
entries = await this.cachedFS.readdir(dir);
|
|
1849
|
-
} catch {
|
|
1850
|
-
continue;
|
|
1851
|
-
}
|
|
1852
|
-
for (const entry of entries) {
|
|
1853
|
-
if (!entry.endsWith(".json")) continue;
|
|
1854
|
-
try {
|
|
1855
|
-
const raw = await this.cachedFS.readFile(`${dir}/${entry}`);
|
|
1856
|
-
const data = JSON.parse(new TextDecoder().decode(toUint8Array2(raw)));
|
|
1857
|
-
const prev = byPath.get(data.path);
|
|
1858
|
-
if (prev) {
|
|
1859
|
-
for (const id of data.confirmedBy ?? []) {
|
|
1860
|
-
if (!prev.confirmedBy.includes(id)) prev.confirmedBy.push(id);
|
|
1861
|
-
}
|
|
1862
|
-
} else {
|
|
1863
|
-
byPath.set(data.path, data);
|
|
1864
|
-
}
|
|
1865
|
-
} catch {
|
|
1866
|
-
}
|
|
1867
|
-
}
|
|
1868
|
-
}
|
|
1869
|
-
this.tombstoneCache = Array.from(byPath.values());
|
|
1961
|
+
this.tombstoneCache = await readTombstonesFromFs(this.cachedFS, (message) => log3.warn(message));
|
|
1870
1962
|
return this.tombstoneCache;
|
|
1871
1963
|
}
|
|
1872
1964
|
/** Invalidate the tombstone cache — call after tombstones are modified. */
|
|
@@ -1891,11 +1983,11 @@ var ConfigRepo = class {
|
|
|
1891
1983
|
for (const tombstone of tombstones) {
|
|
1892
1984
|
const forceDelete = isMtimeSidecar(tombstone.path);
|
|
1893
1985
|
const tVersionPath = forceDelete ? null : versionPathFor(tombstone.path);
|
|
1894
|
-
|
|
1986
|
+
log3.log(`[TOMB-TRACE] processing tombstone: path=${tombstone.path} versionPath=${tVersionPath ?? "null"} forceDelete=${forceDelete}`);
|
|
1895
1987
|
const existedOnPrimary = forceDelete || await this.safeExists(this.cachedFS, tombstone.path);
|
|
1896
|
-
|
|
1988
|
+
log3.log(`[TOMB-TRACE] primary safeExists(${tombstone.path}) \u2192 ${existedOnPrimary}`);
|
|
1897
1989
|
if (existedOnPrimary) {
|
|
1898
|
-
|
|
1990
|
+
log3.log(`[TOMB-TRACE] tombstone check: ${tombstone.path} on primary \u2192 EXISTS`);
|
|
1899
1991
|
}
|
|
1900
1992
|
if (existedOnPrimary) {
|
|
1901
1993
|
try {
|
|
@@ -1906,7 +1998,7 @@ var ConfigRepo = class {
|
|
|
1906
1998
|
}
|
|
1907
1999
|
if (tVersionPath) {
|
|
1908
2000
|
const vExistedOnPrimary = await this.safeExists(this.cachedFS, tVersionPath);
|
|
1909
|
-
|
|
2001
|
+
log3.log(`[TOMB-TRACE] primary safeExists(${tVersionPath}) \u2192 ${vExistedOnPrimary}`);
|
|
1910
2002
|
if (vExistedOnPrimary) {
|
|
1911
2003
|
try {
|
|
1912
2004
|
await this.cachedFS.unlink(tVersionPath);
|
|
@@ -1915,40 +2007,40 @@ var ConfigRepo = class {
|
|
|
1915
2007
|
}
|
|
1916
2008
|
}
|
|
1917
2009
|
for (const [replicaId, replica] of this.replicaBackends) {
|
|
1918
|
-
|
|
2010
|
+
log3.log(`[TOMB-TRACE] checking replica: ${replicaId} for ${tombstone.path}`);
|
|
1919
2011
|
const existed = forceDelete || await this.safeExists(replica.instance, tombstone.path);
|
|
1920
|
-
|
|
2012
|
+
log3.log(`[TOMB-TRACE] replica ${replicaId} safeExists(${tombstone.path}) \u2192 ${existed}`);
|
|
1921
2013
|
if (existed) {
|
|
1922
|
-
|
|
2014
|
+
log3.log(`[TOMB-TRACE] tombstone check: ${tombstone.path} on ${replicaId} \u2192 EXISTS`);
|
|
1923
2015
|
try {
|
|
1924
|
-
|
|
2016
|
+
log3.log(`[TOMB-TRACE] calling unlink(${tombstone.path}) on ${replicaId}`);
|
|
1925
2017
|
await replica.instance.unlink(tombstone.path);
|
|
1926
|
-
|
|
2018
|
+
log3.log(`[TOMB-TRACE] tombstone ${tombstone.path}: deleted on ${replicaId}`);
|
|
1927
2019
|
processed++;
|
|
1928
2020
|
} catch (err) {
|
|
1929
|
-
|
|
2021
|
+
log3.log(`[TOMB-TRACE] unlink(${tombstone.path}) on ${replicaId} FAILED: ${err}`);
|
|
1930
2022
|
alreadyDeleted++;
|
|
1931
2023
|
}
|
|
1932
2024
|
} else {
|
|
1933
|
-
|
|
2025
|
+
log3.log(`[TOMB-TRACE] replica ${replicaId}: already gone, skipping unlink`);
|
|
1934
2026
|
alreadyDeleted++;
|
|
1935
2027
|
}
|
|
1936
2028
|
if (tVersionPath) {
|
|
1937
2029
|
const vExisted = await this.safeExists(replica.instance, tVersionPath);
|
|
1938
|
-
|
|
2030
|
+
log3.log(`[TOMB-TRACE] replica ${replicaId} safeExists(${tVersionPath}) \u2192 ${vExisted}`);
|
|
1939
2031
|
if (vExisted) {
|
|
1940
2032
|
try {
|
|
1941
|
-
|
|
2033
|
+
log3.log(`[TOMB-TRACE] calling unlink(${tVersionPath}) on ${replicaId}`);
|
|
1942
2034
|
await replica.instance.unlink(tVersionPath);
|
|
1943
2035
|
} catch (err) {
|
|
1944
|
-
|
|
2036
|
+
log3.log(`[TOMB-TRACE] unlink(${tVersionPath}) on ${replicaId} FAILED: ${err}`);
|
|
1945
2037
|
}
|
|
1946
2038
|
}
|
|
1947
2039
|
}
|
|
1948
2040
|
}
|
|
1949
2041
|
}
|
|
1950
2042
|
if (processed > 0 || alreadyDeleted > 0) {
|
|
1951
|
-
|
|
2043
|
+
log3.log(`[TOMB-TRACE] processTombstones: ${tombstones.length} tombstone(s), ${processed} deleted, ${alreadyDeleted} already gone`);
|
|
1952
2044
|
}
|
|
1953
2045
|
}
|
|
1954
2046
|
/**
|
|
@@ -1964,21 +2056,21 @@ var ConfigRepo = class {
|
|
|
1964
2056
|
const innerBackendName = fs?.inner?.backendName;
|
|
1965
2057
|
const directBackendName = fs?.backendName;
|
|
1966
2058
|
const backendLabel = innerBackendName ?? directBackendName ?? innerBackend ?? ctorName;
|
|
1967
|
-
|
|
2059
|
+
log3.log(`[TOMB-TRACE] safeExists(${path}): fs type=${ctorName} backend=${backendLabel} hasExists=${hasExists} hasStat=${hasStat} inner=${innerBackend ?? "N/A"}`);
|
|
1968
2060
|
if (hasExists) {
|
|
1969
|
-
|
|
2061
|
+
log3.log(`[TOMB-TRACE] safeExists(${path}): \u2192 calling fs.exists() [backend=${backendLabel}]`);
|
|
1970
2062
|
const result = await fs.exists(path);
|
|
1971
|
-
|
|
2063
|
+
log3.log(`[TOMB-TRACE] safeExists(${path}): \u2190 fs.exists() [backend=${backendLabel}] \u2192 ${result}`);
|
|
1972
2064
|
return result;
|
|
1973
2065
|
}
|
|
1974
|
-
|
|
2066
|
+
log3.log(`[TOMB-TRACE] safeExists(${path}): no exists(), calling fs.stat() [backend=${backendLabel}]`);
|
|
1975
2067
|
await fs.stat(path);
|
|
1976
|
-
|
|
2068
|
+
log3.log(`[TOMB-TRACE] safeExists(${path}): \u2190 fs.stat() [backend=${backendLabel}] \u2192 OK (exists)`);
|
|
1977
2069
|
return true;
|
|
1978
2070
|
} catch (err) {
|
|
1979
2071
|
const errCode = err?.code ?? err?.status ?? "";
|
|
1980
2072
|
const errName = err?.constructor?.name ?? "";
|
|
1981
|
-
|
|
2073
|
+
log3.log(`[TOMB-TRACE] safeExists(${path}): \u2190 ERROR ${errName} ${errCode} ${err?.message ?? err}`);
|
|
1982
2074
|
return false;
|
|
1983
2075
|
}
|
|
1984
2076
|
}
|
|
@@ -2005,13 +2097,13 @@ var ConfigRepo = class {
|
|
|
2005
2097
|
this.assertNotDisposed();
|
|
2006
2098
|
const result = await purgeMtimeSidecars(this.cachedFS, options);
|
|
2007
2099
|
if (result.removed.length > 0) {
|
|
2008
|
-
|
|
2100
|
+
log3.log(
|
|
2009
2101
|
`[ConfigRepo] purged ${result.removed.length} .mtime sidecar(s) from local primary` + (options?.dryRun ? " (dry run)" : ""),
|
|
2010
2102
|
result.removed
|
|
2011
2103
|
);
|
|
2012
2104
|
}
|
|
2013
2105
|
if (result.failed.length > 0) {
|
|
2014
|
-
|
|
2106
|
+
log3.warn(`[ConfigRepo] failed to purge ${result.failed.length} .mtime sidecar(s):`, result.failed);
|
|
2015
2107
|
}
|
|
2016
2108
|
return result;
|
|
2017
2109
|
}
|
|
@@ -2031,13 +2123,13 @@ var ConfigRepo = class {
|
|
|
2031
2123
|
this.assertNotDisposed();
|
|
2032
2124
|
const result = await purgeKeepFiles(this.cachedFS, options);
|
|
2033
2125
|
if (result.removed.length > 0) {
|
|
2034
|
-
|
|
2126
|
+
log3.log(
|
|
2035
2127
|
`[ConfigRepo] purged ${result.removed.length} .keep placeholder(s) from local primary` + (options?.dryRun ? " (dry run)" : ""),
|
|
2036
2128
|
result.removed
|
|
2037
2129
|
);
|
|
2038
2130
|
}
|
|
2039
2131
|
if (result.failed.length > 0) {
|
|
2040
|
-
|
|
2132
|
+
log3.warn(`[ConfigRepo] failed to purge ${result.failed.length} .keep placeholder(s):`, result.failed);
|
|
2041
2133
|
}
|
|
2042
2134
|
return result;
|
|
2043
2135
|
}
|
|
@@ -2056,24 +2148,24 @@ var ConfigRepo = class {
|
|
|
2056
2148
|
}));
|
|
2057
2149
|
const result = await migrateVersionSidecars(this.cachedFS, { replicas });
|
|
2058
2150
|
if (result.renamed.length > 0) {
|
|
2059
|
-
|
|
2151
|
+
log3.log(
|
|
2060
2152
|
`[ConfigRepo] migrated ${result.renamed.length} legacy version sidecar(s) to new naming`,
|
|
2061
2153
|
result.renamed
|
|
2062
2154
|
);
|
|
2063
2155
|
}
|
|
2064
2156
|
if (result.deleted.length > 0) {
|
|
2065
|
-
|
|
2157
|
+
log3.log(
|
|
2066
2158
|
`[ConfigRepo] removed ${result.deleted.length} orphaned legacy version sidecar(s)`,
|
|
2067
2159
|
result.deleted
|
|
2068
2160
|
);
|
|
2069
2161
|
}
|
|
2070
2162
|
if (result.remoteDeleted.length > 0) {
|
|
2071
|
-
|
|
2163
|
+
log3.log(
|
|
2072
2164
|
`[ConfigRepo] removed ${result.remoteDeleted.length} remote residual legacy version sidecar(s)`
|
|
2073
2165
|
);
|
|
2074
2166
|
}
|
|
2075
2167
|
if (result.failed.length > 0) {
|
|
2076
|
-
|
|
2168
|
+
log3.warn(`[ConfigRepo] failed to migrate ${result.failed.length} legacy version sidecar(s):`, result.failed);
|
|
2077
2169
|
}
|
|
2078
2170
|
return result;
|
|
2079
2171
|
}
|
|
@@ -2096,9 +2188,9 @@ var ConfigRepo = class {
|
|
|
2096
2188
|
*/
|
|
2097
2189
|
startBackgroundSync() {
|
|
2098
2190
|
this.initialSyncPromise = this.initialSyncAndDedup().then(() => {
|
|
2099
|
-
|
|
2191
|
+
log3.log("[ConfigRepo] Background initial sync complete");
|
|
2100
2192
|
}).catch((err) => {
|
|
2101
|
-
|
|
2193
|
+
log3.error("[ConfigRepo] Background initial sync failed:", err);
|
|
2102
2194
|
}).finally(() => {
|
|
2103
2195
|
this.initialSyncPromise = null;
|
|
2104
2196
|
});
|
|
@@ -2132,7 +2224,7 @@ var ConfigRepo = class {
|
|
|
2132
2224
|
}
|
|
2133
2225
|
}
|
|
2134
2226
|
}
|
|
2135
|
-
|
|
2227
|
+
log3.log(`[ConfigRepo] updateTombstoneConfirmations: ${modified} tombstone(s) updated`);
|
|
2136
2228
|
if (modified > 0) this.invalidateTombstoneCache();
|
|
2137
2229
|
}
|
|
2138
2230
|
/**
|
|
@@ -2164,7 +2256,7 @@ var ConfigRepo = class {
|
|
|
2164
2256
|
}
|
|
2165
2257
|
}
|
|
2166
2258
|
}
|
|
2167
|
-
|
|
2259
|
+
log3.log(`[ConfigRepo] gcTombstones: removed ${tombstonePath} (all ${allBackendIds.length} backends confirmed)`);
|
|
2168
2260
|
}
|
|
2169
2261
|
}
|
|
2170
2262
|
}
|
|
@@ -2181,7 +2273,7 @@ var ConfigRepo = class {
|
|
|
2181
2273
|
this.assertNotDisposed();
|
|
2182
2274
|
const results = await this.flush();
|
|
2183
2275
|
for (const result of results) {
|
|
2184
|
-
|
|
2276
|
+
log3.log(
|
|
2185
2277
|
`[ConfigRepo] syncMetaToReplicas: ${result.pairId} +${result.filesCreated}/~${result.filesUpdated}/-${result.filesDeleted} skip:${result.filesSkipped} ${result.durationMs}ms`
|
|
2186
2278
|
);
|
|
2187
2279
|
}
|
|
@@ -2354,21 +2446,21 @@ var ConfigRepo = class {
|
|
|
2354
2446
|
// Internal — Setup
|
|
2355
2447
|
// -----------------------------------------------------------------------
|
|
2356
2448
|
async setupSync(backends, primaryBackendId, pollIntervalMs) {
|
|
2357
|
-
|
|
2449
|
+
log3.log(`[ConfigRepo] setupSync: ${backends.length} backends, primary=${primaryBackendId} pollInterval=${pollIntervalMs ?? "default"}ms`);
|
|
2358
2450
|
for (const desc of backends) {
|
|
2359
2451
|
if (desc.id === primaryBackendId) continue;
|
|
2360
2452
|
if (desc.enabled === false) {
|
|
2361
|
-
|
|
2453
|
+
log3.log(`[ConfigRepo] Skipping disabled replica: ${desc.id}`);
|
|
2362
2454
|
continue;
|
|
2363
2455
|
}
|
|
2364
|
-
|
|
2456
|
+
log3.log(`[ConfigRepo] Creating replica backend: id=${desc.id}, type=${desc.type}`);
|
|
2365
2457
|
try {
|
|
2366
2458
|
const instance = await createBackend(desc);
|
|
2367
2459
|
let fsInstance = instance;
|
|
2368
2460
|
if (this.cacheOptions) {
|
|
2369
2461
|
const { wrapWithCache } = await import("./cache-wrapper-S5HRLRQX.mjs");
|
|
2370
2462
|
fsInstance = wrapWithCache(instance, desc.id, this.cacheOptions);
|
|
2371
|
-
|
|
2463
|
+
log3.log(`[ConfigRepo] Replica ${desc.id} wrapped with CachedFileSystem (store=${this.cacheOptions.storeType ?? "IdbCacheStore"})`);
|
|
2372
2464
|
}
|
|
2373
2465
|
const syncable = backendToSyncableFS(fsInstance, `${desc.type}(${desc.id})`);
|
|
2374
2466
|
const pair = this.syncEngine.addPair(
|
|
@@ -2383,7 +2475,7 @@ var ConfigRepo = class {
|
|
|
2383
2475
|
this.invalidateTombstoneCache();
|
|
2384
2476
|
await this.processTombstones();
|
|
2385
2477
|
} catch (err) {
|
|
2386
|
-
|
|
2478
|
+
log3.warn("[ConfigRepo] preSyncHook processTombstones failed:", err);
|
|
2387
2479
|
}
|
|
2388
2480
|
},
|
|
2389
2481
|
postSyncHook: async () => {
|
|
@@ -2392,7 +2484,7 @@ var ConfigRepo = class {
|
|
|
2392
2484
|
await this.processTombstones();
|
|
2393
2485
|
await this.updateTombstoneConfirmations();
|
|
2394
2486
|
} catch (err) {
|
|
2395
|
-
|
|
2487
|
+
log3.warn("[ConfigRepo] postSyncHook tombstone processing failed:", err);
|
|
2396
2488
|
}
|
|
2397
2489
|
}
|
|
2398
2490
|
},
|
|
@@ -2405,9 +2497,9 @@ var ConfigRepo = class {
|
|
|
2405
2497
|
};
|
|
2406
2498
|
this.syncEngine.on(pair.pairId, "conflict", conflictHandler);
|
|
2407
2499
|
this.trackSyncErrors(desc.id, pair.pairId);
|
|
2408
|
-
|
|
2500
|
+
log3.log(`[ConfigRepo] Replica ${desc.id} created, sync pair=${pair.pairId}`);
|
|
2409
2501
|
} catch (err) {
|
|
2410
|
-
|
|
2502
|
+
log3.error(`[ConfigRepo] Failed to create replica ${desc.id} (${desc.type}):`, err);
|
|
2411
2503
|
this.backendStates.set(desc.id, {
|
|
2412
2504
|
backendId: desc.id,
|
|
2413
2505
|
error: {
|
|
@@ -2417,8 +2509,8 @@ var ConfigRepo = class {
|
|
|
2417
2509
|
});
|
|
2418
2510
|
}
|
|
2419
2511
|
}
|
|
2420
|
-
|
|
2421
|
-
|
|
2512
|
+
log3.log(`[ConfigRepo] setupSync complete. Replicas:`, Array.from(this.replicaBackends.keys()));
|
|
2513
|
+
log3.log(`[ConfigRepo] Sync statuses:`, this.getSyncStatuses());
|
|
2422
2514
|
}
|
|
2423
2515
|
// -----------------------------------------------------------------------
|
|
2424
2516
|
// Internal — Persistence
|
|
@@ -2430,12 +2522,12 @@ var ConfigRepo = class {
|
|
|
2430
2522
|
try {
|
|
2431
2523
|
const existing = await readVersion(this.fullFS, vPath);
|
|
2432
2524
|
if (existing && existing.hash === version.hash) {
|
|
2433
|
-
|
|
2525
|
+
log3.log("[ConfigRepo] skip version sidecar (hash unchanged):", vPath);
|
|
2434
2526
|
return;
|
|
2435
2527
|
}
|
|
2436
2528
|
} catch {
|
|
2437
2529
|
}
|
|
2438
|
-
|
|
2530
|
+
log3.log("[ConfigRepo] write version sidecar:", vPath, "v" + version.version);
|
|
2439
2531
|
await this.ensureDir(vPath);
|
|
2440
2532
|
await writeVersion(this.fullFS, vPath, version);
|
|
2441
2533
|
}
|
|
@@ -2539,7 +2631,7 @@ var ConfigRepo = class {
|
|
|
2539
2631
|
await this.resolveConflict(`${conflictId}/meta.json`, customMerge);
|
|
2540
2632
|
}
|
|
2541
2633
|
} catch (err) {
|
|
2542
|
-
|
|
2634
|
+
log3.error("[zen-fs-config] Conflict handler error:", err);
|
|
2543
2635
|
}
|
|
2544
2636
|
}
|
|
2545
2637
|
}
|
|
@@ -2651,11 +2743,11 @@ var ConfigRepo = class {
|
|
|
2651
2743
|
}
|
|
2652
2744
|
return { kind: "ok", desc, mtime };
|
|
2653
2745
|
} else {
|
|
2654
|
-
|
|
2746
|
+
log3.warn(`[ConfigRepo] Backend descriptor ${entry} is missing id/type fields, marking for cleanup`);
|
|
2655
2747
|
return { kind: "corrupt", filePath };
|
|
2656
2748
|
}
|
|
2657
2749
|
} catch (parseErr) {
|
|
2658
|
-
|
|
2750
|
+
log3.warn(`[ConfigRepo] Backend descriptor ${entry} has corrupted JSON: ${parseErr}. Marking for cleanup.`);
|
|
2659
2751
|
return { kind: "corrupt", filePath };
|
|
2660
2752
|
}
|
|
2661
2753
|
})
|
|
@@ -2726,7 +2818,7 @@ var ConfigRepo = class {
|
|
|
2726
2818
|
}
|
|
2727
2819
|
}
|
|
2728
2820
|
if (duplicates.length > 0) {
|
|
2729
|
-
|
|
2821
|
+
log3.log(
|
|
2730
2822
|
`[ConfigRepo] readAllBackendDescriptors: removing ${duplicates.length} duplicate(s): ${duplicates.join(", ")}`
|
|
2731
2823
|
);
|
|
2732
2824
|
for (const dupId of duplicates) {
|
|
@@ -2857,7 +2949,7 @@ var ConfigRepo = class {
|
|
|
2857
2949
|
* Shared by addBackend() and replaceBackend().
|
|
2858
2950
|
*/
|
|
2859
2951
|
async setupReplica(id, type, options, description) {
|
|
2860
|
-
|
|
2952
|
+
log3.log(`[ConfigRepo] addBackend: creating ${id} (${type})...`);
|
|
2861
2953
|
const instance = await createBackend({ type, options });
|
|
2862
2954
|
const syncable = backendToSyncableFS(instance, `${type}(${id})`);
|
|
2863
2955
|
const desc = { id, type, options, description };
|
|
@@ -2873,7 +2965,7 @@ var ConfigRepo = class {
|
|
|
2873
2965
|
this.invalidateTombstoneCache();
|
|
2874
2966
|
await this.processTombstones();
|
|
2875
2967
|
} catch (err) {
|
|
2876
|
-
|
|
2968
|
+
log3.warn("[ConfigRepo] preSyncHook processTombstones failed:", err);
|
|
2877
2969
|
}
|
|
2878
2970
|
},
|
|
2879
2971
|
postSyncHook: async () => {
|
|
@@ -2882,7 +2974,7 @@ var ConfigRepo = class {
|
|
|
2882
2974
|
await this.processTombstones();
|
|
2883
2975
|
await this.updateTombstoneConfirmations();
|
|
2884
2976
|
} catch (err) {
|
|
2885
|
-
|
|
2977
|
+
log3.warn("[ConfigRepo] postSyncHook tombstone processing failed:", err);
|
|
2886
2978
|
}
|
|
2887
2979
|
}
|
|
2888
2980
|
},
|
|
@@ -2895,7 +2987,7 @@ var ConfigRepo = class {
|
|
|
2895
2987
|
};
|
|
2896
2988
|
this.syncEngine.on(pair.pairId, "conflict", conflictHandler);
|
|
2897
2989
|
this.trackSyncErrors(id, pair.pairId);
|
|
2898
|
-
|
|
2990
|
+
log3.log(`[ConfigRepo] addBackend: ${id} (${type}) added, sync pair=${pair.pairId}`);
|
|
2899
2991
|
await this.syncMetaToReplicas();
|
|
2900
2992
|
this.syncEngine.watch(pair.pairId);
|
|
2901
2993
|
return pair.pairId;
|
|
@@ -2921,13 +3013,13 @@ var ConfigRepo = class {
|
|
|
2921
3013
|
}
|
|
2922
3014
|
}
|
|
2923
3015
|
this.syncEngine.removePair(replica.pairId);
|
|
2924
|
-
|
|
3016
|
+
log3.log(`[ConfigRepo] removeBackend: sync pair ${replica.pairId} removed`);
|
|
2925
3017
|
this.replicaBackends.delete(id);
|
|
2926
3018
|
if (replica.instance?.dispose) {
|
|
2927
3019
|
await replica.instance.dispose();
|
|
2928
3020
|
}
|
|
2929
3021
|
} else {
|
|
2930
|
-
|
|
3022
|
+
log3.log(`[ConfigRepo] removeBackend: "${id}" not in replicaBackends, cleaning up descriptor only`);
|
|
2931
3023
|
for (const descPath of descPaths) {
|
|
2932
3024
|
try {
|
|
2933
3025
|
await this.deleteFile(descPath);
|
|
@@ -2938,7 +3030,7 @@ var ConfigRepo = class {
|
|
|
2938
3030
|
}
|
|
2939
3031
|
this.backendStates.delete(id);
|
|
2940
3032
|
this.schedulePostDeleteSync();
|
|
2941
|
-
|
|
3033
|
+
log3.log(`[ConfigRepo] removeBackend: ${id} removed (tombstone written, remote cleaned)`);
|
|
2942
3034
|
}
|
|
2943
3035
|
/**
|
|
2944
3036
|
* Replace a config-sync backend's parameters in place (same id).
|
|
@@ -2985,11 +3077,11 @@ var ConfigRepo = class {
|
|
|
2985
3077
|
await this.setupReplica(id, type, options, description ?? before.description);
|
|
2986
3078
|
} catch (err) {
|
|
2987
3079
|
const reason = err instanceof Error ? err.message : String(err);
|
|
2988
|
-
|
|
3080
|
+
log3.warn(`[ConfigRepo] replaceBackend: "${id}" failed, rolling back old options:`, err);
|
|
2989
3081
|
try {
|
|
2990
3082
|
await this.setupReplica(id, before.type, before.options, before.description);
|
|
2991
3083
|
} catch (rollbackErr) {
|
|
2992
|
-
|
|
3084
|
+
log3.error(`[ConfigRepo] replaceBackend: rollback for "${id}" ALSO failed:`, rollbackErr);
|
|
2993
3085
|
}
|
|
2994
3086
|
throw new Error(`\u66F4\u65B0\u540E\u7AEF\u53C2\u6570\u5931\u8D25\uFF1A${reason}\uFF08\u5DF2\u5C1D\u8BD5\u56DE\u6EDA\u65E7\u53C2\u6570\uFF09`);
|
|
2995
3087
|
}
|
|
@@ -3005,7 +3097,7 @@ var ConfigRepo = class {
|
|
|
3005
3097
|
const existing = await this.cachedFS.readFile(path, "utf-8");
|
|
3006
3098
|
const current = existing.trim();
|
|
3007
3099
|
if (current && current !== type) {
|
|
3008
|
-
|
|
3100
|
+
log3.warn(`[ConfigRepo] group-type already set to "${current}" at ${path}, ignoring request to set "${type}"`);
|
|
3009
3101
|
return;
|
|
3010
3102
|
}
|
|
3011
3103
|
} catch {
|
|
@@ -3036,7 +3128,7 @@ var ConfigRepo = class {
|
|
|
3036
3128
|
features: existingDescriptor.features ?? CONFIG_GROUP_FEATURES
|
|
3037
3129
|
});
|
|
3038
3130
|
}
|
|
3039
|
-
|
|
3131
|
+
log3.log(`[ConfigRepo] group-type set to "${type}"`);
|
|
3040
3132
|
}
|
|
3041
3133
|
/** Read the group-type marker. Returns null if not set (new path, then legacy). */
|
|
3042
3134
|
async getGroupType() {
|
|
@@ -3131,7 +3223,7 @@ var ConfigRepo = class {
|
|
|
3131
3223
|
if (this.appDataGroups.has(id)) {
|
|
3132
3224
|
throw new Error(`App data group "${id}" already exists. Use removeAppDataGroup() first.`);
|
|
3133
3225
|
}
|
|
3134
|
-
|
|
3226
|
+
log3.log(`[ConfigRepo] createAppDataGroup: creating "${id}" with ${backends.length} backend(s)`);
|
|
3135
3227
|
const resolvedBackends = [];
|
|
3136
3228
|
for (const desc of backends) {
|
|
3137
3229
|
assertValidBackendId(desc.id);
|
|
@@ -3158,7 +3250,7 @@ var ConfigRepo = class {
|
|
|
3158
3250
|
};
|
|
3159
3251
|
await this.writeAppDataGroupDescriptorFile(id, descriptor);
|
|
3160
3252
|
this.appDataGroups.set(id, group);
|
|
3161
|
-
|
|
3253
|
+
log3.log(`[ConfigRepo] createAppDataGroup: "${id}" created`);
|
|
3162
3254
|
return group;
|
|
3163
3255
|
}
|
|
3164
3256
|
/**
|
|
@@ -3201,7 +3293,7 @@ var ConfigRepo = class {
|
|
|
3201
3293
|
try {
|
|
3202
3294
|
await live.writeOwnGroupDescriptor();
|
|
3203
3295
|
} catch (err) {
|
|
3204
|
-
|
|
3296
|
+
log3.warn(`[ConfigRepo] updateAppDataGroupName: "${id}" group.json update failed:`, err);
|
|
3205
3297
|
}
|
|
3206
3298
|
}
|
|
3207
3299
|
const descriptor = {
|
|
@@ -3264,7 +3356,7 @@ var ConfigRepo = class {
|
|
|
3264
3356
|
return group;
|
|
3265
3357
|
} catch (err) {
|
|
3266
3358
|
const reason = err instanceof Error ? err.message : String(err);
|
|
3267
|
-
|
|
3359
|
+
log3.warn(`[ConfigRepo] replaceAppDataGroupBackend: "${backendId}" failed, rolling back:`, err);
|
|
3268
3360
|
try {
|
|
3269
3361
|
const restored = new AppDataGroupImpl(
|
|
3270
3362
|
groupId,
|
|
@@ -3278,7 +3370,7 @@ var ConfigRepo = class {
|
|
|
3278
3370
|
await this.updateAppDataGroupDescriptor(groupId, restored.listDeclaredBackends());
|
|
3279
3371
|
this.appDataGroups.set(groupId, restored);
|
|
3280
3372
|
} catch (rollbackErr) {
|
|
3281
|
-
|
|
3373
|
+
log3.error("[ConfigRepo] replaceAppDataGroupBackend: rollback ALSO failed:", rollbackErr);
|
|
3282
3374
|
}
|
|
3283
3375
|
throw new Error(`\u66F4\u65B0\u540E\u7AEF\u53C2\u6570\u5931\u8D25\uFF1A${reason}\uFF08\u5DF2\u5C1D\u8BD5\u56DE\u6EDA\u65E7\u53C2\u6570\uFF09`);
|
|
3284
3376
|
}
|
|
@@ -3396,7 +3488,7 @@ var ConfigRepo = class {
|
|
|
3396
3488
|
try {
|
|
3397
3489
|
await this.deleteFile(descPath);
|
|
3398
3490
|
} catch (err) {
|
|
3399
|
-
|
|
3491
|
+
log3.log(`[ConfigRepo] removeAppDataGroup: deleteFile failed for "${id}" at ${descPath}:`, err);
|
|
3400
3492
|
try {
|
|
3401
3493
|
await this.cachedFS.unlink(descPath);
|
|
3402
3494
|
} catch {
|
|
@@ -3404,7 +3496,7 @@ var ConfigRepo = class {
|
|
|
3404
3496
|
await this.unlinkVersionSidecar(this.cachedFS, descPath);
|
|
3405
3497
|
}
|
|
3406
3498
|
}
|
|
3407
|
-
|
|
3499
|
+
log3.log(`[ConfigRepo] removeAppDataGroup: "${id}" removed`);
|
|
3408
3500
|
}
|
|
3409
3501
|
async listAccountBackends() {
|
|
3410
3502
|
this.assertNotDisposed();
|
|
@@ -3579,24 +3671,24 @@ var AppDataGroupImpl = class {
|
|
|
3579
3671
|
try {
|
|
3580
3672
|
const purged = await purgeMtimeSidecars(this.localFS);
|
|
3581
3673
|
if (purged.removed.length > 0) {
|
|
3582
|
-
|
|
3674
|
+
log3.warn(
|
|
3583
3675
|
`[AppDataGroup:${this.groupId}] purged ${purged.removed.length} leaked .mtime sidecar(s):`,
|
|
3584
3676
|
purged.removed
|
|
3585
3677
|
);
|
|
3586
3678
|
}
|
|
3587
3679
|
} catch (err) {
|
|
3588
|
-
|
|
3680
|
+
log3.warn(`[AppDataGroup:${this.groupId}] .mtime purge failed:`, err?.message ?? err);
|
|
3589
3681
|
}
|
|
3590
3682
|
try {
|
|
3591
3683
|
const purgedKeep = await purgeKeepFiles(this.localFS);
|
|
3592
3684
|
if (purgedKeep.removed.length > 0) {
|
|
3593
|
-
|
|
3685
|
+
log3.warn(
|
|
3594
3686
|
`[AppDataGroup:${this.groupId}] purged ${purgedKeep.removed.length} leaked .keep placeholder(s):`,
|
|
3595
3687
|
purgedKeep.removed
|
|
3596
3688
|
);
|
|
3597
3689
|
}
|
|
3598
3690
|
} catch (err) {
|
|
3599
|
-
|
|
3691
|
+
log3.warn(`[AppDataGroup:${this.groupId}] .keep purge failed:`, err?.message ?? err);
|
|
3600
3692
|
}
|
|
3601
3693
|
const localSyncable = backendToSyncableFS(this.localFS, `local(${this.groupId})`);
|
|
3602
3694
|
this.tombstones = new TombstoneStore(this.localFS, this.localBackendId);
|
|
@@ -3606,13 +3698,13 @@ var AppDataGroupImpl = class {
|
|
|
3606
3698
|
try {
|
|
3607
3699
|
backendsChanged = await this.loadBackendDescriptors();
|
|
3608
3700
|
} catch (err) {
|
|
3609
|
-
|
|
3701
|
+
log3.warn(`[AppDataGroup:${this.groupId}] failed to load .meta/backends:`, err);
|
|
3610
3702
|
this._backends = this._backends ?? [];
|
|
3611
3703
|
}
|
|
3612
3704
|
try {
|
|
3613
3705
|
await this.writeOwnGroupDescriptor();
|
|
3614
3706
|
} catch (err) {
|
|
3615
|
-
|
|
3707
|
+
log3.warn(`[AppDataGroup:${this.groupId}] failed to write .meta/group.json:`, err);
|
|
3616
3708
|
}
|
|
3617
3709
|
this.fs = createChrootFS(this.localFS, "/", {
|
|
3618
3710
|
hiddenPrefixes: [META_DIR, CONFIG_DIR],
|
|
@@ -3622,7 +3714,7 @@ var AppDataGroupImpl = class {
|
|
|
3622
3714
|
});
|
|
3623
3715
|
const { kept, removed } = dedupeAppDataBackends(this._backends);
|
|
3624
3716
|
if (removed.length > 0) {
|
|
3625
|
-
|
|
3717
|
+
log3.warn(
|
|
3626
3718
|
`[AppDataGroup:${this.groupId}] dedupe: removing ${removed.length} duplicate backend(s) (${removed.map((b) => b.id).join(", ")}) \u2014 keeping ${kept.map((b) => b.id).join(", ")}`
|
|
3627
3719
|
);
|
|
3628
3720
|
this._backends = kept;
|
|
@@ -3636,7 +3728,7 @@ var AppDataGroupImpl = class {
|
|
|
3636
3728
|
features: this._declaredFeatures
|
|
3637
3729
|
});
|
|
3638
3730
|
} catch (err) {
|
|
3639
|
-
|
|
3731
|
+
log3.warn(`[AppDataGroup:${this.groupId}] failed to persist backend topology:`, err);
|
|
3640
3732
|
}
|
|
3641
3733
|
}
|
|
3642
3734
|
for (const desc of this._backends) {
|
|
@@ -3668,26 +3760,26 @@ var AppDataGroupImpl = class {
|
|
|
3668
3760
|
if (this.features.conflicts) {
|
|
3669
3761
|
const conflictHandler = (event) => {
|
|
3670
3762
|
this.archiveConflict(event).catch((err) => {
|
|
3671
|
-
|
|
3763
|
+
log3.warn(`[AppDataGroup:${this.groupId}] conflict archive failed:`, err);
|
|
3672
3764
|
});
|
|
3673
3765
|
};
|
|
3674
3766
|
this.syncEngine.on(pair.pairId, "conflict", conflictHandler);
|
|
3675
3767
|
}
|
|
3676
3768
|
this.trackSyncErrors(desc.id, pair.pairId);
|
|
3677
|
-
|
|
3769
|
+
log3.log(`[AppDataGroup:${this.groupId}] backend ${desc.id} (${desc.type}) connected, pair=${pair.pairId}`);
|
|
3678
3770
|
} catch (err) {
|
|
3679
3771
|
const message = err instanceof Error ? err.message : String(err);
|
|
3680
3772
|
this.backendStates.set(desc.id, {
|
|
3681
3773
|
backendId: desc.id,
|
|
3682
3774
|
error: { message, timestamp: Date.now() }
|
|
3683
3775
|
});
|
|
3684
|
-
|
|
3776
|
+
log3.error(`[AppDataGroup:${this.groupId}] Failed to create backend ${desc.id} (${desc.type}):`, err);
|
|
3685
3777
|
}
|
|
3686
3778
|
}
|
|
3687
3779
|
try {
|
|
3688
3780
|
await this.syncEngine.syncAll();
|
|
3689
3781
|
} catch (err) {
|
|
3690
|
-
|
|
3782
|
+
log3.warn(`[AppDataGroup:${this.groupId}] Initial sync failed:`, err);
|
|
3691
3783
|
}
|
|
3692
3784
|
this.syncEngine.watchAll();
|
|
3693
3785
|
}
|
|
@@ -3702,7 +3794,7 @@ var AppDataGroupImpl = class {
|
|
|
3702
3794
|
try {
|
|
3703
3795
|
await this.tombstones.gc(this.allBackendIds(), this.tombstoneTargets());
|
|
3704
3796
|
} catch (err) {
|
|
3705
|
-
|
|
3797
|
+
log3.warn(`[AppDataGroup:${this.groupId}] tombstone GC failed:`, err);
|
|
3706
3798
|
}
|
|
3707
3799
|
return Array.from(results.values());
|
|
3708
3800
|
}
|
|
@@ -3737,7 +3829,7 @@ var AppDataGroupImpl = class {
|
|
|
3737
3829
|
const bytes = typeof data === "string" ? new TextEncoder().encode(data) : toUint8Array2(data);
|
|
3738
3830
|
await this.versions.record(path, bytes);
|
|
3739
3831
|
} catch (err) {
|
|
3740
|
-
|
|
3832
|
+
log3.warn(`[AppDataGroup:${this.groupId}] version record failed for ${path}:`, err);
|
|
3741
3833
|
}
|
|
3742
3834
|
}
|
|
3743
3835
|
/** Delete tombstoned files on local + every connected backend before/after sync. */
|
|
@@ -3745,14 +3837,14 @@ var AppDataGroupImpl = class {
|
|
|
3745
3837
|
try {
|
|
3746
3838
|
await this.tombstones.process(this.tombstoneTargets());
|
|
3747
3839
|
} catch (err) {
|
|
3748
|
-
|
|
3840
|
+
log3.warn(`[AppDataGroup:${this.groupId}] ${stage} tombstone pass failed:`, err);
|
|
3749
3841
|
}
|
|
3750
3842
|
}
|
|
3751
3843
|
async confirmTombstones() {
|
|
3752
3844
|
try {
|
|
3753
3845
|
await this.tombstones.confirm(this.allBackendIds());
|
|
3754
3846
|
} catch (err) {
|
|
3755
|
-
|
|
3847
|
+
log3.warn(`[AppDataGroup:${this.groupId}] tombstone confirmations failed:`, err);
|
|
3756
3848
|
}
|
|
3757
3849
|
}
|
|
3758
3850
|
/** Write a tombstone for `filePath`. Records metadata only — it never creates the file. */
|
|
@@ -3785,7 +3877,7 @@ var AppDataGroupImpl = class {
|
|
|
3785
3877
|
}
|
|
3786
3878
|
await removeDirectoryTree(this.localFS, normalized);
|
|
3787
3879
|
this.schedulePostDeleteSync();
|
|
3788
|
-
|
|
3880
|
+
log3.log(`[AppDataGroup:${this.groupId}] deleteFile(directory): ${normalized} (${files.length} file(s))`);
|
|
3789
3881
|
return;
|
|
3790
3882
|
}
|
|
3791
3883
|
await this.writeTombstoneFor(normalized);
|
|
@@ -3824,7 +3916,7 @@ var AppDataGroupImpl = class {
|
|
|
3824
3916
|
try {
|
|
3825
3917
|
await this.syncEngine.syncAll();
|
|
3826
3918
|
} catch (err) {
|
|
3827
|
-
|
|
3919
|
+
log3.warn(`[AppDataGroup:${this.groupId}] sync after conflict resolve failed:`, err);
|
|
3828
3920
|
}
|
|
3829
3921
|
}
|
|
3830
3922
|
readConflictBackup(conflictId, fileType) {
|
|
@@ -3859,7 +3951,7 @@ var AppDataGroupImpl = class {
|
|
|
3859
3951
|
if (this.dataBackends.has(id)) {
|
|
3860
3952
|
throw new Error(`Backend "${id}" already exists in data group "${this.groupId}"`);
|
|
3861
3953
|
}
|
|
3862
|
-
|
|
3954
|
+
log3.log(`[AppDataGroup:${this.groupId}] addBackend: creating ${id} (${type})...`);
|
|
3863
3955
|
const instance = await createBackend({ type, options });
|
|
3864
3956
|
const syncable = backendToSyncableFS(instance, `${type}(${id})`);
|
|
3865
3957
|
const localSyncable = backendToSyncableFS(this.localFS, `local(${this.groupId})`);
|
|
@@ -3887,13 +3979,13 @@ var AppDataGroupImpl = class {
|
|
|
3887
3979
|
if (this.features.conflicts) {
|
|
3888
3980
|
this.syncEngine.on(pair.pairId, "conflict", (event) => {
|
|
3889
3981
|
this.archiveConflict(event).catch((err) => {
|
|
3890
|
-
|
|
3982
|
+
log3.warn(`[AppDataGroup:${this.groupId}] conflict archive failed:`, err);
|
|
3891
3983
|
});
|
|
3892
3984
|
});
|
|
3893
3985
|
}
|
|
3894
3986
|
this.trackSyncErrors(id, pair.pairId);
|
|
3895
3987
|
this._backends = [...this._backends.filter((b) => b.id !== id), desc];
|
|
3896
|
-
|
|
3988
|
+
log3.log(`[AppDataGroup:${this.groupId}] addBackend: ${id} (${type}) connected, pair=${pair.pairId}`);
|
|
3897
3989
|
try {
|
|
3898
3990
|
const stale = (await this.tombstones.list()).find(
|
|
3899
3991
|
(t) => t.path === backendMetaFilePath(id)
|
|
@@ -3901,12 +3993,12 @@ var AppDataGroupImpl = class {
|
|
|
3901
3993
|
if (stale) await this.tombstones.remove(stale);
|
|
3902
3994
|
await writeBackendMetaDescriptor(this.localFS, desc);
|
|
3903
3995
|
} catch (err) {
|
|
3904
|
-
|
|
3996
|
+
log3.warn(`[AppDataGroup:${this.groupId}] addBackend: failed to write .meta/backends/${id}.json:`, err);
|
|
3905
3997
|
}
|
|
3906
3998
|
try {
|
|
3907
3999
|
await this.syncEngine.sync(pair.pairId);
|
|
3908
4000
|
} catch (err) {
|
|
3909
|
-
|
|
4001
|
+
log3.warn(`[AppDataGroup:${this.groupId}] addBackend: initial sync failed for ${id}:`, err);
|
|
3910
4002
|
}
|
|
3911
4003
|
this.syncEngine.watch(pair.pairId);
|
|
3912
4004
|
await this.parent.updateAppDataGroupDescriptor(this.groupId, this._backends, {
|
|
@@ -3937,7 +4029,7 @@ var AppDataGroupImpl = class {
|
|
|
3937
4029
|
if (backend?.instance?.dispose) {
|
|
3938
4030
|
await backend.instance.dispose();
|
|
3939
4031
|
}
|
|
3940
|
-
|
|
4032
|
+
log3.log(`[AppDataGroup:${this.groupId}] removeBackend: ${id} removed`);
|
|
3941
4033
|
}
|
|
3942
4034
|
listBackends() {
|
|
3943
4035
|
return Array.from(this.dataBackends.values()).map((b) => b.desc);
|
|
@@ -3979,44 +4071,44 @@ async function createConfigRepo(appId, options = {}) {
|
|
|
3979
4071
|
idbStoreName: options.idbStoreName,
|
|
3980
4072
|
folderPath: options.folderPath
|
|
3981
4073
|
});
|
|
3982
|
-
|
|
4074
|
+
log3.log(`[createConfigRepo] Creating local primary (type: ${localPrimary.type})...`);
|
|
3983
4075
|
const primaryInstance = await createBackend(localPrimary);
|
|
3984
4076
|
const cachedFS = primaryInstance;
|
|
3985
4077
|
if (options.purgeMtimeSidecars !== false) {
|
|
3986
4078
|
try {
|
|
3987
4079
|
const purged = await purgeMtimeSidecars(cachedFS);
|
|
3988
4080
|
if (purged.removed.length > 0) {
|
|
3989
|
-
|
|
4081
|
+
log3.warn(
|
|
3990
4082
|
`[createConfigRepo] purged ${purged.removed.length} leaked .mtime sidecar(s) from local primary:`,
|
|
3991
4083
|
purged.removed
|
|
3992
4084
|
);
|
|
3993
4085
|
}
|
|
3994
4086
|
} catch (err) {
|
|
3995
|
-
|
|
4087
|
+
log3.warn(`[createConfigRepo] .mtime purge failed:`, err?.message ?? err);
|
|
3996
4088
|
}
|
|
3997
4089
|
}
|
|
3998
4090
|
if (options.purgeKeepFiles !== false) {
|
|
3999
4091
|
try {
|
|
4000
4092
|
const purged = await purgeKeepFiles(cachedFS);
|
|
4001
4093
|
if (purged.removed.length > 0) {
|
|
4002
|
-
|
|
4094
|
+
log3.warn(
|
|
4003
4095
|
`[createConfigRepo] purged ${purged.removed.length} leaked .keep placeholder(s) from local primary:`,
|
|
4004
4096
|
purged.removed
|
|
4005
4097
|
);
|
|
4006
4098
|
}
|
|
4007
4099
|
} catch (err) {
|
|
4008
|
-
|
|
4100
|
+
log3.warn(`[createConfigRepo] .keep purge failed:`, err?.message ?? err);
|
|
4009
4101
|
}
|
|
4010
4102
|
}
|
|
4011
4103
|
const cacheOptions = options.cache === false ? void 0 : options.cache ?? {};
|
|
4012
4104
|
try {
|
|
4013
4105
|
await primaryInstance.mkdir(META_DIR);
|
|
4014
|
-
|
|
4106
|
+
log3.log(`[createConfigRepo] /.meta/ ready`);
|
|
4015
4107
|
} catch (err) {
|
|
4016
4108
|
const msg = err.message || "";
|
|
4017
4109
|
if (msg.includes("File exists") || msg.includes("EEXIST") || err.code === "EEXIST") {
|
|
4018
4110
|
} else {
|
|
4019
|
-
|
|
4111
|
+
log3.error(`[createConfigRepo] Failed to ensure /.meta/:`, err.message);
|
|
4020
4112
|
}
|
|
4021
4113
|
}
|
|
4022
4114
|
try {
|
|
@@ -4027,7 +4119,7 @@ async function createConfigRepo(appId, options = {}) {
|
|
|
4027
4119
|
} catch {
|
|
4028
4120
|
await ensureParentDir2(primaryInstance, path);
|
|
4029
4121
|
await primaryInstance.writeFile(path, groupTypeBytes);
|
|
4030
|
-
|
|
4122
|
+
log3.log(`[createConfigRepo] group-type set to "config-sync" at ${path}`);
|
|
4031
4123
|
}
|
|
4032
4124
|
}
|
|
4033
4125
|
if (!await readGroupDescriptor(primaryInstance)) {
|
|
@@ -4039,7 +4131,7 @@ async function createConfigRepo(appId, options = {}) {
|
|
|
4039
4131
|
});
|
|
4040
4132
|
}
|
|
4041
4133
|
} catch (err) {
|
|
4042
|
-
|
|
4134
|
+
log3.warn(`[createConfigRepo] Failed to write group metadata:`, err.message);
|
|
4043
4135
|
}
|
|
4044
4136
|
const tempRepo = new ConfigRepo(
|
|
4045
4137
|
appId,
|
|
@@ -4053,11 +4145,11 @@ async function createConfigRepo(appId, options = {}) {
|
|
|
4053
4145
|
);
|
|
4054
4146
|
const oldBackendsMeta = await tempRepo.readMetaFile(BACKENDS_FILE);
|
|
4055
4147
|
if (oldBackendsMeta && oldBackendsMeta.backends?.length > 0) {
|
|
4056
|
-
|
|
4148
|
+
log3.log(`[createConfigRepo] Migrating ${oldBackendsMeta.backends.length} backend(s) from backends.json to individual files...`);
|
|
4057
4149
|
await tempRepo.ensureDir(`${BACKENDS_DIR}/.keep`);
|
|
4058
4150
|
for (const desc of oldBackendsMeta.backends) {
|
|
4059
4151
|
if (desc.id === LOCAL_IDB_BACKEND_ID) {
|
|
4060
|
-
|
|
4152
|
+
log3.log(`[createConfigRepo] Skipping local backend ${desc.id} during migration`);
|
|
4061
4153
|
continue;
|
|
4062
4154
|
}
|
|
4063
4155
|
await tempRepo.writeBackendDescriptor(desc);
|
|
@@ -4075,7 +4167,7 @@ async function createConfigRepo(appId, options = {}) {
|
|
|
4075
4167
|
}
|
|
4076
4168
|
}
|
|
4077
4169
|
}
|
|
4078
|
-
|
|
4170
|
+
log3.log(`[createConfigRepo] Migration complete`);
|
|
4079
4171
|
}
|
|
4080
4172
|
let allBackends = await tempRepo.readAllBackendDescriptors();
|
|
4081
4173
|
if (options.backendInfo) {
|
|
@@ -4093,19 +4185,19 @@ async function createConfigRepo(appId, options = {}) {
|
|
|
4093
4185
|
type: options.backendInfo.type,
|
|
4094
4186
|
options: options.backendInfo.options
|
|
4095
4187
|
});
|
|
4096
|
-
|
|
4188
|
+
log3.log(`[createConfigRepo] Added replica backend: ${replicaId} (${options.backendInfo.type})`);
|
|
4097
4189
|
allBackends = [...allBackends, { id: replicaId, type: options.backendInfo.type, options: options.backendInfo.options }];
|
|
4098
4190
|
} else if (dupConfig) {
|
|
4099
|
-
|
|
4191
|
+
log3.log(`[createConfigRepo] Replica with same config already registered as "${dupConfig.id}", skipping`);
|
|
4100
4192
|
} else {
|
|
4101
|
-
|
|
4193
|
+
log3.log(`[createConfigRepo] Replica ${replicaId} already registered`);
|
|
4102
4194
|
}
|
|
4103
4195
|
}
|
|
4104
|
-
|
|
4196
|
+
log3.log(`[createConfigRepo] Replica backends: ${allBackends.map((b) => b.id).join(", ") || "(none)"}`);
|
|
4105
4197
|
let nodeId = options.nodeId;
|
|
4106
4198
|
if (!nodeId) {
|
|
4107
4199
|
nodeId = `node-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
|
|
4108
|
-
|
|
4200
|
+
log3.log(`[createConfigRepo] Generated nodeId: ${nodeId}`);
|
|
4109
4201
|
}
|
|
4110
4202
|
const serializer = createSerializerChain(options.serializer);
|
|
4111
4203
|
const repo = new ConfigRepo(
|
|
@@ -4128,29 +4220,29 @@ async function createConfigRepo(appId, options = {}) {
|
|
|
4128
4220
|
try {
|
|
4129
4221
|
const mig = await repo.migrateLegacyVersionSidecars();
|
|
4130
4222
|
if (mig.renamed.length === 0 && mig.deleted.length === 0 && mig.remoteDeleted.length === 0) {
|
|
4131
|
-
|
|
4223
|
+
log3.log("[createConfigRepo] no legacy version sidecars to migrate");
|
|
4132
4224
|
}
|
|
4133
4225
|
} catch (err) {
|
|
4134
|
-
|
|
4226
|
+
log3.warn(`[createConfigRepo] version sidecar migration failed:`, err?.message ?? err);
|
|
4135
4227
|
}
|
|
4136
4228
|
}
|
|
4137
4229
|
await repo.load();
|
|
4138
4230
|
if (repo.replicaCount > 0) {
|
|
4139
|
-
|
|
4231
|
+
log3.log("[createConfigRepo] Starting background initial sync + dedup...");
|
|
4140
4232
|
repo.startBackgroundSync();
|
|
4141
4233
|
}
|
|
4142
4234
|
repo.syncMetaToReplicas().catch((err) => {
|
|
4143
|
-
|
|
4235
|
+
log3.error("[createConfigRepo] background syncMetaToReplicas failed:", err);
|
|
4144
4236
|
});
|
|
4145
4237
|
return repo;
|
|
4146
4238
|
}
|
|
4147
4239
|
|
|
4148
4240
|
// src/connect.ts
|
|
4149
|
-
var
|
|
4241
|
+
var log4 = createLogger("connect");
|
|
4150
4242
|
var GROUP_TYPE_FILE2 = "/.config/group-type";
|
|
4151
4243
|
var LEGACY_GROUP_TYPE_FILE2 = "/.meta/group-type";
|
|
4152
4244
|
async function detectGroupType(type, options) {
|
|
4153
|
-
|
|
4245
|
+
log4(`detectGroupType: connecting to ${type}...`);
|
|
4154
4246
|
const tempBackend = await createBackend({ type, options });
|
|
4155
4247
|
try {
|
|
4156
4248
|
for (const path of [GROUP_TYPE_FILE2, LEGACY_GROUP_TYPE_FILE2]) {
|
|
@@ -4158,15 +4250,15 @@ async function detectGroupType(type, options) {
|
|
|
4158
4250
|
const raw = await tempBackend.readFile(path, "utf-8");
|
|
4159
4251
|
const groupType = raw.trim();
|
|
4160
4252
|
if (groupType === "config-sync" || groupType === "data-sync") {
|
|
4161
|
-
|
|
4253
|
+
log4(`detectGroupType: detected "${groupType}" at ${path}`);
|
|
4162
4254
|
return groupType;
|
|
4163
4255
|
}
|
|
4164
|
-
|
|
4256
|
+
log4(`detectGroupType: unknown group-type value "${groupType}" at ${path}, treating as null`);
|
|
4165
4257
|
return null;
|
|
4166
4258
|
} catch {
|
|
4167
4259
|
}
|
|
4168
4260
|
}
|
|
4169
|
-
|
|
4261
|
+
log4(`detectGroupType: no group-type file found (new backend)`);
|
|
4170
4262
|
return null;
|
|
4171
4263
|
} finally {
|
|
4172
4264
|
if (tempBackend?.dispose) {
|
|
@@ -4175,7 +4267,7 @@ async function detectGroupType(type, options) {
|
|
|
4175
4267
|
}
|
|
4176
4268
|
}
|
|
4177
4269
|
async function connect(appId, options = {}) {
|
|
4178
|
-
|
|
4270
|
+
log4(`connect: appId=${appId}`);
|
|
4179
4271
|
if (!options.backendInfo) {
|
|
4180
4272
|
const repo2 = await createConfigRepo(appId, {
|
|
4181
4273
|
idbStoreName: options.idbStoreName,
|
|
@@ -4193,7 +4285,7 @@ async function connect(appId, options = {}) {
|
|
|
4193
4285
|
try {
|
|
4194
4286
|
appDataGroups2.push(await repo2.getAppDataGroup(d.id));
|
|
4195
4287
|
} catch (err) {
|
|
4196
|
-
|
|
4288
|
+
log4(`connect: failed to load app data group "${d.id}":`, err);
|
|
4197
4289
|
}
|
|
4198
4290
|
}
|
|
4199
4291
|
let dataGroup2 = appDataGroups2[0];
|
|
@@ -4222,7 +4314,7 @@ async function connect(appId, options = {}) {
|
|
|
4222
4314
|
groupType = detectedType;
|
|
4223
4315
|
} else {
|
|
4224
4316
|
groupType = options.groupType ?? "config-sync";
|
|
4225
|
-
|
|
4317
|
+
log4(`connect: new backend, using groupType="${groupType}"`);
|
|
4226
4318
|
}
|
|
4227
4319
|
const repo = await createConfigRepo(
|
|
4228
4320
|
appId,
|
|
@@ -4251,7 +4343,7 @@ async function connect(appId, options = {}) {
|
|
|
4251
4343
|
try {
|
|
4252
4344
|
appDataGroups.push(await repo.getAppDataGroup(d.id));
|
|
4253
4345
|
} catch (err) {
|
|
4254
|
-
|
|
4346
|
+
log4(`connect: failed to load app data group "${d.id}":`, err);
|
|
4255
4347
|
}
|
|
4256
4348
|
}
|
|
4257
4349
|
let dataGroup = appDataGroups[0];
|