Files
dealplustech/dealplustech-astro/node_modules/@astrojs/db/dist/runtime/utils.js
Kunthawat Greethong 6402d885f9 Complete Astro migration - PDPA compliant website
- 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
2026-03-09 18:28:01 +07:00

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
};