@synnaxlabs/client 0.31.1 → 0.32.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.
package/dist/client.js CHANGED
@@ -17,9 +17,9 @@ const Sa = (r) => {
17
17
  return Object.keys(a).forEach((c) => {
18
18
  let l = a[c];
19
19
  const u = r(c);
20
- n.recursive && ($r(l) ? En(l, n.keepTypesOnRecursion) || (l = e(l, n)) : n.recursiveInArray && On(l) && (l = [...l].map((y) => {
21
- let d = y;
22
- return $r(y) ? En(d, n.keepTypesOnRecursion) || (d = e(y, n)) : On(y) && (d = e({ key: y }, n).key), d;
20
+ n.recursive && ($r(l) ? En(l, n.keepTypesOnRecursion) || (l = e(l, n)) : n.recursiveInArray && On(l) && (l = [...l].map((h) => {
21
+ let d = h;
22
+ return $r(h) ? En(d, n.keepTypesOnRecursion) || (d = e(h, n)) : On(h) && (d = e({ key: h }, n).key), d;
23
23
  }))), i[u] = l;
24
24
  }), i;
25
25
  };
@@ -82,8 +82,8 @@ let Ra = class {
82
82
  a[c] = [];
83
83
  }), n.forEach((c) => {
84
84
  const l = c.split(",").map((u) => u.trim());
85
- i.forEach((u, y) => {
86
- const d = this.parseValue(l[y]);
85
+ i.forEach((u, h) => {
86
+ const d = this.parseValue(l[h]);
87
87
  d != null && a[u].push(d);
88
88
  });
89
89
  }), e != null ? e.parse(a) : a;
@@ -211,9 +211,9 @@ const Qa = (r) => (e, t, n, i) => t === "dimension" ? [e, n] : [
211
211
  i ? n / r : n * r
212
212
  ], to = (r) => (e, t, n) => {
213
213
  if (e === null) return [r, n];
214
- const { lower: i, upper: a } = e, { lower: c, upper: l } = r, u = a - i, y = l - c;
215
- if (t === "dimension") return [r, n * (y / u)];
216
- const d = (n - i) * (y / u) + c;
214
+ const { lower: i, upper: a } = e, { lower: c, upper: l } = r, u = a - i, h = l - c;
215
+ if (t === "dimension") return [r, n * (h / u)];
216
+ const d = (n - i) * (h / u) + c;
217
217
  return [r, d];
218
218
  }, ro = (r) => (e, t, n) => [r, n], no = () => (r, e, t) => {
219
219
  if (r === null) throw new Error("cannot invert without bounds");
@@ -753,9 +753,9 @@ const R = class N {
753
753
  );
754
754
  }
755
755
  toString() {
756
- const e = this.truncate(N.DAY), t = this.truncate(N.HOUR), n = this.truncate(N.MINUTE), i = this.truncate(N.SECOND), a = this.truncate(N.MILLISECOND), c = this.truncate(N.MICROSECOND), l = this.truncate(N.NANOSECOND), u = e, y = t.sub(e), d = n.sub(t), h = i.sub(n), j = a.sub(i), D = c.sub(a), Q = l.sub(c);
756
+ const e = this.truncate(N.DAY), t = this.truncate(N.HOUR), n = this.truncate(N.MINUTE), i = this.truncate(N.SECOND), a = this.truncate(N.MILLISECOND), c = this.truncate(N.MICROSECOND), l = this.truncate(N.NANOSECOND), u = e, h = t.sub(e), d = n.sub(t), y = i.sub(n), D = a.sub(i), j = c.sub(a), Q = l.sub(c);
757
757
  let U = "";
758
- return u.isZero || (U += `${u.days}d `), y.isZero || (U += `${y.hours}h `), d.isZero || (U += `${d.minutes}m `), h.isZero || (U += `${h.seconds}s `), j.isZero || (U += `${j.milliseconds}ms `), D.isZero || (U += `${D.microseconds}µs `), Q.isZero || (U += `${Q.nanoseconds}ns`), U.trim();
758
+ return u.isZero || (U += `${u.days}d `), h.isZero || (U += `${h.hours}h `), d.isZero || (U += `${d.minutes}m `), y.isZero || (U += `${y.seconds}s `), D.isZero || (U += `${D.milliseconds}ms `), j.isZero || (U += `${j.microseconds}µs `), Q.isZero || (U += `${Q.nanoseconds}ns`), U.trim();
759
759
  }
760
760
  /** @returns the decimal number of days in the timespan */
761
761
  get days() {
@@ -1310,9 +1310,9 @@ const W = class Z extends Number {
1310
1310
  return this.valueOf() / Z.TERABYTE.valueOf();
1311
1311
  }
1312
1312
  toString() {
1313
- const e = this.truncate(Z.TERABYTE), t = this.truncate(Z.GIGABYTE), n = this.truncate(Z.MEGABYTE), i = this.truncate(Z.KILOBYTE), a = this.truncate(Z.BYTE), c = e, l = t.sub(e), u = n.sub(t), y = i.sub(n), d = a.sub(i);
1314
- let h = "";
1315
- return c.isZero || (h += `${c.terabytes}TB `), l.isZero || (h += `${l.gigabytes}GB `), u.isZero || (h += `${u.megabytes}MB `), y.isZero || (h += `${y.kilobytes}KB `), (!d.isZero || h === "") && (h += `${d.valueOf()}B`), h.trim();
1313
+ const e = this.truncate(Z.TERABYTE), t = this.truncate(Z.GIGABYTE), n = this.truncate(Z.MEGABYTE), i = this.truncate(Z.KILOBYTE), a = this.truncate(Z.BYTE), c = e, l = t.sub(e), u = n.sub(t), h = i.sub(n), d = a.sub(i);
1314
+ let y = "";
1315
+ return c.isZero || (y += `${c.terabytes}TB `), l.isZero || (y += `${l.gigabytes}GB `), u.isZero || (y += `${u.megabytes}MB `), h.isZero || (y += `${h.kilobytes}KB `), (!d.isZero || y === "") && (y += `${d.valueOf()}B`), y.trim();
1316
1316
  }
1317
1317
  /**
1318
1318
  * Creates a Size from the given number of bytes.
@@ -1405,50 +1405,50 @@ const Is = (r) => {
1405
1405
  key: l = po()
1406
1406
  } = e, u = e.data ?? [];
1407
1407
  if (u instanceof ue || typeof u == "object" && "isSynnaxSeries" in u && u.isSynnaxSeries === !0) {
1408
- const h = u;
1409
- this.key = h.key, this.dataType = h.dataType, this.sampleOffset = h.sampleOffset, this.gl = h.gl, this._data = h._data, this._timeRange = h._timeRange, this.alignment = h.alignment, this._cachedMin = h._cachedMin, this._cachedMax = h._cachedMax, this.writePos = h.writePos, this._refCount = h._refCount, this._cachedLength = h._cachedLength;
1408
+ const y = u;
1409
+ this.key = y.key, this.dataType = y.dataType, this.sampleOffset = y.sampleOffset, this.gl = y.gl, this._data = y._data, this._timeRange = y._timeRange, this.alignment = y.alignment, this._cachedMin = y._cachedMin, this._cachedMax = y._cachedMax, this.writePos = y.writePos, this._refCount = y._refCount, this._cachedLength = y._cachedLength;
1410
1410
  return;
1411
1411
  }
1412
- const y = Is(u), d = Array.isArray(u);
1412
+ const h = Is(u), d = Array.isArray(u);
1413
1413
  if (t != null) this.dataType = new x(t);
1414
1414
  else {
1415
1415
  if (u instanceof ArrayBuffer)
1416
1416
  throw new Error(
1417
1417
  "cannot infer data type from an ArrayBuffer instance when constructing a Series. Please provide a data type."
1418
1418
  );
1419
- if (d || y) {
1420
- let h = u;
1421
- if (!y) {
1419
+ if (d || h) {
1420
+ let y = u;
1421
+ if (!h) {
1422
1422
  if (u.length === 0)
1423
1423
  throw new Error(
1424
1424
  "cannot infer data type from a zero length JS array when constructing a Series. Please provide a data type."
1425
1425
  );
1426
- h = u[0];
1426
+ y = u[0];
1427
1427
  }
1428
- if (typeof h == "string") this.dataType = x.STRING;
1429
- else if (typeof h == "number") this.dataType = x.FLOAT64;
1430
- else if (typeof h == "bigint") this.dataType = x.INT64;
1431
- else if (typeof h == "boolean") this.dataType = x.BOOLEAN;
1432
- else if (h instanceof M || h instanceof Date || h instanceof M)
1428
+ if (typeof y == "string") this.dataType = x.STRING;
1429
+ else if (typeof y == "number") this.dataType = x.FLOAT64;
1430
+ else if (typeof y == "bigint") this.dataType = x.INT64;
1431
+ else if (typeof y == "boolean") this.dataType = x.BOOLEAN;
1432
+ else if (y instanceof M || y instanceof Date || y instanceof M)
1433
1433
  this.dataType = x.TIMESTAMP;
1434
- else if (typeof h == "object") this.dataType = x.JSON;
1434
+ else if (typeof y == "object") this.dataType = x.JSON;
1435
1435
  else
1436
1436
  throw new Error(
1437
- `cannot infer data type of ${typeof h} when constructing a Series from a JS array`
1437
+ `cannot infer data type of ${typeof y} when constructing a Series from a JS array`
1438
1438
  );
1439
1439
  } else this.dataType = new x(u);
1440
1440
  }
1441
- if (!d && !y) this._data = u;
1441
+ if (!d && !h) this._data = u;
1442
1442
  else {
1443
- let h = y ? [u] : u;
1444
- const j = h[0];
1445
- (j instanceof M || j instanceof Date || j instanceof _) && (h = h.map((D) => new M(D).valueOf())), this.dataType.equals(x.STRING) ? (this._cachedLength = h.length, this._data = new TextEncoder().encode(h.join(`
1443
+ let y = h ? [u] : u;
1444
+ const D = y[0];
1445
+ (D instanceof M || D instanceof Date || D instanceof _) && (y = y.map((j) => new M(j).valueOf())), this.dataType.equals(x.STRING) ? (this._cachedLength = y.length, this._data = new TextEncoder().encode(y.join(`
1446
1446
  `) + `
1447
- `)) : this.dataType.equals(x.JSON) ? (this._cachedLength = h.length, this._data = new TextEncoder().encode(
1448
- h.map((D) => Ft.encodeString(D)).join(`
1447
+ `)) : this.dataType.equals(x.JSON) ? (this._cachedLength = y.length, this._data = new TextEncoder().encode(
1448
+ y.map((j) => Ft.encodeString(j)).join(`
1449
1449
  `) + `
1450
1450
  `
1451
- )) : this._data = new this.dataType.Array(h).buffer;
1451
+ )) : this._data = new this.dataType.Array(y).buffer;
1452
1452
  }
1453
1453
  this.key = l, this.alignment = c, this.sampleOffset = i ?? 0, this._timeRange = n, this.gl = {
1454
1454
  control: null,
@@ -2114,31 +2114,31 @@ class qo extends Bs {
2114
2114
  params: {},
2115
2115
  role: "client"
2116
2116
  },
2117
- async (y) => {
2118
- const d = { ...y, params: {} };
2117
+ async (h) => {
2118
+ const d = { ...h, params: {} };
2119
2119
  l.headers = {
2120
2120
  ...this.headers,
2121
- ...y.params
2121
+ ...h.params
2122
2122
  };
2123
- let h;
2123
+ let y;
2124
2124
  try {
2125
- h = await Bn(y.protocol)(y.target, l);
2126
- } catch (D) {
2127
- let Q = D;
2125
+ y = await Bn(h.protocol)(h.target, l);
2126
+ } catch (j) {
2127
+ let Q = j;
2128
2128
  return Q.message === "Load failed" && (Q = new xe({ url: c })), [d, Q];
2129
2129
  }
2130
- const j = await h.arrayBuffer();
2131
- if (h != null && h.ok)
2132
- return i != null && (a = this.encoder.decode(j, i)), [d, null];
2130
+ const D = await y.arrayBuffer();
2131
+ if (y != null && y.ok)
2132
+ return i != null && (a = this.encoder.decode(D, i)), [d, null];
2133
2133
  try {
2134
- if (h.status !== 400) return [d, new Error(h.statusText)];
2135
- const D = this.encoder.decode(j, Rt), Q = cn(D);
2134
+ if (y.status !== 400) return [d, new Error(y.statusText)];
2135
+ const j = this.encoder.decode(D, Rt), Q = cn(j);
2136
2136
  return [d, Q];
2137
- } catch (D) {
2137
+ } catch (j) {
2138
2138
  return [
2139
2139
  d,
2140
2140
  new Error(
2141
- `[freighter] - failed to decode error: ${h.statusText}: ${D.message}`
2141
+ `[freighter] - failed to decode error: ${y.statusText}: ${j.message}`
2142
2142
  )
2143
2143
  ];
2144
2144
  }
@@ -2222,10 +2222,10 @@ const Fo = "freighterctx", Vo = 1e3, Ko = 1001, Jo = [Vo, Ko], Ho = (r) => Jo.in
2222
2222
  const [, c] = await this.executeMiddleware(
2223
2223
  { target: e, protocol: "websocket", params: {}, role: "client" },
2224
2224
  async (l) => {
2225
- const u = i(this.buildURL(e, l)), y = { ...l, params: {} };
2225
+ const u = i(this.buildURL(e, l)), h = { ...l, params: {} };
2226
2226
  u.binaryType = Ls.MESSAGE_TYPE;
2227
2227
  const d = await this.wrapSocket(u, t, n);
2228
- return d instanceof Error ? [y, d] : (a = d, [y, null]);
2228
+ return d instanceof Error ? [h, d] : (a = d, [h, null]);
2229
2229
  }
2230
2230
  );
2231
2231
  if (c != null) throw c;
@@ -2273,9 +2273,9 @@ const ar = s.union([
2273
2273
  return Object.keys(a).forEach((c) => {
2274
2274
  let l = a[c];
2275
2275
  const u = r(c);
2276
- n.recursive && (Pr(l) ? Zn(l, n.keepTypesOnRecursion) || (l = e(l, n)) : n.recursiveInArray && Un(l) && (l = [...l].map((y) => {
2277
- let d = y;
2278
- return Pr(y) ? Zn(d, n.keepTypesOnRecursion) || (d = e(y, n)) : Un(y) && (d = e({ key: y }, n).key), d;
2276
+ n.recursive && (Pr(l) ? Zn(l, n.keepTypesOnRecursion) || (l = e(l, n)) : n.recursiveInArray && Un(l) && (l = [...l].map((h) => {
2277
+ let d = h;
2278
+ return Pr(h) ? Zn(d, n.keepTypesOnRecursion) || (d = e(h, n)) : Un(h) && (d = e({ key: h }, n).key), d;
2279
2279
  }))), i[u] = l;
2280
2280
  }), i;
2281
2281
  };
@@ -2337,10 +2337,10 @@ let qs = class {
2337
2337
  return a.forEach((l) => {
2338
2338
  c[l] = [];
2339
2339
  }), i.forEach((l) => {
2340
- const u = l.split(",").map((y) => y.trim());
2341
- a.forEach((y, d) => {
2342
- const h = this.parseValue(u[d]);
2343
- h != null && c[y].push(h);
2340
+ const u = l.split(",").map((h) => h.trim());
2341
+ a.forEach((h, d) => {
2342
+ const y = this.parseValue(u[d]);
2343
+ y != null && c[h].push(y);
2344
2344
  });
2345
2345
  }), t != null ? t.parse(c) : c;
2346
2346
  }
@@ -2473,9 +2473,9 @@ const Pc = (r) => (e, t, n, i) => t === "dimension" ? [e, n] : [
2473
2473
  i ? n / r : n * r
2474
2474
  ], jc = (r) => (e, t, n) => {
2475
2475
  if (e === null) return [r, n];
2476
- const { lower: i, upper: a } = e, { lower: c, upper: l } = r, u = a - i, y = l - c;
2477
- if (t === "dimension") return [r, n * (y / u)];
2478
- const d = (n - i) * (y / u) + c;
2476
+ const { lower: i, upper: a } = e, { lower: c, upper: l } = r, u = a - i, h = l - c;
2477
+ if (t === "dimension") return [r, n * (h / u)];
2478
+ const d = (n - i) * (h / u) + c;
2479
2479
  return [r, d];
2480
2480
  }, Mc = (r) => (e, t, n) => [r, n], Bc = () => (r, e, t) => {
2481
2481
  if (r === null) throw new Error("cannot invert without bounds");
@@ -3023,9 +3023,9 @@ const P = class I {
3023
3023
  );
3024
3024
  }
3025
3025
  toString() {
3026
- const e = this.truncate(I.DAY), t = this.truncate(I.HOUR), n = this.truncate(I.MINUTE), i = this.truncate(I.SECOND), a = this.truncate(I.MILLISECOND), c = this.truncate(I.MICROSECOND), l = this.truncate(I.NANOSECOND), u = e, y = t.sub(e), d = n.sub(t), h = i.sub(n), j = a.sub(i), D = c.sub(a), Q = l.sub(c);
3026
+ const e = this.truncate(I.DAY), t = this.truncate(I.HOUR), n = this.truncate(I.MINUTE), i = this.truncate(I.SECOND), a = this.truncate(I.MILLISECOND), c = this.truncate(I.MICROSECOND), l = this.truncate(I.NANOSECOND), u = e, h = t.sub(e), d = n.sub(t), y = i.sub(n), D = a.sub(i), j = c.sub(a), Q = l.sub(c);
3027
3027
  let U = "";
3028
- return u.isZero || (U += `${u.days}d `), y.isZero || (U += `${y.hours}h `), d.isZero || (U += `${d.minutes}m `), h.isZero || (U += `${h.seconds}s `), j.isZero || (U += `${j.milliseconds}ms `), D.isZero || (U += `${D.microseconds}µs `), Q.isZero || (U += `${Q.nanoseconds}ns`), U.trim();
3028
+ return u.isZero || (U += `${u.days}d `), h.isZero || (U += `${h.hours}h `), d.isZero || (U += `${d.minutes}m `), y.isZero || (U += `${y.seconds}s `), D.isZero || (U += `${D.milliseconds}ms `), j.isZero || (U += `${j.microseconds}µs `), Q.isZero || (U += `${Q.nanoseconds}ns`), U.trim();
3029
3029
  }
3030
3030
  /** @returns the decimal number of days in the timespan */
3031
3031
  get days() {
@@ -3581,9 +3581,9 @@ const G = class L extends Number {
3581
3581
  return this.valueOf() / L.TERABYTE.valueOf();
3582
3582
  }
3583
3583
  toString() {
3584
- const e = this.truncate(L.TERABYTE), t = this.truncate(L.GIGABYTE), n = this.truncate(L.MEGABYTE), i = this.truncate(L.KILOBYTE), a = this.truncate(L.BYTE), c = e, l = t.sub(e), u = n.sub(t), y = i.sub(n), d = a.sub(i);
3585
- let h = "";
3586
- return c.isZero || (h += `${c.terabytes}TB `), l.isZero || (h += `${l.gigabytes}GB `), u.isZero || (h += `${u.megabytes}MB `), y.isZero || (h += `${y.kilobytes}KB `), (!d.isZero || h === "") && (h += `${d.valueOf()}B`), h.trim();
3584
+ const e = this.truncate(L.TERABYTE), t = this.truncate(L.GIGABYTE), n = this.truncate(L.MEGABYTE), i = this.truncate(L.KILOBYTE), a = this.truncate(L.BYTE), c = e, l = t.sub(e), u = n.sub(t), h = i.sub(n), d = a.sub(i);
3585
+ let y = "";
3586
+ return c.isZero || (y += `${c.terabytes}TB `), l.isZero || (y += `${l.gigabytes}GB `), u.isZero || (y += `${u.megabytes}MB `), h.isZero || (y += `${h.kilobytes}KB `), (!d.isZero || y === "") && (y += `${d.valueOf()}B`), y.trim();
3587
3587
  }
3588
3588
  /**
3589
3589
  * Creates a Size from the given number of bytes.
@@ -3676,50 +3676,50 @@ const ti = (r) => {
3676
3676
  key: l = Qs()
3677
3677
  } = e, u = e.data ?? [];
3678
3678
  if (u instanceof ye || typeof u == "object" && "isSynnaxSeries" in u && u.isSynnaxSeries === !0) {
3679
- const h = u;
3680
- this.key = h.key, this.dataType = h.dataType, this.sampleOffset = h.sampleOffset, this.gl = h.gl, this._data = h._data, this._timeRange = h._timeRange, this.alignment = h.alignment, this._cachedMin = h._cachedMin, this._cachedMax = h._cachedMax, this.writePos = h.writePos, this._refCount = h._refCount, this._cachedLength = h._cachedLength;
3679
+ const y = u;
3680
+ this.key = y.key, this.dataType = y.dataType, this.sampleOffset = y.sampleOffset, this.gl = y.gl, this._data = y._data, this._timeRange = y._timeRange, this.alignment = y.alignment, this._cachedMin = y._cachedMin, this._cachedMax = y._cachedMax, this.writePos = y.writePos, this._refCount = y._refCount, this._cachedLength = y._cachedLength;
3681
3681
  return;
3682
3682
  }
3683
- const y = ti(u), d = Array.isArray(u);
3683
+ const h = ti(u), d = Array.isArray(u);
3684
3684
  if (t != null) this.dataType = new E(t);
3685
3685
  else {
3686
3686
  if (u instanceof ArrayBuffer)
3687
3687
  throw new Error(
3688
3688
  "cannot infer data type from an ArrayBuffer instance when constructing a Series. Please provide a data type."
3689
3689
  );
3690
- if (d || y) {
3691
- let h = u;
3692
- if (!y) {
3690
+ if (d || h) {
3691
+ let y = u;
3692
+ if (!h) {
3693
3693
  if (u.length === 0)
3694
3694
  throw new Error(
3695
3695
  "cannot infer data type from a zero length JS array when constructing a Series. Please provide a data type."
3696
3696
  );
3697
- h = u[0];
3697
+ y = u[0];
3698
3698
  }
3699
- if (typeof h == "string") this.dataType = E.STRING;
3700
- else if (typeof h == "number") this.dataType = E.FLOAT64;
3701
- else if (typeof h == "bigint") this.dataType = E.INT64;
3702
- else if (typeof h == "boolean") this.dataType = E.BOOLEAN;
3703
- else if (h instanceof k || h instanceof Date || h instanceof k)
3699
+ if (typeof y == "string") this.dataType = E.STRING;
3700
+ else if (typeof y == "number") this.dataType = E.FLOAT64;
3701
+ else if (typeof y == "bigint") this.dataType = E.INT64;
3702
+ else if (typeof y == "boolean") this.dataType = E.BOOLEAN;
3703
+ else if (y instanceof k || y instanceof Date || y instanceof k)
3704
3704
  this.dataType = E.TIMESTAMP;
3705
- else if (typeof h == "object") this.dataType = E.JSON;
3705
+ else if (typeof y == "object") this.dataType = E.JSON;
3706
3706
  else
3707
3707
  throw new Error(
3708
- `cannot infer data type of ${typeof h} when constructing a Series from a JS array`
3708
+ `cannot infer data type of ${typeof y} when constructing a Series from a JS array`
3709
3709
  );
3710
3710
  } else this.dataType = new E(u);
3711
3711
  }
3712
- if (!d && !y) this._data = u;
3712
+ if (!d && !h) this._data = u;
3713
3713
  else {
3714
- let h = y ? [u] : u;
3715
- const j = h[0];
3716
- (j instanceof k || j instanceof Date || j instanceof S) && (h = h.map((D) => new k(D).valueOf())), this.dataType.equals(E.STRING) ? (this._cachedLength = h.length, this._data = new TextEncoder().encode(h.join(`
3714
+ let y = h ? [u] : u;
3715
+ const D = y[0];
3716
+ (D instanceof k || D instanceof Date || D instanceof S) && (y = y.map((j) => new k(j).valueOf())), this.dataType.equals(E.STRING) ? (this._cachedLength = y.length, this._data = new TextEncoder().encode(y.join(`
3717
3717
  `) + `
3718
- `)) : this.dataType.equals(E.JSON) ? (this._cachedLength = h.length, this._data = new TextEncoder().encode(
3719
- h.map((D) => He.encodeString(D)).join(`
3718
+ `)) : this.dataType.equals(E.JSON) ? (this._cachedLength = y.length, this._data = new TextEncoder().encode(
3719
+ y.map((j) => He.encodeString(j)).join(`
3720
3720
  `) + `
3721
3721
  `
3722
- )) : this._data = new this.dataType.Array(h).buffer;
3722
+ )) : this._data = new this.dataType.Array(y).buffer;
3723
3723
  }
3724
3724
  this.key = l, this.alignment = c, this.sampleOffset = i ?? 0, this._timeRange = n, this.gl = {
3725
3725
  control: null,
@@ -4340,14 +4340,14 @@ let Sl = ii;
4340
4340
  new Sl();
4341
4341
  const tn = s.string().regex(/^\d+\.\d+\.\d+$/), xt = (r, e, t = {}) => {
4342
4342
  t.checkMajor ?? (t.checkMajor = !0), t.checkMinor ?? (t.checkMinor = !0), t.checkPatch ?? (t.checkPatch = !0);
4343
- const n = tn.parse(r), i = tn.parse(e), [a, c, l] = n.split(".").map(Number), [u, y, d] = i.split(".").map(Number);
4343
+ const n = tn.parse(r), i = tn.parse(e), [a, c, l] = n.split(".").map(Number), [u, h, d] = i.split(".").map(Number);
4344
4344
  if (t.checkMajor) {
4345
4345
  if (a < u) return Mr;
4346
4346
  if (a > u) return Br;
4347
4347
  }
4348
4348
  if (t.checkMinor) {
4349
- if (c < y) return Mr;
4350
- if (c > y) return Br;
4349
+ if (c < h) return Mr;
4350
+ if (c > h) return Br;
4351
4351
  }
4352
4352
  if (t.checkPatch) {
4353
4353
  if (l < d) return Mr;
@@ -4368,42 +4368,52 @@ const tn = s.string().regex(/^\d+\.\d+\.\d+$/), xt = (r, e, t = {}) => {
4368
4368
  name: r,
4369
4369
  migrations: e,
4370
4370
  targetSchema: t,
4371
- def: n
4371
+ defaultVersion: n,
4372
+ def: i
4372
4373
  }) => {
4373
- const i = Object.keys(e).sort(xt).pop();
4374
- if (i == null)
4375
- return (u) => {
4376
- if (u.version !== n.version)
4374
+ const a = Object.keys(e).sort(xt).pop();
4375
+ if (a == null)
4376
+ return (h) => {
4377
+ if (h.version == null && (h.version = n), h.version !== i.version)
4377
4378
  return console.log(
4378
- `${r} version ${u.version} is newer than latest version of ${n.version}.
4379
+ `${r} version ${h.version} is newer than latest version of ${i.version}.
4379
4380
  Returning default instead.
4380
4381
  `
4381
- ), n;
4382
+ ), i;
4382
4383
  try {
4383
- return t != null ? t.parse(u) : u;
4384
- } catch (y) {
4385
- return console.log(`${r} failed to parse default. Exiting with default`), console.error(y), n;
4384
+ return t != null ? t.parse(h) : h;
4385
+ } catch (d) {
4386
+ return console.log(`${r} failed to parse default. Exiting with default`), console.error(d), i;
4386
4387
  }
4387
4388
  };
4388
- const a = Object.keys(e).length;
4389
- let c = !1;
4390
- const l = (u) => {
4389
+ const c = Object.keys(e).length;
4390
+ let l = !1;
4391
+ const u = (h) => {
4391
4392
  try {
4392
- if (a === 0 || ai(u.version, i))
4393
- return console.log(c ? `${r} ${u.version} now up to date` : `${r} version ${u.version} is up to date with target version ${n.version}`), u;
4394
- const y = u.version, d = e[y], h = d(u);
4395
- return c = !0, l(h);
4396
- } catch (y) {
4393
+ if (c === 0 || ai(h.version, a))
4394
+ return console.log(l ? `${r} ${h.version} now up to date` : `${r} version ${h.version} is up to date with target version ${i.version}`), h;
4395
+ const d = h.version, y = e[d], D = y(h);
4396
+ return l = !0, u(D);
4397
+ } catch (d) {
4397
4398
  return console.log(
4398
- `${r} failed to migrate from ${u.version} to ${i}`
4399
- ), console.error(y), n;
4399
+ `${r} failed to migrate from ${h.version} to ${a}`
4400
+ ), console.error(d), i;
4400
4401
  }
4401
4402
  };
4402
- return (u) => {
4403
+ return (h) => {
4403
4404
  try {
4404
- return l(u);
4405
- } catch (y) {
4406
- return console.log(`${r} failed to parse final result. Exiting with default`), console.error(y), n;
4405
+ if (h.version == null)
4406
+ if (n != null)
4407
+ console.log(
4408
+ `${r} version is null. Setting version to default of ${n}`
4409
+ ), h.version = n;
4410
+ else
4411
+ return console.log(
4412
+ `${r} version is null and no default version set. Exiting with default`
4413
+ ), i;
4414
+ return u(h);
4415
+ } catch (d) {
4416
+ return console.log(`${r} failed to parse final result. Exiting with default`), console.error(d), i;
4407
4417
  }
4408
4418
  };
4409
4419
  }, Qn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
@@ -4995,7 +5005,7 @@ class mr extends Ce.Observer {
4995
5005
  this.dependents = this.dependents.concat(a), this.notify(this.dependents);
4996
5006
  });
4997
5007
  });
4998
- this.resourceType = c, this.internal = l, this.target = t, this.dependents = n, this.resourceType != null && (this.dependents = this.dependents.filter((y) => y.id.type === this.resourceType)), this.client = u, this.relType = i, this.relDir = a, this.internal.resources.onChange(this.handleResourceChange), this.internal.relationships.onChange(this.handleRelationshipChange);
5008
+ this.resourceType = c, this.internal = l, this.target = t, this.dependents = n, this.resourceType != null && (this.dependents = this.dependents.filter((h) => h.id.type === this.resourceType)), this.client = u, this.relType = i, this.relDir = a, this.internal.resources.onChange(this.handleResourceChange), this.internal.relationships.onChange(this.handleRelationshipChange);
4999
5009
  }
5000
5010
  static async open(t, n, i) {
5001
5011
  const a = await Pt.open(n, i);
@@ -5163,22 +5173,22 @@ var uu = function(r, e, t, n) {
5163
5173
  return new (t || (t = Promise))(function(a, c) {
5164
5174
  function l(d) {
5165
5175
  try {
5166
- y(n.next(d));
5167
- } catch (h) {
5168
- c(h);
5176
+ h(n.next(d));
5177
+ } catch (y) {
5178
+ c(y);
5169
5179
  }
5170
5180
  }
5171
5181
  function u(d) {
5172
5182
  try {
5173
- y(n.throw(d));
5174
- } catch (h) {
5175
- c(h);
5183
+ h(n.throw(d));
5184
+ } catch (y) {
5185
+ c(y);
5176
5186
  }
5177
5187
  }
5178
- function y(d) {
5188
+ function h(d) {
5179
5189
  d.done ? a(d.value) : i(d.value).then(l, u);
5180
5190
  }
5181
- y((n = n.apply(r, e || [])).next());
5191
+ h((n = n.apply(r, e || [])).next());
5182
5192
  });
5183
5193
  };
5184
5194
  class hu {
@@ -5281,22 +5291,22 @@ var du = function(r, e, t, n) {
5281
5291
  return new (t || (t = Promise))(function(a, c) {
5282
5292
  function l(d) {
5283
5293
  try {
5284
- y(n.next(d));
5285
- } catch (h) {
5286
- c(h);
5294
+ h(n.next(d));
5295
+ } catch (y) {
5296
+ c(y);
5287
5297
  }
5288
5298
  }
5289
5299
  function u(d) {
5290
5300
  try {
5291
- y(n.throw(d));
5292
- } catch (h) {
5293
- c(h);
5301
+ h(n.throw(d));
5302
+ } catch (y) {
5303
+ c(y);
5294
5304
  }
5295
5305
  }
5296
- function y(d) {
5306
+ function h(d) {
5297
5307
  d.done ? a(d.value) : i(d.value).then(l, u);
5298
5308
  }
5299
- y((n = n.apply(r, e || [])).next());
5309
+ h((n = n.apply(r, e || [])).next());
5300
5310
  });
5301
5311
  };
5302
5312
  class fu {
@@ -5519,9 +5529,9 @@ class Si {
5519
5529
  isIndex: c = !1,
5520
5530
  index: l = 0,
5521
5531
  internal: u = !1,
5522
- virtual: y = !1,
5532
+ virtual: h = !1,
5523
5533
  frameClient: d,
5524
- alias: h
5534
+ alias: y
5525
5535
  }) {
5526
5536
  o(this, "_frameClient");
5527
5537
  /**
@@ -5572,7 +5582,7 @@ class Si {
5572
5582
  * database, but can still be used for streaming purposes.
5573
5583
  */
5574
5584
  o(this, "virtual");
5575
- this.key = a, this.name = n, this.rate = new hn(t ?? 0), this.dataType = new E(e), this.leaseholder = i, this.index = l, this.isIndex = c, this.internal = u, this.alias = h, this.virtual = y, this._frameClient = d ?? null;
5585
+ this.key = a, this.name = n, this.rate = new hn(t ?? 0), this.dataType = new E(e), this.leaseholder = i, this.index = l, this.isIndex = c, this.internal = u, this.alias = y, this.virtual = h, this._frameClient = d ?? null;
5576
5586
  }
5577
5587
  get framer() {
5578
5588
  if (this._frameClient == null)
@@ -5638,8 +5648,8 @@ let Ni = class {
5638
5648
  const { retrieveIfNameExists: n = !1 } = t, i = !Array.isArray(e);
5639
5649
  let a = T(e), c = [];
5640
5650
  if (n) {
5641
- const l = await this.retriever.retrieve(a.map((y) => y.name)), u = new Set(l.map((y) => y.name));
5642
- a = a.filter((y) => !u.has(y.name)), c = this.sugar(l);
5651
+ const l = await this.retriever.retrieve(a.map((h) => h.name)), u = new Set(l.map((h) => h.name));
5652
+ a = a.filter((h) => !u.has(h.name)), c = this.sugar(l);
5643
5653
  }
5644
5654
  return c = c.concat(this.sugar(await this.writer.create(a))), i ? c[0] : c;
5645
5655
  }
@@ -5753,9 +5763,12 @@ const Tf = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5753
5763
  }, Symbol.toStringTag, { value: "Module" })), st = s.string().uuid(), Mt = s.object({
5754
5764
  key: st,
5755
5765
  username: s.string().min(1),
5756
- firstName: s.string().optional().default(""),
5757
- lastName: s.string().optional().default(""),
5758
- rootUser: s.boolean().optional().default(!0)
5766
+ // defaults for firstName, lastName, and rootUser are done to give compatibility with
5767
+ // servers running v0.30.x and earlier. These defaults should be removed in a future
5768
+ // release.
5769
+ firstName: s.string().default(""),
5770
+ lastName: s.string().default(""),
5771
+ rootUser: s.boolean().default(!0)
5759
5772
  }), ki = Mt.partial({ key: !0, firstName: !0, lastName: !0 }).omit({ rootUser: !0 }).extend({ password: s.string().min(1) }), Ai = "user", $u = (r) => new b({ type: Ai, key: r }), Ru = s.object({
5760
5773
  keys: st.array().optional(),
5761
5774
  usernames: s.string().array().optional()
@@ -5911,9 +5924,9 @@ let Qu = class {
5911
5924
  this.credentials,
5912
5925
  Fu,
5913
5926
  Vu
5914
- ).then(([y, d]) => {
5927
+ ).then(([h, d]) => {
5915
5928
  if (d != null) return l(d);
5916
- this.token = y == null ? void 0 : y.token, this.user = y == null ? void 0 : y.user, this.authenticated = !0, l(null);
5929
+ this.token = h == null ? void 0 : h.token, this.user = h == null ? void 0 : h.user, this.authenticated = !0, l(null);
5917
5930
  }).catch(u);
5918
5931
  }));
5919
5932
  const c = await this.authenticating;
@@ -5943,7 +5956,7 @@ const eh = ["disconnected", "connecting", "connected", "failed"], Ri = s.enum(eh
5943
5956
  error: void 0,
5944
5957
  message: "Disconnected",
5945
5958
  clientServerCompatible: !1,
5946
- clientVersion: "0.31.1"
5959
+ clientVersion: "0.32.0"
5947
5960
  }, ls = (r, e, t) => {
5948
5961
  const n = t ? "cluster" : "client";
5949
5962
  return `Synnax cluster node version ${r != null ? r + " " : ""}is too ${t ? "old" : "new"} for client version ${e}.
@@ -6388,16 +6401,16 @@ class fn {
6388
6401
  `);
6389
6402
  const c = [], l = [];
6390
6403
  for (let u = 0; u < e.length; u++) {
6391
- const y = await this.fetchChannel(e[u]);
6404
+ const h = await this.fetchChannel(e[u]);
6392
6405
  if (u >= t.length)
6393
6406
  throw new B(`
6394
6407
  Received an array of channel names or keys but not enough series.
6395
6408
  `);
6396
6409
  const d = new ke({
6397
6410
  data: t[u],
6398
- dataType: y.dataType
6411
+ dataType: h.dataType
6399
6412
  });
6400
- c.push(y.key), l.push(d);
6413
+ c.push(h.key), l.push(d);
6401
6414
  }
6402
6415
  return new Y(c, l);
6403
6416
  }
@@ -6407,18 +6420,18 @@ class fn {
6407
6420
  let l = [];
6408
6421
  return l = c.columns.map((u) => {
6409
6422
  var d;
6410
- const y = typeof u == "string" ? (d = this.adapter) == null ? void 0 : d.get(u) : u;
6411
- if (y == null)
6423
+ const h = typeof u == "string" ? (d = this.adapter) == null ? void 0 : d.get(u) : u;
6424
+ if (h == null)
6412
6425
  throw new B(`
6413
6426
  Channel ${u} was not provided in the list of channels when opening the writer
6414
6427
  `);
6415
- return y;
6428
+ return h;
6416
6429
  }), new Y(l, c.series);
6417
6430
  }
6418
6431
  const n = [], i = [], a = Object.entries(e);
6419
6432
  for (let c = 0; c < a.length; c++) {
6420
- const [l, u] = a[c], y = await this.fetchChannel(l), d = new ke({ data: u, dataType: y.dataType });
6421
- n.push(y.key), i.push(d);
6433
+ const [l, u] = a[c], h = await this.fetchChannel(l), d = new ke({ data: u, dataType: h.dataType });
6434
+ n.push(h.key), i.push(d);
6422
6435
  }
6423
6436
  return new Y(n, i);
6424
6437
  }
@@ -6724,23 +6737,23 @@ let ji = (me = class {
6724
6737
  controlSubject: c,
6725
6738
  mode: l = 1,
6726
6739
  errOnUnauthorized: u = !1,
6727
- enableAutoCommit: y = !1,
6740
+ enableAutoCommit: h = !1,
6728
6741
  autoIndexPersistInterval: d = S.SECOND
6729
6742
  }) {
6730
- const h = await fn.open(e, n), j = await t.stream(me.ENDPOINT, ph, gh), D = new me(j, h);
6731
- return await D.execute({
6743
+ const y = await fn.open(e, n), D = await t.stream(me.ENDPOINT, ph, gh), j = new me(D, y);
6744
+ return await j.execute({
6732
6745
  command: 0,
6733
6746
  config: {
6734
6747
  start: new k(i),
6735
- keys: h.keys,
6748
+ keys: y.keys,
6736
6749
  controlSubject: c,
6737
6750
  authorities: T(a),
6738
6751
  mode: yh(l),
6739
6752
  errOnUnauthorized: u,
6740
- enableAutoCommit: y,
6753
+ enableAutoCommit: h,
6741
6754
  autoIndexPersistInterval: d
6742
6755
  }
6743
- }), D;
6756
+ }), j;
6744
6757
  }
6745
6758
  /**
6746
6759
  * Writes the given frame to the database.
@@ -7240,7 +7253,7 @@ const Bf = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7240
7253
  )
7241
7254
  }), Ki = "task", Lh = (r) => new b({ type: Ki, key: r.toString() }), Ot = "sy_task_state", ys = "sy_task_cmd", Gt = new Error("Task not created");
7242
7255
  class Ji {
7243
- constructor(e, t, n, i, a = !1, c = !1, l, u = null, y = null, d = null) {
7256
+ constructor(e, t, n, i, a = !1, c = !1, l, u = null, h = null, d = null) {
7244
7257
  o(this, "key");
7245
7258
  o(this, "name");
7246
7259
  o(this, "internal");
@@ -7251,7 +7264,7 @@ class Ji {
7251
7264
  o(this, "frameClient");
7252
7265
  o(this, "ontologyClient");
7253
7266
  o(this, "rangeClient");
7254
- this.key = e, this.name = t, this.type = n, this.config = i, this.internal = a, this.snapshot = c, l !== null && (this.state = l), this.frameClient = u, this.ontologyClient = y, this.rangeClient = d;
7267
+ this.key = e, this.name = t, this.type = n, this.config = i, this.internal = a, this.snapshot = c, l !== null && (this.state = l), this.frameClient = u, this.ontologyClient = h, this.rangeClient = d;
7255
7268
  }
7256
7269
  get payload() {
7257
7270
  return {
@@ -7281,11 +7294,11 @@ class Ji {
7281
7294
  for (; ; ) {
7282
7295
  const u = await Promise.any([i.read(), l]);
7283
7296
  if (u === !1) throw new Error("Command timed out");
7284
- const y = At.safeParse(u.at(-1).sy_task_state);
7285
- if (y.success) {
7286
- if (c = y.data, c.key === a) break;
7297
+ const h = At.safeParse(u.at(-1).sy_task_state);
7298
+ if (h.success) {
7299
+ if (c = h.data, c.key === a) break;
7287
7300
  } else
7288
- console.error(y.error);
7301
+ console.error(h.error);
7289
7302
  }
7290
7303
  return i.close(), c;
7291
7304
  }
@@ -7807,7 +7820,7 @@ o(ge, "GET_ENDPOINT", "/range/kv/get"), o(ge, "SET_ENDPOINT", "/range/kv/set"),
7807
7820
  let $t = ge;
7808
7821
  const Gr = (r) => new b({ type: "range", key: r });
7809
7822
  class ca {
7810
- constructor(e, t = F.ZERO, n, i, a, c, l, u, y, d, h) {
7823
+ constructor(e, t = F.ZERO, n, i, a, c, l, u, h, d, y) {
7811
7824
  o(this, "key");
7812
7825
  o(this, "name");
7813
7826
  o(this, "kv");
@@ -7819,7 +7832,7 @@ class ca {
7819
7832
  o(this, "labelClient");
7820
7833
  o(this, "ontologyClient");
7821
7834
  o(this, "rangeClient");
7822
- this.key = n, this.name = e, this.timeRange = t, this.frameClient = a, this.color = i, this.kv = c, this.aliaser = l, this.channels = u, this.labelClient = y, this.ontologyClient = d, this.rangeClient = h;
7835
+ this.key = n, this.name = e, this.timeRange = t, this.frameClient = a, this.color = i, this.kv = c, this.aliaser = l, this.channels = u, this.labelClient = h, this.ontologyClient = d, this.rangeClient = y;
7823
7836
  }
7824
7837
  get ontologyID() {
7825
7838
  return new b({ key: this.key, type: "range" });
@@ -8507,14 +8520,14 @@ class Vd extends Bi {
8507
8520
  * the client from polling the cluster for connectivity information.
8508
8521
  */
8509
8522
  constructor(t) {
8510
- const n = Fd.parse(t), { host: i, port: a, username: c, password: l, connectivityPollFrequency: u, secure: y } = n, d = new Wy(new bl({ host: i, port: Number(a) }), y);
8523
+ const n = Fd.parse(t), { host: i, port: a, username: c, password: l, connectivityPollFrequency: u, secure: h } = n, d = new Wy(new bl({ host: i, port: Number(a) }), h);
8511
8524
  d.use(xl);
8512
- let h;
8513
- c != null && l != null && (h = new Qu(d.unary, { username: c, password: l }), d.use(h.middleware()));
8514
- const j = new dn(
8525
+ let y;
8526
+ c != null && l != null && (y = new Qu(d.unary, { username: c, password: l }), d.use(y.middleware()));
8527
+ const D = new dn(
8515
8528
  new It(d.unary)
8516
- ), D = new Ii(d.unary, j);
8517
- super(d.stream, d.unary, j);
8529
+ ), j = new Ii(d.unary, D);
8530
+ super(d.stream, d.unary, D);
8518
8531
  o(this, "createdAt");
8519
8532
  o(this, "props");
8520
8533
  o(this, "ranges");
@@ -8532,8 +8545,8 @@ class Vd extends Bi {
8532
8545
  /**
8533
8546
  * The version of the client.
8534
8547
  */
8535
- o(this, "clientVersion", "0.31.1");
8536
- this.createdAt = k.now(), this.props = n, this.auth = h, this.transport = d, this.channels = new Ni(this, j, d.unary, D), this.connectivity = new kt(
8548
+ o(this, "clientVersion", "0.32.0");
8549
+ this.createdAt = k.now(), this.props = n, this.auth = y, this.transport = d, this.channels = new Ni(this, D, d.unary, j), this.connectivity = new kt(
8537
8550
  d.unary,
8538
8551
  u,
8539
8552
  this.clientVersion,
@@ -8544,7 +8557,7 @@ class Vd extends Bi {
8544
8557
  this,
8545
8558
  Q,
8546
8559
  this.transport.unary,
8547
- j,
8560
+ D,
8548
8561
  this.labels,
8549
8562
  this.ontology
8550
8563
  ), this.access = new wi(this.transport.unary), this.user = new $i(this.transport.unary), this.workspaces = new wa(this.transport.unary);