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 4.1.11 to 4.2.0

19

dist/build/buildFieldTypeContext.js

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

interfaces: [context.interface('Node')],
fields: () => toGraphQLFieldConfigMap_1.default(typeName, '', Object.assign(Object.assign({ id: {
fields: () => (0, toGraphQLFieldConfigMap_1.default)(typeName, '', Object.assign(Object.assign({ id: {
type: 'Id',

@@ -157,3 +157,3 @@ nullable: false,

const typeName = schema.name + 'Id';
const idType = globalIdType_1.default(schema.name);
const idType = (0, globalIdType_1.default)(schema.name);
return {

@@ -169,3 +169,3 @@ name: typeName,

const toOutputType = (name, options) => {
const outputConfigMap = toGraphQLFieldConfigMap_1.default(name, '', { '': options }, {
const outputConfigMap = (0, toGraphQLFieldConfigMap_1.default)(name, '', { '': options }, {
hookFieldResolve: (name, options) => context.hookFieldResolve(name, options),

@@ -179,3 +179,3 @@ hookQueryResolve: (name, options) => context.hookQueryResolve(name, options),

const toInputType = (name, options) => {
const inputConfigMap = toGraphQLInputFieldConfigMap_1.default(name, { '': options }, fieldTypeContext)[''];
const inputConfigMap = (0, toGraphQLInputFieldConfigMap_1.default)(name, { '': options }, fieldTypeContext)[''];
return inputConfigMap && inputConfigMap.type;

@@ -253,6 +253,7 @@ };

type: typeConfig.outputType,
resolve: (typeConfig === null || typeConfig === void 0 ? void 0 : typeConfig.outputResolve) ? context.hookFieldResolve('value', {
output: { type: wrapType },
resolve: typeConfig.outputResolve
})
resolve: (typeConfig === null || typeConfig === void 0 ? void 0 : typeConfig.outputResolve)
? context.hookFieldResolve('value', {
output: { type: wrapType },
resolve: typeConfig.outputResolve
})
: undefined

@@ -367,3 +368,3 @@ }

const typeConfig = fieldTypeContext.typeConfig(schema.name);
if (!typeConfig) {
if (!(typeConfig === null || typeConfig === void 0 ? void 0 : typeConfig.outputType)) {
return undefined;

@@ -370,0 +371,0 @@ }

@@ -6,4 +6,4 @@ "use strict";

const interfaces = {
Node: graphql_relay_1.nodeDefinitions((globalId) => {
const { type, id } = graphql_relay_1.fromGlobalId(globalId);
Node: (0, graphql_relay_1.nodeDefinitions)((globalId) => {
const { type, id } = (0, graphql_relay_1.fromGlobalId)(globalId);
console.log('Warning-------------------- node id Fetcher not implement' +

@@ -16,3 +16,3 @@ type +

const typeConfig = context.typeConfig(type);
if (typeConfig) {
if (typeConfig === null || typeConfig === void 0 ? void 0 : typeConfig.outputType) {
return typeConfig.outputType;

@@ -19,0 +19,0 @@ }

@@ -17,6 +17,6 @@ "use strict";

}
const inputFields = toGraphQLInputFieldConfigMap_1.default(StringHelper_1.default.toInitialUpperCase(name), options.input || {}, context);
const outputFields = toGraphQLFieldConfigMap_1.default(name, 'Payload', options.output || {}, context);
const inputFields = (0, toGraphQLInputFieldConfigMap_1.default)(StringHelper_1.default.toInitialUpperCase(name), options.input || {}, context);
const outputFields = (0, toGraphQLFieldConfigMap_1.default)(name, 'Payload', options.output || {}, context);
const payloadFields = lodash_1.default.get(options, 'mutation.payloadFields', []);
mutations[name] = mutationWithClientMutationId_1.default({
mutations[name] = (0, mutationWithClientMutationId_1.default)({
name: StringHelper_1.default.toInitialUpperCase(name),

@@ -23,0 +23,0 @@ inputFields: inputFields,

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

}
const fieldConfig = toGraphQLFieldConfigMap_1.default(name, 'Payload', { '': options.output }, context)[''];
const fieldConfig = (0, toGraphQLFieldConfigMap_1.default)(name, 'Payload', { '': options.output }, context)[''];
const finalOptions = Object.assign({}, options);

@@ -66,3 +66,3 @@ const fieldResolve = fieldConfig.resolve;

if (options.input || fieldConfig.args) {
queries[name].args = Object.assign(Object.assign({}, fieldConfig.args), toGraphQLInputFieldConfigMap_1.default(StringHelper_1.default.toInitialUpperCase(name), Object.assign({}, options.input), context));
queries[name].args = Object.assign(Object.assign({}, fieldConfig.args), (0, toGraphQLInputFieldConfigMap_1.default)(StringHelper_1.default.toInitialUpperCase(name), Object.assign({}, options.input), context));
}

@@ -69,0 +69,0 @@ };

@@ -20,6 +20,6 @@ "use strict";

function buildGraphQLContext(sequelize, config, buildOptions) {
const plugins = buildPlugins_1.default(config.plugins || []);
const plugins = (0, buildPlugins_1.default)(config.plugins || []);
const sgContext = {
sequelize: sequelize,
schemas: applyPluginsToSchemas_1.default(config.schemas || [], plugins, buildOptions.defaultPlugin || {}),
schemas: (0, applyPluginsToSchemas_1.default)(config.schemas || [], plugins, buildOptions.defaultPlugin || {}),
models: {},

@@ -29,4 +29,4 @@ services: {},

};
const resolveContext = buildResolverContext_1.default(config.hooks || [], sgContext);
const interfaceContext = buildInterfaceContext_1.default(sgContext);
const resolveContext = (0, buildResolverContext_1.default)(config.hooks || [], sgContext);
const interfaceContext = (0, buildInterfaceContext_1.default)(sgContext);
const context = {

@@ -44,8 +44,8 @@ hookFieldResolve: (name, options) => resolveContext.hookFieldResolve(name, options),

};
const fieldTypeContext = buildFieldTypeContext_1.default(config.types || [], config.dataTypes || [], config.schemas || [], context);
const fieldTypeContext = (0, buildFieldTypeContext_1.default)(config.types || [], config.dataTypes || [], config.schemas || [], context);
context.typeConfig = (typeName) => fieldTypeContext.typeConfig(typeName);
sgContext.typeConfig = (typeName) => fieldTypeContext.typeConfig(typeName);
sgContext.models = applyPluginsToModels_1.default(buildSequelizeModels_1.default(sequelize, config.schemas || [], sgContext), plugins, buildOptions.defaultPlugin || {});
sgContext.services = buildServices_1.default(config.services || [], sgContext);
const rootQueries = buildRootQueries_1.default([
sgContext.models = (0, applyPluginsToModels_1.default)((0, buildSequelizeModels_1.default)(sequelize, config.schemas || [], sgContext), plugins, buildOptions.defaultPlugin || {});
sgContext.services = (0, buildServices_1.default)(config.services || [], sgContext);
const rootQueries = (0, buildRootQueries_1.default)([
...(config.schemas || []).map((schema) => schema.config.queries),

@@ -69,3 +69,3 @@ config.queries || {}

}
const rootMutations = buildRootMutations_1.default([
const rootMutations = (0, buildRootMutations_1.default)([
...(config.schemas || []).map((schema) => schema.config.mutations),

@@ -72,0 +72,0 @@ config.mutations || {}

import { FindOptions } from 'sequelize';
import { GraphQLResolveInfo } from 'graphql';
import { SGModel, SGModelCtrl, SGResolveContext } from '../../index';
export default function <M extends SGModel>(this: SGModelCtrl<M>, id: number, options: FindOptions, context: SGResolveContext, info: GraphQLResolveInfo, path?: string): Promise<M | null>;
export default function <M extends SGModel>(this: SGModelCtrl<M>, id: number | string, options: FindOptions, context: SGResolveContext, info: GraphQLResolveInfo, path?: string): Promise<M | null>;

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

});
const key = `${dbModel.name}.findByPk|${getFindOptionsKey_1.default(dbModel, option)}`;
const key = `${dbModel.name}.findByPk|${(0, getFindOptionsKey_1.default)(dbModel, option)}`;
if (!context.dataloaderMap[key]) {

@@ -34,0 +34,0 @@ context.dataloaderMap[key] = new dataloader_1.default(function (ids) {

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

maxBatchSize: 1,
cacheKeyFn: (k) => getFindOptionsKey_1.default(dbModel, k)
cacheKeyFn: (k) => (0, getFindOptionsKey_1.default)(dbModel, k)
});

@@ -44,0 +44,0 @@ }

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

if (typeof value === 'string') {
return graphql_relay_1.toGlobalId(typeName, value);
return (0, graphql_relay_1.toGlobalId)(typeName, value);
}

@@ -20,3 +20,3 @@ else {

if (typeof value === 'string') {
const { type, id } = graphql_relay_1.fromGlobalId(value);
const { type, id } = (0, graphql_relay_1.fromGlobalId)(value);
if (type === typeName) {

@@ -43,3 +43,3 @@ if (Number.parseInt(id).toString() === id) {

if (typeof value === 'string') {
const { type, id } = graphql_relay_1.fromGlobalId(value);
const { type, id } = (0, graphql_relay_1.fromGlobalId)(value);
if (type === typeName) {

@@ -46,0 +46,0 @@ if (Number.parseInt(id).toString() === id) {

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

}
const value = graphql_1.coerceInputValue(inputValue[valueKey], valueType);
const value = (0, graphql_1.coerceInputValue)(inputValue[valueKey], valueType);
return {

@@ -76,3 +76,3 @@ [typeKey]: inputValue[typeKey],

//if (isValidLiteralValue(inputType, ast).length === 0) {
return graphql_1.valueFromAST(ast, inputType);
return (0, graphql_1.valueFromAST)(ast, inputType);
// } else {

@@ -79,0 +79,0 @@ // throw new GraphQLError(

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

} & SGModelStatic;
export declare abstract class SGService {
export declare class SGService {
getSGContext: () => SGContext;

@@ -41,0 +41,0 @@ }

@@ -30,4 +30,4 @@ "use strict";

const self = this;
const relateModelNames = [self.model.name, ...getIncludeModeNames_1.default(options)];
return `${self.prefix}|${method}|${relateModelNames.join('|')}|${getFindOptionsKey_1.default(self.model, options)}`;
const relateModelNames = [self.model.name, ...(0, getIncludeModeNames_1.default)(options)];
return `${self.prefix}|${method}|${relateModelNames.join('|')}|${(0, getFindOptionsKey_1.default)(self.model, options)}`;
}

@@ -46,3 +46,3 @@ isCacheValid(options) {

self.model.name,
...getIncludeModeNames_1.default(options)
...(0, getIncludeModeNames_1.default)(options)
];

@@ -63,3 +63,3 @@ return (transaction.clearCaches.find((cache) => relateModelNames.indexOf(cache.model.name) !== -1) == null);

if (cacheValue !== undefined) {
return cacheValue.map((value) => dataToInstance_1.default(value, self.model, (options === null || options === void 0 ? void 0 : options.include) || []));
return cacheValue.map((value) => (0, dataToInstance_1.default)(value, self.model, (options === null || options === void 0 ? void 0 : options.include) || []));
}

@@ -72,3 +72,3 @@ else {

if ((yield self.cacheManger.get(lockKey)) === lockValue) {
yield self.cacheManger.set(cacheKey, result.map((r) => instanceToData_1.default(r)), self.expire);
yield self.cacheManger.set(cacheKey, result.map((r) => (0, instanceToData_1.default)(r)), self.expire);
}

@@ -88,3 +88,3 @@ return result;

if (cacheValue !== undefined) {
return dataToInstance_1.default(cacheValue, self.model, options ? options.include : []);
return (0, dataToInstance_1.default)(cacheValue, self.model, options ? options.include : []);
}

@@ -97,3 +97,3 @@ else {

if ((yield self.cacheManger.get(lockKey)) === lockValue) {
yield self.cacheManger.set(cacheKey, instanceToData_1.default(result), self.expire);
yield self.cacheManger.set(cacheKey, (0, instanceToData_1.default)(result), self.expire);
}

@@ -100,0 +100,0 @@ return result;

@@ -5,4 +5,4 @@ import { GraphQLFieldConfigMap } from 'graphql';

declare const toGraphQLFieldConfigMap: (name: string, postfix: string, fields: {
[id: string]: import("..").SGFieldTypeDefinition<import("..").SGOutputFieldTypeMetadata>;
[id: string]: SGOutputFieldConfig;
}, context: Context) => GraphQLFieldConfigMap<any, any>;
export default toGraphQLFieldConfigMap;

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

type: typeConfig.outputType,
args: toGraphQLInputFieldConfigMap_1.default(toTypeName(fieldName, fieldPath), typeConfig.additionalInput || {}, context)
args: (0, toGraphQLInputFieldConfigMap_1.default)(toTypeName(fieldName, fieldPath), typeConfig.additionalInput || {}, context)
};

@@ -97,3 +97,3 @@ const outputResolve = typeConfig.outputResolve;

if ((_k = (_j = field.metadata) === null || _j === void 0 ? void 0 : _j.graphql) === null || _k === void 0 ? void 0 : _k.input) {
config.args = Object.assign(Object.assign({}, config.args), toGraphQLInputFieldConfigMap_1.default(toTypeName(name, path), (_m = (_l = field.metadata) === null || _l === void 0 ? void 0 : _l.graphql) === null || _m === void 0 ? void 0 : _m.input, context));
config.args = Object.assign(Object.assign({}, config.args), (0, toGraphQLInputFieldConfigMap_1.default)(toTypeName(name, path), (_m = (_l = field.metadata) === null || _l === void 0 ? void 0 : _l.graphql) === null || _m === void 0 ? void 0 : _m.input, context));
}

@@ -100,0 +100,0 @@ return config;

import { GraphQLInputFieldConfigMap } from 'graphql';
import { SGInputFieldConfig, SGTypeContext } from '..';
declare const toGraphQLInputFieldConfigMap: (name: string, fields: {
[id: string]: import("..").SGFieldTypeDefinition<import("..").SGInputFieldTypeMetadata>;
[id: string]: SGInputFieldConfig;
}, context: SGTypeContext) => GraphQLInputFieldConfigMap;
export default toGraphQLInputFieldConfigMap;

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

return makeNonNull({
type: unionInputType_1.default({
type: (0, unionInputType_1.default)({
name: StringHelper_1.default.toInitialUpperCase(toTypeName(name, path)) + 'Input',

@@ -88,0 +88,0 @@ inputValueTypes: lodash_1.default.mapValues(field.mapping, (options, key) => {

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

@@ -46,4 +46,4 @@ "main": "dist/index.js",

"express-graphql": "^0.12.0",
"graphql": "^15.5.0",
"graphql-relay": "^0.6.0",
"graphql": "^15.5.3",
"graphql-relay": "^0.9.0",
"jest": "^26.6.3",

@@ -50,0 +50,0 @@ "mysql2": "^1.7.0",

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

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

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