def generate_binary_chunks(path: str, destination: Destination, logger: Logger) -> AsyncIterator[InstallRequest]: if destination == InstallRequest.APP: if path.endswith(".ipa"): return _generate_ipa_chunks(ipa_path=path, logger=logger) elif path.endswith(".app"): return _generate_app_chunks(app_path=path, logger=logger) elif destination == InstallRequest.XCTEST: return _generate_xctest_chunks(path=path, logger=logger) elif destination == InstallRequest.DYLIB: return _generate_dylib_chunks(path=path, logger=logger) elif destination == InstallRequest.DSYM: return _generate_dsym_chunks(path=path, logger=logger) elif destination == InstallRequest.FRAMEWORK: return _generate_framework_chunks(path=path, logger=logger) raise GRPCError( status=Status(Status.FAILED_PRECONDITION), message=f"install invalid for {path} {destination}", )
def translate_exception(self, exception: Exception) -> Exception: if self.translate_exceptions and not isinstance(exception, GRPCError): return GRPCError(Status.INTERNAL, exception.args[0]) return exception
async def Connect(self, stream): if self.__suspended: raise GRPCError(Status.CANCELLED, "Suspended") await stream.send_message(ConnectResponse(default_serializer_id=Serialization().default_serializer_id))
async def StreamStream(self, stream): raise GRPCError(Status.UNIMPLEMENTED)
async def UnaryUnary(self, stream): raise GRPCError(Status.UNIMPLEMENTED)
async def wrapper(stream): if event.metadata.get(api_header, "") != api_token and stream._method_name != '/grpc.health.v1.Health/Check': raise GRPCError(Status.UNAUTHENTICATED) return await method_func(stream)
async def UnaryUnary(self, stream): raise GRPCError( Status.DATA_LOSS, 'Some data loss occurred', [Help(links=[Help.Link(url='https://example.com')])], )