sprof 0.1.11 → 0.1.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,7 +4,7 @@ export default abstract class HttpClient {
4
4
  static baseUrl: string;
5
5
  static apiVersion: string;
6
6
  static host: string;
7
- static Setup(host?: string, port?: string): void;
7
+ static Setup(host?: string, port?: string, apiVersion?: string): void;
8
8
  static headers: HttpHeaders;
9
9
  static newWebSocket(query: string): WebSocket;
10
10
  private static download;
package/dist/sprof.js CHANGED
@@ -4093,8 +4093,8 @@ function gd(t, e) {
4093
4093
  }
4094
4094
  }
4095
4095
  const ae = class ae {
4096
- static Setup(e = "http://localhost", i = "9000") {
4097
- this.baseUrl = gd(e, i), this.host = e;
4096
+ static Setup(e = "http://localhost", i = "9000", n = "api") {
4097
+ this.baseUrl = gd(e, i), this.host = e, this.apiVersion = n;
4098
4098
  }
4099
4099
  static newWebSocket(e) {
4100
4100
  const i = this.host.replace("http", "ws") + "/ws/" + e;
@@ -4162,9 +4162,13 @@ const ae = class ae {
4162
4162
  const { query: i } = e;
4163
4163
  return new EventSource(ae.buildUrl(i));
4164
4164
  }
4165
- static buildUrl(e) {
4166
- const i = e ?? "";
4167
- return this.baseUrl + this.apiVersion + i;
4165
+ static buildUrl(e = "") {
4166
+ try {
4167
+ const i = new URL(this.baseUrl);
4168
+ return new URL(this.apiVersion + e, i).toString();
4169
+ } catch {
4170
+ throw new Error(`Invalid base URL: ${this.baseUrl}`);
4171
+ }
4168
4172
  }
4169
4173
  static getResponseType(e) {
4170
4174
  return e ? "blob" : "json";
@@ -4177,7 +4181,7 @@ const ae = class ae {
4177
4181
  return n;
4178
4182
  }
4179
4183
  };
4180
- a(ae, "baseUrl", ""), a(ae, "apiVersion", ""), a(ae, "host", ""), a(ae, "headers", {
4184
+ a(ae, "baseUrl", ""), a(ae, "apiVersion", "api"), a(ae, "host", ""), a(ae, "headers", {
4181
4185
  [Xn.ContentType]: ko.ApplicationJson
4182
4186
  });
4183
4187
  let de = ae;