@colyseus/sdk 0.17.21 → 0.17.23
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 -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.cjs.map +1 -1
- package/build/HTTP.d.ts +11 -10
- package/build/HTTP.mjs +1 -1
- package/build/HTTP.mjs.map +1 -1
- package/build/Room.cjs +1 -1
- package/build/Room.mjs +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 +1 -1
- package/build/debug.mjs +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 +1 -1
- package/dist/colyseus-cocos-creator.js.map +1 -1
- package/dist/colyseus.js +1 -1
- package/dist/colyseus.js.map +1 -1
- package/dist/debug.js +1 -1
- package/dist/debug.js.map +1 -1
- package/package.json +4 -4
- package/src/HTTP.ts +16 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@colyseus/sdk",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.23",
|
|
4
4
|
"description": "Colyseus Multiplayer SDK for JavaScript/TypeScript",
|
|
5
5
|
"author": "Endel Dreyer",
|
|
6
6
|
"license": "MIT",
|
|
@@ -55,8 +55,8 @@
|
|
|
55
55
|
"@colyseus/schema": "^4.0.4",
|
|
56
56
|
"tslib": "^2.1.0",
|
|
57
57
|
"ws": "^8.13.0",
|
|
58
|
-
"@colyseus/shared-types": "^0.17.
|
|
59
|
-
"@colyseus/better-call": "^1.2.
|
|
58
|
+
"@colyseus/shared-types": "^0.17.4",
|
|
59
|
+
"@colyseus/better-call": "^1.2.1"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@rollup/plugin-alias": "^5.1.1",
|
|
@@ -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.22"
|
|
86
86
|
},
|
|
87
87
|
"peerDependencies": {
|
|
88
88
|
"@colyseus/core": "0.17.x"
|
package/src/HTTP.ts
CHANGED
|
@@ -243,6 +243,12 @@ type InferredAPI<R> = R extends { endpoints: Record<string, Endpoint> }
|
|
|
243
243
|
? WithoutServerOnly<R["endpoints"]>
|
|
244
244
|
: WithoutServerOnly<R & Record<string, Endpoint>>;
|
|
245
245
|
|
|
246
|
+
// Helper type to resolve return type, returning 'any' when R is untyped
|
|
247
|
+
type InferReturnType<R, OPT, K extends keyof OPT> =
|
|
248
|
+
IsAnyOrAnyIndexed<R> extends true
|
|
249
|
+
? any
|
|
250
|
+
: Awaited<ReturnType<OPT[K] extends Endpoint ? OPT[K] : never>>;
|
|
251
|
+
|
|
246
252
|
export class HTTP<R extends Router | Router["endpoints"]> {
|
|
247
253
|
public authToken: string | undefined;
|
|
248
254
|
public options: FetchRequestOptions;
|
|
@@ -282,7 +288,7 @@ export class HTTP<R extends Router | Router["endpoints"]> {
|
|
|
282
288
|
? FetchRequestOptions<any, any, any>
|
|
283
289
|
: WithRequired<FetchRequestOptions<C["body"], C["query"], C["params"]>, keyof RequiredOptionKeys<C>>
|
|
284
290
|
): Promise<
|
|
285
|
-
FetchResponse<
|
|
291
|
+
FetchResponse<InferReturnType<R, OPT, K>>
|
|
286
292
|
>;
|
|
287
293
|
|
|
288
294
|
// Overload for endpoints WITHOUT required fields (permissive when R is 'any')
|
|
@@ -297,7 +303,7 @@ export class HTTP<R extends Router | Router["endpoints"]> {
|
|
|
297
303
|
? FetchRequestOptions<any, any, any>
|
|
298
304
|
: FetchRequestOptions<C["body"], C["query"], C["params"]>
|
|
299
305
|
): Promise<
|
|
300
|
-
FetchResponse<
|
|
306
|
+
FetchResponse<InferReturnType<R, OPT, K>>
|
|
301
307
|
>;
|
|
302
308
|
|
|
303
309
|
get(path: any, options?: any): Promise<any> {
|
|
@@ -316,7 +322,7 @@ export class HTTP<R extends Router | Router["endpoints"]> {
|
|
|
316
322
|
? FetchRequestOptions<any, any, any>
|
|
317
323
|
: WithRequired<FetchRequestOptions<C["body"], C["query"], C["params"]>, keyof RequiredOptionKeys<C>>)
|
|
318
324
|
): Promise<
|
|
319
|
-
FetchResponse<
|
|
325
|
+
FetchResponse<InferReturnType<R, OPT, K>>
|
|
320
326
|
>;
|
|
321
327
|
|
|
322
328
|
// Overload for endpoints WITHOUT required fields (permissive when R is 'any')
|
|
@@ -331,7 +337,7 @@ export class HTTP<R extends Router | Router["endpoints"]> {
|
|
|
331
337
|
? FetchRequestOptions<any, any, any>
|
|
332
338
|
: FetchRequestOptions<C["body"], C["query"], C["params"]>)
|
|
333
339
|
): Promise<
|
|
334
|
-
FetchResponse<
|
|
340
|
+
FetchResponse<InferReturnType<R, OPT, K>>
|
|
335
341
|
>;
|
|
336
342
|
|
|
337
343
|
post(path: any, options?: any): Promise<any> {
|
|
@@ -350,7 +356,7 @@ export class HTTP<R extends Router | Router["endpoints"]> {
|
|
|
350
356
|
? FetchRequestOptions<any, any, any>
|
|
351
357
|
: WithRequired<FetchRequestOptions<C["body"], C["query"], C["params"]>, keyof RequiredOptionKeys<C>>
|
|
352
358
|
): Promise<
|
|
353
|
-
FetchResponse<
|
|
359
|
+
FetchResponse<InferReturnType<R, OPT, K>>
|
|
354
360
|
>;
|
|
355
361
|
|
|
356
362
|
// Overload for endpoints WITHOUT required fields (permissive when R is 'any')
|
|
@@ -365,7 +371,7 @@ export class HTTP<R extends Router | Router["endpoints"]> {
|
|
|
365
371
|
? FetchRequestOptions<any, any, any>
|
|
366
372
|
: FetchRequestOptions<C["body"], C["query"], C["params"]>
|
|
367
373
|
): Promise<
|
|
368
|
-
FetchResponse<
|
|
374
|
+
FetchResponse<InferReturnType<R, OPT, K>>
|
|
369
375
|
>;
|
|
370
376
|
|
|
371
377
|
delete(path: any, options?: any): Promise<any> {
|
|
@@ -384,7 +390,7 @@ export class HTTP<R extends Router | Router["endpoints"]> {
|
|
|
384
390
|
? FetchRequestOptions<any, any, any>
|
|
385
391
|
: WithRequired<FetchRequestOptions<C["body"], C["query"], C["params"]>, keyof RequiredOptionKeys<C>>
|
|
386
392
|
): Promise<
|
|
387
|
-
FetchResponse<
|
|
393
|
+
FetchResponse<InferReturnType<R, OPT, K>>
|
|
388
394
|
>;
|
|
389
395
|
|
|
390
396
|
// Overload for endpoints WITHOUT required fields (permissive when R is 'any')
|
|
@@ -399,7 +405,7 @@ export class HTTP<R extends Router | Router["endpoints"]> {
|
|
|
399
405
|
? FetchRequestOptions<any, any, any>
|
|
400
406
|
: FetchRequestOptions<C["body"], C["query"], C["params"]>
|
|
401
407
|
): Promise<
|
|
402
|
-
FetchResponse<
|
|
408
|
+
FetchResponse<InferReturnType<R, OPT, K>>
|
|
403
409
|
>;
|
|
404
410
|
|
|
405
411
|
patch(path: any, options?: any): Promise<any> {
|
|
@@ -418,7 +424,7 @@ export class HTTP<R extends Router | Router["endpoints"]> {
|
|
|
418
424
|
? FetchRequestOptions<any, any, any>
|
|
419
425
|
: WithRequired<FetchRequestOptions<C["body"], C["query"], C["params"]>, keyof RequiredOptionKeys<C>>
|
|
420
426
|
): Promise<
|
|
421
|
-
FetchResponse<
|
|
427
|
+
FetchResponse<InferReturnType<R, OPT, K>>
|
|
422
428
|
>;
|
|
423
429
|
|
|
424
430
|
// Overload for endpoints WITHOUT required fields (permissive when R is 'any')
|
|
@@ -433,7 +439,7 @@ export class HTTP<R extends Router | Router["endpoints"]> {
|
|
|
433
439
|
? FetchRequestOptions<any, any, any>
|
|
434
440
|
: FetchRequestOptions<C["body"], C["query"], C["params"]>
|
|
435
441
|
): Promise<
|
|
436
|
-
FetchResponse<
|
|
442
|
+
FetchResponse<InferReturnType<R, OPT, K>>
|
|
437
443
|
>;
|
|
438
444
|
|
|
439
445
|
put(path: any, options?: any): Promise<any> {
|