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

@smallstack/common

Package Overview
Dependencies
Maintainers
3
Versions
150
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@smallstack/common - npm Package Compare versions

Comparing version 0.6.8 to 0.6.9

2

dist/bundle/dts/navigation/types/generated/collections/GeneratedNavigationCollection.d.ts

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

import { BaseCollection, Collection, MongoDBAllowDenyOptions } from "@smallstack/common";
import { BaseCollection, Collection, MongoDBAllowDenyOptions } from "../../../../index";
import { NavigationEntry } from "../../models/NavigationEntry";

@@ -3,0 +3,0 @@ export declare class GeneratedNavigationCollection extends BaseCollection<NavigationEntry> implements Collection<NavigationEntry> {

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

import { BaseCollection, Collection, MongoDBAllowDenyOptions } from "@smallstack/common";
import { BaseCollection, Collection, MongoDBAllowDenyOptions } from "../../../../index";
import { NavigationTree } from "../../models/NavigationTree";

@@ -3,0 +3,0 @@ export declare class GeneratedNavigationtreesCollection extends BaseCollection<NavigationTree> implements Collection<NavigationTree> {

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

import { DataBridge } from "@smallstack/common";
import { SmallstackModel, Type } from "@smallstack/common";
import { DataBridge } from "../../../../index";
import { SmallstackModel, Type } from "../../../../index";
import { NavigationEntry } from "../../models/NavigationEntry";
import { QueryOptions } from "@smallstack/common";
import { QueryObject } from "@smallstack/common";
import { QueryOptions } from "../../../../index";
import { QueryObject } from "../../../../index";
export interface INavigationEntry {

@@ -7,0 +7,0 @@ _id?: string;

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

import { DataBridge } from "@smallstack/common";
import { SmallstackModel, Type } from "@smallstack/common";
import { DataBridge } from "../../../../index";
import { SmallstackModel, Type } from "../../../../index";
import { NavigationTree } from "../../models/NavigationTree";

@@ -4,0 +4,0 @@ export interface INavigationTree {

/**
* THIS FILE IS AUTO-GENERATED AND WILL BE REPLACED DURING CODE GENERATION
*/
import { DataBridge } from "@smallstack/common";
import { CollectionsService, Collection, QueryOptions, QueryObject, SmallstackModel } from "@smallstack/common";
import { DataBridge } from "../../../../index";
import { CollectionsService, Collection, QueryOptions, QueryObject, SmallstackModel } from "../../../../index";
import { NavigationService } from "../../services/NavigationService";

@@ -7,0 +7,0 @@ export declare class GeneratedNavigationService<ModelClass extends SmallstackModel> {

/**
* THIS FILE IS AUTO-GENERATED AND WILL BE REPLACED DURING CODE GENERATION
*/
import { DataBridge } from "@smallstack/common";
import { CollectionsService, Collection, QueryOptions, QueryObject, SmallstackModel } from "@smallstack/common";
import { DataBridge } from "../../../../index";
import { CollectionsService, Collection, QueryOptions, QueryObject, SmallstackModel } from "../../../../index";
import { NavigationTreeService } from "../../services/NavigationTreeService";

@@ -7,0 +7,0 @@ export declare class GeneratedNavigationTreeService<ModelClass extends SmallstackModel> {

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

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("underscore"),require("window-or-global"),require("pluralize"),require("@smallstack/common")):"function"==typeof define&&define.amd?define(["exports","underscore","window-or-global","pluralize","@smallstack/common"],t):t(e["@smallstack/common"]={},e._,e.root,e.pluralize,e["@smallstack/common"])}(this,function(e,t,n,i,o){"use strict";n=n&&n.hasOwnProperty("default")?n.default:n,i=i&&i.hasOwnProperty("default")?i.default:i;var r=function(){function e(){}return e.log=function(e,t,n,i){if(this.loggingModule(e,t)){t.length>this.loggerMaxLength&&(this.loggerMaxLength=t.length);var o=this.loggerMaxLength-t.length;if(o>0)for(var r=0;r<o;r++)t+=" ";var a="debug"===e?"log":e;"undefined"!=typeof console&&"function"==typeof console[a]&&(i?console[a](t+" "+n,i):console[a](t+" "+n))}},e.info=function(e,t,n){this.log("info",e,t,n)},e.warning=function(e,t,n){this.log("warn",e,t,n)},e.error=function(e,t,n){this.log("error",e,t,n)},e.debug=function(e,t,n){this.log("debug",e,t,n)},e.loggingModule=function(e,t){return!!this.debugMode||("debug"!==e||-1!==this.debugModules.indexOf(t))},e.printSmallstackLogo=function(){console.log(" "),console.log(" _ _ _ _ "),console.log(" ___ _ __ ___ __ _ | || | ___ | |_ __ _ ___ | | __"),console.log("/ __|| '_ ` _ \\ / _` || || |/ __|| __| / _` | / __|| |/ /"),console.log("\\__ \\| | | | | || (_| || || |\\__ \\| |_ | (_| || (__ | < "),console.log("|___/|_| |_| |_| \\__,_||_||_||___/ \\__| \\__,_| \\___||_|\\_\\"),console.log("visit us on https://smallstack.io!"),console.log(" ")},e.addDebugModule=function(e){this.debugModules.push(e)},e.debugMode=!1,e.loggerMaxLength=24,e.debugModules=[],e}(),a=function(){function e(e){void 0===e&&(e=!1);var n=this;this.container={},this.onRegisterCallbacks={},this.id=t.random(0,99999).toString(),e&&setTimeout(function(){var e="";t.each(n.onRegisterCallbacks,function(t,i){n.container[i]||(""!==e&&(e+=", "),e+=i)}),""!==e&&r.error("IOC","After 10s the following references could not be resolved : "+e,n.id)},1e4)}return e.prototype.register=function(e,n,i){void 0===i&&(i=!1);{if(!this.container[e]||i)return this.container[e]=n,r.debug("IOC","registered Object with ID: "+e+", Type:"+typeof n,this.id),this.onRegisterCallbacks[e]&&(t.each(this.onRegisterCallbacks[e],function(e){e.callback(n)}),this.onRegisterCallbacks[e]=t.reject(this.onRegisterCallbacks[e],function(e){return!0===e.callOnlyOnce})),n;r.debug("IOC","Ignoring re-registering of "+e+" since there is already an instance!",this.id)}},e.register=function(t,n,i){return void 0===i&&(i=!1),e.instance().register(t,n,i)},e.prototype.get=function(e){if(this.isRegistered(e))return this.container[e];throw new Error("Could not find an ioc instance for id : '"+e+"'!")},e.get=function(t){return e.instance().get(t)},e.prototype.isRegistered=function(e){return void 0!==this.container[e]},e.isRegistered=function(t){return e.instance().isRegistered(t)},e.instance=function(){return void 0===n.smallstack_ioc&&(n.smallstack_ioc=new e),n.smallstack_ioc},e.prototype.onRegister=function(e,t,n){void 0===n&&(n=!1),this.isRegistered(e)&&t(this.get(e)),this.onRegisterCallbacks[e]||(this.onRegisterCallbacks[e]=[]),this.onRegisterCallbacks[e].push({callback:t,callOnlyOnce:n})},e.onRegister=function(t,n,i){void 0===i&&(i=!1),e.instance().onRegister(t,n,i)},e.prototype.getIOCID=function(){return this.id},e.prototype.clear=function(){this.container=[],this.onRegisterCallbacks={}},e.clear=function(){e.instance().clear()},e}(),s=function(e,t,n,i){return new(n||(n=Promise))(function(o,r){function a(e){try{c(i.next(e))}catch(e){r(e)}}function s(e){try{c(i.throw(e))}catch(e){r(e)}}function c(e){e.done?o(e.value):new n(function(t){t(e.value)}).then(a,s)}c((i=i.apply(e,t||[])).next())})},c=function(e,t){var n,i,o,r,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return r={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function s(r){return function(s){return function(r){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,i&&(o=i[2&r[0]?"return":r[0]?"throw":"next"])&&!(o=o.call(i,r[1])).done)return o;switch(i=0,o&&(r=[0,o.value]),r[0]){case 0:case 1:o=r;break;case 4:return a.label++,{value:r[1],done:!1};case 5:a.label++,i=r[1],r=[0];continue;case 7:r=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===r[0]||2===r[0])){a=0;continue}if(3===r[0]&&(!o||r[1]>o[0]&&r[1]<o[3])){a.label=r[1];break}if(6===r[0]&&a.label<o[1]){a.label=o[1],o=r;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(r);break}o[2]&&a.ops.pop(),a.trys.pop();continue}r=t.call(e,a)}catch(e){r=[6,e],i=0}finally{n=o=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}([r,s])}}},u=function(){function e(){this.initLevels={}}return e.instance=function(){return a.get("initLevelService")},e.prototype.addInitLevelFn=function(e){if("function"!=typeof e.fn)throw new Error("No fn set for init level function: "+JSON.stringify(e));if("string"!=typeof e.identifier||""===e.identifier)throw new Error("No identifier set for init level function: "+JSON.stringify(e));if(void 0===e.level&&(e.level=50),void 0!==e.stopOnFailure&&"boolean"==typeof e.stopOnFailure||(e.stopOnFailure=!0),e.level<0||e.level>100)throw new Error("InitLevel should be between 0 and 100 (both inclusive): "+JSON.stringify(e));void 0===this.initLevels[e.level]&&(this.initLevels[e.level]=[]),r.debug("InitLevelService","Added '"+e.identifier+"' on init level "+e.level),this.initLevels[e.level].push(e)},e.prototype.execute=function(){return s(this,void 0,void 0,function(){var e,t,n,i,o;return c(this,function(a){switch(a.label){case 0:e=0,a.label=1;case 1:if(!(e<=100))return[3,8];if(!this.initLevels[e])return[3,7];t=0,n=this.initLevels[e],a.label=2;case 2:if(!(t<n.length))return[3,7];i=n[t],r.debug("InitLevelService","Executing '"+i.identifier+"'!"),a.label=3;case 3:return a.trys.push([3,5,,6]),[4,i.fn()];case 4:return a.sent(),[3,6];case 5:if(o=a.sent(),i.stopOnFailure)throw r.error("InitLevelService","Execution of '"+i.identifier+"' failed! InitLevel execution will stop!"),o;return r.warning("InitLevelService","Execution of '"+i.identifier+"' failed! InitLevel execution continuing due stopOnFailure === false!"),[3,6];case 6:return t++,[3,2];case 7:return e++,[3,1];case 8:return[2]}})})},e}();function l(e){if("string"==typeof e)throw new Error("Passing a string is deprecated, please pass an object instead!");return function(t,n){var i=e&&void 0!==e.name?e.name:n;e&&void 0!==e.lazyLoading&&!0!==e.lazyLoading?a.isRegistered(i)?t[n]=a.get(i):r.debug("Autowired","Could not autowire dependency '"+i+"'",{target:t,decoratedPropertyName:n}):a.onRegister(i,function(e){t[n]=e})}}(p=e.PadDirection||(e.PadDirection={}))[p.RIGHT=0]="RIGHT",p[p.LEFT=1]="LEFT";var p,g=function(){function n(){}return n.isNonEmptyString=function(e){return t.isString(e)&&!t.isUndefined(e)&&!t.isEmpty(e)&&null!==e&&void 0!==e},n.isEmptyString=function(e){return!n.isNonEmptyString(e)},n.stringEndsWith=function(e,t){return-1!==e.indexOf(t,e.length-t.length)},n.dasherize=function(e){return e.replace(/[A-Z]/g,function(e,t){return(0!==t?"-":"")+e.toLowerCase()})},n.decapitalize=function(e){return e.charAt(0).toLowerCase()+e.slice(1)},n.capitalize=function(e){return e.charAt(0).toUpperCase()+e.slice(1)},n.spaceBeforeUppercase=function(e){return e.replace(/([A-Z])/g," $1").trim()},n.padString=function(t,n,i,o){void 0===i&&(i=e.PadDirection.LEFT),void 0===o&&(o=" "),length=t.length;var r=length-t.length;switch(o.length>1&&(o=o.charAt(0)),i){case e.PadDirection.RIGHT:for(var a=0;a<r;a++)t+=o;return t;default:for(a=0;a<r;a++)t=o+t;return t}},n.isMobile=function(){var e=navigator.userAgent||navigator.vendor||window.opera;return!(!/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(e)&&!/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(e.substr(0,4)))},n.getUrlParameterByName=function(e,t){e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var n=new RegExp("[\\?&]"+e+"=([^&#]*)").exec(t);return null===n?void 0:decodeURIComponent(n[1].replace(/\+/g," "))},n.check=function(e,t,n,i){return r.debug("Utils","Utils.check is deprecated in favor of Utils.typeOfCheck!"),this.typeOfCheck(e,t,n,i)},n.typeOfCheck=function(e,t,n,i){if(typeof e!==t){var o=new Error(n+" is not of type "+t+", rather of type : "+typeof e);throw i&&i(o),o}},n.createUrlConformIdFromInput=function(e,t){return void 0===e?"":(e=(e=(e=(e=(e=(e=e.replace(/[üÜ]/g,"ue")).replace(/[äÄ]/g,"ae")).replace(/[öÖ]/g,"oe")).replace(/[ß]/g,"ss")).replace(/ /g,"_")).replace(/[^a-zA-Z0-9\_\-]/g,"").toLowerCase(),t?e.substring(0,t):e)},n.isValidEmail=function(e){return/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(e)},n.unflattenJSON=function(e){if(Object(e)!==e||Array.isArray(e))return e;var t=/\.?([^.\[\]]+)|\[(\d+)\]/g,n={};for(var i in e)if(e.hasOwnProperty(i)){for(var o=n,r="",a=void 0;a=t.exec(i);)o=o[r]||(o[r]=a[2]?[]:{}),r=a[2]||a[1];o[r]=e[i]}return n[""]||n},n.flattenJSON=function(e,t){void 0===t&&(t=!0);var n={};return function e(i,o){if(Object(i)!==i)n[o]=i;else if(Array.isArray(i))if(t){for(var r=0,a=i.length;r<a;r++)e(i[r],o+"["+r+"]");0===i.length&&(n[o]=[])}else n[o]=i;else{var s=!0;for(var c in i)i.hasOwnProperty(c)&&(s=!1,e(i[c],o?o+"."+c:c));s&&o&&(n[o]={})}}(e,""),n},n.prettyPrintJson=function(e,n){if(void 0===e)return"-";var i=e;return t.isObject(e)&&(i=JSON.stringify(e,void 0,4)),n&&i.length>n?i.substring(0,n-6)+" (...)":i},n.convertHexToRGB=function(e){if(6!==(e=e.replace("#","")).length)throw new Error("Please provide hex colors in 6-digit format!");return{r:parseInt(e.substring(0,2),16),g:parseInt(e.substring(2,4),16),b:parseInt(e.substring(4,6),16)}},n.isValidUrlName=function(e){return/\b((?=[a-z0-9-]{1,63}\.)(xn--)?[a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,63}\b/.test(e)},n.dataURLtoBlob=function(e){for(var t=e.split(","),n=t[0].match(/:(.*?);/)[1],i=atob(t[1]),o=i.length,r=new Uint8Array(o);o--;)r[o]=i.charCodeAt(o);return new Blob([r],{type:n})},n.blobToDataURL=function(e,t){var n=new FileReader;n.onload=function(e){t(e.target.result)},n.readAsDataURL(e)},n.blobToArrayBuffer=function(e,t){var n=new FileReader;n.onload=function(){t(this.result)},n.readAsArrayBuffer(e)},n.dataUrlToBuffer=function(e,t){this.blobToArrayBuffer(this.dataURLtoBlob(e),t)},n.imageUrlToBlob=function(e,t){var n=new Image;n.onerror=function(){r.error("Utils","Could not convert url to blob: ",e)},n.onload=function(){var e=document.createElement("canvas");e.width=this.width,e.height=this.height;e.getContext("2d").drawImage(this,0,0),e.toBlob(function(e){t(e)})},n.src=e},n.getApiURL=function(e,t){return e+"/"+n.decapitalize(t.replace("get","")).toLowerCase()},n}(),f=function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){e(t,n);function i(){this.constructor=t}t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),d=function(e){f(t,e);function t(t,n){var i=this;return"string"==typeof t?(i=e.call(this,t)||this).i18nKey=t:((i=e.call(this,t.i18nKey)||this).i18nKey=t.i18nKey,i.supportCode=t.supportCode,i.internalDescription=t.internalDescription),i.context=n,i}return t.prototype.setContext=function(e){return this.context=e,this},t}(Error),y=function(){function e(){this.errors={}}return e.instance=function(){return a.get("frontendErrorRegistry")},e.prototype.addCollection=function(e){for(var n=0,i=t.values(e);n<i.length;n++){var o=i[n];this.add(o)}},e.prototype.add=function(e){if("string"!=typeof e.supportCode||""===e.supportCode)throw new Error("Please provide a support code while adding frontend errors!");this.errors[e.supportCode]=new d(e)},e.prototype.getAllFrontendErrors=function(){return t.values(this.errors)},e}(),h=function(){function e(){this.configuration={},this.onSetCallbacks={}}return e.prototype.set=function(e,t,n){this.configuration[e]={key:e,value:t,scope:n}},e.prototype.unset=function(e){delete this.configuration[e]},e.prototype.get=function(e,t){return this.contains(e)?this.configuration[e].value:t},e.prototype.onSet=function(e,t){void 0===this.onSetCallbacks[e]&&(this.onSetCallbacks[e]=[]),this.onSetCallbacks[e].push(t)},e.prototype.contains=function(e){return void 0!==this.configuration[e]},e}(),v=function(){function e(){}return e.prototype.log=function(e,t,n){switch(n){case"debug":console.debug(e+" - "+t);break;case"error":console.error(e+" - "+t);break;case"warn":console.warn(e+" - "+t);break;case"info":case"success":default:console.log(e+" - "+t)}},e.prototype.info=function(e,t){this.log(e,t,"info")},e.prototype.success=function(e,t){this.log(e,t,"success")},e.prototype.debug=function(e,t){this.log(e,t,"debug")},e.prototype.warn=function(e,t){this.log(e,t,"warn")},e.prototype.error=function(e,t){this.log(e,t,"error")},e.prototype.confirmation=function(e,t,n){throw new Error("Console Notifier cannot ask questions!")},e}(),m=function(e,t,n,i){var o,r=arguments.length,a=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(r<3?o(a):r>3?o(t,n,a):o(t,n))||a);return r>3&&a&&Object.defineProperty(t,n,a),a},b=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},N=function(){function e(e){var t=this;e&&this.loadGA(e),a.onRegister("configurationService",function(e){e.onSet("googleanalytics.trackingid",function(e){t.loadGA(e)})})}return e.prototype.track=function(e,t){"undefined"==typeof ga?r.debug("GoogleAnalyticsService","ga not loaded!"):ga(function(t){void 0===t?r.debug("GoogleAnalyticsService","No GA Tracker defined yet!"):(r.debug("GoogleAnalyticsService","Sending GA tracking for path : ",e),ga("send","pageview",e))})},e.prototype.event=function(e,t){t||(t={}),t.category||(t.category="default"),"undefined"==typeof ga?r.debug("GoogleAnalyticsService","ga not loaded!"):ga(function(n){void 0===n?r.debug("GoogleAnalyticsService","No GA Tracker defined yet!"):(r.debug("GoogleAnalyticsService","Sending GA event for eventname : ",e),ga("send","event",t.category,e,t.label,t.value))})},e.prototype.loadGA=function(e){void 0!==e&&(t=window,n=document,i=void 0,o=void 0,t.GoogleAnalyticsObject="ga",t.ga=t.ga||function(){(t.ga.q=t.ga.q||[]).push(arguments)},t.ga.l=(new Date).getTime(),i=n.createElement("script"),o=n.getElementsByTagName("script")[0],i.async=1,i.src="https://www.google-analytics.com/analytics.js",o.parentNode.insertBefore(i,o),ga("create",e,"auto"),ga("send","pageview"),r.debug("GoogleAnalyticsService","Successfully initialized ga object!"));var t,n,i,o},m([l(),b("design:type",Object)],e.prototype,"dataBridge",void 0),e}(),w=function(){function e(){this.types={},this.afterTypeAddedCallbacks=[]}return e.instance=function(){return a.get("typesystem")},e.prototype.addType=function(e){r.debug("Typesystem","Adding type '"+e.getModelName()+"'!"),this.types[e.getModelName()]=e,t.each(this.afterTypeAddedCallbacks,function(t){t(e)})},e.prototype.afterTypeAdded=function(e){this.afterTypeAddedCallbacks.push(e)},e.prototype.getTypeByModelName=function(e){return t.find(this.types,function(t){if(-1!==e.indexOf("::")){var n=e.split("::");return t.model&&t.packageName===n[0]&&t.model.name===n[1]}return t.model&&t.model.name===e})},e.prototype.getTypeByCollectionName=function(e){return t.find(this.types,function(t){return t.collection&&t.collection.name===e})},e.prototype.getAllTypes=function(){return t.values(this.types)},e.prototype.getTypeByServiceName=function(e){return t.find(this.types,function(t){return void 0!==t.service&&t.service.name===e})},e.prototype.getCollectionNameForServiceName=function(e){var t=this.getTypeByServiceName(g.capitalize(e));if(t&&t.collection)return t.collection.name},e}(),C=function(e,t,n,i){var o,r=arguments.length,a=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(r<3?o(a):r>3?o(t,n,a):o(t,n))||a);return r>3&&a&&Object.defineProperty(t,n,a),a},O=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},_=function(){function e(){}return e.prototype.subscribe=function(e,t,n){var i=this;return new Promise(function(o,a){r.debug("Collection","Subscribing to "+e),i.dataBridge.ddpSubscribe(e,t,n,{onStop:function(t){t?a(t):r.debug("Collection","Successfully stopped subscription to "+i.getCollectionName()+"->"+e)},onError:function(t){a(t||new Error("An unknown error occured while subscribing to : "+i.getCollectionName()+"->"+e))},onReady:function(){o()}})})},e.prototype.syncViaJSONAPI=function(e,n){var i=this;return new Promise(function(o,a){var s=void 0!==n&&n.headers?n.headers:{};n&&!0===n.auth&&(s["x-smallstack-token"]=i.tokenService.getLoginToken()),i.dataBridge.httpCall("GET",e,{headers:s}).then(function(e){r.debug("Collection","Syncing models: ",e),t.each(e,function(e){e.id&&!e._id&&(e._id=e.id,delete e.id),r.debug("Collection","Syncing model: ",JSON.stringify(e)),i.mongoDBCollection.upsert({_id:e._id},e)}),o()}).catch(function(e){a(e)})})},e.prototype.subscribeForeignKeys=function(e,t){return this.collectionsService.subscribeForeignKeys(this,e,t)},e.prototype.getQueryCount=function(e,t){return this.dataBridge.ddpCall("server-counts",{queryName:e,parameters:t})},e.prototype.getMongoDBCollection=function(){return this.mongoDBCollection},e.prototype.applyAllowDenyRules=function(){var e=this.getMongoDBCollectionAllowRules(),t=this.getMongoDBCollectionDenyRules();e&&this.mongoDBCollection.allow(e),t&&this.mongoDBCollection.deny(t)},e.prototype.getMongoDBCollectionAllowRules=function(){},e.prototype.getMongoDBCollectionDenyRules=function(){return{insert:function(e,t){return!1},update:function(e,t,n,i){return!1},remove:function(e,t){return!1}}},C([l(),O("design:type",Object)],e.prototype,"collectionsService",void 0),C([l(),O("design:type",w)],e.prototype,"typesystem",void 0),C([l(),O("design:type",Object)],e.prototype,"dataBridge",void 0),C([l(),O("design:type",Object)],e.prototype,"tokenService",void 0),e}(),T=function(){function e(){this.publisherMethods={}}return e.instance=function(){return a.get("collectionAccessService")},e.prototype.checkAccess=function(e,n,i){var o=this;if(void 0!==e.access){var r={context:n,parameters:i,accessObject:e.access};switch(typeof e.access){case"string":return[this.executePublisherMethod(e.access,r)];case"object":var a=[];return t.each(e.access,function(e,t){a.push(o.executePublisherMethod(t,r))}),a;default:throw new Error("Type of query.access: '"+typeof e.access+"' is not allowed!")}}},e.prototype.addPublisherMethod=function(e,t){this.publisherMethods[e]=t},e.prototype.executePublisherMethod=function(e,t){var n=this.publisherMethods[e];if(!n)throw new Error("Publication method '"+e+"' could not be found!");var i=n(t);if("boolean"===i.type&&!1===i.value)throw new Error("Access restricted by '"+e+"'!");return i},e.prototype.getAccessMethod=function(e){return this.publisherMethods[e]},e.prototype.publisherMethodAvailable=function(e){return void 0!==this.publisherMethods[e]},e}(),I=function(){function e(){}return e.create=function(e,t,n,i,o,r){return(new(a.get("QueryObject"))).create(e,t,n,i,o,r)},e}(),S=function(e,t,n,i){var o,r=arguments.length,a=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(r<3?o(a):r>3?o(t,n,a):o(t,n))||a);return r>3&&a&&Object.defineProperty(t,n,a),a},R=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},E=function(e,t,n,i){return new(n||(n=Promise))(function(o,r){function a(e){try{c(i.next(e))}catch(e){r(e)}}function s(e){try{c(i.throw(e))}catch(e){r(e)}}function c(e){e.done?o(e.value):new n(function(t){t(e.value)}).then(a,s)}c((i=i.apply(e,t||[])).next())})},A=function(e,t){var n,i,o,r,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return r={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function s(r){return function(s){return function(r){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,i&&(o=i[2&r[0]?"return":r[0]?"throw":"next"])&&!(o=o.call(i,r[1])).done)return o;switch(i=0,o&&(r=[0,o.value]),r[0]){case 0:case 1:o=r;break;case 4:return a.label++,{value:r[1],done:!1};case 5:a.label++,i=r[1],r=[0];continue;case 7:r=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===r[0]||2===r[0])){a=0;continue}if(3===r[0]&&(!o||r[1]>o[0]&&r[1]<o[3])){a.label=r[1];break}if(6===r[0]&&a.label<o[1]){a.label=o[1],o=r;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(r);break}o[2]&&a.ops.pop(),a.trys.pop();continue}r=t.call(e,a)}catch(e){r=[6,e],i=0}finally{n=o=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}([r,s])}}},P=function(){function e(){this.isSubscribed=!1}return e.prototype.create=function(e,t,n,i,o,r){this.queryOptions=n||{},this.queryOptions.currentPage=this.queryOptions.currentPage||1,this.queryOptions.entriesPerPage=this.queryOptions.entriesPerPage||10,this.sorting=o,this.subscriptionName=t,this.selector=e,this.parameters=i,this.collection=r;var a=this.collection.getCollectionName(),s=this.typesystem.getTypeByCollectionName(a);if(void 0===s)throw new Error("Could not find type by collectionName '"+a+"'!");return this.ModelConstructor=s.getModel(),this},e.prototype.getSelector=function(){return this.selector},e.prototype.getCursor=function(){return this.collection.getMongoDBCollection().find(this.selector,this.convertQueryOptionsToMongoSelector(this.queryOptions,this.sorting))},e.prototype.convertQueryOptionsToMongoSelector=function(e,t,n){void 0===n&&(n=!0);var i={sort:t,reactive:e&&!0===e.reactive};return n?(e&&e.currentPage&&e.entriesPerPage&&(i.skip=(e.currentPage-1)*e.entriesPerPage),e&&e.entriesPerPage&&(i.limit=e.entriesPerPage)):(i.skip=0,e&&e.entriesPerPage&&(i.limit=e.currentPage*e.entriesPerPage)),i},e.prototype.getModels=function(){return this.cursorResolver.resolve(this.getCursor(),{ModelConstructor:this.ModelConstructor})},e.prototype.getModel=function(e){var t=this;return new Promise(function(n){return E(t,void 0,void 0,function(){var t;return A(this,function(i){switch(i.label){case 0:return[4,this.getModels()];case 1:return t=i.sent(),n(t[e]),[2]}})})})},e.prototype.subscribe=function(){var e=this;return new Promise(function(t,n){return E(e,void 0,void 0,function(){var e;return A(this,function(n){switch(n.label){case 0:return r.debug("QueryObject","Subscribing to '"+this.subscriptionName+"'!"),[4,this.collection.subscribe(this.subscriptionName,this.parameters,this.convertQueryOptionsToMongoSelector(this.queryOptions,this.sorting,!1))];case 1:return n.sent(),this.isSubscribed=!0,e=this,[4,this.collection.getQueryCount(this.subscriptionName,this.parameters)];case 2:return e.totalCount=n.sent(),t(this),[2]}})})})},e.prototype.syncViaJSONAPI=function(e){var n=this;return new Promise(function(i,o){var a=n.typesystem.getTypeByCollectionName(n.collection.getCollectionName()).getServiceQueryByName(n.subscriptionName);if(void 0===a)o("Could not find TypeServiceQuery for collection "+n.collection.getCollectionName()+" and serviceQuery "+n.subscriptionName);else{var s=n.configurationService.get("smallstack.api.url");if(s){g.stringEndsWith(s,"/")||(s+="/");var c=s+g.getApiURL(n.collection.getCollectionName(),n.subscriptionName);c=c+"?currentPage="+n.queryOptions.currentPage+"&entriesPerPage="+n.queryOptions.entriesPerPage,t.each(n.parameters,function(e,t){e instanceof Array&&(e=JSON.stringify(e)),c+="&"+t+"="+e}),void 0===a.api?o("API Endpoint "+c+" does not exist!"):(r.info("QueryObject","Querying "+c),n.collection.syncViaJSONAPI(c,e).then(function(e){return i(n)}).catch(function(e){return o(e)}))}else o("No smallstack.api.url configuration set! Can't call JSON API!")}})},e.prototype.expand=function(e){return e instanceof Array&&e.length>0?this.collection.subscribeForeignKeys(this.getCursor(),e):Promise.resolve()},e.prototype.getCount=function(){return this.collection.getQueryCount(this.subscriptionName,this.parameters)},e.prototype.getPage=function(e){var t=this;return new Promise(function(n,i){return E(t,void 0,void 0,function(){return A(this,function(t){switch(t.label){case 0:return[4,this.subscribe()];case 1:return t.sent(),this.queryOptions.currentPage=e,n(this.getModels()),[2]}})})})},e.prototype.getNextPage=function(){var e=this;return new Promise(function(t,n){return E(e,void 0,void 0,function(){var e;return A(this,function(i){switch(i.label){case 0:return this.hasNextPage()?(this.queryOptions.currentPage++,[4,this.subscribe()]):[3,3];case 1:return i.sent(),e=t,[4,this.getModels()];case 2:return e.apply(void 0,[i.sent()]),[3,4];case 3:n("No next page available!"),i.label=4;case 4:return[2]}})})})},e.prototype.getCurrentPage=function(){var e=this;return new Promise(function(t,n){return E(e,void 0,void 0,function(){var e;return A(this,function(n){switch(n.label){case 0:return[4,this.subscribe()];case 1:return n.sent(),e=t,[4,this.getModels()];case 2:return e.apply(void 0,[n.sent()]),[2]}})})})},e.prototype.getPreviousPage=function(){var e=this;return new Promise(function(t,n){return E(e,void 0,void 0,function(){var e;return A(this,function(i){switch(i.label){case 0:return this.hasPreviousPage()?(this.queryOptions.currentPage--,[4,this.subscribe()]):[3,3];case 1:return i.sent(),e=t,[4,this.getModels()];case 2:return e.apply(void 0,[i.sent()]),[3,4];case 3:n("No previous page available!"),i.label=4;case 4:return[2]}})})})},e.prototype.hasNextPage=function(){return void 0!==this.totalCount&&this.totalCount>this.queryOptions.entriesPerPage*this.queryOptions.currentPage},e.prototype.hasPreviousPage=function(){return this.queryOptions.currentPage>1},S([l(),R("design:type",w)],e.prototype,"typesystem",void 0),S([l(),R("design:type",Object)],e.prototype,"cursorResolver",void 0),S([l(),R("design:type",Object)],e.prototype,"dataBridge",void 0),S([l(),R("design:type",Object)],e.prototype,"configurationService",void 0),e}(),B=function(){function e(){}return e.interpolate=function(e,n){var i=this;if(void 0!==e){var o=JSON.stringify(e);if(void 0!==o){var a=(o=o.replace(/\$currentUserId/g,n.userId)).match(/\"\:([a-zA-Z\[\]\:]{2,})\"/g);null!==a&&t.forEach(a,function(t){var a=t.split(":")[1];if(a=a.replace('"',""),!n.parameters||void 0===n.parameters[a]){var s="Expected missing parameter '"+a+"' while interpolating query!";return r.error("QueryUtils",s,{selector:e,context:n}),new Error(s+" - "+JSON.stringify(e))}var c=new RegExp(i.escapeRegExp(t),"g");o=o.replace(c,JSON.stringify(n.parameters[a]))}),e=JSON.parse(o)}else e={}}else e={};return e},e.escapeRegExp=function(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},e}(),D=function(){function e(){}return e.fromDocument=function(n){var i=new e;return t.extend(i,n),i},e.prototype.getServiceName=function(){if(void 0!==this.service)return void 0!==this.service.name?this.service.name:this.getModelName()+"Service"},e.prototype.getServiceClassName=function(){return this.getServiceName()},e.prototype.getGeneratedServiceClassName=function(){return"Generated"+this.getServiceClassName()},e.prototype.getModelName=function(){if(this.model.name)return this.model.name;throw new Error("No model name given! How did that happen...")},e.prototype.getModelClassName=function(){return this.getModelName()},e.prototype.getGeneratedModelClassName=function(){return"Generated"+this.getModelClassName()},e.prototype.getService=function(){var e=this.getServiceName();return e=e.charAt(0).toLowerCase()+e.slice(1),a.get(e)},e.prototype.getCollectionName=function(){if(this.collection)return this.collection.name},e.prototype.getCollectionClassName=function(){var e=this.getCollectionName();if(e)return g.capitalize(e)+"Collection"},e.prototype.getGeneratedCollectionClassName=function(){return"Generated"+this.getCollectionClassName()},e.prototype.getModel=function(){return a.get(this.getModelName())},e.prototype.getServiceQueryByName=function(e){if(this.service)return t.find(this.service.queries,function(t){return t.name===e})},e.prototype.getSchemaEntryByName=function(e){return t.find(this.model.schema,function(t){return t.name===e})},e.prototype.getSearchableFields=function(){for(var e=[],t=0,n=this.model.schema;t<n.length;t++){var i=n[t];"foreign[]"!==i.type&&"foreign"!==i.type&&e.push(i)}return e.push({name:"_id",optional:!1,type:"string"}),e},e.prototype.getForeignGetter=function(){return"get"+i(this.getModelName())+"ByIds"},e}(),k=function(){function e(){}return e.extractServiceQuery=function(e){if("string"==typeof e){var t=e.split(".");return{queryName:t[1],serviceName:t[0]}}},e.getQueryObjectMethod=function(e,t){if(void 0===e)throw new Error("No Service Name given!");e=g.decapitalize(e);var n=a.get(e);if(void 0===n)throw new Error("Service not found : "+e);if("function"!=typeof n[t]){var i="get"+g.capitalize(t);if("function"!=typeof n[i])throw new Error("Query not found : "+t+" or "+i);t=i}return n[t].bind(n)},e.isPrimitiveType=function(e){switch(e=e.toLowerCase().replace(/\[|\]/g,"")){case"number":case"string":case"date":case"boolean":case"blob":case"file":case"any":case"object":return!0}return!1},e.extractSelectorParameters=function(e){if(void 0===e)return[];var t=JSON.stringify(e);t=t.replace(/\'/g,'"');for(var n,i=[],o=/\":([a-zA-Z]*):([a-zA-Z\[\]]*)\"/g;null!==(n=o.exec(t));)i.push(n[1]);return i},e}(),x=function(e,t,n,i){var o,r=arguments.length,a=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(r<3?o(a):r>3?o(t,n,a):o(t,n))||a);return r>3&&a&&Object.defineProperty(t,n,a),a},M=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},j=function(){function e(){}return e.instance=function(){return o.IOC.get("navigationService")},e.prototype.getCollection=function(){return this.collectionsService.getCollectionByName("navigation")},e.prototype.getNavigationForType=function(e,t){return o.QueryObjectBuilder.create({type:e.type},"getNavigationForType",t,e,{},this.getCollection())},e.prototype.getNavigationForTreeId=function(e,t){return o.QueryObjectBuilder.create({navigationTreeId:e.navigationTreeId},"getNavigationForTreeId",t,e,{},this.getCollection())},e.prototype.getNavigationEntryById=function(e,t){return o.QueryObjectBuilder.create({_id:e.id},"getNavigationEntryById",t,e,{},this.getCollection())},e.prototype.getNavigationEntryByPageId=function(e,t){return o.QueryObjectBuilder.create({pageId:e.pageId},"getNavigationEntryByPageId",t,e,{},this.getCollection())},e.prototype.save=function(e){return this.getCollection().getMongoDBCollection().insert(e.toDocument())},e.prototype.update=function(e){var t=e.toDocument("id");return this.getCollection().getMongoDBCollection().update(t.id,{$set:{i18nKey:t.i18nKey,icon:t.icon,route:t.route,navigationTreeIdentifier:t.navigationTreeIdentifier,requiresAuthentication:t.requiresAuthentication,loginRoute:t.loginRoute,requiredRole:t.requiredRole,visibility:t.visibility,index:t.index,stateName:t.stateName,abstract:t.abstract,defaultRoute:t.defaultRoute,substateOfId:t.substateOfId,badge:t.badge,trackingEnabled:t.trackingEnabled,redirectTo:t.redirectTo}})},e.prototype.delete=function(e){return this.getCollection().getMongoDBCollection().remove(e.id)},x([o.Autowired(),M("design:type",Object)],e.prototype,"collectionsService",void 0),x([o.Autowired(),M("design:type",Object)],e.prototype,"dataBridge",void 0),e}(),L=function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){e(t,n);function i(){this.constructor=t}t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),q=function(e){L(n,e);function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.navigationTrees={},t.navigationEntries=[],t.dbNavigation=[],t.layouts={},t.onNavigationEntryAddFns=[],t}return n.instance=function(){return o.IOC.get("navigationService")},n.prototype.addNavigationEntry=function(e){var i=this;void 0===e.navigationTreeIdentifier?e.navigationTreeIdentifier=n.LEGACY_TREE:o.Logger.debug("NavigationService","Adding navigation entry",e),void 0===this.navigationTrees[e.navigationTreeIdentifier]&&(this.navigationTrees[e.navigationTreeIdentifier]=oe.fromDocument({i18nKey:e.navigationTreeIdentifier})),this.navigationEntries.push(e),this.processNavigationEntry(e),t.each(this.onNavigationEntryAddFns,function(t){i.executeCallback(t,e)})},n.prototype.addNavigationTree=function(e){this.navigationTrees[e.identifier]=e},n.prototype.getNavigationTree=function(e){return this.navigationTrees[e]},n.prototype.getNavigationEntriesForTree=function(e){return t.filter(this.navigationEntries,function(t){return t.navigationTreeIdentifier===e})},n.prototype.getNavigationTreesForTag=function(e){var n=t.filter(this.navigationTrees,function(t){return t.tags instanceof Array&&-1!==t.tags.indexOf(e)});return t.sortBy(n,"index")},n.prototype.processNavigationEntry=function(e){void 0===e.stateName&&(e.stateName=e.route),o.Logger.debug("NavigationService","mapping route : "+e.getRoute()+", label : "+e.getI18nKey())},n.prototype.getEntryByRoute=function(e){for(var t=0,n=this.navigationEntries;t<n.length;t++){var i=n[t];if(i.getRoute()===e)return i}o.Logger.error("NavigationService","Could not find navigation entry by route '"+e+"', available routes are : ",this.navigationEntries)},n.prototype.getNavigationEntries=function(){return t.union(this.navigationEntries,this.dbNavigation)},n.prototype.getCodeNavigationEntries=function(){return this.navigationEntries},n.prototype.getDBNavigationEntries=function(){return this.dbNavigation},n.prototype.getNavigationEntriesForNavigationType=function(e){var n=[];return t.each(this.getNavigationEntries(),function(e){n.push(e)}),n},n.prototype.setLayout=function(e,t){this.layouts[e]=t},n.prototype.getEntryByStateName=function(e){return t.find(this.getNavigationEntries(),function(t){return t.stateName===e})},n.prototype.onNavigationEntryAdd=function(e,n){var i=this;this.onNavigationEntryAddFns.push({fn:e,thisArg:n}),t.each(this.navigationEntries,function(t){i.executeCallback({fn:e,thisArg:n},t)})},n.prototype.getDefaultNavigatioNentry=function(){var e=t.find(this.navigationEntries,function(e){return e.isDefaultRoute()});if(e)return e;throw new Error("No route is declared as default route!")},n.prototype.executeCallback=function(e,t){e.thisArg?e.fn.bind(e.thisArg)(t):e.fn(t)},n.LEGACY_TREE="LEGACY_TREE",n}(j),F=function(e,t,n,i){var o,r=arguments.length,a=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(r<3?o(a):r>3?o(t,n,a):o(t,n))||a);return r>3&&a&&Object.defineProperty(t,n,a),a},z=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},G=function(){function e(){this.requiresAuthentication=!0,this.visibility="alwaysVisible",this.abstract=!1,this.defaultRoute=!1,this.trackingEnabled=!0,this._hasSubDocuments=!0,this._isStored=!1}return e.fromDocument=function(e){if(void 0===e||null===e)throw new Error("doc cannot be undefined/null while calling GeneratedNavigationEntry.fromDocument(doc)!");var t=new(this.getModelClass());return void 0!==e._id&&(t._isStored=!0,t.id=e._id),void 0!==e.i18nKey&&(t.i18nKey=e.i18nKey),void 0!==e.icon&&(t.icon=e.icon),void 0!==e.route&&(t.route=e.route),void 0!==e.navigationTreeIdentifier&&(t.navigationTreeIdentifier=e.navigationTreeIdentifier),void 0!==e.requiresAuthentication&&(t.requiresAuthentication=e.requiresAuthentication),void 0!==e.loginRoute&&(t.loginRoute=e.loginRoute),void 0!==e.requiredRole&&(t.requiredRole=e.requiredRole),void 0!==e.visibility&&(t.visibility=e.visibility),void 0!==e.index&&(t.index=e.index),void 0!==e.stateName&&(t.stateName=e.stateName),void 0!==e.abstract&&(t.abstract=e.abstract),void 0!==e.defaultRoute&&(t.defaultRoute=e.defaultRoute),void 0!==e.substateOfId&&(t.substateOfId=e.substateOfId),void 0!==e.badge&&(t.badge=e.badge),void 0!==e.trackingEnabled&&(t.trackingEnabled=e.trackingEnabled),void 0!==e.redirectTo&&(t.redirectTo=e.redirectTo),t},e.prototype.toDocument=function(e){void 0===e&&(e="_id");var t={};return t.i18nKey=this.i18nKey,t.icon=this.icon,t.route=this.route,t.navigationTreeIdentifier=this.navigationTreeIdentifier,t.requiresAuthentication=this.requiresAuthentication,t.loginRoute=this.loginRoute,t.requiredRole=this.requiredRole,t.visibility=this.visibility,t.index=this.index,t.stateName=this.stateName,t.abstract=this.abstract,t.defaultRoute=this.defaultRoute,t.substateOfId=this.substateOfId,t.badge=this.badge,t.trackingEnabled=this.trackingEnabled,t.redirectTo=this.redirectTo,this.id&&(t[e]=this.id),JSON.parse(JSON.stringify(t))},e.prototype.clone=function(){return K.fromDocument(this.toDocument())},e.prototype.saveSnapshot=function(){this._snapshot=this.toDocument()},e.prototype.restoreSnapshot=function(){if(!this._snapshot)throw new Error("Could not restore snapshot of model since no snapshot was saved before!");t.extend(this,this._snapshot)},e.prototype.getSubstateOf=function(e){return o.IOC.get("navigationService").getNavigationEntryById({id:this.substateOfId},e)},e.prototype.hasSubDocuments=function(){return this._hasSubDocuments},e.prototype.isStored=function(){return this._isStored},e.getModelName=function(){return"NavigationEntry"},e.prototype.getModelName=function(){return"NavigationEntry"},e.prototype.getForeignLabel=function(){return this.getModelName()+" ID:"+this.id},e.getModelClass=function(){return o.IOC.get("NavigationEntry")},e.prototype.getModelClass=function(){return o.IOC.get("NavigationEntry")},e.prototype.delete=function(){return q.instance().delete(this)},e.prototype.update=function(){return q.instance().update(this)},e.prototype.save=function(){return q.instance().save(this)},e.asType=function(){return o.Type.fromDocument({collection:{name:"navigation"},service:{name:"NavigationService",queries:[{name:"getNavigationForType",selector:{type:":type:string"}},{name:"getNavigationForTreeId",selector:{navigationTreeId:":navigationTreeId:string"}},{name:"getNavigationEntryById",selector:{_id:":id:string"}},{name:"getNavigationEntryByPageId",selector:{pageId:":pageId:string"}}]},model:{name:"NavigationEntry",schema:[{name:"i18nKey",type:"string",optional:!0},{name:"icon",type:"string",optional:!0},{name:"route",type:"string"},{name:"navigationTreeIdentifier",type:"string",optional:!0},{name:"requiresAuthentication",type:"boolean",defaultValue:!0,optional:!0},{name:"loginRoute",type:"string",optional:!0},{name:"requiredRole",type:"string",optional:!0},{name:"visibility",type:"string",allowedValues:["alwaysVisible","alwaysHidden","onlyAnonymous","onlyAuthenticated"],defaultValue:"alwaysVisible",optional:!0},{name:"index",type:"number",optional:!0},{name:"stateName",type:"string",optional:!0},{name:"abstract",type:"boolean",optional:!0,defaultValue:!1},{name:"defaultRoute",type:"boolean",optional:!0,defaultValue:!1},{name:"substateOfId",type:"foreign",foreignType:"NavigationEntry",optional:!0},{name:"badge",type:"number",optional:!0},{name:"trackingEnabled",type:"boolean",defaultValue:!0,optional:!0},{name:"redirectTo",type:"string",optional:!0}]},packageName:"@smallstack/common"})},e.enums={visibility:{ALWAYSVISIBLE:"alwaysVisible",ALWAYSHIDDEN:"alwaysHidden",ONLYANONYMOUS:"onlyAnonymous",ONLYAUTHENTICATED:"onlyAuthenticated"}},F([o.Autowired(),z("design:type",Object)],e.prototype,"dataBridge",void 0),e}(),V=function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){e(t,n);function i(){this.constructor=t}t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),K=function(e){V(t,e);function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.subEntriesAvailable=!1,t}return t.new=function(){return new t},t.prototype.setI18nKey=function(e){return this.i18nKey=e,this},t.prototype.getI18nKey=function(){return this.i18nKey},t.prototype.setRoute=function(e){if("/"!==e.charAt(0))throw new Error("Route for NavigationEntry has to start with a '/'!");return this.route=e,this},t.prototype.getRoute=function(){if(void 0===this.route&&!0!==this.abstract)throw new Error("No route set for navigation entry : "+JSON.stringify(this,null,2));return this.route},t.prototype.setRequiresAuthentication=function(e,t){return this.requiresAuthentication=e,void 0!==t&&(this.loginRoute=t),this},t.prototype.doesRequireAuthentication=function(){return this.requiresAuthentication},t.prototype.setRequiredRole=function(e){return this.requiredRole=e,this},t.prototype.getRequiredRole=function(){return this.requiredRole},t.prototype.setVisible=function(e){return e?this.setVisibility(t.enums.visibility.ALWAYSVISIBLE):this.setVisibility(t.enums.visibility.ALWAYSHIDDEN),this},t.prototype.setVisibility=function(e){return this.visibility=e,this},t.prototype.isVisible=function(){return this.visibility===t.enums.visibility.ALWAYSVISIBLE||this.visibility!==t.enums.visibility.ALWAYSHIDDEN&&(this.visibility===t.enums.visibility.ONLYANONYMOUS?void 0===this.dataBridge.getCurrentUserId():this.visibility!==t.enums.visibility.ONLYAUTHENTICATED||void 0!==this.dataBridge.getCurrentUserId())},t.prototype.setIndex=function(e){return this.index=e,this},t.prototype.getIndex=function(){return this.index},t.prototype.setIcon=function(e){return this.icon=e,this},t.prototype.getIcon=function(){return void 0===this.icon&&o.Logger.debug("NavigationEntry","No icon set for route : "+this.getI18nKey()),this.icon},t.prototype.setDefaultRoute=function(e){return this.defaultRoute=e,this},t.prototype.isDefaultRoute=function(){return this.defaultRoute},t.prototype.setChildOfRoute=function(e){return this.childOfRoute=e,this},t.prototype.getChildOfRoute=function(){return this.childOfRoute},t.prototype.hasSubEntries=function(){return this.subEntriesAvailable},t.prototype.setSubEntriesAvailable=function(e){return this.subEntriesAvailable=e,this},t.prototype.setComponent=function(e){return this.component=e,this},t.prototype.getComponent=function(){return this.component},t.prototype.setRedirectTo=function(e){return this.redirectTo=e,this},t.prototype.getRedirectTo=function(){return this.redirectTo},t.prototype.setNavigationTree=function(e){return this.navigationTreeIdentifier=e,this},t}(G),U=function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){e(t,n);function i(){this.constructor=t}t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),Q=function(e){U(t,e);function t(){var t=e.call(this)||this;return t.createMongoDBCollection(),t.applyAllowDenyRules(),t.createPublications(),t}return t.prototype.createPublications=function(){this.dataBridge.isServer()&&(this.collectionsService.addPublisher("navigation","getNavigationForType",{type:":type:string"},{}),this.collectionsService.addPublisher("navigation","getNavigationForTreeId",{navigationTreeId:":navigationTreeId:string"},{}),this.collectionsService.addPublisher("navigation","getNavigationEntryById",{_id:":id:string"},{}),this.collectionsService.addPublisher("navigation","getNavigationEntryByPageId",{pageId:":pageId:string"},{}))},t.prototype.createMongoDBCollection=function(){this.mongoDBCollection=this.collectionsService.createMongoDBCollection("navigation",function(e){return K.fromDocument(e)}),this.collectionsService.registerCollection("navigation",this)},t.prototype.applyAllowDenyRules=function(){var e=this.getMongoDBCollectionAllowRules(),t=this.getMongoDBCollectionDenyRules();e&&this.mongoDBCollection.allow(e),t&&this.mongoDBCollection.deny(t)},t.prototype.getMongoDBCollectionAllowRules=function(){},t.prototype.getMongoDBCollectionDenyRules=function(){return{insert:function(e,t){return!1},update:function(e,t,n,i){return!1},remove:function(e,t){return!1}}},t.prototype.getForeignCollection=function(e){switch(e){case"substateOfId":return this.typesystem.getTypeByModelName("NavigationEntry").getCollectionName()}},t.prototype.getCollectionName=function(){return t.COLLECTION_NAME},t.getCollection=function(){return o.IOC.get("collectionsService").getCollectionByName(t.COLLECTION_NAME)},t.COLLECTION_NAME="navigation",t.queries={getNavigationForType:{name:"getNavigationForType",parameters:{type:"type"}},getNavigationForTreeId:{name:"getNavigationForTreeId",parameters:{navigationTreeId:"navigationTreeId"}},getNavigationEntryById:{name:"getNavigationEntryById",parameters:{id:"id"}},getNavigationEntryByPageId:{name:"getNavigationEntryByPageId",parameters:{pageId:"pageId"}}},t.expandables={substateOfId:"substateOfId"},t}(o.BaseCollection),J=function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){e(t,n);function i(){this.constructor=t}t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),Y=function(e){J(t,e);function t(){return e.call(this)||this}return t}(Q),H=function(e,t,n,i){var o,r=arguments.length,a=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(r<3?o(a):r>3?o(t,n,a):o(t,n))||a);return r>3&&a&&Object.defineProperty(t,n,a),a},$=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},W=function(){function e(){}return e.instance=function(){return o.IOC.get("navigationTreeService")},e.prototype.getCollection=function(){return this.collectionsService.getCollectionByName("navigationtrees")},e.prototype.getNavigationTree=function(e,t){return o.QueryObjectBuilder.create({identifier:e.identifier},"getNavigationTree",t,e,{},this.getCollection())},e.prototype.getNavigationTreeById=function(e,t){return o.QueryObjectBuilder.create({_id:e.id},"getNavigationTreeById",t,e,{},this.getCollection())},e.prototype.getNavigationTreesByIds=function(e,t){return o.QueryObjectBuilder.create({_id:{$in:e.ids}},"getNavigationTreesByIds",t,e,{},this.getCollection())},e.prototype.getNavigationTreesForTag=function(e,t){return o.QueryObjectBuilder.create({tags:e.tag},"getNavigationTreesForTag",t,e,{},this.getCollection())},e.prototype.save=function(e){return this.getCollection().getMongoDBCollection().insert(e.toDocument())},e.prototype.update=function(e){var t=e.toDocument("id");return this.getCollection().getMongoDBCollection().update(t.id,{$set:{i18nKey:t.i18nKey,identifier:t.identifier,icon:t.icon,index:t.index,tags:t.tags}})},e.prototype.delete=function(e){return this.getCollection().getMongoDBCollection().remove(e.id)},H([o.Autowired(),$("design:type",Object)],e.prototype,"collectionsService",void 0),H([o.Autowired(),$("design:type",Object)],e.prototype,"dataBridge",void 0),e}(),Z=function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){e(t,n);function i(){this.constructor=t}t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),X=function(e){Z(t,e);function t(){return null!==e&&e.apply(this,arguments)||this}return t}(W),ee=function(e,t,n,i){var o,r=arguments.length,a=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(r<3?o(a):r>3?o(t,n,a):o(t,n))||a);return r>3&&a&&Object.defineProperty(t,n,a),a},te=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},ne=function(){function e(){this.index=0,this.tags=[],this._hasSubDocuments=!1,this._isStored=!1}return e.fromDocument=function(e){if(void 0===e||null===e)throw new Error("doc cannot be undefined/null while calling GeneratedNavigationTree.fromDocument(doc)!");var t=new(this.getModelClass());return void 0!==e._id&&(t._isStored=!0,t.id=e._id),void 0!==e.i18nKey&&(t.i18nKey=e.i18nKey),void 0!==e.identifier&&(t.identifier=e.identifier),void 0!==e.icon&&(t.icon=e.icon),void 0!==e.index&&(t.index=e.index),void 0!==e.tags&&(t.tags=e.tags),t},e.prototype.toDocument=function(e){void 0===e&&(e="_id");var t={};return t.i18nKey=this.i18nKey,t.identifier=this.identifier,t.icon=this.icon,t.index=this.index,t.tags=this.tags,this.id&&(t[e]=this.id),JSON.parse(JSON.stringify(t))},e.prototype.clone=function(){return oe.fromDocument(this.toDocument())},e.prototype.saveSnapshot=function(){this._snapshot=this.toDocument()},e.prototype.restoreSnapshot=function(){if(!this._snapshot)throw new Error("Could not restore snapshot of model since no snapshot was saved before!");t.extend(this,this._snapshot)},e.prototype.hasSubDocuments=function(){return this._hasSubDocuments},e.prototype.isStored=function(){return this._isStored},e.getModelName=function(){return"NavigationTree"},e.prototype.getModelName=function(){return"NavigationTree"},e.prototype.getForeignLabel=function(){return this.getModelName()+" ID:"+this.id},e.getModelClass=function(){return o.IOC.get("NavigationTree")},e.prototype.getModelClass=function(){return o.IOC.get("NavigationTree")},e.prototype.delete=function(){return X.instance().delete(this)},e.prototype.update=function(){return X.instance().update(this)},e.prototype.save=function(){return X.instance().save(this)},e.asType=function(){return o.Type.fromDocument({collection:{name:"navigationtrees"},service:{name:"NavigationTreeService",queries:[{name:"getNavigationTree",selector:{identifier:":identifier:string"}},{name:"getNavigationTreeById",selector:{_id:":id:string"}},{name:"getNavigationTreesByIds",selector:{_id:{$in:":ids:string[]"}}},{name:"getNavigationTreesForTag",selector:{tags:":tag:string"}}]},model:{name:"NavigationTree",schema:[{name:"i18nKey",type:"string"},{name:"identifier",type:"string",optional:!0},{name:"icon",type:"string",optional:!0},{name:"index",type:"number",optional:!0,defaultValue:0},{name:"tags",type:"string[]",optional:!0,defaultValue:[]}]},packageName:"@smallstack/common"})},ee([o.Autowired(),te("design:type",Object)],e.prototype,"dataBridge",void 0),e}(),ie=function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){e(t,n);function i(){this.constructor=t}t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),oe=function(e){ie(t,e);function t(){return null!==e&&e.apply(this,arguments)||this}return t}(ne),re=function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){e(t,n);function i(){this.constructor=t}t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),ae=function(e){re(t,e);function t(){var t=e.call(this)||this;return t.createMongoDBCollection(),t.applyAllowDenyRules(),t.createPublications(),t}return t.prototype.createPublications=function(){this.dataBridge.isServer()&&(this.collectionsService.addPublisher("navigationtrees","getNavigationTree",{identifier:":identifier:string"},{}),this.collectionsService.addPublisher("navigationtrees","getNavigationTreeById",{_id:":id:string"},{}),this.collectionsService.addPublisher("navigationtrees","getNavigationTreesByIds",{_id:{$in:":ids:string[]"}},{}),this.collectionsService.addPublisher("navigationtrees","getNavigationTreesForTag",{tags:":tag:string"},{}))},t.prototype.createMongoDBCollection=function(){this.mongoDBCollection=this.collectionsService.createMongoDBCollection("navigationtrees",function(e){return oe.fromDocument(e)}),this.collectionsService.registerCollection("navigationtrees",this)},t.prototype.applyAllowDenyRules=function(){var e=this.getMongoDBCollectionAllowRules(),t=this.getMongoDBCollectionDenyRules();e&&this.mongoDBCollection.allow(e),t&&this.mongoDBCollection.deny(t)},t.prototype.getMongoDBCollectionAllowRules=function(){},t.prototype.getMongoDBCollectionDenyRules=function(){return{insert:function(e,t){return!1},update:function(e,t,n,i){return!1},remove:function(e,t){return!1}}},t.prototype.getForeignCollection=function(e){},t.prototype.getCollectionName=function(){return t.COLLECTION_NAME},t.getCollection=function(){return o.IOC.get("collectionsService").getCollectionByName(t.COLLECTION_NAME)},t.COLLECTION_NAME="navigationtrees",t.queries={getNavigationTree:{name:"getNavigationTree",parameters:{identifier:"identifier"}},getNavigationTreeById:{name:"getNavigationTreeById",parameters:{id:"id"}},getNavigationTreesByIds:{name:"getNavigationTreesByIds",parameters:{ids:"ids"}},getNavigationTreesForTag:{name:"getNavigationTreesForTag",parameters:{tag:"tag"}}},t.expandables={},t}(o.BaseCollection),se=function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){e(t,n);function i(){this.constructor=t}t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),ce=function(e){se(t,e);function t(){return e.call(this)||this}return t}(ae);a.register("QueryObject",P),e.InitLevelService=u,e.IOC=a,e.Autowired=l,e.Logger=r,e.Utils=g,e.FrontendError=d,e.FrontendErrorRegistry=y,e.InMemoryConfigurationService=h,e.ConsoleNotifier=v,e.GoogleAnalyticsService=N,e.BaseCollection=_,e.CollectionAccessService=T,e.QueryObjectBuilder=I,e.DefaultQueryObject=P,e.QueryUtils=B,e.Type=D,e.Typesystem=w,e.TypesystemUtils=k,e.initializeTypesystem=function(e){o.IOC.onRegister("typesystem",function(t){t.addType(o.Type.fromDocument({collection:{name:"navigation"},service:{name:"NavigationService",queries:[{name:"getNavigationForType",selector:{type:":type:string"}},{name:"getNavigationForTreeId",selector:{navigationTreeId:":navigationTreeId:string"}},{name:"getNavigationEntryById",selector:{_id:":id:string"}},{name:"getNavigationEntryByPageId",selector:{pageId:":pageId:string"}}]},model:{name:"NavigationEntry",schema:[{name:"i18nKey",type:"string",optional:!0},{name:"icon",type:"string",optional:!0},{name:"route",type:"string"},{name:"navigationTreeIdentifier",type:"string",optional:!0},{name:"requiresAuthentication",type:"boolean",defaultValue:!0,optional:!0},{name:"loginRoute",type:"string",optional:!0},{name:"requiredRole",type:"string",optional:!0},{name:"visibility",type:"string",allowedValues:["alwaysVisible","alwaysHidden","onlyAnonymous","onlyAuthenticated"],defaultValue:"alwaysVisible",optional:!0},{name:"index",type:"number",optional:!0},{name:"stateName",type:"string",optional:!0},{name:"abstract",type:"boolean",optional:!0,defaultValue:!1},{name:"defaultRoute",type:"boolean",optional:!0,defaultValue:!1},{name:"substateOfId",type:"foreign",foreignType:"NavigationEntry",optional:!0},{name:"badge",type:"number",optional:!0},{name:"trackingEnabled",type:"boolean",defaultValue:!0,optional:!0},{name:"redirectTo",type:"string",optional:!0}]},packageName:"@smallstack/common"})),t.addType(o.Type.fromDocument({collection:{name:"navigationtrees"},service:{name:"NavigationTreeService",queries:[{name:"getNavigationTree",selector:{identifier:":identifier:string"}},{name:"getNavigationTreeById",selector:{_id:":id:string"}},{name:"getNavigationTreesByIds",selector:{_id:{$in:":ids:string[]"}}},{name:"getNavigationTreesForTag",selector:{tags:":tag:string"}}]},model:{name:"NavigationTree",schema:[{name:"i18nKey",type:"string"},{name:"identifier",type:"string",optional:!0},{name:"icon",type:"string",optional:!0},{name:"index",type:"number",optional:!0,defaultValue:0},{name:"tags",type:"string[]",optional:!0,defaultValue:[]}]},packageName:"@smallstack/common"})),o.IOC.register("NavigationEntry",K),o.IOC.register("NavigationTree",oe),void 0!==e&&void 0!==e.withCollections&&!0!==e.withCollections||(o.IOC.register("navigationCollection",new Y),o.IOC.register("navigationtreesCollection",new ce)),o.IOC.register("navigationService",new q),o.IOC.register("navigationTreeService",new X)})},e.NavigationEntry=K,e.NavigationService=q,e.NavigationCollection=Y,e.NavigationTree=oe,e.NavigationTreeService=X,e.NavigationtreesCollection=ce,Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("underscore"),require("window-or-global"),require("pluralize")):"function"==typeof define&&define.amd?define(["exports","underscore","window-or-global","pluralize"],t):t(e["@smallstack/common"]={},e._,e.root,e.pluralize)}(this,function(e,t,n,i){"use strict";n=n&&n.hasOwnProperty("default")?n.default:n,i=i&&i.hasOwnProperty("default")?i.default:i;var o,r=function(){function e(){}return e.log=function(e,t,n,i){if(this.loggingModule(e,t)){t.length>this.loggerMaxLength&&(this.loggerMaxLength=t.length);var o=this.loggerMaxLength-t.length;if(o>0)for(var r=0;r<o;r++)t+=" ";var a="debug"===e?"log":e;"undefined"!=typeof console&&"function"==typeof console[a]&&(i?console[a](t+" "+n,i):console[a](t+" "+n))}},e.info=function(e,t,n){this.log("info",e,t,n)},e.warning=function(e,t,n){this.log("warn",e,t,n)},e.error=function(e,t,n){this.log("error",e,t,n)},e.debug=function(e,t,n){this.log("debug",e,t,n)},e.loggingModule=function(e,t){return!!this.debugMode||("debug"!==e||-1!==this.debugModules.indexOf(t))},e.printSmallstackLogo=function(){console.log(" "),console.log(" _ _ _ _ "),console.log(" ___ _ __ ___ __ _ | || | ___ | |_ __ _ ___ | | __"),console.log("/ __|| '_ ` _ \\ / _` || || |/ __|| __| / _` | / __|| |/ /"),console.log("\\__ \\| | | | | || (_| || || |\\__ \\| |_ | (_| || (__ | < "),console.log("|___/|_| |_| |_| \\__,_||_||_||___/ \\__| \\__,_| \\___||_|\\_\\"),console.log("visit us on https://smallstack.io!"),console.log(" ")},e.addDebugModule=function(e){this.debugModules.push(e)},e.debugMode=!1,e.loggerMaxLength=24,e.debugModules=[],e}(),a=function(){function e(e){void 0===e&&(e=!1);var n=this;this.container={},this.onRegisterCallbacks={},this.id=t.random(0,99999).toString(),e&&setTimeout(function(){var e="";t.each(n.onRegisterCallbacks,function(t,i){n.container[i]||(""!==e&&(e+=", "),e+=i)}),""!==e&&r.error("IOC","After 10s the following references could not be resolved : "+e,n.id)},1e4)}return e.prototype.register=function(e,n,i){if(void 0===i&&(i=!1),!this.container[e]||i)return this.container[e]=n,r.debug("IOC","registered Object with ID: "+e+", Type:"+typeof n,this.id),this.onRegisterCallbacks[e]&&(t.each(this.onRegisterCallbacks[e],function(e){e.callback(n)}),this.onRegisterCallbacks[e]=t.reject(this.onRegisterCallbacks[e],function(e){return!0===e.callOnlyOnce})),n;r.debug("IOC","Ignoring re-registering of "+e+" since there is already an instance!",this.id)},e.register=function(t,n,i){return void 0===i&&(i=!1),e.instance().register(t,n,i)},e.prototype.get=function(e){if(this.isRegistered(e))return this.container[e];throw new Error("Could not find an ioc instance for id : '"+e+"'!")},e.get=function(t){return e.instance().get(t)},e.prototype.isRegistered=function(e){return void 0!==this.container[e]},e.isRegistered=function(t){return e.instance().isRegistered(t)},e.instance=function(){return void 0===n.smallstack_ioc&&(n.smallstack_ioc=new e),n.smallstack_ioc},e.prototype.onRegister=function(e,t,n){void 0===n&&(n=!1),this.isRegistered(e)&&t(this.get(e)),this.onRegisterCallbacks[e]||(this.onRegisterCallbacks[e]=[]),this.onRegisterCallbacks[e].push({callback:t,callOnlyOnce:n})},e.onRegister=function(t,n,i){void 0===i&&(i=!1),e.instance().onRegister(t,n,i)},e.prototype.getIOCID=function(){return this.id},e.prototype.clear=function(){this.container=[],this.onRegisterCallbacks={}},e.clear=function(){e.instance().clear()},e}(),s=function(e,t,n,i){return new(n||(n=Promise))(function(o,r){function a(e){try{c(i.next(e))}catch(e){r(e)}}function s(e){try{c(i.throw(e))}catch(e){r(e)}}function c(e){e.done?o(e.value):new n(function(t){t(e.value)}).then(a,s)}c((i=i.apply(e,t||[])).next())})},c=function(e,t){var n,i,o,r,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return r={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function s(r){return function(s){return function(r){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,i&&(o=i[2&r[0]?"return":r[0]?"throw":"next"])&&!(o=o.call(i,r[1])).done)return o;switch(i=0,o&&(r=[0,o.value]),r[0]){case 0:case 1:o=r;break;case 4:return a.label++,{value:r[1],done:!1};case 5:a.label++,i=r[1],r=[0];continue;case 7:r=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===r[0]||2===r[0])){a=0;continue}if(3===r[0]&&(!o||r[1]>o[0]&&r[1]<o[3])){a.label=r[1];break}if(6===r[0]&&a.label<o[1]){a.label=o[1],o=r;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(r);break}o[2]&&a.ops.pop(),a.trys.pop();continue}r=t.call(e,a)}catch(e){r=[6,e],i=0}finally{n=o=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}([r,s])}}},u=function(){function e(){this.initLevels={}}return e.instance=function(){return a.get("initLevelService")},e.prototype.addInitLevelFn=function(e){if("function"!=typeof e.fn)throw new Error("No fn set for init level function: "+JSON.stringify(e));if("string"!=typeof e.identifier||""===e.identifier)throw new Error("No identifier set for init level function: "+JSON.stringify(e));if(void 0===e.level&&(e.level=50),void 0!==e.stopOnFailure&&"boolean"==typeof e.stopOnFailure||(e.stopOnFailure=!0),e.level<0||e.level>100)throw new Error("InitLevel should be between 0 and 100 (both inclusive): "+JSON.stringify(e));void 0===this.initLevels[e.level]&&(this.initLevels[e.level]=[]),r.debug("InitLevelService","Added '"+e.identifier+"' on init level "+e.level),this.initLevels[e.level].push(e)},e.prototype.execute=function(){return s(this,void 0,void 0,function(){var e,t,n,i,o;return c(this,function(a){switch(a.label){case 0:e=0,a.label=1;case 1:if(!(e<=100))return[3,8];if(!this.initLevels[e])return[3,7];t=0,n=this.initLevels[e],a.label=2;case 2:if(!(t<n.length))return[3,7];i=n[t],r.debug("InitLevelService","Executing '"+i.identifier+"'!"),a.label=3;case 3:return a.trys.push([3,5,,6]),[4,i.fn()];case 4:return a.sent(),[3,6];case 5:if(o=a.sent(),i.stopOnFailure)throw r.error("InitLevelService","Execution of '"+i.identifier+"' failed! InitLevel execution will stop!"),o;return r.warning("InitLevelService","Execution of '"+i.identifier+"' failed! InitLevel execution continuing due stopOnFailure === false!"),[3,6];case 6:return t++,[3,2];case 7:return e++,[3,1];case 8:return[2]}})})},e}();function l(e){if("string"==typeof e)throw new Error("Passing a string is deprecated, please pass an object instead!");return function(t,n){var i=e&&void 0!==e.name?e.name:n;e&&void 0!==e.lazyLoading&&!0!==e.lazyLoading?a.isRegistered(i)?t[n]=a.get(i):r.debug("Autowired","Could not autowire dependency '"+i+"'",{target:t,decoratedPropertyName:n}):a.onRegister(i,function(e){t[n]=e})}}(o=e.PadDirection||(e.PadDirection={}))[o.RIGHT=0]="RIGHT",o[o.LEFT=1]="LEFT";var p,g,f,d,y,h,v,m,b,N=function(){function n(){}return n.isNonEmptyString=function(e){return t.isString(e)&&!t.isUndefined(e)&&!t.isEmpty(e)&&null!=e},n.isEmptyString=function(e){return!n.isNonEmptyString(e)},n.stringEndsWith=function(e,t){return-1!==e.indexOf(t,e.length-t.length)},n.dasherize=function(e){return e.replace(/[A-Z]/g,function(e,t){return(0!==t?"-":"")+e.toLowerCase()})},n.decapitalize=function(e){return e.charAt(0).toLowerCase()+e.slice(1)},n.capitalize=function(e){return e.charAt(0).toUpperCase()+e.slice(1)},n.spaceBeforeUppercase=function(e){return e.replace(/([A-Z])/g," $1").trim()},n.padString=function(t,n,i,o){void 0===i&&(i=e.PadDirection.LEFT),void 0===o&&(o=" "),length=t.length;var r=length-t.length;switch(o.length>1&&(o=o.charAt(0)),i){case e.PadDirection.RIGHT:for(var a=0;a<r;a++)t+=o;return t;default:for(a=0;a<r;a++)t=o+t;return t}},n.isMobile=function(){var e=navigator.userAgent||navigator.vendor||window.opera;return!(!/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(e)&&!/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(e.substr(0,4)))},n.getUrlParameterByName=function(e,t){e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var n=new RegExp("[\\?&]"+e+"=([^&#]*)").exec(t);return null===n?void 0:decodeURIComponent(n[1].replace(/\+/g," "))},n.check=function(e,t,n,i){return r.debug("Utils","Utils.check is deprecated in favor of Utils.typeOfCheck!"),this.typeOfCheck(e,t,n,i)},n.typeOfCheck=function(e,t,n,i){if(typeof e!==t){var o=new Error(n+" is not of type "+t+", rather of type : "+typeof e);throw i&&i(o),o}},n.createUrlConformIdFromInput=function(e,t){return void 0===e?"":(e=(e=(e=(e=(e=(e=e.replace(/[üÜ]/g,"ue")).replace(/[äÄ]/g,"ae")).replace(/[öÖ]/g,"oe")).replace(/[ß]/g,"ss")).replace(/ /g,"_")).replace(/[^a-zA-Z0-9\_\-]/g,"").toLowerCase(),t?e.substring(0,t):e)},n.isValidEmail=function(e){return/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(e)},n.unflattenJSON=function(e){if(Object(e)!==e||Array.isArray(e))return e;var t=/\.?([^.\[\]]+)|\[(\d+)\]/g,n={};for(var i in e)if(e.hasOwnProperty(i)){for(var o=n,r="",a=void 0;a=t.exec(i);)o=o[r]||(o[r]=a[2]?[]:{}),r=a[2]||a[1];o[r]=e[i]}return n[""]||n},n.flattenJSON=function(e,t){void 0===t&&(t=!0);var n={};return function e(i,o){if(Object(i)!==i)n[o]=i;else if(Array.isArray(i))if(t){for(var r=0,a=i.length;r<a;r++)e(i[r],o+"["+r+"]");0===i.length&&(n[o]=[])}else n[o]=i;else{var s=!0;for(var c in i)i.hasOwnProperty(c)&&(s=!1,e(i[c],o?o+"."+c:c));s&&o&&(n[o]={})}}(e,""),n},n.prettyPrintJson=function(e,n){if(void 0===e)return"-";var i=e;return t.isObject(e)&&(i=JSON.stringify(e,void 0,4)),n&&i.length>n?i.substring(0,n-6)+" (...)":i},n.convertHexToRGB=function(e){if(6!==(e=e.replace("#","")).length)throw new Error("Please provide hex colors in 6-digit format!");return{r:parseInt(e.substring(0,2),16),g:parseInt(e.substring(2,4),16),b:parseInt(e.substring(4,6),16)}},n.isValidUrlName=function(e){return/\b((?=[a-z0-9-]{1,63}\.)(xn--)?[a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,63}\b/.test(e)},n.dataURLtoBlob=function(e){for(var t=e.split(","),n=t[0].match(/:(.*?);/)[1],i=atob(t[1]),o=i.length,r=new Uint8Array(o);o--;)r[o]=i.charCodeAt(o);return new Blob([r],{type:n})},n.blobToDataURL=function(e,t){var n=new FileReader;n.onload=function(e){t(e.target.result)},n.readAsDataURL(e)},n.blobToArrayBuffer=function(e,t){var n=new FileReader;n.onload=function(){t(this.result)},n.readAsArrayBuffer(e)},n.dataUrlToBuffer=function(e,t){this.blobToArrayBuffer(this.dataURLtoBlob(e),t)},n.imageUrlToBlob=function(e,t){var n=new Image;n.onerror=function(){r.error("Utils","Could not convert url to blob: ",e)},n.onload=function(){var e=document.createElement("canvas");e.width=this.width,e.height=this.height,e.getContext("2d").drawImage(this,0,0),e.toBlob(function(e){t(e)})},n.src=e},n.getApiURL=function(e,t){return e+"/"+n.decapitalize(t.replace("get","")).toLowerCase()},n}(),w=(p=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}p(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),C=function(e){function t(t,n){var i=this;return"string"==typeof t?(i=e.call(this,t)||this).i18nKey=t:((i=e.call(this,t.i18nKey)||this).i18nKey=t.i18nKey,i.supportCode=t.supportCode,i.internalDescription=t.internalDescription),i.context=n,i}return w(t,e),t.prototype.setContext=function(e){return this.context=e,this},t}(Error),_=function(){function e(){this.errors={}}return e.instance=function(){return a.get("frontendErrorRegistry")},e.prototype.addCollection=function(e){for(var n=0,i=t.values(e);n<i.length;n++){var o=i[n];this.add(o)}},e.prototype.add=function(e){if("string"!=typeof e.supportCode||""===e.supportCode)throw new Error("Please provide a support code while adding frontend errors!");this.errors[e.supportCode]=new C(e)},e.prototype.getAllFrontendErrors=function(){return t.values(this.errors)},e}(),O=function(){function e(){this.configuration={},this.onSetCallbacks={}}return e.prototype.set=function(e,t,n){this.configuration[e]={key:e,value:t,scope:n}},e.prototype.unset=function(e){delete this.configuration[e]},e.prototype.get=function(e,t){return this.contains(e)?this.configuration[e].value:t},e.prototype.onSet=function(e,t){void 0===this.onSetCallbacks[e]&&(this.onSetCallbacks[e]=[]),this.onSetCallbacks[e].push(t)},e.prototype.contains=function(e){return void 0!==this.configuration[e]},e}(),T=function(){function e(){}return e.prototype.log=function(e,t,n){switch(n){case"debug":console.debug(e+" - "+t);break;case"error":console.error(e+" - "+t);break;case"warn":console.warn(e+" - "+t);break;case"info":case"success":default:console.log(e+" - "+t)}},e.prototype.info=function(e,t){this.log(e,t,"info")},e.prototype.success=function(e,t){this.log(e,t,"success")},e.prototype.debug=function(e,t){this.log(e,t,"debug")},e.prototype.warn=function(e,t){this.log(e,t,"warn")},e.prototype.error=function(e,t){this.log(e,t,"error")},e.prototype.confirmation=function(e,t,n){throw new Error("Console Notifier cannot ask questions!")},e}(),S=function(e,t,n,i){var o,r=arguments.length,a=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(r<3?o(a):r>3?o(t,n,a):o(t,n))||a);return r>3&&a&&Object.defineProperty(t,n,a),a},R=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},E=function(){function e(e){var t=this;e&&this.loadGA(e),a.onRegister("configurationService",function(e){e.onSet("googleanalytics.trackingid",function(e){t.loadGA(e)})})}return e.prototype.track=function(e,t){"undefined"==typeof ga?r.debug("GoogleAnalyticsService","ga not loaded!"):ga(function(t){void 0===t?r.debug("GoogleAnalyticsService","No GA Tracker defined yet!"):(r.debug("GoogleAnalyticsService","Sending GA tracking for path : ",e),ga("send","pageview",e))})},e.prototype.event=function(e,t){t||(t={}),t.category||(t.category="default"),"undefined"==typeof ga?r.debug("GoogleAnalyticsService","ga not loaded!"):ga(function(n){void 0===n?r.debug("GoogleAnalyticsService","No GA Tracker defined yet!"):(r.debug("GoogleAnalyticsService","Sending GA event for eventname : ",e),ga("send","event",t.category,e,t.label,t.value))})},e.prototype.loadGA=function(e){var t,n,i,o,a;void 0!==e&&(t=window,n=document,i="ga",t.GoogleAnalyticsObject=i,t.ga=t.ga||function(){(t.ga.q=t.ga.q||[]).push(arguments)},t.ga.l=(new Date).getTime(),o=n.createElement("script"),a=n.getElementsByTagName("script")[0],o.async=1,o.src="https://www.google-analytics.com/analytics.js",a.parentNode.insertBefore(o,a),ga("create",e,"auto"),ga("send","pageview"),r.debug("GoogleAnalyticsService","Successfully initialized ga object!"))},S([l(),R("design:type",Object)],e.prototype,"dataBridge",void 0),e}(),I=function(){function e(){this.types={},this.afterTypeAddedCallbacks=[]}return e.instance=function(){return a.get("typesystem")},e.prototype.addType=function(e){r.debug("Typesystem","Adding type '"+e.getModelName()+"'!"),this.types[e.getModelName()]=e,t.each(this.afterTypeAddedCallbacks,function(t){t(e)})},e.prototype.afterTypeAdded=function(e){this.afterTypeAddedCallbacks.push(e)},e.prototype.getTypeByModelName=function(e){return t.find(this.types,function(t){if(-1!==e.indexOf("::")){var n=e.split("::");return t.model&&t.packageName===n[0]&&t.model.name===n[1]}return t.model&&t.model.name===e})},e.prototype.getTypeByCollectionName=function(e){return t.find(this.types,function(t){return t.collection&&t.collection.name===e})},e.prototype.getAllTypes=function(){return t.values(this.types)},e.prototype.getTypeByServiceName=function(e){return t.find(this.types,function(t){return void 0!==t.service&&t.service.name===e})},e.prototype.getCollectionNameForServiceName=function(e){var t=this.getTypeByServiceName(N.capitalize(e));if(t&&t.collection)return t.collection.name},e}(),A=function(e,t,n,i){var o,r=arguments.length,a=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(r<3?o(a):r>3?o(t,n,a):o(t,n))||a);return r>3&&a&&Object.defineProperty(t,n,a),a},P=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},B=function(){function e(){}return e.prototype.subscribe=function(e,t,n){var i=this;return new Promise(function(o,a){r.debug("Collection","Subscribing to "+e),i.dataBridge.ddpSubscribe(e,t,n,{onStop:function(t){t?a(t):r.debug("Collection","Successfully stopped subscription to "+i.getCollectionName()+"->"+e)},onError:function(t){a(t||new Error("An unknown error occured while subscribing to : "+i.getCollectionName()+"->"+e))},onReady:function(){o()}})})},e.prototype.syncViaJSONAPI=function(e,n){var i=this;return new Promise(function(o,a){var s=void 0!==n&&n.headers?n.headers:{};n&&!0===n.auth&&(s["x-smallstack-token"]=i.tokenService.getLoginToken()),i.dataBridge.httpCall("GET",e,{headers:s}).then(function(e){r.debug("Collection","Syncing models: ",e),t.each(e,function(e){e.id&&!e._id&&(e._id=e.id,delete e.id),r.debug("Collection","Syncing model: ",JSON.stringify(e)),i.mongoDBCollection.upsert({_id:e._id},e)}),o()}).catch(function(e){a(e)})})},e.prototype.subscribeForeignKeys=function(e,t){return this.collectionsService.subscribeForeignKeys(this,e,t)},e.prototype.getQueryCount=function(e,t){return this.dataBridge.ddpCall("server-counts",{queryName:e,parameters:t})},e.prototype.getMongoDBCollection=function(){return this.mongoDBCollection},e.prototype.applyAllowDenyRules=function(){var e=this.getMongoDBCollectionAllowRules(),t=this.getMongoDBCollectionDenyRules();e&&this.mongoDBCollection.allow(e),t&&this.mongoDBCollection.deny(t)},e.prototype.getMongoDBCollectionAllowRules=function(){},e.prototype.getMongoDBCollectionDenyRules=function(){return{insert:function(e,t){return!1},update:function(e,t,n,i){return!1},remove:function(e,t){return!1}}},A([l(),P("design:type",Object)],e.prototype,"collectionsService",void 0),A([l(),P("design:type",I)],e.prototype,"typesystem",void 0),A([l(),P("design:type",Object)],e.prototype,"dataBridge",void 0),A([l(),P("design:type",Object)],e.prototype,"tokenService",void 0),e}(),D=function(){function e(){this.publisherMethods={}}return e.instance=function(){return a.get("collectionAccessService")},e.prototype.checkAccess=function(e,n,i){var o=this;if(void 0!==e.access){var r={context:n,parameters:i,accessObject:e.access};switch(typeof e.access){case"string":return[this.executePublisherMethod(e.access,r)];case"object":var a=[];return t.each(e.access,function(e,t){a.push(o.executePublisherMethod(t,r))}),a;default:throw new Error("Type of query.access: '"+typeof e.access+"' is not allowed!")}}},e.prototype.addPublisherMethod=function(e,t){this.publisherMethods[e]=t},e.prototype.executePublisherMethod=function(e,t){var n=this.publisherMethods[e];if(!n)throw new Error("Publication method '"+e+"' could not be found!");var i=n(t);if("boolean"===i.type&&!1===i.value)throw new Error("Access restricted by '"+e+"'!");return i},e.prototype.getAccessMethod=function(e){return this.publisherMethods[e]},e.prototype.publisherMethodAvailable=function(e){return void 0!==this.publisherMethods[e]},e}(),k=function(){function e(){}return e.create=function(e,t,n,i,o,r){return(new(a.get("QueryObject"))).create(e,t,n,i,o,r)},e}(),x=function(e,t,n,i){var o,r=arguments.length,a=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(r<3?o(a):r>3?o(t,n,a):o(t,n))||a);return r>3&&a&&Object.defineProperty(t,n,a),a},M=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},j=function(e,t,n,i){return new(n||(n=Promise))(function(o,r){function a(e){try{c(i.next(e))}catch(e){r(e)}}function s(e){try{c(i.throw(e))}catch(e){r(e)}}function c(e){e.done?o(e.value):new n(function(t){t(e.value)}).then(a,s)}c((i=i.apply(e,t||[])).next())})},L=function(e,t){var n,i,o,r,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return r={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function s(r){return function(s){return function(r){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,i&&(o=i[2&r[0]?"return":r[0]?"throw":"next"])&&!(o=o.call(i,r[1])).done)return o;switch(i=0,o&&(r=[0,o.value]),r[0]){case 0:case 1:o=r;break;case 4:return a.label++,{value:r[1],done:!1};case 5:a.label++,i=r[1],r=[0];continue;case 7:r=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===r[0]||2===r[0])){a=0;continue}if(3===r[0]&&(!o||r[1]>o[0]&&r[1]<o[3])){a.label=r[1];break}if(6===r[0]&&a.label<o[1]){a.label=o[1],o=r;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(r);break}o[2]&&a.ops.pop(),a.trys.pop();continue}r=t.call(e,a)}catch(e){r=[6,e],i=0}finally{n=o=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}([r,s])}}},q=function(){function e(){this.isSubscribed=!1}return e.prototype.create=function(e,t,n,i,o,r){this.queryOptions=n||{},this.queryOptions.currentPage=this.queryOptions.currentPage||1,this.queryOptions.entriesPerPage=this.queryOptions.entriesPerPage||10,this.sorting=o,this.subscriptionName=t,this.selector=e,this.parameters=i,this.collection=r;var a=this.collection.getCollectionName(),s=this.typesystem.getTypeByCollectionName(a);if(void 0===s)throw new Error("Could not find type by collectionName '"+a+"'!");return this.ModelConstructor=s.getModel(),this},e.prototype.getSelector=function(){return this.selector},e.prototype.getCursor=function(){return this.collection.getMongoDBCollection().find(this.selector,this.convertQueryOptionsToMongoSelector(this.queryOptions,this.sorting))},e.prototype.convertQueryOptionsToMongoSelector=function(e,t,n){void 0===n&&(n=!0);var i={sort:t,reactive:e&&!0===e.reactive};return n?(e&&e.currentPage&&e.entriesPerPage&&(i.skip=(e.currentPage-1)*e.entriesPerPage),e&&e.entriesPerPage&&(i.limit=e.entriesPerPage)):(i.skip=0,e&&e.entriesPerPage&&(i.limit=e.currentPage*e.entriesPerPage)),i},e.prototype.getModels=function(){return this.cursorResolver.resolve(this.getCursor(),{ModelConstructor:this.ModelConstructor})},e.prototype.getModel=function(e){var t=this;return new Promise(function(n){return j(t,void 0,void 0,function(){var t;return L(this,function(i){switch(i.label){case 0:return[4,this.getModels()];case 1:return t=i.sent(),n(t[e]),[2]}})})})},e.prototype.subscribe=function(){var e=this;return new Promise(function(t,n){return j(e,void 0,void 0,function(){var e;return L(this,function(n){switch(n.label){case 0:return r.debug("QueryObject","Subscribing to '"+this.subscriptionName+"'!"),[4,this.collection.subscribe(this.subscriptionName,this.parameters,this.convertQueryOptionsToMongoSelector(this.queryOptions,this.sorting,!1))];case 1:return n.sent(),this.isSubscribed=!0,e=this,[4,this.collection.getQueryCount(this.subscriptionName,this.parameters)];case 2:return e.totalCount=n.sent(),t(this),[2]}})})})},e.prototype.syncViaJSONAPI=function(e){var n=this;return new Promise(function(i,o){var a=n.typesystem.getTypeByCollectionName(n.collection.getCollectionName()).getServiceQueryByName(n.subscriptionName);if(void 0===a)o("Could not find TypeServiceQuery for collection "+n.collection.getCollectionName()+" and serviceQuery "+n.subscriptionName);else{var s=n.configurationService.get("smallstack.api.url");if(s){N.stringEndsWith(s,"/")||(s+="/");var c=s+N.getApiURL(n.collection.getCollectionName(),n.subscriptionName);c=c+"?currentPage="+n.queryOptions.currentPage+"&entriesPerPage="+n.queryOptions.entriesPerPage,t.each(n.parameters,function(e,t){e instanceof Array&&(e=JSON.stringify(e)),c+="&"+t+"="+e}),void 0===a.api?o("API Endpoint "+c+" does not exist!"):(r.info("QueryObject","Querying "+c),n.collection.syncViaJSONAPI(c,e).then(function(e){return i(n)}).catch(function(e){return o(e)}))}else o("No smallstack.api.url configuration set! Can't call JSON API!")}})},e.prototype.expand=function(e){return e instanceof Array&&e.length>0?this.collection.subscribeForeignKeys(this.getCursor(),e):Promise.resolve()},e.prototype.getCount=function(){return this.collection.getQueryCount(this.subscriptionName,this.parameters)},e.prototype.getPage=function(e){var t=this;return new Promise(function(n,i){return j(t,void 0,void 0,function(){return L(this,function(t){switch(t.label){case 0:return[4,this.subscribe()];case 1:return t.sent(),this.queryOptions.currentPage=e,n(this.getModels()),[2]}})})})},e.prototype.getNextPage=function(){var e=this;return new Promise(function(t,n){return j(e,void 0,void 0,function(){var e;return L(this,function(i){switch(i.label){case 0:return this.hasNextPage()?(this.queryOptions.currentPage++,[4,this.subscribe()]):[3,3];case 1:return i.sent(),e=t,[4,this.getModels()];case 2:return e.apply(void 0,[i.sent()]),[3,4];case 3:n("No next page available!"),i.label=4;case 4:return[2]}})})})},e.prototype.getCurrentPage=function(){var e=this;return new Promise(function(t,n){return j(e,void 0,void 0,function(){var e;return L(this,function(n){switch(n.label){case 0:return[4,this.subscribe()];case 1:return n.sent(),e=t,[4,this.getModels()];case 2:return e.apply(void 0,[n.sent()]),[2]}})})})},e.prototype.getPreviousPage=function(){var e=this;return new Promise(function(t,n){return j(e,void 0,void 0,function(){var e;return L(this,function(i){switch(i.label){case 0:return this.hasPreviousPage()?(this.queryOptions.currentPage--,[4,this.subscribe()]):[3,3];case 1:return i.sent(),e=t,[4,this.getModels()];case 2:return e.apply(void 0,[i.sent()]),[3,4];case 3:n("No previous page available!"),i.label=4;case 4:return[2]}})})})},e.prototype.hasNextPage=function(){return void 0!==this.totalCount&&this.totalCount>this.queryOptions.entriesPerPage*this.queryOptions.currentPage},e.prototype.hasPreviousPage=function(){return this.queryOptions.currentPage>1},x([l(),M("design:type",I)],e.prototype,"typesystem",void 0),x([l(),M("design:type",Object)],e.prototype,"cursorResolver",void 0),x([l(),M("design:type",Object)],e.prototype,"dataBridge",void 0),x([l(),M("design:type",Object)],e.prototype,"configurationService",void 0),e}(),F=function(){function e(){}return e.interpolate=function(e,n){var i=this;if(void 0!==e){var o=JSON.stringify(e);if(void 0!==o){var a=(o=o.replace(/\$currentUserId/g,n.userId)).match(/\"\:([a-zA-Z\[\]\:]{2,})\"/g);null!==a&&t.forEach(a,function(t){var a=t.split(":")[1];if(a=a.replace('"',""),!n.parameters||void 0===n.parameters[a]){var s="Expected missing parameter '"+a+"' while interpolating query!";return r.error("QueryUtils",s,{selector:e,context:n}),new Error(s+" - "+JSON.stringify(e))}var c=new RegExp(i.escapeRegExp(t),"g");o=o.replace(c,JSON.stringify(n.parameters[a]))}),e=JSON.parse(o)}else e={}}else e={};return e},e.escapeRegExp=function(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},e}(),z=function(){function e(){}return e.fromDocument=function(n){var i=new e;return t.extend(i,n),i},e.prototype.getServiceName=function(){if(void 0!==this.service)return void 0!==this.service.name?this.service.name:this.getModelName()+"Service"},e.prototype.getServiceClassName=function(){return this.getServiceName()},e.prototype.getGeneratedServiceClassName=function(){return"Generated"+this.getServiceClassName()},e.prototype.getModelName=function(){if(this.model.name)return this.model.name;throw new Error("No model name given! How did that happen...")},e.prototype.getModelClassName=function(){return this.getModelName()},e.prototype.getGeneratedModelClassName=function(){return"Generated"+this.getModelClassName()},e.prototype.getService=function(){var e=this.getServiceName();return e=e.charAt(0).toLowerCase()+e.slice(1),a.get(e)},e.prototype.getCollectionName=function(){if(this.collection)return this.collection.name},e.prototype.getCollectionClassName=function(){var e=this.getCollectionName();if(e)return N.capitalize(e)+"Collection"},e.prototype.getGeneratedCollectionClassName=function(){return"Generated"+this.getCollectionClassName()},e.prototype.getModel=function(){return a.get(this.getModelName())},e.prototype.getServiceQueryByName=function(e){if(this.service)return t.find(this.service.queries,function(t){return t.name===e})},e.prototype.getSchemaEntryByName=function(e){return t.find(this.model.schema,function(t){return t.name===e})},e.prototype.getSearchableFields=function(){for(var e=[],t=0,n=this.model.schema;t<n.length;t++){var i=n[t];"foreign[]"!==i.type&&"foreign"!==i.type&&e.push(i)}return e.push({name:"_id",optional:!1,type:"string"}),e},e.prototype.getForeignGetter=function(){return"get"+i(this.getModelName())+"ByIds"},e}(),G=function(){function e(){}return e.extractServiceQuery=function(e){if("string"==typeof e){var t=e.split(".");return{queryName:t[1],serviceName:t[0]}}},e.getQueryObjectMethod=function(e,t){if(void 0===e)throw new Error("No Service Name given!");e=N.decapitalize(e);var n=a.get(e);if(void 0===n)throw new Error("Service not found : "+e);if("function"!=typeof n[t]){var i="get"+N.capitalize(t);if("function"!=typeof n[i])throw new Error("Query not found : "+t+" or "+i);t=i}return n[t].bind(n)},e.isPrimitiveType=function(e){switch(e=e.toLowerCase().replace(/\[|\]/g,"")){case"number":case"string":case"date":case"boolean":case"blob":case"file":case"any":case"object":return!0}return!1},e.extractSelectorParameters=function(e){if(void 0===e)return[];var t=JSON.stringify(e);t=t.replace(/\'/g,'"');for(var n,i=[],o=/\":([a-zA-Z]*):([a-zA-Z\[\]]*)\"/g;null!==(n=o.exec(t));)i.push(n[1]);return i},e}(),V=function(e,t,n,i){var o,r=arguments.length,a=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(r<3?o(a):r>3?o(t,n,a):o(t,n))||a);return r>3&&a&&Object.defineProperty(t,n,a),a},K=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},U=function(){function e(){}return e.instance=function(){return a.get("navigationService")},e.prototype.getCollection=function(){return this.collectionsService.getCollectionByName("navigation")},e.prototype.getNavigationForType=function(e,t){return k.create({type:e.type},"getNavigationForType",t,e,{},this.getCollection())},e.prototype.getNavigationForTreeId=function(e,t){return k.create({navigationTreeId:e.navigationTreeId},"getNavigationForTreeId",t,e,{},this.getCollection())},e.prototype.getNavigationEntryById=function(e,t){return k.create({_id:e.id},"getNavigationEntryById",t,e,{},this.getCollection())},e.prototype.getNavigationEntryByPageId=function(e,t){return k.create({pageId:e.pageId},"getNavigationEntryByPageId",t,e,{},this.getCollection())},e.prototype.save=function(e){return this.getCollection().getMongoDBCollection().insert(e.toDocument())},e.prototype.update=function(e){var t=e.toDocument("id");return this.getCollection().getMongoDBCollection().update(t.id,{$set:{i18nKey:t.i18nKey,icon:t.icon,route:t.route,navigationTreeIdentifier:t.navigationTreeIdentifier,requiresAuthentication:t.requiresAuthentication,loginRoute:t.loginRoute,requiredRole:t.requiredRole,visibility:t.visibility,index:t.index,stateName:t.stateName,abstract:t.abstract,defaultRoute:t.defaultRoute,substateOfId:t.substateOfId,badge:t.badge,trackingEnabled:t.trackingEnabled,redirectTo:t.redirectTo}})},e.prototype.delete=function(e){return this.getCollection().getMongoDBCollection().remove(e.id)},V([l(),K("design:type",Object)],e.prototype,"collectionsService",void 0),V([l(),K("design:type",Object)],e.prototype,"dataBridge",void 0),e}(),J=(g=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}g(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),Q=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.navigationTrees={},t.navigationEntries=[],t.dbNavigation=[],t.layouts={},t.onNavigationEntryAddFns=[],t}return J(n,e),n.instance=function(){return a.get("navigationService")},n.prototype.addNavigationEntry=function(e){var i=this;void 0===e.navigationTreeIdentifier?e.navigationTreeIdentifier=n.LEGACY_TREE:r.debug("NavigationService","Adding navigation entry",e),void 0===this.navigationTrees[e.navigationTreeIdentifier]&&(this.navigationTrees[e.navigationTreeIdentifier]=ge.fromDocument({i18nKey:e.navigationTreeIdentifier})),this.navigationEntries.push(e),this.processNavigationEntry(e),t.each(this.onNavigationEntryAddFns,function(t){i.executeCallback(t,e)})},n.prototype.addNavigationTree=function(e){this.navigationTrees[e.identifier]=e},n.prototype.getNavigationTree=function(e){return this.navigationTrees[e]},n.prototype.getNavigationEntriesForTree=function(e){return t.filter(this.navigationEntries,function(t){return t.navigationTreeIdentifier===e})},n.prototype.getNavigationTreesForTag=function(e){var n=t.filter(this.navigationTrees,function(t){return t.tags instanceof Array&&-1!==t.tags.indexOf(e)});return t.sortBy(n,"index")},n.prototype.processNavigationEntry=function(e){void 0===e.stateName&&(e.stateName=e.route),r.debug("NavigationService","mapping route : "+e.getRoute()+", label : "+e.getI18nKey())},n.prototype.getEntryByRoute=function(e){for(var t=0,n=this.navigationEntries;t<n.length;t++){var i=n[t];if(i.getRoute()===e)return i}r.error("NavigationService","Could not find navigation entry by route '"+e+"', available routes are : ",this.navigationEntries)},n.prototype.getNavigationEntries=function(){return t.union(this.navigationEntries,this.dbNavigation)},n.prototype.getCodeNavigationEntries=function(){return this.navigationEntries},n.prototype.getDBNavigationEntries=function(){return this.dbNavigation},n.prototype.getNavigationEntriesForNavigationType=function(e){var n=[];return t.each(this.getNavigationEntries(),function(e){n.push(e)}),n},n.prototype.setLayout=function(e,t){this.layouts[e]=t},n.prototype.getEntryByStateName=function(e){return t.find(this.getNavigationEntries(),function(t){return t.stateName===e})},n.prototype.onNavigationEntryAdd=function(e,n){var i=this;this.onNavigationEntryAddFns.push({fn:e,thisArg:n}),t.each(this.navigationEntries,function(t){i.executeCallback({fn:e,thisArg:n},t)})},n.prototype.getDefaultNavigatioNentry=function(){var e=t.find(this.navigationEntries,function(e){return e.isDefaultRoute()});if(e)return e;throw new Error("No route is declared as default route!")},n.prototype.executeCallback=function(e,t){e.thisArg?e.fn.bind(e.thisArg)(t):e.fn(t)},n.LEGACY_TREE="LEGACY_TREE",n}(U),Y=function(e,t,n,i){var o,r=arguments.length,a=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(r<3?o(a):r>3?o(t,n,a):o(t,n))||a);return r>3&&a&&Object.defineProperty(t,n,a),a},H=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},$=function(){function e(){this.requiresAuthentication=!0,this.visibility="alwaysVisible",this.abstract=!1,this.defaultRoute=!1,this.trackingEnabled=!0,this._hasSubDocuments=!0,this._isStored=!1}return e.fromDocument=function(e){if(null==e)throw new Error("doc cannot be undefined/null while calling GeneratedNavigationEntry.fromDocument(doc)!");var t=new(this.getModelClass());return void 0!==e._id&&(t._isStored=!0,t.id=e._id),void 0!==e.i18nKey&&(t.i18nKey=e.i18nKey),void 0!==e.icon&&(t.icon=e.icon),void 0!==e.route&&(t.route=e.route),void 0!==e.navigationTreeIdentifier&&(t.navigationTreeIdentifier=e.navigationTreeIdentifier),void 0!==e.requiresAuthentication&&(t.requiresAuthentication=e.requiresAuthentication),void 0!==e.loginRoute&&(t.loginRoute=e.loginRoute),void 0!==e.requiredRole&&(t.requiredRole=e.requiredRole),void 0!==e.visibility&&(t.visibility=e.visibility),void 0!==e.index&&(t.index=e.index),void 0!==e.stateName&&(t.stateName=e.stateName),void 0!==e.abstract&&(t.abstract=e.abstract),void 0!==e.defaultRoute&&(t.defaultRoute=e.defaultRoute),void 0!==e.substateOfId&&(t.substateOfId=e.substateOfId),void 0!==e.badge&&(t.badge=e.badge),void 0!==e.trackingEnabled&&(t.trackingEnabled=e.trackingEnabled),void 0!==e.redirectTo&&(t.redirectTo=e.redirectTo),t},e.prototype.toDocument=function(e){void 0===e&&(e="_id");var t={};return t.i18nKey=this.i18nKey,t.icon=this.icon,t.route=this.route,t.navigationTreeIdentifier=this.navigationTreeIdentifier,t.requiresAuthentication=this.requiresAuthentication,t.loginRoute=this.loginRoute,t.requiredRole=this.requiredRole,t.visibility=this.visibility,t.index=this.index,t.stateName=this.stateName,t.abstract=this.abstract,t.defaultRoute=this.defaultRoute,t.substateOfId=this.substateOfId,t.badge=this.badge,t.trackingEnabled=this.trackingEnabled,t.redirectTo=this.redirectTo,this.id&&(t[e]=this.id),JSON.parse(JSON.stringify(t))},e.prototype.clone=function(){return Z.fromDocument(this.toDocument())},e.prototype.saveSnapshot=function(){this._snapshot=this.toDocument()},e.prototype.restoreSnapshot=function(){if(!this._snapshot)throw new Error("Could not restore snapshot of model since no snapshot was saved before!");t.extend(this,this._snapshot)},e.prototype.getSubstateOf=function(e){return a.get("navigationService").getNavigationEntryById({id:this.substateOfId},e)},e.prototype.hasSubDocuments=function(){return this._hasSubDocuments},e.prototype.isStored=function(){return this._isStored},e.getModelName=function(){return"NavigationEntry"},e.prototype.getModelName=function(){return"NavigationEntry"},e.prototype.getForeignLabel=function(){return this.getModelName()+" ID:"+this.id},e.getModelClass=function(){return a.get("NavigationEntry")},e.prototype.getModelClass=function(){return a.get("NavigationEntry")},e.prototype.delete=function(){return Q.instance().delete(this)},e.prototype.update=function(){return Q.instance().update(this)},e.prototype.save=function(){return Q.instance().save(this)},e.asType=function(){return z.fromDocument({collection:{name:"navigation"},service:{name:"NavigationService",queries:[{name:"getNavigationForType",selector:{type:":type:string"}},{name:"getNavigationForTreeId",selector:{navigationTreeId:":navigationTreeId:string"}},{name:"getNavigationEntryById",selector:{_id:":id:string"}},{name:"getNavigationEntryByPageId",selector:{pageId:":pageId:string"}}]},model:{name:"NavigationEntry",schema:[{name:"i18nKey",type:"string",optional:!0},{name:"icon",type:"string",optional:!0},{name:"route",type:"string"},{name:"navigationTreeIdentifier",type:"string",optional:!0},{name:"requiresAuthentication",type:"boolean",defaultValue:!0,optional:!0},{name:"loginRoute",type:"string",optional:!0},{name:"requiredRole",type:"string",optional:!0},{name:"visibility",type:"string",allowedValues:["alwaysVisible","alwaysHidden","onlyAnonymous","onlyAuthenticated"],defaultValue:"alwaysVisible",optional:!0},{name:"index",type:"number",optional:!0},{name:"stateName",type:"string",optional:!0},{name:"abstract",type:"boolean",optional:!0,defaultValue:!1},{name:"defaultRoute",type:"boolean",optional:!0,defaultValue:!1},{name:"substateOfId",type:"foreign",foreignType:"NavigationEntry",optional:!0},{name:"badge",type:"number",optional:!0},{name:"trackingEnabled",type:"boolean",defaultValue:!0,optional:!0},{name:"redirectTo",type:"string",optional:!0}]},packageName:"../../../../index"})},e.enums={visibility:{ALWAYSVISIBLE:"alwaysVisible",ALWAYSHIDDEN:"alwaysHidden",ONLYANONYMOUS:"onlyAnonymous",ONLYAUTHENTICATED:"onlyAuthenticated"}},Y([l(),H("design:type",Object)],e.prototype,"dataBridge",void 0),e}(),W=(f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}f(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),Z=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.subEntriesAvailable=!1,t}return W(t,e),t.new=function(){return new t},t.prototype.setI18nKey=function(e){return this.i18nKey=e,this},t.prototype.getI18nKey=function(){return this.i18nKey},t.prototype.setRoute=function(e){if("/"!==e.charAt(0))throw new Error("Route for NavigationEntry has to start with a '/'!");return this.route=e,this},t.prototype.getRoute=function(){if(void 0===this.route&&!0!==this.abstract)throw new Error("No route set for navigation entry : "+JSON.stringify(this,null,2));return this.route},t.prototype.setRequiresAuthentication=function(e,t){return this.requiresAuthentication=e,void 0!==t&&(this.loginRoute=t),this},t.prototype.doesRequireAuthentication=function(){return this.requiresAuthentication},t.prototype.setRequiredRole=function(e){return this.requiredRole=e,this},t.prototype.getRequiredRole=function(){return this.requiredRole},t.prototype.setVisible=function(e){return e?this.setVisibility(t.enums.visibility.ALWAYSVISIBLE):this.setVisibility(t.enums.visibility.ALWAYSHIDDEN),this},t.prototype.setVisibility=function(e){return this.visibility=e,this},t.prototype.isVisible=function(){return this.visibility===t.enums.visibility.ALWAYSVISIBLE||this.visibility!==t.enums.visibility.ALWAYSHIDDEN&&(this.visibility===t.enums.visibility.ONLYANONYMOUS?void 0===this.dataBridge.getCurrentUserId():this.visibility!==t.enums.visibility.ONLYAUTHENTICATED||void 0!==this.dataBridge.getCurrentUserId())},t.prototype.setIndex=function(e){return this.index=e,this},t.prototype.getIndex=function(){return this.index},t.prototype.setIcon=function(e){return this.icon=e,this},t.prototype.getIcon=function(){return void 0===this.icon&&r.debug("NavigationEntry","No icon set for route : "+this.getI18nKey()),this.icon},t.prototype.setDefaultRoute=function(e){return this.defaultRoute=e,this},t.prototype.isDefaultRoute=function(){return this.defaultRoute},t.prototype.setChildOfRoute=function(e){return this.childOfRoute=e,this},t.prototype.getChildOfRoute=function(){return this.childOfRoute},t.prototype.hasSubEntries=function(){return this.subEntriesAvailable},t.prototype.setSubEntriesAvailable=function(e){return this.subEntriesAvailable=e,this},t.prototype.setComponent=function(e){return this.component=e,this},t.prototype.getComponent=function(){return this.component},t.prototype.setRedirectTo=function(e){return this.redirectTo=e,this},t.prototype.getRedirectTo=function(){return this.redirectTo},t.prototype.setNavigationTree=function(e){return this.navigationTreeIdentifier=e,this},t}($),X=(d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}d(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),ee=function(e){function t(){var t=e.call(this)||this;return t.createMongoDBCollection(),t.applyAllowDenyRules(),t.createPublications(),t}return X(t,e),t.prototype.createPublications=function(){this.dataBridge.isServer()&&(this.collectionsService.addPublisher("navigation","getNavigationForType",{type:":type:string"},{}),this.collectionsService.addPublisher("navigation","getNavigationForTreeId",{navigationTreeId:":navigationTreeId:string"},{}),this.collectionsService.addPublisher("navigation","getNavigationEntryById",{_id:":id:string"},{}),this.collectionsService.addPublisher("navigation","getNavigationEntryByPageId",{pageId:":pageId:string"},{}))},t.prototype.createMongoDBCollection=function(){this.mongoDBCollection=this.collectionsService.createMongoDBCollection("navigation",function(e){return Z.fromDocument(e)}),this.collectionsService.registerCollection("navigation",this)},t.prototype.applyAllowDenyRules=function(){var e=this.getMongoDBCollectionAllowRules(),t=this.getMongoDBCollectionDenyRules();e&&this.mongoDBCollection.allow(e),t&&this.mongoDBCollection.deny(t)},t.prototype.getMongoDBCollectionAllowRules=function(){},t.prototype.getMongoDBCollectionDenyRules=function(){return{insert:function(e,t){return!1},update:function(e,t,n,i){return!1},remove:function(e,t){return!1}}},t.prototype.getForeignCollection=function(e){switch(e){case"substateOfId":return this.typesystem.getTypeByModelName("NavigationEntry").getCollectionName()}},t.prototype.getCollectionName=function(){return t.COLLECTION_NAME},t.getCollection=function(){return a.get("collectionsService").getCollectionByName(t.COLLECTION_NAME)},t.COLLECTION_NAME="navigation",t.queries={getNavigationForType:{name:"getNavigationForType",parameters:{type:"type"}},getNavigationForTreeId:{name:"getNavigationForTreeId",parameters:{navigationTreeId:"navigationTreeId"}},getNavigationEntryById:{name:"getNavigationEntryById",parameters:{id:"id"}},getNavigationEntryByPageId:{name:"getNavigationEntryByPageId",parameters:{pageId:"pageId"}}},t.expandables={substateOfId:"substateOfId"},t}(B),te=(y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}y(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),ne=function(e){function t(){return e.call(this)||this}return te(t,e),t}(ee),ie=function(e,t,n,i){var o,r=arguments.length,a=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(r<3?o(a):r>3?o(t,n,a):o(t,n))||a);return r>3&&a&&Object.defineProperty(t,n,a),a},oe=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},re=function(){function e(){}return e.instance=function(){return a.get("navigationTreeService")},e.prototype.getCollection=function(){return this.collectionsService.getCollectionByName("navigationtrees")},e.prototype.getNavigationTree=function(e,t){return k.create({identifier:e.identifier},"getNavigationTree",t,e,{},this.getCollection())},e.prototype.getNavigationTreeById=function(e,t){return k.create({_id:e.id},"getNavigationTreeById",t,e,{},this.getCollection())},e.prototype.getNavigationTreesByIds=function(e,t){return k.create({_id:{$in:e.ids}},"getNavigationTreesByIds",t,e,{},this.getCollection())},e.prototype.getNavigationTreesForTag=function(e,t){return k.create({tags:e.tag},"getNavigationTreesForTag",t,e,{},this.getCollection())},e.prototype.save=function(e){return this.getCollection().getMongoDBCollection().insert(e.toDocument())},e.prototype.update=function(e){var t=e.toDocument("id");return this.getCollection().getMongoDBCollection().update(t.id,{$set:{i18nKey:t.i18nKey,identifier:t.identifier,icon:t.icon,index:t.index,tags:t.tags}})},e.prototype.delete=function(e){return this.getCollection().getMongoDBCollection().remove(e.id)},ie([l(),oe("design:type",Object)],e.prototype,"collectionsService",void 0),ie([l(),oe("design:type",Object)],e.prototype,"dataBridge",void 0),e}(),ae=(h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}h(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),se=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return ae(t,e),t}(re),ce=function(e,t,n,i){var o,r=arguments.length,a=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(r<3?o(a):r>3?o(t,n,a):o(t,n))||a);return r>3&&a&&Object.defineProperty(t,n,a),a},ue=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},le=function(){function e(){this.index=0,this.tags=[],this._hasSubDocuments=!1,this._isStored=!1}return e.fromDocument=function(e){if(null==e)throw new Error("doc cannot be undefined/null while calling GeneratedNavigationTree.fromDocument(doc)!");var t=new(this.getModelClass());return void 0!==e._id&&(t._isStored=!0,t.id=e._id),void 0!==e.i18nKey&&(t.i18nKey=e.i18nKey),void 0!==e.identifier&&(t.identifier=e.identifier),void 0!==e.icon&&(t.icon=e.icon),void 0!==e.index&&(t.index=e.index),void 0!==e.tags&&(t.tags=e.tags),t},e.prototype.toDocument=function(e){void 0===e&&(e="_id");var t={};return t.i18nKey=this.i18nKey,t.identifier=this.identifier,t.icon=this.icon,t.index=this.index,t.tags=this.tags,this.id&&(t[e]=this.id),JSON.parse(JSON.stringify(t))},e.prototype.clone=function(){return ge.fromDocument(this.toDocument())},e.prototype.saveSnapshot=function(){this._snapshot=this.toDocument()},e.prototype.restoreSnapshot=function(){if(!this._snapshot)throw new Error("Could not restore snapshot of model since no snapshot was saved before!");t.extend(this,this._snapshot)},e.prototype.hasSubDocuments=function(){return this._hasSubDocuments},e.prototype.isStored=function(){return this._isStored},e.getModelName=function(){return"NavigationTree"},e.prototype.getModelName=function(){return"NavigationTree"},e.prototype.getForeignLabel=function(){return this.getModelName()+" ID:"+this.id},e.getModelClass=function(){return a.get("NavigationTree")},e.prototype.getModelClass=function(){return a.get("NavigationTree")},e.prototype.delete=function(){return se.instance().delete(this)},e.prototype.update=function(){return se.instance().update(this)},e.prototype.save=function(){return se.instance().save(this)},e.asType=function(){return z.fromDocument({collection:{name:"navigationtrees"},service:{name:"NavigationTreeService",queries:[{name:"getNavigationTree",selector:{identifier:":identifier:string"}},{name:"getNavigationTreeById",selector:{_id:":id:string"}},{name:"getNavigationTreesByIds",selector:{_id:{$in:":ids:string[]"}}},{name:"getNavigationTreesForTag",selector:{tags:":tag:string"}}]},model:{name:"NavigationTree",schema:[{name:"i18nKey",type:"string"},{name:"identifier",type:"string",optional:!0},{name:"icon",type:"string",optional:!0},{name:"index",type:"number",optional:!0,defaultValue:0},{name:"tags",type:"string[]",optional:!0,defaultValue:[]}]},packageName:"../../../../index"})},ce([l(),ue("design:type",Object)],e.prototype,"dataBridge",void 0),e}(),pe=(v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}v(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),ge=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return pe(t,e),t}(le),fe=(m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}m(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),de=function(e){function t(){var t=e.call(this)||this;return t.createMongoDBCollection(),t.applyAllowDenyRules(),t.createPublications(),t}return fe(t,e),t.prototype.createPublications=function(){this.dataBridge.isServer()&&(this.collectionsService.addPublisher("navigationtrees","getNavigationTree",{identifier:":identifier:string"},{}),this.collectionsService.addPublisher("navigationtrees","getNavigationTreeById",{_id:":id:string"},{}),this.collectionsService.addPublisher("navigationtrees","getNavigationTreesByIds",{_id:{$in:":ids:string[]"}},{}),this.collectionsService.addPublisher("navigationtrees","getNavigationTreesForTag",{tags:":tag:string"},{}))},t.prototype.createMongoDBCollection=function(){this.mongoDBCollection=this.collectionsService.createMongoDBCollection("navigationtrees",function(e){return ge.fromDocument(e)}),this.collectionsService.registerCollection("navigationtrees",this)},t.prototype.applyAllowDenyRules=function(){var e=this.getMongoDBCollectionAllowRules(),t=this.getMongoDBCollectionDenyRules();e&&this.mongoDBCollection.allow(e),t&&this.mongoDBCollection.deny(t)},t.prototype.getMongoDBCollectionAllowRules=function(){},t.prototype.getMongoDBCollectionDenyRules=function(){return{insert:function(e,t){return!1},update:function(e,t,n,i){return!1},remove:function(e,t){return!1}}},t.prototype.getForeignCollection=function(e){},t.prototype.getCollectionName=function(){return t.COLLECTION_NAME},t.getCollection=function(){return a.get("collectionsService").getCollectionByName(t.COLLECTION_NAME)},t.COLLECTION_NAME="navigationtrees",t.queries={getNavigationTree:{name:"getNavigationTree",parameters:{identifier:"identifier"}},getNavigationTreeById:{name:"getNavigationTreeById",parameters:{id:"id"}},getNavigationTreesByIds:{name:"getNavigationTreesByIds",parameters:{ids:"ids"}},getNavigationTreesForTag:{name:"getNavigationTreesForTag",parameters:{tag:"tag"}}},t.expandables={},t}(B),ye=(b=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}b(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),he=function(e){function t(){return e.call(this)||this}return ye(t,e),t}(de);a.register("QueryObject",q),e.InitLevelService=u,e.IOC=a,e.Autowired=l,e.Logger=r,e.Utils=N,e.FrontendError=C,e.FrontendErrorRegistry=_,e.InMemoryConfigurationService=O,e.ConsoleNotifier=T,e.GoogleAnalyticsService=E,e.BaseCollection=B,e.CollectionAccessService=D,e.QueryObjectBuilder=k,e.DefaultQueryObject=q,e.QueryUtils=F,e.Type=z,e.Typesystem=I,e.TypesystemUtils=G,e.initializeTypesystem=function(e){a.onRegister("typesystem",function(t){t.addType(z.fromDocument({collection:{name:"navigation"},service:{name:"NavigationService",queries:[{name:"getNavigationForType",selector:{type:":type:string"}},{name:"getNavigationForTreeId",selector:{navigationTreeId:":navigationTreeId:string"}},{name:"getNavigationEntryById",selector:{_id:":id:string"}},{name:"getNavigationEntryByPageId",selector:{pageId:":pageId:string"}}]},model:{name:"NavigationEntry",schema:[{name:"i18nKey",type:"string",optional:!0},{name:"icon",type:"string",optional:!0},{name:"route",type:"string"},{name:"navigationTreeIdentifier",type:"string",optional:!0},{name:"requiresAuthentication",type:"boolean",defaultValue:!0,optional:!0},{name:"loginRoute",type:"string",optional:!0},{name:"requiredRole",type:"string",optional:!0},{name:"visibility",type:"string",allowedValues:["alwaysVisible","alwaysHidden","onlyAnonymous","onlyAuthenticated"],defaultValue:"alwaysVisible",optional:!0},{name:"index",type:"number",optional:!0},{name:"stateName",type:"string",optional:!0},{name:"abstract",type:"boolean",optional:!0,defaultValue:!1},{name:"defaultRoute",type:"boolean",optional:!0,defaultValue:!1},{name:"substateOfId",type:"foreign",foreignType:"NavigationEntry",optional:!0},{name:"badge",type:"number",optional:!0},{name:"trackingEnabled",type:"boolean",defaultValue:!0,optional:!0},{name:"redirectTo",type:"string",optional:!0}]},packageName:"@smallstack/common"})),t.addType(z.fromDocument({collection:{name:"navigationtrees"},service:{name:"NavigationTreeService",queries:[{name:"getNavigationTree",selector:{identifier:":identifier:string"}},{name:"getNavigationTreeById",selector:{_id:":id:string"}},{name:"getNavigationTreesByIds",selector:{_id:{$in:":ids:string[]"}}},{name:"getNavigationTreesForTag",selector:{tags:":tag:string"}}]},model:{name:"NavigationTree",schema:[{name:"i18nKey",type:"string"},{name:"identifier",type:"string",optional:!0},{name:"icon",type:"string",optional:!0},{name:"index",type:"number",optional:!0,defaultValue:0},{name:"tags",type:"string[]",optional:!0,defaultValue:[]}]},packageName:"@smallstack/common"})),a.register("NavigationEntry",Z),a.register("NavigationTree",ge),void 0!==e&&void 0!==e.withCollections&&!0!==e.withCollections||(a.register("navigationCollection",new ne),a.register("navigationtreesCollection",new he)),a.register("navigationService",new Q),a.register("navigationTreeService",new se)})},e.NavigationEntry=Z,e.NavigationService=Q,e.NavigationCollection=ne,e.NavigationTree=ge,e.NavigationTreeService=se,e.NavigationtreesCollection=he,Object.defineProperty(e,"__esModule",{value:!0})});
//# sourceMappingURL=index.umd.js.map
{
"name": "@smallstack/common",
"version": "0.6.8",
"version": "0.6.9",
"description": "common functionality for smallstack projects",

@@ -46,3 +46,2 @@ "main": "dist/bundle/index.umd.js",

"dependencies": {
"@smallstack/common": "*",
"pluralize": "^7.0.0",

@@ -49,0 +48,0 @@ "rxjs": "^5.5.6",

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