@thatopen/services 0.3.16 → 0.5.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/README.md +62 -62
- package/dist/cli/commands/rhino.d.ts +11 -0
- package/dist/cli/lib/plugin-install.d.ts +24 -0
- package/dist/cli.js +124 -1
- package/dist/core/client.d.ts +1 -0
- package/dist/core/platform-client.d.ts +7 -0
- package/dist/index.cjs.js +2 -2
- package/dist/index.es.js +382 -370
- package/dist/vite-env.d.ts +1 -1
- package/docs/ai-quickstart.md +130 -130
- package/docs/cli/create.md +29 -29
- package/docs/cli/local-server.md +38 -38
- package/docs/cli/login.md +32 -32
- package/docs/cli/publish.md +31 -31
- package/docs/cli/run.md +26 -26
- package/docs/cli/serve.md +43 -43
- package/docs/cli/swap.md +30 -30
- package/docs/cloud/GaussianSplatConverter.md +43 -43
- package/docs/cloud/PointCloudConverter.md +53 -53
- package/docs/revit-collab-quickstart.md +256 -256
- package/package.json +95 -95
- package/resources/AGENTS.md +40 -40
- package/src/built-in/CDEManager/example.ts +214 -214
- package/src/built-in/CDEManager/examples/FileEditing/example.ts +226 -226
- package/src/built-in/CDEManager/examples/FileMoves/example.ts +186 -186
- package/src/built-in/CDEManager/examples/FileOperations/example.ts +295 -295
- package/src/built-in/CDEManager/examples/FileTransfers/example.ts +210 -210
- package/src/built-in/CDEManager/examples/FolderManagement/example.ts +230 -230
- package/src/built-in/CDEManager/examples/MetadataSchema/example.ts +230 -230
- package/src/built-in/CDEManager/examples/MetadataViews/example.ts +166 -166
- package/src/built-in/CDEManager/examples/ProjectConfig/example.ts +177 -177
- package/src/built-in/ClashesManager/example.ts +283 -283
- package/src/built-in/UIManager/src/app/example.ts +97 -97
- package/src/built-in/UIManager/src/app/examples/AppState/example.ts +140 -140
- package/src/built-in/UIManager/src/app/examples/Banner/example.ts +159 -159
- package/src/built-in/UIManager/src/app/examples/Contexts/example.ts +123 -123
- package/src/built-in/UIManager/src/app/examples/FileDrop/example.ts +124 -124
- package/src/built-in/UIManager/src/app/examples/FloatingLayout/example.ts +90 -90
- package/src/built-in/UIManager/src/app/examples/Modal/example.ts +163 -163
- package/src/built-in/UIManager/src/app/examples/Notifications/example.ts +133 -133
- package/src/built-in/UIManager/src/app/examples/Sidebar/example.ts +102 -102
- package/src/cli/templates/app/README.md +217 -217
- package/src/cli/templates/app/index.html +35 -35
- package/src/cli/templates/app/package.json +32 -32
- package/src/cli/templates/app/src/app.ts +37 -37
- package/src/cli/templates/app/src/assets/tool-placeholder.ts +50 -50
- package/src/cli/templates/app/src/bim-components/CloudRunner/index.ts +95 -95
- package/src/cli/templates/app/src/bim-components/CloudRunner/src/index.ts +1 -1
- package/src/cli/templates/app/src/bim-components/CloudRunner/src/types.ts +5 -5
- package/src/cli/templates/app/src/bim-components/index.ts +1 -1
- package/src/cli/templates/app/src/globals.ts +1 -1
- package/src/cli/templates/app/src/main.ts +199 -199
- package/src/cli/templates/app/src/setups/reality-capture/lib/hidden-tiles-plugin.ts +88 -88
- package/src/cli/templates/app/src/setups/reality-capture/lib/point-tile-plugin.ts +166 -166
- package/src/cli/templates/app/src/setups/reality-capture/lib/render-frame.ts +31 -31
- package/src/cli/templates/app/src/setups/reality-capture/lib/splat-tile-plugin.ts +51 -51
- package/src/cli/templates/app/src/setups/reality-capture-viewer.ts +1383 -1383
- package/src/cli/templates/app/src/ui-components/app-info-section/index.ts +26 -26
- package/src/cli/templates/app/src/ui-components/app-info-section/src/index.ts +1 -1
- package/src/cli/templates/app/src/ui-components/app-info-section/src/types.ts +15 -15
- package/src/cli/templates/app/src/ui-components/cloud-runner-section/index.ts +37 -37
- package/src/cli/templates/app/src/ui-components/cloud-runner-section/src/index.ts +1 -1
- package/src/cli/templates/app/src/ui-components/cloud-runner-section/src/types.ts +14 -14
- package/src/cli/templates/app/src/ui-components/index.ts +2 -2
- package/src/cli/templates/app/tsconfig.json +16 -16
- package/src/cli/templates/app/vite.config.js +57 -57
- package/src/cli/templates/cloud-component/README.md +205 -205
- package/src/cli/templates/cloud-component/_thatopen +5 -5
- package/src/cli/templates/cloud-component/declarations.json +4 -4
- package/src/cli/templates/cloud-component/package.json +21 -21
- package/src/cli/templates/cloud-component/src/main.ts +70 -70
- package/src/cli/templates/cloud-component/tsconfig.json +16 -16
- package/src/cli/templates/cloud-component/vite.config.js +46 -46
- package/src/cli/templates/shared/AGENTS.md +8 -8
- package/src/cli/templates/shared/CLAUDE.md +1 -1
- package/src/cli/templates/shared/_gitignore +5 -5
package/dist/index.es.js
CHANGED
|
@@ -1,75 +1,75 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var Me = Object.defineProperty;
|
|
2
|
+
var we = (n) => {
|
|
3
3
|
throw TypeError(n);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
Object.keys(
|
|
18
|
-
|
|
5
|
+
var Ve = (n, e, t) => e in n ? Me(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
|
|
6
|
+
var w = (n, e, t) => Ve(n, typeof e != "symbol" ? e + "" : e, t), J = (n, e, t) => e.has(n) || we("Cannot " + t);
|
|
7
|
+
var Y = (n, e, t) => (J(n, e, "read from private field"), t ? t.call(n) : e.get(n)), K = (n, e, t) => e.has(n) ? we("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t), _e = (n, e, t, s) => (J(n, e, "write to private field"), s ? s.call(n, t) : e.set(n, t), t), c = (n, e, t) => (J(n, e, "access private method"), t);
|
|
8
|
+
const v = /* @__PURE__ */ Object.create(null);
|
|
9
|
+
v.open = "0";
|
|
10
|
+
v.close = "1";
|
|
11
|
+
v.ping = "2";
|
|
12
|
+
v.pong = "3";
|
|
13
|
+
v.message = "4";
|
|
14
|
+
v.upgrade = "5";
|
|
15
|
+
v.noop = "6";
|
|
16
|
+
const U = /* @__PURE__ */ Object.create(null);
|
|
17
|
+
Object.keys(v).forEach((n) => {
|
|
18
|
+
U[v[n]] = n;
|
|
19
19
|
});
|
|
20
|
-
const
|
|
20
|
+
const te = { type: "error", data: "parser error" }, Oe = typeof Blob == "function" || typeof Blob < "u" && Object.prototype.toString.call(Blob) === "[object BlobConstructor]", Se = typeof ArrayBuffer == "function", Ce = (n) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(n) : n && n.buffer instanceof ArrayBuffer, le = ({ type: n, data: e }, t, s) => Oe && e instanceof Blob ? t ? s(e) : be(e, s) : Se && (e instanceof ArrayBuffer || Ce(e)) ? t ? s(e) : be(new Blob([e]), s) : s(v[n] + (e || "")), be = (n, e) => {
|
|
21
21
|
const t = new FileReader();
|
|
22
22
|
return t.onload = function() {
|
|
23
23
|
const s = t.result.split(",")[1];
|
|
24
24
|
e("b" + (s || ""));
|
|
25
25
|
}, t.readAsDataURL(n);
|
|
26
26
|
};
|
|
27
|
-
function
|
|
27
|
+
function Ee(n) {
|
|
28
28
|
return n instanceof Uint8Array ? n : n instanceof ArrayBuffer ? new Uint8Array(n) : new Uint8Array(n.buffer, n.byteOffset, n.byteLength);
|
|
29
29
|
}
|
|
30
|
-
let
|
|
31
|
-
function
|
|
32
|
-
if (
|
|
33
|
-
return n.data.arrayBuffer().then(
|
|
34
|
-
if (
|
|
35
|
-
return e(
|
|
36
|
-
|
|
37
|
-
|
|
30
|
+
let W;
|
|
31
|
+
function He(n, e) {
|
|
32
|
+
if (Oe && n.data instanceof Blob)
|
|
33
|
+
return n.data.arrayBuffer().then(Ee).then(e);
|
|
34
|
+
if (Se && (n.data instanceof ArrayBuffer || Ce(n.data)))
|
|
35
|
+
return e(Ee(n.data));
|
|
36
|
+
le(n, !1, (t) => {
|
|
37
|
+
W || (W = new TextEncoder()), e(W.encode(t));
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
|
-
const
|
|
41
|
-
for (let n = 0; n <
|
|
42
|
-
|
|
43
|
-
const
|
|
40
|
+
const Te = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", P = typeof Uint8Array > "u" ? [] : new Uint8Array(256);
|
|
41
|
+
for (let n = 0; n < Te.length; n++)
|
|
42
|
+
P[Te.charCodeAt(n)] = n;
|
|
43
|
+
const Ge = (n) => {
|
|
44
44
|
let e = n.length * 0.75, t = n.length, s, r = 0, i, o, h, l;
|
|
45
45
|
n[n.length - 1] === "=" && (e--, n[n.length - 2] === "=" && e--);
|
|
46
46
|
const y = new ArrayBuffer(e), d = new Uint8Array(y);
|
|
47
47
|
for (s = 0; s < t; s += 4)
|
|
48
|
-
i =
|
|
48
|
+
i = P[n.charCodeAt(s)], o = P[n.charCodeAt(s + 1)], h = P[n.charCodeAt(s + 2)], l = P[n.charCodeAt(s + 3)], d[r++] = i << 2 | o >> 4, d[r++] = (o & 15) << 4 | h >> 2, d[r++] = (h & 3) << 6 | l & 63;
|
|
49
49
|
return y;
|
|
50
|
-
},
|
|
50
|
+
}, je = typeof ArrayBuffer == "function", fe = (n, e) => {
|
|
51
51
|
if (typeof n != "string")
|
|
52
52
|
return {
|
|
53
53
|
type: "message",
|
|
54
|
-
data:
|
|
54
|
+
data: $e(n, e)
|
|
55
55
|
};
|
|
56
56
|
const t = n.charAt(0);
|
|
57
57
|
return t === "b" ? {
|
|
58
58
|
type: "message",
|
|
59
|
-
data:
|
|
60
|
-
} :
|
|
61
|
-
type:
|
|
59
|
+
data: Je(n.substring(1), e)
|
|
60
|
+
} : U[t] ? n.length > 1 ? {
|
|
61
|
+
type: U[t],
|
|
62
62
|
data: n.substring(1)
|
|
63
63
|
} : {
|
|
64
|
-
type:
|
|
65
|
-
} :
|
|
66
|
-
},
|
|
67
|
-
if (
|
|
68
|
-
const t =
|
|
69
|
-
return
|
|
64
|
+
type: U[t]
|
|
65
|
+
} : te;
|
|
66
|
+
}, Je = (n, e) => {
|
|
67
|
+
if (je) {
|
|
68
|
+
const t = Ge(n);
|
|
69
|
+
return $e(t, e);
|
|
70
70
|
} else
|
|
71
71
|
return { base64: !0, data: n };
|
|
72
|
-
},
|
|
72
|
+
}, $e = (n, e) => {
|
|
73
73
|
switch (e) {
|
|
74
74
|
case "blob":
|
|
75
75
|
return n instanceof Blob ? n : new Blob([n]);
|
|
@@ -77,27 +77,27 @@ const He = (n) => {
|
|
|
77
77
|
default:
|
|
78
78
|
return n instanceof ArrayBuffer ? n : n.buffer;
|
|
79
79
|
}
|
|
80
|
-
},
|
|
80
|
+
}, Re = "", Ye = (n, e) => {
|
|
81
81
|
const t = n.length, s = new Array(t);
|
|
82
82
|
let r = 0;
|
|
83
83
|
n.forEach((i, o) => {
|
|
84
|
-
|
|
85
|
-
s[o] = h, ++r === t && e(s.join(
|
|
84
|
+
le(i, !1, (h) => {
|
|
85
|
+
s[o] = h, ++r === t && e(s.join(Re));
|
|
86
86
|
});
|
|
87
87
|
});
|
|
88
|
-
},
|
|
89
|
-
const t = n.split(
|
|
88
|
+
}, Ke = (n, e) => {
|
|
89
|
+
const t = n.split(Re), s = [];
|
|
90
90
|
for (let r = 0; r < t.length; r++) {
|
|
91
|
-
const i =
|
|
91
|
+
const i = fe(t[r], e);
|
|
92
92
|
if (s.push(i), i.type === "error")
|
|
93
93
|
break;
|
|
94
94
|
}
|
|
95
95
|
return s;
|
|
96
96
|
};
|
|
97
|
-
function
|
|
97
|
+
function We() {
|
|
98
98
|
return new TransformStream({
|
|
99
99
|
transform(n, e) {
|
|
100
|
-
|
|
100
|
+
He(n, (t) => {
|
|
101
101
|
const s = t.length;
|
|
102
102
|
let r;
|
|
103
103
|
if (s < 126)
|
|
@@ -116,11 +116,11 @@ function Ke() {
|
|
|
116
116
|
}
|
|
117
117
|
});
|
|
118
118
|
}
|
|
119
|
-
let
|
|
120
|
-
function
|
|
119
|
+
let z;
|
|
120
|
+
function L(n) {
|
|
121
121
|
return n.reduce((e, t) => e + t.length, 0);
|
|
122
122
|
}
|
|
123
|
-
function
|
|
123
|
+
function I(n, e) {
|
|
124
124
|
if (n[0].length === e)
|
|
125
125
|
return n.shift();
|
|
126
126
|
const t = new Uint8Array(e);
|
|
@@ -129,51 +129,51 @@ function L(n, e) {
|
|
|
129
129
|
t[r] = n[0][s++], s === n[0].length && (n.shift(), s = 0);
|
|
130
130
|
return n.length && s < n[0].length && (n[0] = n[0].slice(s)), t;
|
|
131
131
|
}
|
|
132
|
-
function
|
|
133
|
-
|
|
132
|
+
function ze(n, e) {
|
|
133
|
+
z || (z = new TextDecoder());
|
|
134
134
|
const t = [];
|
|
135
135
|
let s = 0, r = -1, i = !1;
|
|
136
136
|
return new TransformStream({
|
|
137
137
|
transform(o, h) {
|
|
138
138
|
for (t.push(o); ; ) {
|
|
139
139
|
if (s === 0) {
|
|
140
|
-
if (
|
|
140
|
+
if (L(t) < 1)
|
|
141
141
|
break;
|
|
142
|
-
const l =
|
|
142
|
+
const l = I(t, 1);
|
|
143
143
|
i = (l[0] & 128) === 128, r = l[0] & 127, r < 126 ? s = 3 : r === 126 ? s = 1 : s = 2;
|
|
144
144
|
} else if (s === 1) {
|
|
145
|
-
if (
|
|
145
|
+
if (L(t) < 2)
|
|
146
146
|
break;
|
|
147
|
-
const l =
|
|
147
|
+
const l = I(t, 2);
|
|
148
148
|
r = new DataView(l.buffer, l.byteOffset, l.length).getUint16(0), s = 3;
|
|
149
149
|
} else if (s === 2) {
|
|
150
|
-
if (
|
|
150
|
+
if (L(t) < 8)
|
|
151
151
|
break;
|
|
152
|
-
const l =
|
|
152
|
+
const l = I(t, 8), y = new DataView(l.buffer, l.byteOffset, l.length), d = y.getUint32(0);
|
|
153
153
|
if (d > Math.pow(2, 21) - 1) {
|
|
154
|
-
h.enqueue(
|
|
154
|
+
h.enqueue(te);
|
|
155
155
|
break;
|
|
156
156
|
}
|
|
157
157
|
r = d * Math.pow(2, 32) + y.getUint32(4), s = 3;
|
|
158
158
|
} else {
|
|
159
|
-
if (
|
|
159
|
+
if (L(t) < r)
|
|
160
160
|
break;
|
|
161
|
-
const l =
|
|
162
|
-
h.enqueue(
|
|
161
|
+
const l = I(t, r);
|
|
162
|
+
h.enqueue(fe(i ? l : z.decode(l), e)), s = 0;
|
|
163
163
|
}
|
|
164
164
|
if (r === 0 || r > n) {
|
|
165
|
-
h.enqueue(
|
|
165
|
+
h.enqueue(te);
|
|
166
166
|
break;
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
169
|
}
|
|
170
170
|
});
|
|
171
171
|
}
|
|
172
|
-
const
|
|
172
|
+
const Be = 4;
|
|
173
173
|
function g(n) {
|
|
174
|
-
if (n) return
|
|
174
|
+
if (n) return Xe(n);
|
|
175
175
|
}
|
|
176
|
-
function
|
|
176
|
+
function Xe(n) {
|
|
177
177
|
for (var e in g.prototype)
|
|
178
178
|
n[e] = g.prototype[e];
|
|
179
179
|
return n;
|
|
@@ -219,34 +219,34 @@ g.prototype.listeners = function(n) {
|
|
|
219
219
|
g.prototype.hasListeners = function(n) {
|
|
220
220
|
return !!this.listeners(n).length;
|
|
221
221
|
};
|
|
222
|
-
const
|
|
223
|
-
function
|
|
222
|
+
const G = typeof Promise == "function" && typeof Promise.resolve == "function" ? (e) => Promise.resolve().then(e) : (e, t) => t(e, 0), _ = typeof self < "u" ? self : typeof window < "u" ? window : Function("return this")(), Qe = "arraybuffer";
|
|
223
|
+
function xe(n, ...e) {
|
|
224
224
|
return e.reduce((t, s) => (n.hasOwnProperty(s) && (t[s] = n[s]), t), {});
|
|
225
225
|
}
|
|
226
|
-
const
|
|
227
|
-
function
|
|
228
|
-
e.useNativeTimers ? (n.setTimeoutFn =
|
|
229
|
-
}
|
|
230
|
-
const et = 1.33;
|
|
231
|
-
function tt(n) {
|
|
232
|
-
return typeof n == "string" ? st(n) : Math.ceil((n.byteLength || n.size) * et);
|
|
226
|
+
const Ze = _.setTimeout, et = _.clearTimeout;
|
|
227
|
+
function j(n, e) {
|
|
228
|
+
e.useNativeTimers ? (n.setTimeoutFn = Ze.bind(_), n.clearTimeoutFn = et.bind(_)) : (n.setTimeoutFn = _.setTimeout.bind(_), n.clearTimeoutFn = _.clearTimeout.bind(_));
|
|
233
229
|
}
|
|
230
|
+
const tt = 1.33;
|
|
234
231
|
function st(n) {
|
|
232
|
+
return typeof n == "string" ? nt(n) : Math.ceil((n.byteLength || n.size) * tt);
|
|
233
|
+
}
|
|
234
|
+
function nt(n) {
|
|
235
235
|
let e = 0, t = 0;
|
|
236
236
|
for (let s = 0, r = n.length; s < r; s++)
|
|
237
237
|
e = n.charCodeAt(s), e < 128 ? t += 1 : e < 2048 ? t += 2 : e < 55296 || e >= 57344 ? t += 3 : (s++, t += 4);
|
|
238
238
|
return t;
|
|
239
239
|
}
|
|
240
|
-
function
|
|
240
|
+
function Ne() {
|
|
241
241
|
return Date.now().toString(36).substring(3) + Math.random().toString(36).substring(2, 5);
|
|
242
242
|
}
|
|
243
|
-
function
|
|
243
|
+
function rt(n) {
|
|
244
244
|
let e = "";
|
|
245
245
|
for (let t in n)
|
|
246
246
|
n.hasOwnProperty(t) && (e.length && (e += "&"), e += encodeURIComponent(t) + "=" + encodeURIComponent(n[t]));
|
|
247
247
|
return e;
|
|
248
248
|
}
|
|
249
|
-
function
|
|
249
|
+
function it(n) {
|
|
250
250
|
let e = {}, t = n.split("&");
|
|
251
251
|
for (let s = 0, r = t.length; s < r; s++) {
|
|
252
252
|
let i = t[s].split("=");
|
|
@@ -254,12 +254,12 @@ function rt(n) {
|
|
|
254
254
|
}
|
|
255
255
|
return e;
|
|
256
256
|
}
|
|
257
|
-
class
|
|
257
|
+
class ot extends Error {
|
|
258
258
|
constructor(e, t, s) {
|
|
259
259
|
super(e), this.description = t, this.context = s, this.type = "TransportError";
|
|
260
260
|
}
|
|
261
261
|
}
|
|
262
|
-
class
|
|
262
|
+
class pe extends g {
|
|
263
263
|
/**
|
|
264
264
|
* Transport abstract constructor.
|
|
265
265
|
*
|
|
@@ -267,7 +267,7 @@ class fe extends g {
|
|
|
267
267
|
* @protected
|
|
268
268
|
*/
|
|
269
269
|
constructor(e) {
|
|
270
|
-
super(), this.writable = !1,
|
|
270
|
+
super(), this.writable = !1, j(this, e), this.opts = e, this.query = e.query, this.socket = e.socket, this.supportsBinary = !e.forceBase64;
|
|
271
271
|
}
|
|
272
272
|
/**
|
|
273
273
|
* Emits an error.
|
|
@@ -279,7 +279,7 @@ class fe extends g {
|
|
|
279
279
|
* @protected
|
|
280
280
|
*/
|
|
281
281
|
onError(e, t, s) {
|
|
282
|
-
return super.emitReserved("error", new
|
|
282
|
+
return super.emitReserved("error", new ot(e, t, s)), this;
|
|
283
283
|
}
|
|
284
284
|
/**
|
|
285
285
|
* Opens the transport.
|
|
@@ -316,7 +316,7 @@ class fe extends g {
|
|
|
316
316
|
* @protected
|
|
317
317
|
*/
|
|
318
318
|
onData(e) {
|
|
319
|
-
const t =
|
|
319
|
+
const t = fe(e, this.socket.binaryType);
|
|
320
320
|
this.onPacket(t);
|
|
321
321
|
}
|
|
322
322
|
/**
|
|
@@ -353,11 +353,11 @@ class fe extends g {
|
|
|
353
353
|
return this.opts.port && (this.opts.secure && Number(this.opts.port) !== 443 || !this.opts.secure && Number(this.opts.port) !== 80) ? ":" + this.opts.port : "";
|
|
354
354
|
}
|
|
355
355
|
_query(e) {
|
|
356
|
-
const t =
|
|
356
|
+
const t = rt(e);
|
|
357
357
|
return t.length ? "?" + t : "";
|
|
358
358
|
}
|
|
359
359
|
}
|
|
360
|
-
class
|
|
360
|
+
class at extends pe {
|
|
361
361
|
constructor() {
|
|
362
362
|
super(...arguments), this._polling = !1;
|
|
363
363
|
}
|
|
@@ -413,7 +413,7 @@ class ot extends fe {
|
|
|
413
413
|
return this.onClose({ description: "transport closed by the server" }), !1;
|
|
414
414
|
this.onPacket(s);
|
|
415
415
|
};
|
|
416
|
-
|
|
416
|
+
Ke(e, this.socket.binaryType).forEach(t), this.readyState !== "closed" && (this._polling = !1, this.emitReserved("pollComplete"), this.readyState === "open" && this._poll());
|
|
417
417
|
}
|
|
418
418
|
/**
|
|
419
419
|
* For polling, send a close packet.
|
|
@@ -433,7 +433,7 @@ class ot extends fe {
|
|
|
433
433
|
* @protected
|
|
434
434
|
*/
|
|
435
435
|
write(e) {
|
|
436
|
-
this.writable = !1,
|
|
436
|
+
this.writable = !1, Ye(e, (t) => {
|
|
437
437
|
this.doWrite(t, () => {
|
|
438
438
|
this.writable = !0, this.emitReserved("drain");
|
|
439
439
|
});
|
|
@@ -446,18 +446,18 @@ class ot extends fe {
|
|
|
446
446
|
*/
|
|
447
447
|
uri() {
|
|
448
448
|
const e = this.opts.secure ? "https" : "http", t = this.query || {};
|
|
449
|
-
return this.opts.timestampRequests !== !1 && (t[this.opts.timestampParam] =
|
|
449
|
+
return this.opts.timestampRequests !== !1 && (t[this.opts.timestampParam] = Ne()), !this.supportsBinary && !t.sid && (t.b64 = 1), this.createUri(e, t);
|
|
450
450
|
}
|
|
451
451
|
}
|
|
452
|
-
let
|
|
452
|
+
let Pe = !1;
|
|
453
453
|
try {
|
|
454
|
-
|
|
454
|
+
Pe = typeof XMLHttpRequest < "u" && "withCredentials" in new XMLHttpRequest();
|
|
455
455
|
} catch {
|
|
456
456
|
}
|
|
457
|
-
const
|
|
458
|
-
function
|
|
457
|
+
const ct = Pe;
|
|
458
|
+
function ht() {
|
|
459
459
|
}
|
|
460
|
-
class
|
|
460
|
+
class ut extends at {
|
|
461
461
|
/**
|
|
462
462
|
* XHR Polling constructor.
|
|
463
463
|
*
|
|
@@ -499,7 +499,7 @@ class ht extends ot {
|
|
|
499
499
|
}), this.pollXhr = e;
|
|
500
500
|
}
|
|
501
501
|
}
|
|
502
|
-
class
|
|
502
|
+
class T extends g {
|
|
503
503
|
/**
|
|
504
504
|
* Request constructor
|
|
505
505
|
*
|
|
@@ -507,7 +507,7 @@ class v extends g {
|
|
|
507
507
|
* @package
|
|
508
508
|
*/
|
|
509
509
|
constructor(e, t, s) {
|
|
510
|
-
super(), this.createRequest = e,
|
|
510
|
+
super(), this.createRequest = e, j(this, s), this._opts = s, this._method = s.method || "GET", this._uri = t, this._data = s.data !== void 0 ? s.data : null, this._create();
|
|
511
511
|
}
|
|
512
512
|
/**
|
|
513
513
|
* Creates the XHR object and sends the request.
|
|
@@ -516,7 +516,7 @@ class v extends g {
|
|
|
516
516
|
*/
|
|
517
517
|
_create() {
|
|
518
518
|
var e;
|
|
519
|
-
const t =
|
|
519
|
+
const t = xe(this._opts, "agent", "pfx", "key", "passphrase", "cert", "ca", "ciphers", "rejectUnauthorized", "autoUnref");
|
|
520
520
|
t.xdomain = !!this._opts.xd;
|
|
521
521
|
const s = this._xhr = this.createRequest(t);
|
|
522
522
|
try {
|
|
@@ -553,7 +553,7 @@ class v extends g {
|
|
|
553
553
|
}, 0);
|
|
554
554
|
return;
|
|
555
555
|
}
|
|
556
|
-
typeof document < "u" && (this._index =
|
|
556
|
+
typeof document < "u" && (this._index = T.requestsCount++, T.requests[this._index] = this);
|
|
557
557
|
}
|
|
558
558
|
/**
|
|
559
559
|
* Called upon error.
|
|
@@ -570,12 +570,12 @@ class v extends g {
|
|
|
570
570
|
*/
|
|
571
571
|
_cleanup(e) {
|
|
572
572
|
if (!(typeof this._xhr > "u" || this._xhr === null)) {
|
|
573
|
-
if (this._xhr.onreadystatechange =
|
|
573
|
+
if (this._xhr.onreadystatechange = ht, e)
|
|
574
574
|
try {
|
|
575
575
|
this._xhr.abort();
|
|
576
576
|
} catch {
|
|
577
577
|
}
|
|
578
|
-
typeof document < "u" && delete
|
|
578
|
+
typeof document < "u" && delete T.requests[this._index], this._xhr = null;
|
|
579
579
|
}
|
|
580
580
|
}
|
|
581
581
|
/**
|
|
@@ -596,56 +596,56 @@ class v extends g {
|
|
|
596
596
|
this._cleanup();
|
|
597
597
|
}
|
|
598
598
|
}
|
|
599
|
-
|
|
600
|
-
|
|
599
|
+
T.requestsCount = 0;
|
|
600
|
+
T.requests = {};
|
|
601
601
|
if (typeof document < "u") {
|
|
602
602
|
if (typeof attachEvent == "function")
|
|
603
|
-
attachEvent("onunload",
|
|
603
|
+
attachEvent("onunload", ve);
|
|
604
604
|
else if (typeof addEventListener == "function") {
|
|
605
|
-
const n = "onpagehide" in
|
|
606
|
-
addEventListener(n,
|
|
605
|
+
const n = "onpagehide" in _ ? "pagehide" : "unload";
|
|
606
|
+
addEventListener(n, ve, !1);
|
|
607
607
|
}
|
|
608
608
|
}
|
|
609
|
-
function
|
|
610
|
-
for (let n in
|
|
611
|
-
|
|
609
|
+
function ve() {
|
|
610
|
+
for (let n in T.requests)
|
|
611
|
+
T.requests.hasOwnProperty(n) && T.requests[n].abort();
|
|
612
612
|
}
|
|
613
|
-
const
|
|
614
|
-
const n =
|
|
613
|
+
const lt = function() {
|
|
614
|
+
const n = Le({
|
|
615
615
|
xdomain: !1
|
|
616
616
|
});
|
|
617
617
|
return n && n.responseType !== null;
|
|
618
618
|
}();
|
|
619
|
-
class
|
|
619
|
+
class ft extends ut {
|
|
620
620
|
constructor(e) {
|
|
621
621
|
super(e);
|
|
622
622
|
const t = e && e.forceBase64;
|
|
623
|
-
this.supportsBinary =
|
|
623
|
+
this.supportsBinary = lt && !t;
|
|
624
624
|
}
|
|
625
625
|
request(e = {}) {
|
|
626
|
-
return Object.assign(e, { xd: this.xd }, this.opts), new
|
|
626
|
+
return Object.assign(e, { xd: this.xd }, this.opts), new T(Le, this.uri(), e);
|
|
627
627
|
}
|
|
628
628
|
}
|
|
629
|
-
function
|
|
629
|
+
function Le(n) {
|
|
630
630
|
const e = n.xdomain;
|
|
631
631
|
try {
|
|
632
|
-
if (typeof XMLHttpRequest < "u" && (!e ||
|
|
632
|
+
if (typeof XMLHttpRequest < "u" && (!e || ct))
|
|
633
633
|
return new XMLHttpRequest();
|
|
634
634
|
} catch {
|
|
635
635
|
}
|
|
636
636
|
if (!e)
|
|
637
637
|
try {
|
|
638
|
-
return new
|
|
638
|
+
return new _[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP");
|
|
639
639
|
} catch {
|
|
640
640
|
}
|
|
641
641
|
}
|
|
642
|
-
const
|
|
643
|
-
class
|
|
642
|
+
const Ie = typeof navigator < "u" && typeof navigator.product == "string" && navigator.product.toLowerCase() === "reactnative";
|
|
643
|
+
class pt extends pe {
|
|
644
644
|
get name() {
|
|
645
645
|
return "websocket";
|
|
646
646
|
}
|
|
647
647
|
doOpen() {
|
|
648
|
-
const e = this.uri(), t = this.opts.protocols, s =
|
|
648
|
+
const e = this.uri(), t = this.opts.protocols, s = Ie ? {} : xe(this.opts, "agent", "perMessageDeflate", "pfx", "key", "passphrase", "cert", "ca", "ciphers", "rejectUnauthorized", "localAddress", "protocolVersion", "origin", "maxPayload", "family", "checkServerIdentity");
|
|
649
649
|
this.opts.extraHeaders && (s.headers = this.opts.extraHeaders);
|
|
650
650
|
try {
|
|
651
651
|
this.ws = this.createSocket(e, t, s);
|
|
@@ -671,12 +671,12 @@ class ft extends fe {
|
|
|
671
671
|
this.writable = !1;
|
|
672
672
|
for (let t = 0; t < e.length; t++) {
|
|
673
673
|
const s = e[t], r = t === e.length - 1;
|
|
674
|
-
|
|
674
|
+
le(s, this.supportsBinary, (i) => {
|
|
675
675
|
try {
|
|
676
676
|
this.doWrite(s, i);
|
|
677
677
|
} catch {
|
|
678
678
|
}
|
|
679
|
-
r &&
|
|
679
|
+
r && G(() => {
|
|
680
680
|
this.writable = !0, this.emitReserved("drain");
|
|
681
681
|
}, this.setTimeoutFn);
|
|
682
682
|
});
|
|
@@ -693,19 +693,19 @@ class ft extends fe {
|
|
|
693
693
|
*/
|
|
694
694
|
uri() {
|
|
695
695
|
const e = this.opts.secure ? "wss" : "ws", t = this.query || {};
|
|
696
|
-
return this.opts.timestampRequests && (t[this.opts.timestampParam] =
|
|
696
|
+
return this.opts.timestampRequests && (t[this.opts.timestampParam] = Ne()), this.supportsBinary || (t.b64 = 1), this.createUri(e, t);
|
|
697
697
|
}
|
|
698
698
|
}
|
|
699
|
-
const
|
|
700
|
-
class
|
|
699
|
+
const X = _.WebSocket || _.MozWebSocket;
|
|
700
|
+
class dt extends pt {
|
|
701
701
|
createSocket(e, t, s) {
|
|
702
|
-
return
|
|
702
|
+
return Ie ? new X(e, t, s) : t ? new X(e, t) : new X(e);
|
|
703
703
|
}
|
|
704
704
|
doWrite(e, t) {
|
|
705
705
|
this.ws.send(t);
|
|
706
706
|
}
|
|
707
707
|
}
|
|
708
|
-
class
|
|
708
|
+
class yt extends pe {
|
|
709
709
|
get name() {
|
|
710
710
|
return "webtransport";
|
|
711
711
|
}
|
|
@@ -721,7 +721,7 @@ class dt extends fe {
|
|
|
721
721
|
this.onError("webtransport error", e);
|
|
722
722
|
}), this._transport.ready.then(() => {
|
|
723
723
|
this._transport.createBidirectionalStream().then((e) => {
|
|
724
|
-
const t =
|
|
724
|
+
const t = ze(Number.MAX_SAFE_INTEGER, this.socket.binaryType), s = e.readable.pipeThrough(t).getReader(), r = We();
|
|
725
725
|
r.readable.pipeTo(e.writable), this._writer = r.writable.getWriter();
|
|
726
726
|
const i = () => {
|
|
727
727
|
s.read().then(({ done: h, value: l }) => {
|
|
@@ -740,7 +740,7 @@ class dt extends fe {
|
|
|
740
740
|
for (let t = 0; t < e.length; t++) {
|
|
741
741
|
const s = e[t], r = t === e.length - 1;
|
|
742
742
|
this._writer.write(s).then(() => {
|
|
743
|
-
r &&
|
|
743
|
+
r && G(() => {
|
|
744
744
|
this.writable = !0, this.emitReserved("drain");
|
|
745
745
|
}, this.setTimeoutFn);
|
|
746
746
|
});
|
|
@@ -751,11 +751,11 @@ class dt extends fe {
|
|
|
751
751
|
(e = this._transport) === null || e === void 0 || e.close();
|
|
752
752
|
}
|
|
753
753
|
}
|
|
754
|
-
const
|
|
755
|
-
websocket:
|
|
756
|
-
webtransport:
|
|
757
|
-
polling:
|
|
758
|
-
},
|
|
754
|
+
const mt = {
|
|
755
|
+
websocket: dt,
|
|
756
|
+
webtransport: yt,
|
|
757
|
+
polling: ft
|
|
758
|
+
}, gt = /^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/, wt = [
|
|
759
759
|
"source",
|
|
760
760
|
"protocol",
|
|
761
761
|
"authority",
|
|
@@ -771,31 +771,31 @@ const yt = {
|
|
|
771
771
|
"query",
|
|
772
772
|
"anchor"
|
|
773
773
|
];
|
|
774
|
-
function
|
|
774
|
+
function se(n) {
|
|
775
775
|
if (n.length > 8e3)
|
|
776
776
|
throw "URI too long";
|
|
777
777
|
const e = n, t = n.indexOf("["), s = n.indexOf("]");
|
|
778
778
|
t != -1 && s != -1 && (n = n.substring(0, t) + n.substring(t, s).replace(/:/g, ";") + n.substring(s, n.length));
|
|
779
|
-
let r =
|
|
779
|
+
let r = gt.exec(n || ""), i = {}, o = 14;
|
|
780
780
|
for (; o--; )
|
|
781
|
-
i[
|
|
782
|
-
return t != -1 && s != -1 && (i.source = e, i.host = i.host.substring(1, i.host.length - 1).replace(/;/g, ":"), i.authority = i.authority.replace("[", "").replace("]", "").replace(/;/g, ":"), i.ipv6uri = !0), i.pathNames =
|
|
781
|
+
i[wt[o]] = r[o] || "";
|
|
782
|
+
return t != -1 && s != -1 && (i.source = e, i.host = i.host.substring(1, i.host.length - 1).replace(/;/g, ":"), i.authority = i.authority.replace("[", "").replace("]", "").replace(/;/g, ":"), i.ipv6uri = !0), i.pathNames = _t(i, i.path), i.queryKey = bt(i, i.query), i;
|
|
783
783
|
}
|
|
784
|
-
function
|
|
784
|
+
function _t(n, e) {
|
|
785
785
|
const t = /\/{2,9}/g, s = e.replace(t, "/").split("/");
|
|
786
786
|
return (e.slice(0, 1) == "/" || e.length === 0) && s.splice(0, 1), e.slice(-1) == "/" && s.splice(s.length - 1, 1), s;
|
|
787
787
|
}
|
|
788
|
-
function
|
|
788
|
+
function bt(n, e) {
|
|
789
789
|
const t = {};
|
|
790
790
|
return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g, function(s, r, i) {
|
|
791
791
|
r && (t[r] = i);
|
|
792
792
|
}), t;
|
|
793
793
|
}
|
|
794
|
-
const
|
|
795
|
-
|
|
796
|
-
|
|
794
|
+
const ne = typeof addEventListener == "function" && typeof removeEventListener == "function", D = [];
|
|
795
|
+
ne && addEventListener("offline", () => {
|
|
796
|
+
D.forEach((n) => n());
|
|
797
797
|
}, !1);
|
|
798
|
-
class
|
|
798
|
+
class R extends g {
|
|
799
799
|
/**
|
|
800
800
|
* Socket constructor.
|
|
801
801
|
*
|
|
@@ -803,11 +803,11 @@ class $ extends g {
|
|
|
803
803
|
* @param {Object} opts - options
|
|
804
804
|
*/
|
|
805
805
|
constructor(e, t) {
|
|
806
|
-
if (super(), this.binaryType =
|
|
807
|
-
const s =
|
|
806
|
+
if (super(), this.binaryType = Qe, this.writeBuffer = [], this._prevBufferLen = 0, this._pingInterval = -1, this._pingTimeout = -1, this._maxPayload = -1, this._pingTimeoutTime = 1 / 0, e && typeof e == "object" && (t = e, e = null), e) {
|
|
807
|
+
const s = se(e);
|
|
808
808
|
t.hostname = s.host, t.secure = s.protocol === "https" || s.protocol === "wss", t.port = s.port, s.query && (t.query = s.query);
|
|
809
|
-
} else t.host && (t.hostname =
|
|
810
|
-
|
|
809
|
+
} else t.host && (t.hostname = se(t.host).host);
|
|
810
|
+
j(this, t), this.secure = t.secure != null ? t.secure : typeof location < "u" && location.protocol === "https:", t.hostname && !t.port && (t.port = this.secure ? "443" : "80"), this.hostname = t.hostname || (typeof location < "u" ? location.hostname : "localhost"), this.port = t.port || (typeof location < "u" && location.port ? location.port : this.secure ? "443" : "80"), this.transports = [], this._transportsByName = {}, t.transports.forEach((s) => {
|
|
811
811
|
const r = s.prototype.name;
|
|
812
812
|
this.transports.push(r), this._transportsByName[r] = s;
|
|
813
813
|
}), this.opts = Object.assign({
|
|
@@ -824,13 +824,13 @@ class $ extends g {
|
|
|
824
824
|
},
|
|
825
825
|
transportOptions: {},
|
|
826
826
|
closeOnBeforeunload: !1
|
|
827
|
-
}, t), this.opts.path = this.opts.path.replace(/\/$/, "") + (this.opts.addTrailingSlash ? "/" : ""), typeof this.opts.query == "string" && (this.opts.query =
|
|
827
|
+
}, t), this.opts.path = this.opts.path.replace(/\/$/, "") + (this.opts.addTrailingSlash ? "/" : ""), typeof this.opts.query == "string" && (this.opts.query = it(this.opts.query)), ne && (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
|
+
}, D.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 $ extends g {
|
|
|
841
841
|
*/
|
|
842
842
|
createTransport(e) {
|
|
843
843
|
const t = Object.assign({}, this.opts.query);
|
|
844
|
-
t.EIO =
|
|
844
|
+
t.EIO = Be, t.transport = e, this.id && (t.sid = this.id);
|
|
845
845
|
const s = Object.assign({}, this.opts, {
|
|
846
846
|
query: t,
|
|
847
847
|
socket: this,
|
|
@@ -863,7 +863,7 @@ class $ extends g {
|
|
|
863
863
|
}, 0);
|
|
864
864
|
return;
|
|
865
865
|
}
|
|
866
|
-
const e = this.opts.rememberUpgrade &&
|
|
866
|
+
const e = this.opts.rememberUpgrade && R.priorWebsocketSuccess && this.transports.indexOf("websocket") !== -1 ? "websocket" : this.transports[0];
|
|
867
867
|
this.readyState = "opening";
|
|
868
868
|
const t = this.createTransport(e);
|
|
869
869
|
t.open(), this.setTransport(t);
|
|
@@ -882,7 +882,7 @@ class $ extends g {
|
|
|
882
882
|
* @private
|
|
883
883
|
*/
|
|
884
884
|
onOpen() {
|
|
885
|
-
this.readyState = "open",
|
|
885
|
+
this.readyState = "open", R.priorWebsocketSuccess = this.transport.name === "websocket", this.emitReserved("open"), this.flush();
|
|
886
886
|
}
|
|
887
887
|
/**
|
|
888
888
|
* Handles a packet.
|
|
@@ -959,7 +959,7 @@ class $ extends g {
|
|
|
959
959
|
let t = 1;
|
|
960
960
|
for (let s = 0; s < this.writeBuffer.length; s++) {
|
|
961
961
|
const r = this.writeBuffer[s].data;
|
|
962
|
-
if (r && (t +=
|
|
962
|
+
if (r && (t += st(r)), s > 0 && t > this._maxPayload)
|
|
963
963
|
return this.writeBuffer.slice(0, s);
|
|
964
964
|
t += 2;
|
|
965
965
|
}
|
|
@@ -979,7 +979,7 @@ class $ extends g {
|
|
|
979
979
|
if (!this._pingTimeoutTime)
|
|
980
980
|
return !0;
|
|
981
981
|
const e = Date.now() > this._pingTimeoutTime;
|
|
982
|
-
return e && (this._pingTimeoutTime = 0,
|
|
982
|
+
return e && (this._pingTimeoutTime = 0, G(() => {
|
|
983
983
|
this._onClose("ping timeout");
|
|
984
984
|
}, this.setTimeoutFn)), e;
|
|
985
985
|
}
|
|
@@ -1046,7 +1046,7 @@ class $ extends g {
|
|
|
1046
1046
|
* @private
|
|
1047
1047
|
*/
|
|
1048
1048
|
_onError(e) {
|
|
1049
|
-
if (
|
|
1049
|
+
if (R.priorWebsocketSuccess = !1, this.opts.tryAllTransports && this.transports.length > 1 && this.readyState === "opening")
|
|
1050
1050
|
return this.transports.shift(), this._open();
|
|
1051
1051
|
this.emitReserved("error", e), this._onClose("transport error", e);
|
|
1052
1052
|
}
|
|
@@ -1057,16 +1057,16 @@ class $ extends g {
|
|
|
1057
1057
|
*/
|
|
1058
1058
|
_onClose(e, t) {
|
|
1059
1059
|
if (this.readyState === "opening" || this.readyState === "open" || this.readyState === "closing") {
|
|
1060
|
-
if (this.clearTimeoutFn(this._pingTimeoutTimer), this.transport.removeAllListeners("close"), this.transport.close(), this.transport.removeAllListeners(),
|
|
1061
|
-
const s =
|
|
1062
|
-
s !== -1 &&
|
|
1060
|
+
if (this.clearTimeoutFn(this._pingTimeoutTimer), this.transport.removeAllListeners("close"), this.transport.close(), this.transport.removeAllListeners(), ne && (this._beforeunloadEventListener && removeEventListener("beforeunload", this._beforeunloadEventListener, !1), this._offlineEventListener)) {
|
|
1061
|
+
const s = D.indexOf(this._offlineEventListener);
|
|
1062
|
+
s !== -1 && D.splice(s, 1);
|
|
1063
1063
|
}
|
|
1064
1064
|
this.readyState = "closed", this.id = null, this.emitReserved("close", e, t), this.writeBuffer = [], this._prevBufferLen = 0;
|
|
1065
1065
|
}
|
|
1066
1066
|
}
|
|
1067
1067
|
}
|
|
1068
|
-
|
|
1069
|
-
class
|
|
1068
|
+
R.protocol = Be;
|
|
1069
|
+
class Et extends R {
|
|
1070
1070
|
constructor() {
|
|
1071
1071
|
super(...arguments), this._upgrades = [];
|
|
1072
1072
|
}
|
|
@@ -1083,19 +1083,19 @@ class bt extends $ {
|
|
|
1083
1083
|
*/
|
|
1084
1084
|
_probe(e) {
|
|
1085
1085
|
let t = this.createTransport(e), s = !1;
|
|
1086
|
-
|
|
1086
|
+
R.priorWebsocketSuccess = !1;
|
|
1087
1087
|
const r = () => {
|
|
1088
1088
|
s || (t.send([{ type: "ping", data: "probe" }]), t.once("packet", (m) => {
|
|
1089
1089
|
if (!s)
|
|
1090
1090
|
if (m.type === "pong" && m.data === "probe") {
|
|
1091
1091
|
if (this.upgrading = !0, this.emitReserved("upgrading", t), !t)
|
|
1092
1092
|
return;
|
|
1093
|
-
|
|
1093
|
+
R.priorWebsocketSuccess = t.name === "websocket", this.transport.pause(() => {
|
|
1094
1094
|
s || this.readyState !== "closed" && (d(), this.setTransport(t), t.send([{ type: "upgrade" }]), this.emitReserved("upgrade", t), t = null, this.upgrading = !1, this.flush());
|
|
1095
1095
|
});
|
|
1096
1096
|
} else {
|
|
1097
|
-
const
|
|
1098
|
-
|
|
1097
|
+
const k = new Error("probe error");
|
|
1098
|
+
k.transport = t.name, this.emitReserved("upgradeError", k);
|
|
1099
1099
|
}
|
|
1100
1100
|
}));
|
|
1101
1101
|
};
|
|
@@ -1103,8 +1103,8 @@ class bt extends $ {
|
|
|
1103
1103
|
s || (s = !0, d(), t.close(), t = null);
|
|
1104
1104
|
}
|
|
1105
1105
|
const o = (m) => {
|
|
1106
|
-
const
|
|
1107
|
-
|
|
1106
|
+
const k = new Error("probe error: " + m);
|
|
1107
|
+
k.transport = t.name, i(), this.emitReserved("upgradeError", k);
|
|
1108
1108
|
};
|
|
1109
1109
|
function h() {
|
|
1110
1110
|
o("transport closed");
|
|
@@ -1138,67 +1138,67 @@ class bt extends $ {
|
|
|
1138
1138
|
return t;
|
|
1139
1139
|
}
|
|
1140
1140
|
}
|
|
1141
|
-
let
|
|
1141
|
+
let Tt = class extends Et {
|
|
1142
1142
|
constructor(e, t = {}) {
|
|
1143
1143
|
const s = typeof e == "object", r = s ? { ...e } : { ...t };
|
|
1144
|
-
(!r.transports || r.transports && typeof r.transports[0] == "string") && (r.transports = (r.transports || ["polling", "websocket", "webtransport"]).map((i) =>
|
|
1144
|
+
(!r.transports || r.transports && typeof r.transports[0] == "string") && (r.transports = (r.transports || ["polling", "websocket", "webtransport"]).map((i) => mt[i]).filter((i) => !!i)), super(s ? r : e, r);
|
|
1145
1145
|
}
|
|
1146
1146
|
};
|
|
1147
|
-
function
|
|
1147
|
+
function vt(n, e = "", t) {
|
|
1148
1148
|
let s = n;
|
|
1149
|
-
t = t || typeof location < "u" && location, n == null && (n = t.protocol + "//" + t.host), typeof n == "string" && (n.charAt(0) === "/" && (n.charAt(1) === "/" ? n = t.protocol + n : n = t.host + n), /^(https?|wss?):\/\//.test(n) || (typeof t < "u" ? n = t.protocol + "//" + n : n = "https://" + n), s =
|
|
1149
|
+
t = t || typeof location < "u" && location, n == null && (n = t.protocol + "//" + t.host), typeof n == "string" && (n.charAt(0) === "/" && (n.charAt(1) === "/" ? n = t.protocol + n : n = t.host + n), /^(https?|wss?):\/\//.test(n) || (typeof t < "u" ? n = t.protocol + "//" + n : n = "https://" + n), s = se(n)), s.port || (/^(http|ws)$/.test(s.protocol) ? s.port = "80" : /^(http|ws)s$/.test(s.protocol) && (s.port = "443")), s.path = s.path || "/";
|
|
1150
1150
|
const i = s.host.indexOf(":") !== -1 ? "[" + s.host + "]" : s.host;
|
|
1151
1151
|
return s.id = s.protocol + "://" + i + ":" + s.port + e, s.href = s.protocol + "://" + i + (t && t.port === s.port ? "" : ":" + s.port), s;
|
|
1152
1152
|
}
|
|
1153
|
-
const
|
|
1154
|
-
function
|
|
1155
|
-
return
|
|
1153
|
+
const kt = typeof ArrayBuffer == "function", At = (n) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(n) : n.buffer instanceof ArrayBuffer, qe = Object.prototype.toString, Ot = typeof Blob == "function" || typeof Blob < "u" && qe.call(Blob) === "[object BlobConstructor]", St = typeof File == "function" || typeof File < "u" && qe.call(File) === "[object FileConstructor]";
|
|
1154
|
+
function de(n) {
|
|
1155
|
+
return kt && (n instanceof ArrayBuffer || At(n)) || Ot && n instanceof Blob || St && n instanceof File;
|
|
1156
1156
|
}
|
|
1157
|
-
function
|
|
1157
|
+
function F(n, e) {
|
|
1158
1158
|
if (!n || typeof n != "object")
|
|
1159
1159
|
return !1;
|
|
1160
1160
|
if (Array.isArray(n)) {
|
|
1161
1161
|
for (let t = 0, s = n.length; t < s; t++)
|
|
1162
|
-
if (
|
|
1162
|
+
if (F(n[t]))
|
|
1163
1163
|
return !0;
|
|
1164
1164
|
return !1;
|
|
1165
1165
|
}
|
|
1166
|
-
if (
|
|
1166
|
+
if (de(n))
|
|
1167
1167
|
return !0;
|
|
1168
1168
|
if (n.toJSON && typeof n.toJSON == "function" && arguments.length === 1)
|
|
1169
|
-
return
|
|
1169
|
+
return F(n.toJSON(), !0);
|
|
1170
1170
|
for (const t in n)
|
|
1171
|
-
if (Object.prototype.hasOwnProperty.call(n, t) &&
|
|
1171
|
+
if (Object.prototype.hasOwnProperty.call(n, t) && F(n[t]))
|
|
1172
1172
|
return !0;
|
|
1173
1173
|
return !1;
|
|
1174
1174
|
}
|
|
1175
|
-
function
|
|
1175
|
+
function Ct(n) {
|
|
1176
1176
|
const e = [], t = n.data, s = n;
|
|
1177
|
-
return s.data =
|
|
1177
|
+
return s.data = re(t, e), s.attachments = e.length, { packet: s, buffers: e };
|
|
1178
1178
|
}
|
|
1179
|
-
function
|
|
1179
|
+
function re(n, e) {
|
|
1180
1180
|
if (!n)
|
|
1181
1181
|
return n;
|
|
1182
|
-
if (
|
|
1182
|
+
if (de(n)) {
|
|
1183
1183
|
const t = { _placeholder: !0, num: e.length };
|
|
1184
1184
|
return e.push(n), t;
|
|
1185
1185
|
} else if (Array.isArray(n)) {
|
|
1186
1186
|
const t = new Array(n.length);
|
|
1187
1187
|
for (let s = 0; s < n.length; s++)
|
|
1188
|
-
t[s] =
|
|
1188
|
+
t[s] = re(n[s], e);
|
|
1189
1189
|
return t;
|
|
1190
1190
|
} else if (typeof n == "object" && !(n instanceof Date)) {
|
|
1191
1191
|
const t = {};
|
|
1192
1192
|
for (const s in n)
|
|
1193
|
-
Object.prototype.hasOwnProperty.call(n, s) && (t[s] =
|
|
1193
|
+
Object.prototype.hasOwnProperty.call(n, s) && (t[s] = re(n[s], e));
|
|
1194
1194
|
return t;
|
|
1195
1195
|
}
|
|
1196
1196
|
return n;
|
|
1197
1197
|
}
|
|
1198
|
-
function
|
|
1199
|
-
return n.data =
|
|
1198
|
+
function $t(n, e) {
|
|
1199
|
+
return n.data = ie(n.data, e), delete n.attachments, n;
|
|
1200
1200
|
}
|
|
1201
|
-
function
|
|
1201
|
+
function ie(n, e) {
|
|
1202
1202
|
if (!n)
|
|
1203
1203
|
return n;
|
|
1204
1204
|
if (n && n._placeholder === !0) {
|
|
@@ -1207,13 +1207,13 @@ function re(n, e) {
|
|
|
1207
1207
|
throw new Error("illegal attachments");
|
|
1208
1208
|
} else if (Array.isArray(n))
|
|
1209
1209
|
for (let t = 0; t < n.length; t++)
|
|
1210
|
-
n[t] =
|
|
1210
|
+
n[t] = ie(n[t], e);
|
|
1211
1211
|
else if (typeof n == "object")
|
|
1212
1212
|
for (const t in n)
|
|
1213
|
-
Object.prototype.hasOwnProperty.call(n, t) && (n[t] =
|
|
1213
|
+
Object.prototype.hasOwnProperty.call(n, t) && (n[t] = ie(n[t], e));
|
|
1214
1214
|
return n;
|
|
1215
1215
|
}
|
|
1216
|
-
const
|
|
1216
|
+
const Rt = [
|
|
1217
1217
|
"connect",
|
|
1218
1218
|
// used on the client side
|
|
1219
1219
|
"connect_error",
|
|
@@ -1231,7 +1231,7 @@ var p;
|
|
|
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
|
})(p || (p = {}));
|
|
1234
|
-
class
|
|
1234
|
+
class Bt {
|
|
1235
1235
|
/**
|
|
1236
1236
|
* Encoder constructor
|
|
1237
1237
|
*
|
|
@@ -1247,7 +1247,7 @@ class Rt {
|
|
|
1247
1247
|
* @param {Object} obj - packet object
|
|
1248
1248
|
*/
|
|
1249
1249
|
encode(e) {
|
|
1250
|
-
return (e.type === p.EVENT || e.type === p.ACK) &&
|
|
1250
|
+
return (e.type === p.EVENT || e.type === p.ACK) && F(e) ? this.encodeAsBinary({
|
|
1251
1251
|
type: e.type === p.EVENT ? p.BINARY_EVENT : p.BINARY_ACK,
|
|
1252
1252
|
nsp: e.nsp,
|
|
1253
1253
|
data: e.data,
|
|
@@ -1267,11 +1267,11 @@ class Rt {
|
|
|
1267
1267
|
* a list of buffers.
|
|
1268
1268
|
*/
|
|
1269
1269
|
encodeAsBinary(e) {
|
|
1270
|
-
const t =
|
|
1270
|
+
const t = Ct(e), s = this.encodeAsString(t.packet), r = t.buffers;
|
|
1271
1271
|
return r.unshift(s), r;
|
|
1272
1272
|
}
|
|
1273
1273
|
}
|
|
1274
|
-
class
|
|
1274
|
+
class ye extends g {
|
|
1275
1275
|
/**
|
|
1276
1276
|
* Decoder constructor
|
|
1277
1277
|
*/
|
|
@@ -1293,8 +1293,8 @@ class de extends g {
|
|
|
1293
1293
|
throw new Error("got plaintext data when reconstructing a packet");
|
|
1294
1294
|
t = this.decodeString(e);
|
|
1295
1295
|
const s = t.type === p.BINARY_EVENT;
|
|
1296
|
-
s || t.type === p.BINARY_ACK ? (t.type = s ? p.EVENT : p.ACK, this.reconstructor = new
|
|
1297
|
-
} else if (
|
|
1296
|
+
s || t.type === p.BINARY_ACK ? (t.type = s ? p.EVENT : p.ACK, this.reconstructor = new xt(t), t.attachments === 0 && super.emitReserved("decoded", t)) : super.emitReserved("decoded", t);
|
|
1297
|
+
} else if (de(e) || e.base64)
|
|
1298
1298
|
if (this.reconstructor)
|
|
1299
1299
|
t = this.reconstructor.takeBinaryData(e), t && (this.reconstructor = null, super.emitReserved("decoded", t));
|
|
1300
1300
|
else
|
|
@@ -1323,7 +1323,7 @@ class de extends g {
|
|
|
1323
1323
|
if (o != Number(o) || e.charAt(t) !== "-")
|
|
1324
1324
|
throw new Error("Illegal attachments");
|
|
1325
1325
|
const h = Number(o);
|
|
1326
|
-
if (!
|
|
1326
|
+
if (!Nt(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 de extends g {
|
|
|
1352
1352
|
}
|
|
1353
1353
|
if (e.charAt(++t)) {
|
|
1354
1354
|
const i = this.tryParse(e.substr(t));
|
|
1355
|
-
if (
|
|
1355
|
+
if (ye.isPayloadValid(s.type, i))
|
|
1356
1356
|
s.data = i;
|
|
1357
1357
|
else
|
|
1358
1358
|
throw new Error("invalid payload");
|
|
@@ -1369,14 +1369,14 @@ class de extends g {
|
|
|
1369
1369
|
static isPayloadValid(e, t) {
|
|
1370
1370
|
switch (e) {
|
|
1371
1371
|
case p.CONNECT:
|
|
1372
|
-
return
|
|
1372
|
+
return ke(t);
|
|
1373
1373
|
case p.DISCONNECT:
|
|
1374
1374
|
return t === void 0;
|
|
1375
1375
|
case p.CONNECT_ERROR:
|
|
1376
|
-
return typeof t == "string" ||
|
|
1376
|
+
return typeof t == "string" || ke(t);
|
|
1377
1377
|
case p.EVENT:
|
|
1378
1378
|
case p.BINARY_EVENT:
|
|
1379
|
-
return Array.isArray(t) && (typeof t[0] == "number" || typeof t[0] == "string" &&
|
|
1379
|
+
return Array.isArray(t) && (typeof t[0] == "number" || typeof t[0] == "string" && Rt.indexOf(t[0]) === -1);
|
|
1380
1380
|
case p.ACK:
|
|
1381
1381
|
case p.BINARY_ACK:
|
|
1382
1382
|
return Array.isArray(t);
|
|
@@ -1389,7 +1389,7 @@ class de extends g {
|
|
|
1389
1389
|
this.reconstructor && (this.reconstructor.finishedReconstruction(), this.reconstructor = null);
|
|
1390
1390
|
}
|
|
1391
1391
|
}
|
|
1392
|
-
class
|
|
1392
|
+
class xt {
|
|
1393
1393
|
constructor(e) {
|
|
1394
1394
|
this.packet = e, this.buffers = [], this.reconPack = e;
|
|
1395
1395
|
}
|
|
@@ -1403,7 +1403,7 @@ class Bt {
|
|
|
1403
1403
|
*/
|
|
1404
1404
|
takeBinaryData(e) {
|
|
1405
1405
|
if (this.buffers.push(e), this.buffers.length === this.reconPack.attachments) {
|
|
1406
|
-
const t =
|
|
1406
|
+
const t = $t(this.reconPack, this.buffers);
|
|
1407
1407
|
return this.finishedReconstruction(), t;
|
|
1408
1408
|
}
|
|
1409
1409
|
return null;
|
|
@@ -1415,26 +1415,26 @@ class Bt {
|
|
|
1415
1415
|
this.reconPack = null, this.buffers = [];
|
|
1416
1416
|
}
|
|
1417
1417
|
}
|
|
1418
|
-
const
|
|
1418
|
+
const Nt = Number.isInteger || function(n) {
|
|
1419
1419
|
return typeof n == "number" && isFinite(n) && Math.floor(n) === n;
|
|
1420
1420
|
};
|
|
1421
|
-
function
|
|
1421
|
+
function ke(n) {
|
|
1422
1422
|
return Object.prototype.toString.call(n) === "[object Object]";
|
|
1423
1423
|
}
|
|
1424
|
-
const
|
|
1424
|
+
const Pt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1425
1425
|
__proto__: null,
|
|
1426
|
-
Decoder:
|
|
1427
|
-
Encoder:
|
|
1426
|
+
Decoder: ye,
|
|
1427
|
+
Encoder: Bt,
|
|
1428
1428
|
get PacketType() {
|
|
1429
1429
|
return p;
|
|
1430
1430
|
}
|
|
1431
1431
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1432
|
-
function
|
|
1432
|
+
function b(n, e, t) {
|
|
1433
1433
|
return n.on(e, t), function() {
|
|
1434
1434
|
n.off(e, t);
|
|
1435
1435
|
};
|
|
1436
1436
|
}
|
|
1437
|
-
const
|
|
1437
|
+
const Lt = Object.freeze({
|
|
1438
1438
|
connect: 1,
|
|
1439
1439
|
connect_error: 1,
|
|
1440
1440
|
disconnect: 1,
|
|
@@ -1443,7 +1443,7 @@ const Pt = Object.freeze({
|
|
|
1443
1443
|
newListener: 1,
|
|
1444
1444
|
removeListener: 1
|
|
1445
1445
|
});
|
|
1446
|
-
class
|
|
1446
|
+
class Ue extends g {
|
|
1447
1447
|
/**
|
|
1448
1448
|
* `Socket` constructor.
|
|
1449
1449
|
*/
|
|
@@ -1477,10 +1477,10 @@ class qe extends g {
|
|
|
1477
1477
|
return;
|
|
1478
1478
|
const e = this.io;
|
|
1479
1479
|
this.subs = [
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1480
|
+
b(e, "open", this.onopen.bind(this)),
|
|
1481
|
+
b(e, "packet", this.onpacket.bind(this)),
|
|
1482
|
+
b(e, "error", this.onerror.bind(this)),
|
|
1483
|
+
b(e, "close", this.onclose.bind(this))
|
|
1484
1484
|
];
|
|
1485
1485
|
}
|
|
1486
1486
|
/**
|
|
@@ -1559,7 +1559,7 @@ class qe extends g {
|
|
|
1559
1559
|
*/
|
|
1560
1560
|
emit(e, ...t) {
|
|
1561
1561
|
var s, r, i;
|
|
1562
|
-
if (
|
|
1562
|
+
if (Lt.hasOwnProperty(e))
|
|
1563
1563
|
throw new Error('"' + e.toString() + '" is a reserved event name');
|
|
1564
1564
|
if (t.unshift(e), this._opts.retries && !this.flags.fromQueue && !this.flags.volatile)
|
|
1565
1565
|
return this._addToQueue(t), this;
|
|
@@ -2035,10 +2035,10 @@ class qe extends g {
|
|
|
2035
2035
|
}
|
|
2036
2036
|
}
|
|
2037
2037
|
}
|
|
2038
|
-
function
|
|
2038
|
+
function x(n) {
|
|
2039
2039
|
n = n || {}, this.ms = n.min || 100, this.max = n.max || 1e4, this.factor = n.factor || 2, this.jitter = n.jitter > 0 && n.jitter <= 1 ? n.jitter : 0, this.attempts = 0;
|
|
2040
2040
|
}
|
|
2041
|
-
|
|
2041
|
+
x.prototype.duration = function() {
|
|
2042
2042
|
var n = this.ms * Math.pow(this.factor, this.attempts++);
|
|
2043
2043
|
if (this.jitter) {
|
|
2044
2044
|
var e = Math.random(), t = Math.floor(e * this.jitter * n);
|
|
@@ -2046,27 +2046,27 @@ B.prototype.duration = function() {
|
|
|
2046
2046
|
}
|
|
2047
2047
|
return Math.min(n, this.max) | 0;
|
|
2048
2048
|
};
|
|
2049
|
-
|
|
2049
|
+
x.prototype.reset = function() {
|
|
2050
2050
|
this.attempts = 0;
|
|
2051
2051
|
};
|
|
2052
|
-
|
|
2052
|
+
x.prototype.setMin = function(n) {
|
|
2053
2053
|
this.ms = n;
|
|
2054
2054
|
};
|
|
2055
|
-
|
|
2055
|
+
x.prototype.setMax = function(n) {
|
|
2056
2056
|
this.max = n;
|
|
2057
2057
|
};
|
|
2058
|
-
|
|
2058
|
+
x.prototype.setJitter = function(n) {
|
|
2059
2059
|
this.jitter = n;
|
|
2060
2060
|
};
|
|
2061
|
-
class
|
|
2061
|
+
class oe extends g {
|
|
2062
2062
|
constructor(e, t) {
|
|
2063
2063
|
var s;
|
|
2064
|
-
super(), this.nsps = {}, this.subs = [], e && typeof e == "object" && (t = e, e = void 0), t = t || {}, t.path = t.path || "/socket.io", this.opts = t,
|
|
2064
|
+
super(), this.nsps = {}, this.subs = [], e && typeof e == "object" && (t = e, e = void 0), t = t || {}, t.path = t.path || "/socket.io", this.opts = t, j(this, t), this.reconnection(t.reconnection !== !1), this.reconnectionAttempts(t.reconnectionAttempts || 1 / 0), this.reconnectionDelay(t.reconnectionDelay || 1e3), this.reconnectionDelayMax(t.reconnectionDelayMax || 5e3), this.randomizationFactor((s = t.randomizationFactor) !== null && s !== void 0 ? s : 0.5), this.backoff = new x({
|
|
2065
2065
|
min: this.reconnectionDelay(),
|
|
2066
2066
|
max: this.reconnectionDelayMax(),
|
|
2067
2067
|
jitter: this.randomizationFactor()
|
|
2068
2068
|
}), this.timeout(t.timeout == null ? 2e4 : t.timeout), this._readyState = "closed", this.uri = e;
|
|
2069
|
-
const r = t.parser ||
|
|
2069
|
+
const r = t.parser || Pt;
|
|
2070
2070
|
this.encoder = new r.Encoder(), this.decoder = new r.Decoder(), this._autoConnect = t.autoConnect !== !1, this._autoConnect && this.open();
|
|
2071
2071
|
}
|
|
2072
2072
|
reconnection(e) {
|
|
@@ -2109,14 +2109,14 @@ class ie extends g {
|
|
|
2109
2109
|
open(e) {
|
|
2110
2110
|
if (~this._readyState.indexOf("open"))
|
|
2111
2111
|
return this;
|
|
2112
|
-
this.engine = new
|
|
2112
|
+
this.engine = new Tt(this.uri, this.opts);
|
|
2113
2113
|
const t = this.engine, s = this;
|
|
2114
2114
|
this._readyState = "opening", this.skipReconnect = !1;
|
|
2115
|
-
const r =
|
|
2115
|
+
const r = b(t, "open", function() {
|
|
2116
2116
|
s.onopen(), e && e();
|
|
2117
2117
|
}), i = (h) => {
|
|
2118
2118
|
this.cleanup(), this._readyState = "closed", this.emitReserved("error", h), e ? e(h) : this.maybeReconnectOnOpen();
|
|
2119
|
-
}, o =
|
|
2119
|
+
}, o = b(t, "error", i);
|
|
2120
2120
|
if (this._timeout !== !1) {
|
|
2121
2121
|
const h = this._timeout, l = this.setTimeoutFn(() => {
|
|
2122
2122
|
r(), i(new Error("timeout")), t.close();
|
|
@@ -2145,12 +2145,12 @@ class ie extends g {
|
|
|
2145
2145
|
this.cleanup(), this._readyState = "open", this.emitReserved("open");
|
|
2146
2146
|
const e = this.engine;
|
|
2147
2147
|
this.subs.push(
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2148
|
+
b(e, "ping", this.onping.bind(this)),
|
|
2149
|
+
b(e, "data", this.ondata.bind(this)),
|
|
2150
|
+
b(e, "error", this.onerror.bind(this)),
|
|
2151
|
+
b(e, "close", this.onclose.bind(this)),
|
|
2152
2152
|
// @ts-ignore
|
|
2153
|
-
|
|
2153
|
+
b(this.decoder, "decoded", this.ondecoded.bind(this))
|
|
2154
2154
|
);
|
|
2155
2155
|
}
|
|
2156
2156
|
/**
|
|
@@ -2179,7 +2179,7 @@ class ie extends g {
|
|
|
2179
2179
|
* @private
|
|
2180
2180
|
*/
|
|
2181
2181
|
ondecoded(e) {
|
|
2182
|
-
|
|
2182
|
+
G(() => {
|
|
2183
2183
|
this.emitReserved("packet", e);
|
|
2184
2184
|
}, this.setTimeoutFn);
|
|
2185
2185
|
}
|
|
@@ -2199,7 +2199,7 @@ class ie extends g {
|
|
|
2199
2199
|
*/
|
|
2200
2200
|
socket(e, t) {
|
|
2201
2201
|
let s = this.nsps[e];
|
|
2202
|
-
return s ? this._autoConnect && !s.active && s.connect() : (s = new
|
|
2202
|
+
return s ? this._autoConnect && !s.active && s.connect() : (s = new Ue(this, e, t), this.nsps[e] = s), s;
|
|
2203
2203
|
}
|
|
2204
2204
|
/**
|
|
2205
2205
|
* Called upon a socket close.
|
|
@@ -2296,20 +2296,20 @@ class ie extends g {
|
|
|
2296
2296
|
this._reconnecting = !1, this.backoff.reset(), this.emitReserved("reconnect", e);
|
|
2297
2297
|
}
|
|
2298
2298
|
}
|
|
2299
|
-
const
|
|
2300
|
-
function
|
|
2299
|
+
const N = {};
|
|
2300
|
+
function M(n, e) {
|
|
2301
2301
|
typeof n == "object" && (e = n, n = void 0), e = e || {};
|
|
2302
|
-
const t =
|
|
2302
|
+
const t = vt(n, e.path || "/socket.io"), s = t.source, r = t.id, i = t.path, o = N[r] && i in N[r].nsps, h = e.forceNew || e["force new connection"] || e.multiplex === !1 || o;
|
|
2303
2303
|
let l;
|
|
2304
|
-
return h ? l = new
|
|
2304
|
+
return h ? l = new oe(s, e) : (N[r] || (N[r] = new oe(s, e)), l = N[r]), t.query && !e.query && (e.query = t.queryKey), l.socket(t.path, e);
|
|
2305
2305
|
}
|
|
2306
|
-
Object.assign(
|
|
2307
|
-
Manager:
|
|
2308
|
-
Socket:
|
|
2309
|
-
io:
|
|
2310
|
-
connect:
|
|
2306
|
+
Object.assign(M, {
|
|
2307
|
+
Manager: oe,
|
|
2308
|
+
Socket: Ue,
|
|
2309
|
+
io: M,
|
|
2310
|
+
connect: M
|
|
2311
2311
|
});
|
|
2312
|
-
function
|
|
2312
|
+
function It(n) {
|
|
2313
2313
|
try {
|
|
2314
2314
|
const e = JSON.parse(n);
|
|
2315
2315
|
if (e && typeof e == "object") {
|
|
@@ -2324,20 +2324,20 @@ function Lt(n) {
|
|
|
2324
2324
|
}
|
|
2325
2325
|
return {};
|
|
2326
2326
|
}
|
|
2327
|
-
class
|
|
2327
|
+
class qt extends Error {
|
|
2328
2328
|
constructor(t, s, r) {
|
|
2329
|
-
const i =
|
|
2329
|
+
const i = It(r);
|
|
2330
2330
|
super(i.message ?? `${s || "Request failed"} (${t})`);
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2331
|
+
w(this, "status");
|
|
2332
|
+
w(this, "code");
|
|
2333
|
+
w(this, "details");
|
|
2334
|
+
w(this, "body");
|
|
2335
2335
|
this.name = "RequestError", this.status = t, this.code = i.code, this.details = i.details, this.body = r;
|
|
2336
2336
|
}
|
|
2337
2337
|
}
|
|
2338
|
-
const
|
|
2339
|
-
var a,
|
|
2340
|
-
const
|
|
2338
|
+
const E = "item/folder", f = "item", S = "processor", Ut = "npm-registry", C = "hidden", Q = "FILE", Z = "TOOL", ee = "APP";
|
|
2339
|
+
var a, ce, u, $, V, H, he, ue, De;
|
|
2340
|
+
const me = class me {
|
|
2341
2341
|
/**
|
|
2342
2342
|
* Creates a new EngineServicesClient instance.
|
|
2343
2343
|
* @param accessToken - API access token (obtained from the platform dashboard)
|
|
@@ -2346,25 +2346,25 @@ const ye = class ye {
|
|
|
2346
2346
|
* @param props - Optional configuration (retry count, auth mode, etc.).
|
|
2347
2347
|
*/
|
|
2348
2348
|
constructor(e, t, s) {
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2349
|
+
K(this, a);
|
|
2350
|
+
w(this, "apiUrl");
|
|
2351
|
+
w(this, "accessToken");
|
|
2352
|
+
w(this, "wsUrl");
|
|
2353
|
+
w(this, "retries");
|
|
2354
|
+
w(this, "useBearer");
|
|
2355
|
+
w(this, "builtInGlobals", null);
|
|
2356
2356
|
/**
|
|
2357
2357
|
* URL of a local execution server (e.g. `http://localhost:4001`).
|
|
2358
2358
|
* When set, execution methods are routed to this server instead of the cloud API.
|
|
2359
2359
|
* Set to `null` to disable local routing and use the cloud API.
|
|
2360
2360
|
*/
|
|
2361
|
-
|
|
2361
|
+
w(this, "localServerUrl", null);
|
|
2362
2362
|
/**
|
|
2363
2363
|
* The platform context this client was created with.
|
|
2364
2364
|
* Contains `appId`, `projectId`, `accessToken`, and `apiUrl`.
|
|
2365
2365
|
* Populated automatically when using {@link fromPlatformContext}.
|
|
2366
2366
|
*/
|
|
2367
|
-
|
|
2367
|
+
w(this, "context");
|
|
2368
2368
|
const { retries: r = 0, useBearer: i = !1, localServerUrl: o } = s || {};
|
|
2369
2369
|
let h = t;
|
|
2370
2370
|
if (h.charAt(h.length - 1) === "/" && (h = h.slice(0, -1)), this.apiUrl = `${h}/api`, this.accessToken = e, this.wsUrl = `${h}?accessToken=${e}`, this.retries = r, this.useBearer = i, this.context = { appId: "", projectId: "", accessToken: e, apiUrl: t }, o) {
|
|
@@ -2389,7 +2389,7 @@ const ye = class ye {
|
|
|
2389
2389
|
* ```
|
|
2390
2390
|
*/
|
|
2391
2391
|
static fromPlatformContext(e) {
|
|
2392
|
-
const t = (typeof window < "u" ? window.__THATOPEN_CONTEXT__ : null) || { appId: "", projectId: "", accessToken: "", apiUrl: "" }, s = new
|
|
2392
|
+
const t = (typeof window < "u" ? window.__THATOPEN_CONTEXT__ : null) || { appId: "", projectId: "", accessToken: "", apiUrl: "" }, s = new me(t.accessToken, t.apiUrl, {
|
|
2393
2393
|
...e,
|
|
2394
2394
|
useBearer: !0
|
|
2395
2395
|
});
|
|
@@ -2461,9 +2461,9 @@ const ye = class ye {
|
|
|
2461
2461
|
*/
|
|
2462
2462
|
async listFiles(e) {
|
|
2463
2463
|
const { folderId: t, archived: s, projectId: r } = e || {};
|
|
2464
|
-
return t ? await c(this, a, u).call(this, "GET", `${
|
|
2464
|
+
return t ? await c(this, a, u).call(this, "GET", `${E}/${t}/items`, { query: { itemType: Q, archived: s } }) : await c(this, a, u).call(this, "GET", `${f}`, {
|
|
2465
2465
|
query: {
|
|
2466
|
-
itemType:
|
|
2466
|
+
itemType: Q,
|
|
2467
2467
|
archived: s,
|
|
2468
2468
|
...r && { projectId: r }
|
|
2469
2469
|
}
|
|
@@ -2476,7 +2476,7 @@ const ye = class ye {
|
|
|
2476
2476
|
* @returns The file item, optionally with version history.
|
|
2477
2477
|
*/
|
|
2478
2478
|
async getFile(e, t) {
|
|
2479
|
-
return await c(this, a,
|
|
2479
|
+
return await c(this, a, ue).call(this, e, t);
|
|
2480
2480
|
}
|
|
2481
2481
|
/**
|
|
2482
2482
|
* Uploads a new file.
|
|
@@ -2484,7 +2484,7 @@ const ye = class ye {
|
|
|
2484
2484
|
* @returns The created item and its first version.
|
|
2485
2485
|
*/
|
|
2486
2486
|
async createFile(e) {
|
|
2487
|
-
return await c(this, a,
|
|
2487
|
+
return await c(this, a, H).call(this, e, Q);
|
|
2488
2488
|
}
|
|
2489
2489
|
/**
|
|
2490
2490
|
* Updates an existing file. Can rename, move to a different folder,
|
|
@@ -2494,7 +2494,7 @@ const ye = class ye {
|
|
|
2494
2494
|
* @returns The updated item and/or the new version.
|
|
2495
2495
|
*/
|
|
2496
2496
|
async updateFile(e, t) {
|
|
2497
|
-
return await c(this, a,
|
|
2497
|
+
return await c(this, a, he).call(this, e, t);
|
|
2498
2498
|
}
|
|
2499
2499
|
/**
|
|
2500
2500
|
* Archives (soft-deletes) a file. Can be recovered with {@link recoverFile}.
|
|
@@ -2517,7 +2517,7 @@ const ye = class ye {
|
|
|
2517
2517
|
* @returns A fetch Response containing the file data.
|
|
2518
2518
|
*/
|
|
2519
2519
|
async downloadFile(e, t) {
|
|
2520
|
-
return await c(this, a,
|
|
2520
|
+
return await c(this, a, V).call(this, e, t);
|
|
2521
2521
|
}
|
|
2522
2522
|
/**
|
|
2523
2523
|
* Retrieves the free-JSON metadata for a specific file version.
|
|
@@ -2562,7 +2562,7 @@ const ye = class ye {
|
|
|
2562
2562
|
*/
|
|
2563
2563
|
async listFolders(e) {
|
|
2564
2564
|
const { archived: t, parentFolderId: s, projectId: r } = e || {};
|
|
2565
|
-
return await c(this, a, u).call(this, "GET",
|
|
2565
|
+
return await c(this, a, u).call(this, "GET", E, {
|
|
2566
2566
|
query: {
|
|
2567
2567
|
parentFolderId: s,
|
|
2568
2568
|
archived: t,
|
|
@@ -2575,7 +2575,7 @@ const ye = class ye {
|
|
|
2575
2575
|
* @param folderId - The folder's unique identifier.
|
|
2576
2576
|
*/
|
|
2577
2577
|
async getFolder(e) {
|
|
2578
|
-
return await c(this, a, u).call(this, "GET", `${
|
|
2578
|
+
return await c(this, a, u).call(this, "GET", `${E}/${e}`);
|
|
2579
2579
|
}
|
|
2580
2580
|
/**
|
|
2581
2581
|
* Creates a new folder.
|
|
@@ -2584,7 +2584,7 @@ const ye = class ye {
|
|
|
2584
2584
|
* @returns The created folder.
|
|
2585
2585
|
*/
|
|
2586
2586
|
async createFolder(e, t, s) {
|
|
2587
|
-
return await c(this, a, u).call(this, "POST",
|
|
2587
|
+
return await c(this, a, u).call(this, "POST", E, {
|
|
2588
2588
|
body: JSON.stringify({
|
|
2589
2589
|
name: e,
|
|
2590
2590
|
...t && { parentId: t },
|
|
@@ -2601,7 +2601,7 @@ const ye = class ye {
|
|
|
2601
2601
|
*/
|
|
2602
2602
|
async updateFolder(e, t) {
|
|
2603
2603
|
const { name: s } = t;
|
|
2604
|
-
return await c(this, a, u).call(this, "PUT", `${
|
|
2604
|
+
return await c(this, a, u).call(this, "PUT", `${E}/${e}`, {
|
|
2605
2605
|
body: JSON.stringify({ name: s }),
|
|
2606
2606
|
contentType: "application/json"
|
|
2607
2607
|
});
|
|
@@ -2611,14 +2611,14 @@ const ye = class ye {
|
|
|
2611
2611
|
* @param folderId - The folder's unique identifier.
|
|
2612
2612
|
*/
|
|
2613
2613
|
async archiveFolder(e) {
|
|
2614
|
-
return await c(this, a, u).call(this, "DELETE", `${
|
|
2614
|
+
return await c(this, a, u).call(this, "DELETE", `${E}/${e}`);
|
|
2615
2615
|
}
|
|
2616
2616
|
/**
|
|
2617
2617
|
* Recovers a previously archived folder.
|
|
2618
2618
|
* @param folderId - The folder's unique identifier.
|
|
2619
2619
|
*/
|
|
2620
2620
|
async recoverFolder(e) {
|
|
2621
|
-
return await c(this, a, u).call(this, "PUT", `${
|
|
2621
|
+
return await c(this, a, u).call(this, "PUT", `${E}/${e}/recover`);
|
|
2622
2622
|
}
|
|
2623
2623
|
/**
|
|
2624
2624
|
* Downloads an entire folder as a ZIP archive.
|
|
@@ -2626,7 +2626,7 @@ const ye = class ye {
|
|
|
2626
2626
|
* @returns A fetch Response containing the ZIP data.
|
|
2627
2627
|
*/
|
|
2628
2628
|
async downloadFolder(e) {
|
|
2629
|
-
return await c(this, a,
|
|
2629
|
+
return await c(this, a, $).call(this, `${E}/${e}/download`);
|
|
2630
2630
|
}
|
|
2631
2631
|
// ─── Components ──────────────────────────────────────────────────
|
|
2632
2632
|
/**
|
|
@@ -2636,14 +2636,14 @@ const ye = class ye {
|
|
|
2636
2636
|
*/
|
|
2637
2637
|
async listComponents(e) {
|
|
2638
2638
|
const { folderId: t, ShowVersions: s, projectId: r } = e || {};
|
|
2639
|
-
return t ? await c(this, a, u).call(this, "GET", `${
|
|
2639
|
+
return t ? await c(this, a, u).call(this, "GET", `${E}/${t}/items`, {
|
|
2640
2640
|
query: {
|
|
2641
|
-
itemType:
|
|
2641
|
+
itemType: Z,
|
|
2642
2642
|
...s && { ShowVersions: s }
|
|
2643
2643
|
}
|
|
2644
2644
|
}) : await c(this, a, u).call(this, "GET", `${f}`, {
|
|
2645
2645
|
query: {
|
|
2646
|
-
itemType:
|
|
2646
|
+
itemType: Z,
|
|
2647
2647
|
...s && { ShowVersions: s },
|
|
2648
2648
|
...r && { projectId: r }
|
|
2649
2649
|
}
|
|
@@ -2655,7 +2655,7 @@ const ye = class ye {
|
|
|
2655
2655
|
* @param props - Options such as whether to include versions.
|
|
2656
2656
|
*/
|
|
2657
2657
|
async getComponent(e, t) {
|
|
2658
|
-
return await c(this, a,
|
|
2658
|
+
return await c(this, a, ue).call(this, e, t);
|
|
2659
2659
|
}
|
|
2660
2660
|
/**
|
|
2661
2661
|
* Creates a new component with the given file and version properties.
|
|
@@ -2664,7 +2664,7 @@ const ye = class ye {
|
|
|
2664
2664
|
*/
|
|
2665
2665
|
async createComponent(e) {
|
|
2666
2666
|
const { componentProps: t } = e;
|
|
2667
|
-
return await c(this, a,
|
|
2667
|
+
return await c(this, a, H).call(this, e, Z, t);
|
|
2668
2668
|
}
|
|
2669
2669
|
/**
|
|
2670
2670
|
* Updates an existing component. Can rename, move, and/or upload a new version.
|
|
@@ -2674,7 +2674,7 @@ const ye = class ye {
|
|
|
2674
2674
|
*/
|
|
2675
2675
|
async updateComponent(e, t) {
|
|
2676
2676
|
const { componentProps: s } = t;
|
|
2677
|
-
return await c(this, a,
|
|
2677
|
+
return await c(this, a, he).call(this, e, t, s);
|
|
2678
2678
|
}
|
|
2679
2679
|
/**
|
|
2680
2680
|
* Downloads a component's full ZIP file. Returns the raw fetch Response.
|
|
@@ -2683,7 +2683,7 @@ const ye = class ye {
|
|
|
2683
2683
|
* @returns A fetch Response containing the ZIP data.
|
|
2684
2684
|
*/
|
|
2685
2685
|
async downloadComponent(e, t) {
|
|
2686
|
-
return await c(this, a,
|
|
2686
|
+
return await c(this, a, V).call(this, e, t);
|
|
2687
2687
|
}
|
|
2688
2688
|
/**
|
|
2689
2689
|
* Downloads only the JavaScript bundle from a component's ZIP.
|
|
@@ -2694,7 +2694,7 @@ const ye = class ye {
|
|
|
2694
2694
|
*/
|
|
2695
2695
|
async downloadComponentBundle(e, t) {
|
|
2696
2696
|
const { versionTag: s, withDraft: r } = t || {};
|
|
2697
|
-
return await c(this, a,
|
|
2697
|
+
return await c(this, a, $).call(this, `${f}/${e}/download/bundle`, {
|
|
2698
2698
|
query: {
|
|
2699
2699
|
...s && { versionTag: s },
|
|
2700
2700
|
...r && { withDraft: r }
|
|
@@ -2722,7 +2722,7 @@ const ye = class ye {
|
|
|
2722
2722
|
* @returns The component's JavaScript source code as a string.
|
|
2723
2723
|
*/
|
|
2724
2724
|
async getBuiltInComponent(e) {
|
|
2725
|
-
return await (await c(this, a,
|
|
2725
|
+
return await (await c(this, a, $).call(this, `built-in/${e}/bundle`)).text();
|
|
2726
2726
|
}
|
|
2727
2727
|
/**
|
|
2728
2728
|
* Fetches a built-in component bundle, evaluates it, and registers it
|
|
@@ -2820,14 +2820,14 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
|
|
|
2820
2820
|
*/
|
|
2821
2821
|
async listApps(e) {
|
|
2822
2822
|
const { folderId: t, ShowVersions: s, projectId: r } = e || {};
|
|
2823
|
-
return t ? await c(this, a, u).call(this, "GET", `${
|
|
2823
|
+
return t ? await c(this, a, u).call(this, "GET", `${E}/${t}/items`, {
|
|
2824
2824
|
query: {
|
|
2825
|
-
itemType:
|
|
2825
|
+
itemType: ee,
|
|
2826
2826
|
...s && { ShowVersions: s }
|
|
2827
2827
|
}
|
|
2828
2828
|
}) : await c(this, a, u).call(this, "GET", `${f}`, {
|
|
2829
2829
|
query: {
|
|
2830
|
-
itemType:
|
|
2830
|
+
itemType: ee,
|
|
2831
2831
|
...s && { ShowVersions: s },
|
|
2832
2832
|
...r && { projectId: r }
|
|
2833
2833
|
}
|
|
@@ -2840,7 +2840,7 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
|
|
|
2840
2840
|
*/
|
|
2841
2841
|
async createApp(e) {
|
|
2842
2842
|
const { appProps: t } = e;
|
|
2843
|
-
return await c(this, a,
|
|
2843
|
+
return await c(this, a, H).call(this, e, ee, t);
|
|
2844
2844
|
}
|
|
2845
2845
|
/**
|
|
2846
2846
|
* Downloads an app's full ZIP file. Returns the raw fetch Response.
|
|
@@ -2849,7 +2849,7 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
|
|
|
2849
2849
|
* @returns A fetch Response containing the ZIP data.
|
|
2850
2850
|
*/
|
|
2851
2851
|
async downloadApp(e, t) {
|
|
2852
|
-
return await c(this, a,
|
|
2852
|
+
return await c(this, a, V).call(this, e, t);
|
|
2853
2853
|
}
|
|
2854
2854
|
/**
|
|
2855
2855
|
* Downloads only the JavaScript bundle from an app's ZIP.
|
|
@@ -2860,7 +2860,7 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
|
|
|
2860
2860
|
*/
|
|
2861
2861
|
async downloadAppBundle(e, t) {
|
|
2862
2862
|
const { versionTag: s, withDraft: r } = t || {};
|
|
2863
|
-
return await c(this, a,
|
|
2863
|
+
return await c(this, a, $).call(this, `${f}/${e}/download/bundle`, {
|
|
2864
2864
|
query: {
|
|
2865
2865
|
...s && { versionTag: s },
|
|
2866
2866
|
...r && { withDraft: r }
|
|
@@ -2884,7 +2884,7 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
|
|
|
2884
2884
|
* @returns The registry, scope, read-only token, and assembled `.npmrc`.
|
|
2885
2885
|
*/
|
|
2886
2886
|
async getNpmCredentials() {
|
|
2887
|
-
return await c(this, a, u).call(this, "GET", `${
|
|
2887
|
+
return await c(this, a, u).call(this, "GET", `${Ut}/credentials`);
|
|
2888
2888
|
}
|
|
2889
2889
|
// ─── Execution ───────────────────────────────────────────────────
|
|
2890
2890
|
/**
|
|
@@ -2903,7 +2903,7 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
|
|
|
2903
2903
|
*/
|
|
2904
2904
|
async executeComponent(e, t, s) {
|
|
2905
2905
|
if (this.localServerUrl) {
|
|
2906
|
-
const r = `${this.localServerUrl}/api/${
|
|
2906
|
+
const r = `${this.localServerUrl}/api/${S}/${e}/execute`, i = await fetch(r, {
|
|
2907
2907
|
method: "POST",
|
|
2908
2908
|
headers: { "Content-Type": "application/json" },
|
|
2909
2909
|
body: JSON.stringify(t)
|
|
@@ -2914,7 +2914,7 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
|
|
|
2914
2914
|
}
|
|
2915
2915
|
return await i.json();
|
|
2916
2916
|
}
|
|
2917
|
-
return await c(this, a, u).call(this, "POST", `${
|
|
2917
|
+
return await c(this, a, u).call(this, "POST", `${S}/${e}/execute`, {
|
|
2918
2918
|
body: JSON.stringify(t),
|
|
2919
2919
|
query: { ...s && { versionTag: s } },
|
|
2920
2920
|
contentType: "application/json"
|
|
@@ -2926,14 +2926,14 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
|
|
|
2926
2926
|
*/
|
|
2927
2927
|
async abortExecution(e) {
|
|
2928
2928
|
if (this.localServerUrl) {
|
|
2929
|
-
const t = `${this.localServerUrl}/api/${
|
|
2929
|
+
const t = `${this.localServerUrl}/api/${S}/progress/${e}/abort`, s = await fetch(t, { method: "POST" });
|
|
2930
2930
|
if (!s.ok) {
|
|
2931
2931
|
const r = await s.text().catch(() => "");
|
|
2932
2932
|
throw new Error(`Local server request failed: ${s.status} - ${r}`);
|
|
2933
2933
|
}
|
|
2934
2934
|
return await s.json();
|
|
2935
2935
|
}
|
|
2936
|
-
return await c(this, a, u).call(this, "POST", `${
|
|
2936
|
+
return await c(this, a, u).call(this, "POST", `${S}/progress/${e}/abort`);
|
|
2937
2937
|
}
|
|
2938
2938
|
/**
|
|
2939
2939
|
* Lists all executions for a given component.
|
|
@@ -2950,7 +2950,7 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
|
|
|
2950
2950
|
*/
|
|
2951
2951
|
async listExecutions(e, t) {
|
|
2952
2952
|
if (this.localServerUrl) {
|
|
2953
|
-
const s = t ? `?projectId=${encodeURIComponent(t)}` : "", r = `${this.localServerUrl}/api/${
|
|
2953
|
+
const s = t ? `?projectId=${encodeURIComponent(t)}` : "", r = `${this.localServerUrl}/api/${S}/${e}/progress${s}`, i = await fetch(r);
|
|
2954
2954
|
if (!i.ok) {
|
|
2955
2955
|
const o = await i.text().catch(() => "");
|
|
2956
2956
|
throw new Error(
|
|
@@ -2959,7 +2959,7 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
|
|
|
2959
2959
|
}
|
|
2960
2960
|
return await i.json();
|
|
2961
2961
|
}
|
|
2962
|
-
return await c(this, a, u).call(this, "GET", `${
|
|
2962
|
+
return await c(this, a, u).call(this, "GET", `${S}/${e}/progress`, { query: { ...t && { projectId: t } } });
|
|
2963
2963
|
}
|
|
2964
2964
|
/**
|
|
2965
2965
|
* Gets details of a specific execution, including its messages.
|
|
@@ -2968,14 +2968,14 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
|
|
|
2968
2968
|
*/
|
|
2969
2969
|
async getExecution(e) {
|
|
2970
2970
|
if (this.localServerUrl) {
|
|
2971
|
-
const t = `${this.localServerUrl}/api/${
|
|
2971
|
+
const t = `${this.localServerUrl}/api/${S}/progress/${e}`, s = await fetch(t);
|
|
2972
2972
|
if (!s.ok) {
|
|
2973
2973
|
const r = await s.text().catch(() => "");
|
|
2974
2974
|
throw new Error(`Local server request failed: ${s.status} - ${r}`);
|
|
2975
2975
|
}
|
|
2976
2976
|
return await s.json();
|
|
2977
2977
|
}
|
|
2978
|
-
return await c(this, a, u).call(this, "GET", `${
|
|
2978
|
+
return await c(this, a, u).call(this, "GET", `${S}/progress/${e}`);
|
|
2979
2979
|
}
|
|
2980
2980
|
/**
|
|
2981
2981
|
* Subscribes to real-time execution progress via WebSocket.
|
|
@@ -2984,7 +2984,7 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
|
|
|
2984
2984
|
* @param onUpdateCallback - Callback invoked on each progress/result event.
|
|
2985
2985
|
*/
|
|
2986
2986
|
async onExecutionProgress(e, t) {
|
|
2987
|
-
const s = this.localServerUrl ? `${this.localServerUrl}?accessToken=${this.accessToken}` : this.wsUrl, r = await
|
|
2987
|
+
const s = this.localServerUrl ? `${this.localServerUrl}?accessToken=${this.accessToken}` : this.wsUrl, r = await M(s, {
|
|
2988
2988
|
...this.localServerUrl && { transports: ["websocket"] }
|
|
2989
2989
|
});
|
|
2990
2990
|
r.on("connect", function() {
|
|
@@ -3004,7 +3004,7 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
|
|
|
3004
3004
|
*/
|
|
3005
3005
|
async createHiddenFile(e, t) {
|
|
3006
3006
|
const s = new FormData();
|
|
3007
|
-
return s.append("file", e), s.append("parentItemId", t), await c(this, a, u).call(this, "POST", `${f}/${
|
|
3007
|
+
return s.append("file", e), s.append("parentItemId", t), await c(this, a, u).call(this, "POST", `${f}/${C}`, {
|
|
3008
3008
|
body: s
|
|
3009
3009
|
});
|
|
3010
3010
|
}
|
|
@@ -3020,7 +3020,7 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
|
|
|
3020
3020
|
const s = new FormData();
|
|
3021
3021
|
for (const r of e)
|
|
3022
3022
|
s.append("files", r);
|
|
3023
|
-
return s.append("parentItemId", t), await c(this, a, u).call(this, "POST", `${f}/${
|
|
3023
|
+
return s.append("parentItemId", t), await c(this, a, u).call(this, "POST", `${f}/${C}/batch`, {
|
|
3024
3024
|
body: s
|
|
3025
3025
|
});
|
|
3026
3026
|
}
|
|
@@ -3029,21 +3029,21 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
|
|
|
3029
3029
|
* @param hiddenId - The hidden file's unique identifier.
|
|
3030
3030
|
*/
|
|
3031
3031
|
async deleteHiddenFile(e) {
|
|
3032
|
-
return await c(this, a, u).call(this, "DELETE", `${f}/${
|
|
3032
|
+
return await c(this, a, u).call(this, "DELETE", `${f}/${C}/${e}`);
|
|
3033
3033
|
}
|
|
3034
3034
|
/**
|
|
3035
3035
|
* Gets metadata for a hidden file.
|
|
3036
3036
|
* @param hiddenId - The hidden file's unique identifier.
|
|
3037
3037
|
*/
|
|
3038
3038
|
async getHiddenFile(e) {
|
|
3039
|
-
return await c(this, a, u).call(this, "GET", `${f}/${
|
|
3039
|
+
return await c(this, a, u).call(this, "GET", `${f}/${C}/${e}`);
|
|
3040
3040
|
}
|
|
3041
3041
|
/**
|
|
3042
3042
|
* Downloads a hidden file's content. Returns the raw fetch Response.
|
|
3043
3043
|
* @param hiddenId - The hidden file's unique identifier.
|
|
3044
3044
|
*/
|
|
3045
3045
|
async downloadHiddenFile(e) {
|
|
3046
|
-
return await c(this, a,
|
|
3046
|
+
return await c(this, a, $).call(this, `${f}/${C}/${e}/download`);
|
|
3047
3047
|
}
|
|
3048
3048
|
/**
|
|
3049
3049
|
* Mints a short-lived presigned URL for a hidden file so the browser can
|
|
@@ -3063,7 +3063,7 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
|
|
|
3063
3063
|
* an ISO timestamp when it stops working.
|
|
3064
3064
|
*/
|
|
3065
3065
|
async getHiddenFileSignedUrl(e, t) {
|
|
3066
|
-
return await c(this, a, u).call(this, "GET", `${f}/${
|
|
3066
|
+
return await c(this, a, u).call(this, "GET", `${f}/${C}/${e}/signed-url`, { ...t != null && { query: { expiresIn: t } } });
|
|
3067
3067
|
}
|
|
3068
3068
|
/**
|
|
3069
3069
|
* Lists all hidden files attached to a parent item.
|
|
@@ -3071,14 +3071,14 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
|
|
|
3071
3071
|
* @returns Array of hidden file entities.
|
|
3072
3072
|
*/
|
|
3073
3073
|
async getHiddenFilesByParent(e) {
|
|
3074
|
-
return await c(this, a, u).call(this, "GET", `${f}/${e}/${
|
|
3074
|
+
return await c(this, a, u).call(this, "GET", `${f}/${e}/${C}`);
|
|
3075
3075
|
}
|
|
3076
3076
|
/**
|
|
3077
3077
|
* Deletes all hidden files attached to a parent item.
|
|
3078
3078
|
* @param parentFileId - The parent item's unique identifier.
|
|
3079
3079
|
*/
|
|
3080
3080
|
async deleteHiddenFilesByParent(e) {
|
|
3081
|
-
return await c(this, a, u).call(this, "DELETE", `${f}/${e}/${
|
|
3081
|
+
return await c(this, a, u).call(this, "DELETE", `${f}/${e}/${C}`);
|
|
3082
3082
|
}
|
|
3083
3083
|
// ─── Icons ───────────────────────────────────────────────────────
|
|
3084
3084
|
/**
|
|
@@ -3098,7 +3098,7 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
|
|
|
3098
3098
|
* @returns The raw Response (use `.blob()`, `.arrayBuffer()`, or pipe the body).
|
|
3099
3099
|
*/
|
|
3100
3100
|
async getItemIcon(e) {
|
|
3101
|
-
return await c(this, a,
|
|
3101
|
+
return await c(this, a, $).call(this, `${f}/${e}/icon`);
|
|
3102
3102
|
}
|
|
3103
3103
|
/**
|
|
3104
3104
|
* Removes the icon from an item.
|
|
@@ -3176,47 +3176,47 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
|
|
|
3176
3176
|
return await c(this, a, u).call(this, "DELETE", `${f}/${encodeURIComponent(e)}/version/${encodeURIComponent(t)}`);
|
|
3177
3177
|
}
|
|
3178
3178
|
};
|
|
3179
|
-
a = new WeakSet(),
|
|
3179
|
+
a = new WeakSet(), ce = function(e) {
|
|
3180
3180
|
return `${this.apiUrl}/${e}`;
|
|
3181
3181
|
}, u = async function(e, t, s) {
|
|
3182
|
-
const { body: r, query: i, contentType: o, retries: h } = s || {},
|
|
3183
|
-
...
|
|
3184
|
-
...this.useBearer ? {} : { accessToken:
|
|
3182
|
+
const { body: r, query: i, contentType: o, retries: h, responseType: l } = s || {}, y = c(this, a, ce).call(this, t), d = c(this, a, De).call(this, i), m = await this.resolveAccessToken(), k = {
|
|
3183
|
+
...d,
|
|
3184
|
+
...this.useBearer ? {} : { accessToken: m }
|
|
3185
3185
|
};
|
|
3186
3186
|
try {
|
|
3187
|
-
const
|
|
3188
|
-
|
|
3187
|
+
const A = await fetch(
|
|
3188
|
+
y + "?" + new URLSearchParams(k).toString(),
|
|
3189
3189
|
{
|
|
3190
3190
|
method: e,
|
|
3191
3191
|
headers: {
|
|
3192
3192
|
Accept: "application/json",
|
|
3193
3193
|
...o && { "Content-Type": o },
|
|
3194
|
-
...this.useBearer && { Authorization: `Bearer ${
|
|
3194
|
+
...this.useBearer && { Authorization: `Bearer ${m}` }
|
|
3195
3195
|
},
|
|
3196
3196
|
...r && { body: r }
|
|
3197
3197
|
}
|
|
3198
3198
|
);
|
|
3199
|
-
if (!
|
|
3200
|
-
const
|
|
3201
|
-
throw new
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3199
|
+
if (!A.ok) {
|
|
3200
|
+
const O = await A.text().then((Fe) => Fe).catch(() => "");
|
|
3201
|
+
throw new qt(
|
|
3202
|
+
A.status,
|
|
3203
|
+
A.statusText,
|
|
3204
|
+
O
|
|
3205
3205
|
);
|
|
3206
3206
|
}
|
|
3207
|
-
return
|
|
3207
|
+
return l === "blob" ? await A.blob() : A.json().then((O) => O).catch(() => {
|
|
3208
3208
|
});
|
|
3209
|
-
} catch (
|
|
3210
|
-
let
|
|
3211
|
-
if (
|
|
3212
|
-
return
|
|
3209
|
+
} catch (A) {
|
|
3210
|
+
let O = h ?? this.retries;
|
|
3211
|
+
if (O)
|
|
3212
|
+
return O = O - 1, await c(this, a, u).call(this, e, t, {
|
|
3213
3213
|
...s,
|
|
3214
|
-
retries:
|
|
3214
|
+
retries: O
|
|
3215
3215
|
});
|
|
3216
|
-
throw
|
|
3216
|
+
throw A;
|
|
3217
3217
|
}
|
|
3218
|
-
},
|
|
3219
|
-
const { query: s } = t || {}, r = c(this, a,
|
|
3218
|
+
}, $ = async function(e, t) {
|
|
3219
|
+
const { query: s } = t || {}, r = c(this, a, ce).call(this, e), i = await this.resolveAccessToken(), o = {
|
|
3220
3220
|
...s,
|
|
3221
3221
|
...this.useBearer ? {} : { accessToken: i }
|
|
3222
3222
|
};
|
|
@@ -3229,20 +3229,20 @@ a = new WeakSet(), ae = function(e) {
|
|
|
3229
3229
|
}
|
|
3230
3230
|
}
|
|
3231
3231
|
);
|
|
3232
|
-
},
|
|
3232
|
+
}, V = async function(e, t) {
|
|
3233
3233
|
const { versionTag: s, withDraft: r } = t || {};
|
|
3234
|
-
return await c(this, a,
|
|
3234
|
+
return await c(this, a, $).call(this, `${f}/${e}/download`, {
|
|
3235
3235
|
query: {
|
|
3236
3236
|
...s && { versionTag: s },
|
|
3237
3237
|
...r && { withDraft: r }
|
|
3238
3238
|
}
|
|
3239
3239
|
});
|
|
3240
|
-
},
|
|
3240
|
+
}, H = async function(e, t, s) {
|
|
3241
3241
|
const { name: r, versionTag: i, parentFolderId: o, projectId: h, file: l, metadata: y } = e, d = new FormData();
|
|
3242
3242
|
return d.append("file", l), d.append("name", r), d.append("versionTag", i), d.append("itemType", t), o && d.append("folderId", o), h && d.append("projectId", h), s && d.append("extraProps", JSON.stringify(s)), y && d.append("metadata", JSON.stringify(y)), await c(this, a, u).call(this, "POST", f, {
|
|
3243
3243
|
body: d
|
|
3244
3244
|
});
|
|
3245
|
-
},
|
|
3245
|
+
}, he = async function(e, t, s) {
|
|
3246
3246
|
const { name: r, versionTag: i, parentFolderId: o, file: h, metadata: l } = t;
|
|
3247
3247
|
let y, d;
|
|
3248
3248
|
if (h) {
|
|
@@ -3255,28 +3255,28 @@ a = new WeakSet(), ae = function(e) {
|
|
|
3255
3255
|
const m = {
|
|
3256
3256
|
...r && { name: r },
|
|
3257
3257
|
...o && { folderId: o }
|
|
3258
|
-
},
|
|
3258
|
+
}, k = JSON.stringify(m);
|
|
3259
3259
|
y = await c(this, a, u).call(this, "PUT", `${f}/${e}`, {
|
|
3260
|
-
body:
|
|
3260
|
+
body: k,
|
|
3261
3261
|
contentType: "application/json"
|
|
3262
3262
|
});
|
|
3263
3263
|
}
|
|
3264
3264
|
return { item: y, version: d };
|
|
3265
|
-
},
|
|
3265
|
+
}, ue = async function(e, t) {
|
|
3266
3266
|
const { showVersions: s = !1 } = t || {};
|
|
3267
3267
|
return await c(this, a, u).call(this, "GET", `${f}/${e}`, {
|
|
3268
3268
|
query: { showVersions: s }
|
|
3269
3269
|
});
|
|
3270
|
-
},
|
|
3270
|
+
}, De = function(e) {
|
|
3271
3271
|
return e && Object.entries(e).filter(([, t]) => t !== void 0).reduce(
|
|
3272
3272
|
(t, [s, r]) => (t[s] = r, t),
|
|
3273
3273
|
{}
|
|
3274
3274
|
);
|
|
3275
3275
|
};
|
|
3276
|
-
let
|
|
3277
|
-
const
|
|
3278
|
-
var
|
|
3279
|
-
const
|
|
3276
|
+
let ae = me;
|
|
3277
|
+
const q = "project";
|
|
3278
|
+
var B;
|
|
3279
|
+
const ge = class ge extends ae {
|
|
3280
3280
|
/**
|
|
3281
3281
|
* @param token - A bearer JWT, OR a function returning the current JWT
|
|
3282
3282
|
* (sync or async). When a function is passed, it's invoked before every
|
|
@@ -3287,11 +3287,11 @@ const me = class me extends oe {
|
|
|
3287
3287
|
*/
|
|
3288
3288
|
constructor(t, s, r) {
|
|
3289
3289
|
super(typeof t == "string" ? t : "", s, { ...r, useBearer: !0 });
|
|
3290
|
-
|
|
3291
|
-
typeof t == "function" &&
|
|
3290
|
+
K(this, B);
|
|
3291
|
+
typeof t == "function" && _e(this, B, t);
|
|
3292
3292
|
}
|
|
3293
3293
|
async resolveAccessToken() {
|
|
3294
|
-
return
|
|
3294
|
+
return Y(this, B) ? await Y(this, B).call(this) : super.resolveAccessToken();
|
|
3295
3295
|
}
|
|
3296
3296
|
/**
|
|
3297
3297
|
* Creates a client from the platform context injected into
|
|
@@ -3300,7 +3300,7 @@ const me = class me extends oe {
|
|
|
3300
3300
|
* carries a fresh JWT on every navigation.
|
|
3301
3301
|
*/
|
|
3302
3302
|
static fromPlatformContext(t) {
|
|
3303
|
-
const s = (typeof window < "u" ? window.__THATOPEN_CONTEXT__ : null) || { appId: "", projectId: "", accessToken: "", apiUrl: "" }, r = new
|
|
3303
|
+
const s = (typeof window < "u" ? window.__THATOPEN_CONTEXT__ : null) || { appId: "", projectId: "", accessToken: "", apiUrl: "" }, r = new ge(s.accessToken, s.apiUrl, t);
|
|
3304
3304
|
return r.context = s, r;
|
|
3305
3305
|
}
|
|
3306
3306
|
// ─── Projects (JWT-only backend routes) ──────────────────────────
|
|
@@ -3309,7 +3309,7 @@ const me = class me extends oe {
|
|
|
3309
3309
|
* `GET /project/:id` is guarded by `AccountActiveGuard + ProjectAccessGuard`.
|
|
3310
3310
|
*/
|
|
3311
3311
|
async getProject(t) {
|
|
3312
|
-
return await this.request("GET", `${
|
|
3312
|
+
return await this.request("GET", `${q}/${t}`);
|
|
3313
3313
|
}
|
|
3314
3314
|
/**
|
|
3315
3315
|
* Gets the full project data (users, roles, files, folders) for a project.
|
|
@@ -3318,9 +3318,21 @@ const me = class me extends oe {
|
|
|
3318
3318
|
async getProjectData(t) {
|
|
3319
3319
|
return await this.request(
|
|
3320
3320
|
"GET",
|
|
3321
|
-
`${
|
|
3321
|
+
`${q}/${t}/data`
|
|
3322
3322
|
);
|
|
3323
3323
|
}
|
|
3324
|
+
// ─── Account ──────────────────────────────────────────────────────
|
|
3325
|
+
/**
|
|
3326
|
+
* Fetches a user's profile picture as raw image bytes, for showing member
|
|
3327
|
+
* avatars inside an app. The route is bearer-authed, so it can't be used as
|
|
3328
|
+
* an `<img src>` — turn the blob into an object URL with
|
|
3329
|
+
* `URL.createObjectURL(blob)`. Rejects when the account has no avatar.
|
|
3330
|
+
*/
|
|
3331
|
+
async getAvatar(t) {
|
|
3332
|
+
return await this.request("GET", `account/${t}/avatar`, {
|
|
3333
|
+
responseType: "blob"
|
|
3334
|
+
});
|
|
3335
|
+
}
|
|
3324
3336
|
// ─── Permissions (JWT-only backend routes) ───────────────────────
|
|
3325
3337
|
/**
|
|
3326
3338
|
* Checks whether the caller has a specific permission within a project.
|
|
@@ -3331,7 +3343,7 @@ const me = class me extends oe {
|
|
|
3331
3343
|
async checkPermission(t) {
|
|
3332
3344
|
return await this.request(
|
|
3333
3345
|
"GET",
|
|
3334
|
-
`${
|
|
3346
|
+
`${q}/permissions/check`,
|
|
3335
3347
|
{ query: t }
|
|
3336
3348
|
);
|
|
3337
3349
|
}
|
|
@@ -3340,28 +3352,28 @@ const me = class me extends oe {
|
|
|
3340
3352
|
* single round-trip; results come back in the same order as `checks`.
|
|
3341
3353
|
*/
|
|
3342
3354
|
async checkPermissionBatch(t) {
|
|
3343
|
-
return (await this.request("POST", `${
|
|
3355
|
+
return (await this.request("POST", `${q}/permissions/check/batch`, {
|
|
3344
3356
|
body: JSON.stringify({ checks: t }),
|
|
3345
3357
|
contentType: "application/json"
|
|
3346
3358
|
})).results;
|
|
3347
3359
|
}
|
|
3348
3360
|
};
|
|
3349
|
-
|
|
3350
|
-
let
|
|
3351
|
-
const
|
|
3361
|
+
B = new WeakMap();
|
|
3362
|
+
let Ae = ge;
|
|
3363
|
+
const Mt = {
|
|
3352
3364
|
MAX_FIELDS: 200,
|
|
3353
3365
|
MAX_KEY_LENGTH: 50,
|
|
3354
3366
|
MAX_VALUE_LENGTH: 50
|
|
3355
|
-
},
|
|
3367
|
+
}, Vt = { uuid: "a3f82c1d-5b74-4e9a-bc30-d7e12f894a61" }, Ht = { uuid: "2c9f4e8d-3a1b-4c5e-9d7f-0a2b6c8e1d3f" }, Gt = { uuid: "b0b5e2a2-0b3a-4a6b-8b1c-0b1c4a6b8b1c" }, jt = { uuid: "2c4ae432-fc24-43e9-9783-0c960c674e96" }, Jt = { uuid: "69af63aa-19ba-4fc7-b17b-75647bac1d76" }, Yt = { uuid: "234f1416-528d-452a-9cc9-a16c5239b2eb" };
|
|
3356
3368
|
export {
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3369
|
+
Vt as CDEManager,
|
|
3370
|
+
Ht as ClashesManager,
|
|
3371
|
+
ae as EngineServicesClient,
|
|
3372
|
+
Gt as FileList,
|
|
3373
|
+
jt as HelloWorld,
|
|
3374
|
+
Mt as METADATA_LIMITS,
|
|
3375
|
+
Ae as PlatformClient,
|
|
3376
|
+
qt as RequestError,
|
|
3377
|
+
Jt as TopicsManager,
|
|
3378
|
+
Yt as UIManager
|
|
3367
3379
|
};
|