@envelop/apollo-tracing 3.4.0-alpha-aca44e1.0 → 3.4.0-alpha-385b86b.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.
@@ -1,10 +1,8 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const core = require('@envelop/core');
6
- const graphql = require('graphql');
7
-
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");
8
6
  const HR_TO_NS = 1e9;
9
7
  const NS_TO_MS = 1e6;
10
8
  function durationHrTimeToNanos(hrtime) {
@@ -58,7 +56,7 @@ const useApolloTracing = () => {
58
56
  const startOffset = durationHrTimeToNanos(resolverCall.startOffset);
59
57
  const duration = resolverCall.endOffset ? durationHrTimeToNanos(resolverCall.endOffset) - startOffset : 0;
60
58
  return {
61
- path: [...graphql.responsePathAsArray(resolverCall.path)],
59
+ path: [...(0, graphql_1.responsePathAsArray)(resolverCall.path)],
62
60
  parentType: resolverCall.parentType.toString(),
63
61
  fieldName: resolverCall.fieldName,
64
62
  returnType: resolverCall.returnType.toString(),
@@ -68,7 +66,7 @@ const useApolloTracing = () => {
68
66
  }),
69
67
  },
70
68
  };
71
- return core.handleStreamOrSingleExecutionResult(payload, ({ result }) => {
69
+ return (0, core_1.handleStreamOrSingleExecutionResult)(payload, ({ result }) => {
72
70
  result.extensions = result.extensions || {};
73
71
  result.extensions.tracing = tracing;
74
72
  });
@@ -77,5 +75,4 @@ const useApolloTracing = () => {
77
75
  },
78
76
  };
79
77
  };
80
-
81
78
  exports.useApolloTracing = useApolloTracing;
@@ -0,0 +1 @@
1
+ {"type":"commonjs"}
@@ -1,6 +1,5 @@
1
1
  import { handleStreamOrSingleExecutionResult } from '@envelop/core';
2
2
  import { responsePathAsArray } from 'graphql';
3
-
4
3
  const HR_TO_NS = 1e9;
5
4
  const NS_TO_MS = 1e6;
6
5
  function durationHrTimeToNanos(hrtime) {
@@ -17,7 +16,7 @@ const deltaFrom = (hrtime) => {
17
16
  };
18
17
  };
19
18
  const apolloTracingSymbol = Symbol('apolloTracing');
20
- const useApolloTracing = () => {
19
+ export const useApolloTracing = () => {
21
20
  return {
22
21
  onResolverCalled: ({ info, context }) => {
23
22
  const ctx = context[apolloTracingSymbol];
@@ -73,5 +72,3 @@ const useApolloTracing = () => {
73
72
  },
74
73
  };
75
74
  };
76
-
77
- export { useApolloTracing };
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@envelop/apollo-tracing",
3
- "version": "3.4.0-alpha-aca44e1.0",
3
+ "version": "3.4.0-alpha-385b86b.0",
4
4
  "sideEffects": false,
5
5
  "peerDependencies": {
6
- "@envelop/core": "2.4.0-alpha-aca44e1.0",
6
+ "@envelop/core": "2.4.0-alpha-385b86b.0",
7
7
  "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0"
8
8
  },
9
9
  "dependencies": {
@@ -11,26 +11,47 @@
11
11
  },
12
12
  "repository": {
13
13
  "type": "git",
14
- "url": "https://github.com/dotansimha/envelop.git",
14
+ "url": "https://github.com/n1ru4l/envelop.git",
15
15
  "directory": "packages/plugins/apollo-tracing"
16
16
  },
17
17
  "author": "Dotan Simha <dotansimha@gmail.com>",
18
18
  "license": "MIT",
19
- "main": "index.js",
20
- "module": "index.mjs",
21
- "typings": "index.d.ts",
19
+ "main": "cjs/index.js",
20
+ "module": "esm/index.js",
21
+ "typings": "typings/index.d.ts",
22
22
  "typescript": {
23
- "definition": "index.d.ts"
23
+ "definition": "typings/index.d.ts"
24
24
  },
25
+ "type": "module",
25
26
  "exports": {
26
27
  ".": {
27
- "require": "./index.js",
28
- "import": "./index.mjs"
28
+ "require": {
29
+ "types": "./typings/index.d.ts",
30
+ "default": "./cjs/index.js"
31
+ },
32
+ "import": {
33
+ "types": "./typings/index.d.ts",
34
+ "default": "./esm/index.js"
35
+ },
36
+ "default": {
37
+ "types": "./typings/index.d.ts",
38
+ "default": "./esm/index.js"
39
+ }
29
40
  },
30
41
  "./*": {
31
- "require": "./*.js",
32
- "import": "./*.mjs"
42
+ "require": {
43
+ "types": "./typings/*.d.ts",
44
+ "default": "./cjs/*.js"
45
+ },
46
+ "import": {
47
+ "types": "./typings/*.d.ts",
48
+ "default": "./esm/*.js"
49
+ },
50
+ "default": {
51
+ "types": "./typings/*.d.ts",
52
+ "default": "./esm/*.js"
53
+ }
33
54
  },
34
55
  "./package.json": "./package.json"
35
56
  }
36
- }
57
+ }
File without changes
package/README.md DELETED
@@ -1,33 +0,0 @@
1
- ## `@envelop/apollo-tracing`
2
-
3
- This plugin tracks execution and resolvers and reports it using [`apollo-tracing`](https://github.com/apollographql/apollo-server/tree/main/packages/apollo-tracing) format (based on GraphQL `extensions`).
4
-
5
- You can see the results of the collected metrics if you are using [GraphQL Playground](https://github.com/graphql/graphql-playground).
6
-
7
- This is how it looks like (note the `TRACING` section):
8
-
9
- ![Example](./example.png)
10
-
11
- ## Getting Started
12
-
13
- ```
14
- yarn add @envelop/apollo-tracing
15
- ```
16
-
17
- ## Usage Example
18
-
19
- ```ts
20
- import { envelop } from '@envelop/core';
21
- import { useApolloTracing } from '@envelop/apollo-tracing';
22
-
23
- const getEnveloped = envelop({
24
- plugins: [
25
- // ... other plugins ...
26
- useApolloTracing(),
27
- ],
28
- });
29
- ```
30
-
31
- ## Notes
32
-
33
- It's recommended to keep this plugin active only while developing only, since it's mainly used for performance tracking while developing.