Spaces:
Running
Running
Added check for v3.0
Browse files
src/utils/versionUtils.ts
CHANGED
|
@@ -43,10 +43,15 @@ async function checkVersionExists(repoId: string, version: string): Promise<bool
|
|
| 43 |
|
| 44 |
/**
|
| 45 |
* Determines the best available version for a dataset.
|
| 46 |
-
* Prefers
|
| 47 |
*/
|
| 48 |
export async function getDatasetVersion(repoId: string): Promise<string> {
|
| 49 |
-
// Check for
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
if (await checkVersionExists(repoId, "v2.1")) {
|
| 51 |
return "v2.1";
|
| 52 |
}
|
|
@@ -56,10 +61,10 @@ export async function getDatasetVersion(repoId: string): Promise<string> {
|
|
| 56 |
return "v2.0";
|
| 57 |
}
|
| 58 |
|
| 59 |
-
// If
|
| 60 |
throw new Error(
|
| 61 |
`Dataset ${repoId} is not compatible with this visualizer. ` +
|
| 62 |
-
"This tool only works with dataset
|
| 63 |
"Please use a compatible dataset version."
|
| 64 |
);
|
| 65 |
}
|
|
|
|
| 43 |
|
| 44 |
/**
|
| 45 |
* Determines the best available version for a dataset.
|
| 46 |
+
* Prefers v3.0, falls back to v2.1, then v2.0, or throws an error if none exist.
|
| 47 |
*/
|
| 48 |
export async function getDatasetVersion(repoId: string): Promise<string> {
|
| 49 |
+
// Check for v3.0 first
|
| 50 |
+
if (await checkVersionExists(repoId, "v3.0")) {
|
| 51 |
+
return "v3.0";
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
// Check for v2.1
|
| 55 |
if (await checkVersionExists(repoId, "v2.1")) {
|
| 56 |
return "v2.1";
|
| 57 |
}
|
|
|
|
| 61 |
return "v2.0";
|
| 62 |
}
|
| 63 |
|
| 64 |
+
// If none of the supported versions exist, throw an error
|
| 65 |
throw new Error(
|
| 66 |
`Dataset ${repoId} is not compatible with this visualizer. ` +
|
| 67 |
+
"This tool only works with dataset versions 3.0, 2.1, or 2.0. " +
|
| 68 |
"Please use a compatible dataset version."
|
| 69 |
);
|
| 70 |
}
|