feat : Con more reaible

This commit is contained in:
2026-09-26 20:54:40 +07:00 Unverified
parent bfd9f1765d
commit 17c4f21948
11 changed files with 325 additions and 24 deletions
+13
View File
@@ -1,6 +1,7 @@
import * as z from "zod";
export const lunarisVersionSchema = z.string().regex(/^\d+(?:\.\d+)+$/u);
export const catalogFormatVersion = 2;
export interface LunarisVersionChange {
previousVersion: string;
@@ -31,3 +32,15 @@ export function compareLunarisVersions(left: string, right: string): number {
}
return 0;
}
export function catalogSnapshotIsCurrent(
requestedVersion: string,
currentVersion: string | null,
currentFormatVersion: number | null,
): boolean {
return Boolean(
currentVersion &&
compareLunarisVersions(requestedVersion, currentVersion) <= 0 &&
currentFormatVersion === catalogFormatVersion
);
}