diff --git a/packages/sdk-util/src/util.js b/packages/sdk-util/src/util.js index eda9dc6..18bb0fa 100644 --- a/packages/sdk-util/src/util.js +++ b/packages/sdk-util/src/util.js @@ -139,13 +139,11 @@ const makeQuery = (fields, ignoreFields, argValues = {}) => ` .map(x => { const subQueryStr = `${x.name} { __typename - ${x.possibleTypes - .filter(t => !ignoreFields.includes(t.name)) - .map( - t => `... on ${t.name} { + ${x.possibleTypes.filter(t => !ignoreFields.includes(t.name)).map( + t => `... on ${t.name} { ${makeQuery(t.fields, ignoreFields, argValues).trim()} }` - )} + )} }`; return subQueryStr; @@ -194,12 +192,10 @@ const formatArgs = (values, specs = {}) => { if ('String' === type) { const container = isNull(value) ? null : String(value).includes('\n') ? '"""' : '"'; - return isNull(value) - ? null - : `${container}${value - .toString() - .replace(/\\/g, '\\\\') - .replace(/"/g, '\\"')}${container}`; + return isNull(value) ? null : `${container}${value + .toString() + .replace(/\\/g, '\\\\') + .replace(/"/g, '\\"')}${container}`; } if (['DateTime', 'ID', 'HexString'].includes(type)) {