@thatopen/services 0.27.0 → 0.28.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/cli.js +9 -6
- package/dist/cli.js.map +1 -1
- package/dist/core/builtin-recipes/records-to-revit.d.ts +7 -3
- package/dist/core/builtin-recipes/shared.d.ts +7 -0
- package/dist/index.cjs.js +36 -41
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +1133 -1057
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,75 +1,75 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var un = Object.defineProperty;
|
|
2
|
+
var as = (n) => {
|
|
3
3
|
throw TypeError(n);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
Object.keys(
|
|
18
|
-
|
|
5
|
+
var fn = (n, e, t) => e in n ? un(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
|
|
6
|
+
var B = (n, e, t) => fn(n, typeof e != "symbol" ? e + "" : e, t), Tt = (n, e, t) => e.has(n) || as("Cannot " + t);
|
|
7
|
+
var u = (n, e, t) => (Tt(n, e, "read from private field"), t ? t.call(n) : e.get(n)), S = (n, e, t) => e.has(n) ? as("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t), R = (n, e, t, s) => (Tt(n, e, "write to private field"), s ? s.call(n, t) : e.set(n, t), t), h = (n, e, t) => (Tt(n, e, "access private method"), t);
|
|
8
|
+
const ne = /* @__PURE__ */ Object.create(null);
|
|
9
|
+
ne.open = "0";
|
|
10
|
+
ne.close = "1";
|
|
11
|
+
ne.ping = "2";
|
|
12
|
+
ne.pong = "3";
|
|
13
|
+
ne.message = "4";
|
|
14
|
+
ne.upgrade = "5";
|
|
15
|
+
ne.noop = "6";
|
|
16
|
+
const lt = /* @__PURE__ */ Object.create(null);
|
|
17
|
+
Object.keys(ne).forEach((n) => {
|
|
18
|
+
lt[ne[n]] = n;
|
|
19
19
|
});
|
|
20
|
-
const
|
|
20
|
+
const Ct = { type: "error", data: "parser error" }, Cs = typeof Blob == "function" || typeof Blob < "u" && Object.prototype.toString.call(Blob) === "[object BlobConstructor]", $s = typeof ArrayBuffer == "function", xs = (n) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(n) : n && n.buffer instanceof ArrayBuffer, Zt = ({ type: n, data: e }, t, s) => Cs && e instanceof Blob ? t ? s(e) : cs(e, s) : $s && (e instanceof ArrayBuffer || xs(e)) ? t ? s(e) : cs(new Blob([e]), s) : s(ne[n] + (e || "")), cs = (n, e) => {
|
|
21
21
|
const t = new FileReader();
|
|
22
22
|
return t.onload = function() {
|
|
23
23
|
const s = t.result.split(",")[1];
|
|
24
24
|
e("b" + (s || ""));
|
|
25
25
|
}, t.readAsDataURL(n);
|
|
26
26
|
};
|
|
27
|
-
function
|
|
27
|
+
function hs(n) {
|
|
28
28
|
return n instanceof Uint8Array ? n : n instanceof ArrayBuffer ? new Uint8Array(n) : new Uint8Array(n.buffer, n.byteOffset, n.byteLength);
|
|
29
29
|
}
|
|
30
|
-
let
|
|
31
|
-
function
|
|
32
|
-
if (
|
|
33
|
-
return n.data.arrayBuffer().then(
|
|
34
|
-
if (
|
|
35
|
-
return e(
|
|
36
|
-
|
|
37
|
-
|
|
30
|
+
let _t;
|
|
31
|
+
function pn(n, e) {
|
|
32
|
+
if (Cs && n.data instanceof Blob)
|
|
33
|
+
return n.data.arrayBuffer().then(hs).then(e);
|
|
34
|
+
if ($s && (n.data instanceof ArrayBuffer || xs(n.data)))
|
|
35
|
+
return e(hs(n.data));
|
|
36
|
+
Zt(n, !1, (t) => {
|
|
37
|
+
_t || (_t = new TextEncoder()), e(_t.encode(t));
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
|
-
const
|
|
41
|
-
for (let n = 0; n <
|
|
42
|
-
|
|
43
|
-
const
|
|
40
|
+
const ls = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", Je = typeof Uint8Array > "u" ? [] : new Uint8Array(256);
|
|
41
|
+
for (let n = 0; n < ls.length; n++)
|
|
42
|
+
Je[ls.charCodeAt(n)] = n;
|
|
43
|
+
const mn = (n) => {
|
|
44
44
|
let e = n.length * 0.75, t = n.length, s, r = 0, i, o, a, l;
|
|
45
45
|
n[n.length - 1] === "=" && (e--, n[n.length - 2] === "=" && e--);
|
|
46
|
-
const
|
|
46
|
+
const d = new ArrayBuffer(e), c = new Uint8Array(d);
|
|
47
47
|
for (s = 0; s < t; s += 4)
|
|
48
|
-
i =
|
|
49
|
-
return
|
|
50
|
-
},
|
|
48
|
+
i = Je[n.charCodeAt(s)], o = Je[n.charCodeAt(s + 1)], a = Je[n.charCodeAt(s + 2)], l = Je[n.charCodeAt(s + 3)], c[r++] = i << 2 | o >> 4, c[r++] = (o & 15) << 4 | a >> 2, c[r++] = (a & 3) << 6 | l & 63;
|
|
49
|
+
return d;
|
|
50
|
+
}, yn = typeof ArrayBuffer == "function", es = (n, e) => {
|
|
51
51
|
if (typeof n != "string")
|
|
52
52
|
return {
|
|
53
53
|
type: "message",
|
|
54
|
-
data:
|
|
54
|
+
data: Ns(n, e)
|
|
55
55
|
};
|
|
56
56
|
const t = n.charAt(0);
|
|
57
57
|
return t === "b" ? {
|
|
58
58
|
type: "message",
|
|
59
|
-
data:
|
|
60
|
-
} :
|
|
61
|
-
type:
|
|
59
|
+
data: gn(n.substring(1), e)
|
|
60
|
+
} : lt[t] ? n.length > 1 ? {
|
|
61
|
+
type: lt[t],
|
|
62
62
|
data: n.substring(1)
|
|
63
63
|
} : {
|
|
64
|
-
type:
|
|
65
|
-
} :
|
|
66
|
-
},
|
|
67
|
-
if (
|
|
68
|
-
const t =
|
|
69
|
-
return
|
|
64
|
+
type: lt[t]
|
|
65
|
+
} : Ct;
|
|
66
|
+
}, gn = (n, e) => {
|
|
67
|
+
if (yn) {
|
|
68
|
+
const t = mn(n);
|
|
69
|
+
return Ns(t, e);
|
|
70
70
|
} else
|
|
71
71
|
return { base64: !0, data: n };
|
|
72
|
-
},
|
|
72
|
+
}, Ns = (n, e) => {
|
|
73
73
|
switch (e) {
|
|
74
74
|
case "blob":
|
|
75
75
|
return n instanceof Blob ? n : new Blob([n]);
|
|
@@ -77,27 +77,27 @@ const dn = (n) => {
|
|
|
77
77
|
default:
|
|
78
78
|
return n instanceof ArrayBuffer ? n : n.buffer;
|
|
79
79
|
}
|
|
80
|
-
},
|
|
80
|
+
}, Ps = "", wn = (n, e) => {
|
|
81
81
|
const t = n.length, s = new Array(t);
|
|
82
82
|
let r = 0;
|
|
83
83
|
n.forEach((i, o) => {
|
|
84
|
-
|
|
85
|
-
s[o] = a, ++r === t && e(s.join(
|
|
84
|
+
Zt(i, !1, (a) => {
|
|
85
|
+
s[o] = a, ++r === t && e(s.join(Ps));
|
|
86
86
|
});
|
|
87
87
|
});
|
|
88
|
-
},
|
|
89
|
-
const t = n.split(
|
|
88
|
+
}, bn = (n, e) => {
|
|
89
|
+
const t = n.split(Ps), s = [];
|
|
90
90
|
for (let r = 0; r < t.length; r++) {
|
|
91
|
-
const i =
|
|
91
|
+
const i = es(t[r], e);
|
|
92
92
|
if (s.push(i), i.type === "error")
|
|
93
93
|
break;
|
|
94
94
|
}
|
|
95
95
|
return s;
|
|
96
96
|
};
|
|
97
|
-
function
|
|
97
|
+
function vn() {
|
|
98
98
|
return new TransformStream({
|
|
99
99
|
transform(n, e) {
|
|
100
|
-
|
|
100
|
+
pn(n, (t) => {
|
|
101
101
|
const s = t.length;
|
|
102
102
|
let r;
|
|
103
103
|
if (s < 126)
|
|
@@ -116,11 +116,11 @@ function yn() {
|
|
|
116
116
|
}
|
|
117
117
|
});
|
|
118
118
|
}
|
|
119
|
-
let
|
|
120
|
-
function
|
|
119
|
+
let It;
|
|
120
|
+
function it(n) {
|
|
121
121
|
return n.reduce((e, t) => e + t.length, 0);
|
|
122
122
|
}
|
|
123
|
-
function
|
|
123
|
+
function ot(n, e) {
|
|
124
124
|
if (n[0].length === e)
|
|
125
125
|
return n.shift();
|
|
126
126
|
const t = new Uint8Array(e);
|
|
@@ -129,65 +129,65 @@ function je(n, e) {
|
|
|
129
129
|
t[r] = n[0][s++], s === n[0].length && (n.shift(), s = 0);
|
|
130
130
|
return n.length && s < n[0].length && (n[0] = n[0].slice(s)), t;
|
|
131
131
|
}
|
|
132
|
-
function
|
|
133
|
-
|
|
132
|
+
function En(n, e) {
|
|
133
|
+
It || (It = new TextDecoder());
|
|
134
134
|
const t = [];
|
|
135
135
|
let s = 0, r = -1, i = !1;
|
|
136
136
|
return new TransformStream({
|
|
137
137
|
transform(o, a) {
|
|
138
138
|
for (t.push(o); ; ) {
|
|
139
139
|
if (s === 0) {
|
|
140
|
-
if (
|
|
140
|
+
if (it(t) < 1)
|
|
141
141
|
break;
|
|
142
|
-
const l =
|
|
142
|
+
const l = ot(t, 1);
|
|
143
143
|
i = (l[0] & 128) === 128, r = l[0] & 127, r < 126 ? s = 3 : r === 126 ? s = 1 : s = 2;
|
|
144
144
|
} else if (s === 1) {
|
|
145
|
-
if (
|
|
145
|
+
if (it(t) < 2)
|
|
146
146
|
break;
|
|
147
|
-
const l =
|
|
147
|
+
const l = ot(t, 2);
|
|
148
148
|
r = new DataView(l.buffer, l.byteOffset, l.length).getUint16(0), s = 3;
|
|
149
149
|
} else if (s === 2) {
|
|
150
|
-
if (
|
|
150
|
+
if (it(t) < 8)
|
|
151
151
|
break;
|
|
152
|
-
const l =
|
|
152
|
+
const l = ot(t, 8), d = new DataView(l.buffer, l.byteOffset, l.length), c = d.getUint32(0);
|
|
153
153
|
if (c > Math.pow(2, 21) - 1) {
|
|
154
|
-
a.enqueue(
|
|
154
|
+
a.enqueue(Ct);
|
|
155
155
|
break;
|
|
156
156
|
}
|
|
157
|
-
r = c * Math.pow(2, 32) +
|
|
157
|
+
r = c * Math.pow(2, 32) + d.getUint32(4), s = 3;
|
|
158
158
|
} else {
|
|
159
|
-
if (
|
|
159
|
+
if (it(t) < r)
|
|
160
160
|
break;
|
|
161
|
-
const l =
|
|
162
|
-
a.enqueue(
|
|
161
|
+
const l = ot(t, r);
|
|
162
|
+
a.enqueue(es(i ? l : It.decode(l), e)), s = 0;
|
|
163
163
|
}
|
|
164
164
|
if (r === 0 || r > n) {
|
|
165
|
-
a.enqueue(
|
|
165
|
+
a.enqueue(Ct);
|
|
166
166
|
break;
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
169
|
}
|
|
170
170
|
});
|
|
171
171
|
}
|
|
172
|
-
const
|
|
173
|
-
function
|
|
174
|
-
if (n) return
|
|
172
|
+
const Bs = 4;
|
|
173
|
+
function C(n) {
|
|
174
|
+
if (n) return Tn(n);
|
|
175
175
|
}
|
|
176
|
-
function
|
|
177
|
-
for (var e in
|
|
178
|
-
n[e] =
|
|
176
|
+
function Tn(n) {
|
|
177
|
+
for (var e in C.prototype)
|
|
178
|
+
n[e] = C.prototype[e];
|
|
179
179
|
return n;
|
|
180
180
|
}
|
|
181
|
-
|
|
181
|
+
C.prototype.on = C.prototype.addEventListener = function(n, e) {
|
|
182
182
|
return this._callbacks = this._callbacks || {}, (this._callbacks["$" + n] = this._callbacks["$" + n] || []).push(e), this;
|
|
183
183
|
};
|
|
184
|
-
|
|
184
|
+
C.prototype.once = function(n, e) {
|
|
185
185
|
function t() {
|
|
186
186
|
this.off(n, t), e.apply(this, arguments);
|
|
187
187
|
}
|
|
188
188
|
return t.fn = e, this.on(n, t), this;
|
|
189
189
|
};
|
|
190
|
-
|
|
190
|
+
C.prototype.off = C.prototype.removeListener = C.prototype.removeAllListeners = C.prototype.removeEventListener = function(n, e) {
|
|
191
191
|
if (this._callbacks = this._callbacks || {}, arguments.length == 0)
|
|
192
192
|
return this._callbacks = {}, this;
|
|
193
193
|
var t = this._callbacks["$" + n];
|
|
@@ -201,7 +201,7 @@ O.prototype.off = O.prototype.removeListener = O.prototype.removeAllListeners =
|
|
|
201
201
|
}
|
|
202
202
|
return t.length === 0 && delete this._callbacks["$" + n], this;
|
|
203
203
|
};
|
|
204
|
-
|
|
204
|
+
C.prototype.emit = function(n) {
|
|
205
205
|
this._callbacks = this._callbacks || {};
|
|
206
206
|
for (var e = new Array(arguments.length - 1), t = this._callbacks["$" + n], s = 1; s < arguments.length; s++)
|
|
207
207
|
e[s - 1] = arguments[s];
|
|
@@ -212,41 +212,41 @@ O.prototype.emit = function(n) {
|
|
|
212
212
|
}
|
|
213
213
|
return this;
|
|
214
214
|
};
|
|
215
|
-
|
|
216
|
-
|
|
215
|
+
C.prototype.emitReserved = C.prototype.emit;
|
|
216
|
+
C.prototype.listeners = function(n) {
|
|
217
217
|
return this._callbacks = this._callbacks || {}, this._callbacks["$" + n] || [];
|
|
218
218
|
};
|
|
219
|
-
|
|
219
|
+
C.prototype.hasListeners = function(n) {
|
|
220
220
|
return !!this.listeners(n).length;
|
|
221
221
|
};
|
|
222
|
-
const
|
|
223
|
-
function
|
|
222
|
+
const vt = typeof Promise == "function" && typeof Promise.resolve == "function" ? (e) => Promise.resolve().then(e) : (e, t) => t(e, 0), V = typeof self < "u" ? self : typeof window < "u" ? window : Function("return this")(), _n = "arraybuffer";
|
|
223
|
+
function Fs(n, ...e) {
|
|
224
224
|
return e.reduce((t, s) => (n.hasOwnProperty(s) && (t[s] = n[s]), t), {});
|
|
225
225
|
}
|
|
226
|
-
const
|
|
227
|
-
function
|
|
228
|
-
e.useNativeTimers ? (n.setTimeoutFn =
|
|
226
|
+
const In = V.setTimeout, Sn = V.clearTimeout;
|
|
227
|
+
function Et(n, e) {
|
|
228
|
+
e.useNativeTimers ? (n.setTimeoutFn = In.bind(V), n.clearTimeoutFn = Sn.bind(V)) : (n.setTimeoutFn = V.setTimeout.bind(V), n.clearTimeoutFn = V.clearTimeout.bind(V));
|
|
229
229
|
}
|
|
230
|
-
const
|
|
231
|
-
function
|
|
232
|
-
return typeof n == "string" ?
|
|
230
|
+
const kn = 1.33;
|
|
231
|
+
function On(n) {
|
|
232
|
+
return typeof n == "string" ? An(n) : Math.ceil((n.byteLength || n.size) * kn);
|
|
233
233
|
}
|
|
234
|
-
function
|
|
234
|
+
function An(n) {
|
|
235
235
|
let e = 0, t = 0;
|
|
236
236
|
for (let s = 0, r = n.length; s < r; s++)
|
|
237
237
|
e = n.charCodeAt(s), e < 128 ? t += 1 : e < 2048 ? t += 2 : e < 55296 || e >= 57344 ? t += 3 : (s++, t += 4);
|
|
238
238
|
return t;
|
|
239
239
|
}
|
|
240
|
-
function
|
|
240
|
+
function Ls() {
|
|
241
241
|
return Date.now().toString(36).substring(3) + Math.random().toString(36).substring(2, 5);
|
|
242
242
|
}
|
|
243
|
-
function
|
|
243
|
+
function Rn(n) {
|
|
244
244
|
let e = "";
|
|
245
245
|
for (let t in n)
|
|
246
246
|
n.hasOwnProperty(t) && (e.length && (e += "&"), e += encodeURIComponent(t) + "=" + encodeURIComponent(n[t]));
|
|
247
247
|
return e;
|
|
248
248
|
}
|
|
249
|
-
function
|
|
249
|
+
function Cn(n) {
|
|
250
250
|
let e = {}, t = n.split("&");
|
|
251
251
|
for (let s = 0, r = t.length; s < r; s++) {
|
|
252
252
|
let i = t[s].split("=");
|
|
@@ -254,12 +254,12 @@ function kn(n) {
|
|
|
254
254
|
}
|
|
255
255
|
return e;
|
|
256
256
|
}
|
|
257
|
-
class
|
|
257
|
+
class $n extends Error {
|
|
258
258
|
constructor(e, t, s) {
|
|
259
259
|
super(e), this.description = t, this.context = s, this.type = "TransportError";
|
|
260
260
|
}
|
|
261
261
|
}
|
|
262
|
-
class
|
|
262
|
+
class ts extends C {
|
|
263
263
|
/**
|
|
264
264
|
* Transport abstract constructor.
|
|
265
265
|
*
|
|
@@ -267,7 +267,7 @@ class Pt extends O {
|
|
|
267
267
|
* @protected
|
|
268
268
|
*/
|
|
269
269
|
constructor(e) {
|
|
270
|
-
super(), this.writable = !1,
|
|
270
|
+
super(), this.writable = !1, Et(this, e), this.opts = e, this.query = e.query, this.socket = e.socket, this.supportsBinary = !e.forceBase64;
|
|
271
271
|
}
|
|
272
272
|
/**
|
|
273
273
|
* Emits an error.
|
|
@@ -279,7 +279,7 @@ class Pt extends O {
|
|
|
279
279
|
* @protected
|
|
280
280
|
*/
|
|
281
281
|
onError(e, t, s) {
|
|
282
|
-
return super.emitReserved("error", new
|
|
282
|
+
return super.emitReserved("error", new $n(e, t, s)), this;
|
|
283
283
|
}
|
|
284
284
|
/**
|
|
285
285
|
* Opens the transport.
|
|
@@ -316,7 +316,7 @@ class Pt extends O {
|
|
|
316
316
|
* @protected
|
|
317
317
|
*/
|
|
318
318
|
onData(e) {
|
|
319
|
-
const t =
|
|
319
|
+
const t = es(e, this.socket.binaryType);
|
|
320
320
|
this.onPacket(t);
|
|
321
321
|
}
|
|
322
322
|
/**
|
|
@@ -353,11 +353,11 @@ class Pt extends O {
|
|
|
353
353
|
return this.opts.port && (this.opts.secure && Number(this.opts.port) !== 443 || !this.opts.secure && Number(this.opts.port) !== 80) ? ":" + this.opts.port : "";
|
|
354
354
|
}
|
|
355
355
|
_query(e) {
|
|
356
|
-
const t =
|
|
356
|
+
const t = Rn(e);
|
|
357
357
|
return t.length ? "?" + t : "";
|
|
358
358
|
}
|
|
359
359
|
}
|
|
360
|
-
class
|
|
360
|
+
class xn extends ts {
|
|
361
361
|
constructor() {
|
|
362
362
|
super(...arguments), this._polling = !1;
|
|
363
363
|
}
|
|
@@ -413,7 +413,7 @@ class An extends Pt {
|
|
|
413
413
|
return this.onClose({ description: "transport closed by the server" }), !1;
|
|
414
414
|
this.onPacket(s);
|
|
415
415
|
};
|
|
416
|
-
|
|
416
|
+
bn(e, this.socket.binaryType).forEach(t), this.readyState !== "closed" && (this._polling = !1, this.emitReserved("pollComplete"), this.readyState === "open" && this._poll());
|
|
417
417
|
}
|
|
418
418
|
/**
|
|
419
419
|
* For polling, send a close packet.
|
|
@@ -433,7 +433,7 @@ class An extends Pt {
|
|
|
433
433
|
* @protected
|
|
434
434
|
*/
|
|
435
435
|
write(e) {
|
|
436
|
-
this.writable = !1,
|
|
436
|
+
this.writable = !1, wn(e, (t) => {
|
|
437
437
|
this.doWrite(t, () => {
|
|
438
438
|
this.writable = !0, this.emitReserved("drain");
|
|
439
439
|
});
|
|
@@ -446,18 +446,18 @@ class An extends Pt {
|
|
|
446
446
|
*/
|
|
447
447
|
uri() {
|
|
448
448
|
const e = this.opts.secure ? "https" : "http", t = this.query || {};
|
|
449
|
-
return this.opts.timestampRequests !== !1 && (t[this.opts.timestampParam] =
|
|
449
|
+
return this.opts.timestampRequests !== !1 && (t[this.opts.timestampParam] = Ls()), !this.supportsBinary && !t.sid && (t.b64 = 1), this.createUri(e, t);
|
|
450
450
|
}
|
|
451
451
|
}
|
|
452
|
-
let
|
|
452
|
+
let Ds = !1;
|
|
453
453
|
try {
|
|
454
|
-
|
|
454
|
+
Ds = typeof XMLHttpRequest < "u" && "withCredentials" in new XMLHttpRequest();
|
|
455
455
|
} catch {
|
|
456
456
|
}
|
|
457
|
-
const
|
|
458
|
-
function
|
|
457
|
+
const Nn = Ds;
|
|
458
|
+
function Pn() {
|
|
459
459
|
}
|
|
460
|
-
class
|
|
460
|
+
class Bn extends xn {
|
|
461
461
|
/**
|
|
462
462
|
* XHR Polling constructor.
|
|
463
463
|
*
|
|
@@ -499,7 +499,7 @@ class $n extends An {
|
|
|
499
499
|
}), this.pollXhr = e;
|
|
500
500
|
}
|
|
501
501
|
}
|
|
502
|
-
class
|
|
502
|
+
class se extends C {
|
|
503
503
|
/**
|
|
504
504
|
* Request constructor
|
|
505
505
|
*
|
|
@@ -507,7 +507,7 @@ class W extends O {
|
|
|
507
507
|
* @package
|
|
508
508
|
*/
|
|
509
509
|
constructor(e, t, s) {
|
|
510
|
-
super(), this.createRequest = e,
|
|
510
|
+
super(), this.createRequest = e, Et(this, s), this._opts = s, this._method = s.method || "GET", this._uri = t, this._data = s.data !== void 0 ? s.data : null, this._create();
|
|
511
511
|
}
|
|
512
512
|
/**
|
|
513
513
|
* Creates the XHR object and sends the request.
|
|
@@ -516,7 +516,7 @@ class W extends O {
|
|
|
516
516
|
*/
|
|
517
517
|
_create() {
|
|
518
518
|
var e;
|
|
519
|
-
const t =
|
|
519
|
+
const t = Fs(this._opts, "agent", "pfx", "key", "passphrase", "cert", "ca", "ciphers", "rejectUnauthorized", "autoUnref");
|
|
520
520
|
t.xdomain = !!this._opts.xd;
|
|
521
521
|
const s = this._xhr = this.createRequest(t);
|
|
522
522
|
try {
|
|
@@ -553,7 +553,7 @@ class W extends O {
|
|
|
553
553
|
}, 0);
|
|
554
554
|
return;
|
|
555
555
|
}
|
|
556
|
-
typeof document < "u" && (this._index =
|
|
556
|
+
typeof document < "u" && (this._index = se.requestsCount++, se.requests[this._index] = this);
|
|
557
557
|
}
|
|
558
558
|
/**
|
|
559
559
|
* Called upon error.
|
|
@@ -570,12 +570,12 @@ class W extends O {
|
|
|
570
570
|
*/
|
|
571
571
|
_cleanup(e) {
|
|
572
572
|
if (!(typeof this._xhr > "u" || this._xhr === null)) {
|
|
573
|
-
if (this._xhr.onreadystatechange =
|
|
573
|
+
if (this._xhr.onreadystatechange = Pn, e)
|
|
574
574
|
try {
|
|
575
575
|
this._xhr.abort();
|
|
576
576
|
} catch {
|
|
577
577
|
}
|
|
578
|
-
typeof document < "u" && delete
|
|
578
|
+
typeof document < "u" && delete se.requests[this._index], this._xhr = null;
|
|
579
579
|
}
|
|
580
580
|
}
|
|
581
581
|
/**
|
|
@@ -596,56 +596,56 @@ class W extends O {
|
|
|
596
596
|
this._cleanup();
|
|
597
597
|
}
|
|
598
598
|
}
|
|
599
|
-
|
|
600
|
-
|
|
599
|
+
se.requestsCount = 0;
|
|
600
|
+
se.requests = {};
|
|
601
601
|
if (typeof document < "u") {
|
|
602
602
|
if (typeof attachEvent == "function")
|
|
603
|
-
attachEvent("onunload",
|
|
603
|
+
attachEvent("onunload", ds);
|
|
604
604
|
else if (typeof addEventListener == "function") {
|
|
605
|
-
const n = "onpagehide" in
|
|
606
|
-
addEventListener(n,
|
|
605
|
+
const n = "onpagehide" in V ? "pagehide" : "unload";
|
|
606
|
+
addEventListener(n, ds, !1);
|
|
607
607
|
}
|
|
608
608
|
}
|
|
609
|
-
function
|
|
610
|
-
for (let n in
|
|
611
|
-
|
|
609
|
+
function ds() {
|
|
610
|
+
for (let n in se.requests)
|
|
611
|
+
se.requests.hasOwnProperty(n) && se.requests[n].abort();
|
|
612
612
|
}
|
|
613
|
-
const
|
|
614
|
-
const n =
|
|
613
|
+
const Fn = function() {
|
|
614
|
+
const n = qs({
|
|
615
615
|
xdomain: !1
|
|
616
616
|
});
|
|
617
617
|
return n && n.responseType !== null;
|
|
618
618
|
}();
|
|
619
|
-
class
|
|
619
|
+
class Ln extends Bn {
|
|
620
620
|
constructor(e) {
|
|
621
621
|
super(e);
|
|
622
622
|
const t = e && e.forceBase64;
|
|
623
|
-
this.supportsBinary =
|
|
623
|
+
this.supportsBinary = Fn && !t;
|
|
624
624
|
}
|
|
625
625
|
request(e = {}) {
|
|
626
|
-
return Object.assign(e, { xd: this.xd }, this.opts), new
|
|
626
|
+
return Object.assign(e, { xd: this.xd }, this.opts), new se(qs, this.uri(), e);
|
|
627
627
|
}
|
|
628
628
|
}
|
|
629
|
-
function
|
|
629
|
+
function qs(n) {
|
|
630
630
|
const e = n.xdomain;
|
|
631
631
|
try {
|
|
632
|
-
if (typeof XMLHttpRequest < "u" && (!e ||
|
|
632
|
+
if (typeof XMLHttpRequest < "u" && (!e || Nn))
|
|
633
633
|
return new XMLHttpRequest();
|
|
634
634
|
} catch {
|
|
635
635
|
}
|
|
636
636
|
if (!e)
|
|
637
637
|
try {
|
|
638
|
-
return new
|
|
638
|
+
return new V[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP");
|
|
639
639
|
} catch {
|
|
640
640
|
}
|
|
641
641
|
}
|
|
642
|
-
const
|
|
643
|
-
class
|
|
642
|
+
const js = typeof navigator < "u" && typeof navigator.product == "string" && navigator.product.toLowerCase() === "reactnative";
|
|
643
|
+
class Dn extends ts {
|
|
644
644
|
get name() {
|
|
645
645
|
return "websocket";
|
|
646
646
|
}
|
|
647
647
|
doOpen() {
|
|
648
|
-
const e = this.uri(), t = this.opts.protocols, s =
|
|
648
|
+
const e = this.uri(), t = this.opts.protocols, s = js ? {} : Fs(this.opts, "agent", "perMessageDeflate", "pfx", "key", "passphrase", "cert", "ca", "ciphers", "rejectUnauthorized", "localAddress", "protocolVersion", "origin", "maxPayload", "family", "checkServerIdentity");
|
|
649
649
|
this.opts.extraHeaders && (s.headers = this.opts.extraHeaders);
|
|
650
650
|
try {
|
|
651
651
|
this.ws = this.createSocket(e, t, s);
|
|
@@ -671,12 +671,12 @@ class Pn extends Pt {
|
|
|
671
671
|
this.writable = !1;
|
|
672
672
|
for (let t = 0; t < e.length; t++) {
|
|
673
673
|
const s = e[t], r = t === e.length - 1;
|
|
674
|
-
|
|
674
|
+
Zt(s, this.supportsBinary, (i) => {
|
|
675
675
|
try {
|
|
676
676
|
this.doWrite(s, i);
|
|
677
677
|
} catch {
|
|
678
678
|
}
|
|
679
|
-
r &&
|
|
679
|
+
r && vt(() => {
|
|
680
680
|
this.writable = !0, this.emitReserved("drain");
|
|
681
681
|
}, this.setTimeoutFn);
|
|
682
682
|
});
|
|
@@ -693,19 +693,19 @@ class Pn extends Pt {
|
|
|
693
693
|
*/
|
|
694
694
|
uri() {
|
|
695
695
|
const e = this.opts.secure ? "wss" : "ws", t = this.query || {};
|
|
696
|
-
return this.opts.timestampRequests && (t[this.opts.timestampParam] =
|
|
696
|
+
return this.opts.timestampRequests && (t[this.opts.timestampParam] = Ls()), this.supportsBinary || (t.b64 = 1), this.createUri(e, t);
|
|
697
697
|
}
|
|
698
698
|
}
|
|
699
|
-
const
|
|
700
|
-
class
|
|
699
|
+
const St = V.WebSocket || V.MozWebSocket;
|
|
700
|
+
class qn extends Dn {
|
|
701
701
|
createSocket(e, t, s) {
|
|
702
|
-
return
|
|
702
|
+
return js ? new St(e, t, s) : t ? new St(e, t) : new St(e);
|
|
703
703
|
}
|
|
704
704
|
doWrite(e, t) {
|
|
705
705
|
this.ws.send(t);
|
|
706
706
|
}
|
|
707
707
|
}
|
|
708
|
-
class
|
|
708
|
+
class jn extends ts {
|
|
709
709
|
get name() {
|
|
710
710
|
return "webtransport";
|
|
711
711
|
}
|
|
@@ -721,7 +721,7 @@ class Fn extends Pt {
|
|
|
721
721
|
this.onError("webtransport error", e);
|
|
722
722
|
}), this._transport.ready.then(() => {
|
|
723
723
|
this._transport.createBidirectionalStream().then((e) => {
|
|
724
|
-
const t =
|
|
724
|
+
const t = En(Number.MAX_SAFE_INTEGER, this.socket.binaryType), s = e.readable.pipeThrough(t).getReader(), r = vn();
|
|
725
725
|
r.readable.pipeTo(e.writable), this._writer = r.writable.getWriter();
|
|
726
726
|
const i = () => {
|
|
727
727
|
s.read().then(({ done: a, value: l }) => {
|
|
@@ -740,7 +740,7 @@ class Fn extends Pt {
|
|
|
740
740
|
for (let t = 0; t < e.length; t++) {
|
|
741
741
|
const s = e[t], r = t === e.length - 1;
|
|
742
742
|
this._writer.write(s).then(() => {
|
|
743
|
-
r &&
|
|
743
|
+
r && vt(() => {
|
|
744
744
|
this.writable = !0, this.emitReserved("drain");
|
|
745
745
|
}, this.setTimeoutFn);
|
|
746
746
|
});
|
|
@@ -751,11 +751,11 @@ class Fn extends Pt {
|
|
|
751
751
|
(e = this._transport) === null || e === void 0 || e.close();
|
|
752
752
|
}
|
|
753
753
|
}
|
|
754
|
-
const
|
|
755
|
-
websocket:
|
|
756
|
-
webtransport:
|
|
757
|
-
polling:
|
|
758
|
-
},
|
|
754
|
+
const Un = {
|
|
755
|
+
websocket: qn,
|
|
756
|
+
webtransport: jn,
|
|
757
|
+
polling: Ln
|
|
758
|
+
}, Mn = /^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/, Vn = [
|
|
759
759
|
"source",
|
|
760
760
|
"protocol",
|
|
761
761
|
"authority",
|
|
@@ -771,31 +771,31 @@ const Ln = {
|
|
|
771
771
|
"query",
|
|
772
772
|
"anchor"
|
|
773
773
|
];
|
|
774
|
-
function
|
|
774
|
+
function $t(n) {
|
|
775
775
|
if (n.length > 8e3)
|
|
776
776
|
throw "URI too long";
|
|
777
777
|
const e = n, t = n.indexOf("["), s = n.indexOf("]");
|
|
778
778
|
t != -1 && s != -1 && (n = n.substring(0, t) + n.substring(t, s).replace(/:/g, ";") + n.substring(s, n.length));
|
|
779
|
-
let r =
|
|
779
|
+
let r = Mn.exec(n || ""), i = {}, o = 14;
|
|
780
780
|
for (; o--; )
|
|
781
|
-
i[
|
|
782
|
-
return t != -1 && s != -1 && (i.source = e, i.host = i.host.substring(1, i.host.length - 1).replace(/;/g, ":"), i.authority = i.authority.replace("[", "").replace("]", "").replace(/;/g, ":"), i.ipv6uri = !0), i.pathNames =
|
|
781
|
+
i[Vn[o]] = r[o] || "";
|
|
782
|
+
return t != -1 && s != -1 && (i.source = e, i.host = i.host.substring(1, i.host.length - 1).replace(/;/g, ":"), i.authority = i.authority.replace("[", "").replace("]", "").replace(/;/g, ":"), i.ipv6uri = !0), i.pathNames = Hn(i, i.path), i.queryKey = Gn(i, i.query), i;
|
|
783
783
|
}
|
|
784
|
-
function
|
|
784
|
+
function Hn(n, e) {
|
|
785
785
|
const t = /\/{2,9}/g, s = e.replace(t, "/").split("/");
|
|
786
786
|
return (e.slice(0, 1) == "/" || e.length === 0) && s.splice(0, 1), e.slice(-1) == "/" && s.splice(s.length - 1, 1), s;
|
|
787
787
|
}
|
|
788
|
-
function
|
|
788
|
+
function Gn(n, e) {
|
|
789
789
|
const t = {};
|
|
790
790
|
return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g, function(s, r, i) {
|
|
791
791
|
r && (t[r] = i);
|
|
792
792
|
}), t;
|
|
793
793
|
}
|
|
794
|
-
const
|
|
795
|
-
|
|
796
|
-
|
|
794
|
+
const xt = typeof addEventListener == "function" && typeof removeEventListener == "function", dt = [];
|
|
795
|
+
xt && addEventListener("offline", () => {
|
|
796
|
+
dt.forEach((n) => n());
|
|
797
797
|
}, !1);
|
|
798
|
-
class
|
|
798
|
+
class ge extends C {
|
|
799
799
|
/**
|
|
800
800
|
* Socket constructor.
|
|
801
801
|
*
|
|
@@ -803,11 +803,11 @@ class de extends O {
|
|
|
803
803
|
* @param {Object} opts - options
|
|
804
804
|
*/
|
|
805
805
|
constructor(e, t) {
|
|
806
|
-
if (super(), this.binaryType =
|
|
807
|
-
const s =
|
|
806
|
+
if (super(), this.binaryType = _n, this.writeBuffer = [], this._prevBufferLen = 0, this._pingInterval = -1, this._pingTimeout = -1, this._maxPayload = -1, this._pingTimeoutTime = 1 / 0, e && typeof e == "object" && (t = e, e = null), e) {
|
|
807
|
+
const s = $t(e);
|
|
808
808
|
t.hostname = s.host, t.secure = s.protocol === "https" || s.protocol === "wss", t.port = s.port, s.query && (t.query = s.query);
|
|
809
|
-
} else t.host && (t.hostname =
|
|
810
|
-
|
|
809
|
+
} else t.host && (t.hostname = $t(t.host).host);
|
|
810
|
+
Et(this, t), this.secure = t.secure != null ? t.secure : typeof location < "u" && location.protocol === "https:", t.hostname && !t.port && (t.port = this.secure ? "443" : "80"), this.hostname = t.hostname || (typeof location < "u" ? location.hostname : "localhost"), this.port = t.port || (typeof location < "u" && location.port ? location.port : this.secure ? "443" : "80"), this.transports = [], this._transportsByName = {}, t.transports.forEach((s) => {
|
|
811
811
|
const r = s.prototype.name;
|
|
812
812
|
this.transports.push(r), this._transportsByName[r] = s;
|
|
813
813
|
}), this.opts = Object.assign({
|
|
@@ -824,13 +824,13 @@ class de extends O {
|
|
|
824
824
|
},
|
|
825
825
|
transportOptions: {},
|
|
826
826
|
closeOnBeforeunload: !1
|
|
827
|
-
}, t), this.opts.path = this.opts.path.replace(/\/$/, "") + (this.opts.addTrailingSlash ? "/" : ""), typeof this.opts.query == "string" && (this.opts.query =
|
|
827
|
+
}, t), this.opts.path = this.opts.path.replace(/\/$/, "") + (this.opts.addTrailingSlash ? "/" : ""), typeof this.opts.query == "string" && (this.opts.query = Cn(this.opts.query)), xt && (this.opts.closeOnBeforeunload && (this._beforeunloadEventListener = () => {
|
|
828
828
|
this.transport && (this.transport.removeAllListeners(), this.transport.close());
|
|
829
829
|
}, addEventListener("beforeunload", this._beforeunloadEventListener, !1)), this.hostname !== "localhost" && (this._offlineEventListener = () => {
|
|
830
830
|
this._onClose("transport close", {
|
|
831
831
|
description: "network connection lost"
|
|
832
832
|
});
|
|
833
|
-
},
|
|
833
|
+
}, dt.push(this._offlineEventListener))), this.opts.withCredentials && (this._cookieJar = void 0), this._open();
|
|
834
834
|
}
|
|
835
835
|
/**
|
|
836
836
|
* Creates transport of the given type.
|
|
@@ -841,7 +841,7 @@ class de extends O {
|
|
|
841
841
|
*/
|
|
842
842
|
createTransport(e) {
|
|
843
843
|
const t = Object.assign({}, this.opts.query);
|
|
844
|
-
t.EIO =
|
|
844
|
+
t.EIO = Bs, t.transport = e, this.id && (t.sid = this.id);
|
|
845
845
|
const s = Object.assign({}, this.opts, {
|
|
846
846
|
query: t,
|
|
847
847
|
socket: this,
|
|
@@ -863,7 +863,7 @@ class de extends O {
|
|
|
863
863
|
}, 0);
|
|
864
864
|
return;
|
|
865
865
|
}
|
|
866
|
-
const e = this.opts.rememberUpgrade &&
|
|
866
|
+
const e = this.opts.rememberUpgrade && ge.priorWebsocketSuccess && this.transports.indexOf("websocket") !== -1 ? "websocket" : this.transports[0];
|
|
867
867
|
this.readyState = "opening";
|
|
868
868
|
const t = this.createTransport(e);
|
|
869
869
|
t.open(), this.setTransport(t);
|
|
@@ -882,7 +882,7 @@ class de extends O {
|
|
|
882
882
|
* @private
|
|
883
883
|
*/
|
|
884
884
|
onOpen() {
|
|
885
|
-
this.readyState = "open",
|
|
885
|
+
this.readyState = "open", ge.priorWebsocketSuccess = this.transport.name === "websocket", this.emitReserved("open"), this.flush();
|
|
886
886
|
}
|
|
887
887
|
/**
|
|
888
888
|
* Handles a packet.
|
|
@@ -959,7 +959,7 @@ class de extends O {
|
|
|
959
959
|
let t = 1;
|
|
960
960
|
for (let s = 0; s < this.writeBuffer.length; s++) {
|
|
961
961
|
const r = this.writeBuffer[s].data;
|
|
962
|
-
if (r && (t +=
|
|
962
|
+
if (r && (t += On(r)), s > 0 && t > this._maxPayload)
|
|
963
963
|
return this.writeBuffer.slice(0, s);
|
|
964
964
|
t += 2;
|
|
965
965
|
}
|
|
@@ -979,7 +979,7 @@ class de extends O {
|
|
|
979
979
|
if (!this._pingTimeoutTime)
|
|
980
980
|
return !0;
|
|
981
981
|
const e = Date.now() > this._pingTimeoutTime;
|
|
982
|
-
return e && (this._pingTimeoutTime = 0,
|
|
982
|
+
return e && (this._pingTimeoutTime = 0, vt(() => {
|
|
983
983
|
this._onClose("ping timeout");
|
|
984
984
|
}, this.setTimeoutFn)), e;
|
|
985
985
|
}
|
|
@@ -1046,7 +1046,7 @@ class de extends O {
|
|
|
1046
1046
|
* @private
|
|
1047
1047
|
*/
|
|
1048
1048
|
_onError(e) {
|
|
1049
|
-
if (
|
|
1049
|
+
if (ge.priorWebsocketSuccess = !1, this.opts.tryAllTransports && this.transports.length > 1 && this.readyState === "opening")
|
|
1050
1050
|
return this.transports.shift(), this._open();
|
|
1051
1051
|
this.emitReserved("error", e), this._onClose("transport error", e);
|
|
1052
1052
|
}
|
|
@@ -1057,16 +1057,16 @@ class de extends O {
|
|
|
1057
1057
|
*/
|
|
1058
1058
|
_onClose(e, t) {
|
|
1059
1059
|
if (this.readyState === "opening" || this.readyState === "open" || this.readyState === "closing") {
|
|
1060
|
-
if (this.clearTimeoutFn(this._pingTimeoutTimer), this.transport.removeAllListeners("close"), this.transport.close(), this.transport.removeAllListeners(),
|
|
1061
|
-
const s =
|
|
1062
|
-
s !== -1 &&
|
|
1060
|
+
if (this.clearTimeoutFn(this._pingTimeoutTimer), this.transport.removeAllListeners("close"), this.transport.close(), this.transport.removeAllListeners(), xt && (this._beforeunloadEventListener && removeEventListener("beforeunload", this._beforeunloadEventListener, !1), this._offlineEventListener)) {
|
|
1061
|
+
const s = dt.indexOf(this._offlineEventListener);
|
|
1062
|
+
s !== -1 && dt.splice(s, 1);
|
|
1063
1063
|
}
|
|
1064
1064
|
this.readyState = "closed", this.id = null, this.emitReserved("close", e, t), this.writeBuffer = [], this._prevBufferLen = 0;
|
|
1065
1065
|
}
|
|
1066
1066
|
}
|
|
1067
1067
|
}
|
|
1068
|
-
|
|
1069
|
-
class
|
|
1068
|
+
ge.protocol = Bs;
|
|
1069
|
+
class Jn extends ge {
|
|
1070
1070
|
constructor() {
|
|
1071
1071
|
super(...arguments), this._upgrades = [];
|
|
1072
1072
|
}
|
|
@@ -1083,19 +1083,19 @@ class Mn extends de {
|
|
|
1083
1083
|
*/
|
|
1084
1084
|
_probe(e) {
|
|
1085
1085
|
let t = this.createTransport(e), s = !1;
|
|
1086
|
-
|
|
1086
|
+
ge.priorWebsocketSuccess = !1;
|
|
1087
1087
|
const r = () => {
|
|
1088
1088
|
s || (t.send([{ type: "ping", data: "probe" }]), t.once("packet", (m) => {
|
|
1089
1089
|
if (!s)
|
|
1090
1090
|
if (m.type === "pong" && m.data === "probe") {
|
|
1091
1091
|
if (this.upgrading = !0, this.emitReserved("upgrading", t), !t)
|
|
1092
1092
|
return;
|
|
1093
|
-
|
|
1093
|
+
ge.priorWebsocketSuccess = t.name === "websocket", this.transport.pause(() => {
|
|
1094
1094
|
s || this.readyState !== "closed" && (c(), this.setTransport(t), t.send([{ type: "upgrade" }]), this.emitReserved("upgrade", t), t = null, this.upgrading = !1, this.flush());
|
|
1095
1095
|
});
|
|
1096
1096
|
} else {
|
|
1097
|
-
const
|
|
1098
|
-
|
|
1097
|
+
const T = new Error("probe error");
|
|
1098
|
+
T.transport = t.name, this.emitReserved("upgradeError", T);
|
|
1099
1099
|
}
|
|
1100
1100
|
}));
|
|
1101
1101
|
};
|
|
@@ -1103,8 +1103,8 @@ class Mn extends de {
|
|
|
1103
1103
|
s || (s = !0, c(), t.close(), t = null);
|
|
1104
1104
|
}
|
|
1105
1105
|
const o = (m) => {
|
|
1106
|
-
const
|
|
1107
|
-
|
|
1106
|
+
const T = new Error("probe error: " + m);
|
|
1107
|
+
T.transport = t.name, i(), this.emitReserved("upgradeError", T);
|
|
1108
1108
|
};
|
|
1109
1109
|
function a() {
|
|
1110
1110
|
o("transport closed");
|
|
@@ -1112,13 +1112,13 @@ class Mn extends de {
|
|
|
1112
1112
|
function l() {
|
|
1113
1113
|
o("socket closed");
|
|
1114
1114
|
}
|
|
1115
|
-
function
|
|
1115
|
+
function d(m) {
|
|
1116
1116
|
t && m.name !== t.name && i();
|
|
1117
1117
|
}
|
|
1118
1118
|
const c = () => {
|
|
1119
|
-
t.removeListener("open", r), t.removeListener("error", o), t.removeListener("close", a), this.off("close", l), this.off("upgrading",
|
|
1119
|
+
t.removeListener("open", r), t.removeListener("error", o), t.removeListener("close", a), this.off("close", l), this.off("upgrading", d);
|
|
1120
1120
|
};
|
|
1121
|
-
t.once("open", r), t.once("error", o), t.once("close", a), this.once("close", l), this.once("upgrading",
|
|
1121
|
+
t.once("open", r), t.once("error", o), t.once("close", a), this.once("close", l), this.once("upgrading", d), this._upgrades.indexOf("webtransport") !== -1 && e !== "webtransport" ? this.setTimeoutFn(() => {
|
|
1122
1122
|
s || t.open();
|
|
1123
1123
|
}, 200) : t.open();
|
|
1124
1124
|
}
|
|
@@ -1138,67 +1138,67 @@ class Mn extends de {
|
|
|
1138
1138
|
return t;
|
|
1139
1139
|
}
|
|
1140
1140
|
}
|
|
1141
|
-
let
|
|
1141
|
+
let Wn = class extends Jn {
|
|
1142
1142
|
constructor(e, t = {}) {
|
|
1143
1143
|
const s = typeof e == "object", r = s ? { ...e } : { ...t };
|
|
1144
|
-
(!r.transports || r.transports && typeof r.transports[0] == "string") && (r.transports = (r.transports || ["polling", "websocket", "webtransport"]).map((i) =>
|
|
1144
|
+
(!r.transports || r.transports && typeof r.transports[0] == "string") && (r.transports = (r.transports || ["polling", "websocket", "webtransport"]).map((i) => Un[i]).filter((i) => !!i)), super(s ? r : e, r);
|
|
1145
1145
|
}
|
|
1146
1146
|
};
|
|
1147
|
-
function
|
|
1147
|
+
function Yn(n, e = "", t) {
|
|
1148
1148
|
let s = n;
|
|
1149
|
-
t = t || typeof location < "u" && location, n == null && (n = t.protocol + "//" + t.host), typeof n == "string" && (n.charAt(0) === "/" && (n.charAt(1) === "/" ? n = t.protocol + n : n = t.host + n), /^(https?|wss?):\/\//.test(n) || (typeof t < "u" ? n = t.protocol + "//" + n : n = "https://" + n), s =
|
|
1149
|
+
t = t || typeof location < "u" && location, n == null && (n = t.protocol + "//" + t.host), typeof n == "string" && (n.charAt(0) === "/" && (n.charAt(1) === "/" ? n = t.protocol + n : n = t.host + n), /^(https?|wss?):\/\//.test(n) || (typeof t < "u" ? n = t.protocol + "//" + n : n = "https://" + n), s = $t(n)), s.port || (/^(http|ws)$/.test(s.protocol) ? s.port = "80" : /^(http|ws)s$/.test(s.protocol) && (s.port = "443")), s.path = s.path || "/";
|
|
1150
1150
|
const i = s.host.indexOf(":") !== -1 ? "[" + s.host + "]" : s.host;
|
|
1151
1151
|
return s.id = s.protocol + "://" + i + ":" + s.port + e, s.href = s.protocol + "://" + i + (t && t.port === s.port ? "" : ":" + s.port), s;
|
|
1152
1152
|
}
|
|
1153
|
-
const
|
|
1154
|
-
function
|
|
1155
|
-
return
|
|
1153
|
+
const zn = typeof ArrayBuffer == "function", Kn = (n) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(n) : n.buffer instanceof ArrayBuffer, Us = Object.prototype.toString, Xn = typeof Blob == "function" || typeof Blob < "u" && Us.call(Blob) === "[object BlobConstructor]", Qn = typeof File == "function" || typeof File < "u" && Us.call(File) === "[object FileConstructor]";
|
|
1154
|
+
function ss(n) {
|
|
1155
|
+
return zn && (n instanceof ArrayBuffer || Kn(n)) || Xn && n instanceof Blob || Qn && n instanceof File;
|
|
1156
1156
|
}
|
|
1157
|
-
function
|
|
1157
|
+
function ut(n, e) {
|
|
1158
1158
|
if (!n || typeof n != "object")
|
|
1159
1159
|
return !1;
|
|
1160
1160
|
if (Array.isArray(n)) {
|
|
1161
1161
|
for (let t = 0, s = n.length; t < s; t++)
|
|
1162
|
-
if (
|
|
1162
|
+
if (ut(n[t]))
|
|
1163
1163
|
return !0;
|
|
1164
1164
|
return !1;
|
|
1165
1165
|
}
|
|
1166
|
-
if (
|
|
1166
|
+
if (ss(n))
|
|
1167
1167
|
return !0;
|
|
1168
1168
|
if (n.toJSON && typeof n.toJSON == "function" && arguments.length === 1)
|
|
1169
|
-
return
|
|
1169
|
+
return ut(n.toJSON(), !0);
|
|
1170
1170
|
for (const t in n)
|
|
1171
|
-
if (Object.prototype.hasOwnProperty.call(n, t) &&
|
|
1171
|
+
if (Object.prototype.hasOwnProperty.call(n, t) && ut(n[t]))
|
|
1172
1172
|
return !0;
|
|
1173
1173
|
return !1;
|
|
1174
1174
|
}
|
|
1175
|
-
function
|
|
1175
|
+
function Zn(n) {
|
|
1176
1176
|
const e = [], t = n.data, s = n;
|
|
1177
|
-
return s.data =
|
|
1177
|
+
return s.data = Nt(t, e), s.attachments = e.length, { packet: s, buffers: e };
|
|
1178
1178
|
}
|
|
1179
|
-
function
|
|
1179
|
+
function Nt(n, e) {
|
|
1180
1180
|
if (!n)
|
|
1181
1181
|
return n;
|
|
1182
|
-
if (
|
|
1182
|
+
if (ss(n)) {
|
|
1183
1183
|
const t = { _placeholder: !0, num: e.length };
|
|
1184
1184
|
return e.push(n), t;
|
|
1185
1185
|
} else if (Array.isArray(n)) {
|
|
1186
1186
|
const t = new Array(n.length);
|
|
1187
1187
|
for (let s = 0; s < n.length; s++)
|
|
1188
|
-
t[s] =
|
|
1188
|
+
t[s] = Nt(n[s], e);
|
|
1189
1189
|
return t;
|
|
1190
1190
|
} else if (typeof n == "object" && !(n instanceof Date)) {
|
|
1191
1191
|
const t = {};
|
|
1192
1192
|
for (const s in n)
|
|
1193
|
-
Object.prototype.hasOwnProperty.call(n, s) && (t[s] =
|
|
1193
|
+
Object.prototype.hasOwnProperty.call(n, s) && (t[s] = Nt(n[s], e));
|
|
1194
1194
|
return t;
|
|
1195
1195
|
}
|
|
1196
1196
|
return n;
|
|
1197
1197
|
}
|
|
1198
|
-
function
|
|
1199
|
-
return n.data =
|
|
1198
|
+
function er(n, e) {
|
|
1199
|
+
return n.data = Pt(n.data, e), delete n.attachments, n;
|
|
1200
1200
|
}
|
|
1201
|
-
function
|
|
1201
|
+
function Pt(n, e) {
|
|
1202
1202
|
if (!n)
|
|
1203
1203
|
return n;
|
|
1204
1204
|
if (n && n._placeholder === !0) {
|
|
@@ -1207,13 +1207,13 @@ function ft(n, e) {
|
|
|
1207
1207
|
throw new Error("illegal attachments");
|
|
1208
1208
|
} else if (Array.isArray(n))
|
|
1209
1209
|
for (let t = 0; t < n.length; t++)
|
|
1210
|
-
n[t] =
|
|
1210
|
+
n[t] = Pt(n[t], e);
|
|
1211
1211
|
else if (typeof n == "object")
|
|
1212
1212
|
for (const t in n)
|
|
1213
|
-
Object.prototype.hasOwnProperty.call(n, t) && (n[t] =
|
|
1213
|
+
Object.prototype.hasOwnProperty.call(n, t) && (n[t] = Pt(n[t], e));
|
|
1214
1214
|
return n;
|
|
1215
1215
|
}
|
|
1216
|
-
const
|
|
1216
|
+
const tr = [
|
|
1217
1217
|
"connect",
|
|
1218
1218
|
// used on the client side
|
|
1219
1219
|
"connect_error",
|
|
@@ -1227,11 +1227,11 @@ const Xn = [
|
|
|
1227
1227
|
"removeListener"
|
|
1228
1228
|
// used by the Node.js EventEmitter
|
|
1229
1229
|
];
|
|
1230
|
-
var
|
|
1230
|
+
var v;
|
|
1231
1231
|
(function(n) {
|
|
1232
1232
|
n[n.CONNECT = 0] = "CONNECT", n[n.DISCONNECT = 1] = "DISCONNECT", n[n.EVENT = 2] = "EVENT", n[n.ACK = 3] = "ACK", n[n.CONNECT_ERROR = 4] = "CONNECT_ERROR", n[n.BINARY_EVENT = 5] = "BINARY_EVENT", n[n.BINARY_ACK = 6] = "BINARY_ACK";
|
|
1233
|
-
})(
|
|
1234
|
-
class
|
|
1233
|
+
})(v || (v = {}));
|
|
1234
|
+
class sr {
|
|
1235
1235
|
/**
|
|
1236
1236
|
* Encoder constructor
|
|
1237
1237
|
*
|
|
@@ -1247,8 +1247,8 @@ class Qn {
|
|
|
1247
1247
|
* @param {Object} obj - packet object
|
|
1248
1248
|
*/
|
|
1249
1249
|
encode(e) {
|
|
1250
|
-
return (e.type ===
|
|
1251
|
-
type: e.type ===
|
|
1250
|
+
return (e.type === v.EVENT || e.type === v.ACK) && ut(e) ? this.encodeAsBinary({
|
|
1251
|
+
type: e.type === v.EVENT ? v.BINARY_EVENT : v.BINARY_ACK,
|
|
1252
1252
|
nsp: e.nsp,
|
|
1253
1253
|
data: e.data,
|
|
1254
1254
|
id: e.id
|
|
@@ -1259,7 +1259,7 @@ class Qn {
|
|
|
1259
1259
|
*/
|
|
1260
1260
|
encodeAsString(e) {
|
|
1261
1261
|
let t = "" + e.type;
|
|
1262
|
-
return (e.type ===
|
|
1262
|
+
return (e.type === v.BINARY_EVENT || e.type === v.BINARY_ACK) && (t += e.attachments + "-"), e.nsp && e.nsp !== "/" && (t += e.nsp + ","), e.id != null && (t += e.id), e.data != null && (t += JSON.stringify(e.data, this.replacer)), t;
|
|
1263
1263
|
}
|
|
1264
1264
|
/**
|
|
1265
1265
|
* Encode packet as 'buffer sequence' by removing blobs, and
|
|
@@ -1267,11 +1267,11 @@ class Qn {
|
|
|
1267
1267
|
* a list of buffers.
|
|
1268
1268
|
*/
|
|
1269
1269
|
encodeAsBinary(e) {
|
|
1270
|
-
const t =
|
|
1270
|
+
const t = Zn(e), s = this.encodeAsString(t.packet), r = t.buffers;
|
|
1271
1271
|
return r.unshift(s), r;
|
|
1272
1272
|
}
|
|
1273
1273
|
}
|
|
1274
|
-
class
|
|
1274
|
+
class ns extends C {
|
|
1275
1275
|
/**
|
|
1276
1276
|
* Decoder constructor
|
|
1277
1277
|
*/
|
|
@@ -1292,9 +1292,9 @@ class Ft extends O {
|
|
|
1292
1292
|
if (this.reconstructor)
|
|
1293
1293
|
throw new Error("got plaintext data when reconstructing a packet");
|
|
1294
1294
|
t = this.decodeString(e);
|
|
1295
|
-
const s = t.type ===
|
|
1296
|
-
s || t.type ===
|
|
1297
|
-
} else if (
|
|
1295
|
+
const s = t.type === v.BINARY_EVENT;
|
|
1296
|
+
s || t.type === v.BINARY_ACK ? (t.type = s ? v.EVENT : v.ACK, this.reconstructor = new nr(t), t.attachments === 0 && super.emitReserved("decoded", t)) : super.emitReserved("decoded", t);
|
|
1297
|
+
} else if (ss(e) || e.base64)
|
|
1298
1298
|
if (this.reconstructor)
|
|
1299
1299
|
t = this.reconstructor.takeBinaryData(e), t && (this.reconstructor = null, super.emitReserved("decoded", t));
|
|
1300
1300
|
else
|
|
@@ -1313,9 +1313,9 @@ class Ft extends O {
|
|
|
1313
1313
|
const s = {
|
|
1314
1314
|
type: Number(e.charAt(0))
|
|
1315
1315
|
};
|
|
1316
|
-
if (
|
|
1316
|
+
if (v[s.type] === void 0)
|
|
1317
1317
|
throw new Error("unknown packet type " + s.type);
|
|
1318
|
-
if (s.type ===
|
|
1318
|
+
if (s.type === v.BINARY_EVENT || s.type === v.BINARY_ACK) {
|
|
1319
1319
|
const i = t + 1;
|
|
1320
1320
|
for (; e.charAt(++t) !== "-" && t != e.length; )
|
|
1321
1321
|
;
|
|
@@ -1323,7 +1323,7 @@ class Ft extends O {
|
|
|
1323
1323
|
if (o != Number(o) || e.charAt(t) !== "-")
|
|
1324
1324
|
throw new Error("Illegal attachments");
|
|
1325
1325
|
const a = Number(o);
|
|
1326
|
-
if (!
|
|
1326
|
+
if (!rr(a) || a < 0)
|
|
1327
1327
|
throw new Error("Illegal attachments");
|
|
1328
1328
|
if (a > this.opts.maxAttachments)
|
|
1329
1329
|
throw new Error("too many attachments");
|
|
@@ -1352,7 +1352,7 @@ class Ft extends O {
|
|
|
1352
1352
|
}
|
|
1353
1353
|
if (e.charAt(++t)) {
|
|
1354
1354
|
const i = this.tryParse(e.substr(t));
|
|
1355
|
-
if (
|
|
1355
|
+
if (ns.isPayloadValid(s.type, i))
|
|
1356
1356
|
s.data = i;
|
|
1357
1357
|
else
|
|
1358
1358
|
throw new Error("invalid payload");
|
|
@@ -1368,17 +1368,17 @@ class Ft extends O {
|
|
|
1368
1368
|
}
|
|
1369
1369
|
static isPayloadValid(e, t) {
|
|
1370
1370
|
switch (e) {
|
|
1371
|
-
case
|
|
1372
|
-
return
|
|
1373
|
-
case
|
|
1371
|
+
case v.CONNECT:
|
|
1372
|
+
return us(t);
|
|
1373
|
+
case v.DISCONNECT:
|
|
1374
1374
|
return t === void 0;
|
|
1375
|
-
case
|
|
1376
|
-
return typeof t == "string" ||
|
|
1377
|
-
case
|
|
1378
|
-
case
|
|
1379
|
-
return Array.isArray(t) && (typeof t[0] == "number" || typeof t[0] == "string" &&
|
|
1380
|
-
case
|
|
1381
|
-
case
|
|
1375
|
+
case v.CONNECT_ERROR:
|
|
1376
|
+
return typeof t == "string" || us(t);
|
|
1377
|
+
case v.EVENT:
|
|
1378
|
+
case v.BINARY_EVENT:
|
|
1379
|
+
return Array.isArray(t) && (typeof t[0] == "number" || typeof t[0] == "string" && tr.indexOf(t[0]) === -1);
|
|
1380
|
+
case v.ACK:
|
|
1381
|
+
case v.BINARY_ACK:
|
|
1382
1382
|
return Array.isArray(t);
|
|
1383
1383
|
}
|
|
1384
1384
|
}
|
|
@@ -1389,7 +1389,7 @@ class Ft extends O {
|
|
|
1389
1389
|
this.reconstructor && (this.reconstructor.finishedReconstruction(), this.reconstructor = null);
|
|
1390
1390
|
}
|
|
1391
1391
|
}
|
|
1392
|
-
class
|
|
1392
|
+
class nr {
|
|
1393
1393
|
constructor(e) {
|
|
1394
1394
|
this.packet = e, this.buffers = [], this.reconPack = e;
|
|
1395
1395
|
}
|
|
@@ -1403,7 +1403,7 @@ class Zn {
|
|
|
1403
1403
|
*/
|
|
1404
1404
|
takeBinaryData(e) {
|
|
1405
1405
|
if (this.buffers.push(e), this.buffers.length === this.reconPack.attachments) {
|
|
1406
|
-
const t =
|
|
1406
|
+
const t = er(this.reconPack, this.buffers);
|
|
1407
1407
|
return this.finishedReconstruction(), t;
|
|
1408
1408
|
}
|
|
1409
1409
|
return null;
|
|
@@ -1415,26 +1415,26 @@ class Zn {
|
|
|
1415
1415
|
this.reconPack = null, this.buffers = [];
|
|
1416
1416
|
}
|
|
1417
1417
|
}
|
|
1418
|
-
const
|
|
1418
|
+
const rr = Number.isInteger || function(n) {
|
|
1419
1419
|
return typeof n == "number" && isFinite(n) && Math.floor(n) === n;
|
|
1420
1420
|
};
|
|
1421
|
-
function
|
|
1421
|
+
function us(n) {
|
|
1422
1422
|
return Object.prototype.toString.call(n) === "[object Object]";
|
|
1423
1423
|
}
|
|
1424
|
-
const
|
|
1424
|
+
const ir = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1425
1425
|
__proto__: null,
|
|
1426
|
-
Decoder:
|
|
1427
|
-
Encoder:
|
|
1426
|
+
Decoder: ns,
|
|
1427
|
+
Encoder: sr,
|
|
1428
1428
|
get PacketType() {
|
|
1429
|
-
return
|
|
1429
|
+
return v;
|
|
1430
1430
|
}
|
|
1431
1431
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1432
|
-
function
|
|
1432
|
+
function Y(n, e, t) {
|
|
1433
1433
|
return n.on(e, t), function() {
|
|
1434
1434
|
n.off(e, t);
|
|
1435
1435
|
};
|
|
1436
1436
|
}
|
|
1437
|
-
const
|
|
1437
|
+
const or = Object.freeze({
|
|
1438
1438
|
connect: 1,
|
|
1439
1439
|
connect_error: 1,
|
|
1440
1440
|
disconnect: 1,
|
|
@@ -1443,7 +1443,7 @@ const sr = Object.freeze({
|
|
|
1443
1443
|
newListener: 1,
|
|
1444
1444
|
removeListener: 1
|
|
1445
1445
|
});
|
|
1446
|
-
class
|
|
1446
|
+
class Ms extends C {
|
|
1447
1447
|
/**
|
|
1448
1448
|
* `Socket` constructor.
|
|
1449
1449
|
*/
|
|
@@ -1477,10 +1477,10 @@ class Ss extends O {
|
|
|
1477
1477
|
return;
|
|
1478
1478
|
const e = this.io;
|
|
1479
1479
|
this.subs = [
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1480
|
+
Y(e, "open", this.onopen.bind(this)),
|
|
1481
|
+
Y(e, "packet", this.onpacket.bind(this)),
|
|
1482
|
+
Y(e, "error", this.onerror.bind(this)),
|
|
1483
|
+
Y(e, "close", this.onclose.bind(this))
|
|
1484
1484
|
];
|
|
1485
1485
|
}
|
|
1486
1486
|
/**
|
|
@@ -1559,12 +1559,12 @@ class Ss extends O {
|
|
|
1559
1559
|
*/
|
|
1560
1560
|
emit(e, ...t) {
|
|
1561
1561
|
var s, r, i;
|
|
1562
|
-
if (
|
|
1562
|
+
if (or.hasOwnProperty(e))
|
|
1563
1563
|
throw new Error('"' + e.toString() + '" is a reserved event name');
|
|
1564
1564
|
if (t.unshift(e), this._opts.retries && !this.flags.fromQueue && !this.flags.volatile)
|
|
1565
1565
|
return this._addToQueue(t), this;
|
|
1566
1566
|
const o = {
|
|
1567
|
-
type:
|
|
1567
|
+
type: v.EVENT,
|
|
1568
1568
|
data: t
|
|
1569
1569
|
};
|
|
1570
1570
|
if (o.options = {}, o.options.compress = this.flags.compress !== !1, typeof t[t.length - 1] == "function") {
|
|
@@ -1672,7 +1672,7 @@ class Ss extends O {
|
|
|
1672
1672
|
*/
|
|
1673
1673
|
_sendConnectPacket(e) {
|
|
1674
1674
|
this.packet({
|
|
1675
|
-
type:
|
|
1675
|
+
type: v.CONNECT,
|
|
1676
1676
|
data: this._pid ? Object.assign({ pid: this._pid, offset: this._lastOffset }, e) : e
|
|
1677
1677
|
});
|
|
1678
1678
|
}
|
|
@@ -1718,21 +1718,21 @@ class Ss extends O {
|
|
|
1718
1718
|
onpacket(e) {
|
|
1719
1719
|
if (e.nsp === this.nsp)
|
|
1720
1720
|
switch (e.type) {
|
|
1721
|
-
case
|
|
1721
|
+
case v.CONNECT:
|
|
1722
1722
|
e.data && e.data.sid ? this.onconnect(e.data.sid, e.data.pid) : this.emitReserved("connect_error", new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));
|
|
1723
1723
|
break;
|
|
1724
|
-
case
|
|
1725
|
-
case
|
|
1724
|
+
case v.EVENT:
|
|
1725
|
+
case v.BINARY_EVENT:
|
|
1726
1726
|
this.onevent(e);
|
|
1727
1727
|
break;
|
|
1728
|
-
case
|
|
1729
|
-
case
|
|
1728
|
+
case v.ACK:
|
|
1729
|
+
case v.BINARY_ACK:
|
|
1730
1730
|
this.onack(e);
|
|
1731
1731
|
break;
|
|
1732
|
-
case
|
|
1732
|
+
case v.DISCONNECT:
|
|
1733
1733
|
this.ondisconnect();
|
|
1734
1734
|
break;
|
|
1735
|
-
case
|
|
1735
|
+
case v.CONNECT_ERROR:
|
|
1736
1736
|
this.destroy();
|
|
1737
1737
|
const s = new Error(e.data.message);
|
|
1738
1738
|
s.data = e.data.data, this.emitReserved("connect_error", s);
|
|
@@ -1767,7 +1767,7 @@ class Ss extends O {
|
|
|
1767
1767
|
let s = !1;
|
|
1768
1768
|
return function(...r) {
|
|
1769
1769
|
s || (s = !0, t.packet({
|
|
1770
|
-
type:
|
|
1770
|
+
type: v.ACK,
|
|
1771
1771
|
id: e,
|
|
1772
1772
|
data: r
|
|
1773
1773
|
}));
|
|
@@ -1836,7 +1836,7 @@ class Ss extends O {
|
|
|
1836
1836
|
* @return self
|
|
1837
1837
|
*/
|
|
1838
1838
|
disconnect() {
|
|
1839
|
-
return this.connected && this.packet({ type:
|
|
1839
|
+
return this.connected && this.packet({ type: v.DISCONNECT }), this.destroy(), this.connected && this.onclose("io client disconnect"), this;
|
|
1840
1840
|
}
|
|
1841
1841
|
/**
|
|
1842
1842
|
* Alias for {@link disconnect()}.
|
|
@@ -2035,10 +2035,10 @@ class Ss extends O {
|
|
|
2035
2035
|
}
|
|
2036
2036
|
}
|
|
2037
2037
|
}
|
|
2038
|
-
function
|
|
2038
|
+
function Le(n) {
|
|
2039
2039
|
n = n || {}, this.ms = n.min || 100, this.max = n.max || 1e4, this.factor = n.factor || 2, this.jitter = n.jitter > 0 && n.jitter <= 1 ? n.jitter : 0, this.attempts = 0;
|
|
2040
2040
|
}
|
|
2041
|
-
|
|
2041
|
+
Le.prototype.duration = function() {
|
|
2042
2042
|
var n = this.ms * Math.pow(this.factor, this.attempts++);
|
|
2043
2043
|
if (this.jitter) {
|
|
2044
2044
|
var e = Math.random(), t = Math.floor(e * this.jitter * n);
|
|
@@ -2046,27 +2046,27 @@ ke.prototype.duration = function() {
|
|
|
2046
2046
|
}
|
|
2047
2047
|
return Math.min(n, this.max) | 0;
|
|
2048
2048
|
};
|
|
2049
|
-
|
|
2049
|
+
Le.prototype.reset = function() {
|
|
2050
2050
|
this.attempts = 0;
|
|
2051
2051
|
};
|
|
2052
|
-
|
|
2052
|
+
Le.prototype.setMin = function(n) {
|
|
2053
2053
|
this.ms = n;
|
|
2054
2054
|
};
|
|
2055
|
-
|
|
2055
|
+
Le.prototype.setMax = function(n) {
|
|
2056
2056
|
this.max = n;
|
|
2057
2057
|
};
|
|
2058
|
-
|
|
2058
|
+
Le.prototype.setJitter = function(n) {
|
|
2059
2059
|
this.jitter = n;
|
|
2060
2060
|
};
|
|
2061
|
-
class
|
|
2061
|
+
class Bt extends C {
|
|
2062
2062
|
constructor(e, t) {
|
|
2063
2063
|
var s;
|
|
2064
|
-
super(), this.nsps = {}, this.subs = [], e && typeof e == "object" && (t = e, e = void 0), t = t || {}, t.path = t.path || "/socket.io", this.opts = t,
|
|
2064
|
+
super(), this.nsps = {}, this.subs = [], e && typeof e == "object" && (t = e, e = void 0), t = t || {}, t.path = t.path || "/socket.io", this.opts = t, Et(this, t), this.reconnection(t.reconnection !== !1), this.reconnectionAttempts(t.reconnectionAttempts || 1 / 0), this.reconnectionDelay(t.reconnectionDelay || 1e3), this.reconnectionDelayMax(t.reconnectionDelayMax || 5e3), this.randomizationFactor((s = t.randomizationFactor) !== null && s !== void 0 ? s : 0.5), this.backoff = new Le({
|
|
2065
2065
|
min: this.reconnectionDelay(),
|
|
2066
2066
|
max: this.reconnectionDelayMax(),
|
|
2067
2067
|
jitter: this.randomizationFactor()
|
|
2068
2068
|
}), this.timeout(t.timeout == null ? 2e4 : t.timeout), this._readyState = "closed", this.uri = e;
|
|
2069
|
-
const r = t.parser ||
|
|
2069
|
+
const r = t.parser || ir;
|
|
2070
2070
|
this.encoder = new r.Encoder(), this.decoder = new r.Decoder(), this._autoConnect = t.autoConnect !== !1, this._autoConnect && this.open();
|
|
2071
2071
|
}
|
|
2072
2072
|
reconnection(e) {
|
|
@@ -2109,14 +2109,14 @@ class pt extends O {
|
|
|
2109
2109
|
open(e) {
|
|
2110
2110
|
if (~this._readyState.indexOf("open"))
|
|
2111
2111
|
return this;
|
|
2112
|
-
this.engine = new
|
|
2112
|
+
this.engine = new Wn(this.uri, this.opts);
|
|
2113
2113
|
const t = this.engine, s = this;
|
|
2114
2114
|
this._readyState = "opening", this.skipReconnect = !1;
|
|
2115
|
-
const r =
|
|
2115
|
+
const r = Y(t, "open", function() {
|
|
2116
2116
|
s.onopen(), e && e();
|
|
2117
2117
|
}), i = (a) => {
|
|
2118
2118
|
this.cleanup(), this._readyState = "closed", this.emitReserved("error", a), e ? e(a) : this.maybeReconnectOnOpen();
|
|
2119
|
-
}, o =
|
|
2119
|
+
}, o = Y(t, "error", i);
|
|
2120
2120
|
if (this._timeout !== !1) {
|
|
2121
2121
|
const a = this._timeout, l = this.setTimeoutFn(() => {
|
|
2122
2122
|
r(), i(new Error("timeout")), t.close();
|
|
@@ -2145,12 +2145,12 @@ class pt extends O {
|
|
|
2145
2145
|
this.cleanup(), this._readyState = "open", this.emitReserved("open");
|
|
2146
2146
|
const e = this.engine;
|
|
2147
2147
|
this.subs.push(
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2148
|
+
Y(e, "ping", this.onping.bind(this)),
|
|
2149
|
+
Y(e, "data", this.ondata.bind(this)),
|
|
2150
|
+
Y(e, "error", this.onerror.bind(this)),
|
|
2151
|
+
Y(e, "close", this.onclose.bind(this)),
|
|
2152
2152
|
// @ts-ignore
|
|
2153
|
-
|
|
2153
|
+
Y(this.decoder, "decoded", this.ondecoded.bind(this))
|
|
2154
2154
|
);
|
|
2155
2155
|
}
|
|
2156
2156
|
/**
|
|
@@ -2179,7 +2179,7 @@ class pt extends O {
|
|
|
2179
2179
|
* @private
|
|
2180
2180
|
*/
|
|
2181
2181
|
ondecoded(e) {
|
|
2182
|
-
|
|
2182
|
+
vt(() => {
|
|
2183
2183
|
this.emitReserved("packet", e);
|
|
2184
2184
|
}, this.setTimeoutFn);
|
|
2185
2185
|
}
|
|
@@ -2199,7 +2199,7 @@ class pt extends O {
|
|
|
2199
2199
|
*/
|
|
2200
2200
|
socket(e, t) {
|
|
2201
2201
|
let s = this.nsps[e];
|
|
2202
|
-
return s ? this._autoConnect && !s.active && s.connect() : (s = new
|
|
2202
|
+
return s ? this._autoConnect && !s.active && s.connect() : (s = new Ms(this, e, t), this.nsps[e] = s), s;
|
|
2203
2203
|
}
|
|
2204
2204
|
/**
|
|
2205
2205
|
* Called upon a socket close.
|
|
@@ -2296,20 +2296,20 @@ class pt extends O {
|
|
|
2296
2296
|
this._reconnecting = !1, this.backoff.reset(), this.emitReserved("reconnect", e);
|
|
2297
2297
|
}
|
|
2298
2298
|
}
|
|
2299
|
-
const
|
|
2300
|
-
function
|
|
2299
|
+
const Ge = {};
|
|
2300
|
+
function Ke(n, e) {
|
|
2301
2301
|
typeof n == "object" && (e = n, n = void 0), e = e || {};
|
|
2302
|
-
const t =
|
|
2302
|
+
const t = Yn(n, e.path || "/socket.io"), s = t.source, r = t.id, i = t.path, o = Ge[r] && i in Ge[r].nsps, a = e.forceNew || e["force new connection"] || e.multiplex === !1 || o;
|
|
2303
2303
|
let l;
|
|
2304
|
-
return a ? l = new
|
|
2304
|
+
return a ? l = new Bt(s, e) : (Ge[r] || (Ge[r] = new Bt(s, e)), l = Ge[r]), t.query && !e.query && (e.query = t.queryKey), l.socket(t.path, e);
|
|
2305
2305
|
}
|
|
2306
|
-
Object.assign(
|
|
2307
|
-
Manager:
|
|
2308
|
-
Socket:
|
|
2309
|
-
io:
|
|
2310
|
-
connect:
|
|
2306
|
+
Object.assign(Ke, {
|
|
2307
|
+
Manager: Bt,
|
|
2308
|
+
Socket: Ms,
|
|
2309
|
+
io: Ke,
|
|
2310
|
+
connect: Ke
|
|
2311
2311
|
});
|
|
2312
|
-
const
|
|
2312
|
+
const bt = "thatopen/document@1", fs = "document.json", ar = [
|
|
2313
2313
|
"pdf",
|
|
2314
2314
|
"txt",
|
|
2315
2315
|
"md",
|
|
@@ -2317,14 +2317,14 @@ const Xe = "thatopen/document@1", zt = "document.json", nr = [
|
|
|
2317
2317
|
"csv",
|
|
2318
2318
|
"tsv",
|
|
2319
2319
|
"frag"
|
|
2320
|
-
],
|
|
2321
|
-
function
|
|
2320
|
+
], ps = () => `v-${Date.now()}`;
|
|
2321
|
+
function at(n) {
|
|
2322
2322
|
return String(n._id ?? n.id ?? "");
|
|
2323
2323
|
}
|
|
2324
|
-
var
|
|
2325
|
-
class
|
|
2324
|
+
var ke, Hs, Ft;
|
|
2325
|
+
class Vs {
|
|
2326
2326
|
constructor(e, t) {
|
|
2327
|
-
|
|
2327
|
+
S(this, ke);
|
|
2328
2328
|
this.client = e, this.projectId = t;
|
|
2329
2329
|
}
|
|
2330
2330
|
/**
|
|
@@ -2339,7 +2339,7 @@ class ks {
|
|
|
2339
2339
|
});
|
|
2340
2340
|
return (await Promise.all(
|
|
2341
2341
|
e.map(async (s) => {
|
|
2342
|
-
const r =
|
|
2342
|
+
const r = at(s), i = await this.descriptor(r);
|
|
2343
2343
|
return i ? { folderId: r, descriptor: i } : null;
|
|
2344
2344
|
})
|
|
2345
2345
|
)).filter((s) => s !== null);
|
|
@@ -2357,37 +2357,37 @@ class ks {
|
|
|
2357
2357
|
* document is born ready to visualize and the link concept retires.
|
|
2358
2358
|
*/
|
|
2359
2359
|
async fromFile(e, t) {
|
|
2360
|
-
const s = await this.client.getFile(e), r = String(s.name ?? ""), i =
|
|
2360
|
+
const s = await this.client.getFile(e), r = String(s.name ?? ""), i = ms(r, s.fileExtension), o = (t == null ? void 0 : t.name) ?? r.replace(/\.[^.]+$/, "") ?? r, a = await this.client.createFolder(
|
|
2361
2361
|
o,
|
|
2362
2362
|
s.folderId ? String(s.folderId) : void 0,
|
|
2363
2363
|
this.projectId
|
|
2364
|
-
), l =
|
|
2364
|
+
), l = at(a);
|
|
2365
2365
|
await this.client.updateFile(e, { parentFolderId: l });
|
|
2366
|
-
const
|
|
2366
|
+
const d = [], c = await h(this, ke, Hs).call(this, s);
|
|
2367
2367
|
if (c)
|
|
2368
2368
|
try {
|
|
2369
|
-
const
|
|
2370
|
-
await this.client.updateFile(c, { parentFolderId: l }),
|
|
2369
|
+
const A = await this.client.getFile(c);
|
|
2370
|
+
await this.client.updateFile(c, { parentFolderId: l }), d.push({
|
|
2371
2371
|
fileId: c,
|
|
2372
|
-
format:
|
|
2372
|
+
format: ms(String(A.name ?? ""), A.fileExtension)
|
|
2373
2373
|
});
|
|
2374
2374
|
} catch {
|
|
2375
2375
|
}
|
|
2376
|
-
((t == null ? void 0 : t.selfView) ??
|
|
2377
|
-
const
|
|
2378
|
-
schema:
|
|
2376
|
+
((t == null ? void 0 : t.selfView) ?? ar.includes(i)) && d.push({ fileId: e, format: i });
|
|
2377
|
+
const T = {
|
|
2378
|
+
schema: bt,
|
|
2379
2379
|
name: o,
|
|
2380
2380
|
native: { fileId: e, format: i },
|
|
2381
|
-
views:
|
|
2381
|
+
views: d
|
|
2382
2382
|
};
|
|
2383
|
-
return await this.setDescriptor(l,
|
|
2383
|
+
return await this.setDescriptor(l, T), { folderId: l, descriptor: T };
|
|
2384
2384
|
}
|
|
2385
2385
|
/**
|
|
2386
2386
|
* The document's descriptor, read and validated, or null when the folder
|
|
2387
2387
|
* has none yet (an old folder, or a plain folder that is not a document).
|
|
2388
2388
|
*/
|
|
2389
2389
|
async descriptor(e) {
|
|
2390
|
-
const t = await h(this,
|
|
2390
|
+
const t = await h(this, ke, Ft).call(this, e);
|
|
2391
2391
|
if (!t) return null;
|
|
2392
2392
|
const r = await (await this.client.downloadFile(t.id)).text();
|
|
2393
2393
|
if (!r.trim()) return null;
|
|
@@ -2397,7 +2397,7 @@ class ks {
|
|
|
2397
2397
|
} catch {
|
|
2398
2398
|
return null;
|
|
2399
2399
|
}
|
|
2400
|
-
return
|
|
2400
|
+
return cr(i);
|
|
2401
2401
|
}
|
|
2402
2402
|
/**
|
|
2403
2403
|
* The first view whose format appears in `formats` — searched in the ORDER
|
|
@@ -2435,110 +2435,116 @@ class ks {
|
|
|
2435
2435
|
async setDescriptor(e, t) {
|
|
2436
2436
|
const s = {
|
|
2437
2437
|
...t,
|
|
2438
|
-
schema:
|
|
2438
|
+
schema: bt,
|
|
2439
2439
|
views: t.views ?? []
|
|
2440
2440
|
}, r = new Blob([JSON.stringify(s)], {
|
|
2441
2441
|
type: "application/json"
|
|
2442
|
-
}), i = await h(this,
|
|
2442
|
+
}), i = await h(this, ke, Ft).call(this, e);
|
|
2443
2443
|
if (i) {
|
|
2444
2444
|
await this.client.updateFile(i.id, {
|
|
2445
2445
|
file: r,
|
|
2446
|
-
versionTag:
|
|
2446
|
+
versionTag: ps()
|
|
2447
2447
|
});
|
|
2448
2448
|
return;
|
|
2449
2449
|
}
|
|
2450
2450
|
await this.client.createFile({
|
|
2451
2451
|
file: r,
|
|
2452
|
-
name:
|
|
2453
|
-
versionTag:
|
|
2452
|
+
name: fs,
|
|
2453
|
+
versionTag: ps(),
|
|
2454
2454
|
parentFolderId: e,
|
|
2455
2455
|
projectId: this.projectId
|
|
2456
2456
|
});
|
|
2457
2457
|
}
|
|
2458
2458
|
}
|
|
2459
|
-
|
|
2459
|
+
ke = new WeakSet(), Hs = async function(e) {
|
|
2460
2460
|
const t = [...e.versions ?? []].sort(
|
|
2461
2461
|
(s, r) => String(r.createdAt ?? "").localeCompare(String(s.createdAt ?? ""))
|
|
2462
2462
|
);
|
|
2463
2463
|
for (const s of t)
|
|
2464
2464
|
try {
|
|
2465
2465
|
const r = await this.client.getFileVersionMetadata(
|
|
2466
|
-
|
|
2466
|
+
at(e),
|
|
2467
2467
|
s.tag
|
|
2468
2468
|
), i = r == null ? void 0 : r.derivedFileId;
|
|
2469
2469
|
if (typeof i == "string" && i) return i;
|
|
2470
2470
|
} catch {
|
|
2471
2471
|
}
|
|
2472
|
-
},
|
|
2472
|
+
}, Ft = async function(e) {
|
|
2473
2473
|
const s = (await this.client.listFiles({ folderId: e })).find(
|
|
2474
|
-
(r) => String(r.name ?? "") ===
|
|
2474
|
+
(r) => String(r.name ?? "") === fs
|
|
2475
2475
|
);
|
|
2476
|
-
return s ? { id:
|
|
2476
|
+
return s ? { id: at(s) } : void 0;
|
|
2477
2477
|
};
|
|
2478
|
-
function
|
|
2478
|
+
function ms(n, e) {
|
|
2479
2479
|
const t = (e ?? "").replace(/^\./, "").toLowerCase();
|
|
2480
2480
|
if (t) return t;
|
|
2481
2481
|
const s = n.lastIndexOf(".");
|
|
2482
2482
|
return s > 0 ? n.slice(s + 1).toLowerCase() : "";
|
|
2483
2483
|
}
|
|
2484
|
-
function
|
|
2484
|
+
function cr(n) {
|
|
2485
2485
|
if (!n || typeof n != "object") return null;
|
|
2486
2486
|
const e = n;
|
|
2487
|
-
if (e.schema !==
|
|
2487
|
+
if (e.schema !== bt || typeof e.name != "string") return null;
|
|
2488
2488
|
const t = Array.isArray(e.views) ? e.views.filter(
|
|
2489
2489
|
(i) => !!i && typeof i == "object" && typeof i.fileId == "string" && typeof i.format == "string"
|
|
2490
2490
|
) : [], s = e.native, r = !!s && typeof s == "object" && typeof s.fileId == "string" && typeof s.format == "string";
|
|
2491
2491
|
return {
|
|
2492
|
-
schema:
|
|
2492
|
+
schema: bt,
|
|
2493
2493
|
name: e.name,
|
|
2494
2494
|
...r ? { native: { fileId: s.fileId, format: s.format } } : {},
|
|
2495
2495
|
views: t
|
|
2496
2496
|
};
|
|
2497
2497
|
}
|
|
2498
|
-
class
|
|
2498
|
+
class ys extends Error {
|
|
2499
2499
|
constructor(e, t) {
|
|
2500
2500
|
super(
|
|
2501
2501
|
`The document history advanced while this version was being prepared: expected head ${e}, found ${t ?? "none"}. Read the timeline again and rebuild on the new head.`
|
|
2502
2502
|
), this.expectedGuid = e, this.actualGuid = t, this.name = "StaleHistoryError";
|
|
2503
2503
|
}
|
|
2504
2504
|
}
|
|
2505
|
-
const
|
|
2506
|
-
function
|
|
2505
|
+
const gs = "bimterop", Lt = "revitflow_history.json", Re = "revitflow_ops.json", ws = "revitflow/ops@1", Gs = "revitflow_model.frag", Js = "revitflow_", hr = "bimterop-locks-anchor", ct = () => `v-${Date.now()}`;
|
|
2506
|
+
function Ws(n, e) {
|
|
2507
2507
|
return n.filter((t) => String(t.parentId ?? "") === e);
|
|
2508
2508
|
}
|
|
2509
|
-
function
|
|
2509
|
+
function bs(n) {
|
|
2510
|
+
const e = n == null ? void 0 : n.hiddenFileId;
|
|
2511
|
+
if (typeof e != "string" || !e)
|
|
2512
|
+
throw new Error("The hidden-file upload answered without a hiddenFileId.");
|
|
2513
|
+
return e;
|
|
2514
|
+
}
|
|
2515
|
+
function te(n) {
|
|
2510
2516
|
return String(n._id ?? n.id ?? "");
|
|
2511
2517
|
}
|
|
2512
|
-
var
|
|
2513
|
-
class
|
|
2518
|
+
var W, Xe, Dt;
|
|
2519
|
+
class lr {
|
|
2514
2520
|
constructor(e, t) {
|
|
2515
|
-
|
|
2516
|
-
|
|
2521
|
+
S(this, Xe);
|
|
2522
|
+
S(this, W);
|
|
2517
2523
|
this.client = e, this.projectId = t;
|
|
2518
2524
|
}
|
|
2519
2525
|
/** The project's connected documents. */
|
|
2520
2526
|
async docs() {
|
|
2521
|
-
const e = await h(this,
|
|
2527
|
+
const e = await h(this, Xe, Dt).call(this);
|
|
2522
2528
|
if (!e) return [];
|
|
2523
2529
|
const t = await this.client.listFolders({
|
|
2524
2530
|
parentFolderId: e,
|
|
2525
2531
|
projectId: this.projectId
|
|
2526
2532
|
}), s = [];
|
|
2527
|
-
for (const r of
|
|
2533
|
+
for (const r of Ws(t, e)) {
|
|
2528
2534
|
const i = String(r.name ?? ""), o = i.indexOf("-");
|
|
2529
2535
|
if (o <= 0) continue;
|
|
2530
2536
|
const l = (await this.client.listFiles({
|
|
2531
|
-
folderId:
|
|
2537
|
+
folderId: te(r)
|
|
2532
2538
|
})).map(
|
|
2533
2539
|
(m) => String(m.name ?? "")
|
|
2534
|
-
),
|
|
2535
|
-
(m) => m.endsWith(".frag") && !m.startsWith(
|
|
2536
|
-
), c = l.includes(
|
|
2540
|
+
), d = l.find((m) => m === Gs) ?? l.find(
|
|
2541
|
+
(m) => m.endsWith(".frag") && !m.startsWith(Js)
|
|
2542
|
+
), c = l.includes(Lt) || l.includes(Re) || !!d;
|
|
2537
2543
|
s.push({
|
|
2538
2544
|
source: i.slice(0, o),
|
|
2539
2545
|
docId: i.slice(o + 1),
|
|
2540
|
-
folderId:
|
|
2541
|
-
modelName:
|
|
2546
|
+
folderId: te(r),
|
|
2547
|
+
modelName: d,
|
|
2542
2548
|
...c ? {} : { empty: !0 }
|
|
2543
2549
|
});
|
|
2544
2550
|
}
|
|
@@ -2546,36 +2552,36 @@ class or {
|
|
|
2546
2552
|
}
|
|
2547
2553
|
/** One document's history. `source` and `docId` as {@link docs} lists them. */
|
|
2548
2554
|
doc(e, t) {
|
|
2549
|
-
return new
|
|
2555
|
+
return new dr(this.client, this, e, t);
|
|
2550
2556
|
}
|
|
2551
2557
|
/** @internal The `bimterop` folder id, resolved once. */
|
|
2552
2558
|
async rootFolderId(e = !1) {
|
|
2553
|
-
if (
|
|
2554
|
-
const t = await h(this,
|
|
2559
|
+
if (u(this, W)) return u(this, W);
|
|
2560
|
+
const t = await h(this, Xe, Dt).call(this);
|
|
2555
2561
|
if (t) return t;
|
|
2556
2562
|
if (!e) return;
|
|
2557
2563
|
const s = await this.client.createFolder(
|
|
2558
|
-
|
|
2564
|
+
gs,
|
|
2559
2565
|
void 0,
|
|
2560
2566
|
this.projectId
|
|
2561
2567
|
);
|
|
2562
|
-
return
|
|
2568
|
+
return R(this, W, te(s)), u(this, W);
|
|
2563
2569
|
}
|
|
2564
2570
|
}
|
|
2565
|
-
|
|
2566
|
-
if (
|
|
2571
|
+
W = new WeakMap(), Xe = new WeakSet(), Dt = async function() {
|
|
2572
|
+
if (u(this, W)) return u(this, W);
|
|
2567
2573
|
const t = (await this.client.listFolders({
|
|
2568
2574
|
projectId: this.projectId
|
|
2569
2575
|
})).find(
|
|
2570
|
-
(s) => String(s.name ?? "") ===
|
|
2576
|
+
(s) => String(s.name ?? "") === gs && !s.parentId
|
|
2571
2577
|
);
|
|
2572
|
-
return t &&
|
|
2578
|
+
return t && R(this, W, te(t)), u(this, W);
|
|
2573
2579
|
};
|
|
2574
|
-
var
|
|
2575
|
-
class
|
|
2580
|
+
var oe, p, ie, Ce, ee, qt, We, de, jt, ft, Ye, pt, Ut, Ys;
|
|
2581
|
+
class dr {
|
|
2576
2582
|
constructor(e, t, s, r) {
|
|
2577
|
-
|
|
2578
|
-
|
|
2583
|
+
S(this, p);
|
|
2584
|
+
S(this, oe);
|
|
2579
2585
|
this.client = e, this.project = t, this.source = s, this.docId = r;
|
|
2580
2586
|
}
|
|
2581
2587
|
// ─── Reading ───────────────────────────────────────────────────────────────
|
|
@@ -2585,8 +2591,8 @@ class ar {
|
|
|
2585
2591
|
* Each version gets its `ordinal` filled in.
|
|
2586
2592
|
*/
|
|
2587
2593
|
async timeline() {
|
|
2588
|
-
const e = await h(this, p,
|
|
2589
|
-
return
|
|
2594
|
+
const e = await h(this, p, ft).call(this);
|
|
2595
|
+
return zs((e == null ? void 0 : e.commits) ?? []);
|
|
2590
2596
|
}
|
|
2591
2597
|
/** The head of the timeline, or null before the first sync. */
|
|
2592
2598
|
async latest() {
|
|
@@ -2612,7 +2618,7 @@ class ar {
|
|
|
2612
2618
|
* {@link modelParts} and compose.
|
|
2613
2619
|
*/
|
|
2614
2620
|
async model() {
|
|
2615
|
-
const e = await h(this, p,
|
|
2621
|
+
const e = await h(this, p, de).call(this);
|
|
2616
2622
|
if (!e)
|
|
2617
2623
|
throw new Error(
|
|
2618
2624
|
`Document ${this.source}-${this.docId} has no model file yet.`
|
|
@@ -2654,12 +2660,12 @@ class ar {
|
|
|
2654
2660
|
i = c;
|
|
2655
2661
|
break;
|
|
2656
2662
|
}
|
|
2657
|
-
const o = await h(this, p,
|
|
2663
|
+
const o = await h(this, p, de).call(this);
|
|
2658
2664
|
if (!o)
|
|
2659
2665
|
throw new Error(
|
|
2660
2666
|
`Document ${this.source}-${this.docId} has no model file yet.`
|
|
2661
2667
|
);
|
|
2662
|
-
const a = t[i], l = t.slice(r + 1).some((c) => c.full),
|
|
2668
|
+
const a = t[i], l = t.slice(r + 1).some((c) => c.full), d = t.slice(i + 1, r + 1).map((c) => ({
|
|
2663
2669
|
guid: c.guid,
|
|
2664
2670
|
...c.deltaId ? { deltaId: c.deltaId } : {},
|
|
2665
2671
|
removedUniqueIds: c.changes.filter((m) => m.type === "delete").map((m) => m.uniqueId)
|
|
@@ -2671,13 +2677,13 @@ class ar {
|
|
|
2671
2677
|
current: !l,
|
|
2672
2678
|
...a.version !== void 0 ? { storageVersion: a.version } : {}
|
|
2673
2679
|
},
|
|
2674
|
-
steps:
|
|
2680
|
+
steps: d,
|
|
2675
2681
|
at: t[r].guid
|
|
2676
2682
|
};
|
|
2677
2683
|
}
|
|
2678
2684
|
/** The document folder's item id — the id the CDE knows this document by. */
|
|
2679
2685
|
async folderId() {
|
|
2680
|
-
return await h(this, p,
|
|
2686
|
+
return await h(this, p, ee).call(this, !1);
|
|
2681
2687
|
}
|
|
2682
2688
|
// ─── The document descriptor ───────────────────────────────────────────────
|
|
2683
2689
|
/**
|
|
@@ -2685,7 +2691,7 @@ class ar {
|
|
|
2685
2691
|
* not carry one yet — an old folder from before descriptors existed.
|
|
2686
2692
|
*/
|
|
2687
2693
|
async descriptor() {
|
|
2688
|
-
return await
|
|
2694
|
+
return await u(this, p, ie).descriptor(await h(this, p, ee).call(this, !1));
|
|
2689
2695
|
}
|
|
2690
2696
|
/**
|
|
2691
2697
|
* The first view whose format appears in `formats`, searched in the order
|
|
@@ -2693,7 +2699,7 @@ class ar {
|
|
|
2693
2699
|
* model .frag on a descriptor-less folder, so old documents keep viewing.
|
|
2694
2700
|
*/
|
|
2695
2701
|
async view(e) {
|
|
2696
|
-
const t = await h(this, p,
|
|
2702
|
+
const t = await h(this, p, ee).call(this, !1), s = await u(this, p, ie).descriptor(t);
|
|
2697
2703
|
if (s) {
|
|
2698
2704
|
for (const i of e) {
|
|
2699
2705
|
const o = s.views.find((a) => a.format === i);
|
|
@@ -2702,7 +2708,7 @@ class ar {
|
|
|
2702
2708
|
return null;
|
|
2703
2709
|
}
|
|
2704
2710
|
if (!e.includes("frag")) return null;
|
|
2705
|
-
const r = await h(this, p,
|
|
2711
|
+
const r = await h(this, p, de).call(this);
|
|
2706
2712
|
return r ? { fileId: r.id, format: "frag" } : null;
|
|
2707
2713
|
}
|
|
2708
2714
|
/**
|
|
@@ -2711,14 +2717,14 @@ class ar {
|
|
|
2711
2717
|
* One view per format: a same-format view is replaced, not accumulated.
|
|
2712
2718
|
*/
|
|
2713
2719
|
async addView(e) {
|
|
2714
|
-
const t = await h(this, p,
|
|
2715
|
-
if (await
|
|
2716
|
-
await
|
|
2720
|
+
const t = await h(this, p, ee).call(this, !0);
|
|
2721
|
+
if (await u(this, p, ie).descriptor(t)) {
|
|
2722
|
+
await u(this, p, ie).addView(t, e);
|
|
2717
2723
|
return;
|
|
2718
2724
|
}
|
|
2719
|
-
const r = await h(this, p,
|
|
2720
|
-
await
|
|
2721
|
-
name: (r == null ? void 0 : r.name.replace(/\.frag$/, "")) ??
|
|
2725
|
+
const r = await h(this, p, de).call(this);
|
|
2726
|
+
await u(this, p, ie).setDescriptor(t, {
|
|
2727
|
+
name: (r == null ? void 0 : r.name.replace(/\.frag$/, "")) ?? u(this, p, Ce),
|
|
2722
2728
|
views: [e]
|
|
2723
2729
|
});
|
|
2724
2730
|
}
|
|
@@ -2731,15 +2737,15 @@ class ar {
|
|
|
2731
2737
|
* model file).
|
|
2732
2738
|
*/
|
|
2733
2739
|
async ensureDescriptor() {
|
|
2734
|
-
const e = await h(this, p,
|
|
2740
|
+
const e = await h(this, p, ee).call(this, !1), t = await u(this, p, ie).descriptor(e);
|
|
2735
2741
|
if (t) return t;
|
|
2736
|
-
const s = await h(this, p,
|
|
2742
|
+
const s = await h(this, p, de).call(this);
|
|
2737
2743
|
if (!s) return null;
|
|
2738
2744
|
const r = {
|
|
2739
2745
|
name: s.name.replace(/\.frag$/, ""),
|
|
2740
2746
|
views: [{ fileId: s.id, format: "frag" }]
|
|
2741
2747
|
};
|
|
2742
|
-
return await
|
|
2748
|
+
return await u(this, p, ie).setDescriptor(e, r), await u(this, p, ie).descriptor(e);
|
|
2743
2749
|
}
|
|
2744
2750
|
// ─── Ownership (element locks) ─────────────────────────────────────────────
|
|
2745
2751
|
/**
|
|
@@ -2750,15 +2756,15 @@ class ar {
|
|
|
2750
2756
|
* claims counts only for the earliest one, matching the plugins' rule.
|
|
2751
2757
|
*/
|
|
2752
2758
|
async ownership() {
|
|
2753
|
-
const e = await h(this, p,
|
|
2759
|
+
const e = await h(this, p, We).call(this, hr);
|
|
2754
2760
|
if (!e) return [];
|
|
2755
2761
|
const t = await this.client.getHiddenFilesByParent(e.id), s = await Promise.all(
|
|
2756
2762
|
t.map(async (o) => {
|
|
2757
2763
|
try {
|
|
2758
|
-
const a =
|
|
2759
|
-
return !
|
|
2760
|
-
owner: String(
|
|
2761
|
-
keys:
|
|
2764
|
+
const a = te(o), l = await this.client.downloadHiddenFile(a), d = JSON.parse(await l.text());
|
|
2765
|
+
return !d || typeof d != "object" || !("revitflowlock" in d) || !Array.isArray(d.keys) ? null : {
|
|
2766
|
+
owner: String(d.user ?? ""),
|
|
2767
|
+
keys: d.keys.filter((c) => typeof c == "string")
|
|
2762
2768
|
};
|
|
2763
2769
|
} catch {
|
|
2764
2770
|
return null;
|
|
@@ -2787,16 +2793,16 @@ class ar {
|
|
|
2787
2793
|
*/
|
|
2788
2794
|
async sync(e) {
|
|
2789
2795
|
var a;
|
|
2790
|
-
const t = await h(this, p,
|
|
2791
|
-
let s = await h(this, p,
|
|
2796
|
+
const t = await h(this, p, ee).call(this, !0);
|
|
2797
|
+
let s = await h(this, p, ft).call(this) ?? {
|
|
2792
2798
|
model: this.docId,
|
|
2793
2799
|
commits: []
|
|
2794
2800
|
};
|
|
2795
|
-
const r =
|
|
2801
|
+
const r = vs(s.commits);
|
|
2796
2802
|
if (e.expectedLatestGuid !== void 0 && (r == null ? void 0 : r.guid) !== e.expectedLatestGuid)
|
|
2797
|
-
throw new
|
|
2803
|
+
throw new ys(e.expectedLatestGuid, r == null ? void 0 : r.guid);
|
|
2798
2804
|
const i = {
|
|
2799
|
-
guid:
|
|
2805
|
+
guid: Mt(),
|
|
2800
2806
|
...r ? { parents: [r.guid] } : {},
|
|
2801
2807
|
author: e.author,
|
|
2802
2808
|
source: e.source,
|
|
@@ -2805,36 +2811,34 @@ class ar {
|
|
|
2805
2811
|
...e.userId ? { userId: e.userId } : {},
|
|
2806
2812
|
...(a = e.appliedOps) != null && a.length ? { appliedOps: e.appliedOps } : {},
|
|
2807
2813
|
changes: e.changes,
|
|
2808
|
-
counts:
|
|
2814
|
+
counts: ur(e.changes)
|
|
2809
2815
|
};
|
|
2810
|
-
if (e.model && (await h(this, p,
|
|
2811
|
-
const l = await h(this, p,
|
|
2816
|
+
if (e.model && (await h(this, p, Ys).call(this, t, e.model), i.full = !0), e.delta) {
|
|
2817
|
+
const l = await h(this, p, de).call(this);
|
|
2812
2818
|
if (!l)
|
|
2813
2819
|
throw new Error(
|
|
2814
2820
|
"A delta needs the model file to hang from: sync a full model first."
|
|
2815
2821
|
);
|
|
2816
|
-
const
|
|
2822
|
+
const d = await this.client.createHiddenFile(
|
|
2817
2823
|
e.delta,
|
|
2818
2824
|
l.id
|
|
2819
2825
|
);
|
|
2820
|
-
i.deltaId =
|
|
2821
|
-
u._id ?? u.id
|
|
2822
|
-
);
|
|
2826
|
+
i.deltaId = bs(d);
|
|
2823
2827
|
}
|
|
2824
|
-
const o = await h(this, p,
|
|
2828
|
+
const o = await h(this, p, ft).call(this);
|
|
2825
2829
|
if (o) {
|
|
2826
2830
|
s = o;
|
|
2827
|
-
const l =
|
|
2831
|
+
const l = vs(s.commits);
|
|
2828
2832
|
if (e.expectedLatestGuid !== void 0 && (l == null ? void 0 : l.guid) !== e.expectedLatestGuid)
|
|
2829
|
-
throw new
|
|
2833
|
+
throw new ys(e.expectedLatestGuid, l == null ? void 0 : l.guid);
|
|
2830
2834
|
l && !i.parents && (i.parents = [l.guid]);
|
|
2831
2835
|
}
|
|
2832
|
-
return s.commits.push(i), await h(this, p,
|
|
2836
|
+
return s.commits.push(i), await h(this, p, pt).call(this, t, Lt, s), i;
|
|
2833
2837
|
}
|
|
2834
2838
|
// ─── Suggestions (change requests) ────────────────────────────────────────
|
|
2835
2839
|
/** Every suggestion in the document's queue, pending or resolved. */
|
|
2836
2840
|
async suggestions() {
|
|
2837
|
-
const e = await h(this, p,
|
|
2841
|
+
const e = await h(this, p, Ye).call(this);
|
|
2838
2842
|
return (e == null ? void 0 : e.ops) ?? [];
|
|
2839
2843
|
}
|
|
2840
2844
|
/** The suggestions still waiting for the owner, oldest first. */
|
|
@@ -2846,8 +2850,8 @@ class ar {
|
|
|
2846
2850
|
* uploaded as a hidden file under the suggestions index.
|
|
2847
2851
|
*/
|
|
2848
2852
|
async suggest(e) {
|
|
2849
|
-
const t = await h(this, p,
|
|
2850
|
-
opId: e.opId ??
|
|
2853
|
+
const t = await h(this, p, ee).call(this, !0), s = await h(this, p, Ye).call(this) ?? { schema: ws, ops: [] }, r = await h(this, p, We).call(this, Re), i = {
|
|
2854
|
+
opId: e.opId ?? Mt(),
|
|
2851
2855
|
to: e.to ?? this.source,
|
|
2852
2856
|
title: e.title,
|
|
2853
2857
|
verb: e.verb,
|
|
@@ -2860,16 +2864,14 @@ class ar {
|
|
|
2860
2864
|
...e.baseCommitGuid ? { baseCommitGuid: e.baseCommitGuid } : {}
|
|
2861
2865
|
};
|
|
2862
2866
|
if (e.payload) {
|
|
2863
|
-
const a = r ?? await h(this, p,
|
|
2867
|
+
const a = r ?? await h(this, p, Ut).call(this, t, Re, s), l = await this.client.createHiddenFile(
|
|
2864
2868
|
e.payload,
|
|
2865
2869
|
a.id
|
|
2866
2870
|
);
|
|
2867
|
-
i.fragId =
|
|
2868
|
-
l._id ?? l.id
|
|
2869
|
-
);
|
|
2871
|
+
i.fragId = bs(l);
|
|
2870
2872
|
}
|
|
2871
|
-
const o = await h(this, p,
|
|
2872
|
-
return o.schema ?? (o.schema =
|
|
2873
|
+
const o = await h(this, p, Ye).call(this) ?? s;
|
|
2874
|
+
return o.schema ?? (o.schema = ws), o.ops.push(i), await h(this, p, pt).call(this, t, Re, o), i;
|
|
2873
2875
|
}
|
|
2874
2876
|
/** A suggestion's .frag payload. */
|
|
2875
2877
|
async suggestionPayload(e) {
|
|
@@ -2883,20 +2885,20 @@ class ar {
|
|
|
2883
2885
|
* use it for `discarded`.
|
|
2884
2886
|
*/
|
|
2885
2887
|
async resolveSuggestion(e, t) {
|
|
2886
|
-
const s = await h(this, p,
|
|
2888
|
+
const s = await h(this, p, ee).call(this, !1);
|
|
2887
2889
|
if (!s) throw new Error("This document has no suggestion queue.");
|
|
2888
|
-
const r = await h(this, p,
|
|
2890
|
+
const r = await h(this, p, Ye).call(this), i = r == null ? void 0 : r.ops.find((o) => o.opId === e);
|
|
2889
2891
|
if (!r || !i)
|
|
2890
2892
|
throw new Error(`No suggestion ${e} in this document's queue.`);
|
|
2891
|
-
return Object.assign(i, t), await h(this, p,
|
|
2893
|
+
return Object.assign(i, t), await h(this, p, pt).call(this, s, Re, r), i;
|
|
2892
2894
|
}
|
|
2893
2895
|
}
|
|
2894
|
-
|
|
2895
|
-
return new
|
|
2896
|
-
},
|
|
2896
|
+
oe = new WeakMap(), p = new WeakSet(), ie = function() {
|
|
2897
|
+
return new Vs(this.client, this.project.projectId);
|
|
2898
|
+
}, Ce = function() {
|
|
2897
2899
|
return `${this.source}-${this.docId}`;
|
|
2898
|
-
},
|
|
2899
|
-
if (
|
|
2900
|
+
}, ee = async function(e) {
|
|
2901
|
+
if (u(this, oe)) return u(this, oe);
|
|
2900
2902
|
const t = await this.project.rootFolderId(e);
|
|
2901
2903
|
if (!t)
|
|
2902
2904
|
throw new Error(
|
|
@@ -2905,153 +2907,153 @@ Q = new WeakMap(), p = new WeakSet(), X = function() {
|
|
|
2905
2907
|
const s = await this.client.listFolders({
|
|
2906
2908
|
parentFolderId: t,
|
|
2907
2909
|
projectId: this.project.projectId
|
|
2908
|
-
}), r =
|
|
2909
|
-
(o) => String(o.name ?? "") ===
|
|
2910
|
+
}), r = Ws(s, t).find(
|
|
2911
|
+
(o) => String(o.name ?? "") === u(this, p, Ce)
|
|
2910
2912
|
);
|
|
2911
2913
|
if (r)
|
|
2912
|
-
return
|
|
2914
|
+
return R(this, oe, te(r)), u(this, oe);
|
|
2913
2915
|
if (!e)
|
|
2914
2916
|
throw new Error(
|
|
2915
|
-
`Document ${
|
|
2917
|
+
`Document ${u(this, p, Ce)} does not exist in this project.`
|
|
2916
2918
|
);
|
|
2917
2919
|
const i = await this.client.createFolder(
|
|
2918
|
-
|
|
2920
|
+
u(this, p, Ce),
|
|
2919
2921
|
t,
|
|
2920
2922
|
this.project.projectId
|
|
2921
2923
|
);
|
|
2922
|
-
return
|
|
2923
|
-
},
|
|
2924
|
-
const e = await h(this, p,
|
|
2924
|
+
return R(this, oe, te(i)), u(this, oe);
|
|
2925
|
+
}, qt = async function() {
|
|
2926
|
+
const e = await h(this, p, ee).call(this, !1);
|
|
2925
2927
|
return (await this.client.listFiles({ folderId: e })).map((s) => ({
|
|
2926
|
-
id:
|
|
2928
|
+
id: te(s),
|
|
2927
2929
|
name: String(s.name ?? "")
|
|
2928
2930
|
}));
|
|
2929
|
-
},
|
|
2931
|
+
}, We = async function(e) {
|
|
2930
2932
|
try {
|
|
2931
|
-
return (await h(this, p,
|
|
2933
|
+
return (await h(this, p, qt).call(this)).find((t) => t.name === e);
|
|
2932
2934
|
} catch {
|
|
2933
2935
|
return;
|
|
2934
2936
|
}
|
|
2935
|
-
},
|
|
2937
|
+
}, de = async function() {
|
|
2936
2938
|
try {
|
|
2937
|
-
const e = await h(this, p,
|
|
2938
|
-
return e.find((t) => t.name ===
|
|
2939
|
-
(t) => t.name.endsWith(".frag") && !t.name.startsWith(
|
|
2939
|
+
const e = await h(this, p, qt).call(this);
|
|
2940
|
+
return e.find((t) => t.name === Gs) ?? e.find(
|
|
2941
|
+
(t) => t.name.endsWith(".frag") && !t.name.startsWith(Js)
|
|
2940
2942
|
);
|
|
2941
2943
|
} catch {
|
|
2942
2944
|
return;
|
|
2943
2945
|
}
|
|
2944
|
-
},
|
|
2945
|
-
const t = await h(this, p,
|
|
2946
|
+
}, jt = async function(e) {
|
|
2947
|
+
const t = await h(this, p, We).call(this, e);
|
|
2946
2948
|
if (!t) return;
|
|
2947
2949
|
const r = await (await this.client.downloadFile(t.id)).text();
|
|
2948
2950
|
if (r.trim())
|
|
2949
2951
|
return JSON.parse(r);
|
|
2950
|
-
},
|
|
2951
|
-
return h(this, p,
|
|
2952
|
-
},
|
|
2953
|
-
return h(this, p,
|
|
2954
|
-
},
|
|
2952
|
+
}, ft = function() {
|
|
2953
|
+
return h(this, p, jt).call(this, Lt);
|
|
2954
|
+
}, Ye = function() {
|
|
2955
|
+
return h(this, p, jt).call(this, Re);
|
|
2956
|
+
}, pt = async function(e, t, s) {
|
|
2955
2957
|
const r = new Blob([JSON.stringify(s)], {
|
|
2956
2958
|
type: "application/json"
|
|
2957
|
-
}), i = await h(this, p,
|
|
2959
|
+
}), i = await h(this, p, We).call(this, t);
|
|
2958
2960
|
return i ? (await this.client.updateFile(i.id, {
|
|
2959
2961
|
file: r,
|
|
2960
|
-
versionTag:
|
|
2961
|
-
}), i) : await h(this, p,
|
|
2962
|
-
},
|
|
2962
|
+
versionTag: ct()
|
|
2963
|
+
}), i) : await h(this, p, Ut).call(this, e, t, s);
|
|
2964
|
+
}, Ut = async function(e, t, s) {
|
|
2963
2965
|
const r = new Blob([JSON.stringify(s)], {
|
|
2964
2966
|
type: "application/json"
|
|
2965
2967
|
}), i = await this.client.createFile({
|
|
2966
2968
|
file: r,
|
|
2967
2969
|
name: t,
|
|
2968
|
-
versionTag:
|
|
2970
|
+
versionTag: ct(),
|
|
2969
2971
|
parentFolderId: e,
|
|
2970
2972
|
projectId: this.project.projectId
|
|
2971
2973
|
}), o = i.item;
|
|
2972
|
-
return { id:
|
|
2973
|
-
},
|
|
2974
|
-
const s = await h(this, p,
|
|
2974
|
+
return { id: te(o ?? i), name: t };
|
|
2975
|
+
}, Ys = async function(e, t) {
|
|
2976
|
+
const s = await h(this, p, de).call(this);
|
|
2975
2977
|
if (s)
|
|
2976
2978
|
return await this.client.updateFile(s.id, {
|
|
2977
2979
|
file: t,
|
|
2978
|
-
versionTag:
|
|
2980
|
+
versionTag: ct()
|
|
2979
2981
|
}), s;
|
|
2980
|
-
const r = `${
|
|
2982
|
+
const r = `${u(this, p, Ce)}.frag`, i = await this.client.createFile({
|
|
2981
2983
|
file: t,
|
|
2982
2984
|
name: r,
|
|
2983
|
-
versionTag:
|
|
2985
|
+
versionTag: ct(),
|
|
2984
2986
|
parentFolderId: e,
|
|
2985
2987
|
projectId: this.project.projectId
|
|
2986
2988
|
}), o = i.item;
|
|
2987
|
-
return { id:
|
|
2989
|
+
return { id: te(o ?? i), name: r };
|
|
2988
2990
|
};
|
|
2989
|
-
function
|
|
2991
|
+
function ur(n) {
|
|
2990
2992
|
const e = { added: 0, modified: 0, removed: 0 };
|
|
2991
2993
|
for (const t of n)
|
|
2992
2994
|
t.type === "create" ? e.added++ : t.type === "delete" ? e.removed++ : e.modified++;
|
|
2993
2995
|
return e;
|
|
2994
2996
|
}
|
|
2995
|
-
function
|
|
2997
|
+
function zs(n) {
|
|
2996
2998
|
var l;
|
|
2997
2999
|
if (n.length <= 1)
|
|
2998
|
-
return n.forEach((
|
|
2999
|
-
const e = new Map(n.map((
|
|
3000
|
-
for (const
|
|
3001
|
-
const c = (l =
|
|
3000
|
+
return n.forEach((d, c) => d.ordinal = c), [...n];
|
|
3001
|
+
const e = new Map(n.map((d) => [d.guid, d])), t = /* @__PURE__ */ new Map(), s = [];
|
|
3002
|
+
for (const d of n) {
|
|
3003
|
+
const c = (l = d.parents) == null ? void 0 : l[0];
|
|
3002
3004
|
if (c && e.has(c)) {
|
|
3003
3005
|
const m = t.get(c) ?? [];
|
|
3004
|
-
m.push(
|
|
3006
|
+
m.push(d), t.set(c, m);
|
|
3005
3007
|
} else
|
|
3006
|
-
s.push(
|
|
3008
|
+
s.push(d);
|
|
3007
3009
|
}
|
|
3008
|
-
const r = (
|
|
3010
|
+
const r = (d, c) => String(d.timestamp).localeCompare(String(c.timestamp));
|
|
3009
3011
|
s.sort(r);
|
|
3010
3012
|
const i = [], o = [...s].reverse(), a = /* @__PURE__ */ new Set();
|
|
3011
3013
|
for (; o.length; ) {
|
|
3012
|
-
const
|
|
3013
|
-
if (a.has(
|
|
3014
|
-
a.add(
|
|
3015
|
-
const c = (t.get(
|
|
3014
|
+
const d = o.pop();
|
|
3015
|
+
if (a.has(d.guid)) continue;
|
|
3016
|
+
a.add(d.guid), i.push(d);
|
|
3017
|
+
const c = (t.get(d.guid) ?? []).sort(r);
|
|
3016
3018
|
for (let m = c.length - 1; m >= 0; m--) o.push(c[m]);
|
|
3017
3019
|
}
|
|
3018
|
-
for (const
|
|
3019
|
-
a.has(
|
|
3020
|
-
return i.forEach((
|
|
3020
|
+
for (const d of n)
|
|
3021
|
+
a.has(d.guid) || i.push(d);
|
|
3022
|
+
return i.forEach((d, c) => d.ordinal = c), i;
|
|
3021
3023
|
}
|
|
3022
|
-
function
|
|
3023
|
-
const e =
|
|
3024
|
+
function vs(n) {
|
|
3025
|
+
const e = zs(n);
|
|
3024
3026
|
return e[e.length - 1];
|
|
3025
3027
|
}
|
|
3026
|
-
function
|
|
3028
|
+
function Mt() {
|
|
3027
3029
|
const n = globalThis.crypto;
|
|
3028
3030
|
return n != null && n.randomUUID ? n.randomUUID() : "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (e) => {
|
|
3029
3031
|
const t = Math.random() * 16 | 0;
|
|
3030
3032
|
return (e === "x" ? t : t & 3 | 8).toString(16);
|
|
3031
3033
|
});
|
|
3032
3034
|
}
|
|
3033
|
-
var
|
|
3034
|
-
class
|
|
3035
|
+
var fe, Qe, Vt;
|
|
3036
|
+
class fr {
|
|
3035
3037
|
constructor(e) {
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
+
S(this, Qe);
|
|
3039
|
+
S(this, fe, /* @__PURE__ */ new Map());
|
|
3038
3040
|
this.client = e;
|
|
3039
3041
|
}
|
|
3040
3042
|
/** Registers a recipe. One per name; a second with the same name throws. */
|
|
3041
3043
|
register(e) {
|
|
3042
|
-
if (
|
|
3044
|
+
if (u(this, fe).has(e.name))
|
|
3043
3045
|
throw new Error(`A recipe named "${e.name}" is already registered.`);
|
|
3044
|
-
|
|
3046
|
+
u(this, fe).set(e.name, e);
|
|
3045
3047
|
}
|
|
3046
3048
|
/** The registered recipes, optionally filtered by target application. */
|
|
3047
3049
|
list(e) {
|
|
3048
|
-
return [...
|
|
3050
|
+
return [...u(this, fe).values()].filter(
|
|
3049
3051
|
(s) => (!(e != null && e.to) || s.to === e.to) && (!(e != null && e.input) || s.inputs.includes(e.input))
|
|
3050
3052
|
);
|
|
3051
3053
|
}
|
|
3052
3054
|
/** A registered recipe by name, or undefined. */
|
|
3053
3055
|
get(e) {
|
|
3054
|
-
return
|
|
3056
|
+
return u(this, fe).get(e);
|
|
3055
3057
|
}
|
|
3056
3058
|
/**
|
|
3057
3059
|
* Runs a recipe WITHOUT queueing anything: the dry pass. Returns a
|
|
@@ -3060,7 +3062,7 @@ class hr {
|
|
|
3060
3062
|
* included, with no second run. Discard it and the plan never happened.
|
|
3061
3063
|
*/
|
|
3062
3064
|
async plan(e, t) {
|
|
3063
|
-
const { base: s, opId: r, result: i } = await h(this,
|
|
3065
|
+
const { base: s, opId: r, result: i } = await h(this, Qe, Vt).call(this, e, t);
|
|
3064
3066
|
return {
|
|
3065
3067
|
opId: r,
|
|
3066
3068
|
projectId: t.projectId,
|
|
@@ -3093,7 +3095,7 @@ class hr {
|
|
|
3093
3095
|
* to show the tallies before queueing.
|
|
3094
3096
|
*/
|
|
3095
3097
|
async run(e, t) {
|
|
3096
|
-
const { targetDoc: s, base: r, opId: i, result: o } = await h(this,
|
|
3098
|
+
const { targetDoc: s, base: r, opId: i, result: o } = await h(this, Qe, Vt).call(this, e, t);
|
|
3097
3099
|
return { suggestion: await s.suggest({
|
|
3098
3100
|
opId: i,
|
|
3099
3101
|
title: o.title,
|
|
@@ -3106,14 +3108,14 @@ class hr {
|
|
|
3106
3108
|
}), result: o };
|
|
3107
3109
|
}
|
|
3108
3110
|
}
|
|
3109
|
-
|
|
3110
|
-
const s =
|
|
3111
|
+
fe = new WeakMap(), Qe = new WeakSet(), Vt = async function(e, t) {
|
|
3112
|
+
const s = u(this, fe).get(e);
|
|
3111
3113
|
if (!s) throw new Error(`No recipe named "${e}" is registered.`);
|
|
3112
3114
|
if (s.to !== t.target.source)
|
|
3113
3115
|
throw new Error(
|
|
3114
3116
|
`Recipe "${e}" writes ${s.to}, but the target document belongs to ${t.target.source}.`
|
|
3115
3117
|
);
|
|
3116
|
-
const r = this.client.history(t.projectId).doc(t.target.source, t.target.docId), i = await r.latest(), o =
|
|
3118
|
+
const r = this.client.history(t.projectId).doc(t.target.source, t.target.docId), i = await r.latest(), o = Mt(), a = await s.run({
|
|
3117
3119
|
client: this.client,
|
|
3118
3120
|
projectId: t.projectId,
|
|
3119
3121
|
targetDoc: r,
|
|
@@ -3123,8 +3125,8 @@ ae = new WeakMap(), Pe = new WeakSet(), _t = async function(e, t) {
|
|
|
3123
3125
|
});
|
|
3124
3126
|
return { recipe: s, targetDoc: r, base: i, opId: o, result: a };
|
|
3125
3127
|
};
|
|
3126
|
-
const
|
|
3127
|
-
function
|
|
3128
|
+
const Es = 100;
|
|
3129
|
+
function pr(n) {
|
|
3128
3130
|
try {
|
|
3129
3131
|
const e = JSON.parse(n);
|
|
3130
3132
|
if (e && typeof e == "object") {
|
|
@@ -3139,29 +3141,29 @@ function lr(n) {
|
|
|
3139
3141
|
}
|
|
3140
3142
|
return {};
|
|
3141
3143
|
}
|
|
3142
|
-
function
|
|
3144
|
+
function mr(n) {
|
|
3143
3145
|
if (!n || typeof n != "object") return;
|
|
3144
3146
|
const e = n.retryAfter;
|
|
3145
3147
|
return typeof e == "number" && Number.isFinite(e) && e >= 0 ? e : void 0;
|
|
3146
3148
|
}
|
|
3147
|
-
class
|
|
3149
|
+
class rs extends Error {
|
|
3148
3150
|
constructor(t, s, r, i) {
|
|
3149
|
-
const o =
|
|
3151
|
+
const o = pr(r);
|
|
3150
3152
|
super(o.message ?? `${s || "Request failed"} (${t})`);
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3153
|
+
B(this, "status");
|
|
3154
|
+
B(this, "code");
|
|
3155
|
+
B(this, "details");
|
|
3156
|
+
B(this, "body");
|
|
3155
3157
|
/**
|
|
3156
3158
|
* Seconds to wait before retrying, taken from the `Retry-After` header or
|
|
3157
3159
|
* from `details.retryAfter`. Only present on rate-limited (429) responses.
|
|
3158
3160
|
*/
|
|
3159
|
-
|
|
3160
|
-
this.name = "RequestError", this.status = t, this.code = o.code, this.details = o.details, this.body = r, this.retryAfter = i ??
|
|
3161
|
+
B(this, "retryAfter");
|
|
3162
|
+
this.name = "RequestError", this.status = t, this.code = o.code, this.details = o.details, this.body = r, this.retryAfter = i ?? mr(o.details);
|
|
3161
3163
|
}
|
|
3162
3164
|
}
|
|
3163
|
-
const
|
|
3164
|
-
function
|
|
3165
|
+
const Z = "item/folder", b = "item", le = "processor", yr = "npm-registry", re = "hidden", kt = "FILE", Ot = "TOOL", At = "APP", gr = 500, Ts = 3e4, wr = 0.25, br = (n) => new Promise((e) => setTimeout(e, n));
|
|
3166
|
+
function vr(n) {
|
|
3165
3167
|
var r, i;
|
|
3166
3168
|
const e = (i = (r = n.headers) == null ? void 0 : r.get) == null ? void 0 : i.call(r, "Retry-After");
|
|
3167
3169
|
if (!e) return;
|
|
@@ -3171,18 +3173,18 @@ function yr(n) {
|
|
|
3171
3173
|
if (!Number.isNaN(s))
|
|
3172
3174
|
return Math.max(0, (s - Date.now()) / 1e3);
|
|
3173
3175
|
}
|
|
3174
|
-
function
|
|
3175
|
-
return n instanceof
|
|
3176
|
+
function Er(n) {
|
|
3177
|
+
return n instanceof rs ? n.status === 429 || n.status >= 500 : !0;
|
|
3176
3178
|
}
|
|
3177
|
-
function
|
|
3179
|
+
function Tr(n, e) {
|
|
3178
3180
|
const t = Math.min(
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
), s = t *
|
|
3182
|
-
return r != null ? Math.min(r,
|
|
3181
|
+
gr * 2 ** e,
|
|
3182
|
+
Ts
|
|
3183
|
+
), s = t * wr * Math.random(), r = n instanceof rs && n.retryAfter != null ? n.retryAfter * 1e3 : void 0;
|
|
3184
|
+
return r != null ? Math.min(r, Ts) + s : t + s;
|
|
3183
3185
|
}
|
|
3184
|
-
var f,
|
|
3185
|
-
const
|
|
3186
|
+
var f, Gt, w, ue, Ze, ze, mt, yt, Jt, Wt, Ks;
|
|
3187
|
+
const is = class is {
|
|
3186
3188
|
/**
|
|
3187
3189
|
* Creates a new EngineServicesClient instance.
|
|
3188
3190
|
* @param accessToken - API access token (obtained from the platform dashboard)
|
|
@@ -3191,26 +3193,26 @@ const qt = class qt {
|
|
|
3191
3193
|
* @param props - Optional configuration (retry count, auth mode, etc.).
|
|
3192
3194
|
*/
|
|
3193
3195
|
constructor(e, t, s) {
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3196
|
+
S(this, f);
|
|
3197
|
+
B(this, "apiUrl");
|
|
3198
|
+
B(this, "accessToken");
|
|
3199
|
+
B(this, "wsUrl");
|
|
3200
|
+
B(this, "retries");
|
|
3201
|
+
B(this, "useBearer");
|
|
3202
|
+
B(this, "builtInGlobals", null);
|
|
3201
3203
|
/**
|
|
3202
3204
|
* URL of a local execution server (e.g. `http://localhost:4001`).
|
|
3203
3205
|
* When set, execution methods are routed to this server instead of the cloud API.
|
|
3204
3206
|
* Set to `null` to disable local routing and use the cloud API.
|
|
3205
3207
|
*/
|
|
3206
|
-
|
|
3208
|
+
B(this, "localServerUrl", null);
|
|
3207
3209
|
/**
|
|
3208
3210
|
* The platform context this client was created with.
|
|
3209
3211
|
* Contains `appId`, `projectId`, `accessToken`, and `apiUrl`.
|
|
3210
3212
|
* Populated automatically when using {@link fromPlatformContext}.
|
|
3211
3213
|
*/
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
+
B(this, "context");
|
|
3215
|
+
S(this, Ze);
|
|
3214
3216
|
const { retries: r = 0, useBearer: i = !1, localServerUrl: o } = s || {};
|
|
3215
3217
|
let a = t;
|
|
3216
3218
|
if (a.charAt(a.length - 1) === "/" && (a = a.slice(0, -1)), this.apiUrl = `${a}/api`, this.accessToken = e, this.wsUrl = a, this.retries = r, this.useBearer = i, this.context = { appId: "", projectId: "", accessToken: e, apiUrl: t }, o) {
|
|
@@ -3235,7 +3237,7 @@ const qt = class qt {
|
|
|
3235
3237
|
* ```
|
|
3236
3238
|
*/
|
|
3237
3239
|
static fromPlatformContext(e) {
|
|
3238
|
-
const t = (typeof window < "u" ? window.__THATOPEN_CONTEXT__ : null) || { appId: "", projectId: "", accessToken: "", apiUrl: "" }, s = new
|
|
3240
|
+
const t = (typeof window < "u" ? window.__THATOPEN_CONTEXT__ : null) || { appId: "", projectId: "", accessToken: "", apiUrl: "" }, s = new is(t.accessToken, t.apiUrl, {
|
|
3239
3241
|
...e,
|
|
3240
3242
|
useBearer: !0
|
|
3241
3243
|
});
|
|
@@ -3311,7 +3313,7 @@ const qt = class qt {
|
|
|
3311
3313
|
* cleaning logic is applied identically.
|
|
3312
3314
|
*/
|
|
3313
3315
|
async request(e, t, s) {
|
|
3314
|
-
return h(this, f,
|
|
3316
|
+
return h(this, f, w).call(this, e, t, s);
|
|
3315
3317
|
}
|
|
3316
3318
|
// ─── Files ───────────────────────────────────────────────────────
|
|
3317
3319
|
/**
|
|
@@ -3321,9 +3323,9 @@ const qt = class qt {
|
|
|
3321
3323
|
*/
|
|
3322
3324
|
async listFiles(e) {
|
|
3323
3325
|
const { folderId: t, archived: s, projectId: r } = e || {};
|
|
3324
|
-
return t ? await h(this, f,
|
|
3326
|
+
return t ? await h(this, f, w).call(this, "GET", `${Z}/${t}/items`, { query: { itemType: kt, archived: s } }) : await h(this, f, w).call(this, "GET", `${b}`, {
|
|
3325
3327
|
query: {
|
|
3326
|
-
itemType:
|
|
3328
|
+
itemType: kt,
|
|
3327
3329
|
archived: s,
|
|
3328
3330
|
...r && { projectId: r }
|
|
3329
3331
|
}
|
|
@@ -3336,7 +3338,7 @@ const qt = class qt {
|
|
|
3336
3338
|
* @returns The file item, optionally with version history.
|
|
3337
3339
|
*/
|
|
3338
3340
|
async getFile(e, t) {
|
|
3339
|
-
return await h(this, f,
|
|
3341
|
+
return await h(this, f, Wt).call(this, e, t);
|
|
3340
3342
|
}
|
|
3341
3343
|
/**
|
|
3342
3344
|
* Uploads a new file.
|
|
@@ -3344,7 +3346,7 @@ const qt = class qt {
|
|
|
3344
3346
|
* @returns The created item and its first version.
|
|
3345
3347
|
*/
|
|
3346
3348
|
async createFile(e) {
|
|
3347
|
-
return await h(this, f,
|
|
3349
|
+
return await h(this, f, yt).call(this, e, kt);
|
|
3348
3350
|
}
|
|
3349
3351
|
/**
|
|
3350
3352
|
* Updates an existing file. Can rename, move to a different folder,
|
|
@@ -3354,21 +3356,21 @@ const qt = class qt {
|
|
|
3354
3356
|
* @returns The updated item and/or the new version.
|
|
3355
3357
|
*/
|
|
3356
3358
|
async updateFile(e, t) {
|
|
3357
|
-
return await h(this, f,
|
|
3359
|
+
return await h(this, f, Jt).call(this, e, t);
|
|
3358
3360
|
}
|
|
3359
3361
|
/**
|
|
3360
3362
|
* Archives (soft-deletes) a file. Can be recovered with {@link recoverFile}.
|
|
3361
3363
|
* @param fileId - The file's unique identifier.
|
|
3362
3364
|
*/
|
|
3363
3365
|
async archiveFile(e) {
|
|
3364
|
-
return await h(this, f,
|
|
3366
|
+
return await h(this, f, w).call(this, "DELETE", `${b}/${e}`);
|
|
3365
3367
|
}
|
|
3366
3368
|
/**
|
|
3367
3369
|
* Recovers a previously archived file.
|
|
3368
3370
|
* @param fileId - The file's unique identifier.
|
|
3369
3371
|
*/
|
|
3370
3372
|
async recoverFile(e) {
|
|
3371
|
-
return await h(this, f,
|
|
3373
|
+
return await h(this, f, w).call(this, "PUT", `${b}/${e}/recover`);
|
|
3372
3374
|
}
|
|
3373
3375
|
/**
|
|
3374
3376
|
* Downloads a file's content. Returns the raw fetch Response.
|
|
@@ -3377,7 +3379,7 @@ const qt = class qt {
|
|
|
3377
3379
|
* @returns A fetch Response containing the file data.
|
|
3378
3380
|
*/
|
|
3379
3381
|
async downloadFile(e, t) {
|
|
3380
|
-
return await h(this, f,
|
|
3382
|
+
return await h(this, f, mt).call(this, e, t);
|
|
3381
3383
|
}
|
|
3382
3384
|
/**
|
|
3383
3385
|
* Retrieves the free-JSON metadata for a specific file version.
|
|
@@ -3388,7 +3390,7 @@ const qt = class qt {
|
|
|
3388
3390
|
*/
|
|
3389
3391
|
async getFileVersionMetadata(e, t, s) {
|
|
3390
3392
|
const { withDraft: r } = s || {};
|
|
3391
|
-
return await h(this, f,
|
|
3393
|
+
return await h(this, f, w).call(this, "GET", `${b}/${encodeURIComponent(e)}/version/${encodeURIComponent(t)}/metadata`, {
|
|
3392
3394
|
query: {
|
|
3393
3395
|
...r && { withDraft: "true" }
|
|
3394
3396
|
}
|
|
@@ -3401,7 +3403,7 @@ const qt = class qt {
|
|
|
3401
3403
|
* @param metadata - Free-JSON object (max 200 fields, 50-char keys/values).
|
|
3402
3404
|
*/
|
|
3403
3405
|
async updateFileVersionMetadata(e, t, s) {
|
|
3404
|
-
return await h(this, f,
|
|
3406
|
+
return await h(this, f, w).call(this, "PUT", `${b}/${encodeURIComponent(e)}/version/${encodeURIComponent(t)}/metadata`, {
|
|
3405
3407
|
body: JSON.stringify({ metadata: s }),
|
|
3406
3408
|
contentType: "application/json"
|
|
3407
3409
|
});
|
|
@@ -3412,7 +3414,7 @@ const qt = class qt {
|
|
|
3412
3414
|
* @param versionTag - The version tag.
|
|
3413
3415
|
*/
|
|
3414
3416
|
async deleteFileVersionMetadata(e, t) {
|
|
3415
|
-
return await h(this, f,
|
|
3417
|
+
return await h(this, f, w).call(this, "DELETE", `${b}/${encodeURIComponent(e)}/version/${encodeURIComponent(t)}/metadata`);
|
|
3416
3418
|
}
|
|
3417
3419
|
/**
|
|
3418
3420
|
* Batch variant of {@link getFileVersionMetadata}. Reads the metadata of
|
|
@@ -3429,7 +3431,7 @@ const qt = class qt {
|
|
|
3429
3431
|
*/
|
|
3430
3432
|
async getFileVersionMetadataBatch(e, t) {
|
|
3431
3433
|
const { withDraft: s } = t || {};
|
|
3432
|
-
return await h(this, f,
|
|
3434
|
+
return await h(this, f, ze).call(this, e, async (r) => (await h(this, f, w).call(this, "POST", `${b}/batch/version-metadata`, {
|
|
3433
3435
|
body: JSON.stringify({
|
|
3434
3436
|
entries: r,
|
|
3435
3437
|
...s !== void 0 && { withDraft: s }
|
|
@@ -3445,7 +3447,7 @@ const qt = class qt {
|
|
|
3445
3447
|
*/
|
|
3446
3448
|
async listFolders(e) {
|
|
3447
3449
|
const { archived: t, parentFolderId: s, projectId: r } = e || {};
|
|
3448
|
-
return await h(this, f,
|
|
3450
|
+
return await h(this, f, w).call(this, "GET", Z, {
|
|
3449
3451
|
query: {
|
|
3450
3452
|
parentFolderId: s,
|
|
3451
3453
|
archived: t,
|
|
@@ -3458,7 +3460,7 @@ const qt = class qt {
|
|
|
3458
3460
|
* @param folderId - The folder's unique identifier.
|
|
3459
3461
|
*/
|
|
3460
3462
|
async getFolder(e) {
|
|
3461
|
-
return await h(this, f,
|
|
3463
|
+
return await h(this, f, w).call(this, "GET", `${Z}/${e}`);
|
|
3462
3464
|
}
|
|
3463
3465
|
/**
|
|
3464
3466
|
* Batch variant of {@link getFolder}. Resolves a known set of folder ids in
|
|
@@ -3474,7 +3476,7 @@ const qt = class qt {
|
|
|
3474
3476
|
* @param folderIds - The folder ids to resolve.
|
|
3475
3477
|
*/
|
|
3476
3478
|
async getFoldersBatch(e) {
|
|
3477
|
-
return await h(this, f,
|
|
3479
|
+
return await h(this, f, ze).call(this, e, async (t) => (await h(this, f, w).call(this, "POST", `${b}/batch/folders`, {
|
|
3478
3480
|
body: JSON.stringify({ folderIds: t }),
|
|
3479
3481
|
contentType: "application/json"
|
|
3480
3482
|
})).results);
|
|
@@ -3486,7 +3488,7 @@ const qt = class qt {
|
|
|
3486
3488
|
* @returns The created folder.
|
|
3487
3489
|
*/
|
|
3488
3490
|
async createFolder(e, t, s) {
|
|
3489
|
-
return await h(this, f,
|
|
3491
|
+
return await h(this, f, w).call(this, "POST", Z, {
|
|
3490
3492
|
body: JSON.stringify({
|
|
3491
3493
|
name: e,
|
|
3492
3494
|
...t && { parentId: t },
|
|
@@ -3503,7 +3505,7 @@ const qt = class qt {
|
|
|
3503
3505
|
*/
|
|
3504
3506
|
async updateFolder(e, t) {
|
|
3505
3507
|
const { name: s } = t;
|
|
3506
|
-
return await h(this, f,
|
|
3508
|
+
return await h(this, f, w).call(this, "PUT", `${Z}/${e}`, {
|
|
3507
3509
|
body: JSON.stringify({ name: s }),
|
|
3508
3510
|
contentType: "application/json"
|
|
3509
3511
|
});
|
|
@@ -3513,14 +3515,14 @@ const qt = class qt {
|
|
|
3513
3515
|
* @param folderId - The folder's unique identifier.
|
|
3514
3516
|
*/
|
|
3515
3517
|
async archiveFolder(e) {
|
|
3516
|
-
return await h(this, f,
|
|
3518
|
+
return await h(this, f, w).call(this, "DELETE", `${Z}/${e}`);
|
|
3517
3519
|
}
|
|
3518
3520
|
/**
|
|
3519
3521
|
* Recovers a previously archived folder.
|
|
3520
3522
|
* @param folderId - The folder's unique identifier.
|
|
3521
3523
|
*/
|
|
3522
3524
|
async recoverFolder(e) {
|
|
3523
|
-
return await h(this, f,
|
|
3525
|
+
return await h(this, f, w).call(this, "PUT", `${Z}/${e}/recover`);
|
|
3524
3526
|
}
|
|
3525
3527
|
/**
|
|
3526
3528
|
* Downloads an entire folder as a ZIP archive.
|
|
@@ -3528,7 +3530,7 @@ const qt = class qt {
|
|
|
3528
3530
|
* @returns A fetch Response containing the ZIP data.
|
|
3529
3531
|
*/
|
|
3530
3532
|
async downloadFolder(e) {
|
|
3531
|
-
return await h(this, f,
|
|
3533
|
+
return await h(this, f, ue).call(this, `${Z}/${e}/download`);
|
|
3532
3534
|
}
|
|
3533
3535
|
// ─── Components ──────────────────────────────────────────────────
|
|
3534
3536
|
/**
|
|
@@ -3538,14 +3540,14 @@ const qt = class qt {
|
|
|
3538
3540
|
*/
|
|
3539
3541
|
async listComponents(e) {
|
|
3540
3542
|
const { folderId: t, ShowVersions: s, projectId: r } = e || {};
|
|
3541
|
-
return t ? await h(this, f,
|
|
3543
|
+
return t ? await h(this, f, w).call(this, "GET", `${Z}/${t}/items`, {
|
|
3542
3544
|
query: {
|
|
3543
|
-
itemType:
|
|
3545
|
+
itemType: Ot,
|
|
3544
3546
|
...s && { ShowVersions: s }
|
|
3545
3547
|
}
|
|
3546
|
-
}) : await h(this, f,
|
|
3548
|
+
}) : await h(this, f, w).call(this, "GET", `${b}`, {
|
|
3547
3549
|
query: {
|
|
3548
|
-
itemType:
|
|
3550
|
+
itemType: Ot,
|
|
3549
3551
|
...s && { ShowVersions: s },
|
|
3550
3552
|
...r && { projectId: r }
|
|
3551
3553
|
}
|
|
@@ -3557,7 +3559,7 @@ const qt = class qt {
|
|
|
3557
3559
|
* @param props - Options such as whether to include versions.
|
|
3558
3560
|
*/
|
|
3559
3561
|
async getComponent(e, t) {
|
|
3560
|
-
return await h(this, f,
|
|
3562
|
+
return await h(this, f, Wt).call(this, e, t);
|
|
3561
3563
|
}
|
|
3562
3564
|
/**
|
|
3563
3565
|
* Creates a new component with the given file and version properties.
|
|
@@ -3566,7 +3568,7 @@ const qt = class qt {
|
|
|
3566
3568
|
*/
|
|
3567
3569
|
async createComponent(e) {
|
|
3568
3570
|
const { componentProps: t } = e;
|
|
3569
|
-
return await h(this, f,
|
|
3571
|
+
return await h(this, f, yt).call(this, e, Ot, t);
|
|
3570
3572
|
}
|
|
3571
3573
|
/**
|
|
3572
3574
|
* Updates an existing component. Can rename, move, and/or upload a new version.
|
|
@@ -3576,7 +3578,7 @@ const qt = class qt {
|
|
|
3576
3578
|
*/
|
|
3577
3579
|
async updateComponent(e, t) {
|
|
3578
3580
|
const { componentProps: s } = t;
|
|
3579
|
-
return await h(this, f,
|
|
3581
|
+
return await h(this, f, Jt).call(this, e, t, s);
|
|
3580
3582
|
}
|
|
3581
3583
|
/**
|
|
3582
3584
|
* Downloads a component's full ZIP file. Returns the raw fetch Response.
|
|
@@ -3585,7 +3587,7 @@ const qt = class qt {
|
|
|
3585
3587
|
* @returns A fetch Response containing the ZIP data.
|
|
3586
3588
|
*/
|
|
3587
3589
|
async downloadComponent(e, t) {
|
|
3588
|
-
return await h(this, f,
|
|
3590
|
+
return await h(this, f, mt).call(this, e, t);
|
|
3589
3591
|
}
|
|
3590
3592
|
/**
|
|
3591
3593
|
* Downloads only the JavaScript bundle from a component's ZIP.
|
|
@@ -3596,7 +3598,7 @@ const qt = class qt {
|
|
|
3596
3598
|
*/
|
|
3597
3599
|
async downloadComponentBundle(e, t) {
|
|
3598
3600
|
const { versionTag: s, withDraft: r } = t || {};
|
|
3599
|
-
return await h(this, f,
|
|
3601
|
+
return await h(this, f, ue).call(this, `${b}/${e}/download/bundle`, {
|
|
3600
3602
|
query: {
|
|
3601
3603
|
...s && { versionTag: s },
|
|
3602
3604
|
...r && { withDraft: r }
|
|
@@ -3608,14 +3610,14 @@ const qt = class qt {
|
|
|
3608
3610
|
* @param componentId - The component's unique identifier.
|
|
3609
3611
|
*/
|
|
3610
3612
|
async archiveComponent(e) {
|
|
3611
|
-
return await h(this, f,
|
|
3613
|
+
return await h(this, f, w).call(this, "DELETE", `${b}/${e}`);
|
|
3612
3614
|
}
|
|
3613
3615
|
/**
|
|
3614
3616
|
* Recovers a previously archived component.
|
|
3615
3617
|
* @param componentId - The component's unique identifier.
|
|
3616
3618
|
*/
|
|
3617
3619
|
async recoverComponent(e) {
|
|
3618
|
-
return await h(this, f,
|
|
3620
|
+
return await h(this, f, w).call(this, "PUT", `${b}/${e}/recover`);
|
|
3619
3621
|
}
|
|
3620
3622
|
// ─── Built-in Components ─────────────────────────────────────────
|
|
3621
3623
|
/**
|
|
@@ -3624,7 +3626,7 @@ const qt = class qt {
|
|
|
3624
3626
|
* @returns The component's JavaScript source code as a string.
|
|
3625
3627
|
*/
|
|
3626
3628
|
async getBuiltInComponent(e) {
|
|
3627
|
-
return await (await h(this, f,
|
|
3629
|
+
return await (await h(this, f, ue).call(this, `built-in/${e}/bundle`)).text();
|
|
3628
3630
|
}
|
|
3629
3631
|
/**
|
|
3630
3632
|
* Fetches a built-in component bundle, evaluates it, and registers it
|
|
@@ -3653,8 +3655,8 @@ const qt = class qt {
|
|
|
3653
3655
|
* ```
|
|
3654
3656
|
*/
|
|
3655
3657
|
async initBuiltInComponent(e, t, s) {
|
|
3656
|
-
const r = await this.getBuiltInComponent(e.uuid), i = s ?? this.builtInGlobals ?? (typeof window < "u" ? window.ThatOpenCompany : {}) ?? {}, o = Object.keys(i), a = o.map((m) => i[m]),
|
|
3657
|
-
return main;`)(...a), c = (
|
|
3658
|
+
const r = await this.getBuiltInComponent(e.uuid), i = s ?? this.builtInGlobals ?? (typeof window < "u" ? window.ThatOpenCompany : {}) ?? {}, o = Object.keys(i), a = o.map((m) => i[m]), d = new Function(...o, `${r}
|
|
3659
|
+
return main;`)(...a), c = (d == null ? void 0 : d.componentDefinition) ?? d;
|
|
3658
3660
|
t.get(c);
|
|
3659
3661
|
}
|
|
3660
3662
|
/**
|
|
@@ -3722,14 +3724,14 @@ return main;`)(...a), c = (u == null ? void 0 : u.componentDefinition) ?? u;
|
|
|
3722
3724
|
*/
|
|
3723
3725
|
async listApps(e) {
|
|
3724
3726
|
const { folderId: t, ShowVersions: s, projectId: r } = e || {};
|
|
3725
|
-
return t ? await h(this, f,
|
|
3727
|
+
return t ? await h(this, f, w).call(this, "GET", `${Z}/${t}/items`, {
|
|
3726
3728
|
query: {
|
|
3727
|
-
itemType:
|
|
3729
|
+
itemType: At,
|
|
3728
3730
|
...s && { ShowVersions: s }
|
|
3729
3731
|
}
|
|
3730
|
-
}) : await h(this, f,
|
|
3732
|
+
}) : await h(this, f, w).call(this, "GET", `${b}`, {
|
|
3731
3733
|
query: {
|
|
3732
|
-
itemType:
|
|
3734
|
+
itemType: At,
|
|
3733
3735
|
...s && { ShowVersions: s },
|
|
3734
3736
|
...r && { projectId: r }
|
|
3735
3737
|
}
|
|
@@ -3742,7 +3744,7 @@ return main;`)(...a), c = (u == null ? void 0 : u.componentDefinition) ?? u;
|
|
|
3742
3744
|
*/
|
|
3743
3745
|
async createApp(e) {
|
|
3744
3746
|
const { appProps: t } = e;
|
|
3745
|
-
return await h(this, f,
|
|
3747
|
+
return await h(this, f, yt).call(this, e, At, t);
|
|
3746
3748
|
}
|
|
3747
3749
|
/**
|
|
3748
3750
|
* Downloads an app's full ZIP file. Returns the raw fetch Response.
|
|
@@ -3751,7 +3753,7 @@ return main;`)(...a), c = (u == null ? void 0 : u.componentDefinition) ?? u;
|
|
|
3751
3753
|
* @returns A fetch Response containing the ZIP data.
|
|
3752
3754
|
*/
|
|
3753
3755
|
async downloadApp(e, t) {
|
|
3754
|
-
return await h(this, f,
|
|
3756
|
+
return await h(this, f, mt).call(this, e, t);
|
|
3755
3757
|
}
|
|
3756
3758
|
/**
|
|
3757
3759
|
* Downloads only the JavaScript bundle from an app's ZIP.
|
|
@@ -3762,7 +3764,7 @@ return main;`)(...a), c = (u == null ? void 0 : u.componentDefinition) ?? u;
|
|
|
3762
3764
|
*/
|
|
3763
3765
|
async downloadAppBundle(e, t) {
|
|
3764
3766
|
const { versionTag: s, withDraft: r } = t || {};
|
|
3765
|
-
return await h(this, f,
|
|
3767
|
+
return await h(this, f, ue).call(this, `${b}/${e}/download/bundle`, {
|
|
3766
3768
|
query: {
|
|
3767
3769
|
...s && { versionTag: s },
|
|
3768
3770
|
...r && { withDraft: r }
|
|
@@ -3774,7 +3776,7 @@ return main;`)(...a), c = (u == null ? void 0 : u.componentDefinition) ?? u;
|
|
|
3774
3776
|
* @param appId - The app's unique identifier.
|
|
3775
3777
|
*/
|
|
3776
3778
|
async archiveApp(e) {
|
|
3777
|
-
return await h(this, f,
|
|
3779
|
+
return await h(this, f, w).call(this, "DELETE", `${b}/${e}`);
|
|
3778
3780
|
}
|
|
3779
3781
|
// ─── NPM Registry ────────────────────────────────────────────────
|
|
3780
3782
|
/**
|
|
@@ -3786,7 +3788,7 @@ return main;`)(...a), c = (u == null ? void 0 : u.componentDefinition) ?? u;
|
|
|
3786
3788
|
* @returns The registry, scope, read-only token, and assembled `.npmrc`.
|
|
3787
3789
|
*/
|
|
3788
3790
|
async getNpmCredentials() {
|
|
3789
|
-
return await h(this, f,
|
|
3791
|
+
return await h(this, f, w).call(this, "GET", `${yr}/credentials`);
|
|
3790
3792
|
}
|
|
3791
3793
|
// ─── Execution ───────────────────────────────────────────────────
|
|
3792
3794
|
/**
|
|
@@ -3805,7 +3807,7 @@ return main;`)(...a), c = (u == null ? void 0 : u.componentDefinition) ?? u;
|
|
|
3805
3807
|
*/
|
|
3806
3808
|
async executeComponent(e, t, s) {
|
|
3807
3809
|
if (this.localServerUrl) {
|
|
3808
|
-
const r = `${this.localServerUrl}/api/${
|
|
3810
|
+
const r = `${this.localServerUrl}/api/${le}/${e}/execute`, i = await fetch(r, {
|
|
3809
3811
|
method: "POST",
|
|
3810
3812
|
headers: { "Content-Type": "application/json" },
|
|
3811
3813
|
body: JSON.stringify(t)
|
|
@@ -3818,7 +3820,7 @@ return main;`)(...a), c = (u == null ? void 0 : u.componentDefinition) ?? u;
|
|
|
3818
3820
|
}
|
|
3819
3821
|
return await i.json();
|
|
3820
3822
|
}
|
|
3821
|
-
return await h(this, f,
|
|
3823
|
+
return await h(this, f, w).call(this, "POST", `${le}/${e}/execute`, {
|
|
3822
3824
|
body: JSON.stringify(t),
|
|
3823
3825
|
query: { ...s && { versionTag: s } },
|
|
3824
3826
|
contentType: "application/json"
|
|
@@ -3830,7 +3832,7 @@ return main;`)(...a), c = (u == null ? void 0 : u.componentDefinition) ?? u;
|
|
|
3830
3832
|
*/
|
|
3831
3833
|
async abortExecution(e) {
|
|
3832
3834
|
if (this.localServerUrl) {
|
|
3833
|
-
const t = `${this.localServerUrl}/api/${
|
|
3835
|
+
const t = `${this.localServerUrl}/api/${le}/progress/${e}/abort`, s = await fetch(t, { method: "POST" });
|
|
3834
3836
|
if (!s.ok) {
|
|
3835
3837
|
const r = await s.text().catch(() => "");
|
|
3836
3838
|
throw new Error(
|
|
@@ -3839,7 +3841,7 @@ return main;`)(...a), c = (u == null ? void 0 : u.componentDefinition) ?? u;
|
|
|
3839
3841
|
}
|
|
3840
3842
|
return await s.json();
|
|
3841
3843
|
}
|
|
3842
|
-
return await h(this, f,
|
|
3844
|
+
return await h(this, f, w).call(this, "POST", `${le}/progress/${e}/abort`);
|
|
3843
3845
|
}
|
|
3844
3846
|
/**
|
|
3845
3847
|
* Lists all executions for a given component.
|
|
@@ -3856,7 +3858,7 @@ return main;`)(...a), c = (u == null ? void 0 : u.componentDefinition) ?? u;
|
|
|
3856
3858
|
*/
|
|
3857
3859
|
async listExecutions(e, t) {
|
|
3858
3860
|
if (this.localServerUrl) {
|
|
3859
|
-
const s = t ? `?projectId=${encodeURIComponent(t)}` : "", r = `${this.localServerUrl}/api/${
|
|
3861
|
+
const s = t ? `?projectId=${encodeURIComponent(t)}` : "", r = `${this.localServerUrl}/api/${le}/${e}/progress${s}`, i = await fetch(r);
|
|
3860
3862
|
if (!i.ok) {
|
|
3861
3863
|
const o = await i.text().catch(() => "");
|
|
3862
3864
|
throw new Error(
|
|
@@ -3865,7 +3867,7 @@ return main;`)(...a), c = (u == null ? void 0 : u.componentDefinition) ?? u;
|
|
|
3865
3867
|
}
|
|
3866
3868
|
return await i.json();
|
|
3867
3869
|
}
|
|
3868
|
-
return await h(this, f,
|
|
3870
|
+
return await h(this, f, w).call(this, "GET", `${le}/${e}/progress`, { query: { ...t && { projectId: t } } });
|
|
3869
3871
|
}
|
|
3870
3872
|
/**
|
|
3871
3873
|
* Gets details of a specific execution, including its messages.
|
|
@@ -3874,7 +3876,7 @@ return main;`)(...a), c = (u == null ? void 0 : u.componentDefinition) ?? u;
|
|
|
3874
3876
|
*/
|
|
3875
3877
|
async getExecution(e) {
|
|
3876
3878
|
if (this.localServerUrl) {
|
|
3877
|
-
const t = `${this.localServerUrl}/api/${
|
|
3879
|
+
const t = `${this.localServerUrl}/api/${le}/progress/${e}`, s = await fetch(t);
|
|
3878
3880
|
if (!s.ok) {
|
|
3879
3881
|
const r = await s.text().catch(() => "");
|
|
3880
3882
|
throw new Error(
|
|
@@ -3883,7 +3885,7 @@ return main;`)(...a), c = (u == null ? void 0 : u.componentDefinition) ?? u;
|
|
|
3883
3885
|
}
|
|
3884
3886
|
return await s.json();
|
|
3885
3887
|
}
|
|
3886
|
-
return await h(this, f,
|
|
3888
|
+
return await h(this, f, w).call(this, "GET", `${le}/progress/${e}`);
|
|
3887
3889
|
}
|
|
3888
3890
|
/**
|
|
3889
3891
|
* Subscribes to real-time execution progress via WebSocket.
|
|
@@ -3892,7 +3894,7 @@ return main;`)(...a), c = (u == null ? void 0 : u.componentDefinition) ?? u;
|
|
|
3892
3894
|
* @param onUpdateCallback - Callback invoked on each progress/result event.
|
|
3893
3895
|
*/
|
|
3894
3896
|
async onExecutionProgress(e, t) {
|
|
3895
|
-
const s = this.localServerUrl ?? this.wsUrl, r = await
|
|
3897
|
+
const s = this.localServerUrl ?? this.wsUrl, r = await Ke(s, {
|
|
3896
3898
|
auth: { accessToken: this.accessToken },
|
|
3897
3899
|
transports: ["websocket"]
|
|
3898
3900
|
});
|
|
@@ -3911,7 +3913,7 @@ return main;`)(...a), c = (u == null ? void 0 : u.componentDefinition) ?? u;
|
|
|
3911
3913
|
* renderable views. See `src/core/documents.ts` for the model and schema.
|
|
3912
3914
|
*/
|
|
3913
3915
|
documents(e) {
|
|
3914
|
-
return new
|
|
3916
|
+
return new Vs(this, e);
|
|
3915
3917
|
}
|
|
3916
3918
|
/**
|
|
3917
3919
|
* A project's history of connected documents (Revit models, AutoCAD
|
|
@@ -3920,14 +3922,14 @@ return main;`)(...a), c = (u == null ? void 0 : u.componentDefinition) ?? u;
|
|
|
3920
3922
|
* or write it; the storage underneath is private and will move.
|
|
3921
3923
|
*/
|
|
3922
3924
|
history(e) {
|
|
3923
|
-
return new
|
|
3925
|
+
return new lr(this, e);
|
|
3924
3926
|
}
|
|
3925
3927
|
/**
|
|
3926
3928
|
* The recipe registry and runner: scripts that write change requests in a
|
|
3927
3929
|
* native application's language. See `src/core/recipes.ts`.
|
|
3928
3930
|
*/
|
|
3929
3931
|
get recipes() {
|
|
3930
|
-
return
|
|
3932
|
+
return u(this, Ze) ?? R(this, Ze, new fr(this)), u(this, Ze);
|
|
3931
3933
|
}
|
|
3932
3934
|
// ─── Hidden Files ────────────────────────────────────────────────
|
|
3933
3935
|
/**
|
|
@@ -3941,7 +3943,7 @@ return main;`)(...a), c = (u == null ? void 0 : u.componentDefinition) ?? u;
|
|
|
3941
3943
|
*/
|
|
3942
3944
|
async createHiddenFile(e, t, s) {
|
|
3943
3945
|
const r = new FormData();
|
|
3944
|
-
return r.append("file", e), r.append("parentItemId", t), s != null && r.append("tag", s), await h(this, f,
|
|
3946
|
+
return r.append("file", e), r.append("parentItemId", t), s != null && r.append("tag", s), await h(this, f, w).call(this, "POST", `${b}/${re}`, {
|
|
3945
3947
|
body: r
|
|
3946
3948
|
});
|
|
3947
3949
|
}
|
|
@@ -3959,7 +3961,7 @@ return main;`)(...a), c = (u == null ? void 0 : u.componentDefinition) ?? u;
|
|
|
3959
3961
|
const r = new FormData();
|
|
3960
3962
|
for (const i of e)
|
|
3961
3963
|
r.append("files", i);
|
|
3962
|
-
return r.append("parentItemId", t), s != null && r.append("tag", s), await h(this, f,
|
|
3964
|
+
return r.append("parentItemId", t), s != null && r.append("tag", s), await h(this, f, w).call(this, "POST", `${b}/${re}/batch`, {
|
|
3963
3965
|
body: r
|
|
3964
3966
|
});
|
|
3965
3967
|
}
|
|
@@ -3968,21 +3970,21 @@ return main;`)(...a), c = (u == null ? void 0 : u.componentDefinition) ?? u;
|
|
|
3968
3970
|
* @param hiddenId - The hidden file's unique identifier.
|
|
3969
3971
|
*/
|
|
3970
3972
|
async deleteHiddenFile(e) {
|
|
3971
|
-
return await h(this, f,
|
|
3973
|
+
return await h(this, f, w).call(this, "DELETE", `${b}/${re}/${e}`);
|
|
3972
3974
|
}
|
|
3973
3975
|
/**
|
|
3974
3976
|
* Gets metadata for a hidden file.
|
|
3975
3977
|
* @param hiddenId - The hidden file's unique identifier.
|
|
3976
3978
|
*/
|
|
3977
3979
|
async getHiddenFile(e) {
|
|
3978
|
-
return await h(this, f,
|
|
3980
|
+
return await h(this, f, w).call(this, "GET", `${b}/${re}/${e}`);
|
|
3979
3981
|
}
|
|
3980
3982
|
/**
|
|
3981
3983
|
* Downloads a hidden file's content. Returns the raw fetch Response.
|
|
3982
3984
|
* @param hiddenId - The hidden file's unique identifier.
|
|
3983
3985
|
*/
|
|
3984
3986
|
async downloadHiddenFile(e) {
|
|
3985
|
-
return await h(this, f,
|
|
3987
|
+
return await h(this, f, ue).call(this, `${b}/${re}/${e}/download`);
|
|
3986
3988
|
}
|
|
3987
3989
|
/**
|
|
3988
3990
|
* Mints a short-lived presigned URL for a hidden file so the browser can
|
|
@@ -4002,7 +4004,7 @@ return main;`)(...a), c = (u == null ? void 0 : u.componentDefinition) ?? u;
|
|
|
4002
4004
|
* an ISO timestamp when it stops working.
|
|
4003
4005
|
*/
|
|
4004
4006
|
async getHiddenFileSignedUrl(e, t) {
|
|
4005
|
-
return await h(this, f,
|
|
4007
|
+
return await h(this, f, w).call(this, "GET", `${b}/${re}/${e}/signed-url`, { ...t != null && { query: { expiresIn: t } } });
|
|
4006
4008
|
}
|
|
4007
4009
|
/**
|
|
4008
4010
|
* Batch variant of {@link getHiddenFileSignedUrl}. Mints presigned URLs for
|
|
@@ -4023,7 +4025,7 @@ return main;`)(...a), c = (u == null ? void 0 : u.componentDefinition) ?? u;
|
|
|
4023
4025
|
* 900 (15 min) server-side; values are clamped to that range.
|
|
4024
4026
|
*/
|
|
4025
4027
|
async getHiddenFileSignedUrlsBatch(e, t) {
|
|
4026
|
-
return await h(this, f,
|
|
4028
|
+
return await h(this, f, ze).call(this, e, async (s) => (await h(this, f, w).call(this, "POST", `${b}/${re}/signed-url/batch`, {
|
|
4027
4029
|
body: JSON.stringify({
|
|
4028
4030
|
hiddenFileIds: s,
|
|
4029
4031
|
...t != null && { expiresIn: t }
|
|
@@ -4039,14 +4041,14 @@ return main;`)(...a), c = (u == null ? void 0 : u.componentDefinition) ?? u;
|
|
|
4039
4041
|
* @returns Array of hidden file entities.
|
|
4040
4042
|
*/
|
|
4041
4043
|
async getHiddenFilesByParent(e, t) {
|
|
4042
|
-
return await h(this, f,
|
|
4044
|
+
return await h(this, f, w).call(this, "GET", `${b}/${e}/${re}`, { ...t != null && { query: { tag: t } } });
|
|
4043
4045
|
}
|
|
4044
4046
|
/**
|
|
4045
4047
|
* Deletes all hidden files attached to a parent item.
|
|
4046
4048
|
* @param parentFileId - The parent item's unique identifier.
|
|
4047
4049
|
*/
|
|
4048
4050
|
async deleteHiddenFilesByParent(e) {
|
|
4049
|
-
return await h(this, f,
|
|
4051
|
+
return await h(this, f, w).call(this, "DELETE", `${b}/${e}/${re}`);
|
|
4050
4052
|
}
|
|
4051
4053
|
// ─── Icons ───────────────────────────────────────────────────────
|
|
4052
4054
|
/**
|
|
@@ -4058,7 +4060,7 @@ return main;`)(...a), c = (u == null ? void 0 : u.componentDefinition) ?? u;
|
|
|
4058
4060
|
*/
|
|
4059
4061
|
async uploadItemIcon(e, t) {
|
|
4060
4062
|
const s = new FormData();
|
|
4061
|
-
return s.append("icon", t), await h(this, f,
|
|
4063
|
+
return s.append("icon", t), await h(this, f, w).call(this, "PUT", `${b}/${e}/icon`, {
|
|
4062
4064
|
body: s
|
|
4063
4065
|
});
|
|
4064
4066
|
}
|
|
@@ -4068,7 +4070,7 @@ return main;`)(...a), c = (u == null ? void 0 : u.componentDefinition) ?? u;
|
|
|
4068
4070
|
* @returns The raw Response (use `.blob()`, `.arrayBuffer()`, or pipe the body).
|
|
4069
4071
|
*/
|
|
4070
4072
|
async getItemIcon(e) {
|
|
4071
|
-
return await h(this, f,
|
|
4073
|
+
return await h(this, f, ue).call(this, `${b}/${e}/icon`);
|
|
4072
4074
|
}
|
|
4073
4075
|
/**
|
|
4074
4076
|
* Removes the icon from an item.
|
|
@@ -4076,7 +4078,7 @@ return main;`)(...a), c = (u == null ? void 0 : u.componentDefinition) ?? u;
|
|
|
4076
4078
|
* @returns The updated item with icon fields removed.
|
|
4077
4079
|
*/
|
|
4078
4080
|
async removeItemIcon(e) {
|
|
4079
|
-
return await h(this, f,
|
|
4081
|
+
return await h(this, f, w).call(this, "DELETE", `${b}/${e}/icon`);
|
|
4080
4082
|
}
|
|
4081
4083
|
// ─── General Item Operations ─────────────────────────────────────
|
|
4082
4084
|
/**
|
|
@@ -4086,7 +4088,7 @@ return main;`)(...a), c = (u == null ? void 0 : u.componentDefinition) ?? u;
|
|
|
4086
4088
|
* @returns The updated item.
|
|
4087
4089
|
*/
|
|
4088
4090
|
async updateItem(e, t) {
|
|
4089
|
-
return await h(this, f,
|
|
4091
|
+
return await h(this, f, w).call(this, "PUT", `${b}/${e}`, {
|
|
4090
4092
|
body: JSON.stringify(t),
|
|
4091
4093
|
contentType: "application/json"
|
|
4092
4094
|
});
|
|
@@ -4103,7 +4105,7 @@ return main;`)(...a), c = (u == null ? void 0 : u.componentDefinition) ?? u;
|
|
|
4103
4105
|
*/
|
|
4104
4106
|
async createVersion(e, t, s, r, i) {
|
|
4105
4107
|
const o = new FormData();
|
|
4106
|
-
return o.append("file", t), o.append("versionTag", s), r && o.append("extraProps", JSON.stringify(r)), i && o.append("metadata", JSON.stringify(i)), await h(this, f,
|
|
4108
|
+
return o.append("file", t), o.append("versionTag", s), r && o.append("extraProps", JSON.stringify(r)), i && o.append("metadata", JSON.stringify(i)), await h(this, f, w).call(this, "POST", `${b}/${e}/version`, { body: o });
|
|
4107
4109
|
}
|
|
4108
4110
|
/**
|
|
4109
4111
|
* Lists versions of an item. Pass `archived: true` to fetch only archived
|
|
@@ -4113,7 +4115,7 @@ return main;`)(...a), c = (u == null ? void 0 : u.componentDefinition) ?? u;
|
|
|
4113
4115
|
* @returns Array of versions, sorted by creation date descending.
|
|
4114
4116
|
*/
|
|
4115
4117
|
async listVersions(e, t = {}) {
|
|
4116
|
-
return await h(this, f,
|
|
4118
|
+
return await h(this, f, w).call(this, "GET", `${b}/${encodeURIComponent(e)}/versions`, { query: t });
|
|
4117
4119
|
}
|
|
4118
4120
|
/**
|
|
4119
4121
|
* Batch variant of {@link listVersions}. Lists the versions of many items in
|
|
@@ -4132,7 +4134,7 @@ return main;`)(...a), c = (u == null ? void 0 : u.componentDefinition) ?? u;
|
|
|
4132
4134
|
*/
|
|
4133
4135
|
async listVersionsBatch(e, t = {}) {
|
|
4134
4136
|
const { archived: s } = t;
|
|
4135
|
-
return await h(this, f,
|
|
4137
|
+
return await h(this, f, ze).call(this, e, async (r) => (await h(this, f, w).call(this, "POST", `${b}/batch/versions`, {
|
|
4136
4138
|
body: JSON.stringify({
|
|
4137
4139
|
itemIds: r,
|
|
4138
4140
|
...s !== void 0 && { archived: s }
|
|
@@ -4150,7 +4152,7 @@ return main;`)(...a), c = (u == null ? void 0 : u.componentDefinition) ?? u;
|
|
|
4150
4152
|
* @returns The archived version.
|
|
4151
4153
|
*/
|
|
4152
4154
|
async archiveVersion(e, t) {
|
|
4153
|
-
return await h(this, f,
|
|
4155
|
+
return await h(this, f, w).call(this, "PUT", `${b}/${encodeURIComponent(e)}/version/${encodeURIComponent(t)}/archive`);
|
|
4154
4156
|
}
|
|
4155
4157
|
/**
|
|
4156
4158
|
* Recovers a previously archived version, restoring it to the active list.
|
|
@@ -4159,7 +4161,7 @@ return main;`)(...a), c = (u == null ? void 0 : u.componentDefinition) ?? u;
|
|
|
4159
4161
|
* @returns The recovered version.
|
|
4160
4162
|
*/
|
|
4161
4163
|
async recoverVersion(e, t) {
|
|
4162
|
-
return await h(this, f,
|
|
4164
|
+
return await h(this, f, w).call(this, "PUT", `${b}/${encodeURIComponent(e)}/version/${encodeURIComponent(t)}/recover`);
|
|
4163
4165
|
}
|
|
4164
4166
|
/**
|
|
4165
4167
|
* Permanently deletes a version, including its file in object storage.
|
|
@@ -4168,54 +4170,54 @@ return main;`)(...a), c = (u == null ? void 0 : u.componentDefinition) ?? u;
|
|
|
4168
4170
|
* @param versionTag - The version's tag (e.g. "v2").
|
|
4169
4171
|
*/
|
|
4170
4172
|
async deleteVersion(e, t) {
|
|
4171
|
-
return await h(this, f,
|
|
4173
|
+
return await h(this, f, w).call(this, "DELETE", `${b}/${encodeURIComponent(e)}/version/${encodeURIComponent(t)}`);
|
|
4172
4174
|
}
|
|
4173
4175
|
};
|
|
4174
|
-
f = new WeakSet(),
|
|
4176
|
+
f = new WeakSet(), Gt = function(e) {
|
|
4175
4177
|
return `${this.apiUrl}/${e}`;
|
|
4176
|
-
},
|
|
4177
|
-
const { body: r, query: i, contentType: o, retries: a, responseType: l, retryAttempt:
|
|
4178
|
+
}, w = async function(e, t, s) {
|
|
4179
|
+
const { body: r, query: i, contentType: o, retries: a, responseType: l, retryAttempt: d } = s || {}, c = h(this, f, Gt).call(this, t), m = h(this, f, Ks).call(this, i), T = await this.resolveAccessToken(), A = {
|
|
4178
4180
|
...m,
|
|
4179
|
-
...this.useBearer ? {} : { accessToken:
|
|
4181
|
+
...this.useBearer ? {} : { accessToken: T }
|
|
4180
4182
|
};
|
|
4181
4183
|
try {
|
|
4182
|
-
const
|
|
4183
|
-
c + "?" + new URLSearchParams(
|
|
4184
|
+
const _ = await fetch(
|
|
4185
|
+
c + "?" + new URLSearchParams(A).toString(),
|
|
4184
4186
|
{
|
|
4185
4187
|
method: e,
|
|
4186
4188
|
headers: {
|
|
4187
4189
|
Accept: "application/json",
|
|
4188
4190
|
...o && { "Content-Type": o },
|
|
4189
|
-
...this.useBearer && { Authorization: `Bearer ${
|
|
4191
|
+
...this.useBearer && { Authorization: `Bearer ${T}` }
|
|
4190
4192
|
},
|
|
4191
4193
|
...r && { body: r }
|
|
4192
4194
|
}
|
|
4193
4195
|
);
|
|
4194
|
-
if (!
|
|
4195
|
-
const
|
|
4196
|
-
throw new
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4196
|
+
if (!_.ok) {
|
|
4197
|
+
const E = await _.text().then((N) => N).catch(() => "");
|
|
4198
|
+
throw new rs(
|
|
4199
|
+
_.status,
|
|
4200
|
+
_.statusText,
|
|
4201
|
+
E,
|
|
4202
|
+
vr(_)
|
|
4201
4203
|
);
|
|
4202
4204
|
}
|
|
4203
|
-
return l === "blob" ? await
|
|
4205
|
+
return l === "blob" ? await _.blob() : _.json().then((E) => E).catch(() => {
|
|
4204
4206
|
});
|
|
4205
|
-
} catch (
|
|
4206
|
-
const
|
|
4207
|
-
if (
|
|
4208
|
-
const
|
|
4209
|
-
return await
|
|
4207
|
+
} catch (_) {
|
|
4208
|
+
const E = a ?? this.retries;
|
|
4209
|
+
if (E > 0 && Er(_)) {
|
|
4210
|
+
const N = d ?? 0;
|
|
4211
|
+
return await br(Tr(_, N)), await h(this, f, w).call(this, e, t, {
|
|
4210
4212
|
...s,
|
|
4211
|
-
retries:
|
|
4212
|
-
retryAttempt:
|
|
4213
|
+
retries: E - 1,
|
|
4214
|
+
retryAttempt: N + 1
|
|
4213
4215
|
});
|
|
4214
4216
|
}
|
|
4215
|
-
throw
|
|
4217
|
+
throw _;
|
|
4216
4218
|
}
|
|
4217
|
-
},
|
|
4218
|
-
const { query: s } = t || {}, r = h(this, f,
|
|
4219
|
+
}, ue = async function(e, t) {
|
|
4220
|
+
const { query: s } = t || {}, r = h(this, f, Gt).call(this, e), i = await this.resolveAccessToken(), o = {
|
|
4219
4221
|
...s,
|
|
4220
4222
|
...this.useBearer ? {} : { accessToken: i }
|
|
4221
4223
|
};
|
|
@@ -4228,31 +4230,31 @@ f = new WeakSet(), It = function(e) {
|
|
|
4228
4230
|
}
|
|
4229
4231
|
}
|
|
4230
4232
|
);
|
|
4231
|
-
},
|
|
4233
|
+
}, Ze = new WeakMap(), ze = async function(e, t) {
|
|
4232
4234
|
if (!e.length) return [];
|
|
4233
4235
|
const s = [];
|
|
4234
|
-
for (let i = 0; i < e.length; i +=
|
|
4235
|
-
s.push(e.slice(i, i +
|
|
4236
|
+
for (let i = 0; i < e.length; i += Es)
|
|
4237
|
+
s.push(e.slice(i, i + Es));
|
|
4236
4238
|
return (await Promise.all(s.map(t))).flat();
|
|
4237
|
-
},
|
|
4239
|
+
}, mt = async function(e, t) {
|
|
4238
4240
|
const { versionTag: s, withDraft: r } = t || {};
|
|
4239
|
-
return await h(this, f,
|
|
4241
|
+
return await h(this, f, ue).call(this, `${b}/${e}/download`, {
|
|
4240
4242
|
query: {
|
|
4241
4243
|
...s && { versionTag: s },
|
|
4242
4244
|
...r && { withDraft: r }
|
|
4243
4245
|
}
|
|
4244
4246
|
});
|
|
4245
|
-
},
|
|
4246
|
-
const { name: r, versionTag: i, parentFolderId: o, projectId: a, file: l, metadata:
|
|
4247
|
-
return c.append("file", l), c.append("name", r), c.append("versionTag", i), c.append("itemType", t), o && c.append("folderId", o), a && c.append("projectId", a), s && c.append("extraProps", JSON.stringify(s)),
|
|
4247
|
+
}, yt = async function(e, t, s) {
|
|
4248
|
+
const { name: r, versionTag: i, parentFolderId: o, projectId: a, file: l, metadata: d } = e, c = new FormData();
|
|
4249
|
+
return c.append("file", l), c.append("name", r), c.append("versionTag", i), c.append("itemType", t), o && c.append("folderId", o), a && c.append("projectId", a), s && c.append("extraProps", JSON.stringify(s)), d && c.append("metadata", JSON.stringify(d)), await h(this, f, w).call(this, "POST", b, {
|
|
4248
4250
|
body: c
|
|
4249
4251
|
});
|
|
4250
|
-
},
|
|
4252
|
+
}, Jt = async function(e, t, s) {
|
|
4251
4253
|
const { name: r, versionTag: i, parentFolderId: o, file: a, metadata: l } = t;
|
|
4252
|
-
let
|
|
4254
|
+
let d, c;
|
|
4253
4255
|
if (a) {
|
|
4254
4256
|
const m = new FormData();
|
|
4255
|
-
m.append("file", a), i && m.append("versionTag", i), s && m.append("extraProps", JSON.stringify(s)), l && m.append("metadata", JSON.stringify(l)), c = await h(this, f,
|
|
4257
|
+
m.append("file", a), i && m.append("versionTag", i), s && m.append("extraProps", JSON.stringify(s)), l && m.append("metadata", JSON.stringify(l)), c = await h(this, f, w).call(this, "POST", `${b}/${e}/version`, {
|
|
4256
4258
|
body: m
|
|
4257
4259
|
});
|
|
4258
4260
|
}
|
|
@@ -4260,26 +4262,26 @@ f = new WeakSet(), It = function(e) {
|
|
|
4260
4262
|
const m = {
|
|
4261
4263
|
...r && { name: r },
|
|
4262
4264
|
...o && { folderId: o }
|
|
4263
|
-
},
|
|
4264
|
-
|
|
4265
|
-
body:
|
|
4265
|
+
}, T = JSON.stringify(m);
|
|
4266
|
+
d = await h(this, f, w).call(this, "PUT", `${b}/${e}`, {
|
|
4267
|
+
body: T,
|
|
4266
4268
|
contentType: "application/json"
|
|
4267
4269
|
});
|
|
4268
4270
|
}
|
|
4269
|
-
return { item:
|
|
4270
|
-
},
|
|
4271
|
+
return { item: d, version: c };
|
|
4272
|
+
}, Wt = async function(e, t) {
|
|
4271
4273
|
const { showVersions: s = !1 } = t || {};
|
|
4272
|
-
return await h(this, f,
|
|
4274
|
+
return await h(this, f, w).call(this, "GET", `${b}/${e}`, {
|
|
4273
4275
|
query: { showVersions: s }
|
|
4274
4276
|
});
|
|
4275
|
-
},
|
|
4277
|
+
}, Ks = function(e) {
|
|
4276
4278
|
return e && Object.entries(e).filter(([, t]) => t !== void 0).reduce(
|
|
4277
4279
|
(t, [s, r]) => (t[s] = r, t),
|
|
4278
4280
|
{}
|
|
4279
4281
|
);
|
|
4280
4282
|
};
|
|
4281
|
-
let
|
|
4282
|
-
function
|
|
4283
|
+
let Ht = is;
|
|
4284
|
+
function _r() {
|
|
4283
4285
|
if (typeof window > "u" || window.parent === window)
|
|
4284
4286
|
throw new Error(
|
|
4285
4287
|
"client.channel only works inside a That Open app, which runs in an iframe of the platform."
|
|
@@ -4294,80 +4296,80 @@ function br() {
|
|
|
4294
4296
|
}
|
|
4295
4297
|
};
|
|
4296
4298
|
}
|
|
4297
|
-
const
|
|
4298
|
-
function
|
|
4299
|
+
const Yt = "channel:", Ir = 1e4;
|
|
4300
|
+
function gt(n) {
|
|
4299
4301
|
try {
|
|
4300
4302
|
n();
|
|
4301
4303
|
} catch (e) {
|
|
4302
4304
|
console.error("[channel] a listener threw:", e);
|
|
4303
4305
|
}
|
|
4304
4306
|
}
|
|
4305
|
-
var
|
|
4306
|
-
class
|
|
4307
|
+
var ae, U, M, xe, Ne, Pe, F, zt, Kt, $e;
|
|
4308
|
+
class Xs {
|
|
4307
4309
|
constructor(e, t) {
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
|
|
4310
|
+
S(this, F);
|
|
4311
|
+
S(this, ae, !1);
|
|
4312
|
+
S(this, U, []);
|
|
4313
|
+
S(this, M, []);
|
|
4314
|
+
S(this, xe, /* @__PURE__ */ new Set());
|
|
4315
|
+
S(this, Ne, /* @__PURE__ */ new Set());
|
|
4316
|
+
S(this, Pe, /* @__PURE__ */ new Set());
|
|
4315
4317
|
this.transport = e, this.controls = t;
|
|
4316
4318
|
}
|
|
4317
4319
|
/** Whether the platform has confirmed this tab is in the room. */
|
|
4318
4320
|
get joined() {
|
|
4319
|
-
return
|
|
4321
|
+
return u(this, ae);
|
|
4320
4322
|
}
|
|
4321
4323
|
/** Who else is in the room right now, as the platform last reported. */
|
|
4322
4324
|
get peers() {
|
|
4323
|
-
return
|
|
4325
|
+
return u(this, U);
|
|
4324
4326
|
}
|
|
4325
4327
|
/**
|
|
4326
4328
|
* Enters the room. Resolves when the platform confirms; rejects if it
|
|
4327
4329
|
* refuses or does not answer in time. Joining twice is harmless.
|
|
4328
4330
|
*/
|
|
4329
4331
|
join() {
|
|
4330
|
-
return
|
|
4332
|
+
return u(this, ae) ? Promise.resolve() : h(this, F, zt).call(this, "joined", this.controls.join);
|
|
4331
4333
|
}
|
|
4332
4334
|
/** Leaves the room. Handlers stay registered, so `join()` resumes them. */
|
|
4333
4335
|
leave() {
|
|
4334
|
-
return !
|
|
4336
|
+
return !u(this, ae) && !u(this, M).some((e) => e.want === "joined") ? Promise.resolve() : h(this, F, zt).call(this, "left", this.controls.leave);
|
|
4335
4337
|
}
|
|
4336
4338
|
/** Fires when `joined` or `peers` changes. Returns a function that stops it. */
|
|
4337
4339
|
onChange(e) {
|
|
4338
|
-
return
|
|
4340
|
+
return u(this, xe).add(e), () => void u(this, xe).delete(e);
|
|
4339
4341
|
}
|
|
4340
4342
|
onPeerJoined(e) {
|
|
4341
|
-
return
|
|
4343
|
+
return u(this, Ne).add(e), () => void u(this, Ne).delete(e);
|
|
4342
4344
|
}
|
|
4343
4345
|
onPeerLeft(e) {
|
|
4344
|
-
return
|
|
4346
|
+
return u(this, Pe).add(e), () => void u(this, Pe).delete(e);
|
|
4345
4347
|
}
|
|
4346
4348
|
/** @internal */
|
|
4347
4349
|
applyJoined() {
|
|
4348
|
-
|
|
4350
|
+
R(this, ae, !0), h(this, F, Kt).call(this, "joined"), h(this, F, $e).call(this);
|
|
4349
4351
|
}
|
|
4350
4352
|
/** @internal */
|
|
4351
4353
|
applyLeft() {
|
|
4352
|
-
|
|
4354
|
+
R(this, ae, !1), R(this, U, []), h(this, F, Kt).call(this, "left"), h(this, F, $e).call(this);
|
|
4353
4355
|
}
|
|
4354
4356
|
/** @internal */
|
|
4355
4357
|
applyPeers(e) {
|
|
4356
|
-
|
|
4358
|
+
R(this, U, e), h(this, F, $e).call(this);
|
|
4357
4359
|
}
|
|
4358
4360
|
/** @internal */
|
|
4359
4361
|
applyPeerJoined(e) {
|
|
4360
|
-
!
|
|
4362
|
+
!u(this, ae) || u(this, U).some((t) => t.from === e.from) || (R(this, U, [...u(this, U), e]), u(this, Ne).forEach((t) => gt(() => t(e))), h(this, F, $e).call(this));
|
|
4361
4363
|
}
|
|
4362
4364
|
/** @internal */
|
|
4363
4365
|
applyPeerLeft(e) {
|
|
4364
|
-
const t =
|
|
4365
|
-
t && (
|
|
4366
|
+
const t = u(this, U).find((s) => s.from === e);
|
|
4367
|
+
t && (R(this, U, u(this, U).filter((s) => s.from !== e)), u(this, Pe).forEach((s) => gt(() => s(t))), h(this, F, $e).call(this));
|
|
4366
4368
|
}
|
|
4367
4369
|
/** @internal */
|
|
4368
4370
|
failPending(e) {
|
|
4369
|
-
const t =
|
|
4370
|
-
return
|
|
4371
|
+
const t = u(this, M);
|
|
4372
|
+
return R(this, M, []), t.forEach((s) => {
|
|
4371
4373
|
clearTimeout(s.timer), s.reject(e);
|
|
4372
4374
|
}), t.length > 0;
|
|
4373
4375
|
}
|
|
@@ -4375,77 +4377,77 @@ class Ps {
|
|
|
4375
4377
|
this.transport.post(e);
|
|
4376
4378
|
}
|
|
4377
4379
|
}
|
|
4378
|
-
|
|
4380
|
+
ae = new WeakMap(), U = new WeakMap(), M = new WeakMap(), xe = new WeakMap(), Ne = new WeakMap(), Pe = new WeakMap(), F = new WeakSet(), zt = function(e, t) {
|
|
4379
4381
|
return new Promise((s, r) => {
|
|
4380
4382
|
const i = {
|
|
4381
4383
|
want: e,
|
|
4382
4384
|
resolve: s,
|
|
4383
4385
|
reject: r,
|
|
4384
4386
|
timer: setTimeout(() => {
|
|
4385
|
-
|
|
4387
|
+
R(this, M, u(this, M).filter((o) => o !== i)), r(
|
|
4386
4388
|
new Error(
|
|
4387
4389
|
`The platform did not confirm ${e === "joined" ? "joining" : "leaving"} in time.`
|
|
4388
4390
|
)
|
|
4389
4391
|
);
|
|
4390
|
-
},
|
|
4392
|
+
}, Ir)
|
|
4391
4393
|
};
|
|
4392
|
-
|
|
4394
|
+
u(this, M).push(i), this.transport.post({ type: "APP_CHANNEL_CONTROL", ...t });
|
|
4393
4395
|
});
|
|
4394
|
-
},
|
|
4395
|
-
const t =
|
|
4396
|
-
|
|
4396
|
+
}, Kt = function(e) {
|
|
4397
|
+
const t = u(this, M).filter((s) => s.want === e);
|
|
4398
|
+
R(this, M, u(this, M).filter((s) => s.want !== e)), t.forEach((s) => {
|
|
4397
4399
|
clearTimeout(s.timer), s.resolve();
|
|
4398
4400
|
});
|
|
4399
|
-
},
|
|
4400
|
-
|
|
4401
|
+
}, $e = function() {
|
|
4402
|
+
u(this, xe).forEach((e) => gt(e));
|
|
4401
4403
|
};
|
|
4402
|
-
var
|
|
4403
|
-
class
|
|
4404
|
+
var Be;
|
|
4405
|
+
class Sr extends Xs {
|
|
4404
4406
|
/** @internal Use `client.channel.collab()`. */
|
|
4405
4407
|
constructor(t) {
|
|
4406
4408
|
super(t, {
|
|
4407
4409
|
join: { action: "joinCollab" },
|
|
4408
4410
|
leave: { action: "leaveCollab" }
|
|
4409
4411
|
});
|
|
4410
|
-
|
|
4412
|
+
S(this, Be, /* @__PURE__ */ new Map());
|
|
4411
4413
|
}
|
|
4412
4414
|
/**
|
|
4413
4415
|
* Listens for an event other tabs send. Any number of listeners per event.
|
|
4414
4416
|
* @returns a function that removes the listener.
|
|
4415
4417
|
*/
|
|
4416
4418
|
on(t, s) {
|
|
4417
|
-
const r =
|
|
4418
|
-
return r.add(s),
|
|
4419
|
+
const r = u(this, Be).get(t) ?? /* @__PURE__ */ new Set();
|
|
4420
|
+
return r.add(s), u(this, Be).set(t, r), () => void r.delete(s);
|
|
4419
4421
|
}
|
|
4420
4422
|
/**
|
|
4421
4423
|
* Sends an event to the other tabs in the room. Does nothing while this tab
|
|
4422
4424
|
* is not in it, matching what the platform does with a message from outside.
|
|
4423
4425
|
*/
|
|
4424
4426
|
send(t, s) {
|
|
4425
|
-
if (t.startsWith(
|
|
4426
|
-
throw new Error(`Message types starting with '${
|
|
4427
|
+
if (t.startsWith(Yt))
|
|
4428
|
+
throw new Error(`Message types starting with '${Yt}' are reserved.`);
|
|
4427
4429
|
this.joined && this.post({ type: "APP_CHANNEL_PUBLISH", message: { type: t, payload: s } });
|
|
4428
4430
|
}
|
|
4429
4431
|
accepts(t) {
|
|
4430
4432
|
return t === void 0 || t === "collab";
|
|
4431
4433
|
}
|
|
4432
4434
|
async handle(t) {
|
|
4433
|
-
const s =
|
|
4435
|
+
const s = u(this, Be).get(t.type);
|
|
4434
4436
|
if (!(s != null && s.size)) return { handled: !1 };
|
|
4435
|
-
const r =
|
|
4436
|
-
return s.forEach((i) =>
|
|
4437
|
+
const r = Qs(t);
|
|
4438
|
+
return s.forEach((i) => gt(() => i(t.payload, r))), { handled: !0 };
|
|
4437
4439
|
}
|
|
4438
4440
|
}
|
|
4439
|
-
|
|
4440
|
-
var
|
|
4441
|
-
class
|
|
4441
|
+
Be = new WeakMap();
|
|
4442
|
+
var pe;
|
|
4443
|
+
class kr extends Xs {
|
|
4442
4444
|
/** @internal Use `client.channel.external(kind)`. */
|
|
4443
4445
|
constructor(t, s) {
|
|
4444
4446
|
super(t, {
|
|
4445
4447
|
join: { action: "joinExternal", kind: s },
|
|
4446
4448
|
leave: { action: "leaveExternal", kind: s }
|
|
4447
4449
|
});
|
|
4448
|
-
|
|
4450
|
+
S(this, pe, /* @__PURE__ */ new Map());
|
|
4449
4451
|
this.kind = s;
|
|
4450
4452
|
}
|
|
4451
4453
|
/**
|
|
@@ -4459,24 +4461,24 @@ class _r extends Ps {
|
|
|
4459
4461
|
* @returns a function that removes the handler.
|
|
4460
4462
|
*/
|
|
4461
4463
|
on(t, s) {
|
|
4462
|
-
if (
|
|
4464
|
+
if (u(this, pe).has(t))
|
|
4463
4465
|
throw new Error(
|
|
4464
4466
|
`"${t}" already has a handler in this room. Remove it first.`
|
|
4465
4467
|
);
|
|
4466
|
-
return
|
|
4468
|
+
return u(this, pe).set(t, s), () => void u(this, pe).delete(t);
|
|
4467
4469
|
}
|
|
4468
4470
|
accepts(t, s) {
|
|
4469
4471
|
return t !== void 0 && t !== "external" ? !1 : this.kind === void 0 || t === void 0 || this.kind === s;
|
|
4470
4472
|
}
|
|
4471
4473
|
/** @internal Whether this room has any handler at all. */
|
|
4472
4474
|
get hasHandlers() {
|
|
4473
|
-
return
|
|
4475
|
+
return u(this, pe).size > 0;
|
|
4474
4476
|
}
|
|
4475
4477
|
async handle(t) {
|
|
4476
|
-
const s =
|
|
4478
|
+
const s = u(this, pe).get(t.type);
|
|
4477
4479
|
if (!s) return { handled: !1 };
|
|
4478
4480
|
try {
|
|
4479
|
-
return { handled: !0, value: await s(t.payload,
|
|
4481
|
+
return { handled: !0, value: await s(t.payload, Qs(t)) };
|
|
4480
4482
|
} catch (r) {
|
|
4481
4483
|
return {
|
|
4482
4484
|
handled: !0,
|
|
@@ -4485,8 +4487,8 @@ class _r extends Ps {
|
|
|
4485
4487
|
}
|
|
4486
4488
|
}
|
|
4487
4489
|
}
|
|
4488
|
-
|
|
4489
|
-
function
|
|
4490
|
+
pe = new WeakMap();
|
|
4491
|
+
function Qs(n) {
|
|
4490
4492
|
return {
|
|
4491
4493
|
from: n.from,
|
|
4492
4494
|
at: n.at,
|
|
@@ -4494,7 +4496,7 @@ function Bs(n) {
|
|
|
4494
4496
|
kind: n.kind
|
|
4495
4497
|
};
|
|
4496
4498
|
}
|
|
4497
|
-
function
|
|
4499
|
+
function Or(n) {
|
|
4498
4500
|
const e = n;
|
|
4499
4501
|
if ((e == null ? void 0 : e.type) !== "THATOPEN_CHANNEL_MESSAGE") return null;
|
|
4500
4502
|
const t = e.message;
|
|
@@ -4508,20 +4510,20 @@ function Tr(n) {
|
|
|
4508
4510
|
kind: typeof t.kind == "string" ? t.kind : void 0
|
|
4509
4511
|
};
|
|
4510
4512
|
}
|
|
4511
|
-
var
|
|
4512
|
-
class
|
|
4513
|
+
var Se, et, ce, me, ye, $, Xt, wt, Zs, en, tn, Qt;
|
|
4514
|
+
class Ar {
|
|
4513
4515
|
constructor(e) {
|
|
4514
|
-
|
|
4515
|
-
|
|
4516
|
-
|
|
4517
|
-
|
|
4518
|
-
|
|
4519
|
-
|
|
4520
|
-
|
|
4516
|
+
S(this, $);
|
|
4517
|
+
S(this, Se);
|
|
4518
|
+
S(this, et);
|
|
4519
|
+
S(this, ce);
|
|
4520
|
+
S(this, me, /* @__PURE__ */ new Map());
|
|
4521
|
+
S(this, ye, /* @__PURE__ */ new Set());
|
|
4522
|
+
R(this, Se, e), R(this, et, e.listen((t) => void h(this, $, Zs).call(this, t)));
|
|
4521
4523
|
}
|
|
4522
4524
|
/** The collaboration room for this app. Always the same instance. */
|
|
4523
4525
|
collab() {
|
|
4524
|
-
return
|
|
4526
|
+
return u(this, ce) ?? R(this, ce, new Sr(u(this, Se))), u(this, ce);
|
|
4525
4527
|
}
|
|
4526
4528
|
/**
|
|
4527
4529
|
* The room for commands from this account's external tools of one `kind`
|
|
@@ -4530,46 +4532,46 @@ class Ir {
|
|
|
4530
4532
|
*/
|
|
4531
4533
|
external(e) {
|
|
4532
4534
|
const t = e ?? "";
|
|
4533
|
-
let s =
|
|
4534
|
-
return s || (s = new
|
|
4535
|
+
let s = u(this, me).get(t);
|
|
4536
|
+
return s || (s = new kr(u(this, Se), e), u(this, me).set(t, s)), s;
|
|
4535
4537
|
}
|
|
4536
4538
|
/** Stops listening. For tests and teardown; an app normally never calls it. */
|
|
4537
4539
|
dispose() {
|
|
4538
|
-
|
|
4540
|
+
u(this, et).call(this);
|
|
4539
4541
|
}
|
|
4540
4542
|
}
|
|
4541
|
-
|
|
4542
|
-
return [...
|
|
4543
|
-
},
|
|
4544
|
-
if (e === "collab") return
|
|
4543
|
+
Se = new WeakMap(), et = new WeakMap(), ce = new WeakMap(), me = new WeakMap(), ye = new WeakMap(), $ = new WeakSet(), Xt = function() {
|
|
4544
|
+
return [...u(this, ce) ? [u(this, ce)] : [], ...u(this, me).values()];
|
|
4545
|
+
}, wt = function(e, t) {
|
|
4546
|
+
if (e === "collab") return u(this, ce);
|
|
4545
4547
|
if (e === "external")
|
|
4546
|
-
return
|
|
4547
|
-
},
|
|
4548
|
-
const t =
|
|
4548
|
+
return u(this, me).get(typeof t == "string" ? t : "");
|
|
4549
|
+
}, Zs = async function(e) {
|
|
4550
|
+
const t = Or(e);
|
|
4549
4551
|
if (t) {
|
|
4550
|
-
if (t.type.startsWith(
|
|
4551
|
-
h(this,
|
|
4552
|
+
if (t.type.startsWith(Yt)) {
|
|
4553
|
+
h(this, $, en).call(this, t);
|
|
4552
4554
|
return;
|
|
4553
4555
|
}
|
|
4554
|
-
await h(this,
|
|
4556
|
+
await h(this, $, tn).call(this, t);
|
|
4555
4557
|
}
|
|
4556
|
-
},
|
|
4558
|
+
}, en = function(e) {
|
|
4557
4559
|
var s, r, i;
|
|
4558
4560
|
const t = e.payload ?? {};
|
|
4559
4561
|
switch (e.type) {
|
|
4560
4562
|
case "channel:joined":
|
|
4561
|
-
(s = h(this,
|
|
4563
|
+
(s = h(this, $, wt).call(this, t.scope, t.kind)) == null || s.applyJoined();
|
|
4562
4564
|
break;
|
|
4563
4565
|
case "channel:left":
|
|
4564
|
-
(r = h(this,
|
|
4566
|
+
(r = h(this, $, wt).call(this, t.scope, t.kind)) == null || r.applyLeft();
|
|
4565
4567
|
break;
|
|
4566
4568
|
case "channel:peers":
|
|
4567
|
-
(i = h(this,
|
|
4569
|
+
(i = h(this, $, wt).call(this, t.scope, t.kind)) == null || i.applyPeers(t.peers ?? []);
|
|
4568
4570
|
break;
|
|
4569
4571
|
case "channel:peer-joined":
|
|
4570
4572
|
case "channel:peer-left": {
|
|
4571
4573
|
if (!t.from) break;
|
|
4572
|
-
const o = t.scope === "collab" ? [
|
|
4574
|
+
const o = t.scope === "collab" ? [u(this, ce)] : [...u(this, me).values()].filter(
|
|
4573
4575
|
(a) => a.accepts("external", t.kind)
|
|
4574
4576
|
);
|
|
4575
4577
|
for (const a of o)
|
|
@@ -4578,23 +4580,23 @@ pe = new WeakMap(), Fe = new WeakMap(), ee = new WeakMap(), he = new WeakMap(),
|
|
|
4578
4580
|
}
|
|
4579
4581
|
case "channel:error": {
|
|
4580
4582
|
const o = new Error(String(e.payload));
|
|
4581
|
-
h(this,
|
|
4583
|
+
h(this, $, Xt).call(this).map((l) => l.failPending(o)).some(Boolean) || console.error("[channel] error:", e.payload);
|
|
4582
4584
|
break;
|
|
4583
4585
|
}
|
|
4584
4586
|
}
|
|
4585
|
-
},
|
|
4586
|
-
const t = h(this,
|
|
4587
|
+
}, tn = async function(e) {
|
|
4588
|
+
const t = h(this, $, Xt).call(this).filter((i) => i.accepts(e.scope, e.kind));
|
|
4587
4589
|
let s = !1;
|
|
4588
4590
|
for (const i of t) {
|
|
4589
4591
|
const o = await i.handle(e);
|
|
4590
|
-
o.handled && (s = !0, e.requestId && h(this,
|
|
4592
|
+
o.handled && (s = !0, e.requestId && h(this, $, Qt).call(this, e.requestId, o));
|
|
4591
4593
|
}
|
|
4592
|
-
e.requestId && e.scope === "external" && t.length > 0 && !s && h(this,
|
|
4594
|
+
e.requestId && e.scope === "external" && t.length > 0 && !s && h(this, $, Qt).call(this, e.requestId, {
|
|
4593
4595
|
handled: !0,
|
|
4594
4596
|
error: `No handler for "${e.type}".`
|
|
4595
4597
|
});
|
|
4596
|
-
},
|
|
4597
|
-
|
|
4598
|
+
}, Qt = function(e, t) {
|
|
4599
|
+
u(this, ye).has(e) || (u(this, ye).add(e), u(this, ye).size > 500 && u(this, ye).delete(u(this, ye).values().next().value), u(this, Se).post({
|
|
4598
4600
|
type: "APP_CHANNEL_PUBLISH",
|
|
4599
4601
|
message: {
|
|
4600
4602
|
type: t.error === void 0 ? "reply" : "reply-error",
|
|
@@ -4603,9 +4605,9 @@ pe = new WeakMap(), Fe = new WeakMap(), ee = new WeakMap(), he = new WeakMap(),
|
|
|
4603
4605
|
}
|
|
4604
4606
|
}));
|
|
4605
4607
|
};
|
|
4606
|
-
const
|
|
4607
|
-
var
|
|
4608
|
-
const
|
|
4608
|
+
const Ie = "project", Ae = "notifications";
|
|
4609
|
+
var Fe, tt;
|
|
4610
|
+
const os = class os extends Ht {
|
|
4609
4611
|
/**
|
|
4610
4612
|
* @param token - A bearer JWT, OR a function returning the current JWT
|
|
4611
4613
|
* (sync or async). When a function is passed, it's invoked before every
|
|
@@ -4616,12 +4618,12 @@ const jt = class jt extends Tt {
|
|
|
4616
4618
|
*/
|
|
4617
4619
|
constructor(t, s, r) {
|
|
4618
4620
|
super(typeof t == "string" ? t : "", s, { ...r, useBearer: !0 });
|
|
4619
|
-
|
|
4620
|
-
|
|
4621
|
-
typeof t == "function" &&
|
|
4621
|
+
S(this, Fe);
|
|
4622
|
+
S(this, tt);
|
|
4623
|
+
typeof t == "function" && R(this, Fe, t);
|
|
4622
4624
|
}
|
|
4623
4625
|
async resolveAccessToken() {
|
|
4624
|
-
return
|
|
4626
|
+
return u(this, Fe) ? await u(this, Fe).call(this) : super.resolveAccessToken();
|
|
4625
4627
|
}
|
|
4626
4628
|
/**
|
|
4627
4629
|
* Creates a client from the platform context injected into
|
|
@@ -4630,7 +4632,7 @@ const jt = class jt extends Tt {
|
|
|
4630
4632
|
* carries a fresh JWT on every navigation.
|
|
4631
4633
|
*/
|
|
4632
4634
|
static fromPlatformContext(t) {
|
|
4633
|
-
const s = (typeof window < "u" ? window.__THATOPEN_CONTEXT__ : null) || { appId: "", projectId: "", accessToken: "", apiUrl: "" }, r = new
|
|
4635
|
+
const s = (typeof window < "u" ? window.__THATOPEN_CONTEXT__ : null) || { appId: "", projectId: "", accessToken: "", apiUrl: "" }, r = new os(s.accessToken, s.apiUrl, t);
|
|
4634
4636
|
return r.context = s, r;
|
|
4635
4637
|
}
|
|
4636
4638
|
/**
|
|
@@ -4658,7 +4660,7 @@ const jt = class jt extends Tt {
|
|
|
4658
4660
|
* ```
|
|
4659
4661
|
*/
|
|
4660
4662
|
get channel() {
|
|
4661
|
-
return
|
|
4663
|
+
return u(this, tt) ?? R(this, tt, new Ar(_r())), u(this, tt);
|
|
4662
4664
|
}
|
|
4663
4665
|
// ─── Projects (JWT-only backend routes) ──────────────────────────
|
|
4664
4666
|
/**
|
|
@@ -4677,14 +4679,14 @@ const jt = class jt extends Tt {
|
|
|
4677
4679
|
* ```
|
|
4678
4680
|
*/
|
|
4679
4681
|
async listProjects() {
|
|
4680
|
-
return await this.request("GET",
|
|
4682
|
+
return await this.request("GET", Ie);
|
|
4681
4683
|
}
|
|
4682
4684
|
/**
|
|
4683
4685
|
* Gets a project by ID. JWT-only — lives here because
|
|
4684
4686
|
* `GET /project/:id` is guarded by `AccountActiveGuard + ProjectAccessGuard`.
|
|
4685
4687
|
*/
|
|
4686
4688
|
async getProject(t) {
|
|
4687
|
-
return await this.request("GET", `${
|
|
4689
|
+
return await this.request("GET", `${Ie}/${t}`);
|
|
4688
4690
|
}
|
|
4689
4691
|
/**
|
|
4690
4692
|
* Gets the full project data (users, roles, files, folders) for a project.
|
|
@@ -4693,7 +4695,7 @@ const jt = class jt extends Tt {
|
|
|
4693
4695
|
async getProjectData(t) {
|
|
4694
4696
|
return await this.request(
|
|
4695
4697
|
"GET",
|
|
4696
|
-
`${
|
|
4698
|
+
`${Ie}/${t}/data`
|
|
4697
4699
|
);
|
|
4698
4700
|
}
|
|
4699
4701
|
// ─── Account ──────────────────────────────────────────────────────
|
|
@@ -4718,7 +4720,7 @@ const jt = class jt extends Tt {
|
|
|
4718
4720
|
async checkPermission(t) {
|
|
4719
4721
|
return await this.request(
|
|
4720
4722
|
"GET",
|
|
4721
|
-
`${
|
|
4723
|
+
`${Ie}/permissions/check`,
|
|
4722
4724
|
{ query: t }
|
|
4723
4725
|
);
|
|
4724
4726
|
}
|
|
@@ -4727,7 +4729,7 @@ const jt = class jt extends Tt {
|
|
|
4727
4729
|
* single round-trip; results come back in the same order as `checks`.
|
|
4728
4730
|
*/
|
|
4729
4731
|
async checkPermissionBatch(t) {
|
|
4730
|
-
return (await this.request("POST", `${
|
|
4732
|
+
return (await this.request("POST", `${Ie}/permissions/check/batch`, {
|
|
4731
4733
|
body: JSON.stringify({ checks: t }),
|
|
4732
4734
|
contentType: "application/json"
|
|
4733
4735
|
})).results;
|
|
@@ -4755,7 +4757,7 @@ const jt = class jt extends Tt {
|
|
|
4755
4757
|
* ```
|
|
4756
4758
|
*/
|
|
4757
4759
|
async getNotifications(t) {
|
|
4758
|
-
return await this.request("GET",
|
|
4760
|
+
return await this.request("GET", Ae, {
|
|
4759
4761
|
query: {
|
|
4760
4762
|
...(t == null ? void 0 : t.cursor) !== void 0 && { cursor: t.cursor },
|
|
4761
4763
|
...(t == null ? void 0 : t.limit) !== void 0 && { limit: String(t.limit) }
|
|
@@ -4769,7 +4771,7 @@ const jt = class jt extends Tt {
|
|
|
4769
4771
|
async getUnreadNotificationCount() {
|
|
4770
4772
|
return (await this.request(
|
|
4771
4773
|
"GET",
|
|
4772
|
-
`${
|
|
4774
|
+
`${Ae}/unread-count`
|
|
4773
4775
|
)).count;
|
|
4774
4776
|
}
|
|
4775
4777
|
/**
|
|
@@ -4780,7 +4782,7 @@ const jt = class jt extends Tt {
|
|
|
4780
4782
|
async markNotificationsRead(t) {
|
|
4781
4783
|
return await this.request(
|
|
4782
4784
|
"POST",
|
|
4783
|
-
`${
|
|
4785
|
+
`${Ae}/mark-read`,
|
|
4784
4786
|
{
|
|
4785
4787
|
body: JSON.stringify({ ids: t }),
|
|
4786
4788
|
contentType: "application/json"
|
|
@@ -4791,7 +4793,7 @@ const jt = class jt extends Tt {
|
|
|
4791
4793
|
async markAllNotificationsRead() {
|
|
4792
4794
|
return await this.request(
|
|
4793
4795
|
"POST",
|
|
4794
|
-
`${
|
|
4796
|
+
`${Ae}/mark-all-read`
|
|
4795
4797
|
);
|
|
4796
4798
|
}
|
|
4797
4799
|
/**
|
|
@@ -4801,7 +4803,7 @@ const jt = class jt extends Tt {
|
|
|
4801
4803
|
async getNotificationSubscriptions() {
|
|
4802
4804
|
return await this.request(
|
|
4803
4805
|
"GET",
|
|
4804
|
-
`${
|
|
4806
|
+
`${Ae}/subscriptions`
|
|
4805
4807
|
);
|
|
4806
4808
|
}
|
|
4807
4809
|
/**
|
|
@@ -4815,7 +4817,7 @@ const jt = class jt extends Tt {
|
|
|
4815
4817
|
async unsubscribeFromAutomation(t) {
|
|
4816
4818
|
return await this.request(
|
|
4817
4819
|
"DELETE",
|
|
4818
|
-
`${
|
|
4820
|
+
`${Ae}/subscriptions/${t}`
|
|
4819
4821
|
);
|
|
4820
4822
|
}
|
|
4821
4823
|
/**
|
|
@@ -4839,7 +4841,7 @@ const jt = class jt extends Tt {
|
|
|
4839
4841
|
async subscribeToAutomation(t, s, r) {
|
|
4840
4842
|
return await this.request(
|
|
4841
4843
|
"POST",
|
|
4842
|
-
`${
|
|
4844
|
+
`${Ie}/${t}/events/hooks/${s}/subscription`,
|
|
4843
4845
|
{
|
|
4844
4846
|
body: JSON.stringify(r ?? {}),
|
|
4845
4847
|
contentType: "application/json"
|
|
@@ -4856,7 +4858,7 @@ const jt = class jt extends Tt {
|
|
|
4856
4858
|
async updateAutomationSubscription(t, s, r) {
|
|
4857
4859
|
return await this.request(
|
|
4858
4860
|
"PATCH",
|
|
4859
|
-
`${
|
|
4861
|
+
`${Ie}/${t}/events/hooks/${s}/subscription`,
|
|
4860
4862
|
{
|
|
4861
4863
|
body: JSON.stringify(r),
|
|
4862
4864
|
contentType: "application/json"
|
|
@@ -4890,7 +4892,7 @@ const jt = class jt extends Tt {
|
|
|
4890
4892
|
* ```
|
|
4891
4893
|
*/
|
|
4892
4894
|
async onNotification(t) {
|
|
4893
|
-
const s = await this.resolveAccessToken(), r =
|
|
4895
|
+
const s = await this.resolveAccessToken(), r = Ke(`${this.socketOrigin}/notifications`, {
|
|
4894
4896
|
auth: { accessToken: s },
|
|
4895
4897
|
transports: ["websocket"]
|
|
4896
4898
|
});
|
|
@@ -4906,11 +4908,11 @@ const jt = class jt extends Tt {
|
|
|
4906
4908
|
), () => r.disconnect();
|
|
4907
4909
|
}
|
|
4908
4910
|
};
|
|
4909
|
-
|
|
4910
|
-
let
|
|
4911
|
-
async function
|
|
4912
|
-
const [e, t] = await
|
|
4913
|
-
new e.ByteBuffer(await
|
|
4911
|
+
Fe = new WeakMap(), tt = new WeakMap();
|
|
4912
|
+
let _s = os;
|
|
4913
|
+
async function sn(n) {
|
|
4914
|
+
const [e, t] = await Rr(), s = t.Model.getRootAsModel(
|
|
4915
|
+
new e.ByteBuffer(await Cr(n))
|
|
4914
4916
|
);
|
|
4915
4917
|
let r = {};
|
|
4916
4918
|
try {
|
|
@@ -4919,20 +4921,20 @@ async function js(n) {
|
|
|
4919
4921
|
}
|
|
4920
4922
|
const i = /* @__PURE__ */ new Map();
|
|
4921
4923
|
for (let a = 0; a < s.guidsLength(); a++) {
|
|
4922
|
-
const l = s.guidsItems(a),
|
|
4923
|
-
l !== null &&
|
|
4924
|
+
const l = s.guidsItems(a), d = s.guids(a);
|
|
4925
|
+
l !== null && d && i.set(l, d);
|
|
4924
4926
|
}
|
|
4925
4927
|
const o = [];
|
|
4926
4928
|
for (let a = 0; a < s.attributesLength(); a++) {
|
|
4927
4929
|
const l = s.localIds(a);
|
|
4928
4930
|
if (l === null) continue;
|
|
4929
|
-
const
|
|
4931
|
+
const d = {}, c = s.attributes(a);
|
|
4930
4932
|
for (let m = 0; m < ((c == null ? void 0 : c.dataLength()) ?? 0); m++) {
|
|
4931
|
-
const
|
|
4932
|
-
if (
|
|
4933
|
+
const T = c.data(m);
|
|
4934
|
+
if (T)
|
|
4933
4935
|
try {
|
|
4934
|
-
const [
|
|
4935
|
-
|
|
4936
|
+
const [A, _] = JSON.parse(T);
|
|
4937
|
+
d[A] = _;
|
|
4936
4938
|
} catch {
|
|
4937
4939
|
}
|
|
4938
4940
|
}
|
|
@@ -4940,12 +4942,12 @@ async function js(n) {
|
|
|
4940
4942
|
localId: l,
|
|
4941
4943
|
guid: i.get(l) ?? null,
|
|
4942
4944
|
category: s.categories(a) ?? null,
|
|
4943
|
-
attrs:
|
|
4945
|
+
attrs: d
|
|
4944
4946
|
});
|
|
4945
4947
|
}
|
|
4946
4948
|
return { metadata: r, items: o };
|
|
4947
4949
|
}
|
|
4948
|
-
async function
|
|
4950
|
+
async function Rr() {
|
|
4949
4951
|
try {
|
|
4950
4952
|
return await Promise.all([
|
|
4951
4953
|
import("flatbuffers"),
|
|
@@ -4957,14 +4959,14 @@ async function Sr() {
|
|
|
4957
4959
|
);
|
|
4958
4960
|
}
|
|
4959
4961
|
}
|
|
4960
|
-
async function
|
|
4962
|
+
async function Cr(n) {
|
|
4961
4963
|
const e = new Blob([n]).stream().pipeThrough(new DecompressionStream("deflate"));
|
|
4962
4964
|
return new Uint8Array(await new Response(e).arrayBuffer());
|
|
4963
4965
|
}
|
|
4964
|
-
const
|
|
4965
|
-
class
|
|
4966
|
+
const $r = "flow:", xr = "flow:op", Nr = "flow:source", Pr = "revitflow/op@2", Is = "REVITFLOWCHANGE", Ss = "REVITFLOWOPERATION";
|
|
4967
|
+
class nn {
|
|
4966
4968
|
constructor(e) {
|
|
4967
|
-
|
|
4969
|
+
B(this, "changes", []);
|
|
4968
4970
|
this.target = e;
|
|
4969
4971
|
}
|
|
4970
4972
|
/** How many changes are queued. An operation with none is refused by `build`. */
|
|
@@ -5030,7 +5032,7 @@ class Ds {
|
|
|
5030
5032
|
"An operation with no changes is not an operation. Add at least one."
|
|
5031
5033
|
);
|
|
5032
5034
|
const t = {
|
|
5033
|
-
schema:
|
|
5035
|
+
schema: Pr,
|
|
5034
5036
|
opId: e,
|
|
5035
5037
|
// Through the getters, so the envelope and the queue entry cannot drift
|
|
5036
5038
|
// into disagreeing about the same operation.
|
|
@@ -5042,8 +5044,8 @@ class Ds {
|
|
|
5042
5044
|
...this.userId ? { userId: this.userId } : {},
|
|
5043
5045
|
title: this.title,
|
|
5044
5046
|
summary: this.summary
|
|
5045
|
-
}, [s, r] = await
|
|
5046
|
-
return
|
|
5047
|
+
}, [s, r] = await Br();
|
|
5048
|
+
return Fr(
|
|
5047
5049
|
this.flatbuffer(s, r, e, JSON.stringify(t))
|
|
5048
5050
|
);
|
|
5049
5051
|
}
|
|
@@ -5052,8 +5054,8 @@ class Ds {
|
|
|
5052
5054
|
pack(e, t) {
|
|
5053
5055
|
const s = {};
|
|
5054
5056
|
for (const [r, i] of Object.entries(e ?? {}))
|
|
5055
|
-
r.startsWith(
|
|
5056
|
-
return t.position && (s.Position = t.position.map(
|
|
5057
|
+
r.startsWith($r) || (s[r] = String(i));
|
|
5058
|
+
return t.position && (s.Position = t.position.map(ks).join(",")), t.rotationDeg !== void 0 && (s.Rotation = ks(t.rotationDeg)), t.source && (s[Nr] = t.source), s;
|
|
5057
5059
|
}
|
|
5058
5060
|
requireId(e, t) {
|
|
5059
5061
|
if (!e || !e.trim())
|
|
@@ -5075,61 +5077,61 @@ class Ds {
|
|
|
5075
5077
|
* and rejects a falsy one.
|
|
5076
5078
|
*/
|
|
5077
5079
|
flatbuffer(e, t, s, r) {
|
|
5078
|
-
const { Attribute: i, Meshes: o, Model: a, SpatialStructure: l, Transform:
|
|
5079
|
-
let
|
|
5080
|
-
for (let
|
|
5081
|
-
const
|
|
5082
|
-
o.startMeshes(c), o.addCoordinates(c,
|
|
5083
|
-
const
|
|
5084
|
-
for (const
|
|
5085
|
-
const
|
|
5086
|
-
[
|
|
5087
|
-
...
|
|
5080
|
+
const { Attribute: i, Meshes: o, Model: a, SpatialStructure: l, Transform: d } = t, c = new e.Builder(1024), m = this.changes.length, T = new Uint32Array(m);
|
|
5081
|
+
let A = 1;
|
|
5082
|
+
for (let I = 0; I < m; I++) T[I] = A++;
|
|
5083
|
+
const _ = A++, E = (I) => (I(c, 0), c.endVector()), N = o.createShellsVector(c, []), we = o.createCircleExtrusionsVector(c, []), H = E(o.startSamplesVector), z = E(o.startRepresentationsVector), De = E(o.startMaterialsVector), K = E(o.startLocalTransformsVector), O = E(o.startGlobalTransformsVector), q = o.createMeshesItemsVector(c, []), X = o.createMaterialIdsVector(c, []), be = o.createRepresentationIdsVector(c, []), ve = o.createSampleIdsVector(c, []), Ee = o.createLocalTransformIdsVector(c, []), qe = o.createGlobalTransformIdsVector(c, []);
|
|
5084
|
+
o.startMeshes(c), o.addCoordinates(c, d.createTransform(c, 0, 0, 0, 1, 0, 0, 0, 1, 0)), o.addGlobalTransforms(c, O), o.addShells(c, N), o.addRepresentations(c, z), o.addSamples(c, H), o.addLocalTransforms(c, K), o.addMaterials(c, De), o.addCircleExtrusions(c, we), o.addMeshesItems(c, q), o.addRepresentationIds(c, be), o.addSampleIds(c, ve), o.addMaterialIds(c, X), o.addLocalTransformIds(c, Ee), o.addGlobalTransformIds(c, qe);
|
|
5085
|
+
const je = o.endMeshes(c), Te = c.createString(r), Ue = /* @__PURE__ */ new Set(), Oe = [];
|
|
5086
|
+
for (const I of this.changes) {
|
|
5087
|
+
const D = [], _e = {
|
|
5088
|
+
[xr]: I.op,
|
|
5089
|
+
...I.attrs
|
|
5088
5090
|
};
|
|
5089
|
-
for (const [
|
|
5090
|
-
const
|
|
5091
|
-
|
|
5091
|
+
for (const [j, G] of Object.entries(_e)) {
|
|
5092
|
+
const Q = JSON.stringify([j, G, "IFCTEXT"]);
|
|
5093
|
+
Ue.add(Q), D.push(c.createString(Q));
|
|
5092
5094
|
}
|
|
5093
|
-
|
|
5094
|
-
i.createAttribute(c, i.createDataVector(c,
|
|
5095
|
+
Oe.push(
|
|
5096
|
+
i.createAttribute(c, i.createDataVector(c, D))
|
|
5095
5097
|
);
|
|
5096
5098
|
}
|
|
5097
5099
|
{
|
|
5098
|
-
const
|
|
5099
|
-
|
|
5100
|
-
const
|
|
5101
|
-
|
|
5100
|
+
const I = JSON.stringify(["Name", s, "IFCLABEL"]);
|
|
5101
|
+
Ue.add(I);
|
|
5102
|
+
const D = i.createDataVector(c, [c.createString(I)]);
|
|
5103
|
+
Oe.push(i.createAttribute(c, D));
|
|
5102
5104
|
}
|
|
5103
|
-
const
|
|
5105
|
+
const st = a.createAttributesVector(c, Oe), nt = a.createUniqueAttributesVector(
|
|
5104
5106
|
c,
|
|
5105
|
-
[...
|
|
5106
|
-
),
|
|
5107
|
-
() => c.createString(
|
|
5107
|
+
[...Ue].map((I) => c.createString(I))
|
|
5108
|
+
), Me = this.changes.map(
|
|
5109
|
+
() => c.createString(Is)
|
|
5108
5110
|
);
|
|
5109
|
-
|
|
5110
|
-
const
|
|
5111
|
-
this.changes.forEach((
|
|
5112
|
-
|
|
5111
|
+
Me.push(c.createString(Ss));
|
|
5112
|
+
const rt = a.createCategoriesVector(c, Me), Ve = [], He = [];
|
|
5113
|
+
this.changes.forEach((I, D) => {
|
|
5114
|
+
I.item && (Ve.push(c.createString(I.item)), He.push(T[D]));
|
|
5113
5115
|
});
|
|
5114
|
-
const
|
|
5115
|
-
(
|
|
5116
|
+
const g = a.createGuidsVector(c, Ve), y = a.createGuidsItemsVector(c, He), k = a.createLocalIdsVector(c, [...T, _]), x = this.changes.map(
|
|
5117
|
+
(I, D) => l.createSpatialStructure(
|
|
5116
5118
|
c,
|
|
5117
|
-
|
|
5118
|
-
c.createString(
|
|
5119
|
+
T[D],
|
|
5120
|
+
c.createString(Is),
|
|
5119
5121
|
0
|
|
5120
5122
|
)
|
|
5121
|
-
),
|
|
5123
|
+
), P = l.createSpatialStructure(
|
|
5122
5124
|
c,
|
|
5123
|
-
|
|
5124
|
-
c.createString(
|
|
5125
|
-
l.createChildrenVector(c,
|
|
5126
|
-
),
|
|
5127
|
-
a.startModel(c), a.addMeshes(c,
|
|
5128
|
-
const
|
|
5129
|
-
return a.finishModelBuffer(c,
|
|
5125
|
+
_,
|
|
5126
|
+
c.createString(Ss),
|
|
5127
|
+
l.createChildrenVector(c, x)
|
|
5128
|
+
), L = c.createString(s);
|
|
5129
|
+
a.startModel(c), a.addMeshes(c, je), a.addMetadata(c, Te), a.addAttributes(c, st), a.addUniqueAttributes(c, nt), a.addLocalIds(c, k), a.addCategories(c, rt), a.addGuidsItems(c, y), a.addGuids(c, g), a.addGuid(c, L), a.addSpatialStructure(c, P), a.addMaxLocalId(c, A);
|
|
5130
|
+
const he = a.endModel(c);
|
|
5131
|
+
return a.finishModelBuffer(c, he), c.asUint8Array();
|
|
5130
5132
|
}
|
|
5131
5133
|
}
|
|
5132
|
-
async function
|
|
5134
|
+
async function Br() {
|
|
5133
5135
|
try {
|
|
5134
5136
|
return await Promise.all([
|
|
5135
5137
|
import("flatbuffers"),
|
|
@@ -5141,18 +5143,18 @@ async function $r() {
|
|
|
5141
5143
|
);
|
|
5142
5144
|
}
|
|
5143
5145
|
}
|
|
5144
|
-
function
|
|
5146
|
+
function ks(n) {
|
|
5145
5147
|
return Number.isFinite(n) ? String(n) : "0";
|
|
5146
5148
|
}
|
|
5147
|
-
async function
|
|
5149
|
+
async function Fr(n) {
|
|
5148
5150
|
const e = new Blob([n]).stream().pipeThrough(new CompressionStream("deflate"));
|
|
5149
5151
|
return new Uint8Array(await new Response(e).arrayBuffer());
|
|
5150
5152
|
}
|
|
5151
|
-
const
|
|
5152
|
-
function
|
|
5153
|
+
const Lr = "Element", Dr = "Carried", rn = 1 / 0.3048;
|
|
5154
|
+
function qr(n) {
|
|
5153
5155
|
const e = [];
|
|
5154
5156
|
for (const t of n)
|
|
5155
|
-
for (const s of [
|
|
5157
|
+
for (const s of [Lr, Dr]) {
|
|
5156
5158
|
const r = t.attrs[s];
|
|
5157
5159
|
if (r)
|
|
5158
5160
|
try {
|
|
@@ -5171,7 +5173,7 @@ function Br(n) {
|
|
|
5171
5173
|
}
|
|
5172
5174
|
return e;
|
|
5173
5175
|
}
|
|
5174
|
-
function
|
|
5176
|
+
function ht(n, e) {
|
|
5175
5177
|
const t = n.params[e];
|
|
5176
5178
|
if (typeof t != "string") return null;
|
|
5177
5179
|
try {
|
|
@@ -5180,16 +5182,25 @@ function hs(n, e) {
|
|
|
5180
5182
|
return null;
|
|
5181
5183
|
}
|
|
5182
5184
|
}
|
|
5183
|
-
function
|
|
5185
|
+
function jr(n) {
|
|
5184
5186
|
const e = /* @__PURE__ */ new Map();
|
|
5185
5187
|
for (const t of n) {
|
|
5186
5188
|
if (t.kind !== "datum" || t.params.of !== "level") continue;
|
|
5187
|
-
const s = t.params.named;
|
|
5188
|
-
typeof s == "string" && e.set(t.id, s);
|
|
5189
|
+
const s = t.params.named, r = t.params.at;
|
|
5190
|
+
typeof s == "string" && typeof r == "number" && e.set(t.id, { name: s, at: r });
|
|
5191
|
+
}
|
|
5192
|
+
return e;
|
|
5193
|
+
}
|
|
5194
|
+
function Ur(n) {
|
|
5195
|
+
const e = /* @__PURE__ */ new Map();
|
|
5196
|
+
for (const t of n) {
|
|
5197
|
+
if (!t.kind.endsWith("Style")) continue;
|
|
5198
|
+
const s = t.params.name;
|
|
5199
|
+
typeof s == "string" && e.set(s, t);
|
|
5189
5200
|
}
|
|
5190
5201
|
return e;
|
|
5191
5202
|
}
|
|
5192
|
-
async function
|
|
5203
|
+
async function on(n, e) {
|
|
5193
5204
|
const t = /* @__PURE__ */ new Map(), s = (await n.targetDoc.suggestions()).filter(
|
|
5194
5205
|
(r) => {
|
|
5195
5206
|
var i;
|
|
@@ -5198,129 +5209,203 @@ async function Ms(n, e) {
|
|
|
5198
5209
|
).sort((r, i) => String(r.createdAt).localeCompare(String(i.createdAt)));
|
|
5199
5210
|
for (const r of s)
|
|
5200
5211
|
try {
|
|
5201
|
-
const i = await n.targetDoc.suggestionPayload(r), { items: o } = await
|
|
5212
|
+
const i = await n.targetDoc.suggestionPayload(r), { items: o } = await sn(
|
|
5202
5213
|
new Uint8Array(await i.arrayBuffer())
|
|
5203
|
-
), a = o.filter((
|
|
5204
|
-
for (let
|
|
5205
|
-
const c = a[
|
|
5206
|
-
c && (a[
|
|
5214
|
+
), a = o.filter((d) => d.attrs["flow:op"]), l = r.affectedIds ?? [];
|
|
5215
|
+
for (let d = 0; d < a.length && d < l.length; d++) {
|
|
5216
|
+
const c = a[d].attrs["flow:source"];
|
|
5217
|
+
c && (a[d].attrs["flow:op"] === "remove" ? t.delete(c) : t.set(c, l[d]));
|
|
5207
5218
|
}
|
|
5208
5219
|
} catch {
|
|
5209
5220
|
}
|
|
5210
5221
|
return t;
|
|
5211
5222
|
}
|
|
5212
|
-
async function
|
|
5223
|
+
async function an(n, e) {
|
|
5213
5224
|
if (!(e != null && e.fileId)) throw new Error("Choose the model file to read.");
|
|
5214
5225
|
const t = new Uint8Array(
|
|
5215
5226
|
await (await n.client.downloadFile(e.fileId)).arrayBuffer()
|
|
5216
5227
|
);
|
|
5217
|
-
return { picked: e, contents: await
|
|
5228
|
+
return { picked: e, contents: await sn(t) };
|
|
5218
5229
|
}
|
|
5219
|
-
const
|
|
5220
|
-
|
|
5230
|
+
const Rt = {
|
|
5231
|
+
levels: "-2000240",
|
|
5232
|
+
walls: "-2000011",
|
|
5233
|
+
floors: "-2000032"
|
|
5234
|
+
}, Os = 180 / Math.PI;
|
|
5235
|
+
function As(n) {
|
|
5221
5236
|
if (typeof n != "string") return null;
|
|
5222
5237
|
const e = n.indexOf(":");
|
|
5223
5238
|
return e <= 0 || e === n.length - 1 ? null : { family: n.slice(0, e), type: n.slice(e + 1) };
|
|
5224
5239
|
}
|
|
5225
|
-
|
|
5240
|
+
const J = (n) => String(n);
|
|
5241
|
+
function cn(n) {
|
|
5226
5242
|
return async (e) => {
|
|
5227
|
-
var
|
|
5228
|
-
const { picked: t, contents: s } = await
|
|
5243
|
+
var Oe, st, nt, Me, rt, Ve, He;
|
|
5244
|
+
const { picked: t, contents: s } = await an(
|
|
5229
5245
|
e,
|
|
5230
5246
|
e.input
|
|
5231
|
-
), r =
|
|
5247
|
+
), r = qr(s.items);
|
|
5232
5248
|
if (r.length === 0)
|
|
5233
5249
|
throw new Error(
|
|
5234
5250
|
n === "ifc" ? `"${t.name}" carries no platform records: it was imported without the editable converter. Process the IFC with the editable converter first; a plain import only has IFC attributes, and guessing geometry is not this recipe.` : `"${t.name}" carries no platform records, so there is nothing semantic to convert.`
|
|
5235
5251
|
);
|
|
5236
|
-
const { columnType: i, trustStyleNames: o, includeInstances: a } = e.settings;
|
|
5237
|
-
if (!i && !o)
|
|
5238
|
-
throw new Error(
|
|
5239
|
-
"Choose the Revit column type, or trust the model style names."
|
|
5240
|
-
);
|
|
5252
|
+
const { columnType: i, trustStyleNames: o, includeInstances: a } = e.settings, l = e.settings.createLevels !== !1;
|
|
5241
5253
|
if (a && !o)
|
|
5242
5254
|
throw new Error(
|
|
5243
5255
|
"Free-standing instances can only be proposed by their style names: turn trustStyleNames on."
|
|
5244
5256
|
);
|
|
5245
|
-
const
|
|
5257
|
+
const d = jr(r), c = Ur(r), m = `recipe:${n}-to-revit`, T = await on(e, m), A = await e.targetDoc.latest(), _ = new nn({
|
|
5246
5258
|
project: e.projectId,
|
|
5247
5259
|
document: e.targetDoc.docId,
|
|
5248
|
-
baseCommit: (
|
|
5249
|
-
author:
|
|
5250
|
-
}),
|
|
5251
|
-
let
|
|
5252
|
-
const
|
|
5253
|
-
const
|
|
5254
|
-
|
|
5255
|
-
const K = c.get(B);
|
|
5256
|
-
K ? w.set(K, {}, { position: $, rotationDeg: U, source: B }) : w.add(v, { position: $, rotationDeg: U, source: B });
|
|
5260
|
+
baseCommit: (A == null ? void 0 : A.version) ?? 0,
|
|
5261
|
+
author: m
|
|
5262
|
+
}), E = rn, N = (g) => `${t.fileId}:${g}`, we = /* @__PURE__ */ new Set();
|
|
5263
|
+
let H = 0;
|
|
5264
|
+
const z = (g, y, k) => (we.add(g), T.has(g) ? (H++, !1) : (_.add(y, { ...k, source: g }), !0)), De = (g) => {
|
|
5265
|
+
const y = typeof g == "string" ? c.get(g) : void 0, k = y == null ? void 0 : y.params.thickness;
|
|
5266
|
+
return typeof k == "number" && k > 0 ? k * E : void 0;
|
|
5257
5267
|
};
|
|
5258
|
-
|
|
5259
|
-
|
|
5260
|
-
|
|
5261
|
-
|
|
5262
|
-
|
|
5263
|
-
|
|
5264
|
-
|
|
5265
|
-
|
|
5266
|
-
|
|
5267
|
-
|
|
5268
|
-
|
|
5269
|
-
|
|
5270
|
-
|
|
5271
|
-
|
|
5272
|
-
Family: B.family,
|
|
5273
|
-
Type: B.type,
|
|
5274
|
-
...K ? { Level: K } : {}
|
|
5275
|
-
},
|
|
5276
|
-
[$[0] * I, $[1] * I, $[2] * I],
|
|
5277
|
-
(Number((v == null ? void 0 : v.roll) ?? 0) || 0) * ls
|
|
5278
|
-
), S++;
|
|
5268
|
+
let K = 0;
|
|
5269
|
+
if (l)
|
|
5270
|
+
for (const [g, y] of d)
|
|
5271
|
+
z(N(g), {
|
|
5272
|
+
CategoryId: Rt.levels,
|
|
5273
|
+
Name: y.name,
|
|
5274
|
+
Elevation: J(y.at * E)
|
|
5275
|
+
}), K++;
|
|
5276
|
+
let O = 0, q = 0;
|
|
5277
|
+
for (const g of r) {
|
|
5278
|
+
if (g.kind !== "run" || g.params.of !== "wall") continue;
|
|
5279
|
+
const y = ht(g, "run"), k = ((st = (Oe = y == null ? void 0 : y.run) == null ? void 0 : Oe.line) == null ? void 0 : st.curves) ?? [], x = typeof (y == null ? void 0 : y.base) == "number" ? y.base : 0, P = y == null ? void 0 : y.height, L = d.get(String((y == null ? void 0 : y.level) ?? g.params.level ?? "")), he = g.params.lookRef;
|
|
5280
|
+
if (typeof he != "string" || typeof P != "number" || !L) {
|
|
5281
|
+
q++;
|
|
5279
5282
|
continue;
|
|
5280
5283
|
}
|
|
5281
|
-
|
|
5282
|
-
|
|
5283
|
-
|
|
5284
|
-
|
|
5285
|
-
|
|
5286
|
-
const
|
|
5287
|
-
|
|
5288
|
-
|
|
5289
|
-
|
|
5290
|
-
|
|
5291
|
-
|
|
5292
|
-
|
|
5284
|
+
k.forEach((I, D) => {
|
|
5285
|
+
if (I.kind !== "segment" || !I.from || !I.to) {
|
|
5286
|
+
q++;
|
|
5287
|
+
return;
|
|
5288
|
+
}
|
|
5289
|
+
const _e = x * E, j = `${J(I.from[0] * E)},${J(I.from[1] * E)},${J(_e)};${J(I.to[0] * E)},${J(I.to[1] * E)},${J(_e)}`, G = {
|
|
5290
|
+
CategoryId: Rt.walls,
|
|
5291
|
+
Type: he,
|
|
5292
|
+
LocationLine: j,
|
|
5293
|
+
Level: L.name,
|
|
5294
|
+
BaseOffset: J((x - L.at) * E),
|
|
5295
|
+
Height: J(P * E)
|
|
5296
|
+
}, Q = De(he);
|
|
5297
|
+
Q && (G["Type.Width"] = J(Q)), z(`${N(g.id)}#${D}`, G) && O++;
|
|
5298
|
+
});
|
|
5299
|
+
}
|
|
5300
|
+
let X = 0, be = 0;
|
|
5301
|
+
for (const g of r) {
|
|
5302
|
+
if (g.kind !== "extrusion" || g.params.of !== "slab") continue;
|
|
5303
|
+
const y = ht(g, "extrusion"), k = typeof g.params.base == "number" ? g.params.base : 0, x = d.get(String((y == null ? void 0 : y.level) ?? g.params.level ?? "")), P = g.params.lookRef, L = (j) => {
|
|
5304
|
+
if (!(j != null && j.length)) return null;
|
|
5305
|
+
const G = [];
|
|
5306
|
+
for (const Q of j) {
|
|
5307
|
+
if (Q.kind !== "segment" || !Q.from) return null;
|
|
5308
|
+
G.push(Q.from[0] * E, Q.from[1] * E, k * E);
|
|
5309
|
+
}
|
|
5310
|
+
return G.length >= 9 ? G : null;
|
|
5311
|
+
}, he = L((Me = (nt = y == null ? void 0 : y.profile) == null ? void 0 : nt.outline) == null ? void 0 : Me.curves);
|
|
5312
|
+
if (typeof P != "string" || !x || !he) {
|
|
5313
|
+
be++;
|
|
5293
5314
|
continue;
|
|
5294
5315
|
}
|
|
5295
|
-
|
|
5316
|
+
const I = [he];
|
|
5317
|
+
for (const j of ((rt = y == null ? void 0 : y.profile) == null ? void 0 : rt.holes) ?? []) {
|
|
5318
|
+
const G = L(j == null ? void 0 : j.curves);
|
|
5319
|
+
G && I.push(G);
|
|
5320
|
+
}
|
|
5321
|
+
const D = {
|
|
5322
|
+
CategoryId: Rt.floors,
|
|
5323
|
+
Type: P,
|
|
5324
|
+
Profile: JSON.stringify(I),
|
|
5325
|
+
Level: x.name
|
|
5326
|
+
}, _e = De(P);
|
|
5327
|
+
_e && (D["Type.Width"] = J(_e)), z(N(g.id), D) && X++;
|
|
5296
5328
|
}
|
|
5297
|
-
let
|
|
5298
|
-
for (const
|
|
5299
|
-
|
|
5300
|
-
|
|
5329
|
+
let ve = 0;
|
|
5330
|
+
for (const g of r) {
|
|
5331
|
+
if (g.kind !== "member" || g.params.of !== "column") continue;
|
|
5332
|
+
const y = ht(g, "member"), k = y == null ? void 0 : y.start;
|
|
5333
|
+
if (!k || k.length !== 3) continue;
|
|
5334
|
+
const x = o ? As(g.params.lookRef) : null;
|
|
5335
|
+
if (o && !x || !x && !i) continue;
|
|
5336
|
+
const P = x ?? {
|
|
5337
|
+
family: i.family,
|
|
5338
|
+
type: i.type
|
|
5339
|
+
}, L = d.get(String((y == null ? void 0 : y.level) ?? ""));
|
|
5340
|
+
z(
|
|
5341
|
+
N(g.id),
|
|
5342
|
+
{
|
|
5343
|
+
...i && !x ? { CategoryId: i.categoryId } : {},
|
|
5344
|
+
Family: P.family,
|
|
5345
|
+
Type: P.type,
|
|
5346
|
+
...L ? { Level: L.name } : {}
|
|
5347
|
+
},
|
|
5348
|
+
{
|
|
5349
|
+
position: [k[0] * E, k[1] * E, k[2] * E],
|
|
5350
|
+
rotationDeg: (Number((y == null ? void 0 : y.roll) ?? 0) || 0) * Os
|
|
5351
|
+
}
|
|
5352
|
+
) && ve++;
|
|
5353
|
+
}
|
|
5354
|
+
let Ee = 0, qe = 0;
|
|
5355
|
+
for (const g of r) {
|
|
5356
|
+
if (g.kind !== "familyInstance") continue;
|
|
5357
|
+
if (g.params.host) {
|
|
5358
|
+
qe++;
|
|
5359
|
+
continue;
|
|
5360
|
+
}
|
|
5361
|
+
if (!a) continue;
|
|
5362
|
+
const y = ht(g, "instance"), k = (Ve = y == null ? void 0 : y.placement) == null ? void 0 : Ve.at;
|
|
5363
|
+
if (!k || k.length !== 3) continue;
|
|
5364
|
+
const x = As(g.params.type);
|
|
5365
|
+
if (!x) continue;
|
|
5366
|
+
const P = (He = y == null ? void 0 : y.placement) == null ? void 0 : He.right, L = P ? Math.atan2(P[1], P[0]) * Os : 0;
|
|
5367
|
+
z(
|
|
5368
|
+
N(g.id),
|
|
5369
|
+
{ Family: x.family, Type: x.type },
|
|
5370
|
+
{ position: [k[0] * E, k[1] * E, k[2] * E], rotationDeg: L }
|
|
5371
|
+
) && Ee++;
|
|
5372
|
+
}
|
|
5373
|
+
let je = 0;
|
|
5374
|
+
for (const g of r)
|
|
5375
|
+
(g.kind === "stair" || g.kind === "footing" || g.kind === "ramp" || g.kind === "extrusion" && g.params.of !== "slab" || g.kind === "run" && g.params.of !== "wall") && je++;
|
|
5376
|
+
let Te = 0;
|
|
5377
|
+
for (const [g, y] of T)
|
|
5378
|
+
!g.startsWith(`${t.fileId}:`) || we.has(g) || (_.remove(y), Te++);
|
|
5379
|
+
if (_.length === 0)
|
|
5301
5380
|
throw new Error(
|
|
5302
|
-
`Nothing
|
|
5381
|
+
`Nothing new to ask for: "${t.name}" holds ${H} element(s) this recipe already made, ${qe + je} waiting on the applier, and nothing is left to remove.`
|
|
5303
5382
|
);
|
|
5304
|
-
const
|
|
5305
|
-
|
|
5306
|
-
|
|
5307
|
-
|
|
5383
|
+
const Ue = [
|
|
5384
|
+
K ? `${K} level(s)` : "",
|
|
5385
|
+
O ? `${O} wall(s)` : "",
|
|
5386
|
+
X ? `${X} floor(s)` : "",
|
|
5387
|
+
ve ? `${ve} column(s)` : "",
|
|
5388
|
+
Ee ? `${Ee} instance(s)` : "",
|
|
5389
|
+
Te ? `${Te} gone` : ""
|
|
5308
5390
|
].filter(Boolean);
|
|
5309
5391
|
return {
|
|
5310
|
-
title: `${n === "ifc" ? "IFC" : "Model"} to Revit: ${
|
|
5311
|
-
verb:
|
|
5312
|
-
targets:
|
|
5313
|
-
payload: new Blob([await
|
|
5392
|
+
title: `${n === "ifc" ? "IFC" : "Model"} to Revit: ${Ue.join(", ")}`,
|
|
5393
|
+
verb: _.summary,
|
|
5394
|
+
targets: _.length,
|
|
5395
|
+
payload: new Blob([await _.build(e.opId)]),
|
|
5314
5396
|
ruleTallies: [
|
|
5315
|
-
{ read:
|
|
5316
|
-
{ read:
|
|
5317
|
-
{ read:
|
|
5318
|
-
{ read:
|
|
5397
|
+
{ read: d.size, proposed: K },
|
|
5398
|
+
{ read: O + q, proposed: O },
|
|
5399
|
+
{ read: X + be, proposed: X },
|
|
5400
|
+
{ read: ve, proposed: ve },
|
|
5401
|
+
{ read: Ee, proposed: Ee },
|
|
5402
|
+
{ read: Te, proposed: Te },
|
|
5403
|
+
{ read: qe + je, proposed: 0 }
|
|
5319
5404
|
]
|
|
5320
5405
|
};
|
|
5321
5406
|
};
|
|
5322
5407
|
}
|
|
5323
|
-
const
|
|
5408
|
+
const Mr = {
|
|
5324
5409
|
type: "object",
|
|
5325
5410
|
properties: {
|
|
5326
5411
|
columnType: {
|
|
@@ -5343,96 +5428,87 @@ const Lr = {
|
|
|
5343
5428
|
type: "boolean",
|
|
5344
5429
|
title: "Also propose free-standing instances (needs style names)",
|
|
5345
5430
|
default: !1
|
|
5431
|
+
},
|
|
5432
|
+
createLevels: {
|
|
5433
|
+
type: "boolean",
|
|
5434
|
+
title: "Carry the model's levels (ensured by name)",
|
|
5435
|
+
default: !0
|
|
5346
5436
|
}
|
|
5347
5437
|
}
|
|
5348
|
-
},
|
|
5349
|
-
{
|
|
5350
|
-
|
|
5351
|
-
|
|
5352
|
-
},
|
|
5353
|
-
{
|
|
5354
|
-
|
|
5355
|
-
|
|
5356
|
-
|
|
5357
|
-
{
|
|
5358
|
-
reads: "Things this recipe made whose record is gone",
|
|
5359
|
-
proposes: "That element removed"
|
|
5360
|
-
},
|
|
5361
|
-
{
|
|
5362
|
-
reads: "Walls, slabs, stairs and every element with a body",
|
|
5363
|
-
proposes: "Nothing yet - waits on the Revit applier growing"
|
|
5364
|
-
}
|
|
5365
|
-
], Hs = {
|
|
5366
|
-
name: "frag-to-revit",
|
|
5367
|
-
title: "Platform model to Revit",
|
|
5368
|
-
description: "Turns the platform records of a .frag into change requests for a Revit document.",
|
|
5369
|
-
to: "revit",
|
|
5370
|
-
inputs: ["frag-model"],
|
|
5371
|
-
source: { kind: "project-file", extensions: ["frag"] },
|
|
5372
|
-
runtime: "browser",
|
|
5373
|
-
settingsSchema: Lr,
|
|
5374
|
-
rules: qr,
|
|
5375
|
-
doc: `
|
|
5438
|
+
}, Vr = [
|
|
5439
|
+
{ reads: "Levels (datums)", proposes: "The same level on the target, ensured by name" },
|
|
5440
|
+
{ reads: "Wall runs, one per straight segment", proposes: "A native wall: curve, type (made from its width when missing), level, height" },
|
|
5441
|
+
{ reads: "Slabs with their boundary", proposes: "A native floor from the profile, holes included" },
|
|
5442
|
+
{ reads: "Column records (members)", proposes: "A Revit column at each, on its level" },
|
|
5443
|
+
{ reads: "Free-standing family instances (when turned on)", proposes: "A new instance of the same-named type, placed and turned" },
|
|
5444
|
+
{ reads: "Things this recipe made whose record is gone", proposes: "That element removed" },
|
|
5445
|
+
{ reads: "Hosted doors/windows, stairs, roofs, footings, curtain pieces", proposes: "Nothing yet - each waits on the applier or the converter growing" }
|
|
5446
|
+
], hn = `
|
|
5376
5447
|
## What it does
|
|
5377
5448
|
|
|
5378
|
-
It reads
|
|
5379
|
-
the
|
|
5380
|
-
|
|
5449
|
+
It reads the platform's records out of a .frag and asks a Revit document for
|
|
5450
|
+
the building they describe - levels, walls, floors, columns and (opting in)
|
|
5451
|
+
free-standing instances, in one operation, levels first. Nothing changes in
|
|
5452
|
+
Revit until the owner of that document accepts the request there, and the
|
|
5453
|
+
applier materialises everything NATIVELY: real walls on real levels, never
|
|
5454
|
+
imported meshes.
|
|
5381
5455
|
|
|
5382
|
-
## What it
|
|
5456
|
+
## What it carries per thing
|
|
5383
5457
|
|
|
5384
|
-
|
|
5385
|
-
|
|
5386
|
-
|
|
5387
|
-
|
|
5458
|
+
Walls: the location line per straight segment, the type by its exact name
|
|
5459
|
+
(with its width, so a missing type is created by duplication), the level by
|
|
5460
|
+
name, base offset and height. Floors: the boundary loops, holes included.
|
|
5461
|
+
Columns and instances: point, rotation, level, type. Levels: name and
|
|
5462
|
+
elevation - ENSURED, so a level the target already has is simply used.
|
|
5388
5463
|
|
|
5389
5464
|
## It reconciles, it does not push
|
|
5390
5465
|
|
|
5391
|
-
Run it again
|
|
5392
|
-
|
|
5393
|
-
|
|
5394
|
-
|
|
5466
|
+
Run it again and it asks only for the difference: new records become new
|
|
5467
|
+
proposals, and a record that is gone asks for its element to be removed. What
|
|
5468
|
+
it already made is left alone (changing an existing wall through a proposal
|
|
5469
|
+
is the next step, not this one). It can only ever remove what it asked for
|
|
5470
|
+
itself; elements a person made in Revit are invisible to it. It keeps nothing
|
|
5471
|
+
of its own - what it made is read back from its own applied requests.
|
|
5472
|
+
|
|
5473
|
+
## What still waits
|
|
5474
|
+
|
|
5475
|
+
Hosted doors and windows (the converter does not record their category and
|
|
5476
|
+
family yet), stairs, roofs, footings and curtain walls (the applier does not
|
|
5477
|
+
create them yet). They are read and counted, and their rule row says so.
|
|
5395
5478
|
|
|
5396
5479
|
## Units and axes
|
|
5397
5480
|
|
|
5398
|
-
Records are metres, Z up; proposals are written in Revit's feet
|
|
5399
|
-
matched exactly by name; Revit refuses the whole
|
|
5400
|
-
|
|
5401
|
-
|
|
5402
|
-
|
|
5403
|
-
|
|
5481
|
+
Records are metres and radians, Z up; proposals are written in Revit's feet
|
|
5482
|
+
and degrees. Types are matched exactly by name; Revit refuses the whole
|
|
5483
|
+
request when a loadable type is missing (system types are created from their
|
|
5484
|
+
width instead).
|
|
5485
|
+
`, ln = {
|
|
5486
|
+
name: "frag-to-revit",
|
|
5487
|
+
title: "Platform model to Revit",
|
|
5488
|
+
description: "Turns the platform records of a .frag - levels, walls, floors, columns, instances - into change requests for a Revit document.",
|
|
5489
|
+
to: "revit",
|
|
5490
|
+
inputs: ["frag-model"],
|
|
5491
|
+
source: { kind: "project-file", extensions: ["frag"] },
|
|
5492
|
+
runtime: "browser",
|
|
5493
|
+
settingsSchema: Mr,
|
|
5494
|
+
rules: Vr,
|
|
5495
|
+
doc: hn,
|
|
5496
|
+
run: cn("frag")
|
|
5497
|
+
}, Hr = {
|
|
5498
|
+
...ln,
|
|
5404
5499
|
name: "ifc-to-revit",
|
|
5405
5500
|
title: "IFC to Revit",
|
|
5406
|
-
description: "Turns an IFC - through the frag the platform converted it into - into change requests
|
|
5501
|
+
description: "Turns an IFC - through the frag the platform converted it into - into native Revit change requests: levels, walls, floors, columns, instances.",
|
|
5407
5502
|
inputs: ["ifc-model"],
|
|
5408
5503
|
doc: `
|
|
5409
|
-
##
|
|
5410
|
-
|
|
5411
|
-
It reads the .frag your IFC was PROCESSED into (the IFC document's view) and
|
|
5412
|
-
asks a Revit document for the elements its records describe. Point it at that
|
|
5413
|
-
frag: a plain IFC import carries only IFC attributes and is refused by name -
|
|
5414
|
-
the editable converter is what gives an IFC real records.
|
|
5415
|
-
|
|
5416
|
-
## What it can ask for today
|
|
5504
|
+
## Point it at the converted frag
|
|
5417
5505
|
|
|
5418
|
-
|
|
5419
|
-
|
|
5420
|
-
|
|
5421
|
-
|
|
5422
|
-
|
|
5423
|
-
|
|
5424
|
-
|
|
5425
|
-
Run it again after a reconversion and it asks only for the difference. It can
|
|
5426
|
-
only ever ask to remove what it asked for itself. What it made is read back
|
|
5427
|
-
from its own applied requests - it keeps nothing of its own.
|
|
5428
|
-
|
|
5429
|
-
## Units and axes
|
|
5430
|
-
|
|
5431
|
-
Records are metres, Z up; proposals are written in Revit's feet. Types are
|
|
5432
|
-
matched exactly by name; Revit refuses the whole request when one is missing.
|
|
5433
|
-
`,
|
|
5434
|
-
run: Gs("ifc")
|
|
5435
|
-
}, Dr = {
|
|
5506
|
+
It reads the .frag your IFC was PROCESSED into (the IFC document's view). A
|
|
5507
|
+
plain IFC import carries only IFC attributes and is refused by name - the
|
|
5508
|
+
editable converter is what gives an IFC real records.
|
|
5509
|
+
` + hn,
|
|
5510
|
+
run: cn("ifc")
|
|
5511
|
+
}, Gr = {
|
|
5436
5512
|
millimeters: 1e-3,
|
|
5437
5513
|
millimetres: 1e-3,
|
|
5438
5514
|
mm: 1e-3,
|
|
@@ -5446,13 +5522,13 @@ matched exactly by name; Revit refuses the whole request when one is missing.
|
|
|
5446
5522
|
in: 0.0254,
|
|
5447
5523
|
feet: 0.3048,
|
|
5448
5524
|
ft: 0.3048
|
|
5449
|
-
},
|
|
5450
|
-
function
|
|
5525
|
+
}, dn = "rhino-to-revit", Rs = `recipe:${dn}`;
|
|
5526
|
+
function Jr(n) {
|
|
5451
5527
|
const e = (n.attrs.Position ?? "").split(",").map((t) => Number(t.trim()));
|
|
5452
5528
|
return e.length !== 3 || e.some((t) => !Number.isFinite(t)) ? null : [e[0], e[1], e[2]];
|
|
5453
5529
|
}
|
|
5454
|
-
const
|
|
5455
|
-
name:
|
|
5530
|
+
const Wr = {
|
|
5531
|
+
name: dn,
|
|
5456
5532
|
title: "Rhino to Revit",
|
|
5457
5533
|
description: "Turns the placed objects of a Rhino layer into change requests for Revit instances of a chosen type.",
|
|
5458
5534
|
to: "revit",
|
|
@@ -5521,14 +5597,14 @@ at or below the point. For a level-based family the level wins over the
|
|
|
5521
5597
|
point's height.
|
|
5522
5598
|
`,
|
|
5523
5599
|
async run(n) {
|
|
5524
|
-
var
|
|
5525
|
-
const { picked: e, contents: t } = await
|
|
5600
|
+
var K;
|
|
5601
|
+
const { picked: e, contents: t } = await an(
|
|
5526
5602
|
n,
|
|
5527
5603
|
n.input
|
|
5528
5604
|
), { layer: s, instanceType: r } = n.settings;
|
|
5529
5605
|
if (!s || !r)
|
|
5530
5606
|
throw new Error("Choose the layer and the Revit type.");
|
|
5531
|
-
const i = (
|
|
5607
|
+
const i = (K = t.metadata) == null ? void 0 : K.data, o = i == null ? void 0 : i.units, a = typeof o == "string" ? Gr[o.trim().toLowerCase()] : void 0;
|
|
5532
5608
|
if (!a)
|
|
5533
5609
|
throw new Error(
|
|
5534
5610
|
`"${e.name}" does not say what units its data is in${o ? ` ("${String(o)}" is not one this recipe knows)` : ""}, so nothing can be converted from it.`
|
|
@@ -5538,114 +5614,114 @@ point's height.
|
|
|
5538
5614
|
throw new Error(
|
|
5539
5615
|
`"${e.name}" declares its data as "${l}"; this recipe only converts Z up.`
|
|
5540
5616
|
);
|
|
5541
|
-
const
|
|
5617
|
+
const d = a * rn, c = await on(n, Rs), m = await n.targetDoc.latest(), T = new nn({
|
|
5542
5618
|
project: n.projectId,
|
|
5543
5619
|
document: n.targetDoc.docId,
|
|
5544
5620
|
baseCommit: (m == null ? void 0 : m.version) ?? 0,
|
|
5545
|
-
author:
|
|
5621
|
+
author: Rs
|
|
5546
5622
|
});
|
|
5547
|
-
let
|
|
5548
|
-
const
|
|
5549
|
-
for (const
|
|
5550
|
-
if (!
|
|
5551
|
-
if ((
|
|
5552
|
-
|
|
5623
|
+
let A = 0, _ = 0, E = 0;
|
|
5624
|
+
const N = /* @__PURE__ */ new Set(), we = [];
|
|
5625
|
+
for (const O of t.items) {
|
|
5626
|
+
if (!O.guid || Object.keys(O.attrs).length === 0) continue;
|
|
5627
|
+
if ((O.attrs.Layer ?? "") !== s) {
|
|
5628
|
+
E++;
|
|
5553
5629
|
continue;
|
|
5554
5630
|
}
|
|
5555
|
-
const
|
|
5556
|
-
if (!
|
|
5557
|
-
|
|
5558
|
-
const
|
|
5559
|
-
|
|
5560
|
-
|
|
5561
|
-
|
|
5562
|
-
],
|
|
5563
|
-
|
|
5631
|
+
const q = Jr(O);
|
|
5632
|
+
if (!q) continue;
|
|
5633
|
+
N.add(O.guid);
|
|
5634
|
+
const X = [
|
|
5635
|
+
q[0] * d,
|
|
5636
|
+
q[1] * d,
|
|
5637
|
+
q[2] * d
|
|
5638
|
+
], be = c.get(O.guid);
|
|
5639
|
+
be ? we.push({ instance: be, object: O.guid, position: X }) : (T.add(
|
|
5564
5640
|
{
|
|
5565
5641
|
CategoryId: r.categoryId,
|
|
5566
5642
|
Family: r.family,
|
|
5567
5643
|
Type: r.type
|
|
5568
5644
|
},
|
|
5569
|
-
{ position:
|
|
5570
|
-
),
|
|
5645
|
+
{ position: X, source: O.guid }
|
|
5646
|
+
), A++);
|
|
5571
5647
|
}
|
|
5572
|
-
for (const
|
|
5573
|
-
|
|
5574
|
-
let
|
|
5575
|
-
for (const [
|
|
5576
|
-
|
|
5577
|
-
const
|
|
5578
|
-
if (
|
|
5648
|
+
for (const O of we)
|
|
5649
|
+
T.set(O.instance, {}, { position: O.position, source: O.object }), _++;
|
|
5650
|
+
let H = 0;
|
|
5651
|
+
for (const [O, q] of c)
|
|
5652
|
+
N.has(O) || (T.remove(q), H++);
|
|
5653
|
+
const z = A + _ + H;
|
|
5654
|
+
if (z === 0)
|
|
5579
5655
|
throw new Error(
|
|
5580
5656
|
`Nothing to ask for: layer "${s}" of "${e.name}" has no placed object, and nothing of this recipe is left to remove.`
|
|
5581
5657
|
);
|
|
5582
5658
|
return {
|
|
5583
5659
|
title: `From Rhino: ${[
|
|
5584
|
-
|
|
5585
|
-
|
|
5586
|
-
|
|
5660
|
+
A ? `${A} new` : "",
|
|
5661
|
+
_ ? `${_} moved` : "",
|
|
5662
|
+
H ? `${H} gone` : ""
|
|
5587
5663
|
].filter(Boolean).join(", ")}`,
|
|
5588
|
-
verb:
|
|
5589
|
-
targets:
|
|
5590
|
-
payload: new Blob([await
|
|
5664
|
+
verb: T.summary,
|
|
5665
|
+
targets: z,
|
|
5666
|
+
payload: new Blob([await T.build(n.opId)]),
|
|
5591
5667
|
ruleTallies: [
|
|
5592
|
-
{ read:
|
|
5593
|
-
{ read:
|
|
5594
|
-
{ read:
|
|
5595
|
-
{ read:
|
|
5668
|
+
{ read: A, proposed: A },
|
|
5669
|
+
{ read: _, proposed: _ },
|
|
5670
|
+
{ read: H, proposed: H },
|
|
5671
|
+
{ read: E, proposed: 0 }
|
|
5596
5672
|
]
|
|
5597
5673
|
};
|
|
5598
5674
|
}
|
|
5599
|
-
},
|
|
5600
|
-
|
|
5601
|
-
|
|
5602
|
-
|
|
5675
|
+
}, Yr = [
|
|
5676
|
+
Wr,
|
|
5677
|
+
Hr,
|
|
5678
|
+
ln
|
|
5603
5679
|
];
|
|
5604
|
-
function
|
|
5605
|
-
for (const e of
|
|
5680
|
+
function Xr(n) {
|
|
5681
|
+
for (const e of Yr) n.recipes.register(e);
|
|
5606
5682
|
}
|
|
5607
|
-
const
|
|
5683
|
+
const Qr = {
|
|
5608
5684
|
MAX_FIELDS: 200,
|
|
5609
5685
|
MAX_KEY_LENGTH: 50,
|
|
5610
5686
|
MAX_VALUE_LENGTH: 50
|
|
5611
|
-
},
|
|
5687
|
+
}, Zr = { uuid: "a3f82c1d-5b74-4e9a-bc30-d7e12f894a61" }, ei = { uuid: "2c9f4e8d-3a1b-4c5e-9d7f-0a2b6c8e1d3f" }, ti = { uuid: "b0b5e2a2-0b3a-4a6b-8b1c-0b1c4a6b8b1c" }, si = { uuid: "d8f3a1c2-6b4e-4f9a-8c1d-2e7b5a9f3c60" }, ni = { uuid: "3f9c1a7e-6b2d-4e18-9a5c-7d0e2f4b6c81" }, ri = { uuid: "2c4ae432-fc24-43e9-9783-0c960c674e96" }, ii = { uuid: "6f3a9c2e-8b1d-4e6a-9c3f-1d7b5a8e2c4f" }, oi = { uuid: "69af63aa-19ba-4fc7-b17b-75647bac1d76" }, ai = { uuid: "234f1416-528d-452a-9cc9-a16c5239b2eb" };
|
|
5612
5688
|
export {
|
|
5613
|
-
|
|
5614
|
-
|
|
5615
|
-
|
|
5616
|
-
|
|
5617
|
-
|
|
5618
|
-
|
|
5619
|
-
|
|
5620
|
-
|
|
5621
|
-
|
|
5622
|
-
|
|
5623
|
-
|
|
5624
|
-
|
|
5625
|
-
|
|
5626
|
-
|
|
5627
|
-
|
|
5628
|
-
|
|
5629
|
-
|
|
5630
|
-
|
|
5631
|
-
|
|
5632
|
-
|
|
5633
|
-
|
|
5634
|
-
|
|
5635
|
-
|
|
5636
|
-
|
|
5637
|
-
|
|
5638
|
-
|
|
5639
|
-
|
|
5640
|
-
|
|
5641
|
-
|
|
5642
|
-
|
|
5643
|
-
|
|
5644
|
-
|
|
5645
|
-
|
|
5646
|
-
|
|
5647
|
-
|
|
5648
|
-
|
|
5649
|
-
|
|
5689
|
+
Zr as CDEManager,
|
|
5690
|
+
Ar as ChannelClient,
|
|
5691
|
+
Xs as ChannelRoom,
|
|
5692
|
+
ei as ClashesManager,
|
|
5693
|
+
Sr as CollabRoom,
|
|
5694
|
+
fs as DOCUMENT_FILE,
|
|
5695
|
+
bt as DOCUMENT_SCHEMA,
|
|
5696
|
+
Ht as EngineServicesClient,
|
|
5697
|
+
kr as ExternalRoom,
|
|
5698
|
+
ti as FileList,
|
|
5699
|
+
dr as FlowDoc,
|
|
5700
|
+
si as GISManager,
|
|
5701
|
+
ni as GitHistoryManager,
|
|
5702
|
+
ri as HelloWorld,
|
|
5703
|
+
Qr as METADATA_LIMITS,
|
|
5704
|
+
Pr as OP_SCHEMA,
|
|
5705
|
+
nn as OperationBuilder,
|
|
5706
|
+
_s as PlatformClient,
|
|
5707
|
+
Vs as ProjectDocuments,
|
|
5708
|
+
lr as ProjectHistory,
|
|
5709
|
+
ii as ProjectManager,
|
|
5710
|
+
fr as Recipes,
|
|
5711
|
+
rs as RequestError,
|
|
5712
|
+
ar as SELF_VIEWING_FORMATS,
|
|
5713
|
+
Es as STORAGE_BATCH_MAX,
|
|
5714
|
+
ys as StaleHistoryError,
|
|
5715
|
+
oi as TopicsManager,
|
|
5716
|
+
ai as UIManager,
|
|
5717
|
+
Yr as builtinRecipes,
|
|
5718
|
+
ln as fragToRevit,
|
|
5719
|
+
Hr as ifcToRevit,
|
|
5720
|
+
Mt as mintGuid,
|
|
5721
|
+
zs as orderByGraph,
|
|
5722
|
+
sn as readFrag,
|
|
5723
|
+
Xr as registerBuiltinRecipes,
|
|
5724
|
+
Wr as rhinoToRevit,
|
|
5725
|
+
_r as windowTransport
|
|
5650
5726
|
};
|
|
5651
5727
|
//# sourceMappingURL=index.es.js.map
|