@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
package/dist/GN-app-api/handler/controller/handler/cloudScript/ExecuteFunctionRequestHandler.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { RequestHandler } from "./../base/RequestHandler";
|
|
|
6
6
|
declare class ExecuteFunctionOperationRequest extends OperationRequest {
|
|
7
7
|
userId?: string;
|
|
8
8
|
functionName: string;
|
|
9
|
-
functionParameters?:
|
|
9
|
+
functionParameters?: any;
|
|
10
10
|
version?: string;
|
|
11
11
|
isValidRequest(): boolean;
|
|
12
12
|
}
|
package/dist/GN-app-api/handler/controller/handler/masterPlayer/SetPlayerBanRequestHandler.d.ts
CHANGED
|
@@ -16,5 +16,7 @@ export declare class SetPlayerBanRequestHandler extends MasterPlayerBaseRequestH
|
|
|
16
16
|
serverHandle(secretInfo: SecretInfo, operationRequest: OperationRequest): Promise<OperationResponse>;
|
|
17
17
|
adminHandle(secretInfo: SecretInfo, operationRequest: OperationRequest): Promise<OperationResponse>;
|
|
18
18
|
private execute;
|
|
19
|
+
private setPlayerBan;
|
|
20
|
+
protected init(): void;
|
|
19
21
|
}
|
|
20
22
|
export {};
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { GNServer } from "./../../GNServer";
|
|
2
|
+
import { MatchmakingTicketCanMatch } from "./../service/IMatchmakingService";
|
|
3
|
+
import { ServerDetail } from "./../../GN-library/xdatabase/lib/entity/pro/ServerDetail";
|
|
4
|
+
export declare enum CloudScriptEventType {
|
|
5
|
+
SendEventToOne = 0,
|
|
6
|
+
SendEventToMore = 1,
|
|
7
|
+
SendEventToAll = 2,
|
|
8
|
+
JoinRoom = 3,
|
|
9
|
+
LeaveRoom = 4,
|
|
10
|
+
SendEventToRoom = 5,
|
|
11
|
+
ConfirmServerDetail = 10,
|
|
12
|
+
SendMailToOne = 20,
|
|
13
|
+
SendMailToMore = 21,
|
|
14
|
+
SendPushNotificationToOne = 30,
|
|
15
|
+
SendPushNotificationToMore = 31,
|
|
16
|
+
SendPushNotificationToTopic = 32,
|
|
17
|
+
SubscribeToTopic = 33,
|
|
18
|
+
UnsubscribeFromTopic = 34
|
|
19
|
+
}
|
|
20
|
+
interface CloudScriptEventSendEventToOne {
|
|
21
|
+
eventType: CloudScriptEventType.SendEventToOne;
|
|
22
|
+
operationEvent: {
|
|
23
|
+
eventCode: string;
|
|
24
|
+
parameters: {};
|
|
25
|
+
};
|
|
26
|
+
userId: string;
|
|
27
|
+
}
|
|
28
|
+
interface CloudScriptEventSendEventToMore {
|
|
29
|
+
eventType: CloudScriptEventType.SendEventToMore;
|
|
30
|
+
operationEvent: {
|
|
31
|
+
eventCode: string;
|
|
32
|
+
parameters: {};
|
|
33
|
+
};
|
|
34
|
+
userIds: string[];
|
|
35
|
+
}
|
|
36
|
+
interface CloudScriptEventSendEventToAll {
|
|
37
|
+
eventType: CloudScriptEventType.SendEventToAll;
|
|
38
|
+
operationEvent: {
|
|
39
|
+
eventCode: string;
|
|
40
|
+
parameters: {};
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
interface CloudScriptEventJoinRoom {
|
|
44
|
+
eventType: CloudScriptEventType.JoinRoom;
|
|
45
|
+
userId: string;
|
|
46
|
+
roomId: string;
|
|
47
|
+
}
|
|
48
|
+
interface CloudScriptEventLeaveRoom {
|
|
49
|
+
eventType: CloudScriptEventType.LeaveRoom;
|
|
50
|
+
userId: string;
|
|
51
|
+
roomId: string;
|
|
52
|
+
}
|
|
53
|
+
interface CloudScriptEventSendEventToRoom {
|
|
54
|
+
eventType: CloudScriptEventType.SendEventToRoom;
|
|
55
|
+
roomId: string;
|
|
56
|
+
operationEvent: {
|
|
57
|
+
eventCode: string;
|
|
58
|
+
parameters: {};
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
interface CloudScriptEventConfirmServerDetail {
|
|
62
|
+
eventType: CloudScriptEventType.ConfirmServerDetail;
|
|
63
|
+
gameId: string;
|
|
64
|
+
matchmakingTicketCanMatch: MatchmakingTicketCanMatch;
|
|
65
|
+
serverDetail: ServerDetail;
|
|
66
|
+
}
|
|
67
|
+
interface CloudScriptEventSendMailToOne {
|
|
68
|
+
eventType: CloudScriptEventType.SendMailToOne;
|
|
69
|
+
mailData: {
|
|
70
|
+
subject: string;
|
|
71
|
+
contentHtml: string;
|
|
72
|
+
};
|
|
73
|
+
email: string;
|
|
74
|
+
}
|
|
75
|
+
interface CloudScriptEventSendMailToMore {
|
|
76
|
+
eventType: CloudScriptEventType.SendMailToMore;
|
|
77
|
+
mailData: {
|
|
78
|
+
subject: string;
|
|
79
|
+
contentHtml: string;
|
|
80
|
+
};
|
|
81
|
+
emails: string[];
|
|
82
|
+
}
|
|
83
|
+
interface CloudScriptEventSendPushNotificationToOne {
|
|
84
|
+
eventType: CloudScriptEventType.SendPushNotificationToOne;
|
|
85
|
+
pushData: {
|
|
86
|
+
title: string;
|
|
87
|
+
body: string;
|
|
88
|
+
badge?: number;
|
|
89
|
+
sound?: string;
|
|
90
|
+
icon?: string;
|
|
91
|
+
data?: {
|
|
92
|
+
[k: string]: any;
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
token: string;
|
|
96
|
+
}
|
|
97
|
+
interface CloudScriptEventSendPushNotificationToMore {
|
|
98
|
+
eventType: CloudScriptEventType.SendPushNotificationToMore;
|
|
99
|
+
pushData: {
|
|
100
|
+
title: string;
|
|
101
|
+
body: string;
|
|
102
|
+
badge?: number;
|
|
103
|
+
sound?: string;
|
|
104
|
+
icon?: string;
|
|
105
|
+
data?: {
|
|
106
|
+
[k: string]: any;
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
tokens: string[];
|
|
110
|
+
}
|
|
111
|
+
interface CloudScriptEventSendPushNotificationToTopic {
|
|
112
|
+
eventType: CloudScriptEventType.SendPushNotificationToTopic;
|
|
113
|
+
pushData: {
|
|
114
|
+
title: string;
|
|
115
|
+
body: string;
|
|
116
|
+
badge?: number;
|
|
117
|
+
sound?: string;
|
|
118
|
+
icon?: string;
|
|
119
|
+
data?: {
|
|
120
|
+
[k: string]: any;
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
topic: string;
|
|
124
|
+
}
|
|
125
|
+
interface CloudScriptEventSubscribeToTopic {
|
|
126
|
+
eventType: CloudScriptEventType.SubscribeToTopic;
|
|
127
|
+
tokens: string[];
|
|
128
|
+
topic: string;
|
|
129
|
+
}
|
|
130
|
+
interface CloudScriptEventUnsubscribeFromTopic {
|
|
131
|
+
eventType: CloudScriptEventType.UnsubscribeFromTopic;
|
|
132
|
+
tokens: string[];
|
|
133
|
+
topic: string;
|
|
134
|
+
}
|
|
135
|
+
export type CloudScriptEvent = CloudScriptEventSendEventToOne | CloudScriptEventSendEventToMore | CloudScriptEventSendEventToAll | CloudScriptEventJoinRoom | CloudScriptEventLeaveRoom | CloudScriptEventSendEventToRoom | CloudScriptEventConfirmServerDetail | CloudScriptEventSendMailToOne | CloudScriptEventSendMailToMore | CloudScriptEventSendPushNotificationToOne | CloudScriptEventSendPushNotificationToMore | CloudScriptEventSendPushNotificationToTopic | CloudScriptEventSubscribeToTopic | CloudScriptEventUnsubscribeFromTopic;
|
|
136
|
+
export interface ICloudScriptEventService {
|
|
137
|
+
handleEvent(cloudScriptEvent: CloudScriptEvent): Promise<void>;
|
|
138
|
+
}
|
|
139
|
+
export declare class CloudScriptEventService implements ICloudScriptEventService {
|
|
140
|
+
private gnServer;
|
|
141
|
+
init(gnServer: GNServer): void;
|
|
142
|
+
handleEvent(cloudScriptEvent: CloudScriptEvent): Promise<void>;
|
|
143
|
+
}
|
|
144
|
+
export {};
|
|
@@ -30,7 +30,7 @@ export declare class CloudScriptService implements ICloudScriptService {
|
|
|
30
30
|
setCloudScriptFunctionLogCollection(cloudScriptFunctionLogCollection: mongoDB.Collection<mongoDB.Document>): void;
|
|
31
31
|
run(): void;
|
|
32
32
|
private loadVersion;
|
|
33
|
-
executeCloudScriptFunction(userId: string, functionName: string, functionParameters:
|
|
33
|
+
executeCloudScriptFunction(userId: string, functionName: string, functionParameters: any, version: string, customTags: {
|
|
34
34
|
[k: string]: any;
|
|
35
35
|
}): Promise<ExecuteResult>;
|
|
36
36
|
addCloudScriptFunction(script: string, isLive: boolean, canExecute: boolean): Promise<{
|
|
@@ -6,7 +6,7 @@ import * as mongoDB from "mongodb";
|
|
|
6
6
|
import { GNServer } from "./../../GNServer";
|
|
7
7
|
import { GNServerSettingsOptions } from "@xmobitea/gn-typescript-client";
|
|
8
8
|
import { OperationEvent } from "./../../GN-common/entity/operationEvent/OperationEvent";
|
|
9
|
-
import { MatchmakingTicketCanMatch } from "./../
|
|
9
|
+
import { MatchmakingTicketCanMatch } from "./../service/IMatchmakingService";
|
|
10
10
|
interface DbConnection {
|
|
11
11
|
url: string;
|
|
12
12
|
dbName: string;
|
|
@@ -40,7 +40,7 @@ export interface IEventCallbackCloudScriptService {
|
|
|
40
40
|
executePre(eventName: string, request: {
|
|
41
41
|
[k: string]: any;
|
|
42
42
|
}, secretInfo: SecretInfo, operationRequest: OperationRequest): Promise<OperationResponse>;
|
|
43
|
-
executeAuthenticate(
|
|
43
|
+
executeAuthenticate(request: {
|
|
44
44
|
userId: string;
|
|
45
45
|
ipAddress: string;
|
|
46
46
|
isNewUser: boolean;
|
|
@@ -54,6 +54,9 @@ export interface IEventCallbackCloudScriptService {
|
|
|
54
54
|
someDatas?: any;
|
|
55
55
|
errorMessage?: string;
|
|
56
56
|
}>;
|
|
57
|
+
executeSocket(eventName: string, request: {
|
|
58
|
+
[k: string]: any;
|
|
59
|
+
}): Promise<void>;
|
|
57
60
|
addCloudScriptFunction(eventName: string, script: string): Promise<{
|
|
58
61
|
success: boolean;
|
|
59
62
|
errorMessage?: string;
|
|
@@ -120,7 +123,7 @@ export declare class EventCallbackCloudScriptService implements IEventCallbackCl
|
|
|
120
123
|
someDatas?: any;
|
|
121
124
|
errorMessage?: string;
|
|
122
125
|
}>;
|
|
123
|
-
executeAuthenticate(
|
|
126
|
+
executeAuthenticate(request: {
|
|
124
127
|
userId: string;
|
|
125
128
|
ipAddress: string;
|
|
126
129
|
isNewUser: boolean;
|
|
@@ -129,6 +132,9 @@ export declare class EventCallbackCloudScriptService implements IEventCallbackCl
|
|
|
129
132
|
executePost(eventName: string, request: {
|
|
130
133
|
[k: string]: any;
|
|
131
134
|
}, secretInfo: SecretInfo, operationRequest: OperationRequest, operationResponse: OperationResponse): Promise<void>;
|
|
135
|
+
executeSocket(eventName: string, request: {
|
|
136
|
+
[k: string]: any;
|
|
137
|
+
}): Promise<void>;
|
|
132
138
|
private loadCloudScriptFunctionWorkerFromCache;
|
|
133
139
|
addCloudScriptFunction(eventName: string, script: string): Promise<{
|
|
134
140
|
success: boolean;
|
|
@@ -149,20 +155,6 @@ export declare class PostEventCallbackService implements IPostEventCallbackServi
|
|
|
149
155
|
setEventCallbackLogCollection(eventCallbackLogCollection: mongoDB.Collection<mongoDB.Document>): void;
|
|
150
156
|
setCloudScriptService(cloudScriptService: IEventCallbackCloudScriptService): void;
|
|
151
157
|
onEvent(eventName: string, request: {}, secretInfo: SecretInfo, operationRequest: OperationRequest, operationResponse: OperationResponse): Promise<void>;
|
|
152
|
-
onAuthenticateEvent(eventName: string, request: {
|
|
153
|
-
userId: string;
|
|
154
|
-
ipAddress: string;
|
|
155
|
-
isNewUser: boolean;
|
|
156
|
-
authenticationType: string;
|
|
157
|
-
}, secretInfo: SecretInfo, operationRequest: OperationRequest, operationResponse: OperationResponse): Promise<void>;
|
|
158
|
-
onVerifyGenericService(serviceName: string, serviceData: {
|
|
159
|
-
[k: string]: any;
|
|
160
|
-
}): Promise<{
|
|
161
|
-
success: boolean;
|
|
162
|
-
serviceId: string;
|
|
163
|
-
someDatas?: any;
|
|
164
|
-
errorMessage?: string;
|
|
165
|
-
}>;
|
|
166
158
|
}
|
|
167
159
|
export declare class PreEventCallbackService implements IPreEventCallbackService {
|
|
168
160
|
private eventDict;
|
|
@@ -13,12 +13,12 @@ export interface ExecuteResult {
|
|
|
13
13
|
response: {
|
|
14
14
|
status: ExecuteResponseStatus;
|
|
15
15
|
result: any;
|
|
16
|
-
errorMessage:
|
|
16
|
+
errorMessage: string;
|
|
17
17
|
};
|
|
18
18
|
logs: string[];
|
|
19
19
|
}
|
|
20
20
|
export interface ICloudScriptService {
|
|
21
|
-
executeCloudScriptFunction(userId: string, functionName: string, functionParameters:
|
|
21
|
+
executeCloudScriptFunction(userId: string, functionName: string, functionParameters: any, version: string, customTags: {
|
|
22
22
|
[k: string]: any;
|
|
23
23
|
}): Promise<ExecuteResult>;
|
|
24
24
|
addCloudScriptFunction(script: string, isLive: boolean, canExecute: boolean): Promise<{
|
|
@@ -8,20 +8,6 @@ export interface IPostEventCallbackService {
|
|
|
8
8
|
subscriberEvent(eventName: string, callbackFunction: OnPostCallbackFunction): void;
|
|
9
9
|
unSubscriberEvent(eventName: string, callbackFunction: OnPostCallbackFunction): void;
|
|
10
10
|
onEvent(eventName: string, request: {}, secretInfo: SecretInfo, operationRequest: OperationRequest, operationResponse: OperationResponse): Promise<void>;
|
|
11
|
-
onAuthenticateEvent(eventName: string, request: {
|
|
12
|
-
userId: string;
|
|
13
|
-
ipAddress: string;
|
|
14
|
-
isNewUser: boolean;
|
|
15
|
-
authenticationType: string;
|
|
16
|
-
}, secretInfo: SecretInfo, operationRequest: OperationRequest, operationResponse: OperationResponse): Promise<void>;
|
|
17
|
-
onVerifyGenericService(serviceName: string, serviceData: {
|
|
18
|
-
[k: string]: any;
|
|
19
|
-
}): Promise<{
|
|
20
|
-
success: boolean;
|
|
21
|
-
serviceId: string;
|
|
22
|
-
someDatas?: any;
|
|
23
|
-
errorMessage?: string;
|
|
24
|
-
}>;
|
|
25
11
|
}
|
|
26
12
|
export interface OnPreCallbackFunction {
|
|
27
13
|
(request: {}, secretInfo: SecretInfo, operationRequest: OperationRequest): Promise<OperationResponse>;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { DataValueType } from "
|
|
2
|
-
import { GNServer } from "./../../../../../GNServer";
|
|
1
|
+
import { DataValueType } from "../../GN-library/xdatabase/lib/entity/pro/type/DataValueType";
|
|
3
2
|
export interface MatchmakingTicketCanMatch {
|
|
4
3
|
matchId: string;
|
|
5
4
|
queueName: string;
|
|
@@ -41,22 +40,6 @@ export interface MatchmakingTicketCanMatch {
|
|
|
41
40
|
};
|
|
42
41
|
}[];
|
|
43
42
|
}
|
|
44
|
-
export
|
|
45
|
-
private gnServer;
|
|
46
|
-
setGNServer(gnServer: GNServer): void;
|
|
43
|
+
export interface IMatchmakingService {
|
|
47
44
|
handle(gameId: string): Promise<MatchmakingTicketCanMatch[]>;
|
|
48
|
-
private getMatchmakingTicketCanMatchs;
|
|
49
|
-
private isMatchSizeValid;
|
|
50
|
-
private isTeamSizeValid;
|
|
51
|
-
private isTeamTicketSizeBalanceValid;
|
|
52
|
-
private isTeamDifferenceValid;
|
|
53
|
-
private isMatchTotalValid;
|
|
54
|
-
private isStringValid;
|
|
55
|
-
private isDifferenceValid;
|
|
56
|
-
private isRegionSelectionValid;
|
|
57
|
-
private isSetIntersectionValid;
|
|
58
|
-
private isTeamTicketSizeSimilarityValid;
|
|
59
|
-
private removeMatchmakingTicketNotCorrect;
|
|
60
|
-
private createMatch;
|
|
61
|
-
private removeGiveUpTickets;
|
|
62
45
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { GNServer } from "./../../GNServer";
|
|
2
|
+
import { IMatchmakingService, MatchmakingTicketCanMatch } from "./IMatchmakingService";
|
|
3
|
+
export declare class MatchmakingService implements IMatchmakingService {
|
|
4
|
+
private gnServer;
|
|
5
|
+
setGNServer(gnServer: GNServer): void;
|
|
6
|
+
handle(gameId: string): Promise<MatchmakingTicketCanMatch[]>;
|
|
7
|
+
private getMatchmakingTicketCanMatchs;
|
|
8
|
+
private isMatchSizeValid;
|
|
9
|
+
private isTeamSizeValid;
|
|
10
|
+
private isTeamTicketSizeBalanceValid;
|
|
11
|
+
private isTeamDifferenceValid;
|
|
12
|
+
private isMatchTotalValid;
|
|
13
|
+
private isStringValid;
|
|
14
|
+
private isDifferenceValid;
|
|
15
|
+
private isRegionSelectionValid;
|
|
16
|
+
private isSetIntersectionValid;
|
|
17
|
+
private isTeamTicketSizeSimilarityValid;
|
|
18
|
+
private removeMatchmakingTicketNotCorrect;
|
|
19
|
+
private createMatch;
|
|
20
|
+
private removeGiveUpTickets;
|
|
21
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GNNetwork,
|
|
3
|
+
Action1,
|
|
4
|
+
GNHashtable,
|
|
5
|
+
RequestType,
|
|
6
|
+
RequestRole,
|
|
7
|
+
OperationRequest,
|
|
8
|
+
OperationResponse,
|
|
9
|
+
} from "@xmobitea/gn-typescript-client";
|
|
10
|
+
|
|
11
|
+
export class CloudScriptAdmin {
|
|
12
|
+
public readonly characterPlayer = GNNetwork.characterPlayer.admin;
|
|
13
|
+
public readonly content = GNNetwork.content.admin;
|
|
14
|
+
public readonly gamePlayer = GNNetwork.gamePlayer.admin;
|
|
15
|
+
public readonly group = GNNetwork.group.admin;
|
|
16
|
+
public readonly inventory = GNNetwork.inventory.admin;
|
|
17
|
+
public readonly masterPlayer = GNNetwork.masterPlayer.admin;
|
|
18
|
+
public readonly storeInventory = GNNetwork.storeInventory.admin;
|
|
19
|
+
public readonly multiplayer = GNNetwork.multiplayer.admin;
|
|
20
|
+
public readonly cloudScript = GNNetwork.cloudScript.admin;
|
|
21
|
+
public readonly dashboard = {
|
|
22
|
+
getAdminAccountList: GNNetwork.dashboard.getAdminAccountList,
|
|
23
|
+
getAdminAccountListAsync: GNNetwork.dashboard.getAdminAccountListAsync,
|
|
24
|
+
getGameInformation: GNNetwork.dashboard.getGameInformation,
|
|
25
|
+
getGameInformationAsync: GNNetwork.dashboard.getGameInformationAsync,
|
|
26
|
+
getGameList: GNNetwork.dashboard.getGameList,
|
|
27
|
+
getGameListAsync: GNNetwork.dashboard.getGameListAsync,
|
|
28
|
+
getMasterGameSettings: GNNetwork.dashboard.getMasterGameSettings,
|
|
29
|
+
getMasterGameSettingsAsync: GNNetwork.dashboard.getMasterGameSettingsAsync,
|
|
30
|
+
getSecretInfoInformation: GNNetwork.dashboard.getSecretInfoInformation,
|
|
31
|
+
getSecretInfoInformationAsync: GNNetwork.dashboard.getSecretInfoInformationAsync,
|
|
32
|
+
getSecretInfoList: GNNetwork.dashboard.getSecretInfoList,
|
|
33
|
+
getSecretInfoListAsync: GNNetwork.dashboard.getSecretInfoListAsync,
|
|
34
|
+
getServerLog: GNNetwork.dashboard.getServerLog,
|
|
35
|
+
getServerLogAsync: GNNetwork.dashboard.getServerLogAsync,
|
|
36
|
+
setGameInformation: GNNetwork.dashboard.setGameInformation,
|
|
37
|
+
setGameInformationAsync: GNNetwork.dashboard.setGameInformationAsync,
|
|
38
|
+
getUsernameAdminAccount: GNNetwork.dashboard.getUsernameAdminAccount,
|
|
39
|
+
getUsernameAdminAccountAsync: GNNetwork.dashboard.getUsernameAdminAccountAsync,
|
|
40
|
+
getAnalytics: GNNetwork.dashboard.getAnalytics,
|
|
41
|
+
getAnalyticsAsync: GNNetwork.dashboard.getAnalyticsAsync,
|
|
42
|
+
resetStatisticsLeaderboard: GNNetwork.dashboard.resetStatisticsLeaderboard,
|
|
43
|
+
resetStatisticsLeaderboardAsync: GNNetwork.dashboard.resetStatisticsLeaderboardAsync,
|
|
44
|
+
getBackupStatisticsLeaderboardVersion: GNNetwork.dashboard.getBackupStatisticsLeaderboardVersion,
|
|
45
|
+
getBackupStatisticsLeaderboardVersionAsync: GNNetwork.dashboard.getBackupStatisticsLeaderboardVersionAsync,
|
|
46
|
+
getServerGameData: GNNetwork.dashboard.getServerGameData,
|
|
47
|
+
getServerGameDataAsync: GNNetwork.dashboard.getServerGameDataAsync,
|
|
48
|
+
deleteInDatabase: GNNetwork.dashboard.deleteInDatabase,
|
|
49
|
+
deleteInDatabaseAsync: GNNetwork.dashboard.deleteInDatabaseAsync,
|
|
50
|
+
};
|
|
51
|
+
public send(
|
|
52
|
+
requestType: RequestType,
|
|
53
|
+
role: RequestRole,
|
|
54
|
+
request: OperationRequest,
|
|
55
|
+
onResponse: Action1<OperationResponse>,
|
|
56
|
+
overrideAuthToken: string,
|
|
57
|
+
overrideSecretKey: string,
|
|
58
|
+
customTags: GNHashtable
|
|
59
|
+
): void {
|
|
60
|
+
GNNetwork.sendViaHttp(requestType, role, request, onResponse, overrideAuthToken, overrideSecretKey, customTags);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
public sendAsync(
|
|
64
|
+
requestType: RequestType,
|
|
65
|
+
role: RequestRole,
|
|
66
|
+
request: OperationRequest,
|
|
67
|
+
overrideAuthToken: string,
|
|
68
|
+
overrideSecretKey: string,
|
|
69
|
+
customTags: GNHashtable
|
|
70
|
+
): Promise<OperationResponse> {
|
|
71
|
+
return GNNetwork.sendViaHttpAsync(requestType, role, request, overrideAuthToken, overrideSecretKey, customTags);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import * as mongodb from "mongodb";
|
|
2
|
+
|
|
3
|
+
export class CloudScriptDatabase {
|
|
4
|
+
private static readonly DOT: string = ".";
|
|
5
|
+
private static readonly RUNTIME: string = "Runtime" + CloudScriptDatabase.DOT;
|
|
6
|
+
private static readonly META: string = "Meta" + CloudScriptDatabase.DOT;
|
|
7
|
+
private static readonly SYSTEM: string = "System" + CloudScriptDatabase.DOT;
|
|
8
|
+
|
|
9
|
+
private client: mongodb.MongoClient;
|
|
10
|
+
private db: mongodb.Db;
|
|
11
|
+
|
|
12
|
+
private logClient: mongodb.MongoClient;
|
|
13
|
+
private logDb: mongodb.Db;
|
|
14
|
+
|
|
15
|
+
init(url: string, dbName: string, logUrl: string, logDbName: string, options?: mongodb.MongoClientOptions): void {
|
|
16
|
+
this.client = new mongodb.MongoClient(url, options);
|
|
17
|
+
|
|
18
|
+
this.db = this.client.db(dbName);
|
|
19
|
+
|
|
20
|
+
if (!logUrl || logUrl == "" || logUrl == url) {
|
|
21
|
+
this.logClient = this.client;
|
|
22
|
+
this.logDb = this.db;
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
this.logClient = new mongodb.MongoClient(logUrl, options);
|
|
26
|
+
this.logDb = this.logClient.db(logDbName);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
public runtimeCollection<TSchema extends mongodb.Document = mongodb.Document>(collectionName: string): mongodb.Collection<TSchema> {
|
|
31
|
+
return this.collection<TSchema>(CloudScriptDatabase.RUNTIME + collectionName);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
public metaCollection<TSchema extends mongodb.Document = mongodb.Document>(collectionName: string): mongodb.Collection<TSchema> {
|
|
35
|
+
return this.collection<TSchema>(CloudScriptDatabase.META + collectionName);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
public systemCollection<TSchema extends mongodb.Document = mongodb.Document>(collectionName: string): mongodb.Collection<TSchema> {
|
|
39
|
+
return this.collection<TSchema>(CloudScriptDatabase.SYSTEM + collectionName);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
public runtimeGameCollection<TSchema extends mongodb.Document = mongodb.Document>(collectionName: string, gameId: string): mongodb.Collection<TSchema> {
|
|
43
|
+
return this.collection<TSchema>(CloudScriptDatabase.RUNTIME + gameId + CloudScriptDatabase.DOT + collectionName);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
public metaGameCollection<TSchema extends mongodb.Document = mongodb.Document>(collectionName: string, gameId: string): mongodb.Collection<TSchema> {
|
|
47
|
+
return this.collection<TSchema>(CloudScriptDatabase.META + gameId + CloudScriptDatabase.DOT + collectionName);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
public systemGameCollection<TSchema extends mongodb.Document = mongodb.Document>(collectionName: string, gameId: string): mongodb.Collection<TSchema> {
|
|
51
|
+
return this.collection<TSchema>(CloudScriptDatabase.SYSTEM + gameId + CloudScriptDatabase.DOT + collectionName);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
public collection<TSchema extends mongodb.Document = mongodb.Document>(fullCollectionName: string): mongodb.Collection<TSchema> {
|
|
55
|
+
return this.db.collection<TSchema>(fullCollectionName);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
public createCollection(name: string, options?: mongodb.CreateCollectionOptions): Promise<mongodb.Collection<mongodb.BSON.Document>> {
|
|
59
|
+
return this.db.createCollection(name, options);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
public logRuntimeCollection<TSchema extends mongodb.Document = mongodb.Document>(collectionName: string): mongodb.Collection<TSchema> {
|
|
63
|
+
return this.logCollection<TSchema>(CloudScriptDatabase.RUNTIME + collectionName);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
public logMetaCollection<TSchema extends mongodb.Document = mongodb.Document>(collectionName: string): mongodb.Collection<TSchema> {
|
|
67
|
+
return this.logCollection<TSchema>(CloudScriptDatabase.META + collectionName);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
public logSystemCollection<TSchema extends mongodb.Document = mongodb.Document>(collectionName: string): mongodb.Collection<TSchema> {
|
|
71
|
+
return this.logCollection<TSchema>(CloudScriptDatabase.SYSTEM + collectionName);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
public logRuntimeGameCollection<TSchema extends mongodb.Document = mongodb.Document>(collectionName: string, gameId: string): mongodb.Collection<TSchema> {
|
|
75
|
+
return this.logCollection<TSchema>(CloudScriptDatabase.RUNTIME + gameId + CloudScriptDatabase.DOT + collectionName);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
public logMetaGameCollection<TSchema extends mongodb.Document = mongodb.Document>(collectionName: string, gameId: string): mongodb.Collection<TSchema> {
|
|
79
|
+
return this.logCollection<TSchema>(CloudScriptDatabase.META + gameId + CloudScriptDatabase.DOT + collectionName);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
public logSystemGameCollection<TSchema extends mongodb.Document = mongodb.Document>(collectionName: string, gameId: string): mongodb.Collection<TSchema> {
|
|
83
|
+
return this.logCollection<TSchema>(CloudScriptDatabase.SYSTEM + gameId + CloudScriptDatabase.DOT + collectionName);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
public logCollection<TSchema extends mongodb.Document = mongodb.Document>(fullCollectionName: string): mongodb.Collection<TSchema> {
|
|
87
|
+
return this.logDb.collection<TSchema>(fullCollectionName);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
public logCreateCollection<TSchema extends mongodb.Document = mongodb.Document>(collectionName: string, options?: mongodb.CreateCollectionOptions) {
|
|
91
|
+
return this.logDb.createCollection<TSchema>(collectionName, options)
|
|
92
|
+
}
|
|
93
|
+
}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { MatchmakingTicketCanMatch, ServerDetail } from "./../../index";
|
|
2
|
+
|
|
3
|
+
export enum CloudScriptEventType {
|
|
4
|
+
SendEventToOne = 0,
|
|
5
|
+
SendEventToMore = 1,
|
|
6
|
+
SendEventToAll = 2,
|
|
7
|
+
JoinRoom = 3,
|
|
8
|
+
LeaveRoom = 4,
|
|
9
|
+
SendEventToRoom = 5,
|
|
10
|
+
|
|
11
|
+
ConfirmServerDetail = 10,
|
|
12
|
+
|
|
13
|
+
SendMailToOne = 20,
|
|
14
|
+
SendMailToMore = 21,
|
|
15
|
+
|
|
16
|
+
SendPushNotificationToOne = 30,
|
|
17
|
+
SendPushNotificationToMore = 31,
|
|
18
|
+
SendPushNotificationToTopic = 32,
|
|
19
|
+
SubscribeToTopic = 33,
|
|
20
|
+
UnsubscribeFromTopic = 34,
|
|
21
|
+
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
interface CloudScriptEventSendEventToOne {
|
|
25
|
+
eventType: CloudScriptEventType.SendEventToOne;
|
|
26
|
+
operationEvent: {
|
|
27
|
+
eventCode: string;
|
|
28
|
+
parameters: {};
|
|
29
|
+
};
|
|
30
|
+
userId: string;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
interface CloudScriptEventSendEventToMore {
|
|
34
|
+
eventType: CloudScriptEventType.SendEventToMore;
|
|
35
|
+
operationEvent: {
|
|
36
|
+
eventCode: string;
|
|
37
|
+
parameters: {};
|
|
38
|
+
};
|
|
39
|
+
userIds: string[];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
interface CloudScriptEventSendEventToAll {
|
|
43
|
+
eventType: CloudScriptEventType.SendEventToAll;
|
|
44
|
+
operationEvent: {
|
|
45
|
+
eventCode: string;
|
|
46
|
+
parameters: {};
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
interface CloudScriptEventJoinRoom {
|
|
51
|
+
eventType: CloudScriptEventType.JoinRoom;
|
|
52
|
+
userId: string;
|
|
53
|
+
roomId: string;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
interface CloudScriptEventLeaveRoom {
|
|
57
|
+
eventType: CloudScriptEventType.LeaveRoom;
|
|
58
|
+
userId: string;
|
|
59
|
+
roomId: string;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
interface CloudScriptEventSendEventToRoom {
|
|
63
|
+
eventType: CloudScriptEventType.SendEventToRoom;
|
|
64
|
+
roomId: string;
|
|
65
|
+
operationEvent: {
|
|
66
|
+
eventCode: string;
|
|
67
|
+
parameters: {};
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
interface CloudScriptEventConfirmServerDetail {
|
|
72
|
+
eventType: CloudScriptEventType.ConfirmServerDetail;
|
|
73
|
+
gameId: string;
|
|
74
|
+
matchmakingTicketCanMatch: MatchmakingTicketCanMatch;
|
|
75
|
+
serverDetail: ServerDetail;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
interface CloudScriptEventSendMailToOne {
|
|
79
|
+
eventType: CloudScriptEventType.SendMailToOne;
|
|
80
|
+
mailData: {
|
|
81
|
+
subject: string;
|
|
82
|
+
contentHtml: string;
|
|
83
|
+
};
|
|
84
|
+
email: string;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
interface CloudScriptEventSendMailToMore {
|
|
88
|
+
eventType: CloudScriptEventType.SendMailToMore;
|
|
89
|
+
mailData: {
|
|
90
|
+
subject: string;
|
|
91
|
+
contentHtml: string;
|
|
92
|
+
};
|
|
93
|
+
emails: string[];
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
interface CloudScriptEventSendPushNotificationToOne {
|
|
97
|
+
eventType: CloudScriptEventType.SendPushNotificationToOne;
|
|
98
|
+
pushData: {
|
|
99
|
+
title: string;
|
|
100
|
+
body: string;
|
|
101
|
+
badge?: number;
|
|
102
|
+
sound?: string;
|
|
103
|
+
icon?: string;
|
|
104
|
+
data?: { [k: string]: any };
|
|
105
|
+
};
|
|
106
|
+
token: string;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
interface CloudScriptEventSendPushNotificationToMore {
|
|
110
|
+
eventType: CloudScriptEventType.SendPushNotificationToMore;
|
|
111
|
+
pushData: {
|
|
112
|
+
title: string;
|
|
113
|
+
body: string;
|
|
114
|
+
badge?: number;
|
|
115
|
+
sound?: string;
|
|
116
|
+
icon?: string;
|
|
117
|
+
data?: { [k: string]: any };
|
|
118
|
+
};
|
|
119
|
+
tokens: string[];
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
interface CloudScriptEventSendPushNotificationToTopic {
|
|
123
|
+
eventType: CloudScriptEventType.SendPushNotificationToTopic;
|
|
124
|
+
pushData: {
|
|
125
|
+
title: string;
|
|
126
|
+
body: string;
|
|
127
|
+
badge?: number;
|
|
128
|
+
sound?: string;
|
|
129
|
+
icon?: string;
|
|
130
|
+
data?: { [k: string]: any };
|
|
131
|
+
};
|
|
132
|
+
topic: string;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
interface CloudScriptEventSubscribeToTopic {
|
|
136
|
+
eventType: CloudScriptEventType.SubscribeToTopic;
|
|
137
|
+
tokens: string[];
|
|
138
|
+
topic: string;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
interface CloudScriptEventUnsubscribeFromTopic {
|
|
142
|
+
eventType: CloudScriptEventType.UnsubscribeFromTopic;
|
|
143
|
+
tokens: string[];
|
|
144
|
+
topic: string;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
type CloudScriptEvent = CloudScriptEventSendEventToOne | CloudScriptEventSendEventToMore | CloudScriptEventSendEventToAll | CloudScriptEventJoinRoom | CloudScriptEventLeaveRoom | CloudScriptEventSendEventToRoom
|
|
148
|
+
| CloudScriptEventConfirmServerDetail
|
|
149
|
+
| CloudScriptEventSendMailToOne | CloudScriptEventSendMailToMore
|
|
150
|
+
| CloudScriptEventSendPushNotificationToOne | CloudScriptEventSendPushNotificationToMore | CloudScriptEventSendPushNotificationToTopic | CloudScriptEventSubscribeToTopic | CloudScriptEventUnsubscribeFromTopic;
|
|
151
|
+
|
|
152
|
+
export class CloudScriptProcessBase {
|
|
153
|
+
protected async sendEvent(event: CloudScriptEvent) {
|
|
154
|
+
if (process?.send)
|
|
155
|
+
process.send(event);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
}
|