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.cab8e330 to 0.19.0-alpha.2249ff45

1

dist/index.d.ts

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

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

3

dist/typescript-variables-to-object.d.ts

@@ -5,3 +5,4 @@ import { OperationVariablesToObject, ScalarsMap, ConvertNameFn } from 'graphql-codegen-visitor-plugin-common';

private _avoidOptionals;
constructor(_scalars: ScalarsMap, _convertName: ConvertNameFn, _avoidOptionals: boolean);
private _immutableTypes;
constructor(_scalars: ScalarsMap, _convertName: ConvertNameFn, _avoidOptionals: boolean, _immutableTypes: boolean);
private clearOptional;

@@ -8,0 +9,0 @@ wrapAstTypeWithModifiers(baseType: string, typeNode: TypeNode): string;

@@ -20,5 +20,6 @@ "use strict";

__extends(TypeScriptOperationVariablesToObject, _super);
function TypeScriptOperationVariablesToObject(_scalars, _convertName, _avoidOptionals) {
function TypeScriptOperationVariablesToObject(_scalars, _convertName, _avoidOptionals, _immutableTypes) {
var _this = _super.call(this, _scalars, _convertName) || this;
_this._avoidOptionals = _avoidOptionals;
_this._immutableTypes = _immutableTypes;
return _this;

@@ -39,3 +40,3 @@ }

var innerType = this.wrapAstTypeWithModifiers(baseType, typeNode.type);
return "Maybe<Array<" + innerType + ">>";
return "Maybe<" + (this._immutableTypes ? 'ReadonlyArray' : 'Array') + "<" + innerType + ">>";
}

@@ -42,0 +43,0 @@ else {

@@ -8,2 +8,3 @@ import { BaseVisitor, ParsedConfig } from 'graphql-codegen-visitor-plugin-common';

enumsAsTypes: boolean;
immutableTypes: boolean;
maybeValue: string;

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

ListType(node: ListTypeNode): string;
protected wrapWithListType(str: string): string;
NonNullType(node: NonNullTypeNode): string;

@@ -18,0 +20,0 @@ FieldDefinition(node: FieldDefinitionNode, key?: number | string, parent?: any): string;

@@ -27,6 +27,7 @@ "use strict";

constEnums: pluginConfig.constEnums || false,
enumsAsTypes: pluginConfig.enumsAsTypes || false
enumsAsTypes: pluginConfig.enumsAsTypes || false,
immutableTypes: pluginConfig.immutableTypes || false
}, null) || this;
autoBind(_this);
_this.setArgumentsTransformer(new typescript_variables_to_object_1.TypeScriptOperationVariablesToObject(_this.scalars, _this.convertName, _this.config.avoidOptionals));
_this.setArgumentsTransformer(new typescript_variables_to_object_1.TypeScriptOperationVariablesToObject(_this.scalars, _this.convertName, _this.config.avoidOptionals, _this.config.immutableTypes));
_this.setDeclarationBlockConfig({

@@ -49,2 +50,5 @@ enumNameValueSeparator: ' ='

};
TsVisitor.prototype.wrapWithListType = function (str) {
return (this.config.immutableTypes ? 'ReadonlyArray' : 'Array') + "<" + str + ">";
};
TsVisitor.prototype.NonNullType = function (node) {

@@ -58,3 +62,3 @@ var baseValue = _super.prototype.NonNullType.call(this, node);

var addOptionalSign = !this.config.avoidOptionals && originalFieldNode.type.kind !== 'NonNullType';
return graphql_codegen_visitor_plugin_common_1.indent("" + node.name + (addOptionalSign ? '?' : '') + ": " + typeString + ",");
return graphql_codegen_visitor_plugin_common_1.indent("" + (this.config.immutableTypes ? 'readonly ' : '') + node.name + (addOptionalSign ? '?' : '') + ": " + typeString + ",");
};

@@ -61,0 +65,0 @@ TsVisitor.prototype.EnumTypeDefinition = function (node) {

{
"name": "graphql-codegen-typescript",
"version": "0.18.0-alpha.cab8e330",
"version": "0.19.0-alpha.2249ff45",
"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.cab8e330",
"graphql-codegen-plugin-helpers": "0.18.0-alpha.cab8e330",
"graphql-codegen-visitor-plugin-common": "0.18.0-alpha.cab8e330"
"graphql-codegen-core": "0.19.0-alpha.2249ff45",
"graphql-codegen-plugin-helpers": "0.19.0-alpha.2249ff45",
"graphql-codegen-visitor-plugin-common": "0.19.0-alpha.2249ff45"
},

@@ -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

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