npm package diff
Package: @forge/bridge
Versions: 5.7.0-next.10 - 5.7.0-next.11
File: package/out/featureFlags/featureFlagEvents.js
Index: package/out/featureFlags/featureFlagEvents.js
===================================================================
--- package/out/featureFlags/featureFlagEvents.js
+++ package/out/featureFlags/featureFlagEvents.js
@@ -0,0 +1,26 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.trackFeatureFlagEvent = void 0;
+const bridge_1 = require("../bridge");
+const errors_1 = require("../errors");
+const types_1 = require("../types");
+const utils_1 = require("../utils");
+const maxOps = 500;
+const intervalInMs = 1000 * 25;
+const callBridge = (0, bridge_1.getCallBridge)();
+const validatePayload = (payload) => {
+    if (!payload || !payload.type || !payload.properties) {
+        throw new errors_1.BridgeAPIError('Missing required parameters. Parameter type, and properties are required in the payload.');
+    }
+    if (!(payload.type.toUpperCase() in types_1.FeatureFlagEventType)) {
+        throw new errors_1.BridgeAPIError('Event type is not supported');
+    }
+    if (Object.values(payload).some((val) => typeof val === 'function')) {
+        throw new errors_1.BridgeAPIError('Passing functions as part of the payload is not supported!');
+    }
+};
+const _trackFeatureFlagEvent = (payload) => {
+    validatePayload(payload);
+    return callBridge('trackFeatureFlagEvent', payload);
+};
+exports.trackFeatureFlagEvent = (0, utils_1.withRateLimiter)(_trackFeatureFlagEvent, maxOps, intervalInMs, `Feature flags calls are rate limited at ${maxOps}req/${intervalInMs / 1000}s`);