From 5bd9d0ce42674cc5671f2cb0a72381be9a14cb8e Mon Sep 17 00:00:00 2001 From: Mel O'Hagan Date: Tue, 31 May 2022 16:47:11 +0100 Subject: [PATCH] Fix index.ts --- lib/index.d.ts | 6 +----- lib/index.js | 17 +++++++---------- package.json | 4 ++-- src/index.ts | 19 +++++++------------ 4 files changed, 17 insertions(+), 29 deletions(-) diff --git a/lib/index.d.ts b/lib/index.d.ts index 2d72cb7..60835d2 100644 --- a/lib/index.d.ts +++ b/lib/index.d.ts @@ -1,13 +1,9 @@ import * as Bluebird from "bluebird"; -import * as Knex from "knex"; +import { Knex } from "knex"; import { QueryCompiler } from "./query/QueryCompiler"; import { SchemaCompiler, TableCompiler } from "./schema"; export declare class SnowflakeDialect extends Knex.Client { constructor(config?: any); - // @ts-ignore - get dialect(): string; - // @ts-ignore - get driverName(): string; transaction(container: any, config: any, outerTx: any): Knex.Transaction; queryCompiler(builder: any): QueryCompiler; columnBuilder(tableBuilder: any, type: any, args: any): any; diff --git a/lib/index.js b/lib/index.js index 69cec5e..4d23607 100644 --- a/lib/index.js +++ b/lib/index.js @@ -1,16 +1,19 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const Bluebird = require("bluebird"); -const Knex = require("knex"); +const knex_1 = require("knex"); const lodash_1 = require("lodash"); const QueryCompiler_1 = require("./query/QueryCompiler"); const schema_1 = require("./schema"); const ColumnBuilder = require("knex/lib/schema/columnbuilder"); const ColumnCompiler_MySQL = require("knex/lib/dialects/mysql/schema/mysql-columncompiler"); -const Transaction = require("knex/lib/transaction"); +const Transaction = require("knex/lib/execution/transaction"); const util_1 = require("util"); -class SnowflakeDialect extends Knex.Client { - constructor(config = {}) { +class SnowflakeDialect extends knex_1.Knex.Client { + constructor(config = { + dialect: "snowflake", + driverName: "snowflake-sdk", + }) { if (config.connection) { if (config.connection.user && !config.connection.username) { config.connection.username = config.connection.user; @@ -27,12 +30,6 @@ class SnowflakeDialect extends Knex.Client { } super(config); } - get dialect() { - return "snowflake"; - } - get driverName() { - return "snowflake-sdk"; - } transaction(container, config, outerTx) { const transax = new Transaction(this, container, config, outerTx); transax.savepoint = (conn) => { diff --git a/package.json b/package.json index 5d3938e..6b143d2 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,7 @@ "snowflake-sdk": "1.6.0" }, "peerDependencies": { - "knex": "^0.15.2" + "knex": "1.0.3" }, "devDependencies": { "@types/bluebird": "3.5.29", @@ -66,7 +66,7 @@ "@types/node": "13.7.0", "chai": "4.2.0", "jest": "25.1.0", - "knex": "0.20.4", + "knex": "1.0.3", "mocha": "7.1.1", "mysql": "2.18.1", "sinon": "9.0.1", diff --git a/src/index.ts b/src/index.ts index cd032e4..894da7f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,16 +1,19 @@ import * as Bluebird from "bluebird"; -import * as Knex from "knex"; +import { Knex } from "knex"; import { defer, fromPairs, isArray, map, toPairs } from "lodash"; import { QueryCompiler } from "./query/QueryCompiler"; import { SchemaCompiler, TableCompiler } from "./schema"; import * as ColumnBuilder from "knex/lib/schema/columnbuilder"; -import * as ColumnCompiler_MySQL from "knex/lib/dialects/mysql/schema/columncompiler"; -import * as Transaction from "knex/lib/transaction"; +import * as ColumnCompiler_MySQL from "knex/lib/dialects/mysql/schema/mysql-columncompiler"; +import * as Transaction from "knex/lib/execution/transaction"; import { promisify } from "util"; export class SnowflakeDialect extends Knex.Client { - constructor(config = {} as any) { + constructor(config = { + dialect: "snowflake", + driverName: "snowflake-sdk", + } as any) { if (config.connection) { if (config.connection.user && !config.connection.username) { config.connection.username = config.connection.user; @@ -28,14 +31,6 @@ export class SnowflakeDialect extends Knex.Client { super(config); } - public get dialect() { - return "snowflake"; - } - - public get driverName() { - return "snowflake-sdk"; - } - transaction(container: any, config: any, outerTx: any): Knex.Transaction { const transax = new Transaction(this, container, config, outerTx); transax.savepoint = (conn: any) => {