@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.
Files changed (286) hide show
  1. package/AGENTS.md +37 -0
  2. package/README.MD +420 -1
  3. package/dist/gearn.js.client.js +25056 -1056
  4. package/dist/gearn.js.client.min.js +1 -1
  5. package/dist/index.d.ts +30 -0
  6. package/dist/index.js +24236 -212
  7. package/dist/runtime/GNNetwork.d.ts +687 -3
  8. package/dist/runtime/GNNetworkAuthenticateApi.d.ts +327 -0
  9. package/dist/runtime/GNNetworkCharacterPlayerApi.d.ts +1026 -0
  10. package/dist/runtime/GNNetworkCloudScriptApi.d.ts +141 -0
  11. package/dist/runtime/GNNetworkContentApi.d.ts +243 -0
  12. package/dist/runtime/GNNetworkDashboardApi.d.ts +221 -0
  13. package/dist/runtime/GNNetworkGamePlayerApi.d.ts +1033 -0
  14. package/dist/runtime/GNNetworkGroupApi.d.ts +783 -0
  15. package/dist/runtime/GNNetworkInventoryApi.d.ts +673 -0
  16. package/dist/runtime/GNNetworkMasterPlayerApi.d.ts +1614 -6
  17. package/dist/runtime/GNNetworkMultiplayerApi.d.ts +234 -0
  18. package/dist/runtime/GNNetworkStoreInventoryApi.d.ts +309 -0
  19. package/dist/runtime/common/Action0.d.ts +30 -0
  20. package/dist/runtime/common/Action1.d.ts +32 -0
  21. package/dist/runtime/common/Action2.d.ts +21 -0
  22. package/dist/runtime/common/Action3.d.ts +16 -0
  23. package/dist/runtime/common/Action4.d.ts +17 -0
  24. package/dist/runtime/common/GNData.d.ts +368 -0
  25. package/dist/runtime/config/GNServerSettings.d.ts +442 -12
  26. package/dist/runtime/constant/Commands.d.ts +80 -0
  27. package/dist/runtime/constant/EventCode.d.ts +48 -0
  28. package/dist/runtime/constant/OperationCode.d.ts +74 -1
  29. package/dist/runtime/constant/ReturnCode.d.ts +72 -0
  30. package/dist/runtime/constant/enumType/ExecuteResponseStatus.d.ts +31 -0
  31. package/dist/runtime/constant/enumType/FriendStatus.d.ts +39 -0
  32. package/dist/runtime/constant/enumType/GoogleLoginType.d.ts +23 -0
  33. package/dist/runtime/constant/enumType/GroupStatus.d.ts +32 -0
  34. package/dist/runtime/constant/enumType/InvalidMemberType.d.ts +75 -0
  35. package/dist/runtime/constant/enumType/ItemType.d.ts +23 -0
  36. package/dist/runtime/constant/enumType/MatchStatus.d.ts +30 -0
  37. package/dist/runtime/constant/enumType/MatchmakingMemberStatus.d.ts +24 -0
  38. package/dist/runtime/constant/enumType/MatchmakingTicketStatus.d.ts +34 -0
  39. package/dist/runtime/constant/enumType/OwnerType.d.ts +40 -0
  40. package/dist/runtime/constant/enumType/PermissionDataItem.d.ts +22 -0
  41. package/dist/runtime/constant/enumType/PushPlatformType.d.ts +18 -0
  42. package/dist/runtime/constant/enumType/RequestRole.d.ts +32 -0
  43. package/dist/runtime/constant/enumType/RequestType.d.ts +70 -0
  44. package/dist/runtime/constant/enumType/StoreItemType.d.ts +21 -0
  45. package/dist/runtime/constant/enumType/StoreReceiveType.d.ts +30 -0
  46. package/dist/runtime/constant/errorCode/ErrorCode.d.ts +190 -8
  47. package/dist/runtime/constant/parameterCode/ParameterCode.d.ts +35 -5
  48. package/dist/runtime/entity/DataMember.d.ts +338 -0
  49. package/dist/runtime/entity/GNMetadata.d.ts +101 -0
  50. package/dist/runtime/entity/InvalidMember.d.ts +28 -0
  51. package/dist/runtime/entity/OperationEvent.d.ts +49 -0
  52. package/dist/runtime/entity/OperationRequest.d.ts +108 -0
  53. package/dist/runtime/entity/OperationResponse.d.ts +110 -0
  54. package/dist/runtime/entity/models/AuthenticateModels.d.ts +115 -0
  55. package/dist/runtime/entity/models/AuthenticateRequestModels.d.ts +131 -0
  56. package/dist/runtime/entity/models/AuthenticateResponseModels.d.ts +131 -0
  57. package/dist/runtime/entity/models/CharacterPlayerModels.d.ts +625 -1
  58. package/dist/runtime/entity/models/CharacterPlayerRequestModels.d.ts +972 -0
  59. package/dist/runtime/entity/models/CharacterPlayerResponseModels.d.ts +332 -0
  60. package/dist/runtime/entity/models/CloudScriptModels.d.ts +109 -0
  61. package/dist/runtime/entity/models/CloudScriptRequestModels.d.ts +107 -0
  62. package/dist/runtime/entity/models/CloudScriptResponseModels.d.ts +46 -0
  63. package/dist/runtime/entity/models/ContentModels.d.ts +124 -0
  64. package/dist/runtime/entity/models/ContentRequestModels.d.ts +152 -0
  65. package/dist/runtime/entity/models/ContentResponseModels.d.ts +58 -0
  66. package/dist/runtime/entity/models/DashboardModels.d.ts +371 -8
  67. package/dist/runtime/entity/models/DashboardRequestModels.d.ts +172 -0
  68. package/dist/runtime/entity/models/DashboardResponseModels.d.ts +170 -0
  69. package/dist/runtime/entity/models/GamePlayerModels.d.ts +644 -1
  70. package/dist/runtime/entity/models/GamePlayerRequestModels.d.ts +959 -0
  71. package/dist/runtime/entity/models/GamePlayerResponseModels.d.ts +333 -1
  72. package/dist/runtime/entity/models/GenericModels.d.ts +94 -0
  73. package/dist/runtime/entity/models/GroupModels.d.ts +484 -2
  74. package/dist/runtime/entity/models/GroupRequestModels.d.ts +737 -0
  75. package/dist/runtime/entity/models/GroupResponseModels.d.ts +254 -0
  76. package/dist/runtime/entity/models/InventoryModels.d.ts +415 -0
  77. package/dist/runtime/entity/models/InventoryRequestModels.d.ts +629 -0
  78. package/dist/runtime/entity/models/InventoryResponseModels.d.ts +218 -0
  79. package/dist/runtime/entity/models/MasterPlayerModels.d.ts +1065 -3
  80. package/dist/runtime/entity/models/MasterPlayerRequestModels.d.ts +1560 -6
  81. package/dist/runtime/entity/models/MasterPlayerResponseModels.d.ts +532 -1
  82. package/dist/runtime/entity/models/MultiplayerModels.d.ts +199 -0
  83. package/dist/runtime/entity/models/MultiplayerRequestModels.d.ts +196 -0
  84. package/dist/runtime/entity/models/MultiplayerResponseModels.d.ts +74 -0
  85. package/dist/runtime/entity/models/StoreInventoryModels.d.ts +262 -0
  86. package/dist/runtime/entity/models/StoreInventoryRequestModels.d.ts +268 -0
  87. package/dist/runtime/entity/models/StoreInventoryResponseModels.d.ts +98 -0
  88. package/dist/runtime/entity/request/CustomOperationRequest.d.ts +99 -0
  89. package/dist/runtime/entity/response/CustomOperationResponse.d.ts +118 -0
  90. package/dist/runtime/entity/response/GetAuthInfoResponse.d.ts +53 -0
  91. package/dist/runtime/entity/response/HealthCheckResponse.d.ts +56 -0
  92. package/dist/runtime/entity/response/UploadFileResponse.d.ts +19 -0
  93. package/dist/runtime/helper/CodeHelper.d.ts +122 -0
  94. package/dist/runtime/helper/ConverterService.d.ts +74 -0
  95. package/dist/runtime/helper/EnumUtility.d.ts +63 -0
  96. package/dist/runtime/helper/GNSupport.d.ts +64 -4
  97. package/dist/runtime/helper/GNUtils.d.ts +54 -0
  98. package/dist/runtime/helper/MessagePackConverterService.d.ts +48 -0
  99. package/dist/runtime/helper/OperationHelper.d.ts +51 -0
  100. package/dist/runtime/helper/StorageService.d.ts +48 -8
  101. package/dist/runtime/logger/GNDebug.d.ts +117 -0
  102. package/dist/runtime/networking/AuthenticateStatus.d.ts +64 -0
  103. package/dist/runtime/networking/IPeer.d.ts +83 -0
  104. package/dist/runtime/networking/NetworkingPeer.d.ts +256 -1
  105. package/dist/runtime/networking/OperationPending.d.ts +112 -0
  106. package/dist/runtime/networking/PeerBase.d.ts +231 -0
  107. package/dist/runtime/networking/handler/IServerEventHandler.d.ts +84 -0
  108. package/dist/runtime/networking/handler/OnCharacterPlayerFriendUpdateEventHandler.d.ts +69 -0
  109. package/dist/runtime/networking/handler/OnCharacterPlayerGroupUpdateEventHandler.d.ts +49 -0
  110. package/dist/runtime/networking/handler/OnGamePlayerFriendUpdateEventHandler.d.ts +50 -0
  111. package/dist/runtime/networking/handler/OnGamePlayerGroupUpdateEventHandler.d.ts +41 -0
  112. package/dist/runtime/networking/handler/OnGroupMemberUpdateEventHandler.d.ts +47 -0
  113. package/dist/runtime/networking/handler/OnGroupMessageUpdateEventHandler.d.ts +46 -0
  114. package/dist/runtime/networking/http/HttpPeer.d.ts +173 -0
  115. package/dist/runtime/networking/http/NetworkingHttpPeerBase.d.ts +87 -0
  116. package/dist/runtime/networking/http/NetworkingPeerAxiosRequest.d.ts +113 -0
  117. package/dist/runtime/networking/socket/NetworkingPeerSocketIOClient.d.ts +145 -0
  118. package/dist/runtime/networking/socket/NetworkingSocketPeerBase.d.ts +198 -0
  119. package/dist/runtime/networking/socket/SocketPeer.d.ts +155 -0
  120. package/dist/runtime/typescript/ServiceUpdate.d.ts +46 -0
  121. package/docs/AI_CHEATSHEET.md +211 -0
  122. package/docs/COOKBOOK.md +912 -0
  123. package/docs/RULES.md +307 -0
  124. package/docs/ai-manifest.json +725 -0
  125. package/docs/guides/AUTHENTICATE.md +246 -0
  126. package/docs/guides/CHARACTER_PLAYER.md +439 -0
  127. package/docs/guides/CLOUDSCRIPT.md +335 -0
  128. package/docs/guides/COCOS_CREATOR_INTEGRATION.md +150 -0
  129. package/docs/guides/CONTENT.md +291 -0
  130. package/docs/guides/DASHBOARD.md +262 -0
  131. package/docs/guides/GAME_PLAYER.md +473 -0
  132. package/docs/guides/GROUP.md +412 -0
  133. package/docs/guides/INVENTORY.md +375 -0
  134. package/docs/guides/MASTER_PLAYER.md +458 -0
  135. package/docs/guides/MULTIPLAYER.md +303 -0
  136. package/docs/guides/STORE_INVENTORY.md +313 -0
  137. package/docs/llms-full.txt +43 -0
  138. package/docs/reference/API_AUTHENTICATE.md +75 -0
  139. package/docs/reference/API_CHARACTER_PLAYER.md +226 -0
  140. package/docs/reference/API_CLOUDSCRIPT.md +82 -0
  141. package/docs/reference/API_CONTENT.md +88 -0
  142. package/docs/reference/API_DASHBOARD.md +82 -0
  143. package/docs/reference/API_GAME_PLAYER.md +223 -0
  144. package/docs/reference/API_GROUP.md +187 -0
  145. package/docs/reference/API_INDEX.md +57 -0
  146. package/docs/reference/API_INVENTORY.md +169 -0
  147. package/docs/reference/API_MASTER_PLAYER.md +323 -0
  148. package/docs/reference/API_MULTIPLAYER.md +97 -0
  149. package/docs/reference/API_STORE_INVENTORY.md +109 -0
  150. package/docs/reference/CONFIG.md +107 -0
  151. package/docs/reference/DTO_INDEX.md +2543 -0
  152. package/docs/reference/ENUMS.md +433 -0
  153. package/docs/reference/ERROR_HANDLING.md +159 -0
  154. package/docs/reference/EVENTS.md +188 -0
  155. package/docs/reference/PERMISSION_RULES.md +55 -0
  156. package/docs/reference/dto/AUTHENTICATE.md +619 -0
  157. package/docs/reference/dto/CHARACTER_PLAYER.md +3686 -0
  158. package/docs/reference/dto/CLOUDSCRIPT.md +400 -0
  159. package/docs/reference/dto/CONTENT.md +548 -0
  160. package/docs/reference/dto/DASHBOARD.md +1980 -0
  161. package/docs/reference/dto/GAME_PLAYER.md +3631 -0
  162. package/docs/reference/dto/GENERIC.md +151 -0
  163. package/docs/reference/dto/GROUP.md +2842 -0
  164. package/docs/reference/dto/INVENTORY.md +2385 -0
  165. package/docs/reference/dto/MASTER_PLAYER.md +6024 -0
  166. package/docs/reference/dto/MULTIPLAYER.md +850 -0
  167. package/docs/reference/dto/STORE_INVENTORY.md +1262 -0
  168. package/llms.txt +47 -0
  169. package/package.json +12 -3
  170. package/GNServerSettings.debug.json +0 -21
  171. package/docs/COCOS_CREATOR_INTEGRATION.md +0 -116
  172. package/examples/cocos-creator/GearNExample.ts.txt +0 -176
  173. package/srcSwift/Package.swift +0 -32
  174. package/srcSwift/Sources/GearN/runtime/GNNetwork.swift +0 -530
  175. package/srcSwift/Sources/GearN/runtime/GNNetworkAuthenticateApi.swift +0 -178
  176. package/srcSwift/Sources/GearN/runtime/GNNetworkCharacterPlayerApi.swift +0 -1162
  177. package/srcSwift/Sources/GearN/runtime/GNNetworkCloudScriptApi.swift +0 -154
  178. package/srcSwift/Sources/GearN/runtime/GNNetworkContentApi.swift +0 -208
  179. package/srcSwift/Sources/GearN/runtime/GNNetworkDashboardApi.swift +0 -240
  180. package/srcSwift/Sources/GearN/runtime/GNNetworkGamePlayerApi.swift +0 -1369
  181. package/srcSwift/Sources/GearN/runtime/GNNetworkGroupApi.swift +0 -1100
  182. package/srcSwift/Sources/GearN/runtime/GNNetworkInventoryApi.swift +0 -937
  183. package/srcSwift/Sources/GearN/runtime/GNNetworkMasterPlayerApi.swift +0 -2323
  184. package/srcSwift/Sources/GearN/runtime/GNNetworkMultiplayerApi.swift +0 -298
  185. package/srcSwift/Sources/GearN/runtime/GNNetworkStoreInventoryApi.swift +0 -397
  186. package/srcSwift/Sources/GearN/runtime/common/Action0.swift +0 -3
  187. package/srcSwift/Sources/GearN/runtime/common/Action1.swift +0 -3
  188. package/srcSwift/Sources/GearN/runtime/common/Action2.swift +0 -3
  189. package/srcSwift/Sources/GearN/runtime/common/Action3.swift +0 -3
  190. package/srcSwift/Sources/GearN/runtime/common/Action4.swift +0 -3
  191. package/srcSwift/Sources/GearN/runtime/common/GNArray.swift +0 -204
  192. package/srcSwift/Sources/GearN/runtime/common/GNData.swift +0 -108
  193. package/srcSwift/Sources/GearN/runtime/common/GNHashtable.swift +0 -200
  194. package/srcSwift/Sources/GearN/runtime/config/GNServerSettings.swift +0 -95
  195. package/srcSwift/Sources/GearN/runtime/constant/Commands.swift +0 -28
  196. package/srcSwift/Sources/GearN/runtime/constant/EventCode.swift +0 -10
  197. package/srcSwift/Sources/GearN/runtime/constant/OperationCode.swift +0 -252
  198. package/srcSwift/Sources/GearN/runtime/constant/ReturnCode.swift +0 -19
  199. package/srcSwift/Sources/GearN/runtime/constant/enumType/ExecuteResponseStatus.swift +0 -9
  200. package/srcSwift/Sources/GearN/runtime/constant/enumType/FriendStatus.swift +0 -8
  201. package/srcSwift/Sources/GearN/runtime/constant/enumType/GoogleLoginType.swift +0 -6
  202. package/srcSwift/Sources/GearN/runtime/constant/enumType/GroupStatus.swift +0 -8
  203. package/srcSwift/Sources/GearN/runtime/constant/enumType/InvalidMemberType.swift +0 -19
  204. package/srcSwift/Sources/GearN/runtime/constant/enumType/ItemType.swift +0 -6
  205. package/srcSwift/Sources/GearN/runtime/constant/enumType/MatchmakingMemberStatus.swift +0 -7
  206. package/srcSwift/Sources/GearN/runtime/constant/enumType/MatchmakingTicketStatus.swift +0 -9
  207. package/srcSwift/Sources/GearN/runtime/constant/enumType/OwnerType.swift +0 -10
  208. package/srcSwift/Sources/GearN/runtime/constant/enumType/PermissionDataItem.swift +0 -6
  209. package/srcSwift/Sources/GearN/runtime/constant/enumType/PushPlatformType.swift +0 -6
  210. package/srcSwift/Sources/GearN/runtime/constant/enumType/RequestRole.swift +0 -7
  211. package/srcSwift/Sources/GearN/runtime/constant/enumType/RequestType.swift +0 -16
  212. package/srcSwift/Sources/GearN/runtime/constant/enumType/StoreItemType.swift +0 -6
  213. package/srcSwift/Sources/GearN/runtime/constant/enumType/StoreReceiveType.swift +0 -9
  214. package/srcSwift/Sources/GearN/runtime/constant/errorCode/ErrorCode.swift +0 -58
  215. package/srcSwift/Sources/GearN/runtime/constant/parameterCode/ParameterCode.swift +0 -672
  216. package/srcSwift/Sources/GearN/runtime/entity/DataMember.swift +0 -196
  217. package/srcSwift/Sources/GearN/runtime/entity/GNMetadata.swift +0 -9
  218. package/srcSwift/Sources/GearN/runtime/entity/InvalidMember.swift +0 -11
  219. package/srcSwift/Sources/GearN/runtime/entity/OperationEvent.swift +0 -38
  220. package/srcSwift/Sources/GearN/runtime/entity/OperationHelper.swift +0 -28
  221. package/srcSwift/Sources/GearN/runtime/entity/OperationRequest.swift +0 -62
  222. package/srcSwift/Sources/GearN/runtime/entity/OperationResponse.swift +0 -98
  223. package/srcSwift/Sources/GearN/runtime/entity/models/AuthenticateModels.swift +0 -351
  224. package/srcSwift/Sources/GearN/runtime/entity/models/AuthenticateRequestModels.swift +0 -81
  225. package/srcSwift/Sources/GearN/runtime/entity/models/AuthenticateResponseModels.swift +0 -108
  226. package/srcSwift/Sources/GearN/runtime/entity/models/CharacterPlayerModels.swift +0 -1045
  227. package/srcSwift/Sources/GearN/runtime/entity/models/CharacterPlayerRequestModels.swift +0 -821
  228. package/srcSwift/Sources/GearN/runtime/entity/models/CharacterPlayerResponseModels.swift +0 -588
  229. package/srcSwift/Sources/GearN/runtime/entity/models/CloudScriptModels.swift +0 -187
  230. package/srcSwift/Sources/GearN/runtime/entity/models/CloudScriptRequestModels.swift +0 -84
  231. package/srcSwift/Sources/GearN/runtime/entity/models/CloudScriptResponseModels.swift +0 -59
  232. package/srcSwift/Sources/GearN/runtime/entity/models/ContentModels.swift +0 -195
  233. package/srcSwift/Sources/GearN/runtime/entity/models/ContentRequestModels.swift +0 -116
  234. package/srcSwift/Sources/GearN/runtime/entity/models/ContentResponseModels.swift +0 -81
  235. package/srcSwift/Sources/GearN/runtime/entity/models/DashboardModels.swift +0 -426
  236. package/srcSwift/Sources/GearN/runtime/entity/models/DashboardRequestModels.swift +0 -160
  237. package/srcSwift/Sources/GearN/runtime/entity/models/DashboardResponseModels.swift +0 -82
  238. package/srcSwift/Sources/GearN/runtime/entity/models/GamePlayerModels.swift +0 -1334
  239. package/srcSwift/Sources/GearN/runtime/entity/models/GamePlayerRequestModels.swift +0 -643
  240. package/srcSwift/Sources/GearN/runtime/entity/models/GamePlayerResponseModels.swift +0 -213
  241. package/srcSwift/Sources/GearN/runtime/entity/models/GenericModels.swift +0 -171
  242. package/srcSwift/Sources/GearN/runtime/entity/models/GroupModels.swift +0 -850
  243. package/srcSwift/Sources/GearN/runtime/entity/models/GroupRequestModels.swift +0 -485
  244. package/srcSwift/Sources/GearN/runtime/entity/models/GroupResponseModels.swift +0 -165
  245. package/srcSwift/Sources/GearN/runtime/entity/models/InventoryModels.swift +0 -679
  246. package/srcSwift/Sources/GearN/runtime/entity/models/InventoryRequestModels.swift +0 -413
  247. package/srcSwift/Sources/GearN/runtime/entity/models/InventoryResponseModels.swift +0 -141
  248. package/srcSwift/Sources/GearN/runtime/entity/models/MasterPlayerModels.swift +0 -378
  249. package/srcSwift/Sources/GearN/runtime/entity/models/MasterPlayerRequestModels.swift +0 -147
  250. package/srcSwift/Sources/GearN/runtime/entity/models/MasterPlayerResponseModels.swift +0 -318
  251. package/srcSwift/Sources/GearN/runtime/entity/models/MultiplayerModels.swift +0 -319
  252. package/srcSwift/Sources/GearN/runtime/entity/models/MultiplayerRequestModels.swift +0 -125
  253. package/srcSwift/Sources/GearN/runtime/entity/models/MultiplayerResponseModels.swift +0 -45
  254. package/srcSwift/Sources/GearN/runtime/entity/models/StoreInventoryModels.swift +0 -633
  255. package/srcSwift/Sources/GearN/runtime/entity/models/StoreInventoryRequestModels.swift +0 -173
  256. package/srcSwift/Sources/GearN/runtime/entity/models/StoreInventoryResponseModels.swift +0 -61
  257. package/srcSwift/Sources/GearN/runtime/entity/request/CustomOperationRequest.swift +0 -42
  258. package/srcSwift/Sources/GearN/runtime/entity/response/CustomOperationResponse.swift +0 -49
  259. package/srcSwift/Sources/GearN/runtime/entity/response/GetAuthInfoResponse.swift +0 -43
  260. package/srcSwift/Sources/GearN/runtime/entity/response/HealthCheckResponse.swift +0 -86
  261. package/srcSwift/Sources/GearN/runtime/entity/response/UploadFileResponse.swift +0 -15
  262. package/srcSwift/Sources/GearN/runtime/helper/CodeHelper.swift +0 -107
  263. package/srcSwift/Sources/GearN/runtime/helper/ConverterService.swift +0 -98
  264. package/srcSwift/Sources/GearN/runtime/helper/EnumUtility.swift +0 -34
  265. package/srcSwift/Sources/GearN/runtime/helper/GNSupport.swift +0 -41
  266. package/srcSwift/Sources/GearN/runtime/helper/GNUtils.swift +0 -66
  267. package/srcSwift/Sources/GearN/runtime/helper/MessagePackConverterService.swift +0 -21
  268. package/srcSwift/Sources/GearN/runtime/helper/StorageService.swift +0 -29
  269. package/srcSwift/Sources/GearN/runtime/logger/GNDebug.swift +0 -33
  270. package/srcSwift/Sources/GearN/runtime/networking/AuthenticateStatus.swift +0 -24
  271. package/srcSwift/Sources/GearN/runtime/networking/IPeer.swift +0 -8
  272. package/srcSwift/Sources/GearN/runtime/networking/NetworkingPeer.swift +0 -368
  273. package/srcSwift/Sources/GearN/runtime/networking/OperationPending.swift +0 -81
  274. package/srcSwift/Sources/GearN/runtime/networking/PeerBase.swift +0 -228
  275. package/srcSwift/Sources/GearN/runtime/networking/handler/IServerEventHandler.swift +0 -20
  276. package/srcSwift/Sources/GearN/runtime/networking/http/HttpPeer.swift +0 -226
  277. package/srcSwift/Sources/GearN/runtime/networking/http/HttpTypes.swift +0 -24
  278. package/srcSwift/Sources/GearN/runtime/networking/http/NetworkingHttpPeerBase.swift +0 -13
  279. package/srcSwift/Sources/GearN/runtime/networking/http/NetworkingPeerUrlSession.swift +0 -125
  280. package/srcSwift/Sources/GearN/runtime/networking/request/NetRequest.swift +0 -19
  281. package/srcSwift/Sources/GearN/runtime/networking/response/NetResponse.swift +0 -13
  282. package/srcSwift/Sources/GearN/runtime/networking/socket/NetworkingPeerSocketIOClient.swift +0 -244
  283. package/srcSwift/Sources/GearN/runtime/networking/socket/NetworkingSocketPeerBase.swift +0 -59
  284. package/srcSwift/Sources/GearN/runtime/networking/socket/SocketPeer.swift +0 -136
  285. package/tsconfig-build.cocos.json +0 -31
  286. package/webpack.config.cocos.mjs +0 -78
@@ -1,6 +1,69 @@
1
+ /**
2
+ * Generic helper for parsing and formatting TypeScript enums.
3
+ *
4
+ * Background: TypeScript compiles a numeric enum into an object that
5
+ * carries **both** the forward (`name → value`) and the reverse
6
+ * (`value → name`) mappings. The reverse-mapping entries make
7
+ * `Object.keys(MyEnum)` noisy when the caller only wants the human
8
+ * readable member names. This utility centralises the
9
+ * `isNaN(Number(key))` filter so call sites can ignore the
10
+ * implementation detail, and it caches the filtered key list per
11
+ * enum type for repeated lookups.
12
+ *
13
+ * Used by debug log tooling and by application code that needs to
14
+ * convert between an enum value and its display name (e.g. the
15
+ * `getCodeName` helpers in {@link CodeHelper}).
16
+ */
1
17
  export declare class EnumUtility {
18
+ /**
19
+ * Per-enum cache of human-readable member names. The cache key
20
+ * is the enum object itself (not its name), so two distinct
21
+ * enums sharing the same numeric values still get independent
22
+ * entries.
23
+ */
2
24
  private static enumKeyCache;
25
+ /**
26
+ * Returns the cached list of human-readable member names for
27
+ * `enumType`, building the list on first access.
28
+ *
29
+ * Filters out the numeric reverse-mapping keys produced by
30
+ * `Object.keys` on a numeric enum. Caching avoids re-filtering
31
+ * on every call.
32
+ */
3
33
  private static getEnumKeys;
34
+ /**
35
+ * Resolves a string member name to the matching enum value.
36
+ *
37
+ * Two lookup paths:
38
+ * - **Case-sensitive** (default): a direct property lookup with
39
+ * the `value in enumType` guard so unknown names cleanly
40
+ * return `null`.
41
+ * - **Case-insensitive**: walk the cached member-name list
42
+ * uppercase-comparing against the input. Slower but tolerant
43
+ * to mixed-case input from external sources (URLs, config
44
+ * files).
45
+ *
46
+ * @param enumType Enum object (e.g. `MyEnum`). The signature
47
+ * `Record<string, number | string>` covers
48
+ * both numeric and string enums.
49
+ * @param value Display name to resolve.
50
+ * @param ignoreCase Set to `true` to allow mixed-case input.
51
+ * Defaults to `false` (case-sensitive).
52
+ * @returns The enum value, or `null` when the name is
53
+ * unknown.
54
+ */
4
55
  static parse<T extends Record<string, number | string>>(enumType: T, value: string, ignoreCase?: boolean): T[keyof T];
56
+ /**
57
+ * Returns the human-readable name corresponding to `value`.
58
+ *
59
+ * Walks the cached member list and finds the first entry whose
60
+ * value matches. For numeric enums this is essentially a
61
+ * convenient wrapper around the enum's reverse mapping — the
62
+ * helper exists so the same call site works against string
63
+ * enums too (which do **not** have reverse mappings).
64
+ *
65
+ * @returns The member name, or `null` when no member maps to
66
+ * `value`.
67
+ */
5
68
  static toString<T extends Record<string, number | string>>(enumType: T, value: T[keyof T]): string;
6
69
  }
@@ -1,24 +1,84 @@
1
+ /**
2
+ * Discrete identifiers returned by {@link GNSupport.getPlatformType}.
3
+ *
4
+ * The string union is intentionally narrow — the SDK only branches
5
+ * on these three values:
6
+ * - `"cocos"` — the host runtime exposes the Cocos `cc` global with
7
+ * `cc.sys`. Detected before the browser check because the Cocos
8
+ * web build also exposes `window`.
9
+ * - `"browser"` — the host exposes `window` but no Cocos `cc`
10
+ * global (vanilla browser, Electron renderer, embedded WebView).
11
+ * - `"nodejs"` — neither of the above (Node.js, edge runtimes).
12
+ */
1
13
  type PlatformType = "cocos" | "browser" | "nodejs";
14
+ /**
15
+ * Detects the host runtime once during {@link GNNetwork.init} and
16
+ * exposes the result through small static accessors.
17
+ *
18
+ * Used for branching across runtime-specific code paths:
19
+ * - {@link StorageService} picks between `cc.sys.localStorage`,
20
+ * `window.localStorage` and the npm `store` package.
21
+ * - {@link HttpPeer} downgrades MsgPack HTTP requests to JSON in
22
+ * browsers because the browser HTTP path cannot reliably
23
+ * consume a MsgPack response across vendors.
24
+ * - {@link NetworkingPeerAxiosRequest} only emits the custom
25
+ * `User-Agent` / `Content-Length` headers from Node.js because
26
+ * browsers refuse to let JavaScript override them.
27
+ *
28
+ * Detection runs exactly once because the runtime cannot change
29
+ * mid-process; the cached values are accessed via the boolean
30
+ * helpers without re-running the checks.
31
+ */
2
32
  export declare class GNSupport {
33
+ /** Cached `_platformType === "browser"` flag. */
3
34
  private static _isBrowser;
35
+ /** Cached `_platformType === "cocos"` flag. */
4
36
  private static _isCocosCreator;
37
+ /** Cached platform identifier. */
5
38
  private static _platformType;
39
+ /**
40
+ * Init guard so {@link init} is idempotent — the SDK calls it
41
+ * from {@link GNNetwork.init} but defensive call sites may
42
+ * also invoke it.
43
+ */
6
44
  private static _initialized;
45
+ /**
46
+ * Detects the runtime environment and caches the result.
47
+ *
48
+ * Detection order matters: Cocos must come first because the
49
+ * Cocos web build still exposes `window`. Once `cc.sys` is
50
+ * present we treat the host as Cocos even if `window` is also
51
+ * defined.
52
+ *
53
+ * Safe to call multiple times — the {@link _initialized} guard
54
+ * makes the second call a no-op.
55
+ */
7
56
  static init(): void;
8
57
  /**
9
- * Check if running in standard browser environment
58
+ * Returns whether the host runtime exposes a `window` global.
59
+ *
60
+ * Note that this returns `true` for both vanilla browsers and
61
+ * the Cocos web build — when you need to distinguish those two
62
+ * cases use {@link isCocosCreator} or
63
+ * {@link getPlatformType} instead.
10
64
  */
11
65
  static isBrowser(): boolean;
12
66
  /**
13
- * Check if running in Cocos Creator 3.x environment
67
+ * Returns whether the host runtime is Cocos Creator (detected
68
+ * via the `cc.sys` global).
14
69
  */
15
70
  static isCocosCreator(): boolean;
16
71
  /**
17
- * Check if running in Node.js environment
72
+ * Returns whether the host runtime is Node.js (or any other
73
+ * environment that exposes neither `window` nor `cc.sys`).
18
74
  */
19
75
  static isNodeJS(): boolean;
20
76
  /**
21
- * Get the current platform type
77
+ * Returns the cached {@link PlatformType} discriminator.
78
+ *
79
+ * Useful for `switch` statements that need to handle the three
80
+ * runtimes distinctly — see {@link StorageService.getString}
81
+ * for the canonical example.
22
82
  */
23
83
  static getPlatformType(): PlatformType;
24
84
  }
@@ -1,10 +1,64 @@
1
1
  import { GenericModels } from "./../entity/models/GenericModels";
2
+ /**
3
+ * Convenience converters that turn the array-shaped collections
4
+ * returned by the GearN API into `Map<string, T>` lookups keyed by
5
+ * the most common business identifier.
6
+ *
7
+ * The SDK transports always deliver collections as arrays so the
8
+ * wire format stays JSON / MsgPack friendly. Application code
9
+ * usually wants O(1) lookup by id; wrapping each call site in a
10
+ * small `for` loop is repetitive, so this helper centralises the
11
+ * conversion.
12
+ *
13
+ * Each method returns `null` when the input is `null` so the call
14
+ * site can chain it after a typed response without a separate
15
+ * null-check (`GNUtils.toFriendDictionary(response.getResponseData()?.playerFriends)`).
16
+ */
2
17
  export declare class GNUtils {
18
+ /**
19
+ * Indexes a {@link GenericModels.DataItem} array by its
20
+ * `key` field.
21
+ *
22
+ * Useful for player-data / custom-data responses where the
23
+ * application normally needs to look up entries by key. Later
24
+ * duplicates with the same key win, mirroring `Map.set`'s
25
+ * default behaviour.
26
+ *
27
+ * @param datas Source array, or `null`.
28
+ * @returns A keyed map, or `null` when `datas` is `null`.
29
+ */
3
30
  static toDatasDictionary(datas: Array<GenericModels.DataItem>): Map<string, GenericModels.DataItem>;
31
+ /**
32
+ * Indexes a {@link GenericModels.TagItem} array by its `key`
33
+ * field. Used for player / character tag responses.
34
+ */
4
35
  static toTagsDictionary(tags: Array<GenericModels.TagItem>): Map<string, GenericModels.TagItem>;
36
+ /**
37
+ * Indexes a {@link GenericModels.CurrencyItem} array by its
38
+ * `key` field. Used for player / group currency responses.
39
+ */
5
40
  static toCurrenciesDictionary(currencies: Array<GenericModels.CurrencyItem>): Map<string, GenericModels.CurrencyItem>;
41
+ /**
42
+ * Indexes a {@link GenericModels.StatisticsItem} array by its
43
+ * `key` field. Used for player / group statistic responses.
44
+ */
6
45
  static toStatisticsDictionary(statistics: Array<GenericModels.StatisticsItem>): Map<string, GenericModels.StatisticsItem>;
46
+ /**
47
+ * Indexes a {@link GenericModels.InventoryItem} array by its
48
+ * `itemId` field — the unique inventory ledger entry id, not
49
+ * the catalog identifier. To bucket by catalog id instead,
50
+ * write a custom loop using the `classId` field.
51
+ */
7
52
  static toInventoriesDictionary(inventories: Array<GenericModels.InventoryItem>): Map<string, GenericModels.InventoryItem>;
53
+ /**
54
+ * Indexes a {@link GenericModels.GroupItem} array by its
55
+ * `groupId` field. Used for player-group lookup responses.
56
+ */
8
57
  static toGroupDictionary(groups: Array<GenericModels.GroupItem>): Map<string, GenericModels.GroupItem>;
58
+ /**
59
+ * Indexes a {@link GenericModels.FriendItem} array by its
60
+ * `friendId` field. Used for player-friend lookup responses
61
+ * and to drive social UIs that need O(1) presence checks.
62
+ */
9
63
  static toFriendDictionary(friends: Array<GenericModels.FriendItem>): Map<string, GenericModels.FriendItem>;
10
64
  }
@@ -1,4 +1,52 @@
1
+ /**
2
+ * Thin wrapper around the `@msgpack/msgpack` codec.
3
+ *
4
+ * Used by both transports for binary wire-format serialisation:
5
+ * - {@link NetworkingPeerSocketIOClient.emit} encodes outbound socket
6
+ * frames when {@link MessageType.MsgPack} is selected.
7
+ * - {@link NetworkingSocketPeerBase.service} decodes inbound socket
8
+ * frames flagged as MsgPack via {@link SocketPacket.isMsgPack}.
9
+ * - {@link NetworkingPeerAxiosRequest.postRequestAxios} encodes the
10
+ * HTTP request body when MsgPack is selected (Node.js / Cocos
11
+ * only — browser HTTP is downgraded to JSON inside
12
+ * {@link HttpPeer.send}).
13
+ * - {@link HttpPeer.onSendOperationRequestResponse} decodes
14
+ * non-JSON HTTP response bodies via {@link deserialize}.
15
+ *
16
+ * The wrapper exists so the SDK does not import the codec directly
17
+ * from every call site; centralising the import also makes it
18
+ * trivial to swap the underlying library if a future port needs a
19
+ * different MsgPack implementation.
20
+ */
1
21
  export declare class MessagePackConverterService {
22
+ /**
23
+ * Encodes any JSON-compatible value into a MessagePack byte
24
+ * buffer.
25
+ *
26
+ * The codec accepts the same value space as `JSON.stringify`
27
+ * (objects, arrays, numbers, strings, booleans, `null`) plus a
28
+ * few extras such as `Uint8Array` (encoded as the MsgPack
29
+ * `bin` type). Cyclic graphs throw — the SDK never builds them
30
+ * because every payload originates from
31
+ * {@link GNHashtable.toData} / {@link GNArray.toData} which
32
+ * produce a tree.
33
+ *
34
+ * @param tObj Value to encode. Pass the result of
35
+ * `gnHashtable.toData()` for SDK request payloads.
36
+ * @returns MessagePack-encoded bytes ready for transmission.
37
+ */
2
38
  static serialize<T>(tObj: T): Uint8Array;
39
+ /**
40
+ * Decodes a MessagePack byte buffer into a plain JavaScript
41
+ * value.
42
+ *
43
+ * The result is cast to `T` for caller convenience; the runtime
44
+ * shape always reflects what the codec actually decoded
45
+ * (typically a plain object that the SDK feeds into
46
+ * {@link GNHashtable.builder}).
47
+ *
48
+ * @param data Bytes received from the transport.
49
+ * @returns Decoded value cast to `T`.
50
+ */
3
51
  static deserialize<T>(data: Uint8Array): T;
4
52
  }
@@ -1,7 +1,58 @@
1
1
  import { RequestRole } from "./../constant/enumType/RequestRole";
2
2
  import { RequestType } from "./../constant/enumType/RequestType";
3
3
  import { OperationRequest } from "./../entity/OperationRequest";
4
+ /**
5
+ * Wire-shape encoder for outbound socket frames.
6
+ *
7
+ * The GearN socket protocol expects an array (not a JSON object) so
8
+ * that the most common case — request + response correlation —
9
+ * survives MsgPack encoding without paying the per-key overhead of
10
+ * the map type. {@link toSocketData} builds that array.
11
+ *
12
+ * The corresponding HTTP path uses a different shape (typed JSON
13
+ * body keyed by parameter codes) and is **not** produced through
14
+ * this helper; the Axios call inside {@link HttpPeer} talks
15
+ * directly to {@link GNHashtable.toData}.
16
+ */
4
17
  export declare class OperationHelper {
18
+ /**
19
+ * Builds the wire-format array sent over the socket.
20
+ *
21
+ * Layout produced:
22
+ * - Index 0: request-type display name (e.g. `"authenticate"`).
23
+ * - Index 1: request-role display name (e.g. `"client"`).
24
+ * - Index 2: operation code string from
25
+ * {@link OperationCode}.
26
+ * - Index 3: parameter bag dumped via
27
+ * {@link GNHashtable.toData}, or `null` when the request has
28
+ * no parameters.
29
+ * - Index 4 (only when `requestId !== -1`): request id used by
30
+ * the backend to correlate the response. Omitted entirely
31
+ * for fire-and-forget calls.
32
+ *
33
+ * The display-name conversions go through {@link CodeHelper}
34
+ * which produces the lowercased-first-letter form the backend
35
+ * expects (e.g. `RequestType.Authenticate` → `"authenticate"`).
36
+ *
37
+ * @param requestType Logical request category.
38
+ * @param role Permission scope.
39
+ * @param request Pre-built request to encode.
40
+ * @returns Array ready to be MsgPack-encoded /
41
+ * JSON-stringified by the caller.
42
+ */
5
43
  static toSocketData(requestType: RequestType, role: RequestRole, request: OperationRequest): any;
44
+ /**
45
+ * Reserved for future HTTP payload conversion.
46
+ *
47
+ * The current HTTP path bypasses this helper because the
48
+ * payload it sends is already shaped exactly like the inner
49
+ * `GNHashtable` (the operation code, request type and role go
50
+ * into the URL instead of the body). The method exists so a
51
+ * future protocol revision that needs HTTP-side restructuring
52
+ * has a natural home for the new logic without changing the
53
+ * call sites.
54
+ *
55
+ * Always returns `null` today.
56
+ */
6
57
  static toHttpData(requestType: RequestType, role: RequestRole, request: OperationRequest): any;
7
58
  }
@@ -1,18 +1,58 @@
1
1
  /**
2
- * StorageService - Cross-platform storage abstraction for GearN SDK
3
- * Supports: Browser localStorage, Node.js, Cocos Creator 3.x
2
+ * Cross-platform key/value persistence used by the SDK.
3
+ *
4
+ * Used by:
5
+ * - {@link GNNetwork.init} to hydrate the cached
6
+ * {@link AuthenticateStatus} from `[GearN]_AUTH_TOKEN_KEY` and
7
+ * `[GearN]_USER_ID_KEY` so a process restart resumes the
8
+ * previous session.
9
+ * - {@link PeerBase.onResponseHandler} to mirror a fresh auth
10
+ * token / user id onto disk every time a successful response
11
+ * carries the matching parameters.
12
+ *
13
+ * Backend selection follows {@link GNSupport.getPlatformType}:
14
+ * - **`"cocos"`**: `cc.sys.localStorage` (Cocos Creator's own
15
+ * wrapper around the platform storage).
16
+ * - **`"browser"`**: `window.localStorage`.
17
+ * - **`"nodejs"`**: the `store` npm package, which picks the best
18
+ * available backend (file system, SQLite, ...).
19
+ *
20
+ * Failure handling: every method runs inside `try/catch` and logs
21
+ * via `console.warn` on failure rather than throwing, because
22
+ * storage failures (quota exceeded, permissions denied, missing
23
+ * primitives in old Cocos builds) should not crash the SDK
24
+ * bootstrap path.
4
25
  */
5
26
  export declare class StorageService {
6
27
  /**
7
- * Get a value from storage
8
- * @param key Storage key
9
- * @param defaultValue Default value if key doesn't exist
28
+ * Reads a previously persisted string.
29
+ *
30
+ * @param key Storage key (e.g.
31
+ * `GNNetwork.AUTH_TOKEN_KEY`).
32
+ * @param defaultValue Value returned when the key is absent or
33
+ * storage access throws. Defaults to `""`
34
+ * so callers can use the result without a
35
+ * null check.
36
+ * @returns Stored value, or `defaultValue` when the
37
+ * key is missing / storage fails.
38
+ *
39
+ * Implementation note: the return type is `any` because the
40
+ * Node.js path delegates to the `store` package's typed
41
+ * accessor which already handles the default value internally.
42
+ * Treat the result as `string` at call sites.
10
43
  */
11
44
  static getString(key: string, defaultValue?: string): any;
12
45
  /**
13
- * Set a value in storage
14
- * @param key Storage key
15
- * @param value Value to store
46
+ * Persists a string under `key`.
47
+ *
48
+ * Storage failures are swallowed and logged via `console.warn`
49
+ * — most call sites ({@link PeerBase.onResponseHandler}) want
50
+ * the SDK to keep working even when persistence is denied
51
+ * (private-mode browsers, full disk on Cocos device builds).
52
+ *
53
+ * @param key Storage key.
54
+ * @param value Value to persist. Pass `""` to clear the slot
55
+ * (the SDK uses this when explicitly logging out).
16
56
  */
17
57
  static setString(key: string, value: string): void;
18
58
  }
@@ -1,15 +1,132 @@
1
+ /**
2
+ * Hierarchical log verbosity levels consumed by {@link GNDebug}.
3
+ *
4
+ * The values are deliberately ordered so that a higher number includes every
5
+ * lower level. The numeric ordering is what {@link GNDebug.log},
6
+ * {@link GNDebug.logError}, {@link GNDebug.logWarning} and
7
+ * {@link GNDebug.logException} compare against, which yields the following
8
+ * inclusion table:
9
+ *
10
+ * | Configured LogType | Exception | Error | Warning | Verbose `log()` |
11
+ * |--------------------|:---------:|:-----:|:-------:|:---------------:|
12
+ * | `Off` (0) | - | - | - | - |
13
+ * | `Exception` (1) | X | - | - | - |
14
+ * | `Error` (2) | X | X | - | - |
15
+ * | `Warning` (3) | X | X | X | - |
16
+ * | `All` (4) | X | X | X | X |
17
+ *
18
+ * The default level used by the SDK is whatever `GNServerSettings.getLogType()`
19
+ * returns — `LogType.All` until the application overrides it.
20
+ */
1
21
  export declare enum LogType {
22
+ /** Suppress every category of log output. */
2
23
  Off = 0,
24
+ /** Allow only `logException` calls to reach the console. */
3
25
  Exception = 1,
26
+ /** Allow exceptions plus errors. */
4
27
  Error = 2,
28
+ /** Allow exceptions, errors and warnings. */
5
29
  Warning = 3,
30
+ /** Allow every category, including verbose `log` traces from the transports. */
6
31
  All = 4
7
32
  }
33
+ /**
34
+ * Static logging facade used by every internal SDK module.
35
+ *
36
+ * The class is a thin level-gated wrapper around `console.log`,
37
+ * `console.warn` and `console.error`. It is intentionally global so that
38
+ * networking code, helpers and converters can all emit log lines without
39
+ * having to thread a logger reference through every call.
40
+ *
41
+ * Lifecycle:
42
+ * - The level is uninitialised until `GNNetwork.init()` calls
43
+ * {@link setLogType} with the value from
44
+ * `GNServerSettings.getLogType()`. Until that point any call to the
45
+ * `log*` methods will compare against `undefined` and therefore log
46
+ * nothing — be aware of this when adding code that runs before init.
47
+ * - The level can be updated at runtime by calling {@link setLogType} again,
48
+ * which takes effect on the very next call.
49
+ *
50
+ * Output destination:
51
+ * - Always `console.*` of the host runtime (browser DevTools, Node.js stdout
52
+ * / stderr, or the Cocos Creator log panel). The SDK does not write to a
53
+ * file or remote sink — wiring custom log shipping is the application's
54
+ * responsibility.
55
+ *
56
+ * Thread-safety / concurrency:
57
+ * - JavaScript is single-threaded so no synchronisation is required around
58
+ * `_logType`. Mutations from inside event handlers are visible immediately.
59
+ */
8
60
  export declare class GNDebug {
61
+ /**
62
+ * Currently configured maximum verbosity level.
63
+ *
64
+ * Stays `undefined` until {@link setLogType} is called for the first
65
+ * time, which is why the level comparisons in the `log*` helpers below
66
+ * use `>=` against the requested category instead of relying on a
67
+ * default value here.
68
+ */
9
69
  private static _logType;
70
+ /**
71
+ * Replaces the global log verbosity level.
72
+ *
73
+ * Effect is immediate; the next call to any of the `log*` helpers uses
74
+ * the new value. Passing {@link LogType.Off} silences the SDK
75
+ * completely until a higher level is restored.
76
+ *
77
+ * @param logType New level to apply. Higher values include all lower
78
+ * categories (see the inclusion table on {@link LogType}).
79
+ */
10
80
  static setLogType(logType: LogType): void;
81
+ /**
82
+ * Writes a verbose trace line.
83
+ *
84
+ * Used by the transports to surface every queued/sent/received frame
85
+ * (see `[GN Socket SEND]`, `[GN RECV]`, ... prefixes in the networking
86
+ * code) plus other low-frequency informational events like the SDK
87
+ * banner emitted from `GNNetwork.init()`.
88
+ *
89
+ * Only fires when the current level is {@link LogType.All}.
90
+ *
91
+ * @param message Anything the host `console.log` accepts — strings,
92
+ * objects, errors, etc. The value is forwarded as-is so
93
+ * custom `toString()` implementations are honoured.
94
+ */
11
95
  static log(message: any): void;
96
+ /**
97
+ * Writes a captured exception via `console.error`.
98
+ *
99
+ * Fires for every level except {@link LogType.Off}. Prefer this over
100
+ * {@link logError} when you have an actual `Error` instance because it
101
+ * preserves the stack trace produced by the host runtime.
102
+ *
103
+ * @param exception Error instance to print. The SDK never serialises
104
+ * the value first — passing a plain object is allowed
105
+ * but loses the formatted stack trace.
106
+ */
12
107
  static logException(exception: Error): void;
108
+ /**
109
+ * Writes a non-fatal warning via `console.warn`.
110
+ *
111
+ * Fires when the level is at least {@link LogType.Warning}. Used by the
112
+ * SDK for recoverable issues like missing storage features in
113
+ * {@link StorageService} or incoming events that no handler subscribed
114
+ * to.
115
+ *
116
+ * @param message Anything the host `console.warn` accepts.
117
+ */
13
118
  static logWarning(message: any): void;
119
+ /**
120
+ * Writes an error message via `console.error`.
121
+ *
122
+ * Fires when the level is at least {@link LogType.Error}. Used by the
123
+ * SDK whenever a request cannot be sent (`isUse === false`), an unknown
124
+ * `responseId` arrives, or any HTTP/socket failure surfaces from the
125
+ * underlying transport.
126
+ *
127
+ * @param message Anything the host `console.error` accepts. For real
128
+ * exception objects prefer {@link logException} so the
129
+ * stack trace is preserved.
130
+ */
14
131
  static logError(message: any): void;
15
132
  }
@@ -1,8 +1,72 @@
1
+ /**
2
+ * In-memory cache of the auth-related state shared across the SDK.
3
+ *
4
+ * Owned by {@link NetworkingPeer}; populated during {@link GNNetwork.init}
5
+ * from the persisted entries on {@link StorageService} (keys
6
+ * `[GearN]_AUTH_TOKEN_KEY` and `[GearN]_USER_ID_KEY`) and refreshed
7
+ * automatically by {@link PeerBase.onResponseHandler} every time a
8
+ * successful response carries a new `authToken` or `userId`.
9
+ *
10
+ * Lifecycle and consistency:
11
+ * - The instance lives for the lifetime of the JS realm; there is no
12
+ * `dispose()`.
13
+ * - Mutations are immediately visible to every caller because
14
+ * {@link NetworkingPeer.sendViaSocket} / `sendViaHttp` read the
15
+ * current values right before each send.
16
+ * - Mutating the fields directly bypasses the persistent storage
17
+ * layer. If you need a persisted update prefer
18
+ * {@link GNNetwork.setNewAuthenticateStatus}, which writes through
19
+ * to both {@link StorageService} and this cache.
20
+ */
1
21
  export declare class AuthenticateStatus {
22
+ /**
23
+ * Cached auth token used as the default value sent with every
24
+ * authenticated request when the caller does not pass an explicit
25
+ * override.
26
+ */
2
27
  private authToken;
28
+ /**
29
+ * Cached user id resolved from the most recent successful auth
30
+ * response. Updated together with {@link authToken} during the
31
+ * normal login / refresh flows.
32
+ */
3
33
  private userId;
34
+ /**
35
+ * Returns the cached auth token.
36
+ *
37
+ * @returns Token string, or an empty string when no successful
38
+ * login has happened yet (and storage held no prior
39
+ * value).
40
+ */
4
41
  getAuthToken(): string;
42
+ /**
43
+ * Updates the cached auth token in memory only.
44
+ *
45
+ * Called automatically by the response handler when a successful
46
+ * response carries a fresh `authToken`. Application code should
47
+ * normally use {@link GNNetwork.setNewAuthenticateStatus} so that
48
+ * the change is also written to {@link StorageService}.
49
+ *
50
+ * @param authToken New token. Pass `""` to clear the cached value
51
+ * without persisting; pass via the public helper
52
+ * if you also want the persisted entry cleared.
53
+ */
5
54
  setAuthToken(authToken: string): void;
55
+ /**
56
+ * Returns the cached user id.
57
+ *
58
+ * @returns User id string, or an empty string when no successful
59
+ * login has happened yet.
60
+ */
6
61
  getUserId(): string;
62
+ /**
63
+ * Updates the cached user id in memory only.
64
+ *
65
+ * Same caveat as {@link setAuthToken}: bypasses
66
+ * {@link StorageService}. Use
67
+ * {@link GNNetwork.setNewAuthenticateStatus} for a persisted update.
68
+ *
69
+ * @param userId New user id.
70
+ */
7
71
  setUserId(userId: string): void;
8
72
  }