@envelop/apollo-tracing 3.4.0-alpha-e9434aa.0 → 3.4.0-alpha-05dbec7.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.
Files changed (2) hide show
  1. package/esm/index.js +5 -9
  2. package/package.json +2 -2
package/esm/index.js CHANGED
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useApolloTracing = void 0;
4
- const core_1 = require("@envelop/core");
5
- const graphql_1 = require("graphql");
1
+ import { handleStreamOrSingleExecutionResult } from '@envelop/core';
2
+ import { responsePathAsArray } from 'graphql';
6
3
  const HR_TO_NS = 1e9;
7
4
  const NS_TO_MS = 1e6;
8
5
  function durationHrTimeToNanos(hrtime) {
@@ -19,7 +16,7 @@ const deltaFrom = (hrtime) => {
19
16
  };
20
17
  };
21
18
  const apolloTracingSymbol = Symbol('apolloTracing');
22
- const useApolloTracing = () => {
19
+ export const useApolloTracing = () => {
23
20
  return {
24
21
  onResolverCalled: ({ info, context }) => {
25
22
  const ctx = context[apolloTracingSymbol];
@@ -56,7 +53,7 @@ const useApolloTracing = () => {
56
53
  const startOffset = durationHrTimeToNanos(resolverCall.startOffset);
57
54
  const duration = resolverCall.endOffset ? durationHrTimeToNanos(resolverCall.endOffset) - startOffset : 0;
58
55
  return {
59
- path: [...(0, graphql_1.responsePathAsArray)(resolverCall.path)],
56
+ path: [...responsePathAsArray(resolverCall.path)],
60
57
  parentType: resolverCall.parentType.toString(),
61
58
  fieldName: resolverCall.fieldName,
62
59
  returnType: resolverCall.returnType.toString(),
@@ -66,7 +63,7 @@ const useApolloTracing = () => {
66
63
  }),
67
64
  },
68
65
  };
69
- return (0, core_1.handleStreamOrSingleExecutionResult)(payload, ({ result }) => {
66
+ return handleStreamOrSingleExecutionResult(payload, ({ result }) => {
70
67
  result.extensions = result.extensions || {};
71
68
  result.extensions.tracing = tracing;
72
69
  });
@@ -75,4 +72,3 @@ const useApolloTracing = () => {
75
72
  },
76
73
  };
77
74
  };
78
- exports.useApolloTracing = useApolloTracing;
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@envelop/apollo-tracing",
3
- "version": "3.4.0-alpha-e9434aa.0",
3
+ "version": "3.4.0-alpha-05dbec7.0",
4
4
  "sideEffects": false,
5
5
  "peerDependencies": {
6
- "@envelop/core": "2.4.0-alpha-e9434aa.0",
6
+ "@envelop/core": "2.4.0-alpha-05dbec7.0",
7
7
  "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0"
8
8
  },
9
9
  "dependencies": {