@thatopen/services 0.3.15 → 0.4.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/built-in/index.d.ts +165 -2
- package/dist/cli.js +27 -13
- 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 +396 -374
- package/dist/vite-env.d.ts +1 -1
- package/docs/builtin/paths.json +94 -86
- 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/package.json +4 -4
- 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/ProjectFileStorage/example.ts +150 -0
- package/src/built-in/UIManager/src/app/examples/Sidebar/example.ts +102 -102
- package/src/built-in/UIManager/src/clashes-panel/example.ts +183 -160
- package/src/built-in/UIManager/src/models-list/example.ts +122 -122
- package/src/built-in/UIManager/src/topics-panel/example.ts +170 -0
- package/src/built-in/index.ts +1048 -881
- package/src/cli/templates/app/index.html +35 -35
- package/src/cli/templates/app/package.json +32 -32
- 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/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
59
|
data: Je(n.substring(1), e)
|
|
60
|
-
} :
|
|
61
|
-
type:
|
|
60
|
+
} : U[t] ? n.length > 1 ? {
|
|
61
|
+
type: U[t],
|
|
62
62
|
data: n.substring(1)
|
|
63
63
|
} : {
|
|
64
|
-
type:
|
|
65
|
-
} :
|
|
64
|
+
type: U[t]
|
|
65
|
+
} : te;
|
|
66
66
|
}, Je = (n, e) => {
|
|
67
|
-
if (
|
|
68
|
-
const t =
|
|
69
|
-
return
|
|
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
|
*
|
|
@@ -474,8 +474,8 @@ class ht extends ot {
|
|
|
474
474
|
/**
|
|
475
475
|
* Sends data.
|
|
476
476
|
*
|
|
477
|
-
* @param {String} data to send.
|
|
478
|
-
* @param {Function} called upon flush.
|
|
477
|
+
* @param {String} data - data to send.
|
|
478
|
+
* @param {Function} fn - called upon flush.
|
|
479
479
|
* @private
|
|
480
480
|
*/
|
|
481
481
|
doWrite(e, t) {
|
|
@@ -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
|
}
|
|
@@ -1008,7 +1008,7 @@ class $ extends g {
|
|
|
1008
1008
|
/**
|
|
1009
1009
|
* Sends a packet.
|
|
1010
1010
|
*
|
|
1011
|
-
* @param {String} type
|
|
1011
|
+
* @param {String} type - packet type.
|
|
1012
1012
|
* @param {String} data.
|
|
1013
1013
|
* @param {Object} options.
|
|
1014
1014
|
* @param {Function} fn - callback function.
|
|
@@ -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
|
-
const s = typeof e == "object" ? e : t;
|
|
1144
|
-
(!
|
|
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) => 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,18 +1267,19 @@ 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
|
-
*
|
|
1278
|
-
* @param {function} reviver - custom reviver to pass down to JSON.stringify
|
|
1279
1277
|
*/
|
|
1280
1278
|
constructor(e) {
|
|
1281
|
-
super(), this.
|
|
1279
|
+
super(), this.opts = Object.assign({
|
|
1280
|
+
reviver: void 0,
|
|
1281
|
+
maxAttachments: 10
|
|
1282
|
+
}, typeof e == "function" ? { reviver: e } : e);
|
|
1282
1283
|
}
|
|
1283
1284
|
/**
|
|
1284
1285
|
* Decodes an encoded packet string into packet JSON.
|
|
@@ -1292,8 +1293,8 @@ class de extends g {
|
|
|
1292
1293
|
throw new Error("got plaintext data when reconstructing a packet");
|
|
1293
1294
|
t = this.decodeString(e);
|
|
1294
1295
|
const s = t.type === p.BINARY_EVENT;
|
|
1295
|
-
s || t.type === p.BINARY_ACK ? (t.type = s ? p.EVENT : p.ACK, this.reconstructor = new
|
|
1296
|
-
} 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)
|
|
1297
1298
|
if (this.reconstructor)
|
|
1298
1299
|
t = this.reconstructor.takeBinaryData(e), t && (this.reconstructor = null, super.emitReserved("decoded", t));
|
|
1299
1300
|
else
|
|
@@ -1321,7 +1322,12 @@ class de extends g {
|
|
|
1321
1322
|
const o = e.substring(i, t);
|
|
1322
1323
|
if (o != Number(o) || e.charAt(t) !== "-")
|
|
1323
1324
|
throw new Error("Illegal attachments");
|
|
1324
|
-
|
|
1325
|
+
const h = Number(o);
|
|
1326
|
+
if (!Nt(h) || h < 0)
|
|
1327
|
+
throw new Error("Illegal attachments");
|
|
1328
|
+
if (h > this.opts.maxAttachments)
|
|
1329
|
+
throw new Error("too many attachments");
|
|
1330
|
+
s.attachments = h;
|
|
1325
1331
|
}
|
|
1326
1332
|
if (e.charAt(t + 1) === "/") {
|
|
1327
1333
|
const i = t + 1;
|
|
@@ -1346,7 +1352,7 @@ class de extends g {
|
|
|
1346
1352
|
}
|
|
1347
1353
|
if (e.charAt(++t)) {
|
|
1348
1354
|
const i = this.tryParse(e.substr(t));
|
|
1349
|
-
if (
|
|
1355
|
+
if (ye.isPayloadValid(s.type, i))
|
|
1350
1356
|
s.data = i;
|
|
1351
1357
|
else
|
|
1352
1358
|
throw new Error("invalid payload");
|
|
@@ -1355,7 +1361,7 @@ class de extends g {
|
|
|
1355
1361
|
}
|
|
1356
1362
|
tryParse(e) {
|
|
1357
1363
|
try {
|
|
1358
|
-
return JSON.parse(e, this.reviver);
|
|
1364
|
+
return JSON.parse(e, this.opts.reviver);
|
|
1359
1365
|
} catch {
|
|
1360
1366
|
return !1;
|
|
1361
1367
|
}
|
|
@@ -1363,14 +1369,14 @@ class de extends g {
|
|
|
1363
1369
|
static isPayloadValid(e, t) {
|
|
1364
1370
|
switch (e) {
|
|
1365
1371
|
case p.CONNECT:
|
|
1366
|
-
return
|
|
1372
|
+
return ke(t);
|
|
1367
1373
|
case p.DISCONNECT:
|
|
1368
1374
|
return t === void 0;
|
|
1369
1375
|
case p.CONNECT_ERROR:
|
|
1370
|
-
return typeof t == "string" ||
|
|
1376
|
+
return typeof t == "string" || ke(t);
|
|
1371
1377
|
case p.EVENT:
|
|
1372
1378
|
case p.BINARY_EVENT:
|
|
1373
|
-
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);
|
|
1374
1380
|
case p.ACK:
|
|
1375
1381
|
case p.BINARY_ACK:
|
|
1376
1382
|
return Array.isArray(t);
|
|
@@ -1383,7 +1389,7 @@ class de extends g {
|
|
|
1383
1389
|
this.reconstructor && (this.reconstructor.finishedReconstruction(), this.reconstructor = null);
|
|
1384
1390
|
}
|
|
1385
1391
|
}
|
|
1386
|
-
class
|
|
1392
|
+
class xt {
|
|
1387
1393
|
constructor(e) {
|
|
1388
1394
|
this.packet = e, this.buffers = [], this.reconPack = e;
|
|
1389
1395
|
}
|
|
@@ -1397,7 +1403,7 @@ class Bt {
|
|
|
1397
1403
|
*/
|
|
1398
1404
|
takeBinaryData(e) {
|
|
1399
1405
|
if (this.buffers.push(e), this.buffers.length === this.reconPack.attachments) {
|
|
1400
|
-
const t =
|
|
1406
|
+
const t = $t(this.reconPack, this.buffers);
|
|
1401
1407
|
return this.finishedReconstruction(), t;
|
|
1402
1408
|
}
|
|
1403
1409
|
return null;
|
|
@@ -1409,23 +1415,26 @@ class Bt {
|
|
|
1409
1415
|
this.reconPack = null, this.buffers = [];
|
|
1410
1416
|
}
|
|
1411
1417
|
}
|
|
1412
|
-
function
|
|
1418
|
+
const Nt = Number.isInteger || function(n) {
|
|
1419
|
+
return typeof n == "number" && isFinite(n) && Math.floor(n) === n;
|
|
1420
|
+
};
|
|
1421
|
+
function ke(n) {
|
|
1413
1422
|
return Object.prototype.toString.call(n) === "[object Object]";
|
|
1414
1423
|
}
|
|
1415
|
-
const
|
|
1424
|
+
const Pt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1416
1425
|
__proto__: null,
|
|
1417
|
-
Decoder:
|
|
1418
|
-
Encoder:
|
|
1426
|
+
Decoder: ye,
|
|
1427
|
+
Encoder: Bt,
|
|
1419
1428
|
get PacketType() {
|
|
1420
1429
|
return p;
|
|
1421
1430
|
}
|
|
1422
1431
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1423
|
-
function
|
|
1432
|
+
function b(n, e, t) {
|
|
1424
1433
|
return n.on(e, t), function() {
|
|
1425
1434
|
n.off(e, t);
|
|
1426
1435
|
};
|
|
1427
1436
|
}
|
|
1428
|
-
const
|
|
1437
|
+
const Lt = Object.freeze({
|
|
1429
1438
|
connect: 1,
|
|
1430
1439
|
connect_error: 1,
|
|
1431
1440
|
disconnect: 1,
|
|
@@ -1434,7 +1443,7 @@ const Nt = Object.freeze({
|
|
|
1434
1443
|
newListener: 1,
|
|
1435
1444
|
removeListener: 1
|
|
1436
1445
|
});
|
|
1437
|
-
class
|
|
1446
|
+
class Ue extends g {
|
|
1438
1447
|
/**
|
|
1439
1448
|
* `Socket` constructor.
|
|
1440
1449
|
*/
|
|
@@ -1468,10 +1477,10 @@ class qe extends g {
|
|
|
1468
1477
|
return;
|
|
1469
1478
|
const e = this.io;
|
|
1470
1479
|
this.subs = [
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
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))
|
|
1475
1484
|
];
|
|
1476
1485
|
}
|
|
1477
1486
|
/**
|
|
@@ -1550,7 +1559,7 @@ class qe extends g {
|
|
|
1550
1559
|
*/
|
|
1551
1560
|
emit(e, ...t) {
|
|
1552
1561
|
var s, r, i;
|
|
1553
|
-
if (
|
|
1562
|
+
if (Lt.hasOwnProperty(e))
|
|
1554
1563
|
throw new Error('"' + e.toString() + '" is a reserved event name');
|
|
1555
1564
|
if (t.unshift(e), this._opts.retries && !this.flags.fromQueue && !this.flags.volatile)
|
|
1556
1565
|
return this._addToQueue(t), this;
|
|
@@ -2026,10 +2035,10 @@ class qe extends g {
|
|
|
2026
2035
|
}
|
|
2027
2036
|
}
|
|
2028
2037
|
}
|
|
2029
|
-
function
|
|
2038
|
+
function x(n) {
|
|
2030
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;
|
|
2031
2040
|
}
|
|
2032
|
-
|
|
2041
|
+
x.prototype.duration = function() {
|
|
2033
2042
|
var n = this.ms * Math.pow(this.factor, this.attempts++);
|
|
2034
2043
|
if (this.jitter) {
|
|
2035
2044
|
var e = Math.random(), t = Math.floor(e * this.jitter * n);
|
|
@@ -2037,27 +2046,27 @@ B.prototype.duration = function() {
|
|
|
2037
2046
|
}
|
|
2038
2047
|
return Math.min(n, this.max) | 0;
|
|
2039
2048
|
};
|
|
2040
|
-
|
|
2049
|
+
x.prototype.reset = function() {
|
|
2041
2050
|
this.attempts = 0;
|
|
2042
2051
|
};
|
|
2043
|
-
|
|
2052
|
+
x.prototype.setMin = function(n) {
|
|
2044
2053
|
this.ms = n;
|
|
2045
2054
|
};
|
|
2046
|
-
|
|
2055
|
+
x.prototype.setMax = function(n) {
|
|
2047
2056
|
this.max = n;
|
|
2048
2057
|
};
|
|
2049
|
-
|
|
2058
|
+
x.prototype.setJitter = function(n) {
|
|
2050
2059
|
this.jitter = n;
|
|
2051
2060
|
};
|
|
2052
|
-
class
|
|
2061
|
+
class oe extends g {
|
|
2053
2062
|
constructor(e, t) {
|
|
2054
2063
|
var s;
|
|
2055
|
-
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({
|
|
2056
2065
|
min: this.reconnectionDelay(),
|
|
2057
2066
|
max: this.reconnectionDelayMax(),
|
|
2058
2067
|
jitter: this.randomizationFactor()
|
|
2059
2068
|
}), this.timeout(t.timeout == null ? 2e4 : t.timeout), this._readyState = "closed", this.uri = e;
|
|
2060
|
-
const r = t.parser ||
|
|
2069
|
+
const r = t.parser || Pt;
|
|
2061
2070
|
this.encoder = new r.Encoder(), this.decoder = new r.Decoder(), this._autoConnect = t.autoConnect !== !1, this._autoConnect && this.open();
|
|
2062
2071
|
}
|
|
2063
2072
|
reconnection(e) {
|
|
@@ -2100,14 +2109,14 @@ class ie extends g {
|
|
|
2100
2109
|
open(e) {
|
|
2101
2110
|
if (~this._readyState.indexOf("open"))
|
|
2102
2111
|
return this;
|
|
2103
|
-
this.engine = new
|
|
2112
|
+
this.engine = new Tt(this.uri, this.opts);
|
|
2104
2113
|
const t = this.engine, s = this;
|
|
2105
2114
|
this._readyState = "opening", this.skipReconnect = !1;
|
|
2106
|
-
const r =
|
|
2115
|
+
const r = b(t, "open", function() {
|
|
2107
2116
|
s.onopen(), e && e();
|
|
2108
2117
|
}), i = (h) => {
|
|
2109
2118
|
this.cleanup(), this._readyState = "closed", this.emitReserved("error", h), e ? e(h) : this.maybeReconnectOnOpen();
|
|
2110
|
-
}, o =
|
|
2119
|
+
}, o = b(t, "error", i);
|
|
2111
2120
|
if (this._timeout !== !1) {
|
|
2112
2121
|
const h = this._timeout, l = this.setTimeoutFn(() => {
|
|
2113
2122
|
r(), i(new Error("timeout")), t.close();
|
|
@@ -2136,12 +2145,12 @@ class ie extends g {
|
|
|
2136
2145
|
this.cleanup(), this._readyState = "open", this.emitReserved("open");
|
|
2137
2146
|
const e = this.engine;
|
|
2138
2147
|
this.subs.push(
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
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)),
|
|
2143
2152
|
// @ts-ignore
|
|
2144
|
-
|
|
2153
|
+
b(this.decoder, "decoded", this.ondecoded.bind(this))
|
|
2145
2154
|
);
|
|
2146
2155
|
}
|
|
2147
2156
|
/**
|
|
@@ -2170,7 +2179,7 @@ class ie extends g {
|
|
|
2170
2179
|
* @private
|
|
2171
2180
|
*/
|
|
2172
2181
|
ondecoded(e) {
|
|
2173
|
-
|
|
2182
|
+
G(() => {
|
|
2174
2183
|
this.emitReserved("packet", e);
|
|
2175
2184
|
}, this.setTimeoutFn);
|
|
2176
2185
|
}
|
|
@@ -2190,7 +2199,7 @@ class ie extends g {
|
|
|
2190
2199
|
*/
|
|
2191
2200
|
socket(e, t) {
|
|
2192
2201
|
let s = this.nsps[e];
|
|
2193
|
-
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;
|
|
2194
2203
|
}
|
|
2195
2204
|
/**
|
|
2196
2205
|
* Called upon a socket close.
|
|
@@ -2287,20 +2296,20 @@ class ie extends g {
|
|
|
2287
2296
|
this._reconnecting = !1, this.backoff.reset(), this.emitReserved("reconnect", e);
|
|
2288
2297
|
}
|
|
2289
2298
|
}
|
|
2290
|
-
const
|
|
2291
|
-
function
|
|
2299
|
+
const N = {};
|
|
2300
|
+
function M(n, e) {
|
|
2292
2301
|
typeof n == "object" && (e = n, n = void 0), e = e || {};
|
|
2293
|
-
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;
|
|
2294
2303
|
let l;
|
|
2295
|
-
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);
|
|
2296
2305
|
}
|
|
2297
|
-
Object.assign(
|
|
2298
|
-
Manager:
|
|
2299
|
-
Socket:
|
|
2300
|
-
io:
|
|
2301
|
-
connect:
|
|
2306
|
+
Object.assign(M, {
|
|
2307
|
+
Manager: oe,
|
|
2308
|
+
Socket: Ue,
|
|
2309
|
+
io: M,
|
|
2310
|
+
connect: M
|
|
2302
2311
|
});
|
|
2303
|
-
function
|
|
2312
|
+
function It(n) {
|
|
2304
2313
|
try {
|
|
2305
2314
|
const e = JSON.parse(n);
|
|
2306
2315
|
if (e && typeof e == "object") {
|
|
@@ -2315,20 +2324,20 @@ function Pt(n) {
|
|
|
2315
2324
|
}
|
|
2316
2325
|
return {};
|
|
2317
2326
|
}
|
|
2318
|
-
class
|
|
2327
|
+
class qt extends Error {
|
|
2319
2328
|
constructor(t, s, r) {
|
|
2320
|
-
const i =
|
|
2329
|
+
const i = It(r);
|
|
2321
2330
|
super(i.message ?? `${s || "Request failed"} (${t})`);
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2331
|
+
w(this, "status");
|
|
2332
|
+
w(this, "code");
|
|
2333
|
+
w(this, "details");
|
|
2334
|
+
w(this, "body");
|
|
2326
2335
|
this.name = "RequestError", this.status = t, this.code = i.code, this.details = i.details, this.body = r;
|
|
2327
2336
|
}
|
|
2328
2337
|
}
|
|
2329
|
-
const
|
|
2330
|
-
var a,
|
|
2331
|
-
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 {
|
|
2332
2341
|
/**
|
|
2333
2342
|
* Creates a new EngineServicesClient instance.
|
|
2334
2343
|
* @param accessToken - API access token (obtained from the platform dashboard)
|
|
@@ -2337,25 +2346,25 @@ const ye = class ye {
|
|
|
2337
2346
|
* @param props - Optional configuration (retry count, auth mode, etc.).
|
|
2338
2347
|
*/
|
|
2339
2348
|
constructor(e, t, s) {
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
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);
|
|
2347
2356
|
/**
|
|
2348
2357
|
* URL of a local execution server (e.g. `http://localhost:4001`).
|
|
2349
2358
|
* When set, execution methods are routed to this server instead of the cloud API.
|
|
2350
2359
|
* Set to `null` to disable local routing and use the cloud API.
|
|
2351
2360
|
*/
|
|
2352
|
-
|
|
2361
|
+
w(this, "localServerUrl", null);
|
|
2353
2362
|
/**
|
|
2354
2363
|
* The platform context this client was created with.
|
|
2355
2364
|
* Contains `appId`, `projectId`, `accessToken`, and `apiUrl`.
|
|
2356
2365
|
* Populated automatically when using {@link fromPlatformContext}.
|
|
2357
2366
|
*/
|
|
2358
|
-
|
|
2367
|
+
w(this, "context");
|
|
2359
2368
|
const { retries: r = 0, useBearer: i = !1, localServerUrl: o } = s || {};
|
|
2360
2369
|
let h = t;
|
|
2361
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) {
|
|
@@ -2380,7 +2389,7 @@ const ye = class ye {
|
|
|
2380
2389
|
* ```
|
|
2381
2390
|
*/
|
|
2382
2391
|
static fromPlatformContext(e) {
|
|
2383
|
-
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, {
|
|
2384
2393
|
...e,
|
|
2385
2394
|
useBearer: !0
|
|
2386
2395
|
});
|
|
@@ -2452,9 +2461,9 @@ const ye = class ye {
|
|
|
2452
2461
|
*/
|
|
2453
2462
|
async listFiles(e) {
|
|
2454
2463
|
const { folderId: t, archived: s, projectId: r } = e || {};
|
|
2455
|
-
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}`, {
|
|
2456
2465
|
query: {
|
|
2457
|
-
itemType:
|
|
2466
|
+
itemType: Q,
|
|
2458
2467
|
archived: s,
|
|
2459
2468
|
...r && { projectId: r }
|
|
2460
2469
|
}
|
|
@@ -2467,7 +2476,7 @@ const ye = class ye {
|
|
|
2467
2476
|
* @returns The file item, optionally with version history.
|
|
2468
2477
|
*/
|
|
2469
2478
|
async getFile(e, t) {
|
|
2470
|
-
return await c(this, a,
|
|
2479
|
+
return await c(this, a, ue).call(this, e, t);
|
|
2471
2480
|
}
|
|
2472
2481
|
/**
|
|
2473
2482
|
* Uploads a new file.
|
|
@@ -2475,7 +2484,7 @@ const ye = class ye {
|
|
|
2475
2484
|
* @returns The created item and its first version.
|
|
2476
2485
|
*/
|
|
2477
2486
|
async createFile(e) {
|
|
2478
|
-
return await c(this, a,
|
|
2487
|
+
return await c(this, a, H).call(this, e, Q);
|
|
2479
2488
|
}
|
|
2480
2489
|
/**
|
|
2481
2490
|
* Updates an existing file. Can rename, move to a different folder,
|
|
@@ -2485,7 +2494,7 @@ const ye = class ye {
|
|
|
2485
2494
|
* @returns The updated item and/or the new version.
|
|
2486
2495
|
*/
|
|
2487
2496
|
async updateFile(e, t) {
|
|
2488
|
-
return await c(this, a,
|
|
2497
|
+
return await c(this, a, he).call(this, e, t);
|
|
2489
2498
|
}
|
|
2490
2499
|
/**
|
|
2491
2500
|
* Archives (soft-deletes) a file. Can be recovered with {@link recoverFile}.
|
|
@@ -2508,7 +2517,7 @@ const ye = class ye {
|
|
|
2508
2517
|
* @returns A fetch Response containing the file data.
|
|
2509
2518
|
*/
|
|
2510
2519
|
async downloadFile(e, t) {
|
|
2511
|
-
return await c(this, a,
|
|
2520
|
+
return await c(this, a, V).call(this, e, t);
|
|
2512
2521
|
}
|
|
2513
2522
|
/**
|
|
2514
2523
|
* Retrieves the free-JSON metadata for a specific file version.
|
|
@@ -2553,7 +2562,7 @@ const ye = class ye {
|
|
|
2553
2562
|
*/
|
|
2554
2563
|
async listFolders(e) {
|
|
2555
2564
|
const { archived: t, parentFolderId: s, projectId: r } = e || {};
|
|
2556
|
-
return await c(this, a, u).call(this, "GET",
|
|
2565
|
+
return await c(this, a, u).call(this, "GET", E, {
|
|
2557
2566
|
query: {
|
|
2558
2567
|
parentFolderId: s,
|
|
2559
2568
|
archived: t,
|
|
@@ -2566,7 +2575,7 @@ const ye = class ye {
|
|
|
2566
2575
|
* @param folderId - The folder's unique identifier.
|
|
2567
2576
|
*/
|
|
2568
2577
|
async getFolder(e) {
|
|
2569
|
-
return await c(this, a, u).call(this, "GET", `${
|
|
2578
|
+
return await c(this, a, u).call(this, "GET", `${E}/${e}`);
|
|
2570
2579
|
}
|
|
2571
2580
|
/**
|
|
2572
2581
|
* Creates a new folder.
|
|
@@ -2575,7 +2584,7 @@ const ye = class ye {
|
|
|
2575
2584
|
* @returns The created folder.
|
|
2576
2585
|
*/
|
|
2577
2586
|
async createFolder(e, t, s) {
|
|
2578
|
-
return await c(this, a, u).call(this, "POST",
|
|
2587
|
+
return await c(this, a, u).call(this, "POST", E, {
|
|
2579
2588
|
body: JSON.stringify({
|
|
2580
2589
|
name: e,
|
|
2581
2590
|
...t && { parentId: t },
|
|
@@ -2592,7 +2601,7 @@ const ye = class ye {
|
|
|
2592
2601
|
*/
|
|
2593
2602
|
async updateFolder(e, t) {
|
|
2594
2603
|
const { name: s } = t;
|
|
2595
|
-
return await c(this, a, u).call(this, "PUT", `${
|
|
2604
|
+
return await c(this, a, u).call(this, "PUT", `${E}/${e}`, {
|
|
2596
2605
|
body: JSON.stringify({ name: s }),
|
|
2597
2606
|
contentType: "application/json"
|
|
2598
2607
|
});
|
|
@@ -2602,14 +2611,14 @@ const ye = class ye {
|
|
|
2602
2611
|
* @param folderId - The folder's unique identifier.
|
|
2603
2612
|
*/
|
|
2604
2613
|
async archiveFolder(e) {
|
|
2605
|
-
return await c(this, a, u).call(this, "DELETE", `${
|
|
2614
|
+
return await c(this, a, u).call(this, "DELETE", `${E}/${e}`);
|
|
2606
2615
|
}
|
|
2607
2616
|
/**
|
|
2608
2617
|
* Recovers a previously archived folder.
|
|
2609
2618
|
* @param folderId - The folder's unique identifier.
|
|
2610
2619
|
*/
|
|
2611
2620
|
async recoverFolder(e) {
|
|
2612
|
-
return await c(this, a, u).call(this, "PUT", `${
|
|
2621
|
+
return await c(this, a, u).call(this, "PUT", `${E}/${e}/recover`);
|
|
2613
2622
|
}
|
|
2614
2623
|
/**
|
|
2615
2624
|
* Downloads an entire folder as a ZIP archive.
|
|
@@ -2617,7 +2626,7 @@ const ye = class ye {
|
|
|
2617
2626
|
* @returns A fetch Response containing the ZIP data.
|
|
2618
2627
|
*/
|
|
2619
2628
|
async downloadFolder(e) {
|
|
2620
|
-
return await c(this, a,
|
|
2629
|
+
return await c(this, a, $).call(this, `${E}/${e}/download`);
|
|
2621
2630
|
}
|
|
2622
2631
|
// ─── Components ──────────────────────────────────────────────────
|
|
2623
2632
|
/**
|
|
@@ -2627,14 +2636,14 @@ const ye = class ye {
|
|
|
2627
2636
|
*/
|
|
2628
2637
|
async listComponents(e) {
|
|
2629
2638
|
const { folderId: t, ShowVersions: s, projectId: r } = e || {};
|
|
2630
|
-
return t ? await c(this, a, u).call(this, "GET", `${
|
|
2639
|
+
return t ? await c(this, a, u).call(this, "GET", `${E}/${t}/items`, {
|
|
2631
2640
|
query: {
|
|
2632
|
-
itemType:
|
|
2641
|
+
itemType: Z,
|
|
2633
2642
|
...s && { ShowVersions: s }
|
|
2634
2643
|
}
|
|
2635
2644
|
}) : await c(this, a, u).call(this, "GET", `${f}`, {
|
|
2636
2645
|
query: {
|
|
2637
|
-
itemType:
|
|
2646
|
+
itemType: Z,
|
|
2638
2647
|
...s && { ShowVersions: s },
|
|
2639
2648
|
...r && { projectId: r }
|
|
2640
2649
|
}
|
|
@@ -2646,7 +2655,7 @@ const ye = class ye {
|
|
|
2646
2655
|
* @param props - Options such as whether to include versions.
|
|
2647
2656
|
*/
|
|
2648
2657
|
async getComponent(e, t) {
|
|
2649
|
-
return await c(this, a,
|
|
2658
|
+
return await c(this, a, ue).call(this, e, t);
|
|
2650
2659
|
}
|
|
2651
2660
|
/**
|
|
2652
2661
|
* Creates a new component with the given file and version properties.
|
|
@@ -2655,7 +2664,7 @@ const ye = class ye {
|
|
|
2655
2664
|
*/
|
|
2656
2665
|
async createComponent(e) {
|
|
2657
2666
|
const { componentProps: t } = e;
|
|
2658
|
-
return await c(this, a,
|
|
2667
|
+
return await c(this, a, H).call(this, e, Z, t);
|
|
2659
2668
|
}
|
|
2660
2669
|
/**
|
|
2661
2670
|
* Updates an existing component. Can rename, move, and/or upload a new version.
|
|
@@ -2665,7 +2674,7 @@ const ye = class ye {
|
|
|
2665
2674
|
*/
|
|
2666
2675
|
async updateComponent(e, t) {
|
|
2667
2676
|
const { componentProps: s } = t;
|
|
2668
|
-
return await c(this, a,
|
|
2677
|
+
return await c(this, a, he).call(this, e, t, s);
|
|
2669
2678
|
}
|
|
2670
2679
|
/**
|
|
2671
2680
|
* Downloads a component's full ZIP file. Returns the raw fetch Response.
|
|
@@ -2674,7 +2683,7 @@ const ye = class ye {
|
|
|
2674
2683
|
* @returns A fetch Response containing the ZIP data.
|
|
2675
2684
|
*/
|
|
2676
2685
|
async downloadComponent(e, t) {
|
|
2677
|
-
return await c(this, a,
|
|
2686
|
+
return await c(this, a, V).call(this, e, t);
|
|
2678
2687
|
}
|
|
2679
2688
|
/**
|
|
2680
2689
|
* Downloads only the JavaScript bundle from a component's ZIP.
|
|
@@ -2685,7 +2694,7 @@ const ye = class ye {
|
|
|
2685
2694
|
*/
|
|
2686
2695
|
async downloadComponentBundle(e, t) {
|
|
2687
2696
|
const { versionTag: s, withDraft: r } = t || {};
|
|
2688
|
-
return await c(this, a,
|
|
2697
|
+
return await c(this, a, $).call(this, `${f}/${e}/download/bundle`, {
|
|
2689
2698
|
query: {
|
|
2690
2699
|
...s && { versionTag: s },
|
|
2691
2700
|
...r && { withDraft: r }
|
|
@@ -2713,7 +2722,7 @@ const ye = class ye {
|
|
|
2713
2722
|
* @returns The component's JavaScript source code as a string.
|
|
2714
2723
|
*/
|
|
2715
2724
|
async getBuiltInComponent(e) {
|
|
2716
|
-
return await (await c(this, a,
|
|
2725
|
+
return await (await c(this, a, $).call(this, `built-in/${e}/bundle`)).text();
|
|
2717
2726
|
}
|
|
2718
2727
|
/**
|
|
2719
2728
|
* Fetches a built-in component bundle, evaluates it, and registers it
|
|
@@ -2811,14 +2820,14 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
|
|
|
2811
2820
|
*/
|
|
2812
2821
|
async listApps(e) {
|
|
2813
2822
|
const { folderId: t, ShowVersions: s, projectId: r } = e || {};
|
|
2814
|
-
return t ? await c(this, a, u).call(this, "GET", `${
|
|
2823
|
+
return t ? await c(this, a, u).call(this, "GET", `${E}/${t}/items`, {
|
|
2815
2824
|
query: {
|
|
2816
|
-
itemType:
|
|
2825
|
+
itemType: ee,
|
|
2817
2826
|
...s && { ShowVersions: s }
|
|
2818
2827
|
}
|
|
2819
2828
|
}) : await c(this, a, u).call(this, "GET", `${f}`, {
|
|
2820
2829
|
query: {
|
|
2821
|
-
itemType:
|
|
2830
|
+
itemType: ee,
|
|
2822
2831
|
...s && { ShowVersions: s },
|
|
2823
2832
|
...r && { projectId: r }
|
|
2824
2833
|
}
|
|
@@ -2831,7 +2840,7 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
|
|
|
2831
2840
|
*/
|
|
2832
2841
|
async createApp(e) {
|
|
2833
2842
|
const { appProps: t } = e;
|
|
2834
|
-
return await c(this, a,
|
|
2843
|
+
return await c(this, a, H).call(this, e, ee, t);
|
|
2835
2844
|
}
|
|
2836
2845
|
/**
|
|
2837
2846
|
* Downloads an app's full ZIP file. Returns the raw fetch Response.
|
|
@@ -2840,7 +2849,7 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
|
|
|
2840
2849
|
* @returns A fetch Response containing the ZIP data.
|
|
2841
2850
|
*/
|
|
2842
2851
|
async downloadApp(e, t) {
|
|
2843
|
-
return await c(this, a,
|
|
2852
|
+
return await c(this, a, V).call(this, e, t);
|
|
2844
2853
|
}
|
|
2845
2854
|
/**
|
|
2846
2855
|
* Downloads only the JavaScript bundle from an app's ZIP.
|
|
@@ -2851,7 +2860,7 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
|
|
|
2851
2860
|
*/
|
|
2852
2861
|
async downloadAppBundle(e, t) {
|
|
2853
2862
|
const { versionTag: s, withDraft: r } = t || {};
|
|
2854
|
-
return await c(this, a,
|
|
2863
|
+
return await c(this, a, $).call(this, `${f}/${e}/download/bundle`, {
|
|
2855
2864
|
query: {
|
|
2856
2865
|
...s && { versionTag: s },
|
|
2857
2866
|
...r && { withDraft: r }
|
|
@@ -2875,7 +2884,7 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
|
|
|
2875
2884
|
* @returns The registry, scope, read-only token, and assembled `.npmrc`.
|
|
2876
2885
|
*/
|
|
2877
2886
|
async getNpmCredentials() {
|
|
2878
|
-
return await c(this, a, u).call(this, "GET", `${
|
|
2887
|
+
return await c(this, a, u).call(this, "GET", `${Ut}/credentials`);
|
|
2879
2888
|
}
|
|
2880
2889
|
// ─── Execution ───────────────────────────────────────────────────
|
|
2881
2890
|
/**
|
|
@@ -2894,7 +2903,7 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
|
|
|
2894
2903
|
*/
|
|
2895
2904
|
async executeComponent(e, t, s) {
|
|
2896
2905
|
if (this.localServerUrl) {
|
|
2897
|
-
const r = `${this.localServerUrl}/api/${
|
|
2906
|
+
const r = `${this.localServerUrl}/api/${S}/${e}/execute`, i = await fetch(r, {
|
|
2898
2907
|
method: "POST",
|
|
2899
2908
|
headers: { "Content-Type": "application/json" },
|
|
2900
2909
|
body: JSON.stringify(t)
|
|
@@ -2905,7 +2914,7 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
|
|
|
2905
2914
|
}
|
|
2906
2915
|
return await i.json();
|
|
2907
2916
|
}
|
|
2908
|
-
return await c(this, a, u).call(this, "POST", `${
|
|
2917
|
+
return await c(this, a, u).call(this, "POST", `${S}/${e}/execute`, {
|
|
2909
2918
|
body: JSON.stringify(t),
|
|
2910
2919
|
query: { ...s && { versionTag: s } },
|
|
2911
2920
|
contentType: "application/json"
|
|
@@ -2917,14 +2926,14 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
|
|
|
2917
2926
|
*/
|
|
2918
2927
|
async abortExecution(e) {
|
|
2919
2928
|
if (this.localServerUrl) {
|
|
2920
|
-
const t = `${this.localServerUrl}/api/${
|
|
2929
|
+
const t = `${this.localServerUrl}/api/${S}/progress/${e}/abort`, s = await fetch(t, { method: "POST" });
|
|
2921
2930
|
if (!s.ok) {
|
|
2922
2931
|
const r = await s.text().catch(() => "");
|
|
2923
2932
|
throw new Error(`Local server request failed: ${s.status} - ${r}`);
|
|
2924
2933
|
}
|
|
2925
2934
|
return await s.json();
|
|
2926
2935
|
}
|
|
2927
|
-
return await c(this, a, u).call(this, "POST", `${
|
|
2936
|
+
return await c(this, a, u).call(this, "POST", `${S}/progress/${e}/abort`);
|
|
2928
2937
|
}
|
|
2929
2938
|
/**
|
|
2930
2939
|
* Lists all executions for a given component.
|
|
@@ -2941,7 +2950,7 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
|
|
|
2941
2950
|
*/
|
|
2942
2951
|
async listExecutions(e, t) {
|
|
2943
2952
|
if (this.localServerUrl) {
|
|
2944
|
-
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);
|
|
2945
2954
|
if (!i.ok) {
|
|
2946
2955
|
const o = await i.text().catch(() => "");
|
|
2947
2956
|
throw new Error(
|
|
@@ -2950,7 +2959,7 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
|
|
|
2950
2959
|
}
|
|
2951
2960
|
return await i.json();
|
|
2952
2961
|
}
|
|
2953
|
-
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 } } });
|
|
2954
2963
|
}
|
|
2955
2964
|
/**
|
|
2956
2965
|
* Gets details of a specific execution, including its messages.
|
|
@@ -2959,14 +2968,14 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
|
|
|
2959
2968
|
*/
|
|
2960
2969
|
async getExecution(e) {
|
|
2961
2970
|
if (this.localServerUrl) {
|
|
2962
|
-
const t = `${this.localServerUrl}/api/${
|
|
2971
|
+
const t = `${this.localServerUrl}/api/${S}/progress/${e}`, s = await fetch(t);
|
|
2963
2972
|
if (!s.ok) {
|
|
2964
2973
|
const r = await s.text().catch(() => "");
|
|
2965
2974
|
throw new Error(`Local server request failed: ${s.status} - ${r}`);
|
|
2966
2975
|
}
|
|
2967
2976
|
return await s.json();
|
|
2968
2977
|
}
|
|
2969
|
-
return await c(this, a, u).call(this, "GET", `${
|
|
2978
|
+
return await c(this, a, u).call(this, "GET", `${S}/progress/${e}`);
|
|
2970
2979
|
}
|
|
2971
2980
|
/**
|
|
2972
2981
|
* Subscribes to real-time execution progress via WebSocket.
|
|
@@ -2975,7 +2984,7 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
|
|
|
2975
2984
|
* @param onUpdateCallback - Callback invoked on each progress/result event.
|
|
2976
2985
|
*/
|
|
2977
2986
|
async onExecutionProgress(e, t) {
|
|
2978
|
-
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, {
|
|
2979
2988
|
...this.localServerUrl && { transports: ["websocket"] }
|
|
2980
2989
|
});
|
|
2981
2990
|
r.on("connect", function() {
|
|
@@ -2995,7 +3004,7 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
|
|
|
2995
3004
|
*/
|
|
2996
3005
|
async createHiddenFile(e, t) {
|
|
2997
3006
|
const s = new FormData();
|
|
2998
|
-
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}`, {
|
|
2999
3008
|
body: s
|
|
3000
3009
|
});
|
|
3001
3010
|
}
|
|
@@ -3011,7 +3020,7 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
|
|
|
3011
3020
|
const s = new FormData();
|
|
3012
3021
|
for (const r of e)
|
|
3013
3022
|
s.append("files", r);
|
|
3014
|
-
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`, {
|
|
3015
3024
|
body: s
|
|
3016
3025
|
});
|
|
3017
3026
|
}
|
|
@@ -3020,21 +3029,21 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
|
|
|
3020
3029
|
* @param hiddenId - The hidden file's unique identifier.
|
|
3021
3030
|
*/
|
|
3022
3031
|
async deleteHiddenFile(e) {
|
|
3023
|
-
return await c(this, a, u).call(this, "DELETE", `${f}/${
|
|
3032
|
+
return await c(this, a, u).call(this, "DELETE", `${f}/${C}/${e}`);
|
|
3024
3033
|
}
|
|
3025
3034
|
/**
|
|
3026
3035
|
* Gets metadata for a hidden file.
|
|
3027
3036
|
* @param hiddenId - The hidden file's unique identifier.
|
|
3028
3037
|
*/
|
|
3029
3038
|
async getHiddenFile(e) {
|
|
3030
|
-
return await c(this, a, u).call(this, "GET", `${f}/${
|
|
3039
|
+
return await c(this, a, u).call(this, "GET", `${f}/${C}/${e}`);
|
|
3031
3040
|
}
|
|
3032
3041
|
/**
|
|
3033
3042
|
* Downloads a hidden file's content. Returns the raw fetch Response.
|
|
3034
3043
|
* @param hiddenId - The hidden file's unique identifier.
|
|
3035
3044
|
*/
|
|
3036
3045
|
async downloadHiddenFile(e) {
|
|
3037
|
-
return await c(this, a,
|
|
3046
|
+
return await c(this, a, $).call(this, `${f}/${C}/${e}/download`);
|
|
3038
3047
|
}
|
|
3039
3048
|
/**
|
|
3040
3049
|
* Mints a short-lived presigned URL for a hidden file so the browser can
|
|
@@ -3054,7 +3063,7 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
|
|
|
3054
3063
|
* an ISO timestamp when it stops working.
|
|
3055
3064
|
*/
|
|
3056
3065
|
async getHiddenFileSignedUrl(e, t) {
|
|
3057
|
-
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 } } });
|
|
3058
3067
|
}
|
|
3059
3068
|
/**
|
|
3060
3069
|
* Lists all hidden files attached to a parent item.
|
|
@@ -3062,14 +3071,14 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
|
|
|
3062
3071
|
* @returns Array of hidden file entities.
|
|
3063
3072
|
*/
|
|
3064
3073
|
async getHiddenFilesByParent(e) {
|
|
3065
|
-
return await c(this, a, u).call(this, "GET", `${f}/${e}/${
|
|
3074
|
+
return await c(this, a, u).call(this, "GET", `${f}/${e}/${C}`);
|
|
3066
3075
|
}
|
|
3067
3076
|
/**
|
|
3068
3077
|
* Deletes all hidden files attached to a parent item.
|
|
3069
3078
|
* @param parentFileId - The parent item's unique identifier.
|
|
3070
3079
|
*/
|
|
3071
3080
|
async deleteHiddenFilesByParent(e) {
|
|
3072
|
-
return await c(this, a, u).call(this, "DELETE", `${f}/${e}/${
|
|
3081
|
+
return await c(this, a, u).call(this, "DELETE", `${f}/${e}/${C}`);
|
|
3073
3082
|
}
|
|
3074
3083
|
// ─── Icons ───────────────────────────────────────────────────────
|
|
3075
3084
|
/**
|
|
@@ -3089,7 +3098,7 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
|
|
|
3089
3098
|
* @returns The raw Response (use `.blob()`, `.arrayBuffer()`, or pipe the body).
|
|
3090
3099
|
*/
|
|
3091
3100
|
async getItemIcon(e) {
|
|
3092
|
-
return await c(this, a,
|
|
3101
|
+
return await c(this, a, $).call(this, `${f}/${e}/icon`);
|
|
3093
3102
|
}
|
|
3094
3103
|
/**
|
|
3095
3104
|
* Removes the icon from an item.
|
|
@@ -3167,47 +3176,47 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
|
|
|
3167
3176
|
return await c(this, a, u).call(this, "DELETE", `${f}/${encodeURIComponent(e)}/version/${encodeURIComponent(t)}`);
|
|
3168
3177
|
}
|
|
3169
3178
|
};
|
|
3170
|
-
a = new WeakSet(),
|
|
3179
|
+
a = new WeakSet(), ce = function(e) {
|
|
3171
3180
|
return `${this.apiUrl}/${e}`;
|
|
3172
3181
|
}, u = async function(e, t, s) {
|
|
3173
|
-
const { body: r, query: i, contentType: o, retries: h } = s || {},
|
|
3174
|
-
...
|
|
3175
|
-
...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 }
|
|
3176
3185
|
};
|
|
3177
3186
|
try {
|
|
3178
|
-
const
|
|
3179
|
-
|
|
3187
|
+
const A = await fetch(
|
|
3188
|
+
y + "?" + new URLSearchParams(k).toString(),
|
|
3180
3189
|
{
|
|
3181
3190
|
method: e,
|
|
3182
3191
|
headers: {
|
|
3183
3192
|
Accept: "application/json",
|
|
3184
3193
|
...o && { "Content-Type": o },
|
|
3185
|
-
...this.useBearer && { Authorization: `Bearer ${
|
|
3194
|
+
...this.useBearer && { Authorization: `Bearer ${m}` }
|
|
3186
3195
|
},
|
|
3187
3196
|
...r && { body: r }
|
|
3188
3197
|
}
|
|
3189
3198
|
);
|
|
3190
|
-
if (!
|
|
3191
|
-
const
|
|
3192
|
-
throw new
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
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
|
|
3196
3205
|
);
|
|
3197
3206
|
}
|
|
3198
|
-
return
|
|
3207
|
+
return l === "blob" ? await A.blob() : A.json().then((O) => O).catch(() => {
|
|
3199
3208
|
});
|
|
3200
|
-
} catch (
|
|
3201
|
-
let
|
|
3202
|
-
if (
|
|
3203
|
-
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, {
|
|
3204
3213
|
...s,
|
|
3205
|
-
retries:
|
|
3214
|
+
retries: O
|
|
3206
3215
|
});
|
|
3207
|
-
throw
|
|
3216
|
+
throw A;
|
|
3208
3217
|
}
|
|
3209
|
-
},
|
|
3210
|
-
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 = {
|
|
3211
3220
|
...s,
|
|
3212
3221
|
...this.useBearer ? {} : { accessToken: i }
|
|
3213
3222
|
};
|
|
@@ -3220,20 +3229,20 @@ a = new WeakSet(), ae = function(e) {
|
|
|
3220
3229
|
}
|
|
3221
3230
|
}
|
|
3222
3231
|
);
|
|
3223
|
-
},
|
|
3232
|
+
}, V = async function(e, t) {
|
|
3224
3233
|
const { versionTag: s, withDraft: r } = t || {};
|
|
3225
|
-
return await c(this, a,
|
|
3234
|
+
return await c(this, a, $).call(this, `${f}/${e}/download`, {
|
|
3226
3235
|
query: {
|
|
3227
3236
|
...s && { versionTag: s },
|
|
3228
3237
|
...r && { withDraft: r }
|
|
3229
3238
|
}
|
|
3230
3239
|
});
|
|
3231
|
-
},
|
|
3240
|
+
}, H = async function(e, t, s) {
|
|
3232
3241
|
const { name: r, versionTag: i, parentFolderId: o, projectId: h, file: l, metadata: y } = e, d = new FormData();
|
|
3233
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, {
|
|
3234
3243
|
body: d
|
|
3235
3244
|
});
|
|
3236
|
-
},
|
|
3245
|
+
}, he = async function(e, t, s) {
|
|
3237
3246
|
const { name: r, versionTag: i, parentFolderId: o, file: h, metadata: l } = t;
|
|
3238
3247
|
let y, d;
|
|
3239
3248
|
if (h) {
|
|
@@ -3246,28 +3255,28 @@ a = new WeakSet(), ae = function(e) {
|
|
|
3246
3255
|
const m = {
|
|
3247
3256
|
...r && { name: r },
|
|
3248
3257
|
...o && { folderId: o }
|
|
3249
|
-
},
|
|
3258
|
+
}, k = JSON.stringify(m);
|
|
3250
3259
|
y = await c(this, a, u).call(this, "PUT", `${f}/${e}`, {
|
|
3251
|
-
body:
|
|
3260
|
+
body: k,
|
|
3252
3261
|
contentType: "application/json"
|
|
3253
3262
|
});
|
|
3254
3263
|
}
|
|
3255
3264
|
return { item: y, version: d };
|
|
3256
|
-
},
|
|
3265
|
+
}, ue = async function(e, t) {
|
|
3257
3266
|
const { showVersions: s = !1 } = t || {};
|
|
3258
3267
|
return await c(this, a, u).call(this, "GET", `${f}/${e}`, {
|
|
3259
3268
|
query: { showVersions: s }
|
|
3260
3269
|
});
|
|
3261
|
-
},
|
|
3270
|
+
}, De = function(e) {
|
|
3262
3271
|
return e && Object.entries(e).filter(([, t]) => t !== void 0).reduce(
|
|
3263
3272
|
(t, [s, r]) => (t[s] = r, t),
|
|
3264
3273
|
{}
|
|
3265
3274
|
);
|
|
3266
3275
|
};
|
|
3267
|
-
let
|
|
3268
|
-
const
|
|
3269
|
-
var
|
|
3270
|
-
const
|
|
3276
|
+
let ae = me;
|
|
3277
|
+
const q = "project";
|
|
3278
|
+
var B;
|
|
3279
|
+
const ge = class ge extends ae {
|
|
3271
3280
|
/**
|
|
3272
3281
|
* @param token - A bearer JWT, OR a function returning the current JWT
|
|
3273
3282
|
* (sync or async). When a function is passed, it's invoked before every
|
|
@@ -3278,11 +3287,11 @@ const me = class me extends oe {
|
|
|
3278
3287
|
*/
|
|
3279
3288
|
constructor(t, s, r) {
|
|
3280
3289
|
super(typeof t == "string" ? t : "", s, { ...r, useBearer: !0 });
|
|
3281
|
-
|
|
3282
|
-
typeof t == "function" &&
|
|
3290
|
+
K(this, B);
|
|
3291
|
+
typeof t == "function" && _e(this, B, t);
|
|
3283
3292
|
}
|
|
3284
3293
|
async resolveAccessToken() {
|
|
3285
|
-
return
|
|
3294
|
+
return Y(this, B) ? await Y(this, B).call(this) : super.resolveAccessToken();
|
|
3286
3295
|
}
|
|
3287
3296
|
/**
|
|
3288
3297
|
* Creates a client from the platform context injected into
|
|
@@ -3291,7 +3300,7 @@ const me = class me extends oe {
|
|
|
3291
3300
|
* carries a fresh JWT on every navigation.
|
|
3292
3301
|
*/
|
|
3293
3302
|
static fromPlatformContext(t) {
|
|
3294
|
-
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);
|
|
3295
3304
|
return r.context = s, r;
|
|
3296
3305
|
}
|
|
3297
3306
|
// ─── Projects (JWT-only backend routes) ──────────────────────────
|
|
@@ -3300,7 +3309,7 @@ const me = class me extends oe {
|
|
|
3300
3309
|
* `GET /project/:id` is guarded by `AccountActiveGuard + ProjectAccessGuard`.
|
|
3301
3310
|
*/
|
|
3302
3311
|
async getProject(t) {
|
|
3303
|
-
return await this.request("GET", `${
|
|
3312
|
+
return await this.request("GET", `${q}/${t}`);
|
|
3304
3313
|
}
|
|
3305
3314
|
/**
|
|
3306
3315
|
* Gets the full project data (users, roles, files, folders) for a project.
|
|
@@ -3309,9 +3318,21 @@ const me = class me extends oe {
|
|
|
3309
3318
|
async getProjectData(t) {
|
|
3310
3319
|
return await this.request(
|
|
3311
3320
|
"GET",
|
|
3312
|
-
`${
|
|
3321
|
+
`${q}/${t}/data`
|
|
3313
3322
|
);
|
|
3314
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
|
+
}
|
|
3315
3336
|
// ─── Permissions (JWT-only backend routes) ───────────────────────
|
|
3316
3337
|
/**
|
|
3317
3338
|
* Checks whether the caller has a specific permission within a project.
|
|
@@ -3322,7 +3343,7 @@ const me = class me extends oe {
|
|
|
3322
3343
|
async checkPermission(t) {
|
|
3323
3344
|
return await this.request(
|
|
3324
3345
|
"GET",
|
|
3325
|
-
`${
|
|
3346
|
+
`${q}/permissions/check`,
|
|
3326
3347
|
{ query: t }
|
|
3327
3348
|
);
|
|
3328
3349
|
}
|
|
@@ -3331,27 +3352,28 @@ const me = class me extends oe {
|
|
|
3331
3352
|
* single round-trip; results come back in the same order as `checks`.
|
|
3332
3353
|
*/
|
|
3333
3354
|
async checkPermissionBatch(t) {
|
|
3334
|
-
return (await this.request("POST", `${
|
|
3355
|
+
return (await this.request("POST", `${q}/permissions/check/batch`, {
|
|
3335
3356
|
body: JSON.stringify({ checks: t }),
|
|
3336
3357
|
contentType: "application/json"
|
|
3337
3358
|
})).results;
|
|
3338
3359
|
}
|
|
3339
3360
|
};
|
|
3340
|
-
|
|
3341
|
-
let
|
|
3342
|
-
const
|
|
3361
|
+
B = new WeakMap();
|
|
3362
|
+
let Ae = ge;
|
|
3363
|
+
const Mt = {
|
|
3343
3364
|
MAX_FIELDS: 200,
|
|
3344
3365
|
MAX_KEY_LENGTH: 50,
|
|
3345
3366
|
MAX_VALUE_LENGTH: 50
|
|
3346
|
-
},
|
|
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" };
|
|
3347
3368
|
export {
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
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
|
|
3357
3379
|
};
|