@formant/data-sdk 1.33.0 → 1.34.0

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.
@@ -217,10 +217,10 @@ class AuthenticationStore {
217
217
  isAuthenticated() {
218
218
  return this._token !== void 0;
219
219
  }
220
- async loginToPeer(t, n) {
220
+ async loginToPeer(t, n, r) {
221
221
  if ((await fetch(`${t}/login`, {
222
222
  method: "POST",
223
- body: JSON.stringify({ password: n }),
223
+ body: JSON.stringify({ username: n, password: r }),
224
224
  headers: {
225
225
  "Content-Type": "application/json"
226
226
  }
@@ -27853,88 +27853,77 @@ class TelemetryUniverseData extends BasicUniverseDataConnector {
27853
27853
  const s = this.getAvailablePCDWorker();
27854
27854
  if (!s)
27855
27855
  throw new Error("No available pointcloud worker");
27856
- const c = async () => new Promise((U) => {
27857
- const B = (m) => {
27858
- p(), g(), h(), U(m);
27859
- }, R = {
27856
+ const c = async () => new Promise((u) => {
27857
+ const U = (g) => {
27858
+ R(), p(), u(g);
27859
+ }, B = {
27860
27860
  ...r,
27861
27861
  latestDataPoint: !0
27862
- }, p = this.subscribeToJson(
27862
+ }, R = this.subscribeTelemetry(
27863
27863
  n,
27864
- R,
27865
- (m) => {
27866
- m !== void 0 && typeof m != "symbol" && B("json");
27867
- }
27868
- ), g = this.subscribeTelemetry(
27869
- n,
27870
- R,
27864
+ B,
27871
27865
  "point cloud",
27872
- async (m) => {
27873
- m !== void 0 && typeof m != "symbol" && B("pointcloud");
27866
+ async (g) => {
27867
+ g !== void 0 && typeof g != "symbol" && U("pointcloud");
27874
27868
  }
27875
- ), h = this.subscribeTelemetry(
27869
+ ), p = this.subscribeTelemetry(
27876
27870
  n,
27877
- R,
27871
+ B,
27878
27872
  "localization",
27879
- async (m) => {
27880
- m !== void 0 && typeof m != "symbol" && B("localization");
27873
+ async (g) => {
27874
+ g !== void 0 && typeof g != "symbol" && U("localization");
27881
27875
  }
27882
27876
  );
27883
27877
  });
27884
27878
  let o = () => {
27885
27879
  }, d = () => {
27886
- }, u = () => {
27887
27880
  };
27888
- return c().then((U) => {
27889
- U === "json" ? o = this.subscribeToJson(
27890
- n,
27891
- r,
27892
- l
27893
- ) : U === "pointcloud" ? d = this.subscribeTelemetry(
27881
+ return c().then((u) => {
27882
+ u === "pointcloud" ? o = this.subscribeTelemetry(
27894
27883
  n,
27895
27884
  r,
27896
27885
  "point cloud",
27897
- async (B) => {
27898
- if (B === "too much data" || B === void 0) {
27886
+ async (U) => {
27887
+ if (U === "too much data" || U === void 0) {
27899
27888
  l(NoData);
27900
27889
  return;
27901
27890
  }
27902
- const R = B[B.length - 1][1];
27903
- if (typeof R == "string")
27904
- l(JSON.parse(R));
27891
+ const B = U[U.length - 1][1];
27892
+ if (typeof B == "string")
27893
+ l(JSON.parse(B));
27905
27894
  else {
27906
- const { url: p } = R;
27907
- s.postMessage({ url: p }), s.onmessage = (g) => {
27908
- g.data.url === p && l({
27909
- worldToLocal: R.worldToLocal,
27910
- pcd: g.data.pcd
27895
+ const { url: R } = B;
27896
+ s.postMessage({ url: R }), s.onmessage = (p) => {
27897
+ p.data.url === R && l({
27898
+ worldToLocal: B.worldToLocal,
27899
+ pcd: p.data.pcd
27911
27900
  });
27912
27901
  };
27913
27902
  }
27914
27903
  }
27915
- ) : U === "localization" && (u = this.subscribeTelemetry(
27904
+ ) : u === "localization" && (d = this.subscribeTelemetry(
27916
27905
  n,
27917
27906
  r,
27918
27907
  "localization",
27919
- async (B) => {
27920
- if (B === "too much data" || B === void 0) {
27908
+ async (U) => {
27909
+ if (U === "too much data" || U === void 0) {
27921
27910
  l(NoData);
27922
27911
  return;
27923
27912
  }
27924
- let R = B[B.length - 1][1];
27925
- if (R.url && (R = await (await fetch(R.url)).json()), R.pointClouds) {
27926
- const { url: p, worldToLocal: g } = R.pointClouds[0];
27927
- s.postMessage({ url: p }), s.onmessage = (h) => {
27928
- h.data.url === p && l({
27929
- worldToLocal: g,
27930
- pcd: h.data.pcd
27913
+ let B = U[U.length - 1][1];
27914
+ if (B.url && (B = await (await fetch(B.url)).json()), B.pointClouds) {
27915
+ const { url: R, worldToLocal: p } = B.pointClouds[0];
27916
+ s.postMessage({ url: R }), s.onmessage = (g) => {
27917
+ g.data.url === R && l({
27918
+ worldToLocal: p,
27919
+ pcd: g.data.pcd
27931
27920
  });
27932
27921
  };
27933
27922
  }
27934
27923
  }
27935
27924
  ));
27936
27925
  }), () => {
27937
- this.releasePCDWorker(s), o(), d(), u();
27926
+ this.releasePCDWorker(s), o(), d();
27938
27927
  };
27939
27928
  }
27940
27929
  subscribeToOdometry(n, r, l) {