@common-stack/server-core
Advanced tools
Comparing version 0.0.14-5 to 0.0.14-6
import { DocumentNode } from 'graphql'; | ||
import { IResolverOptions, IDirectiveOptions } from '../interfaces'; | ||
export declare const featureCatalog: any; | ||
export declare type FeatureParams = { | ||
schema?: DocumentNode | DocumentNode[]; | ||
createDirectivesFunc?: Function | Function[]; | ||
createResolversFunc?: Function | Function[]; | ||
@@ -9,3 +11,2 @@ createContextFunc?: Function | Function[]; | ||
middleware?: any | any[]; | ||
createFetchOptions?: Function | Function[]; | ||
catalogInfo?: any | any[]; | ||
@@ -15,5 +16,5 @@ }; | ||
schema: DocumentNode[]; | ||
createDirectivesFunc: Function[]; | ||
createResolversFunc: Function[]; | ||
createContextFunc: Function[]; | ||
createFetchOptions: Function[]; | ||
beforeware: Function[]; | ||
@@ -24,7 +25,7 @@ middleware: Function[]; | ||
createContext(req: any, connectionParams: any, webSocket?: any): Promise<any>; | ||
createResolvers(pubsub: any): any; | ||
createResolvers(options?: IResolverOptions): any; | ||
createDirectives(options?: IDirectiveOptions): any; | ||
readonly beforewares: any[]; | ||
readonly middlewares: any[]; | ||
readonly constructFetchOptions: any; | ||
} | ||
export { Feature }; |
export * from './connector'; | ||
export * from './interfaces'; |
@@ -107,2 +107,3 @@ module.exports = | ||
this.schema = combine(arguments, arg => arg.schema); | ||
this.createDirectivesFunc = combine(arguments, arg => arg.createDirectivesFunc); | ||
this.createResolversFunc = combine(arguments, arg => arg.createResolversFunc); | ||
@@ -112,3 +113,2 @@ this.createContextFunc = combine(arguments, arg => arg.createContextFunc); | ||
this.middleware = combine(arguments, arg => arg.middleware); | ||
this.createFetchOptions = combine(arguments, arg => arg.createFetchOptions); | ||
} | ||
@@ -122,5 +122,8 @@ get schemas() { | ||
} | ||
createResolvers(pubsub) { | ||
return lodash_1.merge({}, ...this.createResolversFunc.map(createResolvers => createResolvers(pubsub))); | ||
createResolvers(options) { | ||
return lodash_1.merge({}, ...this.createResolversFunc.map(createResolvers => createResolvers(options))); | ||
} | ||
createDirectives(options) { | ||
return lodash_1.merge({}, ...this.createDirectivesFunc.map(createDirectives => createDirectives(options))); | ||
} | ||
get beforewares() { | ||
@@ -132,18 +135,2 @@ return this.beforeware; | ||
} | ||
get constructFetchOptions() { | ||
return this.createFetchOptions.length | ||
? (...args) => { | ||
try { | ||
let result = {}; | ||
for (let func of this.createFetchOptions) { | ||
result = Object.assign({}, result, func(...args)); | ||
} | ||
return result; | ||
} | ||
catch (e) { | ||
console.log(e.stack); | ||
} | ||
} | ||
: null; | ||
} | ||
} | ||
@@ -150,0 +137,0 @@ exports.Feature = Feature; |
{ | ||
"name": "@common-stack/server-core", | ||
"version": "0.0.14-5", | ||
"version": "0.0.14-6", | ||
"description": "xterm server services for Node", | ||
@@ -51,3 +51,3 @@ "main": "lib/index.js", | ||
"devDependencies": { | ||
"@common-stack/utils": "^0.0.14-5", | ||
"@common-stack/utils": "^0.0.14-6", | ||
"cross-env": "^5.1.3", | ||
@@ -59,3 +59,3 @@ "jest": "^22.1.0", | ||
"dependencies": { | ||
"@common-stack/core": "^0.0.14-5" | ||
"@common-stack/core": "^0.0.14-6" | ||
}, | ||
@@ -62,0 +62,0 @@ "typings": "lib/index.d.ts", |
Sorry, the diff of this file is not supported yet
9
15510
170
Updated@common-stack/core@^0.0.14-6