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.9.0-alpha.1a4d72cb to 0.9.0-alpha.2f7495c1

1

dist/operations/build-selection-set.d.ts
import { SelectionSetItem } from '../types';
import { GraphQLSchema, GraphQLType, SelectionSetNode } from 'graphql';
export declare function separateSelectionSet(selectionSet: SelectionSetItem[]): any;
export declare function buildSelectionSet(schema: GraphQLSchema, rootObject: GraphQLType, node: SelectionSetNode): SelectionSetItem[];

@@ -17,2 +17,3 @@ "use strict";

var debugging_1 = require("../debugging");
var resolve_type_indicators_1 = require("../schema/resolve-type-indicators");
function separateSelectionSet(selectionSet) {

@@ -31,2 +32,3 @@ var fields = selectionSet.filter(function (n) { return types_1.isFieldNode(n); });

}
exports.separateSelectionSet = separateSelectionSet;
function buildSelectionSet(schema, rootObject, node) {

@@ -39,5 +41,11 @@ return (node && node.selections ? node.selections : []).map(function (selectionNode) {

var field = get_field_def_1.getFieldDef(rootObject, fieldNode);
if (!field) {
debugging_1.debugLog("[buildSelectionSet] Ignoring field because of null result from getFieldDef...");
return null;
}
var resolvedType = resolve_type_1.resolveType(field.type);
var childSelectionSet = buildSelectionSet(schema, graphql_1.getNamedType(field.type), fieldNode.selectionSet);
return __assign({ isField: true, isFragmentSpread: false, isInlineFragment: false, isLeaf: childSelectionSet.length === 0, name: name, selectionSet: childSelectionSet }, separateSelectionSet(childSelectionSet), { type: resolvedType.name, isRequired: resolvedType.isRequired, isArray: resolvedType.isArray });
var namedType = graphql_1.getNamedType(field.type);
var indicators = resolve_type_indicators_1.resolveTypeIndicators(namedType);
return __assign({ isField: true, isFragmentSpread: false, isInlineFragment: false, isLeaf: childSelectionSet.length === 0, name: name, selectionSet: childSelectionSet }, separateSelectionSet(childSelectionSet), { type: resolvedType.name, isRequired: resolvedType.isRequired, isArray: resolvedType.isArray, isEnum: indicators.isEnum, isScalar: indicators.isScalar, isInterface: indicators.isInterface, isUnion: indicators.isUnion, isInputType: indicators.isInputType, isType: indicators.isType });
}

@@ -65,5 +73,5 @@ else if (selectionNode.kind === kinds_1.FRAGMENT_SPREAD) {

}
});
}).filter(function (item) { return item; }); // filter to remove null types
}
exports.buildSelectionSet = buildSelectionSet;
//# sourceMappingURL=build-selection-set.js.map

18

dist/operations/transform-fragment-document.js
"use strict";
var __assign = (this && this.__assign) || Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -14,12 +22,8 @@ var graphql_1 = require("graphql");

var directives = get_directives_1.getDirectives(schema, fragment);
return {
name: name,
var selectionSet = build_selection_set_1.buildSelectionSet(schema, root, fragment.selectionSet);
return __assign({ name: name,
onType: onType,
selectionSet: build_selection_set_1.buildSelectionSet(schema, root, fragment.selectionSet),
document: printer_1.print(fragment),
directives: directives,
usesDirectives: Object.keys(directives).length > 0,
};
selectionSet: selectionSet, document: printer_1.print(fragment), directives: directives, usesDirectives: Object.keys(directives).length > 0 }, build_selection_set_1.separateSelectionSet(selectionSet));
}
exports.transformFragment = transformFragment;
//# sourceMappingURL=transform-fragment-document.js.map
"use strict";
var __assign = (this && this.__assign) || Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -15,17 +23,7 @@ var get_root_1 = require("../utils/get-root");

var directives = get_directives_1.getDirectives(schema, operationNode);
return {
name: name,
selectionSet: build_selection_set_1.buildSelectionSet(schema, root, operationNode.selectionSet),
operationType: operationNode.operation,
variables: variables,
hasVariables: variables.length > 0,
isQuery: operationNode.operation === 'query',
isMutation: operationNode.operation === 'mutation',
isSubscription: operationNode.operation === 'subscription',
document: printer_1.print(operationNode),
directives: directives,
usesDirectives: Object.keys(directives).length > 0,
};
var selectionSet = build_selection_set_1.buildSelectionSet(schema, root, operationNode.selectionSet);
return __assign({ name: name,
selectionSet: selectionSet, operationType: operationNode.operation, variables: variables, hasVariables: variables.length > 0, isQuery: operationNode.operation === 'query', isMutation: operationNode.operation === 'mutation', isSubscription: operationNode.operation === 'subscription', document: printer_1.print(operationNode), directives: directives, usesDirectives: Object.keys(directives).length > 0 }, build_selection_set_1.separateSelectionSet(selectionSet));
}
exports.transformOperation = transformOperation;
//# sourceMappingURL=transform-operation.js.map

@@ -6,2 +6,3 @@ "use strict";

var debugging_1 = require("../debugging");
var resolve_type_indicators_1 = require("../schema/resolve-type-indicators");
function transformVariables(schema, definitionNode) {

@@ -12,2 +13,4 @@ return definitionNode.variableDefinitions.map(function (variableDefinition) {

debugging_1.debugLog("[transformVariables] transforming variable " + variableDefinition.variable.name.value + " of type " + resolvedType.name);
var namedType = graphql_1.getNamedType(typeFromSchema);
var indicators = resolve_type_indicators_1.resolveTypeIndicators(namedType);
return {

@@ -18,2 +21,8 @@ name: variableDefinition.variable.name.value,

isRequired: resolvedType.isRequired,
isEnum: indicators.isEnum,
isScalar: indicators.isScalar,
isInterface: indicators.isInterface,
isUnion: indicators.isUnion,
isInputType: indicators.isInputType,
isType: indicators.isType,
};

@@ -20,0 +29,0 @@ });

@@ -11,3 +11,3 @@ "use strict";

isUnion: namedType['resolveType'] !== undefined && namedType['getTypes'] !== undefined,
isInputType: namedType['getFields'] !== undefined && namedType['getInterfaces'] === undefined,
isInputType: namedType['getFields'] !== undefined && namedType['getInterfaces'] === undefined && namedType['resolveType'] === undefined,
isEnum: isEnum,

@@ -14,0 +14,0 @@ };

@@ -116,2 +116,8 @@ import { GraphQLSchema } from 'graphql';

hasFields: boolean;
isType: boolean;
isScalar: boolean;
isInterface: boolean;
isUnion: boolean;
isInputType: boolean;
isEnum: boolean;
}

@@ -126,2 +132,8 @@ export declare function isFieldNode(node: SelectionSetItem): node is SelectionSetFieldNode;

document: string;
fields: SelectionSetFieldNode[];
fragmentsSpread: SelectionSetFragmentSpread[];
inlineFragments: SelectionSetInlineFragment[];
hasFragmentsSpread: boolean;
hasInlineFragments: boolean;
hasFields: boolean;
}

@@ -138,2 +150,8 @@ export interface Operation extends AstNode {

document: string;
fields: SelectionSetFieldNode[];
fragmentsSpread: SelectionSetFragmentSpread[];
inlineFragments: SelectionSetInlineFragment[];
hasFragmentsSpread: boolean;
hasInlineFragments: boolean;
hasFields: boolean;
}

@@ -145,2 +163,8 @@ export interface Variable {

isArray: boolean;
isType: boolean;
isScalar: boolean;
isInterface: boolean;
isUnion: boolean;
isInputType: boolean;
isEnum: boolean;
}

@@ -147,0 +171,0 @@ export interface Document {

@@ -6,2 +6,5 @@ "use strict";

var name = fieldAST.name.value;
if (name === '__typename') {
return null;
}
if (parentType instanceof graphql_1.GraphQLObjectType ||

@@ -8,0 +11,0 @@ parentType instanceof graphql_1.GraphQLInterfaceType) {

{
"name": "graphql-codegen-core",
"version": "0.9.0-alpha.1a4d72cb",
"version": "0.9.0-alpha.2f7495c1",
"description": "GraphQL types and code generator based on schema",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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