@speckle/objectsender 2.24.2 → 2.25.1

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