simple-graphql
Advanced tools
Comparing version 4.0.10 to 4.0.11
@@ -44,2 +44,3 @@ "use strict"; | ||
function buildModelType(schema, fieldTypeContext, context) { | ||
var _a; | ||
const typeName = schema.name; | ||
@@ -49,4 +50,3 @@ return { | ||
description: schema.options.description, | ||
inputType: fieldTypeContext.typeConfig(schema.name + 'Id') | ||
.inputType, | ||
inputType: (_a = fieldTypeContext.typeConfig(schema.name + 'Id')) === null || _a === void 0 ? void 0 : _a.inputType, | ||
outputType: new graphql_1.GraphQLObjectType({ | ||
@@ -236,2 +236,5 @@ name: typeName, | ||
const typeConfig = fieldTypeContext.typeConfig(wrapType); | ||
if (!(typeConfig === null || typeConfig === void 0 ? void 0 : typeConfig.outputType)) { | ||
throw new Error(`Type ${wrapType} has not register`); | ||
} | ||
return { | ||
@@ -247,7 +250,6 @@ name: name, | ||
type: typeConfig.outputType, | ||
resolve: typeConfig.outputResolve | ||
? context.hookFieldResolve('value', { | ||
output: { type: wrapType }, | ||
resolve: typeConfig.outputResolve | ||
}) | ||
resolve: (typeConfig === null || typeConfig === void 0 ? void 0 : typeConfig.outputResolve) ? context.hookFieldResolve('value', { | ||
output: { type: wrapType }, | ||
resolve: typeConfig.outputResolve | ||
}) | ||
: undefined | ||
@@ -254,0 +256,0 @@ } |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const graphql_1 = require("graphql"); | ||
const lodash_1 = __importDefault(require("lodash")); | ||
const typeKey = 'variant'; | ||
@@ -42,11 +38,16 @@ const valueKey = 'value'; | ||
try { | ||
const fields = (ast.fields || []); | ||
for (let i = 0; i < fields.length; i++) { | ||
if (lodash_1.default.get(fields[i], 'name.value') === typeKey) { | ||
type = lodash_1.default.get(fields[i], 'value.value'); | ||
break; | ||
if (ast.kind === 'ObjectValue') { | ||
const fields = ast.fields; | ||
for (let i = 0; i < fields.length; i++) { | ||
if (fields[i].name.value === typeKey) { | ||
const value = fields[i].value; | ||
if (value.kind === 'StringValue') { | ||
type = value.value; | ||
break; | ||
} | ||
} | ||
} | ||
} | ||
if (!type) { | ||
throw new Error(); | ||
throw new Error(`Miss properties ${typeKey}`); | ||
} | ||
@@ -53,0 +54,0 @@ } |
{ | ||
"name": "simple-graphql", | ||
"version": "4.0.10", | ||
"version": "4.0.11", | ||
"description": "The simple way to generates GraphQL schemas and Sequelize models from your models definition.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
322235
4783