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

unleash-client

Package Overview
Dependencies
Maintainers
3
Versions
123
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

unleash-client - npm Package Compare versions

Comparing version 1.0.0-beta.3 to 1.0.0-beta.4

2

lib/repository.js

@@ -23,3 +23,3 @@ 'use strict';

this.appName = appName;
this.storage = new StorageImpl(backupPath);
this.storage = new StorageImpl({ backupPath: backupPath, appName: appName });
this.storage.on('error', function (err) { return _this.emit('error', err); });

@@ -26,0 +26,0 @@ this.storage.on('ready', function () { return _this.emit('ready'); });

@@ -5,2 +5,3 @@ /// <reference types="request" />

url: string;
timeout?: number;
}

@@ -7,0 +8,0 @@ export interface GetRequestOptions extends RequestOptions {

"use strict";
var request = require('request');
exports.post = function (options, cb) {
if (!options.timeout) {
options.timeout = 10000;
}
return request.post(options, cb);

@@ -10,2 +13,3 @@ };

url: url,
timeout: 10000,
headers: {

@@ -12,0 +16,0 @@ 'UNLEASH-APPNAME': appName,

/// <reference types="node" />
import { EventEmitter } from 'events';
export interface StorageOptions {
backupPath: string;
appName: string;
}
export declare class Storage extends EventEmitter implements EventEmitter {
private backupPath;
private ready;
private data;
constructor(backupPath: string);
private path;
constructor({backupPath, appName}: StorageOptions);
reset(data: any, doPersist?: boolean): void;

@@ -9,0 +13,0 @@ get(key: any): any;

@@ -10,9 +10,7 @@ 'use strict';

var fs_1 = require('fs');
var REPO_VERSION = 'schema-v1';
var BACKUP_FILENAME = "/unleash-repo-" + REPO_VERSION + ".json";
var Storage = (function (_super) {
__extends(Storage, _super);
function Storage(backupPath) {
function Storage(_a) {
var backupPath = _a.backupPath, appName = _a.appName;
_super.call(this);
this.backupPath = backupPath;
// ready is a "ready"-flag to signal that storage is ready with data,

@@ -22,2 +20,3 @@ // and to signal to backup not to store fetched backup

this.data = {};
this.path = path_1.join(backupPath, "/unleash-repo-schema-v1-" + appName + ".json");
this.load();

@@ -45,3 +44,3 @@ }

var _this = this;
fs_1.writeFile(path_1.join(this.backupPath, BACKUP_FILENAME), JSON.stringify(this.data), function (err) {
fs_1.writeFile(this.path, JSON.stringify(this.data), function (err) {
if (err) {

@@ -55,3 +54,3 @@ return _this.emit('error', err);

var _this = this;
fs_1.readFile(path_1.join(this.backupPath, BACKUP_FILENAME), 'utf8', function (err, data) {
fs_1.readFile(this.path, 'utf8', function (err, data) {
if (_this.ready) {

@@ -70,2 +69,3 @@ return;

catch (err) {
err.message = "Unleash storage failed parsing file " + _this.path + ": " + err.message;
_this.emit('error', err);

@@ -72,0 +72,0 @@ }

@@ -26,2 +26,7 @@ 'use strict';

}
if (url.endsWith('/features')) {
var oldUrl_1 = url;
process.nextTick(function () { return _this.emit('warn', "Unleash server URL \"" + oldUrl_1 + "\" should no longer link directly to /features"); });
url = url.replace(/\/features$/, '');
}
if (!appName) {

@@ -28,0 +33,0 @@ throw new Error('Unleash client appName missing');

{
"name": "unleash-client",
"version": "1.0.0-beta.3",
"version": "1.0.0-beta.4",
"description": "Unleash Client 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

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