@nmakarov/cli-toolkit 0.63.0 → 0.65.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 +22 -14
- package/dist/cli-runner.cjs.map +1 -1
- package/dist/cli-runner.js +22 -14
- package/dist/cli-runner.js.map +1 -1
- package/dist/filedatabase.cjs +22 -14
- package/dist/filedatabase.cjs.map +1 -1
- package/dist/filedatabase.js +22 -14
- package/dist/filedatabase.js.map +1 -1
- package/dist/http-client2.cjs +22 -14
- package/dist/http-client2.cjs.map +1 -1
- package/dist/http-client2.js +22 -14
- package/dist/http-client2.js.map +1 -1
- package/dist/index.cjs +22 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +22 -14
- package/dist/index.js.map +1 -1
- package/dist/mock-server.cjs +22 -14
- package/dist/mock-server.cjs.map +1 -1
- package/dist/mock-server.js +22 -14
- package/dist/mock-server.js.map +1 -1
- package/dist/tasks.cjs +22 -14
- package/dist/tasks.cjs.map +1 -1
- package/dist/tasks.js +22 -14
- package/dist/tasks.js.map +1 -1
- package/package.json +1 -1
package/dist/cli-runner.cjs
CHANGED
|
@@ -4494,8 +4494,13 @@ var FileDatabase = class _FileDatabase {
|
|
|
4494
4494
|
this.currentVersionFolder = await ensurePath(this.getDestinationPath(), version);
|
|
4495
4495
|
}
|
|
4496
4496
|
/**
|
|
4497
|
-
* Create a new version folder with
|
|
4498
|
-
* Only works in versioned mode
|
|
4497
|
+
* Create a new version folder named with the current UTC second.
|
|
4498
|
+
* Only works in versioned mode.
|
|
4499
|
+
*
|
|
4500
|
+
* Clash protection: if that name already exists (two writers in the same
|
|
4501
|
+
* second, or wall clock behind the latest version), advance +1s until free.
|
|
4502
|
+
* Do NOT always derive from max(existing)+1s — that made successive harvests
|
|
4503
|
+
* hours apart still land one second apart on disk.
|
|
4499
4504
|
*/
|
|
4500
4505
|
async makeNewVersion() {
|
|
4501
4506
|
if (!this.versioned) {
|
|
@@ -4503,19 +4508,22 @@ var FileDatabase = class _FileDatabase {
|
|
|
4503
4508
|
}
|
|
4504
4509
|
this.metadata = this.getDefaultMetadata();
|
|
4505
4510
|
const existingVersions = await this.getVersions();
|
|
4506
|
-
|
|
4511
|
+
const existingSet = new Set(existingVersions);
|
|
4512
|
+
let candidateMs = Date.now();
|
|
4507
4513
|
if (existingVersions.length > 0) {
|
|
4508
|
-
|
|
4509
|
-
|
|
4510
|
-
const
|
|
4511
|
-
|
|
4512
|
-
}
|
|
4513
|
-
|
|
4514
|
-
|
|
4515
|
-
|
|
4516
|
-
}
|
|
4517
|
-
|
|
4518
|
-
|
|
4514
|
+
let maxMs = 0;
|
|
4515
|
+
for (const version of existingVersions) {
|
|
4516
|
+
const ms = new Date(version).getTime();
|
|
4517
|
+
if (Number.isFinite(ms) && ms > maxMs) maxMs = ms;
|
|
4518
|
+
}
|
|
4519
|
+
if (candidateMs <= maxMs) {
|
|
4520
|
+
candidateMs = maxMs + 1e3;
|
|
4521
|
+
}
|
|
4522
|
+
}
|
|
4523
|
+
let versionName = new Date(candidateMs).toISOString().split(".")[0] + "Z";
|
|
4524
|
+
while (existingSet.has(versionName)) {
|
|
4525
|
+
candidateMs += 1e3;
|
|
4526
|
+
versionName = new Date(candidateMs).toISOString().split(".")[0] + "Z";
|
|
4519
4527
|
}
|
|
4520
4528
|
await this.setCurrentVersion(versionName);
|
|
4521
4529
|
this.currentFileNumber = 0;
|