feat(duckdb): move support to standalone driver

This commit is contained in:
t8y2 committed 2026-07-30 00:50:39 +08:00
1 parent ed018dbc77
commit d347c77c3d
76 files changed
+5400 -8258

No files matched your search

@@ -2,15 +2,16 @@ import { describe, expect, it } from "vitest";
import { isOfflineDriverPackage, webDriverImportAccept } from "./driverImportSelection";
describe("driver import selection", () => {
it("recognizes ZIP paths and uploaded files case-insensitively", () => {
it("recognizes ZIP and tar.zst packages case-insensitively", () => {
expect(isOfflineDriverPackage("C:\\Downloads\\dbx-agent-h2-0.2.5.ZIP")).toBe(true);
expect(isOfflineDriverPackage({ name: "dbx-agent-kingbase-0.1.34-macos-aarch64.zip" })).toBe(true);
expect(isOfflineDriverPackage({ name: "dbx-agent-duckdb-0.1.0-macos-aarch64.TAR.ZST" })).toBe(true);
expect(isOfflineDriverPackage({ name: "dbx-agent-h2-0.2.5.jar" })).toBe(false);
});
it("allows ZIP alongside the platform raw artifact", () => {
expect(webDriverImportAccept(true, false)).toBe(".zip,.jar");
expect(webDriverImportAccept(false, true)).toBe(".zip,.exe");
expect(webDriverImportAccept(true, false)).toBe(".zip,.tar.zst,.jar");
expect(webDriverImportAccept(false, true)).toBe(".zip,.tar.zst,.exe");
expect(webDriverImportAccept(false, false)).toBe("");
});
});
@@ -2,10 +2,11 @@ export type DriverImportSelection = string | { name: string };
export function isOfflineDriverPackage(selection: DriverImportSelection): boolean {
const name = typeof selection === "string" ? selection : selection.name;
return name.toLowerCase().endsWith(".zip");
const lowerName = name.toLowerCase();
return lowerName.endsWith(".zip") || lowerName.endsWith(".tar.zst");
}
export function webDriverImportAccept(requiresJavaRuntime: boolean, isWindows: boolean): string {
if (requiresJavaRuntime) return ".zip,.jar";
return isWindows ? ".zip,.exe" : "";
if (requiresJavaRuntime) return ".zip,.tar.zst,.jar";
return isWindows ? ".zip,.tar.zst,.exe" : "";
}