@xmobitea/gn-typescript-client 2.3.0-esnext → 2.3.0

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.
Files changed (108) hide show
  1. package/dist/gn.js.client.js +47638 -0
  2. package/dist/gn.js.client.min.js +2 -0
  3. package/dist/gn.js.client.min.js.LICENSE.txt +14 -0
  4. package/dist/index.js +34927 -314
  5. package/package.json +2 -2
  6. package/dist/runtime/GNNetwork.js +0 -238
  7. package/dist/runtime/GNNetworkAuthenticateApi.js +0 -167
  8. package/dist/runtime/GNNetworkCharacterPlayerApi.js +0 -1271
  9. package/dist/runtime/GNNetworkCloudScriptApi.js +0 -143
  10. package/dist/runtime/GNNetworkContentApi.js +0 -191
  11. package/dist/runtime/GNNetworkDashboardApi.js +0 -223
  12. package/dist/runtime/GNNetworkGamePlayerApi.js +0 -1271
  13. package/dist/runtime/GNNetworkGroupApi.js +0 -983
  14. package/dist/runtime/GNNetworkInventoryApi.js +0 -839
  15. package/dist/runtime/GNNetworkMasterPlayerApi.js +0 -1927
  16. package/dist/runtime/GNNetworkMultiplayerApi.js +0 -263
  17. package/dist/runtime/GNNetworkStoreInventoryApi.js +0 -311
  18. package/dist/runtime/common/Action0.js +0 -1
  19. package/dist/runtime/common/Action1.js +0 -1
  20. package/dist/runtime/common/Action2.js +0 -1
  21. package/dist/runtime/common/Action3.js +0 -1
  22. package/dist/runtime/common/Action4.js +0 -1
  23. package/dist/runtime/common/GNData.js +0 -211
  24. package/dist/runtime/config/GNServerSettings.js +0 -127
  25. package/dist/runtime/constant/Commands.js +0 -19
  26. package/dist/runtime/constant/EventCode.js +0 -8
  27. package/dist/runtime/constant/OperationCode.js +0 -214
  28. package/dist/runtime/constant/ReturnCode.js +0 -14
  29. package/dist/runtime/constant/enumType/FriendStatus.js +0 -7
  30. package/dist/runtime/constant/enumType/GoogleLoginType.js +0 -5
  31. package/dist/runtime/constant/enumType/GroupStatus.js +0 -7
  32. package/dist/runtime/constant/enumType/InvalidMemberType.js +0 -18
  33. package/dist/runtime/constant/enumType/ItemType.js +0 -5
  34. package/dist/runtime/constant/enumType/MatchmakingMemberStatus.js +0 -6
  35. package/dist/runtime/constant/enumType/MatchmakingTicketStatus.js +0 -8
  36. package/dist/runtime/constant/enumType/OwnerType.js +0 -8
  37. package/dist/runtime/constant/enumType/PermissionDataItem.js +0 -5
  38. package/dist/runtime/constant/enumType/RequestRole.js +0 -6
  39. package/dist/runtime/constant/enumType/RequestType.js +0 -15
  40. package/dist/runtime/constant/errorCode/GNErrorCode.js +0 -49
  41. package/dist/runtime/constant/parameterCode/GNParameterCode.js +0 -537
  42. package/dist/runtime/constant/parameterCode/ParameterCode.js +0 -6
  43. package/dist/runtime/entity/DataMember.js +0 -208
  44. package/dist/runtime/entity/GNMetadata.js +0 -11
  45. package/dist/runtime/entity/InvalidMember.js +0 -1
  46. package/dist/runtime/entity/OperationEvent.js +0 -32
  47. package/dist/runtime/entity/OperationHelper.js +0 -23
  48. package/dist/runtime/entity/OperationRequest.js +0 -50
  49. package/dist/runtime/entity/OperationResponse.js +0 -81
  50. package/dist/runtime/entity/models/AuthenticateModels.js +0 -416
  51. package/dist/runtime/entity/models/AuthenticateRequestModels.js +0 -206
  52. package/dist/runtime/entity/models/AuthenticateResponseModels.js +0 -131
  53. package/dist/runtime/entity/models/CharacterPlayerModels.js +0 -1377
  54. package/dist/runtime/entity/models/CharacterPlayerRequestModels.js +0 -1412
  55. package/dist/runtime/entity/models/CharacterPlayerResponseModels.js +0 -369
  56. package/dist/runtime/entity/models/CloudScriptModels.js +0 -197
  57. package/dist/runtime/entity/models/CloudScriptRequestModels.js +0 -143
  58. package/dist/runtime/entity/models/CloudScriptResponseModels.js +0 -40
  59. package/dist/runtime/entity/models/ContentModels.js +0 -211
  60. package/dist/runtime/entity/models/ContentRequestModels.js +0 -197
  61. package/dist/runtime/entity/models/ContentResponseModels.js +0 -54
  62. package/dist/runtime/entity/models/DashboardModels.js +0 -2674
  63. package/dist/runtime/entity/models/DashboardRequestModels.js +0 -283
  64. package/dist/runtime/entity/models/DashboardResponseModels.js +0 -180
  65. package/dist/runtime/entity/models/GamePlayerModels.js +0 -1569
  66. package/dist/runtime/entity/models/GamePlayerRequestModels.js +0 -1412
  67. package/dist/runtime/entity/models/GamePlayerResponseModels.js +0 -369
  68. package/dist/runtime/entity/models/GenericModels.js +0 -177
  69. package/dist/runtime/entity/models/GroupModels.js +0 -1123
  70. package/dist/runtime/entity/models/GroupRequestModels.js +0 -1088
  71. package/dist/runtime/entity/models/GroupResponseModels.js +0 -285
  72. package/dist/runtime/entity/models/InventoryModels.js +0 -903
  73. package/dist/runtime/entity/models/InventoryRequestModels.js +0 -926
  74. package/dist/runtime/entity/models/InventoryResponseModels.js +0 -243
  75. package/dist/runtime/entity/models/MasterPlayerModels.js +0 -2371
  76. package/dist/runtime/entity/models/MasterPlayerRequestModels.js +0 -2152
  77. package/dist/runtime/entity/models/MasterPlayerResponseModels.js +0 -565
  78. package/dist/runtime/entity/models/MultiplayerModels.js +0 -404
  79. package/dist/runtime/entity/models/MultiplayerRequestModels.js +0 -278
  80. package/dist/runtime/entity/models/MultiplayerResponseModels.js +0 -75
  81. package/dist/runtime/entity/models/StoreInventoryModels.js +0 -737
  82. package/dist/runtime/entity/models/StoreInventoryRequestModels.js +0 -332
  83. package/dist/runtime/entity/models/StoreInventoryResponseModels.js +0 -89
  84. package/dist/runtime/entity/request/CustomOperationRequest.js +0 -24
  85. package/dist/runtime/entity/response/CustomOperationResponse.js +0 -29
  86. package/dist/runtime/helper/CodeHelper.js +0 -61
  87. package/dist/runtime/helper/ConverterService.js +0 -275
  88. package/dist/runtime/helper/GNSupport.js +0 -8
  89. package/dist/runtime/logger/GNDebug.js +0 -29
  90. package/dist/runtime/networking/AuthenticateStatus.js +0 -14
  91. package/dist/runtime/networking/IPeer.js +0 -1
  92. package/dist/runtime/networking/NetworkingPeer.js +0 -129
  93. package/dist/runtime/networking/OperationPending.js +0 -53
  94. package/dist/runtime/networking/PeerBase.js +0 -168
  95. package/dist/runtime/networking/handler/IServerEventHandler.js +0 -13
  96. package/dist/runtime/networking/handler/OnCharacterPlayerFriendUpdateEventHandler.js +0 -39
  97. package/dist/runtime/networking/handler/OnCharacterPlayerGroupUpdateEventHandler.js +0 -39
  98. package/dist/runtime/networking/handler/OnGamePlayerFriendUpdateEventHandler.js +0 -39
  99. package/dist/runtime/networking/handler/OnGamePlayerGroupUpdateEventHandler.js +0 -39
  100. package/dist/runtime/networking/handler/OnGroupMemberUpdateEventHandler.js +0 -35
  101. package/dist/runtime/networking/handler/OnGroupMessageUpdateEventHandler.js +0 -35
  102. package/dist/runtime/networking/http/HttpPeer.js +0 -121
  103. package/dist/runtime/networking/http/NetworkingHttpPeerBase.js +0 -6
  104. package/dist/runtime/networking/http/NetworkingPeerAxiosRequest.js +0 -146
  105. package/dist/runtime/networking/socket/NetworkingPeerSocketIOClient.js +0 -126
  106. package/dist/runtime/networking/socket/NetworkingSocketPeerBase.js +0 -176
  107. package/dist/runtime/networking/socket/SocketPeer.js +0 -105
  108. 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,32 +0,0 @@
1
- import { CodeHelper } from "./../helper/CodeHelper";
2
- export class OperationEvent {
3
- constructor(eventCode, parameters = null, encrypted = true) {
4
- this.eventCode = eventCode;
5
- this.parameters = parameters;
6
- this.encrypted = encrypted;
7
- }
8
- getEventCode() {
9
- return this.eventCode;
10
- }
11
- getParameters() {
12
- return this.parameters;
13
- }
14
- isEncrypted() {
15
- return this.encrypted;
16
- }
17
- setParameter(k, value) {
18
- this.parameters.add(k, value);
19
- return this;
20
- }
21
- setParameters(parameters) {
22
- this.parameters = parameters;
23
- return this;
24
- }
25
- setEncrypted(encrypted) {
26
- this.encrypted = encrypted;
27
- return this;
28
- }
29
- toString() {
30
- return "Code: " + CodeHelper.getEventCodeName(this.eventCode) + " (" + this.eventCode + ")" + ", parameters " + this.parameters + ", encrypted " + this.encrypted;
31
- }
32
- }
@@ -1,23 +0,0 @@
1
- export class OperationHelper {
2
- static toSocketData(requestType, requestRole, request) {
3
- let requestId = request.getRequestId();
4
- if (requestId == -1)
5
- return [
6
- request.getOperationCode(),
7
- requestType,
8
- requestRole,
9
- (request.getParameters() == null) ? null : request.getParameters().toData()
10
- ];
11
- else
12
- return [
13
- request.getOperationCode(),
14
- requestType,
15
- requestRole,
16
- (request.getParameters() == null) ? null : request.getParameters().toData(),
17
- requestId
18
- ];
19
- }
20
- static toHttpData(requestType, requestRole, request) {
21
- return null;
22
- }
23
- }
@@ -1,50 +0,0 @@
1
- import { CodeHelper } from "./../helper/CodeHelper";
2
- import { GNHashtable } from "./../common/GNData";
3
- export class OperationRequest {
4
- constructor(operationCode, encrypted, timeout = OperationRequest.defaultTimeOut) {
5
- this.operationCode = operationCode;
6
- this.encrypted = encrypted;
7
- this.timeout = timeout;
8
- }
9
- getOperationCode() {
10
- return this.operationCode;
11
- }
12
- getRequestId() {
13
- return this.requestId;
14
- }
15
- getParameters() {
16
- return this.parameters;
17
- }
18
- isEncrypted() {
19
- return this.encrypted;
20
- }
21
- getTimeout() {
22
- return this.timeout;
23
- }
24
- setRequestId(requestId) {
25
- this.requestId = requestId;
26
- return this;
27
- }
28
- setParameter(key, value) {
29
- if (this.parameters == null)
30
- this.parameters = new GNHashtable();
31
- this.parameters.add(key, value);
32
- return this;
33
- }
34
- setParameters(parameters) {
35
- this.parameters = parameters;
36
- return this;
37
- }
38
- setEncrypted(encrypted) {
39
- this.encrypted = encrypted;
40
- return this;
41
- }
42
- setTimeout(timeout) {
43
- this.timeout = timeout;
44
- return this;
45
- }
46
- toString() {
47
- return "Code: " + CodeHelper.getOperationCodeName(this.operationCode) + " (" + this.operationCode + ")" + ", requestId: " + this.requestId + ", parameters " + this.parameters + ", encrypted " + this.encrypted;
48
- }
49
- }
50
- OperationRequest.defaultTimeOut = 15;
@@ -1,81 +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, encrypted = true) {
6
- this.operationCode = operationCode;
7
- this.responseId = responseId;
8
- this.encrypted = encrypted;
9
- this.parameters = new GNHashtable();
10
- this.debugMessage = null;
11
- }
12
- getOperationCode() {
13
- return this.operationCode;
14
- }
15
- getReturnCode() {
16
- return this.returnCode;
17
- }
18
- getParameters() {
19
- return this.parameters;
20
- }
21
- isEncrypted() {
22
- return this.encrypted;
23
- }
24
- getResponseId() {
25
- return this.responseId;
26
- }
27
- getDebugMessage() {
28
- return this.debugMessage;
29
- }
30
- getInvalidMembers() {
31
- return this.invalidMembers;
32
- }
33
- hasError() {
34
- return this.getReturnCode() != ReturnCode.Ok;
35
- }
36
- setReturnCode(returnCode) {
37
- this.returnCode = returnCode;
38
- return this;
39
- }
40
- setDebugMessage(debugMessage) {
41
- this.debugMessage = debugMessage;
42
- return this;
43
- }
44
- setParameter(k, value) {
45
- this.parameters.add(k, value);
46
- return this;
47
- }
48
- setParameters(parameters) {
49
- this.parameters = parameters;
50
- return this;
51
- }
52
- setEncrypted(encrypted) {
53
- this.encrypted = encrypted;
54
- return this;
55
- }
56
- setInvalidMembers(invalidMembers) {
57
- this.invalidMembers = invalidMembers;
58
- return this;
59
- }
60
- toString() {
61
- let stringBuilder = "";
62
- stringBuilder += "Code: " + CodeHelper.getOperationCodeName(this.operationCode) + " (" + this.operationCode + ")" + ", responseId: " + this.responseId + ", returnCode " + CodeHelper.getReturnCodeName(this.returnCode);
63
- if (this.returnCode == ReturnCode.Ok)
64
- stringBuilder += ", parameters " + this.parameters;
65
- else if (this.returnCode == ReturnCode.InvalidRequestParameters) {
66
- if (this.invalidMembers != null) {
67
- let invalidStr = "";
68
- this.invalidMembers.forEach(invalidMember => {
69
- invalidStr += invalidMember;
70
- });
71
- stringBuilder += ", invalidMembers " + invalidStr;
72
- }
73
- else
74
- stringBuilder += ", invalidMembers " + this.invalidMembers;
75
- }
76
- else
77
- stringBuilder += ", debugMessage " + this.debugMessage;
78
- stringBuilder += ", encrypted " + this.encrypted;
79
- return stringBuilder;
80
- }
81
- }