@envelop/statsd 2.0.0-alpha-d92b4cb.0 → 2.0.0-alpha-dc1e98d.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.
package/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Plugin } from '@envelop/types';
1
+ import { Plugin } from '@envelop/core';
2
2
  import type { StatsD } from 'hot-shots';
3
3
  export interface StatsDPluginOptions {
4
4
  client: StatsD;
package/index.js CHANGED
@@ -2,22 +2,9 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ const core = require('@envelop/core');
5
6
  const graphql = require('graphql');
6
7
 
7
- /**
8
- * Returns true if the provided object implements the AsyncIterator protocol via
9
- * implementing a `Symbol.asyncIterator` method.
10
- *
11
- * Source: https://github.com/graphql/graphql-js/blob/main/src/jsutils/isAsyncIterable.ts
12
- */
13
- function isAsyncIterable(maybeAsyncIterable) {
14
- return typeof (maybeAsyncIterable === null || maybeAsyncIterable === void 0 ? void 0 : maybeAsyncIterable[Symbol.asyncIterator]) === 'function';
15
- }
16
-
17
- function isIntrospectionOperationString(operation) {
18
- return (typeof operation === 'string' ? operation : operation.body).indexOf('__schema') !== -1;
19
- }
20
-
21
8
  const metricNames = {
22
9
  operationCount: 'operations.count',
23
10
  errorCount: 'operations.error_count',
@@ -52,7 +39,7 @@ const useStatsD = (options) => {
52
39
  });
53
40
  },
54
41
  onParse({ extendContext, params }) {
55
- if (skipIntrospection && isIntrospectionOperationString(params.source)) {
42
+ if (skipIntrospection && core.isIntrospectionOperationString(params.source)) {
56
43
  return;
57
44
  }
58
45
  return function onParseDone(payload) {
@@ -91,7 +78,7 @@ const useStatsD = (options) => {
91
78
  return {
92
79
  onExecuteDone({ result }) {
93
80
  const latency = Date.now() - args.contextValue[statsDPluginExecutionStartTimeSymbol];
94
- if (isAsyncIterable(result)) {
81
+ if (core.isAsyncIterable(result)) {
95
82
  // eslint-disable-next-line no-console
96
83
  console.warn(`Plugin "statsd" encountered a AsyncIterator which is not supported yet, so tracing data is not available for the operation.`);
97
84
  return;
package/index.mjs CHANGED
@@ -1,19 +1,6 @@
1
+ import { isIntrospectionOperationString, isAsyncIterable } from '@envelop/core';
1
2
  import { Kind } from 'graphql';
2
3
 
3
- /**
4
- * Returns true if the provided object implements the AsyncIterator protocol via
5
- * implementing a `Symbol.asyncIterator` method.
6
- *
7
- * Source: https://github.com/graphql/graphql-js/blob/main/src/jsutils/isAsyncIterable.ts
8
- */
9
- function isAsyncIterable(maybeAsyncIterable) {
10
- return typeof (maybeAsyncIterable === null || maybeAsyncIterable === void 0 ? void 0 : maybeAsyncIterable[Symbol.asyncIterator]) === 'function';
11
- }
12
-
13
- function isIntrospectionOperationString(operation) {
14
- return (typeof operation === 'string' ? operation : operation.body).indexOf('__schema') !== -1;
15
- }
16
-
17
4
  const metricNames = {
18
5
  operationCount: 'operations.count',
19
6
  errorCount: 'operations.error_count',
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "@envelop/statsd",
3
- "version": "2.0.0-alpha-d92b4cb.0",
3
+ "version": "2.0.0-alpha-dc1e98d.0",
4
4
  "sideEffects": false,
5
5
  "peerDependencies": {
6
- "graphql": "^14.0.0 || ^15.0.0",
7
- "hot-shots": "^8.0.0"
6
+ "@envelop/core": "2.0.0-alpha-dc1e98d.0",
7
+ "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0",
8
+ "hot-shots": "^8.0.0 || ^9.0.0"
8
9
  },
9
10
  "repository": {
10
11
  "type": "git",
@@ -34,6 +35,7 @@
34
35
  "./*": {
35
36
  "require": "./*.js",
36
37
  "import": "./*.mjs"
37
- }
38
+ },
39
+ "./package.json": "./package.json"
38
40
  }
39
41
  }