@thatopen/services 0.23.0 → 0.24.0
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/core/op-builder.d.ts +118 -0
- package/dist/index.cjs.js +2 -2
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +1224 -1035
- package/dist/index.es.js.map +1 -1
- package/docs/ai-quickstart.md +8 -0
- package/package.json +9 -1
package/dist/index.es.js
CHANGED
|
@@ -1,265 +1,265 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
throw TypeError(
|
|
1
|
+
var Js = Object.defineProperty;
|
|
2
|
+
var xe = (r) => {
|
|
3
|
+
throw TypeError(r);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
5
|
+
var Ys = (r, t, e) => t in r ? Js(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
|
|
6
|
+
var I = (r, t, e) => Ys(r, typeof t != "symbol" ? t + "" : t, e), jt = (r, t, e) => t.has(r) || xe("Cannot " + e);
|
|
7
|
+
var u = (r, t, e) => (jt(r, t, "read from private field"), e ? e.call(r) : t.get(r)), b = (r, t, e) => t.has(r) ? xe("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(r) : t.set(r, e), _ = (r, t, e, s) => (jt(r, t, "write to private field"), s ? s.call(r, e) : t.set(r, e), e), a = (r, t, e) => (jt(r, t, "access private method"), e);
|
|
8
|
+
const F = /* @__PURE__ */ Object.create(null);
|
|
9
|
+
F.open = "0";
|
|
10
|
+
F.close = "1";
|
|
11
|
+
F.ping = "2";
|
|
12
|
+
F.pong = "3";
|
|
13
|
+
F.message = "4";
|
|
14
|
+
F.upgrade = "5";
|
|
15
|
+
F.noop = "6";
|
|
16
16
|
const kt = /* @__PURE__ */ Object.create(null);
|
|
17
|
-
Object.keys(
|
|
18
|
-
kt[
|
|
17
|
+
Object.keys(F).forEach((r) => {
|
|
18
|
+
kt[F[r]] = r;
|
|
19
19
|
});
|
|
20
|
-
const
|
|
20
|
+
const Wt = { type: "error", data: "parser error" }, We = typeof Blob == "function" || typeof Blob < "u" && Object.prototype.toString.call(Blob) === "[object BlobConstructor]", Ke = typeof ArrayBuffer == "function", ze = (r) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(r) : r && r.buffer instanceof ArrayBuffer, we = ({ type: r, data: t }, e, s) => We && t instanceof Blob ? e ? s(t) : Re(t, s) : Ke && (t instanceof ArrayBuffer || ze(t)) ? e ? s(t) : Re(new Blob([t]), s) : s(F[r] + (t || "")), Re = (r, t) => {
|
|
21
21
|
const e = new FileReader();
|
|
22
22
|
return e.onload = function() {
|
|
23
23
|
const s = e.result.split(",")[1];
|
|
24
24
|
t("b" + (s || ""));
|
|
25
|
-
}, e.readAsDataURL(
|
|
25
|
+
}, e.readAsDataURL(r);
|
|
26
26
|
};
|
|
27
|
-
function
|
|
28
|
-
return
|
|
27
|
+
function $e(r) {
|
|
28
|
+
return r instanceof Uint8Array ? r : r instanceof ArrayBuffer ? new Uint8Array(r) : new Uint8Array(r.buffer, r.byteOffset, r.byteLength);
|
|
29
29
|
}
|
|
30
|
-
let
|
|
31
|
-
function
|
|
32
|
-
if (
|
|
33
|
-
return
|
|
34
|
-
if (
|
|
35
|
-
return t(
|
|
36
|
-
|
|
37
|
-
|
|
30
|
+
let Mt;
|
|
31
|
+
function Ws(r, t) {
|
|
32
|
+
if (We && r.data instanceof Blob)
|
|
33
|
+
return r.data.arrayBuffer().then($e).then(t);
|
|
34
|
+
if (Ke && (r.data instanceof ArrayBuffer || ze(r.data)))
|
|
35
|
+
return t($e(r.data));
|
|
36
|
+
we(r, !1, (e) => {
|
|
37
|
+
Mt || (Mt = new TextEncoder()), t(Mt.encode(e));
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
|
-
const
|
|
41
|
-
for (let
|
|
42
|
-
|
|
43
|
-
const
|
|
44
|
-
let t =
|
|
45
|
-
|
|
46
|
-
const f = new ArrayBuffer(t),
|
|
40
|
+
const Ne = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", pt = typeof Uint8Array > "u" ? [] : new Uint8Array(256);
|
|
41
|
+
for (let r = 0; r < Ne.length; r++)
|
|
42
|
+
pt[Ne.charCodeAt(r)] = r;
|
|
43
|
+
const Ks = (r) => {
|
|
44
|
+
let t = r.length * 0.75, e = r.length, s, n = 0, i, o, c, d;
|
|
45
|
+
r[r.length - 1] === "=" && (t--, r[r.length - 2] === "=" && t--);
|
|
46
|
+
const f = new ArrayBuffer(t), h = new Uint8Array(f);
|
|
47
47
|
for (s = 0; s < e; s += 4)
|
|
48
|
-
i =
|
|
48
|
+
i = pt[r.charCodeAt(s)], o = pt[r.charCodeAt(s + 1)], c = pt[r.charCodeAt(s + 2)], d = pt[r.charCodeAt(s + 3)], h[n++] = i << 2 | o >> 4, h[n++] = (o & 15) << 4 | c >> 2, h[n++] = (c & 3) << 6 | d & 63;
|
|
49
49
|
return f;
|
|
50
|
-
},
|
|
51
|
-
if (typeof
|
|
50
|
+
}, zs = typeof ArrayBuffer == "function", be = (r, t) => {
|
|
51
|
+
if (typeof r != "string")
|
|
52
52
|
return {
|
|
53
53
|
type: "message",
|
|
54
|
-
data:
|
|
54
|
+
data: Xe(r, t)
|
|
55
55
|
};
|
|
56
|
-
const e =
|
|
56
|
+
const e = r.charAt(0);
|
|
57
57
|
return e === "b" ? {
|
|
58
58
|
type: "message",
|
|
59
|
-
data:
|
|
60
|
-
} : kt[e] ?
|
|
59
|
+
data: Xs(r.substring(1), t)
|
|
60
|
+
} : kt[e] ? r.length > 1 ? {
|
|
61
61
|
type: kt[e],
|
|
62
|
-
data:
|
|
62
|
+
data: r.substring(1)
|
|
63
63
|
} : {
|
|
64
64
|
type: kt[e]
|
|
65
|
-
} :
|
|
66
|
-
},
|
|
67
|
-
if (
|
|
68
|
-
const e =
|
|
69
|
-
return
|
|
65
|
+
} : Wt;
|
|
66
|
+
}, Xs = (r, t) => {
|
|
67
|
+
if (zs) {
|
|
68
|
+
const e = Ks(r);
|
|
69
|
+
return Xe(e, t);
|
|
70
70
|
} else
|
|
71
|
-
return { base64: !0, data:
|
|
72
|
-
},
|
|
71
|
+
return { base64: !0, data: r };
|
|
72
|
+
}, Xe = (r, t) => {
|
|
73
73
|
switch (t) {
|
|
74
74
|
case "blob":
|
|
75
|
-
return
|
|
75
|
+
return r instanceof Blob ? r : new Blob([r]);
|
|
76
76
|
case "arraybuffer":
|
|
77
77
|
default:
|
|
78
|
-
return
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
const e =
|
|
82
|
-
let
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
s[o] = c, ++
|
|
78
|
+
return r instanceof ArrayBuffer ? r : r.buffer;
|
|
79
|
+
}
|
|
80
|
+
}, Qe = "", Qs = (r, t) => {
|
|
81
|
+
const e = r.length, s = new Array(e);
|
|
82
|
+
let n = 0;
|
|
83
|
+
r.forEach((i, o) => {
|
|
84
|
+
we(i, !1, (c) => {
|
|
85
|
+
s[o] = c, ++n === e && t(s.join(Qe));
|
|
86
86
|
});
|
|
87
87
|
});
|
|
88
|
-
},
|
|
89
|
-
const e =
|
|
90
|
-
for (let
|
|
91
|
-
const i =
|
|
88
|
+
}, Zs = (r, t) => {
|
|
89
|
+
const e = r.split(Qe), s = [];
|
|
90
|
+
for (let n = 0; n < e.length; n++) {
|
|
91
|
+
const i = be(e[n], t);
|
|
92
92
|
if (s.push(i), i.type === "error")
|
|
93
93
|
break;
|
|
94
94
|
}
|
|
95
95
|
return s;
|
|
96
96
|
};
|
|
97
|
-
function
|
|
97
|
+
function tr() {
|
|
98
98
|
return new TransformStream({
|
|
99
|
-
transform(
|
|
100
|
-
|
|
99
|
+
transform(r, t) {
|
|
100
|
+
Ws(r, (e) => {
|
|
101
101
|
const s = e.length;
|
|
102
|
-
let
|
|
102
|
+
let n;
|
|
103
103
|
if (s < 126)
|
|
104
|
-
|
|
104
|
+
n = new Uint8Array(1), new DataView(n.buffer).setUint8(0, s);
|
|
105
105
|
else if (s < 65536) {
|
|
106
|
-
|
|
107
|
-
const i = new DataView(
|
|
106
|
+
n = new Uint8Array(3);
|
|
107
|
+
const i = new DataView(n.buffer);
|
|
108
108
|
i.setUint8(0, 126), i.setUint16(1, s);
|
|
109
109
|
} else {
|
|
110
|
-
|
|
111
|
-
const i = new DataView(
|
|
110
|
+
n = new Uint8Array(9);
|
|
111
|
+
const i = new DataView(n.buffer);
|
|
112
112
|
i.setUint8(0, 127), i.setBigUint64(1, BigInt(s));
|
|
113
113
|
}
|
|
114
|
-
|
|
114
|
+
r.data && typeof r.data != "string" && (n[0] |= 128), t.enqueue(n), t.enqueue(e);
|
|
115
115
|
});
|
|
116
116
|
}
|
|
117
117
|
});
|
|
118
118
|
}
|
|
119
|
-
let
|
|
120
|
-
function
|
|
121
|
-
return
|
|
119
|
+
let Vt;
|
|
120
|
+
function It(r) {
|
|
121
|
+
return r.reduce((t, e) => t + e.length, 0);
|
|
122
122
|
}
|
|
123
|
-
function
|
|
124
|
-
if (
|
|
125
|
-
return
|
|
123
|
+
function Ot(r, t) {
|
|
124
|
+
if (r[0].length === t)
|
|
125
|
+
return r.shift();
|
|
126
126
|
const e = new Uint8Array(t);
|
|
127
127
|
let s = 0;
|
|
128
|
-
for (let
|
|
129
|
-
e[
|
|
130
|
-
return
|
|
128
|
+
for (let n = 0; n < t; n++)
|
|
129
|
+
e[n] = r[0][s++], s === r[0].length && (r.shift(), s = 0);
|
|
130
|
+
return r.length && s < r[0].length && (r[0] = r[0].slice(s)), e;
|
|
131
131
|
}
|
|
132
|
-
function
|
|
133
|
-
|
|
132
|
+
function er(r, t) {
|
|
133
|
+
Vt || (Vt = new TextDecoder());
|
|
134
134
|
const e = [];
|
|
135
|
-
let s = 0,
|
|
135
|
+
let s = 0, n = -1, i = !1;
|
|
136
136
|
return new TransformStream({
|
|
137
137
|
transform(o, c) {
|
|
138
138
|
for (e.push(o); ; ) {
|
|
139
139
|
if (s === 0) {
|
|
140
|
-
if (
|
|
140
|
+
if (It(e) < 1)
|
|
141
141
|
break;
|
|
142
|
-
const
|
|
143
|
-
i = (
|
|
142
|
+
const d = Ot(e, 1);
|
|
143
|
+
i = (d[0] & 128) === 128, n = d[0] & 127, n < 126 ? s = 3 : n === 126 ? s = 1 : s = 2;
|
|
144
144
|
} else if (s === 1) {
|
|
145
|
-
if (
|
|
145
|
+
if (It(e) < 2)
|
|
146
146
|
break;
|
|
147
|
-
const
|
|
148
|
-
|
|
147
|
+
const d = Ot(e, 2);
|
|
148
|
+
n = new DataView(d.buffer, d.byteOffset, d.length).getUint16(0), s = 3;
|
|
149
149
|
} else if (s === 2) {
|
|
150
|
-
if (
|
|
150
|
+
if (It(e) < 8)
|
|
151
151
|
break;
|
|
152
|
-
const
|
|
153
|
-
if (
|
|
154
|
-
c.enqueue(
|
|
152
|
+
const d = Ot(e, 8), f = new DataView(d.buffer, d.byteOffset, d.length), h = f.getUint32(0);
|
|
153
|
+
if (h > Math.pow(2, 21) - 1) {
|
|
154
|
+
c.enqueue(Wt);
|
|
155
155
|
break;
|
|
156
156
|
}
|
|
157
|
-
|
|
157
|
+
n = h * Math.pow(2, 32) + f.getUint32(4), s = 3;
|
|
158
158
|
} else {
|
|
159
|
-
if (
|
|
159
|
+
if (It(e) < n)
|
|
160
160
|
break;
|
|
161
|
-
const
|
|
162
|
-
c.enqueue(
|
|
161
|
+
const d = Ot(e, n);
|
|
162
|
+
c.enqueue(be(i ? d : Vt.decode(d), t)), s = 0;
|
|
163
163
|
}
|
|
164
|
-
if (
|
|
165
|
-
c.enqueue(
|
|
164
|
+
if (n === 0 || n > r) {
|
|
165
|
+
c.enqueue(Wt);
|
|
166
166
|
break;
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
169
|
}
|
|
170
170
|
});
|
|
171
171
|
}
|
|
172
|
-
const
|
|
173
|
-
function
|
|
174
|
-
if (
|
|
172
|
+
const Ze = 4;
|
|
173
|
+
function E(r) {
|
|
174
|
+
if (r) return sr(r);
|
|
175
175
|
}
|
|
176
|
-
function
|
|
177
|
-
for (var t in
|
|
178
|
-
|
|
179
|
-
return
|
|
176
|
+
function sr(r) {
|
|
177
|
+
for (var t in E.prototype)
|
|
178
|
+
r[t] = E.prototype[t];
|
|
179
|
+
return r;
|
|
180
180
|
}
|
|
181
|
-
|
|
182
|
-
return this._callbacks = this._callbacks || {}, (this._callbacks["$" +
|
|
181
|
+
E.prototype.on = E.prototype.addEventListener = function(r, t) {
|
|
182
|
+
return this._callbacks = this._callbacks || {}, (this._callbacks["$" + r] = this._callbacks["$" + r] || []).push(t), this;
|
|
183
183
|
};
|
|
184
|
-
|
|
184
|
+
E.prototype.once = function(r, t) {
|
|
185
185
|
function e() {
|
|
186
|
-
this.off(
|
|
186
|
+
this.off(r, e), t.apply(this, arguments);
|
|
187
187
|
}
|
|
188
|
-
return e.fn = t, this.on(
|
|
188
|
+
return e.fn = t, this.on(r, e), this;
|
|
189
189
|
};
|
|
190
|
-
|
|
190
|
+
E.prototype.off = E.prototype.removeListener = E.prototype.removeAllListeners = E.prototype.removeEventListener = function(r, t) {
|
|
191
191
|
if (this._callbacks = this._callbacks || {}, arguments.length == 0)
|
|
192
192
|
return this._callbacks = {}, this;
|
|
193
|
-
var e = this._callbacks["$" +
|
|
193
|
+
var e = this._callbacks["$" + r];
|
|
194
194
|
if (!e) return this;
|
|
195
195
|
if (arguments.length == 1)
|
|
196
|
-
return delete this._callbacks["$" +
|
|
197
|
-
for (var s,
|
|
198
|
-
if (s = e[
|
|
199
|
-
e.splice(
|
|
196
|
+
return delete this._callbacks["$" + r], this;
|
|
197
|
+
for (var s, n = 0; n < e.length; n++)
|
|
198
|
+
if (s = e[n], s === t || s.fn === t) {
|
|
199
|
+
e.splice(n, 1);
|
|
200
200
|
break;
|
|
201
201
|
}
|
|
202
|
-
return e.length === 0 && delete this._callbacks["$" +
|
|
202
|
+
return e.length === 0 && delete this._callbacks["$" + r], this;
|
|
203
203
|
};
|
|
204
|
-
|
|
204
|
+
E.prototype.emit = function(r) {
|
|
205
205
|
this._callbacks = this._callbacks || {};
|
|
206
|
-
for (var t = new Array(arguments.length - 1), e = this._callbacks["$" +
|
|
206
|
+
for (var t = new Array(arguments.length - 1), e = this._callbacks["$" + r], s = 1; s < arguments.length; s++)
|
|
207
207
|
t[s - 1] = arguments[s];
|
|
208
208
|
if (e) {
|
|
209
209
|
e = e.slice(0);
|
|
210
|
-
for (var s = 0,
|
|
210
|
+
for (var s = 0, n = e.length; s < n; ++s)
|
|
211
211
|
e[s].apply(this, t);
|
|
212
212
|
}
|
|
213
213
|
return this;
|
|
214
214
|
};
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
return this._callbacks = this._callbacks || {}, this._callbacks["$" +
|
|
215
|
+
E.prototype.emitReserved = E.prototype.emit;
|
|
216
|
+
E.prototype.listeners = function(r) {
|
|
217
|
+
return this._callbacks = this._callbacks || {}, this._callbacks["$" + r] || [];
|
|
218
218
|
};
|
|
219
|
-
|
|
220
|
-
return !!this.listeners(
|
|
219
|
+
E.prototype.hasListeners = function(r) {
|
|
220
|
+
return !!this.listeners(r).length;
|
|
221
221
|
};
|
|
222
|
-
const
|
|
223
|
-
function
|
|
224
|
-
return t.reduce((e, s) => (
|
|
222
|
+
const Ft = typeof Promise == "function" && typeof Promise.resolve == "function" ? (t) => Promise.resolve().then(t) : (t, e) => e(t, 0), R = typeof self < "u" ? self : typeof window < "u" ? window : Function("return this")(), rr = "arraybuffer";
|
|
223
|
+
function ts(r, ...t) {
|
|
224
|
+
return t.reduce((e, s) => (r.hasOwnProperty(s) && (e[s] = r[s]), e), {});
|
|
225
225
|
}
|
|
226
|
-
const
|
|
227
|
-
function
|
|
228
|
-
t.useNativeTimers ? (
|
|
226
|
+
const nr = R.setTimeout, ir = R.clearTimeout;
|
|
227
|
+
function qt(r, t) {
|
|
228
|
+
t.useNativeTimers ? (r.setTimeoutFn = nr.bind(R), r.clearTimeoutFn = ir.bind(R)) : (r.setTimeoutFn = R.setTimeout.bind(R), r.clearTimeoutFn = R.clearTimeout.bind(R));
|
|
229
229
|
}
|
|
230
|
-
const
|
|
231
|
-
function
|
|
232
|
-
return typeof
|
|
230
|
+
const or = 1.33;
|
|
231
|
+
function ar(r) {
|
|
232
|
+
return typeof r == "string" ? cr(r) : Math.ceil((r.byteLength || r.size) * or);
|
|
233
233
|
}
|
|
234
|
-
function
|
|
234
|
+
function cr(r) {
|
|
235
235
|
let t = 0, e = 0;
|
|
236
|
-
for (let s = 0,
|
|
237
|
-
t =
|
|
236
|
+
for (let s = 0, n = r.length; s < n; s++)
|
|
237
|
+
t = r.charCodeAt(s), t < 128 ? e += 1 : t < 2048 ? e += 2 : t < 55296 || t >= 57344 ? e += 3 : (s++, e += 4);
|
|
238
238
|
return e;
|
|
239
239
|
}
|
|
240
|
-
function
|
|
240
|
+
function es() {
|
|
241
241
|
return Date.now().toString(36).substring(3) + Math.random().toString(36).substring(2, 5);
|
|
242
242
|
}
|
|
243
|
-
function
|
|
243
|
+
function hr(r) {
|
|
244
244
|
let t = "";
|
|
245
|
-
for (let e in
|
|
246
|
-
|
|
245
|
+
for (let e in r)
|
|
246
|
+
r.hasOwnProperty(e) && (t.length && (t += "&"), t += encodeURIComponent(e) + "=" + encodeURIComponent(r[e]));
|
|
247
247
|
return t;
|
|
248
248
|
}
|
|
249
|
-
function
|
|
250
|
-
let t = {}, e =
|
|
251
|
-
for (let s = 0,
|
|
249
|
+
function lr(r) {
|
|
250
|
+
let t = {}, e = r.split("&");
|
|
251
|
+
for (let s = 0, n = e.length; s < n; s++) {
|
|
252
252
|
let i = e[s].split("=");
|
|
253
253
|
t[decodeURIComponent(i[0])] = decodeURIComponent(i[1]);
|
|
254
254
|
}
|
|
255
255
|
return t;
|
|
256
256
|
}
|
|
257
|
-
class
|
|
257
|
+
class ur extends Error {
|
|
258
258
|
constructor(t, e, s) {
|
|
259
259
|
super(t), this.description = e, this.context = s, this.type = "TransportError";
|
|
260
260
|
}
|
|
261
261
|
}
|
|
262
|
-
class
|
|
262
|
+
class _e extends E {
|
|
263
263
|
/**
|
|
264
264
|
* Transport abstract constructor.
|
|
265
265
|
*
|
|
@@ -267,7 +267,7 @@ class ye extends v {
|
|
|
267
267
|
* @protected
|
|
268
268
|
*/
|
|
269
269
|
constructor(t) {
|
|
270
|
-
super(), this.writable = !1,
|
|
270
|
+
super(), this.writable = !1, qt(this, t), this.opts = t, this.query = t.query, this.socket = t.socket, this.supportsBinary = !t.forceBase64;
|
|
271
271
|
}
|
|
272
272
|
/**
|
|
273
273
|
* Emits an error.
|
|
@@ -279,7 +279,7 @@ class ye extends v {
|
|
|
279
279
|
* @protected
|
|
280
280
|
*/
|
|
281
281
|
onError(t, e, s) {
|
|
282
|
-
return super.emitReserved("error", new
|
|
282
|
+
return super.emitReserved("error", new ur(t, e, s)), this;
|
|
283
283
|
}
|
|
284
284
|
/**
|
|
285
285
|
* Opens the transport.
|
|
@@ -316,7 +316,7 @@ class ye extends v {
|
|
|
316
316
|
* @protected
|
|
317
317
|
*/
|
|
318
318
|
onData(t) {
|
|
319
|
-
const e =
|
|
319
|
+
const e = be(t, this.socket.binaryType);
|
|
320
320
|
this.onPacket(e);
|
|
321
321
|
}
|
|
322
322
|
/**
|
|
@@ -353,11 +353,11 @@ class ye extends v {
|
|
|
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(t) {
|
|
356
|
-
const e =
|
|
356
|
+
const e = hr(t);
|
|
357
357
|
return e.length ? "?" + e : "";
|
|
358
358
|
}
|
|
359
359
|
}
|
|
360
|
-
class
|
|
360
|
+
class dr extends _e {
|
|
361
361
|
constructor() {
|
|
362
362
|
super(...arguments), this._polling = !1;
|
|
363
363
|
}
|
|
@@ -413,7 +413,7 @@ class As extends ye {
|
|
|
413
413
|
return this.onClose({ description: "transport closed by the server" }), !1;
|
|
414
414
|
this.onPacket(s);
|
|
415
415
|
};
|
|
416
|
-
|
|
416
|
+
Zs(t, this.socket.binaryType).forEach(e), 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 As extends ye {
|
|
|
433
433
|
* @protected
|
|
434
434
|
*/
|
|
435
435
|
write(t) {
|
|
436
|
-
this.writable = !1,
|
|
436
|
+
this.writable = !1, Qs(t, (e) => {
|
|
437
437
|
this.doWrite(e, () => {
|
|
438
438
|
this.writable = !0, this.emitReserved("drain");
|
|
439
439
|
});
|
|
@@ -446,18 +446,18 @@ class As extends ye {
|
|
|
446
446
|
*/
|
|
447
447
|
uri() {
|
|
448
448
|
const t = this.opts.secure ? "https" : "http", e = this.query || {};
|
|
449
|
-
return this.opts.timestampRequests !== !1 && (e[this.opts.timestampParam] =
|
|
449
|
+
return this.opts.timestampRequests !== !1 && (e[this.opts.timestampParam] = es()), !this.supportsBinary && !e.sid && (e.b64 = 1), this.createUri(t, e);
|
|
450
450
|
}
|
|
451
451
|
}
|
|
452
|
-
let
|
|
452
|
+
let ss = !1;
|
|
453
453
|
try {
|
|
454
|
-
|
|
454
|
+
ss = typeof XMLHttpRequest < "u" && "withCredentials" in new XMLHttpRequest();
|
|
455
455
|
} catch {
|
|
456
456
|
}
|
|
457
|
-
const
|
|
458
|
-
function
|
|
457
|
+
const fr = ss;
|
|
458
|
+
function pr() {
|
|
459
459
|
}
|
|
460
|
-
class
|
|
460
|
+
class yr extends dr {
|
|
461
461
|
/**
|
|
462
462
|
* XHR Polling constructor.
|
|
463
463
|
*
|
|
@@ -483,8 +483,8 @@ class Cs extends As {
|
|
|
483
483
|
method: "POST",
|
|
484
484
|
data: t
|
|
485
485
|
});
|
|
486
|
-
s.on("success", e), s.on("error", (
|
|
487
|
-
this.onError("xhr post error",
|
|
486
|
+
s.on("success", e), s.on("error", (n, i) => {
|
|
487
|
+
this.onError("xhr post error", n, i);
|
|
488
488
|
});
|
|
489
489
|
}
|
|
490
490
|
/**
|
|
@@ -499,7 +499,7 @@ class Cs extends As {
|
|
|
499
499
|
}), this.pollXhr = t;
|
|
500
500
|
}
|
|
501
501
|
}
|
|
502
|
-
class
|
|
502
|
+
class L extends E {
|
|
503
503
|
/**
|
|
504
504
|
* Request constructor
|
|
505
505
|
*
|
|
@@ -507,7 +507,7 @@ class P extends v {
|
|
|
507
507
|
* @package
|
|
508
508
|
*/
|
|
509
509
|
constructor(t, e, s) {
|
|
510
|
-
super(), this.createRequest = t,
|
|
510
|
+
super(), this.createRequest = t, qt(this, s), this._opts = s, this._method = s.method || "GET", this._uri = e, 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 P extends v {
|
|
|
516
516
|
*/
|
|
517
517
|
_create() {
|
|
518
518
|
var t;
|
|
519
|
-
const e =
|
|
519
|
+
const e = ts(this._opts, "agent", "pfx", "key", "passphrase", "cert", "ca", "ciphers", "rejectUnauthorized", "autoUnref");
|
|
520
520
|
e.xdomain = !!this._opts.xd;
|
|
521
521
|
const s = this._xhr = this.createRequest(e);
|
|
522
522
|
try {
|
|
@@ -524,8 +524,8 @@ class P extends v {
|
|
|
524
524
|
try {
|
|
525
525
|
if (this._opts.extraHeaders) {
|
|
526
526
|
s.setDisableHeaderCheck && s.setDisableHeaderCheck(!0);
|
|
527
|
-
for (let
|
|
528
|
-
this._opts.extraHeaders.hasOwnProperty(
|
|
527
|
+
for (let n in this._opts.extraHeaders)
|
|
528
|
+
this._opts.extraHeaders.hasOwnProperty(n) && s.setRequestHeader(n, this._opts.extraHeaders[n]);
|
|
529
529
|
}
|
|
530
530
|
} catch {
|
|
531
531
|
}
|
|
@@ -539,21 +539,21 @@ class P extends v {
|
|
|
539
539
|
} catch {
|
|
540
540
|
}
|
|
541
541
|
(t = this._opts.cookieJar) === null || t === void 0 || t.addCookies(s), "withCredentials" in s && (s.withCredentials = this._opts.withCredentials), this._opts.requestTimeout && (s.timeout = this._opts.requestTimeout), s.onreadystatechange = () => {
|
|
542
|
-
var
|
|
543
|
-
s.readyState === 3 && ((
|
|
542
|
+
var n;
|
|
543
|
+
s.readyState === 3 && ((n = this._opts.cookieJar) === null || n === void 0 || n.parseCookies(
|
|
544
544
|
// @ts-ignore
|
|
545
545
|
s.getResponseHeader("set-cookie")
|
|
546
546
|
)), s.readyState === 4 && (s.status === 200 || s.status === 1223 ? this._onLoad() : this.setTimeoutFn(() => {
|
|
547
547
|
this._onError(typeof s.status == "number" ? s.status : 0);
|
|
548
548
|
}, 0));
|
|
549
549
|
}, s.send(this._data);
|
|
550
|
-
} catch (
|
|
550
|
+
} catch (n) {
|
|
551
551
|
this.setTimeoutFn(() => {
|
|
552
|
-
this._onError(
|
|
552
|
+
this._onError(n);
|
|
553
553
|
}, 0);
|
|
554
554
|
return;
|
|
555
555
|
}
|
|
556
|
-
typeof document < "u" && (this._index =
|
|
556
|
+
typeof document < "u" && (this._index = L.requestsCount++, L.requests[this._index] = this);
|
|
557
557
|
}
|
|
558
558
|
/**
|
|
559
559
|
* Called upon error.
|
|
@@ -570,12 +570,12 @@ class P extends v {
|
|
|
570
570
|
*/
|
|
571
571
|
_cleanup(t) {
|
|
572
572
|
if (!(typeof this._xhr > "u" || this._xhr === null)) {
|
|
573
|
-
if (this._xhr.onreadystatechange =
|
|
573
|
+
if (this._xhr.onreadystatechange = pr, t)
|
|
574
574
|
try {
|
|
575
575
|
this._xhr.abort();
|
|
576
576
|
} catch {
|
|
577
577
|
}
|
|
578
|
-
typeof document < "u" && delete
|
|
578
|
+
typeof document < "u" && delete L.requests[this._index], this._xhr = null;
|
|
579
579
|
}
|
|
580
580
|
}
|
|
581
581
|
/**
|
|
@@ -596,61 +596,61 @@ class P extends v {
|
|
|
596
596
|
this._cleanup();
|
|
597
597
|
}
|
|
598
598
|
}
|
|
599
|
-
|
|
600
|
-
|
|
599
|
+
L.requestsCount = 0;
|
|
600
|
+
L.requests = {};
|
|
601
601
|
if (typeof document < "u") {
|
|
602
602
|
if (typeof attachEvent == "function")
|
|
603
|
-
attachEvent("onunload",
|
|
603
|
+
attachEvent("onunload", Pe);
|
|
604
604
|
else if (typeof addEventListener == "function") {
|
|
605
|
-
const
|
|
606
|
-
addEventListener(
|
|
605
|
+
const r = "onpagehide" in R ? "pagehide" : "unload";
|
|
606
|
+
addEventListener(r, Pe, !1);
|
|
607
607
|
}
|
|
608
608
|
}
|
|
609
|
-
function
|
|
610
|
-
for (let
|
|
611
|
-
|
|
609
|
+
function Pe() {
|
|
610
|
+
for (let r in L.requests)
|
|
611
|
+
L.requests.hasOwnProperty(r) && L.requests[r].abort();
|
|
612
612
|
}
|
|
613
|
-
const
|
|
614
|
-
const
|
|
613
|
+
const mr = function() {
|
|
614
|
+
const r = rs({
|
|
615
615
|
xdomain: !1
|
|
616
616
|
});
|
|
617
|
-
return
|
|
617
|
+
return r && r.responseType !== null;
|
|
618
618
|
}();
|
|
619
|
-
class
|
|
619
|
+
class gr extends yr {
|
|
620
620
|
constructor(t) {
|
|
621
621
|
super(t);
|
|
622
622
|
const e = t && t.forceBase64;
|
|
623
|
-
this.supportsBinary =
|
|
623
|
+
this.supportsBinary = mr && !e;
|
|
624
624
|
}
|
|
625
625
|
request(t = {}) {
|
|
626
|
-
return Object.assign(t, { xd: this.xd }, this.opts), new
|
|
626
|
+
return Object.assign(t, { xd: this.xd }, this.opts), new L(rs, this.uri(), t);
|
|
627
627
|
}
|
|
628
628
|
}
|
|
629
|
-
function
|
|
630
|
-
const t =
|
|
629
|
+
function rs(r) {
|
|
630
|
+
const t = r.xdomain;
|
|
631
631
|
try {
|
|
632
|
-
if (typeof XMLHttpRequest < "u" && (!t ||
|
|
632
|
+
if (typeof XMLHttpRequest < "u" && (!t || fr))
|
|
633
633
|
return new XMLHttpRequest();
|
|
634
634
|
} catch {
|
|
635
635
|
}
|
|
636
636
|
if (!t)
|
|
637
637
|
try {
|
|
638
|
-
return new
|
|
638
|
+
return new R[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP");
|
|
639
639
|
} catch {
|
|
640
640
|
}
|
|
641
641
|
}
|
|
642
|
-
const
|
|
643
|
-
class
|
|
642
|
+
const ns = typeof navigator < "u" && typeof navigator.product == "string" && navigator.product.toLowerCase() === "reactnative";
|
|
643
|
+
class wr extends _e {
|
|
644
644
|
get name() {
|
|
645
645
|
return "websocket";
|
|
646
646
|
}
|
|
647
647
|
doOpen() {
|
|
648
|
-
const t = this.uri(), e = this.opts.protocols, s =
|
|
648
|
+
const t = this.uri(), e = this.opts.protocols, s = ns ? {} : ts(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(t, e, s);
|
|
652
|
-
} catch (
|
|
653
|
-
return this.emitReserved("error",
|
|
652
|
+
} catch (n) {
|
|
653
|
+
return this.emitReserved("error", n);
|
|
654
654
|
}
|
|
655
655
|
this.ws.binaryType = this.socket.binaryType, this.addEventListeners();
|
|
656
656
|
}
|
|
@@ -670,13 +670,13 @@ class Ps extends ye {
|
|
|
670
670
|
write(t) {
|
|
671
671
|
this.writable = !1;
|
|
672
672
|
for (let e = 0; e < t.length; e++) {
|
|
673
|
-
const s = t[e],
|
|
674
|
-
|
|
673
|
+
const s = t[e], n = e === t.length - 1;
|
|
674
|
+
we(s, this.supportsBinary, (i) => {
|
|
675
675
|
try {
|
|
676
676
|
this.doWrite(s, i);
|
|
677
677
|
} catch {
|
|
678
678
|
}
|
|
679
|
-
|
|
679
|
+
n && Ft(() => {
|
|
680
680
|
this.writable = !0, this.emitReserved("drain");
|
|
681
681
|
}, this.setTimeoutFn);
|
|
682
682
|
});
|
|
@@ -693,19 +693,19 @@ class Ps extends ye {
|
|
|
693
693
|
*/
|
|
694
694
|
uri() {
|
|
695
695
|
const t = this.opts.secure ? "wss" : "ws", e = this.query || {};
|
|
696
|
-
return this.opts.timestampRequests && (e[this.opts.timestampParam] =
|
|
696
|
+
return this.opts.timestampRequests && (e[this.opts.timestampParam] = es()), this.supportsBinary || (e.b64 = 1), this.createUri(t, e);
|
|
697
697
|
}
|
|
698
698
|
}
|
|
699
|
-
const
|
|
700
|
-
class
|
|
699
|
+
const Gt = R.WebSocket || R.MozWebSocket;
|
|
700
|
+
class br extends wr {
|
|
701
701
|
createSocket(t, e, s) {
|
|
702
|
-
return
|
|
702
|
+
return ns ? new Gt(t, e, s) : e ? new Gt(t, e) : new Gt(t);
|
|
703
703
|
}
|
|
704
704
|
doWrite(t, e) {
|
|
705
705
|
this.ws.send(e);
|
|
706
706
|
}
|
|
707
707
|
}
|
|
708
|
-
class
|
|
708
|
+
class _r extends _e {
|
|
709
709
|
get name() {
|
|
710
710
|
return "webtransport";
|
|
711
711
|
}
|
|
@@ -721,11 +721,11 @@ class Ls extends ye {
|
|
|
721
721
|
this.onError("webtransport error", t);
|
|
722
722
|
}), this._transport.ready.then(() => {
|
|
723
723
|
this._transport.createBidirectionalStream().then((t) => {
|
|
724
|
-
const e =
|
|
725
|
-
|
|
724
|
+
const e = er(Number.MAX_SAFE_INTEGER, this.socket.binaryType), s = t.readable.pipeThrough(e).getReader(), n = tr();
|
|
725
|
+
n.readable.pipeTo(t.writable), this._writer = n.writable.getWriter();
|
|
726
726
|
const i = () => {
|
|
727
|
-
s.read().then(({ done: c, value:
|
|
728
|
-
c || (this.onPacket(
|
|
727
|
+
s.read().then(({ done: c, value: d }) => {
|
|
728
|
+
c || (this.onPacket(d), i());
|
|
729
729
|
}).catch((c) => {
|
|
730
730
|
});
|
|
731
731
|
};
|
|
@@ -738,9 +738,9 @@ class Ls extends ye {
|
|
|
738
738
|
write(t) {
|
|
739
739
|
this.writable = !1;
|
|
740
740
|
for (let e = 0; e < t.length; e++) {
|
|
741
|
-
const s = t[e],
|
|
741
|
+
const s = t[e], n = e === t.length - 1;
|
|
742
742
|
this._writer.write(s).then(() => {
|
|
743
|
-
|
|
743
|
+
n && Ft(() => {
|
|
744
744
|
this.writable = !0, this.emitReserved("drain");
|
|
745
745
|
}, this.setTimeoutFn);
|
|
746
746
|
});
|
|
@@ -751,11 +751,11 @@ class Ls extends ye {
|
|
|
751
751
|
(t = this._transport) === null || t === void 0 || t.close();
|
|
752
752
|
}
|
|
753
753
|
}
|
|
754
|
-
const
|
|
755
|
-
websocket:
|
|
756
|
-
webtransport:
|
|
757
|
-
polling:
|
|
758
|
-
},
|
|
754
|
+
const Er = {
|
|
755
|
+
websocket: br,
|
|
756
|
+
webtransport: _r,
|
|
757
|
+
polling: gr
|
|
758
|
+
}, vr = /^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/, Tr = [
|
|
759
759
|
"source",
|
|
760
760
|
"protocol",
|
|
761
761
|
"authority",
|
|
@@ -771,31 +771,31 @@ const Fs = {
|
|
|
771
771
|
"query",
|
|
772
772
|
"anchor"
|
|
773
773
|
];
|
|
774
|
-
function
|
|
775
|
-
if (
|
|
774
|
+
function Kt(r) {
|
|
775
|
+
if (r.length > 8e3)
|
|
776
776
|
throw "URI too long";
|
|
777
|
-
const t =
|
|
778
|
-
e != -1 && s != -1 && (
|
|
779
|
-
let
|
|
777
|
+
const t = r, e = r.indexOf("["), s = r.indexOf("]");
|
|
778
|
+
e != -1 && s != -1 && (r = r.substring(0, e) + r.substring(e, s).replace(/:/g, ";") + r.substring(s, r.length));
|
|
779
|
+
let n = vr.exec(r || ""), i = {}, o = 14;
|
|
780
780
|
for (; o--; )
|
|
781
|
-
i[
|
|
782
|
-
return e != -1 && s != -1 && (i.source = t, 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[Tr[o]] = n[o] || "";
|
|
782
|
+
return e != -1 && s != -1 && (i.source = t, 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 = Sr(i, i.path), i.queryKey = Ir(i, i.query), i;
|
|
783
783
|
}
|
|
784
|
-
function
|
|
784
|
+
function Sr(r, t) {
|
|
785
785
|
const e = /\/{2,9}/g, s = t.replace(e, "/").split("/");
|
|
786
786
|
return (t.slice(0, 1) == "/" || t.length === 0) && s.splice(0, 1), t.slice(-1) == "/" && s.splice(s.length - 1, 1), s;
|
|
787
787
|
}
|
|
788
|
-
function
|
|
788
|
+
function Ir(r, t) {
|
|
789
789
|
const e = {};
|
|
790
|
-
return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g, function(s,
|
|
791
|
-
|
|
790
|
+
return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g, function(s, n, i) {
|
|
791
|
+
n && (e[n] = i);
|
|
792
792
|
}), e;
|
|
793
793
|
}
|
|
794
|
-
const
|
|
795
|
-
|
|
796
|
-
|
|
794
|
+
const zt = typeof addEventListener == "function" && typeof removeEventListener == "function", Ct = [];
|
|
795
|
+
zt && addEventListener("offline", () => {
|
|
796
|
+
Ct.forEach((r) => r());
|
|
797
797
|
}, !1);
|
|
798
|
-
class
|
|
798
|
+
class z extends E {
|
|
799
799
|
/**
|
|
800
800
|
* Socket constructor.
|
|
801
801
|
*
|
|
@@ -803,13 +803,13 @@ class Y extends v {
|
|
|
803
803
|
* @param {Object} opts - options
|
|
804
804
|
*/
|
|
805
805
|
constructor(t, e) {
|
|
806
|
-
if (super(), this.binaryType =
|
|
807
|
-
const s =
|
|
806
|
+
if (super(), this.binaryType = rr, this.writeBuffer = [], this._prevBufferLen = 0, this._pingInterval = -1, this._pingTimeout = -1, this._maxPayload = -1, this._pingTimeoutTime = 1 / 0, t && typeof t == "object" && (e = t, t = null), t) {
|
|
807
|
+
const s = Kt(t);
|
|
808
808
|
e.hostname = s.host, e.secure = s.protocol === "https" || s.protocol === "wss", e.port = s.port, s.query && (e.query = s.query);
|
|
809
|
-
} else e.host && (e.hostname =
|
|
810
|
-
|
|
811
|
-
const
|
|
812
|
-
this.transports.push(
|
|
809
|
+
} else e.host && (e.hostname = Kt(e.host).host);
|
|
810
|
+
qt(this, e), this.secure = e.secure != null ? e.secure : typeof location < "u" && location.protocol === "https:", e.hostname && !e.port && (e.port = this.secure ? "443" : "80"), this.hostname = e.hostname || (typeof location < "u" ? location.hostname : "localhost"), this.port = e.port || (typeof location < "u" && location.port ? location.port : this.secure ? "443" : "80"), this.transports = [], this._transportsByName = {}, e.transports.forEach((s) => {
|
|
811
|
+
const n = s.prototype.name;
|
|
812
|
+
this.transports.push(n), this._transportsByName[n] = s;
|
|
813
813
|
}), this.opts = Object.assign({
|
|
814
814
|
path: "/engine.io",
|
|
815
815
|
agent: !1,
|
|
@@ -824,13 +824,13 @@ class Y extends v {
|
|
|
824
824
|
},
|
|
825
825
|
transportOptions: {},
|
|
826
826
|
closeOnBeforeunload: !1
|
|
827
|
-
}, e), this.opts.path = this.opts.path.replace(/\/$/, "") + (this.opts.addTrailingSlash ? "/" : ""), typeof this.opts.query == "string" && (this.opts.query =
|
|
827
|
+
}, e), this.opts.path = this.opts.path.replace(/\/$/, "") + (this.opts.addTrailingSlash ? "/" : ""), typeof this.opts.query == "string" && (this.opts.query = lr(this.opts.query)), zt && (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
|
+
}, Ct.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 Y extends v {
|
|
|
841
841
|
*/
|
|
842
842
|
createTransport(t) {
|
|
843
843
|
const e = Object.assign({}, this.opts.query);
|
|
844
|
-
e.EIO =
|
|
844
|
+
e.EIO = Ze, e.transport = t, this.id && (e.sid = this.id);
|
|
845
845
|
const s = Object.assign({}, this.opts, {
|
|
846
846
|
query: e,
|
|
847
847
|
socket: this,
|
|
@@ -863,7 +863,7 @@ class Y extends v {
|
|
|
863
863
|
}, 0);
|
|
864
864
|
return;
|
|
865
865
|
}
|
|
866
|
-
const t = this.opts.rememberUpgrade &&
|
|
866
|
+
const t = this.opts.rememberUpgrade && z.priorWebsocketSuccess && this.transports.indexOf("websocket") !== -1 ? "websocket" : this.transports[0];
|
|
867
867
|
this.readyState = "opening";
|
|
868
868
|
const e = this.createTransport(t);
|
|
869
869
|
e.open(), this.setTransport(e);
|
|
@@ -882,7 +882,7 @@ class Y extends v {
|
|
|
882
882
|
* @private
|
|
883
883
|
*/
|
|
884
884
|
onOpen() {
|
|
885
|
-
this.readyState = "open",
|
|
885
|
+
this.readyState = "open", z.priorWebsocketSuccess = this.transport.name === "websocket", this.emitReserved("open"), this.flush();
|
|
886
886
|
}
|
|
887
887
|
/**
|
|
888
888
|
* Handles a packet.
|
|
@@ -958,8 +958,8 @@ class Y extends v {
|
|
|
958
958
|
return this.writeBuffer;
|
|
959
959
|
let e = 1;
|
|
960
960
|
for (let s = 0; s < this.writeBuffer.length; s++) {
|
|
961
|
-
const
|
|
962
|
-
if (
|
|
961
|
+
const n = this.writeBuffer[s].data;
|
|
962
|
+
if (n && (e += ar(n)), s > 0 && e > this._maxPayload)
|
|
963
963
|
return this.writeBuffer.slice(0, s);
|
|
964
964
|
e += 2;
|
|
965
965
|
}
|
|
@@ -979,7 +979,7 @@ class Y extends v {
|
|
|
979
979
|
if (!this._pingTimeoutTime)
|
|
980
980
|
return !0;
|
|
981
981
|
const t = Date.now() > this._pingTimeoutTime;
|
|
982
|
-
return t && (this._pingTimeoutTime = 0,
|
|
982
|
+
return t && (this._pingTimeoutTime = 0, Ft(() => {
|
|
983
983
|
this._onClose("ping timeout");
|
|
984
984
|
}, this.setTimeoutFn)), t;
|
|
985
985
|
}
|
|
@@ -1014,8 +1014,8 @@ class Y extends v {
|
|
|
1014
1014
|
* @param {Function} fn - callback function.
|
|
1015
1015
|
* @private
|
|
1016
1016
|
*/
|
|
1017
|
-
_sendPacket(t, e, s,
|
|
1018
|
-
if (typeof e == "function" && (
|
|
1017
|
+
_sendPacket(t, e, s, n) {
|
|
1018
|
+
if (typeof e == "function" && (n = e, e = void 0), typeof s == "function" && (n = s, s = null), this.readyState === "closing" || this.readyState === "closed")
|
|
1019
1019
|
return;
|
|
1020
1020
|
s = s || {}, s.compress = s.compress !== !1;
|
|
1021
1021
|
const i = {
|
|
@@ -1023,7 +1023,7 @@ class Y extends v {
|
|
|
1023
1023
|
data: e,
|
|
1024
1024
|
options: s
|
|
1025
1025
|
};
|
|
1026
|
-
this.emitReserved("packetCreate", i), this.writeBuffer.push(i),
|
|
1026
|
+
this.emitReserved("packetCreate", i), this.writeBuffer.push(i), n && this.once("flush", n), this.flush();
|
|
1027
1027
|
}
|
|
1028
1028
|
/**
|
|
1029
1029
|
* Closes the connection.
|
|
@@ -1046,7 +1046,7 @@ class Y extends v {
|
|
|
1046
1046
|
* @private
|
|
1047
1047
|
*/
|
|
1048
1048
|
_onError(t) {
|
|
1049
|
-
if (
|
|
1049
|
+
if (z.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", t), this._onClose("transport error", t);
|
|
1052
1052
|
}
|
|
@@ -1057,16 +1057,16 @@ class Y extends v {
|
|
|
1057
1057
|
*/
|
|
1058
1058
|
_onClose(t, e) {
|
|
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(), zt && (this._beforeunloadEventListener && removeEventListener("beforeunload", this._beforeunloadEventListener, !1), this._offlineEventListener)) {
|
|
1061
|
+
const s = Ct.indexOf(this._offlineEventListener);
|
|
1062
|
+
s !== -1 && Ct.splice(s, 1);
|
|
1063
1063
|
}
|
|
1064
1064
|
this.readyState = "closed", this.id = null, this.emitReserved("close", t, e), this.writeBuffer = [], this._prevBufferLen = 0;
|
|
1065
1065
|
}
|
|
1066
1066
|
}
|
|
1067
1067
|
}
|
|
1068
|
-
|
|
1069
|
-
class
|
|
1068
|
+
z.protocol = Ze;
|
|
1069
|
+
class Or extends z {
|
|
1070
1070
|
constructor() {
|
|
1071
1071
|
super(...arguments), this._upgrades = [];
|
|
1072
1072
|
}
|
|
@@ -1083,42 +1083,42 @@ class Ms extends Y {
|
|
|
1083
1083
|
*/
|
|
1084
1084
|
_probe(t) {
|
|
1085
1085
|
let e = this.createTransport(t), s = !1;
|
|
1086
|
-
|
|
1087
|
-
const
|
|
1088
|
-
s || (e.send([{ type: "ping", data: "probe" }]), e.once("packet", (
|
|
1086
|
+
z.priorWebsocketSuccess = !1;
|
|
1087
|
+
const n = () => {
|
|
1088
|
+
s || (e.send([{ type: "ping", data: "probe" }]), e.once("packet", (g) => {
|
|
1089
1089
|
if (!s)
|
|
1090
|
-
if (
|
|
1090
|
+
if (g.type === "pong" && g.data === "probe") {
|
|
1091
1091
|
if (this.upgrading = !0, this.emitReserved("upgrading", e), !e)
|
|
1092
1092
|
return;
|
|
1093
|
-
|
|
1094
|
-
s || this.readyState !== "closed" && (
|
|
1093
|
+
z.priorWebsocketSuccess = e.name === "websocket", this.transport.pause(() => {
|
|
1094
|
+
s || this.readyState !== "closed" && (h(), this.setTransport(e), e.send([{ type: "upgrade" }]), this.emitReserved("upgrade", e), e = null, this.upgrading = !1, this.flush());
|
|
1095
1095
|
});
|
|
1096
1096
|
} else {
|
|
1097
|
-
const
|
|
1098
|
-
|
|
1097
|
+
const S = new Error("probe error");
|
|
1098
|
+
S.transport = e.name, this.emitReserved("upgradeError", S);
|
|
1099
1099
|
}
|
|
1100
1100
|
}));
|
|
1101
1101
|
};
|
|
1102
1102
|
function i() {
|
|
1103
|
-
s || (s = !0,
|
|
1103
|
+
s || (s = !0, h(), e.close(), e = null);
|
|
1104
1104
|
}
|
|
1105
|
-
const o = (
|
|
1106
|
-
const
|
|
1107
|
-
|
|
1105
|
+
const o = (g) => {
|
|
1106
|
+
const S = new Error("probe error: " + g);
|
|
1107
|
+
S.transport = e.name, i(), this.emitReserved("upgradeError", S);
|
|
1108
1108
|
};
|
|
1109
1109
|
function c() {
|
|
1110
1110
|
o("transport closed");
|
|
1111
1111
|
}
|
|
1112
|
-
function
|
|
1112
|
+
function d() {
|
|
1113
1113
|
o("socket closed");
|
|
1114
1114
|
}
|
|
1115
|
-
function f(
|
|
1116
|
-
e &&
|
|
1115
|
+
function f(g) {
|
|
1116
|
+
e && g.name !== e.name && i();
|
|
1117
1117
|
}
|
|
1118
|
-
const
|
|
1119
|
-
e.removeListener("open",
|
|
1118
|
+
const h = () => {
|
|
1119
|
+
e.removeListener("open", n), e.removeListener("error", o), e.removeListener("close", c), this.off("close", d), this.off("upgrading", f);
|
|
1120
1120
|
};
|
|
1121
|
-
e.once("open",
|
|
1121
|
+
e.once("open", n), e.once("error", o), e.once("close", c), this.once("close", d), this.once("upgrading", f), this._upgrades.indexOf("webtransport") !== -1 && t !== "webtransport" ? this.setTimeoutFn(() => {
|
|
1122
1122
|
s || e.open();
|
|
1123
1123
|
}, 200) : e.open();
|
|
1124
1124
|
}
|
|
@@ -1138,82 +1138,82 @@ class Ms extends Y {
|
|
|
1138
1138
|
return e;
|
|
1139
1139
|
}
|
|
1140
1140
|
}
|
|
1141
|
-
let
|
|
1141
|
+
let Ar = class extends Or {
|
|
1142
1142
|
constructor(t, e = {}) {
|
|
1143
|
-
const s = typeof t == "object",
|
|
1144
|
-
(!
|
|
1143
|
+
const s = typeof t == "object", n = s ? { ...t } : { ...e };
|
|
1144
|
+
(!n.transports || n.transports && typeof n.transports[0] == "string") && (n.transports = (n.transports || ["polling", "websocket", "webtransport"]).map((i) => Er[i]).filter((i) => !!i)), super(s ? n : t, n);
|
|
1145
1145
|
}
|
|
1146
1146
|
};
|
|
1147
|
-
function
|
|
1148
|
-
let s =
|
|
1149
|
-
e = e || typeof location < "u" && location,
|
|
1147
|
+
function kr(r, t = "", e) {
|
|
1148
|
+
let s = r;
|
|
1149
|
+
e = e || typeof location < "u" && location, r == null && (r = e.protocol + "//" + e.host), typeof r == "string" && (r.charAt(0) === "/" && (r.charAt(1) === "/" ? r = e.protocol + r : r = e.host + r), /^(https?|wss?):\/\//.test(r) || (typeof e < "u" ? r = e.protocol + "//" + r : r = "https://" + r), s = Kt(r)), 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 + t, s.href = s.protocol + "://" + i + (e && e.port === s.port ? "" : ":" + s.port), s;
|
|
1152
1152
|
}
|
|
1153
|
-
const
|
|
1154
|
-
function
|
|
1155
|
-
return
|
|
1153
|
+
const Cr = typeof ArrayBuffer == "function", xr = (r) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(r) : r.buffer instanceof ArrayBuffer, is = Object.prototype.toString, Rr = typeof Blob == "function" || typeof Blob < "u" && is.call(Blob) === "[object BlobConstructor]", $r = typeof File == "function" || typeof File < "u" && is.call(File) === "[object FileConstructor]";
|
|
1154
|
+
function Ee(r) {
|
|
1155
|
+
return Cr && (r instanceof ArrayBuffer || xr(r)) || Rr && r instanceof Blob || $r && r instanceof File;
|
|
1156
1156
|
}
|
|
1157
|
-
function
|
|
1158
|
-
if (!
|
|
1157
|
+
function xt(r, t) {
|
|
1158
|
+
if (!r || typeof r != "object")
|
|
1159
1159
|
return !1;
|
|
1160
|
-
if (Array.isArray(
|
|
1161
|
-
for (let e = 0, s =
|
|
1162
|
-
if (
|
|
1160
|
+
if (Array.isArray(r)) {
|
|
1161
|
+
for (let e = 0, s = r.length; e < s; e++)
|
|
1162
|
+
if (xt(r[e]))
|
|
1163
1163
|
return !0;
|
|
1164
1164
|
return !1;
|
|
1165
1165
|
}
|
|
1166
|
-
if (
|
|
1166
|
+
if (Ee(r))
|
|
1167
1167
|
return !0;
|
|
1168
|
-
if (
|
|
1169
|
-
return
|
|
1170
|
-
for (const e in
|
|
1171
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
1168
|
+
if (r.toJSON && typeof r.toJSON == "function" && arguments.length === 1)
|
|
1169
|
+
return xt(r.toJSON(), !0);
|
|
1170
|
+
for (const e in r)
|
|
1171
|
+
if (Object.prototype.hasOwnProperty.call(r, e) && xt(r[e]))
|
|
1172
1172
|
return !0;
|
|
1173
1173
|
return !1;
|
|
1174
1174
|
}
|
|
1175
|
-
function
|
|
1176
|
-
const t = [], e =
|
|
1177
|
-
return s.data =
|
|
1175
|
+
function Nr(r) {
|
|
1176
|
+
const t = [], e = r.data, s = r;
|
|
1177
|
+
return s.data = Xt(e, t), s.attachments = t.length, { packet: s, buffers: t };
|
|
1178
1178
|
}
|
|
1179
|
-
function
|
|
1180
|
-
if (!
|
|
1181
|
-
return
|
|
1182
|
-
if (
|
|
1179
|
+
function Xt(r, t) {
|
|
1180
|
+
if (!r)
|
|
1181
|
+
return r;
|
|
1182
|
+
if (Ee(r)) {
|
|
1183
1183
|
const e = { _placeholder: !0, num: t.length };
|
|
1184
|
-
return t.push(
|
|
1185
|
-
} else if (Array.isArray(
|
|
1186
|
-
const e = new Array(
|
|
1187
|
-
for (let s = 0; s <
|
|
1188
|
-
e[s] =
|
|
1184
|
+
return t.push(r), e;
|
|
1185
|
+
} else if (Array.isArray(r)) {
|
|
1186
|
+
const e = new Array(r.length);
|
|
1187
|
+
for (let s = 0; s < r.length; s++)
|
|
1188
|
+
e[s] = Xt(r[s], t);
|
|
1189
1189
|
return e;
|
|
1190
|
-
} else if (typeof
|
|
1190
|
+
} else if (typeof r == "object" && !(r instanceof Date)) {
|
|
1191
1191
|
const e = {};
|
|
1192
|
-
for (const s in
|
|
1193
|
-
Object.prototype.hasOwnProperty.call(
|
|
1192
|
+
for (const s in r)
|
|
1193
|
+
Object.prototype.hasOwnProperty.call(r, s) && (e[s] = Xt(r[s], t));
|
|
1194
1194
|
return e;
|
|
1195
1195
|
}
|
|
1196
|
-
return
|
|
1196
|
+
return r;
|
|
1197
1197
|
}
|
|
1198
|
-
function
|
|
1199
|
-
return
|
|
1198
|
+
function Pr(r, t) {
|
|
1199
|
+
return r.data = Qt(r.data, t), delete r.attachments, r;
|
|
1200
1200
|
}
|
|
1201
|
-
function
|
|
1202
|
-
if (!
|
|
1203
|
-
return
|
|
1204
|
-
if (
|
|
1205
|
-
if (typeof
|
|
1206
|
-
return t[
|
|
1201
|
+
function Qt(r, t) {
|
|
1202
|
+
if (!r)
|
|
1203
|
+
return r;
|
|
1204
|
+
if (r && r._placeholder === !0) {
|
|
1205
|
+
if (typeof r.num == "number" && r.num >= 0 && r.num < t.length)
|
|
1206
|
+
return t[r.num];
|
|
1207
1207
|
throw new Error("illegal attachments");
|
|
1208
|
-
} else if (Array.isArray(
|
|
1209
|
-
for (let e = 0; e <
|
|
1210
|
-
|
|
1211
|
-
else if (typeof
|
|
1212
|
-
for (const e in
|
|
1213
|
-
Object.prototype.hasOwnProperty.call(
|
|
1214
|
-
return
|
|
1208
|
+
} else if (Array.isArray(r))
|
|
1209
|
+
for (let e = 0; e < r.length; e++)
|
|
1210
|
+
r[e] = Qt(r[e], t);
|
|
1211
|
+
else if (typeof r == "object")
|
|
1212
|
+
for (const e in r)
|
|
1213
|
+
Object.prototype.hasOwnProperty.call(r, e) && (r[e] = Qt(r[e], t));
|
|
1214
|
+
return r;
|
|
1215
1215
|
}
|
|
1216
|
-
const
|
|
1216
|
+
const Br = [
|
|
1217
1217
|
"connect",
|
|
1218
1218
|
// used on the client side
|
|
1219
1219
|
"connect_error",
|
|
@@ -1227,11 +1227,11 @@ const Xs = [
|
|
|
1227
1227
|
"removeListener"
|
|
1228
1228
|
// used by the Node.js EventEmitter
|
|
1229
1229
|
];
|
|
1230
|
-
var
|
|
1231
|
-
(function(
|
|
1232
|
-
|
|
1233
|
-
})(
|
|
1234
|
-
class
|
|
1230
|
+
var w;
|
|
1231
|
+
(function(r) {
|
|
1232
|
+
r[r.CONNECT = 0] = "CONNECT", r[r.DISCONNECT = 1] = "DISCONNECT", r[r.EVENT = 2] = "EVENT", r[r.ACK = 3] = "ACK", r[r.CONNECT_ERROR = 4] = "CONNECT_ERROR", r[r.BINARY_EVENT = 5] = "BINARY_EVENT", r[r.BINARY_ACK = 6] = "BINARY_ACK";
|
|
1233
|
+
})(w || (w = {}));
|
|
1234
|
+
class Lr {
|
|
1235
1235
|
/**
|
|
1236
1236
|
* Encoder constructor
|
|
1237
1237
|
*
|
|
@@ -1247,8 +1247,8 @@ class Qs {
|
|
|
1247
1247
|
* @param {Object} obj - packet object
|
|
1248
1248
|
*/
|
|
1249
1249
|
encode(t) {
|
|
1250
|
-
return (t.type ===
|
|
1251
|
-
type: t.type ===
|
|
1250
|
+
return (t.type === w.EVENT || t.type === w.ACK) && xt(t) ? this.encodeAsBinary({
|
|
1251
|
+
type: t.type === w.EVENT ? w.BINARY_EVENT : w.BINARY_ACK,
|
|
1252
1252
|
nsp: t.nsp,
|
|
1253
1253
|
data: t.data,
|
|
1254
1254
|
id: t.id
|
|
@@ -1259,7 +1259,7 @@ class Qs {
|
|
|
1259
1259
|
*/
|
|
1260
1260
|
encodeAsString(t) {
|
|
1261
1261
|
let e = "" + t.type;
|
|
1262
|
-
return (t.type ===
|
|
1262
|
+
return (t.type === w.BINARY_EVENT || t.type === w.BINARY_ACK) && (e += t.attachments + "-"), t.nsp && t.nsp !== "/" && (e += t.nsp + ","), t.id != null && (e += t.id), t.data != null && (e += JSON.stringify(t.data, this.replacer)), e;
|
|
1263
1263
|
}
|
|
1264
1264
|
/**
|
|
1265
1265
|
* Encode packet as 'buffer sequence' by removing blobs, and
|
|
@@ -1267,11 +1267,11 @@ class Qs {
|
|
|
1267
1267
|
* a list of buffers.
|
|
1268
1268
|
*/
|
|
1269
1269
|
encodeAsBinary(t) {
|
|
1270
|
-
const e =
|
|
1271
|
-
return
|
|
1270
|
+
const e = Nr(t), s = this.encodeAsString(e.packet), n = e.buffers;
|
|
1271
|
+
return n.unshift(s), n;
|
|
1272
1272
|
}
|
|
1273
1273
|
}
|
|
1274
|
-
class
|
|
1274
|
+
class ve extends E {
|
|
1275
1275
|
/**
|
|
1276
1276
|
* Decoder constructor
|
|
1277
1277
|
*/
|
|
@@ -1292,9 +1292,9 @@ class ge extends v {
|
|
|
1292
1292
|
if (this.reconstructor)
|
|
1293
1293
|
throw new Error("got plaintext data when reconstructing a packet");
|
|
1294
1294
|
e = this.decodeString(t);
|
|
1295
|
-
const s = e.type ===
|
|
1296
|
-
s || e.type ===
|
|
1297
|
-
} else if (
|
|
1295
|
+
const s = e.type === w.BINARY_EVENT;
|
|
1296
|
+
s || e.type === w.BINARY_ACK ? (e.type = s ? w.EVENT : w.ACK, this.reconstructor = new Fr(e), e.attachments === 0 && super.emitReserved("decoded", e)) : super.emitReserved("decoded", e);
|
|
1297
|
+
} else if (Ee(t) || t.base64)
|
|
1298
1298
|
if (this.reconstructor)
|
|
1299
1299
|
e = this.reconstructor.takeBinaryData(t), e && (this.reconstructor = null, super.emitReserved("decoded", e));
|
|
1300
1300
|
else
|
|
@@ -1313,9 +1313,9 @@ class ge extends v {
|
|
|
1313
1313
|
const s = {
|
|
1314
1314
|
type: Number(t.charAt(0))
|
|
1315
1315
|
};
|
|
1316
|
-
if (
|
|
1316
|
+
if (w[s.type] === void 0)
|
|
1317
1317
|
throw new Error("unknown packet type " + s.type);
|
|
1318
|
-
if (s.type ===
|
|
1318
|
+
if (s.type === w.BINARY_EVENT || s.type === w.BINARY_ACK) {
|
|
1319
1319
|
const i = e + 1;
|
|
1320
1320
|
for (; t.charAt(++e) !== "-" && e != t.length; )
|
|
1321
1321
|
;
|
|
@@ -1323,7 +1323,7 @@ class ge extends v {
|
|
|
1323
1323
|
if (o != Number(o) || t.charAt(e) !== "-")
|
|
1324
1324
|
throw new Error("Illegal attachments");
|
|
1325
1325
|
const c = Number(o);
|
|
1326
|
-
if (!
|
|
1326
|
+
if (!qr(c) || c < 0)
|
|
1327
1327
|
throw new Error("Illegal attachments");
|
|
1328
1328
|
if (c > this.opts.maxAttachments)
|
|
1329
1329
|
throw new Error("too many attachments");
|
|
@@ -1336,8 +1336,8 @@ class ge extends v {
|
|
|
1336
1336
|
s.nsp = t.substring(i, e);
|
|
1337
1337
|
} else
|
|
1338
1338
|
s.nsp = "/";
|
|
1339
|
-
const
|
|
1340
|
-
if (
|
|
1339
|
+
const n = t.charAt(e + 1);
|
|
1340
|
+
if (n !== "" && Number(n) == n) {
|
|
1341
1341
|
const i = e + 1;
|
|
1342
1342
|
for (; ++e; ) {
|
|
1343
1343
|
const o = t.charAt(e);
|
|
@@ -1352,7 +1352,7 @@ class ge extends v {
|
|
|
1352
1352
|
}
|
|
1353
1353
|
if (t.charAt(++e)) {
|
|
1354
1354
|
const i = this.tryParse(t.substr(e));
|
|
1355
|
-
if (
|
|
1355
|
+
if (ve.isPayloadValid(s.type, i))
|
|
1356
1356
|
s.data = i;
|
|
1357
1357
|
else
|
|
1358
1358
|
throw new Error("invalid payload");
|
|
@@ -1368,17 +1368,17 @@ class ge extends v {
|
|
|
1368
1368
|
}
|
|
1369
1369
|
static isPayloadValid(t, e) {
|
|
1370
1370
|
switch (t) {
|
|
1371
|
-
case
|
|
1372
|
-
return
|
|
1373
|
-
case
|
|
1371
|
+
case w.CONNECT:
|
|
1372
|
+
return Be(e);
|
|
1373
|
+
case w.DISCONNECT:
|
|
1374
1374
|
return e === void 0;
|
|
1375
|
-
case
|
|
1376
|
-
return typeof e == "string" ||
|
|
1377
|
-
case
|
|
1378
|
-
case
|
|
1379
|
-
return Array.isArray(e) && (typeof e[0] == "number" || typeof e[0] == "string" &&
|
|
1380
|
-
case
|
|
1381
|
-
case
|
|
1375
|
+
case w.CONNECT_ERROR:
|
|
1376
|
+
return typeof e == "string" || Be(e);
|
|
1377
|
+
case w.EVENT:
|
|
1378
|
+
case w.BINARY_EVENT:
|
|
1379
|
+
return Array.isArray(e) && (typeof e[0] == "number" || typeof e[0] == "string" && Br.indexOf(e[0]) === -1);
|
|
1380
|
+
case w.ACK:
|
|
1381
|
+
case w.BINARY_ACK:
|
|
1382
1382
|
return Array.isArray(e);
|
|
1383
1383
|
}
|
|
1384
1384
|
}
|
|
@@ -1389,7 +1389,7 @@ class ge extends v {
|
|
|
1389
1389
|
this.reconstructor && (this.reconstructor.finishedReconstruction(), this.reconstructor = null);
|
|
1390
1390
|
}
|
|
1391
1391
|
}
|
|
1392
|
-
class
|
|
1392
|
+
class Fr {
|
|
1393
1393
|
constructor(t) {
|
|
1394
1394
|
this.packet = t, this.buffers = [], this.reconPack = t;
|
|
1395
1395
|
}
|
|
@@ -1403,7 +1403,7 @@ class Zs {
|
|
|
1403
1403
|
*/
|
|
1404
1404
|
takeBinaryData(t) {
|
|
1405
1405
|
if (this.buffers.push(t), this.buffers.length === this.reconPack.attachments) {
|
|
1406
|
-
const e =
|
|
1406
|
+
const e = Pr(this.reconPack, this.buffers);
|
|
1407
1407
|
return this.finishedReconstruction(), e;
|
|
1408
1408
|
}
|
|
1409
1409
|
return null;
|
|
@@ -1415,26 +1415,26 @@ class Zs {
|
|
|
1415
1415
|
this.reconPack = null, this.buffers = [];
|
|
1416
1416
|
}
|
|
1417
1417
|
}
|
|
1418
|
-
const
|
|
1419
|
-
return typeof
|
|
1418
|
+
const qr = Number.isInteger || function(r) {
|
|
1419
|
+
return typeof r == "number" && isFinite(r) && Math.floor(r) === r;
|
|
1420
1420
|
};
|
|
1421
|
-
function
|
|
1422
|
-
return Object.prototype.toString.call(
|
|
1421
|
+
function Be(r) {
|
|
1422
|
+
return Object.prototype.toString.call(r) === "[object Object]";
|
|
1423
1423
|
}
|
|
1424
|
-
const
|
|
1424
|
+
const Dr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1425
1425
|
__proto__: null,
|
|
1426
|
-
Decoder:
|
|
1427
|
-
Encoder:
|
|
1426
|
+
Decoder: ve,
|
|
1427
|
+
Encoder: Lr,
|
|
1428
1428
|
get PacketType() {
|
|
1429
|
-
return
|
|
1429
|
+
return w;
|
|
1430
1430
|
}
|
|
1431
1431
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1432
|
-
function
|
|
1433
|
-
return
|
|
1434
|
-
|
|
1432
|
+
function N(r, t, e) {
|
|
1433
|
+
return r.on(t, e), function() {
|
|
1434
|
+
r.off(t, e);
|
|
1435
1435
|
};
|
|
1436
1436
|
}
|
|
1437
|
-
const
|
|
1437
|
+
const Ur = Object.freeze({
|
|
1438
1438
|
connect: 1,
|
|
1439
1439
|
connect_error: 1,
|
|
1440
1440
|
disconnect: 1,
|
|
@@ -1443,7 +1443,7 @@ const sn = Object.freeze({
|
|
|
1443
1443
|
newListener: 1,
|
|
1444
1444
|
removeListener: 1
|
|
1445
1445
|
});
|
|
1446
|
-
class
|
|
1446
|
+
class os extends E {
|
|
1447
1447
|
/**
|
|
1448
1448
|
* `Socket` constructor.
|
|
1449
1449
|
*/
|
|
@@ -1477,10 +1477,10 @@ class We extends v {
|
|
|
1477
1477
|
return;
|
|
1478
1478
|
const t = this.io;
|
|
1479
1479
|
this.subs = [
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1480
|
+
N(t, "open", this.onopen.bind(this)),
|
|
1481
|
+
N(t, "packet", this.onpacket.bind(this)),
|
|
1482
|
+
N(t, "error", this.onerror.bind(this)),
|
|
1483
|
+
N(t, "close", this.onclose.bind(this))
|
|
1484
1484
|
];
|
|
1485
1485
|
}
|
|
1486
1486
|
/**
|
|
@@ -1558,29 +1558,29 @@ class We extends v {
|
|
|
1558
1558
|
* @return self
|
|
1559
1559
|
*/
|
|
1560
1560
|
emit(t, ...e) {
|
|
1561
|
-
var s,
|
|
1562
|
-
if (
|
|
1561
|
+
var s, n, i;
|
|
1562
|
+
if (Ur.hasOwnProperty(t))
|
|
1563
1563
|
throw new Error('"' + t.toString() + '" is a reserved event name');
|
|
1564
1564
|
if (e.unshift(t), this._opts.retries && !this.flags.fromQueue && !this.flags.volatile)
|
|
1565
1565
|
return this._addToQueue(e), this;
|
|
1566
1566
|
const o = {
|
|
1567
|
-
type:
|
|
1567
|
+
type: w.EVENT,
|
|
1568
1568
|
data: e
|
|
1569
1569
|
};
|
|
1570
1570
|
if (o.options = {}, o.options.compress = this.flags.compress !== !1, typeof e[e.length - 1] == "function") {
|
|
1571
|
-
const
|
|
1572
|
-
this._registerAckCallback(
|
|
1571
|
+
const h = this.ids++, g = e.pop();
|
|
1572
|
+
this._registerAckCallback(h, g), o.id = h;
|
|
1573
1573
|
}
|
|
1574
|
-
const c = (
|
|
1575
|
-
return this.flags.volatile && !c || (
|
|
1574
|
+
const c = (n = (s = this.io.engine) === null || s === void 0 ? void 0 : s.transport) === null || n === void 0 ? void 0 : n.writable, d = this.connected && !(!((i = this.io.engine) === null || i === void 0) && i._hasPingExpired());
|
|
1575
|
+
return this.flags.volatile && !c || (d ? (this.notifyOutgoingListeners(o), this.packet(o)) : this.sendBuffer.push(o)), this.flags = {}, this;
|
|
1576
1576
|
}
|
|
1577
1577
|
/**
|
|
1578
1578
|
* @private
|
|
1579
1579
|
*/
|
|
1580
1580
|
_registerAckCallback(t, e) {
|
|
1581
1581
|
var s;
|
|
1582
|
-
const
|
|
1583
|
-
if (
|
|
1582
|
+
const n = (s = this.flags.timeout) !== null && s !== void 0 ? s : this._opts.ackTimeout;
|
|
1583
|
+
if (n === void 0) {
|
|
1584
1584
|
this.acks[t] = e;
|
|
1585
1585
|
return;
|
|
1586
1586
|
}
|
|
@@ -1589,7 +1589,7 @@ class We extends v {
|
|
|
1589
1589
|
for (let c = 0; c < this.sendBuffer.length; c++)
|
|
1590
1590
|
this.sendBuffer[c].id === t && this.sendBuffer.splice(c, 1);
|
|
1591
1591
|
e.call(this, new Error("operation has timed out"));
|
|
1592
|
-
},
|
|
1592
|
+
}, n), o = (...c) => {
|
|
1593
1593
|
this.io.clearTimeoutFn(i), e.apply(this, c);
|
|
1594
1594
|
};
|
|
1595
1595
|
o.withError = !0, this.acks[t] = o;
|
|
@@ -1611,8 +1611,8 @@ class We extends v {
|
|
|
1611
1611
|
* @return a Promise that will be fulfilled when the server acknowledges the event
|
|
1612
1612
|
*/
|
|
1613
1613
|
emitWithAck(t, ...e) {
|
|
1614
|
-
return new Promise((s,
|
|
1615
|
-
const i = (o, c) => o ?
|
|
1614
|
+
return new Promise((s, n) => {
|
|
1615
|
+
const i = (o, c) => o ? n(o) : s(c);
|
|
1616
1616
|
i.withError = !0, e.push(i), this.emit(t, ...e);
|
|
1617
1617
|
});
|
|
1618
1618
|
}
|
|
@@ -1631,7 +1631,7 @@ class We extends v {
|
|
|
1631
1631
|
args: t,
|
|
1632
1632
|
flags: Object.assign({ fromQueue: !0 }, this.flags)
|
|
1633
1633
|
};
|
|
1634
|
-
t.push((
|
|
1634
|
+
t.push((n, ...i) => (this._queue[0], n !== null ? s.tryCount > this._opts.retries && (this._queue.shift(), e && e(n)) : (this._queue.shift(), e && e(null, ...i)), s.pending = !1, this._drainQueue())), this._queue.push(s), this._drainQueue();
|
|
1635
1635
|
}
|
|
1636
1636
|
/**
|
|
1637
1637
|
* Send the first packet of the queue, and wait for an acknowledgement from the server.
|
|
@@ -1672,7 +1672,7 @@ class We extends v {
|
|
|
1672
1672
|
*/
|
|
1673
1673
|
_sendConnectPacket(t) {
|
|
1674
1674
|
this.packet({
|
|
1675
|
-
type:
|
|
1675
|
+
type: w.CONNECT,
|
|
1676
1676
|
data: this._pid ? Object.assign({ pid: this._pid, offset: this._lastOffset }, t) : t
|
|
1677
1677
|
});
|
|
1678
1678
|
}
|
|
@@ -1718,21 +1718,21 @@ class We extends v {
|
|
|
1718
1718
|
onpacket(t) {
|
|
1719
1719
|
if (t.nsp === this.nsp)
|
|
1720
1720
|
switch (t.type) {
|
|
1721
|
-
case
|
|
1721
|
+
case w.CONNECT:
|
|
1722
1722
|
t.data && t.data.sid ? this.onconnect(t.data.sid, t.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 w.EVENT:
|
|
1725
|
+
case w.BINARY_EVENT:
|
|
1726
1726
|
this.onevent(t);
|
|
1727
1727
|
break;
|
|
1728
|
-
case
|
|
1729
|
-
case
|
|
1728
|
+
case w.ACK:
|
|
1729
|
+
case w.BINARY_ACK:
|
|
1730
1730
|
this.onack(t);
|
|
1731
1731
|
break;
|
|
1732
|
-
case
|
|
1732
|
+
case w.DISCONNECT:
|
|
1733
1733
|
this.ondisconnect();
|
|
1734
1734
|
break;
|
|
1735
|
-
case
|
|
1735
|
+
case w.CONNECT_ERROR:
|
|
1736
1736
|
this.destroy();
|
|
1737
1737
|
const s = new Error(t.data.message);
|
|
1738
1738
|
s.data = t.data.data, this.emitReserved("connect_error", s);
|
|
@@ -1765,11 +1765,11 @@ class We extends v {
|
|
|
1765
1765
|
ack(t) {
|
|
1766
1766
|
const e = this;
|
|
1767
1767
|
let s = !1;
|
|
1768
|
-
return function(...
|
|
1768
|
+
return function(...n) {
|
|
1769
1769
|
s || (s = !0, e.packet({
|
|
1770
|
-
type:
|
|
1770
|
+
type: w.ACK,
|
|
1771
1771
|
id: t,
|
|
1772
|
-
data:
|
|
1772
|
+
data: n
|
|
1773
1773
|
}));
|
|
1774
1774
|
};
|
|
1775
1775
|
}
|
|
@@ -1836,7 +1836,7 @@ class We extends v {
|
|
|
1836
1836
|
* @return self
|
|
1837
1837
|
*/
|
|
1838
1838
|
disconnect() {
|
|
1839
|
-
return this.connected && this.packet({ type:
|
|
1839
|
+
return this.connected && this.packet({ type: w.DISCONNECT }), this.destroy(), this.connected && this.onclose("io client disconnect"), this;
|
|
1840
1840
|
}
|
|
1841
1841
|
/**
|
|
1842
1842
|
* Alias for {@link disconnect()}.
|
|
@@ -2035,39 +2035,39 @@ class We extends v {
|
|
|
2035
2035
|
}
|
|
2036
2036
|
}
|
|
2037
2037
|
}
|
|
2038
|
-
function
|
|
2039
|
-
|
|
2038
|
+
function ut(r) {
|
|
2039
|
+
r = r || {}, this.ms = r.min || 100, this.max = r.max || 1e4, this.factor = r.factor || 2, this.jitter = r.jitter > 0 && r.jitter <= 1 ? r.jitter : 0, this.attempts = 0;
|
|
2040
2040
|
}
|
|
2041
|
-
|
|
2042
|
-
var
|
|
2041
|
+
ut.prototype.duration = function() {
|
|
2042
|
+
var r = this.ms * Math.pow(this.factor, this.attempts++);
|
|
2043
2043
|
if (this.jitter) {
|
|
2044
|
-
var t = Math.random(), e = Math.floor(t * this.jitter *
|
|
2045
|
-
|
|
2044
|
+
var t = Math.random(), e = Math.floor(t * this.jitter * r);
|
|
2045
|
+
r = Math.floor(t * 10) & 1 ? r + e : r - e;
|
|
2046
2046
|
}
|
|
2047
|
-
return Math.min(
|
|
2047
|
+
return Math.min(r, this.max) | 0;
|
|
2048
2048
|
};
|
|
2049
|
-
|
|
2049
|
+
ut.prototype.reset = function() {
|
|
2050
2050
|
this.attempts = 0;
|
|
2051
2051
|
};
|
|
2052
|
-
|
|
2053
|
-
this.ms =
|
|
2052
|
+
ut.prototype.setMin = function(r) {
|
|
2053
|
+
this.ms = r;
|
|
2054
2054
|
};
|
|
2055
|
-
|
|
2056
|
-
this.max =
|
|
2055
|
+
ut.prototype.setMax = function(r) {
|
|
2056
|
+
this.max = r;
|
|
2057
2057
|
};
|
|
2058
|
-
|
|
2059
|
-
this.jitter =
|
|
2058
|
+
ut.prototype.setJitter = function(r) {
|
|
2059
|
+
this.jitter = r;
|
|
2060
2060
|
};
|
|
2061
|
-
class
|
|
2061
|
+
class Zt extends E {
|
|
2062
2062
|
constructor(t, e) {
|
|
2063
2063
|
var s;
|
|
2064
|
-
super(), this.nsps = {}, this.subs = [], t && typeof t == "object" && (e = t, t = void 0), e = e || {}, e.path = e.path || "/socket.io", this.opts = e,
|
|
2064
|
+
super(), this.nsps = {}, this.subs = [], t && typeof t == "object" && (e = t, t = void 0), e = e || {}, e.path = e.path || "/socket.io", this.opts = e, qt(this, e), this.reconnection(e.reconnection !== !1), this.reconnectionAttempts(e.reconnectionAttempts || 1 / 0), this.reconnectionDelay(e.reconnectionDelay || 1e3), this.reconnectionDelayMax(e.reconnectionDelayMax || 5e3), this.randomizationFactor((s = e.randomizationFactor) !== null && s !== void 0 ? s : 0.5), this.backoff = new ut({
|
|
2065
2065
|
min: this.reconnectionDelay(),
|
|
2066
2066
|
max: this.reconnectionDelayMax(),
|
|
2067
2067
|
jitter: this.randomizationFactor()
|
|
2068
2068
|
}), this.timeout(e.timeout == null ? 2e4 : e.timeout), this._readyState = "closed", this.uri = t;
|
|
2069
|
-
const
|
|
2070
|
-
this.encoder = new
|
|
2069
|
+
const n = e.parser || Dr;
|
|
2070
|
+
this.encoder = new n.Encoder(), this.decoder = new n.Decoder(), this._autoConnect = e.autoConnect !== !1, this._autoConnect && this.open();
|
|
2071
2071
|
}
|
|
2072
2072
|
reconnection(t) {
|
|
2073
2073
|
return arguments.length ? (this._reconnection = !!t, t || (this.skipReconnect = !0), this) : this._reconnection;
|
|
@@ -2109,23 +2109,23 @@ class Wt extends v {
|
|
|
2109
2109
|
open(t) {
|
|
2110
2110
|
if (~this._readyState.indexOf("open"))
|
|
2111
2111
|
return this;
|
|
2112
|
-
this.engine = new
|
|
2112
|
+
this.engine = new Ar(this.uri, this.opts);
|
|
2113
2113
|
const e = this.engine, s = this;
|
|
2114
2114
|
this._readyState = "opening", this.skipReconnect = !1;
|
|
2115
|
-
const
|
|
2115
|
+
const n = N(e, "open", function() {
|
|
2116
2116
|
s.onopen(), t && t();
|
|
2117
2117
|
}), i = (c) => {
|
|
2118
2118
|
this.cleanup(), this._readyState = "closed", this.emitReserved("error", c), t ? t(c) : this.maybeReconnectOnOpen();
|
|
2119
|
-
}, o =
|
|
2119
|
+
}, o = N(e, "error", i);
|
|
2120
2120
|
if (this._timeout !== !1) {
|
|
2121
|
-
const c = this._timeout,
|
|
2122
|
-
|
|
2121
|
+
const c = this._timeout, d = this.setTimeoutFn(() => {
|
|
2122
|
+
n(), i(new Error("timeout")), e.close();
|
|
2123
2123
|
}, c);
|
|
2124
|
-
this.opts.autoUnref &&
|
|
2125
|
-
this.clearTimeoutFn(
|
|
2124
|
+
this.opts.autoUnref && d.unref(), this.subs.push(() => {
|
|
2125
|
+
this.clearTimeoutFn(d);
|
|
2126
2126
|
});
|
|
2127
2127
|
}
|
|
2128
|
-
return this.subs.push(
|
|
2128
|
+
return this.subs.push(n), this.subs.push(o), this;
|
|
2129
2129
|
}
|
|
2130
2130
|
/**
|
|
2131
2131
|
* Alias for open()
|
|
@@ -2145,12 +2145,12 @@ class Wt extends v {
|
|
|
2145
2145
|
this.cleanup(), this._readyState = "open", this.emitReserved("open");
|
|
2146
2146
|
const t = this.engine;
|
|
2147
2147
|
this.subs.push(
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2148
|
+
N(t, "ping", this.onping.bind(this)),
|
|
2149
|
+
N(t, "data", this.ondata.bind(this)),
|
|
2150
|
+
N(t, "error", this.onerror.bind(this)),
|
|
2151
|
+
N(t, "close", this.onclose.bind(this)),
|
|
2152
2152
|
// @ts-ignore
|
|
2153
|
-
|
|
2153
|
+
N(this.decoder, "decoded", this.ondecoded.bind(this))
|
|
2154
2154
|
);
|
|
2155
2155
|
}
|
|
2156
2156
|
/**
|
|
@@ -2179,7 +2179,7 @@ class Wt extends v {
|
|
|
2179
2179
|
* @private
|
|
2180
2180
|
*/
|
|
2181
2181
|
ondecoded(t) {
|
|
2182
|
-
|
|
2182
|
+
Ft(() => {
|
|
2183
2183
|
this.emitReserved("packet", t);
|
|
2184
2184
|
}, this.setTimeoutFn);
|
|
2185
2185
|
}
|
|
@@ -2199,7 +2199,7 @@ class Wt extends v {
|
|
|
2199
2199
|
*/
|
|
2200
2200
|
socket(t, e) {
|
|
2201
2201
|
let s = this.nsps[t];
|
|
2202
|
-
return s ? this._autoConnect && !s.active && s.connect() : (s = new
|
|
2202
|
+
return s ? this._autoConnect && !s.active && s.connect() : (s = new os(this, t, e), this.nsps[t] = s), s;
|
|
2203
2203
|
}
|
|
2204
2204
|
/**
|
|
2205
2205
|
* Called upon a socket close.
|
|
@@ -2277,8 +2277,8 @@ class Wt extends v {
|
|
|
2277
2277
|
const e = this.backoff.duration();
|
|
2278
2278
|
this._reconnecting = !0;
|
|
2279
2279
|
const s = this.setTimeoutFn(() => {
|
|
2280
|
-
t.skipReconnect || (this.emitReserved("reconnect_attempt", t.backoff.attempts), !t.skipReconnect && t.open((
|
|
2281
|
-
|
|
2280
|
+
t.skipReconnect || (this.emitReserved("reconnect_attempt", t.backoff.attempts), !t.skipReconnect && t.open((n) => {
|
|
2281
|
+
n ? (t._reconnecting = !1, t.reconnect(), this.emitReserved("reconnect_error", n)) : t.onreconnect();
|
|
2282
2282
|
}));
|
|
2283
2283
|
}, e);
|
|
2284
2284
|
this.opts.autoUnref && s.unref(), this.subs.push(() => {
|
|
@@ -2296,27 +2296,27 @@ class Wt extends v {
|
|
|
2296
2296
|
this._reconnecting = !1, this.backoff.reset(), this.emitReserved("reconnect", t);
|
|
2297
2297
|
}
|
|
2298
2298
|
}
|
|
2299
|
-
const
|
|
2300
|
-
function
|
|
2301
|
-
typeof
|
|
2302
|
-
const e =
|
|
2303
|
-
let
|
|
2304
|
-
return c ?
|
|
2299
|
+
const ft = {};
|
|
2300
|
+
function wt(r, t) {
|
|
2301
|
+
typeof r == "object" && (t = r, r = void 0), t = t || {};
|
|
2302
|
+
const e = kr(r, t.path || "/socket.io"), s = e.source, n = e.id, i = e.path, o = ft[n] && i in ft[n].nsps, c = t.forceNew || t["force new connection"] || t.multiplex === !1 || o;
|
|
2303
|
+
let d;
|
|
2304
|
+
return c ? d = new Zt(s, t) : (ft[n] || (ft[n] = new Zt(s, t)), d = ft[n]), e.query && !t.query && (t.query = e.queryKey), d.socket(e.path, t);
|
|
2305
2305
|
}
|
|
2306
|
-
Object.assign(
|
|
2307
|
-
Manager:
|
|
2308
|
-
Socket:
|
|
2309
|
-
io:
|
|
2310
|
-
connect:
|
|
2306
|
+
Object.assign(wt, {
|
|
2307
|
+
Manager: Zt,
|
|
2308
|
+
Socket: os,
|
|
2309
|
+
io: wt,
|
|
2310
|
+
connect: wt
|
|
2311
2311
|
});
|
|
2312
|
-
const
|
|
2313
|
-
function
|
|
2314
|
-
return String(
|
|
2312
|
+
const te = "thatopen/document@1", Le = "document.json", Fe = () => `v-${Date.now()}`;
|
|
2313
|
+
function jr(r) {
|
|
2314
|
+
return String(r._id ?? r.id ?? "");
|
|
2315
2315
|
}
|
|
2316
|
-
var
|
|
2317
|
-
class
|
|
2316
|
+
var bt, ee;
|
|
2317
|
+
class as {
|
|
2318
2318
|
constructor(t, e) {
|
|
2319
|
-
b(this,
|
|
2319
|
+
b(this, bt);
|
|
2320
2320
|
this.client = t, this.projectId = e;
|
|
2321
2321
|
}
|
|
2322
2322
|
/**
|
|
@@ -2324,17 +2324,17 @@ class Ke {
|
|
|
2324
2324
|
* has none yet (an old folder, or a plain folder that is not a document).
|
|
2325
2325
|
*/
|
|
2326
2326
|
async descriptor(t) {
|
|
2327
|
-
const e = await a(this,
|
|
2327
|
+
const e = await a(this, bt, ee).call(this, t);
|
|
2328
2328
|
if (!e) return null;
|
|
2329
|
-
const
|
|
2330
|
-
if (!
|
|
2329
|
+
const n = await (await this.client.downloadFile(e.id)).text();
|
|
2330
|
+
if (!n.trim()) return null;
|
|
2331
2331
|
let i;
|
|
2332
2332
|
try {
|
|
2333
|
-
i = JSON.parse(
|
|
2333
|
+
i = JSON.parse(n);
|
|
2334
2334
|
} catch {
|
|
2335
2335
|
return null;
|
|
2336
2336
|
}
|
|
2337
|
-
return
|
|
2337
|
+
return Mr(i);
|
|
2338
2338
|
}
|
|
2339
2339
|
/**
|
|
2340
2340
|
* The first view whose format appears in `formats` — searched in the ORDER
|
|
@@ -2345,8 +2345,8 @@ class Ke {
|
|
|
2345
2345
|
async view(t, e) {
|
|
2346
2346
|
const s = await this.descriptor(t);
|
|
2347
2347
|
if (!s) return null;
|
|
2348
|
-
for (const
|
|
2349
|
-
const i = s.views.find((o) => o.format ===
|
|
2348
|
+
for (const n of e) {
|
|
2349
|
+
const i = s.views.find((o) => o.format === n);
|
|
2350
2350
|
if (i) return i;
|
|
2351
2351
|
}
|
|
2352
2352
|
return null;
|
|
@@ -2364,7 +2364,7 @@ class Ke {
|
|
|
2364
2364
|
"This folder has no document descriptor yet: call setDescriptor first."
|
|
2365
2365
|
);
|
|
2366
2366
|
s.views = [
|
|
2367
|
-
...s.views.filter((
|
|
2367
|
+
...s.views.filter((n) => n.format !== e.format),
|
|
2368
2368
|
e
|
|
2369
2369
|
], await this.setDescriptor(t, s);
|
|
2370
2370
|
}
|
|
@@ -2372,129 +2372,129 @@ class Ke {
|
|
|
2372
2372
|
async setDescriptor(t, e) {
|
|
2373
2373
|
const s = {
|
|
2374
2374
|
...e,
|
|
2375
|
-
schema:
|
|
2375
|
+
schema: te,
|
|
2376
2376
|
views: e.views ?? []
|
|
2377
|
-
},
|
|
2377
|
+
}, n = new Blob([JSON.stringify(s)], {
|
|
2378
2378
|
type: "application/json"
|
|
2379
|
-
}), i = await a(this,
|
|
2379
|
+
}), i = await a(this, bt, ee).call(this, t);
|
|
2380
2380
|
if (i) {
|
|
2381
2381
|
await this.client.updateFile(i.id, {
|
|
2382
|
-
file:
|
|
2383
|
-
versionTag:
|
|
2382
|
+
file: n,
|
|
2383
|
+
versionTag: Fe()
|
|
2384
2384
|
});
|
|
2385
2385
|
return;
|
|
2386
2386
|
}
|
|
2387
2387
|
await this.client.createFile({
|
|
2388
|
-
file:
|
|
2389
|
-
name:
|
|
2390
|
-
versionTag:
|
|
2388
|
+
file: n,
|
|
2389
|
+
name: Le,
|
|
2390
|
+
versionTag: Fe(),
|
|
2391
2391
|
parentFolderId: t,
|
|
2392
2392
|
projectId: this.projectId
|
|
2393
2393
|
});
|
|
2394
2394
|
}
|
|
2395
2395
|
}
|
|
2396
|
-
|
|
2396
|
+
bt = new WeakSet(), ee = async function(t) {
|
|
2397
2397
|
const s = (await this.client.listFiles({ folderId: t })).find(
|
|
2398
|
-
(
|
|
2398
|
+
(n) => String(n.name ?? "") === Le
|
|
2399
2399
|
);
|
|
2400
|
-
return s ? { id:
|
|
2400
|
+
return s ? { id: jr(s) } : void 0;
|
|
2401
2401
|
};
|
|
2402
|
-
function
|
|
2403
|
-
if (!
|
|
2404
|
-
const t =
|
|
2405
|
-
if (t.schema !==
|
|
2402
|
+
function Mr(r) {
|
|
2403
|
+
if (!r || typeof r != "object") return null;
|
|
2404
|
+
const t = r;
|
|
2405
|
+
if (t.schema !== te || typeof t.name != "string") return null;
|
|
2406
2406
|
const e = Array.isArray(t.views) ? t.views.filter(
|
|
2407
2407
|
(i) => !!i && typeof i == "object" && typeof i.fileId == "string" && typeof i.format == "string"
|
|
2408
|
-
) : [], s = t.native,
|
|
2408
|
+
) : [], s = t.native, n = !!s && typeof s == "object" && typeof s.fileId == "string" && typeof s.format == "string";
|
|
2409
2409
|
return {
|
|
2410
|
-
schema:
|
|
2410
|
+
schema: te,
|
|
2411
2411
|
name: t.name,
|
|
2412
|
-
...
|
|
2412
|
+
...n ? { native: { fileId: s.fileId, format: s.format } } : {},
|
|
2413
2413
|
views: e
|
|
2414
2414
|
};
|
|
2415
2415
|
}
|
|
2416
|
-
class
|
|
2416
|
+
class qe extends Error {
|
|
2417
2417
|
constructor(t, e) {
|
|
2418
2418
|
super(
|
|
2419
2419
|
`The document history advanced while this version was being prepared: expected head ${t}, found ${e ?? "none"}. Read the timeline again and rebuild on the new head.`
|
|
2420
2420
|
), this.expectedGuid = t, this.actualGuid = e, this.name = "StaleHistoryError";
|
|
2421
2421
|
}
|
|
2422
2422
|
}
|
|
2423
|
-
const
|
|
2424
|
-
function
|
|
2425
|
-
return
|
|
2423
|
+
const De = "bimterop", se = "revitflow_history.json", et = "revitflow_ops.json", Ue = "revitflow/ops@1", cs = "revitflow_model.frag", hs = "revitflow_", Vr = "bimterop-locks-anchor", At = () => `v-${Date.now()}`;
|
|
2424
|
+
function ls(r, t) {
|
|
2425
|
+
return r.filter((e) => String(e.parentId ?? "") === t);
|
|
2426
2426
|
}
|
|
2427
|
-
function
|
|
2428
|
-
return String(
|
|
2427
|
+
function B(r) {
|
|
2428
|
+
return String(r._id ?? r.id ?? "");
|
|
2429
2429
|
}
|
|
2430
|
-
var
|
|
2431
|
-
class
|
|
2430
|
+
var $, _t, re;
|
|
2431
|
+
class Gr {
|
|
2432
2432
|
constructor(t, e) {
|
|
2433
|
-
b(this,
|
|
2434
|
-
b(this,
|
|
2433
|
+
b(this, _t);
|
|
2434
|
+
b(this, $);
|
|
2435
2435
|
this.client = t, this.projectId = e;
|
|
2436
2436
|
}
|
|
2437
2437
|
/** The project's connected documents. */
|
|
2438
2438
|
async docs() {
|
|
2439
|
-
const t = await a(this,
|
|
2439
|
+
const t = await a(this, _t, re).call(this);
|
|
2440
2440
|
if (!t) return [];
|
|
2441
2441
|
const e = await this.client.listFolders({
|
|
2442
2442
|
parentFolderId: t,
|
|
2443
2443
|
projectId: this.projectId
|
|
2444
2444
|
}), s = [];
|
|
2445
|
-
for (const
|
|
2446
|
-
const i = String(
|
|
2445
|
+
for (const n of ls(e, t)) {
|
|
2446
|
+
const i = String(n.name ?? ""), o = i.indexOf("-");
|
|
2447
2447
|
if (o <= 0) continue;
|
|
2448
|
-
const
|
|
2449
|
-
folderId:
|
|
2448
|
+
const d = (await this.client.listFiles({
|
|
2449
|
+
folderId: B(n)
|
|
2450
2450
|
})).map(
|
|
2451
|
-
(
|
|
2452
|
-
), f =
|
|
2453
|
-
(
|
|
2454
|
-
),
|
|
2451
|
+
(g) => String(g.name ?? "")
|
|
2452
|
+
), f = d.find((g) => g === cs) ?? d.find(
|
|
2453
|
+
(g) => g.endsWith(".frag") && !g.startsWith(hs)
|
|
2454
|
+
), h = d.includes(se) || d.includes(et) || !!f;
|
|
2455
2455
|
s.push({
|
|
2456
2456
|
source: i.slice(0, o),
|
|
2457
2457
|
docId: i.slice(o + 1),
|
|
2458
|
-
folderId:
|
|
2458
|
+
folderId: B(n),
|
|
2459
2459
|
modelName: f,
|
|
2460
|
-
...
|
|
2460
|
+
...h ? {} : { empty: !0 }
|
|
2461
2461
|
});
|
|
2462
2462
|
}
|
|
2463
2463
|
return s;
|
|
2464
2464
|
}
|
|
2465
2465
|
/** One document's history. `source` and `docId` as {@link docs} lists them. */
|
|
2466
2466
|
doc(t, e) {
|
|
2467
|
-
return new
|
|
2467
|
+
return new Hr(this.client, this, t, e);
|
|
2468
2468
|
}
|
|
2469
2469
|
/** @internal The `bimterop` folder id, resolved once. */
|
|
2470
2470
|
async rootFolderId(t = !1) {
|
|
2471
|
-
if (
|
|
2472
|
-
const e = await a(this,
|
|
2471
|
+
if (u(this, $)) return u(this, $);
|
|
2472
|
+
const e = await a(this, _t, re).call(this);
|
|
2473
2473
|
if (e) return e;
|
|
2474
2474
|
if (!t) return;
|
|
2475
2475
|
const s = await this.client.createFolder(
|
|
2476
|
-
|
|
2476
|
+
De,
|
|
2477
2477
|
void 0,
|
|
2478
2478
|
this.projectId
|
|
2479
2479
|
);
|
|
2480
|
-
return _(this,
|
|
2480
|
+
return _(this, $, B(s)), u(this, $);
|
|
2481
2481
|
}
|
|
2482
2482
|
}
|
|
2483
|
-
|
|
2484
|
-
if (
|
|
2483
|
+
$ = new WeakMap(), _t = new WeakSet(), re = async function() {
|
|
2484
|
+
if (u(this, $)) return u(this, $);
|
|
2485
2485
|
const e = (await this.client.listFolders({
|
|
2486
2486
|
projectId: this.projectId
|
|
2487
2487
|
})).find(
|
|
2488
|
-
(s) => String(s.name ?? "") ===
|
|
2488
|
+
(s) => String(s.name ?? "") === De && !s.parentId
|
|
2489
2489
|
);
|
|
2490
|
-
return e && _(this,
|
|
2490
|
+
return e && _(this, $, B(e)), u(this, $);
|
|
2491
2491
|
};
|
|
2492
|
-
var
|
|
2493
|
-
class
|
|
2494
|
-
constructor(t, e, s,
|
|
2495
|
-
b(this,
|
|
2496
|
-
b(this,
|
|
2497
|
-
this.client = t, this.project = e, this.source = s, this.docId =
|
|
2492
|
+
var U, p, st, rt, D, ne, yt, nt, ie, Rt, mt, $t, oe, us;
|
|
2493
|
+
class Hr {
|
|
2494
|
+
constructor(t, e, s, n) {
|
|
2495
|
+
b(this, p);
|
|
2496
|
+
b(this, U);
|
|
2497
|
+
this.client = t, this.project = e, this.source = s, this.docId = n;
|
|
2498
2498
|
}
|
|
2499
2499
|
// ─── Reading ───────────────────────────────────────────────────────────────
|
|
2500
2500
|
/**
|
|
@@ -2503,8 +2503,8 @@ class cn {
|
|
|
2503
2503
|
* Each version gets its `ordinal` filled in.
|
|
2504
2504
|
*/
|
|
2505
2505
|
async timeline() {
|
|
2506
|
-
const t = await a(this,
|
|
2507
|
-
return
|
|
2506
|
+
const t = await a(this, p, Rt).call(this);
|
|
2507
|
+
return ds((t == null ? void 0 : t.commits) ?? []);
|
|
2508
2508
|
}
|
|
2509
2509
|
/** The head of the timeline, or null before the first sync. */
|
|
2510
2510
|
async latest() {
|
|
@@ -2524,7 +2524,7 @@ class cn {
|
|
|
2524
2524
|
}
|
|
2525
2525
|
/** The visible model .frag as last fully exported. */
|
|
2526
2526
|
async model() {
|
|
2527
|
-
const t = await a(this,
|
|
2527
|
+
const t = await a(this, p, nt).call(this);
|
|
2528
2528
|
if (!t)
|
|
2529
2529
|
throw new Error(
|
|
2530
2530
|
`Document ${this.source}-${this.docId} has no model file yet.`
|
|
@@ -2533,7 +2533,7 @@ class cn {
|
|
|
2533
2533
|
}
|
|
2534
2534
|
/** The document folder's item id — the id the CDE knows this document by. */
|
|
2535
2535
|
async folderId() {
|
|
2536
|
-
return await a(this,
|
|
2536
|
+
return await a(this, p, D).call(this, !1);
|
|
2537
2537
|
}
|
|
2538
2538
|
// ─── The document descriptor ───────────────────────────────────────────────
|
|
2539
2539
|
/**
|
|
@@ -2541,7 +2541,7 @@ class cn {
|
|
|
2541
2541
|
* not carry one yet — an old folder from before descriptors existed.
|
|
2542
2542
|
*/
|
|
2543
2543
|
async descriptor() {
|
|
2544
|
-
return await
|
|
2544
|
+
return await u(this, p, st).descriptor(await a(this, p, D).call(this, !1));
|
|
2545
2545
|
}
|
|
2546
2546
|
/**
|
|
2547
2547
|
* The first view whose format appears in `formats`, searched in the order
|
|
@@ -2549,7 +2549,7 @@ class cn {
|
|
|
2549
2549
|
* model .frag on a descriptor-less folder, so old documents keep viewing.
|
|
2550
2550
|
*/
|
|
2551
2551
|
async view(t) {
|
|
2552
|
-
const e = await a(this,
|
|
2552
|
+
const e = await a(this, p, D).call(this, !1), s = await u(this, p, st).descriptor(e);
|
|
2553
2553
|
if (s) {
|
|
2554
2554
|
for (const i of t) {
|
|
2555
2555
|
const o = s.views.find((c) => c.format === i);
|
|
@@ -2558,8 +2558,8 @@ class cn {
|
|
|
2558
2558
|
return null;
|
|
2559
2559
|
}
|
|
2560
2560
|
if (!t.includes("frag")) return null;
|
|
2561
|
-
const
|
|
2562
|
-
return
|
|
2561
|
+
const n = await a(this, p, nt).call(this);
|
|
2562
|
+
return n ? { fileId: n.id, format: "frag" } : null;
|
|
2563
2563
|
}
|
|
2564
2564
|
/**
|
|
2565
2565
|
* Registers a renderable representation, creating the descriptor when the
|
|
@@ -2567,14 +2567,14 @@ class cn {
|
|
|
2567
2567
|
* One view per format: a same-format view is replaced, not accumulated.
|
|
2568
2568
|
*/
|
|
2569
2569
|
async addView(t) {
|
|
2570
|
-
const e = await a(this,
|
|
2571
|
-
if (await
|
|
2572
|
-
await
|
|
2570
|
+
const e = await a(this, p, D).call(this, !0);
|
|
2571
|
+
if (await u(this, p, st).descriptor(e)) {
|
|
2572
|
+
await u(this, p, st).addView(e, t);
|
|
2573
2573
|
return;
|
|
2574
2574
|
}
|
|
2575
|
-
const
|
|
2576
|
-
await
|
|
2577
|
-
name: (
|
|
2575
|
+
const n = await a(this, p, nt).call(this);
|
|
2576
|
+
await u(this, p, st).setDescriptor(e, {
|
|
2577
|
+
name: (n == null ? void 0 : n.name.replace(/\.frag$/, "")) ?? u(this, p, rt),
|
|
2578
2578
|
views: [t]
|
|
2579
2579
|
});
|
|
2580
2580
|
}
|
|
@@ -2587,28 +2587,28 @@ class cn {
|
|
|
2587
2587
|
* claims counts only for the earliest one, matching the plugins' rule.
|
|
2588
2588
|
*/
|
|
2589
2589
|
async ownership() {
|
|
2590
|
-
const t = await a(this,
|
|
2590
|
+
const t = await a(this, p, yt).call(this, Vr);
|
|
2591
2591
|
if (!t) return [];
|
|
2592
2592
|
const e = await this.client.getHiddenFilesByParent(t.id), s = await Promise.all(
|
|
2593
2593
|
e.map(async (o) => {
|
|
2594
2594
|
try {
|
|
2595
|
-
const c =
|
|
2595
|
+
const c = B(o), d = await this.client.downloadHiddenFile(c), f = JSON.parse(await d.text());
|
|
2596
2596
|
return !f || typeof f != "object" || !("revitflowlock" in f) || !Array.isArray(f.keys) ? null : {
|
|
2597
2597
|
owner: String(f.user ?? ""),
|
|
2598
|
-
keys: f.keys.filter((
|
|
2598
|
+
keys: f.keys.filter((h) => typeof h == "string")
|
|
2599
2599
|
};
|
|
2600
2600
|
} catch {
|
|
2601
2601
|
return null;
|
|
2602
2602
|
}
|
|
2603
2603
|
})
|
|
2604
|
-
),
|
|
2604
|
+
), n = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Map();
|
|
2605
2605
|
for (const o of s)
|
|
2606
2606
|
if (o)
|
|
2607
2607
|
for (const c of o.keys) {
|
|
2608
|
-
if (!c ||
|
|
2609
|
-
|
|
2610
|
-
const
|
|
2611
|
-
|
|
2608
|
+
if (!c || n.has(c)) continue;
|
|
2609
|
+
n.add(c);
|
|
2610
|
+
const d = i.get(o.owner) ?? [];
|
|
2611
|
+
d.push(c), i.set(o.owner, d);
|
|
2612
2612
|
}
|
|
2613
2613
|
return [...i.entries()].map(([o, c]) => ({
|
|
2614
2614
|
owner: o,
|
|
@@ -2624,17 +2624,17 @@ class cn {
|
|
|
2624
2624
|
*/
|
|
2625
2625
|
async sync(t) {
|
|
2626
2626
|
var c;
|
|
2627
|
-
const e = await a(this,
|
|
2628
|
-
let s = await a(this,
|
|
2627
|
+
const e = await a(this, p, D).call(this, !0);
|
|
2628
|
+
let s = await a(this, p, Rt).call(this) ?? {
|
|
2629
2629
|
model: this.docId,
|
|
2630
2630
|
commits: []
|
|
2631
2631
|
};
|
|
2632
|
-
const
|
|
2633
|
-
if (t.expectedLatestGuid !== void 0 && (
|
|
2634
|
-
throw new
|
|
2632
|
+
const n = je(s.commits);
|
|
2633
|
+
if (t.expectedLatestGuid !== void 0 && (n == null ? void 0 : n.guid) !== t.expectedLatestGuid)
|
|
2634
|
+
throw new qe(t.expectedLatestGuid, n == null ? void 0 : n.guid);
|
|
2635
2635
|
const i = {
|
|
2636
|
-
guid:
|
|
2637
|
-
...
|
|
2636
|
+
guid: ae(),
|
|
2637
|
+
...n ? { parents: [n.guid] } : {},
|
|
2638
2638
|
author: t.author,
|
|
2639
2639
|
source: t.source,
|
|
2640
2640
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -2642,36 +2642,36 @@ class cn {
|
|
|
2642
2642
|
...t.userId ? { userId: t.userId } : {},
|
|
2643
2643
|
...(c = t.appliedOps) != null && c.length ? { appliedOps: t.appliedOps } : {},
|
|
2644
2644
|
changes: t.changes,
|
|
2645
|
-
counts:
|
|
2645
|
+
counts: Jr(t.changes)
|
|
2646
2646
|
};
|
|
2647
|
-
if (t.model && (await a(this,
|
|
2648
|
-
const
|
|
2649
|
-
if (!
|
|
2647
|
+
if (t.model && (await a(this, p, us).call(this, e, t.model), i.full = !0), t.delta) {
|
|
2648
|
+
const d = await a(this, p, nt).call(this);
|
|
2649
|
+
if (!d)
|
|
2650
2650
|
throw new Error(
|
|
2651
2651
|
"A delta needs the model file to hang from: sync a full model first."
|
|
2652
2652
|
);
|
|
2653
2653
|
const f = await this.client.createHiddenFile(
|
|
2654
2654
|
t.delta,
|
|
2655
|
-
|
|
2655
|
+
d.id
|
|
2656
2656
|
);
|
|
2657
2657
|
i.deltaId = String(
|
|
2658
2658
|
f._id ?? f.id
|
|
2659
2659
|
);
|
|
2660
2660
|
}
|
|
2661
|
-
const o = await a(this,
|
|
2661
|
+
const o = await a(this, p, Rt).call(this);
|
|
2662
2662
|
if (o) {
|
|
2663
2663
|
s = o;
|
|
2664
|
-
const
|
|
2665
|
-
if (t.expectedLatestGuid !== void 0 && (
|
|
2666
|
-
throw new
|
|
2667
|
-
|
|
2664
|
+
const d = je(s.commits);
|
|
2665
|
+
if (t.expectedLatestGuid !== void 0 && (d == null ? void 0 : d.guid) !== t.expectedLatestGuid)
|
|
2666
|
+
throw new qe(t.expectedLatestGuid, d == null ? void 0 : d.guid);
|
|
2667
|
+
d && !i.parents && (i.parents = [d.guid]);
|
|
2668
2668
|
}
|
|
2669
|
-
return s.commits.push(i), await a(this,
|
|
2669
|
+
return s.commits.push(i), await a(this, p, $t).call(this, e, se, s), i;
|
|
2670
2670
|
}
|
|
2671
2671
|
// ─── Suggestions (change requests) ────────────────────────────────────────
|
|
2672
2672
|
/** Every suggestion in the document's queue, pending or resolved. */
|
|
2673
2673
|
async suggestions() {
|
|
2674
|
-
const t = await a(this,
|
|
2674
|
+
const t = await a(this, p, mt).call(this);
|
|
2675
2675
|
return (t == null ? void 0 : t.ops) ?? [];
|
|
2676
2676
|
}
|
|
2677
2677
|
/** The suggestions still waiting for the owner, oldest first. */
|
|
@@ -2683,8 +2683,8 @@ class cn {
|
|
|
2683
2683
|
* uploaded as a hidden file under the suggestions index.
|
|
2684
2684
|
*/
|
|
2685
2685
|
async suggest(t) {
|
|
2686
|
-
const e = await a(this,
|
|
2687
|
-
opId: t.opId ??
|
|
2686
|
+
const e = await a(this, p, D).call(this, !0), s = await a(this, p, mt).call(this) ?? { schema: Ue, ops: [] }, n = await a(this, p, yt).call(this, et), i = {
|
|
2687
|
+
opId: t.opId ?? ae(),
|
|
2688
2688
|
to: t.to ?? this.source,
|
|
2689
2689
|
title: t.title,
|
|
2690
2690
|
verb: t.verb,
|
|
@@ -2697,16 +2697,16 @@ class cn {
|
|
|
2697
2697
|
...t.baseCommitGuid ? { baseCommitGuid: t.baseCommitGuid } : {}
|
|
2698
2698
|
};
|
|
2699
2699
|
if (t.payload) {
|
|
2700
|
-
const c =
|
|
2700
|
+
const c = n ?? await a(this, p, oe).call(this, e, et, s), d = await this.client.createHiddenFile(
|
|
2701
2701
|
t.payload,
|
|
2702
2702
|
c.id
|
|
2703
2703
|
);
|
|
2704
2704
|
i.fragId = String(
|
|
2705
|
-
|
|
2705
|
+
d._id ?? d.id
|
|
2706
2706
|
);
|
|
2707
2707
|
}
|
|
2708
|
-
const o = await a(this,
|
|
2709
|
-
return o.schema ?? (o.schema =
|
|
2708
|
+
const o = await a(this, p, mt).call(this) ?? s;
|
|
2709
|
+
return o.schema ?? (o.schema = Ue), o.ops.push(i), await a(this, p, $t).call(this, e, et, o), i;
|
|
2710
2710
|
}
|
|
2711
2711
|
/** A suggestion's .frag payload. */
|
|
2712
2712
|
async suggestionPayload(t) {
|
|
@@ -2720,20 +2720,20 @@ class cn {
|
|
|
2720
2720
|
* use it for `discarded`.
|
|
2721
2721
|
*/
|
|
2722
2722
|
async resolveSuggestion(t, e) {
|
|
2723
|
-
const s = await a(this,
|
|
2723
|
+
const s = await a(this, p, D).call(this, !1);
|
|
2724
2724
|
if (!s) throw new Error("This document has no suggestion queue.");
|
|
2725
|
-
const
|
|
2726
|
-
if (!
|
|
2725
|
+
const n = await a(this, p, mt).call(this), i = n == null ? void 0 : n.ops.find((o) => o.opId === t);
|
|
2726
|
+
if (!n || !i)
|
|
2727
2727
|
throw new Error(`No suggestion ${t} in this document's queue.`);
|
|
2728
|
-
return Object.assign(i, e), await a(this,
|
|
2728
|
+
return Object.assign(i, e), await a(this, p, $t).call(this, s, et, n), i;
|
|
2729
2729
|
}
|
|
2730
2730
|
}
|
|
2731
|
-
|
|
2732
|
-
return new
|
|
2733
|
-
},
|
|
2731
|
+
U = new WeakMap(), p = new WeakSet(), st = function() {
|
|
2732
|
+
return new as(this.client, this.project.projectId);
|
|
2733
|
+
}, rt = function() {
|
|
2734
2734
|
return `${this.source}-${this.docId}`;
|
|
2735
|
-
},
|
|
2736
|
-
if (
|
|
2735
|
+
}, D = async function(t) {
|
|
2736
|
+
if (u(this, U)) return u(this, U);
|
|
2737
2737
|
const e = await this.project.rootFolderId(t);
|
|
2738
2738
|
if (!e)
|
|
2739
2739
|
throw new Error(
|
|
@@ -2742,153 +2742,153 @@ q = new WeakMap(), d = new WeakSet(), Z = function() {
|
|
|
2742
2742
|
const s = await this.client.listFolders({
|
|
2743
2743
|
parentFolderId: e,
|
|
2744
2744
|
projectId: this.project.projectId
|
|
2745
|
-
}),
|
|
2746
|
-
(o) => String(o.name ?? "") ===
|
|
2745
|
+
}), n = ls(s, e).find(
|
|
2746
|
+
(o) => String(o.name ?? "") === u(this, p, rt)
|
|
2747
2747
|
);
|
|
2748
|
-
if (
|
|
2749
|
-
return _(this,
|
|
2748
|
+
if (n)
|
|
2749
|
+
return _(this, U, B(n)), u(this, U);
|
|
2750
2750
|
if (!t)
|
|
2751
2751
|
throw new Error(
|
|
2752
|
-
`Document ${
|
|
2752
|
+
`Document ${u(this, p, rt)} does not exist in this project.`
|
|
2753
2753
|
);
|
|
2754
2754
|
const i = await this.client.createFolder(
|
|
2755
|
-
|
|
2755
|
+
u(this, p, rt),
|
|
2756
2756
|
e,
|
|
2757
2757
|
this.project.projectId
|
|
2758
2758
|
);
|
|
2759
|
-
return _(this,
|
|
2760
|
-
},
|
|
2761
|
-
const t = await a(this,
|
|
2759
|
+
return _(this, U, B(i)), u(this, U);
|
|
2760
|
+
}, ne = async function() {
|
|
2761
|
+
const t = await a(this, p, D).call(this, !1);
|
|
2762
2762
|
return (await this.client.listFiles({ folderId: t })).map((s) => ({
|
|
2763
|
-
id:
|
|
2763
|
+
id: B(s),
|
|
2764
2764
|
name: String(s.name ?? "")
|
|
2765
2765
|
}));
|
|
2766
|
-
},
|
|
2766
|
+
}, yt = async function(t) {
|
|
2767
2767
|
try {
|
|
2768
|
-
return (await a(this,
|
|
2768
|
+
return (await a(this, p, ne).call(this)).find((e) => e.name === t);
|
|
2769
2769
|
} catch {
|
|
2770
2770
|
return;
|
|
2771
2771
|
}
|
|
2772
|
-
},
|
|
2772
|
+
}, nt = async function() {
|
|
2773
2773
|
try {
|
|
2774
|
-
const t = await a(this,
|
|
2775
|
-
return t.find((e) => e.name ===
|
|
2776
|
-
(e) => e.name.endsWith(".frag") && !e.name.startsWith(
|
|
2774
|
+
const t = await a(this, p, ne).call(this);
|
|
2775
|
+
return t.find((e) => e.name === cs) ?? t.find(
|
|
2776
|
+
(e) => e.name.endsWith(".frag") && !e.name.startsWith(hs)
|
|
2777
2777
|
);
|
|
2778
2778
|
} catch {
|
|
2779
2779
|
return;
|
|
2780
2780
|
}
|
|
2781
|
-
},
|
|
2782
|
-
const e = await a(this,
|
|
2781
|
+
}, ie = async function(t) {
|
|
2782
|
+
const e = await a(this, p, yt).call(this, t);
|
|
2783
2783
|
if (!e) return;
|
|
2784
|
-
const
|
|
2785
|
-
if (
|
|
2786
|
-
return JSON.parse(
|
|
2787
|
-
},
|
|
2788
|
-
return a(this,
|
|
2789
|
-
},
|
|
2790
|
-
return a(this,
|
|
2791
|
-
},
|
|
2792
|
-
const
|
|
2784
|
+
const n = await (await this.client.downloadFile(e.id)).text();
|
|
2785
|
+
if (n.trim())
|
|
2786
|
+
return JSON.parse(n);
|
|
2787
|
+
}, Rt = function() {
|
|
2788
|
+
return a(this, p, ie).call(this, se);
|
|
2789
|
+
}, mt = function() {
|
|
2790
|
+
return a(this, p, ie).call(this, et);
|
|
2791
|
+
}, $t = async function(t, e, s) {
|
|
2792
|
+
const n = new Blob([JSON.stringify(s)], {
|
|
2793
2793
|
type: "application/json"
|
|
2794
|
-
}), i = await a(this,
|
|
2794
|
+
}), i = await a(this, p, yt).call(this, e);
|
|
2795
2795
|
return i ? (await this.client.updateFile(i.id, {
|
|
2796
|
-
file:
|
|
2797
|
-
versionTag:
|
|
2798
|
-
}), i) : await a(this,
|
|
2799
|
-
},
|
|
2800
|
-
const
|
|
2796
|
+
file: n,
|
|
2797
|
+
versionTag: At()
|
|
2798
|
+
}), i) : await a(this, p, oe).call(this, t, e, s);
|
|
2799
|
+
}, oe = async function(t, e, s) {
|
|
2800
|
+
const n = new Blob([JSON.stringify(s)], {
|
|
2801
2801
|
type: "application/json"
|
|
2802
2802
|
}), i = await this.client.createFile({
|
|
2803
|
-
file:
|
|
2803
|
+
file: n,
|
|
2804
2804
|
name: e,
|
|
2805
|
-
versionTag:
|
|
2805
|
+
versionTag: At(),
|
|
2806
2806
|
parentFolderId: t,
|
|
2807
2807
|
projectId: this.project.projectId
|
|
2808
2808
|
}), o = i.item;
|
|
2809
|
-
return { id:
|
|
2810
|
-
},
|
|
2811
|
-
const s = await a(this,
|
|
2809
|
+
return { id: B(o ?? i), name: e };
|
|
2810
|
+
}, us = async function(t, e) {
|
|
2811
|
+
const s = await a(this, p, nt).call(this);
|
|
2812
2812
|
if (s)
|
|
2813
2813
|
return await this.client.updateFile(s.id, {
|
|
2814
2814
|
file: e,
|
|
2815
|
-
versionTag:
|
|
2815
|
+
versionTag: At()
|
|
2816
2816
|
}), s;
|
|
2817
|
-
const
|
|
2817
|
+
const n = `${u(this, p, rt)}.frag`, i = await this.client.createFile({
|
|
2818
2818
|
file: e,
|
|
2819
|
-
name:
|
|
2820
|
-
versionTag:
|
|
2819
|
+
name: n,
|
|
2820
|
+
versionTag: At(),
|
|
2821
2821
|
parentFolderId: t,
|
|
2822
2822
|
projectId: this.project.projectId
|
|
2823
2823
|
}), o = i.item;
|
|
2824
|
-
return { id:
|
|
2824
|
+
return { id: B(o ?? i), name: n };
|
|
2825
2825
|
};
|
|
2826
|
-
function
|
|
2826
|
+
function Jr(r) {
|
|
2827
2827
|
const t = { added: 0, modified: 0, removed: 0 };
|
|
2828
|
-
for (const e of
|
|
2828
|
+
for (const e of r)
|
|
2829
2829
|
e.type === "create" ? t.added++ : e.type === "delete" ? t.removed++ : t.modified++;
|
|
2830
2830
|
return t;
|
|
2831
2831
|
}
|
|
2832
|
-
function
|
|
2833
|
-
var
|
|
2834
|
-
if (
|
|
2835
|
-
return
|
|
2836
|
-
const t = new Map(
|
|
2837
|
-
for (const f of
|
|
2838
|
-
const
|
|
2839
|
-
if (
|
|
2840
|
-
const
|
|
2841
|
-
|
|
2832
|
+
function ds(r) {
|
|
2833
|
+
var d;
|
|
2834
|
+
if (r.length <= 1)
|
|
2835
|
+
return r.forEach((f, h) => f.ordinal = h), [...r];
|
|
2836
|
+
const t = new Map(r.map((f) => [f.guid, f])), e = /* @__PURE__ */ new Map(), s = [];
|
|
2837
|
+
for (const f of r) {
|
|
2838
|
+
const h = (d = f.parents) == null ? void 0 : d[0];
|
|
2839
|
+
if (h && t.has(h)) {
|
|
2840
|
+
const g = e.get(h) ?? [];
|
|
2841
|
+
g.push(f), e.set(h, g);
|
|
2842
2842
|
} else
|
|
2843
2843
|
s.push(f);
|
|
2844
2844
|
}
|
|
2845
|
-
const
|
|
2846
|
-
s.sort(
|
|
2845
|
+
const n = (f, h) => String(f.timestamp).localeCompare(String(h.timestamp));
|
|
2846
|
+
s.sort(n);
|
|
2847
2847
|
const i = [], o = [...s].reverse(), c = /* @__PURE__ */ new Set();
|
|
2848
2848
|
for (; o.length; ) {
|
|
2849
2849
|
const f = o.pop();
|
|
2850
2850
|
if (c.has(f.guid)) continue;
|
|
2851
2851
|
c.add(f.guid), i.push(f);
|
|
2852
|
-
const
|
|
2853
|
-
for (let
|
|
2852
|
+
const h = (e.get(f.guid) ?? []).sort(n);
|
|
2853
|
+
for (let g = h.length - 1; g >= 0; g--) o.push(h[g]);
|
|
2854
2854
|
}
|
|
2855
|
-
for (const f of
|
|
2855
|
+
for (const f of r)
|
|
2856
2856
|
c.has(f.guid) || i.push(f);
|
|
2857
|
-
return i.forEach((f,
|
|
2857
|
+
return i.forEach((f, h) => f.ordinal = h), i;
|
|
2858
2858
|
}
|
|
2859
|
-
function
|
|
2860
|
-
const t =
|
|
2859
|
+
function je(r) {
|
|
2860
|
+
const t = ds(r);
|
|
2861
2861
|
return t[t.length - 1];
|
|
2862
2862
|
}
|
|
2863
|
-
function
|
|
2864
|
-
const
|
|
2865
|
-
return
|
|
2863
|
+
function ae() {
|
|
2864
|
+
const r = globalThis.crypto;
|
|
2865
|
+
return r != null && r.randomUUID ? r.randomUUID() : "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (t) => {
|
|
2866
2866
|
const e = Math.random() * 16 | 0;
|
|
2867
2867
|
return (t === "x" ? e : e & 3 | 8).toString(16);
|
|
2868
2868
|
});
|
|
2869
2869
|
}
|
|
2870
|
-
var
|
|
2871
|
-
class
|
|
2870
|
+
var J, Et, ce;
|
|
2871
|
+
class Yr {
|
|
2872
2872
|
constructor(t) {
|
|
2873
|
-
b(this,
|
|
2874
|
-
b(this,
|
|
2873
|
+
b(this, Et);
|
|
2874
|
+
b(this, J, /* @__PURE__ */ new Map());
|
|
2875
2875
|
this.client = t;
|
|
2876
2876
|
}
|
|
2877
2877
|
/** Registers a recipe. One per name; a second with the same name throws. */
|
|
2878
2878
|
register(t) {
|
|
2879
|
-
if (
|
|
2879
|
+
if (u(this, J).has(t.name))
|
|
2880
2880
|
throw new Error(`A recipe named "${t.name}" is already registered.`);
|
|
2881
|
-
|
|
2881
|
+
u(this, J).set(t.name, t);
|
|
2882
2882
|
}
|
|
2883
2883
|
/** The registered recipes, optionally filtered by target application. */
|
|
2884
2884
|
list(t) {
|
|
2885
|
-
return [...
|
|
2885
|
+
return [...u(this, J).values()].filter(
|
|
2886
2886
|
(s) => (!(t != null && t.to) || s.to === t.to) && (!(t != null && t.input) || s.inputs.includes(t.input))
|
|
2887
2887
|
);
|
|
2888
2888
|
}
|
|
2889
2889
|
/** A registered recipe by name, or undefined. */
|
|
2890
2890
|
get(t) {
|
|
2891
|
-
return
|
|
2891
|
+
return u(this, J).get(t);
|
|
2892
2892
|
}
|
|
2893
2893
|
/**
|
|
2894
2894
|
* Runs a recipe WITHOUT queueing anything: the dry pass. Returns a
|
|
@@ -2897,9 +2897,9 @@ class ln {
|
|
|
2897
2897
|
* included, with no second run. Discard it and the plan never happened.
|
|
2898
2898
|
*/
|
|
2899
2899
|
async plan(t, e) {
|
|
2900
|
-
const { base: s, opId:
|
|
2900
|
+
const { base: s, opId: n, result: i } = await a(this, Et, ce).call(this, t, e);
|
|
2901
2901
|
return {
|
|
2902
|
-
opId:
|
|
2902
|
+
opId: n,
|
|
2903
2903
|
projectId: e.projectId,
|
|
2904
2904
|
target: e.target,
|
|
2905
2905
|
...s != null && s.guid ? { baseCommitGuid: s.guid } : {},
|
|
@@ -2930,7 +2930,7 @@ class ln {
|
|
|
2930
2930
|
* to show the tallies before queueing.
|
|
2931
2931
|
*/
|
|
2932
2932
|
async run(t, e) {
|
|
2933
|
-
const { targetDoc: s, base:
|
|
2933
|
+
const { targetDoc: s, base: n, opId: i, result: o } = await a(this, Et, ce).call(this, t, e);
|
|
2934
2934
|
return { suggestion: await s.suggest({
|
|
2935
2935
|
opId: i,
|
|
2936
2936
|
title: o.title,
|
|
@@ -2939,31 +2939,31 @@ class ln {
|
|
|
2939
2939
|
payload: o.payload,
|
|
2940
2940
|
targets: o.targets,
|
|
2941
2941
|
userId: e.userId,
|
|
2942
|
-
baseCommitGuid:
|
|
2942
|
+
baseCommitGuid: n == null ? void 0 : n.guid
|
|
2943
2943
|
}), result: o };
|
|
2944
2944
|
}
|
|
2945
2945
|
}
|
|
2946
|
-
|
|
2947
|
-
const s =
|
|
2946
|
+
J = new WeakMap(), Et = new WeakSet(), ce = async function(t, e) {
|
|
2947
|
+
const s = u(this, J).get(t);
|
|
2948
2948
|
if (!s) throw new Error(`No recipe named "${t}" is registered.`);
|
|
2949
2949
|
if (s.to !== e.target.source)
|
|
2950
2950
|
throw new Error(
|
|
2951
2951
|
`Recipe "${t}" writes ${s.to}, but the target document belongs to ${e.target.source}.`
|
|
2952
2952
|
);
|
|
2953
|
-
const
|
|
2953
|
+
const n = this.client.history(e.projectId).doc(e.target.source, e.target.docId), i = await n.latest(), o = ae(), c = await s.run({
|
|
2954
2954
|
client: this.client,
|
|
2955
2955
|
projectId: e.projectId,
|
|
2956
|
-
targetDoc:
|
|
2956
|
+
targetDoc: n,
|
|
2957
2957
|
opId: o,
|
|
2958
2958
|
input: e.input,
|
|
2959
2959
|
settings: e.settings ?? {}
|
|
2960
2960
|
});
|
|
2961
|
-
return { recipe: s, targetDoc:
|
|
2961
|
+
return { recipe: s, targetDoc: n, base: i, opId: o, result: c };
|
|
2962
2962
|
};
|
|
2963
|
-
const
|
|
2964
|
-
function
|
|
2963
|
+
const Me = 100;
|
|
2964
|
+
function Wr(r) {
|
|
2965
2965
|
try {
|
|
2966
|
-
const t = JSON.parse(
|
|
2966
|
+
const t = JSON.parse(r);
|
|
2967
2967
|
if (t && typeof t == "object") {
|
|
2968
2968
|
const e = t;
|
|
2969
2969
|
return {
|
|
@@ -2976,31 +2976,31 @@ function un(n) {
|
|
|
2976
2976
|
}
|
|
2977
2977
|
return {};
|
|
2978
2978
|
}
|
|
2979
|
-
function
|
|
2980
|
-
if (!
|
|
2981
|
-
const t =
|
|
2979
|
+
function Kr(r) {
|
|
2980
|
+
if (!r || typeof r != "object") return;
|
|
2981
|
+
const t = r.retryAfter;
|
|
2982
2982
|
return typeof t == "number" && Number.isFinite(t) && t >= 0 ? t : void 0;
|
|
2983
2983
|
}
|
|
2984
|
-
class
|
|
2985
|
-
constructor(e, s,
|
|
2986
|
-
const o =
|
|
2984
|
+
class Te extends Error {
|
|
2985
|
+
constructor(e, s, n, i) {
|
|
2986
|
+
const o = Wr(n);
|
|
2987
2987
|
super(o.message ?? `${s || "Request failed"} (${e})`);
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2988
|
+
I(this, "status");
|
|
2989
|
+
I(this, "code");
|
|
2990
|
+
I(this, "details");
|
|
2991
|
+
I(this, "body");
|
|
2992
2992
|
/**
|
|
2993
2993
|
* Seconds to wait before retrying, taken from the `Retry-After` header or
|
|
2994
2994
|
* from `details.retryAfter`. Only present on rate-limited (429) responses.
|
|
2995
2995
|
*/
|
|
2996
|
-
|
|
2997
|
-
this.name = "RequestError", this.status = e, this.code = o.code, this.details = o.details, this.body =
|
|
2996
|
+
I(this, "retryAfter");
|
|
2997
|
+
this.name = "RequestError", this.status = e, this.code = o.code, this.details = o.details, this.body = n, this.retryAfter = i ?? Kr(o.details);
|
|
2998
2998
|
}
|
|
2999
2999
|
}
|
|
3000
|
-
const
|
|
3001
|
-
function
|
|
3002
|
-
var
|
|
3003
|
-
const t = (i = (
|
|
3000
|
+
const P = "item/folder", m = "item", G = "processor", zr = "npm-registry", q = "hidden", Ht = "FILE", Jt = "TOOL", Yt = "APP", Xr = 500, Ve = 3e4, Qr = 0.25, Zr = (r) => new Promise((t) => setTimeout(t, r));
|
|
3001
|
+
function tn(r) {
|
|
3002
|
+
var n, i;
|
|
3003
|
+
const t = (i = (n = r.headers) == null ? void 0 : n.get) == null ? void 0 : i.call(n, "Retry-After");
|
|
3004
3004
|
if (!t) return;
|
|
3005
3005
|
const e = Number(t);
|
|
3006
3006
|
if (Number.isFinite(e)) return Math.max(0, e);
|
|
@@ -3008,18 +3008,18 @@ function gn(n) {
|
|
|
3008
3008
|
if (!Number.isNaN(s))
|
|
3009
3009
|
return Math.max(0, (s - Date.now()) / 1e3);
|
|
3010
3010
|
}
|
|
3011
|
-
function
|
|
3012
|
-
return
|
|
3011
|
+
function en(r) {
|
|
3012
|
+
return r instanceof Te ? r.status === 429 || r.status >= 500 : !0;
|
|
3013
3013
|
}
|
|
3014
|
-
function
|
|
3014
|
+
function sn(r, t) {
|
|
3015
3015
|
const e = Math.min(
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
), s = e *
|
|
3019
|
-
return
|
|
3016
|
+
Xr * 2 ** t,
|
|
3017
|
+
Ve
|
|
3018
|
+
), s = e * Qr * Math.random(), n = r instanceof Te && r.retryAfter != null ? r.retryAfter * 1e3 : void 0;
|
|
3019
|
+
return n != null ? Math.min(n, Ve) + s : e + s;
|
|
3020
3020
|
}
|
|
3021
|
-
var
|
|
3022
|
-
const
|
|
3021
|
+
var l, le, y, H, vt, gt, Nt, Pt, ue, de, fs;
|
|
3022
|
+
const Se = class Se {
|
|
3023
3023
|
/**
|
|
3024
3024
|
* Creates a new EngineServicesClient instance.
|
|
3025
3025
|
* @param accessToken - API access token (obtained from the platform dashboard)
|
|
@@ -3028,31 +3028,31 @@ const be = class be {
|
|
|
3028
3028
|
* @param props - Optional configuration (retry count, auth mode, etc.).
|
|
3029
3029
|
*/
|
|
3030
3030
|
constructor(t, e, s) {
|
|
3031
|
-
b(this,
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3031
|
+
b(this, l);
|
|
3032
|
+
I(this, "apiUrl");
|
|
3033
|
+
I(this, "accessToken");
|
|
3034
|
+
I(this, "wsUrl");
|
|
3035
|
+
I(this, "retries");
|
|
3036
|
+
I(this, "useBearer");
|
|
3037
|
+
I(this, "builtInGlobals", null);
|
|
3038
3038
|
/**
|
|
3039
3039
|
* URL of a local execution server (e.g. `http://localhost:4001`).
|
|
3040
3040
|
* When set, execution methods are routed to this server instead of the cloud API.
|
|
3041
3041
|
* Set to `null` to disable local routing and use the cloud API.
|
|
3042
3042
|
*/
|
|
3043
|
-
|
|
3043
|
+
I(this, "localServerUrl", null);
|
|
3044
3044
|
/**
|
|
3045
3045
|
* The platform context this client was created with.
|
|
3046
3046
|
* Contains `appId`, `projectId`, `accessToken`, and `apiUrl`.
|
|
3047
3047
|
* Populated automatically when using {@link fromPlatformContext}.
|
|
3048
3048
|
*/
|
|
3049
|
-
|
|
3050
|
-
b(this,
|
|
3051
|
-
const { retries:
|
|
3049
|
+
I(this, "context");
|
|
3050
|
+
b(this, vt);
|
|
3051
|
+
const { retries: n = 0, useBearer: i = !1, localServerUrl: o } = s || {};
|
|
3052
3052
|
let c = e;
|
|
3053
|
-
if (c.charAt(c.length - 1) === "/" && (c = c.slice(0, -1)), this.apiUrl = `${c}/api`, this.accessToken = t, this.wsUrl = c, this.retries =
|
|
3054
|
-
let
|
|
3055
|
-
|
|
3053
|
+
if (c.charAt(c.length - 1) === "/" && (c = c.slice(0, -1)), this.apiUrl = `${c}/api`, this.accessToken = t, this.wsUrl = c, this.retries = n, this.useBearer = i, this.context = { appId: "", projectId: "", accessToken: t, apiUrl: e }, o) {
|
|
3054
|
+
let d = o;
|
|
3055
|
+
d.charAt(d.length - 1) === "/" && (d = d.slice(0, -1)), this.localServerUrl = d;
|
|
3056
3056
|
}
|
|
3057
3057
|
}
|
|
3058
3058
|
/**
|
|
@@ -3072,7 +3072,7 @@ const be = class be {
|
|
|
3072
3072
|
* ```
|
|
3073
3073
|
*/
|
|
3074
3074
|
static fromPlatformContext(t) {
|
|
3075
|
-
const e = (typeof window < "u" ? window.__THATOPEN_CONTEXT__ : null) || { appId: "", projectId: "", accessToken: "", apiUrl: "" }, s = new
|
|
3075
|
+
const e = (typeof window < "u" ? window.__THATOPEN_CONTEXT__ : null) || { appId: "", projectId: "", accessToken: "", apiUrl: "" }, s = new Se(e.accessToken, e.apiUrl, {
|
|
3076
3076
|
...t,
|
|
3077
3077
|
useBearer: !0
|
|
3078
3078
|
});
|
|
@@ -3148,7 +3148,7 @@ const be = class be {
|
|
|
3148
3148
|
* cleaning logic is applied identically.
|
|
3149
3149
|
*/
|
|
3150
3150
|
async request(t, e, s) {
|
|
3151
|
-
return a(this,
|
|
3151
|
+
return a(this, l, y).call(this, t, e, s);
|
|
3152
3152
|
}
|
|
3153
3153
|
// ─── Files ───────────────────────────────────────────────────────
|
|
3154
3154
|
/**
|
|
@@ -3157,12 +3157,12 @@ const be = class be {
|
|
|
3157
3157
|
* @returns Array of file items.
|
|
3158
3158
|
*/
|
|
3159
3159
|
async listFiles(t) {
|
|
3160
|
-
const { folderId: e, archived: s, projectId:
|
|
3161
|
-
return e ? await a(this,
|
|
3160
|
+
const { folderId: e, archived: s, projectId: n } = t || {};
|
|
3161
|
+
return e ? await a(this, l, y).call(this, "GET", `${P}/${e}/items`, { query: { itemType: Ht, archived: s } }) : await a(this, l, y).call(this, "GET", `${m}`, {
|
|
3162
3162
|
query: {
|
|
3163
|
-
itemType:
|
|
3163
|
+
itemType: Ht,
|
|
3164
3164
|
archived: s,
|
|
3165
|
-
...
|
|
3165
|
+
...n && { projectId: n }
|
|
3166
3166
|
}
|
|
3167
3167
|
});
|
|
3168
3168
|
}
|
|
@@ -3173,7 +3173,7 @@ const be = class be {
|
|
|
3173
3173
|
* @returns The file item, optionally with version history.
|
|
3174
3174
|
*/
|
|
3175
3175
|
async getFile(t, e) {
|
|
3176
|
-
return await a(this,
|
|
3176
|
+
return await a(this, l, de).call(this, t, e);
|
|
3177
3177
|
}
|
|
3178
3178
|
/**
|
|
3179
3179
|
* Uploads a new file.
|
|
@@ -3181,7 +3181,7 @@ const be = class be {
|
|
|
3181
3181
|
* @returns The created item and its first version.
|
|
3182
3182
|
*/
|
|
3183
3183
|
async createFile(t) {
|
|
3184
|
-
return await a(this,
|
|
3184
|
+
return await a(this, l, Pt).call(this, t, Ht);
|
|
3185
3185
|
}
|
|
3186
3186
|
/**
|
|
3187
3187
|
* Updates an existing file. Can rename, move to a different folder,
|
|
@@ -3191,21 +3191,21 @@ const be = class be {
|
|
|
3191
3191
|
* @returns The updated item and/or the new version.
|
|
3192
3192
|
*/
|
|
3193
3193
|
async updateFile(t, e) {
|
|
3194
|
-
return await a(this,
|
|
3194
|
+
return await a(this, l, ue).call(this, t, e);
|
|
3195
3195
|
}
|
|
3196
3196
|
/**
|
|
3197
3197
|
* Archives (soft-deletes) a file. Can be recovered with {@link recoverFile}.
|
|
3198
3198
|
* @param fileId - The file's unique identifier.
|
|
3199
3199
|
*/
|
|
3200
3200
|
async archiveFile(t) {
|
|
3201
|
-
return await a(this,
|
|
3201
|
+
return await a(this, l, y).call(this, "DELETE", `${m}/${t}`);
|
|
3202
3202
|
}
|
|
3203
3203
|
/**
|
|
3204
3204
|
* Recovers a previously archived file.
|
|
3205
3205
|
* @param fileId - The file's unique identifier.
|
|
3206
3206
|
*/
|
|
3207
3207
|
async recoverFile(t) {
|
|
3208
|
-
return await a(this,
|
|
3208
|
+
return await a(this, l, y).call(this, "PUT", `${m}/${t}/recover`);
|
|
3209
3209
|
}
|
|
3210
3210
|
/**
|
|
3211
3211
|
* Downloads a file's content. Returns the raw fetch Response.
|
|
@@ -3214,7 +3214,7 @@ const be = class be {
|
|
|
3214
3214
|
* @returns A fetch Response containing the file data.
|
|
3215
3215
|
*/
|
|
3216
3216
|
async downloadFile(t, e) {
|
|
3217
|
-
return await a(this,
|
|
3217
|
+
return await a(this, l, Nt).call(this, t, e);
|
|
3218
3218
|
}
|
|
3219
3219
|
/**
|
|
3220
3220
|
* Retrieves the free-JSON metadata for a specific file version.
|
|
@@ -3224,10 +3224,10 @@ const be = class be {
|
|
|
3224
3224
|
* @param params - Optional flags such as `withDraft`.
|
|
3225
3225
|
*/
|
|
3226
3226
|
async getFileVersionMetadata(t, e, s) {
|
|
3227
|
-
const { withDraft:
|
|
3228
|
-
return await a(this,
|
|
3227
|
+
const { withDraft: n } = s || {};
|
|
3228
|
+
return await a(this, l, y).call(this, "GET", `${m}/${encodeURIComponent(t)}/version/${encodeURIComponent(e)}/metadata`, {
|
|
3229
3229
|
query: {
|
|
3230
|
-
...
|
|
3230
|
+
...n && { withDraft: "true" }
|
|
3231
3231
|
}
|
|
3232
3232
|
});
|
|
3233
3233
|
}
|
|
@@ -3238,7 +3238,7 @@ const be = class be {
|
|
|
3238
3238
|
* @param metadata - Free-JSON object (max 200 fields, 50-char keys/values).
|
|
3239
3239
|
*/
|
|
3240
3240
|
async updateFileVersionMetadata(t, e, s) {
|
|
3241
|
-
return await a(this,
|
|
3241
|
+
return await a(this, l, y).call(this, "PUT", `${m}/${encodeURIComponent(t)}/version/${encodeURIComponent(e)}/metadata`, {
|
|
3242
3242
|
body: JSON.stringify({ metadata: s }),
|
|
3243
3243
|
contentType: "application/json"
|
|
3244
3244
|
});
|
|
@@ -3249,7 +3249,7 @@ const be = class be {
|
|
|
3249
3249
|
* @param versionTag - The version tag.
|
|
3250
3250
|
*/
|
|
3251
3251
|
async deleteFileVersionMetadata(t, e) {
|
|
3252
|
-
return await a(this,
|
|
3252
|
+
return await a(this, l, y).call(this, "DELETE", `${m}/${encodeURIComponent(t)}/version/${encodeURIComponent(e)}/metadata`);
|
|
3253
3253
|
}
|
|
3254
3254
|
/**
|
|
3255
3255
|
* Batch variant of {@link getFileVersionMetadata}. Reads the metadata of
|
|
@@ -3266,9 +3266,9 @@ const be = class be {
|
|
|
3266
3266
|
*/
|
|
3267
3267
|
async getFileVersionMetadataBatch(t, e) {
|
|
3268
3268
|
const { withDraft: s } = e || {};
|
|
3269
|
-
return await a(this,
|
|
3269
|
+
return await a(this, l, gt).call(this, t, async (n) => (await a(this, l, y).call(this, "POST", `${m}/batch/version-metadata`, {
|
|
3270
3270
|
body: JSON.stringify({
|
|
3271
|
-
entries:
|
|
3271
|
+
entries: n,
|
|
3272
3272
|
...s !== void 0 && { withDraft: s }
|
|
3273
3273
|
}),
|
|
3274
3274
|
contentType: "application/json"
|
|
@@ -3281,12 +3281,12 @@ const be = class be {
|
|
|
3281
3281
|
* @returns Array of folder items.
|
|
3282
3282
|
*/
|
|
3283
3283
|
async listFolders(t) {
|
|
3284
|
-
const { archived: e, parentFolderId: s, projectId:
|
|
3285
|
-
return await a(this,
|
|
3284
|
+
const { archived: e, parentFolderId: s, projectId: n } = t || {};
|
|
3285
|
+
return await a(this, l, y).call(this, "GET", P, {
|
|
3286
3286
|
query: {
|
|
3287
3287
|
parentFolderId: s,
|
|
3288
3288
|
archived: e,
|
|
3289
|
-
...
|
|
3289
|
+
...n && { projectId: n }
|
|
3290
3290
|
}
|
|
3291
3291
|
});
|
|
3292
3292
|
}
|
|
@@ -3295,7 +3295,7 @@ const be = class be {
|
|
|
3295
3295
|
* @param folderId - The folder's unique identifier.
|
|
3296
3296
|
*/
|
|
3297
3297
|
async getFolder(t) {
|
|
3298
|
-
return await a(this,
|
|
3298
|
+
return await a(this, l, y).call(this, "GET", `${P}/${t}`);
|
|
3299
3299
|
}
|
|
3300
3300
|
/**
|
|
3301
3301
|
* Batch variant of {@link getFolder}. Resolves a known set of folder ids in
|
|
@@ -3311,7 +3311,7 @@ const be = class be {
|
|
|
3311
3311
|
* @param folderIds - The folder ids to resolve.
|
|
3312
3312
|
*/
|
|
3313
3313
|
async getFoldersBatch(t) {
|
|
3314
|
-
return await a(this,
|
|
3314
|
+
return await a(this, l, gt).call(this, t, async (e) => (await a(this, l, y).call(this, "POST", `${m}/batch/folders`, {
|
|
3315
3315
|
body: JSON.stringify({ folderIds: e }),
|
|
3316
3316
|
contentType: "application/json"
|
|
3317
3317
|
})).results);
|
|
@@ -3323,7 +3323,7 @@ const be = class be {
|
|
|
3323
3323
|
* @returns The created folder.
|
|
3324
3324
|
*/
|
|
3325
3325
|
async createFolder(t, e, s) {
|
|
3326
|
-
return await a(this,
|
|
3326
|
+
return await a(this, l, y).call(this, "POST", P, {
|
|
3327
3327
|
body: JSON.stringify({
|
|
3328
3328
|
name: t,
|
|
3329
3329
|
...e && { parentId: e },
|
|
@@ -3340,7 +3340,7 @@ const be = class be {
|
|
|
3340
3340
|
*/
|
|
3341
3341
|
async updateFolder(t, e) {
|
|
3342
3342
|
const { name: s } = e;
|
|
3343
|
-
return await a(this,
|
|
3343
|
+
return await a(this, l, y).call(this, "PUT", `${P}/${t}`, {
|
|
3344
3344
|
body: JSON.stringify({ name: s }),
|
|
3345
3345
|
contentType: "application/json"
|
|
3346
3346
|
});
|
|
@@ -3350,14 +3350,14 @@ const be = class be {
|
|
|
3350
3350
|
* @param folderId - The folder's unique identifier.
|
|
3351
3351
|
*/
|
|
3352
3352
|
async archiveFolder(t) {
|
|
3353
|
-
return await a(this,
|
|
3353
|
+
return await a(this, l, y).call(this, "DELETE", `${P}/${t}`);
|
|
3354
3354
|
}
|
|
3355
3355
|
/**
|
|
3356
3356
|
* Recovers a previously archived folder.
|
|
3357
3357
|
* @param folderId - The folder's unique identifier.
|
|
3358
3358
|
*/
|
|
3359
3359
|
async recoverFolder(t) {
|
|
3360
|
-
return await a(this,
|
|
3360
|
+
return await a(this, l, y).call(this, "PUT", `${P}/${t}/recover`);
|
|
3361
3361
|
}
|
|
3362
3362
|
/**
|
|
3363
3363
|
* Downloads an entire folder as a ZIP archive.
|
|
@@ -3365,7 +3365,7 @@ const be = class be {
|
|
|
3365
3365
|
* @returns A fetch Response containing the ZIP data.
|
|
3366
3366
|
*/
|
|
3367
3367
|
async downloadFolder(t) {
|
|
3368
|
-
return await a(this,
|
|
3368
|
+
return await a(this, l, H).call(this, `${P}/${t}/download`);
|
|
3369
3369
|
}
|
|
3370
3370
|
// ─── Components ──────────────────────────────────────────────────
|
|
3371
3371
|
/**
|
|
@@ -3374,17 +3374,17 @@ const be = class be {
|
|
|
3374
3374
|
* @returns Array of component items.
|
|
3375
3375
|
*/
|
|
3376
3376
|
async listComponents(t) {
|
|
3377
|
-
const { folderId: e, ShowVersions: s, projectId:
|
|
3378
|
-
return e ? await a(this,
|
|
3377
|
+
const { folderId: e, ShowVersions: s, projectId: n } = t || {};
|
|
3378
|
+
return e ? await a(this, l, y).call(this, "GET", `${P}/${e}/items`, {
|
|
3379
3379
|
query: {
|
|
3380
|
-
itemType:
|
|
3380
|
+
itemType: Jt,
|
|
3381
3381
|
...s && { ShowVersions: s }
|
|
3382
3382
|
}
|
|
3383
|
-
}) : await a(this,
|
|
3383
|
+
}) : await a(this, l, y).call(this, "GET", `${m}`, {
|
|
3384
3384
|
query: {
|
|
3385
|
-
itemType:
|
|
3385
|
+
itemType: Jt,
|
|
3386
3386
|
...s && { ShowVersions: s },
|
|
3387
|
-
...
|
|
3387
|
+
...n && { projectId: n }
|
|
3388
3388
|
}
|
|
3389
3389
|
});
|
|
3390
3390
|
}
|
|
@@ -3394,7 +3394,7 @@ const be = class be {
|
|
|
3394
3394
|
* @param props - Options such as whether to include versions.
|
|
3395
3395
|
*/
|
|
3396
3396
|
async getComponent(t, e) {
|
|
3397
|
-
return await a(this,
|
|
3397
|
+
return await a(this, l, de).call(this, t, e);
|
|
3398
3398
|
}
|
|
3399
3399
|
/**
|
|
3400
3400
|
* Creates a new component with the given file and version properties.
|
|
@@ -3403,7 +3403,7 @@ const be = class be {
|
|
|
3403
3403
|
*/
|
|
3404
3404
|
async createComponent(t) {
|
|
3405
3405
|
const { componentProps: e } = t;
|
|
3406
|
-
return await a(this,
|
|
3406
|
+
return await a(this, l, Pt).call(this, t, Jt, e);
|
|
3407
3407
|
}
|
|
3408
3408
|
/**
|
|
3409
3409
|
* Updates an existing component. Can rename, move, and/or upload a new version.
|
|
@@ -3413,7 +3413,7 @@ const be = class be {
|
|
|
3413
3413
|
*/
|
|
3414
3414
|
async updateComponent(t, e) {
|
|
3415
3415
|
const { componentProps: s } = e;
|
|
3416
|
-
return await a(this,
|
|
3416
|
+
return await a(this, l, ue).call(this, t, e, s);
|
|
3417
3417
|
}
|
|
3418
3418
|
/**
|
|
3419
3419
|
* Downloads a component's full ZIP file. Returns the raw fetch Response.
|
|
@@ -3422,7 +3422,7 @@ const be = class be {
|
|
|
3422
3422
|
* @returns A fetch Response containing the ZIP data.
|
|
3423
3423
|
*/
|
|
3424
3424
|
async downloadComponent(t, e) {
|
|
3425
|
-
return await a(this,
|
|
3425
|
+
return await a(this, l, Nt).call(this, t, e);
|
|
3426
3426
|
}
|
|
3427
3427
|
/**
|
|
3428
3428
|
* Downloads only the JavaScript bundle from a component's ZIP.
|
|
@@ -3432,11 +3432,11 @@ const be = class be {
|
|
|
3432
3432
|
* @returns A fetch Response containing the bundle JavaScript text.
|
|
3433
3433
|
*/
|
|
3434
3434
|
async downloadComponentBundle(t, e) {
|
|
3435
|
-
const { versionTag: s, withDraft:
|
|
3436
|
-
return await a(this,
|
|
3435
|
+
const { versionTag: s, withDraft: n } = e || {};
|
|
3436
|
+
return await a(this, l, H).call(this, `${m}/${t}/download/bundle`, {
|
|
3437
3437
|
query: {
|
|
3438
3438
|
...s && { versionTag: s },
|
|
3439
|
-
...
|
|
3439
|
+
...n && { withDraft: n }
|
|
3440
3440
|
}
|
|
3441
3441
|
});
|
|
3442
3442
|
}
|
|
@@ -3445,14 +3445,14 @@ const be = class be {
|
|
|
3445
3445
|
* @param componentId - The component's unique identifier.
|
|
3446
3446
|
*/
|
|
3447
3447
|
async archiveComponent(t) {
|
|
3448
|
-
return await a(this,
|
|
3448
|
+
return await a(this, l, y).call(this, "DELETE", `${m}/${t}`);
|
|
3449
3449
|
}
|
|
3450
3450
|
/**
|
|
3451
3451
|
* Recovers a previously archived component.
|
|
3452
3452
|
* @param componentId - The component's unique identifier.
|
|
3453
3453
|
*/
|
|
3454
3454
|
async recoverComponent(t) {
|
|
3455
|
-
return await a(this,
|
|
3455
|
+
return await a(this, l, y).call(this, "PUT", `${m}/${t}/recover`);
|
|
3456
3456
|
}
|
|
3457
3457
|
// ─── Built-in Components ─────────────────────────────────────────
|
|
3458
3458
|
/**
|
|
@@ -3461,7 +3461,7 @@ const be = class be {
|
|
|
3461
3461
|
* @returns The component's JavaScript source code as a string.
|
|
3462
3462
|
*/
|
|
3463
3463
|
async getBuiltInComponent(t) {
|
|
3464
|
-
return await (await a(this,
|
|
3464
|
+
return await (await a(this, l, H).call(this, `built-in/${t}/bundle`)).text();
|
|
3465
3465
|
}
|
|
3466
3466
|
/**
|
|
3467
3467
|
* Fetches a built-in component bundle, evaluates it, and registers it
|
|
@@ -3490,9 +3490,9 @@ const be = class be {
|
|
|
3490
3490
|
* ```
|
|
3491
3491
|
*/
|
|
3492
3492
|
async initBuiltInComponent(t, e, s) {
|
|
3493
|
-
const
|
|
3494
|
-
return main;`)(...c),
|
|
3495
|
-
e.get(
|
|
3493
|
+
const n = await this.getBuiltInComponent(t.uuid), i = s ?? this.builtInGlobals ?? (typeof window < "u" ? window.ThatOpenCompany : {}) ?? {}, o = Object.keys(i), c = o.map((g) => i[g]), f = new Function(...o, `${n}
|
|
3494
|
+
return main;`)(...c), h = (f == null ? void 0 : f.componentDefinition) ?? f;
|
|
3495
|
+
e.get(h);
|
|
3496
3496
|
}
|
|
3497
3497
|
/**
|
|
3498
3498
|
* Loads multiple built-in components in parallel.
|
|
@@ -3535,12 +3535,12 @@ return main;`)(...c), y = (f == null ? void 0 : f.componentDefinition) ?? f;
|
|
|
3535
3535
|
*/
|
|
3536
3536
|
async setup(t, ...e) {
|
|
3537
3537
|
var o, c;
|
|
3538
|
-
const s = t.OBC,
|
|
3538
|
+
const s = t.OBC, n = t.BUI;
|
|
3539
3539
|
if (!(s != null && s.Components))
|
|
3540
3540
|
throw new Error("globals.OBC must include Components");
|
|
3541
|
-
if (!(
|
|
3541
|
+
if (!(n != null && n.Manager)) throw new Error("globals.BUI must include Manager");
|
|
3542
3542
|
const i = new s.Components();
|
|
3543
|
-
return
|
|
3543
|
+
return n.Manager.init(), this.setBuiltInGlobals(t), await this.initBuiltInComponents(i, ...e), i.init(), (c = (o = this.context.appEventOrchestrator) == null ? void 0 : o.appLoaded) == null || c.call(o), { components: i };
|
|
3544
3544
|
}
|
|
3545
3545
|
/**
|
|
3546
3546
|
* Reports an error to the platform via the {@link AppEventOrchestrator.appError} callback.
|
|
@@ -3548,8 +3548,8 @@ return main;`)(...c), y = (f == null ? void 0 : f.componentDefinition) ?? f;
|
|
|
3548
3548
|
* @param data - Arbitrary error data to send to the platform.
|
|
3549
3549
|
*/
|
|
3550
3550
|
throwError(t, e) {
|
|
3551
|
-
var s,
|
|
3552
|
-
(
|
|
3551
|
+
var s, n;
|
|
3552
|
+
(n = (s = this.context.appEventOrchestrator) == null ? void 0 : s.appError) == null || n.call(s, t, e);
|
|
3553
3553
|
}
|
|
3554
3554
|
// ─── Apps ────────────────────────────────────────────────────────
|
|
3555
3555
|
/**
|
|
@@ -3558,17 +3558,17 @@ return main;`)(...c), y = (f == null ? void 0 : f.componentDefinition) ?? f;
|
|
|
3558
3558
|
* @returns Array of app items.
|
|
3559
3559
|
*/
|
|
3560
3560
|
async listApps(t) {
|
|
3561
|
-
const { folderId: e, ShowVersions: s, projectId:
|
|
3562
|
-
return e ? await a(this,
|
|
3561
|
+
const { folderId: e, ShowVersions: s, projectId: n } = t || {};
|
|
3562
|
+
return e ? await a(this, l, y).call(this, "GET", `${P}/${e}/items`, {
|
|
3563
3563
|
query: {
|
|
3564
|
-
itemType:
|
|
3564
|
+
itemType: Yt,
|
|
3565
3565
|
...s && { ShowVersions: s }
|
|
3566
3566
|
}
|
|
3567
|
-
}) : await a(this,
|
|
3567
|
+
}) : await a(this, l, y).call(this, "GET", `${m}`, {
|
|
3568
3568
|
query: {
|
|
3569
|
-
itemType:
|
|
3569
|
+
itemType: Yt,
|
|
3570
3570
|
...s && { ShowVersions: s },
|
|
3571
|
-
...
|
|
3571
|
+
...n && { projectId: n }
|
|
3572
3572
|
}
|
|
3573
3573
|
});
|
|
3574
3574
|
}
|
|
@@ -3579,7 +3579,7 @@ return main;`)(...c), y = (f == null ? void 0 : f.componentDefinition) ?? f;
|
|
|
3579
3579
|
*/
|
|
3580
3580
|
async createApp(t) {
|
|
3581
3581
|
const { appProps: e } = t;
|
|
3582
|
-
return await a(this,
|
|
3582
|
+
return await a(this, l, Pt).call(this, t, Yt, e);
|
|
3583
3583
|
}
|
|
3584
3584
|
/**
|
|
3585
3585
|
* Downloads an app's full ZIP file. Returns the raw fetch Response.
|
|
@@ -3588,7 +3588,7 @@ return main;`)(...c), y = (f == null ? void 0 : f.componentDefinition) ?? f;
|
|
|
3588
3588
|
* @returns A fetch Response containing the ZIP data.
|
|
3589
3589
|
*/
|
|
3590
3590
|
async downloadApp(t, e) {
|
|
3591
|
-
return await a(this,
|
|
3591
|
+
return await a(this, l, Nt).call(this, t, e);
|
|
3592
3592
|
}
|
|
3593
3593
|
/**
|
|
3594
3594
|
* Downloads only the JavaScript bundle from an app's ZIP.
|
|
@@ -3598,11 +3598,11 @@ return main;`)(...c), y = (f == null ? void 0 : f.componentDefinition) ?? f;
|
|
|
3598
3598
|
* @returns A fetch Response containing the bundle JavaScript text.
|
|
3599
3599
|
*/
|
|
3600
3600
|
async downloadAppBundle(t, e) {
|
|
3601
|
-
const { versionTag: s, withDraft:
|
|
3602
|
-
return await a(this,
|
|
3601
|
+
const { versionTag: s, withDraft: n } = e || {};
|
|
3602
|
+
return await a(this, l, H).call(this, `${m}/${t}/download/bundle`, {
|
|
3603
3603
|
query: {
|
|
3604
3604
|
...s && { versionTag: s },
|
|
3605
|
-
...
|
|
3605
|
+
...n && { withDraft: n }
|
|
3606
3606
|
}
|
|
3607
3607
|
});
|
|
3608
3608
|
}
|
|
@@ -3611,7 +3611,7 @@ return main;`)(...c), y = (f == null ? void 0 : f.componentDefinition) ?? f;
|
|
|
3611
3611
|
* @param appId - The app's unique identifier.
|
|
3612
3612
|
*/
|
|
3613
3613
|
async archiveApp(t) {
|
|
3614
|
-
return await a(this,
|
|
3614
|
+
return await a(this, l, y).call(this, "DELETE", `${m}/${t}`);
|
|
3615
3615
|
}
|
|
3616
3616
|
// ─── NPM Registry ────────────────────────────────────────────────
|
|
3617
3617
|
/**
|
|
@@ -3623,7 +3623,7 @@ return main;`)(...c), y = (f == null ? void 0 : f.componentDefinition) ?? f;
|
|
|
3623
3623
|
* @returns The registry, scope, read-only token, and assembled `.npmrc`.
|
|
3624
3624
|
*/
|
|
3625
3625
|
async getNpmCredentials() {
|
|
3626
|
-
return await a(this,
|
|
3626
|
+
return await a(this, l, y).call(this, "GET", `${zr}/credentials`);
|
|
3627
3627
|
}
|
|
3628
3628
|
// ─── Execution ───────────────────────────────────────────────────
|
|
3629
3629
|
/**
|
|
@@ -3642,7 +3642,7 @@ return main;`)(...c), y = (f == null ? void 0 : f.componentDefinition) ?? f;
|
|
|
3642
3642
|
*/
|
|
3643
3643
|
async executeComponent(t, e, s) {
|
|
3644
3644
|
if (this.localServerUrl) {
|
|
3645
|
-
const
|
|
3645
|
+
const n = `${this.localServerUrl}/api/${G}/${t}/execute`, i = await fetch(n, {
|
|
3646
3646
|
method: "POST",
|
|
3647
3647
|
headers: { "Content-Type": "application/json" },
|
|
3648
3648
|
body: JSON.stringify(e)
|
|
@@ -3655,7 +3655,7 @@ return main;`)(...c), y = (f == null ? void 0 : f.componentDefinition) ?? f;
|
|
|
3655
3655
|
}
|
|
3656
3656
|
return await i.json();
|
|
3657
3657
|
}
|
|
3658
|
-
return await a(this,
|
|
3658
|
+
return await a(this, l, y).call(this, "POST", `${G}/${t}/execute`, {
|
|
3659
3659
|
body: JSON.stringify(e),
|
|
3660
3660
|
query: { ...s && { versionTag: s } },
|
|
3661
3661
|
contentType: "application/json"
|
|
@@ -3667,16 +3667,16 @@ return main;`)(...c), y = (f == null ? void 0 : f.componentDefinition) ?? f;
|
|
|
3667
3667
|
*/
|
|
3668
3668
|
async abortExecution(t) {
|
|
3669
3669
|
if (this.localServerUrl) {
|
|
3670
|
-
const e = `${this.localServerUrl}/api/${
|
|
3670
|
+
const e = `${this.localServerUrl}/api/${G}/progress/${t}/abort`, s = await fetch(e, { method: "POST" });
|
|
3671
3671
|
if (!s.ok) {
|
|
3672
|
-
const
|
|
3672
|
+
const n = await s.text().catch(() => "");
|
|
3673
3673
|
throw new Error(
|
|
3674
|
-
`Local server request failed: ${s.status} - ${
|
|
3674
|
+
`Local server request failed: ${s.status} - ${n}`
|
|
3675
3675
|
);
|
|
3676
3676
|
}
|
|
3677
3677
|
return await s.json();
|
|
3678
3678
|
}
|
|
3679
|
-
return await a(this,
|
|
3679
|
+
return await a(this, l, y).call(this, "POST", `${G}/progress/${t}/abort`);
|
|
3680
3680
|
}
|
|
3681
3681
|
/**
|
|
3682
3682
|
* Lists all executions for a given component.
|
|
@@ -3693,7 +3693,7 @@ return main;`)(...c), y = (f == null ? void 0 : f.componentDefinition) ?? f;
|
|
|
3693
3693
|
*/
|
|
3694
3694
|
async listExecutions(t, e) {
|
|
3695
3695
|
if (this.localServerUrl) {
|
|
3696
|
-
const s = e ? `?projectId=${encodeURIComponent(e)}` : "",
|
|
3696
|
+
const s = e ? `?projectId=${encodeURIComponent(e)}` : "", n = `${this.localServerUrl}/api/${G}/${t}/progress${s}`, i = await fetch(n);
|
|
3697
3697
|
if (!i.ok) {
|
|
3698
3698
|
const o = await i.text().catch(() => "");
|
|
3699
3699
|
throw new Error(
|
|
@@ -3702,7 +3702,7 @@ return main;`)(...c), y = (f == null ? void 0 : f.componentDefinition) ?? f;
|
|
|
3702
3702
|
}
|
|
3703
3703
|
return await i.json();
|
|
3704
3704
|
}
|
|
3705
|
-
return await a(this,
|
|
3705
|
+
return await a(this, l, y).call(this, "GET", `${G}/${t}/progress`, { query: { ...e && { projectId: e } } });
|
|
3706
3706
|
}
|
|
3707
3707
|
/**
|
|
3708
3708
|
* Gets details of a specific execution, including its messages.
|
|
@@ -3711,16 +3711,16 @@ return main;`)(...c), y = (f == null ? void 0 : f.componentDefinition) ?? f;
|
|
|
3711
3711
|
*/
|
|
3712
3712
|
async getExecution(t) {
|
|
3713
3713
|
if (this.localServerUrl) {
|
|
3714
|
-
const e = `${this.localServerUrl}/api/${
|
|
3714
|
+
const e = `${this.localServerUrl}/api/${G}/progress/${t}`, s = await fetch(e);
|
|
3715
3715
|
if (!s.ok) {
|
|
3716
|
-
const
|
|
3716
|
+
const n = await s.text().catch(() => "");
|
|
3717
3717
|
throw new Error(
|
|
3718
|
-
`Local server request failed: ${s.status} - ${
|
|
3718
|
+
`Local server request failed: ${s.status} - ${n}`
|
|
3719
3719
|
);
|
|
3720
3720
|
}
|
|
3721
3721
|
return await s.json();
|
|
3722
3722
|
}
|
|
3723
|
-
return await a(this,
|
|
3723
|
+
return await a(this, l, y).call(this, "GET", `${G}/progress/${t}`);
|
|
3724
3724
|
}
|
|
3725
3725
|
/**
|
|
3726
3726
|
* Subscribes to real-time execution progress via WebSocket.
|
|
@@ -3729,15 +3729,15 @@ return main;`)(...c), y = (f == null ? void 0 : f.componentDefinition) ?? f;
|
|
|
3729
3729
|
* @param onUpdateCallback - Callback invoked on each progress/result event.
|
|
3730
3730
|
*/
|
|
3731
3731
|
async onExecutionProgress(t, e) {
|
|
3732
|
-
const s = this.localServerUrl ?? this.wsUrl,
|
|
3732
|
+
const s = this.localServerUrl ?? this.wsUrl, n = await wt(s, {
|
|
3733
3733
|
auth: { accessToken: this.accessToken },
|
|
3734
3734
|
transports: ["websocket"]
|
|
3735
3735
|
});
|
|
3736
|
-
|
|
3737
|
-
|
|
3736
|
+
n.on("connect", function() {
|
|
3737
|
+
n.emit("executionSubscription", JSON.stringify({ executionId: t })), n.on("execution", (i) => {
|
|
3738
3738
|
e(i);
|
|
3739
3739
|
});
|
|
3740
|
-
}),
|
|
3740
|
+
}), n.on("connect_error", function(i) {
|
|
3741
3741
|
console.log(i);
|
|
3742
3742
|
});
|
|
3743
3743
|
}
|
|
@@ -3748,7 +3748,7 @@ return main;`)(...c), y = (f == null ? void 0 : f.componentDefinition) ?? f;
|
|
|
3748
3748
|
* renderable views. See `src/core/documents.ts` for the model and schema.
|
|
3749
3749
|
*/
|
|
3750
3750
|
documents(t) {
|
|
3751
|
-
return new
|
|
3751
|
+
return new as(this, t);
|
|
3752
3752
|
}
|
|
3753
3753
|
/**
|
|
3754
3754
|
* A project's history of connected documents (Revit models, AutoCAD
|
|
@@ -3757,14 +3757,14 @@ return main;`)(...c), y = (f == null ? void 0 : f.componentDefinition) ?? f;
|
|
|
3757
3757
|
* or write it; the storage underneath is private and will move.
|
|
3758
3758
|
*/
|
|
3759
3759
|
history(t) {
|
|
3760
|
-
return new
|
|
3760
|
+
return new Gr(this, t);
|
|
3761
3761
|
}
|
|
3762
3762
|
/**
|
|
3763
3763
|
* The recipe registry and runner: scripts that write change requests in a
|
|
3764
3764
|
* native application's language. See `src/core/recipes.ts`.
|
|
3765
3765
|
*/
|
|
3766
3766
|
get recipes() {
|
|
3767
|
-
return
|
|
3767
|
+
return u(this, vt) ?? _(this, vt, new Yr(this)), u(this, vt);
|
|
3768
3768
|
}
|
|
3769
3769
|
// ─── Hidden Files ────────────────────────────────────────────────
|
|
3770
3770
|
/**
|
|
@@ -3777,9 +3777,9 @@ return main;`)(...c), y = (f == null ? void 0 : f.componentDefinition) ?? f;
|
|
|
3777
3777
|
* @returns The hidden file ID.
|
|
3778
3778
|
*/
|
|
3779
3779
|
async createHiddenFile(t, e, s) {
|
|
3780
|
-
const
|
|
3781
|
-
return
|
|
3782
|
-
body:
|
|
3780
|
+
const n = new FormData();
|
|
3781
|
+
return n.append("file", t), n.append("parentItemId", e), s != null && n.append("tag", s), await a(this, l, y).call(this, "POST", `${m}/${q}`, {
|
|
3782
|
+
body: n
|
|
3783
3783
|
});
|
|
3784
3784
|
}
|
|
3785
3785
|
/**
|
|
@@ -3793,11 +3793,11 @@ return main;`)(...c), y = (f == null ? void 0 : f.componentDefinition) ?? f;
|
|
|
3793
3793
|
* @returns One result per uploaded file, in order, each with its hidden file ID.
|
|
3794
3794
|
*/
|
|
3795
3795
|
async createHiddenFilesBatch(t, e, s) {
|
|
3796
|
-
const
|
|
3796
|
+
const n = new FormData();
|
|
3797
3797
|
for (const i of t)
|
|
3798
|
-
|
|
3799
|
-
return
|
|
3800
|
-
body:
|
|
3798
|
+
n.append("files", i);
|
|
3799
|
+
return n.append("parentItemId", e), s != null && n.append("tag", s), await a(this, l, y).call(this, "POST", `${m}/${q}/batch`, {
|
|
3800
|
+
body: n
|
|
3801
3801
|
});
|
|
3802
3802
|
}
|
|
3803
3803
|
/**
|
|
@@ -3805,21 +3805,21 @@ return main;`)(...c), y = (f == null ? void 0 : f.componentDefinition) ?? f;
|
|
|
3805
3805
|
* @param hiddenId - The hidden file's unique identifier.
|
|
3806
3806
|
*/
|
|
3807
3807
|
async deleteHiddenFile(t) {
|
|
3808
|
-
return await a(this,
|
|
3808
|
+
return await a(this, l, y).call(this, "DELETE", `${m}/${q}/${t}`);
|
|
3809
3809
|
}
|
|
3810
3810
|
/**
|
|
3811
3811
|
* Gets metadata for a hidden file.
|
|
3812
3812
|
* @param hiddenId - The hidden file's unique identifier.
|
|
3813
3813
|
*/
|
|
3814
3814
|
async getHiddenFile(t) {
|
|
3815
|
-
return await a(this,
|
|
3815
|
+
return await a(this, l, y).call(this, "GET", `${m}/${q}/${t}`);
|
|
3816
3816
|
}
|
|
3817
3817
|
/**
|
|
3818
3818
|
* Downloads a hidden file's content. Returns the raw fetch Response.
|
|
3819
3819
|
* @param hiddenId - The hidden file's unique identifier.
|
|
3820
3820
|
*/
|
|
3821
3821
|
async downloadHiddenFile(t) {
|
|
3822
|
-
return await a(this,
|
|
3822
|
+
return await a(this, l, H).call(this, `${m}/${q}/${t}/download`);
|
|
3823
3823
|
}
|
|
3824
3824
|
/**
|
|
3825
3825
|
* Mints a short-lived presigned URL for a hidden file so the browser can
|
|
@@ -3839,7 +3839,7 @@ return main;`)(...c), y = (f == null ? void 0 : f.componentDefinition) ?? f;
|
|
|
3839
3839
|
* an ISO timestamp when it stops working.
|
|
3840
3840
|
*/
|
|
3841
3841
|
async getHiddenFileSignedUrl(t, e) {
|
|
3842
|
-
return await a(this,
|
|
3842
|
+
return await a(this, l, y).call(this, "GET", `${m}/${q}/${t}/signed-url`, { ...e != null && { query: { expiresIn: e } } });
|
|
3843
3843
|
}
|
|
3844
3844
|
/**
|
|
3845
3845
|
* Batch variant of {@link getHiddenFileSignedUrl}. Mints presigned URLs for
|
|
@@ -3860,7 +3860,7 @@ return main;`)(...c), y = (f == null ? void 0 : f.componentDefinition) ?? f;
|
|
|
3860
3860
|
* 900 (15 min) server-side; values are clamped to that range.
|
|
3861
3861
|
*/
|
|
3862
3862
|
async getHiddenFileSignedUrlsBatch(t, e) {
|
|
3863
|
-
return await a(this,
|
|
3863
|
+
return await a(this, l, gt).call(this, t, async (s) => (await a(this, l, y).call(this, "POST", `${m}/${q}/signed-url/batch`, {
|
|
3864
3864
|
body: JSON.stringify({
|
|
3865
3865
|
hiddenFileIds: s,
|
|
3866
3866
|
...e != null && { expiresIn: e }
|
|
@@ -3876,14 +3876,14 @@ return main;`)(...c), y = (f == null ? void 0 : f.componentDefinition) ?? f;
|
|
|
3876
3876
|
* @returns Array of hidden file entities.
|
|
3877
3877
|
*/
|
|
3878
3878
|
async getHiddenFilesByParent(t, e) {
|
|
3879
|
-
return await a(this,
|
|
3879
|
+
return await a(this, l, y).call(this, "GET", `${m}/${t}/${q}`, { ...e != null && { query: { tag: e } } });
|
|
3880
3880
|
}
|
|
3881
3881
|
/**
|
|
3882
3882
|
* Deletes all hidden files attached to a parent item.
|
|
3883
3883
|
* @param parentFileId - The parent item's unique identifier.
|
|
3884
3884
|
*/
|
|
3885
3885
|
async deleteHiddenFilesByParent(t) {
|
|
3886
|
-
return await a(this,
|
|
3886
|
+
return await a(this, l, y).call(this, "DELETE", `${m}/${t}/${q}`);
|
|
3887
3887
|
}
|
|
3888
3888
|
// ─── Icons ───────────────────────────────────────────────────────
|
|
3889
3889
|
/**
|
|
@@ -3895,7 +3895,7 @@ return main;`)(...c), y = (f == null ? void 0 : f.componentDefinition) ?? f;
|
|
|
3895
3895
|
*/
|
|
3896
3896
|
async uploadItemIcon(t, e) {
|
|
3897
3897
|
const s = new FormData();
|
|
3898
|
-
return s.append("icon", e), await a(this,
|
|
3898
|
+
return s.append("icon", e), await a(this, l, y).call(this, "PUT", `${m}/${t}/icon`, {
|
|
3899
3899
|
body: s
|
|
3900
3900
|
});
|
|
3901
3901
|
}
|
|
@@ -3905,7 +3905,7 @@ return main;`)(...c), y = (f == null ? void 0 : f.componentDefinition) ?? f;
|
|
|
3905
3905
|
* @returns The raw Response (use `.blob()`, `.arrayBuffer()`, or pipe the body).
|
|
3906
3906
|
*/
|
|
3907
3907
|
async getItemIcon(t) {
|
|
3908
|
-
return await a(this,
|
|
3908
|
+
return await a(this, l, H).call(this, `${m}/${t}/icon`);
|
|
3909
3909
|
}
|
|
3910
3910
|
/**
|
|
3911
3911
|
* Removes the icon from an item.
|
|
@@ -3913,7 +3913,7 @@ return main;`)(...c), y = (f == null ? void 0 : f.componentDefinition) ?? f;
|
|
|
3913
3913
|
* @returns The updated item with icon fields removed.
|
|
3914
3914
|
*/
|
|
3915
3915
|
async removeItemIcon(t) {
|
|
3916
|
-
return await a(this,
|
|
3916
|
+
return await a(this, l, y).call(this, "DELETE", `${m}/${t}/icon`);
|
|
3917
3917
|
}
|
|
3918
3918
|
// ─── General Item Operations ─────────────────────────────────────
|
|
3919
3919
|
/**
|
|
@@ -3923,7 +3923,7 @@ return main;`)(...c), y = (f == null ? void 0 : f.componentDefinition) ?? f;
|
|
|
3923
3923
|
* @returns The updated item.
|
|
3924
3924
|
*/
|
|
3925
3925
|
async updateItem(t, e) {
|
|
3926
|
-
return await a(this,
|
|
3926
|
+
return await a(this, l, y).call(this, "PUT", `${m}/${t}`, {
|
|
3927
3927
|
body: JSON.stringify(e),
|
|
3928
3928
|
contentType: "application/json"
|
|
3929
3929
|
});
|
|
@@ -3938,9 +3938,9 @@ return main;`)(...c), y = (f == null ? void 0 : f.componentDefinition) ?? f;
|
|
|
3938
3938
|
* @param metadata - Optional free-JSON metadata to store on the new version.
|
|
3939
3939
|
* @returns The created version.
|
|
3940
3940
|
*/
|
|
3941
|
-
async createVersion(t, e, s,
|
|
3941
|
+
async createVersion(t, e, s, n, i) {
|
|
3942
3942
|
const o = new FormData();
|
|
3943
|
-
return o.append("file", e), o.append("versionTag", s),
|
|
3943
|
+
return o.append("file", e), o.append("versionTag", s), n && o.append("extraProps", JSON.stringify(n)), i && o.append("metadata", JSON.stringify(i)), await a(this, l, y).call(this, "POST", `${m}/${t}/version`, { body: o });
|
|
3944
3944
|
}
|
|
3945
3945
|
/**
|
|
3946
3946
|
* Lists versions of an item. Pass `archived: true` to fetch only archived
|
|
@@ -3950,7 +3950,7 @@ return main;`)(...c), y = (f == null ? void 0 : f.componentDefinition) ?? f;
|
|
|
3950
3950
|
* @returns Array of versions, sorted by creation date descending.
|
|
3951
3951
|
*/
|
|
3952
3952
|
async listVersions(t, e = {}) {
|
|
3953
|
-
return await a(this,
|
|
3953
|
+
return await a(this, l, y).call(this, "GET", `${m}/${encodeURIComponent(t)}/versions`, { query: e });
|
|
3954
3954
|
}
|
|
3955
3955
|
/**
|
|
3956
3956
|
* Batch variant of {@link listVersions}. Lists the versions of many items in
|
|
@@ -3969,9 +3969,9 @@ return main;`)(...c), y = (f == null ? void 0 : f.componentDefinition) ?? f;
|
|
|
3969
3969
|
*/
|
|
3970
3970
|
async listVersionsBatch(t, e = {}) {
|
|
3971
3971
|
const { archived: s } = e;
|
|
3972
|
-
return await a(this,
|
|
3972
|
+
return await a(this, l, gt).call(this, t, async (n) => (await a(this, l, y).call(this, "POST", `${m}/batch/versions`, {
|
|
3973
3973
|
body: JSON.stringify({
|
|
3974
|
-
itemIds:
|
|
3974
|
+
itemIds: n,
|
|
3975
3975
|
...s !== void 0 && { archived: s }
|
|
3976
3976
|
}),
|
|
3977
3977
|
contentType: "application/json"
|
|
@@ -3987,7 +3987,7 @@ return main;`)(...c), y = (f == null ? void 0 : f.componentDefinition) ?? f;
|
|
|
3987
3987
|
* @returns The archived version.
|
|
3988
3988
|
*/
|
|
3989
3989
|
async archiveVersion(t, e) {
|
|
3990
|
-
return await a(this,
|
|
3990
|
+
return await a(this, l, y).call(this, "PUT", `${m}/${encodeURIComponent(t)}/version/${encodeURIComponent(e)}/archive`);
|
|
3991
3991
|
}
|
|
3992
3992
|
/**
|
|
3993
3993
|
* Recovers a previously archived version, restoring it to the active list.
|
|
@@ -3996,7 +3996,7 @@ return main;`)(...c), y = (f == null ? void 0 : f.componentDefinition) ?? f;
|
|
|
3996
3996
|
* @returns The recovered version.
|
|
3997
3997
|
*/
|
|
3998
3998
|
async recoverVersion(t, e) {
|
|
3999
|
-
return await a(this,
|
|
3999
|
+
return await a(this, l, y).call(this, "PUT", `${m}/${encodeURIComponent(t)}/version/${encodeURIComponent(e)}/recover`);
|
|
4000
4000
|
}
|
|
4001
4001
|
/**
|
|
4002
4002
|
* Permanently deletes a version, including its file in object storage.
|
|
@@ -4005,59 +4005,59 @@ return main;`)(...c), y = (f == null ? void 0 : f.componentDefinition) ?? f;
|
|
|
4005
4005
|
* @param versionTag - The version's tag (e.g. "v2").
|
|
4006
4006
|
*/
|
|
4007
4007
|
async deleteVersion(t, e) {
|
|
4008
|
-
return await a(this,
|
|
4008
|
+
return await a(this, l, y).call(this, "DELETE", `${m}/${encodeURIComponent(t)}/version/${encodeURIComponent(e)}`);
|
|
4009
4009
|
}
|
|
4010
4010
|
};
|
|
4011
|
-
|
|
4011
|
+
l = new WeakSet(), le = function(t) {
|
|
4012
4012
|
return `${this.apiUrl}/${t}`;
|
|
4013
|
-
},
|
|
4014
|
-
const { body:
|
|
4015
|
-
...
|
|
4016
|
-
...this.useBearer ? {} : { accessToken:
|
|
4013
|
+
}, y = async function(t, e, s) {
|
|
4014
|
+
const { body: n, query: i, contentType: o, retries: c, responseType: d, retryAttempt: f } = s || {}, h = a(this, l, le).call(this, e), g = a(this, l, fs).call(this, i), S = await this.resolveAccessToken(), dt = {
|
|
4015
|
+
...g,
|
|
4016
|
+
...this.useBearer ? {} : { accessToken: S }
|
|
4017
4017
|
};
|
|
4018
4018
|
try {
|
|
4019
|
-
const
|
|
4020
|
-
|
|
4019
|
+
const O = await fetch(
|
|
4020
|
+
h + "?" + new URLSearchParams(dt).toString(),
|
|
4021
4021
|
{
|
|
4022
4022
|
method: t,
|
|
4023
4023
|
headers: {
|
|
4024
4024
|
Accept: "application/json",
|
|
4025
4025
|
...o && { "Content-Type": o },
|
|
4026
|
-
...this.useBearer && { Authorization: `Bearer ${
|
|
4026
|
+
...this.useBearer && { Authorization: `Bearer ${S}` }
|
|
4027
4027
|
},
|
|
4028
|
-
...
|
|
4028
|
+
...n && { body: n }
|
|
4029
4029
|
}
|
|
4030
4030
|
);
|
|
4031
|
-
if (!
|
|
4032
|
-
const
|
|
4033
|
-
throw new
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4031
|
+
if (!O.ok) {
|
|
4032
|
+
const k = await O.text().then((Z) => Z).catch(() => "");
|
|
4033
|
+
throw new Te(
|
|
4034
|
+
O.status,
|
|
4035
|
+
O.statusText,
|
|
4036
|
+
k,
|
|
4037
|
+
tn(O)
|
|
4038
4038
|
);
|
|
4039
4039
|
}
|
|
4040
|
-
return
|
|
4040
|
+
return d === "blob" ? await O.blob() : O.json().then((k) => k).catch(() => {
|
|
4041
4041
|
});
|
|
4042
|
-
} catch (
|
|
4043
|
-
const
|
|
4044
|
-
if (
|
|
4045
|
-
const
|
|
4046
|
-
return await
|
|
4042
|
+
} catch (O) {
|
|
4043
|
+
const k = c ?? this.retries;
|
|
4044
|
+
if (k > 0 && en(O)) {
|
|
4045
|
+
const Z = f ?? 0;
|
|
4046
|
+
return await Zr(sn(O, Z)), await a(this, l, y).call(this, t, e, {
|
|
4047
4047
|
...s,
|
|
4048
|
-
retries:
|
|
4049
|
-
retryAttempt:
|
|
4048
|
+
retries: k - 1,
|
|
4049
|
+
retryAttempt: Z + 1
|
|
4050
4050
|
});
|
|
4051
4051
|
}
|
|
4052
|
-
throw
|
|
4052
|
+
throw O;
|
|
4053
4053
|
}
|
|
4054
|
-
},
|
|
4055
|
-
const { query: s } = e || {},
|
|
4054
|
+
}, H = async function(t, e) {
|
|
4055
|
+
const { query: s } = e || {}, n = a(this, l, le).call(this, t), i = await this.resolveAccessToken(), o = {
|
|
4056
4056
|
...s,
|
|
4057
4057
|
...this.useBearer ? {} : { accessToken: i }
|
|
4058
4058
|
};
|
|
4059
4059
|
return await fetch(
|
|
4060
|
-
|
|
4060
|
+
n + "?" + new URLSearchParams(o).toString(),
|
|
4061
4061
|
{
|
|
4062
4062
|
method: "GET",
|
|
4063
4063
|
...this.useBearer && {
|
|
@@ -4065,146 +4065,146 @@ h = new WeakSet(), ie = function(t) {
|
|
|
4065
4065
|
}
|
|
4066
4066
|
}
|
|
4067
4067
|
);
|
|
4068
|
-
},
|
|
4068
|
+
}, vt = new WeakMap(), gt = async function(t, e) {
|
|
4069
4069
|
if (!t.length) return [];
|
|
4070
4070
|
const s = [];
|
|
4071
|
-
for (let i = 0; i < t.length; i +=
|
|
4072
|
-
s.push(t.slice(i, i +
|
|
4071
|
+
for (let i = 0; i < t.length; i += Me)
|
|
4072
|
+
s.push(t.slice(i, i + Me));
|
|
4073
4073
|
return (await Promise.all(s.map(e))).flat();
|
|
4074
|
-
},
|
|
4075
|
-
const { versionTag: s, withDraft:
|
|
4076
|
-
return await a(this,
|
|
4074
|
+
}, Nt = async function(t, e) {
|
|
4075
|
+
const { versionTag: s, withDraft: n } = e || {};
|
|
4076
|
+
return await a(this, l, H).call(this, `${m}/${t}/download`, {
|
|
4077
4077
|
query: {
|
|
4078
4078
|
...s && { versionTag: s },
|
|
4079
|
-
...
|
|
4079
|
+
...n && { withDraft: n }
|
|
4080
4080
|
}
|
|
4081
4081
|
});
|
|
4082
|
-
},
|
|
4083
|
-
const { name:
|
|
4084
|
-
return
|
|
4085
|
-
body:
|
|
4082
|
+
}, Pt = async function(t, e, s) {
|
|
4083
|
+
const { name: n, versionTag: i, parentFolderId: o, projectId: c, file: d, metadata: f } = t, h = new FormData();
|
|
4084
|
+
return h.append("file", d), h.append("name", n), h.append("versionTag", i), h.append("itemType", e), o && h.append("folderId", o), c && h.append("projectId", c), s && h.append("extraProps", JSON.stringify(s)), f && h.append("metadata", JSON.stringify(f)), await a(this, l, y).call(this, "POST", m, {
|
|
4085
|
+
body: h
|
|
4086
4086
|
});
|
|
4087
|
-
},
|
|
4088
|
-
const { name:
|
|
4089
|
-
let f,
|
|
4087
|
+
}, ue = async function(t, e, s) {
|
|
4088
|
+
const { name: n, versionTag: i, parentFolderId: o, file: c, metadata: d } = e;
|
|
4089
|
+
let f, h;
|
|
4090
4090
|
if (c) {
|
|
4091
|
-
const
|
|
4092
|
-
|
|
4093
|
-
body:
|
|
4091
|
+
const g = new FormData();
|
|
4092
|
+
g.append("file", c), i && g.append("versionTag", i), s && g.append("extraProps", JSON.stringify(s)), d && g.append("metadata", JSON.stringify(d)), h = await a(this, l, y).call(this, "POST", `${m}/${t}/version`, {
|
|
4093
|
+
body: g
|
|
4094
4094
|
});
|
|
4095
4095
|
}
|
|
4096
|
-
if (
|
|
4097
|
-
const
|
|
4098
|
-
...
|
|
4096
|
+
if (n || o) {
|
|
4097
|
+
const g = {
|
|
4098
|
+
...n && { name: n },
|
|
4099
4099
|
...o && { folderId: o }
|
|
4100
|
-
},
|
|
4101
|
-
f = await a(this,
|
|
4102
|
-
body:
|
|
4100
|
+
}, S = JSON.stringify(g);
|
|
4101
|
+
f = await a(this, l, y).call(this, "PUT", `${m}/${t}`, {
|
|
4102
|
+
body: S,
|
|
4103
4103
|
contentType: "application/json"
|
|
4104
4104
|
});
|
|
4105
4105
|
}
|
|
4106
|
-
return { item: f, version:
|
|
4107
|
-
},
|
|
4106
|
+
return { item: f, version: h };
|
|
4107
|
+
}, de = async function(t, e) {
|
|
4108
4108
|
const { showVersions: s = !1 } = e || {};
|
|
4109
|
-
return await a(this,
|
|
4109
|
+
return await a(this, l, y).call(this, "GET", `${m}/${t}`, {
|
|
4110
4110
|
query: { showVersions: s }
|
|
4111
4111
|
});
|
|
4112
|
-
},
|
|
4112
|
+
}, fs = function(t) {
|
|
4113
4113
|
return t && Object.entries(t).filter(([, e]) => e !== void 0).reduce(
|
|
4114
|
-
(e, [s,
|
|
4114
|
+
(e, [s, n]) => (e[s] = n, e),
|
|
4115
4115
|
{}
|
|
4116
4116
|
);
|
|
4117
4117
|
};
|
|
4118
|
-
let
|
|
4119
|
-
function
|
|
4118
|
+
let he = Se;
|
|
4119
|
+
function rn() {
|
|
4120
4120
|
if (typeof window > "u" || window.parent === window)
|
|
4121
4121
|
throw new Error(
|
|
4122
4122
|
"client.channel only works inside a That Open app, which runs in an iframe of the platform."
|
|
4123
4123
|
);
|
|
4124
4124
|
return {
|
|
4125
|
-
post: (
|
|
4126
|
-
listen: (
|
|
4125
|
+
post: (r) => window.parent.postMessage(r, "*"),
|
|
4126
|
+
listen: (r) => {
|
|
4127
4127
|
const t = (e) => {
|
|
4128
|
-
e.source === window.parent &&
|
|
4128
|
+
e.source === window.parent && r(e.data);
|
|
4129
4129
|
};
|
|
4130
4130
|
return window.addEventListener("message", t), () => window.removeEventListener("message", t);
|
|
4131
4131
|
}
|
|
4132
4132
|
};
|
|
4133
4133
|
}
|
|
4134
|
-
const
|
|
4135
|
-
function
|
|
4134
|
+
const fe = "channel:", nn = 1e4;
|
|
4135
|
+
function Bt(r) {
|
|
4136
4136
|
try {
|
|
4137
|
-
|
|
4137
|
+
r();
|
|
4138
4138
|
} catch (t) {
|
|
4139
4139
|
console.error("[channel] a listener threw:", t);
|
|
4140
4140
|
}
|
|
4141
4141
|
}
|
|
4142
|
-
var
|
|
4143
|
-
class
|
|
4142
|
+
var j, C, x, ot, at, ct, A, pe, ye, it;
|
|
4143
|
+
class ps {
|
|
4144
4144
|
constructor(t, e) {
|
|
4145
|
-
b(this,
|
|
4146
|
-
b(this,
|
|
4147
|
-
b(this,
|
|
4148
|
-
b(this,
|
|
4149
|
-
b(this,
|
|
4150
|
-
b(this,
|
|
4151
|
-
b(this,
|
|
4145
|
+
b(this, A);
|
|
4146
|
+
b(this, j, !1);
|
|
4147
|
+
b(this, C, []);
|
|
4148
|
+
b(this, x, []);
|
|
4149
|
+
b(this, ot, /* @__PURE__ */ new Set());
|
|
4150
|
+
b(this, at, /* @__PURE__ */ new Set());
|
|
4151
|
+
b(this, ct, /* @__PURE__ */ new Set());
|
|
4152
4152
|
this.transport = t, this.controls = e;
|
|
4153
4153
|
}
|
|
4154
4154
|
/** Whether the platform has confirmed this tab is in the room. */
|
|
4155
4155
|
get joined() {
|
|
4156
|
-
return
|
|
4156
|
+
return u(this, j);
|
|
4157
4157
|
}
|
|
4158
4158
|
/** Who else is in the room right now, as the platform last reported. */
|
|
4159
4159
|
get peers() {
|
|
4160
|
-
return
|
|
4160
|
+
return u(this, C);
|
|
4161
4161
|
}
|
|
4162
4162
|
/**
|
|
4163
4163
|
* Enters the room. Resolves when the platform confirms; rejects if it
|
|
4164
4164
|
* refuses or does not answer in time. Joining twice is harmless.
|
|
4165
4165
|
*/
|
|
4166
4166
|
join() {
|
|
4167
|
-
return
|
|
4167
|
+
return u(this, j) ? Promise.resolve() : a(this, A, pe).call(this, "joined", this.controls.join);
|
|
4168
4168
|
}
|
|
4169
4169
|
/** Leaves the room. Handlers stay registered, so `join()` resumes them. */
|
|
4170
4170
|
leave() {
|
|
4171
|
-
return !
|
|
4171
|
+
return !u(this, j) && !u(this, x).some((t) => t.want === "joined") ? Promise.resolve() : a(this, A, pe).call(this, "left", this.controls.leave);
|
|
4172
4172
|
}
|
|
4173
4173
|
/** Fires when `joined` or `peers` changes. Returns a function that stops it. */
|
|
4174
4174
|
onChange(t) {
|
|
4175
|
-
return
|
|
4175
|
+
return u(this, ot).add(t), () => void u(this, ot).delete(t);
|
|
4176
4176
|
}
|
|
4177
4177
|
onPeerJoined(t) {
|
|
4178
|
-
return
|
|
4178
|
+
return u(this, at).add(t), () => void u(this, at).delete(t);
|
|
4179
4179
|
}
|
|
4180
4180
|
onPeerLeft(t) {
|
|
4181
|
-
return
|
|
4181
|
+
return u(this, ct).add(t), () => void u(this, ct).delete(t);
|
|
4182
4182
|
}
|
|
4183
4183
|
/** @internal */
|
|
4184
4184
|
applyJoined() {
|
|
4185
|
-
_(this,
|
|
4185
|
+
_(this, j, !0), a(this, A, ye).call(this, "joined"), a(this, A, it).call(this);
|
|
4186
4186
|
}
|
|
4187
4187
|
/** @internal */
|
|
4188
4188
|
applyLeft() {
|
|
4189
|
-
_(this,
|
|
4189
|
+
_(this, j, !1), _(this, C, []), a(this, A, ye).call(this, "left"), a(this, A, it).call(this);
|
|
4190
4190
|
}
|
|
4191
4191
|
/** @internal */
|
|
4192
4192
|
applyPeers(t) {
|
|
4193
|
-
_(this,
|
|
4193
|
+
_(this, C, t), a(this, A, it).call(this);
|
|
4194
4194
|
}
|
|
4195
4195
|
/** @internal */
|
|
4196
4196
|
applyPeerJoined(t) {
|
|
4197
|
-
!
|
|
4197
|
+
!u(this, j) || u(this, C).some((e) => e.from === t.from) || (_(this, C, [...u(this, C), t]), u(this, at).forEach((e) => Bt(() => e(t))), a(this, A, it).call(this));
|
|
4198
4198
|
}
|
|
4199
4199
|
/** @internal */
|
|
4200
4200
|
applyPeerLeft(t) {
|
|
4201
|
-
const e =
|
|
4202
|
-
e && (_(this,
|
|
4201
|
+
const e = u(this, C).find((s) => s.from === t);
|
|
4202
|
+
e && (_(this, C, u(this, C).filter((s) => s.from !== t)), u(this, ct).forEach((s) => Bt(() => s(e))), a(this, A, it).call(this));
|
|
4203
4203
|
}
|
|
4204
4204
|
/** @internal */
|
|
4205
4205
|
failPending(t) {
|
|
4206
|
-
const e =
|
|
4207
|
-
return _(this,
|
|
4206
|
+
const e = u(this, x);
|
|
4207
|
+
return _(this, x, []), e.forEach((s) => {
|
|
4208
4208
|
clearTimeout(s.timer), s.reject(t);
|
|
4209
4209
|
}), e.length > 0;
|
|
4210
4210
|
}
|
|
@@ -4212,77 +4212,77 @@ class ss {
|
|
|
4212
4212
|
this.transport.post(t);
|
|
4213
4213
|
}
|
|
4214
4214
|
}
|
|
4215
|
-
|
|
4216
|
-
return new Promise((s,
|
|
4215
|
+
j = new WeakMap(), C = new WeakMap(), x = new WeakMap(), ot = new WeakMap(), at = new WeakMap(), ct = new WeakMap(), A = new WeakSet(), pe = function(t, e) {
|
|
4216
|
+
return new Promise((s, n) => {
|
|
4217
4217
|
const i = {
|
|
4218
4218
|
want: t,
|
|
4219
4219
|
resolve: s,
|
|
4220
|
-
reject:
|
|
4220
|
+
reject: n,
|
|
4221
4221
|
timer: setTimeout(() => {
|
|
4222
|
-
_(this,
|
|
4222
|
+
_(this, x, u(this, x).filter((o) => o !== i)), n(
|
|
4223
4223
|
new Error(
|
|
4224
4224
|
`The platform did not confirm ${t === "joined" ? "joining" : "leaving"} in time.`
|
|
4225
4225
|
)
|
|
4226
4226
|
);
|
|
4227
|
-
},
|
|
4227
|
+
}, nn)
|
|
4228
4228
|
};
|
|
4229
|
-
|
|
4229
|
+
u(this, x).push(i), this.transport.post({ type: "APP_CHANNEL_CONTROL", ...e });
|
|
4230
4230
|
});
|
|
4231
|
-
},
|
|
4232
|
-
const e =
|
|
4233
|
-
_(this,
|
|
4231
|
+
}, ye = function(t) {
|
|
4232
|
+
const e = u(this, x).filter((s) => s.want === t);
|
|
4233
|
+
_(this, x, u(this, x).filter((s) => s.want !== t)), e.forEach((s) => {
|
|
4234
4234
|
clearTimeout(s.timer), s.resolve();
|
|
4235
4235
|
});
|
|
4236
|
-
},
|
|
4237
|
-
|
|
4236
|
+
}, it = function() {
|
|
4237
|
+
u(this, ot).forEach((t) => Bt(t));
|
|
4238
4238
|
};
|
|
4239
|
-
var
|
|
4240
|
-
class
|
|
4239
|
+
var ht;
|
|
4240
|
+
class on extends ps {
|
|
4241
4241
|
/** @internal Use `client.channel.collab()`. */
|
|
4242
4242
|
constructor(e) {
|
|
4243
4243
|
super(e, {
|
|
4244
4244
|
join: { action: "joinCollab" },
|
|
4245
4245
|
leave: { action: "leaveCollab" }
|
|
4246
4246
|
});
|
|
4247
|
-
b(this,
|
|
4247
|
+
b(this, ht, /* @__PURE__ */ new Map());
|
|
4248
4248
|
}
|
|
4249
4249
|
/**
|
|
4250
4250
|
* Listens for an event other tabs send. Any number of listeners per event.
|
|
4251
4251
|
* @returns a function that removes the listener.
|
|
4252
4252
|
*/
|
|
4253
4253
|
on(e, s) {
|
|
4254
|
-
const
|
|
4255
|
-
return
|
|
4254
|
+
const n = u(this, ht).get(e) ?? /* @__PURE__ */ new Set();
|
|
4255
|
+
return n.add(s), u(this, ht).set(e, n), () => void n.delete(s);
|
|
4256
4256
|
}
|
|
4257
4257
|
/**
|
|
4258
4258
|
* Sends an event to the other tabs in the room. Does nothing while this tab
|
|
4259
4259
|
* is not in it, matching what the platform does with a message from outside.
|
|
4260
4260
|
*/
|
|
4261
4261
|
send(e, s) {
|
|
4262
|
-
if (e.startsWith(
|
|
4263
|
-
throw new Error(`Message types starting with '${
|
|
4262
|
+
if (e.startsWith(fe))
|
|
4263
|
+
throw new Error(`Message types starting with '${fe}' are reserved.`);
|
|
4264
4264
|
this.joined && this.post({ type: "APP_CHANNEL_PUBLISH", message: { type: e, payload: s } });
|
|
4265
4265
|
}
|
|
4266
4266
|
accepts(e) {
|
|
4267
4267
|
return e === void 0 || e === "collab";
|
|
4268
4268
|
}
|
|
4269
4269
|
async handle(e) {
|
|
4270
|
-
const s =
|
|
4270
|
+
const s = u(this, ht).get(e.type);
|
|
4271
4271
|
if (!(s != null && s.size)) return { handled: !1 };
|
|
4272
|
-
const
|
|
4273
|
-
return s.forEach((i) =>
|
|
4272
|
+
const n = ys(e);
|
|
4273
|
+
return s.forEach((i) => Bt(() => i(e.payload, n))), { handled: !0 };
|
|
4274
4274
|
}
|
|
4275
4275
|
}
|
|
4276
|
-
|
|
4277
|
-
var
|
|
4278
|
-
class
|
|
4276
|
+
ht = new WeakMap();
|
|
4277
|
+
var Y;
|
|
4278
|
+
class an extends ps {
|
|
4279
4279
|
/** @internal Use `client.channel.external(kind)`. */
|
|
4280
4280
|
constructor(e, s) {
|
|
4281
4281
|
super(e, {
|
|
4282
4282
|
join: { action: "joinExternal", kind: s },
|
|
4283
4283
|
leave: { action: "leaveExternal", kind: s }
|
|
4284
4284
|
});
|
|
4285
|
-
b(this,
|
|
4285
|
+
b(this, Y, /* @__PURE__ */ new Map());
|
|
4286
4286
|
this.kind = s;
|
|
4287
4287
|
}
|
|
4288
4288
|
/**
|
|
@@ -4296,43 +4296,43 @@ class Tn extends ss {
|
|
|
4296
4296
|
* @returns a function that removes the handler.
|
|
4297
4297
|
*/
|
|
4298
4298
|
on(e, s) {
|
|
4299
|
-
if (
|
|
4299
|
+
if (u(this, Y).has(e))
|
|
4300
4300
|
throw new Error(
|
|
4301
4301
|
`"${e}" already has a handler in this room. Remove it first.`
|
|
4302
4302
|
);
|
|
4303
|
-
return
|
|
4303
|
+
return u(this, Y).set(e, s), () => void u(this, Y).delete(e);
|
|
4304
4304
|
}
|
|
4305
4305
|
accepts(e, s) {
|
|
4306
4306
|
return e !== void 0 && e !== "external" ? !1 : this.kind === void 0 || e === void 0 || this.kind === s;
|
|
4307
4307
|
}
|
|
4308
4308
|
/** @internal Whether this room has any handler at all. */
|
|
4309
4309
|
get hasHandlers() {
|
|
4310
|
-
return
|
|
4310
|
+
return u(this, Y).size > 0;
|
|
4311
4311
|
}
|
|
4312
4312
|
async handle(e) {
|
|
4313
|
-
const s =
|
|
4313
|
+
const s = u(this, Y).get(e.type);
|
|
4314
4314
|
if (!s) return { handled: !1 };
|
|
4315
4315
|
try {
|
|
4316
|
-
return { handled: !0, value: await s(e.payload,
|
|
4317
|
-
} catch (
|
|
4316
|
+
return { handled: !0, value: await s(e.payload, ys(e)) };
|
|
4317
|
+
} catch (n) {
|
|
4318
4318
|
return {
|
|
4319
4319
|
handled: !0,
|
|
4320
|
-
error:
|
|
4320
|
+
error: n instanceof Error ? n.message : String(n)
|
|
4321
4321
|
};
|
|
4322
4322
|
}
|
|
4323
4323
|
}
|
|
4324
4324
|
}
|
|
4325
|
-
|
|
4326
|
-
function
|
|
4325
|
+
Y = new WeakMap();
|
|
4326
|
+
function ys(r) {
|
|
4327
4327
|
return {
|
|
4328
|
-
from:
|
|
4329
|
-
at:
|
|
4330
|
-
requestId:
|
|
4331
|
-
kind:
|
|
4328
|
+
from: r.from,
|
|
4329
|
+
at: r.at,
|
|
4330
|
+
requestId: r.requestId,
|
|
4331
|
+
kind: r.kind
|
|
4332
4332
|
};
|
|
4333
4333
|
}
|
|
4334
|
-
function
|
|
4335
|
-
const t =
|
|
4334
|
+
function cn(r) {
|
|
4335
|
+
const t = r;
|
|
4336
4336
|
if ((t == null ? void 0 : t.type) !== "THATOPEN_CHANNEL_MESSAGE") return null;
|
|
4337
4337
|
const e = t.message;
|
|
4338
4338
|
return !e || typeof e.type != "string" ? null : {
|
|
@@ -4345,20 +4345,20 @@ function Sn(n) {
|
|
|
4345
4345
|
kind: typeof e.kind == "string" ? e.kind : void 0
|
|
4346
4346
|
};
|
|
4347
4347
|
}
|
|
4348
|
-
var
|
|
4349
|
-
class
|
|
4348
|
+
var Q, Tt, M, W, K, v, me, Lt, ms, gs, ws, ge;
|
|
4349
|
+
class hn {
|
|
4350
4350
|
constructor(t) {
|
|
4351
|
-
b(this,
|
|
4352
|
-
b(this,
|
|
4353
|
-
b(this,
|
|
4354
|
-
b(this,
|
|
4355
|
-
b(this,
|
|
4356
|
-
b(this,
|
|
4357
|
-
_(this,
|
|
4351
|
+
b(this, v);
|
|
4352
|
+
b(this, Q);
|
|
4353
|
+
b(this, Tt);
|
|
4354
|
+
b(this, M);
|
|
4355
|
+
b(this, W, /* @__PURE__ */ new Map());
|
|
4356
|
+
b(this, K, /* @__PURE__ */ new Set());
|
|
4357
|
+
_(this, Q, t), _(this, Tt, t.listen((e) => void a(this, v, ms).call(this, e)));
|
|
4358
4358
|
}
|
|
4359
4359
|
/** The collaboration room for this app. Always the same instance. */
|
|
4360
4360
|
collab() {
|
|
4361
|
-
return
|
|
4361
|
+
return u(this, M) ?? _(this, M, new on(u(this, Q))), u(this, M);
|
|
4362
4362
|
}
|
|
4363
4363
|
/**
|
|
4364
4364
|
* The room for commands from this account's external tools of one `kind`
|
|
@@ -4367,46 +4367,46 @@ class kn {
|
|
|
4367
4367
|
*/
|
|
4368
4368
|
external(t) {
|
|
4369
4369
|
const e = t ?? "";
|
|
4370
|
-
let s =
|
|
4371
|
-
return s || (s = new
|
|
4370
|
+
let s = u(this, W).get(e);
|
|
4371
|
+
return s || (s = new an(u(this, Q), t), u(this, W).set(e, s)), s;
|
|
4372
4372
|
}
|
|
4373
4373
|
/** Stops listening. For tests and teardown; an app normally never calls it. */
|
|
4374
4374
|
dispose() {
|
|
4375
|
-
|
|
4375
|
+
u(this, Tt).call(this);
|
|
4376
4376
|
}
|
|
4377
4377
|
}
|
|
4378
|
-
|
|
4379
|
-
return [...
|
|
4380
|
-
},
|
|
4381
|
-
if (t === "collab") return
|
|
4378
|
+
Q = new WeakMap(), Tt = new WeakMap(), M = new WeakMap(), W = new WeakMap(), K = new WeakMap(), v = new WeakSet(), me = function() {
|
|
4379
|
+
return [...u(this, M) ? [u(this, M)] : [], ...u(this, W).values()];
|
|
4380
|
+
}, Lt = function(t, e) {
|
|
4381
|
+
if (t === "collab") return u(this, M);
|
|
4382
4382
|
if (t === "external")
|
|
4383
|
-
return
|
|
4384
|
-
},
|
|
4385
|
-
const e =
|
|
4383
|
+
return u(this, W).get(typeof e == "string" ? e : "");
|
|
4384
|
+
}, ms = async function(t) {
|
|
4385
|
+
const e = cn(t);
|
|
4386
4386
|
if (e) {
|
|
4387
|
-
if (e.type.startsWith(
|
|
4388
|
-
a(this,
|
|
4387
|
+
if (e.type.startsWith(fe)) {
|
|
4388
|
+
a(this, v, gs).call(this, e);
|
|
4389
4389
|
return;
|
|
4390
4390
|
}
|
|
4391
|
-
await a(this,
|
|
4391
|
+
await a(this, v, ws).call(this, e);
|
|
4392
4392
|
}
|
|
4393
|
-
},
|
|
4394
|
-
var s,
|
|
4393
|
+
}, gs = function(t) {
|
|
4394
|
+
var s, n, i;
|
|
4395
4395
|
const e = t.payload ?? {};
|
|
4396
4396
|
switch (t.type) {
|
|
4397
4397
|
case "channel:joined":
|
|
4398
|
-
(s = a(this,
|
|
4398
|
+
(s = a(this, v, Lt).call(this, e.scope, e.kind)) == null || s.applyJoined();
|
|
4399
4399
|
break;
|
|
4400
4400
|
case "channel:left":
|
|
4401
|
-
(
|
|
4401
|
+
(n = a(this, v, Lt).call(this, e.scope, e.kind)) == null || n.applyLeft();
|
|
4402
4402
|
break;
|
|
4403
4403
|
case "channel:peers":
|
|
4404
|
-
(i = a(this,
|
|
4404
|
+
(i = a(this, v, Lt).call(this, e.scope, e.kind)) == null || i.applyPeers(e.peers ?? []);
|
|
4405
4405
|
break;
|
|
4406
4406
|
case "channel:peer-joined":
|
|
4407
4407
|
case "channel:peer-left": {
|
|
4408
4408
|
if (!e.from) break;
|
|
4409
|
-
const o = e.scope === "collab" ? [
|
|
4409
|
+
const o = e.scope === "collab" ? [u(this, M)] : [...u(this, W).values()].filter(
|
|
4410
4410
|
(c) => c.accepts("external", e.kind)
|
|
4411
4411
|
);
|
|
4412
4412
|
for (const c of o)
|
|
@@ -4415,23 +4415,23 @@ K = new WeakMap(), bt = new WeakMap(), U = new WeakMap(), V = new WeakMap(), J =
|
|
|
4415
4415
|
}
|
|
4416
4416
|
case "channel:error": {
|
|
4417
4417
|
const o = new Error(String(t.payload));
|
|
4418
|
-
a(this,
|
|
4418
|
+
a(this, v, me).call(this).map((d) => d.failPending(o)).some(Boolean) || console.error("[channel] error:", t.payload);
|
|
4419
4419
|
break;
|
|
4420
4420
|
}
|
|
4421
4421
|
}
|
|
4422
|
-
},
|
|
4423
|
-
const e = a(this,
|
|
4422
|
+
}, ws = async function(t) {
|
|
4423
|
+
const e = a(this, v, me).call(this).filter((i) => i.accepts(t.scope, t.kind));
|
|
4424
4424
|
let s = !1;
|
|
4425
4425
|
for (const i of e) {
|
|
4426
4426
|
const o = await i.handle(t);
|
|
4427
|
-
o.handled && (s = !0, t.requestId && a(this,
|
|
4427
|
+
o.handled && (s = !0, t.requestId && a(this, v, ge).call(this, t.requestId, o));
|
|
4428
4428
|
}
|
|
4429
|
-
t.requestId && t.scope === "external" && e.length > 0 && !s && a(this,
|
|
4429
|
+
t.requestId && t.scope === "external" && e.length > 0 && !s && a(this, v, ge).call(this, t.requestId, {
|
|
4430
4430
|
handled: !0,
|
|
4431
4431
|
error: `No handler for "${t.type}".`
|
|
4432
4432
|
});
|
|
4433
|
-
},
|
|
4434
|
-
|
|
4433
|
+
}, ge = function(t, e) {
|
|
4434
|
+
u(this, K).has(t) || (u(this, K).add(t), u(this, K).size > 500 && u(this, K).delete(u(this, K).values().next().value), u(this, Q).post({
|
|
4435
4435
|
type: "APP_CHANNEL_PUBLISH",
|
|
4436
4436
|
message: {
|
|
4437
4437
|
type: e.error === void 0 ? "reply" : "reply-error",
|
|
@@ -4440,9 +4440,9 @@ K = new WeakMap(), bt = new WeakMap(), U = new WeakMap(), V = new WeakMap(), J =
|
|
|
4440
4440
|
}
|
|
4441
4441
|
}));
|
|
4442
4442
|
};
|
|
4443
|
-
const
|
|
4444
|
-
var
|
|
4445
|
-
const
|
|
4443
|
+
const X = "project", tt = "notifications";
|
|
4444
|
+
var lt, St;
|
|
4445
|
+
const Ie = class Ie extends he {
|
|
4446
4446
|
/**
|
|
4447
4447
|
* @param token - A bearer JWT, OR a function returning the current JWT
|
|
4448
4448
|
* (sync or async). When a function is passed, it's invoked before every
|
|
@@ -4451,14 +4451,14 @@ const _e = class _e extends re {
|
|
|
4451
4451
|
* @param props - Optional client configuration. `useBearer` is forced to
|
|
4452
4452
|
* `true` and cannot be overridden.
|
|
4453
4453
|
*/
|
|
4454
|
-
constructor(e, s,
|
|
4455
|
-
super(typeof e == "string" ? e : "", s, { ...
|
|
4456
|
-
b(this,
|
|
4457
|
-
b(this,
|
|
4458
|
-
typeof e == "function" && _(this,
|
|
4454
|
+
constructor(e, s, n) {
|
|
4455
|
+
super(typeof e == "string" ? e : "", s, { ...n, useBearer: !0 });
|
|
4456
|
+
b(this, lt);
|
|
4457
|
+
b(this, St);
|
|
4458
|
+
typeof e == "function" && _(this, lt, e);
|
|
4459
4459
|
}
|
|
4460
4460
|
async resolveAccessToken() {
|
|
4461
|
-
return
|
|
4461
|
+
return u(this, lt) ? await u(this, lt).call(this) : super.resolveAccessToken();
|
|
4462
4462
|
}
|
|
4463
4463
|
/**
|
|
4464
4464
|
* Creates a client from the platform context injected into
|
|
@@ -4467,8 +4467,8 @@ const _e = class _e extends re {
|
|
|
4467
4467
|
* carries a fresh JWT on every navigation.
|
|
4468
4468
|
*/
|
|
4469
4469
|
static fromPlatformContext(e) {
|
|
4470
|
-
const s = (typeof window < "u" ? window.__THATOPEN_CONTEXT__ : null) || { appId: "", projectId: "", accessToken: "", apiUrl: "" },
|
|
4471
|
-
return
|
|
4470
|
+
const s = (typeof window < "u" ? window.__THATOPEN_CONTEXT__ : null) || { appId: "", projectId: "", accessToken: "", apiUrl: "" }, n = new Ie(s.accessToken, s.apiUrl, e);
|
|
4471
|
+
return n.context = s, n;
|
|
4472
4472
|
}
|
|
4473
4473
|
/**
|
|
4474
4474
|
* The platform channel, from inside an app: a collaboration room shared with
|
|
@@ -4495,7 +4495,7 @@ const _e = class _e extends re {
|
|
|
4495
4495
|
* ```
|
|
4496
4496
|
*/
|
|
4497
4497
|
get channel() {
|
|
4498
|
-
return
|
|
4498
|
+
return u(this, St) ?? _(this, St, new hn(rn())), u(this, St);
|
|
4499
4499
|
}
|
|
4500
4500
|
// ─── Projects (JWT-only backend routes) ──────────────────────────
|
|
4501
4501
|
/**
|
|
@@ -4514,14 +4514,14 @@ const _e = class _e extends re {
|
|
|
4514
4514
|
* ```
|
|
4515
4515
|
*/
|
|
4516
4516
|
async listProjects() {
|
|
4517
|
-
return await this.request("GET",
|
|
4517
|
+
return await this.request("GET", X);
|
|
4518
4518
|
}
|
|
4519
4519
|
/**
|
|
4520
4520
|
* Gets a project by ID. JWT-only — lives here because
|
|
4521
4521
|
* `GET /project/:id` is guarded by `AccountActiveGuard + ProjectAccessGuard`.
|
|
4522
4522
|
*/
|
|
4523
4523
|
async getProject(e) {
|
|
4524
|
-
return await this.request("GET", `${
|
|
4524
|
+
return await this.request("GET", `${X}/${e}`);
|
|
4525
4525
|
}
|
|
4526
4526
|
/**
|
|
4527
4527
|
* Gets the full project data (users, roles, files, folders) for a project.
|
|
@@ -4530,7 +4530,7 @@ const _e = class _e extends re {
|
|
|
4530
4530
|
async getProjectData(e) {
|
|
4531
4531
|
return await this.request(
|
|
4532
4532
|
"GET",
|
|
4533
|
-
`${
|
|
4533
|
+
`${X}/${e}/data`
|
|
4534
4534
|
);
|
|
4535
4535
|
}
|
|
4536
4536
|
// ─── Account ──────────────────────────────────────────────────────
|
|
@@ -4555,7 +4555,7 @@ const _e = class _e extends re {
|
|
|
4555
4555
|
async checkPermission(e) {
|
|
4556
4556
|
return await this.request(
|
|
4557
4557
|
"GET",
|
|
4558
|
-
`${
|
|
4558
|
+
`${X}/permissions/check`,
|
|
4559
4559
|
{ query: e }
|
|
4560
4560
|
);
|
|
4561
4561
|
}
|
|
@@ -4564,7 +4564,7 @@ const _e = class _e extends re {
|
|
|
4564
4564
|
* single round-trip; results come back in the same order as `checks`.
|
|
4565
4565
|
*/
|
|
4566
4566
|
async checkPermissionBatch(e) {
|
|
4567
|
-
return (await this.request("POST", `${
|
|
4567
|
+
return (await this.request("POST", `${X}/permissions/check/batch`, {
|
|
4568
4568
|
body: JSON.stringify({ checks: e }),
|
|
4569
4569
|
contentType: "application/json"
|
|
4570
4570
|
})).results;
|
|
@@ -4592,7 +4592,7 @@ const _e = class _e extends re {
|
|
|
4592
4592
|
* ```
|
|
4593
4593
|
*/
|
|
4594
4594
|
async getNotifications(e) {
|
|
4595
|
-
return await this.request("GET",
|
|
4595
|
+
return await this.request("GET", tt, {
|
|
4596
4596
|
query: {
|
|
4597
4597
|
...(e == null ? void 0 : e.cursor) !== void 0 && { cursor: e.cursor },
|
|
4598
4598
|
...(e == null ? void 0 : e.limit) !== void 0 && { limit: String(e.limit) }
|
|
@@ -4606,7 +4606,7 @@ const _e = class _e extends re {
|
|
|
4606
4606
|
async getUnreadNotificationCount() {
|
|
4607
4607
|
return (await this.request(
|
|
4608
4608
|
"GET",
|
|
4609
|
-
`${
|
|
4609
|
+
`${tt}/unread-count`
|
|
4610
4610
|
)).count;
|
|
4611
4611
|
}
|
|
4612
4612
|
/**
|
|
@@ -4617,7 +4617,7 @@ const _e = class _e extends re {
|
|
|
4617
4617
|
async markNotificationsRead(e) {
|
|
4618
4618
|
return await this.request(
|
|
4619
4619
|
"POST",
|
|
4620
|
-
`${
|
|
4620
|
+
`${tt}/mark-read`,
|
|
4621
4621
|
{
|
|
4622
4622
|
body: JSON.stringify({ ids: e }),
|
|
4623
4623
|
contentType: "application/json"
|
|
@@ -4628,7 +4628,7 @@ const _e = class _e extends re {
|
|
|
4628
4628
|
async markAllNotificationsRead() {
|
|
4629
4629
|
return await this.request(
|
|
4630
4630
|
"POST",
|
|
4631
|
-
`${
|
|
4631
|
+
`${tt}/mark-all-read`
|
|
4632
4632
|
);
|
|
4633
4633
|
}
|
|
4634
4634
|
/**
|
|
@@ -4638,7 +4638,7 @@ const _e = class _e extends re {
|
|
|
4638
4638
|
async getNotificationSubscriptions() {
|
|
4639
4639
|
return await this.request(
|
|
4640
4640
|
"GET",
|
|
4641
|
-
`${
|
|
4641
|
+
`${tt}/subscriptions`
|
|
4642
4642
|
);
|
|
4643
4643
|
}
|
|
4644
4644
|
/**
|
|
@@ -4652,7 +4652,7 @@ const _e = class _e extends re {
|
|
|
4652
4652
|
async unsubscribeFromAutomation(e) {
|
|
4653
4653
|
return await this.request(
|
|
4654
4654
|
"DELETE",
|
|
4655
|
-
`${
|
|
4655
|
+
`${tt}/subscriptions/${e}`
|
|
4656
4656
|
);
|
|
4657
4657
|
}
|
|
4658
4658
|
/**
|
|
@@ -4673,12 +4673,12 @@ const _e = class _e extends re {
|
|
|
4673
4673
|
* });
|
|
4674
4674
|
* ```
|
|
4675
4675
|
*/
|
|
4676
|
-
async subscribeToAutomation(e, s,
|
|
4676
|
+
async subscribeToAutomation(e, s, n) {
|
|
4677
4677
|
return await this.request(
|
|
4678
4678
|
"POST",
|
|
4679
|
-
`${
|
|
4679
|
+
`${X}/${e}/events/hooks/${s}/subscription`,
|
|
4680
4680
|
{
|
|
4681
|
-
body: JSON.stringify(
|
|
4681
|
+
body: JSON.stringify(n ?? {}),
|
|
4682
4682
|
contentType: "application/json"
|
|
4683
4683
|
}
|
|
4684
4684
|
);
|
|
@@ -4690,12 +4690,12 @@ const _e = class _e extends re {
|
|
|
4690
4690
|
* Throws if the user is not subscribed; use {@link subscribeToAutomation}
|
|
4691
4691
|
* to create one.
|
|
4692
4692
|
*/
|
|
4693
|
-
async updateAutomationSubscription(e, s,
|
|
4693
|
+
async updateAutomationSubscription(e, s, n) {
|
|
4694
4694
|
return await this.request(
|
|
4695
4695
|
"PATCH",
|
|
4696
|
-
`${
|
|
4696
|
+
`${X}/${e}/events/hooks/${s}/subscription`,
|
|
4697
4697
|
{
|
|
4698
|
-
body: JSON.stringify(
|
|
4698
|
+
body: JSON.stringify(n),
|
|
4699
4699
|
contentType: "application/json"
|
|
4700
4700
|
}
|
|
4701
4701
|
);
|
|
@@ -4727,57 +4727,246 @@ const _e = class _e extends re {
|
|
|
4727
4727
|
* ```
|
|
4728
4728
|
*/
|
|
4729
4729
|
async onNotification(e) {
|
|
4730
|
-
const s = await this.resolveAccessToken(),
|
|
4730
|
+
const s = await this.resolveAccessToken(), n = wt(`${this.socketOrigin}/notifications`, {
|
|
4731
4731
|
auth: { accessToken: s },
|
|
4732
4732
|
transports: ["websocket"]
|
|
4733
4733
|
});
|
|
4734
|
-
return
|
|
4734
|
+
return n.on(
|
|
4735
4735
|
"notification.created",
|
|
4736
4736
|
(i) => e({ type: "created", id: i == null ? void 0 : i.id })
|
|
4737
|
-
),
|
|
4737
|
+
), n.on(
|
|
4738
4738
|
"notification.read",
|
|
4739
4739
|
(i) => e({ type: "read", id: i == null ? void 0 : i.id })
|
|
4740
|
-
),
|
|
4740
|
+
), n.on(
|
|
4741
4741
|
"notifications.allRead",
|
|
4742
4742
|
(i) => e({ type: "allRead", batch: i == null ? void 0 : i.batch })
|
|
4743
|
-
), () =>
|
|
4743
|
+
), () => n.disconnect();
|
|
4744
4744
|
}
|
|
4745
4745
|
};
|
|
4746
|
-
|
|
4747
|
-
let
|
|
4748
|
-
const
|
|
4746
|
+
lt = new WeakMap(), St = new WeakMap();
|
|
4747
|
+
let Ge = Ie;
|
|
4748
|
+
const ln = "flow:", un = "flow:op", dn = "flow:source", fn = "revitflow/op@2", He = "REVITFLOWCHANGE", Je = "REVITFLOWOPERATION";
|
|
4749
|
+
class wn {
|
|
4750
|
+
constructor(t) {
|
|
4751
|
+
I(this, "changes", []);
|
|
4752
|
+
this.target = t;
|
|
4753
|
+
}
|
|
4754
|
+
/** How many changes are queued. An operation with none is refused by `build`. */
|
|
4755
|
+
get length() {
|
|
4756
|
+
return this.changes.length;
|
|
4757
|
+
}
|
|
4758
|
+
// The envelope, readable. Whoever writes the queue entry has to put the SAME
|
|
4759
|
+
// values in it as the payload carries — an entry that disagrees with its own
|
|
4760
|
+
// payload is a row describing a different operation — so they are exposed
|
|
4761
|
+
// here rather than passed twice by every caller.
|
|
4762
|
+
get batchId() {
|
|
4763
|
+
return this.target.batchId;
|
|
4764
|
+
}
|
|
4765
|
+
get title() {
|
|
4766
|
+
return this.target.title ?? `${this.changes.length} change(s)`;
|
|
4767
|
+
}
|
|
4768
|
+
get author() {
|
|
4769
|
+
return this.target.author ?? "app";
|
|
4770
|
+
}
|
|
4771
|
+
get userId() {
|
|
4772
|
+
return this.target.userId;
|
|
4773
|
+
}
|
|
4774
|
+
get baseCommit() {
|
|
4775
|
+
return this.target.baseCommit;
|
|
4776
|
+
}
|
|
4777
|
+
/**
|
|
4778
|
+
* Create something. There is no id yet: the attributes describe what it is,
|
|
4779
|
+
* the placement says where it goes, and the operation answers with the id
|
|
4780
|
+
* it got.
|
|
4781
|
+
*/
|
|
4782
|
+
add(t, e = {}) {
|
|
4783
|
+
return this.changes.push({ op: "add", attrs: this.pack(t, e) }), this;
|
|
4784
|
+
}
|
|
4785
|
+
/** Write attributes onto an item that already exists, named by the id the target published. */
|
|
4786
|
+
set(t, e, s = {}) {
|
|
4787
|
+
return this.requireId(t, "set"), this.changes.push({ op: "set", item: t, attrs: this.pack(e, s) }), this;
|
|
4788
|
+
}
|
|
4789
|
+
/** Delete an item. Whatever the target cascades along with it is reported, not guessed at here. */
|
|
4790
|
+
remove(t) {
|
|
4791
|
+
return this.requireId(t, "remove"), this.changes.push({ op: "remove", item: t, attrs: {} }), this;
|
|
4792
|
+
}
|
|
4793
|
+
/**
|
|
4794
|
+
* A label for what this operation mostly does. Derived, never read to
|
|
4795
|
+
* decide anything: one operation may add, set and remove at once and still
|
|
4796
|
+
* be atomic, so what each change does is written on the change.
|
|
4797
|
+
*/
|
|
4798
|
+
get summary() {
|
|
4799
|
+
const t = new Set(this.changes.map((e) => e.op));
|
|
4800
|
+
return t.size === 1 ? [...t][0] : "mixed";
|
|
4801
|
+
}
|
|
4802
|
+
/**
|
|
4803
|
+
* The .frag bytes, zlib-deflated, ready to upload as the operation's
|
|
4804
|
+
* payload.
|
|
4805
|
+
*
|
|
4806
|
+
* `opId` is taken rather than generated so the caller can put the same id
|
|
4807
|
+
* in the queue entry it writes next ({@link Recipes} mints it before the
|
|
4808
|
+
* run); an id this class invented and did not return would have to be dug
|
|
4809
|
+
* back out of the bytes.
|
|
4810
|
+
*/
|
|
4811
|
+
async build(t) {
|
|
4812
|
+
if (this.changes.length === 0)
|
|
4813
|
+
throw new Error(
|
|
4814
|
+
"An operation with no changes is not an operation. Add at least one."
|
|
4815
|
+
);
|
|
4816
|
+
const e = {
|
|
4817
|
+
schema: fn,
|
|
4818
|
+
opId: t,
|
|
4819
|
+
// Through the getters, so the envelope and the queue entry cannot drift
|
|
4820
|
+
// into disagreeing about the same operation.
|
|
4821
|
+
batchId: this.batchId ?? t,
|
|
4822
|
+
targetProject: this.target.project,
|
|
4823
|
+
targetDocument: this.target.document,
|
|
4824
|
+
baseCommit: this.baseCommit,
|
|
4825
|
+
author: this.author,
|
|
4826
|
+
...this.userId ? { userId: this.userId } : {},
|
|
4827
|
+
title: this.title,
|
|
4828
|
+
summary: this.summary
|
|
4829
|
+
}, [s, n] = await pn();
|
|
4830
|
+
return yn(
|
|
4831
|
+
this.flatbuffer(s, n, t, JSON.stringify(e))
|
|
4832
|
+
);
|
|
4833
|
+
}
|
|
4834
|
+
// ---------------------------------------------------------------------------------------------
|
|
4835
|
+
/** Placement rides in the attributes, in the same string form the target published. */
|
|
4836
|
+
pack(t, e) {
|
|
4837
|
+
const s = {};
|
|
4838
|
+
for (const [n, i] of Object.entries(t ?? {}))
|
|
4839
|
+
n.startsWith(ln) || (s[n] = String(i));
|
|
4840
|
+
return e.position && (s.Position = e.position.map(Ye).join(",")), e.rotationDeg !== void 0 && (s.Rotation = Ye(e.rotationDeg)), e.source && (s[dn] = e.source), s;
|
|
4841
|
+
}
|
|
4842
|
+
requireId(t, e) {
|
|
4843
|
+
if (!t || !t.trim())
|
|
4844
|
+
throw new Error(`A '${e}' has to name the item it acts on.`);
|
|
4845
|
+
}
|
|
4846
|
+
/**
|
|
4847
|
+
* The buffer itself.
|
|
4848
|
+
*
|
|
4849
|
+
* Laid out exactly as the C# writer lays it out, because the add-in's
|
|
4850
|
+
* reader is the one that has to accept both: items first and the container
|
|
4851
|
+
* after, ids handed out by one monotonic counter, attributes as
|
|
4852
|
+
* `[name, value, type]` JSON triples, and a Meshes table that exists but is
|
|
4853
|
+
* empty.
|
|
4854
|
+
*
|
|
4855
|
+
* Empty rather than absent: the reader asks for it unconditionally, and a
|
|
4856
|
+
* model that draws nothing is still a model. Nothing here gets a sample —
|
|
4857
|
+
* an item with no triangles must not have one, because a sample's bounding
|
|
4858
|
+
* box would then have no size and the reader turns a box into a "dimension"
|
|
4859
|
+
* and rejects a falsy one.
|
|
4860
|
+
*/
|
|
4861
|
+
flatbuffer(t, e, s, n) {
|
|
4862
|
+
const { Attribute: i, Meshes: o, Model: c, SpatialStructure: d, Transform: f } = e, h = new t.Builder(1024), g = this.changes.length, S = new Uint32Array(g);
|
|
4863
|
+
let dt = 1;
|
|
4864
|
+
for (let T = 0; T < g; T++) S[T] = dt++;
|
|
4865
|
+
const O = dt++, k = (T) => (T(h, 0), h.endVector()), Z = o.createShellsVector(h, []), bs = o.createCircleExtrusionsVector(h, []), _s = k(o.startSamplesVector), Es = k(o.startRepresentationsVector), vs = k(o.startMaterialsVector), Ts = k(o.startLocalTransformsVector), Ss = k(o.startGlobalTransformsVector), Is = o.createMeshesItemsVector(h, []), Os = o.createMaterialIdsVector(h, []), As = o.createRepresentationIdsVector(h, []), ks = o.createSampleIdsVector(h, []), Cs = o.createLocalTransformIdsVector(h, []), xs = o.createGlobalTransformIdsVector(h, []);
|
|
4866
|
+
o.startMeshes(h), o.addCoordinates(h, f.createTransform(h, 0, 0, 0, 1, 0, 0, 0, 1, 0)), o.addGlobalTransforms(h, Ss), o.addShells(h, Z), o.addRepresentations(h, Es), o.addSamples(h, _s), o.addLocalTransforms(h, Ts), o.addMaterials(h, vs), o.addCircleExtrusions(h, bs), o.addMeshesItems(h, Is), o.addRepresentationIds(h, As), o.addSampleIds(h, ks), o.addMaterialIds(h, Os), o.addLocalTransformIds(h, Cs), o.addGlobalTransformIds(h, xs);
|
|
4867
|
+
const Rs = o.endMeshes(h), $s = h.createString(n), Dt = /* @__PURE__ */ new Set(), Ut = [];
|
|
4868
|
+
for (const T of this.changes) {
|
|
4869
|
+
const V = [], Vs = {
|
|
4870
|
+
[un]: T.op,
|
|
4871
|
+
...T.attrs
|
|
4872
|
+
};
|
|
4873
|
+
for (const [Gs, Hs] of Object.entries(Vs)) {
|
|
4874
|
+
const Ce = JSON.stringify([Gs, Hs, "IFCTEXT"]);
|
|
4875
|
+
Dt.add(Ce), V.push(h.createString(Ce));
|
|
4876
|
+
}
|
|
4877
|
+
Ut.push(
|
|
4878
|
+
i.createAttribute(h, i.createDataVector(h, V))
|
|
4879
|
+
);
|
|
4880
|
+
}
|
|
4881
|
+
{
|
|
4882
|
+
const T = JSON.stringify(["Name", s, "IFCLABEL"]);
|
|
4883
|
+
Dt.add(T);
|
|
4884
|
+
const V = i.createDataVector(h, [h.createString(T)]);
|
|
4885
|
+
Ut.push(i.createAttribute(h, V));
|
|
4886
|
+
}
|
|
4887
|
+
const Ns = c.createAttributesVector(h, Ut), Ps = c.createUniqueAttributesVector(
|
|
4888
|
+
h,
|
|
4889
|
+
[...Dt].map((T) => h.createString(T))
|
|
4890
|
+
), Oe = this.changes.map(
|
|
4891
|
+
() => h.createString(He)
|
|
4892
|
+
);
|
|
4893
|
+
Oe.push(h.createString(Je));
|
|
4894
|
+
const Bs = c.createCategoriesVector(h, Oe), Ae = [], ke = [];
|
|
4895
|
+
this.changes.forEach((T, V) => {
|
|
4896
|
+
T.item && (Ae.push(h.createString(T.item)), ke.push(S[V]));
|
|
4897
|
+
});
|
|
4898
|
+
const Ls = c.createGuidsVector(h, Ae), Fs = c.createGuidsItemsVector(h, ke), qs = c.createLocalIdsVector(h, [...S, O]), Ds = this.changes.map(
|
|
4899
|
+
(T, V) => d.createSpatialStructure(
|
|
4900
|
+
h,
|
|
4901
|
+
S[V],
|
|
4902
|
+
h.createString(He),
|
|
4903
|
+
0
|
|
4904
|
+
)
|
|
4905
|
+
), Us = d.createSpatialStructure(
|
|
4906
|
+
h,
|
|
4907
|
+
O,
|
|
4908
|
+
h.createString(Je),
|
|
4909
|
+
d.createChildrenVector(h, Ds)
|
|
4910
|
+
), js = h.createString(s);
|
|
4911
|
+
c.startModel(h), c.addMeshes(h, Rs), c.addMetadata(h, $s), c.addAttributes(h, Ns), c.addUniqueAttributes(h, Ps), c.addLocalIds(h, qs), c.addCategories(h, Bs), c.addGuidsItems(h, Fs), c.addGuids(h, Ls), c.addGuid(h, js), c.addSpatialStructure(h, Us), c.addMaxLocalId(h, dt);
|
|
4912
|
+
const Ms = c.endModel(h);
|
|
4913
|
+
return c.finishModelBuffer(h, Ms), h.asUint8Array();
|
|
4914
|
+
}
|
|
4915
|
+
}
|
|
4916
|
+
async function pn() {
|
|
4917
|
+
try {
|
|
4918
|
+
return await Promise.all([
|
|
4919
|
+
import("flatbuffers"),
|
|
4920
|
+
import("@thatopen/fragments")
|
|
4921
|
+
]);
|
|
4922
|
+
} catch (r) {
|
|
4923
|
+
throw new Error(
|
|
4924
|
+
`OperationBuilder needs the optional peers \`flatbuffers\` and \`@thatopen/fragments\` installed — add them to the app that authors operations. (${r instanceof Error ? r.message : String(r)})`
|
|
4925
|
+
);
|
|
4926
|
+
}
|
|
4927
|
+
}
|
|
4928
|
+
function Ye(r) {
|
|
4929
|
+
return Number.isFinite(r) ? String(r) : "0";
|
|
4930
|
+
}
|
|
4931
|
+
async function yn(r) {
|
|
4932
|
+
const t = new Blob([r]).stream().pipeThrough(new CompressionStream("deflate"));
|
|
4933
|
+
return new Uint8Array(await new Response(t).arrayBuffer());
|
|
4934
|
+
}
|
|
4935
|
+
const bn = {
|
|
4749
4936
|
MAX_FIELDS: 200,
|
|
4750
4937
|
MAX_KEY_LENGTH: 50,
|
|
4751
4938
|
MAX_VALUE_LENGTH: 50
|
|
4752
|
-
},
|
|
4939
|
+
}, _n = { uuid: "a3f82c1d-5b74-4e9a-bc30-d7e12f894a61" }, En = { uuid: "2c9f4e8d-3a1b-4c5e-9d7f-0a2b6c8e1d3f" }, vn = { uuid: "b0b5e2a2-0b3a-4a6b-8b1c-0b1c4a6b8b1c" }, Tn = { uuid: "d8f3a1c2-6b4e-4f9a-8c1d-2e7b5a9f3c60" }, Sn = { uuid: "3f9c1a7e-6b2d-4e18-9a5c-7d0e2f4b6c81" }, In = { uuid: "2c4ae432-fc24-43e9-9783-0c960c674e96" }, On = { uuid: "6f3a9c2e-8b1d-4e6a-9c3f-1d7b5a8e2c4f" }, An = { uuid: "69af63aa-19ba-4fc7-b17b-75647bac1d76" }, kn = { uuid: "234f1416-528d-452a-9cc9-a16c5239b2eb" };
|
|
4753
4940
|
export {
|
|
4754
|
-
|
|
4755
|
-
|
|
4756
|
-
|
|
4757
|
-
|
|
4758
|
-
|
|
4759
|
-
|
|
4760
|
-
|
|
4761
|
-
|
|
4762
|
-
|
|
4763
|
-
|
|
4764
|
-
|
|
4765
|
-
|
|
4766
|
-
|
|
4767
|
-
|
|
4768
|
-
|
|
4769
|
-
|
|
4770
|
-
|
|
4771
|
-
|
|
4772
|
-
|
|
4773
|
-
|
|
4774
|
-
|
|
4775
|
-
|
|
4776
|
-
|
|
4777
|
-
|
|
4778
|
-
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
|
|
4941
|
+
_n as CDEManager,
|
|
4942
|
+
hn as ChannelClient,
|
|
4943
|
+
ps as ChannelRoom,
|
|
4944
|
+
En as ClashesManager,
|
|
4945
|
+
on as CollabRoom,
|
|
4946
|
+
Le as DOCUMENT_FILE,
|
|
4947
|
+
te as DOCUMENT_SCHEMA,
|
|
4948
|
+
he as EngineServicesClient,
|
|
4949
|
+
an as ExternalRoom,
|
|
4950
|
+
vn as FileList,
|
|
4951
|
+
Hr as FlowDoc,
|
|
4952
|
+
Tn as GISManager,
|
|
4953
|
+
Sn as GitHistoryManager,
|
|
4954
|
+
In as HelloWorld,
|
|
4955
|
+
bn as METADATA_LIMITS,
|
|
4956
|
+
fn as OP_SCHEMA,
|
|
4957
|
+
wn as OperationBuilder,
|
|
4958
|
+
Ge as PlatformClient,
|
|
4959
|
+
as as ProjectDocuments,
|
|
4960
|
+
Gr as ProjectHistory,
|
|
4961
|
+
On as ProjectManager,
|
|
4962
|
+
Yr as Recipes,
|
|
4963
|
+
Te as RequestError,
|
|
4964
|
+
Me as STORAGE_BATCH_MAX,
|
|
4965
|
+
qe as StaleHistoryError,
|
|
4966
|
+
An as TopicsManager,
|
|
4967
|
+
kn as UIManager,
|
|
4968
|
+
ae as mintGuid,
|
|
4969
|
+
ds as orderByGraph,
|
|
4970
|
+
rn as windowTransport
|
|
4782
4971
|
};
|
|
4783
4972
|
//# sourceMappingURL=index.es.js.map
|