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

slonik

Package Overview
Dependencies
Maintainers
1
Versions
395
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

slonik - npm Package Compare versions

Comparing version 5.5.0 to 5.6.0

8

dist/config.js

@@ -6,3 +6,3 @@ "use strict";

});
exports.SLONIK_LOG_NORMALISED = exports.SLONIK_LOG_VALUES = void 0;
exports.SLONIK_LOG_VALUES = exports.SLONIK_LOG_STACK_TRACE = exports.SLONIK_LOG_NORMALISED = void 0;

@@ -14,6 +14,8 @@ var _boolean = _interopRequireDefault(require("boolean"));

/* eslint-disable no-process-env */
const SLONIK_LOG_NORMALISED = (0, _boolean.default)(process.env.SLONIK_LOG_NORMALISED);
exports.SLONIK_LOG_NORMALISED = SLONIK_LOG_NORMALISED;
const SLONIK_LOG_STACK_TRACE = (0, _boolean.default)(process.env.SLONIK_LOG_STACK_TRACE);
exports.SLONIK_LOG_STACK_TRACE = SLONIK_LOG_STACK_TRACE;
const SLONIK_LOG_VALUES = (0, _boolean.default)(process.env.SLONIK_LOG_VALUES);
exports.SLONIK_LOG_VALUES = SLONIK_LOG_VALUES;
const SLONIK_LOG_NORMALISED = (0, _boolean.default)(process.env.SLONIK_LOG_NORMALISED);
exports.SLONIK_LOG_NORMALISED = SLONIK_LOG_NORMALISED;
//# sourceMappingURL=config.js.map

@@ -38,2 +38,4 @@ "use strict";

var _stackTrace = require("stack-trace");
var _serializeError = _interopRequireDefault(require("serialize-error"));

@@ -81,2 +83,10 @@

const query = async (connection, rawSql, values, queryId) => {
let stackTrace;
if (_config.SLONIK_LOG_STACK_TRACE) {
stackTrace = (0, _stackTrace.get)().map(callSite => {
return callSite.getFileName() + ':' + callSite.getLineNumber() + ':' + callSite.getColumnNumber();
});
}
const strippedSql = (0, _utilities.stripComments)(rawSql);

@@ -137,2 +147,6 @@ let rowCount = null;

if (_config.SLONIK_LOG_STACK_TRACE) {
payload.stackTrace = stackTrace;
}
if (_config.SLONIK_LOG_VALUES) {

@@ -139,0 +153,0 @@ payload.values = values;

@@ -1,1 +0,1 @@

{"author":{"email":"gajus@gajus.com","name":"Gajus Kuizinas","url":"http://gajus.com"},"ava":{"require":["@babel/register"]},"dependencies":{"ajv":"^5.3.0","array-flatten":"^2.1.1","bluebird":"^3.5.1","boolean":"^0.1.3","es6-error":"^4.0.2","pg":"^7.4.0","pg-connection-string":"^2.0.0","pretty-hrtime":"^1.0.3","roarr":"^2.0.2","serialize-error":"^2.1.0","ulid":"^2.3.0"},"description":"A PostgreSQL client with strict types, detail logging and assertions.","devDependencies":{"@babel/cli":"^7.0.0-beta.46","@babel/core":"^7.0.0-beta.46","@babel/plugin-transform-flow-strip-types":"^7.0.0-beta.46","@babel/preset-env":"^7.0.0-beta.46","@babel/register":"^7.0.0-beta.46","ava":"^1.0.0-beta.4","babel-plugin-istanbul":"^4.1.6","coveralls":"^3.0.0","eslint":"^4.10.0","eslint-config-canonical":"^9.3.1","flow-bin":"^0.71.0","flow-copy-source":"^1.2.1","husky":"^0.14.3","nyc":"^11.7.2","semantic-release":"^8.2.0","sinon":"^4.1.2"},"engines":{"node":">=8.0"},"keywords":["postgresql","promise","types"],"license":"BSD-3-Clause","main":"./dist/index.js","name":"slonik","nyc":{"all":true,"exclude":["src/bin","src/queries/*.js"],"include":["src/**/*.js"],"instrument":false,"reporter":["html","text-summary"],"require":["@babel/register"],"silent":true,"sourceMap":false},"repository":{"type":"git","url":"https://github.com/gajus/slonik"},"scripts":{"build":"rm -fr ./dist && NODE_ENV=production babel ./src --out-dir ./dist --copy-files --source-maps && flow-copy-source src dist","lint":"eslint ./src ./test && flow","precommit":"npm run lint && npm run test","test":"NODE_ENV=test nyc ava --verbose --serial --concurrency 1 && nyc report"},"version":"5.5.0"}
{"author":{"email":"gajus@gajus.com","name":"Gajus Kuizinas","url":"http://gajus.com"},"ava":{"require":["@babel/register"]},"dependencies":{"ajv":"^5.3.0","array-flatten":"^2.1.1","bluebird":"^3.5.1","boolean":"^0.1.3","es6-error":"^4.0.2","pg":"^7.4.0","pg-connection-string":"^2.0.0","pretty-hrtime":"^1.0.3","roarr":"^2.0.2","serialize-error":"^2.1.0","stack-trace":"0.0.10","ulid":"^2.3.0"},"description":"A PostgreSQL client with strict types, detail logging and assertions.","devDependencies":{"@babel/cli":"^7.0.0-beta.46","@babel/core":"^7.0.0-beta.46","@babel/plugin-transform-flow-strip-types":"^7.0.0-beta.46","@babel/preset-env":"^7.0.0-beta.46","@babel/register":"^7.0.0-beta.46","ava":"^1.0.0-beta.4","babel-plugin-istanbul":"^4.1.6","coveralls":"^3.0.0","eslint":"^4.10.0","eslint-config-canonical":"^9.3.1","flow-bin":"^0.71.0","flow-copy-source":"^1.2.1","husky":"^0.14.3","nyc":"^11.7.2","semantic-release":"^8.2.0","sinon":"^4.1.2"},"engines":{"node":">=8.0"},"keywords":["postgresql","promise","types"],"license":"BSD-3-Clause","main":"./dist/index.js","name":"slonik","nyc":{"all":true,"exclude":["src/bin","src/queries/*.js"],"include":["src/**/*.js"],"instrument":false,"reporter":["html","text-summary"],"require":["@babel/register"],"silent":true,"sourceMap":false},"repository":{"type":"git","url":"https://github.com/gajus/slonik"},"scripts":{"build":"rm -fr ./dist && NODE_ENV=production babel ./src --out-dir ./dist --copy-files --source-maps && flow-copy-source src dist","lint":"eslint ./src ./test && flow","precommit":"npm run lint && npm run test","test":"NODE_ENV=test nyc ava --verbose --serial --concurrency 1 && nyc report"},"version":"5.6.0"}

@@ -42,3 +42,4 @@ # Slonik

* [Logging](#logging)
* [Long stack traces](#long-stack-traces)
* [Log stack trace](#log-stack-trace)
* [Long stack trace](#long-stack-trace)
* [Syntax highlighting](#syntax-highlighting)

@@ -538,4 +539,29 @@ * [Atom](#atom)

### Long stack traces
### Log stack trace
`SLONIK_LOG_STACK_TRACE=1` will create a stack trace before invoking the query and include the stack trace in the logs, e.g.
```
[2018-05-19T20:10:37.681Z] DEBUG (20) (@slonik) (#slonik): query
executionTime: 52 ms
queryId: 01CDX0D15XWEHJ0TWNQA97VC7G
rowCount: null
sql: INSERT INTO cinema_movie_name ( cinema_id, name, url, description_blob ) VALUES ( ?, ?, ?, ? ) RETURNING id
stackTrace:
- /src/node_modules/slonik/dist/index.js:85:38
- /src/node_modules/slonik/dist/index.js:173:13
- /src/node_modules/slonik/dist/index.js:231:21
- /src/node_modules/slonik/dist/utilities/mapTaggedTemplateLiteralInvocation.js:17:14
- /src/queries/insertCinemaMovieName.js:11:31
- /src/routines/uploadData.js:101:68
values:
- 1000104
- Solo: A Star Wars Story
- null
- null
```
### Long stack trace
Slonik conditionally uses [Bluebird](http://bluebirdjs.com/docs/api/promise.longstacktraces.html) when `BLUEBIRD_DEBUG=1` is configured.

@@ -542,0 +568,0 @@

@@ -7,3 +7,4 @@ // @flow

export const SLONIK_LOG_NORMALISED = boolean(process.env.SLONIK_LOG_NORMALISED);
export const SLONIK_LOG_STACK_TRACE = boolean(process.env.SLONIK_LOG_STACK_TRACE);
export const SLONIK_LOG_VALUES = boolean(process.env.SLONIK_LOG_VALUES);
export const SLONIK_LOG_NORMALISED = boolean(process.env.SLONIK_LOG_NORMALISED);

@@ -10,2 +10,5 @@ // @flow

import Bluebird from 'bluebird';
import {
get as getStackTrace
} from 'stack-trace';
import serializeError from 'serialize-error';

@@ -49,4 +52,5 @@ import prettyHrtime from 'pretty-hrtime';

import {
SLONIK_LOG_VALUES,
SLONIK_LOG_NORMALISED
SLONIK_LOG_NORMALISED,
SLONIK_LOG_STACK_TRACE,
SLONIK_LOG_VALUES
} from './config';

@@ -93,2 +97,11 @@

export const query: InternalQueryType<*> = async (connection, rawSql, values, queryId) => {
let stackTrace;
if (SLONIK_LOG_STACK_TRACE) {
stackTrace = getStackTrace()
.map((callSite) => {
return callSite.getFileName() + ':' + callSite.getLineNumber() + ':' + callSite.getColumnNumber();
});
}
const strippedSql = stripComments(rawSql);

@@ -152,2 +165,6 @@

if (SLONIK_LOG_STACK_TRACE) {
payload.stackTrace = stackTrace;
}
if (SLONIK_LOG_VALUES) {

@@ -154,0 +171,0 @@ payload.values = values;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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