@obelisk/client
Advanced tools
Comparing version 2.1.0 to 2.1.1
@@ -6,2 +6,3 @@ "use strict"; | ||
const util_1 = require("../util"); | ||
const operators_1 = require("rxjs/operators"); | ||
/** | ||
@@ -51,8 +52,8 @@ * Endpoint class represents an IoT-stack API Endpoint. | ||
const url = options ? this.addOptionsToUrl(this._url, options) : this._url; | ||
const h = { | ||
headers: { Authorization: 'Bearer ' + (this.client.tokens.rpt ? this.client.tokens.rpt.getToken() : '<no rpt present>') }, | ||
Transport: XMLHttpRequest | ||
}; | ||
const eventsource = new event_source_polyfill_1.EventSourcePolyfill(url, h); | ||
return rxjs_1.Observable.create((observer) => { | ||
const h = { | ||
headers: { Authorization: 'Bearer ' + (this.client.tokens.rpt ? this.client.tokens.rpt.getToken() : '<no rpt present>') }, | ||
Transport: XMLHttpRequest | ||
}; | ||
const eventsource = new event_source_polyfill_1.EventSourcePolyfill(url, h); | ||
if (util_1.Config.debug) { | ||
@@ -69,4 +70,4 @@ // console.log(eventsource); | ||
eventsource.onerror = function (event) { | ||
eventsource.close(); | ||
if (eventsource.readyState === 0) { | ||
eventsource.close(); | ||
observer.complete(); | ||
@@ -78,4 +79,8 @@ } | ||
}; | ||
return () => eventsource.close(); | ||
}); | ||
return () => { | ||
eventsource.close(); | ||
}; | ||
}).pipe(operators_1.finalize(() => { | ||
eventsource.close(); | ||
})); | ||
} | ||
@@ -82,0 +87,0 @@ /** |
{ | ||
"name": "@obelisk/client", | ||
"version": "2.1.0", | ||
"version": "2.1.1", | ||
"description": "Typescript client to interact with Obelisk on a higher level than the regular ReST API calls.", | ||
@@ -41,2 +41,3 @@ "keywords": [ | ||
"event-source-polyfill": "^1.0.5", | ||
"eventsource": "^1.0.7", | ||
"rxjs": "6.x" | ||
@@ -43,0 +44,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
98259
2621
4
+ Addedeventsource@^1.0.7
+ Addedeventsource@1.1.2(transitive)