Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

prisma-query-log

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prisma-query-log - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

8

index.d.ts

@@ -21,2 +21,10 @@ declare type PrismaQueryEvent = {

unescape?: boolean;
/**
* Color of query (ANSI escape code)
*/
colorQuery?: string;
/**
* Color of parameters (ANSI escape code)
*/
colorParameter?: string;
};

@@ -23,0 +31,0 @@ declare function createPrismaQueryEventHandler(args?: CreatePrismaQueryEventHandlerArgs): (event: PrismaQueryEvent) => void;

15

index.js
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/index.ts
function createPrismaQueryEventHandler(args = {}) {
var _a, _b;
var _a, _b, _c;
const logger = args.logger === true ? console.log : (_a = args.logger) != null ? _a : false;

@@ -9,2 +9,4 @@ if (!logger) {

const unescape = (_b = args.unescape) != null ? _b : true;
const colorParameter = (_c = args.colorParameter) != null ? _c : args.colorQuery;
const colorQuery = args.colorQuery;
return function prismaQueryLog(event) {

@@ -17,5 +19,12 @@ const params = JSON.parse(event.params);

query = query.replace(/\?/g, () => {
return `${JSON.stringify(params.shift())}`;
let parameter = JSON.stringify(params.shift());
if (colorQuery && colorParameter) {
parameter = colorParameter + parameter + "" + colorQuery;
}
return parameter;
});
logger(`${query}`);
if (colorQuery && colorParameter) {
query = colorQuery + query + "";
}
logger(query);
};

@@ -22,0 +31,0 @@ }

2

package.json
{
"name": "prisma-query-log",
"version": "1.0.0",
"version": "1.1.0",
"license": "MIT",

@@ -5,0 +5,0 @@ "description": "Log prisma query event",

@@ -61,5 +61,14 @@ # prisma-query-log

* Remove backticks.
* Default: true
*/
unescape?: boolean;
/**
* Color of query (ANSI escape code)
*/
colorQuery?: string;
/**
* Color of parameters (ANSI escape code)
*/
colorParameter?: string;
};
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc