@xmobitea/gn-server 2.0.4 → 2.0.6
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.
|
@@ -1,10 +1,43 @@
|
|
|
1
1
|
import { InvalidMember } from "./../InvalidMember";
|
|
2
2
|
import { OperationResponse } from "./../operationResponse/OperationResponse";
|
|
3
|
+
import { OperationRequest } from "./../operationRequest/OperationRequest";
|
|
3
4
|
import { OperationEvent } from "./../operationEvent/OperationEvent";
|
|
5
|
+
import { Request } from "./../operationRequest/base/Request";
|
|
6
|
+
import { GNHashtable } from "./../../common/GNData";
|
|
4
7
|
export declare class OperationHelper {
|
|
5
8
|
private static invalidMemberData;
|
|
6
9
|
static toResponseSocketData(operationResponse: OperationResponse): [number, any, number];
|
|
7
10
|
static toResponseHttpData(operationResponse: OperationResponse): [number, any];
|
|
11
|
+
static toDataGNHashtable(gnHashtable: GNHashtable): {};
|
|
12
|
+
static toDataOperationResponse(operationResponse: OperationResponse): {
|
|
13
|
+
operationCode: string;
|
|
14
|
+
encrypted: boolean;
|
|
15
|
+
responseId: number;
|
|
16
|
+
parameters: {};
|
|
17
|
+
debugMessage: string;
|
|
18
|
+
returnCode: string;
|
|
19
|
+
};
|
|
20
|
+
static toDataOperationRequest(operationRequest: OperationRequest): {
|
|
21
|
+
operationCode: string;
|
|
22
|
+
encrypted: boolean;
|
|
23
|
+
requestId: number;
|
|
24
|
+
parameters: {};
|
|
25
|
+
};
|
|
26
|
+
static toDataFromRequest(request: Request): {
|
|
27
|
+
code: string;
|
|
28
|
+
type: string;
|
|
29
|
+
role: string;
|
|
30
|
+
ip: string;
|
|
31
|
+
secretInfo: {
|
|
32
|
+
role: string;
|
|
33
|
+
gameId: string;
|
|
34
|
+
};
|
|
35
|
+
authInfo: {
|
|
36
|
+
userId: string;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
private static toDataSecretInfo;
|
|
40
|
+
private static toAuthInfo;
|
|
8
41
|
static newOperationResponse(operationCode: number, responseId: number, encrypted: boolean): OperationResponse;
|
|
9
42
|
static newOperationResponseInvalid(operationCode: number, responseId: number, encrypted: boolean, debugMessage?: string): OperationResponse;
|
|
10
43
|
static newOperationResponseInvalidRequestParameters(operationCode: number, responseId: number, invalidMembers: InvalidMember[], encrypted: boolean, debugMessage?: string): OperationResponse;
|
package/dist/index.js
CHANGED
|
@@ -179,7 +179,7 @@ class LoginBaseRequestHandler extends RequestHandler_1.RequestHandler {
|
|
|
179
179
|
answer.countryCode = infoRequestParam.countryCode;
|
|
180
180
|
if (infoRequestParam.email)
|
|
181
181
|
answer.email = infoRequestParam.email;
|
|
182
|
-
|
|
182
|
+
answer.playerBan = true;
|
|
183
183
|
return answer;
|
|
184
184
|
}
|
|
185
185
|
generateInfoRequestParamForOwner(secretInfo, infoRequestParam) {
|
|
@@ -62425,6 +62425,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
62425
62425
|
};
|
|
62426
62426
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
62427
62427
|
exports.PreEventCallbackService = exports.PostEventCallbackService = void 0;
|
|
62428
|
+
const OperationHelper_1 = __webpack_require__(7440);
|
|
62428
62429
|
const xDatetime_1 = __webpack_require__(1308);
|
|
62429
62430
|
const xDebug_1 = __webpack_require__(9343);
|
|
62430
62431
|
class PostEventCallbackService {
|
|
@@ -62457,8 +62458,9 @@ class PostEventCallbackService {
|
|
|
62457
62458
|
eventName: eventName,
|
|
62458
62459
|
tsCreate: xDatetime_1.xDatetime.getCurrentMilliseconds(),
|
|
62459
62460
|
request: request,
|
|
62460
|
-
operationRequest: operationRequest,
|
|
62461
|
-
|
|
62461
|
+
operationRequest: OperationHelper_1.OperationHelper.toDataOperationRequest(operationRequest),
|
|
62462
|
+
originRequest: OperationHelper_1.OperationHelper.toDataFromRequest(operationRequest.originRequest),
|
|
62463
|
+
operationResponse: OperationHelper_1.OperationHelper.toDataOperationResponse(operationResponse),
|
|
62462
62464
|
customTags: operationRequest.getParameters().getGNHashtable("CustomTags")
|
|
62463
62465
|
});
|
|
62464
62466
|
if (!this.eventLstDict.has(eventName)) {
|
|
@@ -66225,6 +66227,9 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
66225
66227
|
exports.OperationHelper = void 0;
|
|
66226
66228
|
const ReturnCode_1 = __webpack_require__(8412);
|
|
66227
66229
|
const OperationResponse_1 = __webpack_require__(3964);
|
|
66230
|
+
const CodeHelper_1 = __webpack_require__(7728);
|
|
66231
|
+
const RequestType_1 = __webpack_require__(1016);
|
|
66232
|
+
const RequestRole_1 = __webpack_require__(1948);
|
|
66228
66233
|
class OperationHelper {
|
|
66229
66234
|
static invalidMemberData(operationResponse) {
|
|
66230
66235
|
let anwser = [];
|
|
@@ -66243,6 +66248,54 @@ class OperationHelper {
|
|
|
66243
66248
|
static toResponseHttpData(operationResponse) {
|
|
66244
66249
|
return [operationResponse.getReturnCode(), operationResponse.getReturnCode() == ReturnCode_1.ReturnCode.Ok ? operationResponse.getParameters().toData() : operationResponse.getReturnCode() == ReturnCode_1.ReturnCode.InvalidRequestParameters ? OperationHelper.invalidMemberData(operationResponse) : operationResponse.getDebugMessage()];
|
|
66245
66250
|
}
|
|
66251
|
+
static toDataGNHashtable(gnHashtable) {
|
|
66252
|
+
if (gnHashtable == null)
|
|
66253
|
+
return null;
|
|
66254
|
+
return gnHashtable.toData();
|
|
66255
|
+
}
|
|
66256
|
+
static toDataOperationResponse(operationResponse) {
|
|
66257
|
+
return {
|
|
66258
|
+
operationCode: CodeHelper_1.CodeHelper.getOperationCodeName(operationResponse.getOperationCode()),
|
|
66259
|
+
encrypted: operationResponse.isEncrypted(),
|
|
66260
|
+
responseId: operationResponse.getResponseId(),
|
|
66261
|
+
parameters: OperationHelper.toDataGNHashtable(operationResponse.getParameters()),
|
|
66262
|
+
debugMessage: operationResponse.getDebugMessage(),
|
|
66263
|
+
returnCode: CodeHelper_1.CodeHelper.getReturnCodeName(operationResponse.getReturnCode()),
|
|
66264
|
+
};
|
|
66265
|
+
}
|
|
66266
|
+
static toDataOperationRequest(operationRequest) {
|
|
66267
|
+
return {
|
|
66268
|
+
operationCode: CodeHelper_1.CodeHelper.getOperationCodeName(operationRequest.getOperationCode()),
|
|
66269
|
+
encrypted: operationRequest.isEncrypted(),
|
|
66270
|
+
requestId: operationRequest.getRequestId(),
|
|
66271
|
+
parameters: OperationHelper.toDataGNHashtable(operationRequest.getParameters())
|
|
66272
|
+
};
|
|
66273
|
+
}
|
|
66274
|
+
static toDataFromRequest(request) {
|
|
66275
|
+
return {
|
|
66276
|
+
code: CodeHelper_1.CodeHelper.getOperationCodeName(request.getCode()),
|
|
66277
|
+
type: RequestType_1.RequestType[request.getType()],
|
|
66278
|
+
role: RequestRole_1.RequestRole[request.getRole()],
|
|
66279
|
+
ip: request.getIP(),
|
|
66280
|
+
secretInfo: OperationHelper.toDataSecretInfo(request.getSecretInfo()),
|
|
66281
|
+
authInfo: OperationHelper.toAuthInfo(request.getAuthInfo()),
|
|
66282
|
+
};
|
|
66283
|
+
}
|
|
66284
|
+
static toDataSecretInfo(secretInfo) {
|
|
66285
|
+
if (secretInfo == null)
|
|
66286
|
+
return null;
|
|
66287
|
+
return {
|
|
66288
|
+
role: RequestRole_1.RequestRole[secretInfo.getRole()],
|
|
66289
|
+
gameId: secretInfo.getGameId(),
|
|
66290
|
+
};
|
|
66291
|
+
}
|
|
66292
|
+
static toAuthInfo(authInfo) {
|
|
66293
|
+
if (authInfo == null)
|
|
66294
|
+
return null;
|
|
66295
|
+
return {
|
|
66296
|
+
userId: authInfo.getUserId(),
|
|
66297
|
+
};
|
|
66298
|
+
}
|
|
66246
66299
|
static newOperationResponse(operationCode, responseId, encrypted) {
|
|
66247
66300
|
return new OperationResponse_1.OperationResponse(operationCode, responseId, encrypted);
|
|
66248
66301
|
}
|
|
@@ -70197,9 +70250,8 @@ class xDatabase {
|
|
|
70197
70250
|
let answer = {};
|
|
70198
70251
|
let keys = Object.keys(findOptions);
|
|
70199
70252
|
keys.forEach((key) => {
|
|
70200
|
-
|
|
70201
|
-
|
|
70202
|
-
answer[key] = value;
|
|
70253
|
+
if (findOptions[key] == true)
|
|
70254
|
+
answer[key] = true;
|
|
70203
70255
|
});
|
|
70204
70256
|
return answer;
|
|
70205
70257
|
}
|
|
@@ -71307,10 +71359,10 @@ class ServerApplication extends BuilderBase {
|
|
|
71307
71359
|
yield this.gnServer.getDatabase().systemCollection("UploadFileInfoCollection").createIndex({ "tsCreate": -1 }, { background: true, name: "tsCreate_-1" });
|
|
71308
71360
|
}
|
|
71309
71361
|
{
|
|
71310
|
-
yield this.gnServer.getDatabase().systemCollection("AdapterEventCollection").createIndex({ createdAt: 1 }, { expireAfterSeconds: 60, background: true, name: "createdAt_1" });
|
|
71362
|
+
yield this.gnServer.getDatabase().systemCollection("AdapterEventCollection").createIndex({ "createdAt": 1 }, { expireAfterSeconds: 60, background: true, name: "createdAt_1" });
|
|
71311
71363
|
}
|
|
71312
71364
|
{
|
|
71313
|
-
|
|
71365
|
+
// await this.gnServer.getDatabase().systemCollection("SecretInfoCollection").createIndex({ "secretKey": 1 }, { background: true, unique: true, name: "secretKey_1" });
|
|
71314
71366
|
}
|
|
71315
71367
|
{
|
|
71316
71368
|
yield this.gnServer.getDatabase().systemCollection("Config").createIndex({ "configName": 1, "label": 1 }, { background: true, unique: true, name: "configName_1_label_1" });
|