@kohost/api-client 3.0.0-beta.41 → 3.0.0-beta.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/Client.js +240 -0
- package/dist/cjs/Commands.js +88 -9
- package/dist/cjs/Events.js +11 -32
- package/dist/cjs/Models.js +144 -12
- package/dist/cjs/utils.js +4 -1
- package/dist/esm/Client.js +240 -0
- package/dist/esm/Client.js.map +3 -3
- package/dist/esm/Commands.js +88 -9
- package/dist/esm/Commands.js.map +3 -3
- package/dist/esm/Events.js +11 -32
- package/dist/esm/Events.js.map +3 -3
- package/dist/esm/Models.js +144 -12
- package/dist/esm/Models.js.map +4 -4
- package/dist/esm/SocketIoClient.js +261 -86
- package/dist/esm/SocketIoClient.js.map +4 -4
- package/dist/esm/utils.js +4 -1
- package/dist/esm/utils.js.map +2 -2
- package/dist/useCases/DescribeProduct.js +32 -0
- package/dist/useCases/DescribeReservationEarlyCheckInProducts.js +32 -0
- package/dist/useCases/DescribeReservationRoomUpgrades.js +32 -0
- package/dist/useCases/PurchaseReservationEarlyCheckInProducts.js +32 -0
- package/dist/useCases/PurchaseReservationRoomUpgrades.js +32 -0
- package/dist/useCases/UploadImage.js +32 -0
- package/package.json +1 -1
|
@@ -35,6 +35,7 @@ var require_encodePacket_browser = __commonJS({
|
|
|
35
35
|
"node_modules/engine.io-parser/build/cjs/encodePacket.browser.js"(exports) {
|
|
36
36
|
"use strict";
|
|
37
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
+
exports.encodePacket = exports.encodePacketToBinary = void 0;
|
|
38
39
|
var commons_js_1 = require_commons();
|
|
39
40
|
var withNativeBlob = typeof Blob === "function" || typeof Blob !== "undefined" && Object.prototype.toString.call(Blob) === "[object BlobConstructor]";
|
|
40
41
|
var withNativeArrayBuffer = typeof ArrayBuffer === "function";
|
|
@@ -57,6 +58,7 @@ var require_encodePacket_browser = __commonJS({
|
|
|
57
58
|
}
|
|
58
59
|
return callback(commons_js_1.PACKET_TYPES[type] + (data || ""));
|
|
59
60
|
}, "encodePacket");
|
|
61
|
+
exports.encodePacket = encodePacket;
|
|
60
62
|
var encodeBlobAsBase64 = /* @__PURE__ */ __name((data, callback) => {
|
|
61
63
|
const fileReader = new FileReader();
|
|
62
64
|
fileReader.onload = function() {
|
|
@@ -65,7 +67,32 @@ var require_encodePacket_browser = __commonJS({
|
|
|
65
67
|
};
|
|
66
68
|
return fileReader.readAsDataURL(data);
|
|
67
69
|
}, "encodeBlobAsBase64");
|
|
68
|
-
|
|
70
|
+
function toArray(data) {
|
|
71
|
+
if (data instanceof Uint8Array) {
|
|
72
|
+
return data;
|
|
73
|
+
} else if (data instanceof ArrayBuffer) {
|
|
74
|
+
return new Uint8Array(data);
|
|
75
|
+
} else {
|
|
76
|
+
return new Uint8Array(data.buffer, data.byteOffset, data.byteLength);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
__name(toArray, "toArray");
|
|
80
|
+
var TEXT_ENCODER;
|
|
81
|
+
function encodePacketToBinary(packet, callback) {
|
|
82
|
+
if (withNativeBlob && packet.data instanceof Blob) {
|
|
83
|
+
return packet.data.arrayBuffer().then(toArray).then(callback);
|
|
84
|
+
} else if (withNativeArrayBuffer && (packet.data instanceof ArrayBuffer || isView(packet.data))) {
|
|
85
|
+
return callback(toArray(packet.data));
|
|
86
|
+
}
|
|
87
|
+
encodePacket(packet, false, (encoded) => {
|
|
88
|
+
if (!TEXT_ENCODER) {
|
|
89
|
+
TEXT_ENCODER = new TextEncoder();
|
|
90
|
+
}
|
|
91
|
+
callback(TEXT_ENCODER.encode(encoded));
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
__name(encodePacketToBinary, "encodePacketToBinary");
|
|
95
|
+
exports.encodePacketToBinary = encodePacketToBinary;
|
|
69
96
|
}
|
|
70
97
|
});
|
|
71
98
|
|
|
@@ -125,6 +152,7 @@ var require_decodePacket_browser = __commonJS({
|
|
|
125
152
|
"node_modules/engine.io-parser/build/cjs/decodePacket.browser.js"(exports) {
|
|
126
153
|
"use strict";
|
|
127
154
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
155
|
+
exports.decodePacket = void 0;
|
|
128
156
|
var commons_js_1 = require_commons();
|
|
129
157
|
var base64_arraybuffer_js_1 = require_base64_arraybuffer();
|
|
130
158
|
var withNativeArrayBuffer = typeof ArrayBuffer === "function";
|
|
@@ -153,6 +181,7 @@ var require_decodePacket_browser = __commonJS({
|
|
|
153
181
|
type: commons_js_1.PACKET_TYPES_REVERSE[type]
|
|
154
182
|
};
|
|
155
183
|
}, "decodePacket");
|
|
184
|
+
exports.decodePacket = decodePacket;
|
|
156
185
|
var decodeBase64Packet = /* @__PURE__ */ __name((data, binaryType) => {
|
|
157
186
|
if (withNativeArrayBuffer) {
|
|
158
187
|
const decoded = (0, base64_arraybuffer_js_1.decode)(data);
|
|
@@ -164,13 +193,20 @@ var require_decodePacket_browser = __commonJS({
|
|
|
164
193
|
var mapBinary = /* @__PURE__ */ __name((data, binaryType) => {
|
|
165
194
|
switch (binaryType) {
|
|
166
195
|
case "blob":
|
|
167
|
-
|
|
196
|
+
if (data instanceof Blob) {
|
|
197
|
+
return data;
|
|
198
|
+
} else {
|
|
199
|
+
return new Blob([data]);
|
|
200
|
+
}
|
|
168
201
|
case "arraybuffer":
|
|
169
202
|
default:
|
|
170
|
-
|
|
203
|
+
if (data instanceof ArrayBuffer) {
|
|
204
|
+
return data;
|
|
205
|
+
} else {
|
|
206
|
+
return data.buffer;
|
|
207
|
+
}
|
|
171
208
|
}
|
|
172
209
|
}, "mapBinary");
|
|
173
|
-
exports.default = decodePacket;
|
|
174
210
|
}
|
|
175
211
|
});
|
|
176
212
|
|
|
@@ -179,18 +215,25 @@ var require_cjs = __commonJS({
|
|
|
179
215
|
"node_modules/engine.io-parser/build/cjs/index.js"(exports) {
|
|
180
216
|
"use strict";
|
|
181
217
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
182
|
-
exports.decodePayload = exports.decodePacket = exports.encodePayload = exports.encodePacket = exports.protocol = void 0;
|
|
218
|
+
exports.decodePayload = exports.decodePacket = exports.encodePayload = exports.encodePacketToBinary = exports.encodePacket = exports.protocol = exports.decodePacketFromBinary = void 0;
|
|
183
219
|
var encodePacket_js_1 = require_encodePacket_browser();
|
|
184
|
-
exports
|
|
220
|
+
Object.defineProperty(exports, "encodePacket", { enumerable: true, get: function() {
|
|
221
|
+
return encodePacket_js_1.encodePacket;
|
|
222
|
+
} });
|
|
223
|
+
Object.defineProperty(exports, "encodePacketToBinary", { enumerable: true, get: function() {
|
|
224
|
+
return encodePacket_js_1.encodePacketToBinary;
|
|
225
|
+
} });
|
|
185
226
|
var decodePacket_js_1 = require_decodePacket_browser();
|
|
186
|
-
exports
|
|
227
|
+
Object.defineProperty(exports, "decodePacket", { enumerable: true, get: function() {
|
|
228
|
+
return decodePacket_js_1.decodePacket;
|
|
229
|
+
} });
|
|
187
230
|
var SEPARATOR = String.fromCharCode(30);
|
|
188
231
|
var encodePayload = /* @__PURE__ */ __name((packets, callback) => {
|
|
189
232
|
const length = packets.length;
|
|
190
233
|
const encodedPackets = new Array(length);
|
|
191
234
|
let count = 0;
|
|
192
235
|
packets.forEach((packet, i) => {
|
|
193
|
-
(0, encodePacket_js_1.
|
|
236
|
+
(0, encodePacket_js_1.encodePacket)(packet, false, (encodedPacket) => {
|
|
194
237
|
encodedPackets[i] = encodedPacket;
|
|
195
238
|
if (++count === length) {
|
|
196
239
|
callback(encodedPackets.join(SEPARATOR));
|
|
@@ -203,7 +246,7 @@ var require_cjs = __commonJS({
|
|
|
203
246
|
const encodedPackets = encodedPayload.split(SEPARATOR);
|
|
204
247
|
const packets = [];
|
|
205
248
|
for (let i = 0; i < encodedPackets.length; i++) {
|
|
206
|
-
const decodedPacket = (0, decodePacket_js_1.
|
|
249
|
+
const decodedPacket = (0, decodePacket_js_1.decodePacket)(encodedPackets[i], binaryType);
|
|
207
250
|
packets.push(decodedPacket);
|
|
208
251
|
if (decodedPacket.type === "error") {
|
|
209
252
|
break;
|
|
@@ -212,6 +255,16 @@ var require_cjs = __commonJS({
|
|
|
212
255
|
return packets;
|
|
213
256
|
}, "decodePayload");
|
|
214
257
|
exports.decodePayload = decodePayload;
|
|
258
|
+
var TEXT_DECODER;
|
|
259
|
+
function decodePacketFromBinary(data, isBinary, binaryType) {
|
|
260
|
+
if (!TEXT_DECODER) {
|
|
261
|
+
TEXT_DECODER = new TextDecoder();
|
|
262
|
+
}
|
|
263
|
+
const isPlainBinary = isBinary || data[0] < 48 || data[0] > 54;
|
|
264
|
+
return (0, decodePacket_js_1.decodePacket)(isPlainBinary ? data : TEXT_DECODER.decode(data), binaryType);
|
|
265
|
+
}
|
|
266
|
+
__name(decodePacketFromBinary, "decodePacketFromBinary");
|
|
267
|
+
exports.decodePacketFromBinary = decodePacketFromBinary;
|
|
215
268
|
exports.protocol = 4;
|
|
216
269
|
}
|
|
217
270
|
});
|
|
@@ -844,6 +897,39 @@ var require_browser = __commonJS({
|
|
|
844
897
|
}
|
|
845
898
|
});
|
|
846
899
|
|
|
900
|
+
// node_modules/engine.io-client/build/cjs/contrib/parseqs.js
|
|
901
|
+
var require_parseqs = __commonJS({
|
|
902
|
+
"node_modules/engine.io-client/build/cjs/contrib/parseqs.js"(exports) {
|
|
903
|
+
"use strict";
|
|
904
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
905
|
+
exports.decode = exports.encode = void 0;
|
|
906
|
+
function encode(obj) {
|
|
907
|
+
let str = "";
|
|
908
|
+
for (let i in obj) {
|
|
909
|
+
if (obj.hasOwnProperty(i)) {
|
|
910
|
+
if (str.length)
|
|
911
|
+
str += "&";
|
|
912
|
+
str += encodeURIComponent(i) + "=" + encodeURIComponent(obj[i]);
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
return str;
|
|
916
|
+
}
|
|
917
|
+
__name(encode, "encode");
|
|
918
|
+
exports.encode = encode;
|
|
919
|
+
function decode(qs) {
|
|
920
|
+
let qry = {};
|
|
921
|
+
let pairs = qs.split("&");
|
|
922
|
+
for (let i = 0, l = pairs.length; i < l; i++) {
|
|
923
|
+
let pair = pairs[i].split("=");
|
|
924
|
+
qry[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1]);
|
|
925
|
+
}
|
|
926
|
+
return qry;
|
|
927
|
+
}
|
|
928
|
+
__name(decode, "decode");
|
|
929
|
+
exports.decode = decode;
|
|
930
|
+
}
|
|
931
|
+
});
|
|
932
|
+
|
|
847
933
|
// node_modules/engine.io-client/build/cjs/transport.js
|
|
848
934
|
var require_transport = __commonJS({
|
|
849
935
|
"node_modules/engine.io-client/build/cjs/transport.js"(exports) {
|
|
@@ -857,6 +943,7 @@ var require_transport = __commonJS({
|
|
|
857
943
|
var component_emitter_1 = require_component_emitter();
|
|
858
944
|
var util_js_1 = require_util();
|
|
859
945
|
var debug_1 = __importDefault(require_browser());
|
|
946
|
+
var parseqs_js_1 = require_parseqs();
|
|
860
947
|
var debug = (0, debug_1.default)("engine.io-client:transport");
|
|
861
948
|
var TransportError = class extends Error {
|
|
862
949
|
constructor(reason, description, context) {
|
|
@@ -969,6 +1056,24 @@ var require_transport = __commonJS({
|
|
|
969
1056
|
*/
|
|
970
1057
|
pause(onPause) {
|
|
971
1058
|
}
|
|
1059
|
+
createUri(schema, query = {}) {
|
|
1060
|
+
return schema + "://" + this._hostname() + this._port() + this.opts.path + this._query(query);
|
|
1061
|
+
}
|
|
1062
|
+
_hostname() {
|
|
1063
|
+
const hostname = this.opts.hostname;
|
|
1064
|
+
return hostname.indexOf(":") === -1 ? hostname : "[" + hostname + "]";
|
|
1065
|
+
}
|
|
1066
|
+
_port() {
|
|
1067
|
+
if (this.opts.port && (this.opts.secure && Number(this.opts.port !== 443) || !this.opts.secure && Number(this.opts.port) !== 80)) {
|
|
1068
|
+
return ":" + this.opts.port;
|
|
1069
|
+
} else {
|
|
1070
|
+
return "";
|
|
1071
|
+
}
|
|
1072
|
+
}
|
|
1073
|
+
_query(query) {
|
|
1074
|
+
const encodedQuery = (0, parseqs_js_1.encode)(query);
|
|
1075
|
+
return encodedQuery.length ? "?" + encodedQuery : "";
|
|
1076
|
+
}
|
|
972
1077
|
};
|
|
973
1078
|
__name(Transport, "Transport");
|
|
974
1079
|
exports.Transport = Transport;
|
|
@@ -1019,39 +1124,6 @@ var require_yeast = __commonJS({
|
|
|
1019
1124
|
}
|
|
1020
1125
|
});
|
|
1021
1126
|
|
|
1022
|
-
// node_modules/engine.io-client/build/cjs/contrib/parseqs.js
|
|
1023
|
-
var require_parseqs = __commonJS({
|
|
1024
|
-
"node_modules/engine.io-client/build/cjs/contrib/parseqs.js"(exports) {
|
|
1025
|
-
"use strict";
|
|
1026
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1027
|
-
exports.decode = exports.encode = void 0;
|
|
1028
|
-
function encode(obj) {
|
|
1029
|
-
let str = "";
|
|
1030
|
-
for (let i in obj) {
|
|
1031
|
-
if (obj.hasOwnProperty(i)) {
|
|
1032
|
-
if (str.length)
|
|
1033
|
-
str += "&";
|
|
1034
|
-
str += encodeURIComponent(i) + "=" + encodeURIComponent(obj[i]);
|
|
1035
|
-
}
|
|
1036
|
-
}
|
|
1037
|
-
return str;
|
|
1038
|
-
}
|
|
1039
|
-
__name(encode, "encode");
|
|
1040
|
-
exports.encode = encode;
|
|
1041
|
-
function decode(qs) {
|
|
1042
|
-
let qry = {};
|
|
1043
|
-
let pairs = qs.split("&");
|
|
1044
|
-
for (let i = 0, l = pairs.length; i < l; i++) {
|
|
1045
|
-
let pair = pairs[i].split("=");
|
|
1046
|
-
qry[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1]);
|
|
1047
|
-
}
|
|
1048
|
-
return qry;
|
|
1049
|
-
}
|
|
1050
|
-
__name(decode, "decode");
|
|
1051
|
-
exports.decode = decode;
|
|
1052
|
-
}
|
|
1053
|
-
});
|
|
1054
|
-
|
|
1055
1127
|
// node_modules/engine.io-client/build/cjs/contrib/has-cors.js
|
|
1056
1128
|
var require_has_cors = __commonJS({
|
|
1057
1129
|
"node_modules/engine.io-client/build/cjs/contrib/has-cors.js"(exports) {
|
|
@@ -1072,7 +1144,7 @@ var require_xmlhttprequest_browser = __commonJS({
|
|
|
1072
1144
|
"node_modules/engine.io-client/build/cjs/transports/xmlhttprequest.browser.js"(exports) {
|
|
1073
1145
|
"use strict";
|
|
1074
1146
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1075
|
-
exports.XHR = void 0;
|
|
1147
|
+
exports.createCookieJar = exports.XHR = void 0;
|
|
1076
1148
|
var has_cors_js_1 = require_has_cors();
|
|
1077
1149
|
var globalThis_js_1 = require_globalThis_browser();
|
|
1078
1150
|
function XHR(opts) {
|
|
@@ -1092,6 +1164,10 @@ var require_xmlhttprequest_browser = __commonJS({
|
|
|
1092
1164
|
}
|
|
1093
1165
|
__name(XHR, "XHR");
|
|
1094
1166
|
exports.XHR = XHR;
|
|
1167
|
+
function createCookieJar() {
|
|
1168
|
+
}
|
|
1169
|
+
__name(createCookieJar, "createCookieJar");
|
|
1170
|
+
exports.createCookieJar = createCookieJar;
|
|
1095
1171
|
}
|
|
1096
1172
|
});
|
|
1097
1173
|
|
|
@@ -1107,7 +1183,6 @@ var require_polling = __commonJS({
|
|
|
1107
1183
|
var transport_js_1 = require_transport();
|
|
1108
1184
|
var debug_1 = __importDefault(require_browser());
|
|
1109
1185
|
var yeast_js_1 = require_yeast();
|
|
1110
|
-
var parseqs_js_1 = require_parseqs();
|
|
1111
1186
|
var engine_io_parser_1 = require_cjs();
|
|
1112
1187
|
var xmlhttprequest_js_1 = require_xmlhttprequest_browser();
|
|
1113
1188
|
var component_emitter_1 = require_component_emitter();
|
|
@@ -1140,10 +1215,12 @@ var require_polling = __commonJS({
|
|
|
1140
1215
|
port = isSSL ? "443" : "80";
|
|
1141
1216
|
}
|
|
1142
1217
|
this.xd = typeof location !== "undefined" && opts.hostname !== location.hostname || port !== opts.port;
|
|
1143
|
-
this.xs = opts.secure !== isSSL;
|
|
1144
1218
|
}
|
|
1145
1219
|
const forceBase64 = opts && opts.forceBase64;
|
|
1146
1220
|
this.supportsBinary = hasXHR2 && !forceBase64;
|
|
1221
|
+
if (this.opts.withCredentials) {
|
|
1222
|
+
this.cookieJar = (0, xmlhttprequest_js_1.createCookieJar)();
|
|
1223
|
+
}
|
|
1147
1224
|
}
|
|
1148
1225
|
get name() {
|
|
1149
1226
|
return "polling";
|
|
@@ -1270,21 +1347,15 @@ var require_polling = __commonJS({
|
|
|
1270
1347
|
* @private
|
|
1271
1348
|
*/
|
|
1272
1349
|
uri() {
|
|
1273
|
-
let query = this.query || {};
|
|
1274
1350
|
const schema = this.opts.secure ? "https" : "http";
|
|
1275
|
-
|
|
1351
|
+
const query = this.query || {};
|
|
1276
1352
|
if (false !== this.opts.timestampRequests) {
|
|
1277
1353
|
query[this.opts.timestampParam] = (0, yeast_js_1.yeast)();
|
|
1278
1354
|
}
|
|
1279
1355
|
if (!this.supportsBinary && !query.sid) {
|
|
1280
1356
|
query.b64 = 1;
|
|
1281
1357
|
}
|
|
1282
|
-
|
|
1283
|
-
port = ":" + this.opts.port;
|
|
1284
|
-
}
|
|
1285
|
-
const encodedQuery = (0, parseqs_js_1.encode)(query);
|
|
1286
|
-
const ipv6 = this.opts.hostname.indexOf(":") !== -1;
|
|
1287
|
-
return schema + "://" + (ipv6 ? "[" + this.opts.hostname + "]" : this.opts.hostname) + port + this.opts.path + (encodedQuery.length ? "?" + encodedQuery : "");
|
|
1358
|
+
return this.createUri(schema, query);
|
|
1288
1359
|
}
|
|
1289
1360
|
/**
|
|
1290
1361
|
* Creates a request.
|
|
@@ -1293,7 +1364,7 @@ var require_polling = __commonJS({
|
|
|
1293
1364
|
* @private
|
|
1294
1365
|
*/
|
|
1295
1366
|
request(opts = {}) {
|
|
1296
|
-
Object.assign(opts, { xd: this.xd,
|
|
1367
|
+
Object.assign(opts, { xd: this.xd, cookieJar: this.cookieJar }, this.opts);
|
|
1297
1368
|
return new Request(this.uri(), opts);
|
|
1298
1369
|
}
|
|
1299
1370
|
/**
|
|
@@ -1343,7 +1414,6 @@ var require_polling = __commonJS({
|
|
|
1343
1414
|
this.opts = opts;
|
|
1344
1415
|
this.method = opts.method || "GET";
|
|
1345
1416
|
this.uri = uri;
|
|
1346
|
-
this.async = false !== opts.async;
|
|
1347
1417
|
this.data = void 0 !== opts.data ? opts.data : null;
|
|
1348
1418
|
this.create();
|
|
1349
1419
|
}
|
|
@@ -1353,13 +1423,13 @@ var require_polling = __commonJS({
|
|
|
1353
1423
|
* @private
|
|
1354
1424
|
*/
|
|
1355
1425
|
create() {
|
|
1426
|
+
var _a;
|
|
1356
1427
|
const opts = (0, util_js_1.pick)(this.opts, "agent", "pfx", "key", "passphrase", "cert", "ca", "ciphers", "rejectUnauthorized", "autoUnref");
|
|
1357
1428
|
opts.xdomain = !!this.opts.xd;
|
|
1358
|
-
opts.xscheme = !!this.opts.xs;
|
|
1359
1429
|
const xhr = this.xhr = new xmlhttprequest_js_1.XHR(opts);
|
|
1360
1430
|
try {
|
|
1361
1431
|
debug("xhr open %s: %s", this.method, this.uri);
|
|
1362
|
-
xhr.open(this.method, this.uri,
|
|
1432
|
+
xhr.open(this.method, this.uri, true);
|
|
1363
1433
|
try {
|
|
1364
1434
|
if (this.opts.extraHeaders) {
|
|
1365
1435
|
xhr.setDisableHeaderCheck && xhr.setDisableHeaderCheck(true);
|
|
@@ -1381,6 +1451,7 @@ var require_polling = __commonJS({
|
|
|
1381
1451
|
xhr.setRequestHeader("Accept", "*/*");
|
|
1382
1452
|
} catch (e) {
|
|
1383
1453
|
}
|
|
1454
|
+
(_a = this.opts.cookieJar) === null || _a === void 0 ? void 0 : _a.addCookies(xhr);
|
|
1384
1455
|
if ("withCredentials" in xhr) {
|
|
1385
1456
|
xhr.withCredentials = this.opts.withCredentials;
|
|
1386
1457
|
}
|
|
@@ -1388,6 +1459,10 @@ var require_polling = __commonJS({
|
|
|
1388
1459
|
xhr.timeout = this.opts.requestTimeout;
|
|
1389
1460
|
}
|
|
1390
1461
|
xhr.onreadystatechange = () => {
|
|
1462
|
+
var _a2;
|
|
1463
|
+
if (xhr.readyState === 3) {
|
|
1464
|
+
(_a2 = this.opts.cookieJar) === null || _a2 === void 0 ? void 0 : _a2.parseCookies(xhr);
|
|
1465
|
+
}
|
|
1391
1466
|
if (4 !== xhr.readyState)
|
|
1392
1467
|
return;
|
|
1393
1468
|
if (200 === xhr.status || 1223 === xhr.status) {
|
|
@@ -1517,7 +1592,6 @@ var require_websocket = __commonJS({
|
|
|
1517
1592
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1518
1593
|
exports.WS = void 0;
|
|
1519
1594
|
var transport_js_1 = require_transport();
|
|
1520
|
-
var parseqs_js_1 = require_parseqs();
|
|
1521
1595
|
var yeast_js_1 = require_yeast();
|
|
1522
1596
|
var util_js_1 = require_util();
|
|
1523
1597
|
var websocket_constructor_js_1 = require_websocket_constructor_browser();
|
|
@@ -1627,21 +1701,15 @@ var require_websocket = __commonJS({
|
|
|
1627
1701
|
* @private
|
|
1628
1702
|
*/
|
|
1629
1703
|
uri() {
|
|
1630
|
-
let query = this.query || {};
|
|
1631
1704
|
const schema = this.opts.secure ? "wss" : "ws";
|
|
1632
|
-
|
|
1633
|
-
if (this.opts.port && ("wss" === schema && Number(this.opts.port) !== 443 || "ws" === schema && Number(this.opts.port) !== 80)) {
|
|
1634
|
-
port = ":" + this.opts.port;
|
|
1635
|
-
}
|
|
1705
|
+
const query = this.query || {};
|
|
1636
1706
|
if (this.opts.timestampRequests) {
|
|
1637
1707
|
query[this.opts.timestampParam] = (0, yeast_js_1.yeast)();
|
|
1638
1708
|
}
|
|
1639
1709
|
if (!this.supportsBinary) {
|
|
1640
1710
|
query.b64 = 1;
|
|
1641
1711
|
}
|
|
1642
|
-
|
|
1643
|
-
const ipv6 = this.opts.hostname.indexOf(":") !== -1;
|
|
1644
|
-
return schema + "://" + (ipv6 ? "[" + this.opts.hostname + "]" : this.opts.hostname) + port + this.opts.path + (encodedQuery.length ? "?" + encodedQuery : "");
|
|
1712
|
+
return this.createUri(schema, query);
|
|
1645
1713
|
}
|
|
1646
1714
|
/**
|
|
1647
1715
|
* Feature detection for WebSocket.
|
|
@@ -1658,6 +1726,101 @@ var require_websocket = __commonJS({
|
|
|
1658
1726
|
}
|
|
1659
1727
|
});
|
|
1660
1728
|
|
|
1729
|
+
// node_modules/engine.io-client/build/cjs/transports/webtransport.js
|
|
1730
|
+
var require_webtransport = __commonJS({
|
|
1731
|
+
"node_modules/engine.io-client/build/cjs/transports/webtransport.js"(exports) {
|
|
1732
|
+
"use strict";
|
|
1733
|
+
var __importDefault = exports && exports.__importDefault || function(mod) {
|
|
1734
|
+
return mod && mod.__esModule ? mod : { "default": mod };
|
|
1735
|
+
};
|
|
1736
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1737
|
+
exports.WT = void 0;
|
|
1738
|
+
var transport_js_1 = require_transport();
|
|
1739
|
+
var websocket_constructor_js_1 = require_websocket_constructor_browser();
|
|
1740
|
+
var engine_io_parser_1 = require_cjs();
|
|
1741
|
+
var debug_1 = __importDefault(require_browser());
|
|
1742
|
+
var debug = (0, debug_1.default)("engine.io-client:webtransport");
|
|
1743
|
+
function shouldIncludeBinaryHeader(packet, encoded) {
|
|
1744
|
+
return packet.type === "message" && typeof packet.data !== "string" && encoded[0] >= 48 && encoded[0] <= 54;
|
|
1745
|
+
}
|
|
1746
|
+
__name(shouldIncludeBinaryHeader, "shouldIncludeBinaryHeader");
|
|
1747
|
+
var WT = class extends transport_js_1.Transport {
|
|
1748
|
+
get name() {
|
|
1749
|
+
return "webtransport";
|
|
1750
|
+
}
|
|
1751
|
+
doOpen() {
|
|
1752
|
+
if (typeof WebTransport !== "function") {
|
|
1753
|
+
return;
|
|
1754
|
+
}
|
|
1755
|
+
this.transport = new WebTransport(this.createUri("https"), this.opts.transportOptions[this.name]);
|
|
1756
|
+
this.transport.closed.then(() => {
|
|
1757
|
+
debug("transport closed gracefully");
|
|
1758
|
+
this.onClose();
|
|
1759
|
+
}).catch((err) => {
|
|
1760
|
+
debug("transport closed due to %s", err);
|
|
1761
|
+
this.onError("webtransport error", err);
|
|
1762
|
+
});
|
|
1763
|
+
this.transport.ready.then(() => {
|
|
1764
|
+
this.transport.createBidirectionalStream().then((stream) => {
|
|
1765
|
+
const reader = stream.readable.getReader();
|
|
1766
|
+
this.writer = stream.writable.getWriter();
|
|
1767
|
+
let binaryFlag;
|
|
1768
|
+
const read = /* @__PURE__ */ __name(() => {
|
|
1769
|
+
reader.read().then(({ done, value }) => {
|
|
1770
|
+
if (done) {
|
|
1771
|
+
debug("session is closed");
|
|
1772
|
+
return;
|
|
1773
|
+
}
|
|
1774
|
+
debug("received chunk: %o", value);
|
|
1775
|
+
if (!binaryFlag && value.byteLength === 1 && value[0] === 54) {
|
|
1776
|
+
binaryFlag = true;
|
|
1777
|
+
} else {
|
|
1778
|
+
this.onPacket((0, engine_io_parser_1.decodePacketFromBinary)(value, binaryFlag, "arraybuffer"));
|
|
1779
|
+
binaryFlag = false;
|
|
1780
|
+
}
|
|
1781
|
+
read();
|
|
1782
|
+
}).catch((err) => {
|
|
1783
|
+
debug("an error occurred while reading: %s", err);
|
|
1784
|
+
});
|
|
1785
|
+
}, "read");
|
|
1786
|
+
read();
|
|
1787
|
+
const handshake = this.query.sid ? `0{"sid":"${this.query.sid}"}` : "0";
|
|
1788
|
+
this.writer.write(new TextEncoder().encode(handshake)).then(() => this.onOpen());
|
|
1789
|
+
});
|
|
1790
|
+
});
|
|
1791
|
+
}
|
|
1792
|
+
write(packets) {
|
|
1793
|
+
this.writable = false;
|
|
1794
|
+
for (let i = 0; i < packets.length; i++) {
|
|
1795
|
+
const packet = packets[i];
|
|
1796
|
+
const lastPacket = i === packets.length - 1;
|
|
1797
|
+
(0, engine_io_parser_1.encodePacketToBinary)(packet, (data) => {
|
|
1798
|
+
if (shouldIncludeBinaryHeader(packet, data)) {
|
|
1799
|
+
debug("writing binary header");
|
|
1800
|
+
this.writer.write(Uint8Array.of(54));
|
|
1801
|
+
}
|
|
1802
|
+
debug("writing chunk: %o", data);
|
|
1803
|
+
this.writer.write(data).then(() => {
|
|
1804
|
+
if (lastPacket) {
|
|
1805
|
+
(0, websocket_constructor_js_1.nextTick)(() => {
|
|
1806
|
+
this.writable = true;
|
|
1807
|
+
this.emitReserved("drain");
|
|
1808
|
+
}, this.setTimeoutFn);
|
|
1809
|
+
}
|
|
1810
|
+
});
|
|
1811
|
+
});
|
|
1812
|
+
}
|
|
1813
|
+
}
|
|
1814
|
+
doClose() {
|
|
1815
|
+
var _a;
|
|
1816
|
+
(_a = this.transport) === null || _a === void 0 ? void 0 : _a.close();
|
|
1817
|
+
}
|
|
1818
|
+
};
|
|
1819
|
+
__name(WT, "WT");
|
|
1820
|
+
exports.WT = WT;
|
|
1821
|
+
}
|
|
1822
|
+
});
|
|
1823
|
+
|
|
1661
1824
|
// node_modules/engine.io-client/build/cjs/transports/index.js
|
|
1662
1825
|
var require_transports = __commonJS({
|
|
1663
1826
|
"node_modules/engine.io-client/build/cjs/transports/index.js"(exports) {
|
|
@@ -1666,8 +1829,10 @@ var require_transports = __commonJS({
|
|
|
1666
1829
|
exports.transports = void 0;
|
|
1667
1830
|
var polling_js_1 = require_polling();
|
|
1668
1831
|
var websocket_js_1 = require_websocket();
|
|
1832
|
+
var webtransport_js_1 = require_webtransport();
|
|
1669
1833
|
exports.transports = {
|
|
1670
1834
|
websocket: websocket_js_1.WS,
|
|
1835
|
+
webtransport: webtransport_js_1.WT,
|
|
1671
1836
|
polling: polling_js_1.Polling
|
|
1672
1837
|
};
|
|
1673
1838
|
}
|
|
@@ -1789,7 +1954,11 @@ var require_socket = __commonJS({
|
|
|
1789
1954
|
}
|
|
1790
1955
|
this.hostname = opts.hostname || (typeof location !== "undefined" ? location.hostname : "localhost");
|
|
1791
1956
|
this.port = opts.port || (typeof location !== "undefined" && location.port ? location.port : this.secure ? "443" : "80");
|
|
1792
|
-
this.transports = opts.transports || [
|
|
1957
|
+
this.transports = opts.transports || [
|
|
1958
|
+
"polling",
|
|
1959
|
+
"websocket",
|
|
1960
|
+
"webtransport"
|
|
1961
|
+
];
|
|
1793
1962
|
this.writeBuffer = [];
|
|
1794
1963
|
this.prevBufferLen = 0;
|
|
1795
1964
|
this.opts = Object.assign({
|
|
@@ -1805,7 +1974,7 @@ var require_socket = __commonJS({
|
|
|
1805
1974
|
threshold: 1024
|
|
1806
1975
|
},
|
|
1807
1976
|
transportOptions: {},
|
|
1808
|
-
closeOnBeforeunload:
|
|
1977
|
+
closeOnBeforeunload: false
|
|
1809
1978
|
}, opts);
|
|
1810
1979
|
this.opts.path = this.opts.path.replace(/\/$/, "") + (this.opts.addTrailingSlash ? "/" : "");
|
|
1811
1980
|
if (typeof this.opts.query === "string") {
|
|
@@ -1851,13 +2020,13 @@ var require_socket = __commonJS({
|
|
|
1851
2020
|
query.transport = name;
|
|
1852
2021
|
if (this.id)
|
|
1853
2022
|
query.sid = this.id;
|
|
1854
|
-
const opts = Object.assign({}, this.opts
|
|
2023
|
+
const opts = Object.assign({}, this.opts, {
|
|
1855
2024
|
query,
|
|
1856
2025
|
socket: this,
|
|
1857
2026
|
hostname: this.hostname,
|
|
1858
2027
|
secure: this.secure,
|
|
1859
2028
|
port: this.port
|
|
1860
|
-
});
|
|
2029
|
+
}, this.opts.transportOptions[name]);
|
|
1861
2030
|
debug("options: %j", opts);
|
|
1862
2031
|
return new index_js_1.transports[name](opts);
|
|
1863
2032
|
}
|
|
@@ -1996,7 +2165,15 @@ var require_socket = __commonJS({
|
|
|
1996
2165
|
transport.once("close", onTransportClose);
|
|
1997
2166
|
this.once("close", onclose);
|
|
1998
2167
|
this.once("upgrading", onupgrade);
|
|
1999
|
-
|
|
2168
|
+
if (this.upgrades.indexOf("webtransport") !== -1 && name !== "webtransport") {
|
|
2169
|
+
this.setTimeoutFn(() => {
|
|
2170
|
+
if (!failed) {
|
|
2171
|
+
transport.open();
|
|
2172
|
+
}
|
|
2173
|
+
}, 200);
|
|
2174
|
+
} else {
|
|
2175
|
+
transport.open();
|
|
2176
|
+
}
|
|
2000
2177
|
}
|
|
2001
2178
|
/**
|
|
2002
2179
|
* Called when connection is deemed open.
|
|
@@ -3769,35 +3946,33 @@ var require_manager = __commonJS({
|
|
|
3769
3946
|
self2.onopen();
|
|
3770
3947
|
fn && fn();
|
|
3771
3948
|
});
|
|
3772
|
-
const
|
|
3949
|
+
const onError = /* @__PURE__ */ __name((err) => {
|
|
3773
3950
|
debug("error");
|
|
3774
|
-
|
|
3775
|
-
|
|
3951
|
+
this.cleanup();
|
|
3952
|
+
this._readyState = "closed";
|
|
3776
3953
|
this.emitReserved("error", err);
|
|
3777
3954
|
if (fn) {
|
|
3778
3955
|
fn(err);
|
|
3779
3956
|
} else {
|
|
3780
|
-
|
|
3957
|
+
this.maybeReconnectOnOpen();
|
|
3781
3958
|
}
|
|
3782
|
-
});
|
|
3959
|
+
}, "onError");
|
|
3960
|
+
const errorSub = on_js_1.on(socket, "error", onError);
|
|
3783
3961
|
if (false !== this._timeout) {
|
|
3784
3962
|
const timeout = this._timeout;
|
|
3785
3963
|
debug("connect attempt will timeout after %d", timeout);
|
|
3786
|
-
if (timeout === 0) {
|
|
3787
|
-
openSubDestroy();
|
|
3788
|
-
}
|
|
3789
3964
|
const timer = this.setTimeoutFn(() => {
|
|
3790
3965
|
debug("connect attempt timed out after %d", timeout);
|
|
3791
3966
|
openSubDestroy();
|
|
3967
|
+
onError(new Error("timeout"));
|
|
3792
3968
|
socket.close();
|
|
3793
|
-
socket.emit("error", new Error("timeout"));
|
|
3794
3969
|
}, timeout);
|
|
3795
3970
|
if (this.opts.autoUnref) {
|
|
3796
3971
|
timer.unref();
|
|
3797
3972
|
}
|
|
3798
|
-
this.subs.push(
|
|
3799
|
-
|
|
3800
|
-
}
|
|
3973
|
+
this.subs.push(() => {
|
|
3974
|
+
this.clearTimeoutFn(timer);
|
|
3975
|
+
});
|
|
3801
3976
|
}
|
|
3802
3977
|
this.subs.push(openSubDestroy);
|
|
3803
3978
|
this.subs.push(errorSub);
|
|
@@ -3997,9 +4172,9 @@ var require_manager = __commonJS({
|
|
|
3997
4172
|
if (this.opts.autoUnref) {
|
|
3998
4173
|
timer.unref();
|
|
3999
4174
|
}
|
|
4000
|
-
this.subs.push(
|
|
4001
|
-
|
|
4002
|
-
}
|
|
4175
|
+
this.subs.push(() => {
|
|
4176
|
+
this.clearTimeoutFn(timer);
|
|
4177
|
+
});
|
|
4003
4178
|
}
|
|
4004
4179
|
}
|
|
4005
4180
|
/**
|