Socket
Socket
Sign inDemoInstall

simple-graphql

Package Overview
Dependencies
Maintainers
1
Versions
300
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simple-graphql - npm Package Compare versions

Comparing version 4.0.12 to 4.0.13

2

dist/build/buildFieldTypeContext.js

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

description: value.description || ((_a = value.output.metadata) === null || _a === void 0 ? void 0 : _a.description),
config: value.config,
hookOptions: value.hookOptions,
graphql: {

@@ -72,0 +72,0 @@ input: value.input,

@@ -17,8 +17,10 @@ "use strict";

});
const applyHooks = (action) => {
let hookFunc = (action, invokeInfo, next) => next();
const applyHooks = (target) => {
let hookFunc = (target, invokeInfo, next) => next();
[...finalHooks].reverse().forEach((hook) => {
var _a;
const func = hookFunc;
if (!hook.filter || hook.filter(action)) {
hookFunc = (action, invokeInfo, next) => hook.hook(action, invokeInfo, func.bind(null, action, invokeInfo, next));
const hookTarget = Object.assign(Object.assign({}, target), { options: (_a = target.targetConfig.hookOptions) === null || _a === void 0 ? void 0 : _a[hook.key] });
if (hook.filter == null || hook.filter(hookTarget)) {
hookFunc = (target, invokeInfo, next) => hook.hook(hookTarget, invokeInfo, func.bind(null, target, invokeInfo, next));
}

@@ -30,5 +32,9 @@ });

hookFieldResolve: (name, options) => {
const action = { type: 'field', name: name, options: options };
const hookFunc = applyHooks(action);
return (source, args, context, info) => hookFunc(action, {
const target = {
type: 'field',
name: name,
targetConfig: options
};
const hookFunc = applyHooks(target);
return (source, args, context, info) => hookFunc(target, {
source: source,

@@ -42,5 +48,9 @@ args: args,

hookQueryResolve: (name, options) => {
const action = { type: 'query', name: name, options: options };
const hookFunc = applyHooks(action);
return (source, args, context, info) => hookFunc(action, {
const target = {
type: 'query',
name: name,
targetConfig: options
};
const hookFunc = applyHooks(target);
return (source, args, context, info) => hookFunc(target, {
source: source,

@@ -54,5 +64,9 @@ args: args,

hookMutationResolve: (name, options) => {
const action = { type: 'mutation', name: name, options: options };
const hookFunc = applyHooks(action);
return (source, args, context, info) => hookFunc(action, {
const target = {
type: 'mutation',
name: name,
targetConfig: options
};
const hookFunc = applyHooks(target);
return (source, args, context, info) => hookFunc(target, {
source: source,

@@ -59,0 +73,0 @@ args: args,

@@ -66,8 +66,10 @@ import { GraphQLFieldResolver, GraphQLInputType, GraphQLInterfaceType, GraphQLOutputType, GraphQLResolveInfo } from 'graphql';

};
export interface ResolveContext {
}
export declare type FieldResolve<T = any> = (source: T, args: {
[key: string]: any;
}, context: any, info: GraphQLResolveInfo, sgContext: SGContext) => any;
}, context: ResolveContext, info: GraphQLResolveInfo, sgContext: SGContext) => any;
export declare type RootResolve = (args: {
[key: string]: any;
}, context: any, info: GraphQLResolveInfo, sgContext: SGContext) => any;
}, context: ResolveContext, info: GraphQLResolveInfo, sgContext: SGContext) => any;
export declare type TypeConfig = {

@@ -86,5 +88,3 @@ name: string;

export declare type OutputFieldTypeMetadata = FieldTypeMetadata & {
config?: {
[key: string]: any;
};
hookOptions?: HookOptionsMap;
graphql?: {

@@ -177,5 +177,3 @@ hidden?: boolean;

description?: string;
config?: {
[key: string]: any;
};
hookOptions?: HookOptionsMap;
input?: InputFieldConfigMap;

@@ -213,5 +211,3 @@ dependentFields?: Array<string>;

description?: string;
config?: {
[key: string]: any;
};
hookOptions?: HookOptionsMap;
input?: InputFieldConfigMap;

@@ -226,5 +222,3 @@ output: OutputFieldConfig;

description?: string;
config?: {
[key: string]: any;
};
hookOptions?: HookOptionsMap;
input: InputFieldConfigMap;

@@ -247,20 +241,32 @@ output: OutputFieldConfigMap;

};
export declare type HookAction = {
type: 'field' | 'query' | 'mutation';
export interface HookOptionsMap {
}
export declare type HookTarget<T = any> = {
name: string;
options: LinkedFieldConfig | QueryConfig | MutationConfig;
};
export declare type HookConfig = {
options?: T;
} & ({
type: 'field';
targetConfig: LinkedFieldConfig;
} | {
type: 'query';
targetConfig: QueryConfig;
} | {
type: 'mutation';
targetConfig: MutationConfig;
});
export declare type HookFunc<T = any> = (target: HookTarget<T>, invokeInfo: {
source?: any;
args: {
[key: string]: any;
};
context: ResolveContext;
info: GraphQLResolveInfo;
sgContext: SGContext;
}, next: () => Promise<any>) => Promise<any>;
export declare type HookConfig<T = any> = {
key: string;
description?: string;
priority?: number;
filter: (action: HookAction) => boolean;
hook: (action: HookAction, invokeInfo: {
source: any;
args: {
[key: string]: any;
} | null | undefined;
context: any;
info: GraphQLResolveInfo;
sgContext: SGContext;
}, next: () => any) => any;
filter?: (target: HookTarget<T>) => boolean;
hook: HookFunc<T>;
};

@@ -267,0 +273,0 @@ export declare type PluginConfig<T = PluginOptions> = {

@@ -1,2 +0,2 @@

import { ColumnFieldConfigMap, InputFieldConfigMap, LinkedFieldConfigMap, MutationConfigMap, QueryConfigMap, SchemaOptions } from '../Definition';
import { ColumnFieldConfigMap, HookOptionsMap, InputFieldConfigMap, LinkedFieldConfigMap, MutationConfigMap, QueryConfigMap, SchemaOptions } from '../Definition';
import Sequelize, { BelongsToManyOptions, BelongsToOptions, HasManyOptions, HasOneOptions, OrderItem } from 'sequelize';

@@ -8,3 +8,3 @@ /**

[key: string]: {
config?: Object;
hookOptions?: HookOptionsMap;
hidden?: boolean;

@@ -29,5 +29,3 @@ target: string;

[key: string]: {
config?: {
[key: string]: any;
};
hookOptions?: HookOptionsMap;
target: string;

@@ -34,0 +32,0 @@ description?: string;

@@ -1,12 +0,12 @@

import { PluginConfig, PluginOptions } from '../Definition';
import { HookOptionsMap, PluginConfig, PluginOptions } from '../Definition';
declare type AddMutationOptions = PluginOptions & {
name?: string;
hookOptions?: HookOptionsMap;
};
declare module '../Definition' {
interface PluginOptionsMap {
addMutation?: PluginOptions & {
name?: string;
};
addMutation?: AddMutationOptions;
}
}
declare const _default: PluginConfig<PluginOptions & {
name?: string | undefined;
}>;
declare const _default: PluginConfig<AddMutationOptions>;
export default _default;

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

[config.name || name]: {
config: config,
hookOptions: config.hookOptions,
input: inputFields,

@@ -61,0 +61,0 @@ output: {

@@ -1,12 +0,12 @@

import { PluginConfig, PluginOptions } from '../Definition';
import { HookOptionsMap, PluginConfig, PluginOptions } from '../Definition';
declare type BulkAddMutationOptions = PluginOptions & {
name?: string;
hookOptions?: HookOptionsMap;
};
declare module '../Definition' {
interface PluginOptionsMap {
bulkAddMutation?: PluginOptions & {
name?: string;
};
bulkAddMutation?: BulkAddMutationOptions;
}
}
declare const _default: PluginConfig<PluginOptions & {
name?: string | undefined;
}>;
declare const _default: PluginConfig<BulkAddMutationOptions>;
export default _default;

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

[config.name || name]: {
config: config,
hookOptions: config.hookOptions,
input: {

@@ -61,0 +61,0 @@ values: {

import { CacheManager, PluginConfig, PluginOptions } from '../Definition';
declare type CacheOptions = PluginOptions & {
prefix?: string;
cacheManager?: CacheManager;
expire?: number;
};
declare module '../Definition' {
interface PluginOptionsMap {
cache?: PluginOptions & {
prefix?: string;
cacheManager?: CacheManager;
expire?: number;
};
cache?: CacheOptions;
}
}
declare const _default: PluginConfig<PluginOptions & {
prefix?: string | undefined;
cacheManager?: CacheManager | undefined;
expire?: number | undefined;
}>;
declare const _default: PluginConfig<CacheOptions>;
export default _default;

@@ -1,12 +0,12 @@

import { PluginConfig, PluginOptions } from '../Definition';
import { HookOptionsMap, PluginConfig, PluginOptions } from '../Definition';
declare type DeleteMutationOptions = PluginOptions & {
name?: string;
hookOptions?: HookOptionsMap;
};
declare module '../Definition' {
interface PluginOptionsMap {
deleteMutation?: PluginOptions & {
name?: string;
};
deleteMutation?: DeleteMutationOptions;
}
}
declare const _default: PluginConfig<PluginOptions & {
name?: string | undefined;
}>;
declare const _default: PluginConfig<DeleteMutationOptions>;
export default _default;

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

[config.name || name]: {
config: config,
hookOptions: config.hookOptions,
input: {

@@ -42,0 +42,0 @@ id: {

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

[key]: {
config: config.config,
hookOptions: config.hookOptions,
description: config.description,

@@ -71,0 +71,0 @@ input: args,

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

[key]: {
config: config.config,
hookOptions: config.hookOptions,
output: { type: config.target },

@@ -33,0 +33,0 @@ description: config.description,

@@ -1,14 +0,13 @@

import { InputFieldConfigMap, PluginConfig, PluginOptions } from '../Definition';
import { HookOptionsMap, InputFieldConfigMap, PluginConfig, PluginOptions } from '../Definition';
declare type PluralQueryOptions = PluginOptions & {
name?: string;
conditionFields?: InputFieldConfigMap;
hookOptions?: HookOptionsMap;
};
declare module '../Definition' {
interface PluginOptionsMap {
pluralQuery?: PluginOptions & {
name?: string;
conditionFields?: InputFieldConfigMap;
};
pluralQuery?: PluralQueryOptions;
}
}
declare const _default: PluginConfig<PluginOptions & {
name?: string | undefined;
conditionFields?: InputFieldConfigMap | undefined;
}>;
declare const _default: PluginConfig<PluralQueryOptions>;
export default _default;

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

[`${StringHelper_1.default.toInitialLowerCase(config.name || schema.name + 's')}`]: {
config: config,
hookOptions: config.hookOptions,
output: { type: schema.name + 'Connection' },

@@ -140,0 +140,0 @@ input: Object.assign(Object.assign({}, (lodash_1.default.keys(searchFields).length > 0

@@ -1,12 +0,12 @@

import { PluginConfig, PluginOptions } from '../Definition';
import { HookOptionsMap, PluginConfig, PluginOptions } from '../Definition';
declare type SaveMutationOptions = PluginOptions & {
name?: string;
hookOptions?: HookOptionsMap;
};
declare module '../Definition' {
interface PluginOptionsMap {
saveMutation?: PluginOptions & {
name?: string;
};
saveMutation?: SaveMutationOptions;
}
}
declare const _default: PluginConfig<PluginOptions & {
name?: string | undefined;
}>;
declare const _default: PluginConfig<SaveMutationOptions>;
export default _default;

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

[config.name || name]: {
config: config,
hookOptions: config.hookOptions,
input: inputFields,

@@ -62,0 +62,0 @@ output: {

@@ -1,12 +0,12 @@

import { PluginConfig, PluginOptions } from '../Definition';
import { HookOptionsMap, PluginConfig, PluginOptions } from '../Definition';
declare type SingularQueryOptions = PluginOptions & {
name?: string;
hookOptions?: HookOptionsMap;
};
declare module '../Definition' {
interface PluginOptionsMap {
singularQuery?: PluginOptions & {
name?: string;
};
singularQuery?: SingularQueryOptions;
}
}
declare const _default: PluginConfig<PluginOptions & {
name?: string | undefined;
}>;
declare const _default: PluginConfig<SingularQueryOptions>;
export default _default;

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

[config.name || name]: {
config: config,
hookOptions: config.hookOptions,
output: { type: schema.name },

@@ -87,0 +87,0 @@ input: searchFields,

@@ -1,12 +0,12 @@

import { PluginConfig, PluginOptions } from '../Definition';
import { HookOptionsMap, PluginConfig, PluginOptions } from '../Definition';
declare type UpdateMutationOptions = PluginOptions & {
name?: string;
hookOptions?: HookOptionsMap;
};
declare module '../Definition' {
interface PluginOptionsMap {
updateMutation?: PluginOptions & {
name?: string;
};
updateMutation?: UpdateMutationOptions;
}
}
declare const _default: PluginConfig<PluginOptions & {
name?: string | undefined;
}>;
declare const _default: PluginConfig<UpdateMutationOptions>;
export default _default;

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

[config.name || name]: {
config: config,
hookOptions: config.hookOptions,
input: inputFields,

@@ -80,0 +80,0 @@ output: {

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

description: config.description,
config: (_b = field.metadata) === null || _b === void 0 ? void 0 : _b.config,
hookOptions: (_b = field.metadata) === null || _b === void 0 ? void 0 : _b.hookOptions,
input: (_d = (_c = field.metadata) === null || _c === void 0 ? void 0 : _c.graphql) === null || _d === void 0 ? void 0 : _d.input,

@@ -66,0 +66,0 @@ dependentFields: (_f = (_e = field.metadata) === null || _e === void 0 ? void 0 : _e.graphql) === null || _f === void 0 ? void 0 : _f.dependentFields,

{
"name": "simple-graphql",
"version": "4.0.12",
"version": "4.0.13",
"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

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