@graphql-mesh/plugin-rate-limit 0.0.1-alpha-d8211f7b2.0 → 0.0.1-alpha-913ba159c.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 (3) hide show
  1. package/index.js +4 -2
  2. package/index.mjs +4 -2
  3. package/package.json +3 -2
package/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
3
  const stringInterpolation = require('@graphql-mesh/string-interpolation');
4
- const graphql = require('graphql');
5
4
  const crossHelpers = require('@graphql-mesh/cross-helpers');
5
+ const utils = require('@graphql-tools/utils');
6
6
 
7
7
  function useMeshRateLimit(options) {
8
8
  const pathRateLimitDef = new Map();
@@ -43,7 +43,9 @@ function useMeshRateLimit(options) {
43
43
  timeouts.add(timeout);
44
44
  }
45
45
  if (remainingTokens === 0) {
46
- validationContext.reportError(new graphql.GraphQLError(`Rate limit of "${path}" exceeded for "${identifier}"`));
46
+ validationContext.reportError(utils.createGraphQLError(`Rate limit of "${path}" exceeded for "${identifier}"`, {
47
+ path: [fieldDef.name],
48
+ }));
47
49
  // Remove this field from the selection set
48
50
  return null;
49
51
  }
package/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { stringInterpolator } from '@graphql-mesh/string-interpolation';
2
- import { GraphQLError } from 'graphql';
3
2
  import { process } from '@graphql-mesh/cross-helpers';
3
+ import { createGraphQLError } from '@graphql-tools/utils';
4
4
 
5
5
  function useMeshRateLimit(options) {
6
6
  const pathRateLimitDef = new Map();
@@ -41,7 +41,9 @@ function useMeshRateLimit(options) {
41
41
  timeouts.add(timeout);
42
42
  }
43
43
  if (remainingTokens === 0) {
44
- validationContext.reportError(new GraphQLError(`Rate limit of "${path}" exceeded for "${identifier}"`));
44
+ validationContext.reportError(createGraphQLError(`Rate limit of "${path}" exceeded for "${identifier}"`, {
45
+ path: [fieldDef.name],
46
+ }));
45
47
  // Remove this field from the selection set
46
48
  return null;
47
49
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-mesh/plugin-rate-limit",
3
- "version": "0.0.1-alpha-d8211f7b2.0",
3
+ "version": "0.0.1-alpha-913ba159c.0",
4
4
  "sideEffects": false,
5
5
  "peerDependencies": {
6
6
  "graphql": "*"
@@ -9,7 +9,8 @@
9
9
  "@envelop/core": "^2.3.2",
10
10
  "@graphql-mesh/cross-helpers": "0.1.6",
11
11
  "@graphql-mesh/string-interpolation": "0.3.0",
12
- "@graphql-mesh/types": "0.77.0-alpha-d8211f7b2.0",
12
+ "@graphql-mesh/types": "0.77.0-alpha-913ba159c.0",
13
+ "@graphql-tools/utils": "8.8.0",
13
14
  "tslib": "^2.4.0"
14
15
  },
15
16
  "repository": {