@quillsql/node 0.4.4 → 0.4.5

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,12 +1,12 @@
1
1
  import { Mapable, CacheCredentials } from "../models/Cache";
2
- import { DatabaseConnection, DatabaseType } from "./DatabaseHelper";
2
+ import { DatabaseConnection, QuillDatabaseType } from "./DatabaseHelper";
3
3
  export declare class CachedConnection {
4
- databaseType: DatabaseType;
4
+ databaseType: QuillDatabaseType;
5
5
  pool: DatabaseConnection;
6
6
  orgId: any;
7
7
  ttl: number;
8
8
  cache: Mapable | null;
9
- constructor(databaseType: DatabaseType, config: any, cacheConfig?: Partial<CacheCredentials>);
9
+ constructor(databaseType: QuillDatabaseType, config: any, cacheConfig?: Partial<CacheCredentials>);
10
10
  query(text: string, values?: any[]): Promise<any>;
11
11
  /**
12
12
  * Configures and returns a cache instance or null if none could be created.
@@ -6,7 +6,7 @@ import { PostgresConnectionConfig } from "./Postgres";
6
6
  import { SnowflakeConnectionConfig } from "./Snowflake";
7
7
  import { BigQueryConfig } from "./BigQuery";
8
8
  import { MysqlConnectionConfig } from "./Mysql";
9
- export declare enum DatabaseType {
9
+ export declare enum QuillDatabaseType {
10
10
  postgresql = "postgresql",
11
11
  snowflake = "snowflake",
12
12
  bigquery = "bigquery",
@@ -22,18 +22,18 @@ export interface QuillQueryResults {
22
22
  [fieldName: string]: any;
23
23
  }[];
24
24
  }
25
- export declare function getDatabaseCredentials(databaseType: DatabaseType, connectionString: string): PostgresConnectionConfig | SnowflakeConnectionConfig | BigQueryConfig | MysqlConnectionConfig | undefined;
26
- export declare function connectToDatabase(databaseType: DatabaseType, config: PostgresConnectionConfig | SnowflakeConnectionConfig | BigQueryConfig | MysqlConnectionConfig): DatabaseConnection;
27
- export declare function runQueryByDatabase(databaseType: DatabaseType, connection: DatabaseConnection, sql: string): Promise<QuillQueryResults> | undefined;
28
- export declare function disconnectFromDatabase(databaseType: DatabaseType, database: DatabaseConnection): void | Promise<void>;
29
- export declare function getSchemasByDatabase(databaseType: DatabaseType, connection: DatabaseConnection): Promise<string[] | undefined>;
30
- export declare function getTablesBySchemaByDatabase(databaseType: DatabaseType, connection: DatabaseConnection, schemaName: string | string[]): Promise<string[] | {
25
+ export declare function getDatabaseCredentials(databaseType: QuillDatabaseType, connectionString: string): PostgresConnectionConfig | SnowflakeConnectionConfig | BigQueryConfig | MysqlConnectionConfig | undefined;
26
+ export declare function connectToDatabase(databaseType: QuillDatabaseType, config: PostgresConnectionConfig | SnowflakeConnectionConfig | BigQueryConfig | MysqlConnectionConfig): DatabaseConnection;
27
+ export declare function runQueryByDatabase(databaseType: QuillDatabaseType, connection: DatabaseConnection, sql: string): Promise<QuillQueryResults> | undefined;
28
+ export declare function disconnectFromDatabase(databaseType: QuillDatabaseType, database: DatabaseConnection): void | Promise<void>;
29
+ export declare function getSchemasByDatabase(databaseType: QuillDatabaseType, connection: DatabaseConnection): Promise<string[] | undefined>;
30
+ export declare function getTablesBySchemaByDatabase(databaseType: QuillDatabaseType, connection: DatabaseConnection, schemaName: string | string[]): Promise<string[] | {
31
31
  tableName: string;
32
32
  schemaName: string;
33
33
  }[] | undefined>;
34
- export declare function getColumnsByTableByDatabase(databaseType: DatabaseType, connection: DatabaseConnection, schemaName: string, tableName: string): Promise<string[] | undefined>;
35
- export declare function getForiegnKeysByDatabase(databaseType: DatabaseType, connection: DatabaseConnection, schemaName: string, tableName: string, primaryKey: string): Promise<string[] | undefined>;
36
- export declare function getColumnInfoBySchemaByDatabase(databaseType: DatabaseType, connection: DatabaseConnection, schemaName: string, tables: string[] | {
34
+ export declare function getColumnsByTableByDatabase(databaseType: QuillDatabaseType, connection: DatabaseConnection, schemaName: string, tableName: string): Promise<string[] | undefined>;
35
+ export declare function getForiegnKeysByDatabase(databaseType: QuillDatabaseType, connection: DatabaseConnection, schemaName: string, tableName: string, primaryKey: string): Promise<string[] | undefined>;
36
+ export declare function getColumnInfoBySchemaByDatabase(databaseType: QuillDatabaseType, connection: DatabaseConnection, schemaName: string, tables: string[] | {
37
37
  tableName: string;
38
38
  schemaName: string;
39
39
  }[]): Promise<{
@@ -9,18 +9,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.getColumnInfoBySchemaByDatabase = exports.getForiegnKeysByDatabase = exports.getColumnsByTableByDatabase = exports.getTablesBySchemaByDatabase = exports.getSchemasByDatabase = exports.disconnectFromDatabase = exports.runQueryByDatabase = exports.connectToDatabase = exports.getDatabaseCredentials = exports.DatabaseType = void 0;
12
+ exports.getColumnInfoBySchemaByDatabase = exports.getForiegnKeysByDatabase = exports.getColumnsByTableByDatabase = exports.getTablesBySchemaByDatabase = exports.getSchemasByDatabase = exports.disconnectFromDatabase = exports.runQueryByDatabase = exports.connectToDatabase = exports.getDatabaseCredentials = exports.QuillDatabaseType = void 0;
13
13
  const Postgres_1 = require("./Postgres");
14
14
  const Snowflake_1 = require("./Snowflake");
15
15
  const BigQuery_1 = require("./BigQuery");
16
16
  const Mysql_1 = require("./Mysql");
17
- var DatabaseType;
18
- (function (DatabaseType) {
19
- DatabaseType["postgresql"] = "postgresql";
20
- DatabaseType["snowflake"] = "snowflake";
21
- DatabaseType["bigquery"] = "bigquery";
22
- DatabaseType["mysql"] = "mysql";
23
- })(DatabaseType || (exports.DatabaseType = DatabaseType = {}));
17
+ var QuillDatabaseType;
18
+ (function (QuillDatabaseType) {
19
+ QuillDatabaseType["postgresql"] = "postgresql";
20
+ QuillDatabaseType["snowflake"] = "snowflake";
21
+ QuillDatabaseType["bigquery"] = "bigquery";
22
+ QuillDatabaseType["mysql"] = "mysql";
23
+ })(QuillDatabaseType || (exports.QuillDatabaseType = QuillDatabaseType = {}));
24
24
  function getDatabaseCredentials(databaseType, connectionString) {
25
25
  switch (databaseType.toLowerCase()) {
26
26
  case "postgres":
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import { CacheCredentials } from "./models/Cache";
2
2
  import { QuillQueryParams } from "./models/Quill";
3
3
  import { CachedConnection } from "./db/CachedConnection";
4
4
  import "dotenv/config";
5
- import { DatabaseType } from "./db/DatabaseHelper";
5
+ import { QuillDatabaseType } from "./db/DatabaseHelper";
6
6
  /**
7
7
  * Quill - Fullstack API Platform for Dashboards and Reporting.
8
8
  */
@@ -15,6 +15,7 @@ export interface QuillQueryResult {
15
15
  fields: any[];
16
16
  };
17
17
  }
18
+ export type DatabaseType = QuillDatabaseType;
18
19
  export default class QuillClass {
19
20
  targetConnection: CachedConnection;
20
21
  private baseUrl;
package/dist/index.js CHANGED
@@ -188,4 +188,4 @@ module.exports.getColumnInfoBySchemaByDatabase =
188
188
  DatabaseHelper_1.getColumnInfoBySchemaByDatabase;
189
189
  module.exports.connectToDatabase = DatabaseHelper_1.connectToDatabase;
190
190
  module.exports.runQueryByDatabase = DatabaseHelper_1.runQueryByDatabase;
191
- module.exports.DatabaseType = DatabaseHelper_1.DatabaseType;
191
+ module.exports.DatabaseType = DatabaseHelper_1.QuillDatabaseType;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quillsql/node",
3
- "version": "0.4.4",
3
+ "version": "0.4.5",
4
4
  "description": "Quill's client SDK for node backends.",
5
5
  "main": "dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -5,7 +5,7 @@ import { createClient } from "redis";
5
5
  import { isSuperset } from "../utils/Error";
6
6
  import {
7
7
  DatabaseConnection,
8
- DatabaseType,
8
+ QuillDatabaseType,
9
9
  connectToDatabase,
10
10
  disconnectFromDatabase,
11
11
  runQueryByDatabase,
@@ -29,14 +29,14 @@ class PgError extends Error {
29
29
  const DEFAULT_CACHE_TTL = 24 * 60 * 60;
30
30
 
31
31
  export class CachedConnection {
32
- public databaseType: DatabaseType;
32
+ public databaseType: QuillDatabaseType;
33
33
  public pool: DatabaseConnection;
34
34
  public orgId: any;
35
35
  public ttl: number;
36
36
  public cache: Mapable | null;
37
37
 
38
38
  constructor(
39
- databaseType: DatabaseType,
39
+ databaseType: QuillDatabaseType,
40
40
  config: any,
41
41
  cacheConfig: Partial<CacheCredentials> = {}
42
42
  ) {
@@ -51,7 +51,7 @@ import {
51
51
  getSchemasMysql,
52
52
  } from "./Mysql";
53
53
 
54
- export enum DatabaseType {
54
+ export enum QuillDatabaseType {
55
55
  postgresql = "postgresql",
56
56
  snowflake = "snowflake",
57
57
  bigquery = "bigquery",
@@ -71,7 +71,7 @@ export interface QuillQueryResults {
71
71
  }
72
72
 
73
73
  export function getDatabaseCredentials(
74
- databaseType: DatabaseType,
74
+ databaseType: QuillDatabaseType,
75
75
  connectionString: string
76
76
  ):
77
77
  | PostgresConnectionConfig
@@ -96,7 +96,7 @@ export function getDatabaseCredentials(
96
96
  }
97
97
 
98
98
  export function connectToDatabase(
99
- databaseType: DatabaseType,
99
+ databaseType: QuillDatabaseType,
100
100
  config:
101
101
  | PostgresConnectionConfig
102
102
  | SnowflakeConnectionConfig
@@ -120,7 +120,7 @@ export function connectToDatabase(
120
120
  }
121
121
 
122
122
  export function runQueryByDatabase(
123
- databaseType: DatabaseType,
123
+ databaseType: QuillDatabaseType,
124
124
  connection: DatabaseConnection,
125
125
  sql: string
126
126
  ): Promise<QuillQueryResults> | undefined {
@@ -141,7 +141,7 @@ export function runQueryByDatabase(
141
141
  }
142
142
 
143
143
  export function disconnectFromDatabase(
144
- databaseType: DatabaseType,
144
+ databaseType: QuillDatabaseType,
145
145
  database: DatabaseConnection
146
146
  ) {
147
147
  switch (databaseType.toLowerCase()) {
@@ -161,7 +161,7 @@ export function disconnectFromDatabase(
161
161
  }
162
162
 
163
163
  export async function getSchemasByDatabase(
164
- databaseType: DatabaseType,
164
+ databaseType: QuillDatabaseType,
165
165
  connection: DatabaseConnection
166
166
  ): Promise<string[] | undefined> {
167
167
  switch (databaseType.toLowerCase()) {
@@ -182,7 +182,7 @@ export async function getSchemasByDatabase(
182
182
 
183
183
  // INFORMATION SCHEMA SELECTS
184
184
  export async function getTablesBySchemaByDatabase(
185
- databaseType: DatabaseType,
185
+ databaseType: QuillDatabaseType,
186
186
  connection: DatabaseConnection,
187
187
  schemaName: string | string[]
188
188
  ): Promise<string[] | { tableName: string; schemaName: string }[] | undefined> {
@@ -219,7 +219,7 @@ export async function getTablesBySchemaByDatabase(
219
219
 
220
220
  // INFORMATION SCHEMA SELECTS
221
221
  export async function getColumnsByTableByDatabase(
222
- databaseType: DatabaseType,
222
+ databaseType: QuillDatabaseType,
223
223
  connection: DatabaseConnection,
224
224
  schemaName: string,
225
225
  tableName: string
@@ -261,7 +261,7 @@ export async function getColumnsByTableByDatabase(
261
261
  }
262
262
 
263
263
  export async function getForiegnKeysByDatabase(
264
- databaseType: DatabaseType,
264
+ databaseType: QuillDatabaseType,
265
265
  connection: DatabaseConnection,
266
266
  schemaName: string,
267
267
  tableName: string,
@@ -309,7 +309,7 @@ export async function getForiegnKeysByDatabase(
309
309
  }
310
310
 
311
311
  export function getColumnInfoBySchemaByDatabase(
312
- databaseType: DatabaseType,
312
+ databaseType: QuillDatabaseType,
313
313
  connection: DatabaseConnection,
314
314
  schemaName: string,
315
315
  tables: string[] | { tableName: string; schemaName: string }[]
package/src/index.ts CHANGED
@@ -10,7 +10,7 @@ import axios from "axios";
10
10
  import "dotenv/config";
11
11
  import { mapQueries, removeFields } from "./utils/RunQueryProcesses";
12
12
  import {
13
- DatabaseType,
13
+ QuillDatabaseType,
14
14
  connectToDatabase,
15
15
  getColumnInfoBySchemaByDatabase,
16
16
  getColumnsByTableByDatabase,
@@ -38,6 +38,7 @@ export interface QuillQueryResult {
38
38
  queries?: { rows: any[]; fields: any[] };
39
39
  }
40
40
 
41
+ export type DatabaseType = QuillDatabaseType;
41
42
  export default class QuillClass {
42
43
  // Configure cached connection pools with the given config.
43
44
  public targetConnection;
@@ -296,4 +297,4 @@ module.exports.getColumnInfoBySchemaByDatabase =
296
297
  getColumnInfoBySchemaByDatabase;
297
298
  module.exports.connectToDatabase = connectToDatabase;
298
299
  module.exports.runQueryByDatabase = runQueryByDatabase;
299
- module.exports.DatabaseType = DatabaseType;
300
+ module.exports.DatabaseType = QuillDatabaseType;