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

@aliksend/context

Package Overview
Dependencies
Maintainers
0
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aliksend/context - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

9

dist/_errors.js

@@ -1,5 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.UnauthorizedError = exports.RequestCanceledError = void 0;
class RequestCanceledError extends Error {
export class RequestCanceledError extends Error {
constructor() {

@@ -9,4 +6,3 @@ super('Request canceled');

}
exports.RequestCanceledError = RequestCanceledError;
class UnauthorizedError extends Error {
export class UnauthorizedError extends Error {
constructor() {

@@ -16,3 +12,2 @@ super('Unauthorized');

}
exports.UnauthorizedError = UnauthorizedError;
//# sourceMappingURL=_errors.js.map

@@ -1,7 +0,4 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.formatValueForLog = void 0;
const util_1 = require("util");
const stream_1 = require("stream");
function formatValueForLog(input, parents = []) {
import { inspect } from 'util';
import { Stream } from 'stream';
export function formatValueForLog(input, parents = []) {
if (parents.includes(input)) {

@@ -43,5 +40,5 @@ return '(circular)';

// }
return (0, util_1.inspect)(input, undefined, 10);
return inspect(input, undefined, 10);
}
else if (input instanceof stream_1.Stream) {
else if (input instanceof Stream) {
return '(stream)';

@@ -64,3 +61,2 @@ }

}
exports.formatValueForLog = formatValueForLog;
//# sourceMappingURL=_helper.js.map

@@ -72,3 +72,3 @@ type TagValue = string | number | boolean;

*/
static init(logger: Logger): void;
static setLogger(logger: Logger): void;
/** Get current active context */

@@ -75,0 +75,0 @@ static current(): Context;

@@ -1,15 +0,9 @@

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
var _a;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Context = void 0;
const async_hooks_1 = require("async_hooks");
const crypto_1 = __importDefault(require("crypto"));
const util_1 = __importDefault(require("util"));
const _errors_1 = require("./_errors");
import { AsyncLocalStorage } from 'async_hooks';
import crypto from 'crypto';
import util from 'util';
import { RequestCanceledError, UnauthorizedError } from './_errors';
function genRandomId() {
// return uuid.v4()
return crypto_1.default.randomBytes(8).toString('hex');
return crypto.randomBytes(8).toString('hex');
}

@@ -23,7 +17,7 @@ function camelToSnake(s) {

*/
class Context {
export class Context {
/** Logger, that used to log into stdout */
static #logger;
/** Async storage for current active context */
static #ls = new async_hooks_1.AsyncLocalStorage();
static #ls = new AsyncLocalStorage();
/** List of context trackers */

@@ -35,3 +29,3 @@ static #contextTrackers = new Set();

*/
static init(logger) {
static setLogger(logger) {
this.#logger = logger;

@@ -143,3 +137,3 @@ }

logError(msg, error) {
_a.#logger?.error({ ...this.#metadata(), msg, error: error !== undefined ? util_1.default.inspect(error, undefined, 10) : undefined });
_a.#logger?.error({ ...this.#metadata(), msg, error: error !== undefined ? util.inspect(error, undefined, 10) : undefined });
this.setTag('error', true);

@@ -206,3 +200,3 @@ if (error != null && error instanceof Error) {

if (this.#auth == null) {
throw new _errors_1.UnauthorizedError();
throw new UnauthorizedError();
}

@@ -222,3 +216,3 @@ return this.#auth;

if (this.canceled) {
throw new _errors_1.RequestCanceledError();
throw new RequestCanceledError();
}

@@ -238,4 +232,3 @@ }

}
exports.Context = Context;
_a = Context;
//# sourceMappingURL=context.js.map

@@ -1,18 +0,2 @@

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./context"), exports);
export * from './context';
//# sourceMappingURL=index.js.map
{
"name": "@aliksend/context",
"version": "1.0.0",
"version": "1.0.1",
"description": "Async storage for context",

@@ -12,3 +12,3 @@ "keywords": [

"type": "git",
"url": "https://github.com/aliksend/modular-service.git"
"url": "https://github.com/aliksend/node-packages.git"
},

@@ -23,3 +23,3 @@ "license": "MIT",

"build": "rm -rf dist && tsc",
"lint": "npx @modular-service/linter --fix"
"lint": "npx @aliksend/linter --fix"
},

@@ -26,0 +26,0 @@ "devDependencies": {

@@ -7,3 +7,3 @@ {

"target": "es2022", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', 'ES2021', or 'ESNEXT'. */
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
"module": "es2022", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
"lib": ["es2022"], /* Specify library files to be included in the compilation. */

@@ -10,0 +10,0 @@ // "allowJs": true, /* Allow javascript files to be compiled. */

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