@envelop/depth-limit 2.0.0-alpha-d0d0776.0 → 2.0.0-alpha-ccec0fc.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/README.md CHANGED
@@ -11,18 +11,18 @@ yarn add @envelop/depth-limit
11
11
  ## Usage Example
12
12
 
13
13
  ```ts
14
- import { envelop } from '@envelop/core';
15
- import { useDepthLimit } from '@envelop/depth-limit';
14
+ import { envelop } from '@envelop/core'
15
+ import { useDepthLimit } from '@envelop/depth-limit'
16
16
 
17
17
  const getEnveloped = envelop({
18
18
  plugins: [
19
19
  // ... other plugins ...
20
20
  useDepthLimit({
21
- maxDepth: 10,
21
+ maxDepth: 10
22
22
  // ignore: [ ... ] - you can set this to ignore specific fields or types
23
- }),
24
- ],
25
- });
23
+ })
24
+ ]
25
+ })
26
26
  ```
27
27
 
28
28
  ## Notes
package/cjs/index.js ADDED
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useDepthLimit = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const graphql_depth_limit_1 = tslib_1.__importDefault(require("graphql-depth-limit"));
6
+ const useDepthLimit = (config) => {
7
+ const ignore = config.ignore || [];
8
+ const checkFn = (0, graphql_depth_limit_1.default)(config.maxDepth, { ignore });
9
+ return {
10
+ onValidate({ addValidationRule }) {
11
+ addValidationRule(checkFn);
12
+ },
13
+ };
14
+ };
15
+ exports.useDepthLimit = useDepthLimit;
@@ -0,0 +1 @@
1
+ {"type":"commonjs"}
@@ -1,6 +1,5 @@
1
1
  import depthLimit from 'graphql-depth-limit';
2
-
3
- const useDepthLimit = (config) => {
2
+ export const useDepthLimit = (config) => {
4
3
  const ignore = config.ignore || [];
5
4
  const checkFn = depthLimit(config.maxDepth, { ignore });
6
5
  return {
@@ -9,5 +8,3 @@ const useDepthLimit = (config) => {
9
8
  },
10
9
  };
11
10
  };
12
-
13
- export { useDepthLimit };
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@envelop/depth-limit",
3
- "version": "2.0.0-alpha-d0d0776.0",
3
+ "version": "2.0.0-alpha-ccec0fc.0",
4
4
  "sideEffects": false,
5
5
  "peerDependencies": {
6
- "@envelop/core": "3.0.0-alpha-d0d0776.0",
7
- "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0"
6
+ "@envelop/core": "3.0.0-alpha-ccec0fc.0",
7
+ "@graphql-tools/graphql": "0.1.0-alpha-e7752ba5.0"
8
8
  },
9
9
  "dependencies": {
10
10
  "graphql-depth-limit": "^1.1.0"
@@ -16,33 +16,42 @@
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
28
  "require": {
28
- "default": "./index.js",
29
- "types": "./index.d.ts"
29
+ "types": "./typings/index.d.ts",
30
+ "default": "./cjs/index.js"
30
31
  },
31
32
  "import": {
32
- "default": "./index.mjs",
33
- "types": "./index.d.ts"
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"
34
39
  }
35
40
  },
36
41
  "./*": {
37
42
  "require": {
38
- "default": "./*.js",
39
- "types": "./*.d.ts"
43
+ "types": "./typings/*.d.ts",
44
+ "default": "./cjs/*.js"
40
45
  },
41
46
  "import": {
42
- "default": "./*.mjs",
43
- "types": "./*.d.ts"
47
+ "types": "./typings/*.d.ts",
48
+ "default": "./esm/*.js"
49
+ },
50
+ "default": {
51
+ "types": "./typings/*.d.ts",
52
+ "default": "./esm/*.js"
44
53
  }
45
54
  },
46
55
  "./package.json": "./package.json"
47
56
  }
48
- }
57
+ }
File without changes
package/index.js DELETED
@@ -1,21 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const depthLimit = require('graphql-depth-limit');
6
-
7
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
-
9
- const depthLimit__default = /*#__PURE__*/_interopDefaultLegacy(depthLimit);
10
-
11
- const useDepthLimit = (config) => {
12
- const ignore = config.ignore || [];
13
- const checkFn = depthLimit__default["default"](config.maxDepth, { ignore });
14
- return {
15
- onValidate({ addValidationRule }) {
16
- addValidationRule(checkFn);
17
- },
18
- };
19
- };
20
-
21
- exports.useDepthLimit = useDepthLimit;