@sentry/browser 9.30.0 → 9.31.0

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.
Files changed (55) hide show
  1. package/build/npm/cjs/index.js +1 -2
  2. package/build/npm/cjs/index.js.map +1 -1
  3. package/build/npm/cjs/integrations/featureFlags/launchdarkly/integration.js +8 -8
  4. package/build/npm/cjs/integrations/featureFlags/launchdarkly/integration.js.map +1 -1
  5. package/build/npm/cjs/integrations/featureFlags/openfeature/integration.js +5 -4
  6. package/build/npm/cjs/integrations/featureFlags/openfeature/integration.js.map +1 -1
  7. package/build/npm/cjs/integrations/featureFlags/statsig/integration.js +7 -7
  8. package/build/npm/cjs/integrations/featureFlags/statsig/integration.js.map +1 -1
  9. package/build/npm/cjs/integrations/featureFlags/unleash/integration.js +6 -6
  10. package/build/npm/cjs/integrations/featureFlags/unleash/integration.js.map +1 -1
  11. package/build/npm/cjs/transports/fetch.js +1 -1
  12. package/build/npm/cjs/transports/fetch.js.map +1 -1
  13. package/build/npm/esm/index.js +1 -2
  14. package/build/npm/esm/index.js.map +1 -1
  15. package/build/npm/esm/integrations/featureFlags/launchdarkly/integration.js +9 -9
  16. package/build/npm/esm/integrations/featureFlags/launchdarkly/integration.js.map +1 -1
  17. package/build/npm/esm/integrations/featureFlags/openfeature/integration.js +6 -5
  18. package/build/npm/esm/integrations/featureFlags/openfeature/integration.js.map +1 -1
  19. package/build/npm/esm/integrations/featureFlags/statsig/integration.js +8 -8
  20. package/build/npm/esm/integrations/featureFlags/statsig/integration.js.map +1 -1
  21. package/build/npm/esm/integrations/featureFlags/unleash/integration.js +7 -7
  22. package/build/npm/esm/integrations/featureFlags/unleash/integration.js.map +1 -1
  23. package/build/npm/esm/package.json +1 -1
  24. package/build/npm/esm/transports/fetch.js +1 -1
  25. package/build/npm/esm/transports/fetch.js.map +1 -1
  26. package/build/npm/types/helpers.d.ts +1 -0
  27. package/build/npm/types/helpers.d.ts.map +1 -1
  28. package/build/npm/types/index.d.ts +2 -3
  29. package/build/npm/types/index.d.ts.map +1 -1
  30. package/build/npm/types/integrations/featureFlags/launchdarkly/integration.d.ts +5 -5
  31. package/build/npm/types/integrations/featureFlags/launchdarkly/integration.d.ts.map +1 -1
  32. package/build/npm/types/integrations/featureFlags/openfeature/integration.d.ts.map +1 -1
  33. package/build/npm/types/integrations/featureFlags/statsig/integration.d.ts.map +1 -1
  34. package/build/npm/types/integrations/featureFlags/unleash/integration.d.ts.map +1 -1
  35. package/build/npm/types-ts3.8/helpers.d.ts +1 -0
  36. package/build/npm/types-ts3.8/index.d.ts +2 -3
  37. package/build/npm/types-ts3.8/integrations/featureFlags/launchdarkly/integration.d.ts +5 -5
  38. package/package.json +7 -7
  39. package/build/npm/cjs/integrations/featureFlags/featureFlagsIntegration.js +0 -46
  40. package/build/npm/cjs/integrations/featureFlags/featureFlagsIntegration.js.map +0 -1
  41. package/build/npm/cjs/utils/featureFlags.js +0 -96
  42. package/build/npm/cjs/utils/featureFlags.js.map +0 -1
  43. package/build/npm/esm/integrations/featureFlags/featureFlagsIntegration.js +0 -44
  44. package/build/npm/esm/integrations/featureFlags/featureFlagsIntegration.js.map +0 -1
  45. package/build/npm/esm/utils/featureFlags.js +0 -91
  46. package/build/npm/esm/utils/featureFlags.js.map +0 -1
  47. package/build/npm/types/integrations/featureFlags/featureFlagsIntegration.d.ts +0 -31
  48. package/build/npm/types/integrations/featureFlags/featureFlagsIntegration.d.ts.map +0 -1
  49. package/build/npm/types/integrations/featureFlags/index.d.ts +0 -2
  50. package/build/npm/types/integrations/featureFlags/index.d.ts.map +0 -1
  51. package/build/npm/types/utils/featureFlags.d.ts +0 -34
  52. package/build/npm/types/utils/featureFlags.d.ts.map +0 -1
  53. package/build/npm/types-ts3.8/integrations/featureFlags/featureFlagsIntegration.d.ts +0 -31
  54. package/build/npm/types-ts3.8/integrations/featureFlags/index.d.ts +0 -2
  55. package/build/npm/types-ts3.8/utils/featureFlags.d.ts +0 -34
@@ -16,13 +16,12 @@ export { getFeedback, sendFeedback } from '@sentry-internal/feedback';
16
16
  export { defaultRequestInstrumentationOptions, instrumentOutgoingRequests } from './tracing/request';
17
17
  export { browserTracingIntegration, startBrowserTracingNavigationSpan, startBrowserTracingPageLoadSpan, } from './tracing/browserTracingIntegration';
18
18
  export type { RequestInstrumentationOptions } from './tracing/request';
19
- export { registerSpanErrorInstrumentation, getActiveSpan, getRootSpan, startSpan, startInactiveSpan, startSpanManual, withActiveSpan, startNewTrace, getSpanDescendants, setMeasurement, getSpanStatusFromHttpCode, setHttpStatus, makeMultiplexedTransport, moduleMetadataIntegration, supabaseIntegration, instrumentSupabaseClient, zodErrorsIntegration, thirdPartyErrorFilterIntegration, } from '@sentry/core';
20
- export type { Span } from '@sentry/core';
19
+ export { registerSpanErrorInstrumentation, getActiveSpan, getRootSpan, startSpan, startInactiveSpan, startSpanManual, withActiveSpan, startNewTrace, getSpanDescendants, setMeasurement, getSpanStatusFromHttpCode, setHttpStatus, makeMultiplexedTransport, moduleMetadataIntegration, supabaseIntegration, instrumentSupabaseClient, zodErrorsIntegration, thirdPartyErrorFilterIntegration, featureFlagsIntegration, } from '@sentry/core';
20
+ export type { Span, FeatureFlagsIntegration } from '@sentry/core';
21
21
  export { makeBrowserOfflineTransport } from './transports/offline';
22
22
  export { browserProfilingIntegration } from './profiling/integration';
23
23
  export { spotlightBrowserIntegration } from './integrations/spotlight';
24
24
  export { browserSessionIntegration } from './integrations/browsersession';
25
- export { featureFlagsIntegration, type FeatureFlagsIntegration } from './integrations/featureFlags';
26
25
  export { launchDarklyIntegration, buildLaunchDarklyFlagUsedHandler } from './integrations/featureFlags/launchdarkly';
27
26
  export { openFeatureIntegration, OpenFeatureIntegrationHook } from './integrations/featureFlags/openfeature';
28
27
  export { unleashIntegration } from './integrations/featureFlags/unleash';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAw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2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AACvE,OAAO,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAC1E,OAAO,EAAE,uBAAuB,EAAE,gCAAgC,EAAE,MAAM,0CAA0C,CAAC;AACrH,OAAO,EAAE,sBAAsB,EAAE,0BAA0B,EAAE,MAAM,yCAAyC,CAAC;AAC7G,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AACzE,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import type { LDInspectionFlagUsedHandler } from './types';
2
2
  /**
3
- * Sentry integration for capturing feature flags from LaunchDarkly.
3
+ * Sentry integration for capturing feature flag evaluations from LaunchDarkly.
4
4
  *
5
5
  * See the [feature flag documentation](https://develop.sentry.dev/sdk/expected-features/#feature-flags) for more information.
6
6
  *
@@ -16,10 +16,10 @@ import type { LDInspectionFlagUsedHandler } from './types';
16
16
  */
17
17
  export declare const launchDarklyIntegration: () => import("@sentry/core").Integration;
18
18
  /**
19
- * LaunchDarkly hook that listens for flag evaluations and updates the `flags`
20
- * context in our Sentry scope. This needs to be registered as an
21
- * 'inspector' in LaunchDarkly initialize() options, separately from
22
- * `launchDarklyIntegration`. Both are needed to collect feature flags on error.
19
+ * LaunchDarkly hook to listen for and buffer flag evaluations. This needs to
20
+ * be registered as an 'inspector' in LaunchDarkly initialize() options,
21
+ * separately from `launchDarklyIntegration`. Both the hook and the integration
22
+ * are needed to capture LaunchDarkly flags.
23
23
  */
24
24
  export declare function buildLaunchDarklyFlagUsedHandler(): LDInspectionFlagUsedHandler;
25
25
  //# sourceMappingURL=integration.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"integration.d.ts","sourceRoot":"","sources":["../../../../../../src/integrations/featureFlags/launchdarkly/integration.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAiC,2BAA2B,EAAE,MAAM,SAAS,CAAC;AAE1F;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,uBAAuB,0CAQV,CAAC;AAE3B;;;;;GAKG;AACH,wBAAgB,gCAAgC,IAAI,2BAA2B,CAc9E"}
1
+ {"version":3,"file":"integration.d.ts","sourceRoot":"","sources":["../../../../../../src/integrations/featureFlags/launchdarkly/integration.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAiC,2BAA2B,EAAE,MAAM,SAAS,CAAC;AAE1F;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,uBAAuB,0CAQV,CAAC;AAE3B;;;;;GAKG;AACH,wBAAgB,gCAAgC,IAAI,2BAA2B,CAe9E"}
@@ -1 +1 @@
1
- {"version":3,"file":"integration.d.ts","sourceRoot":"","sources":["../../../../../../src/integrations/featureFlags/openfeature/integration.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAErG,eAAO,MAAM,sBAAsB,0CAQT,CAAC;AAE3B;;GAEG;AACH,qBAAa,0BAA2B,YAAW,eAAe;IAChE;;OAEG;IACI,KAAK,CAAC,YAAY,EAAE,QAAQ,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,EAAE,iBAAiB,EAAE,iBAAiB,CAAC,SAAS,CAAC,GAAG,IAAI;IAInH;;OAEG;IACI,KAAK,CAAC,WAAW,EAAE,QAAQ,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,CAAC,EAAE,SAAS,GAAG,IAAI;CAG3G"}
1
+ {"version":3,"file":"integration.d.ts","sourceRoot":"","sources":["../../../../../../src/integrations/featureFlags/openfeature/integration.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAErG,eAAO,MAAM,sBAAsB,0CAQT,CAAC;AAE3B;;GAEG;AACH,qBAAa,0BAA2B,YAAW,eAAe;IAChE;;OAEG;IACI,KAAK,CAAC,YAAY,EAAE,QAAQ,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,EAAE,iBAAiB,EAAE,iBAAiB,CAAC,SAAS,CAAC,GAAG,IAAI;IAKnH;;OAEG;IACI,KAAK,CAAC,WAAW,EAAE,QAAQ,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,CAAC,EAAE,SAAS,GAAG,IAAI;CAI3G"}
@@ -1 +1 @@
1
- {"version":3,"file":"integration.d.ts","sourceRoot":"","sources":["../../../../../../src/integrations/featureFlags/statsig/integration.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAe,aAAa,EAAE,MAAM,SAAS,CAAC;AAE1D;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,kBAAkB;uBAC+B,aAAa;wCAelD,CAAC"}
1
+ {"version":3,"file":"integration.d.ts","sourceRoot":"","sources":["../../../../../../src/integrations/featureFlags/statsig/integration.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAe,aAAa,EAAE,MAAM,SAAS,CAAC;AAE1D;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,kBAAkB;uBAC+B,aAAa;wCAgBlD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"integration.d.ts","sourceRoot":"","sources":["../../../../../../src/integrations/featureFlags/unleash/integration.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAiB,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAEjE,KAAK,yBAAyB,GAAG;IAC/B,sBAAsB,EAAE,kBAAkB,CAAC;CAC5C,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,kBAAkB,2EAeN,CAAC"}
1
+ {"version":3,"file":"integration.d.ts","sourceRoot":"","sources":["../../../../../../src/integrations/featureFlags/unleash/integration.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAiB,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAEjE,KAAK,yBAAyB,GAAG;IAC/B,sBAAsB,EAAE,kBAAkB,CAAC;CAC5C,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,kBAAkB,2EAeN,CAAC"}
@@ -25,6 +25,7 @@ export declare const WINDOW: {
25
25
  _sentryDebugIds?: Record<string, string> | undefined;
26
26
  _sentryModuleMetadata?: Record<string, any> | undefined;
27
27
  _sentryEsmLoaderHookRegistered?: boolean | undefined;
28
+ _spanToFlagBufferMap?: WeakMap<import("@sentry/core").Span, Set<string>> | undefined;
28
29
  } & import("@sentry/core").Carrier & Window;
29
30
  /**
30
31
  * @hidden
@@ -16,13 +16,12 @@ export { getFeedback, sendFeedback } from '@sentry-internal/feedback';
16
16
  export { defaultRequestInstrumentationOptions, instrumentOutgoingRequests } from './tracing/request';
17
17
  export { browserTracingIntegration, startBrowserTracingNavigationSpan, startBrowserTracingPageLoadSpan, } from './tracing/browserTracingIntegration';
18
18
  export { RequestInstrumentationOptions } from './tracing/request';
19
- export { registerSpanErrorInstrumentation, getActiveSpan, getRootSpan, startSpan, startInactiveSpan, startSpanManual, withActiveSpan, startNewTrace, getSpanDescendants, setMeasurement, getSpanStatusFromHttpCode, setHttpStatus, makeMultiplexedTransport, moduleMetadataIntegration, supabaseIntegration, instrumentSupabaseClient, zodErrorsIntegration, thirdPartyErrorFilterIntegration, } from '@sentry/core';
20
- export { Span } from '@sentry/core';
19
+ export { registerSpanErrorInstrumentation, getActiveSpan, getRootSpan, startSpan, startInactiveSpan, startSpanManual, withActiveSpan, startNewTrace, getSpanDescendants, setMeasurement, getSpanStatusFromHttpCode, setHttpStatus, makeMultiplexedTransport, moduleMetadataIntegration, supabaseIntegration, instrumentSupabaseClient, zodErrorsIntegration, thirdPartyErrorFilterIntegration, featureFlagsIntegration, } from '@sentry/core';
20
+ export { Span, FeatureFlagsIntegration } from '@sentry/core';
21
21
  export { makeBrowserOfflineTransport } from './transports/offline';
22
22
  export { browserProfilingIntegration } from './profiling/integration';
23
23
  export { spotlightBrowserIntegration } from './integrations/spotlight';
24
24
  export { browserSessionIntegration } from './integrations/browsersession';
25
- export { featureFlagsIntegration, FeatureFlagsIntegration } from './integrations/featureFlags';
26
25
  export { launchDarklyIntegration, buildLaunchDarklyFlagUsedHandler } from './integrations/featureFlags/launchdarkly';
27
26
  export { openFeatureIntegration, OpenFeatureIntegrationHook } from './integrations/featureFlags/openfeature';
28
27
  export { unleashIntegration } from './integrations/featureFlags/unleash';
@@ -1,6 +1,6 @@
1
1
  import { LDInspectionFlagUsedHandler } from './types';
2
2
  /**
3
- * Sentry integration for capturing feature flags from LaunchDarkly.
3
+ * Sentry integration for capturing feature flag evaluations from LaunchDarkly.
4
4
  *
5
5
  * See the [feature flag documentation](https://develop.sentry.dev/sdk/expected-features/#feature-flags) for more information.
6
6
  *
@@ -16,10 +16,10 @@ import { LDInspectionFlagUsedHandler } from './types';
16
16
  */
17
17
  export declare const launchDarklyIntegration: () => import("@sentry/core").Integration;
18
18
  /**
19
- * LaunchDarkly hook that listens for flag evaluations and updates the `flags`
20
- * context in our Sentry scope. This needs to be registered as an
21
- * 'inspector' in LaunchDarkly initialize() options, separately from
22
- * `launchDarklyIntegration`. Both are needed to collect feature flags on error.
19
+ * LaunchDarkly hook to listen for and buffer flag evaluations. This needs to
20
+ * be registered as an 'inspector' in LaunchDarkly initialize() options,
21
+ * separately from `launchDarklyIntegration`. Both the hook and the integration
22
+ * are needed to capture LaunchDarkly flags.
23
23
  */
24
24
  export declare function buildLaunchDarklyFlagUsedHandler(): LDInspectionFlagUsedHandler;
25
25
  //# sourceMappingURL=integration.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/browser",
3
- "version": "9.30.0",
3
+ "version": "9.31.0",
4
4
  "description": "Official Sentry SDK for browsers",
5
5
  "repository": "git://github.com/getsentry/sentry-javascript.git",
6
6
  "homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/browser",
@@ -39,14 +39,14 @@
39
39
  "access": "public"
40
40
  },
41
41
  "dependencies": {
42
- "@sentry-internal/browser-utils": "9.30.0",
43
- "@sentry-internal/feedback": "9.30.0",
44
- "@sentry-internal/replay": "9.30.0",
45
- "@sentry-internal/replay-canvas": "9.30.0",
46
- "@sentry/core": "9.30.0"
42
+ "@sentry-internal/browser-utils": "9.31.0",
43
+ "@sentry-internal/feedback": "9.31.0",
44
+ "@sentry-internal/replay": "9.31.0",
45
+ "@sentry-internal/replay-canvas": "9.31.0",
46
+ "@sentry/core": "9.31.0"
47
47
  },
48
48
  "devDependencies": {
49
- "@sentry-internal/integration-shims": "9.30.0",
49
+ "@sentry-internal/integration-shims": "9.31.0",
50
50
  "fake-indexeddb": "^4.0.1"
51
51
  },
52
52
  "scripts": {
@@ -1,46 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
-
3
- const core = require('@sentry/core');
4
- const featureFlags = require('../../utils/featureFlags.js');
5
-
6
- /**
7
- * Sentry integration for buffering feature flags manually with an API, and
8
- * capturing them on error events. We recommend you do this on each flag
9
- * evaluation. Flags are buffered per Sentry scope and limited to 100 per event.
10
- *
11
- * See the [feature flag documentation](https://develop.sentry.dev/sdk/expected-features/#feature-flags) for more information.
12
- *
13
- * @example
14
- * ```
15
- * import * as Sentry from '@sentry/browser';
16
- * import { type FeatureFlagsIntegration } from '@sentry/browser';
17
- *
18
- * // Setup
19
- * Sentry.init(..., integrations: [Sentry.featureFlagsIntegration()])
20
- *
21
- * // Verify
22
- * const flagsIntegration = Sentry.getClient()?.getIntegrationByName<FeatureFlagsIntegration>('FeatureFlags');
23
- * if (flagsIntegration) {
24
- * flagsIntegration.addFeatureFlag('my-flag', true);
25
- * } else {
26
- * // check your setup
27
- * }
28
- * Sentry.captureException(Exception('broke')); // 'my-flag' should be captured to this Sentry event.
29
- * ```
30
- */
31
- const featureFlagsIntegration = core.defineIntegration(() => {
32
- return {
33
- name: 'FeatureFlags',
34
-
35
- processEvent(event, _hint, _client) {
36
- return featureFlags.copyFlagsFromScopeToEvent(event);
37
- },
38
-
39
- addFeatureFlag(name, value) {
40
- featureFlags.insertFlagToScope(name, value);
41
- },
42
- };
43
- }) ;
44
-
45
- exports.featureFlagsIntegration = featureFlagsIntegration;
46
- //# sourceMappingURL=featureFlagsIntegration.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"featureFlagsIntegration.js","sources":["../../../../../src/integrations/featureFlags/featureFlagsIntegration.ts"],"sourcesContent":["import type { Client, Event, EventHint, Integration, IntegrationFn } from '@sentry/core';\nimport { defineIntegration } from '@sentry/core';\nimport { copyFlagsFromScopeToEvent, insertFlagToScope } from '../../utils/featureFlags';\n\nexport interface FeatureFlagsIntegration extends Integration {\n addFeatureFlag: (name: string, value: unknown) => void;\n}\n\n/**\n * Sentry integration for buffering feature flags manually with an API, and\n * capturing them on error events. We recommend you do this on each flag\n * evaluation. Flags are buffered per Sentry scope and limited to 100 per event.\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 { type FeatureFlagsIntegration } from '@sentry/browser';\n *\n * // Setup\n * Sentry.init(..., integrations: [Sentry.featureFlagsIntegration()])\n *\n * // Verify\n * const flagsIntegration = Sentry.getClient()?.getIntegrationByName<FeatureFlagsIntegration>('FeatureFlags');\n * if (flagsIntegration) {\n * flagsIntegration.addFeatureFlag('my-flag', true);\n * } else {\n * // check your setup\n * }\n * Sentry.captureException(Exception('broke')); // 'my-flag' should be captured to this Sentry event.\n * ```\n */\nexport const featureFlagsIntegration = defineIntegration(() => {\n return {\n name: 'FeatureFlags',\n\n processEvent(event: Event, _hint: EventHint, _client: Client): Event {\n return copyFlagsFromScopeToEvent(event);\n },\n\n addFeatureFlag(name: string, value: unknown): void {\n insertFlagToScope(name, value);\n },\n };\n}) as IntegrationFn<FeatureFlagsIntegration>;\n"],"names":["defineIntegration","copyFlagsFromScopeToEvent","insertFlagToScope"],"mappings":";;;;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;MACa,uBAAwB,GAAEA,sBAAiB,CAAC,MAAM;AAC/D,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,cAAc;;AAExB,IAAI,YAAY,CAAC,KAAK,EAAS,KAAK,EAAa,OAAO,EAAiB;AACzE,MAAM,OAAOC,sCAAyB,CAAC,KAAK,CAAC;AAC7C,KAAK;;AAEL,IAAI,cAAc,CAAC,IAAI,EAAU,KAAK,EAAiB;AACvD,MAAMC,8BAAiB,CAAC,IAAI,EAAE,KAAK,CAAC;AACpC,KAAK;AACL,GAAG;AACH,CAAC,CAAE;;;;"}
@@ -1,96 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
-
3
- const core = require('@sentry/core');
4
- const debugBuild = require('../debug-build.js');
5
-
6
- /**
7
- * Ordered LRU cache for storing feature flags in the scope context. The name
8
- * of each flag in the buffer is unique, and the output of getAll() is ordered
9
- * from oldest to newest.
10
- */
11
-
12
- /**
13
- * Max size of the LRU flag buffer stored in Sentry scope and event contexts.
14
- */
15
- const FLAG_BUFFER_SIZE = 100;
16
-
17
- /**
18
- * Copies feature flags that are in current scope context to the event context
19
- */
20
- function copyFlagsFromScopeToEvent(event) {
21
- const scope = core.getCurrentScope();
22
- const flagContext = scope.getScopeData().contexts.flags;
23
- const flagBuffer = flagContext ? flagContext.values : [];
24
-
25
- if (!flagBuffer.length) {
26
- return event;
27
- }
28
-
29
- if (event.contexts === undefined) {
30
- event.contexts = {};
31
- }
32
- event.contexts.flags = { values: [...flagBuffer] };
33
- return event;
34
- }
35
-
36
- /**
37
- * Creates a feature flags values array in current context if it does not exist
38
- * and inserts the flag into a FeatureFlag array while maintaining ordered LRU
39
- * properties. Not thread-safe. After inserting:
40
- * - `flags` is sorted in order of recency, with the newest flag at the end.
41
- * - No other flags with the same name exist in `flags`.
42
- * - The length of `flags` does not exceed `maxSize`. The oldest flag is evicted
43
- * as needed.
44
- *
45
- * @param name Name of the feature flag to insert.
46
- * @param value Value of the feature flag.
47
- * @param maxSize Max number of flags the buffer should store. It's recommended
48
- * to keep this consistent across insertions. Default is FLAG_BUFFER_SIZE
49
- */
50
- function insertFlagToScope(name, value, maxSize = FLAG_BUFFER_SIZE) {
51
- const scopeContexts = core.getCurrentScope().getScopeData().contexts;
52
- if (!scopeContexts.flags) {
53
- scopeContexts.flags = { values: [] };
54
- }
55
- const flags = scopeContexts.flags.values ;
56
- insertToFlagBuffer(flags, name, value, maxSize);
57
- }
58
-
59
- /**
60
- * Exported for tests. Currently only accepts boolean values (otherwise no-op).
61
- */
62
- function insertToFlagBuffer(flags, name, value, maxSize) {
63
- if (typeof value !== 'boolean') {
64
- return;
65
- }
66
-
67
- if (flags.length > maxSize) {
68
- debugBuild.DEBUG_BUILD && core.logger.error(`[Feature Flags] insertToFlagBuffer called on a buffer larger than maxSize=${maxSize}`);
69
- return;
70
- }
71
-
72
- // Check if the flag is already in the buffer - O(n)
73
- const index = flags.findIndex(f => f.flag === name);
74
-
75
- if (index !== -1) {
76
- // The flag was found, remove it from its current position - O(n)
77
- flags.splice(index, 1);
78
- }
79
-
80
- if (flags.length === maxSize) {
81
- // If at capacity, pop the earliest flag - O(n)
82
- flags.shift();
83
- }
84
-
85
- // Push the flag to the end - O(1)
86
- flags.push({
87
- flag: name,
88
- result: value,
89
- });
90
- }
91
-
92
- exports.FLAG_BUFFER_SIZE = FLAG_BUFFER_SIZE;
93
- exports.copyFlagsFromScopeToEvent = copyFlagsFromScopeToEvent;
94
- exports.insertFlagToScope = insertFlagToScope;
95
- exports.insertToFlagBuffer = insertToFlagBuffer;
96
- //# sourceMappingURL=featureFlags.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"featureFlags.js","sources":["../../../../src/utils/featureFlags.ts"],"sourcesContent":["import type { Event, FeatureFlag } from '@sentry/core';\nimport { getCurrentScope, logger } from '@sentry/core';\nimport { DEBUG_BUILD } from '../debug-build';\n\n/**\n * Ordered LRU cache for storing feature flags in the scope context. The name\n * of each flag in the buffer is unique, and the output of getAll() is ordered\n * from oldest to newest.\n */\n\n/**\n * Max size of the LRU flag buffer stored in Sentry scope and event contexts.\n */\nexport const FLAG_BUFFER_SIZE = 100;\n\n/**\n * Copies feature flags that are in current scope context to the event context\n */\nexport function copyFlagsFromScopeToEvent(event: Event): Event {\n const scope = getCurrentScope();\n const flagContext = scope.getScopeData().contexts.flags;\n const flagBuffer = flagContext ? flagContext.values : [];\n\n if (!flagBuffer.length) {\n return event;\n }\n\n if (event.contexts === undefined) {\n event.contexts = {};\n }\n event.contexts.flags = { values: [...flagBuffer] };\n return event;\n}\n\n/**\n * Creates a feature flags values array in current context if it does not exist\n * and inserts the flag into a FeatureFlag array while maintaining ordered LRU\n * properties. Not thread-safe. After inserting:\n * - `flags` is sorted in order of recency, with the newest flag at the end.\n * - No other flags with the same name exist in `flags`.\n * - The length of `flags` does not exceed `maxSize`. The oldest flag is evicted\n * as needed.\n *\n * @param name Name of the feature flag to insert.\n * @param value Value of the feature flag.\n * @param maxSize Max number of flags the buffer should store. It's recommended\n * to keep this consistent across insertions. Default is FLAG_BUFFER_SIZE\n */\nexport function insertFlagToScope(name: string, value: unknown, maxSize: number = FLAG_BUFFER_SIZE): void {\n const scopeContexts = getCurrentScope().getScopeData().contexts;\n if (!scopeContexts.flags) {\n scopeContexts.flags = { values: [] };\n }\n const flags = scopeContexts.flags.values as FeatureFlag[];\n insertToFlagBuffer(flags, name, value, maxSize);\n}\n\n/**\n * Exported for tests. Currently only accepts boolean values (otherwise no-op).\n */\nexport function insertToFlagBuffer(flags: FeatureFlag[], name: string, value: unknown, maxSize: number): void {\n if (typeof value !== 'boolean') {\n return;\n }\n\n if (flags.length > maxSize) {\n DEBUG_BUILD && logger.error(`[Feature Flags] insertToFlagBuffer called on a buffer larger than maxSize=${maxSize}`);\n return;\n }\n\n // Check if the flag is already in the buffer - O(n)\n const index = flags.findIndex(f => f.flag === name);\n\n if (index !== -1) {\n // The flag was found, remove it from its current position - O(n)\n flags.splice(index, 1);\n }\n\n if (flags.length === maxSize) {\n // If at capacity, pop the earliest flag - O(n)\n flags.shift();\n }\n\n // Push the flag to the end - O(1)\n flags.push({\n flag: name,\n result: value,\n });\n}\n"],"names":["getCurrentScope","DEBUG_BUILD","logger"],"mappings":";;;;;AAIA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACO,MAAM,gBAAiB,GAAE;;AAEhC;AACA;AACA;AACO,SAAS,yBAAyB,CAAC,KAAK,EAAgB;AAC/D,EAAE,MAAM,KAAA,GAAQA,oBAAe,EAAE;AACjC,EAAE,MAAM,WAAY,GAAE,KAAK,CAAC,YAAY,EAAE,CAAC,QAAQ,CAAC,KAAK;AACzD,EAAE,MAAM,UAAW,GAAE,WAAY,GAAE,WAAW,CAAC,MAAA,GAAS,EAAE;;AAE1D,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE;AAC1B,IAAI,OAAO,KAAK;AAChB;;AAEA,EAAE,IAAI,KAAK,CAAC,QAAS,KAAI,SAAS,EAAE;AACpC,IAAI,KAAK,CAAC,QAAS,GAAE,EAAE;AACvB;AACA,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAM,GAAE,EAAE,MAAM,EAAE,CAAC,GAAG,UAAU,GAAG;AACpD,EAAE,OAAO,KAAK;AACd;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,iBAAiB,CAAC,IAAI,EAAU,KAAK,EAAW,OAAO,GAAW,gBAAgB,EAAQ;AAC1G,EAAE,MAAM,aAAc,GAAEA,oBAAe,EAAE,CAAC,YAAY,EAAE,CAAC,QAAQ;AACjE,EAAE,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE;AAC5B,IAAI,aAAa,CAAC,KAAM,GAAE,EAAE,MAAM,EAAE,EAAC,EAAG;AACxC;AACA,EAAE,MAAM,KAAM,GAAE,aAAa,CAAC,KAAK,CAAC,MAAO;AAC3C,EAAE,kBAAkB,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC;AACjD;;AAEA;AACA;AACA;AACO,SAAS,kBAAkB,CAAC,KAAK,EAAiB,IAAI,EAAU,KAAK,EAAW,OAAO,EAAgB;AAC9G,EAAE,IAAI,OAAO,KAAM,KAAI,SAAS,EAAE;AAClC,IAAI;AACJ;;AAEA,EAAE,IAAI,KAAK,CAAC,MAAO,GAAE,OAAO,EAAE;AAC9B,IAAIC,sBAAA,IAAeC,WAAM,CAAC,KAAK,CAAC,CAAC,0EAA0E,EAAE,OAAO,CAAC,CAAA,CAAA;AACA,IAAA;AACA;;AAEA;AACA,EAAA,MAAA,KAAA,GAAA,KAAA,CAAA,SAAA,CAAA,CAAA,IAAA,CAAA,CAAA,IAAA,KAAA,IAAA,CAAA;;AAEA,EAAA,IAAA,KAAA,KAAA,EAAA,EAAA;AACA;AACA,IAAA,KAAA,CAAA,MAAA,CAAA,KAAA,EAAA,CAAA,CAAA;AACA;;AAEA,EAAA,IAAA,KAAA,CAAA,MAAA,KAAA,OAAA,EAAA;AACA;AACA,IAAA,KAAA,CAAA,KAAA,EAAA;AACA;;AAEA;AACA,EAAA,KAAA,CAAA,IAAA,CAAA;AACA,IAAA,IAAA,EAAA,IAAA;AACA,IAAA,MAAA,EAAA,KAAA;AACA,GAAA,CAAA;AACA;;;;;;;"}
@@ -1,44 +0,0 @@
1
- import { defineIntegration } from '@sentry/core';
2
- import { insertFlagToScope, copyFlagsFromScopeToEvent } from '../../utils/featureFlags.js';
3
-
4
- /**
5
- * Sentry integration for buffering feature flags manually with an API, and
6
- * capturing them on error events. We recommend you do this on each flag
7
- * evaluation. Flags are buffered per Sentry scope and limited to 100 per event.
8
- *
9
- * See the [feature flag documentation](https://develop.sentry.dev/sdk/expected-features/#feature-flags) for more information.
10
- *
11
- * @example
12
- * ```
13
- * import * as Sentry from '@sentry/browser';
14
- * import { type FeatureFlagsIntegration } from '@sentry/browser';
15
- *
16
- * // Setup
17
- * Sentry.init(..., integrations: [Sentry.featureFlagsIntegration()])
18
- *
19
- * // Verify
20
- * const flagsIntegration = Sentry.getClient()?.getIntegrationByName<FeatureFlagsIntegration>('FeatureFlags');
21
- * if (flagsIntegration) {
22
- * flagsIntegration.addFeatureFlag('my-flag', true);
23
- * } else {
24
- * // check your setup
25
- * }
26
- * Sentry.captureException(Exception('broke')); // 'my-flag' should be captured to this Sentry event.
27
- * ```
28
- */
29
- const featureFlagsIntegration = defineIntegration(() => {
30
- return {
31
- name: 'FeatureFlags',
32
-
33
- processEvent(event, _hint, _client) {
34
- return copyFlagsFromScopeToEvent(event);
35
- },
36
-
37
- addFeatureFlag(name, value) {
38
- insertFlagToScope(name, value);
39
- },
40
- };
41
- }) ;
42
-
43
- export { featureFlagsIntegration };
44
- //# sourceMappingURL=featureFlagsIntegration.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"featureFlagsIntegration.js","sources":["../../../../../src/integrations/featureFlags/featureFlagsIntegration.ts"],"sourcesContent":["import type { Client, Event, EventHint, Integration, IntegrationFn } from '@sentry/core';\nimport { defineIntegration } from '@sentry/core';\nimport { copyFlagsFromScopeToEvent, insertFlagToScope } from '../../utils/featureFlags';\n\nexport interface FeatureFlagsIntegration extends Integration {\n addFeatureFlag: (name: string, value: unknown) => void;\n}\n\n/**\n * Sentry integration for buffering feature flags manually with an API, and\n * capturing them on error events. We recommend you do this on each flag\n * evaluation. Flags are buffered per Sentry scope and limited to 100 per event.\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 { type FeatureFlagsIntegration } from '@sentry/browser';\n *\n * // Setup\n * Sentry.init(..., integrations: [Sentry.featureFlagsIntegration()])\n *\n * // Verify\n * const flagsIntegration = Sentry.getClient()?.getIntegrationByName<FeatureFlagsIntegration>('FeatureFlags');\n * if (flagsIntegration) {\n * flagsIntegration.addFeatureFlag('my-flag', true);\n * } else {\n * // check your setup\n * }\n * Sentry.captureException(Exception('broke')); // 'my-flag' should be captured to this Sentry event.\n * ```\n */\nexport const featureFlagsIntegration = defineIntegration(() => {\n return {\n name: 'FeatureFlags',\n\n processEvent(event: Event, _hint: EventHint, _client: Client): Event {\n return copyFlagsFromScopeToEvent(event);\n },\n\n addFeatureFlag(name: string, value: unknown): void {\n insertFlagToScope(name, value);\n },\n };\n}) as IntegrationFn<FeatureFlagsIntegration>;\n"],"names":[],"mappings":";;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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;;AAEL,IAAI,cAAc,CAAC,IAAI,EAAU,KAAK,EAAiB;AACvD,MAAM,iBAAiB,CAAC,IAAI,EAAE,KAAK,CAAC;AACpC,KAAK;AACL,GAAG;AACH,CAAC,CAAE;;;;"}
@@ -1,91 +0,0 @@
1
- import { getCurrentScope, logger } from '@sentry/core';
2
- import { DEBUG_BUILD } from '../debug-build.js';
3
-
4
- /**
5
- * Ordered LRU cache for storing feature flags in the scope context. The name
6
- * of each flag in the buffer is unique, and the output of getAll() is ordered
7
- * from oldest to newest.
8
- */
9
-
10
- /**
11
- * Max size of the LRU flag buffer stored in Sentry scope and event contexts.
12
- */
13
- const FLAG_BUFFER_SIZE = 100;
14
-
15
- /**
16
- * Copies feature flags that are in current scope context to the event context
17
- */
18
- function copyFlagsFromScopeToEvent(event) {
19
- const scope = getCurrentScope();
20
- const flagContext = scope.getScopeData().contexts.flags;
21
- const flagBuffer = flagContext ? flagContext.values : [];
22
-
23
- if (!flagBuffer.length) {
24
- return event;
25
- }
26
-
27
- if (event.contexts === undefined) {
28
- event.contexts = {};
29
- }
30
- event.contexts.flags = { values: [...flagBuffer] };
31
- return event;
32
- }
33
-
34
- /**
35
- * Creates a feature flags values array in current context if it does not exist
36
- * and inserts the flag into a FeatureFlag array while maintaining ordered LRU
37
- * properties. Not thread-safe. After inserting:
38
- * - `flags` is sorted in order of recency, with the newest flag at the end.
39
- * - No other flags with the same name exist in `flags`.
40
- * - The length of `flags` does not exceed `maxSize`. The oldest flag is evicted
41
- * as needed.
42
- *
43
- * @param name Name of the feature flag to insert.
44
- * @param value Value of the feature flag.
45
- * @param maxSize Max number of flags the buffer should store. It's recommended
46
- * to keep this consistent across insertions. Default is FLAG_BUFFER_SIZE
47
- */
48
- function insertFlagToScope(name, value, maxSize = FLAG_BUFFER_SIZE) {
49
- const scopeContexts = getCurrentScope().getScopeData().contexts;
50
- if (!scopeContexts.flags) {
51
- scopeContexts.flags = { values: [] };
52
- }
53
- const flags = scopeContexts.flags.values ;
54
- insertToFlagBuffer(flags, name, value, maxSize);
55
- }
56
-
57
- /**
58
- * Exported for tests. Currently only accepts boolean values (otherwise no-op).
59
- */
60
- function insertToFlagBuffer(flags, name, value, maxSize) {
61
- if (typeof value !== 'boolean') {
62
- return;
63
- }
64
-
65
- if (flags.length > maxSize) {
66
- DEBUG_BUILD && logger.error(`[Feature Flags] insertToFlagBuffer called on a buffer larger than maxSize=${maxSize}`);
67
- return;
68
- }
69
-
70
- // Check if the flag is already in the buffer - O(n)
71
- const index = flags.findIndex(f => f.flag === name);
72
-
73
- if (index !== -1) {
74
- // The flag was found, remove it from its current position - O(n)
75
- flags.splice(index, 1);
76
- }
77
-
78
- if (flags.length === maxSize) {
79
- // If at capacity, pop the earliest flag - O(n)
80
- flags.shift();
81
- }
82
-
83
- // Push the flag to the end - O(1)
84
- flags.push({
85
- flag: name,
86
- result: value,
87
- });
88
- }
89
-
90
- export { FLAG_BUFFER_SIZE, copyFlagsFromScopeToEvent, insertFlagToScope, insertToFlagBuffer };
91
- //# sourceMappingURL=featureFlags.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"featureFlags.js","sources":["../../../../src/utils/featureFlags.ts"],"sourcesContent":["import type { Event, FeatureFlag } from '@sentry/core';\nimport { getCurrentScope, logger } from '@sentry/core';\nimport { DEBUG_BUILD } from '../debug-build';\n\n/**\n * Ordered LRU cache for storing feature flags in the scope context. The name\n * of each flag in the buffer is unique, and the output of getAll() is ordered\n * from oldest to newest.\n */\n\n/**\n * Max size of the LRU flag buffer stored in Sentry scope and event contexts.\n */\nexport const FLAG_BUFFER_SIZE = 100;\n\n/**\n * Copies feature flags that are in current scope context to the event context\n */\nexport function copyFlagsFromScopeToEvent(event: Event): Event {\n const scope = getCurrentScope();\n const flagContext = scope.getScopeData().contexts.flags;\n const flagBuffer = flagContext ? flagContext.values : [];\n\n if (!flagBuffer.length) {\n return event;\n }\n\n if (event.contexts === undefined) {\n event.contexts = {};\n }\n event.contexts.flags = { values: [...flagBuffer] };\n return event;\n}\n\n/**\n * Creates a feature flags values array in current context if it does not exist\n * and inserts the flag into a FeatureFlag array while maintaining ordered LRU\n * properties. Not thread-safe. After inserting:\n * - `flags` is sorted in order of recency, with the newest flag at the end.\n * - No other flags with the same name exist in `flags`.\n * - The length of `flags` does not exceed `maxSize`. The oldest flag is evicted\n * as needed.\n *\n * @param name Name of the feature flag to insert.\n * @param value Value of the feature flag.\n * @param maxSize Max number of flags the buffer should store. It's recommended\n * to keep this consistent across insertions. Default is FLAG_BUFFER_SIZE\n */\nexport function insertFlagToScope(name: string, value: unknown, maxSize: number = FLAG_BUFFER_SIZE): void {\n const scopeContexts = getCurrentScope().getScopeData().contexts;\n if (!scopeContexts.flags) {\n scopeContexts.flags = { values: [] };\n }\n const flags = scopeContexts.flags.values as FeatureFlag[];\n insertToFlagBuffer(flags, name, value, maxSize);\n}\n\n/**\n * Exported for tests. Currently only accepts boolean values (otherwise no-op).\n */\nexport function insertToFlagBuffer(flags: FeatureFlag[], name: string, value: unknown, maxSize: number): void {\n if (typeof value !== 'boolean') {\n return;\n }\n\n if (flags.length > maxSize) {\n DEBUG_BUILD && logger.error(`[Feature Flags] insertToFlagBuffer called on a buffer larger than maxSize=${maxSize}`);\n return;\n }\n\n // Check if the flag is already in the buffer - O(n)\n const index = flags.findIndex(f => f.flag === name);\n\n if (index !== -1) {\n // The flag was found, remove it from its current position - O(n)\n flags.splice(index, 1);\n }\n\n if (flags.length === maxSize) {\n // If at capacity, pop the earliest flag - O(n)\n flags.shift();\n }\n\n // Push the flag to the end - O(1)\n flags.push({\n flag: name,\n result: value,\n });\n}\n"],"names":[],"mappings":";;;AAIA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACO,MAAM,gBAAiB,GAAE;;AAEhC;AACA;AACA;AACO,SAAS,yBAAyB,CAAC,KAAK,EAAgB;AAC/D,EAAE,MAAM,KAAA,GAAQ,eAAe,EAAE;AACjC,EAAE,MAAM,WAAY,GAAE,KAAK,CAAC,YAAY,EAAE,CAAC,QAAQ,CAAC,KAAK;AACzD,EAAE,MAAM,UAAW,GAAE,WAAY,GAAE,WAAW,CAAC,MAAA,GAAS,EAAE;;AAE1D,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE;AAC1B,IAAI,OAAO,KAAK;AAChB;;AAEA,EAAE,IAAI,KAAK,CAAC,QAAS,KAAI,SAAS,EAAE;AACpC,IAAI,KAAK,CAAC,QAAS,GAAE,EAAE;AACvB;AACA,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAM,GAAE,EAAE,MAAM,EAAE,CAAC,GAAG,U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,IAAA;AACA,IAAA,MAAA,EAAA,KAAA;AACA,GAAA,CAAA;AACA;;;;"}
@@ -1,31 +0,0 @@
1
- import type { Integration, IntegrationFn } from '@sentry/core';
2
- export interface FeatureFlagsIntegration extends Integration {
3
- addFeatureFlag: (name: string, value: unknown) => void;
4
- }
5
- /**
6
- * Sentry integration for buffering feature flags manually with an API, and
7
- * capturing them on error events. We recommend you do this on each flag
8
- * evaluation. Flags are buffered per Sentry scope and limited to 100 per event.
9
- *
10
- * See the [feature flag documentation](https://develop.sentry.dev/sdk/expected-features/#feature-flags) for more information.
11
- *
12
- * @example
13
- * ```
14
- * import * as Sentry from '@sentry/browser';
15
- * import { type FeatureFlagsIntegration } from '@sentry/browser';
16
- *
17
- * // Setup
18
- * Sentry.init(..., integrations: [Sentry.featureFlagsIntegration()])
19
- *
20
- * // Verify
21
- * const flagsIntegration = Sentry.getClient()?.getIntegrationByName<FeatureFlagsIntegration>('FeatureFlags');
22
- * if (flagsIntegration) {
23
- * flagsIntegration.addFeatureFlag('my-flag', true);
24
- * } else {
25
- * // check your setup
26
- * }
27
- * Sentry.captureException(Exception('broke')); // 'my-flag' should be captured to this Sentry event.
28
- * ```
29
- */
30
- export declare const featureFlagsIntegration: IntegrationFn<FeatureFlagsIntegration>;
31
- //# sourceMappingURL=featureFlagsIntegration.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"featureFlagsIntegration.d.ts","sourceRoot":"","sources":["../../../../../src/integrations/featureFlags/featureFlagsIntegration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA4B,WAAW,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAIzF,MAAM,WAAW,uBAAwB,SAAQ,WAAW;IAC1D,cAAc,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CACxD;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,uBAAuB,wCAYQ,CAAC"}
@@ -1,2 +0,0 @@
1
- export { featureFlagsIntegration, type FeatureFlagsIntegration } from './featureFlagsIntegration';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/integrations/featureFlags/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,KAAK,uBAAuB,EAAE,MAAM,2BAA2B,CAAC"}
@@ -1,34 +0,0 @@
1
- import type { Event, FeatureFlag } from '@sentry/core';
2
- /**
3
- * Ordered LRU cache for storing feature flags in the scope context. The name
4
- * of each flag in the buffer is unique, and the output of getAll() is ordered
5
- * from oldest to newest.
6
- */
7
- /**
8
- * Max size of the LRU flag buffer stored in Sentry scope and event contexts.
9
- */
10
- export declare const FLAG_BUFFER_SIZE = 100;
11
- /**
12
- * Copies feature flags that are in current scope context to the event context
13
- */
14
- export declare function copyFlagsFromScopeToEvent(event: Event): Event;
15
- /**
16
- * Creates a feature flags values array in current context if it does not exist
17
- * and inserts the flag into a FeatureFlag array while maintaining ordered LRU
18
- * properties. Not thread-safe. After inserting:
19
- * - `flags` is sorted in order of recency, with the newest flag at the end.
20
- * - No other flags with the same name exist in `flags`.
21
- * - The length of `flags` does not exceed `maxSize`. The oldest flag is evicted
22
- * as needed.
23
- *
24
- * @param name Name of the feature flag to insert.
25
- * @param value Value of the feature flag.
26
- * @param maxSize Max number of flags the buffer should store. It's recommended
27
- * to keep this consistent across insertions. Default is FLAG_BUFFER_SIZE
28
- */
29
- export declare function insertFlagToScope(name: string, value: unknown, maxSize?: number): void;
30
- /**
31
- * Exported for tests. Currently only accepts boolean values (otherwise no-op).
32
- */
33
- export declare function insertToFlagBuffer(flags: FeatureFlag[], name: string, value: unknown, maxSize: number): void;
34
- //# sourceMappingURL=featureFlags.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"featureFlags.d.ts","sourceRoot":"","sources":["../../../../src/utils/featureFlags.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAIvD;;;;GAIG;AAEH;;GAEG;AACH,eAAO,MAAM,gBAAgB,MAAM,CAAC;AAEpC;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,CAc7D;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,GAAE,MAAyB,GAAG,IAAI,CAOxG;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,WAAW,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CA4B5G"}
@@ -1,31 +0,0 @@
1
- import { Integration, IntegrationFn } from '@sentry/core';
2
- export interface FeatureFlagsIntegration extends Integration {
3
- addFeatureFlag: (name: string, value: unknown) => void;
4
- }
5
- /**
6
- * Sentry integration for buffering feature flags manually with an API, and
7
- * capturing them on error events. We recommend you do this on each flag
8
- * evaluation. Flags are buffered per Sentry scope and limited to 100 per event.
9
- *
10
- * See the [feature flag documentation](https://develop.sentry.dev/sdk/expected-features/#feature-flags) for more information.
11
- *
12
- * @example
13
- * ```
14
- * import * as Sentry from '@sentry/browser';
15
- * import { type FeatureFlagsIntegration } from '@sentry/browser';
16
- *
17
- * // Setup
18
- * Sentry.init(..., integrations: [Sentry.featureFlagsIntegration()])
19
- *
20
- * // Verify
21
- * const flagsIntegration = Sentry.getClient()?.getIntegrationByName<FeatureFlagsIntegration>('FeatureFlags');
22
- * if (flagsIntegration) {
23
- * flagsIntegration.addFeatureFlag('my-flag', true);
24
- * } else {
25
- * // check your setup
26
- * }
27
- * Sentry.captureException(Exception('broke')); // 'my-flag' should be captured to this Sentry event.
28
- * ```
29
- */
30
- export declare const featureFlagsIntegration: IntegrationFn<FeatureFlagsIntegration>;
31
- //# sourceMappingURL=featureFlagsIntegration.d.ts.map
@@ -1,2 +0,0 @@
1
- export { featureFlagsIntegration, FeatureFlagsIntegration } from './featureFlagsIntegration';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1,34 +0,0 @@
1
- import { Event, FeatureFlag } from '@sentry/core';
2
- /**
3
- * Ordered LRU cache for storing feature flags in the scope context. The name
4
- * of each flag in the buffer is unique, and the output of getAll() is ordered
5
- * from oldest to newest.
6
- */
7
- /**
8
- * Max size of the LRU flag buffer stored in Sentry scope and event contexts.
9
- */
10
- export declare const FLAG_BUFFER_SIZE = 100;
11
- /**
12
- * Copies feature flags that are in current scope context to the event context
13
- */
14
- export declare function copyFlagsFromScopeToEvent(event: Event): Event;
15
- /**
16
- * Creates a feature flags values array in current context if it does not exist
17
- * and inserts the flag into a FeatureFlag array while maintaining ordered LRU
18
- * properties. Not thread-safe. After inserting:
19
- * - `flags` is sorted in order of recency, with the newest flag at the end.
20
- * - No other flags with the same name exist in `flags`.
21
- * - The length of `flags` does not exceed `maxSize`. The oldest flag is evicted
22
- * as needed.
23
- *
24
- * @param name Name of the feature flag to insert.
25
- * @param value Value of the feature flag.
26
- * @param maxSize Max number of flags the buffer should store. It's recommended
27
- * to keep this consistent across insertions. Default is FLAG_BUFFER_SIZE
28
- */
29
- export declare function insertFlagToScope(name: string, value: unknown, maxSize?: number): void;
30
- /**
31
- * Exported for tests. Currently only accepts boolean values (otherwise no-op).
32
- */
33
- export declare function insertToFlagBuffer(flags: FeatureFlag[], name: string, value: unknown, maxSize: number): void;
34
- //# sourceMappingURL=featureFlags.d.ts.map