graphql-codegen-core
Advanced tools
Comparing version 0.6.0-alpha.14ecb322 to 0.6.0-alpha.1bc8b137
export { schemaToTemplateContext } from './schema/schema-to-template-context'; | ||
export { validateIntrospection } from './utils/introspection-to-schema'; | ||
export * from './types'; | ||
export { transformDocument } from './operations/transform-document'; | ||
export { validateIntrospection, introspectionToGraphQLSchema } from './utils/introspection-to-schema'; | ||
export { Argument, Field, Type, Scalar, Enum, EnumValue, Union, Interface, SchemaTemplateContext, Document, Variable, Operation, Fragment, SelectionSetItem, SelectionSetFieldNode, SelectionSetFragmentSpread, SelectionSetInlineFragment, isFieldNode, isFragmentSpreadNode, isInlineFragmentNode } from './types'; |
@@ -5,4 +5,11 @@ "use strict"; | ||
exports.schemaToTemplateContext = schema_to_template_context_1.schemaToTemplateContext; | ||
var transform_document_1 = require("./operations/transform-document"); | ||
exports.transformDocument = transform_document_1.transformDocument; | ||
var introspection_to_schema_1 = require("./utils/introspection-to-schema"); | ||
exports.validateIntrospection = introspection_to_schema_1.validateIntrospection; | ||
exports.introspectionToGraphQLSchema = introspection_to_schema_1.introspectionToGraphQLSchema; | ||
var types_1 = require("./types"); | ||
exports.isFieldNode = types_1.isFieldNode; | ||
exports.isFragmentSpreadNode = types_1.isFragmentSpreadNode; | ||
exports.isInlineFragmentNode = types_1.isInlineFragmentNode; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
import { GraphQLInputType, GraphQLOutputType } from 'graphql'; | ||
import { GraphQLInputType, GraphQLOutputType, GraphQLType } from 'graphql'; | ||
export interface ResolvedType { | ||
@@ -9,2 +9,2 @@ name: string; | ||
export declare function isArray(type: GraphQLOutputType | GraphQLInputType): boolean; | ||
export declare function resolveType(type: GraphQLOutputType | GraphQLInputType): ResolvedType; | ||
export declare function resolveType(type: GraphQLType): ResolvedType; |
@@ -10,3 +10,3 @@ "use strict"; | ||
var transform_scalar_1 = require("./transform-scalar"); | ||
var GRAPHQL_PRIMITIVES = ['String', 'Int', 'Boolean']; | ||
var GRAPHQL_PRIMITIVES = ['String', 'Int', 'Boolean', 'ID', 'Float']; | ||
var clearTypes = function (typesMap) { return Object.keys(typesMap) | ||
@@ -26,2 +26,8 @@ .filter(function (key) { return !GRAPHQL_PRIMITIVES.includes(key) && !key.startsWith('__'); }) | ||
interfaces: [], | ||
hasTypes: false, | ||
hasInputTypes: false, | ||
hasEnums: false, | ||
hasUnions: false, | ||
hasScalars: false, | ||
hasInterfaces: false, | ||
}; | ||
@@ -55,2 +61,8 @@ var rawTypesMap = schema.getTypeMap(); | ||
}); | ||
result.hasTypes = result.types.length > 0; | ||
result.hasInputTypes = result.inputTypes.length > 0; | ||
result.hasEnums = result.enums.length > 0; | ||
result.hasUnions = result.unions.length > 0; | ||
result.hasScalars = result.scalars.length > 0; | ||
result.hasInterfaces = result.interfaces.length > 0; | ||
return result; | ||
@@ -57,0 +69,0 @@ } |
@@ -10,9 +10,11 @@ "use strict"; | ||
var type = resolve_type_1.resolveType(item.value.type); | ||
var resolvedArguments = resolve_arguments_1.resolveArguments(item.value.args || []); | ||
return { | ||
name: item.value.name, | ||
description: item.value.description || '', | ||
arguments: resolve_arguments_1.resolveArguments(item.value.args || []), | ||
arguments: resolvedArguments, | ||
type: type.name, | ||
isArray: type.isArray, | ||
isRequired: type.isRequired, | ||
hasArguments: resolvedArguments.length > 0, | ||
}; | ||
@@ -19,0 +21,0 @@ }); |
@@ -5,6 +5,8 @@ "use strict"; | ||
function transformInterface(gqlInterface) { | ||
var resolvedFields = transform_fields_1.resolveFields(gqlInterface.getFields()); | ||
return { | ||
name: gqlInterface.name, | ||
description: gqlInterface.description || '', | ||
fields: transform_fields_1.resolveFields(gqlInterface.getFields()), | ||
fields: resolvedFields, | ||
hasFields: resolvedFields.length > 0, | ||
}; | ||
@@ -11,0 +13,0 @@ } |
@@ -6,8 +6,12 @@ "use strict"; | ||
function transformGraphQLObject(object) { | ||
var resolvedFields = transform_fields_1.resolveFields(object.getFields()); | ||
var resolvedInterfaces = object instanceof graphql_1.GraphQLObjectType ? object.getInterfaces().map(function (inf) { return inf.name; }) : []; | ||
return { | ||
name: object.name, | ||
description: object.description || '', | ||
fields: transform_fields_1.resolveFields(object.getFields()), | ||
interfaces: object instanceof graphql_1.GraphQLObjectType ? object.getInterfaces().map(function (inf) { return inf.name; }) : [], | ||
fields: resolvedFields, | ||
interfaces: resolvedInterfaces, | ||
isInputType: object instanceof graphql_1.GraphQLInputObjectType, | ||
hasFields: resolvedFields.length > 0, | ||
hasInterfaces: resolvedInterfaces.length > 0, | ||
}; | ||
@@ -14,0 +18,0 @@ } |
@@ -15,2 +15,3 @@ export interface Argument { | ||
isRequired: boolean; | ||
hasArguments: boolean; | ||
} | ||
@@ -23,2 +24,4 @@ export interface Type { | ||
interfaces: string[]; | ||
hasFields: boolean; | ||
hasInterfaces: boolean; | ||
} | ||
@@ -48,2 +51,3 @@ export interface Scalar { | ||
fields: Field[]; | ||
hasFields: boolean; | ||
} | ||
@@ -57,2 +61,67 @@ export interface SchemaTemplateContext { | ||
scalars: Scalar[]; | ||
hasTypes: boolean; | ||
hasInputTypes: boolean; | ||
hasEnums: boolean; | ||
hasUnions: boolean; | ||
hasScalars: boolean; | ||
hasInterfaces: boolean; | ||
} | ||
export interface SelectionSetItem { | ||
isFragmentSpread: boolean; | ||
isInlineFragment: boolean; | ||
isField: boolean; | ||
isLeaf: boolean; | ||
} | ||
export interface SelectionSetInlineFragment extends SelectionSetItem { | ||
selectionSet: SelectionSetItem[]; | ||
onType: string; | ||
fields: SelectionSetFieldNode[]; | ||
fragmentsSpread: SelectionSetFragmentSpread[]; | ||
inlineFragments: SelectionSetInlineFragment[]; | ||
hasFragmentsSpread: boolean; | ||
hasInlineFragments: boolean; | ||
hasFields: boolean; | ||
} | ||
export interface SelectionSetFragmentSpread extends SelectionSetItem { | ||
fragmentName: string; | ||
} | ||
export interface SelectionSetFieldNode extends SelectionSetItem { | ||
selectionSet: SelectionSetItem[]; | ||
name: string; | ||
type: string; | ||
isRequired: boolean; | ||
isArray: boolean; | ||
fields: SelectionSetFieldNode[]; | ||
fragmentsSpread: SelectionSetFragmentSpread[]; | ||
inlineFragments: SelectionSetInlineFragment[]; | ||
hasFragmentsSpread: boolean; | ||
hasInlineFragments: boolean; | ||
hasFields: boolean; | ||
} | ||
export declare function isFieldNode(node: SelectionSetItem): node is SelectionSetFieldNode; | ||
export declare function isFragmentSpreadNode(node: SelectionSetItem): node is SelectionSetFragmentSpread; | ||
export declare function isInlineFragmentNode(node: SelectionSetItem): node is SelectionSetInlineFragment; | ||
export interface Fragment { | ||
name: string; | ||
selectionSet: SelectionSetItem[]; | ||
onType: string; | ||
} | ||
export interface Operation { | ||
name: string; | ||
selectionSet: SelectionSetItem[]; | ||
operationType: string; | ||
variables: Variable[]; | ||
hasVariables: boolean; | ||
} | ||
export interface Variable { | ||
name: string; | ||
type: string; | ||
isRequired: boolean; | ||
isArray: boolean; | ||
} | ||
export interface Document { | ||
fragments: Fragment[]; | ||
operations: Operation[]; | ||
hasFragments: boolean; | ||
hasOperations: boolean; | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
function isFieldNode(node) { | ||
return node['name'] !== undefined && node['selectionSet'] !== undefined && node['type'] !== undefined; | ||
} | ||
exports.isFieldNode = isFieldNode; | ||
function isFragmentSpreadNode(node) { | ||
return node['fragmentName'] !== undefined; | ||
} | ||
exports.isFragmentSpreadNode = isFragmentSpreadNode; | ||
function isInlineFragmentNode(node) { | ||
return node['selectionSet'] !== undefined && node['onType'] !== undefined; | ||
} | ||
exports.isInlineFragmentNode = isInlineFragmentNode; | ||
//# sourceMappingURL=types.js.map |
{ | ||
"name": "graphql-codegen-core", | ||
"version": "0.6.0-alpha.14ecb322", | ||
"version": "0.6.0-alpha.1bc8b137", | ||
"description": "GraphQL types and code generator based on schema", | ||
@@ -82,26 +82,10 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"camel-case": "^3.0.0", | ||
"commander": "^2.10.0", | ||
"common-tags": "^1.4.0", | ||
"glob": "^7.1.2", | ||
"graphql": "^0.10.3", | ||
"graphql-tools": "^1.0.0", | ||
"handlebars": "^4.0.10", | ||
"mkdirp": "^0.5.1", | ||
"pascal-case": "^2.0.1", | ||
"request": "^2.81.0" | ||
"graphql-tools": "^1.0.0" | ||
}, | ||
"devDependencies": { | ||
"@types/commander": "^2.9.1", | ||
"@types/common-tags": "^1.2.5", | ||
"@types/glob": "^5.0.30", | ||
"@types/handlebars": "^4.0.33", | ||
"@types/jest": "^20.0.2", | ||
"@types/mkdirp": "^0.3.29", | ||
"@types/node": "7", | ||
"@types/request": "^0.0.44", | ||
"conventional-changelog": "^1.1.3", | ||
"cz-conventional-changelog": "^2.0.0", | ||
"graphql-tag": "^2.4.2", | ||
"jest": "^20.0.4", | ||
"nodemon": "^1.11.0", | ||
"rimraf": "^2.6.1", | ||
@@ -108,0 +92,0 @@ "tslint": "^5.4.3", |
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
231809
2
7
66
675
- Removedcamel-case@^3.0.0
- Removedcommander@^2.10.0
- Removedcommon-tags@^1.4.0
- Removedglob@^7.1.2
- Removedhandlebars@^4.0.10
- Removedmkdirp@^0.5.1
- Removedpascal-case@^2.0.1
- Removedrequest@^2.81.0
- Removedajv@6.12.6(transitive)
- Removedasn1@0.2.6(transitive)
- Removedassert-plus@1.0.0(transitive)
- Removedasynckit@0.4.0(transitive)
- Removedaws-sign2@0.7.0(transitive)
- Removedaws4@1.13.2(transitive)
- Removedbalanced-match@1.0.2(transitive)
- Removedbcrypt-pbkdf@1.0.2(transitive)
- Removedbrace-expansion@1.1.11(transitive)
- Removedcamel-case@3.0.0(transitive)
- Removedcaseless@0.12.0(transitive)
- Removedcombined-stream@1.0.8(transitive)
- Removedcommander@2.20.3(transitive)
- Removedcommon-tags@1.8.2(transitive)
- Removedconcat-map@0.0.1(transitive)
- Removedcore-util-is@1.0.2(transitive)
- Removeddashdash@1.14.1(transitive)
- Removeddelayed-stream@1.0.0(transitive)
- Removedecc-jsbn@0.1.2(transitive)
- Removedextend@3.0.2(transitive)
- Removedextsprintf@1.3.0(transitive)
- Removedfast-deep-equal@3.1.3(transitive)
- Removedfast-json-stable-stringify@2.1.0(transitive)
- Removedforever-agent@0.6.1(transitive)
- Removedform-data@2.3.3(transitive)
- Removedfs.realpath@1.0.0(transitive)
- Removedgetpass@0.1.7(transitive)
- Removedglob@7.2.3(transitive)
- Removedhandlebars@4.7.8(transitive)
- Removedhar-schema@2.0.0(transitive)
- Removedhar-validator@5.1.5(transitive)
- Removedhttp-signature@1.2.0(transitive)
- Removedinflight@1.0.6(transitive)
- Removedinherits@2.0.4(transitive)
- Removedis-typedarray@1.0.0(transitive)
- Removedisstream@0.1.2(transitive)
- Removedjsbn@0.1.1(transitive)
- Removedjson-schema@0.4.0(transitive)
- Removedjson-schema-traverse@0.4.1(transitive)
- Removedjson-stringify-safe@5.0.1(transitive)
- Removedjsprim@1.4.2(transitive)
- Removedlower-case@1.1.4(transitive)
- Removedmime-db@1.52.0(transitive)
- Removedmime-types@2.1.35(transitive)
- Removedminimatch@3.1.2(transitive)
- Removedminimist@1.2.8(transitive)
- Removedmkdirp@0.5.6(transitive)
- Removedneo-async@2.6.2(transitive)
- Removedno-case@2.3.2(transitive)
- Removedoauth-sign@0.9.0(transitive)
- Removedonce@1.4.0(transitive)
- Removedpascal-case@2.0.1(transitive)
- Removedpath-is-absolute@1.0.1(transitive)
- Removedperformance-now@2.1.0(transitive)
- Removedpsl@1.15.0(transitive)
- Removedpunycode@2.3.1(transitive)
- Removedqs@6.5.3(transitive)
- Removedrequest@2.88.2(transitive)
- Removedsafe-buffer@5.2.1(transitive)
- Removedsafer-buffer@2.1.2(transitive)
- Removedsource-map@0.6.1(transitive)
- Removedsshpk@1.18.0(transitive)
- Removedtough-cookie@2.5.0(transitive)
- Removedtunnel-agent@0.6.0(transitive)
- Removedtweetnacl@0.14.5(transitive)
- Removeduglify-js@3.19.3(transitive)
- Removedupper-case@1.1.3(transitive)
- Removedupper-case-first@1.1.2(transitive)
- Removeduri-js@4.4.1(transitive)
- Removedverror@1.10.0(transitive)
- Removedwordwrap@1.0.0(transitive)
- Removedwrappy@1.0.2(transitive)