@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/cli-runner.js
CHANGED
|
@@ -4478,8 +4478,13 @@ var FileDatabase = class _FileDatabase {
|
|
|
4478
4478
|
this.currentVersionFolder = await ensurePath(this.getDestinationPath(), version);
|
|
4479
4479
|
}
|
|
4480
4480
|
/**
|
|
4481
|
-
* Create a new version folder with
|
|
4482
|
-
* Only works in versioned mode
|
|
4481
|
+
* Create a new version folder named with the current UTC second.
|
|
4482
|
+
* Only works in versioned mode.
|
|
4483
|
+
*
|
|
4484
|
+
* Clash protection: if that name already exists (two writers in the same
|
|
4485
|
+
* second, or wall clock behind the latest version), advance +1s until free.
|
|
4486
|
+
* Do NOT always derive from max(existing)+1s — that made successive harvests
|
|
4487
|
+
* hours apart still land one second apart on disk.
|
|
4483
4488
|
*/
|
|
4484
4489
|
async makeNewVersion() {
|
|
4485
4490
|
if (!this.versioned) {
|
|
@@ -4487,19 +4492,22 @@ var FileDatabase = class _FileDatabase {
|
|
|
4487
4492
|
}
|
|
4488
4493
|
this.metadata = this.getDefaultMetadata();
|
|
4489
4494
|
const existingVersions = await this.getVersions();
|
|
4490
|
-
|
|
4495
|
+
const existingSet = new Set(existingVersions);
|
|
4496
|
+
let candidateMs = Date.now();
|
|
4491
4497
|
if (existingVersions.length > 0) {
|
|
4492
|
-
|
|
4493
|
-
|
|
4494
|
-
const
|
|
4495
|
-
|
|
4496
|
-
}
|
|
4497
|
-
|
|
4498
|
-
|
|
4499
|
-
|
|
4500
|
-
}
|
|
4501
|
-
|
|
4502
|
-
|
|
4498
|
+
let maxMs = 0;
|
|
4499
|
+
for (const version of existingVersions) {
|
|
4500
|
+
const ms = new Date(version).getTime();
|
|
4501
|
+
if (Number.isFinite(ms) && ms > maxMs) maxMs = ms;
|
|
4502
|
+
}
|
|
4503
|
+
if (candidateMs <= maxMs) {
|
|
4504
|
+
candidateMs = maxMs + 1e3;
|
|
4505
|
+
}
|
|
4506
|
+
}
|
|
4507
|
+
let versionName = new Date(candidateMs).toISOString().split(".")[0] + "Z";
|
|
4508
|
+
while (existingSet.has(versionName)) {
|
|
4509
|
+
candidateMs += 1e3;
|
|
4510
|
+
versionName = new Date(candidateMs).toISOString().split(".")[0] + "Z";
|
|
4503
4511
|
}
|
|
4504
4512
|
await this.setCurrentVersion(versionName);
|
|
4505
4513
|
this.currentFileNumber = 0;
|
|
@@ -5311,6 +5319,12 @@ var FileDatabase = class _FileDatabase {
|
|
|
5311
5319
|
getCurrentVersion() {
|
|
5312
5320
|
return this.currentVersion;
|
|
5313
5321
|
}
|
|
5322
|
+
/**
|
|
5323
|
+
* Max retained version folders (used by harvest_sync.loaded_versions cap, etc.).
|
|
5324
|
+
*/
|
|
5325
|
+
getMaxVersions() {
|
|
5326
|
+
return this.maxVersions;
|
|
5327
|
+
}
|
|
5314
5328
|
/**
|
|
5315
5329
|
* Get current metadata
|
|
5316
5330
|
*/
|