@colyseus/sdk 0.17.32 → 0.17.34

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.
Files changed (58) hide show
  1. package/LICENSE +2 -1
  2. package/README.md +27 -0
  3. package/build/3rd_party/discord.cjs +1 -1
  4. package/build/3rd_party/discord.mjs +1 -1
  5. package/build/Auth.cjs +1 -1
  6. package/build/Auth.mjs +1 -1
  7. package/build/Client.cjs +1 -1
  8. package/build/Client.mjs +1 -1
  9. package/build/Connection.cjs +1 -1
  10. package/build/Connection.mjs +1 -1
  11. package/build/HTTP.bkp.d.ts +103 -0
  12. package/build/HTTP.cjs +1 -1
  13. package/build/HTTP.mjs +1 -1
  14. package/build/HTTP_bkp.d.ts +18 -0
  15. package/build/Protocol.cjs +34 -0
  16. package/build/Protocol.cjs.map +1 -0
  17. package/build/Protocol.d.ts +21 -0
  18. package/build/Protocol.mjs +34 -0
  19. package/build/Protocol.mjs.map +1 -0
  20. package/build/Room.cjs +1 -1
  21. package/build/Room.mjs +1 -1
  22. package/build/Storage.cjs +1 -1
  23. package/build/Storage.mjs +1 -1
  24. package/build/core/nanoevents.cjs +1 -1
  25. package/build/core/nanoevents.mjs +1 -1
  26. package/build/core/signal.cjs +1 -1
  27. package/build/core/signal.mjs +1 -1
  28. package/build/core/utils.cjs +1 -1
  29. package/build/core/utils.mjs +1 -1
  30. package/build/debug.cjs +5 -26
  31. package/build/debug.cjs.map +1 -1
  32. package/build/debug.mjs +5 -26
  33. package/build/debug.mjs.map +1 -1
  34. package/build/errors/Errors.cjs +1 -1
  35. package/build/errors/Errors.mjs +1 -1
  36. package/build/index.cjs +1 -1
  37. package/build/index.mjs +1 -1
  38. package/build/legacy.cjs +1 -1
  39. package/build/legacy.mjs +1 -1
  40. package/build/serializer/NoneSerializer.cjs +1 -1
  41. package/build/serializer/NoneSerializer.mjs +1 -1
  42. package/build/serializer/SchemaSerializer.cjs +1 -1
  43. package/build/serializer/SchemaSerializer.mjs +1 -1
  44. package/build/serializer/Serializer.cjs +1 -1
  45. package/build/serializer/Serializer.mjs +1 -1
  46. package/build/transport/H3Transport.cjs +1 -1
  47. package/build/transport/H3Transport.mjs +1 -1
  48. package/build/transport/WebSocketTransport.cjs +1 -1
  49. package/build/transport/WebSocketTransport.mjs +1 -1
  50. package/dist/colyseus-cocos-creator.js +16 -4
  51. package/dist/colyseus-cocos-creator.js.map +1 -1
  52. package/dist/colyseus.d.ts +4148 -0
  53. package/dist/colyseus.js +16 -4
  54. package/dist/colyseus.js.map +1 -1
  55. package/dist/debug.js +5 -26
  56. package/dist/debug.js.map +1 -1
  57. package/package.json +3 -3
  58. package/src/debug.ts +4 -28
package/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2015-2026 Endel Dreyer
1
+ Copyright (c) 2015-2024 Endel Dreyer
2
2
 
3
3
  MIT License:
4
4
 
@@ -19,3 +19,4 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
19
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
20
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
21
  THE SOFTWARE.
22
+
package/README.md ADDED
@@ -0,0 +1,27 @@
1
+ <div align="center">
2
+ <a href="https://github.com/colyseus/colyseus">
3
+ <img src="https://github.com/colyseus/colyseus/blob/master/media/logo.svg?raw=true" width="40%" height="100" />
4
+ </a>
5
+ <br>
6
+ <br>
7
+ <a href="https://npmjs.com/package/colyseus">
8
+ <img src="https://img.shields.io/npm/dm/colyseus.svg?style=for-the-badge&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAQAAAC1+jfqAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QAAKqNIzIAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAAHdElNRQfjAgETESWYxR33AAAAtElEQVQoz4WQMQrCQBRE38Z0QoTcwF4Qg1h4BO0sxGOk80iCtViksrIQRRBTewWxMI1mbELYjYu+4rPMDPtn12ChMT3gavb4US5Jym0tcBIta3oDHv4Gwmr7nC4QAxBrCdzM2q6XqUnm9m9r59h7Rc0n2pFv24k4ttGMUXW+sGELTJjSr7QDKuqLS6UKFChVWWuFkZw9Z2AAvAirKT+JTlppIRnd6XgaP4goefI2Shj++OnjB3tBmHYK8z9zAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDE5LTAyLTAxVDE4OjE3OjM3KzAxOjAwGQQixQAAACV0RVh0ZGF0ZTptb2RpZnkAMjAxOS0wMi0wMVQxODoxNzozNyswMTowMGhZmnkAAAAZdEVYdFNvZnR3YXJlAHd3dy5pbmtzY2FwZS5vcmeb7jwaAAAAAElFTkSuQmCC">
9
+ </a>
10
+ <a href="https://discuss.colyseus.io" title="Discuss on Forum">
11
+ <img src="https://img.shields.io/badge/discuss-on%20forum-brightgreen.svg?style=for-the-badge&colorB=0069b8&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAQAAAC1+jfqAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QAAKqNIzIAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAAHdElNRQfjAgETDROxCNUzAAABB0lEQVQoz4WRvyvEARjGP193CnWRH+dHQmGwKZtFGcSmxHAL400GN95ktIpV2dzlLzDJgsGgGNRdDAzoQueS/PgY3HXHyT3T+/Y87/s89UANBKXBdoZo5J6L4K1K5ZxHfnjnlQUf3bKvkgy57a0r9hS3cXfMO1kWJMza++tj3Ac7/LY343x1NA9cNmYMwnSS/SP8JVFuSJmr44iFqvtmpjhmhBCrOOazCesq6H4P3bPBjFoIBydOk2bUA17I080Es+wSZ51B4DIA2zgjSpYcEe44Js01G0XjRcCU+y4ZMrDeLmfc9EnVd5M/o0VMeu6nJZxWJivLmhyw1WHTvrr2b4+2OFqra+ALwouTMDcqmjMAAAAldEVYdGRhdGU6Y3JlYXRlADIwMTktMDItMDFUMTg6MTM6MTkrMDE6MDAC9f6fAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDE5LTAyLTAxVDE4OjEzOjE5KzAxOjAwc6hGIwAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAAASUVORK5CYII=" alt="Discussion forum" />
12
+ </a>
13
+ <a href="https://discord.gg/RY8rRS7">
14
+ <img src="https://img.shields.io/discord/525739117951320081.svg?style=for-the-badge&colorB=7581dc&logo=discord&logoColor=white">
15
+ </a>
16
+ <h3>
17
+ Multiplayer SDK for JavaScript/TypeScript. <br /><a href="https://docs.colyseus.io/client">View documentation</a>
18
+ <h3>
19
+ </div>
20
+
21
+ **Browser support tested with:**
22
+
23
+ <a href="https://www.browserstack.com/"><img src="media/browserstack-logo.png?raw=true" width="300" /></a>
24
+
25
+ ## License
26
+
27
+ MIT
@@ -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.32
6
+ // colyseus.js@0.17.34
7
7
  'use strict';
8
8
 
9
9
  /**
@@ -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.32
6
+ // colyseus.js@0.17.34
7
7
  /**
8
8
  * Discord Embedded App SDK
9
9
  * https://github.com/colyseus/colyseus/issues/707
package/build/Auth.cjs 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.32
6
+ // colyseus.js@0.17.34
7
7
  'use strict';
8
8
 
9
9
  var tslib = require('tslib');
package/build/Auth.mjs 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.32
6
+ // colyseus.js@0.17.34
7
7
  import { getItem, removeItem, setItem } from './Storage.mjs';
8
8
  import { createNanoEvents } from './core/nanoevents.mjs';
9
9
 
package/build/Client.cjs 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.32
6
+ // colyseus.js@0.17.34
7
7
  'use strict';
8
8
 
9
9
  var tslib = require('tslib');
package/build/Client.mjs 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.32
6
+ // colyseus.js@0.17.34
7
7
  import { Protocol, CloseCode } from '@colyseus/shared-types';
8
8
  import { ServerError, MatchMakeError } from './errors/Errors.mjs';
9
9
  import { Room } from './Room.mjs';
@@ -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.32
6
+ // colyseus.js@0.17.34
7
7
  'use strict';
8
8
 
9
9
  var tslib = require('tslib');
@@ -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.32
6
+ // colyseus.js@0.17.34
7
7
  import { H3TransportTransport } from './transport/H3Transport.mjs';
8
8
  import { WebSocketTransport } from './transport/WebSocketTransport.mjs';
9
9
  import { CloseCode } from '@colyseus/shared-types';
@@ -0,0 +1,103 @@
1
+ import type { Router, HasRequiredKeys, Prettify, UnionToIntersection, Endpoint, HTTPMethod } from "@colyseus/better-call";
2
+ import { ColyseusSDK } from "./Client.ts";
3
+ /**
4
+ * TODO: we should clean up the types repetition in this file.
5
+ */
6
+ type IsAny<T> = 0 extends 1 & T ? true : false;
7
+ type IsAnyOrAnyIndexed<T> = IsAny<T> extends true ? true : (string extends keyof T ? true : (number extends keyof T ? (symbol extends keyof T ? true : false) : false));
8
+ type HasRequired<T extends {
9
+ body?: any;
10
+ query?: any;
11
+ params?: any;
12
+ }> = T["body"] extends object ? HasRequiredKeys<T["body"]> extends true ? true : T["query"] extends object ? HasRequiredKeys<T["query"]> extends true ? true : T["params"] extends object ? HasRequiredKeys<T["params"]> : false : T["params"] extends object ? HasRequiredKeys<T["params"]> : false : T["query"] extends object ? HasRequiredKeys<T["query"]> extends true ? true : T["params"] extends object ? HasRequiredKeys<T["params"]> : false : T["params"] extends object ? HasRequiredKeys<T["params"]> : false;
13
+ type InferContext<T> = T extends (ctx: infer Ctx) => any ? Ctx extends object ? Ctx : never : never;
14
+ type WithRequired<T, K extends keyof any> = Prettify<T & {
15
+ [P in K & keyof T]-?: NonNullable<T[P]>;
16
+ }>;
17
+ type WithoutServerOnly<T extends Record<string, Endpoint>> = {
18
+ [K in keyof T]: T[K] extends Endpoint<any, infer O> ? O extends {
19
+ metadata: {
20
+ SERVER_ONLY: true;
21
+ };
22
+ } ? never : T[K] : T[K];
23
+ };
24
+ type MethodOptions<API, M extends HTTPMethod> = API extends {
25
+ [key: string]: infer T;
26
+ } ? T extends Endpoint<any, infer O> ? O["method"] extends M ? {
27
+ [key in T["path"]]: T;
28
+ } : O["method"] extends M[] ? M extends O["method"][number] ? {
29
+ [key in T["path"]]: T;
30
+ } : {} : O["method"] extends "*" ? {
31
+ [key in T["path"]]: T;
32
+ } : {} : {} : {};
33
+ export type RequiredOptionKeys<C extends {
34
+ body?: any;
35
+ query?: any;
36
+ params?: any;
37
+ }> = (C["body"] extends object ? HasRequiredKeys<C["body"]> extends true ? {
38
+ body: true;
39
+ } : {} : {}) & (C["query"] extends object ? HasRequiredKeys<C["query"]> extends true ? {
40
+ query: true;
41
+ } : {} : {}) & (C["params"] extends object ? HasRequiredKeys<C["params"]> extends true ? {
42
+ params: true;
43
+ } : {} : {});
44
+ type CommonHeaders = {
45
+ accept: "application/json" | "text/plain" | "application/octet-stream";
46
+ "content-type": "application/json" | "text/plain" | "application/x-www-form-urlencoded" | "multipart/form-data" | "application/octet-stream";
47
+ authorization: "Bearer" | "Basic";
48
+ };
49
+ type FetchRequestOptions<Body = any, Query extends Record<string, any> = any, Params extends Record<string, any> | Array<string> | undefined = any, Res = any, ExtraOptions extends Record<string, any> = {}> = Prettify<ExtraOptions & Omit<RequestInit, "body"> & {
50
+ /**
51
+ * Headers
52
+ */
53
+ headers?: CommonHeaders | Headers | HeadersInit;
54
+ /**
55
+ * Body
56
+ */
57
+ body?: Body;
58
+ /**
59
+ * Query parameters (key-value pairs)
60
+ */
61
+ query?: Query;
62
+ /**
63
+ * Dynamic parameters.
64
+ *
65
+ * If url is defined as /path/:id, params will be { id: string }
66
+ */
67
+ params?: Params;
68
+ }>;
69
+ type FetchResponse<T> = {
70
+ raw: Response;
71
+ data: T;
72
+ headers: Headers;
73
+ status: number;
74
+ statusText: string;
75
+ };
76
+ export declare function isJSONSerializable(value: any): boolean;
77
+ export type ResponseType = "json" | "text" | "blob";
78
+ export declare function detectResponseType(request: Response): ResponseType;
79
+ type InferredAPI<R> = R extends {
80
+ endpoints: Record<string, Endpoint>;
81
+ } ? WithoutServerOnly<R["endpoints"]> : WithoutServerOnly<R & Record<string, Endpoint>>;
82
+ type InferReturnType<R, OPT, K extends keyof OPT> = IsAnyOrAnyIndexed<R> extends true ? any : Awaited<ReturnType<OPT[K] extends Endpoint ? OPT[K] : never>>;
83
+ export declare class HTTP<R extends Router | Router["endpoints"]> {
84
+ authToken: string | undefined;
85
+ options: FetchRequestOptions;
86
+ private sdk;
87
+ constructor(sdk: ColyseusSDK, baseOptions: FetchRequestOptions);
88
+ private request;
89
+ get<API extends InferredAPI<R> = InferredAPI<R>, OPT extends Prettify<UnionToIntersection<MethodOptions<API, "GET">>> = Prettify<UnionToIntersection<MethodOptions<API, "GET">>>, K extends keyof OPT = keyof OPT, C extends InferContext<OPT[K]> = InferContext<OPT[K]>>(path: IsAnyOrAnyIndexed<R> extends true ? string : (HasRequired<C> extends true ? K : never), options: IsAnyOrAnyIndexed<R> extends true ? FetchRequestOptions<any, any, any> : WithRequired<FetchRequestOptions<C["body"], C["query"], C["params"]>, keyof RequiredOptionKeys<C>>): Promise<FetchResponse<InferReturnType<R, OPT, K>>>;
90
+ get<API extends InferredAPI<R> = InferredAPI<R>, OPT extends Prettify<UnionToIntersection<MethodOptions<API, "GET">>> = Prettify<UnionToIntersection<MethodOptions<API, "GET">>>, K extends keyof OPT = keyof OPT, C extends InferContext<OPT[K]> = InferContext<OPT[K]>>(path: IsAnyOrAnyIndexed<R> extends true ? string : (HasRequired<C> extends false ? K : never), options?: IsAnyOrAnyIndexed<R> extends true ? FetchRequestOptions<any, any, any> : FetchRequestOptions<C["body"], C["query"], C["params"]>): Promise<FetchResponse<InferReturnType<R, OPT, K>>>;
91
+ post<API extends InferredAPI<R> = InferredAPI<R>, OPT extends Prettify<UnionToIntersection<MethodOptions<API, "POST">>> = Prettify<UnionToIntersection<MethodOptions<API, "POST">>>, K extends keyof OPT = keyof OPT, C extends InferContext<OPT[K]> = InferContext<OPT[K]>>(path: (IsAnyOrAnyIndexed<R> extends true ? string : never) | (IsAny<API> extends true ? string : never) | (HasRequired<C> extends true ? K : never), options: IsAnyOrAnyIndexed<R> extends true ? FetchRequestOptions<any, any, any> : (IsAny<API> extends true ? FetchRequestOptions<any, any, any> : WithRequired<FetchRequestOptions<C["body"], C["query"], C["params"]>, keyof RequiredOptionKeys<C>>)): Promise<FetchResponse<InferReturnType<R, OPT, K>>>;
92
+ post<API extends InferredAPI<R> = InferredAPI<R>, OPT extends Prettify<UnionToIntersection<MethodOptions<API, "POST">>> = Prettify<UnionToIntersection<MethodOptions<API, "POST">>>, K extends keyof OPT = keyof OPT, C extends InferContext<OPT[K]> = InferContext<OPT[K]>>(path: (IsAnyOrAnyIndexed<R> extends true ? string : never) | (IsAny<API> extends true ? string : never) | (HasRequired<C> extends false ? K : never), options?: IsAnyOrAnyIndexed<R> extends true ? FetchRequestOptions<any, any, any> : (IsAny<API> extends true ? FetchRequestOptions<any, any, any> : FetchRequestOptions<C["body"], C["query"], C["params"]>)): Promise<FetchResponse<InferReturnType<R, OPT, K>>>;
93
+ delete<API extends InferredAPI<R> = InferredAPI<R>, OPT extends Prettify<UnionToIntersection<MethodOptions<API, "DELETE">>> = Prettify<UnionToIntersection<MethodOptions<API, "DELETE">>>, K extends keyof OPT = keyof OPT, C extends InferContext<OPT[K]> = InferContext<OPT[K]>>(path: IsAnyOrAnyIndexed<R> extends true ? string : (HasRequired<C> extends true ? K : never), options: IsAnyOrAnyIndexed<R> extends true ? FetchRequestOptions<any, any, any> : WithRequired<FetchRequestOptions<C["body"], C["query"], C["params"]>, keyof RequiredOptionKeys<C>>): Promise<FetchResponse<InferReturnType<R, OPT, K>>>;
94
+ delete<API extends InferredAPI<R> = InferredAPI<R>, OPT extends Prettify<UnionToIntersection<MethodOptions<API, "DELETE">>> = Prettify<UnionToIntersection<MethodOptions<API, "DELETE">>>, K extends keyof OPT = keyof OPT, C extends InferContext<OPT[K]> = InferContext<OPT[K]>>(path: IsAnyOrAnyIndexed<R> extends true ? string : (HasRequired<C> extends false ? K : never), options?: IsAnyOrAnyIndexed<R> extends true ? FetchRequestOptions<any, any, any> : FetchRequestOptions<C["body"], C["query"], C["params"]>): Promise<FetchResponse<InferReturnType<R, OPT, K>>>;
95
+ del<API extends InferredAPI<R> = InferredAPI<R>, OPT extends Prettify<UnionToIntersection<MethodOptions<API, "DELETE">>> = Prettify<UnionToIntersection<MethodOptions<API, "DELETE">>>, K extends keyof OPT = keyof OPT, C extends InferContext<OPT[K]> = InferContext<OPT[K]>>(path: IsAnyOrAnyIndexed<R> extends true ? string : (HasRequired<C> extends true ? K : never), options: IsAnyOrAnyIndexed<R> extends true ? FetchRequestOptions<any, any, any> : WithRequired<FetchRequestOptions<C["body"], C["query"], C["params"]>, keyof RequiredOptionKeys<C>>): Promise<FetchResponse<InferReturnType<R, OPT, K>>>;
96
+ del<API extends InferredAPI<R> = InferredAPI<R>, OPT extends Prettify<UnionToIntersection<MethodOptions<API, "DELETE">>> = Prettify<UnionToIntersection<MethodOptions<API, "DELETE">>>, K extends keyof OPT = keyof OPT, C extends InferContext<OPT[K]> = InferContext<OPT[K]>>(path: IsAnyOrAnyIndexed<R> extends true ? string : (HasRequired<C> extends false ? K : never), options?: IsAnyOrAnyIndexed<R> extends true ? FetchRequestOptions<any, any, any> : FetchRequestOptions<C["body"], C["query"], C["params"]>): Promise<FetchResponse<InferReturnType<R, OPT, K>>>;
97
+ patch<API extends InferredAPI<R> = InferredAPI<R>, OPT extends Prettify<UnionToIntersection<MethodOptions<API, "PATCH">>> = Prettify<UnionToIntersection<MethodOptions<API, "PATCH">>>, K extends keyof OPT = keyof OPT, C extends InferContext<OPT[K]> = InferContext<OPT[K]>>(path: IsAnyOrAnyIndexed<R> extends true ? string : (HasRequired<C> extends true ? K : never), options: IsAnyOrAnyIndexed<R> extends true ? FetchRequestOptions<any, any, any> : WithRequired<FetchRequestOptions<C["body"], C["query"], C["params"]>, keyof RequiredOptionKeys<C>>): Promise<FetchResponse<InferReturnType<R, OPT, K>>>;
98
+ patch<API extends InferredAPI<R> = InferredAPI<R>, OPT extends Prettify<UnionToIntersection<MethodOptions<API, "PATCH">>> = Prettify<UnionToIntersection<MethodOptions<API, "PATCH">>>, K extends keyof OPT = keyof OPT, C extends InferContext<OPT[K]> = InferContext<OPT[K]>>(path: IsAnyOrAnyIndexed<R> extends true ? string : (HasRequired<C> extends false ? K : never), options?: IsAnyOrAnyIndexed<R> extends true ? FetchRequestOptions<any, any, any> : FetchRequestOptions<C["body"], C["query"], C["params"]>): Promise<FetchResponse<InferReturnType<R, OPT, K>>>;
99
+ put<API extends InferredAPI<R> = InferredAPI<R>, OPT extends Prettify<UnionToIntersection<MethodOptions<API, "PUT">>> = Prettify<UnionToIntersection<MethodOptions<API, "PUT">>>, K extends keyof OPT = keyof OPT, C extends InferContext<OPT[K]> = InferContext<OPT[K]>>(path: IsAnyOrAnyIndexed<R> extends true ? string : (HasRequired<C> extends true ? K : never), options: IsAnyOrAnyIndexed<R> extends true ? FetchRequestOptions<any, any, any> : WithRequired<FetchRequestOptions<C["body"], C["query"], C["params"]>, keyof RequiredOptionKeys<C>>): Promise<FetchResponse<InferReturnType<R, OPT, K>>>;
100
+ put<API extends InferredAPI<R> = InferredAPI<R>, OPT extends Prettify<UnionToIntersection<MethodOptions<API, "PUT">>> = Prettify<UnionToIntersection<MethodOptions<API, "PUT">>>, K extends keyof OPT = keyof OPT, C extends InferContext<OPT[K]> = InferContext<OPT[K]>>(path: IsAnyOrAnyIndexed<R> extends true ? string : (HasRequired<C> extends false ? K : never), options?: IsAnyOrAnyIndexed<R> extends true ? FetchRequestOptions<any, any, any> : FetchRequestOptions<C["body"], C["query"], C["params"]>): Promise<FetchResponse<InferReturnType<R, OPT, K>>>;
101
+ protected executeRequest<M extends HTTPMethod>(method: M, path: any, requestOptions?: any): Promise<any>;
102
+ }
103
+ export {};
package/build/HTTP.cjs 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.32
6
+ // colyseus.js@0.17.34
7
7
  'use strict';
8
8
 
9
9
  var tslib = require('tslib');
package/build/HTTP.mjs 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.32
6
+ // colyseus.js@0.17.34
7
7
  import { ServerError } from './errors/Errors.mjs';
8
8
 
9
9
  function isJSONSerializable(value) {
@@ -0,0 +1,18 @@
1
+ import * as httpie from "@colyseus/httpie";
2
+ import { ColyseusSDK } from "./Client.ts";
3
+ export declare class HTTP {
4
+ protected sdk: ColyseusSDK;
5
+ headers: {
6
+ [id: string]: string;
7
+ };
8
+ authToken: string | undefined;
9
+ constructor(sdk: ColyseusSDK, headers?: {
10
+ [id: string]: string;
11
+ });
12
+ get<T = any>(path: string, options?: Partial<httpie.Options>): Promise<httpie.Response<T>>;
13
+ post<T = any>(path: string, options?: Partial<httpie.Options>): Promise<httpie.Response<T>>;
14
+ del<T = any>(path: string, options?: Partial<httpie.Options>): Promise<httpie.Response<T>>;
15
+ put<T = any>(path: string, options?: Partial<httpie.Options>): Promise<httpie.Response<T>>;
16
+ protected request(method: "get" | "post" | "put" | "del", path: string, options?: Partial<httpie.Options>): Promise<httpie.Response>;
17
+ protected getOptions(options: Partial<httpie.Options>): Partial<httpie.Options>;
18
+ }
@@ -0,0 +1,34 @@
1
+ // Copyright (c) 2026 Endel Dreyer.
2
+ //
3
+ // This software is released under the MIT License.
4
+ // https://opensource.org/license/MIT
5
+ //
6
+ // colyseus.js@0.17.18
7
+ 'use strict';
8
+
9
+ // Use codes between 0~127 for lesser throughput (1 byte)
10
+ exports.Protocol = void 0;
11
+ (function (Protocol) {
12
+ // Room-related (10~19)
13
+ Protocol[Protocol["HANDSHAKE"] = 9] = "HANDSHAKE";
14
+ Protocol[Protocol["JOIN_ROOM"] = 10] = "JOIN_ROOM";
15
+ Protocol[Protocol["ERROR"] = 11] = "ERROR";
16
+ Protocol[Protocol["LEAVE_ROOM"] = 12] = "LEAVE_ROOM";
17
+ Protocol[Protocol["ROOM_DATA"] = 13] = "ROOM_DATA";
18
+ Protocol[Protocol["ROOM_STATE"] = 14] = "ROOM_STATE";
19
+ Protocol[Protocol["ROOM_STATE_PATCH"] = 15] = "ROOM_STATE_PATCH";
20
+ Protocol[Protocol["ROOM_DATA_SCHEMA"] = 16] = "ROOM_DATA_SCHEMA";
21
+ Protocol[Protocol["ROOM_DATA_BYTES"] = 17] = "ROOM_DATA_BYTES";
22
+ Protocol[Protocol["PING"] = 18] = "PING";
23
+ })(exports.Protocol || (exports.Protocol = {}));
24
+ exports.ErrorCode = void 0;
25
+ (function (ErrorCode) {
26
+ ErrorCode[ErrorCode["MATCHMAKE_NO_HANDLER"] = 520] = "MATCHMAKE_NO_HANDLER";
27
+ ErrorCode[ErrorCode["MATCHMAKE_INVALID_CRITERIA"] = 521] = "MATCHMAKE_INVALID_CRITERIA";
28
+ ErrorCode[ErrorCode["MATCHMAKE_INVALID_ROOM_ID"] = 522] = "MATCHMAKE_INVALID_ROOM_ID";
29
+ ErrorCode[ErrorCode["MATCHMAKE_UNHANDLED"] = 523] = "MATCHMAKE_UNHANDLED";
30
+ ErrorCode[ErrorCode["MATCHMAKE_EXPIRED"] = 524] = "MATCHMAKE_EXPIRED";
31
+ ErrorCode[ErrorCode["AUTH_FAILED"] = 525] = "AUTH_FAILED";
32
+ ErrorCode[ErrorCode["APPLICATION_ERROR"] = 526] = "APPLICATION_ERROR";
33
+ })(exports.ErrorCode || (exports.ErrorCode = {}));
34
+ //# sourceMappingURL=Protocol.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Protocol.cjs","sources":["../src/Protocol.ts"],"sourcesContent":["// Use codes between 0~127 for lesser throughput (1 byte)\nexport enum Protocol {\n // Room-related (10~19)\n HANDSHAKE = 9,\n JOIN_ROOM = 10,\n ERROR = 11,\n LEAVE_ROOM = 12,\n ROOM_DATA = 13,\n ROOM_STATE = 14,\n ROOM_STATE_PATCH = 15,\n ROOM_DATA_SCHEMA = 16,\n ROOM_DATA_BYTES = 17,\n PING = 18,\n}\n\nexport enum ErrorCode {\n MATCHMAKE_NO_HANDLER = 520,\n MATCHMAKE_INVALID_CRITERIA = 521,\n MATCHMAKE_INVALID_ROOM_ID = 522,\n MATCHMAKE_UNHANDLED = 523,\n MATCHMAKE_EXPIRED = 524,\n\n AUTH_FAILED = 525,\n APPLICATION_ERROR = 526,\n}\n"],"names":["Protocol","ErrorCode"],"mappings":";;;;;;;;AAAA;AACYA;AAAZ,CAAA,UAAY,QAAQ,EAAA;;AAEhB,IAAA,QAAA,CAAA,QAAA,CAAA,WAAA,CAAA,GAAA,CAAA,CAAA,GAAA,WAAa;AACb,IAAA,QAAA,CAAA,QAAA,CAAA,WAAA,CAAA,GAAA,EAAA,CAAA,GAAA,W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ACjB,IAAA,SAAA,CAAA,SAAA,CAAA,mBAAA,CAAA,GAAA,GAAA,CAAA,GAAA,mBAAuB;AAC3B,CAAC,EATWA,iBAAS,KAATA,iBAAS,GAAA,EAAA,CAAA,CAAA;;"}
@@ -0,0 +1,21 @@
1
+ export declare enum Protocol {
2
+ HANDSHAKE = 9,
3
+ JOIN_ROOM = 10,
4
+ ERROR = 11,
5
+ LEAVE_ROOM = 12,
6
+ ROOM_DATA = 13,
7
+ ROOM_STATE = 14,
8
+ ROOM_STATE_PATCH = 15,
9
+ ROOM_DATA_SCHEMA = 16,
10
+ ROOM_DATA_BYTES = 17,
11
+ PING = 18
12
+ }
13
+ export declare enum ErrorCode {
14
+ MATCHMAKE_NO_HANDLER = 520,
15
+ MATCHMAKE_INVALID_CRITERIA = 521,
16
+ MATCHMAKE_INVALID_ROOM_ID = 522,
17
+ MATCHMAKE_UNHANDLED = 523,
18
+ MATCHMAKE_EXPIRED = 524,
19
+ AUTH_FAILED = 525,
20
+ APPLICATION_ERROR = 526
21
+ }
@@ -0,0 +1,34 @@
1
+ // Copyright (c) 2026 Endel Dreyer.
2
+ //
3
+ // This software is released under the MIT License.
4
+ // https://opensource.org/license/MIT
5
+ //
6
+ // colyseus.js@0.17.18
7
+ // Use codes between 0~127 for lesser throughput (1 byte)
8
+ var Protocol;
9
+ (function (Protocol) {
10
+ // Room-related (10~19)
11
+ Protocol[Protocol["HANDSHAKE"] = 9] = "HANDSHAKE";
12
+ Protocol[Protocol["JOIN_ROOM"] = 10] = "JOIN_ROOM";
13
+ Protocol[Protocol["ERROR"] = 11] = "ERROR";
14
+ Protocol[Protocol["LEAVE_ROOM"] = 12] = "LEAVE_ROOM";
15
+ Protocol[Protocol["ROOM_DATA"] = 13] = "ROOM_DATA";
16
+ Protocol[Protocol["ROOM_STATE"] = 14] = "ROOM_STATE";
17
+ Protocol[Protocol["ROOM_STATE_PATCH"] = 15] = "ROOM_STATE_PATCH";
18
+ Protocol[Protocol["ROOM_DATA_SCHEMA"] = 16] = "ROOM_DATA_SCHEMA";
19
+ Protocol[Protocol["ROOM_DATA_BYTES"] = 17] = "ROOM_DATA_BYTES";
20
+ Protocol[Protocol["PING"] = 18] = "PING";
21
+ })(Protocol || (Protocol = {}));
22
+ var ErrorCode;
23
+ (function (ErrorCode) {
24
+ ErrorCode[ErrorCode["MATCHMAKE_NO_HANDLER"] = 520] = "MATCHMAKE_NO_HANDLER";
25
+ ErrorCode[ErrorCode["MATCHMAKE_INVALID_CRITERIA"] = 521] = "MATCHMAKE_INVALID_CRITERIA";
26
+ ErrorCode[ErrorCode["MATCHMAKE_INVALID_ROOM_ID"] = 522] = "MATCHMAKE_INVALID_ROOM_ID";
27
+ ErrorCode[ErrorCode["MATCHMAKE_UNHANDLED"] = 523] = "MATCHMAKE_UNHANDLED";
28
+ ErrorCode[ErrorCode["MATCHMAKE_EXPIRED"] = 524] = "MATCHMAKE_EXPIRED";
29
+ ErrorCode[ErrorCode["AUTH_FAILED"] = 525] = "AUTH_FAILED";
30
+ ErrorCode[ErrorCode["APPLICATION_ERROR"] = 526] = "APPLICATION_ERROR";
31
+ })(ErrorCode || (ErrorCode = {}));
32
+
33
+ export { ErrorCode, Protocol };
34
+ //# sourceMappingURL=Protocol.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Protocol.mjs","sources":["../src/Protocol.ts"],"sourcesContent":["// Use codes between 0~127 for lesser throughput (1 byte)\nexport enum Protocol {\n // Room-related (10~19)\n HANDSHAKE = 9,\n JOIN_ROOM = 10,\n ERROR = 11,\n LEAVE_ROOM = 12,\n ROOM_DATA = 13,\n ROOM_STATE = 14,\n ROOM_STATE_PATCH = 15,\n ROOM_DATA_SCHEMA = 16,\n ROOM_DATA_BYTES = 17,\n PING = 18,\n}\n\nexport enum ErrorCode {\n MATCHMAKE_NO_HANDLER = 520,\n MATCHMAKE_INVALID_CRITERIA = 521,\n MATCHMAKE_INVALID_ROOM_ID = 522,\n MATCHMAKE_UNHANDLED = 523,\n MAT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,GAAA,GAAA,CAAA,GAAA,2BAA+B;AAC/B,IAAA,SAAA,CAAA,SAAA,CAAA,qBAAA,CAAA,GAAA,GAAA,CAAA,GAAA,qBAAyB;AACzB,IAAA,SAAA,CAAA,SAAA,CAAA,mBAAA,CAAA,GAAA,GAAA,CAAA,GAAA,mBAAuB;AAEvB,IAAA,SAAA,CAAA,SAAA,CAAA,aAAA,CAAA,GAAA,GAAA,CAAA,GAAA,aAAiB;AACjB,IAAA,SAAA,CAAA,SAAA,CAAA,mBAAA,CAAA,GAAA,GAAA,CAAA,GAAA,mBAAuB;AAC3B,CAAC,EATW,SAAS,KAAT,SAAS,GAAA,EAAA,CAAA,CAAA;;;;"}
package/build/Room.cjs 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.32
6
+ // colyseus.js@0.17.34
7
7
  'use strict';
8
8
 
9
9
  var tslib = require('tslib');
package/build/Room.mjs 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.32
6
+ // colyseus.js@0.17.34
7
7
  import { CloseCode, Protocol } from '@colyseus/shared-types';
8
8
  import { Decoder, encode, decode } from '@colyseus/schema';
9
9
  import { Packr, unpack } from '@colyseus/msgpackr';
package/build/Storage.cjs 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.32
6
+ // colyseus.js@0.17.34
7
7
  'use strict';
8
8
 
9
9
  var tslib = require('tslib');
package/build/Storage.mjs 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.32
6
+ // colyseus.js@0.17.34
7
7
  /// <reference path="../typings/cocos-creator.d.ts" />
8
8
  /**
9
9
  * We do not assign 'storage' to window.localStorage immediatelly for React
@@ -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.32
6
+ // colyseus.js@0.17.34
7
7
  'use strict';
8
8
 
9
9
  /**
@@ -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.32
6
+ // colyseus.js@0.17.34
7
7
  /**
8
8
  * The MIT License (MIT)
9
9
  *
@@ -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.32
6
+ // colyseus.js@0.17.34
7
7
  'use strict';
8
8
 
9
9
  class EventEmitter {
@@ -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.32
6
+ // colyseus.js@0.17.34
7
7
  class EventEmitter {
8
8
  handlers = [];
9
9
  register(cb, once = false) {
@@ -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.32
6
+ // colyseus.js@0.17.34
7
7
  'use strict';
8
8
 
9
9
  function now() {
@@ -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.32
6
+ // colyseus.js@0.17.34
7
7
  function now() {
8
8
  return typeof (performance) !== 'undefined' ? performance.now() : Date.now();
9
9
  }
package/build/debug.cjs 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.32
6
+ // colyseus.js@0.17.34
7
7
  'use strict';
8
8
 
9
9
  var Client = require('./Client.cjs');
@@ -2534,33 +2534,12 @@ function applyMonkeyPatches() {
2534
2534
  });
2535
2535
  return room;
2536
2536
  }
2537
- // Store original methods that return rooms
2538
- var originalJoinOrCreate = Client.Client.prototype.joinOrCreate;
2539
- var originalJoin = Client.Client.prototype.join;
2540
- var originalCreate = Client.Client.prototype.create;
2541
- var originalReconnect = Client.Client.prototype.reconnect;
2542
- // Patch joinOrCreate
2543
- Client.Client.prototype.joinOrCreate = function () {
2544
- var promise = originalJoinOrCreate.apply(this, arguments);
2537
+ // Patch consumeSeatReservation to intercept all room connections
2538
+ var originalConsumeSeatReservation = Client.Client.prototype.consumeSeatReservation;
2539
+ Client.Client.prototype.consumeSeatReservation = function () {
2540
+ var promise = originalConsumeSeatReservation.apply(this, arguments);
2545
2541
  return promise.then((room) => patchRoom(room));
2546
2542
  };
2547
- // Patch join
2548
- Client.Client.prototype.join = function () {
2549
- var promise = originalJoin.apply(this, arguments);
2550
- return promise.then((room) => patchRoom(room));
2551
- };
2552
- // Patch create
2553
- Client.Client.prototype.create = function () {
2554
- var promise = originalCreate.apply(this, arguments);
2555
- return promise.then((room) => patchRoom(room));
2556
- };
2557
- // Patch reconnect
2558
- if (originalReconnect) {
2559
- Client.Client.prototype.reconnect = function () {
2560
- var promise = originalReconnect.apply(this, arguments);
2561
- return promise.then((room) => patchRoom(room));
2562
- };
2563
- }
2564
2543
  }
2565
2544
  applyMonkeyPatches();
2566
2545
  // Initialize only after DOM is ready