@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.
- package/dist/examples/browser/main.d.ts +0 -1
- package/dist/examples/browser/utils.d.ts +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/objectsender.cjs +1 -2
- package/dist/objectsender.cjs.map +1 -1
- package/dist/objectsender.js +321 -361
- package/dist/objectsender.js.map +1 -1
- package/dist/transports/ITransport.d.ts +2 -1
- package/dist/transports/ServerTransport.d.ts +2 -2
- package/dist/utils/Decorators.d.ts +0 -1
- package/dist/utils/Serializer.d.ts +0 -1
- package/package.json +3 -3
- package/src/transports/ITransport.ts +2 -1
- package/src/transports/ServerTransport.ts +30 -4
- package/src/utils/Serializer.ts +5 -5
- package/vitest.config.ts +2 -1
- package/dist/utils/Sha1.d.ts +0 -6
- package/dist/utils/Sha1.spec.d.ts +0 -1
- package/src/utils/Sha1.spec.ts +0 -15
- package/src/utils/Sha1.ts +0 -138
package/dist/objectsender.js
CHANGED
|
@@ -1,135 +1,77 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var yt = Object.defineProperty;
|
|
2
|
+
var Q = (t) => {
|
|
3
3
|
throw TypeError(t);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
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
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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[
|
|
73
|
-
var
|
|
14
|
+
t[k] = void 0;
|
|
15
|
+
var n = !0;
|
|
74
16
|
} catch {
|
|
75
17
|
}
|
|
76
|
-
var
|
|
77
|
-
return
|
|
18
|
+
var a = Tt.call(t);
|
|
19
|
+
return n && (e ? t[k] = r : delete t[k]), a;
|
|
78
20
|
}
|
|
79
|
-
var
|
|
80
|
-
function
|
|
81
|
-
return
|
|
21
|
+
var Ot = Object.prototype, vt = Ot.toString;
|
|
22
|
+
function Ct(t) {
|
|
23
|
+
return vt.call(t);
|
|
82
24
|
}
|
|
83
|
-
var
|
|
84
|
-
function
|
|
85
|
-
return t == null ? t === void 0 ?
|
|
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
|
|
29
|
+
function ct(t) {
|
|
88
30
|
return t != null && typeof t == "object";
|
|
89
31
|
}
|
|
90
|
-
var
|
|
91
|
-
function
|
|
92
|
-
return typeof t == "symbol" ||
|
|
32
|
+
var kt = "[object Symbol]";
|
|
33
|
+
function V(t) {
|
|
34
|
+
return typeof t == "symbol" || ct(t) && ot(t) == kt;
|
|
93
35
|
}
|
|
94
|
-
function
|
|
95
|
-
for (var r = -1,
|
|
96
|
-
|
|
97
|
-
return
|
|
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
|
|
100
|
-
function
|
|
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 (
|
|
104
|
-
return
|
|
105
|
-
if (
|
|
106
|
-
return
|
|
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 == -
|
|
50
|
+
return e == "0" && 1 / t == -It ? "-0" : e;
|
|
109
51
|
}
|
|
110
|
-
function
|
|
52
|
+
function ut(t) {
|
|
111
53
|
var e = typeof t;
|
|
112
54
|
return t != null && (e == "object" || e == "function");
|
|
113
55
|
}
|
|
114
|
-
var
|
|
115
|
-
function
|
|
116
|
-
if (!
|
|
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 =
|
|
119
|
-
return e ==
|
|
60
|
+
var e = ot(t);
|
|
61
|
+
return e == Et || e == At || e == xt || e == Dt;
|
|
120
62
|
}
|
|
121
|
-
var
|
|
122
|
-
var t = /[^.]+$/.exec(
|
|
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
|
|
126
|
-
return !!
|
|
67
|
+
function Rt(t) {
|
|
68
|
+
return !!at && at in t;
|
|
127
69
|
}
|
|
128
|
-
var
|
|
129
|
-
function
|
|
70
|
+
var Mt = Function.prototype, Nt = Mt.toString;
|
|
71
|
+
function Lt(t) {
|
|
130
72
|
if (t != null) {
|
|
131
73
|
try {
|
|
132
|
-
return
|
|
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
|
|
143
|
-
"^" +
|
|
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
|
|
146
|
-
if (!
|
|
87
|
+
function Vt(t) {
|
|
88
|
+
if (!ut(t) || Rt(t))
|
|
147
89
|
return !1;
|
|
148
|
-
var e =
|
|
149
|
-
return e.test(
|
|
90
|
+
var e = Ft(t) ? Jt : Gt;
|
|
91
|
+
return e.test(Lt(t));
|
|
150
92
|
}
|
|
151
|
-
function
|
|
93
|
+
function Wt(t, e) {
|
|
152
94
|
return t == null ? void 0 : t[e];
|
|
153
95
|
}
|
|
154
|
-
function
|
|
155
|
-
var r =
|
|
156
|
-
return
|
|
96
|
+
function ft(t, e) {
|
|
97
|
+
var r = Wt(t, e);
|
|
98
|
+
return Vt(r) ? r : void 0;
|
|
157
99
|
}
|
|
158
|
-
function
|
|
100
|
+
function Xt(t, e) {
|
|
159
101
|
return t === e || t !== t && e !== e;
|
|
160
102
|
}
|
|
161
|
-
var
|
|
162
|
-
function
|
|
163
|
-
if (
|
|
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 ||
|
|
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
|
|
169
|
-
function
|
|
170
|
-
this.__data__ =
|
|
110
|
+
var x = ft(Object, "create");
|
|
111
|
+
function te() {
|
|
112
|
+
this.__data__ = x ? x(null) : {}, this.size = 0;
|
|
171
113
|
}
|
|
172
|
-
function
|
|
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
|
|
177
|
-
function
|
|
118
|
+
var re = "__lodash_hash_undefined__", ne = Object.prototype, ae = ne.hasOwnProperty;
|
|
119
|
+
function ie(t) {
|
|
178
120
|
var e = this.__data__;
|
|
179
|
-
if (
|
|
121
|
+
if (x) {
|
|
180
122
|
var r = e[t];
|
|
181
|
-
return r ===
|
|
123
|
+
return r === re ? void 0 : r;
|
|
182
124
|
}
|
|
183
|
-
return
|
|
125
|
+
return ae.call(e, t) ? e[t] : void 0;
|
|
184
126
|
}
|
|
185
|
-
var
|
|
186
|
-
function
|
|
127
|
+
var se = Object.prototype, oe = se.hasOwnProperty;
|
|
128
|
+
function ce(t) {
|
|
187
129
|
var e = this.__data__;
|
|
188
|
-
return
|
|
130
|
+
return x ? e[t] !== void 0 : oe.call(e, t);
|
|
189
131
|
}
|
|
190
|
-
var
|
|
191
|
-
function
|
|
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] =
|
|
135
|
+
return this.size += this.has(t) ? 0 : 1, r[t] = x && e === void 0 ? he : e, this;
|
|
194
136
|
}
|
|
195
|
-
function
|
|
137
|
+
function _(t) {
|
|
196
138
|
var e = -1, r = t == null ? 0 : t.length;
|
|
197
139
|
for (this.clear(); ++e < r; ) {
|
|
198
|
-
var
|
|
199
|
-
this.set(
|
|
140
|
+
var n = t[e];
|
|
141
|
+
this.set(n[0], n[1]);
|
|
200
142
|
}
|
|
201
143
|
}
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
function
|
|
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
|
|
152
|
+
function L(t, e) {
|
|
211
153
|
for (var r = t.length; r--; )
|
|
212
|
-
if (
|
|
154
|
+
if (Xt(t[r][0], e))
|
|
213
155
|
return r;
|
|
214
156
|
return -1;
|
|
215
157
|
}
|
|
216
|
-
var
|
|
217
|
-
function
|
|
218
|
-
var e = this.__data__, r =
|
|
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
|
|
222
|
-
return r ==
|
|
163
|
+
var n = e.length - 1;
|
|
164
|
+
return r == n ? e.pop() : de.call(e, r, 1), --this.size, !0;
|
|
223
165
|
}
|
|
224
|
-
function
|
|
225
|
-
var e = this.__data__, r =
|
|
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
|
|
229
|
-
return
|
|
170
|
+
function ge(t) {
|
|
171
|
+
return L(this.__data__, t) > -1;
|
|
230
172
|
}
|
|
231
|
-
function
|
|
232
|
-
var r = this.__data__,
|
|
233
|
-
return
|
|
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
|
|
177
|
+
function C(t) {
|
|
236
178
|
var e = -1, r = t == null ? 0 : t.length;
|
|
237
179
|
for (this.clear(); ++e < r; ) {
|
|
238
|
-
var
|
|
239
|
-
this.set(
|
|
180
|
+
var n = t[e];
|
|
181
|
+
this.set(n[0], n[1]);
|
|
240
182
|
}
|
|
241
183
|
}
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
var
|
|
248
|
-
function
|
|
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
|
|
251
|
-
map: new (
|
|
252
|
-
string: new
|
|
192
|
+
hash: new _(),
|
|
193
|
+
map: new (be || C)(),
|
|
194
|
+
string: new _()
|
|
253
195
|
};
|
|
254
196
|
}
|
|
255
|
-
function
|
|
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
|
|
201
|
+
function U(t, e) {
|
|
260
202
|
var r = t.__data__;
|
|
261
|
-
return
|
|
203
|
+
return we(e) ? r[typeof e == "string" ? "string" : "hash"] : r.map;
|
|
262
204
|
}
|
|
263
|
-
function
|
|
264
|
-
var e =
|
|
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
|
|
268
|
-
return
|
|
209
|
+
function Te(t) {
|
|
210
|
+
return U(this, t).get(t);
|
|
269
211
|
}
|
|
270
|
-
function
|
|
271
|
-
return
|
|
212
|
+
function je(t) {
|
|
213
|
+
return U(this, t).has(t);
|
|
272
214
|
}
|
|
273
|
-
function
|
|
274
|
-
var r =
|
|
275
|
-
return r.set(t, e), this.size += r.size ==
|
|
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
|
|
219
|
+
function b(t) {
|
|
278
220
|
var e = -1, r = t == null ? 0 : t.length;
|
|
279
221
|
for (this.clear(); ++e < r; ) {
|
|
280
|
-
var
|
|
281
|
-
this.set(
|
|
222
|
+
var n = t[e];
|
|
223
|
+
this.set(n[0], n[1]);
|
|
282
224
|
}
|
|
283
225
|
}
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
var
|
|
290
|
-
function
|
|
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(
|
|
234
|
+
throw new TypeError(ve);
|
|
293
235
|
var r = function() {
|
|
294
|
-
var
|
|
295
|
-
if (
|
|
296
|
-
return
|
|
297
|
-
var
|
|
298
|
-
return r.cache =
|
|
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 (
|
|
242
|
+
return r.cache = new (X.Cache || b)(), r;
|
|
301
243
|
}
|
|
302
|
-
|
|
303
|
-
var
|
|
304
|
-
function
|
|
305
|
-
var e =
|
|
306
|
-
return r.size ===
|
|
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
|
|
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(
|
|
313
|
-
e.push(
|
|
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
|
|
317
|
-
return t == null ? "" :
|
|
258
|
+
function Ie(t) {
|
|
259
|
+
return t == null ? "" : ht(t);
|
|
318
260
|
}
|
|
319
|
-
function
|
|
320
|
-
return
|
|
261
|
+
function xe(t, e) {
|
|
262
|
+
return W(t) ? t : Qt(t, e) ? [t] : Pe(Ie(t));
|
|
321
263
|
}
|
|
322
|
-
var
|
|
323
|
-
function
|
|
324
|
-
if (typeof t == "string" ||
|
|
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 == -
|
|
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
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
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
|
|
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
|
-
|
|
378
|
-
const
|
|
379
|
-
this.lineage.push(
|
|
380
|
-
const
|
|
381
|
-
for (const
|
|
382
|
-
const
|
|
383
|
-
if (
|
|
384
|
-
if (
|
|
385
|
-
|
|
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
|
|
389
|
-
if (
|
|
390
|
-
let
|
|
391
|
-
typeof
|
|
392
|
-
const
|
|
393
|
-
let
|
|
394
|
-
for (const
|
|
395
|
-
|
|
396
|
-
|
|
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 (
|
|
400
|
-
const
|
|
401
|
-
value:
|
|
402
|
-
isDetached:
|
|
341
|
+
if (u.speckle_type) {
|
|
342
|
+
const S = await h(this, s, I).call(this, {
|
|
343
|
+
value: u,
|
|
344
|
+
isDetached: z
|
|
403
345
|
});
|
|
404
|
-
|
|
346
|
+
a[o] = z ? h(this, s, N).call(this, S.id) : S;
|
|
405
347
|
continue;
|
|
406
348
|
}
|
|
407
|
-
|
|
408
|
-
value:
|
|
409
|
-
isDetached:
|
|
349
|
+
a[o] = await h(this, s, I).call(this, {
|
|
350
|
+
value: u,
|
|
351
|
+
isDetached: z
|
|
410
352
|
});
|
|
411
353
|
}
|
|
412
|
-
const
|
|
413
|
-
if (this.familyTree[
|
|
414
|
-
const
|
|
415
|
-
Object.entries(this.familyTree[
|
|
416
|
-
|
|
417
|
-
}),
|
|
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:
|
|
420
|
-
return
|
|
421
|
-
},
|
|
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
|
|
428
|
-
if (
|
|
429
|
-
if (typeof
|
|
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 (
|
|
374
|
+
e.map(async (i) => await h(this, s, I).call(this, { value: i }))
|
|
433
375
|
);
|
|
434
|
-
const
|
|
435
|
-
for (const
|
|
436
|
-
if (
|
|
376
|
+
const a = [];
|
|
377
|
+
for (const i of e)
|
|
378
|
+
if (Le(i)) {
|
|
437
379
|
this.detachLineage.push(r);
|
|
438
|
-
const { hash:
|
|
439
|
-
|
|
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
|
-
|
|
442
|
-
return
|
|
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
|
|
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
|
-
},
|
|
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
|
-
},
|
|
397
|
+
}, q = async function(e) {
|
|
456
398
|
this.detachLineage.push(!0);
|
|
457
|
-
const { hash: r } = await
|
|
458
|
-
return
|
|
459
|
-
},
|
|
460
|
-
const r = JSON.stringify(e),
|
|
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:
|
|
463
|
-
serializedObject:
|
|
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
|
|
410
|
+
class it {
|
|
469
411
|
constructor() {
|
|
470
|
-
|
|
471
|
-
|
|
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
|
|
476
|
-
class
|
|
477
|
-
constructor(e, r,
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
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
|
-
|
|
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 (
|
|
493
|
-
const e = new FormData(),
|
|
494
|
-
|
|
495
|
-
const a = new URL(`/objects/${
|
|
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 ${
|
|
500
|
-
body:
|
|
441
|
+
headers: { Authorization: `Bearer ${c(this, O)}` },
|
|
442
|
+
body: r
|
|
501
443
|
}),
|
|
502
|
-
|
|
444
|
+
bt(c(this, D), "Object sender flush timed out")
|
|
503
445
|
]),
|
|
504
|
-
|
|
505
|
-
(
|
|
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
|
-
|
|
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
|
-
|
|
474
|
+
f(this, y, []);
|
|
515
475
|
}
|
|
516
476
|
}
|
|
517
|
-
|
|
518
|
-
class
|
|
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
|
-
|
|
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
|
|
485
|
+
const We = async (t, {
|
|
526
486
|
serverUrl: e = "https://app.speckle.systems",
|
|
527
487
|
projectId: r,
|
|
528
|
-
token:
|
|
529
|
-
logger:
|
|
530
|
-
options:
|
|
488
|
+
token: n,
|
|
489
|
+
logger: a = console,
|
|
490
|
+
options: i = void 0
|
|
531
491
|
}) => {
|
|
532
|
-
const
|
|
533
|
-
|
|
534
|
-
const
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
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
|
|
499
|
+
let R;
|
|
540
500
|
try {
|
|
541
|
-
|
|
501
|
+
R = await F.write(t);
|
|
542
502
|
} finally {
|
|
543
|
-
|
|
503
|
+
m.dispose(), F.dispose();
|
|
544
504
|
}
|
|
545
|
-
const
|
|
546
|
-
return
|
|
505
|
+
const o = performance.now();
|
|
506
|
+
return a.log(`Finished sending in ${(o - d) / B.second}s.`), R;
|
|
547
507
|
};
|
|
548
508
|
export {
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
509
|
+
Ve as Base,
|
|
510
|
+
Je as Chunkable,
|
|
511
|
+
qe as Detach,
|
|
512
|
+
We as send
|
|
553
513
|
};
|
|
554
514
|
//# sourceMappingURL=objectsender.js.map
|