sprof 0.1.11 → 0.1.13

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
@@ -4084,17 +4084,17 @@ class rn {
4084
4084
  }
4085
4085
  }
4086
4086
  var Xn = /* @__PURE__ */ ((t) => (t.ContentType = "Content-Type", t.Token = "token", t))(Xn || {}), ko = /* @__PURE__ */ ((t) => (t.ApplicationJson = "application/json", t.MultipartFormData = "multipart/form-data", t))(ko || {});
4087
- function gd(t, e) {
4087
+ function gd(t, e, i) {
4088
4088
  try {
4089
- const i = new URL(t);
4090
- return i.port = e.toString(), i.toString();
4089
+ let n = new URL(t);
4090
+ return n.port = e.toString(), n = new URL(i, n), n.toString();
4091
4091
  } catch {
4092
4092
  throw new Error(`Invalid host URL: ${t}`);
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, n), 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
+ let i = new URL(this.baseUrl);
4168
+ return i = new URL(e, i), 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;