@openfeature/flagd-web-provider
Advanced tools
Comparing version 0.3.4 to 0.3.5
32
index.js
import { createPromiseClient, createCallbackClient } from '@bufbuild/connect'; | ||
import { createConnectTransport } from '@bufbuild/connect-web'; | ||
import { proto3, Struct, MethodKind } from '@bufbuild/protobuf'; | ||
import { OpenFeatureEventEmitter, FlagNotFoundError, TypeMismatchError, StandardResolutionReasons, OpenFeature, ProviderEvents } from '@openfeature/web-sdk'; | ||
import { ProviderStatus, OpenFeatureEventEmitter, FlagNotFoundError, TypeMismatchError, StandardResolutionReasons, OpenFeature, ProviderEvents } from '@openfeature/web-sdk'; | ||
@@ -31,4 +31,9 @@ /****************************************************************************** | ||
// @generated by protoc-gen-es v0.1.1 with parameter "target=js+dts" | ||
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { | ||
var e = new Error(message); | ||
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; | ||
}; | ||
// @generated by protoc-gen-es v1.2.1 with parameter "target=js+dts" | ||
/** | ||
@@ -99,2 +104,3 @@ * Request body for bulk flag evaluation, used by the ResolveAll rpc. | ||
{ no: 3, name: "variant", kind: "scalar", T: 9 /* ScalarType.STRING */ }, | ||
{ no: 4, name: "metadata", kind: "message", T: Struct }, | ||
], | ||
@@ -127,2 +133,3 @@ ); | ||
{ no: 3, name: "variant", kind: "scalar", T: 9 /* ScalarType.STRING */ }, | ||
{ no: 4, name: "metadata", kind: "message", T: Struct }, | ||
], | ||
@@ -155,2 +162,3 @@ ); | ||
{ no: 3, name: "variant", kind: "scalar", T: 9 /* ScalarType.STRING */ }, | ||
{ no: 4, name: "metadata", kind: "message", T: Struct }, | ||
], | ||
@@ -183,2 +191,3 @@ ); | ||
{ no: 3, name: "variant", kind: "scalar", T: 9 /* ScalarType.STRING */ }, | ||
{ no: 4, name: "metadata", kind: "message", T: Struct }, | ||
], | ||
@@ -211,2 +220,3 @@ ); | ||
{ no: 3, name: "variant", kind: "scalar", T: 9 /* ScalarType.STRING */ }, | ||
{ no: 4, name: "metadata", kind: "message", T: Struct }, | ||
], | ||
@@ -238,3 +248,3 @@ ); | ||
// @generated by protoc-gen-connect-web v0.2.0 with parameter "target=ts" | ||
// @generated by protoc-gen-connect-es v0.11.0 with parameter "target=ts" | ||
/** | ||
@@ -335,2 +345,3 @@ * Service defines the exposed rpcs of flagd | ||
}; | ||
this._status = ProviderStatus.NOT_READY; | ||
this._connected = false; | ||
@@ -351,2 +362,5 @@ this._retry = 0; | ||
} | ||
get status() { | ||
return this._status; | ||
} | ||
onContextChange(oldContext, newContext) { | ||
@@ -357,3 +371,3 @@ return __awaiter(this, void 0, void 0, function* () { | ||
} | ||
initialize(context) { | ||
initialize() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -363,12 +377,12 @@ yield this.retryConnect(); | ||
} | ||
resolveBooleanEvaluation(flagKey, _) { | ||
resolveBooleanEvaluation(flagKey) { | ||
return this.evaluate(flagKey, 'boolValue'); | ||
} | ||
resolveStringEvaluation(flagKey, _) { | ||
resolveStringEvaluation(flagKey) { | ||
return this.evaluate(flagKey, 'stringValue'); | ||
} | ||
resolveNumberEvaluation(flagKey, _) { | ||
resolveNumberEvaluation(flagKey) { | ||
return this.evaluate(flagKey, 'doubleValue'); | ||
} | ||
resolveObjectEvaluation(flagKey, _) { | ||
resolveObjectEvaluation(flagKey) { | ||
return this.evaluate(flagKey, 'objectValue'); | ||
@@ -409,2 +423,3 @@ } | ||
this.resetConnectionState(); | ||
this._status = ProviderStatus.READY; | ||
resolve(); | ||
@@ -422,2 +437,3 @@ }); | ||
var _a, _b, _c; | ||
this._status = ProviderStatus.ERROR; | ||
(_a = this._logger) === null || _a === void 0 ? void 0 : _a.error(`${FlagdWebProvider.name}: could not establish connection to flagd, ${err === null || err === void 0 ? void 0 : err.message}`); | ||
@@ -424,0 +440,0 @@ (_b = this._logger) === null || _b === void 0 ? void 0 : _b.debug(err === null || err === void 0 ? void 0 : err.stack); |
{ | ||
"name": "@openfeature/flagd-web-provider", | ||
"version": "0.3.4", | ||
"version": "0.3.5", | ||
"type": "module", | ||
@@ -23,6 +23,6 @@ "scripts": { | ||
"dependencies": { | ||
"@bufbuild/connect": "0.8.5", | ||
"@bufbuild/connect-web": "0.8.5", | ||
"@bufbuild/protobuf": "1.2.0" | ||
"@bufbuild/connect": "0.11.0", | ||
"@bufbuild/connect-web": "0.11.0", | ||
"@bufbuild/protobuf": "1.2.1" | ||
} | ||
} |
export * from './lib/flagd-web-provider'; |
import { CallbackClient, PromiseClient } from '@bufbuild/connect'; | ||
import { EvaluationContext, JsonValue, Logger, OpenFeatureEventEmitter, Provider, ResolutionDetails } from '@openfeature/web-sdk'; | ||
import { Service } from '../proto/ts/schema/v1/schema_connectweb'; | ||
import { EvaluationContext, JsonValue, Logger, OpenFeatureEventEmitter, Provider, ProviderStatus, ResolutionDetails } from '@openfeature/web-sdk'; | ||
import { Service } from '../proto/ts/schema/v1/schema_connect'; | ||
import { FlagdProviderOptions } from './options'; | ||
@@ -10,2 +10,3 @@ export declare const ERROR_DISABLED = "DISABLED"; | ||
}; | ||
private _status; | ||
private _connected; | ||
@@ -22,9 +23,10 @@ private _promiseClient; | ||
constructor(options: FlagdProviderOptions, logger?: Logger, promiseClient?: PromiseClient<typeof Service>, callbackClient?: CallbackClient<typeof Service>); | ||
get status(): ProviderStatus; | ||
events: OpenFeatureEventEmitter; | ||
onContextChange(oldContext: EvaluationContext, newContext: EvaluationContext): Promise<void>; | ||
initialize(context: EvaluationContext): Promise<void>; | ||
resolveBooleanEvaluation(flagKey: string, _: boolean): ResolutionDetails<boolean>; | ||
resolveStringEvaluation(flagKey: string, _: string): ResolutionDetails<string>; | ||
resolveNumberEvaluation(flagKey: string, _: number): ResolutionDetails<number>; | ||
resolveObjectEvaluation<U extends JsonValue>(flagKey: string, _: U): ResolutionDetails<U>; | ||
initialize(): Promise<void>; | ||
resolveBooleanEvaluation(flagKey: string): ResolutionDetails<boolean>; | ||
resolveStringEvaluation(flagKey: string): ResolutionDetails<string>; | ||
resolveNumberEvaluation(flagKey: string): ResolutionDetails<number>; | ||
resolveObjectEvaluation<U extends JsonValue>(flagKey: string): ResolutionDetails<U>; | ||
onClose(): Promise<void>; | ||
@@ -31,0 +33,0 @@ private evaluate; |
@@ -0,0 +0,0 @@ export interface Options { |
{ | ||
"module": "commonjs" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
57495
1072
+ Added@bufbuild/connect@0.11.0(transitive)
+ Added@bufbuild/connect-web@0.11.0(transitive)
+ Added@bufbuild/protobuf@1.2.1(transitive)
- Removed@bufbuild/connect@0.8.5(transitive)
- Removed@bufbuild/connect-web@0.8.5(transitive)
- Removed@bufbuild/protobuf@1.2.0(transitive)
Updated@bufbuild/connect@0.11.0
Updated@bufbuild/connect-web@0.11.0
Updated@bufbuild/protobuf@1.2.1