@envelop/sentry 3.7.1-alpha-20220824165935-4720f031 → 3.8.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/README.md +0 -5
- package/cjs/index.js +3 -5
- package/esm/index.js +4 -6
- package/package.json +5 -3
- package/typings/index.d.cts +1 -1
- package/typings/index.d.ts +1 -1
package/README.md
CHANGED
|
@@ -30,17 +30,12 @@ yarn add @sentry/node @sentry/tracing @envelop/sentry
|
|
|
30
30
|
## Usage Example
|
|
31
31
|
|
|
32
32
|
```ts
|
|
33
|
-
import { parse, validate, execute, subscribe } from 'graphql'
|
|
34
33
|
import { envelop } from '@envelop/core'
|
|
35
34
|
import { useSentry } from '@envelop/sentry'
|
|
36
35
|
// do this only once in you entry file.
|
|
37
36
|
import '@sentry/tracing'
|
|
38
37
|
|
|
39
38
|
const getEnveloped = envelop({
|
|
40
|
-
parse,
|
|
41
|
-
validate,
|
|
42
|
-
execute,
|
|
43
|
-
subscribe,
|
|
44
39
|
plugins: [
|
|
45
40
|
// ... other plugins ...
|
|
46
41
|
useSentry({
|
package/cjs/index.js
CHANGED
|
@@ -6,7 +6,7 @@ const core_1 = require("@envelop/core");
|
|
|
6
6
|
const Sentry = tslib_1.__importStar(require("@sentry/node"));
|
|
7
7
|
const graphql_1 = require("graphql");
|
|
8
8
|
function defaultSkipError(error) {
|
|
9
|
-
return error instanceof
|
|
9
|
+
return error instanceof core_1.EnvelopError;
|
|
10
10
|
}
|
|
11
11
|
exports.defaultSkipError = defaultSkipError;
|
|
12
12
|
const sentryTracingSymbol = Symbol('sentryTracing');
|
|
@@ -78,9 +78,7 @@ const useSentry = (options = {}) => {
|
|
|
78
78
|
if (skipOperation(args)) {
|
|
79
79
|
return;
|
|
80
80
|
}
|
|
81
|
-
const rootOperation = args.document.definitions.find(
|
|
82
|
-
// @ts-expect-error TODO: not sure how we will make it dev friendly
|
|
83
|
-
o => o.kind === graphql_1.Kind.OPERATION_DEFINITION);
|
|
81
|
+
const rootOperation = args.document.definitions.find(o => o.kind === graphql_1.Kind.OPERATION_DEFINITION);
|
|
84
82
|
const operationType = rootOperation.operation;
|
|
85
83
|
const document = (0, graphql_1.print)(args.document);
|
|
86
84
|
const opName = args.operationName || ((_a = rootOperation.name) === null || _a === void 0 ? void 0 : _a.value) || 'Anonymous Operation';
|
|
@@ -175,7 +173,7 @@ const useSentry = (options = {}) => {
|
|
|
175
173
|
}
|
|
176
174
|
// Map index values in list to $index for better grouping of events.
|
|
177
175
|
const errorPathWithIndex = ((_b = err.path) !== null && _b !== void 0 ? _b : [])
|
|
178
|
-
.map(
|
|
176
|
+
.map(v => (typeof v === 'number' ? '$index' : v))
|
|
179
177
|
.join(' > ');
|
|
180
178
|
const eventId = Sentry.captureException(err, {
|
|
181
179
|
fingerprint: ['graphql', errorPathWithIndex, opName, operationType],
|
package/esm/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { handleStreamOrSingleExecutionResult, } from '@envelop/core';
|
|
1
|
+
import { EnvelopError, handleStreamOrSingleExecutionResult, } from '@envelop/core';
|
|
2
2
|
import * as Sentry from '@sentry/node';
|
|
3
3
|
import { GraphQLError, Kind, print, responsePathAsArray } from 'graphql';
|
|
4
4
|
export function defaultSkipError(error) {
|
|
5
|
-
return error instanceof
|
|
5
|
+
return error instanceof EnvelopError;
|
|
6
6
|
}
|
|
7
7
|
const sentryTracingSymbol = Symbol('sentryTracing');
|
|
8
8
|
export const useSentry = (options = {}) => {
|
|
@@ -73,9 +73,7 @@ export const useSentry = (options = {}) => {
|
|
|
73
73
|
if (skipOperation(args)) {
|
|
74
74
|
return;
|
|
75
75
|
}
|
|
76
|
-
const rootOperation = args.document.definitions.find(
|
|
77
|
-
// @ts-expect-error TODO: not sure how we will make it dev friendly
|
|
78
|
-
o => o.kind === Kind.OPERATION_DEFINITION);
|
|
76
|
+
const rootOperation = args.document.definitions.find(o => o.kind === Kind.OPERATION_DEFINITION);
|
|
79
77
|
const operationType = rootOperation.operation;
|
|
80
78
|
const document = print(args.document);
|
|
81
79
|
const opName = args.operationName || ((_a = rootOperation.name) === null || _a === void 0 ? void 0 : _a.value) || 'Anonymous Operation';
|
|
@@ -170,7 +168,7 @@ export const useSentry = (options = {}) => {
|
|
|
170
168
|
}
|
|
171
169
|
// Map index values in list to $index for better grouping of events.
|
|
172
170
|
const errorPathWithIndex = ((_b = err.path) !== null && _b !== void 0 ? _b : [])
|
|
173
|
-
.map(
|
|
171
|
+
.map(v => (typeof v === 'number' ? '$index' : v))
|
|
174
172
|
.join(' > ');
|
|
175
173
|
const eventId = Sentry.captureException(err, {
|
|
176
174
|
fingerprint: ['graphql', errorPathWithIndex, opName, operationType],
|
package/package.json
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@envelop/sentry",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.8.0",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"peerDependencies": {
|
|
6
|
-
"@envelop/core": "2.
|
|
6
|
+
"@envelop/core": "^2.6.0",
|
|
7
7
|
"@sentry/node": "^6 || ^7",
|
|
8
8
|
"graphql": "^14.0.0 || ^15.0.0 || ^16.0.0"
|
|
9
9
|
},
|
|
10
|
-
"dependencies": {
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"tslib": "^2.4.0"
|
|
12
|
+
},
|
|
11
13
|
"repository": {
|
|
12
14
|
"type": "git",
|
|
13
15
|
"url": "https://github.com/n1ru4l/envelop.git",
|
package/typings/index.d.cts
CHANGED
|
@@ -73,7 +73,7 @@ export declare type SentryPluginOptions = {
|
|
|
73
73
|
skip?: (args: ExecutionArgs) => boolean;
|
|
74
74
|
/**
|
|
75
75
|
* Indicates whether or not to skip Sentry exception reporting for a given error.
|
|
76
|
-
* By default, this plugin skips all `
|
|
76
|
+
* By default, this plugin skips all `EnvelopError` errors and does not report it to Sentry.
|
|
77
77
|
*/
|
|
78
78
|
skipError?: (args: Error) => boolean;
|
|
79
79
|
};
|
package/typings/index.d.ts
CHANGED
|
@@ -73,7 +73,7 @@ export declare type SentryPluginOptions = {
|
|
|
73
73
|
skip?: (args: ExecutionArgs) => boolean;
|
|
74
74
|
/**
|
|
75
75
|
* Indicates whether or not to skip Sentry exception reporting for a given error.
|
|
76
|
-
* By default, this plugin skips all `
|
|
76
|
+
* By default, this plugin skips all `EnvelopError` errors and does not report it to Sentry.
|
|
77
77
|
*/
|
|
78
78
|
skipError?: (args: Error) => boolean;
|
|
79
79
|
};
|