@graphql-codegen/visitor-plugin-common 5.0.0 → 5.0.1-alpha-20240220203829-dfa176e2fe9eeed869fe6c78a55f38b76b9673be
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/selection-set-processor/pre-resolve-types.js +1 -1
- package/cjs/selection-set-to-object.js +4 -1
- package/esm/selection-set-processor/pre-resolve-types.js +1 -1
- package/esm/selection-set-to-object.js +4 -1
- package/package.json +1 -1
- package/typings/selection-set-processor/base.d.cts +1 -0
- package/typings/selection-set-processor/base.d.ts +1 -0
|
@@ -71,7 +71,7 @@ class PreResolveTypesProcessor extends base_js_1.BaseSelectionSetProcessor {
|
|
|
71
71
|
useTypesSuffix: this.config.enumSuffix,
|
|
72
72
|
});
|
|
73
73
|
}
|
|
74
|
-
const name = this.config.formatNamedField(aliasedField.alias, fieldObj.type,
|
|
74
|
+
const name = this.config.formatNamedField(aliasedField.alias, fieldObj.type, aliasedField.isConditional, unsetTypes);
|
|
75
75
|
if (unsetTypes) {
|
|
76
76
|
return {
|
|
77
77
|
type: 'never',
|
|
@@ -444,7 +444,9 @@ class SelectionSetToObject {
|
|
|
444
444
|
const isConditional = (0, utils_js_1.hasConditionalDirectives)(field) || inlineFragmentConditional;
|
|
445
445
|
const isOptional = options.unsetTypes;
|
|
446
446
|
linkFields.push({
|
|
447
|
-
alias: field.alias
|
|
447
|
+
alias: field.alias
|
|
448
|
+
? this._processor.config.formatNamedField(field.alias.value, selectedFieldType, isConditional, isOptional)
|
|
449
|
+
: undefined,
|
|
448
450
|
name: this._processor.config.formatNamedField(field.name.value, selectedFieldType, isConditional, isOptional),
|
|
449
451
|
type: realSelectedFieldType.name,
|
|
450
452
|
selectionSet: this._processor.config.wrapTypeWithModifiers(selectionSetObjects.mergedTypeString.split(`\n`).join(`\n `), selectedFieldType),
|
|
@@ -465,6 +467,7 @@ class SelectionSetToObject {
|
|
|
465
467
|
...this._processor.transformAliasesPrimitiveFields(parentSchemaType, Array.from(primitiveAliasFields.values()).map(field => ({
|
|
466
468
|
alias: field.alias.value,
|
|
467
469
|
fieldName: field.name.value,
|
|
470
|
+
isConditional: (0, utils_js_1.hasConditionalDirectives)(field),
|
|
468
471
|
})), options.unsetTypes),
|
|
469
472
|
...this._processor.transformLinkFields(linkFields, options.unsetTypes),
|
|
470
473
|
].filter(Boolean);
|
|
@@ -68,7 +68,7 @@ export class PreResolveTypesProcessor extends BaseSelectionSetProcessor {
|
|
|
68
68
|
useTypesSuffix: this.config.enumSuffix,
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
|
-
const name = this.config.formatNamedField(aliasedField.alias, fieldObj.type,
|
|
71
|
+
const name = this.config.formatNamedField(aliasedField.alias, fieldObj.type, aliasedField.isConditional, unsetTypes);
|
|
72
72
|
if (unsetTypes) {
|
|
73
73
|
return {
|
|
74
74
|
type: 'never',
|
|
@@ -440,7 +440,9 @@ export class SelectionSetToObject {
|
|
|
440
440
|
const isConditional = hasConditionalDirectives(field) || inlineFragmentConditional;
|
|
441
441
|
const isOptional = options.unsetTypes;
|
|
442
442
|
linkFields.push({
|
|
443
|
-
alias: field.alias
|
|
443
|
+
alias: field.alias
|
|
444
|
+
? this._processor.config.formatNamedField(field.alias.value, selectedFieldType, isConditional, isOptional)
|
|
445
|
+
: undefined,
|
|
444
446
|
name: this._processor.config.formatNamedField(field.name.value, selectedFieldType, isConditional, isOptional),
|
|
445
447
|
type: realSelectedFieldType.name,
|
|
446
448
|
selectionSet: this._processor.config.wrapTypeWithModifiers(selectionSetObjects.mergedTypeString.split(`\n`).join(`\n `), selectedFieldType),
|
|
@@ -461,6 +463,7 @@ export class SelectionSetToObject {
|
|
|
461
463
|
...this._processor.transformAliasesPrimitiveFields(parentSchemaType, Array.from(primitiveAliasFields.values()).map(field => ({
|
|
462
464
|
alias: field.alias.value,
|
|
463
465
|
fieldName: field.name.value,
|
|
466
|
+
isConditional: hasConditionalDirectives(field),
|
|
464
467
|
})), options.unsetTypes),
|
|
465
468
|
...this._processor.transformLinkFields(linkFields, options.unsetTypes),
|
|
466
469
|
].filter(Boolean);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-codegen/visitor-plugin-common",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.1-alpha-20240220203829-dfa176e2fe9eeed869fe6c78a55f38b76b9673be",
|
|
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
|
},
|