UNPKG

@xmobitea/gn-server

Version:

GearN Server by XmobiTea (Pro)

1,393 lines (1,375 loc) 6.46 MB
/******/ (() => { // 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), ErrorCode: () => (/* reexport */ ErrorCode), EventCode: () => (/* reexport */ EventCode), FacebookService: () => (/* reexport */ FacebookService), FieldDataType: () => (/* reexport */ FieldDataType), FriendCatalogSettingsParam: () => (/* reexport */ FriendCatalogSettingsParam), FriendStatus: () => (/* reexport */ FriendStatus), GNArray: () => (/* reexport */ GNArray), GNArrayBuilder: () => (/* reexport */ GNArrayBuilder), GNArrayDataMember: () => (/* reexport */ GNArrayDataMember), GNData: () => (/* reexport */ GNData), GNFieldDataType: () => (/* reexport */ GNFieldDataType), GNHashtable: () => (/* reexport */ GNHashtable), GNHashtableBuilder: () => (/* reexport */ GNHashtableBuilder), GNHashtableDataMember: () => (/* reexport */ GNHashtableDataMember), GNServer: () => (/* reexport */ GNServer), GameItem: () => (/* reexport */ GameItem), GamePlayer: () => (/* reexport */ GamePlayer), GamePlayerBase: () => (/* reexport */ GamePlayerBase), GamePlayerPermissionRulesParam: () => (/* reexport */ GamePlayerPermissionRulesParam), GamePlayerSettingsParam: () => (/* reexport */ GamePlayerSettingsParam), GameSettingsParam: () => (/* reexport */ GameSettingsParam), 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), 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), 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), MatchStatus: () => (/* reexport */ MatchStatus), 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), SecretRole: () => (/* reexport */ SecretRole), 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 /** * Enumerates low-level return codes surfaced through `OperationResponse`. * * These codes describe transport, gateway, authorization, validation, throttling, * or operation-level execution status. They are not business-domain errors. * * Read order: * 1. Check `returnCode` first. * 2. Only when `returnCode === ReturnCode.Ok` should callers trust typed `parameters` * and then continue checking the business `errorCode` inside the response payload. * * Value conventions: * - `1`: the request completed successfully at protocol level * - `0`: the request failed without a more specific mapped return code * - negative values: the request was rejected, timed out, or failed before a valid * business response could be produced */ class ReturnCode { /** * The selected secret key is missing, wrong, or does not match the current route/game context. */ static SecretInvalid = -10; /** * The serialized request payload exceeded the maximum size accepted by the backend. */ static MaxSizeRequestReject = -9; /** * The backend rejected the request because the current caller exceeded a request-rate limit. */ static MaxRequestReject = -8; /** * The backend rejected the request because the current concurrent-user/session limit was exceeded. */ static MaxCCUReject = -7; /** * The target operation exists, but the caller is not authorized for the selected role or target resource. */ static OperationNotAuthorized = -6; /** * The request shape or one or more request-member values are invalid. * When available, inspect `invalidMembers` for field-level details. */ static InvalidRequestParameters = -5; /** * The requested operation code is unknown or is not valid for the selected request type/role. */ static OperationInvalid = -4; /** * The backend hit an unhandled internal failure before producing a valid business response. */ static InternalServerError = -3; /** * The operation is known and the secret key is valid, but the permission rules attached * to the current secret key do not allow this operation in the current target context. * This usually maps to missing `selfEnable`, `otherSelfEnable`, `serverSelfEnable`, * or `adminSelfEnable` permission for the resolved request. */ static OperationNotAllow = -2; /** * The request timed out before a response was received. * This code may be synthesized by the SDK timeout layer as well as returned by the backend. */ static OperationTimeout = -1; /** * The request failed, but no more specific low-level return code was mapped. */ static UnknownError = 0; /** * The request completed successfully at protocol level and produced a response payload. * Callers must still validate the business `errorCode` in that payload. */ static Ok = 1; } ;// ./src/GN-common/entity/SecretInfo.ts var SecretRole; (function (SecretRole) { SecretRole[SecretRole["Admin"] = 1] = "Admin"; SecretRole[SecretRole["Server"] = 2] = "Server"; SecretRole[SecretRole["Client"] = 3] = "Client"; })(SecretRole || (SecretRole = {})); class BuilderBase { // Stores the secret key value used by this instance. secretKey; // Indicates whether remove. remove; // Stores the timestamp expire value used by this instance. tsExpire; // Stores the description value used by this instance. description; // Stores the permission value used by this instance. permission; // Stores the game ID value used by this instance. gameId; // Indicates whether default. isDefault; // Indicates whether only master admin should be allowed. onlyMasterAdmin; /** * Returns the secret key. * @returns Returns the secret key. */ getSecretKey() { return this.secretKey; } /** * Returns the permission. * @returns Returns the permission. */ getPermission() { return this.permission; } /** * Checks whether remove. * @returns Returns the operation result. */ isRemove() { return this.remove; } /** * Returns the timestamp expire. * @returns Returns the timestamp expire. */ getTsExpire() { return this.tsExpire; } /** * Returns the description. * @returns Returns the description. */ getDescription() { return this.description; } /** * Returns the game ID. * @returns Returns the game ID. */ getGameId() { return this.gameId; } /** * Returns whether default. * @returns Returns whether default. */ getIsDefault() { return this.isDefault; } /** * Returns whether only master admin. * @returns Returns whether only master admin. */ getIsOnlyMasterAdmin() { return this.onlyMasterAdmin; } /** * Sets the secret key. * @param secretKey Provides the secret key value used by this operation. * @returns Returns the current builder instance. */ setSecretKey(secretKey) { return this; } /** * Sets the permission. * @param permission Provides the permission value used by this operation. * @returns Returns the current builder instance. */ setPermission(permission) { return this; } /** * Sets the game ID. * @param gameId Provides the game ID value used by this operation. * @returns Returns the current builder instance. */ setGameId(gameId) { return this; } /** * Sets whether remove. * @param remove Provides the remove value used by this operation. * @returns Returns the current builder instance. */ setIsRemove(remove) { this.remove = remove; return this; } /** * Sets whether default. * @param isDefault Indicates whether default. * @returns Returns the current builder instance. */ setIsDefault(isDefault) { this.isDefault = isDefault; return this; } /** * Sets whether only master admin. * @param onlyMasterAdmin Indicates whether only master admin should be allowed. * @returns Returns the current builder instance. */ setIsOnlyMasterAdmin(onlyMasterAdmin) { this.onlyMasterAdmin = onlyMasterAdmin; return this; } /** * Sets the timestamp expire. * @param tsExpire Provides the timestamp expire value used by this operation. * @returns Returns the current builder instance. */ setTsExpire(tsExpire) { //this.tsExpire = tsExpire; return this; } /** * Sets the description. * @param description Provides the description value used by this operation. * @returns Returns the current builder instance. */ setDescription(description) { return this; } /** * Builds the configured instance. * @returns Returns the built secret info. */ build() { return null; } /** * Initializes a new builder base instance. */ constructor() { } } class Builder extends BuilderBase { /** * Sets the secret key. * @param secretKey Provides the secret key value used by this operation. * @returns Returns the current builder instance. */ setSecretKey(secretKey) { this.secretKey = secretKey; return this; } /** * Sets the timestamp expire. * @param tsExpire Provides the timestamp expire value used by this operation. * @returns Returns the current builder instance. */ setTsExpire(tsExpire) { this.tsExpire = tsExpire; return this; } /** * Sets the description. * @param description Provides the description value used by this operation. * @returns Returns the current builder instance. */ setDescription(description) { this.description = description; return this; } /** * Sets the permission. * @param permission Provides the permission value used by this operation. * @returns Returns the current builder instance. */ setPermission(permission) { this.permission = permission; return this; } /** * Sets the game ID. * @param gameId Provides the game ID value used by this operation. * @returns Returns the current builder instance. */ setGameId(gameId) { this.gameId = gameId; return this; } /** * Builds the configured instance. * @returns Returns the built secret info. */ build() { return new SecretInfo(this); } /** * Initializes a new builder instance. */ constructor() { super(); } } class SecretInfo extends BuilderBase { /** * Initializes a new secret info instance. * @param builder Provides the builder state copied into this instance. */ constructor(builder) { super(); this.secretKey = builder.getSecretKey(); this.remove = builder.isRemove(); this.tsExpire = builder.getTsExpire(); this.description = builder.getDescription(); this.permission = builder.getPermission(); this.gameId = builder.getGameId(); this.isDefault = builder.getIsDefault(); this.onlyMasterAdmin = builder.getIsOnlyMasterAdmin(); } /** * Sets the game ID. * @param gameId Provides the game ID value used by this operation. * @returns Returns the current builder instance. */ setGameId(gameId) { this.gameId = gameId; return this; } /** * Executes the to document data workflow. */ toDocumentData() { // Stores the doc value used in the current execution flow. let doc = { "secretKey": this.secretKey, "isRemove": this.remove, "tsExpire": this.tsExpire, "description": this.description, "permission": this.permission, "gameId": this.gameId, }; if (this.isDefault) doc["isDefault"] = true; if (this.onlyMasterAdmin) doc["onlyMasterAdmin"] = true; return doc; } /** * Creates a new builder instance. * @returns Returns a new builder instance. */ static Builder() { return new Builder(); } } ;// ./src/GN-common/constant/enumType/RequestRole.ts /** * Enumerates the trust boundary used when building a request route and selecting a secret key. */ var RequestRole; (function (RequestRole) { /** * Administrative route intended for operations tooling and privileged dashboards. */ RequestRole[RequestRole["Admin"] = 1] = "Admin"; /** * Trusted backend/server route intended for game servers and internal services. */ RequestRole[RequestRole["Server"] = 2] = "Server"; /** * Public client route intended for player applications. */ RequestRole[RequestRole["Client"] = 3] = "Client"; })(RequestRole || (RequestRole = {})); ;// ./src/GN-common/constant/enumType/RequestType.ts /** * Enumerates top-level request domains used to build transport routes. */ var RequestType; (function (RequestType) { /** * Custom application-defined operation domain. */ RequestType[RequestType["Custom"] = 0] = "Custom"; /** * Authentication domain. */ RequestType[RequestType["Authenticate"] = 1] = "Authenticate"; /** * Character-player domain. */ RequestType[RequestType["CharacterPlayer"] = 2] = "CharacterPlayer"; /** * Content/file domain. */ RequestType[RequestType["Content"] = 3] = "Content"; /** * Game-player domain. */ RequestType[RequestType["GamePlayer"] = 4] = "GamePlayer"; /** * Group domain. */ RequestType[RequestType["Group"] = 5] = "Group"; /** * Inventory/item domain. */ RequestType[RequestType["Inventory"] = 6] = "Inventory"; /** * Master-player domain. */ RequestType[RequestType["MasterPlayer"] = 7] = "MasterPlayer"; /** * Store-inventory domain. */ RequestType[RequestType["StoreInventory"] = 8] = "StoreInventory"; /** * Dashboard/administration domain. */ RequestType[RequestType["Dashboard"] = 9] = "Dashboard"; /** * Multiplayer/matchmaking domain. */ RequestType[RequestType["Multiplayer"] = 10] = "Multiplayer"; /** * CloudScript domain. */ RequestType[RequestType["CloudScript"] = 11] = "CloudScript"; })(RequestType || (RequestType = {})); ;// ./src/GN-common/constant/enumType/InvalidMemberType.ts /** * Enumerates validation failure categories reported for invalid request members. */ var InvalidMemberType; (function (InvalidMemberType) { /** * The backend rejected the member but did not map it to a more specific validation category. */ InvalidMemberType[InvalidMemberType["UnknownError"] = 1] = "UnknownError"; /** * The member is required but missing. */ InvalidMemberType[InvalidMemberType["DataRequired"] = 2] = "DataRequired"; /** * The member type does not match the expected runtime type. */ InvalidMemberType[InvalidMemberType["TypeInvalid"] = 3] = "TypeInvalid"; /** * A required string member is null or empty when null is not allowed. */ InvalidMemberType[InvalidMemberType["StringNull"] = 4] = "StringNull"; /** * A string member is shorter than the configured minimum length. */ InvalidMemberType[InvalidMemberType["StringMinLength"] = 5] = "StringMinLength"; /** * A string member is longer than the configured maximum length. */ InvalidMemberType[InvalidMemberType["StringMaxLength"] = 6] = "StringMaxLength"; /** * A numeric member is lower than the configured minimum value. */ InvalidMemberType[InvalidMemberType["NumberMinValue"] = 7] = "NumberMinValue"; /** * A numeric member is higher than the configured maximum value. */ InvalidMemberType[InvalidMemberType["NumberMaxValue"] = 8] = "NumberMaxValue"; /** * A numeric member must be an integer but received a non-integer value. */ InvalidMemberType[InvalidMemberType["NumberMustInt"] = 9] = "NumberMustInt"; /** * A required `GNHashtable` member is null. */ InvalidMemberType[InvalidMemberType["GNHashtableNull"] = 10] = "GNHashtableNull"; /** * A `GNHashtable` member contains fewer entries than allowed. */ InvalidMemberType[InvalidMemberType["GNHashtableMinLength"] = 11] = "GNHashtableMinLength"; /** * A `GNHashtable` member contains more entries than allowed. */ InvalidMemberType[InvalidMemberType["GNHashtableMaxLength"] = 12] = "GNHashtableMaxLength"; /** * A required `GNArray` member is null. */ InvalidMemberType[InvalidMemberType["GNArrayNull"] = 13] = "GNArrayNull"; /** * A `GNArray` member contains fewer items than allowed. */ InvalidMemberType[InvalidMemberType["GNArrayMinLength"] = 14] = "GNArrayMinLength"; /** * A `GNArray` member contains more items than allowed. */ InvalidMemberType[InvalidMemberType["GNArrayMaxLength"] = 15] = "GNArrayMaxLength"; })(InvalidMemberType || (InvalidMemberType = {})); ;// ./src/GN-common/helper/CodeHelper.ts class CodeHelperBase { // Stores the unknown code value used by this instance. static unknownCode = "Unknown"; // Stores the code dict collection used by this instance. codeDict; /** * Returns the code name. * @param code Provides the code value used by this operation. * @returns Returns the code name. */ getCodeName(code) { return this.codeDict.has(code) ? this.codeDict.get(code) : (CodeHelperBase.unknownCode + " (" + code + ")"); } /** * Initializes a new code helper base instance. * @param codeDict Provides the code dict value used by this operation. */ constructor(codeDict) { this.codeDict = codeDict; } } class CodeHelper { // Stores the return code helper value used by this instance. static returnCodeHelper; // Stores the request type helper value used by this instance. static requestTypeHelper; // Stores the request role helper value used by this instance. static requestRoleHelper; // Stores the secret role helper value used by this instance. static secretRoleHelper; static invalidMemberHelper; /** * Returns the return code name. * @param returnCode Provides the return code value used by this operation. * @returns Returns the return code name. */ static getReturnCodeName(returnCode) { return CodeHelper.returnCodeHelper.getCodeName(returnCode); } /** * Returns the request type name. * @param requestType Provides the request type value used by this operation. * @returns Returns the request type name. */ static getRequestTypeName(requestType) { return CodeHelper.requestTypeHelper.getCodeName(requestType); } /** * Returns the request role name. * @param requestRole Provides the request role value used by this operation. * @returns Returns the request role name. */ static getRequestRoleName(requestRole) { return CodeHelper.requestRoleHelper.getCodeName(requestRole); } /** * Returns the secret role name. * @param secretRole Provides the secret role value used by this operation. * @returns Returns the secret role name. */ static getSecretRoleName(secretRole) { return CodeHelper.secretRoleHelper.getCodeName(secretRole); } static getInvalidMemberName(invalidMember) { return CodeHelper.invalidMemberHelper.getCodeName(invalidMember); } /** * Executes the init workflow. */ static init() { this.setReturnCodeDic(); this.setRequestTypeDic(); this.setRequestRoleDic(); this.setSecretRoleDic(); this.setInvalidMemberDic(); } /** * Sets the return code dictionary. */ static setReturnCodeDic() { this.returnCodeHelper = new CodeHelperBase(new Map()); this.addReturnCodeDic(ReturnCode); } /** * Adds the return code dictionary. * @param returnCode Provides the return code value used by this operation. */ static addReturnCodeDic(returnCode) { // Stores the keys value used in the current execution flow. let keys = Object.keys(returnCode); // Stores the values value used in the current execution flow. let values = Object.values(returnCode); for (let i = 0; i < keys.length; i++) { this.returnCodeHelper.codeDict.set(values[i], keys[i]); } } /** * Sets the request type dictionary. */ static setRequestTypeDic() { this.requestTypeHelper = new CodeHelperBase(new Map()); this.addRequestTypeDic(RequestType); } /** * Adds the request type dictionary. * @param requestType Provides the request type value used by this operation. */ static addRequestTypeDic(requestType) { // Stores the keys value used in the current execution flow. let keys = Object.keys(requestType); // Stores the values value used in the current execution flow. let values = Object.values(requestType); for (let i = 0; i < keys.length; i++) { // Stores the key value used in the current execution flow. let key = keys[i]; this.requestTypeHelper.codeDict.set(values[i], key[0].toLowerCase() + key.slice(1)); } } /** * Sets the request role dictionary. */ static setRequestRoleDic() { this.requestRoleHelper = new CodeHelperBase(new Map()); this.addRequestRoleDic(RequestRole); } /** * Adds the request role dictionary. * @param requestRole Provides the request role value used by this operation. */ static addRequestRoleDic(requestRole) { // Stores the keys value used in the current execution flow. let keys = Object.keys(requestRole); // Stores the values value used in the current execution flow. let values = Object.values(requestRole); for (let i = 0; i < keys.length; i++) { // Stores the key value used in the current execution flow. let key = keys[i]; this.requestRoleHelper.codeDict.set(values[i], key[0].toLowerCase() + key.slice(1)); } } /** * Sets the secret role dictionary. */ static setSecretRoleDic() { this.secretRoleHelper = new CodeHelperBase(new Map()); this.addSecretRoleDic(SecretRole); } /** * Adds the secret role dictionary. * @param secretRole Provides the secret role value used by this operation. */ static addSecretRoleDic(secretRole) { // Stores the keys value used in the current execution flow. let keys = Object.keys(secretRole); // Stores the values value used in the current execution flow. let values = Object.values(secretRole); for (let i = 0; i < keys.length; i++) { // Stores the key value used in the current execution flow. let key = keys[i]; this.secretRoleHelper.codeDict.set(values[i], key[0].toLowerCase() + key.slice(1)); } } static setInvalidMemberDic() { this.invalidMemberHelper = new CodeHelperBase(new Map()); this.addInvalidMemberDic(InvalidMemberType); } static addInvalidMemberDic(invalidMember) { // Stores the keys value used in the current execution flow. let keys = Object.keys(invalidMember); // Stores the values value used in the current execution flow. let values = Object.values(invalidMember); for (let i = 0; i < keys.length; i++) { // Stores the key value used in the current execution flow. let key = keys[i]; this.invalidMemberHelper.codeDict.set(values[i], key[0].toLowerCase() + key.slice(1)); } } } ;// ./src/GN-common/common/GNData.ts class GNData { /** * Executes the get workflow. * @param k Provides the k value used by this operation. * @param def Provides the def value used by this operation. * @returns Returns the operation result. */ get(k, def) { return def; } /** * Returns the boolean. * @param k Provides the k value used by this operation. * @param def Provides the def value used by this operation. * @returns Returns the boolean. */ getBoolean(k, def) { return this.get(k, def); } /** * Returns the object. * @param k Provides the k value used by this operation. * @param def Provides the def value used by this operation. * @returns Returns the object. */ getObject(k, def) { return this.get(k, def); } /** * Returns the string. * @param k Provides the k value used by this operation. * @param def Provides the def value used by this operation. * @returns Returns the string. */ getString(k, def) { return this.get(k, def); } /** * Returns the number. * @param k Provides the k value used by this operation. * @param def Provides the def value used by this operation. * @returns Returns the number. */ getNumber(k, def) { return this.get(k, def); } /** * Returns the GearN hashtable. * @param k Provides the k value used by this operation. * @param def Provides the def value used by this operation. * @returns Returns the GearN hashtable. */ getGNHashtable(k, def) { return this.get(k, def); } /** * Returns the GearN array. * @param k Provides the k value used by this operation. * @param def Provides the def value used by this operation. * @returns Returns the GearN array. */ getGNArray(k, def) { return this.get(k, def); } /** * Creates the GearN hashtable from object. * @param value Provides the value value used by this operation. * @returns Returns the operation result. */ static createGNHashtableFromObject(value) { // Stores the answer value used in the current execution flow. let answer = new GNHashtable(); // Stores the value keys value used in the current execution flow. let valueKeys = Object.keys(value); for (let i = 0; i < valueKeys.length; i++) { // Stores the key value used in the current execution flow. let key = valueKeys[i]; answer.add(key, value[key]); } return answer; } /** * Creates the GearN array from array. * @param value Provides the value value used by this operation. * @returns Returns the operation result. */ static createGNArrayFromArray(value) { // Stores the answer value used in the current execution flow. let answer = new GNArray(); // Stores the value arr value used in the current execution flow. let valueArr = value; for (let i = 0; i < valueArr.length; i++) { answer.add(valueArr[i]); } return answer; } /** * Creates the use data from origin data. * @param value Provides the value value used by this operation. * @returns Returns the operation result. */ static createUseDataFromOriginData(value) { if (value == null) return null; // Stores the type of value value used in the current execution flow. 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; } /** * Creates the data from use data. * @param value Provides the value value used by this operation. * @returns Returns the operation result. */ static createDataFromUseData(value) { if (value == null) return null; if (value instanceof GNData) { return value.toData(); } return value; } } class GNHashtableBuilder { // Stores the dict collection used by this instance. dict = {}; /** * Executes the add workflow. * @param k Provides the k value used by this operation. * @param value Provides the value value used by this operation. * @returns Returns the operation result. */ add(k, value) { this.dict[k] = value; return this; } /** * Adds the all. * @param dict Provides the dict value used by this operation. */ addAll(dict) { // Stores the keys value used in the current execution flow. let keys = Object.keys(dict); keys.forEach(keyStr => { this.add(keyStr, dict[keyStr]); }); return this; } /** * Initializes a new GearN hashtable builder instance. */ constructor() { this.dict = {}; } /** * Builds the configured instance. * @returns Returns the built GearN hashtable. */ build() { // Stores the answer value used in the current execution flow. let answer = new GNHashtable(); // Stores the keys value used in the current execution flow. let keys = Object.keys(this.dict); keys.forEach(keyStr => { answer.add(keyStr, this.dict[keyStr]); }); return answer; } } class GNHashtable extends GNData { // Stores the dict collection used by this instance. dict = {}; /** * Executes the clear workflow. */ clear() { this.dict = {}; } /** * Executes the remove workflow. * @param k Provides the k value used by this operation. * @returns Returns the operation result. */ remove(k) { if (this.containsKey(k)) { delete this.dict[k]; return true; } return false; } /** * Executes the count workflow. * @returns Returns the operation result. */ count() { return Object.keys(this.dict).length; } /** * Executes the contains key workflow. * @param k Provides the k value used by this operation. * @returns Returns the operation result. */ containsKey(k) { // Stores the keys value used in the current execution flow. let keys = Object.keys(this.dict); // Stores the k str value used in the current execution flow. let kStr = k.toString(); return keys.indexOf(kStr) != -1; } /** * Executes the get workflow. * @param k Provides the k value used by this operation. * @param def Provides the def value used by this operation. * @returns Returns the operation result. */ get(k, def) { // Stores the value value used in the current execution flow. let value = this.dict[k]; if (value == null) return def; return value; } /** * Executes the add workflow. * @param k Provides the k value used by this operation. * @param value Provides the value value used by this operation. */ add(k, value) { this.dict[k] = GNData.createUseDataFromOriginData(value); } /** * Executes the to data workflow. * @returns Returns the operation result. */ toData() { // Stores the anwser value used in the current execution flow. let anwser = {}; // Stores the keys value used in the current execution flow. let keys = Object.keys(this.dict); for (let i = 0; i < keys.length; i++) { // Stores the key value used in the current execution flow. let key = keys[i]; anwser[key] = GNData.createDataFromUseData(this.dict[key]); } return anwser; } /** * Creates a new builder instance. * @returns Returns a new builder instance. */ static builder() { return new GNHashtableBuilder(); } /** * Executes the to string workflow. * @returns Returns the operation result. */ toString() { return JSON.stringify(this.dict); } } class GNArrayBuilder { // Stores the array value used by this instance. array; /** * Executes the add workflow. * @param value Provides the value value used by this operation. * @returns Returns the operation result. */ add(value) { this.array.push(value); return this; } /** * Adds the all. * @param array Provides the array value used by this operation. * @returns Returns the operation result. */ addAll(array) { array.forEach(o => { this.add(o); }); return this; } /** * Builds the configured instance. * @returns Returns the built GearN array. */ build() { // Stores the awnser value used in the current execution flow. let awnser = new GNArray(); this.array.forEach(o => { awnser.add(o); }); return awnser; } /** * Initializes a new GearN array builder instance. */ constructor() { this.array = []; } } class GNArray extends GNData { // Stores the array value used by this instance. array = []; /** * Executes the clear workflow. */ clear() { this.array = []; } /** * Executes the index of workflow. * @param item Provides the item value used by this operation. * @returns Returns the operation result. */ indexOf(item) { return this.array.indexOf(item); } /** * Executes the remove workflow. * @param k Provides the k value used by this operation. * @returns Returns the operation result. */ remove(k) { if (k < 0 || k >= this.array.length) return false; this.array.splice(k, 1); return true; } /** * Executes the count workflow. * @returns Returns the operation result. */ count() { return this.array.length; } /** * Executes the get workflow. * @param k Provides the k value used by this operation. * @param def Provides the def value used by this operation. * @returns Returns the operation result. */ get(k, def) { if (k < 0 || k >= this.array.length) return null; // Stores the value value used in the current execution flow. let value = this.array[k]; if (value == null) return def; return value; } /** * Executes the add workflow. * @param value Provides the value value used by this operation. */ add(value) { this.array.push(GNData.createUseDataFromOriginData(value)); } /** * Executes the to data workflow. */ toData() { // Stores the anwser value used in the current execution flow. let anwser = []; for (let i = 0; i < this.array.length; i++) { anwser.push(GNData.createDataFromUseData(this.array[i])); } return anwser; } /** * Creates a new builder instance. * @returns Returns a new builder instance. */ static builder() { return new GNArrayBuilder(); } /** * Executes the to string workflow. * @returns Returns the operation result. */ toString() { return JSON.stringify(this.array); } } ;// ./src/GN-common/entity/operationResponse/OperationResponse.ts class OperationResponse { // Stores the operation code value used by this instance. operationCode; // Stores the response ID value used by this instance. responseId; // Stores the return code value used by this instance. returnCode; // Stores the debug message value used by this instance. debugMessage; // Stores the parameters value used by this instance. parameters; // Stores the invalid members list used by this instance. invalidMembers; /** * Initializes a new operation response instance. * @param operationCode Provides the operation code value used by this operation. * @param responseId Provides the response ID value used by this operation. */ constructor(operationCode, responseId) { this.operationCode = operationCode; this.responseId = responseId; this.parameters = new GNHashtable(); this.debugMessage = null; } /** * Returns the operation code. * @returns Returns the operation code. */ getOperationCode() { return this.operationCode; } /** * Returns the return code. * @returns Returns the return code. */ getReturnCode() { return this.returnCode; } /** * Returns the parameters. * @returns Returns the parameters. */ getParameters() { return this.parameters; } /** * Returns the response ID. * @returns Returns the response ID. */ getResponseId() { return this.responseId; } /** * Returns the debug message. * @returns Returns the debug message. */ getDebugMessage() { return this.debugMessage; } /** * Returns the invalid members. * @returns Returns the invalid members. */ getInvalidMembers() { return this.invalidMembers; } /** * Checks whether error exists. * @returns Returns the operation result. */ hasError() { return this.getReturnCode() != ReturnCode.Ok; } /** * Sets the return code. * @param returnCode Provides the return code value used by this operation. * @returns Returns the current operation response instance. */