@proteinjs/db-driver-knex 1.13.8 → 1.14.0
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 +25 -0
- package/README.md +10 -0
- package/dist/generated/index.js +1 -1
- package/dist/generated/index.js.map +1 -1
- package/dist/generated/test/index.js +1 -1
- package/dist/generated/test/index.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/src/KnexDriver.d.ts +66 -0
- package/dist/src/KnexDriver.d.ts.map +1 -1
- package/dist/src/KnexDriver.js +181 -1
- package/dist/src/KnexDriver.js.map +1 -1
- package/dist/src/KnexLogValues.d.ts +38 -0
- package/dist/src/KnexLogValues.d.ts.map +1 -0
- package/dist/src/KnexLogValues.js +47 -0
- package/dist/src/KnexLogValues.js.map +1 -0
- package/dist/test/LogValuesSwitch.test.d.ts +2 -0
- package/dist/test/LogValuesSwitch.test.d.ts.map +1 -0
- package/dist/test/LogValuesSwitch.test.js +255 -0
- package/dist/test/LogValuesSwitch.test.js.map +1 -0
- package/dist/test/StatementLogNeverThrows.test.d.ts +2 -0
- package/dist/test/StatementLogNeverThrows.test.d.ts.map +1 -0
- package/dist/test/StatementLogNeverThrows.test.js +541 -0
- package/dist/test/StatementLogNeverThrows.test.js.map +1 -0
- package/dist/test/StatementParamLogging.test.d.ts +2 -0
- package/dist/test/StatementParamLogging.test.d.ts.map +1 -0
- package/dist/test/StatementParamLogging.test.js +403 -0
- package/dist/test/StatementParamLogging.test.js.map +1 -0
- package/dist/test/util/printedLine.d.ts +20 -0
- package/dist/test/util/printedLine.d.ts.map +1 -0
- package/dist/test/util/printedLine.js +48 -0
- package/dist/test/util/printedLine.js.map +1 -0
- package/generated/index.ts +1 -1
- package/generated/test/index.ts +1 -1
- package/index.ts +1 -0
- package/package.json +5 -5
- package/src/KnexDriver.ts +191 -2
- package/src/KnexLogValues.ts +42 -0
- package/test/LogValuesSwitch.test.ts +201 -0
- package/test/StatementLogNeverThrows.test.ts +466 -0
- package/test/StatementParamLogging.test.ts +313 -0
- package/test/util/printedLine.ts +43 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,31 @@
|
|
|
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.14.0](https://github.com/proteinjs/db/compare/@proteinjs/db-driver-knex@1.13.9...@proteinjs/db-driver-knex@1.14.0) (2026-09-20)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **db-driver-knex:** the failure line describes the bound parameters and summarizes the failure — the vendor error, which carries every binding, no longer rides it ([79c9517](https://github.com/proteinjs/db/commit/79c95177f5362f23acb710932c51cae02a9d79e5))
|
|
12
|
+
* **db-driver-knex:** writing the failure line can never change what is thrown — a bindings dictionary is described by entry name, the line's helpers are total, and the line goes through one guarded door ([0d4ade6](https://github.com/proteinjs/db/commit/0d4ade699acc547b9ddcddfc581d731739e5df35))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* **db-driver-knex:** a dev-only switch puts the real values back on the failure line — DEVELOPMENT set AND DB_LOG_PARAM_VALUES=1 ([b907f87](https://github.com/proteinjs/db/commit/b907f87ffadfe2a1a2c58be54ac8eece1cc95eb2))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
## [1.13.9](https://github.com/proteinjs/db/compare/@proteinjs/db-driver-knex@1.13.8...@proteinjs/db-driver-knex@1.13.9) (2026-09-14)
|
|
24
|
+
|
|
25
|
+
**Note:** Version bump only for package @proteinjs/db-driver-knex
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
6
31
|
## [1.13.8](https://github.com/proteinjs/db/compare/@proteinjs/db-driver-knex@1.13.7...@proteinjs/db-driver-knex@1.13.8) (2026-09-13)
|
|
7
32
|
|
|
8
33
|
**Note:** Version bump only for package @proteinjs/db-driver-knex
|
package/README.md
CHANGED
|
@@ -3,3 +3,13 @@
|
|
|
3
3
|
1. [Install Docker](https://docs.docker.com/desktop/install/mac-install/)
|
|
4
4
|
2. Create and start mysql container: `docker run -p 127.0.0.1:3306:3306 --name mdb -e MARIADB_ALLOW_EMPTY_ROOT_PASSWORD=TRUE -d mariadb:latest`
|
|
5
5
|
3. (optional) Connect to mysql cli: `docker exec -it mdb mariadb --user root`
|
|
6
|
+
|
|
7
|
+
# What the driver's log lines carry
|
|
8
|
+
|
|
9
|
+
The driver never prints the value of a parameter bound to a statement. Its failure line (`Failed when executing sql`, at error) carries the SQL text (placeholders only), as `params` a description of each parameter (its position — or, for a bindings dictionary bound to `:name` placeholders, its name — the kind of its value and, for strings, arrays and bytes, its length), and as `cause` a summary of the failure: the error's name, the vendor's codes (`ER_DUP_ENTRY`, errno, SQLSTATE) and the server's own message. The vendor error itself is no longer on the line: the query layer rewrites a failed query's `message` to the SQL with every binding interpolated, and the client library's error carries the same text as `sql`.
|
|
10
|
+
|
|
11
|
+
To debug against a local dev database with the real values, set `DB_LOG_PARAM_VALUES=1` in a process that also has `DEVELOPMENT` set: the line then adds `paramValues` (the parameters as bound) and carries the vendor error itself as `error`. With either variable unset the line never carries them. The switch changes the log line only.
|
|
12
|
+
|
|
13
|
+
Writing the line never changes what the driver throws. The description is built for whatever bindings the statement carries (a value that cannot be read is described as `unreadable`), and the line is written through one guarded door: if building or writing it fails — a log writer that throws, a value the writer cannot serialize — the driver writes the fixed line `Failed to write a statement log line` instead, which carries nothing of the statement, and throws the vendor's error exactly as it was going to.
|
|
14
|
+
|
|
15
|
+
What this does NOT cover: the driver throws the vendor's error untouched, exactly as before — so a caller that prints what it catches still prints the interpolated SQL — and the server's own message can echo a bound value (`Duplicate entry '…' for key …`), which the `cause` summary passes on as `sqlMessage`. Closing those is parked on the branch `fix/driver-logs-never-carry-param-values`, pending a decision.
|
package/dist/generated/index.js
CHANGED
|
@@ -20,7 +20,7 @@ require("@proteinjs/db-query");
|
|
|
20
20
|
require("@proteinjs/db-transaction-context");
|
|
21
21
|
require("@proteinjs/logger");
|
|
22
22
|
/** Generate Source Graph */
|
|
23
|
-
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\":\"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\"},{\"name\":\"getTable\",\"type\":{\"packageName\":\"\",\"name\":\"((name: string) => Table<any>) | undefined\",\"filePath\":null,\"qualifiedName\":\"/((name: string) => Table<any>) | undefined\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"}],\"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\":\"createDb\",\"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\":\"name\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"options\",\"type\":{\"packageName\":\"@proteinjs/db-driver-knex\",\"name\":\"{ ddl?: string[] }\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db-driver-knex/{ ddl?: string[] }\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"dropDb\",\"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\":\"name\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}}]},{\"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\":\"public\",\"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\":\"handleCaseSensitivity\",\"returnType\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"tableName\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"columnName\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"caseSensitive\",\"type\":{\"packageName\":\"\",\"name\":\"boolean\",\"filePath\":null,\"qualifiedName\":\"/boolean\",\"typeParameters\":null,\"directParents\":null}}]},{\"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: DbDriverQueryStatementConfig) => Statement\",\"filePath\":null,\"qualifiedName\":\"/(config: DbDriverQueryStatementConfig) => Statement\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"transaction\",\"type\":{\"packageName\":\"knex\",\"name\":\"Transaction\",\"filePath\":null,\"qualifiedName\":\"knex/Transaction\",\"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: DbDriverDmlStatementConfig) => Statement\",\"filePath\":null,\"qualifiedName\":\"/(config: DbDriverDmlStatementConfig) => Statement\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"transaction\",\"type\":{\"packageName\":\"knex\",\"name\":\"Transaction\",\"filePath\":null,\"qualifiedName\":\"knex/Transaction\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"runTransaction\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<T>\",\"filePath\":null,\"qualifiedName\":\"/Promise<T>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"fn\",\"type\":{\"packageName\":\"\",\"name\":\"(transaction: Transaction) => Promise<T>\",\"filePath\":null,\"qualifiedName\":\"/(transaction: Transaction) => Promise<T>\",\"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\":\"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\":\"createTables\",\"returnType\":null,\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"tables\",\"type\":{\"packageName\":\"\",\"name\":\"Table<any>[]\",\"filePath\":null,\"qualifiedName\":\"/Table<any>[]\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"createTable\",\"returnType\":null,\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\",\"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\"}]}";
|
|
23
|
+
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\":\"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\"},{\"name\":\"getTable\",\"type\":{\"packageName\":\"\",\"name\":\"((name: string) => Table<any>) | undefined\",\"filePath\":null,\"qualifiedName\":\"/((name: string) => Table<any>) | undefined\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"}],\"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\":\"createDb\",\"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\":\"name\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"options\",\"type\":{\"packageName\":\"@proteinjs/db-driver-knex\",\"name\":\"{ ddl?: string[] }\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db-driver-knex/{ ddl?: string[] }\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"dropDb\",\"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\":\"name\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}}]},{\"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\":\"public\",\"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\":\"handleCaseSensitivity\",\"returnType\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"tableName\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"columnName\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"caseSensitive\",\"type\":{\"packageName\":\"\",\"name\":\"boolean\",\"filePath\":null,\"qualifiedName\":\"/boolean\",\"typeParameters\":null,\"directParents\":null}}]},{\"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: DbDriverQueryStatementConfig) => Statement\",\"filePath\":null,\"qualifiedName\":\"/(config: DbDriverQueryStatementConfig) => Statement\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"transaction\",\"type\":{\"packageName\":\"knex\",\"name\":\"Transaction\",\"filePath\":null,\"qualifiedName\":\"knex/Transaction\",\"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: DbDriverDmlStatementConfig) => Statement\",\"filePath\":null,\"qualifiedName\":\"/(config: DbDriverDmlStatementConfig) => Statement\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"transaction\",\"type\":{\"packageName\":\"knex\",\"name\":\"Transaction\",\"filePath\":null,\"qualifiedName\":\"knex/Transaction\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"runTransaction\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<T>\",\"filePath\":null,\"qualifiedName\":\"/Promise<T>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"fn\",\"type\":{\"packageName\":\"\",\"name\":\"(transaction: Transaction) => Promise<T>\",\"filePath\":null,\"qualifiedName\":\"/(transaction: Transaction) => Promise<T>\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"logFailure\",\"returnType\":{\"packageName\":\"\",\"name\":\"void\",\"filePath\":null,\"qualifiedName\":\"/void\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\",\"parameters\":[{\"name\":\"sql\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"params\",\"type\":{\"packageName\":\"\",\"name\":\"unknown\",\"filePath\":null,\"qualifiedName\":\"/unknown\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"error\",\"type\":{\"packageName\":\"\",\"name\":\"unknown\",\"filePath\":null,\"qualifiedName\":\"/unknown\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"writeStatementLine\",\"returnType\":{\"packageName\":\"\",\"name\":\"void\",\"filePath\":null,\"qualifiedName\":\"/void\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\",\"parameters\":[{\"name\":\"write\",\"type\":{\"packageName\":\"\",\"name\":\"() => void\",\"filePath\":null,\"qualifiedName\":\"/() => void\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"causeSummary\",\"returnType\":{\"packageName\":\"@proteinjs/db-driver-knex\",\"name\":\"FailureCauseSummary\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db-driver-knex/FailureCauseSummary\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\",\"parameters\":[{\"name\":\"error\",\"type\":{\"packageName\":\"\",\"name\":\"unknown\",\"filePath\":null,\"qualifiedName\":\"/unknown\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"describeParams\",\"returnType\":{\"packageName\":\"\",\"name\":\"ParamsDescription | undefined\",\"filePath\":null,\"qualifiedName\":\"/ParamsDescription | undefined\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\",\"parameters\":[{\"name\":\"params\",\"type\":{\"packageName\":\"\",\"name\":\"unknown\",\"filePath\":null,\"qualifiedName\":\"/unknown\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"describeParam\",\"returnType\":{\"packageName\":\"@proteinjs/db-driver-knex\",\"name\":\"ParamDescription\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db-driver-knex/ParamDescription\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\",\"parameters\":[{\"name\":\"read\",\"type\":{\"packageName\":\"\",\"name\":\"() => unknown\",\"filePath\":null,\"qualifiedName\":\"/() => unknown\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"paramKind\",\"returnType\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\",\"parameters\":[{\"name\":\"value\",\"type\":{\"packageName\":\"\",\"name\":\"unknown\",\"filePath\":null,\"qualifiedName\":\"/unknown\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"isDictionary\",\"returnType\":{\"packageName\":\"\",\"name\":\"params is { [name: string]: unknown }\",\"filePath\":null,\"qualifiedName\":\"/params is { [name: string]: unknown }\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\",\"parameters\":[{\"name\":\"params\",\"type\":{\"packageName\":\"\",\"name\":\"unknown\",\"filePath\":null,\"qualifiedName\":\"/unknown\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"vendorFact\",\"returnType\":{\"packageName\":\"\",\"name\":\"unknown\",\"filePath\":null,\"qualifiedName\":\"/unknown\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\",\"parameters\":[{\"name\":\"error\",\"type\":{\"packageName\":\"\",\"name\":\"unknown\",\"filePath\":null,\"qualifiedName\":\"/unknown\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"fact\",\"type\":{\"packageName\":\"\",\"name\":\"keyof FailureCauseSummary\",\"filePath\":null,\"qualifiedName\":\"/keyof FailureCauseSummary\",\"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\":\"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\":\"createTables\",\"returnType\":null,\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"tables\",\"type\":{\"packageName\":\"\",\"name\":\"Table<any>[]\",\"filePath\":null,\"qualifiedName\":\"/Table<any>[]\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"createTable\",\"returnType\":null,\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\",\"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\"}]}";
|
|
24
24
|
/** Generate Source Links */
|
|
25
25
|
var KnexDriver_1 = require("../src/KnexDriver");
|
|
26
26
|
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,6CAA2C;AAC3C,6BAA2B;AAG3B,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,6CAA2C;AAC3C,6BAA2B;AAG3B,4BAA4B;AAE5B,IAAM,WAAW,GAAG,uxgBAAuxgB,CAAC;AAG5ygB,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"}
|
|
@@ -20,7 +20,7 @@ require("@proteinjs/db-query");
|
|
|
20
20
|
require("@proteinjs/db-transaction-context");
|
|
21
21
|
require("@proteinjs/logger");
|
|
22
22
|
/** Generate Source Graph */
|
|
23
|
-
var sourceGraph = "{\"options\":{\"directed\":true,\"multigraph\":false,\"compound\":false},\"nodes\":[{\"v\":\"@proteinjs/db-driver-knex/TestDbDriverFactory\",\"value\":{\"packageName\":\"@proteinjs/db-driver-knex\",\"name\":\"TestDbDriverFactory\",\"filePath\":\"test/config/TestDbDriverFactory.ts\",\"qualifiedName\":\"@proteinjs/db-driver-knex/TestDbDriverFactory\",\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"properties\":[],\"methods\":[{\"name\":\"getDbDriver\",\"returnType\":{\"packageName\":\"@proteinjs/db\",\"name\":\"DbDriver\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db/DbDriver\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[]}],\"typeParameters\":[],\"directParentInterfaces\":[{\"packageName\":\"@proteinjs/db\",\"name\":\"DefaultDbDriverFactory\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db/DefaultDbDriverFactory\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParents\":[]}],\"directParentClasses\":[],\"sourceType\":2}},{\"v\":\"@proteinjs/db/DefaultDbDriverFactory\"},{\"v\":\"@proteinjs/db-driver-knex/KnexDriver\",\"value\":{\"packageName\":\"@proteinjs/db-driver-knex\",\"name\":\"KnexDriver\",\"filePath\":\"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\"},{\"name\":\"getTable\",\"type\":{\"packageName\":\"\",\"name\":\"((name: string) => Table<any>) | undefined\",\"filePath\":null,\"qualifiedName\":\"/((name: string) => Table<any>) | undefined\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"}],\"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\":\"createDb\",\"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\":\"name\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"options\",\"type\":{\"packageName\":\"@proteinjs/db-driver-knex\",\"name\":\"{ ddl?: string[] }\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db-driver-knex/{ ddl?: string[] }\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"dropDb\",\"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\":\"name\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}}]},{\"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\":\"public\",\"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\":\"handleCaseSensitivity\",\"returnType\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"tableName\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"columnName\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"caseSensitive\",\"type\":{\"packageName\":\"\",\"name\":\"boolean\",\"filePath\":null,\"qualifiedName\":\"/boolean\",\"typeParameters\":null,\"directParents\":null}}]},{\"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: DbDriverQueryStatementConfig) => Statement\",\"filePath\":null,\"qualifiedName\":\"/(config: DbDriverQueryStatementConfig) => Statement\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"transaction\",\"type\":{\"packageName\":\"knex\",\"name\":\"Transaction\",\"filePath\":null,\"qualifiedName\":\"knex/Transaction\",\"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: DbDriverDmlStatementConfig) => Statement\",\"filePath\":null,\"qualifiedName\":\"/(config: DbDriverDmlStatementConfig) => Statement\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"transaction\",\"type\":{\"packageName\":\"knex\",\"name\":\"Transaction\",\"filePath\":null,\"qualifiedName\":\"knex/Transaction\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"runTransaction\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<T>\",\"filePath\":null,\"qualifiedName\":\"/Promise<T>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"fn\",\"type\":{\"packageName\":\"\",\"name\":\"(transaction: Transaction) => Promise<T>\",\"filePath\":null,\"qualifiedName\":\"/(transaction: Transaction) => Promise<T>\",\"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\":\"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\":\"createTables\",\"returnType\":null,\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"tables\",\"type\":{\"packageName\":\"\",\"name\":\"Table<any>[]\",\"filePath\":null,\"qualifiedName\":\"/Table<any>[]\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"createTable\",\"returnType\":null,\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\",\"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/TestDbDriverFactory\",\"w\":\"@proteinjs/db/DefaultDbDriverFactory\",\"value\":\"implements interface\"},{\"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\"}]}";
|
|
23
|
+
var sourceGraph = "{\"options\":{\"directed\":true,\"multigraph\":false,\"compound\":false},\"nodes\":[{\"v\":\"@proteinjs/db-driver-knex/TestDbDriverFactory\",\"value\":{\"packageName\":\"@proteinjs/db-driver-knex\",\"name\":\"TestDbDriverFactory\",\"filePath\":\"test/config/TestDbDriverFactory.ts\",\"qualifiedName\":\"@proteinjs/db-driver-knex/TestDbDriverFactory\",\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"properties\":[],\"methods\":[{\"name\":\"getDbDriver\",\"returnType\":{\"packageName\":\"@proteinjs/db\",\"name\":\"DbDriver\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db/DbDriver\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[]}],\"typeParameters\":[],\"directParentInterfaces\":[{\"packageName\":\"@proteinjs/db\",\"name\":\"DefaultDbDriverFactory\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db/DefaultDbDriverFactory\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParents\":[]}],\"directParentClasses\":[],\"sourceType\":2}},{\"v\":\"@proteinjs/db/DefaultDbDriverFactory\"},{\"v\":\"@proteinjs/db-driver-knex/KnexDriver\",\"value\":{\"packageName\":\"@proteinjs/db-driver-knex\",\"name\":\"KnexDriver\",\"filePath\":\"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\"},{\"name\":\"getTable\",\"type\":{\"packageName\":\"\",\"name\":\"((name: string) => Table<any>) | undefined\",\"filePath\":null,\"qualifiedName\":\"/((name: string) => Table<any>) | undefined\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"}],\"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\":\"createDb\",\"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\":\"name\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"options\",\"type\":{\"packageName\":\"@proteinjs/db-driver-knex\",\"name\":\"{ ddl?: string[] }\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db-driver-knex/{ ddl?: string[] }\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"dropDb\",\"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\":\"name\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}}]},{\"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\":\"public\",\"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\":\"handleCaseSensitivity\",\"returnType\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"tableName\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"columnName\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"caseSensitive\",\"type\":{\"packageName\":\"\",\"name\":\"boolean\",\"filePath\":null,\"qualifiedName\":\"/boolean\",\"typeParameters\":null,\"directParents\":null}}]},{\"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: DbDriverQueryStatementConfig) => Statement\",\"filePath\":null,\"qualifiedName\":\"/(config: DbDriverQueryStatementConfig) => Statement\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"transaction\",\"type\":{\"packageName\":\"knex\",\"name\":\"Transaction\",\"filePath\":null,\"qualifiedName\":\"knex/Transaction\",\"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: DbDriverDmlStatementConfig) => Statement\",\"filePath\":null,\"qualifiedName\":\"/(config: DbDriverDmlStatementConfig) => Statement\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"transaction\",\"type\":{\"packageName\":\"knex\",\"name\":\"Transaction\",\"filePath\":null,\"qualifiedName\":\"knex/Transaction\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"runTransaction\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<T>\",\"filePath\":null,\"qualifiedName\":\"/Promise<T>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"fn\",\"type\":{\"packageName\":\"\",\"name\":\"(transaction: Transaction) => Promise<T>\",\"filePath\":null,\"qualifiedName\":\"/(transaction: Transaction) => Promise<T>\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"logFailure\",\"returnType\":{\"packageName\":\"\",\"name\":\"void\",\"filePath\":null,\"qualifiedName\":\"/void\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\",\"parameters\":[{\"name\":\"sql\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"params\",\"type\":{\"packageName\":\"\",\"name\":\"unknown\",\"filePath\":null,\"qualifiedName\":\"/unknown\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"error\",\"type\":{\"packageName\":\"\",\"name\":\"unknown\",\"filePath\":null,\"qualifiedName\":\"/unknown\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"writeStatementLine\",\"returnType\":{\"packageName\":\"\",\"name\":\"void\",\"filePath\":null,\"qualifiedName\":\"/void\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\",\"parameters\":[{\"name\":\"write\",\"type\":{\"packageName\":\"\",\"name\":\"() => void\",\"filePath\":null,\"qualifiedName\":\"/() => void\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"causeSummary\",\"returnType\":{\"packageName\":\"@proteinjs/db-driver-knex\",\"name\":\"FailureCauseSummary\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db-driver-knex/FailureCauseSummary\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\",\"parameters\":[{\"name\":\"error\",\"type\":{\"packageName\":\"\",\"name\":\"unknown\",\"filePath\":null,\"qualifiedName\":\"/unknown\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"describeParams\",\"returnType\":{\"packageName\":\"\",\"name\":\"ParamsDescription | undefined\",\"filePath\":null,\"qualifiedName\":\"/ParamsDescription | undefined\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\",\"parameters\":[{\"name\":\"params\",\"type\":{\"packageName\":\"\",\"name\":\"unknown\",\"filePath\":null,\"qualifiedName\":\"/unknown\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"describeParam\",\"returnType\":{\"packageName\":\"@proteinjs/db-driver-knex\",\"name\":\"ParamDescription\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db-driver-knex/ParamDescription\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\",\"parameters\":[{\"name\":\"read\",\"type\":{\"packageName\":\"\",\"name\":\"() => unknown\",\"filePath\":null,\"qualifiedName\":\"/() => unknown\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"paramKind\",\"returnType\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\",\"parameters\":[{\"name\":\"value\",\"type\":{\"packageName\":\"\",\"name\":\"unknown\",\"filePath\":null,\"qualifiedName\":\"/unknown\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"isDictionary\",\"returnType\":{\"packageName\":\"\",\"name\":\"params is { [name: string]: unknown }\",\"filePath\":null,\"qualifiedName\":\"/params is { [name: string]: unknown }\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\",\"parameters\":[{\"name\":\"params\",\"type\":{\"packageName\":\"\",\"name\":\"unknown\",\"filePath\":null,\"qualifiedName\":\"/unknown\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"vendorFact\",\"returnType\":{\"packageName\":\"\",\"name\":\"unknown\",\"filePath\":null,\"qualifiedName\":\"/unknown\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\",\"parameters\":[{\"name\":\"error\",\"type\":{\"packageName\":\"\",\"name\":\"unknown\",\"filePath\":null,\"qualifiedName\":\"/unknown\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"fact\",\"type\":{\"packageName\":\"\",\"name\":\"keyof FailureCauseSummary\",\"filePath\":null,\"qualifiedName\":\"/keyof FailureCauseSummary\",\"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\":\"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\":\"createTables\",\"returnType\":null,\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"tables\",\"type\":{\"packageName\":\"\",\"name\":\"Table<any>[]\",\"filePath\":null,\"qualifiedName\":\"/Table<any>[]\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"createTable\",\"returnType\":null,\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\",\"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/TestDbDriverFactory\",\"w\":\"@proteinjs/db/DefaultDbDriverFactory\",\"value\":\"implements interface\"},{\"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\"}]}";
|
|
24
24
|
/** Generate Source Links */
|
|
25
25
|
var TestDbDriverFactory_1 = require("../../test/config/TestDbDriverFactory");
|
|
26
26
|
var KnexDriver_1 = require("../../src/KnexDriver");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../generated/test/index.ts"],"names":[],"mappings":";AAAA,oCAAoC;;;;;;;;;;;;;;;;AAEpC,yBAAuB;AACvB,+BAA6B;AAC7B,6CAA2C;AAC3C,6BAA2B;AAG3B,4BAA4B;AAE5B,IAAM,WAAW,GAAG,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../generated/test/index.ts"],"names":[],"mappings":";AAAA,oCAAoC;;;;;;;;;;;;;;;;AAEpC,yBAAuB;AACvB,+BAA6B;AAC7B,6CAA2C;AAC3C,6BAA2B;AAG3B,4BAA4B;AAE5B,IAAM,WAAW,GAAG,g9iBAAg9iB,CAAC;AAGr+iB,4BAA4B;AAE5B,6EAA4E;AAC5E,mDAAkD;AAClD,uEAAsE;AAEtE,IAAM,WAAW,GAAG;IACnB,+CAA+C,EAAE,yCAAmB;IACpE,sCAAsC,EAAE,uBAAU;IAClD,gDAAgD,EAAE,2CAAoB;CACtE,CAAC;AAGF,kCAAkC;AAElC,oDAAyD;AACzD,6BAAgB,CAAC,KAAK,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;AAGjD,mDAAiC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -16,4 +16,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./src/KnexDriver"), exports);
|
|
18
18
|
__exportStar(require("./src/KnexConfig"), exports);
|
|
19
|
+
__exportStar(require("./src/KnexLogValues"), exports);
|
|
19
20
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC;AACjC,mDAAiC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC;AACjC,mDAAiC;AACjC,sDAAoC"}
|
package/dist/src/KnexDriver.d.ts
CHANGED
|
@@ -44,5 +44,71 @@ export declare class KnexDriver implements DbDriver {
|
|
|
44
44
|
* @returns the return value of the `fn`
|
|
45
45
|
*/
|
|
46
46
|
runTransaction<T>(fn: (transaction: Transaction) => Promise<T>): Promise<T>;
|
|
47
|
+
/**
|
|
48
|
+
* The one line a failed statement writes. What is THROWN is the vendor's error itself, untouched
|
|
49
|
+
* (runQuery rethrows it); this is only what the driver PRINTS of it.
|
|
50
|
+
*
|
|
51
|
+
* The vendor error is not safe to print as it is: the query layer rewrites a failed query's
|
|
52
|
+
* `message` to the SQL with its bindings INTERPOLATED, and the client library's error carries
|
|
53
|
+
* the same formatted text as `sql` — every bound value of the statement, on any line the error
|
|
54
|
+
* reaches. So the line carries the SQL text (placeholders only), the parameters DESCRIBED
|
|
55
|
+
* (describeParams) and a summary of the failure: the error's name, the vendor's codes and the
|
|
56
|
+
* server's own message (`sqlMessage` — which can itself quote a value, e.g. a colliding key; the
|
|
57
|
+
* driver prints it as it always has). The vendor error itself, and the values as bound, ride
|
|
58
|
+
* the line only behind the dev-only switch (KnexLogValues).
|
|
59
|
+
*
|
|
60
|
+
* `params` is whatever the statement carried. `Statement` types it as an array, but the query
|
|
61
|
+
* layer also accepts a bindings dictionary (and wraps anything else as one binding), and
|
|
62
|
+
* runQuery forwards what it was handed — so nothing here may assume a shape. The line is
|
|
63
|
+
* written through writeStatementLine: it sits on the way to a `throw`, and must never be the
|
|
64
|
+
* reason something else is thrown.
|
|
65
|
+
*/
|
|
66
|
+
private logFailure;
|
|
67
|
+
/**
|
|
68
|
+
* The ONE door a statement's log line is written through — the owner of the rule that writing
|
|
69
|
+
* a line can NEVER change what the driver throws. A statement line is written on the way to a
|
|
70
|
+
* `throw`, so whatever goes wrong while building or writing it — a log writer that is down, a
|
|
71
|
+
* serializer meeting a value it cannot print (a bigint or a throwing `toJSON`, under the values
|
|
72
|
+
* switch), a helper meeting a shape nobody foresaw — is caught HERE and reported as one FIXED
|
|
73
|
+
* line that carries nothing of the statement; the caller then throws exactly what it was going
|
|
74
|
+
* to throw. If the logger itself is what failed, the fixed line fails too and is dropped:
|
|
75
|
+
* nothing is left to write with.
|
|
76
|
+
*/
|
|
77
|
+
private writeStatementLine;
|
|
78
|
+
/**
|
|
79
|
+
* The name, codes and server message of any thrown value — never the query layer's rewritten
|
|
80
|
+
* `message` or `sql`. Total: a fact that cannot be read (vendorFact) is left out.
|
|
81
|
+
*/
|
|
82
|
+
private causeSummary;
|
|
83
|
+
/**
|
|
84
|
+
* A statement's bound parameters as a LOG LINE carries them — the one owner of that form: by
|
|
85
|
+
* position, the KIND of each value and, for strings, arrays and bytes, its LENGTH. Never a
|
|
86
|
+
* value: a parameter is row content (a presented token, a credential hash, an address), and a
|
|
87
|
+
* log line outlives and out-travels the row it came from. The SQL text beside it carries `?`
|
|
88
|
+
* placeholders only, so position + kind + length is what locates a failure (which parameter was
|
|
89
|
+
* null, which was oversized) without quoting it.
|
|
90
|
+
*
|
|
91
|
+
* The shapes are the query layer's own: positional bindings (an array) are described by
|
|
92
|
+
* POSITION; a bindings DICTIONARY (a plain object, bound to `:name` placeholders) by entry
|
|
93
|
+
* NAME; no bindings describe nothing; and anything else — null, a scalar, a Map, a Date — is
|
|
94
|
+
* what the query layer binds as ONE parameter, so it is described as one.
|
|
95
|
+
*
|
|
96
|
+
* TOTAL, for any input: a value that cannot be read is described as `unreadable`
|
|
97
|
+
* (describeParam), and bindings that cannot even be walked are the one word `unreadable`.
|
|
98
|
+
*/
|
|
99
|
+
private describeParams;
|
|
100
|
+
/**
|
|
101
|
+
* One bound value, described: its kind, a length for strings, arrays and bytes, null named. The
|
|
102
|
+
* value is READ in here (`read`), so a read that throws — an accessor, a revoked proxy — is
|
|
103
|
+
* described as `unreadable` and its neighbours still are described. A length that is not a
|
|
104
|
+
* number is no length: nothing a value says about itself rides the line but that one number.
|
|
105
|
+
*/
|
|
106
|
+
private describeParam;
|
|
107
|
+
/** The kind of a bound value — a word, never the value. */
|
|
108
|
+
private paramKind;
|
|
109
|
+
/** Whether bindings are a DICTIONARY — a plain object, which the query layer binds by entry name. */
|
|
110
|
+
private isDictionary;
|
|
111
|
+
/** One fact of a thrown value, or nothing when it cannot be read (nothing thrown, a scalar, a throwing accessor). */
|
|
112
|
+
private vendorFact;
|
|
47
113
|
}
|
|
48
114
|
//# sourceMappingURL=KnexDriver.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KnexDriver.d.ts","sourceRoot":"","sources":["../../src/KnexDriver.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,EAAE,EAAE,WAAW,EAAE,MAAM,MAAM,CAAC;AACzC,OAAO,EACL,QAAQ,EACR,4BAA4B,EAC5B,0BAA0B,EAC1B,gBAAgB,EAChB,KAAK,EACL,YAAY,EAEb,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"KnexDriver.d.ts","sourceRoot":"","sources":["../../src/KnexDriver.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,EAAE,EAAE,WAAW,EAAE,MAAM,MAAM,CAAC;AACzC,OAAO,EACL,QAAQ,EACR,4BAA4B,EAC5B,0BAA0B,EAC1B,gBAAgB,EAChB,KAAK,EACL,YAAY,EAEb,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAgBhD;;GAEG;AACH,qBAAa,UAAW,YAAW,QAAQ;IACzC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAO;IAC1B,OAAO,CAAC,MAAM,CAA+C;IAC7D,OAAO,CAAC,MAAM,CAAa;IAC3B,OAAO,CAAC,UAAU,CAAM;IACjB,QAAQ,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,SAAS,CAAC;gBAEhD,MAAM,EAAE,UAAU,EAAE,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,KAAK,CAAC,GAAG,CAAC;IAavE,OAAO,IAAI,IAAI;IAQf,SAAS;IAIH,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC;IAQ1C;;;;OAIG;IACG,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,GAAG,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAUzE,+BAA+B;IACzB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAInC,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAWhD,KAAK;IAKL,IAAI;YAII,uBAAuB;IAOrC,eAAe,IAAI,YAAY;IAM/B;;;;OAIG;IACH,qBAAqB,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,OAAO,GAAG,MAAM;IAsBtF,QAAQ,CACZ,iBAAiB,EAAE,CAAC,MAAM,EAAE,4BAA4B,KAAK,SAAS,EACtE,WAAW,CAAC,EAAE,WAAW,GACxB,OAAO,CAAC,gBAAgB,EAAE,CAAC;IA0BxB,MAAM,CACV,iBAAiB,EAAE,CAAC,MAAM,EAAE,0BAA0B,KAAK,SAAS,EACpE,WAAW,CAAC,EAAE,WAAW,GACxB,OAAO,CAAC,MAAM,CAAC;IAKlB;;;;OAIG;IACG,cAAc,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,WAAW,EAAE,WAAW,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAOjF;;;;;;;;;;;;;;;;;;OAkBG;IACH,OAAO,CAAC,UAAU;IAelB;;;;;;;;;OASG;IACH,OAAO,CAAC,kBAAkB;IAY1B;;;OAGG;IACH,OAAO,CAAC,YAAY;IAepB;;;;;;;;;;;;;;;OAeG;IACH,OAAO,CAAC,cAAc;IAyBtB;;;;;OAKG;IACH,OAAO,CAAC,aAAa;IAmBrB,2DAA2D;IAC3D,OAAO,CAAC,SAAS;IAgBjB,qGAAqG;IACrG,OAAO,CAAC,YAAY;IAQpB,qHAAqH;IACrH,OAAO,CAAC,UAAU;CAOnB"}
|
package/dist/src/KnexDriver.js
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
2
13
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
14
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
15
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -42,6 +53,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
42
53
|
exports.KnexDriver = void 0;
|
|
43
54
|
var knex_1 = __importDefault(require("knex"));
|
|
44
55
|
var db_1 = require("@proteinjs/db");
|
|
56
|
+
var KnexLogValues_1 = require("./KnexLogValues");
|
|
45
57
|
var logger_1 = require("@proteinjs/logger");
|
|
46
58
|
var KnexSchemaOperations_1 = require("./KnexSchemaOperations");
|
|
47
59
|
var KnexColumnTypeFactory_1 = require("./KnexColumnTypeFactory");
|
|
@@ -241,7 +253,7 @@ var KnexDriver = /** @class */ (function () {
|
|
|
241
253
|
case 2: return [2 /*return*/, (_b.sent())[0]]; // returns 2 arrays, first is records, second is metadata per record
|
|
242
254
|
case 3:
|
|
243
255
|
error_1 = _b.sent();
|
|
244
|
-
this.
|
|
256
|
+
this.logFailure(sql, params, error_1);
|
|
245
257
|
throw error_1;
|
|
246
258
|
case 4: return [2 /*return*/];
|
|
247
259
|
}
|
|
@@ -287,6 +299,174 @@ var KnexDriver = /** @class */ (function () {
|
|
|
287
299
|
});
|
|
288
300
|
});
|
|
289
301
|
};
|
|
302
|
+
/**
|
|
303
|
+
* The one line a failed statement writes. What is THROWN is the vendor's error itself, untouched
|
|
304
|
+
* (runQuery rethrows it); this is only what the driver PRINTS of it.
|
|
305
|
+
*
|
|
306
|
+
* The vendor error is not safe to print as it is: the query layer rewrites a failed query's
|
|
307
|
+
* `message` to the SQL with its bindings INTERPOLATED, and the client library's error carries
|
|
308
|
+
* the same formatted text as `sql` — every bound value of the statement, on any line the error
|
|
309
|
+
* reaches. So the line carries the SQL text (placeholders only), the parameters DESCRIBED
|
|
310
|
+
* (describeParams) and a summary of the failure: the error's name, the vendor's codes and the
|
|
311
|
+
* server's own message (`sqlMessage` — which can itself quote a value, e.g. a colliding key; the
|
|
312
|
+
* driver prints it as it always has). The vendor error itself, and the values as bound, ride
|
|
313
|
+
* the line only behind the dev-only switch (KnexLogValues).
|
|
314
|
+
*
|
|
315
|
+
* `params` is whatever the statement carried. `Statement` types it as an array, but the query
|
|
316
|
+
* layer also accepts a bindings dictionary (and wraps anything else as one binding), and
|
|
317
|
+
* runQuery forwards what it was handed — so nothing here may assume a shape. The line is
|
|
318
|
+
* written through writeStatementLine: it sits on the way to a `throw`, and must never be the
|
|
319
|
+
* reason something else is thrown.
|
|
320
|
+
*/
|
|
321
|
+
KnexDriver.prototype.logFailure = function (sql, params, error) {
|
|
322
|
+
var _this = this;
|
|
323
|
+
this.writeStatementLine(function () {
|
|
324
|
+
return _this.logger.error(__assign({ message: "Failed when executing sql", obj: __assign(__assign({ sql: sql, params: _this.describeParams(params) }, KnexLogValues_1.KnexLogValues.ofStatement(params)), { cause: _this.causeSummary(error) }) }, KnexLogValues_1.KnexLogValues.ofFailure(error)));
|
|
325
|
+
});
|
|
326
|
+
};
|
|
327
|
+
/**
|
|
328
|
+
* The ONE door a statement's log line is written through — the owner of the rule that writing
|
|
329
|
+
* a line can NEVER change what the driver throws. A statement line is written on the way to a
|
|
330
|
+
* `throw`, so whatever goes wrong while building or writing it — a log writer that is down, a
|
|
331
|
+
* serializer meeting a value it cannot print (a bigint or a throwing `toJSON`, under the values
|
|
332
|
+
* switch), a helper meeting a shape nobody foresaw — is caught HERE and reported as one FIXED
|
|
333
|
+
* line that carries nothing of the statement; the caller then throws exactly what it was going
|
|
334
|
+
* to throw. If the logger itself is what failed, the fixed line fails too and is dropped:
|
|
335
|
+
* nothing is left to write with.
|
|
336
|
+
*/
|
|
337
|
+
KnexDriver.prototype.writeStatementLine = function (write) {
|
|
338
|
+
try {
|
|
339
|
+
write();
|
|
340
|
+
}
|
|
341
|
+
catch (_a) {
|
|
342
|
+
try {
|
|
343
|
+
this.logger.error({ message: "Failed to write a statement log line" });
|
|
344
|
+
}
|
|
345
|
+
catch (_b) {
|
|
346
|
+
// The logger itself is what failed: nothing is left to write with, and nothing here may throw.
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
};
|
|
350
|
+
/**
|
|
351
|
+
* The name, codes and server message of any thrown value — never the query layer's rewritten
|
|
352
|
+
* `message` or `sql`. Total: a fact that cannot be read (vendorFact) is left out.
|
|
353
|
+
*/
|
|
354
|
+
KnexDriver.prototype.causeSummary = function (error) {
|
|
355
|
+
var name = this.vendorFact(error, 'name');
|
|
356
|
+
var code = this.vendorFact(error, 'code');
|
|
357
|
+
var errno = this.vendorFact(error, 'errno');
|
|
358
|
+
var sqlState = this.vendorFact(error, 'sqlState');
|
|
359
|
+
var sqlMessage = this.vendorFact(error, 'sqlMessage');
|
|
360
|
+
return __assign(__assign(__assign(__assign(__assign({}, (typeof name === 'string' ? { name: name } : {})), (typeof code === 'string' ? { code: code } : {})), (typeof errno === 'number' ? { errno: errno } : {})), (typeof sqlState === 'string' ? { sqlState: sqlState } : {})), (typeof sqlMessage === 'string' ? { sqlMessage: sqlMessage } : {}));
|
|
361
|
+
};
|
|
362
|
+
/**
|
|
363
|
+
* A statement's bound parameters as a LOG LINE carries them — the one owner of that form: by
|
|
364
|
+
* position, the KIND of each value and, for strings, arrays and bytes, its LENGTH. Never a
|
|
365
|
+
* value: a parameter is row content (a presented token, a credential hash, an address), and a
|
|
366
|
+
* log line outlives and out-travels the row it came from. The SQL text beside it carries `?`
|
|
367
|
+
* placeholders only, so position + kind + length is what locates a failure (which parameter was
|
|
368
|
+
* null, which was oversized) without quoting it.
|
|
369
|
+
*
|
|
370
|
+
* The shapes are the query layer's own: positional bindings (an array) are described by
|
|
371
|
+
* POSITION; a bindings DICTIONARY (a plain object, bound to `:name` placeholders) by entry
|
|
372
|
+
* NAME; no bindings describe nothing; and anything else — null, a scalar, a Map, a Date — is
|
|
373
|
+
* what the query layer binds as ONE parameter, so it is described as one.
|
|
374
|
+
*
|
|
375
|
+
* TOTAL, for any input: a value that cannot be read is described as `unreadable`
|
|
376
|
+
* (describeParam), and bindings that cannot even be walked are the one word `unreadable`.
|
|
377
|
+
*/
|
|
378
|
+
KnexDriver.prototype.describeParams = function (params) {
|
|
379
|
+
if (params === undefined) {
|
|
380
|
+
return undefined;
|
|
381
|
+
}
|
|
382
|
+
try {
|
|
383
|
+
if (Array.isArray(params)) {
|
|
384
|
+
var described = [];
|
|
385
|
+
var _loop_1 = function (position) {
|
|
386
|
+
described.push(this_1.describeParam(function () { return params[position]; }));
|
|
387
|
+
};
|
|
388
|
+
var this_1 = this;
|
|
389
|
+
for (var position = 0; position < params.length; position++) {
|
|
390
|
+
_loop_1(position);
|
|
391
|
+
}
|
|
392
|
+
return described;
|
|
393
|
+
}
|
|
394
|
+
if (this.isDictionary(params)) {
|
|
395
|
+
var described = {};
|
|
396
|
+
var _loop_2 = function (name_1) {
|
|
397
|
+
described[name_1] = this_2.describeParam(function () { return params[name_1]; });
|
|
398
|
+
};
|
|
399
|
+
var this_2 = this;
|
|
400
|
+
for (var _i = 0, _a = Object.keys(params); _i < _a.length; _i++) {
|
|
401
|
+
var name_1 = _a[_i];
|
|
402
|
+
_loop_2(name_1);
|
|
403
|
+
}
|
|
404
|
+
return described;
|
|
405
|
+
}
|
|
406
|
+
return [this.describeParam(function () { return params; })];
|
|
407
|
+
}
|
|
408
|
+
catch (_b) {
|
|
409
|
+
return 'unreadable';
|
|
410
|
+
}
|
|
411
|
+
};
|
|
412
|
+
/**
|
|
413
|
+
* One bound value, described: its kind, a length for strings, arrays and bytes, null named. The
|
|
414
|
+
* value is READ in here (`read`), so a read that throws — an accessor, a revoked proxy — is
|
|
415
|
+
* described as `unreadable` and its neighbours still are described. A length that is not a
|
|
416
|
+
* number is no length: nothing a value says about itself rides the line but that one number.
|
|
417
|
+
*/
|
|
418
|
+
KnexDriver.prototype.describeParam = function (read) {
|
|
419
|
+
try {
|
|
420
|
+
var value = read();
|
|
421
|
+
var description = { type: this.paramKind(value) };
|
|
422
|
+
if (typeof value === 'string' || Array.isArray(value) || value instanceof Uint8Array) {
|
|
423
|
+
var length_1 = value.length;
|
|
424
|
+
if (typeof length_1 === 'number') {
|
|
425
|
+
description.length = length_1;
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
if (value === null || value === undefined) {
|
|
429
|
+
description.null = true;
|
|
430
|
+
}
|
|
431
|
+
return description;
|
|
432
|
+
}
|
|
433
|
+
catch (_a) {
|
|
434
|
+
return { type: 'unreadable' };
|
|
435
|
+
}
|
|
436
|
+
};
|
|
437
|
+
/** The kind of a bound value — a word, never the value. */
|
|
438
|
+
KnexDriver.prototype.paramKind = function (value) {
|
|
439
|
+
if (value === null || value === undefined) {
|
|
440
|
+
return 'null';
|
|
441
|
+
}
|
|
442
|
+
if (Array.isArray(value)) {
|
|
443
|
+
return 'array';
|
|
444
|
+
}
|
|
445
|
+
if (value instanceof Date) {
|
|
446
|
+
return 'date';
|
|
447
|
+
}
|
|
448
|
+
if (value instanceof Uint8Array) {
|
|
449
|
+
return 'bytes';
|
|
450
|
+
}
|
|
451
|
+
return typeof value;
|
|
452
|
+
};
|
|
453
|
+
/** Whether bindings are a DICTIONARY — a plain object, which the query layer binds by entry name. */
|
|
454
|
+
KnexDriver.prototype.isDictionary = function (params) {
|
|
455
|
+
if (typeof params !== 'object' || params === null) {
|
|
456
|
+
return false;
|
|
457
|
+
}
|
|
458
|
+
var prototype = Object.getPrototypeOf(params);
|
|
459
|
+
return prototype === null || Object.getPrototypeOf(prototype) === null;
|
|
460
|
+
};
|
|
461
|
+
/** One fact of a thrown value, or nothing when it cannot be read (nothing thrown, a scalar, a throwing accessor). */
|
|
462
|
+
KnexDriver.prototype.vendorFact = function (error, fact) {
|
|
463
|
+
try {
|
|
464
|
+
return error === null || error === void 0 ? void 0 : error[fact];
|
|
465
|
+
}
|
|
466
|
+
catch (_a) {
|
|
467
|
+
return undefined;
|
|
468
|
+
}
|
|
469
|
+
};
|
|
290
470
|
return KnexDriver;
|
|
291
471
|
}());
|
|
292
472
|
exports.KnexDriver = KnexDriver;
|