Socket
Socket
Sign inDemoInstall

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.19.0-alpha.80bb6e0c to 0.19.0-alpha.80ec87c7

4

dist/schema/schema-to-template-context.d.ts
import { GraphQLSchema } from 'graphql';
import { SchemaTemplateContext, DocumentFile } from '../types';
export declare function schemaToTemplateContext(schema: GraphQLSchema, documents?: DocumentFile[]): SchemaTemplateContext;
import { SchemaTemplateContext } from '../types';
export declare function schemaToTemplateContext(schema: GraphQLSchema): SchemaTemplateContext;

@@ -14,5 +14,5 @@ "use strict";

var GRAPHQL_PRIMITIVES = ['String', 'Int', 'Boolean', 'ID', 'Float'];
var clearTypes = function (typesMap, forcedTypes) {
var clearTypes = function (typesMap) {
return Object.keys(typesMap)
.filter(function (key) { return forcedTypes.includes(key) || (!GRAPHQL_PRIMITIVES.includes(key) && !key.startsWith('__')); })
.filter(function (key) { return !GRAPHQL_PRIMITIVES.includes(key) && !key.startsWith('__'); })
.reduce(function (obj, key) {

@@ -23,5 +23,4 @@ obj[key] = typesMap[key];

};
function schemaToTemplateContext(schema, documents) {
function schemaToTemplateContext(schema) {
debugging_1.debugLog('[schemaToTemplateContext] started...');
var introspectionTypesToInclude = includeIntrospectionTypes(schema, documents);
var directives = graphql_toolkit_1.getDirectives(schema, schema);

@@ -49,3 +48,3 @@ var result = {

var rawTypesMap = schema.getTypeMap();
var typesMap = clearTypes(rawTypesMap, introspectionTypesToInclude.map(function (t) { return t.name; }));
var typesMap = clearTypes(rawTypesMap);
var typesArray = object_map_to_array_1.objectMapToArray(typesMap);

@@ -90,18 +89,2 @@ debugging_1.debugLog("[schemaToTemplateContext] Got total of " + typesArray.length + " types in the GraphQL schema");

exports.schemaToTemplateContext = schemaToTemplateContext;
function includeIntrospectionTypes(schema, documents) {
var typesToInclude = [];
if (documents) {
var typeInfo_1 = new graphql_1.TypeInfo(schema);
var visitor_1 = graphql_1.visitWithTypeInfo(typeInfo_1, {
Field: function () {
var type = graphql_1.getNamedType(typeInfo_1.getType());
if (graphql_1.isIntrospectionType(type) && graphql_1.isEnumType(type) && !typesToInclude.includes(type)) {
typesToInclude.push(type);
}
}
});
documents.forEach(function (doc) { return graphql_1.visit(doc.content, visitor_1); });
}
return typesToInclude;
}
//# sourceMappingURL=schema-to-template-context.js.map
{
"name": "graphql-codegen-core",
"version": "0.19.0-alpha.80bb6e0c",
"version": "0.19.0-alpha.80ec87c7",
"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

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