prisma-query-log
Advanced tools
Comparing version 1.2.0 to 2.0.0
@@ -32,11 +32,11 @@ declare type PrismaQueryEvent = { | ||
/** | ||
* Poor Man's T-SQL Formatter options | ||
* https://github.com/TaoK/poor-mans-t-sql-formatter-npm-package#usage | ||
* Formatter options | ||
* https://github.com/gwax/sql-formatter#usage | ||
*/ | ||
formatterOptions: { | ||
maxLineWidth: number | undefined; | ||
indent: string | undefined; | ||
expandCommaLists: boolean | undefined; | ||
expandInLists: boolean | undefined; | ||
}; | ||
formatterOptions: Partial<{ | ||
language: string | undefined; | ||
indent: string; | ||
uppercase: boolean; | ||
linesBetweenQueries: number; | ||
}>; | ||
}; | ||
@@ -43,0 +43,0 @@ declare type CreatePrismaQueryEventHandlerArgs = typeof defaultOptions; |
21
index.js
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var __assign = Object.assign; | ||
// src/index.ts | ||
var defaultFormatterOptions = { | ||
language: void 0, | ||
indent: " ", | ||
uppercase: true, | ||
linesBetweenQueries: 1 | ||
}; | ||
var defaultOptions = { | ||
@@ -10,8 +16,3 @@ logger: true, | ||
format: false, | ||
formatterOptions: { | ||
maxLineWidth: 0, | ||
indent: " ", | ||
expandCommaLists: false, | ||
expandInLists: false | ||
} | ||
formatterOptions: defaultFormatterOptions | ||
}; | ||
@@ -39,9 +40,5 @@ var formatter; | ||
if (!formatter) { | ||
formatter = require("poor-mans-t-sql-formatter"); | ||
if (!formatterOptions.maxLineWidth) { | ||
const termSize = require("term-size"); | ||
formatterOptions.maxLineWidth = termSize().columns - 12; | ||
} | ||
formatter = require("@gwax/sql-formatter"); | ||
} | ||
query = "\n" + formatter.formatSql(query, formatterOptions).text.trim(); | ||
query = "\n" + formatter.format(query, formatterOptions).trim(); | ||
} | ||
@@ -48,0 +45,0 @@ query = query.replace(/\?/g, () => { |
{ | ||
"name": "prisma-query-log", | ||
"version": "1.2.0", | ||
"version": "2.0.0", | ||
"license": "MIT", | ||
@@ -82,5 +82,4 @@ "description": "Log prisma query event", | ||
"dependencies": { | ||
"poor-mans-t-sql-formatter": "^1.6.10", | ||
"term-size": "^2.2.1" | ||
"@gwax/sql-formatter": "^3.0.3" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1
9457
120
+ Added@gwax/sql-formatter@^3.0.3
+ Added@gwax/sql-formatter@3.0.3(transitive)
+ Addedargparse@1.0.10(transitive)
+ Addedsprintf-js@1.0.3(transitive)
- Removedpoor-mans-t-sql-formatter@^1.6.10
- Removedterm-size@^2.2.1
- Removedpoor-mans-t-sql-formatter@1.6.10(transitive)
- Removedterm-size@2.2.1(transitive)