@graphql-codegen/visitor-plugin-common 7.3.0 → 7.4.0-alpha-20261020123158-58816d71cb074db5c3dcfaf8b579b44d6fe9f48e
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/convert-schema-enum-to-declaration-block-string.js +14 -0
- package/esm/convert-schema-enum-to-declaration-block-string.js +14 -0
- package/package.json +1 -1
- package/typings/convert-schema-enum-to-declaration-block-string.d.cts +1 -1
- package/typings/convert-schema-enum-to-declaration-block-string.d.ts +1 -1
|
@@ -93,6 +93,20 @@ const convertSchemaEnumToDeclarationBlockString = ({ schema, node, enumName, enu
|
|
|
93
93
|
.join(',\n')).string;
|
|
94
94
|
return [enumAsConst, typeName].join('\n');
|
|
95
95
|
}
|
|
96
|
+
if (outputType === 'native-with-string-values') {
|
|
97
|
+
// The declaration is a plain native enum; the string values union is added where the enum is used
|
|
98
|
+
return (0, exports.convertSchemaEnumToDeclarationBlockString)({
|
|
99
|
+
schema,
|
|
100
|
+
node,
|
|
101
|
+
enumName,
|
|
102
|
+
enumValues,
|
|
103
|
+
futureProofEnums,
|
|
104
|
+
ignoreEnumValuesFromSchema,
|
|
105
|
+
outputType: 'native',
|
|
106
|
+
declarationBlockConfig,
|
|
107
|
+
naming,
|
|
108
|
+
});
|
|
109
|
+
}
|
|
96
110
|
return new utils_js_1.DeclarationBlock(declarationBlockConfig)
|
|
97
111
|
.export()
|
|
98
112
|
.asKind(outputType === 'native-const' ? 'const enum' : 'enum')
|
|
@@ -90,6 +90,20 @@ export const convertSchemaEnumToDeclarationBlockString = ({ schema, node, enumNa
|
|
|
90
90
|
.join(',\n')).string;
|
|
91
91
|
return [enumAsConst, typeName].join('\n');
|
|
92
92
|
}
|
|
93
|
+
if (outputType === 'native-with-string-values') {
|
|
94
|
+
// The declaration is a plain native enum; the string values union is added where the enum is used
|
|
95
|
+
return convertSchemaEnumToDeclarationBlockString({
|
|
96
|
+
schema,
|
|
97
|
+
node,
|
|
98
|
+
enumName,
|
|
99
|
+
enumValues,
|
|
100
|
+
futureProofEnums,
|
|
101
|
+
ignoreEnumValuesFromSchema,
|
|
102
|
+
outputType: 'native',
|
|
103
|
+
declarationBlockConfig,
|
|
104
|
+
naming,
|
|
105
|
+
});
|
|
106
|
+
}
|
|
93
107
|
return new DeclarationBlock(declarationBlockConfig)
|
|
94
108
|
.export()
|
|
95
109
|
.asKind(outputType === 'native-const' ? 'const enum' : 'enum')
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-codegen/visitor-plugin-common",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.4.0-alpha-20261020123158-58816d71cb074db5c3dcfaf8b579b44d6fe9f48e",
|
|
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 || ^17.0.0"
|
|
6
6
|
},
|
|
@@ -17,7 +17,7 @@ export interface ConvertSchemaEnumToDeclarationBlockString {
|
|
|
17
17
|
useTypesSuffix?: boolean;
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
|
-
outputType: 'string-literal' | 'native-numeric' | 'const' | 'native-const' | 'native';
|
|
20
|
+
outputType: 'string-literal' | 'native-numeric' | 'const' | 'native-const' | 'native' | 'native-with-string-values';
|
|
21
21
|
declarationBlockConfig: DeclarationBlockConfig;
|
|
22
22
|
}
|
|
23
23
|
export declare const convertSchemaEnumToDeclarationBlockString: ({ schema, node, enumName, enumValues, futureProofEnums, ignoreEnumValuesFromSchema, outputType, declarationBlockConfig, naming, }: ConvertSchemaEnumToDeclarationBlockString) => string;
|
|
@@ -17,7 +17,7 @@ export interface ConvertSchemaEnumToDeclarationBlockString {
|
|
|
17
17
|
useTypesSuffix?: boolean;
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
|
-
outputType: 'string-literal' | 'native-numeric' | 'const' | 'native-const' | 'native';
|
|
20
|
+
outputType: 'string-literal' | 'native-numeric' | 'const' | 'native-const' | 'native' | 'native-with-string-values';
|
|
21
21
|
declarationBlockConfig: DeclarationBlockConfig;
|
|
22
22
|
}
|
|
23
23
|
export declare const convertSchemaEnumToDeclarationBlockString: ({ schema, node, enumName, enumValues, futureProofEnums, ignoreEnumValuesFromSchema, outputType, declarationBlockConfig, naming, }: ConvertSchemaEnumToDeclarationBlockString) => string;
|