@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
package/dist/colyseus.js
CHANGED
|
@@ -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
|
(function (global, factory) {
|
|
8
8
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
9
9
|
typeof define === 'function' && define.amd ? define('@colyseus/sdk', ['exports'], factory) :
|
|
@@ -8265,7 +8265,7 @@
|
|
|
8265
8265
|
this.ws.send(data);
|
|
8266
8266
|
}
|
|
8267
8267
|
sendUnreliable(data) {
|
|
8268
|
-
console.warn("colyseus
|
|
8268
|
+
console.warn("@colyseus/sdk: The WebSocket transport does not support unreliable messages");
|
|
8269
8269
|
}
|
|
8270
8270
|
/**
|
|
8271
8271
|
* @param url URL to connect to
|
|
@@ -8773,7 +8773,7 @@
|
|
|
8773
8773
|
this.onMessageHandlers.emit('*', type, message);
|
|
8774
8774
|
}
|
|
8775
8775
|
else if (!messageType.startsWith("__")) { // ignore internal messages
|
|
8776
|
-
(_a = console.warn) === null || _a === void 0 ? void 0 : _a.call(console,
|
|
8776
|
+
(_a = console.warn) === null || _a === void 0 ? void 0 : _a.call(console, `@colyseus/sdk: onMessage() not registered for type '${type}'.`);
|
|
8777
8777
|
}
|
|
8778
8778
|
}
|
|
8779
8779
|
destroy() {
|
|
@@ -8917,6 +8917,7 @@
|
|
|
8917
8917
|
}
|
|
8918
8918
|
executeRequest(method, path, requestOptions) {
|
|
8919
8919
|
return __awaiter(this, void 0, void 0, function* () {
|
|
8920
|
+
var _a;
|
|
8920
8921
|
//
|
|
8921
8922
|
// FIXME: if FormData is provided, merging "baseOptions.body" with
|
|
8922
8923
|
// "options.body" will not work as intended
|
|
@@ -8929,6 +8930,10 @@
|
|
|
8929
8930
|
? 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;
|
|
8930
8931
|
const headers = new Headers((this.options.headers)
|
|
8931
8932
|
? 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);
|
|
8933
|
+
// Add Authorization header if authToken is set
|
|
8934
|
+
if (this.authToken && !headers.has("authorization")) {
|
|
8935
|
+
headers.set("authorization", `Bearer ${this.authToken}`);
|
|
8936
|
+
}
|
|
8932
8937
|
// Stringify JSON-serializable objects for fetch() body
|
|
8933
8938
|
if (isJSONSerializable(body) && typeof body === 'object' && body !== null) {
|
|
8934
8939
|
if (!headers.has("content-type")) {
|
|
@@ -8947,7 +8952,20 @@
|
|
|
8947
8952
|
body,
|
|
8948
8953
|
method });
|
|
8949
8954
|
const url = getURLWithQueryParams(this.sdk['getHttpEndpoint'](path.toString()), mergedOptions);
|
|
8950
|
-
|
|
8955
|
+
let response;
|
|
8956
|
+
try {
|
|
8957
|
+
response = yield fetch(url, mergedOptions);
|
|
8958
|
+
}
|
|
8959
|
+
catch (err) {
|
|
8960
|
+
// If it's an AbortError, re-throw as-is
|
|
8961
|
+
if (err.name === 'AbortError') {
|
|
8962
|
+
throw err;
|
|
8963
|
+
}
|
|
8964
|
+
// Re-throw with network error code at top level (e.g. ECONNREFUSED)
|
|
8965
|
+
const networkError = new ServerError(((_a = err.cause) === null || _a === void 0 ? void 0 : _a.code) || err.code, err.message);
|
|
8966
|
+
networkError.cause = err.cause;
|
|
8967
|
+
throw networkError;
|
|
8968
|
+
}
|
|
8951
8969
|
const contentType = response.headers.get("content-type");
|
|
8952
8970
|
let data;
|
|
8953
8971
|
let error = null;
|
|
@@ -9185,7 +9203,6 @@
|
|
|
9185
9203
|
}
|
|
9186
9204
|
signOut() {
|
|
9187
9205
|
return __awaiter(this, void 0, void 0, function* () {
|
|
9188
|
-
// @ts-ignore
|
|
9189
9206
|
this.emitChange({ user: null, token: null });
|
|
9190
9207
|
});
|
|
9191
9208
|
}
|