@graphql-codegen/visitor-plugin-common 5.7.1-alpha-20250221120941-a01a9a425c7b5284592b7e1cfdf2cb663fa9e736 → 5.7.1-alpha-20250221122145-5ef68e775c396313780244f87714d33191a46522
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.
|
@@ -411,9 +411,13 @@ class SelectionSetToObject {
|
|
|
411
411
|
}
|
|
412
412
|
continue;
|
|
413
413
|
}
|
|
414
|
-
// 2. Handle Fragment
|
|
415
|
-
//
|
|
416
|
-
//
|
|
414
|
+
// 2. Handle Fragment Spread nodes
|
|
415
|
+
// A Fragment Spread can be:
|
|
416
|
+
// - masked: the fields declared in the Fragment do not appear in the operation types
|
|
417
|
+
// - inline: the fields declared in the Fragment appear in the operation types
|
|
418
|
+
// 2a. If `inlineFragmentTypes` is 'combine' or 'mask', the Fragment Spread is masked by default
|
|
419
|
+
// In some cases, a masked node could be unmasked (i.e. treated as inline):
|
|
420
|
+
// - Fragment spread node is marked with Apollo `@unmask`, e.g. `...User @unmask`
|
|
417
421
|
if (this._config.inlineFragmentTypes === 'combine' || this._config.inlineFragmentTypes === 'mask') {
|
|
418
422
|
let isMasked = true;
|
|
419
423
|
if (this._config.customDirectives.apolloUnmask &&
|
|
@@ -425,7 +429,7 @@ class SelectionSetToObject {
|
|
|
425
429
|
continue;
|
|
426
430
|
}
|
|
427
431
|
}
|
|
428
|
-
// 2b. If the Fragment is not masked,
|
|
432
|
+
// 2b. If the Fragment Spread is not masked, generate inline types.
|
|
429
433
|
const fragmentType = this._schema.getType(selectionNode.onType);
|
|
430
434
|
if (fragmentType == null) {
|
|
431
435
|
throw new TypeError(`Unexpected error: Type ${selectionNode.onType} does not exist within schema.`);
|
|
@@ -407,9 +407,13 @@ export class SelectionSetToObject {
|
|
|
407
407
|
}
|
|
408
408
|
continue;
|
|
409
409
|
}
|
|
410
|
-
// 2. Handle Fragment
|
|
411
|
-
//
|
|
412
|
-
//
|
|
410
|
+
// 2. Handle Fragment Spread nodes
|
|
411
|
+
// A Fragment Spread can be:
|
|
412
|
+
// - masked: the fields declared in the Fragment do not appear in the operation types
|
|
413
|
+
// - inline: the fields declared in the Fragment appear in the operation types
|
|
414
|
+
// 2a. If `inlineFragmentTypes` is 'combine' or 'mask', the Fragment Spread is masked by default
|
|
415
|
+
// In some cases, a masked node could be unmasked (i.e. treated as inline):
|
|
416
|
+
// - Fragment spread node is marked with Apollo `@unmask`, e.g. `...User @unmask`
|
|
413
417
|
if (this._config.inlineFragmentTypes === 'combine' || this._config.inlineFragmentTypes === 'mask') {
|
|
414
418
|
let isMasked = true;
|
|
415
419
|
if (this._config.customDirectives.apolloUnmask &&
|
|
@@ -421,7 +425,7 @@ export class SelectionSetToObject {
|
|
|
421
425
|
continue;
|
|
422
426
|
}
|
|
423
427
|
}
|
|
424
|
-
// 2b. If the Fragment is not masked,
|
|
428
|
+
// 2b. If the Fragment Spread is not masked, generate inline types.
|
|
425
429
|
const fragmentType = this._schema.getType(selectionNode.onType);
|
|
426
430
|
if (fragmentType == null) {
|
|
427
431
|
throw new TypeError(`Unexpected error: Type ${selectionNode.onType} does not exist within schema.`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-codegen/visitor-plugin-common",
|
|
3
|
-
"version": "5.7.1-alpha-
|
|
3
|
+
"version": "5.7.1-alpha-20250221122145-5ef68e775c396313780244f87714d33191a46522",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"graphql": "^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"
|
|
6
6
|
},
|