- Migrated all pages from Next.js to Astro - Added PDPA-compliant Privacy Policy (Thai) - Added PDPA-compliant Terms & Conditions (Thai) - Added Cookie Policy with disclosure (Thai) - Implemented cookie consent banner (client-side) - Integrated Umami Analytics placeholder - Blog system with 3 posts - Optimized Docker configuration for production - Static site build (184KB, 11 pages) - Ready for Easypanel deployment Backup: /Users/kunthawatgreethong/Gitea/dealplustech-backup-nextjs-20260309.tar.gz
36 lines
910 B
JavaScript
36 lines
910 B
JavaScript
import { LibsqlError } from "@libsql/client";
|
|
import { AstroError } from "astro/errors";
|
|
function hasPrimaryKey(column) {
|
|
return "primaryKey" in column.schema && !!column.schema.primaryKey;
|
|
}
|
|
const isWindows = process?.platform === "win32";
|
|
class AstroDbError extends AstroError {
|
|
name = "Astro DB Error";
|
|
}
|
|
function isDbError(err) {
|
|
return err instanceof LibsqlError || err instanceof Error && err.libsqlError === true;
|
|
}
|
|
function slash(path) {
|
|
const isExtendedLengthPath = path.startsWith("\\\\?\\");
|
|
if (isExtendedLengthPath) {
|
|
return path;
|
|
}
|
|
return path.replace(/\\/g, "/");
|
|
}
|
|
function pathToFileURL(path) {
|
|
if (isWindows) {
|
|
let slashed = slash(path);
|
|
if (!slashed.startsWith("/")) {
|
|
slashed = "/" + slashed;
|
|
}
|
|
return new URL("file://" + slashed);
|
|
}
|
|
return new URL("file://" + path);
|
|
}
|
|
export {
|
|
AstroDbError,
|
|
hasPrimaryKey,
|
|
isDbError,
|
|
pathToFileURL
|
|
};
|