@thatopen/services 0.20.0 → 0.21.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/cli.js +40 -16
- package/dist/cli.js.map +1 -1
- package/dist/core/history.d.ts +8 -0
- package/dist/core/recipes.d.ts +67 -15
- package/dist/index.cjs.js +2 -2
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +446 -425
- package/dist/index.es.js.map +1 -1
- package/docs/ai-quickstart.md +30 -1
- package/docs/flow-plugin-guide.md +7 -0
- package/docs/rhino-interop-quickstart.md +7 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var Ze = Object.defineProperty;
|
|
2
|
+
var me = (n) => {
|
|
3
3
|
throw TypeError(n);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var T = (n, t, e) =>
|
|
7
|
-
var l = (n, t, e) => (
|
|
5
|
+
var ts = (n, t, e) => t in n ? Ze(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
|
|
6
|
+
var T = (n, t, e) => ts(n, typeof t != "symbol" ? t + "" : t, e), Pt = (n, t, e) => t.has(n) || me("Cannot " + e);
|
|
7
|
+
var l = (n, t, e) => (Pt(n, t, "read from private field"), e ? e.call(n) : t.get(n)), _ = (n, t, e) => t.has(n) ? me("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(n) : t.set(n, e), b = (n, t, e, s) => (Pt(n, t, "write to private field"), s ? s.call(n, e) : t.set(n, e), e), a = (n, t, e) => (Pt(n, t, "access private method"), e);
|
|
8
8
|
const P = /* @__PURE__ */ Object.create(null);
|
|
9
9
|
P.open = "0";
|
|
10
10
|
P.close = "1";
|
|
@@ -13,63 +13,63 @@ P.pong = "3";
|
|
|
13
13
|
P.message = "4";
|
|
14
14
|
P.upgrade = "5";
|
|
15
15
|
P.noop = "6";
|
|
16
|
-
const
|
|
16
|
+
const Et = /* @__PURE__ */ Object.create(null);
|
|
17
17
|
Object.keys(P).forEach((n) => {
|
|
18
|
-
|
|
18
|
+
Et[P[n]] = n;
|
|
19
19
|
});
|
|
20
|
-
const
|
|
20
|
+
const jt = { type: "error", data: "parser error" }, $e = typeof Blob == "function" || typeof Blob < "u" && Object.prototype.toString.call(Blob) === "[object BlobConstructor]", Re = typeof ArrayBuffer == "function", Ce = (n) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(n) : n && n.buffer instanceof ArrayBuffer, ce = ({ type: n, data: t }, e, s) => $e && t instanceof Blob ? e ? s(t) : ge(t, s) : Re && (t instanceof ArrayBuffer || Ce(t)) ? e ? s(t) : ge(new Blob([t]), s) : s(P[n] + (t || "")), ge = (n, 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
25
|
}, e.readAsDataURL(n);
|
|
26
26
|
};
|
|
27
|
-
function
|
|
27
|
+
function we(n) {
|
|
28
28
|
return n instanceof Uint8Array ? n : n instanceof ArrayBuffer ? new Uint8Array(n) : new Uint8Array(n.buffer, n.byteOffset, n.byteLength);
|
|
29
29
|
}
|
|
30
|
-
let
|
|
31
|
-
function
|
|
32
|
-
if (
|
|
33
|
-
return n.data.arrayBuffer().then(
|
|
34
|
-
if (
|
|
35
|
-
return t(
|
|
36
|
-
|
|
37
|
-
|
|
30
|
+
let Bt;
|
|
31
|
+
function es(n, t) {
|
|
32
|
+
if ($e && n.data instanceof Blob)
|
|
33
|
+
return n.data.arrayBuffer().then(we).then(t);
|
|
34
|
+
if (Re && (n.data instanceof ArrayBuffer || Ce(n.data)))
|
|
35
|
+
return t(we(n.data));
|
|
36
|
+
ce(n, !1, (e) => {
|
|
37
|
+
Bt || (Bt = new TextEncoder()), t(Bt.encode(e));
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
|
-
const
|
|
41
|
-
for (let n = 0; n <
|
|
42
|
-
ot[
|
|
43
|
-
const
|
|
40
|
+
const _e = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", ot = typeof Uint8Array > "u" ? [] : new Uint8Array(256);
|
|
41
|
+
for (let n = 0; n < _e.length; n++)
|
|
42
|
+
ot[_e.charCodeAt(n)] = n;
|
|
43
|
+
const ss = (n) => {
|
|
44
44
|
let t = n.length * 0.75, e = n.length, s, r = 0, i, o, h, u;
|
|
45
45
|
n[n.length - 1] === "=" && (t--, n[n.length - 2] === "=" && t--);
|
|
46
46
|
const f = new ArrayBuffer(t), y = new Uint8Array(f);
|
|
47
47
|
for (s = 0; s < e; s += 4)
|
|
48
48
|
i = ot[n.charCodeAt(s)], o = ot[n.charCodeAt(s + 1)], h = ot[n.charCodeAt(s + 2)], u = ot[n.charCodeAt(s + 3)], y[r++] = i << 2 | o >> 4, y[r++] = (o & 15) << 4 | h >> 2, y[r++] = (h & 3) << 6 | u & 63;
|
|
49
49
|
return f;
|
|
50
|
-
},
|
|
50
|
+
}, ns = typeof ArrayBuffer == "function", he = (n, t) => {
|
|
51
51
|
if (typeof n != "string")
|
|
52
52
|
return {
|
|
53
53
|
type: "message",
|
|
54
|
-
data:
|
|
54
|
+
data: Ne(n, t)
|
|
55
55
|
};
|
|
56
56
|
const e = n.charAt(0);
|
|
57
57
|
return e === "b" ? {
|
|
58
58
|
type: "message",
|
|
59
|
-
data:
|
|
60
|
-
} :
|
|
61
|
-
type:
|
|
59
|
+
data: rs(n.substring(1), t)
|
|
60
|
+
} : Et[e] ? n.length > 1 ? {
|
|
61
|
+
type: Et[e],
|
|
62
62
|
data: n.substring(1)
|
|
63
63
|
} : {
|
|
64
|
-
type:
|
|
65
|
-
} :
|
|
66
|
-
},
|
|
67
|
-
if (
|
|
68
|
-
const e =
|
|
69
|
-
return
|
|
64
|
+
type: Et[e]
|
|
65
|
+
} : jt;
|
|
66
|
+
}, rs = (n, t) => {
|
|
67
|
+
if (ns) {
|
|
68
|
+
const e = ss(n);
|
|
69
|
+
return Ne(e, t);
|
|
70
70
|
} else
|
|
71
71
|
return { base64: !0, data: n };
|
|
72
|
-
},
|
|
72
|
+
}, Ne = (n, t) => {
|
|
73
73
|
switch (t) {
|
|
74
74
|
case "blob":
|
|
75
75
|
return n instanceof Blob ? n : new Blob([n]);
|
|
@@ -77,27 +77,27 @@ const Ze = (n) => {
|
|
|
77
77
|
default:
|
|
78
78
|
return n instanceof ArrayBuffer ? n : n.buffer;
|
|
79
79
|
}
|
|
80
|
-
},
|
|
80
|
+
}, Pe = "", is = (n, t) => {
|
|
81
81
|
const e = n.length, s = new Array(e);
|
|
82
82
|
let r = 0;
|
|
83
83
|
n.forEach((i, o) => {
|
|
84
|
-
|
|
85
|
-
s[o] = h, ++r === e && t(s.join(
|
|
84
|
+
ce(i, !1, (h) => {
|
|
85
|
+
s[o] = h, ++r === e && t(s.join(Pe));
|
|
86
86
|
});
|
|
87
87
|
});
|
|
88
|
-
},
|
|
89
|
-
const e = n.split(
|
|
88
|
+
}, os = (n, t) => {
|
|
89
|
+
const e = n.split(Pe), s = [];
|
|
90
90
|
for (let r = 0; r < e.length; r++) {
|
|
91
|
-
const i =
|
|
91
|
+
const i = he(e[r], 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 as() {
|
|
98
98
|
return new TransformStream({
|
|
99
99
|
transform(n, t) {
|
|
100
|
-
|
|
100
|
+
es(n, (e) => {
|
|
101
101
|
const s = e.length;
|
|
102
102
|
let r;
|
|
103
103
|
if (s < 126)
|
|
@@ -116,11 +116,11 @@ function rs() {
|
|
|
116
116
|
}
|
|
117
117
|
});
|
|
118
118
|
}
|
|
119
|
-
let
|
|
120
|
-
function
|
|
119
|
+
let Lt;
|
|
120
|
+
function wt(n) {
|
|
121
121
|
return n.reduce((t, e) => t + e.length, 0);
|
|
122
122
|
}
|
|
123
|
-
function
|
|
123
|
+
function _t(n, t) {
|
|
124
124
|
if (n[0].length === t)
|
|
125
125
|
return n.shift();
|
|
126
126
|
const e = new Uint8Array(t);
|
|
@@ -129,51 +129,51 @@ function wt(n, t) {
|
|
|
129
129
|
e[r] = n[0][s++], s === n[0].length && (n.shift(), s = 0);
|
|
130
130
|
return n.length && s < n[0].length && (n[0] = n[0].slice(s)), e;
|
|
131
131
|
}
|
|
132
|
-
function
|
|
133
|
-
|
|
132
|
+
function cs(n, t) {
|
|
133
|
+
Lt || (Lt = new TextDecoder());
|
|
134
134
|
const e = [];
|
|
135
135
|
let s = 0, r = -1, i = !1;
|
|
136
136
|
return new TransformStream({
|
|
137
137
|
transform(o, h) {
|
|
138
138
|
for (e.push(o); ; ) {
|
|
139
139
|
if (s === 0) {
|
|
140
|
-
if (
|
|
140
|
+
if (wt(e) < 1)
|
|
141
141
|
break;
|
|
142
|
-
const u =
|
|
142
|
+
const u = _t(e, 1);
|
|
143
143
|
i = (u[0] & 128) === 128, r = u[0] & 127, r < 126 ? s = 3 : r === 126 ? s = 1 : s = 2;
|
|
144
144
|
} else if (s === 1) {
|
|
145
|
-
if (
|
|
145
|
+
if (wt(e) < 2)
|
|
146
146
|
break;
|
|
147
|
-
const u =
|
|
147
|
+
const u = _t(e, 2);
|
|
148
148
|
r = new DataView(u.buffer, u.byteOffset, u.length).getUint16(0), s = 3;
|
|
149
149
|
} else if (s === 2) {
|
|
150
|
-
if (
|
|
150
|
+
if (wt(e) < 8)
|
|
151
151
|
break;
|
|
152
|
-
const u =
|
|
152
|
+
const u = _t(e, 8), f = new DataView(u.buffer, u.byteOffset, u.length), y = f.getUint32(0);
|
|
153
153
|
if (y > Math.pow(2, 21) - 1) {
|
|
154
|
-
h.enqueue(
|
|
154
|
+
h.enqueue(jt);
|
|
155
155
|
break;
|
|
156
156
|
}
|
|
157
157
|
r = y * Math.pow(2, 32) + f.getUint32(4), s = 3;
|
|
158
158
|
} else {
|
|
159
|
-
if (
|
|
159
|
+
if (wt(e) < r)
|
|
160
160
|
break;
|
|
161
|
-
const u =
|
|
162
|
-
h.enqueue(
|
|
161
|
+
const u = _t(e, r);
|
|
162
|
+
h.enqueue(he(i ? u : Lt.decode(u), t)), s = 0;
|
|
163
163
|
}
|
|
164
164
|
if (r === 0 || r > n) {
|
|
165
|
-
h.enqueue(
|
|
165
|
+
h.enqueue(jt);
|
|
166
166
|
break;
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
169
|
}
|
|
170
170
|
});
|
|
171
171
|
}
|
|
172
|
-
const
|
|
172
|
+
const Be = 4;
|
|
173
173
|
function E(n) {
|
|
174
|
-
if (n) return
|
|
174
|
+
if (n) return hs(n);
|
|
175
175
|
}
|
|
176
|
-
function
|
|
176
|
+
function hs(n) {
|
|
177
177
|
for (var t in E.prototype)
|
|
178
178
|
n[t] = E.prototype[t];
|
|
179
179
|
return n;
|
|
@@ -219,34 +219,34 @@ E.prototype.listeners = function(n) {
|
|
|
219
219
|
E.prototype.hasListeners = function(n) {
|
|
220
220
|
return !!this.listeners(n).length;
|
|
221
221
|
};
|
|
222
|
-
const
|
|
223
|
-
function
|
|
222
|
+
const Ct = typeof Promise == "function" && typeof Promise.resolve == "function" ? (t) => Promise.resolve().then(t) : (t, e) => e(t, 0), A = typeof self < "u" ? self : typeof window < "u" ? window : Function("return this")(), ls = "arraybuffer";
|
|
223
|
+
function Le(n, ...t) {
|
|
224
224
|
return t.reduce((e, s) => (n.hasOwnProperty(s) && (e[s] = n[s]), e), {});
|
|
225
225
|
}
|
|
226
|
-
const
|
|
227
|
-
function
|
|
228
|
-
t.useNativeTimers ? (n.setTimeoutFn =
|
|
226
|
+
const us = A.setTimeout, ds = A.clearTimeout;
|
|
227
|
+
function Nt(n, t) {
|
|
228
|
+
t.useNativeTimers ? (n.setTimeoutFn = us.bind(A), n.clearTimeoutFn = ds.bind(A)) : (n.setTimeoutFn = A.setTimeout.bind(A), n.clearTimeoutFn = A.clearTimeout.bind(A));
|
|
229
229
|
}
|
|
230
|
-
const
|
|
231
|
-
function
|
|
232
|
-
return typeof n == "string" ?
|
|
230
|
+
const fs = 1.33;
|
|
231
|
+
function ps(n) {
|
|
232
|
+
return typeof n == "string" ? ys(n) : Math.ceil((n.byteLength || n.size) * fs);
|
|
233
233
|
}
|
|
234
|
-
function
|
|
234
|
+
function ys(n) {
|
|
235
235
|
let t = 0, e = 0;
|
|
236
236
|
for (let s = 0, r = n.length; s < r; s++)
|
|
237
237
|
t = n.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 qe() {
|
|
241
241
|
return Date.now().toString(36).substring(3) + Math.random().toString(36).substring(2, 5);
|
|
242
242
|
}
|
|
243
|
-
function
|
|
243
|
+
function ms(n) {
|
|
244
244
|
let t = "";
|
|
245
245
|
for (let e in n)
|
|
246
246
|
n.hasOwnProperty(e) && (t.length && (t += "&"), t += encodeURIComponent(e) + "=" + encodeURIComponent(n[e]));
|
|
247
247
|
return t;
|
|
248
248
|
}
|
|
249
|
-
function
|
|
249
|
+
function gs(n) {
|
|
250
250
|
let t = {}, e = n.split("&");
|
|
251
251
|
for (let s = 0, r = e.length; s < r; s++) {
|
|
252
252
|
let i = e[s].split("=");
|
|
@@ -254,12 +254,12 @@ function ps(n) {
|
|
|
254
254
|
}
|
|
255
255
|
return t;
|
|
256
256
|
}
|
|
257
|
-
class
|
|
257
|
+
class ws 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 le extends E {
|
|
263
263
|
/**
|
|
264
264
|
* Transport abstract constructor.
|
|
265
265
|
*
|
|
@@ -267,7 +267,7 @@ class ae extends E {
|
|
|
267
267
|
* @protected
|
|
268
268
|
*/
|
|
269
269
|
constructor(t) {
|
|
270
|
-
super(), this.writable = !1,
|
|
270
|
+
super(), this.writable = !1, Nt(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 ae extends E {
|
|
|
279
279
|
* @protected
|
|
280
280
|
*/
|
|
281
281
|
onError(t, e, s) {
|
|
282
|
-
return super.emitReserved("error", new
|
|
282
|
+
return super.emitReserved("error", new ws(t, e, s)), this;
|
|
283
283
|
}
|
|
284
284
|
/**
|
|
285
285
|
* Opens the transport.
|
|
@@ -316,7 +316,7 @@ class ae extends E {
|
|
|
316
316
|
* @protected
|
|
317
317
|
*/
|
|
318
318
|
onData(t) {
|
|
319
|
-
const e =
|
|
319
|
+
const e = he(t, this.socket.binaryType);
|
|
320
320
|
this.onPacket(e);
|
|
321
321
|
}
|
|
322
322
|
/**
|
|
@@ -353,11 +353,11 @@ class ae extends E {
|
|
|
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 = ms(t);
|
|
357
357
|
return e.length ? "?" + e : "";
|
|
358
358
|
}
|
|
359
359
|
}
|
|
360
|
-
class
|
|
360
|
+
class _s extends le {
|
|
361
361
|
constructor() {
|
|
362
362
|
super(...arguments), this._polling = !1;
|
|
363
363
|
}
|
|
@@ -413,7 +413,7 @@ class ms extends ae {
|
|
|
413
413
|
return this.onClose({ description: "transport closed by the server" }), !1;
|
|
414
414
|
this.onPacket(s);
|
|
415
415
|
};
|
|
416
|
-
|
|
416
|
+
os(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 ms extends ae {
|
|
|
433
433
|
* @protected
|
|
434
434
|
*/
|
|
435
435
|
write(t) {
|
|
436
|
-
this.writable = !1,
|
|
436
|
+
this.writable = !1, is(t, (e) => {
|
|
437
437
|
this.doWrite(e, () => {
|
|
438
438
|
this.writable = !0, this.emitReserved("drain");
|
|
439
439
|
});
|
|
@@ -446,18 +446,18 @@ class ms extends ae {
|
|
|
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] = qe()), !this.supportsBinary && !e.sid && (e.b64 = 1), this.createUri(t, e);
|
|
450
450
|
}
|
|
451
451
|
}
|
|
452
|
-
let
|
|
452
|
+
let Fe = !1;
|
|
453
453
|
try {
|
|
454
|
-
|
|
454
|
+
Fe = typeof XMLHttpRequest < "u" && "withCredentials" in new XMLHttpRequest();
|
|
455
455
|
} catch {
|
|
456
456
|
}
|
|
457
|
-
const
|
|
458
|
-
function
|
|
457
|
+
const bs = Fe;
|
|
458
|
+
function Es() {
|
|
459
459
|
}
|
|
460
|
-
class
|
|
460
|
+
class vs extends _s {
|
|
461
461
|
/**
|
|
462
462
|
* XHR Polling constructor.
|
|
463
463
|
*
|
|
@@ -507,7 +507,7 @@ class N extends E {
|
|
|
507
507
|
* @package
|
|
508
508
|
*/
|
|
509
509
|
constructor(t, e, s) {
|
|
510
|
-
super(), this.createRequest = t,
|
|
510
|
+
super(), this.createRequest = t, Nt(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 N extends E {
|
|
|
516
516
|
*/
|
|
517
517
|
_create() {
|
|
518
518
|
var t;
|
|
519
|
-
const e =
|
|
519
|
+
const e = Le(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 {
|
|
@@ -570,7 +570,7 @@ class N extends E {
|
|
|
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 = Es, t)
|
|
574
574
|
try {
|
|
575
575
|
this._xhr.abort();
|
|
576
576
|
} catch {
|
|
@@ -600,36 +600,36 @@ N.requestsCount = 0;
|
|
|
600
600
|
N.requests = {};
|
|
601
601
|
if (typeof document < "u") {
|
|
602
602
|
if (typeof attachEvent == "function")
|
|
603
|
-
attachEvent("onunload",
|
|
603
|
+
attachEvent("onunload", be);
|
|
604
604
|
else if (typeof addEventListener == "function") {
|
|
605
605
|
const n = "onpagehide" in A ? "pagehide" : "unload";
|
|
606
|
-
addEventListener(n,
|
|
606
|
+
addEventListener(n, be, !1);
|
|
607
607
|
}
|
|
608
608
|
}
|
|
609
|
-
function
|
|
609
|
+
function be() {
|
|
610
610
|
for (let n in N.requests)
|
|
611
611
|
N.requests.hasOwnProperty(n) && N.requests[n].abort();
|
|
612
612
|
}
|
|
613
|
-
const
|
|
614
|
-
const n =
|
|
613
|
+
const Ts = function() {
|
|
614
|
+
const n = Ue({
|
|
615
615
|
xdomain: !1
|
|
616
616
|
});
|
|
617
617
|
return n && n.responseType !== null;
|
|
618
618
|
}();
|
|
619
|
-
class
|
|
619
|
+
class Ss extends vs {
|
|
620
620
|
constructor(t) {
|
|
621
621
|
super(t);
|
|
622
622
|
const e = t && t.forceBase64;
|
|
623
|
-
this.supportsBinary =
|
|
623
|
+
this.supportsBinary = Ts && !e;
|
|
624
624
|
}
|
|
625
625
|
request(t = {}) {
|
|
626
|
-
return Object.assign(t, { xd: this.xd }, this.opts), new N(
|
|
626
|
+
return Object.assign(t, { xd: this.xd }, this.opts), new N(Ue, this.uri(), t);
|
|
627
627
|
}
|
|
628
628
|
}
|
|
629
|
-
function
|
|
629
|
+
function Ue(n) {
|
|
630
630
|
const t = n.xdomain;
|
|
631
631
|
try {
|
|
632
|
-
if (typeof XMLHttpRequest < "u" && (!t ||
|
|
632
|
+
if (typeof XMLHttpRequest < "u" && (!t || bs))
|
|
633
633
|
return new XMLHttpRequest();
|
|
634
634
|
} catch {
|
|
635
635
|
}
|
|
@@ -639,13 +639,13 @@ function qe(n) {
|
|
|
639
639
|
} catch {
|
|
640
640
|
}
|
|
641
641
|
}
|
|
642
|
-
const
|
|
643
|
-
class
|
|
642
|
+
const De = typeof navigator < "u" && typeof navigator.product == "string" && navigator.product.toLowerCase() === "reactnative";
|
|
643
|
+
class ks extends le {
|
|
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 = De ? {} : Le(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);
|
|
@@ -671,12 +671,12 @@ class vs extends ae {
|
|
|
671
671
|
this.writable = !1;
|
|
672
672
|
for (let e = 0; e < t.length; e++) {
|
|
673
673
|
const s = t[e], r = e === t.length - 1;
|
|
674
|
-
|
|
674
|
+
ce(s, this.supportsBinary, (i) => {
|
|
675
675
|
try {
|
|
676
676
|
this.doWrite(s, i);
|
|
677
677
|
} catch {
|
|
678
678
|
}
|
|
679
|
-
r &&
|
|
679
|
+
r && Ct(() => {
|
|
680
680
|
this.writable = !0, this.emitReserved("drain");
|
|
681
681
|
}, this.setTimeoutFn);
|
|
682
682
|
});
|
|
@@ -693,19 +693,19 @@ class vs extends ae {
|
|
|
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] = qe()), this.supportsBinary || (e.b64 = 1), this.createUri(t, e);
|
|
697
697
|
}
|
|
698
698
|
}
|
|
699
|
-
const
|
|
700
|
-
class
|
|
699
|
+
const qt = A.WebSocket || A.MozWebSocket;
|
|
700
|
+
class Os extends ks {
|
|
701
701
|
createSocket(t, e, s) {
|
|
702
|
-
return
|
|
702
|
+
return De ? new qt(t, e, s) : e ? new qt(t, e) : new qt(t);
|
|
703
703
|
}
|
|
704
704
|
doWrite(t, e) {
|
|
705
705
|
this.ws.send(e);
|
|
706
706
|
}
|
|
707
707
|
}
|
|
708
|
-
class
|
|
708
|
+
class As extends le {
|
|
709
709
|
get name() {
|
|
710
710
|
return "webtransport";
|
|
711
711
|
}
|
|
@@ -721,7 +721,7 @@ class Ss extends ae {
|
|
|
721
721
|
this.onError("webtransport error", t);
|
|
722
722
|
}), this._transport.ready.then(() => {
|
|
723
723
|
this._transport.createBidirectionalStream().then((t) => {
|
|
724
|
-
const e =
|
|
724
|
+
const e = cs(Number.MAX_SAFE_INTEGER, this.socket.binaryType), s = t.readable.pipeThrough(e).getReader(), r = as();
|
|
725
725
|
r.readable.pipeTo(t.writable), this._writer = r.writable.getWriter();
|
|
726
726
|
const i = () => {
|
|
727
727
|
s.read().then(({ done: h, value: u }) => {
|
|
@@ -740,7 +740,7 @@ class Ss extends ae {
|
|
|
740
740
|
for (let e = 0; e < t.length; e++) {
|
|
741
741
|
const s = t[e], r = e === t.length - 1;
|
|
742
742
|
this._writer.write(s).then(() => {
|
|
743
|
-
r &&
|
|
743
|
+
r && Ct(() => {
|
|
744
744
|
this.writable = !0, this.emitReserved("drain");
|
|
745
745
|
}, this.setTimeoutFn);
|
|
746
746
|
});
|
|
@@ -751,11 +751,11 @@ class Ss extends ae {
|
|
|
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 Is = {
|
|
755
|
+
websocket: Os,
|
|
756
|
+
webtransport: As,
|
|
757
|
+
polling: Ss
|
|
758
|
+
}, xs = /^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/, $s = [
|
|
759
759
|
"source",
|
|
760
760
|
"protocol",
|
|
761
761
|
"authority",
|
|
@@ -771,29 +771,29 @@ const ks = {
|
|
|
771
771
|
"query",
|
|
772
772
|
"anchor"
|
|
773
773
|
];
|
|
774
|
-
function
|
|
774
|
+
function Mt(n) {
|
|
775
775
|
if (n.length > 8e3)
|
|
776
776
|
throw "URI too long";
|
|
777
777
|
const t = n, e = n.indexOf("["), s = n.indexOf("]");
|
|
778
778
|
e != -1 && s != -1 && (n = n.substring(0, e) + n.substring(e, s).replace(/:/g, ";") + n.substring(s, n.length));
|
|
779
|
-
let r =
|
|
779
|
+
let r = xs.exec(n || ""), 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[$s[o]] = r[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 = Rs(i, i.path), i.queryKey = Cs(i, i.query), i;
|
|
783
783
|
}
|
|
784
|
-
function
|
|
784
|
+
function Rs(n, 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 Cs(n, t) {
|
|
789
789
|
const e = {};
|
|
790
790
|
return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g, function(s, r, i) {
|
|
791
791
|
r && (e[r] = i);
|
|
792
792
|
}), e;
|
|
793
793
|
}
|
|
794
|
-
const
|
|
795
|
-
|
|
796
|
-
|
|
794
|
+
const Ht = typeof addEventListener == "function" && typeof removeEventListener == "function", vt = [];
|
|
795
|
+
Ht && addEventListener("offline", () => {
|
|
796
|
+
vt.forEach((n) => n());
|
|
797
797
|
}, !1);
|
|
798
798
|
class V extends E {
|
|
799
799
|
/**
|
|
@@ -803,11 +803,11 @@ class V extends E {
|
|
|
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 = ls, 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 = Mt(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
|
-
|
|
809
|
+
} else e.host && (e.hostname = Mt(e.host).host);
|
|
810
|
+
Nt(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
811
|
const r = s.prototype.name;
|
|
812
812
|
this.transports.push(r), this._transportsByName[r] = s;
|
|
813
813
|
}), this.opts = Object.assign({
|
|
@@ -824,13 +824,13 @@ class V extends E {
|
|
|
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 = gs(this.opts.query)), Ht && (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
|
+
}, vt.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 V extends E {
|
|
|
841
841
|
*/
|
|
842
842
|
createTransport(t) {
|
|
843
843
|
const e = Object.assign({}, this.opts.query);
|
|
844
|
-
e.EIO =
|
|
844
|
+
e.EIO = Be, 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,
|
|
@@ -959,7 +959,7 @@ class V extends E {
|
|
|
959
959
|
let e = 1;
|
|
960
960
|
for (let s = 0; s < this.writeBuffer.length; s++) {
|
|
961
961
|
const r = this.writeBuffer[s].data;
|
|
962
|
-
if (r && (e +=
|
|
962
|
+
if (r && (e += ps(r)), s > 0 && e > this._maxPayload)
|
|
963
963
|
return this.writeBuffer.slice(0, s);
|
|
964
964
|
e += 2;
|
|
965
965
|
}
|
|
@@ -979,7 +979,7 @@ class V extends E {
|
|
|
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, Ct(() => {
|
|
983
983
|
this._onClose("ping timeout");
|
|
984
984
|
}, this.setTimeoutFn)), t;
|
|
985
985
|
}
|
|
@@ -1057,16 +1057,16 @@ class V extends E {
|
|
|
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(), Ht && (this._beforeunloadEventListener && removeEventListener("beforeunload", this._beforeunloadEventListener, !1), this._offlineEventListener)) {
|
|
1061
|
+
const s = vt.indexOf(this._offlineEventListener);
|
|
1062
|
+
s !== -1 && vt.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
|
-
V.protocol =
|
|
1069
|
-
class
|
|
1068
|
+
V.protocol = Be;
|
|
1069
|
+
class Ns extends V {
|
|
1070
1070
|
constructor() {
|
|
1071
1071
|
super(...arguments), this._upgrades = [];
|
|
1072
1072
|
}
|
|
@@ -1138,67 +1138,67 @@ class $s extends V {
|
|
|
1138
1138
|
return e;
|
|
1139
1139
|
}
|
|
1140
1140
|
}
|
|
1141
|
-
let
|
|
1141
|
+
let Ps = class extends Ns {
|
|
1142
1142
|
constructor(t, e = {}) {
|
|
1143
1143
|
const s = typeof t == "object", r = s ? { ...t } : { ...e };
|
|
1144
|
-
(!r.transports || r.transports && typeof r.transports[0] == "string") && (r.transports = (r.transports || ["polling", "websocket", "webtransport"]).map((i) =>
|
|
1144
|
+
(!r.transports || r.transports && typeof r.transports[0] == "string") && (r.transports = (r.transports || ["polling", "websocket", "webtransport"]).map((i) => Is[i]).filter((i) => !!i)), super(s ? r : t, r);
|
|
1145
1145
|
}
|
|
1146
1146
|
};
|
|
1147
|
-
function
|
|
1147
|
+
function Bs(n, t = "", e) {
|
|
1148
1148
|
let s = n;
|
|
1149
|
-
e = e || typeof location < "u" && location, n == null && (n = e.protocol + "//" + e.host), typeof n == "string" && (n.charAt(0) === "/" && (n.charAt(1) === "/" ? n = e.protocol + n : n = e.host + n), /^(https?|wss?):\/\//.test(n) || (typeof e < "u" ? n = e.protocol + "//" + n : n = "https://" + n), s =
|
|
1149
|
+
e = e || typeof location < "u" && location, n == null && (n = e.protocol + "//" + e.host), typeof n == "string" && (n.charAt(0) === "/" && (n.charAt(1) === "/" ? n = e.protocol + n : n = e.host + n), /^(https?|wss?):\/\//.test(n) || (typeof e < "u" ? n = e.protocol + "//" + n : n = "https://" + n), s = Mt(n)), s.port || (/^(http|ws)$/.test(s.protocol) ? s.port = "80" : /^(http|ws)s$/.test(s.protocol) && (s.port = "443")), s.path = s.path || "/";
|
|
1150
1150
|
const i = s.host.indexOf(":") !== -1 ? "[" + s.host + "]" : s.host;
|
|
1151
1151
|
return s.id = s.protocol + "://" + i + ":" + s.port + t, s.href = s.protocol + "://" + i + (e && e.port === s.port ? "" : ":" + s.port), s;
|
|
1152
1152
|
}
|
|
1153
|
-
const
|
|
1154
|
-
function
|
|
1155
|
-
return
|
|
1153
|
+
const Ls = typeof ArrayBuffer == "function", qs = (n) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(n) : n.buffer instanceof ArrayBuffer, je = Object.prototype.toString, Fs = typeof Blob == "function" || typeof Blob < "u" && je.call(Blob) === "[object BlobConstructor]", Us = typeof File == "function" || typeof File < "u" && je.call(File) === "[object FileConstructor]";
|
|
1154
|
+
function ue(n) {
|
|
1155
|
+
return Ls && (n instanceof ArrayBuffer || qs(n)) || Fs && n instanceof Blob || Us && n instanceof File;
|
|
1156
1156
|
}
|
|
1157
|
-
function
|
|
1157
|
+
function Tt(n, t) {
|
|
1158
1158
|
if (!n || typeof n != "object")
|
|
1159
1159
|
return !1;
|
|
1160
1160
|
if (Array.isArray(n)) {
|
|
1161
1161
|
for (let e = 0, s = n.length; e < s; e++)
|
|
1162
|
-
if (
|
|
1162
|
+
if (Tt(n[e]))
|
|
1163
1163
|
return !0;
|
|
1164
1164
|
return !1;
|
|
1165
1165
|
}
|
|
1166
|
-
if (
|
|
1166
|
+
if (ue(n))
|
|
1167
1167
|
return !0;
|
|
1168
1168
|
if (n.toJSON && typeof n.toJSON == "function" && arguments.length === 1)
|
|
1169
|
-
return
|
|
1169
|
+
return Tt(n.toJSON(), !0);
|
|
1170
1170
|
for (const e in n)
|
|
1171
|
-
if (Object.prototype.hasOwnProperty.call(n, e) &&
|
|
1171
|
+
if (Object.prototype.hasOwnProperty.call(n, e) && Tt(n[e]))
|
|
1172
1172
|
return !0;
|
|
1173
1173
|
return !1;
|
|
1174
1174
|
}
|
|
1175
|
-
function
|
|
1175
|
+
function Ds(n) {
|
|
1176
1176
|
const t = [], e = n.data, s = n;
|
|
1177
|
-
return s.data =
|
|
1177
|
+
return s.data = Gt(e, t), s.attachments = t.length, { packet: s, buffers: t };
|
|
1178
1178
|
}
|
|
1179
|
-
function
|
|
1179
|
+
function Gt(n, t) {
|
|
1180
1180
|
if (!n)
|
|
1181
1181
|
return n;
|
|
1182
|
-
if (
|
|
1182
|
+
if (ue(n)) {
|
|
1183
1183
|
const e = { _placeholder: !0, num: t.length };
|
|
1184
1184
|
return t.push(n), e;
|
|
1185
1185
|
} else if (Array.isArray(n)) {
|
|
1186
1186
|
const e = new Array(n.length);
|
|
1187
1187
|
for (let s = 0; s < n.length; s++)
|
|
1188
|
-
e[s] =
|
|
1188
|
+
e[s] = Gt(n[s], t);
|
|
1189
1189
|
return e;
|
|
1190
1190
|
} else if (typeof n == "object" && !(n instanceof Date)) {
|
|
1191
1191
|
const e = {};
|
|
1192
1192
|
for (const s in n)
|
|
1193
|
-
Object.prototype.hasOwnProperty.call(n, s) && (e[s] =
|
|
1193
|
+
Object.prototype.hasOwnProperty.call(n, s) && (e[s] = Gt(n[s], t));
|
|
1194
1194
|
return e;
|
|
1195
1195
|
}
|
|
1196
1196
|
return n;
|
|
1197
1197
|
}
|
|
1198
|
-
function
|
|
1199
|
-
return n.data =
|
|
1198
|
+
function js(n, t) {
|
|
1199
|
+
return n.data = Vt(n.data, t), delete n.attachments, n;
|
|
1200
1200
|
}
|
|
1201
|
-
function
|
|
1201
|
+
function Vt(n, t) {
|
|
1202
1202
|
if (!n)
|
|
1203
1203
|
return n;
|
|
1204
1204
|
if (n && n._placeholder === !0) {
|
|
@@ -1207,13 +1207,13 @@ function Gt(n, t) {
|
|
|
1207
1207
|
throw new Error("illegal attachments");
|
|
1208
1208
|
} else if (Array.isArray(n))
|
|
1209
1209
|
for (let e = 0; e < n.length; e++)
|
|
1210
|
-
n[e] =
|
|
1210
|
+
n[e] = Vt(n[e], t);
|
|
1211
1211
|
else if (typeof n == "object")
|
|
1212
1212
|
for (const e in n)
|
|
1213
|
-
Object.prototype.hasOwnProperty.call(n, e) && (n[e] =
|
|
1213
|
+
Object.prototype.hasOwnProperty.call(n, e) && (n[e] = Vt(n[e], t));
|
|
1214
1214
|
return n;
|
|
1215
1215
|
}
|
|
1216
|
-
const
|
|
1216
|
+
const Ms = [
|
|
1217
1217
|
"connect",
|
|
1218
1218
|
// used on the client side
|
|
1219
1219
|
"connect_error",
|
|
@@ -1231,7 +1231,7 @@ var g;
|
|
|
1231
1231
|
(function(n) {
|
|
1232
1232
|
n[n.CONNECT = 0] = "CONNECT", n[n.DISCONNECT = 1] = "DISCONNECT", n[n.EVENT = 2] = "EVENT", n[n.ACK = 3] = "ACK", n[n.CONNECT_ERROR = 4] = "CONNECT_ERROR", n[n.BINARY_EVENT = 5] = "BINARY_EVENT", n[n.BINARY_ACK = 6] = "BINARY_ACK";
|
|
1233
1233
|
})(g || (g = {}));
|
|
1234
|
-
class
|
|
1234
|
+
class Hs {
|
|
1235
1235
|
/**
|
|
1236
1236
|
* Encoder constructor
|
|
1237
1237
|
*
|
|
@@ -1247,7 +1247,7 @@ class Ds {
|
|
|
1247
1247
|
* @param {Object} obj - packet object
|
|
1248
1248
|
*/
|
|
1249
1249
|
encode(t) {
|
|
1250
|
-
return (t.type === g.EVENT || t.type === g.ACK) &&
|
|
1250
|
+
return (t.type === g.EVENT || t.type === g.ACK) && Tt(t) ? this.encodeAsBinary({
|
|
1251
1251
|
type: t.type === g.EVENT ? g.BINARY_EVENT : g.BINARY_ACK,
|
|
1252
1252
|
nsp: t.nsp,
|
|
1253
1253
|
data: t.data,
|
|
@@ -1267,11 +1267,11 @@ class Ds {
|
|
|
1267
1267
|
* a list of buffers.
|
|
1268
1268
|
*/
|
|
1269
1269
|
encodeAsBinary(t) {
|
|
1270
|
-
const e =
|
|
1270
|
+
const e = Ds(t), s = this.encodeAsString(e.packet), r = e.buffers;
|
|
1271
1271
|
return r.unshift(s), r;
|
|
1272
1272
|
}
|
|
1273
1273
|
}
|
|
1274
|
-
class
|
|
1274
|
+
class de extends E {
|
|
1275
1275
|
/**
|
|
1276
1276
|
* Decoder constructor
|
|
1277
1277
|
*/
|
|
@@ -1293,8 +1293,8 @@ class he extends E {
|
|
|
1293
1293
|
throw new Error("got plaintext data when reconstructing a packet");
|
|
1294
1294
|
e = this.decodeString(t);
|
|
1295
1295
|
const s = e.type === g.BINARY_EVENT;
|
|
1296
|
-
s || e.type === g.BINARY_ACK ? (e.type = s ? g.EVENT : g.ACK, this.reconstructor = new
|
|
1297
|
-
} else if (
|
|
1296
|
+
s || e.type === g.BINARY_ACK ? (e.type = s ? g.EVENT : g.ACK, this.reconstructor = new Gs(e), e.attachments === 0 && super.emitReserved("decoded", e)) : super.emitReserved("decoded", e);
|
|
1297
|
+
} else if (ue(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
|
|
@@ -1323,7 +1323,7 @@ class he extends E {
|
|
|
1323
1323
|
if (o != Number(o) || t.charAt(e) !== "-")
|
|
1324
1324
|
throw new Error("Illegal attachments");
|
|
1325
1325
|
const h = Number(o);
|
|
1326
|
-
if (!
|
|
1326
|
+
if (!Vs(h) || h < 0)
|
|
1327
1327
|
throw new Error("Illegal attachments");
|
|
1328
1328
|
if (h > this.opts.maxAttachments)
|
|
1329
1329
|
throw new Error("too many attachments");
|
|
@@ -1352,7 +1352,7 @@ class he extends E {
|
|
|
1352
1352
|
}
|
|
1353
1353
|
if (t.charAt(++e)) {
|
|
1354
1354
|
const i = this.tryParse(t.substr(e));
|
|
1355
|
-
if (
|
|
1355
|
+
if (de.isPayloadValid(s.type, i))
|
|
1356
1356
|
s.data = i;
|
|
1357
1357
|
else
|
|
1358
1358
|
throw new Error("invalid payload");
|
|
@@ -1369,14 +1369,14 @@ class he extends E {
|
|
|
1369
1369
|
static isPayloadValid(t, e) {
|
|
1370
1370
|
switch (t) {
|
|
1371
1371
|
case g.CONNECT:
|
|
1372
|
-
return
|
|
1372
|
+
return Ee(e);
|
|
1373
1373
|
case g.DISCONNECT:
|
|
1374
1374
|
return e === void 0;
|
|
1375
1375
|
case g.CONNECT_ERROR:
|
|
1376
|
-
return typeof e == "string" ||
|
|
1376
|
+
return typeof e == "string" || Ee(e);
|
|
1377
1377
|
case g.EVENT:
|
|
1378
1378
|
case g.BINARY_EVENT:
|
|
1379
|
-
return Array.isArray(e) && (typeof e[0] == "number" || typeof e[0] == "string" &&
|
|
1379
|
+
return Array.isArray(e) && (typeof e[0] == "number" || typeof e[0] == "string" && Ms.indexOf(e[0]) === -1);
|
|
1380
1380
|
case g.ACK:
|
|
1381
1381
|
case g.BINARY_ACK:
|
|
1382
1382
|
return Array.isArray(e);
|
|
@@ -1389,7 +1389,7 @@ class he extends E {
|
|
|
1389
1389
|
this.reconstructor && (this.reconstructor.finishedReconstruction(), this.reconstructor = null);
|
|
1390
1390
|
}
|
|
1391
1391
|
}
|
|
1392
|
-
class
|
|
1392
|
+
class Gs {
|
|
1393
1393
|
constructor(t) {
|
|
1394
1394
|
this.packet = t, this.buffers = [], this.reconPack = t;
|
|
1395
1395
|
}
|
|
@@ -1403,7 +1403,7 @@ class js {
|
|
|
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 = js(this.reconPack, this.buffers);
|
|
1407
1407
|
return this.finishedReconstruction(), e;
|
|
1408
1408
|
}
|
|
1409
1409
|
return null;
|
|
@@ -1415,16 +1415,16 @@ class js {
|
|
|
1415
1415
|
this.reconPack = null, this.buffers = [];
|
|
1416
1416
|
}
|
|
1417
1417
|
}
|
|
1418
|
-
const
|
|
1418
|
+
const Vs = Number.isInteger || function(n) {
|
|
1419
1419
|
return typeof n == "number" && isFinite(n) && Math.floor(n) === n;
|
|
1420
1420
|
};
|
|
1421
|
-
function
|
|
1421
|
+
function Ee(n) {
|
|
1422
1422
|
return Object.prototype.toString.call(n) === "[object Object]";
|
|
1423
1423
|
}
|
|
1424
|
-
const
|
|
1424
|
+
const Js = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1425
1425
|
__proto__: null,
|
|
1426
|
-
Decoder:
|
|
1427
|
-
Encoder:
|
|
1426
|
+
Decoder: de,
|
|
1427
|
+
Encoder: Hs,
|
|
1428
1428
|
get PacketType() {
|
|
1429
1429
|
return g;
|
|
1430
1430
|
}
|
|
@@ -1434,7 +1434,7 @@ function $(n, t, e) {
|
|
|
1434
1434
|
n.off(t, e);
|
|
1435
1435
|
};
|
|
1436
1436
|
}
|
|
1437
|
-
const
|
|
1437
|
+
const Ys = Object.freeze({
|
|
1438
1438
|
connect: 1,
|
|
1439
1439
|
connect_error: 1,
|
|
1440
1440
|
disconnect: 1,
|
|
@@ -1443,7 +1443,7 @@ const Gs = Object.freeze({
|
|
|
1443
1443
|
newListener: 1,
|
|
1444
1444
|
removeListener: 1
|
|
1445
1445
|
});
|
|
1446
|
-
class
|
|
1446
|
+
class Me extends E {
|
|
1447
1447
|
/**
|
|
1448
1448
|
* `Socket` constructor.
|
|
1449
1449
|
*/
|
|
@@ -1559,7 +1559,7 @@ class De extends E {
|
|
|
1559
1559
|
*/
|
|
1560
1560
|
emit(t, ...e) {
|
|
1561
1561
|
var s, r, i;
|
|
1562
|
-
if (
|
|
1562
|
+
if (Ys.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;
|
|
@@ -2058,15 +2058,15 @@ nt.prototype.setMax = function(n) {
|
|
|
2058
2058
|
nt.prototype.setJitter = function(n) {
|
|
2059
2059
|
this.jitter = n;
|
|
2060
2060
|
};
|
|
2061
|
-
class
|
|
2061
|
+
class Jt 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, Nt(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 nt({
|
|
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 r = e.parser ||
|
|
2069
|
+
const r = e.parser || Js;
|
|
2070
2070
|
this.encoder = new r.Encoder(), this.decoder = new r.Decoder(), this._autoConnect = e.autoConnect !== !1, this._autoConnect && this.open();
|
|
2071
2071
|
}
|
|
2072
2072
|
reconnection(t) {
|
|
@@ -2109,7 +2109,7 @@ class Vt extends E {
|
|
|
2109
2109
|
open(t) {
|
|
2110
2110
|
if (~this._readyState.indexOf("open"))
|
|
2111
2111
|
return this;
|
|
2112
|
-
this.engine = new
|
|
2112
|
+
this.engine = new Ps(this.uri, this.opts);
|
|
2113
2113
|
const e = this.engine, s = this;
|
|
2114
2114
|
this._readyState = "opening", this.skipReconnect = !1;
|
|
2115
2115
|
const r = $(e, "open", function() {
|
|
@@ -2179,7 +2179,7 @@ class Vt extends E {
|
|
|
2179
2179
|
* @private
|
|
2180
2180
|
*/
|
|
2181
2181
|
ondecoded(t) {
|
|
2182
|
-
|
|
2182
|
+
Ct(() => {
|
|
2183
2183
|
this.emitReserved("packet", t);
|
|
2184
2184
|
}, this.setTimeoutFn);
|
|
2185
2185
|
}
|
|
@@ -2199,7 +2199,7 @@ class Vt extends E {
|
|
|
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 Me(this, t, e), this.nsps[t] = s), s;
|
|
2203
2203
|
}
|
|
2204
2204
|
/**
|
|
2205
2205
|
* Called upon a socket close.
|
|
@@ -2299,43 +2299,46 @@ class Vt extends E {
|
|
|
2299
2299
|
const rt = {};
|
|
2300
2300
|
function ut(n, t) {
|
|
2301
2301
|
typeof n == "object" && (t = n, n = void 0), t = t || {};
|
|
2302
|
-
const e =
|
|
2302
|
+
const e = Bs(n, t.path || "/socket.io"), s = e.source, r = e.id, i = e.path, o = rt[r] && i in rt[r].nsps, h = t.forceNew || t["force new connection"] || t.multiplex === !1 || o;
|
|
2303
2303
|
let u;
|
|
2304
|
-
return h ? u = new
|
|
2304
|
+
return h ? u = new Jt(s, t) : (rt[r] || (rt[r] = new Jt(s, t)), u = rt[r]), e.query && !t.query && (t.query = e.queryKey), u.socket(e.path, t);
|
|
2305
2305
|
}
|
|
2306
2306
|
Object.assign(ut, {
|
|
2307
|
-
Manager:
|
|
2308
|
-
Socket:
|
|
2307
|
+
Manager: Jt,
|
|
2308
|
+
Socket: Me,
|
|
2309
2309
|
io: ut,
|
|
2310
2310
|
connect: ut
|
|
2311
2311
|
});
|
|
2312
|
-
class
|
|
2312
|
+
class ve extends Error {
|
|
2313
2313
|
constructor(t, e) {
|
|
2314
2314
|
super(
|
|
2315
2315
|
`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.`
|
|
2316
2316
|
), this.expectedGuid = t, this.actualGuid = e, this.name = "StaleHistoryError";
|
|
2317
2317
|
}
|
|
2318
2318
|
}
|
|
2319
|
-
const
|
|
2319
|
+
const Te = "bimterop", Se = "revitflow_history.json", it = "revitflow_ops.json", ke = "revitflow/ops@1", Ws = "revitflow_model.frag", Ks = "revitflow_", bt = () => `v-${Date.now()}`;
|
|
2320
|
+
function He(n, t) {
|
|
2321
|
+
return n.filter((e) => String(e.parentId ?? "") === t);
|
|
2322
|
+
}
|
|
2320
2323
|
function Y(n) {
|
|
2321
2324
|
return String(n._id ?? n.id ?? "");
|
|
2322
2325
|
}
|
|
2323
|
-
var
|
|
2324
|
-
class
|
|
2326
|
+
var x, dt, Yt;
|
|
2327
|
+
class Xs {
|
|
2325
2328
|
constructor(t, e) {
|
|
2326
2329
|
_(this, dt);
|
|
2327
|
-
_(this,
|
|
2330
|
+
_(this, x);
|
|
2328
2331
|
this.client = t, this.projectId = e;
|
|
2329
2332
|
}
|
|
2330
2333
|
/** The project's connected documents. */
|
|
2331
2334
|
async docs() {
|
|
2332
|
-
const t = await a(this, dt,
|
|
2335
|
+
const t = await a(this, dt, Yt).call(this);
|
|
2333
2336
|
if (!t) return [];
|
|
2334
2337
|
const e = await this.client.listFolders({
|
|
2335
2338
|
parentFolderId: t,
|
|
2336
2339
|
projectId: this.projectId
|
|
2337
2340
|
}), s = [];
|
|
2338
|
-
for (const r of e) {
|
|
2341
|
+
for (const r of He(e, t)) {
|
|
2339
2342
|
const i = String(r.name ?? ""), o = i.indexOf("-");
|
|
2340
2343
|
o <= 0 || s.push({
|
|
2341
2344
|
source: i.slice(0, o),
|
|
@@ -2347,33 +2350,33 @@ class Ys {
|
|
|
2347
2350
|
}
|
|
2348
2351
|
/** One document's history. `source` and `docId` as {@link docs} lists them. */
|
|
2349
2352
|
doc(t, e) {
|
|
2350
|
-
return new
|
|
2353
|
+
return new zs(this.client, this, t, e);
|
|
2351
2354
|
}
|
|
2352
2355
|
/** @internal The `bimterop` folder id, resolved once. */
|
|
2353
2356
|
async rootFolderId(t = !1) {
|
|
2354
|
-
if (l(this,
|
|
2355
|
-
const e = await a(this, dt,
|
|
2357
|
+
if (l(this, x)) return l(this, x);
|
|
2358
|
+
const e = await a(this, dt, Yt).call(this);
|
|
2356
2359
|
if (e) return e;
|
|
2357
2360
|
if (!t) return;
|
|
2358
2361
|
const s = await this.client.createFolder(
|
|
2359
|
-
|
|
2362
|
+
Te,
|
|
2360
2363
|
void 0,
|
|
2361
2364
|
this.projectId
|
|
2362
2365
|
);
|
|
2363
|
-
return b(this,
|
|
2366
|
+
return b(this, x, Y(s)), l(this, x);
|
|
2364
2367
|
}
|
|
2365
2368
|
}
|
|
2366
|
-
|
|
2367
|
-
if (l(this,
|
|
2369
|
+
x = new WeakMap(), dt = new WeakSet(), Yt = async function() {
|
|
2370
|
+
if (l(this, x)) return l(this, x);
|
|
2368
2371
|
const e = (await this.client.listFolders({
|
|
2369
2372
|
projectId: this.projectId
|
|
2370
2373
|
})).find(
|
|
2371
|
-
(s) => String(s.name ?? "") ===
|
|
2374
|
+
(s) => String(s.name ?? "") === Te && !s.parentId
|
|
2372
2375
|
);
|
|
2373
|
-
return e && b(this,
|
|
2376
|
+
return e && b(this, x, Y(e)), l(this, x);
|
|
2374
2377
|
};
|
|
2375
|
-
var L, p, at, ct,
|
|
2376
|
-
class
|
|
2378
|
+
var L, p, at, ct, Wt, St, kt, Kt, Ot, ht, At, Xt, Ge;
|
|
2379
|
+
class zs {
|
|
2377
2380
|
constructor(t, e, s, r) {
|
|
2378
2381
|
_(this, p);
|
|
2379
2382
|
_(this, L);
|
|
@@ -2386,8 +2389,8 @@ class Ws {
|
|
|
2386
2389
|
* Each version gets its `ordinal` filled in.
|
|
2387
2390
|
*/
|
|
2388
2391
|
async timeline() {
|
|
2389
|
-
const t = await a(this, p,
|
|
2390
|
-
return
|
|
2392
|
+
const t = await a(this, p, Ot).call(this);
|
|
2393
|
+
return Ve((t == null ? void 0 : t.commits) ?? []);
|
|
2391
2394
|
}
|
|
2392
2395
|
/** The head of the timeline, or null before the first sync. */
|
|
2393
2396
|
async latest() {
|
|
@@ -2407,7 +2410,7 @@ class Ws {
|
|
|
2407
2410
|
}
|
|
2408
2411
|
/** The visible model .frag as last fully exported. */
|
|
2409
2412
|
async model() {
|
|
2410
|
-
const t = await a(this, p,
|
|
2413
|
+
const t = await a(this, p, kt).call(this);
|
|
2411
2414
|
if (!t)
|
|
2412
2415
|
throw new Error(
|
|
2413
2416
|
`Document ${this.source}-${this.docId} has no model file yet.`
|
|
@@ -2424,15 +2427,15 @@ class Ws {
|
|
|
2424
2427
|
async sync(t) {
|
|
2425
2428
|
var h;
|
|
2426
2429
|
const e = await a(this, p, ct).call(this, !0);
|
|
2427
|
-
let s = await a(this, p,
|
|
2430
|
+
let s = await a(this, p, Ot).call(this) ?? {
|
|
2428
2431
|
model: this.docId,
|
|
2429
2432
|
commits: []
|
|
2430
2433
|
};
|
|
2431
|
-
const r =
|
|
2434
|
+
const r = Oe(s.commits);
|
|
2432
2435
|
if (t.expectedLatestGuid !== void 0 && (r == null ? void 0 : r.guid) !== t.expectedLatestGuid)
|
|
2433
|
-
throw new
|
|
2436
|
+
throw new ve(t.expectedLatestGuid, r == null ? void 0 : r.guid);
|
|
2434
2437
|
const i = {
|
|
2435
|
-
guid:
|
|
2438
|
+
guid: zt(),
|
|
2436
2439
|
...r ? { parents: [r.guid] } : {},
|
|
2437
2440
|
author: t.author,
|
|
2438
2441
|
source: t.source,
|
|
@@ -2441,10 +2444,10 @@ class Ws {
|
|
|
2441
2444
|
...t.userId ? { userId: t.userId } : {},
|
|
2442
2445
|
...(h = t.appliedOps) != null && h.length ? { appliedOps: t.appliedOps } : {},
|
|
2443
2446
|
changes: t.changes,
|
|
2444
|
-
counts:
|
|
2447
|
+
counts: Qs(t.changes)
|
|
2445
2448
|
};
|
|
2446
|
-
if (t.model && (await a(this, p,
|
|
2447
|
-
const u = await a(this, p,
|
|
2449
|
+
if (t.model && (await a(this, p, Ge).call(this, e, t.model), i.full = !0), t.delta) {
|
|
2450
|
+
const u = await a(this, p, kt).call(this);
|
|
2448
2451
|
if (!u)
|
|
2449
2452
|
throw new Error(
|
|
2450
2453
|
"A delta needs the model file to hang from: sync a full model first."
|
|
@@ -2457,15 +2460,15 @@ class Ws {
|
|
|
2457
2460
|
f._id ?? f.id
|
|
2458
2461
|
);
|
|
2459
2462
|
}
|
|
2460
|
-
const o = await a(this, p,
|
|
2463
|
+
const o = await a(this, p, Ot).call(this);
|
|
2461
2464
|
if (o) {
|
|
2462
2465
|
s = o;
|
|
2463
|
-
const u =
|
|
2466
|
+
const u = Oe(s.commits);
|
|
2464
2467
|
if (t.expectedLatestGuid !== void 0 && (u == null ? void 0 : u.guid) !== t.expectedLatestGuid)
|
|
2465
|
-
throw new
|
|
2468
|
+
throw new ve(t.expectedLatestGuid, u == null ? void 0 : u.guid);
|
|
2466
2469
|
u && !i.parents && (i.parents = [u.guid]);
|
|
2467
2470
|
}
|
|
2468
|
-
return s.commits.push(i), await a(this, p,
|
|
2471
|
+
return s.commits.push(i), await a(this, p, At).call(this, e, Se, s), i;
|
|
2469
2472
|
}
|
|
2470
2473
|
// ─── Suggestions (change requests) ────────────────────────────────────────
|
|
2471
2474
|
/** Every suggestion in the document's queue, pending or resolved. */
|
|
@@ -2482,8 +2485,8 @@ class Ws {
|
|
|
2482
2485
|
* uploaded as a hidden file under the suggestions index.
|
|
2483
2486
|
*/
|
|
2484
2487
|
async suggest(t) {
|
|
2485
|
-
const e = await a(this, p, ct).call(this, !0), s = await a(this, p, ht).call(this) ?? { schema:
|
|
2486
|
-
opId:
|
|
2488
|
+
const e = await a(this, p, ct).call(this, !0), s = await a(this, p, ht).call(this) ?? { schema: ke, ops: [] }, r = await a(this, p, St).call(this, it), i = {
|
|
2489
|
+
opId: t.opId ?? zt(),
|
|
2487
2490
|
title: t.title,
|
|
2488
2491
|
verb: t.verb,
|
|
2489
2492
|
author: t.author,
|
|
@@ -2495,7 +2498,7 @@ class Ws {
|
|
|
2495
2498
|
...t.baseCommitGuid ? { baseCommitGuid: t.baseCommitGuid } : {}
|
|
2496
2499
|
};
|
|
2497
2500
|
if (t.payload) {
|
|
2498
|
-
const h = r ?? await a(this, p,
|
|
2501
|
+
const h = r ?? await a(this, p, Xt).call(this, e, it, s), u = await this.client.createHiddenFile(
|
|
2499
2502
|
t.payload,
|
|
2500
2503
|
h.id
|
|
2501
2504
|
);
|
|
@@ -2504,7 +2507,7 @@ class Ws {
|
|
|
2504
2507
|
);
|
|
2505
2508
|
}
|
|
2506
2509
|
const o = await a(this, p, ht).call(this) ?? s;
|
|
2507
|
-
return o.schema ?? (o.schema =
|
|
2510
|
+
return o.schema ?? (o.schema = ke), o.ops.push(i), await a(this, p, At).call(this, e, it, o), i;
|
|
2508
2511
|
}
|
|
2509
2512
|
/** A suggestion's .frag payload. */
|
|
2510
2513
|
async suggestionPayload(t) {
|
|
@@ -2523,7 +2526,7 @@ class Ws {
|
|
|
2523
2526
|
const r = await a(this, p, ht).call(this), i = r == null ? void 0 : r.ops.find((o) => o.opId === t);
|
|
2524
2527
|
if (!r || !i)
|
|
2525
2528
|
throw new Error(`No suggestion ${t} in this document's queue.`);
|
|
2526
|
-
return Object.assign(i, e), await a(this, p,
|
|
2529
|
+
return Object.assign(i, e), await a(this, p, At).call(this, s, it, r), i;
|
|
2527
2530
|
}
|
|
2528
2531
|
}
|
|
2529
2532
|
L = new WeakMap(), p = new WeakSet(), at = function() {
|
|
@@ -2535,10 +2538,10 @@ L = new WeakMap(), p = new WeakSet(), at = function() {
|
|
|
2535
2538
|
throw new Error(
|
|
2536
2539
|
`Project ${this.project.projectId} has no connected documents yet.`
|
|
2537
2540
|
);
|
|
2538
|
-
const
|
|
2541
|
+
const s = await this.client.listFolders({
|
|
2539
2542
|
parentFolderId: e,
|
|
2540
2543
|
projectId: this.project.projectId
|
|
2541
|
-
})).find(
|
|
2544
|
+
}), r = He(s, e).find(
|
|
2542
2545
|
(o) => String(o.name ?? "") === l(this, p, at)
|
|
2543
2546
|
);
|
|
2544
2547
|
if (r)
|
|
@@ -2553,79 +2556,79 @@ L = new WeakMap(), p = new WeakSet(), at = function() {
|
|
|
2553
2556
|
this.project.projectId
|
|
2554
2557
|
);
|
|
2555
2558
|
return b(this, L, Y(i)), l(this, L);
|
|
2556
|
-
},
|
|
2559
|
+
}, Wt = async function() {
|
|
2557
2560
|
const t = await a(this, p, ct).call(this, !1);
|
|
2558
2561
|
return (await this.client.listFiles({ folderId: t })).map((s) => ({
|
|
2559
2562
|
id: Y(s),
|
|
2560
2563
|
name: String(s.name ?? "")
|
|
2561
2564
|
}));
|
|
2562
|
-
},
|
|
2565
|
+
}, St = async function(t) {
|
|
2563
2566
|
try {
|
|
2564
|
-
return (await a(this, p,
|
|
2567
|
+
return (await a(this, p, Wt).call(this)).find((e) => e.name === t);
|
|
2565
2568
|
} catch {
|
|
2566
2569
|
return;
|
|
2567
2570
|
}
|
|
2568
|
-
},
|
|
2571
|
+
}, kt = async function() {
|
|
2569
2572
|
try {
|
|
2570
|
-
const t = await a(this, p,
|
|
2571
|
-
return t.find((e) => e.name ===
|
|
2572
|
-
(e) => e.name.endsWith(".frag") && !e.name.startsWith(
|
|
2573
|
+
const t = await a(this, p, Wt).call(this);
|
|
2574
|
+
return t.find((e) => e.name === Ws) ?? t.find(
|
|
2575
|
+
(e) => e.name.endsWith(".frag") && !e.name.startsWith(Ks)
|
|
2573
2576
|
);
|
|
2574
2577
|
} catch {
|
|
2575
2578
|
return;
|
|
2576
2579
|
}
|
|
2577
|
-
},
|
|
2578
|
-
const e = await a(this, p,
|
|
2580
|
+
}, Kt = async function(t) {
|
|
2581
|
+
const e = await a(this, p, St).call(this, t);
|
|
2579
2582
|
if (!e) return;
|
|
2580
2583
|
const r = await (await this.client.downloadFile(e.id)).text();
|
|
2581
2584
|
if (r.trim())
|
|
2582
2585
|
return JSON.parse(r);
|
|
2583
|
-
},
|
|
2584
|
-
return a(this, p,
|
|
2586
|
+
}, Ot = function() {
|
|
2587
|
+
return a(this, p, Kt).call(this, Se);
|
|
2585
2588
|
}, ht = function() {
|
|
2586
|
-
return a(this, p,
|
|
2587
|
-
},
|
|
2589
|
+
return a(this, p, Kt).call(this, it);
|
|
2590
|
+
}, At = async function(t, e, s) {
|
|
2588
2591
|
const r = new Blob([JSON.stringify(s)], {
|
|
2589
2592
|
type: "application/json"
|
|
2590
|
-
}), i = await a(this, p,
|
|
2593
|
+
}), i = await a(this, p, St).call(this, e);
|
|
2591
2594
|
return i ? (await this.client.updateFile(i.id, {
|
|
2592
2595
|
file: r,
|
|
2593
|
-
versionTag:
|
|
2594
|
-
}), i) : await a(this, p,
|
|
2595
|
-
},
|
|
2596
|
+
versionTag: bt()
|
|
2597
|
+
}), i) : await a(this, p, Xt).call(this, t, e, s);
|
|
2598
|
+
}, Xt = async function(t, e, s) {
|
|
2596
2599
|
const r = new Blob([JSON.stringify(s)], {
|
|
2597
2600
|
type: "application/json"
|
|
2598
2601
|
}), i = await this.client.createFile({
|
|
2599
2602
|
file: r,
|
|
2600
2603
|
name: e,
|
|
2601
|
-
versionTag:
|
|
2604
|
+
versionTag: bt(),
|
|
2602
2605
|
parentFolderId: t,
|
|
2603
2606
|
projectId: this.project.projectId
|
|
2604
2607
|
}), o = i.item;
|
|
2605
2608
|
return { id: Y(o ?? i), name: e };
|
|
2606
|
-
},
|
|
2607
|
-
const s = await a(this, p,
|
|
2609
|
+
}, Ge = async function(t, e) {
|
|
2610
|
+
const s = await a(this, p, kt).call(this);
|
|
2608
2611
|
if (s)
|
|
2609
2612
|
return await this.client.updateFile(s.id, {
|
|
2610
2613
|
file: e,
|
|
2611
|
-
versionTag:
|
|
2614
|
+
versionTag: bt()
|
|
2612
2615
|
}), s;
|
|
2613
2616
|
const r = `${l(this, p, at)}.frag`, i = await this.client.createFile({
|
|
2614
2617
|
file: e,
|
|
2615
2618
|
name: r,
|
|
2616
|
-
versionTag:
|
|
2619
|
+
versionTag: bt(),
|
|
2617
2620
|
parentFolderId: t,
|
|
2618
2621
|
projectId: this.project.projectId
|
|
2619
2622
|
}), o = i.item;
|
|
2620
2623
|
return { id: Y(o ?? i), name: r };
|
|
2621
2624
|
};
|
|
2622
|
-
function
|
|
2625
|
+
function Qs(n) {
|
|
2623
2626
|
const t = { added: 0, modified: 0, removed: 0 };
|
|
2624
2627
|
for (const e of n)
|
|
2625
2628
|
e.type === "create" ? t.added++ : e.type === "delete" ? t.removed++ : t.modified++;
|
|
2626
2629
|
return t;
|
|
2627
2630
|
}
|
|
2628
|
-
function
|
|
2631
|
+
function Ve(n) {
|
|
2629
2632
|
var u;
|
|
2630
2633
|
if (n.length <= 1)
|
|
2631
2634
|
return n.forEach((f, y) => f.ordinal = y), [...n];
|
|
@@ -2652,20 +2655,21 @@ function Me(n) {
|
|
|
2652
2655
|
h.has(f.guid) || i.push(f);
|
|
2653
2656
|
return i.forEach((f, y) => f.ordinal = y), i;
|
|
2654
2657
|
}
|
|
2655
|
-
function
|
|
2656
|
-
const t =
|
|
2658
|
+
function Oe(n) {
|
|
2659
|
+
const t = Ve(n);
|
|
2657
2660
|
return t[t.length - 1];
|
|
2658
2661
|
}
|
|
2659
|
-
function
|
|
2662
|
+
function zt() {
|
|
2660
2663
|
const n = globalThis.crypto;
|
|
2661
2664
|
return n != null && n.randomUUID ? n.randomUUID() : "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (t) => {
|
|
2662
2665
|
const e = Math.random() * 16 | 0;
|
|
2663
2666
|
return (t === "x" ? e : e & 3 | 8).toString(16);
|
|
2664
2667
|
});
|
|
2665
2668
|
}
|
|
2666
|
-
var j;
|
|
2667
|
-
class
|
|
2669
|
+
var j, ft, Qt;
|
|
2670
|
+
class Zs {
|
|
2668
2671
|
constructor(t) {
|
|
2672
|
+
_(this, ft);
|
|
2669
2673
|
_(this, j, /* @__PURE__ */ new Map());
|
|
2670
2674
|
this.client = t;
|
|
2671
2675
|
}
|
|
@@ -2685,39 +2689,55 @@ class Xs {
|
|
|
2685
2689
|
get(t) {
|
|
2686
2690
|
return l(this, j).get(t);
|
|
2687
2691
|
}
|
|
2692
|
+
/**
|
|
2693
|
+
* Runs a recipe WITHOUT queueing anything: the dry pass. Returns the
|
|
2694
|
+
* recipe's result — title, tallies per rule, targets — so an app can show
|
|
2695
|
+
* what would be proposed before anybody confirms. The payload it may have
|
|
2696
|
+
* built is discarded along with its opId.
|
|
2697
|
+
*/
|
|
2698
|
+
async plan(t, e) {
|
|
2699
|
+
const { result: s } = await a(this, ft, Qt).call(this, t, e);
|
|
2700
|
+
return s;
|
|
2701
|
+
}
|
|
2688
2702
|
/**
|
|
2689
2703
|
* Runs a recipe and queues its suggestion on the target document. Safe to
|
|
2690
2704
|
* call freely: nothing touches the native application until its owner
|
|
2691
|
-
* accepts the suggestion there.
|
|
2705
|
+
* accepts the suggestion there. Use {@link plan} first when the app wants
|
|
2706
|
+
* to show the tallies before queueing.
|
|
2692
2707
|
*/
|
|
2693
2708
|
async run(t, e) {
|
|
2694
|
-
const s =
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
throw new Error(
|
|
2698
|
-
`Recipe "${t}" writes ${s.to}, but the target document belongs to ${e.target.source}.`
|
|
2699
|
-
);
|
|
2700
|
-
const r = this.client.history(e.projectId).doc(e.target.source, e.target.docId), i = await r.latest(), o = await s.run({
|
|
2701
|
-
client: this.client,
|
|
2702
|
-
projectId: e.projectId,
|
|
2703
|
-
targetDoc: r,
|
|
2704
|
-
input: e.input,
|
|
2705
|
-
settings: e.settings ?? {}
|
|
2706
|
-
});
|
|
2707
|
-
return { suggestion: await r.suggest({
|
|
2709
|
+
const { targetDoc: s, base: r, opId: i, result: o } = await a(this, ft, Qt).call(this, t, e);
|
|
2710
|
+
return { suggestion: await s.suggest({
|
|
2711
|
+
opId: i,
|
|
2708
2712
|
title: o.title,
|
|
2709
2713
|
verb: o.verb,
|
|
2710
2714
|
author: e.author,
|
|
2711
2715
|
payload: o.payload,
|
|
2712
2716
|
targets: o.targets,
|
|
2713
2717
|
userId: e.userId,
|
|
2714
|
-
baseCommitGuid:
|
|
2718
|
+
baseCommitGuid: r == null ? void 0 : r.guid
|
|
2715
2719
|
}), result: o };
|
|
2716
2720
|
}
|
|
2717
2721
|
}
|
|
2718
|
-
j = new WeakMap()
|
|
2719
|
-
const
|
|
2720
|
-
|
|
2722
|
+
j = new WeakMap(), ft = new WeakSet(), Qt = async function(t, e) {
|
|
2723
|
+
const s = l(this, j).get(t);
|
|
2724
|
+
if (!s) throw new Error(`No recipe named "${t}" is registered.`);
|
|
2725
|
+
if (s.to !== e.target.source)
|
|
2726
|
+
throw new Error(
|
|
2727
|
+
`Recipe "${t}" writes ${s.to}, but the target document belongs to ${e.target.source}.`
|
|
2728
|
+
);
|
|
2729
|
+
const r = this.client.history(e.projectId).doc(e.target.source, e.target.docId), i = await r.latest(), o = zt(), h = await s.run({
|
|
2730
|
+
client: this.client,
|
|
2731
|
+
projectId: e.projectId,
|
|
2732
|
+
targetDoc: r,
|
|
2733
|
+
opId: o,
|
|
2734
|
+
input: e.input,
|
|
2735
|
+
settings: e.settings ?? {}
|
|
2736
|
+
});
|
|
2737
|
+
return { recipe: s, targetDoc: r, base: i, opId: o, result: h };
|
|
2738
|
+
};
|
|
2739
|
+
const Ae = 100;
|
|
2740
|
+
function tn(n) {
|
|
2721
2741
|
try {
|
|
2722
2742
|
const t = JSON.parse(n);
|
|
2723
2743
|
if (t && typeof t == "object") {
|
|
@@ -2732,14 +2752,14 @@ function zs(n) {
|
|
|
2732
2752
|
}
|
|
2733
2753
|
return {};
|
|
2734
2754
|
}
|
|
2735
|
-
function
|
|
2755
|
+
function en(n) {
|
|
2736
2756
|
if (!n || typeof n != "object") return;
|
|
2737
2757
|
const t = n.retryAfter;
|
|
2738
2758
|
return typeof t == "number" && Number.isFinite(t) && t >= 0 ? t : void 0;
|
|
2739
2759
|
}
|
|
2740
|
-
class
|
|
2760
|
+
class fe extends Error {
|
|
2741
2761
|
constructor(e, s, r, i) {
|
|
2742
|
-
const o =
|
|
2762
|
+
const o = tn(r);
|
|
2743
2763
|
super(o.message ?? `${s || "Request failed"} (${e})`);
|
|
2744
2764
|
T(this, "status");
|
|
2745
2765
|
T(this, "code");
|
|
@@ -2750,11 +2770,11 @@ class le extends Error {
|
|
|
2750
2770
|
* from `details.retryAfter`. Only present on rate-limited (429) responses.
|
|
2751
2771
|
*/
|
|
2752
2772
|
T(this, "retryAfter");
|
|
2753
|
-
this.name = "RequestError", this.status = e, this.code = o.code, this.details = o.details, this.body = r, this.retryAfter = i ??
|
|
2773
|
+
this.name = "RequestError", this.status = e, this.code = o.code, this.details = o.details, this.body = r, this.retryAfter = i ?? en(o.details);
|
|
2754
2774
|
}
|
|
2755
2775
|
}
|
|
2756
|
-
const C = "item/folder", m = "item", U = "processor",
|
|
2757
|
-
function
|
|
2776
|
+
const C = "item/folder", m = "item", U = "processor", sn = "npm-registry", B = "hidden", Ft = "FILE", Ut = "TOOL", Dt = "APP", nn = 500, Ie = 3e4, rn = 0.25, on = (n) => new Promise((t) => setTimeout(t, n));
|
|
2777
|
+
function an(n) {
|
|
2758
2778
|
var r, i;
|
|
2759
2779
|
const t = (i = (r = n.headers) == null ? void 0 : r.get) == null ? void 0 : i.call(r, "Retry-After");
|
|
2760
2780
|
if (!t) return;
|
|
@@ -2764,18 +2784,18 @@ function nn(n) {
|
|
|
2764
2784
|
if (!Number.isNaN(s))
|
|
2765
2785
|
return Math.max(0, (s - Date.now()) / 1e3);
|
|
2766
2786
|
}
|
|
2767
|
-
function
|
|
2768
|
-
return n instanceof
|
|
2787
|
+
function cn(n) {
|
|
2788
|
+
return n instanceof fe ? n.status === 429 || n.status >= 500 : !0;
|
|
2769
2789
|
}
|
|
2770
|
-
function
|
|
2790
|
+
function hn(n, t) {
|
|
2771
2791
|
const e = Math.min(
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
), s = e *
|
|
2775
|
-
return r != null ? Math.min(r,
|
|
2792
|
+
nn * 2 ** t,
|
|
2793
|
+
Ie
|
|
2794
|
+
), s = e * rn * Math.random(), r = n instanceof fe && n.retryAfter != null ? n.retryAfter * 1e3 : void 0;
|
|
2795
|
+
return r != null ? Math.min(r, Ie) + s : e + s;
|
|
2776
2796
|
}
|
|
2777
|
-
var c,
|
|
2778
|
-
const
|
|
2797
|
+
var c, te, d, D, pt, lt, It, xt, ee, se, Je;
|
|
2798
|
+
const pe = class pe {
|
|
2779
2799
|
/**
|
|
2780
2800
|
* Creates a new EngineServicesClient instance.
|
|
2781
2801
|
* @param accessToken - API access token (obtained from the platform dashboard)
|
|
@@ -2803,7 +2823,7 @@ const ue = class ue {
|
|
|
2803
2823
|
* Populated automatically when using {@link fromPlatformContext}.
|
|
2804
2824
|
*/
|
|
2805
2825
|
T(this, "context");
|
|
2806
|
-
_(this,
|
|
2826
|
+
_(this, pt);
|
|
2807
2827
|
const { retries: r = 0, useBearer: i = !1, localServerUrl: o } = s || {};
|
|
2808
2828
|
let h = e;
|
|
2809
2829
|
if (h.charAt(h.length - 1) === "/" && (h = h.slice(0, -1)), this.apiUrl = `${h}/api`, this.accessToken = t, this.wsUrl = h, this.retries = r, this.useBearer = i, this.context = { appId: "", projectId: "", accessToken: t, apiUrl: e }, o) {
|
|
@@ -2828,7 +2848,7 @@ const ue = class ue {
|
|
|
2828
2848
|
* ```
|
|
2829
2849
|
*/
|
|
2830
2850
|
static fromPlatformContext(t) {
|
|
2831
|
-
const e = (typeof window < "u" ? window.__THATOPEN_CONTEXT__ : null) || { appId: "", projectId: "", accessToken: "", apiUrl: "" }, s = new
|
|
2851
|
+
const e = (typeof window < "u" ? window.__THATOPEN_CONTEXT__ : null) || { appId: "", projectId: "", accessToken: "", apiUrl: "" }, s = new pe(e.accessToken, e.apiUrl, {
|
|
2832
2852
|
...t,
|
|
2833
2853
|
useBearer: !0
|
|
2834
2854
|
});
|
|
@@ -2914,9 +2934,9 @@ const ue = class ue {
|
|
|
2914
2934
|
*/
|
|
2915
2935
|
async listFiles(t) {
|
|
2916
2936
|
const { folderId: e, archived: s, projectId: r } = t || {};
|
|
2917
|
-
return e ? await a(this, c, d).call(this, "GET", `${C}/${e}/items`, { query: { itemType:
|
|
2937
|
+
return e ? await a(this, c, d).call(this, "GET", `${C}/${e}/items`, { query: { itemType: Ft, archived: s } }) : await a(this, c, d).call(this, "GET", `${m}`, {
|
|
2918
2938
|
query: {
|
|
2919
|
-
itemType:
|
|
2939
|
+
itemType: Ft,
|
|
2920
2940
|
archived: s,
|
|
2921
2941
|
...r && { projectId: r }
|
|
2922
2942
|
}
|
|
@@ -2929,7 +2949,7 @@ const ue = class ue {
|
|
|
2929
2949
|
* @returns The file item, optionally with version history.
|
|
2930
2950
|
*/
|
|
2931
2951
|
async getFile(t, e) {
|
|
2932
|
-
return await a(this, c,
|
|
2952
|
+
return await a(this, c, se).call(this, t, e);
|
|
2933
2953
|
}
|
|
2934
2954
|
/**
|
|
2935
2955
|
* Uploads a new file.
|
|
@@ -2937,7 +2957,7 @@ const ue = class ue {
|
|
|
2937
2957
|
* @returns The created item and its first version.
|
|
2938
2958
|
*/
|
|
2939
2959
|
async createFile(t) {
|
|
2940
|
-
return await a(this, c, xt).call(this, t,
|
|
2960
|
+
return await a(this, c, xt).call(this, t, Ft);
|
|
2941
2961
|
}
|
|
2942
2962
|
/**
|
|
2943
2963
|
* Updates an existing file. Can rename, move to a different folder,
|
|
@@ -2947,7 +2967,7 @@ const ue = class ue {
|
|
|
2947
2967
|
* @returns The updated item and/or the new version.
|
|
2948
2968
|
*/
|
|
2949
2969
|
async updateFile(t, e) {
|
|
2950
|
-
return await a(this, c,
|
|
2970
|
+
return await a(this, c, ee).call(this, t, e);
|
|
2951
2971
|
}
|
|
2952
2972
|
/**
|
|
2953
2973
|
* Archives (soft-deletes) a file. Can be recovered with {@link recoverFile}.
|
|
@@ -2970,7 +2990,7 @@ const ue = class ue {
|
|
|
2970
2990
|
* @returns A fetch Response containing the file data.
|
|
2971
2991
|
*/
|
|
2972
2992
|
async downloadFile(t, e) {
|
|
2973
|
-
return await a(this, c,
|
|
2993
|
+
return await a(this, c, It).call(this, t, e);
|
|
2974
2994
|
}
|
|
2975
2995
|
/**
|
|
2976
2996
|
* Retrieves the free-JSON metadata for a specific file version.
|
|
@@ -3133,12 +3153,12 @@ const ue = class ue {
|
|
|
3133
3153
|
const { folderId: e, ShowVersions: s, projectId: r } = t || {};
|
|
3134
3154
|
return e ? await a(this, c, d).call(this, "GET", `${C}/${e}/items`, {
|
|
3135
3155
|
query: {
|
|
3136
|
-
itemType:
|
|
3156
|
+
itemType: Ut,
|
|
3137
3157
|
...s && { ShowVersions: s }
|
|
3138
3158
|
}
|
|
3139
3159
|
}) : await a(this, c, d).call(this, "GET", `${m}`, {
|
|
3140
3160
|
query: {
|
|
3141
|
-
itemType:
|
|
3161
|
+
itemType: Ut,
|
|
3142
3162
|
...s && { ShowVersions: s },
|
|
3143
3163
|
...r && { projectId: r }
|
|
3144
3164
|
}
|
|
@@ -3150,7 +3170,7 @@ const ue = class ue {
|
|
|
3150
3170
|
* @param props - Options such as whether to include versions.
|
|
3151
3171
|
*/
|
|
3152
3172
|
async getComponent(t, e) {
|
|
3153
|
-
return await a(this, c,
|
|
3173
|
+
return await a(this, c, se).call(this, t, e);
|
|
3154
3174
|
}
|
|
3155
3175
|
/**
|
|
3156
3176
|
* Creates a new component with the given file and version properties.
|
|
@@ -3159,7 +3179,7 @@ const ue = class ue {
|
|
|
3159
3179
|
*/
|
|
3160
3180
|
async createComponent(t) {
|
|
3161
3181
|
const { componentProps: e } = t;
|
|
3162
|
-
return await a(this, c, xt).call(this, t,
|
|
3182
|
+
return await a(this, c, xt).call(this, t, Ut, e);
|
|
3163
3183
|
}
|
|
3164
3184
|
/**
|
|
3165
3185
|
* Updates an existing component. Can rename, move, and/or upload a new version.
|
|
@@ -3169,7 +3189,7 @@ const ue = class ue {
|
|
|
3169
3189
|
*/
|
|
3170
3190
|
async updateComponent(t, e) {
|
|
3171
3191
|
const { componentProps: s } = e;
|
|
3172
|
-
return await a(this, c,
|
|
3192
|
+
return await a(this, c, ee).call(this, t, e, s);
|
|
3173
3193
|
}
|
|
3174
3194
|
/**
|
|
3175
3195
|
* Downloads a component's full ZIP file. Returns the raw fetch Response.
|
|
@@ -3178,7 +3198,7 @@ const ue = class ue {
|
|
|
3178
3198
|
* @returns A fetch Response containing the ZIP data.
|
|
3179
3199
|
*/
|
|
3180
3200
|
async downloadComponent(t, e) {
|
|
3181
|
-
return await a(this, c,
|
|
3201
|
+
return await a(this, c, It).call(this, t, e);
|
|
3182
3202
|
}
|
|
3183
3203
|
/**
|
|
3184
3204
|
* Downloads only the JavaScript bundle from a component's ZIP.
|
|
@@ -3317,12 +3337,12 @@ return main;`)(...h), y = (f == null ? void 0 : f.componentDefinition) ?? f;
|
|
|
3317
3337
|
const { folderId: e, ShowVersions: s, projectId: r } = t || {};
|
|
3318
3338
|
return e ? await a(this, c, d).call(this, "GET", `${C}/${e}/items`, {
|
|
3319
3339
|
query: {
|
|
3320
|
-
itemType:
|
|
3340
|
+
itemType: Dt,
|
|
3321
3341
|
...s && { ShowVersions: s }
|
|
3322
3342
|
}
|
|
3323
3343
|
}) : await a(this, c, d).call(this, "GET", `${m}`, {
|
|
3324
3344
|
query: {
|
|
3325
|
-
itemType:
|
|
3345
|
+
itemType: Dt,
|
|
3326
3346
|
...s && { ShowVersions: s },
|
|
3327
3347
|
...r && { projectId: r }
|
|
3328
3348
|
}
|
|
@@ -3335,7 +3355,7 @@ return main;`)(...h), y = (f == null ? void 0 : f.componentDefinition) ?? f;
|
|
|
3335
3355
|
*/
|
|
3336
3356
|
async createApp(t) {
|
|
3337
3357
|
const { appProps: e } = t;
|
|
3338
|
-
return await a(this, c, xt).call(this, t,
|
|
3358
|
+
return await a(this, c, xt).call(this, t, Dt, e);
|
|
3339
3359
|
}
|
|
3340
3360
|
/**
|
|
3341
3361
|
* Downloads an app's full ZIP file. Returns the raw fetch Response.
|
|
@@ -3344,7 +3364,7 @@ return main;`)(...h), y = (f == null ? void 0 : f.componentDefinition) ?? f;
|
|
|
3344
3364
|
* @returns A fetch Response containing the ZIP data.
|
|
3345
3365
|
*/
|
|
3346
3366
|
async downloadApp(t, e) {
|
|
3347
|
-
return await a(this, c,
|
|
3367
|
+
return await a(this, c, It).call(this, t, e);
|
|
3348
3368
|
}
|
|
3349
3369
|
/**
|
|
3350
3370
|
* Downloads only the JavaScript bundle from an app's ZIP.
|
|
@@ -3379,7 +3399,7 @@ return main;`)(...h), y = (f == null ? void 0 : f.componentDefinition) ?? f;
|
|
|
3379
3399
|
* @returns The registry, scope, read-only token, and assembled `.npmrc`.
|
|
3380
3400
|
*/
|
|
3381
3401
|
async getNpmCredentials() {
|
|
3382
|
-
return await a(this, c, d).call(this, "GET", `${
|
|
3402
|
+
return await a(this, c, d).call(this, "GET", `${sn}/credentials`);
|
|
3383
3403
|
}
|
|
3384
3404
|
// ─── Execution ───────────────────────────────────────────────────
|
|
3385
3405
|
/**
|
|
@@ -3505,14 +3525,14 @@ return main;`)(...h), y = (f == null ? void 0 : f.componentDefinition) ?? f;
|
|
|
3505
3525
|
* or write it; the storage underneath is private and will move.
|
|
3506
3526
|
*/
|
|
3507
3527
|
history(t) {
|
|
3508
|
-
return new
|
|
3528
|
+
return new Xs(this, t);
|
|
3509
3529
|
}
|
|
3510
3530
|
/**
|
|
3511
3531
|
* The recipe registry and runner: scripts that write change requests in a
|
|
3512
3532
|
* native application's language. See `src/core/recipes.ts`.
|
|
3513
3533
|
*/
|
|
3514
3534
|
get recipes() {
|
|
3515
|
-
return l(this,
|
|
3535
|
+
return l(this, pt) ?? b(this, pt, new Zs(this)), l(this, pt);
|
|
3516
3536
|
}
|
|
3517
3537
|
// ─── Hidden Files ────────────────────────────────────────────────
|
|
3518
3538
|
/**
|
|
@@ -3756,16 +3776,16 @@ return main;`)(...h), y = (f == null ? void 0 : f.componentDefinition) ?? f;
|
|
|
3756
3776
|
return await a(this, c, d).call(this, "DELETE", `${m}/${encodeURIComponent(t)}/version/${encodeURIComponent(e)}`);
|
|
3757
3777
|
}
|
|
3758
3778
|
};
|
|
3759
|
-
c = new WeakSet(),
|
|
3779
|
+
c = new WeakSet(), te = function(t) {
|
|
3760
3780
|
return `${this.apiUrl}/${t}`;
|
|
3761
3781
|
}, d = async function(t, e, s) {
|
|
3762
|
-
const { body: r, query: i, contentType: o, retries: h, responseType: u, retryAttempt: f } = s || {}, y = a(this, c,
|
|
3782
|
+
const { body: r, query: i, contentType: o, retries: h, responseType: u, retryAttempt: f } = s || {}, y = a(this, c, te).call(this, e), w = a(this, c, Je).call(this, i), R = await this.resolveAccessToken(), Qe = {
|
|
3763
3783
|
...w,
|
|
3764
3784
|
...this.useBearer ? {} : { accessToken: R }
|
|
3765
3785
|
};
|
|
3766
3786
|
try {
|
|
3767
|
-
const
|
|
3768
|
-
y + "?" + new URLSearchParams(
|
|
3787
|
+
const I = await fetch(
|
|
3788
|
+
y + "?" + new URLSearchParams(Qe).toString(),
|
|
3769
3789
|
{
|
|
3770
3790
|
method: t,
|
|
3771
3791
|
headers: {
|
|
@@ -3776,31 +3796,31 @@ c = new WeakSet(), zt = function(t) {
|
|
|
3776
3796
|
...r && { body: r }
|
|
3777
3797
|
}
|
|
3778
3798
|
);
|
|
3779
|
-
if (!
|
|
3780
|
-
const K = await
|
|
3781
|
-
throw new
|
|
3782
|
-
|
|
3783
|
-
|
|
3799
|
+
if (!I.ok) {
|
|
3800
|
+
const K = await I.text().then((gt) => gt).catch(() => "");
|
|
3801
|
+
throw new fe(
|
|
3802
|
+
I.status,
|
|
3803
|
+
I.statusText,
|
|
3784
3804
|
K,
|
|
3785
|
-
|
|
3805
|
+
an(I)
|
|
3786
3806
|
);
|
|
3787
3807
|
}
|
|
3788
|
-
return u === "blob" ? await
|
|
3808
|
+
return u === "blob" ? await I.blob() : I.json().then((K) => K).catch(() => {
|
|
3789
3809
|
});
|
|
3790
|
-
} catch (
|
|
3810
|
+
} catch (I) {
|
|
3791
3811
|
const K = h ?? this.retries;
|
|
3792
|
-
if (K > 0 &&
|
|
3793
|
-
const
|
|
3794
|
-
return await
|
|
3812
|
+
if (K > 0 && cn(I)) {
|
|
3813
|
+
const gt = f ?? 0;
|
|
3814
|
+
return await on(hn(I, gt)), await a(this, c, d).call(this, t, e, {
|
|
3795
3815
|
...s,
|
|
3796
3816
|
retries: K - 1,
|
|
3797
|
-
retryAttempt:
|
|
3817
|
+
retryAttempt: gt + 1
|
|
3798
3818
|
});
|
|
3799
3819
|
}
|
|
3800
|
-
throw
|
|
3820
|
+
throw I;
|
|
3801
3821
|
}
|
|
3802
3822
|
}, D = async function(t, e) {
|
|
3803
|
-
const { query: s } = e || {}, r = a(this, c,
|
|
3823
|
+
const { query: s } = e || {}, r = a(this, c, te).call(this, t), i = await this.resolveAccessToken(), o = {
|
|
3804
3824
|
...s,
|
|
3805
3825
|
...this.useBearer ? {} : { accessToken: i }
|
|
3806
3826
|
};
|
|
@@ -3813,13 +3833,13 @@ c = new WeakSet(), zt = function(t) {
|
|
|
3813
3833
|
}
|
|
3814
3834
|
}
|
|
3815
3835
|
);
|
|
3816
|
-
},
|
|
3836
|
+
}, pt = new WeakMap(), lt = async function(t, e) {
|
|
3817
3837
|
if (!t.length) return [];
|
|
3818
3838
|
const s = [];
|
|
3819
|
-
for (let i = 0; i < t.length; i +=
|
|
3820
|
-
s.push(t.slice(i, i +
|
|
3839
|
+
for (let i = 0; i < t.length; i += Ae)
|
|
3840
|
+
s.push(t.slice(i, i + Ae));
|
|
3821
3841
|
return (await Promise.all(s.map(e))).flat();
|
|
3822
|
-
},
|
|
3842
|
+
}, It = async function(t, e) {
|
|
3823
3843
|
const { versionTag: s, withDraft: r } = e || {};
|
|
3824
3844
|
return await a(this, c, D).call(this, `${m}/${t}/download`, {
|
|
3825
3845
|
query: {
|
|
@@ -3832,7 +3852,7 @@ c = new WeakSet(), zt = function(t) {
|
|
|
3832
3852
|
return y.append("file", u), y.append("name", r), y.append("versionTag", i), y.append("itemType", e), o && y.append("folderId", o), h && y.append("projectId", h), s && y.append("extraProps", JSON.stringify(s)), f && y.append("metadata", JSON.stringify(f)), await a(this, c, d).call(this, "POST", m, {
|
|
3833
3853
|
body: y
|
|
3834
3854
|
});
|
|
3835
|
-
},
|
|
3855
|
+
}, ee = async function(t, e, s) {
|
|
3836
3856
|
const { name: r, versionTag: i, parentFolderId: o, file: h, metadata: u } = e;
|
|
3837
3857
|
let f, y;
|
|
3838
3858
|
if (h) {
|
|
@@ -3852,19 +3872,19 @@ c = new WeakSet(), zt = function(t) {
|
|
|
3852
3872
|
});
|
|
3853
3873
|
}
|
|
3854
3874
|
return { item: f, version: y };
|
|
3855
|
-
},
|
|
3875
|
+
}, se = async function(t, e) {
|
|
3856
3876
|
const { showVersions: s = !1 } = e || {};
|
|
3857
3877
|
return await a(this, c, d).call(this, "GET", `${m}/${t}`, {
|
|
3858
3878
|
query: { showVersions: s }
|
|
3859
3879
|
});
|
|
3860
|
-
},
|
|
3880
|
+
}, Je = function(t) {
|
|
3861
3881
|
return t && Object.entries(t).filter(([, e]) => e !== void 0).reduce(
|
|
3862
3882
|
(e, [s, r]) => (e[s] = r, e),
|
|
3863
3883
|
{}
|
|
3864
3884
|
);
|
|
3865
3885
|
};
|
|
3866
|
-
let
|
|
3867
|
-
function
|
|
3886
|
+
let Zt = pe;
|
|
3887
|
+
function ln() {
|
|
3868
3888
|
if (typeof window > "u" || window.parent === window)
|
|
3869
3889
|
throw new Error(
|
|
3870
3890
|
"client.channel only works inside a That Open app, which runs in an iframe of the platform."
|
|
@@ -3879,16 +3899,16 @@ function an() {
|
|
|
3879
3899
|
}
|
|
3880
3900
|
};
|
|
3881
3901
|
}
|
|
3882
|
-
const
|
|
3883
|
-
function
|
|
3902
|
+
const ne = "channel:", un = 1e4;
|
|
3903
|
+
function $t(n) {
|
|
3884
3904
|
try {
|
|
3885
3905
|
n();
|
|
3886
3906
|
} catch (t) {
|
|
3887
3907
|
console.error("[channel] a listener threw:", t);
|
|
3888
3908
|
}
|
|
3889
3909
|
}
|
|
3890
|
-
var q, k, O, Q, Z, tt, S,
|
|
3891
|
-
class
|
|
3910
|
+
var q, k, O, Q, Z, tt, S, re, ie, z;
|
|
3911
|
+
class Ye {
|
|
3892
3912
|
constructor(t, e) {
|
|
3893
3913
|
_(this, S);
|
|
3894
3914
|
_(this, q, !1);
|
|
@@ -3912,11 +3932,11 @@ class Ge {
|
|
|
3912
3932
|
* refuses or does not answer in time. Joining twice is harmless.
|
|
3913
3933
|
*/
|
|
3914
3934
|
join() {
|
|
3915
|
-
return l(this, q) ? Promise.resolve() : a(this, S,
|
|
3935
|
+
return l(this, q) ? Promise.resolve() : a(this, S, re).call(this, "joined", this.controls.join);
|
|
3916
3936
|
}
|
|
3917
3937
|
/** Leaves the room. Handlers stay registered, so `join()` resumes them. */
|
|
3918
3938
|
leave() {
|
|
3919
|
-
return !l(this, q) && !l(this, O).some((t) => t.want === "joined") ? Promise.resolve() : a(this, S,
|
|
3939
|
+
return !l(this, q) && !l(this, O).some((t) => t.want === "joined") ? Promise.resolve() : a(this, S, re).call(this, "left", this.controls.leave);
|
|
3920
3940
|
}
|
|
3921
3941
|
/** Fires when `joined` or `peers` changes. Returns a function that stops it. */
|
|
3922
3942
|
onChange(t) {
|
|
@@ -3930,11 +3950,11 @@ class Ge {
|
|
|
3930
3950
|
}
|
|
3931
3951
|
/** @internal */
|
|
3932
3952
|
applyJoined() {
|
|
3933
|
-
b(this, q, !0), a(this, S,
|
|
3953
|
+
b(this, q, !0), a(this, S, ie).call(this, "joined"), a(this, S, z).call(this);
|
|
3934
3954
|
}
|
|
3935
3955
|
/** @internal */
|
|
3936
3956
|
applyLeft() {
|
|
3937
|
-
b(this, q, !1), b(this, k, []), a(this, S,
|
|
3957
|
+
b(this, q, !1), b(this, k, []), a(this, S, ie).call(this, "left"), a(this, S, z).call(this);
|
|
3938
3958
|
}
|
|
3939
3959
|
/** @internal */
|
|
3940
3960
|
applyPeers(t) {
|
|
@@ -3942,12 +3962,12 @@ class Ge {
|
|
|
3942
3962
|
}
|
|
3943
3963
|
/** @internal */
|
|
3944
3964
|
applyPeerJoined(t) {
|
|
3945
|
-
!l(this, q) || l(this, k).some((e) => e.from === t.from) || (b(this, k, [...l(this, k), t]), l(this, Z).forEach((e) =>
|
|
3965
|
+
!l(this, q) || l(this, k).some((e) => e.from === t.from) || (b(this, k, [...l(this, k), t]), l(this, Z).forEach((e) => $t(() => e(t))), a(this, S, z).call(this));
|
|
3946
3966
|
}
|
|
3947
3967
|
/** @internal */
|
|
3948
3968
|
applyPeerLeft(t) {
|
|
3949
3969
|
const e = l(this, k).find((s) => s.from === t);
|
|
3950
|
-
e && (b(this, k, l(this, k).filter((s) => s.from !== t)), l(this, tt).forEach((s) =>
|
|
3970
|
+
e && (b(this, k, l(this, k).filter((s) => s.from !== t)), l(this, tt).forEach((s) => $t(() => s(e))), a(this, S, z).call(this));
|
|
3951
3971
|
}
|
|
3952
3972
|
/** @internal */
|
|
3953
3973
|
failPending(t) {
|
|
@@ -3960,7 +3980,7 @@ class Ge {
|
|
|
3960
3980
|
this.transport.post(t);
|
|
3961
3981
|
}
|
|
3962
3982
|
}
|
|
3963
|
-
q = new WeakMap(), k = new WeakMap(), O = new WeakMap(), Q = new WeakMap(), Z = new WeakMap(), tt = new WeakMap(), S = new WeakSet(),
|
|
3983
|
+
q = new WeakMap(), k = new WeakMap(), O = new WeakMap(), Q = new WeakMap(), Z = new WeakMap(), tt = new WeakMap(), S = new WeakSet(), re = function(t, e) {
|
|
3964
3984
|
return new Promise((s, r) => {
|
|
3965
3985
|
const i = {
|
|
3966
3986
|
want: t,
|
|
@@ -3972,20 +3992,20 @@ q = new WeakMap(), k = new WeakMap(), O = new WeakMap(), Q = new WeakMap(), Z =
|
|
|
3972
3992
|
`The platform did not confirm ${t === "joined" ? "joining" : "leaving"} in time.`
|
|
3973
3993
|
)
|
|
3974
3994
|
);
|
|
3975
|
-
},
|
|
3995
|
+
}, un)
|
|
3976
3996
|
};
|
|
3977
3997
|
l(this, O).push(i), this.transport.post({ type: "APP_CHANNEL_CONTROL", ...e });
|
|
3978
3998
|
});
|
|
3979
|
-
},
|
|
3999
|
+
}, ie = function(t) {
|
|
3980
4000
|
const e = l(this, O).filter((s) => s.want === t);
|
|
3981
4001
|
b(this, O, l(this, O).filter((s) => s.want !== t)), e.forEach((s) => {
|
|
3982
4002
|
clearTimeout(s.timer), s.resolve();
|
|
3983
4003
|
});
|
|
3984
4004
|
}, z = function() {
|
|
3985
|
-
l(this, Q).forEach((t) =>
|
|
4005
|
+
l(this, Q).forEach((t) => $t(t));
|
|
3986
4006
|
};
|
|
3987
4007
|
var et;
|
|
3988
|
-
class
|
|
4008
|
+
class dn extends Ye {
|
|
3989
4009
|
/** @internal Use `client.channel.collab()`. */
|
|
3990
4010
|
constructor(e) {
|
|
3991
4011
|
super(e, {
|
|
@@ -4007,8 +4027,8 @@ class hn extends Ge {
|
|
|
4007
4027
|
* is not in it, matching what the platform does with a message from outside.
|
|
4008
4028
|
*/
|
|
4009
4029
|
send(e, s) {
|
|
4010
|
-
if (e.startsWith(
|
|
4011
|
-
throw new Error(`Message types starting with '${
|
|
4030
|
+
if (e.startsWith(ne))
|
|
4031
|
+
throw new Error(`Message types starting with '${ne}' are reserved.`);
|
|
4012
4032
|
this.joined && this.post({ type: "APP_CHANNEL_PUBLISH", message: { type: e, payload: s } });
|
|
4013
4033
|
}
|
|
4014
4034
|
accepts(e) {
|
|
@@ -4017,13 +4037,13 @@ class hn extends Ge {
|
|
|
4017
4037
|
async handle(e) {
|
|
4018
4038
|
const s = l(this, et).get(e.type);
|
|
4019
4039
|
if (!(s != null && s.size)) return { handled: !1 };
|
|
4020
|
-
const r =
|
|
4021
|
-
return s.forEach((i) =>
|
|
4040
|
+
const r = We(e);
|
|
4041
|
+
return s.forEach((i) => $t(() => i(e.payload, r))), { handled: !0 };
|
|
4022
4042
|
}
|
|
4023
4043
|
}
|
|
4024
4044
|
et = new WeakMap();
|
|
4025
4045
|
var M;
|
|
4026
|
-
class
|
|
4046
|
+
class fn extends Ye {
|
|
4027
4047
|
/** @internal Use `client.channel.external(kind)`. */
|
|
4028
4048
|
constructor(e, s) {
|
|
4029
4049
|
super(e, {
|
|
@@ -4061,7 +4081,7 @@ class ln extends Ge {
|
|
|
4061
4081
|
const s = l(this, M).get(e.type);
|
|
4062
4082
|
if (!s) return { handled: !1 };
|
|
4063
4083
|
try {
|
|
4064
|
-
return { handled: !0, value: await s(e.payload,
|
|
4084
|
+
return { handled: !0, value: await s(e.payload, We(e)) };
|
|
4065
4085
|
} catch (r) {
|
|
4066
4086
|
return {
|
|
4067
4087
|
handled: !0,
|
|
@@ -4071,7 +4091,7 @@ class ln extends Ge {
|
|
|
4071
4091
|
}
|
|
4072
4092
|
}
|
|
4073
4093
|
M = new WeakMap();
|
|
4074
|
-
function
|
|
4094
|
+
function We(n) {
|
|
4075
4095
|
return {
|
|
4076
4096
|
from: n.from,
|
|
4077
4097
|
at: n.at,
|
|
@@ -4079,7 +4099,7 @@ function Ve(n) {
|
|
|
4079
4099
|
kind: n.kind
|
|
4080
4100
|
};
|
|
4081
4101
|
}
|
|
4082
|
-
function
|
|
4102
|
+
function pn(n) {
|
|
4083
4103
|
const t = n;
|
|
4084
4104
|
if ((t == null ? void 0 : t.type) !== "THATOPEN_CHANNEL_MESSAGE") return null;
|
|
4085
4105
|
const e = t.message;
|
|
@@ -4093,20 +4113,20 @@ function un(n) {
|
|
|
4093
4113
|
kind: typeof e.kind == "string" ? e.kind : void 0
|
|
4094
4114
|
};
|
|
4095
4115
|
}
|
|
4096
|
-
var W,
|
|
4097
|
-
class
|
|
4116
|
+
var W, yt, F, H, G, v, oe, Rt, Ke, Xe, ze, ae;
|
|
4117
|
+
class yn {
|
|
4098
4118
|
constructor(t) {
|
|
4099
4119
|
_(this, v);
|
|
4100
4120
|
_(this, W);
|
|
4101
|
-
_(this,
|
|
4121
|
+
_(this, yt);
|
|
4102
4122
|
_(this, F);
|
|
4103
4123
|
_(this, H, /* @__PURE__ */ new Map());
|
|
4104
4124
|
_(this, G, /* @__PURE__ */ new Set());
|
|
4105
|
-
b(this, W, t), b(this,
|
|
4125
|
+
b(this, W, t), b(this, yt, t.listen((e) => void a(this, v, Ke).call(this, e)));
|
|
4106
4126
|
}
|
|
4107
4127
|
/** The collaboration room for this app. Always the same instance. */
|
|
4108
4128
|
collab() {
|
|
4109
|
-
return l(this, F) ?? b(this, F, new
|
|
4129
|
+
return l(this, F) ?? b(this, F, new dn(l(this, W))), l(this, F);
|
|
4110
4130
|
}
|
|
4111
4131
|
/**
|
|
4112
4132
|
* The room for commands from this account's external tools of one `kind`
|
|
@@ -4116,40 +4136,40 @@ class dn {
|
|
|
4116
4136
|
external(t) {
|
|
4117
4137
|
const e = t ?? "";
|
|
4118
4138
|
let s = l(this, H).get(e);
|
|
4119
|
-
return s || (s = new
|
|
4139
|
+
return s || (s = new fn(l(this, W), t), l(this, H).set(e, s)), s;
|
|
4120
4140
|
}
|
|
4121
4141
|
/** Stops listening. For tests and teardown; an app normally never calls it. */
|
|
4122
4142
|
dispose() {
|
|
4123
|
-
l(this,
|
|
4143
|
+
l(this, yt).call(this);
|
|
4124
4144
|
}
|
|
4125
4145
|
}
|
|
4126
|
-
W = new WeakMap(),
|
|
4146
|
+
W = new WeakMap(), yt = new WeakMap(), F = new WeakMap(), H = new WeakMap(), G = new WeakMap(), v = new WeakSet(), oe = function() {
|
|
4127
4147
|
return [...l(this, F) ? [l(this, F)] : [], ...l(this, H).values()];
|
|
4128
|
-
},
|
|
4148
|
+
}, Rt = function(t, e) {
|
|
4129
4149
|
if (t === "collab") return l(this, F);
|
|
4130
4150
|
if (t === "external")
|
|
4131
4151
|
return l(this, H).get(typeof e == "string" ? e : "");
|
|
4132
|
-
},
|
|
4133
|
-
const e =
|
|
4152
|
+
}, Ke = async function(t) {
|
|
4153
|
+
const e = pn(t);
|
|
4134
4154
|
if (e) {
|
|
4135
|
-
if (e.type.startsWith(
|
|
4136
|
-
a(this, v,
|
|
4155
|
+
if (e.type.startsWith(ne)) {
|
|
4156
|
+
a(this, v, Xe).call(this, e);
|
|
4137
4157
|
return;
|
|
4138
4158
|
}
|
|
4139
|
-
await a(this, v,
|
|
4159
|
+
await a(this, v, ze).call(this, e);
|
|
4140
4160
|
}
|
|
4141
|
-
},
|
|
4161
|
+
}, Xe = function(t) {
|
|
4142
4162
|
var s, r, i;
|
|
4143
4163
|
const e = t.payload ?? {};
|
|
4144
4164
|
switch (t.type) {
|
|
4145
4165
|
case "channel:joined":
|
|
4146
|
-
(s = a(this, v,
|
|
4166
|
+
(s = a(this, v, Rt).call(this, e.scope, e.kind)) == null || s.applyJoined();
|
|
4147
4167
|
break;
|
|
4148
4168
|
case "channel:left":
|
|
4149
|
-
(r = a(this, v,
|
|
4169
|
+
(r = a(this, v, Rt).call(this, e.scope, e.kind)) == null || r.applyLeft();
|
|
4150
4170
|
break;
|
|
4151
4171
|
case "channel:peers":
|
|
4152
|
-
(i = a(this, v,
|
|
4172
|
+
(i = a(this, v, Rt).call(this, e.scope, e.kind)) == null || i.applyPeers(e.peers ?? []);
|
|
4153
4173
|
break;
|
|
4154
4174
|
case "channel:peer-joined":
|
|
4155
4175
|
case "channel:peer-left": {
|
|
@@ -4163,22 +4183,22 @@ W = new WeakMap(), pt = new WeakMap(), F = new WeakMap(), H = new WeakMap(), G =
|
|
|
4163
4183
|
}
|
|
4164
4184
|
case "channel:error": {
|
|
4165
4185
|
const o = new Error(String(t.payload));
|
|
4166
|
-
a(this, v,
|
|
4186
|
+
a(this, v, oe).call(this).map((u) => u.failPending(o)).some(Boolean) || console.error("[channel] error:", t.payload);
|
|
4167
4187
|
break;
|
|
4168
4188
|
}
|
|
4169
4189
|
}
|
|
4170
|
-
},
|
|
4171
|
-
const e = a(this, v,
|
|
4190
|
+
}, ze = async function(t) {
|
|
4191
|
+
const e = a(this, v, oe).call(this).filter((i) => i.accepts(t.scope, t.kind));
|
|
4172
4192
|
let s = !1;
|
|
4173
4193
|
for (const i of e) {
|
|
4174
4194
|
const o = await i.handle(t);
|
|
4175
|
-
o.handled && (s = !0, t.requestId && a(this, v,
|
|
4195
|
+
o.handled && (s = !0, t.requestId && a(this, v, ae).call(this, t.requestId, o));
|
|
4176
4196
|
}
|
|
4177
|
-
t.requestId && t.scope === "external" && e.length > 0 && !s && a(this, v,
|
|
4197
|
+
t.requestId && t.scope === "external" && e.length > 0 && !s && a(this, v, ae).call(this, t.requestId, {
|
|
4178
4198
|
handled: !0,
|
|
4179
4199
|
error: `No handler for "${t.type}".`
|
|
4180
4200
|
});
|
|
4181
|
-
},
|
|
4201
|
+
}, ae = function(t, e) {
|
|
4182
4202
|
l(this, G).has(t) || (l(this, G).add(t), l(this, G).size > 500 && l(this, G).delete(l(this, G).values().next().value), l(this, W).post({
|
|
4183
4203
|
type: "APP_CHANNEL_PUBLISH",
|
|
4184
4204
|
message: {
|
|
@@ -4189,8 +4209,8 @@ W = new WeakMap(), pt = new WeakMap(), F = new WeakMap(), H = new WeakMap(), G =
|
|
|
4189
4209
|
}));
|
|
4190
4210
|
};
|
|
4191
4211
|
const J = "project", X = "notifications";
|
|
4192
|
-
var st,
|
|
4193
|
-
const
|
|
4212
|
+
var st, mt;
|
|
4213
|
+
const ye = class ye extends Zt {
|
|
4194
4214
|
/**
|
|
4195
4215
|
* @param token - A bearer JWT, OR a function returning the current JWT
|
|
4196
4216
|
* (sync or async). When a function is passed, it's invoked before every
|
|
@@ -4202,7 +4222,7 @@ const de = class de extends Xt {
|
|
|
4202
4222
|
constructor(e, s, r) {
|
|
4203
4223
|
super(typeof e == "string" ? e : "", s, { ...r, useBearer: !0 });
|
|
4204
4224
|
_(this, st);
|
|
4205
|
-
_(this,
|
|
4225
|
+
_(this, mt);
|
|
4206
4226
|
typeof e == "function" && b(this, st, e);
|
|
4207
4227
|
}
|
|
4208
4228
|
async resolveAccessToken() {
|
|
@@ -4215,7 +4235,7 @@ const de = class de extends Xt {
|
|
|
4215
4235
|
* carries a fresh JWT on every navigation.
|
|
4216
4236
|
*/
|
|
4217
4237
|
static fromPlatformContext(e) {
|
|
4218
|
-
const s = (typeof window < "u" ? window.__THATOPEN_CONTEXT__ : null) || { appId: "", projectId: "", accessToken: "", apiUrl: "" }, r = new
|
|
4238
|
+
const s = (typeof window < "u" ? window.__THATOPEN_CONTEXT__ : null) || { appId: "", projectId: "", accessToken: "", apiUrl: "" }, r = new ye(s.accessToken, s.apiUrl, e);
|
|
4219
4239
|
return r.context = s, r;
|
|
4220
4240
|
}
|
|
4221
4241
|
/**
|
|
@@ -4243,7 +4263,7 @@ const de = class de extends Xt {
|
|
|
4243
4263
|
* ```
|
|
4244
4264
|
*/
|
|
4245
4265
|
get channel() {
|
|
4246
|
-
return l(this,
|
|
4266
|
+
return l(this, mt) ?? b(this, mt, new yn(ln())), l(this, mt);
|
|
4247
4267
|
}
|
|
4248
4268
|
// ─── Projects (JWT-only backend routes) ──────────────────────────
|
|
4249
4269
|
/**
|
|
@@ -4491,37 +4511,38 @@ const de = class de extends Xt {
|
|
|
4491
4511
|
), () => r.disconnect();
|
|
4492
4512
|
}
|
|
4493
4513
|
};
|
|
4494
|
-
st = new WeakMap(),
|
|
4495
|
-
let
|
|
4496
|
-
const
|
|
4514
|
+
st = new WeakMap(), mt = new WeakMap();
|
|
4515
|
+
let xe = ye;
|
|
4516
|
+
const wn = {
|
|
4497
4517
|
MAX_FIELDS: 200,
|
|
4498
4518
|
MAX_KEY_LENGTH: 50,
|
|
4499
4519
|
MAX_VALUE_LENGTH: 50
|
|
4500
|
-
},
|
|
4520
|
+
}, _n = { uuid: "a3f82c1d-5b74-4e9a-bc30-d7e12f894a61" }, bn = { uuid: "2c9f4e8d-3a1b-4c5e-9d7f-0a2b6c8e1d3f" }, En = { uuid: "b0b5e2a2-0b3a-4a6b-8b1c-0b1c4a6b8b1c" }, vn = { uuid: "d8f3a1c2-6b4e-4f9a-8c1d-2e7b5a9f3c60" }, Tn = { uuid: "3f9c1a7e-6b2d-4e18-9a5c-7d0e2f4b6c81" }, Sn = { uuid: "2c4ae432-fc24-43e9-9783-0c960c674e96" }, kn = { uuid: "6f3a9c2e-8b1d-4e6a-9c3f-1d7b5a8e2c4f" }, On = { uuid: "69af63aa-19ba-4fc7-b17b-75647bac1d76" }, An = { uuid: "234f1416-528d-452a-9cc9-a16c5239b2eb" };
|
|
4501
4521
|
export {
|
|
4502
|
-
|
|
4503
|
-
|
|
4504
|
-
|
|
4505
|
-
|
|
4506
|
-
|
|
4507
|
-
|
|
4508
|
-
|
|
4509
|
-
|
|
4510
|
-
|
|
4511
|
-
|
|
4512
|
-
|
|
4513
|
-
|
|
4514
|
-
|
|
4515
|
-
|
|
4516
|
-
|
|
4517
|
-
|
|
4518
|
-
|
|
4519
|
-
|
|
4520
|
-
|
|
4521
|
-
|
|
4522
|
-
|
|
4523
|
-
|
|
4524
|
-
|
|
4525
|
-
|
|
4522
|
+
_n as CDEManager,
|
|
4523
|
+
yn as ChannelClient,
|
|
4524
|
+
Ye as ChannelRoom,
|
|
4525
|
+
bn as ClashesManager,
|
|
4526
|
+
dn as CollabRoom,
|
|
4527
|
+
Zt as EngineServicesClient,
|
|
4528
|
+
fn as ExternalRoom,
|
|
4529
|
+
En as FileList,
|
|
4530
|
+
zs as FlowDoc,
|
|
4531
|
+
vn as GISManager,
|
|
4532
|
+
Tn as GitHistoryManager,
|
|
4533
|
+
Sn as HelloWorld,
|
|
4534
|
+
wn as METADATA_LIMITS,
|
|
4535
|
+
xe as PlatformClient,
|
|
4536
|
+
Xs as ProjectHistory,
|
|
4537
|
+
kn as ProjectManager,
|
|
4538
|
+
Zs as Recipes,
|
|
4539
|
+
fe as RequestError,
|
|
4540
|
+
Ae as STORAGE_BATCH_MAX,
|
|
4541
|
+
ve as StaleHistoryError,
|
|
4542
|
+
On as TopicsManager,
|
|
4543
|
+
An as UIManager,
|
|
4544
|
+
zt as mintGuid,
|
|
4545
|
+
Ve as orderByGraph,
|
|
4546
|
+
ln as windowTransport
|
|
4526
4547
|
};
|
|
4527
4548
|
//# sourceMappingURL=index.es.js.map
|