@forge/bridge 6.1.1-next.1 → 6.1.1-next.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @forge/bridge
2
2
 
3
+ ## 6.1.1-next.2
4
+
5
+ ### Patch Changes
6
+
7
+ - f1ec6d7: Remove tracking of client sdk initialisation and checkFlag events
8
+
3
9
  ## 6.1.1-next.1
4
10
 
5
11
  ### Patch Changes
@@ -2,7 +2,6 @@ import { FeatureFlagUser, ForgeFeatureFlagConfig } from './types';
2
2
  export declare class FeatureFlags {
3
3
  private initialized;
4
4
  private evaluator;
5
- private eventProps;
6
5
  /**
7
6
  * Initialize the feature flags client
8
7
  */
@@ -16,6 +15,5 @@ export declare class FeatureFlags {
16
15
  */
17
16
  shutdown(): void;
18
17
  isInitialized(): boolean;
19
- private sendCheckFlagEvent;
20
18
  }
21
19
  //# sourceMappingURL=featureFlags.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"featureFlags.d.ts","sourceRoot":"","sources":["../../src/featureFlags/featureFlags.ts"],"names":[],"mappings":"AAGA,OAAO,EAIL,eAAe,EACf,sBAAsB,EAEvB,MAAM,SAAS,CAAC;AAEjB,qBAAa,YAAY;IACvB,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,SAAS,CAAa;IAC9B,OAAO,CAAC,UAAU,CAAkC;IAEpD;;OAEG;IACU,UAAU,CACrB,IAAI,EAAE,eAAe,EACrB,MAAM,GAAE,sBAAuD,GAC9D,OAAO,CAAC,IAAI,CAAC;IAiBhB;;OAEG;IACI,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,UAAQ,GAAG,OAAO;IAUjE;;OAEG;IACI,QAAQ;IAQR,aAAa;IAIpB,OAAO,CAAC,kBAAkB;CAa3B"}
1
+ {"version":3,"file":"featureFlags.d.ts","sourceRoot":"","sources":["../../src/featureFlags/featureFlags.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAA4B,MAAM,SAAS,CAAC;AAE5F,qBAAa,YAAY;IACvB,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,SAAS,CAAa;IAE9B;;OAEG;IACU,UAAU,CACrB,IAAI,EAAE,eAAe,EACrB,MAAM,GAAE,sBAAuD,GAC9D,OAAO,CAAC,IAAI,CAAC;IAehB;;OAEG;IACI,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,UAAQ,GAAG,OAAO;IAQjE;;OAEG;IACI,QAAQ;IAQR,aAAa;CAGrB"}
@@ -2,13 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.FeatureFlags = void 0;
4
4
  const evaluator_1 = require("./evaluator");
5
- const featureFlagEvents_1 = require("./featureFlagEvents");
6
5
  const initFeatureFlags_1 = require("./initFeatureFlags");
7
- const types_1 = require("./types");
8
6
  class FeatureFlags {
9
7
  constructor() {
10
8
  this.initialized = false;
11
- this.eventProps = {};
12
9
  }
13
10
  /**
14
11
  * Initialize the feature flags client
@@ -20,7 +17,6 @@ class FeatureFlags {
20
17
  if (!(config === null || config === void 0 ? void 0 : config.environment)) {
21
18
  config.environment = 'development';
22
19
  }
23
- this.eventProps.environment = config.environment;
24
20
  const result = await (0, initFeatureFlags_1.initFeatureFlags)({ user, config });
25
21
  this.initialized = true;
26
22
  this.evaluator = new evaluator_1.Evaluator(result);
@@ -30,10 +26,8 @@ class FeatureFlags {
30
26
  */
31
27
  checkFlag(flagName, defaultValue = false) {
32
28
  if (!this.isInitialized() || !this.evaluator) {
33
- this.sendCheckFlagEvent(flagName, false);
34
29
  throw new Error('FeatureFlags not initialized. Call initialize() first.');
35
30
  }
36
- this.sendCheckFlagEvent(flagName, true);
37
31
  return this.evaluator.checkFlag(flagName, defaultValue);
38
32
  }
39
33
  /**
@@ -49,17 +43,5 @@ class FeatureFlags {
49
43
  isInitialized() {
50
44
  return this.initialized;
51
45
  }
52
- sendCheckFlagEvent(flagName, success) {
53
- const props = {
54
- type: types_1.FeatureFlagEventType.CHECKFLAG,
55
- properties: {
56
- ...this.eventProps,
57
- environment: this.eventProps.environment || 'development',
58
- name: flagName,
59
- success
60
- }
61
- };
62
- void (0, featureFlagEvents_1.trackFeatureFlagEvent)(props);
63
- }
64
46
  }
65
47
  exports.FeatureFlags = FeatureFlags;
@@ -13,17 +13,5 @@ export type InitFeatureFlagsPayload = {
13
13
  config: ForgeFeatureFlagConfig;
14
14
  };
15
15
  export type InitFeatureFlagsResponse = Record<string, any> | void;
16
- export declare enum FeatureFlagEventType {
17
- CHECKFLAG = "checkFlag"
18
- }
19
16
  export type FeatureFlagEnvironment = 'development' | 'staging' | 'production';
20
- export type FeatureFlagEventProperties = {
21
- environment?: FeatureFlagEnvironment;
22
- success?: boolean;
23
- name?: string;
24
- };
25
- export type FeatureFlagEventTrackPayload = {
26
- type: FeatureFlagEventType;
27
- properties: FeatureFlagEventProperties;
28
- };
29
17
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/featureFlags/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,sBAAsB;IACrC,WAAW,EAAE,sBAAsB,CAAC;CACrC;AAED,MAAM,WAAW,eAAe;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;IAC7C,WAAW,CAAC,EAAE;QACZ,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;CACH;AAED,MAAM,MAAM,uBAAuB,GAAG;IACpC,IAAI,EAAE,eAAe,CAAC;IACtB,MAAM,EAAE,sBAAsB,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;AAElE,oBAAY,oBAAoB;IAC9B,SAAS,cAAc;CACxB;AAED,MAAM,MAAM,sBAAsB,GAAG,aAAa,GAAG,SAAS,GAAG,YAAY,CAAC;AAE9E,MAAM,MAAM,0BAA0B,GAAG;IACvC,WAAW,CAAC,EAAE,sBAAsB,CAAC;IACrC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,4BAA4B,GAAG;IACzC,IAAI,EAAE,oBAAoB,CAAC;IAC3B,UAAU,EAAE,0BAA0B,CAAC;CACxC,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/featureFlags/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,sBAAsB;IACrC,WAAW,EAAE,sBAAsB,CAAC;CACrC;AAED,MAAM,WAAW,eAAe;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;IAC7C,WAAW,CAAC,EAAE;QACZ,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;CACH;AAED,MAAM,MAAM,uBAAuB,GAAG;IACpC,IAAI,EAAE,eAAe,CAAC;IACtB,MAAM,EAAE,sBAAsB,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;AAElE,MAAM,MAAM,sBAAsB,GAAG,aAAa,GAAG,SAAS,GAAG,YAAY,CAAC"}
@@ -1,7 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FeatureFlagEventType = void 0;
4
- var FeatureFlagEventType;
5
- (function (FeatureFlagEventType) {
6
- FeatureFlagEventType["CHECKFLAG"] = "checkFlag";
7
- })(FeatureFlagEventType || (exports.FeatureFlagEventType = FeatureFlagEventType = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forge/bridge",
3
- "version": "6.1.1-next.1",
3
+ "version": "6.1.1-next.2",
4
4
  "description": "Forge bridge API for custom UI apps",
5
5
  "author": "Atlassian",
6
6
  "license": "SEE LICENSE IN LICENSE.txt",
@@ -1,3 +0,0 @@
1
- import { FeatureFlagEventTrackPayload } from './types';
2
- export declare const trackFeatureFlagEvent: <T>(payload: FeatureFlagEventTrackPayload) => Promise<T>;
3
- //# sourceMappingURL=featureFlagEvents.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"featureFlagEvents.d.ts","sourceRoot":"","sources":["../../src/featureFlags/featureFlagEvents.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,4BAA4B,EAAwB,MAAM,SAAS,CAAC;AA6B7E,eAAO,MAAM,qBAAqB,0DAKjC,CAAC"}
@@ -1,26 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.trackFeatureFlagEvent = void 0;
4
- const bridge_1 = require("../bridge");
5
- const errors_1 = require("../errors");
6
- const utils_1 = require("../utils");
7
- const types_1 = require("./types");
8
- const maxOps = 500;
9
- const intervalInMs = 1000 * 25;
10
- const callBridge = (0, bridge_1.getCallBridge)();
11
- const validatePayload = (payload) => {
12
- if (!payload || !payload.type || !payload.properties) {
13
- throw new errors_1.BridgeAPIError('Missing required parameters. Parameter type, and properties are required in the payload.');
14
- }
15
- if (!(payload.type.toUpperCase() in types_1.FeatureFlagEventType)) {
16
- throw new errors_1.BridgeAPIError('Event type is not supported');
17
- }
18
- if (Object.values(payload).some((val) => typeof val === 'function')) {
19
- throw new errors_1.BridgeAPIError('Passing functions as part of the payload is not supported!');
20
- }
21
- };
22
- const _trackFeatureFlagEvent = (payload) => {
23
- validatePayload(payload);
24
- return callBridge('trackFeatureFlagEvent', payload);
25
- };
26
- exports.trackFeatureFlagEvent = (0, utils_1.withRateLimiter)(_trackFeatureFlagEvent, maxOps, intervalInMs, `Feature flags calls are rate limited at ${maxOps}req/${intervalInMs / 1000}s`);