Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

graphql-codegen-typescript

Package Overview
Dependencies
Maintainers
1
Versions
123
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphql-codegen-typescript - npm Package Compare versions

Comparing version 0.18.0-alpha.b1641564 to 0.18.0-alpha.cab8e330

2

dist/index.d.ts

@@ -6,4 +6,6 @@ import { PluginFunction } from 'graphql-codegen-core';

avoidOptionals?: boolean;
constEnums?: boolean;
enumsAsTypes?: boolean;
maybeValue?: string;
}
export declare const plugin: PluginFunction<TypeScriptPluginConfig>;

5

dist/visitor.d.ts
import { BaseVisitor, ParsedConfig } from 'graphql-codegen-visitor-plugin-common';
import { TypeScriptPluginConfig } from './index';
import { FieldDefinitionNode, NamedTypeNode, ListTypeNode, NonNullTypeNode } from 'graphql';
import { FieldDefinitionNode, NamedTypeNode, ListTypeNode, NonNullTypeNode, EnumTypeDefinitionNode } from 'graphql';
export interface TypeScriptPluginParsedConfig extends ParsedConfig {
avoidOptionals: boolean;
constEnums: boolean;
enumsAsTypes: boolean;
maybeValue: string;

@@ -15,2 +17,3 @@ }

FieldDefinition(node: FieldDefinitionNode, key?: number | string, parent?: any): string;
EnumTypeDefinition(node: EnumTypeDefinitionNode): string;
}

@@ -25,3 +25,5 @@ "use strict";

avoidOptionals: pluginConfig.avoidOptionals || false,
maybeValue: pluginConfig.maybeValue || 'T | null'
maybeValue: pluginConfig.maybeValue || 'T | null',
constEnums: pluginConfig.constEnums || false,
enumsAsTypes: pluginConfig.enumsAsTypes || false
}, null) || this;

@@ -57,2 +59,19 @@ autoBind(_this);

};
TsVisitor.prototype.EnumTypeDefinition = function (node) {
var _this = this;
if (this.config.enumsAsTypes) {
return new graphql_codegen_visitor_plugin_common_1.DeclarationBlock(this._declarationBlockConfig)
.export()
.asKind('type')
.withName(this.convertName(node.name))
.withContent(node.values.map(function (v) { return "'" + (_this.config.enumValues[v.name] || v.name) + "'"; }).join(' | ')).string;
}
else {
return new graphql_codegen_visitor_plugin_common_1.DeclarationBlock(this._declarationBlockConfig)
.export()
.asKind(this.config.constEnums ? 'const enum' : 'enum')
.withName(this.convertName(node.name))
.withBlock(this.buildEnumValuesBlock(node.values)).string;
}
};
return TsVisitor;

@@ -59,0 +78,0 @@ }(graphql_codegen_visitor_plugin_common_1.BaseVisitor));

{
"name": "graphql-codegen-typescript",
"version": "0.18.0-alpha.b1641564",
"version": "0.18.0-alpha.cab8e330",
"description": "GraphQL Code Generator plugin for generating TypeScript types",

@@ -14,5 +14,5 @@ "repository": "git@github.com:dotansimha/graphql-code-generator.git",

"dependencies": {
"graphql-codegen-core": "0.18.0-alpha.b1641564",
"graphql-codegen-plugin-helpers": "0.18.0-alpha.b1641564",
"graphql-codegen-visitor-plugin-common": "0.18.0-alpha.b1641564"
"graphql-codegen-core": "0.18.0-alpha.cab8e330",
"graphql-codegen-plugin-helpers": "0.18.0-alpha.cab8e330",
"graphql-codegen-visitor-plugin-common": "0.18.0-alpha.cab8e330"
},

@@ -19,0 +19,0 @@ "devDependencies": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc