@xmobitea/gn-server 2.6.5 → 2.6.7
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/LICENSE +198 -5
- package/apiReferences/Authenticate.json +1328 -1
- package/apiReferences/CharacterPlayer.json +3199 -1
- package/apiReferences/CloudScript.json +278 -1
- package/apiReferences/Content.json +324 -1
- package/apiReferences/GamePlayer.json +3844 -1
- package/apiReferences/Group.json +2454 -1
- package/apiReferences/Inventory.json +1964 -1
- package/apiReferences/MasterAdmin.json +5569 -1
- package/apiReferences/MasterPlayer.json +5924 -1
- package/apiReferences/Multiplayer.json +545 -1
- package/apiReferences/StoreInventory.json +1290 -1
- package/dist/GN-app-api/handler/controller/handler/characterPlayer/model/GroupMemberParam.d.ts +0 -1
- package/dist/GN-app-api/handler/controller/handler/cloudScript/ExecuteFunctionRequestHandler.d.ts +1 -1
- package/dist/GN-app-api/handler/controller/handler/group/model/GroupMemberParam.d.ts +0 -1
- package/dist/GN-app-api/handler/controller/handler/masterPlayer/SetPlayerBanRequestHandler.d.ts +2 -0
- package/dist/GN-app-api/service/CloudScriptEventService.d.ts +144 -0
- package/dist/GN-app-api/service/CloudScriptService.d.ts +1 -1
- package/dist/GN-app-api/service/EventCallbackService.d.ts +9 -17
- package/dist/GN-app-api/service/ICloudScriptService.d.ts +2 -2
- package/dist/GN-app-api/service/IEventCallbackService.d.ts +0 -14
- package/dist/GN-app-api/{handler/controller/handler/multiplayer/MatchmakingHandler.d.ts → service/IMatchmakingService.d.ts} +2 -19
- package/dist/GN-app-api/service/MatchmakingService.d.ts +21 -0
- package/dist/GN-startup/cloudScript/CloudScriptAdmin.ts +74 -0
- package/dist/GN-startup/cloudScript/CloudScriptDatabase.ts +93 -0
- package/dist/GN-startup/cloudScript/CloudScriptEvent.ts +158 -0
- package/dist/GN-startup/cloudScript/CloudScriptHttp.ts +31 -0
- package/dist/GN-startup/cloudScript/CloudScriptMail.ts +26 -0
- package/dist/GN-startup/cloudScript/CloudScriptMatchmaking.ts +14 -0
- package/dist/GN-startup/cloudScript/CloudScriptPushNotification.ts +65 -0
- package/dist/GN-startup/cloudScript/CloudScriptSocket.ts +64 -0
- package/dist/GN-startup/cloudScript/eventCallbackCloudScriptData.json +59 -17
- package/dist/GN-startup/cloudScript/templateCloudScript.ts +26 -385
- package/dist/GN-startup/cloudScript/templateEventCallback.ts +301 -509
- package/dist/GN-startup/middleware/ApiMiddleware.d.ts +1 -0
- package/dist/GN-startup/routes/SocketAppHandler.d.ts +7 -0
- package/dist/GNServer.d.ts +5 -1
- package/dist/RequestControllerUtils.d.ts +4 -0
- package/dist/index.d.ts +1 -1
- package/package.json +3 -3
- package/syncCode.js +1394 -0
- package/index.js +0 -26
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as axios from "axios";
|
|
2
|
+
|
|
3
|
+
export class CloudScriptHttp {
|
|
4
|
+
public async get<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, config?: axios.AxiosRequestConfig<D>): Promise<R> {
|
|
5
|
+
return await axios.default.get<T, R, D>(url, config);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
public async delete<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, config?: axios.AxiosRequestConfig<D>): Promise<R> {
|
|
9
|
+
return await axios.default.delete<T, R, D>(url, config);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
public async head<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, config?: axios.AxiosRequestConfig<D>): Promise<R> {
|
|
13
|
+
return await axios.default.head<T, R, D>(url, config);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
public async options<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, config?: axios.AxiosRequestConfig<D>): Promise<R> {
|
|
17
|
+
return await axios.default.options<T, R, D>(url, config);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
public async post<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, data?: any, config?: axios.AxiosRequestConfig<D>): Promise<R> {
|
|
21
|
+
return await axios.default.post<T, R, D>(url, data, config);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
public async put<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, data?: any, config?: axios.AxiosRequestConfig<D>): Promise<R> {
|
|
25
|
+
return await axios.default.put<T, R, D>(url, data, config);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
public async patch<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, data?: any, config?: axios.AxiosRequestConfig<D>): Promise<R> {
|
|
29
|
+
return await axios.default.patch<T, R, D>(url, data, config);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { CloudScriptEventType, CloudScriptProcessBase } from "./CloudScriptEvent";
|
|
2
|
+
|
|
3
|
+
export class CloudScriptMail extends CloudScriptProcessBase {
|
|
4
|
+
public async send(email: string, subject: string, contentHtml: string) {
|
|
5
|
+
return await this.sendEvent({
|
|
6
|
+
eventType: CloudScriptEventType.SendMailToOne,
|
|
7
|
+
email: email,
|
|
8
|
+
mailData: {
|
|
9
|
+
subject: subject,
|
|
10
|
+
contentHtml: contentHtml,
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
public async sendToMore(emails: string[], subject: string, contentHtml: string) {
|
|
16
|
+
return await this.sendEvent({
|
|
17
|
+
eventType: CloudScriptEventType.SendMailToMore,
|
|
18
|
+
emails: emails,
|
|
19
|
+
mailData: {
|
|
20
|
+
subject: subject,
|
|
21
|
+
contentHtml: contentHtml,
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { MatchmakingTicketCanMatch, ServerDetail } from "./../../index";
|
|
2
|
+
import { CloudScriptEventType, CloudScriptProcessBase } from "./CloudScriptEvent";
|
|
3
|
+
|
|
4
|
+
export class CloudScriptMatchmaking extends CloudScriptProcessBase {
|
|
5
|
+
public async confirmServerDetail(gameId: string, matchmakingTicketCanMatch: MatchmakingTicketCanMatch, serverDetail: ServerDetail) {
|
|
6
|
+
return await this.sendEvent({
|
|
7
|
+
eventType: CloudScriptEventType.ConfirmServerDetail,
|
|
8
|
+
gameId: gameId,
|
|
9
|
+
matchmakingTicketCanMatch: matchmakingTicketCanMatch,
|
|
10
|
+
serverDetail: serverDetail,
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { CloudScriptEventType, CloudScriptProcessBase } from "./CloudScriptEvent";
|
|
2
|
+
|
|
3
|
+
export class CloudScriptPushNotification extends CloudScriptProcessBase {
|
|
4
|
+
public async send(token: string, title: string, body: string, badge?: number, sound?: string, icon?: string, data?: { [k: string]: any }) {
|
|
5
|
+
return await this.sendEvent({
|
|
6
|
+
eventType: CloudScriptEventType.SendPushNotificationToOne,
|
|
7
|
+
token: token,
|
|
8
|
+
pushData: {
|
|
9
|
+
title: title,
|
|
10
|
+
body: body,
|
|
11
|
+
badge: badge,
|
|
12
|
+
sound: sound,
|
|
13
|
+
icon: icon,
|
|
14
|
+
data: data,
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
public async sendToMore(tokens: string[], title: string, body: string, badge?: number, sound?: string, icon?: string, data?: { [k: string]: any }) {
|
|
20
|
+
return await this.sendEvent({
|
|
21
|
+
eventType: CloudScriptEventType.SendPushNotificationToMore,
|
|
22
|
+
tokens: tokens,
|
|
23
|
+
pushData: {
|
|
24
|
+
title: title,
|
|
25
|
+
body: body,
|
|
26
|
+
badge: badge,
|
|
27
|
+
sound: sound,
|
|
28
|
+
icon: icon,
|
|
29
|
+
data: data,
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
public async sendToTopic(topic: string, title: string, body: string, badge?: number, sound?: string, icon?: string, data?: { [k: string]: any }) {
|
|
35
|
+
return await this.sendEvent({
|
|
36
|
+
eventType: CloudScriptEventType.SendPushNotificationToTopic,
|
|
37
|
+
topic: topic,
|
|
38
|
+
pushData: {
|
|
39
|
+
title: title,
|
|
40
|
+
body: body,
|
|
41
|
+
badge: badge,
|
|
42
|
+
sound: sound,
|
|
43
|
+
icon: icon,
|
|
44
|
+
data: data,
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
public async subscribeToTopic(tokens: string[], topic: string) {
|
|
50
|
+
return await this.sendEvent({
|
|
51
|
+
eventType: CloudScriptEventType.SubscribeToTopic,
|
|
52
|
+
tokens: tokens,
|
|
53
|
+
topic: topic,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
public async unsubscribeFromTopic(tokens: string[], topic: string) {
|
|
58
|
+
return await this.sendEvent({
|
|
59
|
+
eventType: CloudScriptEventType.UnsubscribeFromTopic,
|
|
60
|
+
tokens: tokens,
|
|
61
|
+
topic: topic,
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { OperationEvent } from "@xmobitea/gn-typescript-client";
|
|
2
|
+
import { CloudScriptEventType, CloudScriptProcessBase } from "./CloudScriptEvent";
|
|
3
|
+
|
|
4
|
+
export class CloudScriptSocket extends CloudScriptProcessBase {
|
|
5
|
+
public async sendEventTo(userId: string, operationEvent: OperationEvent): Promise<void> {
|
|
6
|
+
return await this.sendEvent({
|
|
7
|
+
eventType: CloudScriptEventType.SendEventToOne,
|
|
8
|
+
userId: userId,
|
|
9
|
+
operationEvent: {
|
|
10
|
+
eventCode: operationEvent.getEventCode(),
|
|
11
|
+
parameters: operationEvent.getParameters()?.toData() ?? null,
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
public async sendEventToMoreUser(userIds: string[], operationEvent: OperationEvent): Promise<void> {
|
|
17
|
+
return await this.sendEvent({
|
|
18
|
+
eventType: CloudScriptEventType.SendEventToMore,
|
|
19
|
+
userIds: userIds,
|
|
20
|
+
operationEvent: {
|
|
21
|
+
eventCode: operationEvent.getEventCode(),
|
|
22
|
+
parameters: operationEvent.getParameters()?.toData() ?? null,
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
public async sendEventToAllPlayer(operationEvent: OperationEvent): Promise<void> {
|
|
28
|
+
return await this.sendEvent({
|
|
29
|
+
eventType: CloudScriptEventType.SendEventToAll,
|
|
30
|
+
operationEvent: {
|
|
31
|
+
eventCode: operationEvent.getEventCode(),
|
|
32
|
+
parameters: operationEvent.getParameters()?.toData() ?? null,
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
public async joinRoom(userId: string, roomId: string): Promise<void> {
|
|
38
|
+
return await this.sendEvent({
|
|
39
|
+
eventType: CloudScriptEventType.JoinRoom,
|
|
40
|
+
userId: userId,
|
|
41
|
+
roomId: roomId,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
public async leaveRoom(userId: string, roomId: string): Promise<void> {
|
|
46
|
+
return await this.sendEvent({
|
|
47
|
+
eventType: CloudScriptEventType.LeaveRoom,
|
|
48
|
+
userId: userId,
|
|
49
|
+
roomId: roomId,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
public async sendEventToRoom(roomId: string, operationEvent: OperationEvent): Promise<void> {
|
|
54
|
+
return await this.sendEvent({
|
|
55
|
+
eventType: CloudScriptEventType.SendEventToRoom,
|
|
56
|
+
roomId: roomId,
|
|
57
|
+
operationEvent: {
|
|
58
|
+
eventCode: operationEvent.getEventCode(),
|
|
59
|
+
parameters: operationEvent.getParameters()?.toData() ?? null,
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
}
|
|
@@ -19,40 +19,82 @@
|
|
|
19
19
|
"eventName": "system_OnEveryDay",
|
|
20
20
|
"script": "\nsystemHandlers.system_OnEveryDay = async (log: (log: any) => void) => {\n\n}\n",
|
|
21
21
|
"hasEdit": false
|
|
22
|
-
}
|
|
22
|
+
}
|
|
23
|
+
]
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"type": "systemMatchmaking",
|
|
27
|
+
"version": "FIRSTVER",
|
|
28
|
+
"fullScript": "// first full script",
|
|
29
|
+
"tsLastUpdate": 1736498427663,
|
|
30
|
+
"childScripts": [
|
|
23
31
|
{
|
|
24
|
-
"eventName": "
|
|
25
|
-
"script": "\nsystemMatchmakingHandlers.
|
|
32
|
+
"eventName": "systemMatchmaking_RequestServerDetail",
|
|
33
|
+
"script": "\nsystemMatchmakingHandlers.systemMatchmaking_RequestServerDetail = async (gameId: string, matchmakingTicketCanMatch: MatchmakingTicketCanMatch, log: (log: any) => void): Promise<{ success: boolean }> => {\n\t//call matchmaking.confirmServerDetail(gameId, matchmakingTicketCanMatch, { ipV4Address: '127.0.0.1', ports: [{ name: 'GamePort', publicPort: 2202, privatePort: 3000, protocol: 1 }] }); // after setup success a dedicated server;\n\treturn { success: false };\n}\n",
|
|
26
34
|
"hasEdit": false
|
|
27
|
-
}
|
|
35
|
+
}
|
|
36
|
+
]
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"type": "systemAuthenticate",
|
|
40
|
+
"version": "FIRSTVER",
|
|
41
|
+
"fullScript": "// first full script",
|
|
42
|
+
"tsLastUpdate": 1736498427663,
|
|
43
|
+
"childScripts": [
|
|
28
44
|
{
|
|
29
|
-
"eventName": "
|
|
30
|
-
"script": "\nsystemAuthenticateHandlers.
|
|
45
|
+
"eventName": "systemAuthenticate_OnAuthenticateSuccess",
|
|
46
|
+
"script": "\nsystemAuthenticateHandlers.systemAuthenticate_OnAuthenticateSuccess = async (request: { userId: string, ipAddress: string, isNewUser: boolean, authenticationType: string }, secretInfo: SecretInfo, operationRequest: OperationRequest, operationResponse: OperationResponse, log: (log: any) => void) => {\n\n\treturn operationResponse;\n}\n",
|
|
31
47
|
"hasEdit": false
|
|
32
48
|
},
|
|
33
49
|
{
|
|
34
|
-
"eventName": "
|
|
35
|
-
"script": "\nsystemGenericServiceHandlers.
|
|
50
|
+
"eventName": "systemAuthenticate_VerifyGenericService",
|
|
51
|
+
"script": "\nsystemGenericServiceHandlers.systemAuthenticate_VerifyGenericService = async (serviceName: string, serviceData: { [k: string]: any; }, log: (log: any) => void): Promise<{ success: boolean, serviceId: string, someDatas?: any, errorMessage?: string }> => {\n\n\treturn { success: false, serviceId: null, };\n}\n",
|
|
52
|
+
"hasEdit": false
|
|
53
|
+
}
|
|
54
|
+
]
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"type": "event",
|
|
58
|
+
"version": "FIRSTVER",
|
|
59
|
+
"fullScript": "// first full script",
|
|
60
|
+
"tsLastUpdate": 1736498427663,
|
|
61
|
+
"childScripts": [
|
|
62
|
+
{
|
|
63
|
+
"eventName": "event_SendEventTo",
|
|
64
|
+
"script": "\neventHandlers.event_SendEventTo = async (request: { userId: string }, operationEvent: OperationEvent, log: (log: any) => void) => {\n\n}\n",
|
|
36
65
|
"hasEdit": false
|
|
37
66
|
},
|
|
38
67
|
{
|
|
39
|
-
"eventName": "
|
|
40
|
-
"script": "\neventHandlers.
|
|
68
|
+
"eventName": "event_SendEventToRoom",
|
|
69
|
+
"script": "\neventHandlers.event_SendEventToRoom = async (request: { roomId: string }, operationEvent: OperationEvent, log: (log: any) => void) => {\n\n}\n",
|
|
41
70
|
"hasEdit": false
|
|
42
71
|
},
|
|
43
72
|
{
|
|
44
|
-
"eventName": "
|
|
45
|
-
"script": "\neventHandlers.
|
|
73
|
+
"eventName": "event_SendEventToMoreUser",
|
|
74
|
+
"script": "\neventHandlers.event_SendEventToMoreUser = async (request: { userIds: string[] }, operationEvent: OperationEvent, log: (log: any) => void) => {\n\n}\n",
|
|
46
75
|
"hasEdit": false
|
|
47
76
|
},
|
|
48
77
|
{
|
|
49
|
-
"eventName": "
|
|
50
|
-
"script": "\neventHandlers.
|
|
78
|
+
"eventName": "event_SendEventToAllPlayer",
|
|
79
|
+
"script": "\neventHandlers.event_SendEventToAllPlayer = async (request: {}, operationEvent: OperationEvent, log: (log: any) => void) => {\n\n}\n",
|
|
80
|
+
"hasEdit": false
|
|
81
|
+
}
|
|
82
|
+
]
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"type": "socket",
|
|
86
|
+
"version": "FIRSTVER",
|
|
87
|
+
"fullScript": "// first full script",
|
|
88
|
+
"tsLastUpdate": 1736498427663,
|
|
89
|
+
"childScripts": [
|
|
90
|
+
{
|
|
91
|
+
"eventName": "socket_OnSocketConnected",
|
|
92
|
+
"script": "\nsocketHandlers.socket_OnSocketConnected = async (userId: string, socketId: string, log: (log: any) => void) => {\n\n}\n",
|
|
51
93
|
"hasEdit": false
|
|
52
94
|
},
|
|
53
95
|
{
|
|
54
|
-
"eventName": "
|
|
55
|
-
"script": "\
|
|
96
|
+
"eventName": "socket_OnSocketDisconnected",
|
|
97
|
+
"script": "\nsocketHandlers.socket_OnSocketDisconnected = async (userId: string, socketId: string, log: (log: any) => void) => {\n\n}\n",
|
|
56
98
|
"hasEdit": false
|
|
57
99
|
}
|
|
58
100
|
]
|
|
@@ -446,7 +488,7 @@
|
|
|
446
488
|
},
|
|
447
489
|
{
|
|
448
490
|
"eventName": "cloudScript_ExecuteFunction",
|
|
449
|
-
"script": "\npreHandlers.cloudScript_ExecuteFunction = async (request: { userId: string, functionName: string, functionParameters:
|
|
491
|
+
"script": "\npreHandlers.cloudScript_ExecuteFunction = async (request: { userId: string, functionName: string, functionParameters: any, version: string }, secretInfo: SecretInfo, operationRequest: OperationRequest, log: (log: any) => void) => {\n\n\treturn null;\n}\n\npostHandlers.cloudScript_ExecuteFunction = async (request: { userId: string, functionName: string, functionParameters: any, version: string }, secretInfo: SecretInfo, operationRequest: OperationRequest, operationResponse: OperationResponse, log: (log: any) => void) => {\n\n\treturn operationResponse;\n}\n",
|
|
450
492
|
"hasEdit": false
|
|
451
493
|
},
|
|
452
494
|
{
|