@xmobitea/gn-server 2.5.0 → 2.6.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 (49) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +3 -0
  3. package/THIRD_PARTY_LICENSES +97 -0
  4. package/dist/GN-app-api/handler/controller/handler/characterPlayer/SetDisplayNameRequestHandler.d.ts +1 -0
  5. package/dist/GN-app-api/handler/controller/handler/content/SetContentDataRequestHandler.d.ts +2 -0
  6. package/dist/GN-app-api/handler/controller/handler/dashboard/DeleteInDatabaseRequestHandler.d.ts +1 -0
  7. package/dist/GN-app-api/handler/controller/handler/dashboard/GrantGameRequestHandler.d.ts +2 -0
  8. package/dist/GN-app-api/handler/controller/handler/dashboard/SetMasterGameSettingsRequestHandler.d.ts +2 -0
  9. package/dist/GN-app-api/handler/controller/handler/dashboard/SetSecretInfoInformationRequestHandler.d.ts +1 -0
  10. package/dist/GN-app-api/handler/controller/handler/gamePlayer/GrantPlayerCharacterRequestHandler.d.ts +1 -0
  11. package/dist/GN-app-api/service/CacheService.d.ts +36 -0
  12. package/dist/GN-app-api/service/CloudScriptService.d.ts +2 -0
  13. package/dist/GN-app-api/service/ConfigService.d.ts +14 -0
  14. package/dist/{GN-library/xmail/lib/xMail.d.ts → GN-app-api/service/EmailService.d.ts} +3 -10
  15. package/dist/GN-app-api/service/EventCallbackService.d.ts +1 -0
  16. package/dist/GN-app-api/service/ICacheService.d.ts +15 -0
  17. package/dist/GN-app-api/service/IConfigService.d.ts +15 -0
  18. package/dist/GN-app-api/service/IEmailService.d.ts +10 -0
  19. package/dist/GN-app-api/service/IPushNotificationService.d.ts +17 -2
  20. package/dist/{GN-library/xnotification/lib/xPushNotification.d.ts → GN-app-api/service/PushNotificationService.d.ts} +8 -13
  21. package/dist/GN-common/constant/enumType/OwnerType.d.ts +2 -1
  22. package/dist/GN-common/constant/parameterCode/GNParameterCode.d.ts +3 -0
  23. package/dist/GN-common/entity/SecretInfo.d.ts +4 -0
  24. package/dist/GN-library/xdatabase/lib/entity/pro/UploadFileInfo.d.ts +4 -2
  25. package/dist/GN-library/xdatabase/lib/entity/pro/findOptions/FileUploadInfoFindOptions.d.ts +9 -0
  26. package/dist/GN-library/xdatabase/lib/entity/pro/masterAdmin/SecretInfoItem.d.ts +4 -0
  27. package/dist/GN-library/xdatabase/lib/xDatabase.d.ts +17 -8
  28. package/dist/GN-startup/DefaultApplicationStartup.d.ts +2 -1
  29. package/dist/GN-startup/HttpApp.d.ts +6 -0
  30. package/dist/GN-startup/ServerApplication.d.ts +4 -0
  31. package/dist/GN-startup/cloudScript/eventCallbackCloudScriptData.json +4 -4
  32. package/dist/GN-startup/cloudScript/templateCloudScript.ts +32 -0
  33. package/dist/GN-startup/cloudScript/templateEventCallback.ts +32 -0
  34. package/dist/GN-startup/middleware/AntiDdosMiddleware.d.ts +1 -0
  35. package/dist/GN-startup/routes/ClusterHandler.d.ts +34 -0
  36. package/dist/GN-startup/routes/UploadFileHandler.d.ts +1 -0
  37. package/dist/GN-startup/routes/utils/wrap.d.ts +2 -0
  38. package/dist/GN-startup/settings/ClusterSettings.d.ts +29 -0
  39. package/dist/GNServer.d.ts +15 -17
  40. package/dist/index.d.ts +18 -18
  41. package/dist/index.js +76338 -84745
  42. package/gn.sh +18 -6
  43. package/package.json +8 -21
  44. package/dist/GN-app-api/service/ILockService.d.ts +0 -4
  45. package/dist/GN-app-api/service/LockService.d.ts +0 -5
  46. package/dist/GN-library/xcachedata/lib/xCacheData.d.ts +0 -10
  47. package/dist/GN-library/xcachedata/lib/xCacheItem.d.ts +0 -8
  48. package/dist/GN-library/xconfig/lib/entity/xConfigItem.d.ts +0 -9
  49. package/dist/GN-library/xconfig/lib/xConfig.d.ts +0 -15
@@ -9,6 +9,7 @@ export declare class SecretInfoItem extends MasterAdminMongoObject {
9
9
  private static readonly _tsExpire;
10
10
  private static readonly _permission;
11
11
  private static readonly _tsCreate;
12
+ private static readonly _displayName;
12
13
  private static readonly _creatorId;
13
14
  private readonly gameId;
14
15
  private readonly secretKey;
@@ -17,6 +18,7 @@ export declare class SecretInfoItem extends MasterAdminMongoObject {
17
18
  private readonly creatorId;
18
19
  private remove;
19
20
  private tsExpire;
21
+ private displayName;
20
22
  private permission;
21
23
  constructor(result: mongoDB.WithId<mongoDB.Document>, collection: mongoDB.Collection<mongoDB.Document>);
22
24
  private setDocumentMasterSecretInfoItem;
@@ -29,6 +31,8 @@ export declare class SecretInfoItem extends MasterAdminMongoObject {
29
31
  setRemove(isRemove: boolean): void;
30
32
  getTsExpire(): number;
31
33
  setTsExpire(tsExpire: number): void;
34
+ getDisplayName(): string;
35
+ setDisplayName(displayName: string): void;
32
36
  getPermission(): SecretPermissionItem;
33
37
  setPermission(permission: SecretPermissionItem): void;
34
38
  }
@@ -13,6 +13,7 @@ import { InventoryFindOptions } from "./entity/pro/findOptions/InventoryFindOpti
13
13
  import { StoreInventoryFindOptions } from "./entity/pro/findOptions/StoreInventoryFindOptions";
14
14
  import { StoreInventory } from "./entity/pro/StoreInventory";
15
15
  import { UploadFileInfo } from "./entity/pro/UploadFileInfo";
16
+ import { FileUploadInfoFindOptions } from "./entity/pro/findOptions/FileUploadInfoFindOptions";
16
17
  interface OnMongoRunError {
17
18
  (error: mongoDB.AnyError): void;
18
19
  }
@@ -48,8 +49,9 @@ export declare class xDatabase {
48
49
  loadMasterPlayersWithGenericServiceAsync(genericService: string, genericIds: string[], masterPlayerFindOptions?: MasterPlayerFindOptions): Promise<Array<MasterPlayer>>;
49
50
  loadMasterPlayersWithSegmentAsync(segment: string, skip: number, limit: number, masterPlayerFindOptions?: MasterPlayerFindOptions): Promise<Array<MasterPlayer>>;
50
51
  loadMasterPlayersWithTagAsync(key: string, value: string, skip: number, limit: number, masterPlayerFindOptions?: MasterPlayerFindOptions): Promise<Array<MasterPlayer>>;
51
- loadMasterPlayersWithDisplayNameAsync(keyword: string, skip: number, limit: number, masterPlayerFindOptions?: MasterPlayerFindOptions): Promise<Array<MasterPlayer>>;
52
- loadMasterPlayerWithDisplayNameAsync(displayNameNormalize: string, masterPlayerFindOptions?: MasterPlayerFindOptions): Promise<MasterPlayer>;
52
+ loadMasterPlayerWithDisplayNameAsync(displayName: string, masterPlayerFindOptions?: MasterPlayerFindOptions): Promise<MasterPlayer>;
53
+ loadMasterPlayerWithDisplayNameNormalizeAsync(displayNameNormalize: string, masterPlayerFindOptions?: MasterPlayerFindOptions): Promise<MasterPlayer>;
54
+ loadMasterPlayersWithDisplayNameNormalizeRegexAsync(keyword: string, skip: number, limit: number, masterPlayerFindOptions?: MasterPlayerFindOptions): Promise<Array<MasterPlayer>>;
53
55
  loadMasterPlayersLeaderboardWithStatisticsAsync(key: string, skip: number, limit: number, direction: -1 | 1, masterPlayerFindOptions?: MasterPlayerFindOptions): Promise<Array<MasterPlayer>>;
54
56
  loadMasterPlayersLeaderboardWithStatisticsAllAsync(key: string, direction: -1 | 1, masterPlayerFindOptions?: MasterPlayerFindOptions): Promise<Array<MasterPlayer>>;
55
57
  loadMasterPlayersLeaderboardWithCurrenciesAsync(key: string, skip: number, limit: number, masterPlayerFindOptions?: MasterPlayerFindOptions): Promise<Array<MasterPlayer>>;
@@ -78,8 +80,9 @@ export declare class xDatabase {
78
80
  private convertToGamePlayers;
79
81
  loadGamePlayersWithSegmentAsync(segment: string, skip: number, limit: number, gameId: string, gamePlayerFindOptions?: GamePlayerFindOptions): Promise<Array<GamePlayer>>;
80
82
  loadGamePlayersWithTagAsync(key: string, value: string, skip: number, limit: number, gameId: string, gamePlayerFindOptions?: GamePlayerFindOptions): Promise<Array<GamePlayer>>;
81
- loadGamePlayersWithDisplayNameAsync(keyword: string, skip: number, limit: number, gameId: string, gamePlayerFindOptions?: GamePlayerFindOptions): Promise<Array<GamePlayer>>;
82
- loadGamePlayerWithDisplayNameAsync(displayNameNormalize: string, gamePlayerFindOptions?: GamePlayerFindOptions): Promise<GamePlayer>;
83
+ loadGamePlayerWithDisplayNameAsync(displayName: string, gamePlayerFindOptions?: GamePlayerFindOptions): Promise<GamePlayer>;
84
+ loadGamePlayerWithDisplayNameNormalizeAsync(displayNameNormalize: string, gamePlayerFindOptions?: GamePlayerFindOptions): Promise<GamePlayer>;
85
+ loadGamePlayersWithDisplayNameNormalizeRegexAsync(keyword: string, skip: number, limit: number, gameId: string, gamePlayerFindOptions?: GamePlayerFindOptions): Promise<Array<GamePlayer>>;
83
86
  loadGamePlayersLeaderboardWithStatisticsAsync(key: string, skip: number, limit: number, gameId: string, direction: -1 | 1, gamePlayerFindOptions?: GamePlayerFindOptions): Promise<Array<GamePlayer>>;
84
87
  loadGamePlayersLeaderboardWithStatisticsAllAsync(key: string, gameId: string, direction: -1 | 1, gamePlayerFindOptions?: GamePlayerFindOptions): Promise<Array<GamePlayer>>;
85
88
  loadGamePlayersLeaderboardWithCreateAsync(skip: number, limit: number, gameId: string, gamePlayerFindOptions?: GamePlayerFindOptions): Promise<Array<GamePlayer>>;
@@ -119,7 +122,9 @@ export declare class xDatabase {
119
122
  private convertToCharacterPlayers;
120
123
  loadCharacterPlayersWithSegmentAsync(segment: string, skip: number, limit: number, gameId: string, characterPlayerFindOptions?: CharacterPlayerFindOptions): Promise<Array<CharacterPlayer>>;
121
124
  loadCharacterPlayersWithTagAsync(key: string, value: string, skip: number, limit: number, gameId: string, characterPlayerFindOptions?: CharacterPlayerFindOptions): Promise<Array<CharacterPlayer>>;
122
- loadCharacterPlayersWithDisplayNameAsync(keyword: string, skip: number, limit: number, gameId: string, characterPlayerFindOptions?: CharacterPlayerFindOptions): Promise<Array<CharacterPlayer>>;
125
+ loadCharacterPlayerWithDisplayNameAsync(displayName: string, gameId: string, characterPlayerFindOptions?: CharacterPlayerFindOptions): Promise<CharacterPlayer>;
126
+ loadCharacterPlayerWithDisplayNameNormalizeAsync(displayNameNormalize: string, gameId: string, characterPlayerFindOptions?: CharacterPlayerFindOptions): Promise<CharacterPlayer>;
127
+ loadCharacterPlayersWithDisplayNameNormalizeRegexAsync(keyword: string, skip: number, limit: number, gameId: string, characterPlayerFindOptions?: CharacterPlayerFindOptions): Promise<Array<CharacterPlayer>>;
123
128
  loadCharacterPlayersLeaderboardWithStatisticsAsync(key: string, skip: number, limit: number, catalogId: string, gameId: string, direction: -1 | 1, characterPlayerFindOptions?: CharacterPlayerFindOptions): Promise<Array<CharacterPlayer>>;
124
129
  loadCharacterPlayersLeaderboardWithStatisticsAllAsync(key: string, catalogId: string, gameId: string, direction: -1 | 1, characterPlayerFindOptions?: CharacterPlayerFindOptions): Promise<Array<CharacterPlayer>>;
125
130
  loadCharacterPlayersLeaderboardWithCreateAsync(skip: number, limit: number, gameId: string, characterPlayerFindOptions?: CharacterPlayerFindOptions): Promise<Array<CharacterPlayer>>;
@@ -170,7 +175,9 @@ export declare class xDatabase {
170
175
  private convertToGroups;
171
176
  loadGroupsWithSegmentAsync(segment: string, skip: number, limit: number, gameId: string, groupFindOptions?: GroupFindOptions): Promise<Array<Group>>;
172
177
  loadGroupsWithTagAsync(key: string, value: string, skip: number, limit: number, gameId: string, groupFindOptions?: GroupFindOptions): Promise<Array<Group>>;
173
- loadGroupsWithDisplayNameAsync(keyword: string, skip: number, limit: number, gameId: string, groupFindOptions?: GroupFindOptions): Promise<Array<Group>>;
178
+ loadGroupWithDisplayNameAsync(displayName: string, gameId: string, groupFindOptions?: GroupFindOptions): Promise<Group>;
179
+ loadGroupWithDisplayNameNormalizeAsync(displayNameNormalize: string, gameId: string, groupFindOptions?: GroupFindOptions): Promise<Group>;
180
+ loadGroupsWithDisplayNameNormalizeRegexAsync(keyword: string, skip: number, limit: number, gameId: string, groupFindOptions?: GroupFindOptions): Promise<Array<Group>>;
174
181
  loadGroupsLeaderboardWithStatisticsAsync(key: string, skip: number, limit: number, catalogId: string, gameId: string, direction: -1 | 1, groupFindOptions?: GroupFindOptions): Promise<Array<Group>>;
175
182
  loadGroupsLeaderboardWithStatisticsAllAsync(key: string, catalogId: string, gameId: string, direction: -1 | 1, groupFindOptions?: GroupFindOptions): Promise<Array<Group>>;
176
183
  loadGroupsLeaderboardWithCreateAsync(skip: number, limit: number, gameId: string, groupFindOptions?: GroupFindOptions): Promise<Array<Group>>;
@@ -182,7 +189,9 @@ export declare class xDatabase {
182
189
  private convertToInventories;
183
190
  loadInventoriesWithSegmentAsync(segment: string, skip: number, limit: number, gameId: string, inventoryFindOptions?: InventoryFindOptions): Promise<Array<Inventory>>;
184
191
  loadInventoriesWithTagAsync(key: string, value: string, skip: number, limit: number, gameId: string, inventoryFindOptions?: InventoryFindOptions): Promise<Array<Inventory>>;
185
- loadInventoriesWithDisplayNameAsync(keyword: string, skip: number, limit: number, gameId: string, inventoryFindOptions?: InventoryFindOptions): Promise<Array<Inventory>>;
192
+ loadInventoryWithDisplayNameAsync(displayName: string, gameId: string, inventoryFindOptions?: InventoryFindOptions): Promise<Inventory>;
193
+ loadInventoryWithDisplayNameNormalizeAsync(displayNameNormalize: string, gameId: string, inventoryFindOptions?: InventoryFindOptions): Promise<Inventory>;
194
+ loadInventoriesWithDisplayNameNormalizeRegexAsync(keyword: string, skip: number, limit: number, gameId: string, inventoryFindOptions?: InventoryFindOptions): Promise<Array<Inventory>>;
186
195
  loadInventoriesLeaderboardWithStatisticsAsync(key: string, skip: number, limit: number, catalogId: string, gameId: string, direction: -1 | 1, inventoryFindOptions?: InventoryFindOptions): Promise<Array<Inventory>>;
187
196
  loadInventoriesLeaderboardWithStatisticsAllAsync(key: string, catalogId: string, gameId: string, direction: -1 | 1, inventoryFindOptions?: InventoryFindOptions): Promise<Array<Inventory>>;
188
197
  loadInventoriesLeaderboardWithCreateAsync(skip: number, limit: number, gameId: string, inventoryFindOptions?: InventoryFindOptions): Promise<Array<Inventory>>;
@@ -234,7 +243,7 @@ export declare class xDatabase {
234
243
  insertGroupCurrencyLogAsync(groupId: string, gameId: string, key: string, amount: number, startValue: number, finalValue: number, log: string): Promise<void>;
235
244
  loadGroupStatisticsLogAsync($filter: {}, gameId: string, limit: number): Promise<mongoDB.FindCursor<mongoDB.WithId<mongoDB.BSON.Document>>>;
236
245
  loadGroupCurrencyLogAsync($filter: {}, gameId: string, limit: number): Promise<mongoDB.FindCursor<mongoDB.WithId<mongoDB.BSON.Document>>>;
237
- loadUploadFileInfoAsync(fileId: string): Promise<UploadFileInfo>;
246
+ loadUploadFileInfoAsync(fileId: string, fileUploadInfoFindOptions?: FileUploadInfoFindOptions): Promise<UploadFileInfo>;
238
247
  createUploadFileInfoAsync(result: any): Promise<UploadFileInfo>;
239
248
  private getFindOptions;
240
249
  }
@@ -9,9 +9,10 @@ import { OnRunSuccess } from "./../GN-library/xbuilder/lib/OnRunSuccess";
9
9
  import { LogSettings } from "./settings/LogSettings";
10
10
  import { UploadFileSettings } from "./settings/UploadFileSettings";
11
11
  import { DdosSettings } from "./settings/DDosSettings";
12
+ import { ClusterSettings } from "./settings/ClusterSettings";
12
13
  export declare class DefaultApplicationStartup {
13
14
  protected serverApplication: ServerApplication;
14
15
  run(onRunSuccess?: OnRunSuccess): void;
15
- protected newServerApplication(applicationSettings: ApplicationSettings, httpAppSettings: HttpAppSettings, socketAppSettings: SocketAppSettings, otherSettings: OtherSettings, databaseSettings: DatabaseSettings, logSettings: LogSettings, uploadFileSettings: UploadFileSettings, ddosSettings: DdosSettings): ServerApplication;
16
+ protected newServerApplication(applicationSettings: ApplicationSettings, httpAppSettings: HttpAppSettings, socketAppSettings: SocketAppSettings, otherSettings: OtherSettings, databaseSettings: DatabaseSettings, logSettings: LogSettings, uploadFileSettings: UploadFileSettings, ddosSettings: DdosSettings, clusterSettings: ClusterSettings): ServerApplication;
16
17
  getGNServer(): GNServer;
17
18
  }
@@ -1,6 +1,7 @@
1
1
  import { HttpAppSettings } from "./settings/HttpAppSettings";
2
2
  import { HttpAppHandler } from "./routes/HttpAppHandler";
3
3
  import { UploadFileHandler } from "./routes/UploadFileHandler";
4
+ import { ClusterHandler } from "./routes/ClusterHandler";
4
5
  import { Express } from "express";
5
6
  import { ApiMiddleware } from "./middleware/ApiMiddleware";
6
7
  import { UploadFileMiddleware } from "./middleware/UploadFileMiddleware";
@@ -10,14 +11,17 @@ import { AntiDdosMiddleware } from "./middleware/AntiDdosMiddleware";
10
11
  import { SocketAppSettings } from "./settings/SocketAppSettings";
11
12
  import { ApplicationSettings } from "./settings/ApplicationSettings";
12
13
  import { LogSettings } from "./settings/LogSettings";
14
+ import { ClusterSettings } from "./settings/ClusterSettings";
13
15
  export declare class HttpApp {
14
16
  private applicationSettings;
15
17
  private uploadFileSettings;
16
18
  private appSettings;
17
19
  private socketAppSettings;
20
+ private clusterSettings;
18
21
  private app;
19
22
  private httpAppHandler;
20
23
  private uploadFileHandler;
24
+ private clusterHandler;
21
25
  private antiDdosMiddleware;
22
26
  private logSettings;
23
27
  private apiMiddleware;
@@ -28,11 +32,13 @@ export declare class HttpApp {
28
32
  getApp(): Express;
29
33
  getHttpAppHandler(): HttpAppHandler;
30
34
  getUploadFileHandler(): UploadFileHandler;
35
+ getClusterHandler(): ClusterHandler;
31
36
  setApiMiddleware(apiMiddleware: ApiMiddleware): void;
32
37
  setUploadFileMiddleware(uploadFileMiddleware: UploadFileMiddleware): void;
33
38
  setApplicationSettings(applicationSettings: ApplicationSettings): void;
34
39
  setAppSettings(appSettings: HttpAppSettings): void;
35
40
  setSocketAppSettings(socketAppSettings: SocketAppSettings): void;
41
+ setClusterSettings(clusterSettings: ClusterSettings): void;
36
42
  setUploadFileSettings(uploadFileSettings: UploadFileSettings): void;
37
43
  setGNServer(gnServer: GNServer): void;
38
44
  setSessionId(sessionId: string): void;
@@ -9,6 +9,7 @@ import { OnRunSuccess } from "./../GN-library/xbuilder/lib/OnRunSuccess";
9
9
  import { LogSettings } from "./settings/LogSettings";
10
10
  import { UploadFileSettings } from "./settings/UploadFileSettings";
11
11
  import { DdosSettings } from "./settings/DDosSettings";
12
+ import { ClusterSettings } from "./settings/ClusterSettings";
12
13
  declare abstract class BuilderBase {
13
14
  protected applicationSettings: ApplicationSettings;
14
15
  protected httpAppSettings: HttpAppSettings;
@@ -18,6 +19,7 @@ declare abstract class BuilderBase {
18
19
  protected logSettings: LogSettings;
19
20
  protected uploadFileSettings: UploadFileSettings;
20
21
  protected ddosSettings: DdosSettings;
22
+ protected clusterSettings: ClusterSettings;
21
23
  getApplicationSettings(): ApplicationSettings;
22
24
  getHttpAppSettings(): HttpAppSettings;
23
25
  getSocketAppSettings(): SocketAppSettings;
@@ -26,6 +28,7 @@ declare abstract class BuilderBase {
26
28
  getLogSettings(): LogSettings;
27
29
  getUploadFileSettings(): UploadFileSettings;
28
30
  getDdosSettings(): DdosSettings;
31
+ getClusterSettings(): ClusterSettings;
29
32
  constructor();
30
33
  }
31
34
  declare class Builder extends BuilderBase implements IBuilder<ServerApplication> {
@@ -37,6 +40,7 @@ declare class Builder extends BuilderBase implements IBuilder<ServerApplication>
37
40
  setLogSettings(logSettings: LogSettings): Builder;
38
41
  setUploadFileSettings(uploadFileSettings: UploadFileSettings): Builder;
39
42
  setDdosSettings(ddosSettings: DdosSettings): Builder;
43
+ setClusterSettings(clusterSettings: ClusterSettings): Builder;
40
44
  build(): ServerApplication;
41
45
  constructor();
42
46
  }
@@ -378,7 +378,7 @@
378
378
  },
379
379
  {
380
380
  "eventName": "characterPlayer_SetDisplayName",
381
- "script": "\npreHandlers.characterPlayer_SetDisplayName = async (request: { characterId: string, displayName: string }, secretInfo: SecretInfo, operationRequest: OperationRequest, log: (log: any) => void) => {\n\n\treturn null;\n}\n\npostHandlers.characterPlayer_SetDisplayName = async (request: { characterId: string, displayName: string }, secretInfo: SecretInfo, operationRequest: OperationRequest, operationResponse: OperationResponse, log: (log: any) => void) => {\n\n\treturn operationResponse;\n}\n",
381
+ "script": "\npreHandlers.characterPlayer_SetDisplayName = async (request: { characterId: string, displayName: string, uniqueDisplayName: boolean, }, secretInfo: SecretInfo, operationRequest: OperationRequest, log: (log: any) => void) => {\n\n\treturn null;\n}\n\npostHandlers.characterPlayer_SetDisplayName = async (request: { characterId: string, displayName: string, uniqueDisplayName: boolean, }, secretInfo: SecretInfo, operationRequest: OperationRequest, operationResponse: OperationResponse, log: (log: any) => void) => {\n\n\treturn operationResponse;\n}\n",
382
382
  "hasEdit": false
383
383
  },
384
384
  {
@@ -459,7 +459,7 @@
459
459
  "childScripts": [
460
460
  {
461
461
  "eventName": "content_CreateNewFileUploadInfo",
462
- "script": "\npreHandlers.content_CreateNewFileUploadInfo = async (request: { userId: string, fileName: string }, secretInfo: SecretInfo, operationRequest: OperationRequest, log: (log: any) => void) => {\n\n\treturn null;\n}\n\npostHandlers.content_CreateNewFileUploadInfo = async (request: { userId: string, fileName: string }, secretInfo: SecretInfo, operationRequest: OperationRequest, operationResponse: OperationResponse, log: (log: any) => void) => {\n\n\treturn operationResponse;\n}\n",
462
+ "script": "\npreHandlers.content_CreateNewFileUploadInfo = async (request: { fileName: string }, secretInfo: SecretInfo, operationRequest: OperationRequest, log: (log: any) => void) => {\n\n\treturn null;\n}\n\npostHandlers.content_CreateNewFileUploadInfo = async (request: { fileName: string }, secretInfo: SecretInfo, operationRequest: OperationRequest, operationResponse: OperationResponse, log: (log: any) => void) => {\n\n\treturn operationResponse;\n}\n",
463
463
  "hasEdit": false
464
464
  },
465
465
  {
@@ -622,7 +622,7 @@
622
622
  },
623
623
  {
624
624
  "eventName": "dashboard_SetSecretInfoInformation",
625
- "script": "\npreHandlers.dashboard_SetSecretInfoInformation = async (request: { secretKey: string, remove: boolean, tsExpire: number, permissionParam: PermissionParam }, secretInfo: SecretInfo, operationRequest: OperationRequest, log: (log: any) => void) => {\n\n\treturn null;\n}\n\npostHandlers.dashboard_SetSecretInfoInformation = async (request: { secretKey: string, remove: boolean, tsExpire: number, permissionParam: PermissionParam }, secretInfo: SecretInfo, operationRequest: OperationRequest, operationResponse: OperationResponse, log: (log: any) => void) => {\n\n\treturn operationResponse;\n}\n",
625
+ "script": "\npreHandlers.dashboard_SetSecretInfoInformation = async (request: { secretKey: string, remove: boolean, tsExpire: number, permissionParam: PermissionParam, displayName: string, }, secretInfo: SecretInfo, operationRequest: OperationRequest, log: (log: any) => void) => {\n\n\treturn null;\n}\n\npostHandlers.dashboard_SetSecretInfoInformation = async (request: { secretKey: string, remove: boolean, tsExpire: number, permissionParam: PermissionParam, displayName: string, }, secretInfo: SecretInfo, operationRequest: OperationRequest, operationResponse: OperationResponse, log: (log: any) => void) => {\n\n\treturn operationResponse;\n}\n",
626
626
  "hasEdit": false
627
627
  },
628
628
  {
@@ -810,7 +810,7 @@
810
810
  },
811
811
  {
812
812
  "eventName": "gamePlayer_GrantPlayerCharacter",
813
- "script": "\npreHandlers.gamePlayer_GrantPlayerCharacter = async (request: { userId: string, catalogId: string, displayName: string, ipAddress: string }, secretInfo: SecretInfo, operationRequest: OperationRequest, log: (log: any) => void) => {\n\n\treturn null;\n}\n\npostHandlers.gamePlayer_GrantPlayerCharacter = async (request: { userId: string, catalogId: string, displayName: string, ipAddress: string }, secretInfo: SecretInfo, operationRequest: OperationRequest, operationResponse: OperationResponse, log: (log: any) => void) => {\n\n\treturn operationResponse;\n}\n",
813
+ "script": "\npreHandlers.gamePlayer_GrantPlayerCharacter = async (request: { userId: string, catalogId: string, displayName: string, uniqueDisplayName: boolean, ipAddress: string }, secretInfo: SecretInfo, operationRequest: OperationRequest, log: (log: any) => void) => {\n\n\treturn null;\n}\n\npostHandlers.gamePlayer_GrantPlayerCharacter = async (request: { userId: string, catalogId: string, displayName: string, uniqueDisplayName: boolean, ipAddress: string }, secretInfo: SecretInfo, operationRequest: OperationRequest, operationResponse: OperationResponse, log: (log: any) => void) => {\n\n\treturn operationResponse;\n}\n",
814
814
  "hasEdit": false
815
815
  },
816
816
  {
@@ -375,6 +375,38 @@ class CloudScriptPushNotification {
375
375
  },
376
376
  });
377
377
  }
378
+
379
+ public async subscribeToTopic(tokens: string[], topic: string) {
380
+ if (process?.send)
381
+ process.send({
382
+ eventType: 33,
383
+ receiver: null,
384
+ operationEvent: {
385
+ eventCode: 0,
386
+ encrypted: false,
387
+ parameters: {
388
+ tokens: tokens,
389
+ topic: topic,
390
+ },
391
+ },
392
+ });
393
+ }
394
+
395
+ public async unsubscribeFromTopic(tokens: string[], topic: string) {
396
+ if (process?.send)
397
+ process.send({
398
+ eventType: 34,
399
+ receiver: null,
400
+ operationEvent: {
401
+ eventCode: 0,
402
+ encrypted: false,
403
+ parameters: {
404
+ tokens: tokens,
405
+ topic: topic,
406
+ },
407
+ },
408
+ });
409
+ }
378
410
  }
379
411
 
380
412
  interface CloudScriptRequest {
@@ -470,6 +470,38 @@ class CloudScriptPushNotification {
470
470
  },
471
471
  });
472
472
  }
473
+
474
+ public async subscribeToTopic(tokens: string[], topic: string) {
475
+ if (process?.send)
476
+ process.send({
477
+ eventType: 33,
478
+ receiver: null,
479
+ operationEvent: {
480
+ eventCode: 0,
481
+ encrypted: false,
482
+ parameters: {
483
+ tokens: tokens,
484
+ topic: topic,
485
+ },
486
+ },
487
+ });
488
+ }
489
+
490
+ public async unsubscribeFromTopic(tokens: string[], topic: string) {
491
+ if (process?.send)
492
+ process.send({
493
+ eventType: 34,
494
+ receiver: null,
495
+ operationEvent: {
496
+ eventCode: 0,
497
+ encrypted: false,
498
+ parameters: {
499
+ tokens: tokens,
500
+ topic: topic,
501
+ },
502
+ },
503
+ });
504
+ }
473
505
  }
474
506
 
475
507
  enum EventCallbackType {
@@ -3,6 +3,7 @@ import { Socket } from "socket.io";
3
3
  import * as mongoDB from "mongodb";
4
4
  export declare class AntiDdosMiddleware {
5
5
  private static readonly FIVE_MINUTE_TS;
6
+ private static readonly K_MULTIPLE_ADMIN;
6
7
  private static readonly K_MULTIPLE_WHITE_LIST;
7
8
  private static readonly K_MULTIPLE_BLACK_LIST;
8
9
  private socketRequestPerIPDic;
@@ -0,0 +1,34 @@
1
+ import express from "express";
2
+ interface NodeInfo {
3
+ instanceId: string;
4
+ fullUrl: string;
5
+ }
6
+ export declare class ClusterHandler {
7
+ private router;
8
+ private clusterRouter;
9
+ private instanceId;
10
+ private isPrimary;
11
+ private privateKeyToken;
12
+ private allNodes;
13
+ private instanceInfoStatus;
14
+ private instanceInfos;
15
+ private onEventCallback;
16
+ private isSingleNode;
17
+ setRouter(router: express.Express): void;
18
+ setInstanceId(instanceId: string): void;
19
+ setIsPrimary(isPrimary: boolean): void;
20
+ getIsPrimary(): boolean;
21
+ getIsSingleNode(): boolean;
22
+ setPrivateKeyToken(privateKeyToken: string): void;
23
+ setAllNodes(allNodes: NodeInfo[]): void;
24
+ init(): void;
25
+ run(): void;
26
+ private callbackInvoke;
27
+ private update;
28
+ private checkInstanceStatus;
29
+ private checkInstancePrimary;
30
+ onEvent(name: string, onData: (data: any) => void): void;
31
+ sendEvent(name: string, data?: any, includeMe?: boolean): Promise<void>;
32
+ constructor();
33
+ }
34
+ export {};
@@ -21,4 +21,5 @@ export declare class UploadFileHandler {
21
21
  setDownloadFileSessionCollection(downloadFileSessionCollection: mongoDB.Collection<mongoDB.Document>): void;
22
22
  init(): void;
23
23
  run(): void;
24
+ removeFile(fullPath: string): void;
24
25
  }
@@ -0,0 +1,2 @@
1
+ import { Request, Response, NextFunction, RequestHandler } from 'express';
2
+ export declare function wrap(fn: (req: Request, res: Response, next: NextFunction) => any): RequestHandler;
@@ -0,0 +1,29 @@
1
+ import { IBuilder } from "./../../GN-library/xbuilder/lib/IBuilder";
2
+ interface NodeInfo {
3
+ instanceId: string;
4
+ fullUrl: string;
5
+ }
6
+ declare abstract class BuilderBase {
7
+ protected instanceId: string;
8
+ protected isPrimary: boolean;
9
+ protected privateKeyToken: string;
10
+ protected allNodes: NodeInfo[];
11
+ getInstanceId(): string;
12
+ getIsPrimary(): boolean;
13
+ getPrivateKeyToken(): string;
14
+ getAllNodes(): NodeInfo[];
15
+ constructor();
16
+ }
17
+ declare class Builder extends BuilderBase implements IBuilder<ClusterSettings> {
18
+ setInstanceId(instanceId: string): Builder;
19
+ setIsPrimary(isPrimary: boolean): Builder;
20
+ setPrivateKeyToken(privateKeyToken: string): Builder;
21
+ setAllNodes(allNodes: NodeInfo[]): Builder;
22
+ constructor();
23
+ build(): ClusterSettings;
24
+ }
25
+ export declare class ClusterSettings extends BuilderBase {
26
+ constructor(builder: Builder);
27
+ static Builder(): Builder;
28
+ }
29
+ export {};
@@ -1,24 +1,23 @@
1
1
  import { RequestController } from "./GN-app-api/handler/controller/RequestController";
2
2
  import { OperationEvent } from "./GN-common/entity/operationEvent/OperationEvent";
3
- import { xConfig } from "./GN-library/xconfig/lib/xConfig";
4
3
  import { xDatabase } from "./GN-library/xdatabase/lib/xDatabase";
5
4
  import { SocketApp } from "./GN-startup/SocketApp";
6
5
  import { HttpApp } from "./GN-startup/HttpApp";
7
6
  import { IRequestHandler } from "./GN-app-api/handler/controller/handler/base/IRequestHandler";
8
- import { xMail } from "./GN-library/xmail/lib/xMail";
9
- import { xPushNotification } from "./GN-library/xnotification/lib/xPushNotification";
10
7
  import { IFacebookService } from "./GN-app-api/service/IFacebookService";
11
8
  import { IGenericService } from "./GN-app-api/service/IGenericService";
12
9
  import { IAppleService } from "./GN-app-api/service/IAppleService";
13
10
  import { ICloudScriptService } from "./GN-app-api/service/ICloudScriptService";
14
11
  import { ITimerService } from "./GN-app-api/service/ITimerService";
15
12
  import { OnRunSuccess } from "./GN-library/xbuilder/lib/OnRunSuccess";
16
- import { ILockService } from "./GN-app-api/service/ILockService";
17
- import { xCacheData } from "./GN-library/xcachedata/lib/xCacheData";
18
13
  import { ApiMiddleware } from "./GN-startup/middleware/ApiMiddleware";
19
14
  import { IRequestConverterService } from "./GN-app-api/service/IRequestConverterService";
20
15
  import { IGoogleService } from "./GN-app-api/service/IGoogleService";
21
16
  import { IAnalyticsService } from "./GN-app-api/service/IAnalyticsService";
17
+ import { IPushNotificationService } from "./GN-app-api/service/IPushNotificationService";
18
+ import { IEmailService } from "./GN-app-api/service/IEmailService";
19
+ import { ICacheService } from "./GN-app-api/service/ICacheService";
20
+ import { IConfigService } from "./GN-app-api/service/IConfigService";
22
21
  import { xGNSettings } from "./GN-library/xsettings/lib/xGNSettings";
23
22
  import { IPostEventCallbackService, IPreEventCallbackService } from "./GN-app-api/service/IEventCallbackService";
24
23
  import { IEventCallbackCloudScriptService } from "./GN-app-api/service/EventCallbackService";
@@ -38,12 +37,8 @@ export declare class GNServer {
38
37
  private apiMiddleware;
39
38
  private requestController;
40
39
  private idTypeCase;
41
- private xConfigDic;
42
40
  private xGNSettings;
43
41
  private xDatabase;
44
- private xMail;
45
- private xPushNotification;
46
- private xCacheDataDic;
47
42
  private facebookService;
48
43
  private genericService;
49
44
  private appleService;
@@ -51,7 +46,6 @@ export declare class GNServer {
51
46
  private googlePlayGameService;
52
47
  private gameCenterService;
53
48
  private timerService;
54
- private lockService;
55
49
  private requestConverterService;
56
50
  private analyticsService;
57
51
  private postEventCallbackService;
@@ -59,6 +53,10 @@ export declare class GNServer {
59
53
  private cloudScriptServiceDic;
60
54
  private eventCallbackCloudScriptService;
61
55
  private countryIPDetailService;
56
+ private pushNotificationService;
57
+ private emailService;
58
+ private cacheServiceDic;
59
+ private configServiceDic;
62
60
  private gameIds;
63
61
  private matchmakingHandler;
64
62
  private waitingServerDetailDict;
@@ -79,16 +77,14 @@ export declare class GNServer {
79
77
  createIndex(collectionName: string, index: {
80
78
  [k: string]: any;
81
79
  }, options?: CreateIndexesOptions): void;
82
- getConfigGame(gameId: string): xConfig;
83
- setConfigGame(gameId: string, config: xConfig): void;
80
+ getConfigService(gameId: string): IConfigService;
81
+ setConfigGame(gameId: string, configService: IConfigService): void;
84
82
  setIdTypeCase(idTypeCase: number): void;
85
83
  getIdTypeCase(): number;
86
84
  getGNSettings(): xGNSettings;
87
85
  getDatabase(): xDatabase;
88
- getMail(): xMail;
89
- getPushNotification(): xPushNotification;
90
- getCacheData(gameId: string): xCacheData;
91
- setCacheData(gameId: string, cacheData: xCacheData): void;
86
+ getCacheService(gameId: string): ICacheService;
87
+ setCacheService(gameId: string, cacheService: ICacheService): void;
92
88
  getFacebookService(): IFacebookService;
93
89
  getGenericService(): IGenericService;
94
90
  getPostEventCallbackService(): IPostEventCallbackService;
@@ -100,9 +96,10 @@ export declare class GNServer {
100
96
  getGooglePlayGameService(): IGooglePlayGameService;
101
97
  getGameCenterService(): IGameCenterService;
102
98
  getTimerService(): ITimerService;
103
- getLockService(): ILockService;
104
99
  getAnalyticsService(): IAnalyticsService;
105
100
  getRequestConverterService(): IRequestConverterService;
101
+ getEmailService(): IEmailService;
102
+ getPushNotificationService(): IPushNotificationService;
106
103
  getCloudScriptService(gameId: string): ICloudScriptService;
107
104
  setCloudScriptService(gameId: string, cloudScriptService: ICloudScriptService): Map<string, ICloudScriptService>;
108
105
  sendEventTo(userId: string, operationEvent: OperationEvent): Promise<void>;
@@ -121,5 +118,6 @@ export declare class GNServer {
121
118
  setMatchServerDetail(gameId: string, matchId: string, serverDetail: ServerDetail, ticketIds: string[]): void;
122
119
  setMatchServerDetailFailed(gameId: string, matchId: string, ticketIds: string[], reason: string): void;
123
120
  getGameIds(): string[];
121
+ isPrimary(): boolean;
124
122
  }
125
123
  export {};
package/dist/index.d.ts CHANGED
@@ -26,18 +26,28 @@ import { IGenericService, IGenericServiceHandler } from "./GN-app-api/service/IG
26
26
  export { IGenericService, IGenericServiceHandler };
27
27
  import { IGoogleService } from "./GN-app-api/service/IGoogleService";
28
28
  export { IGoogleService };
29
- import { ILockService } from "./GN-app-api/service/ILockService";
30
- export { ILockService };
31
29
  import { IPushNotificationService } from "./GN-app-api/service/IPushNotificationService";
32
30
  export { IPushNotificationService };
31
+ import { PushNotificationService } from "./GN-app-api/service/PushNotificationService";
32
+ export { PushNotificationService };
33
33
  import { IRequestConverterService } from "./GN-app-api/service/IRequestConverterService";
34
34
  export { IRequestConverterService };
35
- import { ITimerService } from "./GN-app-api/service/ITimerService";
36
- export { ITimerService };
37
- import { LockService } from "./GN-app-api/service/LockService";
38
- export { LockService };
39
35
  import { RequestConverterService } from "./GN-app-api/service/RequestConverterService";
40
36
  export { RequestConverterService };
37
+ import { IEmailService } from "./GN-app-api/service/IEmailService";
38
+ export { IEmailService };
39
+ import { EmailService } from "./GN-app-api/service/EmailService";
40
+ export { EmailService };
41
+ import { ICacheService, CacheItem } from "./GN-app-api/service/ICacheService";
42
+ export { ICacheService, CacheItem };
43
+ import { CacheService, ICacheServiceController, MemoryCacheServiceController, MongoDbCacheServiceController } from "./GN-app-api/service/CacheService";
44
+ export { CacheService, ICacheServiceController, MemoryCacheServiceController, MongoDbCacheServiceController };
45
+ import { IConfigService, ConfigItem } from "./GN-app-api/service/IConfigService";
46
+ export { IConfigService, ConfigItem };
47
+ import { ConfigService } from "./GN-app-api/service/ConfigService";
48
+ export { ConfigService };
49
+ import { ITimerService } from "./GN-app-api/service/ITimerService";
50
+ export { ITimerService };
41
51
  import { TimerService } from "./GN-app-api/service/TimerService";
42
52
  export { TimerService };
43
53
  import { GNData, GNArray, GNArrayBuilder, GNHashtable, GNHashtableBuilder } from "./GN-common/common/GNData";
@@ -122,14 +132,6 @@ import { IBuilder } from "./GN-library/xbuilder/lib/IBuilder";
122
132
  export { IBuilder };
123
133
  import { OnRunSuccess } from "./GN-library/xbuilder/lib/OnRunSuccess";
124
134
  export { OnRunSuccess };
125
- import { xCacheData } from "./GN-library/xcachedata/lib/xCacheData";
126
- export { xCacheData };
127
- import { xCacheItem } from "./GN-library/xcachedata/lib/xCacheItem";
128
- export { xCacheItem };
129
- import { xConfigItem } from "./GN-library/xconfig/lib/entity/xConfigItem";
130
- export { xConfigItem };
131
- import { xConfig } from "./GN-library/xconfig/lib/xConfig";
132
- export { xConfig };
133
135
  import { CharacterPlayerFindOptions } from "./GN-library/xdatabase/lib/entity/pro/findOptions/CharacterPlayerFindOptions";
134
136
  export { CharacterPlayerFindOptions };
135
137
  import { GamePlayerFindOptions } from "./GN-library/xdatabase/lib/entity/pro/findOptions/GamePlayerFindOptions";
@@ -228,10 +230,6 @@ import { xDatetime } from "./GN-library/xdatetime/lib/xDatetime";
228
230
  export { xDatetime };
229
231
  import { Debug } from "./GN-library/xdebug/lib/xDebug";
230
232
  export { Debug };
231
- import { xMail } from "./GN-library/xmail/lib/xMail";
232
- export { xMail };
233
- import { xPushNotification } from "./GN-library/xnotification/lib/xPushNotification";
234
- export { xPushNotification };
235
233
  import { xRandom } from "./GN-library/xrandom/lib/xRandom";
236
234
  export { xRandom };
237
235
  import { xCharacterCatalogSettings } from "./GN-library/xsettings/lib/entity/xCharacterCatalogSettings";
@@ -294,6 +292,8 @@ import { DatabaseSettings } from "./GN-startup/settings/DatabaseSettings";
294
292
  export { DatabaseSettings };
295
293
  import { DdosSettings } from "./GN-startup/settings/DDosSettings";
296
294
  export { DdosSettings };
295
+ import { ClusterSettings } from "./GN-startup/settings/ClusterSettings";
296
+ export { ClusterSettings };
297
297
  import { HttpAppSettings } from "./GN-startup/settings/HttpAppSettings";
298
298
  export { HttpAppSettings };
299
299
  import { LogSettings } from "./GN-startup/settings/LogSettings";