Socket
Socket
Sign inDemoInstall

simple-graphql

Package Overview
Dependencies
24
Maintainers
1
Versions
300
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 5.0.8 to 5.1.0

4

dist/build/applyPluginsToSchemas.js

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

const result = {};
const schemaMap = {};
schemas.forEach((schema) => (schemaMap[schema.name] = schema));
plugins.forEach((plugin) => {

@@ -22,3 +24,3 @@ for (const schema of schemas) {

if (options != null && options.enable && plugin.applyToSchema) {
plugin.applyToSchema(schema, options, schemas);
plugin.applyToSchema(schema, options, schemaMap);
}

@@ -25,0 +27,0 @@ }

@@ -256,2 +256,4 @@ "use strict";

const typeMap = {};
const schemaMap = {};
schemas.forEach((schema) => (schemaMap[schema.name] = schema));
const resolves = [

@@ -288,3 +290,3 @@ function resolveInterfaceType(typeName) {

const fieldName = info.fieldName;
if (schemas.find((s) => s.name === subTypeName) != null) {
if (schemaMap[subTypeName] != null) {
if (root[fieldName] != null &&

@@ -343,3 +345,3 @@ root[fieldName].length > 0 &&

function resolveModelType(typeName) {
const schema = schemas.find((s) => s.name === typeName);
const schema = schemaMap[typeName];
if (schema instanceof definition_1.SGSchema) {

@@ -350,9 +352,17 @@ return buildModelType(schema, fieldTypeContext, context);

function resolveModelIdType(typeName) {
const schema = schemas.find((s) => s.name + 'Id' === typeName);
if (schema instanceof definition_1.SGSchema) {
return buildModelTypeId(schema, fieldTypeContext);
if (typeName.endsWith('Id')) {
const schema = schemaMap[typeName.substring(0, typeName.length - 2)];
if (schema instanceof definition_1.SGSchema) {
return buildModelTypeId(schema, fieldTypeContext);
}
}
},
function resolveModelConnectionType(typeName) {
const schema = schemas.find((s) => s.name + 'Connection' === typeName || s.name + 'Edge' === typeName);
let schema = typeName.endsWith('Connection')
? schemaMap[typeName.substring(0, typeName.length - 'Connection'.length)]
: null;
if (typeName.endsWith('Edge')) {
schema =
schemaMap[typeName.substring(0, typeName.length - 'Edge'.length)];
}
if (schema) {

@@ -359,0 +369,0 @@ const typeConfig = fieldTypeContext.typeConfig(schema.name);

@@ -69,2 +69,4 @@ "use strict";

function buildModelAssociations(schemas, models) {
const schemaMap = {};
schemas.forEach((schema) => (schemaMap[schema.name] = schema));
const getForeignKey = (config) => {

@@ -76,3 +78,3 @@ var _a, _b;

else if (config.foreignField) {
const schema = schemas.find((s) => s.name === config.target);
const schema = schemaMap[config.target];
const field = schema === null || schema === void 0 ? void 0 : schema.config.fields[config.foreignField];

@@ -79,0 +81,0 @@ if (field) {

@@ -286,3 +286,5 @@ import { GraphQLFieldResolver, GraphQLInputType, GraphQLInterfaceType, GraphQLOutputType, GraphQLResolveInfo } from 'graphql';

defaultOptions?: T | ((schema: BaseSGSchema) => T);
applyToSchema?: (schema: BaseSGSchema, options: T, schemas: Array<BaseSGSchema>) => void;
applyToSchema?: (schema: BaseSGSchema, options: T, schemas: {
[name: string]: BaseSGSchema;
}) => void;
applyToModel?: (model: SGModelCtrl, options: T, models: Array<SGModelCtrl>) => void;

@@ -289,0 +291,0 @@ };

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

}
const isModelType = (fieldOptions) => {
return (fieldOptions.type &&
schemas.find((s) => s.name === fieldOptions.type) != null);
};
const isModelType = (fieldOptions) => fieldOptions.type && schemas[fieldOptions.type] != null;
lodash_1.default.forOwn(schema.config.fields, (value, key) => {

@@ -51,0 +48,0 @@ var _a, _b, _c, _d;

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

const inputFields = {};
const isModelType = (fieldOptions) => {
return (fieldOptions.type &&
schemas.find((s) => s.name === fieldOptions.type) != null);
};
const isModelType = (fieldOptions) => fieldOptions.type && schemas[fieldOptions.type] != null;
lodash_1.default.forOwn(schema.config.fields, (value, key) => {

@@ -45,0 +42,0 @@ var _a, _b, _c, _d;

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

const getSearchFields = (additionFields, schema, schemas) => {
const isModelType = (fieldOptions) => {
return (fieldOptions.type &&
schemas.find((s) => s.name === fieldOptions.type) != null);
};
const isModelType = (fieldOptions) => fieldOptions.type && schemas[fieldOptions.type] != null;
const advanceType = (options) => {

@@ -36,0 +33,0 @@ if (options.elements) {

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

const inputFields = {};
const isModelType = (fieldOptions) => {
return (fieldOptions.type &&
schemas.find((s) => s.name === fieldOptions.type) != null);
};
const isModelType = (fieldOptions) => fieldOptions.type && schemas[fieldOptions.type] != null;
lodash_1.default.forOwn(schema.config.fields, (value, key) => {

@@ -45,0 +42,0 @@ var _a, _b, _c, _d, _e, _f, _g;

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

const name = StringHelper_1.default.toInitialLowerCase(schema.name);
const isModelType = (fieldOptions) => {
return (fieldOptions.type &&
schemas.find((s) => s.name === fieldOptions.type) != null);
};
const isModelType = (fieldOptions) => fieldOptions.type && schemas[fieldOptions.type] != null;
//TODO support mapper setting

@@ -62,0 +59,0 @@ const searchFields = {

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

const changedName = 'changed' + StringHelper_1.default.toInitialUpperCase(schema.name);
const isModelType = (fieldOptions) => {
return (fieldOptions.type &&
schemas.find((s) => s.name === fieldOptions.type) != null);
};
const isModelType = (fieldOptions) => fieldOptions.type && schemas[fieldOptions.type] != null;
const valuesInputFieldMap = {};

@@ -45,0 +42,0 @@ lodash_1.default.forOwn(schema.config.fields, (value, key) => {

{
"name": "simple-graphql",
"version": "5.0.8",
"version": "5.1.0",
"description": "The simple way to generates GraphQL schemas and Sequelize models from your models definition.",

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

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc