@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
|
@@ -6,26 +6,257 @@ import { OperationRequest } from "./../entity/OperationRequest";
|
|
|
6
6
|
import { OperationResponse } from "./../entity/OperationResponse";
|
|
7
7
|
import { IPeer } from "./IPeer";
|
|
8
8
|
import { OperationPending } from "./OperationPending";
|
|
9
|
+
/**
|
|
10
|
+
* Shared scaffolding for both transports — owns the request queue,
|
|
11
|
+
* tracks in-flight operations, sweeps timeouts and parses raw response
|
|
12
|
+
* payloads into typed {@link OperationResponse} instances.
|
|
13
|
+
*
|
|
14
|
+
* Subclasses ({@link HttpPeer}, {@link SocketPeer}) only need to:
|
|
15
|
+
* - Implement {@link initGNSocketObject} so they can build their
|
|
16
|
+
* transport-specific low-level client (Axios / socket.io).
|
|
17
|
+
* - Implement {@link onEnqueue} to react when a request is queued
|
|
18
|
+
* (typically a debug log line; the socket peer also wakes itself
|
|
19
|
+
* up from idle).
|
|
20
|
+
* - Override {@link send} to dispatch the actual frame, then chain
|
|
21
|
+
* into `super.send(...)` so the in-flight tracking logic still
|
|
22
|
+
* runs.
|
|
23
|
+
*
|
|
24
|
+
* Driver loop: {@link service} is called from {@link ServiceUpdate}
|
|
25
|
+
* on a fixed interval. Each tick:
|
|
26
|
+
* 1. Every 0.1 s sweeps the in-flight map and synthesises a
|
|
27
|
+
* `ReturnCode.OperationTimeout` response for every pending entry
|
|
28
|
+
* whose absolute deadline has elapsed.
|
|
29
|
+
* 2. Drains at most one queued request per tick when the
|
|
30
|
+
* rate-limiter (`perMsgTimer`) permits, so the SDK never floods
|
|
31
|
+
* the backend even when the application bursts dozens of
|
|
32
|
+
* requests at once.
|
|
33
|
+
*
|
|
34
|
+
* Auth token / user id mirror: {@link onResponseHandler} silently
|
|
35
|
+
* forwards any `authToken`, `userId` or `ts` parameter found inside a
|
|
36
|
+
* successful response into both {@link AuthenticateStatus} and
|
|
37
|
+
* {@link StorageService}, so a process restart can resume the prior
|
|
38
|
+
* session without an explicit re-login.
|
|
39
|
+
*/
|
|
9
40
|
export declare abstract class PeerBase implements IPeer {
|
|
41
|
+
/**
|
|
42
|
+
* FIFO queue of requests waiting to be sent. Drained one entry
|
|
43
|
+
* per `service()` tick when the rate limiter allows.
|
|
44
|
+
*/
|
|
10
45
|
private operationPendingQueue;
|
|
46
|
+
/**
|
|
47
|
+
* In-flight set keyed by the request id assigned at enqueue time.
|
|
48
|
+
* Only requests that registered a callback go in here — callbacks
|
|
49
|
+
* are mandatory for response correlation, so fire-and-forget
|
|
50
|
+
* entries are not tracked.
|
|
51
|
+
*/
|
|
11
52
|
private operationWaitingResponseDict;
|
|
53
|
+
/**
|
|
54
|
+
* Monotonic counter used to assign unique request ids to outgoing
|
|
55
|
+
* operations. Static so HTTP and socket peers share the same id
|
|
56
|
+
* space, which makes log lines easier to correlate when the SDK
|
|
57
|
+
* runs both transports concurrently.
|
|
58
|
+
*/
|
|
12
59
|
private static requestId;
|
|
60
|
+
/**
|
|
61
|
+
* Effective time between sends, derived from the configured
|
|
62
|
+
* `sendRate` via `1 / sendRate / 1000`. Note the unusual unit:
|
|
63
|
+
* the value is **seconds-per-message divided by 1000**, which
|
|
64
|
+
* matches the rest of the seconds-based comparisons in
|
|
65
|
+
* {@link service}.
|
|
66
|
+
*/
|
|
13
67
|
private perMsgTimer;
|
|
68
|
+
/**
|
|
69
|
+
* Earliest time the next queued request may be sent. Updated each
|
|
70
|
+
* time a request leaves the queue.
|
|
71
|
+
*/
|
|
14
72
|
private nextSendMsgTimer;
|
|
73
|
+
/**
|
|
74
|
+
* Earliest time the next timeout sweep may run. The sweep cadence
|
|
75
|
+
* is fixed at 100 ms regardless of the configured `sendRate`.
|
|
76
|
+
*/
|
|
15
77
|
private checkTimeoutOperationPending;
|
|
78
|
+
/**
|
|
79
|
+
* Returns the configured send rate as a messages-per-second value.
|
|
80
|
+
*
|
|
81
|
+
* The internal storage uses an unusual unit; this helper restores
|
|
82
|
+
* the human-readable rate so any external diagnostics can display
|
|
83
|
+
* the value the application configured.
|
|
84
|
+
*/
|
|
16
85
|
protected getSendRate(): number;
|
|
86
|
+
/**
|
|
87
|
+
* Translates a messages-per-second rate into the internal
|
|
88
|
+
* per-message tick used by {@link service}.
|
|
89
|
+
*
|
|
90
|
+
* Called once during {@link initSendRate}; mutating it after that
|
|
91
|
+
* has no effect on already-running peers because the value is
|
|
92
|
+
* captured during init.
|
|
93
|
+
*
|
|
94
|
+
* @param sendRate Messages per second from
|
|
95
|
+
* {@link GNServerSettings.getSendRate}.
|
|
96
|
+
*/
|
|
17
97
|
protected setSendRate(sendRate: number): void;
|
|
98
|
+
/**
|
|
99
|
+
* Most recent average latency in milliseconds. Computed from the
|
|
100
|
+
* sliding window in {@link addPing} as half of the round-trip
|
|
101
|
+
* (one-way), and surfaced through {@link NetworkingPeer.getPing}
|
|
102
|
+
* / {@link GNNetwork.getPing}.
|
|
103
|
+
*
|
|
104
|
+
* Stays `undefined` until at least one successful response has
|
|
105
|
+
* been observed; readers should treat that case as "no data".
|
|
106
|
+
*/
|
|
18
107
|
ping: number;
|
|
108
|
+
/**
|
|
109
|
+
* Sliding window of the last 10 measured one-way latencies (in
|
|
110
|
+
* milliseconds). Older entries are dropped from the head as new
|
|
111
|
+
* measurements arrive.
|
|
112
|
+
*/
|
|
19
113
|
private pingLst;
|
|
114
|
+
/**
|
|
115
|
+
* Reflects the matching `useHttp` / `useSocket` flag from
|
|
116
|
+
* {@link GNServerSettings}. Set during {@link initGNSocketObject}
|
|
117
|
+
* and re-checked at every {@link enqueue} / {@link service} call
|
|
118
|
+
* so a transport disabled by configuration drops new requests
|
|
119
|
+
* with a clear error log.
|
|
120
|
+
*/
|
|
20
121
|
protected isUse: boolean;
|
|
122
|
+
/**
|
|
123
|
+
* One-shot bootstrap called from
|
|
124
|
+
* {@link NetworkingPeer.initPeer}.
|
|
125
|
+
*
|
|
126
|
+
* Allocates the queue and in-flight map (idempotent — repeats are
|
|
127
|
+
* no-ops because the existing references are reused), reads the
|
|
128
|
+
* configured send rate and finally lets the concrete subclass
|
|
129
|
+
* build its low-level transport via {@link initGNSocketObject}.
|
|
130
|
+
*/
|
|
21
131
|
initPeer(): void;
|
|
132
|
+
/**
|
|
133
|
+
* Reads the send rate from the shared
|
|
134
|
+
* {@link GNServerSettings} and translates it into the internal
|
|
135
|
+
* tick value through {@link setSendRate}.
|
|
136
|
+
*
|
|
137
|
+
* @throws Error when the SDK is used before
|
|
138
|
+
* {@link GNNetwork.init} has populated the settings
|
|
139
|
+
* singleton.
|
|
140
|
+
*/
|
|
22
141
|
private initSendRate;
|
|
142
|
+
/**
|
|
143
|
+
* Subclass hook for transport-specific client setup.
|
|
144
|
+
*
|
|
145
|
+
* Implementations build the underlying socket.io / Axios client,
|
|
146
|
+
* read the matching `useHttp` / `useSocket` switch, register the
|
|
147
|
+
* transport-specific event/response listeners, and finally set
|
|
148
|
+
* {@link isUse} to control whether the queue accepts requests.
|
|
149
|
+
*/
|
|
23
150
|
protected abstract initGNSocketObject(): void;
|
|
151
|
+
/**
|
|
152
|
+
* Wraps a request in an {@link OperationPending} entry and pushes
|
|
153
|
+
* it onto the FIFO queue.
|
|
154
|
+
*
|
|
155
|
+
* The peer assigns a fresh request id by incrementing the static
|
|
156
|
+
* counter only when the request was created with the non-default
|
|
157
|
+
* id (the constant `-1` opts out so the request becomes
|
|
158
|
+
* fire-and-forget on the wire). Disabled transports
|
|
159
|
+
* (`isUse === false`) drop the call with an error log so the
|
|
160
|
+
* application can spot the misconfiguration during development.
|
|
161
|
+
*
|
|
162
|
+
* @param requestType Logical request category.
|
|
163
|
+
* @param role Permission scope to evaluate against
|
|
164
|
+
* the auth token.
|
|
165
|
+
* @param operationRequest Pre-built request to enqueue.
|
|
166
|
+
* @param onOperationResponse Optional response callback.
|
|
167
|
+
* @param authToken Auth token to attach to this
|
|
168
|
+
* request. Caller code normally lets
|
|
169
|
+
* {@link NetworkingPeer.sendViaSocket}
|
|
170
|
+
* / `sendViaHttp` substitute the
|
|
171
|
+
* cached value when the override is
|
|
172
|
+
* `null`.
|
|
173
|
+
* @param secretKey Shared secret for the
|
|
174
|
+
* `Secret-Key` header.
|
|
175
|
+
* @param customTags Optional routing tags.
|
|
176
|
+
* @param gameId Game id for the `Game-Id` header.
|
|
177
|
+
*/
|
|
24
178
|
enqueue(requestType: RequestType, role: RequestRole, operationRequest: OperationRequest, onOperationResponse: Action1<OperationResponse>, authToken: string, secretKey: string, customTags: GNHashtable, gameId: string): void;
|
|
179
|
+
/**
|
|
180
|
+
* Subclass hook fired immediately after a new pending entry lands
|
|
181
|
+
* in the queue.
|
|
182
|
+
*
|
|
183
|
+
* Used by both transports for diagnostic log lines; the socket
|
|
184
|
+
* peer additionally relies on this to nudge any sleeping send
|
|
185
|
+
* scheduler awake.
|
|
186
|
+
*/
|
|
25
187
|
protected abstract onEnqueue(operationPending: OperationPending): void;
|
|
188
|
+
/**
|
|
189
|
+
* Returns whether the transport is currently enabled.
|
|
190
|
+
*/
|
|
26
191
|
isUsing(): boolean;
|
|
192
|
+
/**
|
|
193
|
+
* Drives one tick of the request pipeline.
|
|
194
|
+
*
|
|
195
|
+
* Steps performed every tick:
|
|
196
|
+
* - Every 100 ms, synthesise a `ReturnCode.OperationTimeout`
|
|
197
|
+
* response for any in-flight operation whose absolute timeout
|
|
198
|
+
* has elapsed. The synthesised response carries `null`
|
|
199
|
+
* parameters and the original `requestId` so
|
|
200
|
+
* {@link onResponseHandler} routes it to the right callback.
|
|
201
|
+
* - When the rate-limit timer permits, pop the head of the queue
|
|
202
|
+
* and dispatch it through {@link send}.
|
|
203
|
+
*
|
|
204
|
+
* Disabled transports short-circuit immediately — no timeout
|
|
205
|
+
* sweep, no send.
|
|
206
|
+
*/
|
|
27
207
|
service(): void;
|
|
208
|
+
/**
|
|
209
|
+
* Decodes a raw response payload, builds the typed
|
|
210
|
+
* {@link OperationResponse}, mirrors any newly issued auth token
|
|
211
|
+
* / user id / server timestamp into the cache and persistent
|
|
212
|
+
* storage, and finally invokes the registered callback.
|
|
213
|
+
*
|
|
214
|
+
* Mirror behaviour:
|
|
215
|
+
* - `ParameterCode.AuthToken` →
|
|
216
|
+
* {@link AuthenticateStatus.setAuthToken} +
|
|
217
|
+
* `StorageService.setString(GNNetwork.AUTH_TOKEN_KEY, ...)`.
|
|
218
|
+
* - `ParameterCode.UserId` →
|
|
219
|
+
* {@link AuthenticateStatus.setUserId} +
|
|
220
|
+
* `StorageService.setString(GNNetwork.USER_ID_KEY, ...)`.
|
|
221
|
+
* - `ParameterCode.Ts` →
|
|
222
|
+
* {@link NetworkingPeer.setServerTimeMilliseconds}.
|
|
223
|
+
*
|
|
224
|
+
* The mirror only runs for responses where `hasError()` returns
|
|
225
|
+
* `false`, so an authentication failure does not poison the cache.
|
|
226
|
+
*
|
|
227
|
+
* @param obj Raw response container as decoded by the transport
|
|
228
|
+
* layer. Carries `ResponseId`, `ReturnCode`,
|
|
229
|
+
* `Parameters`, `DebugMessage` and the optional
|
|
230
|
+
* `InvalidRequestParameters` array.
|
|
231
|
+
*/
|
|
28
232
|
protected onResponseHandler(obj: GNHashtable): void;
|
|
233
|
+
/**
|
|
234
|
+
* Records that a queued request has been handed to the transport
|
|
235
|
+
* and starts tracking it for response correlation.
|
|
236
|
+
*
|
|
237
|
+
* Subclasses override this to perform the actual transport-level
|
|
238
|
+
* dispatch, then call back into `super.send(...)` so the in-flight
|
|
239
|
+
* map stays accurate. Fire-and-forget requests
|
|
240
|
+
* (`requestId === -1`) and entries with no callback are not
|
|
241
|
+
* inserted into the map because there is nothing to resolve them
|
|
242
|
+
* to.
|
|
243
|
+
*/
|
|
29
244
|
send(operationPending: OperationPending): void;
|
|
245
|
+
/**
|
|
246
|
+
* Folds a fresh round-trip measurement into the rolling latency
|
|
247
|
+
* average.
|
|
248
|
+
*
|
|
249
|
+
* The SDK reports half of the measured round-trip as transport
|
|
250
|
+
* latency on the assumption that downstream and upstream legs
|
|
251
|
+
* have similar duration. The window keeps the most recent 10
|
|
252
|
+
* samples (older entries are dropped from the head). The averaged
|
|
253
|
+
* value is multiplied by 1000 because consumers expose it in
|
|
254
|
+
* milliseconds even though the per-sample input is already in
|
|
255
|
+
* milliseconds — the multiplication compensates for the half
|
|
256
|
+
* inside the loop.
|
|
257
|
+
*
|
|
258
|
+
* @param value Round-trip duration in milliseconds, as reported
|
|
259
|
+
* by {@link OperationPending.getExecuteTimerInMs}.
|
|
260
|
+
*/
|
|
30
261
|
addPing(value: number): void;
|
|
31
262
|
}
|
|
@@ -1,14 +1,98 @@
|
|
|
1
1
|
import { OperationEvent } from "./../../entity/OperationEvent";
|
|
2
|
+
/**
|
|
3
|
+
* Contract for a typed server-pushed event handler.
|
|
4
|
+
*
|
|
5
|
+
* The SDK delivers two kinds of incoming traffic over the socket:
|
|
6
|
+
* - **Responses** to operations the client previously sent.
|
|
7
|
+
* - **Events** the server pushes spontaneously (friend list change,
|
|
8
|
+
* group message arrived, group member roster updated, ...).
|
|
9
|
+
*
|
|
10
|
+
* Each event handler implementation declares which `EventCode` it is
|
|
11
|
+
* interested in via {@link getEventCode}, then receives the matching
|
|
12
|
+
* raw {@link OperationEvent} through {@link handle}. The handler is
|
|
13
|
+
* responsible for any further deserialisation — typically through
|
|
14
|
+
* {@link ConverterService.deserializeObject} into a typed payload
|
|
15
|
+
* class — and for fanning out to application code (usually via a
|
|
16
|
+
* static callback slot).
|
|
17
|
+
*
|
|
18
|
+
* Registration:
|
|
19
|
+
* - Decorate the handler class with
|
|
20
|
+
* `@IServerEventHandler.registerEvent` to opt into the static
|
|
21
|
+
* registry. {@link SocketPeer.initGNSocketObject} instantiates one
|
|
22
|
+
* handler per registered class during init.
|
|
23
|
+
* - Or, instantiate a handler manually and call
|
|
24
|
+
* {@link GNNetwork.subscriberServerEventHandler} to add it at
|
|
25
|
+
* runtime — useful for handlers built dynamically with custom
|
|
26
|
+
* instance state.
|
|
27
|
+
*/
|
|
2
28
|
export interface IServerEventHandler {
|
|
29
|
+
/**
|
|
30
|
+
* Returns the {@link EventCode} this handler is responsible for.
|
|
31
|
+
*
|
|
32
|
+
* The SDK uses the returned value as the dictionary key inside
|
|
33
|
+
* the per-event-code dispatch table. Multiple handlers may
|
|
34
|
+
* return the same value; they are dispatched in registration
|
|
35
|
+
* order.
|
|
36
|
+
*/
|
|
3
37
|
getEventCode(): string;
|
|
38
|
+
/**
|
|
39
|
+
* Handles a single decoded {@link OperationEvent} delivered by
|
|
40
|
+
* the socket transport.
|
|
41
|
+
*
|
|
42
|
+
* Implementations typically:
|
|
43
|
+
* 1. Deserialise `operationEvent.getParameters()` into a typed
|
|
44
|
+
* payload class via
|
|
45
|
+
* {@link ConverterService.deserializeObject}.
|
|
46
|
+
* 2. Forward the typed payload to a static callback slot the
|
|
47
|
+
* application registers ahead of time.
|
|
48
|
+
*
|
|
49
|
+
* Implementations should treat thrown errors as fatal — the
|
|
50
|
+
* dispatcher in {@link SocketPeer.onEventHandler} does not
|
|
51
|
+
* wrap the call in try/catch.
|
|
52
|
+
*/
|
|
4
53
|
handle(operationEvent: OperationEvent): void;
|
|
5
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* Registry helpers attached to the {@link IServerEventHandler}
|
|
57
|
+
* interface as a same-named namespace.
|
|
58
|
+
*
|
|
59
|
+
* The registry stores **class constructors** (not instances) so that
|
|
60
|
+
* {@link SocketPeer.initGNSocketObject} can build one fresh instance
|
|
61
|
+
* per class on SDK startup. This indirection lets handler classes
|
|
62
|
+
* carry per-instance state if they wish (e.g. last-seen sequence id,
|
|
63
|
+
* dedup map) without requiring the application to wire them up.
|
|
64
|
+
*/
|
|
6
65
|
export declare namespace IServerEventHandler {
|
|
66
|
+
/**
|
|
67
|
+
* Constructor signature accepted by the registry — anything
|
|
68
|
+
* `new`-able with arbitrary args that produces a `T`. The
|
|
69
|
+
* `prototype` field is required by the registry call site.
|
|
70
|
+
*/
|
|
7
71
|
type Constructor<T> = {
|
|
8
72
|
new (...args: any[]): T;
|
|
9
73
|
readonly prototype: T;
|
|
10
74
|
};
|
|
75
|
+
/**
|
|
76
|
+
* Returns every constructor currently registered with the
|
|
77
|
+
* registry. Called once during {@link SocketPeer.initGNSocketObject}.
|
|
78
|
+
*/
|
|
11
79
|
export function getImplementations(): Constructor<IServerEventHandler>[];
|
|
80
|
+
/**
|
|
81
|
+
* Class decorator that registers a handler so the SDK
|
|
82
|
+
* instantiates it automatically.
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* ```ts
|
|
86
|
+
* @IServerEventHandler.registerEvent
|
|
87
|
+
* export class OnSomethingHandler implements IServerEventHandler {
|
|
88
|
+
* public getEventCode(): string { return EventCode.OnSomething; }
|
|
89
|
+
* public handle(event: OperationEvent): void { ... }
|
|
90
|
+
* }
|
|
91
|
+
* ```
|
|
92
|
+
*
|
|
93
|
+
* Returns the constructor as-is so it can still be used as a
|
|
94
|
+
* value (instantiated, type-checked, etc.).
|
|
95
|
+
*/
|
|
12
96
|
export function registerEvent<T extends Constructor<IServerEventHandler>>(ctor: T): T;
|
|
13
97
|
export {};
|
|
14
98
|
}
|
|
@@ -2,12 +2,81 @@ import { Action1 } from "./../../common/Action1";
|
|
|
2
2
|
import { OperationEvent } from "./../../entity/OperationEvent";
|
|
3
3
|
import { GenericModels } from "./../../entity/models/GenericModels";
|
|
4
4
|
import { IServerEventHandler } from "./IServerEventHandler";
|
|
5
|
+
/**
|
|
6
|
+
* Decoded payload of the `OnCharacterPlayerFriendUpdate` server
|
|
7
|
+
* event.
|
|
8
|
+
*
|
|
9
|
+
* Pushed by the backend whenever the friend roster of an
|
|
10
|
+
* already-loaded character changes — accept / decline / remove /
|
|
11
|
+
* incoming-request / status update. The application uses this to
|
|
12
|
+
* keep the in-game social UI in sync without polling.
|
|
13
|
+
*
|
|
14
|
+
* Pair this event with the related operations on
|
|
15
|
+
* `GNNetwork.characterPlayer` (`acceptCharacterPlayerFriend`,
|
|
16
|
+
* `removeCharacterPlayerFriend`, ...): when the local player issues
|
|
17
|
+
* one of those operations the server eventually echoes the resulting
|
|
18
|
+
* roster back as this event so every connected device converges.
|
|
19
|
+
*/
|
|
5
20
|
export declare class CharacterPlayerFriendUpdate {
|
|
21
|
+
/**
|
|
22
|
+
* Identifier of the character whose friend list is being updated.
|
|
23
|
+
*
|
|
24
|
+
* Matches the character id the local SDK selected via
|
|
25
|
+
* `GNNetwork.characterPlayer.selectCharacter*` (or whichever
|
|
26
|
+
* method created it). When the application has multiple
|
|
27
|
+
* characters loaded, dispatch on this field to update the right
|
|
28
|
+
* roster.
|
|
29
|
+
*/
|
|
6
30
|
characterId: string;
|
|
31
|
+
/**
|
|
32
|
+
* Authoritative friend roster after the change.
|
|
33
|
+
*
|
|
34
|
+
* Each {@link GenericModels.FriendItem} carries the full
|
|
35
|
+
* relation state ({@link FriendStatus}, friend id, optional
|
|
36
|
+
* profile data). Treat the array as a complete replacement —
|
|
37
|
+
* the backend does not send delta updates here.
|
|
38
|
+
*/
|
|
7
39
|
playerFriends: Array<GenericModels.FriendItem>;
|
|
8
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* Auto-registered event handler for the
|
|
43
|
+
* `OnCharacterPlayerFriendUpdate` server event.
|
|
44
|
+
*
|
|
45
|
+
* Wiring at startup:
|
|
46
|
+
* 1. The `@IServerEventHandler.registerEvent` decorator places the
|
|
47
|
+
* class into the static registry at module-load time.
|
|
48
|
+
* 2. {@link SocketPeer.initGNSocketObject} instantiates one handler
|
|
49
|
+
* per registered class and indexes them by their event code.
|
|
50
|
+
* 3. When the matching event arrives the SDK calls {@link handle}
|
|
51
|
+
* on this instance, which deserialises the parameters into a
|
|
52
|
+
* {@link CharacterPlayerFriendUpdate} and dispatches via the
|
|
53
|
+
* application-supplied static callback.
|
|
54
|
+
*
|
|
55
|
+
* Application setup:
|
|
56
|
+
* ```ts
|
|
57
|
+
* OnCharacterPlayerFriendUpdateEventHandler.onUpdate = update => {
|
|
58
|
+
* console.log("friends now", update.playerFriends);
|
|
59
|
+
* };
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
9
62
|
export declare class OnCharacterPlayerFriendUpdateEventHandler implements IServerEventHandler {
|
|
63
|
+
/**
|
|
64
|
+
* Static callback the application registers. The SDK calls it
|
|
65
|
+
* with the deserialised payload whenever a matching event
|
|
66
|
+
* arrives. Leave `null` to ignore the event.
|
|
67
|
+
*/
|
|
10
68
|
static onUpdate: Action1<CharacterPlayerFriendUpdate>;
|
|
69
|
+
/**
|
|
70
|
+
* Returns {@link EventCode.OnCharacterPlayerFriendUpdate}, the
|
|
71
|
+
* stable event code emitted by the GearN backend for this
|
|
72
|
+
* push.
|
|
73
|
+
*/
|
|
11
74
|
getEventCode(): string;
|
|
75
|
+
/**
|
|
76
|
+
* Deserialises the raw parameters into a typed
|
|
77
|
+
* {@link CharacterPlayerFriendUpdate} and forwards it to
|
|
78
|
+
* {@link onUpdate}. Skipped silently when the application has
|
|
79
|
+
* not registered a callback.
|
|
80
|
+
*/
|
|
12
81
|
handle(operationEvent: OperationEvent): void;
|
|
13
82
|
}
|
|
@@ -2,12 +2,61 @@ import { Action1 } from "./../../common/Action1";
|
|
|
2
2
|
import { OperationEvent } from "./../../entity/OperationEvent";
|
|
3
3
|
import { GenericModels } from "./../../entity/models/GenericModels";
|
|
4
4
|
import { IServerEventHandler } from "./IServerEventHandler";
|
|
5
|
+
/**
|
|
6
|
+
* Decoded payload of the `OnCharacterPlayerGroupUpdate` server
|
|
7
|
+
* event.
|
|
8
|
+
*
|
|
9
|
+
* Pushed by the backend whenever the group membership of an
|
|
10
|
+
* already-loaded character changes — invitation, accept, leave,
|
|
11
|
+
* kick, role change. Use it to refresh the in-game guild / clan UI
|
|
12
|
+
* without polling.
|
|
13
|
+
*/
|
|
5
14
|
export declare class CharacterPlayerGroupUpdate {
|
|
15
|
+
/**
|
|
16
|
+
* Identifier of the character whose group membership changed.
|
|
17
|
+
* Mirrors the `characterId` selected by the local SDK so a
|
|
18
|
+
* multi-character host can route the update to the right view.
|
|
19
|
+
*/
|
|
6
20
|
characterId: string;
|
|
21
|
+
/**
|
|
22
|
+
* Authoritative group membership list after the change. Each
|
|
23
|
+
* {@link GenericModels.GroupItem} carries the group id, the
|
|
24
|
+
* member's role, and any embedded summary fields the backend
|
|
25
|
+
* chose to include. Treat the array as a complete replacement.
|
|
26
|
+
*/
|
|
7
27
|
playerGroups: Array<GenericModels.GroupItem>;
|
|
8
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Auto-registered event handler for the
|
|
31
|
+
* `OnCharacterPlayerGroupUpdate` server event.
|
|
32
|
+
*
|
|
33
|
+
* Same lifecycle as the rest of the `On*EventHandler` family —
|
|
34
|
+
* registered at module load via
|
|
35
|
+
* `@IServerEventHandler.registerEvent`, instantiated once during
|
|
36
|
+
* {@link SocketPeer.initGNSocketObject}, then invoked on every
|
|
37
|
+
* incoming event.
|
|
38
|
+
*
|
|
39
|
+
* Application setup:
|
|
40
|
+
* ```ts
|
|
41
|
+
* OnCharacterPlayerGroupUpdateEventHandler.onUpdate = update => {
|
|
42
|
+
* refreshGuildUi(update.playerGroups);
|
|
43
|
+
* };
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
9
46
|
export declare class OnCharacterPlayerGroupUpdateEventHandler implements IServerEventHandler {
|
|
47
|
+
/**
|
|
48
|
+
* Static callback the application registers. Leave `null` to
|
|
49
|
+
* silently drop the event.
|
|
50
|
+
*/
|
|
10
51
|
static onUpdate: Action1<CharacterPlayerGroupUpdate>;
|
|
52
|
+
/**
|
|
53
|
+
* Returns {@link EventCode.OnCharacterPlayerGroupUpdate}.
|
|
54
|
+
*/
|
|
11
55
|
getEventCode(): string;
|
|
56
|
+
/**
|
|
57
|
+
* Deserialises the parameters into a
|
|
58
|
+
* {@link CharacterPlayerGroupUpdate} and forwards to
|
|
59
|
+
* {@link onUpdate}.
|
|
60
|
+
*/
|
|
12
61
|
handle(operationEvent: OperationEvent): void;
|
|
13
62
|
}
|
|
@@ -2,12 +2,62 @@ import { Action1 } from "./../../common/Action1";
|
|
|
2
2
|
import { OperationEvent } from "./../../entity/OperationEvent";
|
|
3
3
|
import { GenericModels } from "./../../entity/models/GenericModels";
|
|
4
4
|
import { IServerEventHandler } from "./IServerEventHandler";
|
|
5
|
+
/**
|
|
6
|
+
* Decoded payload of the `OnGamePlayerFriendUpdate` server event.
|
|
7
|
+
*
|
|
8
|
+
* Pushed by the backend whenever the master-player friend list (the
|
|
9
|
+
* account-level social graph, distinct from per-character friends)
|
|
10
|
+
* changes — accept, decline, remove, status update. Use it to keep
|
|
11
|
+
* the lobby / account-level friend UI in sync without polling.
|
|
12
|
+
*
|
|
13
|
+
* Pair with the operations on `GNNetwork.gamePlayer`
|
|
14
|
+
* (`acceptGamePlayerFriend`, `removeGamePlayerFriend`, etc.):
|
|
15
|
+
* the server echoes the resulting roster back through this event so
|
|
16
|
+
* every connected device for the same account converges.
|
|
17
|
+
*/
|
|
5
18
|
export declare class GamePlayerFriendUpdate {
|
|
19
|
+
/**
|
|
20
|
+
* Optional character id when the backend scopes the update to
|
|
21
|
+
* a specific character context (multi-character titles).
|
|
22
|
+
* Absent for purely account-scoped friend changes.
|
|
23
|
+
*/
|
|
6
24
|
characterId?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Authoritative friend roster after the change. Treat as a
|
|
27
|
+
* complete replacement — the backend does not send deltas.
|
|
28
|
+
*/
|
|
7
29
|
playerFriends: Array<GenericModels.FriendItem>;
|
|
8
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* Auto-registered event handler for the
|
|
33
|
+
* `OnGamePlayerFriendUpdate` server event.
|
|
34
|
+
*
|
|
35
|
+
* Same lifecycle as the rest of the `On*EventHandler` family —
|
|
36
|
+
* registered through `@IServerEventHandler.registerEvent`,
|
|
37
|
+
* instantiated by {@link SocketPeer.initGNSocketObject}, then
|
|
38
|
+
* invoked on every matching event.
|
|
39
|
+
*
|
|
40
|
+
* Application setup:
|
|
41
|
+
* ```ts
|
|
42
|
+
* OnGamePlayerFriendUpdateEventHandler.onUpdate = update => {
|
|
43
|
+
* refreshLobbyFriendsUi(update.playerFriends);
|
|
44
|
+
* };
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
9
47
|
export declare class OnGamePlayerFriendUpdateEventHandler implements IServerEventHandler {
|
|
48
|
+
/**
|
|
49
|
+
* Static callback the application registers. Leave `null` to
|
|
50
|
+
* silently drop the event.
|
|
51
|
+
*/
|
|
10
52
|
static onUpdate: Action1<GamePlayerFriendUpdate>;
|
|
53
|
+
/**
|
|
54
|
+
* Returns {@link EventCode.OnGamePlayerFriendUpdate}.
|
|
55
|
+
*/
|
|
11
56
|
getEventCode(): string;
|
|
57
|
+
/**
|
|
58
|
+
* Deserialises the parameters into a
|
|
59
|
+
* {@link GamePlayerFriendUpdate} and forwards to
|
|
60
|
+
* {@link onUpdate}.
|
|
61
|
+
*/
|
|
12
62
|
handle(operationEvent: OperationEvent): void;
|
|
13
63
|
}
|
|
@@ -2,12 +2,53 @@ import { Action1 } from "./../../common/Action1";
|
|
|
2
2
|
import { OperationEvent } from "./../../entity/OperationEvent";
|
|
3
3
|
import { GenericModels } from "./../../entity/models/GenericModels";
|
|
4
4
|
import { IServerEventHandler } from "./IServerEventHandler";
|
|
5
|
+
/**
|
|
6
|
+
* Decoded payload of the `OnGamePlayerGroupUpdate` server event.
|
|
7
|
+
*
|
|
8
|
+
* Pushed by the backend whenever the master-player group membership
|
|
9
|
+
* changes — invitation, accept, leave, kick, role change. The
|
|
10
|
+
* account-level analogue of
|
|
11
|
+
* {@link CharacterPlayerGroupUpdate}; use it to refresh
|
|
12
|
+
* lobby / account-level group UI without polling.
|
|
13
|
+
*/
|
|
5
14
|
export declare class GamePlayerGroupUpdate {
|
|
15
|
+
/**
|
|
16
|
+
* Optional character id when the backend scopes the update to
|
|
17
|
+
* a specific character context. Absent for purely
|
|
18
|
+
* account-scoped group changes.
|
|
19
|
+
*/
|
|
6
20
|
characterId?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Authoritative group membership list after the change. Treat
|
|
23
|
+
* as a complete replacement.
|
|
24
|
+
*/
|
|
7
25
|
playerGroups: Array<GenericModels.GroupItem>;
|
|
8
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* Auto-registered event handler for the
|
|
29
|
+
* `OnGamePlayerGroupUpdate` server event.
|
|
30
|
+
*
|
|
31
|
+
* Application setup:
|
|
32
|
+
* ```ts
|
|
33
|
+
* OnGamePlayerGroupUpdateEventHandler.onUpdate = update => {
|
|
34
|
+
* refreshLobbyGroupsUi(update.playerGroups);
|
|
35
|
+
* };
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
9
38
|
export declare class OnGamePlayerGroupUpdateEventHandler implements IServerEventHandler {
|
|
39
|
+
/**
|
|
40
|
+
* Static callback the application registers. Leave `null` to
|
|
41
|
+
* silently drop the event.
|
|
42
|
+
*/
|
|
10
43
|
static onUpdate: Action1<GamePlayerGroupUpdate>;
|
|
44
|
+
/**
|
|
45
|
+
* Returns {@link EventCode.OnGamePlayerGroupUpdate}.
|
|
46
|
+
*/
|
|
11
47
|
getEventCode(): string;
|
|
48
|
+
/**
|
|
49
|
+
* Deserialises the parameters into a
|
|
50
|
+
* {@link GamePlayerGroupUpdate} and forwards to
|
|
51
|
+
* {@link onUpdate}.
|
|
52
|
+
*/
|
|
12
53
|
handle(operationEvent: OperationEvent): void;
|
|
13
54
|
}
|
|
@@ -2,11 +2,58 @@ import { Action1 } from "./../../common/Action1";
|
|
|
2
2
|
import { OperationEvent } from "./../../entity/OperationEvent";
|
|
3
3
|
import { GenericModels } from "./../../entity/models/GenericModels";
|
|
4
4
|
import { IServerEventHandler } from "./IServerEventHandler";
|
|
5
|
+
/**
|
|
6
|
+
* Decoded payload of the `OnGroupMemberUpdate` server event.
|
|
7
|
+
*
|
|
8
|
+
* Pushed by the backend whenever the member roster of a group
|
|
9
|
+
* changes — join, leave, role change, kick. Every device currently
|
|
10
|
+
* subscribed to that group receives the same payload so all clients
|
|
11
|
+
* converge on the same view of the roster.
|
|
12
|
+
*
|
|
13
|
+
* Pair with the operations on `GNNetwork.group` (`acceptGroupMember`,
|
|
14
|
+
* `removeGroupMember`, `setGroupMemberRole`, ...): after one client
|
|
15
|
+
* issues such an operation the server fans the resulting roster out
|
|
16
|
+
* through this event.
|
|
17
|
+
*/
|
|
5
18
|
export declare class GroupMemberUpdate {
|
|
19
|
+
/**
|
|
20
|
+
* Authoritative member roster after the change. Each
|
|
21
|
+
* {@link GenericModels.MemberItem} carries the user id, role,
|
|
22
|
+
* join timestamp and optional profile metadata. Treat the
|
|
23
|
+
* array as a complete replacement.
|
|
24
|
+
*/
|
|
6
25
|
members: Array<GenericModels.MemberItem>;
|
|
26
|
+
/**
|
|
27
|
+
* Identifier of the group whose member roster changed. Use
|
|
28
|
+
* this to route the update to the correct group view when the
|
|
29
|
+
* application has multiple groups loaded.
|
|
30
|
+
*/
|
|
31
|
+
groupId: string;
|
|
7
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Auto-registered event handler for the `OnGroupMemberUpdate`
|
|
35
|
+
* server event.
|
|
36
|
+
*
|
|
37
|
+
* Application setup:
|
|
38
|
+
* ```ts
|
|
39
|
+
* OnGroupMemberUpdateEventHandler.onUpdate = update => {
|
|
40
|
+
* refreshGroupMembersUi(update.groupId, update.members);
|
|
41
|
+
* };
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
8
44
|
export declare class OnGroupMemberUpdateEventHandler implements IServerEventHandler {
|
|
45
|
+
/**
|
|
46
|
+
* Static callback the application registers. Leave `null` to
|
|
47
|
+
* silently drop the event.
|
|
48
|
+
*/
|
|
9
49
|
static onUpdate: Action1<GroupMemberUpdate>;
|
|
50
|
+
/**
|
|
51
|
+
* Returns {@link EventCode.OnGroupMemberUpdate}.
|
|
52
|
+
*/
|
|
10
53
|
getEventCode(): string;
|
|
54
|
+
/**
|
|
55
|
+
* Deserialises the parameters into a {@link GroupMemberUpdate}
|
|
56
|
+
* and forwards to {@link onUpdate}.
|
|
57
|
+
*/
|
|
11
58
|
handle(operationEvent: OperationEvent): void;
|
|
12
59
|
}
|