@@ -99,14 +99,13 @@ export enum CacheHitKind {
9999
100100/** Represents results of trying to restore a dependency cache for a language. */
101101export interface DependencyCacheRestoreStatus {
102+ language : Language ;
102103 hit_kind : CacheHitKind ;
103104 download_duration_ms ?: number ;
104105}
105106
106107/** A partial mapping from languages to the results of restoring dependency caches for them. */
107- export type DependencyCacheRestoreStatusReport = Partial <
108- Record < Language , DependencyCacheRestoreStatus >
109- > ;
108+ export type DependencyCacheRestoreStatusReport = DependencyCacheRestoreStatus [ ] ;
110109
111110/**
112111 * Attempts to restore dependency caches for the languages being analyzed.
@@ -121,7 +120,7 @@ export async function downloadDependencyCaches(
121120 logger : Logger ,
122121 minimizeJavaJars : boolean ,
123122) : Promise < DependencyCacheRestoreStatusReport > {
124- const status : DependencyCacheRestoreStatusReport = { } ;
123+ const status : DependencyCacheRestoreStatusReport = [ ] ;
125124
126125 for ( const language of languages ) {
127126 const cacheConfig = getDefaultCacheConfig ( ) [ language ] ;
@@ -138,7 +137,7 @@ export async function downloadDependencyCaches(
138137 const globber = await makeGlobber ( cacheConfig . hash ) ;
139138
140139 if ( ( await globber . glob ( ) ) . length === 0 ) {
141- status [ language ] = { hit_kind : CacheHitKind . NoHash } ;
140+ status . push ( { language , hit_kind : CacheHitKind . NoHash } ) ;
142141 logger . info (
143142 `Skipping download of dependency cache for ${ language } as we cannot calculate a hash for the cache key.` ,
144143 ) ;
@@ -168,12 +167,9 @@ export async function downloadDependencyCaches(
168167 logger . info ( `Cache hit on key ${ hitKey } for ${ language } .` ) ;
169168 const hit_kind =
170169 hitKey === primaryKey ? CacheHitKind . Exact : CacheHitKind . Partial ;
171- status [ language ] = {
172- hit_kind,
173- download_duration_ms,
174- } ;
170+ status . push ( { language, hit_kind, download_duration_ms } ) ;
175171 } else {
176- status [ language ] = { hit_kind : CacheHitKind . Miss } ;
172+ status . push ( { language , hit_kind : CacheHitKind . Miss } ) ;
177173 logger . info ( `No suitable cache found for ${ language } .` ) ;
178174 }
179175 }
@@ -195,15 +191,14 @@ export enum CacheStoreResult {
195191
196192/** Represents results of trying to upload a dependency cache for a language. */
197193export interface DependencyCacheUploadStatus {
194+ language : Language ;
198195 result : CacheStoreResult ;
199196 upload_size_bytes ?: number ;
200197 upload_duration_ms ?: number ;
201198}
202199
203200/** A partial mapping from languages to the results of uploading dependency caches for them. */
204- export type DependencyCacheUploadStatusReport = Partial <
205- Record < Language , DependencyCacheUploadStatus >
206- > ;
201+ export type DependencyCacheUploadStatusReport = DependencyCacheUploadStatus [ ] ;
207202
208203/**
209204 * Attempts to store caches for the languages that were analyzed.
@@ -219,7 +214,7 @@ export async function uploadDependencyCaches(
219214 logger : Logger ,
220215 minimizeJavaJars : boolean ,
221216) : Promise < DependencyCacheUploadStatusReport > {
222- const status : DependencyCacheUploadStatusReport = { } ;
217+ const status : DependencyCacheUploadStatusReport = [ ] ;
223218 for ( const language of config . languages ) {
224219 const cacheConfig = getDefaultCacheConfig ( ) [ language ] ;
225220
@@ -235,7 +230,7 @@ export async function uploadDependencyCaches(
235230 const globber = await makeGlobber ( cacheConfig . hash ) ;
236231
237232 if ( ( await globber . glob ( ) ) . length === 0 ) {
238- status [ language ] = { result : CacheStoreResult . NoHash } ;
233+ status . push ( { language , result : CacheStoreResult . NoHash } ) ;
239234 logger . info (
240235 `Skipping upload of dependency cache for ${ language } as we cannot calculate a hash for the cache key.` ,
241236 ) ;
@@ -256,7 +251,7 @@ export async function uploadDependencyCaches(
256251
257252 // Skip uploading an empty cache.
258253 if ( size === 0 ) {
259- status [ language ] = { result : CacheStoreResult . Empty } ;
254+ status . push ( { language , result : CacheStoreResult . Empty } ) ;
260255 logger . info (
261256 `Skipping upload of dependency cache for ${ language } since it is empty.` ,
262257 ) ;
@@ -274,11 +269,12 @@ export async function uploadDependencyCaches(
274269 await actionsCache . saveCache ( cacheConfig . paths , key ) ;
275270 const upload_duration_ms = Math . round ( performance . now ( ) - start ) ;
276271
277- status [ language ] = {
272+ status . push ( {
273+ language,
278274 result : CacheStoreResult . Stored ,
279275 upload_size_bytes : Math . round ( size ) ,
280276 upload_duration_ms,
281- } ;
277+ } ) ;
282278 } catch ( error ) {
283279 // `ReserveCacheError` indicates that the cache key is already in use, which means that a
284280 // cache with that key already exists or is in the process of being uploaded by another
@@ -289,7 +285,7 @@ export async function uploadDependencyCaches(
289285 ) ;
290286 logger . debug ( error . message ) ;
291287
292- status [ language ] = { result : CacheStoreResult . Duplicate } ;
288+ status . push ( { language , result : CacheStoreResult . Duplicate } ) ;
293289 } else {
294290 // Propagate other errors upwards.
295291 throw error ;
0 commit comments