@frontegg/rest-api 3.0.90 → 3.0.91

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.
@@ -2,10 +2,11 @@ import { FronteggFeatureFlags, IFeatureFlagsAttributes } from "./interfaces";
2
2
  export declare class FeatureFlags {
3
3
  private _flags;
4
4
  private static _instances;
5
- static getInstance(name?: string): any;
6
- static set(featureFlags?: FronteggFeatureFlags, name?: string): FeatureFlags;
7
- static getFeatureFlags(flags: string[]): boolean[];
8
- get flags(): Required<FronteggFeatureFlags>["flags"];
5
+ constructor();
6
+ static getInstance(name?: string): FeatureFlags;
7
+ static set(featureFlags?: IFeatureFlagsAttributes, name?: string): FeatureFlags;
8
+ static getFeatureFlags(flags: string[], name: string): boolean[];
9
+ get flags(): IFeatureFlagsAttributes;
9
10
  set(featureFlags?: FronteggFeatureFlags): void;
10
11
  }
11
12
  export declare function loadFeatureFlags(): Promise<IFeatureFlagsAttributes>;
@@ -6,7 +6,10 @@ const defaultFeatureFlags = {
6
6
  };
7
7
  export class FeatureFlags {
8
8
  constructor() {
9
- this._flags = defaultFeatureFlags.flags;
9
+ var _defaultFeatureFlags$;
10
+
11
+ this._flags = {};
12
+ this._flags = (_defaultFeatureFlags$ = defaultFeatureFlags.flags) != null ? _defaultFeatureFlags$ : {};
10
13
  }
11
14
 
12
15
  static getInstance(name = "default") {
@@ -20,8 +23,8 @@ export class FeatureFlags {
20
23
  return featureFlagsInstance;
21
24
  }
22
25
 
23
- static getFeatureFlags(flags) {
24
- const featureFlagsInstance = this.getInstance();
26
+ static getFeatureFlags(flags, name) {
27
+ const featureFlagsInstance = this.getInstance(name);
25
28
  return flags.map(flag => (featureFlagsInstance == null ? void 0 : featureFlagsInstance._flags[flag]) === "on");
26
29
  }
27
30
 
@@ -32,9 +35,9 @@ export class FeatureFlags {
32
35
  }
33
36
 
34
37
  set(featureFlags) {
35
- var _defaultFeatureFlags$, _featureFlags$flags;
38
+ var _defaultFeatureFlags$2, _featureFlags$flags;
36
39
 
37
- this._flags = _extends({}, (_defaultFeatureFlags$ = defaultFeatureFlags == null ? void 0 : defaultFeatureFlags.flags) != null ? _defaultFeatureFlags$ : {}, (_featureFlags$flags = featureFlags == null ? void 0 : featureFlags.flags) != null ? _featureFlags$flags : {});
40
+ this._flags = _extends({}, (_defaultFeatureFlags$2 = defaultFeatureFlags == null ? void 0 : defaultFeatureFlags.flags) != null ? _defaultFeatureFlags$2 : {}, (_featureFlags$flags = featureFlags == null ? void 0 : featureFlags.flags) != null ? _featureFlags$flags : {});
38
41
  }
39
42
 
40
43
  }
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v3.0.90
1
+ /** @license Frontegg v3.0.91
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
@@ -20,7 +20,10 @@ const defaultFeatureFlags = {
20
20
 
21
21
  class FeatureFlags {
22
22
  constructor() {
23
- this._flags = defaultFeatureFlags.flags;
23
+ var _defaultFeatureFlags$;
24
+
25
+ this._flags = {};
26
+ this._flags = (_defaultFeatureFlags$ = defaultFeatureFlags.flags) != null ? _defaultFeatureFlags$ : {};
24
27
  }
25
28
 
26
29
  static getInstance(name = "default") {
@@ -34,8 +37,8 @@ class FeatureFlags {
34
37
  return featureFlagsInstance;
35
38
  }
36
39
 
37
- static getFeatureFlags(flags) {
38
- const featureFlagsInstance = this.getInstance();
40
+ static getFeatureFlags(flags, name) {
41
+ const featureFlagsInstance = this.getInstance(name);
39
42
  return flags.map(flag => (featureFlagsInstance == null ? void 0 : featureFlagsInstance._flags[flag]) === "on");
40
43
  }
41
44
 
@@ -46,9 +49,9 @@ class FeatureFlags {
46
49
  }
47
50
 
48
51
  set(featureFlags) {
49
- var _defaultFeatureFlags$, _featureFlags$flags;
52
+ var _defaultFeatureFlags$2, _featureFlags$flags;
50
53
 
51
- this._flags = (0, _extends2.default)({}, (_defaultFeatureFlags$ = defaultFeatureFlags == null ? void 0 : defaultFeatureFlags.flags) != null ? _defaultFeatureFlags$ : {}, (_featureFlags$flags = featureFlags == null ? void 0 : featureFlags.flags) != null ? _featureFlags$flags : {});
54
+ this._flags = (0, _extends2.default)({}, (_defaultFeatureFlags$2 = defaultFeatureFlags == null ? void 0 : defaultFeatureFlags.flags) != null ? _defaultFeatureFlags$2 : {}, (_featureFlags$flags = featureFlags == null ? void 0 : featureFlags.flags) != null ? _featureFlags$flags : {});
52
55
  }
53
56
 
54
57
  }
package/node/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v3.0.90
1
+ /** @license Frontegg v3.0.91
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@frontegg/rest-api",
3
- "version": "3.0.90",
3
+ "version": "3.0.91",
4
4
  "main": "./node/index.js",
5
5
  "license": "MIT",
6
6
  "dependencies": {