@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.
- 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 +8 -5
- 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/fetchXHR.cjs +1 -1
- package/build/fetchXHR.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.js +1 -1
- package/dist/colyseus.js.map +1 -1
- package/dist/debug.js +1 -1
- package/package.json +2 -2
- package/src/HTTP.ts +29 -34
package/dist/debug.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@colyseus/sdk",
|
|
3
|
-
"version": "0.17.
|
|
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.
|
|
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
|
|
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
|
|
97
|
-
?
|
|
98
|
-
|
|
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["
|
|
107
|
-
?
|
|
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 = {
|