driftsql 1.0.7 → 1.0.8

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/index.d.mts CHANGED
@@ -15,11 +15,21 @@ type UnifiedQueryResult<T extends Record<string, any>> = {
15
15
  }>;
16
16
  };
17
17
  interface ClientOptions {
18
+ /**
19
+ * @deprecated Since version 1.0.8 this option is deprecated and will be removed in future versions. Use `drivers.postgresHTTP.url` instead.
20
+ */
18
21
  url?: string;
22
+ /**
23
+ * @deprecated Since version 1.0.8 this option is deprecated and will be removed in future versions. Use `drivers.postgresHTTP.url` instead.
24
+ */
19
25
  password?: string;
20
26
  drivers?: {
21
27
  libsql?: Config;
22
28
  postgres?: PoolConfig;
29
+ postgresHTTP?: {
30
+ url: string;
31
+ password: string;
32
+ };
23
33
  mysql?: ConnectionOptions;
24
34
  };
25
35
  options?: {
package/dist/index.d.ts CHANGED
@@ -15,11 +15,21 @@ type UnifiedQueryResult<T extends Record<string, any>> = {
15
15
  }>;
16
16
  };
17
17
  interface ClientOptions {
18
+ /**
19
+ * @deprecated Since version 1.0.8 this option is deprecated and will be removed in future versions. Use `drivers.postgresHTTP.url` instead.
20
+ */
18
21
  url?: string;
22
+ /**
23
+ * @deprecated Since version 1.0.8 this option is deprecated and will be removed in future versions. Use `drivers.postgresHTTP.url` instead.
24
+ */
19
25
  password?: string;
20
26
  drivers?: {
21
27
  libsql?: Config;
22
28
  postgres?: PoolConfig;
29
+ postgresHTTP?: {
30
+ url: string;
31
+ password: string;
32
+ };
23
33
  mysql?: ConnectionOptions;
24
34
  };
25
35
  options?: {
package/dist/index.mjs CHANGED
@@ -5,7 +5,7 @@ import { createClient } from '@libsql/client';
5
5
  import mysql from 'mysql2/promise';
6
6
  import fs from 'node:fs/promises';
7
7
 
8
- const supportedDrivers = ["postgres", "mysql", "libsql"];
8
+ const supportedDrivers = ["postgres", "postgresHTTP", "mysql", "libsql"];
9
9
  const mapDatabaseTypeToTypeScript = (dataType, isNullable = false, driverType = "postgres") => {
10
10
  const nullable = isNullable ? " | null" : "";
11
11
  const lowerType = dataType.toLowerCase();
@@ -118,7 +118,7 @@ const inspectDB = async (drivers) => {
118
118
  AND TABLE_TYPE = 'BASE TABLE'
119
119
  ORDER BY TABLE_NAME`;
120
120
  tableSchemaFilter = currentDatabase;
121
- } else if (activeDriver === "postgres") {
121
+ } else if (activeDriver === "postgres" || activeDriver === "postgresHTTP") {
122
122
  tablesQuery = `SELECT table_name
123
123
  FROM information_schema.tables
124
124
  WHERE table_schema = $1
@@ -152,7 +152,7 @@ const inspectDB = async (drivers) => {
152
152
  ORDER BY ORDINAL_POSITION
153
153
  `;
154
154
  queryParams = [tableName, tableSchemaFilter];
155
- } else if (activeDriver === "postgres") {
155
+ } else if (activeDriver === "postgres" || activeDriver === "postgresHTTP") {
156
156
  columnsQuery = `
157
157
  SELECT
158
158
  column_name,
@@ -219,9 +219,9 @@ class DriftSQLClient {
219
219
  drivers;
220
220
  constructor(options) {
221
221
  this.client = ky.create({
222
- prefixUrl: options.url,
222
+ prefixUrl: options.drivers?.postgresHTTP.url || options.url || "http://localhost:3000",
223
223
  headers: {
224
- Authorization: `Bearer ${options.password}`
224
+ Authorization: `Bearer ${options.drivers?.postgresHTTP?.password || options.password || ""}`
225
225
  },
226
226
  timeout: options.options?.defaultTimeout || 5e3,
227
227
  hooks: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "driftsql",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "author": "lasse vestergaard",
5
5
  "description": "A lightweight SQL client for TypeScript, supporting multiple databases like PostgreSQL, MySQL, and LibSQL.",
6
6
  "repository": "lassejlv/driftsql",