@proteinjs/db-driver-knex 1.0.10 → 1.0.11
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/CHANGELOG.md +11 -0
- package/LICENSE +21 -0
- package/dist/generated/index.js +1 -1
- package/dist/generated/index.js.map +1 -1
- package/dist/src/KnexConfig.d.ts +1 -13
- package/dist/src/KnexConfig.d.ts.map +1 -1
- package/dist/src/KnexConfig.js +0 -12
- package/dist/src/KnexConfig.js.map +1 -1
- package/dist/src/KnexDriver.d.ts +1 -1
- package/dist/src/KnexDriver.d.ts.map +1 -1
- package/dist/src/KnexDriver.js +1 -2
- package/dist/src/KnexDriver.js.map +1 -1
- package/generated/index.ts +1 -1
- package/package.json +5 -4
- package/src/KnexConfig.ts +5 -17
- package/src/KnexDriver.ts +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.0.11](https://github.com/proteinjs/db/compare/@proteinjs/db-driver-knex@1.0.10...@proteinjs/db-driver-knex@1.0.11) (2024-05-02)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* db now requires a `DefaultDbDriverFactory` implementation to get default driver ([29daebd](https://github.com/proteinjs/db/commit/29daebdd971b106142eb525380f5a7d12a3d8eb6))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [1.0.8](https://github.com/proteinjs/db/compare/@proteinjs/db-driver-knex@1.0.7...@proteinjs/db-driver-knex@1.0.8) (2024-04-26)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package @proteinjs/db-driver-knex
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Brent Bahry
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/generated/index.js
CHANGED
|
@@ -24,7 +24,7 @@ require("moment");
|
|
|
24
24
|
require("mysql");
|
|
25
25
|
require("uuid");
|
|
26
26
|
/** Generate Source Graph */
|
|
27
|
-
var sourceGraph = "{\"options\":{\"directed\":true,\"multigraph\":false,\"compound\":false},\"nodes\":[{\"v\":\"@proteinjs/db-driver-knex/
|
|
27
|
+
var sourceGraph = "{\"options\":{\"directed\":true,\"multigraph\":false,\"compound\":false},\"nodes\":[{\"v\":\"@proteinjs/db-driver-knex/KnexDriver\",\"value\":{\"packageName\":\"@proteinjs/db-driver-knex\",\"name\":\"KnexDriver\",\"filePath\":\"/home/runner/work/db/db/packages/drivers/knex/src/KnexDriver.ts\",\"qualifiedName\":\"@proteinjs/db-driver-knex/KnexDriver\",\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"properties\":[{\"name\":\"KNEX\",\"type\":{\"packageName\":\"\",\"name\":\"knex\",\"filePath\":null,\"qualifiedName\":\"/knex\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":true,\"visibility\":\"private\"},{\"name\":\"logger\",\"type\":null,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\"},{\"name\":\"config\",\"type\":{\"packageName\":\"@proteinjs/db-driver-knex\",\"name\":\"KnexConfig\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db-driver-knex/KnexConfig\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\"},{\"name\":\"knexConfig\",\"type\":{\"packageName\":\"\",\"name\":\"any\",\"filePath\":null,\"qualifiedName\":\"/any\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\"}],\"methods\":[{\"name\":\"getKnex\",\"returnType\":{\"packageName\":\"\",\"name\":\"knex\",\"filePath\":null,\"qualifiedName\":\"/knex\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[]},{\"name\":\"getDbName\",\"returnType\":null,\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[]},{\"name\":\"createDbIfNotExists\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<void>\",\"filePath\":null,\"qualifiedName\":\"/Promise<void>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[]},{\"name\":\"dbExists\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<boolean>\",\"filePath\":null,\"qualifiedName\":\"/Promise<boolean>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\",\"parameters\":[{\"name\":\"databaseName\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"start\",\"returnType\":null,\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[]},{\"name\":\"stop\",\"returnType\":null,\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[]},{\"name\":\"setMaxAllowedPacketSize\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<void>\",\"filePath\":null,\"qualifiedName\":\"/Promise<void>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\",\"parameters\":[]},{\"name\":\"getTableManager\",\"returnType\":{\"packageName\":\"@proteinjs/db\",\"name\":\"TableManager\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db/TableManager\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[]},{\"name\":\"runQuery\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<SerializedRecord[]>\",\"filePath\":null,\"qualifiedName\":\"/Promise<SerializedRecord[]>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"generateStatement\",\"type\":{\"packageName\":\"\",\"name\":\"(config: DbDriverStatementConfig) => Statement\",\"filePath\":null,\"qualifiedName\":\"/(config: DbDriverStatementConfig) => Statement\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"runDml\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<number>\",\"filePath\":null,\"qualifiedName\":\"/Promise<number>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"generateStatement\",\"type\":{\"packageName\":\"\",\"name\":\"(config: DbDriverStatementConfig) => Statement\",\"filePath\":null,\"qualifiedName\":\"/(config: DbDriverStatementConfig) => Statement\",\"typeParameters\":null,\"directParents\":null}}]}],\"typeParameters\":[],\"directParentInterfaces\":[{\"packageName\":\"@proteinjs/db\",\"name\":\"DbDriver\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db/DbDriver\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParents\":[]}],\"directParentClasses\":[],\"sourceType\":2}},{\"v\":\"@proteinjs/db/DbDriver\"},{\"v\":\"@proteinjs/db-driver-knex/KnexSchemaOperations\",\"value\":{\"packageName\":\"@proteinjs/db-driver-knex\",\"name\":\"KnexSchemaOperations\",\"filePath\":\"/home/runner/work/db/db/packages/drivers/knex/src/KnexSchemaOperations.ts\",\"qualifiedName\":\"@proteinjs/db-driver-knex/KnexSchemaOperations\",\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"properties\":[{\"name\":\"logger\",\"type\":null,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\"},{\"name\":\"knexDriver\",\"type\":{\"packageName\":\"@proteinjs/db-driver-knex\",\"name\":\"KnexDriver\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db-driver-knex/KnexDriver\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\"}],\"methods\":[{\"name\":\"createTable\",\"returnType\":null,\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"table\",\"type\":{\"packageName\":\"\",\"name\":\"Table<any>\",\"filePath\":null,\"qualifiedName\":\"/Table<any>\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"alterTable\",\"returnType\":null,\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"table\",\"type\":{\"packageName\":\"\",\"name\":\"Table<any>\",\"filePath\":null,\"qualifiedName\":\"/Table<any>\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"tableChanges\",\"type\":{\"packageName\":\"@proteinjs/db\",\"name\":\"TableChanges\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db/TableChanges\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"createColumn\",\"returnType\":null,\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\",\"parameters\":[{\"name\":\"column\",\"type\":{\"packageName\":\"\",\"name\":\"Column<any, any>\",\"filePath\":null,\"qualifiedName\":\"/Column<any, any>\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"table\",\"type\":{\"packageName\":\"\",\"name\":\"Table<any>\",\"filePath\":null,\"qualifiedName\":\"/Table<any>\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"tableBuilder\",\"type\":{\"packageName\":\"\",\"name\":\"knex.TableBuilder\",\"filePath\":null,\"qualifiedName\":\"/knex.TableBuilder\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"tableChanges\",\"type\":{\"packageName\":\"@proteinjs/db\",\"name\":\"TableChanges\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db/TableChanges\",\"typeParameters\":null,\"directParents\":null}}]}],\"typeParameters\":[],\"directParentInterfaces\":[{\"packageName\":\"@proteinjs/db\",\"name\":\"SchemaOperations\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db/SchemaOperations\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParents\":[]}],\"directParentClasses\":[],\"sourceType\":2}},{\"v\":\"@proteinjs/db/SchemaOperations\"}],\"edges\":[{\"v\":\"@proteinjs/db-driver-knex/KnexDriver\",\"w\":\"@proteinjs/db/DbDriver\",\"value\":\"implements interface\"},{\"v\":\"@proteinjs/db-driver-knex/KnexSchemaOperations\",\"w\":\"@proteinjs/db/SchemaOperations\",\"value\":\"implements interface\"}]}";
|
|
28
28
|
/** Generate Source Links */
|
|
29
29
|
var KnexDriver_1 = require("../src/KnexDriver");
|
|
30
30
|
var KnexSchemaOperations_1 = require("../src/KnexSchemaOperations");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../generated/index.ts"],"names":[],"mappings":";AAAA,oCAAoC;;;;;;;;;;;;;;;;AAEpC,yBAAuB;AACvB,+BAA6B;AAC7B,iCAA+B;AAC/B,2BAAyB;AACzB,gBAAc;AACd,kBAAgB;AAChB,iBAAe;AACf,gBAAc;AAGd,4BAA4B;AAE5B,IAAM,WAAW,GAAG,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../generated/index.ts"],"names":[],"mappings":";AAAA,oCAAoC;;;;;;;;;;;;;;;;AAEpC,yBAAuB;AACvB,+BAA6B;AAC7B,iCAA+B;AAC/B,2BAAyB;AACzB,gBAAc;AACd,kBAAgB;AAChB,iBAAe;AACf,gBAAc;AAGd,4BAA4B;AAE5B,IAAM,WAAW,GAAG,4yQAA4yQ,CAAC;AAGj0Q,4BAA4B;AAE5B,gDAA+C;AAC/C,oEAAmE;AAEnE,IAAM,WAAW,GAAG;IACnB,sCAAsC,EAAE,uBAAU;IAClD,gDAAgD,EAAE,2CAAoB;CACtE,CAAC;AAGF,kCAAkC;AAElC,oDAAyD;AACzD,6BAAgB,CAAC,KAAK,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;AAGjD,2CAAyB"}
|
package/dist/src/KnexConfig.d.ts
CHANGED
|
@@ -1,19 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const getKnexConfig: () => {
|
|
1
|
+
export type KnexConfig = {
|
|
3
2
|
host: string;
|
|
4
3
|
user: string;
|
|
5
4
|
password: string;
|
|
6
5
|
dbName: string;
|
|
7
|
-
} & Loadable & {
|
|
8
|
-
host?: string | undefined;
|
|
9
|
-
user?: string | undefined;
|
|
10
|
-
password?: string | undefined;
|
|
11
|
-
dbName?: string | undefined;
|
|
12
|
-
};
|
|
13
|
-
export type KnexConfig = Loadable & {
|
|
14
|
-
host?: string;
|
|
15
|
-
user?: string;
|
|
16
|
-
password?: string;
|
|
17
|
-
dbName?: string;
|
|
18
6
|
};
|
|
19
7
|
//# sourceMappingURL=KnexConfig.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KnexConfig.d.ts","sourceRoot":"","sources":["../../src/KnexConfig.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"KnexConfig.d.ts","sourceRoot":"","sources":["../../src/KnexConfig.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAA"}
|
package/dist/src/KnexConfig.js
CHANGED
|
@@ -1,15 +1,3 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getKnexConfig = void 0;
|
|
4
|
-
var reflection_1 = require("@proteinjs/reflection");
|
|
5
|
-
var getKnexConfig = function () {
|
|
6
|
-
var config = reflection_1.SourceRepository.get().object('@proteinjs/db-driver-knex/KnexConfig');
|
|
7
|
-
return Object.assign({
|
|
8
|
-
host: process.env.DB_HOST ? process.env.DB_HOST : 'localhost',
|
|
9
|
-
user: process.env.DB_USER ? process.env.DB_USER : 'root',
|
|
10
|
-
password: process.env.DB_PASSWORD ? process.env.DB_PASSWORD : '',
|
|
11
|
-
dbName: process.env.DB_NAME ? process.env.DB_NAME : 'dev',
|
|
12
|
-
}, config);
|
|
13
|
-
};
|
|
14
|
-
exports.getKnexConfig = getKnexConfig;
|
|
15
3
|
//# sourceMappingURL=KnexConfig.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KnexConfig.js","sourceRoot":"","sources":["../../src/KnexConfig.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"KnexConfig.js","sourceRoot":"","sources":["../../src/KnexConfig.ts"],"names":[],"mappings":""}
|
package/dist/src/KnexDriver.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export declare class KnexDriver implements DbDriver {
|
|
|
7
7
|
private logger;
|
|
8
8
|
private config;
|
|
9
9
|
private knexConfig;
|
|
10
|
-
constructor(config
|
|
10
|
+
constructor(config: KnexConfig);
|
|
11
11
|
getKnex(): knex;
|
|
12
12
|
getDbName(): string;
|
|
13
13
|
createDbIfNotExists(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KnexDriver.d.ts","sourceRoot":"","sources":["../../src/KnexDriver.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAClG,OAAO,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"KnexDriver.d.ts","sourceRoot":"","sources":["../../src/KnexDriver.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAClG,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAIhD,qBAAa,UAAW,YAAW,QAAQ;IAC1C,OAAO,CAAC,MAAM,CAAC,IAAI,CAAO;IAC1B,OAAO,CAAC,MAAM,CAAqC;IACnD,OAAO,CAAC,MAAM,CAAa;IAC3B,OAAO,CAAC,UAAU,CAAM;gBAEZ,MAAM,EAAE,UAAU;IAY9B,OAAO,IAAI,IAAI;IAOf,SAAS;IAIH,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC;YAO5B,QAAQ;IAUhB,KAAK;IAIL,IAAI;YAII,uBAAuB;IAOrC,eAAe,IAAI,YAAY;IAMzB,QAAQ,CAAC,iBAAiB,EAAE,CAAC,MAAM,EAAE,uBAAuB,KAAK,SAAS,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAUxG,MAAM,CAAC,iBAAiB,EAAE,CAAC,MAAM,EAAE,uBAAuB,KAAK,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC;CAIhG"}
|
package/dist/src/KnexDriver.js
CHANGED
|
@@ -42,14 +42,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
42
42
|
exports.KnexDriver = void 0;
|
|
43
43
|
var knex_1 = __importDefault(require("knex"));
|
|
44
44
|
var db_1 = require("@proteinjs/db");
|
|
45
|
-
var KnexConfig_1 = require("./KnexConfig");
|
|
46
45
|
var util_1 = require("@proteinjs/util");
|
|
47
46
|
var KnexSchemaOperations_1 = require("./KnexSchemaOperations");
|
|
48
47
|
var KnexColumnTypeFactory_1 = require("./KnexColumnTypeFactory");
|
|
49
48
|
var KnexDriver = /** @class */ (function () {
|
|
50
49
|
function KnexDriver(config) {
|
|
51
50
|
this.logger = new util_1.Logger(this.constructor.name);
|
|
52
|
-
this.config = config
|
|
51
|
+
this.config = config;
|
|
53
52
|
this.knexConfig = {
|
|
54
53
|
client: 'mysql',
|
|
55
54
|
connection: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KnexDriver.js","sourceRoot":"","sources":["../../src/KnexDriver.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;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kBAAkB,EAAE,IAAI,EAAE,CAAC,EAAhF,GAAG,SAAA,EAAE,MAAM,YAAA,CAAsE;;;;wBAEhF,qBAAM,IAAI,CAAC,OAAO,EAAE,CAAC,GAAG,CAAC,GAAG,EAAE,MAAa,CAAC,EAAA;4BAApD,sBAAO,CAAC,SAA4C,CAAC,CAAC,CAAC,CAAC,EAAC,CAAC,oEAAoE;;;wBAE9H,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,uCAAgC,GAAG,CAAE,CAAC,CAAC;wBACzD,MAAM,OAAK,CAAC;;;;;KAEb;IAEK,2BAAM,GAAZ,UAAa,iBAAiE;;;;;4BACnD,qBAAM,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC,EAAA;;wBAAxD,YAAY,GAAK,CAAC,SAA8C,CAAA,aAApD;wBACpB,sBAAO,YAAY,EAAC;;;;KACpB;IACF,iBAAC;AAAD,CAAC,AAjFD,IAiFC;AAjFY,gCAAU"}
|
package/generated/index.ts
CHANGED
|
@@ -12,7 +12,7 @@ import 'uuid';
|
|
|
12
12
|
|
|
13
13
|
/** Generate Source Graph */
|
|
14
14
|
|
|
15
|
-
const sourceGraph = "{\"options\":{\"directed\":true,\"multigraph\":false,\"compound\":false},\"nodes\":[{\"v\":\"@proteinjs/db-driver-knex/
|
|
15
|
+
const sourceGraph = "{\"options\":{\"directed\":true,\"multigraph\":false,\"compound\":false},\"nodes\":[{\"v\":\"@proteinjs/db-driver-knex/KnexDriver\",\"value\":{\"packageName\":\"@proteinjs/db-driver-knex\",\"name\":\"KnexDriver\",\"filePath\":\"/home/runner/work/db/db/packages/drivers/knex/src/KnexDriver.ts\",\"qualifiedName\":\"@proteinjs/db-driver-knex/KnexDriver\",\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"properties\":[{\"name\":\"KNEX\",\"type\":{\"packageName\":\"\",\"name\":\"knex\",\"filePath\":null,\"qualifiedName\":\"/knex\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":true,\"visibility\":\"private\"},{\"name\":\"logger\",\"type\":null,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\"},{\"name\":\"config\",\"type\":{\"packageName\":\"@proteinjs/db-driver-knex\",\"name\":\"KnexConfig\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db-driver-knex/KnexConfig\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\"},{\"name\":\"knexConfig\",\"type\":{\"packageName\":\"\",\"name\":\"any\",\"filePath\":null,\"qualifiedName\":\"/any\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\"}],\"methods\":[{\"name\":\"getKnex\",\"returnType\":{\"packageName\":\"\",\"name\":\"knex\",\"filePath\":null,\"qualifiedName\":\"/knex\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[]},{\"name\":\"getDbName\",\"returnType\":null,\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[]},{\"name\":\"createDbIfNotExists\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<void>\",\"filePath\":null,\"qualifiedName\":\"/Promise<void>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[]},{\"name\":\"dbExists\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<boolean>\",\"filePath\":null,\"qualifiedName\":\"/Promise<boolean>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\",\"parameters\":[{\"name\":\"databaseName\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"start\",\"returnType\":null,\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[]},{\"name\":\"stop\",\"returnType\":null,\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[]},{\"name\":\"setMaxAllowedPacketSize\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<void>\",\"filePath\":null,\"qualifiedName\":\"/Promise<void>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\",\"parameters\":[]},{\"name\":\"getTableManager\",\"returnType\":{\"packageName\":\"@proteinjs/db\",\"name\":\"TableManager\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db/TableManager\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[]},{\"name\":\"runQuery\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<SerializedRecord[]>\",\"filePath\":null,\"qualifiedName\":\"/Promise<SerializedRecord[]>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"generateStatement\",\"type\":{\"packageName\":\"\",\"name\":\"(config: DbDriverStatementConfig) => Statement\",\"filePath\":null,\"qualifiedName\":\"/(config: DbDriverStatementConfig) => Statement\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"runDml\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<number>\",\"filePath\":null,\"qualifiedName\":\"/Promise<number>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"generateStatement\",\"type\":{\"packageName\":\"\",\"name\":\"(config: DbDriverStatementConfig) => Statement\",\"filePath\":null,\"qualifiedName\":\"/(config: DbDriverStatementConfig) => Statement\",\"typeParameters\":null,\"directParents\":null}}]}],\"typeParameters\":[],\"directParentInterfaces\":[{\"packageName\":\"@proteinjs/db\",\"name\":\"DbDriver\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db/DbDriver\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParents\":[]}],\"directParentClasses\":[],\"sourceType\":2}},{\"v\":\"@proteinjs/db/DbDriver\"},{\"v\":\"@proteinjs/db-driver-knex/KnexSchemaOperations\",\"value\":{\"packageName\":\"@proteinjs/db-driver-knex\",\"name\":\"KnexSchemaOperations\",\"filePath\":\"/home/runner/work/db/db/packages/drivers/knex/src/KnexSchemaOperations.ts\",\"qualifiedName\":\"@proteinjs/db-driver-knex/KnexSchemaOperations\",\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"properties\":[{\"name\":\"logger\",\"type\":null,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\"},{\"name\":\"knexDriver\",\"type\":{\"packageName\":\"@proteinjs/db-driver-knex\",\"name\":\"KnexDriver\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db-driver-knex/KnexDriver\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\"}],\"methods\":[{\"name\":\"createTable\",\"returnType\":null,\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"table\",\"type\":{\"packageName\":\"\",\"name\":\"Table<any>\",\"filePath\":null,\"qualifiedName\":\"/Table<any>\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"alterTable\",\"returnType\":null,\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"table\",\"type\":{\"packageName\":\"\",\"name\":\"Table<any>\",\"filePath\":null,\"qualifiedName\":\"/Table<any>\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"tableChanges\",\"type\":{\"packageName\":\"@proteinjs/db\",\"name\":\"TableChanges\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db/TableChanges\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"createColumn\",\"returnType\":null,\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\",\"parameters\":[{\"name\":\"column\",\"type\":{\"packageName\":\"\",\"name\":\"Column<any, any>\",\"filePath\":null,\"qualifiedName\":\"/Column<any, any>\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"table\",\"type\":{\"packageName\":\"\",\"name\":\"Table<any>\",\"filePath\":null,\"qualifiedName\":\"/Table<any>\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"tableBuilder\",\"type\":{\"packageName\":\"\",\"name\":\"knex.TableBuilder\",\"filePath\":null,\"qualifiedName\":\"/knex.TableBuilder\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"tableChanges\",\"type\":{\"packageName\":\"@proteinjs/db\",\"name\":\"TableChanges\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db/TableChanges\",\"typeParameters\":null,\"directParents\":null}}]}],\"typeParameters\":[],\"directParentInterfaces\":[{\"packageName\":\"@proteinjs/db\",\"name\":\"SchemaOperations\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db/SchemaOperations\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParents\":[]}],\"directParentClasses\":[],\"sourceType\":2}},{\"v\":\"@proteinjs/db/SchemaOperations\"}],\"edges\":[{\"v\":\"@proteinjs/db-driver-knex/KnexDriver\",\"w\":\"@proteinjs/db/DbDriver\",\"value\":\"implements interface\"},{\"v\":\"@proteinjs/db-driver-knex/KnexSchemaOperations\",\"w\":\"@proteinjs/db/SchemaOperations\",\"value\":\"implements interface\"}]}";
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
/** Generate Source Links */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@proteinjs/db-driver-knex",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.11",
|
|
4
4
|
"description": "Db driver for Knex",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"test": "jest"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@proteinjs/db": "^1.0.
|
|
25
|
+
"@proteinjs/db": "^1.0.12",
|
|
26
26
|
"@proteinjs/db-query": "1.0.7",
|
|
27
27
|
"@proteinjs/reflection": "1.0.7",
|
|
28
28
|
"@proteinjs/util": "1.1.0",
|
|
@@ -42,5 +42,6 @@
|
|
|
42
42
|
"typescript": "5.2.2"
|
|
43
43
|
},
|
|
44
44
|
"main": "./dist/generated/index.js",
|
|
45
|
-
"types": "./dist/generated/index.d.ts"
|
|
46
|
-
|
|
45
|
+
"types": "./dist/generated/index.d.ts",
|
|
46
|
+
"gitHead": "55ef30f514912d26b7e3a492bb5f55616733b134"
|
|
47
|
+
}
|
package/src/KnexConfig.ts
CHANGED
|
@@ -1,18 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
host: process.env.DB_HOST ? process.env.DB_HOST : 'localhost',
|
|
7
|
-
user: process.env.DB_USER ? process.env.DB_USER : 'root',
|
|
8
|
-
password: process.env.DB_PASSWORD ? process.env.DB_PASSWORD : '',
|
|
9
|
-
dbName: process.env.DB_NAME ? process.env.DB_NAME : 'dev',
|
|
10
|
-
}, config);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export type KnexConfig = Loadable & {
|
|
14
|
-
host?: string,
|
|
15
|
-
user?: string,
|
|
16
|
-
password?: string,
|
|
17
|
-
dbName?: string,
|
|
1
|
+
export type KnexConfig = {
|
|
2
|
+
host: string,
|
|
3
|
+
user: string,
|
|
4
|
+
password: string,
|
|
5
|
+
dbName: string,
|
|
18
6
|
}
|
package/src/KnexDriver.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import knex from 'knex';
|
|
2
2
|
import { DbDriver, DbDriverStatementConfig, SerializedRecord, TableManager } from '@proteinjs/db';
|
|
3
|
-
import { KnexConfig
|
|
3
|
+
import { KnexConfig } from './KnexConfig';
|
|
4
4
|
import { Logger } from '@proteinjs/util';
|
|
5
5
|
import { Statement } from '@proteinjs/db-query';
|
|
6
6
|
import { KnexSchemaOperations } from './KnexSchemaOperations';
|
|
@@ -12,8 +12,8 @@ export class KnexDriver implements DbDriver {
|
|
|
12
12
|
private config: KnexConfig;
|
|
13
13
|
private knexConfig: any;
|
|
14
14
|
|
|
15
|
-
constructor(config
|
|
16
|
-
this.config = config
|
|
15
|
+
constructor(config: KnexConfig) {
|
|
16
|
+
this.config = config;
|
|
17
17
|
this.knexConfig = {
|
|
18
18
|
client: 'mysql',
|
|
19
19
|
connection: {
|