@astrojs/db 0.9.9 → 0.9.10
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/core/cli/print-help.js +1 -1
- package/dist/core/integration/index.js +1 -1
- package/dist/runtime/db-client.js +1 -2
- package/dist/runtime/seed-local.js +1 -1
- package/dist/runtime/utils.d.ts +4 -0
- package/dist/runtime/utils.js +5 -0
- package/dist/utils.d.ts +0 -4
- package/dist/utils.js +0 -5
- package/package.json +1 -1
|
@@ -6,7 +6,7 @@ import { blue, yellow } from "kleur/colors";
|
|
|
6
6
|
import { loadEnv } from "vite";
|
|
7
7
|
import parseArgs from "yargs-parser";
|
|
8
8
|
import { SEED_DEV_FILE_NAME } from "../../runtime/queries.js";
|
|
9
|
-
import { AstroDbError } from "../../utils.js";
|
|
9
|
+
import { AstroDbError } from "../../runtime/utils.js";
|
|
10
10
|
import { CONFIG_FILE_NAMES, DB_PATH } from "../consts.js";
|
|
11
11
|
import { resolveDbConfig } from "../load-file.js";
|
|
12
12
|
import { getManagedAppTokenOrExit } from "../tokens.js";
|
|
@@ -2,8 +2,7 @@ import { createClient } from "@libsql/client";
|
|
|
2
2
|
import { drizzle as drizzleLibsql } from "drizzle-orm/libsql";
|
|
3
3
|
import { drizzle as drizzleProxy } from "drizzle-orm/sqlite-proxy";
|
|
4
4
|
import { z } from "zod";
|
|
5
|
-
import { AstroDbError } from "
|
|
6
|
-
import { safeFetch } from "./utils.js";
|
|
5
|
+
import { AstroDbError, safeFetch } from "./utils.js";
|
|
7
6
|
const isWebContainer = !!process.versions?.webcontainer;
|
|
8
7
|
function applyTransactionNotSupported(db) {
|
|
9
8
|
Object.assign(db, {
|
|
@@ -2,9 +2,9 @@ import { LibsqlError } from "@libsql/client";
|
|
|
2
2
|
import { sql } from "drizzle-orm";
|
|
3
3
|
import { SQLiteAsyncDialect } from "drizzle-orm/sqlite-core";
|
|
4
4
|
import {} from "../core/types.js";
|
|
5
|
-
import { AstroDbError } from "../utils.js";
|
|
6
5
|
import { SEED_DEFAULT_EXPORT_ERROR } from "./errors.js";
|
|
7
6
|
import { getCreateIndexQueries, getCreateTableQuery } from "./queries.js";
|
|
7
|
+
import { AstroDbError } from "./utils.js";
|
|
8
8
|
const sqlite = new SQLiteAsyncDialect();
|
|
9
9
|
async function seedLocal({
|
|
10
10
|
db,
|
package/dist/runtime/utils.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
+
import { AstroError } from 'astro/errors';
|
|
1
2
|
/**
|
|
2
3
|
* Small wrapper around fetch that throws an error if the response is not OK. Allows for custom error handling as well through the onNotOK callback.
|
|
3
4
|
*/
|
|
4
5
|
export declare function safeFetch(url: Parameters<typeof fetch>[0], options?: Parameters<typeof fetch>[1], onNotOK?: (response: Response) => void | Promise<void>): Promise<Response>;
|
|
6
|
+
export declare class AstroDbError extends AstroError {
|
|
7
|
+
name: string;
|
|
8
|
+
}
|
package/dist/runtime/utils.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AstroError } from "astro/errors";
|
|
1
2
|
async function safeFetch(url, options = {}, onNotOK = () => {
|
|
2
3
|
throw new Error(`Request to ${url} returned a non-OK status code.`);
|
|
3
4
|
}) {
|
|
@@ -7,6 +8,10 @@ async function safeFetch(url, options = {}, onNotOK = () => {
|
|
|
7
8
|
}
|
|
8
9
|
return response;
|
|
9
10
|
}
|
|
11
|
+
class AstroDbError extends AstroError {
|
|
12
|
+
name = "Astro DB Error";
|
|
13
|
+
}
|
|
10
14
|
export {
|
|
15
|
+
AstroDbError,
|
|
11
16
|
safeFetch
|
|
12
17
|
};
|
package/dist/utils.d.ts
CHANGED
package/dist/utils.js
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
import { AstroError } from "astro/errors";
|
|
2
1
|
import { defineDbIntegration } from "./core/utils.js";
|
|
3
2
|
import { asDrizzleTable } from "./runtime/index.js";
|
|
4
|
-
class AstroDbError extends AstroError {
|
|
5
|
-
name = "Astro DB Error";
|
|
6
|
-
}
|
|
7
3
|
export {
|
|
8
|
-
AstroDbError,
|
|
9
4
|
asDrizzleTable,
|
|
10
5
|
defineDbIntegration
|
|
11
6
|
};
|