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

gql-types-generator

Package Overview
Dependencies
Maintainers
1
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gql-types-generator - npm Package Compare versions

Comparing version 1.2.4 to 1.2.5

3

dist/utils/generation.d.ts

@@ -11,5 +11,6 @@ import { ParsedGQLEnumType, ParsedGQLOperation, ParsedGQLScalarType, ParsedGQLType, ParsedGQLTypeOrInterface, ParsedGQLUnionType } from '../types';

* @param {ParsedGQLTypeOrInterface} parsedType
* @param importsRequired
* @returns {string}
*/
export declare function generateGQLInterface(parsedType: ParsedGQLTypeOrInterface): string;
export declare function generateGQLInterface(parsedType: ParsedGQLTypeOrInterface, importsRequired?: boolean): string;
/**

@@ -16,0 +17,0 @@ * GQL enum => TS enum

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

* @param {ParsedGQLTypeOrInterface} parsedType
* @param importsRequired
* @returns {string}
*/
function generateGQLInterface(parsedType) {
function generateGQLInterface(parsedType, importsRequired) {
if (importsRequired === void 0) { importsRequired = false; }
var name = parsedType.name, description = parsedType.description, fields = parsedType.fields;

@@ -35,6 +37,8 @@ var _a = fields.reduce(function (acc, f) {

acc.definition += fullDefinition;
for (var _i = 0, requiredTypes_1 = requiredTypes; _i < requiredTypes_1.length; _i++) {
var type = requiredTypes_1[_i];
if (!acc.requiredTypes.includes(type)) {
acc.requiredTypes.push(type);
if (importsRequired) {
for (var _i = 0, requiredTypes_1 = requiredTypes; _i < requiredTypes_1.length; _i++) {
var type = requiredTypes_1[_i];
if (!acc.requiredTypes.includes(type)) {
acc.requiredTypes.push(type);
}
}

@@ -98,3 +102,3 @@ }

+ ("export declare interface " + operationName + " " + operationDefinition + "\n\n")
+ generateGQLInterface(variables) + '\n\n'
+ generateGQLInterface(variables, true) + '\n\n'
+ ("declare const " + operationStringName + ": string;\n")

@@ -101,0 +105,0 @@ + ("export default " + operationStringName + ";");

{
"name": "gql-types-generator",
"version": "1.2.4",
"version": "1.2.5",
"main": "dist/index.js",

@@ -5,0 +5,0 @@ "types": "dist/index.d.ts",

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