@colyseus/sdk 0.17.7 → 0.17.10
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/build/3rd_party/discord.cjs +1 -1
- package/build/3rd_party/discord.mjs +1 -1
- package/build/Auth.cjs +1 -2
- package/build/Auth.cjs.map +1 -1
- package/build/Auth.d.ts +27 -10
- package/build/Auth.mjs +1 -2
- package/build/Auth.mjs.map +1 -1
- package/build/Client.cjs +1 -1
- package/build/Client.cjs.map +1 -1
- package/build/Client.d.ts +10 -9
- package/build/Client.mjs +1 -1
- package/build/Client.mjs.map +1 -1
- package/build/Connection.cjs +1 -1
- package/build/Connection.mjs +1 -1
- package/build/HTTP.cjs +21 -2
- package/build/HTTP.cjs.map +1 -1
- package/build/HTTP.d.ts +3 -0
- package/build/HTTP.mjs +21 -2
- package/build/HTTP.mjs.map +1 -1
- package/build/Protocol.cjs +1 -1
- package/build/Protocol.mjs +1 -1
- package/build/Room.cjs +2 -2
- package/build/Room.cjs.map +1 -1
- package/build/Room.d.ts +1 -5
- package/build/Room.mjs +2 -2
- package/build/Room.mjs.map +1 -1
- package/build/Storage.cjs +1 -1
- package/build/Storage.mjs +1 -1
- package/build/core/nanoevents.cjs +1 -1
- package/build/core/nanoevents.cjs.map +1 -1
- package/build/core/nanoevents.d.ts +9 -5
- package/build/core/nanoevents.mjs +1 -1
- package/build/core/nanoevents.mjs.map +1 -1
- package/build/core/signal.cjs +1 -1
- package/build/core/signal.mjs +1 -1
- package/build/core/utils.cjs +1 -1
- package/build/core/utils.cjs.map +1 -1
- package/build/core/utils.d.ts +11 -0
- package/build/core/utils.mjs +1 -1
- package/build/core/utils.mjs.map +1 -1
- package/build/errors/Errors.cjs +1 -1
- package/build/errors/Errors.mjs +1 -1
- package/build/index.cjs +1 -1
- package/build/index.cjs.map +1 -1
- package/build/index.d.ts +2 -1
- package/build/index.mjs +1 -1
- package/build/index.mjs.map +1 -1
- package/build/legacy.cjs +1 -1
- package/build/legacy.mjs +1 -1
- package/build/serializer/NoneSerializer.cjs +1 -1
- package/build/serializer/NoneSerializer.mjs +1 -1
- package/build/serializer/SchemaSerializer.cjs +1 -1
- package/build/serializer/SchemaSerializer.mjs +1 -1
- package/build/serializer/Serializer.cjs +1 -1
- package/build/serializer/Serializer.mjs +1 -1
- package/build/transport/H3Transport.cjs +1 -1
- package/build/transport/H3Transport.mjs +1 -1
- package/build/transport/WebSocketTransport.cjs +2 -2
- package/build/transport/WebSocketTransport.cjs.map +1 -1
- package/build/transport/WebSocketTransport.mjs +2 -2
- package/build/transport/WebSocketTransport.mjs.map +1 -1
- package/dist/colyseus-cocos-creator.js +22 -5
- package/dist/colyseus-cocos-creator.js.map +1 -1
- package/dist/colyseus.js +22 -5
- package/dist/colyseus.js.map +1 -1
- package/dist/debug.js +1 -1
- package/package.json +2 -2
- package/src/Auth.ts +49 -18
- package/src/Client.ts +25 -24
- package/src/HTTP.ts +23 -1
- package/src/Room.ts +1 -1
- package/src/core/nanoevents.ts +11 -3
- package/src/core/utils.ts +18 -1
- package/src/index.ts +2 -1
- package/src/transport/WebSocketTransport.ts +1 -1
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// This software is released under the MIT License.
|
|
4
4
|
// https://opensource.org/license/MIT
|
|
5
5
|
//
|
|
6
|
-
// colyseus.js@0.17.
|
|
6
|
+
// colyseus.js@0.17.10 - @colyseus/schema 4.0.1
|
|
7
7
|
// THIS VERSION USES "XMLHttpRequest" INSTEAD OF "fetch" FOR COMPATIBILITY WITH COCOS CREATOR
|
|
8
8
|
(function (global, factory) {
|
|
9
9
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
@@ -8266,7 +8266,7 @@
|
|
|
8266
8266
|
this.ws.send(data);
|
|
8267
8267
|
}
|
|
8268
8268
|
sendUnreliable(data) {
|
|
8269
|
-
console.warn("colyseus
|
|
8269
|
+
console.warn("@colyseus/sdk: The WebSocket transport does not support unreliable messages");
|
|
8270
8270
|
}
|
|
8271
8271
|
/**
|
|
8272
8272
|
* @param url URL to connect to
|
|
@@ -8774,7 +8774,7 @@
|
|
|
8774
8774
|
this.onMessageHandlers.emit('*', type, message);
|
|
8775
8775
|
}
|
|
8776
8776
|
else if (!messageType.startsWith("__")) { // ignore internal messages
|
|
8777
|
-
(_a = console.warn) === null || _a === void 0 ? void 0 : _a.call(console,
|
|
8777
|
+
(_a = console.warn) === null || _a === void 0 ? void 0 : _a.call(console, `@colyseus/sdk: onMessage() not registered for type '${type}'.`);
|
|
8778
8778
|
}
|
|
8779
8779
|
}
|
|
8780
8780
|
destroy() {
|
|
@@ -8918,6 +8918,7 @@
|
|
|
8918
8918
|
}
|
|
8919
8919
|
executeRequest(method, path, requestOptions) {
|
|
8920
8920
|
return __awaiter(this, void 0, void 0, function* () {
|
|
8921
|
+
var _a;
|
|
8921
8922
|
//
|
|
8922
8923
|
// FIXME: if FormData is provided, merging "baseOptions.body" with
|
|
8923
8924
|
// "options.body" will not work as intended
|
|
@@ -8930,6 +8931,10 @@
|
|
|
8930
8931
|
? Object.assign(Object.assign({}, this.options.params), ((requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.params) || {})) : requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.params;
|
|
8931
8932
|
const headers = new Headers((this.options.headers)
|
|
8932
8933
|
? Object.assign(Object.assign({}, this.options.headers), ((requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers) || {})) : requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
8934
|
+
// Add Authorization header if authToken is set
|
|
8935
|
+
if (this.authToken && !headers.has("authorization")) {
|
|
8936
|
+
headers.set("authorization", `Bearer ${this.authToken}`);
|
|
8937
|
+
}
|
|
8933
8938
|
// Stringify JSON-serializable objects for fetch() body
|
|
8934
8939
|
if (isJSONSerializable(body) && typeof body === 'object' && body !== null) {
|
|
8935
8940
|
if (!headers.has("content-type")) {
|
|
@@ -8948,7 +8953,20 @@
|
|
|
8948
8953
|
body,
|
|
8949
8954
|
method });
|
|
8950
8955
|
const url = getURLWithQueryParams(this.sdk['getHttpEndpoint'](path.toString()), mergedOptions);
|
|
8951
|
-
|
|
8956
|
+
let response;
|
|
8957
|
+
try {
|
|
8958
|
+
response = yield fetch(url, mergedOptions);
|
|
8959
|
+
}
|
|
8960
|
+
catch (err) {
|
|
8961
|
+
// If it's an AbortError, re-throw as-is
|
|
8962
|
+
if (err.name === 'AbortError') {
|
|
8963
|
+
throw err;
|
|
8964
|
+
}
|
|
8965
|
+
// Re-throw with network error code at top level (e.g. ECONNREFUSED)
|
|
8966
|
+
const networkError = new ServerError(((_a = err.cause) === null || _a === void 0 ? void 0 : _a.code) || err.code, err.message);
|
|
8967
|
+
networkError.cause = err.cause;
|
|
8968
|
+
throw networkError;
|
|
8969
|
+
}
|
|
8952
8970
|
const contentType = response.headers.get("content-type");
|
|
8953
8971
|
let data;
|
|
8954
8972
|
let error = null;
|
|
@@ -9186,7 +9204,6 @@
|
|
|
9186
9204
|
}
|
|
9187
9205
|
signOut() {
|
|
9188
9206
|
return __awaiter(this, void 0, void 0, function* () {
|
|
9189
|
-
// @ts-ignore
|
|
9190
9207
|
this.emitChange({ user: null, token: null });
|
|
9191
9208
|
});
|
|
9192
9209
|
}
|