graphql-codegen-typescript
Advanced tools
Comparing version 0.19.0-alpha.004d58ea to 0.19.0-alpha.02a522e7
@@ -1,4 +0,5 @@ | ||
import { PluginFunction } from 'graphql-codegen-core'; | ||
import { PluginFunction } from 'graphql-codegen-plugin-helpers'; | ||
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.004d58ea", | ||
"version": "0.19.0-alpha.02a522e7", | ||
"description": "GraphQL Code Generator plugin for generating TypeScript types", | ||
@@ -8,11 +8,8 @@ "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.004d58ea", | ||
"graphql-codegen-plugin-helpers": "0.19.0-alpha.004d58ea", | ||
"graphql-codegen-visitor-plugin-common": "0.19.0-alpha.004d58ea" | ||
"graphql-codegen-plugin-helpers": "0.19.0-alpha.02a522e7", | ||
"graphql-codegen-visitor-plugin-common": "0.19.0-alpha.02a522e7" | ||
}, | ||
@@ -19,0 +16,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
23788
2
325
+ Addedgraphql-codegen-plugin-helpers@0.19.0-alpha.02a522e7(transitive)
+ Addedgraphql-codegen-visitor-plugin-common@0.19.0-alpha.02a522e7(transitive)
- Removed@babel/code-frame@7.26.2(transitive)
- Removed@babel/generator@7.26.5(transitive)
- Removed@babel/helper-string-parser@7.25.9(transitive)
- Removed@babel/helper-validator-identifier@7.25.9(transitive)
- Removed@babel/parser@7.26.5(transitive)
- Removed@babel/template@7.25.9(transitive)
- Removed@babel/traverse@7.26.5(transitive)
- Removed@babel/types@7.26.5(transitive)
- Removed@colors/colors@1.6.0(transitive)
- Removed@jridgewell/gen-mapping@0.3.8(transitive)
- Removed@jridgewell/resolve-uri@3.1.2(transitive)
- Removed@jridgewell/set-array@1.2.1(transitive)
- Removed@jridgewell/sourcemap-codec@1.5.0(transitive)
- Removed@jridgewell/trace-mapping@0.3.25(transitive)
- Removed@types/triple-beam@1.3.5(transitive)
- Removed@wry/equality@0.1.11(transitive)
- Removedaggregate-error@2.1.0(transitive)
- Removedajv@6.12.6(transitive)
- Removedansi-styles@3.2.1(transitive)
- Removedapollo-link@1.2.14(transitive)
- Removedapollo-utilities@1.3.4(transitive)
- Removedasn1@0.2.6(transitive)
- Removedassert-plus@1.0.0(transitive)
- Removedasync@2.6.4(transitive)
- Removedasynckit@0.4.0(transitive)
- Removedaws-sign2@0.7.0(transitive)
- Removedaws4@1.13.2(transitive)
- Removedbalanced-match@1.0.2(transitive)
- Removedbcrypt-pbkdf@1.0.2(transitive)
- Removedbrace-expansion@1.1.11(transitive)
- Removedbuffer-from@1.1.2(transitive)
- Removedcaseless@0.12.0(transitive)
- Removedchalk@2.4.2(transitive)
- Removedclean-stack@2.2.0(transitive)
- Removedcolor@3.2.1(transitive)
- Removedcolor-convert@1.9.3(transitive)
- Removedcolor-name@1.1.3(transitive)
- Removedcolor-string@1.9.1(transitive)
- Removedcolornames@1.1.1(transitive)
- Removedcolorspace@1.1.4(transitive)
- Removedcombined-stream@1.0.8(transitive)
- Removedconcat-map@0.0.1(transitive)
- Removedcore-util-is@1.0.2(transitive)
- Removeddashdash@1.14.1(transitive)
- Removeddebug@4.4.0(transitive)
- Removeddeepmerge@3.2.0(transitive)
- Removeddelayed-stream@1.0.0(transitive)
- Removeddeprecated-decorator@0.1.6(transitive)
- Removeddiagnostics@1.1.1(transitive)
- Removedecc-jsbn@0.1.2(transitive)
- Removedenabled@1.0.2(transitive)
- Removedenv-variable@0.0.6(transitive)
- Removedescape-string-regexp@1.0.5(transitive)
- Removedextend@3.0.2(transitive)
- Removedextsprintf@1.3.0(transitive)
- Removedfast-deep-equal@3.1.3(transitive)
- Removedfast-json-stable-stringify@2.1.0(transitive)
- Removedfecha@4.2.3(transitive)
- Removedforever-agent@0.6.1(transitive)
- Removedform-data@2.3.3(transitive)
- Removedfs.realpath@1.0.0(transitive)
- Removedgetpass@0.1.7(transitive)
- Removedglob@7.1.3(transitive)
- Removedglobals@11.12.0(transitive)
- Removedgraphql-codegen-core@0.19.0-alpha.004d58ea(transitive)
- Removedgraphql-codegen-plugin-helpers@0.19.0-alpha.004d58ea(transitive)
- Removedgraphql-codegen-visitor-plugin-common@0.19.0-alpha.004d58ea(transitive)
- Removedgraphql-import@0.7.1(transitive)
- Removedgraphql-tag-pluck@0.6.0(transitive)
- Removedgraphql-toolkit@0.2.0(transitive)
- Removedgraphql-tools@4.0.4(transitive)
- Removedhar-schema@2.0.0(transitive)
- Removedhar-validator@5.1.5(transitive)
- Removedhas-flag@3.0.0(transitive)
- Removedhttp-signature@1.2.0(transitive)
- Removedindent-string@3.2.0(transitive)
- Removedinflight@1.0.6(transitive)
- Removedinherits@2.0.4(transitive)
- Removedis-arrayish@0.3.2(transitive)
- Removedis-extglob@1.0.02.1.1(transitive)
- Removedis-glob@2.0.14.0.0(transitive)
- Removedis-invalid-path@0.1.0(transitive)
- Removedis-stream@1.1.0(transitive)
- Removedis-typedarray@1.0.0(transitive)
- Removedis-valid-path@0.1.1(transitive)
- Removedisstream@0.1.2(transitive)
- Removedjs-tokens@4.0.0(transitive)
- Removedjsbn@0.1.1(transitive)
- Removedjsesc@3.1.0(transitive)
- Removedjson-schema@0.4.0(transitive)
- Removedjson-schema-traverse@0.4.1(transitive)
- Removedjson-stringify-safe@5.0.1(transitive)
- Removedjsprim@1.4.2(transitive)
- Removedkuler@1.0.1(transitive)
- Removedlodash@4.17.114.17.21(transitive)
- Removedlogform@2.7.0(transitive)
- Removedmime-db@1.52.0(transitive)
- Removedmime-types@2.1.35(transitive)
- Removedminimatch@3.1.2(transitive)
- Removedms@2.1.3(transitive)
- Removedoauth-sign@0.9.0(transitive)
- Removedonce@1.4.0(transitive)
- Removedone-time@0.0.4(transitive)
- Removedpath-is-absolute@1.0.1(transitive)
- Removedperformance-now@2.1.0(transitive)
- Removedpicocolors@1.1.1(transitive)
- Removedpsl@1.15.0(transitive)
- Removedpunycode@1.4.12.3.1(transitive)
- Removedqs@6.5.3(transitive)
- Removedreadable-stream@3.6.2(transitive)
- Removedrequest@2.88.0(transitive)
- Removedresolve-from@4.0.0(transitive)
- Removedsafe-buffer@5.2.1(transitive)
- Removedsafe-stable-stringify@2.5.0(transitive)
- Removedsafer-buffer@2.1.2(transitive)
- Removedsimple-swizzle@0.2.2(transitive)
- Removedsource-map@0.6.1(transitive)
- Removedsource-map-support@0.5.21(transitive)
- Removedsshpk@1.18.0(transitive)
- Removedstack-trace@0.0.10(transitive)
- Removedstring_decoder@1.3.0(transitive)
- Removedsupports-color@5.5.0(transitive)
- Removedtext-hex@1.0.0(transitive)
- Removedtough-cookie@2.4.3(transitive)
- Removedtriple-beam@1.4.1(transitive)
- Removedts-invariant@0.4.4(transitive)
- Removedtslib@1.14.1(transitive)
- Removedtunnel-agent@0.6.0(transitive)
- Removedtweetnacl@0.14.5(transitive)
- Removedtypescript@3.9.10(transitive)
- Removeduri-js@4.4.1(transitive)
- Removedutil-deprecate@1.0.2(transitive)
- Removeduuid@3.4.0(transitive)
- Removedvalid-url@1.0.9(transitive)
- Removedverror@1.10.0(transitive)
- Removedwinston@3.2.1(transitive)
- Removedwinston-transport@4.9.0(transitive)
- Removedwrappy@1.0.2(transitive)
- Removedzen-observable@0.8.15(transitive)
- Removedzen-observable-ts@0.8.21(transitive)
Updatedgraphql-codegen-visitor-plugin-common@0.19.0-alpha.02a522e7