@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.js
CHANGED
|
@@ -343,8 +343,13 @@ var FileDatabase = class _FileDatabase {
|
|
|
343
343
|
this.currentVersionFolder = await ensurePath(this.getDestinationPath(), version);
|
|
344
344
|
}
|
|
345
345
|
/**
|
|
346
|
-
* Create a new version folder with
|
|
347
|
-
* Only works in versioned mode
|
|
346
|
+
* Create a new version folder named with the current UTC second.
|
|
347
|
+
* Only works in versioned mode.
|
|
348
|
+
*
|
|
349
|
+
* Clash protection: if that name already exists (two writers in the same
|
|
350
|
+
* second, or wall clock behind the latest version), advance +1s until free.
|
|
351
|
+
* Do NOT always derive from max(existing)+1s — that made successive harvests
|
|
352
|
+
* hours apart still land one second apart on disk.
|
|
348
353
|
*/
|
|
349
354
|
async makeNewVersion() {
|
|
350
355
|
if (!this.versioned) {
|
|
@@ -352,19 +357,22 @@ var FileDatabase = class _FileDatabase {
|
|
|
352
357
|
}
|
|
353
358
|
this.metadata = this.getDefaultMetadata();
|
|
354
359
|
const existingVersions = await this.getVersions();
|
|
355
|
-
|
|
360
|
+
const existingSet = new Set(existingVersions);
|
|
361
|
+
let candidateMs = Date.now();
|
|
356
362
|
if (existingVersions.length > 0) {
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
const
|
|
360
|
-
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
|
|
363
|
+
let maxMs = 0;
|
|
364
|
+
for (const version of existingVersions) {
|
|
365
|
+
const ms = new Date(version).getTime();
|
|
366
|
+
if (Number.isFinite(ms) && ms > maxMs) maxMs = ms;
|
|
367
|
+
}
|
|
368
|
+
if (candidateMs <= maxMs) {
|
|
369
|
+
candidateMs = maxMs + 1e3;
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
let versionName = new Date(candidateMs).toISOString().split(".")[0] + "Z";
|
|
373
|
+
while (existingSet.has(versionName)) {
|
|
374
|
+
candidateMs += 1e3;
|
|
375
|
+
versionName = new Date(candidateMs).toISOString().split(".")[0] + "Z";
|
|
368
376
|
}
|
|
369
377
|
await this.setCurrentVersion(versionName);
|
|
370
378
|
this.currentFileNumber = 0;
|
|
@@ -1176,6 +1184,12 @@ var FileDatabase = class _FileDatabase {
|
|
|
1176
1184
|
getCurrentVersion() {
|
|
1177
1185
|
return this.currentVersion;
|
|
1178
1186
|
}
|
|
1187
|
+
/**
|
|
1188
|
+
* Max retained version folders (used by harvest_sync.loaded_versions cap, etc.).
|
|
1189
|
+
*/
|
|
1190
|
+
getMaxVersions() {
|
|
1191
|
+
return this.maxVersions;
|
|
1192
|
+
}
|
|
1179
1193
|
/**
|
|
1180
1194
|
* Get current metadata
|
|
1181
1195
|
*/
|