@astrojs/db 0.14.12 → 0.14.14

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.
@@ -27,7 +27,7 @@ function printHelp({
27
27
  message.push(
28
28
  linebreak(),
29
29
  ` ${bgGreen(black(` ${commandName} `))} ${green(
30
- `v${"0.14.12"}`
30
+ `v${"0.14.14"}`
31
31
  )} ${headline}`
32
32
  );
33
33
  }
@@ -1,3 +1,4 @@
1
+ import { type Config as LibSQLConfig } from '@libsql/client';
1
2
  import type { LibSQLDatabase } from 'drizzle-orm/libsql';
2
3
  import { type SqliteRemoteDatabase } from 'drizzle-orm/sqlite-proxy';
3
4
  type LocalDbClientOptions = {
@@ -11,4 +12,5 @@ type RemoteDbClientOptions = {
11
12
  remoteUrl: string | URL;
12
13
  };
13
14
  export declare function createRemoteDatabaseClient(options: RemoteDbClientOptions): SqliteRemoteDatabase<Record<string, never>> | LibSQLDatabase<Record<string, never>>;
15
+ export declare function parseOpts(config: Record<string, string>): Partial<LibSQLConfig>;
14
16
  export {};
@@ -33,6 +33,16 @@ function createRemoteDatabaseClient(options) {
33
33
  const remoteUrl = new URL(options.remoteUrl);
34
34
  return options.dbType === "studio" ? createStudioDatabaseClient(options.appToken, remoteUrl) : createRemoteLibSQLClient(options.appToken, remoteUrl, options.remoteUrl.toString());
35
35
  }
36
+ function parseOpts(config) {
37
+ return {
38
+ ...config,
39
+ ...config.syncInterval ? { syncInterval: parseInt(config.syncInterval) } : {},
40
+ ..."readYourWrites" in config ? { readYourWrites: config.readYourWrites !== "false" } : {},
41
+ ..."offline" in config ? { offline: config.offline !== "false" } : {},
42
+ ..."tls" in config ? { tls: config.tls !== "false" } : {},
43
+ ...config.concurrency ? { concurrency: parseInt(config.concurrency) } : {}
44
+ };
45
+ }
36
46
  function createRemoteLibSQLClient(appToken, remoteDbURL, rawUrl) {
37
47
  const options = Object.fromEntries(remoteDbURL.searchParams.entries());
38
48
  remoteDbURL.search = "";
@@ -42,11 +52,7 @@ function createRemoteLibSQLClient(appToken, remoteDbURL, rawUrl) {
42
52
  } else if (remoteDbURL.protocol === "file:" && remoteDbURL.pathname.startsWith("/") && !rawUrl.startsWith("file:/")) {
43
53
  url = "file:" + remoteDbURL.pathname.substring(1);
44
54
  }
45
- const client = createClient({
46
- ...options,
47
- authToken: appToken,
48
- url
49
- });
55
+ const client = createClient({ ...parseOpts(options), url, authToken: appToken });
50
56
  return drizzleLibsql(client);
51
57
  }
52
58
  function createStudioDatabaseClient(appToken, remoteDbURL) {
@@ -186,5 +192,6 @@ async function parseRemoteError(response) {
186
192
  }
187
193
  export {
188
194
  createLocalDatabaseClient,
189
- createRemoteDatabaseClient
195
+ createRemoteDatabaseClient,
196
+ parseOpts
190
197
  };
@@ -1,7 +1,7 @@
1
1
  import { type ColumnDataType } from 'drizzle-orm';
2
2
  import type { LibSQLDatabase } from 'drizzle-orm/libsql';
3
3
  import type { DBColumn, DBTable } from '../core/types.js';
4
- export type Database = Omit<LibSQLDatabase, 'transaction'>;
4
+ export type Database = LibSQLDatabase;
5
5
  export type { Table } from './types.js';
6
6
  export { createRemoteDatabaseClient, createLocalDatabaseClient } from './db-client.js';
7
7
  export declare function hasPrimaryKey(column: DBColumn): boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astrojs/db",
3
- "version": "0.14.12",
3
+ "version": "0.14.14",
4
4
  "description": "Add libSQL and Astro Studio support to your Astro site",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -74,7 +74,7 @@
74
74
  "yargs-parser": "^21.1.1",
75
75
  "yocto-spinner": "^0.2.1",
76
76
  "zod": "^3.24.2",
77
- "@astrojs/studio": "0.1.8"
77
+ "@astrojs/studio": "0.1.9"
78
78
  },
79
79
  "devDependencies": {
80
80
  "@types/deep-diff": "^1.0.5",
@@ -82,8 +82,8 @@
82
82
  "@types/yargs-parser": "^21.0.3",
83
83
  "cheerio": "1.0.0",
84
84
  "typescript": "^5.8.3",
85
- "vite": "^6.2.6",
86
- "astro": "5.7.5",
85
+ "vite": "^6.3.4",
86
+ "astro": "5.7.12",
87
87
  "astro-scripts": "0.0.14"
88
88
  },
89
89
  "scripts": {