feat & fix: feat proto & revert NapProto changes

This commit is contained in:
pk5ls20 committed 2024-10-13 16:13:34 +08:00
1 parent b4e22a345d
commit d21da47a7d
6 files changed
+19 -17

No files matched your search

+3 -3
View File
@@ -1,4 +1,4 @@
import { MessageType, RepeatType, ScalarType } from '@protobuf-ts/runtime';
import { MessageType, PartialMessage, RepeatType, ScalarType } from '@protobuf-ts/runtime';
import { PartialFieldInfo } from "@protobuf-ts/runtime/build/types/reflection-info";
type LowerCamelCase<S extends string> = CamelCaseHelper<S, false, true>;
@@ -122,7 +122,7 @@ export class NapProtoMsg<T extends ProtoMessageType> {
no: field.no,
name: key,
kind: 'message',
repeat: field.repeat ? RepeatType.UNPACKED : RepeatType.NO,
repeat: field.repeat ? RepeatType.PACKED : RepeatType.NO,
T: () => rt,
};
}
@@ -131,7 +131,7 @@ export class NapProtoMsg<T extends ProtoMessageType> {
}
encode(data: ProtoStructType<T, true>): Uint8Array {
return this._proto_msg.toBinary(data)
return this._proto_msg.toBinary(this._proto_msg.create(data as PartialMessage<ProtoStructType<T, boolean>>));
}
decode(data: Uint8Array): ProtoStructType<T, false> {
+2 -2
View File
@@ -4,8 +4,8 @@ import { MultiMediaReqHead } from "./common/Ntv2.RichMedia";
export const OidbSvcTrpcTcp0X9067_202 = {
ReqHead: ProtoField(1, () => MultiMediaReqHead),
DownloadRKeyReq: ProtoField(4, () => OidbSvcTrpcTcp0X9067_202Key, true, false),
DownloadRKeyReq: ProtoField(4, () => OidbSvcTrpcTcp0X9067_202Key),
}
export const OidbSvcTrpcTcp0X9067_202Key = {
key: ProtoField(1, ScalarType.UINT32)
key: ProtoField(1, ScalarType.INT32, false, true),
}
+4 -4
View File
@@ -8,7 +8,7 @@ export const NTV2RichMediaReq = {
export const MultiMediaReqHead = {
Common: ProtoField(1, () => CommonHead),
Scene: ProtoField(2, () => SceneInfo),
Clent: ProtoField(3, () => ClientMeta),
Client: ProtoField(3, () => ClientMeta),
}
export const CommonHead = {
RequestId: ProtoField(1, ScalarType.UINT32),
@@ -19,6 +19,9 @@ export const SceneInfo = {
BusinessType: ProtoField(102, ScalarType.UINT32),
SceneType: ProtoField(200, ScalarType.UINT32),
}
export const ClientMeta = {
AgentType: ProtoField(1, ScalarType.UINT32),
}
export const C2CUserInfo = {
AccountType: ProtoField(1, ScalarType.UINT32),
TargetUid: ProtoField(2, ScalarType.STRING),
@@ -26,9 +29,6 @@ export const C2CUserInfo = {
export const GroupInfo = {
GroupUin: ProtoField(1, ScalarType.UINT32),
}
export const ClientMeta = {
AgentType: ProtoField(1, ScalarType.UINT32),
}
export const DownloadReq = {
Node: ProtoField(1, ScalarType.BYTES),
Download: ProtoField(2, ScalarType.BYTES),