@colyseus/sdk 0.17.34 → 0.17.36
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/LICENSE +1 -2
- package/build/3rd_party/discord.cjs +1 -1
- package/build/3rd_party/discord.mjs +1 -1
- package/build/Auth.cjs +1 -1
- package/build/Auth.mjs +1 -1
- package/build/Client.cjs +1 -1
- package/build/Client.mjs +1 -1
- package/build/Connection.cjs +1 -1
- package/build/Connection.mjs +1 -1
- package/build/HTTP.cjs +1 -1
- package/build/HTTP.mjs +1 -1
- package/build/Room.cjs +8 -3
- package/build/Room.cjs.map +1 -1
- package/build/Room.d.ts +6 -0
- package/build/Room.mjs +8 -3
- 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.mjs +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.mjs +1 -1
- package/build/debug.cjs +12 -11
- package/build/debug.cjs.map +1 -1
- package/build/debug.mjs +12 -11
- package/build/debug.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.mjs +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 +1 -1
- package/build/transport/WebSocketTransport.mjs +1 -1
- package/dist/colyseus-cocos-creator.js +8 -3
- package/dist/colyseus-cocos-creator.js.map +1 -1
- package/dist/colyseus.js +8 -3
- package/dist/colyseus.js.map +1 -1
- package/dist/debug.js +12 -11
- package/dist/debug.js.map +1 -1
- package/package.json +2 -2
- package/src/Room.ts +15 -2
- package/src/debug.ts +11 -10
- package/README.md +0 -27
- package/build/HTTP.bkp.d.ts +0 -103
- package/build/HTTP_bkp.d.ts +0 -18
- package/build/Protocol.cjs +0 -34
- package/build/Protocol.cjs.map +0 -1
- package/build/Protocol.d.ts +0 -21
- package/build/Protocol.mjs +0 -34
- package/build/Protocol.mjs.map +0 -1
- package/dist/colyseus.d.ts +0 -4148
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@colyseus/sdk",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.36",
|
|
4
4
|
"description": "Colyseus Multiplayer SDK for JavaScript/TypeScript",
|
|
5
5
|
"author": "Endel Dreyer",
|
|
6
6
|
"license": "MIT",
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"typescript": "^5.9.3",
|
|
83
83
|
"vite": "^5.0.11",
|
|
84
84
|
"vitest": "^2.1.1",
|
|
85
|
-
"@colyseus/core": "^0.17.
|
|
85
|
+
"@colyseus/core": "^0.17.39"
|
|
86
86
|
},
|
|
87
87
|
"peerDependencies": {
|
|
88
88
|
"@colyseus/core": "0.17.x"
|
package/src/Room.ts
CHANGED
|
@@ -29,6 +29,13 @@ export interface RoomAvailable<Metadata = any> {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
export interface ReconnectionOptions {
|
|
32
|
+
/**
|
|
33
|
+
* Whether automatic reconnection is enabled.
|
|
34
|
+
* Set to `false` to disable automatic reconnection entirely.
|
|
35
|
+
* @default true
|
|
36
|
+
*/
|
|
37
|
+
enabled: boolean;
|
|
38
|
+
|
|
32
39
|
/**
|
|
33
40
|
* The maximum number of reconnection attempts.
|
|
34
41
|
*/
|
|
@@ -110,6 +117,7 @@ export class Room<
|
|
|
110
117
|
|
|
111
118
|
// reconnection logic
|
|
112
119
|
public reconnection: ReconnectionOptions = {
|
|
120
|
+
enabled: true,
|
|
113
121
|
retryCount: 0,
|
|
114
122
|
maxRetries: 15,
|
|
115
123
|
delay: 100,
|
|
@@ -171,7 +179,7 @@ export class Room<
|
|
|
171
179
|
e.code === CloseCode.MAY_TRY_RECONNECT
|
|
172
180
|
) {
|
|
173
181
|
this.onDrop.invoke(e.code, e.reason);
|
|
174
|
-
this.handleReconnection();
|
|
182
|
+
this.handleReconnection(e.code, e.reason);
|
|
175
183
|
|
|
176
184
|
} else {
|
|
177
185
|
this.onLeave.invoke(e.code, e.reason);
|
|
@@ -471,7 +479,12 @@ export class Room<
|
|
|
471
479
|
}
|
|
472
480
|
}
|
|
473
481
|
|
|
474
|
-
private handleReconnection() {
|
|
482
|
+
private handleReconnection(code: number, reason?: string) {
|
|
483
|
+
if (!this.reconnection.enabled) {
|
|
484
|
+
this.onLeave.invoke(code, reason);
|
|
485
|
+
return;
|
|
486
|
+
}
|
|
487
|
+
|
|
475
488
|
if (Date.now() - this.joinedAtTime < this.reconnection.minUptime) {
|
|
476
489
|
console.info(`[Colyseus reconnection]: ${String.fromCodePoint(0x274C)} Room has not been up for long enough for automatic reconnection. (min uptime: ${this.reconnection.minUptime}ms)`); // ❌
|
|
477
490
|
this.onLeave.invoke(CloseCode.ABNORMAL_CLOSURE, "Room uptime too short for reconnection.");
|
package/src/debug.ts
CHANGED
|
@@ -40,7 +40,7 @@ const preferences = {
|
|
|
40
40
|
}
|
|
41
41
|
};
|
|
42
42
|
|
|
43
|
-
// Load preferences from localStorage
|
|
43
|
+
// Load preferences from localStorage (hidden state from sessionStorage)
|
|
44
44
|
function loadPreferences() {
|
|
45
45
|
try {
|
|
46
46
|
const savedPrefs = localStorage.getItem('colyseus-debug-preferences') || '{}';
|
|
@@ -60,25 +60,25 @@ function loadPreferences() {
|
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
// Load hidden state
|
|
64
|
-
if (
|
|
63
|
+
// Load hidden state from sessionStorage
|
|
64
|
+
if (sessionStorage.getItem('colyseus-debug-hidden') === 'true') {
|
|
65
65
|
panelsHidden = true;
|
|
66
66
|
}
|
|
67
67
|
} catch (e) {
|
|
68
|
-
//
|
|
68
|
+
// Storage might not be available or JSON parse failed, ignore
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
// Save preferences to localStorage
|
|
72
|
+
// Save preferences to localStorage (hidden state to sessionStorage)
|
|
73
73
|
function savePreferences() {
|
|
74
74
|
try {
|
|
75
75
|
localStorage.setItem('colyseus-debug-preferences', JSON.stringify({
|
|
76
76
|
position: preferences.panelPosition.position,
|
|
77
77
|
latency: preferences.latencySimulation.delay,
|
|
78
|
-
hidden: panelsHidden
|
|
79
78
|
}));
|
|
79
|
+
sessionStorage.setItem('colyseus-debug-hidden', panelsHidden ? 'true' : 'false');
|
|
80
80
|
} catch (e) {
|
|
81
|
-
//
|
|
81
|
+
// Storage might not be available, ignore
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
|
|
@@ -2644,10 +2644,11 @@ function applyMonkeyPatches() {
|
|
|
2644
2644
|
const roomId = room.roomId;
|
|
2645
2645
|
const sessionId = room.sessionId;
|
|
2646
2646
|
|
|
2647
|
-
// Generate unique panel ID: use
|
|
2648
|
-
|
|
2647
|
+
// Generate unique panel ID: use roomId + sessionId to avoid collisions
|
|
2648
|
+
// when the same sessionId is reused across rooms (e.g. QueueRoom handoff)
|
|
2649
|
+
const uniquePanelId = roomId + '_' + (sessionId && sessionId !== 'N/A' && sessionId !== ''
|
|
2649
2650
|
? sessionId
|
|
2650
|
-
:
|
|
2651
|
+
: Date.now() + '-' + Math.random().toString(36).substring(2, 9));
|
|
2651
2652
|
|
|
2652
2653
|
const transport = room.connection?.transport as WebSocketTransport;
|
|
2653
2654
|
const endpoint = transport.ws?.url || 'N/A';
|
package/README.md
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
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
|
package/build/HTTP.bkp.d.ts
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
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_bkp.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
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
|
-
}
|
package/build/Protocol.cjs
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
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
|
package/build/Protocol.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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,WAAc;AACd,IAAA,QAAA,CAAA,QAAA,CAAA,OAAA,CAAA,GAAA,EAAA,CAAA,GAAA,OAAU;AACV,IAAA,QAAA,CAAA,QAAA,CAAA,YAAA,CAAA,GAAA,EAAA,CAAA,GAAA,YAAe;AACf,IAAA,QAAA,CAAA,QAAA,CAAA,WAAA,CAAA,GAAA,EAAA,CAAA,GAAA,WAAc;AACd,IAAA,QAAA,CAAA,QAAA,CAAA,YAAA,CAAA,GAAA,EAAA,CAAA,GAAA,YAAe;AACf,IAAA,QAAA,CAAA,QAAA,CAAA,kBAAA,CAAA,GAAA,EAAA,CAAA,GAAA,kBAAqB;AACrB,IAAA,QAAA,CAAA,QAAA,CAAA,kBAAA,CAAA,GAAA,EAAA,CAAA,GAAA,kBAAqB;AACrB,IAAA,QAAA,CAAA,QAAA,CAAA,iBAAA,CAAA,GAAA,EAAA,CAAA,GAAA,iBAAoB;AACpB,IAAA,QAAA,CAAA,QAAA,CAAA,MAAA,CAAA,GAAA,EAAA,CAAA,GAAA,MAAS;AACb,CAAC,EAZWA,gBAAQ,KAARA,gBAAQ,GAAA,EAAA,CAAA,CAAA;AAcRC;AAAZ,CAAA,UAAY,SAAS,EAAA;AACjB,IAAA,SAAA,CAAA,SAAA,CAAA,sBAAA,CAAA,GAAA,GAAA,CAAA,GAAA,sBAA0B;AAC1B,IAAA,SAAA,CAAA,SAAA,CAAA,4BAAA,CAAA,GAAA,GAAA,CAAA,GAAA,4BAAgC;AAChC,IAAA,SAAA,CAAA,SAAA,CAAA,2BAAA,CAAA,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,EATWA,iBAAS,KAATA,iBAAS,GAAA,EAAA,CAAA,CAAA;;"}
|
package/build/Protocol.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
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
|
-
}
|
package/build/Protocol.mjs
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
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
|
package/build/Protocol.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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 MATCHMAKE_EXPIRED = 524,\n\n AUTH_FAILED = 525,\n APPLICATION_ERROR = 526,\n}\n"],"names":[],"mappings":";;;;;;AAAA;IACY;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,WAAc;AACd,IAAA,QAAA,CAAA,QAAA,CAAA,OAAA,CAAA,GAAA,EAAA,CAAA,GAAA,OAAU;AACV,IAAA,QAAA,CAAA,QAAA,CAAA,YAAA,CAAA,GAAA,EAAA,CAAA,GAAA,YAAe;AACf,IAAA,QAAA,CAAA,QAAA,CAAA,WAAA,CAAA,GAAA,EAAA,CAAA,GAAA,WAAc;AACd,IAAA,QAAA,CAAA,QAAA,CAAA,YAAA,CAAA,GAAA,EAAA,CAAA,GAAA,YAAe;AACf,IAAA,QAAA,CAAA,QAAA,CAAA,kBAAA,CAAA,GAAA,EAAA,CAAA,GAAA,kBAAqB;AACrB,IAAA,QAAA,CAAA,QAAA,CAAA,kBAAA,CAAA,GAAA,EAAA,CAAA,GAAA,kBAAqB;AACrB,IAAA,QAAA,CAAA,QAAA,CAAA,iBAAA,CAAA,GAAA,EAAA,CAAA,GAAA,iBAAoB;AACpB,IAAA,QAAA,CAAA,QAAA,CAAA,MAAA,CAAA,GAAA,EAAA,CAAA,GAAA,MAAS;AACb,CAAC,EAZW,QAAQ,KAAR,QAAQ,GAAA,EAAA,CAAA,CAAA;IAcR;AAAZ,CAAA,UAAY,SAAS,EAAA;AACjB,IAAA,SAAA,CAAA,SAAA,CAAA,sBAAA,CAAA,GAAA,GAAA,CAAA,GAAA,sBAA0B;AAC1B,IAAA,SAAA,CAAA,SAAA,CAAA,4BAAA,CAAA,GAAA,GAAA,CAAA,GAAA,4BAAgC;AAChC,IAAA,SAAA,CAAA,SAAA,CAAA,2BAAA,CAAA,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;;;;"}
|