@envelop/newrelic 4.2.0 → 4.2.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 -7
- package/esm/index.js +5 -6
- package/package.json +2 -2
- package/typings/index.d.cts +1 -2
- package/typings/index.d.ts +1 -2
package/cjs/index.js
CHANGED
|
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.useNewRelic =
|
|
26
|
+
exports.useNewRelic = void 0;
|
|
27
27
|
const core_1 = require("@envelop/core");
|
|
28
28
|
const graphql_1 = require("graphql");
|
|
29
29
|
var AttributeName;
|
|
@@ -48,12 +48,8 @@ const DEFAULT_OPTIONS = {
|
|
|
48
48
|
trackResolvers: false,
|
|
49
49
|
includeResolverArgs: false,
|
|
50
50
|
rootFieldsNaming: false,
|
|
51
|
-
skipError:
|
|
51
|
+
skipError: () => false,
|
|
52
52
|
};
|
|
53
|
-
function defaultSkipError(error) {
|
|
54
|
-
return error.originalError instanceof core_1.EnvelopError;
|
|
55
|
-
}
|
|
56
|
-
exports.defaultSkipError = defaultSkipError;
|
|
57
53
|
const useNewRelic = (rawOptions) => {
|
|
58
54
|
const options = {
|
|
59
55
|
...DEFAULT_OPTIONS,
|
|
@@ -83,7 +79,9 @@ const useNewRelic = (rawOptions) => {
|
|
|
83
79
|
const transactionNameState = instrumentationApi.agent.tracer.getTransaction().nameState;
|
|
84
80
|
const spanContext = instrumentationApi.agent.tracer.getSpanContext();
|
|
85
81
|
const delimiter = transactionNameState.delimiter;
|
|
86
|
-
const rootOperation = args.document.definitions.find(
|
|
82
|
+
const rootOperation = args.document.definitions.find(
|
|
83
|
+
// @ts-expect-error TODO: not sure how we will make it dev friendly
|
|
84
|
+
definitionNode => definitionNode.kind === graphql_1.Kind.OPERATION_DEFINITION);
|
|
87
85
|
const operationType = rootOperation.operation;
|
|
88
86
|
const document = (0, graphql_1.print)(args.document);
|
|
89
87
|
const operationName = ((_a = options.extractOperationName) === null || _a === void 0 ? void 0 : _a.call(options, args.contextValue)) ||
|
package/esm/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isAsyncIterable
|
|
1
|
+
import { isAsyncIterable } from '@envelop/core';
|
|
2
2
|
import { print, Kind } from 'graphql';
|
|
3
3
|
var AttributeName;
|
|
4
4
|
(function (AttributeName) {
|
|
@@ -22,11 +22,8 @@ const DEFAULT_OPTIONS = {
|
|
|
22
22
|
trackResolvers: false,
|
|
23
23
|
includeResolverArgs: false,
|
|
24
24
|
rootFieldsNaming: false,
|
|
25
|
-
skipError:
|
|
25
|
+
skipError: () => false,
|
|
26
26
|
};
|
|
27
|
-
export function defaultSkipError(error) {
|
|
28
|
-
return error.originalError instanceof EnvelopError;
|
|
29
|
-
}
|
|
30
27
|
export const useNewRelic = (rawOptions) => {
|
|
31
28
|
const options = {
|
|
32
29
|
...DEFAULT_OPTIONS,
|
|
@@ -57,7 +54,9 @@ export const useNewRelic = (rawOptions) => {
|
|
|
57
54
|
const transactionNameState = instrumentationApi.agent.tracer.getTransaction().nameState;
|
|
58
55
|
const spanContext = instrumentationApi.agent.tracer.getSpanContext();
|
|
59
56
|
const delimiter = transactionNameState.delimiter;
|
|
60
|
-
const rootOperation = args.document.definitions.find(
|
|
57
|
+
const rootOperation = args.document.definitions.find(
|
|
58
|
+
// @ts-expect-error TODO: not sure how we will make it dev friendly
|
|
59
|
+
definitionNode => definitionNode.kind === Kind.OPERATION_DEFINITION);
|
|
61
60
|
const operationType = rootOperation.operation;
|
|
62
61
|
const document = print(args.document);
|
|
63
62
|
const operationName = ((_a = options.extractOperationName) === null || _a === void 0 ? void 0 : _a.call(options, args.contextValue)) ||
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@envelop/newrelic",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.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
|
"newrelic": "^7 || ^8.0.0",
|
|
8
8
|
"graphql": "^14.0.0 || ^15.0.0 || ^16.0.0"
|
|
9
9
|
},
|
package/typings/index.d.cts
CHANGED
|
@@ -13,9 +13,8 @@ export declare type UseNewRelicOptions = {
|
|
|
13
13
|
extractOperationName?: (context: DefaultContext) => string | undefined;
|
|
14
14
|
/**
|
|
15
15
|
* Indicates whether or not to skip reporting a given error to NewRelic.
|
|
16
|
-
* By default, this plugin skips all `
|
|
16
|
+
* By default, this plugin skips all `Error` errors and does not report them to NewRelic.
|
|
17
17
|
*/
|
|
18
18
|
skipError?: (error: GraphQLError) => boolean;
|
|
19
19
|
};
|
|
20
|
-
export declare function defaultSkipError(error: GraphQLError): boolean;
|
|
21
20
|
export declare const useNewRelic: (rawOptions?: UseNewRelicOptions) => Plugin;
|
package/typings/index.d.ts
CHANGED
|
@@ -13,9 +13,8 @@ export declare type UseNewRelicOptions = {
|
|
|
13
13
|
extractOperationName?: (context: DefaultContext) => string | undefined;
|
|
14
14
|
/**
|
|
15
15
|
* Indicates whether or not to skip reporting a given error to NewRelic.
|
|
16
|
-
* By default, this plugin skips all `
|
|
16
|
+
* By default, this plugin skips all `Error` errors and does not report them to NewRelic.
|
|
17
17
|
*/
|
|
18
18
|
skipError?: (error: GraphQLError) => boolean;
|
|
19
19
|
};
|
|
20
|
-
export declare function defaultSkipError(error: GraphQLError): boolean;
|
|
21
20
|
export declare const useNewRelic: (rawOptions?: UseNewRelicOptions) => Plugin;
|