@astrojs/db 0.10.0 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/runtime/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { pathToFileURL } from "url";
|
|
2
1
|
import { sql } from "drizzle-orm";
|
|
3
2
|
import {
|
|
4
3
|
customType,
|
|
@@ -9,6 +8,7 @@ import {
|
|
|
9
8
|
} from "drizzle-orm/sqlite-core";
|
|
10
9
|
import {} from "../core/types.js";
|
|
11
10
|
import { isSerializedSQL } from "./types.js";
|
|
11
|
+
import { pathToFileURL } from "./utils.js";
|
|
12
12
|
import { createRemoteDatabaseClient, createLocalDatabaseClient } from "./db-client.js";
|
|
13
13
|
import { seedLocal } from "./seed-local.js";
|
|
14
14
|
function hasPrimaryKey(column) {
|
package/dist/runtime/utils.d.ts
CHANGED
package/dist/runtime/utils.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AstroError } from "astro/errors";
|
|
2
|
+
const isWindows = process?.platform === "win32";
|
|
2
3
|
async function safeFetch(url, options = {}, onNotOK = () => {
|
|
3
4
|
throw new Error(`Request to ${url} returned a non-OK status code.`);
|
|
4
5
|
}) {
|
|
@@ -11,7 +12,26 @@ async function safeFetch(url, options = {}, onNotOK = () => {
|
|
|
11
12
|
class AstroDbError extends AstroError {
|
|
12
13
|
name = "Astro DB Error";
|
|
13
14
|
}
|
|
15
|
+
function slash(path) {
|
|
16
|
+
const isExtendedLengthPath = path.startsWith("\\\\?\\");
|
|
17
|
+
if (isExtendedLengthPath) {
|
|
18
|
+
return path;
|
|
19
|
+
}
|
|
20
|
+
return path.replace(/\\/g, "/");
|
|
21
|
+
}
|
|
22
|
+
function pathToFileURL(path) {
|
|
23
|
+
if (isWindows) {
|
|
24
|
+
let slashed = slash(path);
|
|
25
|
+
if (!slashed.startsWith("/")) {
|
|
26
|
+
slashed = "/" + slashed;
|
|
27
|
+
}
|
|
28
|
+
return new URL("file://" + slashed);
|
|
29
|
+
}
|
|
30
|
+
return new URL("file://" + path);
|
|
31
|
+
}
|
|
14
32
|
export {
|
|
15
33
|
AstroDbError,
|
|
34
|
+
slash as default,
|
|
35
|
+
pathToFileURL,
|
|
16
36
|
safeFetch
|
|
17
37
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astrojs/db",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"mocha": "^10.2.0",
|
|
82
82
|
"typescript": "^5.2.2",
|
|
83
83
|
"vite": "^5.1.4",
|
|
84
|
-
"astro": "4.5.
|
|
84
|
+
"astro": "4.5.16",
|
|
85
85
|
"astro-scripts": "0.0.14"
|
|
86
86
|
},
|
|
87
87
|
"scripts": {
|