@xmobitea/gn-server
Version:
GearN Server by XmobiTea (Pro)
1,283 lines (1,252 loc) • 4.59 MB
JavaScript
/******/ (() => { // webpackBootstrap
/******/ "use strict";
/******/ // The require scope
/******/ var __webpack_require__ = {};
/******/
/************************************************************************/
/******/ /* webpack/runtime/compat get default export */
/******/ (() => {
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = (module) => {
/******/ var getter = module && module.__esModule ?
/******/ () => (module['default']) :
/******/ () => (module);
/******/ __webpack_require__.d(getter, { a: getter });
/******/ return getter;
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/define property getters */
/******/ (() => {
/******/ // define getter functions for harmony exports
/******/ __webpack_require__.d = (exports, definition) => {
/******/ for(var key in definition) {
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ }
/******/ }
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/make namespace object */
/******/ (() => {
/******/ // define __esModule on exports
/******/ __webpack_require__.r = (exports) => {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/ })();
/******/
/************************************************************************/
var __webpack_exports__ = {};
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
AnalyticsService: () => (/* reexport */ AnalyticsService),
AntiDdosMiddleware: () => (/* reexport */ AntiDdosMiddleware),
ApiMiddleware: () => (/* reexport */ ApiMiddleware),
AppleService: () => (/* reexport */ AppleService),
ApplicationSettings: () => (/* reexport */ ApplicationSettings),
AuthInfo: () => (/* reexport */ AuthInfo),
AuthenticatePermissionRulesParam: () => (/* reexport */ AuthenticatePermissionRulesParam),
AvatarParam: () => (/* reexport */ AvatarParam),
BooleanDataMember: () => (/* reexport */ BooleanDataMember),
CacheItem: () => (/* reexport */ CacheItem),
CacheService: () => (/* reexport */ CacheService),
CharacterCatalogSettingsParam: () => (/* reexport */ CharacterCatalogSettingsParam),
CharacterPlayer: () => (/* reexport */ CharacterPlayer),
CharacterPlayerPermissionRulesParam: () => (/* reexport */ CharacterPlayerPermissionRulesParam),
CharacterPlayerSettingsParam: () => (/* reexport */ CharacterPlayerSettingsParam),
ChatMessage: () => (/* reexport */ ChatMessage),
CloudScriptPermissionRulesParam: () => (/* reexport */ CloudScriptPermissionRulesParam),
ClusterSettings: () => (/* reexport */ ClusterSettings),
CodeHelper: () => (/* reexport */ CodeHelper),
Commands: () => (/* reexport */ Commands),
CommonOperationRequest: () => (/* reexport */ CommonOperationRequest),
ConfigItem: () => (/* reexport */ ConfigItem),
ConfigService: () => (/* reexport */ ConfigService),
ContentDataParam: () => (/* reexport */ ContentDataParam),
ContentPermissionRulesParam: () => (/* reexport */ ContentPermissionRulesParam),
CurrencyParam: () => (/* reexport */ CurrencyParam),
CurrencySettingsParam: () => (/* reexport */ CurrencySettingsParam),
CustomDataParam: () => (/* reexport */ CustomDataParam_CustomDataParam),
DataMember: () => (/* reexport */ DataMember),
DataObjectBase: () => (/* reexport */ DataObjectBase),
DataSettingsParam: () => (/* reexport */ DataSettingsParam),
DatabaseSettings: () => (/* reexport */ DatabaseSettings),
DdosSettings: () => (/* reexport */ DdosSettings),
Debug: () => (/* reexport */ Debug),
DefaultApplicationStartup: () => (/* reexport */ DefaultApplicationStartup),
DisplayNameUtility: () => (/* reexport */ DisplayNameUtility),
EmailService: () => (/* reexport */ EmailService),
EmailSettingsParam: () => (/* reexport */ EmailSettingsParam),
EventCode: () => (/* reexport */ EventCode),
FacebookService: () => (/* reexport */ FacebookService),
FieldDataType: () => (/* reexport */ GNMetadata_FieldDataType),
FriendCatalogSettingsParam: () => (/* reexport */ FriendCatalogSettingsParam),
FriendStatus: () => (/* reexport */ FriendStatus),
GNArray: () => (/* reexport */ GNArray),
GNArrayBuilder: () => (/* reexport */ GNArrayBuilder),
GNArrayDataMember: () => (/* reexport */ GNArrayDataMember),
GNData: () => (/* reexport */ GNData),
GNErrorCode: () => (/* reexport */ GNErrorCode),
GNFieldDataType: () => (/* reexport */ GNFieldDataType),
GNHashtable: () => (/* reexport */ GNHashtable),
GNHashtableBuilder: () => (/* reexport */ GNHashtableBuilder),
GNHashtableDataMember: () => (/* reexport */ GNHashtableDataMember),
GNParameterCode: () => (/* reexport */ GNParameterCode),
GNServer: () => (/* reexport */ GNServer),
GameItem: () => (/* reexport */ GameItem),
GamePlayer: () => (/* reexport */ GamePlayer),
GamePlayerBase: () => (/* reexport */ GamePlayerBase),
GamePlayerPermissionRulesParam: () => (/* reexport */ GamePlayerPermissionRulesParam),
GamePlayerSettingsParam: () => (/* reexport */ GamePlayerSettingsParam),
GameSettingsParam: () => (/* reexport */ GameSettingsParam),
GenericService: () => (/* reexport */ GenericService),
GenericServiceSettingsParam: () => (/* reexport */ GenericServiceSettingsParam),
GoogleLoginType: () => (/* reexport */ GoogleLoginType),
GoogleService: () => (/* reexport */ GoogleService),
Group: () => (/* reexport */ Group),
GroupCatalogSettingsParam: () => (/* reexport */ GroupCatalogSettingsParam),
GroupCurrencyParam: () => (/* reexport */ GroupCurrencyParam),
GroupDataParam: () => (/* reexport */ GroupDataParam),
GroupMemberParam: () => (/* reexport */ model_GroupMemberParam_GroupMemberParam),
GroupPermissionRulesParam: () => (/* reexport */ GroupPermissionRulesParam),
GroupSettingsParam: () => (/* reexport */ GroupSettingsParam),
GroupStatisticsParam: () => (/* reexport */ GroupStatisticsParam),
GroupStatus: () => (/* reexport */ GroupStatus),
HttpApp: () => (/* reexport */ HttpApp),
HttpAppHandler: () => (/* reexport */ HttpAppHandler),
HttpAppSettings: () => (/* reexport */ HttpAppSettings),
IGenericService: () => (/* reexport */ IGenericService),
InAppPurchaseParam: () => (/* reexport */ InAppPurchaseParam),
InvalidMemberType: () => (/* reexport */ InvalidMemberType),
Inventory: () => (/* reexport */ Inventory),
InventoryPermissionRulesParam: () => (/* reexport */ InventoryPermissionRulesParam),
InventorySettingsParam: () => (/* reexport */ InventorySettingsParam),
ItemCatalogSettingsParam: () => (/* reexport */ ItemCatalogSettingsParam),
ItemClassSettingsParam: () => (/* reexport */ ItemClassSettingsParam),
ItemDataParam: () => (/* reexport */ ItemDataParam),
ItemStatisticsParam: () => (/* reexport */ ItemStatisticsParam),
ItemType: () => (/* reexport */ ItemType),
LockService: () => (/* reexport */ LockService),
LogSettings: () => (/* reexport */ LogSettings),
MasterAdminMongoObject: () => (/* reexport */ MasterAdminMongoObject),
MasterAdminPermissionRulesParam: () => (/* reexport */ MasterAdminPermissionRulesParam),
MasterAdminPlayer: () => (/* reexport */ MasterAdminPlayer),
MasterGameSettings: () => (/* reexport */ MasterGameSettings),
MasterPlayer: () => (/* reexport */ MasterPlayer),
MasterPlayerPermissionRulesParam: () => (/* reexport */ MasterPlayerPermissionRulesParam),
MasterPlayerSettingsParam: () => (/* reexport */ MasterPlayerSettingsParam),
Match: () => (/* reexport */ Match),
MatchmakingMemberStatus: () => (/* reexport */ MatchmakingMemberStatus),
MatchmakingQueueSettingsParam: () => (/* reexport */ MatchmakingQueueSettingsParam),
MatchmakingTicket: () => (/* reexport */ MatchmakingTicket),
MatchmakingTicketStatus: () => (/* reexport */ MatchmakingTicketStatus),
Md5Generate: () => (/* reexport */ Md5Generate),
MemoryCacheServiceController: () => (/* reexport */ MemoryCacheServiceController),
MongoDbCacheServiceController: () => (/* reexport */ MongoDbCacheServiceController),
MongoObject: () => (/* reexport */ MongoObject),
MultiplayerPermissionRulesParam: () => (/* reexport */ MultiplayerPermissionRulesParam),
NumberDataMember: () => (/* reexport */ NumberDataMember),
OperationArray: () => (/* reexport */ OperationArray),
OperationCode: () => (/* reexport */ OperationCode),
OperationEvent: () => (/* reexport */ OperationEvent),
OperationHelper: () => (/* reexport */ OperationHelper),
OperationObject: () => (/* reexport */ OperationObject),
OperationRequest: () => (/* reexport */ OperationRequest),
OperationResponse: () => (/* reexport */ OperationResponse),
OtherSettings: () => (/* reexport */ OtherSettings),
OwnerType: () => (/* reexport */ OwnerType),
ParameterCode: () => (/* reexport */ ParameterCode),
PermissionDataItem: () => (/* reexport */ PermissionDataItem),
PermissionParam: () => (/* reexport */ PermissionParam),
PermissionRulesParam: () => (/* reexport */ PermissionRulesParam),
PlayerBase: () => (/* reexport */ PlayerBase),
PlayerCurrencyParam: () => (/* reexport */ PlayerCurrencyParam_PlayerCurrencyParam),
PlayerDataParam: () => (/* reexport */ PlayerDataParam_PlayerDataParam),
PlayerStatisticsParam: () => (/* reexport */ PlayerStatisticsParam_PlayerStatisticsParam),
PostEventCallbackService: () => (/* reexport */ PostEventCallbackService),
PreEventCallbackService: () => (/* reexport */ PreEventCallbackService),
PushNotificationService: () => (/* reexport */ PushNotificationService),
PushNotificationSettingsParam: () => (/* reexport */ PushNotificationSettingsParam),
PushPlatformType: () => (/* reexport */ PushPlatformType),
Request: () => (/* reexport */ Request),
RequestController: () => (/* reexport */ RequestController),
RequestConverterService: () => (/* reexport */ RequestConverterService),
RequestHandler: () => (/* reexport */ RequestHandler),
RequestRole: () => (/* reexport */ RequestRole),
RequestType: () => (/* reexport */ RequestType),
ReturnCode: () => (/* reexport */ ReturnCode),
SecretInfo: () => (/* reexport */ SecretInfo),
SecretInfoItem: () => (/* reexport */ SecretInfoItem),
ServerApplication: () => (/* reexport */ ServerApplication),
ServerApplicationStartup: () => (/* reexport */ ServerApplicationStartup),
SocketApp: () => (/* reexport */ SocketApp),
SocketAppHandler: () => (/* reexport */ SocketAppHandler),
SocketAppSettings: () => (/* reexport */ SocketAppSettings),
StatisticsSettingsParam: () => (/* reexport */ StatisticsSettingsParam),
StoreDataParam: () => (/* reexport */ StoreDataParam),
StoreInventory: () => (/* reexport */ StoreInventory),
StoreInventoryPermissionRulesParam: () => (/* reexport */ StoreInventoryPermissionRulesParam),
StoreItemParam: () => (/* reexport */ StoreItemParam),
StoreItemType: () => (/* reexport */ StoreItemType),
StringDataMember: () => (/* reexport */ StringDataMember),
StringUtility: () => (/* reexport */ StringUtility),
TagParam: () => (/* reexport */ TagParam),
TagSettingsParam: () => (/* reexport */ TagSettingsParam),
ThirtPartyAppleSettingsParam: () => (/* reexport */ ThirtPartyAppleSettingsParam),
ThirtPartyFacebookSettingsParam: () => (/* reexport */ ThirtPartyFacebookSettingsParam),
ThirtPartyGameCenterSettingsParam: () => (/* reexport */ ThirtPartyGameCenterSettingsParam),
ThirtPartyGooglePlayGameSettingsParam: () => (/* reexport */ ThirtPartyGooglePlayGameSettingsParam),
ThirtPartyParam: () => (/* reexport */ ThirtPartyParam),
TimerService: () => (/* reexport */ TimerService),
TradeInventory: () => (/* reexport */ TradeInventory),
UploadFileHandler: () => (/* reexport */ UploadFileHandler),
UploadFileInfo: () => (/* reexport */ UploadFileInfo),
UploadFileMiddleware: () => (/* reexport */ UploadFileMiddleware),
UploadFileSettings: () => (/* reexport */ UploadFileSettings),
authenticate_InfoRequestParam: () => (/* reexport */ InfoRequestParam),
characterPlayer_InfoRequestParam: () => (/* reexport */ model_InfoRequestParam_InfoRequestParam),
gamePlayer_InfoRequestParam: () => (/* reexport */ gamePlayer_model_InfoRequestParam_InfoRequestParam),
group_InfoRequestParam: () => (/* reexport */ group_model_InfoRequestParam_InfoRequestParam),
inventory_InfoRequestParam: () => (/* reexport */ inventory_model_InfoRequestParam_InfoRequestParam),
masterPlayer_InfoRequestParam: () => (/* reexport */ InfoRequestParam_InfoRequestParam),
storeInventory_InfoRequestParam: () => (/* reexport */ storeInventory_model_InfoRequestParam_InfoRequestParam),
xDatabase: () => (/* reexport */ xDatabase),
xDatetime: () => (/* reexport */ xDatetime),
xGNSettings: () => (/* reexport */ xGNSettings),
xRandom: () => (/* reexport */ xRandom),
xStatisticsAggregationMethod: () => (/* reexport */ xStatisticsAggregationMethod)
});
;// ./src/GN-common/constant/ReturnCode.ts
class ReturnCode {
static SecretInvalid = -10;
static MaxSizeRequestReject = -9;
static MaxRequestReject = -8;
static MaxCCUReject = -7;
static OperationNotAuthorized = -6;
static InvalidRequestParameters = -5;
static OperationInvalid = -4;
static InternalServerError = -3;
static OperationNotAllow = -2;
static OperationTimeout = -1;
static UnknownError = 0;
static Ok = 1;
}
;// ./src/GN-common/constant/EventCode.ts
class EventCode {
static OnGamePlayerFriendUpdate = 1;
static OnCharacterPlayerFriendUpdate = 2;
static OnGamePlayerGroupUpdate = 3;
static OnGroupMemberUpdate = 4;
static OnGroupMessageUpdate = 5;
static OnCharacterPlayerGroupUpdate = 6;
}
;// ./src/GN-common/constant/OperationCode.ts
class OperationCode {
static LoginByAdminAccount = -1;
static ChangePasswordAdminAccount = -2;
static GetGameList = -3;
static GetMasterGameSettings = -4;
static SetMasterGameSettings = -5;
static GrantAdminAccount = -6;
static RemoveAdminAccount = -7;
static SetPasswordAdminAccount = -8;
static SetSecretKeyAdminAccount = -9;
static GetGameInformation = -10;
static SetGameInformation = -11;
static GetAdminAccountList = -12;
static GrantGame = -13;
static GetServerLog = -14;
static GetSecretInfoInformation = -15;
static GetSecretInfoList = -16;
static GrantSecretInfo = -17;
static SetSecretInfoInformation = -18;
static GetUsernameAdminAccount = -19;
static GetAnalytics = -20;
static GetEventCallbackCloudScript = -21;
static SetEventCallbackCloudScript = -22;
static ResetStatisticsLeaderboard = -23;
static GetBackupStatisticsLeaderboardVersion = -24;
static GetServerGameData = -25;
static DeleteInDatabase = -26;
static LoginByAccount = 1;
static LoginByAndroidDeviceId = 2;
static LoginByApple = 3;
static LoginByCustomDeviceId = 4;
static LoginByCustomId = 5;
static LoginByEditorDeviceId = 6;
static LoginByFacebook = 7;
static LoginByGenericService = 8;
static LoginByGoogle = 9;
static LoginByiOSDeviceId = 10;
static LoginByLinuxDeviceId = 11;
static LoginByMacOSDeviceId = 12;
static LoginByWindowsDeviceId = 13;
static LoginByWindowsPhoneDeviceId = 14;
static RegisterAccount = 15;
static LinkAccount = 16;
static LinkAndroidDeviceId = 17;
static LinkApple = 18;
static LinkCustomDeviceId = 19;
static LinkCustomId = 20;
static LinkEditorDeviceId = 21;
static LinkFacebook = 22;
static LinkGenericService = 23;
static LinkGoogle = 24;
static LinkiOSDeviceId = 25;
static LinkLinuxDeviceId = 26;
static LinkMacOSDeviceId = 27;
static LinkWindowsDeviceId = 28;
static LinkWindowsPhoneDeviceId = 29;
static UnlinkAccount = 30;
static UnlinkAndroidDeviceId = 31;
static UnlinkApple = 32;
static UnlinkCustomDeviceId = 33;
static UnlinkCustomId = 34;
static UnlinkEditorDeviceId = 35;
static UnlinkFacebook = 36;
static UnlinkGenericService = 37;
static UnlinkGoogle = 38;
static UnlinkiOSDeviceId = 39;
static UnlinkLinuxDeviceId = 40;
static UnlinkMacOSDeviceId = 41;
static UnlinkWindowsDeviceId = 42;
static UnlinkWindowsPhoneDeviceId = 43;
static AddSegment = 44;
static RemoveSegment = 45;
static GetSegment = 46;
static SetTag = 47;
static GetTag = 48;
static SetDisplayName = 49;
static GetDisplayName = 50;
static GetTsCreate = 51;
static GetIpAddressCreate = 52;
static GetTsLastLogin = 53;
static SetPlayerBan = 54;
static GetPlayerBan = 55;
static SetCountryCode = 56;
static GetCountryCode = 57;
static ChangeAccountPassword = 58;
static ResetAccountPassword = 59;
static SetAvatar = 60;
static GetAvatar = 61;
static SetPlayerCurrency = 62;
static GetPlayerCurrency = 63;
static SetPlayerStatistics = 64;
static GetPlayerStatistics = 65;
static GetStatisticsLeaderboard = 66;
static GetStatisticsLeaderboardAroundPlayer = 67;
static SetCustomData = 68;
static GetCustomData = 69;
static SetPlayerData = 70;
static GetPlayerData = 71;
static GetPlayerInformation = 72;
static GetPlayersWithApple = 73;
static GetPlayersWithFacebook = 74;
static GetPlayersWithGoogle = 75;
static GetPlayersWithGenericService = 76;
static GetPlayersWithSegment = 77;
static GetPlayersWithTag = 78;
static GetExternal = 79;
static GetCatalogId = 80;
static GetOwnerInfo = 81;
static GetOnlineStatus = 82;
static RemovePlayerItem = 83;
static RemovePlayerCharacter = 84;
static AddPlayerFriend = 85;
static RemovePlayerFriend = 86;
static GetPlayerInventory = 87;
static GetPlayerCharacter = 88;
static GetPlayerFriend = 89;
static GetPlayerGroup = 90;
static GrantGroup = 91;
static JoinGroup = 92;
static GrantPlayerItem = 93;
static GrantPlayerCharacter = 94;
static GetOwner = 95;
static GetRemoveStatus = 96;
static SetGroupStatistics = 97;
static SetGroupData = 98;
static GetGroupCurrency = 99;
static SetGroupCurrency = 100;
static GrantGroupItem = 101;
static GetStatisticsLeaderboardAroundGroup = 102;
static GetGroupsWithTag = 103;
static GetGroupsWithSegment = 104;
static GetGroupStatistics = 105;
static GetGroupInventory = 106;
static GetGroupData = 107;
static GetGroupInformation = 108;
static GetMembers = 109;
static SetItemStatistics = 110;
static SetItemData = 111;
static GetItemData = 112;
static GetStatisticsLeaderboardAroundItem = 113;
static GetItemsWithTag = 114;
static GetItemsWithSegment = 115;
static GetItemStatistics = 116;
static GetItemInformation = 117;
static GetAmount = 118;
static GetItemType = 119;
static SetTsLastLogin = 120;
static SetRemoveStatus = 121;
static SetAmount = 122;
static RemoveGroup = 123;
static LeaveGroup = 124;
static AddMember = 125;
static RemoveMember = 126;
static GetContentData = 127;
static SetContentData = 128;
static GetGroupMessage = 129;
static SendGroupMessage = 130;
static GetPlayersWithDisplayName = 131;
static GetItemsWithDisplayName = 132;
static GetGroupsWithDisplayName = 133;
static SetOwner = 134;
static RemoveGroupItem = 135;
static GetClassId = 136;
static GetStoreItemInformation = 137;
static GetStoreItemsWithTag = 138;
static GrantStoreItem = 139;
static RemoveTag = 140;
static BuyStoreItem = 141;
static ValidateAppleAppStoreReceipt = 142;
static ValidateGooglePlayStoreReceipt = 143;
static ValidateFacebookStoreReceipt = 144;
static GetFriendStatisticsLeaderboardAroundPlayer = 145;
static GetFriendStatisticsLeaderboard = 146;
static SetEmail = 147;
static GetEmail = 148;
static CreateNewFileUploadInfo = 149;
static GetFileUploadInfo = 150;
static RequestDownloadFileUploadInfo = 151;
static RemoveFileUploadInfo = 152;
static GetFileUploadInfoList = 153;
static SetStoreItemInformation = 154;
static RefreshAuthToken = 155;
static CancelAllMatchmakingTicket = 156;
static CancelMatchmakingTicket = 157;
static CreateMatchmakingTicket = 158;
static GetMatch = 159;
static GetMatchmakingTicket = 160;
static GetQueueStatistics = 161;
static JoinMatchmakingTicket = 162;
static ListMatchmakingTicketsForPlayer = 163;
static GetCurrencyLeaderboard = 164;
static ExecuteFunction = 165;
static GetFunctions = 166;
static AddFunction = 167;
static EditFunction = 168;
static GetFunction = 169;
static LoginByGooglePlayGameService = 170;
static LoginByGameCenter = 171;
static LinkGooglePlayGameService = 172;
static LinkGameCenter = 173;
static UnlinkGooglePlayGameService = 174;
static UnlinkGameCenter = 175;
static GetPlayersWithGooglePlayGameService = 176;
static GetPlayersWithGameCenter = 177;
static GetLastLoginLeaderboard = 178;
static GetCreateLeaderboard = 179;
static GetAllMatchmakingTicket = 180;
static GetAllMatch = 181;
static SendSocketOperationEvent = 182;
static GetStatisticsLog = 183;
static GetCurrencyLog = 184;
static PresentStoreItem = 185;
static GetStoreLog = 186;
static SendEmail = 187;
static SendPushNotification = 188;
static AddPushNotification = 189;
static RemovePushNotification = 190;
static GetPushNotification = 191;
static GetStoreUsed = 192;
static RemoveStoreUsed = 193;
}
;// ./src/GN-common/helper/CodeHelper.ts
class CodeHelper {
static UnknownCode = "Unknown";
static operationCodeDic;
static eventCodeDic;
static returnCodeDic;
static getOperationCodeName(operationCode) {
let operationCodeName = this.operationCodeDic[operationCode];
return operationCodeName ? operationCodeName : this.UnknownCode;
}
static getEventCodeName(eventCode) {
let eventCodeName = this.eventCodeDic[eventCode];
return eventCodeName ? eventCodeName : this.UnknownCode;
}
static getReturnCodeName(returnCode) {
let returnCodeName = this.returnCodeDic[returnCode];
return returnCodeName ? returnCodeName : this.UnknownCode;
}
static init() {
this.setOperationCodeDic();
this.setEventCodeDic();
this.setReturnCodeDic();
}
static setOperationCodeDic() {
this.operationCodeDic = {};
this.addOperationCodeDic(OperationCode);
}
static addOperationCodeDic(operationCode) {
let keys = Object.keys(operationCode);
let values = Object.values(operationCode);
for (let i = 0; i < keys.length; i++) {
this.operationCodeDic[values[i]] = keys[i];
}
}
static setEventCodeDic() {
this.eventCodeDic = {};
this.addEventCodeDic(EventCode);
}
static addEventCodeDic(eventCode) {
let keys = Object.keys(eventCode);
let values = Object.values(eventCode);
for (let i = 0; i < keys.length; i++) {
this.eventCodeDic[values[i]] = keys[i];
}
}
static setReturnCodeDic() {
this.returnCodeDic = {};
this.addReturnCodeDic(ReturnCode);
}
static addReturnCodeDic(returnCode) {
let keys = Object.keys(returnCode);
let values = Object.values(returnCode);
for (let i = 0; i < keys.length; i++) {
this.returnCodeDic[values[i]] = keys[i];
}
}
static getEventCodeDic() {
return this.eventCodeDic;
}
static getReturnCodeDic() {
return this.returnCodeDic;
}
}
;// ./src/GN-common/common/GNData.ts
class GNData {
get(k, def) {
return def;
}
getBoolean(k, def) {
return this.get(k, def);
}
getObject(k, def) {
return this.get(k, def);
}
getString(k, def) {
return this.get(k, def);
}
getNumber(k, def) {
return this.get(k, def);
}
getGNHashtable(k, def) {
return this.get(k, def);
}
getGNArray(k, def) {
return this.get(k, def);
}
static createGNHashtableFromObject(value) {
let answer = new GNHashtable();
let valueKeys = Object.keys(value);
for (let i = 0; i < valueKeys.length; i++) {
let key = valueKeys[i];
answer.add(key, value[key]);
}
return answer;
}
static createGNArrayFromArray(value) {
let answer = new GNArray();
let valueArr = value;
for (let i = 0; i < valueArr.length; i++) {
answer.add(valueArr[i]);
}
return answer;
}
static createUseDataFromOriginData(value) {
if (value == null)
return null;
let typeOfValue = typeof value;
if (typeOfValue === "string")
return value;
if (typeOfValue === "number")
return value;
if (typeOfValue === "boolean")
return value;
if (value instanceof GNArray)
return value;
if (value instanceof GNHashtable)
return value;
if (typeOfValue === "object") {
if (Array.isArray(value))
return this.createGNArrayFromArray(value);
else
return this.createGNHashtableFromObject(value);
}
return null;
}
static createDataFromUseData(value) {
if (value == null)
return null;
if (value instanceof GNData) {
return value.toData();
}
return value;
}
}
class GNHashtableBuilder {
dict = {};
add(k, value) {
this.dict[k] = value;
return this;
}
addAll(dict) {
let keys = Object.keys(dict);
keys.forEach(keyStr => {
this.add(keyStr, dict[keyStr]);
});
return this;
}
constructor() {
this.dict = {};
}
build() {
let answer = new GNHashtable();
let keys = Object.keys(this.dict);
keys.forEach(keyStr => {
answer.add(keyStr, this.dict[keyStr]);
});
return answer;
}
}
class GNHashtable extends GNData {
dict = {};
clear() {
this.dict = {};
}
remove(k) {
if (this.containsKey(k)) {
delete this.dict[k];
return true;
}
return false;
}
count() {
return Object.keys(this.dict).length;
}
containsKey(k) {
let keys = Object.keys(this.dict);
let kStr = k.toString();
return keys.indexOf(kStr) != -1;
}
get(k, def) {
let value = this.dict[k];
if (value == null)
return def;
return value;
}
add(k, value) {
this.dict[k] = GNData.createUseDataFromOriginData(value);
}
toData() {
let anwser = {};
let keys = Object.keys(this.dict);
for (let i = 0; i < keys.length; i++) {
let key = keys[i];
anwser[key] = GNData.createDataFromUseData(this.dict[key]);
}
return anwser;
}
static builder() {
return new GNHashtableBuilder();
}
toString() {
return JSON.stringify(this.dict);
}
}
class GNArrayBuilder {
array;
add(value) {
this.array.push(value);
return this;
}
addAll(array) {
array.forEach(o => {
this.add(o);
});
return this;
}
build() {
let awnser = new GNArray();
this.array.forEach(o => {
awnser.add(o);
});
return awnser;
}
constructor() {
this.array = [];
}
}
class GNArray extends GNData {
array = [];
clear() {
this.array = [];
}
indexOf(item) {
return this.array.indexOf(item);
}
remove(k) {
if (k < 0 || k >= this.array.length)
return false;
this.array.splice(k, 1);
return true;
}
count() {
return this.array.length;
}
get(k, def) {
if (k < 0 || k >= this.array.length)
return null;
let value = this.array[k];
if (value == null)
return def;
return value;
}
add(value) {
this.array.push(GNData.createUseDataFromOriginData(value));
}
toData() {
let anwser = [];
for (let i = 0; i < this.array.length; i++) {
anwser.push(GNData.createDataFromUseData(this.array[i]));
}
return anwser;
}
static builder() {
return new GNArrayBuilder();
}
toString() {
return JSON.stringify(this.array);
}
}
;// ./src/GN-common/entity/operationResponse/OperationResponse.ts
class OperationResponse {
operationCode;
responseId;
returnCode;
debugMessage;
parameters;
encrypted;
invalidMembers;
constructor(operationCode, responseId, encrypted = true) {
this.operationCode = operationCode;
this.responseId = responseId;
this.encrypted = encrypted;
this.parameters = new GNHashtable();
this.debugMessage = null;
}
getOperationCode() {
return this.operationCode;
}
getReturnCode() {
return this.returnCode;
}
getParameters() {
return this.parameters;
}
isEncrypted() {
return this.encrypted;
}
getResponseId() {
return this.responseId;
}
getDebugMessage() {
return this.debugMessage;
}
getInvalidMembers() {
return this.invalidMembers;
}
hasError() {
return this.getReturnCode() != ReturnCode.Ok;
}
setReturnCode(returnCode) {
this.returnCode = returnCode;
return this;
}
setDebugMessage(debugMessage) {
this.debugMessage = debugMessage;
return this;
}
setParameter(k, value) {
this.parameters.add(k, value);
return this;
}
setParameters(parameters) {
this.parameters = parameters;
return this;
}
setEncrypted(encrypted) {
this.encrypted = encrypted;
return this;
}
setInvalidMembers(invalidMembers) {
this.invalidMembers = invalidMembers;
return this;
}
toString() {
let stringBuilder = "";
stringBuilder += "Code: " + CodeHelper.getOperationCodeName(this.operationCode) + " (" + this.operationCode + ")" + ", responseId: " + this.responseId + ", returnCode " + CodeHelper.getReturnCodeName(this.returnCode);
if (this.returnCode == ReturnCode.Ok)
stringBuilder += ", parameters " + this.parameters;
else if (this.returnCode == ReturnCode.InvalidRequestParameters) {
if (this.invalidMembers != null) {
let invalidStr = "";
this.invalidMembers.forEach(invalidMember => {
invalidStr += invalidMember;
});
stringBuilder += ", invalidMembers " + invalidStr;
}
else
stringBuilder += ", invalidMembers " + this.invalidMembers;
}
else
stringBuilder += ", debugMessage " + this.debugMessage;
stringBuilder += ", encrypted " + this.encrypted;
return stringBuilder;
}
}
;// ./src/GN-common/constant/enumType/RequestType.ts
var RequestType;
(function (RequestType) {
RequestType[RequestType["Custom"] = 0] = "Custom";
RequestType[RequestType["Authenticate"] = 1] = "Authenticate";
RequestType[RequestType["CharacterPlayer"] = 2] = "CharacterPlayer";
RequestType[RequestType["Content"] = 3] = "Content";
RequestType[RequestType["GamePlayer"] = 4] = "GamePlayer";
RequestType[RequestType["Group"] = 5] = "Group";
RequestType[RequestType["Inventory"] = 6] = "Inventory";
RequestType[RequestType["MasterPlayer"] = 7] = "MasterPlayer";
RequestType[RequestType["StoreInventory"] = 8] = "StoreInventory";
RequestType[RequestType["Dashboard"] = 9] = "Dashboard";
RequestType[RequestType["Multiplayer"] = 10] = "Multiplayer";
RequestType[RequestType["CloudScript"] = 11] = "CloudScript";
})(RequestType || (RequestType = {}));
;// ./src/GN-common/constant/enumType/RequestRole.ts
var RequestRole;
(function (RequestRole) {
RequestRole[RequestRole["Admin"] = 1] = "Admin";
RequestRole[RequestRole["Server"] = 2] = "Server";
RequestRole[RequestRole["Client"] = 3] = "Client";
})(RequestRole || (RequestRole = {}));
;// ./src/GN-common/entity/operationHelper/OperationHelper.ts
class OperationHelper {
static invalidMemberData(operationResponse) {
let anwser = [];
let invalidMembers = operationResponse.getInvalidMembers();
if (invalidMembers != null) {
for (let i = 0; i < invalidMembers.length; i++) {
let invalidMember = invalidMembers[i];
anwser.push([invalidMember.code, invalidMember.invalidMemberType]);
}
}
return anwser;
}
static toResponseSocketData(operationResponse) {
return [operationResponse.getReturnCode(), operationResponse.getReturnCode() == ReturnCode.Ok ? operationResponse.getParameters().toData() : operationResponse.getReturnCode() == ReturnCode.InvalidRequestParameters ? OperationHelper.invalidMemberData(operationResponse) : operationResponse.getDebugMessage(), operationResponse.getResponseId()];
}
static toResponseHttpData(operationResponse) {
return [operationResponse.getReturnCode(), operationResponse.getReturnCode() == ReturnCode.Ok ? operationResponse.getParameters().toData() : operationResponse.getReturnCode() == ReturnCode.InvalidRequestParameters ? OperationHelper.invalidMemberData(operationResponse) : operationResponse.getDebugMessage()];
}
static toDataGNHashtable(gnHashtable) {
if (gnHashtable == null)
return null;
return gnHashtable.toData();
}
static toDataOperationResponse(operationResponse) {
return {
operationCode: CodeHelper.getOperationCodeName(operationResponse.getOperationCode()),
encrypted: operationResponse.isEncrypted(),
responseId: operationResponse.getResponseId(),
parameters: OperationHelper.toDataGNHashtable(operationResponse.getParameters()),
debugMessage: operationResponse.getDebugMessage(),
returnCode: CodeHelper.getReturnCodeName(operationResponse.getReturnCode()),
};
}
static toDataOperationRequest(operationRequest) {
return {
operationCode: CodeHelper.getOperationCodeName(operationRequest.getOperationCode()),
encrypted: operationRequest.isEncrypted(),
requestId: operationRequest.getRequestId(),
parameters: OperationHelper.toDataGNHashtable(operationRequest.getParameters())
};
}
static toDataFromRequest(request) {
return {
code: CodeHelper.getOperationCodeName(request.getCode()),
type: RequestType[request.getType()],
role: RequestRole[request.getRole()],
ip: request.getIP(),
secretInfo: OperationHelper.toDataSecretInfo(request.getSecretInfo()),
authInfo: OperationHelper.toAuthInfo(request.getAuthInfo()),
};
}
static toDataSecretInfo(secretInfo) {
if (secretInfo == null)
return null;
return {
role: RequestRole[secretInfo.getRole()],
gameId: secretInfo.getGameId(),
};
}
static toAuthInfo(authInfo) {
if (authInfo == null)
return null;
return {
userId: authInfo.getUserId(),
};
}
static newOperationResponse(operationCode, responseId, encrypted) {
return new OperationResponse(operationCode, responseId, encrypted);
}
static newOperationResponseInvalid(operationCode, responseId, encrypted, debugMessage) {
let operationInvalid = this.newOperationResponse(operationCode, responseId, encrypted);
operationInvalid.setReturnCode(ReturnCode.OperationInvalid);
if (debugMessage !== null)
operationInvalid.setDebugMessage(debugMessage);
return operationInvalid;
}
static newOperationResponseInvalidRequestParameters(operationCode, responseId, invalidMembers, encrypted, debugMessage) {
let operationInvalid = this.newOperationResponse(operationCode, responseId, encrypted);
operationInvalid.setReturnCode(ReturnCode.InvalidRequestParameters);
operationInvalid.setInvalidMembers(invalidMembers);
if (debugMessage !== null)
operationInvalid.setDebugMessage(debugMessage);
return operationInvalid;
}
static newOperationResponseInternalServerError(operationCode, responseId, encrypted, debugMessage) {
let operationInvalid = this.newOperationResponse(operationCode, responseId, encrypted);
operationInvalid.setReturnCode(ReturnCode.InternalServerError);
if (debugMessage !== null)
operationInvalid.setDebugMessage(debugMessage);
return operationInvalid;
}
static newOperationResponseNotAuthorized(operationCode, responseId, encrypted, debugMessage) {
let operationInvalid = this.newOperationResponse(operationCode, responseId, encrypted);
operationInvalid.setReturnCode(ReturnCode.OperationNotAuthorized);
if (debugMessage !== null)
operationInvalid.setDebugMessage(debugMessage);
return operationInvalid;
}
static newOperationNotAllowError(operationCode, responseId, encrypted, debugMessage) {
let operationInvalid = this.newOperationResponse(operationCode, responseId, encrypted);
operationInvalid.setReturnCode(ReturnCode.OperationNotAllow);
if (debugMessage !== null)
operationInvalid.setDebugMessage(debugMessage);
return operationInvalid;
}
static toEventSocketData(operationEvent) {
return [operationEvent.getEventCode(), operationEvent.getParameters() == null ? null : operationEvent.getParameters().toData()];
}
}
;// ./src/GN-app-api/handler/controller/handler/base/RequestHandler.ts
class RequestHandler {
gnServer;
requestConverterService;
async adminHandle(secretInfo, operationRequest) {
return this.newOperationInvalid(operationRequest);
}
async serverHandle(secretInfo, operationRequest) {
return this.newOperationInvalid(operationRequest);
}
async handle(authInfo, secretInfo, operationRequest) {
return this.newOperationInvalid(operationRequest);
}
init() {
}
newInvalidRequestParameters(operationRequest) {
return OperationHelper.newOperationResponseInvalidRequestParameters(operationRequest.getOperationCode(), operationRequest.getRequestId(), operationRequest.invalidMembers, operationRequest.isEncrypted());
}
newOperationInvalid(operationRequest, debugMessage) {
return OperationHelper.newOperationResponseInvalid(operationRequest.getOperationCode(), operationRequest.getRequestId(), operationRequest.isEncrypted(), debugMessage);
}
newOperationInternalServerError(operationRequest, debugMessage) {
return OperationHelper.newOperationResponseInternalServerError(operationRequest.getOperationCode(), operationRequest.getRequestId(), operationRequest.isEncrypted(), debugMessage);
}
newOperationNotAllowError(operationRequest, debugMessage) {
return OperationHelper.newOperationNotAllowError(operationRequest.getOperationCode(), operationRequest.getRequestId(), operationRequest.isEncrypted(), debugMessage);
}
constructor(gnServer) {
this.gnServer = gnServer;
this.requestConverterService = gnServer.getRequestConverterService();
this.init();
}
}
;// ./src/GN-app-api/handler/controller/RequestController.ts
class RequestController {
handlers;
requestUnAuthenticatedCodes;
requestConverterService;
setRequestConverterService(requestConverterService) {
this.requestConverterService = requestConverterService;
}
getRequestUnAuthenticatedCodes() {
return this.requestUnAuthenticatedCodes;
}
addHandler(type, requestHandler, onlyAuthenticated = true) {
if (this.handlers[type] == null) {
this.handlers[type] = {};
}
let allHandler = this.handlers[type];
let code = requestHandler.getCode();
allHandler[code] = requestHandler;
if (!onlyAuthenticated)
this.requestUnAuthenticatedCodes.push(code);
}
removeHandler(type, code) {
if (this.handlers[type] == null) {
this.handlers[type] = {};
}
let allHandler = this.handlers[type];
delete allHandler[code];
}
removeAllHandlers() {
this.handlers = {};
}
getHandler(type, code) {
if (this.handlers[type] == null) {
this.handlers[type] = {};
}
let allHandler = this.handlers[type];
return allHandler[code];
}
getAllHandlers(type) {
if (this.handlers[type] == null) {
this.handlers[type] = {};
}
let allHandler = this.handlers[type];
return Object.values(allHandler);
}
async handleRequest(request) {
let code = request.getCode();
let role = request.getRole();
let isAuthenticated = request.isAuthenticated();
if (!isAuthenticated && role != RequestRole.Admin && role != RequestRole.Server) {
// if the user not authentication
// and this request not in unAthenticated
if (this.requestUnAuthenticatedCodes.indexOf(code) == -1) {
return OperationHelper.newOperationResponseNotAuthorized(code, request.getRequestId(), request.isEncrypted());
}
}
let type = request.getType();
let handler = this.getHandler(type, code);
if (handler != null) {
let operationRequest = this.requestConverterService.newOperationRequest(request);
if (role == RequestRole.Admin) {
return handler.adminHandle(request.getSecretInfo(), operationRequest);
}
else if (role == RequestRole.Server) {
return handler.serverHandle(request.getSecretInfo(), operationRequest);
}
else if (role == RequestRole.Client) {
return handler.handle(request.getAuthInfo(), request.getSecretInfo(), operationRequest);
}
}
return null;
}
constructor() {
this.handlers = {};
this.requestUnAuthenticatedCodes = [];
}
}
;// ./src/GN-library/xdatetime/lib/xDatetime.ts
class xDatetime {
static ONE_SECOND_MILLISECOND = 1 * 1000;
static ONE_MINUTE_MILLISECOND = this.ONE_SECOND_MILLISECOND * 60;
static ONE_HOUR_MILLISECOND = this.ONE_MINUTE_MILLISECOND * 60;
static ONE_DAY_MILLISECOND = this.ONE_HOUR_MILLISECOND * 24;
static ONE_WEEK_MILLISECOND = this.ONE_DAY_MILLISECOND * 7;
static ONE_MONTH_MILLISECOND = this.ONE_DAY_MILLISECOND * 30;
static ONE_YEAR_MILLISECOND = this.ONE_DAY_MILLISECOND * 365;
static getCurrentMilliseconds() {
return this.getMilliseconds(this.getCurrentDate());
}
static getCurrentDate() {
return new Date();
}
static getMilliseconds(date) {
return Math.round(date.getTime());
}
static getDateAtMilliseconds(milliseconds) {
return new Date(milliseconds);
}
static getToday0hMilliseconds() {
let now = new Date();
let today0h = new Date(now.getFullYear(), now.getMonth(), now.getDate());
return this.getMilliseconds(today0h);
}
}
;// external "systeminformation"
const external_systeminformation_namespaceObject = require("systeminformation");
var external_systeminformation_default = /*#__PURE__*/__webpack_require__.n(external_systeminformation_namespaceObject);
;// external "mongodb"
const external_mongodb_namespaceObject = require("mongodb");
;// ./src/GN-app-api/service/AnalyticsService.ts
class AnalyticsService {
gnServer;
currentCCU;
currentDAU;
currentDAUSince0h;
currentDNU;
currentDNUSince0h;
currentDRT;
currentDRTSince0h;
currentMAU;
currentMAUSince0h1;
currentMNU;
currentMNUSince0h1;
currentMRT;
currentMRTSince0h1;
currentAnalyticsPrice;
currentCountry;
currentOperationSystem;
currentDatabaseSystem;
currentRequestComplete;
currentCost;
currentMonthlyCost;
setGNServer(gnServer) {
this.gnServer = gnServer;
}
async getBigAnalyticsItem(tsDate) {
let answer;
if (!tsDate) {
answer = {
CCU: this.currentCCU,
DAU: this.currentDAU,
DAUSince0h: this.currentDAUSince0h,
DNU: this.currentDNU,
DNUSince0h: this.currentDNUSince0h,
DRT: this.currentDRT,
DRTSince0h: this.currentDRTSince0h,
MAU: this.currentMAU,
MAUSince0h1: this.currentMAUSince0h1,
MNU: this.currentMNU,
MNUSince0h1: this.currentMNUSince0h1,
MRT: this.currentMRT,
MRTSince0h1: this.currentMRTSince0h1,
analyticsPrice: this.currentAnalyticsPrice,
country: this.currentCountry,
operationSystem: this.currentOperationSystem,
requestComplete: this.currentRequestComplete,
databaseSystem: this.currentDatabaseSystem,
cost: this.currentCost,
monthlyCost: this.currentMonthlyCost,
};
}
else {
let analyticsCollection = this.gnServer.getDatabase().systemCollection("Analytics");
let result = await analyticsCollection.findOne({ tsCreate: tsDate });
if (result == null) {
answer = {
CCU: 0,
DAU: 0,
DAUSince0h: 0,
DNU: 0,
DNUSince0h: 0,
DRT: 0,
DRTSince0h: 0,
MAU: 0,
MAUSince0h1: 0,
MNU: 0,
MNUSince0h1: 0,
MRT: 0,
MRTSince0h1: 0,
analyticsPrice: 0,
country: null,
operationSystem: null,
requestComplete: null,
databaseSystem: null,
cost: null,
monthlyCost: null,
};
}
else {
answer = {
CCU: result["ccu"],
DAU: result["dau"],
DAUSince0h: result["dauSince0h"],
DNU: result["dnu"],
DNUSince0h: result["dnuSince0h"],
DRT: result["drt"],
DRTSince0h: result["drtSince0h"],
MAU: result["mau"],
MAUSince0h1: result["mauSince0h1"],
MNU: result["mnu"],
MNUSince0h1: result["mnuSince0h1"],
MRT: result["mrt"],
MRTSince0h1: result["mrtSince0h1"],
analyticsPrice: result["analyticsPrice"],
country: result["country"],
operationSystem: result["operationSystem"],
requestComplete: result["requestComplete"],
databaseSystem: result["databaseSystem"],
cost: result["cost"],
monthlyCost: result["monthlyCost"],
};
}
}
return answer;
}
run() {
this.getAnalytics();
let thiz = this;
this.gnServer.getTimerService().subscriberEveryMinute(() => {
let currentDate = xDatetime.getCurrentDate();
if (currentDate.getMinutes() % 15 == 0)
thiz.analytics();
else if (currentDate.getMinutes() % 5 == 0) {
thiz.getAnalytics();
}
});
}
async analytics() {
await this.getAnalytics();
if (this.gnServer.isPrimary()) {
await this.saveAnalytics();
}
}
async getAnalytics() {
let currentMilliseconds = xDatetime.getCurrentMilliseconds();
let millisecondsSince0h = xDatetime.getToday0hMilliseconds();
let playerCollection = this.gnServer.getDatabase().systemCollection("MasterPlayer");
let millisecondsAt15MinutesAgo = currentMilliseconds - 15 * xDatetime.ONE_MINUTE_MILLISECOND;
// CCU
{
this.currentCCU = await playerCollection.countDocuments({
tsLastLogin: {
$gt: millisecondsAt15MinutesAgo
}
});
}
{
this.currentAnalyticsPrice = await this.gnServer.getDatabase().systemCollection("StoreAnalytics").countDocuments({
tsLastLogin: {
$gt: millisecondsAt15MinutesAgo
}
});
}
// DAU
{
let millisecondsAt1DayAgo = currentMillisecon