@xmobitea/gn-server 2.6.10 → 2.6.13
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.
- package/LICENSE +1 -1
- package/dist/GN-app-api/service/CacheService.d.ts +3 -1
- package/dist/GN-app-api/service/EventCallbackService.d.ts +6 -0
- package/dist/GN-common/constant/parameterCode/ParameterCode.d.ts +0 -1
- package/dist/GN-common/helper/StringUtility.d.ts +1 -0
- package/dist/GN-library/xdatabase/lib/entity/pro/Group.d.ts +4 -2
- package/dist/GN-library/xdatabase/lib/entity/pro/Inventory.d.ts +2 -1
- package/dist/GN-library/xdatabase/lib/entity/pro/MongoObject.d.ts +1 -0
- package/dist/GN-library/xdatabase/lib/entity/pro/PlayerBase.d.ts +4 -2
- package/dist/GN-library/xdatabase/lib/entity/pro/TradeInventory.d.ts +2 -1
- package/dist/GN-library/xdatabase/lib/xDatabase.d.ts +4 -4
- package/dist/GN-startup/cloudScript/CloudScriptAdmin.js +52 -0
- package/dist/GN-startup/cloudScript/CloudScriptDatabase.js +7 -0
- package/dist/GN-startup/cloudScript/CloudScriptDatabase.ts +3 -92
- package/dist/GN-startup/cloudScript/CloudScriptEvent.js +27 -0
- package/dist/GN-startup/cloudScript/CloudScriptHttp.js +61 -0
- package/dist/GN-startup/cloudScript/CloudScriptMail.js +27 -0
- package/dist/GN-startup/cloudScript/CloudScriptMatchmaking.js +15 -0
- package/dist/GN-startup/cloudScript/CloudScriptPushNotification.js +63 -0
- package/dist/GN-startup/cloudScript/CloudScriptSocket.js +60 -0
- package/dist/GN-startup/cloudScript/eventCallbackCloudScriptData.json +1 -1
- package/dist/GN-startup/cloudScript/templateEventCallback.ts +9 -3
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3559 -3191
- package/package.json +25 -22
package/LICENSE
CHANGED
|
@@ -186,7 +186,7 @@
|
|
|
186
186
|
same "printed page" as the copyright notice for easier
|
|
187
187
|
identification within third-party archives.
|
|
188
188
|
|
|
189
|
-
Copyright [2020 -
|
|
189
|
+
Copyright [2020 - 2026] [XmobiTea Family]
|
|
190
190
|
|
|
191
191
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
192
|
you may not use this file except in compliance with the License.
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { xDatabase } from "../../GN-library/xdatabase/lib/xDatabase";
|
|
1
2
|
import { ICacheService } from "./ICacheService";
|
|
2
3
|
import * as mongoDB from "mongodb";
|
|
3
4
|
export interface ICacheServiceController {
|
|
@@ -18,12 +19,13 @@ export declare class MemoryCacheServiceController implements ICacheServiceContro
|
|
|
18
19
|
}
|
|
19
20
|
export declare class MongoDbCacheServiceController implements ICacheServiceController {
|
|
20
21
|
private cacheCollection;
|
|
22
|
+
private database;
|
|
21
23
|
getData<T>(key: string): Promise<T>;
|
|
22
24
|
setData<T>(key: string, tData: T, expireAfterMs: number): Promise<void>;
|
|
23
25
|
removeData(key: string): Promise<boolean>;
|
|
24
26
|
isValid(key: string): Promise<boolean>;
|
|
25
27
|
removeInvalidData(): Promise<number>;
|
|
26
|
-
constructor(cacheCollection: mongoDB.Collection<mongoDB.Document
|
|
28
|
+
constructor(cacheCollection: mongoDB.Collection<mongoDB.Document>, database: xDatabase);
|
|
27
29
|
}
|
|
28
30
|
export declare class CacheService implements ICacheService {
|
|
29
31
|
private cacheServiceController;
|
|
@@ -45,6 +45,9 @@ export interface IEventCallbackCloudScriptService {
|
|
|
45
45
|
ipAddress: string;
|
|
46
46
|
isNewUser: boolean;
|
|
47
47
|
authenticationType: string;
|
|
48
|
+
subData: {
|
|
49
|
+
[k: string]: any;
|
|
50
|
+
};
|
|
48
51
|
}, secretInfo: SecretInfo, operationRequest: OperationRequest, operationResponse: OperationResponse): Promise<void>;
|
|
49
52
|
executeVerifyGenericService(serviceName: string, serviceData: {
|
|
50
53
|
[k: string]: any;
|
|
@@ -128,6 +131,9 @@ export declare class EventCallbackCloudScriptService implements IEventCallbackCl
|
|
|
128
131
|
ipAddress: string;
|
|
129
132
|
isNewUser: boolean;
|
|
130
133
|
authenticationType: string;
|
|
134
|
+
subData: {
|
|
135
|
+
[k: string]: any;
|
|
136
|
+
};
|
|
131
137
|
}, secretInfo: SecretInfo, operationRequest: OperationRequest, operationResponse: OperationResponse): Promise<void>;
|
|
132
138
|
executePost(eventName: string, request: {
|
|
133
139
|
[k: string]: any;
|
|
@@ -561,7 +561,6 @@ export declare class ParameterCode {
|
|
|
561
561
|
static readonly EmailSettings: string;
|
|
562
562
|
static readonly PushNotificationSettings: string;
|
|
563
563
|
static readonly SendFrom: string;
|
|
564
|
-
static readonly SendGridApiKey: string;
|
|
565
564
|
static readonly Host: string;
|
|
566
565
|
static readonly Port: string;
|
|
567
566
|
static readonly Secure: string;
|
|
@@ -39,7 +39,8 @@ export declare class Group extends DataObjectBase {
|
|
|
39
39
|
getAllGroupCurrencies(): Map<string, CurrencyItem>;
|
|
40
40
|
hasGroupCurrency(key: string): boolean;
|
|
41
41
|
getGroupCurrency(key: string): CurrencyItem;
|
|
42
|
-
changeGroupCurrency(key: string,
|
|
42
|
+
changeGroupCurrency(key: string, amount: number): void;
|
|
43
|
+
setGroupCurrency(key: string, value: number): void;
|
|
43
44
|
removeGroupCurrency(key: string): void;
|
|
44
45
|
getAllGroupDatas(): Array<DataItem>;
|
|
45
46
|
hasGroupData(key: string): boolean;
|
|
@@ -49,7 +50,8 @@ export declare class Group extends DataObjectBase {
|
|
|
49
50
|
getAllGroupStatistics(): Map<string, StatisticsItem>;
|
|
50
51
|
hasGroupStatistics(key: string): boolean;
|
|
51
52
|
getGroupStatistics(key: string): StatisticsItem;
|
|
52
|
-
changeGroupStatistics(key: string,
|
|
53
|
+
changeGroupStatistics(key: string, amount: number, tsLastUpdate: number): void;
|
|
54
|
+
setGroupStatistics(key: string, value: number, tsLastUpdate: number): void;
|
|
53
55
|
removeGroupStatistics(key: string): void;
|
|
54
56
|
getAllGroupInventories(): Array<InventoryItem>;
|
|
55
57
|
hasGroupInventory(itemId: string): boolean;
|
|
@@ -42,7 +42,8 @@ export declare class Inventory extends DataObjectBase {
|
|
|
42
42
|
getAllItemStatistics(): Map<string, StatisticsItem>;
|
|
43
43
|
hasItemStatistics(key: string): boolean;
|
|
44
44
|
getItemStatistics(key: string): StatisticsItem;
|
|
45
|
-
changeItemStatistics(key: string,
|
|
45
|
+
changeItemStatistics(key: string, amount: number, tsLastUpdate: number): void;
|
|
46
|
+
setItemStatistics(key: string, value: number, tsLastUpdate: number): void;
|
|
46
47
|
removeItemStatistics(key: string): void;
|
|
47
48
|
getRemoveStatus(): RemoveStatusItem;
|
|
48
49
|
setRemoveStatus(tsRemove: number, reason?: string): void;
|
|
@@ -8,6 +8,7 @@ export declare class MongoObject {
|
|
|
8
8
|
private updateFilter;
|
|
9
9
|
constructor(result: mongoDB.WithId<mongoDB.Document>, collection: mongoDB.Collection<mongoDB.Document>);
|
|
10
10
|
protected inc(field: string, value: number): void;
|
|
11
|
+
protected removeInc(field: string): void;
|
|
11
12
|
protected min(field: string, value: any): void;
|
|
12
13
|
protected max(field: string, value: any): void;
|
|
13
14
|
protected mul(field: string, value: number): void;
|
|
@@ -32,12 +32,14 @@ export declare class PlayerBase extends DataObjectBase {
|
|
|
32
32
|
getAllPlayerCurrencies(): Map<string, CurrencyItem>;
|
|
33
33
|
hasPlayerCurrency(key: string): boolean;
|
|
34
34
|
getPlayerCurrency(key: string): CurrencyItem;
|
|
35
|
-
changePlayerCurrency(key: string,
|
|
35
|
+
changePlayerCurrency(key: string, amount: number): void;
|
|
36
|
+
setPlayerCurrency(key: string, value: number): void;
|
|
36
37
|
removePlayerCurrency(key: string): void;
|
|
37
38
|
getAllPlayerStatistics(): Map<string, StatisticsItem>;
|
|
38
39
|
hasPlayerStatistics(key: string): boolean;
|
|
39
40
|
getPlayerStatistics(key: string): StatisticsItem;
|
|
40
|
-
changePlayerStatistics(key: string,
|
|
41
|
+
changePlayerStatistics(key: string, amount: number, tsLastUpdate: number): void;
|
|
42
|
+
setPlayerStatistics(key: string, value: number, tsLastUpdate: number): void;
|
|
41
43
|
removePlayerStatistics(key: string): void;
|
|
42
44
|
getIpAddressCreate(): string;
|
|
43
45
|
setIpAddressCreate(ipAddressCreate: string): void;
|
|
@@ -47,7 +47,8 @@ export declare class TradeInventory extends DataObjectBase {
|
|
|
47
47
|
getAllItemStatistics(): Map<string, StatisticsItem>;
|
|
48
48
|
hasItemStatistics(key: string): boolean;
|
|
49
49
|
getItemStatistics(key: string): StatisticsItem;
|
|
50
|
-
changeItemStatistics(key: string,
|
|
50
|
+
changeItemStatistics(key: string, amount: number, tsLastUpdate: number): void;
|
|
51
|
+
setItemStatistics(key: string, value: number, tsLastUpdate: number): void;
|
|
51
52
|
removeItemStatistics(key: string): void;
|
|
52
53
|
getRemoveStatus(): RemoveStatusItem;
|
|
53
54
|
setRemoveStatus(tsRemove: number, reason?: string): void;
|
|
@@ -22,10 +22,10 @@ export declare class xDatabase {
|
|
|
22
22
|
private static readonly RUNTIME;
|
|
23
23
|
private static readonly META;
|
|
24
24
|
private static readonly SYSTEM;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
protected client: mongoDB.MongoClient;
|
|
26
|
+
protected db: mongoDB.Db;
|
|
27
|
+
protected logClient: mongoDB.MongoClient;
|
|
28
|
+
protected logDb: mongoDB.Db;
|
|
29
29
|
getDb(): mongoDB.Db;
|
|
30
30
|
getLogDb(): mongoDB.Db;
|
|
31
31
|
init(url: string, dbName: string, logUrl: string, logDbName: string, options?: mongoDB.MongoClientOptions): void;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CloudScriptAdmin = void 0;
|
|
4
|
+
const gn_typescript_client_1 = require("@xmobitea/gn-typescript-client");
|
|
5
|
+
class CloudScriptAdmin {
|
|
6
|
+
characterPlayer = gn_typescript_client_1.GNNetwork.characterPlayer.admin;
|
|
7
|
+
content = gn_typescript_client_1.GNNetwork.content.admin;
|
|
8
|
+
gamePlayer = gn_typescript_client_1.GNNetwork.gamePlayer.admin;
|
|
9
|
+
group = gn_typescript_client_1.GNNetwork.group.admin;
|
|
10
|
+
inventory = gn_typescript_client_1.GNNetwork.inventory.admin;
|
|
11
|
+
masterPlayer = gn_typescript_client_1.GNNetwork.masterPlayer.admin;
|
|
12
|
+
storeInventory = gn_typescript_client_1.GNNetwork.storeInventory.admin;
|
|
13
|
+
multiplayer = gn_typescript_client_1.GNNetwork.multiplayer.admin;
|
|
14
|
+
cloudScript = gn_typescript_client_1.GNNetwork.cloudScript.admin;
|
|
15
|
+
dashboard = {
|
|
16
|
+
getAdminAccountList: gn_typescript_client_1.GNNetwork.dashboard.getAdminAccountList,
|
|
17
|
+
getAdminAccountListAsync: gn_typescript_client_1.GNNetwork.dashboard.getAdminAccountListAsync,
|
|
18
|
+
getGameInformation: gn_typescript_client_1.GNNetwork.dashboard.getGameInformation,
|
|
19
|
+
getGameInformationAsync: gn_typescript_client_1.GNNetwork.dashboard.getGameInformationAsync,
|
|
20
|
+
getGameList: gn_typescript_client_1.GNNetwork.dashboard.getGameList,
|
|
21
|
+
getGameListAsync: gn_typescript_client_1.GNNetwork.dashboard.getGameListAsync,
|
|
22
|
+
getMasterGameSettings: gn_typescript_client_1.GNNetwork.dashboard.getMasterGameSettings,
|
|
23
|
+
getMasterGameSettingsAsync: gn_typescript_client_1.GNNetwork.dashboard.getMasterGameSettingsAsync,
|
|
24
|
+
getSecretInfoInformation: gn_typescript_client_1.GNNetwork.dashboard.getSecretInfoInformation,
|
|
25
|
+
getSecretInfoInformationAsync: gn_typescript_client_1.GNNetwork.dashboard.getSecretInfoInformationAsync,
|
|
26
|
+
getSecretInfoList: gn_typescript_client_1.GNNetwork.dashboard.getSecretInfoList,
|
|
27
|
+
getSecretInfoListAsync: gn_typescript_client_1.GNNetwork.dashboard.getSecretInfoListAsync,
|
|
28
|
+
getServerLog: gn_typescript_client_1.GNNetwork.dashboard.getServerLog,
|
|
29
|
+
getServerLogAsync: gn_typescript_client_1.GNNetwork.dashboard.getServerLogAsync,
|
|
30
|
+
setGameInformation: gn_typescript_client_1.GNNetwork.dashboard.setGameInformation,
|
|
31
|
+
setGameInformationAsync: gn_typescript_client_1.GNNetwork.dashboard.setGameInformationAsync,
|
|
32
|
+
getUsernameAdminAccount: gn_typescript_client_1.GNNetwork.dashboard.getUsernameAdminAccount,
|
|
33
|
+
getUsernameAdminAccountAsync: gn_typescript_client_1.GNNetwork.dashboard.getUsernameAdminAccountAsync,
|
|
34
|
+
getAnalytics: gn_typescript_client_1.GNNetwork.dashboard.getAnalytics,
|
|
35
|
+
getAnalyticsAsync: gn_typescript_client_1.GNNetwork.dashboard.getAnalyticsAsync,
|
|
36
|
+
resetStatisticsLeaderboard: gn_typescript_client_1.GNNetwork.dashboard.resetStatisticsLeaderboard,
|
|
37
|
+
resetStatisticsLeaderboardAsync: gn_typescript_client_1.GNNetwork.dashboard.resetStatisticsLeaderboardAsync,
|
|
38
|
+
getBackupStatisticsLeaderboardVersion: gn_typescript_client_1.GNNetwork.dashboard.getBackupStatisticsLeaderboardVersion,
|
|
39
|
+
getBackupStatisticsLeaderboardVersionAsync: gn_typescript_client_1.GNNetwork.dashboard.getBackupStatisticsLeaderboardVersionAsync,
|
|
40
|
+
getServerGameData: gn_typescript_client_1.GNNetwork.dashboard.getServerGameData,
|
|
41
|
+
getServerGameDataAsync: gn_typescript_client_1.GNNetwork.dashboard.getServerGameDataAsync,
|
|
42
|
+
deleteInDatabase: gn_typescript_client_1.GNNetwork.dashboard.deleteInDatabase,
|
|
43
|
+
deleteInDatabaseAsync: gn_typescript_client_1.GNNetwork.dashboard.deleteInDatabaseAsync,
|
|
44
|
+
};
|
|
45
|
+
send(requestType, role, request, onResponse, overrideAuthToken, overrideSecretKey, customTags) {
|
|
46
|
+
gn_typescript_client_1.GNNetwork.sendViaHttp(requestType, role, request, onResponse, overrideAuthToken, overrideSecretKey, customTags);
|
|
47
|
+
}
|
|
48
|
+
sendAsync(requestType, role, request, overrideAuthToken, overrideSecretKey, customTags) {
|
|
49
|
+
return gn_typescript_client_1.GNNetwork.sendViaHttpAsync(requestType, role, request, overrideAuthToken, overrideSecretKey, customTags);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
exports.CloudScriptAdmin = CloudScriptAdmin;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CloudScriptDatabase = void 0;
|
|
4
|
+
const index_1 = require("./../../index");
|
|
5
|
+
class CloudScriptDatabase extends index_1.xDatabase {
|
|
6
|
+
}
|
|
7
|
+
exports.CloudScriptDatabase = CloudScriptDatabase;
|
|
@@ -1,93 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { xDatabase } from "./../../index";
|
|
2
2
|
|
|
3
|
-
export class CloudScriptDatabase {
|
|
4
|
-
|
|
5
|
-
private static readonly RUNTIME: string = "Runtime" + CloudScriptDatabase.DOT;
|
|
6
|
-
private static readonly META: string = "Meta" + CloudScriptDatabase.DOT;
|
|
7
|
-
private static readonly SYSTEM: string = "System" + CloudScriptDatabase.DOT;
|
|
8
|
-
|
|
9
|
-
private client: mongodb.MongoClient;
|
|
10
|
-
private db: mongodb.Db;
|
|
11
|
-
|
|
12
|
-
private logClient: mongodb.MongoClient;
|
|
13
|
-
private logDb: mongodb.Db;
|
|
14
|
-
|
|
15
|
-
init(url: string, dbName: string, logUrl: string, logDbName: string, options?: mongodb.MongoClientOptions): void {
|
|
16
|
-
this.client = new mongodb.MongoClient(url, options);
|
|
17
|
-
|
|
18
|
-
this.db = this.client.db(dbName);
|
|
19
|
-
|
|
20
|
-
if (!logUrl || logUrl == "" || logUrl == url) {
|
|
21
|
-
this.logClient = this.client;
|
|
22
|
-
this.logDb = this.db;
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
this.logClient = new mongodb.MongoClient(logUrl, options);
|
|
26
|
-
this.logDb = this.logClient.db(logDbName);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
public runtimeCollection<TSchema extends mongodb.Document = mongodb.Document>(collectionName: string): mongodb.Collection<TSchema> {
|
|
31
|
-
return this.collection<TSchema>(CloudScriptDatabase.RUNTIME + collectionName);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
public metaCollection<TSchema extends mongodb.Document = mongodb.Document>(collectionName: string): mongodb.Collection<TSchema> {
|
|
35
|
-
return this.collection<TSchema>(CloudScriptDatabase.META + collectionName);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
public systemCollection<TSchema extends mongodb.Document = mongodb.Document>(collectionName: string): mongodb.Collection<TSchema> {
|
|
39
|
-
return this.collection<TSchema>(CloudScriptDatabase.SYSTEM + collectionName);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
public runtimeGameCollection<TSchema extends mongodb.Document = mongodb.Document>(collectionName: string, gameId: string): mongodb.Collection<TSchema> {
|
|
43
|
-
return this.collection<TSchema>(CloudScriptDatabase.RUNTIME + gameId + CloudScriptDatabase.DOT + collectionName);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
public metaGameCollection<TSchema extends mongodb.Document = mongodb.Document>(collectionName: string, gameId: string): mongodb.Collection<TSchema> {
|
|
47
|
-
return this.collection<TSchema>(CloudScriptDatabase.META + gameId + CloudScriptDatabase.DOT + collectionName);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
public systemGameCollection<TSchema extends mongodb.Document = mongodb.Document>(collectionName: string, gameId: string): mongodb.Collection<TSchema> {
|
|
51
|
-
return this.collection<TSchema>(CloudScriptDatabase.SYSTEM + gameId + CloudScriptDatabase.DOT + collectionName);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
public collection<TSchema extends mongodb.Document = mongodb.Document>(fullCollectionName: string): mongodb.Collection<TSchema> {
|
|
55
|
-
return this.db.collection<TSchema>(fullCollectionName);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
public createCollection(name: string, options?: mongodb.CreateCollectionOptions): Promise<mongodb.Collection<mongodb.BSON.Document>> {
|
|
59
|
-
return this.db.createCollection(name, options);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
public logRuntimeCollection<TSchema extends mongodb.Document = mongodb.Document>(collectionName: string): mongodb.Collection<TSchema> {
|
|
63
|
-
return this.logCollection<TSchema>(CloudScriptDatabase.RUNTIME + collectionName);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
public logMetaCollection<TSchema extends mongodb.Document = mongodb.Document>(collectionName: string): mongodb.Collection<TSchema> {
|
|
67
|
-
return this.logCollection<TSchema>(CloudScriptDatabase.META + collectionName);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
public logSystemCollection<TSchema extends mongodb.Document = mongodb.Document>(collectionName: string): mongodb.Collection<TSchema> {
|
|
71
|
-
return this.logCollection<TSchema>(CloudScriptDatabase.SYSTEM + collectionName);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
public logRuntimeGameCollection<TSchema extends mongodb.Document = mongodb.Document>(collectionName: string, gameId: string): mongodb.Collection<TSchema> {
|
|
75
|
-
return this.logCollection<TSchema>(CloudScriptDatabase.RUNTIME + gameId + CloudScriptDatabase.DOT + collectionName);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
public logMetaGameCollection<TSchema extends mongodb.Document = mongodb.Document>(collectionName: string, gameId: string): mongodb.Collection<TSchema> {
|
|
79
|
-
return this.logCollection<TSchema>(CloudScriptDatabase.META + gameId + CloudScriptDatabase.DOT + collectionName);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
public logSystemGameCollection<TSchema extends mongodb.Document = mongodb.Document>(collectionName: string, gameId: string): mongodb.Collection<TSchema> {
|
|
83
|
-
return this.logCollection<TSchema>(CloudScriptDatabase.SYSTEM + gameId + CloudScriptDatabase.DOT + collectionName);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
public logCollection<TSchema extends mongodb.Document = mongodb.Document>(fullCollectionName: string): mongodb.Collection<TSchema> {
|
|
87
|
-
return this.logDb.collection<TSchema>(fullCollectionName);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
public logCreateCollection<TSchema extends mongodb.Document = mongodb.Document>(collectionName: string, options?: mongodb.CreateCollectionOptions) {
|
|
91
|
-
return this.logDb.createCollection<TSchema>(collectionName, options)
|
|
92
|
-
}
|
|
93
|
-
}
|
|
3
|
+
export class CloudScriptDatabase extends xDatabase {
|
|
4
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CloudScriptProcessBase = exports.CloudScriptEventType = void 0;
|
|
4
|
+
var CloudScriptEventType;
|
|
5
|
+
(function (CloudScriptEventType) {
|
|
6
|
+
CloudScriptEventType[CloudScriptEventType["SendEventToOne"] = 0] = "SendEventToOne";
|
|
7
|
+
CloudScriptEventType[CloudScriptEventType["SendEventToMore"] = 1] = "SendEventToMore";
|
|
8
|
+
CloudScriptEventType[CloudScriptEventType["SendEventToAll"] = 2] = "SendEventToAll";
|
|
9
|
+
CloudScriptEventType[CloudScriptEventType["JoinRoom"] = 3] = "JoinRoom";
|
|
10
|
+
CloudScriptEventType[CloudScriptEventType["LeaveRoom"] = 4] = "LeaveRoom";
|
|
11
|
+
CloudScriptEventType[CloudScriptEventType["SendEventToRoom"] = 5] = "SendEventToRoom";
|
|
12
|
+
CloudScriptEventType[CloudScriptEventType["ConfirmServerDetail"] = 10] = "ConfirmServerDetail";
|
|
13
|
+
CloudScriptEventType[CloudScriptEventType["SendMailToOne"] = 20] = "SendMailToOne";
|
|
14
|
+
CloudScriptEventType[CloudScriptEventType["SendMailToMore"] = 21] = "SendMailToMore";
|
|
15
|
+
CloudScriptEventType[CloudScriptEventType["SendPushNotificationToOne"] = 30] = "SendPushNotificationToOne";
|
|
16
|
+
CloudScriptEventType[CloudScriptEventType["SendPushNotificationToMore"] = 31] = "SendPushNotificationToMore";
|
|
17
|
+
CloudScriptEventType[CloudScriptEventType["SendPushNotificationToTopic"] = 32] = "SendPushNotificationToTopic";
|
|
18
|
+
CloudScriptEventType[CloudScriptEventType["SubscribeToTopic"] = 33] = "SubscribeToTopic";
|
|
19
|
+
CloudScriptEventType[CloudScriptEventType["UnsubscribeFromTopic"] = 34] = "UnsubscribeFromTopic";
|
|
20
|
+
})(CloudScriptEventType || (exports.CloudScriptEventType = CloudScriptEventType = {}));
|
|
21
|
+
class CloudScriptProcessBase {
|
|
22
|
+
async sendEvent(event) {
|
|
23
|
+
if (process?.send)
|
|
24
|
+
process.send(event);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.CloudScriptProcessBase = CloudScriptProcessBase;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.CloudScriptHttp = void 0;
|
|
37
|
+
const axios = __importStar(require("axios"));
|
|
38
|
+
class CloudScriptHttp {
|
|
39
|
+
async get(url, config) {
|
|
40
|
+
return await axios.default.get(url, config);
|
|
41
|
+
}
|
|
42
|
+
async delete(url, config) {
|
|
43
|
+
return await axios.default.delete(url, config);
|
|
44
|
+
}
|
|
45
|
+
async head(url, config) {
|
|
46
|
+
return await axios.default.head(url, config);
|
|
47
|
+
}
|
|
48
|
+
async options(url, config) {
|
|
49
|
+
return await axios.default.options(url, config);
|
|
50
|
+
}
|
|
51
|
+
async post(url, data, config) {
|
|
52
|
+
return await axios.default.post(url, data, config);
|
|
53
|
+
}
|
|
54
|
+
async put(url, data, config) {
|
|
55
|
+
return await axios.default.put(url, data, config);
|
|
56
|
+
}
|
|
57
|
+
async patch(url, data, config) {
|
|
58
|
+
return await axios.default.patch(url, data, config);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
exports.CloudScriptHttp = CloudScriptHttp;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CloudScriptMail = void 0;
|
|
4
|
+
const CloudScriptEvent_1 = require("./CloudScriptEvent");
|
|
5
|
+
class CloudScriptMail extends CloudScriptEvent_1.CloudScriptProcessBase {
|
|
6
|
+
async send(email, subject, contentHtml) {
|
|
7
|
+
return await this.sendEvent({
|
|
8
|
+
eventType: CloudScriptEvent_1.CloudScriptEventType.SendMailToOne,
|
|
9
|
+
email: email,
|
|
10
|
+
mailData: {
|
|
11
|
+
subject: subject,
|
|
12
|
+
contentHtml: contentHtml,
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
async sendToMore(emails, subject, contentHtml) {
|
|
17
|
+
return await this.sendEvent({
|
|
18
|
+
eventType: CloudScriptEvent_1.CloudScriptEventType.SendMailToMore,
|
|
19
|
+
emails: emails,
|
|
20
|
+
mailData: {
|
|
21
|
+
subject: subject,
|
|
22
|
+
contentHtml: contentHtml,
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.CloudScriptMail = CloudScriptMail;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CloudScriptMatchmaking = void 0;
|
|
4
|
+
const CloudScriptEvent_1 = require("./CloudScriptEvent");
|
|
5
|
+
class CloudScriptMatchmaking extends CloudScriptEvent_1.CloudScriptProcessBase {
|
|
6
|
+
async confirmServerDetail(gameId, matchmakingTicketCanMatch, serverDetail) {
|
|
7
|
+
return await this.sendEvent({
|
|
8
|
+
eventType: CloudScriptEvent_1.CloudScriptEventType.ConfirmServerDetail,
|
|
9
|
+
gameId: gameId,
|
|
10
|
+
matchmakingTicketCanMatch: matchmakingTicketCanMatch,
|
|
11
|
+
serverDetail: serverDetail,
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.CloudScriptMatchmaking = CloudScriptMatchmaking;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CloudScriptPushNotification = void 0;
|
|
4
|
+
const CloudScriptEvent_1 = require("./CloudScriptEvent");
|
|
5
|
+
class CloudScriptPushNotification extends CloudScriptEvent_1.CloudScriptProcessBase {
|
|
6
|
+
async send(token, title, body, badge, sound, icon, data) {
|
|
7
|
+
return await this.sendEvent({
|
|
8
|
+
eventType: CloudScriptEvent_1.CloudScriptEventType.SendPushNotificationToOne,
|
|
9
|
+
token: token,
|
|
10
|
+
pushData: {
|
|
11
|
+
title: title,
|
|
12
|
+
body: body,
|
|
13
|
+
badge: badge,
|
|
14
|
+
sound: sound,
|
|
15
|
+
icon: icon,
|
|
16
|
+
data: data,
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
async sendToMore(tokens, title, body, badge, sound, icon, data) {
|
|
21
|
+
return await this.sendEvent({
|
|
22
|
+
eventType: CloudScriptEvent_1.CloudScriptEventType.SendPushNotificationToMore,
|
|
23
|
+
tokens: tokens,
|
|
24
|
+
pushData: {
|
|
25
|
+
title: title,
|
|
26
|
+
body: body,
|
|
27
|
+
badge: badge,
|
|
28
|
+
sound: sound,
|
|
29
|
+
icon: icon,
|
|
30
|
+
data: data,
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
async sendToTopic(topic, title, body, badge, sound, icon, data) {
|
|
35
|
+
return await this.sendEvent({
|
|
36
|
+
eventType: CloudScriptEvent_1.CloudScriptEventType.SendPushNotificationToTopic,
|
|
37
|
+
topic: topic,
|
|
38
|
+
pushData: {
|
|
39
|
+
title: title,
|
|
40
|
+
body: body,
|
|
41
|
+
badge: badge,
|
|
42
|
+
sound: sound,
|
|
43
|
+
icon: icon,
|
|
44
|
+
data: data,
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
async subscribeToTopic(tokens, topic) {
|
|
49
|
+
return await this.sendEvent({
|
|
50
|
+
eventType: CloudScriptEvent_1.CloudScriptEventType.SubscribeToTopic,
|
|
51
|
+
tokens: tokens,
|
|
52
|
+
topic: topic,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
async unsubscribeFromTopic(tokens, topic) {
|
|
56
|
+
return await this.sendEvent({
|
|
57
|
+
eventType: CloudScriptEvent_1.CloudScriptEventType.UnsubscribeFromTopic,
|
|
58
|
+
tokens: tokens,
|
|
59
|
+
topic: topic,
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
exports.CloudScriptPushNotification = CloudScriptPushNotification;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CloudScriptSocket = void 0;
|
|
4
|
+
const CloudScriptEvent_1 = require("./CloudScriptEvent");
|
|
5
|
+
class CloudScriptSocket extends CloudScriptEvent_1.CloudScriptProcessBase {
|
|
6
|
+
async sendEventTo(userId, operationEvent) {
|
|
7
|
+
return await this.sendEvent({
|
|
8
|
+
eventType: CloudScriptEvent_1.CloudScriptEventType.SendEventToOne,
|
|
9
|
+
userId: userId,
|
|
10
|
+
operationEvent: {
|
|
11
|
+
eventCode: operationEvent.getEventCode(),
|
|
12
|
+
parameters: operationEvent.getParameters()?.toData() ?? null,
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
async sendEventToMoreUser(userIds, operationEvent) {
|
|
17
|
+
return await this.sendEvent({
|
|
18
|
+
eventType: CloudScriptEvent_1.CloudScriptEventType.SendEventToMore,
|
|
19
|
+
userIds: userIds,
|
|
20
|
+
operationEvent: {
|
|
21
|
+
eventCode: operationEvent.getEventCode(),
|
|
22
|
+
parameters: operationEvent.getParameters()?.toData() ?? null,
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
async sendEventToAllPlayer(operationEvent) {
|
|
27
|
+
return await this.sendEvent({
|
|
28
|
+
eventType: CloudScriptEvent_1.CloudScriptEventType.SendEventToAll,
|
|
29
|
+
operationEvent: {
|
|
30
|
+
eventCode: operationEvent.getEventCode(),
|
|
31
|
+
parameters: operationEvent.getParameters()?.toData() ?? null,
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
async joinRoom(userId, roomId) {
|
|
36
|
+
return await this.sendEvent({
|
|
37
|
+
eventType: CloudScriptEvent_1.CloudScriptEventType.JoinRoom,
|
|
38
|
+
userId: userId,
|
|
39
|
+
roomId: roomId,
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
async leaveRoom(userId, roomId) {
|
|
43
|
+
return await this.sendEvent({
|
|
44
|
+
eventType: CloudScriptEvent_1.CloudScriptEventType.LeaveRoom,
|
|
45
|
+
userId: userId,
|
|
46
|
+
roomId: roomId,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
async sendEventToRoom(roomId, operationEvent) {
|
|
50
|
+
return await this.sendEvent({
|
|
51
|
+
eventType: CloudScriptEvent_1.CloudScriptEventType.SendEventToRoom,
|
|
52
|
+
roomId: roomId,
|
|
53
|
+
operationEvent: {
|
|
54
|
+
eventCode: operationEvent.getEventCode(),
|
|
55
|
+
parameters: operationEvent.getParameters()?.toData() ?? null,
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
exports.CloudScriptSocket = CloudScriptSocket;
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"childScripts": [
|
|
44
44
|
{
|
|
45
45
|
"eventName": "systemAuthenticate_OnAuthenticateSuccess",
|
|
46
|
-
"script": "\nsystemAuthenticateHandlers.systemAuthenticate_OnAuthenticateSuccess = async (request: { userId: string, ipAddress: string, isNewUser: boolean, authenticationType: string }, secretInfo: SecretInfo, operationRequest: OperationRequest, operationResponse: OperationResponse, log: (log: any) => void) => {\n\n\treturn operationResponse;\n}\n",
|
|
46
|
+
"script": "\nsystemAuthenticateHandlers.systemAuthenticate_OnAuthenticateSuccess = async (request: { userId: string, ipAddress: string, isNewUser: boolean, authenticationType: string, subData: { [k: string]: any; } }, secretInfo: SecretInfo, operationRequest: OperationRequest, operationResponse: OperationResponse, log: (log: any) => void) => {\n\n\treturn operationResponse;\n}\n",
|
|
47
47
|
"hasEdit": false
|
|
48
48
|
},
|
|
49
49
|
{
|
|
@@ -322,7 +322,7 @@ interface FunctionRequestSystemMatchmaking {
|
|
|
322
322
|
}
|
|
323
323
|
|
|
324
324
|
interface FunctionRequestSystemAuthenticate {
|
|
325
|
-
request: { [k: string]: any };
|
|
325
|
+
request: { userId: string, ipAddress: string, isNewUser: boolean, authenticationType: string, subData: { [k: string]: any } };
|
|
326
326
|
secretInfo: SecretInfo;
|
|
327
327
|
operationRequest: OperationRequest;
|
|
328
328
|
operationResponse: OperationResponse;
|
|
@@ -515,7 +515,13 @@ process?.on("message", async (request: CloudScriptRequest) => {
|
|
|
515
515
|
operationRequest: operationRequest,
|
|
516
516
|
operationResponse: operationResponse,
|
|
517
517
|
secretInfo: secretInfo,
|
|
518
|
-
request:
|
|
518
|
+
request: {
|
|
519
|
+
userId: request.request.userId,
|
|
520
|
+
ipAddress: request.request.ipAddress,
|
|
521
|
+
isNewUser: request.request.isNewUser,
|
|
522
|
+
authenticationType: request.request.authenticationType,
|
|
523
|
+
subData: request.request.subData
|
|
524
|
+
},
|
|
519
525
|
log(log: any) {
|
|
520
526
|
logs.push(JSON.stringify(log));
|
|
521
527
|
},
|
|
@@ -880,7 +886,7 @@ const eventHandlers: Record<string, (request: any, operationEvent: OperationEven
|
|
|
880
886
|
|
|
881
887
|
const systemMatchmakingHandlers: Record<string, (gameId: string, matchmakingTicketCanMatch: MatchmakingTicketCanMatch, log: (log: any) => void) => Promise<{ success: boolean }>> = {};
|
|
882
888
|
|
|
883
|
-
const systemAuthenticateHandlers: Record<string, (request: { userId: string, ipAddress: string, isNewUser: boolean, authenticationType: string }, secretInfo: SecretInfo, operationRequest: OperationRequest, operationResponse: OperationResponse, log: (log: any) => void) => Promise<OperationResponse>> = {};
|
|
889
|
+
const systemAuthenticateHandlers: Record<string, (request: { userId: string, ipAddress: string, isNewUser: boolean, authenticationType: string, subData: { [k: string]: any; } }, secretInfo: SecretInfo, operationRequest: OperationRequest, operationResponse: OperationResponse, log: (log: any) => void) => Promise<OperationResponse>> = {};
|
|
884
890
|
|
|
885
891
|
const systemGenericServiceHandlers: Record<string, (serviceName: string, serviceData: { [k: string]: any; }, log: (log: any) => void) => Promise<{ success: boolean, serviceId: string, someDatas?: any, errorMessage?: string }>> = {};
|
|
886
892
|
|
package/dist/index.d.ts
CHANGED
|
@@ -218,6 +218,8 @@ import { TradeInventory } from "./GN-library/xdatabase/lib/entity/pro/TradeInven
|
|
|
218
218
|
export { TradeInventory };
|
|
219
219
|
import { UploadFileInfo } from "./GN-library/xdatabase/lib/entity/pro/UploadFileInfo";
|
|
220
220
|
export { UploadFileInfo };
|
|
221
|
+
import { FileUploadInfoFindOptions } from "./GN-library/xdatabase/lib/entity/pro/findOptions/FileUploadInfoFindOptions";
|
|
222
|
+
export { FileUploadInfoFindOptions };
|
|
221
223
|
import { xDatabase } from "./GN-library/xdatabase/lib/xDatabase";
|
|
222
224
|
export { xDatabase };
|
|
223
225
|
import { xDatetime } from "./GN-library/xdatetime/lib/xDatetime";
|