@graphql-tools/wrap 10.0.28 → 10.0.29-alpha-117d5221fdd40912b571f033539fcea93e434d3d
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/CHANGELOG.md +7 -0
- package/dist/index.cjs +9 -2
- package/dist/index.js +10 -3
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @graphql-tools/wrap
|
|
2
2
|
|
|
3
|
+
## 10.0.29-alpha-117d5221fdd40912b571f033539fcea93e434d3d
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`a2842ab`](https://github.com/graphql-hive/gateway/commit/a2842ab8177d08b0c6cc72fa94b4a2f05857cd57)]:
|
|
8
|
+
- @graphql-tools/delegate@10.2.11-alpha-117d5221fdd40912b571f033539fcea93e434d3d
|
|
9
|
+
|
|
3
10
|
## 10.0.28
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -1428,7 +1428,7 @@ class TransformQuery {
|
|
|
1428
1428
|
errorPathTransformer = (errorPath) => [...errorPath],
|
|
1429
1429
|
fragments = {}
|
|
1430
1430
|
}) {
|
|
1431
|
-
this.path = path;
|
|
1431
|
+
this.path = path.filter((key) => !delegate.isPrototypePollutingKey(key));
|
|
1432
1432
|
this.queryTransformer = queryTransformer;
|
|
1433
1433
|
this.resultTransformer = resultTransformer;
|
|
1434
1434
|
this.errorPathTransformer = errorPathTransformer;
|
|
@@ -2306,11 +2306,18 @@ class WrapQuery {
|
|
|
2306
2306
|
const path = [...this.path];
|
|
2307
2307
|
while (path.length > 1) {
|
|
2308
2308
|
const next = path.shift();
|
|
2309
|
+
if (delegate.isPrototypePollutingKey(next)) {
|
|
2310
|
+
throw new Error("Invalid path key");
|
|
2311
|
+
}
|
|
2309
2312
|
if (data[next]) {
|
|
2310
2313
|
data = data[next];
|
|
2311
2314
|
}
|
|
2312
2315
|
}
|
|
2313
|
-
|
|
2316
|
+
const lastKey = path[0];
|
|
2317
|
+
if (delegate.isPrototypePollutingKey(lastKey)) {
|
|
2318
|
+
throw new Error("Invalid path key");
|
|
2319
|
+
}
|
|
2320
|
+
data[lastKey] = this.extractor(data[lastKey]);
|
|
2314
2321
|
}
|
|
2315
2322
|
return {
|
|
2316
2323
|
data: rootData,
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { delegateToSchema, isExternalObject, getUnpathedErrors, getSubschema, resolveExternalValue, applySchemaTransforms, defaultMergedResolver, getTypeInfo as getTypeInfo$1 } from '@graphql-tools/delegate';
|
|
1
|
+
import { delegateToSchema, isExternalObject, getUnpathedErrors, getSubschema, resolveExternalValue, applySchemaTransforms, defaultMergedResolver, getTypeInfo as getTypeInfo$1, isPrototypePollutingKey } from '@graphql-tools/delegate';
|
|
2
2
|
import { getRootTypeMap, getResponseKeyFromInfo, memoize1, mapSchema, MapperKind, renameType, visitData, transformInputValue, getDefinedRootType, memoize2, visitResult, astFromValueUntyped, getOperationASTFromRequest, relocatedError, getArgumentValues, valueMatchesCriteria, getDirectives, pruneSchema, selectObjectFields, appendObjectFields, modifyObjectFields, removeObjectFields, mapMaybePromise, isAsyncIterable, createGraphQLError, inspect } from '@graphql-tools/utils';
|
|
3
3
|
import { GraphQLObjectType, GraphQLInterfaceType, GraphQLUnionType, isSpecifiedScalarType, isScalarType, visit, Kind, visitWithTypeInfo, isObjectType, isInterfaceType, typeFromAST, isInputType, getNamedType, TypeInfo, versionInfo, isLeafType, valueFromAST, valueFromASTUntyped, astFromValue, GraphQLNonNull, getNullableType, isListType, GraphQLList, BREAK, parse, getIntrospectionQuery, buildClientSchema } from 'graphql';
|
|
4
4
|
|
|
@@ -1426,7 +1426,7 @@ class TransformQuery {
|
|
|
1426
1426
|
errorPathTransformer = (errorPath) => [...errorPath],
|
|
1427
1427
|
fragments = {}
|
|
1428
1428
|
}) {
|
|
1429
|
-
this.path = path;
|
|
1429
|
+
this.path = path.filter((key) => !isPrototypePollutingKey(key));
|
|
1430
1430
|
this.queryTransformer = queryTransformer;
|
|
1431
1431
|
this.resultTransformer = resultTransformer;
|
|
1432
1432
|
this.errorPathTransformer = errorPathTransformer;
|
|
@@ -2304,11 +2304,18 @@ class WrapQuery {
|
|
|
2304
2304
|
const path = [...this.path];
|
|
2305
2305
|
while (path.length > 1) {
|
|
2306
2306
|
const next = path.shift();
|
|
2307
|
+
if (isPrototypePollutingKey(next)) {
|
|
2308
|
+
throw new Error("Invalid path key");
|
|
2309
|
+
}
|
|
2307
2310
|
if (data[next]) {
|
|
2308
2311
|
data = data[next];
|
|
2309
2312
|
}
|
|
2310
2313
|
}
|
|
2311
|
-
|
|
2314
|
+
const lastKey = path[0];
|
|
2315
|
+
if (isPrototypePollutingKey(lastKey)) {
|
|
2316
|
+
throw new Error("Invalid path key");
|
|
2317
|
+
}
|
|
2318
|
+
data[lastKey] = this.extractor(data[lastKey]);
|
|
2312
2319
|
}
|
|
2313
2320
|
return {
|
|
2314
2321
|
data: rootData,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-tools/wrap",
|
|
3
|
-
"version": "10.0.
|
|
3
|
+
"version": "10.0.29-alpha-117d5221fdd40912b571f033539fcea93e434d3d",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A set of utils for faster development of GraphQL tools",
|
|
6
6
|
"repository": {
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@graphql-tools/delegate": "
|
|
41
|
+
"@graphql-tools/delegate": "10.2.11-alpha-117d5221fdd40912b571f033539fcea93e434d3d",
|
|
42
42
|
"@graphql-tools/schema": "^10.0.11",
|
|
43
43
|
"@graphql-tools/utils": "^10.7.0",
|
|
44
44
|
"tslib": "^2.8.1"
|