New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More →
Socket
Sign inDemoInstall
Socket

@evergis/api

Package Overview
Dependencies
Maintainers
6
Versions
330
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@evergis/api - npm Package Compare versions

Comparing version 1.0.0-alpha.2 to 1.0.0-alpha.3

2

dist/api.cjs.production.min.js

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

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("@evergis/event-emitter"),r=require("ky"),n=(e=r)&&"object"==typeof e&&"default"in e?e.default:e,s=require("query-string"),i=require("@evergis/sgis/es/painters/DomPainter/DomPainter"),o=require("@evergis/sgis/es/Map"),u=require("@evergis/sgis/es/layers/TileLayer"),c=require("@evergis/sgis/es/layers/DynamicLayer"),a=require("@evergis/sgis");function p(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function h(e,t,r){return t&&p(e.prototype,t),r&&p(e,r),e}function f(){return(f=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function l(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function y(e,t){try{var r=e()}catch(e){return t(e)}return r&&r.then?r.then(void 0,t):r}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var m={ServiceManagerService:{name:"services",type:"ServiceManagerService"},PostgresDataService:{name:"services/data",type:"PostgresDataService"},ImportService:{name:"services/import",type:"ImportService"},GeocodeService:{name:"services/geocode2gis",type:"GeocodeService"},PrintService:{name:"services/print",type:"PrintService"},NotificationService:{name:"services/notifications",type:"NotificationService"},PostgresProjectService:{name:"services/projects",type:"PostgresProjectService"},ResourceCatalogService:{name:"services/resources",type:"ResourceCatalogService"},PostgresSecurityService:{name:"services/security",type:"PostgresSecurityService"},SchedulerService:{name:"services/tasks",type:"SchedulerService"},FileUploadService:{name:"services/upload",type:"FileUploadService"},Layers:{name:"layers",type:"Layers"},Tables:{name:"tables",type:"Tables"},Projects:{name:"projects",type:"Projects"},Styles:{name:"services/styles",type:""},Tools:{name:"services/tools",type:""}},v=function(){function e(e,t){this.info=e,this.http=t}return h(e,[{key:"name",get:function(){return this.info.name}}]),e}(),d=function(e){function t(){return e.apply(this,arguments)||this}l(t,e);var r=t.prototype;return r.login=function(e){try{var t=this;return Promise.resolve(t.getSessionToken(e)).then((function(e){var r=e.owner;t.sessionId=e.token,t.user=r}))}catch(e){return Promise.reject(e)}},r.logout=function(){try{return Promise.resolve(this.closeSession(this.sessionId||"")).then((function(){}))}catch(e){return Promise.reject(e)}},t}(function(e){function t(){return e.apply(this,arguments)||this}l(t,e);var r=t.prototype;return r.findUserByName=function(e){return this.http.get("/services/security/users",{startWith:e}).json()},r.getSessionToken=function(e){return this.http.post("/services/security/authorize",e).json()},r.getOpenSessions=function(){return this.http.get("/services/security/sessions").json()},r.closeSession=function(e){return this.http.delete("/services/security/sessions",{id:e}).json()},t}(v));function g(e){var t=new FormData;return t.append("file",e),t}var P,j=function(e){function t(){return e.apply(this,arguments)||this}return l(t,e),t.prototype.upload=function(e,t){var r=g(e);return r.append("rewrite",""+!!t),this.uploadFile(r)},t}(function(e){function t(){return e.apply(this,arguments)||this}l(t,e);var r=t.prototype;return r.downloadFile=function(e){return this.http.get("/services/upload/file",{fileName:e}).then((function(){}))},r.uploadFile=function(e){return this.http.post("/services/upload/file",e).json()},t}(v)),S=function(e){function t(){return e.apply(this,arguments)||this}return l(t,e),t}(function(e){function t(){return e.apply(this,arguments)||this}l(t,e);var r=t.prototype;return r.getDataSchema=function(e){return this.http.get("/services/import/dataSchema",{fileId:e}).json()},r.getExcelDataSchema=function(e){return this.http.get("/services/import/excelDataSchema",{fileId:e.fileId,attributeNameRowNumber:e.attributeNameRowNumber,aliasRowNumber:e.aliasRowNumber}).json()},r.getRasterAttributes=function(e){return this.http.get("/services/import/rasterAttributes",{fileName:e}).json()},t}(v)),b=function(e){function t(){return e.apply(this,arguments)||this}l(t,e);var r=t.prototype;return r.getSubscriptionList=function(){return this.http.get("/services/notifications/subscribes").json()},r.subscribeOperation=function(e){return this.http.post("/services/notifications/subscribes",null,{tag:e}).then((function(){}))},r.unsubscribeOperation=function(e){return this.http.delete("/services/notifications/subscribes",{tag:e}).then((function(){}))},r.getNotifications=function(){return this.http.get("/services/notifications/notifications").json()},r.subscribeListOperation=function(e){return this.http.post("/services/notifications/subscribe-list",e).then((function(){}))},r.unsubscribeListOperation=function(e){return this.http.post("/services/notifications/unsubscribe-list",e).then((function(){}))},t}(v);(P=exports.ConnectionStatus||(exports.ConnectionStatus={})).Initialized="Initialized",P.Connected="Connected",P.Break="Break",P.Lost="Lost";var T=function(e){function r(r,n){var s;return(s=e.call(this,r,n)||this).MAX_WS_RECONNECT_TRIES=10,s.reconnectTries=0,s.subscribeList=[],s._connectStatus=exports.ConnectionStatus.Initialized,s.onWsConnected=function(){s.connectStatus=exports.ConnectionStatus.Connected},s.onWsClosed=function(){s.reconnectTries<s.MAX_WS_RECONNECT_TRIES?(s.connectStatus=exports.ConnectionStatus.Break,s.reconnectTries++,s.connect()):s.connectStatus=exports.ConnectionStatus.Lost},s.onWsMessage=function(e){var t={};try{t=JSON.parse(e.data)}catch(e){}if("notification"===t.type&&t.data){var r=t.data,n=r.tag;n&&s.emitter.emit(n,new k(r.data))}},s.emitter=new t.EventEmitter,s}l(r,e);var n=r.prototype;return n.on=function(e,t){this.emitter.on(e,t)},n.off=function(e,t){this.emitter.off(e,t)},n.subscribe=function(e){try{var t=this;return t.subscribeList.push(e),setTimeout((function(){t.subscribeList.length&&t.subscribeListOperation(t.subscribeList),t.subscribeList=[]}),500),Promise.resolve()}catch(e){return Promise.reject(e)}},n.unsubscribe=function(e){try{var t=this;return Promise.resolve(t.getSubscriptionList()).then((function(r){if(r.includes(e))return t.unsubscribeOperation(e)}))}catch(e){return Promise.reject(e)}},n.connectWs=function(e,t){var r=e.replace("http://","ws://").replace("https://","wss://");this.wsUrl=r+"?_sb="+encodeURIComponent(t||""),this.connect()},n.connect=function(){this.wsUrl&&(this.ws=new WebSocket(this.wsUrl),this.ws.onopen=this.onWsConnected,this.ws.onclose=this.onWsClosed,this.ws.onmessage=this.onWsMessage)},h(r,[{key:"connectStatus",get:function(){return this._connectStatus},set:function(e){this.emitter.emit("ConnectionStatus",new k(e)),this._connectStatus=e}}]),r}(b),k=function(e){this.data=e},w=function(e){function t(){return e.apply(this,arguments)||this}l(t,e);var r=t.prototype;return r.init=function(e){return this.notification=e,this.notification.subscribe("server_task")},r.runCopyTask=function(e){try{var t=this;return Promise.resolve(t.startCopyTask(e)).then((function(e){return t.processTaskId(e.taskId)}))}catch(e){return Promise.reject(e)}},r.runBufferTask=function(e){try{var t=this;return Promise.resolve(t.startBufferTask(e)).then((function(e){return t.processTaskId(e.taskId)}))}catch(e){return Promise.reject(e)}},r.runUnionTask=function(e){try{var t=this;return Promise.resolve(t.startUnionTask(e)).then((function(e){return t.processTaskId(e.taskId)}))}catch(e){return Promise.reject(e)}},r.runPrintTask=function(e){try{var t=this;return Promise.resolve(t.startPrintTask(e)).then((function(e){return t.processTaskId(e.taskId)}))}catch(e){return Promise.reject(e)}},r.runRouteTask=function(e){try{var t=this;return Promise.resolve(t.startRouteTask(e)).then((function(e){return t.processTaskId(e.taskId)}))}catch(e){return Promise.reject(e)}},r.runOverlayTask=function(e){try{var t=this;return Promise.resolve(t.startOverlayTask(e)).then((function(e){return t.processTaskId(e.taskId)}))}catch(e){return Promise.reject(e)}},r.runFilterCopyTask=function(e){try{var t=this;return Promise.resolve(t.startFilterCopyTask(e)).then((function(e){return t.processTaskId(e.taskId)}))}catch(e){return Promise.reject(e)}},r.runPipelineTask=function(e){try{var t=this;return Promise.resolve(t.startPipelineTask(e)).then((function(e){return t.processTaskId(e.taskId)}))}catch(e){return Promise.reject(e)}},r.waitTaskCompleted=function(e){try{var t=this;return Promise.resolve(new Promise((function(r,n){try{return Promise.resolve(t.getTaskProgress(e)).then((function(s){t.resolveTaskStatus(s,r,n),t.notification&&t.notification.on("server_task",(function s(i){var o=i.data;try{var u=o.taskId===e&&o.status&&["Completed","Failed","Canceled"].includes(o.status),c=function(){if(u)return Promise.resolve(t.getTaskProgress(e)).then((function(e){t.notification&&t.notification.off("server_task",s),t.resolveTaskStatus(e,r,n)}))}();return Promise.resolve(c&&c.then?c.then((function(){})):void 0)}catch(e){return Promise.reject(e)}}))}))}catch(e){return Promise.reject(e)}})))}catch(e){return Promise.reject(e)}},r.resolveTaskStatus=function(e,t,r){"Completed"===e.status?t(e):"Failed"!==e.status&&"Canceled"!==e.status||r(e.status)},r.processTaskId=function(e){if(e)return this.waitTaskCompleted(e);throw new Error("Task was started with no testId")},t}(function(e){function t(){return e.apply(this,arguments)||this}l(t,e);var r=t.prototype;return r.getTaskList=function(e){return this.http.get("/services/tasks/tasks",{owners:e.owners,statuses:e.statuses,offset:e.offset,limit:e.limit}).json()},r.getTaskInfo=function(e){return this.http.get("/services/tasks/tasks/"+e).json()},r.getTaskProgress=function(e){return this.http.get("/services/tasks/tasks/"+e+"/progress").json()},r.cancelTask=function(e){return this.http.post("/services/tasks/tasks/"+e+"/cancel").then((function(){}))},r.startCopyTask=function(e){return this.http.post("/services/tasks/tasks",e,{type:"copy"}).json()},r.startAggregateTask=function(e){return this.http.post("/services/tasks/aggregate",e,{type:"aggregate"}).json()},r.startBufferTask=function(e){return this.http.post("/services/tasks/tasks",e,{type:"buffer"}).json()},r.startPrintTask=function(e){return this.http.post("/services/tasks/tasks",e,{type:"print"}).json()},r.startTilingTask=function(e){return this.http.post("/services/tasks/tasks",e,{type:"tiling"}).json()},r.startRouteTask=function(e){return this.http.post("/services/tasks/tasks",e,{type:"route"}).json()},r.startUnionTask=function(e){return this.http.post("/services/tasks/tasks",e,{type:"union"}).json()},r.startOverlayTask=function(e){return this.http.post("/services/tasks/tasks",e,{type:"overlay"}).json()},r.startFilterCopyTask=function(e){return this.http.post("/services/tasks/tasks",e,{type:"filterCopy"}).json()},r.startPipelineTask=function(e){return this.http.post("/services/tasks/tasks",e,{type:"pipeline"}).json()},t}(v)),L=function(e){try{return Promise.resolve(Promise.all(e.map((function(e){return e.catch((function(e){return x(e)?e:new Error(e)}))})))).then((function(e){return e.filter(I)}))}catch(e){return Promise.reject(e)}};function x(e){return e instanceof Error}function I(e){return!x(e)}var R,C=function(e){function t(){return e.apply(this,arguments)||this}l(t,e);var r=t.prototype;return r.getLayerInfos=function(e){var t=this;return L(e.map((function(e){return t.getLayerInfo(e)})))},r.getLayersDeps=function(e){var t=this;return L(e.map((function(e){return t.getResourceDependencies(e)})))},r.getBasemaps=function(e){return this.getLayersList(f({},e,{types:["LocalTileService","RemoteTileService"]}))},r.createSubLayer=function(e){return this.publishStyledLayerService(e)},r.createTileLayer=function(e){var t=e.remote,r=function(e,t){if(null==e)return{};var r,n,s={},i=Object.keys(e);for(n=0;n<i.length;n++)t.indexOf(r=i[n])>=0||(s[r]=e[r]);return s}(e,["remote"]);return t?this.publishRemoteTileService(r):this.publishLocalTileService(r)},r.uploadPreview=function(e,t){return this.setPreview({name:e,file:g(t)})},r.findOne=function(e){return this.getLayerInfo(e)},r.findAll=function(e){return this.getLayersList(f({},e,{types:["PostgresLayerService","PostgresTileLayerService","StyledFeatureLayer"]}))},r.create=function(e){return this.publishPostgresLayerService(e)},r.update=function(e){return this.updatePostgresLayerService({name:e.name,configuration:e})},r.remove=function(e){try{return Promise.resolve(this.deleteResource(e)).then((function(){return e}))}catch(e){return Promise.reject(e)}},t}(function(e){function t(){return e.apply(this,arguments)||this}l(t,e);var r=t.prototype;return r.getLayerInfo=function(e){return this.http.get("/layers/"+e).json()},r.deleteResource=function(e){return this.http.delete("/layers/"+e).then((function(){}))},r.getLayersList=function(e){return this.http.get("/layers",{filter:e.filter,types:e.types,offset:e.offset,limit:e.limit,orderByFields:e.orderByFields,isFavorite:e.isFavorite}).json()},r.publishRemoteTileService=function(e){return this.http.post("/layers",e,{type:"RemoteTileService"}).json()},r.publishLocalTileService=function(e){return this.http.post("/layers",e,{type:"LocalTileService"}).json()},r.publishPostgresLayerService=function(e){return this.http.post("/layers",e,{type:"PostgresLayerService"}).json()},r.publishPostgresTileCatalogService=function(e){return this.http.post("/layers",e,{type:"PostgresTileLayerService"}).json()},r.updateTileCatalogService=function(e){return this.http.patch("/layers/"+e.name,e.configuration,{type:"PostgresTileLayerService"}).json()},r.publishStyledLayerService=function(e){return this.http.post("/layers",e,{type:"StyledFeatureLayer"}).json()},r.publishCompositeService=function(e){return this.http.post("/layers",e,{type:"CompositeService"}).json()},r.updateRemoteTileService=function(e){return this.http.patch("/layers/"+e.name,e.configuration,{type:"RemoteTileService"}).json()},r.updateLocalTileService=function(e){return this.http.patch("/layers/"+e.name,e.configuration,{type:"LocalTileService"}).json()},r.updatePostgresLayerService=function(e){return this.http.patch("/layers/"+e.name,e.configuration,{type:"PostgresLayerService"}).json()},r.updateCompositeService=function(e){return this.http.patch("/layers/"+e.name,e.configuration,{type:"CompositeService"}).json()},r.reloadService=function(e){return this.http.get("/layers/"+e+"/reload").json()},r.getFeatures=function(e){return this.http.get("/layers/"+e.name+"/features",{query:e.query,offset:e.offset,limit:e.limit,wkid:e.wkid,sort:e.sort,withGeom:e.withGeom,attributes:e.attributes}).json()},r.createFeatures=function(e){return this.http.post("/layers/"+e.name+"/features",e.features).json()},r.deleteFeature=function(e){return this.http.delete("/layers/"+e.name+"/features",{id:e.id}).json()},r.updateFeature=function(e){return this.http.patch("/layers/"+e.name+"/features",e.features).json()},r.getById=function(e){return this.http.get("/layers/"+e.name+"/features/"+e.id,{wkid:e.wkid}).json()},r.getTilesLayerImage=function(e){return this.http.createUrl("/layers/"+e.name+"/tile/"+e.z+"/"+e.x+"/"+e.y,{ids:e.ids})},r.getLayerImage=function(e){return this.http.createUrl("/layers/"+e.name+"/export",{extent:e.extent,size:e.size,extentSr:e.extentSr,condition:e.condition,styleId:e.styleId})},r.getLayerExtent=function(e){return this.http.get("/layers/"+e.name+"/extent",{filterCondition:e.filterCondition,sr:e.sr}).json()},r.getByGeometry=function(e){return this.http.get("/layers/"+e.name+"/features/getByGeometry",{geometry:e.geometry,extentSr:e.extentSr,targetSr:e.targetSr}).json()},r.getByGeometryPost=function(e){return this.http.post("/layers/"+e.name+"/features/getByGeometry",e.geometry,{extentSr:e.extentSr,targetSr:e.targetSr}).json()},r.deleteFeatures=function(e){return this.http.delete("/layers/"+e.name+"/features/deleteByIds",{ids:e.ids}).json()},r.getByGeometryGet=function(e){return this.http.get("/layers/"+e.name+"/features/getByGeometryByClick",{imageRectangle:e.imageRectangle,envelope:e.envelope,clickPoint:e.clickPoint,extentSr:e.extentSr,targetSr:e.targetSr,useFilledSymbols:e.useFilledSymbols,query:e.query}).json()},r.classify=function(e){return this.http.get("/layers/"+e.name+"/classify",{attribute:e.attribute,classes:e.classes,precision:e.precision,type:e.type}).json()},r.distincts=function(e){return this.http.get("/layers/"+e.name+"/distincts",{attribute:e.attribute,limit:e.limit,startsWith:e.startsWith,ignoreDefaultCondition:e.ignoreDefaultCondition}).json()},r.getFilteredFeaturesCount=function(e){return this.http.get("/layers/"+e+"/features/count").json()},r.getPreview=function(e){return this.http.createUrl("/layers/"+e+"/preview")},r.setPreview=function(e){return this.http.post("/layers/"+e.name+"/preview",e.file).json()},r.deletePreview=function(e){return this.http.delete("/layers/"+e+"/preview").then((function(){}))},r.getResourceDependencies=function(e){return this.http.get("/layers/"+e+"/dependencies").json()},r.getResourceReferences=function(e){return this.http.get("/layers/"+e+"/references").json()},r.setPermissions=function(e){return this.http.put("/layers/"+e.name+"/permissions",e.data).json()},r.addPermissions=function(e){return this.http.post("/layers/"+e.name+"/permissions",e.data).json()},r.removePermissions=function(e){return this.http.delete("/layers/"+e.name+"/permissions/"+e.role).json()},t}(v)),F=function(e){function t(){return e.apply(this,arguments)||this}l(t,e);var r=t.prototype;return r.getTableInfos=function(e){var t=this;return L(e.map((function(e){return t.getTableInfo(e)})))},r.uploadPreview=function(e,t){return this.setPreview({name:e,file:g(t)})},r.findOne=function(e){return this.getTableInfo(e)},r.findAll=function(e){return this.getTableList(e)},r.create=function(e){return this.createTable(e)},r.update=function(e){return this.updateTable({name:e.name,data:e})},r.remove=function(e){try{return Promise.resolve(this.deleteResource(e)).then((function(){return e}))}catch(e){return Promise.reject(e)}},t}(function(e){function t(){return e.apply(this,arguments)||this}l(t,e);var r=t.prototype;return r.getTableList=function(e){return this.http.get("/tables",{filter:e.filter,offset:e.offset,limit:e.limit,orderByFields:e.orderByFields,isFavorite:e.isFavorite}).json()},r.createTable=function(e){return this.http.post("/tables",e).json()},r.getTableInfo=function(e){return this.http.get("/tables/"+e).json()},r.deleteResource=function(e){return this.http.delete("/tables/"+e).then((function(){}))},r.updateTable=function(e){return this.http.patch("/tables/"+e.name,e.data).json()},r.getResourceReferences=function(e){return this.http.get("/tables/"+e+"/references").json()},r.getResourceDependencies=function(e){return this.http.get("/tables/"+e+"/dependencies").json()},r.setPermissions=function(e){return this.http.put("/tables/"+e.name+"/permissions",e.data).json()},r.addPermissions=function(e){return this.http.post("/tables/"+e.name+"/permissions",e.data).json()},r.removePermissions=function(e){return this.http.delete("/tables/"+e.name+"/permissions/"+e.role).json()},r.getPreview=function(e){return this.http.createUrl("/tables/"+e+"/preview")},r.setPreview=function(e){return this.http.post("/tables/"+e.name+"/preview",e.file).json()},r.deletePreview=function(e){return this.http.delete("/tables/"+e+"/preview").then((function(){}))},t}(v)),E=function(e){function t(){return e.apply(this,arguments)||this}l(t,e);var r=t.prototype;return r.getProjectInfos=function(e){var t=this;return L(e.map((function(e){return t.getProjectInfo(e)})))},r.getProjectsDeps=function(e){var t=this;return L(e.map((function(e){return t.getResourceDependencies(e)})))},r.uploadPreview=function(e,t){return this.setPreview({name:e,file:g(t)})},r.findOne=function(e){return this.getProjectInfo(e)},r.findAll=function(e){return this.getProjectsList(e)},r.create=function(e){return this.createProject(e)},r.update=function(e){return this.updateProject({name:e.name,info:e})},r.remove=function(e){try{return Promise.resolve(this.deleteResource(e)).then((function(){return e}))}catch(e){return Promise.reject(e)}},t}(function(e){function t(){return e.apply(this,arguments)||this}l(t,e);var r=t.prototype;return r.getProjectsList=function(e){return this.http.get("/projects",{filter:e.filter,offset:e.offset,limit:e.limit,orderByFields:e.orderByFields,isFavorite:e.isFavorite}).json()},r.createProject=function(e){return this.http.post("/projects",e).json()},r.createShareProject=function(e){return this.http.post("/projects/"+e.name+"/share",e.configuration).json()},r.removeShareProject=function(e){return this.http.delete("/projects/"+e+"/share").then((function(){}))},r.getProjectInfo=function(e){return this.http.get("/projects/"+e).json()},r.deleteResource=function(e){return this.http.delete("/projects/"+e).then((function(){}))},r.updateProject=function(e){return this.http.patch("/projects/"+e.name,e.info).json()},r.getResourceDependencies=function(e){return this.http.get("/projects/"+e+"/dependencies").json()},r.getResourceReferences=function(e){return this.http.get("/projects/"+e+"/references").json()},r.setPermissions=function(e){return this.http.put("/projects/"+e.name+"/permissions",e.data).json()},r.addPermissions=function(e){return this.http.post("/projects/"+e.name+"/permissions",e.data).json()},r.removePermissions=function(e){return this.http.delete("/projects/"+e.name+"/permissions/"+e.role).json()},r.getPreview=function(e){return this.http.createUrl("/projects/"+e+"/preview")},r.setPreview=function(e){return this.http.post("/projects/"+e.name+"/preview",e.file).json()},r.deletePreview=function(e){return this.http.delete("/projects/"+e+"/preview").then((function(){}))},t}(v));function D(e,t,r){return r.indexOf(e)===t}function B(e){return"string"==typeof e}!function(e){e.Layer="Service",e.Table="Table"}(R||(R={}));var N,U=function(){function e(e,t,r){this.projects=e,this.layers=t,this.tables=r}var t=e.prototype;return t.getProjectInfosWithDeps=function(e){try{var t=this;return Promise.resolve(t.projects.getProjectInfos(e)).then((function(r){return Promise.resolve(t.projects.getProjectsDeps(e)).then((function(e){return Promise.resolve(t.getDependencies(e,!0,!0)).then((function(e){return{projects:r,deps:{layers:e.layers,tables:e.tables}}}))}))}))}catch(e){return Promise.reject(e)}},t.getLayerInfosWithDeps=function(e){try{var t=this;return Promise.resolve(t.layers.getLayerInfos(e)).then((function(r){return Promise.resolve(t.layers.getLayersDeps(e)).then((function(e){return Promise.resolve(t.getDependencies(e,!1,!0)).then((function(e){return{layers:r,deps:{tables:e.tables}}}))}))}))}catch(e){return Promise.reject(e)}},t.getDependencies=function(e,t,r){try{var n=this,s=e.reduce((function(e,s){var i=s.dependencies||[];if(t){var o,u=n.getDependentNames(i,R.Layer);(o=e.layers).push.apply(o,u)}if(r){var c,a=n.getDependentNames(i,R.Table);(c=e.tables).push.apply(c,a)}return e}),{tables:[],layers:[]}),i=s.layers;return Promise.resolve(n.tables.getTableInfos(s.tables.filter(D))).then((function(e){return Promise.resolve(n.layers.getLayerInfos(i.filter(D))).then((function(t){return{tables:e,layers:t}}))}))}catch(e){return Promise.reject(e)}},t.getDependentNames=function(e,t){return e.filter((function(e){return e.type===t})).map((function(e){return e.name})).filter(B)},e}(),O=function(e){function t(){return e.apply(this,arguments)||this}return l(t,e),t}(function(e){function t(){return e.apply(this,arguments)||this}l(t,e);var r=t.prototype;return r.getStyle=function(e){return this.http.get("/services/styles/"+e).json()},r.updateStyle=function(e){return this.http.post("/services/styles/"+e.id,e.style).json()},r.createStyle=function(e){return this.http.post("/services/styles",e).json()},r.getAllFonts=function(){return this.http.get("/services/styles/fonts").json()},t}(v)),_=function(e){function t(){return e.apply(this,arguments)||this}return l(t,e),t}(function(e){function t(){return e.apply(this,arguments)||this}l(t,e);var r=t.prototype;return r.geocode=function(e){return this.http.get("/"+this.name+"/geocode",{address:e.address,sr:e.sr}).json()},r.geocodeByPoint=function(e){return this.http.get("/"+this.name+"/geocodeByPoint",{pointGeometry:e.pointGeometry,pointSr:e.pointSr}).json()},r.suggest=function(e){return this.http.get("/"+this.name+"/suggest",{address:e}).json()},r.getServiceInfo=function(){return this.http.get("/"+this.name).json()},r.deleteService=function(){return this.http.delete("/"+this.name).then((function(){}))},r.getPermissions=function(){return this.http.get("/"+this.name+"/permissions").json()},r.setPermissions=function(e){return this.http.post("/"+this.name+"/permissions",null,{Acl:e}).json()},r.addPermissions=function(e){return this.http.post("/"+this.name+"/permissions/add",null,{acl:e}).json()},r.removePermissions=function(e){return this.http.post("/"+this.name+"/permissions/remove",null,{Acl:e}).json()},r.getPreview=function(e){return this.http.createUrl("/"+this.name+"/preview",{resourceName:e})},r.setPreview=function(e){return this.http.post("/"+this.name+"/preview",e).then((function(){}))},t}(v)),M=function(e){function t(){return e.apply(this,arguments)||this}return l(t,e),t}(function(e){function t(){return e.apply(this,arguments)||this}l(t,e);var r=t.prototype;return r.getProjects=function(e){return this.http.get("/services/resources/projects",{filter:e.filter,offset:e.offset,limit:e.limit,orderByFields:e.orderByFields,isFavorite:e.isFavorite}).json()},r.getTables=function(e){return this.http.get("/services/resources/tables",{filter:e.filter,offset:e.offset,limit:e.limit,orderByFields:e.orderByFields,isFavorite:e.isFavorite}).json()},r.getLayers=function(e){return this.http.get("/services/resources/layers",{filter:e.filter,types:e.types,offset:e.offset,limit:e.limit,orderByFields:e.orderByFields,isFavorite:e.isFavorite}).json()},r.addResource=function(e){return this.http.post("/services/resources/"+e.resourceType+"/add",e.catalogData).then((function(){}))},r.addResources=function(e){return this.http.post("/services/resources/add",e.resources,{userName:e.userName}).then((function(){}))},r.removeResource=function(e){return this.http.post("/services/resources/"+e.resourceType+"/remove",e.catalogData).then((function(){}))},r.getNewResources=function(){return this.http.get("/services/resources/getNewResources").json()},r.touchResources=function(e){return this.http.post("/services/resources/"+e.resourceType+"/touchResources",e.resources).then((function(){}))},r.shareResources=function(e){return this.http.post("/services/resources/"+e.resourceType+"/shareAll",e.resources).json()},r.unshareResources=function(e){return this.http.post("/services/resources/"+e.resourceType+"/unshareAll",e.resources).json()},r.copyResources=function(e){return this.http.post("/services/resources/copy",e).json()},r.getResource=function(e){return this.http.get("/services/resources/"+e.resourceType+"/"+e.name).then((function(){}))},r.removeResourceDelete=function(e){return this.http.delete("/services/resources/"+e.resourceType,{resource:e.resource,users:e.users}).then((function(){}))},r.checkLimits=function(e){return this.http.get("/services/resources/checkLimits",{workspace:e}).json()},t}(v)),A=function(e){function t(){return e.apply(this,arguments)||this}return l(t,e),t}(function(e){function t(){return e.apply(this,arguments)||this}l(t,e);var r=t.prototype;return r.getTools=function(){return this.http.get("/tools").json()},r.reloadTools=function(){return this.http.post("/tools/reload").json()},r.getToolDescription=function(e){return this.http.get("/tools/"+e).json()},r.evaluateTool=function(e){return this.http.post("/tools/"+e.name+"/evaluate",e.inputParameters,{promo:e.promo}).json()},r.executeTool=function(e){return this.http.post("/tools/"+e.name+"/run",e.inputParameters,{promo:e.promo}).json()},r.getToolAcl=function(e){return this.http.get("/tools/"+e+"/permissions").json()},r.setPermissions=function(e){return this.http.put("/tools/"+e.name+"/permissions",e.data).json()},r.addPermissions=function(e){return this.http.post("/tools/"+e.name+"/permissions",e.data).json()},r.removePermissions=function(e){return this.http.delete("/tools/"+e.name+"/permissions/"+e.role).json()},r.getToolsLists=function(e){return this.http.get("/tools/journal",{types:e.types,status:e.status}).json()},r.getTool=function(e){return this.http.get("/tools/journal/"+e).json()},r.cancelExecute=function(e){return this.http.post("/tools/"+e+"/cancel").then((function(){}))},r.getToolResult=function(e){return this.http.post("/tools/"+e.id+"/result",e.data).json()},r.uploadScriptFile=function(e){return this.http.post("/tools/upload",e).then((function(){}))},r.deleteScriptTool=function(e){return this.http.delete("/tools/"+e).then((function(){}))},t}(v)),W=function(){function e(e){this.prefixUrl=e,this.ky=n.extend({prefixUrl:e})}var t=e.prototype;return t.extend=function(e){this.ky=n.extend(e)},t.get=function(e,t){return this.ky.get(this.stripSlashes(e),{searchParams:G(t)})},t.post=function(e,t,r){var n=H(r,t);return this.ky.post(this.stripSlashes(e),n)},t.put=function(e,t,r){var n=H(r,t);return this.ky.put(this.stripSlashes(e),n)},t.patch=function(e,t,r){var n=H(r,t);return this.ky.patch(this.stripSlashes(e),n)},t.delete=function(e,t){return this.ky.delete(this.stripSlashes(e),{searchParams:G(t)})},t.createUrl=function(e,t){var r=t?"?"+G(t):"";return this.prefixUrl+this.stripSlashes(e)+r},t.stripSlashes=function(e){return this.prefixUrl?e.replace(/^\//g,""):e},e}();function H(e,t){var r,n={searchParams:G(e)};return void 0!==(r=t)&&"object"==typeof r&&null!==r&&r.constructor===Object||Array.isArray(t)?n.json=t:n.body=t,n}function G(e){return void 0===e&&(e={}),s.stringify(e,{arrayFormat:"comma"})}(N=exports.ErrorReason||(exports.ErrorReason={})).HTTP_OTHER="other",N.HTTP_CLIENT="client",N.HTTP_SERVER="server",N.UNKNOWN="unknown";var q,z=function(e){return e instanceof r.HTTPError?function(e){var t=e.response.status,r=exports.ErrorReason.HTTP_OTHER;return t>=400&&t<500&&(r=exports.ErrorReason.HTTP_CLIENT),t>=500&&(r=exports.ErrorReason.HTTP_SERVER),{type:"http",reason:r,status:t,origin:e}}(e):function(e){return{type:"base",reason:exports.ErrorReason.UNKNOWN,origin:e}}(e)},Q=function(e){return e&&e.type&&e.reason};(q=exports.ApiEvent||(exports.ApiEvent={})).ConnectionLost="ConnectionLost",q.Unauthorized="Unauthorized";var K,V={401:exports.ApiEvent.Unauthorized,403:exports.ApiEvent.ConnectionLost},X=function(e){function t(t,n){var s;return(s=e.call(this,t)||this).extend({prefixUrl:t,timeout:!1,hooks:{afterResponse:[function(e){var t=V[e.status];return n&&t&&n.emit(t,z(new r.HTTPError(e))),e}]}}),s}return l(t,e),t}(W),J=function(e){function t(){return e.apply(this,arguments)||this}return l(t,e),t}(function(e){function t(){return e.apply(this,arguments)||this}l(t,e);var r=t.prototype;return r.print=function(e){return this.http.post("/services/print/print",e).blob()},r.getTemplates=function(){return this.http.get("/services/print/templates").json()},r.uploadTemplate=function(e){return this.http.post("/services/print/templates",e.template,{name:e.name,rewrite:e.rewrite}).then((function(){}))},r.getTemplate=function(e){return this.http.get("/services/print/templates/"+e).json()},r.deleteTemplate=function(e){return this.http.delete("/services/print/templates/"+e).then((function(){}))},t}(v)),Y=function(e){function t(t){var r,n=t.url,s=t.wsUrl,i=t.config,o=void 0===i?m:i;return(r=e.call(this)||this).http=new X(n,function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(r)),r.url=n,r.wsUrl=s||n,r.layers=new C(o.Layers,r.http),r.tables=new F(o.Tables,r.http),r.projects=new E(o.Projects,r.http),r.resources=new U(r.projects,r.layers,r.tables),r.styles=new O(o.Styles,r.http),r.security=new d(o.PostgresSecurityService,r.http),r.notification=new T(o.NotificationService,r.http),r.scheduler=new w(o.SchedulerService,r.http),r.file=new j(o.FileUploadService,r.http),r.import=new S(o.ImportService,r.http),r.geocode=new _(o.GeocodeService,r.http),r.print=new J(o.PrintService,r.http),r.tools=new A(o.Tools,r.http),r.resourceCatalog=new M(o.ResourceCatalogService,r.http),r}l(t,e);var r=t.prototype;return r.init=function(e){try{var t=this;return Promise.resolve(y((function(){return Promise.resolve(t.connectSp(e)).then((function(){return Promise.resolve(t.connectWs()).then((function(){return Promise.resolve(t.initScheduler()).then((function(){}))}))}))}),(function(e){throw z(e)})))}catch(e){return Promise.reject(e)}},r.connectSp=function(e){return this.security.login(e)},r.connectWs=function(){try{var e=this,t=function(){if(e.security.sessionId)return Promise.resolve(e.notification.connectWs(e.wsUrl,e.security.sessionId)).then((function(){e.notification.on("ConnectionStatus",(function(t){t.data===exports.ConnectionStatus.Lost&&e.emit(exports.ApiEvent.ConnectionLost,t.data)}))}))}();return Promise.resolve(t&&t.then?t.then((function(){})):void 0)}catch(e){return Promise.reject(e)}},r.initScheduler=function(){return this.scheduler.init(this.notification)},t}(t.EventEmitter),Z=function(e){return window.location.host.includes("localhost")?window.location.protocol+"//"+e+".devpublic.everpoint.ru":window.location.protocol+"//"+e+"."+window.location.host},$=function(e){function t(t,r){var n;return(n=e.call(this,(function(e,s,i){var o=n.subDomains||t.subDomains,u=o&&o[(e+s+i)%o.length],c=r.layers.getTilesLayerImage({x:e,y:s,z:i,name:n.name||t.name});return u?""+Z(u)+c:c}))||this).name=t.name,n.subDomains=t.subDomains,n}return l(t,e),t}(u.TileLayer),ee=function(e){function t(t,r){var n;return(n=e.call(this)||this).api=r,n.name=t.name,n.styleId=t.style,n.conditionQuery=t.condition,n.subscribeRedraw(),n}l(t,e);var r=t.prototype;return r.getUrl=function(e,t){var r=Math.round((e.xMax-e.xMin)/t),n=Math.round((e.yMax-e.yMin)/t);return this.api.layers.getLayerImage({name:this.name,extent:e.coordinates,size:[r,n],extentSr:e.crs.wkid,styleId:this.styleId,condition:this.conditionQuery})},r.subscribeRedraw=function(){var e=this,t="service_update_"+this.name.replace(/\//g,"_");this.api.notification.subscribe(t).then((function(){e.api.notification.on(t,(function(){e.forceUpdate(),e.redraw()}))}))},h(t,[{key:"style",set:function(e){this.styleId=e,this.forceUpdate()},get:function(){return this.styleId}},{key:"condition",set:function(e){this.conditionQuery=e,this.forceUpdate()},get:function(){return this.conditionQuery}}]),t}(c.DynamicLayer),te={RemoteTileService:$,LocalTileService:$,PostgresLayerService:ee,StyledFeatureLayer:ee,CompositeService:null},re=function(){function e(e,t){this.layers=e,this.http=t}var t=e.prototype;return t.getLayerService=function(e){try{var t=this;return Promise.resolve(t.getLayerInfo(e)).then((function(e){var r=e.type;if(function(e){return Boolean(e&&Object.keys(te).includes(e))}(r)){var n=te[r];if(n)return new n(function(e){return f({},e,{name:"services/"+e.name})}(e),t.http);throw new Error('Constructor for service type: "'+e.type+'" not implemented')}}))}catch(e){return Promise.reject(e)}},t.getLayerInfo=function(e){try{var t=this;return Promise.resolve(y((function(){return Promise.resolve(t.layers.getLayerInfo(e))}),(function(){throw new Error('Service with name: "'+e+'" not exists')})))}catch(e){return Promise.reject(e)}},e}();!function(e){e[e.BaseMaps=0]="BaseMaps",e[e.Layers=1]="Layers"}(K||(K={}));var ne=function(e){function t(t,r,n){var s;return(s=e.call(this,r)||this).map=new o.Map,s.painter=new i.DomPainter(s.map),s.mapProps=t,s.auth=n,s.layersManager=new re(s.layers,s.http),s}l(t,e);var r=t.prototype;return r.init=function(){try{var t=this;return Promise.resolve(e.prototype.init.call(t,t.auth)).then((function(){function e(){function e(){function e(){t.setMapProps()}var r=function(){if(i)return Promise.resolve(t.loadProject(i)).then((function(){}))}();return r&&r.then?r.then(e):e()}var r=function(){if(s)return Promise.resolve(Promise.all(s.map((function(e){return t.addLayer(e)})))).then((function(){}))}();return r&&r.then?r.then(e):e()}var r=t.mapProps,n=r.baseService,s=r.services,i=r.projectName,o=function(){if(n)return Promise.resolve(t.setBaseMap(n)).then((function(){}))}();return o&&o.then?o.then(e):e()}))}catch(e){return Promise.reject(e)}},r.reset=function(){try{var e=this;return Promise.resolve(e.security.logout()).then((function(){e.painter.wrapper=null}))}catch(e){return Promise.reject(e)}},r.addLayer=function(e){try{return Promise.resolve(this.insertLayer(e,K.Layers)).then((function(){}))}catch(e){return Promise.reject(e)}},r.setBaseMap=function(e){try{return Promise.resolve(this.insertLayer(e,K.BaseMaps)).then((function(){}))}catch(e){return Promise.reject(e)}},r.loadProject=function(e){try{var t=this;return Promise.resolve(t.projects.getProjectInfo(e)).then((function(e){function r(){var e=function(){if(i){var e=i.map((function(e){return e.name})).filter(se);return Promise.resolve(Promise.all(e.map((function(e){return t.addLayer(e)})))).then((function(){}))}}();if(e&&e.then)return e.then((function(){}))}if(e&&e.content){var n=e.content,s=n.baseMapName,i=n.items,o=function(){if(s)return Promise.resolve(t.setBaseMap(s)).then((function(){}))}();return o&&o.then?o.then(r):r()}}))}catch(e){return Promise.reject(e)}},r.insertLayer=function(e,t){try{var r=this;return Promise.resolve(r.layersManager.getLayerService(e)).then((function(e){e&&r.map.insertLayer(e.layer,t)}))}catch(e){return Promise.reject(e)}},r.setMapProps=function(){var e=this.mapProps,t=e.position,r=e.centerPoint,n=e.mapWrapper,s=e.resolution;t?this.map.position=t:r&&(this.map.centerPoint=r),s&&(this.map.resolution=s),n&&(this.painter.wrapper=n)},t}(Y),se=function(e){return void 0!==e};function ie(e){return function(t){return!!t.type&&e.includes(t.type)}}var oe=ie(["PostgresLayerService","PostgresTileLayerService"]);Object.defineProperty(exports,"HTTPError",{enumerable:!0,get:function(){return r.HTTPError}}),Object.defineProperty(exports,"TimeoutError",{enumerable:!0,get:function(){return r.TimeoutError}}),exports.Api=Y,exports.EvergisDynamicLayer=ee,exports.EvergisTileLayer=$,exports.ExtendedHttpClient=X,exports.FileUpload=j,exports.Geocode=_,exports.HttpClient=W,exports.Import=S,exports.Layers=C,exports.LayersManager=re,exports.Notification=T,exports.NotificationEvent=k,exports.Projects=E,exports.ResourceCatalog=M,exports.Resources=U,exports.Scheduler=w,exports.Security=d,exports.SpatialProcessor=ne,exports.Styles=O,exports.Tables=F,exports.Tools=A,exports.addSubDomainToLocation=Z,exports.errorHandler=z,exports.formDataFromFile=g,exports.isEvergisDynamicLayer=function(e){return e instanceof ee},exports.isEvergisTileLayer=function(e){return e instanceof $},exports.isFeatureLayer=function(e){return e instanceof a.FeatureLayer},exports.isHTTPError=function(e){return Q(e)&&"http"===e.type},exports.isHandledError=Q,exports.isLayer=oe,exports.isProjectContentItems=function(e){return null!=e},exports.isString=B,exports.isTileLayerService=function(e){return e.type&&/TileService/.test(e.type)},exports.promiseAllIgnoreErrors=L,exports.unique=D;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("@evergis/event-emitter"),r=require("ky"),n=(e=r)&&"object"==typeof e&&"default"in e?e.default:e,s=require("query-string"),i=require("@evergis/sgis/es/painters/DomPainter/DomPainter"),o=require("@evergis/sgis/es/Map"),u=require("@evergis/sgis/es/layers/TileLayer"),a=require("@evergis/sgis/es/layers/DynamicLayer"),c=require("@evergis/sgis");function l(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function p(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function h(e,t,r){return t&&p(e.prototype,t),r&&p(e,r),e}function f(){return(f=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function y(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function v(e){return(v=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function m(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function d(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?m(e):t}function k(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=v(e);if(t){var s=v(this).constructor;r=Reflect.construct(n,arguments,s)}else r=n.apply(this,arguments);return d(this,r)}}function g(e,t,r){return(g="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=v(e)););return e}(e,t);if(n){var s=Object.getOwnPropertyDescriptor(n,t);return s.get?s.get.call(r):s.value}})(e,t,r||e)}function P(e,t){try{var r=e()}catch(e){return t(e)}return r&&r.then?r.then(void 0,t):r}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var j={ServiceManagerService:{name:"services",type:"ServiceManagerService"},PostgresDataService:{name:"services/data",type:"PostgresDataService"},ImportService:{name:"services/import",type:"ImportService"},GeocodeService:{name:"services/geocode2gis",type:"GeocodeService"},PrintService:{name:"services/print",type:"PrintService"},NotificationService:{name:"services/notifications",type:"NotificationService"},PostgresProjectService:{name:"services/projects",type:"PostgresProjectService"},ResourceCatalogService:{name:"services/resources",type:"ResourceCatalogService"},PostgresSecurityService:{name:"services/security",type:"PostgresSecurityService"},SchedulerService:{name:"services/tasks",type:"SchedulerService"},FileUploadService:{name:"services/upload",type:"FileUploadService"},Layers:{name:"layers",type:"Layers"},Tables:{name:"tables",type:"Tables"},Projects:{name:"projects",type:"Projects"},Styles:{name:"services/styles",type:""},Tools:{name:"services/tools",type:""}},S=function(){function e(t,r){l(this,e),this.info=t,this.http=r}return h(e,[{key:"name",get:function(){return this.info.name}}]),e}(),b=function(e){y(r,S);var t=k(r);function r(){return l(this,r),t.apply(this,arguments)}return h(r,[{key:"findUserByName",value:function(e){return this.http.get("/services/security/users",{startWith:e}).json()}},{key:"getSessionToken",value:function(e){return this.http.post("/services/security/authorize",e).json()}},{key:"getOpenSessions",value:function(){return this.http.get("/services/security/sessions").json()}},{key:"closeSession",value:function(e){return this.http.delete("/services/security/sessions",{id:e}).json()}}]),r}(),T=function(e){y(r,b);var t=k(r);function r(){return l(this,r),t.apply(this,arguments)}return h(r,[{key:"login",value:function(e){try{var t=this;return Promise.resolve(t.getSessionToken(e)).then((function(e){var r=e.owner;t.sessionId=e.token,t.user=r}))}catch(e){return Promise.reject(e)}}},{key:"logout",value:function(){try{return Promise.resolve(this.closeSession(this.sessionId||"")).then((function(){}))}catch(e){return Promise.reject(e)}}}]),r}(),w=function(e){y(r,S);var t=k(r);function r(){return l(this,r),t.apply(this,arguments)}return h(r,[{key:"downloadFile",value:function(e){return this.http.get("/services/upload/file",{fileName:e}).then((function(){}))}},{key:"uploadFile",value:function(e){return this.http.post("/services/upload/file",e).json()}}]),r}();function L(e){var t=new FormData;return t.append("file",e),t}var x,R=function(e){y(r,w);var t=k(r);function r(){return l(this,r),t.apply(this,arguments)}return h(r,[{key:"upload",value:function(e,t){var r=L(e);return r.append("rewrite",""+!!t),this.uploadFile(r)}}]),r}(),I=function(e){y(r,S);var t=k(r);function r(){return l(this,r),t.apply(this,arguments)}return h(r,[{key:"getDataSchema",value:function(e){return this.http.get("/services/import/dataSchema",{fileId:e}).json()}},{key:"getExcelDataSchema",value:function(e){return this.http.get("/services/import/excelDataSchema",{fileId:e.fileId,attributeNameRowNumber:e.attributeNameRowNumber,aliasRowNumber:e.aliasRowNumber}).json()}},{key:"getRasterAttributes",value:function(e){return this.http.get("/services/import/rasterAttributes",{fileName:e}).json()}}]),r}(),C=function(e){y(r,I);var t=k(r);function r(){return l(this,r),t.apply(this,arguments)}return r}(),F=function(e){y(r,S);var t=k(r);function r(){return l(this,r),t.apply(this,arguments)}return h(r,[{key:"getSubscriptionList",value:function(){return this.http.get("/services/notifications/subscribes").json()}},{key:"subscribeOperation",value:function(e){return this.http.post("/services/notifications/subscribes",null,{tag:e}).then((function(){}))}},{key:"unsubscribeOperation",value:function(e){return this.http.delete("/services/notifications/subscribes",{tag:e}).then((function(){}))}},{key:"getNotifications",value:function(){return this.http.get("/services/notifications/notifications").json()}},{key:"subscribeListOperation",value:function(e){return this.http.post("/services/notifications/subscribe-list",e).then((function(){}))}},{key:"unsubscribeListOperation",value:function(e){return this.http.post("/services/notifications/unsubscribe-list",e).then((function(){}))}}]),r}();(x=exports.ConnectionStatus||(exports.ConnectionStatus={})).Initialized="Initialized",x.Connected="Connected",x.Break="Break",x.Lost="Lost";var E=function(e){y(n,F);var r=k(n);function n(e,s){var i;return l(this,n),(i=r.call(this,e,s)).MAX_WS_RECONNECT_TRIES=10,i.reconnectTries=0,i.subscribeList=[],i._connectStatus=exports.ConnectionStatus.Initialized,i.onWsConnected=function(){i.connectStatus=exports.ConnectionStatus.Connected},i.onWsClosed=function(){i.reconnectTries<i.MAX_WS_RECONNECT_TRIES?(i.connectStatus=exports.ConnectionStatus.Break,i.reconnectTries++,i.connect()):i.connectStatus=exports.ConnectionStatus.Lost},i.onWsMessage=function(e){var t={};try{t=JSON.parse(e.data)}catch(e){}if("notification"===t.type&&t.data){var r=t.data,n=r.tag;n&&i.emitter.emit(n,new D(r.data))}},i.emitter=new t.EventEmitter,i}return h(n,[{key:"on",value:function(e,t){this.emitter.on(e,t)}},{key:"off",value:function(e,t){this.emitter.off(e,t)}},{key:"subscribe",value:function(e){try{var t=this;return t.subscribeList.push(e),setTimeout((function(){t.subscribeList.length&&t.subscribeListOperation(t.subscribeList),t.subscribeList=[]}),500),Promise.resolve()}catch(e){return Promise.reject(e)}}},{key:"unsubscribe",value:function(e){try{var t=this;return Promise.resolve(t.getSubscriptionList()).then((function(r){if(r.includes(e))return t.unsubscribeOperation(e)}))}catch(e){return Promise.reject(e)}}},{key:"connectWs",value:function(e,t){var r=e.replace("http://","ws://").replace("https://","wss://");this.wsUrl=r+"?_sb="+encodeURIComponent(t||""),this.connect()}},{key:"connect",value:function(){this.wsUrl&&(this.ws=new WebSocket(this.wsUrl),this.ws.onopen=this.onWsConnected,this.ws.onclose=this.onWsClosed,this.ws.onmessage=this.onWsMessage)}},{key:"connectStatus",get:function(){return this._connectStatus},set:function(e){this.emitter.emit("ConnectionStatus",new D(e)),this._connectStatus=e}}]),n}(),D=function e(t){l(this,e),this.data=t},O=function(e){y(r,S);var t=k(r);function r(){return l(this,r),t.apply(this,arguments)}return h(r,[{key:"getTaskList",value:function(e){return this.http.get("/services/tasks/tasks",{owners:e.owners,statuses:e.statuses,offset:e.offset,limit:e.limit}).json()}},{key:"getTaskInfo",value:function(e){return this.http.get("/services/tasks/tasks/"+e).json()}},{key:"getTaskProgress",value:function(e){return this.http.get("/services/tasks/tasks/"+e+"/progress").json()}},{key:"cancelTask",value:function(e){return this.http.post("/services/tasks/tasks/"+e+"/cancel").then((function(){}))}},{key:"startCopyTask",value:function(e){return this.http.post("/services/tasks/tasks",e,{type:"copy"}).json()}},{key:"startAggregateTask",value:function(e){return this.http.post("/services/tasks/aggregate",e,{type:"aggregate"}).json()}},{key:"startBufferTask",value:function(e){return this.http.post("/services/tasks/tasks",e,{type:"buffer"}).json()}},{key:"startPrintTask",value:function(e){return this.http.post("/services/tasks/tasks",e,{type:"print"}).json()}},{key:"startTilingTask",value:function(e){return this.http.post("/services/tasks/tasks",e,{type:"tiling"}).json()}},{key:"startRouteTask",value:function(e){return this.http.post("/services/tasks/tasks",e,{type:"route"}).json()}},{key:"startUnionTask",value:function(e){return this.http.post("/services/tasks/tasks",e,{type:"union"}).json()}},{key:"startOverlayTask",value:function(e){return this.http.post("/services/tasks/tasks",e,{type:"overlay"}).json()}},{key:"startFilterCopyTask",value:function(e){return this.http.post("/services/tasks/tasks",e,{type:"filterCopy"}).json()}},{key:"startPipelineTask",value:function(e){return this.http.post("/services/tasks/tasks",e,{type:"pipeline"}).json()}}]),r}(),B=function(e){y(r,O);var t=k(r);function r(){return l(this,r),t.apply(this,arguments)}return h(r,[{key:"init",value:function(e){return this.notification=e,this.notification.subscribe("server_task")}},{key:"runCopyTask",value:function(e){try{var t=this;return Promise.resolve(t.startCopyTask(e)).then((function(e){return t.processTaskId(e.taskId)}))}catch(e){return Promise.reject(e)}}},{key:"runBufferTask",value:function(e){try{var t=this;return Promise.resolve(t.startBufferTask(e)).then((function(e){return t.processTaskId(e.taskId)}))}catch(e){return Promise.reject(e)}}},{key:"runUnionTask",value:function(e){try{var t=this;return Promise.resolve(t.startUnionTask(e)).then((function(e){return t.processTaskId(e.taskId)}))}catch(e){return Promise.reject(e)}}},{key:"runPrintTask",value:function(e){try{var t=this;return Promise.resolve(t.startPrintTask(e)).then((function(e){return t.processTaskId(e.taskId)}))}catch(e){return Promise.reject(e)}}},{key:"runRouteTask",value:function(e){try{var t=this;return Promise.resolve(t.startRouteTask(e)).then((function(e){return t.processTaskId(e.taskId)}))}catch(e){return Promise.reject(e)}}},{key:"runOverlayTask",value:function(e){try{var t=this;return Promise.resolve(t.startOverlayTask(e)).then((function(e){return t.processTaskId(e.taskId)}))}catch(e){return Promise.reject(e)}}},{key:"runFilterCopyTask",value:function(e){try{var t=this;return Promise.resolve(t.startFilterCopyTask(e)).then((function(e){return t.processTaskId(e.taskId)}))}catch(e){return Promise.reject(e)}}},{key:"runPipelineTask",value:function(e){try{var t=this;return Promise.resolve(t.startPipelineTask(e)).then((function(e){return t.processTaskId(e.taskId)}))}catch(e){return Promise.reject(e)}}},{key:"waitTaskCompleted",value:function(e){try{var t=this;return Promise.resolve(new Promise((function(r,n){try{return Promise.resolve(t.getTaskProgress(e)).then((function(s){t.resolveTaskStatus(s,r,n),t.notification&&t.notification.on("server_task",(function s(i){var o=i.data;try{var u=o.taskId===e&&o.status&&["Completed","Failed","Canceled"].includes(o.status),a=function(){if(u)return Promise.resolve(t.getTaskProgress(e)).then((function(e){t.notification&&t.notification.off("server_task",s),t.resolveTaskStatus(e,r,n)}))}();return Promise.resolve(a&&a.then?a.then((function(){})):void 0)}catch(e){return Promise.reject(e)}}))}))}catch(e){return Promise.reject(e)}})))}catch(e){return Promise.reject(e)}}},{key:"resolveTaskStatus",value:function(e,t,r){"Completed"===e.status?t(e):"Failed"!==e.status&&"Canceled"!==e.status||r(e.status)}},{key:"processTaskId",value:function(e){if(e)return this.waitTaskCompleted(e);throw new Error("Task was started with no testId")}}]),r}(),N=function(e){try{return Promise.resolve(Promise.all(e.map((function(e){return e.catch((function(e){return U(e)?e:new Error(e)}))})))).then((function(e){return e.filter(_)}))}catch(e){return Promise.reject(e)}};function U(e){return e instanceof Error}function _(e){return!U(e)}var M,A=function(e){y(r,e);var t=k(r);function r(){return l(this,r),t.apply(this,arguments)}return h(r,[{key:"getLayerInfos",value:function(e){var t=this;return N(e.map((function(e){return t.getLayerInfo(e)})))}},{key:"getLayersDeps",value:function(e){var t=this;return N(e.map((function(e){return t.getResourceDependencies(e)})))}},{key:"getBasemaps",value:function(e){return this.getLayersList(f({},e,{types:["LocalTileService","RemoteTileService"]}))}},{key:"createSubLayer",value:function(e){return this.publishStyledLayerService(e)}},{key:"createTileLayer",value:function(e){var t=e.remote,r=function(e,t){if(null==e)return{};var r,n,s={},i=Object.keys(e);for(n=0;n<i.length;n++)t.indexOf(r=i[n])>=0||(s[r]=e[r]);return s}(e,["remote"]);return t?this.publishRemoteTileService(r):this.publishLocalTileService(r)}},{key:"uploadPreview",value:function(e,t){return this.setPreview({name:e,file:L(t)})}},{key:"findOne",value:function(e){return this.getLayerInfo(e)}},{key:"findAll",value:function(e){return this.getLayersList(f({},e,{types:["PostgresLayerService","PostgresTileLayerService","StyledFeatureLayer"]}))}},{key:"create",value:function(e){return this.publishPostgresLayerService(e)}},{key:"update",value:function(e){return this.updatePostgresLayerService({name:e.name,configuration:e})}},{key:"remove",value:function(e){try{return Promise.resolve(this.deleteResource(e)).then((function(){return e}))}catch(e){return Promise.reject(e)}}}]),r}(function(e){y(r,S);var t=k(r);function r(){return l(this,r),t.apply(this,arguments)}return h(r,[{key:"getLayerInfo",value:function(e){return this.http.get("/layers/"+e).json()}},{key:"deleteResource",value:function(e){return this.http.delete("/layers/"+e).then((function(){}))}},{key:"getLayersList",value:function(e){return this.http.get("/layers",{filter:e.filter,types:e.types,offset:e.offset,limit:e.limit,orderByFields:e.orderByFields,isFavorite:e.isFavorite}).json()}},{key:"publishRemoteTileService",value:function(e){return this.http.post("/layers",e,{type:"RemoteTileService"}).json()}},{key:"publishLocalTileService",value:function(e){return this.http.post("/layers",e,{type:"LocalTileService"}).json()}},{key:"publishPostgresLayerService",value:function(e){return this.http.post("/layers",e,{type:"PostgresLayerService"}).json()}},{key:"publishPostgresTileCatalogService",value:function(e){return this.http.post("/layers",e,{type:"PostgresTileLayerService"}).json()}},{key:"updateTileCatalogService",value:function(e){return this.http.patch("/layers/"+e.name,e.configuration,{type:"PostgresTileLayerService"}).json()}},{key:"publishStyledLayerService",value:function(e){return this.http.post("/layers",e,{type:"StyledFeatureLayer"}).json()}},{key:"publishCompositeService",value:function(e){return this.http.post("/layers",e,{type:"CompositeService"}).json()}},{key:"updateRemoteTileService",value:function(e){return this.http.patch("/layers/"+e.name,e.configuration,{type:"RemoteTileService"}).json()}},{key:"updateLocalTileService",value:function(e){return this.http.patch("/layers/"+e.name,e.configuration,{type:"LocalTileService"}).json()}},{key:"updatePostgresLayerService",value:function(e){return this.http.patch("/layers/"+e.name,e.configuration,{type:"PostgresLayerService"}).json()}},{key:"updateCompositeService",value:function(e){return this.http.patch("/layers/"+e.name,e.configuration,{type:"CompositeService"}).json()}},{key:"reloadService",value:function(e){return this.http.get("/layers/"+e+"/reload").json()}},{key:"getFeatures",value:function(e){return this.http.get("/layers/"+e.name+"/features",{query:e.query,offset:e.offset,limit:e.limit,wkid:e.wkid,sort:e.sort,withGeom:e.withGeom,attributes:e.attributes}).json()}},{key:"createFeatures",value:function(e){return this.http.post("/layers/"+e.name+"/features",e.features).json()}},{key:"deleteFeature",value:function(e){return this.http.delete("/layers/"+e.name+"/features",{id:e.id}).json()}},{key:"updateFeature",value:function(e){return this.http.patch("/layers/"+e.name+"/features",e.features).json()}},{key:"getById",value:function(e){return this.http.get("/layers/"+e.name+"/features/"+e.id,{wkid:e.wkid}).json()}},{key:"getTilesLayerImage",value:function(e){return this.http.createUrl("/layers/"+e.name+"/tile/"+e.z+"/"+e.x+"/"+e.y,{ids:e.ids})}},{key:"getLayerImage",value:function(e){return this.http.createUrl("/layers/"+e.name+"/export",{extent:e.extent,size:e.size,extentSr:e.extentSr,condition:e.condition,styleId:e.styleId})}},{key:"getLayerExtent",value:function(e){return this.http.get("/layers/"+e.name+"/extent",{filterCondition:e.filterCondition,sr:e.sr}).json()}},{key:"getByGeometry",value:function(e){return this.http.get("/layers/"+e.name+"/features/getByGeometry",{geometry:e.geometry,extentSr:e.extentSr,targetSr:e.targetSr}).json()}},{key:"getByGeometryPost",value:function(e){return this.http.post("/layers/"+e.name+"/features/getByGeometry",e.geometry,{extentSr:e.extentSr,targetSr:e.targetSr}).json()}},{key:"deleteFeatures",value:function(e){return this.http.delete("/layers/"+e.name+"/features/deleteByIds",{ids:e.ids}).json()}},{key:"getByGeometryGet",value:function(e){return this.http.get("/layers/"+e.name+"/features/getByGeometryByClick",{imageRectangle:e.imageRectangle,envelope:e.envelope,clickPoint:e.clickPoint,extentSr:e.extentSr,targetSr:e.targetSr,useFilledSymbols:e.useFilledSymbols,query:e.query}).json()}},{key:"classify",value:function(e){return this.http.get("/layers/"+e.name+"/classify",{attribute:e.attribute,classes:e.classes,precision:e.precision,type:e.type}).json()}},{key:"distincts",value:function(e){return this.http.get("/layers/"+e.name+"/distincts",{attribute:e.attribute,limit:e.limit,startsWith:e.startsWith,ignoreDefaultCondition:e.ignoreDefaultCondition}).json()}},{key:"getFilteredFeaturesCount",value:function(e){return this.http.get("/layers/"+e+"/features/count").json()}},{key:"getPreview",value:function(e){return this.http.createUrl("/layers/"+e+"/preview")}},{key:"setPreview",value:function(e){return this.http.post("/layers/"+e.name+"/preview",e.file).json()}},{key:"deletePreview",value:function(e){return this.http.delete("/layers/"+e+"/preview").then((function(){}))}},{key:"getResourceDependencies",value:function(e){return this.http.get("/layers/"+e+"/dependencies").json()}},{key:"getResourceReferences",value:function(e){return this.http.get("/layers/"+e+"/references").json()}},{key:"setPermissions",value:function(e){return this.http.put("/layers/"+e.name+"/permissions",e.data).json()}},{key:"addPermissions",value:function(e){return this.http.post("/layers/"+e.name+"/permissions",e.data).json()}},{key:"removePermissions",value:function(e){return this.http.delete("/layers/"+e.name+"/permissions/"+e.role).json()}}]),r}()),W=function(e){y(r,e);var t=k(r);function r(){return l(this,r),t.apply(this,arguments)}return h(r,[{key:"getTableInfos",value:function(e){var t=this;return N(e.map((function(e){return t.getTableInfo(e)})))}},{key:"uploadPreview",value:function(e,t){return this.setPreview({name:e,file:L(t)})}},{key:"findOne",value:function(e){return this.getTableInfo(e)}},{key:"findAll",value:function(e){return this.getTableList(e)}},{key:"create",value:function(e){return this.createTable(e)}},{key:"update",value:function(e){return this.updateTable({name:e.name,data:e})}},{key:"remove",value:function(e){try{return Promise.resolve(this.deleteResource(e)).then((function(){return e}))}catch(e){return Promise.reject(e)}}}]),r}(function(e){y(r,S);var t=k(r);function r(){return l(this,r),t.apply(this,arguments)}return h(r,[{key:"getTableList",value:function(e){return this.http.get("/tables",{filter:e.filter,offset:e.offset,limit:e.limit,orderByFields:e.orderByFields,isFavorite:e.isFavorite}).json()}},{key:"createTable",value:function(e){return this.http.post("/tables",e).json()}},{key:"getTableInfo",value:function(e){return this.http.get("/tables/"+e).json()}},{key:"deleteResource",value:function(e){return this.http.delete("/tables/"+e).then((function(){}))}},{key:"updateTable",value:function(e){return this.http.patch("/tables/"+e.name,e.data).json()}},{key:"getResourceReferences",value:function(e){return this.http.get("/tables/"+e+"/references").json()}},{key:"getResourceDependencies",value:function(e){return this.http.get("/tables/"+e+"/dependencies").json()}},{key:"setPermissions",value:function(e){return this.http.put("/tables/"+e.name+"/permissions",e.data).json()}},{key:"addPermissions",value:function(e){return this.http.post("/tables/"+e.name+"/permissions",e.data).json()}},{key:"removePermissions",value:function(e){return this.http.delete("/tables/"+e.name+"/permissions/"+e.role).json()}},{key:"getPreview",value:function(e){return this.http.createUrl("/tables/"+e+"/preview")}},{key:"setPreview",value:function(e){return this.http.post("/tables/"+e.name+"/preview",e.file).json()}},{key:"deletePreview",value:function(e){return this.http.delete("/tables/"+e+"/preview").then((function(){}))}}]),r}()),H=function(e){y(r,e);var t=k(r);function r(){return l(this,r),t.apply(this,arguments)}return h(r,[{key:"getProjectInfos",value:function(e){var t=this;return N(e.map((function(e){return t.getProjectInfo(e)})))}},{key:"getProjectsDeps",value:function(e){var t=this;return N(e.map((function(e){return t.getResourceDependencies(e)})))}},{key:"uploadPreview",value:function(e,t){return this.setPreview({name:e,file:L(t)})}},{key:"findOne",value:function(e){return this.getProjectInfo(e)}},{key:"findAll",value:function(e){return this.getProjectsList(e)}},{key:"create",value:function(e){return this.createProject(e)}},{key:"update",value:function(e){return this.updateProject({name:e.name,info:e})}},{key:"remove",value:function(e){try{return Promise.resolve(this.deleteResource(e)).then((function(){return e}))}catch(e){return Promise.reject(e)}}}]),r}(function(e){y(r,S);var t=k(r);function r(){return l(this,r),t.apply(this,arguments)}return h(r,[{key:"getProjectsList",value:function(e){return this.http.get("/projects",{filter:e.filter,offset:e.offset,limit:e.limit,orderByFields:e.orderByFields,isFavorite:e.isFavorite}).json()}},{key:"createProject",value:function(e){return this.http.post("/projects",e).json()}},{key:"createShareProject",value:function(e){return this.http.post("/projects/"+e.name+"/share",e.configuration).json()}},{key:"removeShareProject",value:function(e){return this.http.delete("/projects/"+e+"/share").then((function(){}))}},{key:"getProjectInfo",value:function(e){return this.http.get("/projects/"+e).json()}},{key:"deleteResource",value:function(e){return this.http.delete("/projects/"+e).then((function(){}))}},{key:"updateProject",value:function(e){return this.http.patch("/projects/"+e.name,e.info).json()}},{key:"getResourceDependencies",value:function(e){return this.http.get("/projects/"+e+"/dependencies").json()}},{key:"getResourceReferences",value:function(e){return this.http.get("/projects/"+e+"/references").json()}},{key:"setPermissions",value:function(e){return this.http.put("/projects/"+e.name+"/permissions",e.data).json()}},{key:"addPermissions",value:function(e){return this.http.post("/projects/"+e.name+"/permissions",e.data).json()}},{key:"removePermissions",value:function(e){return this.http.delete("/projects/"+e.name+"/permissions/"+e.role).json()}},{key:"getPreview",value:function(e){return this.http.createUrl("/projects/"+e+"/preview")}},{key:"setPreview",value:function(e){return this.http.post("/projects/"+e.name+"/preview",e.file).json()}},{key:"deletePreview",value:function(e){return this.http.delete("/projects/"+e+"/preview").then((function(){}))}}]),r}());function G(e,t,r){return r.indexOf(e)===t}function q(e){return"string"==typeof e}!function(e){e.Layer="Service",e.Table="Table"}(M||(M={}));var z,Q=function(){function e(t,r,n){l(this,e),this.projects=t,this.layers=r,this.tables=n}return h(e,[{key:"getProjectInfosWithDeps",value:function(e){try{var t=this;return Promise.resolve(t.projects.getProjectInfos(e)).then((function(r){return Promise.resolve(t.projects.getProjectsDeps(e)).then((function(e){return Promise.resolve(t.getDependencies(e,!0,!0)).then((function(e){return{projects:r,deps:{layers:e.layers,tables:e.tables}}}))}))}))}catch(e){return Promise.reject(e)}}},{key:"getLayerInfosWithDeps",value:function(e){try{var t=this;return Promise.resolve(t.layers.getLayerInfos(e)).then((function(r){return Promise.resolve(t.layers.getLayersDeps(e)).then((function(e){return Promise.resolve(t.getDependencies(e,!1,!0)).then((function(e){return{layers:r,deps:{tables:e.tables}}}))}))}))}catch(e){return Promise.reject(e)}}},{key:"getDependencies",value:function(e,t,r){try{var n=this,s=e.reduce((function(e,s){var i=s.dependencies||[];if(t){var o,u=n.getDependentNames(i,M.Layer);(o=e.layers).push.apply(o,u)}if(r){var a,c=n.getDependentNames(i,M.Table);(a=e.tables).push.apply(a,c)}return e}),{tables:[],layers:[]}),i=s.layers;return Promise.resolve(n.tables.getTableInfos(s.tables.filter(G))).then((function(e){return Promise.resolve(n.layers.getLayerInfos(i.filter(G))).then((function(t){return{tables:e,layers:t}}))}))}catch(e){return Promise.reject(e)}}},{key:"getDependentNames",value:function(e,t){return e.filter((function(e){return e.type===t})).map((function(e){return e.name})).filter(q)}}]),e}(),K=function(e){y(r,S);var t=k(r);function r(){return l(this,r),t.apply(this,arguments)}return h(r,[{key:"getStyle",value:function(e){return this.http.get("/services/styles/"+e).json()}},{key:"updateStyle",value:function(e){return this.http.post("/services/styles/"+e.id,e.style).json()}},{key:"createStyle",value:function(e){return this.http.post("/services/styles",e).json()}},{key:"getAllFonts",value:function(){return this.http.get("/services/styles/fonts").json()}}]),r}(),V=function(e){y(r,K);var t=k(r);function r(){return l(this,r),t.apply(this,arguments)}return r}(),X=function(e){y(r,S);var t=k(r);function r(){return l(this,r),t.apply(this,arguments)}return h(r,[{key:"geocode",value:function(e){return this.http.get("/"+this.name+"/geocode",{address:e.address,sr:e.sr}).json()}},{key:"geocodeByPoint",value:function(e){return this.http.get("/"+this.name+"/geocodeByPoint",{pointGeometry:e.pointGeometry,pointSr:e.pointSr}).json()}},{key:"suggest",value:function(e){return this.http.get("/"+this.name+"/suggest",{address:e}).json()}},{key:"getServiceInfo",value:function(){return this.http.get("/"+this.name).json()}},{key:"deleteService",value:function(){return this.http.delete("/"+this.name).then((function(){}))}},{key:"getPermissions",value:function(){return this.http.get("/"+this.name+"/permissions").json()}},{key:"setPermissions",value:function(e){return this.http.post("/"+this.name+"/permissions",null,{Acl:e}).json()}},{key:"addPermissions",value:function(e){return this.http.post("/"+this.name+"/permissions/add",null,{acl:e}).json()}},{key:"removePermissions",value:function(e){return this.http.post("/"+this.name+"/permissions/remove",null,{Acl:e}).json()}},{key:"getPreview",value:function(e){return this.http.createUrl("/"+this.name+"/preview",{resourceName:e})}},{key:"setPreview",value:function(e){return this.http.post("/"+this.name+"/preview",e).then((function(){}))}}]),r}(),J=function(e){y(r,X);var t=k(r);function r(){return l(this,r),t.apply(this,arguments)}return r}(),Y=function(e){y(r,e);var t=k(r);function r(){return l(this,r),t.apply(this,arguments)}return r}(function(e){y(r,S);var t=k(r);function r(){return l(this,r),t.apply(this,arguments)}return h(r,[{key:"getProjects",value:function(e){return this.http.get("/services/resources/projects",{filter:e.filter,offset:e.offset,limit:e.limit,orderByFields:e.orderByFields,isFavorite:e.isFavorite}).json()}},{key:"getTables",value:function(e){return this.http.get("/services/resources/tables",{filter:e.filter,offset:e.offset,limit:e.limit,orderByFields:e.orderByFields,isFavorite:e.isFavorite}).json()}},{key:"getLayers",value:function(e){return this.http.get("/services/resources/layers",{filter:e.filter,types:e.types,offset:e.offset,limit:e.limit,orderByFields:e.orderByFields,isFavorite:e.isFavorite}).json()}},{key:"addResource",value:function(e){return this.http.post("/services/resources/"+e.resourceType+"/add",e.catalogData).then((function(){}))}},{key:"addResources",value:function(e){return this.http.post("/services/resources/add",e.resources,{userName:e.userName}).then((function(){}))}},{key:"removeResource",value:function(e){return this.http.post("/services/resources/"+e.resourceType+"/remove",e.catalogData).then((function(){}))}},{key:"getNewResources",value:function(){return this.http.get("/services/resources/getNewResources").json()}},{key:"touchResources",value:function(e){return this.http.post("/services/resources/"+e.resourceType+"/touchResources",e.resources).then((function(){}))}},{key:"shareResources",value:function(e){return this.http.post("/services/resources/"+e.resourceType+"/shareAll",e.resources).json()}},{key:"unshareResources",value:function(e){return this.http.post("/services/resources/"+e.resourceType+"/unshareAll",e.resources).json()}},{key:"copyResources",value:function(e){return this.http.post("/services/resources/copy",e).json()}},{key:"getResource",value:function(e){return this.http.get("/services/resources/"+e.resourceType+"/"+e.name).then((function(){}))}},{key:"removeResourceDelete",value:function(e){return this.http.delete("/services/resources/"+e.resourceType,{resource:e.resource,users:e.users}).then((function(){}))}},{key:"checkLimits",value:function(e){return this.http.get("/services/resources/checkLimits",{workspace:e}).json()}}]),r}()),Z=function(e){y(r,e);var t=k(r);function r(){return l(this,r),t.apply(this,arguments)}return r}(function(e){y(r,S);var t=k(r);function r(){return l(this,r),t.apply(this,arguments)}return h(r,[{key:"getTools",value:function(){return this.http.get("/tools").json()}},{key:"reloadTools",value:function(){return this.http.post("/tools/reload").json()}},{key:"getToolDescription",value:function(e){return this.http.get("/tools/"+e).json()}},{key:"evaluateTool",value:function(e){return this.http.post("/tools/"+e.name+"/evaluate",e.inputParameters,{promo:e.promo}).json()}},{key:"executeTool",value:function(e){return this.http.post("/tools/"+e.name+"/run",e.inputParameters,{promo:e.promo}).json()}},{key:"getToolAcl",value:function(e){return this.http.get("/tools/"+e+"/permissions").json()}},{key:"setPermissions",value:function(e){return this.http.put("/tools/"+e.name+"/permissions",e.data).json()}},{key:"addPermissions",value:function(e){return this.http.post("/tools/"+e.name+"/permissions",e.data).json()}},{key:"removePermissions",value:function(e){return this.http.delete("/tools/"+e.name+"/permissions/"+e.role).json()}},{key:"getToolsLists",value:function(e){return this.http.get("/tools/journal",{types:e.types,status:e.status}).json()}},{key:"getTool",value:function(e){return this.http.get("/tools/journal/"+e).json()}},{key:"cancelExecute",value:function(e){return this.http.post("/tools/"+e+"/cancel").then((function(){}))}},{key:"getToolResult",value:function(e){return this.http.post("/tools/"+e.id+"/result",e.data).json()}},{key:"uploadScriptFile",value:function(e){return this.http.post("/tools/upload",e).then((function(){}))}},{key:"deleteScriptTool",value:function(e){return this.http.delete("/tools/"+e).then((function(){}))}}]),r}()),$=function(){function e(t){l(this,e),this.prefixUrl=t,this.ky=n.extend({prefixUrl:t})}return h(e,[{key:"extend",value:function(e){this.ky=n.extend(e)}},{key:"get",value:function(e,t){return this.ky.get(this.stripSlashes(e),{searchParams:te(t)})}},{key:"post",value:function(e,t,r){var n=ee(r,t);return this.ky.post(this.stripSlashes(e),n)}},{key:"put",value:function(e,t,r){var n=ee(r,t);return this.ky.put(this.stripSlashes(e),n)}},{key:"patch",value:function(e,t,r){var n=ee(r,t);return this.ky.patch(this.stripSlashes(e),n)}},{key:"delete",value:function(e,t){return this.ky.delete(this.stripSlashes(e),{searchParams:te(t)})}},{key:"createUrl",value:function(e,t){var r=t?"?"+te(t):"";return this.prefixUrl+this.stripSlashes(e)+r}},{key:"stripSlashes",value:function(e){return this.prefixUrl?e.replace(/^\//g,""):e}}]),e}();function ee(e,t){var r,n={searchParams:te(e)};return void 0!==(r=t)&&"object"==typeof r&&null!==r&&r.constructor===Object||Array.isArray(t)?n.json=t:n.body=t,n}function te(e){return void 0===e&&(e={}),s.stringify(e,{arrayFormat:"comma"})}(z=exports.ErrorReason||(exports.ErrorReason={})).HTTP_OTHER="other",z.HTTP_CLIENT="client",z.HTTP_SERVER="server",z.UNKNOWN="unknown";var re,ne=function(e){return e instanceof r.HTTPError?function(e){var t=e.response.status,r=exports.ErrorReason.HTTP_OTHER;return t>=400&&t<500&&(r=exports.ErrorReason.HTTP_CLIENT),t>=500&&(r=exports.ErrorReason.HTTP_SERVER),{type:"http",reason:r,status:t,origin:e}}(e):function(e){return{type:"base",reason:exports.ErrorReason.UNKNOWN,origin:e}}(e)},se=function(e){return e&&e.type&&e.reason};(re=exports.ApiEvent||(exports.ApiEvent={})).ConnectionLost="ConnectionLost",re.Unauthorized="Unauthorized";var ie,oe={401:exports.ApiEvent.Unauthorized,403:exports.ApiEvent.ConnectionLost},ue=function(e){y(n,$);var t=k(n);function n(e,s){var i;return l(this,n),(i=t.call(this,e)).extend({prefixUrl:e,timeout:!1,hooks:{afterResponse:[function(e){var t=oe[e.status];return s&&t&&s.emit(t,ne(new r.HTTPError(e))),e}]}}),i}return n}(),ae=function(e){y(r,e);var t=k(r);function r(){return l(this,r),t.apply(this,arguments)}return r}(function(e){y(r,S);var t=k(r);function r(){return l(this,r),t.apply(this,arguments)}return h(r,[{key:"print",value:function(e){return this.http.post("/services/print/print",e).blob()}},{key:"getTemplates",value:function(){return this.http.get("/services/print/templates").json()}},{key:"uploadTemplate",value:function(e){return this.http.post("/services/print/templates",e.template,{name:e.name,rewrite:e.rewrite}).then((function(){}))}},{key:"getTemplate",value:function(e){return this.http.get("/services/print/templates/"+e).json()}},{key:"deleteTemplate",value:function(e){return this.http.delete("/services/print/templates/"+e).then((function(){}))}}]),r}()),ce=function(e){y(n,t.EventEmitter);var r=k(n);function n(e){var t,s=e.url,i=e.wsUrl,o=e.config,u=void 0===o?j:o;return l(this,n),(t=r.call(this)).http=new ue(s,m(t)),t.url=s,t.wsUrl=i||s,t.layers=new A(u.Layers,t.http),t.tables=new W(u.Tables,t.http),t.projects=new H(u.Projects,t.http),t.resources=new Q(t.projects,t.layers,t.tables),t.styles=new V(u.Styles,t.http),t.security=new T(u.PostgresSecurityService,t.http),t.notification=new E(u.NotificationService,t.http),t.scheduler=new B(u.SchedulerService,t.http),t.file=new R(u.FileUploadService,t.http),t.import=new C(u.ImportService,t.http),t.geocode=new J(u.GeocodeService,t.http),t.print=new ae(u.PrintService,t.http),t.tools=new Z(u.Tools,t.http),t.resourceCatalog=new Y(u.ResourceCatalogService,t.http),t}return h(n,[{key:"init",value:function(e){try{var t=this;return Promise.resolve(P((function(){return Promise.resolve(t.connectSp(e)).then((function(){return Promise.resolve(t.connectWs()).then((function(){return Promise.resolve(t.initScheduler()).then((function(){}))}))}))}),(function(e){throw ne(e)})))}catch(e){return Promise.reject(e)}}},{key:"connectSp",value:function(e){return this.security.login(e)}},{key:"connectWs",value:function(){try{var e=this,t=function(){if(e.security.sessionId)return Promise.resolve(e.notification.connectWs(e.wsUrl,e.security.sessionId)).then((function(){e.notification.on("ConnectionStatus",(function(t){t.data===exports.ConnectionStatus.Lost&&e.emit(exports.ApiEvent.ConnectionLost,t.data)}))}))}();return Promise.resolve(t&&t.then?t.then((function(){})):void 0)}catch(e){return Promise.reject(e)}}},{key:"initScheduler",value:function(){return this.scheduler.init(this.notification)}}]),n}(),le=function(e){return window.location.host.includes("localhost")?window.location.protocol+"//"+e+".devpublic.everpoint.ru":window.location.protocol+"//"+e+"."+window.location.host},pe=function(e){y(r,u.TileLayer);var t=k(r);function r(e,n){var s;return l(this,r),(s=t.call(this,(function(t,r,i){var o=s.subDomains||e.subDomains,u=o&&o[(t+r+i)%o.length],a=n.layers.getTilesLayerImage({x:t,y:r,z:i,name:s.name||e.name});return u?""+le(u)+a:a}))).name=e.name,s.subDomains=e.subDomains,s}return r}(),he=function(e){y(r,a.DynamicLayer);var t=k(r);function r(e,n){var s;return l(this,r),(s=t.call(this)).api=n,s.name=e.name,s.styleId=e.style,s.conditionQuery=e.condition,s.subscribeRedraw(),s}return h(r,[{key:"getUrl",value:function(e,t){var r=Math.round((e.xMax-e.xMin)/t),n=Math.round((e.yMax-e.yMin)/t);return this.api.layers.getLayerImage({name:this.name,extent:e.coordinates,size:[r,n],extentSr:e.crs.wkid,styleId:this.styleId,condition:this.conditionQuery})}},{key:"subscribeRedraw",value:function(){var e=this,t="service_update_"+this.name.replace(/\//g,"_");this.api.notification.subscribe(t).then((function(){e.api.notification.on(t,(function(){e.forceUpdate(),e.redraw()}))}))}},{key:"style",set:function(e){this.styleId=e,this.forceUpdate()},get:function(){return this.styleId}},{key:"condition",set:function(e){this.conditionQuery=e,this.forceUpdate()},get:function(){return this.conditionQuery}}]),r}(),fe={RemoteTileService:pe,LocalTileService:pe,PostgresLayerService:he,StyledFeatureLayer:he,CompositeService:null},ye=function(){function e(t,r){l(this,e),this.layers=t,this.http=r}return h(e,[{key:"getLayerService",value:function(e){try{var t=this;return Promise.resolve(t.getLayerInfo(e)).then((function(e){var r=e.type;if(function(e){return Boolean(e&&Object.keys(fe).includes(e))}(r)){var n=fe[r];if(n)return new n(function(e){return f({},e,{name:"services/"+e.name})}(e),t.http);throw new Error('Constructor for service type: "'+e.type+'" not implemented')}}))}catch(e){return Promise.reject(e)}}},{key:"getLayerInfo",value:function(e){try{var t=this;return Promise.resolve(P((function(){return Promise.resolve(t.layers.getLayerInfo(e))}),(function(){throw new Error('Service with name: "'+e+'" not exists')})))}catch(e){return Promise.reject(e)}}}]),e}();!function(e){e[e.BaseMaps=0]="BaseMaps",e[e.Layers=1]="Layers"}(ie||(ie={}));var ve=function(e){y(r,ce);var t=k(r);function r(e,n,s){var u;return l(this,r),(u=t.call(this,n)).map=new o.Map,u.painter=new i.DomPainter(u.map),u.mapProps=e,u.auth=s,u.layersManager=new ye(u.layers,u.http),u}return h(r,[{key:"init",value:function(){try{var e=this;return Promise.resolve(g(v(r.prototype),"init",e).call(e,e.auth)).then((function(){function t(){function t(){function t(){e.setMapProps()}var r=function(){if(i)return Promise.resolve(e.loadProject(i)).then((function(){}))}();return r&&r.then?r.then(t):t()}var r=function(){if(s)return Promise.resolve(Promise.all(s.map((function(t){return e.addLayer(t)})))).then((function(){}))}();return r&&r.then?r.then(t):t()}var r=e.mapProps,n=r.baseService,s=r.services,i=r.projectName,o=function(){if(n)return Promise.resolve(e.setBaseMap(n)).then((function(){}))}();return o&&o.then?o.then(t):t()}))}catch(e){return Promise.reject(e)}}},{key:"reset",value:function(){try{var e=this;return Promise.resolve(e.security.logout()).then((function(){e.painter.wrapper=null}))}catch(e){return Promise.reject(e)}}},{key:"addLayer",value:function(e){try{return Promise.resolve(this.insertLayer(e,ie.Layers)).then((function(){}))}catch(e){return Promise.reject(e)}}},{key:"setBaseMap",value:function(e){try{return Promise.resolve(this.insertLayer(e,ie.BaseMaps)).then((function(){}))}catch(e){return Promise.reject(e)}}},{key:"loadProject",value:function(e){try{var t=this;return Promise.resolve(t.projects.getProjectInfo(e)).then((function(e){function r(){var e=function(){if(i){var e=i.map((function(e){return e.name})).filter(me);return Promise.resolve(Promise.all(e.map((function(e){return t.addLayer(e)})))).then((function(){}))}}();if(e&&e.then)return e.then((function(){}))}if(e&&e.content){var n=e.content,s=n.baseMapName,i=n.items,o=function(){if(s)return Promise.resolve(t.setBaseMap(s)).then((function(){}))}();return o&&o.then?o.then(r):r()}}))}catch(e){return Promise.reject(e)}}},{key:"insertLayer",value:function(e,t){try{var r=this;return Promise.resolve(r.layersManager.getLayerService(e)).then((function(e){e&&r.map.insertLayer(e.layer,t)}))}catch(e){return Promise.reject(e)}}},{key:"setMapProps",value:function(){var e=this.mapProps,t=e.position,r=e.centerPoint,n=e.mapWrapper,s=e.resolution;t?this.map.position=t:r&&(this.map.centerPoint=r),s&&(this.map.resolution=s),n&&(this.painter.wrapper=n)}}]),r}(),me=function(e){return void 0!==e};function de(e){return function(t){return!!t.type&&e.includes(t.type)}}var ke=de(["PostgresLayerService","PostgresTileLayerService"]);Object.defineProperty(exports,"HTTPError",{enumerable:!0,get:function(){return r.HTTPError}}),Object.defineProperty(exports,"TimeoutError",{enumerable:!0,get:function(){return r.TimeoutError}}),exports.Api=ce,exports.EvergisDynamicLayer=he,exports.EvergisTileLayer=pe,exports.ExtendedHttpClient=ue,exports.FileUpload=R,exports.Geocode=J,exports.HttpClient=$,exports.Import=C,exports.Layers=A,exports.LayersManager=ye,exports.Notification=E,exports.NotificationEvent=D,exports.Projects=H,exports.ResourceCatalog=Y,exports.Resources=Q,exports.Scheduler=B,exports.Security=T,exports.SpatialProcessor=ve,exports.Styles=V,exports.Tables=W,exports.Tools=Z,exports.addSubDomainToLocation=le,exports.errorHandler=ne,exports.formDataFromFile=L,exports.isEvergisDynamicLayer=function(e){return e instanceof he},exports.isEvergisTileLayer=function(e){return e instanceof pe},exports.isFeatureLayer=function(e){return e instanceof c.FeatureLayer},exports.isHTTPError=function(e){return se(e)&&"http"===e.type},exports.isHandledError=se,exports.isLayer=ke,exports.isProjectContentItems=function(e){return null!=e},exports.isString=q,exports.isTileLayerService=function(e){return e.type&&/TileService/.test(e.type)},exports.promiseAllIgnoreErrors=N,exports.unique=G;
//# sourceMappingURL=api.cjs.production.min.js.map

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

export { Api } from './Api';
export { Api, ApiParams } from './Api';
export { ApiEvent } from './ApiEvent';

@@ -3,0 +3,0 @@ export { ApiConfig } from './defaultApiConfig';

{
"version": "1.0.0-alpha.2",
"version": "1.0.0-alpha.3",
"license": "MIT",

@@ -44,2 +44,4 @@ "main": "dist/index.js",

"devDependencies": {
"@babel/plugin-transform-classes": "^7.10.4",
"@babel/preset-env": "^7.11.0",
"husky": "^4.2.5",

@@ -46,0 +48,0 @@ "tsdx": "^0.13.2",

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

export { Api } from './Api';
export { Api, ApiParams } from './Api';
export { ApiEvent } from './ApiEvent';

@@ -3,0 +3,0 @@ export { ApiConfig } from './defaultApiConfig';

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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