@xmobitea/gn-server 2.1.0 → 2.1.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.
@@ -30,8 +30,16 @@ interface FunctionRequest {
30
30
  log: (log: any) => void,
31
31
  }
32
32
 
33
+ export enum ExecuteResponseStatus {
34
+ Ok = 1,
35
+ Exception = 2,
36
+ FunctionNameNotFound = 3,
37
+
38
+ }
39
+
40
+
33
41
  interface FunctionResponse {
34
- status: "ok" | "exception" | "commandNotFound",
42
+ status: ExecuteResponseStatus,
35
43
  result: any,
36
44
  errorMessage: any,
37
45
  }
@@ -90,14 +98,14 @@ async function ___handleFunction(request: FunctionRequest): Promise<FunctionResp
90
98
 
91
99
  if (handler == null) {
92
100
  return {
93
- status: 'commandNotFound',
101
+ status: ExecuteResponseStatus.FunctionNameNotFound,
94
102
  result: null,
95
103
  errorMessage: null,
96
104
  }
97
105
  }
98
106
 
99
107
  let answer: FunctionResponse = {
100
- status: 'ok',
108
+ status: ExecuteResponseStatus.Ok,
101
109
  errorMessage: null,
102
110
  result: null,
103
111
  }
@@ -106,7 +114,7 @@ async function ___handleFunction(request: FunctionRequest): Promise<FunctionResp
106
114
  answer.result = await handler(request);
107
115
  }
108
116
  catch (err: any) {
109
- answer.status = 'exception';
117
+ answer.status = ExecuteResponseStatus.Exception;
110
118
  answer.errorMessage = err.message;
111
119
  }
112
120
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xmobitea/gn-server",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "description": "Game Networking Server by XmobiTea (Pro)",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",