@speckle/objectsender 1.0.0 → 1.0.2

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.
@@ -1,140 +1,141 @@
1
- var ht = Object.defineProperty;
2
- var ut = (t, e, r) => e in t ? ht(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
3
- var u = (t, e, r) => (ut(t, typeof e != "symbol" ? e + "" : e, r), r), ft = (t, e, r) => {
1
+ var Ct = Object.defineProperty;
2
+ var mt = (t, e, r) => e in t ? Ct(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
3
+ var S = (t, e, r) => (mt(t, typeof e != "symbol" ? e + "" : e, r), r), tt = (t, e, r) => {
4
4
  if (!e.has(t))
5
5
  throw TypeError("Cannot " + r);
6
6
  };
7
- var P = (t, e, r) => {
7
+ var T = (t, e, r) => (tt(t, e, "read from private field"), r ? r.call(t) : e.get(t)), y = (t, e, r) => {
8
8
  if (e.has(t))
9
9
  throw TypeError("Cannot add the same private member more than once");
10
10
  e instanceof WeakSet ? e.add(t) : e.set(t, r);
11
- };
12
- var y = (t, e, r) => (ft(t, e, "access private method"), r);
13
- function B(t) {
14
- function e(T, _) {
15
- return T << _ | T >>> 32 - _;
11
+ }, b = (t, e, r, i) => (tt(t, e, "write to private field"), i ? i.call(t, r) : e.set(t, r), r);
12
+ var d = (t, e, r) => (tt(t, e, "access private method"), r);
13
+ import { retry as St, timeoutAt as Tt } from "@speckle/shared";
14
+ function et(t) {
15
+ function e(O, _) {
16
+ return O << _ | O >>> 32 - _;
16
17
  }
17
- function r(T) {
18
- let _ = "", v, C;
19
- for (v = 7; v >= 0; v--)
20
- C = T >>> v * 4 & 15, _ += C.toString(16);
18
+ function r(O) {
19
+ let _ = "", A, m;
20
+ for (A = 7; A >= 0; A--)
21
+ m = O >>> A * 4 & 15, _ += m.toString(16);
21
22
  return _;
22
23
  }
23
- function i(T) {
24
- T = T.replace(/\r\n/g, `
24
+ function i(O) {
25
+ O = O.replace(/\r\n/g, `
25
26
  `);
26
27
  let _ = "";
27
- for (let v = 0; v < T.length; v++) {
28
- const C = T.charCodeAt(v);
29
- C < 128 ? _ += String.fromCharCode(C) : C > 127 && C < 2048 ? (_ += String.fromCharCode(C >> 6 | 192), _ += String.fromCharCode(C & 63 | 128)) : (_ += String.fromCharCode(C >> 12 | 224), _ += String.fromCharCode(C >> 6 & 63 | 128), _ += String.fromCharCode(C & 63 | 128));
28
+ for (let A = 0; A < O.length; A++) {
29
+ const m = O.charCodeAt(A);
30
+ m < 128 ? _ += String.fromCharCode(m) : m > 127 && m < 2048 ? (_ += String.fromCharCode(m >> 6 | 192), _ += String.fromCharCode(m & 63 | 128)) : (_ += String.fromCharCode(m >> 12 | 224), _ += String.fromCharCode(m >> 6 & 63 | 128), _ += String.fromCharCode(m & 63 | 128));
30
31
  }
31
32
  return _;
32
33
  }
33
34
  let a, n, g;
34
- const p = new Array(80);
35
- let m = 1732584193, j = 4023233417, h = 2562383102, f = 271733878, S = 3285377520, l, s, o, c, d, b;
35
+ const f = new Array(80);
36
+ let v = 1732584193, z = 4023233417, h = 2562383102, u = 271733878, j = 3285377520, l, s, o, c, p, w;
36
37
  t = i(t);
37
- const w = t.length, O = [];
38
- for (n = 0; n < w - 3; n += 4)
39
- g = t.charCodeAt(n) << 24 | t.charCodeAt(n + 1) << 16 | t.charCodeAt(n + 2) << 8 | t.charCodeAt(n + 3), O.push(g);
40
- switch (w % 4) {
38
+ const C = t.length, P = [];
39
+ for (n = 0; n < C - 3; n += 4)
40
+ g = t.charCodeAt(n) << 24 | t.charCodeAt(n + 1) << 16 | t.charCodeAt(n + 2) << 8 | t.charCodeAt(n + 3), P.push(g);
41
+ switch (C % 4) {
41
42
  case 0:
42
43
  n = 2147483648;
43
44
  break;
44
45
  case 1:
45
- n = t.charCodeAt(w - 1) << 24 | 8388608;
46
+ n = t.charCodeAt(C - 1) << 24 | 8388608;
46
47
  break;
47
48
  case 2:
48
- n = t.charCodeAt(w - 2) << 24 | t.charCodeAt(w - 1) << 16 | 32768;
49
+ n = t.charCodeAt(C - 2) << 24 | t.charCodeAt(C - 1) << 16 | 32768;
49
50
  break;
50
51
  case 3:
51
- n = t.charCodeAt(w - 3) << 24 | t.charCodeAt(w - 2) << 16 | t.charCodeAt(w - 1) << 8 | 128;
52
+ n = t.charCodeAt(C - 3) << 24 | t.charCodeAt(C - 2) << 16 | t.charCodeAt(C - 1) << 8 | 128;
52
53
  break;
53
54
  }
54
- for (O.push(n); O.length % 16 !== 14; )
55
- O.push(0);
56
- for (O.push(w >>> 29), O.push(w << 3 & 4294967295), a = 0; a < O.length; a += 16) {
55
+ for (P.push(n); P.length % 16 !== 14; )
56
+ P.push(0);
57
+ for (P.push(C >>> 29), P.push(C << 3 & 4294967295), a = 0; a < P.length; a += 16) {
57
58
  for (n = 0; n < 16; n++)
58
- p[n] = O[a + n];
59
+ f[n] = P[a + n];
59
60
  for (n = 16; n <= 79; n++)
60
- p[n] = e(p[n - 3] ^ p[n - 8] ^ p[n - 14] ^ p[n - 16], 1);
61
- for (l = m, s = j, o = h, c = f, d = S, n = 0; n <= 19; n++)
62
- b = e(l, 5) + (s & o | ~s & c) + d + p[n] + 1518500249 & 4294967295, d = c, c = o, o = e(s, 30), s = l, l = b;
61
+ f[n] = e(f[n - 3] ^ f[n - 8] ^ f[n - 14] ^ f[n - 16], 1);
62
+ for (l = v, s = z, o = h, c = u, p = j, n = 0; n <= 19; n++)
63
+ w = e(l, 5) + (s & o | ~s & c) + p + f[n] + 1518500249 & 4294967295, p = c, c = o, o = e(s, 30), s = l, l = w;
63
64
  for (n = 20; n <= 39; n++)
64
- b = e(l, 5) + (s ^ o ^ c) + d + p[n] + 1859775393 & 4294967295, d = c, c = o, o = e(s, 30), s = l, l = b;
65
+ w = e(l, 5) + (s ^ o ^ c) + p + f[n] + 1859775393 & 4294967295, p = c, c = o, o = e(s, 30), s = l, l = w;
65
66
  for (n = 40; n <= 59; n++)
66
- b = e(l, 5) + (s & o | s & c | o & c) + d + p[n] + 2400959708 & 4294967295, d = c, c = o, o = e(s, 30), s = l, l = b;
67
+ w = e(l, 5) + (s & o | s & c | o & c) + p + f[n] + 2400959708 & 4294967295, p = c, c = o, o = e(s, 30), s = l, l = w;
67
68
  for (n = 60; n <= 79; n++)
68
- b = e(l, 5) + (s ^ o ^ c) + d + p[n] + 3395469782 & 4294967295, d = c, c = o, o = e(s, 30), s = l, l = b;
69
- m = m + l & 4294967295, j = j + s & 4294967295, h = h + o & 4294967295, f = f + c & 4294967295, S = S + d & 4294967295;
69
+ w = e(l, 5) + (s ^ o ^ c) + p + f[n] + 3395469782 & 4294967295, p = c, c = o, o = e(s, 30), s = l, l = w;
70
+ v = v + l & 4294967295, z = z + s & 4294967295, h = h + o & 4294967295, u = u + c & 4294967295, j = j + p & 4294967295;
70
71
  }
71
- return (r(m) + r(j) + r(h) + r(f) + r(S)).toLowerCase().substring(0, 32);
72
+ return (r(v) + r(z) + r(h) + r(u) + r(j)).toLowerCase().substring(0, 40);
72
73
  }
73
- var lt = typeof global == "object" && global && global.Object === Object && global, pt = typeof self == "object" && self && self.Object === Object && self, W = lt || pt || Function("return this")(), x = W.Symbol, rt = Object.prototype, dt = rt.hasOwnProperty, yt = rt.toString, F = x ? x.toStringTag : void 0;
74
- function gt(t) {
75
- var e = dt.call(t, F), r = t[F];
74
+ var jt = typeof global == "object" && global && global.Object === Object && global, vt = typeof self == "object" && self && self.Object === Object && self, it = jt || vt || Function("return this")(), L = it.Symbol, pt = Object.prototype, Ot = pt.hasOwnProperty, At = pt.toString, H = L ? L.toStringTag : void 0;
75
+ function $t(t) {
76
+ var e = Ot.call(t, H), r = t[H];
76
77
  try {
77
- t[F] = void 0;
78
+ t[H] = void 0;
78
79
  var i = !0;
79
80
  } catch {
80
81
  }
81
- var a = yt.call(t);
82
- return i && (e ? t[F] = r : delete t[F]), a;
82
+ var a = At.call(t);
83
+ return i && (e ? t[H] = r : delete t[H]), a;
83
84
  }
84
- var _t = Object.prototype, bt = _t.toString;
85
- function wt(t) {
86
- return bt.call(t);
85
+ var zt = Object.prototype, Pt = zt.toString;
86
+ function kt(t) {
87
+ return Pt.call(t);
87
88
  }
88
- var Ct = "[object Null]", St = "[object Undefined]", Y = x ? x.toStringTag : void 0;
89
- function nt(t) {
90
- return t == null ? t === void 0 ? St : Ct : Y && Y in Object(t) ? gt(t) : wt(t);
89
+ var It = "[object Null]", xt = "[object Undefined]", ct = L ? L.toStringTag : void 0;
90
+ function dt(t) {
91
+ return t == null ? t === void 0 ? xt : It : ct && ct in Object(t) ? $t(t) : kt(t);
91
92
  }
92
- function it(t) {
93
+ function yt(t) {
93
94
  return t != null && typeof t == "object";
94
95
  }
95
- var mt = "[object Symbol]";
96
- function J(t) {
97
- return typeof t == "symbol" || it(t) && nt(t) == mt;
96
+ var Et = "[object Symbol]";
97
+ function at(t) {
98
+ return typeof t == "symbol" || yt(t) && dt(t) == Et;
98
99
  }
99
- function Tt(t, e) {
100
+ function Ft(t, e) {
100
101
  for (var r = -1, i = t == null ? 0 : t.length, a = Array(i); ++r < i; )
101
102
  a[r] = e(t[r], r, t);
102
103
  return a;
103
104
  }
104
- var V = Array.isArray, vt = 1 / 0, Z = x ? x.prototype : void 0, Q = Z ? Z.toString : void 0;
105
- function at(t) {
105
+ var st = Array.isArray, Dt = 1 / 0, ht = L ? L.prototype : void 0, ut = ht ? ht.toString : void 0;
106
+ function gt(t) {
106
107
  if (typeof t == "string")
107
108
  return t;
108
- if (V(t))
109
- return Tt(t, at) + "";
110
- if (J(t))
111
- return Q ? Q.call(t) : "";
109
+ if (st(t))
110
+ return Ft(t, gt) + "";
111
+ if (at(t))
112
+ return ut ? ut.call(t) : "";
112
113
  var e = t + "";
113
- return e == "0" && 1 / t == -vt ? "-0" : e;
114
+ return e == "0" && 1 / t == -Dt ? "-0" : e;
114
115
  }
115
- function st(t) {
116
+ function _t(t) {
116
117
  var e = typeof t;
117
118
  return t != null && (e == "object" || e == "function");
118
119
  }
119
- var jt = "[object AsyncFunction]", Ot = "[object Function]", zt = "[object GeneratorFunction]", $t = "[object Proxy]";
120
- function At(t) {
121
- if (!st(t))
120
+ var Lt = "[object AsyncFunction]", Nt = "[object Function]", Ht = "[object GeneratorFunction]", Rt = "[object Proxy]";
121
+ function Mt(t) {
122
+ if (!_t(t))
122
123
  return !1;
123
- var e = nt(t);
124
- return e == Ot || e == zt || e == jt || e == $t;
124
+ var e = dt(t);
125
+ return e == Nt || e == Ht || e == Lt || e == Rt;
125
126
  }
126
- var K = W["__core-js_shared__"], tt = function() {
127
- var t = /[^.]+$/.exec(K && K.keys && K.keys.IE_PROTO || "");
127
+ var rt = it["__core-js_shared__"], lt = function() {
128
+ var t = /[^.]+$/.exec(rt && rt.keys && rt.keys.IE_PROTO || "");
128
129
  return t ? "Symbol(src)_1." + t : "";
129
130
  }();
130
- function kt(t) {
131
- return !!tt && tt in t;
131
+ function Ut(t) {
132
+ return !!lt && lt in t;
132
133
  }
133
- var Pt = Function.prototype, It = Pt.toString;
134
- function xt(t) {
134
+ var Gt = Function.prototype, Bt = Gt.toString;
135
+ function Kt(t) {
135
136
  if (t != null) {
136
137
  try {
137
- return It.call(t);
138
+ return Bt.call(t);
138
139
  } catch {
139
140
  }
140
141
  try {
@@ -144,157 +145,157 @@ function xt(t) {
144
145
  }
145
146
  return "";
146
147
  }
147
- var Et = /[\\^$.*+?()[\]{}|]/g, Ft = /^\[object .+?Constructor\]$/, Dt = Function.prototype, Lt = Object.prototype, Nt = Dt.toString, Ht = Lt.hasOwnProperty, Ut = RegExp(
148
- "^" + Nt.call(Ht).replace(Et, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
148
+ var qt = /[\\^$.*+?()[\]{}|]/g, Wt = /^\[object .+?Constructor\]$/, Jt = Function.prototype, Vt = Object.prototype, Xt = Jt.toString, Yt = Vt.hasOwnProperty, Zt = RegExp(
149
+ "^" + Xt.call(Yt).replace(qt, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
149
150
  );
150
- function Mt(t) {
151
- if (!st(t) || kt(t))
151
+ function Qt(t) {
152
+ if (!_t(t) || Ut(t))
152
153
  return !1;
153
- var e = At(t) ? Ut : Ft;
154
- return e.test(xt(t));
154
+ var e = Mt(t) ? Zt : Wt;
155
+ return e.test(Kt(t));
155
156
  }
156
- function Rt(t, e) {
157
+ function te(t, e) {
157
158
  return t == null ? void 0 : t[e];
158
159
  }
159
- function ot(t, e) {
160
- var r = Rt(t, e);
161
- return Mt(r) ? r : void 0;
160
+ function bt(t, e) {
161
+ var r = te(t, e);
162
+ return Qt(r) ? r : void 0;
162
163
  }
163
- function Gt(t, e) {
164
+ function ee(t, e) {
164
165
  return t === e || t !== t && e !== e;
165
166
  }
166
- var Bt = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, Kt = /^\w*$/;
167
- function qt(t, e) {
168
- if (V(t))
167
+ var re = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, ne = /^\w*$/;
168
+ function ie(t, e) {
169
+ if (st(t))
169
170
  return !1;
170
171
  var r = typeof t;
171
- return r == "number" || r == "symbol" || r == "boolean" || t == null || J(t) ? !0 : Kt.test(t) || !Bt.test(t) || e != null && t in Object(e);
172
+ return r == "number" || r == "symbol" || r == "boolean" || t == null || at(t) ? !0 : ne.test(t) || !re.test(t) || e != null && t in Object(e);
172
173
  }
173
- var N = ot(Object, "create");
174
- function Wt() {
175
- this.__data__ = N ? N(null) : {}, this.size = 0;
174
+ var U = bt(Object, "create");
175
+ function ae() {
176
+ this.__data__ = U ? U(null) : {}, this.size = 0;
176
177
  }
177
- function Jt(t) {
178
+ function se(t) {
178
179
  var e = this.has(t) && delete this.__data__[t];
179
180
  return this.size -= e ? 1 : 0, e;
180
181
  }
181
- var Vt = "__lodash_hash_undefined__", Xt = Object.prototype, Yt = Xt.hasOwnProperty;
182
- function Zt(t) {
182
+ var oe = "__lodash_hash_undefined__", ce = Object.prototype, he = ce.hasOwnProperty;
183
+ function ue(t) {
183
184
  var e = this.__data__;
184
- if (N) {
185
+ if (U) {
185
186
  var r = e[t];
186
- return r === Vt ? void 0 : r;
187
+ return r === oe ? void 0 : r;
187
188
  }
188
- return Yt.call(e, t) ? e[t] : void 0;
189
+ return he.call(e, t) ? e[t] : void 0;
189
190
  }
190
- var Qt = Object.prototype, te = Qt.hasOwnProperty;
191
- function ee(t) {
191
+ var le = Object.prototype, fe = le.hasOwnProperty;
192
+ function pe(t) {
192
193
  var e = this.__data__;
193
- return N ? e[t] !== void 0 : te.call(e, t);
194
+ return U ? e[t] !== void 0 : fe.call(e, t);
194
195
  }
195
- var re = "__lodash_hash_undefined__";
196
- function ne(t, e) {
196
+ var de = "__lodash_hash_undefined__";
197
+ function ye(t, e) {
197
198
  var r = this.__data__;
198
- return this.size += this.has(t) ? 0 : 1, r[t] = N && e === void 0 ? re : e, this;
199
+ return this.size += this.has(t) ? 0 : 1, r[t] = U && e === void 0 ? de : e, this;
199
200
  }
200
- function A(t) {
201
+ function E(t) {
201
202
  var e = -1, r = t == null ? 0 : t.length;
202
203
  for (this.clear(); ++e < r; ) {
203
204
  var i = t[e];
204
205
  this.set(i[0], i[1]);
205
206
  }
206
207
  }
207
- A.prototype.clear = Wt;
208
- A.prototype.delete = Jt;
209
- A.prototype.get = Zt;
210
- A.prototype.has = ee;
211
- A.prototype.set = ne;
212
- function ie() {
208
+ E.prototype.clear = ae;
209
+ E.prototype.delete = se;
210
+ E.prototype.get = ue;
211
+ E.prototype.has = pe;
212
+ E.prototype.set = ye;
213
+ function ge() {
213
214
  this.__data__ = [], this.size = 0;
214
215
  }
215
- function R(t, e) {
216
+ function Z(t, e) {
216
217
  for (var r = t.length; r--; )
217
- if (Gt(t[r][0], e))
218
+ if (ee(t[r][0], e))
218
219
  return r;
219
220
  return -1;
220
221
  }
221
- var ae = Array.prototype, se = ae.splice;
222
- function oe(t) {
223
- var e = this.__data__, r = R(e, t);
222
+ var _e = Array.prototype, be = _e.splice;
223
+ function we(t) {
224
+ var e = this.__data__, r = Z(e, t);
224
225
  if (r < 0)
225
226
  return !1;
226
227
  var i = e.length - 1;
227
- return r == i ? e.pop() : se.call(e, r, 1), --this.size, !0;
228
+ return r == i ? e.pop() : be.call(e, r, 1), --this.size, !0;
228
229
  }
229
- function ce(t) {
230
- var e = this.__data__, r = R(e, t);
230
+ function Ce(t) {
231
+ var e = this.__data__, r = Z(e, t);
231
232
  return r < 0 ? void 0 : e[r][1];
232
233
  }
233
- function he(t) {
234
- return R(this.__data__, t) > -1;
234
+ function me(t) {
235
+ return Z(this.__data__, t) > -1;
235
236
  }
236
- function ue(t, e) {
237
- var r = this.__data__, i = R(r, t);
237
+ function Se(t, e) {
238
+ var r = this.__data__, i = Z(r, t);
238
239
  return i < 0 ? (++this.size, r.push([t, e])) : r[i][1] = e, this;
239
240
  }
240
- function E(t) {
241
+ function N(t) {
241
242
  var e = -1, r = t == null ? 0 : t.length;
242
243
  for (this.clear(); ++e < r; ) {
243
244
  var i = t[e];
244
245
  this.set(i[0], i[1]);
245
246
  }
246
247
  }
247
- E.prototype.clear = ie;
248
- E.prototype.delete = oe;
249
- E.prototype.get = ce;
250
- E.prototype.has = he;
251
- E.prototype.set = ue;
252
- var fe = ot(W, "Map");
253
- function le() {
248
+ N.prototype.clear = ge;
249
+ N.prototype.delete = we;
250
+ N.prototype.get = Ce;
251
+ N.prototype.has = me;
252
+ N.prototype.set = Se;
253
+ var Te = bt(it, "Map");
254
+ function je() {
254
255
  this.size = 0, this.__data__ = {
255
- hash: new A(),
256
- map: new (fe || E)(),
257
- string: new A()
256
+ hash: new E(),
257
+ map: new (Te || N)(),
258
+ string: new E()
258
259
  };
259
260
  }
260
- function pe(t) {
261
+ function ve(t) {
261
262
  var e = typeof t;
262
263
  return e == "string" || e == "number" || e == "symbol" || e == "boolean" ? t !== "__proto__" : t === null;
263
264
  }
264
- function G(t, e) {
265
+ function Q(t, e) {
265
266
  var r = t.__data__;
266
- return pe(e) ? r[typeof e == "string" ? "string" : "hash"] : r.map;
267
+ return ve(e) ? r[typeof e == "string" ? "string" : "hash"] : r.map;
267
268
  }
268
- function de(t) {
269
- var e = G(this, t).delete(t);
269
+ function Oe(t) {
270
+ var e = Q(this, t).delete(t);
270
271
  return this.size -= e ? 1 : 0, e;
271
272
  }
272
- function ye(t) {
273
- return G(this, t).get(t);
273
+ function Ae(t) {
274
+ return Q(this, t).get(t);
274
275
  }
275
- function ge(t) {
276
- return G(this, t).has(t);
276
+ function $e(t) {
277
+ return Q(this, t).has(t);
277
278
  }
278
- function _e(t, e) {
279
- var r = G(this, t), i = r.size;
279
+ function ze(t, e) {
280
+ var r = Q(this, t), i = r.size;
280
281
  return r.set(t, e), this.size += r.size == i ? 0 : 1, this;
281
282
  }
282
- function k(t) {
283
+ function F(t) {
283
284
  var e = -1, r = t == null ? 0 : t.length;
284
285
  for (this.clear(); ++e < r; ) {
285
286
  var i = t[e];
286
287
  this.set(i[0], i[1]);
287
288
  }
288
289
  }
289
- k.prototype.clear = le;
290
- k.prototype.delete = de;
291
- k.prototype.get = ye;
292
- k.prototype.has = ge;
293
- k.prototype.set = _e;
294
- var be = "Expected a function";
295
- function X(t, e) {
290
+ F.prototype.clear = je;
291
+ F.prototype.delete = Oe;
292
+ F.prototype.get = Ae;
293
+ F.prototype.has = $e;
294
+ F.prototype.set = ze;
295
+ var Pe = "Expected a function";
296
+ function ot(t, e) {
296
297
  if (typeof t != "function" || e != null && typeof e != "function")
297
- throw new TypeError(be);
298
+ throw new TypeError(Pe);
298
299
  var r = function() {
299
300
  var i = arguments, a = e ? e.apply(this, i) : i[0], n = r.cache;
300
301
  if (n.has(a))
@@ -302,115 +303,115 @@ function X(t, e) {
302
303
  var g = t.apply(this, i);
303
304
  return r.cache = n.set(a, g) || n, g;
304
305
  };
305
- return r.cache = new (X.Cache || k)(), r;
306
+ return r.cache = new (ot.Cache || F)(), r;
306
307
  }
307
- X.Cache = k;
308
- var we = 500;
309
- function Ce(t) {
310
- var e = X(t, function(i) {
311
- return r.size === we && r.clear(), i;
308
+ ot.Cache = F;
309
+ var ke = 500;
310
+ function Ie(t) {
311
+ var e = ot(t, function(i) {
312
+ return r.size === ke && r.clear(), i;
312
313
  }), r = e.cache;
313
314
  return e;
314
315
  }
315
- var Se = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, me = /\\(\\)?/g, Te = Ce(function(t) {
316
+ var xe = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, Ee = /\\(\\)?/g, Fe = Ie(function(t) {
316
317
  var e = [];
317
- return t.charCodeAt(0) === 46 && e.push(""), t.replace(Se, function(r, i, a, n) {
318
- e.push(a ? n.replace(me, "$1") : i || r);
318
+ return t.charCodeAt(0) === 46 && e.push(""), t.replace(xe, function(r, i, a, n) {
319
+ e.push(a ? n.replace(Ee, "$1") : i || r);
319
320
  }), e;
320
321
  });
321
- function ve(t) {
322
- return t == null ? "" : at(t);
322
+ function De(t) {
323
+ return t == null ? "" : gt(t);
323
324
  }
324
- function je(t, e) {
325
- return V(t) ? t : qt(t, e) ? [t] : Te(ve(t));
325
+ function Le(t, e) {
326
+ return st(t) ? t : ie(t, e) ? [t] : Fe(De(t));
326
327
  }
327
- var Oe = 1 / 0;
328
- function ze(t) {
329
- if (typeof t == "string" || J(t))
328
+ var Ne = 1 / 0;
329
+ function He(t) {
330
+ if (typeof t == "string" || at(t))
330
331
  return t;
331
332
  var e = t + "";
332
- return e == "0" && 1 / t == -Oe ? "-0" : e;
333
+ return e == "0" && 1 / t == -Ne ? "-0" : e;
333
334
  }
334
- function $e(t, e) {
335
- e = je(e, t);
335
+ function Re(t, e) {
336
+ e = Le(e, t);
336
337
  for (var r = 0, i = e.length; t != null && r < i; )
337
- t = t[ze(e[r++])];
338
+ t = t[He(e[r++])];
338
339
  return r && r == i ? t : void 0;
339
340
  }
340
- function Ae(t, e, r) {
341
- var i = t == null ? void 0 : $e(t, e);
341
+ function Me(t, e, r) {
342
+ var i = t == null ? void 0 : Re(t, e);
342
343
  return i === void 0 ? r : i;
343
344
  }
344
- const ke = (t) => it(t) && !!Ae(t, "speckle_type");
345
- var z, D, $, L, I, U, H, q, M, ct;
346
- class Pe {
347
- constructor(e, r = 1e3, i = B) {
348
- P(this, z);
349
- P(this, $);
350
- P(this, I);
351
- P(this, H);
352
- P(this, M);
353
- u(this, "chunkSize");
354
- u(this, "detachLineage");
355
- u(this, "lineage");
356
- u(this, "familyTree");
357
- u(this, "closureTable");
358
- u(this, "transport");
359
- u(this, "uniqueId");
360
- u(this, "hashingFunction");
361
- this.chunkSize = r, this.detachLineage = [!0], this.lineage = [], this.familyTree = {}, this.closureTable = {}, this.transport = e, this.uniqueId = 0, this.hashingFunction = i || B;
345
+ const Ue = (t) => yt(t) && !!Me(t, "speckle_type");
346
+ var k, R, I, M, D, X, G, nt, Y, wt;
347
+ class Ge {
348
+ constructor(e, r = 1e3, i = et) {
349
+ y(this, k);
350
+ y(this, I);
351
+ y(this, D);
352
+ y(this, G);
353
+ y(this, Y);
354
+ S(this, "chunkSize");
355
+ S(this, "detachLineage");
356
+ S(this, "lineage");
357
+ S(this, "familyTree");
358
+ S(this, "closureTable");
359
+ S(this, "transport");
360
+ S(this, "uniqueId");
361
+ S(this, "hashingFunction");
362
+ this.chunkSize = r, this.detachLineage = [!0], this.lineage = [], this.familyTree = {}, this.closureTable = {}, this.transport = e, this.uniqueId = 0, this.hashingFunction = i || et;
362
363
  }
363
364
  async write(e) {
364
- return await y(this, z, D).call(this, e, !0);
365
+ return await d(this, k, R).call(this, e, !0);
365
366
  }
366
367
  dispose() {
367
368
  this.detachLineage = [], this.lineage = [], this.familyTree = {}, this.closureTable = {}, this.transport = null;
368
369
  }
369
370
  }
370
- z = new WeakSet(), D = async function(e, r) {
371
+ k = new WeakSet(), R = async function(e, r) {
371
372
  const i = `${this.uniqueId++}-obj`;
372
373
  this.lineage.push(i);
373
374
  const a = { speckle_type: e.speckle_type || "Base" };
374
375
  for (const h in e) {
375
- const f = e[h];
376
- if (!f || h === "id" || h.startsWith("_"))
376
+ const u = e[h];
377
+ if (!u || h === "id" || h.startsWith("_"))
377
378
  continue;
378
- if (typeof f != "object") {
379
- a[h] = f;
379
+ if (typeof u != "object") {
380
+ a[h] = u;
380
381
  continue;
381
382
  }
382
- const S = h.startsWith("@"), l = Array.isArray(f), s = l ? h.match(/^@\((\d*)\)/) : !1;
383
- if (l && s && f.length !== 0 && typeof f[0] != "object") {
383
+ const j = h.startsWith("@"), l = Array.isArray(u), s = l ? h.match(/^@\((\d*)\)/) : !1;
384
+ if (l && s && u.length !== 0 && typeof u[0] != "object") {
384
385
  const o = s[1] !== "" ? parseInt(s[1]) : this.chunkSize, c = [];
385
- let d = new et(), b = 0;
386
- for (const w of f)
387
- b === o && (c.push(await y(this, H, q).call(this, d)), d = new et(), b = 0), d.data.push(w), b++;
388
- d.data.length !== 0 && c.push(await y(this, H, q).call(this, d)), a[h.replace(s[0], "")] = c;
386
+ let p = new ft(), w = 0;
387
+ for (const C of u)
388
+ w === o && (c.push(await d(this, G, nt).call(this, p)), p = new ft(), w = 0), p.data.push(C), w++;
389
+ p.data.length !== 0 && c.push(await d(this, G, nt).call(this, p)), a[h.replace(s[0], "")] = c;
389
390
  continue;
390
391
  }
391
- if (f.speckle_type) {
392
- const o = await y(this, $, L).call(this, {
393
- value: f,
394
- isDetached: S
392
+ if (u.speckle_type) {
393
+ const o = await d(this, I, M).call(this, {
394
+ value: u,
395
+ isDetached: j
395
396
  });
396
- a[h] = S ? y(this, I, U).call(this, o.id) : o;
397
+ a[h] = j ? d(this, D, X).call(this, o.id) : o;
397
398
  continue;
398
399
  }
399
- a[h] = await y(this, $, L).call(this, {
400
- value: f,
401
- isDetached: S
400
+ a[h] = await d(this, I, M).call(this, {
401
+ value: u,
402
+ isDetached: j
402
403
  });
403
404
  }
404
405
  const n = this.detachLineage.pop(), g = this.lineage.pop();
405
406
  if (this.familyTree[g]) {
406
407
  const h = {};
407
- Object.entries(this.familyTree[g]).forEach(([f, S]) => {
408
- h[f] = S - this.detachLineage.length;
408
+ Object.entries(this.familyTree[g]).forEach(([u, j]) => {
409
+ h[u] = j - this.detachLineage.length;
409
410
  }), a.totalChildrenCount = Object.keys(h).length, a.totalChildrenCount && (a.__closure = h);
410
411
  }
411
- const { hash: p, serializedObject: m, size: j } = y(this, M, ct).call(this, a);
412
- return a.id = p, (n || r) && this.transport && await this.transport.write(m, j), r && this.transport && await this.transport.flush(), { hash: p, traversed: a };
413
- }, $ = new WeakSet(), L = async function({
412
+ const { hash: f, serializedObject: v, size: z } = d(this, Y, wt).call(this, a);
413
+ return a.id = f, (n || r) && this.transport && await this.transport.write(v, z), r && this.transport && await this.transport.flush(), { hash: f, traversed: a };
414
+ }, I = new WeakSet(), M = async function({
414
415
  value: e,
415
416
  isDetached: r = !1
416
417
  }) {
@@ -424,92 +425,103 @@ z = new WeakSet(), D = async function(e, r) {
424
425
  return i;
425
426
  if (!r)
426
427
  return Promise.all(
427
- e.map(async (n) => await y(this, $, L).call(this, { value: n }))
428
+ e.map(async (n) => await d(this, I, M).call(this, { value: n }))
428
429
  );
429
430
  const a = [];
430
431
  for (const n of e)
431
- if (ke(n)) {
432
+ if (Ue(n)) {
432
433
  this.detachLineage.push(r);
433
- const { hash: g } = await y(this, z, D).call(this, n, !1);
434
- a.push(y(this, I, U).call(this, g));
434
+ const { hash: g } = await d(this, k, R).call(this, n, !1);
435
+ a.push(d(this, D, X).call(this, g));
435
436
  } else
436
- a.push(await y(this, $, L).call(this, { value: n, isDetached: r }));
437
+ a.push(await d(this, I, M).call(this, { value: n, isDetached: r }));
437
438
  return a;
438
439
  }
439
440
  if (!e.speckle_type)
440
441
  return e;
441
442
  if (e.speckle_type)
442
- return this.detachLineage.push(r), (await y(this, z, D).call(this, e, !1)).traversed;
443
+ return this.detachLineage.push(r), (await d(this, k, R).call(this, e, !1)).traversed;
443
444
  throw new Error(`Unsupported type '${typeof e}': ${e}.`);
444
- }, I = new WeakSet(), U = function(e) {
445
+ }, D = new WeakSet(), X = function(e) {
445
446
  return this.lineage.forEach((r) => {
446
447
  this.familyTree[r] || (this.familyTree[r] = {}), (!this.familyTree[r][e] || this.familyTree[r][e] > this.detachLineage.length) && (this.familyTree[r][e] = this.detachLineage.length);
447
448
  }), {
448
449
  referencedId: e,
449
450
  speckle_type: "reference"
450
451
  };
451
- }, H = new WeakSet(), q = async function(e) {
452
+ }, G = new WeakSet(), nt = async function(e) {
452
453
  this.detachLineage.push(!0);
453
- const { hash: r } = await y(this, z, D).call(this, e, !1);
454
- return y(this, I, U).call(this, r);
455
- }, M = new WeakSet(), ct = function(e) {
454
+ const { hash: r } = await d(this, k, R).call(this, e, !1);
455
+ return d(this, D, X).call(this, r);
456
+ }, Y = new WeakSet(), wt = function(e) {
456
457
  const r = JSON.stringify(e), i = this.hashingFunction(r), a = r.substring(0, 1) + `"id":"${i}",` + r.substring(1);
457
458
  return {
458
- hash: B(r),
459
+ hash: et(r),
459
460
  serializedObject: a,
460
461
  size: r.length
461
462
  // approx, good enough as we're just limiting artificially batch sizes based on this
462
463
  };
463
464
  };
464
- class et {
465
+ class ft {
465
466
  constructor() {
466
- u(this, "speckle_type");
467
- u(this, "data");
467
+ S(this, "speckle_type");
468
+ S(this, "data");
468
469
  this.data = [], this.speckle_type = "Speckle.Core.Models.DataChunk";
469
470
  }
470
471
  }
471
- class Ie {
472
- constructor(e, r, i, a = 2e5) {
473
- u(this, "buffer");
474
- u(this, "maxSize");
475
- u(this, "currSize");
476
- u(this, "serverUrl");
477
- u(this, "projectId");
478
- u(this, "authToken");
479
- this.maxSize = a, this.currSize = 0, this.serverUrl = e, this.projectId = r, this.authToken = i, this.buffer = [];
472
+ var $, B, x, K, q, W, J, V;
473
+ class Be {
474
+ constructor(e, r, i, a) {
475
+ y(this, $, void 0);
476
+ y(this, B, void 0);
477
+ y(this, x, void 0);
478
+ y(this, K, void 0);
479
+ y(this, q, void 0);
480
+ y(this, W, void 0);
481
+ y(this, J, void 0);
482
+ y(this, V, void 0);
483
+ b(this, B, (a == null ? void 0 : a.maxSize) || 2e5), b(this, J, (a == null ? void 0 : a.flushRetryCount) || 3), b(this, V, (a == null ? void 0 : a.flushTimeout) || 2 * 60 * 1e3), b(this, x, 0), b(this, K, e), b(this, q, r), b(this, W, i), b(this, $, []);
480
484
  }
481
485
  async write(e, r) {
482
- this.buffer.push(e), this.currSize += r, !(this.currSize < this.maxSize) && await this.flush();
486
+ T(this, $).push(e), b(this, x, T(this, x) + r), !(T(this, x) < T(this, B)) && await this.flush();
483
487
  }
484
488
  async flush() {
485
- if (this.buffer.length === 0)
489
+ if (T(this, $).length === 0)
486
490
  return;
487
- const e = new FormData(), r = "[" + this.buffer.join(",") + "]";
491
+ const e = new FormData(), r = "[" + T(this, $).join(",") + "]";
488
492
  e.append("object-batch", new Blob([r], { type: "application/json" }));
489
- const i = new URL(`/objects/${this.projectId}`, this.serverUrl), a = await fetch(i, {
490
- method: "POST",
491
- headers: { Authorization: `Bearer ${this.authToken}` },
492
- body: e
493
- });
493
+ const i = new URL(`/objects/${T(this, q)}`, T(this, K)), a = await St(
494
+ async () => await Promise.race([
495
+ fetch(i, {
496
+ method: "POST",
497
+ headers: { Authorization: `Bearer ${T(this, W)}` },
498
+ body: e
499
+ }),
500
+ Tt(T(this, V), "Object sender flush timed out")
501
+ ]),
502
+ T(this, J),
503
+ (n) => n * 1e3
504
+ );
494
505
  if (a.status !== 201)
495
506
  throw new Error(
496
507
  `Unexpected error when sending data. Expected status 200, got ${a.status}`
497
508
  );
498
- this.buffer = [], this.currSize = 0;
509
+ b(this, $, []), b(this, x, 0);
499
510
  }
500
511
  dispose() {
501
- this.buffer = [];
512
+ b(this, $, []);
502
513
  }
503
514
  }
504
- class Fe {
515
+ $ = new WeakMap(), B = new WeakMap(), x = new WeakMap(), K = new WeakMap(), q = new WeakMap(), W = new WeakMap(), J = new WeakMap(), V = new WeakMap();
516
+ class Je {
505
517
  constructor(e) {
506
- u(this, "speckle_type");
518
+ S(this, "speckle_type");
507
519
  if (this.speckle_type = this.constructor.name, e)
508
520
  for (const r in e)
509
521
  this[r] = e[r];
510
522
  }
511
523
  }
512
- const De = async (t, {
524
+ const Ve = async (t, {
513
525
  serverUrl: e = "https://app.speckle.systems",
514
526
  projectId: r,
515
527
  token: i,
@@ -517,18 +529,18 @@ const De = async (t, {
517
529
  }) => {
518
530
  const n = performance.now();
519
531
  a == null || a.log("Starting to send");
520
- const g = new Ie(e, r, i), p = new Pe(g);
521
- let m;
532
+ const g = new Be(e, r, i), f = new Ge(g);
533
+ let v;
522
534
  try {
523
- m = await p.write(t);
535
+ v = await f.write(t);
524
536
  } finally {
525
- g.dispose(), p.dispose();
537
+ g.dispose(), f.dispose();
526
538
  }
527
- const j = performance.now();
528
- return a.log(`Finished sending in ${(j - n) / 1e3}s.`), m;
539
+ const z = performance.now();
540
+ return a.log(`Finished sending in ${(z - n) / 1e3}s.`), v;
529
541
  };
530
542
  export {
531
- Fe as Base,
532
- De as send
543
+ Je as Base,
544
+ Ve as send
533
545
  };
534
546
  //# sourceMappingURL=objectsender.js.map