@dxos/observability 0.3.11-main.0252f93
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/LICENSE +8 -0
- package/README.md +26 -0
- package/dist/lib/browser/chunk-2J5YS65Q.mjs +81 -0
- package/dist/lib/browser/chunk-2J5YS65Q.mjs.map +7 -0
- package/dist/lib/browser/chunk-6KUJPLEH.mjs +293 -0
- package/dist/lib/browser/chunk-6KUJPLEH.mjs.map +7 -0
- package/dist/lib/browser/datadog/index.mjs +9 -0
- package/dist/lib/browser/datadog/index.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +557 -0
- package/dist/lib/browser/index.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -0
- package/dist/lib/browser/sentry/index.mjs +25 -0
- package/dist/lib/browser/sentry/index.mjs.map +7 -0
- package/dist/lib/node/chunk-FSAOBKO2.cjs +352 -0
- package/dist/lib/node/chunk-FSAOBKO2.cjs.map +7 -0
- package/dist/lib/node/chunk-VDBBIYH6.cjs +101 -0
- package/dist/lib/node/chunk-VDBBIYH6.cjs.map +7 -0
- package/dist/lib/node/datadog/index.cjs +31 -0
- package/dist/lib/node/datadog/index.cjs.map +7 -0
- package/dist/lib/node/index.cjs +630 -0
- package/dist/lib/node/index.cjs.map +7 -0
- package/dist/lib/node/meta.json +1 -0
- package/dist/lib/node/sentry/index.cjs +45 -0
- package/dist/lib/node/sentry/index.cjs.map +7 -0
- package/dist/types/src/cli-observability-secrets.json +7 -0
- package/dist/types/src/datadog/browser.d.ts +8 -0
- package/dist/types/src/datadog/browser.d.ts.map +1 -0
- package/dist/types/src/datadog/browser.js +22 -0
- package/dist/types/src/datadog/browser.js.map +1 -0
- package/dist/types/src/datadog/index.d.ts +3 -0
- package/dist/types/src/datadog/index.d.ts.map +1 -0
- package/dist/types/src/datadog/index.js +22 -0
- package/dist/types/src/datadog/index.js.map +1 -0
- package/dist/types/src/datadog/metrics.d.ts +16 -0
- package/dist/types/src/datadog/metrics.d.ts.map +1 -0
- package/dist/types/src/datadog/metrics.js +56 -0
- package/dist/types/src/datadog/metrics.js.map +1 -0
- package/dist/types/src/datadog/node.d.ts +7 -0
- package/dist/types/src/datadog/node.d.ts.map +1 -0
- package/dist/types/src/datadog/node.js +22 -0
- package/dist/types/src/datadog/node.js.map +1 -0
- package/dist/types/src/index.d.ts +2 -0
- package/dist/types/src/index.d.ts.map +1 -0
- package/dist/types/src/index.js +21 -0
- package/dist/types/src/index.js.map +1 -0
- package/dist/types/src/observability.d.ts +85 -0
- package/dist/types/src/observability.d.ts.map +1 -0
- package/dist/types/src/observability.js +352 -0
- package/dist/types/src/observability.js.map +1 -0
- package/dist/types/src/segment/browser.d.ts +9 -0
- package/dist/types/src/segment/browser.d.ts.map +1 -0
- package/dist/types/src/segment/browser.js +71 -0
- package/dist/types/src/segment/browser.js.map +1 -0
- package/dist/types/src/segment/index.d.ts +3 -0
- package/dist/types/src/segment/index.d.ts.map +1 -0
- package/dist/types/src/segment/index.js +22 -0
- package/dist/types/src/segment/index.js.map +1 -0
- package/dist/types/src/segment/node.d.ts +19 -0
- package/dist/types/src/segment/node.d.ts.map +1 -0
- package/dist/types/src/segment/node.js +88 -0
- package/dist/types/src/segment/node.js.map +1 -0
- package/dist/types/src/segment/types.d.ts +22 -0
- package/dist/types/src/segment/types.d.ts.map +1 -0
- package/dist/types/src/segment/types.js +6 -0
- package/dist/types/src/segment/types.js.map +1 -0
- package/dist/types/src/sentry/browser.d.ts +31 -0
- package/dist/types/src/sentry/browser.d.ts.map +1 -0
- package/dist/types/src/sentry/browser.js +112 -0
- package/dist/types/src/sentry/browser.js.map +1 -0
- package/dist/types/src/sentry/index.d.ts +4 -0
- package/dist/types/src/sentry/index.d.ts.map +1 -0
- package/dist/types/src/sentry/index.js +26 -0
- package/dist/types/src/sentry/index.js.map +1 -0
- package/dist/types/src/sentry/node.d.ts +32 -0
- package/dist/types/src/sentry/node.d.ts.map +1 -0
- package/dist/types/src/sentry/node.js +169 -0
- package/dist/types/src/sentry/node.js.map +1 -0
- package/dist/types/src/sentry/node.test.d.ts +2 -0
- package/dist/types/src/sentry/node.test.d.ts.map +1 -0
- package/dist/types/src/sentry/node.test.js +66 -0
- package/dist/types/src/sentry/node.test.js.map +1 -0
- package/dist/types/src/sentry/sentry.test.d.ts +2 -0
- package/dist/types/src/sentry/sentry.test.d.ts.map +1 -0
- package/dist/types/src/sentry/sentry.test.js +60 -0
- package/dist/types/src/sentry/sentry.test.js.map +1 -0
- package/dist/types/src/sentry/tracing.d.ts +5 -0
- package/dist/types/src/sentry/tracing.d.ts.map +1 -0
- package/dist/types/src/sentry/tracing.js +141 -0
- package/dist/types/src/sentry/tracing.js.map +1 -0
- package/dist/types/src/sentry/tracing.test.d.ts +2 -0
- package/dist/types/src/sentry/tracing.test.d.ts.map +1 -0
- package/dist/types/src/sentry/tracing.test.js +76 -0
- package/dist/types/src/sentry/tracing.test.js.map +1 -0
- package/dist/types/src/sentry/types.d.ts +18 -0
- package/dist/types/src/sentry/types.d.ts.map +1 -0
- package/dist/types/src/sentry/types.js +6 -0
- package/dist/types/src/sentry/types.js.map +1 -0
- package/dist/types/src/testing/index.d.ts +2 -0
- package/dist/types/src/testing/index.d.ts.map +1 -0
- package/dist/types/src/testing/index.js +21 -0
- package/dist/types/src/testing/index.js.map +1 -0
- package/dist/types/src/testing/testkit/browser.d.ts +2 -0
- package/dist/types/src/testing/testkit/browser.d.ts.map +1 -0
- package/dist/types/src/testing/testkit/browser.js +13 -0
- package/dist/types/src/testing/testkit/browser.js.map +1 -0
- package/dist/types/src/testing/testkit/index.d.ts +2 -0
- package/dist/types/src/testing/testkit/index.d.ts.map +1 -0
- package/dist/types/src/testing/testkit/index.js +12 -0
- package/dist/types/src/testing/testkit/index.js.map +1 -0
- package/dist/types/src/util.d.ts +19 -0
- package/dist/types/src/util.d.ts.map +1 -0
- package/dist/types/src/util.js +42 -0
- package/dist/types/src/util.js.map +1 -0
- package/package.json +94 -0
- package/src/cli-observability-secrets.json +7 -0
- package/src/datadog/browser.ts +21 -0
- package/src/datadog/index.ts +6 -0
- package/src/datadog/metrics.ts +49 -0
- package/src/datadog/node.ts +19 -0
- package/src/index.ts +5 -0
- package/src/observability.ts +442 -0
- package/src/segment/browser.ts +67 -0
- package/src/segment/index.ts +6 -0
- package/src/segment/node.ts +91 -0
- package/src/segment/types.ts +27 -0
- package/src/sentry/browser.ts +100 -0
- package/src/sentry/index.ts +9 -0
- package/src/sentry/node.test.ts +46 -0
- package/src/sentry/node.ts +153 -0
- package/src/sentry/sentry.test.ts +39 -0
- package/src/sentry/tracing.test.ts +62 -0
- package/src/sentry/tracing.ts +153 -0
- package/src/sentry/types.ts +22 -0
- package/src/testing/index.ts +5 -0
- package/src/testing/testkit/browser.ts +8 -0
- package/src/testing/testkit/index.ts +7 -0
- package/src/testing/testkit/shims.d.ts +5 -0
- package/src/util.ts +49 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { addBreadcrumb as naturalAddBreadcrumb, captureException as naturalCaptureException } from '@sentry/browser';
|
|
2
|
+
import { type InitOptions } from './types';
|
|
3
|
+
export * from './tracing';
|
|
4
|
+
export { setTag, setTags, setUser } from '@sentry/browser';
|
|
5
|
+
/**
|
|
6
|
+
* To use this SDK, call the init function as early as possible when loading the web page.
|
|
7
|
+
* To set context information or send manual events, use the provided methods.
|
|
8
|
+
*
|
|
9
|
+
* @param options {InitOptions}
|
|
10
|
+
*/
|
|
11
|
+
export declare const init: (options: InitOptions) => void;
|
|
12
|
+
/**
|
|
13
|
+
* Records a new breadcrumb which will be attached to future events.
|
|
14
|
+
*
|
|
15
|
+
* Breadcrumbs will be added to subsequent events to provide more context on user's actions prior to an error or crash.
|
|
16
|
+
*
|
|
17
|
+
* https://docs.sentry.io/platforms/javascript/enriching-events/breadcrumbs/
|
|
18
|
+
*
|
|
19
|
+
* @param breadcrumb — The breadcrumb to record.
|
|
20
|
+
*/
|
|
21
|
+
export declare const addBreadcrumb: typeof naturalAddBreadcrumb;
|
|
22
|
+
/**
|
|
23
|
+
* Captures an exception event and sends it to Sentry.
|
|
24
|
+
*
|
|
25
|
+
* @param exception — An exception-like object.
|
|
26
|
+
* @param captureContext — Additional scope data to apply to exception event.
|
|
27
|
+
* @returns — The generated eventId.
|
|
28
|
+
*/
|
|
29
|
+
export declare const captureException: typeof naturalCaptureException;
|
|
30
|
+
export declare const enableSentryLogProcessor: () => void;
|
|
31
|
+
//# sourceMappingURL=browser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../../../src/sentry/browser.ts"],"names":[],"mappings":"AAIA,OAAO,EAGL,aAAa,IAAI,oBAAoB,EACrC,gBAAgB,IAAI,uBAAuB,EAG5C,MAAM,iBAAiB,CAAC;AAKzB,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,SAAS,CAAC;AAG3C,cAAc,WAAW,CAAC;AAG1B,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE3D;;;;;GAKG;AACH,eAAO,MAAM,IAAI,YAAa,WAAW,SA8BxC,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,aAAa,EAAE,OAAO,oBAOlC,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,EAAE,OAAO,uBASrC,CAAC;AAGF,eAAO,MAAM,wBAAwB,YAAW,CAAC"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
//
|
|
3
|
+
// Copyright 2022 DXOS.org
|
|
4
|
+
//
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
17
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
18
|
+
};
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.enableSentryLogProcessor = exports.captureException = exports.addBreadcrumb = exports.init = exports.setUser = exports.setTags = exports.setTag = void 0;
|
|
21
|
+
const browser_1 = require("@sentry/browser");
|
|
22
|
+
const integrations_1 = require("@sentry/integrations");
|
|
23
|
+
const log_1 = require("@dxos/log");
|
|
24
|
+
// Browser only feature.
|
|
25
|
+
__exportStar(require("./tracing"), exports);
|
|
26
|
+
// Polyfill export.
|
|
27
|
+
var browser_2 = require("@sentry/browser");
|
|
28
|
+
Object.defineProperty(exports, "setTag", { enumerable: true, get: function () { return browser_2.setTag; } });
|
|
29
|
+
Object.defineProperty(exports, "setTags", { enumerable: true, get: function () { return browser_2.setTags; } });
|
|
30
|
+
Object.defineProperty(exports, "setUser", { enumerable: true, get: function () { return browser_2.setUser; } });
|
|
31
|
+
/**
|
|
32
|
+
* To use this SDK, call the init function as early as possible when loading the web page.
|
|
33
|
+
* To set context information or send manual events, use the provided methods.
|
|
34
|
+
*
|
|
35
|
+
* @param options {InitOptions}
|
|
36
|
+
*/
|
|
37
|
+
const init = (options) => {
|
|
38
|
+
var _a, _b;
|
|
39
|
+
try {
|
|
40
|
+
(0, log_1.log)('sentry init', options);
|
|
41
|
+
(0, browser_1.init)({
|
|
42
|
+
enabled: (_a = options.enable) !== null && _a !== void 0 ? _a : true,
|
|
43
|
+
dsn: options.destination,
|
|
44
|
+
release: options.release,
|
|
45
|
+
environment: options.environment,
|
|
46
|
+
integrations: [
|
|
47
|
+
(0, integrations_1.captureConsoleIntegration)({ levels: ['error', 'warn'] }),
|
|
48
|
+
(0, integrations_1.httpClientIntegration)({ failedRequestStatusCodes: [[400, 599]] }),
|
|
49
|
+
...(options.tracing ? [new browser_1.BrowserTracing()] : []),
|
|
50
|
+
...(options.replay ? [(0, browser_1.replayIntegration)({ blockAllMedia: true, maskAllText: true })] : []),
|
|
51
|
+
],
|
|
52
|
+
replaysSessionSampleRate: options.replaySampleRate,
|
|
53
|
+
replaysOnErrorSampleRate: options.replaySampleRateOnError,
|
|
54
|
+
tracesSampleRate: options.sampleRate,
|
|
55
|
+
transport: options.transport,
|
|
56
|
+
beforeSend: (event) => {
|
|
57
|
+
var _a;
|
|
58
|
+
(_a = options.onError) === null || _a === void 0 ? void 0 : _a.call(options, event);
|
|
59
|
+
return event;
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
Object.entries((_b = options.properties) !== null && _b !== void 0 ? _b : {}).forEach(([key, value]) => {
|
|
63
|
+
(0, browser_1.setTag)(key, value);
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
catch (err) {
|
|
67
|
+
log_1.log.catch('Failed to initialize sentry', err);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
exports.init = init;
|
|
71
|
+
/**
|
|
72
|
+
* Records a new breadcrumb which will be attached to future events.
|
|
73
|
+
*
|
|
74
|
+
* Breadcrumbs will be added to subsequent events to provide more context on user's actions prior to an error or crash.
|
|
75
|
+
*
|
|
76
|
+
* https://docs.sentry.io/platforms/javascript/enriching-events/breadcrumbs/
|
|
77
|
+
*
|
|
78
|
+
* @param breadcrumb — The breadcrumb to record.
|
|
79
|
+
*/
|
|
80
|
+
const addBreadcrumb = (breadcrumb) => {
|
|
81
|
+
try {
|
|
82
|
+
(0, browser_1.addBreadcrumb)(breadcrumb);
|
|
83
|
+
(0, log_1.log)('add breadcrumb', breadcrumb);
|
|
84
|
+
}
|
|
85
|
+
catch (err) {
|
|
86
|
+
log_1.log.catch('Failed to add breadcrumb', err);
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
exports.addBreadcrumb = addBreadcrumb;
|
|
90
|
+
/**
|
|
91
|
+
* Captures an exception event and sends it to Sentry.
|
|
92
|
+
*
|
|
93
|
+
* @param exception — An exception-like object.
|
|
94
|
+
* @param captureContext — Additional scope data to apply to exception event.
|
|
95
|
+
* @returns — The generated eventId.
|
|
96
|
+
*/
|
|
97
|
+
const captureException = (exception, captureContext) => {
|
|
98
|
+
try {
|
|
99
|
+
const eventId = (0, browser_1.captureException)(exception, captureContext);
|
|
100
|
+
(0, log_1.log)('capture exception', { exception, eventId, ...captureContext });
|
|
101
|
+
return eventId;
|
|
102
|
+
}
|
|
103
|
+
catch (err) {
|
|
104
|
+
log_1.log.catch('Failed to capture exception', err);
|
|
105
|
+
return 'unknown';
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
exports.captureException = captureException;
|
|
109
|
+
// Not needed for browser.
|
|
110
|
+
const enableSentryLogProcessor = () => { };
|
|
111
|
+
exports.enableSentryLogProcessor = enableSentryLogProcessor;
|
|
112
|
+
//# sourceMappingURL=browser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser.js","sourceRoot":"","sources":["../../../../src/sentry/browser.ts"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;;;;;;;;;;;;;;;;AAEF,6CAOyB;AACzB,uDAAwF;AAExF,mCAAgC;AAIhC,wBAAwB;AACxB,4CAA0B;AAE1B,mBAAmB;AACnB,2CAA2D;AAAlD,iGAAA,MAAM,OAAA;AAAE,kGAAA,OAAO,OAAA;AAAE,kGAAA,OAAO,OAAA;AAEjC;;;;;GAKG;AACI,MAAM,IAAI,GAAG,CAAC,OAAoB,EAAE,EAAE;;IAC3C,IAAI;QACF,IAAA,SAAG,EAAC,aAAa,EAAE,OAAO,CAAC,CAAC;QAC5B,IAAA,cAAW,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@@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
//
|
|
3
|
+
// Copyright 2022 DXOS.org
|
|
4
|
+
//
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
17
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
18
|
+
};
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.configureTracing = void 0;
|
|
21
|
+
__exportStar(require("./node"), exports);
|
|
22
|
+
__exportStar(require("./types"), exports);
|
|
23
|
+
// TODO(mykola): Tracing does not work in the node. Delete this export.
|
|
24
|
+
var tracing_1 = require("./tracing");
|
|
25
|
+
Object.defineProperty(exports, "configureTracing", { enumerable: true, get: function () { return tracing_1.configureTracing; } });
|
|
26
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/sentry/index.ts"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;;;;;;;;;;;;;;;;AAEF,yCAAuB;AACvB,0CAAwB;AAExB,uEAAuE;AACvE,qCAA6C;AAApC,2GAAA,gBAAgB,OAAA"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { addBreadcrumb as naturalAddBreadcrumb, captureException as naturalCaptureException } from '@sentry/node';
|
|
2
|
+
import { LogLevel } from '@dxos/log';
|
|
3
|
+
import { type InitOptions } from './types';
|
|
4
|
+
export { setTag, setTags, setUser } from '@sentry/node';
|
|
5
|
+
/**
|
|
6
|
+
* To use this SDK, call the init function as early as possible in the main entry module.
|
|
7
|
+
* To set context information or send manual events, use the provided methods.
|
|
8
|
+
*
|
|
9
|
+
* @param options {InitOptions}
|
|
10
|
+
*/
|
|
11
|
+
export declare const init: (options: InitOptions) => void;
|
|
12
|
+
/**
|
|
13
|
+
* Records a new breadcrumb which will be attached to future events.
|
|
14
|
+
*
|
|
15
|
+
* Breadcrumbs will be added to subsequent events to provide more context on user's actions prior to an error or crash.
|
|
16
|
+
*
|
|
17
|
+
* https://docs.sentry.io/platforms/javascript/enriching-events/breadcrumbs/
|
|
18
|
+
*
|
|
19
|
+
* @param breadcrumb — The breadcrumb to record.
|
|
20
|
+
*/
|
|
21
|
+
export declare const addBreadcrumb: typeof naturalAddBreadcrumb;
|
|
22
|
+
/**
|
|
23
|
+
* Captures an exception event and sends it to Sentry.
|
|
24
|
+
*
|
|
25
|
+
* @param exception — An exception-like object.
|
|
26
|
+
* @param captureContext — Additional scope data to apply to exception event.
|
|
27
|
+
* @returns — The generated eventId.
|
|
28
|
+
*/
|
|
29
|
+
export declare const captureException: typeof naturalCaptureException;
|
|
30
|
+
export declare const enableSentryLogProcessor: (filter?: string | string[] | LogLevel) => void;
|
|
31
|
+
export declare const SENTRY_LOG_PROCESSOR: (config: any, entry: any) => void;
|
|
32
|
+
//# sourceMappingURL=node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../../../src/sentry/node.ts"],"names":[],"mappings":"AAKA,OAAO,EAGL,aAAa,IAAI,oBAAoB,EACrC,gBAAgB,IAAI,uBAAuB,EAG5C,MAAM,cAAc,CAAC;AAItB,OAAO,EAAO,QAAQ,EAAa,MAAM,WAAW,CAAC;AAErD,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,SAAS,CAAC;AAG3C,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAExD;;;;;GAKG;AACH,eAAO,MAAM,IAAI,YAAa,WAAW,SA6BxC,CAAC;AAWF;;;;;;;;GAQG;AACH,eAAO,MAAM,aAAa,EAAE,OAAO,oBAOlC,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,EAAE,OAAO,uBASrC,CAAC;AAGF,eAAO,MAAM,wBAAwB,YAAa,MAAM,GAAG,MAAM,EAAE,GAAG,QAAQ,SAE7E,CAAC;AAEF,eAAO,MAAM,oBAAoB,WAAY,GAAG,SAAS,GAAG,SAoB3D,CAAC"}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
//
|
|
3
|
+
// Copyright 2022 DXOS.org
|
|
4
|
+
//
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
+
__setModuleDefault(result, mod);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.SENTRY_LOG_PROCESSOR = exports.enableSentryLogProcessor = exports.captureException = exports.addBreadcrumb = exports.init = exports.setUser = exports.setTags = exports.setTag = void 0;
|
|
30
|
+
const integrations_1 = require("@sentry/integrations");
|
|
31
|
+
const node_1 = require("@sentry/node");
|
|
32
|
+
const log_1 = require("@dxos/log");
|
|
33
|
+
// Polyfill export.
|
|
34
|
+
var node_2 = require("@sentry/node");
|
|
35
|
+
Object.defineProperty(exports, "setTag", { enumerable: true, get: function () { return node_2.setTag; } });
|
|
36
|
+
Object.defineProperty(exports, "setTags", { enumerable: true, get: function () { return node_2.setTags; } });
|
|
37
|
+
Object.defineProperty(exports, "setUser", { enumerable: true, get: function () { return node_2.setUser; } });
|
|
38
|
+
/**
|
|
39
|
+
* To use this SDK, call the init function as early as possible in the main entry module.
|
|
40
|
+
* To set context information or send manual events, use the provided methods.
|
|
41
|
+
*
|
|
42
|
+
* @param options {InitOptions}
|
|
43
|
+
*/
|
|
44
|
+
const init = (options) => {
|
|
45
|
+
var _a, _b, _c;
|
|
46
|
+
try {
|
|
47
|
+
if (options.tracing) {
|
|
48
|
+
void Promise.resolve().then(() => __importStar(require('@sentry/tracing')));
|
|
49
|
+
}
|
|
50
|
+
(0, node_1.init)({
|
|
51
|
+
enabled: (_a = options.enable) !== null && _a !== void 0 ? _a : true,
|
|
52
|
+
dsn: options.destination,
|
|
53
|
+
serverName: options.installationId,
|
|
54
|
+
release: options.release,
|
|
55
|
+
environment: (_b = options.environment) !== null && _b !== void 0 ? _b : process.env.DX_ENVIRONMENT,
|
|
56
|
+
integrations: [(0, integrations_1.captureConsoleIntegration)({ levels: ['error', 'warn'] })],
|
|
57
|
+
tracesSampleRate: options.sampleRate,
|
|
58
|
+
transport: options.transport,
|
|
59
|
+
beforeSend: (event) => {
|
|
60
|
+
var _a;
|
|
61
|
+
options.scrubFilenames && scrub(event);
|
|
62
|
+
(_a = options.onError) === null || _a === void 0 ? void 0 : _a.call(options, event);
|
|
63
|
+
return event;
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
Object.entries((_c = options.properties) !== null && _c !== void 0 ? _c : {}).forEach(([key, value]) => {
|
|
67
|
+
(0, node_1.setTag)(key, value);
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
catch (err) {
|
|
71
|
+
log_1.log.catch('Failed to initialize sentry', err);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
exports.init = init;
|
|
75
|
+
const scrub = (event) => {
|
|
76
|
+
var _a, _b;
|
|
77
|
+
(_b = (_a = event.exception) === null || _a === void 0 ? void 0 : _a.values) === null || _b === void 0 ? void 0 : _b.forEach((value) => {
|
|
78
|
+
var _a, _b;
|
|
79
|
+
(_b = (_a = value.stacktrace) === null || _a === void 0 ? void 0 : _a.frames) === null || _b === void 0 ? void 0 : _b.forEach((frame) => {
|
|
80
|
+
var _a;
|
|
81
|
+
const filename = (_a = frame.filename) === null || _a === void 0 ? void 0 : _a.split('/');
|
|
82
|
+
frame.filename = filename && filename[filename.length - 1];
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* Records a new breadcrumb which will be attached to future events.
|
|
88
|
+
*
|
|
89
|
+
* Breadcrumbs will be added to subsequent events to provide more context on user's actions prior to an error or crash.
|
|
90
|
+
*
|
|
91
|
+
* https://docs.sentry.io/platforms/javascript/enriching-events/breadcrumbs/
|
|
92
|
+
*
|
|
93
|
+
* @param breadcrumb — The breadcrumb to record.
|
|
94
|
+
*/
|
|
95
|
+
const addBreadcrumb = (breadcrumb) => {
|
|
96
|
+
try {
|
|
97
|
+
(0, node_1.addBreadcrumb)(breadcrumb);
|
|
98
|
+
(0, log_1.log)('add breadcrumb', breadcrumb);
|
|
99
|
+
}
|
|
100
|
+
catch (err) {
|
|
101
|
+
log_1.log.catch('Failed to add breadcrumb', err);
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
exports.addBreadcrumb = addBreadcrumb;
|
|
105
|
+
/**
|
|
106
|
+
* Captures an exception event and sends it to Sentry.
|
|
107
|
+
*
|
|
108
|
+
* @param exception — An exception-like object.
|
|
109
|
+
* @param captureContext — Additional scope data to apply to exception event.
|
|
110
|
+
* @returns — The generated eventId.
|
|
111
|
+
*/
|
|
112
|
+
const captureException = (exception, captureContext) => {
|
|
113
|
+
try {
|
|
114
|
+
const eventId = (0, node_1.captureException)(exception, captureContext);
|
|
115
|
+
(0, log_1.log)('capture exception', { exception, eventId, ...captureContext });
|
|
116
|
+
return eventId;
|
|
117
|
+
}
|
|
118
|
+
catch (err) {
|
|
119
|
+
log_1.log.catch('Failed to capture exception', err);
|
|
120
|
+
return 'unknown';
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
exports.captureException = captureException;
|
|
124
|
+
// TODO(nf): move to log package as a first-class processor.
|
|
125
|
+
const enableSentryLogProcessor = (filter) => {
|
|
126
|
+
log_1.log.runtimeConfig.processors.push(exports.SENTRY_LOG_PROCESSOR);
|
|
127
|
+
};
|
|
128
|
+
exports.enableSentryLogProcessor = enableSentryLogProcessor;
|
|
129
|
+
const SENTRY_LOG_PROCESSOR = (config, entry) => {
|
|
130
|
+
const { message, level, meta, error } = entry;
|
|
131
|
+
if (!(0, log_1.shouldLog)(entry, config.captureFilters)) {
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
// TODO(nf): add rate limiting to avoid spamming Sentry/consuming excessive quota.
|
|
135
|
+
(0, node_1.withScope)((scope) => {
|
|
136
|
+
scope.setLevel(convertLevel(level));
|
|
137
|
+
scope.setContext('dxoslog', entry.context);
|
|
138
|
+
if (meta) {
|
|
139
|
+
scope.setTransactionName(`${getRelativeFilename(meta.F)}:${meta.L}`);
|
|
140
|
+
}
|
|
141
|
+
// Is this ever used?
|
|
142
|
+
if (error) {
|
|
143
|
+
scope.setExtra('message', message);
|
|
144
|
+
return (0, node_1.captureException)(error);
|
|
145
|
+
}
|
|
146
|
+
(0, node_1.captureMessage)(message);
|
|
147
|
+
});
|
|
148
|
+
};
|
|
149
|
+
exports.SENTRY_LOG_PROCESSOR = SENTRY_LOG_PROCESSOR;
|
|
150
|
+
const convertLevel = (level) => {
|
|
151
|
+
if (level === log_1.LogLevel.TRACE) {
|
|
152
|
+
return 'debug';
|
|
153
|
+
}
|
|
154
|
+
if (level === log_1.LogLevel.WARN) {
|
|
155
|
+
return 'warning';
|
|
156
|
+
}
|
|
157
|
+
return log_1.LogLevel[level].toLowerCase();
|
|
158
|
+
};
|
|
159
|
+
const getRelativeFilename = (filename) => {
|
|
160
|
+
// TODO(burdon): Hack uses "packages" as an anchor (pre-parse NX?)
|
|
161
|
+
// Including `packages/` part of the path so that excluded paths (e.g. from dist) are clickable in vscode.
|
|
162
|
+
const match = filename.match(/.+\/(packages\/.+\/.+)/);
|
|
163
|
+
if (match) {
|
|
164
|
+
const [, filePath] = match;
|
|
165
|
+
return filePath;
|
|
166
|
+
}
|
|
167
|
+
return filename;
|
|
168
|
+
};
|
|
169
|
+
//# sourceMappingURL=node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.js","sourceRoot":"","sources":["../../../../src/sentry/node.ts"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;AAEF,uDAAiE;AACjE,uCAOsB;AAItB,mCAAqD;AAIrD,mBAAmB;AACnB,qCAAwD;AAA/C,8FAAA,MAAM,OAAA;AAAE,+FAAA,OAAO,OAAA;AAAE,+FAAA,OAAO,OAAA;AAEjC;;;;;GAKG;AACI,MAAM,IAAI,GAAG,CAAC,OAAoB,EAAE,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CAAC,CAAC,WAAW,EAAmB,CAAC;AACxD,CAAC,CAAC;AAEF,MAAM,mBAAmB,GAAG,CAAC,QAAgB,EAAE,EAAE;IAC/C,kEAAkE;IAClE,0GAA0G;IAC1G,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAC;IACvD,IAAI,KAAK,EAAE;QACT,MAAM,CAAC,EAAE,QAAQ,CAAC,GAAG,KAAK,CAAC;QAC3B,OAAO,QAAQ,CAAC;KACjB;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.test.d.ts","sourceRoot":"","sources":["../../../../src/sentry/node.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
//
|
|
3
|
+
// Copyright 2022 DXOS.org
|
|
4
|
+
//
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
+
__setModuleDefault(result, mod);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
28
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
29
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
30
|
+
};
|
|
31
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
+
const chai_1 = require("chai");
|
|
33
|
+
const wait_for_expect_1 = __importDefault(require("wait-for-expect"));
|
|
34
|
+
const test_1 = require("@dxos/test");
|
|
35
|
+
const Sentry = __importStar(require("./node"));
|
|
36
|
+
const testing_1 = require("../testing");
|
|
37
|
+
const { testkit, sentryTransport } = (0, testing_1.sentryTestkit)();
|
|
38
|
+
// TODO(burdon): https://example.com?
|
|
39
|
+
const MOCK_DESTINATION = 'https://acacaeaccacacacabcaacdacdacadaca@sentry.io/000001';
|
|
40
|
+
(0, test_1.describe)('Node error reporting', () => {
|
|
41
|
+
(0, test_1.beforeAll)(() => {
|
|
42
|
+
Sentry.init({
|
|
43
|
+
destination: MOCK_DESTINATION,
|
|
44
|
+
release: 'test',
|
|
45
|
+
transport: sentryTransport,
|
|
46
|
+
scrubFilenames: true,
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
(0, test_1.beforeEach)(() => {
|
|
50
|
+
testkit.reset();
|
|
51
|
+
});
|
|
52
|
+
(0, test_1.test)('should scrub stacktraces', async () => {
|
|
53
|
+
var _a, _b;
|
|
54
|
+
const err = new Error('error to look for');
|
|
55
|
+
Sentry.captureException(err);
|
|
56
|
+
await (0, wait_for_expect_1.default)(() => {
|
|
57
|
+
(0, chai_1.expect)(testkit.reports()).to.be.lengthOf(1);
|
|
58
|
+
});
|
|
59
|
+
const report = testkit.findReport(err);
|
|
60
|
+
(_b = ((_a = report === null || report === void 0 ? void 0 : report.error) === null || _a === void 0 ? void 0 : _a.stacktrace).frames) === null || _b === void 0 ? void 0 : _b.forEach((frame) => {
|
|
61
|
+
var _a;
|
|
62
|
+
(0, chai_1.expect)((_a = frame.filename) === null || _a === void 0 ? void 0 : _a.includes('/')).to.be.false;
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
//# sourceMappingURL=node.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.test.js","sourceRoot":"","sources":["../../../../src/sentry/node.test.ts"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKF,+BAA8B;AAC9B,sEAA4C;AAE5C,qCAAmE;AAEnE,+CAAiC;AACjC,wCAA2C;AAE3C,MAAM,EAAE,OAAO,EAAE,eAAe,EAAE,GAAG,IAAA,uBAAa,GAAE,CAAC;AAErD,qCAAqC;AACrC,MAAM,gBAAgB,GAAG,2DAA2D,CAAC;AAErF,IAAA,eAAQ,EAAC,sBAAsB,EAAE,GAAG,EAAE;IACpC,IAAA,gBAAS,EAAC,GAAG,EAAE;QACb,MAAM,CAAC,IAAI,CAAC;YACV,WAAW,EAAE,gBAAgB;YAC7B,OAAO,EAAE,MAAM;YACf,SAAS,EAAE,eAAe;YAC1B,cAAc,EAAE,IAAI;SACrB,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,IAAA,iBAAU,EAAC,GAAG,EAAE;QACd,OAAO,CAAC,KAAK,EAAE,CAAC;IAClB,CAAC,CAAC,CAAC;IAEH,IAAA,WAAI,EAAC,0BAA0B,EAAE,KAAK,IAAI,EAAE;;QAC1C,MAAM,GAAG,GAAG,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;QAC3C,MAAM,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC;QAC7B,MAAM,IAAA,yBAAa,EAAC,GAAG,EAAE;YACvB,IAAA,aAAM,EAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QAC9C,CAAC,CAAC,CAAC;QACH,MAAM,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;QACvC,MAAA,CAAC,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,KAAK,0CAAE,UAAyB,CAAA,CAAC,MAAM,0CAAE,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;;YAClE,IAAA,aAAM,EAAC,MAAA,KAAK,CAAC,QAAQ,0CAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC;QACpD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sentry.test.d.ts","sourceRoot":"","sources":["../../../../src/sentry/sentry.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
//
|
|
3
|
+
// Copyright 2022 DXOS.org
|
|
4
|
+
//
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
+
__setModuleDefault(result, mod);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
28
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
29
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
30
|
+
};
|
|
31
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
+
const chai_1 = require("chai");
|
|
33
|
+
const wait_for_expect_1 = __importDefault(require("wait-for-expect"));
|
|
34
|
+
const test_1 = require("@dxos/test");
|
|
35
|
+
const Sentry = __importStar(require("./node"));
|
|
36
|
+
const testing_1 = require("../testing");
|
|
37
|
+
const { testkit, sentryTransport } = (0, testing_1.sentryTestkit)();
|
|
38
|
+
const MOCK_DESTINATION = 'https://acacaeaccacacacabcaacdacdacadaca@sentry.io/000001';
|
|
39
|
+
(0, test_1.describe)('Error reporting', () => {
|
|
40
|
+
(0, test_1.beforeAll)(() => {
|
|
41
|
+
Sentry.init({
|
|
42
|
+
destination: MOCK_DESTINATION,
|
|
43
|
+
release: 'test',
|
|
44
|
+
transport: sentryTransport,
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
(0, test_1.beforeEach)(() => {
|
|
48
|
+
testkit.reset();
|
|
49
|
+
});
|
|
50
|
+
(0, test_1.test)('should capture errors', async () => {
|
|
51
|
+
const err = new Error('error to look for');
|
|
52
|
+
Sentry.captureException(err);
|
|
53
|
+
await (0, wait_for_expect_1.default)(() => {
|
|
54
|
+
(0, chai_1.expect)(testkit.reports()).to.be.lengthOf(1);
|
|
55
|
+
});
|
|
56
|
+
const report = testkit.findReport(err);
|
|
57
|
+
(0, chai_1.expect)(report).to.exist;
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
//# sourceMappingURL=sentry.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sentry.test.js","sourceRoot":"","sources":["../../../../src/sentry/sentry.test.ts"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEF,+BAA8B;AAC9B,sEAA4C;AAE5C,qCAAmE;AAEnE,+CAAiC;AACjC,wCAA2C;AAE3C,MAAM,EAAE,OAAO,EAAE,eAAe,EAAE,GAAG,IAAA,uBAAa,GAAE,CAAC;AAErD,MAAM,gBAAgB,GAAG,2DAA2D,CAAC;AAErF,IAAA,eAAQ,EAAC,iBAAiB,EAAE,GAAG,EAAE;IAC/B,IAAA,gBAAS,EAAC,GAAG,EAAE;QACb,MAAM,CAAC,IAAI,CAAC;YACV,WAAW,EAAE,gBAAgB;YAC7B,OAAO,EAAE,MAAM;YACf,SAAS,EAAE,eAAe;SAC3B,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,IAAA,iBAAU,EAAC,GAAG,EAAE;QACd,OAAO,CAAC,KAAK,EAAE,CAAC;IAClB,CAAC,CAAC,CAAC;IAEH,IAAA,WAAI,EAAC,uBAAuB,EAAE,KAAK,IAAI,EAAE;QACvC,MAAM,GAAG,GAAG,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;QAC3C,MAAM,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC;QAC7B,MAAM,IAAA,yBAAa,EAAC,GAAG,EAAE;YACvB,IAAA,aAAM,EAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QAC9C,CAAC,CAAC,CAAC;QACH,MAAM,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;QACvC,IAAA,aAAM,EAAC,MAAM,CAA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