From 1e811a05bd0be5d19ce2a1fc02c318cf99fcc4c0 Mon Sep 17 00:00:00 2001 From: Giulio Micheloni Date: Fri, 26 Jan 2024 16:22:03 +0100 Subject: [PATCH] fix map definitions --- dist/index/index.js | 6 +++--- src/index.ts | 4 ++-- src/utils.ts | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/dist/index/index.js b/dist/index/index.js index c75d27d..ecd0fc3 100644 --- a/dist/index/index.js +++ b/dist/index/index.js @@ -27042,7 +27042,7 @@ async function writeCacheMetadata(cachePath, metadata) { const namespaceFolderPath = external_path_.join(cachePath, "namespace"); const metadataFilePath = external_path_.join(namespaceFolderPath, "metadata.json"); const rawData = JSON.stringify(metadata); - external_fs_.writeFileSync(metadataFilePath, rawData, {}); + external_fs_.writeFileSync(metadataFilePath, rawData); } ;// CONCATENATED MODULE: ./src/index.ts @@ -27083,10 +27083,10 @@ async function main() { metadata.updatedAt = new Date().toISOString(); metadata.version = 1; if (!metadata.userRequest) { - metadata.userRequest = new Map(); + metadata.userRequest = {}; } for (const p of cachePaths) { - metadata.userRequest.set(p.pathInCache, { cacheFramework: p.framework, mountTarget: [p.mountTarget], source: ActionVersion }); + metadata.userRequest[p.pathInCache] = { cacheFramework: p.framework, mountTarget: [p.mountTarget], source: ActionVersion }; } writeCacheMetadata(localCachePath, metadata); const cacheUtilInfo = await getCacheSummaryUtil(localCachePath); diff --git a/src/index.ts b/src/index.ts index 7d177fd..b5c6863 100644 --- a/src/index.ts +++ b/src/index.ts @@ -51,11 +51,11 @@ async function main() { metadata.updatedAt = new Date().toISOString(); metadata.version = 1; if (!metadata.userRequest) { - metadata.userRequest = new Map(); + metadata.userRequest = {}; } for (const p of cachePaths) { - metadata.userRequest.set(p.pathInCache, {cacheFramework: p.framework, mountTarget: [p.mountTarget], source: ActionVersion}); + metadata.userRequest[p.pathInCache] = {cacheFramework: p.framework, mountTarget: [p.mountTarget], source: ActionVersion}; } utils.writeCacheMetadata(localCachePath, metadata); diff --git a/src/utils.ts b/src/utils.ts index 43d6a09..70d3496 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -30,7 +30,7 @@ export async function getCacheUtil(cachePath: string): Promise { export interface CacheMetadata { version?: number updatedAt?: string - userRequest?: Map + userRequest?: {[key: string]: CacheMount} preExecution?: ExecutionInfo postExecution?: ExecutionInfo } @@ -41,7 +41,7 @@ export interface CacheMount { } export interface ExecutionInfo { - usage: Map + usage: {[key: string]: number} } export async function ensureCacheMetadata(cachePath: string): Promise { @@ -61,5 +61,5 @@ export async function writeCacheMetadata(cachePath: string, metadata: CacheMetad const namespaceFolderPath = path.join(cachePath, "namespace"); const metadataFilePath = path.join(namespaceFolderPath, "metadata.json"); const rawData = JSON.stringify(metadata); - fs.writeFileSync(metadataFilePath, rawData, {}) + fs.writeFileSync(metadataFilePath, rawData) } \ No newline at end of file