@openfeature/ofrep-web-provider 0.2.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -38,7 +38,7 @@ The provider can use headers from either a static header map or a custom header
38
38
  Headers can be given as a list of tuples or as a map of headers.
39
39
 
40
40
  ```ts
41
- import { OFREPWebProvider } from '@openfeature/ofrep-web';
41
+ import { OFREPWebProvider } from '@openfeature/ofrep-web-provider';
42
42
 
43
43
  OpenFeature.setProvider(
44
44
  new OFREPWebProvider({
@@ -52,7 +52,7 @@ OpenFeature.setProvider(
52
52
  ```
53
53
 
54
54
  ```ts
55
- import { OFREPWebProvider } from '@openfeature/ofrep-web';
55
+ import { OFREPWebProvider } from '@openfeature/ofrep-web-provider';
56
56
 
57
57
  OpenFeature.setProvider(
58
58
  new OFREPWebProvider({
@@ -69,7 +69,7 @@ The header factory is evaluated before every flag evaluation which makes it poss
69
69
  The following shows an example of loading a token and using it as bearer token.
70
70
 
71
71
  ```ts
72
- import { OFREPWebProvider } from '@openfeature/ofrep-web';
72
+ import { OFREPWebProvider } from '@openfeature/ofrep-web-provider';
73
73
 
74
74
  OpenFeature.setProvider(
75
75
  new OFREPWebProvider({
@@ -87,7 +87,7 @@ OpenFeature.setProvider(
87
87
  If needed, a custom fetch implementation can be injected, if e.g. the platform does not have fetch built in.
88
88
 
89
89
  ```ts
90
- import { OFREPWebProvider } from '@openfeature/ofrep-web';
90
+ import { OFREPWebProvider } from '@openfeature/ofrep-web-provider';
91
91
  import { fetchPolyfill } from 'some-fetch-polyfill';
92
92
 
93
93
  OpenFeature.setProvider(
package/index.cjs.js CHANGED
@@ -33,7 +33,7 @@ class OFREPWebProvider {
33
33
  this._options = options;
34
34
  this._logger = logger;
35
35
  this._etag = null;
36
- this._ofrepAPI = new ofrepCore.OFREPApi(this._options.baseUrl, this._options.fetchImplementation);
36
+ this._ofrepAPI = new ofrepCore.OFREPApi(this._options, this._options.fetchImplementation);
37
37
  this._pollingInterval = (_a = this._options.pollInterval) !== null && _a !== void 0 ? _a : this.DEFAULT_POLL_INTERVAL;
38
38
  }
39
39
  /**
@@ -138,10 +138,7 @@ class OFREPWebProvider {
138
138
  const evalReq = {
139
139
  context,
140
140
  };
141
- const options = Object.assign({ headers: new Headers({
142
- 'Content-Type': 'application/json',
143
- }) }, (this._etag !== null ? { headers: { 'If-None-Match': this._etag } } : {}));
144
- const response = yield this._ofrepAPI.postBulkEvaluateFlags(evalReq, options);
141
+ const response = yield this._ofrepAPI.postBulkEvaluateFlags(evalReq, this._etag);
145
142
  if (response.httpStatus === 304) {
146
143
  // nothing has changed since last time, we are doing nothing
147
144
  return { status: BulkEvaluationStatus.SUCCESS_NO_CHANGES, flags: [] };
package/index.esm.js CHANGED
@@ -29,7 +29,7 @@ class OFREPWebProvider {
29
29
  this._options = options;
30
30
  this._logger = logger;
31
31
  this._etag = null;
32
- this._ofrepAPI = new OFREPApi(this._options.baseUrl, this._options.fetchImplementation);
32
+ this._ofrepAPI = new OFREPApi(this._options, this._options.fetchImplementation);
33
33
  this._pollingInterval = (_a = this._options.pollInterval) !== null && _a !== void 0 ? _a : this.DEFAULT_POLL_INTERVAL;
34
34
  }
35
35
  /**
@@ -134,10 +134,7 @@ class OFREPWebProvider {
134
134
  const evalReq = {
135
135
  context,
136
136
  };
137
- const options = Object.assign({ headers: new Headers({
138
- 'Content-Type': 'application/json',
139
- }) }, (this._etag !== null ? { headers: { 'If-None-Match': this._etag } } : {}));
140
- const response = yield this._ofrepAPI.postBulkEvaluateFlags(evalReq, options);
137
+ const response = yield this._ofrepAPI.postBulkEvaluateFlags(evalReq, this._etag);
141
138
  if (response.httpStatus === 304) {
142
139
  // nothing has changed since last time, we are doing nothing
143
140
  return { status: BulkEvaluationStatus.SUCCESS_NO_CHANGES, flags: [] };
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "@openfeature/ofrep-web-provider",
3
- "version": "0.2.0",
3
+ "version": "0.3.1",
4
4
  "dependencies": {
5
- "tslib": "^2.3.0"
5
+ "tslib": "^2.3.0",
6
+ "@openfeature/ofrep-core": "0.2.0"
6
7
  },
7
8
  "main": "./index.cjs.js",
8
9
  "typings": "./src/index.d.ts",
@@ -11,8 +12,7 @@
11
12
  "current-version": "echo $npm_package_version"
12
13
  },
13
14
  "peerDependencies": {
14
- "@openfeature/web-sdk": ">=0.4.0",
15
- "@openfeature/ofrep-core": "^0.1.5"
15
+ "@openfeature/web-sdk": ">=0.4.0"
16
16
  },
17
17
  "exports": {
18
18
  "./package.json": "./package.json",