@xmobitea/gn-server 2.1.0 → 2.3.0

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.
Files changed (204) hide show
  1. package/GNconfig.debug.json +30 -27
  2. package/dist/GN-app-api/handler/controller/handler/authenticate/LoginBaseRequestHandler.d.ts +1 -1
  3. package/dist/GN-app-api/handler/controller/handler/authenticate/LoginByGameCenterRequestHandler.d.ts +24 -0
  4. package/dist/GN-app-api/handler/controller/handler/authenticate/LoginByGooglePlayGameServiceRequestHandler.d.ts +19 -0
  5. package/dist/GN-app-api/handler/controller/handler/authenticate/RegisterAccountRequestHandler.d.ts +1 -6
  6. package/dist/GN-app-api/handler/controller/handler/authenticate/model/InfoRequestParam.d.ts +1 -0
  7. package/dist/GN-app-api/handler/controller/handler/base/RequestHandler.d.ts +1 -1
  8. package/dist/GN-app-api/handler/controller/handler/characterPlayer/GetCreateLeaderboardRequestHandler.d.ts +23 -0
  9. package/dist/GN-app-api/handler/controller/handler/characterPlayer/GetCurrencyLogRequestHandler.d.ts +22 -0
  10. package/dist/GN-app-api/handler/controller/handler/characterPlayer/GetFriendStatisticsLeaderboardRequestHandler.d.ts +2 -1
  11. package/dist/GN-app-api/handler/controller/handler/characterPlayer/GetStatisticsLeaderboardRequestHandler.d.ts +1 -0
  12. package/dist/GN-app-api/handler/controller/handler/characterPlayer/GetStatisticsLogRequestHandler.d.ts +22 -0
  13. package/dist/GN-app-api/handler/controller/handler/characterPlayer/SetPlayerCurrencyRequestHandler.d.ts +1 -0
  14. package/dist/GN-app-api/handler/controller/handler/characterPlayer/SetPlayerStatisticsRequestHandler.d.ts +1 -0
  15. package/dist/GN-app-api/handler/controller/handler/characterPlayer/model/PlayerDataParam.d.ts +0 -1
  16. package/dist/GN-app-api/handler/controller/handler/cloudScript/ExecuteFunctionRequestHandler.d.ts +1 -1
  17. package/dist/GN-app-api/handler/controller/handler/content/GetContentDataRequestHandler.d.ts +1 -1
  18. package/dist/GN-app-api/handler/controller/handler/content/GetFileUploadInfoListRequestHandler.d.ts +0 -1
  19. package/dist/GN-app-api/handler/controller/handler/dashboard/GetAnalyticsRequestHandler.d.ts +22 -0
  20. package/dist/GN-app-api/handler/controller/handler/dashboard/GetBackupStatisticsLeaderboardVersionRequestHandler.d.ts +18 -0
  21. package/dist/GN-app-api/handler/controller/handler/dashboard/GetEventCallbackCloudScriptRequestHandler.d.ts +15 -0
  22. package/dist/GN-app-api/handler/controller/handler/dashboard/GetServerGameDataRequestHandler.d.ts +34 -0
  23. package/dist/GN-app-api/handler/controller/handler/dashboard/GetServerLogRequestHandler.d.ts +2 -0
  24. package/dist/GN-app-api/handler/controller/handler/dashboard/GetUsernameAdminAccountRequestHandler.d.ts +16 -0
  25. package/dist/GN-app-api/handler/controller/handler/dashboard/GrantSecretInfoRequestHandler.d.ts +4 -1
  26. package/dist/GN-app-api/handler/controller/handler/dashboard/ResetStatisticsLeaderboardRequestHandler.d.ts +20 -0
  27. package/dist/GN-app-api/handler/controller/handler/dashboard/SetEventCallbackCloudScriptRequestHandler.d.ts +17 -0
  28. package/dist/GN-app-api/handler/controller/handler/dashboard/SetMasterGameSettingsRequestHandler.d.ts +4 -0
  29. package/dist/GN-app-api/handler/controller/handler/dashboard/model/AuthenticatePermissionRulesParam.d.ts +2 -0
  30. package/dist/GN-app-api/handler/controller/handler/dashboard/model/CharacterPlayerPermissionRulesParam.d.ts +3 -0
  31. package/dist/GN-app-api/handler/controller/handler/dashboard/model/ContentPermissionRulesParam.d.ts +2 -2
  32. package/dist/GN-app-api/handler/controller/handler/dashboard/model/CurrencySettingsParam.d.ts +2 -0
  33. package/dist/GN-app-api/handler/controller/handler/dashboard/model/EmailSettingsParam.d.ts +4 -0
  34. package/dist/GN-app-api/handler/controller/handler/dashboard/model/GamePlayerPermissionRulesParam.d.ts +3 -0
  35. package/dist/GN-app-api/handler/controller/handler/dashboard/model/GroupPermissionRulesParam.d.ts +3 -0
  36. package/dist/GN-app-api/handler/controller/handler/dashboard/model/InventoryPermissionRulesParam.d.ts +2 -0
  37. package/dist/GN-app-api/handler/controller/handler/dashboard/model/MasterAdminPermissionRulesParam.d.ts +6 -0
  38. package/dist/GN-app-api/handler/controller/handler/dashboard/model/MasterPlayerPermissionRulesParam.d.ts +16 -0
  39. package/dist/GN-app-api/handler/controller/handler/dashboard/model/MatchmakingQueueSettingsParam.d.ts +4 -0
  40. package/dist/GN-app-api/handler/controller/handler/dashboard/model/MultiplayerPermissionRulesParam.d.ts +2 -0
  41. package/dist/GN-app-api/handler/controller/handler/dashboard/model/PushNotificationSettingsParam.d.ts +5 -0
  42. package/dist/GN-app-api/handler/controller/handler/dashboard/model/StatisticsSettingsParam.d.ts +3 -0
  43. package/dist/GN-app-api/handler/controller/handler/dashboard/model/StoreInventoryPermissionRulesParam.d.ts +3 -0
  44. package/dist/GN-app-api/handler/controller/handler/dashboard/model/TagSettingsParam.d.ts +1 -0
  45. package/dist/GN-app-api/handler/controller/handler/dashboard/model/ThirtPartyAppleSettingsParam.d.ts +3 -0
  46. package/dist/GN-app-api/handler/controller/handler/dashboard/model/ThirtPartyGameCenterSettingsParam.d.ts +3 -0
  47. package/dist/GN-app-api/handler/controller/handler/dashboard/model/ThirtPartyGooglePlayGameSettingsParam.d.ts +6 -0
  48. package/dist/GN-app-api/handler/controller/handler/dashboard/model/ThirtPartyGoogleSettingsParam.d.ts +3 -3
  49. package/dist/GN-app-api/handler/controller/handler/dashboard/model/ThirtPartyParam.d.ts +4 -0
  50. package/dist/GN-app-api/handler/controller/handler/gamePlayer/GetCreateLeaderboardRequestHandler.d.ts +22 -0
  51. package/dist/GN-app-api/handler/controller/handler/gamePlayer/GetCurrencyLogRequestHandler.d.ts +22 -0
  52. package/dist/GN-app-api/handler/controller/handler/gamePlayer/GetFriendStatisticsLeaderboardRequestHandler.d.ts +2 -1
  53. package/dist/GN-app-api/handler/controller/handler/gamePlayer/GetStatisticsLeaderboardRequestHandler.d.ts +1 -0
  54. package/dist/GN-app-api/handler/controller/handler/gamePlayer/GetStatisticsLogRequestHandler.d.ts +22 -0
  55. package/dist/GN-app-api/handler/controller/handler/gamePlayer/SetPlayerCurrencyRequestHandler.d.ts +1 -0
  56. package/dist/GN-app-api/handler/controller/handler/gamePlayer/SetPlayerStatisticsRequestHandler.d.ts +1 -0
  57. package/dist/GN-app-api/handler/controller/handler/gamePlayer/model/PlayerDataParam.d.ts +0 -1
  58. package/dist/GN-app-api/handler/controller/handler/group/GetCreateLeaderboardRequestHandler.d.ts +22 -0
  59. package/dist/GN-app-api/handler/controller/handler/group/GetCurrencyLogRequestHandler.d.ts +22 -0
  60. package/dist/GN-app-api/handler/controller/handler/group/GetStatisticsLeaderboardRequestHandler.d.ts +1 -0
  61. package/dist/GN-app-api/handler/controller/handler/group/GetStatisticsLogRequestHandler.d.ts +22 -0
  62. package/dist/GN-app-api/handler/controller/handler/group/GroupBaseRequestHandler.d.ts +1 -1
  63. package/dist/GN-app-api/handler/controller/handler/group/SetGroupCurrencyRequestHandler.d.ts +1 -0
  64. package/dist/GN-app-api/handler/controller/handler/group/SetGroupStatisticsRequestHandler.d.ts +1 -0
  65. package/dist/GN-app-api/handler/controller/handler/group/model/GroupDataParam.d.ts +0 -1
  66. package/dist/GN-app-api/handler/controller/handler/inventory/GetCreateLeaderboardRequestHandler.d.ts +22 -0
  67. package/dist/GN-app-api/handler/controller/handler/inventory/GetStatisticsLeaderboardRequestHandler.d.ts +1 -0
  68. package/dist/GN-app-api/handler/controller/handler/inventory/GetStatisticsLogRequestHandler.d.ts +22 -0
  69. package/dist/GN-app-api/handler/controller/handler/inventory/SetItemStatisticsRequestHandler.d.ts +1 -0
  70. package/dist/GN-app-api/handler/controller/handler/inventory/model/ItemDataParam.d.ts +0 -1
  71. package/dist/GN-app-api/handler/controller/handler/masterPlayer/AddPushNotificationRequestHandler.d.ts +20 -0
  72. package/dist/GN-app-api/handler/controller/handler/masterPlayer/GetCreateLeaderboardRequestHandler.d.ts +22 -0
  73. package/dist/GN-app-api/handler/controller/handler/masterPlayer/GetCurrencyLogRequestHandler.d.ts +22 -0
  74. package/dist/GN-app-api/handler/controller/handler/masterPlayer/GetLastLoginLeaderboardRequestHandler.d.ts +22 -0
  75. package/dist/GN-app-api/handler/controller/handler/masterPlayer/GetPlayersWithGameCenterRequestHandler.d.ts +20 -0
  76. package/dist/GN-app-api/handler/controller/handler/masterPlayer/GetPlayersWithGooglePlayGameServiceRequestHandler.d.ts +20 -0
  77. package/dist/GN-app-api/handler/controller/handler/masterPlayer/GetPushNotificationRequestHandler.d.ts +18 -0
  78. package/dist/GN-app-api/handler/controller/handler/masterPlayer/GetStatisticsLeaderboardRequestHandler.d.ts +1 -0
  79. package/dist/GN-app-api/handler/controller/handler/masterPlayer/GetStatisticsLogRequestHandler.d.ts +22 -0
  80. package/dist/GN-app-api/handler/controller/handler/masterPlayer/LinkGameCenterRequestHandler.d.ts +25 -0
  81. package/dist/GN-app-api/handler/controller/handler/masterPlayer/LinkGooglePlayGameServiceRequestHandler.d.ts +20 -0
  82. package/dist/GN-app-api/handler/controller/handler/masterPlayer/MasterPlayerBaseRequestHandler.d.ts +1 -0
  83. package/dist/GN-app-api/handler/controller/handler/masterPlayer/RemovePushNotificationRequestHandler.d.ts +19 -0
  84. package/dist/GN-app-api/handler/controller/handler/masterPlayer/SendEmailRequestHandler.d.ts +20 -0
  85. package/dist/GN-app-api/handler/controller/handler/masterPlayer/SendPushNotificationRequestHandler.d.ts +25 -0
  86. package/dist/GN-app-api/handler/controller/handler/masterPlayer/SendSocketOperationEventRequestHandler.d.ts +22 -0
  87. package/dist/GN-app-api/handler/controller/handler/masterPlayer/SetPlayerCurrencyRequestHandler.d.ts +1 -0
  88. package/dist/GN-app-api/handler/controller/handler/masterPlayer/SetPlayerStatisticsRequestHandler.d.ts +1 -0
  89. package/dist/GN-app-api/handler/controller/handler/masterPlayer/UnlinkGameCenterRequestHandler.d.ts +19 -0
  90. package/dist/GN-app-api/handler/controller/handler/masterPlayer/UnlinkGooglePlayGameServiceRequestHandler.d.ts +19 -0
  91. package/dist/GN-app-api/handler/controller/handler/masterPlayer/model/InfoRequestParam.d.ts +1 -0
  92. package/dist/GN-app-api/handler/controller/handler/multiplayer/GetAllMatchRequestHandler.d.ts +20 -0
  93. package/dist/GN-app-api/handler/controller/handler/multiplayer/GetAllMatchmakingTicketRequestHandler.d.ts +21 -0
  94. package/dist/GN-app-api/handler/controller/handler/multiplayer/MatchmakingHandler.d.ts +2 -2
  95. package/dist/GN-app-api/handler/controller/handler/storeInventory/BuyStoreItemRequestHandler.d.ts +1 -0
  96. package/dist/GN-app-api/handler/controller/handler/storeInventory/GetCreateLeaderboardRequestHandler.d.ts +22 -0
  97. package/dist/GN-app-api/handler/controller/handler/storeInventory/GetStoreLogRequestHandler.d.ts +22 -0
  98. package/dist/GN-app-api/handler/controller/handler/storeInventory/GrantStoreItemRequestHandler.d.ts +1 -0
  99. package/dist/GN-app-api/handler/controller/handler/storeInventory/PresentStoreItemRequestHandler.d.ts +21 -0
  100. package/dist/GN-app-api/handler/controller/handler/storeInventory/SetStoreItemInformationRequestHandler.d.ts +8 -8
  101. package/dist/GN-app-api/handler/controller/handler/storeInventory/ValidateAppleAppStoreReceiptRequestHandler.d.ts +1 -0
  102. package/dist/GN-app-api/handler/controller/handler/storeInventory/ValidateFacebookStoreReceiptRequestHandler.d.ts +1 -0
  103. package/dist/GN-app-api/handler/controller/handler/storeInventory/ValidateGooglePlayStoreReceiptRequestHandler.d.ts +1 -0
  104. package/dist/GN-app-api/handler/controller/handler/storeInventory/model/InAppPurchaseParam.d.ts +4 -3
  105. package/dist/GN-app-api/service/AnalyticsService.d.ts +4 -2
  106. package/dist/GN-app-api/service/AppleService.d.ts +16 -4
  107. package/dist/GN-app-api/service/CloudScriptService.d.ts +14 -2
  108. package/dist/GN-app-api/service/CountryIPDetailService.d.ts +11 -0
  109. package/dist/GN-app-api/service/EventCallbackService.d.ts +103 -0
  110. package/dist/GN-app-api/service/GameCenterService.d.ts +19 -0
  111. package/dist/GN-app-api/service/GenericService.d.ts +3 -2
  112. package/dist/GN-app-api/service/GooglePlayGameService.d.ts +21 -0
  113. package/dist/GN-app-api/service/IAnalyticsService.d.ts +13 -2
  114. package/dist/GN-app-api/service/ICloudScriptService.d.ts +3 -1
  115. package/dist/GN-app-api/service/ICountryIPDetailService.d.ts +20 -0
  116. package/dist/GN-app-api/service/IGameCenterService.d.ts +13 -0
  117. package/dist/GN-app-api/service/IGenericService.d.ts +6 -3
  118. package/dist/GN-app-api/service/IGooglePlayGameService.d.ts +5 -0
  119. package/dist/GN-common/constant/Commands.d.ts +1 -0
  120. package/dist/GN-common/constant/OperationCode.d.ts +29 -0
  121. package/dist/GN-common/constant/enumType/OwnerType.d.ts +2 -1
  122. package/dist/GN-common/constant/enumType/PushPlatformType.d.ts +4 -0
  123. package/dist/GN-common/constant/enumType/StoreReceiveType.d.ts +7 -0
  124. package/dist/GN-common/constant/errorCode/GNErrorCode.d.ts +2 -0
  125. package/dist/GN-common/constant/parameterCode/GNParameterCode.d.ts +120 -1
  126. package/dist/GN-common/entity/SecretInfo.d.ts +48 -1
  127. package/dist/GN-common/helper/StringUtility.d.ts +1 -1
  128. package/dist/GN-library/xcachedata/lib/xCacheData.d.ts +1 -0
  129. package/dist/GN-library/xconfig/lib/xConfig.d.ts +2 -1
  130. package/dist/GN-library/xdatabase/lib/entity/pro/ExternalItem.d.ts +10 -0
  131. package/dist/GN-library/xdatabase/lib/entity/pro/IPDetailItem.d.ts +5 -0
  132. package/dist/GN-library/xdatabase/lib/entity/pro/MasterPlayer.d.ts +13 -0
  133. package/dist/GN-library/xdatabase/lib/entity/pro/MongoObject.d.ts +2 -0
  134. package/dist/GN-library/xdatabase/lib/entity/pro/PushNotificationItem.d.ts +5 -0
  135. package/dist/GN-library/xdatabase/lib/entity/pro/StoreInventory.d.ts +1 -0
  136. package/dist/GN-library/xdatabase/lib/entity/pro/findOptions/MasterPlayerFindOptions.d.ts +2 -0
  137. package/dist/GN-library/xdatabase/lib/entity/pro/masterAdmin/MasterGameSettings.d.ts +10 -0
  138. package/dist/GN-library/xdatabase/lib/xDatabase.d.ts +113 -10
  139. package/dist/GN-library/xdebug/lib/xDebug.d.ts +1 -0
  140. package/dist/GN-library/xmail/lib/xMail.d.ts +3 -1
  141. package/dist/GN-library/xnotification/lib/xPushNotification.d.ts +27 -0
  142. package/dist/GN-library/xsettings/lib/entity/xCurrencySettings.d.ts +2 -0
  143. package/dist/GN-library/xsettings/lib/entity/xEmailSettings.d.ts +4 -0
  144. package/dist/GN-library/xsettings/lib/entity/xPushNotificationSettings.d.ts +5 -0
  145. package/dist/GN-library/xsettings/lib/entity/xStatisticsSettings.d.ts +3 -0
  146. package/dist/GN-library/xsettings/lib/entity/xTagSettings.d.ts +1 -0
  147. package/dist/GN-library/xsettings/lib/entity/xThirtPartySettings.d.ts +12 -0
  148. package/dist/GN-startup/DefaultApplicationStartup.d.ts +1 -2
  149. package/dist/GN-startup/HttpApp.d.ts +0 -3
  150. package/dist/GN-startup/ServerApplication.d.ts +0 -4
  151. package/dist/GN-startup/cloudScript/eventCallbackCloudScriptData.json +1818 -0
  152. package/dist/GN-startup/cloudScript/templateCloudScript.ts +567 -0
  153. package/dist/GN-startup/cloudScript/templateEventCallback.ts +798 -0
  154. package/dist/GN-startup/middleware/AntiDdosMiddleware.d.ts +4 -1
  155. package/dist/GN-startup/middleware/ApiMiddleware.d.ts +1 -0
  156. package/dist/GN-startup/routes/AdminAppHandler.d.ts +0 -31
  157. package/dist/GN-startup/settings/DDosSettings.d.ts +3 -0
  158. package/dist/GN-startup/settings/OtherSettings.d.ts +6 -0
  159. package/dist/GNServer.d.ts +30 -4
  160. package/dist/index.d.ts +144 -6
  161. package/dist/index.js +21329 -6740
  162. package/gn.sh +7 -10
  163. package/package.json +24 -27
  164. package/syncCode.js +341 -341
  165. package/syncCodeVer2.js +176 -0
  166. package/dist/GN-startup/cloudScript/template.ts +0 -118
  167. package/dist/GN-startup/routes/www/public/admin/debug-common.js +0 -1233
  168. package/dist/GN-startup/routes/www/public/admin/index-common.js +0 -217
  169. package/dist/GN-startup/routes/www/public/admin/log-common.js +0 -52
  170. package/dist/GN-startup/routes/www/public/admin/signin-common.js +0 -35
  171. package/dist/GN-startup/routes/www/public/assets/demo/chart-area-demo.js +0 -54
  172. package/dist/GN-startup/routes/www/public/assets/demo/chart-bar-demo.js +0 -46
  173. package/dist/GN-startup/routes/www/public/assets/demo/chart-pie-demo.js +0 -16
  174. package/dist/GN-startup/routes/www/public/assets/demo/datatables-demo.js +0 -4
  175. package/dist/GN-startup/routes/www/public/assets/img/error-404-monochrome.svg +0 -1
  176. package/dist/GN-startup/routes/www/public/css/styles.css +0 -11701
  177. package/dist/GN-startup/routes/www/public/favicon.ico +0 -0
  178. package/dist/GN-startup/routes/www/public/favicon.png +0 -0
  179. package/dist/GN-startup/routes/www/public/js/scripts.js +0 -26
  180. package/dist/GN-startup/routes/www/views/101.ejs +0 -21
  181. package/dist/GN-startup/routes/www/views/401.ejs +0 -25
  182. package/dist/GN-startup/routes/www/views/403.ejs +0 -21
  183. package/dist/GN-startup/routes/www/views/404.ejs +0 -25
  184. package/dist/GN-startup/routes/www/views/500.ejs +0 -25
  185. package/dist/GN-startup/routes/www/views/admin/change-password.ejs +0 -46
  186. package/dist/GN-startup/routes/www/views/admin/debug.ejs +0 -14
  187. package/dist/GN-startup/routes/www/views/admin/index.ejs +0 -28
  188. package/dist/GN-startup/routes/www/views/admin/log.ejs +0 -16
  189. package/dist/GN-startup/routes/www/views/admin/signin.ejs +0 -56
  190. package/dist/GN-startup/routes/www/views/layout.ejs +0 -8
  191. package/dist/GN-startup/routes/www/views/partials/areachart.ejs +0 -9
  192. package/dist/GN-startup/routes/www/views/partials/areachartccu.ejs +0 -9
  193. package/dist/GN-startup/routes/www/views/partials/barchart.ejs +0 -9
  194. package/dist/GN-startup/routes/www/views/partials/barcharttotal.ejs +0 -9
  195. package/dist/GN-startup/routes/www/views/partials/common/footer.ejs +0 -14
  196. package/dist/GN-startup/routes/www/views/partials/common/head.ejs +0 -11
  197. package/dist/GN-startup/routes/www/views/partials/dau.ejs +0 -41
  198. package/dist/GN-startup/routes/www/views/partials/debugboard.ejs +0 -90
  199. package/dist/GN-startup/routes/www/views/partials/description.ejs +0 -20
  200. package/dist/GN-startup/routes/www/views/partials/logtable.ejs +0 -50
  201. package/dist/GN-startup/routes/www/views/partials/piechart.ejs +0 -7
  202. package/dist/GN-startup/routes/www/views/partials/sidenav.ejs +0 -83
  203. package/dist/GN-startup/routes/www/views/partials/topnav.ejs +0 -53
  204. package/dist/GN-startup/settings/MailSettings.d.ts +0 -22
@@ -0,0 +1,798 @@
1
+ import { parentPort, workerData } from "worker_threads";
2
+
3
+ import { SecretInfo, SecretPermissionItem } from "../../index";
4
+ import { AuthInfo } from "../../index";
5
+ import { authenticate_InfoRequestParam as authenticate_InfoRequestParam } from "../../index";
6
+ import { characterPlayer_InfoRequestParam as characterPlayer_InfoRequestParam } from "../../index";
7
+ import { gamePlayer_InfoRequestParam as gamePlayer_InfoRequestParam } from "../../index";
8
+ import { group_InfoRequestParam as group_InfoRequestParam } from "../../index";
9
+ import { inventory_InfoRequestParam as inventory_InfoRequestParam } from "../../index";
10
+ import { masterPlayer_InfoRequestParam as masterPlayer_InfoRequestParam } from "../../index";
11
+ import { storeInventory_InfoRequestParam as storeInventory_InfoRequestParam } from "../../index";
12
+ import { PermissionParam } from "../../index";
13
+
14
+ import { ContentDataParam } from "../../index";
15
+
16
+ import { CustomDataParam } from "../../index";
17
+ // import { GroupMemberParam } from "../../index";
18
+ import { PlayerCurrencyParam } from "../../index";
19
+ import { PlayerDataParam } from "../../index";
20
+ import { PlayerStatisticsParam } from "../../index";
21
+
22
+ import { GroupCurrencyParam } from "../../index";
23
+ import { GroupDataParam } from "../../index";
24
+ import { GroupMemberParam } from "../../index";
25
+ import { GroupMessageItem } from "../../index";
26
+ import { GroupStatisticsParam } from "../../index";
27
+
28
+ import { ItemDataParam } from "../../index";
29
+ import { ItemStatisticsParam } from "../../index";
30
+
31
+ import { AvatarParam } from "../../index";
32
+ import { CurrencyParam } from "../../index";
33
+ import { InAppPurchaseParam } from "../../index";
34
+ import { StoreDataParam } from "../../index";
35
+ import { StoreItemParam } from "../../index";
36
+ import { TagParam } from "../../index";
37
+
38
+ import { AuthenticatePermissionRulesParam } from "../../index";
39
+ import { CharacterCatalogSettingsParam } from "../../index";
40
+ import { CharacterPlayerPermissionRulesParam } from "../../index";
41
+ import { CharacterPlayerSettingsParam } from "../../index";
42
+ import { CloudScriptPermissionRulesParam } from "../../index";
43
+ import { ContentPermissionRulesParam } from "../../index";
44
+ import { CurrencySettingsParam } from "../../index";
45
+ import { DataSettingsParam } from "../../index";
46
+ import { FriendCatalogSettingsParam } from "../../index";
47
+ import { GamePlayerPermissionRulesParam } from "../../index";
48
+ import { GamePlayerSettingsParam } from "../../index";
49
+ import { GameSettingsParam } from "../../index";
50
+ import { GenericServiceSettingsParam } from "../../index";
51
+ import { GroupCatalogSettingsParam } from "../../index";
52
+ import { GroupPermissionRulesParam } from "../../index";
53
+ import { GroupSettingsParam } from "../../index";
54
+ import { InventoryPermissionRulesParam } from "../../index";
55
+ import { InventorySettingsParam } from "../../index";
56
+ import { ItemCatalogSettingsParam } from "../../index";
57
+ import { ItemClassSettingsParam } from "../../index";
58
+ import { MasterAdminPermissionRulesParam } from "../../index";
59
+ import { MasterPlayerPermissionRulesParam } from "../../index";
60
+ import { MasterPlayerSettingsParam } from "../../index";
61
+ import { MatchmakingQueueSettingsParam } from "../../index";
62
+ import { MultiplayerPermissionRulesParam } from "../../index";
63
+ import { PermissionRulesParam } from "../../index";
64
+ import { StatisticsSettingsParam } from "../../index";
65
+ import { StoreInventoryPermissionRulesParam } from "../../index";
66
+ import { TagSettingsParam } from "../../index";
67
+ import { ThirtPartyAppleSettingsParam } from "../../index";
68
+ import { ThirtPartyFacebookSettingsParam } from "../../index";
69
+ import { ThirtPartyGameCenterSettingsParam } from "../../index";
70
+ import { ThirtPartyGooglePlayGameSettingsParam } from "../../index";
71
+ import { ThirtPartyParam } from "../../index";
72
+ import { EmailSettingsParam } from "../../index";
73
+ import { PushNotificationSettingsParam } from "../../index";
74
+ import { AnalyticsRequestParams } from "../../index";
75
+ import { ServerGameDataRequestParams } from "../../index";
76
+ import { MatchmakingTicketCanMatch } from "../../index";
77
+ import { ServerDetail } from "../../index";
78
+
79
+ import {
80
+ GNNetwork,
81
+ Action0,
82
+ Action1,
83
+ Action2,
84
+ Action3,
85
+ Action4,
86
+ ConverterService,
87
+ OwnerType,
88
+ GNErrorCode,
89
+ GNParameterCode,
90
+ ParameterCode,
91
+ Commands,
92
+ EventCode,
93
+ OperationCode,
94
+ ReturnCode,
95
+ CodeHelper,
96
+ DataMember,
97
+ StringDataMember,
98
+ BooleanDataMember,
99
+ GNHashtableDataMember,
100
+ GNArrayDataMember,
101
+ NumberDataMember,
102
+ GNHashtableBuilder,
103
+ GNHashtable,
104
+ GNArrayBuilder,
105
+ GNArray,
106
+ InvalidMemberType,
107
+ InvalidMember,
108
+ RequestType,
109
+ RequestRole,
110
+ CustomOperationRequest,
111
+ CustomOperationRequestAbstract,
112
+ CustomOperationResponse,
113
+ Constructor,
114
+ AbstractConstructor,
115
+ FieldDataType,
116
+ GNObjectFieldMetadata,
117
+ GNObjectMetadata,
118
+ CustomOperationResponseAbstract,
119
+ IServerEventHandler,
120
+ OperationEvent,
121
+ OperationRequest,
122
+ OperationResponse,
123
+ GenericModels,
124
+ CharacterPlayerModels,
125
+ ContentModels,
126
+ GamePlayerModels,
127
+ GroupModels,
128
+ InventoryModels,
129
+ MasterPlayerModels,
130
+ StoreInventoryModels,
131
+ MultiplayerModels,
132
+ CloudScriptModels,
133
+ GNServerSettingsOptions,
134
+ GNServerSettings,
135
+ PermissionDataItem,
136
+ FriendStatus,
137
+ GoogleLoginType,
138
+ GroupStatus,
139
+ GNDebug,
140
+ ItemType,
141
+ LogType,
142
+ GNSupport,
143
+ PostType,
144
+ } from "@xmobitea/gn-typescript-client";
145
+
146
+ import * as mongodb from "mongodb";
147
+ import * as axios from "axios";
148
+
149
+ enum CloudScriptEventType {
150
+ SendToUser = 0,
151
+ SendToMore = 1,
152
+ SendToAll = 2,
153
+ }
154
+
155
+ interface CloudScriptEvent {
156
+ eventType: CloudScriptEventType;
157
+ operationEvent: {
158
+ eventCode: number;
159
+ parameters: {} | null;
160
+ encrypted: boolean;
161
+ };
162
+ receiver: string[] | string | null;
163
+ }
164
+
165
+ class CloudScriptAdmin {
166
+ public readonly characterPlayer = GNNetwork.characterPlayer.admin;
167
+ public readonly content = GNNetwork.content.admin;
168
+ public readonly gamePlayer = GNNetwork.gamePlayer.admin;
169
+ public readonly group = GNNetwork.group.admin;
170
+ public readonly inventory = GNNetwork.inventory.admin;
171
+ public readonly masterPlayer = GNNetwork.masterPlayer.admin;
172
+ public readonly storeInventory = GNNetwork.storeInventory.admin;
173
+ public readonly multiplayer = GNNetwork.multiplayer.admin;
174
+ public readonly cloudScript = GNNetwork.cloudScript.admin;
175
+ public readonly dashboard = GNNetwork.dashboard;
176
+ public send(
177
+ requestType: RequestType,
178
+ requestRole: RequestRole,
179
+ request: OperationRequest,
180
+ onResponse: Action1<OperationResponse>,
181
+ overrideAuthToken: string,
182
+ overrideSecretKey: string,
183
+ customTags: GNHashtable
184
+ ): void {
185
+ GNNetwork.sendViaHttp(requestType, requestRole, request, onResponse, overrideAuthToken, overrideSecretKey, customTags);
186
+ }
187
+
188
+ public sendAsync(
189
+ requestType: RequestType,
190
+ requestRole: RequestRole,
191
+ request: OperationRequest,
192
+ overrideAuthToken: string,
193
+ overrideSecretKey: string,
194
+ customTags: GNHashtable
195
+ ): Promise<OperationResponse> {
196
+ return GNNetwork.sendViaHttpAsync(requestType, requestRole, request, overrideAuthToken, overrideSecretKey, customTags);
197
+ }
198
+ }
199
+
200
+ class CloudScriptDatabase {
201
+ private static readonly DOT: string = ".";
202
+ private static readonly RUNTIME: string = "Runtime" + CloudScriptDatabase.DOT;
203
+ private static readonly META: string = "Meta" + CloudScriptDatabase.DOT;
204
+ private static readonly SYSTEM: string = "System" + CloudScriptDatabase.DOT;
205
+
206
+ private client: mongodb.MongoClient;
207
+ private db: mongodb.Db;
208
+
209
+ init(url: string, dbName: string, options?: mongodb.MongoClientOptions): void {
210
+ this.client = new mongodb.MongoClient(url, options);
211
+
212
+ this.db = this.client.db(dbName);
213
+
214
+ this.client.connect();
215
+ }
216
+
217
+ public runtimeCollection(collectionName: string): mongodb.Collection<mongodb.Document> {
218
+ return this.collection(CloudScriptDatabase.RUNTIME + collectionName);
219
+ }
220
+
221
+ public metaCollection(collectionName: string): mongodb.Collection<mongodb.Document> {
222
+ return this.collection(CloudScriptDatabase.META + collectionName);
223
+ }
224
+
225
+ public systemCollection(collectionName: string): mongodb.Collection<mongodb.Document> {
226
+ return this.collection(CloudScriptDatabase.SYSTEM + collectionName);
227
+ }
228
+
229
+ public runtimeGameCollection(collectionName: string, gameId: string): mongodb.Collection<mongodb.Document> {
230
+ return this.collection(CloudScriptDatabase.RUNTIME + gameId + CloudScriptDatabase.DOT + collectionName);
231
+ }
232
+
233
+ public metaGameCollection(collectionName: string, gameId: string): mongodb.Collection<mongodb.Document> {
234
+ return this.collection(CloudScriptDatabase.META + gameId + CloudScriptDatabase.DOT + collectionName);
235
+ }
236
+
237
+ public systemGameCollection(collectionName: string, gameId: string): mongodb.Collection<mongodb.Document> {
238
+ return this.collection(CloudScriptDatabase.SYSTEM + gameId + CloudScriptDatabase.DOT + collectionName);
239
+ }
240
+
241
+ public collection(fullCollectionName: string): mongodb.Collection<mongodb.Document> {
242
+ return this.db.collection(fullCollectionName);
243
+ }
244
+
245
+ public createCollection(name: string, options?: mongodb.CreateCollectionOptions): Promise<mongodb.Collection<mongodb.BSON.Document>> {
246
+ return this.db.createCollection(name, options);
247
+ }
248
+ }
249
+
250
+ class CloudScriptHttp {
251
+ public async get<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, config?: axios.AxiosRequestConfig<D>): Promise<R> {
252
+ return await axios.default.get<T, R, D>(url, config);
253
+ }
254
+
255
+ public async delete<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, config?: axios.AxiosRequestConfig<D>): Promise<R> {
256
+ return await axios.default.delete<T, R, D>(url, config);
257
+ }
258
+
259
+ public async head<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, config?: axios.AxiosRequestConfig<D>): Promise<R> {
260
+ return await axios.default.head<T, R, D>(url, config);
261
+ }
262
+
263
+ public async options<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, config?: axios.AxiosRequestConfig<D>): Promise<R> {
264
+ return await axios.default.options<T, R, D>(url, config);
265
+ }
266
+
267
+ public async post<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, data?: any, config?: axios.AxiosRequestConfig<D>): Promise<R> {
268
+ return await axios.default.post<T, R, D>(url, data, config);
269
+ }
270
+
271
+ public async put<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, data?: any, config?: axios.AxiosRequestConfig<D>): Promise<R> {
272
+ return await axios.default.put<T, R, D>(url, data, config);
273
+ }
274
+
275
+ public async patch<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, data?: any, config?: axios.AxiosRequestConfig<D>): Promise<R> {
276
+ return await axios.default.patch<T, R, D>(url, data, config);
277
+ }
278
+ }
279
+
280
+ class CloudScriptSocket {
281
+ public async sendEventTo(userId: string, operationEvent: OperationEvent): Promise<void> {
282
+ return await this.sendEvent({
283
+ eventType: CloudScriptEventType.SendToUser,
284
+ receiver: userId,
285
+ operationEvent: {
286
+ eventCode: operationEvent.getEventCode(),
287
+ encrypted: operationEvent.isEncrypted(),
288
+ parameters: operationEvent.getParameters()?.toData() ?? null,
289
+ },
290
+ });
291
+ }
292
+
293
+ public async sendEventToMoreUser(userIds: string[], operationEvent: OperationEvent): Promise<void> {
294
+ return await this.sendEvent({
295
+ eventType: CloudScriptEventType.SendToMore,
296
+ receiver: userIds,
297
+ operationEvent: {
298
+ eventCode: operationEvent.getEventCode(),
299
+ encrypted: operationEvent.isEncrypted(),
300
+ parameters: operationEvent.getParameters()?.toData() ?? null,
301
+ },
302
+ });
303
+ }
304
+
305
+ public async sendEventToAllPlayer(operationEvent: OperationEvent): Promise<void> {
306
+ return await this.sendEvent({
307
+ eventType: CloudScriptEventType.SendToAll,
308
+ receiver: null,
309
+ operationEvent: {
310
+ eventCode: operationEvent.getEventCode(),
311
+ encrypted: operationEvent.isEncrypted(),
312
+ parameters: operationEvent.getParameters()?.toData() ?? null,
313
+ },
314
+ });
315
+ }
316
+
317
+ private async sendEvent(event: CloudScriptEvent) {
318
+ parentPort?.postMessage(event);
319
+ }
320
+ }
321
+
322
+ class CloudScriptMatchmaking {
323
+ public async confirmServerDetail(gameId: string, matchmakingTicketCanMatch: MatchmakingTicketCanMatch, serverDetail: ServerDetail) {
324
+ parentPort?.postMessage({
325
+ eventType: 10,
326
+ receiver: null,
327
+ operationEvent: {
328
+ eventCode: 0,
329
+ encrypted: false,
330
+ parameters: {
331
+ gameId: gameId,
332
+ matchmakingTicketCanMatch: matchmakingTicketCanMatch,
333
+ serverDetail: serverDetail,
334
+ },
335
+ },
336
+ });
337
+ }
338
+ }
339
+
340
+ class CloudScriptMail {
341
+ public async send(email: string, subject: string, contentHtml: string) {
342
+ parentPort?.postMessage({
343
+ eventType: 20,
344
+ receiver: null,
345
+ operationEvent: {
346
+ eventCode: 0,
347
+ encrypted: false,
348
+ parameters: {
349
+ email: email,
350
+ subject: subject,
351
+ contentHtml: contentHtml,
352
+ },
353
+ },
354
+ });
355
+ }
356
+
357
+ public async sendToMore(emails: string[], subject: string, contentHtml: string) {
358
+ parentPort?.postMessage({
359
+ eventType: 21,
360
+ receiver: null,
361
+ operationEvent: {
362
+ eventCode: 0,
363
+ encrypted: false,
364
+ parameters: {
365
+ emails: emails,
366
+ subject: subject,
367
+ contentHtml: contentHtml,
368
+ },
369
+ },
370
+ });
371
+ }
372
+ }
373
+
374
+ class CloudScriptPushNotification {
375
+ public async send(token: string, title: string, body: string, badge?: number, sound?: string, icon?: string, data?: { [k: string]: any }) {
376
+ parentPort?.postMessage({
377
+ eventType: 30,
378
+ receiver: null,
379
+ operationEvent: {
380
+ eventCode: 0,
381
+ encrypted: false,
382
+ parameters: {
383
+ token: token,
384
+ title: title,
385
+ body: body,
386
+ badge: badge,
387
+ sound: sound,
388
+ icon: icon,
389
+ data: data,
390
+ },
391
+ },
392
+ });
393
+ }
394
+
395
+ public async sendToMore(tokens: string[], title: string, body: string, badge?: number, sound?: string, icon?: string, data?: { [k: string]: any }) {
396
+ parentPort?.postMessage({
397
+ eventType: 31,
398
+ receiver: null,
399
+ operationEvent: {
400
+ eventCode: 0,
401
+ encrypted: false,
402
+ parameters: {
403
+ tokens: tokens,
404
+ title: title,
405
+ body: body,
406
+ badge: badge,
407
+ sound: sound,
408
+ icon: icon,
409
+ data: data,
410
+ },
411
+ },
412
+ });
413
+ }
414
+
415
+ public async sendToTopic(topic: string, title: string, body: string, badge?: number, sound?: string, icon?: string, data?: { [k: string]: any }) {
416
+ parentPort?.postMessage({
417
+ eventType: 32,
418
+ receiver: null,
419
+ operationEvent: {
420
+ eventCode: 0,
421
+ encrypted: false,
422
+ parameters: {
423
+ topic: topic,
424
+ title: title,
425
+ body: body,
426
+ badge: badge,
427
+ sound: sound,
428
+ icon: icon,
429
+ data: data,
430
+ },
431
+ },
432
+ });
433
+ }
434
+ }
435
+
436
+ enum EventCallbackType {
437
+ Pre = 0,
438
+ Post = 1,
439
+ System = 2,
440
+ }
441
+
442
+ interface CloudScriptRequest {
443
+ requestId: string;
444
+ eventType: EventCallbackType;
445
+ eventName: string;
446
+ request: { [k: string]: any };
447
+ secretInfo: {
448
+ secretKey: string;
449
+ role: number;
450
+ remove: boolean;
451
+ tsExpire: number;
452
+ permission: SecretPermissionItem;
453
+ gameId: string;
454
+ isDefault: boolean;
455
+ onlyMasterAdmin: boolean;
456
+ };
457
+ operationRequest: {
458
+ operationCode: number;
459
+ requestId: number;
460
+ parameters: {};
461
+ encrypted: boolean;
462
+ };
463
+ operationResponse?: {
464
+ returnCode: number;
465
+ debugMessage: string;
466
+ parameters: {};
467
+ encrypted: boolean;
468
+ };
469
+ log?: (log: any) => void;
470
+ }
471
+
472
+ interface CloudScriptResponse {
473
+ stats: {
474
+ memoryUsedInBytes: number;
475
+ executeTimeInMs: number;
476
+ };
477
+ response: FunctionResponse;
478
+ responseId: string;
479
+ logs: string[];
480
+ }
481
+
482
+ interface FunctionRequest {
483
+ eventName: string;
484
+ request: { [k: string]: any };
485
+ secretInfo: SecretInfo;
486
+ operationRequest: OperationRequest;
487
+ operationResponse?: OperationResponse;
488
+ log: (log: any) => void;
489
+ }
490
+
491
+ enum ExecuteResponseStatus {
492
+ Ok = 1,
493
+ Exception = 2,
494
+ FunctionNameNotFound = 3,
495
+ }
496
+
497
+ interface FunctionResponse {
498
+ status: ExecuteResponseStatus;
499
+ result: {
500
+ returnCode: number;
501
+ debugMessage: string;
502
+ parameters?: {};
503
+ encrypted: boolean;
504
+ } | null;
505
+ request: {
506
+ [k: string]: any;
507
+ } | null;
508
+ errorMessage: any;
509
+ }
510
+
511
+ if (parentPort) {
512
+ parentPort.on("message", async (request: CloudScriptRequest) => {
513
+ let startTime = performance.now();
514
+ let startMemoryUsage = process.memoryUsage();
515
+
516
+ let logs: string[] = [];
517
+
518
+ let handleResponse: FunctionResponse = null as any;
519
+
520
+ if (request.eventType == EventCallbackType.System) {
521
+ if (request.eventName == "system_RequestServerDetail") {
522
+ let functionRequest: FunctionRequest = {
523
+ eventName: request.eventName,
524
+ operationRequest: null as any,
525
+ secretInfo: null as any,
526
+ request: request.request,
527
+ log(log: any) {
528
+ logs.push(log);
529
+ },
530
+ };
531
+
532
+ handleResponse = await ___handleMatchmakingFunction(functionRequest);
533
+ }
534
+ else {
535
+ let functionRequest: FunctionRequest = {
536
+ eventName: request.eventName,
537
+ operationRequest: null as any,
538
+ secretInfo: null as any,
539
+ request: null as any,
540
+ log(log: any) {
541
+ logs.push(log);
542
+ },
543
+ };
544
+
545
+ handleResponse = await ___handleSystemFunction(functionRequest);
546
+ }
547
+ } else {
548
+ let originOperationRequest = request.operationRequest;
549
+ let operationRequest = new OperationRequest(originOperationRequest.operationCode, originOperationRequest.encrypted);
550
+ if (originOperationRequest.parameters) {
551
+ operationRequest.setParameters(GNHashtable.builder().addAll(originOperationRequest.parameters).build());
552
+ }
553
+
554
+ let originSecretInfo = request.secretInfo;
555
+ let secretInfo: SecretInfo = null as any;
556
+ if (originSecretInfo) {
557
+ secretInfo = SecretInfo.Builder()
558
+ .setSecretKey(originSecretInfo.secretKey)
559
+ .setRole(originSecretInfo.role)
560
+ .setIsRemove(originSecretInfo.remove)
561
+ .setTsExpire(originSecretInfo.tsExpire)
562
+ .setPermission(originSecretInfo.permission)
563
+ .setGameId(originSecretInfo.gameId)
564
+ .setIsDefault(originSecretInfo.isDefault)
565
+ .setIsOnlyMasterAdmin(originSecretInfo.onlyMasterAdmin)
566
+ .build();
567
+ }
568
+
569
+ if (request.eventType == EventCallbackType.Pre) {
570
+ let functionRequest: FunctionRequest = {
571
+ eventName: request.eventName,
572
+ operationRequest: operationRequest,
573
+ secretInfo: secretInfo,
574
+ request: request.request,
575
+ log(log: any) {
576
+ logs.push(log);
577
+ },
578
+ };
579
+
580
+ handleResponse = await ___handlePreFunction(functionRequest);
581
+ } else if (request.eventType == EventCallbackType.Post) {
582
+ let originOperationResponse = request.operationResponse;
583
+ let operationResponse: OperationResponse = null as any;
584
+
585
+ if (originOperationResponse) {
586
+ operationResponse = new OperationResponse(originOperationRequest.operationCode, originOperationRequest.requestId, originOperationRequest.encrypted);
587
+ operationResponse.setReturnCode(originOperationResponse.returnCode);
588
+ operationResponse.setDebugMessage(originOperationResponse.debugMessage);
589
+
590
+ if (originOperationResponse.parameters) {
591
+ operationResponse.setParameters(GNHashtable.builder().addAll(originOperationResponse.parameters).build());
592
+ }
593
+ }
594
+
595
+ let functionRequest: FunctionRequest = {
596
+ eventName: request.eventName,
597
+ operationRequest: operationRequest,
598
+ operationResponse: operationResponse,
599
+ secretInfo: secretInfo,
600
+ request: request.request,
601
+ log(log: any) {
602
+ logs.push(log);
603
+ },
604
+ };
605
+
606
+ handleResponse = await ___handlePostFunction(functionRequest);
607
+ }
608
+ }
609
+
610
+ let endTime = performance.now();
611
+ let endMemoryUsage = process.memoryUsage();
612
+
613
+ let memoryUsedInBytes = endMemoryUsage.rss - startMemoryUsage.rss;
614
+ let executeTimeInMs = endTime - startTime;
615
+
616
+ //let cost = (memoryUsedInGb * executeTime) / 1000 * 0.022;
617
+
618
+ let response: CloudScriptResponse = {
619
+ responseId: request.requestId,
620
+ response: handleResponse as any,
621
+ stats: {
622
+ executeTimeInMs: executeTimeInMs,
623
+ memoryUsedInBytes: memoryUsedInBytes,
624
+ },
625
+ logs: logs,
626
+ };
627
+
628
+ parentPort?.postMessage(response);
629
+ });
630
+ }
631
+
632
+ async function ___handleMatchmakingFunction(request: FunctionRequest): Promise<FunctionResponse> {
633
+ let handler = systemMatchmakingHandlers[request.eventName];
634
+
635
+ if (handler == null) {
636
+ return {
637
+ status: ExecuteResponseStatus.FunctionNameNotFound,
638
+ result: null,
639
+ request: null,
640
+ errorMessage: null,
641
+ };
642
+ }
643
+
644
+ let answer: FunctionResponse = {
645
+ status: ExecuteResponseStatus.Ok,
646
+ errorMessage: null,
647
+ result: null,
648
+ request: null,
649
+ };
650
+
651
+ try {
652
+ let result = await handler(request.request.gameId, request.request.matchmakingTicketCanMatch, request.log);
653
+
654
+ if (result != null)
655
+ answer.request = result;
656
+ } catch (err: any) {
657
+ answer.status = ExecuteResponseStatus.Exception;
658
+ answer.errorMessage = err.message;
659
+ }
660
+
661
+ return answer;
662
+ }
663
+
664
+ async function ___handleSystemFunction(request: FunctionRequest): Promise<FunctionResponse> {
665
+ let handler = systemHandlers[request.eventName];
666
+
667
+ if (handler == null) {
668
+ return {
669
+ status: ExecuteResponseStatus.FunctionNameNotFound,
670
+ result: null,
671
+ request: null,
672
+ errorMessage: null,
673
+ };
674
+ }
675
+
676
+ let answer: FunctionResponse = {
677
+ status: ExecuteResponseStatus.Ok,
678
+ errorMessage: null,
679
+ result: null,
680
+ request: null,
681
+ };
682
+
683
+ try {
684
+ await handler(request.log);
685
+ } catch (err: any) {
686
+ answer.status = ExecuteResponseStatus.Exception;
687
+ answer.errorMessage = err.message;
688
+ }
689
+
690
+ return answer;
691
+ }
692
+
693
+ async function ___handlePreFunction(request: FunctionRequest): Promise<FunctionResponse> {
694
+ let handler = preHandlers[request.eventName];
695
+
696
+ if (handler == null) {
697
+ return {
698
+ status: ExecuteResponseStatus.FunctionNameNotFound,
699
+ result: null,
700
+ request: null,
701
+ errorMessage: null,
702
+ };
703
+ }
704
+
705
+ let answer: FunctionResponse = {
706
+ status: ExecuteResponseStatus.Ok,
707
+ errorMessage: null,
708
+ result: null,
709
+ request: null,
710
+ };
711
+
712
+ try {
713
+ let result = await handler(request.request, request.secretInfo, request.operationRequest, request.log);
714
+
715
+ if (result != null)
716
+ answer.result = {
717
+ returnCode: result.getReturnCode(),
718
+ debugMessage: result.getDebugMessage(),
719
+ encrypted: result.isEncrypted(),
720
+ parameters: result.getParameters()?.toData(),
721
+ };
722
+
723
+ answer.request = request.request;
724
+ } catch (err: any) {
725
+ answer.status = ExecuteResponseStatus.Exception;
726
+ answer.errorMessage = err.message;
727
+ }
728
+
729
+ return answer;
730
+ }
731
+
732
+ async function ___handlePostFunction(request: FunctionRequest): Promise<FunctionResponse> {
733
+ let handler = postHandlers[request.eventName];
734
+
735
+ if (handler == null) {
736
+ return {
737
+ status: ExecuteResponseStatus.FunctionNameNotFound,
738
+ result: null,
739
+ errorMessage: null,
740
+ request: null,
741
+ };
742
+ }
743
+
744
+ let answer: FunctionResponse = {
745
+ status: ExecuteResponseStatus.Ok,
746
+ errorMessage: null,
747
+ result: null,
748
+ request: null,
749
+ };
750
+
751
+ try {
752
+ let result = await handler(request.request, request.secretInfo, request.operationRequest, request.operationResponse as any, request.log);
753
+
754
+ answer.result = {
755
+ returnCode: result.getReturnCode(),
756
+ debugMessage: result.getDebugMessage(),
757
+ encrypted: result.isEncrypted(),
758
+ parameters: result.getParameters()?.toData(),
759
+ };
760
+ } catch (err: any) {
761
+ answer.status = ExecuteResponseStatus.Exception;
762
+ answer.errorMessage = err.message;
763
+ }
764
+
765
+ return answer;
766
+ }
767
+
768
+ {
769
+ let gnServerSettingsOptions: GNServerSettingsOptions = workerData.gnServerSettingsOptions;
770
+
771
+ let gnServerSettings = new GNServerSettings();
772
+ gnServerSettings.config(gnServerSettingsOptions);
773
+
774
+ GNNetwork.init(gnServerSettings);
775
+ }
776
+
777
+ const admin = new CloudScriptAdmin();
778
+ const database = new CloudScriptDatabase();
779
+ const http = new CloudScriptHttp();
780
+ const socket = new CloudScriptSocket();
781
+ const matchmaking = new CloudScriptMatchmaking();
782
+ const mail = new CloudScriptMail();
783
+ const pushNotification = new CloudScriptPushNotification();
784
+
785
+ {
786
+ let dbConnection = workerData.dbConnection;
787
+ database.init(dbConnection.url, dbConnection.dbName, dbConnection.options);
788
+ }
789
+
790
+ const preHandlers: Record<string, (request: any, secretInfo: SecretInfo, operationRequest: OperationRequest, log?: (log: any) => void) => Promise<OperationResponse | null>> = {};
791
+
792
+ const postHandlers: Record<string, (request: any, secretInfo: SecretInfo, operationRequest: OperationRequest, operationResponse: OperationResponse, log?: (log: any) => void) => Promise<OperationResponse>> = {};
793
+
794
+ const systemHandlers: Record<string, (log?: (log: any) => void) => Promise<void>> = {};
795
+
796
+ const systemMatchmakingHandlers: Record<string, (gameId: string, matchmakingTicketCanMatch: MatchmakingTicketCanMatch, log?: (log: any) => void) => Promise<{ success: boolean }>> = {};
797
+
798
+ //$replaceScript