Skip to content

Commit 5561633

Browse files
committed
Fix dependencies and rename exports
1 parent cf24b75 commit 5561633

File tree

3 files changed

+23
-23
lines changed

3 files changed

+23
-23
lines changed

packages/launchdarkly/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@
4141
"dependencies": {
4242
"@sentry/browser": "^8.35.0",
4343
"@sentry/core": "8.35.0",
44-
"@sentry/types": "8.35.0",
45-
"@sentry/utils": "8.35.0",
44+
"@sentry/types": "*",
45+
"@sentry/utils": "*",
4646
"launchdarkly-js-client-sdk": "^3.5.0"
4747
},
4848
"scripts": {

packages/launchdarkly/src/core/integration.ts

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { insertToFlagBuffer } from '@sentry/utils';
2020
* const ldClient = LDClient.initialize(..., inspectors: [SentryInspector]);
2121
* ```
2222
*/
23-
export const launchDarklyIntegration = ((_options?: LaunchDarklyOptions) => {
23+
export const buildLaunchDarklyIntegration = ((_options?: LaunchDarklyOptions) => {
2424
return {
2525
name: 'launchdarkly',
2626

@@ -44,26 +44,27 @@ export const launchDarklyIntegration = ((_options?: LaunchDarklyOptions) => {
4444
* This needs to be registered separately in the LDClient, after initializing
4545
* Sentry.
4646
*/
47-
export class SentryInspector implements LDInspectionFlagUsedHandler {
48-
public name = 'sentry-flag-auditor';
49-
50-
public type = 'flag-used' as const;
47+
export function buildSentryFlagUsedInspector(): LDInspectionFlagUsedHandler {
48+
return {
49+
name: 'sentry-flag-auditor',
50+
type: 'flag-used',
5151

52-
// We don't want the handler to impact the performance of the user's flag evaluations.
53-
public synchronous = false;
52+
// We don't want the handler to impact the performance of the user's flag evaluations.
53+
synchronous: false,
5454

55-
/**
56-
* Handle a flag evaluation by storing its name and value on the current scope.
57-
*/
58-
public method(flagKey: string, flagDetail: LDEvaluationDetail, _context: LDContext): void {
59-
if (typeof flagDetail.value === 'boolean') {
60-
const scopeContexts = Sentry.getCurrentScope().getScopeData().contexts;
61-
if (!scopeContexts.flags) {
62-
scopeContexts.flags = {values: []}
55+
/**
56+
* Handle a flag evaluation by storing its name and value on the current scope.
57+
*/
58+
method: (flagKey: string, flagDetail: LDEvaluationDetail, _context: LDContext) => {
59+
if (typeof flagDetail.value === 'boolean') {
60+
const scopeContexts = Sentry.getCurrentScope().getScopeData().contexts;
61+
if (!scopeContexts.flags) {
62+
scopeContexts.flags = {values: []}
63+
}
64+
const flagBuffer = scopeContexts.flags.values;
65+
insertToFlagBuffer(flagBuffer, flagKey, flagDetail.value);
6366
}
64-
const flagBuffer = scopeContexts.flags.values;
65-
insertToFlagBuffer(flagBuffer, flagKey, flagDetail.value);
67+
return;
6668
}
67-
return;
6869
}
6970
}

packages/launchdarkly/src/index.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// This file is used as entry point to generate the npm package and CDN bundles.
22

3-
export { launchDarklyIntegration } from './core/integration';
3+
export { buildLaunchDarklyIntegration, buildSentryFlagUsedInspector } from './core/integration';
44

5-
// export type {
6-
// } from './types';
5+
export type { LaunchDarklyOptions } from './types'

0 commit comments

Comments
 (0)