unleash-client
Advanced tools
Comparing version 3.4.0 to 3.5.0
# Changelog | ||
# 3.5.0 | ||
- fix: Replace deprecated request library with node-fetch | ||
# 3.4.0 | ||
@@ -4,0 +8,0 @@ |
@@ -6,3 +6,3 @@ "use strict"; | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
@@ -9,0 +9,0 @@ }; |
@@ -1,1 +0,1 @@ | ||
{ "name": "unleash-client-node", "version": "3.4.0", "sdkVersion": "unleash-client-node:3.4.0" } | ||
{ "name": "unleash-client-node", "version": "3.5.0", "sdkVersion": "unleash-client-node:3.5.0" } |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.resolveContextValue = exports.createFallbackFunction = void 0; | ||
function createFallbackFunction(name, context, fallback) { | ||
@@ -4,0 +5,0 @@ if (typeof fallback === 'function') { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.countVariant = exports.count = exports.getVariant = exports.getFeatureToggleDefinitions = exports.getFeatureToggleDefinition = exports.destroy = exports.isEnabled = exports.initialize = exports.Unleash = exports.Strategy = void 0; | ||
var unleash_1 = require("./unleash"); | ||
exports.Unleash = unleash_1.Unleash; | ||
Object.defineProperty(exports, "Unleash", { enumerable: true, get: function () { return unleash_1.Unleash; } }); | ||
var variant_1 = require("./variant"); | ||
var index_1 = require("./strategy/index"); | ||
exports.Strategy = index_1.Strategy; | ||
Object.defineProperty(exports, "Strategy", { enumerable: true, get: function () { return index_1.Strategy; } }); | ||
var instance; | ||
@@ -9,0 +10,0 @@ function initialize(options) { |
@@ -6,3 +6,3 @@ "use strict"; | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
@@ -102,6 +102,5 @@ }; | ||
return __awaiter(this, void 0, void 0, function () { | ||
var url, payload, headers, _a; | ||
var _this = this; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
var url, payload, headers, _a, res, _b, _c, err_1; | ||
return __generator(this, function (_d) { | ||
switch (_d.label) { | ||
case 0: | ||
@@ -116,30 +115,40 @@ if (this.disabled) { | ||
case 1: | ||
_a = _b.sent(); | ||
_a = _d.sent(); | ||
return [3 /*break*/, 3]; | ||
case 2: | ||
_a = this.headers; | ||
_b.label = 3; | ||
_d.label = 3; | ||
case 3: | ||
headers = _a; | ||
request_1.post({ | ||
url: url, | ||
json: payload, | ||
appName: this.appName, | ||
instanceId: this.instanceId, | ||
headers: headers, | ||
timeout: this.timeout, | ||
}, function (err, res, body) { | ||
if (err) { | ||
_this.emit('error', err); | ||
return; | ||
} | ||
/* istanbul ignore next if */ | ||
if (!(res.statusCode && res.statusCode >= 200 && res.statusCode < 300)) { | ||
_this.emit('warn', url + " returning " + res.statusCode, body); | ||
return; | ||
} | ||
/* istanbul ignore next line */ | ||
_this.emit('registered', payload); | ||
}); | ||
return [2 /*return*/, true]; | ||
_d.label = 4; | ||
case 4: | ||
_d.trys.push([4, 9, , 10]); | ||
return [4 /*yield*/, request_1.post({ | ||
url: url, | ||
json: payload, | ||
appName: this.appName, | ||
instanceId: this.instanceId, | ||
headers: headers, | ||
timeout: this.timeout, | ||
})]; | ||
case 5: | ||
res = _d.sent(); | ||
if (!!res.ok) return [3 /*break*/, 7]; | ||
// status code outside 200 range | ||
_b = this.emit; | ||
_c = ['warn', url + " returning " + res.status]; | ||
return [4 /*yield*/, res.text()]; | ||
case 6: | ||
// status code outside 200 range | ||
_b.apply(this, _c.concat([_d.sent()])); | ||
return [3 /*break*/, 8]; | ||
case 7: | ||
this.emit('registered', payload); | ||
_d.label = 8; | ||
case 8: return [3 /*break*/, 10]; | ||
case 9: | ||
err_1 = _d.sent(); | ||
this.emit('error', err_1); | ||
return [3 /*break*/, 10]; | ||
case 10: return [2 /*return*/, true]; | ||
} | ||
@@ -151,6 +160,5 @@ }); | ||
return __awaiter(this, void 0, void 0, function () { | ||
var url, payload, headers, _a; | ||
var _this = this; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
var url, payload, headers, _a, res, _b, _c, err_2; | ||
return __generator(this, function (_d) { | ||
switch (_d.label) { | ||
case 0: | ||
@@ -171,36 +179,44 @@ /* istanbul ignore next if */ | ||
case 1: | ||
_a = _b.sent(); | ||
_a = _d.sent(); | ||
return [3 /*break*/, 3]; | ||
case 2: | ||
_a = this.headers; | ||
_b.label = 3; | ||
_d.label = 3; | ||
case 3: | ||
headers = _a; | ||
request_1.post({ | ||
url: url, | ||
json: payload, | ||
appName: this.appName, | ||
instanceId: this.instanceId, | ||
headers: headers, | ||
timeout: this.timeout, | ||
}, function (err, res, body) { | ||
_this.startTimer(); | ||
if (err) { | ||
_this.emit('error', err); | ||
return; | ||
} | ||
/* istanbul ignore next if */ | ||
if (res.statusCode === 404) { | ||
_this.emit('warn', url + " returning 404, stopping metrics"); | ||
_this.stop(); | ||
return; | ||
} | ||
/* istanbul ignore next if */ | ||
if (!(res.statusCode && res.statusCode >= 200 && res.statusCode < 300)) { | ||
_this.emit('warn', url + " returning " + res.statusCode, body); | ||
return; | ||
} | ||
_this.emit('sent', payload); | ||
}); | ||
return [2 /*return*/, true]; | ||
_d.label = 4; | ||
case 4: | ||
_d.trys.push([4, 9, , 10]); | ||
return [4 /*yield*/, request_1.post({ | ||
url: url, | ||
json: payload, | ||
appName: this.appName, | ||
instanceId: this.instanceId, | ||
headers: headers, | ||
timeout: this.timeout, | ||
})]; | ||
case 5: | ||
res = _d.sent(); | ||
this.startTimer(); | ||
if (res.status === 404) { | ||
this.emit('warn', url + " returning 404, stopping metrics"); | ||
this.stop(); | ||
} | ||
if (!!res.ok) return [3 /*break*/, 7]; | ||
_b = this.emit; | ||
_c = ['warn', url + " returning " + res.status]; | ||
return [4 /*yield*/, res.text()]; | ||
case 6: | ||
_b.apply(this, _c.concat([_d.sent()])); | ||
return [3 /*break*/, 8]; | ||
case 7: | ||
this.emit('sent', payload); | ||
_d.label = 8; | ||
case 8: return [3 /*break*/, 10]; | ||
case 9: | ||
err_2 = _d.sent(); | ||
this.emit('error', err_2); | ||
this.startTimer(); | ||
return [3 /*break*/, 10]; | ||
case 10: return [2 /*return*/, true]; | ||
} | ||
@@ -207,0 +223,0 @@ }); |
@@ -38,3 +38,3 @@ /// <reference types="node" /> | ||
validateFeature(feature: FeatureInterface): void; | ||
fetch(): Promise<void>; | ||
fetch(): Promise<boolean | undefined>; | ||
stop(): void; | ||
@@ -41,0 +41,0 @@ getToggle(name: string): FeatureInterface; |
@@ -6,3 +6,3 @@ "use strict"; | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
@@ -103,3 +103,3 @@ }; | ||
return __awaiter(this, void 0, void 0, function () { | ||
var url, headers, _a; | ||
var url, headers, _a, res, data, obj, err_1, err_2; | ||
var _this = this; | ||
@@ -123,41 +123,53 @@ return __generator(this, function (_b) { | ||
headers = _a; | ||
request_1.get({ | ||
url: url, | ||
etag: this.etag, | ||
appName: this.appName, | ||
timeout: this.timeout, | ||
instanceId: this.instanceId, | ||
headers: headers, | ||
}, function (error, res, body) { | ||
// start timer for next fetch | ||
_this.timedFetch(); | ||
if (error) { | ||
return _this.emit('error', error); | ||
} | ||
if (res.statusCode === 304) { | ||
// No new data | ||
_this.emit('unchanged'); | ||
return; | ||
} | ||
if (!(res.statusCode >= 200 && res.statusCode < 300)) { | ||
return _this.emit('error', new Error("Response was not statusCode 2XX, but was " + res.statusCode)); | ||
} | ||
try { | ||
var data = JSON.parse(body); | ||
var obj = data.features.reduce(function (o, feature) { | ||
_this.validateFeature(feature); | ||
o[feature.name] = feature; | ||
return o; | ||
}, {}); | ||
_this.storage.reset(obj); | ||
_this.etag = Array.isArray(res.headers.etag) | ||
? res.headers.etag.join(' ') | ||
: res.headers.etag; | ||
_this.emit('changed', _this.storage.getAll()); | ||
} | ||
catch (err) { | ||
_this.emit('error', err); | ||
} | ||
}); | ||
return [2 /*return*/]; | ||
_b.label = 4; | ||
case 4: | ||
_b.trys.push([4, 11, , 12]); | ||
return [4 /*yield*/, request_1.get({ | ||
url: url, | ||
etag: this.etag, | ||
appName: this.appName, | ||
timeout: this.timeout, | ||
instanceId: this.instanceId, | ||
headers: headers, | ||
})]; | ||
case 5: | ||
res = _b.sent(); | ||
this.timedFetch(); | ||
if (!(res.status === 304)) return [3 /*break*/, 6]; | ||
// No new data | ||
this.emit('unchanged'); | ||
return [3 /*break*/, 10]; | ||
case 6: | ||
if (!!res.ok) return [3 /*break*/, 7]; | ||
return [2 /*return*/, this.emit('error', new Error("Response was not statusCode 2XX, but was " + res.status))]; | ||
case 7: | ||
_b.trys.push([7, 9, , 10]); | ||
return [4 /*yield*/, res.json()]; | ||
case 8: | ||
data = _b.sent(); | ||
obj = data.features.reduce(function (o, feature) { | ||
_this.validateFeature(feature); | ||
o[feature.name] = feature; | ||
return o; | ||
}, {}); | ||
this.storage.reset(obj); | ||
if (res.headers.get('etag') !== null) { | ||
this.etag = res.headers.get('etag'); | ||
} | ||
else { | ||
this.etag = undefined; | ||
} | ||
this.emit('changed', this.storage.getAll()); | ||
return [3 /*break*/, 10]; | ||
case 9: | ||
err_1 = _b.sent(); | ||
this.emit('error', err_1); | ||
return [3 /*break*/, 10]; | ||
case 10: return [3 /*break*/, 12]; | ||
case 11: | ||
err_2 = _b.sent(); | ||
this.emit('error', err_2); | ||
this.timedFetch(); | ||
return [3 /*break*/, 12]; | ||
case 12: return [2 /*return*/]; | ||
} | ||
@@ -164,0 +176,0 @@ }); |
@@ -1,3 +0,5 @@ | ||
import * as request from 'request'; | ||
/// <reference types="node" /> | ||
import { CustomHeaders } from './unleash'; | ||
import * as http from 'http'; | ||
import { URL } from 'url'; | ||
export interface RequestOptions { | ||
@@ -21,4 +23,5 @@ url: string; | ||
} | ||
export declare const post: ({ url, appName, timeout, instanceId, headers, json }: PostRequestOptions, cb: request.RequestCallback) => request.Request; | ||
export declare const get: ({ url, etag, appName, timeout, instanceId, headers }: GetRequestOptions, cb: request.RequestCallback) => request.Request; | ||
export declare const getAgent: (url: URL) => http.Agent; | ||
export declare const post: ({ url, appName, timeout, instanceId, headers, json }: PostRequestOptions) => Promise<import("node-fetch").Response>; | ||
export declare const get: ({ url, etag, appName, timeout, instanceId, headers }: GetRequestOptions) => Promise<import("node-fetch").Response>; | ||
//# sourceMappingURL=request.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var request = require("request"); | ||
exports.post = function (_a, cb) { | ||
exports.get = exports.post = exports.getAgent = void 0; | ||
var node_fetch_1 = require("node-fetch"); | ||
var http = require("http"); | ||
var https = require("https"); | ||
var httpAgent = new http.Agent({ | ||
keepAlive: true, | ||
keepAliveMsecs: 30 * 1000, | ||
timeout: 10 * 1000, | ||
}); | ||
var httpsAgent = new https.Agent({ | ||
keepAlive: true, | ||
keepAliveMsecs: 30 * 1000, | ||
timeout: 10 * 1000, | ||
}); | ||
var getAgent = function (url) { return (url.protocol === 'https:' ? httpsAgent : httpAgent); }; | ||
exports.getAgent = getAgent; | ||
var post = function (_a) { | ||
var url = _a.url, appName = _a.appName, timeout = _a.timeout, instanceId = _a.instanceId, headers = _a.headers, json = _a.json; | ||
var options = { | ||
url: url, | ||
return node_fetch_1.default(url, { | ||
timeout: timeout || 10000, | ||
agentOptions: { | ||
keepAlive: true, | ||
keepAliveMsecs: 30 * 1000, | ||
timeout: timeout || 10 * 1000, | ||
}, | ||
method: 'POST', | ||
agent: exports.getAgent, | ||
headers: Object.assign({ | ||
@@ -18,28 +29,26 @@ 'UNLEASH-APPNAME': appName, | ||
'User-Agent': appName, | ||
'Content-Type': 'application/json', | ||
}, headers), | ||
json: json, | ||
}; | ||
return request.post(options, cb); | ||
body: JSON.stringify(json), | ||
}); | ||
}; | ||
exports.get = function (_a, cb) { | ||
exports.post = post; | ||
var get = function (_a) { | ||
var url = _a.url, etag = _a.etag, appName = _a.appName, timeout = _a.timeout, instanceId = _a.instanceId, headers = _a.headers; | ||
var options = { | ||
url: url, | ||
timeout: timeout || 10000, | ||
agentOptions: { | ||
keepAlive: true, | ||
keepAliveMsecs: 30 * 1000, | ||
timeout: timeout || 10 * 1000, | ||
}, | ||
headers: Object.assign({ | ||
'UNLEASH-APPNAME': appName, | ||
'UNLEASH-INSTANCEID': instanceId, | ||
'User-Agent': appName, | ||
}, headers), | ||
}; | ||
var optHeaders = Object.assign({ | ||
'UNLEASH-APPNAME': appName, | ||
'UNLEASH-INSTANCEID': instanceId, | ||
'User-Agent': appName, | ||
}, headers); | ||
if (etag) { | ||
options.headers['If-None-Match'] = etag; | ||
optHeaders['If-None-Match'] = etag; | ||
} | ||
return request.get(options, cb); | ||
return node_fetch_1.default(url, { | ||
method: 'GET', | ||
timeout: timeout || 10000, | ||
agent: function (url) { return (url.protocol === 'https:' ? httpsAgent : httpAgent); }, | ||
headers: optHeaders, | ||
}); | ||
}; | ||
exports.get = get; | ||
//# sourceMappingURL=request.js.map |
@@ -6,3 +6,3 @@ "use strict"; | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
@@ -17,2 +17,3 @@ }; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Storage = void 0; | ||
var events_1 = require("events"); | ||
@@ -19,0 +20,0 @@ var path_1 = require("path"); |
@@ -6,3 +6,3 @@ "use strict"; | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
@@ -17,2 +17,3 @@ }; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ApplicationHostnameStrategy = void 0; | ||
var strategy_1 = require("./strategy"); | ||
@@ -19,0 +20,0 @@ var os_1 = require("os"); |
@@ -6,3 +6,3 @@ "use strict"; | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
@@ -17,2 +17,3 @@ }; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.DefaultStrategy = void 0; | ||
var strategy_1 = require("./strategy"); | ||
@@ -19,0 +20,0 @@ var DefaultStrategy = /** @class */ (function (_super) { |
@@ -6,3 +6,3 @@ "use strict"; | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
@@ -17,2 +17,3 @@ }; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.FlexibleRolloutStrategy = void 0; | ||
var strategy_1 = require("./strategy"); | ||
@@ -19,0 +20,0 @@ var util_1 = require("./util"); |
@@ -6,3 +6,3 @@ "use strict"; | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
@@ -17,2 +17,3 @@ }; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.GradualRolloutRandomStrategy = void 0; | ||
var strategy_1 = require("./strategy"); | ||
@@ -19,0 +20,0 @@ var GradualRolloutRandomStrategy = /** @class */ (function (_super) { |
@@ -6,3 +6,3 @@ "use strict"; | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
@@ -17,2 +17,3 @@ }; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.GradualRolloutSessionIdStrategy = void 0; | ||
var strategy_1 = require("./strategy"); | ||
@@ -19,0 +20,0 @@ var util_1 = require("./util"); |
@@ -6,3 +6,3 @@ "use strict"; | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
@@ -17,2 +17,3 @@ }; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.GradualRolloutUserIdStrategy = void 0; | ||
var strategy_1 = require("./strategy"); | ||
@@ -19,0 +20,0 @@ var util_1 = require("./util"); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.defaultStrategies = exports.Strategy = void 0; | ||
var default_strategy_1 = require("./default-strategy"); | ||
@@ -12,3 +13,3 @@ var application_hostname_strategy_1 = require("./application-hostname-strategy"); | ||
var strategy_1 = require("./strategy"); | ||
exports.Strategy = strategy_1.Strategy; | ||
Object.defineProperty(exports, "Strategy", { enumerable: true, get: function () { return strategy_1.Strategy; } }); | ||
exports.defaultStrategies = [ | ||
@@ -15,0 +16,0 @@ new default_strategy_1.DefaultStrategy(), |
@@ -6,3 +6,3 @@ "use strict"; | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
@@ -17,2 +17,3 @@ }; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.RemoteAddressStrategy = void 0; | ||
var strategy_1 = require("./strategy"); | ||
@@ -19,0 +20,0 @@ var ip = require('ip'); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Operator = exports.Strategy = void 0; | ||
var helpers_1 = require("../helpers"); | ||
@@ -4,0 +5,0 @@ var Strategy = /** @class */ (function () { |
@@ -6,3 +6,3 @@ "use strict"; | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
@@ -17,2 +17,3 @@ }; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.UserWithIdStrategy = void 0; | ||
var strategy_1 = require("./strategy"); | ||
@@ -19,0 +20,0 @@ var UserWithIdStrategy = /** @class */ (function (_super) { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.normalizedValue = void 0; | ||
var murmurHash3 = require("murmurhash3js"); | ||
@@ -4,0 +5,0 @@ function normalizedValue(id, groupId, normalizer) { |
@@ -6,3 +6,3 @@ "use strict"; | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
@@ -17,2 +17,3 @@ }; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Unleash = exports.Strategy = void 0; | ||
var client_1 = require("./client"); | ||
@@ -22,3 +23,3 @@ var repository_1 = require("./repository"); | ||
var strategy_1 = require("./strategy"); | ||
exports.Strategy = strategy_1.Strategy; | ||
Object.defineProperty(exports, "Strategy", { enumerable: true, get: function () { return strategy_1.Strategy; } }); | ||
var os_1 = require("os"); | ||
@@ -82,3 +83,5 @@ var events_1 = require("events"); | ||
_this.client.on('warn', function (msg) { return _this.emit('warn', msg); }); | ||
_this.emit('ready'); | ||
process.nextTick(function () { | ||
_this.emit('ready'); | ||
}); | ||
}); | ||
@@ -85,0 +88,0 @@ _this.repository.on('error', function (err) { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.selectVariant = exports.getDefaultVariant = void 0; | ||
var util_1 = require("./strategy/util"); | ||
@@ -4,0 +5,0 @@ var helpers_1 = require("./helpers"); |
{ | ||
"name": "unleash-client", | ||
"version": "3.4.0", | ||
"version": "3.5.0", | ||
"description": "Unleash Client for Node", | ||
@@ -13,6 +13,5 @@ "license": "Apache-2.0", | ||
"build": "tsc -p .", | ||
"prepare": "npm run build", | ||
"test": "cross-env NODE_ENV=test npm run build && ava", | ||
"coverage": "nyc --check-coverage=true npm test", | ||
"coveralls": "nyc report --reporter=text-lcov | coveralls" | ||
"prepare": "yarn run build", | ||
"test": "cross-env NODE_ENV=test yarn run build && ava", | ||
"coverage": "nyc --reporter=lcov yarn test" | ||
}, | ||
@@ -35,3 +34,3 @@ "repository": { | ||
"murmurhash3js": "^3.0.1", | ||
"request": "^2.88.2" | ||
"node-fetch": "^2.6.1" | ||
}, | ||
@@ -51,4 +50,4 @@ "engines": { | ||
"@types/node": "^14.0.1", | ||
"@types/request": "^2.48.4", | ||
"@unleash/client-specification": "^3.3.0", | ||
"@types/node-fetch": "^2.5.8", | ||
"@unleash/client-specification": "^3.3.1", | ||
"ava": "^2.2.0", | ||
@@ -62,5 +61,5 @@ "coveralls": "^3.0.3", | ||
"lint-staged": "^10.0.3", | ||
"mkdirp": "^0.5.1", | ||
"mkdirp": "^1.0.4", | ||
"nock": "^12.0.0", | ||
"nyc": "^15.0.0", | ||
"nyc": "^15.1.0", | ||
"prettier": "^1.17.1", | ||
@@ -67,0 +66,0 @@ "sinon": "^9.0.0", |
@@ -6,3 +6,3 @@ # Unleash Client SDK for Node.js | ||
[![Greenkeeper badge](https://badges.greenkeeper.io/Unleash/unleash-client-node.svg)](https://greenkeeper.io/) | ||
[![Build Status](https://travis-ci.org/Unleash/unleash-client-node.svg?branch=master)](https://travis-ci.org/Unleash/unleash-client-node) | ||
[![Build Status](https://github.com/Unleash/unleash-client-node/workflows/Build/badge.svg)](https://github.com/Unleash/unleash-client-node/actions) | ||
[![Code Climate](https://codeclimate.com/github/Unleash/unleash-client-node/badges/gpa.svg)](https://codeclimate.com/github/Unleash/unleash-client-node) | ||
@@ -101,3 +101,3 @@ [![Coverage Status](https://coveralls.io/repos/github/Unleash/unleash-client-node/badge.svg?branch=master)](https://coveralls.io/github/Unleash/unleash-client-node?branch=master) | ||
```javascript | ||
const context = { | ||
const unleashContext = { | ||
userId: '123', | ||
@@ -104,0 +104,0 @@ sessionId: 'some-session-id', |
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
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
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
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 2 instances in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
158508
105
1964
3
+ Addednode-fetch@^2.6.1
+ Addednode-fetch@2.7.0(transitive)
+ Addedtr46@0.0.3(transitive)
+ Addedwebidl-conversions@3.0.1(transitive)
+ Addedwhatwg-url@5.0.0(transitive)
- Removedrequest@^2.88.2
- Removedajv@6.12.6(transitive)
- Removedasn1@0.2.6(transitive)
- Removedassert-plus@1.0.0(transitive)
- Removedasynckit@0.4.0(transitive)
- Removedaws-sign2@0.7.0(transitive)
- Removedaws4@1.13.2(transitive)
- Removedbcrypt-pbkdf@1.0.2(transitive)
- Removedcaseless@0.12.0(transitive)
- Removedcombined-stream@1.0.8(transitive)
- Removedcore-util-is@1.0.2(transitive)
- Removeddashdash@1.14.1(transitive)
- Removeddelayed-stream@1.0.0(transitive)
- Removedecc-jsbn@0.1.2(transitive)
- Removedextend@3.0.2(transitive)
- Removedextsprintf@1.3.0(transitive)
- Removedfast-deep-equal@3.1.3(transitive)
- Removedfast-json-stable-stringify@2.1.0(transitive)
- Removedforever-agent@0.6.1(transitive)
- Removedform-data@2.3.3(transitive)
- Removedgetpass@0.1.7(transitive)
- Removedhar-schema@2.0.0(transitive)
- Removedhar-validator@5.1.5(transitive)
- Removedhttp-signature@1.2.0(transitive)
- Removedis-typedarray@1.0.0(transitive)
- Removedisstream@0.1.2(transitive)
- Removedjsbn@0.1.1(transitive)
- Removedjson-schema@0.4.0(transitive)
- Removedjson-schema-traverse@0.4.1(transitive)
- Removedjson-stringify-safe@5.0.1(transitive)
- Removedjsprim@1.4.2(transitive)
- Removedmime-db@1.52.0(transitive)
- Removedmime-types@2.1.35(transitive)
- Removedoauth-sign@0.9.0(transitive)
- Removedperformance-now@2.1.0(transitive)
- Removedpsl@1.15.0(transitive)
- Removedpunycode@2.3.1(transitive)
- Removedqs@6.5.3(transitive)
- Removedrequest@2.88.2(transitive)
- Removedsafe-buffer@5.2.1(transitive)
- Removedsafer-buffer@2.1.2(transitive)
- Removedsshpk@1.18.0(transitive)
- Removedtough-cookie@2.5.0(transitive)
- Removedtunnel-agent@0.6.0(transitive)
- Removedtweetnacl@0.14.5(transitive)
- Removeduri-js@4.4.1(transitive)
- Removeduuid@3.4.0(transitive)
- Removedverror@1.10.0(transitive)