graphql-compose-modules
Advanced tools
Comparing version 3.0.0 to 3.0.1
@@ -27,4 +27,4 @@ "use strict"; | ||
asts.forEach(function (ast) { | ||
mergedAST.name += "; " + ast.name; | ||
mergedAST.absPath += "; " + ast.absPath; | ||
mergedAST.name += "; ".concat(ast.name); | ||
mergedAST.absPath += "; ".concat(ast.absPath); | ||
// merge rootTypes | ||
@@ -44,3 +44,3 @@ Object.keys(ast.children).forEach(function (key) { | ||
} | ||
mergedRootTypeAST.absPath += "; " + rootTypeNode.absPath; | ||
mergedRootTypeAST.absPath += "; ".concat(rootTypeNode.absPath); | ||
// maybe in future namespaceConfig will be refactored | ||
@@ -69,3 +69,3 @@ // but now it just take last one | ||
// merge dirs | ||
var mergedDirNode = __assign(__assign({}, targetChild), { absPath: "merged; " + targetChild.absPath + "; " + sourceChild.absPath, children: mergeChildren(targetChild.children, sourceChild.children) }); | ||
var mergedDirNode = __assign(__assign({}, targetChild), { absPath: "merged; ".concat(targetChild.absPath, "; ").concat(sourceChild.absPath), children: mergeChildren(targetChild.children, sourceChild.children) }); | ||
if (sourceChild.namespaceConfig) { | ||
@@ -72,0 +72,0 @@ mergedDirNode.namespaceConfig = sourceChild.namespaceConfig; |
@@ -54,3 +54,3 @@ "use strict"; | ||
if (!opts.schemaComposer) { | ||
throw new Error((0, dedent_1.default)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n Provided option 'schemaComposer' should be an instance of SchemaComposer class from 'graphql-compose' package. \n Received:\n ", "\n "], ["\n Provided option 'schemaComposer' should be an instance of SchemaComposer class from 'graphql-compose' package. \n Received:\n ", "\n "])), (0, graphql_compose_1.inspect)(opts.schemaComposer))); | ||
throw new Error((0, dedent_1.default)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n Provided option 'schemaComposer' should be an instance of SchemaComposer class from 'graphql-compose' package.\n Received:\n ", "\n "], ["\n Provided option 'schemaComposer' should be an instance of SchemaComposer class from 'graphql-compose' package.\n Received:\n ", "\n "])), (0, graphql_compose_1.inspect)(opts.schemaComposer))); | ||
} | ||
@@ -84,3 +84,3 @@ sc = opts.schemaComposer; | ||
if (!/^[._a-zA-Z0-9]+$/.test(name)) { | ||
throw new Error("You provide incorrect " + (ast.kind === 'file' ? 'file' : 'directory') + " name '" + name + "', it should meet RegExp(/^[._a-zA-Z0-9]+$/) for '" + ast.absPath + "'"); | ||
throw new Error("You provide incorrect ".concat(ast.kind === 'file' ? 'file' : 'directory', " name '").concat(name, "', it should meet RegExp(/^[._a-zA-Z0-9]+$/) for '").concat(ast.absPath, "'")); | ||
} | ||
@@ -103,3 +103,3 @@ if (ast.kind === 'file') { | ||
parent.addNestedFields((_b = {}, | ||
_b[name] = __assign({ resolve: function () { return ({}); } }, fc_1), | ||
_b[name] = __assign({ resolve: function (source) { return source; } }, fc_1), | ||
_b)); | ||
@@ -119,3 +119,3 @@ var pathPrefixForChild_1 = getTypename(ast, pathPrefix, {}); | ||
if (namesArray.some(function (n) { return !n; })) { | ||
throw new Error("Field name '" + ast.name + "' contains dots in the wrong place for '" + ast.absPath + "'!"); | ||
throw new Error("Field name '".concat(ast.name, "' contains dots in the wrong place for '").concat(ast.absPath, "'!")); | ||
} | ||
@@ -130,3 +130,3 @@ typename += namesArray.reduce(function (prev, current) { | ||
if (opts.prefix) | ||
typename = "" + opts.prefix + typename; | ||
typename = "".concat(opts.prefix).concat(typename); | ||
if (opts.suffix) | ||
@@ -144,3 +144,3 @@ typename += opts.suffix; | ||
if (!(0, graphql_compose_1.isOutputTypeDefinitionString)(fc.type) && !(0, graphql_compose_1.isWrappedTypeNameString)(fc.type)) { | ||
throw new Error((0, dedent_1.default)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n You provide incorrect output type definition:\n ", "\n It must be valid TypeName or output type SDL definition:\n \n Eg.\n type Payload { me: String }\n OR\n Payload\n "], ["\n You provide incorrect output type definition:\n ", "\n It must be valid TypeName or output type SDL definition:\n \n Eg.\n type Payload { me: String }\n OR\n Payload\n "])), fc.type)); | ||
throw new Error((0, dedent_1.default)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n You provide incorrect output type definition:\n ", "\n It must be valid TypeName or output type SDL definition:\n\n Eg.\n type Payload { me: String }\n OR\n Payload\n "], ["\n You provide incorrect output type definition:\n ", "\n It must be valid TypeName or output type SDL definition:\n\n Eg.\n type Payload { me: String }\n OR\n Payload\n "])), fc.type)); | ||
} | ||
@@ -147,0 +147,0 @@ } |
@@ -111,3 +111,3 @@ "use strict"; | ||
if (result.children[filename]) { | ||
throw new Error("You have a folder and file with same name \"" + filename + "\" by the following path " + absPath + ". Please remove one of them."); | ||
throw new Error("You have a folder and file with same name \"".concat(filename, "\" by the following path ").concat(absPath, ". Please remove one of them.")); | ||
} | ||
@@ -127,3 +127,3 @@ var astDir = getAstForDir(m, absFilePath, options); | ||
else if (result.children[fileAst.name]) { | ||
throw new Error("You have a folder and file with same name \"" + fileAst.name + "\" by the following path " + absPath + ". Please remove one of them."); | ||
throw new Error("You have a folder and file with same name \"".concat(fileAst.name, "\" by the following path ").concat(absPath, ". Please remove one of them.")); | ||
} | ||
@@ -227,3 +227,3 @@ else { | ||
if (fc.resolve && typeof fc.resolve !== 'function') { | ||
throw new Error("Cannot load entrypoint config from " + absPath + ". 'resolve' property must be a function or undefined."); | ||
throw new Error("Cannot load entrypoint config from ".concat(absPath, ". 'resolve' property must be a function or undefined.")); | ||
} | ||
@@ -230,0 +230,0 @@ return fc; |
@@ -78,7 +78,7 @@ "use strict"; | ||
if (argNames.length === 0 && varNames.length > 0) { | ||
throw new Error("FieldConfig does not have any arguments. But in test you provided the following variables: " + (0, graphql_compose_1.inspect)(variables)); | ||
throw new Error("FieldConfig does not have any arguments. But in test you provided the following variables: ".concat((0, graphql_compose_1.inspect)(variables))); | ||
} | ||
varNames.forEach(function (varName) { | ||
if (!argNames.includes(varName)) { | ||
throw new Error("FieldConfig does not have '" + varName + "' argument. Available arguments: '" + argNames.join("', '") + "'."); | ||
throw new Error("FieldConfig does not have '".concat(varName, "' argument. Available arguments: '").concat(argNames.join("', '"), "'.")); | ||
} | ||
@@ -90,3 +90,3 @@ }); | ||
if (val === null || val === undefined) { | ||
throw new Error("FieldConfig has required argument '" + argName + "'. But you did not provide it in your test via variables: '" + (0, graphql_compose_1.inspect)(variables) + "'."); | ||
throw new Error("FieldConfig has required argument '".concat(argName, "'. But you did not provide it in your test via variables: '").concat((0, graphql_compose_1.inspect)(variables), "'.")); | ||
} | ||
@@ -96,8 +96,8 @@ } | ||
var queryVars = varNames | ||
.map(function (n) { return "$" + n + ": " + String(sc.Query.getFieldArgType(FIELD, n)); }) | ||
.map(function (n) { return "$".concat(n, ": ").concat(String(sc.Query.getFieldArgType(FIELD, n))); }) | ||
.join(' '); | ||
var fieldVars = varNames.map(function (n) { return n + ": $" + n; }).join(' '); | ||
var fieldVars = varNames.map(function (n) { return "".concat(n, ": $").concat(n); }).join(' '); | ||
return { | ||
queryVars: queryVars ? "(" + queryVars + ")" : '', | ||
fieldVars: fieldVars ? "(" + fieldVars + ")" : '', | ||
queryVars: queryVars ? "(".concat(queryVars, ")") : '', | ||
fieldVars: fieldVars ? "(".concat(fieldVars, ")") : '', | ||
}; | ||
@@ -136,3 +136,3 @@ } | ||
ac = _getArgsForQuery(opts.fc, opts.variables, opts.schemaComposer); | ||
return [4 /*yield*/, testOperation(__assign({ operation: "\n query " + ac.queryVars + " {\n field" + ac.fieldVars + " " + selectionSet.trim() + "\n }\n " }, restOpts))]; | ||
return [4 /*yield*/, testOperation(__assign({ operation: "\n query ".concat(ac.queryVars, " {\n field").concat(ac.fieldVars, " ").concat(selectionSet.trim(), "\n }\n ") }, restOpts))]; | ||
case 1: | ||
@@ -139,0 +139,0 @@ res = _c.sent(); |
@@ -102,3 +102,3 @@ "use strict"; | ||
} | ||
throw new Error("Cannot get fieldConfig. Node has some strange kind: " + node.kind); | ||
throw new Error("Cannot get fieldConfig. Node has some strange kind: ".concat(node.kind)); | ||
}, | ||
@@ -117,3 +117,3 @@ enumerable: false, | ||
if (!outputType) { | ||
throw new Error("FieldConfig " + this.getFieldPathDotted() + " does not have 'type' property"); | ||
throw new Error("FieldConfig ".concat(this.getFieldPathDotted(), " does not have 'type' property")); | ||
} | ||
@@ -129,3 +129,3 @@ // if the type is of any kind of TypeComposer | ||
if (!outputTC) { | ||
throw new Error("FieldConfig " + this.getFieldPathDotted() + " contains some strange value as output type"); | ||
throw new Error("FieldConfig ".concat(this.getFieldPathDotted(), " contains some strange value as output type")); | ||
} | ||
@@ -156,3 +156,3 @@ fc.type = outputTC; | ||
if (!(tc instanceof graphql_compose_1.ObjectTypeComposer)) { | ||
throw new Error("FieldConfig " + this.getFieldPathDotted() + " has non-Object output type. Use 'isOutputTypeIsObject()' before for avoiding this error."); | ||
throw new Error("FieldConfig ".concat(this.getFieldPathDotted(), " has non-Object output type. Use 'isOutputTypeIsObject()' before for avoiding this error.")); | ||
} | ||
@@ -162,3 +162,3 @@ return tc; | ||
VisitInfo.prototype.toString = function () { | ||
return "VisitInfo(" + this.getFieldPathDotted({ includeOperation: true }) + ")"; | ||
return "VisitInfo(".concat(this.getFieldPathDotted({ includeOperation: true }), ")"); | ||
}; | ||
@@ -165,0 +165,0 @@ VisitInfo.prototype.toJSON = function () { |
{ | ||
"name": "graphql-compose-modules", | ||
"license": "MIT", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "A toolkit for construction GraphQL Schema via file structure", | ||
@@ -21,24 +21,24 @@ "repository": "https://github.com/graphql-compose/graphql-compose-modules", | ||
"@types/dedent": "0.7.0", | ||
"@types/glob": "7.1.4", | ||
"@types/jest": "27.0.2", | ||
"@types/glob": "7.2.0", | ||
"@types/jest": "27.0.3", | ||
"@types/lodash.sortby": "^4.7.6", | ||
"@types/node": "16.10.8", | ||
"@typescript-eslint/eslint-plugin": "5.0.0", | ||
"@typescript-eslint/parser": "5.0.0", | ||
"apollo-server": "2.25.0", | ||
"eslint": "7.32.0", | ||
"@types/node": "17.0.0", | ||
"@typescript-eslint/eslint-plugin": "5.7.0", | ||
"@typescript-eslint/parser": "5.7.0", | ||
"apollo-server": "3.5.0", | ||
"eslint": "8.4.1", | ||
"eslint-config-prettier": "8.3.0", | ||
"eslint-plugin-prettier": "4.0.0", | ||
"graphql": "15.6.0", | ||
"graphql-compose": "9.0.3", | ||
"jest": "27.2.5", | ||
"graphql": "16.1.0", | ||
"graphql-compose": "9.0.5", | ||
"jest": "27.4.5", | ||
"jest-junit": "^13.0.0", | ||
"lodash.sortby": "^4.7.0", | ||
"prettier": "2.4.1", | ||
"prettier": "2.5.1", | ||
"rimraf": "3.0.2", | ||
"semantic-release": "17.4.7", | ||
"ts-jest": "27.0.5", | ||
"ts-node": "10.3.0", | ||
"semantic-release": "18.0.1", | ||
"ts-jest": "27.1.1", | ||
"ts-node": "10.4.0", | ||
"ts-node-dev": "1.1.8", | ||
"typescript": "4.4.4" | ||
"typescript": "4.5.4" | ||
}, | ||
@@ -45,0 +45,0 @@ "scripts": { |
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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
101368