@envelop/disable-introspection 4.0.0-alpha-d0d0776.0 → 4.0.0-alpha-5b6bfa8.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 +4 -4
- package/cjs/index.js +19 -0
- package/cjs/package.json +1 -0
- package/{index.mjs → esm/index.js} +3 -6
- package/package.json +26 -16
- package/{index.d.ts → typings/index.d.ts} +1 -1
- package/index.js +0 -22
package/README.md
CHANGED
|
@@ -11,12 +11,12 @@ yarn add @envelop/disable-introspection
|
|
|
11
11
|
## Usage Example
|
|
12
12
|
|
|
13
13
|
```ts
|
|
14
|
-
import { envelop } from '@envelop/core'
|
|
15
|
-
import { useDisableIntrospection } from '@envelop/disable-introspection'
|
|
14
|
+
import { envelop } from '@envelop/core'
|
|
15
|
+
import { useDisableIntrospection } from '@envelop/disable-introspection'
|
|
16
16
|
|
|
17
17
|
const getEnveloped = envelop({
|
|
18
|
-
plugins: [useDisableIntrospection()]
|
|
19
|
-
})
|
|
18
|
+
plugins: [useDisableIntrospection()]
|
|
19
|
+
})
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
## Optional configuration
|
package/cjs/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useDisableIntrospection = void 0;
|
|
4
|
+
const graphql_1 = require("@graphql-tools/graphql");
|
|
5
|
+
const useDisableIntrospection = (options) => {
|
|
6
|
+
const disableIf = options === null || options === void 0 ? void 0 : options.disableIf;
|
|
7
|
+
return {
|
|
8
|
+
onValidate: disableIf
|
|
9
|
+
? ({ addValidationRule, context, params }) => {
|
|
10
|
+
if (disableIf({ context, params })) {
|
|
11
|
+
addValidationRule(graphql_1.NoSchemaIntrospectionCustomRule);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
: ({ addValidationRule }) => {
|
|
15
|
+
addValidationRule(graphql_1.NoSchemaIntrospectionCustomRule);
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
exports.useDisableIntrospection = useDisableIntrospection;
|
package/cjs/package.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"commonjs"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { NoSchemaIntrospectionCustomRule } from 'graphql';
|
|
2
|
-
|
|
3
|
-
const
|
|
4
|
-
const disableIf = options?.disableIf;
|
|
1
|
+
import { NoSchemaIntrospectionCustomRule } from '@graphql-tools/graphql';
|
|
2
|
+
export const useDisableIntrospection = (options) => {
|
|
3
|
+
const disableIf = options === null || options === void 0 ? void 0 : options.disableIf;
|
|
5
4
|
return {
|
|
6
5
|
onValidate: disableIf
|
|
7
6
|
? ({ addValidationRule, context, params }) => {
|
|
@@ -14,5 +13,3 @@ const useDisableIntrospection = (options) => {
|
|
|
14
13
|
},
|
|
15
14
|
};
|
|
16
15
|
};
|
|
17
|
-
|
|
18
|
-
export { useDisableIntrospection };
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@envelop/disable-introspection",
|
|
3
|
-
"version": "4.0.0-alpha-
|
|
3
|
+
"version": "4.0.0-alpha-5b6bfa8.0",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"peerDependencies": {
|
|
6
|
-
"@envelop/core": "3.0.0-alpha-
|
|
7
|
-
"graphql": "
|
|
6
|
+
"@envelop/core": "3.0.0-alpha-5b6bfa8.0",
|
|
7
|
+
"@graphql-tools/graphql": "0.1.0-alpha-33fb2950.0"
|
|
8
8
|
},
|
|
9
|
+
"dependencies": {},
|
|
9
10
|
"repository": {
|
|
10
11
|
"type": "git",
|
|
11
12
|
"url": "https://github.com/n1ru4l/envelop.git",
|
|
@@ -13,33 +14,42 @@
|
|
|
13
14
|
},
|
|
14
15
|
"author": "Dotan Simha <dotansimha@gmail.com>",
|
|
15
16
|
"license": "MIT",
|
|
16
|
-
"main": "index.js",
|
|
17
|
-
"module": "index.
|
|
18
|
-
"typings": "index.d.ts",
|
|
17
|
+
"main": "cjs/index.js",
|
|
18
|
+
"module": "esm/index.js",
|
|
19
|
+
"typings": "typings/index.d.ts",
|
|
19
20
|
"typescript": {
|
|
20
|
-
"definition": "index.d.ts"
|
|
21
|
+
"definition": "typings/index.d.ts"
|
|
21
22
|
},
|
|
23
|
+
"type": "module",
|
|
22
24
|
"exports": {
|
|
23
25
|
".": {
|
|
24
26
|
"require": {
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
+
"types": "./typings/index.d.ts",
|
|
28
|
+
"default": "./cjs/index.js"
|
|
27
29
|
},
|
|
28
30
|
"import": {
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
+
"types": "./typings/index.d.ts",
|
|
32
|
+
"default": "./esm/index.js"
|
|
33
|
+
},
|
|
34
|
+
"default": {
|
|
35
|
+
"types": "./typings/index.d.ts",
|
|
36
|
+
"default": "./esm/index.js"
|
|
31
37
|
}
|
|
32
38
|
},
|
|
33
39
|
"./*": {
|
|
34
40
|
"require": {
|
|
35
|
-
"
|
|
36
|
-
"
|
|
41
|
+
"types": "./typings/*.d.ts",
|
|
42
|
+
"default": "./cjs/*.js"
|
|
37
43
|
},
|
|
38
44
|
"import": {
|
|
39
|
-
"
|
|
40
|
-
"
|
|
45
|
+
"types": "./typings/*.d.ts",
|
|
46
|
+
"default": "./esm/*.js"
|
|
47
|
+
},
|
|
48
|
+
"default": {
|
|
49
|
+
"types": "./typings/*.d.ts",
|
|
50
|
+
"default": "./esm/*.js"
|
|
41
51
|
}
|
|
42
52
|
},
|
|
43
53
|
"./package.json": "./package.json"
|
|
44
54
|
}
|
|
45
|
-
}
|
|
55
|
+
}
|
|
@@ -5,4 +5,4 @@ export interface DisableIntrospectionOptions {
|
|
|
5
5
|
params: Parameters<NonNullable<Plugin['onValidate']>>[0]['params'];
|
|
6
6
|
}) => boolean;
|
|
7
7
|
}
|
|
8
|
-
export declare const useDisableIntrospection: (options?: DisableIntrospectionOptions
|
|
8
|
+
export declare const useDisableIntrospection: (options?: DisableIntrospectionOptions) => Plugin;
|
package/index.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
const graphql = require('graphql');
|
|
6
|
-
|
|
7
|
-
const useDisableIntrospection = (options) => {
|
|
8
|
-
const disableIf = options?.disableIf;
|
|
9
|
-
return {
|
|
10
|
-
onValidate: disableIf
|
|
11
|
-
? ({ addValidationRule, context, params }) => {
|
|
12
|
-
if (disableIf({ context, params })) {
|
|
13
|
-
addValidationRule(graphql.NoSchemaIntrospectionCustomRule);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
: ({ addValidationRule }) => {
|
|
17
|
-
addValidationRule(graphql.NoSchemaIntrospectionCustomRule);
|
|
18
|
-
},
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
exports.useDisableIntrospection = useDisableIntrospection;
|