Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@common-stack/server-core

Package Overview
Dependencies
Maintainers
1
Versions
259
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@common-stack/server-core - npm Package Compare versions

Comparing version 0.0.14 to 0.0.140

lib/connector/__tests__/container-connector.test.d.ts

28

lib/connector/connector.d.ts

@@ -1,27 +0,39 @@

import { DocumentNode } from 'graphql';
import { IResolverOptions, IDirectiveOptions } from '../interfaces';
import { Container } from 'inversify';
export declare const featureCatalog: any;
export declare type FeatureParams = {
schema: DocumentNode | DocumentNode[];
schema?: string | string[];
createRemoteSchemas?: Function | Function[];
createDirectivesFunc?: Function | Function[];
createResolversFunc?: Function | Function[];
createContextFunc?: Function | Function[];
createServiceFunc?: Function | Function[];
createContainerFunc?: Function | Function[];
beforeware?: any | any[];
middleware?: any | any[];
createFetchOptions?: Function | Function[];
catalogInfo?: any | any[];
};
declare class Feature {
schema: DocumentNode[];
schema: string[];
createRemoteSchemas?: Function | Function[];
createDirectivesFunc: Function[];
createResolversFunc: Function[];
createContextFunc: Function[];
createFetchOptions: Function[];
createServiceFunc: Function[];
createContainerFunc: Function[];
beforeware: Function[];
middleware: Function[];
createPreference: Function[];
constructor(feature?: FeatureParams, ...features: Feature[]);
readonly schemas: DocumentNode[];
readonly schemas: string[];
createContext(req: any, connectionParams: any, webSocket?: any): Promise<any>;
createResolvers(pubsub: any): any;
createServiceContext(options: any): (req: any, connectionParams: any, webSocket?: any) => Promise<any>;
createService(options: any): any;
createResolvers(options?: IResolverOptions): any;
createDirectives(options?: IDirectiveOptions): any;
createContainers(options: any): Container;
createDefaultPreferences(): Function[];
readonly beforewares: any[];
readonly middlewares: any[];
readonly constructFetchOptions: any;
}
export { Feature };
export * from './connector';
export * from './interfaces';
export * from './constants';
export * from './logger';

@@ -40,10 +40,30 @@ module.exports =

/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules

@@ -64,21 +84,14 @@ /******/ __webpack_require__.n = function(module) {

/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 0);
/******/ return __webpack_require__(__webpack_require__.s = "./src/index.ts");
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports, __webpack_require__) {
/******/ ({
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
__export(__webpack_require__(1));
/***/ }),
/* 1 */
/***/ "./src/connector/connector.ts":
/*!************************************!*\
!*** ./src/connector/connector.ts ***!
\************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

@@ -88,17 +101,5 @@

function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
__export(__webpack_require__(2));
/***/ }),
/* 2 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const lodash_1 = __webpack_require__(3);
const lodash_1 = __webpack_require__(/*! lodash */ "lodash");
const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
exports.featureCatalog = {};

@@ -110,7 +111,10 @@ const combine = (features, extractor) => lodash_1.without(lodash_1.union(...lodash_1.map(features, res => lodash_1.castArray(extractor(res)))), undefined);

this.schema = combine(arguments, arg => arg.schema);
this.createDirectivesFunc = combine(arguments, arg => arg.createDirectivesFunc);
this.createResolversFunc = combine(arguments, arg => arg.createResolversFunc);
this.createContextFunc = combine(arguments, arg => arg.createContextFunc);
this.createServiceFunc = combine(arguments, arg => arg.createServiceFunc);
this.createContainerFunc = combine(arguments, arg => arg.createContainerFunc);
this.beforeware = combine(arguments, arg => arg.beforeware);
this.middleware = combine(arguments, arg => arg.middleware);
this.createFetchOptions = combine(arguments, arg => arg.createFetchOptions);
this.createPreference = combine(arguments, arg => arg.createPreference);
}

@@ -124,5 +128,27 @@ get schemas() {

}
createResolvers(pubsub) {
return lodash_1.merge({}, ...this.createResolversFunc.map(createResolvers => createResolvers(pubsub)));
createServiceContext(options) {
const services = this.createService(options);
return async (req, connectionParams, webSocket) => {
const results = await Promise.all(this.createContextFunc.map(createContext => createContext(req, connectionParams, webSocket)));
return lodash_1.merge({}, ...results, Object.assign({}, services));
};
}
createService(options) {
const container = this.createContainers(options);
return lodash_1.merge({}, ...this.createServiceFunc.map(createService => createService(container)));
}
createResolvers(options) {
return lodash_1.merge({}, ...this.createResolversFunc.map(createResolvers => createResolvers(options)));
}
createDirectives(options) {
return lodash_1.merge({}, ...this.createDirectivesFunc.map(createDirectives => createDirectives(options)));
}
createContainers(options) {
const container = new inversify_1.Container();
this.createContainerFunc.map(createModule => container.load(createModule(options)));
return container;
}
createDefaultPreferences() {
return this.createPreference;
}
get beforewares() {

@@ -134,18 +160,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;
}
}

@@ -156,9 +166,148 @@ exports.Feature = Feature;

/***/ }),
/* 3 */
/***/ "./src/connector/index.ts":
/*!********************************!*\
!*** ./src/connector/index.ts ***!
\********************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
__export(__webpack_require__(/*! ./connector */ "./src/connector/connector.ts"));
/***/ }),
/***/ "./src/constants/index.ts":
/*!********************************!*\
!*** ./src/constants/index.ts ***!
\********************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
__export(__webpack_require__(/*! ./types */ "./src/constants/types.ts"));
/***/ }),
/***/ "./src/constants/types.ts":
/*!********************************!*\
!*** ./src/constants/types.ts ***!
\********************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TYPES = {
IHemeraSettings: Symbol('IHemeraSettings'),
};
/***/ }),
/***/ "./src/index.ts":
/*!**********************!*\
!*** ./src/index.ts ***!
\**********************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
__export(__webpack_require__(/*! ./connector */ "./src/connector/index.ts"));
__export(__webpack_require__(/*! ./constants */ "./src/constants/index.ts"));
__export(__webpack_require__(/*! ./logger */ "./src/logger/index.ts"));
/***/ }),
/***/ "./src/logger/index.ts":
/*!*****************************!*\
!*** ./src/logger/index.ts ***!
\*****************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
__export(__webpack_require__(/*! ./logger */ "./src/logger/logger.ts"));
/***/ }),
/***/ "./src/logger/logger.ts":
/*!******************************!*\
!*** ./src/logger/logger.ts ***!
\******************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const server_1 = __webpack_require__(/*! @cdm-logger/server */ "@cdm-logger/server");
const settings = {
level: process.env.LOG_LEVEL || 'trace',
};
const appName = process.env.APP_NAME || 'CDMBASE_APP';
exports.logger = server_1.ConsoleLogger.create(appName, settings);
/***/ }),
/***/ "@cdm-logger/server":
/*!*************************************!*\
!*** external "@cdm-logger/server" ***!
\*************************************/
/*! no static exports found */
/***/ (function(module, exports) {
module.exports = require("@cdm-logger/server");
/***/ }),
/***/ "inversify":
/*!****************************!*\
!*** external "inversify" ***!
\****************************/
/*! no static exports found */
/***/ (function(module, exports) {
module.exports = require("inversify");
/***/ }),
/***/ "lodash":
/*!*************************!*\
!*** external "lodash" ***!
\*************************/
/*! no static exports found */
/***/ (function(module, exports) {
module.exports = require("lodash");
/***/ })
/******/ ]);
/******/ });
//# sourceMappingURL=index.js.map
{
"name": "@common-stack/server-core",
"version": "0.0.14",
"version": "0.0.140",
"description": "xterm server services for Node",

@@ -51,10 +51,10 @@ "main": "lib/index.js",

"devDependencies": {
"@common-stack/utils": "^0.0.14",
"@common-stack/utils": "^0.0.140",
"cross-env": "^5.1.3",
"jest": "^22.1.0",
"jest": "^22.4.2",
"rimraf": "^2.6.1",
"webpack": "^3.10.0"
"webpack": "^4.7.0"
},
"dependencies": {
"@common-stack/core": "^0.0.14"
"@common-stack/core": "*"
},

@@ -61,0 +61,0 @@ "typings": "lib/index.d.ts",

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