You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2022/12/29 21:54:40 UTC
[GitHub] [beam] damccorm commented on a diff in pull request #24825: Various cleanups to the typescript SDK.
damccorm commented on code in PR #24825:
URL: https://github.com/apache/beam/pull/24825#discussion_r1059160493
##########
sdks/typescript/src/apache_beam/utils/service.ts:
##########
@@ -326,14 +330,37 @@ export class JavaJarService extends SubprocessService {
}
}
- static mavenJarUrl(
+ static async mavenJarUrl(
artifactId: string,
version: string,
classifier: string | undefined = undefined,
appendix: string | undefined = undefined,
repo: string = JavaJarService.APACHE_REPOSITORY,
groupId: string = JavaJarService.BEAM_GROUP_ID
- ): string {
+ ): Promise<string> {
+ if (version == "latest") {
+ const medatadataUrl = [
+ repo,
+ groupId.replaceAll(".", "/"),
+ artifactId,
+ "maven-metadata.xml",
+ ].join("/");
+ const metadata = await new Promise<string>((resolve, reject) => {
+ let data = "";
+ https.get(medatadataUrl, (res) => {
+ res.on("data", (chunk) => {
+ data += chunk;
+ });
+ res.on("end", () => {
+ resolve(data);
+ });
+ res.on("error", (e) => {
+ reject(e);
+ });
+ });
+ });
Review Comment:
Optional: It might be worth considering a http client library that can do things like handle retries/redirects and will patch responses together for us - I'm partial to https://github.com/microsoft/typed-rest-client (the Http client, not the Rest client in this case), but there are plenty of options out there.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org