@xmobitea/gn-server 2.5.0 → 2.5.1

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 (38) hide show
  1. package/dist/GN-app-api/handler/controller/handler/characterPlayer/SetDisplayNameRequestHandler.d.ts +1 -0
  2. package/dist/GN-app-api/handler/controller/handler/content/SetContentDataRequestHandler.d.ts +2 -0
  3. package/dist/GN-app-api/handler/controller/handler/dashboard/DeleteInDatabaseRequestHandler.d.ts +1 -0
  4. package/dist/GN-app-api/handler/controller/handler/dashboard/GrantGameRequestHandler.d.ts +2 -0
  5. package/dist/GN-app-api/handler/controller/handler/dashboard/SetMasterGameSettingsRequestHandler.d.ts +2 -0
  6. package/dist/GN-app-api/handler/controller/handler/gamePlayer/GrantPlayerCharacterRequestHandler.d.ts +1 -0
  7. package/dist/GN-app-api/service/CacheService.d.ts +36 -0
  8. package/dist/GN-app-api/service/CloudScriptService.d.ts +2 -0
  9. package/dist/GN-app-api/service/ConfigService.d.ts +14 -0
  10. package/dist/{GN-library/xmail/lib/xMail.d.ts → GN-app-api/service/EmailService.d.ts} +3 -10
  11. package/dist/GN-app-api/service/EventCallbackService.d.ts +1 -0
  12. package/dist/GN-app-api/service/ICacheService.d.ts +15 -0
  13. package/dist/GN-app-api/service/IConfigService.d.ts +15 -0
  14. package/dist/GN-app-api/service/IEmailService.d.ts +10 -0
  15. package/dist/GN-app-api/service/IPushNotificationService.d.ts +17 -2
  16. package/dist/{GN-library/xnotification/lib/xPushNotification.d.ts → GN-app-api/service/PushNotificationService.d.ts} +8 -13
  17. package/dist/GN-common/constant/enumType/OwnerType.d.ts +2 -1
  18. package/dist/GN-library/xdatabase/lib/entity/pro/UploadFileInfo.d.ts +4 -2
  19. package/dist/GN-library/xdatabase/lib/entity/pro/findOptions/FileUploadInfoFindOptions.d.ts +9 -0
  20. package/dist/GN-library/xdatabase/lib/xDatabase.d.ts +3 -1
  21. package/dist/GN-startup/DefaultApplicationStartup.d.ts +2 -1
  22. package/dist/GN-startup/HttpApp.d.ts +6 -0
  23. package/dist/GN-startup/ServerApplication.d.ts +4 -0
  24. package/dist/GN-startup/cloudScript/eventCallbackCloudScriptData.json +3 -3
  25. package/dist/GN-startup/cloudScript/templateCloudScript.ts +32 -0
  26. package/dist/GN-startup/cloudScript/templateEventCallback.ts +32 -0
  27. package/dist/GN-startup/routes/ClusterHandler.d.ts +34 -0
  28. package/dist/GN-startup/routes/UploadFileHandler.d.ts +1 -0
  29. package/dist/GN-startup/settings/ClusterSettings.d.ts +29 -0
  30. package/dist/GNServer.d.ts +15 -14
  31. package/dist/index.d.ts +18 -14
  32. package/dist/index.js +74224 -82897
  33. package/gn.sh +17 -5
  34. package/package.json +4 -4
  35. package/dist/GN-library/xcachedata/lib/xCacheData.d.ts +0 -10
  36. package/dist/GN-library/xcachedata/lib/xCacheItem.d.ts +0 -8
  37. package/dist/GN-library/xconfig/lib/entity/xConfigItem.d.ts +0 -9
  38. package/dist/GN-library/xconfig/lib/xConfig.d.ts +0 -15
@@ -6,6 +6,7 @@ import { CharacterPlayerBaseRequestHandler } from "./CharacterPlayerBaseRequestH
6
6
  declare class SetDisplayNameOperationRequest extends OperationRequest {
7
7
  characterId: string;
8
8
  displayName: string;
9
+ uniqueDisplayName?: boolean;
9
10
  isValidRequest(): boolean;
10
11
  }
11
12
  export declare class SetDisplayNameRequestHandler extends CharacterPlayerBaseRequestHandler {
@@ -16,5 +16,7 @@ export declare class SetContentDataRequestHandler extends RequestHandler {
16
16
  serverHandle(secretInfo: SecretInfo, operationRequest: OperationRequest): Promise<OperationResponse>;
17
17
  adminHandle(secretInfo: SecretInfo, operationRequest: OperationRequest): Promise<OperationResponse>;
18
18
  private execute;
19
+ private applySettings;
20
+ protected init(): void;
19
21
  }
20
22
  export {};
@@ -24,5 +24,6 @@ export declare class DeleteInDatabaseRequestHandler extends RequestHandler {
24
24
  private deleteFriendPlayerInCharacterPlayer;
25
25
  private deleteGroupInGamePlayer;
26
26
  private deleteGroupInCharacterPlayer;
27
+ private deleteStoreInventory;
27
28
  }
28
29
  export {};
@@ -12,5 +12,7 @@ export declare class GrantGameRequestHandler extends RequestHandler {
12
12
  getCommonOperationRequest(): typeof GrantGameOperationRequest;
13
13
  handle(authInfo: AuthInfo, secretInfo: SecretInfo, operationRequest: OperationRequest): Promise<OperationResponse>;
14
14
  private execute;
15
+ private addGameId;
16
+ protected init(): void;
15
17
  }
16
18
  export {};
@@ -19,5 +19,7 @@ export declare class SetMasterGameSettingsRequestHandler extends RequestHandler
19
19
  getCommonOperationRequest(): typeof SetMasterGameSettingsOperationRequest;
20
20
  handle(authInfo: AuthInfo, secretInfo: SecretInfo, operationRequest: OperationRequest): Promise<OperationResponse>;
21
21
  private execute;
22
+ private applySettings;
23
+ protected init(): void;
22
24
  }
23
25
  export {};
@@ -7,6 +7,7 @@ declare class GrantPlayerCharacterOperationRequest extends OperationRequest {
7
7
  userId?: string;
8
8
  catalogId: string;
9
9
  displayName?: string;
10
+ uniqueDisplayName?: boolean;
10
11
  isValidRequest(): boolean;
11
12
  }
12
13
  export declare class GrantPlayerCharacterRequestHandler extends GamePlayerBaseRequestHandler {
@@ -0,0 +1,36 @@
1
+ import { ICacheService } from "./ICacheService";
2
+ import * as mongoDB from "mongodb";
3
+ export interface ICacheServiceController {
4
+ getData<T>(key: string): Promise<T>;
5
+ setData<T>(key: string, tData: T, expireAfterMs: number): Promise<void>;
6
+ removeData(key: string): Promise<boolean>;
7
+ isValid(key: string): Promise<boolean>;
8
+ removeInvalidData(): Promise<number>;
9
+ }
10
+ export declare class MemoryCacheServiceController implements ICacheServiceController {
11
+ private dataDic;
12
+ getData<T>(key: string): Promise<T>;
13
+ setData<T>(key: string, tData: T, expireAfterMs: number): Promise<void>;
14
+ removeData(key: string): Promise<boolean>;
15
+ isValid(key: string): Promise<boolean>;
16
+ removeInvalidData(): Promise<number>;
17
+ constructor();
18
+ }
19
+ export declare class MongoDbCacheServiceController implements ICacheServiceController {
20
+ private cacheCollection;
21
+ getData<T>(key: string): Promise<T>;
22
+ setData<T>(key: string, tData: T, expireAfterMs: number): Promise<void>;
23
+ removeData(key: string): Promise<boolean>;
24
+ isValid(key: string): Promise<boolean>;
25
+ removeInvalidData(): Promise<number>;
26
+ constructor(cacheCollection: mongoDB.Collection<mongoDB.Document>);
27
+ }
28
+ export declare class CacheService implements ICacheService {
29
+ private cacheServiceController;
30
+ getData<T>(key: string): Promise<T>;
31
+ setData<T>(key: string, tData: T, expireAfterMs: number): Promise<void>;
32
+ removeData(key: string): Promise<boolean>;
33
+ isValid(key: string): Promise<boolean>;
34
+ removeInvalidData(): Promise<number>;
35
+ constructor(cacheServiceController: ICacheServiceController);
36
+ }
@@ -36,6 +36,8 @@ export declare class CloudScriptService implements ICloudScriptService {
36
36
  errorMessage?: string;
37
37
  version?: string;
38
38
  }>;
39
+ private remoteAddCloudScriptFunction;
40
+ private remoteEditCloudScriptFunction;
39
41
  editCloudScriptFunction(version: string, isLive: boolean, canExecute: boolean): Promise<{
40
42
  success: boolean;
41
43
  errorMessage?: string;
@@ -0,0 +1,14 @@
1
+ import { IConfigService, ConfigItem } from "./IConfigService";
2
+ import * as mongoDB from "mongodb";
3
+ export declare class ConfigService implements IConfigService {
4
+ private configDic;
5
+ private gameId;
6
+ private configCollection;
7
+ setConfigCollection(gameId: string, configCollection: mongoDB.Collection<mongoDB.Document>): void;
8
+ run(): void;
9
+ private syncAllConfigAsync;
10
+ syncConfigFromDatabaseAsync(configName: string, label: string): Promise<ConfigItem>;
11
+ setConfigAsync(configName: string, label: string, data: {}, withSave: boolean): Promise<ConfigItem>;
12
+ getConfigItem(configName: string, label: string): ConfigItem;
13
+ getConfigDicViaLabel(label: string): Map<string, ConfigItem>;
14
+ }
@@ -1,18 +1,11 @@
1
- import { OnRunSuccess } from "./../../xbuilder/lib/OnRunSuccess";
2
- interface OnSendMailSuccess {
3
- (): void;
4
- }
5
- interface OnSendMailError {
6
- (error: string): void;
7
- }
8
- export declare class xMail {
1
+ import { IEmailService, OnSendMailError, OnSendMailSuccess } from "./IEmailService";
2
+ export declare class EmailService implements IEmailService {
9
3
  private isInit;
10
4
  private sendGridApiKey;
11
5
  private fromEmail;
12
6
  private needSetup;
13
7
  init(sendGridApiKey: string, fromEmail: string): void;
14
- run(onRunSuccess?: OnRunSuccess): void;
8
+ run(): void;
15
9
  sendMail(toEmail: string, subject: string, contentHtml: string, onSendMailSuccess?: OnSendMailSuccess, onSendMailError?: OnSendMailError): Promise<void>;
16
10
  sendMailToMore(toEmails: string[], subject: string, contentHtml: string, onSendMailSuccess?: OnSendMailSuccess, onSendMailError?: OnSendMailError): Promise<void>;
17
11
  }
18
- export {};
@@ -105,6 +105,7 @@ export declare class EventCallbackCloudScriptService implements IEventCallbackCl
105
105
  errorMessage?: string;
106
106
  version?: string;
107
107
  }>;
108
+ private remoteAddCloudScriptFunction;
108
109
  private loadCloudScriptFunctionWorker;
109
110
  private loadCloudScriptWorker;
110
111
  }
@@ -0,0 +1,15 @@
1
+ export declare class CacheItem {
2
+ private tsExpire;
3
+ private tData;
4
+ constructor(tData: any, expireAfterMs: number);
5
+ setData(tData: any, expireAfterMs: number): void;
6
+ isExpired(): boolean;
7
+ getData(): any;
8
+ }
9
+ export interface ICacheService {
10
+ getData<T>(key: string): Promise<T>;
11
+ setData<T>(key: string, tData: T, expireAfterMs: number): Promise<void>;
12
+ removeData(key: string): Promise<boolean>;
13
+ isValid(key: string): Promise<boolean>;
14
+ removeInvalidData(): Promise<number>;
15
+ }
@@ -0,0 +1,15 @@
1
+ export declare class ConfigItem {
2
+ private configName;
3
+ private label;
4
+ private data;
5
+ constructor(configName: string, label: string, data: {});
6
+ getConfigName(): string;
7
+ getLabel(): string;
8
+ getData(): {};
9
+ }
10
+ export interface IConfigService {
11
+ syncConfigFromDatabaseAsync(configName: string, label: string): Promise<ConfigItem>;
12
+ setConfigAsync(configName: string, label: string, data: {}, withSave: boolean): Promise<ConfigItem>;
13
+ getConfigItem(configName: string, label: string): ConfigItem;
14
+ getConfigDicViaLabel(label: string): Map<string, ConfigItem>;
15
+ }
@@ -0,0 +1,10 @@
1
+ export interface OnSendMailSuccess {
2
+ (): void;
3
+ }
4
+ export interface OnSendMailError {
5
+ (error: string): void;
6
+ }
7
+ export interface IEmailService {
8
+ sendMail(toEmail: string, subject: string, contentHtml: string, onSendMailSuccess?: OnSendMailSuccess, onSendMailError?: OnSendMailError): Promise<void>;
9
+ sendMailToMore(toEmails: string[], subject: string, contentHtml: string, onSendMailSuccess?: OnSendMailSuccess, onSendMailError?: OnSendMailError): Promise<void>;
10
+ }
@@ -1,4 +1,19 @@
1
+ export interface OnSendNotificationSuccess {
2
+ (message: string): void;
3
+ }
4
+ export interface OnSendNotificationError {
5
+ (error: string): void;
6
+ }
1
7
  export interface IPushNotificationService {
2
- handle(key: string | string[], fn: () => any): Promise<void>;
3
- isBusy(key?: string): boolean;
8
+ sendNotification(token: string, title: string, body: string, badge?: number, sound?: string, icon?: string, data?: {
9
+ [k: string]: any;
10
+ }, onSendNotificationSuccess?: OnSendNotificationSuccess, onSendNotificationError?: OnSendNotificationError): Promise<void>;
11
+ sendNotificationToMore(tokens: string[], title: string, body: string, badge?: number, sound?: string, icon?: string, data?: {
12
+ [k: string]: any;
13
+ }, onSendNotificationSuccess?: OnSendNotificationSuccess, onSendNotificationError?: OnSendNotificationError): Promise<string>;
14
+ sendNotificationToTopic(topic: string, title: string, body: string, badge?: number, sound?: string, icon?: string, data?: {
15
+ [k: string]: any;
16
+ }, onSendNotificationSuccess?: OnSendNotificationSuccess, onSendNotificationError?: OnSendNotificationError): Promise<void>;
17
+ subscribeToTopic(tokens: string[], topic: string, onSendNotificationSuccess?: OnSendNotificationSuccess, onSendNotificationError?: OnSendNotificationError): Promise<void>;
18
+ unsubscribeFromTopic(tokens: string[], topic: string, onSendNotificationSuccess?: OnSendNotificationSuccess, onSendNotificationError?: OnSendNotificationError): Promise<void>;
4
19
  }
@@ -1,11 +1,5 @@
1
- import { OnRunSuccess } from "./../../xbuilder/lib/OnRunSuccess";
2
- interface OnSendNotificationSuccess {
3
- (): void;
4
- }
5
- interface OnSendNotificationError {
6
- (error: string): void;
7
- }
8
- export declare class xPushNotification {
1
+ import { IPushNotificationService, OnSendNotificationError, OnSendNotificationSuccess } from "./IPushNotificationService";
2
+ export declare class PushNotificationService implements IPushNotificationService {
9
3
  private isInit;
10
4
  private projectId;
11
5
  private clientEmail;
@@ -13,15 +7,16 @@ export declare class xPushNotification {
13
7
  private messaging;
14
8
  private needSetup;
15
9
  init(projectId: string, clientEmail: string, privateKey: string): void;
16
- run(onRunSuccess?: OnRunSuccess): Promise<void>;
10
+ run(): Promise<void>;
17
11
  sendNotification(token: string, title: string, body: string, badge?: number, sound?: string, icon?: string, data?: {
18
12
  [k: string]: any;
19
- }, onSendNotificationSuccess?: OnSendNotificationSuccess, onSendNotificationError?: OnSendNotificationError): Promise<any>;
13
+ }, onSendNotificationSuccess?: OnSendNotificationSuccess, onSendNotificationError?: OnSendNotificationError): Promise<void>;
20
14
  sendNotificationToMore(tokens: string[], title: string, body: string, badge?: number, sound?: string, icon?: string, data?: {
21
15
  [k: string]: any;
22
- }, onSendNotificationSuccess?: OnSendNotificationSuccess, onSendNotificationError?: OnSendNotificationError): Promise<any>;
16
+ }, onSendNotificationSuccess?: OnSendNotificationSuccess, onSendNotificationError?: OnSendNotificationError): Promise<string>;
23
17
  sendNotificationToTopic(topic: string, title: string, body: string, badge?: number, sound?: string, icon?: string, data?: {
24
18
  [k: string]: any;
25
- }, onSendNotificationSuccess?: OnSendNotificationSuccess, onSendNotificationError?: OnSendNotificationError): Promise<any>;
19
+ }, onSendNotificationSuccess?: OnSendNotificationSuccess, onSendNotificationError?: OnSendNotificationError): Promise<void>;
20
+ subscribeToTopic(tokens: string[], topic: string, onSendNotificationSuccess?: OnSendNotificationSuccess, onSendNotificationError?: OnSendNotificationError): Promise<void>;
21
+ unsubscribeFromTopic(tokens: string[], topic: string, onSendNotificationSuccess?: OnSendNotificationSuccess, onSendNotificationError?: OnSendNotificationError): Promise<void>;
26
22
  }
27
- export {};
@@ -3,5 +3,6 @@ export declare enum OwnerType {
3
3
  GamePlayer = 2,
4
4
  CharacterPlayer = 3,
5
5
  Group = 4,
6
- Inventory = 5
6
+ Inventory = 5,
7
+ StoreInventory = 6
7
8
  }
@@ -3,8 +3,11 @@ import { MongoObject } from "./MongoObject";
3
3
  import { RemoveStatusItem } from "./RemoveStatusItem";
4
4
  interface FileUpload {
5
5
  mimeType: string;
6
- size: string;
6
+ size: number;
7
7
  folderFileName: string;
8
+ fullPath: string;
9
+ shortPath: string;
10
+ tsUploadFile: number;
8
11
  }
9
12
  export declare class UploadFileInfo extends MongoObject {
10
13
  private static readonly _fileId;
@@ -35,6 +38,5 @@ export declare class UploadFileInfo extends MongoObject {
35
38
  getRemoveStatus(): RemoveStatusItem;
36
39
  setRemoveStatus(tsRemove: number, reason?: string): void;
37
40
  getFileUpload(): FileUpload;
38
- setUploadFile(mimeType: string, size: string, folderFileName: string): void;
39
41
  }
40
42
  export {};
@@ -0,0 +1,9 @@
1
+ export interface FileUploadInfoFindOptions {
2
+ fileId?: boolean;
3
+ fileName?: boolean;
4
+ tsCreate?: boolean;
5
+ tsUploadExpire?: boolean;
6
+ removeStatus?: boolean;
7
+ gameId?: boolean;
8
+ fileUpload?: boolean;
9
+ }
@@ -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
  }
@@ -120,6 +121,7 @@ export declare class xDatabase {
120
121
  loadCharacterPlayersWithSegmentAsync(segment: string, skip: number, limit: number, gameId: string, characterPlayerFindOptions?: CharacterPlayerFindOptions): Promise<Array<CharacterPlayer>>;
121
122
  loadCharacterPlayersWithTagAsync(key: string, value: string, skip: number, limit: number, gameId: string, characterPlayerFindOptions?: CharacterPlayerFindOptions): Promise<Array<CharacterPlayer>>;
122
123
  loadCharacterPlayersWithDisplayNameAsync(keyword: string, skip: number, limit: number, gameId: string, characterPlayerFindOptions?: CharacterPlayerFindOptions): Promise<Array<CharacterPlayer>>;
124
+ loadCharacterPlayerWithDisplayNameAsync(displayNameNormalize: string, gameId: string, characterPlayerFindOptions?: CharacterPlayerFindOptions): Promise<CharacterPlayer>;
123
125
  loadCharacterPlayersLeaderboardWithStatisticsAsync(key: string, skip: number, limit: number, catalogId: string, gameId: string, direction: -1 | 1, characterPlayerFindOptions?: CharacterPlayerFindOptions): Promise<Array<CharacterPlayer>>;
124
126
  loadCharacterPlayersLeaderboardWithStatisticsAllAsync(key: string, catalogId: string, gameId: string, direction: -1 | 1, characterPlayerFindOptions?: CharacterPlayerFindOptions): Promise<Array<CharacterPlayer>>;
125
127
  loadCharacterPlayersLeaderboardWithCreateAsync(skip: number, limit: number, gameId: string, characterPlayerFindOptions?: CharacterPlayerFindOptions): Promise<Array<CharacterPlayer>>;
@@ -234,7 +236,7 @@ export declare class xDatabase {
234
236
  insertGroupCurrencyLogAsync(groupId: string, gameId: string, key: string, amount: number, startValue: number, finalValue: number, log: string): Promise<void>;
235
237
  loadGroupStatisticsLogAsync($filter: {}, gameId: string, limit: number): Promise<mongoDB.FindCursor<mongoDB.WithId<mongoDB.BSON.Document>>>;
236
238
  loadGroupCurrencyLogAsync($filter: {}, gameId: string, limit: number): Promise<mongoDB.FindCursor<mongoDB.WithId<mongoDB.BSON.Document>>>;
237
- loadUploadFileInfoAsync(fileId: string): Promise<UploadFileInfo>;
239
+ loadUploadFileInfoAsync(fileId: string, fileUploadInfoFindOptions?: FileUploadInfoFindOptions): Promise<UploadFileInfo>;
238
240
  createUploadFileInfoAsync(result: any): Promise<UploadFileInfo>;
239
241
  private getFindOptions;
240
242
  }
@@ -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
  {
@@ -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 {
@@ -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,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 {};