Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public async getLatestVersion(
request: CatalogVersionRequest,
abortSignal?: AbortSignal
): Promise {
const startVersion = request.getStartVersion() || -1;
const builder = await this.getRequestBuilder(
"metadata",
HRN.fromString(this.hrn),
abortSignal
).catch(error => Promise.reject(error));
const latestVersion = await MetadataApi.latestVersion(builder, {
startVersion,
billingTag: request.getBillingTag()
});
return latestVersion.version;
}
private async getLatestVersion(): Promise {
const builder = await this.getRequestBuilder("metadata").catch(error =>
Promise.reject(error)
);
const latestVersion = await MetadataApi.latestVersion(builder, {
startVersion: -1
}).catch(async (error: Response) =>
Promise.reject(
new Error(
`Metadata Service error: HTTP ${
error.status
}, ${error.statusText || ""}`
)
)
);
return latestVersion.version;
}
abortSignal?: AbortSignal,
billingTag?: string
): Promise {
const request = await RequestFactory.create(
"metadata",
this.apiVersion,
this.settings,
catalogHrn,
abortSignal
).catch(error =>
Promise.reject(
`Erorr creating request object for metadata service: ${error}`
)
);
const latestVersion = await MetadataApi.latestVersion(request, {
startVersion: -1,
billingTag
}).catch(error => Promise.reject(error));
return Promise.resolve(latestVersion.version);
}
}