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.0 to 1.0.0-alpha.1

dist/utils/index.d.ts

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);!function(e){e.Initialized="Initialized",e.Connected="Connected",e.Break="Break",e.Lost="Lost"}(P||(P={}));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=P.Initialized,s.onWsConnected=function(){s.connectStatus=P.Connected},s.onWsClosed=function(){s.reconnectTries<s.MAX_WS_RECONNECT_TRIES?(s.connectStatus=P.Break,s.reconnectTries++,s.connect()):s.connectStatus=P.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 I(e)?e:new Error(e)}))})))).then((function(e){return e.filter(R)}))}catch(e){return Promise.reject(e)}};function I(e){return e instanceof Error}function R(e){return!I(e)}var x,F=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)),C=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)),D=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 B(e,t,r){return r.indexOf(e)===t}function E(e){return"string"==typeof e}!function(e){e.Layer="Service",e.Table="Table"}(x||(x={}));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,x.Layer);(o=e.layers).push.apply(o,u)}if(r){var c,a=n.getDependentNames(i,x.Table);(c=e.tables).push.apply(c,a)}return e}),{tables:[],layers:[]}),i=s.layers;return Promise.resolve(n.tables.getTableInfos(s.tables.filter(B))).then((function(e){return Promise.resolve(n.layers.getLayerInfos(i.filter(B))).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(E)},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)),W=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)),A=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:q(t)})},t.post=function(e,t,r){var n=G(r,t);return this.ky.post(this.stripSlashes(e),n)},t.put=function(e,t,r){var n=G(r,t);return this.ky.put(this.stripSlashes(e),n)},t.patch=function(e,t,r){var n=G(r,t);return this.ky.patch(this.stripSlashes(e),n)},t.delete=function(e,t){return this.ky.delete(this.stripSlashes(e),{searchParams:q(t)})},t.createUrl=function(e,t){var r=t?"?"+q(t):"";return this.prefixUrl+this.stripSlashes(e)+r},t.stripSlashes=function(e){return this.prefixUrl?e.replace(/^\//g,""):e},e}();function G(e,t){var r,n={searchParams:q(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 q(e){return void 0===e&&(e={}),s.stringify(e,{arrayFormat:"comma"})}!function(e){e.HTTP_OTHER="other",e.HTTP_CLIENT="client",e.HTTP_SERVER="server",e.UNKNOWN="unknown"}(N||(N={}));var H,z=function(e){return e instanceof r.HTTPError?function(e){var t=e.response.status,r=N.HTTP_OTHER;return t>=400&&t<500&&(r=N.HTTP_CLIENT),t>=500&&(r=N.HTTP_SERVER),{type:"http",reason:r,status:t,origin:e}}(e):function(e){return{type:"base",reason:N.UNKNOWN,origin:e}}(e)};!function(e){e.ConnectionLost="ConnectionLost",e.Unauthorized="Unauthorized"}(H||(H={}));var Q,K={401:H.Unauthorized,403:H.ConnectionLost},V=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=K[e.status];return n&&t&&n.emit(t,z(new r.HTTPError(e))),e}]}}),s}return l(t,e),t}(A),X=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)),J=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 V(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 F(o.Layers,r.http),r.tables=new C(o.Tables,r.http),r.projects=new D(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 X(o.PrintService,r.http),r.tools=new W(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===P.Lost&&e.emit(H.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),Y=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?""+function(e){return window.location.host.includes("localhost")?window.location.protocol+"//"+e+".devpublic.everpoint.ru":window.location.protocol+"//"+e+"."+window.location.host}(u)+c:c}))||this).name=t.name,n.subDomains=t.subDomains,n}return l(t,e),t}(u.TileLayer),Z=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),$={RemoteTileService:Y,LocalTileService:Y,PostgresLayerService:Z,StyledFeatureLayer:Z,CompositeService:null},ee=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($).includes(e))}(r)){var n=$[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"}(Q||(Q={}));var te=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 ee(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,Q.Layers)).then((function(){}))}catch(e){return Promise.reject(e)}},r.setBaseMap=function(e){try{return Promise.resolve(this.insertLayer(e,Q.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(re);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}(J),re=function(e){return void 0!==e};function ne(e){return function(t){return!!t.type&&e.includes(t.type)}}var se=ne(["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=J,exports.EvergisDynamicLayer=Z,exports.EvergisTileLayer=Y,exports.FileUpload=j,exports.HttpClient=A,exports.Import=S,exports.Layers=F,exports.Notification=T,exports.Projects=D,exports.ResourceCatalog=M,exports.Scheduler=w,exports.Security=d,exports.SpatialProcessor=te,exports.Tables=C,exports.Tools=W,exports.isEvergisDynamicLayer=function(e){return e instanceof Z},exports.isEvergisTileLayer=function(e){return e instanceof Y},exports.isFeatureLayer=function(e){return e instanceof a.FeatureLayer},exports.isLayer=se;
"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;
//# sourceMappingURL=api.cjs.production.min.js.map
export { Api } from './Api';
export { ApiEvent } from './ApiEvent';
export { ApiConfig } from './defaultApiConfig';
export { SpatialProcessor } from './SpatialProcessor';
export { Notification, Security, FileUpload, Import, Scheduler, Layers, Projects, Tables, ResourceCatalog, Tools, } from './services';
export { EvergisTileLayer, EvergisDynamicLayer } from './layers';
export * from './services';
export * from './layers';
export { HTTPError, TimeoutError, HttpClient, } from './__generated__/HttpClient';
export * from './utils/guards';
export * from './types';
export * from './utils';

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

export { EvergisTileLayer } from './EvergisTileLayer';
export { EvergisDynamicLayer } from './EvergisDynamicLayer';
export { EvergisTileLayer, EvergisTileLayerParams } from './EvergisTileLayer';
export { EvergisDynamicLayer, EvergisDynamicLayerParams } from './EvergisDynamicLayer';
export { LayersManager } from './LayersManager';
export { Security } from './Security';
export { FileUpload } from './FileUpload';
export { Import } from './Import';
export { Notification } from './Notification';
export { Notification, ConnectionStatus, NotificationEvent, NotificationTag, SubscriptionTag } from './Notification';
export { Scheduler } from './Scheduler';
export { Layers } from './Layers';
export { Layers, LayersWithDeps, isTileLayerService } from './Layers';
export { Tables } from './Tables';
export { Projects } from './Projects';
export { Projects, isProjectContentItems, ProjectsWithDeps } from './Projects';
export { Resources } from './Resources';

@@ -10,0 +10,0 @@ export { Styles } from './Styles';

{
"version": "1.0.0-alpha.0",
"version": "1.0.0-alpha.1",
"license": "MIT",

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

@@ -8,6 +8,3 @@ /*

import { Service } from './Service';
import {
ServiceInfoDc,
AccessControlListDc,
} from './data-contracts';
import { ServiceInfoDc, AccessControlListDc } from './data-contracts';

@@ -14,0 +11,0 @@ export class TileService extends Service {

export { Api } from './Api';
export { ApiEvent } from './ApiEvent';
export { ApiConfig } from './defaultApiConfig';
export { SpatialProcessor } from './SpatialProcessor';
export {
Notification,
Security,
FileUpload,
Import,
Scheduler,
Layers,
Projects,
Tables,
ResourceCatalog,
Tools,
} from './services';
export { EvergisTileLayer, EvergisDynamicLayer } from './layers';
export * from './services';
export * from './layers';
export {

@@ -23,3 +15,3 @@ HTTPError,

export * from './utils/guards';
export * from './types';
export * from './utils';

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

export { EvergisTileLayer } from './EvergisTileLayer';
export { EvergisDynamicLayer } from './EvergisDynamicLayer';
export { EvergisTileLayer, EvergisTileLayerParams } from './EvergisTileLayer';
export { EvergisDynamicLayer, EvergisDynamicLayerParams } from './EvergisDynamicLayer';
export { LayersManager } from './LayersManager';
export { Security } from './Security';
export { FileUpload } from './FileUpload';
export { Import } from './Import';
export { Notification } from './Notification';
export { Notification, ConnectionStatus, NotificationEvent, NotificationTag, SubscriptionTag } from './Notification';
export { Scheduler } from './Scheduler';
export { Layers } from './Layers';
export { Layers, LayersWithDeps, isTileLayerService } from './Layers';
export { Tables } from './Tables';
export { Projects } from './Projects';
export { Projects, isProjectContentItems, ProjectsWithDeps } from './Projects';
export { Resources } from './Resources';

@@ -10,0 +10,0 @@ export { Styles } from './Styles';

@@ -45,5 +45,7 @@ import { EventEmitter } from '@evergis/event-emitter';

// @ts-ignore
public get connectStatus() {
return this._connectStatus;
}
// @ts-ignore
public set connectStatus(connectStatus) {

@@ -50,0 +52,0 @@ this.emitter.emit(

@@ -117,4 +117,2 @@ import { DomPainter } from '@evergis/sgis/es/painters/DomPainter/DomPainter';

const isString = (s: string | undefined): s is string => {
return s !== undefined;
};
const isString = (s: string | undefined): s is string => s !== undefined;

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