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

@openfeature/server-sdk

Package Overview
Dependencies
Maintainers
0
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@openfeature/server-sdk - npm Package Compare versions

Comparing version 1.16.2 to 1.17.0

30

dist/cjs/index.js

@@ -327,3 +327,3 @@ "use strict";

}
track(occurrenceKey, context, occurrenceDetails) {
track(occurrenceKey, context = {}, occurrenceDetails = {}) {
var _a, _b;

@@ -362,2 +362,3 @@ try {

};
let evaluationDetails;
try {

@@ -367,19 +368,20 @@ const frozenContext = yield this.beforeHooks(allHooks, hookContext, options);

const resolution = yield resolver.call(this._provider, flagKey, defaultValue, frozenContext, this._logger);
const evaluationDetails = __spreadProps(__spreadValues({}, resolution), {
const resolutionDetails = __spreadProps(__spreadValues({}, resolution), {
flagMetadata: Object.freeze((_a = resolution.flagMetadata) != null ? _a : {}),
flagKey
});
if (evaluationDetails.errorCode) {
const err = (0, import_core4.instantiateErrorByErrorCode)(evaluationDetails.errorCode);
if (resolutionDetails.errorCode) {
const err = (0, import_core4.instantiateErrorByErrorCode)(resolutionDetails.errorCode);
yield this.errorHooks(allHooksReversed, hookContext, err, options);
return this.getErrorEvaluationDetails(flagKey, defaultValue, err);
evaluationDetails = this.getErrorEvaluationDetails(flagKey, defaultValue, err, resolutionDetails.flagMetadata);
} else {
yield this.afterHooks(allHooksReversed, hookContext, resolutionDetails, options);
evaluationDetails = resolutionDetails;
}
yield this.afterHooks(allHooksReversed, hookContext, evaluationDetails, options);
return evaluationDetails;
} catch (err) {
yield this.errorHooks(allHooksReversed, hookContext, err, options);
return this.getErrorEvaluationDetails(flagKey, defaultValue, err);
} finally {
yield this.finallyHooks(allHooksReversed, hookContext, options);
evaluationDetails = this.getErrorEvaluationDetails(flagKey, defaultValue, err);
}
yield this.finallyHooks(allHooksReversed, hookContext, evaluationDetails, options);
return evaluationDetails;
});

@@ -421,3 +423,3 @@ }

}
finallyHooks(hooks, hookContext, options) {
finallyHooks(hooks, hookContext, evaluationDetails, options) {
return __async(this, null, function* () {

@@ -427,3 +429,3 @@ var _a;

try {
yield (_a = hook == null ? void 0 : hook.finally) == null ? void 0 : _a.call(hook, hookContext, options.hookHints);
yield (_a = hook == null ? void 0 : hook.finally) == null ? void 0 : _a.call(hook, hookContext, evaluationDetails, options.hookHints);
} catch (err) {

@@ -458,3 +460,3 @@ this._logger.error(`Unhandled error during 'finally' hook: ${err}`);

}
getErrorEvaluationDetails(flagKey, defaultValue, err) {
getErrorEvaluationDetails(flagKey, defaultValue, err, flagMetadata = {}) {
const errorMessage = err == null ? void 0 : err.message;

@@ -467,3 +469,3 @@ const errorCode = (err == null ? void 0 : err.code) || import_core4.ErrorCode.GENERAL;

reason: import_core4.StandardResolutionReasons.ERROR,
flagMetadata: Object.freeze({}),
flagMetadata: Object.freeze(flagMetadata),
flagKey

@@ -470,0 +472,0 @@ };

@@ -316,3 +316,3 @@ var __defProp = Object.defineProperty;

}
track(occurrenceKey, context, occurrenceDetails) {
track(occurrenceKey, context = {}, occurrenceDetails = {}) {
var _a, _b;

@@ -351,2 +351,3 @@ try {

};
let evaluationDetails;
try {

@@ -356,19 +357,20 @@ const frozenContext = yield this.beforeHooks(allHooks, hookContext, options);

const resolution = yield resolver.call(this._provider, flagKey, defaultValue, frozenContext, this._logger);
const evaluationDetails = __spreadProps(__spreadValues({}, resolution), {
const resolutionDetails = __spreadProps(__spreadValues({}, resolution), {
flagMetadata: Object.freeze((_a = resolution.flagMetadata) != null ? _a : {}),
flagKey
});
if (evaluationDetails.errorCode) {
const err = instantiateErrorByErrorCode(evaluationDetails.errorCode);
if (resolutionDetails.errorCode) {
const err = instantiateErrorByErrorCode(resolutionDetails.errorCode);
yield this.errorHooks(allHooksReversed, hookContext, err, options);
return this.getErrorEvaluationDetails(flagKey, defaultValue, err);
evaluationDetails = this.getErrorEvaluationDetails(flagKey, defaultValue, err, resolutionDetails.flagMetadata);
} else {
yield this.afterHooks(allHooksReversed, hookContext, resolutionDetails, options);
evaluationDetails = resolutionDetails;
}
yield this.afterHooks(allHooksReversed, hookContext, evaluationDetails, options);
return evaluationDetails;
} catch (err) {
yield this.errorHooks(allHooksReversed, hookContext, err, options);
return this.getErrorEvaluationDetails(flagKey, defaultValue, err);
} finally {
yield this.finallyHooks(allHooksReversed, hookContext, options);
evaluationDetails = this.getErrorEvaluationDetails(flagKey, defaultValue, err);
}
yield this.finallyHooks(allHooksReversed, hookContext, evaluationDetails, options);
return evaluationDetails;
});

@@ -410,3 +412,3 @@ }

}
finallyHooks(hooks, hookContext, options) {
finallyHooks(hooks, hookContext, evaluationDetails, options) {
return __async(this, null, function* () {

@@ -416,3 +418,3 @@ var _a;

try {
yield (_a = hook == null ? void 0 : hook.finally) == null ? void 0 : _a.call(hook, hookContext, options.hookHints);
yield (_a = hook == null ? void 0 : hook.finally) == null ? void 0 : _a.call(hook, hookContext, evaluationDetails, options.hookHints);
} catch (err) {

@@ -447,3 +449,3 @@ this._logger.error(`Unhandled error during 'finally' hook: ${err}`);

}
getErrorEvaluationDetails(flagKey, defaultValue, err) {
getErrorEvaluationDetails(flagKey, defaultValue, err, flagMetadata = {}) {
const errorMessage = err == null ? void 0 : err.message;

@@ -456,3 +458,3 @@ const errorCode = (err == null ? void 0 : err.code) || ErrorCode2.GENERAL;

reason: StandardResolutionReasons2.ERROR,
flagMetadata: Object.freeze({}),
flagMetadata: Object.freeze(flagMetadata),
flagKey

@@ -459,0 +461,0 @@ };

{
"name": "@openfeature/server-sdk",
"version": "1.16.2",
"version": "1.17.0",
"description": "OpenFeature SDK for JavaScript",

@@ -51,7 +51,7 @@ "main": "./dist/cjs/index.js",

"peerDependencies": {
"@openfeature/core": "^1.5.0"
"@openfeature/core": "^1.6.0"
},
"devDependencies": {
"@openfeature/core": "^1.5.0"
"@openfeature/core": "^1.6.0"
}
}

@@ -19,4 +19,4 @@ <!-- markdownlint-disable MD033 -->

<!-- x-release-please-start-version -->
<a href="https://github.com/open-feature/js-sdk/releases/tag/server-sdk-v1.16.2">
<img alt="Release" src="https://img.shields.io/static/v1?label=release&message=v1.16.2&color=blue&style=for-the-badge" />
<a href="https://github.com/open-feature/js-sdk/releases/tag/server-sdk-v1.17.0">
<img alt="Release" src="https://img.shields.io/static/v1?label=release&message=v1.17.0&color=blue&style=for-the-badge" />
</a>

@@ -387,3 +387,3 @@ <!-- x-release-please-end -->

after(hookContext: HookContext, evaluationDetails: EvaluationDetails<FlagValue>) {
// code that runs when there's an error during a flag evaluation
// code that runs after flag values are successfully resolved from the provider
}

@@ -390,0 +390,0 @@ }

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