@proteinjs/db-driver-knex 1.0.2

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.
Files changed (51) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/LICENSE +21 -0
  3. package/README.md +2 -0
  4. package/dist/generated/index.d.ts +11 -0
  5. package/dist/generated/index.d.ts.map +1 -0
  6. package/dist/generated/index.js +39 -0
  7. package/dist/generated/index.js.map +1 -0
  8. package/dist/index.d.ts +3 -0
  9. package/dist/index.d.ts.map +1 -0
  10. package/dist/index.js +19 -0
  11. package/dist/index.js.map +1 -0
  12. package/dist/src/KnexColumnTypeFactory.d.ts +5 -0
  13. package/dist/src/KnexColumnTypeFactory.d.ts.map +1 -0
  14. package/dist/src/KnexColumnTypeFactory.js +33 -0
  15. package/dist/src/KnexColumnTypeFactory.js.map +1 -0
  16. package/dist/src/KnexConfig.d.ts +19 -0
  17. package/dist/src/KnexConfig.d.ts.map +1 -0
  18. package/dist/src/KnexConfig.js +15 -0
  19. package/dist/src/KnexConfig.js.map +1 -0
  20. package/dist/src/KnexDriver.d.ts +22 -0
  21. package/dist/src/KnexDriver.d.ts.map +1 -0
  22. package/dist/src/KnexDriver.js +187 -0
  23. package/dist/src/KnexDriver.js.map +1 -0
  24. package/dist/src/KnexSchemaOperations.d.ts +11 -0
  25. package/dist/src/KnexSchemaOperations.d.ts.map +1 -0
  26. package/dist/src/KnexSchemaOperations.js +174 -0
  27. package/dist/src/KnexSchemaOperations.js.map +1 -0
  28. package/dist/src/getColumnFactory.d.ts +34 -0
  29. package/dist/src/getColumnFactory.d.ts.map +1 -0
  30. package/dist/src/getColumnFactory.js +111 -0
  31. package/dist/src/getColumnFactory.js.map +1 -0
  32. package/dist/test/Crud.test.d.ts +2 -0
  33. package/dist/test/Crud.test.d.ts.map +1 -0
  34. package/dist/test/Crud.test.js +62 -0
  35. package/dist/test/Crud.test.js.map +1 -0
  36. package/dist/test/TableManager.test.d.ts +2 -0
  37. package/dist/test/TableManager.test.d.ts.map +1 -0
  38. package/dist/test/TableManager.test.js +63 -0
  39. package/dist/test/TableManager.test.js.map +1 -0
  40. package/generated/index.ts +35 -0
  41. package/index.ts +2 -0
  42. package/jest.config.js +18 -0
  43. package/package.json +47 -0
  44. package/src/KnexColumnTypeFactory.ts +27 -0
  45. package/src/KnexConfig.ts +18 -0
  46. package/src/KnexDriver.ts +90 -0
  47. package/src/KnexSchemaOperations.ts +130 -0
  48. package/src/getColumnFactory.ts +86 -0
  49. package/test/Crud.test.ts +21 -0
  50. package/test/TableManager.test.ts +23 -0
  51. package/tsconfig.json +23 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,16 @@
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
+
6
+ ## [1.0.2](https://github.com/proteinjs/db/compare/@proteinjs/db-driver-knex@1.0.1...@proteinjs/db-driver-knex@1.0.2) (2024-04-19)
7
+
8
+ **Note:** Version bump only for package @proteinjs/db-driver-knex
9
+
10
+
11
+
12
+
13
+
14
+ ## 1.0.1 (2024-04-19)
15
+
16
+ **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/README.md ADDED
@@ -0,0 +1,2 @@
1
+ To connect to your mariadb container's db cli:
2
+ `docker exec -it <container name> mariadb -u root -p`
@@ -0,0 +1,11 @@
1
+ /** Load Dependency Source Graphs */
2
+ import '@proteinjs/db';
3
+ import '@proteinjs/db-query';
4
+ import '@proteinjs/reflection';
5
+ import '@proteinjs/util';
6
+ import 'knex';
7
+ import 'moment';
8
+ import 'mysql';
9
+ import 'uuid';
10
+ export * from '../index';
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../generated/index.ts"],"names":[],"mappings":"AAAA,oCAAoC;AAEpC,OAAO,eAAe,CAAC;AACvB,OAAO,qBAAqB,CAAC;AAC7B,OAAO,uBAAuB,CAAC;AAC/B,OAAO,iBAAiB,CAAC;AACzB,OAAO,MAAM,CAAC;AACd,OAAO,QAAQ,CAAC;AAChB,OAAO,OAAO,CAAC;AACf,OAAO,MAAM,CAAC;AAyBd,cAAc,UAAU,CAAC"}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ /** Load Dependency Source Graphs */
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
16
+ };
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ require("@proteinjs/db");
19
+ require("@proteinjs/db-query");
20
+ require("@proteinjs/reflection");
21
+ require("@proteinjs/util");
22
+ require("knex");
23
+ require("moment");
24
+ require("mysql");
25
+ require("uuid");
26
+ /** Generate Source Graph */
27
+ var sourceGraph = "{\"options\":{\"directed\":true,\"multigraph\":false,\"compound\":false},\"nodes\":[{\"v\":\"@proteinjs/db-driver-knex/KnexConfig\",\"value\":{\"packageName\":\"@proteinjs/db-driver-knex\",\"name\":\"KnexConfig\",\"filePath\":\"/home/runner/work/db/db/packages/drivers/knex/src/KnexConfig.ts\",\"qualifiedName\":\"@proteinjs/db-driver-knex/KnexConfig\",\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/reflection\",\"name\":\"Loadable\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/reflection/Loadable\",\"typeParameters\":[],\"directParents\":null},{\"packageName\":\"@proteinjs/db-driver-knex\",\"name\":\"{\\n host?: string,\\n user?: string,\\n password?: string,\\n dbName?: string,\\n}\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db-driver-knex/{\\n host?: string,\\n user?: string,\\n password?: string,\\n dbName?: string,\\n}\",\"typeParameters\":[],\"directParents\":null}],\"sourceType\":1}},{\"v\":\"@proteinjs/reflection/Loadable\"},{\"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/KnexConfig\",\"w\":\"@proteinjs/reflection/Loadable\",\"value\":\"extends type\"},{\"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
+ /** Generate Source Links */
29
+ var KnexDriver_1 = require("../src/KnexDriver");
30
+ var KnexSchemaOperations_1 = require("../src/KnexSchemaOperations");
31
+ var sourceLinks = {
32
+ '@proteinjs/db-driver-knex/KnexDriver': KnexDriver_1.KnexDriver,
33
+ '@proteinjs/db-driver-knex/KnexSchemaOperations': KnexSchemaOperations_1.KnexSchemaOperations,
34
+ };
35
+ /** Load Source Graph and Links */
36
+ var reflection_1 = require("@proteinjs/reflection");
37
+ reflection_1.SourceRepository.merge(sourceGraph, sourceLinks);
38
+ __exportStar(require("../index"), exports);
39
+ //# sourceMappingURL=index.js.map
@@ -0,0 +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,wySAAwyS,CAAC;AAG7zS,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"}
@@ -0,0 +1,3 @@
1
+ export * from './src/KnexDriver';
2
+ export * from './src/KnexConfig';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./src/KnexDriver"), exports);
18
+ __exportStar(require("./src/KnexConfig"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC;AACjC,mDAAiC"}
@@ -0,0 +1,5 @@
1
+ import { Column } from '@proteinjs/db';
2
+ export declare class KnexColumnTypeFactory {
3
+ getType(column: Column<any, any>): string;
4
+ }
5
+ //# sourceMappingURL=KnexColumnTypeFactory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KnexColumnTypeFactory.d.ts","sourceRoot":"","sources":["../../src/KnexColumnTypeFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAA+B,MAAM,EAAmG,MAAM,eAAe,CAAC;AAGrK,qBAAa,qBAAqB;IAChC,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,MAAM;CAsB1C"}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.KnexColumnTypeFactory = void 0;
4
+ var db_1 = require("@proteinjs/db");
5
+ // note: this might be specific to maria db
6
+ var KnexColumnTypeFactory = /** @class */ (function () {
7
+ function KnexColumnTypeFactory() {
8
+ }
9
+ KnexColumnTypeFactory.prototype.getType = function (column) {
10
+ if (column instanceof db_1.IntegerColumn)
11
+ return column.large ? 'bigint' : 'int';
12
+ else if (column instanceof db_1.UuidColumn)
13
+ return 'char';
14
+ else if (column instanceof db_1.StringColumn)
15
+ return column.maxLength === 'MAX' ? 'longtext' : 'varchar';
16
+ else if (column instanceof db_1.FloatColumn)
17
+ return 'float';
18
+ else if (column instanceof db_1.DecimalColumn)
19
+ return 'decimal';
20
+ else if (column instanceof db_1.BooleanColumn)
21
+ return 'tinyint';
22
+ else if (column instanceof db_1.DateColumn)
23
+ return 'date';
24
+ else if (column instanceof db_1.DateTimeColumn)
25
+ return 'datetime';
26
+ else if (column instanceof db_1.BinaryColumn)
27
+ return column.maxLength === 'MAX' ? 'longblob' : 'blob';
28
+ throw new Error("Invalid column type: ".concat(column.constructor.name, ", must extend a base column"));
29
+ };
30
+ return KnexColumnTypeFactory;
31
+ }());
32
+ exports.KnexColumnTypeFactory = KnexColumnTypeFactory;
33
+ //# sourceMappingURL=KnexColumnTypeFactory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KnexColumnTypeFactory.js","sourceRoot":"","sources":["../../src/KnexColumnTypeFactory.ts"],"names":[],"mappings":";;;AAAA,oCAAqK;AAErK,2CAA2C;AAC3C;IAAA;IAuBA,CAAC;IAtBC,uCAAO,GAAP,UAAQ,MAAwB;QAC9B,IAAI,MAAM,YAAY,kBAAa;YACjC,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC;aACpC,IAAI,MAAM,YAAY,eAAU;YACnC,OAAO,MAAM,CAAC;aACX,IAAI,MAAM,YAAY,iBAAY;YACrC,OAAO,MAAM,CAAC,SAAS,KAAK,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC;aACxD,IAAI,MAAM,YAAY,gBAAW;YACpC,OAAO,OAAO,CAAC;aACZ,IAAI,MAAM,YAAY,kBAAa;YACtC,OAAO,SAAS,CAAC;aACd,IAAI,MAAM,YAAY,kBAAa;YACtC,OAAO,SAAS,CAAC;aACd,IAAI,MAAM,YAAY,eAAU;YACnC,OAAO,MAAM,CAAC;aACX,IAAI,MAAM,YAAY,mBAAc;YACvC,OAAO,UAAU,CAAC;aACf,IAAI,MAAM,YAAY,iBAAY;YACrC,OAAQ,MAAuB,CAAC,SAAS,KAAK,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC;QAE5E,MAAM,IAAI,KAAK,CAAC,+BAAwB,MAAM,CAAC,WAAW,CAAC,IAAI,gCAA6B,CAAC,CAAC;IAChG,CAAC;IACH,4BAAC;AAAD,CAAC,AAvBD,IAuBC;AAvBY,sDAAqB"}
@@ -0,0 +1,19 @@
1
+ import { Loadable } from '@proteinjs/reflection';
2
+ export declare const getKnexConfig: () => {
3
+ host: string;
4
+ user: string;
5
+ password: string;
6
+ 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
+ };
19
+ //# sourceMappingURL=KnexConfig.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KnexConfig.d.ts","sourceRoot":"","sources":["../../src/KnexConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAoB,MAAM,uBAAuB,CAAC;AAEnE,eAAO,MAAM,aAAa;;;;;;;;;;CAQzB,CAAA;AAED,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG;IAClC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAA"}
@@ -0,0 +1,15 @@
1
+ "use strict";
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
+ //# sourceMappingURL=KnexConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KnexConfig.js","sourceRoot":"","sources":["../../src/KnexConfig.ts"],"names":[],"mappings":";;;AAAA,oDAAmE;AAE5D,IAAM,aAAa,GAAG;IAC3B,IAAM,MAAM,GAAG,6BAAgB,CAAC,GAAG,EAAE,CAAC,MAAM,CAAa,sCAAsC,CAAC,CAAC;IACjG,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW;QAC7D,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM;QACxD,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE;QAChE,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK;KAC1D,EAAE,MAAM,CAAC,CAAC;AACb,CAAC,CAAA;AARY,QAAA,aAAa,iBAQzB"}
@@ -0,0 +1,22 @@
1
+ import knex from 'knex';
2
+ import { DbDriver, DbDriverStatementConfig, SerializedRecord, TableManager } from '@proteinjs/db';
3
+ import { KnexConfig } from './KnexConfig';
4
+ import { Statement } from '@proteinjs/db-query';
5
+ export declare class KnexDriver implements DbDriver {
6
+ private static KNEX;
7
+ private logger;
8
+ private config;
9
+ private knexConfig;
10
+ constructor(config?: KnexConfig);
11
+ getKnex(): knex;
12
+ getDbName(): string;
13
+ createDbIfNotExists(): Promise<void>;
14
+ private dbExists;
15
+ start(): Promise<void>;
16
+ stop(): Promise<void>;
17
+ private setMaxAllowedPacketSize;
18
+ getTableManager(): TableManager;
19
+ runQuery(generateStatement: (config: DbDriverStatementConfig) => Statement): Promise<SerializedRecord[]>;
20
+ runDml(generateStatement: (config: DbDriverStatementConfig) => Statement): Promise<number>;
21
+ }
22
+ //# sourceMappingURL=KnexDriver.d.ts.map
@@ -0,0 +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,EAAiB,MAAM,cAAc,CAAC;AAEzD,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,CAAC,EAAE,UAAU;IAY/B,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"}
@@ -0,0 +1,187 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ var __importDefault = (this && this.__importDefault) || function (mod) {
39
+ return (mod && mod.__esModule) ? mod : { "default": mod };
40
+ };
41
+ Object.defineProperty(exports, "__esModule", { value: true });
42
+ exports.KnexDriver = void 0;
43
+ var knex_1 = __importDefault(require("knex"));
44
+ var db_1 = require("@proteinjs/db");
45
+ var KnexConfig_1 = require("./KnexConfig");
46
+ var util_1 = require("@proteinjs/util");
47
+ var KnexSchemaOperations_1 = require("./KnexSchemaOperations");
48
+ var KnexColumnTypeFactory_1 = require("./KnexColumnTypeFactory");
49
+ var KnexDriver = /** @class */ (function () {
50
+ function KnexDriver(config) {
51
+ this.logger = new util_1.Logger(this.constructor.name);
52
+ this.config = config ? config : (0, KnexConfig_1.getKnexConfig)();
53
+ this.knexConfig = {
54
+ client: 'mysql',
55
+ connection: {
56
+ host: this.config.host,
57
+ user: this.config.user,
58
+ password: this.config.password,
59
+ }
60
+ };
61
+ }
62
+ KnexDriver.prototype.getKnex = function () {
63
+ if (!KnexDriver.KNEX)
64
+ KnexDriver.KNEX = (0, knex_1.default)(this.knexConfig);
65
+ return KnexDriver.KNEX;
66
+ };
67
+ KnexDriver.prototype.getDbName = function () {
68
+ return this.config.dbName;
69
+ };
70
+ KnexDriver.prototype.createDbIfNotExists = function () {
71
+ return __awaiter(this, void 0, void 0, function () {
72
+ return __generator(this, function (_a) {
73
+ switch (_a.label) {
74
+ case 0: return [4 /*yield*/, this.dbExists(this.getDbName())];
75
+ case 1:
76
+ if (_a.sent())
77
+ return [2 /*return*/];
78
+ return [4 /*yield*/, this.getKnex().raw("CREATE DATABASE ".concat(this.getDbName(), ";"))];
79
+ case 2:
80
+ _a.sent();
81
+ return [2 /*return*/];
82
+ }
83
+ });
84
+ });
85
+ };
86
+ KnexDriver.prototype.dbExists = function (databaseName) {
87
+ return __awaiter(this, void 0, void 0, function () {
88
+ var result, _i, _a, existingDatabase;
89
+ return __generator(this, function (_b) {
90
+ switch (_b.label) {
91
+ case 0: return [4 /*yield*/, this.getKnex().raw('SHOW DATABASES;')];
92
+ case 1:
93
+ result = _b.sent();
94
+ for (_i = 0, _a = result[0]; _i < _a.length; _i++) {
95
+ existingDatabase = _a[_i];
96
+ if (existingDatabase['Database'] == databaseName)
97
+ return [2 /*return*/, true];
98
+ }
99
+ return [2 /*return*/, false];
100
+ }
101
+ });
102
+ });
103
+ };
104
+ KnexDriver.prototype.start = function () {
105
+ return __awaiter(this, void 0, void 0, function () {
106
+ return __generator(this, function (_a) {
107
+ switch (_a.label) {
108
+ case 0: return [4 /*yield*/, this.setMaxAllowedPacketSize()];
109
+ case 1:
110
+ _a.sent();
111
+ return [2 /*return*/];
112
+ }
113
+ });
114
+ });
115
+ };
116
+ KnexDriver.prototype.stop = function () {
117
+ return __awaiter(this, void 0, void 0, function () {
118
+ return __generator(this, function (_a) {
119
+ switch (_a.label) {
120
+ case 0: return [4 /*yield*/, this.getKnex().destroy()];
121
+ case 1:
122
+ _a.sent();
123
+ return [2 /*return*/];
124
+ }
125
+ });
126
+ });
127
+ };
128
+ KnexDriver.prototype.setMaxAllowedPacketSize = function () {
129
+ return __awaiter(this, void 0, void 0, function () {
130
+ return __generator(this, function (_a) {
131
+ switch (_a.label) {
132
+ case 0: return [4 /*yield*/, this.getKnex().raw('SET GLOBAL max_allowed_packet=1073741824;')];
133
+ case 1:
134
+ _a.sent();
135
+ return [4 /*yield*/, this.getKnex().destroy()];
136
+ case 2:
137
+ _a.sent();
138
+ KnexDriver.KNEX = (0, knex_1.default)(this.knexConfig);
139
+ this.logger.info('Set global max_allowed_packet size to 1gb');
140
+ return [2 /*return*/];
141
+ }
142
+ });
143
+ });
144
+ };
145
+ KnexDriver.prototype.getTableManager = function () {
146
+ var columnTypeFactory = new KnexColumnTypeFactory_1.KnexColumnTypeFactory();
147
+ var schemaOperations = new KnexSchemaOperations_1.KnexSchemaOperations(this);
148
+ return new db_1.TableManager(this, columnTypeFactory, schemaOperations);
149
+ };
150
+ KnexDriver.prototype.runQuery = function (generateStatement) {
151
+ return __awaiter(this, void 0, void 0, function () {
152
+ var _a, sql, params, error_1;
153
+ return __generator(this, function (_b) {
154
+ switch (_b.label) {
155
+ case 0:
156
+ _a = generateStatement({ useParams: true, prefixTablesWithDb: true }), sql = _a.sql, params = _a.params;
157
+ _b.label = 1;
158
+ case 1:
159
+ _b.trys.push([1, 3, , 4]);
160
+ return [4 /*yield*/, this.getKnex().raw(sql, params)];
161
+ case 2: return [2 /*return*/, (_b.sent())[0]]; // returns 2 arrays, first is records, second is metadata per record
162
+ case 3:
163
+ error_1 = _b.sent();
164
+ this.logger.error("Failed when executing query: ".concat(sql));
165
+ throw error_1;
166
+ case 4: return [2 /*return*/];
167
+ }
168
+ });
169
+ });
170
+ };
171
+ KnexDriver.prototype.runDml = function (generateStatement) {
172
+ return __awaiter(this, void 0, void 0, function () {
173
+ var affectedRows;
174
+ return __generator(this, function (_a) {
175
+ switch (_a.label) {
176
+ case 0: return [4 /*yield*/, this.runQuery(generateStatement)];
177
+ case 1:
178
+ affectedRows = (_a.sent()).affectedRows;
179
+ return [2 /*return*/, affectedRows];
180
+ }
181
+ });
182
+ });
183
+ };
184
+ return KnexDriver;
185
+ }());
186
+ exports.KnexDriver = KnexDriver;
187
+ //# sourceMappingURL=KnexDriver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KnexDriver.js","sourceRoot":"","sources":["../../src/KnexDriver.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,11 @@
1
+ import { Table, SchemaOperations, TableChanges } from '@proteinjs/db';
2
+ import { KnexDriver } from './KnexDriver';
3
+ export declare class KnexSchemaOperations implements SchemaOperations {
4
+ private knexDriver;
5
+ private logger;
6
+ constructor(knexDriver: KnexDriver);
7
+ createTable(table: Table<any>): Promise<void>;
8
+ alterTable(table: Table<any>, tableChanges: TableChanges): Promise<void>;
9
+ private createColumn;
10
+ }
11
+ //# sourceMappingURL=KnexSchemaOperations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KnexSchemaOperations.d.ts","sourceRoot":"","sources":["../../src/KnexSchemaOperations.ts"],"names":[],"mappings":"AAEA,OAAO,EAAU,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC9E,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C,qBAAa,oBAAqB,YAAW,gBAAgB;IAIzD,OAAO,CAAC,UAAU;IAHpB,OAAO,CAAC,MAAM,CAAqC;gBAGzC,UAAU,EAAE,UAAU;IAG1B,WAAW,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC;IAkC7B,UAAU,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,EAAE,YAAY,EAAE,YAAY;IA0D9D,OAAO,CAAC,YAAY;CAwBrB"}