@astrojs/db 0.9.0 → 0.9.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.
@@ -1,6 +1,8 @@
1
+ import { LibsqlError } from '@libsql/client';
1
2
  import type { ColumnsConfig, DBConfigInput, TableConfig } from '../core/types.js';
2
3
  import type { LibSQLDatabase } from 'drizzle-orm/libsql';
3
4
  export type Database = Omit<LibSQLDatabase, 'transaction'>;
5
+ export declare function isDbError(err: unknown): err is LibsqlError;
4
6
  export declare const column: {
5
7
  number: <T extends ({
6
8
  name?: string | undefined;
@@ -27,7 +27,7 @@ function printHelp({
27
27
  message.push(
28
28
  linebreak(),
29
29
  ` ${bgGreen(black(` ${commandName} `))} ${green(
30
- `v${"0.9.0"}`
30
+ `v${"0.9.1"}`
31
31
  )} ${headline}`
32
32
  );
33
33
  }
@@ -1,3 +1,4 @@
1
+ import { LibsqlError } from "@libsql/client";
1
2
  import { sql as _sql } from "drizzle-orm";
2
3
  function createColumn(type, schema) {
3
4
  return {
@@ -8,6 +9,9 @@ function createColumn(type, schema) {
8
9
  schema
9
10
  };
10
11
  }
12
+ function isDbError(err) {
13
+ return err instanceof LibsqlError;
14
+ }
11
15
  const column = {
12
16
  number: (opts = {}) => {
13
17
  return createColumn("number", opts);
@@ -86,6 +90,7 @@ export {
86
90
  gt,
87
91
  gte,
88
92
  inArray,
93
+ isDbError,
89
94
  isNotNull,
90
95
  isNull,
91
96
  like,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astrojs/db",
3
- "version": "0.9.0",
3
+ "version": "0.9.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.7",
84
+ "astro": "4.5.8",
85
85
  "astro-scripts": "0.0.14"
86
86
  },
87
87
  "scripts": {
package/virtual.d.ts CHANGED
@@ -11,6 +11,7 @@ declare module 'astro:db' {
11
11
  export const column: RuntimeConfig['column'];
12
12
  export const defineDb: RuntimeConfig['defineDb'];
13
13
  export const defineTable: RuntimeConfig['defineTable'];
14
+ export const isDbError: RuntimeConfig['isDbError'];
14
15
 
15
16
  export const eq: RuntimeConfig['eq'];
16
17
  export const gt: RuntimeConfig['gt'];