UNPKG

@mtdt.temp/browser-core

Version:
51 lines 2.45 kB
"use strict"; /** * LIMITATION: * For NPM setup, this feature flag singleton is shared between RUM and Logs product. * This means that an experimental flag set on the RUM product will be set on the Logs product. * So keep in mind that in certain configurations, your experimental feature flag may affect other products. * * FORMAT: * All feature flags should be snake_cased */ // We want to use a real enum (i.e. not a const enum) here, to be able to check whether an arbitrary // string is an expected feature flag Object.defineProperty(exports, "__esModule", { value: true }); exports.ExperimentalFeature = void 0; exports.initFeatureFlags = initFeatureFlags; exports.addExperimentalFeatures = addExperimentalFeatures; exports.isExperimentalFeatureEnabled = isExperimentalFeatureEnabled; exports.resetExperimentalFeatures = resetExperimentalFeatures; exports.getExperimentalFeatures = getExperimentalFeatures; const objectUtils_1 = require("./utils/objectUtils"); // eslint-disable-next-line no-restricted-syntax var ExperimentalFeature; (function (ExperimentalFeature) { ExperimentalFeature["TRACK_INTAKE_REQUESTS"] = "track_intake_requests"; ExperimentalFeature["WRITABLE_RESOURCE_GRAPHQL"] = "writable_resource_graphql"; ExperimentalFeature["EARLY_REQUEST_COLLECTION"] = "early_request_collection"; ExperimentalFeature["WATCH_COOKIE_WITHOUT_LOCK"] = "watch_cookie_without_lock"; ExperimentalFeature["USE_TREE_WALKER_FOR_ACTION_NAME"] = "use_tree_walker_for_action_name"; ExperimentalFeature["SHORT_SESSION_INVESTIGATION"] = "short_session_investigation"; })(ExperimentalFeature || (exports.ExperimentalFeature = ExperimentalFeature = {})); const enabledExperimentalFeatures = new Set(); function initFeatureFlags(enableExperimentalFeatures) { if (Array.isArray(enableExperimentalFeatures)) { addExperimentalFeatures(enableExperimentalFeatures.filter((flag) => (0, objectUtils_1.objectHasValue)(ExperimentalFeature, flag))); } } function addExperimentalFeatures(enabledFeatures) { enabledFeatures.forEach((flag) => { enabledExperimentalFeatures.add(flag); }); } function isExperimentalFeatureEnabled(featureName) { return enabledExperimentalFeatures.has(featureName); } function resetExperimentalFeatures() { enabledExperimentalFeatures.clear(); } function getExperimentalFeatures() { return enabledExperimentalFeatures; } //# sourceMappingURL=experimentalFeatures.js.map