@sentry/browser 8.42.0 → 8.44.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.
- package/build/npm/cjs/index.js +10 -0
- package/build/npm/cjs/index.js.map +1 -1
- package/build/npm/cjs/integrations/browsersession.js +44 -0
- package/build/npm/cjs/integrations/browsersession.js.map +1 -0
- package/build/npm/cjs/integrations/featureFlags/featureFlagsIntegration.js +46 -0
- package/build/npm/cjs/integrations/featureFlags/featureFlagsIntegration.js.map +1 -0
- package/build/npm/cjs/integrations/featureFlags/launchdarkly/integration.js +55 -0
- package/build/npm/cjs/integrations/featureFlags/launchdarkly/integration.js.map +1 -0
- package/build/npm/cjs/integrations/featureFlags/openfeature/integration.js +37 -0
- package/build/npm/cjs/integrations/featureFlags/openfeature/integration.js.map +1 -0
- package/build/npm/cjs/integrations/globalhandlers.js +8 -4
- package/build/npm/cjs/integrations/globalhandlers.js.map +1 -1
- package/build/npm/cjs/sdk.js +12 -37
- package/build/npm/cjs/sdk.js.map +1 -1
- package/build/npm/cjs/utils/featureFlags.js +96 -0
- package/build/npm/cjs/utils/featureFlags.js.map +1 -0
- package/build/npm/esm/index.js +4 -0
- package/build/npm/esm/index.js.map +1 -1
- package/build/npm/esm/integrations/browsersession.js +42 -0
- package/build/npm/esm/integrations/browsersession.js.map +1 -0
- package/build/npm/esm/integrations/featureFlags/featureFlagsIntegration.js +44 -0
- package/build/npm/esm/integrations/featureFlags/featureFlagsIntegration.js.map +1 -0
- package/build/npm/esm/integrations/featureFlags/launchdarkly/integration.js +52 -0
- package/build/npm/esm/integrations/featureFlags/launchdarkly/integration.js.map +1 -0
- package/build/npm/esm/integrations/featureFlags/openfeature/integration.js +34 -0
- package/build/npm/esm/integrations/featureFlags/openfeature/integration.js.map +1 -0
- package/build/npm/esm/integrations/globalhandlers.js +8 -4
- package/build/npm/esm/integrations/globalhandlers.js.map +1 -1
- package/build/npm/esm/package.json +1 -1
- package/build/npm/esm/sdk.js +13 -38
- package/build/npm/esm/sdk.js.map +1 -1
- package/build/npm/esm/utils/featureFlags.js +91 -0
- package/build/npm/esm/utils/featureFlags.js.map +1 -0
- package/build/npm/types/index.d.ts +7 -3
- package/build/npm/types/index.d.ts.map +1 -1
- package/build/npm/types/integrations/browsersession.d.ts +8 -0
- package/build/npm/types/integrations/browsersession.d.ts.map +1 -0
- package/build/npm/types/integrations/featureFlags/featureFlagsIntegration.d.ts +31 -0
- package/build/npm/types/integrations/featureFlags/featureFlagsIntegration.d.ts.map +1 -0
- package/build/npm/types/integrations/featureFlags/index.d.ts +2 -0
- package/build/npm/types/integrations/featureFlags/index.d.ts.map +1 -0
- package/build/npm/types/integrations/featureFlags/launchdarkly/index.d.ts +2 -0
- package/build/npm/types/integrations/featureFlags/launchdarkly/index.d.ts.map +1 -0
- package/build/npm/types/integrations/featureFlags/launchdarkly/integration.d.ts +25 -0
- package/build/npm/types/integrations/featureFlags/launchdarkly/integration.d.ts.map +1 -0
- package/build/npm/types/integrations/featureFlags/launchdarkly/types.d.ts +44 -0
- package/build/npm/types/integrations/featureFlags/launchdarkly/types.d.ts.map +1 -0
- package/build/npm/types/integrations/featureFlags/openfeature/index.d.ts +2 -0
- package/build/npm/types/integrations/featureFlags/openfeature/index.d.ts.map +1 -0
- package/build/npm/types/integrations/featureFlags/openfeature/integration.d.ts +16 -0
- package/build/npm/types/integrations/featureFlags/openfeature/integration.d.ts.map +1 -0
- package/build/npm/types/integrations/featureFlags/openfeature/types.d.ts +86 -0
- package/build/npm/types/integrations/featureFlags/openfeature/types.d.ts.map +1 -0
- package/build/npm/types/sdk.d.ts +1 -1
- package/build/npm/types/sdk.d.ts.map +1 -1
- package/build/npm/types/utils/featureFlags.d.ts +34 -0
- package/build/npm/types/utils/featureFlags.d.ts.map +1 -0
- package/build/npm/types-ts3.8/index.d.ts +7 -3
- package/build/npm/types-ts3.8/integrations/browsersession.d.ts +8 -0
- package/build/npm/types-ts3.8/integrations/featureFlags/featureFlagsIntegration.d.ts +31 -0
- package/build/npm/types-ts3.8/integrations/featureFlags/index.d.ts +2 -0
- package/build/npm/types-ts3.8/integrations/featureFlags/launchdarkly/index.d.ts +2 -0
- package/build/npm/types-ts3.8/integrations/featureFlags/launchdarkly/integration.d.ts +25 -0
- package/build/npm/types-ts3.8/integrations/featureFlags/launchdarkly/types.d.ts +44 -0
- package/build/npm/types-ts3.8/integrations/featureFlags/openfeature/index.d.ts +2 -0
- package/build/npm/types-ts3.8/integrations/featureFlags/openfeature/integration.d.ts +16 -0
- package/build/npm/types-ts3.8/integrations/featureFlags/openfeature/types.d.ts +86 -0
- package/build/npm/types-ts3.8/sdk.d.ts +1 -1
- package/build/npm/types-ts3.8/utils/featureFlags.d.ts +34 -0
- package/package.json +7 -7
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { addHistoryInstrumentationHandler } from '@sentry-internal/browser-utils';
|
|
2
|
+
import { defineIntegration, logger, startSession, captureSession } from '@sentry/core';
|
|
3
|
+
import { DEBUG_BUILD } from '../debug-build.js';
|
|
4
|
+
import { WINDOW } from '../helpers.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* When added, automatically creates sessions which allow you to track adoption and crashes (crash free rate) in your Releases in Sentry.
|
|
8
|
+
* More information: https://docs.sentry.io/product/releases/health/
|
|
9
|
+
*
|
|
10
|
+
* Note: In order for session tracking to work, you need to set up Releases: https://docs.sentry.io/product/releases/
|
|
11
|
+
*/
|
|
12
|
+
const browserSessionIntegration = defineIntegration(() => {
|
|
13
|
+
return {
|
|
14
|
+
name: 'BrowserSession',
|
|
15
|
+
setupOnce() {
|
|
16
|
+
if (typeof WINDOW.document === 'undefined') {
|
|
17
|
+
DEBUG_BUILD &&
|
|
18
|
+
logger.warn('Using the `browserSessionIntegration` in non-browser environments is not supported.');
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// The session duration for browser sessions does not track a meaningful
|
|
23
|
+
// concept that can be used as a metric.
|
|
24
|
+
// Automatically captured sessions are akin to page views, and thus we
|
|
25
|
+
// discard their duration.
|
|
26
|
+
startSession({ ignoreDuration: true });
|
|
27
|
+
captureSession();
|
|
28
|
+
|
|
29
|
+
// We want to create a session for every navigation as well
|
|
30
|
+
addHistoryInstrumentationHandler(({ from, to }) => {
|
|
31
|
+
// Don't create an additional session for the initial route or if the location did not change
|
|
32
|
+
if (from !== undefined && from !== to) {
|
|
33
|
+
startSession({ ignoreDuration: true });
|
|
34
|
+
captureSession();
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
export { browserSessionIntegration };
|
|
42
|
+
//# sourceMappingURL=browsersession.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browsersession.js","sources":["../../../../src/integrations/browsersession.ts"],"sourcesContent":["import { addHistoryInstrumentationHandler } from '@sentry-internal/browser-utils';\nimport { captureSession, defineIntegration, logger, startSession } from '@sentry/core';\nimport { DEBUG_BUILD } from '../debug-build';\nimport { WINDOW } from '../helpers';\n\n/**\n * When added, automatically creates sessions which allow you to track adoption and crashes (crash free rate) in your Releases in Sentry.\n * More information: https://docs.sentry.io/product/releases/health/\n *\n * Note: In order for session tracking to work, you need to set up Releases: https://docs.sentry.io/product/releases/\n */\nexport const browserSessionIntegration = defineIntegration(() => {\n return {\n name: 'BrowserSession',\n setupOnce() {\n if (typeof WINDOW.document === 'undefined') {\n DEBUG_BUILD &&\n logger.warn('Using the `browserSessionIntegration` in non-browser environments is not supported.');\n return;\n }\n\n // The session duration for browser sessions does not track a meaningful\n // concept that can be used as a metric.\n // Automatically captured sessions are akin to page views, and thus we\n // discard their duration.\n startSession({ ignoreDuration: true });\n captureSession();\n\n // We want to create a session for every navigation as well\n addHistoryInstrumentationHandler(({ from, to }) => {\n // Don't create an additional session for the initial route or if the location did not change\n if (from !== undefined && from !== to) {\n startSession({ ignoreDuration: true });\n captureSession();\n }\n });\n },\n };\n});\n"],"names":[],"mappings":";;;;;AAKA;AACA;AACA;AACA;AACA;AACA;MACa,yBAA0B,GAAE,iBAAiB,CAAC,MAAM;AACjE,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,gBAAgB;AAC1B,IAAI,SAAS,GAAG;AAChB,MAAM,IAAI,OAAO,MAAM,CAAC,QAAS,KAAI,WAAW,EAAE;AAClD,QAAQ,WAAY;AACpB,UAAU,MAAM,CAAC,IAAI,CAAC,qFAAqF,CAAC;AAC5G,QAAQ;AACR;;AAEA;AACA;AACA;AACA;AACA,MAAM,YAAY,CAAC,EAAE,cAAc,EAAE,IAAA,EAAM,CAAC;AAC5C,MAAM,cAAc,EAAE;;AAEtB;AACA,MAAM,gCAAgC,CAAC,CAAC,EAAE,IAAI,EAAE,EAAA,EAAI,KAAK;AACzD;AACA,QAAQ,IAAI,IAAK,KAAI,aAAa,IAAA,KAAS,EAAE,EAAE;AAC/C,UAAU,YAAY,CAAC,EAAE,cAAc,EAAE,IAAA,EAAM,CAAC;AAChD,UAAU,cAAc,EAAE;AAC1B;AACA,OAAO,CAAC;AACR,KAAK;AACL,GAAG;AACH,CAAC;;;;"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { defineIntegration } from '@sentry/core';
|
|
2
|
+
import { copyFlagsFromScopeToEvent, insertFlagToScope } 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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"featureFlagsIntegration.js","sources":["../../../../../src/integrations/featureFlags/featureFlagsIntegration.ts"],"sourcesContent":["import type { Client, Event, EventHint, Integration, IntegrationFn } from '@sentry/core';\n\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":";;;AASA;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;;;;"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { defineIntegration } from '@sentry/core';
|
|
2
|
+
import { copyFlagsFromScopeToEvent, insertFlagToScope } from '../../../utils/featureFlags.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Sentry integration for capturing feature flags from LaunchDarkly.
|
|
6
|
+
*
|
|
7
|
+
* See the [feature flag documentation](https://develop.sentry.dev/sdk/expected-features/#feature-flags) for more information.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```
|
|
11
|
+
* import * as Sentry from '@sentry/browser';
|
|
12
|
+
* import {launchDarklyIntegration, buildLaunchDarklyFlagUsedInspector} from '@sentry/browser';
|
|
13
|
+
* import * as LaunchDarkly from 'launchdarkly-js-client-sdk';
|
|
14
|
+
*
|
|
15
|
+
* Sentry.init(..., integrations: [launchDarklyIntegration()])
|
|
16
|
+
* const ldClient = LaunchDarkly.initialize(..., {inspectors: [buildLaunchDarklyFlagUsedHandler()]});
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
const launchDarklyIntegration = defineIntegration(() => {
|
|
20
|
+
return {
|
|
21
|
+
name: 'LaunchDarkly',
|
|
22
|
+
|
|
23
|
+
processEvent(event, _hint, _client) {
|
|
24
|
+
return copyFlagsFromScopeToEvent(event);
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
}) ;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* LaunchDarkly hook that listens for flag evaluations and updates the `flags`
|
|
31
|
+
* context in our Sentry scope. This needs to be registered as an
|
|
32
|
+
* 'inspector' in LaunchDarkly initialize() options, separately from
|
|
33
|
+
* `launchDarklyIntegration`. Both are needed to collect feature flags on error.
|
|
34
|
+
*/
|
|
35
|
+
function buildLaunchDarklyFlagUsedHandler() {
|
|
36
|
+
return {
|
|
37
|
+
name: 'sentry-flag-auditor',
|
|
38
|
+
type: 'flag-used',
|
|
39
|
+
|
|
40
|
+
synchronous: true,
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Handle a flag evaluation by storing its name and value on the current scope.
|
|
44
|
+
*/
|
|
45
|
+
method: (flagKey, flagDetail, _context) => {
|
|
46
|
+
insertFlagToScope(flagKey, flagDetail.value);
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export { buildLaunchDarklyFlagUsedHandler, launchDarklyIntegration };
|
|
52
|
+
//# sourceMappingURL=integration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"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;;;;"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { defineIntegration } from '@sentry/core';
|
|
2
|
+
import { copyFlagsFromScopeToEvent, insertFlagToScope } from '../../../utils/featureFlags.js';
|
|
3
|
+
|
|
4
|
+
const openFeatureIntegration = defineIntegration(() => {
|
|
5
|
+
return {
|
|
6
|
+
name: 'OpenFeature',
|
|
7
|
+
|
|
8
|
+
processEvent(event, _hint, _client) {
|
|
9
|
+
return copyFlagsFromScopeToEvent(event);
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
}) ;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* OpenFeature Hook class implementation.
|
|
16
|
+
*/
|
|
17
|
+
class OpenFeatureIntegrationHook {
|
|
18
|
+
/**
|
|
19
|
+
* Successful evaluation result.
|
|
20
|
+
*/
|
|
21
|
+
after(_hookContext, evaluationDetails) {
|
|
22
|
+
insertFlagToScope(evaluationDetails.flagKey, evaluationDetails.value);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* On error evaluation result.
|
|
27
|
+
*/
|
|
28
|
+
error(hookContext, _error, _hookHints) {
|
|
29
|
+
insertFlagToScope(hookContext.flagKey, hookContext.defaultValue);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export { OpenFeatureIntegrationHook, openFeatureIntegration };
|
|
34
|
+
//# sourceMappingURL=integration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integration.js","sources":["../../../../../../src/integrations/featureFlags/openfeature/integration.ts"],"sourcesContent":["/**\n * OpenFeature integration.\n *\n * Add the openFeatureIntegration() function call to your integration lists.\n * Add the integration hook to your OpenFeature object.\n * - OpenFeature.getClient().addHooks(new OpenFeatureIntegrationHook());\n */\nimport type { Client, Event, EventHint, IntegrationFn } from '@sentry/core';\nimport type { EvaluationDetails, HookContext, HookHints, JsonValue, OpenFeatureHook } from './types';\n\nimport { defineIntegration } from '@sentry/core';\nimport { copyFlagsFromScopeToEvent, insertFlagToScope } from '../../../utils/featureFlags';\n\nexport const openFeatureIntegration = defineIntegration(() => {\n return {\n name: 'OpenFeature',\n\n processEvent(event: Event, _hint: EventHint, _client: Client): Event {\n return copyFlagsFromScopeToEvent(event);\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * OpenFeature Hook class implementation.\n */\nexport class OpenFeatureIntegrationHook implements OpenFeatureHook {\n /**\n * Successful evaluation result.\n */\n public after(_hookContext: Readonly<HookContext<JsonValue>>, evaluationDetails: EvaluationDetails<JsonValue>): void {\n insertFlagToScope(evaluationDetails.flagKey, evaluationDetails.value);\n }\n\n /**\n * On error evaluation result.\n */\n public error(hookContext: Readonly<HookContext<JsonValue>>, _error: unknown, _hookHints?: HookHints): void {\n insertFlagToScope(hookContext.flagKey, hookContext.defaultValue);\n }\n}\n"],"names":[],"mappings":";;;MAaa,sBAAuB,GAAE,iBAAiB,CAAC,MAAM;AAC9D,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,aAAa;;AAEvB,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;AACO,MAAM,4BAAsD;AACnE;AACA;AACA;AACA,GAAS,KAAK,CAAC,YAAY,EAAoC,iBAAiB,EAAsC;AACtH,IAAI,iBAAiB,CAAC,iBAAiB,CAAC,OAAO,EAAE,iBAAiB,CAAC,KAAK,CAAC;AACzE;;AAEA;AACA;AACA;AACA,GAAS,KAAK,CAAC,WAAW,EAAoC,MAAM,EAAW,UAAU,EAAoB;AAC7G,IAAI,iBAAiB,CAAC,WAAW,CAAC,OAAO,EAAE,WAAW,CAAC,YAAY,CAAC;AACpE;AACA;;;;"}
|
|
@@ -134,8 +134,12 @@ function _eventFromRejectionWithPrimitive(reason) {
|
|
|
134
134
|
};
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
|
|
138
|
-
|
|
137
|
+
function _enhanceEventWithInitialFrame(
|
|
138
|
+
event,
|
|
139
|
+
url,
|
|
140
|
+
line,
|
|
141
|
+
column,
|
|
142
|
+
) {
|
|
139
143
|
// event.exception
|
|
140
144
|
const e = (event.exception = event.exception || {});
|
|
141
145
|
// event.exception.values
|
|
@@ -147,8 +151,8 @@ function _enhanceEventWithInitialFrame(event, url, line, column) {
|
|
|
147
151
|
// event.exception.values[0].stacktrace.frames
|
|
148
152
|
const ev0sf = (ev0s.frames = ev0s.frames || []);
|
|
149
153
|
|
|
150
|
-
const colno =
|
|
151
|
-
const lineno =
|
|
154
|
+
const colno = column;
|
|
155
|
+
const lineno = line;
|
|
152
156
|
const filename = isString(url) && url.length > 0 ? url : getLocationHref();
|
|
153
157
|
|
|
154
158
|
// event.exception.values[0].stacktrace.frames
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"globalhandlers.js","sources":["../../../../src/integrations/globalhandlers.ts"],"sourcesContent":["import type { Client, Event, IntegrationFn, Primitive, StackParser } from '@sentry/core';\nimport {\n UNKNOWN_FUNCTION,\n addGlobalErrorInstrumentationHandler,\n addGlobalUnhandledRejectionInstrumentationHandler,\n captureEvent,\n defineIntegration,\n getClient,\n getLocationHref,\n isPrimitive,\n isString,\n logger,\n} from '@sentry/core';\n\nimport type { BrowserClient } from '../client';\nimport { DEBUG_BUILD } from '../debug-build';\nimport { eventFromUnknownInput } from '../eventbuilder';\nimport { shouldIgnoreOnError } from '../helpers';\n\ntype GlobalHandlersIntegrationsOptionKeys = 'onerror' | 'onunhandledrejection';\n\ntype GlobalHandlersIntegrations = Record<GlobalHandlersIntegrationsOptionKeys, boolean>;\n\nconst INTEGRATION_NAME = 'GlobalHandlers';\n\nconst _globalHandlersIntegration = ((options: Partial<GlobalHandlersIntegrations> = {}) => {\n const _options = {\n onerror: true,\n onunhandledrejection: true,\n ...options,\n };\n\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n Error.stackTraceLimit = 50;\n },\n setup(client) {\n if (_options.onerror) {\n _installGlobalOnErrorHandler(client);\n globalHandlerLog('onerror');\n }\n if (_options.onunhandledrejection) {\n _installGlobalOnUnhandledRejectionHandler(client);\n globalHandlerLog('onunhandledrejection');\n }\n },\n };\n}) satisfies IntegrationFn;\n\nexport const globalHandlersIntegration = defineIntegration(_globalHandlersIntegration);\n\nfunction _installGlobalOnErrorHandler(client: Client): void {\n addGlobalErrorInstrumentationHandler(data => {\n const { stackParser, attachStacktrace } = getOptions();\n\n if (getClient() !== client || shouldIgnoreOnError()) {\n return;\n }\n\n const { msg, url, line, column, error } = data;\n\n const event = _enhanceEventWithInitialFrame(\n eventFromUnknownInput(stackParser, error || msg, undefined, attachStacktrace, false),\n url,\n line,\n column,\n );\n\n event.level = 'error';\n\n captureEvent(event, {\n originalException: error,\n mechanism: {\n handled: false,\n type: 'onerror',\n },\n });\n });\n}\n\nfunction _installGlobalOnUnhandledRejectionHandler(client: Client): void {\n addGlobalUnhandledRejectionInstrumentationHandler(e => {\n const { stackParser, attachStacktrace } = getOptions();\n\n if (getClient() !== client || shouldIgnoreOnError()) {\n return;\n }\n\n const error = _getUnhandledRejectionError(e as unknown);\n\n const event = isPrimitive(error)\n ? _eventFromRejectionWithPrimitive(error)\n : eventFromUnknownInput(stackParser, error, undefined, attachStacktrace, true);\n\n event.level = 'error';\n\n captureEvent(event, {\n originalException: error,\n mechanism: {\n handled: false,\n type: 'onunhandledrejection',\n },\n });\n });\n}\n\nfunction _getUnhandledRejectionError(error: unknown): unknown {\n if (isPrimitive(error)) {\n return error;\n }\n\n // dig the object of the rejection out of known event types\n try {\n type ErrorWithReason = { reason: unknown };\n // PromiseRejectionEvents store the object of the rejection under 'reason'\n // see https://developer.mozilla.org/en-US/docs/Web/API/PromiseRejectionEvent\n if ('reason' in (error as ErrorWithReason)) {\n return (error as ErrorWithReason).reason;\n }\n\n type CustomEventWithDetail = { detail: { reason: unknown } };\n // something, somewhere, (likely a browser extension) effectively casts PromiseRejectionEvents\n // to CustomEvents, moving the `promise` and `reason` attributes of the PRE into\n // the CustomEvent's `detail` attribute, since they're not part of CustomEvent's spec\n // see https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent and\n // https://github.com/getsentry/sentry-javascript/issues/2380\n if ('detail' in (error as CustomEventWithDetail) && 'reason' in (error as CustomEventWithDetail).detail) {\n return (error as CustomEventWithDetail).detail.reason;\n }\n } catch {} // eslint-disable-line no-empty\n\n return error;\n}\n\n/**\n * Create an event from a promise rejection where the `reason` is a primitive.\n *\n * @param reason: The `reason` property of the promise rejection\n * @returns An Event object with an appropriate `exception` value\n */\nfunction _eventFromRejectionWithPrimitive(reason: Primitive): Event {\n return {\n exception: {\n values: [\n {\n type: 'UnhandledRejection',\n // String() is needed because the Primitive type includes symbols (which can't be automatically stringified)\n value: `Non-Error promise rejection captured with value: ${String(reason)}`,\n },\n ],\n },\n };\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction _enhanceEventWithInitialFrame(event: Event, url: any, line: any, column: any): Event {\n // event.exception\n const e = (event.exception = event.exception || {});\n // event.exception.values\n const ev = (e.values = e.values || []);\n // event.exception.values[0]\n const ev0 = (ev[0] = ev[0] || {});\n // event.exception.values[0].stacktrace\n const ev0s = (ev0.stacktrace = ev0.stacktrace || {});\n // event.exception.values[0].stacktrace.frames\n const ev0sf = (ev0s.frames = ev0s.frames || []);\n\n const colno = isNaN(parseInt(column, 10)) ? undefined : column;\n const lineno = isNaN(parseInt(line, 10)) ? undefined : line;\n const filename = isString(url) && url.length > 0 ? url : getLocationHref();\n\n // event.exception.values[0].stacktrace.frames\n if (ev0sf.length === 0) {\n ev0sf.push({\n colno,\n filename,\n function: UNKNOWN_FUNCTION,\n in_app: true,\n lineno,\n });\n }\n\n return event;\n}\n\nfunction globalHandlerLog(type: string): void {\n DEBUG_BUILD && logger.log(`Global Handler attached: ${type}`);\n}\n\nfunction getOptions(): { stackParser: StackParser; attachStacktrace?: boolean } {\n const client = getClient<BrowserClient>();\n const options = (client && client.getOptions()) || {\n stackParser: () => [],\n attachStacktrace: false,\n };\n return options;\n}\n"],"names":[],"mappings":";;;;;AAuBA,MAAM,gBAAA,GAAmB,gBAAgB;;AAEzC,MAAM,0BAAA,IAA8B,CAAC,OAAO,GAAwC,EAAE,KAAK;AAC3F,EAAE,MAAM,WAAW;AACnB,IAAI,OAAO,EAAE,IAAI;AACjB,IAAI,oBAAoB,EAAE,IAAI;AAC9B,IAAI,GAAG,OAAO;AACd,GAAG;;AAEH,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,gBAAgB;AAC1B,IAAI,SAAS,GAAG;AAChB,MAAM,KAAK,CAAC,eAAgB,GAAE,EAAE;AAChC,KAAK;AACL,IAAI,KAAK,CAAC,MAAM,EAAE;AAClB,MAAM,IAAI,QAAQ,CAAC,OAAO,EAAE;AA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AA;AACA,MAAA,MAAA;AACA,KAAA,CAAA;AACA;;AAEA,EAAA,OAAA,KAAA;AACA;;AAEA,SAAA,gBAAA,CAAA,IAAA,EAAA;AACA,EAAA,WAAA,IAAA,MAAA,CAAA,GAAA,CAAA,CAAA,yBAAA,EAAA,IAAA,CAAA,CAAA,CAAA;AACA;;AAEA,SAAA,UAAA,GAAA;AACA,EAAA,MAAA,MAAA,GAAA,SAAA,EAAA;AACA,EAAA,MAAA,OAAA,GAAA,CAAA,MAAA,IAAA,MAAA,CAAA,UAAA,EAAA,KAAA;AACA,IAAA,WAAA,EAAA,MAAA,EAAA;AACA,IAAA,gBAAA,EAAA,KAAA;AACA,GAAA;AACA,EAAA,OAAA,OAAA;AACA;;;;"}
|
|
1
|
+
{"version":3,"file":"globalhandlers.js","sources":["../../../../src/integrations/globalhandlers.ts"],"sourcesContent":["import type { Client, Event, IntegrationFn, Primitive, StackParser } from '@sentry/core';\nimport {\n UNKNOWN_FUNCTION,\n addGlobalErrorInstrumentationHandler,\n addGlobalUnhandledRejectionInstrumentationHandler,\n captureEvent,\n defineIntegration,\n getClient,\n getLocationHref,\n isPrimitive,\n isString,\n logger,\n} from '@sentry/core';\n\nimport type { BrowserClient } from '../client';\nimport { DEBUG_BUILD } from '../debug-build';\nimport { eventFromUnknownInput } from '../eventbuilder';\nimport { shouldIgnoreOnError } from '../helpers';\n\ntype GlobalHandlersIntegrationsOptionKeys = 'onerror' | 'onunhandledrejection';\n\ntype GlobalHandlersIntegrations = Record<GlobalHandlersIntegrationsOptionKeys, boolean>;\n\nconst INTEGRATION_NAME = 'GlobalHandlers';\n\nconst _globalHandlersIntegration = ((options: Partial<GlobalHandlersIntegrations> = {}) => {\n const _options = {\n onerror: true,\n onunhandledrejection: true,\n ...options,\n };\n\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n Error.stackTraceLimit = 50;\n },\n setup(client) {\n if (_options.onerror) {\n _installGlobalOnErrorHandler(client);\n globalHandlerLog('onerror');\n }\n if (_options.onunhandledrejection) {\n _installGlobalOnUnhandledRejectionHandler(client);\n globalHandlerLog('onunhandledrejection');\n }\n },\n };\n}) satisfies IntegrationFn;\n\nexport const globalHandlersIntegration = defineIntegration(_globalHandlersIntegration);\n\nfunction _installGlobalOnErrorHandler(client: Client): void {\n addGlobalErrorInstrumentationHandler(data => {\n const { stackParser, attachStacktrace } = getOptions();\n\n if (getClient() !== client || shouldIgnoreOnError()) {\n return;\n }\n\n const { msg, url, line, column, error } = data;\n\n const event = _enhanceEventWithInitialFrame(\n eventFromUnknownInput(stackParser, error || msg, undefined, attachStacktrace, false),\n url,\n line,\n column,\n );\n\n event.level = 'error';\n\n captureEvent(event, {\n originalException: error,\n mechanism: {\n handled: false,\n type: 'onerror',\n },\n });\n });\n}\n\nfunction _installGlobalOnUnhandledRejectionHandler(client: Client): void {\n addGlobalUnhandledRejectionInstrumentationHandler(e => {\n const { stackParser, attachStacktrace } = getOptions();\n\n if (getClient() !== client || shouldIgnoreOnError()) {\n return;\n }\n\n const error = _getUnhandledRejectionError(e as unknown);\n\n const event = isPrimitive(error)\n ? _eventFromRejectionWithPrimitive(error)\n : eventFromUnknownInput(stackParser, error, undefined, attachStacktrace, true);\n\n event.level = 'error';\n\n captureEvent(event, {\n originalException: error,\n mechanism: {\n handled: false,\n type: 'onunhandledrejection',\n },\n });\n });\n}\n\nfunction _getUnhandledRejectionError(error: unknown): unknown {\n if (isPrimitive(error)) {\n return error;\n }\n\n // dig the object of the rejection out of known event types\n try {\n type ErrorWithReason = { reason: unknown };\n // PromiseRejectionEvents store the object of the rejection under 'reason'\n // see https://developer.mozilla.org/en-US/docs/Web/API/PromiseRejectionEvent\n if ('reason' in (error as ErrorWithReason)) {\n return (error as ErrorWithReason).reason;\n }\n\n type CustomEventWithDetail = { detail: { reason: unknown } };\n // something, somewhere, (likely a browser extension) effectively casts PromiseRejectionEvents\n // to CustomEvents, moving the `promise` and `reason` attributes of the PRE into\n // the CustomEvent's `detail` attribute, since they're not part of CustomEvent's spec\n // see https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent and\n // https://github.com/getsentry/sentry-javascript/issues/2380\n if ('detail' in (error as CustomEventWithDetail) && 'reason' in (error as CustomEventWithDetail).detail) {\n return (error as CustomEventWithDetail).detail.reason;\n }\n } catch {} // eslint-disable-line no-empty\n\n return error;\n}\n\n/**\n * Create an event from a promise rejection where the `reason` is a primitive.\n *\n * @param reason: The `reason` property of the promise rejection\n * @returns An Event object with an appropriate `exception` value\n */\nfunction _eventFromRejectionWithPrimitive(reason: Primitive): Event {\n return {\n exception: {\n values: [\n {\n type: 'UnhandledRejection',\n // String() is needed because the Primitive type includes symbols (which can't be automatically stringified)\n value: `Non-Error promise rejection captured with value: ${String(reason)}`,\n },\n ],\n },\n };\n}\n\nfunction _enhanceEventWithInitialFrame(\n event: Event,\n url: string | undefined,\n line: number | undefined,\n column: number | undefined,\n): Event {\n // event.exception\n const e = (event.exception = event.exception || {});\n // event.exception.values\n const ev = (e.values = e.values || []);\n // event.exception.values[0]\n const ev0 = (ev[0] = ev[0] || {});\n // event.exception.values[0].stacktrace\n const ev0s = (ev0.stacktrace = ev0.stacktrace || {});\n // event.exception.values[0].stacktrace.frames\n const ev0sf = (ev0s.frames = ev0s.frames || []);\n\n const colno = column;\n const lineno = line;\n const filename = isString(url) && url.length > 0 ? url : getLocationHref();\n\n // event.exception.values[0].stacktrace.frames\n if (ev0sf.length === 0) {\n ev0sf.push({\n colno,\n filename,\n function: UNKNOWN_FUNCTION,\n in_app: true,\n lineno,\n });\n }\n\n return event;\n}\n\nfunction globalHandlerLog(type: string): void {\n DEBUG_BUILD && logger.log(`Global Handler attached: ${type}`);\n}\n\nfunction getOptions(): { stackParser: StackParser; attachStacktrace?: boolean } {\n const client = getClient<BrowserClient>();\n const options = (client && client.getOptions()) || {\n stackParser: () => [],\n attachStacktrace: false,\n };\n return options;\n}\n"],"names":[],"mappings":";;;;;AAuBA,MAAM,gBAAA,GAAmB,gBAAgB;;AAEzC,MAAM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,CAAA,IAAA,GAAA,CAAA,MAAA,GAAA,CAAA,GAAA,GAAA,GAAA,eAAA,EAAA;;AAEA;AACA,EAAA,IAAA,KAAA,CAAA,MAAA,KAAA,CAAA,EAAA;AACA,IAAA,KAAA,CAAA,IAAA,CAAA;AACA,MAAA,KAAA;AACA,MAAA,QAAA;AACA,MAAA,QAAA,EAAA,gBAAA;AACA,MAAA,MAAA,EAAA,IAAA;AACA,MAAA,MAAA;AACA,KAAA,CAAA;AACA;;AAEA,EAAA,OAAA,KAAA;AACA;;AAEA,SAAA,gBAAA,CAAA,IAAA,EAAA;AACA,EAAA,WAAA,IAAA,MAAA,CAAA,GAAA,CAAA,CAAA,yBAAA,EAAA,IAAA,CAAA,CAAA,CAAA;AACA;;AAEA,SAAA,UAAA,GAAA;AACA,EAAA,MAAA,MAAA,GAAA,SAAA,EAAA;AACA,EAAA,MAAA,OAAA,GAAA,CAAA,MAAA,IAAA,MAAA,CAAA,UAAA,EAAA,KAAA;AACA,IAAA,WAAA,EAAA,MAAA,EAAA;AACA,IAAA,gBAAA,EAAA,KAAA;AACA,GAAA;AACA,EAAA,OAAA,OAAA;AACA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"type":"module","version":"8.
|
|
1
|
+
{"type":"module","version":"8.44.0","sideEffects":false}
|
package/build/npm/esm/sdk.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { inboundFiltersIntegration, functionToStringIntegration, dedupeIntegration, consoleSandbox, supportsFetch, logger, stackParserFromStackParserOptions, getIntegrationsToSetup, initAndBind, getCurrentScope, lastEventId, getReportDialogEndpoint, startSession, captureSession, getClient } from '@sentry/core';
|
|
1
|
+
import { inboundFiltersIntegration, functionToStringIntegration, dedupeIntegration, consoleSandbox, supportsFetch, logger, stackParserFromStackParserOptions, getIntegrationsToSetup, initAndBind, getCurrentScope, lastEventId, getReportDialogEndpoint, getClient } from '@sentry/core';
|
|
3
2
|
import { BrowserClient } from './client.js';
|
|
4
3
|
import { DEBUG_BUILD } from './debug-build.js';
|
|
5
4
|
import { WINDOW } from './helpers.js';
|
|
6
5
|
import { breadcrumbsIntegration } from './integrations/breadcrumbs.js';
|
|
7
6
|
import { browserApiErrorsIntegration } from './integrations/browserapierrors.js';
|
|
7
|
+
import { browserSessionIntegration } from './integrations/browsersession.js';
|
|
8
8
|
import { globalHandlersIntegration } from './integrations/globalhandlers.js';
|
|
9
9
|
import { httpContextIntegration } from './integrations/httpcontext.js';
|
|
10
10
|
import { linkedErrorsIntegration } from './integrations/linkederrors.js';
|
|
@@ -12,12 +12,12 @@ import { defaultStackParser } from './stack-parsers.js';
|
|
|
12
12
|
import { makeFetchTransport } from './transports/fetch.js';
|
|
13
13
|
|
|
14
14
|
/** Get the default integrations for the browser SDK. */
|
|
15
|
-
function getDefaultIntegrations(
|
|
15
|
+
function getDefaultIntegrations(options) {
|
|
16
16
|
/**
|
|
17
17
|
* Note: Please make sure this stays in sync with Angular SDK, which re-exports
|
|
18
18
|
* `getDefaultIntegrations` but with an adjusted set of integrations.
|
|
19
19
|
*/
|
|
20
|
-
|
|
20
|
+
const integrations = [
|
|
21
21
|
inboundFiltersIntegration(),
|
|
22
22
|
functionToStringIntegration(),
|
|
23
23
|
browserApiErrorsIntegration(),
|
|
@@ -27,11 +27,18 @@ function getDefaultIntegrations(_options) {
|
|
|
27
27
|
dedupeIntegration(),
|
|
28
28
|
httpContextIntegration(),
|
|
29
29
|
];
|
|
30
|
+
|
|
31
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
32
|
+
if (options.autoSessionTracking !== false) {
|
|
33
|
+
integrations.push(browserSessionIntegration());
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return integrations;
|
|
30
37
|
}
|
|
31
38
|
|
|
32
39
|
function applyDefaultOptions(optionsArg = {}) {
|
|
33
40
|
const defaultOptions = {
|
|
34
|
-
defaultIntegrations: getDefaultIntegrations(),
|
|
41
|
+
defaultIntegrations: getDefaultIntegrations(optionsArg),
|
|
35
42
|
release:
|
|
36
43
|
typeof __SENTRY_RELEASE__ === 'string' // This allows build tooling to find-and-replace __SENTRY_RELEASE__ to inject a release value
|
|
37
44
|
? __SENTRY_RELEASE__
|
|
@@ -157,13 +164,7 @@ function init(browserOptions = {}) {
|
|
|
157
164
|
transport: options.transport || makeFetchTransport,
|
|
158
165
|
};
|
|
159
166
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
if (options.autoSessionTracking) {
|
|
163
|
-
startSessionTracking();
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
return client;
|
|
167
|
+
return initAndBind(BrowserClient, clientOptions);
|
|
167
168
|
}
|
|
168
169
|
|
|
169
170
|
/**
|
|
@@ -252,32 +253,6 @@ function onLoad(callback) {
|
|
|
252
253
|
callback();
|
|
253
254
|
}
|
|
254
255
|
|
|
255
|
-
/**
|
|
256
|
-
* Enable automatic Session Tracking for the initial page load.
|
|
257
|
-
*/
|
|
258
|
-
function startSessionTracking() {
|
|
259
|
-
if (typeof WINDOW.document === 'undefined') {
|
|
260
|
-
DEBUG_BUILD && logger.warn('Session tracking in non-browser environment with @sentry/browser is not supported.');
|
|
261
|
-
return;
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
// The session duration for browser sessions does not track a meaningful
|
|
265
|
-
// concept that can be used as a metric.
|
|
266
|
-
// Automatically captured sessions are akin to page views, and thus we
|
|
267
|
-
// discard their duration.
|
|
268
|
-
startSession({ ignoreDuration: true });
|
|
269
|
-
captureSession();
|
|
270
|
-
|
|
271
|
-
// We want to create a session for every navigation as well
|
|
272
|
-
addHistoryInstrumentationHandler(({ from, to }) => {
|
|
273
|
-
// Don't create an additional session for the initial route or if the location did not change
|
|
274
|
-
if (from !== undefined && from !== to) {
|
|
275
|
-
startSession({ ignoreDuration: true });
|
|
276
|
-
captureSession();
|
|
277
|
-
}
|
|
278
|
-
});
|
|
279
|
-
}
|
|
280
|
-
|
|
281
256
|
/**
|
|
282
257
|
* Captures user feedback and sends it to Sentry.
|
|
283
258
|
*
|
package/build/npm/esm/sdk.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.js","sources":["../../../src/sdk.ts"],"sourcesContent":["import { addHistoryInstrumentationHandler } from '@sentry-internal/browser-utils';\nimport {\n captureSession,\n consoleSandbox,\n dedupeIntegration,\n functionToStringIntegration,\n getClient,\n getCurrentScope,\n getIntegrationsToSetup,\n getReportDialogEndpoint,\n inboundFiltersIntegration,\n initAndBind,\n lastEventId,\n logger,\n stackParserFromStackParserOptions,\n startSession,\n supportsFetch,\n} from '@sentry/core';\nimport type { Client, DsnLike, Integration, Options, UserFeedback } from '@sentry/core';\nimport type { BrowserClientOptions, BrowserOptions } from './client';\nimport { BrowserClient } from './client';\nimport { DEBUG_BUILD } from './debug-build';\nimport { WINDOW } from './helpers';\nimport { breadcrumbsIntegration } from './integrations/breadcrumbs';\nimport { browserApiErrorsIntegration } from './integrations/browserapierrors';\nimport { globalHandlersIntegration } from './integrations/globalhandlers';\nimport { httpContextIntegration } from './integrations/httpcontext';\nimport { linkedErrorsIntegration } from './integrations/linkederrors';\nimport { defaultStackParser } from './stack-parsers';\nimport { makeFetchTransport } from './transports/fetch';\n\n/** Get the default integrations for the browser SDK. */\nexport function getDefaultIntegrations(_options: Options): Integration[] {\n /**\n * Note: Please make sure this stays in sync with Angular SDK, which re-exports\n * `getDefaultIntegrations` but with an adjusted set of integrations.\n */\n return [\n inboundFiltersIntegration(),\n functionToStringIntegration(),\n browserApiErrorsIntegration(),\n breadcrumbsIntegration(),\n globalHandlersIntegration(),\n linkedErrorsIntegration(),\n dedupeIntegration(),\n httpContextIntegration(),\n ];\n}\n\nfunction applyDefaultOptions(optionsArg: BrowserOptions = {}): BrowserOptions {\n const defaultOptions: BrowserOptions = {\n defaultIntegrations: getDefaultIntegrations(optionsArg),\n release:\n typeof __SENTRY_RELEASE__ === 'string' // This allows build tooling to find-and-replace __SENTRY_RELEASE__ to inject a release value\n ? __SENTRY_RELEASE__\n : WINDOW.SENTRY_RELEASE && WINDOW.SENTRY_RELEASE.id // This supports the variable that sentry-webpack-plugin injects\n ? WINDOW.SENTRY_RELEASE.id\n : undefined,\n autoSessionTracking: true,\n sendClientReports: true,\n };\n\n // TODO: Instead of dropping just `defaultIntegrations`, we should simply\n // call `dropUndefinedKeys` on the entire `optionsArg`.\n // However, for this to work we need to adjust the `hasTracingEnabled()` logic\n // first as it differentiates between `undefined` and the key not being in the object.\n if (optionsArg.defaultIntegrations == null) {\n delete optionsArg.defaultIntegrations;\n }\n\n return { ...defaultOptions, ...optionsArg };\n}\n\ntype ExtensionProperties = {\n chrome?: Runtime;\n browser?: Runtime;\n nw?: unknown;\n};\ntype Runtime = {\n runtime?: {\n id?: string;\n };\n};\n\nfunction shouldShowBrowserExtensionError(): boolean {\n const windowWithMaybeExtension =\n typeof WINDOW.window !== 'undefined' && (WINDOW as typeof WINDOW & ExtensionProperties);\n if (!windowWithMaybeExtension) {\n // No need to show the error if we're not in a browser window environment (e.g. service workers)\n return false;\n }\n\n const extensionKey = windowWithMaybeExtension.chrome ? 'chrome' : 'browser';\n const extensionObject = windowWithMaybeExtension[extensionKey];\n\n const runtimeId = extensionObject && extensionObject.runtime && extensionObject.runtime.id;\n const href = (WINDOW.location && WINDOW.location.href) || '';\n\n const extensionProtocols = ['chrome-extension:', 'moz-extension:', 'ms-browser-extension:', 'safari-web-extension:'];\n\n // Running the SDK in a dedicated extension page and calling Sentry.init is fine; no risk of data leakage\n const isDedicatedExtensionPage =\n !!runtimeId && WINDOW === WINDOW.top && extensionProtocols.some(protocol => href.startsWith(`${protocol}//`));\n\n // Running the SDK in NW.js, which appears like a browser extension but isn't, is also fine\n // see: https://github.com/getsentry/sentry-javascript/issues/12668\n const isNWjs = typeof windowWithMaybeExtension.nw !== 'undefined';\n\n return !!runtimeId && !isDedicatedExtensionPage && !isNWjs;\n}\n\n/**\n * A magic string that build tooling can leverage in order to inject a release value into the SDK.\n */\ndeclare const __SENTRY_RELEASE__: string | undefined;\n\n/**\n * The Sentry Browser SDK Client.\n *\n * To use this SDK, call the {@link init} function as early as possible when\n * loading the web page. To set context information or send manual events, use\n * the provided methods.\n *\n * @example\n *\n * ```\n *\n * import { init } from '@sentry/browser';\n *\n * init({\n * dsn: '__DSN__',\n * // ...\n * });\n * ```\n *\n * @example\n * ```\n *\n * import { addBreadcrumb } from '@sentry/browser';\n * addBreadcrumb({\n * message: 'My Breadcrumb',\n * // ...\n * });\n * ```\n *\n * @example\n *\n * ```\n *\n * import * as Sentry from '@sentry/browser';\n * Sentry.captureMessage('Hello, world!');\n * Sentry.captureException(new Error('Good bye'));\n * Sentry.captureEvent({\n * message: 'Manual',\n * stacktrace: [\n * // ...\n * ],\n * });\n * ```\n *\n * @see {@link BrowserOptions} for documentation on configuration options.\n */\nexport function init(browserOptions: BrowserOptions = {}): Client | undefined {\n const options = applyDefaultOptions(browserOptions);\n\n if (!options.skipBrowserExtensionCheck && shouldShowBrowserExtensionError()) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.error(\n '[Sentry] You cannot run Sentry this way in a browser extension, check: https://docs.sentry.io/platforms/javascript/best-practices/browser-extensions/',\n );\n });\n return;\n }\n\n if (DEBUG_BUILD) {\n if (!supportsFetch()) {\n logger.warn(\n 'No Fetch API detected. The Sentry SDK requires a Fetch API compatible environment to send events. Please add a Fetch API polyfill.',\n );\n }\n }\n const clientOptions: BrowserClientOptions = {\n ...options,\n stackParser: stackParserFromStackParserOptions(options.stackParser || defaultStackParser),\n integrations: getIntegrationsToSetup(options),\n transport: options.transport || makeFetchTransport,\n };\n\n const client = initAndBind(BrowserClient, clientOptions);\n\n if (options.autoSessionTracking) {\n startSessionTracking();\n }\n\n return client;\n}\n\n/**\n * All properties the report dialog supports\n */\nexport interface ReportDialogOptions {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [key: string]: any;\n eventId?: string;\n dsn?: DsnLike;\n user?: {\n email?: string;\n name?: string;\n };\n lang?: string;\n title?: string;\n subtitle?: string;\n subtitle2?: string;\n labelName?: string;\n labelEmail?: string;\n labelComments?: string;\n labelClose?: string;\n labelSubmit?: string;\n errorGeneric?: string;\n errorFormEntry?: string;\n successMessage?: string;\n /** Callback after reportDialog showed up */\n onLoad?(this: void): void;\n /** Callback after reportDialog closed */\n onClose?(this: void): void;\n}\n\n/**\n * Present the user with a report dialog.\n *\n * @param options Everything is optional, we try to fetch all info need from the global scope.\n */\nexport function showReportDialog(options: ReportDialogOptions = {}): void {\n // doesn't work without a document (React Native)\n if (!WINDOW.document) {\n DEBUG_BUILD && logger.error('Global document not defined in showReportDialog call');\n return;\n }\n\n const scope = getCurrentScope();\n const client = scope.getClient();\n const dsn = client && client.getDsn();\n\n if (!dsn) {\n DEBUG_BUILD && logger.error('DSN not configured for showReportDialog call');\n return;\n }\n\n if (scope) {\n options.user = {\n ...scope.getUser(),\n ...options.user,\n };\n }\n\n if (!options.eventId) {\n const eventId = lastEventId();\n if (eventId) {\n options.eventId = eventId;\n }\n }\n\n const script = WINDOW.document.createElement('script');\n script.async = true;\n script.crossOrigin = 'anonymous';\n script.src = getReportDialogEndpoint(dsn, options);\n\n if (options.onLoad) {\n script.onload = options.onLoad;\n }\n\n const { onClose } = options;\n if (onClose) {\n const reportDialogClosedMessageHandler = (event: MessageEvent): void => {\n if (event.data === '__sentry_reportdialog_closed__') {\n try {\n onClose();\n } finally {\n WINDOW.removeEventListener('message', reportDialogClosedMessageHandler);\n }\n }\n };\n WINDOW.addEventListener('message', reportDialogClosedMessageHandler);\n }\n\n const injectionPoint = WINDOW.document.head || WINDOW.document.body;\n if (injectionPoint) {\n injectionPoint.appendChild(script);\n } else {\n DEBUG_BUILD && logger.error('Not injecting report dialog. No injection point found in HTML');\n }\n}\n\n/**\n * This function is here to be API compatible with the loader.\n * @hidden\n */\nexport function forceLoad(): void {\n // Noop\n}\n\n/**\n * This function is here to be API compatible with the loader.\n * @hidden\n */\nexport function onLoad(callback: () => void): void {\n callback();\n}\n\n/**\n * Enable automatic Session Tracking for the initial page load.\n */\nfunction startSessionTracking(): void {\n if (typeof WINDOW.document === 'undefined') {\n DEBUG_BUILD && logger.warn('Session tracking in non-browser environment with @sentry/browser is not supported.');\n return;\n }\n\n // The session duration for browser sessions does not track a meaningful\n // concept that can be used as a metric.\n // Automatically captured sessions are akin to page views, and thus we\n // discard their duration.\n startSession({ ignoreDuration: true });\n captureSession();\n\n // We want to create a session for every navigation as well\n addHistoryInstrumentationHandler(({ from, to }) => {\n // Don't create an additional session for the initial route or if the location did not change\n if (from !== undefined && from !== to) {\n startSession({ ignoreDuration: true });\n captureSession();\n }\n });\n}\n\n/**\n * Captures user feedback and sends it to Sentry.\n *\n * @deprecated Use `captureFeedback` instead.\n */\nexport function captureUserFeedback(feedback: UserFeedback): void {\n const client = getClient<BrowserClient>();\n if (client) {\n // eslint-disable-next-line deprecation/deprecation\n client.captureUserFeedback(feedback);\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;AA+BA;AACO,SAAS,sBAAsB,CAAC,QAAQ,EAA0B;AACzE;AACA;AACA;AACA;AACA,EAAE,OAAO;AACT,IAAI,yBAAyB,EAAE;AAC/B,IAAI,2BAA2B,EAAE;AACjC,IAAI,2BAA2B,EAAE;AACjC,IAAI,sBAAsB,EAAE;AAC5B,IAAI,yBAAyB,EAAE;AAC/B,IAAI,uBAAuB,EAAE;AAC7B,IAAI,iBAAiB,EAAE;AACvB,IAAI,sBAAsB,EAAE;AAC5B,GAAG;AACH;;AAEA,SAAS,mBAAmB,CAAC,UAAU,GAAmB,EAAE,EAAkB;AAC9E,EAAE,MAAM,cAAc,GAAmB;AACzC,IAAI,mBAAmB,EAAE,sBAAsB,CAAW,CAAC;AAC3D,IAAI,OAAO;AACX,MAAM,OAAO,uBAAuB,QAAA;AACpC,UAAU;AACV,UAAU,MAAM,CAAC,cAAA,IAAkB,MAAM,CAAC,cAAc,CAAC,EAAA;AACzD,YAAY,MAAM,CAAC,cAAc,CAAC;AA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EAAA;AACA,EAAA,IAAA,MAAA,EAAA;AACA;AACA,IAAA,MAAA,CAAA,mBAAA,CAAA,QAAA,CAAA;AACA;AACA;;;;"}
|
|
1
|
+
{"version":3,"file":"sdk.js","sources":["../../../src/sdk.ts"],"sourcesContent":["import {\n consoleSandbox,\n dedupeIntegration,\n functionToStringIntegration,\n getClient,\n getCurrentScope,\n getIntegrationsToSetup,\n getReportDialogEndpoint,\n inboundFiltersIntegration,\n initAndBind,\n lastEventId,\n logger,\n stackParserFromStackParserOptions,\n supportsFetch,\n} from '@sentry/core';\nimport type { Client, DsnLike, Integration, Options, UserFeedback } from '@sentry/core';\nimport type { BrowserClientOptions, BrowserOptions } from './client';\nimport { BrowserClient } from './client';\nimport { DEBUG_BUILD } from './debug-build';\nimport { WINDOW } from './helpers';\nimport { breadcrumbsIntegration } from './integrations/breadcrumbs';\nimport { browserApiErrorsIntegration } from './integrations/browserapierrors';\nimport { browserSessionIntegration } from './integrations/browsersession';\nimport { globalHandlersIntegration } from './integrations/globalhandlers';\nimport { httpContextIntegration } from './integrations/httpcontext';\nimport { linkedErrorsIntegration } from './integrations/linkederrors';\nimport { defaultStackParser } from './stack-parsers';\nimport { makeFetchTransport } from './transports/fetch';\n\n/** Get the default integrations for the browser SDK. */\nexport function getDefaultIntegrations(options: Options): Integration[] {\n /**\n * Note: Please make sure this stays in sync with Angular SDK, which re-exports\n * `getDefaultIntegrations` but with an adjusted set of integrations.\n */\n const integrations = [\n inboundFiltersIntegration(),\n functionToStringIntegration(),\n browserApiErrorsIntegration(),\n breadcrumbsIntegration(),\n globalHandlersIntegration(),\n linkedErrorsIntegration(),\n dedupeIntegration(),\n httpContextIntegration(),\n ];\n\n // eslint-disable-next-line deprecation/deprecation\n if (options.autoSessionTracking !== false) {\n integrations.push(browserSessionIntegration());\n }\n\n return integrations;\n}\n\nfunction applyDefaultOptions(optionsArg: BrowserOptions = {}): BrowserOptions {\n const defaultOptions: BrowserOptions = {\n defaultIntegrations: getDefaultIntegrations(optionsArg),\n release:\n typeof __SENTRY_RELEASE__ === 'string' // This allows build tooling to find-and-replace __SENTRY_RELEASE__ to inject a release value\n ? __SENTRY_RELEASE__\n : WINDOW.SENTRY_RELEASE && WINDOW.SENTRY_RELEASE.id // This supports the variable that sentry-webpack-plugin injects\n ? WINDOW.SENTRY_RELEASE.id\n : undefined,\n autoSessionTracking: true,\n sendClientReports: true,\n };\n\n // TODO: Instead of dropping just `defaultIntegrations`, we should simply\n // call `dropUndefinedKeys` on the entire `optionsArg`.\n // However, for this to work we need to adjust the `hasTracingEnabled()` logic\n // first as it differentiates between `undefined` and the key not being in the object.\n if (optionsArg.defaultIntegrations == null) {\n delete optionsArg.defaultIntegrations;\n }\n\n return { ...defaultOptions, ...optionsArg };\n}\n\ntype ExtensionProperties = {\n chrome?: Runtime;\n browser?: Runtime;\n nw?: unknown;\n};\ntype Runtime = {\n runtime?: {\n id?: string;\n };\n};\n\nfunction shouldShowBrowserExtensionError(): boolean {\n const windowWithMaybeExtension =\n typeof WINDOW.window !== 'undefined' && (WINDOW as typeof WINDOW & ExtensionProperties);\n if (!windowWithMaybeExtension) {\n // No need to show the error if we're not in a browser window environment (e.g. service workers)\n return false;\n }\n\n const extensionKey = windowWithMaybeExtension.chrome ? 'chrome' : 'browser';\n const extensionObject = windowWithMaybeExtension[extensionKey];\n\n const runtimeId = extensionObject && extensionObject.runtime && extensionObject.runtime.id;\n const href = (WINDOW.location && WINDOW.location.href) || '';\n\n const extensionProtocols = ['chrome-extension:', 'moz-extension:', 'ms-browser-extension:', 'safari-web-extension:'];\n\n // Running the SDK in a dedicated extension page and calling Sentry.init is fine; no risk of data leakage\n const isDedicatedExtensionPage =\n !!runtimeId && WINDOW === WINDOW.top && extensionProtocols.some(protocol => href.startsWith(`${protocol}//`));\n\n // Running the SDK in NW.js, which appears like a browser extension but isn't, is also fine\n // see: https://github.com/getsentry/sentry-javascript/issues/12668\n const isNWjs = typeof windowWithMaybeExtension.nw !== 'undefined';\n\n return !!runtimeId && !isDedicatedExtensionPage && !isNWjs;\n}\n\n/**\n * A magic string that build tooling can leverage in order to inject a release value into the SDK.\n */\ndeclare const __SENTRY_RELEASE__: string | undefined;\n\n/**\n * The Sentry Browser SDK Client.\n *\n * To use this SDK, call the {@link init} function as early as possible when\n * loading the web page. To set context information or send manual events, use\n * the provided methods.\n *\n * @example\n *\n * ```\n *\n * import { init } from '@sentry/browser';\n *\n * init({\n * dsn: '__DSN__',\n * // ...\n * });\n * ```\n *\n * @example\n * ```\n *\n * import { addBreadcrumb } from '@sentry/browser';\n * addBreadcrumb({\n * message: 'My Breadcrumb',\n * // ...\n * });\n * ```\n *\n * @example\n *\n * ```\n *\n * import * as Sentry from '@sentry/browser';\n * Sentry.captureMessage('Hello, world!');\n * Sentry.captureException(new Error('Good bye'));\n * Sentry.captureEvent({\n * message: 'Manual',\n * stacktrace: [\n * // ...\n * ],\n * });\n * ```\n *\n * @see {@link BrowserOptions} for documentation on configuration options.\n */\nexport function init(browserOptions: BrowserOptions = {}): Client | undefined {\n const options = applyDefaultOptions(browserOptions);\n\n if (!options.skipBrowserExtensionCheck && shouldShowBrowserExtensionError()) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.error(\n '[Sentry] You cannot run Sentry this way in a browser extension, check: https://docs.sentry.io/platforms/javascript/best-practices/browser-extensions/',\n );\n });\n return;\n }\n\n if (DEBUG_BUILD) {\n if (!supportsFetch()) {\n logger.warn(\n 'No Fetch API detected. The Sentry SDK requires a Fetch API compatible environment to send events. Please add a Fetch API polyfill.',\n );\n }\n }\n const clientOptions: BrowserClientOptions = {\n ...options,\n stackParser: stackParserFromStackParserOptions(options.stackParser || defaultStackParser),\n integrations: getIntegrationsToSetup(options),\n transport: options.transport || makeFetchTransport,\n };\n\n return initAndBind(BrowserClient, clientOptions);\n}\n\n/**\n * All properties the report dialog supports\n */\nexport interface ReportDialogOptions {\n // TODO(v9): Change this to [key: string]: unknkown;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [key: string]: any;\n eventId?: string;\n dsn?: DsnLike;\n user?: {\n email?: string;\n name?: string;\n };\n lang?: string;\n title?: string;\n subtitle?: string;\n subtitle2?: string;\n labelName?: string;\n labelEmail?: string;\n labelComments?: string;\n labelClose?: string;\n labelSubmit?: string;\n errorGeneric?: string;\n errorFormEntry?: string;\n successMessage?: string;\n /** Callback after reportDialog showed up */\n onLoad?(this: void): void;\n /** Callback after reportDialog closed */\n onClose?(this: void): void;\n}\n\n/**\n * Present the user with a report dialog.\n *\n * @param options Everything is optional, we try to fetch all info need from the global scope.\n */\nexport function showReportDialog(options: ReportDialogOptions = {}): void {\n // doesn't work without a document (React Native)\n if (!WINDOW.document) {\n DEBUG_BUILD && logger.error('Global document not defined in showReportDialog call');\n return;\n }\n\n const scope = getCurrentScope();\n const client = scope.getClient();\n const dsn = client && client.getDsn();\n\n if (!dsn) {\n DEBUG_BUILD && logger.error('DSN not configured for showReportDialog call');\n return;\n }\n\n if (scope) {\n options.user = {\n ...scope.getUser(),\n ...options.user,\n };\n }\n\n if (!options.eventId) {\n const eventId = lastEventId();\n if (eventId) {\n options.eventId = eventId;\n }\n }\n\n const script = WINDOW.document.createElement('script');\n script.async = true;\n script.crossOrigin = 'anonymous';\n script.src = getReportDialogEndpoint(dsn, options);\n\n if (options.onLoad) {\n script.onload = options.onLoad;\n }\n\n const { onClose } = options;\n if (onClose) {\n const reportDialogClosedMessageHandler = (event: MessageEvent): void => {\n if (event.data === '__sentry_reportdialog_closed__') {\n try {\n onClose();\n } finally {\n WINDOW.removeEventListener('message', reportDialogClosedMessageHandler);\n }\n }\n };\n WINDOW.addEventListener('message', reportDialogClosedMessageHandler);\n }\n\n const injectionPoint = WINDOW.document.head || WINDOW.document.body;\n if (injectionPoint) {\n injectionPoint.appendChild(script);\n } else {\n DEBUG_BUILD && logger.error('Not injecting report dialog. No injection point found in HTML');\n }\n}\n\n/**\n * This function is here to be API compatible with the loader.\n * @hidden\n */\nexport function forceLoad(): void {\n // Noop\n}\n\n/**\n * This function is here to be API compatible with the loader.\n * @hidden\n */\nexport function onLoad(callback: () => void): void {\n callback();\n}\n\n/**\n * Captures user feedback and sends it to Sentry.\n *\n * @deprecated Use `captureFeedback` instead.\n */\nexport function captureUserFeedback(feedback: UserFeedback): void {\n const client = getClient<BrowserClient>();\n if (client) {\n // eslint-disable-next-line deprecation/deprecation\n client.captureUserFeedback(feedback);\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;AA6BA;AACO,SAAS,sBAAsB,CAAC,OAAO,EAA0B;AACxE;AACA;AACA;AACA;AACA,EAAE,MAAM,eAAe;AACvB,IAAI,yBAAyB,EAAE;AAC/B,IAAI,2BAA2B,EAAE;AACjC,IAAI,2BAA2B,EAAE;AACjC,IAAI,sBAAsB,EAAE;AAC5B,IAAI,yBAAyB,EAAE;AAC/B,IAAI,uBAAuB,EAAE;AAC7B,IAAI,iBAAiB,EAAE;AACvB,IAAI,sBAAsB,EAAE;AAC5B,GAAG;;AAEH;AACA,EAAE,IAAI,OAAO,CAAC,mBAAoB,KAAI,KAAK,EAAE;AAC7C,IAAI,YAAY,CAAC,IAAI,CAAC,yBAAyB,EAAE,CAAC;AAClD;;AAEA,EAAE,OAAO,YAAY;AACrB;;AAEA,SAAS,mBAAmB,CAAC,UAAU,GAAmB,EAAE,EAAkB;AAC9E,EAAE,MAAM,cAAc,GAAmB;AACzC,IAAI,mBAAmB,EAAE,sBAAsB,CAAC,UAAU,CAAC;AAC3D,IAAI,OAAO;AACX,MAAM,OAAO,uBAAuB,QAAA;AACpC,UAAU;AACV,UAAU,MAAM,CAAC,cAAA,IAAkB,MAAM,CAAC,cAAc,CAAC,EAAA;AACzD,YAAY,MAAM,CAAC,cAAc,CAAC;AAClC,YAAY,SAAS;AACrB,IAAI,mBAAmB,EAAE,IAAI;AAC7B,IAAI,iBAAiB,EAAE,IAAI;AAC3B,GAAG;;AAEH;AACA;AACA;AACA;AACA,EAAE,IAAI,UAAU,CAAC,mBAAoB,IAAG,IAA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AAA,CAAA,QAAA,CAAA,IAAA;AACA,EAAA,IAAA,cAAA,EAAA;AACA,IAAA,cAAA,CAAA,WAAA,CAAA,MAAA,CAAA;AACA,GAAA,MAAA;AACA,IAAA,WAAA,IAAA,MAAA,CAAA,KAAA,CAAA,+DAAA,CAAA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAA,SAAA,GAAA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAA,MAAA,CAAA,QAAA,EAAA;AACA,EAAA,QAAA,EAAA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAA,mBAAA,CAAA,QAAA,EAAA;AACA,EAAA,MAAA,MAAA,GAAA,SAAA,EAAA;AACA,EAAA,IAAA,MAAA,EAAA;AACA;AACA,IAAA,MAAA,CAAA,mBAAA,CAAA,QAAA,CAAA;AACA;AACA;;;;"}
|
|
@@ -0,0 +1,91 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"featureFlags.js","sources":["../../../../src/utils/featureFlags.ts"],"sourcesContent":["import type { Event, FeatureFlag } from '@sentry/core';\n\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":";;;AAKA;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,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,KAAA,IAAA,CAAA;;AAEA,EAAA,IAAA,KAAA,KAAA,CAAA,CAAA,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;;;;"}
|
|
@@ -3,15 +3,15 @@ export { reportingObserverIntegration } from './integrations/reportingobserver';
|
|
|
3
3
|
export { httpClientIntegration } from './integrations/httpclient';
|
|
4
4
|
export { contextLinesIntegration } from './integrations/contextlines';
|
|
5
5
|
export { captureConsoleIntegration, debugIntegration, extraErrorDataIntegration, rewriteFramesIntegration, sessionTimingIntegration, captureFeedback, } from '@sentry/core';
|
|
6
|
-
export { replayIntegration, getReplay
|
|
6
|
+
export { replayIntegration, getReplay } from '@sentry-internal/replay';
|
|
7
7
|
export type { ReplayEventType, ReplayEventWithTime, ReplayBreadcrumbFrame, ReplayBreadcrumbFrameEvent, ReplayOptionFrameEvent, ReplayFrame, ReplayFrameEvent, ReplaySpanFrame, ReplaySpanFrameEvent, } from '@sentry-internal/replay';
|
|
8
8
|
export { replayCanvasIntegration } from '@sentry-internal/replay-canvas';
|
|
9
9
|
import { feedbackAsyncIntegration } from './feedbackAsync';
|
|
10
10
|
import { feedbackSyncIntegration } from './feedbackSync';
|
|
11
11
|
export { feedbackAsyncIntegration, feedbackSyncIntegration, feedbackSyncIntegration as feedbackIntegration };
|
|
12
|
-
export { getFeedback, sendFeedback
|
|
12
|
+
export { getFeedback, sendFeedback } from '@sentry-internal/feedback';
|
|
13
13
|
export * from './metrics';
|
|
14
|
-
export { defaultRequestInstrumentationOptions, instrumentOutgoingRequests
|
|
14
|
+
export { defaultRequestInstrumentationOptions, instrumentOutgoingRequests } from './tracing/request';
|
|
15
15
|
export { browserTracingIntegration, startBrowserTracingNavigationSpan, startBrowserTracingPageLoadSpan, } from './tracing/browserTracingIntegration';
|
|
16
16
|
export type { RequestInstrumentationOptions } from './tracing/request';
|
|
17
17
|
export { addTracingExtensions, registerSpanErrorInstrumentation, getActiveSpan, getRootSpan, startSpan, startInactiveSpan, startSpanManual, withActiveSpan, startNewTrace, getSpanDescendants, setMeasurement, getSpanStatusFromHttpCode, setHttpStatus, makeMultiplexedTransport, moduleMetadataIntegration, zodErrorsIntegration, thirdPartyErrorFilterIntegration, } from '@sentry/core';
|
|
@@ -19,4 +19,8 @@ export type { Span } from '@sentry/core';
|
|
|
19
19
|
export { makeBrowserOfflineTransport } from './transports/offline';
|
|
20
20
|
export { browserProfilingIntegration } from './profiling/integration';
|
|
21
21
|
export { spotlightBrowserIntegration } from './integrations/spotlight';
|
|
22
|
+
export { browserSessionIntegration } from './integrations/browsersession';
|
|
23
|
+
export { featureFlagsIntegration, type FeatureFlagsIntegration, } from './integrations/featureFlags';
|
|
24
|
+
export { launchDarklyIntegration, buildLaunchDarklyFlagUsedHandler } from './integrations/featureFlags/launchdarkly';
|
|
25
|
+
export { openFeatureIntegration, OpenFeatureIntegrationHook } from './integrations/featureFlags/openfeature';
|
|
22
26
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAE1B,OAAO,EAAE,4BAA4B,EAAE,MAAM,kCAAkC,CAAC;AAChF,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAEtE,OAAO,EACL,yBAAyB,EAEzB,gBAAgB,EAChB,yBAAyB,EACzB,wBAAwB,EAExB,wBAAwB,EACxB,eAAe,GAChB,MAAM,cAA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SAAS,EACT,iBAAiB,EACjB,eAAe,EACf,cAAc,EACd,aAAa,EACb,kBAAkB,EAClB,cAAc,EACd,yBAAyB,EACzB,aAAa,EACb,wBAAwB,EACxB,yBAAyB,EACzB,oBAAoB,EACpB,gCAAgC,GACjC,MAAM,cAAc,CAAC;AACtB,YAAY,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AACvE,OAAO,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAC1E,OAAO,EACL,uBAAuB,EACvB,KAAK,uBAAuB,GAC7B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,uBAAuB,EAAE,gCAAgC,EAAE,MAAM,0CAA0C,CAAC;AACrH,OAAO,EAAE,sBAAsB,EAAE,0BAA0B,EAAE,MAAM,yCAAyC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* When added, automatically creates sessions which allow you to track adoption and crashes (crash free rate) in your Releases in Sentry.
|
|
3
|
+
* More information: https://docs.sentry.io/product/releases/health/
|
|
4
|
+
*
|
|
5
|
+
* Note: In order for session tracking to work, you need to set up Releases: https://docs.sentry.io/product/releases/
|
|
6
|
+
*/
|
|
7
|
+
export declare const browserSessionIntegration: () => import("@sentry/core").Integration;
|
|
8
|
+
//# sourceMappingURL=browsersession.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browsersession.d.ts","sourceRoot":"","sources":["../../../../src/integrations/browsersession.ts"],"names":[],"mappings":"AAKA;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,0CA2BpC,CAAC"}
|