Skip to content

Commit a3d0612

Browse files
authored
Merge branch 'master' into alert-autofix-30
2 parents 3f9cee8 + ece7732 commit a3d0612

File tree

4 files changed

+15
-3
lines changed

4 files changed

+15
-3
lines changed

.changeset/tame-papayas-fetch.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@graphql-tools/mock': patch
3+
---
4+
5+
Prevent prototype polluting assignment

.changeset/whole-hands-smell.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@graphql-tools/utils': patch
3+
---
4+
5+
Better handling for field name handling in `buildOperationForField`

packages/mock/src/MockStore.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,9 +266,11 @@ export class MockStore implements IMockStore {
266266
if (typeName === '__proto__' || typeName === 'constructor' || typeName === 'prototype') {
267267
throw new Error(`Invalid typeName: ${typeName}`);
268268
}
269+
269270
if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
270271
throw new Error(`Invalid key: ${key}`);
271272
}
273+
272274
if (this.store[typeName] === undefined) {
273275
this.store[typeName] = {};
274276
}

packages/utils/src/build-operation-for-field.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -479,9 +479,9 @@ function resolveField({
479479
if (fieldTypeMap.has(fieldPathStr) && fieldTypeMap.get(fieldPathStr) !== field.type.toString()) {
480480
fieldName += (field.type as any)
481481
.toString()
482-
.replace('!', 'NonNull')
483-
.replace('[', 'List')
484-
.replace(']', '');
482+
.replace(/!/g, 'NonNull')
483+
.replace(/\[/g, 'List')
484+
.replace(/\]/g, '');
485485
}
486486
fieldTypeMap.set(fieldPathStr, field.type.toString());
487487

0 commit comments

Comments
 (0)