refactor(oidb): migrate contacts.ts OIDB cmds to namespaces
6 OIDB cmds moved; pagination + per-group cache + inflight
coalescing stay on the facade because they need cross-call state.
- FetchFriendListPage (0xFD4_1) — facade drives the cursor loop
- FetchGroupList (0xFE5_2) — uinForm; verbatim config blob
- FetchGroupMemberListPage (0xFE7_3) — facade drives the token loop +
owns the TTL cache + inflight
coalescing that keeps busy
OneBot clients from tripping
Tencent risk-control
- FetchUserProfile (0xFE1_2) — uinForm; full property-key
catalogue cross-checked against
LagrangeV2 FetchStrangerService.cs
- FetchGroupRequests (0x10C0_1/_2) — dynamic subcmd via filtered flag
- FetchDownloadRkeys (0x9067_202) — uinForm; respHead.retCode
check moved into deserialize
35 new namespace-level tests covering serialize / deserialize edge
cases (property decoding, sex enum mapping, avatar URL suffix,
empty body handling, pagination cursor behaviour).
Verification:
- typecheck green
- @snowluma/bridge: 30 files / 233 tests
- @snowluma/core: 302 tests
Wire bytes unchanged.
This commit is contained in:
14 files changed
+864
-248
No files matched your search
@@ -0,0 +1,40 @@
|
||||
// 0x10C0 — fetch pending group-add requests.
|
||||
// subCommand 1 = main inbox, 2 = filtered (low-priority) inbox
|
||||
//
|
||||
// Returns the wire shape verbatim — the facade does the GroupRequestInfo
|
||||
// mapping because it also needs to thread the `filtered` flag onto
|
||||
// each entry, which the wire doesn't carry.
|
||||
|
||||
import { protobuf_decode, protobuf_encode } from '@snowluma/proton';
|
||||
import type { OidbBase, OidbSvcTrpcTcp0x10C0Response } from '@snowluma/proto-defs/oidb';
|
||||
import type { OidbGroupRequestList } from '@snowluma/proto-defs/oidb-actions/base';
|
||||
import { invokeOidb, type OidbSender } from '../../oidb-service';
|
||||
|
||||
export namespace FetchGroupRequests {
|
||||
export const command = 0x10C0;
|
||||
|
||||
export interface Params {
|
||||
/** false → subCmd 1 (main inbox), true → subCmd 2 (filtered). */
|
||||
filtered: boolean;
|
||||
}
|
||||
|
||||
export type Deps = OidbSender;
|
||||
|
||||
export const resolveSubCommand = (p: Params): number => p.filtered ? 2 : 1;
|
||||
|
||||
export const serialize = (_: Params): OidbGroupRequestList => ({
|
||||
count: 20,
|
||||
field2: 0,
|
||||
});
|
||||
|
||||
export const deserialize = (body: OidbSvcTrpcTcp0x10C0Response): OidbSvcTrpcTcp0x10C0Response => body;
|
||||
|
||||
export const encode = (env: OidbBase<OidbGroupRequestList>): Uint8Array =>
|
||||
protobuf_encode<OidbBase<OidbGroupRequestList>>(env);
|
||||
|
||||
export const decode = (bytes: Uint8Array): OidbBase<OidbSvcTrpcTcp0x10C0Response> =>
|
||||
protobuf_decode<OidbBase<OidbSvcTrpcTcp0x10C0Response>>(bytes);
|
||||
|
||||
export const invoke = (deps: Deps, params: Params): Promise<OidbSvcTrpcTcp0x10C0Response> =>
|
||||
invokeOidb(deps, FetchGroupRequests, params);
|
||||
}
|
||||
Reference in new issue
Block a user