Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

graphql-codegen-core

Package Overview
Dependencies
Maintainers
1
Versions
1651
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphql-codegen-core - npm Package Compare versions

Comparing version 0.6.0-alpha.14ecb322 to 0.6.0-alpha.1bc8b137

dist/operations/build-selection-set.d.ts

5

dist/index.d.ts
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

4

dist/schema/resolve-type.d.ts

@@ -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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc