@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.js
CHANGED
|
@@ -2452,8 +2452,13 @@ var FileDatabase = class _FileDatabase {
|
|
|
2452
2452
|
this.currentVersionFolder = await ensurePath(this.getDestinationPath(), version);
|
|
2453
2453
|
}
|
|
2454
2454
|
/**
|
|
2455
|
-
* Create a new version folder with
|
|
2456
|
-
* Only works in versioned mode
|
|
2455
|
+
* Create a new version folder named with the current UTC second.
|
|
2456
|
+
* Only works in versioned mode.
|
|
2457
|
+
*
|
|
2458
|
+
* Clash protection: if that name already exists (two writers in the same
|
|
2459
|
+
* second, or wall clock behind the latest version), advance +1s until free.
|
|
2460
|
+
* Do NOT always derive from max(existing)+1s — that made successive harvests
|
|
2461
|
+
* hours apart still land one second apart on disk.
|
|
2457
2462
|
*/
|
|
2458
2463
|
async makeNewVersion() {
|
|
2459
2464
|
if (!this.versioned) {
|
|
@@ -2461,19 +2466,22 @@ var FileDatabase = class _FileDatabase {
|
|
|
2461
2466
|
}
|
|
2462
2467
|
this.metadata = this.getDefaultMetadata();
|
|
2463
2468
|
const existingVersions = await this.getVersions();
|
|
2464
|
-
|
|
2469
|
+
const existingSet = new Set(existingVersions);
|
|
2470
|
+
let candidateMs = Date.now();
|
|
2465
2471
|
if (existingVersions.length > 0) {
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
const
|
|
2469
|
-
|
|
2470
|
-
}
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
}
|
|
2475
|
-
|
|
2476
|
-
|
|
2472
|
+
let maxMs = 0;
|
|
2473
|
+
for (const version of existingVersions) {
|
|
2474
|
+
const ms = new Date(version).getTime();
|
|
2475
|
+
if (Number.isFinite(ms) && ms > maxMs) maxMs = ms;
|
|
2476
|
+
}
|
|
2477
|
+
if (candidateMs <= maxMs) {
|
|
2478
|
+
candidateMs = maxMs + 1e3;
|
|
2479
|
+
}
|
|
2480
|
+
}
|
|
2481
|
+
let versionName = new Date(candidateMs).toISOString().split(".")[0] + "Z";
|
|
2482
|
+
while (existingSet.has(versionName)) {
|
|
2483
|
+
candidateMs += 1e3;
|
|
2484
|
+
versionName = new Date(candidateMs).toISOString().split(".")[0] + "Z";
|
|
2477
2485
|
}
|
|
2478
2486
|
await this.setCurrentVersion(versionName);
|
|
2479
2487
|
this.currentFileNumber = 0;
|
|
@@ -3285,6 +3293,12 @@ var FileDatabase = class _FileDatabase {
|
|
|
3285
3293
|
getCurrentVersion() {
|
|
3286
3294
|
return this.currentVersion;
|
|
3287
3295
|
}
|
|
3296
|
+
/**
|
|
3297
|
+
* Max retained version folders (used by harvest_sync.loaded_versions cap, etc.).
|
|
3298
|
+
*/
|
|
3299
|
+
getMaxVersions() {
|
|
3300
|
+
return this.maxVersions;
|
|
3301
|
+
}
|
|
3288
3302
|
/**
|
|
3289
3303
|
* Get current metadata
|
|
3290
3304
|
*/
|