@evergis/api
Advanced tools
Comparing version
@@ -5,3 +5,3 @@ import ky from 'ky'; | ||
export class HttpClient { | ||
constructor(prefixUrl = '') { | ||
constructor(prefixUrl = '/') { | ||
this.prefixUrl = prefixUrl; | ||
@@ -8,0 +8,0 @@ this.ky = ky.extend({ prefixUrl }); |
@@ -7,3 +7,3 @@ import { HttpClient } from './__generated__/HttpClient'; | ||
url: string; | ||
api: string; | ||
wsUrl?: string; | ||
config?: ApiConfig; | ||
@@ -13,3 +13,3 @@ }; | ||
protected readonly http: HttpClient; | ||
private readonly url; | ||
private readonly wsUrl; | ||
readonly layers: Layers; | ||
@@ -23,4 +23,4 @@ readonly tables: Tables; | ||
readonly import: Import; | ||
constructor({ url, config }: ApiParams); | ||
constructor({ url, wsUrl, config }: ApiParams); | ||
init(params: AuthorizationData): Promise<void>; | ||
} |
@@ -5,5 +5,5 @@ import { HttpClient } from './__generated__/HttpClient'; | ||
export class Api { | ||
constructor({ url, config = defaultApiConfig }) { | ||
this.http = new HttpClient(); | ||
this.url = url; | ||
constructor({ url, wsUrl, config = defaultApiConfig }) { | ||
this.http = new HttpClient(url); | ||
this.wsUrl = wsUrl || url; | ||
this.layers = new Layers(config.Layers, this.http); | ||
@@ -21,3 +21,3 @@ this.tables = new Tables(config.Tables, this.http); | ||
await this.security.login(params); | ||
await this.notification.connectWs(this.url, this.security.sessionId); | ||
await this.notification.connectWs(this.wsUrl, this.security.sessionId); | ||
await this.scheduler.init(this.notification); | ||
@@ -24,0 +24,0 @@ } |
@@ -26,3 +26,3 @@ import { EventHandler, sGisEvent, } from '@evergis/sgis/es/EventHandler'; | ||
} | ||
await super.on(NotificationEvent.type, callback); | ||
super.on(NotificationEvent.type, callback); | ||
} | ||
@@ -34,6 +34,6 @@ async unsubscribe(tag, callback) { | ||
} | ||
await super.off(NotificationEvent.type, callback); | ||
super.off(NotificationEvent.type, callback); | ||
} | ||
async getSubscriptionList() { | ||
return await this.notification.getSubscriptionList(); | ||
getSubscriptionList() { | ||
return this.notification.getSubscriptionList(); | ||
} | ||
@@ -40,0 +40,0 @@ connectWs(url, sessionId) { |
{ | ||
"name": "@evergis/api", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"license": "ISC", | ||
@@ -5,0 +5,0 @@ "author": "everpoint", |
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 not supported yet
149787
-6.28%116
-15.33%2916
-4.77%