@colyseus/core 0.18.0 → 0.18.1
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/MatchMaker.cjs +3 -7
- package/build/MatchMaker.cjs.map +2 -2
- package/build/MatchMaker.mjs +4 -8
- package/build/MatchMaker.mjs.map +2 -2
- package/build/Protocol.cjs +3 -3
- package/build/Protocol.cjs.map +1 -1
- package/build/Protocol.d.ts +3 -3
- package/build/Protocol.mjs +3 -3
- package/build/Protocol.mjs.map +1 -1
- package/build/Rewind.cjs +385 -0
- package/build/Rewind.cjs.map +7 -0
- package/build/Rewind.d.ts +291 -0
- package/build/Rewind.mjs +359 -0
- package/build/Rewind.mjs.map +7 -0
- package/build/Room.cjs +280 -281
- package/build/Room.cjs.map +3 -3
- package/build/Room.d.ts +185 -81
- package/build/Room.mjs +286 -286
- package/build/Room.mjs.map +2 -2
- package/build/RoomMessages.cjs +265 -0
- package/build/RoomMessages.cjs.map +7 -0
- package/build/RoomMessages.d.ts +49 -0
- package/build/RoomMessages.mjs +240 -0
- package/build/RoomMessages.mjs.map +7 -0
- package/build/Server.cjs +88 -31
- package/build/Server.cjs.map +2 -2
- package/build/Server.d.ts +36 -0
- package/build/Server.mjs +88 -31
- package/build/Server.mjs.map +2 -2
- package/build/Transport.cjs +26 -0
- package/build/Transport.cjs.map +2 -2
- package/build/Transport.d.ts +69 -2
- package/build/Transport.mjs +25 -0
- package/build/Transport.mjs.map +2 -2
- package/build/errors/RoomExceptions.cjs +7 -4
- package/build/errors/RoomExceptions.cjs.map +2 -2
- package/build/errors/RoomExceptions.d.ts +15 -3
- package/build/errors/RoomExceptions.mjs +5 -3
- package/build/errors/RoomExceptions.mjs.map +2 -2
- package/build/index.cjs +19 -2
- package/build/index.cjs.map +2 -2
- package/build/index.d.ts +7 -4
- package/build/index.mjs +17 -4
- package/build/index.mjs.map +2 -2
- package/build/input/InputBuffer.cjs +439 -16
- package/build/input/InputBuffer.cjs.map +2 -2
- package/build/input/InputBuffer.d.ts +186 -96
- package/build/input/InputBuffer.mjs +436 -15
- package/build/input/InputBuffer.mjs.map +2 -2
- package/build/input/RoomInput.cjs +306 -0
- package/build/input/RoomInput.cjs.map +7 -0
- package/build/input/RoomInput.d.ts +91 -0
- package/build/input/RoomInput.mjs +287 -0
- package/build/input/RoomInput.mjs.map +7 -0
- package/build/input/types.cjs +18 -0
- package/build/input/types.cjs.map +7 -0
- package/build/input/types.d.ts +476 -0
- package/build/input/types.mjs +0 -0
- package/build/input/types.mjs.map +7 -0
- package/build/rooms/QueueRoom.cjs +1 -1
- package/build/rooms/QueueRoom.cjs.map +2 -2
- package/build/rooms/QueueRoom.mjs +1 -1
- package/build/rooms/QueueRoom.mjs.map +2 -2
- package/build/router/default_routes.cjs +4 -1
- package/build/router/default_routes.cjs.map +2 -2
- package/build/router/default_routes.mjs +4 -1
- package/build/router/default_routes.mjs.map +2 -2
- package/build/router/index.cjs +6 -1
- package/build/router/index.cjs.map +2 -2
- package/build/router/index.mjs +6 -1
- package/build/router/index.mjs.map +2 -2
- package/build/router/node.cjs +37 -2
- package/build/router/node.cjs.map +2 -2
- package/build/router/node.d.ts +10 -0
- package/build/router/node.mjs +35 -1
- package/build/router/node.mjs.map +2 -2
- package/build/serializer/NoneSerializer.cjs +2 -2
- package/build/serializer/NoneSerializer.cjs.map +2 -2
- package/build/serializer/NoneSerializer.d.ts +3 -3
- package/build/serializer/NoneSerializer.mjs +2 -2
- package/build/serializer/NoneSerializer.mjs.map +2 -2
- package/build/serializer/SchemaSerializer.cjs +44 -14
- package/build/serializer/SchemaSerializer.cjs.map +2 -2
- package/build/serializer/SchemaSerializer.d.ts +3 -3
- package/build/serializer/SchemaSerializer.mjs +46 -16
- package/build/serializer/SchemaSerializer.mjs.map +2 -2
- package/build/serializer/Serializer.cjs.map +1 -1
- package/build/serializer/Serializer.d.ts +12 -2
- package/build/utils/DevMode.cjs +14 -14
- package/build/utils/DevMode.cjs.map +2 -2
- package/build/utils/DevMode.d.ts +0 -2
- package/build/utils/DevMode.mjs +14 -12
- package/build/utils/DevMode.mjs.map +2 -2
- package/build/utils/Env.cjs +8 -4
- package/build/utils/Env.cjs.map +3 -3
- package/build/utils/Env.mjs +8 -4
- package/build/utils/Env.mjs.map +2 -2
- package/build/utils/Utils.cjs +3 -0
- package/build/utils/Utils.cjs.map +2 -2
- package/build/utils/Utils.d.ts +8 -0
- package/build/utils/Utils.mjs +2 -0
- package/build/utils/Utils.mjs.map +2 -2
- package/package.json +11 -11
- package/src/MatchMaker.ts +7 -9
- package/src/Protocol.ts +3 -3
- package/src/Rewind.ts +572 -0
- package/src/Room.ts +409 -448
- package/src/RoomMessages.ts +342 -0
- package/src/Server.ts +112 -38
- package/src/Transport.ts +97 -2
- package/src/errors/RoomExceptions.ts +18 -4
- package/src/index.ts +13 -2
- package/src/input/InputBuffer.ts +464 -107
- package/src/input/RoomInput.ts +337 -0
- package/src/input/types.ts +503 -0
- package/src/rooms/QueueRoom.ts +1 -1
- package/src/router/default_routes.ts +6 -1
- package/src/router/index.ts +6 -1
- package/src/router/node.ts +44 -0
- package/src/serializer/NoneSerializer.ts +3 -3
- package/src/serializer/SchemaSerializer.ts +110 -19
- package/src/serializer/Serializer.ts +13 -2
- package/src/utils/DevMode.ts +18 -13
- package/src/utils/Env.ts +12 -4
- package/src/utils/Utils.ts +9 -0
|
@@ -9,7 +9,8 @@ export type RoomMethodName = 'onCreate'
|
|
|
9
9
|
| 'onReconnect'
|
|
10
10
|
| 'onDispose'
|
|
11
11
|
| 'onMessage'
|
|
12
|
-
| '
|
|
12
|
+
| 'setTimestep'
|
|
13
|
+
| 'setFixedTimestep'
|
|
13
14
|
| 'setInterval'
|
|
14
15
|
| 'setTimeout';
|
|
15
16
|
|
|
@@ -22,7 +23,7 @@ export type RoomException<R extends Room = Room> =
|
|
|
22
23
|
OnReconnectException<R> |
|
|
23
24
|
OnDisposeException |
|
|
24
25
|
OnMessageException<R> |
|
|
25
|
-
|
|
26
|
+
TimestepException |
|
|
26
27
|
TimedEventException;
|
|
27
28
|
|
|
28
29
|
export class OnCreateException<R extends Room = Room> extends Error {
|
|
@@ -151,16 +152,29 @@ export class OnMessageException<R extends Room, MessageType extends keyof R['mes
|
|
|
151
152
|
}
|
|
152
153
|
}
|
|
153
154
|
|
|
154
|
-
|
|
155
|
+
/** Thrown when a {@link Room.setTimestep} or {@link Room.setFixedTimestep} tick
|
|
156
|
+
* callback throws (or rejects). Reported to `onUncaughtException` with the
|
|
157
|
+
* originating method as `methodName` (`'setTimestep'` / `'setFixedTimestep'`). */
|
|
158
|
+
export class TimestepException extends Error {
|
|
155
159
|
constructor(
|
|
156
160
|
cause: Error,
|
|
157
161
|
message: string,
|
|
158
162
|
) {
|
|
159
163
|
super(message, { cause });
|
|
160
|
-
this.name = '
|
|
164
|
+
this.name = 'TimestepException';
|
|
161
165
|
}
|
|
162
166
|
}
|
|
163
167
|
|
|
168
|
+
/**
|
|
169
|
+
* @deprecated Renamed to {@link TimestepException} (it now covers both
|
|
170
|
+
* `setTimestep` and `setFixedTimestep`). Kept as an alias for backwards
|
|
171
|
+
* compatibility — `instanceof` checks against either name still match.
|
|
172
|
+
*
|
|
173
|
+
* TODO: remove this on 1.0
|
|
174
|
+
*/
|
|
175
|
+
export const SimulationIntervalException = TimestepException;
|
|
176
|
+
export type SimulationIntervalException = TimestepException;
|
|
177
|
+
|
|
164
178
|
export class TimedEventException extends Error {
|
|
165
179
|
public args: any[];
|
|
166
180
|
constructor(
|
package/src/index.ts
CHANGED
|
@@ -3,16 +3,26 @@ import { ClockTimer as Clock, Delayed } from '@colyseus/timer';
|
|
|
3
3
|
// Shared types - re-export from @colyseus/shared-types for convenience
|
|
4
4
|
export {
|
|
5
5
|
Protocol,
|
|
6
|
+
ProtocolModifier,
|
|
6
7
|
ErrorCode,
|
|
7
8
|
CloseCode,
|
|
9
|
+
ResponseStatus,
|
|
8
10
|
type InferState,
|
|
9
11
|
type ExtractRoomMessages,
|
|
10
12
|
type ExtractRoomClientMessages,
|
|
13
|
+
type MessageContext,
|
|
14
|
+
type Rejection,
|
|
15
|
+
type Resolution,
|
|
16
|
+
type ExtractRejectReason,
|
|
17
|
+
type ExtractResponseType,
|
|
11
18
|
} from '@colyseus/shared-types';
|
|
12
19
|
|
|
13
20
|
// Core classes
|
|
14
21
|
export { Server, defineRoom, defineServer, registerRoomDefinitions, unregisterRoomDefinitions, type RoomDefinitions, type ServerOptions, type SDKTypes } from './Server.ts';
|
|
15
|
-
export { Room,
|
|
22
|
+
export { Room, RoomInternalState, validate, type RoomOptions, type DefineInputOptions, type SimulationCallback, type FixedTimestepCallback, type StepContext, type MessageHandlerWithFormat, type Messages, type ExtractRoomState, type ExtractRoomMetadata, type ExtractRoomClient } from './Room.ts';
|
|
23
|
+
export { InputBufferImpl, compileSanitizer } from './input/InputBuffer.ts';
|
|
24
|
+
export { type InputAccessor, type InputAPI, type NormalizedInputOptions, type ConsumeOptions, type IdleInput, type IdleContext, type SanitizeInput, type NumericFieldsOf } from './input/types.ts';
|
|
25
|
+
export { Rewind, RewindView, type RewindOptions, type RewindMode } from './Rewind.ts';
|
|
16
26
|
export {
|
|
17
27
|
RoomPlugin, definePlugins, attachToTestRoom,
|
|
18
28
|
type RoomPluginOrder, type PluginDependencies, type RoomPluginClass,
|
|
@@ -30,6 +40,7 @@ export {
|
|
|
30
40
|
OnLeaveException,
|
|
31
41
|
OnDisposeException,
|
|
32
42
|
OnMessageException,
|
|
43
|
+
TimestepException,
|
|
33
44
|
SimulationIntervalException,
|
|
34
45
|
TimedEventException,
|
|
35
46
|
} from './errors/RoomExceptions.ts';
|
|
@@ -45,7 +56,7 @@ export * from './matchmaker/LocalDriver/LocalDriver.ts';
|
|
|
45
56
|
export { initializeRoomCache } from './matchmaker/driver.ts';
|
|
46
57
|
|
|
47
58
|
// Transport
|
|
48
|
-
export { type Client, type ClientPrivate, type AuthContext, ClientState, ClientArray, Transport, type ISendOptions, connectClientToRoom } from './Transport.ts';
|
|
59
|
+
export { type Client, type ClientPrivate, type AuthContext, ClientState, ClientArray, Transport, type ISendOptions, connectClientToRoom, enqueueClientRaw } from './Transport.ts';
|
|
49
60
|
|
|
50
61
|
// Presence
|
|
51
62
|
export { type Presence } from './presence/Presence.ts';
|