zen-fs-config 0.4.1 → 0.4.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 +1 -15
- package/dist/index.mjs +1 -15
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -485,7 +485,6 @@ var BACKENDS_DIR = `${META_DIR}/backends`;
|
|
|
485
485
|
var CONFLICTS_DIR = `${META_DIR}/.conflicts`;
|
|
486
486
|
var DELETIONS_DIR = `${META_DIR}/.deleted`;
|
|
487
487
|
var NODES_DIR = "/nodes";
|
|
488
|
-
var NODE_ID_FILE = `${NODES_DIR}/.node-id`;
|
|
489
488
|
var LOCAL_IDB_BACKEND_ID = "local-idb";
|
|
490
489
|
function tombstoneFileName(filePath) {
|
|
491
490
|
return filePath.replace(/^\//, "").replace(/\//g, "__").replace(/\./g, "++") + ".json";
|
|
@@ -1319,22 +1318,9 @@ async function createConfigRepo(appId, options = {}) {
|
|
|
1319
1318
|
const allBackends = await tempRepo.readAllBackendDescriptors();
|
|
1320
1319
|
console.log(`[createConfigRepo] Replica backends: ${allBackends.map((b) => b.id).join(", ") || "(none)"}`);
|
|
1321
1320
|
let nodeId = options.nodeId;
|
|
1322
|
-
if (!nodeId && typeof process !== "undefined" && process.env?.NODE_ID) {
|
|
1323
|
-
nodeId = process.env.NODE_ID;
|
|
1324
|
-
}
|
|
1325
|
-
if (!nodeId) {
|
|
1326
|
-
try {
|
|
1327
|
-
const raw = await cachedFS.readFile(NODE_ID_FILE);
|
|
1328
|
-
nodeId = new TextDecoder().decode(toUint8Array(raw)).trim();
|
|
1329
|
-
} catch {
|
|
1330
|
-
}
|
|
1331
|
-
}
|
|
1332
1321
|
if (!nodeId) {
|
|
1333
1322
|
nodeId = `node-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
|
|
1334
|
-
|
|
1335
|
-
await cachedFS.writeFile(NODE_ID_FILE, new TextEncoder().encode(nodeId));
|
|
1336
|
-
} catch {
|
|
1337
|
-
}
|
|
1323
|
+
console.log(`[createConfigRepo] Generated nodeId: ${nodeId}`);
|
|
1338
1324
|
}
|
|
1339
1325
|
const serializer = createSerializerChain(options.serializer);
|
|
1340
1326
|
const repo = new ConfigRepo(
|
package/dist/index.mjs
CHANGED
|
@@ -433,7 +433,6 @@ var BACKENDS_DIR = `${META_DIR}/backends`;
|
|
|
433
433
|
var CONFLICTS_DIR = `${META_DIR}/.conflicts`;
|
|
434
434
|
var DELETIONS_DIR = `${META_DIR}/.deleted`;
|
|
435
435
|
var NODES_DIR = "/nodes";
|
|
436
|
-
var NODE_ID_FILE = `${NODES_DIR}/.node-id`;
|
|
437
436
|
var LOCAL_IDB_BACKEND_ID = "local-idb";
|
|
438
437
|
function tombstoneFileName(filePath) {
|
|
439
438
|
return filePath.replace(/^\//, "").replace(/\//g, "__").replace(/\./g, "++") + ".json";
|
|
@@ -1267,22 +1266,9 @@ async function createConfigRepo(appId, options = {}) {
|
|
|
1267
1266
|
const allBackends = await tempRepo.readAllBackendDescriptors();
|
|
1268
1267
|
console.log(`[createConfigRepo] Replica backends: ${allBackends.map((b) => b.id).join(", ") || "(none)"}`);
|
|
1269
1268
|
let nodeId = options.nodeId;
|
|
1270
|
-
if (!nodeId && typeof process !== "undefined" && process.env?.NODE_ID) {
|
|
1271
|
-
nodeId = process.env.NODE_ID;
|
|
1272
|
-
}
|
|
1273
|
-
if (!nodeId) {
|
|
1274
|
-
try {
|
|
1275
|
-
const raw = await cachedFS.readFile(NODE_ID_FILE);
|
|
1276
|
-
nodeId = new TextDecoder().decode(toUint8Array(raw)).trim();
|
|
1277
|
-
} catch {
|
|
1278
|
-
}
|
|
1279
|
-
}
|
|
1280
1269
|
if (!nodeId) {
|
|
1281
1270
|
nodeId = `node-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
|
|
1282
|
-
|
|
1283
|
-
await cachedFS.writeFile(NODE_ID_FILE, new TextEncoder().encode(nodeId));
|
|
1284
|
-
} catch {
|
|
1285
|
-
}
|
|
1271
|
+
console.log(`[createConfigRepo] Generated nodeId: ${nodeId}`);
|
|
1286
1272
|
}
|
|
1287
1273
|
const serializer = createSerializerChain(options.serializer);
|
|
1288
1274
|
const repo = new ConfigRepo(
|