sentry-vir 0.2.4 → 1.0.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/dist/cjs/auto.d.ts +1 -1
- package/dist/cjs/auto.js +4 -3
- package/dist/cjs/browser.d.ts +3 -88
- package/dist/cjs/browser.js +2 -1
- package/dist/cjs/env/execution-env.d.ts +1 -1
- package/dist/cjs/index.d.ts +0 -1
- package/dist/cjs/index.js +0 -1
- package/dist/cjs/init-sentry/base-sentry-init.d.ts +6 -5
- package/dist/cjs/init-sentry/base-sentry-init.js +2 -2
- package/dist/cjs/init-sentry/sentry-config.d.ts +1 -2
- package/dist/cjs/init-sentry/sentry-config.js +4 -4
- package/dist/cjs/node.d.ts +3 -78
- package/dist/cjs/node.js +2 -1
- package/dist/cjs/processing/handle-sentry-send.d.ts +2 -6
- package/dist/cjs/processing/handle-sentry-send.js +3 -7
- package/dist/esm/auto.d.ts +1 -1
- package/dist/esm/auto.js +4 -3
- package/dist/esm/browser.d.ts +3 -88
- package/dist/esm/browser.js +2 -1
- package/dist/esm/env/execution-env.d.ts +1 -1
- package/dist/esm/index.d.ts +0 -1
- package/dist/esm/index.js +0 -1
- package/dist/esm/init-sentry/base-sentry-init.d.ts +6 -5
- package/dist/esm/init-sentry/base-sentry-init.js +2 -2
- package/dist/esm/init-sentry/sentry-config.d.ts +1 -2
- package/dist/esm/init-sentry/sentry-config.js +4 -4
- package/dist/esm/node.d.ts +3 -78
- package/dist/esm/node.js +2 -1
- package/dist/esm/processing/handle-sentry-send.d.ts +2 -6
- package/dist/esm/processing/handle-sentry-send.js +3 -7
- package/package.json +1 -1
- package/dist/cjs/env/release-env.d.ts +0 -8
- package/dist/cjs/env/release-env.js +0 -12
- package/dist/esm/env/release-env.d.ts +0 -8
- package/dist/esm/env/release-env.js +0 -9
package/dist/cjs/auto.d.ts
CHANGED
|
@@ -12,4 +12,4 @@ export declare const sentryDepByEnv: Record<SentryExecutionEnvEnum, SentryDepImp
|
|
|
12
12
|
*
|
|
13
13
|
* To override any default sentry-vir settings, include them in the userConfig input.
|
|
14
14
|
*/
|
|
15
|
-
export declare function autoInitSentry({ executionEnv, dsn, releaseEnv, releaseName, sentryConfigOverrides, createUniversalContext, }: InitSentryInput): Promise<
|
|
15
|
+
export declare function autoInitSentry({ executionEnv, dsn, releaseEnv, releaseName, sentryConfigOverrides, createUniversalContext, isDev, }: InitSentryInput): Promise<SentryDep>;
|
package/dist/cjs/auto.js
CHANGED
|
@@ -34,8 +34,8 @@ exports.sentryDepByEnv = {
|
|
|
34
34
|
[execution_env_1.SentryExecutionEnvEnum.Node]: () => Promise.resolve().then(() => __importStar(require('@sentry/node'))),
|
|
35
35
|
};
|
|
36
36
|
/** Determine which Sentry client dependency to use and then import it. */
|
|
37
|
-
async function getSentryByEnv(
|
|
38
|
-
return (await exports.sentryDepByEnv[
|
|
37
|
+
async function getSentryByEnv(executionEnv) {
|
|
38
|
+
return (await exports.sentryDepByEnv[executionEnv]());
|
|
39
39
|
}
|
|
40
40
|
/**
|
|
41
41
|
* Automatically determines which Sentry module to import based on the given execution env. Warning:
|
|
@@ -45,7 +45,7 @@ async function getSentryByEnv(env) {
|
|
|
45
45
|
*
|
|
46
46
|
* To override any default sentry-vir settings, include them in the userConfig input.
|
|
47
47
|
*/
|
|
48
|
-
async function autoInitSentry({ executionEnv, dsn, releaseEnv, releaseName, sentryConfigOverrides, createUniversalContext, }) {
|
|
48
|
+
async function autoInitSentry({ executionEnv, dsn, releaseEnv, releaseName, sentryConfigOverrides, createUniversalContext, isDev, }) {
|
|
49
49
|
const sentryDep = await getSentryByEnv(executionEnv);
|
|
50
50
|
await (0, base_sentry_init_1.baseInitSentry)({
|
|
51
51
|
dsn,
|
|
@@ -55,6 +55,7 @@ async function autoInitSentry({ executionEnv, dsn, releaseEnv, releaseName, sent
|
|
|
55
55
|
createUniversalContext,
|
|
56
56
|
sentryDep,
|
|
57
57
|
executionEnv,
|
|
58
|
+
isDev,
|
|
58
59
|
});
|
|
59
60
|
return sentryDep;
|
|
60
61
|
}
|
package/dist/cjs/browser.d.ts
CHANGED
|
@@ -1,95 +1,10 @@
|
|
|
1
|
+
import type { SentryBrowserDep } from './env/execution-env';
|
|
1
2
|
import { InitSentryInput } from './init-sentry/base-sentry-init';
|
|
3
|
+
export type Sentry = SentryBrowserDep;
|
|
2
4
|
/**
|
|
3
5
|
* Base Sentry init. Requires the Sentry module to already have been imported. Setup a sentry client
|
|
4
6
|
* with all the default sentry-vir integrations and configs.
|
|
5
7
|
*
|
|
6
8
|
* To override any default sentry-vir settings, include them in the userConfig input.
|
|
7
9
|
*/
|
|
8
|
-
export declare function initSentry({ dsn, releaseEnv, releaseName, sentryConfigOverrides, createUniversalContext, }: Omit<InitSentryInput, 'executionEnv'>): Promise<
|
|
9
|
-
default: typeof import("@sentry/browser");
|
|
10
|
-
Integrations: {
|
|
11
|
-
GlobalHandlers: typeof import("@sentry/browser").GlobalHandlers;
|
|
12
|
-
TryCatch: typeof import("@sentry/browser").TryCatch;
|
|
13
|
-
Breadcrumbs: typeof import("@sentry/browser").Breadcrumbs;
|
|
14
|
-
LinkedErrors: typeof import("@sentry/browser").LinkedErrors;
|
|
15
|
-
HttpContext: typeof import("@sentry/browser").HttpContext;
|
|
16
|
-
Dedupe: typeof import("@sentry/browser").Dedupe;
|
|
17
|
-
FunctionToString: typeof import("@sentry/browser").FunctionToString;
|
|
18
|
-
InboundFilters: typeof import("@sentry/browser").InboundFilters;
|
|
19
|
-
};
|
|
20
|
-
Replay: typeof import("@sentry/browser").Replay;
|
|
21
|
-
BrowserTracing: typeof import("@sentry/browser").BrowserTracing;
|
|
22
|
-
defaultRequestInstrumentationOptions: import("@sentry/browser").RequestInstrumentationOptions;
|
|
23
|
-
instrumentOutgoingRequests: typeof import("@sentry/browser").instrumentOutgoingRequests;
|
|
24
|
-
addTracingExtensions: typeof import("@sentry/browser").addTracingExtensions;
|
|
25
|
-
setMeasurement: typeof import("@sentry/browser").setMeasurement;
|
|
26
|
-
extractTraceparentData: typeof import("@sentry/browser").extractTraceparentData;
|
|
27
|
-
getActiveTransaction: typeof import("@sentry/browser").getActiveTransaction;
|
|
28
|
-
spanStatusfromHttpCode: typeof import("@sentry/browser").spanStatusfromHttpCode;
|
|
29
|
-
trace: typeof import("@sentry/browser").trace;
|
|
30
|
-
makeMultiplexedTransport: typeof import("@sentry/browser").makeMultiplexedTransport;
|
|
31
|
-
ModuleMetadata: typeof import("@sentry/browser").ModuleMetadata;
|
|
32
|
-
makeBrowserOfflineTransport: typeof import("@sentry/browser").makeBrowserOfflineTransport;
|
|
33
|
-
onProfilingStartRouteTransaction: typeof import("@sentry/browser").onProfilingStartRouteTransaction;
|
|
34
|
-
BrowserProfilingIntegration: typeof import("@sentry/browser").BrowserProfilingIntegration;
|
|
35
|
-
addGlobalEventProcessor: typeof import("@sentry/browser").addGlobalEventProcessor;
|
|
36
|
-
addBreadcrumb: typeof import("@sentry/browser").addBreadcrumb;
|
|
37
|
-
addIntegration: typeof import("@sentry/browser").addIntegration;
|
|
38
|
-
captureException: typeof import("@sentry/browser").captureException;
|
|
39
|
-
captureEvent: typeof import("@sentry/browser").captureEvent;
|
|
40
|
-
captureMessage: typeof import("@sentry/browser").captureMessage;
|
|
41
|
-
close: typeof import("@sentry/browser").close;
|
|
42
|
-
configureScope: typeof import("@sentry/browser").configureScope;
|
|
43
|
-
createTransport: typeof import("@sentry/browser").createTransport;
|
|
44
|
-
flush: typeof import("@sentry/browser").flush;
|
|
45
|
-
getHubFromCarrier: typeof import("@sentry/browser").getHubFromCarrier;
|
|
46
|
-
getCurrentHub: typeof import("@sentry/browser").getCurrentHub;
|
|
47
|
-
Hub: typeof import("@sentry/browser").Hub;
|
|
48
|
-
lastEventId: typeof import("@sentry/browser").lastEventId;
|
|
49
|
-
makeMain: typeof import("@sentry/browser").makeMain;
|
|
50
|
-
Scope: typeof import("@sentry/browser").Scope;
|
|
51
|
-
startTransaction: typeof import("@sentry/browser").startTransaction;
|
|
52
|
-
getActiveSpan: typeof import("@sentry/browser").getActiveSpan;
|
|
53
|
-
startSpan: typeof import("@sentry/browser").startSpan;
|
|
54
|
-
startInactiveSpan: typeof import("@sentry/browser").startInactiveSpan;
|
|
55
|
-
startSpanManual: typeof import("@sentry/browser").startSpanManual;
|
|
56
|
-
continueTrace: typeof import("@sentry/browser").continueTrace;
|
|
57
|
-
SDK_VERSION: "7.80.1";
|
|
58
|
-
setContext: typeof import("@sentry/browser").setContext;
|
|
59
|
-
setExtra: typeof import("@sentry/browser").setExtra;
|
|
60
|
-
setExtras: typeof import("@sentry/browser").setExtras;
|
|
61
|
-
setTag: typeof import("@sentry/browser").setTag;
|
|
62
|
-
setTags: typeof import("@sentry/browser").setTags;
|
|
63
|
-
setUser: typeof import("@sentry/browser").setUser;
|
|
64
|
-
withScope: typeof import("@sentry/browser").withScope;
|
|
65
|
-
FunctionToString: typeof import("@sentry/browser").FunctionToString;
|
|
66
|
-
InboundFilters: typeof import("@sentry/browser").InboundFilters;
|
|
67
|
-
WINDOW: import("@sentry/utils").InternalGlobal & Window;
|
|
68
|
-
BrowserClient: typeof import("@sentry/browser").BrowserClient;
|
|
69
|
-
makeFetchTransport: typeof import("@sentry/browser").makeFetchTransport;
|
|
70
|
-
makeXHRTransport: typeof import("@sentry/browser").makeXHRTransport;
|
|
71
|
-
defaultStackParser: import("@sentry/types").StackParser;
|
|
72
|
-
defaultStackLineParsers: import("@sentry/types").StackLineParser[];
|
|
73
|
-
chromeStackLineParser: import("@sentry/types").StackLineParser;
|
|
74
|
-
geckoStackLineParser: import("@sentry/types").StackLineParser;
|
|
75
|
-
opera10StackLineParser: import("@sentry/types").StackLineParser;
|
|
76
|
-
opera11StackLineParser: import("@sentry/types").StackLineParser;
|
|
77
|
-
winjsStackLineParser: import("@sentry/types").StackLineParser;
|
|
78
|
-
eventFromException: typeof import("@sentry/browser").eventFromException;
|
|
79
|
-
eventFromMessage: typeof import("@sentry/browser").eventFromMessage;
|
|
80
|
-
exceptionFromError: typeof import("@sentry/browser").exceptionFromError;
|
|
81
|
-
createUserFeedbackEnvelope: typeof import("@sentry/browser").createUserFeedbackEnvelope;
|
|
82
|
-
defaultIntegrations: (import("@sentry/browser").HttpContext | import("@sentry/browser").Dedupe | import("@sentry/browser").InboundFilters | import("@sentry/browser").FunctionToString | import("@sentry/browser").GlobalHandlers | import("@sentry/browser").TryCatch | import("@sentry/browser").Breadcrumbs | import("@sentry/browser").LinkedErrors)[];
|
|
83
|
-
forceLoad: typeof import("@sentry/browser").forceLoad;
|
|
84
|
-
init: typeof import("@sentry/browser").init;
|
|
85
|
-
onLoad: typeof import("@sentry/browser").onLoad;
|
|
86
|
-
showReportDialog: typeof import("@sentry/browser").showReportDialog;
|
|
87
|
-
captureUserFeedback: typeof import("@sentry/browser").captureUserFeedback;
|
|
88
|
-
wrap: typeof import("@sentry/browser").wrap;
|
|
89
|
-
GlobalHandlers: typeof import("@sentry/browser").GlobalHandlers;
|
|
90
|
-
TryCatch: typeof import("@sentry/browser").TryCatch;
|
|
91
|
-
Breadcrumbs: typeof import("@sentry/browser").Breadcrumbs;
|
|
92
|
-
LinkedErrors: typeof import("@sentry/browser").LinkedErrors;
|
|
93
|
-
HttpContext: typeof import("@sentry/browser").HttpContext;
|
|
94
|
-
Dedupe: typeof import("@sentry/browser").Dedupe;
|
|
95
|
-
}>;
|
|
10
|
+
export declare function initSentry({ dsn, releaseEnv, releaseName, sentryConfigOverrides, createUniversalContext, isDev, }: Omit<InitSentryInput, 'executionEnv'>): Promise<Sentry>;
|
package/dist/cjs/browser.js
CHANGED
|
@@ -32,7 +32,7 @@ const base_sentry_init_1 = require("./init-sentry/base-sentry-init");
|
|
|
32
32
|
*
|
|
33
33
|
* To override any default sentry-vir settings, include them in the userConfig input.
|
|
34
34
|
*/
|
|
35
|
-
async function initSentry({ dsn, releaseEnv, releaseName, sentryConfigOverrides, createUniversalContext, }) {
|
|
35
|
+
async function initSentry({ dsn, releaseEnv, releaseName, sentryConfigOverrides, createUniversalContext, isDev, }) {
|
|
36
36
|
const sentryDep = await Promise.resolve().then(() => __importStar(require('@sentry/browser')));
|
|
37
37
|
await (0, base_sentry_init_1.baseInitSentry)({
|
|
38
38
|
dsn,
|
|
@@ -42,6 +42,7 @@ async function initSentry({ dsn, releaseEnv, releaseName, sentryConfigOverrides,
|
|
|
42
42
|
createUniversalContext,
|
|
43
43
|
sentryDep,
|
|
44
44
|
executionEnv: execution_env_1.SentryExecutionEnvEnum.Browser,
|
|
45
|
+
isDev,
|
|
45
46
|
});
|
|
46
47
|
return sentryDep;
|
|
47
48
|
}
|
|
@@ -10,4 +10,4 @@ export type SentryNodeDep = typeof import('@sentry/node');
|
|
|
10
10
|
/** Any of the Sentry client dependencies. */
|
|
11
11
|
export type SentryDep = SentryBrowserDep | SentryNodeDep;
|
|
12
12
|
/** Pick a Sentry client dependency based on the given environment. */
|
|
13
|
-
export type SentryDepByEnv<
|
|
13
|
+
export type SentryDepByEnv<ExecutionEnv extends SentryExecutionEnvEnum> = ExecutionEnv extends SentryExecutionEnvEnum.Browser ? SentryBrowserDep : SentryNodeDep;
|
package/dist/cjs/index.d.ts
CHANGED
package/dist/cjs/index.js
CHANGED
|
@@ -15,7 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./env/execution-env"), exports);
|
|
18
|
-
__exportStar(require("./env/release-env"), exports);
|
|
19
18
|
__exportStar(require("./event-context/event-context"), exports);
|
|
20
19
|
__exportStar(require("./event-context/event-severity"), exports);
|
|
21
20
|
__exportStar(require("./event-context/extra-context.error"), exports);
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import type { Options } from '@sentry/types';
|
|
2
2
|
import { SentryDep, SentryExecutionEnvEnum } from '../env/execution-env';
|
|
3
|
-
import { SentryReleaseEnvEnum } from '../env/release-env';
|
|
4
3
|
import { EventExtraContextCreator } from '../event-context/event-context';
|
|
5
4
|
import { UserOverrides } from './sentry-config';
|
|
6
5
|
/** Configuration for initializing Sentry. */
|
|
7
6
|
export type InitSentryInput = {
|
|
7
|
+
/** The release environment, rather than the execution environment (browser vs node). */
|
|
8
|
+
releaseEnv: string;
|
|
8
9
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
10
|
+
* In dev, events won't be sent to sentry. In either case, events will be logged to the local
|
|
11
|
+
* console.
|
|
11
12
|
*/
|
|
12
|
-
|
|
13
|
+
isDev: boolean;
|
|
13
14
|
/**
|
|
14
15
|
* The environment wherein the Sentry client will execute. Used to determine which Sentry client
|
|
15
16
|
* to load: browser or node.
|
|
@@ -33,6 +34,6 @@ export type InitSentryInput = {
|
|
|
33
34
|
*
|
|
34
35
|
* To override any default sentry-vir settings, include them in the userConfig input.
|
|
35
36
|
*/
|
|
36
|
-
export declare function baseInitSentry({ dsn, releaseEnv, releaseName, sentryConfigOverrides, createUniversalContext, sentryDep, executionEnv, }: InitSentryInput & {
|
|
37
|
+
export declare function baseInitSentry({ dsn, releaseEnv, releaseName, sentryConfigOverrides, createUniversalContext, sentryDep, executionEnv, isDev, }: InitSentryInput & {
|
|
37
38
|
sentryDep: SentryDep;
|
|
38
39
|
}): Promise<SentryDep>;
|
|
@@ -10,12 +10,12 @@ const sentry_config_1 = require("./sentry-config");
|
|
|
10
10
|
*
|
|
11
11
|
* To override any default sentry-vir settings, include them in the userConfig input.
|
|
12
12
|
*/
|
|
13
|
-
async function baseInitSentry({ dsn, releaseEnv, releaseName, sentryConfigOverrides, createUniversalContext, sentryDep, executionEnv, }) {
|
|
13
|
+
async function baseInitSentry({ dsn, releaseEnv, releaseName, sentryConfigOverrides, createUniversalContext, sentryDep, executionEnv, isDev, }) {
|
|
14
14
|
const finalSentryConfig = await (0, sentry_config_1.createSentryConfig)(executionEnv, sentryDep, {
|
|
15
15
|
dsn,
|
|
16
16
|
environment: releaseEnv,
|
|
17
17
|
release: releaseName,
|
|
18
|
-
}, sentryConfigOverrides,
|
|
18
|
+
}, sentryConfigOverrides, isDev);
|
|
19
19
|
sentryDep.init(finalSentryConfig);
|
|
20
20
|
sentryDep.addGlobalEventProcessor((event, hint) => (0, event_processor_1.processSentryEvent)(event, hint, createUniversalContext));
|
|
21
21
|
(0, sentry_client_for_logging_1.setSentryClientForLogging)(sentryDep);
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import type { Options } from '@sentry/types';
|
|
2
2
|
import { SentryBrowserDep, SentryDepByEnv, SentryExecutionEnvEnum, SentryNodeDep } from '../env/execution-env';
|
|
3
|
-
import { SentryReleaseEnvEnum } from '../env/release-env';
|
|
4
3
|
/** Optional UserOverrides of Sentry config values. */
|
|
5
4
|
export type UserOverrides = Omit<Partial<Options>, keyof RequiredSentryOptions> | undefined;
|
|
6
5
|
/** Sentry config options that are required. */
|
|
7
6
|
export type RequiredSentryOptions = Pick<Required<Options>, 'dsn' | 'environment' | 'release'>;
|
|
8
7
|
/** Creates the sentry config used internally by sentry-vir. */
|
|
9
|
-
export declare function createSentryConfig<const
|
|
8
|
+
export declare function createSentryConfig<const ExecutionEnv extends SentryExecutionEnvEnum>(executionEnv: ExecutionEnv, sentryDep: SentryDepByEnv<ExecutionEnv>, requiredSentryOptions: RequiredSentryOptions, userOverrides: UserOverrides, isDev: boolean): Promise<SentryBrowserDep | SentryNodeDep>;
|
|
@@ -5,14 +5,14 @@ const common_1 = require("@augment-vir/common");
|
|
|
5
5
|
const execution_env_1 = require("../env/execution-env");
|
|
6
6
|
const handle_sentry_send_1 = require("../processing/handle-sentry-send");
|
|
7
7
|
/** Creates the sentry config used internally by sentry-vir. */
|
|
8
|
-
async function createSentryConfig(
|
|
8
|
+
async function createSentryConfig(executionEnv, sentryDep, requiredSentryOptions, userOverrides, isDev) {
|
|
9
9
|
const sharedSentryConfig = {
|
|
10
|
-
beforeSend: (0, handle_sentry_send_1.createSentryHandler)(
|
|
11
|
-
beforeSendTransaction: (0, handle_sentry_send_1.createSentryHandler)(
|
|
10
|
+
beforeSend: (0, handle_sentry_send_1.createSentryHandler)(isDev),
|
|
11
|
+
beforeSendTransaction: (0, handle_sentry_send_1.createSentryHandler)(isDev),
|
|
12
12
|
defaultIntegrations: false,
|
|
13
13
|
enabled: true,
|
|
14
14
|
};
|
|
15
|
-
const envSentryConfig = sentryConfigByEnv[
|
|
15
|
+
const envSentryConfig = sentryConfigByEnv[executionEnv](
|
|
16
16
|
/**
|
|
17
17
|
* As cast needed because env and sentryDep are tightly coupled and there's not a good way
|
|
18
18
|
* to check that they match with a type guard. This is okay, however, because the types of
|
package/dist/cjs/node.d.ts
CHANGED
|
@@ -1,85 +1,10 @@
|
|
|
1
|
+
import type { SentryNodeDep } from './env/execution-env';
|
|
1
2
|
import { InitSentryInput } from './init-sentry/base-sentry-init';
|
|
3
|
+
export type Sentry = SentryNodeDep;
|
|
2
4
|
/**
|
|
3
5
|
* Base Sentry init. Requires the Sentry module to already have been imported. Setup a sentry client
|
|
4
6
|
* with all the default sentry-vir integrations and configs.
|
|
5
7
|
*
|
|
6
8
|
* To override any default sentry-vir settings, include them in the userConfig input.
|
|
7
9
|
*/
|
|
8
|
-
export declare function initSentry({ dsn, releaseEnv, releaseName, sentryConfigOverrides, createUniversalContext, }: Omit<InitSentryInput, 'executionEnv'>): Promise<
|
|
9
|
-
default: typeof import("@sentry/node");
|
|
10
|
-
addGlobalEventProcessor: typeof import("@sentry/node").addGlobalEventProcessor;
|
|
11
|
-
addBreadcrumb: typeof import("@sentry/node").addBreadcrumb;
|
|
12
|
-
addIntegration: typeof import("@sentry/node").addIntegration;
|
|
13
|
-
captureException: typeof import("@sentry/node").captureException;
|
|
14
|
-
captureEvent: typeof import("@sentry/node").captureEvent;
|
|
15
|
-
captureMessage: typeof import("@sentry/node").captureMessage;
|
|
16
|
-
close: typeof import("@sentry/node").close;
|
|
17
|
-
configureScope: typeof import("@sentry/node").configureScope;
|
|
18
|
-
createTransport: typeof import("@sentry/node").createTransport;
|
|
19
|
-
extractTraceparentData: typeof import("@sentry/node").extractTraceparentData;
|
|
20
|
-
flush: typeof import("@sentry/node").flush;
|
|
21
|
-
getActiveTransaction: typeof import("@sentry/node").getActiveTransaction;
|
|
22
|
-
getHubFromCarrier: typeof import("@sentry/node").getHubFromCarrier;
|
|
23
|
-
getCurrentHub: typeof import("@sentry/node").getCurrentHub;
|
|
24
|
-
Hub: typeof import("@sentry/node").Hub;
|
|
25
|
-
lastEventId: typeof import("@sentry/node").lastEventId;
|
|
26
|
-
makeMain: typeof import("@sentry/node").makeMain;
|
|
27
|
-
runWithAsyncContext: typeof import("@sentry/node").runWithAsyncContext;
|
|
28
|
-
Scope: typeof import("@sentry/node").Scope;
|
|
29
|
-
startTransaction: typeof import("@sentry/node").startTransaction;
|
|
30
|
-
SDK_VERSION: "7.80.1";
|
|
31
|
-
setContext: typeof import("@sentry/node").setContext;
|
|
32
|
-
setExtra: typeof import("@sentry/node").setExtra;
|
|
33
|
-
setExtras: typeof import("@sentry/node").setExtras;
|
|
34
|
-
setTag: typeof import("@sentry/node").setTag;
|
|
35
|
-
setTags: typeof import("@sentry/node").setTags;
|
|
36
|
-
setUser: typeof import("@sentry/node").setUser;
|
|
37
|
-
spanStatusfromHttpCode: typeof import("@sentry/node").spanStatusfromHttpCode;
|
|
38
|
-
trace: typeof import("@sentry/node").trace;
|
|
39
|
-
withScope: typeof import("@sentry/node").withScope;
|
|
40
|
-
captureCheckIn: typeof import("@sentry/node").captureCheckIn;
|
|
41
|
-
withMonitor: typeof import("@sentry/node").withMonitor;
|
|
42
|
-
setMeasurement: typeof import("@sentry/node").setMeasurement;
|
|
43
|
-
getActiveSpan: typeof import("@sentry/node").getActiveSpan;
|
|
44
|
-
startSpan: typeof import("@sentry/node").startSpan;
|
|
45
|
-
startActiveSpan: typeof import("@sentry/node").startSpan;
|
|
46
|
-
startInactiveSpan: typeof import("@sentry/node").startInactiveSpan;
|
|
47
|
-
startSpanManual: typeof import("@sentry/node").startSpanManual;
|
|
48
|
-
continueTrace: typeof import("@sentry/node").continueTrace;
|
|
49
|
-
autoDiscoverNodePerformanceMonitoringIntegrations: typeof import("@sentry/node").autoDiscoverNodePerformanceMonitoringIntegrations;
|
|
50
|
-
NodeClient: typeof import("@sentry/node").NodeClient;
|
|
51
|
-
makeNodeTransport: typeof import("@sentry/node").makeNodeTransport;
|
|
52
|
-
defaultIntegrations: (import("@sentry/core").InboundFilters | import("@sentry/core").FunctionToString | import("@sentry/node/types/integrations").OnUncaughtException | import("@sentry/node/types/integrations").OnUnhandledRejection | import("@sentry/node/types/integrations").ContextLines | import("@sentry/node/types/integrations").Context | import("@sentry/node/types/integrations").Console | import("@sentry/node/types/integrations").Http | import("@sentry/node/types/integrations").Modules | import("@sentry/node/types/integrations").RequestData | import("@sentry/node/types/integrations").LocalVariables | import("@sentry/node/types/integrations").Undici | import("@sentry/core").LinkedErrors)[];
|
|
53
|
-
init: typeof import("@sentry/node").init;
|
|
54
|
-
defaultStackParser: import("@sentry/types").StackParser;
|
|
55
|
-
getSentryRelease: typeof import("@sentry/node").getSentryRelease;
|
|
56
|
-
addRequestDataToEvent: typeof import("@sentry/node").addRequestDataToEvent;
|
|
57
|
-
DEFAULT_USER_INCLUDES: string[];
|
|
58
|
-
extractRequestData: typeof import("@sentry/node").extractRequestData;
|
|
59
|
-
deepReadDirSync: typeof import("@sentry/node").deepReadDirSync;
|
|
60
|
-
getModuleFromFilename: typeof import("@sentry/node").getModuleFromFilename;
|
|
61
|
-
enableAnrDetection: typeof import("@sentry/node").enableAnrDetection;
|
|
62
|
-
Integrations: {
|
|
63
|
-
Apollo: typeof import("@sentry-internal/tracing").Apollo;
|
|
64
|
-
Express: typeof import("@sentry-internal/tracing").Express;
|
|
65
|
-
GraphQL: typeof import("@sentry-internal/tracing").GraphQL;
|
|
66
|
-
Mongo: typeof import("@sentry-internal/tracing").Mongo;
|
|
67
|
-
Mysql: typeof import("@sentry-internal/tracing").Mysql;
|
|
68
|
-
Postgres: typeof import("@sentry-internal/tracing").Postgres;
|
|
69
|
-
Prisma: typeof import("@sentry-internal/tracing").Prisma;
|
|
70
|
-
Console: typeof import("@sentry/node/types/integrations").Console;
|
|
71
|
-
Http: typeof import("@sentry/node/types/integrations").Http;
|
|
72
|
-
OnUncaughtException: typeof import("@sentry/node/types/integrations").OnUncaughtException;
|
|
73
|
-
OnUnhandledRejection: typeof import("@sentry/node/types/integrations").OnUnhandledRejection;
|
|
74
|
-
Modules: typeof import("@sentry/node/types/integrations").Modules;
|
|
75
|
-
ContextLines: typeof import("@sentry/node/types/integrations").ContextLines;
|
|
76
|
-
Context: typeof import("@sentry/node/types/integrations").Context;
|
|
77
|
-
RequestData: typeof import("@sentry/node/types/integrations").RequestData;
|
|
78
|
-
LocalVariables: typeof import("@sentry/node/types/integrations").LocalVariables;
|
|
79
|
-
Undici: typeof import("@sentry/node/types/integrations").Undici;
|
|
80
|
-
FunctionToString: typeof import("@sentry/core").FunctionToString;
|
|
81
|
-
InboundFilters: typeof import("@sentry/core").InboundFilters;
|
|
82
|
-
LinkedErrors: typeof import("@sentry/core").LinkedErrors;
|
|
83
|
-
};
|
|
84
|
-
Handlers: typeof import("@sentry/node/types/handlers");
|
|
85
|
-
}>;
|
|
10
|
+
export declare function initSentry({ dsn, releaseEnv, releaseName, sentryConfigOverrides, createUniversalContext, isDev, }: Omit<InitSentryInput, 'executionEnv'>): Promise<SentryNodeDep>;
|
package/dist/cjs/node.js
CHANGED
|
@@ -32,7 +32,7 @@ const base_sentry_init_1 = require("./init-sentry/base-sentry-init");
|
|
|
32
32
|
*
|
|
33
33
|
* To override any default sentry-vir settings, include them in the userConfig input.
|
|
34
34
|
*/
|
|
35
|
-
async function initSentry({ dsn, releaseEnv, releaseName, sentryConfigOverrides, createUniversalContext, }) {
|
|
35
|
+
async function initSentry({ dsn, releaseEnv, releaseName, sentryConfigOverrides, createUniversalContext, isDev, }) {
|
|
36
36
|
const sentryDep = await Promise.resolve().then(() => __importStar(require('@sentry/node')));
|
|
37
37
|
await (0, base_sentry_init_1.baseInitSentry)({
|
|
38
38
|
dsn,
|
|
@@ -42,6 +42,7 @@ async function initSentry({ dsn, releaseEnv, releaseName, sentryConfigOverrides,
|
|
|
42
42
|
createUniversalContext,
|
|
43
43
|
sentryDep,
|
|
44
44
|
executionEnv: execution_env_1.SentryExecutionEnvEnum.Node,
|
|
45
|
+
isDev,
|
|
45
46
|
});
|
|
46
47
|
return sentryDep;
|
|
47
48
|
}
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
import type { EventHint } from '@sentry/browser';
|
|
2
2
|
import type { ErrorEvent, TransactionEvent } from '@sentry/types';
|
|
3
|
-
import { SentryReleaseEnvEnum } from '../env/release-env';
|
|
4
3
|
/** Creates a handler for Sentry events based on the given env. */
|
|
5
4
|
export declare function createSentryHandler(
|
|
6
|
-
/**
|
|
7
|
-
|
|
8
|
-
* not.
|
|
9
|
-
*/
|
|
10
|
-
releaseEnv: SentryReleaseEnvEnum): (event: TransactionEvent | ErrorEvent, hint: EventHint) => TransactionEvent | ErrorEvent | null;
|
|
5
|
+
/** If in dev, events won't be sent to Sentry. They will only be logged in the console. */
|
|
6
|
+
isDev: boolean): (event: TransactionEvent | ErrorEvent, hint: EventHint) => TransactionEvent | ErrorEvent | null;
|
|
11
7
|
/** Tries to extract the original event message from different possible Sentry types. */
|
|
12
8
|
export declare function extractOriginalMessage(
|
|
13
9
|
/** Event from Sentry. */
|
|
@@ -2,15 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.extractOriginalMessage = exports.createSentryHandler = void 0;
|
|
4
4
|
const common_1 = require("@augment-vir/common");
|
|
5
|
-
const release_env_1 = require("../env/release-env");
|
|
6
5
|
const event_severity_1 = require("../event-context/event-severity");
|
|
7
6
|
/** Creates a handler for Sentry events based on the given env. */
|
|
8
7
|
function createSentryHandler(
|
|
9
|
-
/**
|
|
10
|
-
|
|
11
|
-
* not.
|
|
12
|
-
*/
|
|
13
|
-
releaseEnv) {
|
|
8
|
+
/** If in dev, events won't be sent to Sentry. They will only be logged in the console. */
|
|
9
|
+
isDev) {
|
|
14
10
|
/** The actual function that gets called when handling Sentry events. */
|
|
15
11
|
function handleSentrySend(
|
|
16
12
|
/** The event from Sentry. */
|
|
@@ -25,7 +21,7 @@ releaseEnv) {
|
|
|
25
21
|
{ event, hint },
|
|
26
22
|
hint.originalException,
|
|
27
23
|
].filter(common_1.isTruthy);
|
|
28
|
-
if (
|
|
24
|
+
if (isDev) {
|
|
29
25
|
consoleMethod('Would have sent to Sentry:', ...logArgs);
|
|
30
26
|
return null;
|
|
31
27
|
}
|
package/dist/esm/auto.d.ts
CHANGED
|
@@ -12,4 +12,4 @@ export declare const sentryDepByEnv: Record<SentryExecutionEnvEnum, SentryDepImp
|
|
|
12
12
|
*
|
|
13
13
|
* To override any default sentry-vir settings, include them in the userConfig input.
|
|
14
14
|
*/
|
|
15
|
-
export declare function autoInitSentry({ executionEnv, dsn, releaseEnv, releaseName, sentryConfigOverrides, createUniversalContext, }: InitSentryInput): Promise<
|
|
15
|
+
export declare function autoInitSentry({ executionEnv, dsn, releaseEnv, releaseName, sentryConfigOverrides, createUniversalContext, isDev, }: InitSentryInput): Promise<SentryDep>;
|
package/dist/esm/auto.js
CHANGED
|
@@ -8,8 +8,8 @@ export const sentryDepByEnv = {
|
|
|
8
8
|
[SentryExecutionEnvEnum.Node]: () => import('@sentry/node'),
|
|
9
9
|
};
|
|
10
10
|
/** Determine which Sentry client dependency to use and then import it. */
|
|
11
|
-
async function getSentryByEnv(
|
|
12
|
-
return (await sentryDepByEnv[
|
|
11
|
+
async function getSentryByEnv(executionEnv) {
|
|
12
|
+
return (await sentryDepByEnv[executionEnv]());
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
15
|
* Automatically determines which Sentry module to import based on the given execution env. Warning:
|
|
@@ -19,7 +19,7 @@ async function getSentryByEnv(env) {
|
|
|
19
19
|
*
|
|
20
20
|
* To override any default sentry-vir settings, include them in the userConfig input.
|
|
21
21
|
*/
|
|
22
|
-
export async function autoInitSentry({ executionEnv, dsn, releaseEnv, releaseName, sentryConfigOverrides, createUniversalContext, }) {
|
|
22
|
+
export async function autoInitSentry({ executionEnv, dsn, releaseEnv, releaseName, sentryConfigOverrides, createUniversalContext, isDev, }) {
|
|
23
23
|
const sentryDep = await getSentryByEnv(executionEnv);
|
|
24
24
|
await baseInitSentry({
|
|
25
25
|
dsn,
|
|
@@ -29,6 +29,7 @@ export async function autoInitSentry({ executionEnv, dsn, releaseEnv, releaseNam
|
|
|
29
29
|
createUniversalContext,
|
|
30
30
|
sentryDep,
|
|
31
31
|
executionEnv,
|
|
32
|
+
isDev,
|
|
32
33
|
});
|
|
33
34
|
return sentryDep;
|
|
34
35
|
}
|
package/dist/esm/browser.d.ts
CHANGED
|
@@ -1,95 +1,10 @@
|
|
|
1
|
+
import type { SentryBrowserDep } from './env/execution-env';
|
|
1
2
|
import { InitSentryInput } from './init-sentry/base-sentry-init';
|
|
3
|
+
export type Sentry = SentryBrowserDep;
|
|
2
4
|
/**
|
|
3
5
|
* Base Sentry init. Requires the Sentry module to already have been imported. Setup a sentry client
|
|
4
6
|
* with all the default sentry-vir integrations and configs.
|
|
5
7
|
*
|
|
6
8
|
* To override any default sentry-vir settings, include them in the userConfig input.
|
|
7
9
|
*/
|
|
8
|
-
export declare function initSentry({ dsn, releaseEnv, releaseName, sentryConfigOverrides, createUniversalContext, }: Omit<InitSentryInput, 'executionEnv'>): Promise<
|
|
9
|
-
default: typeof import("@sentry/browser");
|
|
10
|
-
Integrations: {
|
|
11
|
-
GlobalHandlers: typeof import("@sentry/browser").GlobalHandlers;
|
|
12
|
-
TryCatch: typeof import("@sentry/browser").TryCatch;
|
|
13
|
-
Breadcrumbs: typeof import("@sentry/browser").Breadcrumbs;
|
|
14
|
-
LinkedErrors: typeof import("@sentry/browser").LinkedErrors;
|
|
15
|
-
HttpContext: typeof import("@sentry/browser").HttpContext;
|
|
16
|
-
Dedupe: typeof import("@sentry/browser").Dedupe;
|
|
17
|
-
FunctionToString: typeof import("@sentry/browser").FunctionToString;
|
|
18
|
-
InboundFilters: typeof import("@sentry/browser").InboundFilters;
|
|
19
|
-
};
|
|
20
|
-
Replay: typeof import("@sentry/browser").Replay;
|
|
21
|
-
BrowserTracing: typeof import("@sentry/browser").BrowserTracing;
|
|
22
|
-
defaultRequestInstrumentationOptions: import("@sentry/browser").RequestInstrumentationOptions;
|
|
23
|
-
instrumentOutgoingRequests: typeof import("@sentry/browser").instrumentOutgoingRequests;
|
|
24
|
-
addTracingExtensions: typeof import("@sentry/browser").addTracingExtensions;
|
|
25
|
-
setMeasurement: typeof import("@sentry/browser").setMeasurement;
|
|
26
|
-
extractTraceparentData: typeof import("@sentry/browser").extractTraceparentData;
|
|
27
|
-
getActiveTransaction: typeof import("@sentry/browser").getActiveTransaction;
|
|
28
|
-
spanStatusfromHttpCode: typeof import("@sentry/browser").spanStatusfromHttpCode;
|
|
29
|
-
trace: typeof import("@sentry/browser").trace;
|
|
30
|
-
makeMultiplexedTransport: typeof import("@sentry/browser").makeMultiplexedTransport;
|
|
31
|
-
ModuleMetadata: typeof import("@sentry/browser").ModuleMetadata;
|
|
32
|
-
makeBrowserOfflineTransport: typeof import("@sentry/browser").makeBrowserOfflineTransport;
|
|
33
|
-
onProfilingStartRouteTransaction: typeof import("@sentry/browser").onProfilingStartRouteTransaction;
|
|
34
|
-
BrowserProfilingIntegration: typeof import("@sentry/browser").BrowserProfilingIntegration;
|
|
35
|
-
addGlobalEventProcessor: typeof import("@sentry/browser").addGlobalEventProcessor;
|
|
36
|
-
addBreadcrumb: typeof import("@sentry/browser").addBreadcrumb;
|
|
37
|
-
addIntegration: typeof import("@sentry/browser").addIntegration;
|
|
38
|
-
captureException: typeof import("@sentry/browser").captureException;
|
|
39
|
-
captureEvent: typeof import("@sentry/browser").captureEvent;
|
|
40
|
-
captureMessage: typeof import("@sentry/browser").captureMessage;
|
|
41
|
-
close: typeof import("@sentry/browser").close;
|
|
42
|
-
configureScope: typeof import("@sentry/browser").configureScope;
|
|
43
|
-
createTransport: typeof import("@sentry/browser").createTransport;
|
|
44
|
-
flush: typeof import("@sentry/browser").flush;
|
|
45
|
-
getHubFromCarrier: typeof import("@sentry/browser").getHubFromCarrier;
|
|
46
|
-
getCurrentHub: typeof import("@sentry/browser").getCurrentHub;
|
|
47
|
-
Hub: typeof import("@sentry/browser").Hub;
|
|
48
|
-
lastEventId: typeof import("@sentry/browser").lastEventId;
|
|
49
|
-
makeMain: typeof import("@sentry/browser").makeMain;
|
|
50
|
-
Scope: typeof import("@sentry/browser").Scope;
|
|
51
|
-
startTransaction: typeof import("@sentry/browser").startTransaction;
|
|
52
|
-
getActiveSpan: typeof import("@sentry/browser").getActiveSpan;
|
|
53
|
-
startSpan: typeof import("@sentry/browser").startSpan;
|
|
54
|
-
startInactiveSpan: typeof import("@sentry/browser").startInactiveSpan;
|
|
55
|
-
startSpanManual: typeof import("@sentry/browser").startSpanManual;
|
|
56
|
-
continueTrace: typeof import("@sentry/browser").continueTrace;
|
|
57
|
-
SDK_VERSION: "7.80.1";
|
|
58
|
-
setContext: typeof import("@sentry/browser").setContext;
|
|
59
|
-
setExtra: typeof import("@sentry/browser").setExtra;
|
|
60
|
-
setExtras: typeof import("@sentry/browser").setExtras;
|
|
61
|
-
setTag: typeof import("@sentry/browser").setTag;
|
|
62
|
-
setTags: typeof import("@sentry/browser").setTags;
|
|
63
|
-
setUser: typeof import("@sentry/browser").setUser;
|
|
64
|
-
withScope: typeof import("@sentry/browser").withScope;
|
|
65
|
-
FunctionToString: typeof import("@sentry/browser").FunctionToString;
|
|
66
|
-
InboundFilters: typeof import("@sentry/browser").InboundFilters;
|
|
67
|
-
WINDOW: import("@sentry/utils").InternalGlobal & Window;
|
|
68
|
-
BrowserClient: typeof import("@sentry/browser").BrowserClient;
|
|
69
|
-
makeFetchTransport: typeof import("@sentry/browser").makeFetchTransport;
|
|
70
|
-
makeXHRTransport: typeof import("@sentry/browser").makeXHRTransport;
|
|
71
|
-
defaultStackParser: import("@sentry/types").StackParser;
|
|
72
|
-
defaultStackLineParsers: import("@sentry/types").StackLineParser[];
|
|
73
|
-
chromeStackLineParser: import("@sentry/types").StackLineParser;
|
|
74
|
-
geckoStackLineParser: import("@sentry/types").StackLineParser;
|
|
75
|
-
opera10StackLineParser: import("@sentry/types").StackLineParser;
|
|
76
|
-
opera11StackLineParser: import("@sentry/types").StackLineParser;
|
|
77
|
-
winjsStackLineParser: import("@sentry/types").StackLineParser;
|
|
78
|
-
eventFromException: typeof import("@sentry/browser").eventFromException;
|
|
79
|
-
eventFromMessage: typeof import("@sentry/browser").eventFromMessage;
|
|
80
|
-
exceptionFromError: typeof import("@sentry/browser").exceptionFromError;
|
|
81
|
-
createUserFeedbackEnvelope: typeof import("@sentry/browser").createUserFeedbackEnvelope;
|
|
82
|
-
defaultIntegrations: (import("@sentry/browser").HttpContext | import("@sentry/browser").Dedupe | import("@sentry/browser").InboundFilters | import("@sentry/browser").FunctionToString | import("@sentry/browser").GlobalHandlers | import("@sentry/browser").TryCatch | import("@sentry/browser").Breadcrumbs | import("@sentry/browser").LinkedErrors)[];
|
|
83
|
-
forceLoad: typeof import("@sentry/browser").forceLoad;
|
|
84
|
-
init: typeof import("@sentry/browser").init;
|
|
85
|
-
onLoad: typeof import("@sentry/browser").onLoad;
|
|
86
|
-
showReportDialog: typeof import("@sentry/browser").showReportDialog;
|
|
87
|
-
captureUserFeedback: typeof import("@sentry/browser").captureUserFeedback;
|
|
88
|
-
wrap: typeof import("@sentry/browser").wrap;
|
|
89
|
-
GlobalHandlers: typeof import("@sentry/browser").GlobalHandlers;
|
|
90
|
-
TryCatch: typeof import("@sentry/browser").TryCatch;
|
|
91
|
-
Breadcrumbs: typeof import("@sentry/browser").Breadcrumbs;
|
|
92
|
-
LinkedErrors: typeof import("@sentry/browser").LinkedErrors;
|
|
93
|
-
HttpContext: typeof import("@sentry/browser").HttpContext;
|
|
94
|
-
Dedupe: typeof import("@sentry/browser").Dedupe;
|
|
95
|
-
}>;
|
|
10
|
+
export declare function initSentry({ dsn, releaseEnv, releaseName, sentryConfigOverrides, createUniversalContext, isDev, }: Omit<InitSentryInput, 'executionEnv'>): Promise<Sentry>;
|
package/dist/esm/browser.js
CHANGED
|
@@ -6,7 +6,7 @@ import { baseInitSentry } from './init-sentry/base-sentry-init';
|
|
|
6
6
|
*
|
|
7
7
|
* To override any default sentry-vir settings, include them in the userConfig input.
|
|
8
8
|
*/
|
|
9
|
-
export async function initSentry({ dsn, releaseEnv, releaseName, sentryConfigOverrides, createUniversalContext, }) {
|
|
9
|
+
export async function initSentry({ dsn, releaseEnv, releaseName, sentryConfigOverrides, createUniversalContext, isDev, }) {
|
|
10
10
|
const sentryDep = await import('@sentry/browser');
|
|
11
11
|
await baseInitSentry({
|
|
12
12
|
dsn,
|
|
@@ -16,6 +16,7 @@ export async function initSentry({ dsn, releaseEnv, releaseName, sentryConfigOve
|
|
|
16
16
|
createUniversalContext,
|
|
17
17
|
sentryDep,
|
|
18
18
|
executionEnv: SentryExecutionEnvEnum.Browser,
|
|
19
|
+
isDev,
|
|
19
20
|
});
|
|
20
21
|
return sentryDep;
|
|
21
22
|
}
|
|
@@ -10,4 +10,4 @@ export type SentryNodeDep = typeof import('@sentry/node');
|
|
|
10
10
|
/** Any of the Sentry client dependencies. */
|
|
11
11
|
export type SentryDep = SentryBrowserDep | SentryNodeDep;
|
|
12
12
|
/** Pick a Sentry client dependency based on the given environment. */
|
|
13
|
-
export type SentryDepByEnv<
|
|
13
|
+
export type SentryDepByEnv<ExecutionEnv extends SentryExecutionEnvEnum> = ExecutionEnv extends SentryExecutionEnvEnum.Browser ? SentryBrowserDep : SentryNodeDep;
|
package/dist/esm/index.d.ts
CHANGED
package/dist/esm/index.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import type { Options } from '@sentry/types';
|
|
2
2
|
import { SentryDep, SentryExecutionEnvEnum } from '../env/execution-env';
|
|
3
|
-
import { SentryReleaseEnvEnum } from '../env/release-env';
|
|
4
3
|
import { EventExtraContextCreator } from '../event-context/event-context';
|
|
5
4
|
import { UserOverrides } from './sentry-config';
|
|
6
5
|
/** Configuration for initializing Sentry. */
|
|
7
6
|
export type InitSentryInput = {
|
|
7
|
+
/** The release environment, rather than the execution environment (browser vs node). */
|
|
8
|
+
releaseEnv: string;
|
|
8
9
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
10
|
+
* In dev, events won't be sent to sentry. In either case, events will be logged to the local
|
|
11
|
+
* console.
|
|
11
12
|
*/
|
|
12
|
-
|
|
13
|
+
isDev: boolean;
|
|
13
14
|
/**
|
|
14
15
|
* The environment wherein the Sentry client will execute. Used to determine which Sentry client
|
|
15
16
|
* to load: browser or node.
|
|
@@ -33,6 +34,6 @@ export type InitSentryInput = {
|
|
|
33
34
|
*
|
|
34
35
|
* To override any default sentry-vir settings, include them in the userConfig input.
|
|
35
36
|
*/
|
|
36
|
-
export declare function baseInitSentry({ dsn, releaseEnv, releaseName, sentryConfigOverrides, createUniversalContext, sentryDep, executionEnv, }: InitSentryInput & {
|
|
37
|
+
export declare function baseInitSentry({ dsn, releaseEnv, releaseName, sentryConfigOverrides, createUniversalContext, sentryDep, executionEnv, isDev, }: InitSentryInput & {
|
|
37
38
|
sentryDep: SentryDep;
|
|
38
39
|
}): Promise<SentryDep>;
|
|
@@ -7,12 +7,12 @@ import { createSentryConfig } from './sentry-config';
|
|
|
7
7
|
*
|
|
8
8
|
* To override any default sentry-vir settings, include them in the userConfig input.
|
|
9
9
|
*/
|
|
10
|
-
export async function baseInitSentry({ dsn, releaseEnv, releaseName, sentryConfigOverrides, createUniversalContext, sentryDep, executionEnv, }) {
|
|
10
|
+
export async function baseInitSentry({ dsn, releaseEnv, releaseName, sentryConfigOverrides, createUniversalContext, sentryDep, executionEnv, isDev, }) {
|
|
11
11
|
const finalSentryConfig = await createSentryConfig(executionEnv, sentryDep, {
|
|
12
12
|
dsn,
|
|
13
13
|
environment: releaseEnv,
|
|
14
14
|
release: releaseName,
|
|
15
|
-
}, sentryConfigOverrides,
|
|
15
|
+
}, sentryConfigOverrides, isDev);
|
|
16
16
|
sentryDep.init(finalSentryConfig);
|
|
17
17
|
sentryDep.addGlobalEventProcessor((event, hint) => processSentryEvent(event, hint, createUniversalContext));
|
|
18
18
|
setSentryClientForLogging(sentryDep);
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import type { Options } from '@sentry/types';
|
|
2
2
|
import { SentryBrowserDep, SentryDepByEnv, SentryExecutionEnvEnum, SentryNodeDep } from '../env/execution-env';
|
|
3
|
-
import { SentryReleaseEnvEnum } from '../env/release-env';
|
|
4
3
|
/** Optional UserOverrides of Sentry config values. */
|
|
5
4
|
export type UserOverrides = Omit<Partial<Options>, keyof RequiredSentryOptions> | undefined;
|
|
6
5
|
/** Sentry config options that are required. */
|
|
7
6
|
export type RequiredSentryOptions = Pick<Required<Options>, 'dsn' | 'environment' | 'release'>;
|
|
8
7
|
/** Creates the sentry config used internally by sentry-vir. */
|
|
9
|
-
export declare function createSentryConfig<const
|
|
8
|
+
export declare function createSentryConfig<const ExecutionEnv extends SentryExecutionEnvEnum>(executionEnv: ExecutionEnv, sentryDep: SentryDepByEnv<ExecutionEnv>, requiredSentryOptions: RequiredSentryOptions, userOverrides: UserOverrides, isDev: boolean): Promise<SentryBrowserDep | SentryNodeDep>;
|
|
@@ -2,14 +2,14 @@ import { mergeDeep } from '@augment-vir/common';
|
|
|
2
2
|
import { SentryExecutionEnvEnum, } from '../env/execution-env';
|
|
3
3
|
import { createSentryHandler } from '../processing/handle-sentry-send';
|
|
4
4
|
/** Creates the sentry config used internally by sentry-vir. */
|
|
5
|
-
export async function createSentryConfig(
|
|
5
|
+
export async function createSentryConfig(executionEnv, sentryDep, requiredSentryOptions, userOverrides, isDev) {
|
|
6
6
|
const sharedSentryConfig = {
|
|
7
|
-
beforeSend: createSentryHandler(
|
|
8
|
-
beforeSendTransaction: createSentryHandler(
|
|
7
|
+
beforeSend: createSentryHandler(isDev),
|
|
8
|
+
beforeSendTransaction: createSentryHandler(isDev),
|
|
9
9
|
defaultIntegrations: false,
|
|
10
10
|
enabled: true,
|
|
11
11
|
};
|
|
12
|
-
const envSentryConfig = sentryConfigByEnv[
|
|
12
|
+
const envSentryConfig = sentryConfigByEnv[executionEnv](
|
|
13
13
|
/**
|
|
14
14
|
* As cast needed because env and sentryDep are tightly coupled and there's not a good way
|
|
15
15
|
* to check that they match with a type guard. This is okay, however, because the types of
|
package/dist/esm/node.d.ts
CHANGED
|
@@ -1,85 +1,10 @@
|
|
|
1
|
+
import type { SentryNodeDep } from './env/execution-env';
|
|
1
2
|
import { InitSentryInput } from './init-sentry/base-sentry-init';
|
|
3
|
+
export type Sentry = SentryNodeDep;
|
|
2
4
|
/**
|
|
3
5
|
* Base Sentry init. Requires the Sentry module to already have been imported. Setup a sentry client
|
|
4
6
|
* with all the default sentry-vir integrations and configs.
|
|
5
7
|
*
|
|
6
8
|
* To override any default sentry-vir settings, include them in the userConfig input.
|
|
7
9
|
*/
|
|
8
|
-
export declare function initSentry({ dsn, releaseEnv, releaseName, sentryConfigOverrides, createUniversalContext, }: Omit<InitSentryInput, 'executionEnv'>): Promise<
|
|
9
|
-
default: typeof import("@sentry/node");
|
|
10
|
-
addGlobalEventProcessor: typeof import("@sentry/node").addGlobalEventProcessor;
|
|
11
|
-
addBreadcrumb: typeof import("@sentry/node").addBreadcrumb;
|
|
12
|
-
addIntegration: typeof import("@sentry/node").addIntegration;
|
|
13
|
-
captureException: typeof import("@sentry/node").captureException;
|
|
14
|
-
captureEvent: typeof import("@sentry/node").captureEvent;
|
|
15
|
-
captureMessage: typeof import("@sentry/node").captureMessage;
|
|
16
|
-
close: typeof import("@sentry/node").close;
|
|
17
|
-
configureScope: typeof import("@sentry/node").configureScope;
|
|
18
|
-
createTransport: typeof import("@sentry/node").createTransport;
|
|
19
|
-
extractTraceparentData: typeof import("@sentry/node").extractTraceparentData;
|
|
20
|
-
flush: typeof import("@sentry/node").flush;
|
|
21
|
-
getActiveTransaction: typeof import("@sentry/node").getActiveTransaction;
|
|
22
|
-
getHubFromCarrier: typeof import("@sentry/node").getHubFromCarrier;
|
|
23
|
-
getCurrentHub: typeof import("@sentry/node").getCurrentHub;
|
|
24
|
-
Hub: typeof import("@sentry/node").Hub;
|
|
25
|
-
lastEventId: typeof import("@sentry/node").lastEventId;
|
|
26
|
-
makeMain: typeof import("@sentry/node").makeMain;
|
|
27
|
-
runWithAsyncContext: typeof import("@sentry/node").runWithAsyncContext;
|
|
28
|
-
Scope: typeof import("@sentry/node").Scope;
|
|
29
|
-
startTransaction: typeof import("@sentry/node").startTransaction;
|
|
30
|
-
SDK_VERSION: "7.80.1";
|
|
31
|
-
setContext: typeof import("@sentry/node").setContext;
|
|
32
|
-
setExtra: typeof import("@sentry/node").setExtra;
|
|
33
|
-
setExtras: typeof import("@sentry/node").setExtras;
|
|
34
|
-
setTag: typeof import("@sentry/node").setTag;
|
|
35
|
-
setTags: typeof import("@sentry/node").setTags;
|
|
36
|
-
setUser: typeof import("@sentry/node").setUser;
|
|
37
|
-
spanStatusfromHttpCode: typeof import("@sentry/node").spanStatusfromHttpCode;
|
|
38
|
-
trace: typeof import("@sentry/node").trace;
|
|
39
|
-
withScope: typeof import("@sentry/node").withScope;
|
|
40
|
-
captureCheckIn: typeof import("@sentry/node").captureCheckIn;
|
|
41
|
-
withMonitor: typeof import("@sentry/node").withMonitor;
|
|
42
|
-
setMeasurement: typeof import("@sentry/node").setMeasurement;
|
|
43
|
-
getActiveSpan: typeof import("@sentry/node").getActiveSpan;
|
|
44
|
-
startSpan: typeof import("@sentry/node").startSpan;
|
|
45
|
-
startActiveSpan: typeof import("@sentry/node").startSpan;
|
|
46
|
-
startInactiveSpan: typeof import("@sentry/node").startInactiveSpan;
|
|
47
|
-
startSpanManual: typeof import("@sentry/node").startSpanManual;
|
|
48
|
-
continueTrace: typeof import("@sentry/node").continueTrace;
|
|
49
|
-
autoDiscoverNodePerformanceMonitoringIntegrations: typeof import("@sentry/node").autoDiscoverNodePerformanceMonitoringIntegrations;
|
|
50
|
-
NodeClient: typeof import("@sentry/node").NodeClient;
|
|
51
|
-
makeNodeTransport: typeof import("@sentry/node").makeNodeTransport;
|
|
52
|
-
defaultIntegrations: (import("@sentry/core").InboundFilters | import("@sentry/core").FunctionToString | import("@sentry/node/types/integrations").OnUncaughtException | import("@sentry/node/types/integrations").OnUnhandledRejection | import("@sentry/node/types/integrations").ContextLines | import("@sentry/node/types/integrations").Context | import("@sentry/node/types/integrations").Console | import("@sentry/node/types/integrations").Http | import("@sentry/node/types/integrations").Modules | import("@sentry/node/types/integrations").RequestData | import("@sentry/node/types/integrations").LocalVariables | import("@sentry/node/types/integrations").Undici | import("@sentry/core").LinkedErrors)[];
|
|
53
|
-
init: typeof import("@sentry/node").init;
|
|
54
|
-
defaultStackParser: import("@sentry/types").StackParser;
|
|
55
|
-
getSentryRelease: typeof import("@sentry/node").getSentryRelease;
|
|
56
|
-
addRequestDataToEvent: typeof import("@sentry/node").addRequestDataToEvent;
|
|
57
|
-
DEFAULT_USER_INCLUDES: string[];
|
|
58
|
-
extractRequestData: typeof import("@sentry/node").extractRequestData;
|
|
59
|
-
deepReadDirSync: typeof import("@sentry/node").deepReadDirSync;
|
|
60
|
-
getModuleFromFilename: typeof import("@sentry/node").getModuleFromFilename;
|
|
61
|
-
enableAnrDetection: typeof import("@sentry/node").enableAnrDetection;
|
|
62
|
-
Integrations: {
|
|
63
|
-
Apollo: typeof import("@sentry-internal/tracing").Apollo;
|
|
64
|
-
Express: typeof import("@sentry-internal/tracing").Express;
|
|
65
|
-
GraphQL: typeof import("@sentry-internal/tracing").GraphQL;
|
|
66
|
-
Mongo: typeof import("@sentry-internal/tracing").Mongo;
|
|
67
|
-
Mysql: typeof import("@sentry-internal/tracing").Mysql;
|
|
68
|
-
Postgres: typeof import("@sentry-internal/tracing").Postgres;
|
|
69
|
-
Prisma: typeof import("@sentry-internal/tracing").Prisma;
|
|
70
|
-
Console: typeof import("@sentry/node/types/integrations").Console;
|
|
71
|
-
Http: typeof import("@sentry/node/types/integrations").Http;
|
|
72
|
-
OnUncaughtException: typeof import("@sentry/node/types/integrations").OnUncaughtException;
|
|
73
|
-
OnUnhandledRejection: typeof import("@sentry/node/types/integrations").OnUnhandledRejection;
|
|
74
|
-
Modules: typeof import("@sentry/node/types/integrations").Modules;
|
|
75
|
-
ContextLines: typeof import("@sentry/node/types/integrations").ContextLines;
|
|
76
|
-
Context: typeof import("@sentry/node/types/integrations").Context;
|
|
77
|
-
RequestData: typeof import("@sentry/node/types/integrations").RequestData;
|
|
78
|
-
LocalVariables: typeof import("@sentry/node/types/integrations").LocalVariables;
|
|
79
|
-
Undici: typeof import("@sentry/node/types/integrations").Undici;
|
|
80
|
-
FunctionToString: typeof import("@sentry/core").FunctionToString;
|
|
81
|
-
InboundFilters: typeof import("@sentry/core").InboundFilters;
|
|
82
|
-
LinkedErrors: typeof import("@sentry/core").LinkedErrors;
|
|
83
|
-
};
|
|
84
|
-
Handlers: typeof import("@sentry/node/types/handlers");
|
|
85
|
-
}>;
|
|
10
|
+
export declare function initSentry({ dsn, releaseEnv, releaseName, sentryConfigOverrides, createUniversalContext, isDev, }: Omit<InitSentryInput, 'executionEnv'>): Promise<SentryNodeDep>;
|
package/dist/esm/node.js
CHANGED
|
@@ -6,7 +6,7 @@ import { baseInitSentry } from './init-sentry/base-sentry-init';
|
|
|
6
6
|
*
|
|
7
7
|
* To override any default sentry-vir settings, include them in the userConfig input.
|
|
8
8
|
*/
|
|
9
|
-
export async function initSentry({ dsn, releaseEnv, releaseName, sentryConfigOverrides, createUniversalContext, }) {
|
|
9
|
+
export async function initSentry({ dsn, releaseEnv, releaseName, sentryConfigOverrides, createUniversalContext, isDev, }) {
|
|
10
10
|
const sentryDep = await import('@sentry/node');
|
|
11
11
|
await baseInitSentry({
|
|
12
12
|
dsn,
|
|
@@ -16,6 +16,7 @@ export async function initSentry({ dsn, releaseEnv, releaseName, sentryConfigOve
|
|
|
16
16
|
createUniversalContext,
|
|
17
17
|
sentryDep,
|
|
18
18
|
executionEnv: SentryExecutionEnvEnum.Node,
|
|
19
|
+
isDev,
|
|
19
20
|
});
|
|
20
21
|
return sentryDep;
|
|
21
22
|
}
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
import type { EventHint } from '@sentry/browser';
|
|
2
2
|
import type { ErrorEvent, TransactionEvent } from '@sentry/types';
|
|
3
|
-
import { SentryReleaseEnvEnum } from '../env/release-env';
|
|
4
3
|
/** Creates a handler for Sentry events based on the given env. */
|
|
5
4
|
export declare function createSentryHandler(
|
|
6
|
-
/**
|
|
7
|
-
|
|
8
|
-
* not.
|
|
9
|
-
*/
|
|
10
|
-
releaseEnv: SentryReleaseEnvEnum): (event: TransactionEvent | ErrorEvent, hint: EventHint) => TransactionEvent | ErrorEvent | null;
|
|
5
|
+
/** If in dev, events won't be sent to Sentry. They will only be logged in the console. */
|
|
6
|
+
isDev: boolean): (event: TransactionEvent | ErrorEvent, hint: EventHint) => TransactionEvent | ErrorEvent | null;
|
|
11
7
|
/** Tries to extract the original event message from different possible Sentry types. */
|
|
12
8
|
export declare function extractOriginalMessage(
|
|
13
9
|
/** Event from Sentry. */
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
import { extractErrorMessage, isTruthy } from '@augment-vir/common';
|
|
2
|
-
import { SentryReleaseEnvEnum } from '../env/release-env';
|
|
3
2
|
import { getConsoleMethodForSeverity } from '../event-context/event-severity';
|
|
4
3
|
/** Creates a handler for Sentry events based on the given env. */
|
|
5
4
|
export function createSentryHandler(
|
|
6
|
-
/**
|
|
7
|
-
|
|
8
|
-
* not.
|
|
9
|
-
*/
|
|
10
|
-
releaseEnv) {
|
|
5
|
+
/** If in dev, events won't be sent to Sentry. They will only be logged in the console. */
|
|
6
|
+
isDev) {
|
|
11
7
|
/** The actual function that gets called when handling Sentry events. */
|
|
12
8
|
function handleSentrySend(
|
|
13
9
|
/** The event from Sentry. */
|
|
@@ -22,7 +18,7 @@ releaseEnv) {
|
|
|
22
18
|
{ event, hint },
|
|
23
19
|
hint.originalException,
|
|
24
20
|
].filter(isTruthy);
|
|
25
|
-
if (
|
|
21
|
+
if (isDev) {
|
|
26
22
|
consoleMethod('Would have sent to Sentry:', ...logArgs);
|
|
27
23
|
return null;
|
|
28
24
|
}
|
package/package.json
CHANGED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SentryReleaseEnvEnum = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Used to determine logging behavior (dev does not send events to Sentry but still logs them
|
|
6
|
-
* locally).
|
|
7
|
-
*/
|
|
8
|
-
var SentryReleaseEnvEnum;
|
|
9
|
-
(function (SentryReleaseEnvEnum) {
|
|
10
|
-
SentryReleaseEnvEnum["Prod"] = "prod";
|
|
11
|
-
SentryReleaseEnvEnum["Dev"] = "dev";
|
|
12
|
-
})(SentryReleaseEnvEnum || (exports.SentryReleaseEnvEnum = SentryReleaseEnvEnum = {}));
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Used to determine logging behavior (dev does not send events to Sentry but still logs them
|
|
3
|
-
* locally).
|
|
4
|
-
*/
|
|
5
|
-
export var SentryReleaseEnvEnum;
|
|
6
|
-
(function (SentryReleaseEnvEnum) {
|
|
7
|
-
SentryReleaseEnvEnum["Prod"] = "prod";
|
|
8
|
-
SentryReleaseEnvEnum["Dev"] = "dev";
|
|
9
|
-
})(SentryReleaseEnvEnum || (SentryReleaseEnvEnum = {}));
|