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.0.1 to 2.1.0-alpha.851cd0a6

215

dist/frint.js

@@ -37,5 +37,2 @@ this["Frint"] =

/******/
/******/ // identity function for calling harmony imports with the correct context
/******/ __webpack_require__.i = function(value) { return value; };
/******/
/******/ // define getter function for harmony exports

@@ -68,3 +65,3 @@ /******/ __webpack_require__.d = function(exports, name, getter) {

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

@@ -85,3 +82,3 @@ /************************************************************************/

var _rxjs = __webpack_require__(9);
var _rxjs = __webpack_require__(3);

@@ -263,2 +260,6 @@ var _lodash = __webpack_require__(1);

App.prototype.getName = function getName() {
return this.getOption('name');
};
App.prototype.getProviders = function getProviders() {

@@ -483,8 +484,3 @@ return this.options.providers;

});
exports.default = createApp;
var _lodash = __webpack_require__(1);
var _lodash2 = _interopRequireDefault(_lodash);
var _App = __webpack_require__(0);

@@ -494,55 +490,4 @@

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _createApp = __webpack_require__(9);
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
function createApp() {
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var App = function (_BaseApp) {
_inherits(App, _BaseApp);
function App() {
var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
_classCallCheck(this, App);
return _possibleConstructorReturn(this, (App.__proto__ || Object.getPrototypeOf(App)).call(this, _lodash2.default.merge(options, opts)));
}
return App;
}(_App2.default);
if (typeof options.name !== 'undefined') {
Object.defineProperty(App, 'frintAppName', {
value: options.name,
configurable: true
});
}
return App;
}
module.exports = exports['default'];
/***/ }),
/* 3 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _App = __webpack_require__(0);
var _App2 = _interopRequireDefault(_App);
var _createApp = __webpack_require__(2);
var _createApp2 = _interopRequireDefault(_createApp);

@@ -561,6 +506,12 @@

/***/ }),
/* 3 */
/***/ (function(module, exports) {
(function() { module.exports = this["Rx"]; }());
/***/ }),
/* 4 */
/***/ (function(module, exports, __webpack_require__) {
var lib = __webpack_require__(7);
var lib = __webpack_require__(5);

@@ -577,32 +528,21 @@ module.exports = lib;

Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = createClass;
var _createContainer = __webpack_require__(6);
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var _createContainer2 = _interopRequireDefault(_createContainer);
function createClass() {
var extend = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var _resolveContainer = __webpack_require__(7);
var GeneratedClass = function GeneratedClass() {
var _this = this;
var _resolveContainer2 = _interopRequireDefault(_resolveContainer);
_classCallCheck(this, GeneratedClass);
var _createClass = __webpack_require__(8);
Object.keys(extend).forEach(function (key) {
if (typeof extend[key] === 'function') {
_this[key] = extend[key].bind(_this);
} else {
_this[key] = extend[key];
}
});
var _createClass2 = _interopRequireDefault(_createClass);
if (typeof this.initialize === 'function') {
this.initialize.apply(this, arguments);
}
};
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
return GeneratedClass;
}
module.exports = {
createContainer: _createContainer2.default,
resolveContainer: _resolveContainer2.default,
createClass: _createClass2.default
};

@@ -733,24 +673,50 @@ /***/ }),

var _createContainer = __webpack_require__(6);
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = resolveContainer;
function resolveContainer(Container) {
return new Container();
}
var _createContainer2 = _interopRequireDefault(_createContainer);
/***/ }),
/* 8 */
/***/ (function(module, exports, __webpack_require__) {
var _resolveContainer = __webpack_require__(8);
"use strict";
var _resolveContainer2 = _interopRequireDefault(_resolveContainer);
var _createClass = __webpack_require__(5);
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = createClass;
var _createClass2 = _interopRequireDefault(_createClass);
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function createClass() {
var extend = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
module.exports = {
createContainer: _createContainer2.default,
resolveContainer: _resolveContainer2.default,
createClass: _createClass2.default
};
var GeneratedClass = function GeneratedClass() {
var _this = this;
_classCallCheck(this, GeneratedClass);
Object.keys(extend).forEach(function (key) {
if (typeof extend[key] === 'function') {
_this[key] = extend[key].bind(_this);
} else {
_this[key] = extend[key];
}
});
if (typeof this.initialize === 'function') {
this.initialize.apply(this, arguments);
}
};
return GeneratedClass;
}
/***/ }),
/* 8 */
/* 9 */
/***/ (function(module, exports, __webpack_require__) {

@@ -764,14 +730,49 @@

});
exports.default = resolveContainer;
function resolveContainer(Container) {
return new Container();
}
exports.default = createApp;
/***/ }),
/* 9 */
/***/ (function(module, exports) {
var _lodash = __webpack_require__(1);
(function() { module.exports = this["Rx"]; }());
var _lodash2 = _interopRequireDefault(_lodash);
var _App = __webpack_require__(0);
var _App2 = _interopRequireDefault(_App);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
function createApp() {
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var App = function (_BaseApp) {
_inherits(App, _BaseApp);
function App() {
var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
_classCallCheck(this, App);
return _possibleConstructorReturn(this, (App.__proto__ || Object.getPrototypeOf(App)).call(this, _lodash2.default.merge(options, opts)));
}
return App;
}(_App2.default);
if (typeof options.name !== 'undefined') {
Object.defineProperty(App, 'frintAppName', {
value: options.name,
configurable: true
});
}
return App;
}
module.exports = exports['default'];
/***/ })
/******/ ]);

@@ -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.i=function(e){return e},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=3)}([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(9),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.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}}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},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(2),s=r(a),p={App:i.default,createApp:s.default};t.default=p,e.exports=t.default},function(e,t,n){var r=n(7);e.exports=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,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 e&&e.__esModule?e:{default:e}}var o=n(6),i=r(o),a=n(8),s=r(a),p=n(5),u=r(p);e.exports={createContainer:i.default,resolveContainer:s.default,createClass:u.default}},function(e,t,n){"use strict";function r(e){return new e}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r},function(e,t){!function(){e.exports=this.Rx}()}]);
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}]);

@@ -186,2 +186,6 @@ 'use strict';

App.prototype.getName = function getName() {
return this.getOption('name');
};
App.prototype.getProviders = function getProviders() {

@@ -188,0 +192,0 @@ return this.options.providers;

'use strict';
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /* eslint-disable import/no-extraneous-dependencies, func-names, no-new, class-methods-use-this*/
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /* eslint-disable import/no-extraneous-dependencies, func-names, no-new, class-methods-use-this */
/* global describe, it */

@@ -45,3 +45,3 @@

(0, _chai.expect)(app.getOption('name')).to.equal('MyApp');
(0, _chai.expect)(app.getName()).to.equal('MyApp');
});

@@ -64,4 +64,4 @@

(0, _chai.expect)(rootApp.getOption('name')).to.equal('RootApp');
(0, _chai.expect)(childApp.getOption('name')).to.equal('ChildApp');
(0, _chai.expect)(rootApp.getName()).to.equal('RootApp');
(0, _chai.expect)(childApp.getName()).to.equal('ChildApp');
(0, _chai.expect)(rootApp.getParentApps()).to.deep.equal([]);

@@ -288,3 +288,3 @@

(0, _chai.expect)(app.getOption('name')).to.equal('MyApp');
(0, _chai.expect)(app.getName()).to.equal('MyApp');
(0, _chai.expect)(called).to.equal(true);

@@ -304,3 +304,3 @@ });

(0, _chai.expect)(app.getOption('name')).to.equal('MyApp');
(0, _chai.expect)(app.getName()).to.equal('MyApp');
(0, _chai.expect)(called).to.equal(true);

@@ -399,3 +399,3 @@ });

root.getAppOnceAvailable$('App1').subscribe(function (app) {
(0, _chai.expect)(app.getOption('name')).to.equal('App1');
(0, _chai.expect)(app.getName()).to.equal('App1');

@@ -416,3 +416,3 @@ done();

root.getAppOnceAvailable$('App1').subscribe(function (app) {
(0, _chai.expect)(app.getOption('name')).to.equal('App1');
(0, _chai.expect)(app.getName()).to.equal('App1');

@@ -419,0 +419,0 @@ done();

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

(0, _chai.expect)(app).to.be.instanceOf(_App2.default);
(0, _chai.expect)(app.getOption('name')).to.equal('MyAppNameFromInstance');
(0, _chai.expect)(app.getName()).to.equal('MyAppNameFromInstance');
});
}); /* eslint-disable import/no-extraneous-dependencies, func-names */
/* global describe, it */
{
"name": "frint",
"version": "2.0.1",
"version": "2.1.0-alpha.851cd0a6",
"description": "Core plugin for Frint",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -239,3 +239,3 @@ # frint

useFactory: function ({ app }) {
return app.getOption('name');
return app.app.getName();
},

@@ -308,2 +308,10 @@ deps: ['app'],

### app.getName
> app.getName()
#### Returns
`String`: The App's name.
### app.getRootApp

@@ -310,0 +318,0 @@

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