@xmobitea/gn-typescript-client 0.0.4 → 1.0.9
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/dist/gn.js.client.min.js +2 -0
- package/dist/gn.js.client.min.js.LICENSE.txt +14 -0
- package/dist/index.d.ts +99 -9
- package/dist/index.js +1 -1
- package/dist/runtime/GNNetwork.d.ts +51 -10
- package/dist/runtime/common/Action0.d.ts +1 -3
- package/dist/runtime/common/Action1.d.ts +1 -3
- package/dist/runtime/common/Action2.d.ts +1 -3
- package/dist/runtime/common/Action3.d.ts +1 -3
- package/dist/runtime/common/Action4.d.ts +1 -3
- package/dist/runtime/common/GNData.d.ts +1 -1
- package/dist/runtime/constant/EventCode.d.ts +3 -0
- package/dist/runtime/constant/OperationCode.d.ts +15 -0
- package/dist/runtime/constant/errorCode/ChatErrorCode.d.ts +4 -0
- package/dist/runtime/constant/errorCode/FriendErrorCode.d.ts +4 -0
- package/dist/runtime/constant/parameterCode/ChatParameterCode.d.ts +22 -0
- package/dist/runtime/constant/parameterCode/FriendParameterCode.d.ts +12 -0
- package/dist/runtime/entity/DataMember.d.ts +76 -0
- package/dist/runtime/entity/GNMetadata.d.ts +21 -0
- package/dist/runtime/entity/request/AddFriendOperationRequest.d.ts +6 -0
- package/dist/runtime/entity/request/EditChatInfoChannelOperationRequest.d.ts +7 -0
- package/dist/runtime/entity/request/EditChatMessageChannelOperationRequest.d.ts +6 -0
- package/dist/runtime/entity/request/EditChatMessageUserOperationRequest.d.ts +6 -0
- package/dist/runtime/entity/request/FindPlayerOperationRequest.d.ts +6 -0
- package/dist/runtime/entity/request/GetChatInfoChannelOperationRequest.d.ts +6 -0
- package/dist/runtime/entity/request/GetChatMemberChannelOperationRequest.d.ts +6 -0
- package/dist/runtime/entity/request/GetChatMessageChannelOperationRequest.d.ts +6 -0
- package/dist/runtime/entity/request/GetChatMessageUserOperationRequest.d.ts +6 -0
- package/dist/runtime/entity/request/GetFriendsOperationRequest.d.ts +6 -0
- package/dist/runtime/entity/request/JoinChatChannelOperationRequest.d.ts +6 -0
- package/dist/runtime/entity/request/LeaveChatChannelOperationRequest.d.ts +6 -0
- package/dist/runtime/entity/request/RemoveFriendOperationRequest.d.ts +6 -0
- package/dist/runtime/entity/request/SendChatToChannelOperationRequest.d.ts +6 -0
- package/dist/runtime/entity/request/SendChatToUserOperationRequest.d.ts +6 -0
- package/dist/runtime/entity/response/AddFriendOperationResponse.d.ts +5 -0
- package/dist/runtime/entity/response/EditChatInfoChannelOperationResponse.d.ts +5 -0
- package/dist/runtime/entity/response/EditChatMessageChannelOperationResponse.d.ts +5 -0
- package/dist/runtime/entity/response/EditChatMessageUserOperationResponse.d.ts +5 -0
- package/dist/runtime/entity/response/FindPlayerOperationResponse.d.ts +6 -0
- package/dist/runtime/entity/response/GetChatInfoChannelOperationResponse.d.ts +18 -0
- package/dist/runtime/entity/response/GetChatMemberChannelOperationResponse.d.ts +14 -0
- package/dist/runtime/entity/response/GetChatMessageChannelOperationResponse.d.ts +20 -0
- package/dist/runtime/entity/response/GetChatMessageUserOperationResponse.d.ts +17 -0
- package/dist/runtime/entity/response/GetFriendsOperationResponse.d.ts +13 -0
- package/dist/runtime/entity/response/JoinChatChannelOperationResponse.d.ts +5 -0
- package/dist/runtime/entity/response/LeaveChatChannelOperationResponse.d.ts +5 -0
- package/dist/runtime/entity/response/RemoveFriendOperationResponse.d.ts +5 -0
- package/dist/runtime/entity/response/SendChatToChannelOperationResponse.d.ts +5 -0
- package/dist/runtime/entity/response/SendChatToUserOperationResponse.d.ts +5 -0
- package/dist/runtime/entity/server/AvatarChannel.d.ts +4 -0
- package/dist/runtime/entity/server/ChatChannel.d.ts +13 -0
- package/dist/runtime/entity/server/ChatMessage.d.ts +10 -0
- package/dist/runtime/entity/server/ChatUser.d.ts +5 -0
- package/dist/runtime/entity/server/FriendItem.d.ts +7 -0
- package/dist/runtime/entity/server/UserChannel.d.ts +4 -0
- package/dist/runtime/helper/ConverterService.d.ts +15 -0
- package/dist/runtime/networking/NetworkingPeer.d.ts +42 -0
- package/dist/runtime/networking/SocketPeer.d.ts +5 -1
- package/dist/runtime/networking/handler/OnChannelChatEventHandler.d.ts +6 -0
- package/dist/runtime/networking/handler/OnFriendUpdateEventHandler.d.ts +6 -0
- package/dist/runtime/networking/handler/OnUserChatEventHandler.d.ts +6 -0
- package/package.json +39 -37
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { GNHashtable } from "./../common/GNData";
|
|
2
|
+
type Constructor<T> = {
|
|
3
|
+
new (...args: any[]): T;
|
|
4
|
+
};
|
|
5
|
+
export interface IGNObject {
|
|
6
|
+
parameters: GNHashtable;
|
|
7
|
+
isValid: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare class ConvertService {
|
|
10
|
+
private readonly declaredFieldsMap;
|
|
11
|
+
convertObject<T extends IGNObject>(parameters: GNHashtable, cls: Constructor<T>): T;
|
|
12
|
+
private isInteger;
|
|
13
|
+
constructor();
|
|
14
|
+
}
|
|
15
|
+
export {};
|
|
@@ -18,6 +18,25 @@ import { RegisterSocketOperationResponse } from "./../entity/response/RegisterSo
|
|
|
18
18
|
import { TemplateOperationResponse } from "./../entity/response/TemplateOperationResponse";
|
|
19
19
|
import { IServerEventHandler } from "./handler/IServerEventHandler";
|
|
20
20
|
import { HttpAppResponse } from "./HttpPeer";
|
|
21
|
+
import { OperationEvent } from "./../entity/OperationEvent";
|
|
22
|
+
import { FriendItem } from "./../entity/server/FriendItem";
|
|
23
|
+
import { ChatChannel } from "./../entity/server/ChatChannel";
|
|
24
|
+
import { ChatUser } from "./../entity/server/ChatUser";
|
|
25
|
+
import { AddFriendOperationResponse } from "./../entity/response/AddFriendOperationResponse";
|
|
26
|
+
import { RemoveFriendOperationResponse } from "./../entity/response/RemoveFriendOperationResponse";
|
|
27
|
+
import { GetFriendsOperationResponse } from "./../entity/response/GetFriendsOperationResponse";
|
|
28
|
+
import { FindPlayerOperationResponse } from "./../entity/response/FindPlayerOperationResponse";
|
|
29
|
+
import { SendChatToUserOperationResponse } from "./../entity/response/SendChatToUserOperationResponse";
|
|
30
|
+
import { GetChatMessageUserOperationResponse } from "./../entity/response/GetChatMessageUserOperationResponse";
|
|
31
|
+
import { SendChatToChannelOperationResponse } from "./../entity/response/SendChatToChannelOperationResponse";
|
|
32
|
+
import { JoinChatChannelOperationResponse } from "./../entity/response/JoinChatChannelOperationResponse";
|
|
33
|
+
import { LeaveChatChannelOperationResponse } from "./../entity/response/LeaveChatChannelOperationResponse";
|
|
34
|
+
import { GetChatInfoChannelOperationResponse } from "./../entity/response/GetChatInfoChannelOperationResponse";
|
|
35
|
+
import { GetChatMessageChannelOperationResponse } from "./../entity/response/GetChatMessageChannelOperationResponse";
|
|
36
|
+
import { GetChatMemberChannelOperationResponse } from "./../entity/response/GetChatMemberChannelOperationResponse";
|
|
37
|
+
import { EditChatInfoChannelOperationResponse } from "./../entity/response/EditChatInfoChannelOperationResponse";
|
|
38
|
+
import { EditChatMessageChannelOperationResponse } from "./../entity/response/EditChatMessageChannelOperationResponse";
|
|
39
|
+
import { EditChatMessageUserOperationResponse } from "./../entity/response/EditChatMessageUserOperationResponse";
|
|
21
40
|
export declare class NetworkingPeer {
|
|
22
41
|
static readonly SYNC_TS: string;
|
|
23
42
|
static readonly UPLOAD_FILE: string;
|
|
@@ -29,7 +48,14 @@ export declare class NetworkingPeer {
|
|
|
29
48
|
private httpPeer;
|
|
30
49
|
authToken: string;
|
|
31
50
|
userId: string;
|
|
51
|
+
friendItemLst: FriendItem[];
|
|
52
|
+
onFriendItemChange: Action1<FriendItem>;
|
|
53
|
+
chatChannelLst: ChatChannel[];
|
|
54
|
+
onChatChannelChange: Action1<ChatChannel>;
|
|
55
|
+
chatUserLst: ChatUser[];
|
|
56
|
+
onChatUserChange: Action1<ChatUser>;
|
|
32
57
|
getPing(): number;
|
|
58
|
+
getClientId(): string;
|
|
33
59
|
private update;
|
|
34
60
|
private service;
|
|
35
61
|
private lastCurrentServerMilliseconds;
|
|
@@ -42,6 +68,7 @@ export declare class NetworkingPeer {
|
|
|
42
68
|
sendRequestAuthSocket(): void;
|
|
43
69
|
connectSocket(_onSocketConnect: Action0): void;
|
|
44
70
|
disconnectSocket(_onSocketDisconnect: Action0): void;
|
|
71
|
+
setOnEventHandler(_onEventHandler: Action1<OperationEvent>): void;
|
|
45
72
|
setOnConnectHandler(_onConnectHandler: Action0): void;
|
|
46
73
|
setOnDisconnectHandler(_onDisconnectHandler: Action0): void;
|
|
47
74
|
removeOnConnectHandler(_onConnectHandler: Action0): void;
|
|
@@ -71,4 +98,19 @@ export declare class NetworkingPeer {
|
|
|
71
98
|
createNewFileUploadInfo(originFileName: string, onResponse?: Action1<CreateNewFileUploadInfoOperationResponse>): void;
|
|
72
99
|
getFileUploadInfo(fileId: string, onResponse?: Action1<GetFileUploadInfoOperationResponse>): void;
|
|
73
100
|
logout(onResponse?: Action1<LogoutOperationResponse>): void;
|
|
101
|
+
addFriend(friendId: string, forceAcceptFriend?: boolean, onResponse?: Action1<AddFriendOperationResponse>): void;
|
|
102
|
+
removeFriend(friendId: string, onResponse?: Action1<RemoveFriendOperationResponse>): void;
|
|
103
|
+
getFriends(onResponse?: Action1<GetFriendsOperationResponse>): void;
|
|
104
|
+
findPlayer(keyword: string, skip?: number, limit?: number, onResponse?: Action1<FindPlayerOperationResponse>): void;
|
|
105
|
+
sendChatToUser(userId: string, message: string, saveToDatabase?: boolean, onResponse?: Action1<SendChatToUserOperationResponse>): void;
|
|
106
|
+
getChatMessageUser(userId: string, skip?: number, limit?: number, onResponse?: Action1<GetChatMessageUserOperationResponse>): void;
|
|
107
|
+
sendChatToChannel(channel: string, message: string, onResponse?: Action1<SendChatToChannelOperationResponse>): void;
|
|
108
|
+
joinChatChannel(channel: string, onResponse?: Action1<JoinChatChannelOperationResponse>): void;
|
|
109
|
+
leaveChatChannel(channel: string, onResponse?: Action1<LeaveChatChannelOperationResponse>): void;
|
|
110
|
+
getChatInfoChannel(channel: string, onResponse?: Action1<GetChatInfoChannelOperationResponse>): void;
|
|
111
|
+
getChatMessageChannel(channel: string, skip?: number, limit?: number, onResponse?: Action1<GetChatMessageChannelOperationResponse>): void;
|
|
112
|
+
getChatMemberChannel(channel: string, onResponse?: Action1<GetChatMemberChannelOperationResponse>): void;
|
|
113
|
+
editChatInfoChannel(channel: string, name?: string, avatarChannel?: GNHashtable, onResponse?: Action1<EditChatInfoChannelOperationResponse>): void;
|
|
114
|
+
editChatMessageChannel(tsCreate: number, channel: string, message?: string, isDelete?: boolean, onResponse?: Action1<EditChatMessageChannelOperationResponse>): void;
|
|
115
|
+
editChatMessageUser(tsCreate: number, userId: string, message?: string, isDelete?: boolean, onResponse?: Action1<EditChatMessageUserOperationResponse>): void;
|
|
74
116
|
}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
+
import { Action1 } from "./../common/Action1";
|
|
1
2
|
import { Action0 } from "./../common/Action0";
|
|
2
3
|
import { GNArray } from "./../common/GNData";
|
|
4
|
+
import { OperationEvent } from "./../entity/OperationEvent";
|
|
3
5
|
import { IServerEventHandler } from "./handler/IServerEventHandler";
|
|
4
6
|
import { OperationPending } from "./OperationPending";
|
|
5
7
|
import { PeerBase } from "./PeerBase";
|
|
6
8
|
export declare class SocketPeer extends PeerBase {
|
|
7
|
-
private
|
|
9
|
+
private serverEventHandlersDic;
|
|
10
|
+
private _onEventHandler;
|
|
8
11
|
private networkingPeerBase;
|
|
9
12
|
getClientId(): string;
|
|
10
13
|
isConnected(): boolean;
|
|
@@ -18,6 +21,7 @@ export declare class SocketPeer extends PeerBase {
|
|
|
18
21
|
removeOnDisconnectHandler(_onDisconnectHandler: Action0): void;
|
|
19
22
|
connect(_onSocketConnect: Action0): void;
|
|
20
23
|
disconnect(_onSocketDisconnect: Action0): void;
|
|
24
|
+
setOnEventHandler(_onEventHandler: Action1<OperationEvent>): void;
|
|
21
25
|
send(operationPending: OperationPending): void;
|
|
22
26
|
onEventHandler(obj: GNArray, isEncrypted: boolean): void;
|
|
23
27
|
service(): void;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { OperationEvent } from "./../../entity/OperationEvent";
|
|
2
|
+
import { IServerEventHandler } from "./IServerEventHandler";
|
|
3
|
+
export declare class OnChannelChatEventHandler implements IServerEventHandler {
|
|
4
|
+
getEventCode(): number;
|
|
5
|
+
handle(operationEvent: OperationEvent): void;
|
|
6
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { OperationEvent } from "./../../entity/OperationEvent";
|
|
2
|
+
import { IServerEventHandler } from "./IServerEventHandler";
|
|
3
|
+
export declare class OnFriendUpdateEventHandler implements IServerEventHandler {
|
|
4
|
+
getEventCode(): number;
|
|
5
|
+
handle(operationEvent: OperationEvent): void;
|
|
6
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { OperationEvent } from "./../../entity/OperationEvent";
|
|
2
|
+
import { IServerEventHandler } from "./IServerEventHandler";
|
|
3
|
+
export declare class OnUserChatEventHandler implements IServerEventHandler {
|
|
4
|
+
getEventCode(): number;
|
|
5
|
+
handle(operationEvent: OperationEvent): void;
|
|
6
|
+
}
|
package/package.json
CHANGED
|
@@ -1,37 +1,39 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@xmobitea/gn-typescript-client",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "",
|
|
5
|
-
"types": "dist/index.d.ts",
|
|
6
|
-
"main": "dist/index.js",
|
|
7
|
-
"scripts": {
|
|
8
|
-
"debug": "node index.js",
|
|
9
|
-
"test": "mocha -r ts-node/register ./test/**/*.test.ts",
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"mocha": "^
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"webpack
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@xmobitea/gn-typescript-client",
|
|
3
|
+
"version": "1.0.9",
|
|
4
|
+
"description": "",
|
|
5
|
+
"types": "dist/index.d.ts",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"debug": "node index.js",
|
|
9
|
+
"test": "mocha -r ts-node/register ./test/**/*.test.ts",
|
|
10
|
+
"buildnode": "webpack --config webpack.config.js --mode production --display-modules",
|
|
11
|
+
"buildudm": "webpack --config webpack.config.udm.js --mode production --display-modules",
|
|
12
|
+
"build": "rm -rf ./dist && npm run buildnode && npm run buildudm",
|
|
13
|
+
"push": "npm run build && npm run test && npm publish && git push"
|
|
14
|
+
},
|
|
15
|
+
"author": "changx.develop@gmail.com (https://xmobitea.com)",
|
|
16
|
+
"license": "ISC",
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"@types/mocha": "^8.2.3",
|
|
19
|
+
"@types/store": "^2.0.2",
|
|
20
|
+
"mocha": "^9.2.2",
|
|
21
|
+
"terser-webpack-plugin": "^4.2.3",
|
|
22
|
+
"ts-loader": "^8.4.0",
|
|
23
|
+
"ts-node": "^10.9.1",
|
|
24
|
+
"tslib": "^2.4.1",
|
|
25
|
+
"webpack": "^5.75.0",
|
|
26
|
+
"webpack-cli": "^3.3.12",
|
|
27
|
+
"webpack-node-externals": "^3.0.0"
|
|
28
|
+
},
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@msgpack/msgpack": "^2.8.0",
|
|
31
|
+
"axios": "^1.2.2",
|
|
32
|
+
"reflect-metadata": "^0.1.13",
|
|
33
|
+
"socket.io-client": "^4.5.4",
|
|
34
|
+
"store": "^2.0.12"
|
|
35
|
+
},
|
|
36
|
+
"directories": {
|
|
37
|
+
"test": "test"
|
|
38
|
+
}
|
|
39
|
+
}
|