Skip to content

Commit a19d2ab

Browse files
committed
Fix response data handling after dep update.
1 parent 319b506 commit a19d2ab

File tree

3 files changed

+14
-18
lines changed

3 files changed

+14
-18
lines changed

src/constants.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,13 @@ export const ERROR_REQUEST = 'Please file an issue at: https://github.com/graalv
5353
export const ERROR_HINT =
5454
'If you think this is a mistake, please file an issue at: https://github.com/graalvm/setup-graalvm/issues.'
5555

56-
export type LatestReleaseResponse = otypes.Endpoints['GET /repos/{owner}/{repo}/releases/latest']['response']
56+
export type LatestReleaseResponseData =
57+
otypes.Endpoints['GET /repos/{owner}/{repo}/releases/latest']['response']['data']
5758

58-
export type MatchingRefsResponse = otypes.Endpoints['GET /repos/{owner}/{repo}/git/matching-refs/{ref}']['response']
59+
export type MatchingRefsResponseData =
60+
otypes.Endpoints['GET /repos/{owner}/{repo}/git/matching-refs/{ref}']['response']['data']
5961

60-
export type ReleasesResponse = otypes.Endpoints['GET /repos/{owner}/{repo}/releases']['response']
61-
62-
export type ContentsResponse = otypes.Endpoints['GET /repos/{owner}/{repo}/contents/{path}']['response']
62+
export type ContentsResponseData = otypes.Endpoints['GET /repos/{owner}/{repo}/contents/{path}']['response']['data']
6363

6464
export interface OracleGraalVMEAFile {
6565
filename: string

src/graalvm.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ export async function setUpGraalVMJDKDevBuild(): Promise<string> {
174174
return downloadAndExtractJDK(downloadUrl)
175175
}
176176

177-
export function findHighestJavaVersion(release: c.LatestReleaseResponse['data'], version: string): string {
177+
export function findHighestJavaVersion(release: c.LatestReleaseResponseData, version: string): string {
178178
const graalVMIdentifierPattern = determineGraalVMLegacyIdentifier(false, version, '(\\d+)')
179179
const expectedFileNameRegExp = new RegExp(
180180
`^${graalVMIdentifierPattern}${c.GRAALVM_FILE_EXTENSION.replace(/\./g, '\\.')}$`
@@ -214,7 +214,7 @@ export async function setUpGraalVMLatest_22_X(gdsToken: string, javaVersion: str
214214
return setUpGraalVMRelease(gdsToken, version, javaVersion)
215215
}
216216

217-
export function findGraalVMVersion(release: c.LatestReleaseResponse['data']) {
217+
export function findGraalVMVersion(release: c.LatestReleaseResponseData) {
218218
const tag_name = release.tag_name
219219
if (!tag_name.startsWith(GRAALVM_TAG_PREFIX)) {
220220
throw new Error(`Could not find latest GraalVM release: ${tag_name}`)
@@ -234,7 +234,7 @@ export async function setUpGraalVMRelease(gdsToken: string, version: string, jav
234234
return downloadExtractAndCacheJDK(downloader, toolName, version)
235235
}
236236

237-
function findDownloadUrl(release: c.LatestReleaseResponse['data'], javaVersion: string): string {
237+
function findDownloadUrl(release: c.LatestReleaseResponseData, javaVersion: string): string {
238238
const graalVMIdentifier = determineGraalVMLegacyIdentifier(false, c.VERSION_DEV, javaVersion)
239239
const expectedFileName = `${graalVMIdentifier}${c.GRAALVM_FILE_EXTENSION}`
240240
for (const asset of release.assets) {

src/utils.ts

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,17 @@ export async function exec(commandLine: string, args?: string[], options?: ExecO
1818
}
1919
}
2020

21-
export async function getLatestRelease(repo: string): Promise<c.LatestReleaseResponse['data']> {
21+
export async function getLatestRelease(repo: string): Promise<c.LatestReleaseResponseData> {
2222
const octokit = getOctokit()
2323
return (
2424
await octokit.request('GET /repos/{owner}/{repo}/releases/latest', {
2525
owner: c.GRAALVM_GH_USER,
2626
repo
2727
})
28-
).data
28+
).data as c.LatestReleaseResponseData /** missing digest property */
2929
}
3030

31-
export async function getContents(repo: string, path: string): Promise<c.ContentsResponse['data']> {
31+
export async function getContents(repo: string, path: string): Promise<c.ContentsResponseData> {
3232
const octokit = getOctokit()
3333
return (
3434
await octokit.request('GET /repos/{owner}/{repo}/contents/{path}', {
@@ -39,26 +39,22 @@ export async function getContents(repo: string, path: string): Promise<c.Content
3939
).data
4040
}
4141

42-
export async function getTaggedRelease(
43-
owner: string,
44-
repo: string,
45-
tag: string
46-
): Promise<c.LatestReleaseResponse['data']> {
42+
export async function getTaggedRelease(owner: string, repo: string, tag: string): Promise<c.LatestReleaseResponseData> {
4743
const octokit = getOctokit()
4844
return (
4945
await octokit.request('GET /repos/{owner}/{repo}/releases/tags/{tag}', {
5046
owner,
5147
repo,
5248
tag
5349
})
54-
).data
50+
).data as c.LatestReleaseResponseData /** missing digest property */
5551
}
5652

5753
export async function getMatchingTags(
5854
owner: string,
5955
repo: string,
6056
tagPrefix: string
61-
): Promise<c.MatchingRefsResponse['data']> {
57+
): Promise<c.MatchingRefsResponseData> {
6258
const octokit = getOctokit()
6359
return (
6460
await octokit.request('GET /repos/{owner}/{repo}/git/matching-refs/tags/{tagPrefix}', {

0 commit comments

Comments
 (0)