@xmobitea/gn-server 2.4.3 → 2.4.5

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.
@@ -562,6 +562,6 @@ const pushNotification = new CloudScriptPushNotification();
562
562
  database.init(dbConnection.url, dbConnection.dbName, dbConnection.options);
563
563
  }
564
564
 
565
- const handlers: Record<string, (args?: any, context?: { userId: string; customTags: { [k: string]: any } }, log?: (log: any) => void) => any> = {};
565
+ const handlers: Record<string, (args: any, context: { userId: string; customTags: { [k: string]: any } }, log: (log: any) => void) => any> = {};
566
566
 
567
567
  //$replaceScript
@@ -466,7 +466,7 @@ interface CloudScriptRequest {
466
466
  parameters: {};
467
467
  encrypted: boolean;
468
468
  };
469
- log?: (log: any) => void;
469
+ log: (log: any) => void;
470
470
  }
471
471
 
472
472
  interface CloudScriptResponse {
@@ -787,12 +787,12 @@ const pushNotification = new CloudScriptPushNotification();
787
787
  database.init(dbConnection.url, dbConnection.dbName, dbConnection.options);
788
788
  }
789
789
 
790
- const preHandlers: Record<string, (request: any, secretInfo: SecretInfo, operationRequest: OperationRequest, log?: (log: any) => void) => Promise<OperationResponse | null>> = {};
790
+ const preHandlers: Record<string, (request: any, secretInfo: SecretInfo, operationRequest: OperationRequest, log: (log: any) => void) => Promise<OperationResponse | null>> = {};
791
791
 
792
- const postHandlers: Record<string, (request: any, secretInfo: SecretInfo, operationRequest: OperationRequest, operationResponse: OperationResponse, log?: (log: any) => void) => Promise<OperationResponse>> = {};
792
+ const postHandlers: Record<string, (request: any, secretInfo: SecretInfo, operationRequest: OperationRequest, operationResponse: OperationResponse, log: (log: any) => void) => Promise<OperationResponse>> = {};
793
793
 
794
- const systemHandlers: Record<string, (log?: (log: any) => void) => Promise<void>> = {};
794
+ const systemHandlers: Record<string, (log: (log: any) => void) => Promise<void>> = {};
795
795
 
796
- const systemMatchmakingHandlers: Record<string, (gameId: string, matchmakingTicketCanMatch: MatchmakingTicketCanMatch, log?: (log: any) => void) => Promise<{ success: boolean }>> = {};
796
+ const systemMatchmakingHandlers: Record<string, (gameId: string, matchmakingTicketCanMatch: MatchmakingTicketCanMatch, log: (log: any) => void) => Promise<{ success: boolean }>> = {};
797
797
 
798
798
  //$replaceScript
package/dist/index.js CHANGED
@@ -75630,7 +75630,7 @@ class CloudScriptService {
75630
75630
  let fullScriptTs = fs_1.default.readFileSync(templateFullScriptPathTs).toString().replace("//$replaceScript", script);
75631
75631
  fs_1.default.writeFileSync(filePathTempTs, fullScriptTs);
75632
75632
  let filePathTemp = __dirname + "/./GN-startup/cloudScript";
75633
- yield (0, child_process_1.execSync)("npx tsc " + filePathTempTs + " --noImplicitAny --allowJs --outDir " + filePathTemp);
75633
+ yield (0, child_process_1.execSync)("npx tsc " + filePathTempTs + " --noImplicitAny --allowJs --skipLibCheck --outDir " + filePathTemp);
75634
75634
  let filePathTempJs = __dirname + "/./GN-startup/cloudScript/temp.js";
75635
75635
  fullScriptJs = fs_1.default.readFileSync(filePathTempJs).toString();
75636
75636
  if (canExecute) {
@@ -76419,7 +76419,7 @@ class EventCallbackCloudScriptService {
76419
76419
  let fullScriptTs = fs_1.default.readFileSync(templateFullScriptPathTs).toString().replace("//$replaceScript", finalScript);
76420
76420
  fs_1.default.writeFileSync(filePathTempTs, fullScriptTs);
76421
76421
  let filePathTemp = __dirname + "/./GN-startup/cloudScript";
76422
- yield (0, child_process_1.execSync)("npx tsc " + filePathTempTs + " --noImplicitAny --allowJs --esModuleInterop --outDir " + filePathTemp);
76422
+ yield (0, child_process_1.execSync)("npx tsc " + filePathTempTs + " --noImplicitAny --allowJs --skipLibCheck --esModuleInterop --outDir " + filePathTemp);
76423
76423
  let filePathTempJs = __dirname + "/./GN-startup/cloudScript/temp2.js";
76424
76424
  fullScriptJs = fs_1.default.readFileSync(filePathTempJs).toString();
76425
76425
  let finalVersion = cloudFunction.type + "_" + cloudFunction.version;
@@ -86064,6 +86064,7 @@ class DefaultApplicationStartup {
86064
86064
  .build();
86065
86065
  let socketAppSettings = SocketAppSettings_1.SocketAppSettings.Builder()
86066
86066
  .setEnable(true)
86067
+ .setUseEmitter(false)
86067
86068
  .setOrigins("*")
86068
86069
  .addMethods([])
86069
86070
  .setCredentials(true)
@@ -87562,7 +87563,7 @@ class ServerApplicationStartup extends DefaultApplicationStartup_1.DefaultApplic
87562
87563
  this.gnConfig = gnConfig;
87563
87564
  }
87564
87565
  run(onRunSuccess) {
87565
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22;
87566
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23;
87566
87567
  let gnApplicationSettings = this.gnConfig["applicationSettings"];
87567
87568
  if (gnApplicationSettings == null)
87568
87569
  gnApplicationSettings = {
@@ -87618,15 +87619,16 @@ class ServerApplicationStartup extends DefaultApplicationStartup_1.DefaultApplic
87618
87619
  };
87619
87620
  let socketAppSettings = SocketAppSettings_1.SocketAppSettings.Builder()
87620
87621
  .setEnable((_q = gnSocketAppSettings["enable"]) !== null && _q !== void 0 ? _q : true)
87621
- .setOrigins((_r = gnSocketAppSettings["allowOrigin"]) !== null && _r !== void 0 ? _r : "*")
87622
- .addMethods((_s = gnSocketAppSettings["allowMethods"]) !== null && _s !== void 0 ? _s : ["GET"])
87623
- .setCredentials((_t = gnSocketAppSettings["credentials"]) !== null && _t !== void 0 ? _t : true)
87624
- .setEnablePostViaMsgPack((_u = gnSocketAppSettings["enablePostViaMsgPack"]) !== null && _u !== void 0 ? _u : true)
87625
- .setEnablePostViaJson((_v = gnSocketAppSettings["enablePostViaJson"]) !== null && _v !== void 0 ? _v : true)
87626
- .addAllowedHeaders((_w = gnSocketAppSettings["allowHeaders"]) !== null && _w !== void 0 ? _w : [])
87627
- .setPingInterval((_x = gnSocketAppSettings["pingInterval"]) !== null && _x !== void 0 ? _x : 50000)
87628
- .setPingTimeout((_y = gnSocketAppSettings["pingTimeout"]) !== null && _y !== void 0 ? _y : 5000)
87629
- .setEnableSendAndReceiveDebug((_z = gnSocketAppSettings["enableSendAndReceiveDebug"]) !== null && _z !== void 0 ? _z : true)
87622
+ .setUseEmitter((_r = gnSocketAppSettings["useEmitter"]) !== null && _r !== void 0 ? _r : false)
87623
+ .setOrigins((_s = gnSocketAppSettings["allowOrigin"]) !== null && _s !== void 0 ? _s : "*")
87624
+ .addMethods((_t = gnSocketAppSettings["allowMethods"]) !== null && _t !== void 0 ? _t : ["GET"])
87625
+ .setCredentials((_u = gnSocketAppSettings["credentials"]) !== null && _u !== void 0 ? _u : true)
87626
+ .setEnablePostViaMsgPack((_v = gnSocketAppSettings["enablePostViaMsgPack"]) !== null && _v !== void 0 ? _v : true)
87627
+ .setEnablePostViaJson((_w = gnSocketAppSettings["enablePostViaJson"]) !== null && _w !== void 0 ? _w : true)
87628
+ .addAllowedHeaders((_x = gnSocketAppSettings["allowHeaders"]) !== null && _x !== void 0 ? _x : [])
87629
+ .setPingInterval((_y = gnSocketAppSettings["pingInterval"]) !== null && _y !== void 0 ? _y : 50000)
87630
+ .setPingTimeout((_z = gnSocketAppSettings["pingTimeout"]) !== null && _z !== void 0 ? _z : 5000)
87631
+ .setEnableSendAndReceiveDebug((_0 = gnSocketAppSettings["enableSendAndReceiveDebug"]) !== null && _0 !== void 0 ? _0 : true)
87630
87632
  .build();
87631
87633
  let gnOtherSettings = this.gnConfig["otherSettings"];
87632
87634
  if (gnOtherSettings == null)
@@ -87634,8 +87636,8 @@ class ServerApplicationStartup extends DefaultApplicationStartup_1.DefaultApplic
87634
87636
  "headerIP": "x-ip",
87635
87637
  };
87636
87638
  let otherSettings = OtherSettings_1.OtherSettings.Builder()
87637
- .setHeaderIP((_0 = gnOtherSettings["headerIP"]) !== null && _0 !== void 0 ? _0 : "x-ip")
87638
- .setIdTypeCase((_1 = gnOtherSettings["idTypeCase"]) !== null && _1 !== void 0 ? _1 : 0)
87639
+ .setHeaderIP((_1 = gnOtherSettings["headerIP"]) !== null && _1 !== void 0 ? _1 : "x-ip")
87640
+ .setIdTypeCase((_2 = gnOtherSettings["idTypeCase"]) !== null && _2 !== void 0 ? _2 : 0)
87639
87641
  .setIPApiUrl(gnOtherSettings["ipApiUrl"])
87640
87642
  .build();
87641
87643
  let gnDatabaseSettings = this.gnConfig["databaseSettings"];
@@ -87646,9 +87648,9 @@ class ServerApplicationStartup extends DefaultApplicationStartup_1.DefaultApplic
87646
87648
  "options": {},
87647
87649
  };
87648
87650
  let databaseSettings = DatabaseSettings_1.DatabaseSettings.Builder()
87649
- .setConnectionString((_2 = gnDatabaseSettings["connectionString"]) !== null && _2 !== void 0 ? _2 : "mongodb://127.0.0.1:27017/")
87650
- .setDatabaseName((_3 = gnDatabaseSettings["databaseName"]) !== null && _3 !== void 0 ? _3 : "XmobiTea")
87651
- .setOptions((_4 = gnDatabaseSettings["options"]) !== null && _4 !== void 0 ? _4 : {})
87651
+ .setConnectionString((_3 = gnDatabaseSettings["connectionString"]) !== null && _3 !== void 0 ? _3 : "mongodb://127.0.0.1:27017/")
87652
+ .setDatabaseName((_4 = gnDatabaseSettings["databaseName"]) !== null && _4 !== void 0 ? _4 : "XmobiTea")
87653
+ .setOptions((_5 = gnDatabaseSettings["options"]) !== null && _5 !== void 0 ? _5 : {})
87652
87654
  .build();
87653
87655
  let gnLogSettings = this.gnConfig["logSettings"];
87654
87656
  if (gnLogSettings == null)
@@ -87658,9 +87660,9 @@ class ServerApplicationStartup extends DefaultApplicationStartup_1.DefaultApplic
87658
87660
  "logPath": "./log/debug/Server.log",
87659
87661
  };
87660
87662
  let logSettings = LogSettings_1.LogSettings.Builder()
87661
- .setLogToFileEnable((_5 = gnLogSettings["logToFileEnable"]) !== null && _5 !== void 0 ? _5 : true)
87662
- .setLogToConsoleEnable((_6 = gnLogSettings["logToConsoleEnable"]) !== null && _6 !== void 0 ? _6 : true)
87663
- .setLogPath((_7 = gnLogSettings["logPath"]) !== null && _7 !== void 0 ? _7 : "./log/debug/Server.log")
87663
+ .setLogToFileEnable((_6 = gnLogSettings["logToFileEnable"]) !== null && _6 !== void 0 ? _6 : true)
87664
+ .setLogToConsoleEnable((_7 = gnLogSettings["logToConsoleEnable"]) !== null && _7 !== void 0 ? _7 : true)
87665
+ .setLogPath((_8 = gnLogSettings["logPath"]) !== null && _8 !== void 0 ? _8 : "./log/debug/Server.log")
87664
87666
  .build();
87665
87667
  let gnUploadFileSettings = this.gnConfig["uploadFileSettings"];
87666
87668
  if (gnUploadFileSettings == null)
@@ -87671,10 +87673,10 @@ class ServerApplicationStartup extends DefaultApplicationStartup_1.DefaultApplic
87671
87673
  "mimeTypeAccepts": ["image/png"],
87672
87674
  };
87673
87675
  let uploadFileSettings = UploadFileSettings_1.UploadFileSettings.Builder()
87674
- .setEnable((_8 = gnUploadFileSettings["enable"]) !== null && _8 !== void 0 ? _8 : true)
87675
- .setUploadPath((_9 = gnUploadFileSettings["uploadPath"]) !== null && _9 !== void 0 ? _9 : "./file-upload")
87676
- .setMaxSizeUpload((_10 = gnUploadFileSettings["maxSizeUpload"]) !== null && _10 !== void 0 ? _10 : 52428800)
87677
- .setMimeTypeAccepts((_11 = gnUploadFileSettings["mimeTypeAccepts"]) !== null && _11 !== void 0 ? _11 : ["image/png"])
87676
+ .setEnable((_9 = gnUploadFileSettings["enable"]) !== null && _9 !== void 0 ? _9 : true)
87677
+ .setUploadPath((_10 = gnUploadFileSettings["uploadPath"]) !== null && _10 !== void 0 ? _10 : "./file-upload")
87678
+ .setMaxSizeUpload((_11 = gnUploadFileSettings["maxSizeUpload"]) !== null && _11 !== void 0 ? _11 : 52428800)
87679
+ .setMimeTypeAccepts((_12 = gnUploadFileSettings["mimeTypeAccepts"]) !== null && _12 !== void 0 ? _12 : ["image/png"])
87678
87680
  .build();
87679
87681
  let gnDdosSettings = this.gnConfig["ddosSettings"];
87680
87682
  if (gnDdosSettings == null)
@@ -87691,17 +87693,17 @@ class ServerApplicationStartup extends DefaultApplicationStartup_1.DefaultApplic
87691
87693
  "maxDownloadPendingRequest": 200,
87692
87694
  };
87693
87695
  let ddosSettings = DDosSettings_1.DdosSettings.Builder()
87694
- .setSocketMaxRequestPerSecondPerIp((_12 = gnDdosSettings["socketMaxRequestPerSecondPerIp"]) !== null && _12 !== void 0 ? _12 : 50)
87695
- .setSocketMaxRequestPerSecondPerPeer((_13 = gnDdosSettings["socketMaxRequestPerSecondPerPeer"]) !== null && _13 !== void 0 ? _13 : 20)
87696
- .setSocketMaxPendingRequest((_14 = gnDdosSettings["socketMaxPendingRequest"]) !== null && _14 !== void 0 ? _14 : 1000)
87697
- .setSocketMaxRequestSize((_15 = gnDdosSettings["socketMaxRequestSize"]) !== null && _15 !== void 0 ? _15 : 1024)
87698
- .setHttpMaxRequestPerSecondPerIp((_16 = gnDdosSettings["httpMaxRequestPerSecondPerIp"]) !== null && _16 !== void 0 ? _16 : 50)
87699
- .setHttpMaxRequestPerSecondPerPeer((_17 = gnDdosSettings["httpMaxRequestPerSecondPerPeer"]) !== null && _17 !== void 0 ? _17 : 20)
87700
- .setHttpMaxPendingRequest((_18 = gnDdosSettings["httpMaxPendingRequest"]) !== null && _18 !== void 0 ? _18 : 1000)
87701
- .setHttpMaxRequestSize((_19 = gnDdosSettings["httpMaxRequestSize"]) !== null && _19 !== void 0 ? _19 : 1024)
87702
- .setMaxUploadPendingRequest((_20 = gnDdosSettings["maxUploadPendingRequest"]) !== null && _20 !== void 0 ? _20 : 200)
87703
- .setMaxDownloadPendingRequest((_21 = gnDdosSettings["maxDownloadPendingRequest"]) !== null && _21 !== void 0 ? _21 : 200)
87704
- .setIPWhiteList((_22 = gnDdosSettings["ipWhiteList"]) !== null && _22 !== void 0 ? _22 : [])
87696
+ .setSocketMaxRequestPerSecondPerIp((_13 = gnDdosSettings["socketMaxRequestPerSecondPerIp"]) !== null && _13 !== void 0 ? _13 : 50)
87697
+ .setSocketMaxRequestPerSecondPerPeer((_14 = gnDdosSettings["socketMaxRequestPerSecondPerPeer"]) !== null && _14 !== void 0 ? _14 : 20)
87698
+ .setSocketMaxPendingRequest((_15 = gnDdosSettings["socketMaxPendingRequest"]) !== null && _15 !== void 0 ? _15 : 1000)
87699
+ .setSocketMaxRequestSize((_16 = gnDdosSettings["socketMaxRequestSize"]) !== null && _16 !== void 0 ? _16 : 1024)
87700
+ .setHttpMaxRequestPerSecondPerIp((_17 = gnDdosSettings["httpMaxRequestPerSecondPerIp"]) !== null && _17 !== void 0 ? _17 : 50)
87701
+ .setHttpMaxRequestPerSecondPerPeer((_18 = gnDdosSettings["httpMaxRequestPerSecondPerPeer"]) !== null && _18 !== void 0 ? _18 : 20)
87702
+ .setHttpMaxPendingRequest((_19 = gnDdosSettings["httpMaxPendingRequest"]) !== null && _19 !== void 0 ? _19 : 1000)
87703
+ .setHttpMaxRequestSize((_20 = gnDdosSettings["httpMaxRequestSize"]) !== null && _20 !== void 0 ? _20 : 1024)
87704
+ .setMaxUploadPendingRequest((_21 = gnDdosSettings["maxUploadPendingRequest"]) !== null && _21 !== void 0 ? _21 : 200)
87705
+ .setMaxDownloadPendingRequest((_22 = gnDdosSettings["maxDownloadPendingRequest"]) !== null && _22 !== void 0 ? _22 : 200)
87706
+ .setIPWhiteList((_23 = gnDdosSettings["ipWhiteList"]) !== null && _23 !== void 0 ? _23 : [])
87705
87707
  .build();
87706
87708
  this.serverApplication = this.newServerApplication(applicationSettings, httpAppSettings, socketAppSettings, otherSettings, databaseSettings, logSettings, uploadFileSettings, ddosSettings);
87707
87709
  this.serverApplication.run(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xmobitea/gn-server",
3
- "version": "2.4.3",
3
+ "version": "2.4.5",
4
4
  "description": "Game Networking Server by XmobiTea (Pro)",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",