@xmobitea/gn-typescript-client 2.6.12-tsc → 2.6.12
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/README.MD +1 -0
- package/dist/gearn.js.client.js +47228 -0
- package/dist/gearn.js.client.min.js +2 -0
- package/dist/gearn.js.client.min.js.LICENSE.txt +14 -0
- package/dist/index.js +34236 -339
- package/package.json +9 -9
- package/dist/runtime/GNNetwork.js +0 -260
- package/dist/runtime/GNNetworkAuthenticateApi.js +0 -122
- package/dist/runtime/GNNetworkCharacterPlayerApi.js +0 -968
- package/dist/runtime/GNNetworkCloudScriptApi.js +0 -104
- package/dist/runtime/GNNetworkContentApi.js +0 -140
- package/dist/runtime/GNNetworkDashboardApi.js +0 -170
- package/dist/runtime/GNNetworkGamePlayerApi.js +0 -950
- package/dist/runtime/GNNetworkGroupApi.js +0 -734
- package/dist/runtime/GNNetworkInventoryApi.js +0 -626
- package/dist/runtime/GNNetworkMasterPlayerApi.js +0 -1550
- package/dist/runtime/GNNetworkMultiplayerApi.js +0 -194
- package/dist/runtime/GNNetworkStoreInventoryApi.js +0 -266
- package/dist/runtime/common/Action0.js +0 -1
- package/dist/runtime/common/Action1.js +0 -1
- package/dist/runtime/common/Action2.js +0 -1
- package/dist/runtime/common/Action3.js +0 -1
- package/dist/runtime/common/Action4.js +0 -1
- package/dist/runtime/common/GNData.js +0 -211
- package/dist/runtime/config/GNServerSettings.js +0 -156
- package/dist/runtime/constant/Commands.js +0 -20
- package/dist/runtime/constant/EventCode.js +0 -8
- package/dist/runtime/constant/OperationCode.js +0 -221
- package/dist/runtime/constant/ReturnCode.js +0 -14
- package/dist/runtime/constant/enumType/ExecuteResponseStatus.js +0 -8
- package/dist/runtime/constant/enumType/FriendStatus.js +0 -7
- package/dist/runtime/constant/enumType/GoogleLoginType.js +0 -5
- package/dist/runtime/constant/enumType/GroupStatus.js +0 -7
- package/dist/runtime/constant/enumType/InvalidMemberType.js +0 -18
- package/dist/runtime/constant/enumType/ItemType.js +0 -5
- package/dist/runtime/constant/enumType/MatchmakingMemberStatus.js +0 -6
- package/dist/runtime/constant/enumType/MatchmakingTicketStatus.js +0 -8
- package/dist/runtime/constant/enumType/OwnerType.js +0 -9
- package/dist/runtime/constant/enumType/PermissionDataItem.js +0 -5
- package/dist/runtime/constant/enumType/PushPlatformType.js +0 -5
- package/dist/runtime/constant/enumType/RequestRole.js +0 -6
- package/dist/runtime/constant/enumType/RequestType.js +0 -15
- package/dist/runtime/constant/enumType/StoreItemType.js +0 -5
- package/dist/runtime/constant/enumType/StoreReceiveType.js +0 -8
- package/dist/runtime/constant/errorCode/ErrorCode.js +0 -52
- package/dist/runtime/constant/parameterCode/ParameterCode.js +0 -617
- package/dist/runtime/entity/DataMember.js +0 -208
- package/dist/runtime/entity/GNMetadata.js +0 -11
- package/dist/runtime/entity/InvalidMember.js +0 -1
- package/dist/runtime/entity/OperationEvent.js +0 -24
- package/dist/runtime/entity/OperationHelper.js +0 -24
- package/dist/runtime/entity/OperationRequest.js +0 -42
- package/dist/runtime/entity/OperationResponse.js +0 -73
- package/dist/runtime/entity/models/AuthenticateModels.js +0 -426
- package/dist/runtime/entity/models/AuthenticateRequestModels.js +0 -188
- package/dist/runtime/entity/models/AuthenticateResponseModels.js +0 -131
- package/dist/runtime/entity/models/CharacterPlayerModels.js +0 -1433
- package/dist/runtime/entity/models/CharacterPlayerRequestModels.js +0 -1386
- package/dist/runtime/entity/models/CharacterPlayerResponseModels.js +0 -376
- package/dist/runtime/entity/models/CloudScriptModels.js +0 -197
- package/dist/runtime/entity/models/CloudScriptRequestModels.js +0 -138
- package/dist/runtime/entity/models/CloudScriptResponseModels.js +0 -40
- package/dist/runtime/entity/models/ContentModels.js +0 -203
- package/dist/runtime/entity/models/ContentRequestModels.js +0 -190
- package/dist/runtime/entity/models/ContentResponseModels.js +0 -54
- package/dist/runtime/entity/models/DashboardModels.js +0 -3002
- package/dist/runtime/entity/models/DashboardRequestModels.js +0 -268
- package/dist/runtime/entity/models/DashboardResponseModels.js +0 -187
- package/dist/runtime/entity/models/GamePlayerModels.js +0 -1591
- package/dist/runtime/entity/models/GamePlayerRequestModels.js +0 -1360
- package/dist/runtime/entity/models/GamePlayerResponseModels.js +0 -369
- package/dist/runtime/entity/models/GenericModels.js +0 -177
- package/dist/runtime/entity/models/GroupModels.js +0 -1135
- package/dist/runtime/entity/models/GroupRequestModels.js +0 -1048
- package/dist/runtime/entity/models/GroupResponseModels.js +0 -285
- package/dist/runtime/entity/models/InventoryModels.js +0 -915
- package/dist/runtime/entity/models/InventoryRequestModels.js +0 -892
- package/dist/runtime/entity/models/InventoryResponseModels.js +0 -243
- package/dist/runtime/entity/models/MasterPlayerModels.js +0 -2573
- package/dist/runtime/entity/models/MasterPlayerRequestModels.js +0 -2228
- package/dist/runtime/entity/models/MasterPlayerResponseModels.js +0 -607
- package/dist/runtime/entity/models/MultiplayerModels.js +0 -404
- package/dist/runtime/entity/models/MultiplayerRequestModels.js +0 -268
- package/dist/runtime/entity/models/MultiplayerResponseModels.js +0 -75
- package/dist/runtime/entity/models/StoreInventoryModels.js +0 -797
- package/dist/runtime/entity/models/StoreInventoryRequestModels.js +0 -372
- package/dist/runtime/entity/models/StoreInventoryResponseModels.js +0 -103
- package/dist/runtime/entity/request/CustomOperationRequest.js +0 -24
- package/dist/runtime/entity/response/CustomOperationResponse.js +0 -29
- package/dist/runtime/entity/response/GetAuthInfoResponse.js +0 -2
- package/dist/runtime/entity/response/HealthCheckResponse.js +0 -2
- package/dist/runtime/entity/response/UploadFileResponse.js +0 -2
- package/dist/runtime/helper/CodeHelper.js +0 -63
- package/dist/runtime/helper/ConverterService.js +0 -275
- package/dist/runtime/helper/EnumUtility.js +0 -33
- package/dist/runtime/helper/GNSupport.js +0 -8
- package/dist/runtime/helper/GNUtils.js +0 -72
- package/dist/runtime/helper/MessagePackConverterService.js +0 -9
- package/dist/runtime/logger/GNDebug.js +0 -29
- package/dist/runtime/networking/AuthenticateStatus.js +0 -14
- package/dist/runtime/networking/IPeer.js +0 -1
- package/dist/runtime/networking/NetworkingPeer.js +0 -208
- package/dist/runtime/networking/OperationPending.js +0 -53
- package/dist/runtime/networking/PeerBase.js +0 -161
- package/dist/runtime/networking/handler/IServerEventHandler.js +0 -13
- package/dist/runtime/networking/handler/OnCharacterPlayerFriendUpdateEventHandler.js +0 -39
- package/dist/runtime/networking/handler/OnCharacterPlayerGroupUpdateEventHandler.js +0 -39
- package/dist/runtime/networking/handler/OnGamePlayerFriendUpdateEventHandler.js +0 -39
- package/dist/runtime/networking/handler/OnGamePlayerGroupUpdateEventHandler.js +0 -39
- package/dist/runtime/networking/handler/OnGroupMemberUpdateEventHandler.js +0 -35
- package/dist/runtime/networking/handler/OnGroupMessageUpdateEventHandler.js +0 -43
- package/dist/runtime/networking/http/HttpPeer.js +0 -123
- package/dist/runtime/networking/http/NetworkingHttpPeerBase.js +0 -9
- package/dist/runtime/networking/http/NetworkingPeerAxiosRequest.js +0 -179
- package/dist/runtime/networking/socket/NetworkingPeerSocketIOClient.js +0 -130
- package/dist/runtime/networking/socket/NetworkingSocketPeerBase.js +0 -165
- package/dist/runtime/networking/socket/SocketPeer.js +0 -115
- package/dist/runtime/typescript/ServiceUpdate.js +0 -12
|
@@ -1,208 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
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
|
-
;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,24 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
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;
|
|
@@ -1,73 +0,0 @@
|
|
|
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
|
-
}
|