New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@browserspy/common

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@browserspy/common - npm Package Compare versions

Comparing version 0.6.0 to 0.6.1

8

index.d.ts

@@ -1,10 +0,6 @@

/// <reference types="express" />
/// <reference types="pino" />
import hooks from './lib/hooks';
import { pino } from './lib/logger';
declare const _default: {
hooks: {
middleware(req: import("express").Request, res: import("express").Response, next: import("express").NextFunction): void;
get<T>(key: string): T | null;
set<T>(key: string, value: T): void;
};
hooks: typeof hooks;
pino: typeof pino;

@@ -11,0 +7,0 @@ logger: (name: string, level: string, opts?: pino.LoggerOptions) => import("./lib/logger").ILogger;

@@ -0,8 +1,9 @@

import cls from 'cls-hooked';
import express from 'express';
declare const _default: {
middleware(req: express.Request, res: express.Response, next: express.NextFunction): void;
get<T>(key: string): T | null;
set<T>(key: string, value: T): void;
};
export default _default;
export default class Hooks {
static createNamespace(): cls.Namespace;
static get<T>(key: string): T | null;
static middleware(req: express.Request, res: express.Response, next: express.NextFunction): void;
static set<T>(key: string, value: T): void;
}
//# sourceMappingURL=hooks.d.ts.map

@@ -8,8 +8,9 @@ "use strict";

var namespace = '9ac4700b-2e6b-448a-86c7-2ce53c6fb208';
exports.default = {
middleware: function (req, res, next) {
var ns = cls_hooked_1.default.getNamespace(namespace) || cls_hooked_1.default.createNamespace(namespace);
ns.run(function () { return next(); });
},
get: function (key) {
var Hooks = (function () {
function Hooks() {
}
Hooks.createNamespace = function () {
return cls_hooked_1.default.getNamespace(namespace) || cls_hooked_1.default.createNamespace(namespace);
};
Hooks.get = function (key) {
var ns = cls_hooked_1.default.getNamespace(namespace);

@@ -20,4 +21,8 @@ if (ns && ns.active) {

return null;
},
set: function (key, value) {
};
Hooks.middleware = function (req, res, next) {
Hooks.createNamespace()
.run(function () { return next(); });
};
Hooks.set = function (key, value) {
var ns = cls_hooked_1.default.getNamespace(namespace);

@@ -27,4 +32,6 @@ if (ns && ns.active) {

}
},
};
};
return Hooks;
}());
exports.default = Hooks;
//# sourceMappingURL=hooks.js.map

@@ -20,2 +20,3 @@ import express from 'express';

export declare const getLogId: () => string | null;
export declare const generateLogIdFactory: (logger: ILogger | undefined, priority: (string | undefined)[]) => void;
export declare const generateLogId: (logger: ILogger | undefined) => (req: express.Request, res: express.Response, next: express.NextFunction) => void;

@@ -22,0 +23,0 @@ declare const _default: (name: string, level: string, opts?: pino.LoggerOptions) => ILogger;

@@ -34,8 +34,4 @@ "use strict";

};
exports.generateLogId = function (logger) { return function (req, res, next) {
var priority = [
req.get('x-correlation-id'),
req.get('x-log-id'),
];
var incomingLogId = priority.find(function (fn) { return !!fn; });
exports.generateLogIdFactory = function (logger, priority) {
var incomingLogId = priority.find(function (item) { return !!item; });
if (incomingLogId && logger) {

@@ -54,2 +50,9 @@ logger.debug('Log ID set via headers', {

hooks_1.default.set(exports.logIdKey, logId);
};
exports.generateLogId = function (logger) { return function (req, res, next) {
var priority = [
req.get('x-correlation-id'),
req.get('x-log-id'),
];
exports.generateLogIdFactory(logger, priority);
next();

@@ -56,0 +59,0 @@ }; };

{
"name": "@browserspy/common",
"version": "0.6.0",
"version": "0.6.1",
"description": "",

@@ -5,0 +5,0 @@ "main": "./index",

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

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