@speckle/objectsender 2.23.8 → 2.23.9

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,36 +4,36 @@ var it = (t) => {
4
4
  };
5
5
  var Ct = (t, e, r) => e in t ? mt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
6
6
  var S = (t, e, r) => Ct(t, typeof e != "symbol" ? e + "" : e, r), X = (t, e, r) => e.has(t) || it("Cannot " + r);
7
- var T = (t, e, r) => (X(t, e, "read from private field"), r ? r.call(t) : e.get(t)), j = (t, e, r) => e.has(t) ? it("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, r), b = (t, e, r, a) => (X(t, e, "write to private field"), a ? a.call(t, r) : e.set(t, r), r), y = (t, e, r) => (X(t, e, "access private method"), r);
7
+ var T = (t, e, r) => (X(t, e, "read from private field"), r ? r.call(t) : e.get(t)), j = (t, e, r) => e.has(t) ? it("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, r), _ = (t, e, r, a) => (X(t, e, "write to private field"), a ? a.call(t, r) : e.set(t, r), r), y = (t, e, r) => (X(t, e, "access private method"), r);
8
8
  import "reflect-metadata";
9
9
  import { retry as wt, timeoutAt as St } from "@speckle/shared";
10
10
  function Y(t) {
11
- function e(k, _) {
12
- return k << _ | k >>> 32 - _;
11
+ function e(z, g) {
12
+ return z << g | z >>> 32 - g;
13
13
  }
14
- function r(k) {
15
- let _ = "", z, w;
16
- for (z = 7; z >= 0; z--)
17
- w = k >>> z * 4 & 15, _ += w.toString(16);
18
- return _;
14
+ function r(z) {
15
+ let g = "", A, w;
16
+ for (A = 7; A >= 0; A--)
17
+ w = z >>> A * 4 & 15, g += w.toString(16);
18
+ return g;
19
19
  }
20
- function a(k) {
21
- k = k.replace(/\r\n/g, `
20
+ function a(z) {
21
+ z = z.replace(/\r\n/g, `
22
22
  `);
23
- let _ = "";
24
- for (let z = 0; z < k.length; z++) {
25
- const w = k.charCodeAt(z);
26
- w < 128 ? _ += String.fromCharCode(w) : w > 127 && w < 2048 ? (_ += String.fromCharCode(w >> 6 | 192), _ += String.fromCharCode(w & 63 | 128)) : (_ += String.fromCharCode(w >> 12 | 224), _ += String.fromCharCode(w >> 6 & 63 | 128), _ += String.fromCharCode(w & 63 | 128));
23
+ let g = "";
24
+ for (let A = 0; A < z.length; A++) {
25
+ const w = z.charCodeAt(A);
26
+ w < 128 ? g += String.fromCharCode(w) : w > 127 && w < 2048 ? (g += String.fromCharCode(w >> 6 | 192), g += String.fromCharCode(w & 63 | 128)) : (g += String.fromCharCode(w >> 12 | 224), g += String.fromCharCode(w >> 6 & 63 | 128), g += String.fromCharCode(w & 63 | 128));
27
27
  }
28
- return _;
28
+ return g;
29
29
  }
30
- let i, n, g;
30
+ let i, n, b;
31
31
  const d = new Array(80);
32
- let O = 1732584193, $ = 4023233417, o = 2562383102, l = 271733878, v = 3285377520, f, s, c, u, p, m;
32
+ let O = 1732584193, k = 4023233417, s = 2562383102, l = 271733878, v = 3285377520, f, o, c, u, p, m;
33
33
  t = a(t);
34
34
  const C = t.length, P = [];
35
35
  for (n = 0; n < C - 3; n += 4)
36
- g = t.charCodeAt(n) << 24 | t.charCodeAt(n + 1) << 16 | t.charCodeAt(n + 2) << 8 | t.charCodeAt(n + 3), P.push(g);
36
+ b = t.charCodeAt(n) << 24 | t.charCodeAt(n + 1) << 16 | t.charCodeAt(n + 2) << 8 | t.charCodeAt(n + 3), P.push(b);
37
37
  switch (C % 4) {
38
38
  case 0:
39
39
  n = 2147483648;
@@ -53,17 +53,17 @@ function Y(t) {
53
53
  for (n = 0; n < 16; n++) d[n] = P[i + n];
54
54
  for (n = 16; n <= 79; n++)
55
55
  d[n] = e(d[n - 3] ^ d[n - 8] ^ d[n - 14] ^ d[n - 16], 1);
56
- for (f = O, s = $, c = o, u = l, p = v, n = 0; n <= 19; n++)
57
- m = e(f, 5) + (s & c | ~s & u) + p + d[n] + 1518500249 & 4294967295, p = u, u = c, c = e(s, 30), s = f, f = m;
56
+ for (f = O, o = k, c = s, u = l, p = v, n = 0; n <= 19; n++)
57
+ m = e(f, 5) + (o & c | ~o & u) + p + d[n] + 1518500249 & 4294967295, p = u, u = c, c = e(o, 30), o = f, f = m;
58
58
  for (n = 20; n <= 39; n++)
59
- m = e(f, 5) + (s ^ c ^ u) + p + d[n] + 1859775393 & 4294967295, p = u, u = c, c = e(s, 30), s = f, f = m;
59
+ m = e(f, 5) + (o ^ c ^ u) + p + d[n] + 1859775393 & 4294967295, p = u, u = c, c = e(o, 30), o = f, f = m;
60
60
  for (n = 40; n <= 59; n++)
61
- m = e(f, 5) + (s & c | s & u | c & u) + p + d[n] + 2400959708 & 4294967295, p = u, u = c, c = e(s, 30), s = f, f = m;
61
+ m = e(f, 5) + (o & c | o & u | c & u) + p + d[n] + 2400959708 & 4294967295, p = u, u = c, c = e(o, 30), o = f, f = m;
62
62
  for (n = 60; n <= 79; n++)
63
- m = e(f, 5) + (s ^ c ^ u) + p + d[n] + 3395469782 & 4294967295, p = u, u = c, c = e(s, 30), s = f, f = m;
64
- O = O + f & 4294967295, $ = $ + s & 4294967295, o = o + c & 4294967295, l = l + u & 4294967295, v = v + p & 4294967295;
63
+ m = e(f, 5) + (o ^ c ^ u) + p + d[n] + 3395469782 & 4294967295, p = u, u = c, c = e(o, 30), o = f, f = m;
64
+ O = O + f & 4294967295, k = k + o & 4294967295, s = s + c & 4294967295, l = l + u & 4294967295, v = v + p & 4294967295;
65
65
  }
66
- return (r(O) + r($) + r(o) + r(l) + r(v)).toLowerCase().substring(0, 40);
66
+ return (r(O) + r(k) + r(s) + r(l) + r(v)).toLowerCase().substring(0, 40);
67
67
  }
68
68
  var Tt = typeof global == "object" && global && global.Object === Object && global, vt = typeof self == "object" && self && self.Object === Object && self, tt = Tt || vt || Function("return this")(), D = tt.Symbol, lt = Object.prototype, jt = lt.hasOwnProperty, Ot = lt.toString, R = D ? D.toStringTag : void 0;
69
69
  function kt(t) {
@@ -294,8 +294,8 @@ function nt(t, e) {
294
294
  var a = arguments, i = e ? e.apply(this, a) : a[0], n = r.cache;
295
295
  if (n.has(i))
296
296
  return n.get(i);
297
- var g = t.apply(this, a);
298
- return r.cache = n.set(i, g) || n, g;
297
+ var b = t.apply(this, a);
298
+ return r.cache = n.set(i, b) || n, b;
299
299
  };
300
300
  return r.cache = new (nt.Cache || E)(), r;
301
301
  }
@@ -378,22 +378,22 @@ h = new WeakSet(), L = async function(e, r) {
378
378
  const a = `${this.uniqueId++}-obj`;
379
379
  this.lineage.push(a);
380
380
  const i = { speckle_type: e.speckle_type || "Base" };
381
- for (const o in e) {
382
- const l = e[o];
383
- if (l === void 0 || o === "id" || o.startsWith("_")) continue;
381
+ for (const s in e) {
382
+ const l = e[s];
383
+ if (l === void 0 || s === "id" || s.startsWith("_")) continue;
384
384
  if (typeof l != "object") {
385
- i[o] = l;
385
+ i[s] = l;
386
386
  continue;
387
387
  }
388
- const v = o.startsWith("@") || He(e, o), f = Array.isArray(l), s = f ? Ue(e, o) || o.match(/^@\((\d*)\)/) : !1;
389
- if (f && s && l.length !== 0 && typeof l[0] != "object") {
388
+ const v = s.startsWith("@") || He(e, s), f = Array.isArray(l), o = f ? Ue(e, s) || s.match(/^@\((\d*)\)/) : !1;
389
+ if (f && o && l.length !== 0 && typeof l[0] != "object") {
390
390
  let c = this.chunkSize;
391
- typeof s == "boolean" ? c = Ge(e, o) : c = s[1] !== "" ? parseInt(s[1]) : this.chunkSize;
391
+ typeof o == "boolean" ? c = Ge(e, s) : c = o[1] !== "" ? parseInt(o[1]) : this.chunkSize;
392
392
  const u = [];
393
393
  let p = new ut(), m = 0;
394
394
  for (const C of l)
395
395
  m === c && (u.push(await y(this, h, Q).call(this, p)), p = new ut(), m = 0), p.data.push(C), m++;
396
- p.data.length !== 0 && u.push(await y(this, h, Q).call(this, p)), typeof s == "boolean" ? i[o] = u : i[o.replace(s[0], "")] = u;
396
+ p.data.length !== 0 && u.push(await y(this, h, Q).call(this, p)), typeof o == "boolean" ? i[s] = u : i[s.replace(o[0], "")] = u;
397
397
  continue;
398
398
  }
399
399
  if (l.speckle_type) {
@@ -401,23 +401,23 @@ h = new WeakSet(), L = async function(e, r) {
401
401
  value: l,
402
402
  isDetached: v
403
403
  });
404
- i[o] = v ? y(this, h, W).call(this, c.id) : c;
404
+ i[s] = v ? y(this, h, W).call(this, c.id) : c;
405
405
  continue;
406
406
  }
407
- i[o] = await y(this, h, M).call(this, {
407
+ i[s] = await y(this, h, M).call(this, {
408
408
  value: l,
409
409
  isDetached: v
410
410
  });
411
411
  }
412
- const n = this.detachLineage.pop(), g = this.lineage.pop();
413
- if (this.familyTree[g]) {
414
- const o = {};
415
- Object.entries(this.familyTree[g]).forEach(([l, v]) => {
416
- o[l] = v - this.detachLineage.length;
417
- }), i.totalChildrenCount = Object.keys(o).length, i.totalChildrenCount && (i.__closure = o);
412
+ const n = this.detachLineage.pop(), b = this.lineage.pop();
413
+ if (this.familyTree[b]) {
414
+ const s = {};
415
+ Object.entries(this.familyTree[b]).forEach(([l, v]) => {
416
+ s[l] = v - this.detachLineage.length;
417
+ }), i.totalChildrenCount = Object.keys(s).length, i.totalChildrenCount && (i.__closure = s);
418
418
  }
419
- const { hash: d, serializedObject: O, size: $ } = y(this, h, bt).call(this, i);
420
- return i.id = d, (n || r) && this.transport && await this.transport.write(O, $), r && this.transport && await this.transport.flush(), { hash: d, traversed: i };
419
+ const { hash: d, serializedObject: O, size: k } = y(this, h, bt).call(this, i);
420
+ return i.id = d, (n || r) && this.transport && await this.transport.write(O, k), r && this.transport && await this.transport.flush(), { hash: d, traversed: i };
421
421
  }, M = async function({
422
422
  value: e,
423
423
  isDetached: r = !1
@@ -435,8 +435,8 @@ h = new WeakSet(), L = async function(e, r) {
435
435
  for (const n of e)
436
436
  if (Ke(n)) {
437
437
  this.detachLineage.push(r);
438
- const { hash: g } = await y(this, h, L).call(this, n, !1);
439
- i.push(y(this, h, W).call(this, g));
438
+ const { hash: b } = await y(this, h, L).call(this, n, !1);
439
+ i.push(y(this, h, W).call(this, b));
440
440
  } else
441
441
  i.push(await y(this, h, M).call(this, { value: n, isDetached: r }));
442
442
  return i;
@@ -472,10 +472,10 @@ class ut {
472
472
  this.data = [], this.speckle_type = "Speckle.Core.Models.DataChunk";
473
473
  }
474
474
  }
475
- var A, H, I, U, G, K, B, q;
475
+ var $, H, I, U, G, K, B, q;
476
476
  class qe {
477
477
  constructor(e, r, a, i) {
478
- j(this, A);
478
+ j(this, $);
479
479
  j(this, H);
480
480
  j(this, I);
481
481
  j(this, U);
@@ -483,14 +483,14 @@ class qe {
483
483
  j(this, K);
484
484
  j(this, B);
485
485
  j(this, q);
486
- b(this, H, (i == null ? void 0 : i.maxSize) || 2e5), b(this, B, (i == null ? void 0 : i.flushRetryCount) || 3), b(this, q, (i == null ? void 0 : i.flushTimeout) || 2 * 60 * 1e3), b(this, I, 0), b(this, U, e), b(this, G, r), b(this, K, a), b(this, A, []);
486
+ _(this, H, (i == null ? void 0 : i.maxSize) || 2e5), _(this, B, (i == null ? void 0 : i.flushRetryCount) || 3), _(this, q, (i == null ? void 0 : i.flushTimeout) || 2 * 60 * 1e3), _(this, I, 0), _(this, U, e), _(this, G, r), _(this, K, a), _(this, $, []);
487
487
  }
488
488
  async write(e, r) {
489
- T(this, A).push(e), b(this, I, T(this, I) + r), !(T(this, I) < T(this, H)) && await this.flush();
489
+ T(this, $).push(e), _(this, I, T(this, I) + r), !(T(this, I) < T(this, H)) && await this.flush();
490
490
  }
491
491
  async flush() {
492
- if (T(this, A).length === 0) return;
493
- const e = new FormData(), r = "[" + T(this, A).join(",") + "]";
492
+ if (T(this, $).length === 0) return;
493
+ const e = new FormData(), r = "[" + T(this, $).join(",") + "]";
494
494
  e.append("object-batch", new Blob([r], { type: "application/json" }));
495
495
  const a = new URL(`/objects/${T(this, G)}`, T(this, U)), i = await wt(
496
496
  async () => await Promise.race([
@@ -508,13 +508,13 @@ class qe {
508
508
  throw new Error(
509
509
  `Unexpected error when sending data. Expected status 200, got ${i.status}`
510
510
  );
511
- b(this, A, []), b(this, I, 0);
511
+ _(this, $, []), _(this, I, 0);
512
512
  }
513
513
  dispose() {
514
- b(this, A, []);
514
+ _(this, $, []);
515
515
  }
516
516
  }
517
- A = new WeakMap(), H = new WeakMap(), I = new WeakMap(), U = new WeakMap(), G = new WeakMap(), K = new WeakMap(), B = new WeakMap(), q = new WeakMap();
517
+ $ = new WeakMap(), H = new WeakMap(), I = new WeakMap(), U = new WeakMap(), G = new WeakMap(), K = new WeakMap(), B = new WeakMap(), q = new WeakMap();
518
518
  class Qe {
519
519
  constructor(e) {
520
520
  S(this, "speckle_type");
@@ -526,19 +526,24 @@ const tr = async (t, {
526
526
  serverUrl: e = "https://app.speckle.systems",
527
527
  projectId: r,
528
528
  token: a,
529
- logger: i = console
529
+ logger: i = console,
530
+ options: n = void 0
530
531
  }) => {
531
- const n = performance.now();
532
+ const b = performance.now();
532
533
  i == null || i.log("Starting to send");
533
- const g = new qe(e, r, a), d = new Be(g);
534
- let O;
534
+ const d = new qe(e, r, a, n == null ? void 0 : n.transport), O = new Be(
535
+ d,
536
+ n == null ? void 0 : n.chunkSize,
537
+ n == null ? void 0 : n.hashingFunction
538
+ );
539
+ let k;
535
540
  try {
536
- O = await d.write(t);
541
+ k = await O.write(t);
537
542
  } finally {
538
- g.dispose(), d.dispose();
543
+ d.dispose(), O.dispose();
539
544
  }
540
- const $ = performance.now();
541
- return i.log(`Finished sending in ${($ - n) / 1e3}s.`), O;
545
+ const s = performance.now();
546
+ return i.log(`Finished sending in ${(s - b) / 1e3}s.`), k;
542
547
  };
543
548
  export {
544
549
  Qe as Base,