@astrojs/db 0.9.7 → 0.9.9
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/_internal/core/schemas.d.ts +201 -23
- package/dist/_internal/core/types.d.ts +10 -4
- package/dist/_internal/core/utils.d.ts +20 -0
- package/dist/core/cli/commands/execute/index.js +1 -1
- package/dist/core/cli/migration-queries.d.ts +3 -3
- package/dist/core/cli/print-help.js +1 -1
- package/dist/core/integration/index.js +44 -11
- package/dist/core/integration/vite-plugin-db.d.ts +4 -0
- package/dist/core/integration/vite-plugin-db.js +3 -3
- package/dist/core/integration/vite-plugin-inject-env-ts.js +1 -1
- package/dist/core/load-file.d.ts +4 -4
- package/dist/core/schemas.d.ts +201 -23
- package/dist/core/schemas.js +40 -5
- package/dist/core/types.d.ts +10 -4
- package/dist/core/utils.d.ts +5 -0
- package/dist/core/utils.js +7 -1
- package/dist/runtime/db-client.js +34 -20
- package/dist/runtime/errors.d.ts +0 -1
- package/dist/runtime/errors.js +2 -8
- package/dist/runtime/index.d.ts +1 -0
- package/dist/runtime/index.js +12 -0
- package/dist/runtime/seed-local.js +5 -3
- package/dist/utils.d.ts +4 -0
- package/dist/utils.js +5 -0
- package/package.json +2 -2
|
@@ -2,7 +2,8 @@ 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 {
|
|
5
|
+
import { AstroDbError } from "../utils.js";
|
|
6
|
+
import { SEED_DEFAULT_EXPORT_ERROR } from "./errors.js";
|
|
6
7
|
import { getCreateIndexQueries, getCreateTableQuery } from "./queries.js";
|
|
7
8
|
const sqlite = new SQLiteAsyncDialect();
|
|
8
9
|
async function seedLocal({
|
|
@@ -18,7 +19,7 @@ async function seedLocal({
|
|
|
18
19
|
if (seedFilePath) {
|
|
19
20
|
const mod = userSeedGlob[seedFilePath];
|
|
20
21
|
if (!mod.default)
|
|
21
|
-
throw new
|
|
22
|
+
throw new AstroDbError(SEED_DEFAULT_EXPORT_ERROR(seedFilePath));
|
|
22
23
|
seedFunctions.push(mod.default);
|
|
23
24
|
}
|
|
24
25
|
for (const seedFn of integrationSeedFunctions) {
|
|
@@ -29,7 +30,8 @@ async function seedLocal({
|
|
|
29
30
|
await seed();
|
|
30
31
|
} catch (e) {
|
|
31
32
|
if (e instanceof LibsqlError) {
|
|
32
|
-
throw new
|
|
33
|
+
throw new AstroDbError(`Failed to seed database:
|
|
34
|
+
${e.message}`);
|
|
33
35
|
}
|
|
34
36
|
throw e;
|
|
35
37
|
}
|
package/dist/utils.d.ts
CHANGED
package/dist/utils.js
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
|
+
import { AstroError } from "astro/errors";
|
|
1
2
|
import { defineDbIntegration } from "./core/utils.js";
|
|
2
3
|
import { asDrizzleTable } from "./runtime/index.js";
|
|
4
|
+
class AstroDbError extends AstroError {
|
|
5
|
+
name = "Astro DB Error";
|
|
6
|
+
}
|
|
3
7
|
export {
|
|
8
|
+
AstroDbError,
|
|
4
9
|
asDrizzleTable,
|
|
5
10
|
defineDbIntegration
|
|
6
11
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astrojs/db",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.9",
|
|
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.13",
|
|
85
85
|
"astro-scripts": "0.0.14"
|
|
86
86
|
},
|
|
87
87
|
"scripts": {
|