@spotify-confidence/openfeature-server-provider
Advanced tools
Comparing version 0.0.2 to 0.0.3
@@ -0,1 +1,2 @@ | ||
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
@@ -21,6 +22,11 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
}; | ||
import { ProviderStatus, ErrorCode, } from '@openfeature/js-sdk'; | ||
import equal from 'fast-deep-equal'; | ||
import { ApplyManager, Configuration } from '@spotify-confidence/client-http'; | ||
export class ConfidenceServerProvider { | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ConfidenceServerProvider = void 0; | ||
const js_sdk_1 = require("@openfeature/js-sdk"); | ||
const fast_deep_equal_1 = __importDefault(require("fast-deep-equal")); | ||
const client_http_1 = require("@spotify-confidence/client-http"); | ||
class ConfidenceServerProvider { | ||
constructor(client, options) { | ||
@@ -31,6 +37,6 @@ var _a; | ||
}; | ||
this.status = ProviderStatus.READY; | ||
this.status = js_sdk_1.ProviderStatus.READY; | ||
this.configuration = null; | ||
this.client = client; | ||
this.applyManager = new ApplyManager({ client, timeout: ((_a = options === null || options === void 0 ? void 0 : options.apply) === null || _a === void 0 ? void 0 : _a.timeout) || 250 }); | ||
this.applyManager = new client_http_1.ApplyManager({ client, timeout: ((_a = options === null || options === void 0 ? void 0 : options.apply) === null || _a === void 0 ? void 0 : _a.timeout) || 250 }); | ||
} | ||
@@ -47,3 +53,3 @@ convertContext(context) { | ||
return { | ||
errorCode: ErrorCode.PROVIDER_NOT_READY, | ||
errorCode: js_sdk_1.ErrorCode.PROVIDER_NOT_READY, | ||
value: defaultValue, | ||
@@ -58,3 +64,3 @@ reason: 'ERROR', | ||
return { | ||
errorCode: ErrorCode.FLAG_NOT_FOUND, | ||
errorCode: js_sdk_1.ErrorCode.FLAG_NOT_FOUND, | ||
value: defaultValue, | ||
@@ -64,5 +70,5 @@ reason: 'ERROR', | ||
} | ||
if (flag.reason !== Configuration.ResolveReason.Match) { | ||
if (flag.reason !== client_http_1.Configuration.ResolveReason.Match) { | ||
return { | ||
errorCode: ErrorCode.GENERAL, | ||
errorCode: js_sdk_1.ErrorCode.GENERAL, | ||
value: defaultValue, | ||
@@ -105,3 +111,3 @@ reason: flag.reason, | ||
return { | ||
errorCode: ErrorCode.GENERAL, | ||
errorCode: js_sdk_1.ErrorCode.GENERAL, | ||
value: defaultValue, | ||
@@ -115,3 +121,3 @@ reason: 'ERROR', | ||
const [flagName, ..._] = flagKey.split('.'); | ||
if (!!this.configuration && equal(this.configuration.context, this.convertContext(context))) { | ||
if (!!this.configuration && (0, fast_deep_equal_1.default)(this.configuration.context, this.convertContext(context))) { | ||
if (this.configuration.flags[`flags/${flagName}`]) { | ||
@@ -140,2 +146,3 @@ return this.getFlag(flagKey, defaultValue, logger); | ||
} | ||
exports.ConfidenceServerProvider = ConfidenceServerProvider; | ||
//# sourceMappingURL=ConfidenceServerProvider.js.map |
@@ -1,9 +0,13 @@ | ||
import { ConfidenceClient } from '@spotify-confidence/client-http'; | ||
import { ConfidenceServerProvider } from './ConfidenceServerProvider'; | ||
export function createConfidenceServerProvider(options) { | ||
const confidenceClient = new ConfidenceClient(Object.assign(Object.assign({}, options), { apply: !options.apply })); | ||
return new ConfidenceServerProvider(confidenceClient, { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createConfidenceServerProvider = void 0; | ||
const client_http_1 = require("@spotify-confidence/client-http"); | ||
const ConfidenceServerProvider_1 = require("./ConfidenceServerProvider"); | ||
function createConfidenceServerProvider(options) { | ||
const confidenceClient = new client_http_1.ConfidenceClient(Object.assign(Object.assign({}, options), { apply: !options.apply })); | ||
return new ConfidenceServerProvider_1.ConfidenceServerProvider(confidenceClient, { | ||
apply: options.apply, | ||
}); | ||
} | ||
exports.createConfidenceServerProvider = createConfidenceServerProvider; | ||
//# sourceMappingURL=factory.js.map |
@@ -1,2 +0,18 @@ | ||
export * from './factory'; | ||
"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("./factory"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -6,4 +6,8 @@ # Change Log | ||
## <small>0.0.3 (2023-08-29)</small> | ||
- fix: ensure the target output is esm or cjs ([3990909](https://github.com/spotify/confidence-openfeature-provider-js/commit/3990909)) | ||
## <small>0.0.2 (2023-08-29)</small> | ||
- fix: bump openfeature sdks ([0d01b77](https://github.com/spotify/confidence-openfeature-provider-js/commit/0d01b77)), closes [#5](https://github.com/spotify/confidence-openfeature-provider-js/issues/5) |
{ | ||
"name": "@spotify-confidence/openfeature-server-provider", | ||
"license": "Apache-2.0", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"module": "build/esm/index.js", | ||
@@ -9,3 +9,3 @@ "main": "build/cjs/index.js", | ||
"dependencies": { | ||
"@spotify-confidence/client-http": "^0.0.1", | ||
"@spotify-confidence/client-http": "^0.0.2", | ||
"fast-deep-equal": "^3.1.3" | ||
@@ -25,3 +25,3 @@ }, | ||
}, | ||
"gitHead": "99d02572459a332db6926bc10309f165e966431f" | ||
"gitHead": "c377e3d6611011820bd7799860f96aa1f5fcbe0b" | ||
} |
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
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
153072
577
+ Added@spotify-confidence/client-http@0.0.2(transitive)
- Removed@spotify-confidence/client-http@0.0.1(transitive)