@colyseus/sdk 0.17.39 → 0.17.40

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 (48) hide show
  1. package/build/3rd_party/discord.cjs +1 -1
  2. package/build/3rd_party/discord.mjs +1 -1
  3. package/build/Auth.cjs +1 -1
  4. package/build/Auth.mjs +1 -1
  5. package/build/Client.cjs +1 -1
  6. package/build/Client.mjs +1 -1
  7. package/build/Connection.cjs +1 -1
  8. package/build/Connection.mjs +1 -1
  9. package/build/HTTP.cjs +1 -1
  10. package/build/HTTP.cjs.map +1 -1
  11. package/build/HTTP.d.ts +8 -5
  12. package/build/HTTP.mjs +1 -1
  13. package/build/HTTP.mjs.map +1 -1
  14. package/build/Room.cjs +1 -1
  15. package/build/Room.mjs +1 -1
  16. package/build/Storage.cjs +1 -1
  17. package/build/Storage.mjs +1 -1
  18. package/build/core/nanoevents.cjs +1 -1
  19. package/build/core/nanoevents.mjs +1 -1
  20. package/build/core/signal.cjs +1 -1
  21. package/build/core/signal.mjs +1 -1
  22. package/build/core/utils.cjs +1 -1
  23. package/build/core/utils.mjs +1 -1
  24. package/build/debug.cjs +1 -1
  25. package/build/debug.mjs +1 -1
  26. package/build/errors/Errors.cjs +1 -1
  27. package/build/errors/Errors.mjs +1 -1
  28. package/build/fetchXHR.cjs +1 -1
  29. package/build/fetchXHR.mjs +1 -1
  30. package/build/index.cjs +1 -1
  31. package/build/index.mjs +1 -1
  32. package/build/legacy.cjs +1 -1
  33. package/build/legacy.mjs +1 -1
  34. package/build/serializer/NoneSerializer.cjs +1 -1
  35. package/build/serializer/NoneSerializer.mjs +1 -1
  36. package/build/serializer/SchemaSerializer.cjs +1 -1
  37. package/build/serializer/SchemaSerializer.mjs +1 -1
  38. package/build/serializer/Serializer.cjs +1 -1
  39. package/build/serializer/Serializer.mjs +1 -1
  40. package/build/transport/H3Transport.cjs +1 -1
  41. package/build/transport/H3Transport.mjs +1 -1
  42. package/build/transport/WebSocketTransport.cjs +1 -1
  43. package/build/transport/WebSocketTransport.mjs +1 -1
  44. package/dist/colyseus.js +1 -1
  45. package/dist/colyseus.js.map +1 -1
  46. package/dist/debug.js +1 -1
  47. package/package.json +2 -2
  48. package/src/HTTP.ts +29 -34
package/dist/debug.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.39
6
+ // colyseus.js@0.17.40
7
7
  (function (Client_ts, sharedTypes) {
8
8
  'use strict';
9
9
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@colyseus/sdk",
3
- "version": "0.17.39",
3
+ "version": "0.17.40",
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.40"
85
+ "@colyseus/core": "^0.17.41"
86
86
  },
87
87
  "peerDependencies": {
88
88
  "@colyseus/core": "0.17.x"
package/src/HTTP.ts CHANGED
@@ -30,27 +30,7 @@ type HasRequired<
30
30
  query?: any;
31
31
  params?: any;
32
32
  },
33
- > = T["body"] extends object
34
- ? HasRequiredKeys<T["body"]> extends true
35
- ? true
36
- : T["query"] extends object
37
- ? HasRequiredKeys<T["query"]> extends true
38
- ? true
39
- : T["params"] extends object
40
- ? HasRequiredKeys<T["params"]>
41
- : false
42
- : T["params"] extends object
43
- ? HasRequiredKeys<T["params"]>
44
- : false
45
- : T["query"] extends object
46
- ? HasRequiredKeys<T["query"]> extends true
47
- ? true
48
- : T["params"] extends object
49
- ? HasRequiredKeys<T["params"]>
50
- : false
51
- : T["params"] extends object
52
- ? HasRequiredKeys<T["params"]>
53
- : false;
33
+ > = keyof RequiredOptionKeys<T> extends never ? false : true;
54
34
 
55
35
  type InferContext<T> = T extends (ctx: infer Ctx) => any
56
36
  ? Ctx extends object
@@ -87,27 +67,42 @@ type MethodOptions<API, M extends HTTPMethod> = API extends { [key: string]: inf
87
67
  : {}
88
68
  : {};
89
69
 
70
+ // When the endpoint didn't declare a schema, better-call infers:
71
+ // - body: `any`
72
+ // - query: `Record<string, any> | undefined`
73
+ // - params: `Record<string, any> | undefined` (no `:param` in path)
74
+ // Under `strictNullChecks: false`, `undefined extends T` is vacuously true and
75
+ // `undefined extends object` is also true, so the previous `extends object`
76
+ // guard wrongly classified these undeclared slots as required. The checks
77
+ // below use `IsAny` for body and `string extends keyof NonNullable<…>` to
78
+ // detect the fallback index signature — both are immune to null-check mode.
79
+ type IsUndeclaredSchema<T> = [T] extends [never]
80
+ ? true
81
+ : string extends keyof NonNullable<T> ? true : false;
82
+
90
83
  export type RequiredOptionKeys<
91
84
  C extends {
92
85
  body?: any;
93
86
  query?: any;
94
87
  params?: any;
95
88
  },
96
- > = (C["body"] extends object
97
- ? HasRequiredKeys<C["body"]> extends true
98
- ? { body: true }
99
- : {}
100
- : {}) &
101
- (C["query"] extends object
102
- ? HasRequiredKeys<C["query"]> extends true
103
- ? { query: true }
89
+ > = (IsAny<C["body"]> extends true
90
+ ? {}
91
+ : NonNullable<C["body"]> extends object
92
+ ? HasRequiredKeys<NonNullable<C["body"]>> extends true
93
+ ? { body: true }
104
94
  : {}
105
- : {}) &
106
- (C["params"] extends object
107
- ? HasRequiredKeys<C["params"]> extends true
95
+ : { body: true }) &
96
+ (IsUndeclaredSchema<C["query"]> extends true
97
+ ? {}
98
+ : HasRequiredKeys<NonNullable<C["query"]>> extends true
99
+ ? { query: true }
100
+ : {}) &
101
+ (IsUndeclaredSchema<C["params"]> extends true
102
+ ? {}
103
+ : HasRequiredKeys<NonNullable<C["params"]>> extends true
108
104
  ? { params: true }
109
- : {}
110
- : {});
105
+ : {});
111
106
 
112
107
 
113
108
  type CommonHeaders = {