Use protobuf_encode for OIDB envelopes

Replace the encodeOidbEnv wrapper with direct protobuf_encode<OidbBase<T>> calls across bridge modules. Updated many bridge action files (extras, friend, group-admin, group-file, group-message, interaction, misc, profile, bridge-contacts, highway pipeline, etc.) to import protobuf_encode and OidbBase and to pass encoded OIDB envelopes via protobuf_encode. Removed the encodeOidbEnv implementation from bridge-oidb and restructured proton OIDB definitions by adding new proto/proton/oidb-actions modules (base, group-album, group-file, media, index) and adjusting proton proto usage. This centralizes envelope encoding for better monomorphization and simplifies the OIDB encoding flow.
This commit is contained in:
手瓜一十雪 committed 2026-05-20 18:03:57 +08:00
1 parent ca0a888003
commit bf4c130641
19 files changed
+367 -1760

No files matched your search

-20
View File
@@ -44,26 +44,6 @@ export function makeOidbEnvelope<T>(
};
}
/**
* Pass-through encoder for the OIDB envelope. Single type param, body
* literally forwards its arg to `protobuf_encode<OidbBase<T>>` — proton
* wrapper-binds this and replaces every `encodeOidbEnv<MyReq>(env)` call
* site with `protobuf_encode_OidbBase__MyReq(env)` at build time.
*/
export function encodeOidbEnv<T>(env: OidbBase<T>): Uint8Array {
return protobuf_encode<OidbBase<T>>(env);
}
/**
* Pass-through decoder for the OIDB envelope. Mirror of `encodeOidbEnv`
* — proton monomorphizes `OidbBase<TResp>` per call site.
*
* Returns the full envelope; the caller usually wants `.body`.
*/
export function decodeOidbEnv<T>(bytes: Uint8Array): OidbBase<T> {
return protobuf_decode<OidbBase<T>>(bytes);
}
/**
* Issue one OIDB request and return the raw response bytes.
*