@xmobitea/gn-typescript-client 2.6.13 → 2.6.14
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/AGENTS.md +37 -0
- package/README.MD +420 -1
- package/dist/gearn.js.client.js +25056 -1056
- package/dist/gearn.js.client.min.js +1 -1
- package/dist/index.d.ts +30 -0
- package/dist/index.js +24236 -212
- package/dist/runtime/GNNetwork.d.ts +687 -3
- package/dist/runtime/GNNetworkAuthenticateApi.d.ts +327 -0
- package/dist/runtime/GNNetworkCharacterPlayerApi.d.ts +1026 -0
- package/dist/runtime/GNNetworkCloudScriptApi.d.ts +141 -0
- package/dist/runtime/GNNetworkContentApi.d.ts +243 -0
- package/dist/runtime/GNNetworkDashboardApi.d.ts +221 -0
- package/dist/runtime/GNNetworkGamePlayerApi.d.ts +1033 -0
- package/dist/runtime/GNNetworkGroupApi.d.ts +783 -0
- package/dist/runtime/GNNetworkInventoryApi.d.ts +673 -0
- package/dist/runtime/GNNetworkMasterPlayerApi.d.ts +1614 -6
- package/dist/runtime/GNNetworkMultiplayerApi.d.ts +234 -0
- package/dist/runtime/GNNetworkStoreInventoryApi.d.ts +309 -0
- package/dist/runtime/common/Action0.d.ts +30 -0
- package/dist/runtime/common/Action1.d.ts +32 -0
- package/dist/runtime/common/Action2.d.ts +21 -0
- package/dist/runtime/common/Action3.d.ts +16 -0
- package/dist/runtime/common/Action4.d.ts +17 -0
- package/dist/runtime/common/GNData.d.ts +368 -0
- package/dist/runtime/config/GNServerSettings.d.ts +442 -12
- package/dist/runtime/constant/Commands.d.ts +80 -0
- package/dist/runtime/constant/EventCode.d.ts +48 -0
- package/dist/runtime/constant/OperationCode.d.ts +74 -1
- package/dist/runtime/constant/ReturnCode.d.ts +72 -0
- package/dist/runtime/constant/enumType/ExecuteResponseStatus.d.ts +31 -0
- package/dist/runtime/constant/enumType/FriendStatus.d.ts +39 -0
- package/dist/runtime/constant/enumType/GoogleLoginType.d.ts +23 -0
- package/dist/runtime/constant/enumType/GroupStatus.d.ts +32 -0
- package/dist/runtime/constant/enumType/InvalidMemberType.d.ts +75 -0
- package/dist/runtime/constant/enumType/ItemType.d.ts +23 -0
- package/dist/runtime/constant/enumType/MatchStatus.d.ts +30 -0
- package/dist/runtime/constant/enumType/MatchmakingMemberStatus.d.ts +24 -0
- package/dist/runtime/constant/enumType/MatchmakingTicketStatus.d.ts +34 -0
- package/dist/runtime/constant/enumType/OwnerType.d.ts +40 -0
- package/dist/runtime/constant/enumType/PermissionDataItem.d.ts +22 -0
- package/dist/runtime/constant/enumType/PushPlatformType.d.ts +18 -0
- package/dist/runtime/constant/enumType/RequestRole.d.ts +32 -0
- package/dist/runtime/constant/enumType/RequestType.d.ts +70 -0
- package/dist/runtime/constant/enumType/StoreItemType.d.ts +21 -0
- package/dist/runtime/constant/enumType/StoreReceiveType.d.ts +30 -0
- package/dist/runtime/constant/errorCode/ErrorCode.d.ts +190 -8
- package/dist/runtime/constant/parameterCode/ParameterCode.d.ts +35 -5
- package/dist/runtime/entity/DataMember.d.ts +338 -0
- package/dist/runtime/entity/GNMetadata.d.ts +101 -0
- package/dist/runtime/entity/InvalidMember.d.ts +28 -0
- package/dist/runtime/entity/OperationEvent.d.ts +49 -0
- package/dist/runtime/entity/OperationRequest.d.ts +108 -0
- package/dist/runtime/entity/OperationResponse.d.ts +110 -0
- package/dist/runtime/entity/models/AuthenticateModels.d.ts +115 -0
- package/dist/runtime/entity/models/AuthenticateRequestModels.d.ts +131 -0
- package/dist/runtime/entity/models/AuthenticateResponseModels.d.ts +131 -0
- package/dist/runtime/entity/models/CharacterPlayerModels.d.ts +625 -1
- package/dist/runtime/entity/models/CharacterPlayerRequestModels.d.ts +972 -0
- package/dist/runtime/entity/models/CharacterPlayerResponseModels.d.ts +332 -0
- package/dist/runtime/entity/models/CloudScriptModels.d.ts +109 -0
- package/dist/runtime/entity/models/CloudScriptRequestModels.d.ts +107 -0
- package/dist/runtime/entity/models/CloudScriptResponseModels.d.ts +46 -0
- package/dist/runtime/entity/models/ContentModels.d.ts +124 -0
- package/dist/runtime/entity/models/ContentRequestModels.d.ts +152 -0
- package/dist/runtime/entity/models/ContentResponseModels.d.ts +58 -0
- package/dist/runtime/entity/models/DashboardModels.d.ts +371 -8
- package/dist/runtime/entity/models/DashboardRequestModels.d.ts +172 -0
- package/dist/runtime/entity/models/DashboardResponseModels.d.ts +170 -0
- package/dist/runtime/entity/models/GamePlayerModels.d.ts +644 -1
- package/dist/runtime/entity/models/GamePlayerRequestModels.d.ts +959 -0
- package/dist/runtime/entity/models/GamePlayerResponseModels.d.ts +333 -1
- package/dist/runtime/entity/models/GenericModels.d.ts +94 -0
- package/dist/runtime/entity/models/GroupModels.d.ts +484 -2
- package/dist/runtime/entity/models/GroupRequestModels.d.ts +737 -0
- package/dist/runtime/entity/models/GroupResponseModels.d.ts +254 -0
- package/dist/runtime/entity/models/InventoryModels.d.ts +415 -0
- package/dist/runtime/entity/models/InventoryRequestModels.d.ts +629 -0
- package/dist/runtime/entity/models/InventoryResponseModels.d.ts +218 -0
- package/dist/runtime/entity/models/MasterPlayerModels.d.ts +1065 -3
- package/dist/runtime/entity/models/MasterPlayerRequestModels.d.ts +1560 -6
- package/dist/runtime/entity/models/MasterPlayerResponseModels.d.ts +532 -1
- package/dist/runtime/entity/models/MultiplayerModels.d.ts +199 -0
- package/dist/runtime/entity/models/MultiplayerRequestModels.d.ts +196 -0
- package/dist/runtime/entity/models/MultiplayerResponseModels.d.ts +74 -0
- package/dist/runtime/entity/models/StoreInventoryModels.d.ts +262 -0
- package/dist/runtime/entity/models/StoreInventoryRequestModels.d.ts +268 -0
- package/dist/runtime/entity/models/StoreInventoryResponseModels.d.ts +98 -0
- package/dist/runtime/entity/request/CustomOperationRequest.d.ts +99 -0
- package/dist/runtime/entity/response/CustomOperationResponse.d.ts +118 -0
- package/dist/runtime/entity/response/GetAuthInfoResponse.d.ts +53 -0
- package/dist/runtime/entity/response/HealthCheckResponse.d.ts +56 -0
- package/dist/runtime/entity/response/UploadFileResponse.d.ts +19 -0
- package/dist/runtime/helper/CodeHelper.d.ts +122 -0
- package/dist/runtime/helper/ConverterService.d.ts +74 -0
- package/dist/runtime/helper/EnumUtility.d.ts +63 -0
- package/dist/runtime/helper/GNSupport.d.ts +64 -4
- package/dist/runtime/helper/GNUtils.d.ts +54 -0
- package/dist/runtime/helper/MessagePackConverterService.d.ts +48 -0
- package/dist/runtime/helper/OperationHelper.d.ts +51 -0
- package/dist/runtime/helper/StorageService.d.ts +48 -8
- package/dist/runtime/logger/GNDebug.d.ts +117 -0
- package/dist/runtime/networking/AuthenticateStatus.d.ts +64 -0
- package/dist/runtime/networking/IPeer.d.ts +83 -0
- package/dist/runtime/networking/NetworkingPeer.d.ts +256 -1
- package/dist/runtime/networking/OperationPending.d.ts +112 -0
- package/dist/runtime/networking/PeerBase.d.ts +231 -0
- package/dist/runtime/networking/handler/IServerEventHandler.d.ts +84 -0
- package/dist/runtime/networking/handler/OnCharacterPlayerFriendUpdateEventHandler.d.ts +69 -0
- package/dist/runtime/networking/handler/OnCharacterPlayerGroupUpdateEventHandler.d.ts +49 -0
- package/dist/runtime/networking/handler/OnGamePlayerFriendUpdateEventHandler.d.ts +50 -0
- package/dist/runtime/networking/handler/OnGamePlayerGroupUpdateEventHandler.d.ts +41 -0
- package/dist/runtime/networking/handler/OnGroupMemberUpdateEventHandler.d.ts +47 -0
- package/dist/runtime/networking/handler/OnGroupMessageUpdateEventHandler.d.ts +46 -0
- package/dist/runtime/networking/http/HttpPeer.d.ts +173 -0
- package/dist/runtime/networking/http/NetworkingHttpPeerBase.d.ts +87 -0
- package/dist/runtime/networking/http/NetworkingPeerAxiosRequest.d.ts +113 -0
- package/dist/runtime/networking/socket/NetworkingPeerSocketIOClient.d.ts +145 -0
- package/dist/runtime/networking/socket/NetworkingSocketPeerBase.d.ts +198 -0
- package/dist/runtime/networking/socket/SocketPeer.d.ts +155 -0
- package/dist/runtime/typescript/ServiceUpdate.d.ts +46 -0
- package/docs/AI_CHEATSHEET.md +211 -0
- package/docs/COOKBOOK.md +912 -0
- package/docs/RULES.md +307 -0
- package/docs/ai-manifest.json +725 -0
- package/docs/guides/AUTHENTICATE.md +246 -0
- package/docs/guides/CHARACTER_PLAYER.md +439 -0
- package/docs/guides/CLOUDSCRIPT.md +335 -0
- package/docs/guides/COCOS_CREATOR_INTEGRATION.md +150 -0
- package/docs/guides/CONTENT.md +291 -0
- package/docs/guides/DASHBOARD.md +262 -0
- package/docs/guides/GAME_PLAYER.md +473 -0
- package/docs/guides/GROUP.md +412 -0
- package/docs/guides/INVENTORY.md +375 -0
- package/docs/guides/MASTER_PLAYER.md +458 -0
- package/docs/guides/MULTIPLAYER.md +303 -0
- package/docs/guides/STORE_INVENTORY.md +313 -0
- package/docs/llms-full.txt +43 -0
- package/docs/reference/API_AUTHENTICATE.md +75 -0
- package/docs/reference/API_CHARACTER_PLAYER.md +226 -0
- package/docs/reference/API_CLOUDSCRIPT.md +82 -0
- package/docs/reference/API_CONTENT.md +88 -0
- package/docs/reference/API_DASHBOARD.md +82 -0
- package/docs/reference/API_GAME_PLAYER.md +223 -0
- package/docs/reference/API_GROUP.md +187 -0
- package/docs/reference/API_INDEX.md +57 -0
- package/docs/reference/API_INVENTORY.md +169 -0
- package/docs/reference/API_MASTER_PLAYER.md +323 -0
- package/docs/reference/API_MULTIPLAYER.md +97 -0
- package/docs/reference/API_STORE_INVENTORY.md +109 -0
- package/docs/reference/CONFIG.md +107 -0
- package/docs/reference/DTO_INDEX.md +2543 -0
- package/docs/reference/ENUMS.md +433 -0
- package/docs/reference/ERROR_HANDLING.md +159 -0
- package/docs/reference/EVENTS.md +188 -0
- package/docs/reference/PERMISSION_RULES.md +55 -0
- package/docs/reference/dto/AUTHENTICATE.md +619 -0
- package/docs/reference/dto/CHARACTER_PLAYER.md +3686 -0
- package/docs/reference/dto/CLOUDSCRIPT.md +400 -0
- package/docs/reference/dto/CONTENT.md +548 -0
- package/docs/reference/dto/DASHBOARD.md +1980 -0
- package/docs/reference/dto/GAME_PLAYER.md +3631 -0
- package/docs/reference/dto/GENERIC.md +151 -0
- package/docs/reference/dto/GROUP.md +2842 -0
- package/docs/reference/dto/INVENTORY.md +2385 -0
- package/docs/reference/dto/MASTER_PLAYER.md +6024 -0
- package/docs/reference/dto/MULTIPLAYER.md +850 -0
- package/docs/reference/dto/STORE_INVENTORY.md +1262 -0
- package/llms.txt +47 -0
- package/package.json +12 -3
- package/GNServerSettings.debug.json +0 -21
- package/docs/COCOS_CREATOR_INTEGRATION.md +0 -116
- package/examples/cocos-creator/GearNExample.ts.txt +0 -176
- package/srcSwift/Package.swift +0 -32
- package/srcSwift/Sources/GearN/runtime/GNNetwork.swift +0 -530
- package/srcSwift/Sources/GearN/runtime/GNNetworkAuthenticateApi.swift +0 -178
- package/srcSwift/Sources/GearN/runtime/GNNetworkCharacterPlayerApi.swift +0 -1162
- package/srcSwift/Sources/GearN/runtime/GNNetworkCloudScriptApi.swift +0 -154
- package/srcSwift/Sources/GearN/runtime/GNNetworkContentApi.swift +0 -208
- package/srcSwift/Sources/GearN/runtime/GNNetworkDashboardApi.swift +0 -240
- package/srcSwift/Sources/GearN/runtime/GNNetworkGamePlayerApi.swift +0 -1369
- package/srcSwift/Sources/GearN/runtime/GNNetworkGroupApi.swift +0 -1100
- package/srcSwift/Sources/GearN/runtime/GNNetworkInventoryApi.swift +0 -937
- package/srcSwift/Sources/GearN/runtime/GNNetworkMasterPlayerApi.swift +0 -2323
- package/srcSwift/Sources/GearN/runtime/GNNetworkMultiplayerApi.swift +0 -298
- package/srcSwift/Sources/GearN/runtime/GNNetworkStoreInventoryApi.swift +0 -397
- package/srcSwift/Sources/GearN/runtime/common/Action0.swift +0 -3
- package/srcSwift/Sources/GearN/runtime/common/Action1.swift +0 -3
- package/srcSwift/Sources/GearN/runtime/common/Action2.swift +0 -3
- package/srcSwift/Sources/GearN/runtime/common/Action3.swift +0 -3
- package/srcSwift/Sources/GearN/runtime/common/Action4.swift +0 -3
- package/srcSwift/Sources/GearN/runtime/common/GNArray.swift +0 -204
- package/srcSwift/Sources/GearN/runtime/common/GNData.swift +0 -108
- package/srcSwift/Sources/GearN/runtime/common/GNHashtable.swift +0 -200
- package/srcSwift/Sources/GearN/runtime/config/GNServerSettings.swift +0 -95
- package/srcSwift/Sources/GearN/runtime/constant/Commands.swift +0 -28
- package/srcSwift/Sources/GearN/runtime/constant/EventCode.swift +0 -10
- package/srcSwift/Sources/GearN/runtime/constant/OperationCode.swift +0 -252
- package/srcSwift/Sources/GearN/runtime/constant/ReturnCode.swift +0 -19
- package/srcSwift/Sources/GearN/runtime/constant/enumType/ExecuteResponseStatus.swift +0 -9
- package/srcSwift/Sources/GearN/runtime/constant/enumType/FriendStatus.swift +0 -8
- package/srcSwift/Sources/GearN/runtime/constant/enumType/GoogleLoginType.swift +0 -6
- package/srcSwift/Sources/GearN/runtime/constant/enumType/GroupStatus.swift +0 -8
- package/srcSwift/Sources/GearN/runtime/constant/enumType/InvalidMemberType.swift +0 -19
- package/srcSwift/Sources/GearN/runtime/constant/enumType/ItemType.swift +0 -6
- package/srcSwift/Sources/GearN/runtime/constant/enumType/MatchmakingMemberStatus.swift +0 -7
- package/srcSwift/Sources/GearN/runtime/constant/enumType/MatchmakingTicketStatus.swift +0 -9
- package/srcSwift/Sources/GearN/runtime/constant/enumType/OwnerType.swift +0 -10
- package/srcSwift/Sources/GearN/runtime/constant/enumType/PermissionDataItem.swift +0 -6
- package/srcSwift/Sources/GearN/runtime/constant/enumType/PushPlatformType.swift +0 -6
- package/srcSwift/Sources/GearN/runtime/constant/enumType/RequestRole.swift +0 -7
- package/srcSwift/Sources/GearN/runtime/constant/enumType/RequestType.swift +0 -16
- package/srcSwift/Sources/GearN/runtime/constant/enumType/StoreItemType.swift +0 -6
- package/srcSwift/Sources/GearN/runtime/constant/enumType/StoreReceiveType.swift +0 -9
- package/srcSwift/Sources/GearN/runtime/constant/errorCode/ErrorCode.swift +0 -58
- package/srcSwift/Sources/GearN/runtime/constant/parameterCode/ParameterCode.swift +0 -672
- package/srcSwift/Sources/GearN/runtime/entity/DataMember.swift +0 -196
- package/srcSwift/Sources/GearN/runtime/entity/GNMetadata.swift +0 -9
- package/srcSwift/Sources/GearN/runtime/entity/InvalidMember.swift +0 -11
- package/srcSwift/Sources/GearN/runtime/entity/OperationEvent.swift +0 -38
- package/srcSwift/Sources/GearN/runtime/entity/OperationHelper.swift +0 -28
- package/srcSwift/Sources/GearN/runtime/entity/OperationRequest.swift +0 -62
- package/srcSwift/Sources/GearN/runtime/entity/OperationResponse.swift +0 -98
- package/srcSwift/Sources/GearN/runtime/entity/models/AuthenticateModels.swift +0 -351
- package/srcSwift/Sources/GearN/runtime/entity/models/AuthenticateRequestModels.swift +0 -81
- package/srcSwift/Sources/GearN/runtime/entity/models/AuthenticateResponseModels.swift +0 -108
- package/srcSwift/Sources/GearN/runtime/entity/models/CharacterPlayerModels.swift +0 -1045
- package/srcSwift/Sources/GearN/runtime/entity/models/CharacterPlayerRequestModels.swift +0 -821
- package/srcSwift/Sources/GearN/runtime/entity/models/CharacterPlayerResponseModels.swift +0 -588
- package/srcSwift/Sources/GearN/runtime/entity/models/CloudScriptModels.swift +0 -187
- package/srcSwift/Sources/GearN/runtime/entity/models/CloudScriptRequestModels.swift +0 -84
- package/srcSwift/Sources/GearN/runtime/entity/models/CloudScriptResponseModels.swift +0 -59
- package/srcSwift/Sources/GearN/runtime/entity/models/ContentModels.swift +0 -195
- package/srcSwift/Sources/GearN/runtime/entity/models/ContentRequestModels.swift +0 -116
- package/srcSwift/Sources/GearN/runtime/entity/models/ContentResponseModels.swift +0 -81
- package/srcSwift/Sources/GearN/runtime/entity/models/DashboardModels.swift +0 -426
- package/srcSwift/Sources/GearN/runtime/entity/models/DashboardRequestModels.swift +0 -160
- package/srcSwift/Sources/GearN/runtime/entity/models/DashboardResponseModels.swift +0 -82
- package/srcSwift/Sources/GearN/runtime/entity/models/GamePlayerModels.swift +0 -1334
- package/srcSwift/Sources/GearN/runtime/entity/models/GamePlayerRequestModels.swift +0 -643
- package/srcSwift/Sources/GearN/runtime/entity/models/GamePlayerResponseModels.swift +0 -213
- package/srcSwift/Sources/GearN/runtime/entity/models/GenericModels.swift +0 -171
- package/srcSwift/Sources/GearN/runtime/entity/models/GroupModels.swift +0 -850
- package/srcSwift/Sources/GearN/runtime/entity/models/GroupRequestModels.swift +0 -485
- package/srcSwift/Sources/GearN/runtime/entity/models/GroupResponseModels.swift +0 -165
- package/srcSwift/Sources/GearN/runtime/entity/models/InventoryModels.swift +0 -679
- package/srcSwift/Sources/GearN/runtime/entity/models/InventoryRequestModels.swift +0 -413
- package/srcSwift/Sources/GearN/runtime/entity/models/InventoryResponseModels.swift +0 -141
- package/srcSwift/Sources/GearN/runtime/entity/models/MasterPlayerModels.swift +0 -378
- package/srcSwift/Sources/GearN/runtime/entity/models/MasterPlayerRequestModels.swift +0 -147
- package/srcSwift/Sources/GearN/runtime/entity/models/MasterPlayerResponseModels.swift +0 -318
- package/srcSwift/Sources/GearN/runtime/entity/models/MultiplayerModels.swift +0 -319
- package/srcSwift/Sources/GearN/runtime/entity/models/MultiplayerRequestModels.swift +0 -125
- package/srcSwift/Sources/GearN/runtime/entity/models/MultiplayerResponseModels.swift +0 -45
- package/srcSwift/Sources/GearN/runtime/entity/models/StoreInventoryModels.swift +0 -633
- package/srcSwift/Sources/GearN/runtime/entity/models/StoreInventoryRequestModels.swift +0 -173
- package/srcSwift/Sources/GearN/runtime/entity/models/StoreInventoryResponseModels.swift +0 -61
- package/srcSwift/Sources/GearN/runtime/entity/request/CustomOperationRequest.swift +0 -42
- package/srcSwift/Sources/GearN/runtime/entity/response/CustomOperationResponse.swift +0 -49
- package/srcSwift/Sources/GearN/runtime/entity/response/GetAuthInfoResponse.swift +0 -43
- package/srcSwift/Sources/GearN/runtime/entity/response/HealthCheckResponse.swift +0 -86
- package/srcSwift/Sources/GearN/runtime/entity/response/UploadFileResponse.swift +0 -15
- package/srcSwift/Sources/GearN/runtime/helper/CodeHelper.swift +0 -107
- package/srcSwift/Sources/GearN/runtime/helper/ConverterService.swift +0 -98
- package/srcSwift/Sources/GearN/runtime/helper/EnumUtility.swift +0 -34
- package/srcSwift/Sources/GearN/runtime/helper/GNSupport.swift +0 -41
- package/srcSwift/Sources/GearN/runtime/helper/GNUtils.swift +0 -66
- package/srcSwift/Sources/GearN/runtime/helper/MessagePackConverterService.swift +0 -21
- package/srcSwift/Sources/GearN/runtime/helper/StorageService.swift +0 -29
- package/srcSwift/Sources/GearN/runtime/logger/GNDebug.swift +0 -33
- package/srcSwift/Sources/GearN/runtime/networking/AuthenticateStatus.swift +0 -24
- package/srcSwift/Sources/GearN/runtime/networking/IPeer.swift +0 -8
- package/srcSwift/Sources/GearN/runtime/networking/NetworkingPeer.swift +0 -368
- package/srcSwift/Sources/GearN/runtime/networking/OperationPending.swift +0 -81
- package/srcSwift/Sources/GearN/runtime/networking/PeerBase.swift +0 -228
- package/srcSwift/Sources/GearN/runtime/networking/handler/IServerEventHandler.swift +0 -20
- package/srcSwift/Sources/GearN/runtime/networking/http/HttpPeer.swift +0 -226
- package/srcSwift/Sources/GearN/runtime/networking/http/HttpTypes.swift +0 -24
- package/srcSwift/Sources/GearN/runtime/networking/http/NetworkingHttpPeerBase.swift +0 -13
- package/srcSwift/Sources/GearN/runtime/networking/http/NetworkingPeerUrlSession.swift +0 -125
- package/srcSwift/Sources/GearN/runtime/networking/request/NetRequest.swift +0 -19
- package/srcSwift/Sources/GearN/runtime/networking/response/NetResponse.swift +0 -13
- package/srcSwift/Sources/GearN/runtime/networking/socket/NetworkingPeerSocketIOClient.swift +0 -244
- package/srcSwift/Sources/GearN/runtime/networking/socket/NetworkingSocketPeerBase.swift +0 -59
- package/srcSwift/Sources/GearN/runtime/networking/socket/SocketPeer.swift +0 -136
- package/tsconfig-build.cocos.json +0 -31
- package/webpack.config.cocos.mjs +0 -78
|
@@ -2,19 +2,118 @@ import { Constructor } from "./../GNMetadata";
|
|
|
2
2
|
import { RequestRole } from "./../../constant/enumType/RequestRole";
|
|
3
3
|
import { RequestType } from "./../../constant/enumType/RequestType";
|
|
4
4
|
import { OperationRequest } from "./../OperationRequest";
|
|
5
|
+
/**
|
|
6
|
+
* Abstract base of every typed request wrapper exported by the SDK.
|
|
7
|
+
*
|
|
8
|
+
* Every generated `*OperationRequest` class
|
|
9
|
+
* (`AuthenticateRequestModels.LoginByAccountOperationRequest`,
|
|
10
|
+
* `GroupRequestModels.GetGroupListOperationRequest`, ...) extends
|
|
11
|
+
* either this class directly or its DTO-shaped subclass
|
|
12
|
+
* {@link CustomOperationRequestAbstract}. The role of the wrapper
|
|
13
|
+
* is to bind a typed request DTO to the three pieces of routing
|
|
14
|
+
* metadata the transport needs:
|
|
15
|
+
* - the {@link OperationCode} string;
|
|
16
|
+
* - the {@link RequestType} group;
|
|
17
|
+
* - the {@link RequestRole} (Client / Server / Admin) the backend
|
|
18
|
+
* should evaluate the auth token against.
|
|
19
|
+
*
|
|
20
|
+
* Subclasses fill those three protected fields in their declaration
|
|
21
|
+
* (`protected override operationCode = ...`, etc.) and implement
|
|
22
|
+
* {@link build} so the helper machinery in
|
|
23
|
+
* {@link GNNetwork.sendViaSocketTRequestTResponse} can produce a
|
|
24
|
+
* raw {@link OperationRequest} for the transport.
|
|
25
|
+
*/
|
|
5
26
|
export declare abstract class CustomOperationRequest {
|
|
27
|
+
/** Operation code from {@link OperationCode}. */
|
|
6
28
|
protected abstract operationCode: string;
|
|
29
|
+
/** Request type discriminator (logical category). */
|
|
7
30
|
protected abstract requestType: RequestType;
|
|
31
|
+
/** Permission scope evaluated against the auth token by the backend. */
|
|
8
32
|
protected abstract role: RequestRole;
|
|
33
|
+
/**
|
|
34
|
+
* Per-request timeout in **seconds**, captured at construction
|
|
35
|
+
* time and forwarded into the underlying
|
|
36
|
+
* {@link OperationRequest} by {@link build}.
|
|
37
|
+
*/
|
|
9
38
|
protected operationTimeout: number;
|
|
39
|
+
/**
|
|
40
|
+
* Returns the request type the transport should encode into the
|
|
41
|
+
* outbound frame.
|
|
42
|
+
*/
|
|
10
43
|
getRequestType(): RequestType;
|
|
44
|
+
/**
|
|
45
|
+
* Returns the permission scope the backend should evaluate
|
|
46
|
+
* against the active auth token.
|
|
47
|
+
*
|
|
48
|
+
* Used by {@link GNNetwork.sendViaSocketTRequestTResponse} /
|
|
49
|
+
* `sendViaHttpTRequestTResponse` when they translate the typed
|
|
50
|
+
* wrapper into a raw {@link OperationRequest}.
|
|
51
|
+
*/
|
|
11
52
|
getRole(): RequestRole;
|
|
53
|
+
/**
|
|
54
|
+
* @param timeout Per-request timeout in seconds. Pass
|
|
55
|
+
* {@link OperationRequest.defaultTimeOut} to opt
|
|
56
|
+
* into the transport's configured default.
|
|
57
|
+
*/
|
|
12
58
|
constructor(timeout: number);
|
|
59
|
+
/**
|
|
60
|
+
* Materialises the typed wrapper into a low-level
|
|
61
|
+
* {@link OperationRequest} ready for the transport layer.
|
|
62
|
+
*
|
|
63
|
+
* The default implementation in
|
|
64
|
+
* {@link CustomOperationRequestAbstract} is enough for every
|
|
65
|
+
* generated wrapper; subclasses only need to override `build`
|
|
66
|
+
* when they encode parameters in a non-DTO shape (e.g. a
|
|
67
|
+
* placeholder request with no body).
|
|
68
|
+
*/
|
|
13
69
|
abstract build(): OperationRequest;
|
|
14
70
|
}
|
|
71
|
+
/**
|
|
72
|
+
* DTO-aware base used by every generated request wrapper.
|
|
73
|
+
*
|
|
74
|
+
* Stores the typed request DTO and its class reference so
|
|
75
|
+
* {@link build} can hand both to
|
|
76
|
+
* {@link ConverterService.serializeObject} for wire-format
|
|
77
|
+
* conversion. Subclasses just declare the three protected fields
|
|
78
|
+
* (`operationCode`, `requestType`, `role`) and pass `this.requestDataCls`
|
|
79
|
+
* in their constructor.
|
|
80
|
+
*
|
|
81
|
+
* @template TRequestData Concrete DTO class that holds the typed
|
|
82
|
+
* parameters for the operation. Must use
|
|
83
|
+
* the GearN `@*DataMember` decorator family
|
|
84
|
+
* so `ConverterService` can serialize it.
|
|
85
|
+
*/
|
|
15
86
|
export declare abstract class CustomOperationRequestAbstract<TRequestData> extends CustomOperationRequest {
|
|
87
|
+
/**
|
|
88
|
+
* Public so application code can inspect / mutate the DTO
|
|
89
|
+
* before issuing the request (e.g. patching a single field
|
|
90
|
+
* rather than re-building the wrapper).
|
|
91
|
+
*/
|
|
16
92
|
requestData: TRequestData;
|
|
93
|
+
/**
|
|
94
|
+
* Reference to the DTO class. Required by
|
|
95
|
+
* {@link ConverterService.serializeObject} to look up the
|
|
96
|
+
* cached field metadata produced by the decorators.
|
|
97
|
+
*/
|
|
17
98
|
protected requestDataCls: Constructor<TRequestData>;
|
|
99
|
+
/**
|
|
100
|
+
* @param requestData Typed parameter DTO instance to send.
|
|
101
|
+
* @param timeout Per-request timeout in seconds.
|
|
102
|
+
*/
|
|
18
103
|
constructor(requestData: TRequestData, timeout: number);
|
|
104
|
+
/**
|
|
105
|
+
* Builds the raw {@link OperationRequest} sent to the transport.
|
|
106
|
+
*
|
|
107
|
+
* Steps:
|
|
108
|
+
* 1. Create a fresh `OperationRequest` with the wrapper's
|
|
109
|
+
* operation code and timeout.
|
|
110
|
+
* 2. Serialise the DTO through
|
|
111
|
+
* {@link ConverterService.serializeObject} and attach the
|
|
112
|
+
* resulting {@link GNHashtable} as the request parameters.
|
|
113
|
+
*
|
|
114
|
+
* The request id stays unassigned at this point — it will be
|
|
115
|
+
* filled by {@link PeerBase.enqueue} when the request is
|
|
116
|
+
* queued.
|
|
117
|
+
*/
|
|
19
118
|
build(): OperationRequest;
|
|
20
119
|
}
|
|
@@ -2,19 +2,137 @@ import { Constructor } from "./../GNMetadata";
|
|
|
2
2
|
import { GNHashtable } from "./../../common/GNData";
|
|
3
3
|
import { InvalidMember } from "./../InvalidMember";
|
|
4
4
|
import { OperationResponse } from "./../OperationResponse";
|
|
5
|
+
/**
|
|
6
|
+
* Abstract base of every typed response wrapper exposed by the SDK.
|
|
7
|
+
*
|
|
8
|
+
* Each generated `*OperationResponse` class extends either this
|
|
9
|
+
* class or its DTO-shaped subclass
|
|
10
|
+
* {@link CustomOperationResponseAbstract}. The role of the wrapper
|
|
11
|
+
* is to (a) capture the low-level
|
|
12
|
+
* {@link OperationResponse} fields onto strongly typed properties
|
|
13
|
+
* the application can read directly, and (b) decode the
|
|
14
|
+
* domain-level {@link ErrorCode} carried inside the parameter bag
|
|
15
|
+
* so success-with-business-error responses are distinguishable
|
|
16
|
+
* from transport failures.
|
|
17
|
+
*
|
|
18
|
+
* Two-tier error model:
|
|
19
|
+
* - {@link returnCode} reflects the transport-level
|
|
20
|
+
* {@link ReturnCode} — anything other than `Ok` is a transport,
|
|
21
|
+
* timeout or validation failure. Use {@link hasReturnCodeError}
|
|
22
|
+
* for the boolean check.
|
|
23
|
+
* - {@link errorCode} carries the domain-level {@link ErrorCode}
|
|
24
|
+
* that the backend writes into a successful response payload to
|
|
25
|
+
* describe business outcomes. Only populated when the response
|
|
26
|
+
* has no return-code error.
|
|
27
|
+
*
|
|
28
|
+
* Application code typically inspects both:
|
|
29
|
+
* ```ts
|
|
30
|
+
* if (response.hasReturnCodeError()) {
|
|
31
|
+
* // transport / validation failure
|
|
32
|
+
* return showError(response.debugMessage);
|
|
33
|
+
* }
|
|
34
|
+
* if (response.errorCode !== ErrorCode.Ok) {
|
|
35
|
+
* // domain failure
|
|
36
|
+
* return showError(response.errorCode);
|
|
37
|
+
* }
|
|
38
|
+
* // success: read response.responseData
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
5
41
|
export declare abstract class CustomOperationResponse {
|
|
42
|
+
/** Operation code mirrored from the matching request. */
|
|
6
43
|
operationCode: string;
|
|
44
|
+
/** Raw response parameter bag; usually consumed indirectly through the typed `responseData`. */
|
|
7
45
|
parameters: GNHashtable;
|
|
46
|
+
/** Transport-level return code (from {@link ReturnCode}). */
|
|
8
47
|
returnCode: number;
|
|
48
|
+
/** Backend-supplied debug message; populated mostly for failures. */
|
|
9
49
|
debugMessage: string;
|
|
50
|
+
/**
|
|
51
|
+
* Domain-level error code (from {@link ErrorCode}). Populated
|
|
52
|
+
* only when {@link returnCode} is `Ok`. Read this **after**
|
|
53
|
+
* {@link hasReturnCodeError} confirms transport success.
|
|
54
|
+
*/
|
|
10
55
|
errorCode: number;
|
|
56
|
+
/**
|
|
57
|
+
* Validation failure entries, populated when
|
|
58
|
+
* {@link returnCode} equals
|
|
59
|
+
* `ReturnCode.InvalidRequestParameters`.
|
|
60
|
+
*/
|
|
11
61
|
invalidMembers: InvalidMember[];
|
|
62
|
+
/**
|
|
63
|
+
* Returns whether the transport-level return code indicates a
|
|
64
|
+
* failure (anything other than `Ok`).
|
|
65
|
+
*
|
|
66
|
+
* Note: this does **not** consider {@link errorCode} — a
|
|
67
|
+
* transport-successful response may still carry a domain
|
|
68
|
+
* failure, which the caller has to check separately by
|
|
69
|
+
* comparing `errorCode` to the relevant {@link ErrorCode}
|
|
70
|
+
* constants.
|
|
71
|
+
*/
|
|
12
72
|
hasReturnCodeError(): boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Copies the low-level {@link OperationResponse} fields into
|
|
75
|
+
* the typed wrapper.
|
|
76
|
+
*
|
|
77
|
+
* Called by the SDK helpers
|
|
78
|
+
* {@link GNNetwork.sendViaSocketTResponse} /
|
|
79
|
+
* `sendViaHttpTResponse` after they receive the raw response
|
|
80
|
+
* from the transport. Subclasses such as
|
|
81
|
+
* {@link CustomOperationResponseAbstract} chain into this
|
|
82
|
+
* implementation and then run their own DTO deserialisation.
|
|
83
|
+
*
|
|
84
|
+
* Side effect: when the response is transport-successful, this
|
|
85
|
+
* method also reads `ParameterCode.ErrorCode` out of the
|
|
86
|
+
* parameters and stores it on {@link errorCode} so call sites
|
|
87
|
+
* can check the domain outcome without re-touching the
|
|
88
|
+
* parameter bag.
|
|
89
|
+
*/
|
|
13
90
|
setupOperationResponse(operationResponse: OperationResponse): void;
|
|
91
|
+
/**
|
|
92
|
+
* Returns a compact string useful for logging.
|
|
93
|
+
*
|
|
94
|
+
* Format: `"ReturnCode: <code> <parameters | debugMessage>"`.
|
|
95
|
+
* Parameters are stringified through
|
|
96
|
+
* {@link GNHashtable.toString} when available, otherwise the
|
|
97
|
+
* raw debug message takes their place.
|
|
98
|
+
*/
|
|
14
99
|
toString(): string;
|
|
15
100
|
}
|
|
101
|
+
/**
|
|
102
|
+
* DTO-aware base used by every generated response wrapper.
|
|
103
|
+
*
|
|
104
|
+
* Subclasses populate `responseDataCls` in their constructor /
|
|
105
|
+
* declaration so that {@link setupOperationResponse} can
|
|
106
|
+
* automatically deserialise the parameter bag into a strongly
|
|
107
|
+
* typed payload after a transport-successful response.
|
|
108
|
+
*
|
|
109
|
+
* @template TResponseData Concrete response DTO class. Must use
|
|
110
|
+
* the GearN `@*DataMember` decorator
|
|
111
|
+
* family so {@link ConverterService} can
|
|
112
|
+
* resolve the field metadata.
|
|
113
|
+
*/
|
|
16
114
|
export declare abstract class CustomOperationResponseAbstract<TResponseData> extends CustomOperationResponse {
|
|
115
|
+
/**
|
|
116
|
+
* Typed response payload deserialised from
|
|
117
|
+
* {@link parameters}. Stays `undefined` when the response
|
|
118
|
+
* carried a transport error.
|
|
119
|
+
*/
|
|
17
120
|
responseData: TResponseData;
|
|
121
|
+
/**
|
|
122
|
+
* Reference to the DTO class. Required by
|
|
123
|
+
* {@link ConverterService.deserializeObject} to resolve
|
|
124
|
+
* decorator-driven field metadata.
|
|
125
|
+
*/
|
|
18
126
|
protected responseDataCls: Constructor<TResponseData>;
|
|
127
|
+
/**
|
|
128
|
+
* Chains into {@link CustomOperationResponse.setupOperationResponse}
|
|
129
|
+
* and additionally deserialises the parameters into
|
|
130
|
+
* {@link responseData} when the response has no transport
|
|
131
|
+
* error.
|
|
132
|
+
*
|
|
133
|
+
* Skipped on transport failure: the caller must inspect
|
|
134
|
+
* {@link hasReturnCodeError} / {@link debugMessage} /
|
|
135
|
+
* {@link invalidMembers} instead.
|
|
136
|
+
*/
|
|
19
137
|
setupOperationResponse(operationResponse: OperationResponse): void;
|
|
20
138
|
}
|
|
@@ -1,15 +1,68 @@
|
|
|
1
1
|
import { GNHashtable } from "./../../common/GNData";
|
|
2
|
+
/**
|
|
3
|
+
* Decoded shape of the `getAuthInfo` HTTP endpoint payload.
|
|
4
|
+
*
|
|
5
|
+
* Populated only when the endpoint returned a `200` response with a
|
|
6
|
+
* non-error envelope (`{ data: ..., error: null }`). The fields
|
|
7
|
+
* mirror the columns the GearN backend stores for an issued auth
|
|
8
|
+
* token.
|
|
9
|
+
*/
|
|
2
10
|
interface AuthInfoResponse {
|
|
11
|
+
/**
|
|
12
|
+
* The raw GearN auth token the SDK normally caches in
|
|
13
|
+
* {@link AuthenticateStatus}. Returned here so admin tooling
|
|
14
|
+
* can confirm which exact token the backend resolved.
|
|
15
|
+
*/
|
|
3
16
|
gnToken: string;
|
|
17
|
+
/** User id this token is bound to. */
|
|
4
18
|
userId: string;
|
|
19
|
+
/**
|
|
20
|
+
* Whether the token was logically removed (revoked by the
|
|
21
|
+
* backend, e.g. after a forced logout). When `true` the token
|
|
22
|
+
* is no longer valid for any operation.
|
|
23
|
+
*/
|
|
5
24
|
isRemove: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Absolute expiration timestamp in milliseconds since epoch.
|
|
27
|
+
* The SDK does not refresh the token automatically; the
|
|
28
|
+
* application is expected to call
|
|
29
|
+
* `GNNetwork.authenticate.refreshAuthToken` before this
|
|
30
|
+
* deadline.
|
|
31
|
+
*/
|
|
6
32
|
tsExpire: number;
|
|
33
|
+
/**
|
|
34
|
+
* Custom provider data captured at login time
|
|
35
|
+
* (`LoginByGenericService` and friends). Re-shaped from the
|
|
36
|
+
* raw JSON object into a {@link GNHashtable} by
|
|
37
|
+
* {@link NetworkingPeer.getAuthInfo} so callers can use the
|
|
38
|
+
* typed accessors.
|
|
39
|
+
*/
|
|
7
40
|
otherDatas: GNHashtable;
|
|
41
|
+
/** Issue timestamp in milliseconds since epoch. */
|
|
8
42
|
tsCreate: number;
|
|
43
|
+
/** Secret key bound to the token (admin context only). */
|
|
9
44
|
secretKey: string;
|
|
10
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* Top-level wrapper returned by
|
|
48
|
+
* {@link GNNetwork.getAuthInfo} / `getAuthInfoAsync`.
|
|
49
|
+
*
|
|
50
|
+
* The wrapper always carries either an `error` string or a `data`
|
|
51
|
+
* payload, never both. Application code typically inspects `error`
|
|
52
|
+
* first and falls back to `data` once the error path is ruled out.
|
|
53
|
+
*/
|
|
11
54
|
export declare class GetAuthInfoResponse {
|
|
55
|
+
/**
|
|
56
|
+
* Transport-level error message returned by the backend, or
|
|
57
|
+
* `null` when the call succeeded. The SDK populates this on
|
|
58
|
+
* non-200 responses, JSON parse failures, and any captured
|
|
59
|
+
* Axios exception.
|
|
60
|
+
*/
|
|
12
61
|
error: string;
|
|
62
|
+
/**
|
|
63
|
+
* Decoded auth-info payload. Defined only when {@link error}
|
|
64
|
+
* is `null`.
|
|
65
|
+
*/
|
|
13
66
|
data?: AuthInfoResponse;
|
|
14
67
|
}
|
|
15
68
|
export {};
|
|
@@ -1,21 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-instance status block returned by the GearN health-check
|
|
3
|
+
* endpoint.
|
|
4
|
+
*
|
|
5
|
+
* The backend runs in clusters where one node is the **primary**
|
|
6
|
+
* (acts as the source of truth for clock / leader election) and
|
|
7
|
+
* the rest are **replicas**. The fields below describe one node's
|
|
8
|
+
* view of the cluster topology at the moment of the health check.
|
|
9
|
+
*/
|
|
1
10
|
interface InstanceResponse {
|
|
11
|
+
/** Identifier of the node returning this block. */
|
|
2
12
|
instanceId: string;
|
|
13
|
+
/**
|
|
14
|
+
* Whether the node is currently the cluster primary. Only one
|
|
15
|
+
* node should report `true` at any given time; multiple
|
|
16
|
+
* primaries indicate a split-brain situation.
|
|
17
|
+
*/
|
|
3
18
|
isPrimary: boolean;
|
|
19
|
+
/** Identifier of the node currently considered primary. */
|
|
4
20
|
currentInstanceIdPrimary: string;
|
|
21
|
+
/** Primary clock value at the time of the check (ms since epoch). */
|
|
5
22
|
currentTsPrimary: number;
|
|
23
|
+
/** Same as `currentTsPrimary` formatted as a human-readable date. */
|
|
6
24
|
currentTsPrimaryToDate: string;
|
|
25
|
+
/** Last primary timestamp this node observed (ms since epoch). */
|
|
7
26
|
tsPrimary: number;
|
|
27
|
+
/** Same as `tsPrimary` formatted as a human-readable date. */
|
|
8
28
|
tsPrimaryToDate: string;
|
|
9
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* Per-replica view returned alongside the primary block.
|
|
32
|
+
*
|
|
33
|
+
* Extends {@link InstanceResponse} with the additional `lostPing`
|
|
34
|
+
* counter so operators can spot replicas that have fallen behind on
|
|
35
|
+
* the primary's heartbeat.
|
|
36
|
+
*/
|
|
10
37
|
interface OtherInstanceResponse extends InstanceResponse {
|
|
38
|
+
/**
|
|
39
|
+
* Number of consecutive missed heartbeats the primary
|
|
40
|
+
* observed for this replica. A non-zero value typically
|
|
41
|
+
* indicates the replica is degraded.
|
|
42
|
+
*/
|
|
11
43
|
lostPing: number;
|
|
12
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* Decoded shape of the `healthcheck` HTTP endpoint payload.
|
|
47
|
+
*
|
|
48
|
+
* Populated only when the endpoint returned a `200` response with a
|
|
49
|
+
* non-error envelope.
|
|
50
|
+
*/
|
|
13
51
|
interface HealthCheckDataResponse {
|
|
52
|
+
/** Status block of the node that handled the request. */
|
|
14
53
|
thisInstance: InstanceResponse;
|
|
54
|
+
/** Status of every other node the primary tracks. */
|
|
15
55
|
otherInstances: OtherInstanceResponse[];
|
|
16
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* Top-level wrapper returned by
|
|
59
|
+
* {@link GNNetwork.healthCheck} / `healthCheckAsync`.
|
|
60
|
+
*
|
|
61
|
+
* The wrapper always carries either an `error` string or a `data`
|
|
62
|
+
* payload, never both. Useful for warm-up probes or readiness
|
|
63
|
+
* dashboards — the endpoint does not require an auth token.
|
|
64
|
+
*/
|
|
17
65
|
export declare class HealthCheckResponse {
|
|
66
|
+
/**
|
|
67
|
+
* Transport-level error message, or `null` when the call
|
|
68
|
+
* succeeded.
|
|
69
|
+
*/
|
|
18
70
|
error: string;
|
|
71
|
+
/**
|
|
72
|
+
* Decoded health-check payload. Defined only when
|
|
73
|
+
* {@link error} is `null`.
|
|
74
|
+
*/
|
|
19
75
|
data?: HealthCheckDataResponse;
|
|
20
76
|
}
|
|
21
77
|
export {};
|
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wrapper returned by {@link GNNetwork.uploadFile} /
|
|
3
|
+
* `uploadFileAsync`.
|
|
4
|
+
*
|
|
5
|
+
* The upload endpoint does not return a structured payload — a
|
|
6
|
+
* `200` response with an empty body is enough to confirm the upload
|
|
7
|
+
* was committed. The SDK therefore exposes a single `error` field
|
|
8
|
+
* which is `null` on success and a captured error message on
|
|
9
|
+
* failure (auth missing, transport error, non-200 status). The
|
|
10
|
+
* application consumes the response with a simple
|
|
11
|
+
* `if (response.error) { ... }` check.
|
|
12
|
+
*/
|
|
1
13
|
export declare class UploadFileResponse {
|
|
14
|
+
/**
|
|
15
|
+
* Transport / authentication error captured by the SDK, or
|
|
16
|
+
* `null` when the upload succeeded. Common values:
|
|
17
|
+
* `"Auth token null"` (the cached token was empty),
|
|
18
|
+
* `"Unknown Error"` (non-200 status with no captured detail),
|
|
19
|
+
* or any Axios-thrown error message.
|
|
20
|
+
*/
|
|
2
21
|
error: string;
|
|
3
22
|
}
|
|
@@ -1,15 +1,137 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Static facade for converting GearN numeric codes into the
|
|
3
|
+
* lowercase-first-letter display names the backend expects on the
|
|
4
|
+
* wire (and that look familiar in log lines).
|
|
5
|
+
*
|
|
6
|
+
* Categories:
|
|
7
|
+
* - `getReturnCodeName(returnCode)` — translates the
|
|
8
|
+
* {@link ReturnCode} value carried by every response.
|
|
9
|
+
* - `getRequestTypeName(requestType)` — translates the
|
|
10
|
+
* {@link RequestType} enum to the camelCase string used in
|
|
11
|
+
* {@link OperationHelper.toSocketData} and the HTTP URL.
|
|
12
|
+
* - `getRequestRoleName(requestRole)` — translates the
|
|
13
|
+
* {@link RequestRole} enum the same way.
|
|
14
|
+
* - `getInvalidMemberName(invalidMember)` — translates the
|
|
15
|
+
* {@link InvalidMemberType} enum used in
|
|
16
|
+
* {@link OperationResponse.getInvalidMembers}.
|
|
17
|
+
*
|
|
18
|
+
* Lifecycle: {@link init} runs from {@link GNNetwork.init} before
|
|
19
|
+
* any model serialisation happens. After init, the lookups are
|
|
20
|
+
* effectively immutable; the SDK does not expose a teardown.
|
|
21
|
+
*
|
|
22
|
+
* Extensibility: each category exposes an `add*Dic` method so
|
|
23
|
+
* downstream applications can extend the lookup table with their
|
|
24
|
+
* own enum values without forking the SDK. This is mostly used by
|
|
25
|
+
* white-label deployments that introduce custom return codes.
|
|
26
|
+
*/
|
|
1
27
|
export declare class CodeHelper {
|
|
28
|
+
/** Helper backing {@link getReturnCodeName}. */
|
|
2
29
|
private static returnCodeHelper;
|
|
30
|
+
/** Helper backing {@link getRequestTypeName}. */
|
|
3
31
|
private static requestTypeHelper;
|
|
32
|
+
/** Helper backing {@link getRequestRoleName}. */
|
|
4
33
|
private static requestRoleHelper;
|
|
34
|
+
/** Helper backing {@link getInvalidMemberName}. */
|
|
35
|
+
private static invalidMemberHelper;
|
|
36
|
+
/**
|
|
37
|
+
* Returns the display name for a backend return code (e.g.
|
|
38
|
+
* `ReturnCode.Ok` → `"Ok"`).
|
|
39
|
+
*/
|
|
5
40
|
static getReturnCodeName(returnCode: number): string;
|
|
41
|
+
/**
|
|
42
|
+
* Returns the display name for a request-type code (e.g.
|
|
43
|
+
* `RequestType.Authenticate` → `"authenticate"`).
|
|
44
|
+
*
|
|
45
|
+
* The lowercased-first-letter convention matches the URL
|
|
46
|
+
* segment the backend expects for the HTTP API, and the
|
|
47
|
+
* matching index 0 in the socket frame produced by
|
|
48
|
+
* {@link OperationHelper.toSocketData}.
|
|
49
|
+
*/
|
|
6
50
|
static getRequestTypeName(requestType: number): string;
|
|
51
|
+
/**
|
|
52
|
+
* Returns the display name for a request-role code (e.g.
|
|
53
|
+
* `RequestRole.Client` → `"client"`).
|
|
54
|
+
*/
|
|
7
55
|
static getRequestRoleName(requestRole: number): string;
|
|
56
|
+
/**
|
|
57
|
+
* Returns the display name for an
|
|
58
|
+
* {@link InvalidMemberType} value used by the validation
|
|
59
|
+
* machinery on the response side.
|
|
60
|
+
*
|
|
61
|
+
* @param invalidMember Numeric value picked from the response
|
|
62
|
+
* `invalidRequestParameters` array entry.
|
|
63
|
+
* @returns The display name, or `"Unknown (<n>)"` when the
|
|
64
|
+
* value is not registered.
|
|
65
|
+
*/
|
|
66
|
+
static getInvalidMemberName(invalidMember: number): string;
|
|
67
|
+
/**
|
|
68
|
+
* Builds every lookup table.
|
|
69
|
+
*
|
|
70
|
+
* Called once from {@link GNNetwork.init} before any operation
|
|
71
|
+
* is sent. Subsequent invocations rebuild every helper from
|
|
72
|
+
* scratch — useful in test setups that reset the SDK between
|
|
73
|
+
* cases.
|
|
74
|
+
*/
|
|
8
75
|
static init(): void;
|
|
76
|
+
/**
|
|
77
|
+
* Resets the return-code helper to a fresh instance and seeds
|
|
78
|
+
* it from the canonical {@link ReturnCode} enum.
|
|
79
|
+
*/
|
|
9
80
|
private static setReturnCodeDic;
|
|
81
|
+
/**
|
|
82
|
+
* Adds entries from any enum-shaped object into the
|
|
83
|
+
* return-code helper without lowercasing the first letter.
|
|
84
|
+
*
|
|
85
|
+
* Used by white-label deployments that ship additional return
|
|
86
|
+
* codes — they call this method once after
|
|
87
|
+
* {@link GNNetwork.init} with their own enum.
|
|
88
|
+
*
|
|
89
|
+
* @param returnCode Enum-shaped object whose entries should be
|
|
90
|
+
* merged into the helper.
|
|
91
|
+
*/
|
|
10
92
|
static addReturnCodeDic(returnCode: any): void;
|
|
93
|
+
/**
|
|
94
|
+
* Resets the request-type helper to a fresh instance and seeds
|
|
95
|
+
* it from the canonical {@link RequestType} enum.
|
|
96
|
+
*/
|
|
11
97
|
private static setRequestTypeDic;
|
|
98
|
+
/**
|
|
99
|
+
* Adds entries from any enum-shaped object into the
|
|
100
|
+
* request-type helper, lowercasing the first letter so the
|
|
101
|
+
* stored value matches the wire format
|
|
102
|
+
* (`RequestType.Authenticate` → `"authenticate"`).
|
|
103
|
+
*
|
|
104
|
+
* @param requestType Enum-shaped object whose entries should
|
|
105
|
+
* be merged into the helper.
|
|
106
|
+
*/
|
|
12
107
|
static addRequestTypeDic(requestType: any): void;
|
|
108
|
+
/**
|
|
109
|
+
* Resets the request-role helper to a fresh instance and seeds
|
|
110
|
+
* it from the canonical {@link RequestRole} enum.
|
|
111
|
+
*/
|
|
13
112
|
private static setRequestRoleDic;
|
|
113
|
+
/**
|
|
114
|
+
* Adds entries from any enum-shaped object into the
|
|
115
|
+
* request-role helper, lowercasing the first letter the same
|
|
116
|
+
* way {@link addRequestTypeDic} does.
|
|
117
|
+
*
|
|
118
|
+
* @param requestRole Enum-shaped object whose entries should
|
|
119
|
+
* be merged into the helper.
|
|
120
|
+
*/
|
|
14
121
|
static addRequestRoleDic(requestRole: any): void;
|
|
122
|
+
/**
|
|
123
|
+
* Resets the invalid-member helper to a fresh instance and
|
|
124
|
+
* seeds it from the canonical {@link InvalidMemberType} enum.
|
|
125
|
+
*/
|
|
126
|
+
private static setInvalidMemberDic;
|
|
127
|
+
/**
|
|
128
|
+
* Adds entries from any enum-shaped object into the
|
|
129
|
+
* invalid-member helper, lowercasing the first letter so the
|
|
130
|
+
* stored value matches the human-readable form used in
|
|
131
|
+
* validation log lines.
|
|
132
|
+
*
|
|
133
|
+
* @param invalidMember Enum-shaped object whose entries should
|
|
134
|
+
* be merged into the helper.
|
|
135
|
+
*/
|
|
136
|
+
static addInvalidMemberDic(invalidMember: any): void;
|
|
15
137
|
}
|
|
@@ -1,14 +1,88 @@
|
|
|
1
1
|
import { GNArray, GNHashtable } from "./../common/GNData";
|
|
2
|
+
/**
|
|
3
|
+
* Local alias for an instantiable class.
|
|
4
|
+
*
|
|
5
|
+
* Re-declared here (rather than imported from
|
|
6
|
+
* {@link entity/GNMetadata}) so this file does not have to depend
|
|
7
|
+
* on the metadata module just for the alias — the underlying shape
|
|
8
|
+
* is identical.
|
|
9
|
+
*/
|
|
2
10
|
type Constructor<T> = {
|
|
3
11
|
new (...args: any[]): T;
|
|
4
12
|
};
|
|
13
|
+
/**
|
|
14
|
+
* Static facade for the SDK's typed model (de)serialisation.
|
|
15
|
+
*
|
|
16
|
+
* Most application code does not need to touch this directly — the
|
|
17
|
+
* generated `*Api` wrappers and request/response models call into
|
|
18
|
+
* it internally after {@link GNNetwork.init} runs
|
|
19
|
+
* {@link ConverterService.init}. Reach for this class manually
|
|
20
|
+
* only for advanced workflows: custom DTOs, unit tests that round
|
|
21
|
+
* trip a model through the SDK encoder, or hand-built operation
|
|
22
|
+
* requests that produce non-standard response shapes.
|
|
23
|
+
*
|
|
24
|
+
* Lifecycle:
|
|
25
|
+
* - {@link init} runs from {@link GNNetwork.init} and allocates
|
|
26
|
+
* one shared {@link DataMemberFieldInfoTypeMapper} that backs
|
|
27
|
+
* both the serializer and the deserializer (so the metadata
|
|
28
|
+
* cache is shared between the two directions).
|
|
29
|
+
* - There is no `dispose()`; the singleton lives for the lifetime
|
|
30
|
+
* of the JS realm.
|
|
31
|
+
*/
|
|
5
32
|
export declare class ConverterService {
|
|
6
33
|
private static serializeConverter;
|
|
7
34
|
private static deserializeConverter;
|
|
35
|
+
/**
|
|
36
|
+
* Deserialises a {@link GNHashtable} into a typed model
|
|
37
|
+
* instance.
|
|
38
|
+
*
|
|
39
|
+
* The class supplied as `cls` must use the GearN
|
|
40
|
+
* `@*DataMember` decorator family so the SDK can resolve the
|
|
41
|
+
* field-code mapping. Classes without decorators yield an
|
|
42
|
+
* instance with no fields populated.
|
|
43
|
+
*
|
|
44
|
+
* @param gnHashtable Source container; usually obtained from
|
|
45
|
+
* `OperationResponse.getParameters()`.
|
|
46
|
+
* @param cls Target model class.
|
|
47
|
+
* @returns Populated `T` instance, or `null` when
|
|
48
|
+
* `gnHashtable` is `null`.
|
|
49
|
+
*/
|
|
8
50
|
static deserializeObject<T>(gnHashtable: GNHashtable, cls: Constructor<T>): any;
|
|
51
|
+
/**
|
|
52
|
+
* Deserialises a {@link GNArray} into an array of typed model
|
|
53
|
+
* instances or primitives.
|
|
54
|
+
*
|
|
55
|
+
* For arrays of custom objects, `cls` should be the element
|
|
56
|
+
* class decorated with the GearN metadata. For arrays of
|
|
57
|
+
* primitives pass the matching wrapper (`String`, `Number`,
|
|
58
|
+
* `Boolean`).
|
|
59
|
+
*/
|
|
9
60
|
static deserializeArray<T>(gnArray: GNArray, cls: Constructor<T>): any[];
|
|
61
|
+
/**
|
|
62
|
+
* Serialises a typed model instance into a {@link GNHashtable}
|
|
63
|
+
* suitable for the wire.
|
|
64
|
+
*
|
|
65
|
+
* The result is the same shape that the request build pipeline
|
|
66
|
+
* inside `*OperationRequest.build()` produces — pass it to
|
|
67
|
+
* `OperationRequest.setParameters` if you are constructing a
|
|
68
|
+
* raw request manually.
|
|
69
|
+
*/
|
|
10
70
|
static serializeObject<T>(obj: any, cls: Constructor<T>): GNHashtable;
|
|
71
|
+
/**
|
|
72
|
+
* Serialises an array of typed model instances or primitives
|
|
73
|
+
* into a {@link GNArray}.
|
|
74
|
+
*
|
|
75
|
+
* For arrays of custom objects, `cls` should be the element
|
|
76
|
+
* class decorated with GearN metadata.
|
|
77
|
+
*/
|
|
11
78
|
static serializeArray<T>(objLst: [], cls: Constructor<T>): GNArray;
|
|
79
|
+
/**
|
|
80
|
+
* Allocates the shared serializer / deserializer singletons.
|
|
81
|
+
*
|
|
82
|
+
* Run once from {@link GNNetwork.init}. Calling it again
|
|
83
|
+
* rebuilds the singletons from scratch, which is convenient in
|
|
84
|
+
* test setups that need to reset the SDK between cases.
|
|
85
|
+
*/
|
|
12
86
|
static init(): void;
|
|
13
87
|
}
|
|
14
88
|
export {};
|