@nmakarov/cli-toolkit 0.63.0 → 0.66.0
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/cli-runner.cjs +28 -14
- package/dist/cli-runner.cjs.map +1 -1
- package/dist/cli-runner.js +28 -14
- package/dist/cli-runner.js.map +1 -1
- package/dist/filedatabase.cjs +28 -14
- package/dist/filedatabase.cjs.map +1 -1
- package/dist/filedatabase.js +28 -14
- package/dist/filedatabase.js.map +1 -1
- package/dist/http-client2.cjs +28 -14
- package/dist/http-client2.cjs.map +1 -1
- package/dist/http-client2.js +28 -14
- package/dist/http-client2.js.map +1 -1
- package/dist/index.cjs +28 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +28 -14
- package/dist/index.js.map +1 -1
- package/dist/mock-server.cjs +28 -14
- package/dist/mock-server.cjs.map +1 -1
- package/dist/mock-server.js +28 -14
- package/dist/mock-server.js.map +1 -1
- package/dist/tasks.cjs +28 -14
- package/dist/tasks.cjs.map +1 -1
- package/dist/tasks.js +28 -14
- package/dist/tasks.js.map +1 -1
- package/package.json +1 -1
package/dist/http-client2.cjs
CHANGED
|
@@ -377,8 +377,13 @@ var FileDatabase = class _FileDatabase {
|
|
|
377
377
|
this.currentVersionFolder = await ensurePath(this.getDestinationPath(), version);
|
|
378
378
|
}
|
|
379
379
|
/**
|
|
380
|
-
* Create a new version folder with
|
|
381
|
-
* Only works in versioned mode
|
|
380
|
+
* Create a new version folder named with the current UTC second.
|
|
381
|
+
* Only works in versioned mode.
|
|
382
|
+
*
|
|
383
|
+
* Clash protection: if that name already exists (two writers in the same
|
|
384
|
+
* second, or wall clock behind the latest version), advance +1s until free.
|
|
385
|
+
* Do NOT always derive from max(existing)+1s — that made successive harvests
|
|
386
|
+
* hours apart still land one second apart on disk.
|
|
382
387
|
*/
|
|
383
388
|
async makeNewVersion() {
|
|
384
389
|
if (!this.versioned) {
|
|
@@ -386,19 +391,22 @@ var FileDatabase = class _FileDatabase {
|
|
|
386
391
|
}
|
|
387
392
|
this.metadata = this.getDefaultMetadata();
|
|
388
393
|
const existingVersions = await this.getVersions();
|
|
389
|
-
|
|
394
|
+
const existingSet = new Set(existingVersions);
|
|
395
|
+
let candidateMs = Date.now();
|
|
390
396
|
if (existingVersions.length > 0) {
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
const
|
|
394
|
-
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
|
|
397
|
+
let maxMs = 0;
|
|
398
|
+
for (const version of existingVersions) {
|
|
399
|
+
const ms = new Date(version).getTime();
|
|
400
|
+
if (Number.isFinite(ms) && ms > maxMs) maxMs = ms;
|
|
401
|
+
}
|
|
402
|
+
if (candidateMs <= maxMs) {
|
|
403
|
+
candidateMs = maxMs + 1e3;
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
let versionName = new Date(candidateMs).toISOString().split(".")[0] + "Z";
|
|
407
|
+
while (existingSet.has(versionName)) {
|
|
408
|
+
candidateMs += 1e3;
|
|
409
|
+
versionName = new Date(candidateMs).toISOString().split(".")[0] + "Z";
|
|
402
410
|
}
|
|
403
411
|
await this.setCurrentVersion(versionName);
|
|
404
412
|
this.currentFileNumber = 0;
|
|
@@ -1210,6 +1218,12 @@ var FileDatabase = class _FileDatabase {
|
|
|
1210
1218
|
getCurrentVersion() {
|
|
1211
1219
|
return this.currentVersion;
|
|
1212
1220
|
}
|
|
1221
|
+
/**
|
|
1222
|
+
* Max retained version folders (used by harvest_sync.loaded_versions cap, etc.).
|
|
1223
|
+
*/
|
|
1224
|
+
getMaxVersions() {
|
|
1225
|
+
return this.maxVersions;
|
|
1226
|
+
}
|
|
1213
1227
|
/**
|
|
1214
1228
|
* Get current metadata
|
|
1215
1229
|
*/
|