@c8y/ng1-modules 1017.51.0 → 1017.53.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core/core/services/application.js +1 -1
- package/core/ui/sanitize-html/sanitize-html.service.js +1 -1
- package/modbusConfiguration4/fieldbus-device-list.html +1 -0
- package/package.json +1 -1
- package/tenantApplications/subscribed-applications/subscribed-applications.html +1 -0
- package/tenantApplications/views/index.html +1 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?Object(arguments[t]):{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&r.push.apply(r,Object.getOwnPropertySymbols(n).filter(function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable})),r.forEach(function(t){_defineProperty(e,t,n[t])})}return e}function _defineProperty(t,e,n){return(e=_toPropertyKey(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function _toPropertyKey(t){var e=_toPrimitive(t,"string");return"symbol"===_typeof(e)?e:String(e)}function _toPrimitive(t,e){if("object"!==_typeof(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0===n)return("string"===e?String:Number)(t);var r=n.call(t,e||"default");if("object"!==_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}!function(){function t(c,u,n,p,o,t,s,l,e,f,r,g,h,d,i,m){var v,a=i("humanizeAppName"),y="application/",S="".concat(y,"applications"),E={headers:f.contentHeaders("application",!0)},b=this,A={HOSTED:"cloud",EXTERNAL:"external-link",SMARTAPP:"puzzle-piece",MICROSERVICE:"microchip",APAMA_CEP_RULE:"file-code-o"},P=["HOSTED","EXTERNAL","REPOSITORY"],O=["HOSTED","EXTERNAL","REPOSITORY"],x={HOSTED:d("Hosted application"),REPOSITORY:d("Repository"),EXTERNAL:d("External application"),MICROSERVICE:d("Microservice"),APAMA_CEP_RULE:d("Apama CEP rule")},D=f.createEnum([{name:"UP",label:d("Up"),value:"Up",icon:"check-circle text-success"},{name:"DOWN",label:d("Down"),value:"Down",icon:"warning status critical"},{name:"UNHEALTHY",label:d("Unhealthy"),value:"Unhealth",icon:"exclamation-circle status major"},{name:"UNHEALTHY",label:d("Unhealthy"),value:"Unhealthy",icon:"exclamation-circle status major"}]),R=1e3,C=10;try{v=e.get("gettextCatalog")}catch(t){v={getString:_.identity}}function T(c,o){return r.current().then(function(t){var e=t.tenant,n=f.pageSizeFilter(o),r={params:n},i="".concat(f.url(c),"/").concat(e),a=f.cleanListCallback("applications",angular.bind(b,T,c),n);return u.get(i,r).then(a).then(rt).then(M)})}function w(t){var e=t.desired,n=t.active;return{active:n,unhealthy:function(t,e){return _.isNumber(e)?t-e:t}(e,n),desired:e}}function j(c,o){return r.current().then(function(t){var e=c||t,n=f.pageSizeFilter(o),r={params:_.defaults(n,{noPaging:!0,dropOverwrittenApps:!0})},i=f.url("".concat(y,"applicationsByUser/").concat(encodeURIComponent(e.id))),a=f.cleanListCallback("applications",angular.bind(b,j,e),n);return u.get(i,r).then(a).then(rt).then(M)})}function M(t){var e=_.sortBy(t,[function(t){return a(t)}]);return _.assign(e,_.pick(t,["statistics","paging"])),e}function L(t){return T("".concat(y,"applicationsByTenant"),t)}function U(t){var e=f.url("".concat(S,"/").concat(t.contextPath,"/manifest")),n={params:f.pageSizeNoTotalFilter()};return u.get(e,n).then(function(t){return _.map(t.data.imports,N)})}function k(t){var e=k.cache,n=t.id||t,r=f.url("".concat(S,"/").concat(n,"/binaries/plugins")),i={params:f.pageSizeNoTotalFilter()};function a(){delete e[n]}return e[n]||(e[n]=s(_.noop,2e3).then(function(){return u.get(r,i).then(f.getResData).finally(a)})),e[n]}function N(t){return{id:t.id,contextPath:t.rootContextPath,directoryName:t.directoryName,manifest:t}}function I(t){var e=t.id||t;return f.url("".concat(S,"/").concat(e))}function B(t){var e=I(t);return u.get(e)}function H(e,t){var n=I(e),r=function(t){var e=_.cloneDeep(t);return delete e.type,e}(e),i=_.defaults(t||{},E),a=u.put(n,r,i).finally(function(){o.localStorage.setItem("refresh",e.contextPath)});return a.then(function(t){c.$emit("c8yApplication:update",{app:e,res:t})}),a}function F(e,t){var n=f.url(S),r=_.defaults(t||{},E),i=u.post(n,e,r);return i.then(function(t){return c.$emit("c8yApplication:create",{app:e,res:t})}).catch(function(){l.error("Could not emit c8yApplication:create for:",{app:e})}),i}function $(t,e){return t.id?H(t,e):F(t,e)}function z(i){var a=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},t=2<arguments.length?arguments[2]:void 0,e=3<arguments.length?arguments[3]:void 0,c=C,o=e||p.defer(),u=t||0,n=0===u?"":"-".concat(u);return $(function(t,e){var n=function(t){return"".concat(t).concat(e)};return _objectSpread({},t,{name:n(t.name),key:n(t.key),contextPath:n(t.contextPath)})}(i,n),_objectSpread({silentError:!0},a)).then(function(t){o.resolve(f.getResData(t))},function(t){if(409===t.status&&u<c)z(i,a,u+1,o);else{var e=_.get(t,"data.message")||_.get(t,"data.details.exceptionMessage"),n=e?v.getString(e):d("Could not create application."),r=t.data;o.reject({errorMessage:n,errorDetails:r})}}),o.promise}function Y(r){var t=B(r).then(f.getResData);return p.all({appDetails:t,appPlugins:t.then(k).then(q),appManifest:t.then(V),appIndex:t.then(J)}).then(function(t){t.appDetails;var e=t.appPlugins,n=t.appManifest,r=t.appIndex,i=function(e,t){return _(t.imports).map(function(t){return _.find(e,{pluginName:t})}).compact().concat(e).uniq().value()}(e,n);return p.all({newAppManifest:function(t,e){var n=_.cloneDeep(e);return n.imports=_.map(t,"pluginName"),n}(i,n),newAppIndex:function(t,e,n){var r=n;return r=function(t,e,n){var r=n,i=_(e).map(function(t){var e=_.get(t,"pluginPackage.css",[]);return!!(e=e.length?e:_.get(t,"pluginPackage.less",[])).length&&"".concat(t.pluginName,"/style.css")}).filter(_.identity).value(),a=_.flattenDeep(["\x3c!--MODULES_CSS--\x3e",_.map(i.slice(0,1),function(t){return'<link rel="stylesheet" href="'.concat(t,'"></link>')}),"\x3c!--/MODULES_CSS--\x3e"]).join("\n"),c=_.flattenDeep(["\x3c!--MODULES_CSS_DEFER--\x3e","<script>",["[",'"'.concat(i.slice(1).join('", "'),'"'),"].forEach(function(f){loadCSS(f)})"].join(""),"<\/script>","\x3c!--/MODULES_CSS_DEFER--\x3e"]).join("\n");return r=(r=r.replace(new RegExp("\x3c!--MODULES_CSS--\x3e(.|\\n|\\r)*\x3c!--\\/MODULES_CSS--\x3e","gm"),a)).replace(new RegExp("\x3c!--MODULES_CSS_DEFER--\x3e(.|\\n|\\r)*\x3c!--\\/MODULES_CSS_DEFER--\x3e","gm"),c)}(0,e,r),r=function(t,e,n){var r=_.flattenDeep(["\x3c!--MODULES_JS--\x3e",_(e).map(function(t){var e=_.get(t,"pluginPackage.js",[]);return!!e.length&&"".concat(t.pluginName,"/main.js")}).filter(_.identity).map(function(t){return'<script defer src="'.concat(t,'"><\/script>')}).value(),"\x3c!--/MODULES_JS--\x3e"]).join("\n");return n.replace(new RegExp("\x3c!--MODULES_JS--\x3e(.|\\n|\\r)*\x3c!--\\/MODULES_JS--\x3e","gm"),r)}(0,e,r),r=function(t,e,n){var r=['C8Y_NG_MODULES=["',_.uniq(_.flattenDeep(_.map(e,function(t){return _.get(t,"pluginPackage.ngModules",[])}))).join('","'),'"];'].join("");return n.replace(new RegExp("C8Y_NG_MODULES=\\[(.|\\n|\\r)*?\\];","gm"),r)}(0,e,r)}(0,i,r)})}).then(function(t){var e=t.newAppManifest,n=t.newAppIndex;return X(r,[{path:"cumulocity.json",file:new Blob([JSON.stringify(e)],{type:"application/json"})},{path:"index.html",file:new Blob([n],{type:"text/html"})}])})}function q(t){var e=[],n=_.sortBy(t,function(t){return-1*_.get(t,"pluginPackage.priority",0)});return _.forEach(n,function(t){!function n(t,r,i){var e=K(r,_.get(t,"pluginPackage.contextPath"));if(e)return;var a=_.get(t,"pluginPackage.imports",[]);_.forEach(a,function(t){var e=K(i,t);e?n(e,r,i):l.error("Plugin with context path ".concat(t," is missing."))});r.push(t)}(t,e,n)}),e}function K(t,e){var n=function(t){var e=t;(function(t){return/^core\//.test(t)||/^administration\//.test(t)||/^devicemanagement\//.test(t)||/^cockpit\//.test(t)||/^platformadmin\//.test(t)||/^fieldbus4\//.test(t)||/^fieldbus3\//.test(t)||/^fieldbus2\//.test(t)||/^fieldbus\//.test(t)||/^demoboard\//.test(t)||/^vendme_plugins\//.test(t)})(e)&&(e=e.replace(/\//g,"_"));return e}(e);return _.find(t,function(t){return t&&t.pluginPackage&&t.pluginPackage.contextPath===n})}function V(t){var e="".concat(W(t),"/cumulocity.json");return u.get(e).then(f.getResData)}function J(t){var e="".concat(W(t),"/index.html");return u.get(e).then(f.getResData)}function W(t){return f.url("apps/".concat(t.contextPath))}function X(t,e){var n="".concat(I(t),"/binaries/files"),r=new FormData;return _.forEach(e,function(t){r.append(t.path,new File([t.file],t.path))}),u.post(n,r,{transformRequest:_.identity,headers:{"Content-Type":void 0}})}function G(){var t=o.location.pathname.match(/\/apps\/(public\/){0,1}(.+?)(\/|\?|#|$)/);return t&&t[2]}function Q(){var t=o.location.pathname.match(/\/apps\/(public\/([^/]+)|([^/]+))/);return t&&-1!==t[1].indexOf("public")}function Z(){var n=G(),r=!!Q();function e(t){var e="MARKET"===t.availability;return t.contextPath===n&&(!r||e)}return j(null,{dropOverwrittenApps:!1}).then(function(t){return _.find(t,e)})}function tt(e){return g.list({type:"c8y_SmartAppApplication"}).then(function(t){return _.find(t,{appId:e.id})||null})}function et(t){var e;return(t?p.resolve(t):Z()).then(function(t){return e=t}).then(tt).then(function(t){return e.config=t,e})}function nt(t){return _(t).uniq("id").filter(function(t){var e=t.manifest,n=!1;return e&&(n=e.noAppSwitcher),!n&&_.includes(["HOSTED","EXTERNAL"],t.type)}).value()}function rt(t){var e=_.reject(t,function(t){return"management"===t.name&&"management"===t.owner.tenant.id});return _.assign(e,_.pick(t,_.filter(_.keys(t),function(t){return _.isNaN(_.toNumber(t))}))),e}function it(t,e){var n=_.isString(e)?function(e){return function(t){return t.name===e||t.contextPath===e||t.key===e}}(e):e;return _.some(t,n)}function at(t){return"HOSTED"===t.type||"REPOSITORY"===t.type}function ct(){if(ct.cache)return ct.cache;function e(t){return{url:t,noAppKey:!0}}return u(e([f.url(S),(Q()?"public/":"")+G(),"manifest"].join("/"))).then(function(t){return u(e([f.url(S),t.data.application.id].join("/")))}).then(f.getResData).then(function(t){return ct.cache=p.when(t)})}return d("Administration"),d("Cockpit"),d("Device management"),d("Fieldbus4"),d("Streaming Analytics"),k.cache={},f.getFlag("test")&&(ct.cache=p.when({name:"app",manifest:{}})),{list:L,listByUser:j,listByTenant:L,listByOwner:function(t){return T("".concat(y,"applicationsByOwner"),t)},listPlugins:function(){var t=f.url("".concat(y,"plugins")),e={params:{pageSize:R}};return u.get(t,e).then(function(t){return _.uniqBy(t.data.plugins,"id")})},listPluginsByTenant:function(){return L().then(function(t){var e=_.uniqBy(t,"id"),n=[];return _.forEach(e,function(t){at(t)&&n.push(U(t))}),p.all(n).then(_.flattenDeep).then(function(t){return _.uniqBy(t,"id")})})},listPluginsByApplication:U,listPluginsByPaasApp:k,listByVisibleLinks:function(){return j().then(nt).then(function(t){return p.when(t)})},listApplications:function t(e){var n=f.url("".concat(S)),r={params:f.pageSizeFilter(e)},i=f.cleanListCallback("applications",t,e);return u.get(n,r).then(i).then(M)},getApplicationMO:function(t){var e="c8y_Application_".concat(t);return g.list({type:e}).then(function(t){return _.head(t)})},getApplicationMOs:function(t){var e=t||{},n=e.tenantId,r=e.filters,i=void 0===r?{}:r,a={type:"c8y_Application_*"};return n&&(a=m.addAndFilter(a,{__has:"c8y_Subscriptions.".concat(n)})),g.listQuery(a,i,!0)},getInstanceCounts:w,getSubscriptionsList:function(t){var e=_.get(t,"c8y_Subscriptions");return _.reduce(e,function(t,e,n){var r=_.get(e,"details"),i=_.get(e,"status"),a=w(r);return t.concat(_objectSpread({},a,{tenantName:n,status:i}))},[])},getApplicationStatusForTenant:function(t,e){return _.get(t,["c8y_Subscriptions",e])},status:D,isAvailable:function(e){return j().then(function(t){return it(t,e)})},areAllAvailable:function(t){return j().then(function(e){return _.every(t,function(t){return it(e,t)})})},isAnyAvailable:function(t){return j().then(function(e){return _.some(t,function(t){return it(e,t)})})},detail:B,update:H,create:F,remove:function(n){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},e=I(n),r=et(_.isObjectLike(n)?n:{id:n}).then(function(t){return!_.get(t,"config.id")||g.remove(t.config)}),i=u.delete(e,{params:t}),a=p.all({cfg:r,res:i});return a.then(function(t){var e=t.res;c.$emit("c8yApplication:delete",{app:n,res:e})}),a},save:$,trySave:z,clone:function(t,e){var n="".concat(I(t),"/clone");return u.post(n).then(f.getResData).then(function(t){return _.isObjectLike(e)?(_.assign(t,e),z(t).then(f.getResData)):t})},getHref:function(t){return at(t)?function(t){var e=n.port();return e=80===e||443===e?"":":".concat(e),"".concat(n.protocol(),"://").concat(n.host()).concat(e,"/apps/").concat(t.public?"public/":"").concat(t.contextPath)}(t):t.externalUrl},isHosted:function(t){return"HOSTED"===t.type},isApamaCepRule:function(t){return"APAMA_CEP_RULE"===_.get(t,"type")},isMicroserviceWithManifest:function(e){return g.list({type:"c8y_microservice_manifest_".concat(e.id)}).then(function(t){return"MICROSERVICE"===e.type&&0<t.length})},canOpenInBrowser:function(t){return(_.isObjectLike(t)?p.resolve(t):B(t).then(f.getResData)).then(function(t){var e=!t.name.match(/feature-/),n=_.includes(P,t.type);return e&&n})},canAddPlugin:function(t){return console.warning("This method is now deprecated. Consider using Web SDK to customize and extend applications."),(_.isObjectLike(t)?p.resolve(t):B(t).then(function(t){return t.data})).then(function(t){return!_.isEmpty(t.manifest)&&_.includes(O,_.get(t,"type"))})},icon:function(t){var e=_.isString(t)?t:t.type;return t.manifest&&"MICROSERVICE"!==e&&(e="SMARTAPP"),A[e]},typeLabel:function(t){var e=_.isString(t)?t:t.type;return x[e]},getCurrent:Z,getConfig:et,pollRefreshMessages:function(){t(function(){!function(t){o.localStorage.getItem("refresh")===G()&&(o.localStorage.setItem("refresh",void 0),t||o.location.reload())}()},1e3,0,!1)},getCurrentContextPath:G,updateManifest:function(t,n){return B(t).then(function(t){var e=t.data;return e.manifest=n,e}).then(H)},listArchives:function(t,e){var n="".concat(I(t),"/binaries"),r={params:f.pageSizeNoTotalFilter(e),silentError:!0};return u.get(n,r).then(f.getResData)},uploadArchive:function(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},r={url:"".concat(I(t),"/binaries"),method:"POST",headers:{Content:"multipart/form-data",Accept:"application/json"},file:e,fileName:function(t){return t.replace(/\s+/g,"_")}(e.name)};return _.assign(r,n),h.upload(r)},deleteArchive:function(t,e){var n=e.id||e,r=[I(t),"binaries",n].join("/");return u.delete(r)},setActiveArchive:function(t,e){return $({id:t.id,activeVersionId:e.id})},addPaasAppPlugin:function(t,e){console.warning("This method is now deprecated. Consider using Web SDK to customize and extend applications.");var n=function(t){var e=t.name.split(".");return e.pop(),e.join(".")}(e),r="".concat(I(t),"/binaries/plugins/").concat(n),i=h.upload({url:r,method:"POST",headers:{Content:"multipart/form-data",Accept:"application/json"},file:e}),a=i.then(_.partial(Y,t));return a.progress=i.progress,a},removePaasAppPlugin:function(t,e){console.warning("This method is now deprecated. Consider using Web SDK to customize and extend applications.");var n=e.pluginName||e,r="".concat(I(t),"/binaries/plugins/").concat(n);return u.delete(r).then(_.partial(Y,t))},uploadPaasAppFiles:X,getPaasAppManifest:V,refreshPaasApp:Y,refreshHostedApp:function(t){var e="".concat(I(t),"/refresh");return u.post(e)},isPaasApp:function(t){return V(t).then(function(t){return t._webpaas},function(){return!1})},convertType:function(t){var e=_.cloneDeep(t);return void 0===e.type||(e.type=function(t){return"HOSTED"===t.type&&t.resourcesUrl&&"/"!==t.resourcesUrl.charAt(0)}(e)?"REPOSITORY":e.type),e},revertType:function(t){var e=_.cloneDeep(t);return"HOSTED"===e.type&&(e.resourcesUrl="/"),"REPOSITORY"===e.type&&(e.type="HOSTED"),e},parseAppName:function(t){return t&&"devicemanagement"===t.toLowerCase()?"Device management":t||"Cumulocity"},currentAppCached:ct,sortApps:M,isAppOnTheList:it}}t.$inject=["$rootScope","$http","$location","$q","$window","$interval","$timeout","$log","$injector","c8yBase","c8yUser","c8yInventory","$upload","gettext","$filter","c8yQueriesUtil"],angular.module("c8y.core").factory("c8yApplication",t)}();
|
|
1
|
+
"use strict";function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _objectSpread(n){for(var t=1;t<arguments.length;t++){var e=null!=arguments[t]?Object(arguments[t]):{},r=Object.keys(e);"function"==typeof Object.getOwnPropertySymbols&&r.push.apply(r,Object.getOwnPropertySymbols(e).filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.forEach(function(t){_defineProperty(n,t,e[t])})}return n}function _defineProperty(t,n,e){return(n=_toPropertyKey(n))in t?Object.defineProperty(t,n,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[n]=e,t}function _toPropertyKey(t){var n=_toPrimitive(t,"string");return"symbol"===_typeof(n)?n:String(n)}function _toPrimitive(t,n){if("object"!==_typeof(t)||null===t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);var r=e.call(t,n||"default");if("object"!==_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}!function(){function t(c,u,e,p,o,t,l,s,n,f,r,g,d,h,i,m){var v,a=i("humanizeAppName"),y="application/",S="".concat(y,"applications"),E={headers:f.contentHeaders("application",!0)},b=this,A={HOSTED:"cloud",EXTERNAL:"external-link",SMARTAPP:"puzzle-piece",MICROSERVICE:"microchip",APAMA_CEP_RULE:"file-code-o"},P=["HOSTED","EXTERNAL","REPOSITORY"],O=["HOSTED","EXTERNAL","REPOSITORY"],x={HOSTED:h("Hosted application"),REPOSITORY:h("Repository"),EXTERNAL:h("External application"),MICROSERVICE:h("Microservice"),APAMA_CEP_RULE:h("Apama CEP rule")},D=f.createEnum([{name:"UP",label:h("Up"),value:"Up",icon:"check-circle text-success"},{name:"DOWN",label:h("Down"),value:"Down",icon:"warning status critical"},{name:"UNHEALTHY",label:h("Unhealthy"),value:"Unhealth",icon:"exclamation-circle status major"},{name:"UNHEALTHY",label:h("Unhealthy"),value:"Unhealthy",icon:"exclamation-circle status major"}]),R=1e3,C=10;try{v=n.get("gettextCatalog")}catch(t){v={getString:_.identity}}function w(c,o){return r.current().then(function(t){var n=t.tenant,e=f.pageSizeFilter(o),r={params:e},i="".concat(f.url(c),"/").concat(n),a=f.cleanListCallback("applications",angular.bind(b,w,c),e);return u.get(i,r).then(a).then(rt).then(M)})}function T(t){var n=t.desired,e=t.active;return{active:e,unhealthy:function(t,n){return _.isNumber(n)?t-n:t}(n,e),desired:n}}function j(c,o){return r.current().then(function(t){var n=c||t,e=f.pageSizeFilter(o),r={params:_.defaults(e,{noPaging:!0,dropOverwrittenApps:!0})},i=f.url("".concat(y,"applicationsByUser/").concat(encodeURIComponent(n.id))),a=f.cleanListCallback("applications",angular.bind(b,j,n),e);return u.get(i,r).then(a).then(rt).then(M)})}function M(t){var n=_.sortBy(t,[function(t){return a(t)}]);return _.assign(n,_.pick(t,["statistics","paging"])),n}function L(t){return w("".concat(y,"applicationsByTenant"),t)}function U(t){var n=f.url("".concat(S,"/").concat(t.contextPath,"/manifest")),e={params:f.pageSizeNoTotalFilter()};return u.get(n,e).then(function(t){return _.map(t.data.imports,N)})}function k(t){var n=k.cache,e=t.id||t,r=f.url("".concat(S,"/").concat(e,"/binaries/plugins")),i={params:f.pageSizeNoTotalFilter()};function a(){delete n[e]}return n[e]||(n[e]=l(_.noop,2e3).then(function(){return u.get(r,i).then(f.getResData).finally(a)})),n[e]}function N(t){return{id:t.id,contextPath:t.rootContextPath,directoryName:t.directoryName,manifest:t}}function I(t){var n=t.id||t;return f.url("".concat(S,"/").concat(n))}function B(t){var n=I(t);return u.get(n)}function H(n,t){var e=I(n),r=function(t){var n=_.cloneDeep(t);return delete n.type,n}(n),i=_.defaults(t||{},E),a=u.put(e,r,i).finally(function(){o.localStorage.setItem("refresh",n.contextPath)});return a.then(function(t){c.$emit("c8yApplication:update",{app:n,res:t})}),a}function F(n,t){var e=f.url(S),r=_.defaults(t||{},E),i=u.post(e,n,r);return i.then(function(t){return c.$emit("c8yApplication:create",{app:n,res:t})}).catch(function(){s.error("Could not emit c8yApplication:create for:",{app:n})}),i}function $(t,n){return t.id?H(t,n):F(t,n)}function z(i){var a=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},t=2<arguments.length?arguments[2]:void 0,n=3<arguments.length?arguments[3]:void 0,c=C,o=n||p.defer(),u=t||0,e=0===u?"":"-".concat(u);return $(function(t,n){var e=function(t){return"".concat(t).concat(n)};return _objectSpread({},t,{name:e(t.name),key:e(t.key),contextPath:e(t.contextPath)})}(i,e),_objectSpread({silentError:!0},a)).then(function(t){o.resolve(f.getResData(t))},function(t){if(409===t.status&&u<c)z(i,a,u+1,o);else{var n=_.get(t,"data.message")||_.get(t,"data.details.exceptionMessage"),e=n?v.getString(n):h("Could not create application."),r=t.data;o.reject({errorMessage:e,errorDetails:r})}}),o.promise}function Y(r){var t=B(r).then(f.getResData);return p.all({appDetails:t,appPlugins:t.then(k).then(q),appManifest:t.then(V),appIndex:t.then(J)}).then(function(t){t.appDetails;var n=t.appPlugins,e=t.appManifest,r=t.appIndex,i=function(n,t){return _(t.imports).map(function(t){return _.find(n,{pluginName:t})}).compact().concat(n).uniq().value()}(n,e);return p.all({newAppManifest:function(t,n){var e=_.cloneDeep(n);return e.imports=_.map(t,"pluginName"),e}(i,e),newAppIndex:function(t,n,e){var r=e;return r=function(t,n,e){var r=e,i=_(n).map(function(t){var n=_.get(t,"pluginPackage.css",[]);return!!(n=n.length?n:_.get(t,"pluginPackage.less",[])).length&&"".concat(t.pluginName,"/style.css")}).filter(_.identity).value(),a=_.flattenDeep(["\x3c!--MODULES_CSS--\x3e",_.map(i.slice(0,1),function(t){return'<link rel="stylesheet" href="'.concat(t,'"></link>')}),"\x3c!--/MODULES_CSS--\x3e"]).join("\n"),c=_.flattenDeep(["\x3c!--MODULES_CSS_DEFER--\x3e","<script>",["[",'"'.concat(i.slice(1).join('", "'),'"'),"].forEach(function(f){loadCSS(f)})"].join(""),"<\/script>","\x3c!--/MODULES_CSS_DEFER--\x3e"]).join("\n");return r=(r=r.replace(new RegExp("\x3c!--MODULES_CSS--\x3e(.|\\n|\\r)*\x3c!--\\/MODULES_CSS--\x3e","gm"),a)).replace(new RegExp("\x3c!--MODULES_CSS_DEFER--\x3e(.|\\n|\\r)*\x3c!--\\/MODULES_CSS_DEFER--\x3e","gm"),c)}(0,n,r),r=function(t,n,e){var r=_.flattenDeep(["\x3c!--MODULES_JS--\x3e",_(n).map(function(t){var n=_.get(t,"pluginPackage.js",[]);return!!n.length&&"".concat(t.pluginName,"/main.js")}).filter(_.identity).map(function(t){return'<script defer src="'.concat(t,'"><\/script>')}).value(),"\x3c!--/MODULES_JS--\x3e"]).join("\n");return e.replace(new RegExp("\x3c!--MODULES_JS--\x3e(.|\\n|\\r)*\x3c!--\\/MODULES_JS--\x3e","gm"),r)}(0,n,r),r=function(t,n,e){var r=['C8Y_NG_MODULES=["',_.uniq(_.flattenDeep(_.map(n,function(t){return _.get(t,"pluginPackage.ngModules",[])}))).join('","'),'"];'].join("");return e.replace(new RegExp("C8Y_NG_MODULES=\\[(.|\\n|\\r)*?\\];","gm"),r)}(0,n,r)}(0,i,r)})}).then(function(t){var n=t.newAppManifest,e=t.newAppIndex;return X(r,[{path:"cumulocity.json",file:new Blob([JSON.stringify(n)],{type:"application/json"})},{path:"index.html",file:new Blob([e],{type:"text/html"})}])})}function q(t){var n=[],e=_.sortBy(t,function(t){return-1*_.get(t,"pluginPackage.priority",0)});return _.forEach(e,function(t){!function e(t,r,i){var n=K(r,_.get(t,"pluginPackage.contextPath"));if(n)return;var a=_.get(t,"pluginPackage.imports",[]);_.forEach(a,function(t){var n=K(i,t);n?e(n,r,i):s.error("Plugin with context path ".concat(t," is missing."))});r.push(t)}(t,n,e)}),n}function K(t,n){var e=function(t){var n=t;(function(t){return/^core\//.test(t)||/^administration\//.test(t)||/^devicemanagement\//.test(t)||/^cockpit\//.test(t)||/^platformadmin\//.test(t)||/^fieldbus4\//.test(t)||/^fieldbus3\//.test(t)||/^fieldbus2\//.test(t)||/^fieldbus\//.test(t)||/^demoboard\//.test(t)||/^vendme_plugins\//.test(t)})(n)&&(n=n.replace(/\//g,"_"));return n}(n);return _.find(t,function(t){return t&&t.pluginPackage&&t.pluginPackage.contextPath===e})}function V(t){var n="".concat(W(t),"/cumulocity.json");return u.get(n).then(f.getResData)}function J(t){var n="".concat(W(t),"/index.html");return u.get(n).then(f.getResData)}function W(t){return f.url("apps/".concat(t.contextPath))}function X(t,n){var e="".concat(I(t),"/binaries/files"),r=new FormData;return _.forEach(n,function(t){r.append(t.path,new File([t.file],t.path))}),u.post(e,r,{transformRequest:_.identity,headers:{"Content-Type":void 0}})}function G(){var t=o.location.pathname.match(/\/apps\/(public\/){0,1}(.+?)(\/|\?|#|$)/);return t&&t[2]}function Q(){var t=o.location.pathname.match(/\/apps\/(public\/([^/]+)|([^/]+))/);return t&&-1!==t[1].indexOf("public")}function Z(){var e=G(),r=!!Q();function n(t){var n="MARKET"===t.availability;return t.contextPath===e&&(!r||n)}return j(null,{dropOverwrittenApps:!1}).then(function(t){return _.find(t,n)})}function tt(n){return g.list({type:"c8y_SmartAppApplication"}).then(function(t){return _.find(t,{appId:n.id})||null})}function nt(t){var n;return(t?p.resolve(t):Z()).then(function(t){return n=t}).then(tt).then(function(t){return n.config=t,n})}function et(t){return _(t).uniq("id").filter(function(t){var n=t.manifest,e=!1;return n&&(e=n.noAppSwitcher),!e&&_.includes(["HOSTED","EXTERNAL"],t.type)}).value()}function rt(t){var n=_.reject(t,function(t){return"management"===t.name&&"management"===t.owner.tenant.id});return _.assign(n,_.pick(t,_.filter(_.keys(t),function(t){return _.isNaN(_.toNumber(t))}))),n}function it(t,n){var e=_.isString(n)?function(n){return function(t){return t.name===n||t.contextPath===n||t.key===n}}(n):n;return _.some(t,e)}function at(t){return"HOSTED"===t.type||"REPOSITORY"===t.type}function ct(){if(ct.cache)return ct.cache;function n(t){return{url:t,noAppKey:!0}}return u(n([f.url(S),(Q()?"public/":"")+G(),"manifest"].join("/"))).then(function(t){return u(n([f.url(S),t.data.application.id].join("/")))}).then(f.getResData).then(function(t){return ct.cache=p.when(t)})}return h("Administration"),h("Cockpit"),h("Device management"),h("Fieldbus4"),h("Streaming Analytics"),k.cache={},f.getFlag("test")&&(ct.cache=p.when({name:"app",manifest:{}})),{list:L,listByUser:j,listByTenant:L,listByOwner:function(t){return w("".concat(y,"applicationsByOwner"),t)},listPlugins:function(){var t=f.url("".concat(y,"plugins")),n={params:{pageSize:R}};return u.get(t,n).then(function(t){return _.uniqBy(t.data.plugins,"id")})},listPluginsByTenant:function(){return L().then(function(t){var n=_.uniqBy(t,"id"),e=[];return _.forEach(n,function(t){at(t)&&e.push(U(t))}),p.all(e).then(_.flattenDeep).then(function(t){return _.uniqBy(t,"id")})})},listPluginsByApplication:U,listPluginsByPaasApp:k,listByVisibleLinks:function(){return j().then(et).then(function(t){return p.when(t)})},listApplications:function t(n){var e=f.url("".concat(S)),r={params:f.pageSizeFilter(n)},i=f.cleanListCallback("applications",t,n);return u.get(e,r).then(i).then(M)},getApplicationMO:function(t){var n="c8y_Application_".concat(t);return g.list({type:n}).then(function(t){return _.head(t)})},getApplicationMOs:function(t){var n=t||{},e=n.tenantId,r=n.filters,i=void 0===r?{}:r,a={type:"c8y_Application_*"};return e&&(a=m.addAndFilter(a,{__has:"c8y_Subscriptions.".concat(e)})),g.listQuery(a,i,!0)},getInstanceCounts:T,getSubscriptionsList:function(t){var n=_.get(t,"c8y_Subscriptions");return _.reduce(n,function(t,n,e){var r=_.get(n,"details"),i=_.get(n,"status"),a=T(r);return t.concat(_objectSpread({},a,{tenantName:e,status:i}))},[])},getApplicationStatusForTenant:function(t,n){return _.get(t,["c8y_Subscriptions",n])},status:D,isAvailable:function(n){return j().then(function(t){return it(t,n)})},areAllAvailable:function(t){return j().then(function(n){return _.every(t,function(t){return it(n,t)})})},isAnyAvailable:function(t){return j().then(function(n){return _.some(t,function(t){return it(n,t)})})},detail:B,update:H,create:F,remove:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},n=I(e),r=nt(_.isObjectLike(e)?e:{id:e}).then(function(t){return!_.get(t,"config.id")||g.remove(t.config)}),i=u.delete(n,{params:t}),a=p.all({cfg:r,res:i});return a.then(function(t){var n=t.res;c.$emit("c8yApplication:delete",{app:e,res:n})}),a},save:$,trySave:z,clone:function(t,n){var e="".concat(I(t),"/clone");return u.post(e).then(f.getResData).then(function(t){return _.isObjectLike(n)?(_.assign(t,n),z(t).then(f.getResData)):t})},getHref:function(t){return at(t)?function(t){var n=e.port();return n=80===n||443===n?"":":".concat(n),"".concat(e.protocol(),"://").concat(e.host()).concat(n,"/apps/").concat(t.public?"public/":"").concat(t.contextPath)}(t):t.externalUrl},isHosted:function(t){return"HOSTED"===t.type},isApamaCepRule:function(t){return"APAMA_CEP_RULE"===_.get(t,"type")},isMicroserviceWithManifest:function(n){return g.list({type:"c8y_microservice_manifest_".concat(n.id)}).then(function(t){return"MICROSERVICE"===n.type&&0<t.length})},canOpenInBrowser:function(t){return(_.isObjectLike(t)?p.resolve(t):B(t).then(f.getResData)).then(function(t){var n=!t.name.match(/feature-/),e=_.includes(P,t.type);return n&&e})},canAddPlugin:function(t){return console.warning("This method is now deprecated. Consider using Web SDK to customize and extend applications."),(_.isObjectLike(t)?p.resolve(t):B(t).then(function(t){return t.data})).then(function(t){return!_.isEmpty(t.manifest)&&_.includes(O,_.get(t,"type"))})},icon:function(t){var n=_.isString(t)?t:t.type;return t.manifest&&"MICROSERVICE"!==n&&(n="SMARTAPP"),A[n]},typeLabel:function(t){var n=_.isString(t)?t:t.type;return x[n]},getCurrent:Z,getConfig:nt,pollRefreshMessages:function(){t(function(){!function(t){o.localStorage.getItem("refresh")===G()&&(o.localStorage.setItem("refresh",void 0),t||o.location.reload())}()},1e3,0,!1)},getCurrentContextPath:G,updateManifest:function(t,e){return B(t).then(function(t){var n=t.data;return n.manifest=e,n}).then(H)},listArchives:function(t,n){var e="".concat(I(t),"/binaries"),r={params:f.pageSizeNoTotalFilter(n),silentError:!0};return u.get(e,r).then(f.getResData)},uploadArchive:function(t,n){var e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},r={url:"".concat(I(t),"/binaries"),method:"POST",headers:{Content:"multipart/form-data",Accept:"application/json"},file:n,fileName:function(t){return t.replace(/\s+/g,"_")}(n.name)};return _.assign(r,e),d.upload(r)},deleteArchive:function(t,n){var e=n.id||n,r=[I(t),"binaries",e].join("/");return u.delete(r)},setActiveArchive:function(t,n){return $({id:t.id,activeVersionId:n.id})},addPaasAppPlugin:function(t,n){console.warning("This method is now deprecated. Consider using Web SDK to customize and extend applications.");var e=function(t){var n=t.name.split(".");return n.pop(),n.join(".")}(n),r="".concat(I(t),"/binaries/plugins/").concat(e),i=d.upload({url:r,method:"POST",headers:{Content:"multipart/form-data",Accept:"application/json"},file:n}),a=i.then(_.partial(Y,t));return a.progress=i.progress,a},removePaasAppPlugin:function(t,n){console.warning("This method is now deprecated. Consider using Web SDK to customize and extend applications.");var e=n.pluginName||n,r="".concat(I(t),"/binaries/plugins/").concat(e);return u.delete(r).then(_.partial(Y,t))},uploadPaasAppFiles:X,getPaasAppManifest:V,refreshPaasApp:Y,refreshHostedApp:function(t){var n="".concat(I(t),"/refresh");return u.post(n)},isPaasApp:function(t){return V(t).then(function(t){return t._webpaas},function(){return!1})},convertType:function(t){var n=_.cloneDeep(t);return void 0===n.type||(n.type=function(t){return"HOSTED"===t.type&&t.resourcesUrl&&"/"!==t.resourcesUrl.charAt(0)}(n)?"REPOSITORY":n.type),n},revertType:function(t){var n=_.cloneDeep(t);return"HOSTED"===n.type&&(n.resourcesUrl="/"),"REPOSITORY"===n.type&&(n.type="HOSTED"),n},parseAppName:function(t){var n=t&&t.toLowerCase();return"devicemanagement"===n?"Device management":"digital-twin-manager"===n?"Digital twin manager":t||"Cumulocity"},currentAppCached:ct,sortApps:M,isAppOnTheList:it}}t.$inject=["$rootScope","$http","$location","$q","$window","$interval","$timeout","$log","$injector","c8yBase","c8yUser","c8yInventory","$upload","gettext","$filter","c8yQueriesUtil"],angular.module("c8y.core").factory("c8yApplication",t)}();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function _slicedToArray(t,r){return _arrayWithHoles(t)||_iterableToArrayLimit(t,r)||_unsupportedIterableToArray(t,r)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _iterableToArrayLimit(t,r){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var a,e,o,g,i=[],l=!0,u=!1;try{if(o=(n=n.call(t)).next,0===r){if(Object(n)!==n)return;l=!1}else for(;!(l=(a=o.call(n)).done)&&(i.push(a.value),i.length!==r);l=!0);}catch(t){u=!0,e=t}finally{try{if(!l&&null!=n.return&&(g=n.return(),Object(g)!==g))return}finally{if(u)throw e}}return i}}function _arrayWithHoles(t){if(Array.isArray(t))return t}function _toConsumableArray(t){return _arrayWithoutHoles(t)||_iterableToArray(t)||_unsupportedIterableToArray(t)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(t,r){if(t){if("string"==typeof t)return _arrayLikeToArray(t,r);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(t,r):void 0}}function _iterableToArray(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function _arrayWithoutHoles(t){if(Array.isArray(t))return _arrayLikeToArray(t)}function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var n=0,a=new Array(r);n<r;n++)a[n]=t[n];return a}!function(){function t(n,t,a){var r=_.memoize(function(t){var r=t.moduleName,n=t.tagName;return function(t){return t.map(function(t){return _.kebabCase(t).replace("c-8-y","c8y")})}(function(t){var e=[];return t.forEach(function(t){var r=angular.module(t)._invokeQueue;0<r.length&&r.forEach(function(t){var r=_slicedToArray(t,3),n=r[1],a=_slicedToArray(r[2],1)[0];"directive"===n&&e.push(a)})}),_.uniq(e)}(c(r))).filter(function(t){return t.includes(n)})},function(t){return t.moduleName}),e={declaration:{regex:{openingTag:/(<\?xml)/g,closingTag:/(\?>)/g},openingTag:"<?xml",closingTag:"?>"}},o=["use","#comment"].concat(_toConsumableArray(_.keys(e))),g=["ngBind","ngBindHtml","ngBindTemplate","ngClass","ngClassEven","ngClassOdd","ngCloak","ngController","ngForm","ngHide","ngIf","ngInclude","ngInit","ngNonBindable","ngPluralize","ngRef","ngRepeat","ngShow","ngStyle","ngSwitch","ngSwitchWhen","ngSwitchDefault","ngOptions","ngTransclude","ngModel","ngList","ngChange","pattern","ngPattern","ngRequired","minlength","ngMinlength","maxlength","ngMaxlength","ngValue","ngModelOptions"].map(_.kebabCase),i="click dblclick mousedown mouseup mouseover mouseout mousemove mouseenter mouseleave keydown keyup keypress submit focus blur copy cut paste".split(/\s/).map(function(t){return"ng-".concat(t)}),l="click dblclick mousedown mouseup mouseover mouseout mousemove mouseenter mouseleave keydown keyup keypress submit focus blur copy cut paste".split(/\s/).map(function(t){return"on".concat(t)}),u={ADD_TAGS:_.concat(r({moduleName:"app",tagName:"c8y"}),o),ADD_ATTR:[].concat(_toConsumableArray(g),_toConsumableArray(i),_toConsumableArray(l),["ng-attr-accent-height","ng-attr-accumulate","ng-attr-additive","ng-attr-alignment-baseline","ng-attr-ascent","ng-attr-attributename","ng-attr-attributetype","ng-attr-azimuth","ng-attr-basefrequency","ng-attr-baseline-shift","ng-attr-begin","ng-attr-bias","ng-attr-by","ng-attr-class","ng-attr-clip","ng-attr-clip-path","ng-attr-clip-rule","ng-attr-color","ng-attr-color-interpolation","ng-attr-color-interpolation-filters","ng-attr-color-profile","ng-attr-color-rendering","ng-attr-cx","ng-attr-cy","ng-attr-d","ng-attr-dx","ng-attr-dy","ng-attr-diffuseconstant","ng-attr-direction","ng-attr-display","ng-attr-divisor","ng-attr-dur","ng-attr-edgemode","ng-attr-elevation","ng-attr-end","ng-attr-fill","ng-attr-fill-opacity","ng-attr-fill-rule","ng-attr-filter","ng-attr-filterunits","ng-attr-flood-color","ng-attr-flood-opacity","ng-attr-font-family","ng-attr-font-size","ng-attr-font-size-adjust","ng-attr-font-stretch","ng-attr-font-style","ng-attr-font-variant","ng-attr-font-weight","ng-attr-fx","ng-attr-fy","ng-attr-g1","ng-attr-g2","ng-attr-glyph-name","ng-attr-glyphref","ng-attr-gradientunits","ng-attr-gradienttransform","ng-attr-height","ng-attr-href","ng-attr-id","ng-attr-image-rendering","ng-attr-in","ng-attr-in2","ng-attr-k","ng-attr-k1","ng-attr-k2","ng-attr-k3","ng-attr-k4","ng-attr-kerning","ng-attr-keypoints","ng-attr-keysplines","ng-attr-keytimes","ng-attr-lang","ng-attr-lengthadjust","ng-attr-letter-spacing","ng-attr-kernelmatrix","ng-attr-kernelunitlength","ng-attr-lighting-color","ng-attr-local","ng-attr-marker-end","ng-attr-marker-mid","ng-attr-marker-start","ng-attr-markerheight","ng-attr-markerunits","ng-attr-markerwidth","ng-attr-maskcontentunits","ng-attr-maskunits","ng-attr-max","ng-attr-mask","ng-attr-media","ng-attr-method","ng-attr-mode","ng-attr-min","ng-attr-name","ng-attr-numoctaves","ng-attr-offset","ng-attr-operator","ng-attr-opacity","ng-attr-order","ng-attr-orient","ng-attr-orientation","ng-attr-origin","ng-attr-overflow","ng-attr-paint-order","ng-attr-path","ng-attr-pathlength","ng-attr-patterncontentunits","ng-attr-patterntransform","ng-attr-patternunits","ng-attr-points","ng-attr-preservealpha","ng-attr-preserveaspectratio","ng-attr-primitiveunits","ng-attr-r","ng-attr-rx","ng-attr-ry","ng-attr-radius","ng-attr-refx","ng-attr-refy","ng-attr-repeatcount","ng-attr-repeatdur","ng-attr-restart","ng-attr-result","ng-attr-rotate","ng-attr-scale","ng-attr-seed","ng-attr-shape-rendering","ng-attr-specularconstant","ng-attr-specularexponent","ng-attr-spreadmethod","ng-attr-stddeviation","ng-attr-stitchtiles","ng-attr-stop-color","ng-attr-stop-opacity","ng-attr-stroke-dasharray","ng-attr-stroke-dashoffset","ng-attr-stroke-linecap","ng-attr-stroke-linejoin","ng-attr-stroke-miterlimit","ng-attr-stroke-opacity","ng-attr-stroke","ng-attr-stroke-width","ng-attr-style","ng-attr-surfacescale","ng-attr-tabindex","ng-attr-targetx","ng-attr-targety","ng-attr-transform","ng-attr-text-anchor","ng-attr-text-decoration","ng-attr-text-rendering","ng-attr-textlength","ng-attr-type","ng-attr-u1","ng-attr-u2","ng-attr-unicode","ng-attr-values","ng-attr-viewbox","ng-attr-visibility","ng-attr-version","ng-attr-vert-adv-y","ng-attr-vert-origin-x","ng-attr-vert-origin-y","ng-attr-width","ng-attr-word-spacing","ng-attr-wrap","ng-attr-writing-mode","ng-attr-xchannelselector","ng-attr-ychannelselector","ng-attr-x","ng-attr-x1","ng-attr-x2","ng-attr-xmlns","ng-attr-y","ng-attr-y1","ng-attr-y2","ng-attr-z","ng-attr-zoomandpan"],_toConsumableArray(r({moduleName:"app",tagName:"c8y"})))};return{sanitizeString:s,getSpecificHtmlTags:r,getModulesList:c,sanitizeFileByLevel:function(t,r){var n=a.defer();return n.resolve(t),"strict"!==r?"lax"!==r?n.promise:this.sanitizeFile(t):this.sanitizeFile(t,{})},sanitizeFile:function(r){var n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:u;return t.readDataUri(r).then(t.decodeDataUri).then(function(t){return s(t,n)}).then(function(t){return new File([t],r.name,{type:r.type})})}};function s(t){var r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:u;return function(t){var n=t;return _.forEach(e,function(t,r){n=n.replace(new RegExp("<".concat(r,">"),"g"),t.openingTag).replace(new RegExp("</".concat(r,">"),"g"),t.closingTag)}),n}(n.sanitize(function(t){var a=t;return _.forEach(e,function(t,r){var n=t.regex;a=a.replace(n.openingTag,"<".concat(r,">")).replace(n.closingTag,"</".concat(r,">"))}),a}(t),r))}function c(r){var t=angular.module(r).requires.reduce(d,[]);return-1===_.findIndex(t,function(t){return t===r})&&t.push(r),_.uniq(t)}function d(t,r){if("string"!=typeof r)return t;var n=angular.module(r);return 0<n.requires.length?_.includes(t,r)?t:(t.push(r),n.requires.reduce(d,t)):(t.push(r),t)}}t.$inject=["DOMPurify","c8yBinary","$q"],angular.module("c8y.ui").constant("DOMPurify",window.DOMPurify),angular.module("c8y.ui").factory("c8ySanitizeHtml",t)}();
|
|
1
|
+
"use strict";function _slicedToArray(t,r){return _arrayWithHoles(t)||_iterableToArrayLimit(t,r)||_unsupportedIterableToArray(t,r)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _iterableToArrayLimit(t,r){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var a,e,o,g,i=[],l=!0,u=!1;try{if(o=(n=n.call(t)).next,0===r){if(Object(n)!==n)return;l=!1}else for(;!(l=(a=o.call(n)).done)&&(i.push(a.value),i.length!==r);l=!0);}catch(t){u=!0,e=t}finally{try{if(!l&&null!=n.return&&(g=n.return(),Object(g)!==g))return}finally{if(u)throw e}}return i}}function _arrayWithHoles(t){if(Array.isArray(t))return t}function _toConsumableArray(t){return _arrayWithoutHoles(t)||_iterableToArray(t)||_unsupportedIterableToArray(t)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(t,r){if(t){if("string"==typeof t)return _arrayLikeToArray(t,r);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(t,r):void 0}}function _iterableToArray(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function _arrayWithoutHoles(t){if(Array.isArray(t))return _arrayLikeToArray(t)}function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var n=0,a=new Array(r);n<r;n++)a[n]=t[n];return a}!function(){function t(n,t,a){var r=_.memoize(function(t){var r=t.moduleName,n=t.tagName;return function(t){return t.map(function(t){return _.kebabCase(t).replace("c-8-y","c8y")})}(function(t){var e=[];return t.forEach(function(t){var r=angular.module(t)._invokeQueue;0<r.length&&r.forEach(function(t){var r=_slicedToArray(t,3),n=r[1],a=_slicedToArray(r[2],1)[0];"directive"===n&&e.push(a)})}),_.uniq(e)}(c(r))).filter(function(t){return t.includes(n)})},function(t){return t.moduleName}),e={declaration:{regex:{openingTag:/(<\?xml)/g,closingTag:/(\?>)/g},openingTag:"<?xml",closingTag:"?>"}},o=["use","#comment"].concat(_toConsumableArray(_.keys(e))),g=["ngBind","ngBindHtml","ngBindTemplate","ngClass","ngClassEven","ngClassOdd","ngCloak","ngController","ngForm","ngHide","ngIf","ngInclude","ngInit","ngNonBindable","ngPluralize","ngRef","ngRepeat","ngShow","ngStyle","ngSwitch","ngSwitchWhen","ngSwitchDefault","ngOptions","ngTransclude","ngModel","ngList","ngChange","pattern","ngPattern","ngRequired","minlength","ngMinlength","maxlength","ngMaxlength","ngValue","ngModelOptions"].map(_.kebabCase),i="click dblclick mousedown mouseup mouseover mouseout mousemove mouseenter mouseleave keydown keyup keypress submit focus blur copy cut paste".split(/\s/).map(function(t){return"ng-".concat(t)}),l="click dblclick mousedown mouseup mouseover mouseout mousemove mouseenter mouseleave keydown keyup keypress submit focus blur copy cut paste".split(/\s/).map(function(t){return"on".concat(t)}),u={ADD_TAGS:_.concat(r({moduleName:"app",tagName:"c8y"}),o),ADD_ATTR:[].concat(_toConsumableArray(g),_toConsumableArray(i),_toConsumableArray(l),["ng-attr-accent-height","ng-attr-accumulate","ng-attr-additive","ng-attr-alignment-baseline","ng-attr-ascent","ng-attr-attributename","ng-attr-attributetype","ng-attr-azimuth","ng-attr-basefrequency","ng-attr-baseline-shift","ng-attr-begin","ng-attr-bias","ng-attr-by","ng-attr-class","ng-attr-clip","ng-attr-clip-path","ng-attr-clip-rule","ng-attr-color","ng-attr-color-interpolation","ng-attr-color-interpolation-filters","ng-attr-color-profile","ng-attr-color-rendering","ng-attr-cx","ng-attr-cy","ng-attr-d","ng-attr-dx","ng-attr-dy","ng-attr-diffuseconstant","ng-attr-direction","ng-attr-display","ng-attr-divisor","ng-attr-dur","ng-attr-edgemode","ng-attr-elevation","ng-attr-end","ng-attr-fill","ng-attr-fill-opacity","ng-attr-fill-rule","ng-attr-filter","ng-attr-filterunits","ng-attr-flood-color","ng-attr-flood-opacity","ng-attr-font-family","ng-attr-font-size","ng-attr-font-size-adjust","ng-attr-font-stretch","ng-attr-font-style","ng-attr-font-variant","ng-attr-font-weight","ng-attr-fx","ng-attr-fy","ng-attr-g1","ng-attr-g2","ng-attr-glyph-name","ng-attr-glyphref","ng-attr-gradientunits","ng-attr-gradienttransform","ng-attr-height","ng-attr-href","ng-attr-id","ng-attr-image-rendering","ng-attr-in","ng-attr-in2","ng-attr-k","ng-attr-k1","ng-attr-k2","ng-attr-k3","ng-attr-k4","ng-attr-kerning","ng-attr-keypoints","ng-attr-keysplines","ng-attr-keytimes","ng-attr-lang","ng-attr-lengthadjust","ng-attr-letter-spacing","ng-attr-kernelmatrix","ng-attr-kernelunitlength","ng-attr-lighting-color","ng-attr-local","ng-attr-marker-end","ng-attr-marker-mid","ng-attr-marker-start","ng-attr-markerheight","ng-attr-markerunits","ng-attr-markerwidth","ng-attr-maskcontentunits","ng-attr-maskunits","ng-attr-max","ng-attr-mask","ng-attr-media","ng-attr-method","ng-attr-mode","ng-attr-min","ng-attr-name","ng-attr-numoctaves","ng-attr-offset","ng-attr-operator","ng-attr-opacity","ng-attr-order","ng-attr-orient","ng-attr-orientation","ng-attr-origin","ng-attr-overflow","ng-attr-paint-order","ng-attr-path","ng-attr-pathlength","ng-attr-patterncontentunits","ng-attr-patterntransform","ng-attr-patternunits","ng-attr-points","ng-attr-preservealpha","ng-attr-preserveaspectratio","ng-attr-primitiveunits","ng-attr-r","ng-attr-rx","ng-attr-ry","ng-attr-radius","ng-attr-refx","ng-attr-refy","ng-attr-repeatcount","ng-attr-repeatdur","ng-attr-restart","ng-attr-result","ng-attr-rotate","ng-attr-scale","ng-attr-seed","ng-attr-shape-rendering","ng-attr-specularconstant","ng-attr-specularexponent","ng-attr-spreadmethod","ng-attr-stddeviation","ng-attr-stitchtiles","ng-attr-stop-color","ng-attr-stop-opacity","ng-attr-stroke-dasharray","ng-attr-stroke-dashoffset","ng-attr-stroke-linecap","ng-attr-stroke-linejoin","ng-attr-stroke-miterlimit","ng-attr-stroke-opacity","ng-attr-stroke","ng-attr-stroke-width","ng-attr-style","ng-attr-surfacescale","ng-attr-tabindex","ng-attr-targetx","ng-attr-targety","ng-attr-transform","ng-attr-text-anchor","ng-attr-text-decoration","ng-attr-text-rendering","ng-attr-textlength","ng-attr-type","ng-attr-u1","ng-attr-u2","ng-attr-unicode","ng-attr-values","ng-attr-viewbox","ng-attr-visibility","ng-attr-version","ng-attr-vert-adv-y","ng-attr-vert-origin-x","ng-attr-vert-origin-y","ng-attr-width","ng-attr-word-spacing","ng-attr-wrap","ng-attr-writing-mode","ng-attr-xchannelselector","ng-attr-ychannelselector","ng-attr-x","ng-attr-x1","ng-attr-x2","ng-attr-xmlns","ng-attr-y","ng-attr-y1","ng-attr-y2","ng-attr-z","ng-attr-zoomandpan"],_toConsumableArray(r({moduleName:"app",tagName:"c8y"})))};return{sanitizeString:s,getSpecificHtmlTags:r,getModulesList:c,sanitizeFileByLevel:function(t,r){var n=a.defer();return n.resolve(t),"strict"!==r?"lax"!==r?n.promise:this.sanitizeFile(t):this.sanitizeFile(t,{})},sanitizeFile:function(r){var n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:u;return t.readDataUri(r).then(t.decodeDataUri).then(function(t){return s(t,n)}).then(function(t){return new File([t],r.name,{type:r.type})})}};function s(t){var r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:u;return function(t){var n=t;return _.forEach(e,function(t,r){n=n.replace(new RegExp("<".concat(r,">"),"g"),t.openingTag).replace(new RegExp("</".concat(r,">"),"g"),t.closingTag)}),n}(n.sanitize(function(t){var a=t;return _.forEach(e,function(t,r){var n=t.regex;a=a.replace(n.openingTag,"<".concat(r,">")).replace(n.closingTag,"</".concat(r,">")).replace("constructor.constructor","")}),a}(t),r))}function c(r){var t=angular.module(r).requires.reduce(d,[]);return-1===_.findIndex(t,function(t){return t===r})&&t.push(r),_.uniq(t)}function d(t,r){if("string"!=typeof r)return t;var n=angular.module(r);return 0<n.requires.length?_.includes(t,r)?t:(t.push(r),n.requires.reduce(d,t)):(t.push(r),t)}}t.$inject=["DOMPurify","c8yBinary","$q"],angular.module("c8y.ui").constant("DOMPurify",window.DOMPurify),angular.module("c8y.ui").factory("c8ySanitizeHtml",t)}();
|
package/package.json
CHANGED