@envelop/sentry 3.7.0 → 3.7.1-alpha-20220824152235-afd061e6
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/cjs/index.js +5 -3
- package/esm/index.js +6 -4
- package/package.json +2 -2
- package/typings/index.d.cts +1 -1
- package/typings/index.d.ts +1 -1
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 Error;
|
|
10
10
|
}
|
|
11
11
|
exports.defaultSkipError = defaultSkipError;
|
|
12
12
|
const sentryTracingSymbol = Symbol('sentryTracing');
|
|
@@ -78,7 +78,9 @@ const useSentry = (options = {}) => {
|
|
|
78
78
|
if (skipOperation(args)) {
|
|
79
79
|
return;
|
|
80
80
|
}
|
|
81
|
-
const rootOperation = args.document.definitions.find(
|
|
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);
|
|
82
84
|
const operationType = rootOperation.operation;
|
|
83
85
|
const document = (0, graphql_1.print)(args.document);
|
|
84
86
|
const opName = args.operationName || ((_a = rootOperation.name) === null || _a === void 0 ? void 0 : _a.value) || 'Anonymous Operation';
|
|
@@ -173,7 +175,7 @@ const useSentry = (options = {}) => {
|
|
|
173
175
|
}
|
|
174
176
|
// Map index values in list to $index for better grouping of events.
|
|
175
177
|
const errorPathWithIndex = ((_b = err.path) !== null && _b !== void 0 ? _b : [])
|
|
176
|
-
.map(v => (typeof v === 'number' ? '$index' : v))
|
|
178
|
+
.map((v) => (typeof v === 'number' ? '$index' : v))
|
|
177
179
|
.join(' > ');
|
|
178
180
|
const eventId = Sentry.captureException(err, {
|
|
179
181
|
fingerprint: ['graphql', errorPathWithIndex, opName, operationType],
|
package/esm/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { 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 Error;
|
|
6
6
|
}
|
|
7
7
|
const sentryTracingSymbol = Symbol('sentryTracing');
|
|
8
8
|
export const useSentry = (options = {}) => {
|
|
@@ -73,7 +73,9 @@ export const useSentry = (options = {}) => {
|
|
|
73
73
|
if (skipOperation(args)) {
|
|
74
74
|
return;
|
|
75
75
|
}
|
|
76
|
-
const rootOperation = args.document.definitions.find(
|
|
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);
|
|
77
79
|
const operationType = rootOperation.operation;
|
|
78
80
|
const document = print(args.document);
|
|
79
81
|
const opName = args.operationName || ((_a = rootOperation.name) === null || _a === void 0 ? void 0 : _a.value) || 'Anonymous Operation';
|
|
@@ -168,7 +170,7 @@ export const useSentry = (options = {}) => {
|
|
|
168
170
|
}
|
|
169
171
|
// Map index values in list to $index for better grouping of events.
|
|
170
172
|
const errorPathWithIndex = ((_b = err.path) !== null && _b !== void 0 ? _b : [])
|
|
171
|
-
.map(v => (typeof v === 'number' ? '$index' : v))
|
|
173
|
+
.map((v) => (typeof v === 'number' ? '$index' : v))
|
|
172
174
|
.join(' > ');
|
|
173
175
|
const eventId = Sentry.captureException(err, {
|
|
174
176
|
fingerprint: ['graphql', errorPathWithIndex, opName, operationType],
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@envelop/sentry",
|
|
3
|
-
"version": "3.7.
|
|
3
|
+
"version": "3.7.1-alpha-20220824152235-afd061e6",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"peerDependencies": {
|
|
6
|
-
"@envelop/core": "
|
|
6
|
+
"@envelop/core": "2.5.1-alpha-20220824152235-afd061e6",
|
|
7
7
|
"@sentry/node": "^6 || ^7",
|
|
8
8
|
"graphql": "^14.0.0 || ^15.0.0 || ^16.0.0"
|
|
9
9
|
},
|
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 `Error` 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 `Error` errors and does not report it to Sentry.
|
|
77
77
|
*/
|
|
78
78
|
skipError?: (args: Error) => boolean;
|
|
79
79
|
};
|