@xmobitea/gn-typescript-client 2.6.13 → 2.6.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +37 -0
- package/README.MD +420 -1
- package/dist/gearn.js.client.js +25056 -1056
- package/dist/gearn.js.client.min.js +1 -1
- package/dist/index.d.ts +30 -0
- package/dist/index.js +24236 -212
- package/dist/runtime/GNNetwork.d.ts +687 -3
- package/dist/runtime/GNNetworkAuthenticateApi.d.ts +327 -0
- package/dist/runtime/GNNetworkCharacterPlayerApi.d.ts +1026 -0
- package/dist/runtime/GNNetworkCloudScriptApi.d.ts +141 -0
- package/dist/runtime/GNNetworkContentApi.d.ts +243 -0
- package/dist/runtime/GNNetworkDashboardApi.d.ts +221 -0
- package/dist/runtime/GNNetworkGamePlayerApi.d.ts +1033 -0
- package/dist/runtime/GNNetworkGroupApi.d.ts +783 -0
- package/dist/runtime/GNNetworkInventoryApi.d.ts +673 -0
- package/dist/runtime/GNNetworkMasterPlayerApi.d.ts +1614 -6
- package/dist/runtime/GNNetworkMultiplayerApi.d.ts +234 -0
- package/dist/runtime/GNNetworkStoreInventoryApi.d.ts +309 -0
- package/dist/runtime/common/Action0.d.ts +30 -0
- package/dist/runtime/common/Action1.d.ts +32 -0
- package/dist/runtime/common/Action2.d.ts +21 -0
- package/dist/runtime/common/Action3.d.ts +16 -0
- package/dist/runtime/common/Action4.d.ts +17 -0
- package/dist/runtime/common/GNData.d.ts +368 -0
- package/dist/runtime/config/GNServerSettings.d.ts +442 -12
- package/dist/runtime/constant/Commands.d.ts +80 -0
- package/dist/runtime/constant/EventCode.d.ts +48 -0
- package/dist/runtime/constant/OperationCode.d.ts +74 -1
- package/dist/runtime/constant/ReturnCode.d.ts +72 -0
- package/dist/runtime/constant/enumType/ExecuteResponseStatus.d.ts +31 -0
- package/dist/runtime/constant/enumType/FriendStatus.d.ts +39 -0
- package/dist/runtime/constant/enumType/GoogleLoginType.d.ts +23 -0
- package/dist/runtime/constant/enumType/GroupStatus.d.ts +32 -0
- package/dist/runtime/constant/enumType/InvalidMemberType.d.ts +75 -0
- package/dist/runtime/constant/enumType/ItemType.d.ts +23 -0
- package/dist/runtime/constant/enumType/MatchStatus.d.ts +30 -0
- package/dist/runtime/constant/enumType/MatchmakingMemberStatus.d.ts +24 -0
- package/dist/runtime/constant/enumType/MatchmakingTicketStatus.d.ts +34 -0
- package/dist/runtime/constant/enumType/OwnerType.d.ts +40 -0
- package/dist/runtime/constant/enumType/PermissionDataItem.d.ts +22 -0
- package/dist/runtime/constant/enumType/PushPlatformType.d.ts +18 -0
- package/dist/runtime/constant/enumType/RequestRole.d.ts +32 -0
- package/dist/runtime/constant/enumType/RequestType.d.ts +70 -0
- package/dist/runtime/constant/enumType/StoreItemType.d.ts +21 -0
- package/dist/runtime/constant/enumType/StoreReceiveType.d.ts +30 -0
- package/dist/runtime/constant/errorCode/ErrorCode.d.ts +190 -8
- package/dist/runtime/constant/parameterCode/ParameterCode.d.ts +35 -5
- package/dist/runtime/entity/DataMember.d.ts +338 -0
- package/dist/runtime/entity/GNMetadata.d.ts +101 -0
- package/dist/runtime/entity/InvalidMember.d.ts +28 -0
- package/dist/runtime/entity/OperationEvent.d.ts +49 -0
- package/dist/runtime/entity/OperationRequest.d.ts +108 -0
- package/dist/runtime/entity/OperationResponse.d.ts +110 -0
- package/dist/runtime/entity/models/AuthenticateModels.d.ts +115 -0
- package/dist/runtime/entity/models/AuthenticateRequestModels.d.ts +131 -0
- package/dist/runtime/entity/models/AuthenticateResponseModels.d.ts +131 -0
- package/dist/runtime/entity/models/CharacterPlayerModels.d.ts +625 -1
- package/dist/runtime/entity/models/CharacterPlayerRequestModels.d.ts +972 -0
- package/dist/runtime/entity/models/CharacterPlayerResponseModels.d.ts +332 -0
- package/dist/runtime/entity/models/CloudScriptModels.d.ts +109 -0
- package/dist/runtime/entity/models/CloudScriptRequestModels.d.ts +107 -0
- package/dist/runtime/entity/models/CloudScriptResponseModels.d.ts +46 -0
- package/dist/runtime/entity/models/ContentModels.d.ts +124 -0
- package/dist/runtime/entity/models/ContentRequestModels.d.ts +152 -0
- package/dist/runtime/entity/models/ContentResponseModels.d.ts +58 -0
- package/dist/runtime/entity/models/DashboardModels.d.ts +371 -8
- package/dist/runtime/entity/models/DashboardRequestModels.d.ts +172 -0
- package/dist/runtime/entity/models/DashboardResponseModels.d.ts +170 -0
- package/dist/runtime/entity/models/GamePlayerModels.d.ts +644 -1
- package/dist/runtime/entity/models/GamePlayerRequestModels.d.ts +959 -0
- package/dist/runtime/entity/models/GamePlayerResponseModels.d.ts +333 -1
- package/dist/runtime/entity/models/GenericModels.d.ts +94 -0
- package/dist/runtime/entity/models/GroupModels.d.ts +484 -2
- package/dist/runtime/entity/models/GroupRequestModels.d.ts +737 -0
- package/dist/runtime/entity/models/GroupResponseModels.d.ts +254 -0
- package/dist/runtime/entity/models/InventoryModels.d.ts +415 -0
- package/dist/runtime/entity/models/InventoryRequestModels.d.ts +629 -0
- package/dist/runtime/entity/models/InventoryResponseModels.d.ts +218 -0
- package/dist/runtime/entity/models/MasterPlayerModels.d.ts +1065 -3
- package/dist/runtime/entity/models/MasterPlayerRequestModels.d.ts +1560 -6
- package/dist/runtime/entity/models/MasterPlayerResponseModels.d.ts +532 -1
- package/dist/runtime/entity/models/MultiplayerModels.d.ts +199 -0
- package/dist/runtime/entity/models/MultiplayerRequestModels.d.ts +196 -0
- package/dist/runtime/entity/models/MultiplayerResponseModels.d.ts +74 -0
- package/dist/runtime/entity/models/StoreInventoryModels.d.ts +262 -0
- package/dist/runtime/entity/models/StoreInventoryRequestModels.d.ts +268 -0
- package/dist/runtime/entity/models/StoreInventoryResponseModels.d.ts +98 -0
- package/dist/runtime/entity/request/CustomOperationRequest.d.ts +99 -0
- package/dist/runtime/entity/response/CustomOperationResponse.d.ts +118 -0
- package/dist/runtime/entity/response/GetAuthInfoResponse.d.ts +53 -0
- package/dist/runtime/entity/response/HealthCheckResponse.d.ts +56 -0
- package/dist/runtime/entity/response/UploadFileResponse.d.ts +19 -0
- package/dist/runtime/helper/CodeHelper.d.ts +122 -0
- package/dist/runtime/helper/ConverterService.d.ts +74 -0
- package/dist/runtime/helper/EnumUtility.d.ts +63 -0
- package/dist/runtime/helper/GNSupport.d.ts +64 -4
- package/dist/runtime/helper/GNUtils.d.ts +54 -0
- package/dist/runtime/helper/MessagePackConverterService.d.ts +48 -0
- package/dist/runtime/helper/OperationHelper.d.ts +51 -0
- package/dist/runtime/helper/StorageService.d.ts +48 -8
- package/dist/runtime/logger/GNDebug.d.ts +117 -0
- package/dist/runtime/networking/AuthenticateStatus.d.ts +64 -0
- package/dist/runtime/networking/IPeer.d.ts +83 -0
- package/dist/runtime/networking/NetworkingPeer.d.ts +256 -1
- package/dist/runtime/networking/OperationPending.d.ts +112 -0
- package/dist/runtime/networking/PeerBase.d.ts +231 -0
- package/dist/runtime/networking/handler/IServerEventHandler.d.ts +84 -0
- package/dist/runtime/networking/handler/OnCharacterPlayerFriendUpdateEventHandler.d.ts +69 -0
- package/dist/runtime/networking/handler/OnCharacterPlayerGroupUpdateEventHandler.d.ts +49 -0
- package/dist/runtime/networking/handler/OnGamePlayerFriendUpdateEventHandler.d.ts +50 -0
- package/dist/runtime/networking/handler/OnGamePlayerGroupUpdateEventHandler.d.ts +41 -0
- package/dist/runtime/networking/handler/OnGroupMemberUpdateEventHandler.d.ts +47 -0
- package/dist/runtime/networking/handler/OnGroupMessageUpdateEventHandler.d.ts +46 -0
- package/dist/runtime/networking/http/HttpPeer.d.ts +173 -0
- package/dist/runtime/networking/http/NetworkingHttpPeerBase.d.ts +87 -0
- package/dist/runtime/networking/http/NetworkingPeerAxiosRequest.d.ts +113 -0
- package/dist/runtime/networking/socket/NetworkingPeerSocketIOClient.d.ts +145 -0
- package/dist/runtime/networking/socket/NetworkingSocketPeerBase.d.ts +198 -0
- package/dist/runtime/networking/socket/SocketPeer.d.ts +155 -0
- package/dist/runtime/typescript/ServiceUpdate.d.ts +46 -0
- package/docs/AI_CHEATSHEET.md +211 -0
- package/docs/COOKBOOK.md +912 -0
- package/docs/RULES.md +307 -0
- package/docs/ai-manifest.json +725 -0
- package/docs/guides/AUTHENTICATE.md +246 -0
- package/docs/guides/CHARACTER_PLAYER.md +439 -0
- package/docs/guides/CLOUDSCRIPT.md +335 -0
- package/docs/guides/COCOS_CREATOR_INTEGRATION.md +150 -0
- package/docs/guides/CONTENT.md +291 -0
- package/docs/guides/DASHBOARD.md +262 -0
- package/docs/guides/GAME_PLAYER.md +473 -0
- package/docs/guides/GROUP.md +412 -0
- package/docs/guides/INVENTORY.md +375 -0
- package/docs/guides/MASTER_PLAYER.md +458 -0
- package/docs/guides/MULTIPLAYER.md +303 -0
- package/docs/guides/STORE_INVENTORY.md +313 -0
- package/docs/llms-full.txt +43 -0
- package/docs/reference/API_AUTHENTICATE.md +75 -0
- package/docs/reference/API_CHARACTER_PLAYER.md +226 -0
- package/docs/reference/API_CLOUDSCRIPT.md +82 -0
- package/docs/reference/API_CONTENT.md +88 -0
- package/docs/reference/API_DASHBOARD.md +82 -0
- package/docs/reference/API_GAME_PLAYER.md +223 -0
- package/docs/reference/API_GROUP.md +187 -0
- package/docs/reference/API_INDEX.md +57 -0
- package/docs/reference/API_INVENTORY.md +169 -0
- package/docs/reference/API_MASTER_PLAYER.md +323 -0
- package/docs/reference/API_MULTIPLAYER.md +97 -0
- package/docs/reference/API_STORE_INVENTORY.md +109 -0
- package/docs/reference/CONFIG.md +107 -0
- package/docs/reference/DTO_INDEX.md +2543 -0
- package/docs/reference/ENUMS.md +433 -0
- package/docs/reference/ERROR_HANDLING.md +159 -0
- package/docs/reference/EVENTS.md +188 -0
- package/docs/reference/PERMISSION_RULES.md +55 -0
- package/docs/reference/dto/AUTHENTICATE.md +619 -0
- package/docs/reference/dto/CHARACTER_PLAYER.md +3686 -0
- package/docs/reference/dto/CLOUDSCRIPT.md +400 -0
- package/docs/reference/dto/CONTENT.md +548 -0
- package/docs/reference/dto/DASHBOARD.md +1980 -0
- package/docs/reference/dto/GAME_PLAYER.md +3631 -0
- package/docs/reference/dto/GENERIC.md +151 -0
- package/docs/reference/dto/GROUP.md +2842 -0
- package/docs/reference/dto/INVENTORY.md +2385 -0
- package/docs/reference/dto/MASTER_PLAYER.md +6024 -0
- package/docs/reference/dto/MULTIPLAYER.md +850 -0
- package/docs/reference/dto/STORE_INVENTORY.md +1262 -0
- package/llms.txt +47 -0
- package/package.json +12 -3
- package/GNServerSettings.debug.json +0 -21
- package/docs/COCOS_CREATOR_INTEGRATION.md +0 -116
- package/examples/cocos-creator/GearNExample.ts.txt +0 -176
- package/srcSwift/Package.swift +0 -32
- package/srcSwift/Sources/GearN/runtime/GNNetwork.swift +0 -530
- package/srcSwift/Sources/GearN/runtime/GNNetworkAuthenticateApi.swift +0 -178
- package/srcSwift/Sources/GearN/runtime/GNNetworkCharacterPlayerApi.swift +0 -1162
- package/srcSwift/Sources/GearN/runtime/GNNetworkCloudScriptApi.swift +0 -154
- package/srcSwift/Sources/GearN/runtime/GNNetworkContentApi.swift +0 -208
- package/srcSwift/Sources/GearN/runtime/GNNetworkDashboardApi.swift +0 -240
- package/srcSwift/Sources/GearN/runtime/GNNetworkGamePlayerApi.swift +0 -1369
- package/srcSwift/Sources/GearN/runtime/GNNetworkGroupApi.swift +0 -1100
- package/srcSwift/Sources/GearN/runtime/GNNetworkInventoryApi.swift +0 -937
- package/srcSwift/Sources/GearN/runtime/GNNetworkMasterPlayerApi.swift +0 -2323
- package/srcSwift/Sources/GearN/runtime/GNNetworkMultiplayerApi.swift +0 -298
- package/srcSwift/Sources/GearN/runtime/GNNetworkStoreInventoryApi.swift +0 -397
- package/srcSwift/Sources/GearN/runtime/common/Action0.swift +0 -3
- package/srcSwift/Sources/GearN/runtime/common/Action1.swift +0 -3
- package/srcSwift/Sources/GearN/runtime/common/Action2.swift +0 -3
- package/srcSwift/Sources/GearN/runtime/common/Action3.swift +0 -3
- package/srcSwift/Sources/GearN/runtime/common/Action4.swift +0 -3
- package/srcSwift/Sources/GearN/runtime/common/GNArray.swift +0 -204
- package/srcSwift/Sources/GearN/runtime/common/GNData.swift +0 -108
- package/srcSwift/Sources/GearN/runtime/common/GNHashtable.swift +0 -200
- package/srcSwift/Sources/GearN/runtime/config/GNServerSettings.swift +0 -95
- package/srcSwift/Sources/GearN/runtime/constant/Commands.swift +0 -28
- package/srcSwift/Sources/GearN/runtime/constant/EventCode.swift +0 -10
- package/srcSwift/Sources/GearN/runtime/constant/OperationCode.swift +0 -252
- package/srcSwift/Sources/GearN/runtime/constant/ReturnCode.swift +0 -19
- package/srcSwift/Sources/GearN/runtime/constant/enumType/ExecuteResponseStatus.swift +0 -9
- package/srcSwift/Sources/GearN/runtime/constant/enumType/FriendStatus.swift +0 -8
- package/srcSwift/Sources/GearN/runtime/constant/enumType/GoogleLoginType.swift +0 -6
- package/srcSwift/Sources/GearN/runtime/constant/enumType/GroupStatus.swift +0 -8
- package/srcSwift/Sources/GearN/runtime/constant/enumType/InvalidMemberType.swift +0 -19
- package/srcSwift/Sources/GearN/runtime/constant/enumType/ItemType.swift +0 -6
- package/srcSwift/Sources/GearN/runtime/constant/enumType/MatchmakingMemberStatus.swift +0 -7
- package/srcSwift/Sources/GearN/runtime/constant/enumType/MatchmakingTicketStatus.swift +0 -9
- package/srcSwift/Sources/GearN/runtime/constant/enumType/OwnerType.swift +0 -10
- package/srcSwift/Sources/GearN/runtime/constant/enumType/PermissionDataItem.swift +0 -6
- package/srcSwift/Sources/GearN/runtime/constant/enumType/PushPlatformType.swift +0 -6
- package/srcSwift/Sources/GearN/runtime/constant/enumType/RequestRole.swift +0 -7
- package/srcSwift/Sources/GearN/runtime/constant/enumType/RequestType.swift +0 -16
- package/srcSwift/Sources/GearN/runtime/constant/enumType/StoreItemType.swift +0 -6
- package/srcSwift/Sources/GearN/runtime/constant/enumType/StoreReceiveType.swift +0 -9
- package/srcSwift/Sources/GearN/runtime/constant/errorCode/ErrorCode.swift +0 -58
- package/srcSwift/Sources/GearN/runtime/constant/parameterCode/ParameterCode.swift +0 -672
- package/srcSwift/Sources/GearN/runtime/entity/DataMember.swift +0 -196
- package/srcSwift/Sources/GearN/runtime/entity/GNMetadata.swift +0 -9
- package/srcSwift/Sources/GearN/runtime/entity/InvalidMember.swift +0 -11
- package/srcSwift/Sources/GearN/runtime/entity/OperationEvent.swift +0 -38
- package/srcSwift/Sources/GearN/runtime/entity/OperationHelper.swift +0 -28
- package/srcSwift/Sources/GearN/runtime/entity/OperationRequest.swift +0 -62
- package/srcSwift/Sources/GearN/runtime/entity/OperationResponse.swift +0 -98
- package/srcSwift/Sources/GearN/runtime/entity/models/AuthenticateModels.swift +0 -351
- package/srcSwift/Sources/GearN/runtime/entity/models/AuthenticateRequestModels.swift +0 -81
- package/srcSwift/Sources/GearN/runtime/entity/models/AuthenticateResponseModels.swift +0 -108
- package/srcSwift/Sources/GearN/runtime/entity/models/CharacterPlayerModels.swift +0 -1045
- package/srcSwift/Sources/GearN/runtime/entity/models/CharacterPlayerRequestModels.swift +0 -821
- package/srcSwift/Sources/GearN/runtime/entity/models/CharacterPlayerResponseModels.swift +0 -588
- package/srcSwift/Sources/GearN/runtime/entity/models/CloudScriptModels.swift +0 -187
- package/srcSwift/Sources/GearN/runtime/entity/models/CloudScriptRequestModels.swift +0 -84
- package/srcSwift/Sources/GearN/runtime/entity/models/CloudScriptResponseModels.swift +0 -59
- package/srcSwift/Sources/GearN/runtime/entity/models/ContentModels.swift +0 -195
- package/srcSwift/Sources/GearN/runtime/entity/models/ContentRequestModels.swift +0 -116
- package/srcSwift/Sources/GearN/runtime/entity/models/ContentResponseModels.swift +0 -81
- package/srcSwift/Sources/GearN/runtime/entity/models/DashboardModels.swift +0 -426
- package/srcSwift/Sources/GearN/runtime/entity/models/DashboardRequestModels.swift +0 -160
- package/srcSwift/Sources/GearN/runtime/entity/models/DashboardResponseModels.swift +0 -82
- package/srcSwift/Sources/GearN/runtime/entity/models/GamePlayerModels.swift +0 -1334
- package/srcSwift/Sources/GearN/runtime/entity/models/GamePlayerRequestModels.swift +0 -643
- package/srcSwift/Sources/GearN/runtime/entity/models/GamePlayerResponseModels.swift +0 -213
- package/srcSwift/Sources/GearN/runtime/entity/models/GenericModels.swift +0 -171
- package/srcSwift/Sources/GearN/runtime/entity/models/GroupModels.swift +0 -850
- package/srcSwift/Sources/GearN/runtime/entity/models/GroupRequestModels.swift +0 -485
- package/srcSwift/Sources/GearN/runtime/entity/models/GroupResponseModels.swift +0 -165
- package/srcSwift/Sources/GearN/runtime/entity/models/InventoryModels.swift +0 -679
- package/srcSwift/Sources/GearN/runtime/entity/models/InventoryRequestModels.swift +0 -413
- package/srcSwift/Sources/GearN/runtime/entity/models/InventoryResponseModels.swift +0 -141
- package/srcSwift/Sources/GearN/runtime/entity/models/MasterPlayerModels.swift +0 -378
- package/srcSwift/Sources/GearN/runtime/entity/models/MasterPlayerRequestModels.swift +0 -147
- package/srcSwift/Sources/GearN/runtime/entity/models/MasterPlayerResponseModels.swift +0 -318
- package/srcSwift/Sources/GearN/runtime/entity/models/MultiplayerModels.swift +0 -319
- package/srcSwift/Sources/GearN/runtime/entity/models/MultiplayerRequestModels.swift +0 -125
- package/srcSwift/Sources/GearN/runtime/entity/models/MultiplayerResponseModels.swift +0 -45
- package/srcSwift/Sources/GearN/runtime/entity/models/StoreInventoryModels.swift +0 -633
- package/srcSwift/Sources/GearN/runtime/entity/models/StoreInventoryRequestModels.swift +0 -173
- package/srcSwift/Sources/GearN/runtime/entity/models/StoreInventoryResponseModels.swift +0 -61
- package/srcSwift/Sources/GearN/runtime/entity/request/CustomOperationRequest.swift +0 -42
- package/srcSwift/Sources/GearN/runtime/entity/response/CustomOperationResponse.swift +0 -49
- package/srcSwift/Sources/GearN/runtime/entity/response/GetAuthInfoResponse.swift +0 -43
- package/srcSwift/Sources/GearN/runtime/entity/response/HealthCheckResponse.swift +0 -86
- package/srcSwift/Sources/GearN/runtime/entity/response/UploadFileResponse.swift +0 -15
- package/srcSwift/Sources/GearN/runtime/helper/CodeHelper.swift +0 -107
- package/srcSwift/Sources/GearN/runtime/helper/ConverterService.swift +0 -98
- package/srcSwift/Sources/GearN/runtime/helper/EnumUtility.swift +0 -34
- package/srcSwift/Sources/GearN/runtime/helper/GNSupport.swift +0 -41
- package/srcSwift/Sources/GearN/runtime/helper/GNUtils.swift +0 -66
- package/srcSwift/Sources/GearN/runtime/helper/MessagePackConverterService.swift +0 -21
- package/srcSwift/Sources/GearN/runtime/helper/StorageService.swift +0 -29
- package/srcSwift/Sources/GearN/runtime/logger/GNDebug.swift +0 -33
- package/srcSwift/Sources/GearN/runtime/networking/AuthenticateStatus.swift +0 -24
- package/srcSwift/Sources/GearN/runtime/networking/IPeer.swift +0 -8
- package/srcSwift/Sources/GearN/runtime/networking/NetworkingPeer.swift +0 -368
- package/srcSwift/Sources/GearN/runtime/networking/OperationPending.swift +0 -81
- package/srcSwift/Sources/GearN/runtime/networking/PeerBase.swift +0 -228
- package/srcSwift/Sources/GearN/runtime/networking/handler/IServerEventHandler.swift +0 -20
- package/srcSwift/Sources/GearN/runtime/networking/http/HttpPeer.swift +0 -226
- package/srcSwift/Sources/GearN/runtime/networking/http/HttpTypes.swift +0 -24
- package/srcSwift/Sources/GearN/runtime/networking/http/NetworkingHttpPeerBase.swift +0 -13
- package/srcSwift/Sources/GearN/runtime/networking/http/NetworkingPeerUrlSession.swift +0 -125
- package/srcSwift/Sources/GearN/runtime/networking/request/NetRequest.swift +0 -19
- package/srcSwift/Sources/GearN/runtime/networking/response/NetResponse.swift +0 -13
- package/srcSwift/Sources/GearN/runtime/networking/socket/NetworkingPeerSocketIOClient.swift +0 -244
- package/srcSwift/Sources/GearN/runtime/networking/socket/NetworkingSocketPeerBase.swift +0 -59
- package/srcSwift/Sources/GearN/runtime/networking/socket/SocketPeer.swift +0 -136
- package/tsconfig-build.cocos.json +0 -31
- package/webpack.config.cocos.mjs +0 -78
package/docs/RULES.md
ADDED
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
# RULES — Single Source of Truth
|
|
2
|
+
|
|
3
|
+
File này là canonical source cho mọi rule cross-cutting: route/permission, self/other-self, auth/socket, error handling, override params, anti-patterns. Các file khác (`README.MD`, `AGENTS.md`, guides) đều link tới đây thay vì lặp lại.
|
|
4
|
+
|
|
5
|
+
> Nếu phát hiện mâu thuẫn giữa RULES.md và file khác, RULES.md thắng.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 1. Init
|
|
10
|
+
|
|
11
|
+
- Public entrypoint duy nhất là static class `GNNetwork` (import từ `@xmobitea/gn-typescript-client`).
|
|
12
|
+
- Bắt buộc tạo `GNServerSettings`, gọi `settings.config({...})`, rồi `GNNetwork.init(settings)` **1 lần** ở bootstrap của mỗi app session.
|
|
13
|
+
- `init()` idempotent — lần thứ 2 bị ignore. Muốn đổi snapshot config toàn cục nên restart process. Mutate cùng `settings` object sau init chỉ ảnh hưởng một số request mới và không tự reconnect socket.
|
|
14
|
+
- Gọi API trước khi init → namespace `undefined` / `TypeError`.
|
|
15
|
+
- Config field: xem [reference/CONFIG.md](reference/CONFIG.md).
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## 2. Response checking (2-tier)
|
|
20
|
+
|
|
21
|
+
Typed response (mọi `*Async()` và callback form) expose **PUBLIC FIELDS** — không phải getter:
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
res.returnCode // transport/gateway layer
|
|
25
|
+
res.errorCode // business/domain layer
|
|
26
|
+
res.invalidMembers // chỉ set khi returnCode === InvalidRequestParameters
|
|
27
|
+
res.debugMessage // backend debug string
|
|
28
|
+
res.responseData // typed payload, chỉ set khi returnCode === Ok
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Pattern bắt buộc, đúng thứ tự:
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
if (res.returnCode !== ReturnCode.Ok) return; // transport/permission fail
|
|
35
|
+
if (res.errorCode !== ErrorCode.Ok) return; // business fail
|
|
36
|
+
useResult(res.responseData); // happy path
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Rule cứng:
|
|
40
|
+
|
|
41
|
+
- `Ok === 1` ở **cả** `ReturnCode` và `ErrorCode`. Không giả định `Ok === 0`.
|
|
42
|
+
- Không skip tầng 1 để đọc thẳng `errorCode`; khi `returnCode !== Ok`, `errorCode` và `responseData` **không đáng tin**.
|
|
43
|
+
- Không hardcode số (`if (res.returnCode === 1)`). So sánh bằng enum symbol.
|
|
44
|
+
- `*Async()` **không throw** business/transport error — reject Promise chỉ khi transport layer thật sự fail (network exception, serialization fail).
|
|
45
|
+
- Low-level raw `OperationResponse` (không dùng typed wrapper) có getter `getReturnCode()` etc. — chỉ dùng khi tự viết custom op.
|
|
46
|
+
|
|
47
|
+
Full table ReturnCode/ErrorCode + recommended action: [reference/ERROR_HANDLING.md](reference/ERROR_HANDLING.md). Phân biệt `SecretInvalid` / `OperationInvalid` / `OperationNotAllow` → § 5.
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## 3. Route = trust boundary của caller
|
|
52
|
+
|
|
53
|
+
Route `client / server / admin` mô tả **bên gọi** thực sự ở đâu, không phải target của mình hay của người khác.
|
|
54
|
+
|
|
55
|
+
| Route | Dùng khi code chạy ở |
|
|
56
|
+
|---|---|
|
|
57
|
+
| `client` (`GNNetwork.<group>`) | App / browser / mobile của player |
|
|
58
|
+
| `server` (`GNNetwork.<group>.server`) | Trusted backend: game server, internal service, worker, cron, webhook |
|
|
59
|
+
| `admin` (`GNNetwork.<group>.admin`) | Backoffice, dashboard, GM tool, migration tool, ops |
|
|
60
|
+
|
|
61
|
+
Rule cứng:
|
|
62
|
+
|
|
63
|
+
- Không chọn `server`/`admin` chỉ vì target không thuộc user hiện tại.
|
|
64
|
+
- Không dùng `.server` / `.admin` từ app client chỉ để vượt permission — bị coi là trust boundary leak, secret sẽ bị expose.
|
|
65
|
+
- Không suy diễn route chỉ từ việc request có hay không có `userId`.
|
|
66
|
+
- Route `server`/`admin` yêu cầu `secretKey` có flag `serverSelfEnable` / `adminSelfEnable` tương ứng (hoặc truyền `overrideSecretKey`).
|
|
67
|
+
|
|
68
|
+
### Ngoại lệ: `DashboardApi`
|
|
69
|
+
|
|
70
|
+
- Sau `loginByAdminAccountAsync` thành công, backend resolve admin context từ `authToken` — caller **không** cần cấu hình `secretKey` admin riêng.
|
|
71
|
+
- Public wrapper `GNNetwork.dashboard.*` vẫn đi `RequestRole.Client`.
|
|
72
|
+
- `GNNetwork.dashboard.server` và `GNNetwork.dashboard.admin` hiện **rỗng** (không có operation public).
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## 4. `self` vs `other-self` (chỉ áp dụng trên route `client`)
|
|
77
|
+
|
|
78
|
+
Backend suy ra thêm target context `self / other-self` cho route `client`:
|
|
79
|
+
|
|
80
|
+
| Domain | `self` = |
|
|
81
|
+
|---|---|
|
|
82
|
+
| `MasterPlayerApi`, `GamePlayerApi` | `userId` trong request trùng `userId` đã authenticate (hoặc request không truyền `userId`) |
|
|
83
|
+
| `CharacterPlayerApi`, `InventoryApi`, `GroupApi` | Entity target thuộc ownership của `GamePlayer` có `userId` trùng user đang authenticate |
|
|
84
|
+
| `ContentApi`, `StoreInventoryApi`, `MultiplayerApi`, `CloudScriptApi` | **Không có ownership rõ ràng** — không ép self/other-self; chọn route theo trust boundary + để backend áp permission theo contract operation |
|
|
85
|
+
|
|
86
|
+
Rule cứng:
|
|
87
|
+
|
|
88
|
+
- `self / other-self` **không** phải `server / admin`. `server / admin` là route đặc quyền riêng.
|
|
89
|
+
- Không vì muốn thao tác lên data user khác mà tự động chuyển sang `.server` / `.admin`.
|
|
90
|
+
- Ví dụ đúng:
|
|
91
|
+
- App player gọi `masterPlayer.getPlayerInformationAsync()` cho user đang login → `client + self`.
|
|
92
|
+
- App player gọi `masterPlayer.getPlayerInformationAsync(otherUserId)` → `client + other-self`.
|
|
93
|
+
- Game server gọi `gamePlayer.server.changePlayerCurrencyAsync(...)` → `server` (không phải `client + other-self`).
|
|
94
|
+
- GM tool gọi `inventory.admin.setRemoveStatusAsync(...)` → `admin`.
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## 5. Phân biệt 3 ReturnCode dễ nhầm
|
|
99
|
+
|
|
100
|
+
| Code | Nghĩa | Fix |
|
|
101
|
+
|---|---|---|
|
|
102
|
+
| `SecretInvalid` | Secret key sai, thiếu, hoặc không khớp game context | Fix `GNServerSettings.secretKey`. **KHÔNG retry**. |
|
|
103
|
+
| `OperationInvalid` | Operation code không tồn tại, hoặc không hợp lệ với `RequestType` + `RequestRole` hiện tại | Check namespace đang gọi + đúng method trong `API_<GROUP>.md`. |
|
|
104
|
+
| `OperationNotAllow` | Secret hợp lệ **và** operation tồn tại, NHƯNG permission rule của secret không cho phép trong target context | Check route + flag `selfEnable`/`otherSelfEnable`/`serverSelfEnable`/`adminSelfEnable`. **KHÔNG retry**. |
|
|
105
|
+
|
|
106
|
+
Cùng gia đình nhưng ý nghĩa khác hẳn — đừng confuse "secret sai" với "secret đúng nhưng không đủ quyền".
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## 6. Permission flags
|
|
111
|
+
|
|
112
|
+
GearN Server map quyền theo từng domain + operation (ví dụ `masterPlayer.getPlayerInformation`, `group.sendGroupMessage`). Mỗi secret key có 4 flag chính:
|
|
113
|
+
|
|
114
|
+
| Flag | Nghĩa |
|
|
115
|
+
|---|---|
|
|
116
|
+
| `selfEnable` | Cho phép thao tác trên tài nguyên thuộc user đã authenticate |
|
|
117
|
+
| `otherSelfEnable` | Cho phép thao tác trên tài nguyên không thuộc user đã authenticate |
|
|
118
|
+
| `serverSelfEnable` | Cho phép thực thi qua route `server` |
|
|
119
|
+
| `adminSelfEnable` | Cho phép thực thi qua route `admin` |
|
|
120
|
+
|
|
121
|
+
Danh sách operation/flag offline: [reference/PERMISSION_RULES.md](reference/PERMISSION_RULES.md) + `docs/reference/API_<GROUP>.md`. Backend GearN Server / dashboard vẫn là runtime source-of-truth cho secret key nào đang có flag nào.
|
|
122
|
+
|
|
123
|
+
### 6.1 Mapping (route, target) → required flag
|
|
124
|
+
|
|
125
|
+
Đây là quy tắc **uniform** cho mọi operation. Kết hợp với [§ 4 self / other-self](#4-self-vs-other-self-chỉ-áp-dụng-trên-route-client) để xác định target.
|
|
126
|
+
|
|
127
|
+
| Caller gọi | Target | Flag cần trên secret key |
|
|
128
|
+
|---|---|---|
|
|
129
|
+
| `GNNetwork.<group>.<method>()` — bỏ userId hoặc userId trùng auth | Self | `selfEnable` của operation |
|
|
130
|
+
| `GNNetwork.<group>.<method>(otherUserId)` | Other-self | `otherSelfEnable` của operation |
|
|
131
|
+
| `GNNetwork.<group>.server.<method>(...)` | Bất kỳ | `serverSelfEnable` của operation |
|
|
132
|
+
| `GNNetwork.<group>.admin.<method>(...)` | Bất kỳ | `adminSelfEnable` của operation |
|
|
133
|
+
|
|
134
|
+
Ngoại lệ: domain không có ownership (`ContentApi`, `StoreInventoryApi`, `MultiplayerApi`, `CloudScriptApi`) — `self` / `other-self` không áp dụng trên route `client`; backend áp rule theo contract operation.
|
|
135
|
+
|
|
136
|
+
### 6.2 Ai config flag, client có đổi được không?
|
|
137
|
+
|
|
138
|
+
- Permission rule được **backend admin** config trên dashboard GearN Server theo **từng `secretKey` × từng operation × từng flag**.
|
|
139
|
+
- Client **không** tự đổi được flag. Chỉ có 3 option khi thiếu quyền:
|
|
140
|
+
1. Dùng `secretKey` khác trong `GNServerSettings` (cấu hình từ bootstrap).
|
|
141
|
+
2. Truyền `overrideSecretKey` per-request.
|
|
142
|
+
3. Yêu cầu backend admin bật flag cho secret hiện tại.
|
|
143
|
+
- Danh sách operation theo domain: ưu tiên [reference/PERMISSION_RULES.md](reference/PERMISSION_RULES.md) và `docs/reference/API_<GROUP>.md` trong repo; chỉ dùng external permission mirror khi cần đối chiếu online.
|
|
144
|
+
|
|
145
|
+
### 6.3 Scenario điển hình trigger `OperationNotAllow`
|
|
146
|
+
|
|
147
|
+
| # | Code thực tế | Root cause | Fix |
|
|
148
|
+
|---|---|---|---|
|
|
149
|
+
| 1 | App player: `masterPlayer.getPlayerInformationAsync(otherUserId)` | Secret client không có `otherSelfEnable` cho `masterPlayer.getPlayerInformation` | Backend admin bật `otherSelfEnable` trong GearN Dashboard, hoặc chuyển flow sang server-side |
|
|
150
|
+
| 2 | Script dev: `inventory.admin.setAmountAsync(...)` với secret client thường | Secret không có `adminSelfEnable` cho `inventory.setAmount` | Dùng secret admin qua `overrideSecretKey`, hoặc cấu hình `GNServerSettings.secretKey` = secret admin |
|
|
151
|
+
| 3 | Game server: `GNNetwork.gamePlayer.joinGroupAsync(...)` (route client) | Secret server không có `selfEnable` cho `gamePlayer.joinGroup` | Chuyển sang `GNNetwork.gamePlayer.server.joinGroupAsync(...)` — dùng `serverSelfEnable` |
|
|
152
|
+
| 4 | Backend worker: `gamePlayer.server.changePlayerCurrencyAsync(...)` bỏ `userId` | Route `server`/`admin` yêu cầu `userId` rõ ràng (xem [§ 4](#4-self-vs-other-self-chỉ-áp-dụng-trên-route-client)) | Truyền `userId` target |
|
|
153
|
+
| 5 | Admin tool: `masterPlayer.admin.setPlayerBanAsync(...)` | Secret admin bị backend giới hạn operation đó | Hỏi backend admin bật `adminSelfEnable` cho `masterPlayer.setPlayerBan` trong GearN Dashboard |
|
|
154
|
+
|
|
155
|
+
### 6.4 Checklist nhanh khi gặp `ReturnCode.OperationNotAllow`
|
|
156
|
+
|
|
157
|
+
Theo đúng thứ tự:
|
|
158
|
+
|
|
159
|
+
1. Xác định route đang gọi (`client` / `.server` / `.admin`).
|
|
160
|
+
2. Xác định target là `self` hay `other-self` (xem [§ 4](#4-self-vs-other-self-chỉ-áp-dụng-trên-route-client)).
|
|
161
|
+
3. Tra bảng § 6.1 → ra flag cần (ví dụ `otherSelfEnable`).
|
|
162
|
+
4. Check secret key active có flag đó cho operation đang gọi không? → xem backend dashboard hoặc hỏi admin.
|
|
163
|
+
5. Nếu không → 3 option ở § 6.2.
|
|
164
|
+
|
|
165
|
+
**Không retry** — đây là config fix, không phải transient error.
|
|
166
|
+
|
|
167
|
+
Diagnose end-to-end với code: [COOKBOOK Scenario 16](COOKBOOK.md#scenario-16-diagnose-operationnotallow).
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
## 7. Auth & Socket flow
|
|
172
|
+
|
|
173
|
+
Flow chuẩn:
|
|
174
|
+
|
|
175
|
+
```
|
|
176
|
+
1. Login HTTP (GNNetwork.authenticate.loginByXxxAsync) → SDK cache authToken + userId vào StorageService
|
|
177
|
+
2. Nếu app cần realtime: GNNetwork.connectSocket()
|
|
178
|
+
3. Khi socket connect, SDK tự gửi authToken hiện tại cho backend
|
|
179
|
+
4. (Chỉ khi cần) GNNetwork.sendRequestAuthSocket() — re-auth thủ công, không reconnect
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
Rule cứng:
|
|
183
|
+
|
|
184
|
+
- **Không gộp** auth socket với auth HTTP. Socket auth là bước riêng sau HTTP.
|
|
185
|
+
- Không bắt buộc gọi `sendRequestAuthSocket()` sau mỗi `connectSocket()`. SDK auto-auth nếu token đã có.
|
|
186
|
+
- Gọi `sendRequestAuthSocket()` chỉ khi:
|
|
187
|
+
- Socket connect **trước** khi có `authToken` (login xảy ra sau socket up).
|
|
188
|
+
- Token vừa đổi và muốn re-auth ngay mà không reconnect socket.
|
|
189
|
+
- Không giả định realtime event tự chạy chỉ vì đã gọi method HTTP friend/group. Phải subscribe handler trong [reference/EVENTS.md](reference/EVENTS.md).
|
|
190
|
+
- Subscribe event handler **trước** `connectSocket()` để không miss event ngay sau handshake.
|
|
191
|
+
|
|
192
|
+
Helper state:
|
|
193
|
+
|
|
194
|
+
- `GNNetwork.isSocketConnected()` — check socket session id hiện tại.
|
|
195
|
+
- `GNNetwork.getPing()` — ping trung bình từ active transport.
|
|
196
|
+
- `GNNetwork.syncTs()` — sync local estimate của server timestamp.
|
|
197
|
+
- `GNNetwork.getAuthenticateStatus().getAuthToken() / .getUserId()` — đọc auth cache.
|
|
198
|
+
|
|
199
|
+
---
|
|
200
|
+
|
|
201
|
+
## 8. Method signature & override params
|
|
202
|
+
|
|
203
|
+
Đa số method có 2 form:
|
|
204
|
+
|
|
205
|
+
```ts
|
|
206
|
+
// Callback
|
|
207
|
+
GNNetwork.<group>.<method>(requestData, onResponse?, overrideAuthToken?, overrideSecretKey?, customTags?, timeout?);
|
|
208
|
+
|
|
209
|
+
// Async (preferred)
|
|
210
|
+
const res = await GNNetwork.<group>.<method>Async(requestData, overrideAuthToken?, overrideSecretKey?, customTags?, timeout?);
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
### 8.1 Build request DTO trong code copy-paste
|
|
214
|
+
|
|
215
|
+
- Code tích hợp cuối cùng nên tạo instance DTO public: `const request = new <Group>Models.<Method>RequestData();`.
|
|
216
|
+
- Set field trên instance đó rồi truyền vào `*Async(request)`.
|
|
217
|
+
- Không dùng object literal rồi cast sang `RequestData`; pattern đó bỏ qua constructor/decorator và dễ làm AI sinh payload thiếu shape.
|
|
218
|
+
- API reference có thể dùng tên biến `requestData` để rút gọn bảng method, nhưng guide/cookbook copy-paste phải dùng DTO instance cụ thể.
|
|
219
|
+
|
|
220
|
+
| Param | Khi nào cần |
|
|
221
|
+
|---|---|
|
|
222
|
+
| `overrideAuthToken: string` | Impersonate / multi-session / admin thao tác trên user khác mà không dùng auth cache hiện tại |
|
|
223
|
+
| `overrideSecretKey: string` | Override secret cho 1 request, ví dụ migration tool gọi `.admin` từ script ngoài |
|
|
224
|
+
| `customTags: GNHashtable` | Tag trace id, build version, A/B bucket — backend có thể log/route |
|
|
225
|
+
| `timeout: number` | Override `defaultTimeoutInSeconds` per-request (giây) |
|
|
226
|
+
|
|
227
|
+
Ví dụ `customTags`:
|
|
228
|
+
|
|
229
|
+
```ts
|
|
230
|
+
const tags = GNHashtable.builder()
|
|
231
|
+
.add("traceId", "trace-001")
|
|
232
|
+
.add("build", "qa")
|
|
233
|
+
.build();
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
---
|
|
237
|
+
|
|
238
|
+
## 9. Platform & transport
|
|
239
|
+
|
|
240
|
+
- Node ≥ 20. Custom DTO có decorator cần bật `experimentalDecorators` + `emitDecoratorMetadata`.
|
|
241
|
+
- `MessageType.MsgPack` + HTTP trên browser → SDK tự fallback JSON. Không cần override toàn SDK sang `MessageType.Json`.
|
|
242
|
+
- Cocos Creator: giữ 2 flag TS decorator nêu trên khi có custom DTO.
|
|
243
|
+
- Detect platform runtime: `GNSupport.getPlatformType()`.
|
|
244
|
+
|
|
245
|
+
---
|
|
246
|
+
|
|
247
|
+
## 10. Anti-patterns & pitfalls
|
|
248
|
+
|
|
249
|
+
Bảng hợp nhất — cột "Triệu chứng" mô tả lỗi runtime thường thấy, cột "Fix" là hành động đúng.
|
|
250
|
+
|
|
251
|
+
| # | Anti-pattern | Triệu chứng | Fix |
|
|
252
|
+
|---|---|---|---|
|
|
253
|
+
| 1 | Giả định success là `0` | So sánh `=== 0` luôn false, code tưởng fail | `Ok === 1` cả `ReturnCode` và `ErrorCode`. So sánh bằng enum symbol. |
|
|
254
|
+
| 2 | Skip tầng 1, đọc thẳng `errorCode` | Business code branching nhầm vì `errorCode` chưa valid | Check `returnCode !== Ok` **trước**, return sớm. |
|
|
255
|
+
| 3 | Dùng getter `res.getReturnCode()` | `undefined is not a function` trên typed response | Typed response dùng PUBLIC FIELDS. Getter chỉ trên raw `OperationResponse`. |
|
|
256
|
+
| 4 | Gọi API trước `GNNetwork.init()` | `TypeError`, namespace `undefined` | Init 1 lần ở bootstrap. Idempotent — không re-init để đổi config. |
|
|
257
|
+
| 5 | Re-init để đổi config | Config cũ vẫn active | `init()` idempotent; restart process mới đổi được. |
|
|
258
|
+
| 6 | Dùng `.server` / `.admin` từ frontend để vượt permission | Trust boundary leak, secret expose | Route là trust boundary của **caller**, không phải target ownership. |
|
|
259
|
+
| 7 | Tự gọi `sendRequestAuthSocket()` sau mọi `connectSocket()` | Redundant call, có thể gây re-auth loop | SDK auto-auth nếu token có. Chỉ gọi tay khi token đến sau socket up hoặc token vừa đổi. |
|
|
260
|
+
| 8 | Subscribe event SAU `connectSocket()` | Miss event ngay sau handshake | Subscribe handler trước, rồi mới connect. |
|
|
261
|
+
| 9 | `editFunctionAsync` (CloudScript) để sửa source code | Source không đổi, chỉ flag thay | Đổi source = `addFunctionAsync` tạo version mới. |
|
|
262
|
+
| 10 | `MultiplayerApi` gửi qua socket | Không reach backend | Multiplayer dùng HTTP. Flow: create ticket → poll `getMatchmakingTicket` → `getMatch`. |
|
|
263
|
+
| 11 | `infoRequestParam = null` trong login | Backend không hydrate gì cả | Truyền instance dù chỉ bật ít field. |
|
|
264
|
+
| 12 | Bulk-set mọi field của `infoRequestParam` | Payload bự, slow | Chỉ bật field thật sự render. |
|
|
265
|
+
| 13 | Browser + `MessageType.MsgPack` → override toàn SDK sang JSON | Over-engineering | HTTP transport auto-fallback JSON; giữ MsgPack là ok. |
|
|
266
|
+
| 14 | `OperationNotAllow` = thiếu secret | Fix sai hướng, thay secret vô nghĩa | Xem § 5: secret hợp lệ nhưng permission rule cấm. |
|
|
267
|
+
| 15 | Bịa method / field không có trong `dist/*.d.ts` | Compile fail hoặc runtime `undefined` | Tra `API_<GROUP>.md` / `dto/<DOMAIN>.md` / `dist/*.d.ts`. Không suy diễn. |
|
|
268
|
+
| 16 | Giả định realtime tự chạy sau HTTP call | Không nhận event | Phải subscribe handler trong [reference/EVENTS.md](reference/EVENTS.md). |
|
|
269
|
+
| 17 | Bỏ qua `overrideAuthToken` / `overrideSecretKey` / `customTags` / `timeout` khi cần | Impersonate fail, timeout mặc định không đủ | Xem § 8. |
|
|
270
|
+
| 18 | Dùng `src/` làm nguồn public contract | Phụ thuộc internal, rot nhanh | `src/` chỉ khi sửa SDK / debug nội bộ. |
|
|
271
|
+
|
|
272
|
+
---
|
|
273
|
+
|
|
274
|
+
## 11. Canonical sources (thứ tự ưu tiên)
|
|
275
|
+
|
|
276
|
+
Khi có conflict, tách theo loại thông tin:
|
|
277
|
+
|
|
278
|
+
- Rule cross-cutting (route, permission, socket, error): **RULES.md thắng**.
|
|
279
|
+
- Method signature, DTO, enum: **API reference / DTO reference / ENUMS.md thắng**, fallback cuối là `dist/*.d.ts`.
|
|
280
|
+
- Bundle generated như `llms-full.txt` không bao giờ thắng source docs.
|
|
281
|
+
|
|
282
|
+
Khi sinh code:
|
|
283
|
+
|
|
284
|
+
1. **API reference theo domain** (`docs/reference/API_<GROUP>.md`) — method signature, request DTO, async form, response class.
|
|
285
|
+
2. **Guide theo domain** (`docs/guides/<GROUP>.md`) — decision rules, gotchas domain-specific.
|
|
286
|
+
3. **RULES.md** (file này) + [ai-manifest.json](ai-manifest.json) — rule cross-cutting.
|
|
287
|
+
4. **DTO field table** (`docs/reference/dto/<DOMAIN>.md` hoặc grep `DTO_INDEX.md`) — field-level schema.
|
|
288
|
+
5. **ENUMS.md** — giá trị numeric.
|
|
289
|
+
6. **`dist/*.d.ts`** — fallback nếu docs chưa cover.
|
|
290
|
+
|
|
291
|
+
Chỉ đọc `src/` khi:
|
|
292
|
+
- Sửa chính SDK.
|
|
293
|
+
- Debug behavior nội bộ.
|
|
294
|
+
- Verify public contract mà docs + `dist` chưa đủ.
|
|
295
|
+
|
|
296
|
+
---
|
|
297
|
+
|
|
298
|
+
## Liên kết
|
|
299
|
+
|
|
300
|
+
- [AI_CHEATSHEET.md](AI_CHEATSHEET.md) — one-page reference
|
|
301
|
+
- [COOKBOOK.md](COOKBOOK.md) — 16 scenario end-to-end
|
|
302
|
+
- [reference/API_INDEX.md](reference/API_INDEX.md) — bảng method mọi group
|
|
303
|
+
- [reference/ERROR_HANDLING.md](reference/ERROR_HANDLING.md) — full return/error code table
|
|
304
|
+
- [reference/EVENTS.md](reference/EVENTS.md) — realtime event handler
|
|
305
|
+
- [reference/CONFIG.md](reference/CONFIG.md) — `GNServerSettings` schema
|
|
306
|
+
- [reference/ENUMS.md](reference/ENUMS.md) — enum numeric value
|
|
307
|
+
- [ai-manifest.json](ai-manifest.json) — machine-readable manifest
|