unreal-engine-mcp-server 0.2.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/.dockerignore +57 -0
- package/.env.production +25 -0
- package/.eslintrc.json +54 -0
- package/.github/workflows/publish-mcp.yml +75 -0
- package/Dockerfile +54 -0
- package/LICENSE +21 -0
- package/Public/icon.png +0 -0
- package/README.md +209 -0
- package/claude_desktop_config_example.json +13 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.js +7 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.js +484 -0
- package/dist/prompts/index.d.ts +14 -0
- package/dist/prompts/index.js +38 -0
- package/dist/python-utils.d.ts +29 -0
- package/dist/python-utils.js +54 -0
- package/dist/resources/actors.d.ts +13 -0
- package/dist/resources/actors.js +83 -0
- package/dist/resources/assets.d.ts +23 -0
- package/dist/resources/assets.js +245 -0
- package/dist/resources/levels.d.ts +17 -0
- package/dist/resources/levels.js +94 -0
- package/dist/tools/actors.d.ts +51 -0
- package/dist/tools/actors.js +459 -0
- package/dist/tools/animation.d.ts +196 -0
- package/dist/tools/animation.js +579 -0
- package/dist/tools/assets.d.ts +21 -0
- package/dist/tools/assets.js +304 -0
- package/dist/tools/audio.d.ts +170 -0
- package/dist/tools/audio.js +416 -0
- package/dist/tools/blueprint.d.ts +144 -0
- package/dist/tools/blueprint.js +652 -0
- package/dist/tools/build_environment_advanced.d.ts +66 -0
- package/dist/tools/build_environment_advanced.js +484 -0
- package/dist/tools/consolidated-tool-definitions.d.ts +2598 -0
- package/dist/tools/consolidated-tool-definitions.js +607 -0
- package/dist/tools/consolidated-tool-handlers.d.ts +2 -0
- package/dist/tools/consolidated-tool-handlers.js +1050 -0
- package/dist/tools/debug.d.ts +185 -0
- package/dist/tools/debug.js +265 -0
- package/dist/tools/editor.d.ts +88 -0
- package/dist/tools/editor.js +365 -0
- package/dist/tools/engine.d.ts +30 -0
- package/dist/tools/engine.js +36 -0
- package/dist/tools/foliage.d.ts +155 -0
- package/dist/tools/foliage.js +525 -0
- package/dist/tools/introspection.d.ts +98 -0
- package/dist/tools/introspection.js +683 -0
- package/dist/tools/landscape.d.ts +158 -0
- package/dist/tools/landscape.js +375 -0
- package/dist/tools/level.d.ts +110 -0
- package/dist/tools/level.js +362 -0
- package/dist/tools/lighting.d.ts +159 -0
- package/dist/tools/lighting.js +1179 -0
- package/dist/tools/materials.d.ts +34 -0
- package/dist/tools/materials.js +146 -0
- package/dist/tools/niagara.d.ts +145 -0
- package/dist/tools/niagara.js +289 -0
- package/dist/tools/performance.d.ts +163 -0
- package/dist/tools/performance.js +412 -0
- package/dist/tools/physics.d.ts +189 -0
- package/dist/tools/physics.js +784 -0
- package/dist/tools/rc.d.ts +110 -0
- package/dist/tools/rc.js +363 -0
- package/dist/tools/sequence.d.ts +112 -0
- package/dist/tools/sequence.js +675 -0
- package/dist/tools/tool-definitions.d.ts +4919 -0
- package/dist/tools/tool-definitions.js +891 -0
- package/dist/tools/tool-handlers.d.ts +47 -0
- package/dist/tools/tool-handlers.js +830 -0
- package/dist/tools/ui.d.ts +171 -0
- package/dist/tools/ui.js +337 -0
- package/dist/tools/visual.d.ts +29 -0
- package/dist/tools/visual.js +67 -0
- package/dist/types/env.d.ts +10 -0
- package/dist/types/env.js +18 -0
- package/dist/types/index.d.ts +323 -0
- package/dist/types/index.js +28 -0
- package/dist/types/tool-types.d.ts +274 -0
- package/dist/types/tool-types.js +13 -0
- package/dist/unreal-bridge.d.ts +126 -0
- package/dist/unreal-bridge.js +992 -0
- package/dist/utils/cache-manager.d.ts +64 -0
- package/dist/utils/cache-manager.js +176 -0
- package/dist/utils/error-handler.d.ts +66 -0
- package/dist/utils/error-handler.js +243 -0
- package/dist/utils/errors.d.ts +133 -0
- package/dist/utils/errors.js +256 -0
- package/dist/utils/http.d.ts +26 -0
- package/dist/utils/http.js +135 -0
- package/dist/utils/logger.d.ts +12 -0
- package/dist/utils/logger.js +32 -0
- package/dist/utils/normalize.d.ts +17 -0
- package/dist/utils/normalize.js +49 -0
- package/dist/utils/response-validator.d.ts +34 -0
- package/dist/utils/response-validator.js +121 -0
- package/dist/utils/safe-json.d.ts +4 -0
- package/dist/utils/safe-json.js +97 -0
- package/dist/utils/stdio-redirect.d.ts +2 -0
- package/dist/utils/stdio-redirect.js +20 -0
- package/dist/utils/validation.d.ts +50 -0
- package/dist/utils/validation.js +173 -0
- package/mcp-config-example.json +14 -0
- package/package.json +63 -0
- package/server.json +60 -0
- package/src/cli.ts +7 -0
- package/src/index.ts +543 -0
- package/src/prompts/index.ts +51 -0
- package/src/python/editor_compat.py +181 -0
- package/src/python-utils.ts +57 -0
- package/src/resources/actors.ts +92 -0
- package/src/resources/assets.ts +251 -0
- package/src/resources/levels.ts +83 -0
- package/src/tools/actors.ts +480 -0
- package/src/tools/animation.ts +713 -0
- package/src/tools/assets.ts +305 -0
- package/src/tools/audio.ts +548 -0
- package/src/tools/blueprint.ts +736 -0
- package/src/tools/build_environment_advanced.ts +526 -0
- package/src/tools/consolidated-tool-definitions.ts +619 -0
- package/src/tools/consolidated-tool-handlers.ts +1093 -0
- package/src/tools/debug.ts +368 -0
- package/src/tools/editor.ts +360 -0
- package/src/tools/engine.ts +32 -0
- package/src/tools/foliage.ts +652 -0
- package/src/tools/introspection.ts +778 -0
- package/src/tools/landscape.ts +523 -0
- package/src/tools/level.ts +410 -0
- package/src/tools/lighting.ts +1316 -0
- package/src/tools/materials.ts +148 -0
- package/src/tools/niagara.ts +312 -0
- package/src/tools/performance.ts +549 -0
- package/src/tools/physics.ts +924 -0
- package/src/tools/rc.ts +437 -0
- package/src/tools/sequence.ts +791 -0
- package/src/tools/tool-definitions.ts +907 -0
- package/src/tools/tool-handlers.ts +941 -0
- package/src/tools/ui.ts +499 -0
- package/src/tools/visual.ts +60 -0
- package/src/types/env.ts +27 -0
- package/src/types/index.ts +414 -0
- package/src/types/tool-types.ts +343 -0
- package/src/unreal-bridge.ts +1118 -0
- package/src/utils/cache-manager.ts +213 -0
- package/src/utils/error-handler.ts +320 -0
- package/src/utils/errors.ts +312 -0
- package/src/utils/http.ts +184 -0
- package/src/utils/logger.ts +30 -0
- package/src/utils/normalize.ts +54 -0
- package/src/utils/response-validator.ts +145 -0
- package/src/utils/safe-json.ts +112 -0
- package/src/utils/stdio-redirect.ts +18 -0
- package/src/utils/validation.ts +212 -0
- package/tsconfig.json +33 -0
|
@@ -0,0 +1,414 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Comprehensive type definitions for Unreal Engine MCP Server
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
// Re-export existing types
|
|
6
|
+
export * from './env.js';
|
|
7
|
+
export * from './tool-types.js';
|
|
8
|
+
|
|
9
|
+
// Common Unreal Engine types
|
|
10
|
+
export interface Vector3 {
|
|
11
|
+
x: number;
|
|
12
|
+
y: number;
|
|
13
|
+
z: number;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface Rotation3 {
|
|
17
|
+
pitch: number;
|
|
18
|
+
yaw: number;
|
|
19
|
+
roll: number;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface Transform {
|
|
23
|
+
location: Vector3;
|
|
24
|
+
rotation: Rotation3;
|
|
25
|
+
scale?: Vector3;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface Color {
|
|
29
|
+
r: number;
|
|
30
|
+
g: number;
|
|
31
|
+
b: number;
|
|
32
|
+
a?: number;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Asset types
|
|
36
|
+
export interface Asset {
|
|
37
|
+
Name: string;
|
|
38
|
+
Path: string;
|
|
39
|
+
Class: string;
|
|
40
|
+
PackagePath: string;
|
|
41
|
+
Type?: string;
|
|
42
|
+
Size?: number;
|
|
43
|
+
LastModified?: Date;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface Material extends Asset {
|
|
47
|
+
BaseColor?: Color;
|
|
48
|
+
Metallic?: number;
|
|
49
|
+
Roughness?: number;
|
|
50
|
+
Emissive?: Color;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface Texture extends Asset {
|
|
54
|
+
Width?: number;
|
|
55
|
+
Height?: number;
|
|
56
|
+
Format?: string;
|
|
57
|
+
MipLevels?: number;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// Actor types
|
|
61
|
+
export interface Actor {
|
|
62
|
+
Name: string;
|
|
63
|
+
Class: string;
|
|
64
|
+
Path: string;
|
|
65
|
+
Transform?: Transform;
|
|
66
|
+
Components?: Component[];
|
|
67
|
+
Tags?: string[];
|
|
68
|
+
IsSelected?: boolean;
|
|
69
|
+
IsHidden?: boolean;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export interface Component {
|
|
73
|
+
Name: string;
|
|
74
|
+
Class: string;
|
|
75
|
+
Properties?: Record<string, any>;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// Level types
|
|
79
|
+
export interface Level {
|
|
80
|
+
Name: string;
|
|
81
|
+
Path: string;
|
|
82
|
+
IsLoaded: boolean;
|
|
83
|
+
IsVisible: boolean;
|
|
84
|
+
Actors?: Actor[];
|
|
85
|
+
StreamingLevels?: StreamingLevel[];
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export interface StreamingLevel {
|
|
89
|
+
Name: string;
|
|
90
|
+
Path: string;
|
|
91
|
+
LoadingState: 'Unloaded' | 'Loading' | 'Loaded';
|
|
92
|
+
ShouldBeLoaded: boolean;
|
|
93
|
+
ShouldBeVisible: boolean;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// Blueprint types
|
|
97
|
+
export interface Blueprint {
|
|
98
|
+
Name: string;
|
|
99
|
+
Path: string;
|
|
100
|
+
ParentClass: string;
|
|
101
|
+
Components?: BlueprintComponent[];
|
|
102
|
+
Variables?: BlueprintVariable[];
|
|
103
|
+
Functions?: BlueprintFunction[];
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export interface BlueprintComponent {
|
|
107
|
+
Name: string;
|
|
108
|
+
Type: string;
|
|
109
|
+
DefaultProperties?: Record<string, any>;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export interface BlueprintVariable {
|
|
113
|
+
Name: string;
|
|
114
|
+
Type: string;
|
|
115
|
+
DefaultValue?: any;
|
|
116
|
+
IsPublic?: boolean;
|
|
117
|
+
Category?: string;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export interface BlueprintFunction {
|
|
121
|
+
Name: string;
|
|
122
|
+
ReturnType?: string;
|
|
123
|
+
Parameters?: FunctionParameter[];
|
|
124
|
+
IsPublic?: boolean;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export interface FunctionParameter {
|
|
128
|
+
Name: string;
|
|
129
|
+
Type: string;
|
|
130
|
+
DefaultValue?: any;
|
|
131
|
+
IsOptional?: boolean;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// Animation types
|
|
135
|
+
export interface AnimationSequence {
|
|
136
|
+
Name: string;
|
|
137
|
+
Path: string;
|
|
138
|
+
Duration: number;
|
|
139
|
+
FrameRate: number;
|
|
140
|
+
Skeleton?: string;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export interface AnimationMontage {
|
|
144
|
+
Name: string;
|
|
145
|
+
Path: string;
|
|
146
|
+
Sections?: MontageSection[];
|
|
147
|
+
BlendIn?: number;
|
|
148
|
+
BlendOut?: number;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export interface MontageSection {
|
|
152
|
+
Name: string;
|
|
153
|
+
StartTime: number;
|
|
154
|
+
EndTime: number;
|
|
155
|
+
NextSection?: string;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// Physics types
|
|
159
|
+
export interface PhysicsBody {
|
|
160
|
+
Mass: number;
|
|
161
|
+
LinearDamping: number;
|
|
162
|
+
AngularDamping: number;
|
|
163
|
+
EnableGravity: boolean;
|
|
164
|
+
IsKinematic: boolean;
|
|
165
|
+
CollisionEnabled: boolean;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export interface PhysicsConstraint {
|
|
169
|
+
Name: string;
|
|
170
|
+
Actor1: string;
|
|
171
|
+
Actor2: string;
|
|
172
|
+
LinearLimits?: Vector3;
|
|
173
|
+
AngularLimits?: Vector3;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// Niagara/VFX types
|
|
177
|
+
export interface NiagaraSystem {
|
|
178
|
+
Name: string;
|
|
179
|
+
Path: string;
|
|
180
|
+
Emitters?: NiagaraEmitter[];
|
|
181
|
+
Parameters?: NiagaraParameter[];
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
export interface NiagaraEmitter {
|
|
185
|
+
Name: string;
|
|
186
|
+
SpawnRate: number;
|
|
187
|
+
Lifetime: number;
|
|
188
|
+
VelocityModule?: Vector3;
|
|
189
|
+
ColorModule?: Color;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
export interface NiagaraParameter {
|
|
193
|
+
Name: string;
|
|
194
|
+
Type: string;
|
|
195
|
+
Value: any;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// Landscape types
|
|
199
|
+
export interface Landscape {
|
|
200
|
+
Name: string;
|
|
201
|
+
ComponentCount: number;
|
|
202
|
+
Resolution: { x: number; y: number };
|
|
203
|
+
Scale: Vector3;
|
|
204
|
+
Materials?: string[];
|
|
205
|
+
Layers?: LandscapeLayer[];
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
export interface LandscapeLayer {
|
|
209
|
+
Name: string;
|
|
210
|
+
BlendMode: string;
|
|
211
|
+
Weight: number;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
// Remote Control types
|
|
215
|
+
export interface RemoteControlPreset {
|
|
216
|
+
Name: string;
|
|
217
|
+
Path: string;
|
|
218
|
+
ExposedProperties?: ExposedProperty[];
|
|
219
|
+
ExposedFunctions?: ExposedFunction[];
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
export interface ExposedProperty {
|
|
223
|
+
Name: string;
|
|
224
|
+
DisplayName?: string;
|
|
225
|
+
ObjectPath: string;
|
|
226
|
+
PropertyPath: string;
|
|
227
|
+
Type: string;
|
|
228
|
+
Value?: any;
|
|
229
|
+
Metadata?: Record<string, any>;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
export interface ExposedFunction {
|
|
233
|
+
Name: string;
|
|
234
|
+
DisplayName?: string;
|
|
235
|
+
ObjectPath: string;
|
|
236
|
+
FunctionName: string;
|
|
237
|
+
Parameters?: FunctionParameter[];
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
// Sequencer types
|
|
241
|
+
export interface LevelSequence {
|
|
242
|
+
Name: string;
|
|
243
|
+
Path: string;
|
|
244
|
+
Duration: number;
|
|
245
|
+
FrameRate: number;
|
|
246
|
+
Tracks?: SequencerTrack[];
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
export interface SequencerTrack {
|
|
250
|
+
Name: string;
|
|
251
|
+
Type: string;
|
|
252
|
+
BoundObject?: string;
|
|
253
|
+
Sections?: SequencerSection[];
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
export interface SequencerSection {
|
|
257
|
+
StartFrame: number;
|
|
258
|
+
EndFrame: number;
|
|
259
|
+
Properties?: Record<string, any>;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
// Performance types
|
|
263
|
+
export interface PerformanceMetrics {
|
|
264
|
+
FPS: number;
|
|
265
|
+
FrameTime: number;
|
|
266
|
+
GameThreadTime: number;
|
|
267
|
+
RenderThreadTime: number;
|
|
268
|
+
GPUTime: number;
|
|
269
|
+
DrawCalls: number;
|
|
270
|
+
Triangles: number;
|
|
271
|
+
Memory: MemoryMetrics;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
export interface MemoryMetrics {
|
|
275
|
+
Physical: number;
|
|
276
|
+
Virtual: number;
|
|
277
|
+
GPU: number;
|
|
278
|
+
TextureMemory: number;
|
|
279
|
+
MeshMemory: number;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
// Engine info types
|
|
283
|
+
export interface EngineVersion {
|
|
284
|
+
Major: number;
|
|
285
|
+
Minor: number;
|
|
286
|
+
Patch: number;
|
|
287
|
+
Build?: number;
|
|
288
|
+
Branch?: string;
|
|
289
|
+
Compatible?: boolean;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
export interface ProjectInfo {
|
|
293
|
+
Name: string;
|
|
294
|
+
Path: string;
|
|
295
|
+
EngineVersion: string;
|
|
296
|
+
Plugins?: PluginInfo[];
|
|
297
|
+
Settings?: ProjectSettings;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
export interface PluginInfo {
|
|
301
|
+
Name: string;
|
|
302
|
+
Version: string;
|
|
303
|
+
Enabled: boolean;
|
|
304
|
+
Category?: string;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
export interface ProjectSettings {
|
|
308
|
+
DefaultMap?: string;
|
|
309
|
+
DefaultGameMode?: string;
|
|
310
|
+
TargetFrameRate?: number;
|
|
311
|
+
EnableRayTracing?: boolean;
|
|
312
|
+
EnableNanite?: boolean;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
// Response types
|
|
316
|
+
export interface SuccessResponse<T = any> {
|
|
317
|
+
success: true;
|
|
318
|
+
data?: T;
|
|
319
|
+
message?: string;
|
|
320
|
+
metadata?: Record<string, any>;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
export interface ErrorResponse {
|
|
324
|
+
success: false;
|
|
325
|
+
error: string;
|
|
326
|
+
code?: string;
|
|
327
|
+
statusCode?: number;
|
|
328
|
+
details?: Record<string, any>;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
export type ApiResponse<T = any> = SuccessResponse<T> | ErrorResponse;
|
|
332
|
+
|
|
333
|
+
// Tool execution types
|
|
334
|
+
export interface ToolContext {
|
|
335
|
+
bridge: any; // UnrealBridge instance
|
|
336
|
+
tools: Record<string, any>;
|
|
337
|
+
cache?: any;
|
|
338
|
+
metrics?: any;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
export interface ToolResult<T = any> {
|
|
342
|
+
content: Array<{
|
|
343
|
+
type: 'text' | 'json' | 'error';
|
|
344
|
+
text?: string;
|
|
345
|
+
data?: T;
|
|
346
|
+
}>;
|
|
347
|
+
isError?: boolean;
|
|
348
|
+
metadata?: Record<string, any>;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
// Event types
|
|
352
|
+
export interface UnrealEvent {
|
|
353
|
+
type: string;
|
|
354
|
+
timestamp: Date;
|
|
355
|
+
data: any;
|
|
356
|
+
source?: string;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
export interface PropertyChangeEvent extends UnrealEvent {
|
|
360
|
+
type: 'property_change';
|
|
361
|
+
objectPath: string;
|
|
362
|
+
propertyName: string;
|
|
363
|
+
oldValue: any;
|
|
364
|
+
newValue: any;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
export interface ActorSpawnEvent extends UnrealEvent {
|
|
368
|
+
type: 'actor_spawn';
|
|
369
|
+
actorName: string;
|
|
370
|
+
actorClass: string;
|
|
371
|
+
location: Vector3;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
// Utility types
|
|
375
|
+
export type DeepPartial<T> = {
|
|
376
|
+
[P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
|
|
377
|
+
};
|
|
378
|
+
|
|
379
|
+
export type Nullable<T> = T | null;
|
|
380
|
+
|
|
381
|
+
export type Optional<T> = T | undefined;
|
|
382
|
+
|
|
383
|
+
export type AsyncResult<T> = Promise<ApiResponse<T>>;
|
|
384
|
+
|
|
385
|
+
export type Callback<T> = (error: Error | null, result?: T) => void;
|
|
386
|
+
|
|
387
|
+
// Type guards
|
|
388
|
+
export function isVector3(value: any): value is Vector3 {
|
|
389
|
+
return (
|
|
390
|
+
typeof value === 'object' &&
|
|
391
|
+
value !== null &&
|
|
392
|
+
typeof value.x === 'number' &&
|
|
393
|
+
typeof value.y === 'number' &&
|
|
394
|
+
typeof value.z === 'number'
|
|
395
|
+
);
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
export function isRotation3(value: any): value is Rotation3 {
|
|
399
|
+
return (
|
|
400
|
+
typeof value === 'object' &&
|
|
401
|
+
value !== null &&
|
|
402
|
+
typeof value.pitch === 'number' &&
|
|
403
|
+
typeof value.yaw === 'number' &&
|
|
404
|
+
typeof value.roll === 'number'
|
|
405
|
+
);
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
export function isSuccessResponse<T>(response: ApiResponse<T>): response is SuccessResponse<T> {
|
|
409
|
+
return response.success === true;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
export function isErrorResponse(response: ApiResponse): response is ErrorResponse {
|
|
413
|
+
return response.success === false;
|
|
414
|
+
}
|