@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/tasks.js
CHANGED
|
@@ -904,8 +904,13 @@ var FileDatabase = class _FileDatabase {
|
|
|
904
904
|
this.currentVersionFolder = await ensurePath(this.getDestinationPath(), version);
|
|
905
905
|
}
|
|
906
906
|
/**
|
|
907
|
-
* Create a new version folder with
|
|
908
|
-
* Only works in versioned mode
|
|
907
|
+
* Create a new version folder named with the current UTC second.
|
|
908
|
+
* Only works in versioned mode.
|
|
909
|
+
*
|
|
910
|
+
* Clash protection: if that name already exists (two writers in the same
|
|
911
|
+
* second, or wall clock behind the latest version), advance +1s until free.
|
|
912
|
+
* Do NOT always derive from max(existing)+1s — that made successive harvests
|
|
913
|
+
* hours apart still land one second apart on disk.
|
|
909
914
|
*/
|
|
910
915
|
async makeNewVersion() {
|
|
911
916
|
if (!this.versioned) {
|
|
@@ -913,19 +918,22 @@ var FileDatabase = class _FileDatabase {
|
|
|
913
918
|
}
|
|
914
919
|
this.metadata = this.getDefaultMetadata();
|
|
915
920
|
const existingVersions = await this.getVersions();
|
|
916
|
-
|
|
921
|
+
const existingSet = new Set(existingVersions);
|
|
922
|
+
let candidateMs = Date.now();
|
|
917
923
|
if (existingVersions.length > 0) {
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
const
|
|
921
|
-
|
|
922
|
-
}
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
}
|
|
927
|
-
|
|
928
|
-
|
|
924
|
+
let maxMs = 0;
|
|
925
|
+
for (const version of existingVersions) {
|
|
926
|
+
const ms = new Date(version).getTime();
|
|
927
|
+
if (Number.isFinite(ms) && ms > maxMs) maxMs = ms;
|
|
928
|
+
}
|
|
929
|
+
if (candidateMs <= maxMs) {
|
|
930
|
+
candidateMs = maxMs + 1e3;
|
|
931
|
+
}
|
|
932
|
+
}
|
|
933
|
+
let versionName = new Date(candidateMs).toISOString().split(".")[0] + "Z";
|
|
934
|
+
while (existingSet.has(versionName)) {
|
|
935
|
+
candidateMs += 1e3;
|
|
936
|
+
versionName = new Date(candidateMs).toISOString().split(".")[0] + "Z";
|
|
929
937
|
}
|
|
930
938
|
await this.setCurrentVersion(versionName);
|
|
931
939
|
this.currentFileNumber = 0;
|
|
@@ -1737,6 +1745,12 @@ var FileDatabase = class _FileDatabase {
|
|
|
1737
1745
|
getCurrentVersion() {
|
|
1738
1746
|
return this.currentVersion;
|
|
1739
1747
|
}
|
|
1748
|
+
/**
|
|
1749
|
+
* Max retained version folders (used by harvest_sync.loaded_versions cap, etc.).
|
|
1750
|
+
*/
|
|
1751
|
+
getMaxVersions() {
|
|
1752
|
+
return this.maxVersions;
|
|
1753
|
+
}
|
|
1740
1754
|
/**
|
|
1741
1755
|
* Get current metadata
|
|
1742
1756
|
*/
|