@xmobitea/gn-typescript-client 2.6.8 → 2.6.9-tsc
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 +198 -5
- package/dist/index.js +337 -34170
- package/dist/runtime/GNNetwork.js +250 -0
- package/dist/runtime/GNNetworkAuthenticateApi.js +122 -0
- package/dist/runtime/GNNetworkCharacterPlayerApi.js +968 -0
- package/dist/runtime/GNNetworkCloudScriptApi.js +104 -0
- package/dist/runtime/GNNetworkContentApi.js +140 -0
- package/dist/runtime/GNNetworkDashboardApi.js +170 -0
- package/dist/runtime/GNNetworkGamePlayerApi.js +950 -0
- package/dist/runtime/GNNetworkGroupApi.js +734 -0
- package/dist/runtime/GNNetworkInventoryApi.js +626 -0
- package/dist/runtime/GNNetworkMasterPlayerApi.js +1550 -0
- package/dist/runtime/GNNetworkMultiplayerApi.js +194 -0
- package/dist/runtime/GNNetworkStoreInventoryApi.js +266 -0
- package/dist/runtime/common/Action0.js +1 -0
- package/dist/runtime/common/Action1.js +1 -0
- package/dist/runtime/common/Action2.js +1 -0
- package/dist/runtime/common/Action3.js +1 -0
- package/dist/runtime/common/Action4.js +1 -0
- package/dist/runtime/common/GNData.js +211 -0
- package/dist/runtime/config/GNServerSettings.js +149 -0
- package/dist/runtime/constant/Commands.js +19 -0
- package/dist/runtime/constant/EventCode.js +8 -0
- package/dist/runtime/constant/OperationCode.js +221 -0
- package/dist/runtime/constant/ReturnCode.js +14 -0
- package/dist/runtime/constant/enumType/ExecuteResponseStatus.js +8 -0
- package/dist/runtime/constant/enumType/FriendStatus.js +7 -0
- package/dist/runtime/constant/enumType/GoogleLoginType.js +5 -0
- package/dist/runtime/constant/enumType/GroupStatus.js +7 -0
- package/dist/runtime/constant/enumType/InvalidMemberType.js +18 -0
- package/dist/runtime/constant/enumType/ItemType.js +5 -0
- package/dist/runtime/constant/enumType/MatchmakingMemberStatus.js +6 -0
- package/dist/runtime/constant/enumType/MatchmakingTicketStatus.js +8 -0
- package/dist/runtime/constant/enumType/OwnerType.js +9 -0
- package/dist/runtime/constant/enumType/PermissionDataItem.js +5 -0
- package/dist/runtime/constant/enumType/PushPlatformType.js +5 -0
- package/dist/runtime/constant/enumType/RequestRole.js +6 -0
- package/dist/runtime/constant/enumType/RequestType.js +15 -0
- package/dist/runtime/constant/enumType/StoreItemType.js +5 -0
- package/dist/runtime/constant/enumType/StoreReceiveType.js +8 -0
- package/dist/runtime/constant/errorCode/ErrorCode.js +52 -0
- package/dist/runtime/constant/parameterCode/ParameterCode.js +617 -0
- package/dist/runtime/entity/DataMember.js +208 -0
- package/dist/runtime/entity/GNMetadata.js +11 -0
- package/dist/runtime/entity/InvalidMember.js +1 -0
- package/dist/runtime/entity/OperationEvent.js +24 -0
- package/dist/runtime/entity/OperationHelper.js +24 -0
- package/dist/runtime/entity/OperationRequest.js +42 -0
- package/dist/runtime/entity/OperationResponse.js +73 -0
- package/dist/runtime/entity/models/AuthenticateModels.js +426 -0
- package/dist/runtime/entity/models/AuthenticateRequestModels.js +188 -0
- package/dist/runtime/entity/models/AuthenticateResponseModels.js +131 -0
- package/dist/runtime/entity/models/CharacterPlayerModels.d.ts +0 -1
- package/dist/runtime/entity/models/CharacterPlayerModels.js +1433 -0
- package/dist/runtime/entity/models/CharacterPlayerRequestModels.js +1386 -0
- package/dist/runtime/entity/models/CharacterPlayerResponseModels.js +376 -0
- package/dist/runtime/entity/models/CloudScriptModels.js +197 -0
- package/dist/runtime/entity/models/CloudScriptRequestModels.js +138 -0
- package/dist/runtime/entity/models/CloudScriptResponseModels.js +40 -0
- package/dist/runtime/entity/models/ContentModels.js +203 -0
- package/dist/runtime/entity/models/ContentRequestModels.js +190 -0
- package/dist/runtime/entity/models/ContentResponseModels.js +54 -0
- package/dist/runtime/entity/models/DashboardModels.d.ts +7 -7
- package/dist/runtime/entity/models/DashboardModels.js +3002 -0
- package/dist/runtime/entity/models/DashboardRequestModels.js +268 -0
- package/dist/runtime/entity/models/DashboardResponseModels.js +187 -0
- package/dist/runtime/entity/models/GamePlayerModels.js +1591 -0
- package/dist/runtime/entity/models/GamePlayerRequestModels.js +1360 -0
- package/dist/runtime/entity/models/GamePlayerResponseModels.js +369 -0
- package/dist/runtime/entity/models/GenericModels.js +177 -0
- package/dist/runtime/entity/models/GroupModels.d.ts +0 -1
- package/dist/runtime/entity/models/GroupModels.js +1135 -0
- package/dist/runtime/entity/models/GroupRequestModels.js +1048 -0
- package/dist/runtime/entity/models/GroupResponseModels.js +285 -0
- package/dist/runtime/entity/models/InventoryModels.js +915 -0
- package/dist/runtime/entity/models/InventoryRequestModels.js +892 -0
- package/dist/runtime/entity/models/InventoryResponseModels.js +243 -0
- package/dist/runtime/entity/models/MasterPlayerModels.js +2573 -0
- package/dist/runtime/entity/models/MasterPlayerRequestModels.js +2228 -0
- package/dist/runtime/entity/models/MasterPlayerResponseModels.js +607 -0
- package/dist/runtime/entity/models/MultiplayerModels.d.ts +1 -1
- package/dist/runtime/entity/models/MultiplayerModels.js +404 -0
- package/dist/runtime/entity/models/MultiplayerRequestModels.js +268 -0
- package/dist/runtime/entity/models/MultiplayerResponseModels.js +75 -0
- package/dist/runtime/entity/models/StoreInventoryModels.js +797 -0
- package/dist/runtime/entity/models/StoreInventoryRequestModels.js +372 -0
- package/dist/runtime/entity/models/StoreInventoryResponseModels.js +103 -0
- package/dist/runtime/entity/request/CustomOperationRequest.js +24 -0
- package/dist/runtime/entity/response/CustomOperationResponse.js +29 -0
- package/dist/runtime/entity/response/GetAuthInfoResponse.js +2 -0
- package/dist/runtime/entity/response/UploadFileResponse.js +2 -0
- package/dist/runtime/helper/CodeHelper.js +63 -0
- package/dist/runtime/helper/ConverterService.js +275 -0
- package/dist/runtime/helper/EnumUtility.js +33 -0
- package/dist/runtime/helper/GNSupport.js +8 -0
- package/dist/runtime/helper/GNUtils.js +72 -0
- package/dist/runtime/helper/MessagePackConverterService.js +9 -0
- package/dist/runtime/logger/GNDebug.js +29 -0
- package/dist/runtime/networking/AuthenticateStatus.js +14 -0
- package/dist/runtime/networking/IPeer.js +1 -0
- package/dist/runtime/networking/NetworkingPeer.js +178 -0
- package/dist/runtime/networking/OperationPending.js +53 -0
- package/dist/runtime/networking/PeerBase.js +161 -0
- package/dist/runtime/networking/handler/IServerEventHandler.js +13 -0
- package/dist/runtime/networking/handler/OnCharacterPlayerFriendUpdateEventHandler.js +39 -0
- package/dist/runtime/networking/handler/OnCharacterPlayerGroupUpdateEventHandler.js +39 -0
- package/dist/runtime/networking/handler/OnGamePlayerFriendUpdateEventHandler.js +39 -0
- package/dist/runtime/networking/handler/OnGamePlayerGroupUpdateEventHandler.js +39 -0
- package/dist/runtime/networking/handler/OnGroupMemberUpdateEventHandler.js +35 -0
- package/dist/runtime/networking/handler/OnGroupMessageUpdateEventHandler.js +43 -0
- package/dist/runtime/networking/http/HttpPeer.js +122 -0
- package/dist/runtime/networking/http/NetworkingHttpPeerBase.js +6 -0
- package/dist/runtime/networking/http/NetworkingPeerAxiosRequest.js +164 -0
- package/dist/runtime/networking/socket/NetworkingPeerSocketIOClient.js +130 -0
- package/dist/runtime/networking/socket/NetworkingSocketPeerBase.js +165 -0
- package/dist/runtime/networking/socket/SocketPeer.js +115 -0
- package/dist/runtime/typescript/ServiceUpdate.js +12 -0
- package/package.json +2 -2
- package/responseModel/chatgpt/Authenticate.json +724 -0
- package/responseModel/chatgpt/CharacterPlayer.json +1890 -0
- package/responseModel/chatgpt/CloudScript.json +254 -0
- package/responseModel/chatgpt/Content.json +273 -0
- package/responseModel/chatgpt/Dashboard.json +4110 -0
- package/responseModel/chatgpt/GamePlayer.json +2306 -0
- package/responseModel/chatgpt/Generic.json +253 -0
- package/responseModel/chatgpt/Group.json +1509 -0
- package/responseModel/chatgpt/Inventory.json +1211 -0
- package/responseModel/chatgpt/MasterPlayer.json +3801 -0
- package/responseModel/chatgpt/Multiplayer.json +634 -0
- package/responseModel/chatgpt/StoreInventory.json +1099 -0
- package/responseModel/clients/AuthenticateModels.json +271 -0
- package/responseModel/clients/CharacterPlayerModels.json +792 -0
- package/responseModel/clients/CloudScriptModels.json +191 -0
- package/responseModel/clients/ContentModels.json +178 -0
- package/responseModel/clients/DashboardModels.json +5423 -0
- package/responseModel/clients/GamePlayerModels.json +781 -0
- package/responseModel/clients/GenericModels.json +344 -0
- package/responseModel/clients/GroupModels.json +705 -0
- package/responseModel/clients/InventoryModels.json +568 -0
- package/responseModel/clients/MasterPlayerModels.json +1281 -0
- package/responseModel/clients/MultiplayerModels.json +439 -0
- package/responseModel/clients/StoreInventoryModels.json +971 -0
- package/responseModel/finalChatgpt/Authenticate.json +1475 -0
- package/responseModel/finalChatgpt/CharacterPlayer.json +4104 -0
- package/responseModel/finalChatgpt/CloudScript.json +515 -0
- package/responseModel/finalChatgpt/Content.json +536 -0
- package/responseModel/finalChatgpt/Dashboard.json +6712 -0
- package/responseModel/finalChatgpt/GamePlayer.json +5142 -0
- package/responseModel/finalChatgpt/Generic.json +333 -0
- package/responseModel/finalChatgpt/Group.json +3232 -0
- package/responseModel/finalChatgpt/Inventory.json +2606 -0
- package/responseModel/finalChatgpt/MasterPlayer.json +8385 -0
- package/responseModel/finalChatgpt/Multiplayer.json +1196 -0
- package/responseModel/finalChatgpt/StoreInventory.json +2085 -0
- package/responseModel/finals/Authenticate.json +1460 -0
- package/responseModel/finals/CharacterPlayer.json +3639 -0
- package/responseModel/finals/CloudScript.json +465 -0
- package/responseModel/finals/Content.json +479 -0
- package/responseModel/finals/Dashboard.json +6718 -0
- package/responseModel/finals/GamePlayer.json +4291 -0
- package/responseModel/finals/Generic.json +345 -0
- package/responseModel/finals/Group.json +2885 -0
- package/responseModel/finals/Inventory.json +2309 -0
- package/responseModel/finals/MasterPlayer.json +7018 -0
- package/responseModel/finals/Multiplayer.json +1082 -0
- package/responseModel/finals/StoreInventory.json +1979 -0
- package/responseModel/finalsShort/Authenticate.json +723 -0
- package/responseModel/finalsShort/CharacterPlayer.json +1889 -0
- package/responseModel/finalsShort/CloudScript.json +253 -0
- package/responseModel/finalsShort/Content.json +272 -0
- package/responseModel/finalsShort/Dashboard.json +4109 -0
- package/responseModel/finalsShort/GamePlayer.json +2305 -0
- package/responseModel/finalsShort/Generic.json +252 -0
- package/responseModel/finalsShort/Group.json +1508 -0
- package/responseModel/finalsShort/Inventory.json +1210 -0
- package/responseModel/finalsShort/MasterPlayer.json +3800 -0
- package/responseModel/finalsShort/Multiplayer.json +633 -0
- package/responseModel/finalsShort/StoreInventory.json +1098 -0
- package/responseModel/operationResponse/AuthenticateResponseModels.json +77 -0
- package/responseModel/operationResponse/CharacterPlayerResponseModels.json +217 -0
- package/responseModel/operationResponse/CloudScriptResponseModels.json +25 -0
- package/responseModel/operationResponse/ContentResponseModels.json +33 -0
- package/responseModel/operationResponse/DashboardResponseModels.json +109 -0
- package/responseModel/operationResponse/GamePlayerResponseModels.json +213 -0
- package/responseModel/operationResponse/GroupResponseModels.json +165 -0
- package/responseModel/operationResponse/InventoryResponseModels.json +141 -0
- package/responseModel/operationResponse/MasterPlayerResponseModels.json +349 -0
- package/responseModel/operationResponse/MultiplayerResponseModels.json +45 -0
- package/responseModel/operationResponse/StoreInventoryResponseModels.json +61 -0
- package/responseModel/servers/Authenticate.json +1328 -0
- package/responseModel/servers/CharacterPlayer.json +3199 -0
- package/responseModel/servers/CloudScript.json +278 -0
- package/responseModel/servers/Content.json +324 -0
- package/responseModel/servers/GamePlayer.json +3844 -0
- package/responseModel/servers/Group.json +2454 -0
- package/responseModel/servers/Inventory.json +1964 -0
- package/responseModel/servers/MasterAdmin.json +5569 -0
- package/responseModel/servers/MasterPlayer.json +5924 -0
- package/responseModel/servers/Multiplayer.json +545 -0
- package/responseModel/servers/StoreInventory.json +1290 -0
- package/dist/gearn.js.client.js +0 -46892
- package/dist/gearn.js.client.min.js +0 -2
- package/dist/gearn.js.client.min.js.LICENSE.txt +0 -14
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import "reflect-metadata";
|
|
2
|
+
import { FieldDataType } from "./GNMetadata";
|
|
3
|
+
// Thanks special for athongintel @clairejs/core
|
|
4
|
+
//@internal
|
|
5
|
+
export const GN_METADATA = "__GN_METADATA__";
|
|
6
|
+
const getGNReflectedDataType = (prototype, propertyKey) => {
|
|
7
|
+
let t = Reflect.getMetadata("design:type", prototype, propertyKey);
|
|
8
|
+
if (!t) {
|
|
9
|
+
throw Error(`Cannot get gn reflected data type for ${prototype.constructor.name}:${propertyKey}`);
|
|
10
|
+
}
|
|
11
|
+
switch (t.name) {
|
|
12
|
+
case "Boolean":
|
|
13
|
+
return FieldDataType.Boolean;
|
|
14
|
+
case "Number":
|
|
15
|
+
return FieldDataType.Number;
|
|
16
|
+
case "String":
|
|
17
|
+
return FieldDataType.String;
|
|
18
|
+
case "Array":
|
|
19
|
+
return FieldDataType.Array;
|
|
20
|
+
default:
|
|
21
|
+
return FieldDataType.Object;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
const getGNReflectedMetadata = (prototype, propertyKey) => {
|
|
25
|
+
let t = Reflect.getMetadata("design:type", prototype, propertyKey);
|
|
26
|
+
if (!t) {
|
|
27
|
+
throw Error(`Cannot get gn reflected data type for ${prototype.constructor.name}:${propertyKey}`);
|
|
28
|
+
}
|
|
29
|
+
let answer = {
|
|
30
|
+
fieldDataType: null,
|
|
31
|
+
prototype: t.prototype
|
|
32
|
+
};
|
|
33
|
+
if (t.name == "Boolean")
|
|
34
|
+
answer.fieldDataType = FieldDataType.Boolean;
|
|
35
|
+
else if (t.name == "Number")
|
|
36
|
+
answer.fieldDataType = FieldDataType.Number;
|
|
37
|
+
else if (t.name == "String")
|
|
38
|
+
answer.fieldDataType = FieldDataType.String;
|
|
39
|
+
else if (t.name == "Array")
|
|
40
|
+
answer.fieldDataType = FieldDataType.Array;
|
|
41
|
+
else
|
|
42
|
+
answer.fieldDataType = FieldDataType.Object;
|
|
43
|
+
return answer;
|
|
44
|
+
};
|
|
45
|
+
export const initGNObjectMetadata = (prototype) => {
|
|
46
|
+
if (prototype === Object.prototype) {
|
|
47
|
+
return {};
|
|
48
|
+
}
|
|
49
|
+
if (!prototype.hasOwnProperty(GN_METADATA)) {
|
|
50
|
+
const superPrototype = initGNObjectMetadata(Object.getPrototypeOf(prototype));
|
|
51
|
+
prototype[GN_METADATA] = Object.assign(Object.assign({}, superPrototype), { id: getTableName(prototype.constructor), fields: superPrototype.fields ? superPrototype.fields.map((f) => (Object.assign({}, f))) : [] });
|
|
52
|
+
}
|
|
53
|
+
return prototype[GN_METADATA];
|
|
54
|
+
};
|
|
55
|
+
export const initGNObjectFieldMetadata = (prototype, propertyKey) => {
|
|
56
|
+
let meta = initGNObjectMetadata(prototype);
|
|
57
|
+
let fieldIndex = meta.fields.findIndex((f) => f.name === propertyKey);
|
|
58
|
+
if (fieldIndex < 0) {
|
|
59
|
+
let gnReflectedMetadata = getGNReflectedMetadata(prototype, propertyKey);
|
|
60
|
+
const field = {
|
|
61
|
+
name: propertyKey,
|
|
62
|
+
// fieldType: getGNReflectedDataType(prototype, propertyKey),
|
|
63
|
+
fieldType: gnReflectedMetadata.fieldDataType,
|
|
64
|
+
cls: gnReflectedMetadata.prototype.constructor
|
|
65
|
+
};
|
|
66
|
+
meta.fields.push(field);
|
|
67
|
+
return field;
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
//-- shadow clone the field
|
|
71
|
+
const field = Object.assign({}, meta.fields[fieldIndex]);
|
|
72
|
+
meta.fields[fieldIndex] = field;
|
|
73
|
+
return field;
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
export const getGNObjectMetadata = (obj) => {
|
|
77
|
+
return obj.prototype[GN_METADATA];
|
|
78
|
+
};
|
|
79
|
+
export const setGNObjectMetadata = (obj, metadata) => {
|
|
80
|
+
obj.prototype[GN_METADATA] = metadata;
|
|
81
|
+
};
|
|
82
|
+
export const getTableName = (model) => model === null || model === void 0 ? void 0 : model.name.toLowerCase();
|
|
83
|
+
;
|
|
84
|
+
export var GNFieldDataType;
|
|
85
|
+
(function (GNFieldDataType) {
|
|
86
|
+
GNFieldDataType[GNFieldDataType["Other"] = 0] = "Other";
|
|
87
|
+
GNFieldDataType[GNFieldDataType["Number"] = 1] = "Number";
|
|
88
|
+
GNFieldDataType[GNFieldDataType["String"] = 2] = "String";
|
|
89
|
+
GNFieldDataType[GNFieldDataType["Boolean"] = 3] = "Boolean";
|
|
90
|
+
GNFieldDataType[GNFieldDataType["GNHashtable"] = 4] = "GNHashtable";
|
|
91
|
+
GNFieldDataType[GNFieldDataType["GNArray"] = 5] = "GNArray";
|
|
92
|
+
})(GNFieldDataType || (GNFieldDataType = {}));
|
|
93
|
+
;
|
|
94
|
+
;
|
|
95
|
+
;
|
|
96
|
+
;
|
|
97
|
+
;
|
|
98
|
+
;
|
|
99
|
+
;
|
|
100
|
+
;
|
|
101
|
+
;
|
|
102
|
+
;
|
|
103
|
+
export const DataMember = (args) => (prototype, propertyKey) => {
|
|
104
|
+
let field = initGNObjectFieldMetadata(prototype, propertyKey);
|
|
105
|
+
field.code = args.code;
|
|
106
|
+
field.isOptional = args.isOptional == null ? false : args.isOptional;
|
|
107
|
+
field.defaultValue = args.defaultValue;
|
|
108
|
+
field.gnFieldType = args.gnFieldType == null ? GNFieldDataType.Other : args.gnFieldType;
|
|
109
|
+
field.activeConditionValid = false;
|
|
110
|
+
};
|
|
111
|
+
export const StringDataMember = (args) => (prototype, propertyKey) => {
|
|
112
|
+
let field = initGNObjectFieldMetadata(prototype, propertyKey);
|
|
113
|
+
field.code = args.code;
|
|
114
|
+
field.isOptional = args.isOptional == null ? false : args.isOptional;
|
|
115
|
+
field.defaultValue = args.defaultValue;
|
|
116
|
+
field.gnFieldType = GNFieldDataType.String;
|
|
117
|
+
if (args.mustNonNull != null || args.minLength != null || args.maxLength != null) {
|
|
118
|
+
field.activeConditionValid = true;
|
|
119
|
+
if (args.mustNonNull == null) {
|
|
120
|
+
args.mustNonNull = false;
|
|
121
|
+
}
|
|
122
|
+
if (args.minLength == null) {
|
|
123
|
+
args.minLength = 0;
|
|
124
|
+
}
|
|
125
|
+
if (args.maxLength == null) {
|
|
126
|
+
args.maxLength = 256;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
field.mustNonNull = args.mustNonNull;
|
|
130
|
+
field.minLength = args.minLength;
|
|
131
|
+
field.maxLength = args.maxLength;
|
|
132
|
+
};
|
|
133
|
+
export const BooleanDataMember = (args) => (prototype, propertyKey) => {
|
|
134
|
+
let field = initGNObjectFieldMetadata(prototype, propertyKey);
|
|
135
|
+
field.code = args.code;
|
|
136
|
+
field.isOptional = args.isOptional == null ? false : args.isOptional;
|
|
137
|
+
field.defaultValue = args.defaultValue;
|
|
138
|
+
field.gnFieldType = GNFieldDataType.Boolean;
|
|
139
|
+
field.activeConditionValid = false;
|
|
140
|
+
};
|
|
141
|
+
export const GNHashtableDataMember = (args) => (prototype, propertyKey) => {
|
|
142
|
+
let field = initGNObjectFieldMetadata(prototype, propertyKey);
|
|
143
|
+
field.code = args.code;
|
|
144
|
+
field.isOptional = args.isOptional == null ? false : args.isOptional;
|
|
145
|
+
field.defaultValue = args.defaultValue;
|
|
146
|
+
field.gnFieldType = GNFieldDataType.GNHashtable;
|
|
147
|
+
if (args.mustNonNull != null || args.minLength != null || args.maxLength != null) {
|
|
148
|
+
field.activeConditionValid = true;
|
|
149
|
+
if (args.mustNonNull == null) {
|
|
150
|
+
args.mustNonNull = false;
|
|
151
|
+
}
|
|
152
|
+
if (args.minLength == null) {
|
|
153
|
+
args.minLength = 0;
|
|
154
|
+
}
|
|
155
|
+
if (args.maxLength == null) {
|
|
156
|
+
args.maxLength = 256;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
field.mustNonNull = args.mustNonNull;
|
|
160
|
+
field.minLength = args.minLength;
|
|
161
|
+
field.maxLength = args.maxLength;
|
|
162
|
+
};
|
|
163
|
+
export const GNArrayDataMember = (args) => (prototype, propertyKey) => {
|
|
164
|
+
let field = initGNObjectFieldMetadata(prototype, propertyKey);
|
|
165
|
+
if (args.elementCls != null)
|
|
166
|
+
field.cls = args.elementCls;
|
|
167
|
+
field.code = args.code;
|
|
168
|
+
field.isOptional = args.isOptional == null ? false : args.isOptional;
|
|
169
|
+
field.defaultValue = args.defaultValue;
|
|
170
|
+
field.gnFieldType = GNFieldDataType.GNArray;
|
|
171
|
+
if (args.mustNonNull != null || args.minLength != null || args.maxLength != null) {
|
|
172
|
+
field.activeConditionValid = true;
|
|
173
|
+
if (args.mustNonNull == null) {
|
|
174
|
+
args.mustNonNull = false;
|
|
175
|
+
}
|
|
176
|
+
if (args.minLength == null) {
|
|
177
|
+
args.minLength = 0;
|
|
178
|
+
}
|
|
179
|
+
if (args.maxLength == null) {
|
|
180
|
+
args.maxLength = 256;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
field.mustNonNull = args.mustNonNull;
|
|
184
|
+
field.minLength = args.minLength;
|
|
185
|
+
field.maxLength = args.maxLength;
|
|
186
|
+
};
|
|
187
|
+
export const NumberDataMember = (args) => (prototype, propertyKey) => {
|
|
188
|
+
let field = initGNObjectFieldMetadata(prototype, propertyKey);
|
|
189
|
+
field.code = args.code;
|
|
190
|
+
field.isOptional = args.isOptional == null ? false : args.isOptional;
|
|
191
|
+
field.defaultValue = args.defaultValue;
|
|
192
|
+
field.gnFieldType = GNFieldDataType.Number;
|
|
193
|
+
if (args.mustInt != null || args.minValue != null || args.maxValue != null) {
|
|
194
|
+
field.activeConditionValid = true;
|
|
195
|
+
if (args.mustInt == null) {
|
|
196
|
+
args.mustInt = false;
|
|
197
|
+
}
|
|
198
|
+
if (args.minValue == null) {
|
|
199
|
+
args.minValue = -Infinity;
|
|
200
|
+
}
|
|
201
|
+
if (args.maxValue == null) {
|
|
202
|
+
args.maxValue = Infinity;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
field.minValue = args.minValue;
|
|
206
|
+
field.maxValue = args.maxValue;
|
|
207
|
+
field.mustInt = args.mustInt;
|
|
208
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export var FieldDataType;
|
|
2
|
+
(function (FieldDataType) {
|
|
3
|
+
FieldDataType[FieldDataType["Boolean"] = 0] = "Boolean";
|
|
4
|
+
FieldDataType[FieldDataType["Number"] = 1] = "Number";
|
|
5
|
+
FieldDataType[FieldDataType["String"] = 2] = "String";
|
|
6
|
+
FieldDataType[FieldDataType["Array"] = 3] = "Array";
|
|
7
|
+
FieldDataType[FieldDataType["Object"] = 4] = "Object";
|
|
8
|
+
})(FieldDataType || (FieldDataType = {}));
|
|
9
|
+
;
|
|
10
|
+
;
|
|
11
|
+
;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export class OperationEvent {
|
|
2
|
+
constructor(eventCode, parameters = null) {
|
|
3
|
+
this.eventCode = eventCode;
|
|
4
|
+
this.parameters = parameters;
|
|
5
|
+
}
|
|
6
|
+
getEventCode() {
|
|
7
|
+
return this.eventCode;
|
|
8
|
+
}
|
|
9
|
+
getParameters() {
|
|
10
|
+
return this.parameters;
|
|
11
|
+
}
|
|
12
|
+
setParameter(k, value) {
|
|
13
|
+
this.parameters.add(k, value);
|
|
14
|
+
return this;
|
|
15
|
+
}
|
|
16
|
+
setParameters(parameters) {
|
|
17
|
+
this.parameters = parameters;
|
|
18
|
+
return this;
|
|
19
|
+
}
|
|
20
|
+
toString() {
|
|
21
|
+
var _a;
|
|
22
|
+
return "EventCode: " + this.eventCode + ", parameters " + JSON.stringify((_a = this.parameters) === null || _a === void 0 ? void 0 : _a.toData());
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { CodeHelper } from "./../helper/CodeHelper";
|
|
2
|
+
export class OperationHelper {
|
|
3
|
+
static toSocketData(requestType, role, request) {
|
|
4
|
+
let requestId = request.getRequestId();
|
|
5
|
+
if (requestId == -1)
|
|
6
|
+
return [
|
|
7
|
+
CodeHelper.getRequestTypeName(requestType),
|
|
8
|
+
CodeHelper.getRequestRoleName(role),
|
|
9
|
+
request.getOperationCode(),
|
|
10
|
+
(request.getParameters() == null) ? null : request.getParameters().toData()
|
|
11
|
+
];
|
|
12
|
+
else
|
|
13
|
+
return [
|
|
14
|
+
CodeHelper.getRequestTypeName(requestType),
|
|
15
|
+
CodeHelper.getRequestRoleName(role),
|
|
16
|
+
request.getOperationCode(),
|
|
17
|
+
(request.getParameters() == null) ? null : request.getParameters().toData(),
|
|
18
|
+
requestId
|
|
19
|
+
];
|
|
20
|
+
}
|
|
21
|
+
static toHttpData(requestType, role, request) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { GNHashtable } from "./../common/GNData";
|
|
2
|
+
export class OperationRequest {
|
|
3
|
+
constructor(operationCode, timeout = OperationRequest.defaultTimeOut) {
|
|
4
|
+
this.operationCode = operationCode;
|
|
5
|
+
this.timeout = timeout;
|
|
6
|
+
}
|
|
7
|
+
getOperationCode() {
|
|
8
|
+
return this.operationCode;
|
|
9
|
+
}
|
|
10
|
+
getRequestId() {
|
|
11
|
+
return this.requestId;
|
|
12
|
+
}
|
|
13
|
+
getParameters() {
|
|
14
|
+
return this.parameters;
|
|
15
|
+
}
|
|
16
|
+
getTimeout() {
|
|
17
|
+
return this.timeout;
|
|
18
|
+
}
|
|
19
|
+
setRequestId(requestId) {
|
|
20
|
+
this.requestId = requestId;
|
|
21
|
+
return this;
|
|
22
|
+
}
|
|
23
|
+
setParameter(key, value) {
|
|
24
|
+
if (this.parameters == null)
|
|
25
|
+
this.parameters = new GNHashtable();
|
|
26
|
+
this.parameters.add(key, value);
|
|
27
|
+
return this;
|
|
28
|
+
}
|
|
29
|
+
setParameters(parameters) {
|
|
30
|
+
this.parameters = parameters;
|
|
31
|
+
return this;
|
|
32
|
+
}
|
|
33
|
+
setTimeout(timeout) {
|
|
34
|
+
this.timeout = timeout;
|
|
35
|
+
return this;
|
|
36
|
+
}
|
|
37
|
+
toString() {
|
|
38
|
+
var _a;
|
|
39
|
+
return "OperationCode: " + this.operationCode + ", requestId: " + this.requestId + ", parameters " + JSON.stringify((_a = this.parameters) === null || _a === void 0 ? void 0 : _a.toData());
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
OperationRequest.defaultTimeOut = 20;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { CodeHelper } from "./../helper/CodeHelper";
|
|
2
|
+
import { GNHashtable } from "./../common/GNData";
|
|
3
|
+
import { ReturnCode } from "./../constant/ReturnCode";
|
|
4
|
+
export class OperationResponse {
|
|
5
|
+
constructor(operationCode, responseId) {
|
|
6
|
+
this.operationCode = operationCode;
|
|
7
|
+
this.responseId = responseId;
|
|
8
|
+
this.parameters = new GNHashtable();
|
|
9
|
+
this.debugMessage = null;
|
|
10
|
+
}
|
|
11
|
+
getOperationCode() {
|
|
12
|
+
return this.operationCode;
|
|
13
|
+
}
|
|
14
|
+
getReturnCode() {
|
|
15
|
+
return this.returnCode;
|
|
16
|
+
}
|
|
17
|
+
getParameters() {
|
|
18
|
+
return this.parameters;
|
|
19
|
+
}
|
|
20
|
+
getResponseId() {
|
|
21
|
+
return this.responseId;
|
|
22
|
+
}
|
|
23
|
+
getDebugMessage() {
|
|
24
|
+
return this.debugMessage;
|
|
25
|
+
}
|
|
26
|
+
getInvalidMembers() {
|
|
27
|
+
return this.invalidMembers;
|
|
28
|
+
}
|
|
29
|
+
hasError() {
|
|
30
|
+
return this.getReturnCode() != ReturnCode.Ok;
|
|
31
|
+
}
|
|
32
|
+
setReturnCode(returnCode) {
|
|
33
|
+
this.returnCode = returnCode;
|
|
34
|
+
return this;
|
|
35
|
+
}
|
|
36
|
+
setDebugMessage(debugMessage) {
|
|
37
|
+
this.debugMessage = debugMessage;
|
|
38
|
+
return this;
|
|
39
|
+
}
|
|
40
|
+
setParameter(k, value) {
|
|
41
|
+
this.parameters.add(k, value);
|
|
42
|
+
return this;
|
|
43
|
+
}
|
|
44
|
+
setParameters(parameters) {
|
|
45
|
+
this.parameters = parameters;
|
|
46
|
+
return this;
|
|
47
|
+
}
|
|
48
|
+
setInvalidMembers(invalidMembers) {
|
|
49
|
+
this.invalidMembers = invalidMembers;
|
|
50
|
+
return this;
|
|
51
|
+
}
|
|
52
|
+
toString() {
|
|
53
|
+
var _a;
|
|
54
|
+
let stringBuilder = "";
|
|
55
|
+
stringBuilder += "OperationCode: " + this.operationCode + ", responseId: " + this.responseId + ", returnCode " + CodeHelper.getReturnCodeName(this.returnCode);
|
|
56
|
+
if (this.returnCode == ReturnCode.Ok)
|
|
57
|
+
stringBuilder += ", parameters " + JSON.stringify((_a = this.parameters) === null || _a === void 0 ? void 0 : _a.toData());
|
|
58
|
+
else if (this.returnCode == ReturnCode.InvalidRequestParameters) {
|
|
59
|
+
if (this.invalidMembers != null) {
|
|
60
|
+
let invalidStr = "";
|
|
61
|
+
this.invalidMembers.forEach(invalidMember => {
|
|
62
|
+
invalidStr += invalidMember;
|
|
63
|
+
});
|
|
64
|
+
stringBuilder += ", invalidMembers " + invalidStr;
|
|
65
|
+
}
|
|
66
|
+
else
|
|
67
|
+
stringBuilder += ", invalidMembers " + this.invalidMembers;
|
|
68
|
+
}
|
|
69
|
+
else
|
|
70
|
+
stringBuilder += ", debugMessage " + this.debugMessage;
|
|
71
|
+
return stringBuilder;
|
|
72
|
+
}
|
|
73
|
+
}
|