graphql-auto-query
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -126,2 +126,3 @@ "use strict"; | ||
const name = upperFirst(field.name); | ||
const newArgsMap = { ...argsMap }; | ||
const fieldOutput = `${createSpaces((level + 1) * 2)}${field.name}${field.args.length | ||
@@ -135,4 +136,4 @@ ? [ | ||
: arg.name; | ||
const genName = this.generateArgsName(argsMap, argName); | ||
argsMap[genName] = arg.type.toString(); | ||
const genName = this.generateArgsName(newArgsMap, argName); | ||
newArgsMap[genName] = arg.type.toString(); | ||
return `${createSpaces((level + 2) * 2)}${arg.name}: $${genName}`; | ||
@@ -145,3 +146,3 @@ }) | ||
const childOutput = fields | ||
.map((field) => this.createOutputFields(field, argsMap, maxLevel, level + 1)) | ||
.map((field) => this.createOutputFields(field, newArgsMap, maxLevel, level + 1)) | ||
.filter((v) => v) | ||
@@ -155,2 +156,3 @@ .join("\n"); | ||
return ""; | ||
Object.assign(argsMap, newArgsMap); | ||
return [fieldOutput, fragmentOutput, childOutput, closingOutput] | ||
@@ -157,0 +159,0 @@ .filter((v) => v) |
@@ -123,2 +123,3 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ | ||
const name = upperFirst(field.name); | ||
const newArgsMap = { ...argsMap }; | ||
const fieldOutput = `${createSpaces((level + 1) * 2)}${field.name}${field.args.length | ||
@@ -132,4 +133,4 @@ ? [ | ||
: arg.name; | ||
const genName = this.generateArgsName(argsMap, argName); | ||
argsMap[genName] = arg.type.toString(); | ||
const genName = this.generateArgsName(newArgsMap, argName); | ||
newArgsMap[genName] = arg.type.toString(); | ||
return `${createSpaces((level + 2) * 2)}${arg.name}: $${genName}`; | ||
@@ -142,3 +143,3 @@ }) | ||
const childOutput = fields | ||
.map((field) => this.createOutputFields(field, argsMap, maxLevel, level + 1)) | ||
.map((field) => this.createOutputFields(field, newArgsMap, maxLevel, level + 1)) | ||
.filter((v) => v) | ||
@@ -152,2 +153,3 @@ .join("\n"); | ||
return ""; | ||
Object.assign(argsMap, newArgsMap); | ||
return [fieldOutput, fragmentOutput, childOutput, closingOutput] | ||
@@ -154,0 +156,0 @@ .filter((v) => v) |
{ | ||
"name": "graphql-auto-query", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"author": "SoraKumo <info@croud.jp>", | ||
@@ -5,0 +5,0 @@ "description": "Automatic generation of GraphQL queries from GraphQL schemas", |
30673
727