@xmobitea/gn-typescript-client 2.6.13-tsc → 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 +71354 -0
- package/dist/gearn.js.client.min.js +2 -0
- package/dist/gearn.js.client.min.js.LICENSE.txt +14 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.js +58386 -339
- 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 +11 -2
- package/GNServerSettings.debug.json +0 -21
- package/dist/runtime/GNNetwork.js +0 -273
- package/dist/runtime/GNNetworkAuthenticateApi.js +0 -122
- package/dist/runtime/GNNetworkCharacterPlayerApi.js +0 -968
- package/dist/runtime/GNNetworkCloudScriptApi.js +0 -104
- package/dist/runtime/GNNetworkContentApi.js +0 -140
- package/dist/runtime/GNNetworkDashboardApi.js +0 -170
- package/dist/runtime/GNNetworkGamePlayerApi.js +0 -950
- package/dist/runtime/GNNetworkGroupApi.js +0 -734
- package/dist/runtime/GNNetworkInventoryApi.js +0 -626
- package/dist/runtime/GNNetworkMasterPlayerApi.js +0 -1550
- package/dist/runtime/GNNetworkMultiplayerApi.js +0 -194
- package/dist/runtime/GNNetworkStoreInventoryApi.js +0 -266
- package/dist/runtime/common/Action0.js +0 -1
- package/dist/runtime/common/Action1.js +0 -1
- package/dist/runtime/common/Action2.js +0 -1
- package/dist/runtime/common/Action3.js +0 -1
- package/dist/runtime/common/Action4.js +0 -1
- package/dist/runtime/common/GNData.js +0 -209
- package/dist/runtime/config/GNServerSettings.js +0 -156
- package/dist/runtime/constant/Commands.js +0 -20
- package/dist/runtime/constant/EventCode.js +0 -8
- package/dist/runtime/constant/OperationCode.js +0 -221
- package/dist/runtime/constant/ReturnCode.js +0 -14
- package/dist/runtime/constant/enumType/ExecuteResponseStatus.js +0 -8
- package/dist/runtime/constant/enumType/FriendStatus.js +0 -7
- package/dist/runtime/constant/enumType/GoogleLoginType.js +0 -5
- package/dist/runtime/constant/enumType/GroupStatus.js +0 -7
- package/dist/runtime/constant/enumType/InvalidMemberType.js +0 -18
- package/dist/runtime/constant/enumType/ItemType.js +0 -5
- package/dist/runtime/constant/enumType/MatchmakingMemberStatus.js +0 -6
- package/dist/runtime/constant/enumType/MatchmakingTicketStatus.js +0 -8
- package/dist/runtime/constant/enumType/OwnerType.js +0 -9
- package/dist/runtime/constant/enumType/PermissionDataItem.js +0 -5
- package/dist/runtime/constant/enumType/PushPlatformType.js +0 -5
- package/dist/runtime/constant/enumType/RequestRole.js +0 -6
- package/dist/runtime/constant/enumType/RequestType.js +0 -15
- package/dist/runtime/constant/enumType/StoreItemType.js +0 -5
- package/dist/runtime/constant/enumType/StoreReceiveType.js +0 -8
- package/dist/runtime/constant/errorCode/ErrorCode.js +0 -52
- package/dist/runtime/constant/parameterCode/ParameterCode.js +0 -617
- package/dist/runtime/entity/DataMember.js +0 -208
- package/dist/runtime/entity/GNMetadata.js +0 -11
- package/dist/runtime/entity/InvalidMember.js +0 -1
- package/dist/runtime/entity/OperationEvent.js +0 -24
- package/dist/runtime/entity/OperationRequest.js +0 -42
- package/dist/runtime/entity/OperationResponse.js +0 -73
- package/dist/runtime/entity/models/AuthenticateModels.js +0 -426
- package/dist/runtime/entity/models/AuthenticateRequestModels.js +0 -188
- package/dist/runtime/entity/models/AuthenticateResponseModels.js +0 -131
- package/dist/runtime/entity/models/CharacterPlayerModels.js +0 -1433
- package/dist/runtime/entity/models/CharacterPlayerRequestModels.js +0 -1386
- package/dist/runtime/entity/models/CharacterPlayerResponseModels.js +0 -376
- package/dist/runtime/entity/models/CloudScriptModels.js +0 -197
- package/dist/runtime/entity/models/CloudScriptRequestModels.js +0 -138
- package/dist/runtime/entity/models/CloudScriptResponseModels.js +0 -40
- package/dist/runtime/entity/models/ContentModels.js +0 -203
- package/dist/runtime/entity/models/ContentRequestModels.js +0 -190
- package/dist/runtime/entity/models/ContentResponseModels.js +0 -54
- package/dist/runtime/entity/models/DashboardModels.js +0 -3002
- package/dist/runtime/entity/models/DashboardRequestModels.js +0 -268
- package/dist/runtime/entity/models/DashboardResponseModels.js +0 -187
- package/dist/runtime/entity/models/GamePlayerModels.js +0 -1591
- package/dist/runtime/entity/models/GamePlayerRequestModels.js +0 -1360
- package/dist/runtime/entity/models/GamePlayerResponseModels.js +0 -369
- package/dist/runtime/entity/models/GenericModels.js +0 -177
- package/dist/runtime/entity/models/GroupModels.js +0 -1135
- package/dist/runtime/entity/models/GroupRequestModels.js +0 -1048
- package/dist/runtime/entity/models/GroupResponseModels.js +0 -285
- package/dist/runtime/entity/models/InventoryModels.js +0 -915
- package/dist/runtime/entity/models/InventoryRequestModels.js +0 -892
- package/dist/runtime/entity/models/InventoryResponseModels.js +0 -243
- package/dist/runtime/entity/models/MasterPlayerModels.js +0 -2573
- package/dist/runtime/entity/models/MasterPlayerRequestModels.js +0 -2228
- package/dist/runtime/entity/models/MasterPlayerResponseModels.js +0 -607
- package/dist/runtime/entity/models/MultiplayerModels.js +0 -404
- package/dist/runtime/entity/models/MultiplayerRequestModels.js +0 -268
- package/dist/runtime/entity/models/MultiplayerResponseModels.js +0 -75
- package/dist/runtime/entity/models/StoreInventoryModels.js +0 -797
- package/dist/runtime/entity/models/StoreInventoryRequestModels.js +0 -372
- package/dist/runtime/entity/models/StoreInventoryResponseModels.js +0 -103
- package/dist/runtime/entity/request/CustomOperationRequest.js +0 -24
- package/dist/runtime/entity/response/CustomOperationResponse.js +0 -29
- package/dist/runtime/entity/response/GetAuthInfoResponse.js +0 -2
- package/dist/runtime/entity/response/HealthCheckResponse.js +0 -2
- package/dist/runtime/entity/response/UploadFileResponse.js +0 -2
- package/dist/runtime/helper/CodeHelper.js +0 -63
- package/dist/runtime/helper/ConverterService.js +0 -275
- package/dist/runtime/helper/EnumUtility.js +0 -33
- package/dist/runtime/helper/GNSupport.js +0 -47
- package/dist/runtime/helper/GNUtils.js +0 -72
- package/dist/runtime/helper/MessagePackConverterService.js +0 -9
- package/dist/runtime/helper/OperationHelper.js +0 -24
- package/dist/runtime/helper/StorageService.js +0 -62
- package/dist/runtime/logger/GNDebug.js +0 -29
- package/dist/runtime/networking/AuthenticateStatus.js +0 -14
- package/dist/runtime/networking/IPeer.js +0 -1
- package/dist/runtime/networking/NetworkingPeer.js +0 -210
- package/dist/runtime/networking/OperationPending.js +0 -53
- package/dist/runtime/networking/PeerBase.js +0 -161
- package/dist/runtime/networking/handler/IServerEventHandler.js +0 -13
- package/dist/runtime/networking/handler/OnCharacterPlayerFriendUpdateEventHandler.js +0 -39
- package/dist/runtime/networking/handler/OnCharacterPlayerGroupUpdateEventHandler.js +0 -39
- package/dist/runtime/networking/handler/OnGamePlayerFriendUpdateEventHandler.js +0 -39
- package/dist/runtime/networking/handler/OnGamePlayerGroupUpdateEventHandler.js +0 -39
- package/dist/runtime/networking/handler/OnGroupMemberUpdateEventHandler.js +0 -35
- package/dist/runtime/networking/handler/OnGroupMessageUpdateEventHandler.js +0 -43
- package/dist/runtime/networking/http/HttpPeer.js +0 -123
- package/dist/runtime/networking/http/NetworkingHttpPeerBase.js +0 -9
- package/dist/runtime/networking/http/NetworkingPeerAxiosRequest.js +0 -179
- package/dist/runtime/networking/socket/NetworkingPeerSocketIOClient.js +0 -130
- package/dist/runtime/networking/socket/NetworkingSocketPeerBase.js +0 -165
- package/dist/runtime/networking/socket/SocketPeer.js +0 -115
- package/dist/runtime/typescript/ServiceUpdate.js +0 -22
- 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
|
@@ -27,66 +27,750 @@ import { CloudScriptApi } from "./GNNetworkCloudScriptApi";
|
|
|
27
27
|
import { GetAuthInfoResponse } from "./entity/response/GetAuthInfoResponse";
|
|
28
28
|
import { UploadFileResponse } from "./entity/response/UploadFileResponse";
|
|
29
29
|
import { HealthCheckResponse } from "./entity/response/HealthCheckResponse";
|
|
30
|
+
/**
|
|
31
|
+
* Static facade that owns the entire GearN client SDK runtime state.
|
|
32
|
+
*
|
|
33
|
+
* Application code never instantiates `GNNetwork` directly — it calls
|
|
34
|
+
* {@link init} once with a populated {@link GNServerSettings} and then
|
|
35
|
+
* issues operations through the static API namespaces ({@link authenticate},
|
|
36
|
+
* {@link characterPlayer}, {@link group}, ...) or the low-level
|
|
37
|
+
* `sendVia*` helpers.
|
|
38
|
+
*
|
|
39
|
+
* Responsibility:
|
|
40
|
+
* - Owns the shared {@link NetworkingPeer} that bundles the HTTP and
|
|
41
|
+
* socket transports.
|
|
42
|
+
* - Persists the auth token and user id through {@link StorageService} so
|
|
43
|
+
* that a page reload or process restart automatically resumes the
|
|
44
|
+
* previous session.
|
|
45
|
+
* - Exposes typed helpers for arbitrary `OperationRequest` /
|
|
46
|
+
* `OperationResponse` pairs (`sendViaSocketTRequestTResponse`,
|
|
47
|
+
* `sendViaHttpTRequestTResponse`) used internally by the generated
|
|
48
|
+
* `*Api` wrappers.
|
|
49
|
+
* - Surfaces realtime hooks: socket connect / disconnect callbacks plus
|
|
50
|
+
* typed {@link IServerEventHandler} subscription.
|
|
51
|
+
*
|
|
52
|
+
* Threading model:
|
|
53
|
+
* - JavaScript is single-threaded so all members are safe to access from
|
|
54
|
+
* any callback. The `service()` loop driven by {@link ServiceUpdate}
|
|
55
|
+
* uses `setInterval`-style scheduling and shares no synchronisation
|
|
56
|
+
* primitives with caller code.
|
|
57
|
+
*
|
|
58
|
+
* Initialisation contract:
|
|
59
|
+
* - {@link init} is idempotent — calling it twice logs a warning and
|
|
60
|
+
* returns without re-initialising. There is no `dispose()` counterpart;
|
|
61
|
+
* the static state lives for the lifetime of the JS realm.
|
|
62
|
+
* - All static API namespaces ({@link authenticate}, {@link group}, ...)
|
|
63
|
+
* are `undefined` until `init()` finishes. Accessing them earlier will
|
|
64
|
+
* throw `TypeError`.
|
|
65
|
+
*/
|
|
30
66
|
export declare class GNNetwork {
|
|
67
|
+
/**
|
|
68
|
+
* Storage key used by {@link StorageService} to persist the most
|
|
69
|
+
* recent successful auth token.
|
|
70
|
+
*
|
|
71
|
+
* The key is intentionally namespaced (`[GearN]_` prefix) so that an
|
|
72
|
+
* application embedding multiple SDKs into the same browser
|
|
73
|
+
* `localStorage` cannot collide with GearN entries.
|
|
74
|
+
*/
|
|
31
75
|
static readonly AUTH_TOKEN_KEY = "[GearN]_AUTH_TOKEN_KEY";
|
|
76
|
+
/**
|
|
77
|
+
* Storage key used by {@link StorageService} to persist the user id
|
|
78
|
+
* that was bound to the cached auth token.
|
|
79
|
+
*
|
|
80
|
+
* Restored together with {@link AUTH_TOKEN_KEY} during {@link init}
|
|
81
|
+
* so the SDK can hydrate `getAuthenticateStatus().getUserId()`
|
|
82
|
+
* without an extra round trip.
|
|
83
|
+
*/
|
|
32
84
|
static readonly USER_ID_KEY = "[GearN]_USER_ID_KEY";
|
|
33
|
-
|
|
85
|
+
/**
|
|
86
|
+
* Active runtime configuration. Populated by {@link init} and treated
|
|
87
|
+
* as the single source of truth for URLs, transport tuning and the
|
|
88
|
+
* configured `secretKey` / `gameId`.
|
|
89
|
+
*
|
|
90
|
+
* Remains `null` before `init()` runs, which is also the sentinel
|
|
91
|
+
* used to make `init()` idempotent.
|
|
92
|
+
*/
|
|
34
93
|
private static gnServerSettings;
|
|
94
|
+
/**
|
|
95
|
+
* Returns the shared {@link GNServerSettings} instance owned by the
|
|
96
|
+
* SDK.
|
|
97
|
+
*
|
|
98
|
+
* Useful for inspecting URLs / tuning values at runtime, or for
|
|
99
|
+
* mutating them on the fly through the dedicated `set*` accessors of
|
|
100
|
+
* `GNServerSettings`.
|
|
101
|
+
*
|
|
102
|
+
* @returns The active settings instance, or `undefined` when called
|
|
103
|
+
* before {@link init}.
|
|
104
|
+
*/
|
|
35
105
|
static getGNServerSettings(): GNServerSettings;
|
|
106
|
+
/**
|
|
107
|
+
* Shared low-level networking peer. Instantiated by
|
|
108
|
+
* {@link initGNSocketObject} and never replaced. Owns both the HTTP
|
|
109
|
+
* peer ({@link HttpPeer}) and the socket peer ({@link SocketPeer}).
|
|
110
|
+
*
|
|
111
|
+
* Marked `public` only because the `*Api` wrappers and integration
|
|
112
|
+
* tests need to reach the underlying transports directly. Application
|
|
113
|
+
* code should normally go through the typed helpers or domain APIs
|
|
114
|
+
* instead of touching this object.
|
|
115
|
+
*/
|
|
36
116
|
static peer: NetworkingPeer;
|
|
117
|
+
/**
|
|
118
|
+
* Returns the averaged transport latency in milliseconds across every
|
|
119
|
+
* transport currently marked as `isUsing()`.
|
|
120
|
+
*
|
|
121
|
+
* The transports compute their own ping using a sliding window of the
|
|
122
|
+
* last 10 successful round trips (see {@link PeerBase.addPing}). When
|
|
123
|
+
* both HTTP and socket transports are active, this method returns
|
|
124
|
+
* their unweighted arithmetic mean.
|
|
125
|
+
*
|
|
126
|
+
* @returns Average latency in milliseconds, or `-1` when neither
|
|
127
|
+
* transport is enabled or no successful request has produced
|
|
128
|
+
* a measurement yet.
|
|
129
|
+
*/
|
|
37
130
|
static getPing(): number;
|
|
131
|
+
/**
|
|
132
|
+
* Returns the socket session id assigned by the socket.io server.
|
|
133
|
+
*
|
|
134
|
+
* The session id is non-empty only after the socket has completed its
|
|
135
|
+
* connect handshake — use {@link isSocketConnected} for a boolean
|
|
136
|
+
* connection check.
|
|
137
|
+
*
|
|
138
|
+
* @returns Current socket id, or `""` (empty string) when the SDK is
|
|
139
|
+
* not initialised or the socket is not connected.
|
|
140
|
+
*/
|
|
38
141
|
static getSocketSId(): string;
|
|
142
|
+
/**
|
|
143
|
+
* Pushes the cached auth token to the socket channel.
|
|
144
|
+
*
|
|
145
|
+
* Required after a fresh socket connect because the socket.io session
|
|
146
|
+
* has no concept of HTTP cookies — the backend needs the explicit
|
|
147
|
+
* auth frame to associate the socket with a user. Most callers do not
|
|
148
|
+
* need to invoke this manually because the SDK fires it from its own
|
|
149
|
+
* connect handler when an auth token is present.
|
|
150
|
+
*
|
|
151
|
+
* @throws TypeError when called before {@link init} has populated
|
|
152
|
+
* {@link peer}.
|
|
153
|
+
*/
|
|
39
154
|
static sendRequestAuthSocket(): void;
|
|
155
|
+
/**
|
|
156
|
+
* Returns whether the socket transport currently holds a non-empty
|
|
157
|
+
* session id.
|
|
158
|
+
*
|
|
159
|
+
* Implementation detail: this checks the cached
|
|
160
|
+
* {@link getSocketSId} string rather than asking the underlying
|
|
161
|
+
* socket.io client directly. The two stay in sync because the SDK
|
|
162
|
+
* clears the cached id on disconnect.
|
|
163
|
+
*
|
|
164
|
+
* @returns `true` while the socket has an active session, `false`
|
|
165
|
+
* when uninitialised or disconnected.
|
|
166
|
+
*/
|
|
40
167
|
static isSocketConnected(): boolean;
|
|
168
|
+
/**
|
|
169
|
+
* Returns the SDK's best estimate of the current server clock in
|
|
170
|
+
* **milliseconds since epoch**.
|
|
171
|
+
*
|
|
172
|
+
* After at least one successful response the peer rebases the local
|
|
173
|
+
* `Date.now()` against the latest server timestamp it has observed
|
|
174
|
+
* (see {@link PeerBase.onResponseHandler} and
|
|
175
|
+
* {@link NetworkingPeer.setServerTimeMilliseconds}). Until then this
|
|
176
|
+
* method falls back to the local `Date.now()` so caller code can use
|
|
177
|
+
* it without a null check.
|
|
178
|
+
*
|
|
179
|
+
* @returns Estimated server timestamp. Always defined, never `null`.
|
|
180
|
+
*/
|
|
41
181
|
static getServerTimestamp(): number;
|
|
182
|
+
/**
|
|
183
|
+
* Returns the shared cache of auth-related state (auth token + user
|
|
184
|
+
* id) tracked by the networking peer.
|
|
185
|
+
*
|
|
186
|
+
* @returns The shared {@link AuthenticateStatus} instance. Mutating
|
|
187
|
+
* its fields directly bypasses {@link StorageService} — for
|
|
188
|
+
* a persisted update prefer
|
|
189
|
+
* {@link setNewAuthenticateStatus}.
|
|
190
|
+
*
|
|
191
|
+
* @throws TypeError when called before {@link init}.
|
|
192
|
+
*/
|
|
42
193
|
static getAuthenticateStatus(): AuthenticateStatus;
|
|
43
|
-
|
|
194
|
+
/**
|
|
195
|
+
* Returns a string describing the runtime detected by
|
|
196
|
+
* {@link GNSupport}.
|
|
197
|
+
*
|
|
198
|
+
* Possible return values: `"browser"`, `"nodejs"`, `"cocos"`. Useful
|
|
199
|
+
* for switching between platform-specific code paths in higher-level
|
|
200
|
+
* application code (analytics SDKs, file pickers, ...).
|
|
201
|
+
*
|
|
202
|
+
* @returns Detected platform identifier.
|
|
203
|
+
*/
|
|
44
204
|
static getPlatform(): string;
|
|
205
|
+
/**
|
|
206
|
+
* Authentication API namespace — login, register and refresh-token
|
|
207
|
+
* operations executed over HTTP with `RequestRole.Client`.
|
|
208
|
+
*
|
|
209
|
+
* Instantiated during {@link init}. The wrapper also exposes
|
|
210
|
+
* `.server` and `.admin` sub-namespaces for symmetry, but those are
|
|
211
|
+
* currently empty for the Authenticate domain.
|
|
212
|
+
*/
|
|
45
213
|
static authenticate: AuthenticateApi;
|
|
214
|
+
/**
|
|
215
|
+
* Character-player API namespace — gameplay-tier player operations:
|
|
216
|
+
* profile, social graph (friends, groups), tags, currencies and
|
|
217
|
+
* statistics scoped to a single in-game character. Executed over HTTP.
|
|
218
|
+
*/
|
|
46
219
|
static characterPlayer: CharacterPlayerApi;
|
|
220
|
+
/**
|
|
221
|
+
* Content API namespace — file metadata, upload-token and
|
|
222
|
+
* download-token operations. Pair the typed responses with
|
|
223
|
+
* {@link uploadFile} and {@link getDownloadFileUrl} for the actual
|
|
224
|
+
* binary transfer.
|
|
225
|
+
*/
|
|
47
226
|
static content: ContentApi;
|
|
227
|
+
/**
|
|
228
|
+
* Dashboard / admin API namespace.
|
|
229
|
+
*
|
|
230
|
+
* The backend resolves admin-vs-client privileges from the auth token
|
|
231
|
+
* itself, so the same wrapper exposes both the data-access methods
|
|
232
|
+
* used by tools and the admin operations that need an
|
|
233
|
+
* `AdminAccount`-issued token.
|
|
234
|
+
*/
|
|
48
235
|
static dashboard: DashboardApi;
|
|
236
|
+
/**
|
|
237
|
+
* Game-player API namespace — account-level player profile, identity
|
|
238
|
+
* link / unlink, friend graph, group membership and notifications
|
|
239
|
+
* scoped to the master player record.
|
|
240
|
+
*/
|
|
49
241
|
static gamePlayer: GamePlayerApi;
|
|
242
|
+
/**
|
|
243
|
+
* Group API namespace — group metadata, member roles, message wall,
|
|
244
|
+
* group currencies and group statistics.
|
|
245
|
+
*/
|
|
50
246
|
static group: GroupApi;
|
|
247
|
+
/**
|
|
248
|
+
* Inventory API namespace — item metadata, ownership ledger,
|
|
249
|
+
* per-owner amounts, item statistics and audit log.
|
|
250
|
+
*/
|
|
51
251
|
static inventory: InventoryApi;
|
|
252
|
+
/**
|
|
253
|
+
* Master-player API namespace — account / identity / profile
|
|
254
|
+
* operations bound to the global master player record (one per
|
|
255
|
+
* GearN account).
|
|
256
|
+
*/
|
|
52
257
|
static masterPlayer: MasterPlayerApi;
|
|
258
|
+
/**
|
|
259
|
+
* Store API namespace — catalog browsing, purchase, gift, receipt
|
|
260
|
+
* validation and audit operations.
|
|
261
|
+
*/
|
|
53
262
|
static storeInventory: StoreInventoryApi;
|
|
263
|
+
/**
|
|
264
|
+
* Multiplayer API namespace — matchmaking ticket lifecycle and
|
|
265
|
+
* match-history queries.
|
|
266
|
+
*/
|
|
54
267
|
static multiplayer: MultiplayerApi;
|
|
268
|
+
/**
|
|
269
|
+
* CloudScript API namespace — backend-hosted script execute, publish
|
|
270
|
+
* and version-management operations.
|
|
271
|
+
*/
|
|
55
272
|
static cloudScript: CloudScriptApi;
|
|
273
|
+
/**
|
|
274
|
+
* Boots every static piece of SDK state.
|
|
275
|
+
*
|
|
276
|
+
* Steps performed in order:
|
|
277
|
+
* 1. Reject second invocations — when {@link gnServerSettings} is
|
|
278
|
+
* already populated the call logs a warning and returns. This makes
|
|
279
|
+
* the method safe to invoke from multiple bootstrap paths in the
|
|
280
|
+
* host application.
|
|
281
|
+
* 2. Initialise the lookup tables and platform detection helpers
|
|
282
|
+
* ({@link GNSupport}, {@link CodeHelper},
|
|
283
|
+
* {@link ConverterService}). These must run before any model
|
|
284
|
+
* serialises or any code reads `getPlatform()`.
|
|
285
|
+
* 3. Cache the supplied settings, configure {@link GNDebug} from them
|
|
286
|
+
* and emit the SDK banner including {@link getClientSdkVersion}.
|
|
287
|
+
* 4. Build the shared {@link NetworkingPeer} via
|
|
288
|
+
* {@link initGNSocketObject} and start the {@link ServiceUpdate}
|
|
289
|
+
* loop that drives the queue and timeout machinery.
|
|
290
|
+
* 5. Hydrate {@link AuthenticateStatus} from the persisted
|
|
291
|
+
* `[GearN]_AUTH_TOKEN_KEY` and `[GearN]_USER_ID_KEY` entries so a
|
|
292
|
+
* process restart can resume the prior session without an explicit
|
|
293
|
+
* re-login.
|
|
294
|
+
* 6. Instantiate every public `*Api` namespace.
|
|
295
|
+
*
|
|
296
|
+
* @param gnServerSettings Configured runtime parameters. The SDK
|
|
297
|
+
* keeps a live reference to this object — do
|
|
298
|
+
* not mutate it concurrently from another
|
|
299
|
+
* thread (in browsers there is none, in
|
|
300
|
+
* Node.js use the dedicated `set*` accessors
|
|
301
|
+
* and avoid worker-thread sharing).
|
|
302
|
+
*/
|
|
56
303
|
static init(gnServerSettings: GNServerSettings): void;
|
|
304
|
+
/**
|
|
305
|
+
* Persists a new auth-token / user-id pair to {@link StorageService}
|
|
306
|
+
* and reflects the change into the shared {@link AuthenticateStatus}.
|
|
307
|
+
*
|
|
308
|
+
* Used after operations that mint or rotate a token outside the
|
|
309
|
+
* normal login flow — e.g. server-issued auth handoff, custom
|
|
310
|
+
* delegated-auth integrations, or a manual restore from a known good
|
|
311
|
+
* snapshot.
|
|
312
|
+
*
|
|
313
|
+
* The normal login flows do **not** need this helper because
|
|
314
|
+
* {@link PeerBase.onResponseHandler} already updates both the cache
|
|
315
|
+
* and storage every time a successful response includes an
|
|
316
|
+
* `authToken` / `userId` field.
|
|
317
|
+
*
|
|
318
|
+
* @param authenticateStatus Source of the new values. Only its
|
|
319
|
+
* `getAuthToken()` and `getUserId()` are
|
|
320
|
+
* inspected; the object itself is not
|
|
321
|
+
* retained.
|
|
322
|
+
*/
|
|
57
323
|
static setNewAuthenticateStatus(authenticateStatus: AuthenticateStatus): void;
|
|
58
|
-
|
|
324
|
+
/**
|
|
325
|
+
* Returns the public SDK version string.
|
|
326
|
+
*
|
|
327
|
+
* Reflects the {@link VERSION} constant declared at the top of this
|
|
328
|
+
* file. Useful when reporting bugs to GearN support — include the
|
|
329
|
+
* version in any issue you file.
|
|
330
|
+
*
|
|
331
|
+
* @returns Semantic-version-like string (e.g. `"2.6"`).
|
|
332
|
+
*/
|
|
59
333
|
static getClientSdkVersion(): string;
|
|
334
|
+
/**
|
|
335
|
+
* Legacy hook from the original Unity client SDK.
|
|
336
|
+
*
|
|
337
|
+
* The Unity SDK loaded its `GNServerSettings` from a Resources asset
|
|
338
|
+
* which the editor menu helped author. The TypeScript SDK accepts the
|
|
339
|
+
* settings object as a constructor argument to {@link init} instead,
|
|
340
|
+
* so this method does nothing — it remains so future SDK ports can
|
|
341
|
+
* reuse the same `init()` call sequence without diverging from the
|
|
342
|
+
* original.
|
|
343
|
+
*/
|
|
60
344
|
private static initServerSettings;
|
|
345
|
+
/**
|
|
346
|
+
* Configures {@link GNDebug} from the active {@link GNServerSettings}.
|
|
347
|
+
*
|
|
348
|
+
* Asserts that {@link gnServerSettings} has been populated — failing
|
|
349
|
+
* loudly here is intentional because every later call relies on the
|
|
350
|
+
* settings reference being valid.
|
|
351
|
+
*
|
|
352
|
+
* @throws Error when {@link gnServerSettings} is `null`.
|
|
353
|
+
*/
|
|
61
354
|
private static initGNDebug;
|
|
355
|
+
/**
|
|
356
|
+
* Builds the shared {@link NetworkingPeer} and starts the
|
|
357
|
+
* {@link ServiceUpdate} loop.
|
|
358
|
+
*
|
|
359
|
+
* The service loop ticks at a fixed interval and calls
|
|
360
|
+
* `peer.service()` on every tick, which lets the HTTP and socket
|
|
361
|
+
* peers (a) drain their pending queues at the configured `sendRate`
|
|
362
|
+
* and (b) detect timed-out in-flight operations.
|
|
363
|
+
*
|
|
364
|
+
* Called exactly once from {@link init}; never invoked again because
|
|
365
|
+
* the peer reference and the service loop are designed to live for
|
|
366
|
+
* the lifetime of the JS realm.
|
|
367
|
+
*/
|
|
62
368
|
private static initGNSocketObject;
|
|
369
|
+
/**
|
|
370
|
+
* Sends a low-level {@link OperationRequest} through the socket
|
|
371
|
+
* transport.
|
|
372
|
+
*
|
|
373
|
+
* This is the rawest entry point — most application code should use
|
|
374
|
+
* the typed `sendViaSocketTRequestTResponse` helper or the domain
|
|
375
|
+
* `*Api` wrappers instead. Use this method only when you already have
|
|
376
|
+
* a hand-built `OperationRequest` (custom op-codes, replay tooling,
|
|
377
|
+
* advanced testing) and explicitly want the socket transport.
|
|
378
|
+
*
|
|
379
|
+
* The peer fills the `authToken` and `secretKey` slots from the
|
|
380
|
+
* shared {@link AuthenticateStatus} / {@link GNServerSettings} when
|
|
381
|
+
* the corresponding override parameter is `null`, and always attaches
|
|
382
|
+
* the configured `gameId` from `GNServerSettings.getGameId()`.
|
|
383
|
+
*
|
|
384
|
+
* @param requestType Logical request category (Authenticate /
|
|
385
|
+
* CharacterPlayer / ...). Embedded in the
|
|
386
|
+
* socket frame and used by the backend to
|
|
387
|
+
* pick the correct handler.
|
|
388
|
+
* @param role `RequestRole.Client`, `Server` or `Admin`.
|
|
389
|
+
* Determines which permission table the
|
|
390
|
+
* backend evaluates against the auth token.
|
|
391
|
+
* @param request Pre-built request payload — the peer
|
|
392
|
+
* assigns a `requestId` when the existing
|
|
393
|
+
* value is `-1` so the response can be
|
|
394
|
+
* correlated.
|
|
395
|
+
* @param onResponse Optional callback fired with the resolved
|
|
396
|
+
* {@link OperationResponse}. Pass `null`
|
|
397
|
+
* for fire-and-forget semantics; the SDK
|
|
398
|
+
* still tracks timeouts but the result is
|
|
399
|
+
* dropped.
|
|
400
|
+
* @param overrideAuthToken Use a one-shot auth token instead of the
|
|
401
|
+
* cached one. Pass `null` to use the cache.
|
|
402
|
+
* @param overrideSecretKey Use a one-shot secret key instead of the
|
|
403
|
+
* configured one. Pass `null` for the
|
|
404
|
+
* default.
|
|
405
|
+
* @param customTags Optional bag of routing / telemetry tags
|
|
406
|
+
* merged into the outbound payload.
|
|
407
|
+
*/
|
|
63
408
|
static sendViaSocket(requestType: RequestType, role: RequestRole, request: OperationRequest, onResponse: Action1<OperationResponse>, overrideAuthToken: string, overrideSecretKey: string, customTags: GNHashtable): void;
|
|
409
|
+
/**
|
|
410
|
+
* Promise-based wrapper around {@link sendViaSocket}.
|
|
411
|
+
*
|
|
412
|
+
* The promise always resolves (it never rejects). On a transport
|
|
413
|
+
* error or timeout the resolved {@link OperationResponse} carries a
|
|
414
|
+
* non-zero `returnCode` that callers should check via
|
|
415
|
+
* `response.hasError()`.
|
|
416
|
+
*
|
|
417
|
+
* @returns Promise of the typed response.
|
|
418
|
+
*/
|
|
64
419
|
static sendViaSocketAsync(requestType: RequestType, role: RequestRole, request: OperationRequest, overrideAuthToken: string, overrideSecretKey: string, customTags: GNHashtable): Promise<OperationResponse>;
|
|
420
|
+
/**
|
|
421
|
+
* Sends a low-level {@link OperationRequest} through the HTTP
|
|
422
|
+
* transport.
|
|
423
|
+
*
|
|
424
|
+
* Mirror of {@link sendViaSocket}. See that method's documentation
|
|
425
|
+
* for the parameter contract — the only behavioural difference is
|
|
426
|
+
* the choice of transport, which determines which queue the request
|
|
427
|
+
* is enqueued into and which serializer is used (JSON over Axios for
|
|
428
|
+
* HTTP, MsgPack/JSON over socket.io for the socket peer).
|
|
429
|
+
*
|
|
430
|
+
* Prefer HTTP for request/response operations that do not require
|
|
431
|
+
* realtime push, and the socket peer for low-latency or
|
|
432
|
+
* server-initiated traffic.
|
|
433
|
+
*
|
|
434
|
+
* @param requestType See {@link sendViaSocket}.
|
|
435
|
+
* @param role See {@link sendViaSocket}.
|
|
436
|
+
* @param request See {@link sendViaSocket}.
|
|
437
|
+
* @param onResponse See {@link sendViaSocket}.
|
|
438
|
+
* @param overrideAuthToken See {@link sendViaSocket}.
|
|
439
|
+
* @param overrideSecretKey See {@link sendViaSocket}.
|
|
440
|
+
* @param customTags See {@link sendViaSocket}.
|
|
441
|
+
*/
|
|
65
442
|
static sendViaHttp(requestType: RequestType, role: RequestRole, request: OperationRequest, onResponse: Action1<OperationResponse>, overrideAuthToken: string, overrideSecretKey: string, customTags: GNHashtable): void;
|
|
443
|
+
/**
|
|
444
|
+
* Promise-based wrapper around {@link sendViaHttp}.
|
|
445
|
+
*
|
|
446
|
+
* Same resolution contract as {@link sendViaSocketAsync}: always
|
|
447
|
+
* resolves; transport errors and timeouts surface through
|
|
448
|
+
* `response.hasError()`.
|
|
449
|
+
*
|
|
450
|
+
* @returns Promise of the typed response.
|
|
451
|
+
*/
|
|
66
452
|
static sendViaHttpAsync(requestType: RequestType, role: RequestRole, request: OperationRequest, overrideAuthToken: string, overrideSecretKey: string, customTags: GNHashtable): Promise<OperationResponse>;
|
|
453
|
+
/**
|
|
454
|
+
* Sends a typed {@link CustomOperationRequest} through the socket
|
|
455
|
+
* transport and deserialises the response into the supplied
|
|
456
|
+
* {@link CustomOperationResponse} subclass.
|
|
457
|
+
*
|
|
458
|
+
* Used internally by every generated `*Api` wrapper. Application
|
|
459
|
+
* code reaches for it directly when implementing a custom request
|
|
460
|
+
* type that does not yet have a wrapper.
|
|
461
|
+
*
|
|
462
|
+
* @param request Source request — its
|
|
463
|
+
* `getRequestType()`,
|
|
464
|
+
* `getRole()` and `build()` are
|
|
465
|
+
* called to obtain the wire
|
|
466
|
+
* payload.
|
|
467
|
+
* @param onResponse Optional typed callback.
|
|
468
|
+
* @param overrideAuthToken Optional one-shot auth token.
|
|
469
|
+
* @param overrideSecretKey Optional one-shot secret key.
|
|
470
|
+
* @param customTags Optional routing tags.
|
|
471
|
+
* @param customOperationResponseCls Concrete response class — the
|
|
472
|
+
* SDK instantiates it via
|
|
473
|
+
* `new customOperationResponseCls()`
|
|
474
|
+
* and calls
|
|
475
|
+
* `setupOperationResponse(...)`
|
|
476
|
+
* on the result.
|
|
477
|
+
*/
|
|
67
478
|
static sendViaSocketTRequestTResponse<TRequest extends CustomOperationRequest, TResponse extends CustomOperationResponse>(request: TRequest, onResponse: Action1<TResponse>, overrideAuthToken: string, overrideSecretKey: string, customTags: GNHashtable, customOperationResponseCls: Constructor<TResponse>): void;
|
|
479
|
+
/**
|
|
480
|
+
* Promise-based wrapper around
|
|
481
|
+
* {@link sendViaSocketTRequestTResponse}.
|
|
482
|
+
*
|
|
483
|
+
* @returns Promise of the typed response.
|
|
484
|
+
*/
|
|
68
485
|
static sendViaSocketTRequestTResponseAsync<TRequest extends CustomOperationRequest, TResponse extends CustomOperationResponse>(request: TRequest, overrideAuthToken: string, overrideSecretKey: string, customTags: GNHashtable, customOperationResponseCls: Constructor<TResponse>): Promise<TResponse>;
|
|
486
|
+
/**
|
|
487
|
+
* Sends a typed {@link CustomOperationRequest} through the HTTP
|
|
488
|
+
* transport.
|
|
489
|
+
*
|
|
490
|
+
* Same contract as {@link sendViaSocketTRequestTResponse} but routes
|
|
491
|
+
* the request through Axios instead of socket.io. This is the
|
|
492
|
+
* helper invoked by every method on the generated `*Api` classes.
|
|
493
|
+
*/
|
|
69
494
|
static sendViaHttpTRequestTResponse<TRequest extends CustomOperationRequest, TResponse extends CustomOperationResponse>(request: TRequest, onResponse: Action1<TResponse>, overrideAuthToken: string, overrideSecretKey: string, customTags: GNHashtable, customOperationResponseCls: Constructor<TResponse>): void;
|
|
495
|
+
/**
|
|
496
|
+
* Promise-based wrapper around
|
|
497
|
+
* {@link sendViaHttpTRequestTResponse}.
|
|
498
|
+
*
|
|
499
|
+
* @returns Promise of the typed response.
|
|
500
|
+
*/
|
|
70
501
|
static sendViaHttpTRequestTResponseAsync<TRequest extends CustomOperationRequest, TResponse extends CustomOperationResponse>(request: TRequest, overrideAuthToken: string, overrideSecretKey: string, customTags: GNHashtable, customOperationResponseCls: Constructor<TResponse>): Promise<TResponse>;
|
|
502
|
+
/**
|
|
503
|
+
* Sends a low-level {@link OperationRequest} through the socket
|
|
504
|
+
* transport but deserialises the result into a typed
|
|
505
|
+
* {@link CustomOperationResponse} subclass.
|
|
506
|
+
*
|
|
507
|
+
* Use this when your call site has a hand-built `OperationRequest`
|
|
508
|
+
* (already encoded with the right `operationCode` and parameters)
|
|
509
|
+
* but still wants the convenience of a typed response object.
|
|
510
|
+
*
|
|
511
|
+
* The callback is **not** invoked when the underlying transport
|
|
512
|
+
* yields a `null` response — this matches the historical behaviour
|
|
513
|
+
* the Unity SDK relied on. Wrap the call in a timeout watchdog if
|
|
514
|
+
* you need a guaranteed final notification.
|
|
515
|
+
*
|
|
516
|
+
* @param requestType See {@link sendViaSocket}.
|
|
517
|
+
* @param role See {@link sendViaSocket}.
|
|
518
|
+
* @param request See {@link sendViaSocket}.
|
|
519
|
+
* @param onResponse Optional typed callback. Pass
|
|
520
|
+
* `null` for fire-and-forget.
|
|
521
|
+
* @param overrideAuthToken Optional one-shot auth token.
|
|
522
|
+
* @param overrideSecretKey Optional one-shot secret key.
|
|
523
|
+
* @param customTags Optional routing tags.
|
|
524
|
+
* @param customOperationResponseCls Concrete response class.
|
|
525
|
+
*/
|
|
71
526
|
static sendViaSocketTResponse<TResponse extends CustomOperationResponse>(requestType: RequestType, role: RequestRole, request: OperationRequest, onResponse: Action1<TResponse>, overrideAuthToken: string, overrideSecretKey: string, customTags: GNHashtable, customOperationResponseCls: Constructor<TResponse>): void;
|
|
527
|
+
/**
|
|
528
|
+
* Promise-based wrapper around {@link sendViaSocketTResponse}.
|
|
529
|
+
*
|
|
530
|
+
* Like the underlying method, the promise never rejects but may stay
|
|
531
|
+
* pending forever if the transport drops the response without
|
|
532
|
+
* triggering a timeout. Pair with `Promise.race` against an
|
|
533
|
+
* application-side timer when that matters.
|
|
534
|
+
*
|
|
535
|
+
* @returns Promise of the typed response.
|
|
536
|
+
*/
|
|
72
537
|
static sendViaSocketTResponseAsync<TResponse extends CustomOperationResponse>(requestType: RequestType, role: RequestRole, request: OperationRequest, overrideAuthToken: string, overrideSecretKey: string, customTags: GNHashtable, customOperationResponseCls: Constructor<TResponse>): Promise<TResponse>;
|
|
538
|
+
/**
|
|
539
|
+
* Sends a low-level {@link OperationRequest} through the HTTP
|
|
540
|
+
* transport and deserialises the result into a typed
|
|
541
|
+
* {@link CustomOperationResponse} subclass.
|
|
542
|
+
*
|
|
543
|
+
* HTTP mirror of {@link sendViaSocketTResponse}. Same `null` short
|
|
544
|
+
* circuit applies: when the transport yields a `null` response the
|
|
545
|
+
* callback is not invoked.
|
|
546
|
+
*
|
|
547
|
+
* @param requestType See {@link sendViaSocket}.
|
|
548
|
+
* @param role See {@link sendViaSocket}.
|
|
549
|
+
* @param request See {@link sendViaSocket}.
|
|
550
|
+
* @param onResponse Optional typed callback.
|
|
551
|
+
* @param overrideAuthToken Optional one-shot auth token.
|
|
552
|
+
* @param overrideSecretKey Optional one-shot secret key.
|
|
553
|
+
* @param customTags Optional routing tags.
|
|
554
|
+
* @param customOperationResponseCls Concrete response class.
|
|
555
|
+
*/
|
|
73
556
|
static sendViaHttpTResponse<TResponse extends CustomOperationResponse>(requestType: RequestType, role: RequestRole, request: OperationRequest, onResponse: Action1<TResponse>, overrideAuthToken: string, overrideSecretKey: string, customTags: GNHashtable, customOperationResponseCls: Constructor<TResponse>): void;
|
|
557
|
+
/**
|
|
558
|
+
* Promise-based wrapper around {@link sendViaHttpTResponse}.
|
|
559
|
+
*
|
|
560
|
+
* @returns Promise of the typed response.
|
|
561
|
+
*/
|
|
74
562
|
static sendViaHttpTResponseAsync<TResponse extends CustomOperationResponse>(requestType: RequestType, role: RequestRole, request: OperationRequest, overrideAuthToken: string, overrideSecretKey: string, customTags: GNHashtable, customOperationResponseCls: Constructor<TResponse>): Promise<TResponse>;
|
|
563
|
+
/**
|
|
564
|
+
* Opens the socket transport.
|
|
565
|
+
*
|
|
566
|
+
* Triggers the underlying socket.io client to dial the configured
|
|
567
|
+
* URL using the SSL / port settings active at the time of the call.
|
|
568
|
+
* Subsequent connect notifications fire on every callback registered
|
|
569
|
+
* through {@link subscriberOnConnectHandler}.
|
|
570
|
+
*
|
|
571
|
+
* @param _onSocketConnect Optional callback invoked once the socket
|
|
572
|
+
* finishes its connect handshake. Pass
|
|
573
|
+
* `null` (default) when other connect hooks
|
|
574
|
+
* are sufficient.
|
|
575
|
+
*/
|
|
75
576
|
static connectSocket(_onSocketConnect?: Action0): void;
|
|
577
|
+
/**
|
|
578
|
+
* Closes the socket transport.
|
|
579
|
+
*
|
|
580
|
+
* Sends the disconnect frame, drops every pending socket-bound
|
|
581
|
+
* operation in the queue, and triggers every callback registered
|
|
582
|
+
* through {@link subscriberOnDisconnectHandler}.
|
|
583
|
+
*
|
|
584
|
+
* @param _onSocketDisconnect Optional callback invoked once the
|
|
585
|
+
* socket reports `disconnect`.
|
|
586
|
+
*/
|
|
76
587
|
static disconnectSocket(_onSocketDisconnect?: Action0): void;
|
|
588
|
+
/**
|
|
589
|
+
* Replaces the raw event callback that observes every incoming
|
|
590
|
+
* server event.
|
|
591
|
+
*
|
|
592
|
+
* Only one raw observer is installed at a time — calling this method
|
|
593
|
+
* again overwrites the previous handler. For non-destructive
|
|
594
|
+
* subscriptions use {@link subscriberServerEventHandler} with a
|
|
595
|
+
* dedicated typed handler.
|
|
596
|
+
*
|
|
597
|
+
* @param _onEventHandler Receiver invoked with every decoded
|
|
598
|
+
* {@link OperationEvent} as it arrives. Pass
|
|
599
|
+
* `null` to clear the slot.
|
|
600
|
+
*/
|
|
77
601
|
static setOnEventHandler(_onEventHandler: Action1<OperationEvent>): void;
|
|
602
|
+
/**
|
|
603
|
+
* Adds a callback to the multi-subscriber socket-connect channel.
|
|
604
|
+
*
|
|
605
|
+
* Unlike {@link setOnEventHandler}, the connect / disconnect channel
|
|
606
|
+
* accumulates subscribers — every registered callback is invoked in
|
|
607
|
+
* registration order on the next connect.
|
|
608
|
+
*
|
|
609
|
+
* @param _onConnectHandler Function to add. Use a stable reference
|
|
610
|
+
* so that {@link unscriberOnConnectHandler}
|
|
611
|
+
* can remove it later.
|
|
612
|
+
*/
|
|
78
613
|
static subscriberOnConnectHandler(_onConnectHandler: Action0): void;
|
|
614
|
+
/**
|
|
615
|
+
* Adds a callback to the multi-subscriber socket-disconnect channel.
|
|
616
|
+
*
|
|
617
|
+
* @param _onDisconnectHandler Function to add. Must be the same
|
|
618
|
+
* reference that will later be passed to
|
|
619
|
+
* {@link unsubscriberOnDisconnectHandler}.
|
|
620
|
+
*/
|
|
79
621
|
static subscriberOnDisconnectHandler(_onDisconnectHandler: Action0): void;
|
|
622
|
+
/**
|
|
623
|
+
* Removes a previously registered socket-connect callback.
|
|
624
|
+
*
|
|
625
|
+
* No-op when the supplied function reference is not currently
|
|
626
|
+
* subscribed.
|
|
627
|
+
*
|
|
628
|
+
* @param _onConnectHandler The exact reference originally passed to
|
|
629
|
+
* {@link subscriberOnConnectHandler}.
|
|
630
|
+
*/
|
|
80
631
|
static unscriberOnConnectHandler(_onConnectHandler: Action0): void;
|
|
632
|
+
/**
|
|
633
|
+
* Removes a previously registered socket-disconnect callback.
|
|
634
|
+
*
|
|
635
|
+
* No-op when the supplied function reference is not currently
|
|
636
|
+
* subscribed.
|
|
637
|
+
*
|
|
638
|
+
* @param _onDisconnectHandler The exact reference originally passed
|
|
639
|
+
* to
|
|
640
|
+
* {@link subscriberOnDisconnectHandler}.
|
|
641
|
+
*/
|
|
81
642
|
static unsubscriberOnDisconnectHandler(_onDisconnectHandler: Action0): void;
|
|
643
|
+
/**
|
|
644
|
+
* Registers a typed {@link IServerEventHandler} so the SDK can
|
|
645
|
+
* dispatch the matching server event to it automatically.
|
|
646
|
+
*
|
|
647
|
+
* The handler must implement `IServerEventHandler` and is usually
|
|
648
|
+
* decorated with `@IServerEventHandler.registerEvent` so that it is
|
|
649
|
+
* picked up at module-load time. This helper exists for the cases
|
|
650
|
+
* where a handler is constructed dynamically and therefore needs to
|
|
651
|
+
* be subscribed at runtime.
|
|
652
|
+
*
|
|
653
|
+
* Multiple handlers may register against the same `EventCode`; they
|
|
654
|
+
* are invoked in registration order whenever a matching event is
|
|
655
|
+
* received from the socket.
|
|
656
|
+
*
|
|
657
|
+
* @param serverEventHandler Concrete handler instance.
|
|
658
|
+
*/
|
|
82
659
|
static subscriberServerEventHandler(serverEventHandler: IServerEventHandler): void;
|
|
660
|
+
/**
|
|
661
|
+
* Triggers the timestamp endpoint and refreshes the local server
|
|
662
|
+
* clock estimate.
|
|
663
|
+
*
|
|
664
|
+
* The SDK already calls this internally when the server includes a
|
|
665
|
+
* `ts` field in any successful response (see
|
|
666
|
+
* {@link PeerBase.onResponseHandler}). Manual invocations are useful
|
|
667
|
+
* after long idle periods or before issuing a time-sensitive request
|
|
668
|
+
* such as receipt validation.
|
|
669
|
+
*
|
|
670
|
+
* @param onResponse Optional callback receiving the new server
|
|
671
|
+
* timestamp in milliseconds since epoch.
|
|
672
|
+
*/
|
|
83
673
|
static syncTs(onResponse?: Action1<number>): void;
|
|
674
|
+
/**
|
|
675
|
+
* Promise-based wrapper around {@link syncTs}.
|
|
676
|
+
*
|
|
677
|
+
* @returns Promise of the freshly observed server timestamp in
|
|
678
|
+
* milliseconds since epoch.
|
|
679
|
+
*/
|
|
84
680
|
static syncTsAsync(): Promise<number>;
|
|
681
|
+
/**
|
|
682
|
+
* Calls the auth-info endpoint to inspect the player record bound to
|
|
683
|
+
* an arbitrary auth token without affecting the cached session.
|
|
684
|
+
*
|
|
685
|
+
* Useful for tools (admin dashboards, diagnostics) that need to
|
|
686
|
+
* resolve a token without logging in as the corresponding user.
|
|
687
|
+
*
|
|
688
|
+
* @param authToken Token to inspect. Does **not** replace the
|
|
689
|
+
* cached auth token used by other requests.
|
|
690
|
+
* @param onResponse Optional callback receiving the typed
|
|
691
|
+
* {@link GetAuthInfoResponse}.
|
|
692
|
+
*/
|
|
85
693
|
static getAuthInfo(authToken: string, onResponse?: Action1<GetAuthInfoResponse>): void;
|
|
694
|
+
/**
|
|
695
|
+
* Promise-based wrapper around {@link getAuthInfo}.
|
|
696
|
+
*
|
|
697
|
+
* @returns Promise of the typed auth-info response.
|
|
698
|
+
*/
|
|
86
699
|
static getAuthInfoAsync(authToken: string): Promise<GetAuthInfoResponse>;
|
|
700
|
+
/**
|
|
701
|
+
* Calls the health-check endpoint.
|
|
702
|
+
*
|
|
703
|
+
* Useful for warm-up probes, health dashboards or as a simple ping
|
|
704
|
+
* to confirm that the configured base URL is reachable. The endpoint
|
|
705
|
+
* does **not** require an auth token.
|
|
706
|
+
*
|
|
707
|
+
* @param onResponse Optional callback receiving the typed
|
|
708
|
+
* {@link HealthCheckResponse}.
|
|
709
|
+
*/
|
|
87
710
|
static healthCheck(onResponse?: Action1<HealthCheckResponse>): void;
|
|
711
|
+
/**
|
|
712
|
+
* Promise-based wrapper around {@link healthCheck}.
|
|
713
|
+
*
|
|
714
|
+
* @returns Promise of the typed health-check response.
|
|
715
|
+
*/
|
|
88
716
|
static healthCheckAsync(): Promise<HealthCheckResponse>;
|
|
717
|
+
/**
|
|
718
|
+
* Uploads a file using the authenticated multipart endpoint.
|
|
719
|
+
*
|
|
720
|
+
* Expected flow:
|
|
721
|
+
* 1. Call `GNNetwork.content.createNewFileUploadInfo(...)` (or the
|
|
722
|
+
* matching async variant). The backend reserves a slot and
|
|
723
|
+
* returns a `fileId`.
|
|
724
|
+
* 2. Pass that `fileId` plus the binary payload into this method.
|
|
725
|
+
* The SDK uses the cached auth token automatically (it does not
|
|
726
|
+
* accept an override here).
|
|
727
|
+
* 3. Inspect `response.uploadCommitted` (or equivalent field) before
|
|
728
|
+
* treating the upload as durable.
|
|
729
|
+
*
|
|
730
|
+
* Browser caveat: `content` is sent as a `Blob`, so very large
|
|
731
|
+
* payloads may be subject to host-runtime memory limits. Chunked
|
|
732
|
+
* uploads are not supported by this endpoint — use the dashboard /
|
|
733
|
+
* server SDK for files larger than ~50 MB.
|
|
734
|
+
*
|
|
735
|
+
* @param fileId Identifier returned by `content.createNewFileUploadInfo*`.
|
|
736
|
+
* @param content Binary payload to upload.
|
|
737
|
+
* @param filename Display name written into the multipart envelope.
|
|
738
|
+
* @param mimetype Content-Type for the file part. Affects the
|
|
739
|
+
* `Content-Type` header on the file blob only;
|
|
740
|
+
* the multipart envelope itself remains
|
|
741
|
+
* `multipart/form-data`.
|
|
742
|
+
* @param onResponse Optional callback receiving the typed
|
|
743
|
+
* {@link UploadFileResponse}.
|
|
744
|
+
*/
|
|
89
745
|
static uploadFile(fileId: string, content: Uint8Array, filename: string, mimetype: string, onResponse?: Action1<UploadFileResponse>): void;
|
|
746
|
+
/**
|
|
747
|
+
* Promise-based wrapper around {@link uploadFile}.
|
|
748
|
+
*
|
|
749
|
+
* @returns Promise of the typed upload response.
|
|
750
|
+
*/
|
|
90
751
|
static uploadFileAsync(fileId: string, content: Uint8Array, filename: string, mimetype: string): Promise<UploadFileResponse>;
|
|
752
|
+
/**
|
|
753
|
+
* Builds the absolute download URL for a previously issued download
|
|
754
|
+
* token.
|
|
755
|
+
*
|
|
756
|
+
* Expected flow:
|
|
757
|
+
* 1. Call `GNNetwork.content.requestDownloadFileUploadInfo(...)` to
|
|
758
|
+
* obtain a short-lived `downloadToken` for the target file.
|
|
759
|
+
* 2. Pass that token into this helper to get the absolute URL.
|
|
760
|
+
* 3. Hand the URL to the host runtime's preferred download
|
|
761
|
+
* primitive (`<a download>`, `fetch(...)`, Cocos `assetManager`,
|
|
762
|
+
* Node.js `http.get`, ...).
|
|
763
|
+
*
|
|
764
|
+
* The returned URL embeds the token directly — treat it as
|
|
765
|
+
* sensitive and avoid logging it.
|
|
766
|
+
*
|
|
767
|
+
* @param downloadToken Short-lived token returned by
|
|
768
|
+
* `content.requestDownloadFileUploadInfo*`.
|
|
769
|
+
* @returns Absolute URL of the form
|
|
770
|
+
* `<httpUrl>/download/<downloadToken>`.
|
|
771
|
+
*
|
|
772
|
+
* @throws TypeError when called before {@link init} (the SDK has no
|
|
773
|
+
* settings to pull the base URL from).
|
|
774
|
+
*/
|
|
91
775
|
static getDownloadFileUrl(downloadToken: string): string;
|
|
92
776
|
}
|