@graphql-mesh/transform-filter-schema 1.0.0-alpha-20230524103718-9e72bdbec → 1.0.0-alpha-20230524142207-e9be9c327
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/cjs/bareFilter.js +2 -3
- package/cjs/wrapFilter.js +4 -5
- package/esm/bareFilter.js +2 -2
- package/esm/wrapFilter.js +4 -4
- package/package.json +4 -4
package/cjs/bareFilter.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
4
|
-
const minimatch_1 = tslib_1.__importDefault(require("minimatch"));
|
|
3
|
+
const minimatch_1 = require("minimatch");
|
|
5
4
|
const utils_1 = require("@graphql-tools/utils");
|
|
6
5
|
class BareFilter {
|
|
7
6
|
constructor({ config: { filters } }) {
|
|
@@ -33,7 +32,7 @@ class BareFilter {
|
|
|
33
32
|
}
|
|
34
33
|
matchInArray(rulesArray, value) {
|
|
35
34
|
for (const rule of rulesArray) {
|
|
36
|
-
const ruleMatcher = new minimatch_1.
|
|
35
|
+
const ruleMatcher = new minimatch_1.Minimatch(rule);
|
|
37
36
|
if (!ruleMatcher.match(value))
|
|
38
37
|
return null;
|
|
39
38
|
}
|
package/cjs/wrapFilter.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
4
|
-
const minimatch_1 = tslib_1.__importDefault(require("minimatch"));
|
|
3
|
+
const minimatch_1 = require("minimatch");
|
|
5
4
|
const utils_1 = require("@graphql-mesh/utils");
|
|
6
5
|
const utils_2 = require("@graphql-tools/utils");
|
|
7
6
|
const wrap_1 = require("@graphql-tools/wrap");
|
|
@@ -10,7 +9,7 @@ class WrapFilter {
|
|
|
10
9
|
this.transforms = [];
|
|
11
10
|
for (const filter of filters) {
|
|
12
11
|
const [typeName, fieldNameOrGlob, argsGlob] = filter.split('.');
|
|
13
|
-
const typeMatcher = new minimatch_1.
|
|
12
|
+
const typeMatcher = new minimatch_1.Minimatch(typeName);
|
|
14
13
|
// TODO: deprecate this in next major release as dscussed in #1605
|
|
15
14
|
if (!fieldNameOrGlob) {
|
|
16
15
|
this.transforms.push(new wrap_1.FilterTypes(type => {
|
|
@@ -23,7 +22,7 @@ class WrapFilter {
|
|
|
23
22
|
fixedFieldGlob = fieldNameOrGlob.replace('{', '').replace('}', '');
|
|
24
23
|
}
|
|
25
24
|
fixedFieldGlob = fixedFieldGlob.split(', ').join(',');
|
|
26
|
-
const globalTypeMatcher = new minimatch_1.
|
|
25
|
+
const globalTypeMatcher = new minimatch_1.Minimatch(fixedFieldGlob.trim());
|
|
27
26
|
if (typeName === 'Type') {
|
|
28
27
|
this.transforms.push(new wrap_1.FilterTypes(type => {
|
|
29
28
|
return globalTypeMatcher.match(type.name);
|
|
@@ -31,7 +30,7 @@ class WrapFilter {
|
|
|
31
30
|
continue;
|
|
32
31
|
}
|
|
33
32
|
if (argsGlob) {
|
|
34
|
-
const fieldMatcher = new minimatch_1.
|
|
33
|
+
const fieldMatcher = new minimatch_1.Minimatch(fieldNameOrGlob);
|
|
35
34
|
this.transforms.push(new wrap_1.TransformCompositeFields((fieldTypeName, fieldName, fieldConfig) => {
|
|
36
35
|
if (typeMatcher.match(fieldTypeName) && fieldMatcher.match(fieldName)) {
|
|
37
36
|
const fieldArgs = Object.entries(fieldConfig.args).reduce((args, [argName, argConfig]) => !globalTypeMatcher.match(argName) ? args : { ...args, [argName]: argConfig }, {});
|
package/esm/bareFilter.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Minimatch } from 'minimatch';
|
|
2
2
|
import { MapperKind, mapSchema } from '@graphql-tools/utils';
|
|
3
3
|
export default class BareFilter {
|
|
4
4
|
constructor({ config: { filters } }) {
|
|
@@ -30,7 +30,7 @@ export default class BareFilter {
|
|
|
30
30
|
}
|
|
31
31
|
matchInArray(rulesArray, value) {
|
|
32
32
|
for (const rule of rulesArray) {
|
|
33
|
-
const ruleMatcher = new
|
|
33
|
+
const ruleMatcher = new Minimatch(rule);
|
|
34
34
|
if (!ruleMatcher.match(value))
|
|
35
35
|
return null;
|
|
36
36
|
}
|
package/esm/wrapFilter.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Minimatch } from 'minimatch';
|
|
2
2
|
import { applyRequestTransforms, applyResultTransforms, applySchemaTransforms, } from '@graphql-mesh/utils';
|
|
3
3
|
import { MapperKind, mapSchema } from '@graphql-tools/utils';
|
|
4
4
|
import { FilterInputObjectFields, FilterInterfaceFields, FilterObjectFields, FilterRootFields, FilterTypes, TransformCompositeFields, } from '@graphql-tools/wrap';
|
|
@@ -7,7 +7,7 @@ export default class WrapFilter {
|
|
|
7
7
|
this.transforms = [];
|
|
8
8
|
for (const filter of filters) {
|
|
9
9
|
const [typeName, fieldNameOrGlob, argsGlob] = filter.split('.');
|
|
10
|
-
const typeMatcher = new
|
|
10
|
+
const typeMatcher = new Minimatch(typeName);
|
|
11
11
|
// TODO: deprecate this in next major release as dscussed in #1605
|
|
12
12
|
if (!fieldNameOrGlob) {
|
|
13
13
|
this.transforms.push(new FilterTypes(type => {
|
|
@@ -20,7 +20,7 @@ export default class WrapFilter {
|
|
|
20
20
|
fixedFieldGlob = fieldNameOrGlob.replace('{', '').replace('}', '');
|
|
21
21
|
}
|
|
22
22
|
fixedFieldGlob = fixedFieldGlob.split(', ').join(',');
|
|
23
|
-
const globalTypeMatcher = new
|
|
23
|
+
const globalTypeMatcher = new Minimatch(fixedFieldGlob.trim());
|
|
24
24
|
if (typeName === 'Type') {
|
|
25
25
|
this.transforms.push(new FilterTypes(type => {
|
|
26
26
|
return globalTypeMatcher.match(type.name);
|
|
@@ -28,7 +28,7 @@ export default class WrapFilter {
|
|
|
28
28
|
continue;
|
|
29
29
|
}
|
|
30
30
|
if (argsGlob) {
|
|
31
|
-
const fieldMatcher = new
|
|
31
|
+
const fieldMatcher = new Minimatch(fieldNameOrGlob);
|
|
32
32
|
this.transforms.push(new TransformCompositeFields((fieldTypeName, fieldName, fieldConfig) => {
|
|
33
33
|
if (typeMatcher.match(fieldTypeName) && fieldMatcher.match(fieldName)) {
|
|
34
34
|
const fieldArgs = Object.entries(fieldConfig.args).reduce((args, [argName, argConfig]) => !globalTypeMatcher.match(argName) ? args : { ...args, [argName]: argConfig }, {});
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-mesh/transform-filter-schema",
|
|
3
|
-
"version": "1.0.0-alpha-
|
|
3
|
+
"version": "1.0.0-alpha-20230524142207-e9be9c327",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"peerDependencies": {
|
|
6
|
-
"@graphql-mesh/types": "1.0.0-alpha-
|
|
7
|
-
"@graphql-mesh/utils": "1.0.0-alpha-
|
|
6
|
+
"@graphql-mesh/types": "1.0.0-alpha-20230524142207-e9be9c327",
|
|
7
|
+
"@graphql-mesh/utils": "1.0.0-alpha-20230524142207-e9be9c327",
|
|
8
8
|
"@graphql-tools/utils": "^9.2.1 || ^10.0.0",
|
|
9
9
|
"graphql": "*",
|
|
10
10
|
"tslib": "^2.4.0"
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"@graphql-tools/delegate": "^10.0.0",
|
|
14
14
|
"@graphql-tools/wrap": "^10.0.0",
|
|
15
|
-
"minimatch": "^
|
|
15
|
+
"minimatch": "^9.0.0"
|
|
16
16
|
},
|
|
17
17
|
"repository": {
|
|
18
18
|
"type": "git",
|