Skip to content

Commit

Permalink
chore: upgrade flipt-client-browser dep (#1070)
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Phelps <209477+markphelps@users.noreply.github.com>
  • Loading branch information
markphelps authored Oct 18, 2024
1 parent 768007f commit 2d2f70d
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 43 deletions.
37 changes: 18 additions & 19 deletions libs/providers/flipt-web/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion libs/providers/flipt-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@openfeature/flipt-web-provider",
"version": "0.1.0",
"dependencies": {
"@flipt-io/flipt-client-browser": "^0.0.19",
"@flipt-io/flipt-client-browser": "^0.3.1",
"tslib": "^2.3.0"
},
"main": "./src/index.js",
Expand Down
20 changes: 3 additions & 17 deletions libs/providers/flipt-web/src/lib/flipt-web-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ import {
JsonValue,
ResolutionDetails,
Logger,
ProviderStatus,
StandardResolutionReasons,
ErrorCode,
TypeMismatchError,
GeneralError,
ProviderFatalError,
Expand Down Expand Up @@ -80,13 +78,7 @@ export class FliptWebProvider implements Provider {
const evalContext: Record<string, string> = transformContext(context);

try {
const resp = this._client?.evaluateBoolean(flagKey, context.targetingKey ?? '', evalContext);

if (resp?.status === 'failure') {
throw new GeneralError(resp.error_message);
}

const result = resp?.result;
const result = this._client?.evaluateBoolean(flagKey, context.targetingKey ?? '', evalContext);

switch (result?.reason) {
case EvaluationReason.DEFAULT:
Expand Down Expand Up @@ -151,13 +143,7 @@ export class FliptWebProvider implements Provider {
const evalContext: Record<string, string> = transformContext(context);

try {
const resp = this._client?.evaluateVariant(flagKey, context.targetingKey ?? '', evalContext);

if (resp?.status === 'failure') {
throw new GeneralError(resp.error_message);
}

const result = resp?.result;
const result = this._client?.evaluateVariant(flagKey, context.targetingKey ?? '', evalContext);

if (result?.reason === EvaluationReason.FLAG_DISABLED) {
return {
Expand All @@ -175,7 +161,7 @@ export class FliptWebProvider implements Provider {

const flagValue: PrimitiveType | U = validateFlagType(
flagType,
flagType === 'json' ? result.variant_attachment : result.variant_key,
flagType === 'json' ? result.variantAttachment : result.variantKey,
);

return {
Expand Down
9 changes: 4 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"@connectrpc/connect": "^1.4.0",
"@connectrpc/connect-web": "^1.4.0",
"@flipt-io/flipt": "^1.0.0",
"@flipt-io/flipt-client-browser": "^0.0.19",
"@flipt-io/flipt-client-browser": "^0.3.1",
"@growthbook/growthbook": "^1.0.0",
"@grpc/grpc-js": "^1.9.13",
"@opentelemetry/api": "^1.3.0",
Expand Down

0 comments on commit 2d2f70d

Please sign in to comment.