Comparing version 0.5.1 to 0.6.0
@@ -494,7 +494,8 @@ "use strict"; | ||
} | ||
if (typeof types === "function") { | ||
addTypes(builder, types(builder)); | ||
} | ||
if (isWrappedTypeDef(types)) { | ||
types = types.type; | ||
if (typeof types === "function") { | ||
addTypes(builder, types(builder)); | ||
return; | ||
} | ||
} | ||
@@ -501,0 +502,0 @@ if (isNamedTypeDef(types) || graphql_1.isNamedType(types)) { |
@@ -312,9 +312,10 @@ import * as Types from "./types"; | ||
/** | ||
* The `WrappedType` exists purely to signify that the value returned from | ||
* The `WrappedType` exists to signify that the value returned from | ||
* the type construction APIs should not be used externally outside of the | ||
* builder function. | ||
* builder function. It also is useful if you need the SchemaBuilder, in that | ||
* it can take a function which is lazy-evaluated to build the type. | ||
*/ | ||
export declare class WrappedType { | ||
readonly type: Types.NamedTypeDef | DirectiveTypeDef | GraphQLScalarType; | ||
constructor(type: Types.NamedTypeDef | DirectiveTypeDef | GraphQLScalarType); | ||
readonly type: Types.NamedTypeDef | DirectiveTypeDef | GraphQLScalarType | ((schema: SchemaBuilder) => WrappedType); | ||
constructor(type: Types.NamedTypeDef | DirectiveTypeDef | GraphQLScalarType | ((schema: SchemaBuilder) => WrappedType)); | ||
} |
@@ -551,5 +551,6 @@ "use strict"; | ||
/** | ||
* The `WrappedType` exists purely to signify that the value returned from | ||
* The `WrappedType` exists to signify that the value returned from | ||
* the type construction APIs should not be used externally outside of the | ||
* builder function. | ||
* builder function. It also is useful if you need the SchemaBuilder, in that | ||
* it can take a function which is lazy-evaluated to build the type. | ||
*/ | ||
@@ -556,0 +557,0 @@ var WrappedType = /** @class */ (function () { |
@@ -106,6 +106,6 @@ "use strict"; | ||
if (graphql_1.isInputObjectType(type) || graphql_1.isEnumType(type)) { | ||
return type.name; | ||
return "" + typeStr + type.name; | ||
} | ||
if (graphql_1.isScalarType(type)) { | ||
return backingTypeMap[type.name] || "unknown"; | ||
return "" + typeStr + (backingTypeMap[type.name] || "unknown"); | ||
} | ||
@@ -257,3 +257,3 @@ throw new Error("Unexpected type " + type); | ||
allTypeStrings.push([ | ||
"interface " + type.name + " {", | ||
"export interface " + type.name + " {", | ||
utils_1.mapObj(type.getFields(), function (inputField) { | ||
@@ -351,3 +351,3 @@ return printArgOrFieldMember(inputField); | ||
"{", | ||
map(typeNames.inputObjects, function (n) { return " " + n + ": any;"; }), | ||
map(typeNames.inputObjects, function (n) { return " " + n + ": " + n + ";"; }), | ||
" }", | ||
@@ -354,0 +354,0 @@ ].join("\n"); |
{ | ||
"name": "nexus", | ||
"version": "0.5.1", | ||
"version": "0.6.0", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "types": "dist/index.d.ts", |
@@ -703,7 +703,8 @@ import { | ||
} | ||
if (typeof types === "function") { | ||
addTypes(builder, types(builder)); | ||
} | ||
if (isWrappedTypeDef(types)) { | ||
types = types.type; | ||
if (typeof types === "function") { | ||
addTypes(builder, types(builder)); | ||
return; | ||
} | ||
} | ||
@@ -710,0 +711,0 @@ if (isNamedTypeDef(types) || isNamedType(types)) { |
@@ -709,10 +709,15 @@ import * as Types from "./types"; | ||
/** | ||
* The `WrappedType` exists purely to signify that the value returned from | ||
* The `WrappedType` exists to signify that the value returned from | ||
* the type construction APIs should not be used externally outside of the | ||
* builder function. | ||
* builder function. It also is useful if you need the SchemaBuilder, in that | ||
* it can take a function which is lazy-evaluated to build the type. | ||
*/ | ||
export class WrappedType { | ||
constructor( | ||
readonly type: Types.NamedTypeDef | DirectiveTypeDef | GraphQLScalarType | ||
readonly type: | ||
| Types.NamedTypeDef | ||
| DirectiveTypeDef | ||
| GraphQLScalarType | ||
| ((schema: SchemaBuilder) => WrappedType) | ||
) {} | ||
} |
@@ -149,6 +149,6 @@ import { | ||
if (isInputObjectType(type) || isEnumType(type)) { | ||
return type.name; | ||
return `${typeStr}${type.name}`; | ||
} | ||
if (isScalarType(type)) { | ||
return backingTypeMap[type.name] || "unknown"; | ||
return `${typeStr}${backingTypeMap[type.name] || "unknown"}`; | ||
} | ||
@@ -341,3 +341,3 @@ throw new Error(`Unexpected type ${type}`); | ||
[ | ||
`interface ${type.name} {`, | ||
`export interface ${type.name} {`, | ||
mapObj(type.getFields(), (inputField) => | ||
@@ -472,3 +472,3 @@ printArgOrFieldMember(inputField) | ||
`{`, | ||
map(typeNames.inputObjects, (n) => ` ${n}: any;`), | ||
map(typeNames.inputObjects, (n) => ` ${n}: ${n};`), | ||
" }", | ||
@@ -475,0 +475,0 @@ ].join("\n"); |
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
519700
7783