@graphql-yoga/plugin-apollo-inline-trace 3.10.11 → 3.10.12
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 +8 -14
- package/esm/index.js +9 -15
- package/package.json +1 -1
package/cjs/index.js
CHANGED
|
@@ -112,19 +112,12 @@ function useApolloInstrumentation(options) {
|
|
|
112
112
|
},
|
|
113
113
|
onRequest({ request }) {
|
|
114
114
|
if (options.ignoreRequest) {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
if (
|
|
118
|
-
|
|
115
|
+
// @ts-expect-error - Types are not aligned
|
|
116
|
+
return (0, graphql_yoga_1.mapMaybePromise)(options.ignoreRequest(request), shouldIgnore => {
|
|
117
|
+
if (!shouldIgnore) {
|
|
118
|
+
setNewContext(request);
|
|
119
119
|
}
|
|
120
|
-
}
|
|
121
|
-
else {
|
|
122
|
-
return res$.then(shouldIgnore => {
|
|
123
|
-
if (!shouldIgnore) {
|
|
124
|
-
setNewContext(request);
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
}
|
|
120
|
+
});
|
|
128
121
|
}
|
|
129
122
|
setNewContext(request);
|
|
130
123
|
},
|
|
@@ -171,8 +164,9 @@ function useApolloInstrumentation(options) {
|
|
|
171
164
|
if (!reqCtx)
|
|
172
165
|
return;
|
|
173
166
|
// onResultProcess will be called only once since we disallow async iterables
|
|
174
|
-
if (reqCtx.stopped)
|
|
175
|
-
|
|
167
|
+
if (reqCtx.stopped) {
|
|
168
|
+
logger.debug('Trace stopped multiple times');
|
|
169
|
+
}
|
|
176
170
|
reqCtx.stopped = true;
|
|
177
171
|
},
|
|
178
172
|
};
|
package/esm/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createGraphQLError, isAsyncIterable, } from 'graphql-yoga';
|
|
1
|
+
import { createGraphQLError, isAsyncIterable, mapMaybePromise, } from 'graphql-yoga';
|
|
2
2
|
import { google, Trace } from '@apollo/usage-reporting-protobuf';
|
|
3
3
|
import { useOnResolve } from '@envelop/on-resolve';
|
|
4
4
|
import { btoa } from '@whatwg-node/fetch';
|
|
@@ -108,19 +108,12 @@ export function useApolloInstrumentation(options) {
|
|
|
108
108
|
},
|
|
109
109
|
onRequest({ request }) {
|
|
110
110
|
if (options.ignoreRequest) {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
if (
|
|
114
|
-
|
|
111
|
+
// @ts-expect-error - Types are not aligned
|
|
112
|
+
return mapMaybePromise(options.ignoreRequest(request), shouldIgnore => {
|
|
113
|
+
if (!shouldIgnore) {
|
|
114
|
+
setNewContext(request);
|
|
115
115
|
}
|
|
116
|
-
}
|
|
117
|
-
else {
|
|
118
|
-
return res$.then(shouldIgnore => {
|
|
119
|
-
if (!shouldIgnore) {
|
|
120
|
-
setNewContext(request);
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
|
-
}
|
|
116
|
+
});
|
|
124
117
|
}
|
|
125
118
|
setNewContext(request);
|
|
126
119
|
},
|
|
@@ -167,8 +160,9 @@ export function useApolloInstrumentation(options) {
|
|
|
167
160
|
if (!reqCtx)
|
|
168
161
|
return;
|
|
169
162
|
// onResultProcess will be called only once since we disallow async iterables
|
|
170
|
-
if (reqCtx.stopped)
|
|
171
|
-
|
|
163
|
+
if (reqCtx.stopped) {
|
|
164
|
+
logger.debug('Trace stopped multiple times');
|
|
165
|
+
}
|
|
172
166
|
reqCtx.stopped = true;
|
|
173
167
|
},
|
|
174
168
|
};
|