Skip to content

Commit

Permalink
Ignore unknown fields in protobuf parsing (#132)
Browse files Browse the repository at this point in the history
* Ignore unknown fields in protobuf parsing

* Create tough-onions-jog.md
  • Loading branch information
lukasIO committed Feb 12, 2024
1 parent 618d84c commit 8cad1ba
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 20 deletions.
5 changes: 5 additions & 0 deletions .changeset/tough-onions-jog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"livekit-server-sdk": patch
---

Ignore unknown fields in protobuf parsing
18 changes: 9 additions & 9 deletions src/EgressClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ export class EgressClient extends ServiceBase {
req,
await this.authHeader({ roomRecord: true }),
);
return EgressInfo.fromJson(data);
return EgressInfo.fromJson(data, { ignoreUnknownFields: true });
}

/**
Expand Down Expand Up @@ -241,7 +241,7 @@ export class EgressClient extends ServiceBase {
req,
await this.authHeader({ roomRecord: true }),
);
return EgressInfo.fromJson(data);
return EgressInfo.fromJson(data, { ignoreUnknownFields: true });
}

/**
Expand Down Expand Up @@ -276,7 +276,7 @@ export class EgressClient extends ServiceBase {
req,
this.authHeader({ roomRecord: true }),
);
return EgressInfo.fromJson(data);
return EgressInfo.fromJson(data, { ignoreUnknownFields: true });
}

/**
Expand Down Expand Up @@ -345,7 +345,7 @@ export class EgressClient extends ServiceBase {
req,
await this.authHeader({ roomRecord: true }),
);
return EgressInfo.fromJson(data);
return EgressInfo.fromJson(data, { ignoreUnknownFields: true });
}

private isEncodedOutputs(output: any): output is EncodedOutputs {
Expand Down Expand Up @@ -518,7 +518,7 @@ export class EgressClient extends ServiceBase {
req,
await this.authHeader({ roomRecord: true }),
);
return EgressInfo.fromJson(data);
return EgressInfo.fromJson(data, { ignoreUnknownFields: true });
}

/**
Expand All @@ -532,7 +532,7 @@ export class EgressClient extends ServiceBase {
new UpdateLayoutRequest({ egressId, layout }).toJson(),
await this.authHeader({ roomRecord: true }),
);
return EgressInfo.fromJson(data);
return EgressInfo.fromJson(data, { ignoreUnknownFields: true });
}

/**
Expand All @@ -554,7 +554,7 @@ export class EgressClient extends ServiceBase {
new UpdateStreamRequest({ egressId, addOutputUrls, removeOutputUrls }).toJson(),
await this.authHeader({ roomRecord: true }),
);
return EgressInfo.fromJson(data);
return EgressInfo.fromJson(data, { ignoreUnknownFields: true });
}

/**
Expand Down Expand Up @@ -584,7 +584,7 @@ export class EgressClient extends ServiceBase {
new ListEgressRequest(req).toJson(),
await this.authHeader({ roomRecord: true }),
);
return ListEgressResponse.fromJson(data).items ?? [];
return ListEgressResponse.fromJson(data, { ignoreUnknownFields: true }).items ?? [];
}

/**
Expand All @@ -597,6 +597,6 @@ export class EgressClient extends ServiceBase {
new StopEgressRequest({ egressId }).toJson(),
await this.authHeader({ roomRecord: true }),
);
return EgressInfo.fromJson(data);
return EgressInfo.fromJson(data, { ignoreUnknownFields: true });
}
}
8 changes: 4 additions & 4 deletions src/IngressClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export class IngressClient extends ServiceBase {
req,
await this.authHeader({ ingressAdmin: true }),
);
return IngressInfo.fromJson(data);
return IngressInfo.fromJson(data, { ignoreUnknownFields: true });
}

/**
Expand Down Expand Up @@ -182,7 +182,7 @@ export class IngressClient extends ServiceBase {
req,
await this.authHeader({ ingressAdmin: true }),
);
return IngressInfo.fromJson(data);
return IngressInfo.fromJson(data, { ignoreUnknownFields: true });
}

/**
Expand All @@ -207,7 +207,7 @@ export class IngressClient extends ServiceBase {
new ListIngressRequest(req).toJson(),
await this.authHeader({ ingressAdmin: true }),
);
return ListIngressResponse.fromJson(data).items ?? [];
return ListIngressResponse.fromJson(data, { ignoreUnknownFields: true }).items ?? [];
}

/**
Expand All @@ -220,6 +220,6 @@ export class IngressClient extends ServiceBase {
new DeleteIngressRequest({ ingressId }).toJson(),
await this.authHeader({ ingressAdmin: true }),
);
return IngressInfo.fromJson(data);
return IngressInfo.fromJson(data, { ignoreUnknownFields: true });
}
}
14 changes: 7 additions & 7 deletions src/RoomServiceClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export class RoomServiceClient extends ServiceBase {
new CreateRoomRequest(options).toJson(),
await this.authHeader({ roomCreate: true }),
);
return Room.fromJson(data);
return Room.fromJson(data, { ignoreUnknownFields: true });
}

/**
Expand All @@ -127,7 +127,7 @@ export class RoomServiceClient extends ServiceBase {
new ListRoomsRequest({ names: names ?? [] }).toJson(),
await this.authHeader({ roomList: true }),
);
const res = ListRoomsResponse.fromJson(data);
const res = ListRoomsResponse.fromJson(data, { ignoreUnknownFields: true });
return res.rooms ?? [];
}

Expand All @@ -152,7 +152,7 @@ export class RoomServiceClient extends ServiceBase {
new UpdateRoomMetadataRequest({ room, metadata }).toJson(),
await this.authHeader({ roomAdmin: true, room }),
);
return Room.fromJson(data);
return Room.fromJson(data, { ignoreUnknownFields: true });
}

/**
Expand All @@ -166,7 +166,7 @@ export class RoomServiceClient extends ServiceBase {
new ListParticipantsRequest({ room }).toJson(),
await this.authHeader({ roomAdmin: true, room }),
);
const res = ListParticipantsResponse.fromJson(data);
const res = ListParticipantsResponse.fromJson(data, { ignoreUnknownFields: true });
return res.participants ?? [];
}

Expand All @@ -184,7 +184,7 @@ export class RoomServiceClient extends ServiceBase {
await this.authHeader({ roomAdmin: true, room }),
);

return ParticipantInfo.fromJson(data);
return ParticipantInfo.fromJson(data, { ignoreUnknownFields: true });
}

/**
Expand Down Expand Up @@ -228,7 +228,7 @@ export class RoomServiceClient extends ServiceBase {
req,
await this.authHeader({ roomAdmin: true, room }),
);
const res = MuteRoomTrackResponse.fromJson(data);
const res = MuteRoomTrackResponse.fromJson(data, { ignoreUnknownFields: true });
return res.track!;
}

Expand Down Expand Up @@ -262,7 +262,7 @@ export class RoomServiceClient extends ServiceBase {
req.toJson(),
await this.authHeader({ roomAdmin: true, room }),
);
return ParticipantInfo.fromJson(data);
return ParticipantInfo.fromJson(data, { ignoreUnknownFields: true });
}

/**
Expand Down

0 comments on commit 8cad1ba

Please sign in to comment.