All Downloads are FREE. Search and download functionalities are using the official Maven repository.

package.build.npm.esm.integrations.featureFlags.launchdarkly.integration.js.map Maven / Gradle / Ivy

There is a newer version: 9.5.0
Show newest version
{"version":3,"file":"integration.js","sources":["../../../../../../src/integrations/featureFlags/launchdarkly/integration.ts"],"sourcesContent":["import type { Client, Event, EventHint, IntegrationFn } from '@sentry/core';\nimport type { LDContext, LDEvaluationDetail, LDInspectionFlagUsedHandler } from './types';\n\nimport { defineIntegration } from '@sentry/core';\nimport { copyFlagsFromScopeToEvent, insertFlagToScope } from '../../../utils/featureFlags';\n\n/**\n * Sentry integration for capturing feature flags from LaunchDarkly.\n *\n * See the [feature flag documentation](https://develop.sentry.dev/sdk/expected-features/#feature-flags) for more information.\n *\n * @example\n * ```\n * import * as Sentry from '@sentry/browser';\n * import {launchDarklyIntegration, buildLaunchDarklyFlagUsedInspector} from '@sentry/browser';\n * import * as LaunchDarkly from 'launchdarkly-js-client-sdk';\n *\n * Sentry.init(..., integrations: [launchDarklyIntegration()])\n * const ldClient = LaunchDarkly.initialize(..., {inspectors: [buildLaunchDarklyFlagUsedHandler()]});\n * ```\n */\nexport const launchDarklyIntegration = defineIntegration(() => {\n  return {\n    name: 'LaunchDarkly',\n\n    processEvent(event: Event, _hint: EventHint, _client: Client): Event {\n      return copyFlagsFromScopeToEvent(event);\n    },\n  };\n}) satisfies IntegrationFn;\n\n/**\n * LaunchDarkly hook that listens for flag evaluations and updates the `flags`\n * context in our Sentry scope. This needs to be registered as an\n * 'inspector' in LaunchDarkly initialize() options, separately from\n * `launchDarklyIntegration`. Both are needed to collect feature flags on error.\n */\nexport function buildLaunchDarklyFlagUsedHandler(): LDInspectionFlagUsedHandler {\n  return {\n    name: 'sentry-flag-auditor',\n    type: 'flag-used',\n\n    synchronous: true,\n\n    /**\n     * Handle a flag evaluation by storing its name and value on the current scope.\n     */\n    method: (flagKey: string, flagDetail: LDEvaluationDetail, _context: LDContext) => {\n      insertFlagToScope(flagKey, flagDetail.value);\n    },\n  };\n}\n"],"names":[],"mappings":";;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;MACa,uBAAwB,GAAE,iBAAiB,CAAC,MAAM;AAC/D,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,cAAc;;AAExB,IAAI,YAAY,CAAC,KAAK,EAAS,KAAK,EAAa,OAAO,EAAiB;AACzE,MAAM,OAAO,yBAAyB,CAAC,KAAK,CAAC;AAC7C,KAAK;AACL,GAAG;AACH,CAAC,CAAE;;AAEH;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,gCAAgC,GAAgC;AAChF,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,qBAAqB;AAC/B,IAAI,IAAI,EAAE,WAAW;;AAErB,IAAI,WAAW,EAAE,IAAI;;AAErB;AACA;AACA;AACA,IAAI,MAAM,EAAE,CAAC,OAAO,EAAU,UAAU,EAAsB,QAAQ,KAAgB;AACtF,MAAM,iBAAiB,CAAC,OAAO,EAAE,UAAU,CAAC,KAAK,CAAC;AAClD,KAAK;AACL,GAAG;AACH;;;;"}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy