graphql-codegen-typescript
Advanced tools
Comparing version 0.19.0-alpha.80bb6e0c to 0.19.0-alpha.813c8d3c
import { PluginFunction } from 'graphql-codegen-core'; | ||
import { RawTypesConfig } from 'graphql-codegen-visitor-plugin-common'; | ||
export * from './typescript-variables-to-object'; | ||
export * from './visitor'; | ||
export interface TypeScriptPluginConfig extends RawTypesConfig { | ||
@@ -5,0 +6,0 @@ avoidOptionals?: boolean; |
@@ -10,2 +10,3 @@ "use strict"; | ||
__export(require("./typescript-variables-to-object")); | ||
__export(require("./visitor")); | ||
exports.plugin = function (schema, documents, config) { | ||
@@ -12,0 +13,0 @@ var visitor = new visitor_1.TsVisitor(config); |
@@ -11,4 +11,4 @@ import { BaseTypesVisitor, ParsedTypesConfig } from 'graphql-codegen-visitor-plugin-common'; | ||
} | ||
export declare class TsVisitor extends BaseTypesVisitor<TypeScriptPluginConfig, TypeScriptPluginParsedConfig> { | ||
constructor(pluginConfig?: TypeScriptPluginConfig); | ||
export declare class TsVisitor<TRawConfig extends TypeScriptPluginConfig = TypeScriptPluginConfig, TParsedConfig extends TypeScriptPluginParsedConfig = TypeScriptPluginParsedConfig> extends BaseTypesVisitor<TRawConfig, TParsedConfig> { | ||
constructor(pluginConfig: TRawConfig, additionalConfig?: Partial<TParsedConfig>); | ||
private clearOptional; | ||
@@ -15,0 +15,0 @@ NamedType(node: NamedTypeNode): string; |
@@ -15,17 +15,23 @@ "use strict"; | ||
})(); | ||
var __assign = (this && this.__assign) || function () { | ||
__assign = Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var graphql_codegen_visitor_plugin_common_1 = require("graphql-codegen-visitor-plugin-common"); | ||
var autoBind = require("auto-bind"); | ||
var graphql_1 = require("graphql"); | ||
var typescript_variables_to_object_1 = require("./typescript-variables-to-object"); | ||
var TsVisitor = /** @class */ (function (_super) { | ||
__extends(TsVisitor, _super); | ||
function TsVisitor(pluginConfig) { | ||
if (pluginConfig === void 0) { pluginConfig = {}; } | ||
var _this = _super.call(this, pluginConfig, { | ||
avoidOptionals: pluginConfig.avoidOptionals || false, | ||
maybeValue: pluginConfig.maybeValue || 'T | null', | ||
constEnums: pluginConfig.constEnums || false, | ||
enumsAsTypes: pluginConfig.enumsAsTypes || false, | ||
immutableTypes: pluginConfig.immutableTypes || false | ||
}, null) || this; | ||
function TsVisitor(pluginConfig, additionalConfig) { | ||
if (additionalConfig === void 0) { additionalConfig = {}; } | ||
var _this = _super.call(this, pluginConfig, __assign({ avoidOptionals: pluginConfig.avoidOptionals || false, maybeValue: pluginConfig.maybeValue || 'T | null', constEnums: pluginConfig.constEnums || false, enumsAsTypes: pluginConfig.enumsAsTypes || false, immutableTypes: pluginConfig.immutableTypes || false }, (additionalConfig || {})), null) || this; | ||
autoBind(_this); | ||
@@ -60,3 +66,3 @@ _this.setArgumentsTransformer(new typescript_variables_to_object_1.TypeScriptOperationVariablesToObject(_this.scalars, _this.convertName, _this.config.avoidOptionals, _this.config.immutableTypes)); | ||
var originalFieldNode = parent[key]; | ||
var addOptionalSign = !this.config.avoidOptionals && originalFieldNode.type.kind !== 'NonNullType'; | ||
var addOptionalSign = !this.config.avoidOptionals && originalFieldNode.type.kind !== graphql_1.Kind.NON_NULL_TYPE; | ||
return graphql_codegen_visitor_plugin_common_1.indent("" + (this.config.immutableTypes ? 'readonly ' : '') + node.name + (addOptionalSign ? '?' : '') + ": " + typeString + ","); | ||
@@ -63,0 +69,0 @@ }; |
{ | ||
"name": "graphql-codegen-typescript", | ||
"version": "0.19.0-alpha.80bb6e0c", | ||
"version": "0.19.0-alpha.813c8d3c", | ||
"description": "GraphQL Code Generator plugin for generating TypeScript types", | ||
@@ -8,11 +8,9 @@ "repository": "git@github.com:dotansimha/graphql-code-generator.git", | ||
"scripts": { | ||
"prepublishOnly": "yarn build", | ||
"build": "tsc", | ||
"pretest": "yarn build", | ||
"test": "jest" | ||
}, | ||
"dependencies": { | ||
"graphql-codegen-core": "0.19.0-alpha.80bb6e0c", | ||
"graphql-codegen-plugin-helpers": "0.19.0-alpha.80bb6e0c", | ||
"graphql-codegen-visitor-plugin-common": "0.19.0-alpha.80bb6e0c" | ||
"graphql-codegen-core": "0.19.0-alpha.813c8d3c", | ||
"graphql-codegen-plugin-helpers": "0.19.0-alpha.813c8d3c", | ||
"graphql-codegen-visitor-plugin-common": "0.19.0-alpha.813c8d3c" | ||
}, | ||
@@ -19,0 +17,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
23831
295
325
+ Addedgraphql-codegen-core@0.19.0-alpha.813c8d3c(transitive)
+ Addedgraphql-codegen-plugin-helpers@0.19.0-alpha.813c8d3c(transitive)
+ Addedgraphql-codegen-visitor-plugin-common@0.19.0-alpha.813c8d3c(transitive)
- Removedgraphql-codegen-core@0.19.0-alpha.80bb6e0c(transitive)
- Removedgraphql-codegen-plugin-helpers@0.19.0-alpha.80bb6e0c(transitive)
- Removedgraphql-codegen-visitor-plugin-common@0.19.0-alpha.80bb6e0c(transitive)
Updatedgraphql-codegen-visitor-plugin-common@0.19.0-alpha.813c8d3c