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

frint

Package Overview
Dependencies
Maintainers
6
Versions
89
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

frint - npm Package Compare versions

Comparing version 2.8.1 to 2.9.0-alpha.2d26e4d7

172

dist/frint.js

@@ -64,3 +64,3 @@ this["Frint"] =

/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 2);
/******/ return __webpack_require__(__webpack_require__.s = 1);
/******/ })

@@ -81,10 +81,32 @@ /************************************************************************/

var _rxjs = __webpack_require__(3);
var _BehaviorSubject = __webpack_require__(2);
var _lodash = __webpack_require__(1);
var _of = __webpack_require__(3);
var _lodash2 = _interopRequireDefault(_lodash);
var _concatMap = __webpack_require__(4);
var _travixDi = __webpack_require__(4);
var _find = __webpack_require__(5);
var _map = __webpack_require__(6);
var _first = __webpack_require__(7);
var _omit = __webpack_require__(8);
var _omit2 = _interopRequireDefault(_omit);
var _get = __webpack_require__(9);
var _get2 = _interopRequireDefault(_get);
var _find2 = __webpack_require__(10);
var _find3 = _interopRequireDefault(_find2);
var _findIndex = __webpack_require__(11);
var _findIndex2 = _interopRequireDefault(_findIndex);
var _travixDi = __webpack_require__(12);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -161,3 +183,3 @@

this._appsCollection = [];
this._apps$ = new _rxjs.BehaviorSubject(this._appsCollection);
this._apps$ = new _BehaviorSubject.BehaviorSubject(this._appsCollection);

@@ -183,3 +205,3 @@ this.options.initialize.bind(this)();

var definedProvider = Object.assign({}, _lodash2.default.omit(parentProvider, ['useClass', 'useValue', 'useFactory']));
var definedProvider = Object.assign({}, (0, _omit2.default)(parentProvider, ['useClass', 'useValue', 'useFactory']));

@@ -258,3 +280,3 @@ // non-scoped

App.prototype.getOption = function getOption(key) {
return _lodash2.default.get(this.options, key);
return (0, _get2.default)(this.options, key);
};

@@ -271,3 +293,3 @@

App.prototype.getProvider = function getProvider(name) {
return _lodash2.default.find(this.options.providers, function (p) {
return (0, _find3.default)(this.options.providers, function (p) {
return p.name === name;

@@ -288,2 +310,4 @@ });

App.prototype.getApps$ = function getApps$() {
var _context;
var regionName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;

@@ -295,3 +319,3 @@

return this._apps$.map(function (collection) {
return (_context = this._apps$, _map.map).call(_context, function (collection) {
return collection.filter(function (w) {

@@ -317,3 +341,3 @@ return w.regions.indexOf(regionName) > -1;

var existingIndex = _lodash2.default.findIndex(this._appsCollection, function (w) {
var existingIndex = (0, _findIndex2.default)(this._appsCollection, function (w) {
return w.name === AppClass.frintAppName;

@@ -357,3 +381,3 @@ });

var index = _lodash2.default.findIndex(this._appsCollection, function (w) {
var index = (0, _findIndex2.default)(this._appsCollection, function (w) {
return w.name === name;

@@ -378,2 +402,4 @@ });

App.prototype.getAppOnceAvailable$ = function getAppOnceAvailable$(name) {
var _context2;
var region = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;

@@ -387,13 +413,13 @@ var regionKey = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;

if (w) {
return _rxjs.Observable.of(w);
return (0, _of.of)(w);
}
return rootApp._apps$.concatMap(function (y) {
return (_context2 = (_context2 = (_context2 = (_context2 = rootApp._apps$, _concatMap.concatMap).call(_context2, function (y) {
return y;
}).find(function (app) {
}), _find.find).call(_context2, function (app) {
return app.name === name;
}).map(function (x) {
}), _map.map).call(_context2, function (x) {
var instanceKey = makeInstanceKey(region, regionKey, x.multi);
return x.instances[instanceKey];
}).first(function (y) {
}), _first.first).call(_context2, function (y) {
return y;

@@ -407,3 +433,3 @@ });

var index = _lodash2.default.findIndex(this._appsCollection, function (w) {
var index = (0, _findIndex2.default)(this._appsCollection, function (w) {
return w.App.frintAppName === name;

@@ -419,3 +445,3 @@ });

this._appsCollection[index].instances[key] = new w.App(_extends({}, _lodash2.default.omit(w, ['App', 'instances']), {
this._appsCollection[index].instances[key] = new w.App(_extends({}, (0, _omit2.default)(w, ['App', 'instances']), {
name: w.App.frintAppName,

@@ -432,3 +458,3 @@ parentApp: this

var index = _lodash2.default.findIndex(this._appsCollection, function (w) {
var index = (0, _findIndex2.default)(this._appsCollection, function (w) {
if (!w || !w.App) {

@@ -460,14 +486,2 @@ return false;

// @TODO: Get rid of *Widget* aliases
[{ alias: 'getWidgets$', fn: 'getApps$' }, { alias: 'registerWidget', fn: 'registerApp' }, { alias: 'hasWidgetInstance', fn: 'hasWidgetInstance' }, { alias: 'getWidgetInstance', fn: 'getAppInstance' }, { alias: 'getWidgetOnceAvailable$', fn: 'getAppOnceAvailable$' }, { alias: 'destroyWidget', fn: 'destroyApp' }].forEach(function (_ref) {
var alias = _ref.alias,
fn = _ref.fn;
App.prototype[alias] = function deprecatedAlias() {
// eslint-disable-next-line no-console, prefer-template
console.warn('[DEPRECATED] `' + alias + '` has been deprecated. Use `' + fn + '` instead');
this[fn].apply(this, arguments);
};
});
// unregisterApp(name, region = null, regionKey = null) {

@@ -482,8 +496,2 @@ // // @TODO

/* 1 */
/***/ (function(module, exports) {
(function() { module.exports = this["_"]; }());
/***/ }),
/* 2 */
/***/ (function(module, exports, __webpack_require__) {

@@ -502,3 +510,3 @@

var _createApp = __webpack_require__(9);
var _createApp = __webpack_require__(17);

@@ -518,12 +526,66 @@ var _createApp2 = _interopRequireDefault(_createApp);

/***/ }),
/* 2 */
/***/ (function(module, exports) {
(function() { module.exports = this[undefined]; }());
/***/ }),
/* 3 */
/***/ (function(module, exports) {
(function() { module.exports = this["Rx"]; }());
(function() { module.exports = this[undefined]; }());
/***/ }),
/* 4 */
/***/ (function(module, exports) {
(function() { module.exports = this[undefined]; }());
/***/ }),
/* 5 */
/***/ (function(module, exports) {
(function() { module.exports = this[undefined]; }());
/***/ }),
/* 6 */
/***/ (function(module, exports) {
(function() { module.exports = this[undefined]; }());
/***/ }),
/* 7 */
/***/ (function(module, exports) {
(function() { module.exports = this[undefined]; }());
/***/ }),
/* 8 */
/***/ (function(module, exports) {
(function() { module.exports = this[undefined]; }());
/***/ }),
/* 9 */
/***/ (function(module, exports) {
(function() { module.exports = this[undefined]; }());
/***/ }),
/* 10 */
/***/ (function(module, exports) {
(function() { module.exports = this[undefined]; }());
/***/ }),
/* 11 */
/***/ (function(module, exports) {
(function() { module.exports = this[undefined]; }());
/***/ }),
/* 12 */
/***/ (function(module, exports, __webpack_require__) {
var lib = __webpack_require__(5);
var lib = __webpack_require__(13);

@@ -534,3 +596,3 @@ module.exports = lib;

/***/ }),
/* 5 */
/* 13 */
/***/ (function(module, exports, __webpack_require__) {

@@ -541,11 +603,11 @@

var _createContainer = __webpack_require__(6);
var _createContainer = __webpack_require__(14);
var _createContainer2 = _interopRequireDefault(_createContainer);
var _resolveContainer = __webpack_require__(7);
var _resolveContainer = __webpack_require__(15);
var _resolveContainer2 = _interopRequireDefault(_resolveContainer);
var _createClass = __webpack_require__(8);
var _createClass = __webpack_require__(16);

@@ -563,3 +625,3 @@ var _createClass2 = _interopRequireDefault(_createClass);

/***/ }),
/* 6 */
/* 14 */
/***/ (function(module, exports, __webpack_require__) {

@@ -681,3 +743,3 @@

/***/ }),
/* 7 */
/* 15 */
/***/ (function(module, exports, __webpack_require__) {

@@ -697,3 +759,3 @@

/***/ }),
/* 8 */
/* 16 */
/***/ (function(module, exports, __webpack_require__) {

@@ -736,3 +798,3 @@

/***/ }),
/* 9 */
/* 17 */
/***/ (function(module, exports, __webpack_require__) {

@@ -748,5 +810,5 @@

var _lodash = __webpack_require__(1);
var _merge = __webpack_require__(18);
var _lodash2 = _interopRequireDefault(_lodash);
var _merge2 = _interopRequireDefault(_merge);

@@ -776,3 +838,3 @@ var _App = __webpack_require__(0);

return _possibleConstructorReturn(this, (App.__proto__ || Object.getPrototypeOf(App)).call(this, _lodash2.default.merge(options, opts)));
return _possibleConstructorReturn(this, (App.__proto__ || Object.getPrototypeOf(App)).call(this, (0, _merge2.default)(options, opts)));
}

@@ -794,3 +856,9 @@

/***/ }),
/* 18 */
/***/ (function(module, exports) {
(function() { module.exports = this[undefined]; }());
/***/ })
/******/ ]);

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

this.Frint=function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=2)}([function(e,t,n){"use strict";function r(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(!(arguments.length>2&&void 0!==arguments[2]&&arguments[2])||!e&&!t)return"default";var n="";return e&&(n=e),t&&(n=e+"_"+t),n}function o(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.options=i({name:null,parentApp:null,providers:[],providerNames:{component:"component",container:"container",store:"store",app:"app",parentApp:"parentApp",rootApp:"rootApp",region:"region"},initialize:function(){},beforeDestroy:function(){}},t),!this.options.name)throw new Error("Must provide `name` in options");var n=(0,u.createContainer)([{name:this.options.providerNames.app,useDefinedValue:this},{name:this.options.providerNames.parentApp,useDefinedValue:this.getParentApp()},{name:this.options.providerNames.rootApp,useDefinedValue:this.getRootApp()}],{containerKey:this.options.providerNames.container});this.container=(0,u.resolveContainer)(n),this._registerRootProviders(),this.options.providers.forEach(function(t){e.container.register(t)}),this._appsCollection=[],this._apps$=new a.BehaviorSubject(this._appsCollection),this.options.initialize.bind(this)()}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},a=n(3),s=n(1),p=function(e){return e&&e.__esModule?e:{default:e}}(s),u=n(4);o.prototype._registerRootProviders=function(){var e=this,t=this.getParentApps();0!==t.length&&t.reverse().forEach(function(t){t.getProviders().forEach(function(n){if(n.cascade){var r=Object.assign({},p.default.omit(n,["useClass","useValue","useFactory"]));return n.scoped?"useValue"in n?void e.container.register(i({},r,{useValue:t.get(n.name)})):"useClass"in n?void e.container.register(i({},r,{useClass:n.useClass})):void("useFactory"in n&&e.container.register(i({},r,{useFactory:n.useFactory}))):void e.container.register(i({},r,{useValue:t.get(n.name)}))}})})},o.prototype.getContainer=function(){return this.container},o.prototype.getRootApp=function(){var e=this.getParentApps();return 0===e.length?this:e.pop()},o.prototype.getParentApp=function(){return this.options[this.options.providerNames.parentApp]||null},o.prototype.getParentApps=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=t.getParentApp();return r?(n.push(r),e(r,n)):n}return e(this)},o.prototype.getOption=function(e){return p.default.get(this.options,e)},o.prototype.getName=function(){return this.getOption("name")},o.prototype.getProviders=function(){return this.options.providers},o.prototype.getProvider=function(e){return p.default.find(this.options.providers,function(t){return t.name===e})},o.prototype.get=function(e){var t=this.container.get(e);return void 0!==t?t:null},o.prototype.getApps$=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return e?this._apps$.map(function(t){return t.filter(function(t){return t.regions.indexOf(e)>-1})}):this._apps$},o.prototype.registerApp=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=i({multi:!1},t);if(void 0!==n.name&&Object.defineProperty(e,"frintAppName",{value:n.name,configurable:!0}),-1!==p.default.findIndex(this._appsCollection,function(t){return t.name===e.frintAppName}))throw new Error("App '"+e.frintAppName+"' has been already registered before.");this._appsCollection.push(i({},n,{name:e.frintAppName,App:e,regions:n.regions||[],instances:{}})),!1===n.multi&&this.instantiateApp(e.frintAppName),this._apps$.next(this._appsCollection)},o.prototype.hasAppInstance=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=this.getAppInstance(e,t,n);return!(!r||void 0===r)},o.prototype.getAppInstance=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,o=p.default.findIndex(this._appsCollection,function(t){return t.name===e});if(-1===o)return null;var i=this._appsCollection[o],a=r(t,n,i.multi),s=i.instances[a];return s&&void 0!==s?s:null},o.prototype.getAppOnceAvailable$=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,o=this.getRootApp(),i=o.getAppInstance(e,t,n);return i?a.Observable.of(i):o._apps$.concatMap(function(e){return e}).find(function(t){return t.name===e}).map(function(e){var o=r(t,n,e.multi);return e.instances[o]}).first(function(e){return e})},o.prototype.instantiateApp=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,o=p.default.findIndex(this._appsCollection,function(t){return t.App.frintAppName===e});if(-1===o)throw new Error("No app found with name '"+e+"'.");var a=this._appsCollection[o],s=r(t,n,a.multi);return this._appsCollection[o].instances[s]=new a.App(i({},p.default.omit(a,["App","instances"]),{name:a.App.frintAppName,parentApp:this})),this._appsCollection[o].instances[s]},o.prototype.destroyApp=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,o=p.default.findIndex(this._appsCollection,function(t){return!(!t||!t.App)&&t.App.frintAppName===e});if(-1===o)throw new Error("No app found with name '"+e+"'.");var i=this._appsCollection[o],a=r(t,n,i.multi);if(void 0===this._appsCollection[o].instances[a])throw new Error("No instance with key '"+a+"' found for app with name '"+e+"'.");this._appsCollection[o].instances[a].beforeDestroy(),delete this._appsCollection[o].instances[a]},o.prototype.beforeDestroy=function(){return this.options.beforeDestroy.bind(this)()},[{alias:"getWidgets$",fn:"getApps$"},{alias:"registerWidget",fn:"registerApp"},{alias:"hasWidgetInstance",fn:"hasWidgetInstance"},{alias:"getWidgetInstance",fn:"getAppInstance"},{alias:"getWidgetOnceAvailable$",fn:"getAppOnceAvailable$"},{alias:"destroyWidget",fn:"destroyApp"}].forEach(function(e){var t=e.alias,n=e.fn;o.prototype[t]=function(){console.warn("[DEPRECATED] `"+t+"` has been deprecated. Use `"+n+"` instead"),this[n].apply(this,arguments)}}),t.default=o,e.exports=t.default},function(e,t){!function(){e.exports=this._}()},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(0),i=r(o),a=n(9),s=r(a),p={App:i.default,createApp:s.default};t.default=p,e.exports=t.default},function(e,t){!function(){e.exports=this.Rx}()},function(e,t,n){var r=n(5);e.exports=r},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}var o=n(6),i=r(o),a=n(7),s=r(a),p=n(8),u=r(p);e.exports={createContainer:i.default,resolveContainer:s.default,createClass:u.default}},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=s({containerName:"container"},t);return function(){function t(){var o=this;r(this,t),this.registry={},Object.defineProperty(this.registry,n.containerName,{get:function(){return o}}),e.forEach(function(e){o.register(e)})}return a(t,[{key:"getDeps",value:function(e){var t=this,n=e.name,r={};return Array.isArray(e.deps)?e.deps.forEach(function(e){if(!(e in t.registry))throw new Error("For provider '"+n+"', dependency '"+e+"' is not available yet.");r[e]=t.registry[e]}):"object"===i(e.deps)&&Object.keys(e.deps).forEach(function(o){if(!(o in t.registry))throw new Error("For provider '"+n+"', dependency '"+o+"' is not available yet.");var i=e.deps[o];r[i]=t.registry[o]}),r}},{key:"register",value:function(e){if("string"!=typeof e.name)throw new Error("Provider has no 'name' key.");var t=e.name;if("useValue"in e)this.registry[t]=e.useValue;else if("useFactory"in e)this.registry[t]=e.useFactory(this.getDeps(e));else if("useClass"in e)this.registry[t]=new e.useClass(this.getDeps(e));else{if(!("useDefinedValue"in e))throw new Error("No value given for '"+t+"' provider.");Object.defineProperty(this.registry,t,{get:function(){return e.useDefinedValue}})}}},{key:"get",value:function(e){return this.registry[e]}}]),t}()}Object.defineProperty(t,"__esModule",{value:!0});var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e};t.default=o},function(e,t,n){"use strict";function r(e){return new e}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function t(){var n=this;r(this,t),Object.keys(e).forEach(function(t){"function"==typeof e[t]?n[t]=e[t].bind(n):n[t]=e[t]}),"function"==typeof this.initialize&&this.initialize.apply(this,arguments)}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=o},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=function(t){function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return o(this,n),i(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,u.default.merge(e,t)))}return a(n,t),n}(c.default);return void 0!==e.name&&Object.defineProperty(t,"frintAppName",{value:e.name,configurable:!0}),t}Object.defineProperty(t,"__esModule",{value:!0}),t.default=s;var p=n(1),u=r(p),l=n(0),c=r(l);e.exports=t.default}]);
this.Frint=function(t){function e(o){if(n[o])return n[o].exports;var r=n[o]={i:o,l:!1,exports:{}};return t[o].call(r.exports,r,r.exports,e),r.l=!0,r.exports}var n={};return e.m=t,e.c=n,e.d=function(t,n,o){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:o})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=1)}([function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{default:t}}function r(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(!(arguments.length>2&&void 0!==arguments[2]&&arguments[2])||!t&&!e)return"default";var n="";return t&&(n=t),e&&(n=t+"_"+e),n}function i(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.options=s({name:null,parentApp:null,providers:[],providerNames:{component:"component",container:"container",store:"store",app:"app",parentApp:"parentApp",rootApp:"rootApp",region:"region"},initialize:function(){},beforeDestroy:function(){}},e),!this.options.name)throw new Error("Must provide `name` in options");var n=(0,A.createContainer)([{name:this.options.providerNames.app,useDefinedValue:this},{name:this.options.providerNames.parentApp,useDefinedValue:this.getParentApp()},{name:this.options.providerNames.rootApp,useDefinedValue:this.getRootApp()}],{containerKey:this.options.providerNames.container});this.container=(0,A.resolveContainer)(n),this._registerRootProviders(),this.options.providers.forEach(function(e){t.container.register(e)}),this._appsCollection=[],this._apps$=new a.BehaviorSubject(this._appsCollection),this.options.initialize.bind(this)()}Object.defineProperty(e,"__esModule",{value:!0});var s=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},a=n(2),u=n(3),p=n(4),c=n(5),l=n(6),f=n(7),h=n(8),d=o(h),v=n(9),y=o(v),g=n(10),m=o(g),b=n(11),_=o(b),A=n(12);i.prototype._registerRootProviders=function(){var t=this,e=this.getParentApps();0!==e.length&&e.reverse().forEach(function(e){e.getProviders().forEach(function(n){if(n.cascade){var o=Object.assign({},(0,d.default)(n,["useClass","useValue","useFactory"]));return n.scoped?"useValue"in n?void t.container.register(s({},o,{useValue:e.get(n.name)})):"useClass"in n?void t.container.register(s({},o,{useClass:n.useClass})):void("useFactory"in n&&t.container.register(s({},o,{useFactory:n.useFactory}))):void t.container.register(s({},o,{useValue:e.get(n.name)}))}})})},i.prototype.getContainer=function(){return this.container},i.prototype.getRootApp=function(){var t=this.getParentApps();return 0===t.length?this:t.pop()},i.prototype.getParentApp=function(){return this.options[this.options.providerNames.parentApp]||null},i.prototype.getParentApps=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],o=e.getParentApp();return o?(n.push(o),t(o,n)):n}return t(this)},i.prototype.getOption=function(t){return(0,y.default)(this.options,t)},i.prototype.getName=function(){return this.getOption("name")},i.prototype.getProviders=function(){return this.options.providers},i.prototype.getProvider=function(t){return(0,m.default)(this.options.providers,function(e){return e.name===t})},i.prototype.get=function(t){var e=this.container.get(t);return void 0!==e?e:null},i.prototype.getApps$=function(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return e?(t=this._apps$,l.map).call(t,function(t){return t.filter(function(t){return t.regions.indexOf(e)>-1})}):this._apps$},i.prototype.registerApp=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=s({multi:!1},e);if(void 0!==n.name&&Object.defineProperty(t,"frintAppName",{value:n.name,configurable:!0}),-1!==(0,_.default)(this._appsCollection,function(e){return e.name===t.frintAppName}))throw new Error("App '"+t.frintAppName+"' has been already registered before.");this._appsCollection.push(s({},n,{name:t.frintAppName,App:t,regions:n.regions||[],instances:{}})),!1===n.multi&&this.instantiateApp(t.frintAppName),this._apps$.next(this._appsCollection)},i.prototype.hasAppInstance=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,o=this.getAppInstance(t,e,n);return!(!o||void 0===o)},i.prototype.getAppInstance=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,o=(0,_.default)(this._appsCollection,function(e){return e.name===t});if(-1===o)return null;var i=this._appsCollection[o],s=r(e,n,i.multi),a=i.instances[s];return a&&void 0!==a?a:null},i.prototype.getAppOnceAvailable$=function(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=this.getRootApp(),s=i.getAppInstance(t,n,o);return s?(0,u.of)(s):(e=(e=(e=(e=i._apps$,p.concatMap).call(e,function(t){return t}),c.find).call(e,function(e){return e.name===t}),l.map).call(e,function(t){var e=r(n,o,t.multi);return t.instances[e]}),f.first).call(e,function(t){return t})},i.prototype.instantiateApp=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,o=(0,_.default)(this._appsCollection,function(e){return e.App.frintAppName===t});if(-1===o)throw new Error("No app found with name '"+t+"'.");var i=this._appsCollection[o],a=r(e,n,i.multi);return this._appsCollection[o].instances[a]=new i.App(s({},(0,d.default)(i,["App","instances"]),{name:i.App.frintAppName,parentApp:this})),this._appsCollection[o].instances[a]},i.prototype.destroyApp=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,o=(0,_.default)(this._appsCollection,function(e){return!(!e||!e.App)&&e.App.frintAppName===t});if(-1===o)throw new Error("No app found with name '"+t+"'.");var i=this._appsCollection[o],s=r(e,n,i.multi);if(void 0===this._appsCollection[o].instances[s])throw new Error("No instance with key '"+s+"' found for app with name '"+t+"'.");this._appsCollection[o].instances[s].beforeDestroy(),delete this._appsCollection[o].instances[s]},i.prototype.beforeDestroy=function(){return this.options.beforeDestroy.bind(this)()},e.default=i,t.exports=e.default},function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),i=o(r),s=n(17),a=o(s),u={App:i.default,createApp:a.default};e.default=u,t.exports=e.default},function(t,e){!function(){t.exports=this[void 0]}()},function(t,e){!function(){t.exports=this[void 0]}()},function(t,e){!function(){t.exports=this[void 0]}()},function(t,e){!function(){t.exports=this[void 0]}()},function(t,e){!function(){t.exports=this[void 0]}()},function(t,e){!function(){t.exports=this[void 0]}()},function(t,e){!function(){t.exports=this[void 0]}()},function(t,e){!function(){t.exports=this[void 0]}()},function(t,e){!function(){t.exports=this[void 0]}()},function(t,e){!function(){t.exports=this[void 0]}()},function(t,e,n){var o=n(13);t.exports=o},function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{default:t}}var r=n(14),i=o(r),s=n(15),a=o(s),u=n(16),p=o(u);t.exports={createContainer:i.default,resolveContainer:a.default,createClass:p.default}},function(t,e,n){"use strict";function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=a({containerName:"container"},e);return function(){function e(){var r=this;o(this,e),this.registry={},Object.defineProperty(this.registry,n.containerName,{get:function(){return r}}),t.forEach(function(t){r.register(t)})}return s(e,[{key:"getDeps",value:function(t){var e=this,n=t.name,o={};return Array.isArray(t.deps)?t.deps.forEach(function(t){if(!(t in e.registry))throw new Error("For provider '"+n+"', dependency '"+t+"' is not available yet.");o[t]=e.registry[t]}):"object"===i(t.deps)&&Object.keys(t.deps).forEach(function(r){if(!(r in e.registry))throw new Error("For provider '"+n+"', dependency '"+r+"' is not available yet.");var i=t.deps[r];o[i]=e.registry[r]}),o}},{key:"register",value:function(t){if("string"!=typeof t.name)throw new Error("Provider has no 'name' key.");var e=t.name;if("useValue"in t)this.registry[e]=t.useValue;else if("useFactory"in t)this.registry[e]=t.useFactory(this.getDeps(t));else if("useClass"in t)this.registry[e]=new t.useClass(this.getDeps(t));else{if(!("useDefinedValue"in t))throw new Error("No value given for '"+e+"' provider.");Object.defineProperty(this.registry,e,{get:function(){return t.useDefinedValue}})}}},{key:"get",value:function(t){return this.registry[t]}}]),e}()}Object.defineProperty(e,"__esModule",{value:!0});var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},s=function(){function t(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,n,o){return n&&t(e.prototype,n),o&&t(e,o),e}}(),a=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t};e.default=r},function(t,e,n){"use strict";function o(t){return new t}Object.defineProperty(e,"__esModule",{value:!0}),e.default=o},function(t,e,n){"use strict";function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function e(){var n=this;o(this,e),Object.keys(t).forEach(function(e){"function"==typeof t[e]?n[e]=t[e].bind(n):n[e]=t[e]}),"function"==typeof this.initialize&&this.initialize.apply(this,arguments)}}Object.defineProperty(e,"__esModule",{value:!0}),e.default=r},function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{default:t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function a(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=function(e){function n(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return r(this,n),i(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,(0,p.default)(t,e)))}return s(n,e),n}(l.default);return void 0!==t.name&&Object.defineProperty(e,"frintAppName",{value:t.name,configurable:!0}),e}Object.defineProperty(e,"__esModule",{value:!0}),e.default=a;var u=n(18),p=o(u),c=n(0),l=o(c);t.exports=e.default},function(t,e){!function(){t.exports=this[void 0]}()}]);

@@ -9,8 +9,30 @@ 'use strict';

var _rxjs = require('rxjs');
var _BehaviorSubject = require('rxjs/BehaviorSubject');
var _lodash = require('lodash');
var _of = require('rxjs/observable/of');
var _lodash2 = _interopRequireDefault(_lodash);
var _concatMap = require('rxjs/operator/concatMap');
var _find = require('rxjs/operator/find');
var _map = require('rxjs/operator/map');
var _first = require('rxjs/operator/first');
var _omit = require('lodash/omit');
var _omit2 = _interopRequireDefault(_omit);
var _get = require('lodash/get');
var _get2 = _interopRequireDefault(_get);
var _find2 = require('lodash/find');
var _find3 = _interopRequireDefault(_find2);
var _findIndex = require('lodash/findIndex');
var _findIndex2 = _interopRequireDefault(_findIndex);
var _travixDi = require('travix-di');

@@ -89,3 +111,3 @@

this._appsCollection = [];
this._apps$ = new _rxjs.BehaviorSubject(this._appsCollection);
this._apps$ = new _BehaviorSubject.BehaviorSubject(this._appsCollection);

@@ -111,3 +133,3 @@ this.options.initialize.bind(this)();

var definedProvider = Object.assign({}, _lodash2.default.omit(parentProvider, ['useClass', 'useValue', 'useFactory']));
var definedProvider = Object.assign({}, (0, _omit2.default)(parentProvider, ['useClass', 'useValue', 'useFactory']));

@@ -186,3 +208,3 @@ // non-scoped

App.prototype.getOption = function getOption(key) {
return _lodash2.default.get(this.options, key);
return (0, _get2.default)(this.options, key);
};

@@ -199,3 +221,3 @@

App.prototype.getProvider = function getProvider(name) {
return _lodash2.default.find(this.options.providers, function (p) {
return (0, _find3.default)(this.options.providers, function (p) {
return p.name === name;

@@ -216,2 +238,4 @@ });

App.prototype.getApps$ = function getApps$() {
var _context;
var regionName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;

@@ -223,3 +247,3 @@

return this._apps$.map(function (collection) {
return (_context = this._apps$, _map.map).call(_context, function (collection) {
return collection.filter(function (w) {

@@ -245,3 +269,3 @@ return w.regions.indexOf(regionName) > -1;

var existingIndex = _lodash2.default.findIndex(this._appsCollection, function (w) {
var existingIndex = (0, _findIndex2.default)(this._appsCollection, function (w) {
return w.name === AppClass.frintAppName;

@@ -285,3 +309,3 @@ });

var index = _lodash2.default.findIndex(this._appsCollection, function (w) {
var index = (0, _findIndex2.default)(this._appsCollection, function (w) {
return w.name === name;

@@ -306,2 +330,4 @@ });

App.prototype.getAppOnceAvailable$ = function getAppOnceAvailable$(name) {
var _context2;
var region = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;

@@ -315,13 +341,13 @@ var regionKey = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;

if (w) {
return _rxjs.Observable.of(w);
return (0, _of.of)(w);
}
return rootApp._apps$.concatMap(function (y) {
return (_context2 = (_context2 = (_context2 = (_context2 = rootApp._apps$, _concatMap.concatMap).call(_context2, function (y) {
return y;
}).find(function (app) {
}), _find.find).call(_context2, function (app) {
return app.name === name;
}).map(function (x) {
}), _map.map).call(_context2, function (x) {
var instanceKey = makeInstanceKey(region, regionKey, x.multi);
return x.instances[instanceKey];
}).first(function (y) {
}), _first.first).call(_context2, function (y) {
return y;

@@ -335,3 +361,3 @@ });

var index = _lodash2.default.findIndex(this._appsCollection, function (w) {
var index = (0, _findIndex2.default)(this._appsCollection, function (w) {
return w.App.frintAppName === name;

@@ -347,3 +373,3 @@ });

this._appsCollection[index].instances[key] = new w.App(_extends({}, _lodash2.default.omit(w, ['App', 'instances']), {
this._appsCollection[index].instances[key] = new w.App(_extends({}, (0, _omit2.default)(w, ['App', 'instances']), {
name: w.App.frintAppName,

@@ -360,3 +386,3 @@ parentApp: this

var index = _lodash2.default.findIndex(this._appsCollection, function (w) {
var index = (0, _findIndex2.default)(this._appsCollection, function (w) {
if (!w || !w.App) {

@@ -388,14 +414,2 @@ return false;

// @TODO: Get rid of *Widget* aliases
[{ alias: 'getWidgets$', fn: 'getApps$' }, { alias: 'registerWidget', fn: 'registerApp' }, { alias: 'hasWidgetInstance', fn: 'hasWidgetInstance' }, { alias: 'getWidgetInstance', fn: 'getAppInstance' }, { alias: 'getWidgetOnceAvailable$', fn: 'getAppOnceAvailable$' }, { alias: 'destroyWidget', fn: 'destroyApp' }].forEach(function (_ref) {
var alias = _ref.alias,
fn = _ref.fn;
App.prototype[alias] = function deprecatedAlias() {
// eslint-disable-next-line no-console, prefer-template
console.warn('[DEPRECATED] `' + alias + '` has been deprecated. Use `' + fn + '` instead');
this[fn].apply(this, arguments);
};
});
// unregisterApp(name, region = null, regionKey = null) {

@@ -402,0 +416,0 @@ // // @TODO

@@ -9,12 +9,2 @@ 'use strict';

var _chai2 = _interopRequireDefault(_chai);
var _sinon = require('sinon');
var _sinon2 = _interopRequireDefault(_sinon);
var _sinonChai = require('sinon-chai');
var _sinonChai2 = _interopRequireDefault(_sinonChai);
var _App = require('./App');

@@ -32,4 +22,2 @@

_chai2.default.use(_sinonChai2.default);
describe('frint › App', function () {

@@ -474,20 +462,2 @@ it('throws error when creating new instance without name', function () {

});
describe('aliases', function () {
var testApp = new _App2.default({ name: 'MyApp' });
[{ alias: 'getWidgets$', fn: 'getApps$' }, { alias: 'registerWidget', fn: 'registerApp' }, { alias: 'hasWidgetInstance', fn: 'hasWidgetInstance' }, { alias: 'getWidgetInstance', fn: 'getAppInstance' }, { alias: 'getWidgetOnceAvailable$', fn: 'getAppOnceAvailable$' }, { alias: 'destroyWidget', fn: 'destroyApp' }].forEach(function (_ref3) {
var alias = _ref3.alias,
fn = _ref3.fn;
it('"' + alias + '" should call "' + fn + '"', function () {
var _expect$to$have$been;
var stub = _sinon2.default.stub(testApp, fn);
var args = [1, 2, 3];
testApp[alias].apply(testApp, args);
(_expect$to$have$been = (0, _chai.expect)(stub).to.have.been).calledWith.apply(_expect$to$have$been, args);
});
});
});
});

@@ -8,5 +8,5 @@ 'use strict';

var _lodash = require('lodash');
var _merge = require('lodash/merge');
var _lodash2 = _interopRequireDefault(_lodash);
var _merge2 = _interopRequireDefault(_merge);

@@ -36,3 +36,3 @@ var _App = require('./App');

return _possibleConstructorReturn(this, (App.__proto__ || Object.getPrototypeOf(App)).call(this, _lodash2.default.merge(options, opts)));
return _possibleConstructorReturn(this, (App.__proto__ || Object.getPrototypeOf(App)).call(this, (0, _merge2.default)(options, opts)));
}

@@ -39,0 +39,0 @@

{
"name": "frint",
"version": "2.8.1",
"version": "2.9.0-alpha.2d26e4d7",
"description": "Core plugin for Frint",

@@ -36,3 +36,4 @@ "main": "lib/index.js",

"devDependencies": {
"cross-env": "^5.0.5"
"cross-env": "^5.0.5",
"frint-config": "^2.9.0-alpha.2d26e4d7"
},

@@ -39,0 +40,0 @@ "bugs": {

@@ -18,2 +18,3 @@ # frint

- [createApp](#createapp)
- [app](#app-1)

@@ -392,8 +393,2 @@ <!-- /MarkdownTOC -->

### app.getWidgets$ [deprecated]
> app.getWidgets$(regionName = null)
Alias to [`app.getApps$`](#app-getapps-)
### app.registerApp

@@ -416,8 +411,2 @@

### app.registerWidget [deprecated]
> app.registerWidget(App, options = {})
Alias to [`app.registerApp`](#app-registerapp)
### app.hasAppInstance

@@ -439,8 +428,2 @@

### app.hasWidgetInstance [deprecated]
> app.hasWidgetInstance(name, region = null, regionKey = null)
Alias to [`app.hasAppInstance`](#app-hasappinstance)
### app.getAppInstance

@@ -462,8 +445,2 @@

### app.getWidgetInstance [deprecated]
> app.getWidgetInstance(name, region = null, regionKey = null)
Alias to [`app.getAppInstance`](#app-getappinstance)
### app.getAppOnceAvailable$

@@ -485,8 +462,2 @@

### app.getWidgetOnceAvailable$ [deprecated]
> app.getWidgetOnceAvailable$(name, region = null, regionKey = null)
Alias to [`app.getAppOnceAvailable$`](#app-getapponceavailable-)
### app.instantiateApp

@@ -508,8 +479,2 @@

### app.instantiateWidget [deprecated]
> app.instantiateWidget(name, region = null, regionKey = null)
Alias to [`app.instantiateApp`](#app-instantiateapp)
### app.destroyApp

@@ -530,7 +495,1 @@

`void`.
### app.destroyWidget [deprecated]
> app.destroyWidget(name, region = null, regionKey = null)
Alias to [`app.destroyApp`](#app-destroyapp)
var webpack = require('webpack');
var externals = require('frint-config').externals;

@@ -26,6 +27,6 @@ var minify = process.env.DIST_MIN;

},
externals: {
externals: Object.assign({}, {
'lodash': '_',
'rxjs': 'Rx',
},
}, externals),
target: 'web',

@@ -32,0 +33,0 @@ plugins: plugins,

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