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

@unrevealed/node

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@unrevealed/node - npm Package Compare versions

Comparing version 0.0.2-rc.1 to 0.0.2

6

lib/Logger.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Logger = void 0;
class Logger {
exports.UnrevealedLogger = void 0;
class UnrevealedLogger {
log(message) {

@@ -12,2 +12,2 @@ console.log(`[INFO] unrevealed: ${message}`);

}
exports.Logger = Logger;
exports.UnrevealedLogger = UnrevealedLogger;

@@ -1,5 +0,9 @@

export declare class Logger {
export interface Logger {
log(message: string): void;
error(message: string): void;
}
export declare class UnrevealedLogger implements Logger {
log(message: string): void;
error(message: string): void;
}
//# sourceMappingURL=Logger.d.ts.map

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

import { Logger } from './Logger';
export declare enum ReadyState {

@@ -9,2 +10,3 @@ UNINITIALIZED = 0,

apiKey: string;
logger?: Logger;
}

@@ -11,0 +13,0 @@ interface User {

@@ -29,8 +29,7 @@ "use strict";

const RETRY_INTERVAL_MS = 2000;
const RETRY_MAX_ATTEMPTS = 5;
class UnrevealedClient {
constructor(options) {
var _a;
this._eventSource = null;
this._featureAccesses = {};
this._logger = new Logger_1.Logger();
this._readyState = ReadyState.UNINITIALIZED;

@@ -42,2 +41,3 @@ this._connectionPromise = null;

this._trackingUrl = _options.trackingUrl || TRACKING_API_URL;
this._logger = (_a = options.logger) !== null && _a !== void 0 ? _a : new Logger_1.UnrevealedLogger();
}

@@ -49,2 +49,3 @@ get readyState() {

return __awaiter(this, void 0, void 0, function* () {
console.log('connect');
if (this._isReady()) {

@@ -124,7 +125,2 @@ return true;

}
if (attempt >= RETRY_MAX_ATTEMPTS) {
this._logger.error('Maximum connection attempts reached');
this.close();
return;
}
this._logger.error(`Connection to Unrevealed failed: ${err}`);

@@ -145,14 +141,9 @@ this._logger.error(`Reconnecting...`);

return new Promise((resolve, reject) => {
const rejectPromise = (err) => {
reject(err);
};
const resolvePromise = () => {
resolve();
};
try {
const eventSource = this._createEventSource();
eventSource.addEventListener('error', (event) => {
eventSource.addEventListener('error', (event, ...args) => {
console.log('error', event, args);
if (this._readyState === ReadyState.CONNECTING) {
if ('status' in event && event.status === 401) {
rejectPromise(new errors_1.UnauthorizedException());
reject(new errors_1.UnauthorizedException());
return;

@@ -164,3 +155,3 @@ }

}
rejectPromise(errorMessage);
reject(errorMessage);
return;

@@ -171,11 +162,15 @@ }

eventSource.addEventListener('put', (event) => __awaiter(this, void 0, void 0, function* () {
console.log('put', event);
try {
this._handlePut(event);
resolvePromise();
resolve();
}
catch (err) {
rejectPromise(err);
reject(err);
}
}));
eventSource.addEventListener('patch', (event) => this._handlePatch(event));
eventSource.addEventListener('patch', (event) => {
console.log('patch', event);
this._handlePatch(event);
});
this._eventSource = eventSource;

@@ -182,0 +177,0 @@ }

{
"name": "@unrevealed/node",
"version": "0.0.2-rc.1",
"version": "0.0.2",
"description": "Unrevealed SDK for Node",

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

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