graphql-compose
Advanced tools
Comparing version 9.0.2 to 9.0.3
@@ -27,5 +27,5 @@ "use strict"; | ||
this.schemaComposer.set(graphqlType.name, this); | ||
this._gqcFields = configToDefine_1.convertEnumValuesToConfig(this._gqType.getValues(), this.schemaComposer); | ||
this._gqcFields = (0, configToDefine_1.convertEnumValuesToConfig)(this._gqType.getValues(), this.schemaComposer); | ||
if (!this._gqType.astNode) { | ||
this._gqType.astNode = definitionNode_1.getEnumTypeDefinitionNode(this); | ||
this._gqType.astNode = (0, definitionNode_1.getEnumTypeDefinitionNode)(this); | ||
} | ||
@@ -49,5 +49,5 @@ this._gqcIsModified = false; | ||
let ETC; | ||
if (is_1.isString(typeDef)) { | ||
if ((0, is_1.isString)(typeDef)) { | ||
const typeName = typeDef; | ||
if (typeHelpers_1.isTypeNameString(typeName)) { | ||
if ((0, typeHelpers_1.isTypeNameString)(typeName)) { | ||
ETC = new EnumTypeComposer(new graphql_1.GraphQLEnumType({ | ||
@@ -69,3 +69,3 @@ name: typeName, | ||
} | ||
else if (is_1.isObject(typeDef)) { | ||
else if ((0, is_1.isObject)(typeDef)) { | ||
const type = new graphql_1.GraphQLEnumType(Object.assign({}, typeDef)); | ||
@@ -80,3 +80,3 @@ ETC = new EnumTypeComposer(type, sc); | ||
else { | ||
throw new Error(`You should provide GraphQLEnumTypeConfig or string with enum name or SDL. Provided:\n${misc_1.inspect(typeDef)}`); | ||
throw new Error(`You should provide GraphQLEnumTypeConfig or string with enum name or SDL. Provided:\n${(0, misc_1.inspect)(typeDef)}`); | ||
} | ||
@@ -200,7 +200,7 @@ return ETC; | ||
this._gqcIsModified = false; | ||
gqType.astNode = definitionNode_1.getEnumTypeDefinitionNode(this); | ||
gqType.astNode = (0, definitionNode_1.getEnumTypeDefinitionNode)(this); | ||
if (graphqlVersion_1.graphqlVersion >= 14) { | ||
gqType._values = configToDefine_1.defineEnumValues(gqType, this._gqcFields, gqType.astNode); | ||
gqType._values = (0, configToDefine_1.defineEnumValues)(gqType, this._gqcFields, gqType.astNode); | ||
gqType._valueLookup = new Map(gqType._values.map((enumValue) => [enumValue.value, enumValue])); | ||
gqType._nameLookup = misc_1.keyMap(gqType._values, (value) => value.name); | ||
gqType._nameLookup = (0, misc_1.keyMap)(gqType._values, (value) => value.name); | ||
} | ||
@@ -210,3 +210,3 @@ else { | ||
delete gqType._nameLookup; | ||
gqType._values = configToDefine_1.defineEnumValues(gqType, this._gqcFields, gqType.astNode); | ||
gqType._values = (0, configToDefine_1.defineEnumValues)(gqType, this._gqcFields, gqType.astNode); | ||
} | ||
@@ -252,3 +252,3 @@ } | ||
: EnumTypeComposer.create(newTypeNameOrTC, this.schemaComposer); | ||
cloned._gqcFields = misc_1.mapEachKey(this._gqcFields, (fieldConfig) => (Object.assign(Object.assign({}, fieldConfig), { extensions: Object.assign({}, fieldConfig.extensions), directives: fieldConfig.directives && [...(fieldConfig.directives || [])] }))); | ||
cloned._gqcFields = (0, misc_1.mapEachKey)(this._gqcFields, (fieldConfig) => (Object.assign(Object.assign({}, fieldConfig), { extensions: Object.assign({}, fieldConfig.extensions), directives: fieldConfig.directives && [...(fieldConfig.directives || [])] }))); | ||
cloned._gqcExtensions = Object.assign({}, this._gqcExtensions); | ||
@@ -278,3 +278,3 @@ cloned.setDescription(this.getDescription()); | ||
else { | ||
throw new Error(`Cannot merge ${misc_1.inspect(type)} with EnumType(${this.getTypeName()}). Provided type should be GraphQLEnumType or EnumTypeComposer.`); | ||
throw new Error(`Cannot merge ${(0, misc_1.inspect)(type)} with EnumType(${this.getTypeName()}). Provided type should be GraphQLEnumType or EnumTypeComposer.`); | ||
} | ||
@@ -436,3 +436,3 @@ this.addFields(tc.getFields()); | ||
toSDL(opts) { | ||
return schemaPrinter_1.printEnum(this.getType(), opts); | ||
return (0, schemaPrinter_1.printEnum)(this.getType(), opts); | ||
} | ||
@@ -439,0 +439,0 @@ } |
@@ -41,10 +41,10 @@ "use strict"; | ||
if (graphqlVersion_1.graphqlVersion >= 14) { | ||
this._gqcFields = configToDefine_1.convertInputFieldMapToConfig(this._gqType._fields, this.schemaComposer); | ||
this._gqcFields = (0, configToDefine_1.convertInputFieldMapToConfig)(this._gqType._fields, this.schemaComposer); | ||
} | ||
else { | ||
const fields = this._gqType._typeConfig.fields; | ||
this._gqcFields = this.schemaComposer.typeMapper.convertInputFieldConfigMap(misc_1.resolveMaybeThunk(fields) || {}, this.getTypeName()); | ||
this._gqcFields = this.schemaComposer.typeMapper.convertInputFieldConfigMap((0, misc_1.resolveMaybeThunk)(fields) || {}, this.getTypeName()); | ||
} | ||
if (!this._gqType.astNode) { | ||
this._gqType.astNode = definitionNode_1.getInputObjectTypeDefinitionNode(this); | ||
this._gqType.astNode = (0, definitionNode_1.getInputObjectTypeDefinitionNode)(this); | ||
} | ||
@@ -68,5 +68,5 @@ this._gqcIsModified = false; | ||
let ITC; | ||
if (is_1.isString(typeDef)) { | ||
if ((0, is_1.isString)(typeDef)) { | ||
const typeName = typeDef; | ||
if (typeHelpers_1.isTypeNameString(typeName)) { | ||
if ((0, typeHelpers_1.isTypeNameString)(typeName)) { | ||
ITC = new InputTypeComposer(new graphql_1.GraphQLInputObjectType({ | ||
@@ -88,3 +88,3 @@ name: typeName, | ||
} | ||
else if (is_1.isObject(typeDef)) { | ||
else if ((0, is_1.isObject)(typeDef)) { | ||
const type = new graphql_1.GraphQLInputObjectType({ | ||
@@ -97,6 +97,6 @@ name: typeDef.name, | ||
const fields = typeDef.fields; | ||
if (is_1.isFunction(fields)) { | ||
ITC.addFields(configToDefine_1.convertInputFieldMapToConfig(fields, sc)); | ||
if ((0, is_1.isFunction)(fields)) { | ||
ITC.addFields((0, configToDefine_1.convertInputFieldMapToConfig)(fields, sc)); | ||
} | ||
if (is_1.isObject(fields)) | ||
if ((0, is_1.isObject)(fields)) | ||
ITC.addFields(fields); | ||
@@ -109,3 +109,3 @@ ITC.setExtensions(typeDef.extensions || undefined); | ||
else { | ||
throw new Error(`You should provide InputObjectConfig or string with type name to InputTypeComposer.create(typeDef). Provided:\n${misc_1.inspect(typeDef)}`); | ||
throw new Error(`You should provide InputObjectConfig or string with type name to InputTypeComposer.create(typeDef). Provided:\n${(0, misc_1.inspect)(typeDef)}`); | ||
} | ||
@@ -131,3 +131,3 @@ return ITC; | ||
setField(fieldName, fieldConfig) { | ||
this._gqcFields[fieldName] = is_1.isFunction(fieldConfig) | ||
this._gqcFields[fieldName] = (0, is_1.isFunction)(fieldConfig) | ||
? fieldConfig | ||
@@ -158,3 +158,3 @@ : this.schemaComposer.typeMapper.convertInputFieldConfig(fieldConfig, fieldName, this.getTypeName()); | ||
if (!this.hasField(name)) { | ||
childTC = InputTypeComposer.create(`${this.getTypeName()}${misc_1.upperFirst(name)}`, this.schemaComposer); | ||
childTC = InputTypeComposer.create(`${this.getTypeName()}${(0, misc_1.upperFirst)(name)}`, this.schemaComposer); | ||
this.setField(name, childTC); | ||
@@ -173,3 +173,3 @@ } | ||
getField(fieldName) { | ||
if (is_1.isFunction(this._gqcFields[fieldName])) { | ||
if ((0, is_1.isFunction)(this._gqcFields[fieldName])) { | ||
const unwrappedFieldConfig = this._gqcFields[fieldName](this.schemaComposer); | ||
@@ -252,3 +252,3 @@ this.setField(fieldName, unwrappedFieldConfig); | ||
const anyTC = this.getField(fieldName).type; | ||
return typeHelpers_1.unwrapInputTC(anyTC); | ||
return (0, typeHelpers_1.unwrapInputTC)(anyTC); | ||
} | ||
@@ -335,6 +335,6 @@ getFieldITC(fieldName) { | ||
this._gqcIsModified = false; | ||
this._gqType.astNode = definitionNode_1.getInputObjectTypeDefinitionNode(this); | ||
this._gqType.astNode = (0, definitionNode_1.getInputObjectTypeDefinitionNode)(this); | ||
if (graphqlVersion_1.graphqlVersion >= 14) { | ||
this._gqType._fields = () => { | ||
return configToDefine_1.defineInputFieldMap(this._gqType, misc_1.mapEachKey(this._gqcFields, (_, name) => this.getFieldConfig(name)), this._gqType.astNode); | ||
return (0, configToDefine_1.defineInputFieldMap)(this._gqType, (0, misc_1.mapEachKey)(this._gqcFields, (_, name) => this.getFieldConfig(name)), this._gqType.astNode); | ||
}; | ||
@@ -344,3 +344,3 @@ } | ||
this._gqType._typeConfig.fields = () => { | ||
return misc_1.mapEachKey(this._gqcFields, (_, name) => this.getFieldConfig(name)); | ||
return (0, misc_1.mapEachKey)(this._gqcFields, (_, name) => this.getFieldConfig(name)); | ||
}; | ||
@@ -388,3 +388,3 @@ delete this._gqType._fields; | ||
: InputTypeComposer.create(newTypeNameOrTC, this.schemaComposer); | ||
cloned._gqcFields = misc_1.mapEachKey(this._gqcFields, (fieldConfig) => (Object.assign(Object.assign({}, fieldConfig), { extensions: Object.assign({}, fieldConfig.extensions), directives: fieldConfig.directives && [...(fieldConfig.directives || [])] }))); | ||
cloned._gqcFields = (0, misc_1.mapEachKey)(this._gqcFields, (fieldConfig) => (Object.assign(Object.assign({}, fieldConfig), { extensions: Object.assign({}, fieldConfig.extensions), directives: fieldConfig.directives && [...(fieldConfig.directives || [])] }))); | ||
cloned._gqcExtensions = Object.assign({}, this._gqcExtensions); | ||
@@ -403,3 +403,3 @@ cloned.setDescription(this.getDescription()); | ||
cloneMap.set(this, cloned); | ||
cloned._gqcFields = misc_1.mapEachKey(this._gqcFields, (fieldConfig) => (Object.assign(Object.assign({}, fieldConfig), { type: typeHelpers_1.cloneTypeTo(fieldConfig.type, anotherSchemaComposer, cloneMap), extensions: Object.assign({}, fieldConfig.extensions) }))); | ||
cloned._gqcFields = (0, misc_1.mapEachKey)(this._gqcFields, (fieldConfig) => (Object.assign(Object.assign({}, fieldConfig), { type: (0, typeHelpers_1.cloneTypeTo)(fieldConfig.type, anotherSchemaComposer, cloneMap), extensions: Object.assign({}, fieldConfig.extensions) }))); | ||
cloned._gqcExtensions = Object.assign({}, this._gqcExtensions); | ||
@@ -418,3 +418,3 @@ cloned.setDescription(this.getDescription()); | ||
else { | ||
throw new Error(`Cannot merge ${misc_1.inspect(type)} with InputObjectType(${this.getTypeName()}). Provided type should be GraphQLInputObjectType or InputTypeComposer.`); | ||
throw new Error(`Cannot merge ${(0, misc_1.inspect)(type)} with InputObjectType(${this.getTypeName()}). Provided type should be GraphQLInputObjectType or InputTypeComposer.`); | ||
} | ||
@@ -580,3 +580,3 @@ const fields = Object.assign({}, tc.getFields()); | ||
get(path) { | ||
return typeByPath_1.typeByPath(this, path); | ||
return (0, typeByPath_1.typeByPath)(this, path); | ||
} | ||
@@ -602,5 +602,5 @@ getNestedTCs(opts = {}, passedTypes = new Set()) { | ||
let r = ''; | ||
r += schemaPrinter_1.printInputObject(this.getType(), innerOpts); | ||
r += (0, schemaPrinter_1.printInputObject)(this.getType(), innerOpts); | ||
const nestedTypes = Array.from(this.getNestedTCs({ exclude })); | ||
const sortMethod = schemaPrinterSortTypes_1.getSortMethodFromOption(innerOpts.sortAll || innerOpts.sortTypes); | ||
const sortMethod = (0, schemaPrinterSortTypes_1.getSortMethodFromOption)(innerOpts.sortAll || innerOpts.sortTypes); | ||
if (sortMethod) { | ||
@@ -618,3 +618,3 @@ nestedTypes.sort(sortMethod); | ||
} | ||
return schemaPrinter_1.printInputObject(this.getType(), innerOpts); | ||
return (0, schemaPrinter_1.printInputObject)(this.getType(), innerOpts); | ||
} | ||
@@ -621,0 +621,0 @@ } |
@@ -58,7 +58,7 @@ "use strict"; | ||
if (graphqlVersion_1.graphqlVersion >= 15) { | ||
this._gqcFields = configToDefine_1.convertObjectFieldMapToConfig(this._gqType._fields, this.schemaComposer); | ||
this._gqcInterfaces = configToDefine_1.convertInterfaceArrayAsThunk(this._gqType._interfaces, this.schemaComposer); | ||
this._gqcFields = (0, configToDefine_1.convertObjectFieldMapToConfig)(this._gqType._fields, this.schemaComposer); | ||
this._gqcInterfaces = (0, configToDefine_1.convertInterfaceArrayAsThunk)(this._gqType._interfaces, this.schemaComposer); | ||
} | ||
else if (graphqlVersion_1.graphqlVersion >= 14) { | ||
this._gqcFields = configToDefine_1.convertObjectFieldMapToConfig(this._gqType._fields, this.schemaComposer); | ||
this._gqcFields = (0, configToDefine_1.convertObjectFieldMapToConfig)(this._gqType._fields, this.schemaComposer); | ||
} | ||
@@ -68,6 +68,6 @@ else { | ||
.fields; | ||
this._gqcFields = this.schemaComposer.typeMapper.convertOutputFieldConfigMap(misc_1.resolveMaybeThunk(fields) || {}, this.getTypeName()); | ||
this._gqcFields = this.schemaComposer.typeMapper.convertOutputFieldConfigMap((0, misc_1.resolveMaybeThunk)(fields) || {}, this.getTypeName()); | ||
} | ||
if (!this._gqType.astNode) { | ||
this._gqType.astNode = definitionNode_1.getInterfaceTypeDefinitionNode(this); | ||
this._gqType.astNode = (0, definitionNode_1.getInterfaceTypeDefinitionNode)(this); | ||
} | ||
@@ -91,5 +91,5 @@ this._gqcIsModified = false; | ||
let IFTC; | ||
if (is_1.isString(typeDef)) { | ||
if ((0, is_1.isString)(typeDef)) { | ||
const typeName = typeDef; | ||
if (typeHelpers_1.isTypeNameString(typeName)) { | ||
if ((0, typeHelpers_1.isTypeNameString)(typeName)) { | ||
IFTC = new InterfaceTypeComposer(new graphql_1.GraphQLInterfaceType({ | ||
@@ -114,10 +114,10 @@ name: typeName, | ||
} | ||
else if (is_1.isObject(typeDef) && !(typeDef instanceof InterfaceTypeComposer)) { | ||
else if ((0, is_1.isObject)(typeDef) && !(typeDef instanceof InterfaceTypeComposer)) { | ||
const type = new graphql_1.GraphQLInterfaceType(Object.assign(Object.assign({}, typeDef), { fields: () => ({}) })); | ||
IFTC = new InterfaceTypeComposer(type, sc); | ||
const fields = typeDef.fields; | ||
if (is_1.isFunction(fields)) { | ||
IFTC.addFields(configToDefine_1.convertObjectFieldMapToConfig(fields, sc)); | ||
if ((0, is_1.isFunction)(fields)) { | ||
IFTC.addFields((0, configToDefine_1.convertObjectFieldMapToConfig)(fields, sc)); | ||
} | ||
else if (is_1.isObject(fields)) { | ||
else if ((0, is_1.isObject)(fields)) { | ||
IFTC.addFields(fields); | ||
@@ -128,4 +128,4 @@ } | ||
IFTC.setInterfaces(interfaces); | ||
else if (is_1.isFunction(interfaces)) { | ||
IFTC.setInterfaces(configToDefine_1.convertInterfaceArrayAsThunk(interfaces, sc)); | ||
else if ((0, is_1.isFunction)(interfaces)) { | ||
IFTC.setInterfaces((0, configToDefine_1.convertInterfaceArrayAsThunk)(interfaces, sc)); | ||
} | ||
@@ -138,3 +138,3 @@ IFTC.setExtensions(typeDef.extensions); | ||
else { | ||
throw new Error(`You should provide GraphQLInterfaceTypeConfig or string with interface name or SDL definition. Provided:\n${misc_1.inspect(typeDef)}`); | ||
throw new Error(`You should provide GraphQLInterfaceTypeConfig or string with interface name or SDL definition. Provided:\n${(0, misc_1.inspect)(typeDef)}`); | ||
} | ||
@@ -150,3 +150,3 @@ return IFTC; | ||
getField(fieldName) { | ||
if (is_1.isFunction(this._gqcFields[fieldName])) { | ||
if ((0, is_1.isFunction)(this._gqcFields[fieldName])) { | ||
const unwrappedFieldConfig = this._gqcFields[fieldName](this.schemaComposer); | ||
@@ -172,3 +172,3 @@ this.setField(fieldName, unwrappedFieldConfig); | ||
setField(fieldName, fieldConfig) { | ||
this._gqcFields[fieldName] = is_1.isFunction(fieldConfig) | ||
this._gqcFields[fieldName] = (0, is_1.isFunction)(fieldConfig) | ||
? fieldConfig | ||
@@ -244,3 +244,3 @@ : this.schemaComposer.typeMapper.convertOutputFieldConfig(fieldConfig, fieldName, this.getTypeName()); | ||
return Object.assign({ type: type.getType(), args: args && | ||
misc_1.mapEachKey(args, (ac) => (Object.assign(Object.assign({}, ac), { type: ac.type.getType() }))) }, rest); | ||
(0, misc_1.mapEachKey)(args, (ac) => (Object.assign(Object.assign({}, ac), { type: ac.type.getType() }))) }, rest); | ||
} | ||
@@ -255,3 +255,3 @@ getFieldType(fieldName) { | ||
const anyTC = this.getField(fieldName).type; | ||
return typeHelpers_1.unwrapOutputTC(anyTC); | ||
return (0, typeHelpers_1.unwrapOutputTC)(anyTC); | ||
} | ||
@@ -393,3 +393,3 @@ getFieldOTC(fieldName) { | ||
const anyTC = this.getFieldArg(fieldName, argName).type; | ||
return typeHelpers_1.unwrapInputTC(anyTC); | ||
return (0, typeHelpers_1.unwrapInputTC)(anyTC); | ||
} | ||
@@ -499,13 +499,13 @@ getFieldArgITC(fieldName, argName) { | ||
this._gqcIsModified = false; | ||
this._gqType.astNode = definitionNode_1.getInterfaceTypeDefinitionNode(this); | ||
this._gqType.astNode = (0, definitionNode_1.getInterfaceTypeDefinitionNode)(this); | ||
if (graphqlVersion_1.graphqlVersion >= 15) { | ||
this._gqType._fields = () => configToDefine_1.defineFieldMap(this._gqType, misc_1.mapEachKey(this._gqcFields, (_, name) => this.getFieldConfig(name)), this._gqType.astNode); | ||
this._gqType._fields = () => (0, configToDefine_1.defineFieldMap)(this._gqType, (0, misc_1.mapEachKey)(this._gqcFields, (_, name) => this.getFieldConfig(name)), this._gqType.astNode); | ||
this._gqType._interfaces = () => this.getInterfacesTypes(); | ||
} | ||
else if (graphqlVersion_1.graphqlVersion >= 14) { | ||
this._gqType._fields = () => configToDefine_1.defineFieldMap(this._gqType, misc_1.mapEachKey(this._gqcFields, (_, name) => this.getFieldConfig(name)), this._gqType.astNode); | ||
this._gqType._fields = () => (0, configToDefine_1.defineFieldMap)(this._gqType, (0, misc_1.mapEachKey)(this._gqcFields, (_, name) => this.getFieldConfig(name)), this._gqType.astNode); | ||
} | ||
else { | ||
this._gqType._typeConfig.fields = () => { | ||
return misc_1.mapEachKey(this._gqcFields, (_, name) => this.getFieldConfig(name)); | ||
return (0, misc_1.mapEachKey)(this._gqcFields, (_, name) => this.getFieldConfig(name)); | ||
}; | ||
@@ -553,3 +553,3 @@ this._gqType._fields = {}; | ||
: InterfaceTypeComposer.create(newTypeNameOrTC, this.schemaComposer); | ||
cloned._gqcFields = misc_1.mapEachKey(this._gqcFields, (fieldConfig) => (Object.assign(Object.assign({}, fieldConfig), { args: misc_1.mapEachKey(fieldConfig.args, (argConfig) => (Object.assign(Object.assign({}, argConfig), { extensions: Object.assign({}, argConfig.extensions), directives: [...(argConfig.directives || [])] }))), extensions: Object.assign({}, fieldConfig.extensions), directives: [...(fieldConfig.directives || [])] }))); | ||
cloned._gqcFields = (0, misc_1.mapEachKey)(this._gqcFields, (fieldConfig) => (Object.assign(Object.assign({}, fieldConfig), { args: (0, misc_1.mapEachKey)(fieldConfig.args, (argConfig) => (Object.assign(Object.assign({}, argConfig), { extensions: Object.assign({}, argConfig.extensions), directives: [...(argConfig.directives || [])] }))), extensions: Object.assign({}, fieldConfig.extensions), directives: [...(fieldConfig.directives || [])] }))); | ||
cloned._gqcInterfaces = [...this._gqcInterfaces]; | ||
@@ -573,3 +573,3 @@ if (this._gqcTypeResolvers) { | ||
cloneMap.set(this, cloned); | ||
cloned._gqcFields = misc_1.mapEachKey(this._gqcFields, (fieldConfig) => (Object.assign(Object.assign({}, fieldConfig), { type: typeHelpers_1.cloneTypeTo(fieldConfig.type, anotherSchemaComposer, cloneMap), args: misc_1.mapEachKey(fieldConfig.args, (argConfig) => (Object.assign(Object.assign({}, argConfig), { type: typeHelpers_1.cloneTypeTo(argConfig.type, anotherSchemaComposer, cloneMap), extensions: Object.assign({}, argConfig.extensions), directives: [...(argConfig.directives || [])] }))), extensions: Object.assign({}, fieldConfig.extensions), directives: [...(fieldConfig.directives || [])] }))); | ||
cloned._gqcFields = (0, misc_1.mapEachKey)(this._gqcFields, (fieldConfig) => (Object.assign(Object.assign({}, fieldConfig), { type: (0, typeHelpers_1.cloneTypeTo)(fieldConfig.type, anotherSchemaComposer, cloneMap), args: (0, misc_1.mapEachKey)(fieldConfig.args, (argConfig) => (Object.assign(Object.assign({}, argConfig), { type: (0, typeHelpers_1.cloneTypeTo)(argConfig.type, anotherSchemaComposer, cloneMap), extensions: Object.assign({}, argConfig.extensions), directives: [...(argConfig.directives || [])] }))), extensions: Object.assign({}, fieldConfig.extensions), directives: [...(fieldConfig.directives || [])] }))); | ||
cloned._gqcInterfaces = this._gqcInterfaces.map((i) => i.cloneTo(anotherSchemaComposer, cloneMap)); | ||
@@ -582,3 +582,3 @@ cloned._gqcExtensions = Object.assign({}, this._gqcExtensions); | ||
typeResolversMap.forEach((fn, tc) => { | ||
const clonedTC = typeHelpers_1.cloneTypeTo(tc, anotherSchemaComposer, cloneMap); | ||
const clonedTC = (0, typeHelpers_1.cloneTypeTo)(tc, anotherSchemaComposer, cloneMap); | ||
clonedTypeResolvers.set(clonedTC, fn); | ||
@@ -589,3 +589,3 @@ }); | ||
if (this._gqcFallbackResolveType) { | ||
cloned._gqcFallbackResolveType = typeHelpers_1.cloneTypeTo(this._gqcFallbackResolveType, anotherSchemaComposer, cloneMap); | ||
cloned._gqcFallbackResolveType = (0, typeHelpers_1.cloneTypeTo)(this._gqcFallbackResolveType, anotherSchemaComposer, cloneMap); | ||
} | ||
@@ -606,3 +606,3 @@ return cloned; | ||
else { | ||
throw new Error(`Cannot merge ${misc_1.inspect(type)} with InterfaceType(${this.getTypeName()}). Provided type should be GraphQLInterfaceType, GraphQLObjectType, InterfaceTypeComposer or ObjectTypeComposer.`); | ||
throw new Error(`Cannot merge ${(0, misc_1.inspect)(type)} with InterfaceType(${this.getTypeName()}). Provided type should be GraphQLInterfaceType, GraphQLObjectType, InterfaceTypeComposer or ObjectTypeComposer.`); | ||
} | ||
@@ -632,3 +632,3 @@ const fields = Object.assign({}, tc.getFields()); | ||
if (!this._gqcInputTypeComposer) { | ||
this._gqcInputTypeComposer = toInputType_1.toInputObjectType(this, opts); | ||
this._gqcInputTypeComposer = (0, toInputType_1.toInputObjectType)(this, opts); | ||
} | ||
@@ -665,3 +665,3 @@ return this._gqcInputTypeComposer; | ||
if (!typeResolversMap.has(type)) { | ||
throw new Error(`Type resolve function in interface '${this.getTypeName()}' is not defined for type ${misc_1.inspect(type)}.`); | ||
throw new Error(`Type resolve function in interface '${this.getTypeName()}' is not defined for type ${(0, misc_1.inspect)(type)}.`); | ||
} | ||
@@ -687,3 +687,3 @@ return typeResolversMap.get(type); | ||
typeResolversMap.forEach((_, composeType) => { | ||
types.push(typeHelpers_1.getGraphQLType(composeType)); | ||
types.push((0, typeHelpers_1.getGraphQLType)(composeType)); | ||
}); | ||
@@ -701,3 +701,3 @@ return types; | ||
const fallbackType = this._gqcFallbackResolveType | ||
? typeHelpers_1.getGraphQLType(this._gqcFallbackResolveType) | ||
? (0, typeHelpers_1.getGraphQLType)(this._gqcFallbackResolveType) | ||
: null; | ||
@@ -707,3 +707,3 @@ const fastEntries = []; | ||
for (const [composeType, checkFn] of typeResolversMap.entries()) { | ||
fastEntries.push([typeHelpers_1.getComposeTypeName(composeType, this.schemaComposer), checkFn]); | ||
fastEntries.push([(0, typeHelpers_1.getComposeTypeName)(composeType, this.schemaComposer), checkFn]); | ||
} | ||
@@ -713,3 +713,3 @@ } | ||
for (const [composeType, checkFn] of typeResolversMap.entries()) { | ||
fastEntries.push([typeHelpers_1.getGraphQLType(composeType), checkFn]); | ||
fastEntries.push([(0, typeHelpers_1.getGraphQLType)(composeType), checkFn]); | ||
} | ||
@@ -751,3 +751,3 @@ } | ||
try { | ||
const type = typeHelpers_1.getGraphQLType(composeType); | ||
const type = (0, typeHelpers_1.getGraphQLType)(composeType); | ||
if (!(type instanceof graphql_1.GraphQLObjectType)) | ||
@@ -757,6 +757,6 @@ throw new Error('Must be GraphQLObjectType'); | ||
catch (e) { | ||
throw new Error(`For interface type resolver ${this.getTypeName()} you must provide GraphQLObjectType or ObjectTypeComposer, but provided ${misc_1.inspect(composeType)}`); | ||
throw new Error(`For interface type resolver ${this.getTypeName()} you must provide GraphQLObjectType or ObjectTypeComposer, but provided ${(0, misc_1.inspect)(composeType)}`); | ||
} | ||
if (!is_1.isFunction(checkFn)) { | ||
throw new Error(`Interface ${this.getTypeName()} has invalid check function for type ${misc_1.inspect(composeType)}`); | ||
if (!(0, is_1.isFunction)(checkFn)) { | ||
throw new Error(`Interface ${this.getTypeName()} has invalid check function for type ${(0, misc_1.inspect)(composeType)}`); | ||
} | ||
@@ -815,3 +815,3 @@ return true; | ||
setInterfaces(interfaces) { | ||
this._gqcInterfaces = configToDefine_1.convertInterfaceArrayAsThunk(interfaces, this.schemaComposer); | ||
this._gqcInterfaces = (0, configToDefine_1.convertInterfaceArrayAsThunk)(interfaces, this.schemaComposer); | ||
this._gqcIsModified = true; | ||
@@ -821,3 +821,3 @@ return this; | ||
hasInterface(iface) { | ||
const typeName = typeHelpers_1.getComposeTypeName(iface, this.schemaComposer); | ||
const typeName = (0, typeHelpers_1.getComposeTypeName)(iface, this.schemaComposer); | ||
return !!this._gqcInterfaces.find((i) => i.getTypeName() === typeName); | ||
@@ -840,3 +840,3 @@ } | ||
removeInterface(iface) { | ||
const typeName = typeHelpers_1.getComposeTypeName(iface, this.schemaComposer); | ||
const typeName = (0, typeHelpers_1.getComposeTypeName)(iface, this.schemaComposer); | ||
this._gqcInterfaces = this._gqcInterfaces.filter((i) => i.getTypeName() !== typeName); | ||
@@ -1072,3 +1072,3 @@ this._gqcIsModified = true; | ||
get(path) { | ||
return typeByPath_1.typeByPath(this, path); | ||
return (0, typeByPath_1.typeByPath)(this, path); | ||
} | ||
@@ -1110,5 +1110,5 @@ getNestedTCs(opts = {}, passedTypes = new Set()) { | ||
let r = ''; | ||
r += schemaPrinter_1.printInterface(this.getType(), innerOpts); | ||
r += (0, schemaPrinter_1.printInterface)(this.getType(), innerOpts); | ||
const nestedTypes = Array.from(this.getNestedTCs({ exclude })); | ||
const sortMethod = schemaPrinterSortTypes_1.getSortMethodFromOption(innerOpts.sortAll || innerOpts.sortTypes); | ||
const sortMethod = (0, schemaPrinterSortTypes_1.getSortMethodFromOption)(innerOpts.sortAll || innerOpts.sortTypes); | ||
if (sortMethod) { | ||
@@ -1126,3 +1126,3 @@ nestedTypes.sort(sortMethod); | ||
} | ||
return schemaPrinter_1.printInterface(this.getType(), innerOpts); | ||
return (0, schemaPrinter_1.printInterface)(this.getType(), innerOpts); | ||
} | ||
@@ -1129,0 +1129,0 @@ } |
@@ -19,3 +19,3 @@ "use strict"; | ||
let tc = this; | ||
while (!typeHelpers_1.isNamedTypeComposer(tc)) { | ||
while (!(0, typeHelpers_1.isNamedTypeComposer)(tc)) { | ||
tc = tc.ofType; | ||
@@ -22,0 +22,0 @@ } |
@@ -10,3 +10,3 @@ "use strict"; | ||
constructor(type) { | ||
misc_1.invariant(!(type instanceof NonNullComposer), 'You provide NonNull value to NonNullComposer constructor. Nesting NonNull is not allowed.'); | ||
(0, misc_1.invariant)(!(type instanceof NonNullComposer), 'You provide NonNull value to NonNullComposer constructor. Nesting NonNull is not allowed.'); | ||
this.ofType = type; | ||
@@ -22,3 +22,3 @@ } | ||
let tc = this; | ||
while (!typeHelpers_1.isNamedTypeComposer(tc)) { | ||
while (!(0, typeHelpers_1.isNamedTypeComposer)(tc)) { | ||
tc = tc.ofType; | ||
@@ -25,0 +25,0 @@ } |
@@ -52,4 +52,4 @@ "use strict"; | ||
if (graphqlVersion_1.graphqlVersion >= 14) { | ||
this._gqcFields = configToDefine_1.convertObjectFieldMapToConfig(this._gqType._fields, this.schemaComposer); | ||
this._gqcInterfaces = configToDefine_1.convertInterfaceArrayAsThunk(this._gqType._interfaces, this.schemaComposer); | ||
this._gqcFields = (0, configToDefine_1.convertObjectFieldMapToConfig)(this._gqType._fields, this.schemaComposer); | ||
this._gqcInterfaces = (0, configToDefine_1.convertInterfaceArrayAsThunk)(this._gqType._interfaces, this.schemaComposer); | ||
} | ||
@@ -59,7 +59,7 @@ else { | ||
.fields; | ||
this._gqcFields = this.schemaComposer.typeMapper.convertOutputFieldConfigMap((misc_1.resolveMaybeThunk(fields) || {}), this.getTypeName()); | ||
this._gqcInterfaces = configToDefine_1.convertInterfaceArrayAsThunk(this._gqType._interfaces || this._gqType._typeConfig.interfaces, this.schemaComposer); | ||
this._gqcFields = this.schemaComposer.typeMapper.convertOutputFieldConfigMap(((0, misc_1.resolveMaybeThunk)(fields) || {}), this.getTypeName()); | ||
this._gqcInterfaces = (0, configToDefine_1.convertInterfaceArrayAsThunk)(this._gqType._interfaces || this._gqType._typeConfig.interfaces, this.schemaComposer); | ||
} | ||
if (!this._gqType.astNode) { | ||
this._gqType.astNode = definitionNode_1.getObjectTypeDefinitionNode(this); | ||
this._gqType.astNode = (0, definitionNode_1.getObjectTypeDefinitionNode)(this); | ||
} | ||
@@ -86,5 +86,5 @@ this._gqcIsModified = false; | ||
let TC; | ||
if (is_1.isString(typeDef)) { | ||
if ((0, is_1.isString)(typeDef)) { | ||
const typeName = typeDef; | ||
if (typeHelpers_1.isTypeNameString(typeName)) { | ||
if ((0, typeHelpers_1.isTypeNameString)(typeName)) { | ||
TC = new ObjectTypeComposer(new graphql_1.GraphQLObjectType({ | ||
@@ -109,10 +109,10 @@ name: typeName, | ||
} | ||
else if (is_1.isObject(typeDef)) { | ||
else if ((0, is_1.isObject)(typeDef)) { | ||
const type = new graphql_1.GraphQLObjectType(Object.assign(Object.assign({}, typeDef), { fields: () => ({}) })); | ||
TC = new ObjectTypeComposer(type, sc); | ||
const fields = typeDef.fields; | ||
if (is_1.isFunction(fields)) { | ||
TC.addFields(configToDefine_1.convertObjectFieldMapToConfig(fields, sc)); | ||
if ((0, is_1.isFunction)(fields)) { | ||
TC.addFields((0, configToDefine_1.convertObjectFieldMapToConfig)(fields, sc)); | ||
} | ||
else if (is_1.isObject(fields)) { | ||
else if ((0, is_1.isObject)(fields)) { | ||
TC.addFields(fields); | ||
@@ -123,4 +123,4 @@ } | ||
TC.setInterfaces(interfaces); | ||
else if (is_1.isFunction(interfaces)) { | ||
TC.setInterfaces(configToDefine_1.convertInterfaceArrayAsThunk(interfaces, sc)); | ||
else if ((0, is_1.isFunction)(interfaces)) { | ||
TC.setInterfaces((0, configToDefine_1.convertInterfaceArrayAsThunk)(interfaces, sc)); | ||
} | ||
@@ -133,3 +133,3 @@ TC.setExtensions(typeDef.extensions); | ||
else { | ||
throw new Error(`You should provide GraphQLObjectTypeConfig or string with type name to ObjectTypeComposer.create(opts). Provided:\n${misc_1.inspect(typeDef)}`); | ||
throw new Error(`You should provide GraphQLObjectTypeConfig or string with type name to ObjectTypeComposer.create(opts). Provided:\n${(0, misc_1.inspect)(typeDef)}`); | ||
} | ||
@@ -145,3 +145,3 @@ return TC; | ||
getField(fieldName) { | ||
if (is_1.isFunction(this._gqcFields[fieldName])) { | ||
if ((0, is_1.isFunction)(this._gqcFields[fieldName])) { | ||
const unwrappedFieldConfig = this._gqcFields[fieldName](this.schemaComposer); | ||
@@ -167,3 +167,3 @@ this.setField(fieldName, unwrappedFieldConfig); | ||
setField(fieldName, fieldConfig) { | ||
this._gqcFields[fieldName] = is_1.isFunction(fieldConfig) | ||
this._gqcFields[fieldName] = (0, is_1.isFunction)(fieldConfig) | ||
? fieldConfig | ||
@@ -194,3 +194,3 @@ : this.schemaComposer.typeMapper.convertOutputFieldConfig(fieldConfig, fieldName, this.getTypeName()); | ||
if (!this.hasField(name)) { | ||
childTC = ObjectTypeComposer.create(`${this.getTypeName()}${misc_1.upperFirst(name)}`, this.schemaComposer); | ||
childTC = ObjectTypeComposer.create(`${this.getTypeName()}${(0, misc_1.upperFirst)(name)}`, this.schemaComposer); | ||
this.setField(name, { | ||
@@ -270,3 +270,3 @@ type: childTC, | ||
return Object.assign({ type: type.getType(), args: args && | ||
misc_1.mapEachKey(args, (ac) => (Object.assign(Object.assign({}, ac), { type: ac.type.getType() }))) }, rest); | ||
(0, misc_1.mapEachKey)(args, (ac) => (Object.assign(Object.assign({}, ac), { type: ac.type.getType() }))) }, rest); | ||
} | ||
@@ -281,3 +281,3 @@ getFieldType(fieldName) { | ||
const anyTC = this.getField(fieldName).type; | ||
return typeHelpers_1.unwrapOutputTC(anyTC); | ||
return (0, typeHelpers_1.unwrapOutputTC)(anyTC); | ||
} | ||
@@ -419,3 +419,3 @@ getFieldOTC(fieldName) { | ||
const anyTC = this.getFieldArg(fieldName, argName).type; | ||
return typeHelpers_1.unwrapInputTC(anyTC); | ||
return (0, typeHelpers_1.unwrapInputTC)(anyTC); | ||
} | ||
@@ -547,5 +547,5 @@ getFieldArgITC(fieldName, argName) { | ||
this._gqcIsModified = false; | ||
this._gqType.astNode = definitionNode_1.getObjectTypeDefinitionNode(this); | ||
this._gqType.astNode = (0, definitionNode_1.getObjectTypeDefinitionNode)(this); | ||
if (graphqlVersion_1.graphqlVersion >= 14) { | ||
this._gqType._fields = () => configToDefine_1.defineFieldMap(this._gqType, misc_1.mapEachKey(this._gqcFields, (_, name) => this.getFieldConfig(name)), this._gqType.astNode); | ||
this._gqType._fields = () => (0, configToDefine_1.defineFieldMap)(this._gqType, (0, misc_1.mapEachKey)(this._gqcFields, (_, name) => this.getFieldConfig(name)), this._gqType.astNode); | ||
this._gqType._interfaces = () => this.getInterfacesTypes(); | ||
@@ -555,3 +555,3 @@ } | ||
this._gqType._typeConfig.fields = () => { | ||
return misc_1.mapEachKey(this._gqcFields, (_, name) => this.getFieldConfig(name)); | ||
return (0, misc_1.mapEachKey)(this._gqcFields, (_, name) => this.getFieldConfig(name)); | ||
}; | ||
@@ -601,3 +601,3 @@ this._gqType._typeConfig.interfaces = () => this.getInterfacesTypes(); | ||
: ObjectTypeComposer.create(newTypeNameOrTC, this.schemaComposer); | ||
cloned._gqcFields = misc_1.mapEachKey(this._gqcFields, (fieldConfig) => (Object.assign(Object.assign({}, fieldConfig), { args: misc_1.mapEachKey(fieldConfig.args || {}, (argConfig) => (Object.assign(Object.assign({}, argConfig), { extensions: Object.assign({}, argConfig.extensions), directives: [...(argConfig.directives || [])] }))), extensions: Object.assign({}, fieldConfig.extensions), directives: [...(fieldConfig.directives || [])] }))); | ||
cloned._gqcFields = (0, misc_1.mapEachKey)(this._gqcFields, (fieldConfig) => (Object.assign(Object.assign({}, fieldConfig), { args: (0, misc_1.mapEachKey)(fieldConfig.args || {}, (argConfig) => (Object.assign(Object.assign({}, argConfig), { extensions: Object.assign({}, argConfig.extensions), directives: [...(argConfig.directives || [])] }))), extensions: Object.assign({}, fieldConfig.extensions), directives: [...(fieldConfig.directives || [])] }))); | ||
cloned._gqcInterfaces = [...this._gqcInterfaces]; | ||
@@ -610,3 +610,3 @@ cloned._gqcExtensions = Object.assign({}, this._gqcExtensions); | ||
const newResolver = resolver.clone(); | ||
newResolver.type = typeHelpers_1.replaceTC(newResolver.type, (tc) => { | ||
newResolver.type = (0, typeHelpers_1.replaceTC)(newResolver.type, (tc) => { | ||
return tc === this ? cloned : tc; | ||
@@ -626,3 +626,3 @@ }); | ||
cloneMap.set(this, cloned); | ||
cloned._gqcFields = misc_1.mapEachKey(this._gqcFields, (fieldConfig) => (Object.assign(Object.assign({}, fieldConfig), { type: typeHelpers_1.cloneTypeTo(fieldConfig.type, anotherSchemaComposer, cloneMap), args: misc_1.mapEachKey(fieldConfig.args, (argConfig) => (Object.assign(Object.assign({}, argConfig), { type: typeHelpers_1.cloneTypeTo(argConfig.type, anotherSchemaComposer, cloneMap), extensions: Object.assign({}, argConfig.extensions), directives: [...(argConfig.directives || [])] }))), extensions: Object.assign({}, fieldConfig.extensions), directives: [...(fieldConfig.directives || [])] }))); | ||
cloned._gqcFields = (0, misc_1.mapEachKey)(this._gqcFields, (fieldConfig) => (Object.assign(Object.assign({}, fieldConfig), { type: (0, typeHelpers_1.cloneTypeTo)(fieldConfig.type, anotherSchemaComposer, cloneMap), args: (0, misc_1.mapEachKey)(fieldConfig.args, (argConfig) => (Object.assign(Object.assign({}, argConfig), { type: (0, typeHelpers_1.cloneTypeTo)(argConfig.type, anotherSchemaComposer, cloneMap), extensions: Object.assign({}, argConfig.extensions), directives: [...(argConfig.directives || [])] }))), extensions: Object.assign({}, fieldConfig.extensions), directives: [...(fieldConfig.directives || [])] }))); | ||
cloned._gqcInterfaces = this._gqcInterfaces.map((i) => i.cloneTo(anotherSchemaComposer, cloneMap)); | ||
@@ -659,3 +659,3 @@ cloned._gqcExtensions = Object.assign({}, this._gqcExtensions); | ||
else { | ||
throw new Error(`Cannot merge ${misc_1.inspect(type)} with ObjectType(${this.getTypeName()}). Provided type should be GraphQLInterfaceType, GraphQLObjectType, InterfaceTypeComposer or ObjectTypeComposer.`); | ||
throw new Error(`Cannot merge ${(0, misc_1.inspect)(type)} with ObjectType(${this.getTypeName()}). Provided type should be GraphQLInterfaceType, GraphQLObjectType, InterfaceTypeComposer or ObjectTypeComposer.`); | ||
} | ||
@@ -685,3 +685,3 @@ const fields = Object.assign({}, tc.getFields()); | ||
if (!this._gqcInputTypeComposer) { | ||
this._gqcInputTypeComposer = toInputType_1.toInputObjectType(this, opts); | ||
this._gqcInputTypeComposer = (0, toInputType_1.toInputObjectType)(this, opts); | ||
} | ||
@@ -782,3 +782,3 @@ return this._gqcInputTypeComposer; | ||
setInterfaces(interfaces) { | ||
this._gqcInterfaces = configToDefine_1.convertInterfaceArrayAsThunk(interfaces, this.schemaComposer); | ||
this._gqcInterfaces = (0, configToDefine_1.convertInterfaceArrayAsThunk)(interfaces, this.schemaComposer); | ||
this._gqcIsModified = true; | ||
@@ -788,3 +788,3 @@ return this; | ||
hasInterface(iface) { | ||
const typeName = typeHelpers_1.getComposeTypeName(iface, this.schemaComposer); | ||
const typeName = (0, typeHelpers_1.getComposeTypeName)(iface, this.schemaComposer); | ||
return !!this._gqcInterfaces.find((i) => i.getTypeName() === typeName); | ||
@@ -807,3 +807,3 @@ } | ||
removeInterface(iface) { | ||
const typeName = typeHelpers_1.getComposeTypeName(iface, this.schemaComposer); | ||
const typeName = (0, typeHelpers_1.getComposeTypeName)(iface, this.schemaComposer); | ||
this._gqcInterfaces = this._gqcInterfaces.filter((i) => i.getTypeName() !== typeName); | ||
@@ -1045,4 +1045,4 @@ this._gqcIsModified = true; | ||
if (opts.hasOwnProperty('resolver')) { | ||
if (is_1.isFunction(opts.resolver)) { | ||
this._gqcFields[fieldName] = createThunkedObjectProxy_1.createThunkedObjectProxy(() => this._relationWithResolverToFC(opts, fieldName)); | ||
if ((0, is_1.isFunction)(opts.resolver)) { | ||
this._gqcFields[fieldName] = (0, createThunkedObjectProxy_1.createThunkedObjectProxy)(() => this._relationWithResolverToFC(opts, fieldName)); | ||
} | ||
@@ -1066,3 +1066,3 @@ else { | ||
_relationWithResolverToFC(opts, fieldName = '') { | ||
const resolver = is_1.isFunction(opts.resolver) ? opts.resolver(this.schemaComposer) : opts.resolver; | ||
const resolver = (0, is_1.isFunction)(opts.resolver) ? opts.resolver(this.schemaComposer) : opts.resolver; | ||
if (!(resolver instanceof Resolver_1.Resolver)) { | ||
@@ -1088,3 +1088,3 @@ throw new Error('You should provide correct Resolver object for relation ' + | ||
delete argsConfig[argName]; | ||
if (is_1.isFunction(argMapVal)) { | ||
if ((0, is_1.isFunction)(argMapVal)) { | ||
argsRuntime.push([argName, argMapVal]); | ||
@@ -1142,3 +1142,3 @@ } | ||
get(path) { | ||
return typeByPath_1.typeByPath(this, path); | ||
return (0, typeByPath_1.typeByPath)(this, path); | ||
} | ||
@@ -1180,5 +1180,5 @@ getNestedTCs(opts = {}, passedTypes = new Set()) { | ||
let r = ''; | ||
r += schemaPrinter_1.printObject(this.getType(), innerOpts); | ||
r += (0, schemaPrinter_1.printObject)(this.getType(), innerOpts); | ||
const nestedTypes = Array.from(this.getNestedTCs({ exclude })); | ||
const sortMethod = schemaPrinterSortTypes_1.getSortMethodFromOption(innerOpts.sortAll || innerOpts.sortTypes); | ||
const sortMethod = (0, schemaPrinterSortTypes_1.getSortMethodFromOption)(innerOpts.sortAll || innerOpts.sortTypes); | ||
if (sortMethod) { | ||
@@ -1196,3 +1196,3 @@ nestedTypes.sort(sortMethod); | ||
} | ||
return schemaPrinter_1.printObject(this.getType(), innerOpts); | ||
return (0, schemaPrinter_1.printObject)(this.getType(), innerOpts); | ||
} | ||
@@ -1199,0 +1199,0 @@ } |
@@ -72,3 +72,3 @@ "use strict"; | ||
const anyTC = this.type; | ||
return typeHelpers_1.unwrapOutputTC(anyTC); | ||
return (0, typeHelpers_1.unwrapOutputTC)(anyTC); | ||
} | ||
@@ -86,3 +86,3 @@ getOTC() { | ||
if (!tc) { | ||
throw new Error(`Cannot convert to ObjectType following value: ${misc_1.inspect(typeDef)}`); | ||
throw new Error(`Cannot convert to ObjectType following value: ${(0, misc_1.inspect)(typeDef)}`); | ||
} | ||
@@ -100,5 +100,5 @@ this.type = tc; | ||
let arg = this.args[argName]; | ||
if (is_1.isFunction(arg)) | ||
if ((0, is_1.isFunction)(arg)) | ||
arg = arg(this.schemaComposer); | ||
if (typeof arg === 'string' || typeHelpers_1.isComposeInputType(arg) || Array.isArray(arg)) { | ||
if (typeof arg === 'string' || (0, typeHelpers_1.isComposeInputType)(arg) || Array.isArray(arg)) { | ||
return { type: arg }; | ||
@@ -137,3 +137,3 @@ } | ||
if (!tc) { | ||
throw new Error(`Cannot create InputType from ${misc_1.inspect(typeDef)}`); | ||
throw new Error(`Cannot create InputType from ${(0, misc_1.inspect)(typeDef)}`); | ||
} | ||
@@ -187,3 +187,3 @@ ac.type = tc; | ||
const argType = this.getArg(argName).type; | ||
return typeHelpers_1.unwrapInputTC(argType); | ||
return (0, typeHelpers_1.unwrapInputTC)(argType); | ||
} | ||
@@ -265,15 +265,15 @@ getArgITC(argName) { | ||
if (!{}.hasOwnProperty.call(this.args, argName)) { | ||
throw new Error(`Can not clone arg ${misc_1.inspect(argName)} for resolver ${this.name}. Argument does not exist.`); | ||
throw new Error(`Can not clone arg ${(0, misc_1.inspect)(argName)} for resolver ${this.name}. Argument does not exist.`); | ||
} | ||
const argTC = this.getArg(argName).type; | ||
const clonedTC = typeHelpers_1.replaceTC(argTC, (unwrappedTC) => { | ||
const clonedTC = (0, typeHelpers_1.replaceTC)(argTC, (unwrappedTC) => { | ||
if (!(unwrappedTC instanceof InputTypeComposer_1.InputTypeComposer)) { | ||
throw new Error(`Cannot clone arg ${misc_1.inspect(argName)} for resolver ${misc_1.inspect(this.name)}. ` + | ||
`Argument should be InputObjectType, but received: ${misc_1.inspect(unwrappedTC)}.`); | ||
throw new Error(`Cannot clone arg ${(0, misc_1.inspect)(argName)} for resolver ${(0, misc_1.inspect)(this.name)}. ` + | ||
`Argument should be InputObjectType, but received: ${(0, misc_1.inspect)(unwrappedTC)}.`); | ||
} | ||
if (!newTypeName || newTypeName !== misc_1.clearName(newTypeName)) { | ||
if (!newTypeName || newTypeName !== (0, misc_1.clearName)(newTypeName)) { | ||
throw new Error('You should provide new type name as second argument'); | ||
} | ||
if (newTypeName === unwrappedTC.getTypeName()) { | ||
throw new Error(`You should provide new type name. It is equal to current name: ${misc_1.inspect(newTypeName)}.`); | ||
throw new Error(`You should provide new type name. It is equal to current name: ${(0, misc_1.inspect)(newTypeName)}.`); | ||
} | ||
@@ -299,3 +299,3 @@ return unwrappedTC.clone(newTypeName); | ||
if (!(filterITC instanceof InputTypeComposer_1.InputTypeComposer)) { | ||
if (!opts.filterTypeNameFallback || !is_1.isString(opts.filterTypeNameFallback)) { | ||
if (!opts.filterTypeNameFallback || !(0, is_1.isString)(opts.filterTypeNameFallback)) { | ||
throw new Error('For Resolver.addFilterArg needs to provide `opts.filterTypeNameFallback: string`. ' + | ||
@@ -318,3 +318,3 @@ 'This string will be used as unique name for `filter` type of input argument. ' + | ||
const query = opts.query; | ||
if (query && is_1.isFunction(query)) { | ||
if (query && (0, is_1.isFunction)(query)) { | ||
resolver.setResolve((resolveParams) => __awaiter(this, void 0, void 0, function* () { | ||
@@ -346,3 +346,3 @@ const value = object_path_1.default.get(resolveParams, ['args', 'filter', name]); | ||
if (!sortETC) { | ||
if (!opts.sortTypeNameFallback || !is_1.isString(opts.sortTypeNameFallback)) { | ||
if (!opts.sortTypeNameFallback || !(0, is_1.isString)(opts.sortTypeNameFallback)) { | ||
throw new Error('For Resolver.addSortArg needs to provide `opts.sortTypeNameFallback: string`. ' + | ||
@@ -358,3 +358,3 @@ 'This string will be used as unique name for `sort` type of input argument. ' + | ||
if (!(sortETC instanceof EnumTypeComposer_1.EnumTypeComposer)) { | ||
throw new Error(`Resolver must have 'sort' arg with EnumType, but got: ${misc_1.inspect(sortETC)} `); | ||
throw new Error(`Resolver must have 'sort' arg with EnumType, but got: ${(0, misc_1.inspect)(sortETC)} `); | ||
} | ||
@@ -368,3 +368,3 @@ const { name, description, deprecationReason, value } = opts; | ||
const resolveNext = resolver.getResolve(); | ||
if (is_1.isFunction(value)) { | ||
if ((0, is_1.isFunction)(value)) { | ||
sortETC.extendField(name, { value: name }); | ||
@@ -392,3 +392,3 @@ const getValue = value; | ||
if (!Array.isArray(middlewares)) { | ||
throw new Error(`You should provide array of middlewares '(resolve, source, args, context, info) => any', but provided ${misc_1.inspect(middlewares)}.`); | ||
throw new Error(`You should provide array of middlewares '(resolve, source, args, context, info) => any', but provided ${(0, misc_1.inspect)(middlewares)}.`); | ||
} | ||
@@ -419,3 +419,3 @@ let resolver = this; | ||
const newResolver = this.clone(Object.assign({ name: 'wrap', parent: prevResolver }, newResolverOpts)); | ||
if (is_1.isFunction(cb)) { | ||
if ((0, is_1.isFunction)(cb)) { | ||
const resolver = cb(newResolver, prevResolver); | ||
@@ -458,3 +458,3 @@ if (resolver) | ||
type: this.getType(), | ||
args: misc_1.mapEachKey(this.getArgs(), (ac) => (Object.assign(Object.assign({}, ac), { type: ac.type.getType() }))), | ||
args: (0, misc_1.mapEachKey)(this.getArgs(), (ac) => (Object.assign(Object.assign({}, ac), { type: ac.type.getType() }))), | ||
resolve: this.getFieldResolver(opts), | ||
@@ -471,8 +471,8 @@ }; | ||
return (source, args, context, info) => { | ||
let projection = projection_1.getProjectionFromAST(info); | ||
let projection = (0, projection_1.getProjectionFromAST)(info); | ||
if (this.projection) { | ||
projection = deepmerge_1.deepmerge(projection, this.projection); | ||
projection = (0, deepmerge_1.deepmerge)(projection, this.projection); | ||
} | ||
if (opts.projection) { | ||
projection = deepmerge_1.deepmerge(projection, opts.projection); | ||
projection = (0, deepmerge_1.deepmerge)(projection, opts.projection); | ||
} | ||
@@ -508,3 +508,3 @@ return resolve({ source, args, context, info, projection }); | ||
get(path) { | ||
return typeByPath_1.typeByPath(this, path); | ||
return (0, typeByPath_1.typeByPath)(this, path); | ||
} | ||
@@ -549,3 +549,3 @@ clone(opts = {}) { | ||
} | ||
cloned.args = misc_1.mapEachKey(this.args, (argConfig) => (Object.assign(Object.assign({}, argConfig), { type: typeHelpers_1.cloneTypeTo(argConfig.type, anotherSchemaComposer, cloneMap), extensions: Object.assign({}, argConfig.extensions) }))); | ||
cloned.args = (0, misc_1.mapEachKey)(this.args, (argConfig) => (Object.assign(Object.assign({}, argConfig), { type: (0, typeHelpers_1.cloneTypeTo)(argConfig.type, anotherSchemaComposer, cloneMap), extensions: Object.assign({}, argConfig.extensions) }))); | ||
return cloned; | ||
@@ -634,3 +634,3 @@ } | ||
console.log(`ResolverResolveParams for ${this.getNestedName()}:`); | ||
const data = filterByDotPaths_1.filterByDotPaths(rp, filterPaths, { | ||
const data = (0, filterByDotPaths_1.filterByDotPaths)(rp, filterPaths, { | ||
hideFields: (rp === null || rp === void 0 ? void 0 : rp.context) && ((_a = rp.context) === null || _a === void 0 ? void 0 : _a.res) && ((_b = rp.context) === null || _b === void 0 ? void 0 : _b.params) && ((_c = rp.context) === null || _c === void 0 ? void 0 : _c.headers) | ||
@@ -658,3 +658,3 @@ ? { | ||
console.dir([ | ||
filterPaths ? filterByDotPaths_1.filterByDotPaths(res[0], filterPaths) : res[0], | ||
filterPaths ? (0, filterByDotPaths_1.filterByDotPaths)(res[0], filterPaths) : res[0], | ||
`[debug note]: Other ${res.length - 1} records was [[hidden]]. ` + | ||
@@ -665,3 +665,3 @@ 'Use debugPayload("0 1 2 3 4") or debug({ payload: "0 1 2 3 4" }) for display this records', | ||
else { | ||
console.dir(filterPaths ? filterByDotPaths_1.filterByDotPaths(res, filterPaths) : res, opts); | ||
console.dir(filterPaths ? (0, filterByDotPaths_1.filterByDotPaths)(res, filterPaths) : res, opts); | ||
} | ||
@@ -668,0 +668,0 @@ return res; |
@@ -49,3 +49,3 @@ "use strict"; | ||
if (!this._gqType.astNode) { | ||
this._gqType.astNode = definitionNode_1.getScalarTypeDefinitionNode(this); | ||
this._gqType.astNode = (0, definitionNode_1.getScalarTypeDefinitionNode)(this); | ||
} | ||
@@ -69,5 +69,5 @@ this._gqcIsModified = false; | ||
let STC; | ||
if (is_1.isString(typeDef)) { | ||
if ((0, is_1.isString)(typeDef)) { | ||
const typeName = typeDef; | ||
if (typeHelpers_1.isTypeNameString(typeName)) { | ||
if ((0, typeHelpers_1.isTypeNameString)(typeName)) { | ||
STC = new ScalarTypeComposer(new graphql_1.GraphQLScalarType({ | ||
@@ -88,3 +88,3 @@ name: typeName, | ||
} | ||
else if (is_1.isObject(typeDef)) { | ||
else if ((0, is_1.isObject)(typeDef)) { | ||
const type = new graphql_1.GraphQLScalarType(Object.assign({}, typeDef)); | ||
@@ -98,3 +98,3 @@ STC = new ScalarTypeComposer(type, sc); | ||
else { | ||
throw new Error(`You should provide GraphQLScalarTypeConfig or string with scalar name or SDL. Provided:\n${misc_1.inspect(typeDef)}`); | ||
throw new Error(`You should provide GraphQLScalarTypeConfig or string with scalar name or SDL. Provided:\n${(0, misc_1.inspect)(typeDef)}`); | ||
} | ||
@@ -130,3 +130,3 @@ return STC; | ||
this._gqcIsModified = false; | ||
this._gqType.astNode = definitionNode_1.getScalarTypeDefinitionNode(this); | ||
this._gqType.astNode = (0, definitionNode_1.getScalarTypeDefinitionNode)(this); | ||
if (graphqlVersion_1.graphqlVersion >= 14) { | ||
@@ -223,3 +223,3 @@ this._gqType.specifiedByUrl = this.getSpecifiedByUrl(); | ||
else { | ||
throw new Error(`Cannot merge ${misc_1.inspect(type)} with ScalarType(${this.getTypeName()}). Provided type should be GraphQLScalarType or ScalarTypeComposer.`); | ||
throw new Error(`Cannot merge ${(0, misc_1.inspect)(type)} with ScalarType(${this.getTypeName()}). Provided type should be GraphQLScalarType or ScalarTypeComposer.`); | ||
} | ||
@@ -306,3 +306,3 @@ return this; | ||
toSDL(opts) { | ||
return schemaPrinter_1.printScalar(this.getType(), opts); | ||
return (0, schemaPrinter_1.printScalar)(this.getType(), opts); | ||
} | ||
@@ -309,0 +309,0 @@ } |
@@ -51,3 +51,3 @@ "use strict"; | ||
if (typeof schemaOrSDL === 'string') { | ||
schema = graphql_1.buildSchema(schemaOrSDL); | ||
schema = (0, graphql_1.buildSchema)(schemaOrSDL); | ||
} | ||
@@ -61,3 +61,3 @@ else { | ||
}); | ||
misc_1.forEachKey(schema.getTypeMap(), (v, k) => { | ||
(0, misc_1.forEachKey)(schema.getTypeMap(), (v, k) => { | ||
if (k.startsWith('__')) | ||
@@ -114,11 +114,11 @@ return; | ||
this.types.forEach((type) => { | ||
typesSet.add(graphql_1.getNamedType(typeHelpers_1.getGraphQLType(type))); | ||
typesSet.add((0, graphql_1.getNamedType)((0, typeHelpers_1.getGraphQLType)(type))); | ||
}); | ||
} | ||
this._schemaMustHaveTypes.forEach((type) => { | ||
typesSet.add(graphql_1.getNamedType(typeHelpers_1.getGraphQLType(type))); | ||
typesSet.add((0, graphql_1.getNamedType)((0, typeHelpers_1.getGraphQLType)(type))); | ||
}); | ||
if (Array.isArray(extraConfig === null || extraConfig === void 0 ? void 0 : extraConfig.types)) { | ||
extraConfig === null || extraConfig === void 0 ? void 0 : extraConfig.types.forEach((type) => { | ||
typesSet.add(graphql_1.getNamedType(typeHelpers_1.getGraphQLType(type))); | ||
typesSet.add((0, graphql_1.getNamedType)((0, typeHelpers_1.getGraphQLType)(type))); | ||
}); | ||
@@ -164,5 +164,5 @@ } | ||
this.forEach((type, key) => { | ||
sc.set(key, typeHelpers_1.cloneTypeTo(type, sc, cloneMap)); | ||
sc.set(key, (0, typeHelpers_1.cloneTypeTo)(type, sc, cloneMap)); | ||
}); | ||
sc._schemaMustHaveTypes = this._schemaMustHaveTypes.map((t) => typeHelpers_1.cloneTypeTo(t, sc, cloneMap)); | ||
sc._schemaMustHaveTypes = this._schemaMustHaveTypes.map((t) => (0, typeHelpers_1.cloneTypeTo)(t, sc, cloneMap)); | ||
sc._directives = [...this._directives]; | ||
@@ -193,4 +193,4 @@ return sc; | ||
let typeName; | ||
if (typeHelpers_1.isComposeNamedType(type)) { | ||
typeName = typeHelpers_1.getComposeTypeName(type, this); | ||
if ((0, typeHelpers_1.isComposeNamedType)(type)) { | ||
typeName = (0, typeHelpers_1.getComposeTypeName)(type, this); | ||
} | ||
@@ -294,5 +294,5 @@ if (this.has(key)) { | ||
} | ||
throw new Error(dedent_1.dedent ` | ||
throw new Error((0, dedent_1.dedent) ` | ||
Cannot add resolver to the following type: | ||
${misc_1.inspect(tc)} | ||
${(0, misc_1.inspect)(tc)} | ||
`); | ||
@@ -326,3 +326,3 @@ }); | ||
} | ||
const tc = typeHelpers_1.isNamedTypeComposer(typeOrSDL) ? typeOrSDL : this.createTempTC(typeOrSDL); | ||
const tc = (0, typeHelpers_1.isNamedTypeComposer)(typeOrSDL) ? typeOrSDL : this.createTempTC(typeOrSDL); | ||
const typeName = tc.getTypeName(); | ||
@@ -341,3 +341,3 @@ this.set(typeName, tc); | ||
} | ||
if (typeHelpers_1.isTypeComposer(type)) { | ||
if ((0, typeHelpers_1.isTypeComposer)(type)) { | ||
if (type instanceof NonNullComposer_1.NonNullComposer || | ||
@@ -369,9 +369,9 @@ type instanceof ListComposer_1.ListComposer || | ||
} | ||
throw new Error(dedent_1.dedent ` | ||
throw new Error((0, dedent_1.dedent) ` | ||
Cannot create as TypeComposer the following value: | ||
${misc_1.inspect(type)}. | ||
${(0, misc_1.inspect)(type)}. | ||
`); | ||
} | ||
getOrCreateTC(typeName, onCreate) { | ||
deprecate_1.default(`Use SchemaComposer.getOrCreateOTC() method instead`); | ||
(0, deprecate_1.default)(`Use SchemaComposer.getOrCreateOTC() method instead`); | ||
return this.getOrCreateOTC(typeName, onCreate); | ||
@@ -386,3 +386,3 @@ } | ||
this.set(typeName, tc); | ||
if (onCreate && is_1.isFunction(onCreate)) | ||
if (onCreate && (0, is_1.isFunction)(onCreate)) | ||
onCreate(tc); | ||
@@ -399,3 +399,3 @@ return tc; | ||
this.set(typeName, itc); | ||
if (onCreate && is_1.isFunction(onCreate)) | ||
if (onCreate && (0, is_1.isFunction)(onCreate)) | ||
onCreate(itc); | ||
@@ -412,3 +412,3 @@ return itc; | ||
this.set(typeName, etc); | ||
if (onCreate && is_1.isFunction(onCreate)) | ||
if (onCreate && (0, is_1.isFunction)(onCreate)) | ||
onCreate(etc); | ||
@@ -425,3 +425,3 @@ return etc; | ||
this.set(typeName, iftc); | ||
if (onCreate && is_1.isFunction(onCreate)) | ||
if (onCreate && (0, is_1.isFunction)(onCreate)) | ||
onCreate(iftc); | ||
@@ -438,3 +438,3 @@ return iftc; | ||
this.set(typeName, utc); | ||
if (onCreate && is_1.isFunction(onCreate)) | ||
if (onCreate && (0, is_1.isFunction)(onCreate)) | ||
onCreate(utc); | ||
@@ -451,3 +451,3 @@ return utc; | ||
this.set(typeName, stc); | ||
if (onCreate && is_1.isFunction(onCreate)) | ||
if (onCreate && (0, is_1.isFunction)(onCreate)) | ||
onCreate(stc); | ||
@@ -522,3 +522,3 @@ return stc; | ||
} | ||
else if (typeHelpers_1.isNamedTypeComposer(type)) { | ||
else if ((0, typeHelpers_1.isNamedTypeComposer)(type)) { | ||
return type; | ||
@@ -547,4 +547,4 @@ } | ||
} | ||
throw new Error(dedent_1.dedent ` | ||
Type with name ${misc_1.inspect(typeOrName)} cannot be obtained as any Composer helper. | ||
throw new Error((0, dedent_1.dedent) ` | ||
Type with name ${(0, misc_1.inspect)(typeOrName)} cannot be obtained as any Composer helper. | ||
Put something strange? | ||
@@ -554,7 +554,7 @@ `); | ||
addAsComposer(typeOrSDL) { | ||
deprecate_1.default('Use schemaComposer.add() method instead. From v7 all types in storage saved as TypeComposers.'); | ||
(0, deprecate_1.default)('Use schemaComposer.add() method instead. From v7 all types in storage saved as TypeComposers.'); | ||
return this.add(typeOrSDL); | ||
} | ||
isObjectType(type) { | ||
if (typeof type === 'string' && typeHelpers_1.isOutputTypeDefinitionString(type)) | ||
if (typeof type === 'string' && (0, typeHelpers_1.isOutputTypeDefinitionString)(type)) | ||
return true; | ||
@@ -566,3 +566,3 @@ if (!this.has(type)) | ||
isInputObjectType(type) { | ||
if (typeof type === 'string' && typeHelpers_1.isInputTypeDefinitionString(type)) | ||
if (typeof type === 'string' && (0, typeHelpers_1.isInputTypeDefinitionString)(type)) | ||
return true; | ||
@@ -574,3 +574,3 @@ if (!this.has(type)) | ||
isScalarType(type) { | ||
if (typeof type === 'string' && typeHelpers_1.isScalarTypeDefinitionString(type)) | ||
if (typeof type === 'string' && (0, typeHelpers_1.isScalarTypeDefinitionString)(type)) | ||
return true; | ||
@@ -582,3 +582,3 @@ if (!this.has(type)) | ||
isEnumType(type) { | ||
if (typeof type === 'string' && typeHelpers_1.isEnumTypeDefinitionString(type)) | ||
if (typeof type === 'string' && (0, typeHelpers_1.isEnumTypeDefinitionString)(type)) | ||
return true; | ||
@@ -590,3 +590,3 @@ if (!this.has(type)) | ||
isInterfaceType(type) { | ||
if (typeof type === 'string' && typeHelpers_1.isInterfaceTypeDefinitionString(type)) | ||
if (typeof type === 'string' && (0, typeHelpers_1.isInterfaceTypeDefinitionString)(type)) | ||
return true; | ||
@@ -598,3 +598,3 @@ if (!this.has(type)) | ||
isUnionType(type) { | ||
if (typeof type === 'string' && typeHelpers_1.isUnionTypeDefinitionString(type)) | ||
if (typeof type === 'string' && (0, typeHelpers_1.isUnionTypeDefinitionString)(type)) | ||
return true; | ||
@@ -615,5 +615,5 @@ if (!this.has(type)) | ||
set(key, value) { | ||
if (!typeHelpers_1.isNamedTypeComposer(value)) { | ||
deprecate_1.default(`SchemaComposer.set() accept only TypeComposers. ` + | ||
`You provide with key ${misc_1.inspect(key)} the following wrong value ${misc_1.inspect(value)}.`); | ||
if (!(0, typeHelpers_1.isNamedTypeComposer)(value)) { | ||
(0, deprecate_1.default)(`SchemaComposer.set() accept only TypeComposers. ` + | ||
`You provide with key ${(0, misc_1.inspect)(key)} the following wrong value ${(0, misc_1.inspect)(value)}.`); | ||
} | ||
@@ -625,5 +625,5 @@ super.set(key, value); | ||
if (!(directive instanceof graphql_1.GraphQLDirective)) { | ||
throw new Error(dedent_1.dedent ` | ||
throw new Error((0, dedent_1.dedent) ` | ||
You should provide GraphQLDirective to schemaComposer.addDirective(), but received: | ||
${misc_1.inspect(directive)} | ||
${(0, misc_1.inspect)(directive)} | ||
`); | ||
@@ -680,3 +680,3 @@ } | ||
const opts = Object.assign({ sortTypes: 'GROUP_BY_TYPE' }, options); | ||
return schemaPrinter_1.printSchemaComposer(this, opts); | ||
return (0, schemaPrinter_1.printSchemaComposer)(this, opts); | ||
} | ||
@@ -686,3 +686,3 @@ getResolveMethods(opts) { | ||
const exclude = (opts === null || opts === void 0 ? void 0 : opts.exclude) || []; | ||
schemaVisitor_1.visitSchema(this, { | ||
(0, schemaVisitor_1.visitSchema)(this, { | ||
OBJECT_TYPE: (tc) => { | ||
@@ -692,3 +692,3 @@ const typename = tc.getTypeName(); | ||
return; | ||
misc_1.forEachKey(tc.getFields(), (fc, fieldName) => { | ||
(0, misc_1.forEachKey)(tc.getFields(), (fc, fieldName) => { | ||
if (!fc.resolve || fc.resolve === graphql_1.defaultFieldResolver) | ||
@@ -707,3 +707,3 @@ return; | ||
const internalValues = {}; | ||
misc_1.forEachKey(tc.getFields(), (fc, fieldName) => { | ||
(0, misc_1.forEachKey)(tc.getFields(), (fc, fieldName) => { | ||
if (fc.value !== fieldName) | ||
@@ -710,0 +710,0 @@ hasDifferentIntervalValues = true; |
@@ -20,3 +20,3 @@ "use strict"; | ||
if (!this._typeFromThunk) { | ||
throw new Error(`ThunkComposer(${this._typeName || ''}) returns empty value: ${misc_1.inspect(this._typeFromThunk)}`); | ||
throw new Error(`ThunkComposer(${this._typeName || ''}) returns empty value: ${(0, misc_1.inspect)(this._typeFromThunk)}`); | ||
} | ||
@@ -32,3 +32,3 @@ return this._typeFromThunk; | ||
getTypeName() { | ||
if (this._typeFromThunk && is_1.isFunction(this._typeFromThunk.getTypeName)) { | ||
if (this._typeFromThunk && (0, is_1.isFunction)(this._typeFromThunk.getTypeName)) { | ||
return this._typeFromThunk.getTypeName(); | ||
@@ -35,0 +35,0 @@ } |
@@ -49,40 +49,40 @@ "use strict"; | ||
static isOutputType(type) { | ||
deprecate_1.default("Use `import { isSomeOutputTypeComposer } from './utils/typeHelpers'` instead."); | ||
return typeHelpers_1.isSomeOutputTypeComposer(type); | ||
(0, deprecate_1.default)("Use `import { isSomeOutputTypeComposer } from './utils/typeHelpers'` instead."); | ||
return (0, typeHelpers_1.isSomeOutputTypeComposer)(type); | ||
} | ||
static isInputType(type) { | ||
deprecate_1.default("Use `import { isSomeInputTypeComposer } from './utils/typeHelpers'` instead."); | ||
return typeHelpers_1.isSomeInputTypeComposer(type); | ||
(0, deprecate_1.default)("Use `import { isSomeInputTypeComposer } from './utils/typeHelpers'` instead."); | ||
return (0, typeHelpers_1.isSomeInputTypeComposer)(type); | ||
} | ||
static isTypeNameString(str) { | ||
deprecate_1.default("Use `import { isTypeNameString } from './utils/typeHelpers'` instead."); | ||
return typeHelpers_1.isTypeNameString(str); | ||
(0, deprecate_1.default)("Use `import { isTypeNameString } from './utils/typeHelpers'` instead."); | ||
return (0, typeHelpers_1.isTypeNameString)(str); | ||
} | ||
static isTypeDefinitionString(str) { | ||
deprecate_1.default("Use `import { isTypeDefinitionString } from './utils/typeHelpers'` instead."); | ||
return typeHelpers_1.isTypeDefinitionString(str); | ||
(0, deprecate_1.default)("Use `import { isTypeDefinitionString } from './utils/typeHelpers'` instead."); | ||
return (0, typeHelpers_1.isTypeDefinitionString)(str); | ||
} | ||
static isOutputTypeDefinitionString(str) { | ||
deprecate_1.default("Use `import { isOutputTypeDefinitionString } from './utils/typeHelpers'` instead."); | ||
return typeHelpers_1.isOutputTypeDefinitionString(str); | ||
(0, deprecate_1.default)("Use `import { isOutputTypeDefinitionString } from './utils/typeHelpers'` instead."); | ||
return (0, typeHelpers_1.isOutputTypeDefinitionString)(str); | ||
} | ||
static isInputTypeDefinitionString(str) { | ||
deprecate_1.default("Use `import { isInputTypeDefinitionString } from './utils/typeHelpers'` instead."); | ||
return typeHelpers_1.isInputTypeDefinitionString(str); | ||
(0, deprecate_1.default)("Use `import { isInputTypeDefinitionString } from './utils/typeHelpers'` instead."); | ||
return (0, typeHelpers_1.isInputTypeDefinitionString)(str); | ||
} | ||
static isEnumTypeDefinitionString(str) { | ||
deprecate_1.default("Use `import { isEnumTypeDefinitionString } from './utils/typeHelpers'` instead."); | ||
return typeHelpers_1.isEnumTypeDefinitionString(str); | ||
(0, deprecate_1.default)("Use `import { isEnumTypeDefinitionString } from './utils/typeHelpers'` instead."); | ||
return (0, typeHelpers_1.isEnumTypeDefinitionString)(str); | ||
} | ||
static isScalarTypeDefinitionString(str) { | ||
deprecate_1.default("Use `import { isScalarTypeDefinitionString } from './utils/typeHelpers'` instead."); | ||
return typeHelpers_1.isScalarTypeDefinitionString(str); | ||
(0, deprecate_1.default)("Use `import { isScalarTypeDefinitionString } from './utils/typeHelpers'` instead."); | ||
return (0, typeHelpers_1.isScalarTypeDefinitionString)(str); | ||
} | ||
static isInterfaceTypeDefinitionString(str) { | ||
deprecate_1.default("Use `import { isInterfaceTypeDefinitionString } from './utils/typeHelpers'` instead."); | ||
return typeHelpers_1.isInterfaceTypeDefinitionString(str); | ||
(0, deprecate_1.default)("Use `import { isInterfaceTypeDefinitionString } from './utils/typeHelpers'` instead."); | ||
return (0, typeHelpers_1.isInterfaceTypeDefinitionString)(str); | ||
} | ||
static isUnionTypeDefinitionString(str) { | ||
deprecate_1.default("Use `import { isUnionTypeDefinitionString } from './utils/typeHelpers'` instead."); | ||
return typeHelpers_1.isUnionTypeDefinitionString(str); | ||
(0, deprecate_1.default)("Use `import { isUnionTypeDefinitionString } from './utils/typeHelpers'` instead."); | ||
return (0, typeHelpers_1.isUnionTypeDefinitionString)(str); | ||
} | ||
@@ -114,6 +114,6 @@ convertGraphQLTypeToComposer(type) { | ||
} | ||
throw new Error(`Cannot convert to Composer the following value: ${misc_2.inspect(type)}`); | ||
throw new Error(`Cannot convert to Composer the following value: ${(0, misc_2.inspect)(type)}`); | ||
} | ||
convertSDLWrappedTypeName(str) { | ||
const typeAST = parser_1.parseType(str); | ||
const typeAST = (0, parser_1.parseType)(str); | ||
return this.typeFromAST(typeAST); | ||
@@ -125,3 +125,3 @@ } | ||
} | ||
const astDocument = parser_1.parse(str); | ||
const astDocument = (0, parser_1.parse)(str); | ||
if (!astDocument || astDocument.kind !== language_1.Kind.DOCUMENT) { | ||
@@ -142,4 +142,4 @@ throw new Error('You should provide correct type syntax. ' + | ||
if (typeof typeDef === 'string') { | ||
if (typeHelpers_1.isInputTypeDefinitionString(typeDef)) { | ||
throw new Error(`Should be OutputType, but got input type definition: ${misc_2.inspect(typeDef)}'`); | ||
if ((0, typeHelpers_1.isInputTypeDefinitionString)(typeDef)) { | ||
throw new Error(`Should be OutputType, but got input type definition: ${(0, misc_2.inspect)(typeDef)}'`); | ||
} | ||
@@ -151,15 +151,15 @@ let tc; | ||
else { | ||
tc = typeHelpers_1.isTypeDefinitionString(typeDef) | ||
tc = (0, typeHelpers_1.isTypeDefinitionString)(typeDef) | ||
? this.convertSDLTypeDefinition(typeDef) | ||
: this.convertSDLWrappedTypeName(typeDef); | ||
if (!tc) { | ||
throw new Error(`Cannot convert to OutputType the following string: ${misc_2.inspect(typeDef)}`); | ||
throw new Error(`Cannot convert to OutputType the following string: ${(0, misc_2.inspect)(typeDef)}`); | ||
} | ||
} | ||
if (!typeHelpers_1.isSomeOutputTypeComposer(tc)) { | ||
throw new Error(`Provided incorrect OutputType: ${misc_2.inspect(typeDef)}`); | ||
if (!(0, typeHelpers_1.isSomeOutputTypeComposer)(tc)) { | ||
throw new Error(`Provided incorrect OutputType: ${(0, misc_2.inspect)(typeDef)}`); | ||
} | ||
return tc; | ||
} | ||
else if (typeHelpers_1.isSomeOutputTypeComposer(typeDef)) { | ||
else if ((0, typeHelpers_1.isSomeOutputTypeComposer)(typeDef)) { | ||
return typeDef; | ||
@@ -169,16 +169,16 @@ } | ||
if (typeDef.length !== 1) { | ||
throw new Error(`Array must have exact one output type definition, but has ${typeDef.length}: ${misc_2.inspect(typeDef)}`); | ||
throw new Error(`Array must have exact one output type definition, but has ${typeDef.length}: ${(0, misc_2.inspect)(typeDef)}`); | ||
} | ||
const tc = this.convertOutputTypeDefinition(typeDef[0], fieldName, typeName); | ||
if (!tc) { | ||
throw new Error(`Cannot construct TypeComposer from ${misc_2.inspect(typeDef)}`); | ||
throw new Error(`Cannot construct TypeComposer from ${(0, misc_2.inspect)(typeDef)}`); | ||
} | ||
return new ListComposer_1.ListComposer(tc); | ||
} | ||
else if (is_1.isFunction(typeDef)) { | ||
else if ((0, is_1.isFunction)(typeDef)) { | ||
return new ThunkComposer_1.ThunkComposer(() => { | ||
const def = typeDef(this.schemaComposer); | ||
const tc = this.convertOutputFieldConfig(def, fieldName, typeName).type; | ||
if (!typeHelpers_1.isSomeOutputTypeComposer(tc)) { | ||
throw new Error(`Provided incorrect OutputType: Function[${misc_2.inspect(def)}]`); | ||
if (!(0, typeHelpers_1.isSomeOutputTypeComposer)(tc)) { | ||
throw new Error(`Provided incorrect OutputType: Function[${(0, misc_2.inspect)(def)}]`); | ||
} | ||
@@ -193,7 +193,7 @@ return tc; | ||
const type = this.convertGraphQLTypeToComposer(typeDef); | ||
if (typeHelpers_1.isSomeOutputTypeComposer(type)) { | ||
if ((0, typeHelpers_1.isSomeOutputTypeComposer)(type)) { | ||
return type; | ||
} | ||
else { | ||
throw new Error(`Provided incorrect OutputType: ${misc_2.inspect(type)}`); | ||
throw new Error(`Provided incorrect OutputType: ${(0, misc_2.inspect)(type)}`); | ||
} | ||
@@ -209,3 +209,3 @@ } | ||
if (typeDef instanceof InputTypeComposer_1.InputTypeComposer) { | ||
throw new Error(`Should be OutputType, but provided InputTypeComposer ${misc_2.inspect(typeDef)}`); | ||
throw new Error(`Should be OutputType, but provided InputTypeComposer ${(0, misc_2.inspect)(typeDef)}`); | ||
} | ||
@@ -218,3 +218,3 @@ return undefined; | ||
if (!composeFC) { | ||
throw new Error(`You provide empty output field definition: ${misc_2.inspect(composeFC)}`); | ||
throw new Error(`You provide empty output field definition: ${(0, misc_2.inspect)(composeFC)}`); | ||
} | ||
@@ -236,6 +236,6 @@ if (composeFC instanceof Resolver_1.Resolver) { | ||
} | ||
if (is_1.isObject(composeFC)) { | ||
if ((0, is_1.isObject)(composeFC)) { | ||
const _f = composeFC, { type, args } = _f, rest = __rest(_f, ["type", "args"]); | ||
if (!type) { | ||
throw new Error(`Definition object should contain 'type' property: ${misc_2.inspect(composeFC)}`); | ||
throw new Error(`Definition object should contain 'type' property: ${(0, misc_2.inspect)(composeFC)}`); | ||
} | ||
@@ -262,3 +262,3 @@ const tc = this.convertOutputTypeDefinition(type, fieldName, typeName); | ||
} | ||
throw new Error(`Cannot convert to OutputType the following value: ${misc_2.inspect(composeFC)}`); | ||
throw new Error(`Cannot convert to OutputType the following value: ${(0, misc_2.inspect)(composeFC)}`); | ||
} | ||
@@ -281,3 +281,3 @@ catch (e) { | ||
if (!composeAC) { | ||
throw new Error(`You provide empty argument config ${misc_2.inspect(composeAC)}`); | ||
throw new Error(`You provide empty argument config ${(0, misc_2.inspect)(composeAC)}`); | ||
} | ||
@@ -288,6 +288,6 @@ const tcFromAC = this.convertInputTypeDefinition(composeAC); | ||
} | ||
if (is_1.isObject(composeAC)) { | ||
if ((0, is_1.isObject)(composeAC)) { | ||
const _f = composeAC, { type } = _f, rest = __rest(_f, ["type"]); | ||
if (!type) { | ||
throw new Error(`Definition object should contain 'type' property: ${misc_2.inspect(composeAC)}'`); | ||
throw new Error(`Definition object should contain 'type' property: ${(0, misc_2.inspect)(composeAC)}'`); | ||
} | ||
@@ -314,3 +314,3 @@ const tc = this.convertInputTypeDefinition(type); | ||
} | ||
throw new Error(`Cannot convert to InputType the following value: ${misc_2.inspect(tcFromAC)}`); | ||
throw new Error(`Cannot convert to InputType the following value: ${(0, misc_2.inspect)(tcFromAC)}`); | ||
} | ||
@@ -333,4 +333,4 @@ catch (e) { | ||
if (typeof typeDef === 'string') { | ||
if (typeHelpers_1.isOutputTypeDefinitionString(typeDef)) { | ||
throw new Error(`Should be InputType, but got output type definition: ${misc_2.inspect(typeDef)}`); | ||
if ((0, typeHelpers_1.isOutputTypeDefinitionString)(typeDef)) { | ||
throw new Error(`Should be InputType, but got output type definition: ${(0, misc_2.inspect)(typeDef)}`); | ||
} | ||
@@ -342,15 +342,15 @@ let tc; | ||
else { | ||
tc = typeHelpers_1.isTypeDefinitionString(typeDef) | ||
tc = (0, typeHelpers_1.isTypeDefinitionString)(typeDef) | ||
? this.convertSDLTypeDefinition(typeDef) | ||
: this.convertSDLWrappedTypeName(typeDef); | ||
if (!tc) { | ||
throw new Error(`Cannot convert to InputType the following string: ${misc_2.inspect(typeDef)}`); | ||
throw new Error(`Cannot convert to InputType the following string: ${(0, misc_2.inspect)(typeDef)}`); | ||
} | ||
} | ||
if (!typeHelpers_1.isSomeInputTypeComposer(tc)) { | ||
throw new Error(`Provided incorrect InputType: ${misc_2.inspect(typeDef)}`); | ||
if (!(0, typeHelpers_1.isSomeInputTypeComposer)(tc)) { | ||
throw new Error(`Provided incorrect InputType: ${(0, misc_2.inspect)(typeDef)}`); | ||
} | ||
return tc; | ||
} | ||
else if (typeHelpers_1.isSomeInputTypeComposer(typeDef)) { | ||
else if ((0, typeHelpers_1.isSomeInputTypeComposer)(typeDef)) { | ||
return typeDef; | ||
@@ -360,16 +360,16 @@ } | ||
if (typeDef.length !== 1) { | ||
throw new Error(`Array must have exact one input type definition, but has ${typeDef.length}: ${misc_2.inspect(typeDef)}`); | ||
throw new Error(`Array must have exact one input type definition, but has ${typeDef.length}: ${(0, misc_2.inspect)(typeDef)}`); | ||
} | ||
const tc = this.convertInputTypeDefinition(typeDef[0], fieldName, typeName); | ||
if (!tc) { | ||
throw new Error(`Cannot construct TypeComposer from ${misc_2.inspect(typeDef)}`); | ||
throw new Error(`Cannot construct TypeComposer from ${(0, misc_2.inspect)(typeDef)}`); | ||
} | ||
return new ListComposer_1.ListComposer(tc); | ||
} | ||
else if (is_1.isFunction(typeDef)) { | ||
else if ((0, is_1.isFunction)(typeDef)) { | ||
return new ThunkComposer_1.ThunkComposer(() => { | ||
const def = typeDef(this.schemaComposer); | ||
const tc = this.convertInputFieldConfig(def, fieldName, typeName).type; | ||
if (!typeHelpers_1.isSomeInputTypeComposer(tc)) { | ||
throw new Error(`Provided incorrect InputType: Function[${misc_2.inspect(def)}]`); | ||
if (!(0, typeHelpers_1.isSomeInputTypeComposer)(tc)) { | ||
throw new Error(`Provided incorrect InputType: Function[${(0, misc_2.inspect)(def)}]`); | ||
} | ||
@@ -381,7 +381,7 @@ return tc; | ||
const type = this.convertGraphQLTypeToComposer(typeDef); | ||
if (typeHelpers_1.isSomeInputTypeComposer(type)) { | ||
if ((0, typeHelpers_1.isSomeInputTypeComposer)(type)) { | ||
return type; | ||
} | ||
else { | ||
throw new Error(`Provided incorrect InputType: ${misc_2.inspect(type)}`); | ||
throw new Error(`Provided incorrect InputType: ${(0, misc_2.inspect)(type)}`); | ||
} | ||
@@ -395,3 +395,3 @@ } | ||
if (typeDef instanceof ObjectTypeComposer_1.ObjectTypeComposer) { | ||
throw new Error(`Should be InputType, but provided ObjectTypeComposer ${misc_2.inspect(typeDef)}`); | ||
throw new Error(`Should be InputType, but provided ObjectTypeComposer ${(0, misc_2.inspect)(typeDef)}`); | ||
} | ||
@@ -404,3 +404,3 @@ return undefined; | ||
if (!composeIFC) { | ||
throw new Error(`You provide empty input field definition: ${misc_2.inspect(composeIFC)}`); | ||
throw new Error(`You provide empty input field definition: ${(0, misc_2.inspect)(composeIFC)}`); | ||
} | ||
@@ -411,6 +411,6 @@ const tcFromIFC = this.convertInputTypeDefinition(composeIFC, fieldName, typeName); | ||
} | ||
if (is_1.isObject(composeIFC)) { | ||
if ((0, is_1.isObject)(composeIFC)) { | ||
const _f = composeIFC, { type } = _f, rest = __rest(_f, ["type"]); | ||
if (!type) { | ||
throw new Error(`Definition object should contain 'type' property: ${misc_2.inspect(composeIFC)}`); | ||
throw new Error(`Definition object should contain 'type' property: ${(0, misc_2.inspect)(composeIFC)}`); | ||
} | ||
@@ -437,3 +437,3 @@ const tc = this.convertInputTypeDefinition(type, fieldName, typeName); | ||
} | ||
throw new Error(`Cannot convert to InputType the following value: ${misc_2.inspect(composeIFC)}`); | ||
throw new Error(`Cannot convert to InputType the following value: ${(0, misc_2.inspect)(composeIFC)}`); | ||
} | ||
@@ -457,7 +457,7 @@ catch (e) { | ||
else if (typeof typeDef === 'string') { | ||
const tc = typeHelpers_1.isInterfaceTypeDefinitionString(typeDef) | ||
const tc = (0, typeHelpers_1.isInterfaceTypeDefinitionString)(typeDef) | ||
? this.convertSDLTypeDefinition(typeDef) | ||
: this.convertSDLWrappedTypeName(typeDef); | ||
if (!(tc instanceof InterfaceTypeComposer_1.InterfaceTypeComposer) && !(tc instanceof ThunkComposer_1.ThunkComposer)) { | ||
throw new Error(`Cannot convert to InterfaceType the following definition: ${misc_2.inspect(typeDef)}`); | ||
throw new Error(`Cannot convert to InterfaceType the following definition: ${(0, misc_2.inspect)(typeDef)}`); | ||
} | ||
@@ -472,9 +472,9 @@ return tc; | ||
} | ||
else if (is_1.isFunction(typeDef)) { | ||
else if ((0, is_1.isFunction)(typeDef)) { | ||
return new ThunkComposer_1.ThunkComposer(() => this.convertInterfaceTypeDefinition(typeDef(this.schemaComposer))); | ||
} | ||
throw new Error(`Cannot convert to InterfaceType the following definition: ${misc_2.inspect(typeDef)}`); | ||
throw new Error(`Cannot convert to InterfaceType the following definition: ${(0, misc_2.inspect)(typeDef)}`); | ||
} | ||
parseTypesFromString(str) { | ||
const astDocument = parser_1.parse(str); | ||
const astDocument = (0, parser_1.parse)(str); | ||
if (!astDocument || astDocument.kind !== 'Document') { | ||
@@ -508,3 +508,3 @@ throw new Error('You should provide correct SDL syntax.'); | ||
} | ||
misc_1.invariant(typeNode.kind === language_1.Kind.NAMED_TYPE, `Must be a named type for ${misc_2.inspect(typeNode)}.`); | ||
(0, misc_1.invariant)(typeNode.kind === language_1.Kind.NAMED_TYPE, `Must be a named type for ${(0, misc_2.inspect)(typeNode)}.`); | ||
const typeName = typeNode.name.value; | ||
@@ -523,4 +523,4 @@ if (this.schemaComposer.has(typeName)) { | ||
const tc = this.typeFromAST(typeNode); | ||
if (!typeHelpers_1.isSomeInputTypeComposer(tc)) { | ||
throw new Error(`TypeAST should be for Input types. But received ${misc_2.inspect(typeNode)}`); | ||
if (!(0, typeHelpers_1.isSomeInputTypeComposer)(tc)) { | ||
throw new Error(`TypeAST should be for Input types. But received ${(0, misc_2.inspect)(typeNode)}`); | ||
} | ||
@@ -531,4 +531,4 @@ return tc; | ||
const tc = this.typeFromAST(typeNode); | ||
if (!typeHelpers_1.isSomeOutputTypeComposer(tc)) { | ||
throw new Error(`TypeAST should be for Output types. But received ${misc_2.inspect(typeNode)}`); | ||
if (!(0, typeHelpers_1.isSomeOutputTypeComposer)(tc)) { | ||
throw new Error(`TypeAST should be for Output types. But received ${(0, misc_2.inspect)(typeNode)}`); | ||
} | ||
@@ -603,4 +603,4 @@ return tc; | ||
const wrappedType = this.buildWrappedTypeDef(typeDef, value.type); | ||
if (typeHelpers_1.isSomeInputTypeComposer(wrappedType)) { | ||
ac.defaultValue = graphql_1.valueFromAST(value.defaultValue, wrappedType.getType()); | ||
if ((0, typeHelpers_1.isSomeInputTypeComposer)(wrappedType)) { | ||
ac.defaultValue = (0, graphql_1.valueFromAST)(value.defaultValue, wrappedType.getType()); | ||
} | ||
@@ -619,3 +619,3 @@ else { | ||
return {}; | ||
return misc_2.keyValMap(def.fields, (field) => field.name.value, (field) => { | ||
return (0, misc_2.keyValMap)(def.fields, (field) => field.name.value, (field) => { | ||
const fc = { | ||
@@ -635,3 +635,3 @@ type: this.typeFromASTOutput(field.type), | ||
return {}; | ||
return misc_2.keyValMap(def.fields, (field) => field.name.value, (field) => { | ||
return (0, misc_2.keyValMap)(def.fields, (field) => field.name.value, (field) => { | ||
const fc = { | ||
@@ -660,3 +660,3 @@ type: this.typeFromASTInput(field.type), | ||
return {}; | ||
return misc_2.keyValMap(def.values, (enumValue) => enumValue.name.value, (enumValue) => { | ||
return (0, misc_2.keyValMap)(def.values, (enumValue) => enumValue.name.value, (enumValue) => { | ||
const ec = { | ||
@@ -687,7 +687,7 @@ description: getDescription(enumValue), | ||
const wrappedType = this.typeFromAST(value.type); | ||
if (typeHelpers_1.isSomeInputTypeComposer(wrappedType)) { | ||
if ((0, typeHelpers_1.isSomeInputTypeComposer)(wrappedType)) { | ||
val = { | ||
type: wrappedType.getType(), | ||
description: getDescription(value), | ||
defaultValue: graphql_1.valueFromAST(value.defaultValue, wrappedType.getType()), | ||
defaultValue: (0, graphql_1.valueFromAST)(value.defaultValue, wrappedType.getType()), | ||
}; | ||
@@ -850,3 +850,3 @@ } | ||
} | ||
const { reason } = values_1.getArgumentValues(graphql_1.GraphQLDeprecatedDirective, deprecatedAST); | ||
const { reason } = (0, values_1.getArgumentValues)(graphql_1.GraphQLDeprecatedDirective, deprecatedAST); | ||
return reason; | ||
@@ -862,4 +862,4 @@ } | ||
const args = directiveDef | ||
? values_1.getArgumentValues(directiveDef, directive) | ||
: misc_2.keyValMap(directive.arguments || [], (arg) => arg.name.value, (arg) => definitionNode_1.parseValueNode(arg.value)); | ||
? (0, values_1.getArgumentValues)(directiveDef, directive) | ||
: (0, misc_2.keyValMap)(directive.arguments || [], (arg) => arg.name.value, (arg) => (0, definitionNode_1.parseValueNode)(arg.value)); | ||
result.push({ name, args }); | ||
@@ -927,3 +927,3 @@ }); | ||
if (rawValue !== undefined) { | ||
return blockString_1.dedentBlockStringValue('\n' + rawValue); | ||
return (0, blockString_1.dedentBlockStringValue)('\n' + rawValue); | ||
} | ||
@@ -930,0 +930,0 @@ } |
@@ -28,3 +28,3 @@ "use strict"; | ||
if (!v) { | ||
throw new Error(`Type with name ${misc_1.inspect(typeName)} does not exists`); | ||
throw new Error(`Type with name ${(0, misc_1.inspect)(typeName)} does not exists`); | ||
} | ||
@@ -76,3 +76,3 @@ return v; | ||
} | ||
const gqType = is_1.isFunction(typeOrThunk) ? typeOrThunk(this) : typeOrThunk; | ||
const gqType = (0, is_1.isFunction)(typeOrThunk) ? typeOrThunk(this) : typeOrThunk; | ||
if (gqType) { | ||
@@ -79,0 +79,0 @@ this.set(typeName, gqType); |
@@ -58,3 +58,3 @@ "use strict"; | ||
} | ||
types = configToDefine_1.convertObjectTypeArrayAsThunk(types, this.schemaComposer); | ||
types = (0, configToDefine_1.convertObjectTypeArrayAsThunk)(types, this.schemaComposer); | ||
this._gqcTypes = new Set(); | ||
@@ -66,3 +66,3 @@ types.forEach((type) => { | ||
if (!this._gqType.astNode) { | ||
this._gqType.astNode = definitionNode_1.getUnionTypeDefinitionNode(this); | ||
this._gqType.astNode = (0, definitionNode_1.getUnionTypeDefinitionNode)(this); | ||
} | ||
@@ -85,5 +85,5 @@ this._gqcIsModified = false; | ||
let UTC; | ||
if (is_1.isString(typeDef)) { | ||
if ((0, is_1.isString)(typeDef)) { | ||
const typeName = typeDef; | ||
if (typeHelpers_1.isTypeNameString(typeName)) { | ||
if ((0, typeHelpers_1.isTypeNameString)(typeName)) { | ||
UTC = new UnionTypeComposer(new graphql_1.GraphQLUnionType({ | ||
@@ -105,3 +105,3 @@ name: typeName, | ||
} | ||
else if (is_1.isObject(typeDef)) { | ||
else if ((0, is_1.isObject)(typeDef)) { | ||
const type = new graphql_1.GraphQLUnionType(Object.assign(Object.assign({}, typeDef), { types: () => [] })); | ||
@@ -112,4 +112,4 @@ UTC = new UnionTypeComposer(type, sc); | ||
UTC.setTypes(types); | ||
else if (is_1.isFunction(types)) { | ||
UTC.setTypes(configToDefine_1.convertObjectTypeArrayAsThunk(types, sc)); | ||
else if ((0, is_1.isFunction)(types)) { | ||
UTC.setTypes((0, configToDefine_1.convertObjectTypeArrayAsThunk)(types, sc)); | ||
} | ||
@@ -122,3 +122,3 @@ UTC.setExtensions(typeDef.extensions); | ||
else { | ||
throw new Error(`You should provide GraphQLUnionTypeConfig or string with union name or SDL definition. Provided:\n${misc_1.inspect(typeDef)}`); | ||
throw new Error(`You should provide GraphQLUnionTypeConfig or string with union name or SDL definition. Provided:\n${(0, misc_1.inspect)(typeDef)}`); | ||
} | ||
@@ -128,3 +128,3 @@ return UTC; | ||
hasType(name) { | ||
const typeName = typeHelpers_1.getComposeTypeName(name, this.schemaComposer); | ||
const typeName = (0, typeHelpers_1.getComposeTypeName)(name, this.schemaComposer); | ||
for (const type of this._gqcTypes) { | ||
@@ -141,3 +141,3 @@ if (type.getTypeName() === typeName) { | ||
getTypeComposers() { | ||
return this.getTypes().map((t) => typeHelpers_1.unwrapOutputTC(t)); | ||
return this.getTypes().map((t) => (0, typeHelpers_1.unwrapOutputTC)(t)); | ||
} | ||
@@ -153,3 +153,3 @@ getTypeNames() { | ||
setTypes(types) { | ||
const tcs = configToDefine_1.convertObjectTypeArrayAsThunk(types, this.schemaComposer); | ||
const tcs = (0, configToDefine_1.convertObjectTypeArrayAsThunk)(types, this.schemaComposer); | ||
this._gqcTypes = new Set(tcs); | ||
@@ -198,3 +198,3 @@ this._gqcIsModified = true; | ||
this._gqcIsModified = false; | ||
this._gqType.astNode = definitionNode_1.getUnionTypeDefinitionNode(this); | ||
this._gqType.astNode = (0, definitionNode_1.getUnionTypeDefinitionNode)(this); | ||
const prepareTypes = () => { | ||
@@ -277,3 +277,3 @@ try { | ||
typeResolversMap.forEach((fn, tc) => { | ||
const clonedTC = typeHelpers_1.cloneTypeTo(tc, anotherSchemaComposer, cloneMap); | ||
const clonedTC = (0, typeHelpers_1.cloneTypeTo)(tc, anotherSchemaComposer, cloneMap); | ||
clonedTypeResolvers.set(clonedTC, fn); | ||
@@ -284,7 +284,7 @@ }); | ||
if (this._gqcFallbackResolveType) { | ||
cloned._gqcFallbackResolveType = typeHelpers_1.cloneTypeTo(this._gqcFallbackResolveType, anotherSchemaComposer, cloneMap); | ||
cloned._gqcFallbackResolveType = (0, typeHelpers_1.cloneTypeTo)(this._gqcFallbackResolveType, anotherSchemaComposer, cloneMap); | ||
} | ||
const types = this.getTypes(); | ||
if (types.length > 0) { | ||
cloned.setTypes(types.map((tc) => typeHelpers_1.cloneTypeTo(tc, anotherSchemaComposer, cloneMap))); | ||
cloned.setTypes(types.map((tc) => (0, typeHelpers_1.cloneTypeTo)(tc, anotherSchemaComposer, cloneMap))); | ||
} | ||
@@ -302,3 +302,3 @@ return cloned; | ||
else { | ||
throw new Error(`Cannot merge ${misc_1.inspect(type)} with UnionType(${this.getTypeName()}). Provided type should be GraphQLUnionType or UnionTypeComposer.`); | ||
throw new Error(`Cannot merge ${(0, misc_1.inspect)(type)} with UnionType(${this.getTypeName()}). Provided type should be GraphQLUnionType or UnionTypeComposer.`); | ||
} | ||
@@ -328,3 +328,3 @@ this.addTypes(tc.getTypes().map((t) => t.getTypeName())); | ||
if (!typeResolversMap.has(tc)) { | ||
throw new Error(`Type resolve function in union '${this.getTypeName()}' is not defined for type ${misc_1.inspect(type)}.`); | ||
throw new Error(`Type resolve function in union '${this.getTypeName()}' is not defined for type ${(0, misc_1.inspect)(type)}.`); | ||
} | ||
@@ -353,3 +353,3 @@ return typeResolversMap.get(tc); | ||
const fallbackType = this._gqcFallbackResolveType | ||
? typeHelpers_1.getGraphQLType(this._gqcFallbackResolveType) | ||
? (0, typeHelpers_1.getGraphQLType)(this._gqcFallbackResolveType) | ||
: undefined; | ||
@@ -359,3 +359,3 @@ const fastEntries = []; | ||
for (const [composeType, checkFn] of this._gqcTypeResolvers.entries()) { | ||
fastEntries.push([typeHelpers_1.getComposeTypeName(composeType, this.schemaComposer), checkFn]); | ||
fastEntries.push([(0, typeHelpers_1.getComposeTypeName)(composeType, this.schemaComposer), checkFn]); | ||
this.addType(composeType); | ||
@@ -366,3 +366,3 @@ } | ||
for (const [composeType, checkFn] of this._gqcTypeResolvers.entries()) { | ||
fastEntries.push([typeHelpers_1.getGraphQLType(composeType), checkFn]); | ||
fastEntries.push([(0, typeHelpers_1.getGraphQLType)(composeType), checkFn]); | ||
this.addType(composeType); | ||
@@ -399,3 +399,3 @@ } | ||
} | ||
throw new Error(`Should be provided ObjectType but received ${misc_1.inspect(type)}`); | ||
throw new Error(`Should be provided ObjectType but received ${(0, misc_1.inspect)(type)}`); | ||
} | ||
@@ -412,6 +412,6 @@ _convertTypeResolvers(typeResolversMap) { | ||
catch (e) { | ||
throw new Error(`For union type resolver ${this.getTypeName()} you must provide GraphQLObjectType or ObjectTypeComposer, but provided ${misc_1.inspect(composeType)}`); | ||
throw new Error(`For union type resolver ${this.getTypeName()} you must provide GraphQLObjectType or ObjectTypeComposer, but provided ${(0, misc_1.inspect)(composeType)}`); | ||
} | ||
if (!is_1.isFunction(checkFn)) { | ||
throw new Error(`Union ${this.getTypeName()} has invalid check function for type ${misc_1.inspect(composeType)}`); | ||
if (!(0, is_1.isFunction)(checkFn)) { | ||
throw new Error(`Union ${this.getTypeName()} has invalid check function for type ${(0, misc_1.inspect)(composeType)}`); | ||
} | ||
@@ -556,5 +556,5 @@ } | ||
let r = ''; | ||
r += schemaPrinter_1.printUnion(this.getType(), innerOpts); | ||
r += (0, schemaPrinter_1.printUnion)(this.getType(), innerOpts); | ||
const nestedTypes = Array.from(this.getNestedTCs({ exclude })); | ||
const sortMethod = schemaPrinterSortTypes_1.getSortMethodFromOption(innerOpts.sortAll || innerOpts.sortTypes); | ||
const sortMethod = (0, schemaPrinterSortTypes_1.getSortMethodFromOption)(innerOpts.sortAll || innerOpts.sortTypes); | ||
if (sortMethod) { | ||
@@ -572,3 +572,3 @@ nestedTypes.sort(sortMethod); | ||
} | ||
return schemaPrinter_1.printUnion(this.getType(), innerOpts); | ||
return (0, schemaPrinter_1.printUnion)(this.getType(), innerOpts); | ||
} | ||
@@ -575,0 +575,0 @@ } |
@@ -26,3 +26,3 @@ "use strict"; | ||
var _a, _b, _c; | ||
misc_1.invariant(isPlainObj(fieldMap), `${config.name} fields must be an object with field names as keys or a ` + | ||
(0, misc_1.invariant)(isPlainObj(fieldMap), `${config.name} fields must be an object with field names as keys or a ` + | ||
'function which returns such an object.'); | ||
@@ -46,6 +46,6 @@ const fieldAstNodeMap = Object.create(null); | ||
const fieldNodeAst = fieldAstNodeMap[fieldName]; | ||
misc_1.invariant(isPlainObj(fieldConfig), `${config.name}.${fieldName} field config must be an object`); | ||
(0, misc_1.invariant)(isPlainObj(fieldConfig), `${config.name}.${fieldName} field config must be an object`); | ||
const field = Object.assign(Object.assign({}, fieldConfig), { isDeprecated: Boolean(fieldConfig.deprecationReason), name: fieldName, astNode: fieldNodeAst }); | ||
misc_1.invariant(field.resolve == null || typeof field.resolve === 'function', `${config.name}.${fieldName} field resolver must be a function if ` + | ||
`provided, but got: ${misc_1.inspect(field.resolve)}.`); | ||
(0, misc_1.invariant)(field.resolve == null || typeof field.resolve === 'function', `${config.name}.${fieldName} field resolver must be a function if ` + | ||
`provided, but got: ${(0, misc_1.inspect)(field.resolve)}.`); | ||
const argsConfig = fieldConfig.args; | ||
@@ -56,3 +56,3 @@ if (!argsConfig) { | ||
else { | ||
misc_1.invariant(isPlainObj(argsConfig), `${config.name}.${fieldName} args must be an object with argument names as keys.`); | ||
(0, misc_1.invariant)(isPlainObj(argsConfig), `${config.name}.${fieldName} args must be an object with argument names as keys.`); | ||
const fieldArgNodeMap = (_c = argAstNodeMap[fieldName]) !== null && _c !== void 0 ? _c : {}; | ||
@@ -79,5 +79,5 @@ field.args = Object.keys(argsConfig).map((argName) => { | ||
const fields = {}; | ||
const isThunk = is_1.isFunction(fieldMap); | ||
const isThunk = (0, is_1.isFunction)(fieldMap); | ||
const _fields = isThunk ? fieldMap(sc) : fieldMap; | ||
if (!is_1.isObject(_fields)) | ||
if (!(0, is_1.isObject)(_fields)) | ||
return {}; | ||
@@ -98,6 +98,6 @@ Object.keys(_fields).forEach((n) => { | ||
} | ||
else if (is_1.isObject(fc.args)) { | ||
else if ((0, is_1.isObject)(fc.args)) { | ||
Object.keys(fc.args).forEach((argName) => { | ||
const sourceArgs = fc.args; | ||
args[argName] = Object.assign(Object.assign({}, (is_1.isObject(sourceArgs[argName]) ? sourceArgs[argName] : null)), { type: isThunk | ||
args[argName] = Object.assign(Object.assign({}, ((0, is_1.isObject)(sourceArgs[argName]) ? sourceArgs[argName] : null)), { type: isThunk | ||
? new ThunkComposer_1.ThunkComposer(() => sc.typeMapper.convertInputTypeDefinition(sourceArgs[argName].type || sourceArgs[argName])) | ||
@@ -117,3 +117,3 @@ : sc.typeMapper.convertInputTypeDefinition(sourceArgs[argName].type || sourceArgs[argName]) }); | ||
var _a; | ||
misc_1.invariant(isPlainObj(valueMap), `${type.name} values must be an object with value names as keys.`); | ||
(0, misc_1.invariant)(isPlainObj(valueMap), `${type.name} values must be an object with value names as keys.`); | ||
const astNodeMap = Object.create(null); | ||
@@ -125,5 +125,5 @@ for (const valueNode of (_a = parentAstNode === null || parentAstNode === void 0 ? void 0 : parentAstNode.values) !== null && _a !== void 0 ? _a : []) { | ||
const value = valueMap[valueName]; | ||
misc_1.invariant(isPlainObj(value), `${type.name}.${valueName} must refer to an object with a "value" key ` + | ||
`representing an internal value but got: ${misc_1.inspect(value)}.`); | ||
misc_1.invariant(!value.hasOwnProperty('isDeprecated'), `${type.name}.${valueName} should provide "deprecationReason" instead of "isDeprecated".`); | ||
(0, misc_1.invariant)(isPlainObj(value), `${type.name}.${valueName} must refer to an object with a "value" key ` + | ||
`representing an internal value but got: ${(0, misc_1.inspect)(value)}.`); | ||
(0, misc_1.invariant)(!value.hasOwnProperty('isDeprecated'), `${type.name}.${valueName} should provide "deprecationReason" instead of "isDeprecated".`); | ||
return { | ||
@@ -159,3 +159,3 @@ name: valueName, | ||
var _a; | ||
misc_1.invariant(isPlainObj(fieldMap), `${config.name} fields must be an object with field names as keys or a ` + | ||
(0, misc_1.invariant)(isPlainObj(fieldMap), `${config.name} fields must be an object with field names as keys or a ` + | ||
'function which returns such an object.'); | ||
@@ -169,3 +169,3 @@ const astNodeMap = Object.create(null); | ||
const field = Object.assign(Object.assign({}, fieldMap[fieldName]), { name: fieldName, astNode: astNodeMap[fieldName] }); | ||
misc_1.invariant(!field.hasOwnProperty('resolve'), `${config.name}.${fieldName} field has a resolve property, but ` + | ||
(0, misc_1.invariant)(!field.hasOwnProperty('resolve'), `${config.name}.${fieldName} field has a resolve property, but ` + | ||
'Input Types cannot define resolvers.'); | ||
@@ -179,3 +179,3 @@ resultFieldMap[fieldName] = field; | ||
const fields = {}; | ||
const isThunk = is_1.isFunction(fieldMap); | ||
const isThunk = (0, is_1.isFunction)(fieldMap); | ||
const _fields = isThunk ? fieldMap(sc) : fieldMap; | ||
@@ -193,3 +193,3 @@ Object.keys(_fields).forEach((n) => { | ||
function convertObjectTypeArrayAsThunk(types, sc) { | ||
const isThunk = is_1.isFunction(types); | ||
const isThunk = (0, is_1.isFunction)(types); | ||
const t = isThunk ? types(sc) : types; | ||
@@ -204,6 +204,6 @@ if (!Array.isArray(t)) | ||
if (!tc && isThunk) { | ||
return new ThunkComposer_1.ThunkComposer(() => sc.typeMapper.convertOutputTypeDefinition(type), typeHelpers_1.getComposeTypeName(type, sc)); | ||
return new ThunkComposer_1.ThunkComposer(() => sc.typeMapper.convertOutputTypeDefinition(type), (0, typeHelpers_1.getComposeTypeName)(type, sc)); | ||
} | ||
if (!(tc instanceof ObjectTypeComposer_1.ObjectTypeComposer) && !(tc instanceof ThunkComposer_1.ThunkComposer)) { | ||
throw new Error(`Should be provided ObjectType but received ${misc_1.inspect(type)}`); | ||
throw new Error(`Should be provided ObjectType but received ${(0, misc_1.inspect)(type)}`); | ||
} | ||
@@ -215,3 +215,3 @@ return tc; | ||
function convertInterfaceArrayAsThunk(types, sc) { | ||
const isThunk = is_1.isFunction(types); | ||
const isThunk = (0, is_1.isFunction)(types); | ||
const t = isThunk ? types(sc) : types; | ||
@@ -225,3 +225,3 @@ if (!Array.isArray(t)) | ||
return isThunk | ||
? new ThunkComposer_1.ThunkComposer(() => sc.typeMapper.convertInterfaceTypeDefinition(type), typeHelpers_1.getComposeTypeName(type, sc)) | ||
? new ThunkComposer_1.ThunkComposer(() => sc.typeMapper.convertInterfaceTypeDefinition(type), (0, typeHelpers_1.getComposeTypeName)(type, sc)) | ||
: sc.typeMapper.convertInterfaceTypeDefinition(type); | ||
@@ -228,0 +228,0 @@ }); |
@@ -11,3 +11,3 @@ "use strict"; | ||
isResolved = true; | ||
const tmp = is_1.isFunction(thunk) ? thunk() : thunk; | ||
const tmp = (0, is_1.isFunction)(thunk) ? thunk() : thunk; | ||
Object.keys(tmp).forEach((k) => { | ||
@@ -14,0 +14,0 @@ data[k] = tmp[k]; |
@@ -113,3 +113,3 @@ "use strict"; | ||
default: | ||
console.log(`Cannot determine astNode in toValueNode() method: ${misc_1.inspect(value)}`); | ||
console.log(`Cannot determine astNode in toValueNode() method: ${(0, misc_1.inspect)(value)}`); | ||
return { kind: graphql_2.Kind.NULL }; | ||
@@ -134,3 +134,3 @@ } | ||
? | ||
graphql_1.astFromValue(data[k], argumentType) || { kind: graphql_2.Kind.NULL } | ||
(0, graphql_1.astFromValue)(data[k], argumentType) || { kind: graphql_2.Kind.NULL } | ||
: | ||
@@ -214,3 +214,3 @@ toValueNode(data[k]), | ||
defaultValue: (ac.defaultValue !== undefined && | ||
graphql_1.astFromValue(ac.defaultValue, tc.getFieldArgType(fieldName, argName))) || | ||
(0, graphql_1.astFromValue)(ac.defaultValue, tc.getFieldArgType(fieldName, argName))) || | ||
undefined, | ||
@@ -261,3 +261,3 @@ }; | ||
defaultValue: (fc.defaultValue !== undefined && | ||
graphql_1.astFromValue(fc.defaultValue, tc.getFieldType(fieldName))) || | ||
(0, graphql_1.astFromValue)(fc.defaultValue, tc.getFieldType(fieldName))) || | ||
undefined, | ||
@@ -309,3 +309,3 @@ }; | ||
default: | ||
throw new TypeError(`${typeName} cannot represent value: ${misc_1.inspect(ast)}`); | ||
throw new TypeError(`${typeName} cannot represent value: ${(0, misc_1.inspect)(ast)}`); | ||
} | ||
@@ -312,0 +312,0 @@ } |
@@ -17,3 +17,3 @@ "use strict"; | ||
function getPluralName(name) { | ||
return pluralize_1.pluralize(camelCase(name)); | ||
return (0, pluralize_1.pluralize)(camelCase(name)); | ||
} | ||
@@ -95,3 +95,3 @@ exports.getPluralName = getPluralName; | ||
function mapEachKey(obj, callback) { | ||
if (!is_1.isObject(obj)) | ||
if (!(0, is_1.isObject)(obj)) | ||
return obj; | ||
@@ -98,0 +98,0 @@ const result = {}; |
@@ -39,3 +39,3 @@ "use strict"; | ||
if (res[value]) { | ||
res[value] = deepmerge_1.deepmerge(res[value], getProjectionFromASTQuery(info, ast) || true); | ||
res[value] = (0, deepmerge_1.deepmerge)(res[value], getProjectionFromASTQuery(info, ast) || true); | ||
} | ||
@@ -48,5 +48,5 @@ else { | ||
case INLINE_FRAGMENT: | ||
return deepmerge_1.deepmerge(res, getProjectionFromASTQuery(info, ast)); | ||
return (0, deepmerge_1.deepmerge)(res, getProjectionFromASTQuery(info, ast)); | ||
case FRAGMENT_SPREAD: | ||
return deepmerge_1.deepmerge(res, getProjectionFromASTQuery(info, info.fragments[ast.name.value])); | ||
return (0, deepmerge_1.deepmerge)(res, getProjectionFromASTQuery(info, info.fragments[ast.name.value])); | ||
default: | ||
@@ -83,5 +83,5 @@ throw new Error('Unsupported query selection'); | ||
if (field.projection) | ||
proj = deepmerge_1.deepmerge(proj, field.projection); | ||
proj = (0, deepmerge_1.deepmerge)(proj, field.projection); | ||
if (field.extensions && field.extensions.projection) { | ||
proj = deepmerge_1.deepmerge(proj, field.extensions.projection); | ||
proj = (0, deepmerge_1.deepmerge)(proj, field.extensions.projection); | ||
} | ||
@@ -88,0 +88,0 @@ proj[key] = extendByFieldProjection(field.type, proj[key]); |
@@ -40,4 +40,4 @@ "use strict"; | ||
const { optPrinter, optFilter } = splitOptionsFilterPrinter(options); | ||
const printTypes = Array.from(getFromSchema_1.getTypesFromSchema(sc, optFilter)); | ||
const sortMethod = schemaPrinterSortTypes_1.getSortMethodFromOption(optPrinter === null || optPrinter === void 0 ? void 0 : optPrinter.sortTypes, optFilter); | ||
const printTypes = Array.from((0, getFromSchema_1.getTypesFromSchema)(sc, optFilter)); | ||
const sortMethod = (0, schemaPrinterSortTypes_1.getSortMethodFromOption)(optPrinter === null || optPrinter === void 0 ? void 0 : optPrinter.sortTypes, optFilter); | ||
if (sortMethod) | ||
@@ -47,3 +47,3 @@ printTypes.sort(sortMethod); | ||
if (!optFilter.omitDirectiveDefinitions) { | ||
res.push(...getFromSchema_1.getDirectivesFromSchema(sc).map((d) => printDirective(d, optPrinter))); | ||
res.push(...(0, getFromSchema_1.getDirectivesFromSchema)(sc).map((d) => printDirective(d, optPrinter))); | ||
} | ||
@@ -55,3 +55,3 @@ res.push(...printTypes.map((tc) => tc.toSDL(optPrinter))); | ||
function printSchema(schema, options) { | ||
return printFilteredSchema(schema, (n) => !directives_1.isSpecifiedDirective(n), isDefinedType, options); | ||
return printFilteredSchema(schema, (n) => !(0, directives_1.isSpecifiedDirective)(n), isDefinedType, options); | ||
} | ||
@@ -64,3 +64,3 @@ exports.printSchema = printSchema; | ||
function isDefinedType(type) { | ||
return !scalars_1.isSpecifiedScalarType(type) && !introspection_1.isIntrospectionType(type); | ||
return !(0, scalars_1.isSpecifiedScalarType)(type) && !(0, introspection_1.isIntrospectionType)(type); | ||
} | ||
@@ -117,21 +117,21 @@ exports.isDefinedType = isDefinedType; | ||
function printType(type, options) { | ||
if (definition_1.isScalarType(type)) { | ||
if ((0, definition_1.isScalarType)(type)) { | ||
return printScalar(type, options); | ||
} | ||
else if (definition_1.isObjectType(type)) { | ||
else if ((0, definition_1.isObjectType)(type)) { | ||
return printObject(type, options); | ||
} | ||
else if (definition_1.isInterfaceType(type)) { | ||
else if ((0, definition_1.isInterfaceType)(type)) { | ||
return printInterface(type, options); | ||
} | ||
else if (definition_1.isUnionType(type)) { | ||
else if ((0, definition_1.isUnionType)(type)) { | ||
return printUnion(type, options); | ||
} | ||
else if (definition_1.isEnumType(type)) { | ||
else if ((0, definition_1.isEnumType)(type)) { | ||
return printEnum(type, options); | ||
} | ||
else if (definition_1.isInputObjectType(type)) { | ||
else if ((0, definition_1.isInputObjectType)(type)) { | ||
return printInputObject(type, options); | ||
} | ||
misc_1.invariant(false, `Unexpected type: ${misc_1.inspect(type)}`); | ||
(0, misc_1.invariant)(false, `Unexpected type: ${(0, misc_1.inspect)(type)}`); | ||
return ''; | ||
@@ -223,6 +223,6 @@ } | ||
function printInputValue(arg) { | ||
const defaultAST = astFromValue_1.astFromValue(arg.defaultValue, arg.type); | ||
const defaultAST = (0, astFromValue_1.astFromValue)(arg.defaultValue, arg.type); | ||
let argDecl = `${arg.name}: ${String(arg.type)}`; | ||
if (defaultAST) { | ||
argDecl += ` = ${printer_1.print(defaultAST)}`; | ||
argDecl += ` = ${(0, printer_1.print)(defaultAST)}`; | ||
} | ||
@@ -243,3 +243,3 @@ return `${argDecl}${printNodeDirectives(arg.astNode)}`; | ||
if (d.arguments && d.arguments.length) { | ||
args = `(${d.arguments.map((a) => `${a.name.value}: ${printer_1.print(a.value)}`).join(', ')})`; | ||
args = `(${d.arguments.map((a) => `${a.name.value}: ${(0, printer_1.print)(a.value)}`).join(', ')})`; | ||
} | ||
@@ -246,0 +246,0 @@ return `@${d.name.value}${args}`; |
@@ -70,3 +70,3 @@ "use strict"; | ||
} | ||
else if (is_1.isFunction(sortOption)) { | ||
else if ((0, is_1.isFunction)(sortOption)) { | ||
return sortOption; | ||
@@ -73,0 +73,0 @@ } |
@@ -58,3 +58,3 @@ "use strict"; | ||
} | ||
else if (typeHelpers_1.isNamedTypeComposer(result)) { | ||
else if ((0, typeHelpers_1.isNamedTypeComposer)(result)) { | ||
tc = result; | ||
@@ -61,0 +61,0 @@ schema.set(key, tc); |
@@ -26,3 +26,3 @@ "use strict"; | ||
} | ||
if (!typeHelpers_1.isSomeInputTypeComposer(tc)) { | ||
if (!(0, typeHelpers_1.isSomeInputTypeComposer)(tc)) { | ||
if (tc instanceof ObjectTypeComposer_1.ObjectTypeComposer || tc instanceof InterfaceTypeComposer_1.InterfaceTypeComposer) { | ||
@@ -38,3 +38,3 @@ tc = toInputObjectType(tc, opts); | ||
else { | ||
throw new Error(`Cannot convert '${misc_1.inspect(tc)}' to InputType. Please use 'fallbackType' option for removing this error.`); | ||
throw new Error(`Cannot convert '${(0, misc_1.inspect)(tc)}' to InputType. Please use 'fallbackType' option for removing this error.`); | ||
} | ||
@@ -71,3 +71,3 @@ } | ||
throw new Error(`${`Can not convert field '${tc.getTypeName()}.${fieldName}' to InputType` + | ||
'\nIt should be ObjectType or InterfaceType, but got \n'}${misc_1.inspect(fc.type)}`); | ||
'\nIt should be ObjectType or InterfaceType, but got \n'}${(0, misc_1.inspect)(fc.type)}`); | ||
} | ||
@@ -74,0 +74,0 @@ } |
@@ -108,3 +108,3 @@ "use strict"; | ||
return undefined; | ||
const tc = typeHelpers_1.unwrapTC(type); | ||
const tc = (0, typeHelpers_1.unwrapTC)(type); | ||
if (tc instanceof ObjectTypeComposer_1.ObjectTypeComposer) { | ||
@@ -111,0 +111,0 @@ if (restParts.length > 0) { |
@@ -98,3 +98,3 @@ "use strict"; | ||
function isComposeNamedType(type) { | ||
return (graphql_1.isNamedType(type) || | ||
return ((0, graphql_1.isNamedType)(type) || | ||
type instanceof ObjectTypeComposer_1.ObjectTypeComposer || | ||
@@ -115,7 +115,7 @@ type instanceof InputTypeComposer_1.InputTypeComposer || | ||
type instanceof Resolver_1.Resolver || | ||
graphql_1.isType(type)); | ||
(0, graphql_1.isType)(type)); | ||
} | ||
exports.isComposeType = isComposeType; | ||
function isComposeOutputType(type) { | ||
return (graphql_1.isOutputType(type) || | ||
return ((0, graphql_1.isOutputType)(type) || | ||
(Array.isArray(type) && isComposeOutputType(type[0])) || | ||
@@ -127,3 +127,3 @@ isSomeOutputTypeComposer(type) || | ||
function isComposeInputType(type) { | ||
return (graphql_1.isInputType(type) || | ||
return ((0, graphql_1.isInputType)(type) || | ||
(Array.isArray(type) && isComposeInputType(type[0])) || | ||
@@ -151,7 +151,7 @@ isSomeInputTypeComposer(type)); | ||
let type = anyType; | ||
if (type && is_1.isFunction(type.getType)) { | ||
if (type && (0, is_1.isFunction)(type.getType)) { | ||
type = type.getType(); | ||
} | ||
if (!graphql_1.isType(type)) { | ||
throw new Error(`You provide incorrect type for 'getGraphQLType' method: ${misc_1.inspect(type)}`); | ||
if (!(0, graphql_1.isType)(type)) { | ||
throw new Error(`You provide incorrect type for 'getGraphQLType' method: ${(0, misc_1.inspect)(type)}`); | ||
} | ||
@@ -167,3 +167,3 @@ return type; | ||
else { | ||
const docNode = graphql_1.parse(type); | ||
const docNode = (0, graphql_1.parse)(type); | ||
if (docNode.definitions[0] && | ||
@@ -175,5 +175,5 @@ docNode.definitions[0].name && | ||
} | ||
throw new Error(`Cannot get type name from string: ${misc_1.inspect(type)}`); | ||
throw new Error(`Cannot get type name from string: ${(0, misc_1.inspect)(type)}`); | ||
} | ||
else if (is_1.isFunction(type)) { | ||
else if ((0, is_1.isFunction)(type)) { | ||
return getComposeTypeName(type(sc), sc); | ||
@@ -189,6 +189,6 @@ } | ||
catch (e) { | ||
throw new Error(`Cannot get type name from ${misc_1.inspect(type)}`); | ||
throw new Error(`Cannot get type name from ${(0, misc_1.inspect)(type)}`); | ||
} | ||
} | ||
throw new Error(`Cannot get type name from ${misc_1.inspect(type)}`); | ||
throw new Error(`Cannot get type name from ${(0, misc_1.inspect)(type)}`); | ||
} | ||
@@ -215,3 +215,3 @@ exports.getComposeTypeName = getComposeTypeName; | ||
function changeUnwrappedTC(anyTC, cb) { | ||
deprecate_1.default('Please use `replaceTC()` function instead.'); | ||
(0, deprecate_1.default)('Please use `replaceTC()` function instead.'); | ||
return replaceTC(anyTC, cb); | ||
@@ -234,3 +234,3 @@ } | ||
} | ||
tc = is_1.isFunction(replaceByTC) ? replaceByTC(tc) : replaceByTC; | ||
tc = (0, is_1.isFunction)(replaceByTC) ? replaceByTC(tc) : replaceByTC; | ||
if (tc) { | ||
@@ -265,3 +265,3 @@ tc = wrappers.reduce((type, Wrapper) => new Wrapper(type), tc); | ||
} | ||
else if (graphql_1.isType(type)) { | ||
else if ((0, graphql_1.isType)(type)) { | ||
const tc = anotherSchemaComposer.typeMapper.convertGraphQLTypeToComposer(type); | ||
@@ -272,5 +272,5 @@ cloneMap.set(type, tc); | ||
else { | ||
throw new Error(dedent_1.dedent ` | ||
throw new Error((0, dedent_1.dedent) ` | ||
Something strange was provided to utils cloneTypeTo() method: | ||
${misc_1.inspect(type)} | ||
${(0, misc_1.inspect)(type)} | ||
`); | ||
@@ -277,0 +277,0 @@ } |
{ | ||
"name": "graphql-compose", | ||
"version": "9.0.2", | ||
"version": "9.0.3", | ||
"description": "GraphQL schema builder from different data sources with middleware extensions.", | ||
@@ -27,25 +27,25 @@ "files": [ | ||
"devDependencies": { | ||
"@types/jest": "26.0.23", | ||
"@types/lodash": "^4.14.168", | ||
"@typescript-eslint/eslint-plugin": "4.22.0", | ||
"@typescript-eslint/parser": "4.22.0", | ||
"@types/jest": "27.0.1", | ||
"@types/lodash": "4.14.172", | ||
"@typescript-eslint/eslint-plugin": "4.31.0", | ||
"@typescript-eslint/parser": "4.31.0", | ||
"cz-conventional-changelog": "3.3.0", | ||
"eslint": "7.25.0", | ||
"eslint": "7.32.0", | ||
"eslint-config-airbnb-base": "14.2.1", | ||
"eslint-config-prettier": "8.3.0", | ||
"eslint-plugin-import": "2.22.1", | ||
"eslint-plugin-prettier": "3.4.0", | ||
"eslint-plugin-import": "2.24.2", | ||
"eslint-plugin-prettier": "4.0.0", | ||
"graphql": "16.0.0-alpha.2", | ||
"jest": "26.6.3", | ||
"jest-junit": "12.0.0", | ||
"prettier": "2.2.1", | ||
"jest": "27.1.0", | ||
"jest-junit": "12.2.0", | ||
"prettier": "2.3.2", | ||
"rimraf": "3.0.2", | ||
"semantic-release": "17.4.2", | ||
"ts-jest": "26.5.5", | ||
"typescript": "4.2.4" | ||
"semantic-release": "17.4.7", | ||
"ts-jest": "27.0.5", | ||
"typescript": "4.4.2" | ||
}, | ||
"dependencies": { | ||
"@types/object-path": "^0.11.0", | ||
"@types/object-path": "0.11.1", | ||
"graphql-type-json": "0.3.2", | ||
"object-path": "0.11.5" | ||
"object-path": "0.11.7" | ||
}, | ||
@@ -52,0 +52,0 @@ "config": { |
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
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
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
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
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
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
906429
10540
+ Added@types/object-path@0.11.1(transitive)
+ Addedobject-path@0.11.7(transitive)
- Removed@types/object-path@0.11.4(transitive)
- Removedobject-path@0.11.5(transitive)
Updated@types/object-path@0.11.1
Updatedobject-path@0.11.7