@graphql-codegen/typescript-operations 6.2.0-alpha-20261020125957-1b4072fd8d00111072bb1dc326da90528879ee91 → 6.2.0
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/ts-operation-variables-to-object.js +2 -1
- package/cjs/visitor.js +1 -1
- package/esm/ts-operation-variables-to-object.js +2 -1
- package/esm/visitor.js +1 -1
- package/package.json +2 -2
- package/typings/ts-operation-variables-to-object.d.cts +2 -2
- package/typings/ts-operation-variables-to-object.d.ts +2 -2
|
@@ -43,7 +43,8 @@ class TypeScriptOperationVariablesToObject extends visitor_plugin_common_1.Opera
|
|
|
43
43
|
const listInputCoercionExtension = applyCoercion ? ` | ${innerType}` : '';
|
|
44
44
|
return this.wrapMaybe(`${this._config.immutableTypes ? 'ReadonlyArray' : 'Array'}<${innerType}>${listInputCoercionExtension}`);
|
|
45
45
|
}
|
|
46
|
-
if (this._config.
|
|
46
|
+
if (this._config.enumType === 'native-with-string-values' &&
|
|
47
|
+
this._enumNames.includes(typeNode.name.value)) {
|
|
47
48
|
return this.wrapMaybe(`${baseType} | \`\${${baseType}}\``);
|
|
48
49
|
}
|
|
49
50
|
return this.wrapMaybe(baseType);
|
package/cjs/visitor.js
CHANGED
|
@@ -137,7 +137,7 @@ class TypeScriptDocumentsVisitor extends visitor_plugin_common_1.BaseDocumentsVi
|
|
|
137
137
|
avoidOptionals: this.config.avoidOptionals,
|
|
138
138
|
immutableTypes: this.config.immutableTypes,
|
|
139
139
|
inputMaybeValue: this.config.inputMaybeValue,
|
|
140
|
-
|
|
140
|
+
enumType: this.config.enumType,
|
|
141
141
|
}, this.scalars, this.convertName.bind(this), this.config.namespacedImportName, enumsNames, this.config.enumPrefix, this.config.enumSuffix, this.config.enumValues, this.config.arrayInputCoercion));
|
|
142
142
|
this._declarationBlockConfig = {
|
|
143
143
|
ignoreExport: this.config.noExport,
|
|
@@ -40,7 +40,8 @@ export class TypeScriptOperationVariablesToObject extends OperationVariablesToOb
|
|
|
40
40
|
const listInputCoercionExtension = applyCoercion ? ` | ${innerType}` : '';
|
|
41
41
|
return this.wrapMaybe(`${this._config.immutableTypes ? 'ReadonlyArray' : 'Array'}<${innerType}>${listInputCoercionExtension}`);
|
|
42
42
|
}
|
|
43
|
-
if (this._config.
|
|
43
|
+
if (this._config.enumType === 'native-with-string-values' &&
|
|
44
|
+
this._enumNames.includes(typeNode.name.value)) {
|
|
44
45
|
return this.wrapMaybe(`${baseType} | \`\${${baseType}}\``);
|
|
45
46
|
}
|
|
46
47
|
return this.wrapMaybe(baseType);
|
package/esm/visitor.js
CHANGED
|
@@ -133,7 +133,7 @@ export class TypeScriptDocumentsVisitor extends BaseDocumentsVisitor {
|
|
|
133
133
|
avoidOptionals: this.config.avoidOptionals,
|
|
134
134
|
immutableTypes: this.config.immutableTypes,
|
|
135
135
|
inputMaybeValue: this.config.inputMaybeValue,
|
|
136
|
-
|
|
136
|
+
enumType: this.config.enumType,
|
|
137
137
|
}, this.scalars, this.convertName.bind(this), this.config.namespacedImportName, enumsNames, this.config.enumPrefix, this.config.enumSuffix, this.config.enumValues, this.config.arrayInputCoercion));
|
|
138
138
|
this._declarationBlockConfig = {
|
|
139
139
|
ignoreExport: this.config.noExport,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-codegen/typescript-operations",
|
|
3
|
-
"version": "6.2.0
|
|
3
|
+
"version": "6.2.0",
|
|
4
4
|
"description": "GraphQL Code Generator plugin for generating TypeScript types for GraphQL queries, mutations, subscriptions and fragments",
|
|
5
5
|
"peerDependenciesMeta": {
|
|
6
6
|
"graphql-sock": {
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"@graphql-codegen/plugin-helpers": "^7.4.2",
|
|
16
16
|
"@graphql-codegen/schema-ast": "^6.1.1",
|
|
17
|
-
"@graphql-codegen/visitor-plugin-common": "^7.
|
|
17
|
+
"@graphql-codegen/visitor-plugin-common": "^7.5.0",
|
|
18
18
|
"auto-bind": "^5.0.0",
|
|
19
19
|
"tslib": "^2.8.0"
|
|
20
20
|
},
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { TypeNode } from 'graphql';
|
|
2
|
-
import { ConvertNameFn, NormalizedScalarsMap, OperationVariablesToObject, ParsedEnumValuesMap, type NormalizedOperationAvoidOptionalsConfig } from '@graphql-codegen/visitor-plugin-common';
|
|
2
|
+
import { ConvertNameFn, NormalizedScalarsMap, OperationVariablesToObject, ParsedEnumValuesMap, type ConvertSchemaEnumToDeclarationBlockString, type NormalizedOperationAvoidOptionalsConfig } from '@graphql-codegen/visitor-plugin-common';
|
|
3
3
|
export declare class TypeScriptOperationVariablesToObject extends OperationVariablesToObject {
|
|
4
4
|
private _config;
|
|
5
5
|
constructor(_config: {
|
|
6
6
|
avoidOptionals: NormalizedOperationAvoidOptionalsConfig;
|
|
7
7
|
immutableTypes: boolean;
|
|
8
8
|
inputMaybeValue: string;
|
|
9
|
-
|
|
9
|
+
enumType: ConvertSchemaEnumToDeclarationBlockString['outputType'];
|
|
10
10
|
}, _scalars: NormalizedScalarsMap, _convertName: ConvertNameFn, _namespacedImportName: string | null, _enumNames: string[], _enumPrefix: boolean, _enumSuffix: boolean, _enumValues: ParsedEnumValuesMap, _applyCoercion: boolean);
|
|
11
11
|
protected formatFieldString(fieldName: string, isNonNullType: boolean, hasDefaultValue: boolean): string;
|
|
12
12
|
protected formatTypeString(fieldType: string, _isNonNullType: boolean, _hasDefaultValue: boolean): string;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { TypeNode } from 'graphql';
|
|
2
|
-
import { ConvertNameFn, NormalizedScalarsMap, OperationVariablesToObject, ParsedEnumValuesMap, type NormalizedOperationAvoidOptionalsConfig } from '@graphql-codegen/visitor-plugin-common';
|
|
2
|
+
import { ConvertNameFn, NormalizedScalarsMap, OperationVariablesToObject, ParsedEnumValuesMap, type ConvertSchemaEnumToDeclarationBlockString, type NormalizedOperationAvoidOptionalsConfig } from '@graphql-codegen/visitor-plugin-common';
|
|
3
3
|
export declare class TypeScriptOperationVariablesToObject extends OperationVariablesToObject {
|
|
4
4
|
private _config;
|
|
5
5
|
constructor(_config: {
|
|
6
6
|
avoidOptionals: NormalizedOperationAvoidOptionalsConfig;
|
|
7
7
|
immutableTypes: boolean;
|
|
8
8
|
inputMaybeValue: string;
|
|
9
|
-
|
|
9
|
+
enumType: ConvertSchemaEnumToDeclarationBlockString['outputType'];
|
|
10
10
|
}, _scalars: NormalizedScalarsMap, _convertName: ConvertNameFn, _namespacedImportName: string | null, _enumNames: string[], _enumPrefix: boolean, _enumSuffix: boolean, _enumValues: ParsedEnumValuesMap, _applyCoercion: boolean);
|
|
11
11
|
protected formatFieldString(fieldName: string, isNonNullType: boolean, hasDefaultValue: boolean): string;
|
|
12
12
|
protected formatTypeString(fieldType: string, _isNonNullType: boolean, _hasDefaultValue: boolean): string;
|