@common-stack/client-core
Advanced tools
Comparing version 0.0.1 to 0.0.4
@@ -1,1 +0,3 @@ | ||
export * from './common'; | ||
export * from './logger'; | ||
export * from './connector'; | ||
export * from './interfaces'; |
@@ -78,2 +78,3 @@ module.exports = | ||
__export(__webpack_require__(1)); | ||
__export(__webpack_require__(4)); | ||
@@ -112,4 +113,96 @@ | ||
/***/ }), | ||
/* 4 */ | ||
/***/ (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__(5)); | ||
/***/ }), | ||
/* 5 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const lodash_1 = __webpack_require__(6); | ||
const combine = (features, extractor) => lodash_1.without(lodash_1.union(...lodash_1.map(features, res => lodash_1.castArray(extractor(res)))), undefined); | ||
exports.featureCatalog = {}; | ||
class AbstractFeature { | ||
constructor({ route, navItem, navItemRight, reducer, resolver, middleware, afterware, connectionParam, createFetchOptions, stylesInsert, scriptsInsert, rootComponentFactory, routerFactory, catalogInfo, }, ...features) { | ||
combine(arguments, arg => arg.catalogInfo).forEach(info => Object.keys(info).forEach(key => (exports.featureCatalog[key] = info[key]))); | ||
this.route = combine(arguments, arg => arg.route); | ||
this.navItem = combine(arguments, arg => arg.navItem); | ||
this.navItemRight = combine(arguments, arg => arg.navItemRight); | ||
this.reducer = combine(arguments, arg => arg.reducer); | ||
this.resolver = combine(arguments, arg => arg.resolver); | ||
this.middleware = combine(arguments, arg => arg.middleware); | ||
this.afterware = combine(arguments, arg => arg.afterware); | ||
this.connectionParam = combine(arguments, arg => arg.connectionParam); | ||
this.createFetchOptions = combine(arguments, arg => arg.createFetchOptions); | ||
this.stylesInsert = combine(arguments, arg => arg.stylesInsert); | ||
this.scriptsInsert = combine(arguments, arg => arg.scriptsInsert); | ||
this.rootComponentFactory = combine(arguments, arg => arg.rootComponentFactory); | ||
this.routerFactory = combine(arguments, arg => arg.routerFactory) | ||
.slice(-1) | ||
.pop(); | ||
} | ||
router() { | ||
return this.routerFactory(); | ||
} | ||
reducers() { | ||
return lodash_1.merge(...this.reducer); | ||
} | ||
resolvers() { | ||
return lodash_1.merge(...this.resolver); | ||
} | ||
middlewares() { | ||
return this.middleware; | ||
} | ||
afterwares() { | ||
return this.afterware; | ||
} | ||
connectionParams() { | ||
return this.connectionParam; | ||
} | ||
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; | ||
} | ||
stylesInserts() { | ||
return this.stylesInsert; | ||
} | ||
scriptsInserts() { | ||
return this.scriptsInsert; | ||
} | ||
} | ||
exports.AbstractFeature = AbstractFeature; | ||
/***/ }), | ||
/* 6 */ | ||
/***/ (function(module, exports) { | ||
module.exports = require("lodash"); | ||
/***/ }) | ||
/******/ ]); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@common-stack/client-core", | ||
"version": "0.0.1", | ||
"version": "0.0.4", | ||
"description": "Sample core for higher packages to depend on", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22390
11
250