Fix response data handling after dep update.
This commit is contained in:
committed by
Fabio Niephaus
parent
319b5062ea
commit
a19d2ab4f7
@@ -53,13 +53,13 @@ export const ERROR_REQUEST = 'Please file an issue at: https://github.com/graalv
|
||||
export const ERROR_HINT =
|
||||
'If you think this is a mistake, please file an issue at: https://github.com/graalvm/setup-graalvm/issues.'
|
||||
|
||||
export type LatestReleaseResponse = otypes.Endpoints['GET /repos/{owner}/{repo}/releases/latest']['response']
|
||||
export type LatestReleaseResponseData =
|
||||
otypes.Endpoints['GET /repos/{owner}/{repo}/releases/latest']['response']['data']
|
||||
|
||||
export type MatchingRefsResponse = otypes.Endpoints['GET /repos/{owner}/{repo}/git/matching-refs/{ref}']['response']
|
||||
export type MatchingRefsResponseData =
|
||||
otypes.Endpoints['GET /repos/{owner}/{repo}/git/matching-refs/{ref}']['response']['data']
|
||||
|
||||
export type ReleasesResponse = otypes.Endpoints['GET /repos/{owner}/{repo}/releases']['response']
|
||||
|
||||
export type ContentsResponse = otypes.Endpoints['GET /repos/{owner}/{repo}/contents/{path}']['response']
|
||||
export type ContentsResponseData = otypes.Endpoints['GET /repos/{owner}/{repo}/contents/{path}']['response']['data']
|
||||
|
||||
export interface OracleGraalVMEAFile {
|
||||
filename: string
|
||||
|
||||
@@ -174,7 +174,7 @@ export async function setUpGraalVMJDKDevBuild(): Promise<string> {
|
||||
return downloadAndExtractJDK(downloadUrl)
|
||||
}
|
||||
|
||||
export function findHighestJavaVersion(release: c.LatestReleaseResponse['data'], version: string): string {
|
||||
export function findHighestJavaVersion(release: c.LatestReleaseResponseData, version: string): string {
|
||||
const graalVMIdentifierPattern = determineGraalVMLegacyIdentifier(false, version, '(\\d+)')
|
||||
const expectedFileNameRegExp = new RegExp(
|
||||
`^${graalVMIdentifierPattern}${c.GRAALVM_FILE_EXTENSION.replace(/\./g, '\\.')}$`
|
||||
@@ -214,7 +214,7 @@ export async function setUpGraalVMLatest_22_X(gdsToken: string, javaVersion: str
|
||||
return setUpGraalVMRelease(gdsToken, version, javaVersion)
|
||||
}
|
||||
|
||||
export function findGraalVMVersion(release: c.LatestReleaseResponse['data']) {
|
||||
export function findGraalVMVersion(release: c.LatestReleaseResponseData) {
|
||||
const tag_name = release.tag_name
|
||||
if (!tag_name.startsWith(GRAALVM_TAG_PREFIX)) {
|
||||
throw new Error(`Could not find latest GraalVM release: ${tag_name}`)
|
||||
@@ -234,7 +234,7 @@ export async function setUpGraalVMRelease(gdsToken: string, version: string, jav
|
||||
return downloadExtractAndCacheJDK(downloader, toolName, version)
|
||||
}
|
||||
|
||||
function findDownloadUrl(release: c.LatestReleaseResponse['data'], javaVersion: string): string {
|
||||
function findDownloadUrl(release: c.LatestReleaseResponseData, javaVersion: string): string {
|
||||
const graalVMIdentifier = determineGraalVMLegacyIdentifier(false, c.VERSION_DEV, javaVersion)
|
||||
const expectedFileName = `${graalVMIdentifier}${c.GRAALVM_FILE_EXTENSION}`
|
||||
for (const asset of release.assets) {
|
||||
|
||||
16
src/utils.ts
16
src/utils.ts
@@ -18,17 +18,17 @@ export async function exec(commandLine: string, args?: string[], options?: ExecO
|
||||
}
|
||||
}
|
||||
|
||||
export async function getLatestRelease(repo: string): Promise<c.LatestReleaseResponse['data']> {
|
||||
export async function getLatestRelease(repo: string): Promise<c.LatestReleaseResponseData> {
|
||||
const octokit = getOctokit()
|
||||
return (
|
||||
await octokit.request('GET /repos/{owner}/{repo}/releases/latest', {
|
||||
owner: c.GRAALVM_GH_USER,
|
||||
repo
|
||||
})
|
||||
).data
|
||||
).data as c.LatestReleaseResponseData /** missing digest property */
|
||||
}
|
||||
|
||||
export async function getContents(repo: string, path: string): Promise<c.ContentsResponse['data']> {
|
||||
export async function getContents(repo: string, path: string): Promise<c.ContentsResponseData> {
|
||||
const octokit = getOctokit()
|
||||
return (
|
||||
await octokit.request('GET /repos/{owner}/{repo}/contents/{path}', {
|
||||
@@ -39,11 +39,7 @@ export async function getContents(repo: string, path: string): Promise<c.Content
|
||||
).data
|
||||
}
|
||||
|
||||
export async function getTaggedRelease(
|
||||
owner: string,
|
||||
repo: string,
|
||||
tag: string
|
||||
): Promise<c.LatestReleaseResponse['data']> {
|
||||
export async function getTaggedRelease(owner: string, repo: string, tag: string): Promise<c.LatestReleaseResponseData> {
|
||||
const octokit = getOctokit()
|
||||
return (
|
||||
await octokit.request('GET /repos/{owner}/{repo}/releases/tags/{tag}', {
|
||||
@@ -51,14 +47,14 @@ export async function getTaggedRelease(
|
||||
repo,
|
||||
tag
|
||||
})
|
||||
).data
|
||||
).data as c.LatestReleaseResponseData /** missing digest property */
|
||||
}
|
||||
|
||||
export async function getMatchingTags(
|
||||
owner: string,
|
||||
repo: string,
|
||||
tagPrefix: string
|
||||
): Promise<c.MatchingRefsResponse['data']> {
|
||||
): Promise<c.MatchingRefsResponseData> {
|
||||
const octokit = getOctokit()
|
||||
return (
|
||||
await octokit.request('GET /repos/{owner}/{repo}/git/matching-refs/tags/{tagPrefix}', {
|
||||
|
||||
Reference in New Issue
Block a user