@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/index.cjs
CHANGED
|
@@ -2643,8 +2643,13 @@ var FileDatabase = class _FileDatabase {
|
|
|
2643
2643
|
this.currentVersionFolder = await ensurePath(this.getDestinationPath(), version);
|
|
2644
2644
|
}
|
|
2645
2645
|
/**
|
|
2646
|
-
* Create a new version folder with
|
|
2647
|
-
* Only works in versioned mode
|
|
2646
|
+
* Create a new version folder named with the current UTC second.
|
|
2647
|
+
* Only works in versioned mode.
|
|
2648
|
+
*
|
|
2649
|
+
* Clash protection: if that name already exists (two writers in the same
|
|
2650
|
+
* second, or wall clock behind the latest version), advance +1s until free.
|
|
2651
|
+
* Do NOT always derive from max(existing)+1s — that made successive harvests
|
|
2652
|
+
* hours apart still land one second apart on disk.
|
|
2648
2653
|
*/
|
|
2649
2654
|
async makeNewVersion() {
|
|
2650
2655
|
if (!this.versioned) {
|
|
@@ -2652,19 +2657,22 @@ var FileDatabase = class _FileDatabase {
|
|
|
2652
2657
|
}
|
|
2653
2658
|
this.metadata = this.getDefaultMetadata();
|
|
2654
2659
|
const existingVersions = await this.getVersions();
|
|
2655
|
-
|
|
2660
|
+
const existingSet = new Set(existingVersions);
|
|
2661
|
+
let candidateMs = Date.now();
|
|
2656
2662
|
if (existingVersions.length > 0) {
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
const
|
|
2660
|
-
|
|
2661
|
-
}
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
}
|
|
2666
|
-
|
|
2667
|
-
|
|
2663
|
+
let maxMs = 0;
|
|
2664
|
+
for (const version of existingVersions) {
|
|
2665
|
+
const ms = new Date(version).getTime();
|
|
2666
|
+
if (Number.isFinite(ms) && ms > maxMs) maxMs = ms;
|
|
2667
|
+
}
|
|
2668
|
+
if (candidateMs <= maxMs) {
|
|
2669
|
+
candidateMs = maxMs + 1e3;
|
|
2670
|
+
}
|
|
2671
|
+
}
|
|
2672
|
+
let versionName = new Date(candidateMs).toISOString().split(".")[0] + "Z";
|
|
2673
|
+
while (existingSet.has(versionName)) {
|
|
2674
|
+
candidateMs += 1e3;
|
|
2675
|
+
versionName = new Date(candidateMs).toISOString().split(".")[0] + "Z";
|
|
2668
2676
|
}
|
|
2669
2677
|
await this.setCurrentVersion(versionName);
|
|
2670
2678
|
this.currentFileNumber = 0;
|
|
@@ -3476,6 +3484,12 @@ var FileDatabase = class _FileDatabase {
|
|
|
3476
3484
|
getCurrentVersion() {
|
|
3477
3485
|
return this.currentVersion;
|
|
3478
3486
|
}
|
|
3487
|
+
/**
|
|
3488
|
+
* Max retained version folders (used by harvest_sync.loaded_versions cap, etc.).
|
|
3489
|
+
*/
|
|
3490
|
+
getMaxVersions() {
|
|
3491
|
+
return this.maxVersions;
|
|
3492
|
+
}
|
|
3479
3493
|
/**
|
|
3480
3494
|
* Get current metadata
|
|
3481
3495
|
*/
|